Vous êtes sur la page 1sur 4428

import abstract class CBehaviorGraphBlendMultipleCondNode_Transition{

}
import abstract class CStoryScenePreviewPlayer{
}
import abstract class ISerializable{
}
import struct IScriptable{
import public function ToString() : String;
import public function PushState(stateName : CName);
import public final function IsInState(stateName : CName) : Bool;
import public function PopState(popAll : Bool);
import public function GotoState(newState : CName, keepStack : Bool, for
ceEvents : Bool);
import public final function GotoStateAuto();
import public final function LogStates();
import public final function GetState(stateName : CName) : CScriptableSt
ate;
import public final function GetCurrentState() : CScriptableState;
import public final function GetCurrentStateName() : CName;
import public final function LockEntryFunction(lock : Bool);
import public final function SetCleanupFunction(functionName : CName);
import public final function ClearCleanupFunction();
import public final function DebugDumpEntryFunctionCalls(enabled : Bool)
;
}
import struct CObject{
import public function GetParent() : CObject;
import public function Clone(newParent : CObject) : CObject;
}
import abstract class IBehaviorGraphBlendMultipleCondNode_DampMethod{
}
import abstract class IBehaviorGraphBlendMultipleCondNode_Condition{
}
import abstract class SBehaviorGraphBoneInfo{
}
import abstract class IReferencable{
}
import abstract class IImporter{
}
import abstract class IExporter{
}
import abstract class IFactory{
}
import abstract class ICommandlet{
}
import abstract class CBehaviorGraphValueNode{
}

import abstract class CResource{


import public final function GetPath() : String;
}
import abstract class EngineTime{
}
import abstract class CScriptThread{
}
import struct CJournalResource{
import public final function GetEntry() : CJournalBase;
}
import struct CJournalCreatureDescriptionGroup{
}
import struct CJournalCreatureDescriptionEntry{
import public final function GetDescriptionStringId() : Int32;
}
import abstract class SBehaviorGraphMapToDiscreteMapper{
}
struct SAttributeTooltip{
var originName : CName;
var attributeName : String;
var attributeColor : String;
var value : Float;
var percentageValue : Bool;
var primaryStat : Bool;
}
import abstract class CBehaviorGraphStateTransitionNode{
}
import abstract class SBehaviorComboWay{
}
class W3RefillableContainer extends W3Container{
private saved var isEmpty : Bool;
private saved var checkedForBonusHerbs : Bool;
protected function IsEmpty() : Bool{
return isEmpty;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tmpName : CName;
var i : Int32;
var inv : CInventoryComponent;
super.OnSpawned(spawnData);
lockedByKey = false;
if (spawnData.restored && isEmpty){
AddTimer('Refill', 20, true, /* NOP */, /* NOP */, /* NO
P */, /* NOP */);
}
inv = GetInventory();
if (inv && !inv.IsEmpty(/* NOP */)){
SetFocusModeVisibility(1, /* NOP */);

}
/* NOP */;
}
protected function TakeAllItems(){
var inv : CInventoryComponent;
if (isEmpty){
return;
}
inv = GetInventory();
if (inv){
super.TakeAllItems();
}
isEmpty = true;
SetFocusModeVisibility(0, /* NOP */);
Enable(false, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
var null : array<SItemUniqueId>;
var null2 : array<Int32>;
var herbBonusChance : Float;
super.OnInteractionActivated(interactionComponentName, activator
);
if (activator == thePlayer && !checkedForBonusHerbs){
herbBonusChance = CalculateAttributeValue(thePlayer.GetA
ttributeValue('bonus_herb_chance', /* NOP */, /* NOP */), /* NOP */);
if (herbBonusChance > 0){
CheckForBonusHerbs(null, null2, herbBonusChance)
;
}
}
/* NOP */;
}
public timer function Refill(optional td : Float, optional id : Int32){
var inv : CInventoryComponent;
var oldMoney : Int32;
var i : Int32;
var oldItems : array<SItemUniqueId>;
var oldItemsCounts : array<Int32>;
var herbBonusChance : Float;
inv = GetInventory();
if (inv && inv.IsLootRenewable()){
if (inv.IsReadyToRenew()){
PreRefillContainer();
}
if (isPlayerInActivationRange){
oldMoney = inv.GetMoney();
herbBonusChance = CalculateAttributeValue(thePla
yer.GetAttributeValue('bonus_herb_chance', /* NOP */, /* NOP */), /* NOP */);
if (herbBonusChance > 0){
inv.GetAllItems(oldItems);
oldItemsCounts.Resize(oldItems.Size());
i = 0;
while (i < oldItems.Size()){
oldItemsCounts[i] = inv.GetItemQ
uantity(oldItems[i]);
i += 1;
}
}

}
inv.UpdateLoot();
checkedForBonusMoney = false;
checkedForBonusHerbs = false;
if (isPlayerInActivationRange){
checkedForBonusMoney = true;
checkedForBonusHerbs = true;
CheckForBonusMoney(oldMoney);
if (herbBonusChance > 0){
CheckForBonusHerbs(oldItems, oldItemsCou
nts, herbBonusChance);
}
}
if (!inv.IsEmpty(/* NOP */)){
isEmpty = false;
SetFocusModeVisibility(1, /* NOP */);
ApplyAppearance("1_full");
Enable(true, /* NOP */, /* NOP */);
RemoveTimer('Refill', /* NOP */);
}
} else {
RemoveTimer('Refill', /* NOP */);
}
/* NOP */;
}
private function CheckForBonusHerbs(oldItems : array<SItemUniqueId>, old
ItemsQuantities : array<Int32>, bonusChance : Float){
var oldHerbNames : array<CName>;
var newHerbNames : array<CName>;
var oldHerbQuantities : array<Int32>;
var newHerbQuantities : array<Int32>;
var newItemsCounts : array<Int32>;
var newItems : array<SItemUniqueId>;
var i : Int32;
var ind : Int32;
var dm : CDefinitionsManagerAccessor;
GetHerbsData(oldItems, oldItemsQuantities, oldHerbNames, oldHerb
Quantities);
if (inv){
inv.GetAllItems(newItems);
}
newItemsCounts.Resize(newItems.Size());
i = 0;
while (i < newItems.Size()){
newItemsCounts[i] = inv.GetItemQuantity(newItems[i]);
i += 1;
}
GetHerbsData(newItems, newItemsCounts, newHerbNames, newHerbQuan
tities);
i = 0;
while (i < newHerbNames.Size()){
ind = oldHerbNames.FindFirst(newHerbNames[i]);
if (ind == -1){
} else {
newHerbQuantities[i] -= oldHerbQuantities[ind];
}
i += 1;
}
if (inv){
dm = theGame.GetDefinitionsManager();

i = 0;
while (i < newHerbNames.Size()){
if (newHerbQuantities[i] <= 0){
} else if (dm.ItemHasTag(newHerbNames[i], 'Quest
')){
} else if (RandF() > bonusChance){
} else {
inv.AddAnItem(newHerbNames[i], 1, true,
true, /* NOP */);
}
i += 1;
}
}
/* NOP */;
}
private function GetHerbsData(items : array<SItemUniqueId>, itemsQuantit
ies : array<Int32>, herbNames : array<CName>, herbQuantities : array<Int32>){
var i : Int32;
var ind : Int32;
var herbName : CName;
if (!inv){
return;
}
i = 0;
while (i < items.Size()){
if (inv.ItemHasTag(items[i], 'HerbGameplay')){
herbName = inv.GetItemName(items[i]);
ind = herbNames.FindFirst(herbName);
if (ind == -1){
herbNames.PushBack(herbName);
herbQuantities.PushBack(inv.GetItemQuant
ity(items[i]));
} else {
herbQuantities[ind] += inv.GetItemQuanti
ty(items[i]);
}
}
i += 1;
}
/* NOP */;
}
protected function PreRefillContainer(){
}
}
import abstract class CBehaviorGraphAnimationNode{
}
import abstract class SBehaviorComboElem{
}
import abstract class IBehaviorGraphComboModifier{
}
import struct CWitcherSword{
public editable var padBacklightColor : Vector;
public var oilLevel : Int32;
public var runeCount : Int32;
import public function GetSwordType() : EWitcherSwordType;
public function Initialize(actor : CActor){

var inv : CInventoryComponent;


var swordCategory : CName;
var myItemId : SItemUniqueId;
var stateName : CName;
var swordType : EWitcherSwordType;
var abilities : array<CName>;
inv = (CInventoryComponent)actor.GetComponentByClassName('CInven
toryComponent');
swordType = GetSwordType();
switch(swordType){
case 0:
swordCategory = 'silversword';
break;
case 1:
swordCategory = 'steelsword';
break;
}
myItemId = inv.GetItemByItemEntity(this);
inv.GetItemAbilitiesWithTag(myItemId, theGame.params.OIL_ABILITY
_TAG, abilities);
ApplyOil(abilities);
runeCount = inv.GetItemEnhancementCount(myItemId);
UpdateEnhancements(runeCount);
stateName = actor.GetCurrentStateName();
if (swordType == 0 && stateName == 'CombatSilver' || swordType =
= 1 && stateName == 'CombatSteel'){
PlayEffect('rune_blast_loop', /* NOP */);
} else {
PlayEffect('rune_blast_long', /* NOP */);
}
/* NOP */;
}
public function OnGrab() : Bool{
super.OnGrab();
Initialize((CActor)GetParentEntity());
GetWitcherPlayer().ResetPadBacklightColor(/* NOP */);
/* NOP */;
}
public function OnPut() : Bool{
super.OnPut();
StopAllEffects();
GetWitcherPlayer().ResetPadBacklightColor(true);
/* NOP */;
}
public function ApplyOil(oilAbilities : array<CName>){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var oilFx : CName;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
dm = theGame.GetDefinitionsManager();
dm.GetAbilitiesAttributeValue(oilAbilities, 'level', min, max, /
* NOP */);
oilLevel = CalculateAttributeValue(min, /* NOP */);
oilFx = GetOilFxName();
PlayEffect(oilFx, /* NOP */);
/* NOP */;
}
public function RemoveOil(){
var oilFx : CName;

oilFx = GetOilFxName();
StopEffect(oilFx);
oilLevel = 0;
/* NOP */;
}
public function GetOilFxName() : CName{
var oilFx : CName;
switch(oilLevel){
case 0:
oilFx = 'oil_lvl0';
break;
case 1:
oilFx = 'oil_lvl1';
break;
case 2:
oilFx = 'oil_lvl2';
break;
case 3:
oilFx = 'oil_lvl3';
break;
}
return oilFx;
/* NOP */;
}
public function GetRuneFxName() : CName{
var runeFx : CName;
switch(runeCount){
case 0:
runeFx = 'rune_lvl0';
break;
case 1:
runeFx = 'rune_lvl1';
break;
case 2:
runeFx = 'rune_lvl2';
break;
case 3:
runeFx = 'rune_lvl3';
break;
}
return runeFx;
/* NOP */;
}
public function UpdateEnhancements(newRuneCount : Int32){
var fx : CName;
fx = GetRuneFxName();
StopEffect(fx);
runeCount = newRuneCount;
fx = GetRuneFxName();
PlayEffect(fx, /* NOP */);
/* NOP */;
}
}
import abstract class CBehaviorGraphComboTransitionInterface{
}
import abstract class SBehaviorComboAnimation{
}

import abstract class SBehaviorComboLevel{


}
import abstract class SBehaviorComboAnim{
}
import abstract class IBehaviorStateTransitionCondition{
}
import abstract class SBehaviorGraphTransitionSetInternalVariable{
}
import abstract class CBehaviorGraphStateNode{
}
struct Runeword{
var wordName : CName;
var runes : array<CName>;
var abilities : array<CName>;
}
import abstract class CBehaviorGraphStateTransitionGlobalBlendNode{
}
import abstract class CBehaviorVectorVariable{
}
class W3DurationObstacle extends CGameplayEntity{
protected editable var lifeTimeDuration : SRangeF;
protected editable var disappearanceEffectDuration : Float;
protected editable var disappearEffectName : CName;
protected editable var simplyStopEffect : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (lifeTimeDuration.min > 0 || lifeTimeDuration.max > 0){
AddTimer('Disappear', RandRangeF(lifeTimeDuration.max, l
ifeTimeDuration.min), false, /* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public timer function Disappear(optional delta : Float, optional id : In
t32){
if (simplyStopEffect){
StopEffect(disappearEffectName);
} else {
PlayEffect(disappearEffectName, /* NOP */);
}
AddTimer('DestroyTimer', disappearanceEffectDuration, false, /*
NOP */, /* NOP */, true, /* NOP */);
SpecificDisappear();
/* NOP */;
}
private function SpecificDisappear(){
}
}
import abstract class IBehaviorConstraintObject{
}
import abstract class SLookAtAnimationPairInputBasedDefinition{
}

import abstract class SLookAtAnimationPairDefinition{


}
import abstract class SSynchronizeAnimationToParentDefinition{
}
class W3NewDoor extends W3LockableEntity{
public editable var openAngle : Float;
public editable var initiallyOpened : Bool;
public editable var factOnPlayerDoorOpen : CName;
public editable var openedByHorse : Bool;
private autobind doorsCmp : CDoorComponent = single;
private autobind lockedCmp : CInteractionComponent = "Locked";
private autobind unlockCmp : CInteractionComponent = "Unlock";
private autobind lockedDA : CDeniedAreaComponent = "LockedDeniedArea";
private autobind rigidMeshCmp : CRigidMeshComponent = single;
private var updateDuration : Float;
private var updateTimeLeft : Float;
private var playerInsideTrapdoorTrigger : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
SetFocusModeVisibility(1, /* NOP */);
/* NOP */;
}
public function GetOpeningAngle() : Float{
return openAngle;
/* NOP */;
}
public function OnPlayerOpenedDoors() : Bool{
if (factOnPlayerDoorOpen){
FactsAdd(factOnPlayerDoorOpen, 1, 3);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var activatorPlayer : CPlayer;
var activatorNPC : CNewNPC;
var doorPos : Vector;
var activatorPos : Vector;
var horse : CGameplayEntity;
var horseComp : W3HorseComponent;
if (!doorsCmp){
return true;
}
super.OnAreaEnter(area, activator);
activatorPlayer = (CPlayer)activator.GetEntity();
activatorNPC = (CNewNPC)activator.GetEntity();
if (activatorNPC && isEnabled){
doorsCmp.AddDoorUser(activatorNPC);
activatorNPC.SignalGameplayEventParamObject('AI_DoorTrig
gerEntered', this);
if (doorsCmp.IsInteractive()){
doorsCmp.Open(false, false);
}
} else if (activatorPlayer){
if (doorsCmp.IsTrapdoor()){
activatorPos = activatorPlayer.GetWorldPosition(
);

doorPos = GetWorldPosition();
if (activatorPos.Z < doorPos.Z - 0.100000){
doorsCmp.Open(false, false);
} else {
playerInsideTrapdoorTrigger = true;
}
}
if (!doorsCmp.IsInteractive()){
doorsCmp.AddDoorUser(activatorPlayer);
}
}
if (openedByHorse){
if (activatorPlayer && activatorPlayer.IsUsingHorse(/* N
OP */)){
horse = activatorPlayer.GetUsedVehicle();
horseComp = (W3HorseComponent)horse.GetComponent
ByClassName('W3HorseComponent');
horseComp.IncrementIgnoreTestsCounter();
}
}
/* NOP */;
}
public function IsOpen() : Bool{
if (doorsCmp){
return doorsCmp.IsOpen();
}
return true;
/* NOP */;
}
public function Unlock(){
super.Unlock();
if (theGame.IsActive()){
lockedDA.SetEnabled(false);
}
/* NOP */;
}
protected function OnLock(){
super.OnLock();
if (theGame.IsActive()){
lockedDA.SetEnabled(true);
}
/* NOP */;
}
public function OnOpened() : Bool{
lockedDA.SetEnabled(false);
/* NOP */;
}
public function OnCombatStarted() : Bool{
lockedDA.SetEnabled(true);
/* NOP */;
}
public function OnCombatEnded() : Bool{
if (!lockedByKey && isEnabled){
lockedDA.SetEnabled(false);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var activatorNPC : CNewNPC;

var activatorPlayer : CPlayer;


var horse : CGameplayEntity;
var horseComp : W3HorseComponent;
super.OnAreaExit(area, activator);
activatorNPC = (CNewNPC)activator.GetEntity();
activatorPlayer = (CPlayer)activator.GetEntity();
if (activatorNPC){
activatorNPC.SignalGameplayEventParamObject('AI_DoorTrig
gerExit', this);
}
if (activatorPlayer){
playerInsideTrapdoorTrigger = false;
}
if (doorsCmp){
doorsCmp.Unsuppress();
}
if (openedByHorse){
if (activatorPlayer && activatorPlayer.IsUsingHorse(/* N
OP */)){
horse = activatorPlayer.GetUsedVehicle();
horseComp = (W3HorseComponent)horse.GetComponent
ByClassName('W3HorseComponent');
horseComp.DecrementIgnoreTestsCounter(/* NOP */)
;
}
}
/* NOP */;
}
public function OnStateChange(newState : Bool) : Bool{
super.OnStateChange(newState);
if (doorsCmp){
doorsCmp.EnebleDoors(newState);
}
/* NOP */;
}
public function OnActionNameChanged() : Bool{
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.ForceInteractionUpdate();
}
/* NOP */;
}
public function Enable(e : Bool, skipInteractionUpdate : Bool, questForc
edEnable : Bool){
super.Enable(e, skipInteractionUpdate, questForcedEnable);
if (doorsCmp){
doorsCmp.EnebleDoors(e);
doorsCmp.SetEnabled(e);
}
if (theGame.IsActive()){
if (!e){
lockedDA.SetEnabled(true);
} else if (!lockedByKey){
lockedDA.SetEnabled(false);
}
}
/* NOP */;
}
public function OnManageNewDoor(operations : array<ENewDoorOperation>, f

orce : Bool) : Bool{


var i : Int32;
var size : Int32;
size = operations.Size();
i = 0;
while (i < size){
switch(operations[i]){
case 0:
if (force){
doorsCmp.InstantOpen(true);
} else {
doorsCmp.Open(false, false);
}
break;
case 1:
if (force){
doorsCmp.InstantClose();
} else {
doorsCmp.Close(true);
}
break;
case 3:
if (!IsLocked()){
Lock('anykey', /* NOP */, /* NOP */);
}
break;
case 4:
if (IsLocked()){
Unlock();
}
break;
case 5:
ToggleLock();
break;
}
i += 1;
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (!playerInsideTrapdoorTrigger){
super.OnInteraction(actionName, activator);
updateTimeLeft = updateDuration;
AddTimer('UpdateIconOffset', 0.010000, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnDoorActivation() : Bool{
if (doorsCmp){
if (initiallyOpened && !lockedByKey){
doorsCmp.InstantOpen(true);
}
}
/* NOP */;
}
public function OnStreamIn() : Bool{
super.OnStreamIn();
/* NOP */;

}
public final timer function UpdateIconOffset(optional delta : Float, opt
ional id : Int32){
var l_gameplayEnt : CGameplayEntity;
var l_localToWorld : Matrix;
var l_worldToLocal : Matrix;
var l_slotMatrix : Matrix;
var l_slotWorldPos : Vector;
var l_offset : Vector;
var l_box : Box;
if (CalcEntitySlotMatrix('handle', l_slotMatrix)){
l_localToWorld = GetLocalToWorld();
l_worldToLocal = doorsCmp.InvertMatrixForDoor(l_localToW
orld);
l_slotWorldPos = MatrixGetTranslation(l_slotMatrix);
l_offset = VecTransform(l_worldToLocal, l_slotWorldPos);
doorsCmp.SetIconOffset(l_offset);
lockedCmp.SetIconOffset(l_offset);
unlockCmp.SetIconOffset(l_offset);
}
updateTimeLeft -= delta;
if (updateTimeLeft <= 0){
RemoveTimer('UpdateIconOffset', /* NOP */);
}
/* NOP */;
}
}
class CExplorationStateManager extends CSelfUpdatingComponent{
public var m_OwnerE : CGameplayEntity;
public var m_OwnerMAC : CMovingPhysicalAgentComponent;
public editable inlined var m_InputO : CExplorationInput;
public editable inlined var m_MoverO : CExplorationMover;
public editable inlined var m_SharedDataO : CExplorationSharedData;
public editable inlined var m_CollisionManagerO : CExplorationCollisionM
anager;
public editable inlined var m_MovementCorrectorO : CExplorationMovementC
orrector;
private var m_SuperStateLastN : CName;
private var m_StatesSArr : array<CExplorationStateAbstract>;
private var m_StatesUpdatedInactiveSArr : array<CExplorationStateAbstrac
t>;
private var m_StateNamesSArr : array<CName>;
private var m_StateTransitionsSArr : array<CExplorationStateTransitionAb
stract>;
private var m_StateLastN : CName;
private var m_StateLastI : Int32;
private var m_StateCurN : CName;
private var m_StateCurI : Int32;
private var m_StateTimeCurF : Float;
private var m_StateTimeLastF : Float;
private var m_StateGlobalQueuedN : CName;
private var m_StateDefaultN : CName;
private const var c_InvalidStateN : CName;
private const var c_InvalidStateI : Int32;
private var m_StateChanged : Bool;
private var m_StateExitedFromBehN : CName;
private var m_StateEnteredFromBehN : CName;
private var m_BehaviorConfirmStateE : EBehGraphConfirmationState;
private var m_StateBehCurReportedN : CName;

public editable inlined var m_DefaultCameraSetS : CCameraParametersSet;


private var m_IsOnGroundB : Bool;
private var m_TeleportedFallHackTime : Float;
private editable var m_TeleportedFallHackTimeTotalF : Float;
private var m_storedInteractionPri : EInteractionPriority;
private var m_NoSaveLock : Int32;
private var m_NoSaveLockStringS : String;
private var m_ActiveB : Bool;
private var m_InitializedB : Bool;
public var m_IsDebugModeB : Bool;
public var m_DebugPointV : Vector;
public var m_SmoothedVelocityV : Vector;
public function OnComponentAttached() : Bool{
var l_EntityE : CGameplayEntity;
var l_ActorE : CActor;
var l_MAC : CMovingPhysicalAgentComponent;
InitExplorationLogs();
if (!theGame.IsActive()){
return true;
}
l_EntityE = (CGameplayEntity)GetEntity();
l_ActorE = (CActor)l_EntityE;
if (l_ActorE){
l_MAC = (CMovingPhysicalAgentComponent)l_ActorE.GetMovin
gAgentComponent();
if (!l_MAC){
LogExplorationError("Owner is has no CMovingPhys
icalAgentComponent");
}
} else {
LogExplorationError("Owner is not an actor");
}
Initialize(l_EntityE, l_MAC);
return true;
/* NOP */;
}
public function Initialize(_OwnerEntityE : CGameplayEntity, _OwnerEntity
MAC : CMovingPhysicalAgentComponent){
var test : Bool;
if (theGame.IsFinalBuild()){
m_IsDebugModeB = false;
}
m_OwnerE = _OwnerEntityE;
m_OwnerMAC = _OwnerEntityMAC;
if (!m_InputO){
m_InputO = new CExplorationInput in this;
}
m_InputO.Initialize(this);
if (!m_MoverO){
m_MoverO = new CExplorationMover in this;
}
m_MoverO.Initialize(this);
if (!m_CollisionManagerO){
m_CollisionManagerO = new CExplorationCollisionManager i
n this;
}
m_CollisionManagerO.Initialize(this);
if (!m_MovementCorrectorO){
m_MovementCorrectorO = new CExplorationMovementCorrector
in this;

}
m_MovementCorrectorO.Initialize(this);
if (m_SharedDataO){
test = true;
} else {
m_SharedDataO = new CExplorationSharedData in this;
}
m_SharedDataO.Initialize(this);
m_OwnerMAC.RegisterEventListener(this);
if (!m_DefaultCameraSetS){
LogExplorationWarning("There is no default camera parame
ters set, camera won't be set to defautl after each state change");
}
RessetCameraOffset();
GrabStateComponents();
Restart();
m_InitializedB = true;
LogExploration("Finished initialization");
LogExploration("----------------------------------------------------------------------------");
LogExploration("----------------------------------------------------------------------------");
/* NOP */;
}
private function GrabStateComponents(){
var i : Int32;
var l_StatesCountI : Int32;
var l_ComponentsStateCArr : array<CComponent>;
var l_ComponentsTransitionCArr : array<CComponent>;
var l_TransitionO : CExplorationStateTransitionAbstract;
l_ComponentsStateCArr = m_OwnerE.GetComponentsByClassName('CExpl
orationStateAbstract');
LogExploration("Found " + l_ComponentsStateCArr.Size() + " Explo
ration states");
l_StatesCountI = l_ComponentsStateCArr.Size() + 1;
m_StatesSArr.Resize(l_StatesCountI);
m_StateNamesSArr.Resize(l_StatesCountI);
m_StatesUpdatedInactiveSArr.Clear();
m_StatesSArr[c_InvalidStateI] = new CExplorationStateInvalid in
this;
m_StatesSArr[c_InvalidStateI].Initialize(this);
i = 1;
while (i < m_StatesSArr.Size()){
m_StatesSArr[i] = (CExplorationStateAbstract)l_Component
sStateCArr[i - 1];
if (m_StatesSArr[i]){
m_StatesSArr[i].Initialize(this);
m_StateNamesSArr[i] = m_StatesSArr[i].GetStateNa
me();
if (m_StatesSArr[i].m_UpdatesWhileInactiveB){
m_StatesUpdatedInactiveSArr.PushBack(m_S
tatesSArr[i]);
}
} else {
LogExploration("Wrong state: " + l_ComponentsSta
teCArr[i].GetName());
}
i += 1;
}
i = 0;

while (i < m_StatesSArr.Size()){


m_StatesSArr[i].PostInitialize();
i += 1;
}
FindAndReportProblemsWithStates();
i = 0;
while (i < l_ComponentsStateCArr.Size()){
l_TransitionO = (CExplorationStateTransitionAbstract)l_C
omponentsStateCArr[i];
if (l_TransitionO){
m_StateTransitionsSArr.PushBack(l_TransitionO);
}
i += 1;
}
LogExploration("Found : " + m_StateTransitionsSArr.Size() + " Tr
ansition states");
/* NOP */;
}
private function FindAndReportProblemsWithStates(){
var i : Int32;
if (FindState(c_InvalidStateN) != c_InvalidStateI){
LogExplorationError("Invalid state should not be placed
on the entity template");
}
if (FindState(m_StateDefaultN) == c_InvalidStateI){
LogExplorationError("Missing default state");
}
i = 1;
while (i < m_StatesSArr.Size()){
if (m_StatesSArr[i].GetStateType() == 0){
LogExplorationError(m_StatesSArr[i].GetStateName
() + ": Missing state type. Add it on the script of the state");
}
i += 1;
}
/* NOP */;
}
private function FindState(stateName : CName) : Int32{
var i : Int32;
if (!IsNameValid(stateName)){
return c_InvalidStateI;
}
i = 0;
while (i < m_StatesSArr.Size()){
if (m_StatesSArr[i].GetStateName() == stateName){
return i;
}
i += 1;
}
return c_InvalidStateI;
/* NOP */;
}
public function Restart(){
var i : Int32;
i = 0;
while (i < m_StatesSArr.Size()){
m_StatesSArr[i].Restart();
i += 1;
}
m_StateBehCurReportedN = 'None';

m_StateGlobalQueuedN = c_InvalidStateN;
m_StateCurN = c_InvalidStateN;
m_StateCurI = c_InvalidStateI;
m_StateTimeCurF = 0.000000;
m_StateTimeLastF = 0.000000;
StateTryToChangeTo(m_StateDefaultN);
m_SharedDataO.Reset();
m_MoverO.Reset();
m_SuperStateLastN = 'None';
theGame.ReleaseNoSaveLockByName(m_NoSaveLockStringS);
/* NOP */;
m_ActiveB = true;
LogExploration("RESTARTED");
/* NOP */;
}
public function OnComponentTick(_Dt : Float) : Bool{
Update(_Dt);
/* NOP */;
}
public function Update(_Dt : Float){
var l_NewStateN : CName;
UpdateSuperStateChange();
if (m_IsDebugModeB){
UpdateDebugInfo();
}
if (!m_ActiveB || !theGame.IsActive() || theGame.IsPaused()){
return;
}
PreUpdate(_Dt);
StateChangeUpdate();
UpdateStates(_Dt);
PostUpdate(_Dt);
/* NOP */;
}
private function UpdateDebugInfo(){
var auxString : String;
var auxName : CName;
var weaponName : String;
var auxVector : Vector;
var auxFloat : Float;
var textColor : Color;
var width : Int32;
var height : Int32;
var heightCur : Int32;
var heightInit : Int32;
var heightInactive : Int32;
var heightOffset : Int32;
var heightOffsetBig : Int32;
var left : Int32;
var right : Int32;
var leftFar : Int32;
var titleOffset : Int32;
var i : Int32;
textColor = Color(255, 255, 0);
width = 200;
height = 10;
heightInit = 400;
heightInactive = 300;
heightOffset = 15;
heightOffsetBig = 25;

left = 250;
right = 700;
leftFar = 200;
titleOffset = -30;
heightCur = heightInit;
thePlayer.GetVisualDebug().AddBar('labelStates', right + titleOf
fset, heightCur, width, height, 0.000000, textColor, "States", 0.000000);
heightCur += heightOffset;
auxString = "PlayerState: " + m_StateCurN;
auxString += " " + m_StatesSArr[m_StateCurI].GetDebugText();
if (!m_ActiveB){
auxString += " ( Inactive )";
}
thePlayer.GetVisualDebug().AddBar('PlayerState', right, heightCu
r, width, height, 0.000000, textColor, auxString, 0.000000);
heightCur += heightOffset;
auxString = "Last State: " + m_StateLastN + " time: " + m_StateT
imeLastF;
thePlayer.GetVisualDebug().AddBar('LastState', right, heightCur,
width, height, 0.000000, textColor, auxString, 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('SuperState', right, heightCur
, width, height, 0.000000, textColor, "Super State: " + m_SuperStateLastN, 0.000
000);
heightCur += heightOffset;
auxString = m_OwnerMAC.GetPhysicalState();
thePlayer.GetVisualDebug().AddBar('PhysicalState', right, height
Cur, width, height, 0.000000, textColor, "Physical State: " + auxString, 0.00000
0);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('IsInAir', right, heightCur, w
idth, height, 0.000000, textColor, "IsInAir: " + thePlayer.IsInAir(), 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('HasGround', right, heightCur,
width, height, 0.000000, textColor, "HasGround: " + m_IsOnGroundB, 0.000000);
heightCur += heightOffset;
auxString = "Position: " + VecToStringPrec(m_OwnerE.GetWorldPosi
tion(), 2) + "...Forward: " + VecToStringPrec(m_OwnerE.GetWorldForward(), 1) + "
...Heading: " + m_OwnerE.GetHeading();
thePlayer.GetVisualDebug().AddBar('PlayerPosAndForward', right,
heightCur, width, height, 0.000000, textColor, auxString, 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('VelocityLogic', right, height
Cur, width, height, 0.000000, textColor, "Velocity Logic: " + m_MoverO.GetMoveme
ntSpeedF(), 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('VelocityMAC', right, heightCu
r, width, height, 0.000000, textColor, "Velocity MAC: " + VecLength(m_OwnerMAC.G
etVelocity()), 0.000000);
heightCur += heightOffset;
m_SmoothedVelocityV = m_SmoothedVelocityV * 0.900000 + m_OwnerMA
C.GetVelocity() * 0.100000;
thePlayer.GetVisualDebug().AddBar('Velocity2DMAC', right, height
Cur, width, height, 0.000000, textColor, "Velocity2DMAC: " + VecLength2D(m_Smoot
hedVelocityV), 0.000000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('labelCamera', right + titleOf
fset, heightCur, width, height, 0.000000, textColor, "Camera", 0.000000);
heightCur += heightOffset;
auxName = theGame.GetGameCamera().GetActivePivotPositionControll

er().controllerName;
thePlayer.GetVisualDebug().AddBar('CamPivot', right, heightCur,
width, height, 0.000000, textColor, "Camera Position controller: " + auxName, 0.
000000);
heightCur += heightOffset;
auxName = theGame.GetGameCamera().GetActivePivotRotationControll
er().controllerName;
thePlayer.GetVisualDebug().AddBar('CamRot', right, heightCur, wi
dth, height, 0.000000, textColor, "Camera Rotation controller: " + auxName, 0.00
0000);
heightCur += heightOffset;
auxName = theGame.GetGameCamera().GetActivePivotDistanceControll
er().controllerName;
thePlayer.GetVisualDebug().AddBar('CamDist', right, heightCur, w
idth, height, 0.000000, textColor, "Camera Distance controller: " + auxName, 0.0
00000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('SavingEnabled', right + title
Offset, heightCur, width, height, 0.000000, textColor, "Save allowed: " + !theGa
me.AreSavesLocked(), 0.000000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('Turn Adjustment', right + tit
leOffset, heightCur, width, height, 0.000000, textColor, "Turn adjusting: " + m_
MovementCorrectorO.IsTurnAdjusted(), 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('Turn any Adjustment', right +
titleOffset, heightCur, width, height, 0.000000, textColor, "Movement adjusting
: " + m_OwnerMAC.GetMovementAdjustor().HasAnyActiveRequest(), 0.000000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('labelIK', right + titleOffset
, heightCur, width, height, 0.000000, textColor, "IK", 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('IK feet', right, heightCur, w
idth, height, 0.000000, textColor, "IK Feet: " + m_OwnerMAC.GetEnabledFeetIK(),
0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('IK Slide', right, heightCur,
width, height, 0.000000, textColor, "IK slope: " + m_OwnerMAC.GetEnabledSlidingO
nSlopeIK(), 0.000000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('Label Correction', right + ti
tleOffset, heightCur, width, height, 0.000000, textColor, "Correction", 0.000000
);
heightCur += heightOffset;
auxString = "Corrected " + m_MovementCorrectorO.GetDebugText();
thePlayer.GetVisualDebug().AddBar('Correction', right, heightCur
, width, height, 0.000000, textColor, auxString, 0.000000);
heightCur = heightInit;
thePlayer.GetVisualDebug().AddBar('labelInput', left + titleOffs
et, heightCur, width, height, 0.000000, textColor, "Input", 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('InputContext', left, heightCu
r, width, height, 0.000000, textColor, "Input context: " + theInput.GetContext()
, 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('labelWeapons', left + titleOf
fset, heightCur, width, height, 0.000000, textColor, "Weapons", 0.000000);
if (thePlayer.IsWeaponHeld('fist')){
weaponName = "fist";
} else if (thePlayer.IsWeaponHeld('silversword')){

weaponName = "silversword";
} else if (thePlayer.IsWeaponHeld('steelsword')){
weaponName = "steelsword";
} else {
weaponName = "None";
}
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('LeftHandI', left, heightCur,
width, height, 0.000000, textColor, "Item Weapon: " + weaponName, 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('LeftHandL', left, heightCur,
width, height, 0.000000, textColor, "Logic Weapon: " + thePlayer.GetCurrentMelee
WeaponName(), 0.000000);
heightCur += heightOffsetBig;
thePlayer.GetVisualDebug().AddBar('labelSlide', left + titleOffs
et, heightCur, width, height, 0.000000, textColor, "Slide", 0.000000);
heightCur += heightOffset;
thePlayer.GetVisualDebug().AddBar('TerrainMaterial', left, heigh
tCur, width, height, 0.000000, Color(255, 255, 0), "Material: " + m_OwnerMAC.Get
MaterialName(), 0.000000);
heightCur += heightOffset;
auxString = "Preset: " + m_SharedDataO.terrainSlidePresetName;
auxString += " : SlideMin " + m_MoverO.ConvertCoefToAngleDegree(
m_MoverO.GetSlidingLimitMinCur());
auxString += ", SlideMax " + m_MoverO.ConvertCoefToAngleDegree(m
_MoverO.GetSlidingLimitMax());
thePlayer.GetVisualDebug().AddBar('TerrainPreset', left, heightC
ur, width, height, 0.000000, Color(255, 255, 0), auxString, 0.000000);
heightCur += heightOffset;
auxFloat = m_MoverO.GetRealSlideAngle();
thePlayer.GetVisualDebug().AddBar('RawSlideAngle', left, heightC
ur, width, height, 0.000000, Color(255, 255, 0), "Real raw terrain angle: " + au
xFloat, 0.000000);
heightCur += heightOffset;
auxFloat = m_MoverO.GetRealWideSlideAngle();
auxFloat = m_MoverO.ConvertCoefToAngleDegree(auxFloat);
thePlayer.GetVisualDebug().AddBar('RawWideSlideAngle', left, hei
ghtCur, width, height, 0.000000, Color(255, 255, 0), "Real raw wide terrain angl
e: " + auxFloat, 0.000000);
heightCur += heightOffsetBig;
auxFloat = m_OwnerMAC.GetSlideCoef();
thePlayer.GetVisualDebug().AddBar('SlideCoefDamp', left, heightC
ur, width, height, 0.000000, textColor, "Slide coef damped: " + auxFloat, 0.0000
00);
heightCur += heightOffset;
auxFloat = m_MoverO.GetSlideCoefFromTerrain();
thePlayer.GetVisualDebug().AddBar('SlideCoefInst', left, heightC
ur, width, height, 0.000000, textColor, "Slide coef instant: " + auxFloat, 0.000
000);
heightCur += heightOffset;
auxFloat = m_MoverO.GetSlideWideCoefFromTerrain(true);
auxVector = m_MoverO.m_WideNormalAverageV;
thePlayer.GetVisualDebug().AddBar('NormalWideAVG', left, heightC
ur, width, height, 0.000000, Color(255, 255, 0), "Normal coef Wide AVG: " + auxF
loat + " " + VecToString(auxVector), 0.000000);
heightCur += heightOffset;
auxFloat = m_MoverO.GetSlideWideCoefFromTerrain(false);
auxVector = m_MoverO.m_WideNormalGlobalV;
thePlayer.GetVisualDebug().AddBar('NormalWideGlbl', left, height
Cur, width, height, 0.000000, Color(255, 255, 0), "Normal coef Wide Global: " +

auxFloat + " " + VecToString(auxVector), 0.000000);


heightCur += heightOffset;
auxVector = m_OwnerMAC.GetTerrainNormal(true);
thePlayer.GetVisualDebug().AddBar('NormalDamped', left, heightCu
r, width, height, 0.000000, textColor, "Normal coef damped: " + auxVector.Z, 0.0
00000);
heightCur += heightOffset;
auxVector = VecNormalize(m_OwnerMAC.GetTerrainNormal(false));
thePlayer.GetVisualDebug().AddBar('NormalInstant', left, heightC
ur, width, height, 0.000000, textColor, "Normal coef Instant: " + auxVector.Z, 0
.000000);
heightCur = heightInactive;
heightCur = m_SharedDataO.DrawDebugText(leftFar, heightCur, heig
htOffset, width, height, textColor);
i = 0;
while (i < m_StatesSArr.Size()){
auxString = m_StatesSArr[i].GetDebugTextInactive();
if (auxString != ""){
heightCur += heightOffset;
auxName = m_StatesSArr[i].GetStateName();
thePlayer.GetVisualDebug().AddBar(auxName, leftF
ar, heightCur, width, height, 0.000000, textColor, auxName + auxString, 0.000000
);
}
i += 1;
}
DebugDisplayActionLocks();
m_CollisionManagerO.UpdateDebugInfo();
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags) : Bool{
var i : Int32;
i = 0;
while (i < m_StatesSArr.Size()){
m_StatesSArr[i].OnVisualDebug(frame, flag, i == m_StateC
urI);
i += 1;
}
m_MovementCorrectorO.OnVisualDebug(frame, flag);
m_CollisionManagerO.OnVisualDebug(frame, flag);
frame.DrawSphere(m_DebugPointV, 0.200000, Color(100, 100, 100));
return true;
/* NOP */;
}
public function SetDebugPoint(point : Vector){
m_DebugPointV = point;
/* NOP */;
}
private function DebugDisplayActionLocks(){
var actionLocks : array<array<SInputActionLock>>;
var numLocks : Int32;
var i : Int32;
var j : Int32;
var heightCur : Int32;
var textColor : Color;
var auxString : String;
var auxName : CName;
heightCur = 100;
actionLocks = thePlayer.GetAllActionLocks();

i = 0;
while (i < actionLocks.Size()){
auxString = i;
auxString = auxString + ":
";
auxName = GetAuxNameForInt(i);
j = 0;
while (j < actionLocks[i].Size()){
auxString += actionLocks[i][j].sourceName + ", "
;
j += 1;
}
thePlayer.GetVisualDebug().AddBar(auxName, 5, heightCur,
300, 15, 0.000000, textColor, auxString, 0.000000);
heightCur += 15;
i += 1;
}
/* NOP */;
}
private function GetAuxNameForInt(i : Int32) : CName{
switch(i){
case 0:
return 'IntName 0';
case 1:
return 'IntName 1';
case 2:
return 'IntName 2';
case 3:
return 'IntName 3';
case 4:
return 'IntName 4';
case 5:
return 'IntName 5';
case 6:
return 'IntName 6';
case 7:
return 'IntName 7';
case 8:
return 'IntName 8';
case 9:
return 'IntName 9';
case 10:
return 'IntName 10';
case 11:
return 'IntName 11';
case 12:
return 'IntName 12';
case 13:
return 'IntName 13';
case 14:
return 'IntName 14';
case 15:
return 'IntName 15';
case 16:
return 'IntName 16';
case 17:
return 'IntName 17';
case 18:
return 'IntName 18';
case 19:
return 'IntName 19';

case 20:
return 'IntName 20';
case 21:
return 'IntName 21';
case 22:
return 'IntName 22';
case 23:
return 'IntName 23';
case 24:
return 'IntName 24';
case 25:
return 'IntName 25';
case 26:
return 'IntName 26';
case 27:
return 'IntName 27';
case 28:
return 'IntName 28';
case 29:
return 'IntName 29';
case 30:
return 'IntName 30';
case 31:
return 'IntName 31';
case 32:
return 'IntName 32';
case 33:
return 'IntName 33';
case 34:
return 'IntName 34';
case 35:
return 'IntName 35';
case 36:
return 'IntName 36';
case 37:
return 'IntName 37';
case 38:
return 'IntName 38';
case 39:
return 'IntName 39';
case 40:
return 'IntName 40';
case 41:
return 'IntName 41';
case 42:
return 'IntName 42';
case 43:
return 'IntName 43';
case 44:
return 'IntName 44';
case 45:
return 'IntName 45';
case 46:
return 'IntName 46';
}
/* NOP */;
}
private function UpdateSuperStateChange(){
var l_CurrentSuperStateN : CName;
l_CurrentSuperStateN = thePlayer.GetCurrentStateName();

if (m_SuperStateLastN != l_CurrentSuperStateN){
SuperStateChanged(m_SuperStateLastN, l_CurrentSuperState
N);
m_SuperStateLastN = l_CurrentSuperStateN;
}
/* NOP */;
}
private function SuperStateChanged(stateExiting : CName, stateEntering :
CName){
var l_WasActiveB : Bool;
l_WasActiveB = m_ActiveB;
m_ActiveB = true;
LogExploration("Changed SuperState from : " + stateExiting + " t
o " + stateEntering);
if (stateExiting == 'TraverseExploration'){
if (m_CollisionManagerO.CheckLandBelow(0.300000, /* NOP
*/, /* NOP */)){
m_TeleportedFallHackTime = m_TeleportedFallHackT
imeTotalF;
}
}
if (stateEntering == 'TraverseExploration'){
StateTryToChangeTo('Interaction');
} else if (IsThisACombatSuperState(stateEntering)){
StateTryToChangeOrFallToDefault('CombatExploration');
} else if (stateEntering == 'Skating'){
StateTryToChangeOrFallToDefault('SkateIdle');
} else if (stateEntering == 'Exploration'){
if (!l_WasActiveB){
StateTryToChangeTo(m_StateDefaultN);
}
if (stateExiting == 'PlayerDialogScene'){
m_TeleportedFallHackTime = m_TeleportedFallHackT
imeTotalF;
} else if (IsThisACombatSuperState(stateExiting)){
if (m_StateCurN != 'Jump' && m_StateCurN != 'Sli
de'){
StateTryToChangeTo(m_StateDefaultN);
}
} else if (stateExiting == 'Swimming' && GetStateCur() =
= 'Climb'){
} else if (stateExiting == 'TraverseExploration' && m_Sh
aredDataO.HasToFallFromLadder()){
StateTryToChangeOrFallToDefault('Jump');
} else if (stateExiting != 'AimThrow'){
StateTryToChangeTo(m_StateDefaultN);
}
} else if (stateEntering == 'Swimming'){
StateTryToChangeOrFallToDefault('Swim');
} else if (!thePlayer.OnStateCanUpdateExplorationSubstates()){
m_ActiveB = false;
}
/* NOP */;
}
public function IsThisACombatSuperState(stateName : CName) : Bool{
return thePlayer.IsThisACombatSuperState(stateName);
/* NOP */;
}
private function PreUpdate(_Dt : Float){
m_InputO.Update(_Dt);

m_MoverO.PreUpdate(_Dt);
m_SharedDataO.PreUpdate(_Dt);
m_MovementCorrectorO.PreUpdate(_Dt);
UpdateExternalData(_Dt);
/* NOP */;
}
private function UpdateExternalData(_Dt : Float){
var isOnGroundNow : Bool;
if (m_TeleportedFallHackTime > 0.000000){
return;
}
m_CollisionManagerO.Update(_Dt);
isOnGroundNow = m_OwnerMAC.IsOnGround();
if (isOnGroundNow != m_IsOnGroundB){
if (m_IsDebugModeB){
if (isOnGroundNow){
LogExploration("StateManager : HitGround
at pos" + VecToStringPrec(m_OwnerE.GetWorldPosition(), 3));
} else {
LogExploration("StateManager : LostGroun
d at pos" + VecToStringPrec(m_OwnerE.GetWorldPosition(), 3));
}
}
m_IsOnGroundB = isOnGroundNow;
}
if (!isOnGroundNow){
if (m_StatesSArr[m_StateCurI].ReactToLoseGround()){
return;
}
QueueState('StartFalling');
} else if (m_StatesSArr[m_StateCurI].ReactToHitGround()){
return;
}
/* NOP */;
}
public function ReactOnHitCeiling(){
m_StatesSArr[m_StateCurI].ReactToHitCeiling();
/* NOP */;
}
public function ReactToChanceToFallAndSlide() : Bool{
return m_StatesSArr[m_StateCurI].ReactToChanceToFallAndSlide();
/* NOP */;
}
private function StateChangeUpdate(){
var l_NewStateN : CName;
var stateChanged : Bool;
stateChanged = false;
if (m_TeleportedFallHackTime > 0.000000){
return;
}
UpdateStateChangesFromBehavior();
UpdateStateChangesConfirmation();
UpdateStateChangesQueued();
UpdateStateChangesInProperState();
/* NOP */;
}
private function UpdateStateChangesFromBehavior() : Bool{
var stateName : CName;
var stateChanged : Bool;
stateChanged = false;

if (m_StateEnteredFromBehN != c_InvalidStateN && IsNameValid(m_S


tateEnteredFromBehN)){
stateChanged = StateTryToChangeOrFallToDefault(m_StateEn
teredFromBehN);
LogExploration("State changed from the Behavior graph");
} else if (!stateChanged && m_StateExitedFromBehN != c_InvalidSt
ateN && IsNameValid(m_StateExitedFromBehN)){
stateName = m_StatesSArr[m_StateCurI].GetStateToExitToAf
terFailing();
stateChanged = StateTryToChangeOrFallToDefault(stateName
);
LogExploration("State changed by: exiting the Behavior g
raph node");
}
m_StateEnteredFromBehN = c_InvalidStateN;
m_StateExitedFromBehN = c_InvalidStateN;
return stateChanged;
/* NOP */;
}
private function UpdateStateChangesConfirmation() : Bool{
var stateChanged : Bool;
stateChanged = false;
switch(m_BehaviorConfirmStateE){
case 0:
break;
case 1:
m_BehaviorConfirmStateE = 3;
break;
case 2:
m_StatesSArr[m_StateCurI].StateEnterConfirmed();
m_BehaviorConfirmStateE = 0;
break;
case 3:
stateChanged = BehaviorConfirmationFailedChange();
m_BehaviorConfirmStateE = 0;
break;
}
return stateChanged;
/* NOP */;
}
private function BehaviorConfirmationFailedChange() : Bool{
var stateName : CName;
var stateChanged : Bool;
stateChanged = false;
if (m_StatesSArr[m_StateCurI].NeedsBehaviorConfirmation()){
LogExplorationError(m_StatesSArr[m_StateCurI].GetStateNa
me() + ": FAILED CONFIRMATION: behavior graph node was not entered. " + "this CE
xplorationState needs a node of type ScriptState in the behavior graph (So it is
marked on the state variables), " + " and it has to have the same name than the
CExplorationState and the notification on enter and exit called 'Enter' and 'Ex
it'.");
stateName = m_StatesSArr[m_StateCurI].GetStateToExitToAf
terFailing();
stateChanged = StateTryToChangeOrFallToDefault(stateName
);
if (stateChanged){
LogExploration("State changed by: Missing behavi
our node confirmation");
}
} else {

LogExploration(m_StateCurN + ": CONFIRMATION NOT NEEDED,


so it is set on the property");
}
return stateChanged;
/* NOP */;
}
private function UpdateStateChangesQueued() : Bool{
var stateChanged : Bool;
stateChanged = false;
if (m_StateGlobalQueuedN != c_InvalidStateN){
if (!StateTryToChangeTo(m_StateGlobalQueuedN)){
LogExplorationError("Queued state change fail: "
+ m_StateGlobalQueuedN);
} else {
LogExploration("State changed by: State queued "
);
stateChanged = true;
}
m_StateGlobalQueuedN = c_InvalidStateN;
}
return stateChanged;
/* NOP */;
}
private function UpdateStateChangesInProperState() : Bool{
var l_NewStateN : CName;
var stateChanged : Bool;
stateChanged = false;
l_NewStateN = m_StatesSArr[m_StateCurI].StateChangePrecheck();
while (l_NewStateN != m_StateCurN){
if (!StateTryToChangeTo(l_NewStateN)){
if (m_IsDebugModeB){
LogExplorationError("State could not be
changed: " + m_StateCurN + " -> " + l_NewStateN + ", this should be checked insi
de the state itself on the StateChangePrecheck ");
}
break;
}
l_NewStateN = m_StatesSArr[m_StateCurI].StateChangePrech
eck();
stateChanged = true;
LogExploration("State changed by: The state change prech
eck");
}
return stateChanged;
/* NOP */;
}
private function UpdateStates(_Dt : Float){
m_StatesSArr[m_StateCurI].StateUpdate(_Dt);
UpdateInactiveStates(_Dt);
/* NOP */;
}
private function PostUpdate(_Dt : Float){
if (m_StateChanged){
PostStateChange();
}
m_MoverO.ApplyMovement(_Dt);
if (m_StatesSArr[m_StateCurI].IsRaisingBehaviorEventEachFrame())
{
TryToSetTheProperBehaviorState();
}

m_InputO.PostUpdate(_Dt);
m_MoverO.PostUpdate(_Dt);
m_SharedDataO.PostUpdate(_Dt);
m_TeleportedFallHackTime -= _Dt;
m_StateTimeCurF += _Dt;
/* NOP */;
}
private function StateTryToChangeOrFallToDefault(newState : CName) : Boo
l{
if (newState == m_StateCurN){
return true;
}
if (StateTryToChangeTo(newState)){
return true;
}
LogExploration("StateTryToChangeOrFallToDefault: Could not enter
to " + newState + "Trying to go to default");
if (StateTryToChangeTo(m_StateDefaultN)){
return true;
} else if (m_StateDefaultN != m_StateCurN){
LogExplorationError("Can't enter to defautl state, THIS
IS BAD");
}
return false;
/* NOP */;
}
private function StateTryToChangeTo(_NewStateN : CName) : Bool{
if (!CanChangeBetwenStates(m_StateCurN, _NewStateN)){
return false;
}
ChangeToStateWithTransition(_NewStateN);
return true;
/* NOP */;
}
private function ChangeToStateWithTransition(_NewStateN : CName){
var l_NewStateID : Int32;
var l_NewTransitionID : Int32;
var l_NewTransitionN : CName;
if (FindTransitionThatCanPlay(m_StateCurN, _NewStateN, l_NewTran
sitionID, l_NewTransitionN)){
_NewStateN = l_NewTransitionN;
}
ChangeStateTo(_NewStateN);
/* NOP */;
}
public function CanChangeToState(_ToN : CName) : Bool{
return CanChangeBetwenStates(m_StateCurN, _ToN);
/* NOP */;
}
public function CanChangeBetwenStates(_FromN : CName, _ToN : CName) : Bo
ol{
var l_FromID : Int32;
var l_ToID : Int32;
if (_ToN != m_StateDefaultN){
if (thePlayer.IsInNonGameplayCutscene()){
return false;
}
}
l_FromID = GetStateID(_FromN);
l_ToID = GetStateID(_ToN);

if (_ToN == _FromN){
LogExploration("Trying to go to the same state: " + _ToN
);
return false;
}
if (l_ToID == c_InvalidStateI){
LogExploration("Trying to go to the unexistent state: "
+ _ToN);
return false;
}
if (!m_StatesSArr[l_ToID].StateCanEnter(_FromN)){
return false;
}
return true;
/* NOP */;
}
public function StateWantsAndCanEnter(desiredState : CName) : Bool{
var stateID : Int32;
if (CanChangeBetwenStates(m_StateCurN, desiredState)){
stateID = GetStateID(desiredState);
if (m_StatesSArr[stateID].StateWantsToEnter()){
return true;
}
}
return false;
/* NOP */;
}
private function FindTransitionThatCanPlay(_FromN : CName, _ToN : CName,
_TransitionI : Int32, _TransitionNameN : CName) : Bool{
if (!FindTransition(_FromN, _ToN, _TransitionI, _TransitionNameN
)){
return false;
}
return true;
/* NOP */;
}
private function FindTransition(_FromN : CName, _ToN : CName, _Transitio
nI : Int32, _TransitionNameN : CName) : Bool{
var i : Int32;
var l_SizeI : Int32;
l_SizeI = m_StateTransitionsSArr.Size();
i = 0;
while (i < l_SizeI){
if (m_StateTransitionsSArr[i].IsMachForThisStates(_FromN
, _ToN)){
_TransitionI = i;
_TransitionNameN = m_StateTransitionsSArr[i].Get
StateName();
if (IsNameValid(_TransitionNameN)){
if (CanWePlayTransition(_FromN, _ToN, _T
ransitionNameN)){
return true;
}
}
}
i += 1;
}
return false;
/* NOP */;
}

private function CanWePlayTransition(_FromN : CName, _ToN : CName, _Tran


sitionNameN : CName) : Bool{
LogExploration("Found Transition: " + _TransitionNameN + ": " +
_FromN + " --> " + _ToN);
if (CanChangeBetwenStates(_FromN, _TransitionNameN)){
LogExploration("Transition will be played'");
return true;
}
return false;
/* NOP */;
}
private function ChangeStateTo(_NewStateN : CName){
var l_NewStateID : Int32;
l_NewStateID = GetStateID(_NewStateN);
m_StatesSArr[m_StateCurI].StateExit(_NewStateN);
m_StatesSArr[l_NewStateID].StateEnter(m_StateCurN);
m_StateLastI = m_StateCurI;
m_StateLastN = m_StateCurN;
m_StateCurI = l_NewStateID;
m_StateCurN = _NewStateN;
m_StateTimeLastF = m_StateTimeCurF;
m_StateTimeCurF = 0.000000;
m_StateChanged = true;
/* NOP */;
}
public function StateExited(){
RessetCameraOffset();
/* NOP */;
}
private function PostStateChange(){
var l_StateTypeE : EExplorationStateType;
TryToSetTheProperBehaviorState();
m_BehaviorConfirmStateE = 1;
SetCamera();
switch(m_StatesSArr[m_StateCurI].m_InputContextE){
case 0:
break;
case 1:
theInput.SetContext(thePlayer.GetExplorationInputContext
());
break;
case 2:
theInput.SetContext('JumpClimb');
break;
case 3:
theInput.SetContext(thePlayer.GetCombatInputContext());
break;
case 4:
theInput.SetContext('Swimming');
break;
}
if (!m_StatesSArr[m_StateCurI].GetCanSave()){
theGame.CreateNoSaveLock(m_NoSaveLockStringS, m_NoSaveLo
ck, true, /* NOP */);
/* NOP */;
} else {
theGame.ReleaseNoSaveLockByName(m_NoSaveLockStringS);
/* NOP */;
}
SetBehaviorParamBool('holsterFastForced', m_StatesSArr[m_StateCu

rI].IsHolsterFast(), true);
l_StateTypeE = m_StatesSArr[m_StateCurI].GetStateType();
if (l_StateTypeE != 7){
thePlayer.SetIsInAir(l_StateTypeE == 2);
}
m_StateChanged = false;
/* NOP */;
}
private function SetCamera(){
var cameraSet : CCameraParametersSet;
var cameraSetLast : CCameraParametersSet;
if (m_StatesSArr[m_StateCurI].m_ChangeCamerasB){
if (m_StatesSArr[m_StateCurI].GetIfCameraIsKept()){
return;
}
if (m_StatesSArr[m_StateLastI].GetCameraSet(cameraSetLas
t)){
cameraSetLast.StopOnMainCamera();
}
if (m_StatesSArr[m_StateCurI].GetCameraSet(cameraSet)){
if (cameraSetLast){
cameraSet.SetToMainCamera(cameraSetLast.
pivotPosForcedBlendOnNext);
} else {
cameraSet.SetToMainCamera(0.000000);
}
} else if (m_DefaultCameraSetS){
if (cameraSetLast){
m_DefaultCameraSetS.SetToMainCamera(came
raSetLast.pivotPosForcedBlendOnNext);
} else {
m_DefaultCameraSetS.SetToMainCamera(0.00
0000);
}
}
}
/* NOP */;
}
private function TryToSetTheProperBehaviorState(){
var l_BehaviorEventN : CName;
var l_EventIsForcedB : Bool;
if (m_StatesSArr[m_StateCurI].IsRaisingBehaviorEvent()){
l_BehaviorEventN = m_StatesSArr[m_StateCurI].GetBehavior
EventName();
l_EventIsForcedB = m_StatesSArr[m_StateCurI].GetBehavior
IsEventForced(m_StateLastN);
SendAnimEvent(l_BehaviorEventN, l_EventIsForcedB);
}
/* NOP */;
}
private function UpdateInactiveStates(_Dt : Float){
var i : Int32;
i = 0;
while (i < m_StatesUpdatedInactiveSArr.Size()){
if (m_StatesUpdatedInactiveSArr[i].GetStateName() != m_S
tateCurN){
m_StatesUpdatedInactiveSArr[i].StateUpdateInacti
ve(_Dt);
}
i += 1;

}
/* NOP */;
}
private function QueueState(newState : CName){
m_StateGlobalQueuedN = newState;
LogExploration("Queued state : " + newState);
/* NOP */;
}
public function QueueStateExternal(newState : CName){
m_StateGlobalQueuedN = newState;
LogExplorationWarning("Externaly Queued state : " + newState);
/* NOP */;
}
public function OnRagdollStart() : Bool{
var actor : CActor;
var currentPri : EInteractionPriority;
actor = (CActor)m_OwnerE;
currentPri = actor.GetInteractionPriority();
if (actor.IsAlive() && currentPri != -2){
m_storedInteractionPri = currentPri;
actor.SetInteractionPriority(-2);
}
/* NOP */;
}
public function OnNoLongerInRagdoll() : Bool{
var actor : CActor;
actor = (CActor)m_OwnerE;
if (actor.IsAlive() && m_storedInteractionPri != -1){
actor.SetInteractionPriority(m_storedInteractionPri);
m_storedInteractionPri = -1;
}
/* NOP */;
}
public function OnRagdollTouch(entity : CEntity) : Bool{
var actor : CActor;
actor = (CActor)entity;
if (actor){
LogExploration("on ragdoll touch - " + actor.IsAlive());
m_OwnerMAC.SetRagdollPushingMul(/* NOP */);
}
/* NOP */;
}
public function OnPrediction(pos : Vector, normal : Vector, disp : Vecto
r, penetration : Float, actorHeight : Float, diffZ : Float, fromVirtualControlle
r : Bool) : Bool{
}
public function SendAnimEvent(eventName : CName, forced : Bool) : Bool{
if (forced){
return m_OwnerE.RaiseForceEvent(eventName);
} else {
return m_OwnerE.RaiseEvent(eventName);
}
/* NOP */;
}
public function SetBehaviorParamBool(paramName : CName, value : Bool, on
AllInstances : Bool){
if (value){
m_OwnerE.SetBehaviorVariable(paramName, 1.000000, onAllI
nstances);
} else {

m_OwnerE.SetBehaviorVariable(paramName, 0.000000, onAllI


nstances);
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
m_StatesSArr[m_StateCurI].OnAnimEvent(animEventName, animEventTy
pe, animInfo);
m_SharedDataO.OnAnimEvent(animEventName, animEventType, animInfo
);
/* NOP */;
}
public function OnBehaviorGraphNotification(notificationName : CName, st
ateName : CName) : Bool{
var i : Int32;
if (notificationName == 'StartTurnAdjustment'){
m_MovementCorrectorO.StartTurnAdjustment();
} else if (notificationName == 'CancelTurnAdjustment'){
m_MovementCorrectorO.CancelTurnAdjustment();
} else if (!m_StatesSArr[m_StateCurI].IsRaisingBehaviorEventEach
Frame()){
if (notificationName == 'Exit'){
m_StatesSArr[m_StateCurI].OnBehGraphNodeExited()
;
if (!m_StatesSArr[m_StateCurI].IsRaisingBehavior
Event() || !m_StatesSArr[m_StateCurI].NeedsBehaviorConfirmation()){
return true;
}
if (stateName == m_StateCurN){
m_StateExitedFromBehN = m_StateCurN;
LogExplorationWarning(m_StateCurN + ": F
ORCING EXIT, The behavior graph node of this state left by its own");
}
if (stateName == m_StateCurN && m_BehaviorConfir
mStateE == 2){
LogExplorationWarning(m_StateCurN + ": D
ECONFIRMED, exited by the Behavior graph node");
m_BehaviorConfirmStateE = 3;
}
if (stateName == m_StateEnteredFromBehN){
LogExplorationWarning(stateName + ": FOR
CED ENTER CANCELLED, the state was reentered on the same frame");
m_StateExitedFromBehN = c_InvalidStateN;
m_StateEnteredFromBehN = c_InvalidStateN
;
}
if (m_StateBehCurReportedN == stateName){
m_StateBehCurReportedN = 'None';
}
} else if (notificationName == 'Enter'){
m_StatesSArr[m_StateCurI].OnBehGraphNodeEntered(
);
if (!m_StatesSArr[GetStateID(stateName)].IsRaisi
ngBehaviorEvent() || !m_StatesSArr[GetStateID(stateName)].NeedsBehaviorConfirmat
ion()){
return true;
}
if (stateName == m_StateExitedFromBehN){
LogExplorationWarning(stateName + ": FOR

CED EXIT CANCELLED, the state was reentered on the same frame");
m_StateExitedFromBehN = c_InvalidStateN;
m_StateEnteredFromBehN = c_InvalidStateN
;
}
if (stateName == m_StateCurN){
LogExploration(m_StateCurN + ": CONFIRME
D, enter by the Behavior graph node");
m_BehaviorConfirmStateE = 2;
} else {
i = 0;
while (i < m_StatesSArr.Size()){
if (m_StateCurI != i && stateNam
e == m_StatesSArr[i].GetStateName()){
m_StateEnteredFromBehN =
stateName;
LogExplorationWarning(m_
StatesSArr[i].GetStateName() + ": FORCING ENTER, The Behavior graph node of this
state entered by itself");
}
i += 1;
}
}
m_StateBehCurReportedN = stateName;
}
}
/* NOP */;
}
public function OnTeleported(){
m_SharedDataO.OnTeleported();
m_MoverO.OnTeleported();
m_TeleportedFallHackTime = m_TeleportedFallHackTimeTotalF;
/* NOP */;
}
public function ReactOnBeingHit() : Bool{
if (m_ActiveB){
if (m_StatesSArr[m_StateCurI].ReactToBeingHit()){
return true;
}
}
return false;
/* NOP */;
}
public function ReactOnCriticalState(enabled : Bool){
if (m_ActiveB){
if (m_StatesSArr[m_StateCurI].ReactToCriticalState(enabl
ed)){
return;
}
}
if (enabled){
StateTryToChangeTo('Ragdoll');
}
/* NOP */;
}
public function UpdateCameraIfNeeded(moveData : SCameraMovementData, dt
: Float) : Bool{
return m_StatesSArr[m_StateCurI].UpdateCameraIfNeeded(moveData,
dt);
/* NOP */;

}
public function OnGameCameraExplorationRotCtrlChange() : Bool{
if (m_StatesSArr[m_StateCurI].m_ChangeCamerasB){
if (m_StatesSArr[m_StateCurI].CameraChangesRotationContr
oller()){
return true;
}
}
return false;
/* NOP */;
}
public function RessetCameraOffset(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
if (camera){
camera.ResetCollisionOffset();
}
/* NOP */;
}
private function GetStateID(_StateNameN : CName) : Int32{
var id : Int32;
id = m_StateNamesSArr.FindFirst(_StateNameN);
if (id < 0){
id = c_InvalidStateI;
}
return id;
/* NOP */;
}
public function GetStateCur() : CName{
return m_StateCurN;
/* NOP */;
}
public function GetStateTypeCur() : EExplorationStateType{
return m_StatesSArr[m_StateCurI].GetStateType();
/* NOP */;
}
public function GetStateType(stateName : CName) : EExplorationStateType{
var stateId : Int32;
stateId = GetStateID(stateName);
if (stateId == c_InvalidStateI){
LogExplorationError("checking for the type of an unexist
ing state: " + stateName);
}
return m_StatesSArr[stateId].GetStateType();
/* NOP */;
}
public function GetStateTimeF() : Float{
return m_StateTimeCurF;
/* NOP */;
}
public function GetDefaultStateName() : CName{
return m_StateDefaultN;
/* NOP */;
}
public function GetSuperStateName() : CName{
return m_SuperStateLastN;
/* NOP */;
}
public function StateExistsB(stateName : CName) : Bool{
if (FindState(stateName) != c_InvalidStateI){

return true;
}
return false;
/* NOP */;
}
public function IsOnGround() : Bool{
return m_IsOnGroundB;
/* NOP */;
}
public function CanInteract() : Bool{
return m_StatesSArr[m_StateCurI].CanInteract();
/* NOP */;
}
public function CanReactToHardCriticalState() : Bool{
return m_StatesSArr[m_StateCurI].CanReactToHardCriticalState();
/* NOP */;
}
}
class CClimbProbe extends CObject{
private var valid : Bool;
private var setupReady : Bool;
private var exploratorPosition : Vector;
private var directionChecking : Vector;
private var directionRequiresInput : Bool;
private var distForwardToCheck : Float;
private var distanceCheckType : EClimbDistanceType;
private editable var distForwardToCheckClose : Float;
private editable var distForwardToCheckMedium : Float;
private editable var maxAttempts : Int32;
private editable var distForwardToCheckLong : Float;
private editable var characterRadius : Float;
private var heightTotalMin : Float;
private var heightTotalMax : Float;
private editable var ceilingDoubleCheck : Bool;
private editable var ceilingCheckingClose : Bool;
private editable var ceilingBackOffsetClose : Float;
private editable var ceilingBackOffsetFar : Float;
private editable var ceilingHeightNeeded : Float;
private editable var ceilingRadius : Float;
private var ceilingFound : Bool;
private var ceilingPoint : Vector;
private var ceilingHeightFree : Float;
private var ceilingCheckFrom : Vector;
private var ceilingCheckTo : Vector;
private editable var groundRadiusToCheck : Float;
private editable var groundNormalMinZ : Float;
private var groundFound : Bool;
private var groundEndPoint : Vector;
private var groundEndNormal : Vector;
private var heightTarget : Float;
private var heightAdded : Float;
private var groundCheckFrom : Vector;
private var groundCheckTo : Vector;
private editable var groundRefineEnabled : Bool;
private editable var groundRefineDistCheck : Float;
private editable var groundRefineHeightCheck : Float;
private editable var groundRefineRadius : Float;
private var groundRefined : Bool;
private var climbableFound : Bool;

private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private

var climbableObjName : String;


var climbableObjTagOnLayer : Bool;
var climbableObjForceAllow : Bool;
var climbablePoint : Vector;
editable var climbableRadius : Float;
editable var climbableLockTag : CName;
editable var climbableUnLockTag : CName;
editable var holeForwardNeeded : Float;
var holeIsBlocked : Bool;
var holeCollision : Vector;
var holeCheckFrom : Vector;
var holeCheckTo : Vector;
editable var wallRadiusToCheck : Float;
editable var wallNormalCheckBackExtra : Float;
editable var wallSideSeparation : Float;
var wallFound : Bool;
var wallNormalOrigin : Vector;
var wallNormalDirection : Vector;
var wallCheckFromL : Vector;
var wallCheckToL : Vector;
var wallCheckFromR : Vector;
var wallCheckToR : Vector;
var wallCollL : Vector;
var wallCollR : Vector;
editable var slopeAngleMax : Float;
var slopeNormalZMax : Float;
editable var slopeForwardDistance : Float;
editable var slopeLeftDistance : Float;
editable var horizHeightRdius : Float;
editable var horizHeightSeparation : Float;
editable var horizHeightAngleMin : Float;
editable var horizHeightAngleMax : Float;
var horizFoundLeft : Bool;
var horizFoundRight : Bool;
var horizHeightAngleCur : Float;
var horizPointLeft : Vector;
var horizPointRight : Vector;
var horizCorrectSideCoef : Float;
editable var vertSlopeAngleOffset : Float;
editable var vertSlopeAngleMax : Float;
var vertSlopeAngleCur : Float;
var vertSlopeAngleFrom : Vector;
var vertSlopeAngleTo : Vector;
var vertSlopeAnglePoint : Vector;
editable var vertSlopeAngleLowOffset : Float;
editable var vertSlopeLowAngleMax : Float;
var vertSlopeLowAngleCur : Float;
var vertSlopeLowAngleFrom : Vector;
var vertSlopeLowAngleTo : Vector;
var vertSlopeLowAnglePoint : Vector;
editable var vertFreeHeightEnable : Bool;
editable var vertFreeHorOffset : Float;
editable var vertFreeHorMin : Float;
editable var vertFreeHeightMin : Float;
editable var vertFreeHeightGrndMax : Float;
editable var vertFreeHeightCur : Float;
var vertFreeFrom : Vector;
var vertFreeTo : Vector;
var vertFreeCollPoint : Vector;
editable var vaultHeight : Float;

private editable var vaultHeightOffset : Float;


private editable var vaultDistance : Float;
private editable var vaultRadius : Float;
private editable var heightOffsetToEndFall : Float;
private editable var heighAbsToEndFall : Float;
private var vaultingFound : EClimbRequirementVault;
private var vaultCollision : Vector;
private var vaultEndsFalling : Bool;
private var vaultCheckFrom : Vector;
private var vaultCheckTo : Vector;
private var platformFound : EClimbRequirementPlatform;
private var platformFrom : Vector;
private var platformTo : Vector;
private var platformCollision : Vector;
private editable var platformHeightDown : Float;
private editable var platformRadius : Float;
private editable var platformDeep : Float;
private var platformMinToCheck : Float;
private var collisionClimbableNames : array<CName>;
private var collisionObstaclesNames : array<CName>;
private var collisionForceAllowNames : array<CName>;
private var collisionLockNames : array<CName>;
private var debugPrefix : String;
private var debugIsTop : String;
private var debugColorDiv : Int32;
private var debugLogFails : Bool;
private var onlyDebugPoint : Vector;
private var debugLastErrorMessage : String;
private var debugLastErrorPosition : Vector;
private var debugDrawGraphics : Bool;
private var debugCeiling : Bool;
private var debugGround : Bool;
private var debugWall : Bool;
private var debugHole : Bool;
private var debugVault : Bool;
private var debugVertSlope : Bool;
private var debugVertFree : Bool;
private var debugHorSlope : Bool;
private var debugPlatform : Bool;
private var vectorUp : Vector;
private var vectorZero : Vector;
public function Initialize(heightMin : Float, heightMax : Float, platfor
mHeihtMin : Float, radius : Float, colorDivide : Int32, isTop : Bool){
debugColorDiv = colorDivide;
debugIsTop = isTop;
if (debugIsTop){
debugPrefix = "Top";
} else {
debugPrefix = "Bottom";
}
heightTotalMin = heightMin;
heightTotalMax = heightMax;
characterRadius = radius;
platformMinToCheck = platformHeihtMin;
collisionClimbableNames.PushBack('Terrain');
collisionClimbableNames.PushBack('Static');
collisionClimbableNames.PushBack('Destructible');
collisionClimbableNames.PushBack('Platforms');
collisionClimbableNames.PushBack('Fence');
collisionClimbableNames.PushBack('Boat');

collisionClimbableNames.PushBack('BoatDocking');
collisionObstaclesNames.PushBack('Terrain');
collisionObstaclesNames.PushBack('Static');
collisionObstaclesNames.PushBack('Platforms');
collisionObstaclesNames.PushBack('Fence');
collisionObstaclesNames.PushBack('Boat');
collisionObstaclesNames.PushBack('BoatDocking');
collisionObstaclesNames.PushBack('Foliage');
collisionObstaclesNames.PushBack('Dynamic');
collisionObstaclesNames.PushBack('Destructible');
collisionObstaclesNames.PushBack('RigidBody');
collisionForceAllowNames.PushBack('UnlockClimb');
collisionLockNames.PushBack('LockClimb');
slopeNormalZMax = CosF(Deg2Rad(slopeAngleMax));
vectorUp = Vector(0.000000, 0.000000, 1.000000);
vectorZero = Vector(0.000000, 0.000000, 0.000000);
/* NOP */;
}
public function PreUpdate(position : Vector, direction : Vector, require
InputDir : Bool, distanceType : EClimbDistanceType, logFails : Bool){
PrepareDebugPositions();
debugLogFails = logFails;
exploratorPosition = position;
directionChecking = direction;
directionRequiresInput = requireInputDir;
distanceCheckType = distanceType;
if (distanceCheckType == 1){
distForwardToCheck = distForwardToCheckClose;
} else {
distForwardToCheck = distForwardToCheckMedium;
}
valid = false;
setupReady = false;
/* NOP */;
}
public function ComputeStartup(){
var i : Int32;
ComputeCeiling();
valid = ComputeCurCeilingStartup();
if (distanceCheckType == 2){
i = 0;
while (!valid && i < maxAttempts){
exploratorPosition += directionChecking * distFo
rwardToCheckLong;
ComputeCeiling();
valid = ComputeCurCeilingStartup();
i += 1;
}
}
setupReady = valid;
/* NOP */;
}
public function ComputeStartupFromThisPoint(manualPoint : Vector){
ComputeFakeCeiling(manualPoint);
valid = ComputeCurCeilingStartup();
setupReady = valid;
/* NOP */;
}
private function ComputeCurCeilingStartup() : Bool{
if (!DoWeHaveAValidCeiling()){

return false;
}
ComputeGround();
if (!DoWeHaveGroundStartUp()){
return false;
}
return true;
/* NOP */;
}
public function ComputeClimbDetails() : Bool{
if (!valid){
return false;
}
if (!DoWeHaveGround()){
return false;
}
ComputeClimbableGroundPhysics();
if (!DoWeHaveAClimbableGround()){
return false;
}
if (!DoWeHaveSpaceBetweenGroundAndCeiling()){
return false;
}
RecomputeDirectionWithGroundPoint();
ComputeNormalOfWallDetailed();
if (!DoWeHaveAWall()){
return false;
}
RefineGroundBasedOnWall();
ComputeSpaceToEnter();
if (!DoWeHaveEnoughSpace()){
return false;
}
ComputeVaultMode();
if (vaultingFound == 0){
ComputeVerticalSlope();
if (!DoWeHaveProperVerticalSlope()){
return false;
}
if (platformFound == 0){
ComputeVerticalLowSlope();
if (!DoWeHaveProperVerticalSlopeLow()){
return false;
}
}
if (vertFreeHeightEnable){
ComputeVerticalFreeDistanceInFront();
if (!DoWeHaveEnoughVerticalFreeDistance()){
return false;
}
}
}
ComputePlatformMode();
ComputeHorizontalHeightDiff();
if (!DoWeHaveProperHorizontalDiff()){
return false;
}
ComputeClimbAproximation();
return true;
/* NOP */;

}
public function IsSetupValid() : Bool{
return setupReady;
/* NOP */;
}
public function IsValid() : Bool{
return valid;
/* NOP */;
}
public function GetClimbData(height : Float, vault : EClimbRequirementVa
ult, vaultFalls : Bool, platform : EClimbRequirementPlatform, climbPoint : Vecto
r, wallNormal : Vector) : Bool{
if (!valid){
return false;
}
height = heightTarget;
vault = vaultingFound;
vaultFalls = vaultEndsFalling;
platform = platformFound;
climbPoint = wallNormalOrigin;
climbPoint.Z = groundEndPoint.Z;
wallNormal = wallNormalDirection;
return true;
/* NOP */;
}
public function GetGroundPoint() : Vector{
if (!setupReady){
return exploratorPosition;
}
return groundEndPoint;
/* NOP */;
}
private function ComputeCeiling(){
var position : Vector;
var point : Vector;
var pointC : Vector;
var pointF : Vector;
var normal : Vector;
var heightFree : Float;
position = exploratorPosition - directionChecking * ceilingBackO
ffsetClose;
ceilingCheckFrom = position + vectorUp * heightTotalMin + ceilin
gHeightNeeded;
ceilingCheckTo = position + vectorUp * heightTotalMax + ceilingH
eightNeeded;
ceilingCheckingClose = true;
ceilingFound = theGame.GetWorld().SweepTest(ceilingCheckFrom, ce
ilingCheckTo, ceilingRadius, pointC, normal, collisionObstaclesNames);
point = pointC;
if (ceilingFound && ceilingDoubleCheck){
position = exploratorPosition - directionChecking * ceil
ingBackOffsetFar;
ceilingCheckFrom = position + vectorUp * ceilingHeightNe
eded;
ceilingCheckTo = position + vectorUp * heightTotalMax +
ceilingHeightNeeded;
ceilingFound = theGame.GetWorld().SweepTest(ceilingCheck
From, ceilingCheckTo, ceilingRadius, pointF, normal, collisionObstaclesNames);
if (pointF.Z > pointC.Z){
point = pointF;

ceilingCheckingClose = false;
}
}
if (!ceilingFound){
heightFree = heightTotalMax + ceilingHeightNeeded;
SetCeilingData(ceilingCheckFrom, heightFree);
return;
}
heightFree = point.Z - position.Z;
SetCeilingData(point, heightFree);
/* NOP */;
}
private function ComputeFakeCeiling(manualPoint : Vector){
var heightFree : Float;
ceilingFound = true;
heightFree = manualPoint.Z - exploratorPosition.Z;
SetCeilingData(manualPoint, heightFree);
/* NOP */;
}
private function SetCeilingData(point : Vector, heightFree : Float){
ceilingPoint = point;
ceilingHeightFree = heightFree;
/* NOP */;
}
private function ComputeGround(){
var position : Vector;
var point : Vector;
var normal : Vector;
var dot : Float;
var rayOrig : Vector;
var rayEnd : Vector;
position = exploratorPosition;
groundCheckFrom = position + directionChecking * distForwardToCh
eck;
groundCheckTo = groundCheckFrom + vectorUp * heightTotalMin;
groundCheckFrom = groundCheckFrom + vectorUp * ceilingHeightFree
- ceilingHeightNeeded + groundRadiusToCheck;
groundFound = theGame.GetWorld().SweepTest(groundCheckFrom, grou
ndCheckTo, groundRadiusToCheck, point, normal, collisionClimbableNames);
if (groundFound && directionRequiresInput){
if (!IsGroundPointCloseToDirection(point)){
groundFound = false;
}
}
if (groundFound){
groundEndPoint = point;
groundEndNormal = normal;
heightTarget = point.Z - position.Z;
}
/* NOP */;
}
private function IsGroundPointCloseToDirection(point : Vector) : Bool{
var dirFound : Vector;
dirFound = point - exploratorPosition;
dirFound.Z = 0.000000;
dirFound = VecNormalize(dirFound);
return VecDot(dirFound, directionChecking) > 0.500000;
/* NOP */;
}
private function RecomputeDirectionWithGroundPoint(){

directionChecking = groundEndPoint - exploratorPosition;


directionChecking.Z = 0.000000;
directionChecking = VecNormalize(directionChecking);
/* NOP */;
}
private function ComputeClimbableGround(){
var i : Int32;
var totalEntities : Int32;
var entities : array<CEntity>;
var locked : Bool;
climbableFound = true;
locked = false;
climbableObjForceAllow = false;
theGame.GetWorld().SphereOverlapTest(entities, groundEndPoint, c
limbableRadius, collisionClimbableNames);
totalEntities = entities.Size();
i = 0;
while (i < totalEntities){
if (entities[i].HasTag(climbableUnLockTag)){
climbableObjForceAllow = true;
climbableObjTagOnLayer = false;
} else if (entities[i].HasTagInLayer(climbableUnLockTag)
){
climbableObjForceAllow = true;
climbableObjTagOnLayer = true;
}
if (climbableObjForceAllow){
climbableObjName = entities[i].GetName();
climbablePoint = groundEndPoint;
climbableFound = true;
return;
}
if (!locked){
if (entities[i].HasTag(climbableLockTag)){
locked = true;
climbableObjTagOnLayer = false;
} else if (entities[i].HasTagInLayer(climbableLo
ckTag)){
locked = true;
climbableObjTagOnLayer = true;
}
if (locked){
climbableObjName = entities[i].GetName()
;
climbablePoint = groundEndPoint;
climbableFound = false;
}
}
i += 1;
}
/* NOP */;
}
private function ComputeClimbableGroundPhysics(){
var origin : Vector;
var end : Vector;
var point : Vector;
var normal : Vector;
origin = groundEndPoint;
origin.Z += 0.100000;
end = groundEndPoint;

end.Z -= 0.100000;
climbablePoint = groundEndPoint;
if (theGame.GetWorld().SweepTest(origin, end, climbableRadius, p
oint, normal, collisionForceAllowNames)){
climbableFound = true;
climbableObjForceAllow = true;
} else if (theGame.GetWorld().SweepTest(origin, end, climbableRa
dius, point, normal, collisionLockNames)){
climbableFound = false;
climbableObjForceAllow = false;
} else {
climbableFound = true;
climbableObjForceAllow = false;
}
/* NOP */;
}
private function ComputeNormalOfWall(){
var direction : Vector;
var position : Vector;
var normal : Vector;
var distBack : Float;
if (ceilingCheckingClose){
distBack = groundRadiusToCheck + ceilingBackOffsetClose;
} else {
distBack = groundRadiusToCheck + ceilingBackOffsetFar;
}
distBack += wallNormalCheckBackExtra;
position = groundEndPoint;
wallCheckFromL = position - directionChecking * distBack;
wallCheckToL = position + directionChecking * distForwardToCheck
+ 2.000000 * groundRadiusToCheck;
wallFound = theGame.GetWorld().SweepTest(wallCheckFromL, wallChe
ckToR, wallRadiusToCheck, wallCollL, normal, collisionClimbableNames);
if (!wallFound){
return;
}
wallNormalOrigin = wallCollL;
wallNormalDirection = normal;
wallNormalDirection.Z = 0.000000;
wallNormalDirection = VecNormalize(wallNormalDirection);
/* NOP */;
}
private function ComputeNormalOfWallDetailed(){
var direction : Vector;
var position : Vector;
var distBack : Float;
var normalL : Vector;
var normalR : Vector;
var foundL : Bool;
var foundR : Bool;
if (ceilingCheckingClose){
distBack = groundRadiusToCheck + ceilingBackOffsetClose;
} else {
distBack = groundRadiusToCheck + ceilingBackOffsetFar;
}
distBack += wallNormalCheckBackExtra;
direction = VecCross(directionChecking, vectorUp);
position = groundCheckFrom - direction * wallSideSeparation;
position.Z = groundEndPoint.Z - wallRadiusToCheck * 0.300000;
wallCheckFromL = position - directionChecking * distBack;

wallCheckToL = position + directionChecking * distForwardToCheck


+ groundRadiusToCheck;
foundL = theGame.GetWorld().SweepTest(wallCheckFromL, wallCheckT
oL, wallRadiusToCheck, wallCollL, normalL, collisionClimbableNames);
wallCheckFromR = wallCheckFromL + direction * wallSideSeparation
* 2.000000;
wallCheckToR = wallCheckToL + direction * wallSideSeparation * 2
.000000;
foundR = theGame.GetWorld().SweepTest(wallCheckFromR, wallCheckT
oR, wallRadiusToCheck, wallCollR, normalR, collisionClimbableNames);
wallFound = true;
if (!foundL && !foundR){
wallFound = false;
return;
} else if (foundL && foundR){
wallNormalOrigin = wallCollL + wallCollR * 0.500000;
wallNormalDirection = VecCross(VecNormalize(wallCollR wallCollL), vectorUp);
} else if (foundL){
wallNormalOrigin = wallCollL;
wallNormalDirection = normalL;
} else {
wallNormalOrigin = wallCollR;
wallNormalDirection = normalR;
}
wallNormalDirection.Z = 0.000000;
wallNormalDirection = VecNormalize(wallNormalDirection);
/* NOP */;
}
private function RefineGroundBasedOnWall(){
var refinedGround : Vector;
var from : Vector;
var to : Vector;
var normal : Vector;
var distance : Float;
var wallNormalModif : Float;
groundRefined = false;
if (!groundRefineEnabled){
return;
}
if (VecDot2D(wallNormalOrigin - groundEndPoint, directionCheckin
g) >= 0.000000){
return;
}
distance = VecDistance2D(groundEndPoint, wallNormalOrigin);
if (distance > groundRefineDistCheck){
from = wallNormalOrigin;
to = from;
from.Z = groundEndPoint.Z + groundRefineHeightCheck;
to.Z = groundEndPoint.Z - groundRefineHeightCheck;
groundRefined = theGame.GetWorld().SweepTest(from, to, g
roundRefineRadius, refinedGround, normal, collisionClimbableNames);
if (groundRefined){
if (VecDot2D(refinedGround - wallNormalOrigin, d
irectionChecking) > 0.000000){
groundEndPoint = wallNormalOrigin;
groundEndPoint.Z = refinedGround.Z;
} else {
groundEndPoint = refinedGround;
}

heightTarget = groundEndPoint.Z - exploratorPosi


tion.Z;
}
}
/* NOP */;
}
private function ComputeSpaceToEnter(){
var point : Vector;
var normal : Vector;
holeCheckFrom = wallNormalOrigin;
holeCheckFrom.Z = groundEndPoint.Z + ceilingHeightNeeded * 0.500
000;
holeCheckTo = holeCheckFrom - wallNormalDirection * holeForwardN
eeded;
holeCheckFrom += wallNormalDirection * characterRadius;
holeIsBlocked = theGame.GetWorld().SweepTest(holeCheckFrom, hole
CheckTo, characterRadius, point, normal, collisionObstaclesNames);
if (holeIsBlocked){
holeCollision = point;
}
/* NOP */;
}
private function ComputeHorizontalHeightDiff(){
var position : Vector;
var direction : Vector;
var from : Vector;
var to : Vector;
var normalL : Vector;
var normalR : Vector;
var slope : Vector;
var angle : Float;
var pointL : Vector;
var pointR : Vector;
position = groundEndPoint + vectorUp;
direction = VecCross(wallNormalDirection, vectorUp);
from = position + direction * horizHeightSeparation;
to = from - vectorUp * 2.000000;
horizFoundLeft = theGame.GetWorld().SweepTest(from, to, horizHei
ghtRdius, pointL, normalL, collisionClimbableNames);
from = position - direction * horizHeightSeparation;
to = from - vectorUp * 2.000000;
horizFoundRight = theGame.GetWorld().SweepTest(from, to, horizHe
ightRdius, pointR, normalR, collisionClimbableNames);
if (!horizFoundLeft && !horizFoundRight){
horizHeightAngleCur = 180.000000;
return;
}
if (!horizFoundLeft){
slope = VecCross(normalR, wallNormalDirection);
horizPointRight = pointR;
}
if (!horizFoundRight){
slope = VecCross(normalL, wallNormalDirection);
horizPointLeft = pointL;
} else {
horizPointLeft = pointL;
horizPointRight = pointR;
slope = VecNormalize(horizPointLeft - horizPointRight);
}
angle = AngleNormalize180(VecGetAngleBetween(slope, direction));

if (slope.Z < 0.000000){


angle *= -1.000000;
}
horizHeightAngleCur = angle;
/* NOP */;
}
private function ComputeClimbAproximation(){
if (!horizFoundRight){
groundEndPoint = groundEndPoint * 1.000000 - horizCorrec
tSideCoef + horizPointLeft * horizCorrectSideCoef;
} else if (!horizFoundLeft){
groundEndPoint = groundEndPoint * 1.000000 - horizCorrec
tSideCoef + horizPointRight * horizCorrectSideCoef;
}
/* NOP */;
}
private function ComputeVaultMode(){
var point : Vector;
var normal : Vector;
var direction : Vector;
var height : Float;
var collided : Bool;
vaultEndsFalling = false;
direction = -wallNormalDirection;
direction.Z = 0.000000;
direction = VecNormalize(direction);
point = wallNormalOrigin;
point.Z = groundEndPoint.Z + vaultHeightOffset + vaultRadius;
vaultCheckFrom = point + direction * vaultDistance + vaultRadius
;
vaultCheckTo = vaultCheckFrom - vectorUp * heightTotalMax;
collided = theGame.GetWorld().SweepTest(vaultCheckFrom, vaultChe
ckTo, vaultRadius, point, normal, collisionObstaclesNames);
if (!collided){
vaultingFound = 1;
} else {
vaultCollision = point;
height = groundEndPoint.Z - vaultCollision.Z;
if (height > vaultHeight){
vaultingFound = 1;
if (height >= heightTarget + heightOffsetToEndFa
ll || height > heighAbsToEndFall){
vaultEndsFalling = true;
}
} else {
vaultingFound = 0;
}
}
/* NOP */;
}
private function ComputePlatformMode(){
var position : Vector;
var normal : Vector;
if (heightTarget < platformMinToCheck){
platformFound = 0;
return;
}
position = wallNormalOrigin;
position.Z = groundEndPoint.Z - platformHeightDown - platformRad
ius;

platformFrom = position + wallNormalDirection * characterRadius;


platformTo = position - wallNormalDirection * platformDeep;
if (theGame.GetWorld().SweepTest(platformFrom, platformTo, platf
ormRadius, platformCollision, normal, collisionClimbableNames)){
platformFound = 0;
} else {
platformFound = 1;
}
/* NOP */;
}
private function ComputeVerticalSlope(){
var position : Vector;
var point : Vector;
var normal : Vector;
position = wallNormalOrigin;
position.Z = groundEndPoint.Z;
vertSlopeAngleFrom = holeCheckTo;
vertSlopeAngleTo = position - vectorUp - vertSlopeAngleOffset *
wallNormalDirection;
if (!theGame.GetWorld().SweepTest(vertSlopeAngleFrom, vertSlopeA
ngleTo, horizHeightRdius, point, normal, collisionClimbableNames)){
vertSlopeAngleCur = -180.000000;
vertSlopeAnglePoint = vertSlopeAngleTo;
return;
}
vertSlopeAnglePoint = point;
vertSlopeAngleCur = GetVerticalAngle(point, groundEndPoint);
/* NOP */;
}
private function ComputeVerticalLowSlope(){
var position : Vector;
var point : Vector;
var normal : Vector;
var heightToCheck : Float;
heightToCheck = MaxF(exploratorPosition.Z + horizHeightRdius * 1
.100000, wallCheckFromL.Z - vertSlopeAngleLowOffset);
vertSlopeLowAngleFrom = wallCheckFromL + wallCheckFromR * 0.5000
00;
vertSlopeLowAngleTo = wallCheckToL + wallCheckToR * 0.500000;
vertSlopeLowAngleFrom.Z = heightToCheck;
vertSlopeLowAngleTo.Z = heightToCheck;
if (!theGame.GetWorld().SweepTest(vertSlopeLowAngleFrom, vertSlo
peLowAngleTo, horizHeightRdius, point, normal, collisionClimbableNames)){
vertSlopeLowAngleCur = -180.000000;
vertSlopeLowAnglePoint = vertSlopeLowAngleTo;
return;
}
vertSlopeLowAnglePoint = point;
vertSlopeLowAngleCur = AngleNormalize180(VecGetAngleBetween(wall
NormalOrigin - point, vectorUp));
if (VecDot(wallNormalOrigin - point, wallNormalDirection) > 0.00
0000){
vertSlopeLowAngleCur *= -1.000000;
}
/* NOP */;
}
private function ComputeVerticalFreeDistanceInFront(){
var position : Vector;
var point : Vector;
var normal : Vector;

var slope : Vector;


var heightNeeded : Float;
if (heightTarget <= vertFreeHeightGrndMax){
vertFreeHeightCur = vertFreeHeightMin;
return;
}
position = wallNormalOrigin + vertFreeHorOffset + vertFreeHorMin
* 2.000000 * wallNormalDirection;
position.Z = groundEndPoint.Z;
heightNeeded = MinF(heightTarget - vertFreeHeightGrndMax, vertFr
eeHeightMin);
heightNeeded = MaxF(0.000000, heightNeeded);
vertFreeFrom = position + vectorUp;
vertFreeTo = position - vectorUp * heightNeeded;
if (!theGame.GetWorld().SweepTest(vertFreeFrom, vertFreeTo, vert
FreeHorMin, point, normal, collisionObstaclesNames)){
vertFreeHeightCur = vertFreeHeightMin;
return;
} else {
vertFreeHeightCur = position.Z - point.Z;
vertFreeCollPoint = point;
}
/* NOP */;
}
private function DoWeHaveAValidCeiling() : Bool{
if (ceilingFound && ceilingHeightFree < ceilingHeightNeeded){
FailedClimbCheckBecause("Real ceiling is too low: ");
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveHeightForBottomGround() : Bool{
var exploratorPosition : Vector;
exploratorPosition = exploratorPosition;
if (groundEndPoint.Z < exploratorPosition.Z + heightTotalMin + c
eilingHeightNeeded){
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveGroundStartUp() : Bool{
if (!groundFound){
FailedClimbCheckBecause("No ground found: ");
return false;
} else if (heightTarget < heightTotalMin){
FailedClimbCheckBecause("Ground too low: " + heightTarge
t + " < heightTotalMin: " + heightTotalMin);
return false;
} else if (groundEndNormal.Z <= groundNormalMinZ){
FailedClimbCheckBecause("Ground normal Z: " + groundEndN
ormal.Z + " <= groundNormalMinZ: " + groundNormalMinZ);
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveGround() : Bool{
if (!groundFound){

FailedClimbCheckBecause("No ground found: ");


return false;
} else if (heightTarget < heightTotalMin){
FailedClimbCheckBecause("Ground too low: " + heightTarge
t + " < heightTotalMin: " + heightTotalMin);
return false;
} else if (heightTarget > heightTotalMax){
FailedClimbCheckBecause("Ground too high: " + heightTarg
et + " > heightTotalMax: " + heightTotalMax);
return false;
} else if (groundEndNormal.Z <= groundNormalMinZ){
FailedClimbCheckBecause("Ground normal Z: " + groundEndN
ormal.Z + " <= groundNormalMinZ: " + groundNormalMinZ);
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveAClimbableGround() : Bool{
if (!climbableFound){
if (climbableObjTagOnLayer){
FailedClimbCheckBecause("Found an object on a no
n climbable layer in range: " + climbableObjName);
} else {
FailedClimbCheckBecause("Found an object not cli
mbableFound in range: " + climbableObjName);
}
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveAWall() : Bool{
if (!wallFound){
FailedClimbCheckBecause("No wall or edge found: ");
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveSpaceBetweenGroundAndCeiling() : Bool{
var freeSpace : Float;
if (ceilingFound){
freeSpace = ceilingPoint.Z - groundEndPoint.Z;
if (freeSpace < ceilingHeightNeeded){
FailedClimbCheckBecause("Space between ground an
d ceiling is too small: " + ceilingHeightFree);
return false;
}
}
return true;
/* NOP */;
}
private function DoWeHaveEnoughSpace() : Bool{
if (holeIsBlocked){
FailedClimbCheckBecause("The hole not existing or not be
ing big enough");
return false;
}
return true;

/* NOP */;
}
private function DoWeHaveProperHorizontalDiff() : Bool{
if (vaultingFound == 1){
if (horizHeightAngleCur < horizHeightAngleMin || horizHe
ightAngleCur > horizHeightAngleMax){
FailedClimbCheckBecause("Horizontal height diffe
rence angle is too big : " + horizHeightAngleCur + ", " + horizHeightAngleMin +
"' " + horizHeightAngleMax);
return false;
}
} else if (!horizFoundLeft && !horizFoundRight){
FailedClimbCheckBecause("Horizontal space is not wide en
ough ");
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveProperSlope() : Bool{
var dot : Float;
dot = VecDot(groundEndNormal, vectorUp);
if (dot < slopeNormalZMax){
FailedClimbCheckBecause("The slope Z found is too big fo
r a climb: " + groundEndNormal.Z);
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveProperVerticalSlope() : Bool{
if (AbsF(vertSlopeAngleCur) > vertSlopeAngleMax){
FailedClimbCheckBecause("Vertical slope is too much: Abs
F( " + vertSlopeAngleCur + " ) > " + vertSlopeAngleMax);
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveProperVerticalSlopeLow() : Bool{
if (vertSlopeLowAngleCur > vertSlopeLowAngleMax){
FailedClimbCheckBecause("Vertical LOW slope is too much:
" + vertSlopeLowAngleCur + " > " + vertSlopeLowAngleMax);
return false;
}
return true;
/* NOP */;
}
private function DoWeHaveEnoughVerticalFreeDistance() : Bool{
if (vertFreeHeightCur < vertFreeHeightMin){
FailedClimbCheckBecause("Not enough free vert space in f
ront of the wall " + vertFreeHeightCur + " < " + vertFreeHeightMin);
return false;
}
return true;
/* NOP */;
}
private function FailedClimbCheckBecause(failExplanation : String){
valid = false;
if (debugLogFails){

debugLastErrorMessage = debugPrefix + " climb probe fail


ed because " + failExplanation;
if (debugIsTop){
debugLastErrorPosition = thePlayer.GetWorldPosit
ion() + vectorUp * 2.000000;
} else {
debugLastErrorPosition = thePlayer.GetWorldPosit
ion() + vectorUp * 1.000000;
}
LogExplorationClimb(debugLastErrorMessage);
}
/* NOP */;
}
private function GetVerticalAngle(from : Vector, to : Vector) : Float{
var slopeFlat : Vector;
var slope : Vector;
var angle : Float;
slope = VecNormalize(from - to);
slopeFlat = slope;
slopeFlat.Z = 0.000000;
slopeFlat = VecNormalize(slopeFlat);
angle = AngleNormalize180(VecGetAngleBetween(slope, slopeFlat));
if (slope.Z < 0.000000){
angle *= -1.000000;
}
return angle;
/* NOP */;
}
public function GetDebugText() : String{
var text : String;
text = "";
if (climbableObjForceAllow){
if (climbableObjTagOnLayer){
text += "Force unlocked by layer of object ";
} else {
text += "Force unlocked by object ";
}
text += climbableObjName + ", ";
}
text += "Height: " + heightTarget + ", Ceiling height free: " +
ceilingHeightFree + ", Horizontal diff: " + horizHeightAngleCur + " SlopeVertUp
: " + vertSlopeAngleCur + " SlopeVertDown: " + vertSlopeLowAngleCur;
return text;
/* NOP */;
}
private function PrepareDebugPositions(){
if (!debugDrawGraphics){
return;
}
climbablePoint = vectorZero;
if (debugCeiling){
ceilingCheckFrom = vectorZero;
ceilingPoint = vectorZero;
}
if (debugGround){
groundEndPoint = vectorZero;
groundCheckFrom = vectorZero;
groundCheckTo = vectorZero;
}
if (debugWall){

wallNormalOrigin = vectorZero;
wallCheckFromL = vectorZero;
wallCheckToL = vectorZero;
wallCollL = vectorZero;
wallCollR = vectorZero;
}
if (debugHole){
holeCollision = vectorZero;
holeCheckFrom = vectorZero;
holeCheckTo = vectorZero;
}
if (debugVault){
vaultCheckFrom = vectorZero;
vaultCheckTo = vectorZero;
vaultCollision = vectorZero;
}
if (debugHorSlope){
horizPointLeft = vectorZero;
horizPointRight = vectorZero;
}
if (debugVertSlope){
vertSlopeAngleFrom = vectorZero;
vertSlopeAngleTo = vectorZero;
vertSlopeAnglePoint = vectorZero;
}
if (debugVertFree){
vertFreeFrom = vectorZero;
vertFreeTo = vectorZero;
vertFreeCollPoint = vectorZero;
}
if (debugPlatform){
platformCollision = vectorZero;
platformFrom = vectorZero;
platformTo = vectorZero;
}
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, active : Bool) : Bool{
var vecAux : Vector;
var colorAux : Color;
var textAux : String;
var smallRadius : Float;
var verySmallRadius : Float;
var heightText : Float;
smallRadius = 0.200000;
verySmallRadius = 0.050000;
heightText = 0.100000;
if (!debugDrawGraphics){
return true;
}
if (debugCeiling){
colorAux = Color(255 / debugColorDiv, 0, 0);
vecAux = ceilingCheckFrom;
vecAux.Z = ceilingPoint.Z;
frame.DrawLine(ceilingCheckFrom, ceilingCheckTo, colorAu
x);
frame.DrawSphere(vecAux, ceilingRadius, colorAux);
frame.DrawText("C", ceilingPoint, colorAux);
frame.DrawText("" + ceilingHeightFree, ceilingPoint - ve

ctorUp * heightText, colorAux);


}
if (debugGround){
colorAux = Color(0, 255 / debugColorDiv, 0);
frame.DrawLine(groundEndPoint, groundEndPoint + groundEn
dNormal, colorAux);
frame.DrawLine(groundCheckFrom, groundCheckTo, colorAux)
;
frame.DrawSphere(groundEndPoint, smallRadius, colorAux);
if (groundRefined){
frame.DrawText("G-R", groundEndPoint, colorAux);
} else {
frame.DrawText("G", groundEndPoint, colorAux);
}
frame.DrawText("" + heightTarget, groundEndPoint - vecto
rUp * heightText, colorAux);
}
if (debugWall){
colorAux = Color(0, 0, 255 / debugColorDiv);
frame.DrawLine(wallNormalOrigin, wallNormalOrigin + wall
NormalDirection, colorAux);
frame.DrawLine(wallCheckFromL, wallCheckToL, colorAux);
frame.DrawLine(wallCheckFromR, wallCheckToR, colorAux);
frame.DrawSphere(wallCollL, wallRadiusToCheck, colorAux)
;
frame.DrawSphere(wallCollR, wallRadiusToCheck, colorAux)
;
frame.DrawSphere(wallNormalOrigin, verySmallRadius, colo
rAux);
frame.DrawText("W", wallNormalOrigin, colorAux);
frame.DrawText("WL", wallCollL, colorAux);
frame.DrawText("WR", wallCollR, colorAux);
}
if (debugHole){
colorAux = Color(255 / debugColorDiv, 0, 255 / debugColo
rDiv);
vecAux = holeCollision;
vecAux.Z = holeCheckFrom.Z;
frame.DrawLine(holeCheckFrom, holeCheckTo, colorAux);
frame.DrawSphere(vecAux, characterRadius, colorAux);
frame.DrawText("HF", holeCheckFrom, colorAux);
frame.DrawText("HT", holeCheckTo, colorAux);
frame.DrawText("H", holeCollision, colorAux);
}
if (debugVault){
colorAux = Color(0, 255 / debugColorDiv, 255 / debugColo
rDiv);
frame.DrawLine(vaultCheckFrom, vaultCheckTo, colorAux);
vecAux = vaultCheckFrom;
vecAux.Z = vaultCollision.Z;
frame.DrawSphere(vaultCheckFrom - vectorUp * vaultHeight
Offset, vaultRadius, colorAux);
frame.DrawText("V", vaultCollision, colorAux);
frame.DrawText("" + vaultHeight, vaultCollision - vector
Up * heightText, colorAux);
}
if (debugHorSlope){
colorAux = Color(255 / debugColorDiv, 0, 255 / debugColo
rDiv);
frame.DrawSphere(horizPointLeft, horizHeightRdius, color

Aux);
frame.DrawSphere(horizPointRight, horizHeightRdius, colo
rAux);
frame.DrawText("l", horizPointLeft, colorAux);
frame.DrawText("r", horizPointRight, colorAux);
frame.DrawText("" + horizHeightAngleCur, horizPointLeft
- vectorUp * heightText, colorAux);
}
if (debugVertSlope){
colorAux = Color(255 / debugColorDiv, 0, 0);
frame.DrawLine(vertSlopeAngleFrom, vertSlopeAngleTo, col
orAux);
frame.DrawSphere(vertSlopeAnglePoint, horizHeightRdius,
colorAux);
frame.DrawText("A", vertSlopeAnglePoint, colorAux);
frame.DrawText("" + vertSlopeAngleCur, vertSlopeAnglePoi
nt - vectorUp * heightText, colorAux);
frame.DrawLine(vertSlopeLowAngleFrom, vertSlopeLowAngleT
o, colorAux);
frame.DrawSphere(vertSlopeLowAnglePoint, horizHeightRdiu
s, colorAux);
frame.DrawText("AL", vertSlopeLowAnglePoint, colorAux);
frame.DrawText("" + vertSlopeLowAngleCur, vertSlopeLowAn
glePoint - vectorUp * heightText, colorAux);
}
if (debugVertFree){
colorAux = Color(255 / debugColorDiv, 0, 0);
frame.DrawLine(vertFreeFrom, vertFreeTo, colorAux);
frame.DrawSphere(vertFreeCollPoint, vertFreeHorMin, colo
rAux);
frame.DrawText("Ff", vertFreeFrom, colorAux);
frame.DrawText("Ft", vertFreeTo, colorAux);
frame.DrawText("F", vertFreeCollPoint, colorAux);
}
if (debugPlatform){
colorAux = Color(255 / debugColorDiv, 255 / debugColorDi
v, 0);
frame.DrawSphere(platformCollision, platformRadius, colo
rAux);
frame.DrawLine(platformFrom, platformTo, colorAux);
frame.DrawText("" + platformFound, platformFrom, colorAu
x);
frame.DrawText("P", platformTo, colorAux);
}
if (!climbableFound){
colorAux = Color(255 / debugColorDiv, 0, 0);
textAux = "Lock Climb: " + climbableObjName;
if (climbableObjTagOnLayer){
textAux += " Locked by layer";
}
frame.DrawText(textAux, climbablePoint + vectorUp * 0.50
0000, colorAux);
}
colorAux = Color(255 / debugColorDiv, 0, 0);
frame.DrawText(debugLastErrorMessage, debugLastErrorPosition, co
lorAux);
return true;
/* NOP */;
}
}

import abstract class IBehaviorGraphPointCloudLookAtTransition{


}
import abstract class CBehaviorGraphPointCloudLookAtSecMotion{
}
import struct CScriptedRenderFrame{
import public function DrawText(text : String, position : Vector, color
: Color);
import public function DrawSphere(position : Vector, radius : Float, col
or : Color);
import public function DrawLine(start : Vector, end : Vector, color : Co
lor);
}
import abstract class IBehaviorScript{
}
import abstract class CBehaviorGraphVectorValueNode{
}
import abstract class CSkeletalAnimationSet{
}
import abstract class EulerAngles{
//NULL type for Pitch
//NULL type for Yaw
//NULL type for Roll
}
import abstract class Vector{
//NULL type for Z
//NULL type for W
//NULL type for X
//NULL type for Y
}
class CInputAxisDoubleTap extends CObject{
public editable var m_ActionN : CName;
public editable var m_ThresholdUnpressF : Float;
public editable var m_ThresholdPressF : Float;
public editable var m_TimeThresholdF : Float;
private var m_IsActivatedB : Bool;
private var m_PressedNowB : Bool;
private var m_UnpressedNowB : Bool;
private var m_TimeF : Float;
private var m_LastTimesUnpressFArr : array<Float>;
private var m_LastTimesPressFArr : array<Float>;
public function Initialize(_ActionN : CName, _PressF : Float, _UnpressF
: Float, _TimeF : Float){
m_ActionN = _ActionN;
m_ThresholdUnpressF = _PressF;
m_ThresholdPressF = _UnpressF;
m_TimeThresholdF = _TimeF;
ResetValues();
m_TimeF = 0.000000;
/* NOP */;
}
private function ResetValues(){

m_LastTimesUnpressFArr.Clear();
m_LastTimesUnpressFArr.PushBack(2.000000);
m_LastTimesUnpressFArr.PushBack(2.000000);
m_LastTimesPressFArr.Clear();
m_LastTimesPressFArr.PushBack(1.000000);
m_LastTimesPressFArr.PushBack(1.000000);
m_PressedNowB = false;
m_UnpressedNowB = false;
m_IsActivatedB = false;
/* NOP */;
}
public function Update(){
var l_ValueF : Float;
m_TimeF = theGame.GetEngineTimeAsSeconds();
l_ValueF = theInput.GetActionValue(m_ActionN);
if (CheckPressB(l_ValueF)){
if (!m_PressedNowB){
m_LastTimesPressFArr[0] = m_LastTimesPressFArr[1
];
}
m_LastTimesPressFArr[1] = m_TimeF;
m_PressedNowB = true;
} else {
if (CheckUnPressB(l_ValueF)){
if (!m_UnpressedNowB){
m_LastTimesUnpressFArr[0] = m_LastTimesU
npressFArr[1];
}
m_LastTimesUnpressFArr[1] = m_TimeF;
m_UnpressedNowB = true;
} else {
m_UnpressedNowB = false;
}
m_PressedNowB = false;
}
m_IsActivatedB = CheckActivation();
/* NOP */;
}
private function CheckPressB(_ValueF : Float) : Bool{
if (m_ThresholdPressF > 0.000000){
return _ValueF >= m_ThresholdPressF;
} else {
return _ValueF <= m_ThresholdPressF;
}
/* NOP */;
}
private function CheckUnPressB(_ValueF : Float) : Bool{
if (m_ThresholdPressF >= 0.000000){
return _ValueF <= m_ThresholdUnpressF;
} else {
return _ValueF >= m_ThresholdUnpressF;
}
/* NOP */;
}
private function CheckActivation() : Bool{
if (m_LastTimesUnpressFArr[1] > m_LastTimesPressFArr[1]){
return false;
}
if (m_LastTimesPressFArr[1] > m_TimeF + m_TimeThresholdF){
return false;

}
if (m_LastTimesUnpressFArr[1] > m_LastTimesPressFArr[1] + m_Time
ThresholdF){
return false;
}
if (m_LastTimesPressFArr[0] > m_LastTimesUnpressFArr[1] + m_Time
ThresholdF){
return false;
}
if (m_LastTimesUnpressFArr[1] > m_LastTimesPressFArr[0] + m_Time
ThresholdF){
return false;
}
return true;
/* NOP */;
}
public function IsActiveB() : Bool{
return m_IsActivatedB;
/* NOP */;
}
public function ConsumeIfActivated(){
if (m_IsActivatedB){
ResetValues();
}
/* NOP */;
}
}
import struct CActionMoveAnimationProxy{
import public function IsInitialized() : Bool;
import public function IsValid() : Bool;
import public function IsFinished() : Bool;
import public function WillBeFinished(time : Float) : Bool;
}
class NavigationCorrection extends CObject{
public var corrected : Bool;
public var direction : Vector;
public var angle : Float;
public var type : EMovementCorrectionType;
public var color : Color;
public function Set(isCorrected : Bool, oldDirection : Vector, newDirect
ion : Vector){
corrected = isCorrected;
direction = newDirection;
angle = AngleDistance(VecHeading(oldDirection), VecHeading(newDi
rection));
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, selected : Bool) : Bool{
var origin : Vector;
var end : Vector;
if (!corrected){
return true;
}
origin = thePlayer.GetWorldPosition();
end = thePlayer.GetWorldPosition() + direction * 2.000000;
frame.DrawLine(origin, end, color);
if (selected){

frame.DrawSphere(end, 0.200000, color);


}
return true;
/* NOP */;
}
}
import abstract class IBehaviorGraphRetargetCharacterNodeMethod{
}
import abstract class CDyngResource{
}
import abstract class CDropPhysicsSetup{
}
import abstract class SDropPhysicsCurves{
}
class CDoorMarking extends CScriptedComponent{
private editable var changeCamera : Bool;
private var calculated : Bool;
private var pointA : Vector;
private var pointB : Vector;
private var middlePoint : Vector;
private var normal : Vector;
private var checkState : EDoorMarkingState;
private var initialized : Bool;
public function OnComponentAttached() : Bool{
initialized = false;
PreInit();
/* NOP */;
}
public function PreInit(){
var entity : CEntity;
var gameplayEntity : CGameplayEntity;
calculated = false;
entity = GetEntity();
if (entity){
gameplayEntity = (CGameplayEntity)entity;
if (gameplayEntity){
gameplayEntity.EnableVisualDebug(29, true);
}
SetProperTags();
initialized = true;
}
/* NOP */;
}
private function SetProperTags(){
var tag : CName;
var tags : array<CName>;
var i : Int32;
var entity : CEntity;
tag = 'navigation_correction';
entity = GetEntity();
if (entity){
if (!entity.HasTag(tag)){
tags = entity.GetTags();
tags.PushBack(tag);
entity.SetTags(tags);

}
}
/* NOP */;
}
public function GetClosestPointAndNormal(outPoint : Vector, outNormal :
Vector){
if (!calculated){
CalculateData();
}
outPoint = middlePoint;
outNormal = normal;
/* NOP */;
}
private function CalculateData(){
var aux : Float;
if (!initialized){
PreInit();
}
CalculatePoints();
middlePoint = pointB + pointA * 0.500000;
normal = pointB - pointA;
aux = normal.X;
normal.X = -normal.Y;
normal.Y = aux;
normal.Z = 0.000000;
normal = VecNormalize(normal);
calculated = true;
/* NOP */;
}
private function CalculatePoints(){
var slotMatrix : Matrix;
GetEntity().CalcEntitySlotMatrix('point_a', slotMatrix);
pointA = MatrixGetTranslation(slotMatrix);
GetEntity().CalcEntitySlotMatrix('point_b', slotMatrix);
pointB = MatrixGetTranslation(slotMatrix);
/* NOP */;
}
public function SetCheckState(check : EDoorMarkingState){
checkState = check;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags) : Bool{
var offsetVec : Vector;
var color : Color;
switch(checkState){
case 0:
color = Color(230, 140, 140);
break;
case 1:
color = Color(0, 0, 255);
break;
case 2:
color = Color(0, 255, 0);
break;
}
checkState = 0;
offsetVec = Vector(0, 0, 0.100000);
CalculateData();
frame.DrawText("doorway", GetWorldPosition() + offsetVec * 5.000

000, color);
frame.DrawSphere(pointA, 0.100000, color);
frame.DrawSphere(pointB, 0.100000, color);
frame.DrawLine(pointA, pointB, color);
frame.DrawLine(pointA + offsetVec, pointB + offsetVec, color);
frame.DrawSphere(middlePoint, 0.050000, color);
frame.DrawLine(middlePoint + offsetVec - normal * 0.500000, midd
lePoint + normal * 0.500000 + offsetVec, color);
return true;
/* NOP */;
}
public function IsChangingCamera() : Bool{
return changeCamera;
/* NOP */;
}
}
import abstract class CBrushFace{
}
import abstract class CBrushComponent{
}
import abstract class IParticleModule{
}
import struct CR4CameraDirector{
}
import abstract class IParticleDrawer{
}
import abstract class CDecalSpawner{
}
class CExplorationInput extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private var m_InputMoveOnPadV : Vector;
private var m_InputMoveOnPlaneV : Vector;
private var m_InputMoveOnPadNormalizedV : Vector;
private var m_InputMoveOnPlaneNormalizedV : Vector;
private var m_InputMoveOnCameraNormalizedV : Vector;
private var m_InputMoveDiffOnHeadingF : Float;
private var m_InputMoveHeadingOnPlaneF : Float;
private var m_InputModuleF : Float;
private editable var m_InputMinModuleF : Float;
private editable var m_InputRunModuleF : Float;
private editable var m_InputHeadingDifMaxF : Float;
private editable var m_InputHeadingDifReflectedF : Float;
protected editable var m_JumpTimeGapF : Float;
protected editable var m_RollTimePrevF : Float;
private editable var m_InputDoubleTapPressValF : Float;
private editable var m_InputDoubleTapUnPressValF : Float;
private editable var m_InputDoubleTapTimeGapF : Float;
public editable var m_UseDoubleTapOnAxisB : Bool;
private var m_InputLeftO : CInputAxisDoubleTap;
private var m_InputRightO : CInputAxisDoubleTap;
private var m_InputDownO : CInputAxisDoubleTap;
private var m_InputUpO : CInputAxisDoubleTap;
private var m_SprintDoubletapO : CInputAxisDoubleTap;

private editable var m_ActionJumpN : CName;


private editable var m_ActionExplorationN : CName;
private editable var m_ActionInteractionN : CName;
private editable var m_ActionRollN : CName;
private editable var m_ActionSprintN : CName;
private editable var m_ActionSkateJumpN : CName;
private editable var m_ActionDashN : CName;
private editable var m_ActionDriftN : CName;
private editable var m_ActionAttackN : CName;
private editable var m_ActionAttackAltN : CName;
private editable var m_ActionParryN : CName;
private editable var m_SprintLastActivationTimeF : Float;
public function Initialize(_ExplorationO : CExplorationStateManager){
m_ExplorationO = _ExplorationO;
if (m_UseDoubleTapOnAxisB){
m_InputLeftO = new CInputAxisDoubleTap in this;
m_InputRightO = new CInputAxisDoubleTap in this;
m_InputUpO = new CInputAxisDoubleTap in this;
m_InputDownO = new CInputAxisDoubleTap in this;
m_SprintDoubletapO = new CInputAxisDoubleTap in this;
m_InputLeftO.Initialize('GI_AxisLeftX', -m_InputDoubleTa
pPressValF, -m_InputDoubleTapUnPressValF, m_InputDoubleTapTimeGapF);
m_InputRightO.Initialize('GI_AxisLeftX', m_InputDoubleTa
pPressValF, m_InputDoubleTapUnPressValF, m_InputDoubleTapTimeGapF);
m_InputDownO.Initialize('GI_AxisLeftY', -m_InputDoubleTa
pPressValF, -m_InputDoubleTapUnPressValF, m_InputDoubleTapTimeGapF);
m_InputUpO.Initialize('GI_AxisLeftY', m_InputDoubleTapPr
essValF, m_InputDoubleTapUnPressValF, m_InputDoubleTapTimeGapF);
m_SprintDoubletapO.Initialize(m_ActionSprintN, m_InputDo
ubleTapPressValF, m_InputDoubleTapUnPressValF, m_InputDoubleTapTimeGapF);
}
m_SprintLastActivationTimeF = 0.000000;
/* NOP */;
}
public function Update(_Dt : Float){
UpdateDirectionVectors();
UpdateHeading();
if (m_UseDoubleTapOnAxisB){
UpdateAxesDoubletaps();
}
/* NOP */;
}
private function UpdateAxesDoubletaps(){
m_InputLeftO.Update();
m_InputRightO.Update();
m_InputUpO.Update();
m_InputDownO.Update();
m_SprintDoubletapO.Update();
/* NOP */;
}
private function UpdateSimpleActions(_Dt : Float){
m_SprintLastActivationTimeF += _Dt;
if (thePlayer.IsActionAllowed(14) && thePlayer.IsActionAllowed(2
6)){
if (theInput.GetActionValue(m_ActionSprintN)){
m_SprintLastActivationTimeF = 0.000000;
}
}
/* NOP */;
}

private function UpdateDirectionVectors(){


var l_InputMoveOnCameraV : Vector;
m_InputMoveOnPadV.X = theInput.GetActionValue('GI_AxisLeftX');
m_InputMoveOnPadV.Y = theInput.GetActionValue('GI_AxisLeftY');
m_InputMoveOnPadV.Z = 0.000000;
m_InputMoveOnPadV.W = 0.000000;
m_InputModuleF = VecLengthSquared(m_InputMoveOnPadV);
if (m_InputModuleF < m_InputMinModuleF){
SetZeroInput();
return;
}
m_InputModuleF = SqrtF(m_InputModuleF);
m_InputMoveOnPadNormalizedV = m_InputMoveOnPadV / m_InputModuleF
;
if (m_InputModuleF > 1.000000){
m_InputModuleF = 1.000000;
m_InputMoveOnPadV = m_InputMoveOnPadNormalizedV;
}
l_InputMoveOnCameraV = theCamera.GetCameraRight() * m_InputMoveO
nPadV.X + theCamera.GetCameraForward() * m_InputMoveOnPadV.Y;
m_InputMoveOnCameraNormalizedV = VecNormalize(l_InputMoveOnCamer
aV);
m_InputMoveOnPlaneV = l_InputMoveOnCameraV;
m_InputMoveOnPlaneV.Z = 0.000000;
m_InputMoveOnPlaneNormalizedV = VecNormalize(m_InputMoveOnPlaneV
);
m_InputMoveOnPlaneV = m_InputModuleF * m_InputMoveOnPlaneNormali
zedV;
/* NOP */;
}
private function SetZeroInput(){
m_InputModuleF = 0.000000;
VecSetZeros(m_InputMoveOnPadV);
VecSetZeros(m_InputMoveOnPadNormalizedV);
VecSetZeros(m_InputMoveOnCameraNormalizedV);
VecSetZeros(m_InputMoveOnPlaneV);
VecSetZeros(m_InputMoveOnPlaneNormalizedV);
/* NOP */;
}
private function UpdateHeading(){
var l_InputVectorV : Vector;
var l_CharacterHeadingF : Float;
if (m_InputModuleF < m_InputMinModuleF){
l_InputVectorV = theCamera.GetCameraForwardOnHorizontalP
lane();
} else {
l_InputVectorV = m_InputMoveOnPlaneV;
}
m_InputMoveHeadingOnPlaneF = AngleNormalize180(VecHeading(l_Inpu
tVectorV));
l_CharacterHeadingF = AngleNormalize180(m_ExplorationO.m_OwnerE.
GetHeading());
m_InputMoveDiffOnHeadingF = AngleDistance(m_InputMoveHeadingOnPl
aneF, l_CharacterHeadingF);
/* NOP */;
}
public function PostUpdate(_Dt : Float){
if (m_UseDoubleTapOnAxisB){
m_InputLeftO.ConsumeIfActivated();
m_InputRightO.ConsumeIfActivated();

m_InputUpO.ConsumeIfActivated();
m_InputDownO.ConsumeIfActivated();
m_SprintDoubletapO.ConsumeIfActivated();
}
/* NOP */;
}
public function GetDoubleTapUp() : Bool{
return m_UseDoubleTapOnAxisB && m_InputUpO.IsActiveB();
/* NOP */;
}
public function GetDoubleTapDownB() : Bool{
return m_UseDoubleTapOnAxisB && m_InputDownO.IsActiveB();
/* NOP */;
}
public function GetDoubleTapLeftB() : Bool{
return m_UseDoubleTapOnAxisB && m_InputLeftO.IsActiveB();
/* NOP */;
}
public function GetDoubleTapRightB() : Bool{
return m_UseDoubleTapOnAxisB && m_InputRightO.IsActiveB();
/* NOP */;
}
public function GetDoubleTapRollB() : Bool{
return m_UseDoubleTapOnAxisB && m_SprintDoubletapO.IsActiveB();
/* NOP */;
}
public function GetModuleF() : Float{
return m_InputModuleF;
/* NOP */;
}
public function GetMovementOnPadV() : Vector{
return m_InputMoveOnPadV;
/* NOP */;
}
public function GetMovementOnPadNormalizedV() : Vector{
return m_InputMoveOnPadNormalizedV;
/* NOP */;
}
public function GetMovementOnCameraNormalizedV() : Vector{
return m_InputMoveOnCameraNormalizedV;
/* NOP */;
}
public function GetMovementOnPlaneV() : Vector{
return m_InputMoveOnPlaneV;
/* NOP */;
}
public function GetMovementOnPlaneNormalizedV() : Vector{
return m_InputMoveOnPlaneNormalizedV;
/* NOP */;
}
public function GetHeadingOnPadF() : Float{
return VecHeading(m_InputMoveOnPadV);
/* NOP */;
}
public function GetHeadingOnPlaneF() : Float{
return m_InputMoveHeadingOnPlaneF;
/* NOP */;
}
public function GetHeadingDiffFromPlayerF() : Float{
return m_InputMoveDiffOnHeadingF;

/* NOP */;
}
public function GetHeadingDiffFromYawF(yaw : Float) : Float{
yaw = AngleNormalize180(yaw);
return AngleDistance(m_InputMoveHeadingOnPlaneF, yaw);
/* NOP */;
}
public function ComputeHeadingDiffWithReflectionF(targetHeading : Float,
reflectAllow : Bool, diffReal : Float, diffPercent : Float, shouldReflect : Boo
l, requireinputModule : Bool){
var directionDiffAbs : Float;
if (requireinputModule){
if (!IsModuleConsiderable()){
diffReal = 0.000000;
diffPercent = 0.000000;
return;
}
}
targetHeading = AngleNormalize180(targetHeading);
diffReal = AngleDistance(m_InputMoveHeadingOnPlaneF, targetHeadi
ng);
directionDiffAbs = AbsF(diffReal);
shouldReflect = directionDiffAbs > m_InputHeadingDifReflectedF;
if (reflectAllow && shouldReflect){
directionDiffAbs = 180.000000 - directionDiffAbs;
diffReal = directionDiffAbs * SignF(diffReal);
}
if (directionDiffAbs > m_InputHeadingDifMaxF){
directionDiffAbs = m_InputHeadingDifMaxF;
diffReal = SignF(diffReal) * m_InputHeadingDifMaxF;
}
diffPercent = diffReal / m_InputHeadingDifMaxF;
/* NOP */;
}
public function GetInputDirOnSlopeDot() : Float{
var slideDir : Vector;
var slideNormal : Vector;
var input : Vector;
var slideDir2D : Vector;
var dot : Float;
input = GetMovementOnPlaneV();
m_ExplorationO.m_MoverO.GetSlideDirAndNormal(slideDir, slideNorm
al);
slideDir2D = slideDir;
slideDir2D.Z = 0.000000;
slideDir2D = VecNormalize(slideDir2D);
dot = VecDot(input, slideDir2D);
return dot;
/* NOP */;
}
public function IsModuleConsiderable() : Bool{
return m_InputModuleF >= m_InputMinModuleF;
/* NOP */;
}
public function IsModuleRunning() : Bool{
return m_InputModuleF >= m_InputRunModuleF;
/* NOP */;
}
public function IsRollPressedInTime() : Bool{
if (!thePlayer.IsActionAllowed(11)){

return false;
}
return theInput.GetLastActivationTime(m_ActionRollN) < m_RollTim
ePrevF;
/* NOP */;
}
public function IsRollJustPressed() : Bool{
if (thePlayer.IsActionAllowed(11)){
return theInput.IsActionJustPressed(m_ActionRollN);
}
return false;
/* NOP */;
}
public function IsGuardPressed() : Bool{
if (thePlayer.IsActionAllowed(25)){
return theInput.IsActionJustPressed(m_ActionParryN);
}
return false;
/* NOP */;
}
public function IsJumpPressedInTime() : Bool{
return theInput.GetLastActivationTime(m_ActionJumpN) < m_JumpTim
eGapF;
/* NOP */;
}
public function GetJumpLastJustPressedTime() : Float{
return theInput.GetLastActivationTime(m_ActionJumpN);
/* NOP */;
}
public function GetJumpTimeGap() : Float{
return m_JumpTimeGapF;
/* NOP */;
}
public function IsJumpJustPressed() : Bool{
return theInput.IsActionJustPressed(m_ActionJumpN);
/* NOP */;
}
public function IsJumpJustReleased() : Bool{
return theInput.IsActionJustReleased(m_ActionJumpN);
/* NOP */;
}
public function IsJumpPressed() : Bool{
return theInput.IsActionPressed(m_ActionJumpN);
/* NOP */;
}
public function IsExplorationJustPressed() : Bool{
return theInput.IsActionJustPressed(m_ActionExplorationN);
/* NOP */;
}
public function IsInteractionJustPressed() : Bool{
return theInput.IsActionJustPressed(m_ActionInteractionN);
/* NOP */;
}
public function IsExplorationPressed() : Bool{
return theInput.IsActionPressed(m_ActionExplorationN);
/* NOP */;
}
public function GetExplorationLastJustPressedTime() : Float{
return theInput.GetLastActivationTime(m_ActionExplorationN);
/* NOP */;

}
public function GetIsDebugKeyPressed() : Bool{
if (theGame.IsFinalBuild()){
return false;
}
return theInput.IsActionPressed('DebugInput');
/* NOP */;
}
public function IsSprintJustPressed() : Bool{
if (!thePlayer.IsActionAllowed(14) && thePlayer.IsActionAllowed(
26)){
return false;
}
return theInput.IsActionJustPressed(m_ActionSprintN);
/* NOP */;
}
public function IsSprintPressed() : Bool{
if (!thePlayer.IsActionAllowed(14) && thePlayer.IsActionAllowed(
26)){
return false;
}
return theInput.GetActionValue(m_ActionSprintN);
/* NOP */;
}
public function IsSprintPressedInTime(time : Float) : Bool{
if (thePlayer.IsActionAllowed(14) && thePlayer.IsActionAllowed(2
6)){
return theInput.GetLastActivationTime(m_ActionSprintN) <
time;
}
return false;
/* NOP */;
}
public function IsSkateJumpJustPressed() : Bool{
if (!thePlayer.IsActionAllowed(10)){
return false;
}
return theInput.IsActionJustPressed(m_ActionSkateJumpN);
/* NOP */;
}
public function GetSkateJumpLastPressedTime() : Float{
if (!thePlayer.IsActionAllowed(10)){
return -1000.000000;
}
return theInput.GetLastActivationTime(m_ActionSkateJumpN);
/* NOP */;
}
public function IsDashJustPressed() : Bool{
if (!thePlayer.IsActionAllowed(14)){
return false;
}
return theInput.IsActionJustPressed(m_ActionDashN);
/* NOP */;
}
public function IsDashPressed() : Bool{
if (!thePlayer.IsActionAllowed(14)){
return false;
}
return theInput.GetActionValue(m_ActionDashN);
/* NOP */;

}
public function GetDashLastPressedTime() : Float{
if (!thePlayer.IsActionAllowed(14)){
return -1000.000000;
}
return theInput.GetLastActivationTime(m_ActionDashN);
/* NOP */;
}
public function IsDriftJustPressed() : Bool{
if (!thePlayer.IsActionAllowed(14)){
return false;
}
return theInput.IsActionJustPressed(m_ActionDriftN);
/* NOP */;
}
public function IsDriftPressed() : Bool{
if (!thePlayer.IsActionAllowed(14)){
return false;
}
return theInput.GetActionValue(m_ActionDriftN);
/* NOP */;
}
public function GetDriftLastPressedTime() : Float{
if (!thePlayer.IsActionAllowed(14)){
return -1000.000000;
}
return MinF(theInput.GetLastActivationTime(m_ActionDriftN), theI
nput.GetLastActivationTime(m_ActionAttackAltN));
/* NOP */;
}
public function IsSkateAttackPressed() : Bool{
return theInput.IsActionPressed(m_ActionAttackN) || theInput.IsA
ctionPressed(m_ActionAttackAltN);
/* NOP */;
}
public function IsSkateAttackJustPressed() : Bool{
return theInput.IsActionJustPressed(m_ActionAttackN) || theInput
.IsActionJustPressed(m_ActionAttackAltN);
/* NOP */;
}
public function IsSkateAttackPressedInTime(time : Float) : Bool{
return theInput.GetLastActivationTime(m_ActionAttackN) < time ||
theInput.GetLastActivationTime(m_ActionAttackAltN) < time;
/* NOP */;
}
}
import abstract class SParticleEmitterLODLevel{
}
import abstract class ParticleBurst{
}
import abstract class IEvaluatorFloat{
}
import abstract class CParticleEmitter{
}
import abstract class SParticleSystemLODLevel{

}
import abstract class CParticleSystem{
}
import abstract class CMesh{
}
import abstract class IEvaluatorVector{
}
import abstract class IEvaluatorColor{
}
import struct CR4TelemetryScriptProxy{
import public final function Log(eventType : ER4TelemetryEvents);
import public final function LogWithLabel(eventType : ER4TelemetryEvents
, label : String);
import public final function LogWithValue(eventType : ER4TelemetryEvents
, value : Int32);
import public final function LogWithValueStr(eventType : ER4TelemetryEve
nts, value : String);
import public final function LogWithLabelAndValue(eventType : ER4Telemet
ryEvents, label : String, value : Int32);
import public final function LogWithLabelAndValueStr(eventType : ER4Tele
metryEvents, label : String, value : String);
import public final function SetCommonStatFlt(statType : ER4CommonStats,
value : Float);
import public final function SetCommonStatI32(statType : ER4CommonStats,
value : Int32);
import public final function SetGameProgress(value : Float);
import public final function AddSessionTag(tag : String);
import public final function RemoveSessionTag(tag : String);
import public final function XDPPrintUserStats(statisticName : String);
import public final function XDPPrintUserAchievement(achievementName : S
tring);
}
import abstract class SAreaEnvironmentPoint{
}
import abstract class CGraphConnection{
}
import abstract class CGraphSocket{
}
import abstract class ITexture{
}
import abstract class CCubeTexture{
}
import abstract class ICollisionShape{
}
class CExplorationSkatingGlobal extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private var speedLevelCur : Int32;
private editable var speedLevelCapDefault : Int32;

private var speedLevelCap : Int32;


private editable var speedLevelTotal : Int32;
private editable var maxSpeedTotal : Float;
private editable var minSpeedTotal : Float;
private var speedPerLevel : Float;
private var movementParamsLevels : array<SSkatingLevelParams>;
private editable inlined var movementLevelsSpeedCurve : CCurve;
private editable inlined var movementParams : SSkatingMovementParams;
private editable var turnSpeedBase : Float;
protected editable var dashCooldownTotal : Float;
protected editable var dashCooldownCur : Float;
private editable var speedToBrake : Float;
private editable var speedToStop : Float;
public var m_TurnF : Float;
public var m_Drifting : Bool;
public var m_DrifIsLeft : Bool;
protected var flowComboCur : Int32;
protected var flowGapTimeCur : Float;
protected editable var flowGapTimeTotal : Float;
protected editable var flowSuccesfullTimeTotal : Float;
protected var flowSuccesfullTime : Float;
private editable var behParamTurnName : CName;
private editable var behParamAccelName : CName;
private editable var behParamSpeedName : CName;
public editable var behParamAttackName : CName;
public editable var behParamRandAttackName : CName;
public editable var behParamJumpAttackName : CName;
private editable var behParamTurnMax : Float;
private editable var behIncreasedSpeed : CName;
private editable var behIncreasedFwdSpeed : CName;
private var active : Bool;
public function Initialize(_Exploration : CExplorationStateManager){
var aux : Float;
var i : Int32;
m_ExplorationO = _Exploration;
flowGapTimeCur = flowGapTimeTotal + 1.000000;
speedPerLevel = maxSpeedTotal - minSpeedTotal / speedLevelTotal
- 1;
movementParamsLevels.Resize(speedLevelTotal);
if (movementLevelsSpeedCurve){
i = 0;
while (i < speedLevelTotal){
aux = i / speedLevelTotal - 1;
aux = minSpeedTotal + maxSpeedTotal - minSpeedTo
tal * movementLevelsSpeedCurve.GetValue(aux);
movementParamsLevels[i].speedMax = aux;
movementParamsLevels[i].reflectInput = true;
i += 1;
}
} else {
i = 0;
while (i < speedLevelTotal){
movementParamsLevels[i].speedMax = minSpeedTotal
+ speedPerLevel * i;
movementParamsLevels[i].reflectInput = true;
i += 1;
}
}
movementParamsLevels[0].reflectInput = false;
m_ExplorationO.m_MoverO.SetSkatingAbsoluteMaxSpeed(maxSpeedTotal

);
Reset();
/* NOP */;
}
public function Reset(){
speedLevelCap = speedLevelCapDefault;
CancelFlowTimeGap();
SetSpeedLevel(0, true);
ApplyDefaultParams();
/* NOP */;
}
public function PostUpdate(_Dt : Float){
if (!active){
return;
}
UpdateSpeedLevelReduction(_Dt);
if (flowGapTimeCur < flowGapTimeTotal){
flowGapTimeCur += _Dt;
if (flowGapTimeCur >= flowGapTimeTotal){
LostFlowCombo();
}
}
m_ExplorationO.m_SharedDataO.m_JumpDirectionForcedV = m_Explorat
ionO.m_MoverO.GetMovementVelocityNormalized();
UpdateDebug(_Dt);
/* NOP */;
}
private function UpdateSpeedLevelReduction(_Dt : Float){
var decreaseLevel : Bool;
decreaseLevel = false;
if (m_ExplorationO.m_MoverO.GetAccelerationnLastF() < 0.000000){
if (speedLevelCur > 0){
if (m_ExplorationO.m_MoverO.GetMovementSpeedF()
<= movementParamsLevels[speedLevelCur - 1].speedMax){
decreaseLevel = true;
}
}
}
if (decreaseLevel){
DecreaseSpeedLevel(true, true);
}
/* NOP */;
}
private function UpdateDebug(_Dt : Float){
var height : Int32;
height = 450;
thePlayer.GetVisualDebug().AddBar('SpeedLevelSeparator', 150, he
ight, 200, 5, 1.000000, Color(0, 255, 0), "", 0.000000);
height += 5;
thePlayer.GetVisualDebug().AddBar('SpeedLevel', 150, height, 200
, 10, speedLevelCur / speedLevelTotal, Color(255, 255, 0), "SpeedLevel: " + spee
dLevelCur + " cap at: " + speedLevelCap, 0.000000);
height += 12;
thePlayer.GetVisualDebug().AddBar('Speed', 150, height, 200, 10,
m_ExplorationO.m_MoverO.GetMovementSpeedF() / maxSpeedTotal, Color(100, 255, 10
0), "Speed: " + m_ExplorationO.m_MoverO.GetMovementSpeedF(), 0.000000);
height += 15;
thePlayer.GetVisualDebug().AddBar('Skate flow combo', 150, heigh
t, 200, 5, 1.000000, Color(255, 255, 0), "Combo " + flowComboCur, 0.000000);
height += 15;

height = 450;
if (flowSuccesfullTime > 0.000000){
flowSuccesfullTime -= _Dt;
thePlayer.GetVisualDebug().AddBar('Skate flow success',
750, height, 500, 30, 1.000000, Color(0, 255, 0), "FLOW SUCCESS!!!", 0.000000);
} else {
thePlayer.GetVisualDebug().AddBar('Skate flow success',
750, height, 500, 30, 0.000000, Color(0, 255, 0), "", 0.000000);
}
height += 30;
thePlayer.GetVisualDebug().AddBar('Skate flow separator', 750, h
eight, 500, 2, 1.000000, Color(255, 255, 0), "Flow", 0.000000);
if (flowGapTimeCur <= flowGapTimeTotal){
thePlayer.GetVisualDebug().AddBar('Skate flow gap', 750,
height + 5, 500, 30, 1.000000 - ClampF(flowGapTimeCur / flowGapTimeTotal, 0.000
000, 1.000000), Color(255, 255, 0), "", 0.000000);
} else {
thePlayer.GetVisualDebug().AddBar('Skate flow gap', 750,
height + 5, 500, 30, 0.000000, Color(255, 255, 0), "", 0.000000);
}
/* NOP */;
}
public function SetActive(enable : Bool){
active = enable;
if (enable){
theInput.SetContext('Skating');
}
/* NOP */;
}
public function UpdateRandomAttack() : Bool{
return false;
if (m_ExplorationO.m_InputO.IsSkateAttackJustPressed()){
m_ExplorationO.SendAnimEvent(behParamRandAttackName, /*
NOP */);
return true;
}
return false;
/* NOP */;
}
public function UpdateDashAttack() : Bool{
return false;
if (m_ExplorationO.m_InputO.IsSkateAttackJustPressed()){
m_ExplorationO.SendAnimEvent(behParamAttackName, /* NOP
*/);
return true;
}
return false;
/* NOP */;
}
public function UpdateJumpAttack() : Bool{
if (m_ExplorationO.m_InputO.IsSkateAttackJustPressed()){
m_ExplorationO.SendAnimEvent(behParamJumpAttackName, /*
NOP */);
return true;
}
return false;
/* NOP */;
}
public function GetSpeedLevel() : Int32{
return speedLevelCur;

/* NOP */;
}
public function GetSpeedMax() : Float{
return maxSpeedTotal + speedPerLevel;
/* NOP */;
}
public function GetSpeedMaxCur() : Float{
return GetSpeedLevelParamSpeedMax(speedLevelCur);
/* NOP */;
}
public function GetSpeedLevelParamSpeedMax(level : Int32) : Float{
level = Clamp(level, 0, speedLevelTotal);
return movementParamsLevels[level].speedMax;
/* NOP */;
}
public function ApplyDefaultParams(){
m_ExplorationO.m_MoverO.SetSkatingParams(movementParams);
m_ExplorationO.m_MoverO.SetSkatingTurnSpeed(turnSpeedBase);
/* NOP */;
}
public function ApplyCurLevelParams(){
m_ExplorationO.m_MoverO.SetSkatingLevelParams(movementParamsLeve
ls[speedLevelCur]);
/* NOP */;
}
public function ImpulseToNextSpeedLevel(baseImpulse : Float){
var speedLevelNext : Int32;
var speedLevelNow : Int32;
var speedMax : Float;
var speedCur : Float;
var aux : Float;
speedCur = m_ExplorationO.m_MoverO.GetMovementSpeedF();
speedLevelNext = Min(speedLevelCur + 1, speedLevelTotal - 1);
speedMax = movementParamsLevels[speedLevelNext].speedMax;
aux = speedMax - speedCur;
aux = ClampF(baseImpulse, 0.000000, aux);
m_ExplorationO.m_MoverO.AddSpeed(aux);
/* NOP */;
}
public function ImpulseNotExceedingMaxSpeedLevel(baseImpulse : Float){
var speedMax : Float;
var speedCur : Float;
var aux : Float;
speedCur = m_ExplorationO.m_MoverO.GetMovementSpeedF();
speedMax = movementParamsLevels[speedLevelTotal - 1].speedMax;
aux = speedMax - speedCur;
aux = ClampF(baseImpulse, 0.000000, aux);
m_ExplorationO.m_MoverO.AddSpeed(aux);
/* NOP */;
}
public function IncreaseSpeedLevel(applyNow : Bool, increaseLevelCapIfNe
eded : Bool) : Bool{
if (speedLevelCur < speedLevelTotal){
if (speedLevelCur >= speedLevelCap){
if (increaseLevelCapIfNeeded){
speedLevelCap += 1;
} else {
return false;
}
}

speedLevelCur += 1;
return SetSpeedLevel(speedLevelCur, applyNow);
}
return false;
/* NOP */;
}
public function DecreaseSpeedLevel(applyNow : Bool, decreaseLevelCapIfNe
eded : Bool) : Bool{
if (speedLevelCur > 0){
speedLevelCur -= 1;
if (decreaseLevelCapIfNeeded){
speedLevelCap = Max(speedLevelCur, speedLevelCap
Default);
}
return SetSpeedLevel(speedLevelCur, applyNow);
}
return false;
/* NOP */;
}
public function SetSpeedLevel(level : Int32, applyNow : Bool) : Bool{
if (level >= speedLevelTotal || level < 0){
LogExplorationError("Trying to set a speed level that do
es not exist");
return false;
}
speedLevelCur = level;
LogExploration("Speed level set to:" + speedLevelCur);
if (applyNow){
ApplyCurLevelParams();
}
return true;
/* NOP */;
}
public function ShouldStop(braking : Bool) : Bool{
var accel : Float;
accel = m_ExplorationO.m_MoverO.GetAccelerationnLastF();
if (accel < 0.000000){
if (GetSpeedLevel() <= 0){
if (braking){
if (m_ExplorationO.m_MoverO.GetMovementS
peedF() <= speedToBrake){
return true;
}
} else if (m_ExplorationO.m_MoverO.GetMovementSp
eedF() <= speedToStop){
return true;
}
}
}
return false;
/* NOP */;
}
public function StartFlowTimeGap(){
flowGapTimeCur = 0.000000;
/* NOP */;
}
public function CancelFlowTimeGap(){
flowGapTimeCur = flowGapTimeTotal + 1.000000;
/* NOP */;
}

public function CheckIfIsInFlowGapAndConsume() : Bool{


var result : Bool;
result = flowGapTimeCur <= flowGapTimeTotal;
CancelFlowTimeGap();
if (result){
flowSuccesfullTime = flowSuccesfullTimeTotal;
ChainedFlowCombo();
}
return result;
/* NOP */;
}
public function GetMaxFlowTimeGap() : Float{
return flowGapTimeTotal;
/* NOP */;
}
private function LostFlowCombo(){
flowComboCur = 0;
/* NOP */;
}
private function ChainedFlowCombo(){
flowComboCur += 1;
/* NOP */;
}
private function GetCurFlowCombo() : Int32{
return flowComboCur;
/* NOP */;
}
public function IsDashReady() : Bool{
return dashCooldownCur >= dashCooldownTotal || flowGapTimeCur <=
flowGapTimeTotal;
/* NOP */;
}
public function UpdateDashCooldown(_Dt : Float){
dashCooldownCur += _Dt;
/* NOP */;
}
public function ConsumeDashCooldown(){
dashCooldownCur = 0.000000;
/* NOP */;
}
public function SetDashReady(){
dashCooldownCur = dashCooldownTotal;
/* NOP */;
}
public function SetBehParams(accel : Float, braking : Bool, turn : Float
){
var speed : Float;
var directionDot : Float;
if (speedLevelCur > 1){
speed = 1.000000;
} else {
speed = 0.000000;
}
turn = ClampF(turn, -1.000000, 1.000000);
directionDot = VecDot(m_ExplorationO.m_InputO.GetMovementOnPlane
V(), m_ExplorationO.m_OwnerE.GetWorldForward());
if (directionDot > -0.250000){
accel = 1.000000;
} else if (braking){
accel = -1.000000;

} else {
accel = 0.000000;
}
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behParamSpeedName, s
peed, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behParamAccelName, a
ccel, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behParamTurnName, -t
urn, /* NOP */);
m_TurnF = turn;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
if (animEventName == behIncreasedSpeed){
m_ExplorationO.m_MoverO.SetSpeedFromAnim(maxSpeedTotal);
}
if (animEventName == behIncreasedFwdSpeed){
m_ExplorationO.m_MoverO.SetSpeedFromAnimFrontal(maxSpeed
Total);
}
/* NOP */;
}
}
import abstract class CFXTrackGroup{
}
import abstract class CFXTrack{
}
import abstract class CFXTrackItem{
}
import abstract class IFXSpawner{
}
import abstract class IFXPhysicalForce{
}
struct SDefaultStateTransition{
var m_StateNameN : CName;
var m_TimeToStartCheckingF : Float;
}
class CCameraParametersSet extends CObject{
public editable var pivotPositionControllerName : CName;
public editable var pivotPositionControllerBlend : Float;
public editable var pivotPosForcedBlendOnNext : Float;
public editable var pivotPositionBlendFromPos : Bool;
public editable var forceBlendFromPosOnNextCam : Bool;
public editable var pivotRotationController : CName;
public editable var pivotDistanceController : CName;
public editable var launchAnimation : Bool;
public editable inlined var animationData : SCameraAnimationData;
public editable var collisionOffset : Vector;
public function SetToMainCamera(forcedBlend : Float){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();

if (IsNameValid(pivotPositionControllerName) && pivotPositionCon


trollerName != camera.GetActivePivotPositionController().controllerName){
if (forcedBlend > 0.000000 || pivotPositionControllerBle
nd > 0.000000){
if (pivotPositionBlendFromPos){
camera.ChangePivotPositionController('Ke
epRelativePositionController');
}
if (forcedBlend > 0.000000){
camera.BlendToPivotPositionController(pi
votPositionControllerName, forcedBlend);
} else {
camera.BlendToPivotPositionController(pi
votPositionControllerName, pivotPositionControllerBlend);
}
} else {
camera.ChangePivotPositionController(pivotPositi
onControllerName);
}
}
if (IsNameValid(pivotRotationController) && pivotRotationControl
ler != camera.GetActivePivotRotationController().controllerName){
camera.ChangePivotRotationController(pivotRotationContro
ller);
}
if (IsNameValid(pivotDistanceController) && pivotDistanceControl
ler != camera.GetActivePivotDistanceController().controllerName){
camera.ChangePivotDistanceController(pivotDistanceContro
ller);
}
if (launchAnimation){
animation.animation = animationData.animation;
animation.priority = animationData.priority;
animation.blendIn = animationData.blend;
animation.blendOut = animationData.blend;
animation.weight = animationData.weight;
animation.loop = animationData.loop;
animation.speed = 1.000000;
animation.additive = true;
animation.reset = true;
camera.PlayAnimation(animation);
}
/* NOP */;
}
public function StopOnMainCamera(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
if (launchAnimation){
camera.StopAnimation(animationData.animation);
}
if (forceBlendFromPosOnNextCam && camera){
camera.ChangePivotPositionController('KeepRelativePositi
onController');
}
/* NOP */;
}
}
import abstract class CGenericGrassMask{
}

import abstract class CGrassOccurrenceMap{


}
class CExplorationMover extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private var m_InputO : CExplorationInput;
private var m_WorldPositionV : Vector;
private var m_DisplacementLastFrameV : Vector;
private var m_PlaneMovementParamsS : SPlaneMovementParameters;
private var m_VerticalMovementParamsS : SVerticalMovementParams;
private var m_SlidingParamsS : SSlidingMovementParams;
private var m_SkatingParamsS : SSkatingMovementParams;
private var m_SkatingLevelParamsS : SSkatingLevelParams;
private var m_SkatingTurnPerSpeedF : Float;
private var m_SkatingSpeedTotalMaxF : Float;
private var m_SkatingTurnPerSpeedCurF : Float;
private var m_SkatingTurnPerSpeedBlendF : Float;
private var m_SlidingFrictionBlendedF : Float;
private var m_SkateTurnDecelCoefF : Float;
private var m_SkateTurnBrakeCoefF : Float;
private var m_VelocityV : Vector;
private var m_VelocityNormalizedV : Vector;
private var m_SpeedF : Float;
private var m_SpeedHeadingF : Float;
private var m_SpeedVerticalF : Float;
private var m_DisplacementV : Vector;
private var m_RotationDeltaEA : EulerAngles;
private var m_SpeedLastF : Float;
private var m_AccelerationLastF : Float;
public editable var m_SlideMaxSpeedSafeF : Float;
public editable var m_SlideMaxSpeedToFallF : Float;
public var m_SlideMaxSpeedF : Float;
public var m_UseMaterialsB : Bool;
private var m_SlidingLimitMinF : Float;
private var m_SlidingLimitMaxF : Float;
private var m_MaterialFrictionMultF : Float;
private var m_CoefMinMaterialF : Float;
private var m_SlideNormalRealV : Vector;
private var m_SlideNormalV : Vector;
private var m_SlideDirV : Vector;
private var m_SlideRealangleF : Float;
private var m_SlideComputedThisFrameB : Bool;
private var m_SlideWideComputedThisFrameB : Bool;
private var m_SlideWideCoefGlobalF : Float;
public var m_WideNormalAverageV : Vector;
public var m_WideNormalGlobalV : Vector;
private var m_SlideWideCoefAverageF : Float;
private var m_SlideWideCoefRealGlobalF : Float;
private var m_SlideWideCoefRealAverageF : Float;
public var m_SlideTerrainWideDistFwdF : Float;
public var m_SlideTerrainWideDistBwdF : Float;
public var m_SlideTerrainWideDistHorizF : Float;
private editable inlined var gravityCurve : CCurve;
public var superSlide : Bool;
private var m_TurnThisFrameF : Float;
private var m_BankingNeedsUpdatingB : Bool;
private var m_BankingTargetF : Float;
private var m_BankingSpeedF : Float;
private var m_BankingSpeedDefaultF : Float;

private var m_OrientToInputMaxHeadingF : Float;


private var m_MACVelocityDampedV : Vector;
private var m_MACVelocityDamSpeedF : Float;
public var m_CustomIsAnimatedB : Bool;
protected var m_BoneRightFootN : CName;
protected var m_BoneLeftFootN : CName;
protected var m_BoneIndexRightFootI : Int32;
protected var m_BoneIndexLeftFootI : Int32;
private var m_UpV : Vector;
private var m_ZeroV : Vector;
public function Initialize(_ExplorationO : CExplorationStateManager){
m_ExplorationO = _ExplorationO;
m_InputO = m_ExplorationO.m_InputO;
m_BoneIndexRightFootI = m_ExplorationO.m_OwnerE.GetBoneIndex(m_B
oneRightFootN);
m_BoneIndexLeftFootI = m_ExplorationO.m_OwnerE.GetBoneIndex(m_Bo
neLeftFootN);
m_UpV = Vector(0.000000, 0.000000, 1.000000);
m_ZeroV = Vector(0.000000, 0.000000, 0.000000);
Reset();
/* NOP */;
}
public function Reset(){
StopAllMovement();
m_SlideComputedThisFrameB = false;
m_SlideWideComputedThisFrameB = false;
m_WorldPositionV = m_ExplorationO.m_OwnerE.GetWorldPosition();
m_MACVelocityDampedV = m_ZeroV;
/* NOP */;
}
public function OnTeleported(){
StopAllMovement();
/* NOP */;
}
public function ApplyMovement(_Dt : Float){
var movAdj : CMovementAdjustor;
if (_Dt <= 0.000000){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
movAdj.AddOneFrameTranslationVelocity(m_DisplacementV / _Dt);
m_RotationDeltaEA.Yaw = m_RotationDeltaEA.Yaw / _Dt;
m_RotationDeltaEA.Pitch = m_RotationDeltaEA.Pitch / _Dt;
m_RotationDeltaEA.Roll = m_RotationDeltaEA.Roll / _Dt;
movAdj.AddOneFrameRotationVelocity(m_RotationDeltaEA);
if (m_BankingNeedsUpdatingB){
UpdateBanking(_Dt);
}
/* NOP */;
}
public function PreUpdate(_Dt : Float){
var positionCur : Vector;
m_SlideComputedThisFrameB = false;
m_SlideWideComputedThisFrameB = false;
positionCur = m_ExplorationO.m_OwnerE.GetWorldPosition();
m_DisplacementLastFrameV = positionCur - m_WorldPositionV;
m_WorldPositionV = positionCur;
/* NOP */;
}
public function PostUpdate(_Dt : Float){

VecSetZeros(m_DisplacementV);
EulerSetZeros(m_RotationDeltaEA);
m_AccelerationLastF = m_SpeedF - m_SpeedLastF;
m_SpeedLastF = m_SpeedF;
m_MACVelocityDampedV = LerpV(m_MACVelocityDampedV, m_Exploration
O.m_OwnerMAC.GetVelocity(), MinF(1.000000, m_MACVelocityDamSpeedF * _Dt));
m_SlideComputedThisFrameB = false;
m_SlideWideComputedThisFrameB = false;
/* NOP */;
}
public function Translate(_TranslationV : Vector){
m_DisplacementV += _TranslationV;
/* NOP */;
}
private function Rotate(_RotationEA : EulerAngles){
m_RotationDeltaEA.Yaw += _RotationEA.Yaw;
m_RotationDeltaEA.Pitch += _RotationEA.Pitch;
m_RotationDeltaEA.Roll += _RotationEA.Roll;
/* NOP */;
}
public function GetDisplacementLastFrame() : Vector{
return m_DisplacementLastFrameV;
/* NOP */;
}
public function IsRightFootForward() : Bool{
var actorForward : Vector;
actorForward = m_ExplorationO.m_OwnerE.GetWorldForward();
return IsRightFootForwardTowardsDir(actorForward);
/* NOP */;
}
public function IsRightFootForwardTowardsDir(direction : Vector) : Bool{
var startRightFoot : Bool;
var lFoot : Vector;
var rFoot : Vector;
var leftToRightFoot : Vector;
lFoot = m_ExplorationO.m_OwnerE.GetBoneWorldPositionByIndex(m_Bo
neIndexLeftFootI);
rFoot = m_ExplorationO.m_OwnerE.GetBoneWorldPositionByIndex(m_Bo
neIndexRightFootI);
leftToRightFoot = rFoot - lFoot;
startRightFoot = VecDot(leftToRightFoot, direction) > 0.000000;
return startRightFoot;
/* NOP */;
}
public function UpdateMovementLinear(_VelocityV : Vector, _Dt : Float){
SetVelocity(_VelocityV);
Translate(m_VelocityV * _Dt);
/* NOP */;
}
public function SetPlaneMovementParams(_PlaneMovementParamsS : SPlaneMov
ementParameters){
m_PlaneMovementParamsS = _PlaneMovementParamsS;
/* NOP */;
}
public function SetVerticalMovementParams(_VerticalMovementParamsS : SVe
rticalMovementParams){
m_VerticalMovementParamsS = _VerticalMovementParamsS;
if (m_VerticalMovementParamsS.m_VertMaxSpeedF > 0.000000){
m_VerticalMovementParamsS.m_VertMaxSpeedF *= -1.000000;
}

if (m_VerticalMovementParamsS.m_GravityUpF > 0.000000){


m_VerticalMovementParamsS.m_GravityUpF *= -1.000000;
}
if (m_VerticalMovementParamsS.m_GravityDownF > 0.000000){
m_VerticalMovementParamsS.m_GravityDownF *= -1.000000;
}
/* NOP */;
}
public function SetSlidingLimits(minDegrees : Float, maxDegrees : Float)
{
m_SlidingLimitMinF = ConvertAngleDegreeToSlidECoef(minDegrees);
m_SlidingLimitMaxF = ConvertAngleDegreeToSlidECoef(maxDegrees);
m_ExplorationO.m_OwnerMAC.SetSlidingLimits(m_SlidingLimitMinF, m
_SlidingLimitMaxF);
/* NOP */;
}
public function GetSlidingLimitMinCur() : Float{
return m_CoefMinMaterialF;
/* NOP */;
}
public function GetSlidingLimitMax() : Float{
return m_SlidingLimitMaxF;
/* NOP */;
}
public function ConvertAngleDegreeToSlidECoef(angleDegree : Float) : Flo
at{
angleDegree = ClampF(angleDegree / 90.000000, 0.000000, 1.000000
);
return angleDegree;
/* NOP */;
}
public function ConvertCoefToAngleDegree(coef : Float) : Float{
coef *= 90.000000;
return coef;
/* NOP */;
}
public function SetSlidingParams(_SlidingParamsS : SSlidingMovementParam
s){
m_SlidingParamsS = _SlidingParamsS;
m_SlidingFrictionBlendedF = 1.000000;
/* NOP */;
}
public function SetSlidingMaterialParams(_AngleMinMaterialF : Float, _Ma
terialFrictionMultiplierF : Float){
m_CoefMinMaterialF = ConvertAngleDegreeToSlidECoef(_AngleMinMate
rialF);
m_MaterialFrictionMultF = _MaterialFrictionMultiplierF;
if (m_MaterialFrictionMultF <= 0.000000){
m_MaterialFrictionMultF = m_MaterialFrictionMultF;
}
/* NOP */;
}
public function SetSkatingParams(slidingParams : SSkatingMovementParams)
{
m_SkatingParamsS = slidingParams;
/* NOP */;
}
public function SetSkatingLevelParams(levelParams : SSkatingLevelParams)
{
m_SkatingLevelParamsS = levelParams;

/* NOP */;
}
public function SetSkatingTurnSpeed(turnSpeed : Float){
m_SkatingTurnPerSpeedF = turnSpeed;
/* NOP */;
}
public function SetSkatingAbsoluteMaxSpeed(maxSpeed : Float){
m_SkatingSpeedTotalMaxF = maxSpeed;
/* NOP */;
}
public function SetManualMovement(enable : Bool){
if (m_CustomIsAnimatedB){
m_ExplorationO.m_CollisionManagerO.EnableVerticalSliding
(enable);
m_ExplorationO.m_OwnerMAC.SetAnimatedMovement(enable);
} else {
m_ExplorationO.m_OwnerMAC.SetAnimatedMovement(enable);
}
m_ExplorationO.m_OwnerMAC.EnableVirtualControllerCollisionRespon
se('MainCollider', !enable);
/* NOP */;
}
public function SetCustomIsAnim(enabled : Bool){
m_CustomIsAnimatedB = enabled;
/* NOP */;
}
public function UpdateMovementOnPlaneWithInput(_Dt : Float){
var l_DotF : Float;
var l_AccelV : Vector;
var l_NewVelocityV : Vector;
var l_MaxSpeedTotalF : Float;
if (!m_InputO.IsModuleConsiderable()){
l_NewVelocityV = VecReduceTowardsZero(m_VelocityV, m_Pla
neMovementParamsS.m_DecelF * _Dt);
} else {
l_DotF = VecDot(m_VelocityNormalizedV, m_InputO.GetMovem
entOnPlaneV());
if (l_DotF >= m_PlaneMovementParamsS.m_BrakeDotF){
l_AccelV = m_InputO.GetMovementOnPlaneV() * m_Pl
aneMovementParamsS.m_AccelF;
} else {
l_AccelV = m_InputO.GetMovementOnPlaneV() * m_Pl
aneMovementParamsS.m_BrakeF;
}
l_MaxSpeedTotalF = m_PlaneMovementParamsS.m_SpeedMaxF *
m_InputO.GetModuleF();
l_NewVelocityV = VecAddNotExceedingV(m_VelocityV, l_Acce
lV * _Dt, l_MaxSpeedTotalF);
if (VecLengthSquared(l_NewVelocityV) > l_MaxSpeedTotalF
* l_MaxSpeedTotalF){
l_NewVelocityV = VecReduceNotExceedingV(m_Veloci
tyV, m_PlaneMovementParamsS.m_DecelF * _Dt, l_MaxSpeedTotalF);
}
}
SetVelocity(l_NewVelocityV);
Translate(m_VelocityV * _Dt);
/* NOP */;
}
public function UpdateMovementOnPlaneWithInertia(_Dt : Float){
var l_NewVelocityV : Vector;

l_NewVelocityV = VecReduceTowardsZero(m_VelocityV, m_PlaneMoveme


ntParamsS.m_DecelF * _Dt);
SetVelocity(l_NewVelocityV);
Translate(m_VelocityV * _Dt);
/* NOP */;
}
public function UpdateMovementStraightAndTurnWithInput(_SpeedMaxF : Floa
t, _AccelF : Float, _TurnCoefBaseF : Float, _InputMaxTurnF : Float, _Dt : Float)
{
var l_InputVectorV : Vector;
var l_InputHeadingF : Float;
var l_CharacterHeadingF : Float;
var l_DirectionDiffF : Float;
var l_TurnAngleF : Float;
if (!m_InputO.IsModuleConsiderable()){
l_InputVectorV = theCamera.GetCameraForwardOnHorizontalP
lane();
} else {
l_InputVectorV = m_InputO.GetMovementOnPlaneV();
}
l_InputHeadingF = AngleNormalize180(VecHeading(l_InputVectorV));
l_CharacterHeadingF = AngleNormalize180(VecHeading(m_Exploration
O.m_OwnerE.GetWorldForward()));
l_DirectionDiffF = AngleDistance(l_InputHeadingF, l_CharacterHea
dingF);
_TurnCoefBaseF = _TurnCoefBaseF * MinF(1.000000, AbsF(l_Directio
nDiffF) / _InputMaxTurnF);
l_TurnAngleF = SignF(l_DirectionDiffF) * MinF(_TurnCoefBaseF * _
Dt, AbsF(l_DirectionDiffF));
m_SpeedF = ClampF(m_SpeedF + _AccelF * _Dt, -_SpeedMaxF, _SpeedM
axF);
SetVelocity(m_SpeedF * VecFromHeading(l_CharacterHeadingF + l_Tu
rnAngleF));
AddYaw(l_TurnAngleF);
Translate(m_VelocityV * _Dt);
/* NOP */;
}
public function UpdateSkatingMovement(_Dt : Float, _AccelF : Float, _Res
ultingTurnPercF : Float, _IsBraking : Bool, _IsDriftingB : Bool, _IsDriftLeftB :
Bool){
var l_CharacterHeadingF : Float;
var l_DirectionDiffF : Float;
var l_DirectionDiffAbsF : Float;
var l_TurnTotalF : Float;
var l_AccelF : Float;
var l_SpeedMaxF : Float;
var l_FrictionF : Float;
var l_GravityTurnF : Float;
var l_GravityAccelF : Float;
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
l_GravityAccelF = VecDot(m_VelocityNormalizedV, m_SlideDirV) * 1
.000000 - VecDot(m_SlideNormalV, m_UpV);
l_GravityAccelF *= m_SkatingParamsS.gravity;
l_GravityTurnF = AngleDistance(VecHeading(m_VelocityNormalizedV)
, VecHeading(m_SlideDirV));
l_CharacterHeadingF = m_ExplorationO.m_OwnerE.GetHeading();
m_InputO.ComputeHeadingDiffWithReflectionF(l_CharacterHeadingF,
m_SkatingLevelParamsS.reflectInput, l_DirectionDiffF, _ResultingTurnPercF, _IsBr

aking, true);
_AccelF = m_InputO.GetModuleF() * 1.000000 - AbsF(_ResultingTurn
PercF);
if (_IsBraking){
_AccelF *= -1.000000;
}
m_SkatingTurnPerSpeedCurF = LerpF(MinF(_Dt * m_SkatingTurnPerSpe
edBlendF, 1.000000), m_SkatingTurnPerSpeedCurF, m_SkatingTurnPerSpeedF, /* NOP *
/);
l_TurnTotalF = m_SkatingTurnPerSpeedCurF;
if (m_SkatingParamsS.turnCurve){
l_TurnTotalF *= m_SkatingParamsS.turnCurve.GetValue(m_Sp
eedF / m_SkatingSpeedTotalMaxF);
}
if (_IsBraking){
l_TurnTotalF *= m_SkateTurnBrakeCoefF;
} else if (_AccelF < 0.500000){
l_TurnTotalF *= m_SkateTurnDecelCoefF;
}
if (_IsDriftingB){
if (_IsDriftLeftB){
l_TurnTotalF = l_TurnTotalF * MapF(_ResultingTur
nPercF, -1.000000, 1.000000, -1.000000, 0.200000);
} else {
l_TurnTotalF = l_TurnTotalF * MapF(_ResultingTur
nPercF, -1.000000, 1.000000, -0.200000, 1.000000);
}
} else {
l_TurnTotalF = l_TurnTotalF * _ResultingTurnPercF;
if (_IsBraking){
if (theInput.GetActionValue('GI_AxisLeftY') < -0
.900000){
_ResultingTurnPercF = 0.000000;
l_TurnTotalF = 0.000000;
}
}
}
l_DirectionDiffAbsF = AbsF(l_DirectionDiffF);
l_TurnTotalF = ClampF(l_TurnTotalF * _Dt, -l_DirectionDiffAbsF,
l_DirectionDiffAbsF);
AddYaw(l_TurnTotalF);
if (m_SpeedF >= m_SkatingLevelParamsS.speedMax){
l_AccelF = -m_SkatingParamsS.decelMaxSpeed * m_SpeedF;
if (_AccelF > 0.000000){
if (m_SpeedF + l_AccelF * _Dt < m_SkatingLevelPa
ramsS.speedMax){
l_AccelF = m_SkatingLevelParamsS.speedMa
x - m_SpeedF / _Dt;
}
}
} else if (!m_InputO.IsModuleConsiderable()){
l_AccelF = -m_SkatingParamsS.decel;
} else if (_IsBraking){
l_AccelF = -m_SkatingParamsS.brake * m_InputO.GetModuleF
() * MaxF(m_SkatingParamsS.brakeBaseSpeed, m_SpeedF);
} else {
l_AccelF = m_SkatingParamsS.accel * m_InputO.GetModuleF(
);
}
l_FrictionF = m_SpeedF * m_SpeedF * m_SkatingParamsS.frictionSqu

are + m_SkatingParamsS.frictionLinear + m_SkatingParamsS.frictionConst;


l_AccelF -= l_FrictionF;
l_SpeedMaxF = MaxF(m_SpeedF, m_SkatingLevelParamsS.speedMax);
m_SpeedF = MinF(m_SpeedF + l_AccelF * _Dt, l_SpeedMaxF);
l_SpeedMaxF = MaxF(m_SpeedF, m_SkatingParamsS.gravitySpeedMax);
m_SpeedF = MinF(m_SpeedF + l_GravityAccelF * _Dt, l_SpeedMaxF);
SetVelocity(m_SpeedF * VecFromHeading(l_CharacterHeadingF + l_Tu
rnTotalF));
Translate(m_VelocityV * _Dt);
m_ExplorationO.m_SharedDataO.m_JumpDirectionForcedV = m_Velocity
NormalizedV;
/* NOP */;
}
public function UpdateSlidingInertialMovementWithInput(_Dt : Float, _Tur
nF : Float, _AccelF : Float, applyStoppingFriction : Bool, slopeYaw : Float, slo
peOrientSpeed : Float){
var l_SlopeDirectionV : Vector;
var l_SlopeNormalV : Vector;
var l_SlopeAccelVectorV : Vector;
var l_SlopeRestitutionV : Vector;
var l_SlopeFrictionV : Vector;
var l_NewVelocityV : Vector;
var l_NewVelocityDirV : Vector;
var l_VelocityRightV : Vector;
var l_SpeedLostProjectingF : Float;
var l_AuxF : Float;
var l_InputVectorV : Vector;
var l_DirectionDiffF : Float;
var l_DirectionDiffAbsF : Float;
var l_DirectionDiffPercF : Float;
var l_DirectionReflectedB : Bool;
var l_TurnAngleF : Float;
var l_FrictionInputCoefF : Float;
l_NewVelocityV = m_VelocityV;
GetSlideDirAndNormal(l_SlopeDirectionV, l_SlopeNormalV);
l_AuxF = VecLength(l_NewVelocityV);
l_NewVelocityV = l_NewVelocityV - l_SlopeNormalV * VecDot(l_NewV
elocityV, l_SlopeNormalV);
l_NewVelocityV.W = 0.000000;
l_NewVelocityDirV = VecNormalize(l_NewVelocityV);
l_SpeedLostProjectingF = VecLength(l_NewVelocityV) - l_AuxF;
l_SlopeRestitutionV = l_SlopeDirectionV * l_SpeedLostProjectingF
* m_SlidingParamsS.m_RestitutionF;
l_NewVelocityV += l_SlopeRestitutionV;
if (m_InputO.IsModuleConsiderable()){
l_InputVectorV = m_InputO.GetMovementOnPlaneV();
l_AuxF = VecLength(l_InputVectorV);
l_InputVectorV = l_InputVectorV - l_SlopeNormalV * VecDo
t(l_InputVectorV, l_SlopeNormalV);
l_InputVectorV.W = 0.000000;
l_InputVectorV = VecNormalize(l_InputVectorV) * l_AuxF;
} else {
l_InputVectorV = m_ZeroV;
}
l_FrictionInputCoefF = VecDot(l_InputVectorV, l_NewVelocityDirV)
;
if (l_FrictionInputCoefF >= 0.000000){
l_FrictionInputCoefF = MapF(1.000000 - l_FrictionInputCo
efF, 0.000000, 1.000000, m_SlidingParamsS.m_InputFrictionCoefMinF, 1.000000);
} else {

l_FrictionInputCoefF = MapF(-l_FrictionInputCoefF, 0.000


000, 1.000000, 1.000000, m_SlidingParamsS.m_InputFrictionCoefMaxF);
}
m_SlidingFrictionBlendedF = BlendLinearF(m_SlidingFrictionBlende
dF, l_FrictionInputCoefF, m_SlidingParamsS.m_InputFrictionBlend * _Dt);
l_AuxF = VecLength(l_NewVelocityV);
l_AuxF = m_SlidingParamsS.m_FrictionConstF + m_SlidingParamsS.m_
FrictionLinearF + m_SlidingParamsS.m_FrictionSquareF * l_AuxF * l_AuxF;
l_AuxF *= m_SlidingFrictionBlendedF;
l_AuxF *= m_MaterialFrictionMultF;
if (applyStoppingFriction){
l_AuxF *= m_SlidingParamsS.m_FrictionConstExitF;
}
l_NewVelocityV = VecReduceTowardsZero(l_NewVelocityV, l_AuxF * _
Dt);
l_AuxF = AbsF(VecDot(l_SlopeDirectionV, m_UpV));
l_AuxF = -gravityCurve.GetValue(l_AuxF) * m_SlidingParamsS.m_Gra
vityF;
l_SlopeAccelVectorV = l_SlopeDirectionV * l_AuxF;
l_VelocityRightV = VecCross(l_NewVelocityDirV, l_SlopeNormalV);
l_SlopeAccelVectorV += l_VelocityRightV * VecDot(l_InputVectorV,
l_VelocityRightV) * m_SlidingParamsS.m_InputStrafeCoefF;
l_NewVelocityV = l_NewVelocityV + l_SlopeAccelVectorV * _Dt;
if (m_InputO.IsModuleConsiderable()){
m_InputO.ComputeHeadingDiffWithReflectionF(m_Exploration
O.m_OwnerE.GetHeading(), true, l_DirectionDiffF, l_DirectionDiffPercF, l_Directi
onReflectedB, /* NOP */);
l_DirectionDiffAbsF = AbsF(l_DirectionDiffF);
l_TurnAngleF = m_SlidingParamsS.m_TurnSpeedF * l_Directi
onDiffPercF;
l_TurnAngleF = ClampF(l_TurnAngleF * _Dt, -l_DirectionDi
ffAbsF, l_DirectionDiffAbsF);
l_NewVelocityV = VecRotateAxis(l_NewVelocityV, l_SlopeNo
rmalV, l_TurnAngleF);
} else {
l_TurnAngleF = 0.000000;
}
l_AuxF = VecLength(l_NewVelocityV);
if (l_AuxF > m_SlideMaxSpeedF){
l_NewVelocityV *= m_SlideMaxSpeedF / l_AuxF;
}
SetVelocity(l_NewVelocityV);
Translate(m_VelocityV * _Dt);
slopeYaw = AngleDistance(slopeYaw, m_ExplorationO.m_OwnerE.GetHe
ading());
slopeYaw *= 2.500000 * _Dt;
AddYaw(l_TurnAngleF * m_SlidingParamsS.m_InputVisualTurnCoefF +
slopeYaw);
_TurnF = l_DirectionDiffPercF;
_AccelF = l_FrictionInputCoefF;
/* NOP */;
}
public function UpdateSlidingInertialMovement(_Dt : Float){
var l_SlopeDirectionV : Vector;
var l_SlopeNormalV : Vector;
var l_SlopeAccelVectorV : Vector;
var l_SlopeRestitutionV : Vector;
var l_SlopeFrictionV : Vector;
var l_NewVelocityV : Vector;
var l_AuxF : Float;

l_NewVelocityV = m_VelocityV;
GetSlideDirAndNormal(l_SlopeDirectionV, l_SlopeNormalV);
l_AuxF = m_SlidingParamsS.m_FrictionConstF + m_SlidingParamsS.m_
FrictionLinearF * VecLength(l_NewVelocityV);
l_AuxF *= m_MaterialFrictionMultF;
l_NewVelocityV = VecReduceTowardsZero(l_NewVelocityV, l_AuxF * _
Dt);
l_NewVelocityV = l_NewVelocityV - l_SlopeNormalV * VecDot(l_NewV
elocityV, l_SlopeNormalV);
l_AuxF = VecDot(l_SlopeDirectionV, m_UpV);
l_AuxF = l_AuxF * m_SlidingParamsS.m_GravityF;
l_SlopeAccelVectorV = l_SlopeDirectionV * l_AuxF;
l_SlopeRestitutionV = l_SlopeDirectionV * VecDot(l_NewVelocityV,
l_SlopeNormalV) * m_SlidingParamsS.m_RestitutionF;
l_NewVelocityV = l_NewVelocityV + l_SlopeAccelVectorV * _Dt + l_
SlopeRestitutionV;
SetVelocity(l_NewVelocityV);
Translate(m_VelocityV * _Dt);
/* NOP */;
}
public function UpdateMovementVertical(_Dt : Float) : Float{
var l_DisplacementF : Float;
var l_AccelF : Float;
if (m_SpeedVerticalF > 0.000000){
l_AccelF = m_VerticalMovementParamsS.m_GravityUpF;
} else {
l_AccelF = m_VerticalMovementParamsS.m_GravityDownF;
}
l_DisplacementF = l_AccelF * _Dt * _Dt + m_SpeedVerticalF * _Dt;
m_SpeedVerticalF = MaxF(m_VerticalMovementParamsS.m_VertMaxSpeed
F, l_DisplacementF / _Dt);
Translate(l_DisplacementF * m_UpV);
return l_DisplacementF;
/* NOP */;
}
public function UpdatePerfectMovementVertical(_Dt : Float) : Float{
var l_AccelF : Float;
var l_TimeRemainingF : Float;
var l_TimeNeededF : Float;
var l_DisplacementF : Float;
l_TimeRemainingF = _Dt;
l_DisplacementF = 0.000000;
if (m_SpeedVerticalF > 0.000000){
l_TimeNeededF = GetTimeToReachThePeak();
l_TimeNeededF = MinF(l_TimeNeededF, l_TimeRemainingF);
l_DisplacementF += UpdateParabolicVerticalMovement(m_Ver
ticalMovementParamsS.m_GravityUpF, l_TimeNeededF);
l_TimeRemainingF -= l_TimeNeededF;
if (l_TimeRemainingF <= 0.000000){
return l_DisplacementF;
}
}
if (m_SpeedVerticalF > m_VerticalMovementParamsS.m_VertMaxSpeedF
){
l_TimeNeededF = GetTimeToReachMaxSpeed();
l_TimeNeededF = MinF(l_TimeNeededF, l_TimeRemainingF);
l_DisplacementF += UpdateParabolicVerticalMovement(m_Ver
ticalMovementParamsS.m_GravityDownF, l_TimeNeededF);
l_TimeRemainingF -= l_TimeNeededF;
if (l_TimeRemainingF <= 0.000000){

return l_DisplacementF;
}
}
l_DisplacementF += UpdateLinearVerticalMovement(l_TimeRemainingF
);
return l_DisplacementF;
/* NOP */;
}
private function GetTimeToReachThePeak() : Float{
if (m_SpeedVerticalF <= 0.000000){
return 0.000000;
}
return -m_SpeedVerticalF / 2.000000 / m_VerticalMovementParamsS.
m_GravityUpF;
/* NOP */;
}
private function GetTimeToReachMaxSpeed() : Float{
if (m_SpeedVerticalF <= m_VerticalMovementParamsS.m_VertMaxSpeed
F){
return 0.000000;
}
return m_VerticalMovementParamsS.m_VertMaxSpeedF - m_SpeedVertic
alF / 2.000000 / m_VerticalMovementParamsS.m_GravityUpF;
/* NOP */;
}
private function UpdateParabolicVerticalMovement(_AccelF : Float, _Dt :
Float) : Float{
var l_DisplacementF : Float;
l_DisplacementF = _AccelF * _Dt * _Dt + m_SpeedVerticalF * _Dt;
m_SpeedVerticalF = MaxF(m_VerticalMovementParamsS.m_VertMaxSpeed
F, l_DisplacementF / _Dt);
m_SpeedVerticalF += 2 * m_VerticalMovementParamsS.m_GravityUpF *
_Dt;
Translate(l_DisplacementF * m_UpV);
return l_DisplacementF;
/* NOP */;
}
private function UpdateLinearVerticalMovement(_Dt : Float) : Float{
Translate(_Dt * m_SpeedVerticalF * m_UpV);
return _Dt * m_SpeedVerticalF;
/* NOP */;
}
public function UpdateOrientToInput(_Speed : Float, _Dt : Float) : Bool{
var inputHeading : Float;
var turnDelta : Float;
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputHeading = m_ExplorationO.m_InputO.GetHeadingDiffFro
mPlayerF();
turnDelta = ClampF(inputHeading, -m_OrientToInputMaxHead
ingF, m_OrientToInputMaxHeadingF) * MinF(1.000000, _Speed * _Dt);
if (AbsF(turnDelta) >= AbsF(inputHeading)){
AddYaw(turnDelta - inputHeading);
return true;
}
AddYaw(turnDelta);
}
return false;
/* NOP */;
}
public function UpdateOrientToInputLinear(_Speed : Float, _Dt : Float, t

olerance : Float) : Bool{


var inputHeading : Float;
var inputHeadingAbs : Float;
var turnDelta : Float;
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputHeading = m_ExplorationO.m_InputO.GetHeadingDiffFro
mPlayerF();
inputHeadingAbs = AbsF(inputHeading);
turnDelta = ClampF(SignF(inputHeading) * _Speed * _Dt, inputHeadingAbs, inputHeadingAbs);
AddYaw(turnDelta);
if (AbsF(turnDelta) + tolerance >= inputHeadingAbs){
return true;
}
}
return false;
/* NOP */;
}
private function UpdateBanking(_Dt : Float){
var l_BankingCurF : Float;
var l_RotationNeededF : Float;
var l_RotationEA : EulerAngles;
l_RotationEA = m_ExplorationO.m_OwnerE.GetWorldRotation();
l_BankingCurF = l_RotationEA.Roll;
l_RotationNeededF = AngleDistance(m_BankingTargetF, l_BankingCur
F);
if (AbsF(l_RotationNeededF) > m_BankingSpeedF * _Dt){
l_RotationNeededF = SignF(l_RotationNeededF) * m_Banking
SpeedF * _Dt;
} else {
m_BankingNeedsUpdatingB = false;
}
Rotate(EulerAngles(0.000000, 0.000000, l_RotationNeededF));
/* NOP */;
}
private function ComputeSlideDirAndNormal(){
var aux : Float;
m_SlideNormalV = m_ExplorationO.m_OwnerMAC.GetTerrainNormal(true
);
m_SlideNormalRealV = m_ExplorationO.m_OwnerMAC.GetTerrainNormal(
false);
if (m_SlideNormalV == m_ZeroV){
return;
}
m_SlideDirV = VecCross(m_SlideNormalV, m_UpV);
m_SlideDirV = VecCross(m_SlideNormalV, m_SlideDirV);
m_SlideRealangleF = ComputeRealSlideCoefFromNormal(m_SlideNormal
RealV.Z);
m_SlideRealangleF = ConvertCoefToAngleDegree(m_SlideRealangleF);
m_SlideComputedThisFrameB = true;
/* NOP */;
}
private function ComputeSlideWideCoef(){
var wideNormalGlobal : Vector;
var wideNormalAverage : Vector;
var direction : Vector;
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
if (VecLengthSquared(m_SlideDirV) < 0.900000){

direction = m_ExplorationO.m_OwnerE.GetWorldForward();
} else {
direction = VecNormalize(m_SlideDirV);
}
m_ExplorationO.m_OwnerMAC.GetTerrainNormalWide(m_WideNormalAvera
geV, m_WideNormalGlobalV, direction, m_SlideTerrainWideDistHorizF, m_SlideTerrai
nWideDistFwdF, m_SlideTerrainWideDistBwdF);
m_SlideWideCoefRealAverageF = ComputeRealSlideCoefFromNormal(m_W
ideNormalAverageV.Z);
m_SlideWideCoefRealGlobalF = ComputeRealSlideCoefFromNormal(m_Wi
deNormalGlobalV.Z);
m_SlideWideCoefAverageF = ComputeSlideCoefFromNormal(m_WideNorma
lAverageV.Z);
m_SlideWideCoefGlobalF = ComputeSlideCoefFromNormal(m_WideNormal
GlobalV.Z);
m_SlideWideComputedThisFrameB = true;
/* NOP */;
}
public function GetSlideDirAndNormal(slideDir : Vector, slideNormal : Ve
ctor){
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
slideDir = m_SlideDirV;
slideNormal = m_SlideNormalV;
/* NOP */;
}
public function GetSlideDir() : Vector{
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
return m_SlideDirV;
/* NOP */;
}
public function SetSuperSlide(enabled : Bool){
superSlide = enabled;
/* NOP */;
}
public function GetSlideCoef(forceNoDamp : Bool, coefExtra : Float) : Fl
oat{
var coef : Float;
coef = GetRawSlideCoef(forceNoDamp);
if (superSlide){
coef *= 2.000000;
}
if (m_UseMaterialsB){
if (coef > 0.000000 && m_CoefMinMaterialF != m_SlidingLi
mitMinF){
coef = m_SlidingLimitMinF + coef * m_SlidingLimi
tMaxF - m_SlidingLimitMinF + coefExtra;
if (true){
coef = MapF(coef, m_CoefMinMaterialF, m_
SlidingLimitMaxF, 0.000000, 1.000000);
} else {
coef = -1.000000;
}
}
}
return coef;
/* NOP */;

}
public function GetRawSlideCoef(forceNoDamp : Bool) : Float{
var coef : Float;
if (!forceNoDamp && m_ExplorationO.m_OwnerMAC.IsSliding()){
coef = m_ExplorationO.m_OwnerMAC.GetSlideCoef();
} else {
coef = GetSlideCoefFromTerrain();
}
return coef;
/* NOP */;
}
public function GetRealSlideAngle() : Float{
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
return m_SlideRealangleF;
/* NOP */;
}
public function GetRealWideSlideAngle() : Float{
if (!m_SlideWideComputedThisFrameB){
ComputeSlideWideCoef();
}
return m_SlideWideCoefRealAverageF;
/* NOP */;
}
public function GetSlideWideCoefFromTerrain(average : Bool) : Float{
if (!m_SlideWideComputedThisFrameB){
ComputeSlideWideCoef();
}
if (average){
return m_SlideWideCoefAverageF;
} else {
return m_SlideWideCoefGlobalF;
}
/* NOP */;
}
public function GetSlideCoefFromTerrain() : Float{
var coef : Float;
if (!m_SlideComputedThisFrameB){
ComputeSlideDirAndNormal();
}
coef = ComputeSlideCoefFromNormal(m_SlideNormalV.Z);
return coef;
/* NOP */;
}
public function GetSlideSpeedMax() : Float{
return m_SlideMaxSpeedF;
/* NOP */;
}
public function SetSlideSpeedMode(fast : Bool){
if (fast){
m_SlideMaxSpeedF = m_SlideMaxSpeedToFallF;
} else {
m_SlideMaxSpeedF = m_SlideMaxSpeedSafeF;
}
/* NOP */;
}
private function ComputeRealSlideCoefFromNormal(normalZ : Float) : Float
{
var coef : Float;

coef = AcosF(normalZ) * 2.000000 / Pi();


return coef;
/* NOP */;
}
private function ComputeSlideCoefFromNormal(normalZ : Float) : Float{
var coef : Float;
coef = ComputeRealSlideCoefFromNormal(normalZ);
coef = ClampF(coef - m_SlidingLimitMinF / m_SlidingLimitMaxF - m
_SlidingLimitMinF, 0.000000, 1.000000);
return coef;
/* NOP */;
}
public function StopAllMovement(){
m_SpeedVerticalF = 0.000000;
SetVelocity(m_ZeroV);
VecSetZeros(m_DisplacementV);
EulerSetZeros(m_RotationDeltaEA);
m_SpeedLastF = 0.000000;
m_AccelerationLastF = 0.000000;
/* NOP */;
}
public function StopVerticalMovement(){
m_SpeedVerticalF = 0.000000;
m_VelocityV.Z = 0.000000;
SetVelocity(m_VelocityV);
/* NOP */;
}
public function AddVelocity(velocity : Vector){
SetVelocity(m_VelocityV + velocity);
/* NOP */;
}
public function AddSpeed(speed : Float){
SetVelocity(m_VelocityV + m_VelocityNormalizedV * speed);
/* NOP */;
}
public function SetVelocity(_NewVelocityV : Vector){
m_VelocityV = _NewVelocityV;
m_VelocityV.W = 0.000000;
m_SpeedF = VecLength(m_VelocityV);
m_VelocityNormalizedV = m_VelocityV;
if (m_SpeedF != 0.000000){
m_VelocityNormalizedV /= m_SpeedF;
}
m_SpeedHeadingF = VecHeading(m_VelocityNormalizedV);
/* NOP */;
}
public function SetVerticalSpeed(_NewSpeedF : Float){
m_SpeedVerticalF = _NewSpeedF;
/* NOP */;
}
public function AddVerticalSpeed(_NewSpeedF : Float){
m_SpeedVerticalF += _NewSpeedF;
/* NOP */;
}
public function SetBankingToReset(){
SetBankingTarget(0.000000, m_BankingSpeedDefaultF);
/* NOP */;
}
public function SetBankingTarget(_BankingF : Float, _SpeedF : Float){
m_BankingTargetF = _BankingF;

m_BankingSpeedF = _SpeedF;
m_BankingNeedsUpdatingB = true;
/* NOP */;
}
public function AddYaw(_DeltaYawF : Float){
m_RotationDeltaEA.Yaw += _DeltaYawF;
Rotate(EulerAngles(0.000000, _DeltaYawF, 0.000000));
/* NOP */;
}
public function RotateYawTowards(_TargetYawF : Float, _DeltaYawF : Float
, _ToleranceF : Float, _SoftB : Bool){
var l_RotationEA : EulerAngles;
var l_DistanceF : Float;
var l_DistanceAbsF : Float;
if (_DeltaYawF <= _ToleranceF){
return;
}
l_RotationEA = m_ExplorationO.m_OwnerMAC.GetWorldRotation();
l_DistanceF = AngleDistance(_TargetYawF, l_RotationEA.Yaw + m_Ro
tationDeltaEA.Yaw);
l_DistanceAbsF = AbsF(l_DistanceF);
if (_DeltaYawF >= l_DistanceAbsF){
_DeltaYawF = l_DistanceF;
}
if (l_DistanceF < 0.000000){
_DeltaYawF = -_DeltaYawF;
}
if (_SoftB){
_DeltaYawF *= l_DistanceAbsF / 180.000000;
}
Rotate(EulerAngles(0.000000, _DeltaYawF, 0.000000));
/* NOP */;
}
public function SetSpeedFromAnim(_MaxSpeedF : Float){
var l_ImpulseV : Vector;
l_ImpulseV = m_MACVelocityDampedV;
if (_MaxSpeedF > 0.000000){
if (VecLengthSquared(l_ImpulseV) > _MaxSpeedF * _MaxSpee
dF){
l_ImpulseV = VecNormalize(l_ImpulseV) * _MaxSpee
dF;
}
}
m_ExplorationO.m_MoverO.SetVelocity(l_ImpulseV);
/* NOP */;
}
public function SetSpeedFromAnimFrontal(_MaxSpeedF : Float){
var l_FrontalSpeedF : Float;
l_FrontalSpeedF = VecDot(m_MACVelocityDampedV, m_ExplorationO.m_
MoverO.GetMovementVelocityNormalized());
if (_MaxSpeedF > 0.000000){
l_FrontalSpeedF = MinF(_MaxSpeedF, l_FrontalSpeedF);
}
m_ExplorationO.m_MoverO.SetVelocity(l_FrontalSpeedF * m_Velocity
NormalizedV);
/* NOP */;
}
public function RemoveSpeedOnThisDirection(directionNormalized : Vector)
{
var dot : Float;

var velocityToReduce : Vector;


dot = VecDot(directionNormalized, m_VelocityV);
if (dot > 0.000000){
velocityToReduce = -directionNormalized * dot;
AddVelocity(velocityToReduce);
}
/* NOP */;
}
public function GetMovementHorizontalVelocityV() : Vector{
return m_VelocityV;
/* NOP */;
}
public function GetMovementVerticalSpeedF() : Float{
return m_SpeedVerticalF;
/* NOP */;
}
public function GetMovementVelocity() : Vector{
var velocity : Vector;
velocity = m_VelocityV;
velocity.Z += m_SpeedVerticalF;
return velocity;
/* NOP */;
}
public function GetMovementVelocityNormalized() : Vector{
return m_VelocityNormalizedV;
/* NOP */;
}
public function GetMovementSpeedF() : Float{
return m_SpeedF;
/* NOP */;
}
public function GetMovementSpeedHeadingF() : Float{
return m_SpeedHeadingF;
/* NOP */;
}
public function GetAccelerationnLastF() : Float{
return m_AccelerationLastF;
/* NOP */;
}
public function GetYawTurnThisFrameF() : Float{
return m_RotationDeltaEA.Yaw;
/* NOP */;
}
}
class CExplorationSharedData extends CObject{
private var m_ExplorationO : CExplorationStateManager;
public var m_AutoJumpOnPredictionB : Bool;
public var m_AutoJumpToWaterB : Bool;
public var m_TimeSinceIdleF : Float;
protected editable var m_SprintJumpTimePreparingF : Float;
protected editable var m_BehParamRightFootS : CName;
public var m_IsRightFootForwardB : Bool;
public var m_JumpTypeE : EJumpType;
public var m_LandingOnWater : Bool;
public var m_JumpIsTooSoonToLandB : Bool;
private var m_FallHeightReachedF : Float;
public editable var m_UsePantherJumpB : Bool;
public var m_AirCollisionIsFrontal : Bool;
public var m_JumpDirectionForcedV : Vector;

public var m_CanFallSetVelocityB : Bool;


public var m_ShouldFlipFootOnLandB : Bool;
public var m_DontRecalcFootOnLandB : Bool;
private var m_FromCriticalB : Bool;
public var m_ClimbStateTypeE : EClimbRequirementType;
public editable var m_AirCollisionSideEnabledB : Bool;
public var m_SkipLandAnimDistMaxF : Float;
public var m_SkipLandAnimTimeMaxF : Float;
public editable inlined var m_SkateGlobalC : CExplorationSkatingGlobal;
private var m_LastExplorationS : SExplorationQueryToken;
private var m_LastExplorationValidB : Bool;
public var m_AngleToExploreManualF : Float;
public var m_AngleToExploreAutoF : Float;
public var hasToRecoverFromRagdoll : Bool;
private var m_TeleportTimeCurF : Float;
public var m_TeleportTimeMaxF : Float;
public var terrainSlidePresetName : CName;
private var terrainBlendSpeedCur : Float;
private var terrainBlendSpeedTarget : Float;
private var terrainBlendTimeCur : Float;
private var terrainBlendTimeMax : Float;
public var m_JumpSwimRotationF : Float;
private var m_JumpToWaterAreaB : Bool;
public var m_JumpToWaterForcedDirV : Vector;
public var m_JumpToWaterRequireDirB : Bool;
public var m_JumpToWaterRequireSprintB : Bool;
private var m_HeightFallenF : Float;
private var lastPosition : Vector;
private var landAddAdding : Bool;
private var landAddCurrent : Float;
private editable inlined var landAddCurve : CCurve;
private var landAddCoef : Float;
private editable var landAddCoefWalk : Float;
private editable var landAddTimeCoefWalk : Float;
private var landAddTimeCur : Float;
private editable var landAddSpeedCancel : Float;
private var landAddTimeCoef : Float;
private editable var landAddTimeCoefFast : Float;
private editable var landAddBehVarName : CName;
private editable var m_CameraModifyOffsetB : Bool;
public var m_UsePrototypeAnimationsB : Bool;
public var m_ForceOnlyJumpB : Bool;
public var m_UseClimbB : Bool;
public var m_UsepushB : Bool;
public var hackKnockBackAlways : Bool;
public function Initialize(manager : CExplorationStateManager){
var test : Bool;
m_ExplorationO = manager;
if (m_SkateGlobalC){
test = true;
} else {
m_SkateGlobalC = new CExplorationSkatingGlobal in this;
}
m_SkateGlobalC.Initialize(manager);
m_AngleToExploreManualF = Deg2Rad(m_AngleToExploreManualF);
m_AngleToExploreAutoF = Deg2Rad(m_AngleToExploreAutoF);
DisableJumpToWaterArea();
if (thePlayer){
if (m_UsePrototypeAnimationsB){
thePlayer.SetBehaviorVariable('prototypeAnimatio

ns', 1.000000, /* NOP */);


} else {
thePlayer.SetBehaviorVariable('prototypeAnimatio
ns', 0.000000, /* NOP */);
}
}
Reset();
/* NOP */;
}
public function Reset(){
m_SkateGlobalC.Reset();
ResetHeightFallen();
landAddCurrent = 0.000000;
landAddTimeCoef = 1.000000;
landAddAdding = false;
m_CanFallSetVelocityB = true;
SetFallFromCritical(false);
terrainBlendSpeedCur = terrainBlendSpeedTarget;
terrainBlendTimeCur = terrainBlendTimeMax;
/* NOP */;
}
public function PreUpdate(_Dt : Float){
m_LastExplorationValidB = false;
if (thePlayer.GetIsWalking()){
m_TimeSinceIdleF += _Dt;
} else {
m_TimeSinceIdleF = 0.000000;
}
UpdateTerrainSlopeBlend(_Dt);
/* NOP */;
}
public function PostUpdate(_Dt : Float){
LandCrouchUpdate(_Dt);
m_SkateGlobalC.PostUpdate(_Dt);
lastPosition = m_ExplorationO.m_OwnerE.GetWorldPosition();
if (m_TeleportTimeCurF < m_TeleportTimeMaxF){
ResetHeightFallen();
m_TeleportTimeCurF += _Dt;
}
m_LastExplorationValidB = false;
/* NOP */;
}
public function DrawDebugText(horizontalPos : Int32, verticalPos : Int32
, heightStep : Int32, width : Int32, height : Int32, textColor : Color) : Int32{
var text : String;
text = " HeightFallen : " + m_HeightFallenF + "
Height Reache
d : " + m_FallHeightReachedF;
thePlayer.GetVisualDebug().AddBar('HeightFallen', horizontalPos,
verticalPos, width, height, 0.000000, textColor, text, 0.000000);
verticalPos += heightStep;
return verticalPos;
/* NOP */;
}
public function OnTeleported(){
ResetHeightFallen();
m_TeleportTimeCurF = 0.000000;
/* NOP */;
}
public function HasToFallFromLadder() : Bool{
if (GetCurentExplorationType() != 1){

return false;
}
if (m_ExplorationO.m_CollisionManagerO.CheckLandBelow(0.550000,
Vector(0.000000, 0.000000, 0.500000), true)){
return false;
}
return true;
/* NOP */;
}
public function GetFallFromCritical() : Bool{
return m_FromCriticalB;
/* NOP */;
}
public function SetFallFromCritical(fall : Bool){
m_FromCriticalB = fall;
m_ExplorationO.SetBehaviorParamBool('FallFromCritical', fall, /*
NOP */);
/* NOP */;
}
private function LandCrouchUpdate(_Dt : Float){
if (landAddAdding){
if (landAddTimeCur <= landAddCurve.GetDuration()){
landAddTimeCur += _Dt * landAddTimeCoef;
landAddCurrent = landAddCurve.GetValue(landAddTi
meCur) * landAddCoef;
m_ExplorationO.m_OwnerE.SetBehaviorVariable(land
AddBehVarName, landAddCurrent, /* NOP */);
}
} else if (landAddCurrent >= 0.000000){
landAddCurrent = BlendF(landAddCurrent, 0.000000, landAd
dSpeedCancel * _Dt);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(landAddBehVa
rName, landAddCurrent, /* NOP */);
}
/* NOP */;
}
public function LandCrouchStart(walking : Bool){
if (walking){
landAddCoef = landAddCoefWalk;
landAddTimeCoef = landAddTimeCoefWalk;
} else {
landAddCoef = 1.000000;
landAddTimeCoef = 1.000000;
}
landAddAdding = true;
landAddTimeCur = 0.000000;
/* NOP */;
}
public function LandCrouchCancel(){
landAddAdding = false;
/* NOP */;
}
public function LandCrouchSpeedUp(){
landAddTimeCoef = landAddTimeCoefFast;
/* NOP */;
}
public function SetExplorationToken(exploration : SExplorationQueryToken
, tag : String){
m_LastExplorationS = exploration;
m_LastExplorationValidB = true;

if (m_ExplorationO.m_IsDebugModeB){
LogExplorationToken("Token set by : " + tag + GetExplora
tionTokenDescription(exploration));
}
/* NOP */;
}
public function GetExplorationTokenDescription(exploration : SExploratio
nQueryToken) : String{
var text : String;
text = ". Type " + exploration.type + ". Valid: " + exploration.
valid + ". Pos diff from player: " + VecToString(exploration.pointOnEdge - thePl
ayer.GetWorldPosition()) + ". Normal: " + VecToString(exploration.normal);
return text;
/* NOP */;
}
public function HasValidExploration() : Bool{
return m_LastExplorationValidB && m_LastExplorationS.valid;
/* NOP */;
}
public function GetLastExploration() : SExplorationQueryToken{
return m_LastExplorationS;
/* NOP */;
}
public function HasValidLadderExploration() : Bool{
if (!HasValidExploration()){
return false;
}
if (m_LastExplorationS.type != 1){
return false;
}
return true;
/* NOP */;
}
public function GetCurentExplorationType() : EExplorationType{
return m_LastExplorationS.type;
/* NOP */;
}
public function IsForceHeading(targetRotation : EulerAngles) : Bool{
var imput : Vector;
if (m_ExplorationO.GetStateCur() == 'Interaction'){
targetRotation.Yaw = 180.000000 + VecHeading(m_LastExplo
rationS.normal);
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){
targetRotation.Pitch = 0.000000;
} else {
imput = m_ExplorationO.m_InputO.GetMovementOnPad
V();
targetRotation.Pitch = imput.Y * 65.000000;
}
targetRotation.Roll = 0.000000;
return true;
}
return false;
/* NOP */;
}
public function UpdateTerrainSlopeBlend(_Dt : Float){
if (terrainBlendTimeCur < terrainBlendTimeMax){
terrainBlendTimeCur += _Dt;
terrainBlendSpeedCur = BlendF(terrainBlendSpeedCur, terr
ainBlendSpeedTarget, MinF(terrainBlendTimeCur / terrainBlendTimeMax, 1.000000));

thePlayer.SetBehaviorVariable('onSteepSlopeDampSpeed', t
errainBlendSpeedCur, /* NOP */);
}
/* NOP */;
}
public function SetTerrainSlopeSpeed(speed : Float){
terrainBlendTimeCur = 0.000000;
terrainBlendSpeedCur = speed;
thePlayer.SetBehaviorVariable('terrainBlendSpeed', terrainBlendS
peedCur, /* NOP */);
/* NOP */;
}
public function SetTerrainSlopeInstant(slope : Float){
thePlayer.SetBehaviorVariable('terrainPitch', slope, /* NOP */);
thePlayer.SetTerrainPitch(slope);
/* NOP */;
}
public function ResetHeightFallen(){
m_HeightFallenF = 0.000000;
m_FallHeightReachedF = 0.000000;
lastPosition = m_ExplorationO.m_OwnerE.GetWorldPosition();
if (m_ExplorationO.m_IsDebugModeB){
/* NOP */;
}
/* NOP */;
}
public function GetFallingHeight() : Float{
return m_HeightFallenF;
/* NOP */;
}
public function GetFallingMaxHeightReached() : Float{
return m_FallHeightReachedF;
/* NOP */;
}
public function UpdateFallHeight(){
var currentPosition : Vector;
var heightIncrease : Float;
currentPosition = m_ExplorationO.m_OwnerE.GetWorldPosition();
heightIncrease = currentPosition.Z - lastPosition.Z;
m_HeightFallenF += heightIncrease;
if (heightIncrease > 0.000000){
m_FallHeightReachedF += heightIncrease;
}
/* NOP */;
}
public function CalculateFallingHeights(fallDiff : Float, jumpTotalDiff
: Float){
fallDiff = -GetFallingHeight();
jumpTotalDiff = m_FallHeightReachedF;
/* NOP */;
}
public function SetFotForward(reverse : Bool){
var rightFoot : Bool;
rightFoot = m_ExplorationO.m_MoverO.IsRightFootForward();
if (reverse){
rightFoot = !rightFoot;
}
m_IsRightFootForwardB = rightFoot;
m_ExplorationO.SetBehaviorParamBool(m_BehParamRightFootS, rightF
oot, /* NOP */);

/* NOP */;
}
public function ForceFotForward(right : Bool){
m_ExplorationO.SetBehaviorParamBool(m_BehParamRightFootS, right,
/* NOP */);
/* NOP */;
}
public function EnableJumpToWaterArea(needDirection : Bool, direction :
Vector, requireSprint : Bool){
m_JumpToWaterAreaB = true;
m_JumpToWaterForcedDirV = direction;
m_JumpToWaterRequireDirB = needDirection;
m_JumpToWaterRequireSprintB = requireSprint;
/* NOP */;
}
public function DisableJumpToWaterArea(){
m_JumpToWaterAreaB = false;
/* NOP */;
}
public function GetJumpToWaterArea() : Bool{
return m_JumpToWaterAreaB;
/* NOP */;
}
public function SetUseClimb(enable : Bool){
m_UseClimbB = enable;
/* NOP */;
}
public function SetHackKnockBack(enable : Bool){
hackKnockBackAlways = enable;
/* NOP */;
}
public function SwitchUseOnlyJumpClimbs(){
m_ForceOnlyJumpB = !m_ForceOnlyJumpB;
/* NOP */;
}
public function SetAirCollisionSideEnabled(enabled : Bool){
m_AirCollisionSideEnabledB = enabled;
/* NOP */;
}
public function SwitchPrototypeAnimations(){
m_UsePrototypeAnimationsB = !m_UsePrototypeAnimationsB;
if (m_UsePrototypeAnimationsB){
thePlayer.SetBehaviorVariable('prototypeAnimations', 1.0
00000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('prototypeAnimations', 0.0
00000, /* NOP */);
}
/* NOP */;
}
public function GoToRagdoll(){
var actor : CActor;
var params : SCustomEffectParams;
actor = (CActor)m_ExplorationO.m_OwnerE;
params.effectType = 65;
params.creator = actor;
params.duration = 20;
params.sourceName = actor.GetName();
actor.AddEffectCustom(params);
/* NOP */;

}
public function GoToKnockDown(){
var actor : CActor;
var params : SCustomEffectParams;
actor = (CActor)m_ExplorationO.m_OwnerE;
params.effectType = 9;
params.creator = actor;
params.duration = 20;
params.sourceName = 'SlideFall';
actor.AddEffectCustom(params);
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
m_SkateGlobalC.OnAnimEvent(animEventName, animEventType, animInf
o);
/* NOP */;
}
public function EnableCameraOffsetCorrection(enable : Bool){
m_CameraModifyOffsetB = enable;
/* NOP */;
}
public function CameraOffsetEnabled() : Bool{
return m_CameraModifyOffsetB;
/* NOP */;
}
}
class CExplorationCollisionManager extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private editable var m_CollideWithNPCEventCenter : CName;
private editable var m_CollideWithNPCEventLeft : CName;
private editable var m_CollideWithNPCEventRight : CName;
private editable var m_CollideNameS : CName;
private editable var m_CollideBehGraphSideNameS : CName;
private editable var m_CollideBehGraphStanceNameS : CName;
private editable var m_CollideAngleNameS : CName;
private editable var m_CollideBehGraphStrengthRelNameS : CName;
private editable var m_CollideBehGraphHeightN : CName;
private editable var m_CanCollideWithStaticaB : Bool;
private editable var m_VisualReactionToPushB : Bool;
private editable var m_SpeedToCollideWihNPCsF : Float;
private editable var m_TimeCollidingToStopF : Float;
private var m_TimeCollidingCurF : Float;
private editable var m_AcceptableZToBumpF : Float;
private editable var playerHandHeightRange : Float;
private var m_LandWaterMinDepthF : Float;
private var m_CollisionGroupsNamesNArr : array<CName>;
private var m_CollisionSightNArr : array<CName>;
public var m_CollisionObstaclesNArr : array<CName>;
private var m_CollidingB : Bool;
private var m_IsThereAnyCollisionB : Bool;
private var m_CollidingWithNpcB : Bool;
private var m_CollidingWithStaticsB : Bool;
private editable var m_AngleToSideF : Float;
private var m_CollidingAngleF : Float;
private editable var m_CollideCenterIfBothSidesB : Bool;
private var m_CollidingSideE : ESideSelected;
private var m_CollidingSideLastE : ESideSelected;
private var m_CollidingSideCooldownF : Float;

public var forceFallEnabled : Bool;


public var forceFallRequireCenter : Bool;
public var forceFallRunning : Bool;
public var m_CollidingStrengthOtherF : Float;
public var m_CollidingStrengthRelativeF : Float;
public var m_CollidingDirOtherV : Vector;
public var m_CollidingSpeedOtherV : Vector;
private editable var m_CollidingStrengthFadeSpeedF : Float;
public var m_CollidingIsLowB : Bool;
public editable var m_CollidingLowMinHeightF : Float;
public editable var debugEnabled : Bool;
private var m_UpV : Vector;
private var m_ZeroV : Vector;
public var lastWaterCheckPoint : Vector;
public function Initialize(explorationManager : CExplorationStateManager
){
m_ExplorationO = explorationManager;
m_TimeCollidingCurF = 0.000000;
m_UpV = Vector(0.000000, 0.000000, 1.000000);
m_ZeroV = Vector(0.000000, 0.000000, 0.000000);
m_CollidingStrengthOtherF = -1.000000;
m_CollidingStrengthRelativeF = -1.000000;
m_CollidingDirOtherV = m_ZeroV;
m_CollidingSideLastE = 0;
m_CollidingSideCooldownF = 0.000000;
m_CollidingB = false;
m_CollidingWithStaticsB = false;
m_CollidingWithNpcB = false;
m_CollidingAngleF = 0.000000;
m_CollidingSideE = 0;
m_CollisionSightNArr.PushBack('Terrain');
m_CollisionSightNArr.PushBack('Static');
m_CollisionSightNArr.PushBack('Destructible');
m_CollisionObstaclesNArr.PushBack('Terrain');
m_CollisionObstaclesNArr.PushBack('Static');
m_CollisionObstaclesNArr.PushBack('Foliage');
m_CollisionObstaclesNArr.PushBack('Dynamic');
m_CollisionObstaclesNArr.PushBack('Destructible');
m_CollisionObstaclesNArr.PushBack('RigidBody');
m_CollisionObstaclesNArr.PushBack('Platforms');
m_CollisionObstaclesNArr.PushBack('Boat');
m_CollisionObstaclesNArr.PushBack('BoatDocking');
/* NOP */;
}
public function Update(_Dt : Float){
var isThereAnyCollision : Bool;
var canPlayerReactToCollisions : Bool;
var canPlayerReactToPushes : Bool;
var canNpcsReactToCollisions : Bool;
if (m_CollidingStrengthFadeSpeedF <= 0.000000){
m_CollidingStrengthRelativeF = -1.000000;
} else {
m_CollidingStrengthRelativeF = MaxF(-1.000000, m_Collidi
ngStrengthRelativeF - _Dt * m_CollidingStrengthFadeSpeedF);
}
isThereAnyCollision = m_ExplorationO.m_OwnerMAC.GetCollisionChar
acterDataCount() > 0;
if (m_CanCollideWithStaticaB && !isThereAnyCollision){
isThereAnyCollision = m_ExplorationO.m_OwnerMAC.GetColli
sionDataCount() > 0;

}
if (isThereAnyCollision || isThereAnyCollision != m_IsThereAnyCo
llisionB){
m_CollidingB = false;
m_CollidingWithStaticsB = false;
m_CollidingWithNpcB = false;
m_CollidingAngleF = 0.000000;
m_CollidingSideE = 0;
m_CollidingStrengthOtherF = -1.000000;
}
m_IsThereAnyCollisionB = isThereAnyCollision;
if (m_IsThereAnyCollisionB){
canPlayerReactToCollisions = CanPlayerCollide();
if (m_CanCollideWithStaticaB && canPlayerReactToCollisio
ns){
UpdateCollisionsWithStatics();
}
if (!m_CollidingWithStaticsB && m_ExplorationO.m_OwnerMA
C.GetCollisionCharacterDataCount() > 0){
canPlayerReactToPushes = CanPlayerBePushed();
canNpcsReactToCollisions = CanNPCsCollide();
if (canPlayerReactToCollisions || canPlayerReact
ToPushes || canNpcsReactToCollisions){
UpdateCollisionWithNPCs(canPlayerReactTo
Collisions, canPlayerReactToPushes, canNpcsReactToCollisions);
}
}
}
UpdateCollidingSideEvent(_Dt);
/* NOP */;
}
private function UpdateCollisionWithNPCs(canPlayerReactToCollisions : Bo
ol, canPlayerReactToPushes : Bool, canNpcsReactToCollisions : Bool){
var collisionData : SCollisionData;
var npc : CNewNPC;
var collisionNum : Int32;
var i : Int32;
var playerPos : Vector;
var playerHandHeight : Float;
playerPos = m_ExplorationO.m_OwnerE.GetWorldPosition();
playerHandHeight = playerPos.Z + 1.200000;
collisionNum = m_ExplorationO.m_OwnerMAC.GetCollisionCharacterDa
taCount();
i = 0;
while (i < collisionNum){
collisionData = m_ExplorationO.m_OwnerMAC.GetCollisionCh
aracterData(i);
npc = (CNewNPC)collisionData.entity;
if (!npc){
} else if (!CanThisNpcCollide(npc)){
} else {
if (canNpcsReactToCollisions){
m_CollidingB = true;
m_CollidingWithNpcB = true;
MakeNPCCollide(npc);
}
if (canPlayerReactToCollisions){
if (CanPlayerReactToThisNPC(npc)){
UpdatePlayerCollidingSide(npc.Ge
tWorldPosition(), 0.000000);

UpdatePlayerCollidingHeight(npc)
;
}
}
if (canPlayerReactToPushes){
UpdatePlayerCollidingStrength(npc.GetWor
ldPosition(), npc.GetMovingAgentComponent().GetVelocityBasedOnRequestedMovement(
));
}
}
i += 1;
}
/* NOP */;
}
private function UpdateCollisionsWithStatics(){
if (m_ExplorationO.m_MovementCorrectorO.GetIsCollisionCorrected(
)){
m_CollidingWithStaticsB = true;
m_CollidingB = true;
m_CollidingSideE = 3;
}
/* NOP */;
}
public function IsCollidingWithStatics() : Bool{
return m_ExplorationO.m_OwnerMAC.GetCollisionDataCount() > 0;
/* NOP */;
}
public function GetAngleBlockedByStatics(min : Float, max : Float, angle
Blocked : Float) : Bool{
var collisionData : SCollisionData;
var collisionNum : Int32;
var i : Int32;
var collisionAngle : Float;
var collided : Bool;
min = 360.000000;
max = -360.000000;
collided = false;
collisionNum = m_ExplorationO.m_OwnerMAC.GetCollisionDataCount()
;
i = 0;
while (i < collisionNum){
collisionData = m_ExplorationO.m_OwnerMAC.GetCollisionDa
ta(i);
if (AbsF(collisionData.normal.Z) > 0.450000){
} else {
collisionAngle = VecHeading(-collisionData.norma
l);
min = MinF(min, collisionAngle - angleBlocked);
max = MaxF(max, collisionAngle + angleBlocked);
collided = true;
}
i += 1;
}
min = AngleNormalize180(min);
max = AngleNormalize180(max);
return collided;
/* NOP */;
}
public function IsAngleBlockedByStatics(angle : Float, angleNeeded : Flo
at) : Bool{

var collisionData : SCollisionData;


var collisionNum : Int32;
var i : Int32;
var playerPos : Vector;
var collisionAngle : Float;
playerPos = m_ExplorationO.m_OwnerE.GetWorldPosition();
collisionNum = m_ExplorationO.m_OwnerMAC.GetCollisionDataCount()
;
i = 0;
while (i < collisionNum){
collisionData = m_ExplorationO.m_OwnerMAC.GetCollisionDa
ta(i);
if (AbsF(collisionData.normal.Z) > 0.450000){
} else {
collisionAngle = VecHeading(collisionData.point
- playerPos);
if (AbsF(AngleDistance(angle, collisionAngle)) >
angleNeeded){
return true;
}
}
i += 1;
}
return false;
/* NOP */;
}
private function UpdateCollisionTime(_Dt : Float){
if (m_CollidingB){
m_TimeCollidingCurF += _Dt;
} else {
m_TimeCollidingCurF = 0.000000;
}
/* NOP */;
}
private function CanPlayerCollide() : Bool{
if (m_ExplorationO.GetStateCur() == 'Idle' || m_ExplorationO.Get
StateCur() == 'Pushed' && !thePlayer.rangedWeapon || thePlayer.rangedWeapon.GetC
urrentStateName() == 'State_WeaponWait'){
return true;
}
return false;
/* NOP */;
}
private function CanPlayerBePushed() : Bool{
if (m_ExplorationO.GetStateCur() == 'CombatExploration'){
return true;
}
if (m_ExplorationO.GetStateCur() == 'Idle' || m_ExplorationO.Get
StateCur() == 'Pushed'){
return true;
}
return false;
/* NOP */;
}
private function CanPlayerReactToThisNPC(npc : CNewNPC) : Bool{
if (npc.GetComponentByClassName('CVehicleComponent')){
return false;
}
return true;
/* NOP */;

}
private function CanNPCsCollide() : Bool{
if (m_ExplorationO.GetStateCur() != 'Idle' && VecLengthSquared(m
_ExplorationO.m_OwnerMAC.GetVelocity()) >= m_SpeedToCollideWihNPCsF * m_SpeedToC
ollideWihNPCsF){
return true;
}
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
return true;
}
return false;
/* NOP */;
}
private function CanThisNpcCollide(npc : CNewNPC) : Bool{
var actor : CActor;
var cantPush : Int32;
cantPush = 0;
if (!npc.IsAlive() || npc.IsInAgony()){
return false;
} else if (npc.IsAnimal()){
return false;
}
return true;
/* NOP */;
}
private function MakeNPCCollide(npc : CNewNPC){
npc.SignalGameplayEventParamObject('CollideWithPlayer', m_Explor
ationO.m_OwnerE);
theGame.GetBehTreeReactionManager().CreateReactionEvent(npc, 'Bu
mpAction', 1, 1, 1, 1, false, /* NOP */);
/* NOP */;
}
private function UpdatePlayerCollidingSide(pointToConsider : Vector, nor
malZ : Float){
var newAngle : Float;
var auxAngle : Float;
if (m_CollidingSideE != 0 && !m_CollideCenterIfBothSidesB || m_C
ollidingSideE == 3){
return;
}
if (normalZ > m_AcceptableZToBumpF){
return;
}
m_CollidingB = true;
auxAngle = VecHeading(pointToConsider - m_ExplorationO.m_OwnerMA
C.GetWorldPosition());
newAngle = AngleDistance(m_ExplorationO.m_OwnerMAC.GetHeading(),
auxAngle);
newAngle = AngleNormalize180(newAngle);
if (newAngle <= -m_AngleToSideF){
if (m_CollidingSideE == 0){
m_CollidingSideE = 1;
} else if (m_CollideCenterIfBothSidesB && m_CollidingSid
eE == 2){
newAngle = 0.000000;
m_CollidingSideE = 3;
}
} else if (newAngle < m_AngleToSideF){
m_CollidingSideE = 3;
} else if (newAngle >= m_AngleToSideF){

if (m_CollidingSideE == 0){
m_CollidingSideE = 2;
} else if (m_CollideCenterIfBothSidesB && m_CollidingSid
eE == 1){
newAngle = 0.000000;
m_CollidingSideE = 3;
}
}
m_CollidingAngleF = newAngle;
/* NOP */;
}
private function UpdatePlayerCollidingHeight(npc : CNewNPC){
var mac : CMovingAgentComponent;
var mpac : CMovingPhysicalAgentComponent;
var height : Float;
var positionOwner : Vector;
var positionNpc : Vector;
mac = npc.GetMovingAgentComponent();
mpac = (CMovingPhysicalAgentComponent)mac;
if (!mpac){
m_CollidingIsLowB = true;
return;
}
height = mpac.GetCapsuleHeight();
positionOwner = m_ExplorationO.m_OwnerE.GetWorldPosition();
positionNpc = npc.GetWorldPosition();
m_CollidingIsLowB = positionOwner.Z + m_CollidingLowMinHeightF >
positionNpc.Z + height;
/* NOP */;
}
private function UpdatePlayerCollidingStrength(otherPosition : Vector, o
therSpeed : Vector){
m_CollidingDirOtherV = VecNormalize2D(m_ExplorationO.m_OwnerE.Ge
tWorldPosition() - otherPosition);
m_CollidingStrengthRelativeF = VecDot2D(m_CollidingDirOtherV, ot
herSpeed);
if (m_CollidingStrengthRelativeF < 0.000000){
m_CollidingStrengthOtherF = 0.000000;
} else {
m_CollidingSpeedOtherV = otherSpeed;
m_CollidingStrengthOtherF = VecLength2D(otherSpeed);
}
/* NOP */;
}
public function GetPushData(strength : Float, direction : Vector, otherS
peed : Float, otherVelocity : Vector){
strength = m_CollidingStrengthRelativeF;
direction = m_CollidingDirOtherV;
otherSpeed = m_CollidingStrengthOtherF;
otherVelocity = m_CollidingSpeedOtherV;
/* NOP */;
}
private function SetPlayerCollisionBehaviorData(){
var desiredStance : EPlayerCollisionStance;
desiredStance = GetDesiredStance();
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_CollideBehGraphSta
nceNameS, desiredStance, /* NOP */);
if (m_CollidingSideLastE != m_CollidingSideE){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_CollideBeh
GraphSideNameS, m_CollidingSideE, /* NOP */);

}
m_ExplorationO.SetBehaviorParamBool(m_CollideBehGraphHeightN, m_
CollidingIsLowB, /* NOP */);
if (m_VisualReactionToPushB){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_CollideBeh
GraphStrengthRelNameS, m_CollidingStrengthRelativeF, /* NOP */);
}
/* NOP */;
}
private function UpdateCollidingSideEvent(_Dt : Float){
if (m_CollidingSideLastE != m_CollidingSideE){
switch(m_CollidingSideE){
case 0:
m_CollidingSideCooldownF -= _Dt;
if (m_CollidingSideCooldownF > 0.000000){
return;
}
m_ExplorationO.m_OwnerE.RaiseEvent('CollideStop'
);
break;
case 1:
m_ExplorationO.m_OwnerE.RaiseEvent('CollideLeft'
);
m_CollidingSideCooldownF = 0.000000;
break;
case 2:
m_ExplorationO.m_OwnerE.RaiseEvent('CollideRight
');
m_CollidingSideCooldownF = 0.000000;
break;
case 3:
m_ExplorationO.m_OwnerE.RaiseEvent('CollideCente
r');
m_CollidingSideCooldownF = 0.300000;
break;
}
m_CollidingSideLastE = m_CollidingSideE;
}
/* NOP */;
}
private function GetDesiredStance() : EPlayerCollisionStance{
if (m_CollidingWithStaticsB){
return 1;
}
if (thePlayer.GetIsSprinting()){
if (m_CollidingWithNpcB){
return 3;
}
} else if (thePlayer.IsInCombat()){
return 4;
} else if (thePlayer.GetIsRunning()){
return 2;
} else if (thePlayer.IsMoving()){
return 1;
}
return 0;
/* NOP */;
}
public function IsThereWaterAndIsItDeepEnough(point : Vector, height : F
loat, radius : Float) : Bool{

var world : CWorld;


var waterLevel : Float;
var res : Bool;
var posOrigin : Vector;
var posEnd : Vector;
var posMid : Vector;
var posCollided : Vector;
var normalCollided : Vector;
var waterDepth : Float;
var tempPlayerpos : Vector;
world = theGame.GetWorld();
if (!world){
return false;
}
posEnd = point;
posEnd.Z = height;
posOrigin = point;
waterLevel = world.GetWaterLevel(point, /* NOP */);
if (height >= waterLevel){
return false;
}
point.Z = waterLevel + 0.200000;
waterDepth = world.GetWaterDepth(point, true);
if (waterDepth < m_LandWaterMinDepthF){
return false;
}
posEnd.Z = waterLevel - 0.200000;
res = world.StaticTrace(posOrigin, posEnd, posCollided, normalCo
llided, m_CollisionObstaclesNArr);
if (res){
return false;
}
return true;
/* NOP */;
}
public function CheckLandBelow(distance : Float, offset : Vector, useDef
aultCollisionObstacles : Bool) : Bool{
return CheckSwipeInDir(-m_UpV, distance, 0.200000, offset, useDe
faultCollisionObstacles);
/* NOP */;
}
public function CheckCollisionsForwardInHands(distance : Float) : Bool{
return CheckSwipeInDir(m_ExplorationO.m_OwnerE.GetWorldForward()
, distance, 0.300000, m_UpV, /* NOP */);
/* NOP */;
}
public function CheckCollisionsToNoStepOnInputDir(distForward : Float, h
eightToStep : Float) : Bool{
var direction : Vector;
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
direction = m_ExplorationO.m_InputO.GetMovementOnPlaneNo
rmalizedV();
} else {
direction = m_ExplorationO.m_OwnerE.GetWorldForward();
}
return CheckSwipeInDir(direction, distForward + 0.400000, 0.3000
00, m_UpV * heightToStep + 0.300000, true);
/* NOP */;
}
public function CheckCollisionsInJumpTrajectory(height : Float, distance

: Float) : Bool{
return CheckSwipeInDir(m_ExplorationO.m_OwnerE.GetWorldForward()
, distance, 0.300000, m_UpV * height + 0.300000, /* NOP */);
/* NOP */;
}
public function EnableVerticalSliding(enable : Bool){
m_ExplorationO.m_OwnerMAC.EnableAdditionalVerticalSlidingIterati
on(enable);
/* NOP */;
}
public function TeleportPlayerToHisGroundIfNeeded(tolerance : Float){
var world : CWorld;
var waterLevel : Float;
var res : Bool;
var posOrigin : Vector;
var posEnd : Vector;
var posCollided : Vector;
var normalCollided : Vector;
var ticket : SMovementAdjustmentRequestTicket;
var movementAdjustor : CMovementAdjustor;
world = theGame.GetWorld();
if (!world){
return;
}
posOrigin = m_ExplorationO.m_OwnerE.GetWorldPosition();
waterLevel = world.GetWaterLevel(posOrigin, /* NOP */);
if (waterLevel >= posOrigin.Z){
return;
}
posEnd = posOrigin;
posOrigin.Z += 1.800000;
posEnd.Z -= 30.000000;
res = world.SweepTest(posOrigin, posEnd, 0.400000, posCollided,
normalCollided, m_CollisionObstaclesNArr);
if (res && AbsF(posOrigin.Z - posCollided.Z) > tolerance || AbsF
(posOrigin.Z - posCollided.Z) < 1.000000){
if (waterLevel >= posCollided.Z){
posOrigin.Z = waterLevel;
} else {
posOrigin.Z = posCollided.Z;
}
movementAdjustor = m_ExplorationO.m_OwnerMAC.GetMovement
Adjustor();
ticket = movementAdjustor.CreateNewRequest('teleported_m
oveDown');
thePlayer.Teleport(posOrigin);
movementAdjustor.AdjustmentDuration(ticket, 0.100000);
movementAdjustor.SlideBy(ticket, Vector(0, 0, -0.300000)
);
}
/* NOP */;
}
public function CheckSwipeInDir(directionNormalized : Vector, distance :
Float, radius : Float, vecOffset : Vector, useDefaultCollisionObstacles : Bool)
: Bool{
var world : CWorld;
var posCurrent : Vector;
var posPredicted : Vector;
var posCollided : Vector;
var normalCollided : Vector;

var res : Bool;


world = theGame.GetWorld();
if (!world){
return false;
}
posCurrent = m_ExplorationO.m_OwnerE.GetWorldPosition() + vecOff
set;
posPredicted = posCurrent;
posPredicted += directionNormalized * distance;
if (useDefaultCollisionObstacles){
res = world.SweepTest(posCurrent, posPredicted, radius,
posCollided, normalCollided, m_CollisionObstaclesNArr);
} else {
res = world.SweepTest(posCurrent, posPredicted, radius,
posCollided, normalCollided, /* NOP */);
}
if (!res){
return false;
}
if (VecDot(normalCollided, -directionNormalized) < 0.750000){
return false;
}
return true;
/* NOP */;
}
public function CheckLineOfSightHorizontal(point : Vector) : Bool{
var world : CWorld;
var posOrigin : Vector;
var direction : Vector;
var distance : Float;
var posCollided : Vector;
var normalCollided : Vector;
var res : Bool;
world = theGame.GetWorld();
if (!world){
return true;
}
posOrigin = m_ExplorationO.m_OwnerE.GetWorldPosition() + m_Explo
rationO.m_OwnerE.GetWorldUp();
point.Z = posOrigin.Z;
direction = point - posOrigin;
distance = VecLength(direction);
if (distance < 0.500000){
return true;
}
point -= direction * 0.300000 / distance;
res = world.StaticTrace(posOrigin, point, posCollided, normalCol
lided, m_CollisionGroupsNamesNArr);
if (res){
return false;
}
return true;
/* NOP */;
}
public function HasGroundCollisions() : Bool{
var mac : CMovingPhysicalAgentComponent;
mac = m_ExplorationO.m_OwnerMAC;
if (mac.GetGroundGridCollisionOn(8) || mac.GetGroundGridCollisio
nOn(0) || mac.GetGroundGridCollisionOn(4) || mac.GetGroundGridCollisionOn(5) ||
mac.GetGroundGridCollisionOn(3) || mac.GetGroundGridCollisionOn(1) || mac.GetGro

undGridCollisionOn(2) || mac.GetGroundGridCollisionOn(7) || mac.GetGroundGridCol


lisionOn(6)){
return true;
}
return false;
/* NOP */;
}
public function GetHasToFallInDirection(direction : Float) : Bool{
var mac : CMovingPhysicalAgentComponent;
var hasCenterGround : Bool;
var front : Bool;
var left : Bool;
var right : Bool;
var back : Bool;
if (!forceFallEnabled){
return false;
}
if (m_ExplorationO.GetStateCur() != 'Idle' && m_ExplorationO.Get
StateCur() != 'CombatExploration'){
return false;
}
mac = m_ExplorationO.m_OwnerMAC;
hasCenterGround = mac.GetGroundGridCollisionOn(8);
if (forceFallRequireCenter && hasCenterGround){
return false;
}
if (!forceFallRunning && thePlayer.GetIsRunning()){
return false;
}
direction = 0.000000;
front = !mac.GetGroundGridCollisionOn(0) && !mac.GetGroundGridCo
llisionOn(4) && !mac.GetGroundGridCollisionOn(5);
left = !mac.GetGroundGridCollisionOn(3) && !mac.GetGroundGridCol
lisionOn(4) && !mac.GetGroundGridCollisionOn(7);
right = !mac.GetGroundGridCollisionOn(1) && !mac.GetGroundGridCo
llisionOn(6) && !mac.GetGroundGridCollisionOn(5);
back = !mac.GetGroundGridCollisionOn(2) && !mac.GetGroundGridCol
lisionOn(6) && !mac.GetGroundGridCollisionOn(7) && !mac.GetGroundGridCollisionOn
(3) && !mac.GetGroundGridCollisionOn(1);
if (front && left && right && back){
return false;
} else if (front && left && right){
direction = 0.000000;
} else if (front && right && back){
direction = 0.500000;
} else if (front && left && back){
direction = -0.500000;
} else if (front || back){
if (left){
direction = -0.250000;
} else if (right){
direction = 0.250000;
} else if (front){
direction = 0.000000;
} else {
direction = -1.000000;
}
} else if (left){
direction = -0.500000;
} else if (right){

direction = 0.500000;
}
if (front || right || left || back){
if (!front && !right && !left && m_ExplorationO.GetState
Cur() != 'Idle'){
return false;
}
if (IsAngleBlockedByStatics(direction + m_ExplorationO.m
_OwnerE.GetHeading(), 45.000000)){
return false;
}
if (!IsDirectionToFallFree(direction + m_ExplorationO.m_
OwnerE.GetHeading())){
return false;
}
return true;
}
return false;
/* NOP */;
}
public function IsInSolidGround() : Bool{
var mac : CMovingPhysicalAgentComponent;
mac = m_ExplorationO.m_OwnerMAC;
if (!mac.GetGroundGridCollisionOn(8) || !mac.GetGroundGridCollis
ionOn(0) || !mac.GetGroundGridCollisionOn(4) || !mac.GetGroundGridCollisionOn(5)
|| !mac.GetGroundGridCollisionOn(3) || !mac.GetGroundGridCollisionOn(1) || !mac
.GetGroundGridCollisionOn(2) || !mac.GetGroundGridCollisionOn(7) || !mac.GetGrou
ndGridCollisionOn(6)){
return false;
} else {
return true;
}
/* NOP */;
}
public function IsDirectionToFallFree(headingLocal : Float) : Bool{
var direction : Vector;
direction = VecFromHeading(headingLocal + m_ExplorationO.m_Owner
E.GetHeading());
if (CheckSwipeInDir(direction, 0.600000, 0.400000, m_Exploration
O.m_OwnerE.GetWorldUp(), true)){
return false;
}
return true;
/* NOP */;
}
public function GetLandGoesToFall() : Bool{
var mac : CMovingPhysicalAgentComponent;
var hasCenterGround : Bool;
var front : Bool;
var restOfCollisions : Bool;
mac = m_ExplorationO.m_OwnerMAC;
restOfCollisions = !mac.GetGroundGridCollisionOn(8) && !mac.GetG
roundGridCollisionOn(2) && !mac.GetGroundGridCollisionOn(7) && !mac.GetGroundGri
dCollisionOn(6);
if (restOfCollisions){
return false;
}
front = !mac.GetGroundGridCollisionOn(0) && !mac.GetGroundGridCo
llisionOn(4) && !mac.GetGroundGridCollisionOn(5);
return front;

/* NOP */;
}
public function IsGoingDownSlopeInstant(_AutoRollSlopeCoefF : Float) : B
ool{
var world : CWorld;
var posOrigin : Vector;
var posEnd : Vector;
var posCollided1 : Vector;
var posCollided2 : Vector;
var normalCollided1 : Vector;
var normalCollided2 : Vector;
var direction : Vector;
var res : Bool;
var slideCoef : Float;
world = theGame.GetWorld();
if (!world){
return false;
}
posOrigin = m_ExplorationO.m_OwnerE.GetWorldPosition();
direction = m_ExplorationO.m_OwnerE.GetWorldForward() * 0.400000
;
posOrigin -= direction;
posEnd = posOrigin;
posEnd.Z -= 0.750000;
posOrigin.Z += 0.750000;
res = world.SweepTest(posOrigin, posEnd, 0.200000, posCollided1,
normalCollided1, /* NOP */);
if (!res){
return false;
}
posOrigin += 2.000000 * direction;
posEnd += 2.000000 * direction;
res = world.SweepTest(posOrigin, posEnd, 0.200000, posCollided2,
normalCollided2, /* NOP */);
if (!res){
return false;
}
direction = VecNormalize(posCollided2 - posCollided1);
if (VecDot(direction, Vector(0.000000, 0.000000, -1.000000)) > 0
.000000){
slideCoef = direction.Z;
if (slideCoef < -_AutoRollSlopeCoefF){
return true;
}
}
return false;
/* NOP */;
}
public function IsGoingUpSlope(direction : Vector, upCoef : Float, front
Coef : Float) : Bool{
var slopeDir : Vector;
var slopeNormal : Vector;
var slopeDot : Float;
if (upCoef == 0.000000){
upCoef = 0.750000;
}
m_ExplorationO.m_MoverO.GetSlideDirAndNormal(slopeDir, slopeNorm
al);
if (slopeNormal.Z < upCoef){
slopeDot = VecDot(-slopeDir, direction);

if (slopeDot > frontCoef){


return true;
}
}
return false;
/* NOP */;
}
public function IsGoingUpSlopeInInputDir(upCoef : Float, frontCoef : Flo
at) : Bool{
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){
return IsGoingUpSlope(m_ExplorationO.m_OwnerE.GetWorldFo
rward(), upCoef, frontCoef);
}
return IsGoingUpSlope(m_ExplorationO.m_InputO.GetMovementOnPlane
NormalizedV(), upCoef, frontCoef);
return false;
/* NOP */;
}
public function GetJumpGoesToWater() : Bool{
var inputVector : Vector;
var origin : Vector;
var end : Vector;
var midPoint : Vector;
var normal : Vector;
var collisionPoint : Vector;
var endUpPoint : Vector;
var wallFound : Bool;
var jumpDistance : Float;
var jumpRadius : Float;
var jumpHeight : Float;
var jumpMaxFallHeight : Float;
jumpDistance = 3.800000;
jumpRadius = 0.600000;
jumpHeight = 0.500000;
jumpMaxFallHeight = 250.000000;
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputVector = m_ExplorationO.m_InputO.GetMovementOnPlane
V();
} else {
inputVector = m_ExplorationO.m_OwnerE.GetWorldForward();
}
m_ExplorationO.m_SharedDataO.m_JumpDirectionForcedV = inputVecto
r;
if (thePlayer.IsOnBoat()){
if (!GetJumpGoesToWaterFromBoat(inputVector)){
return false;
}
}
if (!theGame.GetWorld()){
return false;
}
origin = m_ExplorationO.m_OwnerE.GetWorldPosition() + m_Explorat
ionO.m_OwnerE.GetWorldUp() * jumpHeight + jumpRadius + m_ExplorationO.m_OwnerE.G
etWorldForward() * 0.400000;
end = origin + inputVector * jumpDistance;
midPoint = origin + inputVector * jumpDistance * 0.500000;
wallFound = theGame.GetWorld().SweepTest(origin, midPoint, jumpR
adius, collisionPoint, normal, m_CollisionObstaclesNArr);
if (wallFound){
lastWaterCheckPoint = collisionPoint;

return false;
}
wallFound = theGame.GetWorld().SweepTest(midPoint, end, jumpRadi
us, collisionPoint, normal, m_CollisionObstaclesNArr);
if (wallFound){
lastWaterCheckPoint = collisionPoint;
return false;
}
endUpPoint = end;
endUpPoint.Z = origin.Z;
lastWaterCheckPoint = endUpPoint;
return IsThereWaterAndIsItDeepEnough(endUpPoint, end.Z - jumpMax
FallHeight, jumpRadius);
/* NOP */;
}
private function GetJumpGoesToWaterFromBoat(inputVector : Vector) : Bool
{
var vehicleComponent : CVehicleComponent;
var vehicleEntity : CEntity;
var direction : Vector;
var dot : Float;
var dot2 : Float;
var angle : Float;
vehicleComponent = thePlayer.FindTheNearestVehicle(6.000000, fal
se);
if (vehicleComponent){
vehicleEntity = (CEntity)vehicleComponent.GetParent();
if (vehicleEntity){
dot = VecDot(inputVector, vehicleEntity.GetWorld
Forward());
dot = AbsF(dot);
if (dot < 0.500000){
direction = m_ExplorationO.m_OwnerE.GetW
orldPosition() - vehicleEntity.GetWorldPosition();
dot = VecDot(direction, vehicleEntity.Ge
tWorldRight());
dot2 = VecDot(inputVector, vehicleEntity
.GetWorldRight());
if (dot * dot2 > 0.000000){
return true;
}
}
}
}
return false;
/* NOP */;
}
public function GetJumpGoesOutOfBoat() : Bool{
var vehicleComponent : CVehicleComponent;
var vehicleEntity : CEntity;
var direction : Vector;
var dot : Float;
var dot2 : Float;
var angle : Float;
var inputVector : Vector;
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputVector = m_ExplorationO.m_InputO.GetMovementOnPlane
V();
} else {
inputVector = m_ExplorationO.m_OwnerE.GetWorldForward();

}
vehicleComponent = thePlayer.FindTheNearestVehicle(6.000000, fal
se);
if (vehicleComponent){
vehicleEntity = (CEntity)vehicleComponent.GetParent();
if (vehicleEntity){
dot = VecDot(inputVector, vehicleEntity.GetWorld
Forward());
dot = AbsF(dot);
return dot < 0.600000;
}
}
return false;
/* NOP */;
}
public function UpdateDebugInfo(){
var auxString : String;
var textColor : Color;
var width : Int32;
var height : Int32;
var heightCur : Int32;
var heightInit : Int32;
var heightInactive : Int32;
var heightOffset : Int32;
var heightOffsetBig : Int32;
var left : Int32;
var center : Int32;
var right : Int32;
var i : Int32;
var mac : CMovingPhysicalAgentComponent;
textColor = Color(255, 255, 0);
width = 200;
height = 10;
heightInit = 100;
heightInactive = 300;
heightOffset = 15;
heightOffsetBig = 25;
left = 850;
center = 950;
right = 1050;
mac = m_ExplorationO.m_OwnerMAC;
heightCur = heightInit;
thePlayer.GetVisualDebug().AddBar('GroundCollisionFail', left, h
eightCur, width, height, 0.000000, textColor, "Ground collisions", 0.000000);
heightCur += heightOffset;
auxString = "" + mac.GetGroundGridCollisionOn(4);
thePlayer.GetVisualDebug().AddBar('CS_FRONT_LEFT', left, heightC
ur, width, height, 0.000000, textColor, auxString, 0.000000);
auxString = "" + mac.GetGroundGridCollisionOn(0);
thePlayer.GetVisualDebug().AddBar('CS_FRONT', center, heightCur,
width, height, 0.000000, textColor, auxString, 0.000000);
auxString = "" + mac.GetGroundGridCollisionOn(5);
thePlayer.GetVisualDebug().AddBar('CS_FRONT_RIGHT', right, heigh
tCur, width, height, 0.000000, textColor, auxString, 0.000000);
heightCur += heightOffset;
auxString = "" + mac.GetGroundGridCollisionOn(3);
thePlayer.GetVisualDebug().AddBar('CS_LEFT', left, heightCur, wi
dth, height, 0.000000, textColor, auxString, 0.000000);
auxString = "" + mac.GetGroundGridCollisionOn(8);
thePlayer.GetVisualDebug().AddBar('CS_CENTER', center, heightCur

, width, height, 0.000000, textColor, auxString, 0.000000);


auxString = "" + mac.GetGroundGridCollisionOn(1);
thePlayer.GetVisualDebug().AddBar('CS_RIGHT', right, heightCur,
width, height, 0.000000, textColor, auxString, 0.000000);
heightCur += heightOffset;
auxString = "" + mac.GetGroundGridCollisionOn(7);
thePlayer.GetVisualDebug().AddBar('CS_BACK_LEFT', left, heightCu
r, width, height, 0.000000, textColor, auxString, 0.000000);
auxString = "" + mac.GetGroundGridCollisionOn(2);
thePlayer.GetVisualDebug().AddBar('CS_BACK', center, heightCur,
width, height, 0.000000, textColor, auxString, 0.000000);
auxString = "" + mac.GetGroundGridCollisionOn(6);
thePlayer.GetVisualDebug().AddBar('CS_BACK_RIGHT', right, height
Cur, width, height, 0.000000, textColor, auxString, 0.000000);
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags) : Bool{
var vectorUp : Vector;
var destination : Vector;
if (!debugEnabled){
return true;
}
frame.DrawSphere(lastWaterCheckPoint, 0.300000, Color(0, 255, 0)
);
frame.DrawText("Water ", lastWaterCheckPoint, Color(0, 255, 0));
return true;
/* NOP */;
}
}
class CExplorationMovementCorrector extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private var correctionNone : NavigationCorrection;
private var correctionOnCollision : NavigationCorrection;
private var correctionOnPhysics : NavigationCorrection;
private var correctionOnPush : NavigationCorrection;
private var correctionOnNavMesh : NavigationCorrection;
private var correctionOnExploration : NavigationCorrection;
private var correctionOnDoors : NavigationCorrection;
private var correctionOnFalling : NavigationCorrection;
private var correctionAccepted : NavigationCorrection;
private var validExploration : SExplorationQueryToken;
private var checkingForRun : Bool;
private var checkingForCombat : Bool;
private var inputDiference : Float;
private var pushSlowingTimeCooldown : Float;
private var pushSlowingTimeCur : Float;
private var maxPushAngleSlow : Float;
private var maxPushAngleTurn : Float;
private var pushCooldownTotal : Float;
private var pushCooldownCur : Float;
private var pushDirection : Vector;
private var collisionStopped : Bool;
private var enableCollisionWalking : Bool;
private var enableCollisionRunning : Bool;
private var enablePushCombat : Bool;
private var enablePushWhileMoving : Bool;
private var enablePhysicsWalking : Bool;
private var enablePhysicsRunning : Bool;

private var enableNavMeshWalking : Bool;


private var enableNavMeshRunning : Bool;
private var enableExplorationWalking : Bool;
private var enableExplorationRunning : Bool;
private var enableDoorsWalking : Bool;
private var enableDoorsRunning : Bool;
private var limitCorrectionTurningSide : Bool;
private var inputDifToSide : Float;
private var maxPhysicSideDistance : Float;
private var maxPhysicPortalDistance : Float;
private var maxPhysicDistanceWalk : Float;
private var maxPhysicDistanceRun : Float;
private var maxPhysicAngleWalk : Float;
private var maxPhysicAngleRun : Float;
private var maxNavmeshDistanceWalk : Float;
private var maxNavmeshDistanceRun : Float;
private var maxNavmeshAngleWalk : Float;
private var maxNavmeshAngleRun : Float;
private var maxExplorationDistanceWalk : Float;
private var maxExplorationDistanceRun : Float;
private var maxExplorationAngleWalk : Float;
private var maxExplorationAngleRun : Float;
private var maxDoorDistanceWalk : Float;
private var maxDoorDistanceRun : Float;
private var maxDoorAngleWalk : Float;
private var maxDoorAngleRun : Float;
private var maxDoorAngleGather : Float;
private var maxDoorBack : Float;
private var maxDoorHeight : Float;
private var turnAdjustmentEnabled : Bool;
private var turnAdjustmentTimeCur : Float;
private var turnAdjustmentTimeMax : Float;
private var cameraRequestByDoor : Bool;
private var doorPoint : Vector;
private var auxDiff : Float;
private var debugPush : Bool;
public function Initialize(explorationManager : CExplorationStateManager
){
m_ExplorationO = explorationManager;
correctionNone = new NavigationCorrection in this;
correctionNone.color = Color(0, 0, 0);
correctionNone.type = 0;
correctionNone.corrected = false;
correctionNone.angle = 0.000000;
correctionOnExploration = new NavigationCorrection in this;
correctionOnExploration.color = Color(255, 50, 50);
correctionOnExploration.type = 5;
correctionOnDoors = new NavigationCorrection in this;
correctionOnDoors.color = Color(50, 155, 155);
correctionOnDoors.type = 6;
correctionOnFalling = new NavigationCorrection in this;
correctionOnFalling.color = Color(155, 50, 155);
correctionOnFalling.type = 7;
correctionOnCollision = new NavigationCorrection in this;
correctionOnCollision.color = Color(155, 155, 50);
correctionOnCollision.type = 1;
correctionOnPush = new NavigationCorrection in this;
correctionOnPush.color = Color(50, 255, 50);
correctionOnPush.type = 2;
correctionOnPhysics = new NavigationCorrection in this;

correctionOnPhysics.color = Color(50, 255, 50);


correctionOnPhysics.type = 3;
correctionOnNavMesh = new NavigationCorrection in this;
correctionOnNavMesh.color = Color(50, 50, 255);
correctionOnNavMesh.type = 4;
turnAdjustmentTimeCur = 0.000000;
/* NOP */;
}
public function PreUpdate(_Dt : Float){
pushSlowingTimeCur -= _Dt;
pushCooldownCur -= _Dt;
UpdateTurnAdjustment(_Dt);
/* NOP */;
}
public function CorrectDirectionToAvoid(direction : Vector, newDirection
: Vector, anyInput : Bool) : Bool{
UpdatePlayerData();
UpdateCorrections(direction, anyInput);
FindBestCorrection();
if (correctionAccepted.type != 0){
newDirection = correctionAccepted.direction;
return true;
}
return false;
/* NOP */;
}
public function ModifySpeedRequired(speed : Float) : Bool{
if (correctionAccepted.type == 2){
if (pushSlowingTimeCur > 0.000000){
speed = 0.000000;
} else {
speed = 1.000000;
}
return true;
} else if (collisionStopped){
speed = MinF(speed, 0.100000);
return true;
}
return false;
/* NOP */;
}
public function IsDoorRequestingCamera() : Bool{
return cameraRequestByDoor;
/* NOP */;
}
private function UpdatePlayerData(){
if (thePlayer.GetIsRunning() || thePlayer.GetIsSprinting()){
checkingForRun = true;
} else {
checkingForRun = false;
}
if (m_ExplorationO.GetStateCur() == 'CombatExploration'){
checkingForCombat = true;
} else {
checkingForCombat = false;
}
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputDiference = m_ExplorationO.m_InputO.GetHeadingOnPad
F();
} else {

inputDiference = 0.000000;
}
/* NOP */;
}
public function StartTurnAdjustment(){
if (turnAdjustmentEnabled){
turnAdjustmentTimeCur = turnAdjustmentTimeMax;
}
/* NOP */;
}
public function CancelTurnAdjustment(){
turnAdjustmentTimeCur = 0.000000;
/* NOP */;
}
private function UpdateTurnAdjustment(_Dt : Float){
if (turnAdjustmentTimeCur > 0.000000){
m_ExplorationO.m_MoverO.UpdateOrientToInput(3.000000, _D
t);
turnAdjustmentTimeCur -= _Dt;
}
/* NOP */;
}
private function UpdateCorrections(direction : Vector, anyInput : Bool){
correctionOnCollision.corrected = false;
correctionOnFalling.corrected = false;
correctionOnPhysics.corrected = false;
correctionOnPush.corrected = false;
correctionOnExploration.corrected = false;
correctionOnNavMesh.corrected = false;
correctionOnDoors.corrected = false;
cameraRequestByDoor = false;
collisionStopped = false;
if (enablePushCombat && checkingForCombat && anyInput || enableP
ushWhileMoving){
CorrectDirectionOnPush(direction, correctionOnPush);
}
if (!anyInput){
return;
}
if (!checkingForRun && enableCollisionWalking || checkingForRun
&& enableCollisionRunning){
CorrectDirectionOnCollision(direction, correctionOnColli
sion);
}
if (!checkingForRun && enablePhysicsWalking || checkingForRun &&
enablePhysicsRunning){
CorrectDirectionOnPhysycs(direction, correctionOnPhysics
);
}
if (!checkingForRun && enableNavMeshWalking || checkingForRun &&
enableNavMeshRunning){
CorrectDirectionOnNavmesh(direction, correctionOnNavMesh
);
}
if (!checkingForRun && enableExplorationWalking || checkingForRu
n && enableExplorationRunning){
CorrectDirectionOnExploration(direction, correctionOnExp
loration);
}
if (!checkingForRun && enableDoorsWalking || checkingForRun && e

nableDoorsRunning){
CorrectDirectionOnDoors(direction, correctionOnDoors);
}
/* NOP */;
}
private function FindBestCorrection(){
if (correctionOnCollision.corrected){
correctionAccepted = correctionOnCollision;
return;
}
if (correctionOnPush.corrected){
correctionAccepted = correctionOnPush;
return;
}
if (correctionOnFalling.corrected){
correctionAccepted = correctionOnFalling;
return;
}
if (correctionOnDoors.corrected){
correctionAccepted = correctionOnDoors;
return;
}
if (correctionOnPhysics.corrected){
if (correctionOnNavMesh.corrected && AbsF(correctionOnNa
vMesh.angle) > AbsF(correctionOnPhysics.angle)){
correctionAccepted = correctionOnNavMesh;
} else {
correctionAccepted = correctionOnPhysics;
}
} else if (correctionOnNavMesh.corrected){
correctionAccepted = correctionOnNavMesh;
}
if (correctionOnExploration.corrected){
if (!correctionOnPhysics.corrected && !correctionOnNavMe
sh.corrected || AbsF(correctionOnExploration.angle) < AbsF(correctionAccepted.an
gle)){
correctionAccepted = correctionOnExploration;
}
} else if (!correctionOnPhysics.corrected && !correctionOnNavMes
h.corrected){
correctionAccepted = correctionNone;
}
/* NOP */;
}
private function CorrectDirectionOnDoors(direction : Vector, correction
: NavigationCorrection){
var entities : array<CGameplayEntity>;
var maxAngle : Float;
var maxDist : Float;
var maxAngleDot : Float;
var doorMark : CDoorMarking;
var playerPos : Vector;
var normal : Vector;
var point : Vector;
var correctedDir : Vector;
var foundDoors : Int32;
var i : Int32;
var distance : Float;
if (checkingForRun){
maxAngle = maxDoorAngleRun;

maxDist = maxDoorDistanceRun;
} else {
maxAngle = maxDoorAngleWalk;
maxDist = maxDoorDistanceWalk;
}
playerPos = m_ExplorationO.m_OwnerE.GetWorldPosition();
FindGameplayEntitiesInCone(entities, playerPos - m_ExplorationO.
m_OwnerE.GetWorldForward() * maxDoorBack, VecHeading(direction), maxDoorAngleGat
her, maxDist + maxDoorBack, 100, 'navigation_correction', /* NOP */, /* NOP */,
/* NOP */);
foundDoors = entities.Size();
if (foundDoors <= 0){
return;
}
maxAngleDot = CosF(Deg2Rad(maxAngle));
i = 0;
while (i < foundDoors){
doorMark = (CDoorMarking)entities[i].GetComponentByClass
Name('CDoorMarking');
if (!doorMark){
} else {
doorMark.SetCheckState(1);
doorMark.GetClosestPointAndNormal(point, normal)
;
if (point.Z < playerPos.Z - maxDoorHeight || poi
nt.Z > playerPos.Z + maxDoorHeight){
} else if (AbsF(VecDot(normal, direction)) < max
AngleDot){
} else {
correctedDir = point - playerPos;
if (VecDot(correctedDir, direction) < 0.
000000){
} else {
distance = VecLength(correctedDi
r);
if (distance < 0.500000){
if (VecDot(normal, direc
tion) > 0.000000){
normal = -normal
;
}
point -= normal * 0.5000
00;
correctedDir = VecNormal
ize(point - playerPos);
} else if (distance > 1.000000){
if (VecDot(normal, direc
tion) > 0.000000){
normal = -normal
;
}
point += normal * 0.5000
00;
correctedDir = VecNormal
ize(point - playerPos);
} else {
correctedDir /= distance
;
}
correction.Set(true, direction,

correctedDir);
cameraRequestByDoor = doorMark.I
sChangingCamera();
doorPoint = point;
doorMark.SetCheckState(2);
break;
}
}
}
i += 1;
}
/* NOP */;
}
private function CorrectDirectionOnCollision(direction : Vector, correct
ion : NavigationCorrection){
var correctedDir : Vector;
var min : Float;
var max : Float;
var desiredAngle : Float;
var angleDist : Float;
var closestCorrection : Float;
if (!m_ExplorationO.m_CollisionManagerO.IsCollidingWithStatics()
){
return;
}
if (!m_ExplorationO.m_CollisionManagerO.GetAngleBlockedByStatics
(min, max, 90.000000)){
return;
}
desiredAngle = VecHeading(direction);
if (AbsF(AngleDistance(desiredAngle, min)) < AbsF(AngleDistance(
desiredAngle, max))){
closestCorrection = min;
} else {
closestCorrection = max;
}
angleDist = AbsF(AngleDistance(closestCorrection, desiredAngle))
;
LogExplorationCorrection("Collision angleDist: " + angleDist);
if (angleDist > 45.000000){
correctedDir = direction;
collisionStopped = true;
} else if (angleDist < 75.000000){
correctedDir = VecFromHeading(closestCorrection);
} else {
return;
}
correction.Set(true, direction, correctedDir);
/* NOP */;
}
private function LogExplorationCorrection(text : String){
/* NOP */;
/* NOP */;
}
public function IsTurnAdjusted() : Bool{
return turnAdjustmentTimeCur > 0.000000;
/* NOP */;
}
private function CorrectDirectionOnPush(direction : Vector, correction :
NavigationCorrection){

var pushing : Bool;


var slowing : Bool;
var back : Bool;
var pushCorrectDir : Vector;
if (!CanBePushed()){
return;
}
FindCurrentPushData(pushCorrectDir, slowing, pushing, back);
if (slowing){
pushSlowingTimeCur = pushSlowingTimeCooldown;
}
if (back){
pushDirection = pushCorrectDir;
pushCooldownCur = pushCooldownTotal;
} else if (pushing){
pushDirection = pushCorrectDir;
pushCooldownCur = 0.000000;
}
if (pushCooldownCur >= 0.000000){
correction.Set(true, direction, pushDirection);
}
/* NOP */;
}
private function CanBePushed() : Bool{
if (thePlayer.GetPlayerCombatStance() == 1 && thePlayer.playerMo
veType == 0 || thePlayer.playerMoveType == 1){
return true;
} else {
return false;
}
/* NOP */;
}
private function FindCurrentPushData(pushDirection : Vector, slowing : B
ool, pushing : Bool, pushBack : Bool){
var pudhDir : Vector;
var pushAngle : Float;
var diffAngle : Float;
var pushStrength : Float;
var otherPushStrength : Float;
var otherPushDir : Vector;
slowing = false;
pushing = false;
pushBack = false;
m_ExplorationO.m_CollisionManagerO.GetPushData(pushStrength, pud
hDir, otherPushStrength, otherPushDir);
if (pushStrength <= -1.000000){
return;
}
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){
pushDirection = pudhDir;
pushing = true;
pushBack = VecDot(pudhDir, m_ExplorationO.m_OwnerE.GetWo
rldForward()) < -0.500000;
} else {
pushAngle = AngleNormalize180(VecHeading(-pudhDir));
diffAngle = AngleNormalize180(m_ExplorationO.m_InputO.Ge
tHeadingDiffFromYawF(pushAngle));
auxDiff = diffAngle;
if (AbsF(diffAngle) < maxPushAngleSlow){
pushing = otherPushStrength > 0.000000;

slowing = !pushing;
pushDirection = pudhDir;
pushBack = true;
} else if (AbsF(diffAngle) < maxPushAngleTurn){
pushing = true;
if (diffAngle > 0.000000){
pushDirection = VecFromHeading(m_Explora
tionO.m_InputO.GetHeadingOnPlaneF() + maxPushAngleTurn);
} else {
pushDirection = VecFromHeading(m_Explora
tionO.m_InputO.GetHeadingOnPlaneF() - maxPushAngleTurn);
}
}
}
/* NOP */;
}
private function CorrectDirectionOnPush2(direction : Vector, correction
: NavigationCorrection){
var pudhDir : Vector;
var pushAngle : Float;
var diffAngle : Float;
var pushStrength : Float;
var correctedDir : Vector;
var otherPushStrength : Float;
var otherPushDir : Vector;
m_ExplorationO.m_CollisionManagerO.GetPushData(pushStrength, pud
hDir, otherPushStrength, otherPushDir);
if (pushStrength <= -1.000000){
return;
}
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){
direction = m_ExplorationO.m_OwnerE.GetWorldForward();
correctedDir = pudhDir;
} else {
pushAngle = AngleNormalize180(VecHeading(-pudhDir));
diffAngle = AngleNormalize180(m_ExplorationO.m_InputO.Ge
tHeadingDiffFromYawF(pushAngle));
auxDiff = diffAngle;
if (AbsF(diffAngle) < maxPushAngleSlow){
if (otherPushStrength > 0.000000){
correctedDir = pudhDir;
} else {
pushSlowingTimeCur = pushSlowingTimeCool
down;
}
} else {
if (pushStrength <= 0.000000){
return;
}
if (AbsF(diffAngle) < maxPushAngleTurn){
if (diffAngle > 0.000000){
correctedDir = VecFromHeading(m_
ExplorationO.m_InputO.GetHeadingOnPlaneF() + maxPushAngleTurn);
} else {
correctedDir = VecFromHeading(m_
ExplorationO.m_InputO.GetHeadingOnPlaneF() - maxPushAngleTurn);
}
} else {
return;
}

}
}
if (VecDot(correctedDir, pudhDir) < 0.000000){
pushSlowingTimeCur = pushSlowingTimeCooldown;
}
correction.Set(true, direction, correctedDir);
/* NOP */;
}
private function CorrectDirectionOnPhysycs(direction : Vector, correctio
n : NavigationCorrection){
var corrected : Bool;
var correctedDir : Vector;
var corner : Bool;
var portal : Bool;
var speed : Float;
var maxAngle : Float;
var maxDist : Float;
var shouldStop : Bool;
if (checkingForRun){
maxAngle = maxPhysicAngleRun;
maxDist = maxPhysicDistanceRun;
} else {
maxAngle = maxPhysicAngleWalk;
maxDist = maxPhysicDistanceWalk;
}
correctedDir = direction;
speed = maxDist;
corrected = m_ExplorationO.m_OwnerMAC.AdjustRequestedMovementDir
ectionPhysics(correctedDir, shouldStop, speed, maxAngle, maxPhysicSideDistance,
corner, portal);
correction.Set(corrected, direction, correctedDir);
if (corrected && AbsF(correction.angle) > maxAngle){
correction.corrected = false;
}
if (correction.corrected && !IsCorrectionSideAcceptable(correcti
on.direction)){
correction.corrected = false;
}
/* NOP */;
}
private function CorrectDirectionOnNavmesh(direction : Vector, correctio
n : NavigationCorrection){
var forwardDir : Vector;
var correctedDir : Vector;
var corrected : Bool;
var modifiedAngle : Float;
var maxDist : Float;
var maxAngle : Float;
if (checkingForRun){
maxDist = maxNavmeshDistanceRun;
maxAngle = maxNavmeshAngleRun;
} else {
maxDist = maxNavmeshDistanceWalk;
maxAngle = maxNavmeshAngleWalk;
}
correctedDir = m_ExplorationO.m_OwnerE.GetWorldForward();
corrected = m_ExplorationO.m_OwnerMAC.AdjustRequestedMovementDir
ectionNavMesh(correctedDir, maxDist, maxAngle, 15, 5, direction, true);
correction.Set(corrected, direction, correctedDir);
if (correction.corrected && !IsCorrectionSideAcceptable(correcti

on.direction)){
correction.corrected = false;
}
/* NOP */;
}
private function CorrectDirectionOnExploration(inputDir : Vector, correc
tion : NavigationCorrection){
var directionToInteract : Vector;
var newExploration : SExplorationQueryToken;
if (GetClosestExploration(inputDir, newExploration)){
if (GetDirectionToReachExploration(inputDir, newExplorat
ion, directionToInteract)){
validExploration = newExploration;
correction.Set(true, inputDir, directionToIntera
ct);
if (IsCorrectionSideAcceptable(correction.direct
ion)){
return;
}
}
}
if (GetDirectionToReachExploration(inputDir, validExploration, d
irectionToInteract)){
correction.Set(true, inputDir, directionToInteract);
if (IsCorrectionSideAcceptable(correction.direction)){
return;
}
}
correction.corrected = false;
return;
/* NOP */;
}
private function GetClosestExploration(direction : Vector, exploration :
SExplorationQueryToken) : Bool{
var queryContext : SExplorationQueryContext;
queryContext.inputDirectionInWorldSpace = direction;
queryContext.maxAngleToCheck = 5.000000;
queryContext.forJumping = false;
queryContext.dontDoZAndDistChecks = true;
if (m_ExplorationO.m_SharedDataO.m_UseClimbB){
queryContext.laddersOnly = true;
}
exploration = theGame.QueryExplorationSync(thePlayer, queryConte
xt);
return exploration.valid;
/* NOP */;
}
private function GetDirectionToReachExploration(direction : Vector, expl
oration : SExplorationQueryToken, directionToInteract : Vector) : Bool{
var distToExploration : Float;
var dot : Float;
var dotLimit : Float;
var distanceMax : Float;
var angleMax : Float;
directionToInteract = exploration.pointOnEdge - thePlayer.GetWor
ldPosition();
if (directionToInteract.Z < -2.000000 || directionToInteract.Z >
2.750000){
return false;
}

if (checkingForRun){
distanceMax = maxExplorationDistanceRun;
angleMax = maxExplorationAngleRun;
} else {
distanceMax = maxExplorationDistanceWalk;
angleMax = maxExplorationAngleWalk;
}
directionToInteract.Z = 0.000000;
distToExploration = VecLength(directionToInteract);
directionToInteract = directionToInteract / distToExploration;
dot = VecDot(directionToInteract, direction);
dotLimit = CosF(Deg2Rad(angleMax));
if (dot < dotLimit){
return false;
}
if (dot < CosF(Deg2Rad(75.000000))){
directionToInteract = exploration.pointOnEdge + explorat
ion.normal - thePlayer.GetWorldPosition();
directionToInteract.Z = 0.000000;
distToExploration = VecLength(directionToInteract);
}
if (distToExploration > distanceMax){
return false;
}
directionToInteract /= distToExploration;
return true;
/* NOP */;
}
private function IsCorrectionSideAcceptable(correctionDirection : Vector
) : Bool{
var angle : Float;
if (!limitCorrectionTurningSide){
return true;
}
angle = VecHeading(correctionDirection);
angle = m_ExplorationO.m_InputO.GetHeadingDiffFromYawF(angle);
if (AbsF(inputDiference) > inputDifToSide && angle * inputDifere
nce > 0.000000){
return false;
}
return true;
/* NOP */;
}
public function GetIsCollisionCorrected() : Bool{
return collisionStopped;
/* NOP */;
}
public function GetDebugText() : String{
var text : String;
var typeText : String;
var i : Int32;
var cases : Int32;
var accepted : Int32;
var j : Int32;
var length : Int32;
cases = 8;
accepted = correctionAccepted.type;
text = "Correction: ";
i = 0;
while (i < cases){

if (i == accepted){
typeText = correctionAccepted.type;
length = StrLen(typeText);
j = 0;
while (j < 15 - length){
typeText += ".";
j += 1;
}
text += typeText;
} else {
text += "...............";
}
i += 1;
}
if (pushSlowingTimeCur > 0.000000){
text += "Stopping ";
}
if (collisionStopped){
text += "Stopping Collision";
}
return text + auxDiff;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags) : Bool{
var green : Color;
var auxText : String;
if (!debugPush){
return true;
}
green = Color(0, 255, 0);
correctionOnCollision.OnVisualDebug(frame, flag, correctionAccep
ted.type == correctionOnCollision.type);
correctionOnPush.OnVisualDebug(frame, flag, correctionAccepted.t
ype == correctionOnCollision.type);
correctionOnPhysics.OnVisualDebug(frame, flag, correctionAccepte
d.type == correctionOnPhysics.type);
correctionOnNavMesh.OnVisualDebug(frame, flag, correctionAccepte
d.type == correctionOnNavMesh.type);
correctionOnExploration.OnVisualDebug(frame, flag, correctionAcc
epted.type == correctionOnExploration.type);
correctionOnDoors.OnVisualDebug(frame, flag, correctionAccepted.
type == correctionOnDoors.type);
correctionOnFalling.OnVisualDebug(frame, flag, correctionAccepte
d.type == correctionOnFalling.type);
frame.DrawSphere(doorPoint, 0.200000, green);
frame.DrawText("Door Correction", doorPoint, green);
if (false){
auxText = "Angle " + auxDiff;
if (pushSlowingTimeCur > 0.000000){
auxText += "-> Slowing";
}
frame.DrawText(auxText, m_ExplorationO.m_OwnerE.GetWorld
Position() + m_ExplorationO.m_OwnerE.GetWorldUp() * 2.000000, green);
}
return true;
/* NOP */;
}
}

class CExplorationStateAbstract extends CScriptedComponent{


protected editable var m_StateNameN : CName;
protected var m_StateTypeE : EExplorationStateType;
public var m_UpdatesWhileInactiveB : Bool;
protected var m_ExplorationO : CExplorationStateManager;
private var m_LockedB : Bool;
private var m_ActiveB : Bool;
private var m_StateNextN : CName;
protected var m_DefaultStateChangesArr : array<SDefaultStateTransition>;
protected editable var m_BehaviorNeedsConfirmB : Bool;
protected editable var m_BehaviorEventB : Bool;
protected editable var m_BehaviorEventEachFrameB : Bool;
protected editable var m_BehaviorEventN : CName;
protected editable var m_StateDefaultExitToN : CName;
protected editable var m_CanReactToCriticalStateB : Bool;
public editable var m_ChangeCamerasB : Bool;
protected editable var m_CameraKeepOldB : Bool;
protected editable inlined var m_CameraSetS : CCameraParametersSet;
public editable var m_InputContextE : EGameplayContextInput;
protected var m_ActionsToBlockEArr : array<EInputActionBlock>;
protected var m_ActionsToBlockCountI : Int32;
protected var m_HolsterIsFastB : Bool;
private var m_CanSaveB : Bool;
public final function Initialize(_Exploration : CExplorationStateManager
){
m_ExplorationO = _Exploration;
InitializeSpecific(_Exploration);
AddAnimEventCallbacks();
if (m_BehaviorEventB && !IsNameValid(m_BehaviorEventN)){
m_BehaviorEventN = m_StateNameN;
}
if (!IsNameValid(m_StateDefaultExitToN)){
m_StateDefaultExitToN = m_ExplorationO.GetDefaultStateNa
me();
}
if (m_CameraSetS){
if (!IsNameValid(m_CameraSetS.pivotPositionControllerNam
e)){
m_CameraSetS.pivotPositionControllerName = m_Exp
lorationO.m_DefaultCameraSetS.pivotPositionControllerName;
}
if (!IsNameValid(m_CameraSetS.pivotRotationController)){
m_CameraSetS.pivotRotationController = m_Explora
tionO.m_DefaultCameraSetS.pivotRotationController;
}
if (!IsNameValid(m_CameraSetS.pivotDistanceController)){
m_CameraSetS.pivotDistanceController = m_Explora
tionO.m_DefaultCameraSetS.pivotDistanceController;
}
}
m_ActionsToBlockEArr.Clear();
AddActionsToBlock();
if (m_BehaviorNeedsConfirmB && m_BehaviorEventEachFrameB){
LogExplorationError("You can't Require confirmation if y
ou are sending the event each frame: m_BehaviorNeedsConfirmB && m_BehaviorEventE
achFrameB");
}
LogExploration("Initialized : " + GetStateName());
/* NOP */;
}

protected function InitializeSpecific(_Exploration : CExplorationStateMa


nager){
LogExplorationError(super.GetStateName() + ": Missing function I
nitializeSpecific");
/* NOP */;
}
public function PostInitialize(){
AddDefaultStateChangesSpecific();
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
LogExplorationError(super.GetStateName() + ": Missing function A
ddDefaultStateChangesSpecific");
/* NOP */;
}
protected function AddStateToTheDefaultChangeList(stateName : CName, tim
eToStartChecking : Float){
var automaticTransition : SDefaultStateTransition;
if (!m_ExplorationO.StateExistsB(stateName)){
LogExplorationError(super.GetStateName() + ": State chan
ge : " + stateName + " Does not exist");
return;
}
automaticTransition.m_StateNameN = stateName;
automaticTransition.m_TimeToStartCheckingF = timeToStartChecking
;
m_DefaultStateChangesArr.PushBack(automaticTransition);
/* NOP */;
}
protected function AddActionsToBlock(){
m_ActionsToBlockEArr.Clear();
/* NOP */;
}
protected function AddActionToBlock(action : EInputActionBlock){
m_ActionsToBlockEArr.PushBack(action);
/* NOP */;
}
protected function BlockActions(){
var i : Int32;
m_ActionsToBlockCountI = m_ActionsToBlockEArr.Size();
if (thePlayer){
i = 0;
while (i < m_ActionsToBlockCountI){
thePlayer.BlockAction(m_ActionsToBlockEArr[i], m
_StateNameN, /* NOP */, /* NOP */, /* NOP */);
i += 1;
}
}
/* NOP */;
}
private function UnlockallActions(){
var i : Int32;
if (thePlayer){
i = 0;
while (i < m_ActionsToBlockCountI){
thePlayer.UnblockAction(m_ActionsToBlockEArr[i],
m_StateNameN);
i += 1;
}
}

/* NOP */;
}
public final function Restart(){
m_ActiveB = false;
/* NOP */;
}
public function StateWantsToEnter() : Bool{
LogExplorationError(super.GetStateName() + ": Missing function S
tateWantsToEnter");
return false;
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
LogExplorationError(super.GetStateName() + ": Missing function S
tateCanEnter");
DebugBreak();
return false;
/* NOP */;
}
public final function StateEnter(prevStateName : CName){
m_StateNextN = GetStateName();
m_ActiveB = true;
LogExploration("----------------------------------------------------------------------------");
LogExploration(GetStateName() + ": StateEnter");
StateEnterSpecific(prevStateName);
/* NOP */;
}
protected function StateEnterSpecific(prevStateName : CName){
LogExplorationError(super.GetStateName() + ": Missing function S
tateEnterSpecific");
/* NOP */;
}
protected function AddAnimEventCallbacks(){
}
public function StateEnterConfirmed(){
if (m_BehaviorNeedsConfirmB){
StateEnterConfirmedSpecific();
}
/* NOP */;
}
public function StateEnterConfirmedSpecific(){
}
public function StateChangePrecheck() : CName{
var i : Int32;
var max : Int32;
var time : Float;
time = m_ExplorationO.GetStateTimeF();
max = m_DefaultStateChangesArr.Size();
i = 0;
while (i < max){
if (time > m_DefaultStateChangesArr[i].m_TimeToStartChec
kingF){
if (m_ExplorationO.StateWantsAndCanEnter(m_Defau
ltStateChangesArr[i].m_StateNameN)){
return m_DefaultStateChangesArr[i].m_Sta
teNameN;
}
}
i += 1;

}
if (m_StateNextN != super.GetStateName() && m_ExplorationO.CanCh
angeBetwenStates(super.GetStateName(), m_StateNextN)){
return m_StateNextN;
}
return super.GetStateName();
/* NOP */;
}
public function SetReadyToChangeTo(_NewStateN : CName){
m_StateNextN = _NewStateN;
/* NOP */;
}
public function HasQueuedState() : Bool{
return m_StateNextN != super.GetStateName();
/* NOP */;
}
public function IsThisStatequeued(_StateN : CName) : Bool{
return m_StateNextN == _StateN;
/* NOP */;
}
public function GetQueuedState() : CName{
return m_StateNextN;
/* NOP */;
}
public function StateUpdate(_Dt : Float){
var l_BehaviorEventN : CName;
StateUpdateSpecific(_Dt);
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
LogExplorationError(super.GetStateName() + ": Missing function S
tateUpdate");
DebugBreak();
/* NOP */;
}
public function StateUpdateInactive(_Dt : Float){
}
public final function StateExit(nextStateName : CName){
LogExploration(GetStateName() + ": StateExit. Took " + m_Explora
tionO.GetStateTimeF() + " seconds.");
UnlockallActions();
StateExitSpecific(nextStateName);
m_ExplorationO.StateExited();
m_ActiveB = false;
/* NOP */;
}
protected function StateExitSpecific(nextStateName : CName){
LogExplorationError(super.GetStateName() + ": Missing function S
tateExit");
/* NOP */;
}
protected function RemoveAnimEventCallbacks(){
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
}
public function ReactToHitGround() : Bool{
return false;
/* NOP */;
}

public function ReactToLoseGround() : Bool{


return false;
/* NOP */;
}
public function ReactToHitCeiling() : Bool{
return false;
/* NOP */;
}
public function ReactToSlide() : Bool{
return false;
/* NOP */;
}
public function ReactToBeingHit() : Bool{
return false;
/* NOP */;
}
public function ReactToChanceToFallAndSlide() : Bool{
return false;
/* NOP */;
}
public function ReactToCriticalState(enabled : Bool) : Bool{
return false;
/* NOP */;
}
public function OnBehGraphNodeEntered(){
}
public function OnBehGraphNodeExited(){
}
public final function GetStateName() : CName{
return m_StateNameN;
/* NOP */;
}
public final function GetStateType() : EExplorationStateType{
return m_StateTypeE;
/* NOP */;
}
public function NeedsBehaviorConfirmation() : Bool{
return m_BehaviorNeedsConfirmB;
/* NOP */;
}
public final function IsRaisingBehaviorEvent() : Bool{
return m_BehaviorEventB;
/* NOP */;
}
public final function IsRaisingBehaviorEventEachFrame() : Bool{
return m_BehaviorEventEachFrameB;
/* NOP */;
}
public function GetBehaviorEventName() : CName{
return m_BehaviorEventN;
/* NOP */;
}
public function GetBehaviorIsEventForced(fromState : CName) : Bool{
return false;
/* NOP */;
}
public function IsHolsterFast() : Bool{
return m_HolsterIsFastB;
/* NOP */;
}

public function GetStateToExitToAfterFailing() : CName{


return m_StateDefaultExitToN;
/* NOP */;
}
public function GetDebugText() : String{
return "";
/* NOP */;
}
public function GetDebugTextInactive() : String{
return "";
/* NOP */;
}
public function GetCameraSet(cameraSet : CCameraParametersSet) : Bool{
if (m_CameraSetS){
cameraSet = m_CameraSetS;
return true;
}
return false;
/* NOP */;
}
public function CameraChangesRotationController() : Bool{
if (IsNameValid(m_CameraSetS.pivotRotationController)){
if (m_CameraSetS.pivotRotationController != m_Exploratio
nO.m_DefaultCameraSetS.pivotRotationController){
return true;
}
}
return false;
/* NOP */;
}
public function GetIfCameraIsKept() : Bool{
return m_CameraKeepOldB;
/* NOP */;
}
public function UpdateCameraIfNeeded(moveData : SCameraMovementData, dt
: Float) : Bool{
return false;
/* NOP */;
}
public final function IsActiveState() : Bool{
return m_ActiveB;
/* NOP */;
}
public function CanInteract() : Bool{
LogExplorationError(super.GetStateName() + ": Missing function C
anInteract");
DebugBreak();
return false;
/* NOP */;
}
protected function SetCanSave(canSave : Bool){
m_CanSaveB = canSave;
/* NOP */;
}
public function GetCanSave() : Bool{
return m_CanSaveB;
/* NOP */;
}
public function CanReactToHardCriticalState() : Bool{
return m_CanReactToCriticalStateB;

/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, active : Bool) : Bool{
return true;
/* NOP */;
}
}
class CExplorationStateTransitionAbstract extends CExplorationStateAbstract{
protected editable var m_TransitionOriginStateN : CName;
protected editable var m_TransitionEndStateN : CName;
public function IsMachForThisStates(_FromN : CName, _ToN : CName) : Bool
{
if (IsNameValid(m_TransitionOriginStateN) && _FromN != m_Transit
ionOriginStateN){
return false;
}
if (IsNameValid(m_TransitionEndStateN) && _ToN != m_TransitionEn
dStateN){
return false;
}
return _FromN == m_TransitionOriginStateN && m_TransitionEndStat
eN == _ToN;
/* NOP */;
}
}
import abstract class SSwfFontDesc{
}
struct SInputActionLock{
saved var sourceName : CName;
saved var removedOnSpawn : Bool;
saved var isFromQuest : Bool;
saved var isFromPlace : Bool;
}
import abstract class CSwfTexture{
}
import abstract class STerrainTextureParameters{
}
import abstract class CVegetationBrush{
}
import abstract class CClipMapCookedData{
}
import struct CWorld{
import public final function ShowLayerGroup(layerGroupName : String);
import public final function HideLayerGroup(layerGroupName : String);
import public final function PointProjectionTest(point : Vector, normal
: EulerAngles, range : Float) : Bool;
import public final function StaticTrace(pointA : Vector, pointB : Vecto
r, position : Vector, normal : Vector, collisionGroupsNames : array<CName>) : Bo
ol;
import public final function StaticTraceWithAdditionalInfo(pointA : Vect
or, pointB : Vector, position : Vector, normal : Vector, material : CName, compo

nent : CComponent, collisionGroupsNames : array<CName>) : Bool;


import public final function GetWaterLevel(point : Vector, dontUseApprox
imation : Bool) : Float;
import public final function GetWaterDepth(point : Vector, dontUseApprox
imation : Bool) : Float;
import public final function GetWaterTangent(point : Vector, direction :
Vector, resolution : Float) : Vector;
import public final function SweepTest(pointA : Vector, pointB : Vector,
radius : Float, position : Vector, normal : Vector, collisionGroupsNames : arra
y<CName>) : Bool;
import public final function SphereOverlapTest(entities : array<CEntity>
, position : Vector, radius : Float, collisionGroupsNames : array<CName>) : Int3
2;
import public final function NavigationLineTest(pos1 : Vector, pos2 : Ve
ctor, radius : Float, ignoreObstacles : Bool, noEndpointZ : Bool) : Bool;
import public final function NavigationCircleTest(position : Vector, rad
ius : Float, ignoreObstacles : Bool) : Bool;
import public final function NavigationClosestObstacleToLine(pos1 : Vect
or, pos2 : Vector, radius : Float, closestPointOnLine : Vector, closestPointOnGe
ometry : Vector, ignoreObstacles : Bool) : Float;
import public final function NavigationClosestObstacleToCircle(position
: Vector, radius : Float, closestPointOnGeometry : Vector, ignoreObstacles : Boo
l) : Float;
import public final function NavigationClearLineInDirection(pos1 : Vecto
r, pos2 : Vector, radius : Float, closestPointOnLine : Vector) : Bool;
import public final function NavigationFindSafeSpot(position : Vector, p
ersonalSpace : Float, searchRadius : Float, outSafeSpot : Vector) : Bool;
import public final function NavigationComputeZ(position : Vector, zMin
: Float, zMax : Float, z : Float) : Bool;
import public final function PhysicsCorrectZ(position : Vector, z : Floa
t) : Bool;
import public final function GetDepotPath() : String;
import public final function ForceGraphicalLOD(lodLevel : Int32);
import public final function GetTerrainParameters(terrainSize : Float, t
ilesCount : Int32) : Bool;
import public final function GetTraceManager() : CScriptBatchQueryAccess
or;
public function OnWeatherChange() : Bool{
if (thePlayer){
thePlayer.OnWeatherChanged();
}
/* NOP */;
}
}
import abstract class SWorldDescription{
}
import abstract class SSimplexTreeStruct{
}
import abstract class INormalBlendDataSource{
}
import abstract class CSRTBaseTree{
}
import abstract class CVegetationBrushEntry{
}

import abstract class CGrassCellMask{


}
import abstract class CCurveComponent{
}
import abstract class CCurveControlPointEntity{
}
import struct CHeadManagerComponent{
import public final function
import public final function
import public final function
2);
import public final function
import public final function
import public final function
import public final function
import public final function
}

SetTattoo(hasTattoo : Bool);
Shave();
SetBeardStage(maxStage : Bool, stage : Int3
SetCustomHead(head : CName);
RemoveCustomHead();
BlockGrowing(block : Bool);
MimicTest(animName : CName);
GetCurHeadName() : CName;

import abstract class SSwitchableFoliageEntry{


}
import abstract class CSwitchableFoliageResource{
}
import abstract class SEntityWeight{
}
import abstract class IAnimationBuffer{
}
import struct CStoryScene{
import public final function GetRequiredPositionTags() : array<CName>;
}
import statemachine struct CPlayer{
private var _DEBUGDisplayRadiusMinimapIcons : Bool;
private var debug_BIsInputAllowedLocks : array<CName>;
public const var ENTER_SWIMMING_WATER_LEVEL : Float;
public var useSprintingCameraAnim : Bool;
public var oTCameraOffset : Float;
public var oTCameraPitchOffset : Float;
public var bIsRollAllowed : Bool;
protected var bIsInCombatAction : Bool;
protected var bIsInCombatActionFriendly : Bool;
private var bIsInputAllowed : Bool;
public var bIsFirstAttackInCombo : Bool;
protected var bIsInHitAnim : Bool;
public editable var FarZoneDistMax : Float;
public editable var DangerZoneDistMax : Float;
private var commentaryCooldown : Float;
private var commentaryLastTime : EngineTime;
private var canPlaySpecificVoiceset : Bool;
public var isHorseMounted : Bool;
public var isCompanionFollowing : Bool;
public var bStartScreenIsOpened : Bool;
public var bEndScreenIsOpened : Bool;
public var fStartScreenFadeDuration : Float;

public var bStartScreenEndWithBlackScreen : Bool;


public var fStartScreenFadeInDuration : Float;
public const var DEATH_SCREEN_OPEN_DELAY : Float;
public var bLAxisReleased : Bool;
public var bRAxisReleased : Bool;
private var bUITakesInput : Bool;
protected saved var inputHandler : CPlayerInput;
public var sprintActionPressed : Bool;
private var inputModuleNeededToRun : Float;
private var bInteractionPressed : Bool;
public var rawPlayerSpeed : Float;
public var rawPlayerAngle : Float;
public var rawPlayerHeading : Float;
public var cachedRawPlayerHeading : Float;
public var cachedCombatActionHeading : Float;
public var canResetCachedCombatActionHeading : Bool;
protected var combatActionHeading : Float;
public var rawCameraHeading : Float;
private var isSprinting : Bool;
protected var isRunning : Bool;
protected var isWalking : Bool;
public var playerMoveType : EPlayerMoveType;
private var sprintingTime : Float;
private var walkToggle : Bool;
private var sprintToggle : Bool;
public var moveTarget : CActor;
public var nonActorTarget : CGameplayEntity;
public var tempLookAtTarget : CGameplayEntity;
public var lockTargetSelectionHeading : Float;
protected var rawLeftJoyRot : Float;
protected var rawRightJoyRot : Float;
protected var rawLeftJoyVec : Vector;
protected var rawRightJoyVec : Vector;
protected var prevRawLeftJoyVec : Vector;
protected var prevRawRightJoyVec : Vector;
protected var lastValidLeftJoyVec : Vector;
protected var lastValidRightJoyVec : Vector;
public var allowStopRunCheck : Bool;
public var moveTargetDampValue : Float;
public var interiorCamera : Bool;
public var movementLockType : EPlayerMovementLockType;
public var scriptedCombatCamera : Bool;
public var modifyPlayerSpeed : Bool;
public var inv : CInventoryComponent;
public saved var equipmentSlotHistory : array<SItemUniqueId>;
private var currentTrackedQuestSystemObjectives : array<SJournalQuestObj
ectiveData>;
private var currentTrackedQuestObjectives : array<SJournalQuestObjective
Data>;
private var currentTrackedQuestGUID : CGUID;
private var HAXNewObjTable : array<CGUID>;
public var handAimPitch : Float;
private saved var vehicleCachedSign : ESignType;
public editable var softLockDist : Float;
public editable var softLockFrameSize : Float;
public var findMoveTargetDist : Float;
public var softLockDistVehicle : Float;
private var bBIsLockedToTarget : Bool;
private var bActorIsLockedToTarget : Bool;
private var bIsHardLockedTotarget : Bool;

private var terrTypeOne : ETerrainType;


private var terrTypeTwo : ETerrainType;
private var terrModifier : Float;
private var prevTerrType : ETerrainType;
protected var currentlyUsedItem : W3UsableItem;
protected var currentlyEquipedItem : SItemUniqueId;
protected var currentlyUsedItemL : W3UsableItem;
public saved var currentlyEquipedItemL : SItemUniqueId;
protected var isUsableItemBlocked : Bool;
protected var isUsableItemLtransitionAllowed : Bool;
protected var playerActionToRestore : EPlayerActionToRestore;
public saved var teleportedOnBoatToOtherHUB : Bool;
public var isAdaptiveBalance : Bool;
private var inputHeadingReady : Bool;
public var lastAxisInputIsMovement : Bool;
private var bRAxisReleasedLastFrame : Bool;
private var selectTargetTime : Float;
private var swipeMouseTimeStamp : Float;
private var swipeMouseDir : Vector;
private var swipeMouseDist : Float;
private var enableSwipeCheck : Bool;
public var lAxisReleasedAfterCounter : Bool;
public var lAxisReleaseCounterEnabled : Bool;
public var lAxisReleasedAfterCounterNoCA : Bool;
public var lAxisReleaseCounterEnabledNoCA : Bool;
private var sprintButtonPressedTimestamp : Float;
public var sprintingCamera : Bool;
public var runningCamera : Bool;
public var disableSprintingTimerEnabled : Bool;
private var illusionMedallion : array<SItemUniqueId>;
//NULL type for isMovable
import public final function LockButtonInteractions(channel : Int32);
import public final function UnlockButtonInteractions(channel : Int32);
import public final function GetActiveExplorationEntity() : CEntity;
public function IsAdaptiveBalance() : Bool{
return isAdaptiveBalance;
/* NOP */;
}
public function SetAdaptiveBalance(val : Bool){
/* NOP */;
isAdaptiveBalance = val;
/* NOP */;
}
public function SetTeleportedOnBoatToOtherHUB(val : Bool){
teleportedOnBoatToOtherHUB = val;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var conf : Int32;
inv = GetInventory();
super.OnSpawned(spawnData);
RegisterCollisionEventsListener();
AddTimer('PlayerTick', 0.000000, true, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
InitializeParryType();
SetCanPlayHitAnim(true);
if (inv){
inv.Created();
}
if (!spawnData.restored){

inputHandler = new CPlayerInput in this;


}
inputHandler.Initialize(spawnData.restored, /* NOP */);
if (!IsNameValid(GetCurrentStateName())){
GotoStateAuto();
}
isRunning = false;
SetIsWalking(false);
EnableBroadcastPresence(true);
AddAnimEventCallback('EquipItem', 'OnAnimEvent_QuickSlotItems');
AddAnimEventCallback('UseItem', 'OnAnimEvent_QuickSlotItems');
AddAnimEventCallback('HideItem', 'OnAnimEvent_QuickSlotItems');
AddAnimEventCallback('EquipItemL', 'OnAnimEvent_QuickSlotItems')
;
AddAnimEventCallback('UseItemL', 'OnAnimEvent_QuickSlotItems');
AddAnimEventCallback('HideItemL', 'OnAnimEvent_QuickSlotItems');
AddAnimEventCallback('AllowInput', 'OnAnimEvent_AllowInput');
AddAnimEventCallback('DisallowInput', 'OnAnimEvent_DisallowInput
');
AddAnimEventCallback('DisallowHitAnim', 'OnAnimEvent_DisallowHit
Anim');
AddAnimEventCallback('AllowHitAnim', 'OnAnimEvent_AllowHitAnim')
;
AddAnimEventCallback('SetRagdoll', 'OnAnimEvent_SetRagdoll');
AddAnimEventCallback('InAirKDCheck', 'OnAnimEvent_InAirKDCheck')
;
AddAnimEventCallback('EquipMedallion', 'OnAnimEvent_EquipMedalli
on');
AddAnimEventCallback('HideMedallion', 'OnAnimEvent_HideMedallion
');
ResumeEffects(2, 'Sprint');
/* NOP */;
}
public function Debug_ResetInput(){
inputHandler = new CPlayerInput in this;
inputHandler.Initialize(false, /* NOP */);
/* NOP */;
}
public function GetTutorialInputHandler() : W3PlayerTutorialInput{
return (W3PlayerTutorialInput)inputHandler;
/* NOP */;
}
public function BlockAction(action : EInputActionBlock, sourceName : CNa
me, keepOnSpawn : Bool, isFromQuest : Bool, isFromPlace : Bool) : Bool{
if (inputHandler){
inputHandler.BlockAction(action, sourceName, true, keepO
nSpawn, this, isFromQuest, isFromPlace);
return true;
}
return false;
/* NOP */;
}
public function UnblockAction(action : EInputActionBlock, sourceName : C
Name) : Bool{
if (inputHandler){
inputHandler.BlockAction(action, sourceName, false, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
return false;

/* NOP */;
}
public final function TutorialForceUnblockRadial() : array<SInputActionL
ock>{
var null : array<SInputActionLock>;
if (inputHandler){
return inputHandler.TutorialForceUnblockRadial();
}
return null;
/* NOP */;
}
public final function TutorialForceRestoreRadialLocks(radialLocks : arra
y<SInputActionLock>){
if (inputHandler){
inputHandler.TutorialForceRestoreRadialLocks(radialLocks
);
}
/* NOP */;
}
public function GetActionLocks(action : EInputActionBlock) : array<SInpu
tActionLock>{
return inputHandler.GetActionLocks(action);
/* NOP */;
}
public function GetAllActionLocks() : array<array<SInputActionLock>>{
return inputHandler.GetAllActionLocks();
/* NOP */;
}
public function IsActionAllowed(action : EInputActionBlock) : Bool{
if (inputHandler){
return inputHandler.IsActionAllowed(action);
}
return true;
/* NOP */;
}
public function IsActionBlockedBy(action : EInputActionBlock, sourceName
: CName) : Bool{
if (inputHandler){
return inputHandler.IsActionBlockedBy(action, sourceName
);
}
return false;
/* NOP */;
}
public function IsWeaponActionAllowed(weapon : EPlayerWeapon) : Bool{
if (inputHandler){
if (weapon == 3){
return inputHandler.IsActionAllowed(8);
} else {
return inputHandler.IsActionAllowed(1);
}
}
return true;
/* NOP */;
}
public function BlockAllActions(sourceName : CName, lock : Bool, excepti
ons : array<EInputActionBlock>, exceptUI : Bool, saveLock : Bool, onSpawnedNullP
ointerHackFix : CPlayer, isFromPlace : Bool){
if (inputHandler){
if (exceptUI){

exceptions.PushBack(2);
exceptions.PushBack(41);
exceptions.PushBack(5);
exceptions.PushBack(15);
exceptions.PushBack(16);
exceptions.PushBack(17);
exceptions.PushBack(18);
}
inputHandler.BlockAllActions(sourceName, lock, exception
s, saveLock, onSpawnedNullPointerHackFix, false, isFromPlace);
}
if (lock){
}
/* NOP */;
}
public final function BlockAllQuestActions(sourceName : CName, lock : Bo
ol){
inputHandler.BlockAllQuestActions(sourceName, lock);
/* NOP */;
}
public function BlockAllUIQuestActions(sourceName : CName, lock : Bool){
inputHandler.BlockAllUIQuestActions(sourceName, lock);
/* NOP */;
}
public function GetInputHandler() : CPlayerInput{
return inputHandler;
/* NOP */;
}
public function CheatGod2(on : Bool){
if (on){
SetImmortalityMode(1, 1, true);
} else {
SetImmortalityMode(0, 1, true);
}
StaminaBoyInternal(on);
/* NOP */;
}
public function IsInCombatState() : Bool{
var stateName : CName;
stateName = thePlayer.GetCurrentStateName();
if (stateName == 'Combat' || stateName == 'CombatSteel' || state
Name == 'CombatSilver' || stateName == 'CombatFists'){
return true;
}
return false;
/* NOP */;
}
public function DisableCombatState(){
if (IsInCombatState()){
GotoState('Exploration', /* NOP */, /* NOP */);
}
/* NOP */;
}
protected function SetAbilityManager(){
abilityManager = new W3PlayerAbilityManager in this;
/* NOP */;
}
public function OnDamageFromBoids(damage : Float) : Bool{
var damageAction : W3DamageAction;
damageAction = new W3DamageAction in theGame.damageMgr;

damageAction.Initialize(NULL, this, NULL, 'boid', 0, 0, false, f


alse, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
damageAction.AddDamage(theGame.params.DAMAGE_NAME_PHYSICAL, 6.00
0000);
damageAction.SetHitAnimationPlayType(2);
damageAction.SetSuppressHitSounds(true);
/* NOP */;
theGame.damageMgr.ProcessAction(damageAction);
delete damageAction;
/* NOP */;
}
public function InitializeParryType(){
var i : Int32;
var j : Int32;
parryTypeTable.Resize(EnumGetMax('EAttackSwingType') + 1);
i = 0;
while (i < EnumGetMax('EAttackSwingType') + 1){
parryTypeTable[i].Resize(EnumGetMax('EAttackSwingDirecti
on') + 1);
i += 1;
}
parryTypeTable[0][0] = 9;
parryTypeTable[0][1] = 9;
parryTypeTable[0][2] = 9;
parryTypeTable[0][3] = 9;
parryTypeTable[1][0] = 9;
parryTypeTable[1][1] = 9;
parryTypeTable[1][2] = 9;
parryTypeTable[1][3] = 9;
parryTypeTable[2][0] = 9;
parryTypeTable[2][1] = 9;
parryTypeTable[2][2] = 9;
parryTypeTable[2][3] = 9;
parryTypeTable[3][0] = 9;
parryTypeTable[3][1] = 9;
parryTypeTable[3][2] = 9;
parryTypeTable[3][3] = 9;
parryTypeTable[4][0] = 9;
parryTypeTable[4][1] = 9;
parryTypeTable[4][2] = 9;
parryTypeTable[4][3] = 9;
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
}
public timer function PlayerTick(optional deltaTime : Float, optional id
: Int32){
deltaTime = theTimer.timeDeltaUnscaled;
OnPlayerTickTimer(deltaTime);
if (!IsActionAllowed(14)){
movementLockType = 2;
} else if (!IsActionAllowed(26)){
movementLockType = 1;
} else {
movementLockType = 0;
}
/* NOP */;
}
public function IsLookInputIgnored() : Bool{
return false;

/* NOP */;
}
public function SetInputHeadingReady(flag : Bool){
inputHeadingReady = flag;
/* NOP */;
}
public function IsInputHeadingReady() : Bool{
return inputHeadingReady;
/* NOP */;
}
public function HandleMovement(deltaTime : Float){
var leftStickVector : Vector;
var rightStickVector : Vector;
var rawLengthL : Float;
var rawLengthR : Float;
var len : Float;
var i : Int32;
prevRawLeftJoyVec = rawLeftJoyVec;
prevRawRightJoyVec = rawRightJoyVec;
rawLeftJoyVec.X = theInput.GetActionValue('GI_AxisLeftX');
rawLeftJoyVec.Y = theInput.GetActionValue('GI_AxisLeftY');
if (thePlayer.IsPCModeEnabled()){
rawRightJoyVec.X = theInput.GetActionValue('GI_MouseDamp
X');
rawRightJoyVec.Y = theInput.GetActionValue('GI_MouseDamp
Y');
} else {
rawRightJoyVec.X = theInput.GetActionValue('GI_AxisRight
X');
rawRightJoyVec.Y = theInput.GetActionValue('GI_AxisRight
Y');
}
leftStickVector = rawLeftJoyVec;
rightStickVector = rawRightJoyVec;
if (VecDot2D(prevRawLeftJoyVec, leftStickVector) < 0.000000){
leftStickVector = lastValidLeftJoyVec;
} else {
lastValidLeftJoyVec = leftStickVector;
}
if (VecDot2D(prevRawRightJoyVec, rightStickVector) < 0.000000){
rightStickVector = lastValidRightJoyVec;
} else {
lastValidRightJoyVec = rightStickVector;
}
rawLengthL = VecLength(leftStickVector);
rawLengthR = VecLength(rightStickVector);
SetBehaviorVariable('lAxisLength', ClampF(rawLengthL, 0.000000,
1.000000), /* NOP */);
rawLeftJoyRot = VecHeading(leftStickVector);
rawRightJoyRot = VecHeading(rightStickVector);
if (rawLengthL > 0){
bLAxisReleased = false;
if (isSprinting){
if (rawLengthL > 0.600000){
rawPlayerSpeed = 1.300000;
allowStopRunCheck = true;
RemoveTimer('StopRunDelayedInputCheck',
/* NOP */);
} else if (allowStopRunCheck){
allowStopRunCheck = false;

AddTimer('StopRunDelayedInputCheck', 0.2
50000, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else if (GetCurrentStateName() == 'Exploration'){
rawPlayerSpeed = 0.900000 * rawLengthL;
} else if (rawLengthL > 0.600000){
rawPlayerSpeed = 0.800000;
} else {
rawPlayerSpeed = 0.400000;
}
} else {
if (isSprinting){
if (allowStopRunCheck){
allowStopRunCheck = false;
AddTimer('StopRunDelayedInputCheck', 0.2
50000, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
rawPlayerSpeed = 0.000000;
}
bLAxisReleased = true;
}
if (rawLengthR > 0){
bRAxisReleased = false;
} else {
bRAxisReleased = true;
}
ProcessLAxisCaching();
SetBehaviorVariable('moveSpeedWhileCasting', rawPlayerSpeed, /*
NOP */);
if (rawPlayerSpeed > 0.000000){
rawPlayerHeading = AngleDistance(theCamera.GetCameraHead
ing(), -rawLeftJoyRot);
if (rawPlayerSpeed > 0.100000){
cachedRawPlayerHeading = rawPlayerHeading;
}
if (IsInCombatAction()){
canResetCachedCombatActionHeading = false;
cachedCombatActionHeading = cachedRawPlayerHeadi
ng;
}
}
rawPlayerAngle = AngleDistance(rawPlayerHeading, GetHeading());
if (!ProcessLockTargetSelectionInput(rightStickVector, rawLength
R)){
ProcessLockTargetSelectionInput(rightStickVector, rawLen
gthR);
}
/* NOP */;
}
protected function ProcessLAxisCaching(){
if (bLAxisReleased){
if (GetBIsCombatActionAllowed()){
if (!lAxisReleaseCounterEnabled){
lAxisReleaseCounterEnabled = true;
AddTimer('LAxisReleaseCounter', 0.250000
, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
if (!lAxisReleaseCounterEnabledNoCA){

lAxisReleaseCounterEnabledNoCA = true;
AddTimer('LAxisReleaseCounterNoCA', 0.200000, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (!bRAxisReleased){
if (thePlayer.IsPCModeEnabled()){
if (lAxisReleasedAfterCounter){
lastAxisInputIsMovement = false;
}
} else {
lastAxisInputIsMovement = false;
}
}
} else {
lAxisReleasedAfterCounter = false;
lAxisReleasedAfterCounterNoCA = false;
RemoveTimer('LAxisReleaseCounter', /* NOP */);
RemoveTimer('LAxisReleaseCounterNoCA', /* NOP */);
lAxisReleaseCounterEnabled = false;
lAxisReleaseCounterEnabledNoCA = false;
lastAxisInputIsMovement = true;
}
/* NOP */;
}
public function ResetLastAxisInputIsMovement(){
lastAxisInputIsMovement = true;
/* NOP */;
}
protected function ProcessLockTargetSelectionInput(rightStickVector : Ve
ctor, rawLengthR : Float) : Bool{
var currTime : Float;
var rightStickVectorNormalized : Vector;
var dot : Float;
if (IsCameraLockedToTarget()){
currTime = theGame.GetEngineTimeAsSeconds();
if (thePlayer.IsPCModeEnabled()){
if (rawLengthR > 0.000000){
rightStickVectorNormalized = VecNormaliz
e(rightStickVector);
if (enableSwipeCheck){
enableSwipeCheck = false;
swipeMouseTimeStamp = currTime;
swipeMouseDir = rightStickVector
;
swipeMouseDist = 0.000000;
}
dot = VecDot(swipeMouseDir, rightStickVe
ctor);
if (dot > 0.800000){
swipeMouseDist += rawLengthR;
} else {
enableSwipeCheck = true;
return false;
}
swipeMouseDir = rightStickVector;
if (currTime > swipeMouseTimeStamp + 0.2
00000){
swipeMouseDist = 0.000000;
enableSwipeCheck = true;
}

} else {
swipeMouseDist = 0.000000;
enableSwipeCheck = true;
}
if (swipeMouseDist <= 350.000000){
return true;
} else {
rightStickVector = rightStickVectorNorma
lized;
rawLengthR = VecLength(rightStickVector)
;
}
}
if (bRAxisReleasedLastFrame){
if (rawLengthR >= 0.300000){
inputHandler.OnCbtSelectLockTarget(right
StickVector);
selectTargetTime = currTime;
}
} else if (rawLengthR >= 0.300000 && currTime > selectTa
rgetTime + 0.500000){
inputHandler.OnCbtSelectLockTarget(rightStickVec
tor);
selectTargetTime = currTime;
}
}
if (rawLengthR < 0.300000){
bRAxisReleasedLastFrame = true;
} else {
bRAxisReleasedLastFrame = false;
}
return true;
/* NOP */;
}
private timer function LAxisReleaseCounter(optional time : Float, option
al id : Int32){
if (bLAxisReleased){
lAxisReleasedAfterCounter = true;
}
/* NOP */;
}
private timer function LAxisReleaseCounterNoCA(optional time : Float, op
tional id : Int32){
if (bLAxisReleased){
lAxisReleasedAfterCounterNoCA = true;
}
/* NOP */;
}
public timer function StopRunDelayedInputCheck(optional time : Float, op
tional id : Int32){
allowStopRunCheck = true;
/* NOP */;
}
public function IsUITakeInput() : Bool{
return bUITakesInput;
/* NOP */;
}
public function SetUITakeInput(val : Bool){
bUITakesInput = val;
/* NOP */;

}
public function GetRawLeftJoyRot() : Float{
return rawLeftJoyRot;
/* NOP */;
}
public function SetIsActorLockedToTarget(flag : Bool){
bActorIsLockedToTarget = flag;
/* NOP */;
}
public function IsActorLockedToTarget() : Bool{
return bActorIsLockedToTarget;
/* NOP */;
}
public function SetIsCameraLockedToTarget(flag : Bool){
bBIsLockedToTarget = flag;
/* NOP */;
}
public function IsCameraLockedToTarget() : Bool{
return bBIsLockedToTarget;
/* NOP */;
}
public function IsLockedToTarget() : Bool{
return false;
/* NOP */;
}
public function EnableHardLock(flag : Bool){
if (!flag){
/* NOP */;
}
bIsHardLockedTotarget = flag;
/* NOP */;
}
public function IsHardLockEnabled() : Bool{
return bIsHardLockedTotarget;
/* NOP */;
}
public function EnableBroadcastPresence(enable : Bool){
if (enable){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(this, 'PlayerPresenceAction', -1.000000, 10.000000, 3.000000, -1, true
, /* NOP */, /* NOP */);
} else {
theGame.GetBehTreeReactionManager().RemoveReactionEvent(
this, 'PlayerPresenceAction');
}
/* NOP */;
}
public function RemoveReactions(){
theGame.GetBehTreeReactionManager().RemoveReactionEvent(this, 'D
rawSwordAction');
theGame.GetBehTreeReactionManager().RemoveReactionEvent(this, 'C
ombatNearbyAction');
theGame.GetBehTreeReactionManager().RemoveReactionEvent(this, 'A
ttackAction');
theGame.GetBehTreeReactionManager().RemoveReactionEvent(this, 'C
astSignAction');
EnableBroadcastPresence(false);
/* NOP */;
}
public function RestartReactionsIfNeeded(){

EnableBroadcastPresence(true);
/* NOP */;
}
public function OnBlockingSceneStarted(scene : CStoryScene) : Bool{
super.OnBlockingSceneStarted(scene);
ClearAttitudes(true, false, false);
RaiseForceEvent('ForceIdle');
RemoveReactions();
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'PlayerInScene', -1.000000, 60.000000, -1, -1, true, /* NOP */, /*
NOP */);
PushState('PlayerDialogScene');
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
var exceptions : array<EInputActionBlock>;
super.OnBlockingSceneEnded(output);
RestartReactionsIfNeeded();
exceptions.PushBack(6);
exceptions.PushBack(14);
exceptions.PushBack(26);
BlockAllActions('SceneEnded', true, exceptions, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
AddTimer('RemoveSceneEndedActionBlock', 1.000000, false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
private timer function RemoveSceneEndedActionBlock(optional dt : Float,
optional id : Int32){
BlockAllActions('SceneEnded', false, /* NOP */, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
if (!thePlayer.IsInCombat()){
thePlayer.SetPlayerCombatStance(0, /* NOP */);
}
/* NOP */;
}
public function SetDeathType(type : EPlayerDeathType){
SetBehaviorVariable('DeathType', type, /* NOP */);
/* NOP */;
}
public function ResetDeathType(){
SetDeathType(0);
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
var attacker : CGameplayEntity;
var hud : CR4ScriptedHud;
var radialModule : CR4HudModuleRadialMenu;
var depth : Float;
var guiManager : CR4GuiManager;
var allowDeath : Bool;
super.OnDeath(damageAction);
ClearAttitudes(true, false, false);
attacker = damageAction.attacker;
depth = (CMovingPhysicalAgentComponent)GetMovingAgentComponent()
.GetSubmergeDepth();
if ((W3ReplacerCiri)this){
allowDeath = true;
} else if (!IsUsingVehicle() && depth > -0.500000 && !IsSwimming
() && attacker && (CNewNPC)attacker.GetNPCType() == 3){

(CR4PlayerStateUnconscious)GetState('Unconscious').OnKil
ledByGuard();
PushState('Unconscious');
} else if (!IsUsingVehicle() && depth > -0.500000 && !IsSwimming
() && (W3Elevator)attacker){
(CR4PlayerStateUnconscious)GetState('Unconscious').OnKil
ledByElevator();
PushState('Unconscious');
} else if (!IsUsingVehicle() && depth > -0.500000 && !IsSwimming
() && WillBeUnconscious()){
PushState('Unconscious');
} else {
allowDeath = true;
}
if (allowDeath){
SetAlive(false);
if (IsUsingHorse(true) || IsUsingBoat()){
} else {
RaiseForceEvent('Death');
SetBehaviorVariable('Ragdoll_Weight', 1.000000,
/* NOP */);
}
theGame.FadeOutAsync(DEATH_SCREEN_OPEN_DELAY - 0.100000,
/* NOP */);
hud = (CR4ScriptedHud)theGame.GetHud();
guiManager = theGame.GetGuiManager();
if (guiManager && guiManager.IsAnyMenu()){
guiManager.GetRootMenu().CloseMenu();
}
if (hud){
hud.StartDeathTimer(DEATH_SCREEN_OPEN_DELAY);
} else {
AddTimer('OpenDeathScreen', DEATH_SCREEN_OPEN_DE
LAY, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (hud){
radialModule = (CR4HudModuleRadialMenu)hud.GetHu
dModule("RadialMenuModule");
if (radialModule && radialModule.IsRadialMenuOpe
ned()){
radialModule.HideRadialMenu();
}
}
theTelemetry.LogWithLabel(20, damageAction.attacker.ToSt
ring());
}
/* NOP */;
}
public function OnUnconsciousEnd() : Bool{
if (GetCurrentStateName() == 'Unconscious'){
GotoStateAuto();
}
/* NOP */;
}
public function OnDodgeBoost() : Bool{
}
public function StopRun(){
SetSprintActionPressed(false, true);
SetIsSprinting(false);
/* NOP */;

}
public function IsRunPressed() : Bool{
return true;
/* NOP */;
}
public function SetSprintActionPressed(enable : Bool, dontClearTimeStamp
: Bool){
sprintActionPressed = enable;
if (!dontClearTimeStamp){
sprintButtonPressedTimestamp = theGame.GetEngineTimeAsSe
conds();
}
/* NOP */;
}
public function GetHowLongSprintButtonWasPressed() : Float{
var duration : Float;
if (!sprintActionPressed || sprintButtonPressedTimestamp <= 0){
return -1;
}
duration = theGame.GetEngineTimeAsSeconds() - sprintButtonPresse
dTimestamp;
return duration;
/* NOP */;
}
public function SetIsSprinting(flag : Bool){
if (flag == isSprinting){
if (flag && disableSprintingTimerEnabled){
disableSprintingTimerEnabled = false;
RemoveTimer('DisableSprintingTimer', /* NOP */);
}
return;
}
if (flag){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(thePlayer, 'PlayerSprintAction', -1, 10.000000, 0.500000, -1, true, /*
NOP */, /* NOP */);
BreakPheromoneEffect();
RemoveTimer('DisableSprintingTimer', /* NOP */);
AddTimer('SprintingTimer', 0.010000, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
thePlayer.PauseEffects(2, 'Sprint', true, /* NOP */, /*
NOP */);
} else {
sprintingTime = 0.000000;
theGame.GetBehTreeReactionManager().RemoveReactionEvent(
thePlayer, 'PlayerSprintAction');
thePlayer.ResumeEffects(2, 'Sprint');
EnableSprintingCamera(false);
}
isSprinting = flag;
SetBehaviorVariable('isSprinting', isSprinting, /* NOP */);
/* NOP */;
}
public function EnableSprintingCamera(flag : Bool){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
var vel : Float;
if (!useSprintingCameraAnim){
return;
}

if (IsSwimming() || OnCheckDiving()){
flag = false;
}
camera = theGame.GetGameCamera();
if (flag){
vel = VecLength(GetMovingAgentComponent().GetVelocity())
;
if (!sprintingCamera && vel > 6.500000){
animation.animation = 'camera_shake_loop_lvl1_1'
;
animation.priority = 3;
animation.blendIn = 1.000000;
animation.blendOut = 1.000000;
animation.weight = 1.500000;
animation.speed = 1.000000;
animation.loop = true;
animation.additive = true;
animation.reset = true;
camera.PlayAnimation(animation);
sprintingCamera = true;
}
} else {
sprintingCamera = false;
camera.StopAnimation('camera_shake_loop_lvl1_1');
}
/* NOP */;
}
public function EnableRunCamera(flag : Bool){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
var vel : Float;
camera = theGame.GetGameCamera();
if (IsSwimming() || OnCheckDiving()){
flag = false;
}
if (flag){
animation.animation = 'camera_shake_loop_lvl1_5';
animation.priority = 3;
animation.blendIn = 1.000000;
animation.blendOut = 1.000000;
animation.weight = 0.700000;
animation.speed = 0.800000;
animation.loop = true;
animation.additive = true;
animation.reset = true;
camera.PlayAnimation(animation);
} else {
camera.StopAnimation('camera_shake_loop_lvl1_5');
}
runningCamera = flag;
/* NOP */;
}
protected timer function SprintingTimer(optional dt : Float, optional id
: Int32){
if (!thePlayer.modifyPlayerSpeed){
sprintingTime += dt;
if (ShouldDrainStaminaWhileSprinting()){
DrainStamina(9, 0, 0, 'None', dt, /* NOP */);
}
}

/* NOP */;
}
protected function ShouldDrainStaminaWhileSprinting() : Bool{
var currentStateName : CName;
if (sprintingTime >= 3.000000 || GetStaminaPercents() < 1.000000
){
currentStateName = GetCurrentStateName();
if (currentStateName == 'Exploration' || currentStateNam
e == 'CombatSteel' || currentStateName == 'CombatSilver' || currentStateName ==
'CombatFists'){
return true;
}
}
return false;
/* NOP */;
}
protected function ShouldUseStaminaWhileSprinting() : Bool{
return true;
/* NOP */;
}
public function GetIsSprinting() : Bool{
return isSprinting;
/* NOP */;
}
public function GetSprintingTime() : Float{
if (!GetIsSprinting()){
return 0.000000;
}
return sprintingTime;
/* NOP */;
}
public timer function DisableSprintingTimer(optional time : Float, optio
nal id : Int32){
disableSprintingTimerEnabled = false;
if (!thePlayer.CanSprint(VecLength(rawLeftJoyVec))){
thePlayer.RemoveTimer('SprintingTimer', /* NOP */);
thePlayer.SetIsSprinting(false);
}
/* NOP */;
}
public function IsSprintActionPressed() : Bool{
return theInput.IsActionPressed('Sprint') || sprintToggle;
/* NOP */;
}
public function SetSprintToggle(flag : Bool){
sprintToggle = flag;
/* NOP */;
}
public function GetIsSprintToggled() : Bool{
return sprintToggle;
/* NOP */;
}
public function SetWalkToggle(flag : Bool){
walkToggle = flag;
/* NOP */;
}
public function GetIsWalkToggled() : Bool{
return walkToggle;
/* NOP */;
}

public function GetIsRunning() : Bool{


return isRunning;
/* NOP */;
}
public function SetIsRunning(flag : Bool){
isRunning = flag;
/* NOP */;
}
public function GetIsWalking() : Bool{
return isWalking;
/* NOP */;
}
public function SetIsWalking(walking : Bool){
isWalking = walking;
/* NOP */;
}
public final function SetIsMovable(flag : Bool){
isMovable = flag;
/* NOP */;
}
public function SetManualControl(movement : Bool, camera : Bool){
if (movement == false){
RaiseForceEvent('Idle');
}
super.SetIsMovable(movement);
SetShowHud(movement);
/* NOP */;
}
public final function GetIsMovable() : Bool{
return isMovable && inputHandler.IsActionAllowed(6);
/* NOP */;
}
public function SetBInteractionPressed(flag : Bool){
bInteractionPressed = flag;
/* NOP */;
}
public function GetBInteractionPressed() : Bool{
return bInteractionPressed;
/* NOP */;
}
public function IsInCombatAction() : Bool{
return bIsInCombatAction;
/* NOP */;
}
public function IsInCombatActionFriendly() : Bool{
return bIsInCombatActionFriendly;
/* NOP */;
}
public function IsInCombatAction_SpecialAttack() : Bool{
return false;
/* NOP */;
}
public function SetBIsInCombatAction(flag : Bool){
if (flag){
}
bIsInCombatAction = flag;
SetBehaviorVariable('isInCombatActionForOverlay', bIsInCombatAct
ion, /* NOP */);
/* NOP */;
}

public function SetBIsInCombatActionFriendly(flag : Bool){


bIsInCombatActionFriendly = flag;
/* NOP */;
}
public function RaiseCombatActionFriendlyEvent() : Bool{
if (CanRaiseCombatActionFriendlyEvent(/* NOP */)){
if (RaiseEvent('CombatActionFriendly')){
SetBIsInCombatActionFriendly(true);
return true;
}
}
return false;
/* NOP */;
}
public function CanRaiseCombatActionFriendlyEvent(isShootingCrossbow : B
ool) : Bool{
var raiseEvent : Bool;
var playerWitcher : W3PlayerWitcher;
var itemId : SItemUniqueId;
raiseEvent = false;
playerWitcher = (W3PlayerWitcher)this;
if (!playerWitcher){
return true;
} else if (isShootingCrossbow){
return true;
} else if (thePlayer.IsOnBoat() && !thePlayer.IsCombatMusicEnabl
ed()){
return true;
} else {
itemId = thePlayer.GetSelectedItemId();
if (!playerWitcher.IsHoldingItemInLHand() && inv.IsIdVal
id(itemId) && !inv.IsItemCrossbow(itemId) && !inv.IsItemBomb(itemId)){
return true;
}
}
thePlayer.DisplayActionDisallowedHudMessage(28, /* NOP */, /* NO
P */, true, /* NOP */);
return false;
/* NOP */;
}
public final function CanParryAttack() : Bool{
return inputHandler.IsActionAllowed(25) && ParryCounterCheck() &
& !IsCurrentlyDodging() && CanParryAttack();
/* NOP */;
}
protected function ParryCounterCheck() : Bool{
var combatActionType : Int32;
combatActionType = GetBehaviorVariable('combatActionType', /* NO
P */);
if (combatActionType == 9){
return true;
}
if (GetBIsCombatActionAllowed()){
return true;
}
if (thePlayer.IsInCombatAction() && combatActionType == 2){
if (thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened
()){
return true;
}

}
return false;
/* NOP */;
}
public function SetIsHorseMounted(isOn : Bool){
isHorseMounted = isOn;
/* NOP */;
}
public function GetIsHorseMounted() : Bool{
return isHorseMounted;
/* NOP */;
}
public function SetIsCompanionFollowing(isOn : Bool){
isCompanionFollowing = isOn;
/* NOP */;
}
public function GetIsCompanionFollowing() : Bool{
return isCompanionFollowing;
/* NOP */;
}
public function SetStartScreenIsOpened(isOpened : Bool){
bStartScreenIsOpened = isOpened;
if (isOpened){
theSound.EnterGameState(15);
} else {
theSound.LeaveGameState(15);
}
/* NOP */;
}
public function GetStartScreenIsOpened() : Bool{
return bStartScreenIsOpened;
/* NOP */;
}
public function SetEndScreenIsOpened(isOpened : Bool){
bEndScreenIsOpened = isOpened;
if (isOpened){
theSound.EnterGameState(15);
} else {
theSound.LeaveGameState(15);
}
/* NOP */;
}
public function GetEndScreenIsOpened() : Bool{
return bEndScreenIsOpened;
/* NOP */;
}
public function SetStartScreenFadeDuration(fadeTime : Float){
fStartScreenFadeDuration = fadeTime;
/* NOP */;
}
public function GetStartScreenFadeDuration() : Float{
return fStartScreenFadeDuration;
/* NOP */;
}
public function SetStartScreenFadeInDuration(fadeTime : Float){
fStartScreenFadeInDuration = fadeTime;
/* NOP */;
}
public function GetStartScreenFadeInDuration() : Float{
return fStartScreenFadeInDuration;

/* NOP */;
}
public function SetStartScreenEndWithBlackScreen(value : Bool){
bStartScreenEndWithBlackScreen = value;
/* NOP */;
}
public function GetStartScreenEndWithBlackScreen() : Bool{
return bStartScreenEndWithBlackScreen;
/* NOP */;
}
public function CanStartTalk() : Bool{
var stateName : CName;
stateName = thePlayer.GetCurrentStateName();
return stateName != 'CombatSteel' && stateName != 'CombatSilver'
&& stateName != 'CombatFists';
/* NOP */;
}
public function UpdateRequestedDirectionVariables_PlayerDefault(){
UpdateRequestedDirectionVariables(rawPlayerHeading, GetHeading()
);
/* NOP */;
}
public function SetGuarded(flag : Bool){
super.SetGuarded(flag);
SetParryEnabled(IsGuarded());
if (!thePlayer.IsInCombat()){
if (flag){
OnDelayOrientationChange();
} else {
thePlayer.EnableManualCameraControl(true, 'Guard
');
}
}
/* NOP */;
}
public function OnDelayOrientationChange() : Bool{
}
public function SetBIsInputAllowed(flag : Bool, sourceName : CName){
bIsInputAllowed = flag;
if (flag){
debug_BIsInputAllowedLocks.Clear();
} else {
debug_BIsInputAllowedLocks.PushBack(sourceName);
}
/* NOP */;
}
public function GetBIsInputAllowed() : Bool{
return bIsInputAllowed;
/* NOP */;
}
public function SetBIsFirstAttackInCombo(flag : Bool){
bIsFirstAttackInCombo = flag;
/* NOP */;
}
public function IsInHitAnim() : Bool{
return bIsInHitAnim;
/* NOP */;
}
public function SetIsInHitAnim(flag : Bool){
bIsInHitAnim = flag;

/* NOP */;
}
public function SetInputModuleNeededToRun(_inputModuleNeededToRun : Floa
t){
inputModuleNeededToRun = ClampF(_inputModuleNeededToRun, 0.50000
0, 1.000000);
/* NOP */;
}
public function GetInputModuleNeededToRun() : Float{
var configValue : String;
if (inputModuleNeededToRun == -1.000000){
configValue = theGame.GetInGameConfigWrapper().GetVarVal
ue('Controls', 'LeftStickSensitivity');
inputModuleNeededToRun = StringToFloat(configValue, 0.70
0000);
}
return inputModuleNeededToRun;
/* NOP */;
}
public function OnAnimEvent_AllowInput(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){
SetBIsInputAllowed(true, 'AnimEventAllowInputStart');
}
/* NOP */;
}
public function OnAnimEvent_DisallowInput(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){
SetBIsInputAllowed(false, 'AnimEventDisallowInputStart')
;
} else if (animEventType == 3){
SetBIsInputAllowed(true, 'AnimEventDisallowInputEnd');
}
/* NOP */;
}
public function OnAnimEvent_DisallowHitAnim(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
SetCanPlayHitAnim(true);
} else if (GetBehaviorVariable('combatActionType', /* NOP */) ==
0 && !bIsFirstAttackInCombo || GetBehaviorVariable('combatActionType', /* NOP *
/) == 2 && GetBehaviorVariable('isRolling', /* NOP */) == 0.000000){
} else {
SetCanPlayHitAnim(false);
}
/* NOP */;
}
public function OnAnimEvent_AllowHitAnim(animEventName : CName, animEven
tType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetCanPlayHitAnim(true);
/* NOP */;
}
public function OnAnimEvent_AllowBlend(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetCanPlayHitAnim(true);
/* NOP */;
}
public function OnAnimEvent_QuickSlotItems(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{

var itemEntity : W3UsableItem;


if (animEventName == 'EquipItem' && currentlyUsedItem){
inv.MountItem(currentlyEquipedItem, true, /* NOP */);
} else if (animEventName == 'UseItem' && currentlyUsedItem){
currentlyUsedItem.OnUsed(this);
} else if (animEventName == 'HideItem'){
inv.UnmountItem(currentlyEquipedItem, true);
currentlyEquipedItem = GetInvalidUniqueId();
} else if (animEventName == 'EquipItemL'){
if (thePlayer.IsHoldingItemInLHand()){
inv.MountItem(currentlyEquipedItemL, true, /* NO
P */);
thePlayer.StartWaitForItemSpawnAndProccesTask();
}
} else if (animEventName == 'UseItemL' || animEventName == 'Item
UseL'){
thePlayer.AllowUseSelectedItem();
} else if (animEventName == 'HideItemL'){
thePlayer.KillWaitForItemSpawnAndProccesTask();
if (currentlyUsedItemL){
currentlyUsedItemL.OnHidden(this);
currentlyUsedItemL.SetVisibility(false);
}
inv.UnmountItem(currentlyEquipedItemL, true);
}
/* NOP */;
}
public function OnAnimEvent_SetRagdoll(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if ((CMovingPhysicalAgentComponent)GetMovingAgentComponent().Has
Ragdoll()){
if (this == thePlayer && !thePlayer.IsOnBoat()){
TurnOnRagdoll();
}
}
/* NOP */;
}
public function OnAnimEvent_InAirKDCheck(animEventName : CName, animEven
tType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (IsInAir()){
TurnOnRagdoll();
}
/* NOP */;
}
public function OnAnimEvent_EquipMedallion(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
illusionMedallion.Clear();
illusionMedallion = inv.GetItemsByName('Illusion Medallion');
inv.MountItem(illusionMedallion[0], true, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_HideMedallion(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
inv.UnmountItem(illusionMedallion[0], true);
illusionMedallion.Clear();
/* NOP */;
}
public function OnDiving(dir : Int32) : Bool{
}
public function OnDive() : Bool{

}
public function OnCheckDiving() : Bool{
return false;
/* NOP */;
}
public function OnAllowShallowWaterCheck() : Bool{
return true;
/* NOP */;
}
public function OnCheckUnconscious() : Bool{
return false;
/* NOP */;
}
public function OnAllowSwimmingSprint() : Bool{
return false;
/* NOP */;
}
public function OnAllowedDiveDown() : Bool{
return true;
/* NOP */;
}
public function OnDiveInput(divePitch : Float) : Bool{
}
public function OnIsCameraUnderwater() : Bool{
return false;
/* NOP */;
}
public function OnHitGround() : Bool{
}
public function OnHitCeiling() : Bool{
}
private function SetTerrModifier(val : Float){
SetBehaviorVariable('TerrainModifier', val, /* NOP */);
terrModifier = val;
/* NOP */;
}
private function SetTerrTypeOne(type : ETerrainType){
SetBehaviorVariable('TerrainType', type, /* NOP */);
terrTypeOne = type;
/* NOP */;
}
private function SetTerrTypeTwo(type : ETerrainType){
SetBehaviorVariable('TerrainTypeBlended', type, /* NOP */);
terrTypeTwo = type;
/* NOP */;
}
public function SteppedOnTerrain(type : ETerrainType){
if (type != terrTypeOne && type != terrTypeTwo){
if (terrTypeOne == prevTerrType){
SetTerrTypeTwo(type);
SetTerrModifier(0.010000);
} else if (terrTypeTwo == prevTerrType){
SetTerrTypeOne(type);
SetTerrModifier(0.990000);
}
}
if (type == terrTypeOne){
terrModifier -= 0.100000;
} else if (type == terrTypeTwo){
terrModifier += 0.100000;

}
terrModifier = ClampF(terrModifier, 0.010000, 0.990000);
SetBehaviorVariable('TerrainModifier', terrModifier, /* NOP */);
prevTerrType = type;
/* NOP */;
}
public function PlayerCanComment() : Bool{
var time : EngineTime;
time = commentaryLastTime + commentaryCooldown;
return theGame.GetEngineTime() > time;
/* NOP */;
}
public function PlayerCanPlayMonsterCommentary() : Bool{
var time : EngineTime;
var commentaryMonsterCooldown : Float;
commentaryMonsterCooldown = 120.000000;
time = commentaryLastTime + commentaryMonsterCooldown;
return theGame.GetEngineTime() > time;
/* NOP */;
}
public function PlayerCommentary(commentaryType : EPlayerCommentary, new
CommentaryCooldown : Float){
var actor : CPlayer;
var activeActor : CEntity;
var hud : CR4ScriptedHud;
actor = thePlayer;
hud = (CR4ScriptedHud)theGame.GetHud();
activeActor = actor;
commentaryLastTime = theGame.GetEngineTime();
if (newCommentaryCooldown > 0.000000){
commentaryCooldown = newCommentaryCooldown;
} else {
commentaryCooldown = 20.000000;
}
if (commentaryType == 0){
PlayVoiceset(1, "warning", /* NOP */);
hud.ShowOneliner("My medallion", activeActor);
AddTimer('TurnOffOneliner', 3.500000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
} else if (commentaryType == 1){
PlayVoiceset(1, "monster", /* NOP */);
} else if (commentaryType == 5){
hud.ShowOneliner("Damn, it's cold!", activeActor);
AddTimer('TurnOffOneliner', 3.500000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function TurnOffOneliner(optional deltaTime : Float, option
al id : Int32){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
hud.HideOneliner(this);
/* NOP */;
}
public function CanPlaySpecificVoiceset() : Bool{
return canPlaySpecificVoiceset;
/* NOP */;
}
public function SetCanPlaySpecificVoiceset(val : Bool){

canPlaySpecificVoiceset = val;
/* NOP */;
}
public timer function ResetSpecificVoicesetFlag(optional dt : Float, opt
ional id : Int32){
SetCanPlaySpecificVoiceset(true);
/* NOP */;
}
public function GetThreatLevel() : Int32{
return 5;
/* NOP */;
}
public function GetBIsCombatActionAllowed() : Bool{
return true;
/* NOP */;
}
public function SetVehicleCachedSign(sign : ESignType){
vehicleCachedSign = sign;
/* NOP */;
}
public function GetVehicleCachedSign() : ESignType{
return vehicleCachedSign;
/* NOP */;
}
public function GetMoney() : Int32{
return inv.GetMoney();
/* NOP */;
}
public function AddMoney(amount : Int32){
inv.AddMoney(amount);
/* NOP */;
}
public function RemoveMoney(amount : Int32){
inv.RemoveMoney(amount);
/* NOP */;
}
public function GetThrowItemMode() : Bool{
return false;
/* NOP */;
}
public function GetEquippedSign() : ESignType{
return 5;
/* NOP */;
}
public function GetCurrentlyCastSign() : ESignType{
return 5;
/* NOP */;
}
public function IsCastingSign() : Bool{
return false;
/* NOP */;
}
public function IsCurrentSignChanneled() : Bool{
return false;
/* NOP */;
}
public function OnRadialMenuItemChoose(selectedItem : String){
}
public function UpdateQuickSlotItems() : Bool{
return false;

/* NOP */;
}
public function SetUpdateQuickSlotItems(bUpdate : Bool){
}
public function RemoveAllPotionEffectsBut(skip : CBaseGameplayEffect){
effectManager.RemoveAllPotionEffectsBut(skip);
/* NOP */;
}
public function BreakPheromoneEffect() : Bool{
if (thePlayer.HasBuff(115) || thePlayer.HasBuff(116) || thePlaye
r.HasBuff(117)){
thePlayer.RemoveBuff(115, /* NOP */, /* NOP */);
thePlayer.RemoveBuff(116, /* NOP */, /* NOP */);
thePlayer.RemoveBuff(117, /* NOP */, /* NOP */);
}
return true;
/* NOP */;
}
public function GetCurrentTrackedQuestSystemObjectives() : array<SJourna
lQuestObjectiveData>{
return currentTrackedQuestSystemObjectives;
/* NOP */;
}
public function SetCurrentTrackedQuestSystemObjectives(cTQO : array<SJou
rnalQuestObjectiveData>){
var i : Int32;
currentTrackedQuestSystemObjectives = cTQO;
i = 0;
while (i < cTQO.Size()){
currentTrackedQuestSystemObjectives[i] = cTQO[i];
i += 1;
}
/* NOP */;
}
public function GetCurrentTrackedQuestObjectives() : array<SJournalQuest
ObjectiveData>{
return currentTrackedQuestObjectives;
/* NOP */;
}
public function SetCurrentTrackedQuestObjectives(cTQO : array<SJournalQu
estObjectiveData>){
var i : Int32;
currentTrackedQuestObjectives = cTQO;
i = 0;
while (i < cTQO.Size()){
currentTrackedQuestObjectives[i] = cTQO[i];
i += 1;
}
/* NOP */;
}
public function GetCurrentTrackedQuestGUID() : CGUID{
return currentTrackedQuestGUID;
/* NOP */;
}
public function SetCurrentTrackedQuestGUID(cTQG : CGUID){
currentTrackedQuestGUID = cTQG;
/* NOP */;
}
public function HAXCheckIfNew(checkGUID : CGUID) : Bool{
var i : Int32;

i = 0;
while (i < HAXNewObjTable.Size()){
if (HAXNewObjTable[i] == checkGUID){
return false;
}
i += 1;
}
HAXNewObjTable.PushBack(checkGUID);
return true;
/* NOP */;
}
public function GetShowHud() : Bool{
return true;
/* NOP */;
}
public function SetShowHud(value : Bool){
}
public function DebugKillAll(){
var i : Int32;
var enemiesSize : Int32;
var actors : array<CActor>;
actors = GetNPCsAndPlayersInRange(20, 20, 'None', 256);
enemiesSize = actors.Size();
i = 0;
while (i < enemiesSize){
actors[i].Kill(false, this, /* NOP */);
i += 1;
}
/* NOP */;
}
public function OnHitByObstacle(obstacleComponent : CComponent) : Bool{
obstacleComponent.SetEnabled(false);
/* NOP */;
}
public function DEBUGGetDisplayRadiusMinimapIcons() : Bool{
return _DEBUGDisplayRadiusMinimapIcons;
/* NOP */;
}
public function DEBUGSetDisplayRadiusMinimapIcons(inValue : Bool){
_DEBUGDisplayRadiusMinimapIcons = inValue;
/* NOP */;
}
public function Dbg_UnlockAllActions(){
inputHandler.Dbg_UnlockAllActions();
/* NOP */;
}
public function OnCriticalStateAnimStop() : Bool{
SetBehaviorVariable('bCriticalState', 0, /* NOP */);
CriticalStateAnimStopped(false);
if (IsRagdolled()){
RaiseForceEvent('RecoverFromRagdoll');
}
return true;
/* NOP */;
}
public function OnRecoverFromRagdollEnd() : Bool{
if (IsRagdolled()){
SetKinematic(true);
}
/* NOP */;

}
public function ReapplyCriticalBuff(){
var buff : CBaseGameplayEffect;
buff = ChooseCurrentCriticalBuffForAnim();
if (buff){
LogCritical("Reapplying critical <<" + buff.GetEffectTyp
e() + ">> after finished CombatAction (End)");
StartCSAnim(buff);
}
/* NOP */;
}
public timer function ReapplyCSTimer(optional dt : Float, optional id :
Int32){
ReapplyCriticalBuff();
/* NOP */;
}
public function IsInAgony() : Bool{
return false;
/* NOP */;
}
public function GetOTCameraOffset() : Float{
return oTCameraOffset;
/* NOP */;
}
public function IsKnockedUnconscious() : Bool{
return OnCheckUnconscious();
/* NOP */;
}
public function IsSailing() : Bool{
return IsUsingVehicle() && GetCurrentStateName() == 'Sailing';
/* NOP */;
}
public final function spawnBoatAndMount(){
var entities : array<CGameplayEntity>;
var vehicle : CVehicleComponent;
var i : Int32;
var boat : W3Boat;
var ent : CEntity;
var player : Vector;
var rot : EulerAngles;
var template : CEntityTemplate;
FindGameplayEntitiesInRange(entities, thePlayer, 10, 10, 'vehicl
e', /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < entities.Size()){
boat = (W3Boat)entities[i];
if (boat){
vehicle = (CVehicleComponent)boat.GetComponentBy
ClassName('CVehicleComponent');
if (vehicle){
vehicle.Mount(thePlayer, 4, 0);
}
return;
}
i = i + 1;
}
rot = thePlayer.GetWorldRotation();
player = thePlayer.GetWorldPosition();
template = (CEntityTemplate)LoadResource('boat', /* NOP */);
player.Z = 0.000000;

ent = theGame.CreateEntity(template, player, rot, true, false, f


alse, 2, /* NOP */);
if (ent){
vehicle = (CVehicleComponent)ent.GetComponentByClassName
('CVehicleComponent');
if (vehicle){
vehicle.Mount(thePlayer, 4, 0);
boat = (W3Boat)ent;
if (boat){
boat.SetTeleportedFromOtherHUB(true);
}
}
}
/* NOP */;
}
public timer function DelayedSpawnAndMountBoat(optional delta : Float, o
ptional id : Int32){
super.spawnBoatAndMount();
RemoveTimer('DelayedSpawnAndMountBoat', /* NOP */);
/* NOP */;
}
}
import struct CDLCManager{
import public final function GetDLCs(names : array<CName>);
import public final function EnableDLC(id : CName, isEnabled : Bool);
import public final function IsDLCEnabled(id : CName) : Bool;
import public final function IsDLCAvailable(id : CName) : Bool;
import public final function GetDLCName(id : CName) : String;
import public final function GetDLCDescription(id : CName) : String;
import public final function SimulateDLCsAvailable(shouldSimulate : Bool
);
public function IsNewGamePlusAvailable() : Bool{
return theGame.GetDLCManager().IsDLCAvailable('dlc_009_001') &&
hasSaveDataToLoad();
/* NOP */;
}
}
abstract class W3DamageOverTimeEffect extends CBaseGameplayEffect{
protected saved var damages : array<SDoTDamage>;
protected saved var powerStatType : ECharacterPowerStats;
protected saved var isEnvironment : Bool;
protected saved var hpRegenPauseStrength : SAbilityAttributeValue;
protected saved var hpRegenPauseExtraDuration : Float;
public function CacheSettings(){
var dm : CDefinitionsManagerAccessor;
var i : Int32;
var attribs : array<CName>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dot : SDoTDamage;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(abilityName, attribs);
i = 0;
while (i < attribs.Size()){
if (IsDamageTypeNameValid(attribs[i])){
dm.GetAbilityAttributeValue(abilityName, attribs
[i], min, max);

dot.damageTypeName = attribs[i];
dot.hitsVitality = DamageHitsVitality(attribs[i]
);
dot.hitsEssence = DamageHitsEssence(attribs[i]);
dot.resistance = GetResistForDamage(dot.damageTy
peName, true);
damages.PushBack(dot);
attributeName = attribs[i];
} else if (attribs[i] == 'hp_regen_reduction_strength'){
dm.GetAbilityAttributeValue(abilityName, attribs
[i], min, max);
hpRegenPauseStrength = GetAttributeRandomizedVal
ue(min, max);
} else if (attribs[i] == 'hp_regen_reduction_duration'){
dm.GetAbilityAttributeValue(abilityName, attribs
[i], min, max);
hpRegenPauseExtraDuration = CalculateAttributeVa
lue(GetAttributeRandomizedValue(min, max), /* NOP */);
}
i += 1;
}
if (damages.Size() == 0 && !(W3CriticalDOTEffect)this){
LogAssert(false, "W3DamageOverTimeEffect.CacheSettings:
effect <<" + this + ">> has no damage type defined!");
return;
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var params : W3BuffDoTParams;
params = (W3BuffDoTParams)customParams;
if (params){
isEnvironment = params.isEnvironment;
}
AddHealthRegenReductionBuff();
super.OnEffectAdded(customParams);
/* NOP */;
}
private function AddHealthRegenReductionBuff(){
var regenParams : SCustomEffectParams;
if (hpRegenPauseExtraDuration > 0 && hpRegenPauseStrength.valueA
dditive > 0 || hpRegenPauseStrength.valueBase > 0 || hpRegenPauseStrength.valueM
ultiplicative > 0){
regenParams.effectType = 20;
regenParams.creator = GetCreator();
regenParams.sourceName = sourceName;
regenParams.duration = duration + hpRegenPauseExtraDurat
ion;
regenParams.effectValue = hpRegenPauseStrength;
target.AddEffectCustom(regenParams);
}
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
super.CumulateWith(effect);
AddHealthRegenReductionBuff();
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
var dmg : Float;

var maxVit : Float;


var maxEss : Float;
var i : Int32;
super.OnUpdate(dt);
if (!target.IsAlive()){
return true;
}
maxVit = target.GetStatMax(0);
maxEss = target.GetStatMax(1);
i = 0;
while (i < damages.Size()){
dmg = CalculateDamage(i, maxVit, maxEss, dt);
if (!damages[i].hitsVitality && !damages[i].hitsEssence
|| dmg <= 0){
LogAssert(false, "W3DamageOverTimeEffect: effect
" + this + " on " + target.GetReadableName() + " is dealing no damage");
} else {
effectManager.CacheDamage(damages[i].damageTypeN
ame, dmg, GetCreator(), this, dt, true, powerStatType, isEnvironment);
}
if (effectValue.valueBase != 0){
LogAssert(false, "W3DamageOverTimeEffect.OnUpdat
e: effect <<" + this + ">> has baseValue set which makes no sense!!!!");
} else if (effectValue.valueMultiplicative == 1){
LogAssert(false, "W3DamageOverTimeEffect.OnUpdat
e: effect <<" + this + ">> has valueMultiplicative set to 1 which results in 100
% MAX HP damage /sec!!!!!");
}
i += 1;
}
/* NOP */;
}
protected function CalculateDamage(arrayIndex : Int32, maxVit : Float, m
axEss : Float, dt : Float) : Float{
var dmg : Float;
var dmgV : Float;
var dmgE : Float;
if (damages[arrayIndex].hitsVitality){
dmgV = MaxF(0, dt * effectValue.valueAdditive + effectVa
lue.valueMultiplicative * maxVit);
}
if (damages[arrayIndex].hitsEssence){
dmgE = MaxF(0, dt * effectValue.valueAdditive + effectVa
lue.valueMultiplicative * maxEss);
}
dmg = MaxF(dmgE, dmgV);
return dmg;
/* NOP */;
}
protected function IsImmuneToAllDamage(dt : Float) : Bool{
var i : Int32;
var maxVit : Float;
var maxEss : Float;
var immune : Bool;
var points : Float;
var percents : Float;
maxVit = target.GetStatMax(0);
maxEss = target.GetStatMax(1);
i = 0;
while (i < damages.Size()){

target.GetResistValue(damages[i].resistance, points, per


cents);
if (points < CalculateDamage(i, maxVit, maxEss, dt) && p
ercents < 1){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
if (duration >= 0.000000 && duration < 0.100000){
duration = 0.000000;
LogEffects("W3DamageOverTimeEffect.CalculateDuration():
final duration is below 0.1, setting to 0");
}
/* NOP */;
}
public final function HAXXX_GetQuenDamages() : array<SRawDamage>{
var raw : SRawDamage;
var i : Int32;
var maxVit : Float;
var maxEss : Float;
var ret : array<SRawDamage>;
maxVit = target.GetStatMax(0);
maxEss = target.GetStatMax(1);
i = 0;
while (i < damages.Size()){
raw.dmgType = damages[i].damageTypeName;
raw.dmgVal = CalculateDamage(i, maxVit, maxEss, 0.100000
);
ret.PushBack(raw);
i += 1;
}
return ret;
/* NOP */;
}
}
class CExplorationClimbOracle extends CObject{
private var m_ExplorationO : CExplorationStateManager;
private var probeTop : CClimbProbe;
private var probeBottom : CClimbProbe;
private editable var distForwardToCheck : Float;
private editable var characterRadius : Float;
private editable var characterHeight : Float;
private editable var radiusToCheck : Float;
private editable var bottomCheckAllowed : Bool;
private var topIsPriority : Bool;
private var probeBeingUsed : EClimbProbeUsed;
private var debugLogFails : Bool;
private var vectorUp : Vector;
public function Initialize(explorationO : CExplorationStateManager, heig
htMin : Float, heightMax : Float, platformHeihtMin : Float, radius : Float){
m_ExplorationO = explorationO;
if (!probeTop){
probeTop = new CClimbProbe in this;
}

if (!probeBottom){
probeBottom = new CClimbProbe in this;
}
probeTop.Initialize(heightMin, heightMax, platformHeihtMin, radi
us, 1, true);
probeBottom.Initialize(heightMin, heightMax, platformHeihtMin, r
adius, 2, false);
vectorUp = Vector(0.000000, 0.000000, 1.000000);
/* NOP */;
}
public function ComputeAll(ptriorizeTop : Bool, position : Vector, direc
tionNormalized : Vector, distanceType : EClimbDistanceType, requireInputDir : Bo
ol, logFails : Bool){
var requireInput : Bool;
debugLogFails = logFails;
topIsPriority = ptriorizeTop;
probeTop.PreUpdate(position, directionNormalized, requireInputDi
r, distanceType, logFails);
probeBottom.PreUpdate(position, directionNormalized, requireInpu
tDir, distanceType, logFails);
probeBeingUsed = ComputeConvenientClimb();
/* NOP */;
}
public function CanWeClimb() : Bool{
switch(probeBeingUsed){
case 0:
return false;
case 1:
return probeTop.IsValid();
case 2:
return probeBottom.IsValid();
}
/* NOP */;
}
public function GetClimbData(height : Float, vault : EClimbRequirementVa
ult, vaultFalls : Bool, platform : EClimbRequirementPlatform, climbPoint : Vecto
r, wallNormal : Vector){
switch(probeBeingUsed){
case 0:
LogExplorationClimb(" Trying to get climb data when ther
e is no valid data");
break;
case 1:
probeTop.GetClimbData(height, vault, vaultFalls, platfor
m, climbPoint, wallNormal);
break;
case 2:
probeBottom.GetClimbData(height, vault, vaultFalls, plat
form, climbPoint, wallNormal);
break;
}
/* NOP */;
}
private function ComputeConvenientClimb() : EClimbProbeUsed{
probeTop.ComputeStartup();
if (!probeTop.IsSetupValid()){
return 0;
}
if (topIsPriority){
probeTop.ComputeClimbDetails();

if (probeTop.IsValid()){
return 1;
} else if (bottomCheckAllowed){
probeBottom.ComputeStartupFromThisPoint(probeTop
.GetGroundPoint());
probeBottom.ComputeClimbDetails();
if (probeBottom.IsValid()){
return 2;
}
}
} else {
if (bottomCheckAllowed){
probeBottom.ComputeStartupFromThisPoint(probeTop
.GetGroundPoint());
probeBottom.ComputeClimbDetails();
if (probeBottom.IsValid()){
return 2;
}
}
probeTop.ComputeClimbDetails();
if (probeTop.IsValid()){
return 1;
}
}
return 0;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, active : Bool) : Bool{
if (!probeTop.IsValid() && probeBottom.IsValid()){
probeBottom.OnVisualDebug(frame, flag, active);
} else {
probeTop.OnVisualDebug(frame, flag, active);
}
return true;
/* NOP */;
}
public function DebugLogSuccesfullClimb(){
var auxText : String;
if (probeBeingUsed == 1){
auxText = "Used Top climb ";
if (!topIsPriority){
auxText += "cause bottom climb is not available
";
}
auxText += probeTop.GetDebugText();
} else if (probeBeingUsed == 2){
auxText = "Used Bottom climb ";
if (topIsPriority){
auxText += "cause top climb is not available ";
}
auxText += probeBottom.GetDebugText();
}
LogExplorationClimb(auxText);
/* NOP */;
}
}
struct CClimbType{
editable var requiredState : EClimbRequirementType;

editable
editable
editable
editable
editable
editable
editable
editable
editable
editable

var
var
var
var
var
var
var
var
var
var

requiredVault : EClimbRequirementVault;
requiredPlatform : EClimbRequirementPlatform;
type : EClimbHeightType;
heightUseDefaults : Bool;
heightMax : Float;
heightMin : Float;
heightExact : Float;
forwardDistExact : Float;
playCameraAnimation : Bool;
cameraAnimation : CName;

}
import abstract class SCustomNodeAttribute{
}
import abstract class SCustomNode{
//NULL type for subNodes
//NULL type for values
}
import abstract class SItemUniqueId{
}
class W3LadderInteraction extends CGameplayEntity{
public editable var associatedDoorTag : CName;
public var associatedDoor : W3NewDoor;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var components : array<CComponent>;
var ic : CInteractionComponent;
var i : Int32;
var size : Int32;
if (associatedDoorTag == 'None' && HasTag('q305_ladder_midgets_c
ellar')){
associatedDoorTag = 'q305_midgets_trapdoor';
}
if (associatedDoorTag){
components = GetComponentsByClassName('CInteractionCompo
nent');
size = components.Size();
i = 0;
while (i < size){
ic = (CInteractionComponent)components[i];
if (ic){
ic.performScriptedTest = true;
}
i += 1;
}
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (associatedDoorTag){
if (!associatedDoor){
associatedDoor = (W3NewDoor)theGame.GetNodeByTag
(associatedDoorTag);
}
if (associatedDoor && !associatedDoor.IsOpen()){
return false;
}

}
return true;
/* NOP */;
}
private function PlayerHasLadderExplorationReady() : Bool{
if (!thePlayer.substateManager.CanInteract()){
return false;
}
if (!thePlayer.substateManager.m_SharedDataO.HasValidLadderExplo
ration()){
return false;
}
return true;
/* NOP */;
}
}
import abstract class CStorySceneControlPart{
}
import abstract class CStorySceneSection{
}
import abstract class CStorySceneActor{
}
import abstract class CStorySceneProp{
}
import abstract class CStorySceneEffect{
}
import abstract class CStorySceneLight{
}
import abstract class CStorySceneDialogsetInstance{
}
import abstract class StorySceneCameraDefinition{
}
class CGroupFXManager extends CGameplayEntity{
public editable var entityTag : CName;
public editable var randomDropMin : Float;
public editable var randomDropMax : Float;
public editable var effectName : CName;
private var ntities : array<CEntity>;
private var randomDrop : Float;
public function Activate(){
theGame.GetEntitiesByTag(entityTag, ntities);
AddTimer('StartDropping', randomDrop, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
/* NOP */;
}
public function Deactivate(){
RemoveTimer('StartDropping', /* NOP */);
/* NOP */;
}
public timer function StartDropping(optional deltaTime : Float, optional
id : Int32){

var randomEntity : Int32;


var givenEntity : CEntity;
randomDrop = RandRangeF(randomDropMax + 1, randomDropMin);
if (ntities.Size() > 0){
randomEntity = RandRange(ntities.Size() - 1, 0);
givenEntity = ntities[randomEntity];
givenEntity.PlayEffectSingle(effectName, /* NOP */);
ntities.Remove(givenEntity);
} else {
RemoveTimer('StartDropping', /* NOP */);
}
/* NOP */;
}
}
import abstract class CStorySceneAction{
}
import abstract class SSceneCameraShotDescription{
}
import abstract class SScenePersonalCameraDescription{
}
import abstract class SSceneMasterCameraDescription{
}
import abstract class SSceneCustomCameraDescription{
}
import abstract class CStorySceneDialogsetSlot{
}
import struct CActor{
public editable saved var isTargatebleByPlayer : Bool;
public editable saved var isUsingTooltip : Bool;
public var slideTarget : CGameplayEntity;
public var parryTypeTable : array<array<EParryType>>;
public var lastAttacker : CActor;
public var counterAttackAnimTable : array<CName>;
private var bIsGuarded : Bool;
private var bParryEnabled : Bool;
protected var bCanPerformCounter : Bool;
private var lastParryType : EParryType;
private var useAdditiveHits : Bool;
private var oneTimeAdditiveHit : Bool;
private var useAdditiveCriticalStateAnim : Bool;
private var criticalCancelAdditiveHit : Bool;
private var lastAttackRangeName : CName;
protected var attackActionName : CName;
protected var hitTargets : array<CGameplayEntity>;
private var droppedItems : array<SDroppedItem>;
private var wasDefeatedFromFistFight : Bool;
protected var isCurrentlyDodging : Bool;
private var combatStartTime : Float;
private var combatPartStartTime : Float;
private var collisionDamageTimestamp : Float;
private var lastWasAttackedTime : Float;
private var lastWasHitTime : Float;
private var lowerGuardTime : Float;

private var knockedUncounscious : Bool;


private var isGameplayVisible : Bool;
private var lastBreathTime : Float;
private var bIsPlayerCurrentTarget : Bool;
private saved var buffImmunities : array<SBuffImmunity>;
private saved var buffRemovedImmunities : array<SBuffImmunity>;
protected saved var newRequestedCS : CBaseGameplayEffect;
private var criticalStateCounter : Int32;
private var totalCriticalStateCounter : Int32;
public saved var isDead : Bool;
protected var canPlayHitAnim : Bool;
private editable var damageDistanceNotReducing : Float;
private editable var deathDistNotReducing : Float;
private editable var damageDistanceReducing : Float;
private editable var deathDistanceReducing : Float;
private editable var fallDamageMinHealthPerc : Float;
public var isPlayerFollower : Bool;
private var MAC : CMovingPhysicalAgentComponent;
public saved var immortalityFlags : Int32;
public saved var abilityManager : W3AbilityManager;
private var effectsUpdateTicking : Bool;
public saved var immortalityFlagsCopy : Int32;
protected var isSwimming : Bool;
protected saved var usedVehicleHandle : EntityHandle;
protected var usedVehicle : CGameplayEntity;
protected saved var effectManager : W3EffectManager;
private var traverser : CScriptedExplorationTraverser;
private saved var nextFreeAnimMultCauserId : Int32;
private saved var animationMultiplierCausers : array<SAnimMultiplyCauser
>;
private var isInFFMiniGame : Bool;
public var isInAir : Bool;
private var cachedIsHuman : Int32;
private var cachedIsWoman : Int32;
private var cachedIsMan : Int32;
private var cachedIsMonster : Int32;
private var cachedIsAnimal : Int32;
private var woundToDismember : CName;
private var forwardVector : Vector;
private var dismemberForceRagdoll : Bool;
protected var attackEventInProgress : Bool;
private var ignoreAttack : Bool;
private var currentAttackData : CPreAttackEventData;
private var currentAttackAnimInfo : SAnimationEventAnimInfo;
private var ignoreTargetsForCurrentAttack : array<CActor>;
public var customCameraStackIndex : Int32;
public var cachedHeal : Float;
public var hudModuleHealScheduledUpdate : Bool;
public var cachedDoTDamage : Float;
public var hudModuleDoTScheduledUpdate : Bool;
//NULL type for isAttackableByPlayer
import public final function SetDebugAttackRange(rangeName : CName);
import public final function EnableDebugARTraceDraw(enable : Bool);
import public final function SignalGameplayDamageEvent(eventName : CName
, data : CDamageData);
import public final function SignalGameplayEvent(eventName : CName);
import public final function SignalGameplayEventParamCName(eventName : C
Name, param : CName);
import public final function SignalGameplayEventParamInt(eventName : CNa
me, param : Int32);

import public final function SignalGameplayEventParamFloat(eventName : C


Name, param : Float);
import public final function SignalGameplayEventParamObject(eventName :
CName, param : IScriptable);
import public final function SignalGameplayEventReturnCName(eventName :
CName, defaultVal : CName) : CName;
import public final function SignalGameplayEventReturnInt(eventName : CN
ame, defaultVal : Int32) : Int32;
import public final function SignalGameplayEventReturnFloat(eventName :
CName, defaultVal : Float) : Float;
import public final function ForceAIUpdate();
import public final function GetRadius() : Float;
import public final function PlayVoiceset(priority : Int32, voiceset : S
tring, breakCurrentSpeach : Bool) : Bool;
import public final function StopAllVoicesets(cleanupQueue : Bool);
import public final function HasVoiceset(voiceset : String) : EAsyncChec
kResult;
import public final function PlayScene(input : String) : Bool;
import public final function StopAllScenes();
import public final function EmptyHands();
import public final function IsRotatedTowards(node : CNode, maxAngle : F
loat) : Bool;
import public final function IsRotatedTowardsPoint(point : Vector, maxAn
gle : Float) : Bool;
import protected final function GetAliveFlag() : Bool;
import public final function SetAlive(flag : Bool);
import public final function IsExternalyControlled() : Bool;
import public final function IsInCombat() : Bool;
import public final function IsMoving() : Bool;
import public final function GetMoveDestination() : Vector;
import public final function GetPositionOrMoveDestination() : Vector;
import public final function GetVisualDebug() : CVisualDebug;
import public final function GetVoicetag() : CName;
import public final function GetSkeletonType() : ESkeletonType;
import public final function UseItem(itemId : SItemUniqueId) : Bool;
import public final function SetVisibility(isVisible : Bool);
import public final function GetVisibility() : Bool;
import public final function SetAppearance(appearanceName : CName);
import public final function GetAppearance() : CName;
import public final function GetHeadAngleHorizontal() : Float;
import public final function GetHeadAngleVertical() : Float;
import public final function GetAnimationTimeMultiplier() : Float;
import public final function SetAnimationTimeMultiplier(mult : Float);
import public final function GetMovingAgentComponent() : CMovingAgentCom
ponent;
import public final function GetMorphedMeshManagerComponent() : CMorphed
MeshManagerComponent;
import public final function EnablePathEngineAgent(flag : Bool);
import public final function IsRagdollObstacle() : Bool;
import public final function ClearRotationTarget();
import public final function SetRotationTarget(node : CNode, clamping :
Bool);
import public final function SetRotationTargetPos(position : Vector, cla
mping : Bool);
import public final function EnableCollisionInfoReportingForItem(itemId
: SItemUniqueId, enable : Bool);
import public final function EnablePhysicalMovement(enable : Bool) : Boo
l;
import public final function EnableCharacterCollisions(enable : Bool) :
Bool;

import public final function EnableDynamicCollisions(enable : Bool) : Bo


ol;
import public final function EnableStaticCollisions(enable : Bool) : Boo
l;
import public final function IsInNonGameplayCutscene() : Bool;
import public final function IsInGameplayScene() : Bool;
import public final function PlayLine(stringId : Int32, subtitle : Bool)
;
import public final function PlayLineByStringKey(stringKey : String, sub
title : Bool);
import public final function EndLine();
import public final function IsSpeaking(stringId : Int32) : Bool;
import public function EnableDynamicLookAt(node : CNode, duration : Floa
t);
import public function EnableStaticLookAt(point : Vector, duration : Flo
at);
import public function DisableLookAt();
import public final function IsAttackableByPlayer() : Bool;
import public final function SetAttackableByPlayerPersistent(flag : Bool
);
import public final function SetAttackableByPlayerRuntime(flag : Bool, t
imeout : Float);
import public final function InAttackRange(target : CGameplayEntity, ran
geName : CName) : Bool;
import public final function GetNearestPointInPersonalSpace(position : V
ector) : Vector;
import public final function GetNearestPointInPersonalSpaceAt(myPosition
: Vector, otherPosition : Vector) : Vector;
import public final function GatherEntitiesInAttackRange(entities : arra
y<CGameplayEntity>, rangeName : CName);
import public final function CalculateHeight() : Float;
import public final function PlayMimicAnimationAsync(animation : CName)
: Bool;
import public final function CanPlayQuestScene() : Bool;
import public final function HasInteractionScene() : Bool;
import public final function CanTalk(ignoreCurrentSpeech : Bool) : Bool;
import public final function GetActorAnimState() : Int32;
import public final function IsInView() : Bool;
import public final function GetHeadBoneIndex() : Int32;
import public final function GetTorsoBoneIndex() : Int32;
import public final function GetTarget() : CActor;
import public final function IsDangerous(actor : CActor) : Bool;
import public final function GetAttitude(actor : CActor) : EAIAttitude;
import public final function SetAttitude(actor : CActor, attitude : EAIA
ttitude);
import public final function ResetAttitude(actor : CActor);
import public final function HasAttitudeTowards(actor : CActor) : Bool;
import public final function ClearAttitudes(hostile : Bool, neutral : Bo
ol, friendly : Bool);
import public final function GetAttitudeGroup() : CName;
import public final function GetBaseAttitudeGroup() : CName;
import public final function SetBaseAttitudeGroup(groupName : CName);
import public final function ResetBaseAttitudeGroup();
import public final function SetTemporaryAttitudeGroup(groupName : CName
, priority : EAttitudeGroupPriority);
import public final function ResetTemporaryAttitudeGroup(priority : EAtt
itudeGroupPriority);
import public final function CanStealOtherActor(actor : CActor) : Bool;
import public final function DrawItems(instant : Bool, itemId : SItemUni
queId, itemId2 : SItemUniqueId, itemId3 : SItemUniqueId) : Bool;

import public final function HolsterItems(instant : Bool, itemId : SItem


UniqueId, itemId2 : SItemUniqueId, itemId3 : SItemUniqueId) : Bool;
import public final latent function DrawItemsLatent(itemId : SItemUnique
Id, itemId2 : SItemUniqueId, itemId3 : SItemUniqueId) : Bool;
import public final latent function HolsterItemsLatent(itemId : SItemUni
queId, itemId2 : SItemUniqueId, itemId3 : SItemUniqueId) : Bool;
import public latent function WaitForFinishedAllLatentItemActions() : Bo
ol;
import public final latent function DrawWeaponAndAttackLatent(itemId : S
ItemUniqueId) : Bool;
import public final function SetBehaviorMimicVariable(varName : CName, v
arValue : Float) : Bool;
import public function SetLookAtMode(mode : ELookAtMode);
import public function ResetLookAtMode(mode : ELookAtMode);
import public final function IsUsingExploration() : Bool;
import public final function GetAnimCombatSlots(animSlotName : CName, ou
tSlots : array<Matrix>, slotsNum : Int32, mainEnemyMatrix : Matrix) : Bool;
import public final function ForceAIBehavior(tree : IAITree, forceLevel
: EArbitratorPriorities, forceEventName : CName) : Int32;
import public final function CancelAIBehavior(forceActionId : Int32) : B
ool;
import public final function GetAIStorageObject(storageItemName : CName)
: IScriptable;
import public final function GetAutoEffects(effects : array<CName>);
import public final function SetInteractionPriority(priority : EInteract
ionPriority);
import public final function SetOriginalInteractionPriority(priority : E
InteractionPriority);
import public final function RestoreOriginalInteractionPriority();
import public final function GetOriginalInteractionPriority() : EInterac
tionPriority;
import public final function GetInteractionPriority() : EInteractionPrio
rity;
import public final function SetUnpushableTarget(target : CActor) : CAct
or;
import public final function EnableCollisions(val : Bool);
import public final function PredictWorldPosition(inTime : Float) : Vect
or;
import public final function IsReadyForNewAction() : Bool;
import public final function ActionCancelAll();
import public final function GetCurrentActionPriority() : Int32;
import public final function IsDoingSomethingMoreImportant(priority : In
t32) : Bool;
import public final function IsCurrentActionInProgress() : Bool;
import public final function IsCurrentActionSucceded() : Bool;
import public final function IsCurrentActionFailed() : Bool;
import public final latent function ActionMoveToNode(target : CNode, mov
eType : EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailur
eAction) : Bool;
import public final function ActionMoveToNodeAsync(target : CNode, moveT
ype : EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailureA
ction) : Bool;
import public final latent function ActionMoveToNodeWithHeading(target :
CNode, moveType : EMoveType, absSpeed : Float, radius : Float, failureAction :
EMoveFailureAction) : Bool;
import public final function ActionMoveToNodeWithHeadingAsync(target : C
Node, moveType : EMoveType, absSpeed : Float, radius : Float, failureAction : EM
oveFailureAction) : Bool;
import public final latent function ActionMoveTo(target : Vector, moveTy
pe : EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailureAc

tion) : Bool;
import public final function ActionMoveToAsync(target : Vector, moveType
: EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailureActi
on) : Bool;
import public final latent function ActionMoveToWithHeading(target : Vec
tor, heading : Float, moveType : EMoveType, absSpeed : Float, radius : Float, fa
ilureAction : EMoveFailureAction) : Bool;
import public final function ActionMoveToWithHeadingAsync(target : Vecto
r, heading : Float, moveType : EMoveType, absSpeed : Float, radius : Float, fail
ureAction : EMoveFailureAction) : Bool;
import public final latent function ActionMoveAwayFromNode(position : CN
ode, distance : Float, moveType : EMoveType, absSpeed : Float, radius : Float, f
ailureAction : EMoveFailureAction) : Bool;
import public final function ActionMoveAwayFromNodeAsync(position : CNod
e, distance : Float, moveType : EMoveType, absSpeed : Float, radius : Float, fai
lureAction : EMoveFailureAction) : Bool;
import public final latent function ActionMoveAwayFromLine(positionA : V
ector, positionB : Vector, distance : Float, makeMinimalMovement : Bool, moveTyp
e : EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailureAct
ion) : Bool;
import public final function ActionMoveAwayFromLineAsync(positionA : Vec
tor, positionB : Vector, distance : Float, makeMinimalMovement : Bool, moveType
: EMoveType, absSpeed : Float, radius : Float, failureAction : EMoveFailureActio
n) : Bool;
import public final latent function ActionMoveCustom(targeter : CMoveTRG
Script) : Bool;
import public final function ActionMoveCustomAsync(targeter : CMoveTRGSc
ript) : Bool;
import public final latent function ActionMoveToDynamicNode(target : CNo
de, moveType : EMoveType, absSpeed : Float, range : Float, keepDistance : Bool,
failureAction : EMoveFailureAction) : Bool;
import public final function ActionMoveToDynamicNodeAsync(target : CNode
, moveType : EMoveType, absSpeed : Float, range : Float, keepDistance : Bool, fa
ilureAction : EMoveFailureAction) : Bool;
import public final latent function ActionSlideThrough(explorationAreaTo
Use : CActionAreaComponent) : Bool;
import public final function ActionSlideThroughAsync(explorationAreaToUs
e : CActionAreaComponent) : Bool;
import public final latent function ActionSlideTo(target : Vector, durat
ion : Float) : Bool;
import public final function ActionSlideToAsync(target : Vector, duratio
n : Float) : Bool;
import public final function ActionSlideToWithHeadingAsync(target : Vect
or, heading : Float, duration : Float, rotation : ESlideRotation) : Bool;
import public final latent function ActionSlideToWithHeading(target : Ve
ctor, heading : Float, duration : Float, rotation : ESlideRotation) : Bool;
import public final latent function ActionMoveOnCurveTo(target : Vector,
duration : Float, rightShift : Bool) : Bool;
import public final function ActionMoveOnCurveToAsync(target : Vector, d
uration : Float, rightShift : Bool) : Bool;
import public final latent function ActionRotateTo(target : Vector) : Bo
ol;
import public final latent function ActionSetOrientation(orientation : F
loat) : Bool;
import public final function ActionRotateToAsync(target : Vector) : Bool
;
import public final latent function ActionPlaySlotAnimation(slotName : C
Name, animationName : CName, blendIn : Float, blendOut : Float, continuePlaying
: Bool) : Bool;
import public final function ActionPlaySlotAnimationAsync(slotName : CNa

me, animationName : CName, blendIn : Float, blendOut : Float, continuePlaying :


Bool) : Bool;
import public final latent function ActionExitWork(fast : Bool) : Bool;
import public final function ActionExitWorkAsync(fast : Bool) : Bool;
import public final latent function ActionExploration(exploration : SExp
lorationQueryToken, listener : IScriptable, steeringGraphTargetNode : CNode) : B
ool;
import public final latent function ActionAnimatedSlideToStatic(settings
: SAnimatedSlideSettings, target : Vector, heading : Float, translation : Bool,
rotation : Bool) : Bool;
import public final function ActionAnimatedSlideToStaticAsync(settings :
SAnimatedSlideSettings, target : Vector, heading : Float, translation : Bool, r
otation : Bool) : Bool;
import public final function ActionAnimatedSlideToStaticAsync_P(settings
: SAnimatedSlideSettings, target : Vector, heading : Float, translation : Bool,
rotation : Bool, animProxy : CActionMoveAnimationProxy) : Bool;
import public final latent function ActionAnimatedSlideTo(settings : SAn
imatedSlideSettings, target : CNode, translation : Bool, rotation : Bool) : Bool
;
import public final function ActionAnimatedSlideToAsync(settings : SAnim
atedSlideSettings, target : CNode, translation : Bool, rotation : Bool) : Bool;
import public final function ActionAnimatedSlideToAsync_P(settings : SAn
imatedSlideSettings, target : CNode, translation : Bool, rotation : Bool, animPr
oxy : CActionMoveAnimationProxy) : Bool;
import public final latent function ActionMatchTo(settings : SAnimatedSl
ideSettings, target : SActionMatchToTarget) : Bool;
import public final function ActionMatchToAsync(settings : SActionMatchT
oSettings, target : SActionMatchToTarget) : Bool;
import public final function ActionMatchToAsync_P(settings : SActionMatc
hToSettings, target : SActionMatchToTarget, animProxy : CActionMoveAnimationProx
y) : Bool;
import public final function GetCurrentActionType() : EActorActionType;
import public final function SetErrorState(description : String);
import public final function PushAway(pusher : CMovingAgentComponent, st
rength : Float, speed : Float);
import public final function PushInDirection(pusherPos : Vector, directi
on : Vector, speed : Float, playAnimation : Bool, applyRotation : Bool);
import public final function IssueRequiredItems(leftItem : CName, rightI
tem : CName);
import public final function SetRequiredItems(leftItem : CName, rightIte
m : CName);
import public final function IssueRequiredItemsGeneric(items : array<CNa
me>, slots : array<CName>);
import public final function SetRequiredItemsGeneric(items : array<CName
>, slots : array<CName>);
import public final latent function ActivateAndSyncBehaviorWithItemsPara
llel(names : CName, timeout : Float) : Bool;
import public final latent function ActivateAndSyncBehaviorWithItemsSequ
ence(names : CName, timeout : Float) : Bool;
import public final latent function ProcessRequiredItems(instant : Bool)
;
import public final function PlayPushAnimation(pushDirection : EPushingD
irection);
import public final function GetFallTauntEvent() : String;
import public function GetCharacterStatsParam(abilities : array<CName>);
import public function ApplyItemAbilities(itemId : SItemUniqueId) : Bool
;
import public function RemoveItemAbilities(itemId : SItemUniqueId) : Boo
l;
import public function ReportDeathToSpawnSystems();

import public function CanPush(canPush : Bool);


import public function MuteHeadAudio(mute : Bool);
public function GetIgnoreImmortalDodge() : Bool{
return false;
/* NOP */;
}
public function SetTatgetableByPlayer(isTargetAble : Bool){
isTargatebleByPlayer = isTargetAble;
/* NOP */;
}
public function IsTargetableByPlayer() : Bool{
if (thePlayer.playerMode.GetForceCombatMode()){
if (GetAttitude(thePlayer) == 0){
return false;
}
}
return isTargatebleByPlayer;
/* NOP */;
}
public function IsUsingTooltip() : Bool{
return isUsingTooltip;
/* NOP */;
}
public function SetIsUsingTooltip(hasTooltip : Bool){
isUsingTooltip = hasTooltip;
/* NOP */;
}
public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTyp
eName : CName, crossbowId : SItemUniqueId) : Float{
var excessiveDamage : SAbilityAttributeValue;
var i : Int32;
var weapons : array<SItemUniqueId>;
var inv : CInventoryComponent;
var n : CName;
var damage : Float;
excessiveDamage = GetAttributeValue(damageTypeName, /* NOP */, /
* NOP */);
inv = GetInventory();
weapons = inv.GetAllWeapons();
i = 0;
while (i < weapons.Size()){
n = inv.GetItemName(weapons[i]);
if (!inv.IsItemHeld(weapons[i])){
} else if (weapons[i] == weaponId){
} else if (inv.IsItemBolt(weaponId) && weapons[i] == cro
ssbowId){
} else {
excessiveDamage -= inv.GetItemAttributeValue(wea
pons[i], damageTypeName, /* NOP */, /* NOP */);
}
i += 1;
}
if (!inv.IsItemHeld(weaponId) && !inv.IsItemBolt(weaponId)){
excessiveDamage += inv.GetItemAttributeValue(weaponId, d
amageTypeName, /* NOP */, /* NOP */);
}
damage = CalculateAttributeValue(excessiveDamage, /* NOP */);
return damage;
/* NOP */;
}

public function GetAttributeValue(attributeName : CName, tags : array<CN


ame>, ignoreDeath : Bool) : SAbilityAttributeValue{
var null : SAbilityAttributeValue;
if (abilityManager && abilityManager.IsInitialized() && ignoreDe
ath || super.IsAlive()){
return abilityManager.GetAttributeValue(attributeName, t
ags);
}
null.valueBase = -1;
null.valueAdditive = -1;
null.valueMultiplicative = 0;
return null;
/* NOP */;
}
public function CanAddAttribute(attributeName : CName, abilityName : CNa
me) : Bool{
if (attributeName == 'vitality' && UsesEssence()){
return false;
} else if (attributeName == 'essence' && UsesVitality()){
return false;
}
return true;
/* NOP */;
}
public function GetListOfCannotAddAttributes(attributes : array<CName>){
if (UsesEssence()){
attributes.PushBack(StatEnumToName(0));
} else if (UsesVitality()){
attributes.PushBack(StatEnumToName(1));
}
/* NOP */;
}
public function OnAbilityAdded(abilityName : CName) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
abilityManager.OnAbilityAdded(abilityName);
}
/* NOP */;
}
public function OnAbilityRemoved(abilityName : CName) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
abilityManager.OnAbilityRemoved(abilityName);
}
/* NOP */;
}
public function IsAbilityBlocked(abilityName : CName) : Bool{
return abilityManager.IsAbilityBlocked(abilityName);
/* NOP */;
}
public function BlockAbility(abilityName : CName, block : Bool, cooldown
: Float) : Bool{
return abilityManager.BlockAbility(abilityName, block, cooldown)
;
/* NOP */;
}
public function GetAbilities(includeAbilitiesFromItems : Bool) : array<C
Name>{
var tmp : array<CName>;
GetCharacterStats().GetAbilities(tmp, includeAbilitiesFromItems)
;
return tmp;

/* NOP */;
}
private function GetPureImmortalityFlags() : Int32{
var mask : Int32;
mask = 16777215;
return immortalityFlags & mask;
/* NOP */;
}
public function WillBeUnconscious() : Bool{
var pureImmortalityFlags : Int32;
pureImmortalityFlags = GetPureImmortalityFlags();
return pureImmortalityFlags > 0 && pureImmortalityFlags < 256;
/* NOP */;
}
public function IsImmortal() : Bool{
var pureImmortalityFlags : Int32;
pureImmortalityFlags = GetPureImmortalityFlags();
return pureImmortalityFlags >= 256 && pureImmortalityFlags < 655
36;
/* NOP */;
}
public function IsInvulnerable() : Bool{
var pureImmortalityFlags : Int32;
pureImmortalityFlags = GetPureImmortalityFlags();
return pureImmortalityFlags >= 65536;
/* NOP */;
}
public function IsVulnerable() : Bool{
var pureImmortalityFlags : Int32;
pureImmortalityFlags = GetPureImmortalityFlags();
return pureImmortalityFlags == 0;
/* NOP */;
}
public function GetImmortalityMode() : EActorImmortalityMode{
if (WillBeUnconscious()){
return 3;
} else if (IsInvulnerable()){
return 2;
} else if (IsImmortal()){
return 1;
}
return 0;
/* NOP */;
}
public function LogAllAbilities(){
var attributes : array<CName>;
var i : Int32;
var res : String;
GetWitcherPlayer().GetCharacterStats().GetAllAttributesNames(att
ributes);
i = 1;
while (i < attributes.Size()){
res = NameToString(attributes[i]) + " (" + GetLocStringB
yKeyExt(NameToString(attributes[i])) + ") : " + FloatToString(CalculateAttribute
Value(GetAttributeValue(attributes[i], /* NOP */, /* NOP */), /* NOP */));
LogStats(res);
i += 1;
}
/* NOP */;
}

public function ForceVulnerable(){


var oldMode : EActorImmortalityMode;
if (immortalityFlags > 0){
oldMode = GetImmortalityMode();
/* NOP */;
}
immortalityFlags = 0;
/* NOP */;
}
public function ForceVulnerableImmortalityMode(){
immortalityFlagsCopy = immortalityFlags;
immortalityFlags = 0;
/* NOP */;
}
public function RestoreImmortalityMode(){
immortalityFlags = immortalityFlagsCopy;
/* NOP */;
}
public function SetImmortalityMode(mode : EActorImmortalityMode, channel
: EActorImmortalityChanel, lockMode : Bool){
var oldMode : EActorImmortalityMode;
var channelInt : Int32;
var _shift8 : Int32;
var _shift16 : Int32;
var _shift24 : Int32;
channelInt = channel;
_shift8 = 256;
_shift16 = 65536;
_shift24 = 16777216;
if (!lockMode && immortalityFlags & channelInt * _shift24 != 0){
return;
}
oldMode = GetImmortalityMode();
if (mode == 3){
immortalityFlags = immortalityFlags | channelInt;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft8;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft16;
} else if (mode == 1){
immortalityFlags = immortalityFlags | channelInt * _shif
t8;
immortalityFlags = immortalityFlags & ~channelInt;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft16;
} else if (mode == 2){
immortalityFlags = immortalityFlags | channelInt * _shif
t16;
immortalityFlags = immortalityFlags & ~channelInt;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft8;
} else if (mode == 0){
immortalityFlags = immortalityFlags & ~channelInt;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft8;
immortalityFlags = immortalityFlags & ~channelInt * _shi
ft16;
}
if (lockMode){
immortalityFlags = immortalityFlags | channelInt * _shif

t24;
}
if (oldMode == mode){
return;
}
/* NOP */;
/* NOP */;
}
public function GetTraverser() : CScriptedExplorationTraverser{
return traverser;
/* NOP */;
}
public timer function UpdateTraverser(optional time : Float, optional id
: Int32){
if (traverser){
traverser.Update(time);
}
/* NOP */;
}
public function OnStartTraversingExploration(t : CScriptedExplorationTra
verser) : Bool{
super.SetInteractionPriority(-2);
traverser = t;
return true;
/* NOP */;
}
public function OnFinishTraversingExploration() : Bool{
super.RestoreOriginalInteractionPriority();
traverser = NULL;
return true;
/* NOP */;
}
public function SetCombatStartTime(){
combatStartTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function GetCombatStartTime() : Float{
return combatStartTime;
/* NOP */;
}
public function ResetCombatStartTime(){
combatStartTime = 0;
/* NOP */;
}
public function SetCombatPartStartTime(){
combatPartStartTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function ResetCombatPartStartTime(){
combatPartStartTime = 0;
/* NOP */;
}
public function GetCombatTime() : Float{
var time : Float;
if (combatStartTime){
time = theGame.GetEngineTimeAsSeconds() - combatStartTim
e;
return time;
} else {
return 0;

}
/* NOP */;
}
public function GetCombatPartTime() : Float{
var time : Float;
if (combatPartStartTime){
time = theGame.GetEngineTimeAsSeconds() - combatPartStar
tTime;
return time;
} else {
return 0;
}
/* NOP */;
}
protected function OnCombatModeSet(toggle : Bool){
var movingAgent : CMovingAgentComponent;
movingAgent = super.GetMovingAgentComponent();
if (movingAgent){
movingAgent.EnableCombatMode(toggle);
movingAgent.SetVirtualRadius('testRadius', /* NOP */);
if (toggle){
movingAgent.SetVirtualRadius('CombatCharacterRad
ius', /* NOP */);
} else {
movingAgent.ResetVirtualRadius(/* NOP */);
}
}
/* NOP */;
}
public function HasHitTarget() : Bool{
return hitTargets.Size() != 0;
/* NOP */;
}
public function WasDefeatedFromFistFight() : Bool{
return wasDefeatedFromFistFight;
/* NOP */;
}
public function IsFistFighting() : Bool{
var i : Int32;
var inv : CInventoryComponent;
var weapons : array<SItemUniqueId>;
inv = GetInventory();
weapons = inv.GetHeldWeapons();
i = 0;
while (i < weapons.Size()){
if (inv.IsItemFists(weapons[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnStartFistfightMinigame() : Bool{
PauseHPRegenEffects('FistFightMinigame', -1);
isInFFMiniGame = true;
/* NOP */;
}
public function OnEndFistfightMinigame() : Bool{
ResumeHPRegenEffects('FistFightMinigame');

isInFFMiniGame = false;
/* NOP */;
}
public function IsInFistFightMiniGame() : Bool{
return isInFFMiniGame;
/* NOP */;
}
public function IsInAir() : Bool{
return isInAir;
/* NOP */;
}
public function SetIsInAir(b : Bool){
var critical : CBaseGameplayEffect;
if (b != isInAir){
isInAir = b;
SetBehaviorVariable('IsInAir', isInAir, /* NOP */);
critical = GetCurrentlyAnimatedCS();
if (critical){
if (isInAir){
SignalGameplayEvent('DisableFinisher');
} else {
SignalGameplayEvent('EnableFinisher');
}
}
}
/* NOP */;
}
public latent function RotateTo(target : Vector, duration : Float) : Boo
l{
var vec : Vector;
var pos : Vector;
var heading : Float;
var res : Bool;
if (duration <= 0.000000){
duration = 0.200000;
}
pos = GetWorldPosition();
vec = target - GetWorldPosition();
heading = VecHeading(vec);
res = super.ActionSlideToWithHeading(pos, heading, duration, /*
NOP */);
return res;
/* NOP */;
}
public latent function RotateToNode(node : CNode, duration : Float) : Bo
ol{
var res : Bool;
res = RotateTo(node.GetWorldPosition(), duration);
return res;
/* NOP */;
}
public function OnBehTreeEnded() : Bool{
}
public final function IsAlive() : Bool{
return GetAliveFlag();
/* NOP */;
}
public function Heal(amount : Float){
if (amount <= 0){
return;

}
if (UsesVitality()){
GainStat(0, amount);
} else if (UsesEssence()){
GainStat(1, amount);
}
/* NOP */;
}
public function SetHealthPerc(amount : Float){
var stat : EBaseCharacterStats;
var maxHealth : Float;
if (amount < 0){
return;
}
if (UsesVitality()){
stat = 0;
} else if (UsesEssence()){
stat = 1;
}
maxHealth = GetMaxHealth();
ForceSetStat(stat, amount * maxHealth);
/* NOP */;
}
public function SetHealth(amount : Float){
var stat : EBaseCharacterStats;
if (amount < 0){
return;
}
if (UsesVitality()){
stat = 0;
} else if (UsesEssence()){
stat = 1;
}
ForceSetStat(stat, amount);
/* NOP */;
}
public function IsFrozen() : Bool{
return HasBuff(11);
/* NOP */;
}
public final function SetRotationTargetWithTimeout(node : CNode, clampin
g : Bool, timeout : Float){
if (timeout == 0.000000){
timeout = 10.000000;
}
SetRotationTarget(node, clamping);
AddTimer('ClearRotationTargetTimer', timeout, false, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public final function ClearRotationTargetWithTimeout(){
ClearRotationTarget();
RemoveTimer('ClearRotationTargetTimer', /* NOP */);
/* NOP */;
}
public timer function ClearRotationTargetTimer(optional td : Float, opti
onal id : Int32){
super.ClearRotationTarget();
/* NOP */;
}

public function GetNearestPoint(position : Vector, distance : Float) : V


ector{
var vec : Vector;
vec = GetWorldPosition() - position;
return position + VecNormalize2D(vec) * distance;
/* NOP */;
}
public function GetNearestPointInBothPersonalSpaces(position : Vector) :
Vector{
return GetNearestPointInBothPersonalSpacesAt(GetWorldPosition(),
position);
/* NOP */;
}
public function GetNearestPointInBothPersonalSpacesAt(myPosition : Vecto
r, otherPosition : Vector) : Vector{
var pos : Vector;
var playerRadius : Float;
playerRadius = (CMovingPhysicalAgentComponent)thePlayer.GetMovin
gAgentComponent().GetCapsuleRadius();
pos = playerRadius * VecNormalize2D(otherPosition - myPosition)
+ GetNearestPointInPersonalSpaceAt(myPosition, otherPosition);
return pos;
/* NOP */;
}
public function GetVectorBetweenTwoNearestPoints(actorA : CActor, actorB
: CActor) : Vector{
var actorANearestPoint : Vector;
var actorBNearestPoint : Vector;
actorANearestPoint = actorA.GetNearestPointInPersonalSpace(actor
B.GetWorldPosition());
actorBNearestPoint = actorB.GetNearestPointInPersonalSpace(actor
A.GetWorldPosition());
return actorBNearestPoint - actorANearestPoint;
/* NOP */;
}
public function IsOnGround() : Bool{
var distFromGround : Float;
distFromGround = GetDistanceFromGround(1.500000, /* NOP */);
if (distFromGround < 0.150000){
return true;
} else if (distFromGround < 1.500000){
if (!MAC){
MAC = (CMovingPhysicalAgentComponent)super.GetMo
vingAgentComponent();
}
if (MAC){
return MAC.IsOnGround();
}
}
return false;
/* NOP */;
}
public function IsFalling() : Bool{
if (!MAC){
MAC = (CMovingPhysicalAgentComponent)super.GetMovingAgen
tComponent();
}
if (MAC){
return MAC.IsFalling();
} else {

return false;
}
/* NOP */;
}
public function GetDistanceFromGround(_MaxTestDistance : Float, _Collisi
onGroupNames : array<CName>) : Float{
var l_pos : Vector;
var l_ground : Vector;
var l_normal : Vector;
var l_groundZ : Float;
var l_distance : Float;
l_pos = GetWorldPosition();
if (theGame.GetWorld().NavigationComputeZ(l_pos, l_pos.Z - _MaxT
estDistance, l_pos.Z + _MaxTestDistance, l_groundZ)){
l_distance = l_pos.Z - l_groundZ;
return l_distance;
}
return _MaxTestDistance;
/* NOP */;
}
public function SetGameplayVisibility(b : Bool){
isGameplayVisible = b;
/* NOP */;
}
public function GetGameplayVisibility() : Bool{
return isGameplayVisible;
/* NOP */;
}
public function SetAnimationSpeedMultiplier(mul : Float, overrideExistin
gId : Int32) : Int32{
var causer : SAnimMultiplyCauser;
var finalMul : Float;
var i : Int32;
var size : Int32;
if (overrideExistingId != -1){
size = animationMultiplierCausers.Size();
i = 0;
while (i < size){
if (animationMultiplierCausers[i].id == override
ExistingId){
animationMultiplierCausers[i].mul = mul;
super.SetAnimationTimeMultiplier(Calcula
teFinalAnimationSpeedMultiplier());
return animationMultiplierCausers[i].id;
}
i += 1;
}
}
causer.mul = mul;
causer.id = nextFreeAnimMultCauserId;
nextFreeAnimMultCauserId += 1;
animationMultiplierCausers.PushBack(causer);
super.SetAnimationTimeMultiplier(CalculateFinalAnimationSpeedMul
tiplier());
return causer.id;
/* NOP */;
}
private function CalculateFinalAnimationSpeedMultiplier() : Float{
if (animationMultiplierCausers.Size() > 0){
return animationMultiplierCausers[animationMultiplierCau

sers.Size() - 1].mul;
}
return 1;
/* NOP */;
}
public function ResetAnimationSpeedMultiplier(id : Int32){
var i : Int32;
var size : Int32;
size = animationMultiplierCausers.Size();
if (size == 0){
return;
}
i = 0;
while (i < size){
if (animationMultiplierCausers[i].id == id){
animationMultiplierCausers.Remove(animationMulti
plierCausers[i]);
}
i += 1;
}
if (animationMultiplierCausers.Size() + 1 != size){
LogAssert(false, "CAnimatedComponent.ResetAnimationMulti
plier: invalid causer ID passed, nothing removed!");
return;
}
super.SetAnimationTimeMultiplier(CalculateFinalAnimationSpeedMul
tiplier());
/* NOP */;
}
public final latent function WaitForEndOfSpeach(){
SleepOneFrame();
while (IsSpeaking(/* NOP */)){
Sleep(0.100000);
}
/* NOP */;
}
public function GetAttackableNPCsAndPlayersInRange(range : Float, maxRes
ults : Int32, tag : CName) : array<CActor>{
if (maxResults <= 0){
maxResults = 1000000;
}
return GetNPCsAndPlayersInRange(range, maxResults, tag, 64 + 256
+ 4 + 32);
/* NOP */;
}
public function GetNPCsAndPlayersInRange(range : Float, maxResults : Int
32, tag : CName, queryFlags : Int32) : array<CActor>{
var i : Int32;
var actors : array<CActor>;
var entities : array<CGameplayEntity>;
var actorEnt : CActor;
if (queryFlags & 64 == 0 && queryFlags & 256 == 0 && queryFlags
& 128 == 0){
queryFlags = queryFlags | 64 | 256 | 128;
}
if (maxResults <= 0){
maxResults = 1000000;
}
FindGameplayEntitiesInSphere(entities, GetWorldPosition(), range
, maxResults, tag, queryFlags, this, /* NOP */);

i = 0;
while (i < entities.Size()){
actorEnt = (CActor)entities[i];
if (actorEnt){
actors.PushBack(actorEnt);
}
i += 1;
}
return actors;
/* NOP */;
}
public function GetAttackableNPCsAndPlayersInCone(range : Float, coneDir
: Float, coneAngle : Float, maxResults : Int32, tag : CName) : array<CActor>{
if (maxResults <= 0){
maxResults = 1000000;
}
return GetNPCsAndPlayersInCone(range, coneDir, coneAngle, maxRes
ults, tag, 64 + 256 + 4 + 32);
/* NOP */;
}
public function GetNPCsAndPlayersInCone(range : Float, coneDir : Float,
coneAngle : Float, maxResults : Int32, tag : CName, queryFlags : Int32) : array<
CActor>{
var i : Int32;
var actors : array<CActor>;
var entities : array<CGameplayEntity>;
var actor : CActor;
if (queryFlags & 64 == 0 && queryFlags & 256 == 0 && queryFlags
& 128 == 0){
queryFlags = queryFlags | 64 | 256 | 128;
}
if (maxResults <= 0){
maxResults = 1000000;
}
FindGameplayEntitiesInCone(entities, GetWorldPosition(), coneDir
, coneAngle, range, maxResults, tag, queryFlags, this, /* NOP */);
i = 0;
while (i < entities.Size()){
actor = (CActor)entities[i];
if (actor){
actors.PushBack(actor);
}
i += 1;
}
return actors;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
AddAnimEventCallback('RotateEvent', 'OnAnimEvent_RotateEvent');
AddAnimEventCallback('RotateAwayEvent', 'OnAnimEvent_RotateAwayE
vent');
AddAnimEventCallback('Shake0', 'OnAnimEvent_Shake0');
AddAnimEventCallback('Shake1', 'OnAnimEvent_Shake1');
AddAnimEventCallback('Shake2', 'OnAnimEvent_Shake2');
AddAnimEventCallback('Shake3', 'OnAnimEvent_Shake3');
AddAnimEventCallback('Shake4', 'OnAnimEvent_Shake4');
AddAnimEventCallback('Shake5', 'OnAnimEvent_Shake5');
AddAnimEventCallback('DropItem', 'OnAnimEvent_DropItem');
AddAnimEventCallback('OnGround', 'OnAnimEvent_OnGround');

AddAnimEventCallback('Death', 'OnAnimEvent_Death');
AddAnimEventCallback('MountHorseType', 'OnAnimEvent_MountHorseTy
pe');
AddAnimEventCallback('HorseRidingOn', 'OnAnimEvent_HorseRidingOn
');
effectsUpdateTicking = false;
SetBehaviorVariable('CriticalStateType', 11, /* NOP */);
if (!spawnData.restored){
SetAbilityManager();
if (abilityManager){
abilityManager.Init(this, GetCharacterStats(), s
pawnData.restored, theGame.GetSpawnDifficultyMode());
}
SetEffectManager();
} else {
if (abilityManager){
abilityManager.Init(this, GetCharacterStats(), s
pawnData.restored, theGame.GetSpawnDifficultyMode());
}
if (effectManager){
effectManager.OnLoad(this);
}
}
if (abilityManager){
abilityManager.PostInit();
}
SetGameplayVisibility(true);
MountHorseIfNeeded();
if (effectManager){
ResumeEffects(2, 'SignCast');
}
/* NOP */;
}
protected function SetEffectManager(){
effectManager = new W3EffectManager in this;
effectManager.Initialize(this);
/* NOP */;
}
public function MountHorseIfNeeded(){
var vehicle : CVehicleComponent;
if (usedVehicle){
return;
}
usedVehicle = (CGameplayEntity)EntityHandleGet(usedVehicleHandle
);
if (usedVehicle){
vehicle = (CVehicleComponent)usedVehicle.GetComponentByC
lassName('CVehicleComponent');
vehicle.Mount(this, 4, 0);
}
/* NOP */;
}
public function UpdateSoundInfo(){
var cr4HumanoidCombatComponent : CR4HumanoidCombatComponent;
var defMapping : SSoundInfoMapping;
if (IsHuman()){
cr4HumanoidCombatComponent = (CR4HumanoidCombatComponent
)GetComponentByClassName('CR4HumanoidCombatComponent');
if (cr4HumanoidCombatComponent){
cr4HumanoidCombatComponent.UpdateSoundInfo();

defMapping = cr4HumanoidCombatComponent.GetDefau
ltSoundInfoMapping();
if (defMapping.isDefault){
if (defMapping.soundTypeIdentification !
= 'default' && defMapping.soundTypeIdentification != 'None'){
SoundSwitch("armour_type_movemen
t", defMapping.soundTypeIdentification, /* NOP */, /* NOP */);
}
}
}
}
/* NOP */;
}
public timer function DelaySoundInfoUpdate(optional dt : Float, optional
id : Int32){
UpdateSoundInfo();
/* NOP */;
}
public function OnAppearanceChanged() : Bool{
AddTimer('DelaySoundInfoUpdate', 1, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function RestoreOriginalInteractionPriorityTimer(optional d
eltaTime : Float, optional id : Int32){
super.RestoreOriginalInteractionPriority();
/* NOP */;
}
public function CanBeTeleporting() : Bool{
var temp : EMonsterCategory;
var temp2 : CName;
var temp3 : Bool;
var temp4 : Bool;
var teleports : Bool;
theGame.GetMonsterParamsForActor(this, temp, temp2, teleports, t
emp3, temp4);
return teleports;
/* NOP */;
}
public function CanBeStrafed() : Bool{
var temp : CMonsterParam;
theGame.GetMonsterParamForActor(this, temp);
return temp.canBeStrafed;
/* NOP */;
}
public function CanBeTargeted() : Bool{
var temp : EMonsterCategory;
var temp2 : CName;
var temp3 : Bool;
var temp4 : Bool;
var canBeTargeted : Bool;
if (!IsTargetableByPlayer()){
return false;
}
theGame.GetMonsterParamsForActor(this, temp, temp2, temp3, canBe
Targeted, temp4);
return canBeTargeted;
/* NOP */;
}
public function IsHuman() : Bool{

var monsterCategory : EMonsterCategory;


var temp2 : CName;
var temp3 : Bool;
var temp4 : Bool;
var canBeTargeted : Bool;
if (cachedIsHuman != -1){
return cachedIsHuman > 0;
}
theGame.GetMonsterParamsForActor(this, monsterCategory, temp2, t
emp3, canBeTargeted, temp4);
if (monsterCategory == 11){
cachedIsHuman = 1;
} else {
cachedIsHuman = 0;
}
return cachedIsHuman;
/* NOP */;
}
public function IsWoman() : Bool{
if (cachedIsWoman != -1){
return cachedIsWoman > 0;
}
if (GetMovingAgentComponent().GetName() == "woman_base"){
cachedIsWoman = 1;
} else {
cachedIsWoman = 0;
}
return cachedIsWoman;
/* NOP */;
}
public function IsMan() : Bool{
if (cachedIsMan != -1){
return cachedIsMan > 0;
}
if (GetMovingAgentComponent().GetName() == "man_base"){
cachedIsMan = 1;
} else {
cachedIsMan = 0;
}
return cachedIsMan;
/* NOP */;
}
public function IsMonster() : Bool{
var monsterCategory : EMonsterCategory;
var temp2 : CName;
var temp3 : Bool;
var temp4 : Bool;
var canBeTargeted : Bool;
if (cachedIsMonster != -1){
return cachedIsMonster > 0;
}
theGame.GetMonsterParamsForActor(this, monsterCategory, temp2, t
emp3, canBeTargeted, temp4);
if (MonsterCategoryIsMonster(monsterCategory)){
cachedIsMonster = 1;
} else {
cachedIsMonster = 0;
}
return cachedIsMonster;
/* NOP */;

}
public function IsAnimal() : Bool{
var monsterCategory : EMonsterCategory;
var tmpName : CName;
var tmpBool : Bool;
if (cachedIsAnimal != -1){
return cachedIsAnimal > 0;
}
theGame.GetMonsterParamsForActor(this, monsterCategory, tmpName,
tmpBool, tmpBool, tmpBool);
if (monsterCategory == 14){
cachedIsAnimal = 1;
} else {
cachedIsAnimal = 0;
}
return cachedIsAnimal;
/* NOP */;
}
protected function SetAbilityManager(){
}
public timer function CheckBlockedAbilities(optional dt : Float, optiona
l id : Int32){
var nextCallTime : Float;
nextCallTime = abilityManager.CheckBlockedAbilities(dt);
if (nextCallTime != -1){
AddTimer('CheckBlockedAbilities', nextCallTime, /* NOP *
/, /* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
protected function GetKillAction(ignoreImmortalityMode : Bool, attacker
: CGameplayEntity, source : CName) : W3DamageAction{
var vit : Float;
var ess : Float;
var action : W3DamageAction;
var dmg : CDamageData;
vit = abilityManager.GetStatMax(0);
ess = abilityManager.GetStatMax(1);
if (!IsNameValid(source)){
source = 'Kill';
}
action = new W3DamageAction in theGame.damageMgr;
action.Initialize(attacker, this, theGame, source, 0, 2, false,
false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, MaxF(vit, es
s));
action.SetIgnoreImmortalityMode(ignoreImmortalityMode);
action.SetCanPlayHitParticle(false);
action.SetSuppressHitSounds(true);
return action;
/* NOP */;
}
public function Kill(ignoreImmortalityMode : Bool, attacker : CGameplayE
ntity, source : CName){
var action : W3DamageAction;
if (theGame.CanLog()){
LogDMHits("CActor.Kill: called for actor <<" + this + ">
>", /* NOP */);
}
action = GetKillAction(ignoreImmortalityMode, attacker, /* NOP *

/);
theGame.damageMgr.ProcessAction(action);
delete action;
/* NOP */;
}
private function InterfaceKill(force : Bool, attacker : CActor){
Kill(force, /* NOP */, /* NOP */);
/* NOP */;
}
public function HasStaminaToParry(attActionName : CName) : Bool{
var multiplier : Float;
if (IsHeavyAttack(attActionName)){
multiplier = theGame.params.HEAVY_STRIKE_COST_MULTIPLIER
;
}
return HasStaminaToUseAction(4, 'None', 0, multiplier);
/* NOP */;
}
public function CanParryAttack() : Bool{
return bParryEnabled && IsGuarded();
/* NOP */;
}
public function CanCounterParryAttack(attActionName : CName) : Bool{
return CanParryAttack() && CanPerformCounter() && HasStaminaToPa
rry(attActionName);
/* NOP */;
}
public function FistFightCheck(target : CActor, attacker : CActor, bothU
singFists : Bool) : Bool{
var i : Int32;
var j : Int32;
var size : Int32;
var size2 : Int32;
var targetFists : array<SItemUniqueId>;
var attackerFists : array<SItemUniqueId>;
var targetInv : CInventoryComponent;
var attackerInv : CInventoryComponent;
targetInv = target.GetInventory();
targetFists = targetInv.GetItemsByCategory('fist');
size = targetFists.Size();
if (size <= 0){
return true;
}
attackerInv = attacker.GetInventory();
attackerFists = attackerInv.GetItemsByCategory('fist');
size2 = attackerFists.Size();
if (size2 > 0){
i = 0;
while (i < size){
if (targetInv.IsItemHeld(targetFists[i])){
j = 0;
while (j < size2){
if (attackerInv.IsItemHeld(attac
kerFists[j])){
bothUsingFists = true;
return true;
}
j += 1;
}
return false;

}
i += 1;
}
return true;
} else {
i = 0;
while (i < size){
if (targetInv.IsItemHeld(targetFists[i])){
return false;
}
i += 1;
}
return true;
}
/* NOP */;
}
public function ProcessSwordOrFistHitReaction(target : CActor, attacker
: CActor) : Float{
var i : Int32;
var j : Int32;
var size : Int32;
var targetFists : array<SItemUniqueId>;
var attackerFists : array<SItemUniqueId>;
targetFists = target.GetInventory().GetItemsByCategory('fist');
size = targetFists.Size();
if (size > 0){
attackerFists = attacker.GetInventory().GetItemsByCatego
ry('fist');
i = 0;
while (i < size){
if (target.GetInventory().IsItemHeld(targetFists
[i])){
j = 0;
while (j < attackerFists.Size()){
if (attacker.GetInventory().IsIt
emHeld(attackerFists[j])){
return 1.000000;
}
j += 1;
}
return 0;
}
i += 1;
}
}
return 0.000000;
/* NOP */;
}
public function IsWeaponHeld(itemCategory : CName) : Bool{
var items : array<SItemUniqueId>;
var i : Int32;
var inv : CInventoryComponent;
inv = GetInventory();
items = inv.GetItemsByCategory(itemCategory);
i = 0;
while (i < items.Size()){
if (inv.IsItemHeld(items[i])){
return true;
}
i += 1;

}
return false;
/* NOP */;
}
public function IsAnyWeaponHeld() : Bool{
return IsWeaponHeld('silversword') || IsWeaponHeld('steelsword')
|| IsWeaponHeld('fist');
/* NOP */;
}
public function IsSecondaryWeaponHeld() : Bool{
var heldWeapons : array<SItemUniqueId>;
var isSecondaryWeaponHeld : Bool;
var i : Int32;
var inv : CInventoryComponent;
inv = GetInventory();
heldWeapons = inv.GetHeldWeapons();
i = 0;
while (i < heldWeapons.Size()){
isSecondaryWeaponHeld = inv.ItemHasTag(heldWeapons[i], '
SecondaryWeapon');
if (isSecondaryWeaponHeld){
break;
}
i += 1;
}
return isSecondaryWeaponHeld;
/* NOP */;
}
public function IsSwordWooden() : Bool{
var heldWeapons : array<SItemUniqueId>;
var i : Int32;
var isSwordWooden : Bool;
var inv : CInventoryComponent;
inv = GetInventory();
heldWeapons = inv.GetHeldWeapons();
i = 0;
while (i < heldWeapons.Size()){
isSwordWooden = inv.ItemHasTag(heldWeapons[i], 'Wooden')
;
if (isSwordWooden){
break;
}
i += 1;
}
return isSwordWooden;
/* NOP */;
}
public function IsDeadlySwordHeld() : Bool{
if (IsSwordWooden()){
return false;
}
if (IsSecondaryWeaponHeld()){
return false;
}
if (IsWeaponHeld('fist')){
return false;
}
return true;
/* NOP */;
}

public function SetIsCurrentlyDodging(b : Bool, isRolling : Bool){


isCurrentlyDodging = b;
/* NOP */;
}
public function IsCurrentlyDodging() : Bool{
return isCurrentlyDodging;
/* NOP */;
}
public function SetParryEnabled(flag : Bool){
bParryEnabled = flag;
/* NOP */;
}
public function GetLastAttackRangeName() : CName{
return lastAttackRangeName;
/* NOP */;
}
public function CanPerformCounter() : Bool{
return bCanPerformCounter;
/* NOP */;
}
public function IsGuarded() : Bool{
return bIsGuarded;
/* NOP */;
}
public function SetGuarded(flag : Bool){
if (bIsGuarded == true && flag == false){
lowerGuardTime = theGame.GetEngineTimeAsSeconds();
}
bIsGuarded = flag;
SetBehaviorVariable('bIsGuarded', bIsGuarded, /* NOP */);
/* NOP */;
}
public function CanGuard() : Bool{
var l_delayToWait : Float;
var l_currentDelay : Float;
l_delayToWait = CalculateAttributeValue(GetAttributeValue('delay
_between_raise_guard', /* NOP */, /* NOP */), /* NOP */);
if (l_delayToWait <= 0){
return true;
}
l_currentDelay = theGame.GetEngineTimeAsSeconds() - lowerGuardTi
me;
if (l_currentDelay >= l_delayToWait){
return true;
}
return false;
/* NOP */;
}
public function DisableHitAnimFor(time : Float){
SetCanPlayHitAnim(false);
AddTimer('EnableHitAnim', time, false, /* NOP */, /* NOP */, tru
e, true);
/* NOP */;
}
public function UseAdditiveHit() : Bool{
return useAdditiveHits;
/* NOP */;
}
public function SetUseAdditiveHit(_Flag : Bool, _CriticalCancelAdditiveH
it : Bool, _OneTimeActivation : Bool){

if (_OneTimeActivation){
oneTimeAdditiveHit = _OneTimeActivation;
} else {
useAdditiveHits = _Flag;
}
criticalCancelAdditiveHit = _CriticalCancelAdditiveHit;
/* NOP */;
}
public function UseAdditiveCriticalState() : Bool{
return useAdditiveCriticalStateAnim;
/* NOP */;
}
public function SetUseAdditiveCriticalStateAnim(flag : Bool){
useAdditiveCriticalStateAnim = flag;
/* NOP */;
}
public function SetCanPlayHitAnim(flag : Bool){
RemoveTimer('EnableHitAnim', /* NOP */);
canPlayHitAnim = flag;
/* NOP */;
}
public function CanPlayHitAnim() : Bool{
return canPlayHitAnim;
/* NOP */;
}
public final function StopRotateEventAdjustments(){
var movementAdjustor : CMovementAdjustor;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
movementAdjustor.Cancel(movementAdjustor.GetRequest('RotateEvent
'));
/* NOP */;
}
public function DrainStamina(action : EStaminaActionType, fixedCost : Fl
oat, fixedDelay : Float, abilityName : CName, dt : Float, costMult : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainStamina(action, fixedCost, fixedDela
y, abilityName, dt, costMult);
}
/* NOP */;
}
public function DrainAir(cost : Float, regenDelay : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainAir(cost, regenDelay);
}
/* NOP */;
}
public function DrainSwimmingStamina(cost : Float, regenDelay : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainSwimmingStamina(cost, regenDelay);
}
/* NOP */;
}
public function DrainMorale(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainMorale(amount);

}
/* NOP */;
}
public function DrainVitality(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainVitality(amount);
}
/* NOP */;
}
public function DrainEssence(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.DrainEssence(amount);
}
/* NOP */;
}
public function AddPanic(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.AddPanic(amount);
}
/* NOP */;
}
public function GainStat(stat : EBaseCharacterStats, amount : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.GainStat(stat, amount);
}
/* NOP */;
}
public function UpdateStatMax(stat : EBaseCharacterStats){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.UpdateStatMax(stat);
}
/* NOP */;
}
public function ForceSetStat(stat : EBaseCharacterStats, val : Float){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.ForceSetStat(stat, val);
}
/* NOP */;
}
public function GetPowerStatValue(stat : ECharacterPowerStats, abilityNa
me : CName, ignoreDeath : Bool) : SAbilityAttributeValue{
var null : SAbilityAttributeValue;
if (abilityManager && abilityManager.IsInitialized() && ignoreDe
ath || super.IsAlive()){
return abilityManager.GetPowerStatValue(stat, abilityNam
e);
}
return null;
/* NOP */;
}
public function GetResistValue(stat : ECharacterDefenseStats, points : F
loat, percents : Float){
points = 0;
percents = 0;

if (abilityManager && abilityManager.IsInitialized() && super.Is


Alive()){
abilityManager.GetResistValue(stat, points, percents);
}
/* NOP */;
}
public function ResumeEffects(type : EEffectType, sourceName : CName){
if (effectManager && effectManager.IsReady()){
effectManager.ResumeEffects(type, sourceName);
}
/* NOP */;
}
public function PauseEffects(type : EEffectType, sourceName : CName, sin
gleLock : Bool, duration : Float, useMaxDuration : Bool){
if (effectManager){
effectManager.PauseEffects(type, sourceName, singleLock,
duration, useMaxDuration);
}
/* NOP */;
}
public function HasDefaultAbilitySet() : Bool{
return GetCharacterStats().HasAbilityWithTag(theGame.params.BASE
_ABILITY_TAG, true);
/* NOP */;
}
public function IgnoresDifficultySettings() : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.IgnoresDifficultySettings();
}
return true;
/* NOP */;
}
public function HasStaminaToUseAction(action : EStaminaActionType, abili
tyName : CName, dt : Float, multiplier : Float) : Bool{
var ret : Bool;
var cost : Float;
ret = false;
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
if (multiplier == 0){
multiplier = 1;
}
cost = multiplier * GetStaminaActionCost(action, ability
Name, dt);
ret = GetStat(2, /* NOP */) >= cost;
}
return ret;
/* NOP */;
}
public function GetStaminaActionCost(action : EStaminaActionType, abilit
yName : CName, dt : Float) : Float{
var cost : Float;
var delay : Float;
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.GetStaminaActionCost(action, cost, delay,
0, 0, abilityName, dt, /* NOP */);
return cost;
}
return -1;

/* NOP */;
}
public function GetStaminaActionDelay(action : EStaminaActionType, abili
tyName : CName, dt : Float) : Float{
var cost : Float;
var delay : Float;
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.GetStaminaActionCost(action, cost, delay,
0, 0, abilityName, dt, /* NOP */);
return delay;
}
return 0;
/* NOP */;
}
public function GetHealthPercents() : Float{
if (!abilityManager || !abilityManager.IsInitialized()){
return -1;
}
if (UsesVitality()){
return abilityManager.GetStatPercents(0);
} else if (UsesEssence()){
return abilityManager.GetStatPercents(1);
} else {
return -1;
}
/* NOP */;
}
public final function GetHealth() : Float{
if (!abilityManager || !abilityManager.IsInitialized()){
return -1;
}
if (UsesVitality()){
return abilityManager.GetStat(0, /* NOP */);
} else if (UsesEssence()){
return abilityManager.GetStat(1, /* NOP */);
} else {
return -1;
}
/* NOP */;
}
public function GetStaminaPercents() : Float{
if (!abilityManager || !abilityManager.IsInitialized()){
return -1;
}
return abilityManager.GetStatPercents(2);
/* NOP */;
}
public function GetMaxHealth() : Float{
var vit : Bool;
var ess : Bool;
vit = UsesVitality();
ess = UsesEssence();
if (vit && !ess){
return GetStatMax(0);
} else if (!vit && ess){
return GetStatMax(1);
} else {
return -1;
}

/* NOP */;
}
public function GetCurrentHealth() : Float{
var vit : Bool;
var ess : Bool;
vit = UsesVitality();
ess = UsesEssence();
if (vit && !ess){
return GetStat(0, /* NOP */);
} else if (!vit && ess){
return GetStat(1, /* NOP */);
} else {
return -1;
}
/* NOP */;
}
public function UsesVitality() : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.UsedHPType() == 0;
}
return false;
/* NOP */;
}
public function UsesEssence() : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.UsedHPType() == 1;
}
return false;
/* NOP */;
}
public function GetStat(stat : EBaseCharacterStats, ignoreLock : Bool) :
Float{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.GetStat(stat, ignoreLock);
}
return -1;
/* NOP */;
}
public function GetStatMax(stat : EBaseCharacterStats) : Float{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.GetStatMax(stat);
}
return -1;
/* NOP */;
}
public function GetStats(stat : EBaseCharacterStats, curr : Float, max :
Float){
curr = -1;
max = -1;
if (abilityManager && abilityManager.IsInitialized()){
abilityManager.GetStats(stat, curr, max);
}
/* NOP */;
}
public function GetStatPercents(stat : EBaseCharacterStats) : Float{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.GetStatPercents(stat);
}
return -1;
/* NOP */;

}
public function GetThreatLevel() : Int32{
return 0;
/* NOP */;
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
var playerAttacker : CPlayer;
var attackName : CName;
var animatedComponent : CAnimatedComponent;
var buff : W3Effect_Frozen;
var buffs : array<CBaseGameplayEffect>;
var i : Int32;
var mutagen : CBaseGameplayEffect;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var lifeLeech : Float;
var health : Float;
var stamina : Float;
var attackAction : W3Action_Attack;
var wasAlive : Bool;
var hudModuleDamageType : EFloatingValueType;
playerAttacker = (CPlayer)action.attacker;
wasAlive = super.IsAlive();
buffs = GetBuffs(11, /* NOP */, /* NOP */);
i = 0;
while (i < buffs.Size()){
buff = (W3Effect_Frozen)buffs[i];
if (buff.KillOnHit()){
action.processedDmg.vitalityDamage = GetStatMax(
0);
action.processedDmg.essenceDamage = GetStatMax(1
);
if (action.attacker == thePlayer){
ShowFloatingValue(3, 0, false, /* NOP */
);
}
break;
}
i += 1;
}
if (action.processedDmg.vitalityDamage > 0 && UsesVitality()){
DrainVitality(action.processedDmg.vitalityDamage);
action.SetDealtDamage();
}
if (action.processedDmg.essenceDamage > 0 && UsesEssence()){
DrainEssence(action.processedDmg.essenceDamage);
action.SetDealtDamage();
}
if (action.processedDmg.moraleDamage > 0){
DrainMorale(action.processedDmg.moraleDamage);
}
if (action.processedDmg.staminaDamage > 0){
DrainStamina(13, action.processedDmg.staminaDamage, 0, /
* NOP */, /* NOP */, /* NOP */);
}
ShouldAttachArrowToPlayer(action);
if (action.attacker && action.attacker == thePlayer || (CBaseGam
eplayEffect)action.causer && !action.GetUnderwaterDisplayDamageHack()){
attackAction = (W3Action_Attack)action;
if (attackAction && attackAction.GetInstantKill()){

hudModuleDamageType = 3;
} else if (attackAction && attackAction.IsCriticalHit())
{
hudModuleDamageType = 1;
} else if (action.IsDoTDamage()){
hudModuleDamageType = 4;
} else {
hudModuleDamageType = 0;
}
ShowFloatingValue(hudModuleDamageType, action.GetDamageD
ealt(), hudModuleDamageType == 4, /* NOP */);
}
if (action.attacker && !action.IsDoTDamage() && wasAlive && acti
on.GetDTCount() > 0 && !action.GetUnderwaterDisplayDamageHack()){
theGame.witcherLog.CacheCombatDamageMessage(action.attac
ker, this, action.GetDamageDealt());
theGame.witcherLog.AddCombatDamageMessage(action.DealtDa
mage());
}
if (playerAttacker){
if (thePlayer.HasBuff(79)){
mutagen = thePlayer.GetBuff(79, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(mutagen.GetAbilityName(), 'lifeLeech', min, max);
lifeLeech = CalculateAttributeValue(GetAttribute
RandomizedValue(min, max), /* NOP */);
if (UsesVitality()){
lifeLeech = lifeLeech * action.processed
Dmg.vitalityDamage;
} else if (UsesEssence()){
lifeLeech = lifeLeech * action.processed
Dmg.essenceDamage;
} else {
lifeLeech = 0;
}
thePlayer.GainStat(0, lifeLeech);
}
}
if (playerAttacker && action.IsActionMelee()){
attackName = (W3Action_Attack)action.GetAttackName();
if (thePlayer.HasBuff(76) && action.DealsAnyDamage() &&
thePlayer.IsHeavyAttack(attackName) && thePlayer.GetStat(2, /* NOP */) > 0){
mutagen = thePlayer.GetBuff(76, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(mutagen.GetAbilityName(), 'staminaCostPerc', min, max);
stamina = CalculateAttributeValue(GetAttributeRa
ndomizedValue(min, max), /* NOP */);
stamina *= thePlayer.GetStat(2, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(mutagen.GetAbilityName(), 'healthReductionPerc', min, max);
health = CalculateAttributeValue(GetAttributeRan
domizedValue(min, max), /* NOP */);
if (UsesVitality()){
health *= GetStat(0, /* NOP */);
DrainVitality(health);
thePlayer.DrainStamina(13, stamina, 0.50
0000, /* NOP */, /* NOP */, /* NOP */);
} else if (UsesEssence()){
health *= GetStat(1, /* NOP */);
DrainEssence(health);

thePlayer.DrainStamina(13, stamina, 0.50


0000, /* NOP */, /* NOP */, /* NOP */);
}
if (health > 0){
action.SetDealtDamage();
}
}
}
if (!super.IsAlive()){
OnDeath(action);
}
super.SignalGameplayEvent('DamageTaken');
/* NOP */;
}
public function Revive(){
var maxVitality : Float;
var maxEssence : Float;
if (!super.IsAlive() || IsKnockedUnconscious()){
OnRevived();
if (effectManager){
effectManager.OnOwnerRevived();
}
abilityManager.OnOwnerRevived();
}
/* NOP */;
}
public function ApplyActionEffects(action : W3DamageAction) : Bool{
if (effectManager){
return effectManager.AddEffectsFromAction(action);
}
return false;
/* NOP */;
}
public function ReactToReflectedAttack(target : CGameplayEntity){
var hp : Float;
var dmg : Float;
var action : W3DamageAction;
action = new W3DamageAction in this;
action.Initialize(target, this, NULL, 'None', 4, 0, true, false,
false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.SetHitAnimationPlayType(1);
if (UsesVitality()){
hp = GetStat(0, /* NOP */);
} else {
hp = GetStat(1, /* NOP */);
}
if (hp <= 1){
dmg = 0.000000;
} else {
dmg = 1;
}
action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, dmg);
(CActor)target.PlayEffectOnHeldWeapon('light_block', /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
/* NOP */;
}
public function ReactToBeingHit(damageAction : W3DamageAction, buffNotAp
plied : Bool) : Bool{
var animType : EHitReactionType;

var receivedAnyDamage : Bool;


var isParriedOrCountered : Bool;
var playHitAnim : Bool;
var criticalAllowsHit : Bool;
var immortalDebugHack : Bool;
var hitAnimationPlayType : EActionHitAnim;
var animPlayed : Bool;
var attackAction : W3Action_Attack;
var hud : CR4ScriptedHud;
OnReactToBeingHit(damageAction);
hitAnimationPlayType = damageAction.GetHitAnimationPlayType();
receivedAnyDamage = damageAction.DealtDamage();
attackAction = (W3Action_Attack)damageAction;
animPlayed = false;
if (hitAnimationPlayType != 2){
playHitAnim = false;
if (GetImmortalityMode() == 2 && this == thePlayer){
playHitAnim = false;
} else if (hitAnimationPlayType == 1){
playHitAnim = true;
} else {
if (effectManager){
criticalAllowsHit = CriticalBuffIsHitAll
owed(effectManager.GetCurrentlyAnimatedCS(), damageAction.GetHitReactionType());
}
isParriedOrCountered = attackAction && attackAct
ion.IsParried() || attackAction.IsCountered() || attackAction.WasDodged();
immortalDebugHack = GetImmortalityMode() == 1 &&
!isParriedOrCountered;
if (HasAbility('IgnoreHitAnimFromSigns')){
playHitAnim = false;
} else if (damageAction.attacker == thePlayer &&
thePlayer.GetAttitude(this) == 0 && !HasBuff(36)){
playHitAnim = false;
} else if (receivedAnyDamage || immortalDebugHac
k && CanPlayHitAnim() && criticalAllowsHit){
playHitAnim = true;
} else if (buffNotApplied && damageAction.IsActi
onWitcherSign()){
playHitAnim = true;
} else if (CanPlayHitAnim()){
if (receivedAnyDamage && useAdditiveHits
|| oneTimeAdditiveHit){
playHitAnim = true;
} else if (!receivedAnyDamage && !isParr
iedOrCountered && criticalAllowsHit){
playHitAnim = true;
}
}
}
if (playHitAnim){
if (useAdditiveHits || oneTimeAdditiveHit && !cr
iticalCancelAdditiveHit && attackAction.IsCriticalHit()){
animType = ModifyHitSeverityReaction(thi
s, damageAction.GetHitReactionType());
if (animType != 0){
SetDetailedHitReaction(damageAct
ion.GetSwingType(), damageAction.GetSwingDirection());
}
damageAction.additiveHitReactionAnimRequ

ested = true;
oneTimeAdditiveHit = false;
} else if (hitAnimationPlayType == 1 || CanPlayH
itAnim() && hitAnimationPlayType == 0){
animType = ModifyHitSeverityReaction(thi
s, damageAction.GetHitReactionType());
if (animType != 0){
PlayHitAnimation(damageAction, a
nimType);
animPlayed = true;
}
}
}
}
lastWasHitTime = theGame.GetEngineTimeAsSeconds();
lastWasAttackedTime = lastWasHitTime;
return animPlayed;
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
RemoveAllBuffsOfType(11);
super.OnFireHit(source);
/* NOP */;
}
public final function ProcessHitSound(damageAction : W3DamageAction, hit
AnimPlayed : Bool){
var noHitSound : Bool;
var playHitReactionSfx : Bool;
var playHitReactionSfxOverrides : Bool;
var npcVictim : CNewNPC;
noHitSound = damageAction.SuppressHitSounds();
if (!IsAlive() && damageAction.IsDoTDamage() || theGame.IsDialog
OrCutscenePlaying()){
noHitSound = true;
}
if (noHitSound){
SoundSwitch("opponent_weapon_type", 'empty', /* NOP */,
/* NOP */);
SoundSwitch("opponent_weapon_size", 'None', /* NOP */, /
* NOP */);
return;
}
SetHitSoundData(damageAction);
npcVictim = (CNewNPC)damageAction.victim;
if (!hitAnimPlayed || npcVictim && !npcVictim.CanPlayHitAnim()){
playHitReactionSfx = damageAction.DealtDamage() && !dama
geAction.IsDoTDamage() && damageAction.GetBuffSourceName() != "FallingDamage";
playHitReactionSfxOverrides = (W3Petard)damageAction.cau
ser;
if (playHitReactionSfx || playHitReactionSfxOverrides){
if (damageAction.GetHitReactionType() == 2){
SoundEvent("cmb_play_hit_heavy", /* NOP
*/, /* NOP */);
} else {
SoundEvent("cmb_play_hit_light", /* NOP
*/, /* NOP */);
}
}
}
/* NOP */;

}
public function SetHitSoundData(action : W3DamageAction){
var weaponMeshSoundTypeIdentification : CName;
var soundMonsterName : CName;
var weaponMeshSoundSizeIdentification : CName;
var armourMeshSoundSizeIdentification : CName;
var i : Int32;
var boneIndex : Int32;
var weaponComponents : array<CComponent>;
var monsterCategory : EMonsterCategory;
var isTeleporting : Bool;
var canBeTargeted : Bool;
var canBeHitByFists : Bool;
var category : CName;
var weaponEntity : CItemEntity;
var attackAction : W3Action_Attack;
var weaponId : SItemUniqueId;
var nodeCauser : CNode;
var isByArrow : Bool;
var cr4HumanoidCombatComponent : CR4HumanoidCombatComponent;
attackAction = (W3Action_Attack)action;
isByArrow = (W3ArrowProjectile)action.causer;
nodeCauser = (CNode)action.causer;
if (attackAction && attackAction.IsActionMelee() || isByArrow){
weaponId = attackAction.GetWeaponId();
weaponEntity = action.attacker.GetInventory().GetItemEnt
ityUnsafe(weaponId);
category = action.attacker.GetInventory().GetItemCategor
y(weaponId);
if (category == 'monster_weapon'){
theGame.GetMonsterParamsForActor((CActor)action.
attacker, monsterCategory, soundMonsterName, isTeleporting, canBeTargeted, canBe
HitByFists);
SoundSwitch("opponent_weapon_type", 'monster', /
* NOP */, /* NOP */);
SoundSwitch("opponent_weapon_size", soundMonster
Name, /* NOP */, /* NOP */);
} else if (category == 'fist'){
SoundSwitch("opponent_weapon_type", 'fist', /* N
OP */, /* NOP */);
SoundSwitch("opponent_weapon_size", 'None', /* N
OP */, /* NOP */);
} else if (isByArrow){
SoundSwitch("opponent_weapon_type", "arrow", /*
NOP */, /* NOP */);
} else {
weaponComponents = weaponEntity.GetComponentsByC
lassName('CMeshComponent');
if (weaponComponents.Size() > 0 && weaponCompone
nts[0]){
weaponMeshSoundTypeIdentification = GetM
eshSoundTypeIdentification(weaponComponents[0]);
weaponMeshSoundSizeIdentification = GetM
eshSoundSizeIdentification(weaponComponents[0]);
SoundSwitch("opponent_weapon_type", weap
onMeshSoundTypeIdentification, /* NOP */, /* NOP */);
SoundSwitch("opponent_weapon_size", weap
onMeshSoundSizeIdentification, /* NOP */, /* NOP */);
}
}

boneIndex = attackAction.GetHitBoneIndex();
if (boneIndex == super.GetHeadBoneIndex()){
SoundSwitch("hit_location", "head", /* NOP */, /
* NOP */);
} else {
SoundSwitch("hit_location", "body", /* NOP */, /
* NOP */);
}
SoundSwitch("opponent_attack_type", attackAction.GetSoun
dAttackType(), /* NOP */, /* NOP */);
cr4HumanoidCombatComponent = (CR4HumanoidCombatComponent
)GetComponentByClassName('CR4HumanoidCombatComponent');
if (cr4HumanoidCombatComponent){
armourMeshSoundSizeIdentification = cr4HumanoidC
ombatComponent.GetSoundTypeIdentificationForBone(boneIndex);
if (armourMeshSoundSizeIdentification != 'defaul
t' && armourMeshSoundSizeIdentification != 'None'){
SoundSwitch("armour_type", armourMeshSou
ndSizeIdentification, /* NOP */, /* NOP */);
}
}
} else if (action.IsActionWitcherSign()){
SetDamageActionMagicHitSound((CEntity)action.causer);
} else if ((W3CiriPhantom)action.attacker){
SoundSwitch("opponent_weapon_type", 'ciri_spec_ability',
/* NOP */, /* NOP */);
} else if ((W3SnowballProjectile)action.causer || nodeCauser &&
nodeCauser.HasTag('Snowball')){
SoundSwitch("opponent_weapon_type", 'snowball', /* NOP *
/, /* NOP */);
} else if ((W3Petard)action.causer){
SoundSwitch("opponent_attack_type", (W3Petard)action.cau
ser.GetAudioImpactName(), /* NOP */, /* NOP */);
weaponComponents = (W3Petard)action.causer.GetComponents
ByClassName('CMeshComponent');
if (weaponComponents.Size() > 0 && weaponComponents[0]){
weaponMeshSoundTypeIdentification = GetMeshSound
TypeIdentification(weaponComponents[0]);
weaponMeshSoundSizeIdentification = GetMeshSound
SizeIdentification(weaponComponents[0]);
SoundSwitch("opponent_weapon_type", weaponMeshSo
undTypeIdentification, /* NOP */, /* NOP */);
SoundSwitch("opponent_weapon_size", weaponMeshSo
undSizeIdentification, /* NOP */, /* NOP */);
}
} else if (isByArrow){
SoundSwitch("opponent_weapon_type", 'arrow', /* NOP */,
/* NOP */);
SoundSwitch("opponent_attack_type", 'wpn_arrow', /* NOP
*/, /* NOP */);
}
/* NOP */;
}
protected function SetDamageActionMagicHitSound(causer : CEntity){
SoundSwitch("opponent_weapon_type", 'magic', /* NOP */, /* NOP *
/);
if ((W3IgniProjectile)causer){
SoundSwitch("opponent_weapon_size", 'magic_igni', /* NOP
*/, /* NOP */);
}

if ((W3AardProjectile)causer){
SoundSwitch("opponent_weapon_size", 'magic_aard', /* NOP
*/, /* NOP */);
}
if ((W3YrdenEntity)causer){
SoundSwitch("opponent_weapon_size", 'magic_yrden', /* NO
P */, /* NOP */);
}
if ((W3QuenEntity)causer){
SoundSwitch("opponent_weapon_size", 'magic_quen', /* NOP
*/, /* NOP */);
}
/* NOP */;
}
public function PlayHitEffect(damageAction : W3DamageAction){
var effectName : CName;
var attackAction : W3Action_Attack;
var actorAttacker : CActor;
attackAction = (W3Action_Attack)damageAction;
actorAttacker = (CActor)damageAction.attacker;
if (attackAction && actorAttacker && actorAttacker.GetInventory(
).ItemHasTag(attackAction.GetWeaponId(), 'Wooden')){
if (actorAttacker.IsHeavyAttack(attackAction.GetAttackNa
me())){
effectName = 'wood_heavy_hit';
} else {
effectName = 'wood_light_hit';
}
} else if (attackAction && actorAttacker && damageAction.DealsAn
yDamage() && !actorAttacker.GetInventory().ItemHasTag(attackAction.GetWeaponId()
, 'MagicWeaponFX') && actorAttacker.IsWeaponHeld('fist')){
effectName = 'fistfight_heavy_hit';
} else {
effectName = damageAction.GetHitEffect(IsAttackerAtBack(
damageAction.attacker), !damageAction.DealsAnyDamage());
}
if (IsNameValid(effectName)){
PlayEffect(effectName, /* NOP */);
}
/* NOP */;
}
public function OnReactToBeingHit(out damageAction : W3DamageAction) : B
ool{
}
public function InterruptCombatFocusMode(){
}
protected function PlayHitAnimation(out damageAction : W3DamageAction, o
ut animType : EHitReactionType){
}
public function SetHitReactionDirection(attacker : CNode){
var victimToAttackerAngle : Float;
victimToAttackerAngle = NodeToNodeAngleDistance(attacker, this);
if (AbsF(victimToAttackerAngle) <= 90){
SetBehaviorVariable('HitReactionDirection', 0, /* NOP */
);
} else if (AbsF(victimToAttackerAngle) > 90){
SetBehaviorVariable('HitReactionDirection', 1, /* NOP */
);
}
if (victimToAttackerAngle > 45 && victimToAttackerAngle < 135){

SetBehaviorVariable('HitReactionSide', 2, /* NOP */);


} else if (victimToAttackerAngle < -45 && victimToAttackerAngle
> -135){
SetBehaviorVariable('HitReactionSide', 1, /* NOP */);
} else {
SetBehaviorVariable('HitReactionSide', 0, /* NOP */);
}
/* NOP */;
}
public function SetDetailedHitReaction(type : EAttackSwingType, dir : EA
ttackSwingDirection){
SetBehaviorVariable('HitSwingDirection', dir, /* NOP */);
SetBehaviorVariable('HitSwingType', type, /* NOP */);
/* NOP */;
}
public function OnBlockingSceneStarted(scene : CStoryScene) : Bool{
SetKinematic(true);
SetImmortalityMode(2, 4, /* NOP */);
super.SetTemporaryAttitudeGroup('geralt_friendly', 4);
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
SetImmortalityMode(0, 4, /* NOP */);
super.ResetTemporaryAttitudeGroup(4);
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
OnFocusModeSound(false);
SetFocusModeSoundEffectType(3);
super.StopAllVoicesets(/* NOP */);
if (effectManager){
if (WillBeUnconscious()){
effectManager.OwnerHasEnteredUnconscious();
} else {
effectManager.OwnerHasDied();
}
}
SetFocusModeVisibility(0, /* NOP */);
GetMovingAgentComponent().SetEnabledFeetIK(false, 0.500000);
/* NOP */;
}
public function OnRevived(){
wasDefeatedFromFistFight = false;
super.SignalGameplayEvent('OnRevive');
super.SetAlive(true);
GetMovingAgentComponent().SetEnabledFeetIK(true, 0.500000);
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
super.StopRotateEventAdjustments();
/* NOP */;
}
public function OnCanFindPath(sender : CActor) : Bool{
}
public function OnCannotFindPath(sender : CActor) : Bool{
}
public function OnBecomeAwareAndCanAttack(sender : CActor) : Bool{
}
public function OnBecomeUnawareOrCannotAttack(sender : CActor) : Bool{
}

public
}
public
}
public
}
public
}
public

function OnApproachAttack(sender : CActor) : Bool{


function OnApproachAttackEnd(sender : CActor) : Bool{
function OnAttack(sender : CActor) : Bool{
function OnAttackEnd(sender : CActor) : Bool{
function OnAxiied(attacker : CActor) : Bool{
var i : Int32;
var victimTags : array<CName>;
var attackerTags : array<CName>;
victimTags = GetTags();
attackerTags = attacker.GetTags();
AddHitFacts(victimTags, attackerTags, "_axii_hit", /* NOP */, /*

NOP */);
/* NOP */;
}
public function SetEffectsUpdateTicking(on : Bool, dontCheckEffectsManag
er : Bool){
if (on){
if (!effectsUpdateTicking){
if (abilityManager && abilityManager.IsInitializ
ed() && dontCheckEffectsManager || effectManager && effectManager.IsReady()){
effectsUpdateTicking = true;
AddTimer('EffectsUpdate', 0.001000, true
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
} else if (effectsUpdateTicking && effectManager && effectManage
r.CanBeRemoved()){
effectsUpdateTicking = false;
RemoveTimer('EffectsUpdate', /* NOP */);
}
/* NOP */;
}
public function IsEffectsUpdateTicking() : Bool{
return effectsUpdateTicking;
/* NOP */;
}
public function StartVitalityRegen() : Bool{
if (effectManager){
return effectManager.StartVitalityRegen();
}
return false;
/* NOP */;
}
public function StopVitalityRegen(){
if (effectManager){
effectManager.StopVitalityRegen();
}
/* NOP */;
}
public function StartEssenceRegen() : Bool{
if (effectManager){
return effectManager.StartEssenceRegen();
}
return false;
/* NOP */;
}

public function StopEssenceRegen(){


if (effectManager){
effectManager.StopEssenceRegen();
}
/* NOP */;
}
public function StartStaminaRegen() : Bool{
if (effectManager){
return effectManager.StartStaminaRegen();
}
return false;
/* NOP */;
}
public function StopStaminaRegen(){
if (effectManager){
effectManager.StopStaminaRegen();
}
/* NOP */;
}
public function StartMoraleRegen() : Bool{
if (effectManager){
return effectManager.StartMoraleRegen();
}
return false;
/* NOP */;
}
public function StopMoraleRegen(){
if (effectManager){
effectManager.StopMoraleRegen();
}
/* NOP */;
}
public function StartPanicRegen() : Bool{
if (effectManager){
return effectManager.StartPanicRegen();
}
return false;
/* NOP */;
}
public function StopPanicRegen(){
if (effectManager){
effectManager.StopPanicRegen();
}
/* NOP */;
}
public function StartAirRegen() : Bool{
if (effectManager){
return effectManager.StartAirRegen();
}
return false;
/* NOP */;
}
public function StopAirRegen(){
if (effectManager){
effectManager.StopAirRegen();
}
/* NOP */;
}
public function StartSwimmingStaminaRegen() : Bool{
if (effectManager){

return effectManager.StartSwimmingStaminaRegen();
}
return false;
/* NOP */;
}
public function StopSwimmingStaminaRegen(){
if (effectManager){
effectManager.StopSwimmingStaminaRegen();
}
/* NOP */;
}
public timer function EffectsUpdate(optional deltaTime : Float, optional
id : Int32){
if (effectManager){
effectManager.PerformUpdate(deltaTime);
}
/* NOP */;
}
public function UpdateRequestedDirectionVariables(headingYawWS : Float,
orientationYawWS : Float){
SetBehaviorVariable('requestedMovementDirection', AngleNormalize
(headingYawWS), /* NOP */);
SetBehaviorVariable('requestedFacingDirection', AngleNormalize(o
rientationYawWS), /* NOP */);
SetBehaviorVariable('requestedMovementDirectionForOverlay', Angl
eNormalize(headingYawWS), /* NOP */);
SetBehaviorVariable('requestedFacingDirectionForOverlay', AngleN
ormalize(orientationYawWS), /* NOP */);
/* NOP */;
}
protected function CriticalBuffInformBehavior(out buff : CBaseGameplayEf
fect){
}
public function GetNewRequestedCS() : CBaseGameplayEffect{
return newRequestedCS;
/* NOP */;
}
public function SetNewRequestedCS(buff : CBaseGameplayEffect){
newRequestedCS = buff;
/* NOP */;
}
public function StartCSAnim(buff : CBaseGameplayEffect) : Bool{
LogCritical("Received request to start CS anim for <<" + GetBuff
CriticalType(buff) + ">>");
if (effectManager && effectManager.GetCurrentlyAnimatedCS() == b
uff){
LogCritical("ASSERT: Trying to start anims for currently
played critical state - aborting!");
return false;
}
if (newRequestedCS == buff){
return false;
}
if (this == thePlayer && IsUsingVehicle()){
return false;
}
if (GetCurrentStateName() == 'TraverseExploration'){
super.ActionCancelAll();
}
newRequestedCS = buff;

SetBehaviorVariable('CriticalStateType', GetBuffCriticalType(buf
f), /* NOP */);
SetBehaviorVariable('bCriticalState', 1, /* NOP */);
return true;
/* NOP */;
}
public function OnCriticalStateAnimStart() : Bool{
if (!newRequestedCS){
LogCritical("Aborting start of new CS - it got deleted i
n the meantime");
return false;
}
LogCritical("Started anim of CS <<" + GetBuffCriticalType(newReq
uestedCS) + ">>");
if (effectManager){
effectManager.SetCurrentlyAnimatedCS(newRequestedCS);
}
newRequestedCS = NULL;
return true;
/* NOP */;
}
public function CriticalEffectAnimationInterrupted(reason : String) : Bo
ol{
var buff : CBaseGameplayEffect;
if (effectManager){
buff = effectManager.GetCurrentlyAnimatedCS();
if (buff){
if (CriticalBuffIsDestroyedOnInterrupt(buff)){
effectManager.RemoveEffect(effectManager
.GetCurrentlyAnimatedCS(), true);
}
effectManager.SetCurrentlyAnimatedCS(NULL);
SetBehaviorVariable('bCriticalState', 0, /* NOP
*/);
SetBehaviorVariable('CriticalStateType', 11, /*
NOP */);
LogCritical("Critical effect animation gets inte
rrupted, reason: " + reason);
return true;
}
}
return false;
/* NOP */;
}
public function RequestCriticalAnimStop(dontSetCriticalToStopped : Bool)
{
var currentlyAnimatedCritical : CBaseGameplayEffect;
var critType : ECriticalStateType;
if (effectManager){
currentlyAnimatedCritical = effectManager.GetCurrentlyAn
imatedCS();
}
critType = GetBuffCriticalType(currentlyAnimatedCritical);
if (currentlyAnimatedCritical){
LogCritical("Requesting CS anim stop for <<" + critType
+ ">>, time remaining = " + NoTrailZeros(currentlyAnimatedCritical.GetDurationLe
ft()));
} else {
LogCritical("Requesting CS anim stop but there is no cri
tical playing animation right now");

}
if (!dontSetCriticalToStopped && super.IsAlive()){
SetBehaviorVariable('bCriticalStopped', 1, /* NOP */);
}
SignalGameplayEvent('DisableFinisher');
SignalGameplayEventParamInt('StoppingEffect', critType);
/* NOP */;
}
public function CriticalStateAnimStopped(forceRemoveBuff : Bool){
var buffToStop : CBaseGameplayEffect;
var findNewBuff : Bool;
var buggedCS : Bool;
var buff : CBaseGameplayEffect;
var csType : ECriticalStateType;
if (!ChooseNextCriticalBuffForAnim()){
SetBehaviorVariable('CriticalStateType', 11, /* NOP */);
}
if (effectManager){
buff = effectManager.GetCurrentlyAnimatedCS();
}
if (buff){
csType = GetBuffCriticalType(buff);
LogCritical("Stopping CS animation for <<" + csType + ">
>");
if (forceRemoveBuff || buff.GetDurationLeft() < 0 || !bu
ff.IsActive() || CriticalBuffIsDestroyedOnInterrupt(buff)){
LogCritical("Buff <<" + csType + ">> gets remove
d (CriticalStateAnimStopped)");
effectManager.RemoveEffect(effectManager.GetCurr
entlyAnimatedCS(), true);
} else {
LogCritical("Buff <<" + csType + ">> gets moved
to background and won't be played now but isn't removed yet. Duration left = " +
NoTrailZeros(buff.GetDurationLeft()));
effectManager.SetCurrentlyAnimatedCS(NULL);
}
}
/* NOP */;
}
public function ChooseNextCriticalBuffForAnim() : CBaseGameplayEffect{
var max : Int32;
var val : Int32;
var i : Int32;
var eff : array<CBaseGameplayEffect>;
var buff : CBaseGameplayEffect;
if (!effectManager){
return NULL;
}
eff = effectManager.GetCriticalBuffs();
eff.Remove(GetCurrentlyAnimatedCS());
buff = NULL;
i = 0;
while (i < eff.Size()){
if (!eff[i].IsActive()){
} else if (!CriticalEffectCanPlayAnimation(eff[i])){
} else {
val = CalculateCriticalStateTypePriority(GetBuff
CriticalType(eff[i]));
if (val >= max){
max = val;

buff = eff[i];
}
}
i += 1;
}
return buff;
/* NOP */;
}
public function ChooseCurrentCriticalBuffForAnim() : CBaseGameplayEffect
{
var tempType : ECriticalStateType;
var max : Int32;
var val : Int32;
var i : Int32;
var size : Int32;
var maxSet : Bool;
var eff : array<CBaseGameplayEffect>;
var buff : CBaseGameplayEffect;
if (!effectManager){
return NULL;
}
eff = effectManager.GetCurrentEffects(/* NOP */, /* NOP */, /* N
OP */);
size = eff.Size();
maxSet = false;
buff = NULL;
i = 0;
while (i < size){
tempType = GetBuffCriticalType(eff[i]);
if (tempType == 11){
} else if (eff[i].GetDurationLeft() <= 0 || !eff[i].IsAc
tive()){
effectManager.RemoveEffect(eff[i], /* NOP */);
} else if (tempType != 11){
if (!CriticalEffectCanPlayAnimation(eff[i])){
} else {
val = CalculateCriticalStateTypePriority
(tempType);
if (val > max || !maxSet){
max = val;
maxSet = true;
buff = eff[i];
}
}
}
i += 1;
}
return buff;
/* NOP */;
}
public function GetCriticalBuffs() : array<CBaseGameplayEffect>{
var null : array<CBaseGameplayEffect>;
if (effectManager){
return effectManager.GetCriticalBuffs();
}
return null;
/* NOP */;
}
public final function IsCriticalTypeHigherThanAllCurrent(crit : ECritica
lStateType) : Bool{

var i : Int32;
var askedPriority : Int32;
var buffs : array<CBaseGameplayEffect>;
askedPriority = CalculateCriticalStateTypePriority(crit);
buffs = GetCriticalBuffs();
i = 0;
while (i < buffs.Size()){
if (buffs[i].IsActive() && CalculateCriticalStateTypePri
ority(GetBuffCriticalType(buffs[i])) >= askedPriority){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public function RecalcEffectDurations(){
if (effectManager){
effectManager.RecalcEffectDurations();
}
/* NOP */;
}
public function UpdateApplicatorBuffs(){
if (effectManager && effectManager.IsReady()){
effectManager.UpdateApplicatorBuffs();
}
/* NOP */;
}
public function GetApplicatorParamsFor(applicator : W3ApplicatorEffect,
pwrStatValue : SAbilityAttributeValue){
if (abilityManager){
abilityManager.GetApplicatorParamsFor(applicator, pwrSta
tValue);
}
/* NOP */;
}
public function AddEffectCustom(params : SCustomEffectParams) : EEffectI
nteract{
if (effectManager && effectManager.IsReady()){
return effectManager.AddEffectCustom(params);
}
LogAssert(false, "Actor.AddEffectCustom: <<" + this + ">> effect
manager does not exist! Cannot add <<" + params.effectType + ">>");
return 0;
/* NOP */;
}
public function AddEffectDefault(effectType : EEffectType, creat : CGame
playEntity, srcName : String, signEffect : Bool) : EEffectInteract{
if (effectManager && effectManager.IsReady()){
return effectManager.AddEffectDefault(effectType, creat,
srcName, signEffect);
}
LogAssert(false, "Actor.AddEffectDefault: <<" + this + ">> effec
t manager does not exist! Cannot add <<" + effectType + ">>");
return 0;
/* NOP */;
}
public function ProcessOnHitEffects(victim : CActor, silverSword : Bool,
steelSword : Bool, sign : Bool){
if (effectManager){

effectManager.ProcessOnHitEffects(victim, silverSword, s
teelSword, sign);
}
/* NOP */;
}
public function RemoveBuff(effectType : EEffectType, csForcedRemove : Bo
ol, sourceName : String){
if (effectManager && effectManager.IsReady()){
effectManager.RemoveEffect(effectManager.GetEffect(effec
tType, sourceName), csForcedRemove);
}
/* NOP */;
}
public function RemoveEffect(effect : CBaseGameplayEffect, csForcedRemov
e : Bool){
if (effectManager && effectManager.IsReady()){
effectManager.RemoveEffect(effect, csForcedRemove);
}
/* NOP */;
}
public function RemoveAllNonAutoBuffs(){
if (effectManager && effectManager.IsReady()){
effectManager.RemoveAllNonAutoEffects();
}
/* NOP */;
}
public function RemoveAllBuffsOfType(effectType : EEffectType){
if (effectManager && effectManager.IsReady()){
effectManager.RemoveAllEffectsOfType(effectType, /* NOP
*/);
}
/* NOP */;
}
public function HasBuff(effectType : EEffectType) : Bool{
if (effectManager && effectManager.IsReady()){
return effectManager.HasEffect(effectType);
}
return false;
/* NOP */;
}
public function GetBuffTimePercentageByType(effectType : EEffectType) :
Int32{
if (effectManager && effectManager.IsReady()){
return effectManager.GetEffectTimePercentageByType(effec
tType);
}
return 0;
/* NOP */;
}
public function GetBuffTimePercentage(effect : CBaseGameplayEffect) : In
t32{
if (effectManager && effectManager.IsReady()){
return effectManager.GetEffectTimePercentage(effect);
}
return 0;
/* NOP */;
}
public function GetCriticalBuffsCount() : Int32{
if (effectManager){
return effectManager.GetCriticalBuffsCount();

}
return 0;
/* NOP */;
}
public function GetCurrentlyAnimatedCS() : CBaseGameplayEffect{
if (effectManager){
return effectManager.GetCurrentlyAnimatedCS();
}
return NULL;
/* NOP */;
}
public function GetBuff(effectType : EEffectType, sourceName : String) :
CBaseGameplayEffect{
if (effectManager){
return effectManager.GetEffect(effectType, sourceName);
}
return NULL;
/* NOP */;
}
public function GetBuffs(type : EEffectType, sourceName : String, partia
lSourceNameSearch : Bool) : array<CBaseGameplayEffect>{
var null : array<CBaseGameplayEffect>;
if (effectManager){
return effectManager.GetCurrentEffects(type, sourceName,
partialSourceNameSearch);
}
return null;
/* NOP */;
}
public final function HasPotionBuff() : Bool{
if (effectManager){
return effectManager.HasPotionBuff();
}
return false;
/* NOP */;
}
public function IsImmuneToBuff(effect : EEffectType) : Bool{
var immunes : CBuffImmunity;
var i : Int32;
var potion : Bool;
var positive : Bool;
var neutral : Bool;
var negative : Bool;
var immobilize : Bool;
var confuse : Bool;
var damage : Bool;
var criticalStatesToResist : Float;
var resistCriticalStateChance : Float;
var resistCriticalStateMultiplier : Float;
var mac : CMovingAgentComponent;
mac = super.GetMovingAgentComponent();
if (mac && mac.IsEntityRepresentationForced() == 512 && !IsUsing
Vehicle()){
return false;
}
if (IsCriticalEffectType(effect) && HasAbility('ResistCriticalSt
ates')){
criticalStatesToResist = CalculateAttributeValue(GetAttr
ibuteValue('critical_states_to_raise_guard', /* NOP */, /* NOP */), /* NOP */);
resistCriticalStateChance = CalculateAttributeValue(GetA

ttributeValue('resist_critical_state_chance', /* NOP */, /* NOP */), /* NOP */);


resistCriticalStateMultiplier = CalculateAttributeValue(
GetAttributeValue('resist_critical_state_chance_mult_per_hit', /* NOP */, /* NOP
*/), /* NOP */);
criticalStateCounter = GetCriticalStateCounter(/* NOP */
);
resistCriticalStateChance += criticalStateCounter * resi
stCriticalStateMultiplier;
if (criticalStateCounter >= criticalStatesToResist){
if (resistCriticalStateChance > RandRangeF(1, 0)
){
return true;
}
}
}
i = 0;
while (i < buffImmunities.Size()){
if (buffImmunities[i].buffType == effect){
return true;
}
i += 1;
}
i = 0;
while (i < buffRemovedImmunities.Size()){
if (buffRemovedImmunities[i].buffType == effect){
return false;
}
i += 1;
}
immunes = theGame.GetBuffImmunitiesForActor(this);
if (immunes.immunityTo.Contains(effect)){
return true;
}
theGame.effectMgr.GetEffectTypeFlags(effect, potion, positive, n
eutral, negative, immobilize, confuse, damage);
if (potion && immunes.potion || positive && immunes.positive ||
neutral && immunes.neutral || negative && immunes.negative || immobilize && immu
nes.immobilize || confuse && immunes.confuse || damage && immunes.damage){
return true;
}
return false;
/* NOP */;
}
public function AddBuffImmunity_AllCritical(source : CName, removeIfPres
ent : Bool){
var i : Int32;
var size : Int32;
size = EnumGetMax('EEffectType') + 1;
i = 0;
while (i < size){
if (IsCriticalEffectType(i)){
AddBuffImmunity(i, source, removeIfPresent);
}
i += 1;
}
/* NOP */;
}
public function AddBuffImmunity_AllNegative(source : CName, removeIfPres
ent : Bool){
var i : Int32;

var size : Int32;


size = EnumGetMax('EEffectType') + 1;
i = 0;
while (i < size){
if (IsNegativeEffectType(i)){
AddBuffImmunity(i, source, removeIfPresent);
}
i += 1;
}
/* NOP */;
}
public function AddBuffImmunity(effect : EEffectType, source : CName, re
moveBuffIfPresent : Bool){
var i : Int32;
var removed : Bool;
var immuneExists : Bool;
var immunity : SBuffImmunity;
removed = false;
i = 0;
while (i < buffRemovedImmunities.Size()){
if (buffRemovedImmunities[i].buffType == effect && buffR
emovedImmunities[i].sources.Contains(source)){
buffRemovedImmunities[i].sources.Remove(source);
if (buffRemovedImmunities[i].sources.Size() == 0
){
buffRemovedImmunities.Erase(i);
}
removed = true;
break;
}
i += 1;
}
if (!removed){
immuneExists = false;
i = 0;
while (i < buffImmunities.Size()){
if (buffImmunities[i].buffType == effect){
if (!buffImmunities[i].sources.Contains(
source)){
buffImmunities[i].sources.PushBa
ck(source);
}
immuneExists = true;
break;
}
i += 1;
}
if (!immuneExists){
immunity.buffType = effect;
immunity.sources.PushBack(source);
buffImmunities.PushBack(immunity);
}
}
if (removeBuffIfPresent && effectManager){
effectManager.RemoveAllEffectsOfType(effect, /* NOP */);
}
/* NOP */;
}
public function RemoveBuffImmunity_AllCritical(source : CName){
var i : Int32;

var size : Int32;


size = EnumGetMax('EEffectType') + 1;
i = 0;
while (i < size){
if (IsCriticalEffectType(i)){
RemoveBuffImmunity(i, source);
}
i += 1;
}
/* NOP */;
}
public function RemoveBuffImmunity_AllNegative(source : CName){
var i : Int32;
var size : Int32;
size = EnumGetMax('EEffectType') + 1;
i = 0;
while (i < size){
if (theGame.effectMgr.IsBuffNegative(i)){
RemoveBuffImmunity(i, source);
}
i += 1;
}
/* NOP */;
}
public function RemoveBuffImmunity(effect : EEffectType, source : CName)
{
var immunes : CBuffImmunity;
var i : Int32;
var immunity : SBuffImmunity;
i = 0;
while (i < buffImmunities.Size()){
if (buffImmunities[i].buffType == effect && buffImmuniti
es[i].sources.Contains(source)){
buffImmunities[i].sources.Remove(source);
if (buffImmunities[i].sources.Size() == 0){
buffImmunities.Erase(i);
}
break;
}
i += 1;
}
if (!IsNameValid(source)){
immunes = theGame.GetBuffImmunitiesForActor(this);
if (immunes.immunityTo.Contains(effect)){
i = 0;
while (i < buffRemovedImmunities.Size()){
if (buffRemovedImmunities[i].buffType ==
effect){
if (!buffRemovedImmunities[i].so
urces.Contains(source)){
buffRemovedImmunities[i]
.sources.PushBack(source);
}
return;
}
i += 1;
}
immunity.buffType = effect;
immunity.sources.PushBack(source);
buffRemovedImmunities.PushBack(immunity);

}
}
/* NOP */;
}
public function PauseHPRegenEffects(sourceName : CName, duration : Float
){
if (effectManager && effectManager.IsReady()){
effectManager.PauseHPRegenEffects(sourceName, duration);
}
/* NOP */;
}
public function ResumeHPRegenEffects(sourceName : CName){
if (effectManager && effectManager.IsReady()){
effectManager.ResumeHPRegenEffects(sourceName);
}
/* NOP */;
}
public function PauseStaminaRegen(sourceName : CName){
if (effectManager && effectManager.IsReady()){
effectManager.PauseStaminaRegen(sourceName);
}
/* NOP */;
}
public function ResumeStaminaRegen(sourceName : CName){
if (effectManager && effectManager.IsReady()){
effectManager.ResumeStaminaRegen(sourceName);
}
/* NOP */;
}
public function GetCriticalStateCounter(total : Bool) : Int32{
if (total){
return totalCriticalStateCounter;
}
return criticalStateCounter;
/* NOP */;
}
public function IncCriticalStateCounter(){
criticalStateCounter += 1;
totalCriticalStateCounter += 1;
AddTimer('ResetCriticalStateCounter', 5.000000, false, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
private timer function ResetCriticalStateCounter(optional deta : Float,
optional id : Int32){
criticalStateCounter = 0;
/* NOP */;
}
public function GetTotalSignSpellPower(out signSkill : ESkill) : SAbilit
yAttributeValue{
}
public timer function EnableHighlightTimer(optional time : Float, option
al id : Int32){
if (bIsPlayerCurrentTarget && thePlayer.GetCurrentStateName() !=
'Exploration'){
PlayEffect('select_character', /* NOP */);
}
/* NOP */;
}
public function SetBIsPlayerCurrentTarget(flag : Bool){

bIsPlayerCurrentTarget = flag;
/* NOP */;
}
public function OnSlideToTargetAnimEvent(animEventName : CName, properti
es : SSlideToTargetEventProps, animEventType : EAnimationEventType, animEventDur
ation : Float, animInfo : SAnimationEventAnimInfo) : Bool{
ProcessSlideToTarget(animEventDuration, properties);
/* NOP */;
}
public function OnSlideToTargetDistance(animEventName : CName, propertie
s : SMultiValue, animEventType : EAnimationEventType, animEventDuration : Float,
animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){
ProcessSlideToTargetDistance(animEventDuration, properti
es.floats[0]);
}
/* NOP */;
}
public function SetRotationAdjustmentRotateTo(turnTowards : CNode, offse
tHeading : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest('RotateEvent');
movementAdjustor.RotateTowards(ticket, turnTowards, offsetHeadin
g);
/* NOP */;
}
public function SetRotationAdjustmentRotateToHeading(heading : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest('RotateEvent');
movementAdjustor.RotateTo(ticket, heading);
/* NOP */;
}
public function SuspendRotationAdjustment(){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest('RotateEvent');
movementAdjustor.KeepRotationAdjustmentActive(ticket);
/* NOP */;
}
public function GetRotationRateFromAnimEvent(enumValue : Int32) : ERotat
ionRate{
var hax : array<ERotationRate>;
if (enumValue < 0){
return -1;
} else if (enumValue < 20){
hax.PushBack(0);
hax.PushBack(30);
hax.PushBack(60);
hax.PushBack(90);
hax.PushBack(180);
hax.PushBack(360);
hax.PushBack(1080);

hax.PushBack(2160);
return hax[enumValue];
} else {
return enumValue;
}
/* NOP */;
}
private function GetWoundNameFromDLCForAnim(animInfo : SAnimationEventAn
imInfo) : CName{
var i : Int32;
var size : Int32;
var dlcFinishersLeftSide : array<CR4FinisherDLC>;
var dlcFinishersRightSide : array<CR4FinisherDLC>;
dlcFinishersLeftSide = theGame.GetSyncAnimManager().dlcFinishers
LeftSide;
size = dlcFinishersLeftSide.Size();
i = 0;
while (i < size){
if (dlcFinishersLeftSide[i].IsFinisherForAnim(animInfo))
{
return dlcFinishersLeftSide[i].woundName;
}
i += 1;
}
dlcFinishersRightSide = theGame.GetSyncAnimManager().dlcFinisher
sRightSide;
size = dlcFinishersRightSide.Size();
i = 0;
while (i < size){
if (dlcFinishersRightSide[i].IsFinisherForAnim(animInfo)
){
return dlcFinishersRightSide[i].woundName;
}
i += 1;
}
return 'none';
/* NOP */;
}
public function OnEnumAnimEvent(animEventName : CName, variant : SEnumVa
riant, animEventType : EAnimationEventType, animEventDuration : Float, animInfo
: SAnimationEventAnimInfo) : Bool{
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
var rotationRate : ERotationRate;
var loopShake : Bool;
var shakeStrength : Float;
var animName : CName;
var player : CR4Player;
var woundName : CName;
switch(animEventName){
case 'RotateEvent':
case 'RotateAwayEvent':
rotationRate = GetRotationRateFromAnimEvent(variant.enum
Value);
movementAdjustor = GetMovingAgentComponent().GetMovement
Adjustor();
if (animEventType == 1 || animEventType == 2){
movementAdjustor.Cancel(movementAdjustor.GetRequ
est('RotateEvent'));
ticket = movementAdjustor.CreateNewRequest('Rota

teEvent');
movementAdjustor.Continuous(ticket);
movementAdjustor.KeepActiveFor(ticket, animEvent
Duration);
if (rotationRate >= 0){
movementAdjustor.MaxRotationAdjustmentSp
eed(ticket, rotationRate);
}
movementAdjustor.MatchMoveRotation(ticket);
movementAdjustor.UpdateSourceAnimation(ticket, a
nimInfo);
movementAdjustor.CancelIfSourceAnimationUpdateIs
NotUpdated(ticket, /* NOP */);
movementAdjustor.SteeringMayOverrideMaxRotationA
djustmentSpeed(ticket, /* NOP */);
if ((CNewNPC)this){
if (animEventName == 'RotateAwayEvent'){
super.SignalGameplayEvent('Rotat
eAwayEventStart');
} else {
super.SignalGameplayEvent('Rotat
eEventStart');
}
}
} else if (animEventType == 3){
super.SignalGameplayEvent('RotateEventEnd');
} else {
ticket = movementAdjustor.GetRequest('RotateEven
t');
movementAdjustor.UpdateSourceAnimation(ticket, a
nimInfo);
super.SignalGameplayEvent('RotateEventSync');
}
break;
case 'InteractionPriority':
if (animEventType == 1){
super.SetInteractionPriority(variant.enumValue);
RemoveTimer('RestoreOriginalInteractionPriorityT
imer', /* NOP */);
AddTimer('RestoreOriginalInteractionPriorityTime
r', animEventDuration, false, /* NOP */, /* NOP */, true, /* NOP */);
}
break;
case 'Dismemberment':
if (animEventType == 3){
if (variant.enumValue == 16){
woundName = GetWoundNameFromDLCForAnim(a
nimInfo);
} else {
woundName = GetWoundNameFromWoundType(va
riant.enumValue);
}
SetDismembermentInfo(woundName, GetWorldPosition
() - thePlayer.GetWorldPosition(), false);
Dismember();
DropItemFromSlot('r_weapon', true);
DropItemFromSlot('l_weapon', true);
}
break;
case 'Shake':

if (animEventType == 4 || animEventType == 3){


return false;
}
loopShake = animEventType == 1;
animName = 'None';
if (loopShake){
animName = 'camera_shake_loop_lvl1_1';
player = thePlayer;
player.loopingCameraShakeAnimName = animName;
thePlayer.AddTimer('RemoveQuestCameraShakeTimer'
, animEventDuration, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
shakeStrength = variant.enumValue;
shakeStrength = shakeStrength / 10 * 1.900000 + 0.100000
;
GCameraShake(shakeStrength, true, GetWorldPosition(), 30
.000000, loopShake, animName, /* NOP */);
break;
default:
break;
}
/* NOP */;
}
public function GetWoundNameFromWoundType(woundType : Int32) : CName{
switch(woundType){
case 0:
return 'cut_head';
case 1:
return 'cut_torso';
case 2:
return 'none';
case 3:
return 'none';
case 4:
return 'none';
case 5:
return 'cut_arm';
case 6:
return 'none';
case 7:
return 'none';
case 8:
return 'morph_cut_head';
case 9:
return 'morph_cut_torso';
case 10:
return 'none';
case 11:
return 'none';
case 12:
return 'none';
case 13:
return 'morph_cut_arm';
case 14:
return 'none';
case 15:
return 'none';
case 16:
return 'none';
}

/* NOP */;
}
public function OnAnimEvent_RotateEvent(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var variant : SEnumVariant;
variant.enumValue = -1;
OnEnumAnimEvent(animEventName, variant, animEventType, 10.000000
, animInfo);
/* NOP */;
}
public function OnAnimEvent_RotateAwayEvent(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var variant : SEnumVariant;
variant.enumValue = -1;
OnEnumAnimEvent(animEventName, variant, animEventType, 10.000000
, animInfo);
/* NOP */;
}
public function OnAnimEvent_DeathHitGround(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var effectName : CName;
if (effectManager){
if (effectManager.HasEffect(18)){
effectName = 'igni_death_hit';
effectManager.RemoveAllEffectsOfType(18, true);
} else {
effectName = 'None';
}
if (IsNameValid(effectName)){
PlayEffect(effectName, /* NOP */);
}
}
/* NOP */;
}
public function OnAnimEvent_Shake0(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var loopShake : Bool;
loopShake = animEventType == 1;
GCameraShake(0.100000, true, GetWorldPosition(), 30.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_Shake1(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var loopShake : Bool;
loopShake = animEventType == 1;
GCameraShake(0.200000, true, GetWorldPosition(), 30.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_Shake2(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var loopShake : Bool;
loopShake = animEventType == 1;
GCameraShake(0.400000, true, GetWorldPosition(), 30.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_Shake3(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{

var loopShake : Bool;


loopShake = animEventType == 1;
GCameraShake(0.600000, true, GetWorldPosition(), 30.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_Shake4(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var loopShake : Bool;
loopShake = animEventType == 1;
GCameraShake(0.800000, true, GetWorldPosition(), 30.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_Shake5(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var loopShake : Bool;
loopShake = animEventType == 1;
GCameraShake(1.000000, true, GetWorldPosition(), 40.000000, loop
Shake, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_DropItem(animEventName : CName, animEventTyp
e : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
DropItemFromSlot('r_weapon', /* NOP */);
DropItemFromSlot('l_weapon', /* NOP */);
BreakAttachment();
/* NOP */;
}
public function OnAnimEvent_OnGround(animEventName : CName, animEventTyp
e : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType != 3){
SetBehaviorVariable('ExplorationMode', 1, /* NOP */);
} else {
SetBehaviorVariable('ExplorationMode', 2, /* NOP */);
}
/* NOP */;
}
public function OnAnimEvent_Death(animEventName : CName, animEventType :
EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3 && effectManager){
effectManager.OwnerHasFinishedDeathAnim();
}
/* NOP */;
}
public function OnAnimEvent_MountHorseType(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
super.SignalGameplayEventParamCName('MountHorseType', GetAnimNam
eFromEventAnimInfo(animInfo));
/* NOP */;
}
public function OnAnimEvent_HorseRidingOn(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
super.SignalGameplayEvent('HorseRidingOn');
/* NOP */;
}
public function OnDeathAnimFinished() : Bool{
if (effectManager){
effectManager.OwnerHasFinishedDeathAnim();
}

if (super.CanBleed()){
super.CreateBloodSpill();
super.CreateBloodSpill();
super.CreateBloodSpill();
}
/* NOP */;
}
public function EnableFinishComponent(flag : Bool){
var comp : CComponent;
comp = GetComponent("Finish");
if (comp){
if (flag && !theGame.GetWorld().NavigationLineTest(thePl
ayer.GetWorldPosition(), GetWorldPosition(), 0.400000, /* NOP */, /* NOP */)){
flag = false;
}
comp.SetEnabled(flag);
if (flag){
thePlayer.ProcessIsHoldingDeadlySword();
thePlayer.UpdateDisplayTarget(true, /* NOP */);
}
}
/* NOP */;
}
public final function CanBleed() : Bool{
var pts : Float;
var perc : Float;
GetResistValue(2, pts, perc);
return perc < 1;
/* NOP */;
}
public final function CreateBloodSpill(){
var bloodTemplate : CEntityTemplate;
bloodTemplate = (CEntityTemplate)LoadResource("blood_0" + RandRa
nge(4, /* NOP */), /* NOP */);
theGame.CreateEntity(bloodTemplate, GetWorldPosition() + VecRing
Rand(0, 0.500000), EulerAngles(0, RandF() * 360, 0), /* NOP */, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
/* NOP */;
}
public function DropItemFromSlot(slotName : CName, removeFromInv : Bool)
{
var itemToDrop : SItemUniqueId;
var inv : CInventoryComponent;
var droppedWeapon : SDroppedItem;
var itemEntity : CItemEntity;
inv = GetInventory();
itemToDrop = inv.GetItemFromSlot(slotName);
if (inv.IsIdValid(itemToDrop)){
itemEntity = inv.GetItemEntityUnsafe(itemToDrop);
AddDroppedItem(inv.GetItemName(itemToDrop), itemEntity);
inv.DropItem(itemToDrop, removeFromInv);
}
/* NOP */;
}
public function AddDroppedItem(itemName : CName, entity : CEntity){
var droppedItem : SDroppedItem;
droppedItem.itemName = itemName;
droppedItem.entity = entity;
droppedItems.PushBack(droppedItem);
/* NOP */;

}
public function RemoveDroppedItem(itemName : CName, destroy : Bool){
var i : Int32;
i = 0;
while (i < droppedItems.Size()){
if (droppedItems[i].itemName == itemName){
if (destroy && droppedItems[i].entity){
droppedItems[i].entity.Destroy();
}
droppedItems.Erase(i);
} else {
i += 1;
}
}
/* NOP */;
}
public function DropEquipment(tag : CName, direction : Vector){
var dropPhysics : CDropPhysicsComponent;
if (tag == 'None'){
LogAssert(false, "CActor.DropEquipment: empty tag!");
return;
}
dropPhysics = (CDropPhysicsComponent)GetComponentByClassName('CD
ropPhysicsComponent');
if (dropPhysics){
dropPhysics.DropMeshByTag(tag, direction, /* NOP */);
}
/* NOP */;
}
public function SetWound(woundName : CName, spawnEntity : Bool, createPa
rticles : Bool, dropEquipment : Bool, playSound : Bool, direction : Vector, play
Effects : Bool){
var dc : CDismembermentComponent;
dc = (CDismembermentComponent)GetComponentByClassName('CDismembe
rmentComponent');
if (dc){
dc.SetVisibleWound(woundName, spawnEntity, createParticl
es, dropEquipment, playSound, direction, playEffects);
}
/* NOP */;
}
public function IsCurrentWound(woundName : CName) : Bool{
var dc : CDismembermentComponent;
dc = (CDismembermentComponent)GetComponentByClassName('CDismembe
rmentComponent');
if (dc){
return dc.GetVisibleWoundName() == woundName;
}
return false;
/* NOP */;
}
public function IsWoundDefined(woundName : CName) : Bool{
var dc : CDismembermentComponent;
dc = (CDismembermentComponent)GetComponentByClassName('CDismembe
rmentComponent');
if (dc){
return dc.IsWoundDefined(woundName);
}
return false;
/* NOP */;

}
public function GetNearestWoundForBone(boneIndex : Int32, directionWS :
Vector, woundTypeFlags : EWoundTypeFlags) : CName{
var dc : CDismembermentComponent;
dc = (CDismembermentComponent)GetComponentByClassName('CDismembe
rmentComponent');
if (dc){
return dc.GetNearestWoundNameForBone(boneIndex, directio
nWS, woundTypeFlags);
}
return 'None';
/* NOP */;
}
public function SetDismembermentInfo(woundName : CName, vec : Vector, fo
rceRagoll : Bool){
woundToDismember = woundName;
forwardVector = vec;
dismemberForceRagdoll = forceRagoll;
/* NOP */;
}
public timer function DelayedDismemberTimer(optional time : Float, optio
nal id : Int32){
Dismember();
/* NOP */;
}
private function Dismember(){
SetWound(woundToDismember, true, true, true, true, forwardVector
, /* NOP */);
if (dismemberForceRagdoll && (CMovingPhysicalAgentComponent)supe
r.GetMovingAgentComponent().HasRagdoll()){
TurnOnRagdoll();
}
/* NOP */;
}
public function TurnOnRagdoll(){
SetBehaviorVariable('Ragdoll_Weight', 1.000000, /* NOP */);
RaiseEvent('Ragdoll');
/* NOP */;
}
private function FindAttackTargets(preAttackData : CPreAttackEventData)
: array<CGameplayEntity>{
var targets : array<CGameplayEntity>;
var i : Int32;
var attitude : Bool;
var canLog : Bool;
canLog = theGame.CanLog();
if (preAttackData.rangeName == 'None'){
if (canLog){
LogAssert(false, "CActor.FindAttackTargets: atta
ck <<" + preAttackData.attackName + ">> of <<" + this + ">> has no range defined
!!! Skipping hit!!!");
LogDMHits("CActor.FindAttackTargets: attack <<"
+ preAttackData.attackName + ">> of <<" + this + ">> has no range defined!!! Ski
pping hit!!!", /* NOP */);
}
return targets;
} else {
super.GatherEntitiesInAttackRange(targets, preAttackData
.rangeName);
}

i = targets.Size() - 1;
while (i >= 0){
if (!targets[i] || targets[i] == this){
targets.EraseFast(i);
} else if ((W3SignEntity)targets[i] || (CProjectileTraje
ctory)targets[i] || (CDamageAreaEntity)targets[i] || (W3ToxicCloud)targets[i]){
targets.EraseFast(i);
} else if (!targets[i].IsAlive()){
targets.EraseFast(i);
} else {
attitude = IsRequiredAttitudeBetween(this, targe
ts[i], preAttackData.Damage_Hostile, preAttackData.Damage_Neutral, preAttackData
.Damage_Friendly || (CActor)targets[i].HasBuff(36));
if (!attitude){
if (canLog){
LogDMHits("Attacker <<" + this +
">> is skipping target << " + targets[i] + ">> due to failed attitude check", /
* NOP */);
}
targets.EraseFast(i);
}
}
i -= 1;
}
return targets;
/* NOP */;
}
public function IsSuperHeavyAttack(attackName : CName) : Bool{
return theGame.GetDefinitionsManager().AbilityHasTag(attackName,
theGame.params.ATTACK_NAME_SUPERHEAVY);
/* NOP */;
}
public function IsHeavyAttack(attackName : CName) : Bool{
return theGame.GetDefinitionsManager().AbilityHasTag(attackName,
theGame.params.ATTACK_NAME_HEAVY);
/* NOP */;
}
public function IsLightAttack(attackName : CName) : Bool{
return theGame.GetDefinitionsManager().AbilityHasTag(attackName,
theGame.params.ATTACK_NAME_LIGHT);
/* NOP */;
}
public function BlinkWeapon(weaponId : SItemUniqueId) : Bool{
if (GetInventory().IsIdValid(weaponId)){
GetInventory().PlayItemEffect(weaponId, 'flash_fx');
} else {
return PlayEffectOnHeldWeapon('flash_fx', /* NOP */);
}
return true;
/* NOP */;
}
public function PlayEffectOnHeldWeapon(effectName : CName, disable : Boo
l) : Bool{
var itemId : SItemUniqueId;
var inv : CInventoryComponent;
inv = GetInventory();
itemId = inv.GetItemFromSlot('r_weapon');
if (!inv.IsIdValid(itemId)){
itemId = inv.GetItemFromSlot('l_weapon');
if (!inv.IsIdValid(itemId)){

return false;
}
}
if (disable){
inv.StopItemEffect(itemId, effectName);
} else {
inv.PlayItemEffect(itemId, effectName);
}
return true;
/* NOP */;
}
protected function PerformCounterCheck(out parryInfo : SParryInfo) : Boo
l{
}
public function PerformParryCheck(out parryInfo : SParryInfo) : Bool{
}
public function OnPreAttackEvent(animEventName : CName, animEventType :
EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimI
nfo) : Bool{
var parriedBy : array<CActor>;
var weaponId : SItemUniqueId;
var player : CR4Player;
var parried : Bool;
var countered : Bool;
player = thePlayer;
if (animEventType == 1){
ignoreAttack = false;
SetAttackData(data);
weaponId = GetInventory().GetItemFromSlot(data.weaponSlo
t);
if (this != thePlayer){
BlinkWeapon(weaponId);
}
SetCurrentAttackData(data, animInfo);
} else if (animEventType == 3){
attackEventInProgress = false;
if (ignoreAttack){
ignoreAttack = false;
return true;
}
if (this == thePlayer && GetEventEndsAtTimeFromEventAnim
Info(animInfo) - GetLocalAnimTimeFromEventAnimInfo(animInfo) > 0.060000){
return true;
}
weaponId = GetInventory().GetItemFromSlot(data.weaponSlo
t);
if (!GetInventory().IsIdValid(weaponId) || data.attackNa
me == 'None'){
LogAttackEvents("No valid attack data set - skip
ping hit!");
LogAssert(false, "No valid attack data set - ski
pping hit!");
return false;
}
hitTargets = FindAttackTargets(data);
parriedBy = TestParryAndCounter(data, weaponId, parried,
countered);
if (data.attackName == 'attack_speed_based' && this == t
hePlayer){
return false;

}
lastAttackRangeName = data.rangeName;
DoAttack(data, weaponId, parried, countered, parriedBy,
GetAnimNameFromEventAnimInfo(animInfo), GetLocalAnimTimeFromEventAnimInfo(animIn
fo));
}
/* NOP */;
}
private function PreAttackParry(){
var data : CPreAttackEventData;
var animInfo : SAnimationEventAnimInfo;
var parriedBy : array<CActor>;
var weaponId : SItemUniqueId;
var parried : Bool;
var countered : Bool;
if (!attackEventInProgress){
return;
}
GetCurrentAttackDataAndAnimInfo(data, animInfo);
weaponId = GetInventory().GetItemFromSlot(data.weaponSlot);
if (!GetInventory().IsIdValid(weaponId) || data.attackName == 'N
one'){
LogAttackEvents("No valid attack data set - skipping hit
!");
LogAssert(false, "No valid attack data set - skipping hi
t!");
return;
}
parriedBy = TestParryAndCounter(data, weaponId, parried, counter
ed);
if (parried || countered){
DoAttack(data, weaponId, parried, countered, parriedBy,
GetAnimNameFromEventAnimInfo(animInfo), GetLocalAnimTimeFromEventAnimInfo(animIn
fo));
ignoreAttack = true;
}
/* NOP */;
}
private function SetCurrentAttackData(data : CPreAttackEventData, animIn
fo : SAnimationEventAnimInfo){
currentAttackData = data;
currentAttackAnimInfo = animInfo;
ignoreTargetsForCurrentAttack.Clear();
attackEventInProgress = true;
super.SignalGameplayEvent('NewCurrentAttackData');
/* NOP */;
}
private function GetCurrentAttackDataAndAnimInfo(data : CPreAttackEventD
ata, animInfo : SAnimationEventAnimInfo) : Bool{
if (!attackEventInProgress){
return false;
}
data = currentAttackData;
animInfo = currentAttackAnimInfo;
return true;
/* NOP */;
}
public function GetCurrentAttackData(data : CPreAttackEventData) : Bool{
if (!attackEventInProgress){
return false;

}
data = currentAttackData;
return true;
/* NOP */;
}
public function OnCollisionFromItem(collidedActor : CActor, itemEntity :
CItemEntity) : Bool{
var data : CPreAttackEventData;
var animInfo : SAnimationEventAnimInfo;
var parriedBy : array<CActor>;
var weaponId : SItemUniqueId;
var parried : Bool;
var countered : Bool;
var hasProperAttitude : Bool;
if (!attackEventInProgress){
LogItemCollision("Item " + itemEntity + " collided with
" + collidedActor + " but Attack is not in progress");
return false;
}
if (!collidedActor){
LogItemCollision("Item " + itemEntity + " collided with
NOT actor");
return false;
}
if (ignoreTargetsForCurrentAttack.Contains(collidedActor)){
return false;
}
GetCurrentAttackDataAndAnimInfo(data, animInfo);
if (data.rangeName != 'useCollisionFromItem'){
return false;
}
hasProperAttitude = IsRequiredAttitudeBetween(this, collidedActo
r, data.Damage_Hostile, data.Damage_Neutral, data.Damage_Friendly);
if (!hasProperAttitude){
return false;
}
weaponId = GetInventory().GetItemFromSlot(data.weaponSlot);
GetInventory().GetItemEntityUnsafe(weaponId) == itemEntity;
if (!GetInventory().IsIdValid(weaponId) || data.attackName == 'N
one'){
LogAttackEvents("No valid attack data set - skipping hit
!");
LogAssert(false, "No valid attack data set - skipping hi
t!");
return false;
} else if (itemEntity && GetInventory().GetItemEntityUnsafe(weap
onId) != itemEntity){
LogItemCollision("Item " + itemEntity + " collided with
" + collidedActor + " but Attack is for different item");
return false;
}
if (HasAbility('WildHunt_Imlerith')){
data.canBeDodged = false;
}
hitTargets.PushBack(collidedActor);
parriedBy = TestParryAndCounter(data, weaponId, parried, counter
ed);
DoAttack(data, weaponId, parried, countered, parriedBy, GetAnimN
ameFromEventAnimInfo(animInfo), GetLocalAnimTimeFromEventAnimInfo(animInfo));
LogItemCollision("Item " + itemEntity + " collided with " + coll

idedActor + " and Attack should deal dmg");


ignoreTargetsForCurrentAttack.PushBack(collidedActor);
ignoreAttack = true;
return true;
/* NOP */;
}
public function SetAttackData(data : CPreAttackEventData){
var i : Int32;
var targets : array<CGameplayEntity>;
var npc : CNewNPC;
var actor : CActor;
if (!GetInventory().IsIdValid(GetInventory().GetItemFromSlot(dat
a.weaponSlot))){
if (theGame.CanLog()){
LogAssert(false, "Attacker <<" + this + ">> has
invalid weapon ID, no attack data set!!!");
LogDMHits("Attacker <<" + this + ">> has invalid
weapon ID, no attack data set!!!", /* NOP */);
}
return;
}
super.SetDebugAttackRange(data.rangeName);
if (!IsNameValid(attackActionName)){
attackActionName = data.attackName;
}
npc = (CNewNPC)this;
if (npc){
npc.SetCounterWindowStartTime(theGame.GetEngineTime());
if (ShouldProcessTutorial('TutorialCounter') || ShouldPr
ocessTutorial('TutorialDodge') && super.GetTarget() == thePlayer && FactsQuerySu
m("tut_fight_use_slomo") > 0 && !thePlayer.IsCurrentlyDodging()){
if (theGame.GetTutorialSystem().AreMessagesEnabl
ed()){
theGame.SetTimeScale(0.001000, theGame.G
etTimescaleSource(13), theGame.GetTimescalePriority(13), /* NOP */, /* NOP */);
}
FactsAdd("tut_fight_slomo_ON", /* NOP */, /* NOP
*/);
}
}
targets = FindAttackTargets(data);
if (targets.Size() == 0 && this == thePlayer && slideTarget){
targets.PushBack(slideTarget);
}
i = 0;
while (i < targets.Size()){
npc = (CNewNPC)targets[i];
if (npc){
if (!IsUsingHorse(/* NOP */)){
if (data.hitReactionType == 1){
npc.SignalGameplayEventParamInt(
'Time2Dodge', 0);
} else if (data.hitReactionType == 2){
npc.SignalGameplayEventParamInt(
'Time2Dodge', 1);
}
}
if (npc.IsShielded(this) || npc.IsGuarded() && d
ata.Can_Parry_Attack){
if (IsHeavyAttack(attackActionName)){

npc.SignalGameplayEventParamInt(
'ParryStart', 1);
} else {
npc.SignalGameplayEventParamInt(
'ParryStart', 0);
}
}
}
actor = (CActor)targets[i];
if (actor){
actor.IsAttacked(/* NOP */);
}
i += 1;
}
/* NOP */;
}
protected function TestParryAndCounter(data : CPreAttackEventData, weapo
nId : SItemUniqueId, parried : Bool, countered : Bool) : array<CActor>{
var actor : CActor;
var i : Int32;
var parryInfo : SParryInfo;
var parriedBy : array<CActor>;
var npc : CNewNPC;
var playerTarget : CR4Player;
var levelDiff : Int32;
var chanceToFailParry : Float;
super.SetDebugAttackRange(data.rangeName);
RemoveTimer('PostAttackDebugRangeClear', /* NOP */);
i = hitTargets.Size() - 1;
while (i >= 0){
actor = (CActor)hitTargets[i];
if (!actor){
} else {
parryInfo = ProcessParryInfo(this, actor, data.s
wingType, data.swingDir, attackActionName, weaponId, data.Can_Parry_Attack);
playerTarget = (CR4Player)hitTargets[i];
parried = false;
countered = false;
if (FactsQuerySum("tut_fight_start") > 0 || acto
r.HasAbility('IgnoreLevelDiffForParryTest')){
levelDiff = 0;
} else {
levelDiff = GetLevel() - actor.GetLevel(
);
}
if (thePlayer.IsInFistFightMiniGame() || levelDi
ff < theGame.params.LEVEL_DIFF_DEADLY && !playerTarget || playerTarget.IsActionA
llowed(29)){
countered = actor.PerformCounterCheck(pa
rryInfo);
}
if (!countered){
if (thePlayer.IsInFistFightMiniGame() ||
levelDiff < theGame.params.LEVEL_DIFF_DEADLY && !playerTarget || playerTarget.I
sActionAllowed(25)){
if (!thePlayer.IsInFistFightMini
Game() && levelDiff >= theGame.params.LEVEL_DIFF_HIGH){
chanceToFailParry = Calc
ulateAttributeValue(actor.GetAttributeValue('chance_to_fail_parry_per_level_diff
', /* NOP */, /* NOP */), /* NOP */);

if (chanceToFailParry >
0){
chanceToFailParr
y *= levelDiff - theGame.params.LEVEL_DIFF_HIGH + 1;
if (RandRange(10
0, /* NOP */) < chanceToFailParry){
parryInf
o.canBeParried = false;
}
}
}
parried = actor.PerformParryChec
k(parryInfo);
}
} else if (playerTarget && data.Can_Parry_Attack
){
FactsAdd("ach_counter", 1, 4);
theGame.GetGamerProfile().CheckLearningT
heRopes();
}
if (countered || parried){
actor.SetDetailedHitReaction(data.swingT
ype, data.swingDir);
if (theGame.CanLog()){
LogAttackRangesDebug("");
if (countered){
LogDMHits("Attack counte
red by <<" + actor + ">>", /* NOP */);
LogAttackRangesDebug("At
tack countered by <<" + actor + ">>");
} else if (parried){
LogDMHits("Attack parrie
d by <<" + actor + ">>", /* NOP */);
LogAttackRangesDebug("At
tack parried by <<" + actor + ">>");
}
}
parriedBy.PushBack(actor);
}
}
i -= 1;
}
return parriedBy;
/* NOP */;
}
private function SetCounterHint(){
var hud : CR4ScriptedHud;
var module : CR4HudModuleEnemyFocus;
hud = (CR4ScriptedHud)theGame.GetHud();
module = (CR4HudModuleEnemyFocus)hud.GetHudModule("EnemyFocusMod
ule");
/* NOP */;
}
protected function DoAttack(animData : CPreAttackEventData, weaponId : S
ItemUniqueId, parried : Bool, countered : Bool, parriedBy : array<CActor>, attac
kAnimationName : CName, hitTime : Float){
var i : Int32;
var weaponEntity : CItemEntity;
weaponEntity = GetInventory().GetItemEntityUnsafe(weaponId);
i = 0;

while (i < hitTargets.Size()){


Attack(hitTargets[i], animData, weaponId, parried, count
ered, parriedBy, attackAnimationName, hitTime, weaponEntity);
i += 1;
}
attackActionName = 'None';
hitTargets.Clear();
AddTimer('PostAttackDebugRangeClear', 1, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function PostAttackDebugRangeClear(optional dt : Float, opt
ional id : Int32){
super.SetDebugAttackRange('None');
/* NOP */;
}
protected function Attack(hitTarget : CGameplayEntity, animData : CPreAt
tackEventData, weaponId : SItemUniqueId, parried : Bool, countered : Bool, parri
edBy : array<CActor>, attackAnimationName : CName, hitTime : Float, weaponEntity
: CItemEntity){
var action : W3Action_Attack;
if (PrepareAttackAction(hitTarget, animData, weaponId, parried,
countered, parriedBy, attackAnimationName, hitTime, weaponEntity, action)){
theGame.damageMgr.ProcessAction(action);
delete action;
}
/* NOP */;
}
public function SetAttackActionName(nam : CName){
attackActionName = nam;
/* NOP */;
}
protected function PrepareAttackAction(hitTarget : CGameplayEntity, anim
Data : CPreAttackEventData, weaponId : SItemUniqueId, parried : Bool, countered
: Bool, parriedBy : array<CActor>, attackAnimationName : CName, hitTime : Float,
weaponEntity : CItemEntity, attackAction : W3Action_Attack) : Bool{
var actor : CActor;
if (!hitTarget){
return false;
}
attackAction = new W3Action_Attack in theGame.damageMgr;
if (animData.hitFX == 'basedOnWeapon'){
ChangeHitFxBasedOnWeapon(animData, weaponId);
}
attackAction.Init(this, hitTarget, NULL, weaponId, animData.atta
ckName, GetName(), animData.hitReactionType, animData.Can_Parry_Attack, animData
.canBeDodged, attackActionName, animData.swingType, animData.swingDir, true, fal
se, false, false, animData.hitFX, animData.hitBackFX, animData.hitParriedFX, ani
mData.hitBackParriedFX, /* NOP */);
attackAction.SetAttackAnimName(attackAnimationName);
attackAction.SetHitTime(hitTime);
attackAction.SetWeaponEntity(weaponEntity);
attackAction.SetWeaponSlot(animData.weaponSlot);
attackAction.SetSoundAttackType(animData.soundAttackType);
actor = (CActor)hitTarget;
if (actor && parriedBy.Contains(actor)){
if (parried){
attackAction.SetIsParried(true);
} else if (countered){
attackAction.SetIsCountered(true);

}
}
if (attackAction.IsParried() && attackAction.attacker.HasAbility
('ReflectOnBeingParried')){
(CActor)attackAction.attacker.SetCanPlayHitAnim(true);
ReactToReflectedAttack(attackAction.victim);
}
return true;
/* NOP */;
}
protected function ChangeHitFxBasedOnWeapon(animData : CPreAttackEventDa
ta, weaponId : SItemUniqueId){
var weaponName : CName;
weaponName = GetInventory().GetItemName(weaponId);
if (weaponName == 'fists'){
animData.hitFX = 'fistfight_hit';
animData.hitBackFX = 'fistfight_hit_back';
} else if (weaponName == 'fists_lightning'){
animData.hitFX = 'hit_electric';
animData.hitParriedFX = 'hit_electric';
animData.hitBackFX = 'hit_electric';
animData.hitBackParriedFX = 'hit_electric';
} else if (weaponName == 'fists_fire'){
animData.hitFX = 'fire_hit';
animData.hitParriedFX = 'fire_hit';
animData.hitBackFX = 'fire_hit';
animData.hitBackParriedFX = 'fire_hit';
}
/* NOP */;
}
public function ReduceDamage(damageData : W3DamageAction){
var actorAttacker : CActor;
var id : SItemUniqueId;
var attackAction : W3Action_Attack;
var arrStr : array<String>;
var l_percAboutToBeRemoved : Float;
var l_healthPerc : Float;
var l_threshold : Float;
var l_maxPercLossAllowed : Float;
var l_maxDamageAllowed : Float;
var l_maxHealth : Float;
var mult : Float;
var l_actorTarget : CActor;
var canLog : Bool;
var hitsToKill : SAbilityAttributeValue;
var thisNPC : CNewNPC;
var minDamage : Float;
var i : Int32;
var dmgTypes : array<SRawDamage>;
canLog = theGame.CanLog();
if (damageData.victim == thePlayer && !damageData.IsDoTDamage())
{
damageData.GetDTs(dmgTypes);
minDamage = 0;
i = 0;
while (i < dmgTypes.Size()){
if (DamageHitsVitality(dmgTypes[i].dmgType)){
minDamage += dmgTypes[i].dmgVal;
}
i += 1;

}
minDamage *= 0.050000;
if (minDamage < 1){
minDamage = 1;
}
if (damageData.processedDmg.vitalityDamage < minDamage){
damageData.processedDmg.vitalityDamage = minDama
ge;
}
}
if (damageData.IsActionRanged() && damageData.attacker == thePla
yer && (W3BoltProjectile)damageData.causer){
if (UsesEssence() && damageData.processedDmg.essenceDama
ge < 1){
damageData.processedDmg.essenceDamage = 1;
if (canLog){
LogDMHits("CActor.ReduceDamage: victim w
ould take no damage but it's a bolt so we deal 1 pt of damage", damageData);
}
} else if (UsesVitality() && damageData.processedDmg.vit
alityDamage < 1){
damageData.processedDmg.vitalityDamage = 1;
if (canLog){
LogDMHits("CActor.ReduceDamage: victim w
ould take no damage but it's a bolt so we deal 1 pt of damage", damageData);
}
}
}
thisNPC = (CNewNPC)this;
if (thisNPC && damageData.attacker == thePlayer && !HasBuff(36)
&& GetAttitudeBetween(this, thePlayer) == 0 || GetAttitudeBetween(this, thePlaye
r) == 1 && thisNPC.GetNPCType() == 3){
if (canLog){
LogDMHits("Player attacked friendly or neutral c
ommunity npc - no damage dealt", damageData);
}
damageData.SetAllProcessedDamageAs(0);
damageData.ClearEffects();
return;
}
if (!damageData.DealsAnyDamage()){
return;
}
if (attackAction && attackAction.IsActionMelee() && HasAbility('
CannotBeAttackedFromBehind') && IsAttackerAtBack(damageData.attacker)){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim attacked
from behind and immune to this type of strike - no damage will be done", damageD
ata);
}
damageData.SetAllProcessedDamageAs(0);
(CActor)damageData.attacker.ReactToReflectedAttack(this)
;
return;
}
if (HasAbility('EredinInvulnerable') && damageData.IsActionWitch
erSign()){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim has Eredi
nInvulnerable ability - no damage will be done", damageData);

}
damageData.SetAllProcessedDamageAs(0);
return;
}
if (this != thePlayer && FactsDoesExist("debug_fact_weak")){
if (canLog){
LogDMHits("CActor.ReduceDamage: using 'weak' che
at - all damage set to 0.001", damageData);
}
damageData.processedDmg.essenceDamage = MinF(0.001000, d
amageData.processedDmg.essenceDamage);
damageData.processedDmg.vitalityDamage = MinF(0.001000,
damageData.processedDmg.vitalityDamage);
damageData.processedDmg.staminaDamage = MinF(0.001000, d
amageData.processedDmg.staminaDamage);
damageData.processedDmg.moraleDamage = MinF(0.001000, da
mageData.processedDmg.moraleDamage);
}
if (this != thePlayer && IsCurrentlyDodging() && damageData.CanB
eDodged() && VecDistanceSquared(GetWorldPosition(), damageData.attacker.GetWorld
Position()) > 1.700000){
if (canLog){
LogDMHits("Non-player character dodge - no damag
e dealt", damageData);
}
damageData.SetAllProcessedDamageAs(0);
damageData.ClearEffects();
damageData.SetHitAnimationPlayType(2);
return;
}
if (damageData.IsParryStagger()){
actorAttacker = (CActor)damageData.attacker;
if ((CMovingPhysicalAgentComponent)actorAttacker.GetMovi
ngAgentComponent().GetCapsuleHeight() > 2.000000){
mult = theGame.params.PARRY_STAGGER_REDUCE_DAMAG
E_LARGE;
} else if (actorAttacker.GetRadius() > 0.600000){
mult = theGame.params.PARRY_STAGGER_REDUCE_DAMAG
E_LARGE;
} else if (this == thePlayer && thePlayer.GetBossTag() !
= 'None'){
mult = theGame.params.PARRY_STAGGER_REDUCE_DAMAG
E_LARGE;
} else if (actorAttacker.HasAbility('mon_troll_base')){
mult = theGame.params.PARRY_STAGGER_REDUCE_DAMAG
E_LARGE;
} else {
mult = theGame.params.PARRY_STAGGER_REDUCE_DAMAG
E_SMALL;
}
damageData.MultiplyAllDamageBy(mult);
if (canLog){
LogDMHits("Stagger-Parry, reducing damage by " +
NoTrailZeros(1 - mult * 100) + "%", /* NOP */);
}
return;
}
attackAction = (W3Action_Attack)damageData;
if (attackAction && damageData.IsActionMelee() && attackAction.C
anBeParried() && attackAction.IsParried() || attackAction.IsCountered()){

arrStr.PushBack(GetDisplayName(/* NOP */));


if (attackAction.IsParried()){
if (canLog){
LogDMHits("Attack parried - no damage",
damageData);
}
theGame.witcherLog.AddCombatMessage(GetLocString
ByKeyExtWithParams("hud_combat_log_parries", /* NOP */, /* NOP */, arrStr, /* NO
P */), attackAction.attacker, this);
} else {
if (canLog){
LogDMHits("Attack countered - no damage"
, damageData);
}
theGame.witcherLog.AddCombatMessage(GetLocString
ByKeyExtWithParams("hud_combat_log_counters", /* NOP */, /* NOP */, arrStr, /* N
OP */), attackAction.attacker, this);
}
damageData.SetAllProcessedDamageAs(0);
return;
}
actorAttacker = (CActor)damageData.attacker;
if ((CPlayer)actorAttacker && !(CPlayer)damageData.victim && Fac
tsQuerySum('player_is_the_boss') > 0){
if (canLog){
LogDMHits("Using 'like a boss' cheat - damage se
t to 40% of targets MAX health", damageData);
}
damageData.processedDmg.vitalityDamage = GetStatMax(0) /
2.500000;
damageData.processedDmg.essenceDamage = GetStatMax(1) /
2.500000;
}
if (attackAction && actorAttacker == thePlayer && thePlayer.inv.
IsItemBolt(attackAction.GetWeaponId())){
if (thePlayer.IsOnBoat()){
hitsToKill = GetAttributeValue('extraDamageWhenP
layerOnBoat', /* NOP */, /* NOP */);
if (hitsToKill.valueAdditive > 0){
damageData.processedDmg.vitalityDamage =
CeilF(GetStatMax(0) / hitsToKill.valueAdditive);
damageData.processedDmg.essenceDamage =
CeilF(GetStatMax(1) / hitsToKill.valueAdditive);
if (theGame.CanLog()){
LogDMHits("Target is getting kil
led by " + NoTrailZeros(hitsToKill.valueAdditive) + " hits when being shot from
boat by default bolts", damageData);
LogDMHits("Final hacked damage i
s now, vit: " + NoTrailZeros(damageData.processedDmg.vitalityDamage) + ", ess: "
+ NoTrailZeros(damageData.processedDmg.essenceDamage), damageData);
}
}
}
}
if (HasAbility('ShadowFormActive')){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim has Shado
wFormActive ability - damage reduced to 10% of base", damageData);
}
damageData.processedDmg.vitalityDamage *= 0.100000;

damageData.processedDmg.essenceDamage *= 0.100000;
damageData.SetCanPlayHitParticle(false);
theGame.witcherLog.CombatMessageAddGlobalDamageMult(0.10
0000);
}
if (actorAttacker && HasAbility('IceArmor') && !actorAttacker.Ha
sAbility('Ciri_Rage')){
if (theGame.GetDifficultyMode() == 1){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim h
as IceArmor ability - damage reduced by 5%", damageData);
}
damageData.processedDmg.vitalityDamage *= 0.9500
00;
damageData.processedDmg.essenceDamage *= 0.95000
0;
theGame.witcherLog.CombatMessageAddGlobalDamageM
ult(0.950000);
} else {
if (canLog){
LogDMHits("CActor.ReduceDamage: victim h
as IceArmor ability - damage reduced by 50%", damageData);
}
damageData.processedDmg.vitalityDamage *= 0.5000
00;
damageData.processedDmg.essenceDamage *= 0.50000
0;
theGame.witcherLog.CombatMessageAddGlobalDamageM
ult(0.500000);
}
}
if (HasAbility('LastBreath')){
l_threshold = CalculateAttributeValue(GetAttributeValue(
'lastbreath_threshold', /* NOP */, /* NOP */), /* NOP */);
if (l_threshold == 0){
l_threshold = 0.250000;
}
l_healthPerc = GetHealthPercents();
if (theGame.GetEngineTimeAsSeconds() - lastBreathTime <
1){
if (damageData.processedDmg.vitalityDamage > 0){
damageData.processedDmg.vitalityDamage =
0;
}
if (damageData.processedDmg.essenceDamage > 0){
damageData.processedDmg.essenceDamage =
0;
}
if (canLog){
LogDMHits("CActor.ReduceDamage: victim j
ust activated LastBreath ability - reducing damage", /* NOP */);
}
} else if (l_healthPerc > l_threshold){
l_maxHealth = GetMaxHealth();
l_percAboutToBeRemoved = MaxF(damageData.process
edDmg.vitalityDamage, damageData.processedDmg.essenceDamage) / l_maxHealth;
l_maxPercLossAllowed = l_healthPerc - l_threshol
d;
if (l_percAboutToBeRemoved > l_maxPercLossAllowe
d){

l_maxDamageAllowed = l_maxPercLossAllowe
d * l_maxHealth;
if (damageData.processedDmg.vitalityDama
ge > 0){
damageData.processedDmg.vitality
Damage = l_maxDamageAllowed;
}
if (damageData.processedDmg.essenceDamag
e > 0){
damageData.processedDmg.essenceD
amage = l_maxDamageAllowed;
}
if (canLog){
LogDMHits("CActor.ReduceDamage:
victim has LastBreath ability - reducing damage", damageData);
}
super.SignalGameplayEvent('LastBreath');
lastBreathTime = theGame.GetEngineTimeAs
Seconds();
DisableHitAnimFor(1);
}
}
}
if (!damageData.GetIgnoreImmortalityMode()){
if (!(W3PlayerWitcher)this){
/* NOP */;
}
if (IsInvulnerable()){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim I
nvulnerable - no damage will be dealt", damageData);
}
damageData.SetAllProcessedDamageAs(0);
return;
}
if (actorAttacker && damageData.DealsAnyDamage()){
actorAttacker.SignalGameplayEvent('DamageInstiga
ted');
}
if (IsImmortal()){
if (canLog){
LogDMHits("CActor.ReduceDamage: victim i
s Immortal, clamping damage", damageData);
}
damageData.processedDmg.vitalityDamage = ClampF(
damageData.processedDmg.vitalityDamage, 0, GetStat(0, /* NOP */) - 1);
damageData.processedDmg.essenceDamage = ClampF(d
amageData.processedDmg.essenceDamage, 0, GetStat(1, /* NOP */) - 1);
return;
}
} else if (actorAttacker && damageData.DealsAnyDamage()){
actorAttacker.SignalGameplayEvent('DamageInstigated');
}
/* NOP */;
}
public function GetDelaySinceLastAttacked() : Float{
return theGame.GetEngineTimeAsSeconds() - lastWasAttackedTime;
/* NOP */;
}
public function GetDelaySinceLastHit() : Float{

return theGame.GetEngineTimeAsSeconds() - lastWasHitTime;


/* NOP */;
}
public function IsAttacked(byPlayer : Bool){
if (byPlayer){
super.SignalGameplayEvent('AttackedByPlayer');
}
lastWasAttackedTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function IsAttackerAtBack(attacker : CNode) : Bool{
var targetToSourceAngle : Float;
if (!attacker){
return false;
}
targetToSourceAngle = AbsF(NodeToNodeAngleDistance(attacker, thi
s));
if (targetToSourceAngle > 90){
return true;
}
return false;
/* NOP */;
}
public function ProcessSlideToTarget(duration : Float, slideProperties :
SSlideToTargetEventProps){
var attackerWorldPos : Vector;
var targetWorldPos : Vector;
var slideToWorldPos : Vector;
var targetNearestPointWorldPos : Vector;
var attackerToTargetDist : Float;
var minSlideDistance : Float;
var maxSlideDistance : Float;
var slideDuration : Float;
if (!slideTarget){
return;
}
slideDuration = duration;
minSlideDistance = slideProperties.minSlideDist;
maxSlideDistance = slideProperties.maxSlideDist;
attackerWorldPos = GetWorldPosition();
targetWorldPos = slideTarget.GetWorldPosition();
if ((CActor)slideTarget){
targetNearestPointWorldPos = (CActor)slideTarget.GetNear
estPointInPersonalSpace(attackerWorldPos);
} else {
targetNearestPointWorldPos = slideTarget.GetWorldPositio
n();
}
attackerToTargetDist = VecDistance(attackerWorldPos, targetWorld
Pos);
if (attackerToTargetDist > minSlideDistance && attackerToTargetD
ist < maxSlideDistance){
GetVisualDebug().AddSphere('NearestEnemyLoc', 0.200000,
targetNearestPointWorldPos, true, Color(0, 255, 255), 0.100000);
super.ActionSlideToAsync(targetNearestPointWorldPos, sli
deDuration);
}
/* NOP */;
}
public function ProcessSlideToTargetDistance(duration : Float, targetDis

t : Float){
var targetPos : Vector;
var targetToPlayerVector : Vector;
var slidePosition : Vector;
targetPos = GetTarget().GetWorldPosition();
targetToPlayerVector = VecNormalize(GetWorldPosition() - targetP
os);
slidePosition = targetPos + targetToPlayerVector * targetDist;
GetVisualDebug().AddSphere('SyncLocation', 0.250000, slidePositi
on, true, Color(0, 210, 210), 60.000000);
super.ActionSlideToAsync(slidePosition, duration);
/* NOP */;
}
public function SetDetailedHitType(hitType : EDetailedHitType){
SetBehaviorVariable('detailedHitType', hitType, /* NOP */);
/* NOP */;
}
public function ChooseDetailedHitType(parryInfo : SParryInfo) : EDetaile
dHitType{
switch(parryInfo.attackSwingType){
case 4:
return 1;
case 1:
return 1;
default:
}
if (parryInfo.attackSwingDir == 3){
return 2;
} else if (parryInfo.attackSwingDir == 2){
return 3;
} else {
return 0;
}
/* NOP */;
}
public function ChooseParryTypeIndex(parryInfo : SParryInfo) : Float{
var parryType : EParryType;
var parryTypeIndex : Float;
parryType = thePlayer.parryTypeTable[parryInfo.attackSwingType][
parryInfo.attackSwingDir];
lastParryType = parryType;
parryTypeIndex = parryType;
return parryTypeIndex;
/* NOP */;
}
public function ProcessParryInfo(attacker : CActor, target : CActor, att
ackSwingType : EAttackSwingType, attackSwingDir : EAttackSwingDirection, attActi
onName : CName, attackerWeaponId : SItemUniqueId, canBeParried : Bool) : SParryI
nfo{
var parryInfo : SParryInfo;
parryInfo.attacker = attacker;
parryInfo.target = target;
parryInfo.attackActionName = attActionName;
parryInfo.attackerWeaponId = attackerWeaponId;
parryInfo.targetToAttackerAngleAbs = AbsF(NodeToNodeAngleDistanc
e(attacker, target));
parryInfo.targetToAttackerDist = VecDistance(attacker.GetWorldPo
sition(), target.GetWorldPosition());
parryInfo.attackSwingType = attackSwingType;
parryInfo.attackSwingDir = attackSwingDir;

parryInfo.canBeParried = canBeParried;
target.SetDetailedHitType(ChooseDetailedHitType(parryInfo));
return parryInfo;
/* NOP */;
}
public timer function DelayDodgeProjectileEventTimer(optional dt : Float
, optional id : Int32){
super.SignalGameplayEvent('Time2DodgeProjectileDelayed');
/* NOP */;
}
public timer function DelayDodgeBombEventTimer(optional dt : Float, opti
onal id : Int32){
super.SignalGameplayEvent('Time2DodgeBombDelayed');
/* NOP */;
}
public timer function DelayRepulseProjectileEventTimer(optional dt : Flo
at, optional id : Int32){
super.SignalGameplayEvent('Time2RepulseProjectileDelayed');
/* NOP */;
}
public timer function DelayRepulseBombEventTimer(optional dt : Float, op
tional id : Int32){
super.SignalGameplayEvent('Time2RepulseBombDelayed');
/* NOP */;
}
public function GetTotalArmor() : SAbilityAttributeValue{
return GetAttributeValue(theGame.params.ARMOR_VALUE_NAME, /* NOP
*/, true);
/* NOP */;
}
public function HasWeaponDrawn(treatFistsAsWeapon : Bool) : Bool{
var ids : array<SItemUniqueId>;
var i : Int32;
var fistsIds : array<SItemUniqueId>;
var inv : CInventoryComponent;
inv = GetInventory();
ids = inv.GetAllWeapons();
if (treatFistsAsWeapon){
i = 0;
while (i < ids.Size()){
if (inv.IsItemHeld(ids[i])){
return true;
}
i += 1;
}
} else {
fistsIds = inv.GetItemsByCategory('fist');
i = 0;
while (i < ids.Size()){
if (!fistsIds.Contains(ids[i]) && inv.IsItemHeld
(ids[i])){
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
public function UnequipItem(item : SItemUniqueId) : Bool{

return GetInventory().UnmountItem(item, true);


/* NOP */;
}
public function EquipItem(item : SItemUniqueId, slot : EEquipmentSlots,
toHand : Bool) : Bool{
return GetInventory().MountItem(item, toHand, /* NOP */);
/* NOP */;
}
public function IsInAgony() : Bool{
}
public function Agony(){
}
public function IsKnockedUnconscious() : Bool{
return knockedUncounscious;
/* NOP */;
}
public function EnterKnockedUnconscious(){
knockedUncounscious = true;
/* NOP */;
}
public function EndKnockedUnconscious(){
knockedUncounscious = false;
/* NOP */;
}
private timer function EnableHitAnim(optional time : Float, optional id
: Int32){
SetCanPlayHitAnim(true);
/* NOP */;
}
public function SetUsedVehicle(ent : CGameplayEntity){
usedVehicle = ent;
if (usedVehicle){
EntityHandleSet(usedVehicleHandle, usedVehicle);
GetRootAnimatedComponent().UpdateByOtherAnimatedComponen
t(usedVehicle.GetRootAnimatedComponent());
GetMovingAgentComponent().SetUseEntityForPelvisOffset(us
edVehicle);
} else {
EntityHandleSet(usedVehicleHandle, NULL);
GetRootAnimatedComponent().DontUpdateByOtherAnimatedComp
onent();
GetMovingAgentComponent().SetUseEntityForPelvisOffset(/*
NOP */);
}
/* NOP */;
}
public function GetUsedVehicle() : CGameplayEntity{
var vehicleFromHandle : CGameplayEntity;
vehicleFromHandle = (CGameplayEntity)EntityHandleGet(usedVehicle
Handle);
if (vehicleFromHandle){
return vehicleFromHandle;
}
return usedVehicle;
/* NOP */;
}
public function IsUsingVehicle() : Bool{
if (EntityHandleGet(usedVehicleHandle)){
return true;
}

return usedVehicle;
/* NOP */;
}
public function IsUsingHorse(ignoreMountInProgress : Bool) : Bool{
var horseComp : W3HorseComponent;
var mountStatus : EVehicleMountStatus;
horseComp = GetUsedHorseComponent();
if (horseComp){
mountStatus = horseComp.riderSharedParams.mountStatus;
if (ignoreMountInProgress){
return mountStatus == 1;
} else {
return mountStatus == 1 || mountStatus == 0;
}
}
return false;
/* NOP */;
}
public function IsUsingBoat() : Bool{
if ((W3Boat)GetUsedVehicle()){
return true;
}
return false;
/* NOP */;
}
public function GetUsedHorseComponent() : W3HorseComponent{
var npc : CNewNPC;
npc = (CNewNPC)GetUsedVehicle();
if (npc){
return npc.GetHorseComponent();
}
return NULL;
/* NOP */;
}
public final function FindAndMountVehicle(mountType : EVehicleMountType,
maxDistance : Float) : Bool{
var vehicle : CVehicleComponent;
/* NOP */;
vehicle = FindTheNearestVehicle(maxDistance, true);
/* NOP */;
if (vehicle){
vehicle.StopTheVehicle();
vehicle.Mount(this, mountType, 0);
return true;
}
return false;
/* NOP */;
}
public final function FindTheNearestVehicle(maxDistance : Float, require
ToBeMountable : Bool) : CVehicleComponent{
var vehicle : CVehicleComponent;
var nodes : array<CNode>;
var vehicleEntity : CEntity;
theGame.GetNodesByTag('vehicle', nodes);
if (nodes.Size() == 0){
return NULL;
}
vehicleEntity = SelectTheNearestVehicles(nodes, maxDistance);
if (!vehicleEntity){
return NULL;

}
vehicle = (CVehicleComponent)vehicleEntity.GetComponentByClassNa
me('CVehicleComponent');
if (requireToBeMountable && vehicle && !vehicle.CanBeUsedBy(this
)){
return NULL;
}
return vehicle;
/* NOP */;
}
private final function SelectTheNearestVehicles(nodes : array<CNode>, ma
xDistance : Float) : CEntity{
var i : Int32;
var size : Int32;
var bestEnt : CEntity;
var curr : Float;
var best : Float;
var posA : Vector;
var posB : Vector;
bestEnt = NULL;
size = nodes.Size();
best = maxDistance * maxDistance;
posB = GetWorldPosition();
i = 0;
while (i < size){
posA = nodes[i].GetWorldPosition();
curr = VecDistanceSquared2D(posA, posB);
if (curr < best){
best = curr;
bestEnt = (CEntity)nodes[i];
}
i += 1;
}
return bestEnt;
/* NOP */;
}
public function GetCurrentEffects() : array<CBaseGameplayEffect>{
var null : array<CBaseGameplayEffect>;
if (effectManager){
return effectManager.GetCurrentEffects(/* NOP */, /* NOP
*/, /* NOP */);
}
return null;
/* NOP */;
}
public function GetNeedsToReduceFallingDamage(heightDiff : Float) : Bool
{
return heightDiff >= damageDistanceNotReducing;
/* NOP */;
}
public function CanReduceFallDamage(heightDiff : Float) : Bool{
return heightDiff <= damageDistanceReducing;
/* NOP */;
}
public function ApplyFallingDamage(heightDiff : Float, reducing : Bool)
: Float{
var action : W3DamageAction;
var dmgPerc : Float;
var damageValue : Float;
var deathDistance : Float;

var damageDistance : Float;


var totalDamage : Float;
if (reducing){
deathDistance = deathDistanceReducing;
damageDistance = damageDistanceReducing;
} else {
deathDistance = deathDistNotReducing;
damageDistance = damageDistanceNotReducing;
}
if (heightDiff < damageDistance){
return 0.000000;
}
if (heightDiff > deathDistance){
dmgPerc = 1.000000;
PlayEffect('heavy_hit', /* NOP */);
PlayEffect('hit_screen', /* NOP */);
totalDamage = GetMaxHealth();
} else {
dmgPerc = MapF(heightDiff, damageDistance, deathDistance
, 0.000000, 1.000000);
if (dmgPerc < 1.000000 && dmgPerc >= GetHealthPercents()
- fallDamageMinHealthPerc){
totalDamage = MaxF(0.000000, GetHealthPercents()
- fallDamageMinHealthPerc) * GetMaxHealth();
} else {
totalDamage = dmgPerc * GetMaxHealth();
}
}
action = new W3DamageAction in this;
action.Initialize(NULL, this, NULL, "FallingDamage", 0, 2, false
, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.SetCanPlayHitParticle(false);
damageValue = totalDamage;
action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, damageValue)
;
theGame.damageMgr.ProcessAction(action);
delete action;
return dmgPerc;
/* NOP */;
}
public function OnContactEvent(position : Vector, force : Vector, otherB
ody : CComponent, actorIndex : Int32, shapeIndex : Int32) : Bool{
var mass : Float;
var velocity : Float;
var momentum : Float;
var damage : W3DamageAction;
var damageVal : Float;
var hitReaction : EHitReactionType;
if (collisionDamageTimestamp + 1.000000 > theGame.GetEngineTimeA
sSeconds()){
return false;
}
if (otherBody.HasCollisionType('Ragdoll', actorIndex, shapeIndex
) || otherBody.HasCollisionType('Weapon', actorIndex, shapeIndex) || otherBody.H
asCollisionType('Corpse', actorIndex, shapeIndex)){
return false;
}
mass = otherBody.GetPhysicalObjectMass(actorIndex);
velocity = VecLength(otherBody.GetPhysicalObjectLinearVelocity(a
ctorIndex));

momentum = mass * velocity;


if (momentum < 50.000000 || velocity < 3.500000){
return false;
}
damageVal = 0.250000 * momentum;
hitReaction = 1;
if (damageVal > 100.000000){
damageVal = 100.000000;
}
damage = new W3DamageAction in this;
damage.Initialize((CGameplayEntity)otherBody.GetEntity(), this,
theGame, "physical_object_damage", hitReaction, 2, false, false, false, true, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
damage.AddDamage(theGame.params.DAMAGE_NAME_PHYSICAL, damageVal)
;
theGame.damageMgr.ProcessAction(damage);
collisionDamageTimestamp = theGame.GetEngineTimeAsSeconds();
delete damage;
/* NOP */;
}
public function OnCustomCamera(eventName : CName, properties : SMultiVal
ue, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : B
ool{
var customCameraParams : SCustomCameraParams;
var player : CR4Player;
player = thePlayer;
if (properties.enums[0].enumType != 'ECustomCameraType'){
/* NOP */;
} else if (properties.enums[0].enumValue == 0){
player.DisableCustomCamInStack(customCameraStackIndex);
} else {
customCameraParams.source = this;
customCameraParams.cameraParams = properties;
customCameraParams.useCustomCamera = true;
player.DisableCustomCamInStack(customCameraStackIndex);
customCameraStackIndex = player.AddCustomCamToStack(cust
omCameraParams);
super.SignalGameplayEventParamInt('CameraIndex', customC
ameraStackIndex);
}
/* NOP */;
}
public function OnFrostHit(source : CGameplayEntity) : Bool{
super.OnFrostHit(source);
if ((W3WhiteFrost)source){
RemoveAllBuffsOfType(18);
}
/* NOP */;
}
public function SetIsSwimming(toggle : Bool){
isSwimming = toggle;
/* NOP */;
}
public function IsSwimming() : Bool{
return isSwimming;
/* NOP */;
}
public final function IsDiving() : Bool{
if (!MAC){
MAC = (CMovingPhysicalAgentComponent)GetMovingAgentCompo

nent();
}
if (MAC){
return MAC.IsDiving();
}
return false;
/* NOP */;
}
public final function GetSwordTipMovementFromAnimation(animation : CName
, time : Float, deltaTime : Float, hitWeapon : CItemEntity) : Vector{
var handBone : CName;
var handBoneIdx : Int32;
var boneAtTimeMS : Matrix;
var boneWithDeltaTimeMS : Matrix;
var swordTipAtTime : Vector;
var swordTipWithDeltaTime : Vector;
var localToWorld : Matrix;
var weaponSlotMatrixWS : Matrix;
var handMatrixWS : Matrix;
handBone = 'r_weapon';
handBoneIdx = GetBoneIndex(handBone);
hitWeapon.CalcEntitySlotMatrix('blood_fx_point', weaponSlotMatri
xWS);
handMatrixWS = GetBoneWorldMatrixByIndex(handBoneIdx);
swordTipAtTime = MatrixGetTranslation(weaponSlotMatrixWS);
swordTipAtTime = VecTransform(MatrixGetInverted(handMatrixWS), s
wordTipAtTime);
swordTipWithDeltaTime = swordTipAtTime;
GetRootAnimatedComponent().GetBoneMatrixMovementModelSpaceInAnim
ation(handBoneIdx, animation, time, deltaTime, boneAtTimeMS, boneWithDeltaTimeMS
);
swordTipAtTime = VecTransform(boneAtTimeMS, swordTipAtTime);
swordTipWithDeltaTime = VecTransform(boneWithDeltaTimeMS, swordT
ipWithDeltaTime);
localToWorld = GetLocalToWorld();
swordTipAtTime = VecTransform(localToWorld, swordTipAtTime);
swordTipWithDeltaTime = VecTransform(localToWorld, swordTipWithD
eltaTime);
return swordTipWithDeltaTime - swordTipAtTime;
/* NOP */;
}
public function GetLyingDownFacingDirection() : Float{
var boneAngles : EulerAngles;
var pitch : Float;
boneAngles = MatrixGetRotation(GetBoneWorldMatrixByIndex(GetBone
Index('torso3')));
pitch = boneAngles.Pitch;
return pitch;
/* NOP */;
}
public function RegisterCollisionEventsListener(){
var physicalComponent : CMovingPhysicalAgentComponent;
physicalComponent = (CMovingPhysicalAgentComponent)GetComponentB
yClassName('CMovingPhysicalAgentComponent');
if (physicalComponent){
physicalComponent.RegisterEventListener(this);
}
/* NOP */;
}
public function OnRagdollOnGround() : Bool{

}
public function OnRagdollInAir() : Bool{
}
public function OnNoLongerInRagdoll() : Bool{
}
public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, vict
imMonsterCategory : EMonsterCategory, isStrikeAtBack : Bool) : SAbilityAttribute
Value{
return GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONU
S, /* NOP */, /* NOP */);
/* NOP */;
}
public function HasAlternateQuen() : Bool{
return false;
/* NOP */;
}
public function FinishQuen(){
}
public function UpdateStatsForDifficultyLevel(d : EDifficultyMode){
if (abilityManager && abilityManager.IsInitialized() && super.Is
Alive()){
abilityManager.UpdateStatsForDifficultyLevel(d);
}
/* NOP */;
}
public function GetLevel() : Int32{
return -1;
/* NOP */;
}
public function GetAbilityCount(abilityName : CName) : Int32{
var i : Int32;
var cnt : Int32;
var all : array<CName>;
all = GetAbilities(true);
cnt = 0;
i = 0;
while (i < all.Size()){
if (all[i] == abilityName){
cnt += 1;
}
i += 1;
}
return cnt;
/* NOP */;
}
public function TestIsInSettlement() : Bool{
var ents : array<CEntity>;
var trigger : CTriggerAreaComponent;
var i : Int32;
theGame.GetEntitiesByTag('settlement', ents);
i = 0;
while (i < ents.Size()){
trigger = (CTriggerAreaComponent)ents[i].GetComponentByC
lassName('CTriggerAreaComponent');
if (trigger.TestEntityOverlap(this)){
return true;
}
i += 1;
}
return false;

/* NOP */;
}
public function OnSpawnedEditor(spawnData : SEntitySpawnData) : Bool{
var resource : CEntityTemplate;
var resourceKey : CName;
var itemName : CName;
var ent : CEntity;
var i : Int32;
var items : array<SItemUniqueId>;
var ids : array<SItemUniqueId>;
var inv : CInventoryComponent;
var geraltInv : CInventoryComponent;
var definition : EPlayerPreviewInventory;
if (GetVoicetag() != 'GERALT'){
return true;
}
definition = theGame.GetGameplayConfigEnumValue('playerPreviewIn
ventory');
switch(definition){
case 1:
resourceKey = 'preview_inventory_bear_1';
break;
case 2:
resourceKey = 'preview_inventory_bear_4';
break;
case 3:
resourceKey = 'preview_inventory_lynx_1';
break;
case 4:
resourceKey = 'preview_inventory_lynx_4';
break;
case 5:
resourceKey = 'preview_inventory_gryphon_1';
break;
case 6:
resourceKey = 'preview_inventory_gryphon_4';
break;
case 7:
resourceKey = 'preview_inventory_common_1';
break;
case 8:
resourceKey = 'preview_inventory_naked';
break;
case 9:
resourceKey = 'preview_inventory_viper';
break;
case 0:
default:
resourceKey = 'preview_inventory_default';
break;
}
resource = (CEntityTemplate)LoadResource(resourceKey, /* NOP */)
;
geraltInv = GetInventory();
geraltInv.InitInvFromTemplate(resource);
/* NOP */;
}
public function OnCutsceneDeath() : Bool{
Kill(true, /* NOP */, /* NOP */);
/* NOP */;

}
public function ShouldAttachArrowToPlayer(action : W3DamageAction){
var arrow : W3ArrowProjectile;
if (action.victim == thePlayer){
if ((W3ArrowProjectile)action.causer){
if (action.processedDmg.vitalityDamage == 0){
arrow = (W3ArrowProjectile)action.causer
;
arrow.SetShouldBeAttachedToVictim(false)
;
}
}
}
/* NOP */;
}
private final function CacheHudModuleHealFloater(heal : Float){
cachedHeal += heal;
if (!hudModuleHealScheduledUpdate){
hudModuleHealScheduledUpdate = true;
AddTimer('HudModuleHealUpdate', 1.000000, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function HudModuleHealUpdate(optional dt : Float, optional
id : Int32){
if (cachedHeal >= 1.000000){
ShowFloatingValue(5, cachedHeal, false, /* NOP */);
cachedHeal = 0.000000;
}
hudModuleHealScheduledUpdate = false;
/* NOP */;
}
private final function CacheHudModuleDoTDamageFloater(dmg : Float){
cachedDoTDamage += dmg;
if (!hudModuleDoTScheduledUpdate){
hudModuleDoTScheduledUpdate = true;
AddTimer('HudModuleDoTUpdate', 1.000000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function HudModuleDoTUpdate(optional dt : Float, optional i
d : Int32){
if (cachedDoTDamage >= 1.000000){
ShowFloatingValue(4, cachedDoTDamage, false, /* NOP */);
cachedDoTDamage = 0.000000;
}
hudModuleDoTScheduledUpdate = false;
/* NOP */;
}
public function ShowFloatingValue(type : EFloatingValueType, value : Flo
at, cache : Bool, stringParam : String){
var hud : CR4ScriptedHud;
var module : CR4HudModuleEnemyFocus;
if (type == 5 && cache){
super.CacheHudModuleHealFloater(value);
} else if (type == 4 && cache){
super.CacheHudModuleDoTDamageFloater(value);
} else if (thePlayer.GetTarget() == this){

hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
module = (CR4HudModuleEnemyFocus)hud.GetHudModul
e("EnemyFocusModule");
if (module){
module.ShowDamageType(type, value, strin
gParam);
}
}
}
/* NOP */;
}
public function Debug_GetUsedDifficultyMode() : EDifficultyMode{
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.Debug_GetUsedDifficultyMode();
}
return 0;
/* NOP */;
}
}
import abstract class CBehTreeMachine{
}
struct SSlidingMaterialPresetParams{
editable var presetName : CName;
editable var angleMin : Float;
editable var angleMinRain : Float;
editable var frictionMultiplier : Float;
editable var frictionMultiplierRain : Float;
}
struct SSlidingMaterialNamesToPresets{
editable var materialName : CName;
editable var presetName : CName;
}
class InterpCurveF extends InterpCurve{
public var points : array<InterpCurvePointF>;
public function AddPoint(inVal : Float, outVal : Float) : Int32{
var keyPoint : InterpCurvePointF;
var numPoints : Int32;
var i : Int32;
keyPoint = new InterpCurvePointF in this;
numPoints = points.Size();
keyPoint.inVal = inVal;
keyPoint.outVal = outVal;
keyPoint.interpMode = 1;
i = 0;
while (i < numPoints && points[i].inVal < inVal){
/* NOP */;
i = i + 1;
}
points.Insert(i, keyPoint);
return i;
/* NOP */;
}
private function ComputeCurveTangent(prevTime : Float, prevPoint : Float
, currTime : Float, currPoint : Float, nextTime : Float, nextPoint : Float, tens
ion : Float, outTangent : Float){

var timeDiff : Float;


AutoCalcTangent(prevPoint, currPoint, nextPoint, tension, outTan
gent);
timeDiff = MaxF(EPSILON(), nextTime - prevTime);
outTangent /= timeDiff;
/* NOP */;
}
private function AutoCalcTangent(prevP : Float, p : Float, nextP : Float
, tension : Float, outTan : Float){
outTan = 1.000000 - tension * p - prevP + nextP - p;
/* NOP */;
}
private function AutoCalcClampTngent(prevP : Float, p : Float, nextP : F
loat, tension : Float, outTan : Float){
}
public function AutoSetTangents(tension : Float){
var numPoints : Int32;
var ptIdx : Int32;
var arriveTangent : Float;
var leaveTangent : Float;
numPoints = points.Size();
ptIdx = 0;
while (ptIdx < numPoints){
arriveTangent = points[ptIdx].arriveTangent;
leaveTangent = points[ptIdx].leaveTangent;
if (ptIdx == 0){
if (ptIdx < numPoints - 1){
if (points[ptIdx].interpMode == 2){
leaveTangent = 0;
}
} else {
leaveTangent = 0;
}
} else if (ptIdx < numPoints - 1){
if (points[ptIdx].interpMode == 2){
if (points[ptIdx - 1].IsCurveKey() && po
ints[ptIdx].IsCurveKey()){
if (interpMethod == 0){
ComputeCurveTangent(poin
ts[ptIdx - 1].inVal, points[ptIdx - 1].outVal, points[ptIdx].inVal, points[ptIdx
].outVal, points[ptIdx + 1].inVal, points[ptIdx + 1].outVal, tension, arriveTang
ent);
} else {
AutoCalcTangent(points[p
tIdx - 1].outVal, points[ptIdx].outVal, points[ptIdx + 1].outVal, tension, arriv
eTangent);
}
leaveTangent = arriveTangent;
} else if (points[ptIdx - 1].interpMode
== 0 || points[ptIdx].interpMode == 0){
arriveTangent = 0;
leaveTangent = 0;
}
}
} else if (points[ptIdx].interpMode == 2){
arriveTangent = 0;
}
points[ptIdx].arriveTangent = arriveTangent;
points[ptIdx].leaveTangent = leaveTangent;
ptIdx = ptIdx + 1;

}
/* NOP */;
}
public function Eval(inVal : Float, defaultVal : Float, ptIdx : Int32) :
Float{
var numPoints : Int32;
var diff : Float;
var i : Int32;
var alpha : Float;
numPoints = points.Size();
if (numPoints == 0){
ptIdx = -1;
return defaultVal;
}
if (numPoints < 2 || inVal <= points[0].inVal){
ptIdx = 0;
return points[0].outVal;
}
if (inVal >= points[numPoints - 1].inVal){
ptIdx = numPoints - 1;
return points[numPoints - 1].outVal;
}
i = 1;
while (i < numPoints){
if (inVal < points[i].inVal){
diff = points[i].inVal - points[i - 1].inVal;
if (diff > 0.000000){
alpha = inVal - points[i - 1].inVal / di
ff;
ptIdx = i - 1;
switch(points[i - 1].interpMode){
case 0:
return points[numPoints - 1].out
Val;
break;
case 1:
return LerpF(alpha, points[i - 1
].outVal, points[i].outVal, /* NOP */);
break;
default:
switch(interpMethod){
case 2:
return CubicInterp_F(poi
nts[i - 1].outVal, points[i - 1].leaveTangent, points[i].outVal, points[i].arriv
eTangent, alpha);
break;
default:
return CubicInterp_F(poi
nts[i - 1].outVal, points[i - 1].leaveTangent * diff, points[i].outVal, points[i
].arriveTangent * diff, alpha);
break;
}
break;
}
}
}
i = i + 1;
}
ptIdx = numPoints - 1;
return points[numPoints - 1].outVal;

/* NOP */;
}
}
class InterpCurveV extends InterpCurve{
public var points : array<InterpCurvePointV>;
public function AddPoint(inVal : Float, outVal : Vector) : Int32{
var keyPoint : InterpCurvePointV;
var numPoints : Int32;
var i : Int32;
keyPoint = new InterpCurvePointV in this;
numPoints = points.Size();
keyPoint.inVal = inVal;
keyPoint.outVal = outVal;
keyPoint.interpMode = 1;
i = 0;
while (i < numPoints && points[i].inVal < inVal){
/* NOP */;
i = i + 1;
}
points.Insert(i, keyPoint);
return i;
/* NOP */;
}
private function ComputeCurveTangent(prevTime : Float, prevPoint : Vecto
r, currTime : Float, currPoint : Vector, nextTime : Float, nextPoint : Vector, t
ension : Float, outTangent : Vector){
var timeDiff : Float;
AutoCalcTangent(prevPoint, currPoint, nextPoint, tension, outTan
gent);
timeDiff = MaxF(EPSILON(), nextTime - prevTime);
outTangent /= timeDiff;
/* NOP */;
}
private function AutoCalcTangent(prevP : Vector, p : Vector, nextP : Vec
tor, tension : Float, outTan : Vector){
outTan = 1.000000 - tension * p - prevP + nextP - p;
/* NOP */;
}
private function AutoCalcClampTngent(prevP : Float, p : Float, nextP : F
loat, tension : Float, outTan : Float){
}
public function AutoSetTangents(tension : Float){
var numPoints : Int32;
var ptIdx : Int32;
var arriveTangent : Vector;
var leaveTangent : Vector;
numPoints = points.Size();
ptIdx = 0;
while (ptIdx < numPoints){
arriveTangent = points[ptIdx].arriveTangent;
leaveTangent = points[ptIdx].leaveTangent;
if (ptIdx == 0){
if (ptIdx < numPoints - 1){
if (points[ptIdx].interpMode == 2){
leaveTangent = Vector(0.000000,
0.000000, 0.000000, 0.000000);
}
} else {
leaveTangent = Vector(0.000000, 0.000000

, 0.000000, 0.000000);
}
} else if (ptIdx < numPoints - 1){
if (points[ptIdx].interpMode == 2){
if (points[ptIdx - 1].IsCurveKey() && po
ints[ptIdx].IsCurveKey()){
if (interpMethod == 0){
ComputeCurveTangent(poin
ts[ptIdx - 1].inVal, points[ptIdx - 1].outVal, points[ptIdx].inVal, points[ptIdx
].outVal, points[ptIdx + 1].inVal, points[ptIdx + 1].outVal, tension, arriveTang
ent);
} else {
AutoCalcTangent(points[p
tIdx - 1].outVal, points[ptIdx].outVal, points[ptIdx + 1].outVal, tension, arriv
eTangent);
}
leaveTangent = arriveTangent;
} else if (points[ptIdx - 1].interpMode
== 0 || points[ptIdx].interpMode == 0){
arriveTangent = Vector(0.000000,
0.000000, 0.000000, 0.000000);
leaveTangent = Vector(0.000000,
0.000000, 0.000000, 0.000000);
}
}
} else if (points[ptIdx].interpMode == 2){
arriveTangent = Vector(0.000000, 0.000000, 0.000
000, 0.000000);
}
points[ptIdx].arriveTangent = arriveTangent;
points[ptIdx].leaveTangent = leaveTangent;
ptIdx = ptIdx + 1;
}
/* NOP */;
}
public function Eval(inVal : Float, defaultVal : Vector, ptIdx : Int32)
: Vector{
var numPoints : Int32;
var diff : Float;
var i : Int32;
var alpha : Float;
numPoints = points.Size();
if (numPoints == 0){
ptIdx = -1;
return defaultVal;
}
if (numPoints < 2 || inVal <= points[0].inVal){
ptIdx = 0;
return points[0].outVal;
}
if (inVal >= points[numPoints - 1].inVal){
ptIdx = numPoints - 1;
return points[numPoints - 1].outVal;
}
i = 1;
while (i < numPoints){
if (inVal < points[i].inVal){
diff = points[i].inVal - points[i - 1].inVal;
if (diff > 0.000000){
alpha = inVal - points[i - 1].inVal / di

ff;
ptIdx = i - 1;
switch(points[i - 1].interpMode){
case 0:
return points[numPoints - 1].out
Val;
break;
case 1:
return LerpV(points[i - 1].outVa
l, points[i].outVal, alpha);
break;
default:
switch(interpMethod){
case 2:
return CubicInterp_V(poi
nts[i - 1].outVal, points[i - 1].leaveTangent, points[i].outVal, points[i].arriv
eTangent, alpha);
break;
default:
return CubicInterp_V(poi
nts[i - 1].outVal, points[i - 1].leaveTangent * diff, points[i].outVal, points[i
].arriveTangent * diff, alpha);
break;
}
break;
}
}
}
i = i + 1;
}
ptIdx = numPoints - 1;
return points[numPoints - 1].outVal;
/* NOP */;
}
}
class W3SnowballProjectile extends W3AdvancedProjectile{
public editable var damageTypeName : CName;
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var specialFxOnVictimName : CName;
public editable var applyDebuffIfNoDmgWasDealt : Bool;
public function OnProjectileInit() : Bool{
damageTypeName = theGame.params.DAMAGE_NAME_PIERCING;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var action : W3DamageAction;
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit

CollisionsGroups, actorIndex, shapeIndex);


if (victim && !collidedEntities.Contains(victim)){
StopProjectile();
DestroyAfter(1.000000);
SetHideInGame(true);
StopEffect(initFxName);
PlayEffect(onCollisionFxName, /* NOP */);
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 1, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
if (projDMG > 0){
action.AddDamage(damageTypeName, projDMG);
}
action.AddEffectInfo(projEfect, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
action.SetCanPlayHitParticle(false);
action.SetProcessBuffsIfNoDamage(applyDebuffIfNoDmgWasDe
alt);
theGame.damageMgr.ProcessAction(action);
delete action;
if (applyDebuffIfNoDmgWasDealt){
victim.PlayEffect(specialFxOnVictimName, /* NOP
*/);
}
collidedEntities.PushBack(victim);
isActive = false;
} else if (!victim){
StopProjectile();
DestroyAfter(1.000000);
SetHideInGame(true);
StopEffect(initFxName);
PlayEffect(onCollisionFxName, /* NOP */);
isActive = false;
}
return false;
/* NOP */;
}
public function OnRangeReached() : Bool{
isActive = false;
SetHideInGame(true);
StopEffect(initFxName);
DestroyAfter(1.000000);
/* NOP */;
}
}
class CR4LocomotionSwimToStop extends CR4LocomotionDirectControllerScript{
public var player : CR4Player;
public var targetPoint : Vector;
public var closeEnough : Bool;
public function Activate() : Bool{
var exploration : SExplorationQueryToken;
player = (CR4Player)agent.GetEntity();
exploration = thePlayer.substateManager.m_SharedDataO.GetLastExp
loration();
targetPoint = exploration.pointOnEdge;
closeEnough = false;
return super.Activate();
/* NOP */;

}
public function Deactivate(){
player.UpdateRequestedDirectionVariables_PlayerDefault();
super.Deactivate();
/* NOP */;
}
public function UpdateLocomotion(){
var direction : Vector;
var directionYaw : Float;
direction = targetPoint - player.GetWorldPosition();
directionYaw = VecHeading(direction);
directionYaw = AngleNormalize180(AngleDistance(player.GetHeading
(), directionYaw));
directionYaw = ClampF(directionYaw, -90.000000, 90.000000) / 90.
000000;
closeEnough = AbsF(directionYaw) < 0.300000;
player.GetMovingAgentComponent().ResetMoveRequests();
/* NOP */;
}
public function GetIsCloseEnough() : Bool{
return closeEnough;
/* NOP */;
}
}
struct SSkatingLevelParams{
editable var speedMax : Float;
editable var reflectInput : Bool;
}
import abstract class CMoveSteeringBehavior{
}
import struct CMovementAdjustor{
import public final function IsRequestActive(ticket : SMovementAdjustmen
tRequestTicket) : Bool;
import public final function HasAnyActiveRequest() : Bool;
import public final function HasAnyActiveRotationRequests() : Bool;
import public final function HasAnyActiveTranslationRequests() : Bool;
import public final function Cancel(ticket : SMovementAdjustmentRequestT
icket);
import public final function CancelByName(requestName : CName);
import public final function CancelAll();
import public final function CreateNewRequest(requestName : CName) : SMo
vementAdjustmentRequestTicket;
import public final function GetRequest(requestName : CName) : SMovement
AdjustmentRequestTicket;
import public final function BlendIn(ticket : SMovementAdjustmentRequest
Ticket, blendInTime : Float);
import public final function DontEnd(ticket : SMovementAdjustmentRequest
Ticket);
import public final function KeepActiveFor(ticket : SMovementAdjustmentR
equestTicket, duration : Float);
import public final function AdjustmentDuration(ticket : SMovementAdjust
mentRequestTicket, duration : Float);
import public final function Continuous(ticket : SMovementAdjustmentRequ
estTicket);
import public final function BaseOnNode(ticket : SMovementAdjustmentRequ
estTicket, onNode : CNode);
import public final function BindToEvent(ticket : SMovementAdjustmentReq

uestTicket, eventName : CName, adjustDurationOnNextEvent : Bool);


import public final function BindToEventAnimInfo(ticket : SMovementAdjus
tmentRequestTicket, animInfo : SAnimationEventAnimInfo, bindOnly : Bool);
import public final function ScaleAnimation(ticket : SMovementAdjustment
RequestTicket, scaleAnimation : Bool, scaleLocation : Bool, scaleRotation : Bool
);
import public final function ScaleAnimationLocationVertically(ticket : S
MovementAdjustmentRequestTicket, scaleAnimationLocationVertically : Bool);
import public final function DontUseSourceAnimation(ticket : SMovementAd
justmentRequestTicket, dontUseSourceAnimation : Bool);
import public final function UpdateSourceAnimation(ticket : SMovementAdj
ustmentRequestTicket, animInfo : SAnimationEventAnimInfo);
import public final function CancelIfSourceAnimationUpdateIsNotUpdated(t
icket : SMovementAdjustmentRequestTicket, cancelIfSourceAnimationUpdateIsNotUpda
ted : Bool);
import public final function SyncPointInAnimation(ticket : SMovementAdju
stmentRequestTicket, syncPointTime : Float);
import public final function UseBoneForAdjustment(ticket : SMovementAdju
stmentRequestTicket, boneName : CName, useContinuously : Bool, useBoneForLocatio
nAdjustmentWeight : Float, useBoneForRotationAdjustmentWeight : Float, useBoneTo
MatchTargetHeadingWeight : Float);
import public final function MatchEntitySlot(ticket : SMovementAdjustmen
tRequestTicket, entity : CEntity, slotName : CName);
import public final function KeepLocationAdjustmentActive(ticket : SMove
mentAdjustmentRequestTicket);
import public final function ReplaceTranslation(ticket : SMovementAdjust
mentRequestTicket, replaceTranslation : Bool);
import public final function ShouldStartAt(ticket : SMovementAdjustmentR
equestTicket, atLocation : Vector);
import public final function SlideTo(ticket : SMovementAdjustmentRequest
Ticket, targetLocation : Vector);
import public final function SlideBy(ticket : SMovementAdjustmentRequest
Ticket, byVector : Vector);
import public final function SlideTowards(ticket : SMovementAdjustmentRe
questTicket, node : CNode, minDistance : Float, maxDistance : Float);
import public final function SlideToEntity(ticket : SMovementAdjustmentR
equestTicket, entity : CEntity, boneName : CName, minDistance : Float, maxDistan
ce : Float);
import public final function MaxLocationAdjustmentSpeed(ticket : SMoveme
ntAdjustmentRequestTicket, maxSpeed : Float, maxSpeedZ : Float);
import public final function MaxLocationAdjustmentDistance(ticket : SMov
ementAdjustmentRequestTicket, throughSpeed : Bool, locationAdjustmentMaxDistance
XY : Float, locationAdjustmentMaxDistanceZ : Float);
import public final function AdjustLocationVertically(ticket : SMovement
AdjustmentRequestTicket, adjustLocationVertically : Bool);
import public final function KeepRotationAdjustmentActive(ticket : SMove
mentAdjustmentRequestTicket);
import public final function ReplaceRotation(ticket : SMovementAdjustmen
tRequestTicket, replaceRotation : Bool);
import public final function ShouldStartFacing(ticket : SMovementAdjustm
entRequestTicket, targetHeading : Float);
import public final function RotateTo(ticket : SMovementAdjustmentReques
tTicket, targetHeading : Float);
import public final function RotateBy(ticket : SMovementAdjustmentReques
tTicket, byHeading : Float);
import public final function RotateTowards(ticket : SMovementAdjustmentR
equestTicket, node : CNode, offsetHeading : Float);
import public final function MatchMoveRotation(ticket : SMovementAdjustm
entRequestTicket);
import public final function MaxRotationAdjustmentSpeed(ticket : SMoveme

ntAdjustmentRequestTicket, rotationAdjustmentMaxSpeed : Float);


import public final function SteeringMayOverrideMaxRotationAdjustmentSpe
ed(ticket : SMovementAdjustmentRequestTicket, steeringMayOverrideMaxRotationAdju
stmentSpeed : Bool);
import public final function LockMovementInDirection(ticket : SMovementA
djustmentRequestTicket, heading : Float);
import public final function RotateExistingDeltaLocation(ticket : SMovem
entAdjustmentRequestTicket, rotateExistingDeltaLocation : Bool);
import public final function NotifyScript(ticket : SMovementAdjustmentRe
questTicket, notifyObject : IScriptable, eventName : CName, notify : EMovementAd
justmentNotify);
import public final function DontNotifyScript(ticket : SMovementAdjustme
ntRequestTicket, notifyObject : IScriptable, eventName : CName, notify : EMoveme
ntAdjustmentNotify);
import public final function AddOneFrameTranslationVelocity(translationV
elocity : Vector);
import public final function AddOneFrameRotationVelocity(rotationVelocit
y : EulerAngles);
}
class W3Campfire extends CGameplayEntity{
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
AddTimer('CheckForNPCs', 3.000000, true, /* NOP */, /* NOP */, /
* NOP */, /* NOP */);
/* NOP */;
}
public function OnDestroyed() : Bool{
RemoveTimer('CheckForNPCs', /* NOP */);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (activator == thePlayer && interactionComponentName == "Apply
Damage"){
ApplyDamage();
AddTimer('ApplyDamageTimer', 3.000000, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
if (activator == thePlayer && interactionComponentName == "Apply
Damage"){
RemoveTimer('ApplyDamageTimer', /* NOP */);
}
/* NOP */;
}
public function ApplyDamage(){
if (IsOnFire()){
thePlayer.AddEffectDefault(18, this, 'environment', /* N
OP */);
}
/* NOP */;
}
public timer function ApplyDamageTimer(optional dt : Float, optional id
: Int32){
ApplyDamage();
/* NOP */;
}

public timer function CheckForNPCs(optional dt : Float, optional id : In


t32){
var range : Float;
var entities : array<CGameplayEntity>;
var i : Int32;
var actor : CActor;
range = 30.000000;
if (VecDistanceSquared(GetWorldPosition(), thePlayer.GetWorldPos
ition()) <= range * range){
return;
}
FindGameplayEntitiesInRange(entities, this, 20.000000, 10, /* NO
P */, 2, /* NOP */, /* NOP */);
if (entities.Size() == 0){
ToggleFire(false);
} else {
i = 0;
while (i < entities.Size()){
actor = (CActor)entities[i];
if (actor.IsHuman()){
ToggleFire(true);
return;
}
i += 1;
}
ToggleFire(false);
}
/* NOP */;
}
public function IsOnFire() : Bool{
var gameLightComp : CGameplayLightComponent;
gameLightComp = (CGameplayLightComponent)GetComponentByClassName
('CGameplayLightComponent');
return gameLightComp.IsLightOn();
/* NOP */;
}
public function ToggleFire(toggle : Bool){
var gameLightComp : CGameplayLightComponent;
gameLightComp = (CGameplayLightComponent)GetComponentByClassName
('CGameplayLightComponent');
if (gameLightComp){
gameLightComp.SetLight(toggle);
}
/* NOP */;
}
}
import struct CInterestPoint{
}
class W3FireSource extends CGameplayEntity{
public var glComponent : CGameplayLightComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
glComponent = (CGameplayLightComponent)GetComponentByClassName('
CGameplayLightComponent');
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (!glComponent){

glComponent = (CGameplayLightComponent)GetComponentByCla
ssName('CGameplayLightComponent');
}
if (!glComponent){
return false;
}
if (activator == thePlayer && interactionComponentName == "Apply
Damage" && glComponent.IsLightOn()){
thePlayer.AddEffectDefault(18, this, 'environment', /* N
OP */);
AddTimer('ApplyFireSourceDamage', 3.000000, true, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
if (!glComponent){
glComponent = (CGameplayLightComponent)GetComponentByCla
ssName('CGameplayLightComponent');
}
if (!glComponent){
return false;
}
if (activator == thePlayer && interactionComponentName == "Apply
Damage" && glComponent.IsLightOn()){
RemoveTimer('ApplyFireSourceDamage', /* NOP */);
}
/* NOP */;
}
public timer function ApplyFireSourceDamage(optional dt : Float, optiona
l id : Int32){
if (!glComponent){
glComponent = (CGameplayLightComponent)GetComponentByCla
ssName('CGameplayLightComponent');
}
if (!glComponent.IsLightOn()){
RemoveTimer('ApplyFireSourceDamage', /* NOP */);
return;
}
thePlayer.AddEffectDefault(18, this, 'environment', /* NOP */);
/* NOP */;
}
}
import abstract class CStorySceneElement{
}
import abstract class CStorySceneSectionVariant{
}
class CollisionTrajectoryPart extends CPhantomComponent{
private var triggeredCollisions : Int32;
private var waterCollisions : Int32;
private var ownerTrajectory : CollisionTrajectory;
public editable var part : ECollisionTrajectoryPart;
private editable var waterUpPosCheckSlotName : CName;
private editable var waterDownPosCheckSlotName : CName;
public function Initialize(owner : CollisionTrajectory){
triggeredCollisions = 0;

waterCollisions = 0;
ownerTrajectory = owner;
/* NOP */;
}
public function HasCollisions() : Bool{
return triggeredCollisions > 0;
/* NOP */;
}
public function OnCollisionEnter(object : CObject, physicalActorindex :
Int32, shapeIndex : Int32) : Bool{
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
if (!IsValidCollider(component)){
return false;
}
if (!component.GetEntity()){
waterCollisions += 1;
}
triggeredCollisions += 1;
/* NOP */;
}
public function OnCollisionExit(object : CObject, physicalActorindex : I
nt32, shapeIndex : Int32) : Bool{
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
if (!IsValidCollider(component)){
return false;
}
if (!component.GetEntity()){
waterCollisions -= 1;
}
triggeredCollisions = Max(triggeredCollisions - 1, 0);
/* NOP */;
}
private function IsValidCollider(component : CComponent) : Bool{
if (component && (CPhantomComponent)component){
return false;
}
if (component.GetEntity() == ownerTrajectory.stateManager.m_Owne
rE){
return false;
}
return true;
/* NOP */;
}
public function GetDebugText() : String{
return " " + part + " " + triggeredCollisions;
/* NOP */;
}
public function IsGoingToWater() : Bool{
var positionUp : Vector;
var positionDown : Vector;
var slotMatrix : Matrix;
GetEntity().CalcEntitySlotMatrix(waterUpPosCheckSlotName, slotMa

trix);
positionUp = MatrixGetTranslation(slotMatrix);
GetEntity().CalcEntitySlotMatrix(waterDownPosCheckSlotName, slot
Matrix);
positionDown = MatrixGetTranslation(slotMatrix);
return ownerTrajectory.stateManager.m_CollisionManagerO.IsThereW
aterAndIsItDeepEnough(positionUp, positionDown.Z, 0.400000);
/* NOP */;
}
}
import abstract class CStorySceneLocaleVariantMapping{
}
import abstract class CStorySceneEvent{
}
import struct CPeristentEntity{
public function OnBehaviorSnaphot() : Bool{
return false;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
/* NOP */;
}
}
import abstract class CStorySceneEventInfo{
}
class CR4Component extends CScriptedComponent{
public function IgniHit(){
OnIgniHit();
/* NOP */;
}
public function AardHit(){
OnAardHit();
/* NOP */;
}
public function OnIgniHit() : Bool{
}
public function OnAardHit() : Bool{
}
}
import abstract class CStorySceneChoice{
}
class CollisionTrajectory extends CGameplayEntity{
public var stateManager : CExplorationStateManager;
private var collisionSegmentsArr : array<CollisionTrajectoryPart>;
private var firstSegmentCollision : ECollisionTrajectoryPart;
private var trajectoryStatusLastChecked : ECollisionTrajecoryStatus;
private var trajecoryExpStatusLastChecked : ECollisionTrajecoryExplorati
onStatus;
private var goingToWaterLastState : ECollisionTrajectoryToWaterState;
private var computedCollisionState : Bool;
private var computedGoingToWater : Bool;
public function Initialize(exploration : CExplorationStateManager){

var components : array<CComponent>;


var part : CollisionTrajectoryPart;
var i : Int32;
CreateAttachment(exploration.GetEntity(), 'None', /* NOP */, /*
NOP */);
stateManager = exploration;
components = GetComponentsByClassName('CollisionTrajectoryPart')
;
i = 0;
while (i < components.Size()){
part = (CollisionTrajectoryPart)components[i];
if (part){
part.Initialize(this);
collisionSegmentsArr.PushBack(part);
} else {
LogCollisionTrajectory("Wrong CollisionTrajector
yPart: " + components[i].GetName());
}
i += 1;
}
SortParts();
/* NOP */;
}
private function SortParts(){
SortPart(0);
SortPart(1);
SortPart(2);
SortPart(3);
SortPart(4);
SortPart(5);
SortPart(6);
SortPart(7);
SortPart(8);
/* NOP */;
}
private function SortPart(part : ECollisionTrajectoryPart){
var i : Int32;
var partChecking : Int32;
var partFound : Int32;
partChecking = part;
partFound = FindPart(part);
if (partFound != partChecking){
SwapParts(partFound, partChecking);
}
/* NOP */;
}
private function FindPart(part : ECollisionTrajectoryPart) : Int32{
var i : Int32;
i = 0;
while (i < collisionSegmentsArr.Size()){
if (collisionSegmentsArr[i].part == part){
return i;
}
i += 1;
}
LogCollisionTrajectory("Missing CollisionTrajectoryPart: " + par
t);
return 0;
/* NOP */;
}

private function SwapParts(i : Int32, j : Int32){


var partAux : CollisionTrajectoryPart;
partAux = collisionSegmentsArr[i];
collisionSegmentsArr[i] = collisionSegmentsArr[j];
collisionSegmentsArr[j] = partAux;
/* NOP */;
}
public function PreUpdate(){
computedCollisionState = false;
computedGoingToWater = false;
/* NOP */;
}
private function ComputeCollisionStateIfNeeded(){
if (computedCollisionState){
return;
}
if (collisionSegmentsArr[0].HasCollisions()){
trajectoryStatusLastChecked = 4;
firstSegmentCollision = 0;
} else if (collisionSegmentsArr[1].HasCollisions()){
trajectoryStatusLastChecked = 4;
firstSegmentCollision = 1;
} else if (collisionSegmentsArr[2].HasCollisions()){
trajectoryStatusLastChecked = 4;
firstSegmentCollision = 2;
} else if (collisionSegmentsArr[3].HasCollisions()){
trajectoryStatusLastChecked = 3;
firstSegmentCollision = 3;
} else if (collisionSegmentsArr[4].HasCollisions()){
trajectoryStatusLastChecked = 2;
firstSegmentCollision = 4;
} else if (collisionSegmentsArr[5].HasCollisions()){
trajectoryStatusLastChecked = 1;
firstSegmentCollision = 5;
} else {
trajectoryStatusLastChecked = 0;
firstSegmentCollision = 9;
}
computedCollisionState = true;
/* NOP */;
}
public function GetCollisionState() : ECollisionTrajecoryStatus{
ComputeCollisionStateIfNeeded();
return trajectoryStatusLastChecked;
/* NOP */;
}
public function IsPotentialObstacleToUseExploration() : Bool{
ComputeCollisionStateIfNeeded();
if (trajectoryStatusLastChecked >= 4){
return false;
}
if (collisionSegmentsArr[6].HasCollisions()){
return false;
}
if (!collisionSegmentsArr[7].HasCollisions()){
return false;
}
return true;
/* NOP */;
}

public function IsPotentialObstacleToJump() : Bool{


ComputeCollisionStateIfNeeded();
if (trajectoryStatusLastChecked >= 3){
return false;
}
if (collisionSegmentsArr[7].HasCollisions()){
return true;
}
if (collisionSegmentsArr[8].HasCollisions() && trajectoryStatusL
astChecked >= 1){
return true;
}
return false;
/* NOP */;
}
public function GetRefinedObstacleToJumpPosition(position : Vector) : Bo
ol{
var world : CWorld;
var normalCollided : Vector;
var posEnd : Vector;
var resultPosition : Vector;
var radius : Float;
radius = 0.400000;
world = theGame.GetWorld();
if (!world){
return false;
}
position = collisionSegmentsArr[7].GetWorldPosition() + Vector(0
, 0, 1.000000);
posEnd = position + Vector(0, 0, -2.000000);
if (!world.SweepTest(position, posEnd, radius, resultPosition, n
ormalCollided, /* NOP */)){
return false;
}
position = resultPosition;
return true;
/* NOP */;
}
private function ComputeGoingToWaterIfNeeded(){
if (computedGoingToWater){
return;
}
ComputeCollisionStateIfNeeded();
if (trajectoryStatusLastChecked != 0 && trajectoryStatusLastChec
ked != 1 && trajectoryStatusLastChecked != 2){
goingToWaterLastState = 0;
} else if (collisionSegmentsArr[4].IsGoingToWater()){
goingToWaterLastState = 1;
} else if (collisionSegmentsArr[5].IsGoingToWater()){
goingToWaterLastState = 2;
} else {
goingToWaterLastState = 0;
}
computedGoingToWater = true;
/* NOP */;
}
public function IsGoingToWater() : ECollisionTrajectoryToWaterState{
ComputeGoingToWaterIfNeeded();
return goingToWaterLastState;
/* NOP */;

}
public function DrawDebugText(horizontalPos : Int32, verticalPos : Int32
, heightStep : Int32, width : Int32, height : Int32, textColor : Color) : Int32{
var text : String;
var i : Int32;
ComputeGoingToWaterIfNeeded();
text = " Prediction state: ";
if (IsPotentialObstacleToJump()){
text += "ObstacleToJump.";
} else if (IsPotentialObstacleToUseExploration()){
text += "ObstacleToExplore.";
} else {
text += "No prediction.";
}
text += " Trajectory obstruction: " + trajectoryStatusLastChec
ked;
text += " Going to water: " + IsGoingToWater();
thePlayer.GetVisualDebug().AddBar('JumpTrajectory', horizontalPo
s, verticalPos, width, height, 0.000000, textColor, text, 0.000000);
verticalPos += heightStep;
text = " Parts: ";
i = 0;
while (i < collisionSegmentsArr.Size()){
text += collisionSegmentsArr[i].GetDebugText();
i += 1;
}
thePlayer.GetVisualDebug().AddBar('JumpTrajectoryPart', horizont
alPos, verticalPos, width, height, 0.000000, textColor, text, 0.000000);
verticalPos += heightStep;
return verticalPos;
/* NOP */;
}
}
import abstract class CStorySceneLinkElement{
}
struct ErrandDetailsList{
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
var posX : Int32;
var posY : Int32;
var errandPosition
}

errandStringKey : String;
newQuestFact : String;
requiredFact : String;
forbiddenFact : String;
addedItemName : CName;
: Int32;

import abstract class IQuestCondition{


}
class CTestTrigger extends CGameplayEntity{
private var entryTime : Float;
private var timerInterval : Float;
public timer function entryTimer(optional time : Float, optional id : In
t32){
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;

var params : SCustomEffectParams;


entryTime = 0;
if (activator.GetEntity()){
actor = (CActor)activator.GetEntity();
if (actor){
params.effectType = 65;
params.creator = this;
params.duration = 5;
actor.AddEffectCustom(params);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
}
}
class W3ProjectileShooterTest extends CActor{
public editable var projectileTemplate : CEntityTemplate;
public editable var targetTag : CName;
public editable var frequency : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (projectileTemplate && IsNameValid(targetTag) && frequency >
0.000000){
AddTimer('Shoot', 1.000000 / frequency, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function Shoot(optional t : Float, optional id : Int32){
var projectile : CProjectileTrajectory;
var node : CNode;
projectile = (CProjectileTrajectory)theGame.CreateEntity(project
ileTemplate, GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
node = theGame.GetNodeByTag(targetTag);
projectile.Init(this);
projectile.ShootProjectileAtNode(45.000000, 20.000000, node, 100
0.000000, /* NOP */);
/* NOP */;
}
}
import abstract class CStorySceneScript{
}
import abstract class CStorySceneFlowSwitchCase{
}
class CAICarryingItems extends CAIWanderTree{
public editable inlined var params : CAICarryingItemsParams;
public function Init(){
params = new CAICarryingItemsParams in this;
params.OnCreated();
/* NOP */;
}
}
class CSpawnTreeInitializerCarryItemWanderAI extends ISpawnTreeInitializerIdleSm

artAI{
public function GetObjectForPropertiesEdition() : IScriptable{
if (ai && (CAICarryingItems)ai.idleTree && (CAICarryingItems)ai.
idleTree.params){
return (CAICarryingItems)ai.idleTree.params;
}
return this;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "Carrying items";
/* NOP */;
}
public function Init(){
super.Init();
ai.idleTree = new CAICarryingItems in this;
ai.idleTree.OnCreated();
/* NOP */;
}
}
import struct ISpawnTreeInitializerIdleSmartAI{
//NULL type for subInitializer
public function GetObjectForPropertiesEdition() : IScriptable{
return NULL;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "Abstract Smart idle AI";
/* NOP */;
}
public function GetSubInitializerClassName() : CName{
return 'None';
/* NOP */;
}
public function GetContextMenuSpecialOptions(names : array<String>){
}
public function RunSpecialOption(option : Int32){
}
}
import statemachine struct CStoryScenePlayer{
private var m_isFinalboard : Bool;
import public function GetSceneWorldPos() : Vector;
import public function RestartScene();
import public function RestartSection();
import public final function DbFactAdded(factName : String);
import public final function DbFactRemoved(factName : String);
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
/* NOP */;
}
public function SetFinalboardQuest(isFinalboard : Bool){
m_isFinalboard = isFinalboard;
/* NOP */;
}
public function ShouldRestoreItemsForPlayer(output : CStorySceneOutput)
: Bool{
return output.action == 0 || output.action == 1;
/* NOP */;

}
public function OnBlockingSceneStarted(scene : CStoryScene) : Bool{
var box : Box;
var ents : array<CGameplayEntity>;
var i : Int32;
var actor : CActor;
if (!theGame.IsActive()){
return true;
}
theGame.SetIsDialogOrCutscenePlaying(true);
box.Min = Vector(-30, -30, -30);
box.Max = Vector(30, 30, 30);
FindGameplayEntitiesInBox(ents, GetSceneWorldPos(), box, 100000,
'None', 1 + 2, /* NOP */, /* NOP */);
i = 0;
while (i < ents.Size()){
actor = (CActor)ents[i];
if (actor && actor.IsInAgony()){
actor.SignalGameplayEvent('ForceEndAgony');
}
i += 1;
}
thePlayer.RemoveAllBuffsOfType(23);
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
if (!theGame.IsActive()){
return true;
}
theGame.SetIsDialogOrCutscenePlaying(false);
/* NOP */;
}
public function OnCustceneStarted() : Bool{
theGame.SetIsCutscenePlaying(true);
/* NOP */;
}
public function OnCutsceneEnded() : Bool{
theGame.SetIsCutscenePlaying(false);
/* NOP */;
}
public function OnMovieStarted() : Bool{
if (m_isFinalboard){
theSound.EnterGameState(15);
} else {
theSound.EnterGameState(13);
}
/* NOP */;
}
public function OnMovieEnded() : Bool{
if (theSound.GetCurrentGameState() != 15){
if (theGame.envMgr.IsNight()){
theSound.EnterGameState(9);
} else {
theSound.EnterGameState(8);
}
}
/* NOP */;
}
}

class CAINpcWanderParams extends CAIWanderParameters{


}
import struct IAIActionParameters{
}
import struct IRiderActionParameters{
}
import abstract class CStorySceneActorMap{
}
class CAIRiderMoveAlongPathAction extends IRiderActionTree{
public editable inlined var params : CAIRiderMoveAlongPathActionParams;
public function Init(){
params = new CAIRiderMoveAlongPathActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIRiderMoveAlongPathWithCompanionAction extends CAIRiderMoveAlongPathActi
on{
public function Init(){
params = new CAIRiderMoveAlongPathWithCompanionActionParams in t
his;
params.OnCreated();
/* NOP */;
}
}
class CAIRiderRaceAlongPathAction extends IRiderActionTree{
public editable inlined var params : CAIRiderRaceAlongPathActionParams;
public function Init(){
params = new CAIRiderRaceAlongPathActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAISailorMountBoatAction extends ISailorActionTree{
public editable inlined var params : CAISailorMountBoatActionParams;
public function Init(){
params = new CAISailorMountBoatActionParams in this;
params.OnCreated();
/* NOP */;
}
}
abstract class ISailorActionParameters extends IAIActionParameters{
}
class CAISailorMoveToAction extends ISailorActionTree{
public editable inlined var params : CAISailorMoveToActionParams;
public function Init(){
params = new CAISailorMoveToActionParams in this;
params.OnCreated();
/* NOP */;
}
}

class W3UsableItem extends CItemEntity{


public editable var itemType : EUsableItemType;
public editable var blockedActions : array<EInputActionBlock>;
public var wasOnHiddenCalled : Bool;
public function OnDestroyed() : Bool{
if (!wasOnHiddenCalled){
OnHidden(this);
}
/* NOP */;
}
public function OnUsed(usedBy : CEntity) : Bool{
var i : Int32;
blockedActions.PushBack(25);
blockedActions.PushBack(29);
i = 0;
while (i < blockedActions.Size()){
thePlayer.BlockAction(blockedActions[i], 'UsableItem', /
* NOP */, /* NOP */, /* NOP */);
i += 1;
}
/* NOP */;
}
public function OnHidden(hiddenBy : CEntity) : Bool{
var i : Int32;
wasOnHiddenCalled = true;
thePlayer.BlockAllActions('UsableItem', false, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function SetVisibility(isVisible : Bool){
var comps : array<CComponent>;
var dComp : CDrawableComponent;
var i : Int32;
comps = GetComponentsByClassName('CDrawableComponent');
i = 0;
while (i < comps.Size()){
dComp = (CDrawableComponent)comps[i];
if (dComp && dComp.GetName() != "shadow_capsule"){
dComp.SetVisible(isVisible);
}
i += 1;
}
/* NOP */;
}
}
class CAISailorMoveAlongPathAction extends ISailorActionTree{
public editable inlined var params : CAISailorMoveAlongPathActionParams;
public function Init(){
params = new CAISailorMoveAlongPathActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAISailorRaceAlongPathAction extends ISailorActionTree{
public editable inlined var params : CAISailorRaceAlongPathActionParams;
public function Init(){
params = new CAISailorRaceAlongPathActionParams in this;

params.OnCreated();
/* NOP */;
}
}
class CAIMoveToActionAwareOfTail extends IAIBaseAction{
public editable inlined var params : CAIMoveToActionAwareOfTailParams;
public function Init(){
params = new CAIMoveToActionAwareOfTailParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIRiderMoveToAction extends IRiderActionTree{
public editable inlined var params : CAIRiderMoveToActionParams;
public function Init(){
params = new CAIRiderMoveToActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWalkToTargetWaitAction extends IAIActionTree{
public editable inlined var params : CAIWalkToTargetWaitParams;
public function Init(){
params = new CAIWalkToTargetWaitParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIAnimalBase extends CAIBaseTree{
public editable inlined var params : CAIAnimalDefaults;
public function Init(){
params = new CAIAnimalDefaults in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CQuest{
}
import struct CAnimationManualSlotSyncInstance{
import public final function RegisterMaster(definition : SAnimationSeque
nceDefinition) : Int32;
import public final function RegisterSlave(definition : SAnimationSequen
ceDefinition) : Int32;
import public final function StopSequence(index : Int32);
import public final function IsSequenceFinished(index : Int32) : Bool;
import public final function HasEnded() : Bool;
import public final function Update(deltaTime : Float);
import public final function BreakIfPossible(entity : CEntity) : Bool;
}
class CAIAnimalQuestDefaults extends CAIDefaults{
public editable inlined var combatTree : CAICombatTree;
public editable inlined var idleTree : CAIIdleTree;
public editable inlined var deathTree : CAIDeathTree;

public function Init(){


combatTree = new CAIAnimalQuestCombat in this;
combatTree.OnCreated();
idleTree = new CAIIdleTree in this;
idleTree.OnCreated();
deathTree = new CAIAnimalDeath in this;
deathTree.OnCreated();
/* NOP */;
}
}
class CAIAnimalQuestCombat extends CAIAnimalCombat{
}
class CAIHorseDefaults extends CAIAnimalDefaults{
public editable var isMount : Bool;
public editable var canMoveOutOfAWay : Bool;
public function Init(){
super.Init();
combatTree = new CAIAnimalCombatHorse in this;
combatTree.OnCreated();
idleDecoratorTree = new CHorseIdleDecoratorTree in this;
idleDecoratorTree.OnCreated();
charmedTree = new CAIHorseCharmed in this;
charmedTree.OnCreated();
/* NOP */;
}
}
import abstract class CPropertyAnimationSet{
}
class CAIAnimalCombatHorse extends CAIAnimalCombat{
public editable inlined var shakeRiderTree : CAIHorseShakeRider;
public function Init(){
shakeRiderTree = new CAIHorseShakeRider in this;
shakeRiderTree.OnCreated();
/* NOP */;
}
}
import struct CCharacterStats{
import public final function AddAbility(abilityName : CName, allowMultip
le : Bool) : Bool;
import public final function RemoveAbility(abilityName : CName) : Bool;
import public final function HasAbility(abilityName : CName, includeInve
ntoryAbl : Bool) : Bool;
import public final function HasAbilityWithTag(tag : CName, includeInven
toryAbl : Bool) : Bool;
import public final function GetAllAttributesNames(attributes : array<CN
ame>);
import public final function IsAbilityAvailableToBuy(abilityName : CName
) : Bool;
import public final function GetAbilities(abilities : array<CName>, incl
udeInventoryAbl : Bool);
import public final function GetAttributeValue(attributeName : CName, ab
ilityTags : array<CName>, withoutTags : Bool) : SAbilityAttributeValue;
import public final function GetAbilityAttributeValue(attributeName : CN
ame, abilityName : CName) : SAbilityAttributeValue;
import public final function GetAllContainedAbilities(abilities : array<

CName>);
public function AddAbilityMultiple(abilityName : CName, count : Int32){
while (count > 0){
count -= 1;
super.AddAbility(abilityName, true);
}
/* NOP */;
}
public function RemoveAbilityMultiple(abilityName : CName, count : Int32
){
while (count > 0){
count -= 1;
super.RemoveAbility(abilityName);
}
/* NOP */;
}
public function GetAbilitiesWithTag(tag : CName) : array<CName>{
var abs : array<CName>;
var ret : array<CName>;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
super.GetAbilities(abs, true);
i = 0;
while (i < abs.Size()){
if (dm.AbilityHasTag(abs[i], tag)){
ret.PushBack(abs[i]);
}
i += 1;
}
return ret;
/* NOP */;
}
}
class CHorseIdleDecoratorTree extends CAIMonsterIdleDecorator{
public editable inlined var actionPointSelector : CHorseParkingActionPoi
ntSelector;
public editable var packName : CName;
public function Init(){
super.Init();
actionPointSelector = new CHorseParkingActionPointSelector in th
is;
actionPointSelector.radius = 20.000000;
/* NOP */;
}
}
class CAIHorseCharmed extends CAIAnimalCharmed{
public function Init(){
super.Init();
charmedGotoDistance = 5.000000;
/* NOP */;
}
}
class CAIWildHorseDefaults extends CAIHorseDefaults{
public editable var isWildHorse : Bool;
public function Init(){
var i : Int32;

var moveInPack : CAIActionMoveInPack;


var runWildInPack : CAIActionRunWildInPack;
var leadPack : CAILeadPackWander;
var runWild : CAIAnimalRunWild;
super.Init();
idleTree = new CAIAnimalRunWild in this;
idleTree.OnCreated();
runWild = (CAIAnimalRunWild)idleTree;
runWild.packRegroupEvent = 'HorsePackRunsWild';
runWild.leaderRegroupEvent = 'HorseMoves';
combatTree.neutralIsDanger = true;
i = 0;
while (i < idleDecoratorTree.params.reactionTree.params.reaction
s.Size()){
moveInPack = (CAIActionMoveInPack)idleDecoratorTree.para
ms.reactionTree.params.reactions[i];
if (moveInPack){
moveInPack.actionEventName = 'HorseMoves';
moveInPack.chanceToFollowPack = 80;
}
runWildInPack = (CAIActionRunWildInPack)idleDecoratorTre
e.params.reactionTree.params.reactions[i];
if (runWildInPack){
runWildInPack.actionEventName = 'HorsePackRunsWi
ld';
}
i += 1;
}
/* NOP */;
}
}
class CAIDeerDefaults extends CAIAnimalDefaults{
public function Init(){
var i : Int32;
var moveInPack : CAIActionMoveInPack;
var eatAction : CAIMonsterIdleEat;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatDeer in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 10.000000;
eatAction.params.loopTime = 3.000000;
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
idleDecoratorTree.params.actions.PushBack(eatAction);
i = 0;
while (i < idleDecoratorTree.params.reactionTree.params.reaction
s.Size()){
moveInPack = (CAIActionMoveInPack)idleDecoratorTree.para
ms.reactionTree.params.reactions[i];
if (moveInPack){
moveInPack.actionEventName = 'DeerMoves';

moveInPack.chanceToFollowPack = 100;
}
i += 1;
}
/* NOP */;
}
}
class CAIDeerLeaderDefaults extends CAIDeerDefaults{
public function Init(){
var leadPack : CAILeadPackWander;
super.Init();
idleTree = new CAILeadPackWander in this;
idleTree.OnCreated();
leadPack = (CAILeadPackWander)idleTree;
leadPack.leaderRegroupEvent = 'DeerMoves';
/* NOP */;
}
}
class CAIAnimalCombatDeer extends CAIAnimalCombat{
}
class CAIHareDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
super.Init();
combatTree = new CAIAnimalCombatHare in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 10.000000;
eatAction.params.loopTime = 3.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
/* NOP */;
}
}
class CAIAnimalCombatHare extends CAIAnimalCombat{
}
class CAIDogDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
var lieAction : CAIMonsterIdleLie;
var sitAction : CAIMonsterIdleSit;
var cleanAction : CAIMonsterIdleClean;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatDog in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
lieAction = new CAIMonsterIdleLie in this;
lieAction.OnCreated();
lieAction.params.cooldown = 40.000000;

lieAction.params.loopTime = 15.000000;
sitAction = new CAIMonsterIdleSit in this;
sitAction.OnCreated();
sitAction.params.cooldown = 40.000000;
sitAction.params.loopTime = 15.000000;
cleanAction = new CAIMonsterIdleClean in this;
cleanAction.OnCreated();
cleanAction.params.cooldown = 40.000000;
cleanAction.params.loopTime = 15.000000;
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.meat = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
idleDecoratorTree.params.actions.PushBack(eatAction);
idleDecoratorTree.params.actions.PushBack(lieAction);
idleDecoratorTree.params.actions.PushBack(sitAction);
idleDecoratorTree.params.actions.PushBack(cleanAction);
/* NOP */;
}
}
class CAIAnimalCombatDog extends CAIAnimalCombat{
}
class CAIGoatDefaults extends CAIAnimalDefaults{
public function Init(){
var i : Int32;
var moveInPack : CAIActionMoveInPack;
var leadPack : CAILeadPackWander;
var eatAction : CAIMonsterIdleEat;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatGoat in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 10.000000;
eatAction.params.loopTime = 10.000000;
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
idleTree = new CAILeadPackWander in this;
idleTree.OnCreated();
leadPack = (CAILeadPackWander)idleTree;
leadPack.leaderRegroupEvent = 'GoatMoves';
idleDecoratorTree.params.searchFoodTree = searchFood;
idleDecoratorTree.params.actions.PushBack(eatAction);
i = 0;
while (i < idleDecoratorTree.params.reactionTree.params.reaction
s.Size()){
moveInPack = (CAIActionMoveInPack)idleDecoratorTree.para
ms.reactionTree.params.reactions[i];
if (moveInPack){
moveInPack.actionEventName = 'GoatMoves';
moveInPack.chanceToFollowPack = 50;
}
i += 1;

}
/* NOP */;
}
}
class CAIAnimalCombatGoat extends CAIAnimalCombat{
}
class CAIGoatQuestDefaults extends CAIAnimalDefaults{
public function Init(){
combatTree = new CAIAnimalQuestCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAIPigDefaults extends CAIAnimalDefaults{
public function Init(){
var i : Int32;
var moveInPack : CAIActionMoveInPack;
var leadPack : CAILeadPackWander;
var eatAction : CAIMonsterIdleEat;
var lieAction : CAIMonsterIdleLie;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatPig in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
lieAction = new CAIMonsterIdleLie in this;
lieAction.OnCreated();
lieAction.params.cooldown = 10.000000;
lieAction.params.loopTime = 15.000000;
idleTree = new CAILeadPackWander in this;
idleTree.OnCreated();
leadPack = (CAILeadPackWander)idleTree;
leadPack.leaderRegroupEvent = 'PigMoves';
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.meat = true;
searchFoodParams.vegetable = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
idleDecoratorTree.params.actions.PushBack(eatAction);
idleDecoratorTree.params.actions.PushBack(lieAction);
i = 0;
while (i < idleDecoratorTree.params.reactionTree.params.reaction
s.Size()){
moveInPack = (CAIActionMoveInPack)idleDecoratorTree.para
ms.reactionTree.params.reactions[i];
if (moveInPack){
moveInPack.actionEventName = 'PigMoves';
moveInPack.chanceToFollowPack = 30;
}
i += 1;
}

/* NOP */;
}
}
class CAIAnimalCombatPig extends CAIAnimalCombat{
}
class CAISheepDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
var lieAction : CAIMonsterIdleLie;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatSheep in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
lieAction = new CAIMonsterIdleLie in this;
lieAction.OnCreated();
lieAction.params.cooldown = 10.000000;
lieAction.params.loopTime = 15.000000;
idleDecoratorTree.params.actions.PushBack(lieAction);
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
/* NOP */;
}
}
class CAIAnimalCombatSheep extends CAIAnimalCombat{
}
class CAIGooseDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatGoose in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
/* NOP */;
}

}
class CAIAnimalCombatGoose extends CAIAnimalCombat{
}
class CAICowDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
var lieAction : CAIMonsterIdleLie;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatCow in this;
combatTree.OnCreated();
charmedTree = new CAICowCharmed in this;
charmedTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 10.000000;
eatAction.params.loopTime = 30.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
lieAction = new CAIMonsterIdleLie in this;
lieAction.OnCreated();
lieAction.params.cooldown = 10.000000;
lieAction.params.loopTime = 30.000000;
idleDecoratorTree.params.actions.PushBack(lieAction);
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
/* NOP */;
}
}
class CAIAnimalCombatCow extends CAIAnimalCombat{
}
class CAICowCharmed extends CAIAnimalCharmed{
public function Init(){
super.Init();
charmedGotoDistance = 5.000000;
/* NOP */;
}
}
class CAIChickenDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
super.Init();
combatTree = new CAIAnimalCombatRooster in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
/* NOP */;
}

}
class CAIAnimalCombatRooster extends CAIAnimalCombat{
}
class CAIRoosterDefaults extends CAIAnimalDefaults{
public function Init(){
var eatAction : CAIMonsterIdleEat;
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatRooster in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.vegetable = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
/* NOP */;
}
}
class CAICatDefaults extends CAIAnimalDefaults{
public function Init(){
var searchFood : CAIMonsterSearchFoodTree;
var searchFoodParams : CAIMonsterSearchFoodIdleParams;
var eatAction : CAIMonsterIdleEat;
searchFood = new CAIMonsterSearchFoodTree in this;
super.Init();
combatTree = new CAIAnimalCombatCat in this;
combatTree.OnCreated();
eatAction = new CAIMonsterIdleEat in this;
eatAction.OnCreated();
eatAction.params.cooldown = 4.000000;
eatAction.params.loopTime = 10.000000;
idleDecoratorTree.params.actions.PushBack(eatAction);
searchFood.OnCreated();
searchFoodParams = searchFood.params;
searchFoodParams.corpse = true;
searchFoodParams.meat = true;
searchFoodParams.water = true;
idleDecoratorTree.params.searchFoodTree = searchFood;
/* NOP */;
}
}
class W3Mutagen20_Effect extends W3Mutagen_Effect{
private var burningPoints : SAbilityAttributeValue;
private var burningPercents : SAbilityAttributeValue;
private var poisonPoints : SAbilityAttributeValue;
private var poisonPercents : SAbilityAttributeValue;
private var bleedingPoints : SAbilityAttributeValue;
private var bleedingPercents : SAbilityAttributeValue;
private var burningResistanceCounter : Float;
private var poisonResistanceCounter : Float;

private var bleedingResistanceCounter : Float;


private var player : CR4Player;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var dm : CDefinitionsManagerAccessor;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnEffectAdded(customParams);
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(16
, true), min, max);
burningPoints = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(16
, false), min, max);
burningPercents = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(17
, true), min, max);
poisonPoints = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(17
, false), min, max);
poisonPercents = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(18
, true), min, max);
bleedingPoints = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue(abilityName, ResistStatEnumToName(18
, false), min, max);
bleedingPercents = GetAttributeRandomizedValue(min, max);
player = (CR4Player)target;
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
player = (CR4Player)target;
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (!player.IsInCombat()){
burningResistanceCounter = 0;
bleedingResistanceCounter = 0;
poisonResistanceCounter = 0;
} else {
if (target.HasBuff(18)){
burningResistanceCounter += dt;
}
if (target.HasBuff(16)){
bleedingResistanceCounter += dt;
}
if (target.HasBuff(15)){
poisonResistanceCounter += dt;
}
if (target.HasBuff(19)){
poisonResistanceCounter += dt;
}
}
/* NOP */;
}
public function GetResistBonus(resist : ECharacterDefenseStats, points :
SAbilityAttributeValue, percents : SAbilityAttributeValue){
if (resist == 16){
points = burningPoints;

percents = burningPercents;
points = points * burningResistanceCounter;
percents = percents * burningResistanceCounter;
} else if (resist == 17){
points = poisonPoints;
percents = poisonPercents;
points = points * poisonResistanceCounter;
percents = percents * poisonResistanceCounter;
} else if (resist == 18){
points = bleedingPoints;
percents = bleedingPercents;
points = points * bleedingResistanceCounter;
percents = percents * bleedingResistanceCounter;
}
/* NOP */;
}
}
class CAIAnimalCombatCat extends CAIAnimalCombat{
}
class CAIAnimalDeathParams extends CAINpcDeathParams{
}
abstract class IAICustomActionTree extends IAIActionTree{
}
import abstract class SCutsceneActorOverrideMapping{
}
class CAIRunExplorationActionTree extends IAIBaseAction{
public editable inlined var params : CAIRunExplorationActionTreeParams;
public function Init(){
params = new CAIRunExplorationActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICommonerReactionTree extends CAINpcReactionsTree{
public function Init(){
var beingHit : CAIActionBeingHit;
var bump : CAIActionBumpTree;
var rain : CAIActionRain;
var taunt : CAIActionTaunt;
var drawSword : CAIActionDrawSword;
var attack : CAIActionAttack;
var castSign : CAIActionCastSign;
var crossbowShot : CAIActionCrossbowShot;
var bombExplosion : CAIActionBombExplosion;
var combatNearby : CAIActionCombatNearby;
var gossip : CAIActionGossip;
var question : CAIActionQuestion;
var barter : CAIActionBarter;
var jump : CAIActionJump;
beingHit = new CAIActionBeingHit in this;
bump = new CAIActionBumpTree in this;
rain = new CAIActionRain in this;
taunt = new CAIActionTaunt in this;
drawSword = new CAIActionDrawSword in this;

attack = new CAIActionAttack in this;


castSign = new CAIActionCastSign in this;
crossbowShot = new CAIActionCrossbowShot in this;
bombExplosion = new CAIActionBombExplosion in this;
combatNearby = new CAIActionCombatNearby in this;
gossip = new CAIActionGossip in this;
question = new CAIActionQuestion in this;
barter = new CAIActionBarter in this;
jump = new CAIActionJump in this;
beingHit.OnCreated();
bump.OnCreated();
rain.OnCreated();
taunt.OnCreated();
drawSword.OnCreated();
attack.OnCreated();
castSign.OnCreated();
crossbowShot.OnCreated();
bombExplosion.OnCreated();
combatNearby.OnCreated();
gossip.OnCreated();
question.OnCreated();
barter.OnCreated();
jump.OnCreated();
taunt.forwardAvailabilityToReactionTree = true;
attack.forwardAvailabilityToReactionTree = true;
castSign.forwardAvailabilityToReactionTree = true;
crossbowShot.forwardAvailabilityToReactionTree = true;
bombExplosion.forwardAvailabilityToReactionTree = true;
combatNearby.forwardAvailabilityToReactionTree = true;
reactions.PushBack(beingHit);
reactions.PushBack(bump);
reactions.PushBack(rain);
reactions.PushBack(drawSword);
reactions.PushBack(taunt);
reactions.PushBack(attack);
reactions.PushBack(castSign);
reactions.PushBack(crossbowShot);
reactions.PushBack(bombExplosion);
reactions.PushBack(combatNearby);
reactions.PushBack(gossip);
reactions.PushBack(question);
reactions.PushBack(barter);
reactions.PushBack(jump);
/* NOP */;
}
}
class CAIChildReactionTree extends CAINpcReactionsTree{
public function Init(){
var beingHit : CAIActionBeingHit;
var bump : CAIActionBumpTree;
var rain : CAIActionRain;
var taunt : CAIActionTaunt;
var drawSword : CAIActionDrawSword;
var attack : CAIActionAttack;
var castSign : CAIActionCastSign;
var crossbowShot : CAIActionCrossbowShot;
var bombExplosion : CAIActionBombExplosion;
var combatNearby : CAIActionCombatNearby;
var tempOverride : CAINpcActionSubtree;

beingHit = new CAIActionBeingHit in this;


bump = new CAIActionBumpTree in this;
rain = new CAIActionRain in this;
taunt = new CAIActionTaunt in this;
drawSword = new CAIActionDrawSword in this;
attack = new CAIActionAttack in this;
castSign = new CAIActionCastSign in this;
crossbowShot = new CAIActionCrossbowShot in this;
bombExplosion = new CAIActionBombExplosion in this;
combatNearby = new CAIActionCombatNearby in this;
beingHit.OnCreated();
bump.OnCreated();
rain.OnCreated();
taunt.OnCreated();
drawSword.OnCreated();
attack.OnCreated();
castSign.OnCreated();
crossbowShot.OnCreated();
bombExplosion.OnCreated();
combatNearby.OnCreated();
reactions.PushBack(beingHit);
reactions.PushBack(bump);
reactions.PushBack(rain);
reactions.PushBack(drawSword);
reactions.PushBack(taunt);
reactions.PushBack(attack);
reactions.PushBack(castSign);
reactions.PushBack(crossbowShot);
reactions.PushBack(bombExplosion);
reactions.PushBack(combatNearby);
tempOverride = reactions[3];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
tempOverride = reactions[4];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
tempOverride = reactions[5];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
tempOverride = reactions[6];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
tempOverride = reactions[7];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);

tempOverride = reactions[8];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
tempOverride = reactions[9];
tempOverride.reactionLogicTree = new CAINpcReactionGetScared in
this;
tempOverride.reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(10.000000, false, /* NOP */);
/* NOP */;
}
}
class CAINpcReactionGetScared extends CAINpcReaction{
public editable var scaredTime : Float;
public editable var scaredTimeMax : Float;
public editable var checkLineOfSight : Bool;
public editable var tryToBeHostileFirst : Bool;
public function SetParams(_scaredTime : Float, _checkLineOfSight : Bool,
_tryToBeHostileFirst : Bool){
scaredTime = _scaredTime - 2;
scaredTimeMax = _scaredTime + 1;
checkLineOfSight = _checkLineOfSight;
tryToBeHostileFirst = _tryToBeHostileFirst;
/* NOP */;
}
}
class CAIDrunkCommonerReactionTree extends CAINpcReactionsTree{
public function Init(){
var beingHit : CAIActionBeingHit;
var crossbowShot : CAIActionCrossbowShot;
var bombExplosion : CAIActionBombExplosion;
beingHit = new CAIActionBeingHit in this;
crossbowShot = new CAIActionCrossbowShot in this;
bombExplosion = new CAIActionBombExplosion in this;
beingHit.OnCreated();
crossbowShot.OnCreated();
bombExplosion.OnCreated();
crossbowShot.forwardAvailabilityToReactionTree = true;
bombExplosion.forwardAvailabilityToReactionTree = true;
reactions.PushBack(beingHit);
reactions.PushBack(crossbowShot);
reactions.PushBack(bombExplosion);
/* NOP */;
}
}
class CAIGuardReactionsTree extends CAINpcReactionsTree{
public function Init(){
var beingHit : CAIActionBeingHit;
var bump : CAIActionBumpTree;
var drawSword : CAIActionDrawSword;
var attack : CAIActionAttack;
var castSign : CAIActionCastSign;
var crossbowShot : CAIActionCrossbowShot;
var bombExplosion : CAIActionBombExplosion;

var combatNearby : CAIActionCombatNearby;


var looting : CAIActionLooting;
var taunt : CAIActionTaunt;
var jump : CAIActionJump;
var gossip : CAIActionGossip;
var question : CAIActionQuestion;
var tempOverride : CAINpcActionSubtree;
beingHit = new CAIActionBeingHit in this;
bump = new CAIActionBumpTree in this;
drawSword = new CAIActionDrawSword in this;
attack = new CAIActionAttack in this;
castSign = new CAIActionCastSign in this;
crossbowShot = new CAIActionCrossbowShot in this;
bombExplosion = new CAIActionBombExplosion in this;
combatNearby = new CAIActionCombatNearby in this;
looting = new CAIActionLooting in this;
taunt = new CAIActionTaunt in this;
jump = new CAIActionJump in this;
gossip = new CAIActionGossip in this;
question = new CAIActionQuestion in this;
beingHit.OnCreated();
bump.OnCreated();
drawSword.OnCreated();
attack.OnCreated();
castSign.OnCreated();
crossbowShot.OnCreated();
bombExplosion.OnCreated();
combatNearby.OnCreated();
looting.OnCreated();
taunt.OnCreated();
jump.OnCreated();
gossip.OnCreated();
question.OnCreated();
reactions.PushBack(beingHit);
reactions.PushBack(combatNearby);
reactions.PushBack(bump);
reactions.PushBack(drawSword);
reactions.PushBack(attack);
reactions.PushBack(castSign);
reactions.PushBack(crossbowShot);
reactions.PushBack(bombExplosion);
reactions.PushBack(taunt);
reactions.PushBack(looting);
tempOverride = reactions[0];
tempOverride.reactionLogicTree = new CAINpcReactionTurnHostile i
n this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
(CAINpcReactionTurnHostile)tempOverride.reactionLogicTree.SetPar
ams('BeingHitAction');
tempOverride = reactions[1];
tempOverride.reactionLogicTree = new CAINpcReactionJoinFight in
this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
tempOverride.disallowWhileOnHorse = true;
tempOverride = reactions[2];
tempOverride.reactionLogicTree = new CAINpcReactionBump in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.disallowWhileOnHorse = true;

tempOverride = reactions[3];
tempOverride.reactionLogicTree = new CAINpcReactionGuardWarnGene
ral in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.forwardAvailabilityToReactionTree = true;
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[4];
tempOverride.reactionLogicTree = new CAINpcReactionGuardWarnGene
ral in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.forwardAvailabilityToReactionTree = true;
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[5];
tempOverride.reactionLogicTree = new CAINpcReactionGuardWarnGene
ral in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.forwardAvailabilityToReactionTree = true;
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[6];
tempOverride.reactionLogicTree = new CAINpcReactionGuardWarnGene
ral in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.forwardAvailabilityToReactionTree = true;
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[7];
tempOverride.reactionLogicTree = new CAINpcReactionTurnHostile i
n this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[8];
tempOverride.reactionLogicTree = new CAINpcReactionGuardWarnGene
ral in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
tempOverride.forwardAvailabilityToReactionTree = true;
tempOverride.disallowWhileOnHorse = false;
tempOverride = reactions[9];
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
OverriderReactionsPriority(60, 59);
reactions.PushBack(jump);
tempOverride = reactions[0];
tempOverride.changePriorityWhileActive = false;
tempOverride.reactionPriority = 62;
tempOverride = reactions[1];
tempOverride.changePriorityWhileActive = false;
tempOverride.reactionPriority = 61;
tempOverride = reactions[2];
tempOverride.changePriorityWhileActive = false;
tempOverride.reactionPriority = 58;
reactions.PushBack(gossip);
reactions.PushBack(question);
/* NOP */;
}
}
class CAINpcReactionTurnHostile extends CAINpcReaction{
public editable var setAttitudeGameplayEventName : CName;
public function SetParams(gameplayEventName : CName){
setAttitudeGameplayEventName = gameplayEventName;

/* NOP */;
}
}
class CAINpcReactionJoinFight extends CAINpcReaction{
public editable var onlyHelpActorsFromTheSameAttidueGroup : Bool;
public function SetParams(_onlyHelpActorsFromTheSameAttidueGroup : Bool)
{
onlyHelpActorsFromTheSameAttidueGroup = _onlyHelpActorsFromTheSa
meAttidueGroup;
/* NOP */;
}
}
class CAINpcReactionBump extends CAINpcReaction{
}
class CAINpcReactionGuardWarnGeneral extends CAINpcReaction{
public editable var lootingReaction : Bool;
public function SetParams(_lootingReaction : Bool){
lootingReaction = _lootingReaction;
/* NOP */;
}
}
class CAICombatNPCReactionsTree extends CAINpcReactionsTree{
public function Init(){
var beingHit : CAIActionBeingHit;
var bump : CAIActionBumpTree;
var combatNearby : CAIActionCombatNearby;
var taunt : CAIActionTaunt;
var jump : CAIActionJump;
var bombExplosion : CAIActionBombExplosion;
var combatStarted : CAIActionCombatStarted;
var tempOverride : CAINpcActionSubtree;
beingHit = new CAIActionBeingHit in this;
bump = new CAIActionBumpTree in this;
combatNearby = new CAIActionCombatNearby in this;
taunt = new CAIActionTaunt in this;
jump = new CAIActionJump in this;
bombExplosion = new CAIActionBombExplosion in this;
combatStarted = new CAIActionCombatStarted in this;
beingHit.OnCreated();
bump.OnCreated();
combatNearby.OnCreated();
taunt.OnCreated();
jump.OnCreated();
bombExplosion.OnCreated();
combatStarted.OnCreated();
reactions.PushBack(beingHit);
reactions.PushBack(combatNearby);
reactions.PushBack(bump);
reactions.PushBack(taunt);
reactions.PushBack(bombExplosion);
reactions.PushBack(combatStarted);
tempOverride = reactions[0];
tempOverride.reactionLogicTree = new CAINpcReactionTurnHostile i
n this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";

(CAINpcReactionTurnHostile)tempOverride.reactionLogicTree.SetPar
ams('BeingHitAction');
tempOverride = reactions[1];
tempOverride.reactionLogicTree = new CAINpcReactionJoinFight in
this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
(CAINpcReactionJoinFight)tempOverride.reactionLogicTree.SetParam
s(true);
tempOverride.disallowWhileOnHorse = true;
tempOverride = reactions[2];
tempOverride.reactionLogicTree = new CAINpcReactionBump in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.disallowWhileOnHorse = true;
tempOverride = reactions[3];
tempOverride.reactionLogicTree = new CAINpcReactionStopAndCommen
t in this;
tempOverride.reactionLogicTree.OnCreated();
tempOverride.reactionLogicTree.voiceSet = "afraid";
tempOverride = reactions[4];
(CAINpcReactionGetScared)tempOverride.reactionLogicTree.SetParam
s(7.000000, false, true);
OverriderReactionsPriority(60, 59);
reactions.PushBack(jump);
tempOverride = reactions[0];
tempOverride.changePriorityWhileActive = false;
tempOverride = reactions[1];
tempOverride.changePriorityWhileActive = false;
tempOverride = reactions[3];
tempOverride.changePriorityWhileActive = false;
tempOverride.reactionPriority = 24;
/* NOP */;
}
}
abstract class W3RegenEffect extends CBaseGameplayEffect{
protected var regenStat : ECharacterRegenStats;
protected saved var stat : EBaseCharacterStats;
private var isOnMonster : Bool;
public function OnUpdate(dt : Float) : Bool{
var regenPoints : Float;
var canRegen : Bool;
var hpRegenPauseBuff : W3Effect_DoTHPRegenReduce;
var pauseRegenVal : SAbilityAttributeValue;
var armorModVal : SAbilityAttributeValue;
super.OnUpdate(dt);
canRegen = target.GetStatPercents(stat) < 1;
if (canRegen){
regenPoints = effectValue.valueAdditive + effectValue.va
lueMultiplicative * target.GetStatMax(stat);
if (isOnPlayer && regenStat == 5 && attributeName == Reg
enStatEnumToName(regenStat) && GetWitcherPlayer()){
armorModVal = GetWitcherPlayer().GetAttributeVal
ue('staminaRegen_armor_mod', /* NOP */, /* NOP */);
regenPoints *= 1 + armorModVal.valueMultiplicati
ve;
} else if (regenStat == 1 || regenStat == 2){
hpRegenPauseBuff = (W3Effect_DoTHPRegenReduce)ta
rget.GetBuff(20, /* NOP */);
if (hpRegenPauseBuff){

pauseRegenVal = hpRegenPauseBuff.GetEffe
ctValue();
regenPoints = MaxF(0, regenPoints * 1 pauseRegenVal.valueMultiplicative - pauseRegenVal.valueAdditive);
}
}
if (regenPoints > 0){
effectManager.CacheStatUpdate(stat, regenPoints
* dt);
}
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var null : SAbilityAttributeValue;
super.OnEffectAdded(customParams);
if (effectValue == null){
isActive = false;
} else if (target.GetStatMax(stat) <= 0){
isActive = false;
}
CheckMonsterTarget();
/* NOP */;
}
private function CheckMonsterTarget(){
var monsterCategory : EMonsterCategory;
var temp_n : CName;
var temp_b : Bool;
theGame.GetMonsterParamsForActor(target, monsterCategory, temp_n
, temp_b, temp_b, temp_b);
isOnMonster = monsterCategory != 11;
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
CheckMonsterTarget();
/* NOP */;
}
public function CacheSettings(){
var i : Int32;
var size : Int32;
var att : array<CName>;
var dm : CDefinitionsManagerAccessor;
var atts : array<CName>;
super.CacheSettings();
if (regenStat == 0){
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(abilityName, att);
size = att.Size();
i = 0;
while (i < size){
regenStat = RegenStatNameToEnum(att[i]);
if (regenStat != 0){
break;
}
i += 1;
}
}
stat = GetStatForRegenStat(regenStat);
attributeName = RegenStatEnumToName(regenStat);

/* NOP */;
}
public function GetRegenStat() : ECharacterRegenStats{
return regenStat;
/* NOP */;
}
public function UpdateEffectValue(){
SetEffectValue();
/* NOP */;
}
}
class CAINpcReactionStopAndComment extends CAINpcReaction{
public editable var stopDuration : Float;
public editable var activationChance : Int32;
public editable var distanceToInterrupt : Int32;
public function SetParams(_activationChance : Int32, _stopDuration : Flo
at){
activationChance = _activationChance;
stopDuration = _stopDuration;
/* NOP */;
}
}
import abstract class CGuiConfigResource{
}
class CAIQuestNPCReactionsTree extends CAINpcReactionsTree{
public function Init(){
var bombExplosion : CAIActionBombExplosion;
bombExplosion = new CAIActionBombExplosion in this;
bombExplosion.OnCreated();
reactions.PushBack(bombExplosion);
/* NOP */;
}
}
class CAIPhilippaReactionsTree extends CAINpcReactionsTree{
public function Init(){
var bombExplosion : CAIActionBombExplosion;
bombExplosion = new CAIActionBombExplosion in this;
bombExplosion.OnCreated();
bombExplosion.forwardAvailabilityToReactionTree = true;
reactions.PushBack(bombExplosion);
/* NOP */;
}
}
struct SWeatherBonus{
var dayPart :
var weather :
var moonState
var ability :
}

EDayPart;
EWeatherEffect;
: EMoonState;
CName;

class CAINpcReactionObserveFight extends CAINpcReaction{


public editable var doNotCheckLineOfSight : Bool;
public function SetParams(_doNotCheckLineOfSight : Bool){
doNotCheckLineOfSight = _doNotCheckLineOfSight;
/* NOP */;

}
}
struct SSkill{
saved var skillType : ESkill;
var skillPath : ESkillPath;
var skillSubPath : ESkillSubPath;
saved var level : Int32;
var maxLevel : Int32;
var requiredSkills : array<ESkill>;
var requiredSkillsIsAlternative : Bool;
var requiredPointsSpent : Int32;
var priority : Int32;
var cost : Int32;
var abilityName : CName;
var modifierTags : array<CName>;
var localisationNameKey : String;
var localisationDescriptionKey : String;
var localisationDescriptionLevel2Key : String;
var localisationDescriptionLevel3Key : String;
var iconPath : String;
var positionID : Int32;
saved var isNew : Bool;
var isCoreSkill : Bool;
var wasEquippedOnUIEnter : Bool;
saved var remainingBlockedTime : Float;
var precachedModifierSkills : array<ESkill>;
}
class CAINpcReactionTaunt extends CAINpcReaction{
}
import abstract class SResistanceValue{
//NULL type for points
//NULL type for percents
//NULL type for type
}
struct SSkillSlot{
saved var id : Int32;
saved var unlockedOnLevel : Int32;
saved var neighbourUp : Int32;
saved var neighbourDown : Int32;
saved var neighbourLeft : Int32;
saved var neighbourRight : Int32;
saved var socketedSkill : ESkill;
saved var unlocked : Bool;
saved var groupID : Int32;
}
class CAINpcReactionRain extends CAINpcReaction{
public editable inlined var actionPointSelector : CRainActionPointSelect
or;
public function Init(){
actionPointSelector = new CRainActionPointSelector in this;
actionPointSelector.radius = 30;
actionPointSelector.chooseClosestAP = true;
/* NOP */;
}
}

class CAINpcReactionSurprise extends CAINpcReaction{


public editable var rotateToActionTargetsTarget : Bool;
public function SetParams(_rotateToActionTargetsTarget : Bool){
rotateToActionTargetsTarget = _rotateToActionTargetsTarget;
/* NOP */;
}
}
struct SMutagenSlot{
saved var item : SItemUniqueId;
saved var unlockedAtLevel : Int32;
saved var skillGroupID : Int32;
saved var equipmentSlot : EEquipmentSlots;
}
struct STutorialTemporarySkill{
var wasLearned : Bool;
var skillType : ESkill;
}
class CAIActionPlayerPresence extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionStopAndComment in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "reaction_to_geralt";
reactionPriority = 20;
actionEventName = 'PlayerPresenceAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 10;
forwardAvailabilityToReactionTree = true;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 22;
disableTalkInteraction = false;
/* NOP */;
}
}
abstract class CAIMonsterFlyIdleAction extends CAIMonsterIdleAction{
public function Init(){
params = new CAIMonsterFlyIdleActionParams in this;
params.Init();
/* NOP */;
}
}
struct SSimpleSkill{
var level : Int32;
var skillType : ESkill;
}
struct SRestoredSkill{
var level : Int32;
var skillType : ESkill;
var isNew : Bool;
var remainingBlockedTime : Float;
}
state W3TutorialManagerUIHandlerStateCharDevMutagens in W3TutorialManagerUIHandl
er extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{

private const var DESCRIPTION : CName;


private const var SELECT_TAB : CName;
private const var EQUIP : CName;
private const var BONUSES : CName;
private const var MATCH_SKILL_COLOR : CName;
private const var MULTIPLE_SKILLS : CName;
private const var WRONG_COLOR : CName;
private const var POTIONS : CName;
private const var MUTAGENS_JOURNAL : CName;
private var isClosing : Bool;
private var savedEquippedSkills : array<STutorialSavedSkill>;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
isClosing = false;
ShowHint(DESCRIPTION, theGame.params.TUT_POS_CHAR_DEV_X, theGame
.params.TUT_POS_CHAR_DEV_Y, 5, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().ActivateJournalEntry(MUTAGENS_JOURNA
L);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(DESCRIPTION);
CloseHint(SELECT_TAB);
CloseHint(EQUIP);
CloseHint(BONUSES);
CloseHint(MATCH_SKILL_COLOR);
CloseHint(MULTIPLE_SKILLS);
CloseHint(WRONG_COLOR);
CloseHint(POTIONS);
theGame.GetTutorialSystem().MarkMessageAsSeen(DESCRIPTION);
GetWitcherPlayer().TutorialMutagensCleanupTempSkills(savedEquipp
edSkills);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == DESCRIPTION){
highlights.Resize(1);
highlights[0].x = 0.265000;
highlights[0].y = 0.130000;
highlights[0].width = 0.070000;
highlights[0].height = 0.120000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_CHAR_DEV_X,
theGame.params.TUT_POS_CHAR_DEV_Y, 3, highlights, /* NOP */, /* NOP */);
} else if (hintName == EQUIP){
highlights.Resize(1);
highlights[0].x = 0.330000;
highlights[0].y = 0.370000;
highlights[0].width = 0.220000;
highlights[0].height = 0.130000;
savedEquippedSkills = GetWitcherPlayer().TutorialMutagen
sUnequipPlayerSkills();
ShowHint(BONUSES, theGame.params.TUT_POS_CHAR_DEV_X, the
Game.params.TUT_POS_CHAR_DEV_Y, 5, highlights, /* NOP */, /* NOP */);

} else if (hintName == BONUSES){


highlights.Resize(2);
highlights[0].x = 0.330000;
highlights[0].y = 0.370000;
highlights[0].width = 0.220000;
highlights[0].height = 0.130000;
highlights[1].x = 0.420000;
highlights[1].y = 0.140000;
highlights[1].width = 0.100000;
highlights[1].height = 0.130000;
GetWitcherPlayer().TutorialMutagensEquipOneGoodSkill();
ShowHint(MATCH_SKILL_COLOR, theGame.params.TUT_POS_CHAR_
DEV_X, theGame.params.TUT_POS_CHAR_DEV_Y, 5, highlights, /* NOP */, /* NOP */);
} else if (hintName == MATCH_SKILL_COLOR){
highlights.Resize(2);
highlights[0].x = 0.330000;
highlights[0].y = 0.370000;
highlights[0].width = 0.220000;
highlights[0].height = 0.130000;
highlights[1].x = 0.420000;
highlights[1].y = 0.225000;
highlights[1].width = 0.100000;
highlights[1].height = 0.130000;
GetWitcherPlayer().TutorialMutagensEquipOneGoodOneBadSki
ll();
ShowHint(WRONG_COLOR, theGame.params.TUT_POS_CHAR_DEV_X,
theGame.params.TUT_POS_CHAR_DEV_Y, 5, highlights, /* NOP */, /* NOP */);
} else if (hintName == WRONG_COLOR){
highlights.Resize(1);
highlights[0].x = 0.330000;
highlights[0].y = 0.370000;
highlights[0].width = 0.220000;
highlights[0].height = 0.130000;
GetWitcherPlayer().TutorialMutagensEquipThreeGoodSkills(
);
ShowHint(MULTIPLE_SKILLS, theGame.params.TUT_POS_CHAR_DE
V_X, theGame.params.TUT_POS_CHAR_DEV_Y, 5, highlights, /* NOP */, /* NOP */);
} else if (hintName == MULTIPLE_SKILLS){
ShowHint(POTIONS, theGame.params.TUT_POS_CHAR_DEV_X, the
Game.params.TUT_POS_CHAR_DEV_Y, 5, /* NOP */, /* NOP */, /* NOP */);
} else if (hintName == POTIONS){
QuitState();
}
/* NOP */;
}
public final function SelectedMutagensTab(){
var highlights : array<STutorialHighlight>;
if (IsCurrentHint(SELECT_TAB)){
CloseHint(SELECT_TAB);
highlights.Resize(2);
highlights[0].x = 0.090000;
highlights[0].y = 0.285000;
highlights[0].width = 0.235000;
highlights[0].height = 0.380000;
highlights[1].x = 0.355000;
highlights[1].y = 0.210000;
highlights[1].width = 0.100000;
highlights[1].height = 0.160000;
ShowHint(EQUIP, theGame.params.TUT_POS_CHAR_DEV_X, theGa
me.params.TUT_POS_CHAR_DEV_Y, 3, highlights, /* NOP */, /* NOP */);

}
/* NOP */;
}
public final function EquippedMutagen(){
var highlights : array<STutorialHighlight>;
CloseHint(EQUIP);
highlights.Resize(1);
highlights[0].x = 0.030000;
highlights[0].y = 0.250000;
highlights[0].width = 0.230000;
highlights[0].height = 0.150000;
ShowHint(BONUSES, theGame.params.TUT_POS_CHAR_DEV_X, theGame.par
ams.TUT_POS_CHAR_DEV_Y, 5, highlights, /* NOP */, /* NOP */);
/* NOP */;
}
}
class CAIMonsterIdleFlyOnCurve extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params = new CAIMonsterIdleFlyOnCurveParamsDefault in this;
params.Init();
/* NOP */;
}
}
class CAIMonsterIdleFlyOnCurveParamsDefault extends CAIMonsterIdleActionParams{
public editable var curveTag : CName;
public editable var rotateBeforeTakeOff : Bool;
public editable var animationName : CName;
public editable var curveDummyName : String;
public editable var blendInTime : Float;
public editable var slotAnimation : CName;
public editable var animValPitch : String;
public editable var animValYaw : String;
public editable var maxPitchInput : Float;
public editable var maxPitchOutput : Float;
public editable var maxYawInput : Float;
public editable var maxYawOutput : Float;
}
class CAIMonsterIdleDefault extends CAIMonsterIdle{
public function Init(){
params = new CAIMonsterIdleParams in this;
params.OnCreated();
/* NOP */;
}
}
abstract class CAISubTreeParameters extends CAIParameters{
}
class CAILessogIdle extends CAIMonsterIdle{
public function Init(){
params = new CAIMonsterIdleParams in this;
params.OnCreated();
/* NOP */;
}
}

abstract class CAIIdleParameters extends CAIMainParameters{


}
class CAIMonsterIdleDecoratorArachas extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var dig : CAIMonsterIdleDig;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
dig = new CAIMonsterIdleDig in this;
super.Init();
eat.OnCreated();
dig.OnCreated();
eatParams = eat.params;
eatParams.meat = true;
params.searchFoodTree = eat;
params.actions.PushBack(dig);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorBear extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var onGroundAndClean : CAIMonsterIdleOnGroundAndClean;
var sleep : CAIMonsterIdleSleep;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
onGroundAndClean = new CAIMonsterIdleOnGroundAndClean in this;
sleep = new CAIMonsterIdleSleep in this;
super.Init();
eat.OnCreated();
onGroundAndClean.OnCreated();
sleep.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
eatParams.meat = true;
params.searchFoodTree = eat;
params.actions.PushBack(onGroundAndClean);
params.actions.PushBack(sleep);
params.nightActions.PushBack(sleep);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorBies extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var howl : CAIMonsterIdleHowl;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
howl = new CAIMonsterIdleHowl in this;
super.Init();
eat.OnCreated();
howl.OnCreated();
eatParams = eat.params;
eatParams.vegetable = true;
params.searchFoodTree = eat;
params.actions.PushBack(howl);
/* NOP */;

}
}
class CAIMonsterIdleDecoratorTroll extends CAIMonsterIdleDecorator{
public function Init(){
var stretch : CAIMonsterIdleStretch;
stretch = new CAIMonsterIdleStretch in this;
super.Init();
stretch.OnCreated();
params.actions.PushBack(stretch);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorDrowner extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var cough : CAIMonsterIdleCough;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
cough = new CAIMonsterIdleCough in this;
super.Init();
eat.OnCreated();
cough.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
eatParams.monster = true;
params.searchFoodTree = eat;
params.actions.PushBack(cough);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorGhoul extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
super.Init();
eat.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
eatParams.monster = true;
params.searchFoodTree = eat;
/* NOP */;
}
}
class CAIMonsterIdleDecoratorGolem extends CAIMonsterIdleDecorator{
public function Init(){
var strikeFists : CAIMonsterIdleStrikeFists;
var growl : CAIMonsterIdleGrowl;
var lookAround : CAIMonsterIdleLookAround;
strikeFists = new CAIMonsterIdleStrikeFists in this;
growl = new CAIMonsterIdleGrowl in this;
lookAround = new CAIMonsterIdleLookAround in this;
super.Init();
strikeFists.OnCreated();
growl.OnCreated();
lookAround.OnCreated();

params.actions.PushBack(strikeFists);
params.actions.PushBack(growl);
params.actions.PushBack(lookAround);
/* NOP */;
}
}
import struct CMovingAgentComponent{
private var relativeSpeedBuffer : array<Float>;
import public final function SetMaxMoveRotationPerSec(rotSpeed : Float);
import public final function GetCurrentMoveSpeedAbs() : Float;
import public final function TeleportBehindCamera(continueMovement : Boo
l) : Bool;
import public final function SetMoveType(moveType : EMoveType);
import public final function EnableCombatMode(combat : Bool) : Bool;
import public final function EnableVirtualController(virtualControllerNa
me : CName, enabled : Bool);
import public final function SetVirtualRadius(radiusName : CName, virtua
lControllerName : CName);
import public final function SetVirtualRadiusImmediately(radiusName : CN
ame);
import public final function ResetVirtualRadius(virtualControllerName :
CName);
import public final function SetHeight(height : Float);
import public final function ResetHeight();
import public final function GetSpeed() : Float;
import public final function GetRelativeMoveSpeed() : Float;
import public final function GetMoveTypeRelativeMoveSpeed(moveType : EMo
veType) : Float;
import public final function ForceSetRelativeMoveSpeed(relativeMoveSpeed
: Float);
import public final function SetGameplayRelativeMoveSpeed(relativeMoveSp
eed : Float);
import public final function SetGameplayMoveDirection(actorDirection : F
loat);
import public final function SetDirectionChangeRate(directionChangeRate
: Float);
import public final function GetMaxSpeed() : Float;
import public final function GetVelocity() : Vector;
import public final function GetVelocityBasedOnRequestedMovement() : Vec
tor;
import public final function AdjustRequestedMovementDirectionPhysics(dir
ectionWS : Vector, shouldStop : Bool, speed : Float, angleToDeflect : Float, fre
eSideDistanceRequired : Float, cornerDetected : Bool, portal : Bool) : Bool;
import public final function AdjustRequestedMovementDirectionNavMesh(dir
ectionWS : Vector, speed : Float, maxAngle : Float, maxIteration : Int32, maxIte
rationStartSide : Int32, preferedDirection : Vector, checkExploration : Bool) :
Bool;
import public final function StartRoadFollowing(speed : Float, maxAngle
: Float, maxDistance : Float, correctedDirection : Vector) : Bool;
import public final function ResetRoadFollowing();
import public final function GetAgentPosition() : Vector;
import public final function GetPathPointInDistance(distance : Float, po
sition : Vector) : Bool;
import public final function SnapToNavigableSpace(snap : Bool);
import public final function IsOnNavigableSpace() : Bool;
import public final function IsEntityRepresentationForced() : Int32;
import public final function GetLastNavigablePosition() : Vector;
import public final function CanGoStraightToDestination(destination : Ve
ctor) : Bool;

import public final function IsPositionValid(position : Vector) : Bool;


import public final function GetEndOfLineNavMeshPosition(pos : Vector, o
utPos : Vector) : Bool;
import public final function IsEndOfLinePositionValid(position : Vector)
: Bool;
import public final function GetMovementAdjustor() : CMovementAdjustor;
import public final function PredictWorldPosition(inTime : Float) : Vect
or;
import public final function SetTriggerActivatorRadius(radius : Float);
import public final function SetTriggerActivatorHeight(height : Float);
import public final function AddTriggerActivatorChannel(channel : ETrigg
erChannels);
import public final function RemoveTriggerActivatorChannel(channel : ETr
iggerChannels);
import public final function SetEnabledFeetIK(enable : Bool, blendTime :
Float);
import public final function GetEnabledFeetIK() : Bool;
import public final function SetEnabledHandsIK(enable : Bool);
import public final function SetHandsIKOffsets(left : Float, right : Flo
at);
import public final function SetEnabledSlidingOnSlopeIK(enable : Bool);
import public final function GetEnabledSlidingOnSlopeIK() : Bool;
import public final function SetUseEntityForPelvisOffset(entity : CEntit
y);
import public final function GetUseEntityForPelvisOffset() : CEntity;
import public final function SetAdditionalOffsetWhenAttachingToEntity(en
tity : CEntity, time : Float);
import public final function SetAdditionalOffsetToConsumePointWS(transfo
rmWS : Matrix, time : Float);
import public final function SetAdditionalOffsetToConsumeMS(pos : Vector
, rot : EulerAngles, time : Float);
public final function SetEnabledRestorePosition(enabled : Bool) : Bool{
SetEnabled(enabled);
if (enabled){
return IsEnabled();
} else {
return false;
}
/* NOP */;
}
public function ResetMoveRequests(){
super.ForceSetRelativeMoveSpeed(0.000000);
super.SetGameplayRelativeMoveSpeed(0.000000);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorGryphon extends CAIMonsterIdleDecorator{
public editable var arrivalDistance : Float;
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var growl : CAIMonsterIdleGrowl;
var wings : CAIMonsterIdleWings;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
growl = new CAIMonsterIdleGrowl in this;
wings = new CAIMonsterIdleWings in this;
super.Init();
eat.OnCreated();
growl.OnCreated();

wings.OnCreated();
eatParams = eat.params;
eatParams.meat = true;
eatParams.landHeight = 7;
eatParams.landHeight = 6;
params.searchFoodTree = eat;
params.actions.PushBack(growl);
params.actions.PushBack(wings);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorHarpy extends CAIMonsterIdleDecorator{
public function Init(){
var dig : CAIMonsterIdleDig;
var lookAround : CAIMonsterIdleLookAround;
dig = new CAIMonsterIdleDig in this;
lookAround = new CAIMonsterIdleLookAround in this;
super.Init();
dig.OnCreated();
lookAround.OnCreated();
params.actions.PushBack(dig);
params.actions.PushBack(lookAround);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorSiren extends CAIMonsterIdleDecorator{
public function Init(){
var flyBarrel : CAIMonsterIdleFlyBarrel;
var flyAirDive : CAIMonsterIdleFlyAirDive;
var wings : CAIMonsterIdleWings;
flyBarrel = new CAIMonsterIdleFlyBarrel in this;
flyAirDive = new CAIMonsterIdleFlyAirDive in this;
wings = new CAIMonsterIdleWings in this;
super.Init();
flyBarrel.OnCreated();
flyAirDive.OnCreated();
wings.OnCreated();
params.actions.PushBack(flyBarrel);
params.actions.PushBack(flyAirDive);
params.actions.PushBack(wings);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorGiant extends CAIMonsterIdleDecorator{
public function Init(){
var sit : CAIMonsterIdleSit;
var yawn : CAIMonsterIdleYawn;
var sleep : CAIMonsterIdleSleep;
sit = new CAIMonsterIdleSit in this;
yawn = new CAIMonsterIdleYawn in this;
sleep = new CAIMonsterIdleSleep in this;
super.Init();
sit.OnCreated();
yawn.OnCreated();
sleep.OnCreated();
params.actions.PushBack(sit);
params.actions.PushBack(yawn);

params.actions.PushBack(sleep);
params.nightActions.PushBack(sleep);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorNekker extends CAIMonsterIdleDecorator{
public function Init(){
var growl : CAIMonsterIdleGrowl;
var dig : CAIMonsterIdleDig;
var lookAround : CAIMonsterIdleLookAround;
growl = new CAIMonsterIdleGrowl in this;
dig = new CAIMonsterIdleDig in this;
lookAround = new CAIMonsterIdleLookAround in this;
super.Init();
growl.OnCreated();
dig.OnCreated();
lookAround.OnCreated();
params.actions.PushBack(growl);
params.actions.PushBack(dig);
params.actions.PushBack(lookAround);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorWerewolf extends CAIMonsterIdleDecorator{
public function Init(){
var howl : CAIMonsterIdleHowl;
var sniff : CAIMonsterIdleSniff;
howl = new CAIMonsterIdleHowl in this;
sniff = new CAIMonsterIdleSniff in this;
super.Init();
howl.OnCreated();
sniff.OnCreated();
params.actions.PushBack(howl);
params.actions.PushBack(sniff);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorWolfAlpha extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var sit : CAIMonsterIdleSit;
var howl : CAIMonsterIdleHowl;
var eatParams : CAIMonsterSearchFoodIdleParams;
var searchForTarget : CAIActionSearchForTarget;
var joinSearch : CAIActionAllySearchesTarget;
eat = new CAIMonsterSearchFoodTree in this;
sit = new CAIMonsterIdleSit in this;
howl = new CAIMonsterIdleHowl in this;
searchForTarget = new CAIActionSearchForTarget in this;
joinSearch = new CAIActionAllySearchesTarget in this;
super.Init();
eat.OnCreated();
sit.OnCreated();
howl.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
params.searchFoodTree = eat;

params.actions.PushBack(sit);
params.actions.PushBack(howl);
searchForTarget.OnCreated();
joinSearch.OnCreated();
params.reactionTree.params.reactions.Clear();
params.reactionTree.params.reactions.PushBack(searchForTarget);
params.reactionTree.params.reactions.PushBack(joinSearch);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorWolf extends CAIMonsterIdleDecorator{
public function Init(){
var i : Int32;
var moveInPack : CAIActionMoveInPack;
var eat : CAIMonsterSearchFoodTree;
var sit : CAIMonsterIdleSit;
var onGroundAndClean : CAIMonsterIdleOnGroundAndClean;
var howl : CAIMonsterIdleHowl;
var sleep : CAIMonsterIdleSleep;
var roll : CAIMonsterIdleRoll;
var playAround : CAIMonsterIdlePlayAround;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
sit = new CAIMonsterIdleSit in this;
onGroundAndClean = new CAIMonsterIdleOnGroundAndClean in this;
howl = new CAIMonsterIdleHowl in this;
sleep = new CAIMonsterIdleSleep in this;
roll = new CAIMonsterIdleRoll in this;
playAround = new CAIMonsterIdlePlayAround in this;
super.Init();
eat.OnCreated();
roll.OnCreated();
sit.OnCreated();
onGroundAndClean.OnCreated();
howl.OnCreated();
sleep.OnCreated();
playAround.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
params.searchFoodTree = eat;
params.actions.PushBack(roll);
params.actions.PushBack(sit);
params.actions.PushBack(onGroundAndClean);
params.actions.PushBack(howl);
params.actions.PushBack(sleep);
params.actions.PushBack(playAround);
params.nightActions.PushBack(sleep);
params.nightActions.PushBack(howl);
i = 0;
while (i < params.reactionTree.params.reactions.Size()){
moveInPack = (CAIActionMoveInPack)params.reactionTree.pa
rams.reactions[i];
if (moveInPack){
moveInPack.actionEventName = 'WolfMoves';
moveInPack.chanceToFollowPack = 100;
}
i += 1;
}
/* NOP */;

}
}
class CAIMonsterIdleDecoratorWyvern extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var wings : CAIMonsterIdleWings;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
wings = new CAIMonsterIdleWings in this;
super.Init();
eat.OnCreated();
wings.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
eatParams.monster = true;
eatParams.landHeight = 2;
eatParams.flyHeight = 2;
params.searchFoodTree = eat;
params.actions.PushBack(wings);
/* NOP */;
}
}
class CAIMonsterIdleDecoratorGravehag extends CAIMonsterIdleDecorator{
public function Init(){
var eat : CAIMonsterSearchFoodTree;
var eatParams : CAIMonsterSearchFoodIdleParams;
eat = new CAIMonsterSearchFoodTree in this;
super.Init();
eat.OnCreated();
eatParams = eat.params;
eatParams.corpse = true;
eatParams.monster = true;
params.searchFoodTree = eat;
/* NOP */;
}
}
import abstract class CCookedExplorations{
}
class CAIMonsterBase extends CAIBaseTree{
public editable inlined var params : CAIBaseMonsterDefaults;
public function Init(){
params = new CAIMonsterDefaults in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterDefaults extends CAIBaseMonsterDefaults{
public editable inlined var combatTree : CAIMonsterCombat;
public editable inlined var deathTree : CAIMonsterDeath;
public function Init(){
super.Init();
spawnTree = new CAIMonsterSpawnDefault in this;
spawnTree.OnCreated();
combatTree = new CAIMonsterCombat in this;
combatTree.OnCreated();

deathTree = new CAIMonsterDeath in this;


deathTree.OnCreated();
/* NOP */;
}
}
import abstract class CWayPointsCollectionsSet{
}
state W3TutorialManagerUIHandlerStateCharacterDevelopment in W3TutorialManagerUI
Handler extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var OPEN_CHAR_DEV : CName;
private const var LEVELING : CName;
private const var SKILLS : CName;
private const var BUY_SKILL : CName;
private const var SKILL_EQUIPPING : CName;
private const var EQUIP_SKILL : CName;
private const var SKILL_UNEQUIPPING : CName;
private const var GROUPS : CName;
private var isClosing : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
isClosing = false;
CloseHint(OPEN_CHAR_DEV);
ShowHint(LEVELING, theGame.params.TUT_POS_CHAR_DEV_X, theGame.pa
rams.TUT_POS_CHAR_DEV_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().uiHandler.UnregisterUIHint('Characte
rDevelopmentFastMenu', /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(OPEN_CHAR_DEV);
CloseHint(LEVELING);
CloseHint(SKILLS);
CloseHint(BUY_SKILL);
CloseHint(SKILL_EQUIPPING);
CloseHint(EQUIP_SKILL);
CloseHint(SKILL_UNEQUIPPING);
CloseHint(GROUPS);
theGame.GetTutorialSystem().MarkMessageAsSeen(BUY_SKILL);
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_SKILL);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == LEVELING){
highlights.Resize(1);
highlights[0].x = 0.030000;
highlights[0].y = 0.190000;
highlights[0].width = 0.230000;
highlights[0].height = 0.150000;
ShowHint(SKILLS, theGame.params.TUT_POS_CHAR_DEV_X, theG
ame.params.TUT_POS_CHAR_DEV_Y, /* NOP */, highlights, /* NOP */, /* NOP */);
} else if (hintName == SKILLS){

highlights.Resize(1);
highlights[0].x = 0.085000;
highlights[0].y = 0.130000;
highlights[0].width = 0.155000;
highlights[0].height = 0.120000;
ShowHint(GROUPS, theGame.params.TUT_POS_CHAR_DEV_X, theG
ame.params.TUT_POS_CHAR_DEV_Y, /* NOP */, highlights, /* NOP */, /* NOP */);
} else if (hintName == GROUPS){
highlights.Resize(1);
highlights[0].x = 0.100000;
highlights[0].y = 0.285000;
highlights[0].width = 0.210000;
highlights[0].height = 0.350000;
ShowHint(BUY_SKILL, theGame.params.TUT_POS_CHAR_DEV_X, t
heGame.params.TUT_POS_CHAR_DEV_Y, 3, highlights, /* NOP */, /* NOP */);
} else if (hintName == SKILL_EQUIPPING){
highlights.Resize(1);
highlights[0].x = 0.430000;
highlights[0].y = 0.143000;
highlights[0].width = 0.080000;
highlights[0].height = 0.300000;
ShowHint(EQUIP_SKILL, theGame.params.TUT_POS_CHAR_DEV_X,
theGame.params.TUT_POS_CHAR_DEV_Y, 3, highlights, /* NOP */, /* NOP */);
} else if (hintName == SKILL_UNEQUIPPING){
QuitState();
}
/* NOP */;
}
public final function OnBoughtSkill(skill : ESkill){
var highlights : array<STutorialHighlight>;
CloseHint(BUY_SKILL);
theGame.GetTutorialSystem().MarkMessageAsSeen(BUY_SKILL);
highlights.Resize(4);
highlights[0].x = 0.430000;
highlights[0].y = 0.143000;
highlights[0].width = 0.080000;
highlights[0].height = 0.300000;
highlights[1].x = 0.520000;
highlights[1].y = 0.143000;
highlights[1].width = 0.080000;
highlights[1].height = 0.300000;
highlights[2].x = 0.520000;
highlights[2].y = 0.490000;
highlights[2].width = 0.080000;
highlights[2].height = 0.300000;
highlights[3].x = 0.430000;
highlights[3].y = 0.490000;
highlights[3].width = 0.080000;
highlights[3].height = 0.300000;
ShowHint(SKILL_EQUIPPING, theGame.params.TUT_POS_CHAR_DEV_X, the
Game.params.TUT_POS_CHAR_DEV_Y, /* NOP */, highlights, /* NOP */, /* NOP */);
/* NOP */;
}
public final function EquippedSkill(){
var i : Int32;
var size : Int32;
CloseHint(EQUIP_SKILL);
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_SKILL);
ShowHint(SKILL_UNEQUIPPING, theGame.params.TUT_POS_CHAR_DEV_X, t
heGame.params.TUT_POS_CHAR_DEV_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);

size = EnumGetMax('EInputActionBlock') + 1;
i = 0;
while (i < size){
thePlayer.UnblockAction(i, 'lvlup_tutorial');
i += 1;
}
/* NOP */;
}
}
class CAIMonsterSpawnDefault extends CAIMonsterSpawn{
public function Init(){
params = new CAIMonsterSpawnParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIFlyingMonsterDefaults extends CAIBaseMonsterDefaults{
public editable inlined var combatTree : CAIFlyingMonsterCombat;
public editable inlined var deathTree : CAIFlyingMonsterDeath;
public editable inlined var flyingWander : CAISubTree;
public editable inlined var freeFlight : IAIFlightIdleTree;
public editable var canFly : Bool;
public function Init(){
super.Init();
spawnTree = new CAIMonsterSpawnFlying in this;
spawnTree.OnCreated();
combatTree = new CAIFlyingMonsterCombat in this;
combatTree.OnCreated();
deathTree = new CAIFlyingMonsterDeath in this;
deathTree.OnCreated();
freeFlight = new CAIFlightIdleFreeRoam in this;
freeFlight.OnCreated();
axiiTree.params.canFly = true;
/* NOP */;
}
}
state W3TutorialManagerUIHandlerStateSpecialAttacks in W3TutorialManagerUIHandle
r extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var SPECIALS : CName;
private const var ALTERNATES : CName;
public function OnLeaveState(nextStateName : CName) : Bool{
CloseHint(SPECIALS);
CloseHint(ALTERNATES);
if (theGame.GetTutorialSystem().HasSeenTutorial(SPECIALS) && the
Game.GetTutorialSystem().HasSeenTutorial(ALTERNATES)){
theGame.GetTutorialSystem().uiHandler.UnregisterUIHint(G
etStateName(), /* NOP */);
}
/* NOP */;
}
public final function OnBoughtSkill(skill : ESkill){
if (skill == 16 || skill == 17){
ShowHint(SPECIALS, theGame.params.TUT_POS_CHAR_DEV_X, 0.
470000, 5, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().MarkMessageAsSeen(SPECIALS);
} else if (skill == 37 || skill == 38 || skill == 39 || skill ==
40 || skill == 41){

ShowHint(ALTERNATES, theGame.params.TUT_POS_CHAR_DEV_X,
theGame.params.TUT_POS_CHAR_DEV_Y, 5, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().MarkMessageAsSeen(ALTERNATES
);
}
/* NOP */;
}
}
class CAIMonsterSpawnFlying extends CAIMonsterSpawn{
public function Init(){
params = new CAIMonsterSpawnParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIFlightIdleFreeRoam
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
}

extends IAIFlightIdleTree{
flightHeight : Float;
flyAround : Bool;
flyAroundDurationMin : Float;
flyAroundDurationMax : Float;
flightAreaSelection : EAIAreaSelectionMode;
flightAreaOptionalTag : CName;

class CAITrollDefaults extends CAIMonsterDefaults{


public function Init(){
super.Init();
combatTree.params.IncreaseHitCounterOnlyOnMelee = false;
combatTree.params.combatLogicTree = new CAITrollCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorTroll in this;
idleDecoratorTree.OnCreated();
/* NOP */;
}
}
class CAITrollCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINekkerDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAINekkerCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'NekkerKno
ckDownFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorNekker in this;
idleDecoratorTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 0;

/* NOP */;
}
}
class CAINekkerCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIBiesDefaults extends CAIMonsterDefaults{
public function Init(){
var moveToLure : CAIActionMoveToLure;
moveToLure = new CAIActionMoveToLure in this;
super.Init();
combatTree.params.combatLogicTree = new CAIBiesCombatLogic in th
is;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorBies in this;
idleDecoratorTree.OnCreated();
moveToLure.OnCreated();
idleDecoratorTree.params.reactionTree.params.reactions.PushBack(
moveToLure);
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 0;
/* NOP */;
}
}
class CAIBiesCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class IGameplayDLCMounter{
}
class CAIBiesDEBUG extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIBiesDEBUGLogic in thi
s;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIBiesDEBUGLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAISirenDefaults extends CAIFlyingMonsterDefaults{


public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAISirenCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'SirenCraw
lFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorSiren in this;
idleDecoratorTree.OnCreated();
flyingWander = new CAISirenDynamicWander in this;
flyingWander.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
axiiTree = NULL;
tauntTree = NULL;
/* NOP */;
}
}
class CAISirenCombatLogic extends CAIFlyingMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAISirenDynamicWander
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
}

extends CAISubTree{
chanceToTakeOff : Float;
chanceToLand : Float;
chanceToDive : Float;
minFlyDistance : Float;
maxFlyDistance : Float;
minHeight : Float;
maxHeight : Float;
proximityToAllowTakeOff : Float;
proximityToForceTakeOff : Float;
distanceFromPlayerToLand : Float;

import abstract class CDLCDefinition{


}
class CAIIceGiantDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIIceGiantCombatLogic i
n this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorGiant in this;
idleDecoratorTree.OnCreated();
/* NOP */;
}
}
class CAIIceGiantCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;

params.OnCreated();
/* NOP */;
}
}
class CAIDjinnDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIDjinnCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIDjinnCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIDrownerDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIDrownerCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'DrownerKn
ockDownFinisher';
spawnTree = new CAIMonsterSpawnFlying in this;
spawnTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorDrowner in this;
idleDecoratorTree.OnCreated();
idleTree = new CAIAmphibiousDynamicWander in this;
idleTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
/* NOP */;
}
}
class CAIDrownerCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIAmphibiousDynamicWander extends CAIDynamicWander{
}
class CAIGhoulDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIGhoulCombatLogic in t
his;

combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'GhoulKnoc
kDownFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorGhoul in this;
idleDecoratorTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
deathTree.params.stopFXOnActivate = 'morph_fx';
/* NOP */;
}
}
class CAIGhoulCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3Effect_Toxicity extends CBaseGameplayEffect{
private saved var dmgTypeName : CName;
private saved var toxThresholdEffect : Int32;
private var delayToNextVFXUpdate : Float;
public function CacheSettings(){
dmgTypeName = theGame.params.DAMAGE_NAME_DIRECT;
super.CacheSettings();
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var witcher : W3PlayerWitcher;
if (!(W3PlayerWitcher)target){
LogAssert(false, "W3Effect_Toxicity.OnEffectAdded: effec
t added on non-CR4Player object - aborting!");
return false;
}
witcher = GetWitcherPlayer();
if (witcher.GetStatPercents(3) >= witcher.GetToxicityDamageThres
hold()){
switchCameraEffect = true;
} else {
switchCameraEffect = false;
}
super.OnEffectAdded(customParams);
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
var dmg : Float;
var maxStat : Float;
var toxicity : Float;
var threshold : Float;
var drainVal : Float;
var dmgValue : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var currentStateName : CName;
var currentThreshold : Int32;
super.OnUpdate(deltaTime);
toxicity = GetWitcherPlayer().GetStat(3, false) / GetWitcherPlay

er().GetStatMax(3);
threshold = GetWitcherPlayer().GetToxicityDamageThreshold();
if (toxicity >= 0.500000 && !isPlayingCameraEffect){
switchCameraEffect = true;
} else if (toxicity < 0.500000 && isPlayingCameraEffect){
switchCameraEffect = true;
}
if (delayToNextVFXUpdate <= 0){
if (toxicity < 0.250000){
currentThreshold = 0;
} else if (toxicity < 0.500000){
currentThreshold = 1;
} else if (toxicity < 0.750000){
currentThreshold = 2;
} else {
currentThreshold = 3;
}
if (toxThresholdEffect != currentThreshold && !target.Is
EffectActive('invisible', /* NOP */)){
toxThresholdEffect = currentThreshold;
switch(toxThresholdEffect){
case 0:
PlayHeadEffect('toxic_000_025', /* NOP *
/);
break;
case 1:
PlayHeadEffect('toxic_025_050', /* NOP *
/);
break;
case 2:
PlayHeadEffect('toxic_050_075', /* NOP *
/);
break;
case 3:
PlayHeadEffect('toxic_075_100', /* NOP *
/);
break;
}
delayToNextVFXUpdate = 2;
}
} else {
delayToNextVFXUpdate -= deltaTime;
}
if (toxicity >= threshold){
currentStateName = thePlayer.GetCurrentStateName();
if (currentStateName != 'Meditation' && currentStateName
!= 'MeditationWaiting'){
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(abilityName, dmgTypeName, min, max);
if (DamageHitsVitality(dmgTypeName)){
maxStat = target.GetStatMax(0);
} else {
maxStat = target.GetStatMax(1);
}
dmgValue = GetAttributeRandomizedValue(min, max)
;
dmg = MaxF(0, deltaTime * dmgValue.valueAdditive
+ dmgValue.valueMultiplicative * maxStat + dmgValue.valueBase);
if (dmg > 0){
effectManager.CacheDamage(dmgTypeName, d

mg, NULL, this, deltaTime, true, 2, false);


} else {
LogAssert(false, "W3Effect_Toxicity: sho
uld deal damage but deals 0 damage!");
}
}
if (thePlayer.CanUseSkill(77) && !target.HasBuff(37)){
target.AddEffectDefault(37, target, 'IgnorePain'
, /* NOP */);
}
} else {
target.RemoveBuff(37, /* NOP */, /* NOP */);
}
drainVal = deltaTime * effectValue.valueAdditive + effectValue.v
alueMultiplicative * effectValue.valueBase + target.GetStatMax(3);
if (!target.IsInCombat()){
drainVal *= 2;
}
effectManager.CacheStatUpdate(3, drainVal);
/* NOP */;
}
public function PlayHeadEffect(effect : CName, stop : Bool){
var inv : CInventoryComponent;
var headIds : array<SItemUniqueId>;
var headId : SItemUniqueId;
var head : CItemEntity;
var i : Int32;
inv = target.GetInventory();
headIds = inv.GetItemsByCategory('head');
i = 0;
while (i < headIds.Size()){
if (!inv.IsItemMounted(headIds[i])){
} else {
headId = headIds[i];
if (!inv.IsIdValid(headId)){
LogAssert(false, "W3Effect_Toxicity : Ca
n't find head item");
return;
}
head = inv.GetItemEntityUnsafe(headId);
if (!head){
LogAssert(false, "W3Effect_Toxicity : he
ad item is null");
return;
}
if (stop){
head.StopEffect(effect);
} else {
head.PlayEffectSingle(effect, /* NOP */)
;
}
}
i += 1;
}
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
toxThresholdEffect = -1;
/* NOP */;

}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
if (thePlayer.CanUseSkill(77) && target.HasBuff(37)){
target.RemoveBuff(37, /* NOP */, /* NOP */);
}
PlayHeadEffect('toxic_000_025', true);
PlayHeadEffect('toxic_025_050', true);
PlayHeadEffect('toxic_050_075', true);
PlayHeadEffect('toxic_075_100', true);
PlayHeadEffect('toxic_025_000', true);
PlayHeadEffect('toxic_050_025', true);
PlayHeadEffect('toxic_075_050', true);
PlayHeadEffect('toxic_100_075', true);
toxThresholdEffect = 0;
/* NOP */;
}
protected function SetEffectValue(){
RecalcEffectValue();
/* NOP */;
}
public function RecalcEffectValue(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
if (!IsNameValid(abilityName)){
return;
}
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, attributeName, min, max
);
effectValue = GetAttributeRandomizedValue(min, max);
if (thePlayer.CanUseSkill(72)){
effectValue += thePlayer.GetSkillAttributeValue(72, attr
ibuteName, false, true) * thePlayer.GetSkillLevel(72);
}
/* NOP */;
}
}
class CAIGryphonDefaults extends CAIFlyingMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIGryphonCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorGryphon in this;
idleDecoratorTree.OnCreated();
flyingWander = new CAIDynamicFlyingWanderGryphon in this;
flyingWander.OnCreated();
axiiTree.params.landingGroundOffset = 7;
/* NOP */;
}
}
class CAIGryphonCombatLogic extends CAIFlyingMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;

}
}
class W3AlchemyManager extends CObject{
private var recipes : array<SAlchemyRecipe>;
public function Init(alchemyRecipes : array<CName>){
if (alchemyRecipes.Size() > 0){
LoadRecipesCustomXMLData(alchemyRecipes);
} else {
LoadRecipesCustomXMLData(GetWitcherPlayer().GetAlchemyRe
cipes());
}
/* NOP */;
}
public function GetRecipe(recipeName : CName, ret : SAlchemyRecipe) : Bo
ol{
var i : Int32;
i = 0;
while (i < recipes.Size()){
if (recipes[i].recipeName == recipeName){
ret = recipes[i];
return true;
}
i += 1;
}
return false;
/* NOP */;
}
private function LoadRecipesCustomXMLData(recipesNames : array<CName>){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var tmpBool : Bool;
var tmpName : CName;
var tmpString : String;
var tmpInt : Int32;
var rec : SAlchemyRecipe;
var i : Int32;
var k : Int32;
var readRecipes : Int32;
var ing : SItemParts;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('alchemy_recipes');
readRecipes = 0;
i = 0;
while (i < main.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'name_name', tmpName) && IsNameValid(tmpName) && recipesNames.Contains(tmpName)
){
rec.recipeName = tmpName;
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'cookedItem_name', tmpName)){
rec.cookedItemName = tmpName;
} else {
rec.cookedItemName = 'None';
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'type_name', tmpName)){
rec.typeName = tmpName;
} else {

rec.typeName = 'None';
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'level', tmpInt)){
rec.level = tmpInt;
} else {
rec.level = -1;
}
if (dm.GetCustomNodeAttributeValueString(main.su
bNodes[i], 'cookedItemType', tmpString)){
rec.cookedItemType = AlchemyCookedItemTy
peStringToEnum(tmpString);
} else {
rec.cookedItemType = 0;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'cookedItemQuantity', tmpInt)){
rec.cookedItemQuantity = tmpInt;
} else {
rec.cookedItemQuantity = -1;
}
ingredients = dm.GetCustomDefinitionSubNode(main
.subNodes[i], 'ingredients');
rec.requiredIngredients.Clear();
k = 0;
while (k < ingredients.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(i
ngredients.subNodes[k], 'item_name', tmpName)){
ing.itemName = tmpName;
} else {
ing.itemName = 'None';
}
if (dm.GetCustomNodeAttributeValueInt(in
gredients.subNodes[k], 'quantity', tmpInt)){
ing.quantity = tmpInt;
} else {
ing.quantity = -1;
}
rec.requiredIngredients.PushBack(ing);
k += 1;
}
rec.cookedItemIconPath = dm.GetItemIconPath(rec.
cookedItemName);
rec.recipeIconPath = dm.GetItemIconPath(rec.reci
peName);
recipes.PushBack(rec);
readRecipes += 1;
if (readRecipes >= recipesNames.Size()){
break;
}
}
i += 1;
}
/* NOP */;
}
public function CanCookRecipe(recipeName : CName) : EAlchemyExceptions{
var i : Int32;
var cnt : Int32;
var recipe : SAlchemyRecipe;
var items : array<SItemUniqueId>;

if (!GetRecipe(recipeName, recipe)){
return 3;
}
if (theGame.GetDefinitionsManager().IsItemSingletonItem(recipe.c
ookedItemName) && thePlayer.inv.GetItemQuantityByName(recipe.cookedItemName, /*
NOP */) > 0){
items = thePlayer.inv.GetItemsByName(recipe.cookedItemNa
me);
if (items.Size() > 1 || items.Size() < 1 || !thePlayer.i
nv.ItemHasTag(items[0], 'NoShow')){
return 4;
}
}
i = 0;
while (i < recipe.requiredIngredients.Size()){
cnt = thePlayer.inv.GetItemQuantityByName(recipe.require
dIngredients[i].itemName, /* NOP */);
if (cnt < recipe.requiredIngredients[i].quantity){
return 2;
}
i += 1;
}
return 0;
/* NOP */;
}
public function CookItem(recipeName : CName){
var i : Int32;
var j : Int32;
var quantity : Int32;
var removedIngQuantity : Int32;
var maxAmmo : Int32;
var recipe : SAlchemyRecipe;
var dm : CDefinitionsManagerAccessor;
var crossbowID : SItemUniqueId;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var uiStateAlchemy : W3TutorialManagerUIHandlerStateAlchemy;
var uiStateAlchemyMutagens : W3TutorialManagerUIHandlerStateAlch
emyMutagens;
var ids : array<SItemUniqueId>;
var items : array<SItemUniqueId>;
var alchIngs : array<SItemUniqueId>;
var isPotion : Bool;
var isSingletonItem : Bool;
var witcher : W3PlayerWitcher;
var equippedOnSlot : EEquipmentSlots;
GetRecipe(recipeName, recipe);
equippedOnSlot = 0;
dm = theGame.GetDefinitionsManager();
dm.GetItemAttributeValueNoRandom(recipe.cookedItemName, true, 'a
mmo', min, max);
quantity = CalculateAttributeValue(GetAttributeRandomizedValue(m
in, max), /* NOP */);
if (recipe.cookedItemType == 2 && GetWitcherPlayer().CanUseSkill
(65)){
quantity += GetWitcherPlayer().GetSkillLevel(65);
}
isSingletonItem = dm.IsItemSingletonItem(recipe.cookedItemName);
if (isSingletonItem && thePlayer.inv.GetItemQuantityByName(recip
e.cookedItemName, /* NOP */) > 0){

items = thePlayer.inv.GetItemsByName(recipe.cookedItemNa
me);
if (items.Size() == 1 && thePlayer.inv.ItemHasTag(items[
0], 'NoShow')){
thePlayer.inv.RemoveItemTag(items[i], 'NoShow');
}
} else {
ids = thePlayer.inv.AddAnItem(recipe.cookedItemName, qua
ntity, /* NOP */, /* NOP */, /* NOP */);
if (isSingletonItem){
maxAmmo = thePlayer.inv.SingletonItemGetMaxAmmo(
ids[0]);
i = 0;
while (i < ids.Size()){
thePlayer.inv.SingletonItemSetAmmo(ids[i
], maxAmmo);
i += 1;
}
}
}
i = 0;
while (i < recipe.requiredIngredients.Size()){
if (dm.IsItemAlchemyItem(recipe.requiredIngredients[i].i
temName)){
removedIngQuantity = 0;
alchIngs = thePlayer.inv.GetItemsByName(recipe.r
equiredIngredients[i].itemName);
witcher = GetWitcherPlayer();
j = 0;
while (j < alchIngs.Size()){
equippedOnSlot = witcher.GetItemSlot(alc
hIngs[j]);
if (equippedOnSlot != 0){
witcher.UnequipItem(alchIngs[j])
;
}
removedIngQuantity += 1;
witcher.inv.RemoveItem(alchIngs[j], /* N
OP */);
if (removedIngQuantity >= recipe.require
dIngredients[i].quantity){
break;
}
j += 1;
}
} else {
thePlayer.inv.RemoveItemByName(recipe.requiredIn
gredients[i].itemName, recipe.requiredIngredients[i].quantity);
}
i += 1;
}
RemoveLowerLevelItems(recipe);
if (ids.Size() > 0 && thePlayer.inv.IsItemPotion(ids[0])){
isPotion = true;
} else if (items.Size() > 0 && thePlayer.inv.IsItemPotion(items[
0])){
isPotion = true;
} else {
isPotion = false;
}

if (isPotion){
theTelemetry.LogWithLabelAndValue(27, recipe.cookedItemN
ame, 1);
} else {
theTelemetry.LogWithLabelAndValue(27, recipe.cookedItemN
ame, 0);
}
if (equippedOnSlot != 0){
witcher.EquipItemInGivenSlot(ids[0], equippedOnSlot, fal
se, /* NOP */);
}
LogAlchemy("Item <<" + recipe.cookedItemName + ">> cooked x" + r
ecipe.cookedItemQuantity);
if (ShouldProcessTutorial('TutorialAlchemyCook')){
uiStateAlchemy = (W3TutorialManagerUIHandlerStateAlchemy
)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateAlchemy){
uiStateAlchemy.CookedItem(recipeName);
} else {
uiStateAlchemyMutagens = (W3TutorialManagerUIHan
dlerStateAlchemyMutagens)theGame.GetTutorialSystem().uiHandler.GetCurrentState()
;
if (uiStateAlchemyMutagens){
uiStateAlchemyMutagens.CookedItem(recipe
Name);
}
}
}
/* NOP */;
}
private function RemoveLowerLevelItems(recipe : SAlchemyRecipe){
var i : Int32;
var j : Int32;
var items : array<SItemUniqueId>;
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
i = 0;
while (i < recipes.Size()){
if (recipes[i].typeName == recipe.typeName && recipes[i]
.level < recipe.level){
items = thePlayer.inv.GetItemsByName(recipes[i].
cookedItemName);
j = 0;
while (j < items.Size()){
if (witcher.IsItemEquipped(items[j])){
witcher.UnequipItem(items[j]);
}
witcher.inv.RemoveItem(items[j], /* NOP
*/);
j += 1;
}
}
i += 1;
}
/* NOP */;
}
public function GetRecipes(forceAll : Bool) : array<SAlchemyRecipe>{
var ret : array<SAlchemyRecipe>;
var i : Int32;
var j : Int32;

var cnt : Int32;


var checkedRecipe : String;
var testedRecipe : String;
var deletedCheckted : Bool;
var alchemyItems : array<SItemUniqueId>;
var itemName : CName;
if (forceAll){
return recipes;
}
alchemyItems = thePlayer.inv.GetAlchemyCraftableItems();
ret.Resize(recipes.Size());
i = 0;
while (i < recipes.Size()){
ret[i] = recipes[i];
i += 1;
}
i = 0;
while (i < ret.Size()){
j = i + 1;
deletedCheckted = false;
checkedRecipe = NameToString(ret[i].cookedItemName);
checkedRecipe = StrLeft(checkedRecipe, StrLen(checkedRec
ipe) - 2);
while (j < ret.Size()){
testedRecipe = NameToString(ret[j].cookedItemNam
e);
testedRecipe = StrLeft(testedRecipe, StrLen(test
edRecipe) - 2);
if (checkedRecipe == testedRecipe){
if (ret[i].level < ret[j].level){
if (super.ShouldRemoveRecipe(ret
[i].cookedItemName, ret[i].level, alchemyItems)){
ret.EraseFast(i);
deletedCheckted = true;
break;
}
} else if (super.ShouldRemoveRecipe(ret[
j].cookedItemName, ret[j].level, alchemyItems)){
ret.EraseFast(j);
}
} else {
j += 1;
}
}
if (!deletedCheckted){
i += 1;
}
}
i = ret.Size() - 1;
while (i >= 0){
itemName = ret[i].cookedItemName;
cnt = thePlayer.inv.GetItemQuantityByName(itemName, /* N
OP */);
if (cnt <= 0){
} else if (ret[i].cookedItemType == 1 && StrStartsWith(N
ameToString(ret[i].typeName), "Mutagen")){
ret.EraseFast(i);
} else if (ret[i].level == 3){
ret.EraseFast(i);
} else if (itemName == 'Killer Whale 1' || itemName == '

Trial Potion Kit' || itemName == 'Pops Antidote' || itemName == 'mh107_czart_lur


e' || StrContains(NameToString(itemName), "Pheromone")){
ret.EraseFast(i);
}
i -= 1;
}
return ret;
/* NOP */;
}
private final function ShouldRemoveRecipe(itemName : CName, itemLevel :
Int32, alchemyItems : array<SItemUniqueId>) : Bool{
var recipeItemType : String;
var checkedItemType : String;
var i : Int32;
recipeItemType = NameToString(itemName);
recipeItemType = StrLeft(recipeItemType, StrLen(recipeItemType)
- 2);
i = 0;
while (i < alchemyItems.Size()){
checkedItemType = NameToString(thePlayer.inv.GetItemName
(alchemyItems[i]));
checkedItemType = StrLeft(checkedItemType, StrLen(checke
dItemType) - 2);
if (recipeItemType == checkedItemType){
if (CalculateAttributeValue(thePlayer.inv.GetIte
mAttributeValue(alchemyItems[i], 'level', /* NOP */, /* NOP */), /* NOP */) >= i
temLevel){
return true;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function GetRequiredIngredients(recipeName : CName) : array<SItem
Parts>{
var rec : SAlchemyRecipe;
var null : array<SItemParts>;
if (GetRecipe(recipeName, rec)){
return rec.requiredIngredients;
}
return null;
/* NOP */;
}
}
class CAIDynamicFlyingWanderGryphon extends CAIDynamicFlyingWander{
}
class CAIHarpyDefaults extends CAIFlyingMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIHarpyCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'HarpyKnoc
kDownFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorHarpy in this;
idleDecoratorTree.OnCreated();

flyingWander = new CAIDynamicFlyingWanderHarpy in this;


flyingWander.OnCreated();
axiiTree.params.onSpotLanding = true;
axiiTree.params.landingGroundOffset = 1;
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
/* NOP */;
}
}
class CAIHarpyCombatLogic extends CAIFlyingMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIDynamicFlyingWanderHarpy extends CAIDynamicFlyingWander{
}
class W3Effect_BattleTrance extends CBaseGameplayEffect{
private saved var currentFocusLevel : Int32;
public function OnUpdate(deltaTime : Float) : Bool{
var focus : Float;
var newLevel : Int32;
var delta : Int32;
super.OnUpdate(deltaTime);
focus = target.GetStat(4, /* NOP */);
newLevel = FloorF(focus);
delta = newLevel - currentFocusLevel;
if (delta != 0){
if (delta < 0){
target.RemoveAbilityMultiple(thePlayer.GetSkillA
bilityName(5), Abs(delta));
if (thePlayer.CanUseSkill(43)){
thePlayer.RemoveAbilityMultiple(thePlaye
r.GetSkillAbilityName(43), Abs(delta));
}
if (thePlayer.CanUseSkill(90)){
thePlayer.RemoveAbilityMultiple(thePlaye
r.GetSkillAbilityName(90), Abs(delta));
}
} else {
target.AddAbilityMultiple(thePlayer.GetSkillAbil
ityName(5), delta);
if (thePlayer.CanUseSkill(43)){
thePlayer.AddAbilityMultiple(thePlayer.G
etSkillAbilityName(43), delta);
}
if (thePlayer.CanUseSkill(90)){
thePlayer.AddAbilityMultiple(thePlayer.G
etSkillAbilityName(90), delta);
}
}
if (newLevel == 0){
isActive = false;
return true;
}

currentFocusLevel = newLevel;
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var player : CR4Player;
player = (CR4Player)target;
if (!player){
LogEffects("W3Effect_BattleTrance.OnEffectAdded: effect
added on non-CR4Player object - aborting!");
return false;
}
super.OnEffectAdded(customParams);
currentFocusLevel = FloorF(target.GetStat(4, /* NOP */));
target.AddAbility(thePlayer.GetSkillAbilityName(5), /* NOP */);
if (player.CanUseSkill(43)){
player.AddAbility(player.GetSkillAbilityName(43), /* NOP
*/);
}
if (player.CanUseSkill(90)){
player.AddAbilityMultiple(player.GetSkillAbilityName(90)
, currentFocusLevel);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var player : CR4Player;
super.OnEffectRemoved();
player = (CR4Player)target;
player.RemoveAbilityAll(player.GetSkillAbilityName(43));
player.RemoveAbilityAll(player.GetSkillAbilityName(90));
player.RemoveAbilityAll(player.GetSkillAbilityName(5));
/* NOP */;
}
public function OnPerk11Equipped(){
thePlayer.AddAbilityMultiple(thePlayer.GetSkillAbilityName(90),
FloorF(thePlayer.GetStat(4, /* NOP */)));
/* NOP */;
}
public function OnPerk11Unequipped(){
thePlayer.RemoveAbilityAll(thePlayer.GetSkillAbilityName(90));
/* NOP */;
}
protected function SetEffectValue(){
effectValue = GetWitcherPlayer().GetSkillAttributeValue(5, Power
StatEnumToName(0), false, true);
/* NOP */;
}
}
class CAIWraithDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIWraithCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorWraith in this;
idleDecoratorTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;

deathTree.params.disableCollisionDelay = 0.050000;
deathTree.params.destroyAfterAnimDelay = 5;
/* NOP */;
}
}
class CAIWraithCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterIdleDecoratorWraith extends CAIMonsterIdleDecorator{
public function Init(){
super.Init();
/* NOP */;
}
}
class CAINoonwraithDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAINoonwraithCombatLogic
in this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorNoonWraith in thi
s;
idleDecoratorTree.OnCreated();
deathTree.params.destroyAfterAnimDelay = 5.000000;
deathTree.params.stopFXOnActivate = 'shadows_form';
/* NOP */;
}
}
class CAINoonwraithCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterIdleDecoratorNoonWraith extends CAIMonsterIdleDecorator{
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIPestaDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIPestaCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
deathTree.params.destroyAfterAnimDelay = 5.000000;
deathTree.params.stopFXOnActivate = 'shadows_form';
/* NOP */;

}
}
class CAIPestaCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWolfDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
idleDecoratorTree = new CAIMonsterIdleDecoratorWolf in this;
idleDecoratorTree.OnCreated();
combatTree.params.combatLogicTree = new CAIWolfCombatLogic in co
mbatTree.params;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'WolfKnock
DownFinisher';
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
/* NOP */;
}
}
class CAIWolfCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIWolfCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3Effect_IgnorePain extends W3ChangeMaxStatEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var witcher : W3PlayerWitcher;
var level : Int32;
witcher = (W3PlayerWitcher)target;
if (!witcher){
LogEffects("W3Effect_Toxicity.OnEffectAdded: effect adde
d on non-CR4Player object - aborting!");
target.RemoveBuff(37, true, /* NOP */);
return false;
}
level = witcher.GetSkillLevel(77);
if (level > 1){
witcher.AddAbilityMultiple(abilityName, level - 1);
}
super.OnEffectAdded(customParams);
/* NOP */;
}
public final function OnSkillLevelChanged(delta : Int32){
var i : Int32;
i = 0;
while (i < Abs(delta)){
if (delta > 0){
thePlayer.AddAbilityMultiple(abilityName, delta)

;
} else {
thePlayer.RemoveAbilityMultiple(abilityName, -de
lta);
}
i += 1;
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var percents : Float;
var level : Int32;
percents = target.GetStatPercents(0);
super.OnEffectRemoved();
level = GetWitcherPlayer().GetSkillLevel(77);
if (level > 1){
target.RemoveAbilityMultiple(abilityName, level);
}
target.UpdateStatMax(0);
target.ForceSetStat(0, percents * target.GetStatMax(0));
/* NOP */;
}
}
import abstract class CUnknownResource{
}
struct STutorialSavedSkill{
var skillSlotID : Int32;
var skillType : ESkill;
}
import struct CScriptableState{
import public function GetStateName() : CName;
import public function IsActive() : Bool;
import public function CanEnterState(prevStateName : CName) : Bool;
import public function CanLeaveState(nextStateName : CName) : Bool;
import public function BeginState(prevStateName : CName);
import public function EndState(nextStateName : CName);
import public function ContinuedState();
import public function PausedState();
public function OnEnterState(prevStateName : CName) : Bool{
}
public function OnLeaveState(nextStateName : CName) : Bool{
}
}
class CAIWolfAlphaDefaults extends CAIWolfDefaults{
public function Init(){
var leadPack : CAILeadPackWander;
var newParams : CAIWolfCombatLogicParams;
super.Init();
idleDecoratorTree = new CAIMonsterIdleDecoratorWolfAlpha in this
;
idleDecoratorTree.OnCreated();
newParams = (CAIWolfCombatLogicParams)combatTree.params.combatLo
gicTree.params;
newParams.attackMovementType = 0;
idleTree = new CAILeadPackWander in this;
idleTree.OnCreated();

leadPack = (CAILeadPackWander)idleTree;
leadPack.leaderRegroupEvent = 'WolfMoves';
leadPack.followers = 6;
/* NOP */;
}
}
import abstract class IAttachment{
}
class CAIGuardDogDefaults extends CAIWolfDefaults{
public function Init(){
var moveOut : CAIActionMoveOut;
super.Init();
moveOut = new CAIActionMoveOut in this;
moveOut.OnCreated();
idleDecoratorTree.params.reactionTree.params.reactions.PushBack(
moveOut);
/* NOP */;
}
}
import abstract class CMeshSkinningAttachment{
}
class CAILessogDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
spawnTree = new CAIMonsterSpawnLessog in this;
spawnTree.OnCreated();
combatTree.params.combatLogicTree = new CAILessogCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
deathTree = new CAIMonsterDeath in this;
deathTree.OnCreated();
deathTree.params.playFXOnDeactivate = 'respawn_dissapear';
deathTree.params.disableCollision = true;
deathTree.params.destroyAfterAnimDelay = 10;
/* NOP */;
}
}
import abstract class CResourceDefEntry{
}
class CAIMonsterSpawnLessog extends CAIMonsterSpawn{
public function Init(){
params = new CAIMonsterSpawnParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct IAIParameters{
import public function LoadSteeringGraph(fileName : String) : CMoveSteer
ingBehavior;
import public function OnManualRuntimeCreation();
public function OnCreated(){
Init();
/* NOP */;

}
public function Init(){
}
}
class CAILessogCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CDiskBundleContent{
}
class CAIHimDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIHimCombatLogic in thi
s;
combatTree.params.combatLogicTree.OnCreated();
deathTree = new CAIMonsterDeath in this;
deathTree.OnCreated();
/* NOP */;
}
}
import abstract class CAIReaction{
}
class CAIHimCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIEndriagaDefaults extends CAIMonsterDefaults{
public function Init(){
var combatLogicParams : CAIArachasCombatLogicParams;
super.Init();
combatTree.params.combatLogicTree = new CAIArachasCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
combatLogicParams = (CAIArachasCombatLogicParams)combatTree.para
ms.combatLogicTree.params;
combatLogicParams.minChargeDist = 3.000000;
combatLogicParams.maxChargeDist = 4.000000;
idleDecoratorTree = new CAIMonsterIdleDecoratorArachas in this;
idleDecoratorTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 0;
/* NOP */;
}
}
class CAIArachasCombatLogic extends CAIMonsterCombatLogic{

public function Init(){


params = new CAIArachasCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CAISenseParams{
}
class CAIArachasDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIArachasCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorArachas in this;
idleDecoratorTree.OnCreated();
/* NOP */;
}
}
class CAIArachasDEBUG extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIArachasDEBUGLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIArachasDEBUGLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIGolemDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIGolemCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorGolem in this;
idleDecoratorTree.OnCreated();
spawnTree.params.monitorGroundContact = true;
/* NOP */;
}
}
class CAIGolemCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIGolemCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAIGolemDEBUG extends CAIMonsterDefaults{


public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIGolemDEBUGLogic in th
is;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIGolemDEBUGLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWerewolfDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIWerewolfCombatLogic i
n this;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'WerewolfK
nockDownFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorWerewolf in this;
idleDecoratorTree.OnCreated();
deathTree = new CAIMonsterDefeated in this;
deathTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 0.500000;
/* NOP */;
}
}
import abstract class IReactionCondition{
}
class CAIWerewolfCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class IReactionAction{
}
class CAIMonsterDefeated extends CAIMonsterDeath{
public editable inlined var params : CAIMonsterDefeatedParams;
public function Init(){
params = new CAIMonsterDefeatedParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAIKatakanDefaults extends CAIMonsterDefaults{


public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIKatakanCombatLogic in
this;
combatTree.params.Init();
idleDecoratorTree = new CAIMonsterIdleDecoratorKatakan in this;
idleDecoratorTree.OnCreated();
/* NOP */;
}
}
class CAIKatakanCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.Init();
/* NOP */;
}
}
class CAIMonsterIdleDecoratorKatakan extends CAIMonsterIdleDecorator{
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIBearDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIBearCombatLogic in th
is;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorBear in this;
idleDecoratorTree.OnCreated();
/* NOP */;
}
}
class CAIBearCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIBearProtectiveDefaults extends CAIBearDefaults{
public editable var canTaunt : Bool;
public editable var berserk : Bool;
public function Init(){
super.Init();
keepDistance = new CAIKeepDistanceTree in this;
keepDistance.OnCreated();
keepDistance.moveType = 0;
/* NOP */;
}
}

class CAIWyvernDefaults extends CAIFlyingMonsterDefaults{


public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIWyvernCombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecoratorWyvern in this;
idleDecoratorTree.OnCreated();
axiiTree.params.landingGroundOffset = 2;
flyingWander = new CAIDynamicFlyingWanderWyvern in this;
flyingWander.OnCreated();
/* NOP */;
}
}
class CAIWyvernCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CAIMinigameParamsWristWrestling{
}
class CAIDynamicFlyingWanderWyvern extends CAIDynamicFlyingWander{
}
class CAIGravehagDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIGravehagCombatLogic i
n this;
combatTree.params.combatLogicTree.OnCreated();
combatTree.params.criticalState.params.FinisherAnim = 'GravehagK
nockDownFinisher';
idleDecoratorTree = new CAIMonsterIdleDecoratorGravehag in this;
idleDecoratorTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
/* NOP */;
}
}
class CAIGravehagCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIFoglingDopplegangerDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIFoglingDopplegangerCo
mbatLogic in this;
combatTree.params.combatLogicTree.OnCreated();

deathTree.params.playFXOnActivate = 'disappear_fog';
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 0.050000;
deathTree.params.destroyAfterAnimDelay = 5;
/* NOP */;
}
}
import struct CAIBaseTree{
}
class CAIFoglingDopplegangerCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct ICustomValAIParameters{
public function SetCNameValue(value : CName){
}
}
class CAIWitchDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIWitchCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIWitchCombatLogic extends CAIMonsterCombatLogic{
public editable var Phase1 : Bool;
public editable var Phase2 : Bool;
public editable var PhaseReset : Bool;
public editable var AbilityHypnosis : Bool;
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWitch2Defaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIWitch2CombatLogic in
this;
combatTree.params.combatLogicTree.OnCreated();
/* NOP */;
}
}
class CAIWitch2CombatLogic extends CAIMonsterCombatLogic{
public editable var Phase1 : Bool;
public editable var Phase2 : Bool;

public
public
public
public

editable var PhaseReset : Bool;


editable var bileAttack : Bool;
editable var prePursueTaunt : Bool;
function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
bileAttack = true;
prePursueTaunt = true;
/* NOP */;

}
}
class CAIFugasDefaults extends CAIMonsterDefaults{
public function Init(){
super.Init();
combatTree.params.combatLogicTree = new CAIFugasCombatLogic in t
his;
combatTree.params.combatLogicTree.OnCreated();
deathTree.params.disableCollisionOnAnim = true;
deathTree.params.disableCollision = true;
deathTree.params.disableCollisionDelay = 2;
/* NOP */;
}
}
import abstract class CEDSavedAnswer{
}
class CAIFugasCombatLogic extends CAIMonsterCombatLogic{
public editable var useFasterMovementToApproach : Bool;
public editable var fireAttack : Bool;
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
useFasterMovementToApproach = true;
fireAttack = true;
/* NOP */;
}
}
class CAIRatDefaults extends CAIMonsterDefaults{
public function Init(){
var fleeFire : CAIActionLeadEscape;
var fleeAard : CAIActionLeadEscape;
fleeFire = new CAIActionLeadEscape in this;
fleeAard = new CAIActionLeadEscape in this;
super.Init();
combatTree.params.combatLogicTree = new CAIRatCombatLogic in thi
s;
combatTree.params.combatLogicTree.OnCreated();
fleeFire.OnCreated();
fleeFire.actionEventName = 'FireDanger';
fleeAard.OnCreated();
fleeAard.actionEventName = 'CastSignAction';
idleDecoratorTree.params.reactionTree.params.reactions.PushBack(
fleeFire);
combatTree.params.reactionTree.params.reactions.PushBack(fleeFir
e);
combatTree.params.reactionTree.params.reactions.PushBack(fleeAar
d);

combatTree.params.criticalState = NULL;
spawnTree = NULL;
tauntTree = NULL;
/* NOP */;
}
}
class CAIRatCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
abstract class CAIAxiiParameters extends CAIMainParameters{
}
abstract class CAITauntParameters extends CAIMainParameters{
}
class CAICowardMonsterTaunt extends CAIMonsterTaunt{
public function Init(){
super.Init();
params = new CAICowardMonsterTauntParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICowardMonsterTauntParams extends CAIMonsterTauntParams{
public editable var moveBackDistance : Float;
}
abstract class
public
public
eactionTree;
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
t;
public
public

CAIBaseMonsterCombatParams extends CAICombatParameters{


editable inlined var combatLogicTree : CAIMonsterCombatLogic;
editable inlined var damageReactionTree : CAIMonsterSimpleDamageR
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable

var
var
var
var
var
var
var
var
var
var
var
var
var
var
var

reachabilityTolerance : Float;
targetOnlyPlayer : Bool;
hostileActorWeight : Float;
currentTargetWeight : Float;
rememberedHits : Int32;
hitterWeight : Float;
maxWeightedDistance : Float;
distanceWeight : Float;
playerWeightProbability : Int32;
playerWeight : Float;
skipVehicle : ECombatTargetSelectionSkipTarget;
skipVehicleProbability : Int32;
skipUnreachable : ECombatTargetSelectionSkipTarget;
skipUnreachableProbability : Int32;
skipNotThreatening : ECombatTargetSelectionSkipTarge

editable var skipNotThreateningProbability : Int32;


function Init(){
var i : Int32;
var stdCS : CAINpcCriticalState;
damageReactionTree = new CAIMonsterDamageReactionTree in this;
damageReactionTree.OnCreated();

/* NOP */;
}
}
class CAIMonsterDamageReactionTree extends CAIMonsterSimpleDamageReactionTree{
public editable inlined var params : CAIDamageReactionTreeParams;
public function Init(){
params = new CAIDamageReactionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CAnimDef{
}
class W3Mutagen28_Effect extends W3Mutagen_Effect{
public function GetMonsterDamageBonus(mc : EMonsterCategory) : SAbilityA
ttributeValue{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var attName : CName;
attName = MonsterCategoryToAttackPowerBonus(mc);
if (!IsNameValid(attName)){
return min;
}
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, attName, min, max);
return GetAttributeRandomizedValue(min, max);
/* NOP */;
}
public function GetProtection(mc : EMonsterCategory, dmgType : CName, is
DoT : Bool, bonusResist : Float, bonusReduct : Float){
var res : ECharacterDefenseStats;
var atts : array<CName>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var pointRes : CName;
var percRes : CName;
bonusResist = 0;
bonusReduct = 0;
if (mc != 7){
return;
}
res = GetResistForDamage(dmgType, isDoT);
pointRes = ResistStatEnumToName(res, true);
percRes = ResistStatEnumToName(res, false);
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(abilityName, atts);
i = 0;
while (i < atts.Size()){
if (pointRes == atts[i]){
dm.GetAbilityAttributeValue(abilityName, atts[i]
, min, max);
bonusReduct = CalculateAttributeValue(GetAttribu
teRandomizedValue(min, max), /* NOP */);
} else if (percRes == atts[i]){
dm.GetAbilityAttributeValue(abilityName, atts[i]

, min, max);
bonusResist = CalculateAttributeValue(GetAttribu
teRandomizedValue(min, max), /* NOP */);
}
i += 1;
}
/* NOP */;
}
}
class CAIGolemCombatLogicParams extends CAIMonsterCombatLogicParams{
public editable var projectileTemplate : CEntityTemplate;
public editable var attackRange : Float;
public function Init(){
attackRange = 10.000000;
/* NOP */;
}
}
class CAIGhulCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class SAnimShift{
}
class W3Mutagen25_Effect extends W3Mutagen_Effect{
private var attackPowerBonus : SAbilityAttributeValue;
public function GetAttackPowerBonus() : SAbilityAttributeValue{
return attackPowerBonus;
/* NOP */;
}
public function CacheSettings(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.CacheSettings();
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, PowerStatEnumToName(0), min, max);
attackPowerBonus = GetAttributeRandomizedValue(min, max);
/* NOP */;
}
}
class CAIWitchSoloCombatLogic extends CAIMonsterCombatLogic{
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcDeath extends CAIDeathTree{
public editable inlined var params : CAINpcDeathParams;
public function Init(){
params = new CAINpcDeathParams in this;
params.OnCreated();

/* NOP */;
}
}
class CAIMonsterDeathParams extends CAINpcDeathParams{
}
class CAIFlyingMonsterDeathParams extends CAIMonsterDeathParams{
}
class CAINpcReactionSearchTarget extends CAINpcReaction{
}
class CAINpcReactionJoinSearchForTarget extends CAINpcReaction{
}
class CAINpcReactionPlayWithTarget extends CAINpcReaction{
}
class CAINpcReactionMoveToLure extends CAINpcReaction{
}
class CAINpcReactionMoveOut extends CAINpcReaction{
}
class CAINpcReactionMoveInPack extends CAINpcReaction{
}
class CAINpcReactionRunWildInPack extends CAINpcReaction{
}
class CAINpcReactionLeadEscape extends CAINpcReaction{
}
class CAINpcReactionEscapeInPack extends CAINpcReaction{
}
class CAIScaredTree extends CAIScaredSubTree{
}
class CAINpcFistsDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcFistsCombat in this;
combatTree.OnCreated();
deathTree = new CAIDefeated in this;
deathTree.OnCreated();
/* NOP */;
}
}
class CAINpcFistsCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcFistsCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIDefeated extends CAIDeathTree{

public editable inlined var params : CAIDefeatedParams;


public function Init(){
params = new CAIDefeatedParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcFistsCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcFistsCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleFistsParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcFistsEasyDefaults extends CAINpcFistsDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcFistsEasyCombat in this;
combatTree.OnCreated();
deathTree = new CAIDefeated in this;
deathTree.OnCreated();
/* NOP */;
}
}
class CAINpcFistsEasyCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcFistsEasyCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcFistsEasyCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcFistsEasyCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcFistsEasyCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleFistsEasyParams in this;
params.OnCreated();
/* NOP */;

}
}
class CAINpcFistsHardDefaults extends CAINpcFistsDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcFistsHardCombat in this;
combatTree.OnCreated();
deathTree = new CAIDefeated in this;
deathTree.OnCreated();
/* NOP */;
}
}
class CAINpcFistsHardCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcFistsHardCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcFistsHardCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcFistsHardCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcFistsHardCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleFistsHardParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcGuardDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcGuardCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcGuardCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcGuardCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct CAITree{
}

class CAINpcGuardCombatParams extends CAINpcCombatParams{


private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedAnyCombatStyle in this)
;
combatStyles.PushBack(new CAINpcOneHandedAnyCombatStyle in this)
;
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTwoHandedAnyCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedAnyParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class IBehTreeNodeDefinition{
}
class CAINpcOneHandedAnyCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleOneHandedAnyParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CBehTree{
}
class CAINpcOneHandedDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcOneHandedCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
import abstract class CFormation{
}
struct SAlchemyRecipe{
var cookedItemName : CName;
var cookedItemType : EAlchemyCookedItemType;
var cookedItemIconPath : String;
var cookedItemQuantity : Int32;
var recipeName : CName;
var recipeIconPath : String;
var typeName : CName;
var level : Int32;
var requiredIngredients : array<SItemParts>;
}

class CAINpcOneHandedCombat extends CAINpcCombat{


public function Init(){
params = new CAINpcOneHandedCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct IBehTreeTaskDefinition{
//NULL type for listenToGameplayEvents
//NULL type for listenToAnimEvents
import protected final function ListenToAnimEvent(eventName : CName);
import protected final function ListenToGameplayEvent(eventName : CName)
;
public function Initialize(){
InitializeEvents();
/* NOP */;
}
public function Refactor(){
InitializeEvents();
/* NOP */;
}
public function InitializeEvents(){
listenToGameplayEvents.Clear();
listenToAnimEvents.Clear();
/* NOP */;
}
}
class CAINpcOneHandedCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcOneHandedSwordCombatStyle in thi
s);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcOneHandedSwordCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleOneHandedSwordParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedAxeDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcOneHandedAxeCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedAxeCombat extends CAINpcCombat{

public function Init(){


params = new CAINpcOneHandedAxeCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedAxeCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcOneHandedAxeCombatStyle in this)
;
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcOneHandedAxeCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleOneHandedAxeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedBluntDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcOneHandedBluntCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedBluntCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcOneHandedBluntCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcOneHandedBluntCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcOneHandedBluntCombatStyle in thi
s);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
state W3TutorialManagerUIHandlerStateAlchemy in W3TutorialManagerUIHandler exten
ds W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var INGREDIENTS : CName;
private const var COOKED_ITEM_DESC : CName;
private const var CATEGORIES : CName;

private const var SELECT_SOMETHING : CName;


private const var SELECT_THUNDERBOLT : CName;
private const var COOK : CName;
private const var POTIONS : CName;
private const var PREPARATION_GO_TO : CName;
private const var RECIPE_THUNDERBOLT : CName;
private const var POTIONS_JOURNAL : CName;
private var isClosing : Bool;
private var isForcedTunderbolt : Bool;
private var currentlySelectedRecipe : CName;
private var requiredRecipeName : CName;
private var selectRecipe : CName;
public function OnEnterState(prevStateName : CName) : Bool{
var highlights : array<STutorialHighlight>;
super.OnEnterState(prevStateName);
isClosing = false;
isForcedTunderbolt = FactsQuerySum("tut_forced_preparation") > 0
;
currentlySelectedRecipe = 'None';
if (isForcedTunderbolt){
requiredRecipeName = RECIPE_THUNDERBOLT;
selectRecipe = SELECT_THUNDERBOLT;
theGame.GetTutorialSystem().uiHandler.LockLeaveMenu(true
);
super.AddThunderBoltIngredients();
theGame.GetTutorialSystem().UnmarkMessageAsSeen(INGREDIE
NTS);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(COOKED_I
TEM_DESC);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(CATEGORI
ES);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(SELECT_T
HUNDERBOLT);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(COOK);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(POTIONS)
;
theGame.GetTutorialSystem().UnmarkMessageAsSeen(PREPARAT
ION_GO_TO);
} else {
selectRecipe = SELECT_SOMETHING;
}
highlights.Resize(1);
highlights[0].x = 0.410000;
highlights[0].y = 0.510000;
highlights[0].width = 0.270000;
highlights[0].height = 0.130000;
ShowHint(INGREDIENTS, theGame.params.TUT_POS_ALCHEMY_X, theGame.
params.TUT_POS_ALCHEMY_Y, /* NOP */, highlights, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(INGREDIENTS);
CloseHint(COOKED_ITEM_DESC);
CloseHint(CATEGORIES);
CloseHint(selectRecipe);
CloseHint(COOK);
CloseHint(POTIONS);
CloseHint(PREPARATION_GO_TO);
theGame.GetTutorialSystem().MarkMessageAsSeen(INGREDIENTS);

if (isForcedTunderbolt){
theGame.GetTutorialSystem().uiHandler.UnregisterUIHint('
Alchemy', /* NOP */);
theGame.GetTutorialSystem().uiHandler.UnregisterUIHint('
Alchemy', /* NOP */);
} else {
FactsRemove("tutorial_alch_has_ings");
}
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == INGREDIENTS){
highlights.Resize(1);
highlights[0].x = 0.680000;
highlights[0].y = 0.130000;
highlights[0].width = 0.250000;
highlights[0].height = 0.500000;
ShowHint(COOKED_ITEM_DESC, theGame.params.TUT_POS_ALCHEM
Y_X, 0.650000, /* NOP */, highlights, /* NOP */, /* NOP */);
} else if (hintName == COOKED_ITEM_DESC){
highlights.Resize(1);
highlights[0].x = 0.065000;
highlights[0].y = 0.150000;
highlights[0].width = 0.350000;
highlights[0].height = 0.650000;
ShowHint(CATEGORIES, theGame.params.TUT_POS_ALCHEMY_X, t
heGame.params.TUT_POS_ALCHEMY_Y, /* NOP */, highlights, /* NOP */, /* NOP */);
} else if (hintName == CATEGORIES){
if (currentlySelectedRecipe == requiredRecipeName){
ShowHint(COOK, theGame.params.TUT_POS_ALCHEMY_X,
theGame.params.TUT_POS_ALCHEMY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else {
ShowHint(selectRecipe, theGame.params.TUT_POS_AL
CHEMY_X, theGame.params.TUT_POS_ALCHEMY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
} else if (hintName == POTIONS){
CloseHint(POTIONS);
ShowHint(PREPARATION_GO_TO, theGame.params.TUT_POS_ALCHE
MY_X, theGame.params.TUT_POS_ALCHEMY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
if (isForcedTunderbolt){
thePlayer.UnblockAction(2, 'tut_forced_preparati
on');
}
}
/* NOP */;
}
public final function SelectedRecipe(recipeName : CName, canCook : Bool)
{
currentlySelectedRecipe = recipeName;
if (IsCurrentHint(selectRecipe) && IsRecipeOk(recipeName, canCoo
k)){
CloseHint(selectRecipe);
ShowHint(COOK, theGame.params.TUT_POS_ALCHEMY_X, theGame
.params.TUT_POS_ALCHEMY_Y, 3, /* NOP */, /* NOP */, /* NOP */);

} else if (IsCurrentHint(COOK) && !IsRecipeOk(recipeName, canCoo


k)){
CloseHint(COOK);
ShowHint(selectRecipe, theGame.params.TUT_POS_ALCHEMY_X,
theGame.params.TUT_POS_ALCHEMY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private final function IsRecipeOk(recipeName : CName, canCook : Bool) :
Bool{
if (isForcedTunderbolt){
return recipeName == requiredRecipeName;
} else {
return canCook;
}
/* NOP */;
}
public final function CookedItem(recipeName : CName){
if (isForcedTunderbolt && recipeName != requiredRecipeName){
AddThunderBoltIngredients();
} else {
isClosing = true;
CloseHint(INGREDIENTS);
CloseHint(COOKED_ITEM_DESC);
CloseHint(CATEGORIES);
CloseHint(selectRecipe);
CloseHint(COOK);
isClosing = false;
ShowHint(POTIONS, theGame.params.TUT_POS_ALCHEMY_X, theG
ame.params.TUT_POS_ALCHEMY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().ActivateJournalEntry(POTIONS
_JOURNAL);
}
/* NOP */;
}
private final function AddThunderBoltIngredients(){
var i : Int32;
var k : Int32;
var currQuantity : Int32;
var addQuantity : Int32;
var tmpInt : Int32;
var tmpName : CName;
var witcher : W3PlayerWitcher;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var memoryWaste : array<CName>;
witcher = GetWitcherPlayer();
memoryWaste = witcher.GetAlchemyRecipes();
if (!memoryWaste.Contains(RECIPE_THUNDERBOLT)){
witcher.AddAlchemyRecipe(RECIPE_THUNDERBOLT, /* NOP */,
/* NOP */);
}
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('alchemy_recipes');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
if (tmpName == RECIPE_THUNDERBOLT){

ingredients = dm.GetCustomDefinitionSubNode(main
.subNodes[i], 'ingredients');
k = 0;
while (k < ingredients.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(ingre
dients.subNodes[k], 'item_name', tmpName);
dm.GetCustomNodeAttributeValueInt(ingred
ients.subNodes[k], 'quantity', tmpInt);
currQuantity = witcher.inv.GetItemQuanti
tyByName(tmpName, /* NOP */);
addQuantity = tmpInt - currQuantity;
if (addQuantity > 0){
witcher.inv.AddAnItem(tmpName, a
ddQuantity, /* NOP */, /* NOP */, /* NOP */);
}
k += 1;
}
break;
}
i += 1;
}
/* NOP */;
}
}
class CAINpcOneHandedBluntCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleOneHandedBluntParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedHammerDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcTwoHandedHammerCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
state W3TutorialManagerUIHandlerStateAlchemyMutagens in W3TutorialManagerUIHandl
er extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var MUTAGENS : CName;
private var currentlySelectedRecipe : CName;
private var requiredRecipeName : CName;
private var selectRecipe : CName;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
currentlySelectedRecipe = 'None';
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CloseHint(MUTAGENS);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :

Bool) : Bool{
QuitState();
/* NOP */;
}
public final function CookedItem(recipeName : CName){
if (theGame.GetDefinitionsManager().IsRecipeForMutagenPotion(rec
ipeName)){
ShowHint(MUTAGENS, theGame.params.TUT_POS_ALCHEMY_X, the
Game.params.TUT_POS_ALCHEMY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
}
class CAINpcTwoHandedHammerCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTwoHandedHammerCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedHammerCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedHammerCombatStyle in th
is);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTwoHandedHammerCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedHammerParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedAxeDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcTwoHandedAxeCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedAxeCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTwoHandedAxeCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedAxeCombatParams extends CAINpcCombatParams{

private function SetupCombatStyles(){


combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedAxeCombatStyle in this)
;
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTwoHandedAxeCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedAxeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedHalberdDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcTwoHandedHalberdCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedHalberdCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTwoHandedHalberdCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedHalberdCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedHalberdCombatStyle in t
his);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTwoHandedHalberdCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedHalberdParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedSpearDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcTwoHandedSpearCombat in this;

combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedSpearCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTwoHandedSpearCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedSpearCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedSpearCombatStyle in thi
s);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTwoHandedSpearCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedSpearParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcPitchforkDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcPitchforkCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
statemachine class CBirdsManager extends CGameplayEntity{
public editable var birdsSpawnPointsTag : CName;
public editable var birdType : EBirdType;
public editable var spawnRange : Float;
public editable var customBirdTemplate : CEntityTemplate;
public editable var respawnDelay : Float;
public editable var respawnMinDistance : Float;
public editable var spawnOnlyInsideBirdsArea : Bool;
private var birdSpawnpoints : array<SBirdSpawnpoint>;
private var shouldBirdsFly : Bool;
private var despawnTime : Float;
private var wasEverVisible : Bool;
private var birdArea : CTriggerAreaComponent;
public var birdTemplate : CEntityTemplate;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
super.OnSpawned(spawnData);
/* NOP */;

}
public function OnDetaching() : Bool{
var i : Int32;
i = 0;
while (i < birdSpawnpoints.Size()){
if (birdSpawnpoints[i].bird){
birdSpawnpoints[i].bird.Destroy();
}
i += 1;
}
/* NOP */;
}
public function SetBirdArea(area : CTriggerAreaComponent){
birdArea = area;
/* NOP */;
}
private function GetBirdAreaInRange(range : Float) : CTriggerAreaCompone
nt{
var i : Int32;
var birdsAreaEntity : CBirdsArea;
var entitites : array<CGameplayEntity>;
var area : CTriggerAreaComponent;
FindGameplayEntitiesInRange(entitites, this, range, 1000, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < entitites.Size()){
birdsAreaEntity = (CBirdsArea)entitites[i];
if (birdsAreaEntity){
area = (CTriggerAreaComponent)birdsAreaEntity.Ge
tComponentByClassName('CTriggerAreaComponent');
if (area.TestEntityOverlap(this)){
return area;
}
}
i += 1;
}
return NULL;
/* NOP */;
}
public function OnBirdDestroyed(b : W3Bird){
var i : Int32;
i = 0;
while (i < birdSpawnpoints.Size()){
if (birdSpawnpoints[i].bird == b){
birdSpawnpoints[i].bird = NULL;
birdSpawnpoints[i].entityId = 0;
birdSpawnpoints[i].entitySpawnTimestamp = 0.0000
00;
birdSpawnpoints[i].isFlying = false;
break;
}
i += 1;
}
i = 0;
while (i < birdSpawnpoints.Size()){
if (birdSpawnpoints[i].bird){
return;
}
i += 1;
}

despawnTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function FlyBirds(){
var i : Int32;
var notFlyingBirds : Int32;
notFlyingBirds = 0;
if (birdSpawnpoints.Size() > 0){
i = 0;
while (i < birdSpawnpoints.Size()){
if (!birdSpawnpoints[i].isFlying){
if (spawnOnlyInsideBirdsArea && !birdAre
a.TestEntityOverlap(birdSpawnpoints[i].bird)){
} else {
if (birdSpawnpoints[i].bird){
birdSpawnpoints[i].isFly
ing = birdSpawnpoints[i].bird.Fly();
}
if (!birdSpawnpoints[i].isFlying
){
notFlyingBirds += 1;
}
}
}
i += 1;
}
} else {
notFlyingBirds += 1;
}
shouldBirdsFly = notFlyingBirds > 0;
/* NOP */;
}
public function SpawnBirds(forced : Bool){
var i : Int32;
var size : Int32;
var x : Float;
var y : Float;
var isVisible : Bool;
var bird : W3Bird;
var spawnPos : Vector;
var normal : Vector;
var traceResult : Bool;
var createEntityHelper : CCreateEntityHelper;
if (!forced){
if (theGame.GetEngineTimeAsSeconds() < respawnDelay + de
spawnTime){
return;
}
if (VecDistance(GetWorldPosition(), theCamera.GetCameraP
osition()) < respawnMinDistance){
return;
}
}
UpdateSpawnPointsList();
size = birdSpawnpoints.Size();
i = 0;
while (i < size){
if (!birdSpawnpoints[i].bird){
if (birdSpawnpoints[i].entityId == 0){
if (!forced){

isVisible = theCamera.WorldVecto
rToViewRatio(birdSpawnpoints[i].position, x, y);
if (isVisible && AbsF(x) > 1.100
000 && AbsF(y) > 1.100000){
isVisible = false;
}
}
if (!isVisible || forced && VecDistance(
birdSpawnpoints[i].position, theCamera.GetCameraPosition()) < spawnRange){
traceResult = theGame.GetWorld()
.StaticTrace(birdSpawnpoints[i].position, birdSpawnpoints[i].position - Vector(0
, 0, 255), spawnPos, normal, /* NOP */);
if (traceResult == false){
spawnPos = birdSpawnpoin
ts[i].position;
}
createEntityHelper = new CCreate
EntityHelper;
createEntityHelper.SetPostAttach
edCallback(this, 'OnBirdEntityAttached');
birdSpawnpoints[i].entitySpawnTi
mestamp = theGame.GetEngineTimeAsSeconds();
birdSpawnpoints[i].entityId = th
eGame.CreateEntityAsync(createEntityHelper, birdTemplate, spawnPos, birdSpawnpoi
nts[i].rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else if (theGame.GetEngineTimeAsSeconds() - bi
rdSpawnpoints[i].entitySpawnTimestamp >= 10.000000){
birdSpawnpoints[i].entityId = 0;
birdSpawnpoints[i].entitySpawnTimestamp
= 0.000000;
}
}
i += 1;
}
/* NOP */;
}
public function OnBirdEntityAttached(birdEntity : CEntity){
var bird : W3Bird;
var i : Int32;
var size : Int32;
var success : Bool;
success = false;
bird = (W3Bird)birdEntity;
if (bird){
size = birdSpawnpoints.Size();
i = 0;
while (i < size){
if (birdSpawnpoints[i].entityId == bird.GetGuidH
ash()){
bird.SetBirdManager(this);
birdSpawnpoints[i].bird = bird;
birdSpawnpoints[i].isFlying = false;
success = true;
break;
}
i += 1;
}
}
if (!success){

birdEntity.Destroy();
}
/* NOP */;
}
private function UpdateSpawnPointsList(){
var spawnstruct : SBirdSpawnpoint;
var nodes : array<CNode>;
var spawnpoint : CBirdSpawnpoint;
var collisionPos : Vector;
var testVec : Vector;
var normal : Vector;
var world : CWorld;
var i : Int32;
var j : Int32;
var lastExistingSpawnPoint : Int32;
var exists : Bool;
var foundSpawnpoints : array<Int32>;
var collisionGroups : array<CName>;
if (spawnOnlyInsideBirdsArea && !birdArea){
SetBirdArea(GetBirdAreaInRange(spawnRange));
}
lastExistingSpawnPoint = birdSpawnpoints.Size() - 1;
theGame.GetNodesByTag(birdsSpawnPointsTag, nodes);
world = theGame.GetWorld();
collisionGroups.PushBack('Terrain');
collisionGroups.PushBack('Static');
collisionGroups.PushBack('Debris');
collisionGroups.PushBack('Ragdoll');
collisionGroups.PushBack('Destructible');
collisionGroups.PushBack('RigidBody');
collisionGroups.PushBack('Foliage');
collisionGroups.PushBack('Boat');
collisionGroups.PushBack('BoatDocking');
collisionGroups.PushBack('Door');
collisionGroups.PushBack('Platforms');
collisionGroups.PushBack('Corpse');
collisionGroups.PushBack('Fence');
i = 0;
while (i < nodes.Size()){
spawnpoint = (CBirdSpawnpoint)nodes[i];
if (spawnpoint){
if (birdArea && !birdArea.TestEntityOverlap(spaw
npoint)){
} else if (VecDistance(spawnpoint.GetWorldPositi
on(), GetWorldPosition()) < spawnRange){
spawnstruct.position = spawnpoint.GetWor
ldPosition();
testVec = Vector(0, 0, 1);
if (world.StaticTrace(spawnstruct.positi
on, spawnstruct.position - testVec, collisionPos, normal, collisionGroups)){
spawnstruct.position = collision
Pos;
} else if (world.StaticTrace(spawnstruct
.position, spawnstruct.position + testVec, collisionPos, normal, collisionGroups
)){
spawnstruct.position = collision
Pos;
}
exists = false;
j = 0;

while (j <= lastExistingSpawnPoint){


if (birdSpawnpoints[j].position
== spawnstruct.position){
foundSpawnpoints.PushBac
k(j);
exists = true;
break;
}
j += 1;
}
if (!exists){
spawnstruct.rotation = spawnpoin
t.GetWorldRotation();
birdSpawnpoints.PushBack(spawnst
ruct);
}
}
}
i += 1;
}
i = lastExistingSpawnPoint;
while (i >= 0){
exists = false;
j = 0;
while (j < foundSpawnpoints.Size()){
if (i == foundSpawnpoints[j]){
exists = true;
foundSpawnpoints.Erase(j);
break;
}
j += 1;
}
if (!exists){
birdSpawnpoints.Erase(i);
}
i -= 1;
}
/* NOP */;
}
private function DespawnBirds(){
var i : Int32;
i = 0;
while (i < birdSpawnpoints.Size()){
if (birdSpawnpoints[i].bird){
birdSpawnpoints[i].bird.Destroy();
}
birdSpawnpoints[i].entityId = 0;
birdSpawnpoints[i].entitySpawnTimestamp = 0.000000;
birdSpawnpoints[i].isFlying = false;
i += 1;
}
/* NOP */;
}
public function OnDestroyed() : Bool{
DespawnBirds();
RemoveTimer('BirdsSpawnCheck', /* NOP */);
/* NOP */;
}
protected function ShouldBirdsSpawnCheckBeActive() : Bool{
var dist2 : Float;

var pos : Vector;


var camPos : Vector;
var checkRange : Float;
pos = GetWorldPosition();
camPos = theCamera.GetCameraPosition();
dist2 = VecDistanceSquared(pos, camPos);
checkRange = spawnRange * 3.000000;
return dist2 <= checkRange * checkRange;
/* NOP */;
}
protected function StartBirdsSpawnCheck(){
var timerUpdateDT : Float;
timerUpdateDT = RandRangeF(0.700000, 0.300000);
AddTimer('BirdsSpawnCheck', timerUpdateDT, true, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
RemoveTimer('BirdsSpawnPreCheck', /* NOP */);
/* NOP */;
}
protected function StartBirdsSpawnPreCheck(){
var timerUpdateDT : Float;
timerUpdateDT = RandRangeF(5.000000, 2.000000);
AddTimer('BirdsSpawnPreCheck', timerUpdateDT, true, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
RemoveTimer('BirdsSpawnCheck', /* NOP */);
/* NOP */;
}
public timer function BirdsSpawnCheck(optional td : Float, optional id :
Int32){
var x : Float;
var y : Float;
var dist2 : Float;
var i : Int32;
var pos : Vector;
var isVisible : Bool;
var areBirdsSpawned : Bool;
var bspSize : Int32;
pos = GetWorldPosition();
isVisible = theCamera.WorldVectorToViewRatio(pos, x, y);
x = AbsF(x);
y = AbsF(y);
if (isVisible && x >= 1.100000 || y >= 1.100000){
isVisible = false;
}
if (isVisible){
wasEverVisible = true;
}
if (!isVisible){
dist2 = VecDistanceSquared(pos, theCamera.GetCameraPosit
ion());
areBirdsSpawned = false;
bspSize = birdSpawnpoints.Size();
i = 0;
while (i < bspSize){
if (birdSpawnpoints[i].bird){
areBirdsSpawned = true;
break;
}
i += 1;
}
if (areBirdsSpawned){

if (wasEverVisible && dist2 > spawnRange * spawn


Range){
DespawnBirds();
}
} else if (x < 1.300000 || y < 1.300000 && dist2 <= spaw
nRange * spawnRange){
SpawnBirds(/* NOP */);
}
}
if (shouldBirdsFly){
FlyBirds();
}
if (!areBirdsSpawned && !ShouldBirdsSpawnCheckBeActive()){
StartBirdsSpawnPreCheck();
}
/* NOP */;
}
public timer function BirdsSpawnPreCheck(optional td : Float, optional i
d : Int32){
if (ShouldBirdsSpawnCheckBeActive()){
StartBirdsSpawnCheck();
}
/* NOP */;
}
}
class CAINpcPitchforkCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcPitchforkCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcPitchforkCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcPitchforkCombatStyle in this);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcPitchforkCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStylePitchforkParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcShieldDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcShieldCombat in this;
combatTree.OnCreated();
/* NOP */;
}

}
class CAINpcShieldCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcShieldCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcShieldCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcShieldCombatStyle in this);
combatStyles.PushBack(new CAINpcOneHandedAnyCombatStyle in this)
;
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcShieldCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleShieldParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CNode{
import public final function GetName() : String;
import public final function GetLocalPosition() : Vector;
import public final function GetLocalRotation() : EulerAngles;
import public final function GetLocalScale() : Vector;
import public final function GetLocalToWorld() : Matrix;
import public final function GetWorldPosition() : Vector;
import public final function GetWorldRotation() : EulerAngles;
import public final function GetWorldForward() : Vector;
import public final function GetWorldRight() : Vector;
import public final function GetWorldUp() : Vector;
import public final function GetHeading() : Float;
import public final function GetHeadingVector() : Vector;
import public final function HasTag(tag : CName) : Bool;
import public final function GetTags() : array<CName>;
import public final function SetTags(tags : array<CName>);
import public final function GetTagsString() : String;
public function AddTag(tag : CName){
var tags : array<CName>;
tags = super.GetTags();
ArrayOfNamesPushBackUnique(tags, tag);
super.SetTags(tags);
/* NOP */;
}
}
class CAINpcBowDefaults extends CAINpcDefaults{
public function Init(){
super.Init();

combatTree = new CAINpcBowCombat in this;


combatTree.Init();
/* NOP */;
}
}
struct SBirdSpawnpoint{
var isBirdSpawned : Bool;
var isFlying : Bool;
var entityId : Int32;
var entitySpawnTimestamp : Float;
var bird : W3Bird;
var position : Vector;
var rotation : EulerAngles;
}
class CAINpcBowCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcBowCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcBowCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcBowCombatStyle in this);
combatStyles.PushBack(new CAINpcBowmanMeleeCombatStyle in this);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
preferedCombatStyle = 15;
/* NOP */;
}
}
class CAINpcBowCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleBowParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcBowmanMeleeCombatStyle extends CAINpcCombatStyle{
public function Init(){
var i : Int32;
super.Init();
params = new CAINpcStyleBowmanMeleeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCrossbowDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcCrossbowCombat in this;
combatTree.Init();

/* NOP */;
}
}
class CAINpcCrossbowCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcCrossbowCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CBirdsArea extends CGameplayEntity{
public editable var birdsManagerTag : CName;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var activatorActor : CActor;
var activatorProjectile : CThrowable;
var i : Int32;
var birdsManager : CBirdsManager;
var birdManagers : array<CNode>;
activatorActor = (CActor)activator.GetEntity();
activatorProjectile = (CThrowable)activator.GetEntity();
if (activatorActor || activatorProjectile){
theGame.GetNodesByTag(birdsManagerTag, birdManagers);
i = 0;
while (i < birdManagers.Size()){
birdsManager = (CBirdsManager)birdManagers[i];
if (birdsManager && area.TestEntityOverlap(birds
Manager)){
birdsManager.FlyBirds();
}
i += 1;
}
}
/* NOP */;
}
}
class CAINpcCrossbowCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcCrossbowCombatStyle in this);
combatStyles.PushBack(new CAINpcBowmanMeleeCombatStyle in this);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
preferedCombatStyle = 16;
/* NOP */;
}
}
class CAINpcCrossbowCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleCrossbowParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAINpcTwoHandedSwordDefaults extends CAINpcDefaults{


public function Init(){
super.Init();
combatTree = new CAINpcTwoHandedSwordCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcTwoHandedSwordCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTwoHandedSwordCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTwoHandedSwordCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedSwordCombatStyle in thi
s);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
preferedCombatStyle = 8;
/* NOP */;
}
}
class CAINpcTwoHandedSwordCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleTwoHandedSwordParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIHjalmarDefaults extends CAINpcDefaults{
public function Init(){
var hjalmarStyle : CAINpcCombatStyle;
OnCreated();
combatTree.params.combatStyles.Clear();
hjalmarStyle = new CAINpcCombatStyle in this;
hjalmarStyle.OnCreated();
hjalmarStyle.params = new CAINpcStyleHjalmarParams in this;
hjalmarStyle.params.OnCreated();
combatTree.params.combatStyles.PushBack(hjalmarStyle);
hjalmarStyle = new CAINpcCombatStyle in this;
hjalmarStyle.OnCreated();
hjalmarStyle.params = new CAINpcStyleFistsHardParams in this;
hjalmarStyle.params.OnCreated();
combatTree.params.combatStyles.PushBack(hjalmarStyle);
/* NOP */;
}
}
class CBirdSpawnpoint extends CEntity{
}

class CAINpcStyleHjalmarParams extends CAINpcStyleOneHandedSwordParams{


}
class CAINpcStyleFistsHardParams extends CAINpcFistsCombatStyleBaseParams{
public function Init(){
super.Init();
attackBehavior.params.attackAction = new CAIComboFistAttackActio
nTree in this;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.farAttackAction = new CAISimpleAttackActio
nTree in this;
attackBehavior.params.farAttackAction.OnCreated();
/* NOP */;
}
}
class CAINpcWitcherDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcWitcherCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
import abstract class SEntitySpawnData{
//NULL type for restored
}
class CAINpcWitcherCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcWitcherCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct CEntity{
import public final function AddTimer(timerName : CName, period : Float,
repeats : Bool, scatter : Bool, group : ETickGroup, saveable : Bool, overrideEx
isting : Bool) : Int32;
import public final function AddGameTimeTimer(timerName : CName, period
: GameTime, repeats : Bool, scatter : Bool, group : ETickGroup, saveable : Bool,
overrideExisting : Bool) : Int32;
import public final function RemoveTimer(timerName : CName, group : ETic
kGroup);
import public final function RemoveTimerById(id : Int32, group : ETickGr
oup);
import public final function RemoveTimers();
import public final function Destroy();
import public final function Teleport(position : Vector);
import public final function TeleportWithRotation(position : Vector, rot
ation : EulerAngles);
import public final function TeleportToNode(node : CNode, applyRotation
: Bool) : Bool;
import public function GetComponent(compName : String) : CComponent;
import public function GetComponentByClassName(className : CName) : CCom
ponent;
import public function GetComponentsByClassName(className : CName) : arr
ay<CComponent>;

import public function GetComponentByUsedBoneName(boneIndex : Int32) : a


rray<CComponent>;
import public function GetComponentsCountByClassName(className : CName)
: Int32;
import public final function RaiseEvent(eventName : CName) : Bool;
import public final function RaiseForceEvent(eventName : CName) : Bool;
import public final function RaiseEventWithoutTestCheck(eventName : CNam
e) : Bool;
import public final function RaiseForceEventWithoutTestCheck(eventName :
CName) : Bool;
import public final function GetBoneIndex(bone : CName) : Int32;
import public final function GetBoneWorldMatrixByIndex(boneIndex : Int32
) : Matrix;
import public final function GetBoneReferenceMatrixMS(boneIndex : Int32)
: Matrix;
import public final function GetMoveTarget() : Vector;
import public final function GetMoveHeading() : Float;
import public final function GetRootAnimatedComponent() : CAnimatedCompo
nent;
import public final latent function PreloadBehaviorsToActivate(names : a
rray<CName>) : Bool;
import public final latent function ActivateBehaviors(names : array<CNam
e>) : Bool;
import public final function ActivateBehaviorsSync(names : array<CName>)
: Bool;
import public final latent function ActivateAndSyncBehavior(names : CNam
e, timeout : Float) : Bool;
import public final latent function ActivateAndSyncBehaviors(names : arr
ay<CName>, timeout : Float) : Bool;
import public final latent function AttachBehavior(instanceName : CName)
: Bool;
import public final function AttachBehaviorSync(instanceName : CName) :
Bool;
import public final function DetachBehavior(instanceName : CName) : Bool
;
import public final function SetBehaviorVariable(varName : CName, varVal
ue : Float, inAllInstances : Bool) : Bool;
import public final function GetBehaviorVariable(varName : CName, defaul
tValue : Float) : Float;
import public final function SetBehaviorVectorVariable(varName : CName,
varValue : Vector, inAllInstances : Bool) : Bool;
import public final function GetBehaviorVectorVariable(varName : CName)
: Vector;
import public final function GetBehaviorGraphInstanceName(index : Int32)
: CName;
import public function PlayEffect(effectName : CName, target : CNode) :
Bool;
import public function PlayEffectOnBone(effectName : CName, boneName : C
Name, target : CNode) : Bool;
import public function SetAutoEffect(effectName : CName) : Bool;
import public function StopEffect(effectName : CName) : Bool;
import public function DestroyEffect(effectName : CName) : Bool;
import public function StopAllEffects();
import public function DestroyAllEffects();
import public function HasEffect(effectName : CName) : Bool;
import public function SoundEvent(eventName : String, boneName : CName,
isSlot : Bool);
import public function SoundSwitch(swichGroupName : String, stateName :
String, boneName : CName, isSlot : Bool);
import public function SoundParameter(parameterName : String, value : Fl

oat, boneName : CName, duration : Float, isSlot : Bool);


import public function SoundIsActiveAny() : Bool;
import public function SoundIsActiveName(eventName : CName) : Bool;
import public function SoundIsActive(boneName : CName, isSlot : Bool) :
Bool;
import public function PreloadEffect(effectName : CName) : Bool;
import public function PreloadEffectForAnimation(animName : CName) : Boo
l;
import public final function Fade(fadeIn : Bool);
import public function CreateAttachment(parentEntity : CEntity, slot : C
Name, relativePosition : Vector, relativeRotation : EulerAngles) : Bool;
import public function CreateAttachmentAtBoneWS(parentEntity : CEntity,
bone : CName, worldLocation : Vector, worldRotation : EulerAngles) : Bool;
import public function BreakAttachment() : Bool;
import public function HasAttachment() : Bool;
import public function HasSlot(slotName : CName, recursive : Bool) : Boo
l;
import public function CreateChildAttachment(child : CNode, slot : CName
) : Bool;
import public function BreakChildAttachment(child : CNode, slot : CName)
: Bool;
import public function HasChildAttachment(child : CNode) : Bool;
import public final function CalcEntitySlotMatrix(slot : CName, slotMatr
ix : Matrix) : Bool;
import public function SetEffectIntensity(effectName : CName, intensity
: Float, specificComponentName : CName, effectParameterName : CName);
import public function SetKinematic(enable : Bool);
import public function SetStatic();
import public function IsRagdolled() : Bool;
import public function IsStatic() : Bool;
import public function I_GetDisplayName() : String;
import public function IsEffectActive(effectName : CName, treatStoppingA
sActive : Bool) : Bool;
import public final function Duplicate(placeOnLayer : CLayer) : CEntity;
import public final function SetHideInGame(hide : Bool);
import public function GetGuidHash() : Int32;
import public function CalcBoundingBox(box : Box);
import public final function HasTagInLayer(tag : CName) : Bool;
import public final latent function WaitForEventProcessing(eventName : C
Name, timeout : Float) : Bool;
import public final latent function WaitForBehaviorNodeActivation(activa
tionName : CName, timeout : Float) : Bool;
import public final latent function WaitForBehaviorNodeDeactivation(deac
tivationName : CName, timeout : Float) : Bool;
import public final function BehaviorNodeDeactivationNotificationReceive
d(deactivationName : CName) : Bool;
import public final latent function WaitForAnimationEvent(animEventName
: CName, timeout : Float) : Bool;
public function OnBehaviorGraphNotification(notificationName : CName, st
ateName : CName) : Bool{
}
public final function GetBoneWorldPosition(boneName : CName) : Vector{
var boneIdx : Int32;
var boneMatrix : Matrix;
boneIdx = GetBoneIndex(boneName);
if (boneIdx != -1){
boneMatrix = GetBoneWorldMatrixByIndex(boneIdx);
return MatrixGetTranslation(boneMatrix);
}
return Vector(0, 0, 0, 1);

/* NOP */;
}
public final function GetBoneWorldPositionByIndex(boneIndex : Int32) : V
ector{
var boneMatrix : Matrix;
if (boneIndex != -1){
boneMatrix = GetBoneWorldMatrixByIndex(boneIndex);
return MatrixGetTranslation(boneMatrix);
}
return Vector(0, 0, 0, 1);
/* NOP */;
}
public final function GetBoneWorldRotationByIndex(boneIndex : Int32) : E
ulerAngles{
var boneMatrix : Matrix;
if (boneIndex != -1){
boneMatrix = GetBoneWorldMatrixByIndex(boneIndex);
return MatrixGetRotation(boneMatrix);
}
return EulerAngles(0, 0, 0);
/* NOP */;
}
public final function GetBoneWorldPositionAndRotationByIndex(boneIndex :
Int32, position : Vector, rotation : EulerAngles){
var boneMatrix : Matrix;
if (boneIndex != -1){
boneMatrix = GetBoneWorldMatrixByIndex(boneIndex);
position = MatrixGetTranslation(boneMatrix);
rotation = MatrixGetRotation(boneMatrix);
} else {
position = Vector(0, 0, 0, 1);
rotation = EulerAngles(0, 0, 0);
}
/* NOP */;
}
public final function GetBoneWorldMatrix(boneName : CName) : Matrix{
var boneIdx : Int32;
var boneMatrix : Matrix;
boneIdx = GetBoneIndex(boneName);
if (boneIdx != -1){
boneMatrix = GetBoneWorldMatrixByIndex(boneIdx);
}
return boneMatrix;
/* NOP */;
}
public function PlayEffectSingle(effectName : CName, target : CNode) : B
ool{
if (!IsEffectActive(effectName, false)){
return PlayEffect(effectName, target);
}
return false;
/* NOP */;
}
public function StopEffectIfActive(effectName : CName) : Bool{
if (IsEffectActive(effectName, false)){
return StopEffect(effectName);
}
return false;
/* NOP */;
}

public function OnSpawned(spawnData : SEntitySpawnData) : Bool{


}
public function OnCanCreateParentAttachment(parentEntity : CEntity) : Bo
ol{
return true;
/* NOP */;
}
public function OnCanBreakParentAttachment(parentEntity : CEntity) : Boo
l{
return true;
/* NOP */;
}
public function OnCanCreateChildAttachment(childEntity : CEntity) : Bool
{
return true;
/* NOP */;
}
public function OnCanBreakChildAttachment(childEntity : CEntity) : Bool{
return true;
/* NOP */;
}
public function OnParentAttachmentCreated(parentEntity : CEntity) : Bool
{
}
public
}
public
}
public
}
public

function OnParentAttachmentBroken(parentEntity : CEntity) : Bool{


function OnChildAttachmentCreated(childEntity : CEntity) : Bool{
function OnChildAttachmentBroken(childEntity : CEntity) : Bool{
function GetReadableName() : String{
var s1 : String;
var s2 : String;
if (StrSplitLast(ToString(), "::", s1, s2)){
return s2;
} else {
return ToString();
}
/* NOP */;

}
public function ApplyAppearance(appearanceName : String){
var comp : CAppearanceComponent;
comp = (CAppearanceComponent)GetComponentByClassName('CAppearanc
eComponent');
if (comp){
comp.ApplyAppearance(appearanceName);
}
/* NOP */;
}
public function DestroyAfter(time : Float){
super.AddTimer('DestroyTimer', time, false, /* NOP */, /* NOP */
, true, /* NOP */);
/* NOP */;
}
public function StopAllEffectsAfter(time : Float){
super.AddTimer('StopAllEffectsTimer', time, false, /* NOP */, /*
NOP */, true, /* NOP */);
/* NOP */;
}
private timer function DestroyTimer(optional delta : Float, optional id

: Int32){
super.Destroy();
/* NOP */;
}
private timer function StopAllEffectsTimer(optional delta : Float, optio
nal id : Int32){
StopAllEffects();
/* NOP */;
}
public final function RemoveTag(tag : CName){
var tags : array<CName>;
tags = GetTags();
tags.Remove(tag);
SetTags(tags);
/* NOP */;
}
protected function SnapComponentByName(componentName : CName, maxHeightD
own : Float, maxHeightUp : Float, collisionNames : array<CName>, newPos : Vector
) : Bool{
var component : CComponent;
var entityPos : Vector;
var componentPos : Vector;
var testUpPos : Vector;
var testDownPos : Vector;
var collisionNormal : Vector;
component = GetComponent(componentName);
if (!component){
LogAssert(false, "CEntity.SnapComponentToTerrain: cannot
snap component <<" + componentName + ">> - cannot find component with such name
");
newPos = Vector(0, 0, 0);
return false;
}
entityPos = GetWorldPosition();
componentPos = entityPos + component.GetLocalPosition();
testUpPos = componentPos;
testUpPos.Z += maxHeightUp;
testDownPos = componentPos;
testDownPos.Z -= maxHeightDown;
if (theGame.GetWorld().StaticTrace(componentPos, testDownPos, ne
wPos, collisionNormal, collisionNames)){
component.SetPosition(newPos - entityPos);
return true;
} else if (theGame.GetWorld().StaticTrace(componentPos, testUpPo
s, newPos, collisionNormal, collisionNames)){
component.SetPosition(newPos - entityPos);
return true;
}
newPos = Vector(0, 0, -1000);
component.SetPosition(newPos);
return false;
/* NOP */;
}
protected function SnapComponent(component : CComponent, maxHeightDown :
Float, maxHeightUp : Float, collisionNames : array<CName>, newPos : Vector) : B
ool{
var entityPos : Vector;
var componentPos : Vector;
var testUpPos : Vector;
var testDownPos : Vector;

var collisionNormal : Vector;


if (!component){
LogAssert(false, "CEntity.SnapComponentToTerrain: cannot
snap component <<" + component + ">> - cannot find component!");
newPos = Vector(0, 0, 0);
return false;
}
entityPos = GetWorldPosition();
componentPos = entityPos + component.GetLocalPosition();
testUpPos = componentPos;
testUpPos.Z += maxHeightUp;
testDownPos = componentPos;
testDownPos.Z -= maxHeightDown;
if (theGame.GetWorld().StaticTrace(componentPos, testDownPos, ne
wPos, collisionNormal, collisionNames)){
component.SetPosition(newPos);
return true;
} else if (theGame.GetWorld().StaticTrace(componentPos, testUpPo
s, newPos, collisionNormal, collisionNames)){
component.SetPosition(newPos);
return true;
}
newPos = Vector(0, 0, 0);
return false;
/* NOP */;
}
}
class CAINpcWitcherCombatParams extends CAINpcCombatParams{
protected function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcWitcherCombatStyle in this);
combatStyles.PushBack(new CAINpcFistsCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
import abstract class CEntityOnLayerReference{
}
class CAINpcWitcherCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcWitcherCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcEredinDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcEredinCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcEredinCombat extends CAINpcCombat{

public function Init(){


params = new CAINpcEredinCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcEredinCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcEredinCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcEredinCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcEredinCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcImlerithDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcImlerithCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
import abstract class CGame{
import public final function IsActive() : Bool;
import public final function IsPaused() : Bool;
import public final function IsPausedForReason(reason : String) : Bool;
import public final function IsStopped() : Bool;
import public final function IsActivelyPaused() : Bool;
import public final function IsLoadingScreenVideoPlaying() : Bool;
import public final function GetEngineTime() : EngineTime;
import public final function GetEngineTimeAsSeconds() : Float;
import public final function GetTimeScale(forCamera : Bool) : Float;
import public final function SetTimeScale(timeScale : Float, sourceName
: CName, priority : Int32, affectCamera : Bool, dontSave : Bool);
import public final function RemoveTimeScale(sourceName : CName);
import public final function RemoveAllTimeScales();
import public final function SetOrRemoveTimeScale(timeScale : Float, sou
rceName : CName, priority : Int32, affectCamera : Bool);
import public final function LogTimeScales();
import public final function GetGameTime() : GameTime;
import public final function SetGameTime(time : GameTime, callEvents : B
ool);
import public final function SetHoursPerMinute(f : Float);
import public final function GetHoursPerMinute() : Float;
import public final function Pause(reason : String);
import public final function Unpause(reason : String);
import public final function ExitGame();
import public final function SetActivePause(flag : Bool);

import public final function CreateEntity(entityTemplate : CEntityTempla


te, pos : Vector, rot : EulerAngles, useAppearancesFromIncludes : Bool, forceBeh
aviorPose : Bool, doNotAdjustPlacement : Bool, persistanceMode : EPersistanceMod
e, tagList : array<CName>) : CEntity;
import public final function GetNodeByTag(tag : CName) : CNode;
import public final function GetEntityByTag(tag : CName) : CEntity;
import public final function GetNodesByTag(tag : CName, nodes : array<CN
ode>);
import public final function GetNodesByTags(tagsList : array<CName>, nod
es : array<CNode>, matchAll : Bool);
import public final function GetWorld() : CWorld;
import public final function IsFreeCameraEnabled() : Bool;
import public final function EnableFreeCamera(flag : Bool);
import public final function GetFreeCameraPosition() : Vector;
import public final function IsShowFlagEnabled(showFlag : EShowFlags) :
Bool;
import public final function SetShowFlag(showFlag : EShowFlags, enabled
: Bool);
import public final function AddInitialFact(factName : String);
import public final function RemoveInitialFact(faceName : String);
import public final function ClearInitialFacts();
import public final latent function PlayCutscene(csName : String, actorN
ames : array<String>, actorEntities : array<CEntity>, csPos : Vector, csRot : Eu
lerAngles, cameraNum : Int32) : Bool;
import public final function PlayCutsceneAsync(csName : String, actorNam
es : array<String>, actorEntities : array<CEntity>, csPos : Vector, csRot : Eule
rAngles, cameraNum : Int32) : Bool;
import public final function IsStreaming() : Bool;
import public final function GetEntitiesByTag(tag : CName, entities : ar
ray<CEntity>);
import public final latent function FadeIn(fadeTime : Float);
import public final latent function FadeOut(fadeTime : Float, fadeColor
: Color);
import public final function FadeInAsync(fadeTime : Float);
import public final function FadeOutAsync(fadeTime : Float, fadeColor :
Color);
import public final function IsFading() : Bool;
import public final function IsBlackscreen() : Bool;
import public final function SetFadeLock(lockName : String);
import public final function ResetFadeLock(lockName : String);
import public final function UnlockAchievement(achName : CName) : Bool;
import public final function LockAchievement(achName : CName) : Bool;
import public final function GetUnlockedAchievements(unlockedAchievments
: array<CName>);
import public final function GetAllAchievements(unlockedAchievments : ar
ray<CName>);
import public final function IsAchievementUnlocked(achievement : CName)
: Bool;
import public final function GetDifficultyLevel() : Int32;
import public final function SetDifficultyLevel(amount : Int32);
import public final function ToggleUserProfileManagerInputProcessing(ena
bled : Bool);
import public final function IsCheatEnabled(cheatFeature : ECheats) : Bo
ol;
import public final function ReloadGameplayConfig();
import public final function GetGameplayChoice() : Bool;
import public final function IsCurrentlyPlayingNonGameplayScene() : Bool
;
import public final function IsFinalBuild() : Bool;
import public final function PauseCutscenes();

import public final function UnpauseCutscenes();


import public final function IsPadConnected() : Bool;
import public final function IsVibrationEnabled() : Bool;
import public final function SetVibrationEnabled(enabled : Bool);
import public final function VibrateController(lowFreq : Float, highFreq
: Float, duration : Float);
import public final function StopVibrateController();
import public final function GetCurrentVibrationFreq(lowFreq : Float, hi
ghFreq : Float);
import public final function RemoveSpecificRumble(lowFreq : Float, highF
req : Float);
import public final function IsSpecificRumbleActive(lowFreq : Float, hig
hFreq : Float) : Bool;
import public final function OverrideRumbleDuration(lowFreq : Float, hig
hFreq : Float, newDuration : Float);
import public final function GetGameplayConfigFloatValue(propName : CNam
e) : Float;
import public final function GetGameplayConfigBoolValue(propName : CName
) : Bool;
import public final function GetGameplayConfigIntValue(propName : CName)
: Int32;
import public final function GetGameplayConfigEnumValue(propName : CName
) : Int32;
import public final function SetAIObjectsLooseTime(time : Float);
import public final function SetSingleShotLoadingScreen(contextName : CN
ame, initString : String, videoToPlay : String);
import public final function GetCurrentViewportResolution(width : Int32,
height : Int32);
import public final function DebugActivateContent(contentToActivate : CN
ame);
import public final function HasBlackscreenRequested() : Bool;
public function OnDifficultyChanged(out newDifficulty : Int32) : Bool{
}
}
class CAINpcImlerithCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcImlerithCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class STimeScaleSource{
}
class CAINpcImlerithCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcImlerithCombatStyle in this);
combatStyles.PushBack(new CAINpcImlerithSecondStageCombatStyle i
n this);
InitializeCombatStyles();
/* NOP */;
}
}
import abstract class STimeScaleSourceSet{
}

class CAINpcImlerithCombatStyle extends CAINpcCombatStyle{


public function Init(){
super.Init();
params = new CAINpcImlerithCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcImlerithSecondStageCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcImlerithSecondStageCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
statemachine class CThrowable extends CProjectileTrajectory{
protected var ownerHandle : EntityHandle;
protected var wasThrown : Bool;
protected var itemId : SItemUniqueId;
protected var isFromAimThrow : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoState('Waiting', /* NOP */, /* NOP */);
/* NOP */;
}
public final function GetOwner() : CActor{
return (CActor)EntityHandleGet(ownerHandle);
/* NOP */;
}
public function OnProcessThrowEvent(animEventName : CName) : Bool{
var ownerPlayer : CR4Player;
var thrownEntity : CThrowable;
ownerPlayer = (CR4Player)super.GetOwner();
if (animEventName == 'ProjectileAttach'){
if (!CreateAttachment(super.GetOwner(), 'l_weapon', /* N
OP */, /* NOP */)){
LogThrowable("Cannot attach thrown item to actor
!");
LogAssert(false, "CActor.OnAnimEvent(ProjectileA
ttach): Cannot attach thrown item to actor!");
}
} else if (animEventName == 'ProjectileThrow'){
if (!GetOwner().GetInventory().IsIdValid(itemId)){
if ((W3Petard)this){
thePlayer.BombThrowAbort();
}
return true;
}
if (ownerPlayer){
if ((W3Petard)this){
ownerPlayer.OnBombProjectileReleased();
}
ownerPlayer.playerAiming.RemoveAimingSloMo();
}
LogThrowable("Thrown <<" + GetOwner().GetInventory().Get
ItemName(itemId) + ">>, " + GetOwner().GetInventory().GetItemQuantity(itemId) +
" more left.");
}

/* NOP */;
}
public function Initialize(ownr : CActor, id : SItemUniqueId){
var ownerPlayer : CR4Player;
EntityHandleSet(ownerHandle, ownr);
itemId = id;
Init(super.GetOwner());
ownerPlayer = (CR4Player)super.GetOwner();
if (ownerPlayer && ownerPlayer.playerAiming.GetCurrentStateName(
) == 'Aiming'){
GotoState('Aiming', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function StartAiming(){
var ownerPlayer : CR4Player;
ownerPlayer = (CR4Player)super.GetOwner();
ownerPlayer.playerAiming.StartAiming(this);
GotoState('Aiming', /* NOP */, /* NOP */);
/* NOP */;
}
public function StopAiming(flag : Bool){
var ownerPlayer : CR4Player;
ownerPlayer = (CR4Player)super.GetOwner();
ownerPlayer.playerAiming.StopAiming();
OnStopAiming(flag);
/* NOP */;
}
public function OnStopAiming(flag : Bool) : Bool{
}
public function ThrowProjectile(targetPos : Vector){
BreakAttachment();
wasThrown = true;
/* NOP */;
}
public function WasThrown() : Bool{
return wasThrown;
/* NOP */;
}
protected function CanCollideWithVictim(actor : CActor) : Bool{
var ownerPlayer : CPlayer;
if (!actor){
return true;
}
if (actor == thePlayer.GetUsedVehicle()){
return false;
}
if (!actor.IsAlive()){
return false;
}
if (actor.IsKnockedUnconscious()){
return false;
}
ownerPlayer = (CPlayer)super.GetOwner();
if (ownerPlayer && ownerPlayer.GetAttitude(actor) == 0){
return false;
}
return true;
/* NOP */;
}

}
class CAINpcCaranthirDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcCaranthirCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcCaranthirCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcCaranthirCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCaranthirCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcCaranthirCombatStyle in this);
increaseHitCounterOnlyOnMelee = false;
LogEffects("increaseHitCounterOnlyOnMelee " + increaseHitCounter
OnlyOnMelee);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcCaranthirCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcCaranthirCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcWitcherFollowerDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcWitcherFollowerCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcWitcherFollowerCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcWitcherFollowerCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcWitcherFollowerCombatParams extends CAINpcWitcherCombatParams{
public var i : Int32;
public function Init(){

super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
super.SetupCombatStyles();
combatStyles[0].params.combatTacticTree.params.specialActions.Pu
shBack(new CAIDwimeritiumBombSpecialAction in combatStyles[0].params.combatTacti
cTree.params);
combatStyles[0].params.combatTacticTree.params.InitializeSpecial
Actions();
i = 0;
while (i < combatStyles.Size()){
combatStyles[i].params.potentialFollower = true;
i += 1;
}
/* NOP */;
}
}
statemachine class W3CurveFishManager extends CGameplayEntity{
public editable var fishSpawnPointsTag : CName;
public editable var spawnRange : Float;
public editable var fishTemplate : array<CEntityTemplate>;
public editable var respawnDelay : Float;
public editable var respawnMinDistance : Float;
public editable var randomFishRotation : Bool;
private var fishSpawnpoints : array<SFishSpawnpoint>;
private var despawnTime : Float;
private var wasEverVisible : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnDetaching() : Bool{
var i : Int32;
i = 0;
while (i < fishSpawnpoints.Size()){
if (fishSpawnpoints[i].fish){
fishSpawnpoints[i].fish.Destroy();
}
i += 1;
}
/* NOP */;
}
public function OnFishDestroyed(b : W3CurveFish){
var i : Int32;
i = 0;
while (i < fishSpawnpoints.Size()){
if (fishSpawnpoints[i].fish == b){
fishSpawnpoints[i].fish = NULL;
break;
}
i += 1;
}
i = 0;
while (i < fishSpawnpoints.Size()){
if (fishSpawnpoints[i].fish){
return;

}
i += 1;
}
despawnTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
private function SelectFishTemplate() : CEntityTemplate{
return fishTemplate[RandRange(fishTemplate.Size(), 0)];
/* NOP */;
}
public function SpawnFish(forced : Bool){
var i : Int32;
var size : Int32;
var x : Float;
var y : Float;
var isVisible : Bool;
var fish : W3CurveFish;
var spawnRotation : EulerAngles;
if (!forced){
if (theGame.GetEngineTimeAsSeconds() < respawnDelay + de
spawnTime){
return;
}
if (VecDistance(GetWorldPosition(), theCamera.GetCameraP
osition()) < respawnMinDistance){
return;
}
}
UpdateSpawnPointsList();
size = fishSpawnpoints.Size();
i = 0;
while (i < size){
if (!fishSpawnpoints[i].fish){
if (!forced){
isVisible = theCamera.WorldVectorToViewR
atio(fishSpawnpoints[i].position, x, y);
if (isVisible && AbsF(x) > 1.100000 && A
bsF(y) > 1.100000){
isVisible = false;
}
}
if (randomFishRotation){
spawnRotation.Pitch = fishSpawnpoints[i]
.rotation.Pitch;
spawnRotation.Roll = fishSpawnpoints[i].
rotation.Roll;
spawnRotation.Yaw = RandRangeF(359.00000
0, 1.000000);
} else {
spawnRotation = fishSpawnpoints[i].rotat
ion;
}
if (!isVisible || forced){
fish = (W3CurveFish)theGame.CreateEntity
(SelectFishTemplate(), fishSpawnpoints[i].position, spawnRotation, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
if (fish){
fish.SetFishManager(this);
fishSpawnpoints[i].fish = fish;
}

}
}
i += 1;
}
/* NOP */;
}
private function UpdateSpawnPointsList(){
var spawnstruct : SFishSpawnpoint;
var nodes : array<CNode>;
var spawnpoint : W3CurveFishSpawnpoint;
var collisionPos : Vector;
var testVec : Vector;
var normal : Vector;
var world : CWorld;
var i : Int32;
var j : Int32;
var lastExistingSpawnPoint : Int32;
var exists : Bool;
var foundSpawnpoints : array<Int32>;
var collisionGroups : array<CName>;
lastExistingSpawnPoint = fishSpawnpoints.Size() - 1;
theGame.GetNodesByTag(fishSpawnPointsTag, nodes);
world = theGame.GetWorld();
i = 0;
while (i < nodes.Size()){
spawnpoint = (W3CurveFishSpawnpoint)nodes[i];
if (spawnpoint){
spawnstruct.position = spawnpoint.GetWorldPositi
on();
exists = false;
j = 0;
while (j <= lastExistingSpawnPoint){
if (fishSpawnpoints[j].position == spawn
struct.position){
foundSpawnpoints.PushBack(j);
exists = true;
break;
}
j += 1;
}
if (!exists){
spawnstruct.rotation = spawnpoint.GetWor
ldRotation();
fishSpawnpoints.PushBack(spawnstruct);
}
}
i += 1;
}
i = lastExistingSpawnPoint;
while (i >= 0){
exists = false;
j = 0;
while (j < foundSpawnpoints.Size()){
if (i == foundSpawnpoints[j]){
exists = true;
foundSpawnpoints.Erase(j);
break;
}
j += 1;
}

if (!exists){
fishSpawnpoints.Erase(i);
}
i -= 1;
}
/* NOP */;
}
private function DespawnFish(){
var i : Int32;
i = 0;
while (i < fishSpawnpoints.Size()){
if (fishSpawnpoints[i].fish){
fishSpawnpoints[i].fish.Destroy();
}
i += 1;
}
/* NOP */;
}
public function OnDestroyed() : Bool{
DespawnFish();
RemoveTimer('FishSpawnCheck', /* NOP */);
/* NOP */;
}
public timer function FishSpawnCheck(optional td : Float, optional id :
Int32){
var x : Float;
var y : Float;
var dist : Float;
var i : Int32;
var pos : Vector;
var isVisible : Bool;
var areFishSpawned : Bool;
pos = GetWorldPosition();
isVisible = theCamera.WorldVectorToViewRatio(pos, x, y);
x = AbsF(x);
y = AbsF(y);
if (isVisible && x >= 1.100000 || y >= 1.100000){
isVisible = false;
}
if (isVisible){
wasEverVisible = true;
}
if (!isVisible){
dist = VecDistance(pos, theCamera.GetCameraPosition());
areFishSpawned = false;
i = 0;
while (i < fishSpawnpoints.Size()){
if (fishSpawnpoints[i].fish){
areFishSpawned = true;
break;
}
i += 1;
}
if (areFishSpawned){
if (dist > spawnRange && wasEverVisible){
DespawnFish();
}
} else if (x < 1.300000 || y < 1.300000 && dist <= spawn
Range){
SpawnFish(true);

}
}
/* NOP */;
}
}
class CAIDwimeritiumBombSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCiriDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcCiriCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAINpcCiriCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcCiriCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCiriCombatParams extends CAINpcCombatParams{
public var i : Int32;
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcCiriCombatStyle in this);
InitializeCombatStyles();
i = 0;
while (i < combatStyles.Size()){
combatStyles[i].params.potentialFollower = true;
i += 1;
}
/* NOP */;
}
}
class CAINpcCiriCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcCiriCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}

abstract class CAINpcSorceressDefaults extends CAINpcDefaults{


}
import abstract class CDrawableComponent{
import public final function IsVisible() : Bool;
import public final function SetVisible(flag : Bool);
import public final function SetCastingShadows(flag : Bool);
public function GetObjectBoundingVolume(box : Box) : Bool{
return GetPhysicalObjectBoundingVolume(box);
/* NOP */;
}
}
import abstract class CBoundedComponent{
import public final function GetBoundingBox() : Box;
}
class CAINpcYenneferDefaults extends CAINpcSorceressDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcYenneferCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcYenneferCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcYenneferCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
struct SFishSpawnpoint{
var isFishSpawned : Bool;
var fish : W3CurveFish;
var position : Vector;
var rotation : EulerAngles;
}
class CAINpcTrissDefaults extends CAINpcSorceressDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcTrissCombat in this;
combatTree.Init();
/* NOP */;
}
}
class W3CurveFishSpawnpoint extends CEntity{
}
class CAINpcTrissCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcTrissCombatParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAINpcKeiraDefaults extends CAINpcSorceressDefaults{


public function Init(){
super.Init();
combatTree = new CAINpcKeiraCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcKeiraCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcKeiraCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
statemachine class W3WhaleArea extends CEntity{
public editable var whaleSpawnPointTag : CName;
public editable var whaleSpawnOffsetY : Float;
public editable var minSpawnDistance : Float;
public editable var maxSpawnDistance : Float;
public editable var spawnFrequencyMin : Float;
public editable var spawnFrequencyMax : Float;
public editable var movementPatern : EWhaleMovementPatern;
public var whaleTemplate : CEntityTemplate;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (activator.GetEntity() == thePlayer){
SpawnWhale();
AddTimer('CheckWhaleSpawn', RandomSpawnInterval(), true,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() == thePlayer){
RemoveTimer('CheckWhaleSpawn', /* NOP */);
}
/* NOP */;
}
public function RandomSpawnInterval() : Float{
var f : Float;
f = RandRangeF(spawnFrequencyMax, spawnFrequencyMin);
return f;
/* NOP */;
}
public timer function CheckWhaleSpawn(optional deltaTime : Float, option
al id : Int32){
var visibleWhale : W3Whale;
var areaComponent : CAreaComponent;
var playerInArea : Bool;
visibleWhale = (W3Whale)theGame.GetNodeByTag('whale');

areaComponent = (CAreaComponent)GetComponentByClassName('CTrigge
rAreaComponent');
playerInArea = areaComponent.TestEntityOverlap(thePlayer);
if (!visibleWhale && playerInArea){
SpawnWhale();
}
/* NOP */;
}
public function SpawnWhale(){
var wPos : Vector;
var dir : Vector;
var wRot : EulerAngles;
var offset : Vector;
var plyerPos : Vector;
var offsetY : Float;
var spawnP : CNode;
var spawnsP : array<CNode>;
var spawnedWhale : W3Whale;
var timeToDespawn : Float;
var currDistance : Float;
var i : Int32;
if (whaleSpawnPointTag == 'None'){
if (whaleSpawnOffsetY < 120.000000){
offsetY = 120.000000;
} else {
offsetY = whaleSpawnOffsetY;
}
offset = Vector(-40.000000, offsetY, -8.000000);
WhaleSpawnPosition(offset, wPos, wRot);
plyerPos = thePlayer.GetWorldPosition();
currDistance = VecDistance2D(plyerPos, wPos);
if (currDistance > minSpawnDistance && currDistance < ma
xSpawnDistance){
timeToDespawn = RandRangeF(8.000000, 5.000000);
spawnedWhale = (W3Whale)theGame.CreateEntity(wha
leTemplate, wPos, wRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
spawnedWhale.AddTimer('EachTick', 0.010000, true
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
spawnedWhale.SetSpawnPosAndRot(wPos, wRot);
spawnedWhale.ApplyAppearance("whale_01");
}
} else {
theGame.GetNodesByTag(whaleSpawnPointTag, spawnsP);
i = 0;
while (i < spawnsP.Size()){
spawnP = spawnsP[i];
wPos = spawnP.GetWorldPosition();
plyerPos = thePlayer.GetWorldPosition();
wPos.Z = -8.000000;
if (movementPatern == 2){
dir = wPos - plyerPos;
wRot.Pitch = 0.000000;
wRot.Roll = 0.000000;
wRot.Yaw = VecHeading(dir);
} else if (movementPatern == 1){
dir = plyerPos - wPos;
wRot.Pitch = 0.000000;
wRot.Roll = 0.000000;
wRot.Yaw = VecHeading(dir);
} else {

wRot = spawnP.GetWorldRotation();
}
currDistance = VecDistance2D(plyerPos, wPos);
if (currDistance > minSpawnDistance && currDista
nce < maxSpawnDistance){
spawnedWhale = (W3Whale)theGame.CreateEn
tity(whaleTemplate, wPos, wRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
spawnedWhale.AddTimer('EachTick', 0.0100
00, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
spawnedWhale.SetSpawnPosAndRot(wPos, wRo
t);
spawnedWhale.ApplyAppearance("whale_01")
;
return;
}
i += 1;
}
}
/* NOP */;
}
public function WhaleSpawnPosition(offset : Vector, positionWS : Vector,
rotationWS : EulerAngles){
var local2world : Matrix;
var positionWSInv : Vector;
var dir : Vector;
var offsetInv : Vector;
offsetInv = offset;
offsetInv.X = -offset.X;
local2world = thePlayer.GetLocalToWorld();
positionWS = VecTransform(local2world, offset);
positionWSInv = VecTransform(local2world, offsetInv);
dir = positionWSInv - positionWS;
rotationWS.Pitch = 0.000000;
rotationWS.Roll = 0.000000;
rotationWS.Yaw = VecHeading(dir);
/* NOP */;
}
}
class CAINpcPhilippaDefaults extends CAINpcSorceressDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcPhilippaCombat in this;
combatTree.Init();
reactionTree = new CAIPhilippaReactionsTree in this;
reactionTree.Init();
/* NOP */;
}
}
class CAINpcPhilippaCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcPhilippaCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcYenneferCombatParams extends CAINpcCombatParams{

public function Init(){


super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcYenneferCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcTrissCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTrissCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcKeiraCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcKeiraCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcPhilippaCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcPhilippaCombatStyle in this);
combatStyles.PushBack(new CAINpcPhilippaCustomCombatStyle in thi
s);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcSorceressCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();

ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
var i : Int32;
combatStyles.Clear();
combatStyles.PushBack(new CAINpcSorceressCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcSorceressCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleSorceressParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcYenneferCombatStyle extends CAINpcSorceressCombatStyle{
public function Init(){
var i : Int32;
var sorceressParams : CAINpcStyleSorceressParams;
super.Init();
sorceressParams = (CAINpcStyleSorceressParams)params;
sorceressParams.magicAttackResourceName = 'magic_attack_lightnin
g';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stLightningSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stRipApartSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class CAINpcTrissCombatStyle extends CAINpcSorceressCombatStyle{
public function Init(){
var i : Int32;
var sorceressParams : CAINpcStyleSorceressParams;
super.Init();
sorceressParams = (CAINpcStyleSorceressParams)params;
sorceressParams.magicAttackResourceName = 'magic_attack_fire';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stRipApartSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stFireballSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class CAINpcKeiraCombatStyle extends CAINpcSorceressCombatStyle{
public function Init(){
var i : Int32;
var sorceressParams : CAINpcStyleSorceressParams;

super.Init();
sorceressParams = (CAINpcStyleSorceressParams)params;
sorceressParams.magicAttackResourceName = 'magic_attack_lightnin
g';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stLightningSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stRipApartSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAISh
ootProjectilesFromGroundSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class CAINpcPhilippaCombatStyle extends CAINpcSorceressCombatStyle{
public function Init(){
var i : Int32;
var sorceressParams : CAINpcStyleSorceressParams;
super.Init();
sorceressParams = (CAINpcStyleSorceressParams)params;
sorceressParams.magicAttackResourceName = 'magic_attack_arcane';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stArcaneMissileSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAICa
stArcaneExplosionSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class CAINpcPhilippaCustomCombatStyle extends CAINpcSorceressCombatStyle{
public function Init(){
var i : Int32;
var sorceressParams : CAINpcStyleSorceressParams;
super.Init();
params = new CAINpcStylePhilippaParams in this;
params.OnCreated();
sorceressParams = (CAINpcStyleSorceressParams)params;
sorceressParams.magicAttackResourceName = 'magic_attack_arcane';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class W3Whale extends CGameplayEntity{
public var whaleArea : W3WhaleArea;
public var destroyTime : Float;
public var alwaysSpawned : Bool;
public var canBeDestroyed : Bool;
public var spawnPosition : Vector;
public var spawnRotation : EulerAngles;
public function SetDestroyTime(time : Float){
destroyTime = time;
/* NOP */;
}
public function SetSpawnPosAndRot(position : Vector, rotation : EulerAng

les){
spawnPosition = position;
spawnRotation = rotation;
/* NOP */;
}
public function SetAlwaysSpawned(always : Bool){
alwaysSpawned = always;
/* NOP */;
}
public function OnAnimEvent_WhaleDespawn(animEventName : CName, animEven
tType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (!alwaysSpawned){
canBeDestroyed = true;
}
/* NOP */;
}
public function OnAnimEvent_Destroy(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (canBeDestroyed){
Destroy();
return true;
}
RaiseForceEvent('SwimUpStart');
if (alwaysSpawned){
Teleport(spawnPosition);
}
/* NOP */;
}
public function OnAnimEvent_PlayEffect(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
PlayEffect(animEventName, /* NOP */);
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
RaiseForceEvent('SwimUpStart');
AddAnimEventCallback('whale_despawn', 'OnAnimEvent_WhaleDespawn'
);
AddAnimEventCallback('destroy', 'OnAnimEvent_Destroy');
AddAnimEventCallback('appear', 'OnAnimEvent_PlayEffect');
AddAnimEventCallback('splash', 'OnAnimEvent_PlayEffect');
AddAnimEventCallback('tail', 'OnAnimEvent_PlayEffect');
/* NOP */;
}
public timer function EachTick(optional dt : Float, optional id : Int32)
{
var pos : Vector;
pos = GetWorldPosition();
pos.Z = theGame.GetWorld().GetWaterLevel(Vector(pos.X, pos.Y, 50
), /* NOP */) - 32.000000;
Teleport(Vector(pos.X, pos.Y, pos.Z));
/* NOP */;
}
}
abstract class CAINpcSorcererDefaults extends CAINpcDefaults{
}
class CAINpcDruidDefaults extends CAINpcSorcererDefaults{
public function Init(){
super.Init();

combatTree = new CAINpcDruidCombat in this;


combatTree.Init();
/* NOP */;
}
}
class CAINpcDruidCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcDruidCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcDruidCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcDruidCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcAvallachDefaults extends CAINpcSorcererDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcAvallachCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcAvallachCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcAvallachCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcAvallachCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcAvallachCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcSorcererCombatParams extends CAINpcCombatParams{

public function Init(){


super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
var i : Int32;
combatStyles.Clear();
combatStyles.PushBack(new CAINpcSorcererCombatStyle in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcSorcererCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleSorcererParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcDruidCombatStyle extends CAINpcSorcererCombatStyle{
public function Init(){
var i : Int32;
var sorcererParams : CAINpcStyleSorcererParams;
super.Init();
sorcererParams = (CAINpcStyleSorcererParams)params;
sorcererParams.magicAttackResourceName = 'magic_attack_lightning
';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAIMa
gicGroundBlastSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAIMa
gicPushSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
class CAINpcAvallachCombatStyle extends CAINpcSorcererCombatStyle{
public function Init(){
var i : Int32;
var sorcererParams : CAINpcStyleSorcererParams;
super.Init();
sorcererParams = (CAINpcStyleSorcererParams)params;
sorcererParams.magicAttackResourceName = 'magic_attack_lightning
';
params.combatTacticTree.params.specialActions.Clear();
params.combatTacticTree.params.specialActions.PushBack(new CAIMa
gicGroundBlastSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.specialActions.PushBack(new CAIMa
gicPushSpecialAction in params.combatTacticTree.params);
params.combatTacticTree.params.InitializeSpecialActions();
/* NOP */;
}
}
abstract class CAINpcMainDefaults extends CAINpcDefaults{

}
class CAINpcIorwvethDefaults extends CAINpcMainDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcBowCombat in this;
combatTree.Init();
combatTree.params.preferedCombatStyle = 6;
/* NOP */;
}
}
class CAINpcZoltanDefaults extends CAINpcMainDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcZoltanCombat in this;
combatTree.Init();
combatTree.params.preferedCombatStyle = 10;
/* NOP */;
}
}
class CAINpcZoltanCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcZoltanCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcZoltanCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcTwoHandedAxeCombatStyle in this)
;
combatStyles.PushBack(new CAINpcOneHandedBluntCombatStyle in thi
s);
InitializeCombatStyles();
/* NOP */;
}
}
class CAINpcVesDefaults extends CAINpcMainDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcVesCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcVesCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcVesCombatParams in this;
params.OnCreated();

/* NOP */;
}
}
class CAINpcVesCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcOneHandedSwordCombatStyle in thi
s);
combatStyles.PushBack(new CAINpcBowCombatStyle in this);
InitializeCombatStyles();
combatStyles[1].params.combatTacticTree.params.specialActions.Pu
shBack(new CAIShootBarrelsSpecialAction in combatStyles[1].params.combatTacticTr
ee.params);
combatStyles[1].params.combatTacticTree.params.InitializeSpecial
Actions();
preferedCombatStyle = 3;
/* NOP */;
}
}
class CAIShootBarrelsSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcRocheDefaults extends CAINpcMainDefaults{
public function Init(){
super.Init();
combatTree = new CAINpcRocheCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAINpcRocheCombat extends CAINpcCombat{
public function Init(){
params = new CAINpcRocheCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcRocheCombatParams extends CAINpcCombatParams{
public function Init(){
super.Init();
ClearCSFinisherAnims();
/* NOP */;
}
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAINpcOneHandedSwordCombatStyle in thi

s);
combatStyles.PushBack(new CAINpcCrossbowCombatStyle in this);
InitializeCombatStyles();
combatStyles[1].params.combatTacticTree.params.specialActions.Pu
shBack(new CAIShootBarrelsSpecialAction in combatStyles[1].params.combatTacticTr
ee.params);
combatStyles[1].params.combatTacticTree.params.InitializeSpecial
Actions();
preferedCombatStyle = 3;
/* NOP */;
}
}
class CAINpcSimpleTacticTree extends CAINpcMeleeTacticTree{
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcSurroundTacticTree extends CAINpcMeleeTacticTree{
public function Init(){
params = new CAINpcSurroundTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcSurroundTacticTreeParams extends CAINpcTacticTreeParams{
public editable var minStrafeDist : Float;
public editable var maxStrafeDist : Float;
public editable var minFarStrafeDist : Float;
public editable var maxFarStrafeDist : Float;
public function Init(){
super.Init();
minStrafeDist = 3.000000;
maxStrafeDist = 5.000000;
minFarStrafeDist = 8.000000;
maxFarStrafeDist = 12.000000;
/* NOP */;
}
}
import abstract class IBehTreeAtomicCondition{
}
class CAINpcSurroundTacticCloseTree extends CAINpcMeleeTacticTree{
public function Init(){
params = new CAINpcSurroundTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcSurroundTacticFarTree extends CAINpcMeleeTacticTree{
public function Init(){
params = new CAINpcSurroundTacticTreeParams in this;
params.OnCreated();
/* NOP */;

}
}
class CAINpcSurroundRangedTacticTree extends CAINpcRangedTacticTree{
public function Init(){
params = new CAINpcSurroundTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcHoldGroundTacticTree extends CAINpcMeleeTacticTree{
public function Init(){
params = new CAINpcHoldGroundTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcHoldGroundTacticTreeParams extends CAINpcTacticTreeParams{
public editable var holdPositionTag : CName;
public editable var engageDist : Float;
public editable var maxDistanceToHoldGroundPosition : Float;
public function Init(){
super.Init();
engageDist = 8;
maxDistanceToHoldGroundPosition = 8;
/* NOP */;
}
}
class CAINpcHoldGroundRangedTacticTree extends CAINpcRangedTacticTree{
public function Init(){
params = new CAINpcHoldGroundRangedTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcHoldGroundRangedTacticTreeParams extends CAINpcTacticTreeParams{
public editable var holdPositionTag : CName;
public editable var maxDistanceToHoldGroundPosition : Float;
public function Init(){
super.Init();
maxDistanceToHoldGroundPosition = 0.000000;
/* NOP */;
}
}
class CAINpcVesemirTutorialTacticTree extends CAINpcCustomTacticTree{
public function Init(){
params = new CAINpcVesemirTutorialTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcVesemirTutorialTacticTreeParams extends CAINpcTacticTreeParams{
public editable var backgroundTraining : Bool;
public editable var onlyBlock : Bool;

public
public
public
public
public
public
public

editable var onlyBlocksWithQuen : Bool;


editable var useAttacks : Bool;
editable var useCombos : Bool;
editable var forceIdle : Bool;
editable var attacksInterval : Float;
editable var maxDistFromTarget : Float;
function Init(){
attacksInterval = 3.000000;
super.Init();
/* NOP */;

}
}
class CAINpcSorceressTacticTree extends CAINpcRangedTacticTree{
public function Init(){
params = new CAINpcSorceressTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcSorceressTacticTreeParams extends CAINpcTacticTreeParams{
public editable var minStrafeDist : Float;
public editable var maxStrafeDist : Float;
public editable var minFarStrafeDist : Float;
public editable var maxFarStrafeDist : Float;
public function Init(){
super.Init();
minStrafeDist = 3.000000;
maxStrafeDist = 5.000000;
minFarStrafeDist = 8.000000;
maxFarStrafeDist = 12.000000;
/* NOP */;
}
}
class CAINpcSorcererTacticTree extends CAINpcRangedTacticTree{
public function Init(){
params = new CAINpcSorcererTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcSorcererTacticTreeParams extends CAINpcTacticTreeParams{
public editable var minStrafeDist : Float;
public editable var maxStrafeDist : Float;
public editable var minFarStrafeDist : Float;
public editable var maxFarStrafeDist : Float;
public function Init(){
super.Init();
minStrafeDist = 3.000000;
maxStrafeDist = 5.000000;
minFarStrafeDist = 8.000000;
maxFarStrafeDist = 12.000000;
/* NOP */;
}
}
class CAINpcEredinTacticTree extends CAINpcCustomTacticTree{

public function Init(){


params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcEredinTESTTacticTree extends CAINpcCustomTacticTree{
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcImlerithTacticTree extends CAINpcCustomTacticTree{
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcImlerithSecondStageTacticTree extends CAINpcCustomTacticTree{
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCaranthirTacticTree extends CAINpcCustomTacticTree{
public editable var Phase1 : Bool;
public editable var Phase2 : Bool;
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcPhilippaTacticTree extends CAINpcCustomTacticTree{
public function Init(){
params = new CAINpcSorceressTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIBasicAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIAttachEntitiesSpecialAction extends CAISpecialAction{
public function Init(){

params = new CAISpecialActionParams in this;


params.OnCreated();
/* NOP */;
}
}
class CAIDisperseAttachedEntitiesSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMagicGroundBlastSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMagicPushSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIShootAttachedEntitiesSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIShootProjectilesFromGroundSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICastRipApartSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICastFireballSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}

}
class CAICastLightningSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICastArcaneMissileSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAICastArcaneExplosionSpecialAction extends CAISpecialAction{
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3ClueStash extends W3MonsterClue{
public editable var lootEntityTemplate : CEntityTemplate;
public editable var setInvisibleAppearanceAfterLootingStash : Bool;
public editable var showLootPanelImmediately : Bool;
public editable saved var isStashDisabled : Bool;
public editable var stashOpenDelay : Float;
public editable var stashSpawnOffset : Vector;
public saved var currentAppearance : CName;
public var lootEntity : W3Container;
public saved var lootWasOfferedToPlayer : Bool;
public saved var stashWasLooted : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (wasDetected && !isStashDisabled){
UpdateAppearance(0, 0);
if (lootEntity){
lootEntity.RegisterClueStash(this);
}
} else {
SetAppearance(currentAppearance);
}
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnStreamIn() : Bool{
if (wasDetected && !isStashDisabled){
UpdateAppearance(0, 0);
if (lootEntity){
lootEntity.RegisterClueStash(this);
}
} else {
SetAppearance(currentAppearance);
}
super.OnStreamIn();
/* NOP */;

}
public function SetAppearance(appearance : CName){
currentAppearance = appearance;
ApplyAppearance(appearance);
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (stashOpenDelay > interactionAnimTime){
interactionAnimTime = stashOpenDelay;
}
super.OnInteraction(actionName, activator);
if (!isStashDisabled){
SetAttributes(0, false, false, false, false, true, false
);
SetAppearance('detected');
UpdateStash();
}
if (lootEntity){
lootEntity.RegisterClueStash(this);
} else {
AddTimer('RegisterClueStash', 0.000100, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function RegisterClueStash(optional t : Float, optional id
: Int32){
if (lootEntity){
lootEntity.RegisterClueStash(this);
RemoveTimer('RegisterClueStash', /* NOP */);
}
/* NOP */;
}
public function OnClueDetected() : Bool{
if (isStashDisabled == false){
SetInteractive(true);
}
super.OnClueDetected();
/* NOP */;
}
public function ShouldBlockGameplayActionsOnInteraction() : Bool{
return true;
/* NOP */;
}
public function UpdateInteraction(comp : CComponent){
var enabled : Bool;
if (!comp){
comp = GetComponent(INTERACTION_COMPONENT_NAME);
}
if (comp){
enabled = false;
if (IsInteractiveInternal()){
if (!isPlayingInteractionAnim){
enabled = true;
}
}
EnableInteractionBaseOnStashState(enabled);
} else {
LogAssert(false, "Monster clue <<" + this + ">> has no I

nteractiveClue component");
}
/* NOP */;
}
public function UpdateStash(){
if (isStashDisabled == false){
if (!showLootPanelImmediately){
AddTimer('UpdateAppearance', stashOpenDelay, /*
NOP */, /* NOP */, /* NOP */, true, /* NOP */);
} else {
UpdateAppearance(0, 0);
}
}
/* NOP */;
}
public function OnContainerEvent(){
if (!lootEntity || lootEntity.IsEmpty()){
stashWasLooted = true;
if (setInvisibleAppearanceAfterLootingStash){
SetAppearance('invisible');
}
}
/* NOP */;
}
public timer function UpdateAppearance(optional td : Float, optional id
: Int32){
var lootPos : Vector;
if (!stashWasLooted){
SetAppearance(currentAppearance);
if (lootEntityTemplate && !stashWasLooted){
lootPos = GetWorldPosition() + stashSpawnOffset;
lootEntity = (W3Container)theGame.CreateEntity(l
ootEntityTemplate, lootPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
if (lootEntity){
SetAttributes(0, false, false, false, fa
lse, true, false);
}
if (!lootEntity.IsEmpty()){
if (lootEntity.GetSkipInventoryPanel()){
lootEntity.TakeAllItems();
lootEntity.OnContainerClosed();
} else if (!lootWasOfferedToPlayer){
lootWasOfferedToPlayer = true;
lootEntity.ShowLoot();
}
}
}
if (!lootEntity || lootEntity.IsEmpty()){
stashWasLooted = true;
if (setInvisibleAppearanceAfterLootingStash){
SetAppearance('invisible');
}
}
RemoveTimer('UpdateAppearance', /* NOP */);
} else {
SetAppearance('invisible');
}
/* NOP */;
}

public function SetStashDisabled(isDisabled : Bool){


isStashDisabled = isDisabled;
/* NOP */;
}
private function EnableInteractionBaseOnStashState(enable : Bool){
var takeInteraction : CInteractionComponent;
var examineInteraction : CInteractionComponent;
takeInteraction = (CInteractionComponent)GetComponent("Take");
examineInteraction = (CInteractionComponent)GetComponent("Intera
ctiveClue");
if (takeInteraction){
if (!isStashDisabled && wasDetected){
examineInteraction.SetEnabled(false);
takeInteraction.SetEnabled(enable);
} else {
examineInteraction.SetEnabled(enable);
takeInteraction.SetEnabled(false);
}
} else {
examineInteraction.SetEnabled(enable);
}
/* NOP */;
}
}
import abstract class CSoundEmitterComponent{
}
class CAISimpleAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAISimpleAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class SSoundProperty{
}
class CAISimpleAttackActionTreeParams extends CAIAttackActionTreeParams{
}
import abstract class SSoundSwitch{
}
class CAIBasicAttackActionTreeParams extends CAIAttackActionTreeParams{
}
import struct CSwitchableFoliageComponent{
private var currEntryName : CName;
import private final function SetEntry(entryName : CName);
public function SetAndSaveEntry(entryName : CName){
currEntryName = entryName;
super.SetEntry(currEntryName);
/* NOP */;
}
public function GetEntry() : CName{
return currEntryName;
/* NOP */;

}
}
class CAIFistAttackActionTree extends CAIAttackActionTree{
public var easyVersion : Bool;
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
easyVersion = true;
/* NOP */;
}
}
class CAIComboFistAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAISword2hAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAITwoHandedAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIPitchforkAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3LootPopupData extends CObject{
public var targetContainer : W3Container;
}
class CAIWitcherAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;

}
}
class CAICiriAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcParryAction extends CAINpcDefenseAction{
public editable var activationTimeLimitBonusHeavy : Float;
public editable var activationTimeLimitBonusLight : Float;
}
class CAINpcDodgeAction extends CAINpcDefenseAction{
}
class CAINpcCounterAction extends CAINpcDefenseAction{
}
class CAINpcStyleOneHandedSwordParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.chargeAction = true;
/* NOP */;
}
}
struct SCookingSchematic{
var cookedItemName : CName;
var cookedItemQuantity : Int32;
var ingredients : array<SItemParts>;
var schemName : CName;
}
class CAINpcStyleOneHandedAxeParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.chargeAction = true;
defenseActions.Clear();
defenseActions.PushBack(new CAINpcDodgeAction in this);
/* NOP */;
}
}
class CAINpcStyleOneHandedBluntParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.chargeAction = true;
defenseActions.Clear();
defenseActions.PushBack(new CAINpcDodgeAction in this);

/* NOP */;
}
}
class CAINpcStyleOneHandedAnyParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.chargeAction = true;
defenseActions.Clear();
/* NOP */;
}
}
class CAINpcStyleTwoHandedAnyParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
defenseActions.Clear();
/* NOP */;
}
}
abstract class CAINpcFistsCombatStyleBaseParams extends CAINpcCombatStyleParams{
public editable var canBeScared : Bool;
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticCloseTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
defenseActions.Clear();
defenseActions.PushBack(new CAINpcParryAction in this);
defenseActions.PushBack(new CAINpcDodgeAction in this);
defenseActions.PushBack(new CAINpcCounterFistFightAction in this
);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcCounterFistFightAction extends CAINpcDefenseAction{
}
class CAINpcStyleFistsParams extends CAINpcFistsCombatStyleBaseParams{
public function Init(){
super.Init();
attackBehavior.params.attackAction = new CAIFistAttackActionTree
in this;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.farAttackAction = new CAISimpleAttackActio

nTree in this;
attackBehavior.params.farAttackAction.OnCreated();
/* NOP */;
}
}
import abstract class COcclusionQueryPtr{
}
class CAINpcStyleFistsEasyParams extends CAINpcFistsCombatStyleBaseParams{
public function Init(){
super.Init();
attackBehavior.params.attackAction = new CAIFistAttackActionTree
in this;
attackBehavior.params.attackAction.OnCreated();
/* NOP */;
}
}
class CAINpcStyleShieldParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
combatTacticTree.params.allowChangingGuard = false;
/* NOP */;
}
}
class CAINpcStylePhilippaParams extends CAINpcCombatStyleParams{
public editable var magicAttackResourceName : CName;
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcPhilippaTacticTree in this;
combatTacticTree.OnCreated();
defenseActions.Clear();
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcCounterPushAction extends CAINpcDefenseAction{
}
class CAINpcStyleBowParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
minCombatStyleDistance = 6.000000;
combatTacticTree = new CAINpcSurroundRangedTacticTree in this;
combatTacticTree.OnCreated();
/* NOP */;
}
}

class CAINpcStyleBowmanMeleeParams extends CAINpcCombatStyleParams{


public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticFarTree in this;
combatTacticTree.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcParryAction in this);
defenseActions.PushBack(new CAINpcDodgeAction in this);
defenseActions.PushBack(new CAINpcCounterAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcStyleCrossbowParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
minCombatStyleDistance = 6.000000;
combatTacticTree = new CAINpcSurroundRangedTacticTree in this;
combatTacticTree.OnCreated();
/* NOP */;
}
}
class CAINpcStyleTwoHandedHammerParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcCounterHitAction extends CAINpcDefenseAction{
}
import abstract class IBehTreeMetanodeOnSpawnDefinition{
}
class CAINpcStyleTwoHandedAxeParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();

combatTacticTree = new CAINpcSurroundTacticTree in this;


combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcStyleTwoHandedHalberdParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
attackBehavior.params.farAttackActionRange = 'thrust320';
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcStyleTwoHandedSpearParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
attackBehavior.params.farAttackAction = new CAISimpleAttackActio
nTree in attackBehavior.params;
attackBehavior.params.farAttackAction.OnCreated();
attackBehavior.params.farAttackActionRange = 'thrust320';
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();

i += 1;
}
/* NOP */;
}
}
class CAINpcStylePitchforkParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIPitchforkAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcWitcherCombatStyleParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIWitcherAttackActionT
ree in this;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.approachAction = true;
attackBehavior.params.throwBomb = true;
defenseActions.Clear();
defenseActions.PushBack(new CAINpcWitcherCounterAction in this);
defenseActions.PushBack(new CAINpcParryAction in this);
defenseActions.PushBack(new CAINpcDodgeAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcWitcherCounterAction extends CAINpcDefenseAction{
}
class CAINpcEredinCombatStyleParams extends CAINpcCombatStyleParams{
public function Init(){
var parryAction : CAINpcEredinParryAction;
var i : Int32;

super.Init();
combatTacticTree = new CAINpcEredinTacticTree in this;
combatTacticTree.OnCreated();
defenseActions.Clear();
parryAction = new CAINpcEredinParryAction in this;
parryAction.activationTimeLimitBonusHeavy = 3.000000;
parryAction.activationTimeLimitBonusLight = 2.000000;
defenseActions.PushBack(parryAction);
defenseActions.PushBack(new CAINpcEredinCounterAction in this);
defenseActions.PushBack(new CAINpcEredinRaiseGuardAction in this
);
defenseActions.PushBack(new CAINpcEredinSignsBlockAction in this
);
defenseActions.PushBack(new CAINpcEredinDodgeAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcEredinCounterAction extends CAINpcDefenseAction{
}
class CAINpcEredinRaiseGuardAction extends CAINpcDefenseAction{
}
class CAINpcEredinSignsBlockAction extends CAINpcDefenseAction{
}
class CAINpcEredinDodgeAction extends CAINpcDefenseAction{
}
class CAINpcCaranthirCombatStyleParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcCaranthirTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCaranthirCounterAction in this
);
defenseActions.PushBack(new CAINpcCaranthirIceArmorAction in thi
s);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcCaranthirCounterAction extends CAINpcDefenseAction{
}
class CAINpcCaranthirIceArmorAction extends CAINpcDefenseAction{

}
class CAINpcImlerithCombatStyleParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcImlerithTacticTree in this;
combatTacticTree.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcImlerithParry in this);
defenseActions.PushBack(new CAINpcImlerithCounterAction in this)
;
defenseActions.PushBack(new CAINpcImlerithGuardAction in this);
defenseActions.PushBack(new CAINpcImlerithSignsBlockAction in th
is);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcImlerithParry extends CAINpcDefenseAction{
public editable var activationTimeLimitBonusHeavy : Float;
public editable var activationTimeLimitBonusLight : Float;
}
abstract class W3SwitchEvent extends CScriptedAction{
}
class CAINpcImlerithCounterAction extends CAINpcDefenseAction{
}
import struct IBehTreeOnSpawnEffector{
import public final function GetActor() : CActor;
import public final function GetObjectFromAIStorage(varName : CName) : I
Scriptable;
public function Run(){
}
}
class CAINpcImlerithGuardAction extends CAINpcDefenseAction{
}
class CAINpcImlerithSignsBlockAction extends CAINpcDefenseAction{
}
struct SCraftingSchematic{
var craftedItemName : CName;
var craftedItemCount : Int32;
var requiredCraftsmanType : ECraftsmanType;
var requiredCraftsmanLevel : ECraftsmanLevel;
var baseCraftingPrice : Int32;
var ingredients : array<SItemParts>;
var schemName : CName;
}
class CAINpcImlerithSecondStageCombatStyleParams extends CAINpcCombatStyleParams

{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcImlerithSecondStageTacticTree in th
is;
combatTacticTree.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcImlerithCounterActionSecondSta
ge in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcImlerithCounterActionSecondStage extends CAINpcDefenseAction{
}
class W3CraftsmanComponent extends W3MerchantComponent{
public editable var craftsmanData : array<SCraftsman>;
public var owner : W3MerchantNPC;
public function GetCraftsmanLevel(type : ECraftsmanType) : ECraftsmanLev
el{
var i : Int32;
var size : Int32;
size = craftsmanData.Size();
i = 0;
while (i < size){
if (craftsmanData[i].type == type){
return craftsmanData[i].level;
} else if (3 == type && craftsmanData[i].type == 1 || cr
aftsmanData[i].type == 2){
return craftsmanData[i].level;
}
i += 1;
}
return 0;
/* NOP */;
}
public function IsCraftsmanType(type : ECraftsmanType) : Bool{
var i : Int32;
var size : Int32;
size = craftsmanData.Size();
i = 0;
while (i < size){
if (craftsmanData[i].type == type){
return true;
} else if (3 == type && craftsmanData[i].type == 1 || cr
aftsmanData[i].type == 2){
return true;
}
i += 1;
}
return false;
/* NOP */;
}

public function CalculateCostOfCrafting(basePrice : Int32) : Int32{


var i : Int32;
var size : Int32;
if (craftsmanData.Size() > 0){
if (true == craftsmanData[0].noCraftingCost){
return 0;
}
}
return basePrice * 0.300000;
/* NOP */;
}
public function OnComponentAttachFinished() : Bool{
var crafterType : ECraftsmanType;
var crafterLevel : ECraftsmanLevel;
owner = (W3MerchantNPC)GetEntity();
owner.RemoveTag('Blacksmith');
owner.RemoveTag('Armorer');
owner.RemoveTag('Apprentice');
owner.RemoveTag('Specialist');
owner.RemoveTag('Master');
if (owner){
if (IsCraftsmanType(1)){
owner.AddTag('Blacksmith');
SetCrafterLevelTag(1);
}
if (IsCraftsmanType(2)){
owner.AddTag('Armorer');
SetCrafterLevelTag(2);
}
}
/* NOP */;
}
public function SetCrafterLevelTag(type : ECraftsmanType){
var level : ECraftsmanLevel;
level = GetCraftsmanLevel(type);
switch(level){
case 1:
owner.AddTag('Apprentice');
break;
case 2:
owner.AddTag('Specialist');
break;
case 3:
owner.AddTag('Master');
break;
}
/* NOP */;
}
}
class CAINpcCiriCombatStyleParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.attackAction = new CAICiriAttackActionTree
in this;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.teleportAction = true;
defenseActions.Clear();

/* NOP */;
}
}
class CAINpcStyleTwoHandedSwordParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.attackAction = new CAISword2hAttackActionT
ree in this;
attackBehavior.params.attackAction.OnCreated();
/* NOP */;
}
}
class CAINpcVesemirTutorialCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAINpcStyleVesemirTutorialParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcStyleVesemirTutorialParams extends CAINpcCombatStyleParams{
public function Init(){
super.Init();
combatTacticTree = new CAINpcVesemirTutorialTacticTree in this;
combatTacticTree.OnCreated();
/* NOP */;
}
}
class CAINpcBase extends CAIBaseTree{
public editable inlined var params : CAINpcDefaults;
public function Init(){
params = new CAINpcDefaults in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CBehTreeInstance{
}
class CAINpcRiderBase extends CAIBaseTree{
public editable inlined var params : CAINpcRiderDefaults;
public function Init(){
params = new CAINpcRiderDefaults in this;
params.OnCreated();
/* NOP */;
}
}
abstract class CAINpcIdle extends CAIIdleTree{
public editable inlined var params : CAINpcIdleParams;
public function Init(){
params = new CAINpcIdleParams in this;
params.OnCreated();

/* NOP */;
}
}
class CAIRiderIdleParams extends CAINpcIdleParams{
}
class CAINpcActiveIdle extends CAIIdleTree{
public editable inlined var params : CAINpcActiveIdleParams;
public editable var delayWorkOnFailure : Float;
public editable var delayWorkOnSuccess : Float;
public editable var delayWorkOnInterruption : Float;
public function Init(){
params = new CAINpcActiveIdleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWanderRandom extends CAIWanderTree{
public editable inlined var params : CAINpcRandomWanderParams;
public function Init(){
params = new CAINpcRandomWanderParams in this;
params.OnCreated();
/* NOP */;
}
}
state W3TutorialManagerUIHandlerStateCraftingSet in W3TutorialManagerUIHandler e
xtends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var SET : CName;
public function OnLeaveState(nextStateName : CName) : Bool{
CloseHint(SET);
if (theGame.GetTutorialSystem().HasSeenTutorial(SET)){
super.OnLeaveState(nextStateName);
}
/* NOP */;
}
public function OnCraftedSetItem() : Bool{
ShowHint(SET, theGame.params.TUT_POS_ALCHEMY_X, theGame.params.T
UT_POS_ALCHEMY_Y, 5, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().MarkMessageAsSeen(SET);
/* NOP */;
}
}
class CAIDynamicWander extends CAIWanderTree{
public var params : CAIDynamicWanderParams;
public editable var dynamicWanderArea : EntityHandle;
public editable var dynamicWanderUseGuardArea : Bool;
public editable var dynamicWanderIdleDuration : Float;
public editable var dynamicWanderIdleChance : Float;
public editable var dynamicWanderMoveDuration : Float;
public editable var dynamicWanderMoveChance : Float;
public editable var dynamicWanderMinimalDistance : Float;
public function OnPostLoad() : Bool{
if (params){
dynamicWanderArea = params.dynamicWanderArea;
dynamicWanderIdleDuration = params.dynamicWanderIdleDura
tion;

dynamicWanderIdleChance = params.dynamicWanderIdleChance
;
dynamicWanderMoveDuration = params.dynamicWanderMoveDura
tion;
dynamicWanderMoveChance = params.dynamicWanderMoveChance
;
params = NULL;
return true;
}
return false;
/* NOP */;
}
}
class CAIFollowPartyMemeberTree extends CAIIdleTree{
public editable var followPartyMember : CName;
public editable var followDistance : Float;
public editable var moveType : EMoveType;
}
import struct CEncounter{
public editable inlined saved var dataManager : CEncounterDataManager;
private saved var ownerTasksToPerformOnLeaveEncounter : array<SOwnerEnco
unterTaskParams>;
private var externalTasksToPerformOnLeaveEncounter : array<SExternalEnco
unterTaskParams>;
private saved var isUpdating : Bool;
//NULL type for enabled
import public final function EnableMember(memberName : CName, enable : B
ool);
import public final function GetPlayerDistFromArea() : Float;
import public final function GetEncounterArea() : CTriggerAreaComponent;
import public final function IsPlayerInEncounterArea() : Bool;
import public final function IsEnabled() : Bool;
import public final function EnterArea();
import public final function LeaveArea();
import public final function EnableEncounter(enable : Bool);
import public final function ForceDespawnDetached();
import public final function SetSpawnPhase(phaseName : CName) : Bool;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (enabled && activator.GetEntity() == thePlayer){
super.EnterArea();
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() == thePlayer){
if (enabled){
super.LeaveArea();
}
UpdateDelayedTasks();
}
/* NOP */;
}
public function UpdateDelayedTasks(){
var i : Int32;
i = 0;
while (i < ownerTasksToPerformOnLeaveEncounter.Size()){

RunOwnerTask(ownerTasksToPerformOnLeaveEncounter[i]);
i += 1;
}
i = 0;
while (i < externalTasksToPerformOnLeaveEncounter.Size()){
RunExternalTask(externalTasksToPerformOnLeaveEncounter[i
]);
i += 1;
}
RemoveTimer('CheckMeditationTimer', /* NOP */);
/* NOP */;
}
public function OnFullRespawn(){
if (dataManager && dataManager.resetOnFullRespawn){
dataManager.ProcessFullRespawn();
}
/* NOP */;
}
public function GetEncounterDataManager() : CEncounterDataManager{
return dataManager;
/* NOP */;
}
public function ForceDespawnDetachedWithDelay(realTimeDelay : Float){
AddTimer('ForceDespawnWithDelayTimer', realTimeDelay, false, /*
NOP */, /* NOP */, true, true);
/* NOP */;
}
public timer function ForceDespawnWithDelayTimer(optional timeDelta : Fl
oat, optional id : Int32){
super.ForceDespawnDetached();
/* NOP */;
}
public function InitializeEncounterDataManager(){
dataManager = new CEncounterDataManager;
/* NOP */;
}
public function ProcessTasks(){
var i : Int32;
var delay : Int32;
var ownerTask : SOwnerEncounterTaskParams;
var externalTask : SExternalEncounterTaskParams;
var taskID : Int32;
while (i < dataManager.ownerTasksToPerform.Size()){
ownerTask = dataManager.ownerTasksToPerform[i];
delay = GameTimeToSeconds(ownerTask.delay.gameTime);
if (delay <= 0){
if (ownerTask.triggerWhenOutsideOwnerEncounterAr
ea && super.IsPlayerInEncounterArea() && FactsQuerySum("MeditationStarted") <= 0
){
ownerTasksToPerformOnLeaveEncounter.Push
Back(ownerTask);
i += 1;
AddTimer('CheckMeditationTimer', 1.00000
0, true, /* NOP */, /* NOP */, true, true);
} else {
RunOwnerTask(ownerTask);
continue;
}
} else {
taskID = AddGameTimeTimer('RunOwnerTaskTimer', o

wnerTask.delay.gameTime, false, /* NOP */, /* NOP */, true, false);


dataManager.ownerTasksToPerform[i].ID = taskID;
i += 1;
}
}
i = 0;
while (i < dataManager.externalTasksToPerform.Size()){
externalTask = dataManager.externalTasksToPerform[i];
delay = GameTimeToSeconds(externalTask.delay.gameTime);
if (delay <= 0){
if (externalTask.triggerWhenOutsideOwnerEncounte
rArea && super.IsPlayerInEncounterArea() && FactsQuerySum("MeditationStarted") <
= 0){
externalTasksToPerformOnLeaveEncounter.P
ushBack(externalTask);
i += 1;
AddTimer('CheckMeditationTimer', 1.00000
0, true, /* NOP */, /* NOP */, true, true);
} else {
RunExternalTask(externalTask);
continue;
}
} else {
taskID = AddGameTimeTimer('RunExternalTaskTimer'
, externalTask.delay.gameTime, false, /* NOP */, /* NOP */, true, false);
dataManager.externalTasksToPerform[i].ID = taskI
D;
i += 1;
}
}
/* NOP */;
}
public function RunOwnerTask(task : SOwnerEncounterTaskParams){
var i : Int32;
var delay : Int32;
dataManager.RemoveOwnerTask(task);
if (task.creaturesGroupToEnable.Size() > 0){
i = 0;
i = 0;
while (i < task.creaturesGroupToEnable.Size()){
dataManager.EnableCreaturesGroup(task.creaturesG
roupToEnable[i], task.sourceName);
i += 1;
}
}
if (task.creaturesGroupToDisable.Size() > 0){
i = 0;
i = 0;
while (i < task.creaturesGroupToDisable.Size()){
dataManager.DisableCreaturesGroup(task.creatures
GroupToDisable[i], task.sourceName);
i += 1;
}
}
if (task.factOnTaskPerformed != "" && !FactsDoesExist(task.factO
nTaskPerformed)){
FactsAdd(task.factOnTaskPerformed, 1, -1);
}
if (task.forceDespawn){
ForceDespawnDetachedWithDelay(3.000000);

}
if (task.deactivateEncounter){
super.EnableEncounter(false);
return;
}
if (!task.deactivateEncounter){
if (!super.IsEnabled()){
super.EnableEncounter(true);
}
}
if (task.spawnTreeNodesToActivate.Size() > 0){
i = 0;
i = 0;
while (i < task.spawnTreeNodesToActivate.Size()){
super.EnableMember(task.spawnTreeNodesToActivate
[i], true);
i += 1;
}
}
if (task.spawnTreeNodesToDeactivate.Size() > 0){
i = 0;
i = 0;
while (i < task.spawnTreeNodesToDeactivate.Size()){
super.EnableMember(task.spawnTreeNodesToDeactiva
te[i], false);
i += 1;
}
}
if (task.encounterPhasetoActivate != 'None'){
super.SetSpawnPhase(task.encounterPhasetoActivate);
}
/* NOP */;
}
public function RunExternalTask(task : SExternalEncounterTaskParams){
var i : Int32;
var encounter : CEncounter;
var externalDataManager : CEncounterDataManager;
dataManager.RemoveExternalTask(task);
if (task.encounterTag != 'None'){
encounter = (CEncounter)theGame.GetEntityByTag(task.enco
unterTag);
if (!encounter){
return;
}
} else {
return;
}
externalDataManager = encounter.dataManager;
if (!externalDataManager){
encounter.InitializeEncounterDataManager();
externalDataManager = encounter.dataManager;
}
if (task.creaturesGroupToEnable.Size() > 0){
i = 0;
i = 0;
while (i < task.creaturesGroupToEnable.Size()){
externalDataManager.EnableCreaturesGroup(task.cr
eaturesGroupToEnable[i], task.sourceName);
i += 1;
}

}
if (task.creaturesGroupToDisable.Size() > 0){
i = 0;
i = 0;
while (i < task.creaturesGroupToDisable.Size()){
externalDataManager.DisableCreaturesGroup(task.c
reaturesGroupToDisable[i], task.sourceName);
i += 1;
}
}
if (task.factOnTaskPerformed != "" && !FactsDoesExist(task.factO
nTaskPerformed)){
FactsAdd(task.factOnTaskPerformed, 1, -1);
}
if (task.forceDespawn){
ForceDespawnDetachedWithDelay(3.000000);
}
if (task.shouldEncounterChangeState){
encounter.EnableEncounter(task.enableEncounter);
if (!task.enableEncounter){
return;
}
}
if (task.spawnTreeNodesToActivate.Size() > 0){
i = 0;
i = 0;
while (i < task.spawnTreeNodesToActivate.Size()){
encounter.EnableMember(task.spawnTreeNodesToActi
vate[i], true);
i += 1;
}
}
if (task.spawnTreeNodesToDeactivate.Size() > 0){
i = 0;
i = 0;
while (i < task.spawnTreeNodesToDeactivate.Size()){
encounter.EnableMember(task.spawnTreeNodesToDeac
tivate[i], false);
i += 1;
}
}
if (task.encounterPhasetoActivate != 'None'){
encounter.SetSpawnPhase(task.encounterPhasetoActivate);
}
/* NOP */;
}
public timer function RunOwnerTaskTimer(optional timeDelta : GameTime, o
ptional id : Int32){
var ownerTask : SOwnerEncounterTaskParams;
if (dataManager.GetOwnerTaskByID(id, ownerTask)){
if (ownerTask.triggerWhenOutsideOwnerEncounterArea && su
per.IsPlayerInEncounterArea() && FactsQuerySum("MeditationStarted") <= 0){
ownerTasksToPerformOnLeaveEncounter.PushBack(own
erTask);
AddTimer('CheckMeditationTimer', 1.000000, true,
/* NOP */, /* NOP */, true, true);
} else {
RunOwnerTask(ownerTask);
}
}

/* NOP */;
}
public timer function RunExternalTaskTimer(optional timeDelta : GameTime
, optional id : Int32){
var externalTask : SExternalEncounterTaskParams;
if (dataManager.GetExternalTaskByID(id, externalTask)){
if (externalTask.triggerWhenOutsideOwnerEncounterArea &&
super.IsPlayerInEncounterArea() && FactsQuerySum("MeditationStarted") <= 0){
externalTasksToPerformOnLeaveEncounter.PushBack(
externalTask);
AddTimer('CheckMeditationTimer', 1.000000, true,
/* NOP */, /* NOP */, true, true);
} else {
RunExternalTask(externalTask);
}
}
/* NOP */;
}
public timer function CheckMeditationTimer(optional timeDelta : Float, o
ptional id : Int32){
if (FactsQuerySum("MeditationStarted") > 0){
UpdateDelayedTasks();
}
/* NOP */;
}
}
class CAINpcBoxCarry extends CAINpcIdle{
public function Init(){
params = new CAINpcBoxCarryParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class IAISpawnTreeSubParameters{
}
struct SItemUpgradeListElement{
var itemId : SItemUniqueId;
var upgrade : SItemUpgrade;
}
class CAINpcBoxCarryParams extends CAINpcIdleParams{
public editable var workCarryItemTemplate : CEntityTemplate;
public editable var workCarryPickupPoint : CName;
public editable var workCarryDropPoint : CName;
}
abstract class IAIIdleFormationTree extends CAIIdleTree{
public editable var formation : CFormation;
}
class CAINpcIdleHorseRiderParams extends CAIRiderIdleParams{
}
import struct IAIActionTree{
}
class CAIWildHuntTwoHandedSwordDefaults extends CAINpcDefaults{

public function Init(){


super.Init();
combatTree = new CAIWildHuntTwoHandedSwordCombat in this;
combatTree.Init();
/* NOP */;
}
}
class CAIWildHuntTwoHandedSwordCombat extends CAINpcCombat{
public function Init(){
params = new CAIWildHuntTwoHandedSwordCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedSwordCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAIWildHuntTwoHandedSwordCombatStyle i
n this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAIWildHuntTwoHandedSwordCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAIWildHuntStyleTwoHandedSwordParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CAIDespawnParameters{
}
class CAIWildHuntStyleTwoHandedSwordParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior.params.attackAction = new CAIWildHuntTwoHandedSwo
rdAttackActionTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'basic_strike';
defenseActions.Clear();
defenseActions.PushBack(new CAIWildHuntCounterHitAction in this)
;
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}

class CAIWildHuntTwoHandedSwordAttackActionTree extends CAIAttackActionTree{


public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3DamageManagerProcessor extends CObject{
private var playerAttacker : CR4Player;
private var playerVictim : CR4Player;
private var action : W3DamageAction;
private var attackAction : W3Action_Attack;
private var weaponId : SItemUniqueId;
private var actorVictim : CActor;
private var actorAttacker : CActor;
private var dm : CDefinitionsManagerAccessor;
private var attackerMonsterCategory : EMonsterCategory;
private var victimMonsterCategory : EMonsterCategory;
private var victimCanBeHitByFists : Bool;
public function ProcessAction(act : W3DamageAction){
var abilityTag : CName;
var abilityName : CName;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var value : SAbilityAttributeValue;
var focusDrain : Float;
var rendLoad : Float;
var validDamage : Bool;
var usesSteel : Bool;
var usesSilver : Bool;
var usesVitality : Bool;
var usesEssence : Bool;
var bloodTrailParam : CBloodTrailEffect;
var i : Int32;
var abs : array<CName>;
var isFrozen : Bool;
var wasAlive : Bool;
var npc : CNewNPC;
var arrStr : array<String>;
var ciriPlayer : W3ReplacerCiri;
var buffs : array<EEffectType>;
if (!act || !act.victim){
return;
}
wasAlive = act.victim.IsAlive();
if (!wasAlive && act.GetEffectsCount() == 0){
return;
}
playerAttacker = (CR4Player)act.attacker;
npc = (CNewNPC)act.victim;
if (playerAttacker && npc && !npc.isAttackableByPlayer){
return;
}
super.InitializeActionVars(act);
if (playerVictim && attackAction && attackAction.IsActionMelee()
&& !attackAction.CanBeParried() && attackAction.IsParried()){
action.GetEffectTypes(buffs);
if (!buffs.Contains(9) && !buffs.Contains(6)){

action.SetParryStagger();
action.SetProcessBuffsIfNoDamage(true);
action.AddEffectInfo(46, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
action.SetHitAnimationPlayType(2);
action.SetCanPlayHitParticle(false);
action.RemoveBuffsByType(16);
}
}
if (actorAttacker && playerVictim && (W3PlayerWitcher)playerVict
im && GetWitcherPlayer().IsAnyQuenActive()){
FactsAdd("player_had_quen", /* NOP */, /* NOP */);
}
ProcessActionQuest(act);
isFrozen = actorVictim && actorVictim.HasBuff(11);
validDamage = ProcessActionDamage();
if (wasAlive && !action.victim.IsAlive()){
arrStr.PushBack(action.victim.GetDisplayName(/* NOP */))
;
if (npc && npc.WillBeUnconscious()){
theGame.witcherLog.AddCombatMessage(GetLocString
ByKeyExtWithParams("hud_combat_log_unconscious", /* NOP */, /* NOP */, arrStr, /
* NOP */), NULL, action.victim);
} else if (action.attacker && action.attacker.GetDisplay
Name(/* NOP */) != ""){
arrStr.PushBack(action.attacker.GetDisplayName(/
* NOP */));
theGame.witcherLog.AddCombatMessage(GetLocString
ByKeyExtWithParams("hud_combat_log_killed", /* NOP */, /* NOP */, arrStr, /* NOP
*/), action.attacker, action.victim);
} else {
theGame.witcherLog.AddCombatMessage(GetLocString
ByKeyExtWithParams("hud_combat_log_dies", /* NOP */, /* NOP */, arrStr, /* NOP *
/), NULL, action.victim);
}
}
ProcessActionReaction(isFrozen, wasAlive);
if (action.DealsAnyDamage() || action.ProcessBuffsIfNoDamage()){
ProcessActionBuffs();
}
if (!validDamage && action.GetEffectsCount() == 0){
LogAssert(false, "W3DamageManagerProcessor.ProcessAction
: action deals no damage and gives no buffs - investigate!");
if (theGame.CanLog()){
LogDMHits("*** Action has no valid damage and no
valid buffs - investigate!", action);
}
}
if (playerAttacker && attackAction){
if (npc.IsHuman()){
playerAttacker.PlayBattleCry('BattleCryHumansHit
', 0.050000, /* NOP */, /* NOP */);
} else {
playerAttacker.PlayBattleCry('BattleCryMonstersH
it', 0.050000, /* NOP */, /* NOP */);
}
if (attackAction.IsActionMelee()){
abilityTag = attackAction.GetAttackName();
if (!IsBasicAttack(abilityTag)){
abilityName = attackAction.GetAttackType

Name();
} else {
abilityName = abilityTag;
}
playerAttacker.IncreaseUninterruptedHitsCount();
if (action.DealsAnyDamage()){
ciriPlayer = (W3ReplacerCiri)playerAttac
ker;
if (ciriPlayer){
ciriPlayer.GainResource();
}
}
if (playerAttacker.IsLightAttack(attackAction.Ge
tAttackName())){
GCameraShake(0.100000, false, playerAtta
cker.GetWorldPosition(), 10, /* NOP */, /* NOP */, /* NOP */);
}
if (SkillNameToEnum(attackAction.GetAttackTypeNa
me()) == 17){
rendLoad = playerAttacker.GetSpecialAtta
ckTimeRatio();
rendLoad = MinF(rendLoad * playerAttacke
r.GetStatMax(4), playerAttacker.GetStat(4, /* NOP */));
rendLoad = FloorF(rendLoad);
playerAttacker.DrainFocus(rendLoad);
thePlayer.OnSpecialAttackHeavyActionProc
ess();
} else {
value = playerAttacker.GetAttributeValue
('focus_gain', /* NOP */, /* NOP */);
if (playerAttacker.CanUseSkill(35)){
value += playerAttacker.GetSkill
AttributeValue(35, 'focus_gain', false, true) * playerAttacker.GetSkillLevel(35)
;
}
playerAttacker.GainStat(4, 0.100000 * 1
+ CalculateAttributeValue(value, /* NOP */));
}
if (actorVictim && ShouldProcessTutorial('Tutori
alWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver') && GetA
ttitudeBetween(actorVictim, playerAttacker) == 2){
usesSteel = playerAttacker.inv.IsItemSte
elSwordUsableByPlayer(weaponId);
usesSilver = playerAttacker.inv.IsItemSi
lverSwordUsableByPlayer(weaponId);
usesVitality = actorVictim.UsesVitality(
);
usesEssence = actorVictim.UsesEssence();
if (usesSilver && usesVitality){
FactsAdd('tut_wrong_sword_silver
', 1, /* NOP */);
} else if (usesSteel && usesEssence){
FactsAdd('tut_wrong_sword_steel'
, 1, /* NOP */);
} else if (FactsQuerySum('tut_wrong_swor
d_steel') && usesSilver && usesEssence){
FactsAdd('tut_proper_sword_silve
r', 1, /* NOP */);
FactsRemove('tut_wrong_sword_ste
el');

} else if (FactsQuerySum('tut_wrong_swor
d_silver') && usesSteel && usesVitality){
FactsAdd('tut_proper_sword_steel
', 1, /* NOP */);
FactsRemove('tut_wrong_sword_sil
ver');
}
}
} else if (attackAction.IsActionRanged()){
if (playerAttacker.CanUseSkill(30)){
value = playerAttacker.GetSkillAttribute
Value(30, 'focus_gain', false, true) * playerAttacker.GetSkillLevel(30);
playerAttacker.GainStat(4, CalculateAttr
ibuteValue(value, /* NOP */));
}
if (playerAttacker.CanUseSkill(27) && attackActi
on.IsCriticalHit()){
abs = actorVictim.GetAbilities(false);
i = abs.Size() - 1;
while (i >= 0){
if (!dm.AbilityHasTag(abs[i], th
eGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i])){
abs.EraseFast(i);
}
i -= 1;
}
if (abs.Size() > 0){
value = playerAttacker.GetSkillA
ttributeValue(27, 'duration', true, true) * playerAttacker.GetSkillLevel(27);
actorVictim.BlockAbility(abs[Ran
dRange(abs.Size(), /* NOP */)], true, CalculateAttributeValue(value, /* NOP */))
;
}
}
}
}
if (action.DealsAnyDamage()){
bloodTrailParam = (CBloodTrailEffect)actorVictim.GetGame
playEntityParam('CBloodTrailEffect');
if (bloodTrailParam){
act.attacker.GetInventory().PlayItemEffect(weapo
nId, bloodTrailParam.GetEffectName());
}
}
if (actorVictim == GetWitcherPlayer() && action.DealsAnyDamage()
){
if (actorAttacker && attackAction){
if (actorAttacker.IsHeavyAttack(attackAction.Get
AttackName())){
focusDrain = CalculateAttributeValue(the
Player.GetAttributeValue('heavy_attack_focus_drain', /* NOP */, /* NOP */), /* N
OP */);
} else if (actorAttacker.IsSuperHeavyAttack(atta
ckAction.GetAttackName())){
focusDrain = CalculateAttributeValue(the
Player.GetAttributeValue('super_heavy_attack_focus_drain', /* NOP */, /* NOP */)
, /* NOP */);
} else {
focusDrain = CalculateAttributeValue(the
Player.GetAttributeValue('light_attack_focus_drain', /* NOP */, /* NOP */), /* N

OP */);
}
} else {
focusDrain = CalculateAttributeValue(thePlayer.G
etAttributeValue('light_attack_focus_drain', /* NOP */, /* NOP */), /* NOP */);
}
if (GetWitcherPlayer().CanUseSkill(31)){
focusDrain *= 1 - CalculateAttributeValue(thePla
yer.GetSkillAttributeValue(31, 'focus_drain_reduction', false, true), /* NOP */)
* thePlayer.GetSkillLevel(31);
}
thePlayer.DrainFocus(focusDrain);
}
if (action.EndsQuen() && actorVictim){
actorVictim.FinishQuen();
}
PostProcessActionTutorial();
/* NOP */;
}
private final function InitializeActionVars(act : W3DamageAction){
var tmpName : CName;
var tmpBool : Bool;
action = act;
playerAttacker = (CR4Player)action.attacker;
playerVictim = (CR4Player)action.victim;
attackAction = (W3Action_Attack)action;
actorVictim = (CActor)action.victim;
actorAttacker = (CActor)action.attacker;
dm = theGame.GetDefinitionsManager();
if (attackAction){
weaponId = attackAction.GetWeaponId();
}
theGame.GetMonsterParamsForActor(actorVictim, victimMonsterCateg
ory, tmpName, tmpBool, tmpBool, victimCanBeHitByFists);
if (actorAttacker){
theGame.GetMonsterParamsForActor(actorAttacker, attacker
MonsterCategory, tmpName, tmpBool, tmpBool, tmpBool);
}
/* NOP */;
}
private function ProcessActionQuest(act : W3DamageAction){
var victimTags : array<CName>;
var attackerTags : array<CName>;
victimTags = action.victim.GetTags();
if (action.attacker){
attackerTags = action.attacker.GetTags();
}
AddHitFacts(victimTags, attackerTags, "_weapon_hit", /* NOP */,
/* NOP */);
if ((W3MonsterClue)action.victim){
action.victim.OnWeaponHit(act);
}
/* NOP */;
}
private function PostProcessActionTutorial(){
if (actorAttacker == thePlayer && ShouldProcessTutorial('Tutoria
lLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks')){
if (attackAction && attackAction.IsActionMelee()){
if (thePlayer.IsLightAttack(attackAction.GetAtta
ckName())){

theGame.GetTutorialSystem().IncreaseGera
ltsLightAttacksCount(action.victim.GetTags());
} else if (thePlayer.IsHeavyAttack(attackAction.
GetAttackName())){
theGame.GetTutorialSystem().IncreaseGera
ltsHeavyAttacksCount(action.victim.GetTags());
}
}
} else if (actorVictim == thePlayer && ShouldProcessTutorial('Tu
torialCounter') || ShouldProcessTutorial('TutorialParry') || ShouldProcessTutori
al('TutorialDodge')){
if (attackAction && attackAction.IsActionMelee()){
if (attackAction.CanBeDodged() && attackAction.W
asDodged()){
} else if (attackAction.CanBeParried()){
if (attackAction.IsCountered()){
theGame.GetTutorialSystem().Incr
easeCounters();
} else if (attackAction.IsParried()){
theGame.GetTutorialSystem().Incr
easeParries();
}
}
if (attackAction.CanBeDodged() && !attackAction.
WasDodged()){
GameplayFactsAdd("tut_failed_dodge", 1,
1);
GameplayFactsAdd("tut_failed_roll", 1, 1
);
}
}
}
/* NOP */;
}
private function ProcessActionDamage() : Bool{
var directDmgIndex : Int32;
var size : Int32;
var i : Int32;
var dmgInfos : array<SRawDamage>;
var immortalityMode : EActorImmortalityMode;
var dmgValue : Float;
var anyDamageProcessed : Bool;
var victimHealthPercBeforeHit : Float;
var frozenAdditionalDamage : Float;
var powerMod : SAbilityAttributeValue;
var witcher : W3PlayerWitcher;
var canLog : Bool;
canLog = theGame.CanLog();
action.SetAllProcessedDamageAs(0);
size = action.GetDTs(dmgInfos);
action.SetDealtFireDamage(false);
if (!actorVictim || !actorVictim.UsesVitality() && !actorVictim.
UsesEssence()){
i = 0;
while (i < dmgInfos.Size()){
if (dmgInfos[i].dmgType == theGame.params.DAMAGE
_NAME_FIRE && dmgInfos[i].dmgVal > 0){
action.victim.OnFireHit((CGameplayEntity
)action.causer);
break;

}
i += 1;
}
if (!actorVictim.abilityManager){
actorVictim.OnDeath(action);
}
return false;
}
if (actorVictim.UsesVitality()){
victimHealthPercBeforeHit = actorVictim.GetStatPercents(
0);
} else {
victimHealthPercBeforeHit = actorVictim.GetStatPercents(
1);
}
ProcessDamageIncrease(dmgInfos);
if (canLog){
LogBeginning();
}
ProcessCriticalHitCheck();
ProcessOnBeforeHitChecks();
powerMod = GetAttackersPowerMod();
anyDamageProcessed = false;
directDmgIndex = -1;
witcher = GetWitcherPlayer();
i = 0;
while (i < size){
if (dmgInfos[i].dmgVal == 0){
} else if (dmgInfos[i].dmgType == theGame.params.DAMAGE_
NAME_DIRECT){
directDmgIndex = i;
} else if (dmgInfos[i].dmgType == theGame.params.DAMAGE_
NAME_POISON && witcher == actorVictim && witcher.HasBuff(26) && witcher.GetPotio
nBuffLevel(26) == 3){
witcher.GainStat(0, dmgInfos[i].dmgVal);
if (canLog){
LogDMHits("", action);
LogDMHits("*** Player absorbs poison dam
age from level 3 Golden Oriole potion: " + dmgInfos[i].dmgVal, action);
}
dmgInfos[i].dmgVal = 0;
} else {
if (canLog){
LogDMHits("", action);
LogDMHits("*** Incoming " + NoTrailZeros
(dmgInfos[i].dmgVal) + " " + dmgInfos[i].dmgType + " damage", action);
if (action.IsDoTDamage()){
LogDMHits("DoT's current dt = "
+ NoTrailZeros(action.GetDoTdt()) + ", estimated dps = " + NoTrailZeros(dmgInfos
[i].dmgVal / action.GetDoTdt()), action);
}
}
anyDamageProcessed = true;
dmgValue = MaxF(0, CalculateDamage(dmgInfos[i],
powerMod));
if (DamageHitsEssence(dmgInfos[i].dmgType)){
action.processedDmg.essenceDamage += dmg
Value;
}
if (DamageHitsVitality(dmgInfos[i].dmgType)){

action.processedDmg.vitalityDamage += dm
gValue;
}
if (DamageHitsMorale(dmgInfos[i].dmgType)){
action.processedDmg.moraleDamage += dmgV
alue;
}
if (DamageHitsStamina(dmgInfos[i].dmgType)){
action.processedDmg.staminaDamage += dmg
Value;
}
}
i += 1;
}
if (size == 0 && canLog){
LogDMHits("*** There is no incoming damage set (probably
only buffs).", action);
}
if (canLog){
LogDMHits("", action);
LogDMHits("Processing block, parry, immortality, signs a
nd other GLOBAL damage reductions...", action);
}
if (actorVictim){
actorVictim.ReduceDamage(action);
}
if (directDmgIndex != -1){
anyDamageProcessed = true;
if (action.GetIgnoreImmortalityMode() || !actorVictim.Is
Immortal() && !actorVictim.IsInvulnerable() && !actorVictim.IsKnockedUnconscious
()){
action.processedDmg.vitalityDamage += dmgInfos[d
irectDmgIndex].dmgVal;
action.processedDmg.essenceDamage += dmgInfos[di
rectDmgIndex].dmgVal;
} else if (actorVictim.IsInvulnerable()){
} else if (actorVictim.IsImmortal()){
action.processedDmg.vitalityDamage += MinF(dmgIn
fos[directDmgIndex].dmgVal, actorVictim.GetStat(0, /* NOP */) - 1);
action.processedDmg.essenceDamage += MinF(dmgInf
os[directDmgIndex].dmgVal, actorVictim.GetStat(1, /* NOP */) - 1);
}
}
if (action.HasDealtFireDamage()){
action.victim.OnFireHit((CGameplayEntity)action.causer);
}
ProcessInstantKill();
ProcessActionDamage_DealDamage();
if (playerAttacker && witcher){
witcher.SetRecentlyCountered(false);
}
if (attackAction && !attackAction.IsCountered() && playerVictim
&& attackAction.IsActionMelee()){
theGame.GetGamerProfile().ResetStat(6);
}
ProcessActionDamage_ReduceDurability();
if (playerAttacker && actorVictim){
if (playerAttacker.inv.ItemHasOilApplied(weaponId) && !p
layerAttacker.CanUseSkill(63) || playerAttacker.GetSkillLevel(63) < 3){
playerAttacker.ReduceOilAmmo(weaponId, /* NOP */

);
if (ShouldProcessTutorial('TutorialOilAmmo')){
FactsAdd("tut_used_oil_in_combat", /* NO
P */, /* NOP */);
}
}
playerAttacker.inv.ReduceItemRepairObjectBonusCharge(wea
ponId);
}
if (actorVictim && actorAttacker && !action.GetCannotReturnDamag
e()){
ProcessActionReturnedDamage();
}
return anyDamageProcessed;
/* NOP */;
}
private function ProcessInstantKill(){
var instantKill : Float;
var focus : Float;
if (!actorVictim || !attackAction || !actorAttacker || actorVict
im.HasAbility('InstantKillImmune') || actorVictim.IsImmortal() || actorVictim.Is
Invulnerable()){
return;
}
instantKill = CalculateAttributeValue(actorAttacker.GetInventory
().GetItemAttributeValue(weaponId, 'instant_kill_chance', /* NOP */, /* NOP */),
/* NOP */);
if (attackAction.IsActionMelee() || attackAction.IsActionRanged(
) && playerAttacker && thePlayer.CanUseSkill(18) && !playerAttacker.inv.IsItemFi
sts(weaponId)){
focus = thePlayer.GetStat(4, /* NOP */);
if (focus >= 1){
instantKill += focus * CalculateAttributeValue(t
hePlayer.GetSkillAttributeValue(18, 'instant_kill_chance', false, true), /* NOP
*/) * thePlayer.GetSkillLevel(18);
}
}
if (RandF() < instantKill){
if (theGame.CanLog()){
LogDMHits("Instant kill!! (" + NoTrailZeros(inst
antKill * 100) + "% chance", action);
}
action.processedDmg.vitalityDamage += actorVictim.GetSta
t(0, /* NOP */);
action.processedDmg.essenceDamage += actorVictim.GetStat
(1, /* NOP */);
attackAction.SetCriticalHit();
attackAction.SetInstantKill();
if (playerAttacker){
theSound.SoundEvent('cmb_play_deadly_hit');
theGame.SetTimeScale(0.200000, theGame.GetTimesc
aleSource(14), theGame.GetTimescalePriority(14), true, true);
thePlayer.AddTimer('RemoveInstantKillSloMo', 0.2
00000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
private function ProcessOnBeforeHitChecks(){
var isSilverSword : Bool;

var isSteelSword : Bool;


var oilItemName : CName;
var effectAbilityName : CName;
var monsterBonusType : CName;
var effectType : EEffectType;
var null : SAbilityAttributeValue;
var monsterBonusVal : SAbilityAttributeValue;
var oilLevel : Int32;
var skillLevel : Int32;
var i : Int32;
var baseChance : Float;
var perOilLevelChance : Float;
var chance : Float;
var buffs : array<CName>;
if (playerAttacker && actorVictim && attackAction && attackActio
n.IsActionMelee() && playerAttacker.CanUseSkill(69)){
isSilverSword = playerAttacker.inv.IsItemSilverSwordUsab
leByPlayer(weaponId);
if (!isSilverSword){
isSteelSword = playerAttacker.inv.IsItemSteelSwo
rdUsableByPlayer(weaponId);
} else {
isSteelSword = false;
}
if (isSilverSword || isSteelSword){
oilItemName = playerAttacker.inv.GetOilNameOnSwo
rd(isSteelSword);
if (dm.IsItemAlchemyItem(oilItemName)){
monsterBonusType = MonsterCategoryToAtta
ckPowerBonus(victimMonsterCategory);
monsterBonusVal = playerAttacker.inv.Get
ItemAttributeValue(weaponId, monsterBonusType, /* NOP */, /* NOP */);
if (monsterBonusVal != null){
oilLevel = CalculateAttributeVal
ue(playerAttacker.inv.GetItemAttributeValue(weaponId, 'level', /* NOP */, /* NOP
*/), /* NOP */) - 1;
skillLevel = playerAttacker.GetS
killLevel(69);
baseChance = CalculateAttributeV
alue(playerAttacker.GetSkillAttributeValue(69, 'skill_chance', false, true), /*
NOP */);
perOilLevelChance = CalculateAtt
ributeValue(playerAttacker.GetSkillAttributeValue(69, 'oil_level_chance', false,
true), /* NOP */);
chance = baseChance * skillLevel
+ perOilLevelChance * oilLevel;
if (RandF() < chance){
dm.GetContainedAbilities
(playerAttacker.GetSkillAbilityName(69), buffs);
i = 0;
while (i < buffs.Size())
{
EffectNameToType
(buffs[i], effectType, effectAbilityName);
action.AddEffect
Info(effectType, /* NOP */, /* NOP */, effectAbilityName, /* NOP */, /* NOP */);
i += 1;
}
}
}

}
}
}
/* NOP */;
}
private function ProcessCriticalHitCheck(){
var critChance : Float;
var critDamageBonus : Float;
var canLog : Bool;
var arrStr : array<String>;
var samum : CBaseGameplayEffect;
canLog = theGame.CanLog();
if (playerAttacker && attackAction && attackAction.IsActionMelee
() || attackAction.IsActionRanged()){
if (SkillEnumToName(17) == attackAction.GetAttackTypeNam
e()){
critChance += CalculateAttributeValue(playerAtta
cker.GetSkillAttributeValue(17, theGame.params.CRITICAL_HIT_CHANCE, false, true)
, /* NOP */) * playerAttacker.GetSkillLevel(17);
}
if (GetWitcherPlayer() && GetWitcherPlayer().HasRecently
Countered() && playerAttacker.CanUseSkill(26) && playerAttacker.GetSkillLevel(26
) > 2){
critChance += CalculateAttributeValue(playerAtta
cker.GetSkillAttributeValue(26, theGame.params.CRITICAL_HIT_CHANCE, false, true)
, /* NOP */);
}
critChance += playerAttacker.GetCriticalHitChance(player
Attacker.IsHeavyAttack(attackAction.GetAttackName()), actorVictim, victimMonster
Category);
if (attackAction.IsActionRanged() && playerAttacker.CanU
seSkill(22)){
critChance += CalculateAttributeValue(playerAtta
cker.GetSkillAttributeValue(22, theGame.params.CRITICAL_HIT_CHANCE, false, true)
, /* NOP */) * playerAttacker.GetSkillLevel(22);
}
if (action.GetIsHeadShot()){
critChance += theGame.params.HEAD_SHOT_CRIT_CHAN
CE_BONUS;
}
if (actorVictim && actorVictim.IsAttackerAtBack(playerAt
tacker)){
critChance += theGame.params.BACK_ATTACK_CRIT_CH
ANCE_BONUS;
}
samum = actorVictim.GetBuff(14, 'petard');
if (samum && samum.GetBuffLevel() == 3){
critChance += 1.000000;
}
if (canLog){
critDamageBonus = 1 + CalculateAttributeValue(ac
torAttacker.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, actorVict
im.IsAttackerAtBack(playerAttacker)), /* NOP */);
if (playerAttacker.IsHeavyAttack(attackAction.Ge
tAttackName())){
critDamageBonus += CalculateAttributeVal
ue(actorAttacker.GetAttributeValue('critical_hit_chance_fast_style', /* NOP */,
/* NOP */), /* NOP */);
}
critDamageBonus = 100 * critDamageBonus;

LogDMHits("", action);
LogDMHits("Trying critical hit (" + NoTrailZeros
(critChance * 100) + "% chance, dealing " + NoTrailZeros(critDamageBonus) + "% d
amage)...", action);
}
if (RandF() < critChance){
attackAction.SetCriticalHit();
if (canLog){
LogDMHits("********************", action
);
LogDMHits("*** CRITICAL HIT ***", action
);
LogDMHits("********************", action
);
}
arrStr.PushBack(action.attacker.GetDisplayName(/
* NOP */));
theGame.witcherLog.AddCombatMessage(theGame.witc
herLog.COLOR_GOLD_BEGIN + GetLocStringByKeyExtWithParams("hud_combat_log_critica
l_hit", /* NOP */, /* NOP */, arrStr, /* NOP */) + theGame.witcherLog.COLOR_GOLD
_END, action.attacker, NULL);
} else if (canLog){
LogDMHits("... nope", action);
}
}
/* NOP */;
}
private function LogBeginning(){
var logStr : String;
if (!theGame.CanLog()){
return;
}
LogDMHits("----------------------------------------------------------------------------------", action);
logStr = "Beginning hit processing from <<" + action.attacker +
">> to <<" + action.victim + ">> via <<" + action.causer + ">>";
if (attackAction){
logStr += " using AttackType <<" + attackAction.GetAttac
kTypeName() + ">>";
}
logStr += ":";
LogDMHits(logStr, action);
LogDMHits("", action);
LogDMHits("Target stats before damage dealt are:", action);
if (actorVictim){
if (actorVictim.UsesVitality()){
LogDMHits("Vitality = " + NoTrailZeros(actorVict
im.GetStat(0, /* NOP */)), action);
}
if (actorVictim.UsesEssence()){
LogDMHits("Essence = " + NoTrailZeros(actorVicti
m.GetStat(1, /* NOP */)), action);
}
if (actorVictim.GetStatMax(2) > 0){
LogDMHits("Stamina = " + NoTrailZeros(actorVicti
m.GetStat(2, true)), action);
}
if (actorVictim.GetStatMax(5) > 0){
LogDMHits("Morale = " + NoTrailZeros(actorVictim
.GetStat(5, /* NOP */)), action);

}
} else {
LogDMHits("Undefined - victim is not a CActor and theref
ore has no stats", action);
}
/* NOP */;
}
private function ProcessDamageIncrease(dmgInfos : array<SRawDamage>){
var difficultyDamageMultiplier : Float;
var rendLoad : Float;
var rendBonus : Float;
var i : Int32;
var frozenBuff : W3Effect_Frozen;
var frozenDmgInfo : SRawDamage;
var hadFrostDamage : Bool;
var mpac : CMovingPhysicalAgentComponent;
var rendBonusPerPoint : SAbilityAttributeValue;
var witcherAttacker : W3PlayerWitcher;
if (actorAttacker && !actorAttacker.IgnoresDifficultySettings()
&& !action.IsDoTDamage()){
difficultyDamageMultiplier = CalculateAttributeValue(act
orAttacker.GetAttributeValue(theGame.params.DIFFICULTY_DMG_MULTIPLIER, /* NOP */
, /* NOP */), /* NOP */);
i = 0;
while (i < dmgInfos.Size()){
dmgInfos[i].dmgVal = dmgInfos[i].dmgVal * diffic
ultyDamageMultiplier;
i += 1;
}
}
if (actorVictim && !action.IsDoTDamage() && actorVictim.HasBuff(
11) && (W3AardProjectile)action.causer || (W3AardEntity)action.causer || action.
DealsPhysicalOrSilverDamage()){
frozenBuff = (W3Effect_Frozen)actorVictim.GetBuff(11, /*
NOP */);
frozenDmgInfo.dmgVal = frozenBuff.GetAdditionalDamagePer
cents() * actorVictim.GetMaxHealth();
hadFrostDamage = false;
i = 0;
while (i < dmgInfos.Size()){
if (dmgInfos[i].dmgType == theGame.params.DAMAGE
_NAME_FROST){
dmgInfos[i].dmgVal += frozenDmgInfo.dmgV
al;
hadFrostDamage = true;
break;
}
i += 1;
}
if (!hadFrostDamage){
frozenDmgInfo.dmgType = theGame.params.DAMAGE_NA
ME_FROST;
dmgInfos.PushBack(frozenDmgInfo);
}
actorVictim.RemoveAllBuffsOfType(11);
action.AddEffectInfo(10, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
}
if (actorVictim){
mpac = (CMovingPhysicalAgentComponent)actorVictim.GetMov

ingAgentComponent();
if (mpac && mpac.IsDiving()){
mpac = (CMovingPhysicalAgentComponent)actorAttac
ker.GetMovingAgentComponent();
if (mpac && mpac.IsDiving()){
action.SetUnderwaterDisplayDamageHack();
if (playerAttacker && attackAction && at
tackAction.IsActionRanged()){
i = 0;
while (i < dmgInfos.Size()){
dmgInfos[i].dmgVal *= 1
+ theGame.params.UNDERWATER_CROSSBOW_DAMAGE_BONUS;
i += 1;
}
}
}
}
}
if (playerAttacker && attackAction && SkillNameToEnum(attackActi
on.GetAttackTypeName()) == 17){
witcherAttacker = (W3PlayerWitcher)playerAttacker;
rendLoad = witcherAttacker.GetSpecialAttackTimeRatio();
rendLoad = MinF(rendLoad * playerAttacker.GetStatMax(4),
playerAttacker.GetStat(4, /* NOP */));
if (rendLoad >= 1){
rendBonusPerPoint = witcherAttacker.GetSkillAttr
ibuteValue(17, 'adrenaline_final_damage_bonus', false, true);
rendBonus = FloorF(rendLoad) * rendBonusPerPoint
.valueMultiplicative;
i = 0;
while (i < dmgInfos.Size()){
dmgInfos[i].dmgVal *= 1 + rendBonus;
i += 1;
}
}
}
/* NOP */;
}
private function ProcessActionReturnedDamage(){
var witcher : W3PlayerWitcher;
var quen : W3QuenEntity;
var params : SCustomEffectParams;
var processFireShield : Bool;
if (attackerMonsterCategory == 2 || attackerMonsterCategory == 6
&& actorVictim.HasBuff(22)){
ProcessActionBlackBloodReturnedDamage();
}
if (action.IsActionMelee() && actorVictim.HasAbility('Thorns')){
ProcessActionThornDamage();
}
if (playerVictim && !playerAttacker && actorAttacker && attackAc
tion && attackAction.IsActionMelee() && thePlayer.HasBuff(98)){
ProcessActionLeshenMutagenDamage();
}
if (action.IsActionMelee() && actorVictim.HasAbility('FireShield
')){
witcher = GetWitcherPlayer();
processFireShield = true;
if (playerAttacker == witcher){
quen = (W3QuenEntity)witcher.GetSignEntity(3);

if (quen && quen.IsAnyQuenActive()){


processFireShield = false;
}
}
if (processFireShield){
params.effectType = 18;
params.creator = actorVictim;
params.sourceName = actorVictim.GetName();
params.effectValue.valueMultiplicative = 0.01000
0;
actorAttacker.AddEffectCustom(params);
}
}
if (actorAttacker.UsesEssence()){
ProcessSilverStudsReturnedDamage();
}
/* NOP */;
}
private function ProcessActionLeshenMutagenDamage(){
var damageAction : W3DamageAction;
var returnedDamage : Float;
var pts : Float;
var perc : Float;
var mutagen : W3Mutagen26_Effect;
mutagen = (W3Mutagen26_Effect)playerVictim.GetBuff(98, /* NOP */
);
mutagen.GetReturnedDamage(pts, perc);
if (pts <= 0 && perc <= 0){
return;
}
returnedDamage = pts + perc * action.GetDamageValueTotal();
damageAction = new W3DamageAction in this;
damageAction.Initialize(action.victim, action.attacker, NULL, "M
utagen26", 0, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
damageAction.SetCannotReturnDamage(true);
damageAction.SetHitAnimationPlayType(2);
damageAction.AddDamage(theGame.params.DAMAGE_NAME_SILVER, return
edDamage);
damageAction.AddDamage(theGame.params.DAMAGE_NAME_PHYSICAL, retu
rnedDamage);
theGame.damageMgr.ProcessAction(damageAction);
delete damageAction;
/* NOP */;
}
private function ProcessSilverStudsReturnedDamage(){
var damageAction : W3DamageAction;
var returnedDamage : Float;
returnedDamage = CalculateAttributeValue(actorVictim.GetAttribut
eValue('returned_silver_damage', /* NOP */, /* NOP */), /* NOP */);
if (returnedDamage <= 0){
return;
}
damageAction = new W3DamageAction in this;
damageAction.Initialize(action.victim, action.attacker, NULL, "S
ilverStuds", 0, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /
* NOP */);
damageAction.SetCannotReturnDamage(true);
damageAction.SetHitAnimationPlayType(2);
damageAction.AddDamage(theGame.params.DAMAGE_NAME_SILVER, return

edDamage);
theGame.damageMgr.ProcessAction(damageAction);
delete damageAction;
/* NOP */;
}
private function ProcessActionBlackBloodReturnedDamage(){
var returnedAction : W3DamageAction;
var returnVal : SAbilityAttributeValue;
var bb : W3Potion_BlackBlood;
var potionLevel : Int32;
var returnedDamage : Float;
if (action.processedDmg.vitalityDamage <= 0){
return;
}
bb = (W3Potion_BlackBlood)actorVictim.GetBuff(22, /* NOP */);
potionLevel = bb.GetBuffLevel();
returnedAction = new W3DamageAction in this;
returnedAction.Initialize(action.victim, action.attacker, bb, "B
lackBlood", 0, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
returnedAction.SetCannotReturnDamage(true);
returnVal = bb.GetReturnDamageValue();
if (potionLevel == 1){
returnedAction.SetHitAnimationPlayType(2);
} else {
returnedAction.SetHitAnimationPlayType(1);
returnedAction.SetHitReactionType(4, /* NOP */);
}
returnedDamage = returnVal.valueBase + action.processedDmg.vital
ityDamage * returnVal.valueMultiplicative + returnVal.valueAdditive;
returnedAction.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, retu
rnedDamage);
theGame.damageMgr.ProcessAction(returnedAction);
delete returnedAction;
/* NOP */;
}
private function ProcessActionThornDamage(){
var damageAction : W3DamageAction;
var damageVal : SAbilityAttributeValue;
var damage : Float;
var inv : CInventoryComponent;
var damageNames : array<CName>;
damageAction = new W3DamageAction in this;
damageAction.Initialize(action.victim, action.attacker, NULL, "T
horns", 1, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
damageAction.SetCannotReturnDamage(true);
damageVal = actorVictim.GetAttributeValue('light_attack_damage_v
itality', /* NOP */, /* NOP */);
inv = actorAttacker.GetInventory();
inv.GetWeaponDTNames(weaponId, damageNames);
damageVal.valueBase = actorAttacker.GetTotalWeaponDamage(weaponI
d, damageNames[0], GetInvalidUniqueId());
damageVal.valueBase *= 0.100000;
if (damageVal.valueBase == 0){
damageVal.valueBase = 10;
}
damage = damageVal.valueBase + action.processedDmg.vitalityDamag
e * damageVal.valueMultiplicative + damageVal.valueAdditive;
damageAction.AddDamage(theGame.params.DAMAGE_NAME_PIERCING, dama

ge);
damageAction.SetHitAnimationPlayType(1);
theGame.damageMgr.ProcessAction(damageAction);
delete damageAction;
/* NOP */;
}
private function GetAttackersPowerMod() : SAbilityAttributeValue{
var powerMod : SAbilityAttributeValue;
var criticalDamageBonus : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var mutagen : CBaseGameplayEffect;
powerMod = action.GetPowerStatValue();
if (powerMod.valueAdditive == 0 && powerMod.valueBase == 0 && po
werMod.valueMultiplicative == 0 && theGame.CanLog()){
LogDMHits("Attacker has power stat of 0!", action);
}
if (playerAttacker && attackAction && playerAttacker.IsHeavyAtta
ck(attackAction.GetAttackName())){
powerMod.valueMultiplicative -= 0.833000;
}
if (playerAttacker && (W3IgniProjectile)action.causer){
powerMod.valueMultiplicative = 1 + powerMod.valueMultipl
icative - 1 * theGame.params.IGNI_SPELL_POWER_MILT;
}
if (playerAttacker && (W3AardProjectile)action.causer){
powerMod.valueMultiplicative = 1;
}
if (attackAction && attackAction.IsCriticalHit()){
criticalDamageBonus = actorAttacker.GetCriticalHitDamage
Bonus(weaponId, victimMonsterCategory, actorVictim.IsAttackerAtBack(playerAttack
er));
if (actorAttacker.IsHeavyAttack(attackAction.GetAttackNa
me())){
criticalDamageBonus += actorAttacker.GetAttribut
eValue('critical_hit_chance_fast_style', /* NOP */, /* NOP */);
}
if (playerAttacker){
if (playerAttacker.IsHeavyAttack(attackAction.Ge
tAttackName()) && playerAttacker.CanUseSkill(23)){
criticalDamageBonus += playerAttacker.Ge
tSkillAttributeValue(23, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)
* playerAttacker.GetSkillLevel(23);
} else if (!playerAttacker.IsHeavyAttack(attackA
ction.GetAttackName()) && playerAttacker.CanUseSkill(32)){
criticalDamageBonus += playerAttacker.Ge
tSkillAttributeValue(32, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)
* playerAttacker.GetSkillLevel(32);
}
}
powerMod.valueMultiplicative += CalculateAttributeValue(
criticalDamageBonus, /* NOP */);
}
if (actorVictim && playerAttacker){
if (playerAttacker.HasBuff(77) && playerAttacker.GetStat
(0, /* NOP */) == playerAttacker.GetStatMax(0)){
mutagen = playerAttacker.GetBuff(77, /* NOP */);
dm.GetAbilityAttributeValue(mutagen.GetAbilityNa
me(), 'damageIncrease', min, max);
powerMod += GetAttributeRandomizedValue(min, max

);
}
}
return powerMod;
/* NOP */;
}
private function GetDamageResists(dmgType : CName, resistPts : Float, re
sistPerc : Float){
var armorReduction : SAbilityAttributeValue;
var armorReductionPerc : SAbilityAttributeValue;
var skillArmorReduction : SAbilityAttributeValue;
var bonusReduct : Float;
var bonusResist : Float;
var maxOilCharges : Float;
var oilCharges : Int32;
var mutagenBuff : W3Mutagen28_Effect;
var appliedOilName : CName;
var vsMonsterResistReduction : CName;
if (attackAction && attackAction.IsActionMelee() && actorAttacke
r.GetInventory().IsItemFists(weaponId) && !actorVictim.UsesEssence()){
return;
}
if (actorVictim){
actorVictim.GetResistValue(GetResistForDamage(dmgType, a
ction.IsDoTDamage()), resistPts, resistPerc);
if (playerVictim && actorAttacker && playerVictim.CanUse
Skill(62)){
GetOilProtectionAgainstMonster(dmgType, bonusRes
ist, bonusReduct);
resistPerc += bonusResist * playerVictim.GetSkil
lLevel(62);
}
if (playerVictim && actorAttacker && playerVictim.HasBuf
f(100)){
mutagenBuff = (W3Mutagen28_Effect)playerVictim.G
etBuff(100, /* NOP */);
mutagenBuff.GetProtection(attackerMonsterCategor
y, dmgType, action.IsDoTDamage(), bonusResist, bonusReduct);
resistPts += bonusReduct;
resistPerc += bonusResist;
}
if (actorAttacker){
armorReduction = actorAttacker.GetAttributeValue
('armor_reduction', /* NOP */, /* NOP */);
armorReductionPerc = actorAttacker.GetAttributeV
alue('armor_reduction_perc', /* NOP */, /* NOP */);
if (playerAttacker){
vsMonsterResistReduction = MonsterCatego
ryToResistReduction(victimMonsterCategory);
appliedOilName = playerAttacker.inv.GetS
wordOil(weaponId);
if (dm.ItemHasAttribute(appliedOilName,
true, vsMonsterResistReduction)){
oilCharges = playerAttacker.GetC
urrentOilAmmo(weaponId);
maxOilCharges = playerAttacker.G
etMaxOilAmmo(weaponId);
armorReductionPerc.valueMultipli
cative += oilCharges / maxOilCharges;
}

}
if (playerAttacker && action.IsActionMelee() &&
playerAttacker.IsHeavyAttack(attackAction.GetAttackName()) && playerAttacker.Can
UseSkill(2)){
armorReduction += playerAttacker.GetSkil
lAttributeValue(2, 'armor_reduction', false, true);
}
if (playerAttacker && action.IsActionMelee() &&
playerAttacker.IsHeavyAttack(attackAction.GetAttackName()) && dmgType == theGame
.params.DAMAGE_NAME_PHYSICAL || dmgType == theGame.params.DAMAGE_NAME_SLASHING |
| dmgType == theGame.params.DAMAGE_NAME_PIERCING || dmgType == theGame.params.DA
MAGE_NAME_BLUDGEONING || dmgType == theGame.params.DAMAGE_NAME_RENDING || dmgTyp
e == theGame.params.DAMAGE_NAME_SILVER && playerAttacker.CanUseSkill(21)){
skillArmorReduction = playerAttacker.Get
SkillAttributeValue(21, 'armor_reduction_perc', false, true);
armorReductionPerc += skillArmorReductio
n * playerAttacker.GetSkillLevel(21);
}
}
}
if (!action.GetIgnoreArmor()){
resistPts += CalculateAttributeValue(actorVictim.GetTota
lArmor(), /* NOP */);
}
resistPts = MaxF(0, resistPts - CalculateAttributeValue(armorRed
uction, /* NOP */));
resistPerc -= CalculateAttributeValue(armorReductionPerc, /* NOP
*/);
resistPerc = MaxF(0, resistPerc);
/* NOP */;
}
private function CalculateDamage(dmgInfo : SRawDamage, powerMod : SAbili
tyAttributeValue) : Float{
var finalDamage : Float;
var finalIncomingDamage : Float;
var resistPoints : Float;
var resistPercents : Float;
var ptsString : String;
var percString : String;
var mutagen : CBaseGameplayEffect;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var encumbranceBonus : Float;
var temp : Bool;
var fistfightDamageMult : Float;
GetDamageResists(dmgInfo.dmgType, resistPoints, resistPercents);
if (thePlayer.IsFistFightMinigameEnabled() && actorAttacker == t
hePlayer){
finalDamage = MaxF(0, dmgInfo.dmgVal);
} else {
finalDamage = MaxF(0, dmgInfo.dmgVal + powerMod.valueBas
e * powerMod.valueMultiplicative + powerMod.valueAdditive);
}
finalIncomingDamage = finalDamage;
if (finalDamage > 0.000000){
if (!action.IsPointResistIgnored() && !dmgInfo.dmgType =
= theGame.params.DAMAGE_NAME_ELEMENTAL || dmgInfo.dmgType == theGame.params.DAMA
GE_NAME_FIRE || dmgInfo.dmgType == theGame.params.DAMAGE_NAME_FROST){
finalDamage = MaxF(0, finalDamage - resistPoints
);

if (finalDamage == 0.000000){
action.SetArmorReducedDamageToZero();
}
}
}
if (finalDamage > 0.000000){
if (playerVictim == GetWitcherPlayer() && playerVictim.H
asBuff(74)){
encumbranceBonus = 1 - GetWitcherPlayer().GetEnc
umbrance() / GetWitcherPlayer().GetMaxRunEncumbrance(temp);
if (encumbranceBonus < 0){
encumbranceBonus = 0;
}
mutagen = playerVictim.GetBuff(74, /* NOP */);
dm.GetAbilityAttributeValue(mutagen.GetAbilityNa
me(), 'resistGainRate', min, max);
encumbranceBonus *= CalculateAttributeValue(GetA
ttributeRandomizedValue(min, max), /* NOP */);
resistPercents += encumbranceBonus;
}
finalDamage *= 1 - resistPercents;
}
if (theGame.CanLog()){
LogDMHits("Single hit damage: initial damage = " + NoTra
ilZeros(dmgInfo.dmgVal), action);
LogDMHits("Single hit damage: attack_power = base: " + N
oTrailZeros(powerMod.valueBase) + ", mult: " + NoTrailZeros(powerMod.valueMultip
licative) + ", add: " + NoTrailZeros(powerMod.valueAdditive), action);
if (action.IsPointResistIgnored()){
LogDMHits("Single hit damage: resistance pts and
armor = IGNORED", action);
} else {
LogDMHits("Single hit damage: resistance pts and
armor = " + NoTrailZeros(resistPoints), action);
}
LogDMHits("Single hit damage: resistance perc = " + NoTr
ailZeros(resistPercents * 100), action);
LogDMHits("Single hit damage: final damage to sustain =
" + NoTrailZeros(finalDamage), action);
}
if (dmgInfo.dmgType == theGame.params.DAMAGE_NAME_FIRE && finalD
amage > 0){
action.SetDealtFireDamage(true);
}
if (playerAttacker && thePlayer.IsWeaponHeld('fist') && !thePlay
er.IsInFistFightMiniGame()){
fistfightDamageMult = thePlayer.GetLevel() * 0.050000;
finalDamage *= 1 + fistfightDamageMult;
}
if (playerAttacker && attackAction && playerAttacker.IsHeavyAtta
ck(attackAction.GetAttackName())){
finalDamage *= 1.833000;
}
return finalDamage;
/* NOP */;
}
private function ProcessActionDamage_DealDamage(){
var logStr : String;
var hpPerc : Float;
var npcVictim : CNewNPC;

if (theGame.CanLog()){
logStr = "";
if (action.processedDmg.vitalityDamage > 0){
logStr += NoTrailZeros(action.processedDmg.vital
ityDamage) + " vitality, ";
}
if (action.processedDmg.essenceDamage > 0){
logStr += NoTrailZeros(action.processedDmg.essen
ceDamage) + " essence, ";
}
if (action.processedDmg.staminaDamage > 0){
logStr += NoTrailZeros(action.processedDmg.stami
naDamage) + " stamina, ";
}
if (action.processedDmg.moraleDamage > 0){
logStr += NoTrailZeros(action.processedDmg.moral
eDamage) + " morale";
}
if (logStr == ""){
logStr = "NONE";
}
LogDMHits("Final damage to sustain is: " + logStr, actio
n);
}
if (actorVictim){
hpPerc = actorVictim.GetHealthPercents();
if (actorVictim.IsAlive()){
npcVictim = (CNewNPC)actorVictim;
if (npcVictim && npcVictim.IsHorse()){
npcVictim.GetHorseComponent().OnTakeDama
ge(action);
} else {
actorVictim.OnTakeDamage(action);
}
}
if (!actorVictim.IsAlive() && hpPerc == 1){
action.SetWasKilledBySingleHit();
}
}
if (theGame.CanLog()){
LogDMHits("", action);
LogDMHits("Target stats after damage dealt are:", action
);
if (actorVictim){
if (actorVictim.UsesVitality()){
LogDMHits("Vitality = " + NoTrailZeros(a
ctorVictim.GetStat(0, /* NOP */)), action);
}
if (actorVictim.UsesEssence()){
LogDMHits("Essence = " + NoTrailZeros(ac
torVictim.GetStat(1, /* NOP */)), action);
}
if (actorVictim.GetStatMax(2) > 0){
LogDMHits("Stamina = " + NoTrailZeros(ac
torVictim.GetStat(2, true)), action);
}
if (actorVictim.GetStatMax(5) > 0){
LogDMHits("Morale = " + NoTrailZeros(act
orVictim.GetStat(5, /* NOP */)), action);
}

} else {
LogDMHits("Undefined - victim is not a CActor an
d therefore has no stats", action);
}
}
/* NOP */;
}
private function ProcessActionDamage_ReduceDurability(){
var witcherPlayer : W3PlayerWitcher;
var dbg_currDur : Float;
var dbg_prevDur1 : Float;
var dbg_prevDur2 : Float;
var dbg_prevDur3 : Float;
var dbg_prevDur4 : Float;
var dbg_prevDur : Float;
var dbg_armor : SItemUniqueId;
var dbg_pants : SItemUniqueId;
var dbg_boots : SItemUniqueId;
var dbg_gloves : SItemUniqueId;
var reducedItemId : SItemUniqueId;
var weapon : SItemUniqueId;
var slot : EEquipmentSlots;
var weapons : array<SItemUniqueId>;
var armorStringName : String;
var canLog : Bool;
var playerHasSword : Bool;
var i : Int32;
canLog = theGame.CanLog();
witcherPlayer = GetWitcherPlayer();
if (playerAttacker && playerAttacker.inv.IsIdValid(weaponId) &&
playerAttacker.inv.HasItemDurability(weaponId)){
dbg_prevDur = playerAttacker.inv.GetItemDurability(weapo
nId);
if (playerAttacker.inv.ReduceItemDurability(weaponId, /*
NOP */) && canLog){
LogDMHits("", action);
LogDMHits("Player's weapon durability changes fr
om " + NoTrailZeros(dbg_prevDur) + " to " + NoTrailZeros(action.attacker.GetInve
ntory().GetItemDurability(weaponId)), action);
}
} else if (playerVictim && attackAction && attackAction.IsAction
Melee() && attackAction.IsParried() || attackAction.IsCountered()){
weapons = playerVictim.inv.GetHeldWeapons();
playerHasSword = false;
i = 0;
while (i < weapons.Size()){
weapon = weapons[i];
if (playerVictim.inv.IsIdValid(weapon) && player
Victim.inv.IsItemSteelSwordUsableByPlayer(weapon) || playerVictim.inv.IsItemSilv
erSwordUsableByPlayer(weapon)){
playerHasSword = true;
break;
}
i += 1;
}
if (playerHasSword){
playerVictim.inv.ReduceItemDurability(weapon, /*
NOP */);
}
} else if (action.victim == witcherPlayer && action.IsActionMele

e() || action.IsActionRanged() && action.DealsAnyDamage()){


if (canLog){
if (witcherPlayer.GetItemEquippedOnSlot(3, dbg_a
rmor)){
dbg_prevDur1 = action.victim.GetInventor
y().GetItemDurability(dbg_armor);
} else {
dbg_prevDur1 = 0;
}
if (witcherPlayer.GetItemEquippedOnSlot(5, dbg_p
ants)){
dbg_prevDur2 = action.victim.GetInventor
y().GetItemDurability(dbg_pants);
} else {
dbg_prevDur2 = 0;
}
if (witcherPlayer.GetItemEquippedOnSlot(4, dbg_b
oots)){
dbg_prevDur3 = action.victim.GetInventor
y().GetItemDurability(dbg_boots);
} else {
dbg_prevDur3 = 0;
}
if (witcherPlayer.GetItemEquippedOnSlot(6, dbg_g
loves)){
dbg_prevDur4 = action.victim.GetInventor
y().GetItemDurability(dbg_gloves);
} else {
dbg_prevDur4 = 0;
}
}
slot = GetWitcherPlayer().ReduceArmorDurability();
if (canLog){
LogDMHits("", action);
if (slot != 0){
switch(slot){
case 3:
armorStringName = "chest armor";
reducedItemId = dbg_armor;
dbg_prevDur = dbg_prevDur1;
break;
case 5:
armorStringName = "pants";
reducedItemId = dbg_pants;
dbg_prevDur = dbg_prevDur2;
break;
case 4:
armorStringName = "boots";
reducedItemId = dbg_boots;
dbg_prevDur = dbg_prevDur3;
break;
case 6:
armorStringName = "gloves";
reducedItemId = dbg_gloves;
dbg_prevDur = dbg_prevDur4;
break;
}
dbg_currDur = action.victim.GetInventory
().GetItemDurability(reducedItemId);
LogDMHits("", action);

LogDMHits("Player's <<" + armorStringNam


e + ">> durability changes from " + NoTrailZeros(dbg_prevDur) + " to " + NoTrail
Zeros(dbg_currDur), action);
} else {
LogDMHits("Tried to reduce player's armo
r durability but failed", action);
}
}
if (slot != 0){
thePlayer.inv.ReduceItemRepairObjectBonusCharge(
reducedItemId);
}
}
/* NOP */;
}
private function ProcessActionReaction(wasFrozen : Bool, wasAlive : Bool
){
var dismemberExplosion : Bool;
var damageName : CName;
var damage : array<SRawDamage>;
var points : Float;
var percents : Float;
var hp : Float;
var dmg : Float;
var counterAction : W3DamageAction;
var moveTargets : array<CActor>;
var i : Int32;
var canPerformFinisher : Bool;
var weaponName : CName;
var npcVictim : CNewNPC;
var toxicCloud : W3ToxicCloud;
var playsNonAdditiveAnim : Bool;
var bleedCustomEffect : SCustomEffectParams;
var staminaPercent : Float;
if (!actorVictim){
return;
}
npcVictim = (CNewNPC)actorVictim;
canPerformFinisher = CanPerformFinisher(actorVictim);
if (actorVictim.IsAlive() && !canPerformFinisher){
if (!action.IsDoTDamage() && action.DealtDamage()){
if (actorAttacker && npcVictim){
npcVictim.NoticeActorInGuardArea(actorAt
tacker);
}
if (!playerVictim){
actorVictim.RemoveAllBuffsOfType(5);
}
if (playerAttacker && action.IsActionMelee() &&
!playerAttacker.GetInventory().IsItemFists(weaponId) && playerAttacker.IsLightAt
tack(attackAction.GetAttackName()) && playerAttacker.CanUseSkill(20)){
bleedCustomEffect.effectType = 16;
bleedCustomEffect.creator = playerAttack
er;
bleedCustomEffect.sourceName = SkillEnum
ToName(20);
bleedCustomEffect.duration = CalculateAt
tributeValue(playerAttacker.GetSkillAttributeValue(20, 'duration', false, true),
/* NOP */);
bleedCustomEffect.effectValue.valueAddit

ive = CalculateAttributeValue(playerAttacker.GetSkillAttributeValue(20, 'dmg_per


_sec', false, true), /* NOP */) * playerAttacker.GetSkillLevel(20);
actorVictim.AddEffectCustom(bleedCustomE
ffect);
}
}
if (actorVictim && wasAlive){
playsNonAdditiveAnim = actorVictim.ReactToBeingH
it(action, /* NOP */);
}
} else {
if (!canPerformFinisher && CanDismember(wasFrozen, disme
mberExplosion, weaponName)){
ProcessDismemberment(wasFrozen, dismemberExplosi
on);
toxicCloud = (W3ToxicCloud)action.causer;
if (toxicCloud && toxicCloud.HasExplodingTargetD
amages()){
ProcessToxicCloudDismemberExplosion(toxi
cCloud.GetExplodingTargetDamages());
}
if (IsRequiredAttitudeBetween(thePlayer, action.
victim, true, /* NOP */, /* NOP */)){
moveTargets = thePlayer.GetMoveTargets()
;
i = 0;
while (i < moveTargets.Size()){
if (moveTargets[i].IsHuman()){
moveTargets[i].DrainMora
le(20.000000);
}
i += 1;
}
}
} else if (canPerformFinisher){
if (actorVictim.IsAlive()){
actorVictim.Kill(false, thePlayer, /* NO
P */);
}
thePlayer.AddTimer('DelayedFinisherInputTimer',
0.100000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.SetFinisherVictim(actorVictim);
thePlayer.CleanCombatActionBuffer();
thePlayer.OnBlockAllCombatTickets(true);
moveTargets = thePlayer.GetMoveTargets();
i = 0;
while (i < moveTargets.Size()){
if (actorVictim != moveTargets[i]){
moveTargets[i].SignalGameplayEve
nt('InterruptChargeAttack');
}
i += 1;
}
if (theGame.GetInGameConfigWrapper().GetVarValue
('Gameplay', 'AutomaticFinishersEnabled') == "true"){
actorVictim.AddAbility('ForceFinisher',
false);
}
if (actorVictim.HasTag('ForceFinisher')){
actorVictim.AddAbility('ForceFinisher',

false);
}
actorVictim.SignalGameplayEvent('ForceFinisher')
;
} else if (weaponName == 'fists' && npcVictim){
npcVictim.DisableAgony();
}
thePlayer.FindMoveTarget();
}
actorVictim.ProcessHitSound(action, playsNonAdditiveAnim || !act
orVictim.IsAlive());
if (attackAction && attackAction.IsCriticalHit() && action.Dealt
Damage() && !actorVictim.IsAlive()){
GCameraShake(0.500000, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
if (npcVictim){
staminaPercent = npcVictim.GetStaminaPercents();
}
if (attackAction && npcVictim && npcVictim.IsShielded(actorAttac
ker) && attackAction.IsParried() && attackAction.GetAttackName() == 'attack_heav
y' && staminaPercent <= 0.100000){
npcVictim.ProcessShieldDestruction();
}
if (actorVictim && action.CanPlayHitParticle() && action.DealsAn
yDamage() || attackAction && attackAction.IsParried()){
actorVictim.PlayHitEffect(action);
}
if (actorVictim && playerAttacker && action.IsActionMelee() && t
hePlayer.inv.IsItemFists(weaponId)){
if (MonsterCategoryIsMonster(victimMonsterCategory)){
if (!victimCanBeHitByFists){
playerAttacker.ReactToReflectedAttack(ac
torVictim);
} else {
actorVictim.GetResistValue(1, points, pe
rcents);
if (percents >= theGame.params.MONSTER_R
ESIST_THRESHOLD_TO_REFLECT_FISTS){
playerAttacker.ReactToReflectedA
ttack(actorVictim);
}
}
}
}
super.ProcessSparksFromNoDamage();
if (attackAction && attackAction.IsActionMelee() && actorAttacke
r && playerVictim && attackAction.IsCountered() && playerVictim == GetWitcherPla
yer()){
GetWitcherPlayer().SetRecentlyCountered(true);
}
if (attackAction && !action.IsDoTDamage() && playerAttacker || p
layerVictim && attackAction.IsParried() || attackAction.IsCountered()){
theGame.VibrateControllerLight(/* NOP */);
}
/* NOP */;
}
private function CanDismember(wasFrozen : Bool, dismemberExplosion : Boo
l, weaponName : CName) : Bool{
var dismember : Bool;

var dismemberChance : Int32;


var petard : W3Petard;
var bolt : W3BoltProjectile;
var arrow : W3ArrowProjectile;
var inv : CInventoryComponent;
var toxicCloud : W3ToxicCloud;
var witcher : W3PlayerWitcher;
var i : Int32;
var secondaryWeapon : Bool;
petard = (W3Petard)action.causer;
bolt = (W3BoltProjectile)action.causer;
arrow = (W3ArrowProjectile)action.causer;
toxicCloud = (W3ToxicCloud)action.causer;
dismemberExplosion = false;
if (playerAttacker){
secondaryWeapon = playerAttacker.inv.ItemHasTag(weaponId
, 'SecondaryWeapon') || playerAttacker.inv.ItemHasTag(weaponId, 'Wooden');
}
if (actorVictim.HasAbility('DisableDismemberment')){
dismember = false;
} else if (actorVictim.HasTag('DisableDismemberment')){
dismember = false;
} else if (actorVictim.WillBeUnconscious()){
dismember = false;
} else if (playerAttacker && secondaryWeapon){
dismember = false;
} else if (arrow){
dismember = false;
} else if (actorAttacker.HasAbility('ForceDismemberment')){
dismember = true;
} else if (wasFrozen){
dismember = true;
} else if (petard && petard.DismembersOnKill() || bolt && bolt.D
ismembersOnKill()){
dismember = true;
} else if ((W3Effect_YrdenHealthDrain)action.causer){
dismember = true;
dismemberExplosion = true;
} else if (toxicCloud && toxicCloud.HasExplodingTargetDamages())
{
dismember = true;
dismemberExplosion = true;
} else {
inv = actorAttacker.GetInventory();
weaponName = inv.GetItemName(weaponId);
if (attackAction && !inv.IsItemSteelSwordUsableByPlayer(
weaponId) && !inv.IsItemSilverSwordUsableByPlayer(weaponId) && weaponName != 'po
learm' && weaponName != 'fists_lightning' && weaponName != 'fists_fire'){
dismember = false;
} else if (attackAction && attackAction.IsCriticalHit())
{
dismember = true;
dismemberExplosion = attackAction.HasForceExplos
ionDismemberment();
} else {
dismemberChance = theGame.params.DISMEMBERMENT_O
N_DEATH_CHANCE;
if (playerAttacker && playerAttacker.forceDismem
ber){
dismemberChance = thePlayer.forceDismemb

erChance;
dismemberExplosion = thePlayer.forceDism
emberExplosion;
}
if (attackAction){
dismemberChance += RoundMath(100 * Calcu
lateAttributeValue(inv.GetItemAttributeValue(weaponId, 'dismember_chance', /* NO
P */, /* NOP */), /* NOP */));
dismemberExplosion = attackAction.HasFor
ceExplosionDismemberment();
}
witcher = (W3PlayerWitcher)actorAttacker;
if (witcher && witcher.CanUseSkill(82)){
dismemberChance += RoundMath(100 * Calcu
lateAttributeValue(witcher.GetSkillAttributeValue(82, 'dismember_chance', false,
true), /* NOP */));
}
dismemberChance = Clamp(dismemberChance, 0, 100)
;
if (RandRange(100, /* NOP */) < dismemberChance)
{
dismember = true;
} else {
dismember = false;
}
}
}
return dismember;
/* NOP */;
}
private function CanPerformFinisher(actorVictim : CActor) : Bool{
var finisherChance : Int32;
var areEnemiesAttacking : Bool;
var i : Int32;
var victimToPlayerVector : Vector;
var playerPos : Vector;
var item : SItemUniqueId;
var moveTargets : array<CActor>;
var b : Bool;
var size : Int32;
var npc : CNewNPC;
if ((W3ReplacerCiri)thePlayer || playerVictim || thePlayer.isInF
inisher){
return false;
}
if (actorVictim.IsAlive() && !CanPerformFinisherOnAliveTarget(ac
torVictim)){
return false;
}
moveTargets = thePlayer.GetMoveTargets();
size = moveTargets.Size();
playerPos = thePlayer.GetWorldPosition();
if (size > 0){
areEnemiesAttacking = false;
i = 0;
while (i < size){
npc = (CNewNPC)moveTargets[i];
if (npc && VecDistanceSquared(playerPos, moveTar
gets[i].GetWorldPosition()) < 7 && npc.IsAttacking() && npc != actorVictim){
areEnemiesAttacking = true;

break;
}
i += 1;
}
}
victimToPlayerVector = actorVictim.GetWorldPosition() - playerPo
s;
if (actorVictim.IsHuman()){
npc = (CNewNPC)actorVictim;
if (actorVictim.HasBuff(5) || actorVictim.HasBuff(36)){
finisherChance = 75 + -npc.level - thePlayer.Get
Level();
} else if (size <= 1 && theGame.params.FINISHER_ON_DEATH
_CHANCE > 0 || actorVictim.HasAbility('ForceFinisher')){
finisherChance = 100;
} else if (npc.level - thePlayer.GetLevel() < -5){
finisherChance = theGame.params.FINISHER_ON_DEAT
H_CHANCE + -npc.level - thePlayer.GetLevel();
} else {
finisherChance = theGame.params.FINISHER_ON_DEAT
H_CHANCE;
}
finisherChance = Clamp(finisherChance, 0, 100);
} else {
finisherChance = 0;
}
if (actorVictim.HasTag('ForceFinisher')){
finisherChance = 100;
areEnemiesAttacking = false;
}
item = thePlayer.inv.GetItemFromSlot('l_weapon');
b = playerAttacker && attackAction && attackAction.IsActionMelee
();
b = b && actorVictim.IsHuman() && !actorVictim.IsWoman();
b = b && RandRange(100, /* NOP */) < finisherChance;
b = b && !areEnemiesAttacking;
b = b && AbsF(victimToPlayerVector.Z) < 0.400000;
b = b && !thePlayer.IsInAir();
b = b && thePlayer.IsWeaponHeld('steelsword') || thePlayer.IsWea
ponHeld('silversword');
b = b && !thePlayer.IsSecondaryWeaponHeld();
b = b && !thePlayer.inv.IsIdValid(item);
b = b && !actorVictim.IsKnockedUnconscious();
b = b && !actorVictim.HasBuff(9);
b = b && !actorVictim.HasBuff(65);
b = b && !actorVictim.HasBuff(11);
b = b && !actorVictim.HasAbility('DisableFinishers');
b = b && actorVictim.GetAttitude(thePlayer) == 2;
b = b && !thePlayer.IsUsingVehicle();
b = b && thePlayer.IsAlive();
b = b && !thePlayer.IsCurrentSignChanneled();
b = b && theGame.GetWorld().NavigationCircleTest(actorVictim.Get
WorldPosition(), 2.000000, /* NOP */) || actorVictim.HasTag('ForceFinisher');
if (thePlayer.forceFinisher && actorVictim.IsHuman()){
return true;
}
if (b){
if (!actorVictim.IsAlive()){
actorVictim.AddAbility('DisableFinishers', false
);

}
return true;
}
return false;
/* NOP */;
}
private function CanPerformFinisherOnAliveTarget(actorVictim : CActor) :
Bool{
return actorVictim.IsHuman() && actorVictim.HasBuff(5) || actorV
ictim.HasBuff(36) && actorVictim.IsVulnerable() && !actorVictim.HasAbility('Disa
bleFinisher') && !actorVictim.HasAbility('InstantKillImmune');
/* NOP */;
}
private function ProcessActionBuffs() : Bool{
var inv : CInventoryComponent;
var ret : Bool;
if (!action.victim.IsAlive() || action.WasDodged() || attackActi
on && attackAction.IsActionMelee() && attackAction.CanBeParried() && attackActio
n.IsParried()){
return true;
}
ApplyQuenBuffChanges();
if (actorVictim && action.GetEffectsCount() > 0){
ret = actorVictim.ApplyActionEffects(action);
} else {
ret = false;
}
if (actorAttacker && actorVictim){
inv = actorAttacker.GetInventory();
actorAttacker.ProcessOnHitEffects(actorVictim, inv.IsIte
mSilverSwordUsableByPlayer(weaponId), inv.IsItemSteelSwordUsableByPlayer(weaponI
d), action.IsActionWitcherSign());
}
return ret;
/* NOP */;
}
private function ApplyQuenBuffChanges(){
var npc : CNewNPC;
var protection : Bool;
var witcher : W3PlayerWitcher;
var quenEntity : W3QuenEntity;
var i : Int32;
var buffs : array<EEffectType>;
if (!actorVictim || !actorVictim.HasAlternateQuen()){
return;
}
npc = (CNewNPC)actorVictim;
if (npc){
if (!action.DealsAnyDamage()){
protection = true;
}
} else {
witcher = (W3PlayerWitcher)actorVictim;
if (witcher){
quenEntity = (W3QuenEntity)witcher.GetCurrentSig
nEntity();
if (quenEntity.GetBlockedAllDamage()){
protection = true;
}
}

}
if (!protection){
return;
}
action.GetEffectTypes(buffs);
i = buffs.Size() - 1;
while (i >= 0){
if (buffs[i] == 10 || IsKnockdownEffectType(buffs[i])){
} else {
action.RemoveBuff(i);
}
i -= 1;
}
/* NOP */;
}
private function ProcessDismemberment(wasFrozen : Bool, dismemberExplosi
on : Bool){
var hitDirection : Vector;
var usedWound : CName;
var npcVictim : CNewNPC;
var wounds : array<CName>;
var i : Int32;
var petard : W3Petard;
var bolt : W3BoltProjectile;
var forcedRagdoll : Bool;
var isExplosion : Bool;
var dismembermentComp : CDismembermentComponent;
var specialWounds : array<CName>;
var useHitDirection : Bool;
if (!actorVictim){
return;
}
dismembermentComp = (CDismembermentComponent)actorVictim.GetComp
onentByClassName('CDismembermentComponent');
if (!dismembermentComp){
return;
}
if (wasFrozen){
ProcessFrostDismemberment();
return;
}
forcedRagdoll = false;
petard = (W3Petard)action.causer;
bolt = (W3BoltProjectile)action.causer;
if (dismemberExplosion || attackAction && attackAction.GetAttack
Name() == 'attack_explosion' || petard && petard.DismembersOnKill() || bolt && b
olt.DismembersOnKill()){
isExplosion = true;
} else {
isExplosion = false;
}
if (playerAttacker && thePlayer.forceDismember && IsNameValid(th
ePlayer.forceDismemberName)){
usedWound = thePlayer.forceDismemberName;
} else if (isExplosion){
dismembermentComp.GetWoundsNames(wounds, 2);
if (wounds.Size() > 0){
usedWound = wounds[RandRange(wounds.Size(), /* N
OP */)];
}

if (usedWound){
StopVO(actorVictim);
}
} else if (attackAction || action.GetBuffSourceName() == "riderH
it"){
if (attackAction.GetAttackTypeName() == 'sword_s2' || th
ePlayer.isInFinisher){
useHitDirection = true;
}
if (useHitDirection){
hitDirection = actorAttacker.GetSwordTipMovement
FromAnimation(attackAction.GetAttackAnimName(), attackAction.GetHitTime(), 0.100
000, attackAction.GetWeaponEntity());
usedWound = actorVictim.GetNearestWoundForBone(a
ttackAction.GetHitBoneIndex(), hitDirection, 1);
} else {
dismembermentComp.GetWoundsNames(wounds, /* NOP
*/);
if (wounds.Size() > 0){
dismembermentComp.GetWoundsNames(special
Wounds, 2);
i = 0;
while (i < specialWounds.Size()){
wounds.Remove(specialWounds[i]);
i += 1;
}
if (wounds.Size() > 0){
dismembermentComp.GetWoundsNames
(specialWounds, 4);
i = 0;
while (i < specialWounds.Size())
{
wounds.Remove(specialWou
nds[i]);
i += 1;
}
if (wounds.Size() > 0){
usedWound = wounds[RandR
ange(wounds.Size(), /* NOP */)];
}
}
}
}
}
if (usedWound){
npcVictim = (CNewNPC)action.victim;
if (npcVictim){
npcVictim.DisableAgony();
}
actorVictim.SetDismembermentInfo(usedWound, actorVictim.
GetWorldPosition() - actorAttacker.GetWorldPosition(), forcedRagdoll);
actorVictim.AddTimer('DelayedDismemberTimer', 0.050000,
/* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
ProcessDismembermentDeathAnim(usedWound);
if (usedWound == 'explode_02'){
actorVictim.SetKinematic(false);
}
DropEquipmentFromDismember(usedWound, true, true);
if (attackAction){
GCameraShake(0.500000, false, actorAttacker.GetW

orldPosition(), 10, /* NOP */, /* NOP */, /* NOP */);


}
if (playerAttacker){
theGame.VibrateControllerHard(/* NOP */);
}
} else {
/* NOP */;
}
/* NOP */;
}
private function ProcessFrostDismemberment(){
var dismembermentComp : CDismembermentComponent;
var wounds : array<CName>;
var wound : CName;
var i : Int32;
var npcVictim : CNewNPC;
dismembermentComp = (CDismembermentComponent)actorVictim.GetComp
onentByClassName('CDismembermentComponent');
if (!dismembermentComp){
return;
}
dismembermentComp.GetWoundsNames(wounds, 4);
if (wounds.Size() > 0){
wound = wounds[RandRange(wounds.Size(), /* NOP */)];
} else {
return;
}
npcVictim = (CNewNPC)action.victim;
if (npcVictim){
npcVictim.DisableAgony();
StopVO(npcVictim);
}
actorVictim.SetDismembermentInfo(wound, actorVictim.GetWorldPosi
tion() - actorAttacker.GetWorldPosition(), true);
actorVictim.AddTimer('DelayedDismemberTimer', 0.050000, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
ProcessDismembermentDeathAnim(wound);
DropEquipmentFromDismember(wound, true, true);
if (attackAction){
GCameraShake(0.500000, false, actorAttacker.GetWorldPosi
tion(), 10, /* NOP */, /* NOP */, /* NOP */);
}
if (playerAttacker){
theGame.VibrateControllerHard(/* NOP */);
}
/* NOP */;
}
private function ProcessDismembermentDeathAnim(nearestWound : CName){
var dropCurveName : CName;
dropCurveName = (CDismembermentComponent)actorVictim.GetComponen
tByClassName('CDismembermentComponent').GetMainCurveName(nearestWound);
if (dropCurveName == 'head'){
actorVictim.SetBehaviorVariable('FinisherDeathType', 1,
/* NOP */);
StopVO(actorVictim);
} else if (dropCurveName == 'torso_left' || dropCurveName == 'to
rso_right' || dropCurveName == 'torso'){
actorVictim.SetBehaviorVariable('FinisherDeathType', 2,
/* NOP */);
} else if (dropCurveName == 'arm_right'){

actorVictim.SetBehaviorVariable('FinisherDeathType', 4,
/* NOP */);
} else if (dropCurveName == 'arm_left'){
actorVictim.SetBehaviorVariable('FinisherDeathType', 3,
/* NOP */);
} else if (dropCurveName == 'leg_left'){
actorVictim.SetBehaviorVariable('FinisherDeathType', 5,
/* NOP */);
} else if (dropCurveName == 'leg_right'){
actorVictim.SetBehaviorVariable('FinisherDeathType', 6,
/* NOP */);
} else {
actorVictim.SetBehaviorVariable('FinisherDeathType', 0,
/* NOP */);
}
/* NOP */;
}
private function StopVO(actor : CActor){
actor.SoundEvent("grunt_vo_death_stop", 'head', /* NOP */);
/* NOP */;
}
private function DropEquipmentFromDismember(nearestWound : CName, dropLe
ft : Bool, dropRight : Bool){
var dropCurveName : CName;
dropCurveName = (CDismembermentComponent)actorVictim.GetComponen
tByClassName('CDismembermentComponent').GetMainCurveName(nearestWound);
if (ChangeHeldItemAppearance()){
actorVictim.SignalGameplayEvent('DropWeaponsInDeathTask'
);
return;
}
if (dropLeft || dropRight){
if (dropLeft){
actorVictim.DropItemFromSlot('l_weapon', true);
}
if (dropRight){
actorVictim.DropItemFromSlot('r_weapon', true);
}
return;
}
if (dropCurveName == 'arm_right'){
actorVictim.DropItemFromSlot('r_weapon', true);
} else if (dropCurveName == 'arm_left'){
actorVictim.DropItemFromSlot('l_weapon', true);
} else if (dropCurveName == 'torso_left' || dropCurveName == 'to
rso_right' || dropCurveName == 'torso'){
actorVictim.DropItemFromSlot('l_weapon', true);
actorVictim.DropItemFromSlot('r_weapon', true);
} else if (dropCurveName == 'head' || dropCurveName == 'leg_left
' || dropCurveName == 'leg_right'){
if (RandRange(100, /* NOP */) < 50){
actorVictim.DropItemFromSlot('l_weapon', true);
}
if (RandRange(100, /* NOP */) < 50){
actorVictim.DropItemFromSlot('r_weapon', true);
}
}
/* NOP */;
}
public function ChangeHeldItemAppearance() : Bool{

var inv : CInventoryComponent;


var weapon : SItemUniqueId;
inv = actorVictim.GetInventory();
weapon = inv.GetItemFromSlot('l_weapon');
if (inv.IsIdValid(weapon)){
if (inv.ItemHasTag(weapon, 'bow') || inv.ItemHasTag(weap
on, 'crossbow')){
inv.GetItemEntityUnsafe(weapon).ApplyAppearance(
"rigid");
}
return true;
}
weapon = inv.GetItemFromSlot('r_weapon');
if (inv.IsIdValid(weapon)){
if (inv.ItemHasTag(weapon, 'bow') || inv.ItemHasTag(weap
on, 'crossbow')){
inv.GetItemEntityUnsafe(weapon).ApplyAppearance(
"rigid");
}
return true;
}
return false;
/* NOP */;
}
private function GetOilProtectionAgainstMonster(dmgType : CName, resist
: Float, reduct : Float){
var vsMonsterAttributeName : CName;
var oilTypeMatches : Bool;
var isPointResist : Bool;
var i : Int32;
var j : Int32;
var abs : array<CName>;
var atts : array<CName>;
var requiredResist : ECharacterDefenseStats;
var val : Float;
var valMin : SAbilityAttributeValue;
var valMax : SAbilityAttributeValue;
var heldWeapons : array<SItemUniqueId>;
var weapon : SItemUniqueId;
resist = 0;
reduct = 0;
vsMonsterAttributeName = MonsterCategoryToAttackPowerBonus(attac
kerMonsterCategory);
heldWeapons = thePlayer.inv.GetHeldWeapons();
i = 0;
while (i < heldWeapons.Size()){
if (!thePlayer.inv.IsItemFists(heldWeapons[i])){
weapon = heldWeapons[i];
break;
}
i += 1;
}
if (!thePlayer.inv.IsIdValid(weapon)){
return;
}
thePlayer.inv.GetItemAbilities(weapon, abs);
i = 0;
while (i < abs.Size()){
if (dm.AbilityHasTag(abs[i], theGame.params.OIL_ABILITY_
TAG)){

dm.GetAbilityAttributes(abs[i], atts);
oilTypeMatches = false;
j = 0;
while (j < atts.Size()){
if (vsMonsterAttributeName == atts[j]){
oilTypeMatches = true;
break;
}
j += 1;
}
if (!oilTypeMatches){
break;
}
resist = CalculateAttributeValue(thePlayer.GetSk
illAttributeValue(62, 'defence_bonus', false, true), /* NOP */);
return;
}
i += 1;
}
/* NOP */;
}
private function ProcessToxicCloudDismemberExplosion(damages : array<SRa
wDamage>){
var act : W3DamageAction;
var i : Int32;
var j : Int32;
var ents : array<CGameplayEntity>;
if (damages.Size() == 0){
LogAssert(false, "W3DamageManagerProcessor.ProcessToxicC
loudDismemberExplosion: trying to process but no damages are passed! Aborting!")
;
return;
}
FindGameplayEntitiesInSphere(ents, action.victim.GetWorldPositio
n(), 3, 1000, /* NOP */, 4, /* NOP */, /* NOP */);
i = 0;
while (i < ents.Size()){
act = new W3DamageAction in this;
act.Initialize(action.attacker, ents[i], action.causer,
'Dragons_Dream_3', 2, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
j = 0;
while (j < damages.Size()){
act.AddDamage(damages[j].dmgType, damages[j].dmg
Val);
j += 1;
}
theGame.damageMgr.ProcessAction(act);
delete act;
i += 1;
}
/* NOP */;
}
private final function ProcessSparksFromNoDamage(){
var sparksEntity : CEntity;
var weaponEntity : CEntity;
var weaponTipPosition : Vector;
var weaponSlotMatrix : Matrix;
if (!playerAttacker || !attackAction || !attackAction.IsActionMe
lee() || attackAction.DealsAnyDamage()){

return;
}
if (!attackAction.DidArmorReduceDamageToZero() || attackAction.I
sParried() || attackAction.IsCountered()){
return;
}
if (actorVictim.HasTag('NoSparksOnArmorDmgReduced')){
return;
}
weaponEntity = playerAttacker.inv.GetItemEntityUnsafe(weaponId);
weaponEntity.CalcEntitySlotMatrix('blood_fx_point', weaponSlotMa
trix);
weaponTipPosition = MatrixGetTranslation(weaponSlotMatrix);
sparksEntity = theGame.CreateEntity((CEntityTemplate)LoadResourc
e('sword_colision_fx', /* NOP */), weaponTipPosition, /* NOP */, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
sparksEntity.PlayEffect('sparks', /* NOP */);
/* NOP */;
}
}
class CAIWildHuntCounterHitAction extends CAINpcDefenseAction{
}
class CAIWildHuntTwoHandedAxeDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAIWildHuntTwoHandedAxeCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedAxeCombat extends CAINpcCombat{
public function Init(){
params = new CAIWildHuntTwoHandedAxeCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct CGameplayEntity{
public editable var minLootParamNumber : Int32;
public editable var maxLootParamNumber : Int32;
public editable var iconOffset : Vector;
public var highlighted : Bool;
public var focusModeSoundEffectType : EFocusModeSoundEffectType;
public var isPlayingFocusSound : Bool;
public var focusSoundVisualEffectBoneName : CName;
public editable var isHighlightedByMedallion : Bool;
public editable var isMagicalObject : Bool;
public editable var soundEntityName : String;
public editable var soundEntityGender : String;
public editable var soundEntitySet : String;
//NULL type for aimVector
import public final function GetInventory() : CInventoryComponent;
import public final function GetDisplayName(fallBack : Bool) : String;
import protected final function GetCharacterStats() : CCharacterStats;
import public final function PlayPropertyAnimation(animationName : CName
, count : Int32, lengthScale : Float, mode : EPropertyCurveMode);

import public final function StopPropertyAnimation(animationName : CName


, restoreInitialValues : Bool);
import public final function RewindPropertyAnimation(animationName : CNa
me, time : Float);
import public final function GetGameplayEntityParam(className : CName) :
CGameplayEntityParam;
import public final function GetPropertyAnimationInstanceTime(propertyNa
me : CName, animationName : CName) : Float;
import public final function GetPropertyAnimationLength(propertyName : C
Name, animationName : CName) : Float;
import public final function GetPropertyAnimationTransformAt(propertyNam
e : CName, animationName : CName, time : Float) : Matrix;
import public final function EnableVisualDebug(flag : EShowFlags, enable
: Bool);
import public function GetStorageBounds(box : Box);
import public final function GetGameplayInfoCache(type : EGameplayInfoCa
cheType) : Bool;
import public final function GetFocusModeVisibility() : EFocusModeVisibi
lity;
import public final function SetFocusModeVisibility(focusModeVisibility
: EFocusModeVisibility, persistent : Bool);
import public final function AddAnimEventCallback(eventName : CName, fun
ctionName : CName);
import public final function RemoveAnimEventCallback(eventName : CName);
import public final function AddAnimEventChildCallback(child : CNode, ev
entName : CName, functionName : CName);
import public final function RemoveAnimEventChildCallback(child : CNode,
eventName : CName);
import public final function GetSfxTag() : CName;
public final function GetAllAttributes() : array<CName>{
var atts : array<CName>;
GetCharacterStats().GetAllAttributesNames(atts);
return atts;
/* NOP */;
}
public function OnSpawnedEditor(spawnData : SEntitySpawnData) : Bool{
}
public function OnGameplayPropertyChanged(propertyName : CName) : Bool{
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
isPlayingFocusSound = false;
if (soundEntityName){
SoundSwitch("entity_name", soundEntityName, /* NOP */, /
* NOP */);
}
if (soundEntityGender){
SoundSwitch("entity_gender", soundEntityGender, /* NOP *
/, /* NOP */);
}
if (soundEntitySet){
SoundSwitch("entity_sound_set", soundEntitySet, /* NOP *
/, /* NOP */);
}
/* NOP */;
}
public function OnDestroyed() : Bool{
}
public function OnPlayerActionEnd() : Bool{
}
public function OnPlayerActionStartFinished() : Bool{

}
public function OnSyncAnimEnd() : Bool{
}
public function OnPreAttackEvent(animEventName : CName, animEventType :
EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimI
nfo) : Bool{
}
public function IsAlive() : Bool{
return true;
/* NOP */;
}
public function HasAbility(abilityName : CName) : Bool{
return GetCharacterStats().HasAbility(abilityName, /* NOP */);
/* NOP */;
}
public function AddAbility(abilityName : CName, allowMultiple : Bool) :
Bool{
return GetCharacterStats().AddAbility(abilityName, allowMultiple
);
/* NOP */;
}
public function RemoveAbility(abilityName : CName){
GetCharacterStats().RemoveAbility(abilityName);
/* NOP */;
}
public function AddAbilityMultiple(abilityName : CName, count : Int32){
GetCharacterStats().AddAbilityMultiple(abilityName, count);
/* NOP */;
}
public function RemoveAbilityMultiple(abilityName : CName, count : Int32
){
GetCharacterStats().RemoveAbilityMultiple(abilityName, count);
/* NOP */;
}
public function RemoveAbilityAll(abilityName : CName){
var characterStats : CCharacterStats;
characterStats = super.GetCharacterStats();
while (characterStats.HasAbility(abilityName, /* NOP */)){
characterStats.RemoveAbility(abilityName);
}
/* NOP */;
}
public function AddTag(tag : CName){
var i : Int32;
var ents : array<CGameplayEntity>;
var area : CTriggerAreaComponent;
var toxic : W3ToxicCloud;
super.AddTag(tag);
if (tag == theGame.params.TAG_OPEN_FIRE){
FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 2
0, 100000, theGame.params.TAG_EXPLODING_GAS, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < ents.Size()){
toxic = (W3ToxicCloud)ents[i];
if (toxic){
area = toxic.GetGasAreaUnsafe();
if (area && area.TestEntityOverlap(this)
){
ents[i].OnFireHit(this);
}

}
i += 1;
}
}
/* NOP */;
}
public timer function MedallionEffectOff(optional deltaTime : Float, opt
ional id : Int32){
SetHighlighted(false);
StopEffect('medalion_detection_fx');
/* NOP */;
}
public timer function EnemyHighlightOff(optional dt : Float, optional id
: Int32){
var catComponent : CGameplayEffectsComponent;
catComponent = GetGameplayEffectsComponent(this);
if (catComponent){
catComponent.ResetGameplayEffectFlag(2);
}
/* NOP */;
}
public timer function SonarEffectOff(optional deltaTime : Float, optiona
l id : Int32){
StopEffect('fx_sonar_detection');
/* NOP */;
}
public function FocusEffectOff(){
StopEffect('focus_activation_fx');
/* NOP */;
}
public function SetHighlighted(b : Bool){
highlighted = b;
/* NOP */;
}
public function IsHighlighted() : Bool{
return highlighted;
/* NOP */;
}
public function ShouldBlockGameplayActionsOnInteraction() : Bool{
return false;
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
}
public function OnItemTaken(itemId : SItemUniqueId, quantity : Int32) :
Bool{
}
public function SenseMagic(){
if (thePlayer.PlayerCanComment()){
GetComponent("Medallion").SetEnabled(true);
thePlayer.PlayerCommentary(0, /* NOP */);
}
GetWitcherPlayer().GetMedallion().Activate(true, 5.000000);
/* NOP */;
}
public function AddSignHitFacts(sign : W3SignProjectile, signType : Stri
ng){
AddHitFacts(GetTags(), sign.caster.GetTags(), signType, /* NOP *
/, /* NOP */);
/* NOP */;

}
public function OnWeaponHit(act : W3DamageAction) : Bool{
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
var i : Int32;
var doors : array<CComponent>;
var R4Components : array<CComponent>;
var gameLightComp : CGameplayLightComponent;
AddSignHitFacts(sign, "_aard_hit");
doors = GetComponentsByClassName('CDoorComponent');
i = 0;
while (i < doors.Size()){
(CDoorComponent)doors[i].AddForceImpulse(sign.caster.Get
WorldPosition(), 3000.000000);
i += 1;
}
R4Components = GetComponentsByClassName('CR4Component');
i = 0;
while (i < R4Components.Size()){
(CR4Component)R4Components[i].OnAardHit();
i += 1;
}
if (HasEffect('aardReaction') && !IsEffectActive('aardReaction',
/* NOP */)){
PlayEffect('aardReaction', /* NOP */);
}
gameLightComp = (CGameplayLightComponent)GetComponentByClassName
('CGameplayLightComponent');
if (gameLightComp){
gameLightComp.AardHit();
}
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
var i : Int32;
var gameLightComp : CComponent;
var R4Components : array<CComponent>;
AddSignHitFacts(sign, "_igni_hit");
gameLightComp = GetComponentByClassName('CGameplayLightComponent
');
if (gameLightComp){
(CGameplayLightComponent)gameLightComp.IgniHit();
}
R4Components = GetComponentsByClassName('CR4Component');
i = 0;
while (i < R4Components.Size()){
(CR4Component)R4Components[i].OnIgniHit();
i += 1;
}
OnFireHit(sign);
/* NOP */;
}
public function OnAxiiHit(sign : W3AxiiProjectile) : Bool{
AddSignHitFacts(sign, "_axii_hit");
/* NOP */;
}
public function OnFrostHit(source : CGameplayEntity) : Bool{
var gameLightComp : CGameplayLightComponent;
var fireAuraCmp : W3FireAuraManagerComponent;
gameLightComp = (CGameplayLightComponent)GetComponentByClassName

('CGameplayLightComponent');
if (gameLightComp){
gameLightComp.FrostHit();
}
fireAuraCmp = (W3FireAuraManagerComponent)GetComponentByClassNam
e('W3FireAuraManagerComponent');
if (fireAuraCmp){
fireAuraCmp.DeactivateAura();
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
var w3FoodComponents : array<CComponent>;
var i : Int32;
var actor : CActor;
var gameLightComp : CGameplayLightComponent;
actor = (CActor)this;
if (!actor || !actor.IsAlive()){
w3FoodComponents = GetComponentsByClassName('W3FoodCompo
nent');
i = 0;
while (i < w3FoodComponents.Size()){
(W3FoodComponent)w3FoodComponents[i].OnFireHit()
;
i += 1;
}
}
gameLightComp = (CGameplayLightComponent)GetComponentByClassName
('CGameplayLightComponent');
if (gameLightComp){
gameLightComp.FireHit();
}
/* NOP */;
}
public function OnYrdenHit(caster : CGameplayEntity) : Bool{
AddHitFacts(GetTags(), caster.GetTags(), "_yrden_hit", /* NOP */
, /* NOP */);
/* NOP */;
}
public function OnRootHit() : Bool{
var i : Int32;
var tags : array<CName>;
tags = GetTags();
i = 0;
while (i < tags.Size()){
FactsAdd(NameToString(tags[i]) + "_roots_hit", 1, 1);
i += 1;
}
/* NOP */;
}
public function OnDamageFromJump(activator : CComponent, jumpDistance :
Float, jumpHeightDiff : Float) : Bool{
WhenFallen(jumpHeightDiff);
/* NOP */;
}
public function OnDamageFromFalling(activator : CComponent, fallingDista
nce : Float, fallingHeightDiff : Float) : Bool{
WhenFallen(fallingHeightDiff);
/* NOP */;
}

protected function WhenFallen(fallingHeightDiff : Float){


var vehicleComp : CVehicleComponent;
var gpEnt : CGameplayEntity;
if (-fallingHeightDiff > 0){
if (this == thePlayer || GetAttitudeBetween(thePlayer, t
his) == 2){
ApplyFallingDamage(-fallingHeightDiff, /* NOP */
);
}
}
if (IsVehicle()){
vehicleComp = (CVehicleComponent)GetComponentByClassName
('CVehicleComponent');
gpEnt = vehicleComp.user;
if (gpEnt){
gpEnt.WhenFallen(fallingHeightDiff);
if ((CNewNPC)this.IsHorse() && !gpEnt.IsAlive())
{
(CNewNPC)this.GetHorseComponent().OnKill
Horse();
}
}
}
/* NOP */;
}
public function IsVehicle() : Bool{
return GetComponentByClassName('CVehicleComponent');
/* NOP */;
}
public function ApplyFallingDamage(heightDiff : Float, reducing : Bool)
: Float{
return 0;
/* NOP */;
}
public function GetFocusModeSoundEffectName() : CName{
if (focusModeSoundEffectType == 0){
return 'focus_sound_fx';
} else if (focusModeSoundEffectType == 1){
return 'focus_sound_red_fx';
} else if (focusModeSoundEffectType == 2){
return 'focus_sound_green_fx';
}
return 'None';
/* NOP */;
}
public function PlayFocusSoundVisualEffect(effectName : CName){
var focusSoundParam : CFocusSoundParam;
if (focusSoundVisualEffectBoneName == 'None'){
focusSoundParam = (CFocusSoundParam)super.GetGameplayEnt
ityParam('CFocusSoundParam');
if (focusSoundParam){
focusSoundVisualEffectBoneName = focusSoundParam
.GetVisualEffectBoneName();
}
if (focusSoundVisualEffectBoneName == 'None'){
focusSoundVisualEffectBoneName = 'entity';
}
}
if (focusSoundVisualEffectBoneName != 'entity'){
PlayEffectOnBone(effectName, focusSoundVisualEffectBoneN

ame, /* NOP */);


} else {
PlayEffect(effectName, /* NOP */);
}
/* NOP */;
}
public function SetFocusModeSoundEffectType(type : EFocusModeSoundEffect
Type){
if (focusModeSoundEffectType == type){
return;
}
if (isPlayingFocusSound){
StopEffect(GetFocusModeSoundEffectName());
}
focusModeSoundEffectType = type;
if (isPlayingFocusSound && type != 3){
PlayFocusSoundVisualEffect(GetFocusModeSoundEffectName()
);
}
/* NOP */;
}
public function OnFocusModeSound(enabled : Bool) : Bool{
if (!IsAlive()){
enabled = false;
}
if (enabled == isPlayingFocusSound){
return false;
}
isPlayingFocusSound = enabled;
if (isPlayingFocusSound){
PlayFocusSoundVisualEffect(GetFocusModeSoundEffectName()
);
} else {
StopEffect(GetFocusModeSoundEffectName());
}
/* NOP */;
}
public function GetFocusActionName() : CName{
var focusComponent : CFocusActionComponent;
focusComponent = (CFocusActionComponent)GetComponentByClassName(
'CFocusActionComponent');
if (focusComponent){
return focusComponent.actionName;
}
return 'None';
/* NOP */;
}
public function CanShowFocusInteractionIcon() : Bool{
return true;
/* NOP */;
}
public function GetInteractionData(actionName : CName, text : String) :
Bool{
return false;
/* NOP */;
}
}
class CAIWildHuntTwoHandedAxeCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){

combatStyles.Clear();
combatStyles.PushBack(new CAIWildHuntTwoHandedAxeCombatStyle in
this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAIWildHuntTwoHandedAxeCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAIWildHuntStyleTwoHandedAxeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntStyleTwoHandedAxeParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIWildHuntTwoHandedPol
earmAttackActionTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAIWildHuntTwoHandedPolearmAttackActionTree extends CAIAttackActionTree{
public function Init(){
super.Init();
params = new CAIBasicAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHalberdDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAIWildHuntTwoHandedHalberdCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHalberdCombat extends CAINpcCombat{
public function Init(){
params = new CAIWildHuntTwoHandedHalberdCombatParams in this;
params.OnCreated();

/* NOP */;
}
}
class CAIWildHuntTwoHandedHalberdCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAIWildHuntTwoHandedHalberdCombatStyle
in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHalberdCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAIWildHuntStyleTwoHandedHalberdParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct CBloodTrailEffect{
import public final function GetEffectName() : CName;
}
class CAIWildHuntStyleTwoHandedHalberdParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIWildHuntTwoHandedPol
earmAttackActionTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
attackBehavior.params.farAttackActionRange = 'thrust320';
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAIWildHuntTwoHandedHammerDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAIWildHuntTwoHandedHammerCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHammerCombat extends CAINpcCombat{

public function Init(){


params = new CAIWildHuntTwoHandedHammerCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHammerCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAIWildHuntTwoHandedHammerCombatStyle
in this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAIWildHuntTwoHandedHammerCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAIWildHuntStyleTwoHandedHammerParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntStyleTwoHandedHammerParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIWildHuntTwoHandedPol
earmAttackActionTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAIWildHuntTwoHandedSpearDefaults extends CAINpcDefaults{
public function Init(){
super.Init();
combatTree = new CAIWildHuntTwoHandedSpearCombat in this;
combatTree.OnCreated();
/* NOP */;
}
}
import abstract class ISpawnTreeSpawnStrategy{
}
class CAIWildHuntTwoHandedSpearCombat extends CAINpcCombat{

public function Init(){


params = new CAIWildHuntTwoHandedSpearCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class SEncounterGroupLimit{
}
class CAIWildHuntTwoHandedSpearCombatParams extends CAINpcCombatParams{
private function SetupCombatStyles(){
combatStyles.Clear();
combatStyles.PushBack(new CAIWildHuntTwoHandedSpearCombatStyle i
n this);
InitializeCombatStyles();
/* NOP */;
}
}
class CAIWildHuntTwoHandedSpearCombatStyle extends CAINpcCombatStyle{
public function Init(){
super.Init();
params = new CAIWildHuntStyleTwoHandedSpearParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIWildHuntStyleTwoHandedSpearParams extends CAINpcCombatStyleParams{
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAIWildHuntTwoHandedPol
earmAttackActionTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
attackBehavior.params.farAttackAction = new CAISimpleAttackActio
nTree in attackBehavior.params;
attackBehavior.params.farAttackAction.OnCreated();
attackBehavior.params.farAttackActionRange = 'thrust320';
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterHitAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
import abstract class ISpawnTreeBranch{
}
import struct IBehTreeConditionalTaskDefinition{
}

import abstract class CEncounterCreatureDefinition{


}
import abstract class CEncounterParameters{
}
class BTCondNumberOfSummonedCreaturesAlive extends IBehTreeTask{
public var value : Float;
public var operator : EOperator;
public function IsAvailable() : Bool{
var oppNo : Int32;
var summonerComponent : W3SummonerComponent;
summonerComponent = (W3SummonerComponent)GetNPC().GetComponentBy
ClassName('W3SummonerComponent');
if (!summonerComponent){
/* NOP */;
return false;
}
oppNo = summonerComponent.GetNumberOfSummonedEntities();
switch(operator){
case 0:
return oppNo == value;
case 1:
return oppNo != value;
case 2:
return oppNo < value;
case 3:
return oppNo <= value;
case 4:
return oppNo > value;
case 5:
return oppNo >= value;
default:
}
return false;
/* NOP */;
}
}
class W3ActorLatentActionFollowPlayer extends IPresetActorLatentAction{
public editable var moveType : EMoveType;
public editable var keepDistance : Bool;
public editable var followDistance : Float;
public editable var moveSpeed : Float;
public editable var teleportToCatchup : Bool;
public editable var cachupDistance : Float;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIFollowAction;
action = new CAIFollowAction in parentObj;
action.OnCreated();
action.params.targetTag = 'PLAYER';
action.params.moveType = moveType;
action.params.keepDistance = keepDistance;
action.params.followDistance = followDistance;
action.params.moveSpeed = moveSpeed;
action.params.teleportToCatchup = teleportToCatchup;
action.params.cachupDistance = cachupDistance;
return action;

/* NOP */;
}
}
class CBTTaskPlayAnimationEventDecorator extends IBehTreeTask{
public var finishTaskOnAllowBlend : Bool;
public var rotateOnRotateEvent : Bool;
public var disableHitOnActivation : Bool;
public var disableLookatOnActivation : Bool;
public var interruptOverlayAnim : Bool;
public var checkStats : Bool;
public var xmlMoraleCheckName : CName;
public var xmlStaminaCostName : CName;
public var drainStaminaOnUse : Bool;
private var staminaCost : Float;
private var moraleThreshold : Float;
private var lookAt : Bool;
private var hitAnim : Bool;
private var additiveHits : Bool;
private var slowMo : Bool;
private var guardOpen : Bool;
private var unstoppable : Bool;
private var waitingForEndOfDisableHit : Bool;
protected var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CBaseAICombatStorage;
public function IsAvailable() : Bool{
if (checkStats){
GetStats();
if (IsNameValid(xmlStaminaCostName) && GetActor().GetSta
t(2, /* NOP */) < staminaCost){
return false;
}
if (IsNameValid(xmlMoraleCheckName) && GetActor().GetSta
t(5, /* NOP */) < moraleThreshold){
return false;
}
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
GetStats();
if (drainStaminaOnUse && staminaCost){
npc.DrainStamina(13, staminaCost, 1, /* NOP */, /* NOP *
/, /* NOP */);
}
if (disableHitOnActivation){
npc.SetCanPlayHitAnim(false);
}
if (disableLookatOnActivation){
npc.SignalGameplayEvent('LookatOff');
lookAt = true;
}
if (interruptOverlayAnim){
npc.RaiseEvent('InterruptOverlay');
}
return 0;
/* NOP */;

}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
if (hitAnim || disableHitOnActivation){
npc.SetCanPlayHitAnim(true);
hitAnim = false;
}
if (unstoppable){
npc.SetUnstoppable(false);
unstoppable = false;
}
if (lookAt){
lookAt = false;
npc.SignalGameplayEvent('LookatOn');
}
if (additiveHits){
npc.SetUseAdditiveHit(false, /* NOP */, /* NOP */);
}
if (slowMo){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(2));
slowMo = false;
}
if (guardOpen){
npc.SetGuarded(true);
}
if (waitingForEndOfDisableHit){
npc.SetCanPlayHitAnim(true);
waitingForEndOfDisableHit = false;
}
/* NOP */;
}
public function Roll(chance : Float) : Bool{
if (chance >= 100){
return true;
} else if (RandRange(100, /* NOP */) < chance){
return true;
}
return false;
/* NOP */;
}
public function GetStats(){
if (xmlStaminaCostName){
staminaCost = CalculateAttributeValue(GetNPC().GetAttrib
uteValue(xmlStaminaCostName, /* NOP */, /* NOP */), /* NOP */);
}
if (xmlMoraleCheckName){
moraleThreshold = CalculateAttributeValue(GetNPC().GetAt
tributeValue(xmlMoraleCheckName, /* NOP */, /* NOP */), /* NOP */);
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (finishTaskOnAllowBlend && animEventName == 'AllowBlend' && a
nimEventType == 1){
Complete(true);
} else if (animEventName == 'LTrail'){

if (animEventType == 1){
npc.PlayEffect('l_trail', /* NOP */);
} else if (animEventType == 3){
npc.StopEffect('l_trail');
}
} else if (animEventName == 'RTrail'){
if (animEventType == 1){
npc.PlayEffect('r_trail', /* NOP */);
} else if (animEventType == 3){
npc.StopEffect('r_trail');
}
} else if (animEventName == 'DisableHitAnim' && !disableHitOnAct
ivation){
if (animEventType == 3){
npc.SetCanPlayHitAnim(true);
hitAnim = false;
waitingForEndOfDisableHit = false;
} else {
npc.SetCanPlayHitAnim(false);
waitingForEndOfDisableHit = true;
hitAnim = true;
}
} else if (animEventName == 'SetUnstoppable' && !disableHitOnAct
ivation){

} else

} else

} else

} else

if (animEventType == 3){
npc.SetUnstoppable(false);
unstoppable = false;
} else {
npc.SetUnstoppable(true);
unstoppable = true;
}
if (animEventName == 'LookatOff'){
if (animEventType == 1){
npc.SignalGameplayEvent('LookatOff');
lookAt = true;
} else if (animEventType == 3){
npc.SignalGameplayEvent('LookatOn');
lookAt = false;
}
if (animEventName == 'LookatOn'){
if (animEventType == 1){
npc.SignalGameplayEvent('LookatOn');
lookAt = false;
}
if (animEventName == 'AdditiveHitsOnly'){
if (animEventType == 1){
npc.SetCanPlayHitAnim(false);
hitAnim = true;
} else if (animEventType == 3){
npc.SetCanPlayHitAnim(true);
hitAnim = false;
}
if (animEventName == 'OpenGuard' && npc.HasShieldedAbilit

y()){
if (animEventType == 1){
npc.SetGuarded(false);
guardOpen = true;
} else if (animEventType == 3){
npc.SetGuarded(true);
guardOpen = false;

}
} else if (animEventName == 'Invulnerable'){
if (animEventType == 1){
npc.SetImmortalityMode(2, 2, /* NOP */);
} else if (animEventType == 3){
npc.SetImmortalityMode(0, 2, /* NOP */);
}
} else if (animEventName == 'DisableGameplayVisibility'){
if (animEventType == 1){
npc.SetGameplayVisibility(false);
} else if (animEventType == 3){
npc.SetGameplayVisibility(true);
}
} else if (animEventName == 'DisableProxyCollisions'){
if (animEventType == 1){
npc.EnableCharacterCollisions(false);
} else if (animEventType == 3){
npc.EnableCharacterCollisions(true);
}
}
return false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (rotateOnRotateEvent){
if (eventName == 'RotateEventStart'){
GetNPC().SetRotationAdjustmentRotateTo(GetCombat
Target(), /* NOP */);
return true;
}
if (eventName == 'RotateAwayEventStart'){
GetNPC().SetRotationAdjustmentRotateTo(GetCombat
Target(), 180.000000);
return true;
}
}
return false;
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CBaseAICombatStorage)storageHandler
.Get();
}
/* NOP */;
}
}
statemachine class W3QuenEntity extends W3SignEntity{
public editable var effects : array<SQuenEffects>;
public editable var hitEntityTemplate : CEntityTemplate;
protected var shieldDuration : Float;
protected var shieldHealth : Float;
protected var dischargePercent : Float;
protected var ownerBoneIndex : Int32;
protected var blockedAllDamage : Bool;
protected var shieldStartTime : EngineTime;
private var hitEntityTimestamps : array<EngineTime>;
private const var MIN_HIT_ENTITY_SPAWN_DELAY : Float;

private var hitDoTEntities : array<W3VisualFx>;


public var isForceFinished : Bool;
public function GetSignType() : ESignType{
return 3;
/* NOP */;
}
public function SetBlockedAllDamage(b : Bool){
blockedAllDamage = b;
/* NOP */;
}
public function GetBlockedAllDamage() : Bool{
return blockedAllDamage;
/* NOP */;
}
public function Init(inOwner : W3SignOwner, prevInstance : W3SignEntity,
skipCastingAnimation : Bool) : Bool{
var oldQuen : W3QuenEntity;
ownerBoneIndex = inOwner.GetActor().GetBoneIndex('pelvis');
oldQuen = (W3QuenEntity)prevInstance;
if (oldQuen){
oldQuen.OnSignAborted(true);
}
hitEntityTimestamps.Clear();
return super.Init(inOwner, prevInstance, skipCastingAnimation);
/* NOP */;
}
public function OnTargetHit(damageData : W3DamageAction) : Bool{
if (owner.GetActor() == thePlayer && !damageData.IsDoTDamage() &
& !damageData.WasDodged()){
theGame.VibrateControllerHard(/* NOP */);
}
/* NOP */;
}
protected function GetSignStats(){
super.GetSignStats();
shieldDuration = CalculateAttributeValue(owner.GetSkillAttribute
Value(skillEnum, 'shield_duration', true, true), /* NOP */);
shieldHealth = CalculateAttributeValue(owner.GetSkillAttributeVa
lue(skillEnum, 'shield_health', false, true), /* NOP */);
if (owner.CanUseSkill(50)){
dischargePercent = CalculateAttributeValue(owner.GetSkil
lAttributeValue(50, 'discharge_percent', false, true), /* NOP */) * owner.GetSki
llLevel(50);
} else {
dischargePercent = 0;
}
/* NOP */;
}
public final function AddBuffImmunities(useDoTs : Bool){
var actor : CActor;
var i : Int32;
var crits : array<CBaseGameplayEffect>;
actor = owner.GetActor();
crits = actor.GetBuffs(/* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < crits.Size()){
if (IsDoTEffect(crits[i]) && crits[i].GetEffectType() !=
113 && crits[i].GetEffectType() != 58){
actor.RemoveEffect(crits[i], true);
} else if (crits[i].GetEffectType() == 113 || crits[i].G

etEffectType() == 58){
actor.FinishQuen();
return;
}
i += 1;
}
/* NOP */;
}
public final function RemoveBuffImmunities(useDoTs : Bool){
var actor : CActor;
var i : Int32;
var size : Int32;
var dots : array<EEffectType>;
actor = owner.GetActor();
dots.PushBack(16);
dots.PushBack(18);
dots.PushBack(19);
dots.PushBack(15);
dots.PushBack(52);
if (useDoTs){
i = 0;
while (i < dots.Size()){
actor.RemoveBuffImmunity(dots[i], 'Quen');
i += 1;
}
}
size = EnumGetMax('EEffectType') + 1;
i = 0;
while (i < size){
if (IsCriticalEffectType(i) && !dots.Contains(i)){
actor.RemoveBuffImmunity(i, 'Quen');
}
i += 1;
}
/* NOP */;
}
public function OnStarted() : Bool{
var isAlternate : Bool;
owner.ChangeAspect(this, 40);
isAlternate = IsAlternateCast();
if (isAlternate){
CreateAttachment(owner.GetActor(), 'quen_sphere', /* NOP
*/, /* NOP */);
if ((CPlayer)owner.GetActor()){
GetWitcherPlayer().FailFundamentalsFirstAchievem
entCondition();
}
} else {
super.OnStarted();
}
if (owner.GetActor() == thePlayer && ShouldProcessTutorial('Tuto
rialSelectQuen')){
FactsAdd("tutorial_quen_cast", /* NOP */, /* NOP */);
}
if ((CPlayer)owner.GetActor()){
GetWitcherPlayer().FailFundamentalsFirstAchievementCondi
tion();
}
if (isAlternate || !owner.IsPlayer()){
PlayEffect(effects[1].castEffect, /* NOP */);

CacheActionBuffsFromSkill();
GotoState('QuenChanneled', /* NOP */, /* NOP */);
} else {
PlayEffect(effects[0].castEffect, /* NOP */);
GotoState('QuenShield', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function Impulse(){
var level : Int32;
var i : Int32;
var j : Int32;
var atts : array<CName>;
var damages : array<CName>;
var ents : array<CGameplayEntity>;
var action : W3DamageAction;
var dm : CDefinitionsManagerAccessor;
var skillAbilityName : CName;
var dmg : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var ownerActor : CActor;
level = owner.GetSkillLevel(49);
dm = theGame.GetDefinitionsManager();
skillAbilityName = owner.GetPlayer().GetSkillAbilityName(49);
ownerActor = owner.GetActor();
if (level >= 2){
dm.GetAbilityAttributes(skillAbilityName, atts);
i = 0;
while (i < atts.Size()){
if (IsDamageTypeNameValid(atts[i])){
damages.PushBack(atts[i]);
}
i += 1;
}
}
FindGameplayEntitiesInSphere(ents, ownerActor.GetWorldPosition()
, 3, 1000, 'None', 4 + 32 + 256 + 64 + 16384, ownerActor, /* NOP */);
i = 0;
while (i < ents.Size()){
action = new W3DamageAction in theGame;
action.Initialize(ownerActor, ents[i], this, "quen_impul
se", 2, 1, false, false, true, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */
);
action.SetSignSkill(49);
action.SetCannotReturnDamage(true);
action.SetProcessBuffsIfNoDamage(true);
if (!IsAlternateCast() && level >= 2){
action.SetHitEffect('hit_electric_quen', /* NOP
*/, /* NOP */);
action.SetHitEffect('hit_electric_quen', true, /
* NOP */);
action.SetHitEffect('hit_electric_quen', false,
true);
action.SetHitEffect('hit_electric_quen', true, t
rue);
}
if (level >= 1){
action.AddEffectInfo(13, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);

}
if (level >= 2){
j = 0;
while (j < damages.Size()){
dm.GetAbilityAttributeValue(skillAbility
Name, damages[j], min, max);
dmg = CalculateAttributeValue(GetAttribu
teRandomizedValue(min, max), /* NOP */);
action.AddDamage(damages[j], dmg);
j += 1;
}
}
if (level == 3){
action.AddEffectInfo(10, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
}
theGame.damageMgr.ProcessAction(action);
delete action;
i += 1;
}
if (IsAlternateCast()){
super.PlayHitEffect('quen_impulse_explode', ownerActor.G
etWorldRotation(), /* NOP */);
} else {
ownerActor.PlayEffect('lasting_shield_impulse', /* NOP *
/);
}
if (IsAlternateCast() && level >= 2){
super.PlayHitEffect('quen_electric_explode', ownerActor.
GetWorldRotation(), /* NOP */);
}
/* NOP */;
}
public final function IsAnyQuenActive() : Bool{
if (GetCurrentStateName() == 'QuenChanneled' || GetCurrentStateN
ame() == 'ShieldActive' && shieldHealth > 0){
return true;
}
return false;
/* NOP */;
}
public function OnSignAborted(force : Bool) : Bool{
}
public final function PlayHitEffect(fxName : CName, rot : EulerAngles, i
sDoT : Bool){
var hitEntity : W3VisualFx;
var currentTime : EngineTime;
var dt : Float;
currentTime = theGame.GetEngineTime();
if (hitEntityTimestamps.Size() > 0){
dt = EngineTimeToFloat(currentTime - hitEntityTimestamps
[0]);
if (dt < MIN_HIT_ENTITY_SPAWN_DELAY){
return;
}
}
hitEntityTimestamps.Erase(0);
hitEntityTimestamps.PushBack(currentTime);
hitEntity = (W3VisualFx)theGame.CreateEntity(hitEntityTemplate,
GetWorldPosition(), rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);

if (hitEntity){
hitEntity.CreateAttachment(owner.GetActor(), 'quen_spher
e', /* NOP */, rot);
hitEntity.PlayEffect(fxName, /* NOP */);
hitEntity.DestroyOnFxEnd(fxName);
if (isDoT){
hitDoTEntities.PushBack(hitEntity);
}
}
/* NOP */;
}
public timer function RemoveDoTFX(optional dt : Float, optional id : Int
32){
super.RemoveHitDoTEntities();
/* NOP */;
}
public final function RemoveHitDoTEntities(){
var i : Int32;
i = hitDoTEntities.Size() - 1;
while (i >= 0){
if (hitDoTEntities[i]){
hitDoTEntities[i].Destroy();
}
i -= 1;
}
/* NOP */;
}
public final function GetShieldHealth() : Float{
return shieldHealth;
/* NOP */;
}
public final function GetShieldRemainingDuration() : Float{
return shieldDuration - EngineTimeToFloat(theGame.GetEngineTime(
) - shieldStartTime);
/* NOP */;
}
public final function SetDataFromSave(health : Float, duration : Float){
shieldHealth = health;
shieldDuration = duration;
shieldStartTime = theGame.GetEngineTime();
AddTimer('Expire', shieldDuration, false, /* NOP */, /* NOP */,
true, true);
/* NOP */;
}
public timer function Expire(optional deltaTime : Float, optional id : I
nt32){
GotoState('Expired', /* NOP */, /* NOP */);
/* NOP */;
}
public final function ForceFinishQuen(){
if (IsAlternateCast()){
OnEnded(/* NOP */);
owner.GetActor().PlayEffect('hit_electric_quen', /* NOP
*/);
} else {
isForceFinished = true;
GotoState('Expired', /* NOP */, /* NOP */);
}
/* NOP */;
}

}
class W3Mutagen26_Effect extends W3Mutagen_Effect{
public final function GetReturnedDamage(points : Float, percents : Float
){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dmg : SAbilityAttributeValue;
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'returned_damage', min, max);
dmg = GetAttributeRandomizedValue(min, max);
points = dmg.valueAdditive;
percents = dmg.valueMultiplicative;
/* NOP */;
}
}
class CBTTaskSelectTargetFromList extends IBehTreeTask{
public var targetList : array<CName>;
private var currentTargetIndex : Int32;
private var currentTarget : CNode;
private var targetToSelect : CNode;
public function IsAvailable() : Bool{
if (isActive){
return true;
}
return SelectTarget();
/* NOP */;
}
public function SelectTarget() : Bool{
var target : CNode;
if (currentTarget && targetToSelect == currentTarget){
return true;
}
if (targetList.Size() <= 0){
return false;
}
if (currentTargetIndex >= targetList.Size()){
return false;
}
targetToSelect = theGame.GetNodeByTag(targetList[currentTargetIn
dex]);
if (!targetToSelect){
return false;
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (!targetToSelect){
SelectTarget();
}
if (!targetToSelect){
return 1;
}
SetActionTarget(targetToSelect);
currentTarget = targetToSelect;
currentTargetIndex += 1;
GetNPC().SignalGameplayEventParamInt('CurrentTargetIndex', curre
ntTargetIndex);

return 0;
/* NOP */;
}
public function OnDeactivate(){
targetToSelect = NULL;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var tempIndex : Int32;
var tempTag : CName;
if (eventName == 'ChangeNextTeleportPoint'){
tempTag = GetEventParamCName('None');
if (tempTag != 'None'){
tempIndex = targetList.FindFirst(tempTag);
}
} else {
tempIndex = GetEventParamInt(-1);
}
if (tempIndex >= 0){
currentTargetIndex = tempIndex;
return true;
}
return false;
/* NOP */;
}
}
import abstract class ISpawnTreeBaseNode{
//NULL type for nodeName
}
class W3Potion_BlackBlood extends W3Effect_Aura{
public function GetReturnDamageValue() : SAbilityAttributeValue{
return effectValue;
/* NOP */;
}
protected function ApplySpawnsOn(victimGE : CGameplayEntity){
var tmpBool : Bool;
var tmpName : CName;
var actor : CActor;
var monsterCategory : EMonsterCategory;
actor = (CActor)victimGE;
if (!actor){
return;
}
theGame.GetMonsterParamsForActor(actor, monsterCategory, tmpName
, tmpBool, tmpBool, tmpBool);
if (GetBuffLevel() == 3 && monsterCategory == 6 || monsterCatego
ry == 2){
super.ApplySpawnsOn(victimGE);
}
/* NOP */;
}
}
import abstract class ISpawnTreeInitializer{
}
import abstract class CSpawnTree{
}

class CBTTaskAnimalSetIsScared extends IBehTreeTask{


public var value : Bool;
public var setOnDeactivate : Bool;
public var aiStorageHandler : CAIStorageHandler;
public function OnActivate() : EBTNodeStatus{
var animalData : CAIStorageAnimalData;
if (setOnDeactivate == false){
animalData = (CAIStorageAnimalData)aiStorageHandler.Get(
);
animalData.scared = value;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var animalData : CAIStorageAnimalData;
if (setOnDeactivate){
animalData = (CAIStorageAnimalData)aiStorageHandler.Get(
);
animalData.scared = value;
}
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('AnimalData', '*CAIStorageAnimalData
', this);
aiStorageHandler.Get();
/* NOP */;
}
}
class CBTCondAnimalIsScared extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
var animalData : CAIStorageAnimalData;
if (GetNPC().GetAttitudeGroup() == 'animals' || GetNPC().GetAtti
tudeGroup() == 'AG_small_animals'){
}
animalData = (CAIStorageAnimalData)aiStorageHandler.Get();
return animalData.scared;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var animalData : CAIStorageAnimalData;
animalData = (CAIStorageAnimalData)aiStorageHandler.Get();
animalData.scared = true;
return true;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('AnimalData', '*CAIStorageAnimalData
', this);
aiStorageHandler.Get();
/* NOP */;
}
}

abstract class IBehTreeHorseConditionalTaskDefinition extends IBehTreeConditiona


lTaskDefinition{
}
class CBTTask3StateAttack extends CBTTaskAttack{
public var loopTime : Float;
public var endTaskWhenOwnerGoesPastTarget : Bool;
public var stopRotatingWhenTargetIsBehind : Bool;
public var playFXOnLoopStart : CName;
public var playLoopFXInterval : Float;
private var startPos : Vector;
public var lastFXTime : Float;
public function OnActivate() : EBTNodeStatus{
InitializeCombatDataStorage();
combatDataStorage.SetIsAttacking(true, GetLocalTime());
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var loopRes : Int32;
npc = GetNPC();
npc.SetBehaviorVariable('AttackEnd', 0.000000, /* NOP */);
if (npc.RaiseForceEvent('3StateAttack')){
npc.WaitForBehaviorNodeDeactivation('AttackStart', 10.00
0000);
} else {
return 1;
}
if (IsNameValid(playFXOnLoopStart) && playLoopFXInterval <= 0){
npc.PlayEffect(playFXOnLoopStart, /* NOP */);
}
loopRes = Loop();
if (loopRes){
return 2;
}
ChooseAnim();
if (IsNameValid(playFXOnLoopStart)){
npc.StopEffect(playFXOnLoopStart);
}
npc.SetBehaviorVariable('AttackEnd', 1.000000, /* NOP */);
npc.WaitForBehaviorNodeDeactivation('AttackEnd', 10.000000);
if (loopRes == -1){
return 1;
}
return 2;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
ChooseAnim();
if (IsNameValid(playFXOnLoopStart)){
npc.StopEffect(playFXOnLoopStart);
}
npc.SetBehaviorVariable('AttackEnd', 1.000000, /* NOP */);
super.OnDeactivate();
/* NOP */;
}
public latent function Loop() : Int32{

var endTime : Float;


var dotProduct : Float;
var playFX : Bool;
var npc : CNewNPC;
var target : CActor;
var targetPos : Vector;
var npcPos : Vector;
endTime = GetLocalTime() + loopTime;
playFX = IsNameValid(playFXOnLoopStart) && playLoopFXInterval >
0;
if (endTaskWhenOwnerGoesPastTarget){
npc = GetNPC();
target = GetCombatTarget();
startPos = npc.GetWorldPosition();
dotProduct = 0;
if (playFX){
npc.PlayEffect(playFXOnLoopStart, /* NOP */);
}
while (dotProduct >= 0.000000 && GetLocalTime() <= endTi
me){
if (playFX && GetLocalTime() > lastFXTime + play
LoopFXInterval){
npc.PlayEffect(playFXOnLoopStart, /* NOP
*/);
lastFXTime = GetLocalTime();
}
Sleep(0.250000);
npcPos = npc.GetWorldPosition();
targetPos = target.GetWorldPosition();
dotProduct = VecDot(targetPos - startPos, target
Pos - npcPos);
}
} else {
while (GetLocalTime() <= endTime){
if (playFX){
npc.PlayEffect(playFXOnLoopStart, /* NOP
*/);
Sleep(playLoopFXInterval);
} else {
SleepOneFrame();
}
}
}
return 0;
/* NOP */;
}
public function ChooseAnim(){
return;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (stopRotatingWhenTargetIsBehind && eventName == 'RotateEventS
ync'){
if (AbsF(NodeToNodeAngleDistance(GetCombatTarget(), GetA
ctor())) < 90){
return super.OnGameplayEvent('RotateEventStart')
;
} else {
GetNPC().SuspendRotationAdjustment();
return true;

}
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
}
class CBTTask3StateCharge extends CBTTask3StateAttack{
public var differentChargeEndings : Bool;
public var bCollisionWithActor : Bool;
public var loopStart : Bool;
public var isEnding : Bool;
public var attached : Bool;
public var cameraIndex : Int32;
public var collidedActor : CActor;
public function IsAvailable() : Bool{
if (theGame.GetWorld().NavigationLineTest(GetActor().GetWorldPos
ition(), GetCombatTarget().GetWorldPosition(), GetActor().GetRadius(), /* NOP */
, /* NOP */)){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
combatDataStorage.SetIsCharging(true);
return super.OnActivate();
/* NOP */;
}
public latent function Loop() : Int32{
var endTime : Float;
var dist : Float;
var minDistance : Float;
var npcSightCone : Float;
var testedAngle : Float;
var npc : CNewNPC;
var action : W3DamageAction;
var target : CActor;
minDistance = 6;
npcSightCone = 90;
npc = GetNPC();
endTime = GetLocalTime() + loopTime;
loopStart = true;
while (!bCollisionWithActor && GetLocalTime() <= endTime){
SleepOneFrame();
if (differentChargeEndings){
dist = VecDistance2D(npc.GetWorldPosition(), npc
.GetTarget().GetWorldPosition());
if (dist < minDistance){
testedAngle = AbsF(NodeToNodeAngleDistan
ce(npc.GetTarget(), npc));
if (testedAngle < npcSightCone / 2){
npc.SetBehaviorVariable('ChargeE
ndType', 1, true);
break;
}
} else {
npc.SetBehaviorVariable('ChargeEndType',
0, true);
}

}
if (!theGame.GetWorld().NavigationLineTest(npc.GetWorldP
osition(), npc.GetWorldPosition() + npc.GetHeadingVector(), GetActor().GetRadius
(), /* NOP */, /* NOP */)){
break;
}
}
if (collidedActor){
action = new W3DamageAction in this;
action.Initialize(npc, collidedActor, NULL, npc.GetName(
), 0, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING,
20);
action.AddEffectInfo(10, 2.000000, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
}
npc.SetBehaviorVariable('AttackEnd', 1.000000, true);
npc.WaitForBehaviorNodeDeactivation('AttackEnd', 10.000000);
return 1;
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
bCollisionWithActor = false;
isEnding = false;
collidedActor = NULL;
loopStart = false;
combatDataStorage.SetIsCharging(false);
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var player : CActor;
npc = GetNPC();
if (loopStart && !bCollisionWithActor && eventName == 'Collision
WithActor'){
collidedActor = (CActor)GetEventParamObject();
if (IsRequiredAttitudeBetween(npc, collidedActor, true,
/* NOP */, /* NOP */)){
bCollisionWithActor = true;
}
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
}
import abstract class SWanderAndWorkEntryGeneratorParams{
//NULL type for creatureEntry
//NULL type for wander
//NULL type for work
}
import abstract class SWorkEntryGeneratorParam{
//NULL type for creatureEntry
//NULL type for work
}

class W3BoltProjectile extends W3ArrowProjectile{


private editable var dismemberOnKill : Bool;
private editable var dodgeable : Bool;
private var projectiles : array<W3BoltProjectile>;
private saved var targetPos : Vector;
private saved var crossbowId : SItemUniqueId;
private var collisionGroups : array<CName>;
protected saved var wasShotUnderWater : Bool;
private var visibility : Bool;
public function InitializeCrossbow(ownr : CActor, boltId : SItemUniqueId
, crossId : SItemUniqueId){
Initialize(ownr, boltId);
crossbowId = crossId;
/* NOP */;
}
public function OnProjectileInit() : Bool{
InitCollisionGroups();
super.OnProjectileInit();
/* NOP */;
}
private function InitCollisionGroups(){
if (collisionGroups.Size() <= 0){
collisionGroups.PushBack('Ragdoll');
collisionGroups.PushBack('Static');
collisionGroups.PushBack('Terrain');
collisionGroups.PushBack('Water');
collisionGroups.PushBack('Character');
}
/* NOP */;
}
public function DismembersOnKill() : Bool{
return dismemberOnKill;
/* NOP */;
}
protected function ProcessDamageAction(victim : CGameplayEntity, pos : V
ector, boneName : CName){
var action : W3Action_Attack;
var victimTags : array<CName>;
var attackerTags : array<CName>;
if (caster == thePlayer){
thePlayer.ApplyItemAbilities(itemId);
thePlayer.ApplyItemAbilities(crossbowId);
}
action = new W3Action_Attack in this;
action.Init((CGameplayEntity)caster, victim, this, itemId, 'bolt
', caster.GetName(), 1, false, false, 'None', 5, 4, false, true, false, false, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, crossbowId);
if ((CNewNPC)victim){
if (boneName == 'head' || boneName == 'neck' || boneName
== 'hroll' || boneName == 'pelvis' && (CNewNPC)victim.IsHuman()){
action.SetHeadShot();
}
}
theGame.damageMgr.ProcessAction(action);
delete action;
if (caster == thePlayer){
thePlayer.RemoveItemAbilities(itemId);
thePlayer.RemoveItemAbilities(crossbowId);
}

collidedEntities.PushBack(victim);
if (caster == thePlayer && (CActor)victim && IsRequiredAttitudeB
etween(caster, victim, true, /* NOP */, /* NOP */)){
FactsAdd("ach_crossbow", 1, 4);
}
victimTags = victim.GetTags();
attackerTags = caster.GetTags();
AddHitFacts(victimTags, attackerTags, "_bolt_hit", /* NOP */, /*
NOP */);
/* NOP */;
}
public function OnProcessThrowEvent(animEventName : CName) : Bool{
var throwPos : Vector;
var boneIndex : Int32;
var orientationTarget : EOrientationTarget;
var tempComponent : CDrawableComponent;
var entityHeight : Float;
var ownerPlayer : CR4Player;
var mat : Matrix;
var targetPosDist : Float;
var maxRangePos : Vector;
if (animEventName == 'ProjectileThrow'){
ownerPlayer = (CR4Player)GetOwner();
if (ownerPlayer){
targetPosDist = VecDistance(ownerPlayer.GetLookA
tPosition(), ownerPlayer.GetWorldPosition());
maxRangePos = VecNormalize(ownerPlayer.GetLookAt
Position() - ownerPlayer.GetWorldPosition()) * theGame.params.MAX_THROW_RANGE +
ownerPlayer.GetWorldPosition();
if (ownerPlayer.GetOrientationTarget() == 0){
throwPos = maxRangePos;
} else if (targetPosDist > theGame.params.MAX_TH
ROW_RANGE){
throwPos = maxRangePos;
} else {
throwPos = ownerPlayer.GetLookAtPosition
();
}
}
ThrowProjectile(throwPos);
}
return super.OnProcessThrowEvent(animEventName);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CActor;
victim = (CActor)collidingComponent.GetEntity();
if (CanCollideWithVictim(victim)){
if (super.OnProjectileCollision(pos, normal, collidingCo
mponent, hitCollisionsGroups, actorIndex, shapeIndex)){
SmartDestroy();
}
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
}
public function SetVisibility(flag : Bool){

visibility = flag;
if (Visibility()){
AddTimer('SetVisibilityTimer', 0.000000, true, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function SetVisibilityTimer(optional dt : Float, optional
id : Int32){
Visibility();
/* NOP */;
}
private function Visibility() : Bool{
var comp : CDrawableComponent;
comp = (CDrawableComponent)GetComponentByClassName('CDrawableCom
ponent');
if (comp){
if (visibility == comp.IsVisible()){
RemoveTimer('SetVisibilityTimer', /* NOP */);
} else {
comp.SetVisible(visibility);
return true;
}
}
return false;
/* NOP */;
}
public function ThrowProjectile(targetPosIn : Vector){
var inv : CInventoryComponent;
var splitCount : Int32;
var additionalProjectile : W3BoltProjectile;
if (GetOwner() == thePlayer){
theGame.VibrateControllerHard(/* NOP */);
}
inv = GetOwner().GetInventory();
projectiles.Clear();
projectiles.PushBack(this);
wasShotUnderWater = (CMovingPhysicalAgentComponent)GetOwner().Ge
tMovingAgentComponent().IsDiving();
splitCount = CalculateAttributeValue(inv.GetItemAttributeValue(i
temId, 'split_count', /* NOP */, /* NOP */), /* NOP */);
if (splitCount == 2 || splitCount == 3){
additionalProjectile = (W3BoltProjectile)Duplicate(/* NO
P */);
additionalProjectile.Init(GetOwner());
additionalProjectile.CreateAttachment(GetOwner(), 'bolt'
, /* NOP */, /* NOP */);
projectiles.PushBack(additionalProjectile);
if (splitCount > 2){
additionalProjectile = (W3BoltProjectile)Duplica
te(/* NOP */);
additionalProjectile.Init(GetOwner());
additionalProjectile.CreateAttachment(GetOwner()
, 'bolt', /* NOP */, /* NOP */);
projectiles.PushBack(additionalProjectile);
}
}
targetPos = targetPosIn;
projectiles[0].BreakAttachment();
projectiles[0].CheckIfInfWater();

AddTimer('ReleaseProjectiles', 0.001000, false, /* NOP */, /* NO


P */, /* NOP */, /* NOP */);
super.ThrowProjectile(targetPosIn);
/* NOP */;
}
public timer function ReleaseProjectiles(optional time : Float, optional
id : Int32){
var sideVec : Vector;
var vecToTarget : Vector;
var sideLen : Float;
var pos1 : Vector;
var rot1 : EulerAngles;
pos1 = projectiles[0].GetWorldPosition();
rot1 = projectiles[0].GetWorldRotation();
if (projectiles.Size() > 1){
projectiles[1].BreakAttachment();
projectiles[1].TeleportWithRotation(pos1, rot1);
projectiles[1].CheckIfInfWater();
if (projectiles.Size() > 2){
projectiles[2].BreakAttachment();
projectiles[2].TeleportWithRotation(pos1, rot1);
projectiles[2].CheckIfInfWater();
}
}
AddTimer('ReleaseProjectiles2', 0.001000, false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function ReleaseProjectiles2(optional time : Float, optiona
l id : Int32){
var sideVec : Vector;
var vecToTarget : Vector;
var sideLen : Float;
var distanceToTarget : Float;
var projectileFlightTime : Float;
var attackRange : Float;
var target : CActor;
var inv : CInventoryComponent;
var boneIndex : Int32;
var npc : CNewNPC;
target = thePlayer.GetTarget();
if (thePlayer.IsSwimming()){
attackRange = theGame.params.MAX_THROW_RANGE;
} else {
attackRange = theGame.params.UNDERWATER_THROW_RANGE;
}
boneIndex = -1;
if (thePlayer.IsCombatMusicEnabled() && thePlayer.GetDisplayTarg
et() && thePlayer.playerAiming.GetCurrentStateName() == 'Waiting'){
npc = (CNewNPC)thePlayer.GetDisplayTarget();
if (npc){
boneIndex = npc.GetBoneIndex('torso2');
}
}
if (boneIndex >= 0){
projectiles[0].ShootProjectileAtBone(projAngle, projSpee
d, npc, 'torso2', attackRange, collisionGroups);
} else {
projectiles[0].ShootProjectileAtPosition(projAngle, proj
Speed, targetPos, attackRange, collisionGroups);

}
projectiles[0].SoundEvent("cmb_arrow_swoosh", /* NOP */, /* NOP
*/);
if (!FactsDoesExist("debug_fact_inf_bolts")){
inv = GetOwner().GetInventory();
if (!inv.ItemHasTag(itemId, theGame.params.TAG_INFINITE_
AMMO)){
inv.RemoveItem(itemId, /* NOP */);
}
}
if (dodgeable && target){
distanceToTarget = VecDistance(thePlayer.GetWorldPositio
n(), target.GetWorldPosition());
projectileFlightTime = distanceToTarget / projSpeed;
target.SignalGameplayEventParamFloat('Time2DodgeProjecti
le', projectileFlightTime);
}
if (projectiles.Size() > 1){
vecToTarget = GetOwner().GetWorldPosition() - targetPos;
sideVec = VecCross(VecNormalize(vecToTarget), Vector(0,
0, 1));
sideLen = SinF(3.000000 * Pi() / 180.000000) * VecLength
(vecToTarget);
projectiles[1].ShootProjectileAtPosition(projAngle, proj
Speed, targetPos + VecNormalize(sideVec) * sideLen, attackRange, collisionGroups
);
projectiles[1].SoundEvent("cmb_arrow_swoosh", /* NOP */,
/* NOP */);
if (projectiles.Size() > 2){
projectiles[2].ShootProjectileAtPosition(projAng
le, projSpeed, targetPos - VecNormalize(sideVec) * sideLen, attackRange, collisi
onGroups);
projectiles[2].SoundEvent("cmb_arrow_swoosh", /*
NOP */, /* NOP */);
}
}
/* NOP */;
}
}
import struct CSpawnTreeEntrySubDefinition{
//NULL type for creatureDefinition
//NULL type for partyMemberId
}
import abstract class CPartySpawnOrganizer{
}
abstract class CBTTaskCastSignDef extends CBTTaskPlayAnimationEventDecoratorDef{
}
import abstract class CSpawnTreeQuestPhase{
}
class CBehTreeCombatTargetSelectionTask extends IBehTreeTask{
public var maxTargetDistance : Float;
public var testMaxFrequency : Float;
public var nextTestDelay : Float;
public var nextTarget : CActor;
public var playerPriority : Int32;

public var targetOnlyPlayer : Bool;


public var ForceTarget : CActor;
public function IsAvailable() : Bool{
var owner : CNewNPC;
var tooFar : Bool;
var target : CActor;
var localTime : Float;
owner = GetNPC();
if (ForceTarget){
if (ForceTarget != GetCombatTarget()){
nextTarget = ForceTarget;
return true;
}
return false;
}
localTime = GetLocalTime();
if (nextTestDelay > localTime){
return false;
}
nextTestDelay = localTime + testMaxFrequency;
target = GetCombatTarget();
tooFar = target && !IsTargetInRange();
if (!target || target && !target.IsAlive() || owner.lastAttacker
|| tooFar){
if (FindTarget()){
return true;
}
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
SetCombatTarget(nextTarget);
nextTarget = NULL;
return 2;
/* NOP */;
}
public function EvaluatePotentialTarget(target : CActor) : Float{
var owner : CNewNPC;
var sum : Float;
var npcTarget : CNewNPC;
var dist : Float;
owner = GetNPC();
npcTarget = (CNewNPC)target;
if (!owner.IsDangerous(target)){
return 0;
}
if (npcTarget && owner.GetAttitude(thePlayer) != npcTarget.GetAt
titude(thePlayer)){
sum = sum + 10.000000;
}
if (target == GetCombatTarget() && target.IsAlive()){
sum = sum + 50.000000;
}
if (target == owner.lastAttacker){
sum = sum + 100.000000;
}
dist = VecDistance2D(owner.GetWorldPosition(), target.GetWorldPo
sition());
sum = sum + 1000.000000 * 1.000000 - dist / maxTargetDistance;

if (target == thePlayer){
if (RandRange(100, /* NOP */) < playerPriority){
sum = sum + 600.000000;
}
}
return sum;
/* NOP */;
}
public function FindTarget() : Bool{
var score : Float;
var maxScore : Float;
var bestTarget : CActor;
var newTarget : CActor;
var index : Int32;
var owner : CNewNPC;
owner = GetNPC();
if (targetOnlyPlayer){
bestTarget = NULL;
if (thePlayer.IsAlive() && owner.IsDangerous(thePlayer))
{
bestTarget = thePlayer;
}
} else {
maxScore = 0;
index = 0;
newTarget = owner.GetNoticedObject(index);
while (newTarget){
if (newTarget.IsAlive()){
score = EvaluatePotentialTarget(newTarge
t);
if (score > maxScore){
maxScore = score;
bestTarget = newTarget;
}
}
index = index + 1;
newTarget = owner.GetNoticedObject(index);
}
}
owner.lastAttacker = NULL;
if (bestTarget != GetCombatTarget()){
nextTarget = bestTarget;
return true;
}
return false;
/* NOP */;
}
public function IsTargetInRange() : Bool{
var owner : CNewNPC;
var target : CActor;
var res : Bool;
owner = GetNPC();
target = GetCombatTarget();
res = false;
if (target){
res = VecDistance2D(owner.GetWorldPosition(), target.Get
WorldPosition()) < maxTargetDistance;
}
return res;
/* NOP */;

}
public function OnGameplayEvent(eventName : CName) : Bool{
var owner : CNewNPC;
var data : CDamageData;
owner = GetNPC();
if (eventName == 'BeingHit'){
data = (CDamageData)GetEventParamBaseDamage();
owner.lastAttacker = (CActor)data.attacker;
return true;
}
if (eventName == 'ForceTarget'){
ForceTarget = (CActor)GetEventParamObject();
return true;
}
if (eventName == 'UnforceTarget'){
ForceTarget = NULL;
SetCombatTarget(NULL);
return true;
}
if (eventName == 'ReevaluateCombatTarget'){
SetCombatTarget(NULL);
}
return false;
/* NOP */;
}
}
import abstract class ISpawnCondition{
}
class CBTTaskPlayAnimationEventDecoratorDef extends IBehTreeTaskDefinition{
public editable var finishTaskOnAllowBlend : Bool;
public editable var rotateOnRotateEvent : Bool;
public editable var disableHitOnActivation : Bool;
public editable var disableLookatOnActivation : Bool;
public editable var interruptOverlayAnim : Bool;
public editable var checkStats : Bool;
public editable var xmlMoraleCheckName : CName;
public editable var xmlStaminaCostName : CName;
public editable var drainStaminaOnUse : Bool;
}
class CBTTaskDodge extends CBTTaskPlayAnimationEventDecorator{
protected var dodgeChanceAttackLight : Int32;
protected var dodgeChanceAttackHeavy : Int32;
protected var dodgeChanceAard : Int32;
protected var dodgeChanceIgni : Int32;
protected var dodgeChanceBomb : Int32;
protected var dodgeChanceProjectile : Int32;
protected var dodgeChanceFear : Int32;
protected var Time2Dodge : Bool;
protected var dodgeType : EDodgeType;
protected var dodgeDirection : EDodgeDirection;
private var dodgeTime : Float;
private var dodgeEventTime : Float;
private var nextDodgeTime : Float;
private var performDodgeDelay : Float;
private var ownerPosition : Vector;
public var navmeshCheckDist : Float;
public var minDelayBetweenDodges : Float;

public
public
public
public
public
public

var maxDistanceFromTarget : Float;


var movementAdjustorSlideDistance : Float;
var allowDodgeWhileAttacking : Bool;
var signalGameplayEventWhileInHitAnim : Bool;
var alwaysAvailableOnDodgeType : EDodgeType;
function IsAvailable() : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (dodgeEventTime && dodgeEventTime + 0.100000 < GetLocalTime()

){
Time2Dodge = false;
} else if (!super.IsAvailable()){
Time2Dodge = false;
}
return Time2Dodge;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
GetActor().SetIsCurrentlyDodging(true, /* NOP */);
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
Sleep(0.400000);
GetActor().SetIsCurrentlyDodging(false, /* NOP */);
return 0;
/* NOP */;
}
public function OnDeactivate(){
Time2Dodge = false;
nextDodgeTime = GetLocalTime() + minDelayBetweenDodges;
performDodgeDelay = 0;
GetActor().SetIsCurrentlyDodging(false, /* NOP */);
super.OnDeactivate();
/* NOP */;
}
public function Dodge() : Bool{
if (dodgeEventTime + 0.100000 < GetLocalTime()){
return false;
}
if (nextDodgeTime >= GetLocalTime()){
return false;
}
if (!CheckDistance()){
return false;
}
InitializeCombatDataStorage();
if (combatDataStorage.GetIsAttacking() && !allowDodgeWhileAttack
ing && alwaysAvailableOnDodgeType != dodgeType){
return false;
}
if (!ChooseAndCheckDodge()){
return false;
}
if (!CheckNavMesh()){
return false;
}
return true;
/* NOP */;
}

public function CheckDistance() : Bool{


var npc : CNewNPC;
var target : CActor;
var dist : Float;
npc = GetNPC();
target = GetCombatTarget();
if (target && maxDistanceFromTarget > 0 && dodgeType != 5 && dod
geType != 4){
dist = VecDistance(npc.GetWorldPosition(), target.GetWor
ldPosition());
if (dist > maxDistanceFromTarget){
return false;
}
}
return true;
/* NOP */;
}
public function GetDodgeStats(){
var npc : CNewNPC;
npc = GetNPC();
dodgeChanceAttackLight = 100 * CalculateAttributeValue(npc.GetAt
tributeValue('dodge_melee_light_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceAttackHeavy = 100 * CalculateAttributeValue(npc.GetAt
tributeValue('dodge_melee_heavy_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceAard = 100 * CalculateAttributeValue(npc.GetAttribute
Value('dodge_magic_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceIgni = 100 * CalculateAttributeValue(npc.GetAttribute
Value('dodge_magic_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceBomb = 100 * CalculateAttributeValue(npc.GetAttribute
Value('dodge_bomb_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceProjectile = 100 * CalculateAttributeValue(npc.GetAtt
ributeValue('dodge_projectile_chance', /* NOP */, /* NOP */), /* NOP */);
dodgeChanceFear = 100 * CalculateAttributeValue(npc.GetAttribute
Value('dodge_fear_chance', /* NOP */, /* NOP */), /* NOP */);
/* NOP */;
}
public function ChooseAndCheckDodge() : Bool{
var npc : CNewNPC;
var dodgeChance : Int32;
npc = GetNPC();
switch(dodgeType){
case 0:
dodgeChance = dodgeChanceAttackLight;
break;
case 1:
dodgeChance = dodgeChanceAttackHeavy;
break;
case 2:
dodgeChance = dodgeChanceAard;
break;
case 3:
dodgeChance = dodgeChanceIgni;
break;
case 4:
dodgeChance = dodgeChanceBomb;
break;
case 5:
dodgeChance = dodgeChanceProjectile;
break;
case 6:

dodgeChance = dodgeChanceFear;
break;
default:
return false;
}
if (RandRange(100, /* NOP */) < dodgeChance){
if (dodgeType == 0 || dodgeType == 1 || dodgeType == 6){
dodgeDirection = 0;
} else if (dodgeType == 5 || dodgeType == 4){
dodgeDirection = 0;
}
npc.SetBehaviorVariable('DodgeDirection', dodgeDirection
, /* NOP */);
return true;
}
return false;
/* NOP */;
}
public function CheckNavMesh() : Bool{
var ownerPosition : Vector;
var targetVector : Vector;
if (dodgeDirection == 0 && GetCombatTarget()){
ownerPosition = GetActor().GetWorldPosition();
targetVector = VecNormalize2D(GetActor().GetWorldPositio
n() - GetCombatTarget().GetWorldPosition());
return theGame.GetWorld().NavigationLineTest(ownerPositi
on, ownerPosition + navmeshCheckDist * targetVector, GetActor().GetRadius(), /*
NOP */, /* NOP */);
}
return true;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (eventName == 'Time2DodgeProjectile'){
dodgeType = 5;
ownerPosition = npc.GetWorldPosition();
performDodgeDelay = GetEventParamFloat(-1);
performDodgeDelay = ClampF(performDodgeDelay - 0.400000,
0, 99);
npc.AddTimer('DelayDodgeProjectileEventTimer', performDo
dgeDelay, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
if (eventName == 'Time2DodgeBomb'){
dodgeType = 4;
ownerPosition = npc.GetWorldPosition();
performDodgeDelay = GetEventParamFloat(-1);
performDodgeDelay = ClampF(performDodgeDelay - 0.400000,
0, 99);
npc.AddTimer('DelayDodgeBombEventTimer', performDodgeDel
ay, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
if (eventName == 'Time2Dodge' || eventName == 'Time2DodgeProject
ileDelayed' || eventName == 'Time2DodgeBombDelayed'){
GetDodgeStats();
dodgeEventTime = GetLocalTime();
if (eventName != 'Time2DodgeProjectileDelayed' && eventN

ame != 'Time2DodgeBombDelayed'){
dodgeType = GetEventParamInt(-1);
}
if (Dodge()){
Time2Dodge = true;
if (npc.IsInHitAnim() && signalGameplayEventWhil
eInHitAnim){
npc.SignalGameplayEvent('WantsToPerformD
odge');
} else if (dodgeType == 1){
npc.SignalGameplayEvent('WantsToPerformD
odgeAgainstHeavyAttack');
}
}
return true;
}
return false;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var npc : CNewNPC;
var target : CActor;
var ticket : SMovementAdjustmentRequestTicket;
var movementAdjustor : CMovementAdjustor;
var minDistance : Float;
npc = GetNPC();
target = GetCombatTarget();
if (movementAdjustorSlideDistance > 0 && animEventName == 'Slide
ToTarget' && animEventType == 1 || animEventType == 2 && dodgeType != 5 && dodge
Type != 4){
movementAdjustor = npc.GetMovingAgentComponent().GetMove
mentAdjustor();
if (movementAdjustor){
ticket = movementAdjustor.CreateNewRequest('Slid
eAwayDodge');
movementAdjustor.BindToEventAnimInfo(ticket, ani
mInfo, /* NOP */);
movementAdjustor.MaxLocationAdjustmentSpeed(tick
et, 1000000, /* NOP */);
movementAdjustor.ScaleAnimation(ticket, /* NOP *
/, /* NOP */, /* NOP */);
movementAdjustor.SlideTowards(ticket, target, mo
vementAdjustorSlideDistance, /* NOP */);
}
return true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
}
class W3ElevatorInteractive extends W3Elevator{
public editable var initialPosOnTop : Bool;
public editable var targetObject : EntityHandle;
public editable var maxHeight : Float;
public editable var mechanismEntityHandle : EntityHandle;
private autobind interactionComponent : CInteractionComponent = "Unlocke
d";

public
public
public
public
public
public
public

var activated : Bool;


var explorationComponents : array<CComponent>;
var switches : array<W3ElevatorSwitch>;
var i : Int32;
var size : Int32;
var elevatorSaveLockInt : Int32;
final function RegisterSwitch(elevatorSwitch : W3ElevatorSwitch){
if (elevatorSwitch && !switches.Contains(elevatorSwitch)){
switches.PushBack(elevatorSwitch);
}
/* NOP */;

}
public final function DisableSwitches(){
var i : Int32;
var size : Int32;
size = switches.Size();
i = 0;
while (i < size){
if (switches[i]){
switches[i].SetICEnabled(false);
}
i += 1;
}
/* NOP */;
}
public final function EnableOrDisableSwitches(onTop : Bool){
var i : Int32;
var size : Int32;
size = switches.Size();
i = 0;
while (i < size){
if (switches[i]){
if (switches[i].switchType == 0){
switches[i].SetICEnabled(isOnTop);
} else {
switches[i].SetICEnabled(!isOnTop);
}
}
i += 1;
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (explorationComponents.Size() == 0){
explorationComponents = GetComponentsByClassName('CExplo
rationComponent');
}
if (activator == thePlayer){
if (actionName == "UseDevice"){
if (!activated){
CheckInitialVariables();
activated = true;
}
theGame.CreateNoSaveLock("moving_elevator", elev
atorSaveLockInt, /* NOP */, /* NOP */);
GotoState('Moving', /* NOP */, /* NOP */);
}
}
/* NOP */;

}
public final function OnEndMovement(){
var mechanism : W3ElevatorMechanism;
if (movementStarted){
movementStarted = false;
mechanism = (W3ElevatorMechanism)EntityHandleGet(mechani
smEntityHandle);
if (mechanism){
mechanism.SetRotationSpeed(0);
mechanism.StopWorking();
mechanism.SoundEvent("global_machines_lift_wood1
_mechanism_stop", /* NOP */, /* NOP */);
}
SoundEvent("global_machines_lift_wood1_platform_stop", /
* NOP */, /* NOP */);
GCameraShake(0.100000, this, GetWorldPosition(), 6.00000
0, /* NOP */, /* NOP */, /* NOP */);
}
if (interactionComponent){
interactionComponent.SetEnabled(true);
}
size = explorationComponents.Size();
if (isOnTop){
ApplyAppearance(appearanceOnTop);
}
i = 0;
while (i < size){
explorationComponents[i].SetEnabled(true);
i += 1;
}
EnableOrDisableSwitches(isOnTop);
theGame.ReleaseNoSaveLock(elevatorSaveLockInt);
OnEndMovement();
/* NOP */;
}
public final function OnStartMovement(){
var mechanism : W3ElevatorMechanism;
DisableSwitches();
mechanism = (W3ElevatorMechanism)EntityHandleGet(mechanismEntity
Handle);
if (mechanism){
mechanism.SetRotationSpeed(speed);
mechanism.StartWorking(!isOnTop);
mechanism.SoundEvent("global_machines_lift_wood1_mechani
sm_start", /* NOP */, /* NOP */);
}
GCameraShake(0.100000, true, GetWorldPosition(), 6.000000, /* NO
P */, /* NOP */, /* NOP */);
SoundEvent("global_machines_lift_wood1_platform_start", /* NOP *
/, /* NOP */);
ApplyAppearance(appearanceOnGround);
if (interactionComponent){
interactionComponent.SetEnabled(false);
}
size = explorationComponents.Size();
i = 0;
while (i < size){
explorationComponents[i].SetEnabled(false);
i += 1;
}

movementStarted = true;
OnStartMovement();
/* NOP */;
}
public function CheckInitialVariables(){
var targetNode : CNode;
var targetPos : Vector;
var currentHeightDifference : Float;
pos = GetWorldPosition();
if (currentHeight != 0){
pos.Z = currentHeight;
Teleport(pos);
} else {
initialHeight = pos.Z;
}
targetNode = EntityHandleGet(targetObject);
if (targetNode){
targetPos = targetNode.GetWorldPosition();
targetNodeHeight = targetPos.Z;
heightDifference = targetNodeHeight - initialHeight;
currentHeightDifference = targetNodeHeight - pos.Z;
} else {
heightDifference = maxHeight;
}
if (currentHeightDifference > -2){
ApplyAppearance(appearanceOnGround);
goingUp = true;
initialSpeed = speed;
isOnTop = false;
} else {
ApplyAppearance(appearanceOnTop);
goingUp = false;
initialSpeed = speed * -1;
isOnTop = true;
}
if (isOnTop && !onTopPosChecked){
onTopPos = GetWorldPosition();
onTopPosChecked = true;
}
GotoState('OnStartPos', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (thePlayer.IsCombatMusicEnabled()){
return false;
}
if (activator == thePlayer){
if (interactionComponent.IsEnabled()){
return true;
} else {
return false;
}
}
return false;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;

actor = (CActor)activator.GetEntity();
if ((CPlayer)actor){
playerOnElevator = true;
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if ((CPlayer)actor){
playerOnElevator = false;
}
/* NOP */;
}
public function OnPhantomComponentCollision(object : CObject, physicalAc
torindex : Int32, shapeIndex : Int32) : Bool{
var entity : CEntity;
var component : CComponent;
var action : W3DamageAction;
component = (CComponent)object;
if (!component){
return false;
}
entity = component.GetEntity();
if ((CPlayer)entity && currentSpeed < 0){
action = new W3DamageAction in this;
action.Initialize(this, (CPlayer)entity, this, GetName()
, 1, 0, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, (CPl
ayer)entity.GetStat(0, /* NOP */) + 1);
theGame.damageMgr.ProcessAction(action);
}
/* NOP */;
}
}
import struct CAIDespawnTree{
}
abstract class CBTTaskCollisionAttack extends CBTTaskAttack{
public function OnGameplayEvent(eventName : CName) : Bool{
var attackData : CPreAttackEventData;
if (eventName == 'NewCurrentAttackData'){
if (GetActor().GetCurrentAttackData(attackData)){
NewCurrentAttackData(attackData);
}
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
public function NewCurrentAttackData(out attackData : CPreAttackEventDat
a){
}
}
class W3ElevatorSwitch extends W3InteractionSwitch{
public editable var elevator : EntityHandle;
public editable var switchType : EElevatorSwitchType;

private autobind interactionComponent : CInteractionComponent = "Unlocke


d";
private var switchRegistered : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var elevatorInteractive : W3ElevatorInteractive;
super.OnSpawned(spawnData);
switchRegistered = false;
elevatorInteractive = (W3ElevatorInteractive)EntityHandleGet(ele
vator);
if (elevatorInteractive){
if (!elevatorInteractive.activated){
elevatorInteractive.CheckInitialVariables();
elevatorInteractive.activated = true;
}
elevatorInteractive.RegisterSwitch(this);
super.SetSwitch(elevatorInteractive);
switchRegistered = true;
}
/* NOP */;
}
public final function SetSwitch(elevator : W3ElevatorInteractive){
var set : Bool;
if (elevator && interactionComponent){
set = elevator.IsOnTop();
if (switchType == 0){
if (interactionComponent){
interactionComponent.SetEnabled(set);
}
} else if (interactionComponent){
interactionComponent.SetEnabled(!set);
}
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var elevatorInteractive : W3ElevatorInteractive;
if (activator == thePlayer){
if (actionName == "UseDevice"){
elevatorInteractive = (W3ElevatorInteractive)Ent
ityHandleGet(elevator);
if (!elevatorInteractive.activated){
elevatorInteractive.CheckInitialVariable
s();
elevatorInteractive.activated = true;
}
super.OnInteraction(actionName, activator);
}
}
/* NOP */;
}
public function OnSyncAnimEnd() : Bool{
var elevatorInteractive : W3ElevatorInteractive;
elevatorInteractive = (W3ElevatorInteractive)EntityHandleGet(ele
vator);
elevatorInteractive.GotoState('Moving', /* NOP */, /* NOP */);
super.OnSyncAnimEnd();
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S

tring, activator : CEntity) : Bool{


if (thePlayer.IsCombatMusicEnabled()){
return false;
}
return super.OnInteractionActivationTest(interactionComponentNam
e, activator);
/* NOP */;
}
public final function SetICEnabled(enabled : Bool){
if (interactionComponent){
interactionComponent.SetEnabled(enabled);
}
/* NOP */;
}
}
abstract class
public
public
public
public
public

CBTTaskMagicAttack extends CBTTaskCollisionAttack{


var dodgeable : Bool;
var fxDummyEntityTag : CName;
var effectName : CName;
var dummyEntityEffectName : CName;
function OnDeactivate(){
super.OnDeactivate();
/* NOP */;

}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
var fxDummyEntity : array<CEntity>;
var target : CNode;
var actor : CActor;
target = GetCombatTarget();
actor = GetActor();
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (!target){
target = GetActionTarget();
}
if (animEventName == 'PerformMagicAttack'){
if (dodgeable){
if (target && !(CActor)target.IsCurrentlyDodging
()){
PerformMagicAttack();
} else {
theGame.GetEntitiesByTag(fxDummyEntityTa
g, fxDummyEntity);
if (fxDummyEntity.Size() > 0){
actor.PlayEffect(effectName, fxD
ummyEntity[0]);
fxDummyEntity[0].PlayEffect(dumm
yEntityEffectName, /* NOP */);
}
}
} else {
PerformMagicAttack();
}
return true;
}
return res;
/* NOP */;
}

public function PerformMagicAttack(){


}
}
class W3ElevatorMechanism extends CEntity{
public editable var radius : Float;
public editable var clockwiseRotation : Bool;
public var rotationSpeed : Float;
public var forwardDirection : Bool;
public var transformMatrix : Matrix;
public var localRotation : EulerAngles;
public function SetRotationSpeed(linearSpeed : Float){
rotationSpeed = linearSpeed / radius;
/* NOP */;
}
public function StartWorking(forward : Bool){
forwardDirection = forward;
AddTimer('TimerMechanismWorking', 0.010000, true, /* NOP */, /*
NOP */, true, /* NOP */);
/* NOP */;
}
public timer function TimerMechanismWorking(optional timeDelta : Float,
optional id : Int32){
localRotation = GetWorldRotation();
if (forwardDirection && !clockwiseRotation || clockwiseRotation
&& !forwardDirection){
localRotation.Roll -= rotationSpeed;
} else {
localRotation.Roll += rotationSpeed;
}
TeleportWithRotation(GetWorldPosition(), localRotation);
/* NOP */;
}
public function StopWorking(){
RemoveTimer('TimerMechanismWorking', /* NOP */);
/* NOP */;
}
}
import abstract class SSpawnStrategyRange{
}
class CBTTaskPerformParry extends CBTTaskPlayAnimationEventDecorator{
public var activationTimeLimitBonusHeavy : Float;
public var activationTimeLimitBonusLight : Float;
public var activationTimeLimit : Float;
public var action : CName;
public var runMain : Bool;
public var counterChance : Float;
public var hitsToCounter : Int32;
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public function IsAvailable() : Bool{
InitializeCombatDataStorage();
if (combatDataStorage.IsProtectedByQuen()){
GetNPC().SetParryEnabled(true);
return false;
} else if (activationTimeLimit > 0.000000 && isActive || !combat
DataStorage.GetIsAttacking()){
if (GetLocalTime() < activationTimeLimit){

return true;
}
activationTimeLimit = 0.000000;
return false;
} else if (GetNPC().HasShieldedAbility() && activationTimeLimit
> 0.000000){
GetNPC().SetParryEnabled(true);
return false;
} else {
GetNPC().SetParryEnabled(false);
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
InitializeCombatDataStorage();
GetNPC().SetParryEnabled(true);
/* NOP */;
GetStats();
if (action == 'ParryPerform'){
if (TryToParry(/* NOP */)){
runMain = true;
RunMain();
}
action = 'None';
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var resStart : Bool;
var resEnd : Bool;
resEnd = false;
while (runMain){
resStart = GetNPC().WaitForBehaviorNodeDeactivation('Par
ryPerformEnd', 2.000000);
resEnd = GetNPC().WaitForBehaviorNodeActivation('ParryPe
rformStart', 0.000100);
if (!resEnd){
activationTimeLimit = 0;
runMain = false;
}
if (resStart && resEnd){
SleepOneFrame();
}
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetParryEnabled(false);
runMain = false;
activationTimeLimit = 0;
action = 'None';
combatDataStorage.ResetParryCount();
super.OnDeactivate();
/* NOP */;
/* NOP */;
}
private function GetStats(){

counterChance = MaxF(0, 100 * CalculateAttributeValue(GetActor()


.GetAttributeValue('counter_chance', /* NOP */, /* NOP */), /* NOP */));
hitsToCounter = MaxF(0, CalculateAttributeValue(GetActor().GetAt
tributeValue('hits_to_roll_counter', /* NOP */, /* NOP */), /* NOP */));
if (hitsToCounter < 0){
hitsToCounter = 65536;
}
/* NOP */;
}
private function TryToParry(counter : Bool) : Bool{
var npc : CNewNPC;
var mult : Float;
npc = GetNPC();
if (isActive && npc.CanParryAttack()){
/* NOP */;
npc.SignalGameplayEvent('SendBattleCry');
mult = theGame.params.HEAVY_STRIKE_COST_MULTIPLIER;
if (npc.RaiseEvent('ParryPerform')){
if (counter){
npc.DrainStamina(5, 0, 0, 'None', 0, /*
NOP */);
npc.SignalGameplayEvent('Counter');
} else {
npc.DrainStamina(4, 0, 0, 'None', 0, mul
t);
}
combatDataStorage.IncParryCount();
activationTimeLimit = GetLocalTime() + 0.500000;
} else {
Complete(false);
}
return true;
} else if (isActive){
Complete(false);
activationTimeLimit = 0.000000;
}
return false;
/* NOP */;
}
public function AdditiveParry(force : Bool) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (force || !isActive && npc.CanParryAttack() && combatDataStor
age.GetIsAttacking()){
npc.RaiseEvent('PerformAdditiveParry');
return true;
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var res : Bool;
var isHeavy : Bool;
InitializeCombatDataStorage();
if (eventName == 'ParryStart'){
isHeavy = GetEventParamInt(-1);
if (isHeavy){
activationTimeLimit = GetLocalTime() + activatio
nTimeLimitBonusHeavy;
} else {

activationTimeLimit = GetLocalTime() + activatio


nTimeLimitBonusLight;
}
if (GetNPC().HasShieldedAbility()){
GetNPC().SetParryEnabled(true);
}
return true;
} else if (eventName == 'ParryPerform'){
if (AdditiveParry(/* NOP */)){
return true;
}
if (!isActive){
return false;
}
isHeavy = GetEventParamInt(-1);
if (ShouldCounter(isHeavy)){
res = TryToParry(true);
} else {
res = TryToParry(/* NOP */);
}
if (res){
runMain = true;
RunMain();
}
return true;
} else if (eventName == 'CounterParryPerform'){
if (TryToParry(true)){
runMain = true;
RunMain();
}
return true;
} else if (eventName == 'ParryStagger'){
if (!isActive){
return false;
}
if (GetNPC().HasShieldedAbility()){
GetNPC().AddEffectDefault(13, GetCombatTarget(),
"ParryStagger", /* NOP */);
runMain = false;
activationTimeLimit = 0.000000;
} else if (TryToParry(/* NOP */)){
GetNPC().LowerGuard();
runMain = false;
}
return true;
} else if (eventName == 'ParryEnd'){
activationTimeLimit = 0.000000;
return true;
} else if (eventName == 'PerformAdditiveParry'){
AdditiveParry(true);
return true;
} else if (eventName == 'WantsToPerformDodgeAgainstHeavyAttack'
&& GetActor().HasAbility('ablPrioritizeAvoidingHeavyAttacks')){
activationTimeLimit = 0.000000;
if (isActive){
Complete(true);
}
return true;
}
return OnGameplayEvent(eventName);

/* NOP */;
}
public function ShouldCounter(isHeavy : Bool) : Bool{
var playerTarget : W3PlayerWitcher;
if (GetActor().HasAbility('DisableCounterAttack')){
return false;
}
playerTarget = (W3PlayerWitcher)GetCombatTarget();
if (playerTarget && playerTarget.IsInCombatAction_SpecialAttack(
)){
return false;
}
if (isHeavy && !GetActor().HasAbility('ablCounterHeavyAttacks'))
{
return false;
}
return combatDataStorage.GetParryCount() >= hitsToCounter && Rol
l(counterChance);
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBTTaskAttackDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var attackType : EAttackType;
public editable var stopTaskAfterDealingDmg : Bool;
public editable var setAttackEndVarOnStopTask : Bool;
public editable var useDirectionalAttacks : Bool;
public editable var fxOnDamageInstigated : CName;
public editable var fxOnDamageVictim : CName;
public editable var applyFXCooldown : Float;
public editable var behVarNameOnDeactivation : CName;
public editable var behVarValueOnDeactivation : Float;
public editable var stopAllEfectsOnDeactivation : Bool;
public editable var slideToTargetOnAnimEvent : Bool;
public editable var useCombatTarget : Bool;
public editable var useActionBlend : Bool;
public editable var attackParameter : CBehTreeValInt;
public editable var applyEffectType : EEffectType;
public editable var customEffectDuration : Float;
public function OnSpawn(task : IBehTreeTask){
var thisTask : CBTTaskAttack;
thisTask = (CBTTaskAttack)task;
if (attackType == 20 && GetValInt(attackParameter) >= 0){
thisTask.attackType = GetValInt(attackParameter);
}
/* NOP */;
}
}
class CBTTaskReaction extends IBehTreeTask{
public var counterChance : Int32;
public var dodgeChanceAttacks : Int32;

public
public
public
public
public
public
public
public
public

var dodgeChanceAard : Int32;


var dodgeChanceIgni : Int32;
var dodgeChanceBomb : Int32;
var dodgeChanceProjectile : Int32;
var Time2Dodge : Bool;
var dodgeType : EDodgeType;
var nextReactionTime : Float;
var reactionDelay : Float;
function IsAvailable() : Bool{
var target : CActor;
var npc : CNewNPC;
if (isActive){
return true;
}
if (nextReactionTime > GetLocalTime()){
Time2Dodge = false;
return false;
}
if (!checkDistance()){
Time2Dodge = false;
return false;
}
if (!Time2Dodge){
return false;
}
return true;
/* NOP */;

}
public function checkDistance() : Bool{
var npc : CNewNPC;
var target : CActor;
var dist : Float;
npc = GetNPC();
target = GetCombatTarget();
if (target){
dist = VecDistance2D(npc.GetWorldPosition(), target.GetW
orldPosition());
if (dist >= 0 && dist < 2){
return true;
}
}
return false;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
if (dodgeType == 0 || dodgeType == 1 && counterChance > 0){
if (RandRange(100, /* NOP */) < counterChance){
if (npc.RaiseForceEvent('CounterAttack')){
npc.WaitForBehaviorNodeDeactivation('Cou
nterAttackEnd', 10.000000);
Time2Dodge = false;
return 2;
}
}
} else if (!ChooseAndCheckDodge()){
if (npc.RaiseForceEvent('Dodge')){
npc.WaitForBehaviorNodeDeactivation('DodgeEnd',
10.000000);

Time2Dodge = false;
return 2;
}
}
return 1;
/* NOP */;
}
public function ChooseAndCheckDodge() : Bool{
var npc : CNewNPC;
var dodgeChance : Int32;
npc = GetNPC();
if (!Time2Dodge){
return false;
}
switch(dodgeType){
case 0:
dodgeChance = dodgeChanceAttacks;
break;
case 1:
dodgeChance = dodgeChanceAttacks;
break;
case 2:
dodgeChance = dodgeChanceAard;
break;
case 3:
dodgeChance = dodgeChanceIgni;
break;
case 4:
dodgeChance = dodgeChanceBomb;
break;
case 5:
dodgeChance = dodgeChanceProjectile;
break;
default:
return false;
}
if (RandRange(100, /* NOP */) < dodgeChance){
if (dodgeType == 0 || dodgeType == 1){
npc.SetBehaviorVariable('DodgeDirection', 0, /*
NOP */);
} else {
npc.SetBehaviorVariable('DodgeDirection', 1, /*
NOP */);
}
return true;
}
return false;
/* NOP */;
}
public function OnDeactivate(){
Time2Dodge = false;
nextReactionTime = GetLocalTime() + reactionDelay;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
if (eventName == 'Time2Dodge' && nextReactionTime < GetLocalTime
()){
npc = GetNPC();
Time2Dodge = true;

dodgeType = GetEventParamInt(-1);
return true;
}
return false;
/* NOP */;
}
}
import abstract class SWanderPointConnection{
}
import struct IAIExplorationTree{
}
class CBehTreeTaskSheathWeapons extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
private var processLeftItem : Bool;
private var processRightItem : Bool;
public function OnActivate() : EBTNodeStatus{
if (!GetNPC().IsHuman() || GetActor() == thePlayer){
return 0;
}
ShouldProcessItems();
return 0;
/* NOP */;
}
private function ShouldProcessItems(){
var itemID : SItemUniqueId;
var i : Int32;
var items : array<SItemUniqueId>;
var inventory : CInventoryComponent;
if (!processLeftItem || !processRightItem){
inventory = GetActor().GetInventory();
itemID = inventory.GetItemFromSlot('l_weapon');
if (inventory.IsItemWeapon(itemID)){
processLeftItem = true;
}
itemID = inventory.GetItemFromSlot('r_weapon');
if (inventory.IsItemWeapon(itemID)){
processRightItem = true;
}
}
if (processLeftItem && processRightItem){
GetActor().SetRequiredItems('None', 'None');
} else if (processLeftItem){
GetActor().SetRequiredItems('None', 'Any');
} else if (processRightItem){
GetActor().SetRequiredItems('Any', 'None');
}
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var wasWaitingForItems : Bool;
var npc : CNewNPC;
npc = GetNPC();
wasWaitingForItems = npc.WaitForFinishedAllLatentItemActions();
if (processLeftItem || processRightItem){
if (wasWaitingForItems){
ShouldProcessItems();
}

if (processLeftItem || processRightItem){
Sleep(0.100000);
npc.ProcessRequiredItems(/* NOP */);
npc.OnProcessRequiredItemsFinish();
}
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
processLeftItem = false;
processRightItem = false;
/* NOP */;
}
}
class CBehTreeTaskConditionalSheathWeapons extends CBehTreeTaskSheathWeapons{
protected var reactionDataStorage : CAIStorageReactionData;
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
Sleep(0.100000);
return DelayedActivate();
/* NOP */;
}
public function DelayedActivate() : EBTNodeStatus{
var res : Bool;
var itemID : SItemUniqueId;
var i : Int32;
var items : array<SItemUniqueId>;
var npc : CNewNPC;
var inventory : CInventoryComponent;
npc = GetNPC();
reactionDataStorage.ResetAttitudes(npc);
if (npc.GetNPCType() != 3 && !npc.IsAtWork()){
return super.OnActivate();
} else {
inventory = npc.GetInventory();
itemID = inventory.GetItemFromSlot('r_weapon');
if (inventory.IsIdValid(itemID)){
npc.OnEquippedItem(inventory.GetItemCategory(ite
mID), 'r_weapon');
}
itemID = inventory.GetItemFromSlot('l_weapon');
if (inventory.IsIdValid(itemID)){
npc.OnEquippedItem(inventory.GetItemCategory(ite
mID), 'l_weapon');
}
return 0;
}
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();

/* NOP */;
}
}
class CBTTaskShoot extends CBTTaskPlayAnimationEventDecorator{
public var useCombatTarget : Bool;
public var attackRange : Float;
public var setArrowOnFire : Bool;
public var dodgeable : Bool;
private var arrow : W3ArrowProjectile;
private var projShot : Bool;
public function IsAvailable() : Bool{
InitializeCombatDataStorage();
if (!(CHumanAICombatStorage)combatDataStorage.GetProjectile()){
GetNPC().SignalGameplayEvent('TakeBowArrow');
return false;
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
InitializeCombatDataStorage();
projShot = false;
arrow = (W3ArrowProjectile)(CHumanAICombatStorage)combatDataStor
age.GetProjectile();
if (setArrowOnFire){
arrow.ToggleFire(true);
}
return super.OnActivate();
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'ShootProjectile' && arrow){
ShootProjectile();
if (setArrowOnFire){
arrow.OnFireHit(NULL);
}
combatDataStorage.SetIsShooting(false);
(CHumanAICombatStorage)combatDataStorage.SetProjectile(N
ULL);
return true;
} else if (animEventName == 'TakeBowArrow'){
GetActor().SignalGameplayEvent('ShouldSwitchToMelee');
return true;
}
return res;
/* NOP */;
}
public function ShootProjectile(){
var npc : CNewNPC;
var target : CNode;
var targetEntity : CGameplayEntity;
var desiredHeadingVec : Vector;

var distanceToTarget : Float;


var projectileFlightTime : Float;
var targetPos : Vector;
var collisionGroups : array<CName>;
var headBoneIdx : Int32;
var entMat : Matrix;
var targetMAC : CMovingPhysicalAgentComponent;
var yrdenShockEntity : W3YrdenEntityStateYrdenShock;
npc = GetNPC();
collisionGroups.PushBack('Ragdoll');
collisionGroups.PushBack('Terrain');
collisionGroups.PushBack('Static');
if (useCombatTarget){
target = GetCombatTarget();
targetPos = npc.GetBehaviorVectorVariable('lookAtTarget'
);
} else {
target = GetActionTarget();
if ((CActor)target){
headBoneIdx = (CActor)target.GetHeadBoneIndex();
if (headBoneIdx >= 0){
targetPos = MatrixGetTranslation((CActor
)target.GetBoneWorldMatrixByIndex(headBoneIdx));
} else {
targetPos = target.GetWorldPosition();
targetPos.Z += (CMovingPhysicalAgentComp
onent)(CActor)target.GetMovingAgentComponent().GetCapsuleHeight() * 0.750000;
}
} else if ((CGameplayEntity)target){
targetEntity = (CGameplayEntity)target;
if (!targetEntity.aimVector.X == 0 && targetEnti
ty.aimVector.Y == 0 && targetEntity.aimVector.Z == 0){
entMat = targetEntity.GetLocalToWorld();
targetPos = VecTransform(entMat, targetE
ntity.aimVector);
}
} else {
targetPos = target.GetWorldPosition();
}
}
distanceToTarget = VecDistance(npc.GetWorldPosition(), targetPos
);
desiredHeadingVec = arrow.GetHeadingVector();
if (targetPos == Vector(0, 0, 0) || distanceToTarget < 6.000000)
{
targetPos = npc.GetWorldPosition();
if ((CActor)target){
targetMAC = (CMovingPhysicalAgentComponent)(CAct
or)target.GetMovingAgentComponent();
if (targetMAC){
targetPos.Z += 0.800000 * targetMAC.GetC
apsuleHeight();
}
}
targetPos = targetPos + desiredHeadingVec * distanceToTa
rget;
}
arrow.BreakAttachment();
arrow.Init(npc);
if (arrow.yrdenAlternate){

yrdenShockEntity = (W3YrdenEntityStateYrdenShock)arrow.y
rdenAlternate.GetCurrentState();
if (yrdenShockEntity){
yrdenShockEntity.ShootDownProjectile(arrow);
}
projShot = false;
} else {
arrow.ShootProjectileAtPosition(7, arrow.projSpeed, targ
etPos, attackRange, collisionGroups);
projShot = true;
}
if (projShot && dodgeable){
projectileFlightTime = distanceToTarget / arrow.projSpee
d;
(CActor)target.SignalGameplayEventParamFloat('Time2Dodge
Projectile', projectileFlightTime);
}
npc.SetCounterWindowStartTime(theGame.GetEngineTime());
npc.BlinkWeapon(/* NOP */);
/* NOP */;
}
}
class CBTTaskSpawnEntityAttack extends CBTTaskAttack{
public var offsetVector : Vector;
public var ressourceName : CName;
public var entityTemplate : CEntityTemplate;
public var spawnAnimEventName : CName;
public var completeAfterSpawn : Bool;
protected var m_summonerComponent : W3SummonerComponent;
private var couldntLoadResource : Bool;
public function Initialize(){
m_summonerComponent = (W3SummonerComponent)GetNPC().GetComponent
ByClassName('W3SummonerComponent');
/* NOP */;
}
public function IsAvailable() : Bool{
if (couldntLoadResource){
return false;
}
return super.IsAvailable();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
if (!entityTemplate){
entityTemplate = (CEntityTemplate)LoadResourceAsync(ress
ourceName, /* NOP */);
}
if (!entityTemplate){
couldntLoadResource = true;
return 1;
}
if (!IsNameValid(spawnAnimEventName)){
SpawnEntity();
}
return 0;

/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (IsNameValid(spawnAnimEventName) && animEventName == spawnAni
mEventName){
SpawnEntity();
return true;
}
return res;
/* NOP */;
}
public function SpawnEntity(){
var spawnPos : Vector;
var entity : CEntity;
var damageAreaEntity : CDamageAreaEntity;
spawnPos = GetActor().GetWorldPosition();
spawnPos += offsetVector;
entity = theGame.CreateEntity(entityTemplate, spawnPos, GetActor
().GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
damageAreaEntity = (CDamageAreaEntity)entity;
entity.AddTag('q501_ice_golem');
if (m_summonerComponent){
m_summonerComponent.AddEntity(entity);
}
if (damageAreaEntity){
damageAreaEntity.owner = GetActor();
}
if (completeAfterSpawn){
Complete(true);
}
/* NOP */;
}
}
class CBTTaskSpawnMultipleEntitiesAttack extends CBTTaskSpawnEntityAttack{
public var numberToSpawn : Int32;
public var numberOfCircles : Int32;
public var randomnessInCircles : Float;
public var useRandomSpaceBetweenSpawns : Bool;
public var spawnRadiusMin : Float;
public var spawnRadiusMax : Float;
public var spawnEntityRadius : Float;
public var spawnPositionPattern : ESpawnPositionPattern;
public var spawnRotation : ESpawnRotation;
public var leaveOpenSpaceForDodge : Bool;
public var spawnInRandomOrder : Bool;
public var delayBetweenSpawn : Float;
public var spawnOnGround : Bool;
public var m_dodgeDistance : Float;
public var m_dodgeSafeAreaRadius : Float;
public var m_shouldSpawn : Bool;
public var m_entitiesSpawned : Int32;
public var m_canComplete : Bool;
public latent function Main() : EBTNodeStatus{
while (!m_shouldSpawn){
SleepOneFrame();
}

LatentSpawnEntity();
while (!m_canComplete){
SleepOneFrame();
}
if (m_entitiesSpawned >= numberToSpawn){
return 2;
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
finishTaskOnAllowBlend = false;
if (animEventName == 'AllowBlend' && animEventType == 1){
m_canComplete = true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
public function SpawnEntity(){
m_shouldSpawn = true;
/* NOP */;
}
public latent function LatentSpawnEntity(){
var i : Int32;
var l_spawnCenter : Vector;
var l_spawnPos : Vector;
var l_entity : CEntity;
var l_coneAngle : Float;
var l_coneWidth : Float;
var l_randomVector : Vector;
var l_normal : Vector;
var l_rotation : EulerAngles;
var l_npc : CNewNPC;
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_dodgePos : Vector;
var l_currentCircle : Float;
var l_numPerCircle : Int32;
var l_numberInCurrentCircle : Int32;
var l_currentCone : Int32;
var l_circleRadiusMin : Float;
var l_circleRadiusMax : Float;
var l_positionArray : array<Vector>;
var l_rotationArray : array<EulerAngles>;
l_npc = GetNPC();
switch(spawnPositionPattern){
case 0:
l_spawnCenter = GetCombatTarget().GetWorldPosition();
break;
case 1:
l_spawnCenter = GetNPC().GetWorldPosition();
break;
case 2:
l_spawnCenter = GetNPC().GetWorldPosition();
l_spawnCenter += GetCombatTarget().GetWorldPosition();
l_spawnCenter /= 2;
break;
}

numberOfCircles = Max(1, numberOfCircles);


l_numPerCircle = FloorF(numberToSpawn / numberOfCircles);
l_coneAngle = 360 / l_numPerCircle;
l_npcPos = l_npc.GetWorldPosition();
l_targetPos = GetCombatTarget().GetWorldPosition();
if (leaveOpenSpaceForDodge){
l_dodgePos = l_targetPos + VecRand2D() * m_dodgeDistance
;
}
l_coneWidth = 0.500000;
if (useRandomSpaceBetweenSpawns){
l_coneWidth = l_coneAngle;
}
l_positionArray.Clear();
l_rotationArray.Clear();
i = 0;
while (i < numberToSpawn){
l_circleRadiusMin = spawnRadiusMin + l_currentCircle / n
umberOfCircles * spawnRadiusMax - spawnRadiusMin;
l_circleRadiusMax = spawnRadiusMax - l_currentCircle / n
umberOfCircles * spawnRadiusMax - spawnRadiusMin;
if (numberOfCircles > 1){
l_circleRadiusMax = MinF(l_circleRadiusMin + ran
domnessInCircles, spawnRadiusMax);
}
l_randomVector = VecConeRand(l_currentCone * l_coneAngle
, l_coneWidth, l_circleRadiusMin, l_circleRadiusMax);
l_spawnPos = l_spawnCenter + l_randomVector + offsetVect
or;
if (leaveOpenSpaceForDodge && VecDistance(l_spawnPos, l_
dodgePos) < m_dodgeSafeAreaRadius){
m_entitiesSpawned += 1;
} else {
if (spawnOnGround){
theGame.GetWorld().StaticTrace(l_spawnPo
s + Vector(0, 0, 5), l_spawnPos - Vector(0, 0, 5), l_spawnPos, l_normal, /* NOP
*/);
}
switch(spawnRotation){
case 0:
l_rotation = VecToRotation(l_spawnPos l_npc.GetWorldPosition());
break;
case 1:
l_rotation = VecToRotation(l_npc.GetWorl
dPosition() - l_spawnPos);
break;
case 2:
l_rotation = VecToRotation(l_targetPos l_spawnPos);
break;
case 3:
l_rotation = GetActor().GetWorldRotation
();
break;
case 4:
l_rotation = VecToRotation(l_npc.GetWorl
dForward() * -1);
break;
}

l_positionArray.PushBack(l_spawnPos);
l_rotationArray.PushBack(l_rotation);
l_currentCone += 1;
l_numberInCurrentCircle += 1;
if (l_numberInCurrentCircle >= l_numPerCircle){
l_numberInCurrentCircle = 0;
l_currentCircle += 1;
l_currentCone = 0;
}
}
i += 1;
}
if (delayBetweenSpawn <= 0){
spawnInRandomOrder = false;
}
while (l_positionArray.Size() > 0){
i = 0;
if (spawnInRandomOrder){
i = RandRange(l_positionArray.Size(), 0);
}
l_spawnPos = l_positionArray[i];
l_rotation = l_rotationArray[i];
l_positionArray.Erase(i);
l_rotationArray.Erase(i);
l_entity = CreateEntity(l_spawnPos, l_rotation);
m_entitiesSpawned += 1;
if (delayBetweenSpawn > 0){
Sleep(delayBetweenSpawn);
}
}
/* NOP */;
}
public function CreateEntity(_SpawnPos : Vector, _Rotation : EulerAngles
) : CEntity{
var l_npc : CNewNPC;
var l_entity : CEntity;
var l_damageAreaEntity : CDamageAreaEntity;
var l_summonedEntityComponent : W3SummonedEntityComponent;
var l_newPos : Vector;
l_npc = GetNPC();
if (!theGame.GetWorld().NavigationFindSafeSpot(_SpawnPos, spawnE
ntityRadius, spawnEntityRadius * 3, l_newPos)){
/* NOP */;
return NULL;
}
l_entity = theGame.CreateEntity(entityTemplate, l_newPos, _Rotat
ion, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (m_summonerComponent){
m_summonerComponent.AddEntity(l_entity);
}
l_summonedEntityComponent = (W3SummonedEntityComponent)l_entity.
GetComponentByClassName('W3SummonedEntityComponent');
if (l_summonedEntityComponent){
l_summonedEntityComponent.Init(l_npc);
}
l_damageAreaEntity = (CDamageAreaEntity)l_entity;
if (l_damageAreaEntity){
l_damageAreaEntity.owner = GetActor();
}
return l_entity;

/* NOP */;
}
public function OnDeactivate(){
m_shouldSpawn = false;
m_canComplete = false;
/* NOP */;
}
}
class CBTTaskSummonCreatures extends CBTTaskAttack{
public var dontResummonUntilMinionsAreDead : Bool;
public var preventActivationUntilMinionsAreDead : Bool;
public var teleportOutsidePlayerFOV : Bool;
public var killSummonedCreaturesOnSummonerDeath : Bool;
public var spawnOnAnimEventName : CName;
public var entityToSummonName : CName;
public var raiseEventOnSummon : CName;
public var entityTemplate : CEntityTemplate;
public var overrideAttitude : Bool;
public var attitudeToPlayer : EAIAttitude;
public var count : Int32;
public var minDistance : Float;
public var maxDistance : Float;
public var spawnAnimation : EExplorationMode;
public var forcedSpawnAnim : Int32;
public var spawnTag : CName;
public var spawnedNPCs : array<CNewNPC>;
public var minions : array<CGameplayEntity>;
public var respawnTime : array<EngineTime>;
public var respawnNeeded : array<Bool>;
public var respawnDelay : Float;
public var targetShouldBeAccessible : Bool;
public var spawnerShouldBeAccessible : Bool;
public var summonActivated : Bool;
public var spawnConditionsCheckInterval : Float;
public var spawnConditionsChecksNumber : Int32;
public function IsAvailable() : Bool{
if (preventActivationUntilMinionsAreDead){
return MinionNumberCheck();
}
return true;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
if (IsNameValid(entityToSummonName)){
entityTemplate = (CEntityTemplate)LoadResourceAsync(enti
tyToSummonName, /* NOP */);
}
if (!IsNameValid(spawnOnAnimEventName)){
spawnedNPCs.Clear();
respawnTime.Clear();
respawnNeeded.Clear();
spawnedNPCs.Grow(count);
respawnTime.Grow(count);
respawnNeeded.Grow(count);
summonActivated = true;
}
while (!summonActivated){
SleepOneFrame();
}

if (dontResummonUntilMinionsAreDead && MinionNumberCheck()){


SummonCreatures();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
/* NOP */;
}
public latent function SummonCreatures() : Bool{
var i : Int32;
var npc : CNewNPC;
var spawnPos : Vector;
var spawnRot : EulerAngles;
var freeSpawnPos : Vector;
var normal : Vector;
var cameraToPlayerDistance : Float;
var failed : Bool;
var createEntityHelper : CCreateEntityHelper;
var numberOfTries : Int32;
npc = GetNPC();
i = 0;
while (i < count){
numberOfTries = 0;
do {
if (teleportOutsidePlayerFOV){
cameraToPlayerDistance = VecDistance(the
Camera.GetCameraPosition(), thePlayer.GetWorldPosition());
if (cameraToPlayerDistance * 1.200000 >
minDistance){
minDistance = cameraToPlayerDist
ance * 1.200000;
maxDistance = maxDistance + came
raToPlayerDistance - minDistance * 1.200000;
}
spawnPos = VecConeRand(theCamera.GetCame
raHeading(), 180, minDistance, maxDistance);
freeSpawnPos = theCamera.GetCameraPositi
on() - spawnPos;
theGame.GetWorld().StaticTrace(freeSpawn
Pos + Vector(0, 0, 3), freeSpawnPos - Vector(0, 0, 3), freeSpawnPos, normal, /*
NOP */);
} else {
spawnPos = VecRingRand(minDistance, maxD
istance);
freeSpawnPos = npc.GetWorldPosition() +
spawnPos;
theGame.GetWorld().StaticTrace(freeSpawn
Pos + Vector(0, 0, 3), freeSpawnPos - Vector(0, 0, 3), freeSpawnPos, normal, /*
NOP */);
}
spawnRot = VecToRotation(spawnPos - GetCombatTar
get().GetWorldPosition());
if (!NavTest(freeSpawnPos)){
failed = true;
Sleep(spawnConditionsCheckInterval);
} else {
failed = false;
}

numberOfTries += 1;
} while (failed && numberOfTries < spawnConditionsChecks
Number);
if (!failed){
createEntityHelper = new CCreateEntityHelper in
this;
createEntityHelper.SetPostAttachedCallback(this,
'OnMinionAttached');
theGame.CreateEntityAsync(createEntityHelper, en
tityTemplate, freeSpawnPos, spawnRot, true, false, false, 0, /* NOP */);
summonActivated = false;
}
i += 1;
}
return failed;
/* NOP */;
}
public function NavTest(_PosToTest : Vector) : Bool{
var l_targetPos : Vector;
var l_ownerPos : Vector;
if (!theGame.GetWorld().NavigationCircleTest(_PosToTest, 1.50000
0, /* NOP */)){
return false;
}
if (targetShouldBeAccessible){
l_targetPos = GetCombatTarget().GetWorldPosition();
if (!theGame.GetWorld().NavigationLineTest(_PosToTest, l
_targetPos, 1.500000, false, true)){
return false;
}
}
if (spawnerShouldBeAccessible){
l_ownerPos = GetNPC().GetWorldPosition();
if (!theGame.GetWorld().NavigationLineTest(_PosToTest, l
_ownerPos, 1.500000, false, true)){
return false;
}
}
return true;
/* NOP */;
}
public function OnMinionAttached(minionEntity : CEntity){
var i : Int32;
var summon : CNewNPC;
var npc : CNewNPC;
npc = GetNPC();
summon = (CNewNPC)minionEntity;
if (summon){
spawnedNPCs[i] = summon;
if (overrideAttitude){
summon.SetAttitude(thePlayer, attitudeToPlayer);
} else {
summon.SetBaseAttitudeGroup(npc.GetAttitudeGroup
());
}
summon.SetBehaviorVariable('SpawnAnim', spawnAnimation,
/* NOP */);
summon.AddTag(spawnTag);
if (forcedSpawnAnim >= 0){
summon.SetBehaviorVariable('ForcedSpawnAnim', fo

rcedSpawnAnim, /* NOP */);


}
if (summon.GetBehaviorVariable('SpawnAnim', /* NOP */) =
= 1.000000 && summon.GetDistanceFromGround(3, /* NOP */) > 1.500000){
(CMovingPhysicalAgentComponent)summon.GetMovingA
gentComponent().SetAnimatedMovement(false);
}
if (IsNameValid(raiseEventOnSummon)){
summon.RaiseEvent(raiseEventOnSummon);
}
}
/* NOP */;
}
public function MinionNumberCheck() : Bool{
var npc : CNewNPC;
var i : Int32;
var minionsSize : Int32;
npc = GetNPC();
if (!IsNameValid(spawnTag)){
/* NOP */;
return false;
}
FindGameplayEntitiesInRange(minions, npc, 250, 5, spawnTag, 4, /
* NOP */, /* NOP */);
minionsSize = minions.Size();
if (minions.Size() < 1){
return true;
}
return false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var i : Int32;
if (killSummonedCreaturesOnSummonerDeath && eventName == 'Death'
){
if (minions.Size() < 1){
MinionNumberCheck();
}
i = 0;
while (i < minions.Size()){
(CActor)minions[i].Kill(true, /* NOP */, /* NOP
*/);
i += 1;
}
return true;
}
return false;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var i : Int32;
var j : Int32;
var encounters : array<CGameplayEntity>;
var creatureEntries : array<CCreatureEntry>;
var npc : CNewNPC;
npc = GetNPC();
if (IsNameValid(spawnOnAnimEventName) && animEventName == spawnO
nAnimEventName){
spawnedNPCs.Clear();

respawnTime.Clear();
respawnNeeded.Clear();
spawnedNPCs.Grow(count);
respawnTime.Grow(count);
respawnNeeded.Grow(count);
summonActivated = true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
}
import abstract class SPartySpawner{
}
import abstract class SPartyWaypointData{
}
class CBTTaskPlaySyncedAnimation extends IBehTreeTask{
private var isRunning : Bool;
private var shouldStartAnimation : Bool;
private var syncInstance : CAnimationManualSlotSyncInstance;
private var sequenceIndex : Int32;
private var forceEventOnEnd : CName;
private var gameplayEventOnEnd : CName;
private var finisherSyncAnim : Bool;
private var completeSuccess : Bool;
public function IsAvailable() : Bool{
if (isActive || shouldStartAnimation){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var owner : CActor;
owner = GetActor();
if (!isRunning){
isRunning = true;
shouldStartAnimation = false;
}
owner.EnableCharacterCollisions(false);
owner.SetCanPlayHitAnim(false);
owner.SetImmortalityMode(2, 2, /* NOP */);
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
while (true){
if (syncInstance){
if (syncInstance.HasEnded()){
completeSuccess = true;
return 2;
}
} else {
return 1;
}
SleepOneFrame();
}

return 0;
/* NOP */;
}
public function OnDeactivate(){
var owner : CActor;
owner = GetActor();
if (completeSuccess && finisherSyncAnim){
GetActor().DropItemFromSlot('r_weapon', /* NOP */);
GetActor().DropItemFromSlot('l_weapon', /* NOP */);
GetActor().BreakAttachment();
GetNPC().DisableDeathAndAgony();
owner.SetImmortalityMode(0, 2, /* NOP */);
owner.Kill(false, GetWitcherPlayer(), /* NOP */);
owner.RaiseEvent('FinisherDeath');
}
if (syncInstance && sequenceIndex > -1){
syncInstance.StopSequence(sequenceIndex);
}
isRunning = false;
shouldStartAnimation = false;
syncInstance = NULL;
forceEventOnEnd = 'None';
gameplayEventOnEnd = 'None';
finisherSyncAnim = false;
completeSuccess = false;
owner.SetImmortalityMode(0, 2, /* NOP */);
owner.EnableCharacterCollisions(true);
owner.SetCanPlayHitAnim(true);
/* NOP */;
}
public function OnCompletion(success : Bool){
if (forceEventOnEnd){
GetActor().RaiseForceEvent(forceEventOnEnd);
}
if (gameplayEventOnEnd){
GetActor().SignalGameplayEvent(gameplayEventOnEnd);
}
/* NOP */;
}
public function OnListenedGameplayEvent(gameEventName : CName) : Bool{
var owner : CActor;
owner = GetActor();
if (gameEventName == 'PlaySyncedAnim'){
shouldStartAnimation = true;
return true;
} else if (gameEventName == 'PlayFinisherSyncedAnim'){
shouldStartAnimation = true;
finisherSyncAnim = true;
return true;
} else if (gameEventName == 'SetupSyncInstance'){
syncInstance = theGame.GetSyncAnimManager().GetSyncInsta
nce(GetEventParamInt(-1));
} else if (gameEventName == 'SetupSequenceIndex'){
sequenceIndex = GetEventParamInt(-1);
} else if (gameEventName == 'SetupEndEvent'){
forceEventOnEnd = GetEventParamCName('None');
} else if (gameEventName == 'SetupEndGameplayEvent'){
gameplayEventOnEnd = GetEventParamCName('None');
}
return false;

/* NOP */;
}
public function OnGameplayEvent(gameEventName : CName) : Bool{
if (gameEventName == 'FinisherInterrupt' && GetActor().IsAlive()
){
if (theGame.GetSyncAnimManager().BreakSyncIfPossible(Get
Actor())){
finisherSyncAnim = false;
(CNewNPC)GetActor().FinisherAnimInterrupted();
Complete(false);
}
} else if (gameEventName == 'FinisherKill' && GetActor().IsAlive
()){
thePlayer.SpawnFinisherBlood();
GetActor().SetHealth(0.100000);
}
return false;
/* NOP */;
}
}
import struct CDestructionSystemComponent{
import public final function IsDestroyed() : Bool;
import public final function GetFractureRatio() : Float;
import public final function ApplyFracture() : Bool;
public function GetObjectBoundingVolume(box : Box) : Bool{
box = GetBoundingBox();
if (box.Min != box.Max){
return true;
}
return GetPhysicalObjectBoundingVolume(box);
/* NOP */;
}
}
import abstract class CDeniedAreaComponent{
}
class W3TrapProjectileArea extends W3Trap{
private editable var projectile : CEntityTemplate;
private editable var density : Float;
private editable var maxShots : Int32;
private editable var reloadAtActivation : Bool;
private editable var projAtOnce : SRange;
private editable var delay : SRangeF;
private editable var targetPlayerDelay : SRangeF;
private editable var height : SRangeF;
private editable var velocity : SRangeF;
private editable var projectileOriginOffsetX : SRangeF;
private editable var projectileOriginOffsetY : SRangeF;
private editable var shootOnlyWhenTargetInside : Bool;
private editable var deactivateAutomatically : Bool;
private editable var useAdvancedDistribution : Bool;
private editable var useGridPositioning : Bool;
private editable var excludedEntityTags : array<CName>;
private editable var magnetTags : array<CName>;
private editable var magnetRange : Float;
private editable var magnetOffset : Vector;
private editable var maxDistanceFromPlayer : Float;
private editable var forbidingAreaRadius : Float;

private
private
private
private
private
private
private
private
private
private
private
private
private
private
private

var
var
var
var
var
var
var
var
var
var
var
var
var
var
var

m_AreaComponent : CTriggerAreaComponent;
m_ProjectilePositionGrid : array<Vector>;
m_UsedProjectilePosition : array<Vector>;
m_AcceptablePos : array<Vector>;
m_ForbiddenPos : array<Vector>;
m_LastPlayerCheckedPos : Vector;
m_LastQuantOfForbidAreas : Int32;
m_GridSquareWidth : Float;
m_GridSquareLength : Float;
m_DelayUntilNextShoot : Float;
m_DelayUntilNextPlayerShoot : Float;
m_QuantityShotNext : Int32;
m_PlayerIsInArea : Bool;
m_TargetsInArea : array<CEntity>;
m_CreateEntityHelper : W3TrapProjectileArea_CreateEntityHelp

er;
private var m_EntityCreated : Int32;
private var m_WasCreatingLastFrame : Bool;
private var m_Shot : Bool;
private var m_DebugFloat : Float;
private var m_DebugIndex : Int32;
private saved var m_TotalQuantityShot : Int32;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
m_AreaComponent = (CTriggerAreaComponent)GetComponentByClassName
('CTriggerAreaComponent');
GeneratePositionGrid();
m_QuantityShotNext = RandRange(projAtOnce.max, projAtOnce.min);
m_DelayUntilNextPlayerShoot = RandRangeF(targetPlayerDelay.max,
targetPlayerDelay.min);
m_CreateEntityHelper = new W3TrapProjectileArea_CreateEntityHelp
er in theGame;
/* NOP */;
}
private function GeneratePositionGrid(){
var x : Int32;
var y : Int32;
var l_cornerA : Vector;
var l_cornerB : Vector;
var l_length : Float;
var l_width : Float;
var l_widthVector : Vector;
var l_lengthVector : Vector;
var l_areaPoints : array<Vector>;
var l_startPoint : Vector;
var l_totalSquaresW : Int32;
var l_totalSquaresL : Int32;
var l_position : Vector;
m_AreaComponent.GetWorldPoints(l_areaPoints);
l_startPoint = l_areaPoints[0];
l_widthVector = l_areaPoints[1] - l_startPoint;
l_lengthVector = l_areaPoints[3] - l_startPoint;
l_width = VecLength(l_widthVector);
l_length = VecLength(l_lengthVector);
m_GridSquareWidth = l_width / l_width * density;
m_GridSquareLength = l_length / l_length * density;
l_totalSquaresW = CeilF(l_width / m_GridSquareWidth);
l_totalSquaresL = CeilF(l_length / m_GridSquareLength);
l_widthVector = VecNormalize(l_widthVector) * m_GridSquareWidth;
l_lengthVector = VecNormalize(l_lengthVector) * m_GridSquareLeng

th;
m_ProjectilePositionGrid.Clear();
x = 0;
while (x < l_totalSquaresL){
y = 0;
while (y < l_totalSquaresW){
l_position = l_startPoint + l_widthVector * y +
l_lengthVector * x;
m_ProjectilePositionGrid.PushBack(l_position);
y += 1;
}
x += 1;
}
if (useAdvancedDistribution){
ShufflePositionArray();
}
/* NOP */;
}
private function ShufflePositionArray(){
var l_baseArray : array<Vector>;
var l_shuffleArray : array<Vector>;
var l_randomIndex : Int32;
l_baseArray = m_ProjectilePositionGrid;
do {
l_randomIndex = RandRange(l_baseArray.Size(), /* NOP */)
;
l_shuffleArray.PushBack(l_baseArray[l_randomIndex]);
l_baseArray.Erase(l_randomIndex);
} while (l_baseArray.Size() > 0);
m_ProjectilePositionGrid = l_shuffleArray;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var l_entity : CEntity;
l_entity = activator.GetEntity();
if (ShouldExcludeEntity(l_entity)){
return false;
}
if (!m_TargetsInArea.Contains(l_entity)){
m_TargetsInArea.PushBack(l_entity);
}
if (activator.GetEntity() == thePlayer){
m_PlayerIsInArea = true;
}
if (m_IsActive){
Activate(activator);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var l_entity : CEntity;
l_entity = activator.GetEntity();
if (ShouldExcludeEntity(activator.GetEntity())){
return false;
}
if (activator.GetEntity() == thePlayer){
m_PlayerIsInArea = false;
}

m_TargetsInArea.Remove(l_entity);
if (m_TargetsInArea.Size() == 0 && deactivateAutomatically){
Deactivate(/* NOP */, /* NOP */);
}
/* NOP */;
}
public function Activate(_Target : CNode){
super.Activate(_Target);
if (reloadAtActivation){
m_TotalQuantityShot = 0;
}
/* NOP */;
}
private function ShouldExcludeEntity(_Entity : CNode) : Bool{
var i : Int32;
var l_entityTags : array<CName>;
if (_Entity && excludedEntityTags.Size() > 0){
l_entityTags = _Entity.GetTags();
i = 0;
while (i < excludedEntityTags.Size()){
if (l_entityTags.Contains(excludedEntityTags[i])
){
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
private timer function Update(optional _dT : Float, optional id : Int32)
{
var i : Int32;
var l_actor : CActor;
if (m_CreateEntityHelper.IsCreating()){
return;
} else if (m_WasCreatingLastFrame){
m_WasCreatingLastFrame = false;
m_EntityCreated += 1;
if (m_EntityCreated < m_QuantityShotNext){
if (Shoot()){
m_Shot = true;
return;
}
} else if (m_Shot){
m_DelayUntilNextShoot = RandRangeF(delay.max, de
lay.min);
m_QuantityShotNext = RandRange(projAtOnce.max, p
rojAtOnce.min);
} else {
m_DelayUntilNextShoot = 0.500000;
m_QuantityShotNext = RandRange(projAtOnce.max, p
rojAtOnce.min);
}
}
m_EntityCreated = 0;
i = m_TargetsInArea.Size() - 1;
while (i >= 0){
l_actor = (CActor)m_TargetsInArea[i];
if (l_actor && !l_actor.IsAlive()){

m_TargetsInArea.EraseFast(i);
}
i -= 1;
}
if (shootOnlyWhenTargetInside && m_TargetsInArea.Size() <= 0){
return;
}
m_DelayUntilNextShoot -= _dT;
if (targetPlayerDelay.max >= 0){
m_DelayUntilNextPlayerShoot -= _dT;
}
if (m_DelayUntilNextShoot <= 0 && maxShots < 0 || m_TotalQuantit
yShot <= maxShots){
m_Shot = false;
if (Shoot()){
m_Shot = true;
}
}
/* NOP */;
}
private function Shoot() : Bool{
var l_projectileToShoot : W3AdvancedProjectile;
var l_targetPos : Vector;
var l_originPos : Vector;
var l_rotation : EulerAngles;
var l_forwardVector : Vector;
var l_targetPlayer : Bool;
if (m_TotalQuantityShot > maxShots && maxShots >= 0){
return false;
}
if (m_DelayUntilNextPlayerShoot <= 0 && m_PlayerIsInArea && targ
etPlayerDelay.max >= 0){
l_targetPlayer = true;
m_DelayUntilNextPlayerShoot = RandRangeF(targetPlayerDel
ay.max, targetPlayerDelay.min);
}
if (l_targetPlayer){
l_targetPos = thePlayer.GetWorldPosition() + VecRingRand
(m_GridSquareLength, m_GridSquareWidth);
} else {
l_targetPos = PickRandomShootPosition();
if (l_targetPos == Vector(0, 0, 0)){
return false;
}
}
if (!useGridPositioning && !l_targetPlayer){
l_targetPos += VecRingRand(m_GridSquareLength, m_GridSqu
areWidth);
}
MagnetLandingPosition(l_targetPos);
if (maxDistanceFromPlayer >= 0 && VecDistance(thePlayer.GetWorld
Position(), l_targetPos) > maxDistanceFromPlayer){
return false;
}
if (forbidingAreaRadius > 0){
m_ForbiddenPos.PushBack(l_targetPos);
}
l_originPos = l_targetPos + Vector(RandRangeF(projectileOriginOf
fsetX.max, projectileOriginOffsetX.min), RandRangeF(projectileOriginOffsetY.max,
projectileOriginOffsetY.min), RandRangeF(height.max, height.min));

l_forwardVector = l_targetPos - l_originPos;


l_rotation = VecToRotation(l_forwardVector);
m_CreateEntityHelper.Reset();
m_CreateEntityHelper.owner = this;
m_CreateEntityHelper.velocity = RandRangeF(velocity.max, velocit
y.min);
m_CreateEntityHelper.targetPos = l_targetPos;
m_CreateEntityHelper.SetPostAttachedCallback(m_CreateEntityHelpe
r, 'OnEntityCreated');
theGame.CreateEntityAsync(m_CreateEntityHelper, projectile, l_or
iginPos, l_rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_WasCreatingLastFrame = true;
m_TotalQuantityShot += 1;
return true;
/* NOP */;
}
private function MagnetLandingPosition(_Position : Vector){
var t : Int32;
var e : Int32;
var l_magnetPos : Vector;
var l_actor : CActor;
var l_entities : array<CGameplayEntity>;
t = 0;
while (t < magnetTags.Size()){
l_entities.Clear();
FindGameplayEntitiesCloseToPoint(l_entities, _Position,
magnetRange, 99, magnetTags[t], /* NOP */, /* NOP */, /* NOP */);
e = 0;
while (e < l_entities.Size()){
l_actor = (CActor)l_entities[e];
if (l_actor && !l_actor.IsAlive()){
} else {
l_magnetPos = l_entities[e].GetWorldPosi
tion() + magnetOffset;
if (m_AreaComponent.TestPointOverlap(l_m
agnetPos)){
_Position = l_magnetPos;
return;
}
}
e += 1;
}
t += 1;
}
/* NOP */;
}
private function PickRandomShootPosition() : Vector{
var l_randomIndex : Int32;
var l_playerPos : Vector;
var l_position : Vector;
var l_minMoveDistance : Float;
if (useAdvancedDistribution){
if (m_ProjectilePositionGrid.Size() == 0){
m_ProjectilePositionGrid = m_UsedProjectilePosit
ion;
m_UsedProjectilePosition.Clear();
}
l_position = m_ProjectilePositionGrid[m_ProjectilePositi
onGrid.Size() - 1];
if (maxDistanceFromPlayer >= 0 && VecDistance(thePlayer.

GetWorldPosition(), l_position) > maxDistanceFromPlayer){


return l_position;
}
m_ProjectilePositionGrid.PopBack();
m_UsedProjectilePosition.PushBack(l_position);
return l_position;
} else if (maxDistanceFromPlayer >= 0 || forbidingAreaRadius > 0
){
if (maxDistanceFromPlayer >= 0 && forbidingAreaRadius >
0){
l_minMoveDistance = MinF(maxDistanceFromPlayer,
forbidingAreaRadius);
} else {
l_minMoveDistance = MaxF(maxDistanceFromPlayer,
forbidingAreaRadius);
}
l_minMoveDistance *= 0.300000;
if (m_LastQuantOfForbidAreas < m_ForbiddenPos.Size() ||
VecDistance(thePlayer.GetWorldPosition(), m_LastPlayerCheckedPos) > l_minMoveDis
tance){
l_playerPos = thePlayer.GetWorldPosition();
m_AcceptablePos = m_ProjectilePositionGrid;
if (maxDistanceFromPlayer >= 0){
m_AcceptablePos = PosCloseToPoint(m_Acce
ptablePos, l_playerPos, maxDistanceFromPlayer);
}
if (forbidingAreaRadius > 0){
m_AcceptablePos = PosNotForbidden(m_Acce
ptablePos);
}
m_LastPlayerCheckedPos = l_playerPos;
m_LastQuantOfForbidAreas = m_ForbiddenPos.Size()
;
}
if (m_AcceptablePos.Size() == 0){
return Vector(0, 0, 0);
}
l_randomIndex = RandRange(m_AcceptablePos.Size(), /* NOP
*/);
return m_AcceptablePos[l_randomIndex];
} else {
l_randomIndex = RandRange(m_ProjectilePositionGrid.Size(
), /* NOP */);
return m_ProjectilePositionGrid[l_randomIndex];
}
/* NOP */;
}
private function PosCloseToPoint(_PosToFilter : array<Vector>, _Center :
Vector, _Distance : Float) : array<Vector>{
var i : Int32;
var s : Int32;
var l_numToSkip : Int32;
var l_playerPos : Vector;
var l_pos : array<Vector>;
l_pos = _PosToFilter;
l_numToSkip = RoundF(_Distance * 0.100000 / m_GridSquareWidth);
i = l_pos.Size() - 1;
while (i >= 0){
if (VecDistance(_Center, l_pos[i]) > _Distance){
s = 0;

while (s <= l_numToSkip && i - s >= 0){


l_pos.EraseFast(i - s);
s += 1;
}
}
i -= i + l_numToSkip;
}
return l_pos;
/* NOP */;
}
private function PosNotForbidden(_PosToFilter : array<Vector>) : array<V
ector>{
var i : Int32;
var f : Int32;
var l_numToSkip : Int32;
var l_pos : array<Vector>;
l_pos = _PosToFilter;
i = l_pos.Size() - 1;
while (i >= 0){
f = 0;
while (f < m_ForbiddenPos.Size()){
if (VecDistance(m_ForbiddenPos[f], l_pos[i]) < f
orbidingAreaRadius){
l_pos.EraseFast(i);
break;
}
f += 1;
}
i -= 1;
}
return l_pos;
/* NOP */;
}
}
class CBehTreeTaskCriticalState extends IBehTreeTask{
private var activate : Bool;
private var activateTimeStamp : Float;
private var forceActivate : Bool;
private var currentCS : ECriticalStateType;
protected var storageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
if (forceActivate){
return true;
}
if (activateTimeStamp + 3 < GetLocalTime()){
activate = false;
}
return activate && !GetNPC().IsUnstoppable();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
activate = false;
forceActivate = false;
GetNPC().SetIsInHitAnim(true);
return 0;
/* NOP */;
}
public function OnDeactivate(){
var currBuff : CBaseGameplayEffect;

var nextBuff : CBaseGameplayEffect;


var nextBuffType : ECriticalStateType;
var owner : CNewNPC;
var forceRemoveCurrentBuff : Bool;
owner = GetNPC();
if (owner.IsInFinisherAnim()){
activate = true;
return;
}
nextBuff = owner.ChooseNextCriticalBuffForAnim();
nextBuffType = GetBuffCriticalType(nextBuff);
if (!nextBuff || currentCS == nextBuffType){
forceRemoveCurrentBuff = true;
} else {
forceRemoveCurrentBuff = false;
}
owner.CriticalStateAnimStopped(forceRemoveCurrentBuff);
activate = false;
if (!nextBuff){
currBuff = owner.GetCurrentlyAnimatedCS();
CriticalBuffDisallowPlayAnimation(currBuff);
} else {
forceActivate = true;
}
currentCS = 11;
owner.EnableCollisions(true);
owner.SetIsInHitAnim(false);
owner.SetBehaviorVariable('bCriticalStopped', 1.000000, /* NOP *
/);
/* NOP */;
}
public function OnListenedGameplayEvent(gameEventName : CName) : Bool{
var npc : CNewNPC;
var receivedBuffType : ECriticalStateType;
var receivedBuff : CBaseGameplayEffect;
var currentBuffPriority : Int32;
var receivedBuffPriority : Int32;
if (gameEventName == 'ForceCS'){
forceActivate = true;
} else if (gameEventName == 'CriticalState'){
receivedBuffType = GetEventParamInt(-1);
npc = GetNPC();
if (receivedBuffType == 0 && npc.HasAbility('BurnNoAnim'
)){
return false;
}
if (npc.HasAbility('ablIgnoreSigns')){
return false;
}
if (ShouldBeScaredOnOverlay()){
theGame.GetBehTreeReactionManager().CreateReacti
onEventIfPossible(GetNPC(), 'TauntAction', -1, 1.000000, -1.000000, 1, false, /*
NOP */, /* NOP */);
return false;
}
activate = true;
activateTimeStamp = GetLocalTime();
if (isActive){
currentBuffPriority = CalculateCriticalStateType
Priority(currentCS);

receivedBuffPriority = CalculateCriticalStateTyp
ePriority(receivedBuffType);
if (receivedBuffPriority > currentBuffPriority){
Complete(true);
}
}
} else if (gameEventName == 'RagdollFromHorse'){
forceActivate = true;
}
currentCS = receivedBuffType;
return IsAvailable();
/* NOP */;
}
public function ShouldBeScaredOnOverlay() : Bool{
var res : Int32;
res = GetNPC().SignalGameplayEventReturnInt('AI_ShouldBeScaredOn
Overlay', -1);
return res > 0;
/* NOP */;
}
}
class W3TrapProjectileArea_CreateEntityHelper extends CCreateEntityHelper{
public var owner : W3TrapProjectileArea;
public var velocity : Float;
public var targetPos : Vector;
public function OnEntityCreated(entity : CEntity) : Bool{
var projectileToShoot : W3AdvancedProjectile;
if (owner){
projectileToShoot = (W3AdvancedProjectile)entity;
projectileToShoot.Init(owner);
projectileToShoot.ShootProjectileAtPosition(0, velocity,
targetPos, /* NOP */, /* NOP */);
owner = NULL;
} else {
entity.Destroy();
}
/* NOP */;
}
}
import struct CAnimatedComponent{
public var nextFreeAnimMultCauserId : Int32;
public var animationMultiplierCausers : array<SAnimMultiplyCauser>;
import public final function UseExtractedMotion() : Bool;
import public final function SetUseExtractedMotion(use : Bool);
import public final function StickRagdollToCapsule(stick : Bool);
import public final latent function ActivateBehaviors(names : array<CNam
e>) : Bool;
import public final latent function AttachBehavior(instanceName : CName)
: Bool;
import public final function DetachBehavior(instanceName : CName) : Bool
;
import public final function SetBehaviorVariable(varName : CName, varVal
ue : Float) : Bool;
import public final function GetBehaviorVariable(varName : CName) : Floa
t;
import public final function SetBehaviorVectorVariable(varName : CName,
varValue : Vector) : Bool;
import public final function GetBehaviorVectorVariable(varName : CName)

: Vector;
import public final function DisplaySkeleton(bone : Bool, axis : Bool, n
ames : Bool);
import public final function GetAnimationTimeMultiplier() : Float;
import public final function SetAnimationTimeMultiplier(mult : Float);
import public final function GetMoveSpeedAbs() : Float;
import public final function RaiseBehaviorEvent(eventName : CName) : Boo
l;
import public final function RaiseBehaviorForceEvent(eventName : CName)
: Bool;
import public final function FindNearestBoneWS(position : Vector) : Int3
2;
import public final function FindNearestBoneToEdgeWS(a : Vector, b : Vec
tor) : Int32;
import public final function GetCurrentBehaviorState(instanceName : CNam
e) : String;
import public final function FreezePose();
import public final function UnfreezePose();
import public final function FreezePoseFadeIn(fadeInTime : Float);
import public final function UnfreezePoseFadeOut(fadeOutTime : Float);
import public final function HasFrozenPose() : Bool;
import public final function SyncTo(slaveComponent : CAnimatedComponent,
ass : SAnimatedComponentSyncSettings) : Bool;
import public final function HasRagdoll() : Bool;
import public final function GetRagdollBoneName(actorIndex : Int32) : CN
ame;
import public final function PlaySlotAnimationAsync(animation : CName, s
lotName : CName, settings : SAnimatedComponentSlotAnimationSettings) : Bool;
import public final function PlaySkeletalAnimationAsync(animation : CNam
e, looped : Bool) : Bool;
import public final function GetMoveSpeedRel() : Float;
import public final function GetBoneMatrixMovementModelSpaceInAnimation(
boneIndex : Int32, animation : CName, time : Float, deltaTime : Float, boneAtTim
eMS : Matrix, boneWithDeltaTimeMS : Matrix);
import public final function DontUpdateByOtherAnimatedComponent();
import public final function UpdateByOtherAnimatedComponent(slaveCompone
nt : CAnimatedComponent);
public function SetAnimationSpeedMultiplier(mul : Float) : Int32{
var causer : SAnimMultiplyCauser;
var finalMul : Float;
causer.mul = mul;
causer.id = nextFreeAnimMultCauserId;
nextFreeAnimMultCauserId += 1;
animationMultiplierCausers.PushBack(causer);
super.SetAnimationTimeMultiplier(CalculateFinalAnimationSpeedMul
tiplier());
return causer.id;
/* NOP */;
}
private function CalculateFinalAnimationSpeedMultiplier() : Float{
if (animationMultiplierCausers.Size() > 0){
return animationMultiplierCausers[animationMultiplierCau
sers.Size() - 1].mul;
}
return 1;
/* NOP */;
}
public function ResetAnimationSpeedMultiplier(id : Int32){
var i : Int32;
var size : Int32;

size = animationMultiplierCausers.Size();
if (size == 0){
return;
}
i = size - 1;
while (i >= 0){
if (animationMultiplierCausers[i].id == id){
animationMultiplierCausers.Erase(i);
}
i -= 1;
}
if (animationMultiplierCausers.Size() + 1 != size){
LogAssert(false, "CAnimatedComponent.ResetAnimationMulti
plier: invalid causer ID passed, nothing removed!");
return;
}
super.SetAnimationTimeMultiplier(CalculateFinalAnimationSpeedMul
tiplier());
/* NOP */;
}
}
import abstract class CComponent{
import public final function GetEntity() : CEntity;
import public final function IsEnabled() : Bool;
import public final function SetEnabled(flag : Bool);
import public final function SetPosition(position : Vector);
import public final function SetRotation(rotation : EulerAngles);
import public final function SetScale(scale : Vector);
import public final function HasDynamicPhysic() : Bool;
import public final function HasCollisionType(collisionTypeName : CName,
actorIndex : Int32, shapeIndex : Int32) : Bool;
import public final function GetPhysicalObjectLinearVelocity(actorIndex
: Int32) : Vector;
import public final function GetPhysicalObjectAngularVelocity(actorIndex
: Int32) : Vector;
import public final function SetPhysicalObjectLinearVelocity(velocity :
Vector, actorIndex : Int32) : Bool;
import public final function SetPhysicalObjectAngularVelocity(velocity :
Vector, actorIndex : Int32) : Bool;
import public final function GetPhysicalObjectMass(actorIndex : Int32) :
Float;
import public final function ApplyTorqueToPhysicalObject(torque : Vector
, actorIndex : Int32);
import public final function ApplyForceAtPointToPhysicalObject(force : V
ector, point : Vector, actorIndex : Int32);
import public final function ApplyLocalImpulseToPhysicalObject(impulse :
Vector, actorIndex : Int32);
import public final function ApplyTorqueImpulseToPhysicalObject(impulse
: Vector, actorIndex : Int32);
import public final function GetPhysicalObjectBoundingVolume(box : Box)
: Bool;
import public final function SetShouldSave(shouldSave : Bool);
public function SignalCustomEvent(eventName : CName){
}
}
import abstract class CLayer{
}

class CBehTreeTaskCSEffect extends IBehTreeTask{


protected var CSType : ECriticalStateType;
protected var requestedCSType : ECriticalStateType;
public var buffType : EEffectType;
public var buff : CBaseGameplayEffect;
public var finisherAnimName : CName;
private var hasBuff : Bool;
private var allowBlend : Bool;
private var hitReactionDisabled : Bool;
private var waitForDropItem : Bool;
private var isInAir : Bool;
private var heightDiff : Float;
private var isInPotentialRagdoll : Bool;
private var guardOpen : Bool;
private var criticalStatesToResist : Int32;
private var resistCriticalStateChance : Int32;
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CBaseAICombatStorage;
protected var reactionDataStorage : CAIStorageReactionData;
protected var finisherEnabled : Bool;
protected var forceFinisherActivation : Bool;
protected var finisherDisabled : Bool;
private var pullToNavRadiusMult : Float;
private var m_storedInteractionPri : EInteractionPriority;
private var startAirPos : Vector;
private var endAirPos : Vector;
private var cachedInAir : Bool;
private var airStartTime : Float;
private var screamPlayed : Bool;
private var fallingDamage : Float;
private var maxFallingHeightDiff : Float;
public function IsAvailable() : Bool{
var owner : CNewNPC;
owner = GetNPC();
buff = owner.ChooseCurrentCriticalBuffForAnim();
if (buff){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var owner : CNewNPC;
var currentPri : EInteractionPriority;
var actor : CActor;
owner = GetNPC();
InitializeDataStorages();
buffType = buff.GetEffectType();
CSType = GetBuffCriticalType(buff);
owner.CSAnimStarted(buff);
owner.IncCriticalStateCounter();
owner.SetBehaviorVariable('bCriticalStopped', 0, /* NOP */);
owner.SetBehaviorVariable('CriticalStateType', CSType, /* NOP */
);
owner.SignalGameplayEvent('CSActivated');
combatDataStorage.SetCriticalState(CSType, true, 0);
reactionDataStorage.ChangeAttitudeIfNeeded(owner, (CActor)buff.G
etCreator());
hasBuff = true;
finisherDisabled = false;

actor = owner;
currentPri = actor.GetInteractionPriority();
if (actor.IsAlive() && currentPri != -2){
m_storedInteractionPri = currentPri;
actor.SetInteractionPriority(-2);
}
if (CSType == 5 || CSType == 6){
owner.SignalGameplayEvent('StopRage');
}
if (ShouldDisableHitReaction()){
owner.SetCanPlayHitAnim(false);
hitReactionDisabled = true;
} else {
hitReactionDisabled = false;
}
if (owner.HasShieldedAbility() && ShouldNotLowerGuard()){
} else {
owner.LowerGuard();
}
if (!owner.IsInAir() && owner.IsOnGround()){
EnableFinisher();
}
if (CSType != 10 && ShouldTryToDisarm()){
Disarm();
}
if (CSType == 1 || CSType == 2 || CSType == 14 || CSType == 3 ||
CSType == 4){
OnRagdollStart();
} else {
isInPotentialRagdoll = false;
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var criticalStateCounter : Int32;
var tmpF : Float;
var timeStamp : Float;
var mac : CMovingPhysicalAgentComponent;
npc = GetNPC();
criticalStateCounter = 0;
if (CSType == 1 || CSType == 2 || CSType == 3 || CSType == 4 &&
npc.HasAbility('MistCharge')){
npc.PlayEffect('appear_fog', /* NOP */);
}
if (CSType == 0 && npc.HasAbility('BurnIgnore')){
timeStamp = GetLocalTime();
while (isActive){
if (timeStamp + 1.000000 <= GetLocalTime()){
npc.SignalGameplayEvent('BurnCriticalCom
pleted');
npc.RequestCriticalAnimStop(/* NOP */);
Complete(true);
}
SleepOneFrame();
}
} else if (CSType == 10){
if (npc.HasAbility('mon_gravehag')){
tmpF = npc.GetBehaviorVariable('AttackType', /*

NOP */);
if (tmpF == 6 || tmpF == 19){
npc.SetBehaviorVariable('countered', 1,
/* NOP */);
npc.RemoveAbility('TongueAttack');
}
}
while (waitForDropItem){
SleepOneFrame();
}
npc.SetRequiredItems('None', 'blunt1h');
npc.ProcessRequiredItems(true);
} else if (isInPotentialRagdoll){
mac = (CMovingPhysicalAgentComponent)GetActor().GetMovin
gAgentComponent();
while (true){
OnRagdollUpdate(npc, mac);
SleepOneFrame();
}
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var actor : CActor;
var owner : CNewNPC;
var buffs : array<CBaseGameplayEffect>;
var deactivate : Bool;
var i : Int32;
owner = GetNPC();
actor = owner;
actor.EnablePhysicalMovement(false);
if (actor.IsAlive() && m_storedInteractionPri != -1){
actor.SetInteractionPriority(m_storedInteractionPri);
m_storedInteractionPri = -1;
}
if (guardOpen){
owner.SetGuarded(true);
guardOpen = false;
}
if (hitReactionDisabled){
owner.SetCanPlayHitAnim(true);
}
if (finisherEnabled){
DisableFinisher();
}
combatDataStorage.SetCriticalState(CSType, false, GetLocalTime()
);
if (isInPotentialRagdoll){
OnRagdollStop();
}
if (owner.IsAlive() && owner.IsRagdolled() && !owner.IsStatic()
&& requestedCSType != 1 && requestedCSType != 2){
owner.SetKinematic(true);
}
forceFinisherActivation = false;
/* NOP */;
}
public function ShouldEnableFinisher() : Bool{
var actor : CActor;

actor = GetActor();
if (CSType != 1 && CSType != 2 && CSType != 14 && forceFinisherA
ctivation == false){
return false;
}
if (GetWitcherPlayer() && GetAttitudeBetween(actor, thePlayer) =
= 2 && actor.IsVulnerable() && actor.GetComponent("Finish")){
if (actor.HasAbility('ResistFinisher') && actor.GetHealt
hPercents() > 0.200000){
return false;
}
return true;
}
return false;
/* NOP */;
}
public function EnableFinisher(){
if (IsNameValid(finisherAnimName) && ShouldEnableFinisher() && !
finisherEnabled && !finisherDisabled){
GetNPC().EnableFinishComponent(true);
thePlayer.AddToFinishableEnemyList(GetNPC(), true);
finisherEnabled = true;
}
/* NOP */;
}
public function DisableFinisher(){
GetNPC().EnableFinishComponent(false);
thePlayer.AddToFinishableEnemyList(GetNPC(), false);
finisherEnabled = false;
/* NOP */;
}
public function ShouldCompleteOnParryStart() : Bool{
switch(CSType){
case 4:
return true;
case 10:
return true;
default:
}
return false;
return false;
/* NOP */;
}
public function ShouldNotLowerGuard() : Bool{
switch(CSType){
case 4:
return true;
case 10:
return true;
default:
}
return false;
return false;
/* NOP */;
}
public function ShouldTryToDisarm() : Bool{
var res : Bool;
if (!GetNPC().HasShieldedAbility()){
return false;
}

switch(CSType){
case 1:
res = true;
break;
case 2:
res = true;
break;
default:
res = false;
}
if (!res){
return false;
}
return GetNPC().HasShieldedAbility();
/* NOP */;
}
public function ShouldDisableHitReaction() : Bool{
switch(CSType){
case 17:
return true;
case 14:
return true;
default:
}
return false;
return false;
/* NOP */;
}
public function Disarm(){
GetNPC().DropItemFromSlot('l_weapon', true);
/* NOP */;
}
public function FinisherSyncAnim(){
theGame.GetSyncAnimManager().SetupSimpleSyncAnim(finisherAnimNam
e, thePlayer, GetActor());
/* NOP */;
}
public function CombatCheck() : Bool{
var stateName : CName;
stateName = thePlayer.GetCurrentStateName();
if (stateName == 'CombatSteel' || stateName == 'CombatSilver'){
return true;
}
return false;
/* NOP */;
}
public function GetStats(){
var resistCriticalStateMultiplier : Int32;
criticalStatesToResist = CalculateAttributeValue(GetActor().GetA
ttributeValue('critical_states_to_raise_guard', /* NOP */, /* NOP */), /* NOP */
);
resistCriticalStateChance = MaxF(0, 100 * CalculateAttributeValu
e(GetActor().GetAttributeValue('resist_critical_state_chance', /* NOP */, /* NOP
*/), /* NOP */));
resistCriticalStateMultiplier = MaxF(0, 100 * CalculateAttribute
Value(GetActor().GetAttributeValue('resist_critical_state_chance_mult_per_hit',
/* NOP */, /* NOP */), /* NOP */));
resistCriticalStateChance += Max(0, GetNPC().GetCriticalStateCou
nter(/* NOP */) - 1) * resistCriticalStateMultiplier;
if (criticalStatesToResist < 0){

criticalStatesToResist = 65536;
}
/* NOP */;
}
public function Roll(chance : Float) : Bool{
if (chance >= 100){
return true;
} else if (RandRange(100, /* NOP */) < chance){
return true;
}
return false;
/* NOP */;
}
public function OnRagdollStart(){
var mac : CMovingPhysicalAgentComponent;
var radius : Float;
var owner : CNewNPC;
owner = GetNPC();
mac = (CMovingPhysicalAgentComponent)GetActor().GetMovingAgentCo
mponent();
screamPlayed = false;
airStartTime = 0.000000;
fallingDamage = 0.000000;
maxFallingHeightDiff = 0.000000;
if (!GetNPC().IsInFistFightMiniGame() && GetActor().IsVulnerable
() && !IsThisStagger() || IsCliffBehindMe() && !GetNPC().IsInInterior() && GetAc
tor().EnablePhysicalMovement(true)){
mac.SnapToNavigableSpace(false);
isInPotentialRagdoll = true;
if (GetActor().IsInAir()){
startAirPos = mac.GetAgentPosition();
cachedInAir = true;
airStartTime = GetLocalTime();
} else {
cachedInAir = false;
}
} else {
GetActor().EnablePhysicalMovement(false);
mac.SnapToNavigableSpace(true);
isInPotentialRagdoll = false;
}
/* NOP */;
}
public function OnRagdollUpdate(owner : CNewNPC, mac : CMovingPhysicalAg
entComponent){
var velocity : Float;
var submergeDepth : Float;
var currentFaliingHeightDiff : Float;
velocity = VecLengthSquared(mac.GetVelocity());
submergeDepth = mac.GetSubmergeDepth();
if (!owner.IsInAir() && !cachedInAir && !mac.IsOnGround() && vel
ocity >= 0.010000){
owner.SetIsInAir(true);
startAirPos = mac.GetAgentPosition();
cachedInAir = true;
DisableFinisher();
airStartTime = GetLocalTime();
} else if (!owner.IsInAir() && cachedInAir || owner.IsInAir() &&
mac.IsOnGround() || !mac.IsOnGround() && velocity < 0.010000 || owner.IsInAir()
&& submergeDepth <= -0.500000){

EnableFinisher();
owner.SetIsInAir(false);
cachedInAir = false;
endAirPos = mac.GetAgentPosition();
currentFaliingHeightDiff = startAirPos.Z - endAirPos.Z;
maxFallingHeightDiff = MaxF(currentFaliingHeightDiff, ma
xFallingHeightDiff);
fallingDamage = MaxF(fallingDamage, owner.ApplyFallingDa
mage(currentFaliingHeightDiff, false));
airStartTime = 0.000000;
}
if (owner.IsHuman()){
if (IsThisStagger() && airStartTime > 0.000000 && GetLoc
alTime() - airStartTime > 0){
ApplyRagdoll();
}
if (!screamPlayed && airStartTime > 0.000000 && GetLocal
Time() - airStartTime > 0.500000){
PlayScream();
screamPlayed = true;
}
} else if (!mac.IsOnNavigableSpace() && IsCliffBehindMe()){
ApplyRagdoll();
}
if (!owner.IsInAir() && owner.IsHuman() && IsThisStagger()){
if (!mac.IsOnNavigableSpace()){
ApplyRagdoll();
}
} else if (!owner.IsInAir() && owner.IsAlive() && submergeDepth
<= -0.500000 || owner.GetBehaviorVariable('bCriticalStopped', /* NOP */) > 0.500
000){
if (mac.IsOnNavigableSpace()){
return;
} else if (KillNPCIfNeeded(owner, mac)){
Complete(true);
}
}
/* NOP */;
}
public function OnRagdollStop(){
var mac : CMovingPhysicalAgentComponent;
var owner : CNewNPC;
owner = GetNPC();
mac = (CMovingPhysicalAgentComponent)owner.GetMovingAgentCompone
nt();
if (owner.IsHuman() && IsThisStagger()){
if (owner.IsInAir() || !mac.IsOnNavigableSpace()){
ApplyRagdoll();
}
if (!owner.HasBuff(65)){
mac.SnapToNavigableSpace(true);
owner.EnablePhysicalMovement(false);
}
} else if (owner.IsAlive()){
if (!mac.IsOnNavigableSpace() && KillNPCIfNeeded(owner,
mac)){
mac.SnapToNavigableSpace(false);
} else {
mac.SnapToNavigableSpace(true);
owner.EnablePhysicalMovement(false);

}
} else {
mac.SnapToNavigableSpace(false);
if (CSType == 14 || owner.IsRagdolled()){
owner.DisableDeathAndAgony();
}
}
/* NOP */;
}
public function IsThisStagger() : Bool{
return CSType == 4 || CSType == 3 || CSType == 10;
/* NOP */;
}
public function IsCliffBehindMe() : Bool{
var ownerPosition : Vector;
var pointA : Vector;
var pointB : Vector;
var heading : Vector;
var position : Vector;
var normal : Vector;
var target : CNode;
var collisionGroups : array<CName>;
ownerPosition = GetNPC().GetWorldPosition();
if (buff.GetCreator()){
target = buff.GetCreator();
} else if (GetCombatTarget()){
target = GetCombatTarget();
}
if (!target){
return false;
}
heading = VecNormalize(target.GetWorldPosition() - ownerPosition
) * -1.500000;
pointA = ownerPosition + heading;
if (theGame.GetWorld().NavigationLineTest(ownerPosition, pointA,
GetActor().GetRadius(), false, true)){
return false;
}
position = ownerPosition;
position.Z += 1.500000;
if (theGame.GetWorld().StaticTrace(position, position + heading,
position, normal, collisionGroups)){
return false;
}
pointA.Z += 1.500000;
heading = VecNormalize(target.GetWorldPosition() - ownerPosition
) * -2;
pointB = ownerPosition + heading;
pointB.Z -= 1.500000;
collisionGroups.PushBack('Static');
collisionGroups.PushBack('Terrain');
if (theGame.GetWorld().SweepTest(pointA, pointB, 0.400000, posit
ion, normal, collisionGroups)){
return false;
}
return true;
/* NOP */;
}
public function KillNPCIfNeeded(owner : CNewNPC, mac : CMovingPhysicalAg
entComponent) : Bool{

var newPosition : Vector;


if (!theGame.GetWorld().NavigationFindSafeSpot(mac.GetAgentPosit
ion(), owner.GetRadius(), ClampF(owner.GetRadius() * pullToNavRadiusMult, 0, 2.5
00000), newPosition) && !CanSwimOrFly(owner, mac)){
if (fallingDamage > 0 || maxFallingHeightDiff >= 1.30000
0){
owner.Kill(false, NULL, 'FallingDamage');
} else {
owner.Kill(/* NOP */, /* NOP */, /* NOP */);
}
owner.SetKinematic(false);
return true;
}
return false;
/* NOP */;
}
public function CanSwimOrFly(owner : CNewNPC, mac : CMovingPhysicalAgent
Component) : Bool{
if (owner.HasAbility('mon_drowner_base') || owner.HasAbility('mo
n_siren_base') && mac.GetSubmergeDepth() < 0){
return true;
}
if (owner.HasAbility('mon_wyvern_base') || owner.HasAbility('mon
_siren_base') || owner.HasAbility('mon_gryphon_base') || owner.HasAbility('mon_h
arpy_base') && mac.GetSubmergeDepth() > 0){
return true;
}
return false;
/* NOP */;
}
public function ApplyRagdoll(){
var owner : CNewNPC;
var params : SCustomEffectParams;
owner = GetNPC();
if (GetActor().HasBuff(65)){
return;
}
params.effectType = 65;
params.creator = GetActor();
params.sourceName = "inAir";
params.duration = 1.000000;
GetActor().AddEffectCustom(params);
if (!owner.IsHuman()){
owner.Kill(/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function PlayScream(){
if (GetActor().IsWoman()){
return GetActor().SoundEvent("grunt_vo_test_falling_scre
am_AdultFemale", 'head', /* NOP */);
} else {
return GetActor().SoundEvent("grunt_vo_test_falling_scre
am_AdultMale", 'head', /* NOP */);
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var npc : CNewNPC;

npc = GetNPC();
if (animEventName == 'AllowBlend' && animEventType == 1){
Complete(true);
return true;
} else if (animEventName == 'StaggerCounter'){
npc.SignalGameplayEvent('StaggerCounter');
Complete(true);
return true;
} else if (animEventName == 'DisarmMoment'){
if (ShouldTryToDisarm()){
Disarm();
}
return true;
} else if (animEventName == 'OpenGuard' && npc.HasShieldedAbilit
y()){
if (animEventType == 1){
npc.SetGuarded(false);
guardOpen = true;
} else if (animEventType == 3){
npc.SetGuarded(true);
guardOpen = false;
}
return true;
} else if (animEventName == 'SetRagdoll'){
if ((CMovingPhysicalAgentComponent)npc.GetMovingAgentCom
ponent().HasRagdoll()){
npc.TurnOnRagdoll();
}
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(gameEventName : CName) : Bool{
if (gameEventName == 'CriticalState'){
requestedCSType = GetNPC().GetBehaviorVariable('Critical
StateType', /* NOP */);
}
return IsAvailable();
/* NOP */;
}
protected function getBuffType(CSType : ECriticalStateType) : EEffectTyp
e{
switch(CSType){
case 9:
return 8;
case 0:
return 18;
case 2:
return 9;
case 1:
return 6;
case 7:
return 14;
case 6:
return 5;
case 8:
return 12;
case 5:
return 7;
case 4:

return 13;
case 10:
return 56;
case 3:
return 46;
case 13:
return 53;
case 14:
return 65;
case 15:
return 15;
case 17:
return 11;
case 12:
return 52;
case 16:
return 58;
default:
}
return 0;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var syncAnimName : CName;
var effect : CBaseGameplayEffect;
npc = GetNPC();
if (eventName == 'RotateEventStart'){
effect = npc.GetBuff(getBuffType(CSType), /* NOP */);
npc.SetRotationAdjustmentRotateTo(effect.GetCreator(), /
* NOP */);
return true;
} else if (eventName == 'StoppingEffect' && finisherEnabled && G
etEventParamInt(-1) == CSType){
GetNPC().EnableFinishComponent(false);
thePlayer.AddToFinishableEnemyList(GetNPC(), false);
finisherEnabled = false;
return true;
} else if (eventName == 'Finisher'){
if (CombatCheck() && finisherEnabled){
GetNPC().EnableFinishComponent(false);
thePlayer.AddToFinishableEnemyList(GetNPC(), fal
se);
GetNPC().FinisherAnimStart();
FinisherSyncAnim();
}
return true;
} else if (eventName == 'ParryStart' && ShouldCompleteOnParrySta
rt() && npc.IsShielded(GetCombatTarget())){
Complete(true);
return true;
} else if (eventName == 'DisableFinisher'){
if (!npc.HasAbility('mon_siren_base')){
finisherDisabled = true;
DisableFinisher();
}
return true;
} else if (eventName == 'EnableFinisher'){
finisherDisabled = false;
EnableFinisher();

return true;
} else if (eventName == 'ForceStopCriticalEffect' && GetEventPar
amInt(-1) == CSType){
Complete(true);
return true;
} else if (eventName == 'SpearDestruction'){
npc.ProcessSpearDestruction();
waitForDropItem = false;
return true;
}
return false;
/* NOP */;
}
public function InitializeDataStorages(){
if (!combatDataStorage || !reactionDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageRe
actionData', this);
reactionDataStorage = (CAIStorageReactionData)storageHan
dler.Get();
}
/* NOP */;
}
}
import abstract class SAppearanceAttachment{
}
import abstract class SAppearanceAttachments{
}
import struct CAppearanceComponent{
import public final function ApplyAppearance(appearanceName : String);
import public final function IncludeAppearanceTemplate(template : CEntit
yTemplate);
import public final function ExcludeAppearanceTemplate(template : CEntit
yTemplate);
}
class CBTTaskDurationDef extends IBehTreeTaskDefinition{
public editable var duration : Float;
public editable var chance : Int32;
public editable var endWithFailure : Bool;
}
import abstract class SGameplayConfig{
}
import abstract class SGameplayConfigLookAts{
}
import abstract class SGameplayConfigGameCamera{
}
import abstract class SActorLODConfig{
}

class BTTaskHandleHorseCollision extends BTTaskGameplayEventListener{


public function IsAvailable() : Bool{
return super.IsAvailable();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return super.OnActivate();
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (isActive){
return false;
}
if (GetNPC().IsHorse() && GetNPC().GetCanFlee() && GetNPC().GetH
orseComponent().IsDismounted()){
SetCustomTarget(GetNPC().GetWorldPosition(), 0.000000);
SetEventRetvalInt(1);
return super.OnListenedGameplayEvent(eventName);
} else {
SetEventRetvalInt(0);
return false;
}
/* NOP */;
}
}
import abstract class SGameplayLODConfig{
}
import abstract class SCollisionInfo{
}
import abstract class SCollisionData{
//NULL type for entity
//NULL type for normal
//NULL type for point
}
import abstract class GameTime{
}
import abstract class GameTimeInterval{
}
import abstract class GameTimeWrapper{
//NULL type for gameTime
}
class CBTTaskHitReactionDecorator extends CBTTaskPlayAnimationEventDecorator{
public var createHitReactionEvent : CName;
public var increaseHitCounterOnlyOnMeleeDmg : Bool;
private var hitsToRaiseGuard : Int32;
private var raiseGuardChance : Int32;
private var hitsToCounter : Int32;
private var counterChance : Int32;
private var counterStaminaCost : Float;
private var damageData : CDamageData;
private var damageIsMelee : Bool;
private var rotateNode : CNode;
private var lastAttacker : CGameplayEntity;

protected var reactionDataStorage : CAIStorageReactionData;


public var cachedPos : Vector;
public function IsAvailable() : Bool{
return GetActor().CanPlayHitAnim() && !GetNPC().IsUnstoppable();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
GetStats();
npc.SetIsInHitAnim(true);
InitializeReactionDataStorage();
reactionDataStorage.ChangeAttitudeIfNeeded(npc, (CActor)lastAtta
cker);
if (CheckGuardOrCounter()){
npc.DisableHitAnimFor(0.100000);
npc.SetIsInHitAnim(false);
return 2;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
npc.SetIsTranslationScaled(false);
npc.SetIsInHitAnim(false);
/* NOP */;
}
public function GetStats(){
var raiseGuardMultiplier : Int32;
var counterMultiplier : Int32;
hitsToRaiseGuard = CalculateAttributeValue(GetActor().GetAttribu
teValue('hits_to_raise_guard', /* NOP */, /* NOP */), /* NOP */);
raiseGuardChance = MaxF(0, 100 * CalculateAttributeValue(GetActo
r().GetAttributeValue('raise_guard_chance', /* NOP */, /* NOP */), /* NOP */));
raiseGuardMultiplier = MaxF(0, 100 * CalculateAttributeValue(Get
Actor().GetAttributeValue('raise_guard_chance_mult_per_hit', /* NOP */, /* NOP *
/), /* NOP */));
hitsToCounter = CalculateAttributeValue(GetActor().GetAttributeV
alue('hits_to_roll_counter', /* NOP */, /* NOP */), /* NOP */);
counterChance = MaxF(0, 100 * CalculateAttributeValue(GetActor()
.GetAttributeValue('counter_chance', /* NOP */, /* NOP */), /* NOP */));
counterMultiplier = MaxF(0, 100 * CalculateAttributeValue(GetAct
or().GetAttributeValue('counter_chance_per_hit', /* NOP */, /* NOP */), /* NOP *
/));
counterStaminaCost = CalculateAttributeValue(GetNPC().GetAttribu
teValue('counter_stamina_cost', /* NOP */, /* NOP */), /* NOP */);
raiseGuardChance += Max(0, GetNPC().GetHitCounter(/* NOP */) - 1
) * raiseGuardMultiplier;
counterChance += Max(0, GetNPC().GetHitCounter(/* NOP */) - 1) *
counterMultiplier;
if (hitsToRaiseGuard < 0){
hitsToRaiseGuard = 65536;
}
/* NOP */;
}
public function CheckGuardOrCounter() : Bool{
var npc : CNewNPC;
var hitCounter : Int32;

npc = GetNPC();
hitCounter = npc.GetHitCounter(/* NOP */);
if (hitCounter >= hitsToRaiseGuard && npc.CanGuard()){
GetStats();
if (Roll(raiseGuardChance)){
if (npc.RaiseGuard()){
npc.SignalGameplayEvent('HitReactionTask
Completed');
return true;
}
}
}
if (!npc.IsHuman() && GetActor().GetMovingAgentComponent().GetNa
me() != "wild_hunt_base" && hitCounter >= hitsToCounter){
if (Roll(counterChance) && npc.GetStat(2, /* NOP */) >=
counterStaminaCost){
npc.SignalGameplayEvent('LaunchCounterAttack');
return true;
}
}
return false;
/* NOP */;
}
public function CheckDistanceToAttacker(attacker : CActor) : Bool{
var dist : Float;
dist = VecDistanceSquared(GetActor().GetWorldPosition(), attacke
r.GetWorldPosition());
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (eventName == 'BeingHit'){
damageData = (CDamageData)GetEventParamBaseDamage();
damageIsMelee = damageData.isActionMelee;
lastAttacker = damageData.attacker;
if (!npc.IsInFistFightMiniGame() && (CActor)lastAttacker
){
theGame.GetBehTreeReactionManager().CreateReacti
onEventIfPossible(lastAttacker, 'CombatNearbyAction', 5.000000, 10.000000, 999.0
00000, -1, true, /* NOP */, /* NOP */);
}
rotateNode = GetRotateNode();
if (!increaseHitCounterOnlyOnMeleeDmg || increaseHitCoun
terOnlyOnMeleeDmg && damageIsMelee){
npc.IncHitCounter();
}
if (isActive && CheckGuardOrCounter()){
npc.DisableHitAnimFor(0.100000);
Complete(true);
return false;
}
if (damageData.hitReactionAnimRequested){
return true;
} else {
return false;
}
} else if (eventName == 'CriticalState'){
if (isActive){

Complete(true);
} else {
npc.DisableHitAnimFor(0.100000);
}
}
return false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == 'RotateEventStart'){
GetNPC().SetRotationAdjustmentRotateTo(rotateNode, /* NO
P */);
return true;
} else if (eventName == 'RotateAwayEventStart'){
GetNPC().SetRotationAdjustmentRotateTo(rotateNode, 180.0
00000);
return true;
} else if (eventName == 'WantsToPerformDodge'){
Complete(true);
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
public function GetRotateNode() : CNode{
if (lastAttacker){
return lastAttacker;
}
return GetCombatTarget();
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var owner : CNewNPC;
var player : CR4Player;
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
player = thePlayer;
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
public function InitializeReactionDataStorage(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
import abstract class SBehaviorGraphTrackInfo{
}
import abstract class SBoneTransform{
}
import abstract class SGraphLayer{
}

import abstract class TextureGroup{


}
import abstract class CTextureArrayEntry{
}
class BTTaskUpdateLookatTarget extends IBehTreeTask{
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public var useCombatTarget : Bool;
public var useCustomTarget : Bool;
public var headBoneName : CName;
public var usePrediction : Bool;
public var addZOffsetValue : Bool;
protected var lookatTarget : CNode;
protected var lookatActor : CActor;
protected var targetBoneIndex : Int32;
public function OnActivate() : EBTNodeStatus{
if (useCombatTarget){
lookatTarget = GetCombatTarget();
} else {
lookatTarget = GetActionTarget();
}
lookatActor = (CActor)lookatTarget;
if (lookatActor){
targetBoneIndex = lookatActor.GetBoneIndex('torso3');
if (targetBoneIndex == -1){
targetBoneIndex = lookatActor.GetBoneIndex('head
');
}
} else {
targetBoneIndex = -1;
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var targetPos : Vector;
var heading : Float;
var targetIsActor : Bool;
var npc : CActor;
if (!lookatTarget && !useCustomTarget){
return 0;
}
if ((CActor)lookatTarget){
targetIsActor = true;
}
while (true){
if (!npc){
npc = GetActor();
}
if (useCustomTarget){
GetCustomTarget(targetPos, heading);
if (addZOffsetValue){
targetPos.Z += 1;
}
} else if (targetBoneIndex != -1){
targetPos = MatrixGetTranslation(lookatActor.Get
BoneWorldMatrixByIndex(targetBoneIndex));

} else {
targetPos = lookatTarget.GetWorldPosition();
if (addZOffsetValue && targetIsActor){
targetPos.Z += 1.500000;
}
}
if (usePrediction && lookatActor){
targetPos = PredictPosition(lookatActor, targetP
os);
}
GetActor().UpdateLookAtVariables(1.000000, targetPos);
SleepOneFrame();
}
return 0;
/* NOP */;
}
public function PredictPosition(target : CActor, targetPos : Vector) : V
ector{
var myPos : Vector;
var finalPos : Vector;
var distanceToTarget : Float;
var targetMoveHeadingVect : Vector;
var targetSpeed : Float;
var proj : W3AdvancedProjectile;
var time : Float;
if (!target){
return targetPos;
}
myPos = GetActor().GetWorldPosition();
targetMoveHeadingVect = target.GetMovingAgentComponent().GetVelo
city();
targetSpeed = VecLength(targetMoveHeadingVect);
if (targetSpeed <= 0){
return targetPos;
}
distanceToTarget = VecDistance(myPos, targetPos);
proj = combatDataStorage.GetProjectile();
if (proj){
time = distanceToTarget / proj.projSpeed;
} else {
time = distanceToTarget / 40;
}
finalPos = targetPos + VecNormalize(targetMoveHeadingVect) * tim
e * targetSpeed;
return finalPos;
/* NOP */;
}
public function Initialize(){
if (usePrediction){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
import abstract class ISlot{
}

import struct CCurve{


import public function GetValue(time : Float) : Float;
import public function GetDuration() : Float;
}
import abstract class SPropertyAnimation{
}
import abstract class SMultiCurve{
}
class BTTaskManageObjectsInPhantomComponentSlots extends IBehTreeTask{
public var checkDistanceOnIsAvailable : Bool;
public var createEntityResourceNames : array<CName>;
public var attachSlotNames : array<CName>;
public var activateOnAnimEvent : CName;
public var drawEntitiesFromArea : Bool;
public var drawEntitiesRadius : Float;
public var drawEntitiesTag : CName;
public var drawSpeedLimit : Float;
public var snapDrawnEntityToGround : Bool;
public var shootAtLookatTarget : Bool;
public var destroyEntityOnAnimEvent : CName;
public var shootEntityOnAnimEvent : CName;
public var shootAllDrawnEntitiesAtOnce : Bool;
public var disperseObjectsOnAnimEvent : CName;
public var playEffectOnEntityPull : CName;
public var playEffectOnEntityAttach : CName;
public var playEffectOnDestroyEntity : CName;
public var playEffectOnDisperseObjects : CName;
private var m_Npc : CNewNPC;
private var m_CreateEntityTemplates : array<CEntityTemplate>;
private var m_EntitiesDrawnFromArea : array<CEntity>;
private var m_CurveComponents : array<CComponent>;
private var m_activateEventReceived : Bool;
private var m_destroyEntityEventReceived : Bool;
private var m_disperceObjectsEventReceived : Bool;
private var m_shootEntityEventReceived : Bool;
private var m_entityResourceNameFilled : Bool;
private var m_prevDesiredAffectedEntityPos : Vector;
private var m_prevSpeed : Float;
private var m_ClosestSlot : CName;
private var m_attachEntitiesArray : array<CEntity>;
private var m_collisionGroups : array<CName>;
private var m_drawnEntities : Int32;
private var m_checkedForEntities : Bool;
public function Initialize(){
var i : Int32;
m_Npc = GetNPC();
if (createEntityResourceNames.Size() > 0){
i = 0;
while (i < createEntityResourceNames.Size()){
if (IsNameValid(createEntityResourceNames[i])){
m_entityResourceNameFilled = true;
m_CreateEntityTemplates.PushBack((CEntit
yTemplate)LoadResource(createEntityResourceNames[i], /* NOP */));
}
i += 1;
}
}

m_collisionGroups.PushBack('Ragdoll');
m_collisionGroups.PushBack('Terrain');
m_collisionGroups.PushBack('Static');
m_collisionGroups.PushBack('Water');
/* NOP */;
}
public function IsAvailable() : Bool{
var entityToActorDist : Float;
var i : Int32;
if (!m_checkedForEntities && drawEntitiesFromArea && IsNameValid
(drawEntitiesTag)){
theGame.GetEntitiesByTag(drawEntitiesTag, m_EntitiesDraw
nFromArea);
m_checkedForEntities = true;
}
if (checkDistanceOnIsAvailable){
if (m_EntitiesDrawnFromArea.Size() < 1){
return false;
}
i = 0;
while (i < m_EntitiesDrawnFromArea.Size()){
entityToActorDist = VecDistance(m_EntitiesDrawnF
romArea[i].GetWorldPosition(), m_Npc.GetWorldPosition());
if (entityToActorDist < drawEntitiesRadius){
return true;
}
i += 1;
}
return false;
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
m_CurveComponents = m_Npc.GetComponentsByClassName('W3ApplyEffec
tPhantomComponent');
if (!checkDistanceOnIsAvailable){
if (m_EntitiesDrawnFromArea.Size() < 1){
return 1;
}
}
if (m_CurveComponents.Size() < 1){
/* NOP */;
return 1;
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var l_lastLocalTime : Float;
var l_deltaTime : Float;
while (true){
l_lastLocalTime = GetLocalTime();
SleepOneFrame();
l_deltaTime = GetLocalTime() - l_lastLocalTime;
if (!IsNameValid(activateOnAnimEvent)){
AttachObjects(l_deltaTime);
} else if (m_activateEventReceived){
AttachObjects(l_deltaTime);
if (m_destroyEntityEventReceived || m_disperceOb

jectsEventReceived || m_shootEntityEventReceived){
m_activateEventReceived = false;
}
}
if (m_shootEntityEventReceived && m_drawnEntities > 0){
DetachEntity(m_shootEntityEventReceived);
if (!shootAllDrawnEntitiesAtOnce){
m_shootEntityEventReceived = false;
} else if (m_drawnEntities == 0){
m_shootEntityEventReceived = false;
}
} else if (m_destroyEntityEventReceived){
DetachEntity(false);
m_destroyEntityEventReceived = false;
} else if (m_disperceObjectsEventReceived){
DisperseEntities(/* NOP */);
m_disperceObjectsEventReceived = false;
}
}
return 2;
/* NOP */;
}
public function OnDeactivate(){
DisperseEntities(true);
m_activateEventReceived = false;
m_shootEntityEventReceived = false;
m_disperceObjectsEventReceived = false;
/* NOP */;
}
private latent function AttachObjects(_DeltaTime : Float){
var i : Int32;
var componentPos : Vector;
var componentRot : EulerAngles;
var entityRot : EulerAngles;
var affectedEntityRot : EulerAngles;
var slotPos : Vector;
var slotHeading : Float;
var createdEntity : CEntity;
var actorPos : Vector;
var affectedEntityPos : Vector;
var desiredAffectedEntityPos : Vector;
var normal : Vector;
var entityToActorDist : Float;
var entityToComponentDist : Float;
var speed : Float;
actorPos = m_Npc.GetWorldPosition();
speed = m_prevSpeed + drawSpeedLimit * _DeltaTime;
if (speed > drawSpeedLimit){
speed = drawSpeedLimit;
}
m_prevSpeed = speed;
if (m_EntitiesDrawnFromArea.Size() > 0){
i = 0;
while (i < m_EntitiesDrawnFromArea.Size()){
if (m_attachEntitiesArray.Size() < m_CurveCompon
ents.Size()){
entityToActorDist = VecDistance(m_Entiti
esDrawnFromArea[i].GetWorldPosition(), m_Npc.GetWorldPosition());
if (entityToActorDist < drawEntitiesRadi
us){

m_drawnEntities += 1;
m_attachEntitiesArray.PushBack(m
_EntitiesDrawnFromArea[i]);
if (IsNameValid(playEffectOnEnti
tyPull)){
m_EntitiesDrawnFromArea[
i].PlayEffect(playEffectOnEntityPull, /* NOP */);
}
}
}
i += 1;
}
}
i = 0;
while (i < m_CurveComponents.Size()){
if (!(W3ApplyEffectPhantomComponent)m_CurveComponents[i]
.IsObjectAttached()){
componentPos = m_CurveComponents[i].GetWorldPosi
tion();
componentRot = m_CurveComponents[i].GetWorldRota
tion();
if (m_entityResourceNameFilled && i <= createEnt
ityResourceNames.Size()){
createdEntity = CreateEntity(i, componen
tPos, componentRot);
(W3ApplyEffectPhantomComponent)m_CurveCo
mponents[i].GetClosestFreeSlotInfo(attachSlotNames, createdEntity.GetWorldPositi
on(), createdEntity.GetHeading(), m_ClosestSlot, slotPos, slotHeading);
if (createdEntity.CreateAttachment(m_Npc
, m_ClosestSlot, /* NOP */, /* NOP */)){
if (IsNameValid(playEffectOnEnti
tyAttach)){
m_Npc.PlayEffect(playEff
ectOnEntityAttach, /* NOP */);
}
(W3ApplyEffectPhantomComponent)m
_CurveComponents[i].SetObjectAttached(true);
}
} else if (m_attachEntitiesArray.Size() > 0){
affectedEntityPos = m_attachEntitiesArra
y[i].GetWorldPosition();
entityToComponentDist = VecDistance(affe
ctedEntityPos, componentPos);
if (entityToComponentDist > 0.200000){
desiredAffectedEntityPos = affec
tedEntityPos + VecNormalize(componentPos - affectedEntityPos) * speed * _DeltaTi
me;
m_prevDesiredAffectedEntityPos =
desiredAffectedEntityPos;
if (snapDrawnEntityToGround){
theGame.GetWorld().Stati
cTrace(desiredAffectedEntityPos + Vector(0, 0, 3), desiredAffectedEntityPos - Ve
ctor(0, 0, 3), desiredAffectedEntityPos, normal, /* NOP */);
}
entityRot = m_attachEntitiesArra
y[i].GetWorldRotation();
m_attachEntitiesArray[i].Telepor
tWithRotation(desiredAffectedEntityPos, entityRot);
} else {
affectedEntityRot = VecToRotatio

n(affectedEntityPos);
desiredAffectedEntityPos = Inter
pTo_V(affectedEntityPos, componentPos, _DeltaTime, speed);
entityRot = m_attachEntitiesArra
y[i].GetWorldRotation();
entityRot.Pitch += 4;
entityRot.Yaw += 4;
if (snapDrawnEntityToGround){
theGame.GetWorld().Stati
cTrace(desiredAffectedEntityPos + Vector(0, 0, 3), desiredAffectedEntityPos - Ve
ctor(0, 0, 3), desiredAffectedEntityPos, normal, /* NOP */);
}
m_attachEntitiesArray[i].Telepor
tWithRotation(InterpTo_V(desiredAffectedEntityPos, affectedEntityPos, 0.050000,
0.500000), entityRot);
}
}
}
i += 1;
}
/* NOP */;
}
private function DetachEntity(shootProjectile : Bool){
var i : Int32;
var attachedEntity : CEntity;
var target : CEntity;
var entityPos : Vector;
var targetPos : Vector;
var entityToTargetDist : Float;
var entityToTargetDistArray : array<Float>;
var traceEffect : Vector;
var normal : Vector;
i = 0;
while (i < m_CurveComponents.Size()){
target = GetCombatTarget();
targetPos = target.GetWorldPosition();
entityPos = m_attachEntitiesArray[i].GetWorldPosition();
entityToTargetDist = VecDistance(entityPos, targetPos);
entityToTargetDistArray.PushBack(entityToTargetDist);
i += 1;
}
i = ArrayFindMinF(entityToTargetDistArray);
entityToTargetDistArray.Clear();
attachedEntity = m_attachEntitiesArray[i];
if (shootProjectile){
entityPos = attachedEntity.GetWorldPosition();
entityPos.Z += 0.750000;
if (GetCombatTarget()){
targetPos.Z += (CMovingPhysicalAgentComponent)(C
Actor)target.GetMovingAgentComponent().GetCapsuleHeight() * 0.750000;
}
if (theGame.GetWorld().StaticTrace(entityPos, targetPos,
traceEffect, normal, /* NOP */)){
return;
}
}
attachedEntity.BreakAttachment();
m_attachEntitiesArray.Erase(i);
m_drawnEntities -= 1;
if ((W3ApplyEffectPhantomComponent)m_CurveComponents[i].IsObject

Attached()){
(W3ApplyEffectPhantomComponent)m_CurveComponents[i].SetO
bjectAttached(false);
}
if (m_destroyEntityEventReceived){
if (IsNameValid(playEffectOnDestroyEntity)){
m_Npc.PlayEffect(playEffectOnDestroyEntity, /* N
OP */);
}
attachedEntity.Destroy();
} else if (m_shootEntityEventReceived){
ShootProjectile(attachedEntity, /* NOP */, /* NOP */);
}
/* NOP */;
}
private function DisperseEntities(deactivate : Bool){
var i : Int32;
var attachedEntity : CEntity;
var entityPos : Vector;
var targetPos : Vector;
var entityToTargetDist : Float;
var entityToTargetDistArray : array<Float>;
i = 0;
while (i < m_CurveComponents.Size()){
if ((W3ApplyEffectPhantomComponent)m_CurveComponents[i].
IsObjectAttached()){
attachedEntity = m_attachEntitiesArray[i];
attachedEntity.BreakAttachment();
(W3ApplyEffectPhantomComponent)m_CurveComponents
[i].SetObjectAttached(false);
m_drawnEntities -= 1;
}
i += 1;
}
if (IsNameValid(playEffectOnDisperseObjects)){
m_Npc.PlayEffect(playEffectOnDisperseObjects, /* NOP */)
;
}
i = 0;
while (i < m_attachEntitiesArray.Size()){
ShootProjectile(m_attachEntitiesArray[i], true, /* NOP *
/);
i += 1;
}
m_disperceObjectsEventReceived = false;
m_attachEntitiesArray.Clear();
/* NOP */;
}
public function ShootProjectile(projectile : CEntity, allDirections : Bo
ol, deactivate : Bool){
var target : CActor;
var npcPos : Vector;
var combatTargetPos : Vector;
var targetPos : Vector;
var proj : W3AdvancedProjectile;
var range : Float;
var distToTarget : Float;
var l_heightFromTarget : Float;
var l_3DdistanceToTarget : Float;
var l_projectileFlightTime : Float;

var l_npcToProjectileAngle : Float;


target = GetCombatTarget();
combatTargetPos = GetCombatTarget().GetWorldPosition();
proj = (W3AdvancedProjectile)projectile;
distToTarget = VecDistance2D(combatTargetPos, m_Npc.GetWorldPosi
tion());
if (deactivate){
range = 1.500000;
} else {
range = 100;
}
if (deactivate){
targetPos = projectile.GetWorldPosition() + projectile.G
etHeadingVector() * range;
}
if (allDirections){
l_npcToProjectileAngle = NodeToNodeAngleDistance(project
ile, m_Npc);
targetPos = projectile.GetWorldPosition() + VecFromHeadi
ng(l_npcToProjectileAngle) * range;
} else if (shootAtLookatTarget){
targetPos = m_Npc.GetBehaviorVectorVariable('lookAtTarge
t');
} else {
targetPos = projectile.GetWorldPosition() + m_Npc.GetHea
dingVector() * distToTarget;
}
if (!deactivate){
targetPos.Z = combatTargetPos.Z + 1.500000;
}
proj.Init(m_Npc);
proj.ShootProjectileAtPosition(proj.projAngle, proj.projSpeed, t
argetPos, range, m_collisionGroups);
l_3DdistanceToTarget = VecDistance(m_Npc.GetWorldPosition(), com
batTargetPos);
l_projectileFlightTime = l_3DdistanceToTarget / drawSpeedLimit;
target.SignalGameplayEventParamFloat('Time2DodgeProjectile', l_p
rojectileFlightTime);
/* NOP */;
}
public function CreateEntity(i : Int32, _SpawnPos : Vector, _Rotation :
EulerAngles) : CEntity{
var l_spawnedEntity : CEntity;
var l_summonedEntityComponent : W3SummonedEntityComponent;
var l_normal : Vector;
var l_entityToSpawn : CEntityTemplate;
var l_randValue : Int32;
theGame.GetWorld().StaticTrace(_SpawnPos + Vector(0, 0, 5), _Spa
wnPos - Vector(0, 0, 5), _SpawnPos, l_normal, /* NOP */);
l_entityToSpawn = m_CreateEntityTemplates[i];
l_spawnedEntity = theGame.CreateEntity(l_entityToSpawn, _SpawnPo
s, _Rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
l_summonedEntityComponent = (W3SummonedEntityComponent)l_spawned
Entity.GetComponentByClassName('W3SummonedEntityComponent');
if (l_summonedEntityComponent){
l_summonedEntityComponent.Init(m_Npc);
}
return l_spawnedEntity;
/* NOP */;
}

public function OnAnimEvent(animEventName : CName, animEventType : EAnim


ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (IsNameValid(activateOnAnimEvent) && animEventName == activat
eOnAnimEvent){
m_activateEventReceived = true;
}
if (IsNameValid(shootEntityOnAnimEvent) && animEventName == shoo
tEntityOnAnimEvent){
m_shootEntityEventReceived = true;
}
if (IsNameValid(destroyEntityOnAnimEvent) && animEventName == de
stroyEntityOnAnimEvent){
m_destroyEntityEventReceived = true;
}
if (IsNameValid(disperseObjectsOnAnimEvent) && animEventName ==
disperseObjectsOnAnimEvent){
m_disperceObjectsEventReceived = true;
}
return false;
/* NOP */;
}
}
import abstract class SMultiCurvePosition{
}
class W3ApplyEffectPhantomComponent extends CPhantomComponent{
public editable var effectToApply : EEffectType;
public editable var effectDuration : Float;
public editable var requiredAbilities : array<CName>;
public editable var onlyWhenAlive : Bool;
public editable var onlyToHostiles : Bool;
public editable var onlyToTag : CName;
public editable var ignoreIfHasEffect : Bool;
public editable var useCustomValue : Bool;
public editable var customValue : SAbilityAttributeValue;
public editable var forcedDamage : Float;
public editable var minRelativeSpeed : Float;
public editable var decreasePlayerDmgBy : Float;
public var objectAttached : Bool;
public function OnCollisionEnter(object : CObject, physicalActorindex :
Int32, shapeIndex : Int32) : Bool{
var i : Int32;
var l_ability : CName;
var l_actor : CActor;
var l_target : CActor;
var l_entityTarget : CEntity;
var l_source : CGameplayEntity;
var l_params : SCustomEffectParams;
var l_action : W3DamageAction;
var l_animatedComponent : CAnimatedComponent;
var l_speed : Float;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
l_actor = (CActor)GetEntity();
if (l_actor && onlyWhenAlive && !l_actor.IsAlive()){
return false;

}
if (requiredAbilities.Size() > 0){
if (!l_actor){
return false;
}
i = 0;
while (i < requiredAbilities.Size()){
l_ability = requiredAbilities[0];
if (!l_actor.HasAbility(l_ability) || l_actor.Is
AbilityBlocked(l_ability)){
return false;
}
i += 1;
}
}
l_target = (CActor)component.GetEntity();
l_entityTarget = component.GetEntity();
if (!l_target){
return false;
}
if (l_target == l_actor){
return false;
}
if (onlyToHostiles && l_actor && l_actor.GetAttitude(l_target) !
= 2){
return false;
}
if (IsNameValid(onlyToTag) && !l_target.HasTag(onlyToTag)){
return false;
}
if (ignoreIfHasEffect && l_target.HasBuff(effectToApply)){
return false;
}
if (minRelativeSpeed > 0){
l_animatedComponent = (CAnimatedComponent)GetEntity().Ge
tComponentByClassName('CAnimatedComponent');
l_speed = l_animatedComponent.GetMoveSpeedRel();
if (l_speed < minRelativeSpeed){
return false;
}
}
l_source = (CGameplayEntity)GetEntity();
l_params.effectType = effectToApply;
l_params.creator = l_source;
l_params.sourceName = l_actor.GetName();
l_params.duration = effectDuration;
if (useCustomValue){
l_params.effectValue = customValue;
}
l_target.AddEffectCustom(l_params);
if (forcedDamage > 0){
l_action = new W3DamageAction in this;
l_action.Initialize(l_source, l_target, NULL, l_source.G
etName(), 0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
l_action.SetCanPlayHitParticle(false);
if (l_target == thePlayer){
forcedDamage = forcedDamage - forcedDamage * dec
reasePlayerDmgBy;
}

l_action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, fo
rcedDamage);
l_action.SetSuppressHitSounds(true);
theGame.damageMgr.ProcessAction(l_action);
delete l_action;
}
/* NOP */;
}
public function GetClosestFreeSlotInfo(attachComponents : array<CName>,
_objectPosition : Vector, _objectHeading : Float, _ClosestSlotName : CName, _Pos
ition : Vector, _Heading : Float) : Bool{
var i : Int32;
var l_slotMatrix : Matrix;
var l_slotPos : Vector;
var l_closestDistance : Float;
var l_closestMatrix : Matrix;
var l_closestPos : Vector;
var l_distance : Float;
var l_npcPos : Vector;
var l_slotRotation : EulerAngles;
var l_slotForward : Vector;
var l_slotName : CName;
var l_angleDistance : Float;
if (attachComponents.Size() == 0){
return false;
}
l_closestDistance = 999;
i = 0;
while (i < attachComponents.Size()){
l_slotName = attachComponents[i];
GetEntity().CalcEntitySlotMatrix(l_slotName, l_slotMatri
x);
l_slotPos = MatrixGetTranslation(l_slotMatrix);
l_distance = VecDistance(_objectPosition, l_slotPos);
if (l_distance < l_closestDistance){
l_closestDistance = l_distance;
l_closestPos = l_slotPos;
l_closestMatrix = l_slotMatrix;
_ClosestSlotName = l_slotName;
}
i += 1;
}
l_slotRotation = MatrixGetRotation(l_closestMatrix);
l_slotForward = RotForward(l_slotRotation);
_Heading = VecHeading(l_slotForward);
_Position = l_closestPos;
l_angleDistance = AngleDistance(_objectHeading, _Heading);
if (AbsF(l_angleDistance) > 50){
return false;
}
return true;
/* NOP */;
}
public function SetObjectAttached(b : Bool){
objectAttached = b;
/* NOP */;
}
public function IsObjectAttached() : Bool{
return objectAttached;
/* NOP */;

}
}
import abstract class SCurveEaseParam{
}
import abstract class CubeFace{
}
import abstract class CWorldShadowConfig{
}
import abstract class SGlobalSpeedTreeParameters{
}
import abstract class SWorldSkyboxParameters{
}
class CBTTaskManageRepulseProjectileEvents extends IBehTreeTask{
private var performRepulseProjectileDelay : Float;
private var ownerPosition : Vector;
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (eventName == 'Time2DodgeProjectile'){
ownerPosition = npc.GetWorldPosition();
performRepulseProjectileDelay = GetEventParamFloat(-1);
performRepulseProjectileDelay = ClampF(performRepulsePro
jectileDelay - 0.400000, 0, 99);
npc.AddTimer('DelayRepulseProjectileEventTimer', perform
RepulseProjectileDelay, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
if (eventName == 'Time2DodgeBomb'){
ownerPosition = npc.GetWorldPosition();
performRepulseProjectileDelay = GetEventParamFloat(-1);
performRepulseProjectileDelay = ClampF(performRepulsePro
jectileDelay - 0.400000, 0, 99);
npc.AddTimer('DelayRepulseBombEventTimer', performRepuls
eProjectileDelay, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
return false;
/* NOP */;
}
}
import abstract class SWorldRenderSettings{
}
import abstract class SWorldMotionBlurSettings{
}
import abstract class SWorldEnvironmentParameters{
}
import abstract class SLensFlareGroupsParameters{
}
import abstract class CSectorData{

}
import abstract class IFormationLogic{
}
import abstract class CCookedMeshEntity{
}
import abstract class CDynamicLayer{
}
import struct CEnvironmentDefinition{
}
import abstract class CEnvAmbientProbesGenParameters{
}
import abstract class IFormationPatternNode{
}
import abstract class CEnvReflectionProbesGenParameters{
}
import abstract class CEnvCameraLightParameters{
}
import abstract class CEnvCameraLightsSetupParameters{
}
import abstract class CEnvGlobalSkyParameters{
}
import abstract class SFormationConstraintDefinition{
}
import abstract class CGlobalLightingTrajectory{
}
import abstract class SBokehDofParams{
}
import abstract class CEnvToneMappingParameters{
}
import abstract class CEnvToneMappingCurveParameters{
}
import abstract class CEnvBloomNewParameters{
}
import abstract class CFormationSlotDefinition{
}
import abstract class CEnvDistanceRangeParameters{
}
import abstract class CEnvColorModTransparencyParameters{
}
import abstract class CEnvShadowsParameters{

}
class CBTTaskSearchForThrowable extends IBehTreeTask{
public var range : Float;
public var tag : CName;
public var selectedObject : CNode;
public var physicalComponent : CComponent;
public var activate : Bool;
public var findTime : Float;
public var throwData : CAIStorageHandler;
public function IsAvailable() : Bool{
return activate;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (GetActionTarget() != selectedObject){
SetActionTarget(selectedObject);
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
findTime = 0.000000;
activate = false;
physicalComponent = NULL;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var component : CComponent;
npc = GetNPC();
if (eventName == 'CollisionWithStatic' && !activate){
component = (CComponent)GetEventParamObject();
if (component.HasDynamicPhysic()){
activate = true;
findTime = GetLocalTime();
physicalComponent = component;
selectedObject = component.GetEntity();
GetNPC().SignalGameplayEventParamObject('Throwab
le', component);
}
return true;
}
return false;
/* NOP */;
}
}
import abstract class CEnvGlobalFogParameters{
}
import abstract class CEnvDepthOfFieldParameters{
}
import abstract class CEnvNVSSAOParameters{
}
class BTTaskSpawnEntitiesAttack extends IBehTreeTask{
public var resourceName : CName;
public var eventName : CName;

public
public
public
public
public
public
public
public
public
public
public
public
public

var numberOfEntities : Int32;


var timeBetweenSpawn : Float;
var minDistFromTarget : Float;
var maxDistFromTarget : Float;
var minDistFromEachOther : Float;
var initialDelay : Float;
var behVariableToSetOnEnd : CName;
var shouldStart : Bool;
var lastSpawnTimestamp : Float;
var spawnTimeout : Float;
var entityTemplate : CEntityTemplate;
var usedPos : array<Vector>;
function OnActivate() : EBTNodeStatus{
GetNPC().SetBehaviorVariable(behVariableToSetOnEnd, 0.000000, /*

NOP */);
return 0;
/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetBehaviorVariable(behVariableToSetOnEnd, 1.000000, /*
NOP */);
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == eventName){
shouldStart = true;
return true;
}
return false;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var pos : Vector;
var i : Int32;
entityTemplate = (CEntityTemplate)LoadResourceAsync(resourceName
, /* NOP */);
while (!shouldStart){
SleepOneFrame();
}
usedPos.Clear();
spawnTimeout = timeBetweenSpawn * 3;
Sleep(initialDelay);
i = 0;
while (i < numberOfEntities){
if (VecDistance2D(GetNPC().GetWorldPosition(), GetCombat
Target().GetWorldPosition()) < 7.500000){
break;
}
pos = FindPosition();
while (!IsPositionValid(pos)){
SleepOneFrame();
pos = FindPosition();
}
Spawn(pos);
usedPos.PushBack(pos);
lastSpawnTimestamp = theGame.GetEngineTimeAsSeconds();
Sleep(timeBetweenSpawn);
i += 1;
}

GetNPC().SetBehaviorVariable(behVariableToSetOnEnd, 1.000000, /*
NOP */);
return 0;
/* NOP */;
}
public function Spawn(position : Vector){
var npc : CNewNPC;
var entity : CEntity;
var randYaw : Float;
var rotation : EulerAngles;
npc = GetNPC();
if (entityTemplate){
randYaw = RandRangeF(180.000000, -180.000000);
rotation.Yaw = randYaw;
entity = theGame.CreateEntity(entityTemplate, position,
rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function FindPosition() : Vector{
var randVec : Vector;
var targetPos : Vector;
var outPos : Vector;
randVec = Vector(0.000000, 0.000000, 0.000000);
targetPos = GetCombatTarget().GetWorldPosition();
randVec = VecRingRand(minDistFromTarget, maxDistFromTarget);
outPos = targetPos + randVec;
return outPos;
/* NOP */;
}
protected function IsPositionValid(whereTo : Vector) : Bool{
var newPos : Vector;
var radius : Float;
var z : Float;
var i : Int32;
radius = 0.100000;
if (!theGame.GetWorld().NavigationFindSafeSpot(whereTo, radius,
radius * 3, newPos)){
if (theGame.GetWorld().NavigationComputeZ(whereTo, where
To.Z - 5.000000, whereTo.Z + 5.000000, z)){
whereTo.Z = z;
if (!theGame.GetWorld().NavigationFindSafeSpot(w
hereTo, radius, radius * 3, newPos)){
return false;
}
}
return false;
}
if (lastSpawnTimestamp + spawnTimeout > theGame.GetEngineTimeAsS
econds()){
i = 0;
while (i < usedPos.Size()){
if (VecDistance2D(newPos, usedPos[i]) < minDistF
romEachOther){
return false;
}
i += 1;
}
}
whereTo = newPos;

return true;
/* NOP */;
}
}
import abstract class CEnvMSSSAOParameters{
}
import abstract class CEnvRadialBlurParameters{
}
import abstract class CEnvDayCycleOverrideParameters{
}
import abstract class
import public
import public
e);
import public
oat);
}

IPerformableAction{
final function Trigger(parnt : CEntity);
final function TriggerArgNode(parnt : CEntity, node : CNod
final function TriggerArgFloat(parnt : CEntity, value : Fl

import abstract class CEnvBrightnessTintParameters{


}
import abstract class CEnvDisplaySettingsParams{
}
import abstract class CEnvSpeedTreeRandomColorParameters{
}
import abstract class CEnvSpeedTreeParameters{
}
class CBTTaskSetBoatAsActionTarget extends IBehTreeTask{
public function IsAvailable() : Bool{
FindBoat();
if (GetActionTarget()){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public function OnDeactivate(){
SetActionTarget(NULL);
/* NOP */;
}
public function FindBoat(){
var destructionComp : CBoatDestructionComponent;
if (GetCombatTarget() == thePlayer && thePlayer.IsSailing()){
SetActionTarget(thePlayer.GetUsedVehicle());
}
/* NOP */;
}
}

import abstract class CEnvGlobalLightParameters{


}
import abstract class CEnvParametricBalanceParameters{
}
import abstract class CEnvFinalColorBalanceParameters{
}
struct SEffectCachedDamage{
saved var dmgType : CName;
saved var attacker : EntityHandle;
saved var carrier : CBaseGameplayEffect;
saved var dmgVal : Float;
saved var dt : Float;
saved var dontShowHitParticle : Bool;
saved var powerStatType : ECharacterPowerStats;
saved var isEnvironment : Bool;
saved var sourceName : String;
}
import abstract class CEnvSharpenParameters{
}
class CBTTaskMagicMeleeAttack extends CBTTaskMagicAttack{
public var resourceName : CName;
private var effectEntityTemplate : CEntityTemplate;
private var dealDmgOnDeactivate : Bool;
private var couldntLoadResource : Bool;
public function IsAvailable() : Bool{
return !couldntLoadResource;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
if (!effectEntityTemplate){
effectEntityTemplate = (CEntityTemplate)LoadResourceAsyn
c(resourceName, /* NOP */);
}
if (!effectEntityTemplate){
couldntLoadResource = true;
return 1;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (dealDmgOnDeactivate){
GetActor().OnCollisionFromItem(GetCombatTarget(), /* NOP
*/);
dealDmgOnDeactivate = false;
}
super.OnDeactivate();
/* NOP */;
}
public function PerformMagicAttack(){
dealDmgOnDeactivate = false;
GetActor().OnCollisionFromItem(GetCombatTarget(), /* NOP */);
/* NOP */;
}
public function NewCurrentAttackData(attackData : CPreAttackEventData){

SpawnEffect(attackData);
dealDmgOnDeactivate = true;
/* NOP */;
}
public function SpawnEffect(attackData : CPreAttackEventData) : Bool{
var effectName : CName;
var entity : CEntity;
var pos : Vector;
var rot : EulerAngles;
switch(attackData.swingType){
case 0:
switch(attackData.swingDir){
case 2:
effectName = 'left';
break;
case 3:
effectName = 'right';
break;
default:
break;
}
break;
case 1:
switch(attackData.swingDir){
case 0:
effectName = 'down';
break;
case 1:
effectName = 'up';
break;
default:
break;
}
break;
case 2:
switch(attackData.swingDir){
case 2:
effectName = 'diagonal_up_left';
break;
case 3:
effectName = 'diagonal_up_right';
break;
default:
break;
}
break;
case 3:
switch(attackData.swingDir){
case 2:
effectName = 'diagonal_down_left';
break;
case 3:
effectName = 'diagonal_down_right';
break;
default:
break;
}
break;
default:
effectName = 'None';

}
if (GetActor().HasTag('Philippa')){
effectName = 'cast_line';
}
if (effectName){
GetEffectPositionAndRotation(pos, rot);
entity = theGame.CreateEntity(effectEntityTemplate, pos,
rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (entity){
entity.PlayEffect(effectName, /* NOP */);
entity.DestroyAfter(5.000000);
return true;
}
}
return false;
/* NOP */;
}
public function GetEffectPositionAndRotation(pos : Vector, rot : EulerAn
gles){
var target : CActor;
var owner : CActor;
target = GetCombatTarget();
owner = GetNPC();
pos = target.GetWorldPosition();
pos.Z += 0.700000;
rot = owner.GetWorldRotation();
/* NOP */;
}
}
import abstract class IPotentialField{
}
import abstract class CEnvWaterParameters{
}
import abstract class CEnvSunAndMoonParameters{
}
import abstract class CEnvGameplayEffectsParameters{
}
class CBTTaskSpawnAnim extends IBehTreeTask{
public var spawnCondition : ESpawnCondition;
public var delayMain : Float;
public var time : Float;
public var distToActors : Float;
public var manageGravity : Bool;
public var raiseEventName : CName;
public var fxName : CName;
public var initialAppearance : CName;
public var setAppearanceTo : CName;
public var playFXOnAnimEvent : Bool;
public var animEventNameActivator : CName;
public var monitorGroundContact : Bool;
public var dealDamageOnAnimEvent : CName;
public var tagToBeDamaged : CName;
private var spawned : Bool;
private var canPlayHitAnim : Bool;
private var animEventOccured : Bool;

public function IsAvailable() : Bool{


if (GetNPC().WasInCutscene()){
return false;
}
if (GetNPC().GetBehaviorVariable('Spawn', /* NOP */) == 1){
return false;
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
canPlayHitAnim = npc.CanPlayHitAnim();
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
super.SelectSpawnAnim();
while (npc.GetBehaviorVariable('ForcedSpawnAnim', /* NOP */) > 0
|| npc.GetBehaviorVariable('SpawnAnim', /* NOP */) != 0.000000 && !spawned){
if (spawnCondition == 1){
if (VecDistance2D(thePlayer.GetWorldPosition(),
npc.GetWorldPosition()) < distToActors){
ActivateSpawn();
}
} else {
ActivateSpawn();
}
Sleep(0.100000);
}
return 2;
/* NOP */;
}
private final latent function SelectSpawnAnim(){
var npc : CNewNPC;
var pos : Vector;
var componentArray : array<CComponent>;
var waterLevel : Float;
var waterDepth : Float;
var navDataZ : Float;
var distFromNavZ : Float;
var security : Int32;
npc = GetNPC();
npc.SetCanPlayHitAnim(false);
if (initialAppearance){
npc.SetAppearance(initialAppearance);
}
pos = npc.GetWorldPosition();
waterDepth = theGame.GetWorld().GetWaterDepth(pos, /* NOP */);
if (waterDepth > 1000){
waterDepth = 0;
}
while (!theGame.GetWorld().NavigationComputeZ(pos, pos.Z - 100,
pos.Z + 3, navDataZ) && waterDepth <= 0 && security < 120){
SleepOneFrame();
security += 1;
}

distFromNavZ = pos.Z - navDataZ;


if (security >= 120){
}
waterLevel = theGame.GetWorld().GetWaterLevel(pos, /* NOP */);
if (waterLevel > pos.Z + 2){
npc.SetBehaviorVariable('SpawnAnim', 3, /* NOP */);
npc.ChangeStance(6);
} else if (distFromNavZ > 1 && npc.HasAbility('Flying') && !npc.
IsAbilityBlocked('Flying')){
npc.SetBehaviorVariable('SpawnAnim', 2, /* NOP */);
npc.ChangeStance(5);
} else {
npc.SetBehaviorVariable('SpawnAnim', 1, /* NOP */);
if (npc.IsAbilityBlocked('Flying')){
/* NOP */;
}
}
if (raiseEventName){
npc.RaiseForceEvent(raiseEventName);
}
/* NOP */;
}
public latent function ActivateSpawn(){
var npc : CNewNPC;
var InFlySwimSpawnAnim : Bool;
var waterLevel : Float;
var submergeDepth : Float;
var pos : Vector;
var navDataZ : Float;
var distFromNavZ : Float;
npc = GetNPC();
(CMovingPhysicalAgentComponent)npc.GetMovingAgentComponent().Set
AnimatedMovement(false);
submergeDepth = (CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().GetSubmergeDepth();
time = GetLocalTime();
pos = npc.GetWorldPosition();
waterLevel = theGame.GetWorld().GetWaterLevel(pos, /* NOP */);
if (manageGravity && npc.GetBehaviorVariable('SpawnAnim', /* NOP
*/) == 1.000000){
if (waterLevel > pos.Z + 2){
npc.EnablePhysicalMovement(true);
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetSwimming(true);
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetDiving(true);
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetGravity(false);
} else {
npc.EnablePhysicalMovement(false);
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetGravity(true);
}
}
while (time + delayMain > GetLocalTime()){
Sleep(0.010000);
}
npc.SetBehaviorVariable('Spawn', 1.000000, /* NOP */);
InFlySwimSpawnAnim = npc.GetBehaviorVariable('SpawnAnim', /* NOP
*/) >= 2.000000;

if (InFlySwimSpawnAnim && manageGravity){


npc.EnablePhysicalMovement(true);
if (waterLevel > pos.Z + 2){
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetSwimming(true);
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetDiving(true);
} else {
(CMovingPhysicalAgentComponent)npc.GetMovingAgen
tComponent().SetAnimatedMovement(true);
}
(CMovingPhysicalAgentComponent)npc.GetMovingAgentCompone
nt().SetGravity(false);
}
while (monitorGroundContact){
pos = npc.GetWorldPosition();
theGame.GetWorld().NavigationComputeZ(pos, pos.Z - 1, po
s.Z + 1, navDataZ);
distFromNavZ = pos.Z - navDataZ;
if (distFromNavZ < 1){
npc.SetBehaviorVariable('GroundContact', 1.00000
0, /* NOP */);
monitorGroundContact = false;
}
SleepOneFrame();
}
npc.WaitForBehaviorNodeDeactivation('SpawnEnd', 15);
theGame.GetWorld().NavigationComputeZ(pos, pos.Z - 1, pos.Z + 1,
navDataZ);
distFromNavZ = pos.Z - navDataZ;
if (waterLevel < pos.Z + 2 && manageGravity && distFromNavZ > 1
&& npc.GetDistanceFromGround(2, /* NOP */) > 1 && npc.HasAbility('Flying') && !n
pc.IsAbilityBlocked('Flying')){
npc.EnablePhysicalMovement(true);
(CMovingPhysicalAgentComponent)npc.GetMovingAgentCompone
nt().SetAnimatedMovement(true);
npc.ChangeStance(5);
} else if (waterLevel < pos.Z + 2){
(CMovingPhysicalAgentComponent)npc.GetMovingAgentCompone
nt().SetAnimatedMovement(false);
npc.EnablePhysicalMovement(false);
npc.ChangeStance(0);
}
spawned = true;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
spawned = false;
animEventOccured = false;
npc.SetCanPlayHitAnim(canPlayHitAnim);
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (animEventName == animEventNameActivator){
animEventOccured = true;

if (setAppearanceTo){
npc.SetAppearance(setAppearanceTo);
}
if (IsNameValid(fxName) && playFXOnAnimEvent){
npc.PlayEffect(fxName, /* NOP */);
}
return true;
}
if (IsNameValid(dealDamageOnAnimEvent) && animEventName == dealD
amageOnAnimEvent){
DealDamage();
return true;
}
return false;
/* NOP */;
}
private function DealDamage(){
var action : W3DamageAction;
var npc : CNewNPC;
var victims : array<CActor>;
var i : Int32;
var inv : CInventoryComponent;
var weapons : array<SItemUniqueId>;
var damageNames : array<CName>;
npc = GetNPC();
victims = GetActorsInRange(npc, 3.000000, 5, tagToBeDamaged, tru
e);
action = new W3DamageAction in this;
inv = action.attacker.GetInventory();
weapons = inv.GetWeapons();
inv.GetWeaponDTNames(weapons[0], damageNames);
action.AddEffectInfo(9, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING, 25.0000
00);
action.SetCanPlayHitParticle(false);
if (victims.Size() > 0){
i = 0;
while (i < victims.Size()){
action.Initialize(npc, victims[i], this, npc.Get
Name(), 2, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
theGame.damageMgr.ProcessAction(action);
i += 1;
}
}
delete action;
/* NOP */;
}
}
struct SCurrentBuffFX{
var fx : CName;
var sources : array<String>;
}
import abstract class CEnvMotionBlurParameters{
}
class CBTTaskSpawnFXEntityDef extends IBehTreeTaskDefinition{

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable
editable

var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var

resourceName : CName;
attachToActor : Bool;
useNodeWithTag : Bool;
useOnlyOneFXEntity : Bool;
referenceNodeTag : CName;
useTargetInsteadOfOwner : Bool;
useCombatTarget : Bool;
attachToSlotName : CName;
spawnAfter : Float;
spawnOnAnimEvent : CName;
spawnOnGameplayEvent : CName;
fxNameOnSpawn : CName;
fxEntityTag : CName;
destroyEntityAfter : Float;
destroyEntityOnAnimEvent : CName;
destroyEntityOnDeact : Bool;
stopAllEffectsAfter : Float;
offsetVector : Vector;
additionalRotation : EulerAngles;
baseOffsetOnCasterRotation : Bool;

}
import abstract class CEnvWindParameters{
}
struct STemporarilyPausedEffect{
saved var buff : CBaseGameplayEffect;
saved var timeLeft : Float;
saved var source : CName;
saved var singleLock : Bool;
saved var useMaxDuration : Bool;
saved var duration : Float;
}
import abstract class CEnvDialogLightParameters{
}
import abstract class CEnvColorGroupsParameters{
}
struct SPausedAutoEffect{
saved var effectType : EEffectType;
saved var duration : Float;
saved var sourceName : CName;
saved var singleLock : Bool;
saved var useMaxDuration : Bool;
saved var timeLeft : Float;
}
import abstract class CEnvFlareColorParameters{
}
import abstract class CEnvFlareColorGroupsParameters{
}
import abstract class CAreaEnvironmentParams{
}
abstract class CBehTreeHLTaskCombatBase extends IBehTreeTask{
public var wasHit : Bool;

public function OnActivate() : EBTNodeStatus{


wasHit = false;
return 0;
/* NOP */;
}
}
import abstract class CGameEnvironmentParams{
}
abstract class IBehTreeHLTaskDefinition extends IBehTreeTaskDefinition{
}
import abstract class CWindParameters{
}
import abstract class CLayerInfo{
}
import abstract class CLayerGroup{
}
class W3Effect_Burning extends W3CriticalDOTEffect{
private var cachedMPAC : CMovingPhysicalAgentComponent;
public function CacheSettings(){
super.CacheSettings();
allowedHits[3] = false;
blockedActions.PushBack(4);
blockedActions.PushBack(10);
blockedActions.PushBack(13);
blockedActions.PushBack(34);
blockedActions.PushBack(25);
blockedActions.PushBack(29);
vibratePadLowFreq = 0.100000;
vibratePadHighFreq = 0.200000;
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
if (IsOnPlayer() && thePlayer.IsUsingVehicle()){
if (blockedActions.Contains(33)){
blockedActions.Remove(33);
}
} else {
blockedActions.PushBack(33);
}
super.OnEffectAdded(customParams);
cachedMPAC = (CMovingPhysicalAgentComponent)target.GetMovingAgen
tComponent();
if (isOnPlayer){
if (thePlayer.playerAiming.GetCurrentStateName() == 'Wai
ting'){
thePlayer.AddCustomOrientationTarget(2, 'Burning
Effect');
}
}
if (!target.IsAlive()){
timeLeft = 10;
}
/* NOP */;
}

public function OnEffectAddedPost() : Bool{


super.OnEffectAddedPost();
target.AddTag(theGame.params.TAG_OPEN_FIRE);
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
cachedMPAC = (CMovingPhysicalAgentComponent)target.GetMovingAgen
tComponent();
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
var player : CR4Player;
player = thePlayer;
if (isOnPlayer){
if (player.bLAxisReleased){
player.SetOrientationTargetCustomHeading(player.
GetHeading(), 'BurningEffect');
} else if (player.GetPlayerCombatStance() == 1){
player.SetOrientationTargetCustomHeading(VecHead
ing(player.moveTarget.GetWorldPosition() - player.GetWorldPosition()), 'BurningE
ffect');
} else {
player.SetOrientationTargetCustomHeading(VecHead
ing(theCamera.GetCameraDirection()), 'BurningEffect');
}
}
if (cachedMPAC && cachedMPAC.GetSubmergeDepth() <= -1){
target.RemoveAllBuffsOfType(effectType);
} else {
super.OnUpdate(deltaTime);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
if (isOnPlayer){
thePlayer.RemoveCustomOrientationTarget('BurningEffect')
;
}
target.RemoveTag(theGame.params.TAG_OPEN_FIRE);
super.OnEffectRemoved();
/* NOP */;
}
public function OnTargetDeath(){
timeLeft = 10;
/* NOP */;
}
public function OnTargetDeathAnimFinished(){
timeLeft = 10;
/* NOP */;
}
}
import abstract class SSkeletonBone{
}
import abstract class SSkeletonTrack{
}
import abstract class CSkeleton{

}
import abstract class CAnimationBufferUncompressed{
}
import abstract class CAnimationBufferBitwiseCompressed{
}
import abstract class SAnimationBufferBitwiseCompressedData{
}
class CBTCondHorseIsMounted extends IBehTreeTask{
public var waitForMountEnd : Bool;
public var waitForDismountEnd : Bool;
public function IsAvailable() : Bool{
var horseComp : W3HorseComponent;
horseComp = GetNPC().GetHorseComponent();
if (!horseComp){
return false;
}
if (!horseComp.riderSharedParams){
return false;
}
switch(horseComp.riderSharedParams.mountStatus){
case 0:
if (waitForMountEnd){
return false;
}
return true;
case 1:
return true;
case 2:
if (waitForDismountEnd){
return true;
}
return false;
case 3:
return false;
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
switch(eventName){
case 'HorseMountStart':
return true;
case 'HorseMountEnd':
return true;
case 'HorseDismountStart':
return true;
case 'HorseDismountEnd':
return true;
}
return false;
/* NOP */;
}
}
import abstract class SAnimationBufferBitwiseCompressedBoneTrack{
}

class CBTCondHorseIsMountedDef extends IBehTreeHorseConditionalTaskDefinition{


public editable var waitForMountEnd : Bool;
public editable var waitForDismountEnd : Bool;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('HorseMountStart');
listenToGameplayEvents.PushBack('HorseMountEnd');
listenToGameplayEvents.PushBack('HorseDismountStart');
listenToGameplayEvents.PushBack('HorseDismountEnd');
/* NOP */;
}
}
import abstract class CReactionScene{
}
import abstract class SAnimationBufferBitwiseCompressionSettings{
}
class CBTCondHorseShouldShakeOffRider extends IBehTreeTask{
public var activate : Bool;
public function IsAvailable() : Bool{
var horseComp : W3HorseComponent;
var panic : Float;
if (activate){
return true;
}
horseComp = GetNPC().GetHorseComponent();
panic = horseComp.GetPanicPercent();
if (panic >= 0.999000){
return true;
}
return false;
/* NOP */;
}
public function OnDeactivate(){
activate = false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var buffType : ECriticalStateType;
if (!GetNPC().IsInCombat()){
return false;
}
if (eventName == 'CriticalState'){
buffType = GetEventParamInt(-1);
if (buffType == 2 || buffType == 1 || buffType == 14){
activate = true;
return true;
} else {
return false;
}
}
return true;
/* NOP */;
}
}
import abstract class CSkeletalAnimation{

}
import abstract class CVirtualSkeletalAnimation{
}
abstract class IBehTreeHorseTaskDefinition extends IBehTreeTaskDefinition{
}
import abstract class CBehTreeReactionEventData{
}
class CBTTaskHorseReassure extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function OnActivate() : EBTNodeStatus{
var animalData : CAIStorageAnimalData;
animalData = (CAIStorageAnimalData)aiStorageHandler.Get();
animalData.scared = false;
return 0;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('AnimalData', '*CAIStorageAnimalData
', this);
aiStorageHandler.Get();
/* NOP */;
}
}
import abstract class SCompressedPoseInfo{
}
struct SAnimMultiplyCauser{
saved var id : Int32;
saved var mul : Float;
}
import abstract class CAnimatedComponentPhysicsRepresentation{
}
import abstract class SAnimatedComponentSyncSettings{
}
class CBTTaskHorseNervous extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var timeTillNextNervous : Float;
public function OnActivate() : EBTNodeStatus{
var horseData : CAIStorageHorseData;
horseData = (CAIStorageHorseData)aiStorageHandler.Get();
GetActor().SignalGameplayEvent('HorseNervousStart');
return 0;
/* NOP */;
}
public function UpdateTimeUntillNextNervous(){
var spellPower : SAbilityAttributeValue;
spellPower = thePlayer.GetPowerStatValue(1, /* NOP */, /* NOP */
);
timeTillNextNervous = GetLocalTime() + RandRangeF(10.000000, 8.0
00000) + spellPower.valueMultiplicative * spellPower.valueMultiplicative;
/* NOP */;

}
public function IsTimeToNextNervous() : Bool{
return timeTillNextNervous < GetLocalTime();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var horseData : CAIStorageHorseData;
horseData = (CAIStorageHorseData)aiStorageHandler.Get();
while (true){
if (IsTimeToNextNervous()){
GetActor().SignalGameplayEvent('HorseNervousStar
t');
UpdateTimeUntillNextNervous();
}
SleepOneFrame();
}
return 2;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('HorseData', '*CAIStorageHorseData',
this);
aiStorageHandler.Get();
/* NOP */;
}
}
import abstract class SAnimatedComponentSlotAnimationSettings{
//NULL type for blendIn
//NULL type for blendOut
}
import abstract class CSkeletalAnimatedComponent{
}
class W3Mutagen13_Effect extends W3Mutagen_Effect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var buffs : array<CBaseGameplayEffect>;
var i : Int32;
super.OnEffectAdded(customParams);
buffs = target.GetBuffs(/* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < buffs.Size()){
if (IsEffectTypeAffected(buffs[i].GetEffectType())){
buffs[i].SetTimeLeft(GetForcedDuration());
}
i += 1;
}
/* NOP */;
}
public function GetForcedDuration() : Float{
return 0.500000;
/* NOP */;
}
public function IsEffectTypeAffected(effectType : EEffectType) : Bool{
switch(effectType){
case 14:
case 108:
case 5:

case
case
case
case
case
case
case
case
case

56:
6:
7:
8:
9:
46:
12:
13:
42:

return true;
default:
}
return false;
/* NOP */;
}
}
import abstract class CWetnessComponent{
}
import abstract class SSlotInfo{
}
import abstract class CSlotComponent{
}
import abstract class CIndirectSlot{
}
import abstract class CMimicComponent{
}
import abstract class CMimicFaces{
}
class CBTTaskHorseRequiredItemsForRider extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var processLeftItem : Bool;
private var processRightItem : Bool;
public var LeftItemType : CName;
public var RightItemType : CName;
public function IsAvailable() : Bool{
return RequiredItems();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var riderData : CAIStorageRiderData;
var horseComp : W3HorseComponent;
horseComp = GetNPC().GetHorseComponent();
npc = (CNewNPC)horseComp.riderSharedParams.rider;
if (!npc){
return 1;
}
npc.SetBehaviorVariable('actionType', 3, /* NOP */);
npc.SetBehaviorVariable('isHoldingWeaponR', 1.000000, /* NOP */)

;
npc.SetBehaviorVariable('swordAdditiveBlendWeight', 1.000000, /*
NOP */);
if (processLeftItem || processRightItem){
if (processLeftItem && processRightItem){
npc.SetRequiredItems('None', 'None');
} else if (processLeftItem){
npc.SetRequiredItems('None', 'Any');
} else if (processRightItem){
npc.SetRequiredItems('Any', 'None');
}
npc.ProcessRequiredItems(/* NOP */);
npc.SetRequiredItems(LeftItemType, RightItemType);
npc.ProcessRequiredItems(/* NOP */);
npc.OnProcessRequiredItemsFinish();
}
return 0;
/* NOP */;
}
private function RequiredItems() : Bool{
var res : Bool;
var itemID : SItemUniqueId;
var i : Int32;
var items : array<SItemUniqueId>;
var inventory : CInventoryComponent;
var horseComp : W3HorseComponent;
horseComp = GetNPC().GetHorseComponent();
inventory = horseComp.riderSharedParams.rider.GetInventory();
if (!inventory){
return false;
}
res = true;
if (LeftItemType != 'None'){
processLeftItem = true;
items = inventory.GetItemsByCategory(LeftItemType);
if (items.Size() == 0){
items = inventory.GetItemsByTag(LeftItemType);
}
if (items.Size() == 0){
res = false;
LogQuest("Cannot enter combat style. No " + Left
ItemType + " found in l_weapon");
} else {
i = 0;
while (i < items.Size()){
if (inventory.IsItemHeld(items[i])){
processLeftItem = false;
}
i += 1;
}
}
} else {
itemID = inventory.GetItemFromSlot('l_weapon');
if (inventory.GetItemCategory(itemID) != LeftItemType){
processLeftItem = true;
}
}
if (RightItemType != 'None'){
processRightItem = true;
items = inventory.GetItemsByCategory(RightItemType);

if (items.Size() == 0){
items = inventory.GetItemsByTag(RightItemType);
}
if (items.Size() == 0){
res = false;
LogQuest("Cannot enter combat style. No " + Righ
tItemType + " found in r_weapon");
} else {
i = 0;
while (i < items.Size()){
if (inventory.IsItemHeld(items[i])){
processRightItem = false;
}
i += 1;
}
}
} else {
itemID = inventory.GetItemFromSlot('r_weapon');
if (inventory.GetItemCategory(itemID) != RightItemType){
processRightItem = true;
}
}
return res;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class IMoveSteeringNode{
}
import abstract class CMimicFace{
}
import abstract class SMimicTrackPose{
}
class CBTTaskHorseManageRiderPosition extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var rider : CActor;
private const var activation_distance : Float;
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var res : Bool;
var dist : Float;
var target : CActor;
var horseComp : W3HorseComponent;
horseComp = GetNPC().GetHorseComponent();
rider = horseComp.riderSharedParams.rider;
while (true){

SleepOneFrame();
target = GetCombatTarget();
dist = VecDistance(rider.GetWorldPosition(), target.GetW
orldPosition());
if (dist > activation_distance){
rider.SetBehaviorVariable('attackRelease', 2.000
000, /* NOP */);
} else {
if (rider.GetBehaviorVariable('attackRelease', /
* NOP */) == 2){
rider.SetBehaviorVariable('actionType',
3, /* NOP */);
rider.SetBehaviorVariable('attackRelease
', 0.000000, /* NOP */);
rider.RaiseEvent('actionStart');
}
rider.SetBehaviorVariable('speed', GetActor().Ge
tMovingAgentComponent().GetRelativeMoveSpeed(), /* NOP */);
ChooseAttackDir();
ChooseAttackHeight();
}
}
return 2;
/* NOP */;
}
public function OnDeactivate(){
rider.SetBehaviorVariable('attackRelease', 2.000000, /* NOP */);
rider = NULL;
/* NOP */;
}
private function ChooseAttackDir(){
var verticalVal : Float;
var horizontalVal : Float;
var localOffset : Vector;
var heading : Float;
var riderTarget : CActor;
var riderData : CAIStorageRiderData;
riderTarget = GetCombatTarget();
heading = VecHeading(riderTarget.GetWorldPosition() - rider.GetW
orldPosition());
horizontalVal = AngleDistance(rider.GetHeading(), heading) / 180
.000000;
rider.SetBehaviorVariable('aimHorizontal', horizontalVal, /* NOP
*/);
if (horizontalVal > 0){
rider.SetBehaviorVariable('aimHorizontalSword', 0.000000
, /* NOP */);
} else if (horizontalVal < 0){
rider.SetBehaviorVariable('aimHorizontalSword', 1.000000
, /* NOP */);
}
/* NOP */;
}
public function ChooseAttackHeight(){
var verticalVal : Float;
var riderPos : Vector;
var targetPos : Vector;
riderPos = rider.GetWorldPosition();
targetPos = GetCombatTarget().GetWorldPosition();
if (GetCombatTarget().IsUsingHorse(/* NOP */)){

if (riderPos.Z < targetPos.Z + 0.300000){


verticalVal = 1.000000;
} else {
verticalVal = 0.000000;
}
} else if (riderPos.Z + 1.000000 < targetPos.Z){
verticalVal = 1.000000;
} else {
verticalVal = 0.000000;
}
rider.SetBehaviorVariable('aimVertical', verticalVal, /* NOP */)
;
/* NOP */;
}
}
import abstract class IMoveSteeringCondition{
}
abstract class W3Mutagen_Effect extends CBaseGameplayEffect{
private saved var toxicityOffset : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var mutParams : W3MutagenBuffCustomParams;
if (target != GetWitcherPlayer()){
isActive = false;
return false;
}
super.OnEffectAdded(customParams);
mutParams = (W3MutagenBuffCustomParams)customParams;
if (mutParams){
toxicityOffset = mutParams.toxicityOffset;
GetWitcherPlayer().AddToxicityOffset(toxicityOffset);
} else {
toxicityOffset = 0;
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
GetWitcherPlayer().RemoveToxicityOffset(toxicityOffset);
super.OnEffectRemoved();
/* NOP */;
}
}
import abstract class CSkeletalAnimationSetEntry{
}
import abstract class IMoveSteeringTask{
}
import abstract class CAnimationSlots{
}
import abstract class CBezierComponent{
}
import struct CInputManager{
import public final function GetLastActivationTime(actionName : CName) :
Float;
import public final function GetActionValue(actionName : CName) : Float;

import public final function GetAction(actionName : CName) : SInputActio


n;
import public final function ClearIgnoredInput();
import public final function IsInputIgnored(actionName : CName) : Bool;
import public final function SetContext(contextName : CName);
import public final function GetContext() : CName;
import public final function UnregisterListener(listener : IScriptable,
actionName : CName);
import public final function RegisterListener(listener : IScriptable, ev
entName : CName, actionName : CName);
import public final function EnableLog(val : Bool);
import public final function StoreContext(newContext : CName);
import public final function RestoreContext(storedContext : CName, conte
xtCouldChange : Bool);
import public final function LastUsedPCInput() : Bool;
import public final function LastUsedGamepad() : Bool;
import public final function ForceDeactivateAction(actionName : CName);
import public final function GetPCKeysForAction(actionName : CName, outK
eys : array<EInputKey>);
import public final function GetPadKeysForAction(actionName : CName, out
Keys : array<EInputKey>);
import public final function GetCurrentKeysForAction(actionName : CName,
outKeys : array<EInputKey>);
import public final function GetPCKeysForActionStr(actionName : String,
outKeys : array<EInputKey>);
import public final function GetPadKeysForActionStr(actionName : String,
outKeys : array<EInputKey>);
import public final function GetCurrentKeysForActionStr(actionName : Str
ing, outKeys : array<EInputKey>);
import public final function UsesPlaystationPad() : Bool;
import public final function SetInvertCamera(invert : Bool);
public final function UsesPlaystationPadScript() : Bool{
return UsesPlaystationPad() || FactsQuerySum("dbg_force_ps_pad")
> 0;
/* NOP */;
}
public function IsActionPressed(actionName : CName) : Bool{
var action : SInputAction;
action = super.GetAction(actionName);
return IsPressed(action, true);
/* NOP */;
}
public function IsActionReleased(actionName : CName) : Bool{
var action : SInputAction;
action = super.GetAction(actionName);
return IsReleased(action, true);
/* NOP */;
}
public function IsActionJustPressed(actionName : CName) : Bool{
var action : SInputAction;
action = super.GetAction(actionName);
return IsPressed(action, /* NOP */);
/* NOP */;
}
public function IsActionJustReleased(actionName : CName) : Bool{
var action : SInputAction;
action = super.GetAction(actionName);
return IsReleased(action, /* NOP */);
/* NOP */;
}

public function OnInputDeviceChanged() : Bool{


var guiManager : CR4GuiManager;
var hud : CR4ScriptedHud;
var overlayPopupRef : CR4OverlayPopup;
var tutorialPopupRef : CR4TutorialPopup;
var glossaryTutorial : CR4GlossaryTutorialsMenu;
var tutorialSystem : CR4TutorialSystem;
var commonMenuRef : CR4CommonMenu;
guiManager = theGame.GetGuiManager();
if (guiManager.GetLockedControlScheme() == 0){
tutorialSystem = theGame.GetTutorialSystem();
if (tutorialSystem && tutorialSystem.IsRunning()){
tutorialSystem.OnInputDeviceChanged();
}
tutorialPopupRef = (CR4TutorialPopup)guiManager.GetPopup
('TutorialPopup');
if (tutorialPopupRef){
tutorialPopupRef.UpdateInputDevice();
}
overlayPopupRef = (CR4OverlayPopup)guiManager.GetPopup('
OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.UpdateInputDevice();
}
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateInputDevice();
}
commonMenuRef = guiManager.GetCommonMenu();
if (commonMenuRef){
commonMenuRef.UpdateInputDevice();
glossaryTutorial = (CR4GlossaryTutorialsMenu)com
monMenuRef.GetSubMenu();
if (glossaryTutorial){
}
}
}
/* NOP */;
}
public function IsAttackWithAlternateBound() : Bool{
var outKeys : array<EInputKey>;
if (super.LastUsedGamepad()){
return false;
} else if (super.LastUsedPCInput()){
super.GetPCKeysForAction('PCAlternate', outKeys);
if (outKeys.Size() > 0){
return true;
}
}
return false;
/* NOP */;
}
public function IsToggleSprintBound() : Bool{
var outKeys : array<EInputKey>;
if (super.LastUsedGamepad()){
return false;
} else if (super.LastUsedPCInput()){
super.GetPCKeysForAction('SprintToggle', outKeys);
if (outKeys.Size() > 0){
return true;

}
}
return false;
/* NOP */;
}
}
import abstract class CGestureSystem{
}
import abstract class SInputAction{
//NULL type for aName
//NULL type for value
//NULL type for lastFrameValue
}
import abstract class SCustomClippingPlanes{
}
class CBTTaskHorseUpdateRiderLookat extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var rider : CActor;
public var boneName : CName;
public var useCombatTarget : Bool;
public var useCustomTarget : Bool;
public function OnActivate() : EBTNodeStatus{
var horseComp : W3HorseComponent;
if (!rider){
horseComp = GetNPC().GetHorseComponent();
rider = horseComp.riderSharedParams.rider;
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var lookatTarget : CEntity;
var targetBoneIndex : Int32;
var targetPos : Vector;
var heading : Float;
if (useCombatTarget){
lookatTarget = GetCombatTarget();
} else {
lookatTarget = (CEntity)GetActionTarget();
}
if (!lookatTarget && !useCustomTarget){
return 0;
}
targetBoneIndex = lookatTarget.GetBoneIndex(boneName);
while (true){
if (useCustomTarget){
GetCustomTarget(targetPos, heading);
targetPos.Z += 1;
} else if (targetBoneIndex != -1){
targetPos = MatrixGetTranslation(lookatTarget.Ge
tBoneWorldMatrixByIndex(targetBoneIndex));
} else {
targetPos = lookatTarget.GetWorldPosition();
targetPos.Z += 1.500000;
}
rider.UpdateLookAtVariables(1.000000, targetPos);

SleepOneFrame();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
rider.SetBehaviorVariable('lookatOn', 0.000000, /* NOP */);
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class COverrideStreamingDistanceComponent{
}
import abstract class CAnimEventSerializer{
}
import abstract class CExtAnimEvent{
}
import abstract class CExtAnimDurationEvent{
}
import abstract class CExtAnimExplorationEvent{
}
import abstract class CExtAnimCutsceneActorEffect{
}
abstract class W3Effect_ApplicatorOnHit extends W3ApplicatorEffect{
private saved var fromSilverSword : Bool;
private saved var fromSteelSword : Bool;
private saved var fromSign : Bool;
private saved var fromAll : Bool;
public function ProcessOnHit(victim : CActor, silverSword : Bool, steelS
word : Bool, sign : Bool){
if (fromAll || silverSword && fromSilverSword || steelSword && f
romSteelSword || sign && fromSign){
ApplySpawnsOn(victim);
}
/* NOP */;
}
public function CacheSettings(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var tmpApplicatorName : CName;
var tmpName : CName;
var i : Int32;
var tmpBool : Bool;
var type : EEffectType;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;

while (i < main.subNodes.Size()){


dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpApplicatorName);
EffectNameToType(tmpApplicatorName, type, tmpName);
if (effectType == type){
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'fromSilverSword', tmpBool)){
fromSilverSword = tmpBool;
}
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'fromSteelSword', tmpBool)){
fromSteelSword = tmpBool;
}
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'fromSign', tmpBool)){
fromSign = tmpBool;
}
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'fromAll', tmpBool)){
fromAll = tmpBool;
}
}
i += 1;
}
/* NOP */;
}
}
import abstract class CExtAnimCutsceneBodyPartEvent{
}
class CBTTask3StateProjectileAttack extends CBTTask3StateAttack{
public var attackRange : Float;
public var projEntity : CEntityTemplate;
public var projectileName : CName;
public var dodgeable : Bool;
public var useLookatTarget : Bool;
public var projectiles : array<W3AdvancedProjectile>;
public latent function Main() : EBTNodeStatus{
var res : EBTNodeStatus;
if (!projEntity){
projEntity = (CEntityTemplate)LoadResourceAsync(projecti
leName, /* NOP */);
}
if (!projEntity){
return 1;
}
res = super.Main();
return res;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'ShootProjectile'){
ShootProjectile(/* NOP */);
return true;
} else if (animEventName == 'Shoot3Projectiles'){
ShootProjectile(/* NOP */);

ShootProjectile(GetActor().GetHeading() +
ShootProjectile(GetActor().GetHeading() return true;
} else if (animEventName == 'Shoot5Projectiles'){
ShootProjectile(/* NOP */);
ShootProjectile(GetActor().GetHeading() +
ShootProjectile(GetActor().GetHeading() ShootProjectile(GetActor().GetHeading() +
ShootProjectile(GetActor().GetHeading() return true;
}
return res;
/* NOP */;

5);
5);

5);
5);
10);
10);

}
public function ShootProjectile(customHeading : Float){
var npc : CNewNPC;
var projRot : EulerAngles;
var projPos : Vector;
var targetPos : Vector;
var projectile : W3AdvancedProjectile;
var distanceToTarget : Float;
var projectileFlightTime : Float;
var target : CActor;
npc = GetNPC();
target = GetCombatTarget();
projPos = npc.GetWorldPosition();
projPos.Z += 1.500000;
projRot = npc.GetWorldRotation();
projectile = (W3AdvancedProjectile)theGame.CreateEntity(projEnti
ty, projPos, projRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
projectile.Init(npc);
if (useLookatTarget){
targetPos = npc.GetBehaviorVectorVariable('lookAtTarget'
);
} else if (customHeading){
targetPos = projPos + VecFromHeading(customHeading) * at
tackRange;
} else {
targetPos = projPos + npc.GetHeadingVector() * attackRan
ge;
}
projectile.ShootProjectileAtPosition(0, projectile.projSpeed, ta
rgetPos, attackRange, /* NOP */);
if (dodgeable){
distanceToTarget = VecDistance(npc.GetWorldPosition(), t
arget.GetWorldPosition());
projectileFlightTime = distanceToTarget / projectile.pro
jSpeed;
target.SignalGameplayEventParamFloat('Time2DodgeProjecti
le', projectileFlightTime);
}
projectiles.PushBack(projectile);
/* NOP */;
}
}
import abstract class CExtAnimCutsceneDialogEvent{
}
import abstract class CExtAnimCutsceneBreakEvent{

}
import abstract class CExtAnimCutsceneEffectEvent{
}
import abstract class CExtAnimCutsceneSlowMoEvent{
}
import abstract class CExtAnimCutsceneWindEvent{
}
import abstract class CExtAnimCutsceneEnvironmentEvent{
}
import abstract class CExtAnimCutsceneLightEvent{
}
import abstract class CExtAnimCutsceneBokehDofEvent{
}
import abstract class CExtAnimCutsceneBokehDofBlendEvent{
}
import abstract class CExtAnimCutsceneFadeEvent{
}
abstract class W3Effect_Shrine extends CBaseGameplayEffect{
private saved var isFromMutagen23 : Bool;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var shrineParams : W3ShrineEffectParams;
super.OnEffectAdded(customParams);
shrineParams = (W3ShrineEffectParams)customParams;
if (shrineParams){
isFromMutagen23 = shrineParams.isFromMutagen23;
}
/* NOP */;
}
public final function IsFromMutagen23() : Bool{
return isFromMutagen23;
/* NOP */;
}
}
import abstract class CExtAnimCutsceneSoundEvent{
}
import abstract class CExtAnimComboEvent{
}
import abstract class CExtAnimHitEvent{
}
import abstract class CExtAnimMorphEvent{
}
struct SEffectIconType{
var typeName : CName;
var path : String;
}

import abstract class CExtAnimCutsceneEvent{


}
import abstract class CExtAnimCutsceneDurationEvent{
}
class CBTTask3StateAttackDef extends CBTTaskAttackDef{
public editable var loopTime : Float;
public editable var endTaskWhenOwnerGoesPastTarget : Bool;
public editable var stopRotatingWhenTargetIsBehind : Bool;
public editable var playFXOnLoopStart : CName;
public editable var playLoopFXInterval : Float;
}
import abstract class CExtAnimCutsceneSetClippingPlanesEvent{
}
import abstract class CExtAnimEventFileFactory{
}
class W3MonsterElementalArm extends CGameplayEntity{
public editable var physcialComponent : CComponent;
public var victims : array<CActor>;
public var victim : CActor;
public var isActive : Bool;
public var action : W3DamageAction;
public var owner : CActor;
private autobind component : CMeshComponent = single;
public function SetIsActive(toggle : Bool){
isActive = true;
/* NOP */;
}
public function SetOwner(actor : CActor){
owner = actor;
AddTimer('ExplodeTimer', 5.000000, false, /* NOP */, /* NOP */,
true, /* NOP */);
/* NOP */;
}
public timer function ExplodeTimer(optional dt : Float, optional id : In
t32){
if (isActive){
Explode();
}
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (isActive && activator != owner){
Explode();
}
/* NOP */;
}
public function Explode(){
var i : Int32;
victims = owner.GetNPCsAndPlayersInRange(5, 10, 'None', 32 + 4 +
256 + 64);
PlayEffect('explosion', /* NOP */);
if (component){
component.SetVisible(false);
}

StopEffect('fire_fx');
action = new W3DamageAction in this;
i = 0;
while (i < victims.Size()){
action = new W3DamageAction in this;
action.Initialize(owner, victims[i], NULL, 'elemental_ar
m', 0, 0, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */)
;
action.AddDamage(theGame.params.DAMAGE_NAME_ELEMENTAL, 2
0);
action.AddEffectInfo(10, 2.000000, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
i += 1;
}
DestroyAfter(7);
isActive = false;
/* NOP */;
}
public function OnContactEvent(position : Vector, force : Vector, otherB
ody : CComponent, actorIndex : Int32, shapeIndex : Int32) : Bool{
if (isActive && otherBody.GetEntity() != owner){
Explode();
} else if (isActive && !otherBody){
Explode();
}
/* NOP */;
}
}
import abstract class CExtAnimRaiseEventEvent{
}
import abstract class CExtAnimDisableDialogLookatEvent{
}
class BTTaskExplodeAtDeath extends IBehTreeTask{
public var requiredAbility : CName;
public var damageRadius : Float;
public var damageValue : Float;
public var weaponSlot : CName;
private var m_hasExploded : Bool;
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (IsNameValid(requiredAbility) && !GetNPC().HasAbility(require
dAbility)){
return false;
}
if (!m_hasExploded && eventName == 'Death'){
Explode();
}
return true;
/* NOP */;
}
private function Explode(){
var l_actor : CActor;
var l_dismembermentComp : CDismembermentComponent;
var l_wounds : array<CName>;
var l_actors : array<CActor>;
var l_usedWound : CName;

var i : Int32;
var l_damageAction : W3DamageAction;
var l_damageAttr : SAbilityAttributeValue;
var l_inv : CInventoryComponent;
var l_weaponId : SItemUniqueId;
var l_damageNames : array<CName>;
var l_attribute : CName;
l_actor = GetNPC();
l_dismembermentComp = (CDismembermentComponent)l_actor.GetCompon
entByClassName('CDismembermentComponent');
if (!l_dismembermentComp){
return;
}
l_dismembermentComp.GetWoundsNames(l_wounds, 2);
if (l_wounds.Size() > 0){
l_usedWound = l_wounds[RandRange(l_wounds.Size(), /* NOP
*/)];
}
l_actor.SetDismembermentInfo(l_usedWound, Vector(0, 0, 10), fals
e);
l_actor.AddTimer('DelayedDismemberTimer', 0.050000, /* NOP */, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_hasExploded = true;
l_actor.GetVisualDebug().AddSphere('ExplosionRange', damageRadiu
s, Vector(0, 0, 0), /* NOP */, /* NOP */, 5);
if (damageRadius > 0){
l_actors = GetActorsInRange(GetNPC(), damageRadius, -1,
/* NOP */, true);
if (l_actors.Size() > 0){
l_damageAction = new W3DamageAction in this;
if (IsNameValid(weaponSlot)){
l_inv = l_actor.GetInventory();
l_weaponId = l_inv.GetItemFromSlot(weapo
nSlot);
l_inv.GetWeaponDTNames(l_weaponId, l_dam
ageNames);
l_attribute = GetBasicAttackDamageAttrib
uteName(theGame.params.ATTACK_NAME_HEAVY, theGame.params.DAMAGE_NAME_FROST);
l_damageAttr = l_actor.GetAttributeValue
(l_attribute, /* NOP */, /* NOP */);
l_damageAttr.valueBase = l_actor.GetTota
lWeaponDamage(l_weaponId, l_damageNames[0], GetInvalidUniqueId());
if (theGame.GetDifficultyMode() == 1){
damageValue = 50 + l_damageAttr.
valueBase * l_damageAttr.valueMultiplicative + l_damageAttr.valueAdditive * 2;
} else if (theGame.GetDifficultyMode() =
= 3){
damageValue = 150 + l_damageAttr
.valueBase * l_damageAttr.valueMultiplicative + l_damageAttr.valueAdditive * 4;
} else if (theGame.GetDifficultyMode() =
= 4){
damageValue = 200 + l_damageAttr
.valueBase * l_damageAttr.valueMultiplicative + l_damageAttr.valueAdditive * 5;
} else {
damageValue = 100 + l_damageAttr
.valueBase * l_damageAttr.valueMultiplicative + l_damageAttr.valueAdditive * 3;
}
}
i = 0;
while (i < l_actors.Size()){

if (l_actors[i] == GetNPC()){
} else {
l_damageAction.Initialize(l_acto
r, l_actors[i], NULL, "Explosion", 2, 0, false, true, false, false, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
l_damageAction.SetCannotReturnDa
mage(true);
l_damageAction.AddDamage(theGame
.params.DAMAGE_NAME_PHYSICAL, damageValue);
l_damageAction.AddDamage(theGame
.params.DAMAGE_NAME_SILVER, damageValue);
l_damageAction.AddEffectInfo(13,
1.000000, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(
l_damageAction);
}
i += 1;
}
delete l_damageAction;
}
}
/* NOP */;
}
}
import abstract class CExtAnimScriptEvent{
}
import abstract class CEASMultiValueSimpleEvent{
}
class CBTTaskHarpyDustAttack extends CBTTaskAttack{
public var effectRange : Float;
public var effectAngle : Float;
public var eventReceived : Bool;
public latent function Main() : EBTNodeStatus{
var action : W3DamageAction;
var npc : CNewNPC;
var target : CActor;
var npcPos : Vector;
var targetPos : Vector;
var dist : Float;
var angle : Float;
npc = GetNPC();
target = npc.GetTarget();
while (true){
if (eventReceived){
npcPos = npc.GetWorldPosition();
targetPos = target.GetWorldPosition();
angle = AbsF(AngleDistance(npc.GetHeading(), Vec
Heading(targetPos - npcPos)));
dist = VecDistanceSquared(npcPos, targetPos);
if (dist <= effectRange * effectRange && angle <
= effectAngle){
action = new W3DamageAction in this;
action.Initialize(npc, target, npc, npc
+ "'s dust attack", 0, 0, false, false, false, false, /* NOP */, /* NOP */, /* N
OP */, /* NOP */);
action.SetHitAnimationPlayType(2);
action.AddEffectInfo(52, /* NOP */, /* N

OP */, /* NOP */, /* NOP */, /* NOP */);


theGame.damageMgr.ProcessAction(action);
delete action;
GCameraShake(0.500000, false, target.Get
WorldPosition(), 10.000000, /* NOP */, /* NOP */, /* NOP */);
if (target == thePlayer){
target.PlayEffect('radial_blur',
/* NOP */);
}
}
eventReceived = false;
}
Sleep(0.100000);
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'ApplyBlind'){
eventReceived = true;
return true;
}
return false;
/* NOP */;
}
}
import abstract class CExtAnimScriptDurationEvent{
}
import abstract class CEASSlideToTargetEvent{
}
import abstract class CEASEnumEvent{
}
import abstract class CEASMultiValueEvent{
}
import abstract class SAnimationEventAnimInfo{
}
struct SApplicatorSpawnEffect{
saved var spawnAbilityName : CName;
saved var spawnType : EEffectType;
saved var spawnFlagsHostile : Bool;
saved var spawnFlagsNeutral : Bool;
saved var spawnFlagsFriendly : Bool;
saved var spawnSourceName : String;
}
import abstract class SSlideToTargetEventProps{
//NULL type for minSlideDist
//NULL type for maxSlideDist
}
import abstract class SEnumVariant{
//NULL type for enumValue
//NULL type for enumType

}
import abstract class SMultiValue{
//NULL type for floats
//NULL type for enums
}
import abstract class CExtAnimEventsFile{
}
class CBTTaskSwarm extends CBTTaskAttack{
public var lair : CFlyingSwarmMasterLair;
public var entities : array<CGameplayEntity>;
public var i : Int32;
public function OnActivate() : EBTNodeStatus{
var owner : CNewNPC;
var lairEntities : array<CGameplayEntity>;
owner = GetNPC();
if (!lair){
FindGameplayEntitiesInRange(lairEntities, GetActor(), 15
0, 1, 'SwarmMasterLair', /* NOP */, /* NOP */, /* NOP */);
if (lairEntities.Size() > 0){
lair = (CFlyingSwarmMasterLair)lairEntities[0];
}
}
if (lair){
lair.SetBirdMaster(owner);
}
return super.OnActivate();
/* NOP */;
}
}
import abstract class CPoseBBoxGenerator{
}
import abstract class CSkeleton2SkeletonMapper{
}
import abstract class IPoseCompression{
}
import abstract class CPoseCompressionNone{
}
import abstract class CPoseCompressionDefault{
}
struct SBuffPauseLock{
saved var sourceName : CName;
saved var counter : Int32;
}
import abstract class CPoseCompressionDefaultWithExtraBones{
}
class W3LeshyBirdProjectile extends CProjectileTrajectory{
public editable var fxEntityTemplate : CEntityTemplate;
private var fxEntity : CEntity;
private var action : W3DamageAction;

private var owner : CActor;


private var projPos : Vector;
private var projRot : EulerAngles;
private var projExpired : Bool;
public function SetOwner(actor : CActor){
owner = actor;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CGameplayEntity;
var birdDmg : Float;
var attributeName : CName;
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
if (victim && victim == (CActor)caster.GetTarget()){
projExpired = true;
attributeName = GetBasicAttackDamageAttributeName(theGam
e.params.ATTACK_NAME_LIGHT, theGame.params.DAMAGE_NAME_PHYSICAL);
birdDmg = CalculateAttributeValue((CActor)caster.GetAttr
ibuteValue(attributeName, /* NOP */, /* NOP */), /* NOP */);
action = new W3DamageAction in this;
action.Initialize(owner, victim, this, caster.GetName()
+ "_" + "root_projectile", 0, 0, false, false, false, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
action.SetHitAnimationPlayType(1);
action.AddDamage(theGame.params.DAMAGE_NAME_RENDING, bir
dDmg);
theGame.damageMgr.ProcessAction(action);
AddTimer('TimeDestroy', 5.000000, false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
}
delete action;
/* NOP */;
}
public function OnRangeReached() : Bool{
StopAllEffects();
StopProjectile();
if (!projExpired){
AddTimer('TimeDestroy', 5.000000, false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function Expired() : Bool{
return projExpired;
/* NOP */;
}
public timer function TimeDestroy(optional deltaTime : Float, optional i
d : Int32){
Destroy();
/* NOP */;
}
}

import abstract class CPoseCompressionCharacter{


}
import abstract class CPoseCompressionCamera{
}
import abstract class ICompressedPose{
}
import abstract class CNoCompressedPose{
}
import abstract class CDefaultCompressedPose2{
}
import abstract class CDefaultCompressedPoseWithExtraBones{
}
import abstract class CCharacterCompressedPose{
}
import abstract class CCameraCompressedPose{
}
class CBTTaskSearchForObject extends IBehTreeTask{
public var range : Float;
public var tag : CName;
public var selectRandomObject : Bool;
public var avoidSelectingPreviousOne : Bool;
public var dontSelectClosestOneIfPossible : Bool;
public var addFactOnLastObject : Bool;
public var setActionTargetOnIsAvailable : Bool;
public var cooldown : Float;
private var selectedObject : CNode;
private var previouslySelectedObject : CGameplayEntity;
private var searchTimeStamp : Float;
public function IsAvailable() : Bool{
if (isActive){
return true;
}
if (cooldown > 0 && searchTimeStamp > 0 && searchTimeStamp + coo
ldown > GetLocalTime()){
return false;
}
if (setActionTargetOnIsAvailable){
if (super.Search()){
SetActionTarget(selectedObject);
return true;
}
return false;
}
return super.Search();
/* NOP */;
}
public final function Search() : Bool{
var npc : CNewNPC;
var foundObjects : array<CGameplayEntity>;
var indeks : Int32;
npc = GetNPC();
if (selectRandomObject){

FindGameplayEntitiesInRange(foundObjects, npc, range, 99


, tag, /* NOP */, /* NOP */, /* NOP */);
} else {
FindGameplayEntitiesInRange(foundObjects, npc, range, 1,
tag, /* NOP */, /* NOP */, /* NOP */);
}
FilterOutObjects(foundObjects);
searchTimeStamp = GetLocalTime();
if (foundObjects.Size() > 0){
if (selectRandomObject){
if (foundObjects.Size() > 1){
if (dontSelectClosestOneIfPossible){
foundObjects.Erase(0);
}
if (avoidSelectingPreviousOne && previou
slySelectedObject){
foundObjects.Remove(previouslySe
lectedObject);
}
} else if (addFactOnLastObject){
FactsAdd("last_object_" + tag, 1, -1);
}
indeks = RandRange(foundObjects.Size(), 0);
selectedObject = foundObjects[indeks];
} else {
selectedObject = foundObjects[0];
}
if (selectedObject){
return true;
}
return false;
} else {
return false;
}
/* NOP */;
}
public function FilterOutObjects(foundObjects : array<CGameplayEntity>){
}
public function OnActivate() : EBTNodeStatus{
if (!selectedObject){
super.Search();
}
if (!selectedObject){
return 1;
}
SetActionTarget(selectedObject);
previouslySelectedObject = (CGameplayEntity)selectedObject;
return 0;
/* NOP */;
}
public function OnDeactivate(){
selectedObject = NULL;
/* NOP */;
}
}
import abstract class IMotionExtraction{
}
import abstract class CUncompressedMotionExtraction{

}
import abstract class CHavokMotionExtraction{
}
import abstract class CLineMotionExtraction{
}
import abstract class CLineMotionExtraction2{
}
import abstract class IMotionExtractionCompression{
}
import abstract class CMotionExtractionLineCompression{
}
import abstract class CMotionExtractionLineCompression2{
}
import abstract class IAnimationCompression{
}
import abstract class CNoAnimationCompression{
}
import abstract class CWaveletAnimationCompression{
}
import abstract class CDeltaAnimationCompression{
}
class CBTTaskWraithSummonDoppelganger extends CBTTaskPlayAnimationEventDecorator
{
public var splitEffectEntityTemplate : CEntityTemplate;
public var numberToSummon : Int32;
public var summonOnAnimEvent : CName;
public var summonPositionPattern : ESpawnPositionPattern;
public var summonMaxDistance : Float;
public var summonMinDistance : Float;
public var entityToSummonName : CName;
public var splitEffectEntity : CName;
public var applyBlindnessRange : Float;
private var entityToSummon : CEntityTemplate;
private var m_shouldSummon : Bool;
private var m_hasSummoned : Bool;
private var m_createEntityHelper : CCreateEntityHelper;
public function Initialize(){
m_createEntityHelper = new CCreateEntityHelper in this;
/* NOP */;
}
public final latent function Main() : EBTNodeStatus{
var l_spawnPosCenter : Vector;
var cameraDir : Vector;
var l_npcPos : Vector;
var l_targetPos : Vector;
var posFin : Vector;
var l_normal : Vector;
var l_spawnVectorFromTarget : Vector;
var l_summonedEntity : CEntity;

var l_npc : CNewNPC;


var l_target : CActor;
var l_rot : EulerAngles;
var l_angleBetweenSpawns : Float;
var l_angleCur : Float;
var i : Int32;
var sign : Int32;
var s : Float;
var l_radius : Float;
var x : Float;
var y : Float;
var l_summonerComponent : W3SummonerComponent;
var l_summonedComponent : W3SummonedEntityComponent;
var l_splitEntity : CEntity;
var l_splitEntities : array<CEntity>;
var l_spawnedDoppel : Int32;
var l_lastLocalTime : Float;
var l_deltaTime : Float;
var l_slideComponent : W3SlideToTargetComponent;
var l_actorsInRange : array<CActor>;
var l_maxDelay : Float;
l_npc = GetNPC();
l_target = l_npc.GetTarget();
LoadResources();
if (!IsNameValid(summonOnAnimEvent)){
m_shouldSummon = true;
}
while (!m_hasSummoned){
if (m_shouldSummon == true){
l_npcPos = l_npc.GetWorldPosition();
l_targetPos = l_target.GetWorldPosition();
l_summonerComponent = (W3SummonerComponent)l_npc
.GetComponentByClassName('W3SummonerComponent');
switch(summonPositionPattern){
case 0:
l_spawnPosCenter = l_targetPos;
break;
case 1:
l_spawnPosCenter = l_npcPos;
break;
}
if (!theGame.GetWorld().NavigationCircleTest(l_s
pawnPosCenter, 0.700000, /* NOP */)){
theGame.GetWorld().NavigationFindSafeSpo
t(l_spawnPosCenter, 1, 10, l_spawnPosCenter);
}
if (applyBlindnessRange > 0){
l_actorsInRange = GetActorsInRange(l_npc
, applyBlindnessRange, /* NOP */, /* NOP */, true);
i = 0;
while (i < l_actorsInRange.Size()){
l_actorsInRange[i].AddEffectDefa
ult(14, l_npc, /* NOP */, /* NOP */);
i += 1;
}
}
posFin.Z = l_spawnPosCenter.Z;
l_radius = summonMaxDistance - summonMinDistance
;
l_angleBetweenSpawns = 2.000000 * Pi() / numberT

oSummon;
l_angleCur = RandF() * 2.000000 * Pi();
l_splitEntities.Resize(numberToSummon);
i = 0;
while (i < numberToSummon){
posFin = l_spawnPosCenter + Vector(summo
nMinDistance + RandF() * l_radius * CosF(l_angleCur), summonMinDistance * SinF(l
_angleCur), 0.000000);
l_angleCur += l_angleBetweenSpawns;
theGame.GetWorld().NavigationFindSafeSpo
t(posFin, 1, 10, posFin);
m_createEntityHelper.Reset();
theGame.CreateEntityAsync(m_createEntity
Helper, splitEffectEntityTemplate, l_npcPos, l_rot, true, false, false, 0, /* NO
P */);
while (m_createEntityHelper.IsCreating()
){
SleepOneFrame();
l_maxDelay += 1;
if (l_maxDelay >= 120){
return 2;
}
}
l_splitEntity = m_createEntityHelper.Get
CreatedEntity();
l_slideComponent = (W3SlideToTargetCompo
nent)l_splitEntity.GetComponentByClassName('W3SlideToTargetComponent');
l_slideComponent.SetTargetVector(posFin)
;
l_slideComponent.SetSpeed(1);
l_slideComponent.SetStopDistance(0.50000
0);
l_slideComponent.SetTriggerOnTarget(true
);
l_slideComponent.SetDestroyDelayAtDest(5
);
l_splitEntities[i] = l_splitEntity;
i += 1;
}
while (l_spawnedDoppel < numberToSummon){
l_lastLocalTime = GetLocalTime();
SleepOneFrame();
l_deltaTime = GetLocalTime() - l_lastLoc
alTime;
i = l_splitEntities.Size() - 1;
while (i >= 0){
l_splitEntity = l_splitEntities[
i];
l_slideComponent = (W3SlideToTar
getComponent)l_splitEntity.GetComponentByClassName('W3SlideToTargetComponent');
if (l_slideComponent.IsAtDestina
tion()){
l_rot = VecToRotation(l_
targetPos - l_splitEntity.GetWorldPosition());
m_createEntityHelper.Res
et();
theGame.CreateEntityAsyn
c(m_createEntityHelper, entityToSummon, l_splitEntity.GetWorldPosition(), l_rot,
true, false, false, 0, /* NOP */);
l_maxDelay = 0;

while (m_createEntityHel
per.IsCreating()){
SleepOneFrame();
l_maxDelay += 1;
if (l_maxDelay >
= 120){
return 2
;
}
}
l_summonedEntity = m_cre
ateEntityHelper.GetCreatedEntity();
if (l_summonerComponent)
{
l_summonerCompon
ent.AddEntity(l_summonedEntity);
}
l_summonedComponent = (W
3SummonedEntityComponent)l_summonedEntity.GetComponentByClassName('W3SummonedEnt
ityComponent');
if (l_summonedComponent)
{
l_summonedCompon
ent.Init(GetNPC());
}
l_spawnedDoppel += 1;
l_splitEntities.EraseFas
t(i);
}
i -= 1;
}
}
l_npc.SignalGameplayEvent('SummonedDoppelgangers
');
m_hasSummoned = true;
}
SleepOneFrame();
}
return 2;
/* NOP */;
}
private final latent function LoadResources(){
if (IsNameValid(entityToSummonName)){
entityToSummon = (CEntityTemplate)LoadResourceAsync(enti
tyToSummonName, /* NOP */);
if (!entityToSummon){
/* NOP */;
}
}
/* NOP */;
}
private final function OnDeactivate(){
m_hasSummoned = false;
/* NOP */;
}
public final function OnAnimEvent(animEventName : CName, animEventType :
EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == summonOnAnimEvent){
m_shouldSummon = true;
m_hasSummoned = false;

return true;
}
return OnAnimEvent(animEventName, animEventType, animInfo);
/* NOP */;
}
}
import abstract class CSplineAnimationCompression{
}
class CBTTaskWyvernTakeOffEffect extends CBTTaskPlayAnimationEventDecorator{
public var effectRange : Float;
public var effectAngle : Float;
public var eventReceived : Bool;
public latent function Main() : EBTNodeStatus{
var action : W3DamageAction;
var npc : CNewNPC;
var target : CActor;
var npcPos : Vector;
var targetPos : Vector;
var dist : Float;
var angle : Float;
npc = GetNPC();
target = npc.GetTarget();
while (true){
if (eventReceived){
npcPos = npc.GetWorldPosition();
targetPos = target.GetWorldPosition();
angle = AbsF(AngleDistance(npc.GetHeading(), Vec
Heading(targetPos - npcPos)));
dist = VecDistanceSquared(npcPos, targetPos);
if (dist <= effectRange * effectRange && angle <
= effectAngle){
action = new W3DamageAction in this;
action.Initialize(npc, target, npc, npc
+ "'s dust attack", 0, 0, false, false, false, false, /* NOP */, /* NOP */, /* N
OP */, /* NOP */);
action.SetHitAnimationPlayType(2);
action.AddEffectInfo(52, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
GCameraShake(0.500000, false, target.Get
WorldPosition(), 10.000000, /* NOP */, /* NOP */, /* NOP */);
if (target == thePlayer){
target.PlayEffect('radial_blur',
/* NOP */);
}
}
eventReceived = false;
}
Sleep(0.100000);
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'ApplyBlind'){
eventReceived = true;

return true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
}
import abstract class CAnimationFpsCompression{
}
import abstract class CSourceTexture{
}
import abstract class CBitmapTexture{
}
import abstract class CTextureArray{
}
import abstract class CFont{
}
class CBTTaskFlyPursueTarget extends IBehTreeTask{
public var useCustom : Bool;
public var distanceFromTarget : Float;
public var heightFromTarget : Float;
public var distanceTolerance : Float;
public var predictPositionTime : Float;
public var multiplyPredictTimeByDistance : Float;
public var npcPosition : Vector;
public var targetPosition : Vector;
public var npcToTargetDistance2D : Float;
public var movePos : Vector;
public var cachedTime : Float;
public var randomHeight : Int32;
public var randomVectorFromTarget : Vector;
public var flySpeed : Float;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
npc = GetNPC();
target = npc.GetTarget();
if (!useCustom){
randomVectorFromTarget = VecRingRand(20.000000, 25.00000
0);
randomVectorFromTarget.Z = randomVectorFromTarget.Z + 2.
000000 + RandRange(13, /* NOP */);
}
cachedTime = GetLocalTime();
npc.GetMovingAgentComponent().SnapToNavigableSpace(false);
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var npcToMovePosVector : Vector;
var npcToMovePosVector2 : Vector;
var flyPitch : Float;

var flyYaw : Float;


var localTime : Float;
var turnSpeedScale : Float;
var npcToMovePosDistance : Float;
var npcToTargetHeight : Float;
var attackerToTargetAngle : Float;
var targetToNpcVector : Vector;
var positionOnPath : Vector;
npc = GetNPC();
target = npc.GetTarget();
while (true){
if (predictPositionTime <= 0){
targetPosition = target.GetWorldPosition();
} else {
targetPosition = target.PredictWorldPosition(pre
dictPositionTime);
}
npcPosition = npc.GetWorldPosition();
if (useCustom){
targetToNpcVector = npcPosition - targetPosition
;
targetToNpcVector.Z = 0;
movePos = VecNormalize(targetToNpcVector) * dist
anceFromTarget + targetPosition;
movePos.Z = movePos.Z + heightFromTarget;
} else {
movePos = targetPosition + randomVectorFromTarge
t;
}
positionOnPath = movePos;
if (theGame.GetVolumePathManager().IsPathfindingNeeded(n
pcPosition, movePos)){
positionOnPath = theGame.GetVolumePathManager().
GetPointAlongPath(npcPosition, movePos, 2.000000, /* NOP */);
}
movePos = positionOnPath;
if (targetPosition.Z - npcPosition.Z >= 5.000000){
movePos = npcPosition;
movePos.Z = movePos.Z + 15.000000;
}
npcToMovePosVector = movePos - npcPosition;
npcToMovePosVector2 = npcToMovePosVector;
npcToMovePosVector2.Z = 0;
npcToMovePosDistance = VecDistance(npcPosition, movePos)
;
if (npcToMovePosDistance <= 20.000000){
flySpeed = 1.000000;
turnSpeedScale = 2.000000;
} else {
flySpeed = 2.000000;
turnSpeedScale = 1.500000;
}
if (useCustom){
if (npcToMovePosDistance <= 20.000000){
attackerToTargetAngle = AbsF(AngleDistan
ce(VecHeading(targetPosition - npc.GetWorldPosition()), VecHeading(npc.GetHeadin
gVector())));
if (attackerToTargetAngle > 60 || attack
erToTargetAngle < -60){
flySpeed = 1.000000;

} else {
flySpeed = 2.000000;
}
}
turnSpeedScale = 3.000000;
}
flyPitch = Rad2Deg(AcosF(VecDot(VecNormalize(npcToMovePo
sVector), VecNormalize(npcToMovePosVector2))));
if (npcPosition.X == movePos.X && npcPosition.Y == moveP
os.Y){
flyPitch = 90;
}
flyPitch = flyPitch / 90;
flyPitch = flyPitch * PowF(turnSpeedScale, flyPitch);
if (flyPitch > 1){
flyPitch = 1.000000;
} else if (flyPitch < -1){
flyPitch = -1.000000;
}
if (movePos.Z < npcPosition.Z){
flyPitch *= -1;
}
flyYaw = AngleDistance(VecHeading(npcToMovePosVector), V
ecHeading(npc.GetHeadingVector()));
flyYaw = flyYaw / 180;
flyYaw = flyYaw * PowF(turnSpeedScale, AbsF(flyYaw));
if (flyYaw > 1){
flyYaw = 1.000000;
} else if (flyYaw < -1){
flyYaw = -1.000000;
}
npc.SetBehaviorVariable('FlyYaw', flyYaw, /* NOP */);
npc.SetBehaviorVariable('FlyPitch', flyPitch, /* NOP */)
;
npc.SetBehaviorVariable('FlySpeed', flySpeed, /* NOP */)
;
localTime = GetLocalTime();
if (useCustom){
npcToTargetDistance2D = VecDistance2D(npcPositio
n, targetPosition);
npcToTargetHeight = npcPosition.Z - targetPositi
on.Z;
if (npcToTargetDistance2D <= distanceFromTarget
+ distanceTolerance && npcToTargetDistance2D >= distanceFromTarget - distanceTol
erance && npcToTargetHeight <= heightFromTarget + distanceTolerance && npcToTarg
etHeight >= heightFromTarget - distanceTolerance){
return 2;
}
} else if (localTime >= cachedTime + 4){
cachedTime = localTime;
movePos = targetPosition + VecRingRand(5.000000,
12.000000);
movePos.Z = movePos.Z + heightFromTarget + RandR
ange(randomHeight, /* NOP */);
}
npc.GetVisualDebug().AddSphere('destination', 1.000000,
movePos, true, Color(0, 0, 255), 0.200000);
Sleep(0.100000);
}
return 2;

/* NOP */;
}
public function DoTrace(movePos : Vector){
var groundPosition : Vector;
var offsetGroundPosition : Vector;
var ceilingPosition : Vector;
var ceilingTrace : Vector;
var normal : Vector;
var npc : CNewNPC;
var vecDiff : Vector;
npc = GetNPC();
npc.GetMovingAgentComponent().GetPathPointInDistance(10.000000,
groundPosition);
offsetGroundPosition = groundPosition;
offsetGroundPosition.Z += 1.500000;
ceilingTrace = offsetGroundPosition;
ceilingTrace.Z += 20.000000;
if (!theGame.GetWorld().StaticTrace(ceilingTrace, offsetGroundPo
sition, ceilingPosition, normal, /* NOP */)){
movePos = groundPosition;
movePos.Z += heightFromTarget + randomHeight;
} else {
movePos = groundPosition;
vecDiff = ceilingPosition - groundPosition;
if (vecDiff.Z < heightFromTarget + randomHeight + 3){
movePos.Z += vecDiff.Z / 2.000000;
} else {
movePos.Z += heightFromTarget + randomHeight;
}
}
npc.GetVisualDebug().AddSphere('ground', 1.000000, offsetGroundP
osition, true, Color(255, 0, 0), 0.200000);
npc.GetVisualDebug().AddLine('line', offsetGroundPosition, ceili
ngTrace, true, Color(255, 0, 0), 0.200000);
npc.GetVisualDebug().AddSphere('ceiling', 1.000000, ceilingPosit
ion, true, Color(0, 255, 0), 0.200000);
npc.GetVisualDebug().AddSphere('destination', 1.000000, movePos,
true, Color(0, 0, 255), 0.200000);
/* NOP */;
}
public function OnDeactivate(){
GetNPC().GetMovingAgentComponent().SnapToNavigableSpace(true);
/* NOP */;
}
}
class W3PotionParams extends W3BuffCustomParams{
public var potionItemName : CName;
}
class CBTTaskUnderwaterPursueTarget extends IBehTreeTask{
public var useCustom : Bool;
public var distanceFromTarget : Float;
public var heightFromTarget : Float;
public var distanceTolerance : Float;
public var npcPosition : Vector;
public var targetPosition : Vector;
public var npcToTargetDistance2D : Float;
public var movePos : Vector;
public var cachedTime : Float;

public var randomHeight : Int32;


public var flySpeed : Float;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
npc = GetNPC();
target = npc.GetTarget();
if (!useCustom){
movePos = target.GetWorldPosition() + VecRingRand(20.000
000, 25.000000);
movePos.Z = movePos.Z + 2.000000 + RandRange(13, /* NOP
*/);
}
cachedTime = GetLocalTime();
npc.GetMovingAgentComponent().SnapToNavigableSpace(false);
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var npcToMovePosVector : Vector;
var npcToMovePosVector2 : Vector;
var flyPitch : Float;
var flyYaw : Float;
var localTime : Float;
var turnSpeedScale : Float;
var npcToMovePosDistance : Float;
var npcToTargetHeight : Float;
var attackerToTargetAngle : Float;
var targetToNpcVector : Vector;
var world : CWorld;
var waterLevel : Float;
npc = GetNPC();
target = npc.GetTarget();
world = theGame.GetWorld();
while (true){
targetPosition = target.GetWorldPosition();
npcPosition = npc.GetWorldPosition();
waterLevel = world.GetWaterLevel(npcPosition, /* NOP */)
;
movePos = theGame.GetVolumePathManager().GetPointAlongPa
th(npcPosition, targetPosition + Vector(0.000000, 0.000000, 1.500000), 2.000000,
waterLevel - 4);
npcToMovePosVector = movePos - npcPosition;
npcToMovePosVector2 = npcToMovePosVector;
npcToMovePosVector2.Z = 0;
npcToMovePosDistance = VecDistance(npcPosition, movePos)
;
if (npcToMovePosDistance <= 20.000000){
flySpeed = 1.000000;
turnSpeedScale = 2.000000;
} else {
flySpeed = 2.000000;
turnSpeedScale = 1.500000;
}
if (useCustom){
if (npcToMovePosDistance <= 20.000000){
attackerToTargetAngle = AbsF(AngleDistan
ce(VecHeading(targetPosition - npc.GetWorldPosition()), VecHeading(npc.GetHeadin

gVector())));
if (attackerToTargetAngle > 60 || attack
erToTargetAngle < -60){
flySpeed = 1.000000;
} else {
flySpeed = 2.000000;
}
}
turnSpeedScale = 3.000000;
}
flyPitch = Rad2Deg(AcosF(VecDot(VecNormalize(npcToMovePo
sVector), VecNormalize(npcToMovePosVector2))));
if (npcPosition.X == movePos.X && npcPosition.Y == moveP
os.Y){
flyPitch = 90;
}
flyPitch = flyPitch / 90;
flyPitch = flyPitch * PowF(turnSpeedScale, flyPitch);
if (flyPitch > 1){
flyPitch = 1.000000;
} else if (flyPitch < -1){
flyPitch = -1.000000;
}
if (movePos.Z < npcPosition.Z){
flyPitch *= -1;
}
flyYaw = AngleDistance(VecHeading(npcToMovePosVector), V
ecHeading(npc.GetHeadingVector()));
flyYaw = flyYaw / 180;
flyYaw = flyYaw * PowF(turnSpeedScale, AbsF(flyYaw));
if (flyYaw > 1){
flyYaw = 1.000000;
} else if (flyYaw < -1){
flyYaw = -1.000000;
}
npc.SetBehaviorVariable('FlyYaw', flyYaw, /* NOP */);
npc.SetBehaviorVariable('FlyPitch', flyPitch, /* NOP */)
;
npc.SetBehaviorVariable('FlySpeed', flySpeed, /* NOP */)
;
localTime = GetLocalTime();
if (useCustom){
npcToTargetDistance2D = VecDistance2D(npcPositio
n, targetPosition);
npcToTargetHeight = npcPosition.Z - targetPositi
on.Z;
if (npcToTargetDistance2D <= distanceFromTarget
+ distanceTolerance && npcToTargetDistance2D >= distanceFromTarget - distanceTol
erance && npcToTargetHeight <= heightFromTarget + distanceTolerance && npcToTarg
etHeight >= heightFromTarget - distanceTolerance){
return 2;
}
} else if (localTime >= cachedTime + 4){
cachedTime = localTime;
movePos = targetPosition + VecRingRand(5.000000,
12.000000);
movePos.Z = movePos.Z + heightFromTarget + RandR
ange(randomHeight, /* NOP */);
}
npc.GetVisualDebug().AddSphere('destination', 1.000000,

movePos, true, Color(0, 0, 255), 0.200000);


Sleep(0.100000);
}
return 2;
/* NOP */;
}
public function DoTrace(movePos : Vector){
var groundPosition : Vector;
var offsetGroundPosition : Vector;
var ceilingPosition : Vector;
var ceilingTrace : Vector;
var normal : Vector;
var npc : CNewNPC;
var vecDiff : Vector;
npc = GetNPC();
npc.GetMovingAgentComponent().GetPathPointInDistance(10.000000,
groundPosition);
offsetGroundPosition = groundPosition;
offsetGroundPosition.Z += 1.500000;
ceilingTrace = offsetGroundPosition;
ceilingTrace.Z += 20.000000;
if (!theGame.GetWorld().StaticTrace(ceilingTrace, offsetGroundPo
sition, ceilingPosition, normal, /* NOP */)){
movePos = groundPosition;
movePos.Z += heightFromTarget + randomHeight;
} else {
movePos = groundPosition;
vecDiff = ceilingPosition - groundPosition;
if (vecDiff.Z < heightFromTarget + randomHeight + 3){
movePos.Z += vecDiff.Z / 2.000000;
} else {
movePos.Z += heightFromTarget + randomHeight;
}
}
npc.GetVisualDebug().AddSphere('ground', 1.000000, offsetGroundP
osition, true, Color(255, 0, 0), 0.200000);
npc.GetVisualDebug().AddLine('line', offsetGroundPosition, ceili
ngTrace, true, Color(255, 0, 0), 0.200000);
npc.GetVisualDebug().AddSphere('ceiling', 1.000000, ceilingPosit
ion, true, Color(0, 255, 0), 0.200000);
npc.GetVisualDebug().AddSphere('destination', 1.000000, movePos,
true, Color(0, 0, 255), 0.200000);
/* NOP */;
}
public function OnDeactivate(){
GetNPC().GetMovingAgentComponent().SnapToNavigableSpace(true);
/* NOP */;
}
}
import abstract class CEffectEntity{
}
import abstract class PersistentRef{
}
class TaskTeleportAction extends IBehTreeTask{
public var teleportType : ETeleportType;
public var teleportToRequestedFacingDirection : Bool;
public var teleportAwayFromRequestedFacingDirection : Bool;

public var teleportOutsidePlayerFOV : Bool;


public var teleportBehindTarget : Bool;
public var requestedFacingDirectionNoiseAngle : Float;
public var minDistance : Float;
public var maxDistance : Float;
public var setIsTeleportingFlag : Bool;
public var minWaterDepthToAppear : Float;
public var maxWaterDepthToAppear : Float;
public var zTolerance : Float;
public var testLOSforNewPosition : Bool;
public var testNavigationBetweenCombatTargetAndNewPosition : Bool;
public var overrideActorRadiusForNavigationTests : Bool;
public var actorRadiusForNavigationTests : Float;
public var checkWaterLevel : Bool;
public var searchingTimeout : Float;
public var nodeTag : CName;
public var shouldSpawnMarkers : Bool;
public var useCombatTarget : Bool;
public var paramsOverriden : Bool;
public var cashedBool : Bool;
public var setInvulnerable : Bool;
protected var alreadyTeleported : Bool;
protected var isTeleporting : Bool;
protected var distFromLastTelePos : Float;
protected var dangerZone : Float;
protected var angle : Float;
protected var lastTelePos : Vector;
public function IsAvailable() : Bool{
var currTime : Float;
currTime = GetLocalTime();
if (useCombatTarget && !GetCombatTarget()){
return false;
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
if (setIsTeleportingFlag){
npc.SetIsTeleporting(true);
if (setInvulnerable){
npc.SetImmortalityMode(2, 2, /* NOP */);
}
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var newPosition : Vector;
var res : Bool;
var node : CNode;
if (teleportType == 6){
if (nodeTag == 'None'){
return 1;
}
node = theGame.GetNodeByTag(nodeTag);
if (node){
newPosition = node.GetWorldPosition();
res = true;

}
} else {
res = FindSuitablePoint(newPosition, searchingTimeout);
}
if (!res){
return 1;
}
if (shouldSpawnMarkers){
SpawnBlinkMarkers(GetNPC().GetWorldPosition(), newPositi
on);
}
PerformTeleport(newPosition);
alreadyTeleported = true;
return 2;
/* NOP */;
}
protected function PerformTeleport(newPosition : Vector){
var rotation : EulerAngles;
if (teleportType == 6){
rotation = theGame.GetNodeByTag(nodeTag).GetWorldRotatio
n();
GetNPC().TeleportWithRotation(newPosition, rotation);
} else if (GetCombatTarget()){
rotation = VecToRotation(GetCombatTarget().GetWorldPosit
ion() - newPosition);
rotation.Pitch = 0.000000;
rotation.Roll = 0.000000;
GetNPC().TeleportWithRotation(newPosition, rotation);
} else {
GetNPC().Teleport(newPosition);
}
lastTelePos = newPosition;
/* NOP */;
}
protected latent function FindSuitablePoint(newPosition : Vector, timeOu
t : Float) : Bool{
var whereTo : Vector;
var randVec : Vector;
var startTimeStamp : Float;
startTimeStamp = GetLocalTime();
randVec = CalculateRandVec();
whereTo = CalculateWhereToVec(randVec);
while (!IsPointSuitableForTeleport(whereTo)){
if (timeOut > 0 && startTimeStamp + timeOut < GetLocalTi
me()){
return false;
}
SleepOneFrame();
randVec = CalculateRandVec();
whereTo = CalculateWhereToVec(randVec);
}
newPosition = whereTo;
return true;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
if (setIsTeleportingFlag){
npc.SetIsTeleporting(false);

if (setInvulnerable){
npc.SetImmortalityMode(0, 2, /* NOP */);
}
}
if (paramsOverriden){
testNavigationBetweenCombatTargetAndNewPosition = cashed
Bool;
paramsOverriden = false;
}
isTeleporting = false;
/* NOP */;
}
protected function IsPointSuitableForTeleport(whereTo : Vector) : Bool{
var npc : CNewNPC;
var newPos : Vector;
var radius : Float;
var waterDepth : Float;
var z : Float;
npc = GetNPC();
if (overrideActorRadiusForNavigationTests){
radius = MaxF(0.010000, actorRadiusForNavigationTests);
} else {
radius = npc.GetRadius();
}
if (!theGame.GetWorld().NavigationFindSafeSpot(whereTo, radius,
radius * 3, newPos)){
if (theGame.GetWorld().NavigationComputeZ(whereTo, where
To.Z - zTolerance, whereTo.Z + zTolerance, z)){
whereTo.Z = z;
if (!theGame.GetWorld().NavigationFindSafeSpot(w
hereTo, radius, radius * 3, newPos)){
return false;
}
}
}
if (testNavigationBetweenCombatTargetAndNewPosition && testLOSfo
rNewPosition){
if (!theGame.GetWorld().NavigationLineTest(newPos, GetCo
mbatTarget().GetWorldPosition(), radius, /* NOP */, /* NOP */) && !theGame.GetWo
rld().NavigationLineTest(npc.GetWorldPosition(), newPos, radius, /* NOP */, /* N
OP */)){
return false;
}
} else {
if (testNavigationBetweenCombatTargetAndNewPosition && !
theGame.GetWorld().NavigationLineTest(newPos, GetCombatTarget().GetWorldPosition
(), radius, /* NOP */, /* NOP */)){
return false;
}
if (testLOSforNewPosition && !theGame.GetWorld().Navigat
ionLineTest(npc.GetWorldPosition(), newPos, radius, /* NOP */, /* NOP */)){
return false;
}
}
if (checkWaterLevel || minWaterDepthToAppear > 0){
waterDepth = theGame.GetWorld().GetWaterDepth(newPos, /*
NOP */);
if (waterDepth == 10000){
waterDepth = 0;
}

if (waterDepth > maxWaterDepthToAppear){


return false;
}
if (minWaterDepthToAppear > 0 && waterDepth < minWaterDe
pthToAppear){
return false;
}
}
whereTo = newPos;
return true;
/* NOP */;
}
private function CalculateWhereToVec(randVec : Vector) : Vector{
var whereTo : Vector;
var npc : CNewNPC;
var target : CNode;
npc = GetNPC();
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
if (teleportType == 5 || teleportType != 5 && !target){
whereTo = npc.GetWorldPosition() - randVec;
} else if (teleportBehindTarget){
whereTo = target.GetWorldPosition() + randVec;
} else if (teleportOutsidePlayerFOV){
whereTo = theCamera.GetCameraPosition() - randVec;
} else if (teleportType == 1 || teleportType == 3){
if (teleportToRequestedFacingDirection || teleportAwayFr
omRequestedFacingDirection){
whereTo = target.GetWorldPosition() + randVec;
} else {
whereTo = target.GetWorldPosition() - randVec;
}
} else if (teleportType == 0){
if (teleportToRequestedFacingDirection || teleportAwayFr
omRequestedFacingDirection){
whereTo = thePlayer.GetWorldPosition() + randVec
;
} else {
whereTo = thePlayer.GetWorldPosition() - randVec
;
}
} else {
whereTo = npc.GetWorldPosition() - randVec;
}
return whereTo;
/* NOP */;
}
private function CalculateRandVec() : Vector{
var randVec : Vector;
var npc : CNewNPC;
var target : CActor;
var cameraToPlayerDistance : Float;
var averageDistance : Float;
randVec = Vector(0.000000, 0.000000, 0.000000);
npc = GetNPC();
target = GetCombatTarget();
if (teleportToRequestedFacingDirection){

averageDistance = RandRangeF(minDistance, maxDistance);


requestedFacingDirectionNoiseAngle *= -1;
randVec = VecFromHeading(AngleNormalize180(npc.GetBehavi
orVariable('requestedFacingDirection', /* NOP */) + 180 + requestedFacingDirecti
onNoiseAngle)) * averageDistance;
} else if (teleportAwayFromRequestedFacingDirection){
averageDistance = RandRangeF(minDistance, maxDistance);
requestedFacingDirectionNoiseAngle *= -1;
randVec = VecFromHeading(AngleNormalize180(npc.GetBehavi
orVariable('requestedFacingDirection', /* NOP */) + requestedFacingDirectionNois
eAngle)) * averageDistance;
} else if (teleportType == 5){
randVec = VecRingRand(minDistance, maxDistance);
} else if (teleportBehindTarget){
randVec = VecConeRand(VecHeading(target.GetHeadingVector
()) + 180, 5, minDistance, maxDistance);
} else if (teleportOutsidePlayerFOV){
cameraToPlayerDistance = VecDistance(theCamera.GetCamera
Position(), thePlayer.GetWorldPosition());
if (cameraToPlayerDistance * 1.200000 > minDistance){
minDistance = cameraToPlayerDistance * 1.200000;
maxDistance = maxDistance + cameraToPlayerDistan
ce - minDistance * 1.200000;
} else {
randVec = VecConeRand(theCamera.GetCameraHeading
(), 45, minDistance, maxDistance);
}
} else if (teleportType == 3){
angle = NodeToNodeAngleDistance(npc.GetTarget(), npc);
if (alreadyTeleported){
distFromLastTelePos = VecDistance(lastTelePos, n
pc.GetWorldPosition());
minDistance = distFromLastTelePos - 2;
maxDistance = distFromLastTelePos + 2;
randVec = VecConeRand(angle, 30, minDistance, ma
xDistance);
} else {
randVec = VecRingRand(minDistance, maxDistance);
}
} else if (maxDistance != 0){
randVec = VecRingRand(minDistance, maxDistance);
}
return randVec;
/* NOP */;
}
private latent function SpawnBlinkMarkers(startPos : Vector, endPos : Ve
ctor){
var startEnt : CEntity;
var endEnt : CEntity;
var entityTemplate : CEntityTemplate;
entityTemplate = (CEntityTemplate)LoadResourceAsync('blink_marke
r', /* NOP */);
if (entityTemplate){
startEnt = theGame.CreateEntity(entityTemplate, startPos
, VecToRotation(endPos - startPos), /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
endEnt = theGame.CreateEntity(entityTemplate, endPos, Ve
cToRotation(startPos - endPos), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
}

startEnt.PlayEffect('disappear', /* NOP */);


endEnt.PlayEffect('appear', /* NOP */);
startEnt.DestroyAfter(2.000000);
endEnt.DestroyAfter(2.000000);
/* NOP */;
}
}
import abstract class CEntityGroup{
}
class CBTTaskTeleport extends TaskTeleportAction{
public var vanish : Bool;
public var forceInvisible : Bool;
public var disallowInPlayerFOV : Bool;
public var cameraToPlayerDistance : Float;
public var cooldown : Float;
public var nextTeleTime : Float;
public var delayActivation : Float;
public var delayReappearance : Float;
public var disableInvisibilityAfterReappearance : Bool;
public var disappearfxName : CName;
public var appearFXName : CName;
public var additionalAppearFXName : CName;
public var performPosCheckOnTeleportEventName : Bool;
public var performLastMomentPosCheck : Bool;
public var teleportEventName : CName;
public var raiseEventName : CName;
public var appearRaiseEventName : CName;
public var appearRaiseEventNameOnFailure : CName;
public var setBehVarNameOnRaiseEvent : CName;
public var setBehVarValueOnRaiseDisappearEvent : Float;
public var setBehVarValueOnRaiseAppearEvent : Float;
public var heading : Vector;
public var randVec : Vector;
public var playerPos : Vector;
public var whereTo : Vector;
public var canBeStrafed : Bool;
public var appearFXPlayed : Bool;
public var appearRaiseEventLaunched : Bool;
public var disappearRaiseEventLaunched : Bool;
public var shouldPlayHitAnim : Bool;
public function IsAvailable() : Bool{
var currTime : Float;
currTime = GetLocalTime();
super.IsAvailable();
if (isActive){
return true;
}
if (nextTeleTime > 0 && nextTeleTime > currTime){
return false;
}
if (disallowInPlayerFOV){
if (!ActorInPlayerFOV()){
return true;
} else {
return false;
}
} else {
return true;

}
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
npc.SetIsTeleporting(true);
if (setInvulnerable){
npc.SetImmortalityMode(2, 2, /* NOP */);
}
npc.AddBuffImmunity_AllNegative('teleport', true);
npc.SetCanPlayHitAnim(shouldPlayHitAnim);
appearFXPlayed = false;
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var newPosition : Vector;
var res : Bool;
npc = GetNPC();
target = GetCombatTarget();
appearRaiseEventLaunched = false;
disappearRaiseEventLaunched = false;
if (!performPosCheckOnTeleportEventName){
res = PosChecks(newPosition);
if (!res){
return 1;
}
}
if (delayActivation == 0){
npc.RaiseEvent(raiseEventName);
disappearRaiseEventLaunched = true;
if (IsNameValid(setBehVarNameOnRaiseEvent)){
npc.SetBehaviorVariable(setBehVarNameOnRaiseEven
t, setBehVarValueOnRaiseDisappearEvent, true);
}
if (IsNameValid(disappearfxName)){
npc.PlayEffect(disappearfxName, /* NOP */);
}
}
res = false;
isTeleporting = true;
npc.SetGameplayVisibility(false);
if (delayActivation > 0){
Sleep(delayActivation);
npc.RaiseEvent(raiseEventName);
disappearRaiseEventLaunched = true;
if (IsNameValid(setBehVarNameOnRaiseEvent)){
npc.SetBehaviorVariable(setBehVarNameOnRaiseEven
t, setBehVarValueOnRaiseDisappearEvent, true);
}
if (IsNameValid(disappearfxName)){
npc.PlayEffect(disappearfxName, /* NOP */);
Sleep(0.100000);
}
}
if (teleportEventName){
while (!vanish){

Sleep(0.010000);
}
if (performPosCheckOnTeleportEventName){
res = PosChecks(newPosition);
if (!res){
return 1;
}
}
if (forceInvisible){
npc.SetVisibility(false);
}
}
if (delayReappearance > 0){
if (forceInvisible && !IsNameValid(teleportEventName)){
npc.SetVisibility(false);
}
npc.EnableCharacterCollisions(false);
Sleep(delayReappearance);
if (performLastMomentPosCheck){
res = PosChecks(newPosition);
if (!res){
return 1;
}
}
SafeTeleport(newPosition);
if (IsNameValid(appearRaiseEventName)){
npc.RaiseEvent(appearRaiseEventName);
appearRaiseEventLaunched = true;
if (IsNameValid(setBehVarNameOnRaiseEvent)){
npc.SetBehaviorVariable(setBehVarNameOnR
aiseEvent, setBehVarValueOnRaiseAppearEvent, true);
}
}
} else {
if (performLastMomentPosCheck){
res = PosChecks(newPosition);
if (!res){
return 1;
}
}
SafeTeleport(newPosition);
}
if (IsNameValid(appearFXName)){
appearFXPlayed = true;
npc.PlayEffect(appearFXName, /* NOP */);
}
if (IsNameValid(additionalAppearFXName)){
appearFXPlayed = true;
npc.PlayEffect(additionalAppearFXName, /* NOP */);
}
if (disableInvisibilityAfterReappearance){
if (forceInvisible){
npc.SetVisibility(true);
}
}
if (IsNameValid(appearRaiseEventName)){
npc.WaitForBehaviorNodeDeactivation(appearRaiseEventName
, 2.000000);
}
nextTeleTime = GetLocalTime() + cooldown;

alreadyTeleported = true;
SleepOneFrame();
return 2;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
npc.SetCanPlayHitAnim(true);
npc.SetBehaviorVariable('teleport_on_hit', 0, true);
if (isTeleporting){
isTeleporting = false;
vanish = false;
}
if (!appearFXPlayed){
if (IsNameValid(additionalAppearFXName)){
npc.PlayEffect(additionalAppearFXName, /* NOP */
);
} else if (IsNameValid(appearFXName)){
npc.PlayEffect(appearFXName, /* NOP */);
}
}
if (forceInvisible){
npc.SetVisibility(true);
}
if (teleportEventName){
npc.SetGameplayVisibility(true);
}
if (delayReappearance > 0 || disableInvisibilityAfterReappearanc
e){
npc.EnableCharacterCollisions(true);
npc.SetGameplayVisibility(true);
}
npc.SetIsTeleporting(false);
if (setInvulnerable){
npc.SetImmortalityMode(0, 2, /* NOP */);
}
npc.RemoveBuffImmunity_AllNegative('teleport');
/* NOP */;
}
public function OnCompletion(success : Bool){
if (!success && IsNameValid(appearRaiseEventNameOnFailure) && di
sappearRaiseEventLaunched && !appearRaiseEventLaunched){
GetNPC().RaiseEvent(appearRaiseEventNameOnFailure);
}
/* NOP */;
}
public latent function PosChecks(pos : Vector) : Bool{
var l_res : Bool;
l_res = FindSuitablePoint(pos, 0.500000);
if (!l_res){
paramsOverriden = true;
cashedBool = testNavigationBetweenCombatTargetAndNewPosi
tion;
testNavigationBetweenCombatTargetAndNewPosition = false;
l_res = FindSuitablePoint(pos, 0.100000);
if (!l_res){
return false;
}
}

return true;
/* NOP */;
}
public latent function SafeTeleport(pos : Vector) : Bool{
var l_rotation : EulerAngles;
var npc : CNewNPC;
npc = GetNPC();
if (GetCombatTarget()){
l_rotation = VecToRotation(GetCombatTarget().GetWorldPos
ition() - pos);
l_rotation.Pitch = 0.000000;
l_rotation.Roll = 0.000000;
npc.TeleportWithRotation(pos, l_rotation);
} else {
npc.Teleport(pos);
}
lastTelePos = pos;
return true;
/* NOP */;
}
public function ActorInPlayerFOV() : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (thePlayer.WasVisibleInScaledFrame(npc, 1.150000, 1.150000)){
return true;
}
return false;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == teleportEventName){
vanish = true;
return true;
}
return false;
/* NOP */;
}
}
import struct CGameplayEntityParam{
}
import abstract class CEntityTemplateParam{
}
import abstract class CTemplateListParam{
}
import abstract class CCharacterControllerParam{
}
class CBTTaskVolumetricFlyAroundTarget extends CBTTaskVolumetricMove{
public var distance : Float;
public var height : Float;
public var flightMaxDuration : Float;
public var npcToDestDistance : Float;
public var flightStartTime : Float;
public var flightDuration : Float;
public latent function Main() : EBTNodeStatus{

npc = GetNPC();
TargetSelection();
UpdatePositions();
UpdateTargetToNpcVec();
FlyAroundSetInitialDest();
StartFlightTimeCounting();
while (true){
UpdatePositions();
UpdateNpcToDestDistance();
if (npcToDestDistance < 8.000000){
UpdateTargetToNpcVec();
FlyAroundSetDest();
}
UsePathfinding(npcPos, dest, 2.000000);
CalculateBehaviorVariables(dest);
Sleep(0.100000);
if (CheckFlightTime()){
return 2;
}
}
return 0;
/* NOP */;
}
public function UpdateTargetToNpcVec(){
CalculateTargetToNpcVec();
targetToNpcVec.Z = 0;
/* NOP */;
}
public function FlyAroundSetInitialDest(){
dest = targetPos + VecNormalize(targetToNpcVec) * distance;
dest.Z += height;
/* NOP */;
}
public function FlyAroundSetDest(){
dest = targetPos + VecNormalize(targetToNpcVec) * distance + Vec
Normalize(npc.GetHeadingVector()) * 10.000000;
if (dest.Z < height){
dest.Z += height;
}
/* NOP */;
}
public function StartFlightTimeCounting(){
flightStartTime = GetLocalTime();
/* NOP */;
}
public function CheckFlightTime() : Bool{
flightDuration = GetLocalTime();
if (flightDuration > flightStartTime + flightMaxDuration && flig
htMaxDuration != -1.000000){
return true;
} else {
return false;
}
/* NOP */;
}
public function UpdateNpcToDestDistance(){
npcToDestDistance = VecDistance(npcPos, dest);
/* NOP */;
}
}

import abstract class SControllerRadiusParams{


}
import abstract class SVirtualControllerParams{
}
import abstract class CMovableRepresentationCreator{
}
import struct CCameraDirector{
import public final function ViewCoordsToWorldVector(x : Int32, y : Int3
2, rayStart : Vector, rayDirection : Vector);
import public final function WorldVectorToViewCoords(worldPos : Vector,
x : Int32, y : Int32);
import public final function WorldVectorToViewRatio(worldPos : Vector, x
: Float, y : Float) : Bool;
import public final function GetCameraPosition() : Vector;
import public final function GetCameraRotation() : EulerAngles;
import public final function GetCameraForward() : Vector;
import public final function GetCameraRight() : Vector;
import public final function GetCameraUp() : Vector;
import public final function GetCameraHeading() : Float;
import public final function GetCameraDirection() : Vector;
import public final function GetFov() : Float;
import public final function GetTopmostCameraObject() : IScriptable;
public function GetCameraForwardOnHorizontalPlane() : Vector{
var l_ForwardV : Vector;
l_ForwardV = super.GetCameraForward();
l_ForwardV.Z = 0.000000;
return VecNormalize(l_ForwardV);
/* NOP */;
}
}
import struct CCamera{
public var cameraState : ECameraState;
import public final function Rotate(leftRightDelta : Float, upDownDelta
: Float);
import public final function Follow(dest : CEntity);
import public final function FollowWithRotation(dest : CEntity);
import public final function LookAt(target : CNode, duration : Float, ac
tivatingTime : Float);
import public final function LookAtStatic(staticTarget : Vector, duratio
n : Float, activatingTime : Float);
import public final function LookAtBone(target : CAnimatedComponent, bon
eName : String, duration : Float, activatingTime : Float);
import public final function LookAtDeactivation(deactivatingTime : Float
);
import public final function HasLookAt() : Bool;
import public final function GetLookAtTargetPosition() : Vector;
import public final function FocusOn(target : CNode, duration : Float, a
ctivatingTime : Float);
import public final function FocusOnStatic(staticTarget : Vector, durati
on : Float, activatingTime : Float);
import public final function FocusOnBone(target : CAnimatedComponent, bo
neName : String, duration : Float, activatingTime : Float);
import public final function FocusDeactivation(deactivatingTime : Float)
;
import public final function IsFocused() : Bool;

import public final function GetFocusTargetPosition() : Vector;


import public final function SetActive(blendTime : Float);
import public final function IsActive() : Bool;
import public final function IsOnStack() : Bool;
import public final function GetCameraDirection() : Vector;
import public final function GetCameraPosition() : Vector;
import public final function GetCameraMatrixWorldSpace() : Matrix;
import public final function SetFov(fov : Float);
import public final function GetFov() : Float;
import public final function SetZoom(value : Float);
import public final function GetZoom() : Float;
import public final function Reset();
import public final function ResetRotation(smoothly : Bool, horizontal :
Bool, vertical : Bool, duration : Float);
import public final function ResetRotationTo(smoothly : Bool, horizontal
Angle : Float, verticalAngle : Float, duration : Float);
public final function SetCameraState(newState : ECameraState) : Bool{
var lCamState : Int32;
var ret : Bool;
lCamState = newState;
if (SetBehaviorVariable('cameraState', lCamState, /* NOP */)){
cameraState = newState;
return true;
}
return false;
/* NOP */;
}
public final function GetCameraState() : ECameraState{
return cameraState;
/* NOP */;
}
public final function CameraShakeLooped(strength : Float, cameraShakeTyp
e : ECameraShakeState){
SetBehaviorVariable('cameraShakeState', cameraShakeType, /* NOP
*/);
SetBehaviorVariable('cameraShakeLooped', strength, /* NOP */);
/* NOP */;
}
public final function GCameraShake(strength : Float, testDistance : Bool
, shakeEpicenter : Vector, maxDistance : Float){
var finalStrength : Float;
var distance : Float;
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
if (testDistance){
if (maxDistance <= 0){
maxDistance = 20.000000;
}
if (shakeEpicenter == Vector(0, 0, 0)){
shakeEpicenter = thePlayer.GetWorldPosition();
}
distance = VecDistance(shakeEpicenter, thePlayer.GetWorl
dPosition());
if (distance > maxDistance){
distance = maxDistance;
}
finalStrength = strength * 1 - distance / maxDistance;
} else {
finalStrength = strength;

}
SetBehaviorVariable('cameraShakeStrength', finalStrength, /* NOP
*/);
RaiseForceEvent('Shake');
if (camera){
if (finalStrength > 1){
finalStrength = 1.000000;
}
animation.animation = 'camera_shake_hit_lvl3_1';
animation.priority = 3;
animation.blendIn = 0.100000;
animation.blendOut = 0.100000;
animation.weight = finalStrength;
animation.speed = 1.000000;
animation.additive = true;
animation.reset = true;
camera.PlayAnimation(animation);
}
/* NOP */;
}
public final function SetCameraShakeState(newState : ECameraShakeState,
strength : Float) : Bool{
var res : Bool;
var res2 : Bool;
res = SetBehaviorVariable('cameraShakeState', newState, /* NOP *
/);
if (newState == 0){
strength = 0;
}
res2 = SetBehaviorVariable('cameraShakeStrength', strength, /* N
OP */);
return res && res2;
/* NOP */;
}
}
abstract class IBehTreePlayerTaskDefinition extends IBehTreeTaskDefinition{
}
import struct CStaticCamera{
//NULL type for deactivationDuration
//NULL type for activationDuration
//NULL type for fadeStartDuration
//NULL type for fadeEndDuration
import public final function Run() : Bool;
import public final latent function RunAndWait(timeout : Float) : Bool;
import public final function IsRunning() : Bool;
import public final function AutoDeactivating() : Bool;
import public final function Stop();
}
abstract class CBTTaskQuestDef extends IBehTreeTaskDefinition{
}
import abstract class CSoundAmbientEmitter{
}
import abstract class CMeshTypeResource{
}

class CBTTaskCheckAttitudes extends IBehTreeTask{


public var onlyHelpActorsFromTheSameAttidueGroup : Bool;
public var useReactionTarget : Bool;
public var owner : CActor;
public var sender : CActor;
public var sendersTarget : CActor;
public var attitudeToSender : EAIAttitude;
public var attitudeToSendersTarget : EAIAttitude;
public var senderAttitudeGroup : CName;
public var sendersTargetAttitudeGroup : CName;
public var ownerAttitudeGroup : CName;
private var actorToChangeAttitude : CActor;
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public function IsAvailable() : Bool{
var npc : CNewNPC;
var ownerNPC : CNewNPC;
owner = GetActor();
if (useReactionTarget){
sender = (CActor)GetNamedTarget('ReactionTarget');
} else {
sender = (CActor)GetActionTarget();
}
sendersTarget = sender.GetTarget();
if (!sender || !sender.IsAlive() || !sendersTarget || !sendersTa
rget.IsAlive()){
return false;
}
if (sender.GetAttitude(sendersTarget) != 2){
return false;
}
attitudeToSender = owner.GetAttitude(sender);
attitudeToSendersTarget = owner.GetAttitude(sendersTarget);
if (owner.HasBuff(36)){
if (sender == thePlayer){
actorToChangeAttitude = sendersTarget;
return true;
}
return false;
}
if (attitudeToSender == 0 && attitudeToSendersTarget == 0){
return false;
}
ownerAttitudeGroup = owner.GetAttitudeGroup();
senderAttitudeGroup = sender.GetAttitudeGroup();
sendersTargetAttitudeGroup = sendersTarget.GetAttitudeGroup();
ownerNPC = GetNPC();
if (ownerNPC && ownerNPC.GetNPCType() == 3){
npc = (CNewNPC)sendersTarget;
if (npc && sender == thePlayer && attitudeToSendersTarge
t != 0){
actorToChangeAttitude = sendersTarget;
if (actorToChangeAttitude == thePlayer){
return true;
}
return true;
}
npc = (CNewNPC)sender;
if (npc && sendersTarget == thePlayer && attitudeToSende
r != 0){

actorToChangeAttitude = sender;
if (actorToChangeAttitude == thePlayer){
return true;
}
return true;
}
}
if (attitudeToSendersTarget == 0 && senderAttitudeGroup != owner
AttitudeGroup && sendersTargetAttitudeGroup == ownerAttitudeGroup){
actorToChangeAttitude = sender;
if (actorToChangeAttitude == thePlayer){
return true;
}
return true;
} else if (attitudeToSender == 0 && sendersTargetAttitudeGroup !
= ownerAttitudeGroup && senderAttitudeGroup == ownerAttitudeGroup){
actorToChangeAttitude = sendersTarget;
if (actorToChangeAttitude == thePlayer){
return true;
}
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var owner : CActor;
owner = GetActor();
InitializeReactionDataStorage();
reactionDataStorage.NewTempHostileActor(owner, actorToChangeAtti
tude);
return 0;
/* NOP */;
}
public function OnCompletion(success : Bool){
reactionDataStorage.ResetAttitudes(GetActor());
/* NOP */;
}
public function InitializeReactionDataStorage(){
if (!reactionDataStorage){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageRe
actionData', this);
reactionDataStorage = (CAIStorageReactionData)storageHan
dler.Get();
}
/* NOP */;
}
}
import abstract class SMeshChunkPacked{
}
abstract class IBehTreeReactionTaskDefinition extends IBehTreeTaskDefinition{
}
import abstract class SMeshCookedData{
}
class CBTTaskIsAlarmed extends IBehTreeTask{

protected var storageHandler : CAIStorageHandler;


protected var reactionDataStorage : CAIStorageReactionData;
public function IsAvailable() : Bool{
return reactionDataStorage.IsAlarmed(GetLocalTime());
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
struct SDoTDamage{
saved var damageTypeName : CName;
saved var hitsVitality : Bool;
saved var hitsEssence : Bool;
saved var resistance : ECharacterDefenseStats;
}
import abstract class SMeshSoundInfo{
}
class CBTTaskIsAngry extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public function IsAvailable() : Bool{
return reactionDataStorage.IsAngry(GetLocalTime());
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
import abstract class CFurMeshResource{
}
class CBTTaskRainReaction extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public function IsAvailable() : Bool{
return true;
/* NOP */;

}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
return 2;
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
import abstract class CMergedWorldGeometry{
}
class CBTTaskReactionStorage extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public var onActivate : Bool;
public var onDeactivate : Bool;
public var onCompletion : Bool;
public var setIsAlarmed : Bool;
public var setTaunted : Bool;
public var reset : Bool;
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (onActivate){
DoStuff();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (onDeactivate){
DoStuff();
}
/* NOP */;
}
public function OnCompletion(success : Bool){
if (onDeactivate){
DoStuff();
}
/* NOP */;
}
public function DoStuff(){
if (setIsAlarmed){
reactionDataStorage.SetAlarmed(GetLocalTime());
}
if (setTaunted){
reactionDataStorage.IncreaseTauntCounter(GetLocalTime(),

GetNPC());
}
if (reset){
reactionDataStorage.Reset();
}
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
import abstract class IMergedWorldGeometryData{
}
class CBehTreeTaskReactionStorageCleanup extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
public function OnDeactivate(){
reactionDataStorage.Reset();
reactionDataStorage.ResetAttitudes(GetActor());
/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
class W3BuffDoTParams extends W3BuffCustomParams{
public var isEnvironment : Bool;
}
import abstract class CMergedWorldGeometryEntity{
}
class CBTTaskResetAttitudes extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var reactionDataStorage : CAIStorageReactionData;
public function OnActivate() : EBTNodeStatus{
reactionDataStorage.ResetAttitudes(GetActor());
return 0;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
reactionDataStorage.ResetAttitudes(GetActor());
return true;

/* NOP */;
}
public function Initialize(){
storageHandler = new CAIStorageHandler in this;
storageHandler.Initialize('ReactionData', '*CAIStorageReactionDa
ta', this);
reactionDataStorage = (CAIStorageReactionData)storageHandler.Get
();
/* NOP */;
}
}
import abstract class CMergedWorldGeometryGridCoordinates{
}
import abstract class CMergedMeshComponent{
}
import abstract class CMergedShadowMeshComponent{
}
import abstract class CMergedWorldGeometryShadowData{
}
import abstract class CSkeletalAnimationContainer{
}
import abstract class CMeshTypeComponent{
}
class CBTTaskSetReactionTarget extends IBehTreeTask{
public var useCombatTarget : Bool;
public function OnActivate() : EBTNodeStatus{
if (!useCombatTarget){
SetActionTarget(GetActionTarget());
} else {
SetActionTarget(GetCombatTarget());
}
return 2;
/* NOP */;
}
}
import struct CJobTree{
}
class W3Potion_Fact_Params extends W3PotionParams{
public var factName : CName;
}
import abstract class CMeshComponent{
}
import abstract class CMorphedMeshComponent{
}
class W3Potion_Fact extends CBaseGameplayEffect{
protected saved var fact : CName;
public function Init(params : SEffectInitInfo){
super.Init(params);

isPositive = false;
isNegative = false;
isNeutral = true;
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var params : W3Potion_Fact_Params;
super.OnEffectAdded(customParams);
params = (W3Potion_Fact_Params)customParams;
fact = params.factName;
effectNameLocalisationKey = "pot_name_" + fact;
effectDescriptionLocalisationKey = "pot_desc_" + fact;
FactsAdd(fact, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
FactsRemove(fact);
/* NOP */;
}
public function GetFactName() : CName{
return fact;
/* NOP */;
}
public function GetEffectNameLocalisationKey() : String{
return "effect_" + NameToString(fact);
/* NOP */;
}
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
var factPot : W3Potion_Fact;
factPot = (W3Potion_Fact)e;
if (factPot){
return 4;
}
return 3;
/* NOP */;
}
}
import struct CMorphedMeshManagerComponent{
import public final function SetMorphBlend(morphRatio : Float, blendtime
: Float);
import public final function GetMorphBlend() : Float;
}
import abstract class SFlareParameters{
}
import abstract class SLensFlareElementParameters{
}
import abstract class SLensFlareParameters{
}
import abstract class CFlareComponent{
}
import abstract class CWindowComponent{
}

import abstract class CWaterComponent{


}
import abstract class CWindAreaComponent{
}
import abstract class CDaycycleGraphicsEntity{
}
abstract class CBTTaskRidingManagerVehicleMount extends IBehTreeTask{
protected var mountType : CName;
public var aiStorageHandler : CAIStorageHandler;
public var attachSlot : CName;
public function OnActivate() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
var vehicleComponent : CVehicleComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
vehicleComponent = GetVehicleComponent();
if (!vehicleComponent || vehicleComponent.IsMountingPossible() =
= false){
return 1;
}
return 0;
/* NOP */;
}
public function GetVehicleComponent() : CVehicleComponent{
return NULL;
/* NOP */;
}
public latent function OnMountStarted(riderData : CAIStorageRiderData, b
ehGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var behaviorsToActivate : array<CName>;
var preloadResult : Bool;
riderActor = GetActor();
preloadResult = true;
vehicleComponent.OnMountStarted(riderActor, riderData.sharedPara
ms.vehicleSlot);
riderActor.SetUsedVehicle((CGameplayEntity)vehicleComponent.GetE
ntity());
behaviorsToActivate.PushBack(behGraphName);
preloadResult = riderActor.PreloadBehaviorsToActivate(behaviorsT
oActivate);
LogAssert(preloadResult, "CBTTaskRidingManagerVehicleMount::OnMo
untStarted - preloading behaviors failed");
riderData.sharedParams.mountStatus = 0;
/* NOP */;
}
public latent function OnMountFinishedSuccessfully(riderData : CAIStorag
eRiderData, behGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var behaviorsToActivate : array<CName>;
var graphResult : Bool;
var movementAdjustor : CMovementAdjustor;
riderActor = GetActor();
riderData.sharedParams.mountStatus = 1;
riderActor.RemoveTimer('UpdateTraverser', /* NOP */);
behaviorsToActivate.PushBack(behGraphName);
graphResult = riderActor.ActivateBehaviors(behaviorsToActivate);

riderActor.SetBehaviorVariable('MountType', GetMountTypeVariable
(), /* NOP */);
if (riderData.ridingManagerInstantMount){
riderActor.RaiseForceEvent('InstantMount');
}
LogAssert(graphResult, "CBTTaskRidingManagerHorseMount::OnMountF
inishedSuccessfully - behaviors activation failed");
if (riderData.sharedParams.vehicleSlot == 1){
if (riderActor.SetBehaviorVariable('isPassenger', 1.0000
00, /* NOP */) == false){
LogAssert(graphResult, "CBTTaskRidingManagerHors
eMount::OnMountFinishedSuccessfully - behaviors variable init failed");
}
} else if (riderActor.SetBehaviorVariable('isPassenger', 0.00000
0, /* NOP */) == false){
LogAssert(graphResult, "CBTTaskRidingManagerHorseMount::
OnMountFinishedSuccessfully - behaviors variable init failed");
}
riderActor.EnableCollisions(false);
riderActor.CreateAttachment(vehicleComponent.GetEntity(), attach
Slot, /* NOP */, /* NOP */);
movementAdjustor = riderActor.GetMovingAgentComponent().GetMovem
entAdjustor();
if (movementAdjustor){
movementAdjustor.CancelAll();
}
vehicleComponent.OnMountFinished(riderActor);
/* NOP */;
}
public latent function OnMountFailed(riderData : CAIStorageRiderData, ve
hicleComponent : CVehicleComponent){
var riderActor : CActor;
riderActor = GetActor();
riderData.ridingManagerMountError = true;
vehicleComponent.OnDismountStarted(riderActor);
vehicleComponent.OnDismountFinished(riderActor, riderData.shared
Params.vehicleSlot);
riderData.sharedParams.mountStatus = 3;
riderActor.SetUsedVehicle(NULL);
/* NOP */;
}
public latent function MountActor(riderData : CAIStorageRiderData, behGr
aphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var exploration : SExplorationQueryToken;
var vehicleEntity : CEntity;
var queryContext : SExplorationQueryContext;
var success : Bool;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
success = true;
if (riderData.ridingManagerInstantMount == false){
queryContext.inputDirectionInWorldSpace = VecNormalize(v
ehicleEntity.GetWorldPosition() - riderActor.GetWorldPosition());
exploration = theGame.QueryExplorationFromObjectSync(rid
erActor, vehicleEntity, /* NOP */);
success = exploration.valid;
}
if (success){
OnMountStarted(riderData, behGraphName, vehicleComponent

);
if (riderData.ridingManagerInstantMount == false){
riderActor.AddTimer('UpdateTraverser', 0.000000,
true, false, 0, /* NOP */, /* NOP */);
success = riderActor.ActionExploration(explorati
on, NULL, riderData.sharedParams.GetHorse());
}
}
if (success){
OnMountFinishedSuccessfully(riderData, behGraphName, veh
icleComponent);
} else {
OnMountFailed(riderData, vehicleComponent);
}
/* NOP */;
}
public function GetMountTypeVariable() : Float{
switch(mountType){
case 'horse_mount_B_01':
return 1.000000;
case 'horse_mount_L':
return 2.000000;
case 'horse_mount_LB':
return 3.000000;
case 'horse_mount_LF':
return 4.000000;
case 'horse_mount_R_01':
return 5.000000;
case 'horse_mount_RB_01':
return 6.000000;
case 'horse_mount_RF_01':
return 7.000000;
default:
}
return 0.000000;
return 0.000000;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
}
import abstract class CBehaviorAnimationMultiplyEntity{
}
import abstract class CSkyTransformComponent{
}
import abstract class CSkyTransformEntity{
}
import abstract class CStaticMeshComponent{
}
import struct CRigidMeshComponent{

import public function EnableBuoyancy(enable : Bool) : Bool;


}
import abstract class CRigidMeshComponentCooked{
}
class CBTTaskRidingManagerVehicleDismount extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function OnDismountStarted(riderData : CAIStorageRiderData, vehic
leComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
if (vehicleComponent){
vehicleComponent.OnDismountStarted(riderActor);
}
riderActor.ActionCancelAll();
riderActor.RemoveTimer('UpdateTraverser', /* NOP */);
riderData.sharedParams.mountStatus = 2;
/* NOP */;
}
public function OnDismountFinishedA(riderData : CAIStorageRiderData, veh
icleComponent : CVehicleComponent){
var riderActor : CActor;
riderActor = GetActor();
riderData.sharedParams.mountStatus = 3;
riderActor.EnableCharacterCollisions(true);
riderActor.BreakAttachment();
riderActor.SetUsedVehicle(NULL);
if (vehicleComponent){
vehicleComponent.OnDismountFinished(riderActor, riderDat
a.sharedParams.vehicleSlot);
}
/* NOP */;
}
public latent function OnDismountFinishedB_Latent(riderData : CAIStorage
RiderData, vehicleComponent : CVehicleComponent){
}
public function FindDismountDirection(riderData : CAIStorageRiderData, v
ehicleComponent : CVehicleComponent, dismountDirection : Float){
var riderActor : CActor;
var vehicleEntity : CEntity;
var horseComponent : W3HorseComponent;
var LeftForwardDismountPosition : Vector;
var LeftForwardDismountPositionTrot : Vector;
var RightForwardDismountPosition : Vector;
var LeftBackwardDismountPosition : Vector;
var RightBackwardDismountPosition : Vector;
var BackDismountPosition : Vector;
var actorMovingAgentComponent : CMovingPhysicalAgentComponent;
var vehiclePosition : Vector;
var vehicleForward : Vector;
var vehicleRight : Vector;
var dismountCheckLength : Float;
var possibleDirections : array<Float>;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
vehiclePosition = vehicleEntity.GetWorldPosition();
vehicleForward = vehicleEntity.GetWorldForward();
vehicleRight = vehicleEntity.GetWorldRight();

dismountCheckLength = 1.000000;
dismountDirection = 1.000000;
actorMovingAgentComponent = (CMovingPhysicalAgentComponent)rider
Actor.GetMovingAgentComponent();
LeftForwardDismountPosition = vehiclePosition - vehicleRight * d
ismountCheckLength;
LeftForwardDismountPositionTrot = vehiclePosition + 2 * vehicleF
orward - vehicleRight * dismountCheckLength;
RightForwardDismountPosition = vehiclePosition + vehicleRight *
dismountCheckLength;
LeftBackwardDismountPosition = vehiclePosition + -vehicleForward
- vehicleRight * dismountCheckLength;
RightBackwardDismountPosition = vehiclePosition + -vehicleForwar
d + vehicleRight * dismountCheckLength;
BackDismountPosition = vehiclePosition + -vehicleForward * dismo
untCheckLength;
horseComponent = (W3HorseComponent)vehicleComponent;
if (horseComponent && riderActor == thePlayer){
if (horseComponent.GetCurrentPitch() >= 30.000000){
if (IsPositionValid(vehicleComponent, BackDismou
ntPosition)){
thePlayer.SetBehaviorVariable('dismountT
ype', 0.000000, /* NOP */);
dismountDirection = 4.000000;
return;
} else {
riderData.ridingManagerDismountType = 8;
return;
}
} else if (thePlayer.GetBehaviorVariable('dismountType',
/* NOP */) == 1.000000){
if (IsPositionValid(vehicleComponent, LeftForwar
dDismountPositionTrot)){
return;
} else {
thePlayer.SetBehaviorVariable('dismountT
ype', 0.000000, /* NOP */);
}
}
}
if (IsPositionValid(vehicleComponent, LeftForwardDismountPositio
n)){
possibleDirections.PushBack(0.000000);
}
if (IsPositionValid(vehicleComponent, RightForwardDismountPositi
on)){
possibleDirections.PushBack(1.000000);
}
if (possibleDirections.Size() <= 0){
if (IsPositionValid(vehicleComponent, LeftBackwardDismou
ntPosition)){
possibleDirections.PushBack(2.000000);
}
if (IsPositionValid(vehicleComponent, RightBackwardDismo
untPosition)){
possibleDirections.PushBack(3.000000);
}
if (!possibleDirections.Size()){
if (IsPositionValid(vehicleComponent, BackDismou
ntPosition)){

dismountDirection = 4.000000;
return;
} else {
riderData.ridingManagerDismountType = 8;
return;
}
}
dismountDirection = possibleDirections[RandRange(possibl
eDirections.Size(), /* NOP */)];
} else {
dismountDirection = possibleDirections[RandRange(possibl
eDirections.Size(), /* NOP */)];
}
/* NOP */;
}
public function IsPositionValid(vehicleComponent : CVehicleComponent, _p
osition : Vector) : Bool{
var riderActor : CActor;
var actorMovingAgentComponent : CMovingPhysicalAgentComponent;
var vehicleEntity : CEntity;
var vehiclePosition : Vector;
var pointA : Vector;
var pointB : Vector;
var outPosition : Vector;
var outNormal : Vector;
var collisionGroupsNames : array<CName>;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
vehiclePosition = vehicleEntity.GetWorldPosition();
actorMovingAgentComponent = (CMovingPhysicalAgentComponent)rider
Actor.GetMovingAgentComponent();
collisionGroupsNames.PushBack('Static');
collisionGroupsNames.PushBack('Terrain');
collisionGroupsNames.PushBack('Destructible');
collisionGroupsNames.PushBack('Foliage');
pointA = vehiclePosition;
pointB = _position;
pointA.Z += 1.000000;
pointB.Z += 1.000000;
if (theGame.GetWorld().SweepTest(pointA, pointB, 0.400000, outPo
sition, outNormal, collisionGroupsNames)){
return false;
}
return true;
/* NOP */;
}
public latent function DismountActor_Latent(riderData : CAIStorageRiderD
ata, vehicleComponent : CVehicleComponent, dismountDirection : Float){
var riderActor : CActor;
var riderActorTarget : CActor;
var angleDistance : Float;
var vehicleEntity : CEntity;
var params : SCustomEffectParams;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
switch(riderData.ridingManagerDismountType){
case 1:
riderActor.SetBehaviorVariable('shakeOffRider', 0.000000
, /* NOP */);
riderActor.SetBehaviorVariable('dismountDirection', dism

ountDirection, /* NOP */);


if (riderActor.RaiseForceEventWithoutTestCheck('dismount
')){
riderActor.WaitForBehaviorNodeDeactivation('dism
ountEnd', 10.000000);
} else if (riderActor.RaiseForceEvent('dismount')){
riderActor.WaitForBehaviorNodeDeactivation('dism
ountEnd', 10.000000);
}
break;
case 2:
riderActor.SetBehaviorVariable('shakeOffRider', 1.000000
, /* NOP */);
vehicleEntity.SetBehaviorVariable('shakeOffRider', 1.000
000, /* NOP */);
riderActor.SetBehaviorVariable('dismountDirection', dism
ountDirection, /* NOP */);
vehicleEntity.SetBehaviorVariable('dismountDirection', d
ismountDirection, /* NOP */);
params.effectType = 9;
params.creator = (CGameplayEntity)vehicleComponent.GetEn
tity();
params.sourceName = "shakeOff_dismount";
params.duration = 5;
riderActor.AddEffectCustom(params);
PlaySyncAnimWithRider(vehicleEntity, 'dismount', 'dismou
ntEnd');
break;
case 4:
riderActorTarget = riderActor.GetTarget();
if (riderActorTarget){
angleDistance = NodeToNodeAngleDistance(riderAct
orTarget, riderActor);
if (AbsF(angleDistance) < 50){
dismountDirection = 0.000000;
} else if (angleDistance <= -50){
dismountDirection = 1.000000;
} else {
dismountDirection = 2.000000;
}
} else {
dismountDirection = 0.000000;
}
riderActor.SetBehaviorVariable('dismountDirection', dism
ountDirection, /* NOP */);
riderActor.RaiseForceEvent('dismountRagdoll');
riderActor.WaitForBehaviorNodeDeactivation('dismountRagd
ollEnd', 0.500000);
riderActor.BreakAttachment();
break;
case 8:
break;
}
/* NOP */;
}
public latent function DismountActor(riderData : CAIStorageRiderData, ve
hicleComponent : CVehicleComponent){
var dismountDirection : Float;
dismountDirection = 1.000000;
OnDismountStarted(riderData, vehicleComponent);

FindDismountDirection(riderData, vehicleComponent, dismountDirec


tion);
DismountActor_Latent(riderData, vehicleComponent, dismountDirect
ion);
OnDismountFinishedA(riderData, vehicleComponent);
OnDismountFinishedB_Latent(riderData, vehicleComponent);
/* NOP */;
}
public function DismountActor_NonLatent(riderData : CAIStorageRiderData,
vehicleComponent : CVehicleComponent){
OnDismountStarted(riderData, vehicleComponent);
OnDismountFinishedA(riderData, vehicleComponent);
/* NOP */;
}
public latent function PlaySyncAnimWithRider(vehicleEntity : CEntity, ev
entName : CName, deactivationEvent : CName){
var riderActor : CActor;
riderActor = GetActor();
vehicleEntity.RaiseForceEventWithoutTestCheck('ForceIdle');
Sleep(0.100000);
if (riderActor != thePlayer){
vehicleEntity.RaiseForceEventWithoutTestCheck(eventName)
;
riderActor.RaiseForceEventWithoutTestCheck(eventName);
riderActor.BreakAttachment();
Sleep(1.000000);
riderActor.RaiseEvent('SwitchToRagdoll');
} else {
vehicleEntity.RaiseEventWithoutTestCheck(eventName);
riderActor.RaiseEventWithoutTestCheck(eventName);
riderActor.BreakAttachment();
vehicleEntity.WaitForBehaviorNodeDeactivation(deactivati
onEvent, 10.000000);
}
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
}
import abstract class CDynamicColliderComponent{
}
import abstract class CSimpleBuoyancyComponent{
}
abstract class CBTTaskRidingManagerBoatMount extends CBTTaskRidingManagerVehicle
Mount{
public var behGraphAlias : CName;
public function GetVehicleComponent() : CVehicleComponent{
var riderData : CAIStorageRiderData;
var boat : CEntity;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
boat = EntityHandleGet(riderData.sharedParams.boat);
return (CVehicleComponent)boat.GetComponentByClassName('CVehicle

Component');
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
var vehicleComponent : CVehicleComponent;
if (super.OnActivate() != 0){
return 1;
}
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.vehicleSlot == 0){
attachSlot = 'seat';
} else {
attachSlot = 'seat_passenger';
}
return 0;
/* NOP */;
}
public latent function OnMountStarted(riderData : CAIStorageRiderData, b
ehGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
super.OnMountStarted(riderData, behGraphName, vehicleComponent);
/* NOP */;
}
public latent function OnMountFinishedSuccessfully(riderData : CAIStorag
eRiderData, behGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
super.OnMountFinishedSuccessfully(riderData, behGraphName, vehic
leComponent);
/* NOP */;
}
public latent function OnMountFailed(riderData : CAIStorageRiderData, ve
hicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleEntity : CEntity;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
super.OnMountFailed(riderData, vehicleComponent);
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
var vehicleComponent : CVehicleComponent;
var vehicle : CEntity;
var boatComp : CBoatComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.rider != thePlayer){
riderData.ridingManagerInstantMount = true;
}
vehicle = EntityHandleGet(riderData.sharedParams.boat);
vehicleComponent = (CVehicleComponent)vehicle.GetComponentByClas
sName('CVehicleComponent');
if (riderData.sharedParams.vehicleSlot == 0 && vehicleComponent.
GetUser()){
return 1;
}

boatComp = (CBoatComponent)vehicle.GetComponentByClassName('CBoa
tComponent');
if (boatComp){
if (riderData.sharedParams.vehicleSlot == 1 && boatComp.
GetPassenger()){
return 1;
}
}
MountActor(riderData, behGraphAlias, vehicleComponent);
return 2;
/* NOP */;
}
}
import abstract class CStorySceneDialogset{
}
class W3ConfuseEffectCustomParams extends W3BuffCustomParams{
public var criticalHitChanceBonus : Float;
}
import abstract class SDynamicCollider{
}
abstract class CBTTaskRidingManagerBoatDismount extends CBTTaskRidingManagerVehi
cleDismount{
public function OnDismountStarted(riderData : CAIStorageRiderData, vehic
leComponent : CVehicleComponent){
super.OnDismountStarted(riderData, vehicleComponent);
/* NOP */;
}
public function OnDismountFinishedA(riderData : CAIStorageRiderData, veh
icleComponent : CVehicleComponent){
super.OnDismountFinishedA(riderData, vehicleComponent);
/* NOP */;
}
public latent function OnDismountFinishedB_Latent(riderData : CAIStorage
RiderData, vehicleComponent : CVehicleComponent){
super.OnDismountFinishedB_Latent(riderData, vehicleComponent);
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
var vehicleComponent : CVehicleComponent;
var boat : CEntity;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
boat = EntityHandleGet(riderData.sharedParams.boat);
vehicleComponent = (CVehicleComponent)boat.GetComponentByClassNa
me('CVehicleComponent');
DismountActor(riderData, vehicleComponent);
return 2;
/* NOP */;
}
}
state CR4PlayerStateMountHorse in CR4Player extends CR4PlayerStateMountTheVehicl
e{
public var horseComp : W3HorseComponent;
private var mountAnimStarted : Bool;
public const var MOUNT_TIMEOUT : Float;

public function OnEnterState(prevStateName : CName) : Bool{


var instantMount : Bool;
instantMount = false;
super.OnEnterState(prevStateName);
thePlayer.HideUsableItem(/* NOP */);
thePlayer.AddBuffImmunity(53, 'HorseRidingBuffImmunity', true);
horseComp = (W3HorseComponent)vehicle;
if (horseComp){
horseComp.canDismount = false;
ProcessMountHorse();
} else {
LogAssert(vehicle, "MountHorse::ProcessMountTheVehicle,
'vehicle' is not set");
}
if (mountType == 2){
instantMount = true;
}
theGame.ActivateHorseCamera(true, 0.000000, instantMount);
if ((W3ReplacerCiri)thePlayer){
theInput.SetContext('Horse_Replacer_Ciri');
} else {
theInput.SetContext('Horse');
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
/* NOP */;
}
public cleanup function MountCleanup(){
super.MountCleanup();
parent.SignalGameplayEventParamInt('RidingManagerDismountHorse',
8 | 1024);
/* NOP */;
}
public entry function ProcessMountHorse(){
var riderData : CAIStorageRiderData;
var distance : Float;
var contextSwitchOffset : Float;
var mountStartTimestamp : Float;
parent.SetCleanupFunction('MountCleanup');
mountAnimStarted = false;
if (mountType == 2){
parent.OnHitGround();
}
riderData = thePlayer.GetRiderData();
horseComp.Unpair();
horseComp.PairWithRider(riderData.sharedParams);
riderData.sharedParams.rider = thePlayer;
riderData.sharedParams.vehicleSlot = vehicleSlot;
parent.SignalGameplayEventParamInt('RidingManagerMountHorse', mo
untType);
SleepOneFrame();
mountStartTimestamp = theGame.GetEngineTimeAsSeconds();
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 1){
break;
}
if (mountAnimStarted){

} else if (riderData.ridingManagerMountError == true ||


mountStartTimestamp + MOUNT_TIMEOUT < theGame.GetEngineTimeAsSeconds()){
OnMountingFailed();
parent.PopState(/* NOP */);
break;
}
SleepOneFrame();
}
parent.ClearCleanupFunction();
horseComp.IssueCommandToUseVehicle();
/* NOP */;
}
public function OnStartTraversingExploration(t : CScriptedExplorationTra
verser) : Bool{
return parent.OnStartTraversingExploration(t);
/* NOP */;
}
private function OnMountingFailed(){
super.OnMountingFailed();
theGame.ActivateHorseCamera(false, 0.000000, /* NOP */);
/* NOP */;
}
public function OnMountAnimStarted() : Bool{
mountAnimStarted = true;
/* NOP */;
}
public function OnHorseRidingOn() : Bool{
horseComp.PushState('Exploration');
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
parent.ActionCancelAll();
parent.OnDeath(damageAction);
/* NOP */;
}
}
import struct CDecalComponent{
}
abstract class CBTTaskRidingManagerHorseMount extends CBTTaskRidingManagerVehicl
eMount{
public function GetVehicleComponent() : CVehicleComponent{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
return (CVehicleComponent)riderData.sharedParams.GetHorse().GetC
omponentByClassName('CVehicleComponent');
/* NOP */;
}
public latent function OnMountStarted(riderData : CAIStorageRiderData, b
ehGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
super.OnMountStarted(riderData, behGraphName, vehicleComponent);
vehicleActor = (CActor)vehicleComponent.GetEntity();
vehicleActor.SignalGameplayEvent('HorseMountStart');
riderActor.SignalGameplayEvent('HorseMountStart');
/* NOP */;
}

public latent function OnMountFinishedSuccessfully(riderData : CAIStorag


eRiderData, behGraphName : CName, vehicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
var player : CR4Player;
var behaviorsToActivate : array<CName>;
var graphResult : Bool;
riderActor = GetActor();
vehicleActor = (CActor)vehicleComponent.GetEntity();
player = (CR4Player)riderActor;
if (riderData.ridingManagerInstantMount == false){
riderActor.GetMovingAgentComponent().SetAdditionalOffset
WhenAttachingToEntity(vehicleActor, 1.000000);
}
if (player){
riderActor.EnableCollisions(false);
}
riderActor.SetBehaviorVariable('rider', 1.000000, /* NOP */);
vehicleActor.SignalGameplayEvent('HorseMountEnd');
riderActor.SignalGameplayEvent('HorseMountEnd');
if (riderActor.CanStealOtherActor(vehicleActor)){
theGame.ConvertToStrayActor(vehicleActor);
if (player){
player.SaveLastMountedHorse(vehicleActor);
}
}
super.OnMountFinishedSuccessfully(riderData, behGraphName, vehic
leComponent);
/* NOP */;
}
public latent function OnMountFailed(riderData : CAIStorageRiderData, ve
hicleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleEntity : CEntity;
riderActor = GetActor();
vehicleEntity = vehicleComponent.GetEntity();
super.OnMountFailed(riderData, vehicleComponent);
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var riderActor : CActor;
var riderData : CAIStorageRiderData;
var vehicleEntity : CEntity;
var vehicleComponent : W3HorseComponent;
riderActor = GetActor();
if (eventName == 'OnPoolRequest' || eventName == 'RequestInstant
Dismount'){
Complete(false);
}
if (eventName == 'MountHorseType'){
mountType = GetEventParamCName('None');
if (riderActor == thePlayer){
(CR4PlayerStateMountHorse)thePlayer.GetState('Mo
untHorse').OnMountAnimStarted();
}
}
if (eventName == 'HorseRidingOn'){
if (riderActor == thePlayer){
(CR4PlayerStateMountHorse)thePlayer.GetState('Mo
untHorse').OnHorseRidingOn();

}
}
return false;
/* NOP */;
}
}
import abstract class CSwarmRenderComponent{
}
import abstract class SStripeControlPoint{
}
import abstract class CStripeComponent{
}
abstract class CBTTaskRidingManagerVehicleDismountDef extends IBehTreeTaskDefini
tion{
}
import abstract class CFurComponent{
}
abstract class CBTTaskRidingManagerHorseDismount extends CBTTaskRidingManagerVeh
icleDismount{
public function OnDismountStarted(riderData : CAIStorageRiderData, vehic
leComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
super.OnDismountStarted(riderData, vehicleComponent);
vehicleActor = (CActor)vehicleComponent.GetEntity();
if (vehicleActor){
vehicleActor.SignalGameplayEvent('HorseDismountStart');
}
riderActor.SignalGameplayEvent('HorseDismountStart');
/* NOP */;
}
public function OnDismountFinishedA(riderData : CAIStorageRiderData, veh
icleComponent : CVehicleComponent){
var riderActor : CActor;
var vehicleActor : CActor;
riderActor = GetActor();
riderActor.SignalGameplayEvent('HorseDismountEnd');
vehicleActor = (CActor)vehicleComponent.GetEntity();
if (vehicleActor){
vehicleActor.SignalGameplayEvent('HorseDismountEnd');
}
if ((CR4Player)riderActor){
riderActor.EnableCollisions(true);
}
super.OnDismountFinishedA(riderData, vehicleComponent);
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
var vehicleEntity : CEntity;
var vehicleComponent : CVehicleComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
vehicleEntity = riderData.sharedParams.GetHorse();

vehicleComponent = (CNewNPC)vehicleEntity.GetHorseComponent();
DismountActor(riderData, vehicleComponent);
return 2;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var riderActor : CActor;
var riderData : CAIStorageRiderData;
var vehicleEntity : CEntity;
var vehicleComponent : W3HorseComponent;
riderActor = GetActor();
if (eventName == 'OnPoolRequest' || eventName == 'RequestInstant
Dismount'){
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
vehicleEntity = riderData.sharedParams.GetHorse();
if (vehicleEntity){
vehicleComponent = (CNewNPC)vehicleEntity.GetHor
seComponent();
}
if (riderData.sharedParams.mountStatus != 3){
DismountActor_NonLatent(riderData, vehicleCompon
ent);
riderData.OnInstantDismount(riderActor);
}
}
return false;
/* NOP */;
}
}
class W3FrozenEffectCustomParams extends W3BuffCustomParams{
public var freezeFadeInTime : Float;
}
import struct CScriptedDestroyableComponent{
public editable var distanceValue : Float;
public editable var destroyTimeDuration : Float;
public editable var contactDestroyDelay : Float;
public editable var destroyAtTime : Float;
public var m_state : EScriptedDetroyableComponentState;
private var entryTime : Float;
private var timerInterval : Float;
import public final function GetDestroyWay() : EDestroyWay;
import public function GetDestroyAtTime() : Float;
import public function GetDestroyTimeDuration() : Float;
public function GetDistanceToTargetValue() : Float{
return distanceValue;
/* NOP */;
}
public function GetDestroyTimeDurationValue() : Float{
return destroyTimeDuration;
/* NOP */;
}
public function GetContactDestroyDelayValue() : Float{
return contactDestroyDelay;
/* NOP */;
}
public function GetDestroyAtTimeValue() : Float{
return destroyAtTime;
/* NOP */;

}
public
}
public
}
public
}
public
}

function IdleTick(out time : Float){


function PreDestroyTick(out time : Float){
function DestroyTick(out time : Float){
function PostDestroyTick(out time : Float){

}
import struct CPhantomComponent{
import public final function
import public final function
import public final function
ray<CName>);
import public final function
}

Activate();
Deactivate();
GetTriggeringCollisionGroupNames(names : ar
GetNumObjectsInside() : Int32;

import abstract class CPhantomAttachment{


}
class CBTCondMyHorseIsMounted extends IBehTreeTask{
public var waitForMountEnd : Bool;
public var waitForDismountEnd : Bool;
public var aiStorageHandler : CAIStorageHandler;
public var returnTrueWhenNoHorse : Bool;
public function IsAvailable() : Bool{
var owner : CActor;
var riderData : CAIStorageRiderData;
owner = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (!riderData || !riderData.sharedParams || !riderData.sharedPa
rams.GetHorse()){
if (returnTrueWhenNoHorse){
return true;
} else {
return false;
}
}
switch(riderData.sharedParams.mountStatus){
case 0:
if (waitForMountEnd){
return false;
}
return true;
case 1:
return true;
case 2:
if (waitForDismountEnd){
return true;
}
return false;
case 3:
return false;
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{

if (eventName == 'HorseMountStart'){
return true;
} else if (eventName == 'HorseMountEnd'){
return true;
} else if (eventName == 'HorseDismountStart'){
return true;
} else if (eventName == 'HorsedismountEnd'){
return true;
}
return false;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CFootstepData{
}
abstract class IBehTreeRiderConditionalTaskDefinition extends IBehTreeConditiona
lTaskDefinition{
}
import abstract class CEntityTemplate{
}
class CBTCondRiderHasPairedHorse extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
var owner : CActor;
var riderData : CAIStorageRiderData;
owner = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.GetHorse()){
return true;
}
return false;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == 'HorseLost'){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondRiderFightOnHorse extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;

public function IsAvailable() : Bool{


var actor : CActor;
var riderData : CAIStorageRiderData;
actor = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.mountStatus == 0 || riderData.sharedP
arams.mountStatus == 1){
return true;
}
return false;
return false;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CCharacterEntityTemplate{
}
class CBTCondRiderDistanceToHorse extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public var minDistance : Float;
public var maxDistance : Float;
public function IsAvailable() : Bool{
return Check();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (Check()){
return 0;
} else {
return 1;
}
/* NOP */;
}
public function Check() : Bool{
var squaredDistance : Float;
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (!riderData || !riderData.sharedParams.GetHorse()){
return false;
}
squaredDistance = VecDistanceSquared(riderData.sharedParams.GetH
orse().GetWorldPosition(), GetActor().GetWorldPosition());
if (minDistance * minDistance < squaredDistance && squaredDistan
ce < maxDistance * maxDistance){
return true;
}
return false;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);

/* NOP */;
}
}
import abstract class EntitySlot{
}
class CBTCondRiderPlayingSyncAnim extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
var riderData : CAIStorageRiderData;
var horseComp : CVehicleComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.GetHorse()){
return false;
}
if (riderData.sharedParams.mountStatus == 0 || riderData.sharedP
arams.mountStatus == 2){
return true;
} else {
return false;
}
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CStorySceneVoicetagMapping{
}
class W3SnowstormCustomParams extends W3BuffCustomParams{
public editable var showCamEffect : Bool;
}
import abstract class SComponentInstancePropertyEntry{
}
class CBTCondRiderIsMountInProgress extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
var riderData : CAIStorageRiderData;
var horseComp : CVehicleComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.sharedParams.GetHorse()){
return false;
}
if (riderData.sharedParams.mountStatus == 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;

aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CClothAttachment{
}
class CBTCondRiderIsDismountInProgress extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
private var riderData : CAIStorageRiderData;
public function IsAvailable() : Bool{
var riderData : CAIStorageRiderData;
var horseComp : CVehicleComponent;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (riderData.GetRidingManagerCurrentTask() == 2){
return true;
} else {
return false;
}
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CAnimatedAttachment{
}
class CBTCondRiderHasFallenFromHorse extends IBehTreeTask{
public var waitForMountEnd : Bool;
public var waitForDismountEnd : Bool;
public var aiStorageHandler : CAIStorageHandler;
public function IsAvailable() : Bool{
var owner : CActor;
var riderData : CAIStorageRiderData;
owner = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
return riderData.sharedParams.hasFallenFromHorse;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CHardAttachment{
}
class CBTTaskRiderCombatOnHorseDecorator extends IBehTreeTask{
public function OnActivate() : EBTNodeStatus{
return 0;

/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var buffType : ECriticalStateType;
if (eventName == 'CriticalState'){
buffType = GetEventParamInt(-1);
if (buffType == 2 || buffType == 1 || buffType == 14 ||
buffType == 4 || buffType == 3){
GetActor().SignalGameplayEventParamInt('RidingMa
nagerDismountHorse', 4);
} else {
GetActor().SignalGameplayEventParamInt('RidingMa
nagerDismountHorse', 2);
}
return true;
}
return false;
/* NOP */;
}
}
import abstract class CDependencyAttachment{
}
class CBTTaskRiderMountHorse extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var squaredDistance : Float;
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
if (!riderData.sharedParams.GetHorse()){
return 1;
}
squaredDistance = VecDistanceSquared(riderData.sharedParams.GetH
orse().GetWorldPosition(), GetActor().GetWorldPosition());
if (squaredDistance > 5.000000 * 5.000000){
return 1;
}
GetActor().SignalGameplayEvent('RidingManagerMountHorse');
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0){
if (riderData.sharedParams.mountStatus == 1){
if (riderData.ridingManagerMountError){
return 1;
}
return 2;
}

GetActor().SignalGameplayEventParamInt('RidingMa
nagerMountHorse', 2 | 1024);
}
SleepOneFrame();
}
return 2;
/* NOP */;
}
}
import abstract class CSkinningAttachment{
}
class CBTTaskRiderDismountHorse extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public var endDismountDone : Bool;
public function OnActivate() : EBTNodeStatus{
GetActor().SignalGameplayEventParamInt('RidingManagerDismountHor
se', 1);
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 3){
return 2;
}
SleepOneFrame();
}
return 2;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
}
import abstract class CDummyComponent{
}
import struct CSpriteComponent{
}
import abstract class SLightFlickering{
}
abstract class IBehTreeRiderTaskDefinition extends IBehTreeTaskDefinition{
}
import abstract class CLightComponent{
}
class CBTTaskRiderSetFollowActionOnHorseDef extends IBehTreeRiderTaskDefinition{

public function OnSpawn(taskGen : IBehTreeTask){


var myParams : CAIRiderFollowActionParams;
var task : CBTTaskRiderSetFollowActionOnHorse;
task = (CBTTaskRiderSetFollowActionOnHorse)taskGen;
task.horseFollowAction = new CAIFollowAction in this;
task.horseFollowAction.OnCreated();
myParams = (CAIRiderFollowActionParams)GetAIParametersByClassNam
e('CAIRiderFollowActionParams');
myParams.CopyTo(task.horseFollowAction.params);
task.horseFollowAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import abstract class CPointLightComponent{
}
class CBTTaskRiderSetFollowSideBySideActionOnHorseDef extends IBehTreeRiderTaskD
efinition{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderFollowSideBySideActionParams;
var task : CBTTaskRiderSetFollowSideBySideActionOnHorse;
task = (CBTTaskRiderSetFollowSideBySideActionOnHorse)taskGen;
task.horseFollowSideBySideAction = new CAIFollowSideBySideAction
in this;
task.horseFollowSideBySideAction.OnCreated();
myParams = (CAIRiderFollowSideBySideActionParams)GetAIParameters
ByClassName('CAIRiderFollowSideBySideActionParams');
myParams.CopyTo_SideBySide(task.horseFollowSideBySideAction);
task.horseFollowSideBySideAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import abstract class CSpotLightComponent{
}
class CBTTaskRiderSetDoNothingActionOnHorseDef extends IBehTreeRiderTaskDefiniti
on{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderRideHorseAction;
var task : CBTTaskRiderSetDoNothingActionOnHorse;
task = (CBTTaskRiderSetDoNothingActionOnHorse)taskGen;
task.horseDoNothingAction = new CAIHorseDoNothingAction in this;
task.horseDoNothingAction.OnCreated();
myParams = (CAIRiderRideHorseAction)GetAIParametersByClassName('
CAIRiderRideHorseAction');
myParams.CopyTo(task.horseDoNothingAction);
task.horseDoNothingAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import abstract class CDimmerComponent{
}
class CBTTaskRiderSetMoveToActionOnHorseDef extends IBehTreeRiderTaskDefinition{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderMoveToActionParams;
var task : CBTTaskRiderSetMoveToActionOnHorse;

task = (CBTTaskRiderSetMoveToActionOnHorse)taskGen;
task.horseMoveToAction = new CAIMoveToAction in this;
task.horseMoveToAction.OnCreated();
myParams = (CAIRiderMoveToActionParams)GetAIParametersByClassNam
e('CAIRiderMoveToActionParams');
myParams.CopyTo(task.horseMoveToAction.params);
task.horseMoveToAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import abstract class SEnvProbeGenParams{
}
class CBTTaskRiderSetMoveAlongPathActionOnHorseDef extends IBehTreeRiderTaskDefi
nition{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderMoveAlongPathActionParams;
var task : CBTTaskRiderSetMoveAlongPathActionOnHorse;
task = (CBTTaskRiderSetMoveAlongPathActionOnHorse)taskGen;
task.horseMoveAlongPathAction = new CAIMoveAlongPathAction in th
is;
task.horseMoveAlongPathAction.OnCreated();
myParams = (CAIRiderMoveAlongPathActionParams)GetAIParametersByC
lassName('CAIRiderMoveAlongPathActionParams');
myParams.CopyTo(task.horseMoveAlongPathAction.params);
task.horseMoveAlongPathAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import abstract class CEnvProbeComponent{
}
class CBTTaskRiderSetMoveAlongPathWithCompanionActionOnHorseDef extends IBehTree
RiderTaskDefinition{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderMoveAlongPathWithCompanionActionParams;
var task : CBTTaskRiderSetMoveAlongPathWithCompanionActionOnHors
e;
task = (CBTTaskRiderSetMoveAlongPathWithCompanionActionOnHorse)t
askGen;
task.horseMoveAlongPathAction = new CAIMoveAlongPathWithCompanio
nAction in this;
task.horseMoveAlongPathAction.OnCreated();
myParams = (CAIRiderMoveAlongPathWithCompanionActionParams)GetAI
ParametersByClassName('CAIRiderMoveAlongPathWithCompanionActionParams');
myParams.CopyTo_2((CAIMoveAlongPathWithCompanionParams)task.hors
eMoveAlongPathAction.params);
task.horseMoveAlongPathAction.OnManualRuntimeCreation();
/* NOP */;
}
}
state CR4PlayerStateSwimming in CR4Player extends CR4PlayerStateExtendedMovable{
public const var START_SWIMMING_WATER_LEVEL : Float;
public const var LEAVE_STATE_WATER_LEVEL : Float;
public const var LEAVE_STATE_SUBMERGE_DEPTH : Float;
public const var WALK_DEEP_WATER_LEVEL : Float;
public const var MIN_WATER_LEVEL_FOR_DIVING : Float;

public const var ENTER_DIVING_WATER_LEVEL : Float;


public const var EXIT_DIVING_WATER_LEVEL : Float;
public const var MINIMAL_SUBMERGE_DEPTH : Float;
private const var jumpToWaterAnimDist : Float;
private const var swimToIdleAnimDist : Float;
private var splashEntityTemplate : CEntityTemplate;
private var walkDeep : Bool;
private var swimming : Bool;
private var diving : Bool;
private var divingStarting : Bool;
private var swimStart : Bool;
private var unlimitedDiving : Bool;
private var swimStagger : Bool;
private var minSubmergeDepthReached : Bool;
private var inDivingState : Bool;
private var divingEnd : Bool;
private var blockPopState : Bool;
private var usePredicitonDepth : Bool;
private var divingEffectPlaying : Bool;
private var jumpToWaterInProgress : Bool;
private var startSwimPos : Vector;
private var currentWaterDepth : Float;
private var cachedVerCameraTimeout : Float;
private var defaultEmergeSpeed : Float;
private var windPower : Float;
private var predictedWaterDepth : Float;
private var blockDiveDown : Bool;
private var cameraIsUnderwater : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
SwimmingInitGeneral(prevStateName);
SwimmingLatentInit();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var item : SItemUniqueId;
StateBlockInputActions(false);
usePredicitonDepth = false;
if (nextStateName == 'AimThrow'){
return super.OnLeaveState(nextStateName);
}
parent.RemoveAnimEventCallback('TurnOnDiving');
parent.RemoveAnimEventCallback('AllowSwitchToDiving');
EnableBuffImmunities(false);
ToggleDiving(false);
ToggleSwimming(false, /* NOP */);
swimming = false;
diving = false;
if (nextStateName == 'TraverseExploration'){
parent.GetMovingAgentComponent().ResetMoveRequests();
}
parent.StopEffect('underwater_swimming');
divingEffectPlaying = false;
theGame.GetGameCamera().ResetCollisionOffset();
parent.SetIsSwimming(false);
parent.OnCombatActionEndComplete();
theSound.SoundEvent("fx_underwater_off");
SetCapsuleToSwim(false);
parentMAC.SetSwimming(false);
parentMAC.SetDiving(false);

(W3PlayerWitcher)parent.SetBIsCombatActionAllowed(true);
thePlayer.UnblockAction(33, 'Diving');
ResetVariables();
if (!thePlayer.IsSwimming()){
EnableRadialSlots();
}
if (nextStateName != 'AimThrow'){
GetWitcherPlayer().AddAndEquipInfiniteBolt(true, /* NOP
*/);
GetWitcherPlayer().ClearPreviouslyUsedBolt();
}
parent.PlayEffect('dripping_water', /* NOP */);
parent.GetMovingAgentComponent().SetEnabledFeetIK(true, /* NOP *
/);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function SwimmingLatentInit(){
parent.ActivateAndSyncBehavior('PlayerSwimming', /* NOP */);
if ((W3ReplacerCiri)parent){
parent.SetBehaviorVariable('test_ciri_replacer', 1.00000
0, /* NOP */);
}
if (parent.IsRagdolled()){
parent.SetBehaviorVariable('recoverFromRagdoll', 1.00000
0, /* NOP */);
} else {
parent.SetBehaviorVariable('recoverFromRagdoll', 0.00000
0, /* NOP */);
PredictWaterDepth(parent.GetWorldPosition() + parent.Get
HeadingVector() * jumpToWaterAnimDist);
if (predictedWaterDepth < 9999 && predictedWaterDepth >=
START_SWIMMING_WATER_LEVEL){
parent.SetBehaviorVariable('bCanJumpToWater', 1.
000000, /* NOP */);
} else {
parent.SetBehaviorVariable('bCanJumpToWater', 0.
000000, /* NOP */);
}
}
if (thePlayer.IsHoldingItemInLHand()){
HideUsableItemL();
}
/* NOP */;
}
public function SwimmingInitGeneral(prevStateName : CName){
theInput.SetContext('Swimming');
StateBlockInputActions(true);
TurnOnSwimmingCamera();
parent.GetMovingAgentComponent().SetEnabledFeetIK(false, /* NOP
*/);
parent.SetBIsInCombatAction(false);
parent.findMoveTargetDist = parent.findMoveTargetDistMax;
parent.OnMeleeForceHolster(true);
parent.HideUsableItem(true);
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
if (prevStateName == 'DismountHorse'){
parent.SetIsInAir(true);
}
if (prevStateName == 'AimThrow'){

SwimmingInitAfterAimThrow();
} else {
SwimmingInitNormal(prevStateName);
}
/* NOP */;
}
public function SwimmingInitNormal(prevStateName : CName){
if (!splashEntityTemplate){
splashEntityTemplate = (CEntityTemplate)LoadResource('wa
ter_splashes', /* NOP */);
}
startSwimPos = parent.GetWorldPosition();
if (!thePlayer.IsSwimming()){
DisableRadialSlots();
}
parent.AddAnimEventCallback('TurnOnDiving', 'OnAnimEvent_TurnOnD
iving');
parent.AddAnimEventCallback('AllowSwitchToDiving', 'OnAnimEvent_
AllowSwitchToDiving');
parent.StopEffect('dripping_water');
ResetVariables();
EnableBuffImmunities(true);
SetCapsuleToSwim(true);
/* NOP */;
ShouldSpawnWaterSplash(prevStateName);
if (parent.IsRagdolled()){
ToggleDiving(true);
theInput.SetContext('Diving');
}
GetWitcherPlayer().AddAndEquipInfiniteBolt(false, true);
/* NOP */;
}
public function SwimmingInitAfterAimThrow(){
if (diving){
TurnOnDivingCamera();
theInput.SetContext('Diving');
}
/* NOP */;
}
private latent function HideUsableItemL(){
while (true){
if (!thePlayer.IsUsableItemLBlocked()){
thePlayer.OnUseSelectedItem(true);
return;
}
Sleep(0.100000);
}
/* NOP */;
}
private function DisableRadialSlots(){
var slotsToBlock : array<CName>;
slotsToBlock.PushBack('Yrden');
slotsToBlock.PushBack('Quen');
slotsToBlock.PushBack('Igni');
slotsToBlock.PushBack('Axii');
slotsToBlock.PushBack('Aard');
slotsToBlock.PushBack('Slot1');
slotsToBlock.PushBack('Slot2');
slotsToBlock.PushBack('Slot3');
slotsToBlock.PushBack('Slot4');

slotsToBlock.PushBack('Slot5');
parent.EnableRadialSlotsWithSource(false, slotsToBlock, 'swimmin
g');
/* NOP */;
}
private function EnableRadialSlots(){
var slotsToBlock : array<CName>;
slotsToBlock.PushBack('Yrden');
slotsToBlock.PushBack('Quen');
slotsToBlock.PushBack('Igni');
slotsToBlock.PushBack('Axii');
slotsToBlock.PushBack('Aard');
slotsToBlock.PushBack('Slot1');
slotsToBlock.PushBack('Slot2');
slotsToBlock.PushBack('Slot3');
slotsToBlock.PushBack('Slot4');
slotsToBlock.PushBack('Slot5');
parent.EnableRadialSlotsWithSource(true, slotsToBlock, 'swimming
');
/* NOP */;
}
private function ResetVariables(){
walkDeep = false;
swimming = false;
diving = false;
divingStarting = false;
swimStart = false;
swimStagger = false;
minSubmergeDepthReached = false;
inDivingState = false;
divingEnd = false;
blockPopState = false;
usePredicitonDepth = false;
jumpToWaterInProgress = false;
blockDiveDown = false;
/* NOP */;
}
private function EnableBuffImmunities(enable : Bool){
if (enable){
parent.AddBuffImmunity_AllCritical('Swimming', true);
} else {
parent.RemoveBuffImmunity_AllCritical('Swimming');
}
/* NOP */;
}
private function SetCapsuleToSwim(_swimming : Bool){
var mac : CMovingPhysicalAgentComponent;
if (_swimming){
parent.GetMovingAgentComponent().SetVirtualRadius('Swimm
ingRadius', /* NOP */);
} else {
parent.GetMovingAgentComponent().ResetVirtualRadius(/* N
OP */);
}
parentMAC.EnableVirtualControllerCollisionResponse('Swimming', _
swimming);
/* NOP */;
}
private function StateBlockInputActions(toggle : Bool){
if (toggle){

parent.BlockAction(1, 'SwimmingState', /* NOP */, /* NOP


*/, /* NOP */);
parent.BlockAction(0, 'SwimmingState', /* NOP */, /* NOP
*/, /* NOP */);
parent.BlockAction(4, 'SwimmingState', /* NOP */, /* NOP
*/, /* NOP */);
parent.BlockAction(13, 'SwimmingState', /* NOP */, /* NO
P */, /* NOP */);
} else {
parent.BlockAllActions('SwimmingState', false, /* NOP */
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private function ShouldSpawnWaterSplash(prevState : CName){
var fallDist : Float;
if (prevState == 'AimThrow'){
return;
}
if (parent.GetFallDist(fallDist)){
if (fallDist > 2.000000 && CheckWaterDepth(START_SWIMMIN
G_WATER_LEVEL)){
SpawnWaterSplash('man_water_splash');
if (theInput.IsActionPressed('DiveDown') && Chec
kWaterDepth(MIN_WATER_LEVEL_FOR_DIVING)){
parent.SetBehaviorVariable('divePitch',
-1.000000, /* NOP */);
}
} else {
SpawnWaterSplash('splash_small');
}
} else if (prevState == 'DismountHorse'){
SpawnWaterSplash('splash_small');
}
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
virtual_parent.OnPlayerTickTimer(deltaTime);
SwimmingLoop(deltaTime);
ProcessPlayerOrientation();
if (diving && theGame.GetGameCamera().GetActivePivotRotationCont
roller().controllerName != 'Diving'){
TurnOnDivingCamera();
}
if (swimming && !CheckIdle() && !diving){
UpdatePitch();
}
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.HideUsableItem(true);
}
if (thePlayer.IsWeaponHeld('steelsword') || thePlayer.IsWeaponHe
ld('silversword')){
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
}
if (!diving){
CalculateWindPower();
} else {
windPower = 0.000000;
}
/* NOP */;

}
private function SwimmingLoop(dt : Float){
var waterDepth : Float;
var submergeDepth : Float;
currentWaterDepth = GetWaterDepth();
submergeDepth = GetSubmergeDepth();
if (usePredicitonDepth){
waterDepth = predictedWaterDepth;
} else {
waterDepth = currentWaterDepth;
}
if (parent.IsInAir() || jumpToWaterInProgress || divingStarting)
{
if (!diving && submergeDepth < ENTER_DIVING_WATER_LEVEL)
{
ToggleDiving(true);
}
if (!diving){
if (submergeDepth < LEAVE_STATE_SUBMERGE_DEPTH){
ToggleSwimming(true, /* NOP */);
parent.SetIsInAir(false);
}
} else if (submergeDepth < ENTER_DIVING_WATER_LEVEL){
parent.SetIsInAir(false);
}
} else if (waterDepth > 0 && submergeDepth <= LEAVE_STATE_SUBMER
GE_DEPTH){
if (waterDepth <= LEAVE_STATE_WATER_LEVEL){
/* NOP */;
if (!swimming){
TryToPopState();
}
ToggleSwimming(false, /* NOP */);
ToggleWalkDeep(false);
} else if (waterDepth < WALK_DEEP_WATER_LEVEL){
ToggleSwimming(false, /* NOP */);
ToggleWalkDeep(false);
} else if (!IsSwimmingAllowed()){
return;
} else if (waterDepth < START_SWIMMING_WATER_LEVEL){
ToggleSwimming(false, true);
ToggleWalkDeep(true);
} else if (!swimming){
ToggleSwimming(true, /* NOP */);
}
} else if (submergeDepth > LEAVE_STATE_SUBMERGE_DEPTH){
/* NOP */;
ToggleSwimming(false, /* NOP */);
ToggleWalkDeep(false);
TryToPopState();
} else if (!IsSwimmingAllowed()){
return;
} else if (!swimming){
ToggleSwimming(true, /* NOP */);
ToggleWalkDeep(false);
}
if (swimming || diving){
FailSafeVerify();
if (!jumpToWaterInProgress){
ShouldGoDiving(submergeDepth);

}
if (diving){
if (submergeDepth < -3.000000){
if (!divingEffectPlaying){
parent.PlayEffect('underwater_sw
imming', /* NOP */);
divingEffectPlaying = true;
}
} else {
parent.StopEffect('underwater_swimming')
;
divingEffectPlaying = false;
}
}
}
if (!unlimitedDiving && submergeDepth < MINIMAL_SUBMERGE_DEPTH){
ReleaseDiveDown();
minSubmergeDepthReached = true;
} else {
minSubmergeDepthReached = false;
}
/* NOP */;
}
private function FailSafeVerify(){
var currentContext : CName;
currentContext = theInput.GetContext();
if (parentMAC.GetPhysicalState() != 3){
if (diving){
parentMAC.SetDiving(true);
} else if (swimming){
parentMAC.SetSwimming(true);
}
}
/* NOP */;
}
private function UpdatePitch(){
var currentPosition : Vector;
var frontPoint : Vector;
var backPoint : Vector;
var frontWaterLevel : Float;
var backWaterLevel : Float;
var delta : Float;
var pitch : Float;
currentPosition = parent.GetWorldPosition();
frontPoint = currentPosition + parent.GetHeadingVector() * 0.500
000;
backPoint = currentPosition - parent.GetHeadingVector() * 0.5000
00;
frontWaterLevel = theGame.GetWorld().GetWaterLevel(frontPoint, t
rue);
backWaterLevel = theGame.GetWorld().GetWaterLevel(backPoint, tru
e);
if (frontWaterLevel >= 10000 || backWaterLevel >= 10000){
pitch = 0.000000;
} else {
delta = frontWaterLevel - backWaterLevel;
pitch = Rad2Deg(AtanF(delta, 1));
}
parent.SetBehaviorVariable('swimmingPitchCorrection', pitch, /*
NOP */);

/* NOP */;
}
private function TryToPopState(){
if (!blockPopState && !swimStart){
parent.OnEnterShallowWater();
parent.GotoStateAuto();
}
/* NOP */;
}
public function ShouldDrainStamina() : Bool{
var currentArea : EAreaName;
currentArea = theGame.GetCommonMapManager().GetCurrentArea();
if (!IsInTroubledWater() || currentArea == 4){
return false;
}
return true;
/* NOP */;
}
public function IsInColdWater() : Bool{
var currentArea : EAreaName;
currentArea = theGame.GetCommonMapManager().GetCurrentArea();
switch(currentArea){
case 2:
return true;
case 6:
return true;
default:
}
return false;
/* NOP */;
}
public function IsInTroubledWater() : Bool{
return windPower >= 0.500000;
/* NOP */;
}
public function GetWindPower() : Float{
return windPower;
/* NOP */;
}
public function GetWaterDepth() : Float{
return theGame.GetWorld().GetWaterDepth(parent.GetWorldPosition(
), true);
/* NOP */;
}
public function CheckIdle() : Bool{
return parent.rawPlayerSpeed == 0 && theInput.IsActionReleased('
DiveDown') && theInput.IsActionReleased('DiveUp');
/* NOP */;
}
public function EnableUnlimitedDiving(enable : Bool){
unlimitedDiving = enable;
/* NOP */;
}
public function IsSwimmingAllowed() : Bool{
return true;
/* NOP */;
}
private function ToggleWalkDeep(toggle : Bool){
if (toggle && !walkDeep){
parent.SetBehaviorVariable('walkDeep', 1.000000, /* NOP

*/);
walkDeep = true;
} else if (!toggle && walkDeep){
parent.SetBehaviorVariable('walkDeep', 0.000000, /* NOP
*/);
walkDeep = false;
}
/* NOP */;
}
private function ToggleSwimming(toggle : Bool, ignorePAC : Bool){
if (toggle && !swimming){
parent.OnRangedForceHolster(true, /* NOP */, /* NOP */);
parent.SetIsSwimming(true);
SetBehaviorGraphVariables(1.000000);
ToggleWalkDeep(false);
swimming = true;
if (!ignorePAC){
parentMAC.SetSwimming(true);
}
/* NOP */;
parent.AddEffectDefault(105, parent, 'Swimming', /* NOP
*/);
} else if (!toggle && swimming){
parent.SetIsSwimming(false);
SetBehaviorGraphVariables(0.000000);
swimming = false;
swimStart = false;
if (!ignorePAC){
parentMAC.SetSwimming(false);
}
/* NOP */;
parent.RemoveBuff(105, /* NOP */, /* NOP */);
}
/* NOP */;
}
private function ToggleDiving(toggle : Bool){
var slotsToBlock : array<CName>;
var displayTargetActor : CActor;
if (toggle && !diving){
swimStart = false;
parent.SetBehaviorVariable('diving', 1.000000, /* NOP */
);
diving = true;
parent.StartAirRegen();
parent.PauseEffects(59, 'Diving', true, /* NOP */, /* NO
P */);
parent.AddEffectDefault(101, NULL, 'Diving', /* NOP */);
parent.AddEffectDefault(105, NULL, 'Swimming', /* NOP */
);
parentMAC.SetDiving(true);
LogSwimming("Entered Diving");
TurnOnDivingCamera();
theInput.SetContext('Diving');
ToggleSwimStagger(false);
cachedVerCameraTimeout = theGame.GetGameCamera().GetManu
alRotationVerTimeout();
theGame.GetGameCamera().SetManualRotationVerTimeout(9999
.000000);
slotsToBlock.PushBack('Slot3');
thePlayer.EnableRadialSlotsWithSource(true, slotsToBlock

, 'swimming');
} else if (!toggle && diving){
parent.OnRangedForceHolster(false, true, true);
if (parent.RaiseEvent('DiveEnd')){
divingEnd = true;
}
thePlayer.UnblockAction(33, 'Diving');
parent.SetBehaviorVariable('diving', 0.000000, /* NOP */
);
parent.SetBehaviorVariable('cameraPitch', 0.000000, /* N
OP */);
parent.SetBehaviorVariable('divePitch', 0.000000, /* NOP
*/);
if (thePlayer.IsSprintActionPressed()){
parent.SetIsSprinting(true);
}
diving = false;
parent.RemoveBuff(101, /* NOP */, /* NOP */);
parent.RemoveBuff(57, /* NOP */, /* NOP */);
parent.ResumeEffects(59, 'Diving');
parent.RemoveBuff(105, /* NOP */, /* NOP */);
parentMAC.SetDiving(false);
theGame.GetGameCamera().ChangePivotRotationController('S
wimming');
theGame.GetGameCamera().ChangePivotPositionController('D
efault');
theGame.GetGameCamera().ChangePivotDistanceController('D
efault');
theInput.SetContext('Swimming');
LogSwimming("Left Diving");
theGame.GetGameCamera().SetManualRotationVerTimeout(cach
edVerCameraTimeout);
slotsToBlock.PushBack('Slot3');
thePlayer.EnableRadialSlotsWithSource(false, slotsToBloc
k, 'swimming');
}
displayTargetActor = (CActor)parent.GetDisplayTarget();
if (parent.IsHardLockEnabled() && displayTargetActor && !parent.
CanBeTargetedIfSwimming(displayTargetActor, /* NOP */)){
parent.HardLockToTarget(false);
}
/* NOP */;
}
private timer function SetSwimming(optional dt : Float, optional id : In
t32){
if (swimming){
parentMAC.SetSwimming(true);
}
/* NOP */;
}
private function ShouldGoDiving(depth : Float){
if (!diving && !divingEnd && depth < ENTER_DIVING_WATER_LEVEL){
if (swimming){
OnDive();
} else {
ToggleDiving(true);
}
} else if (!divingStarting && diving){
if (inDivingState && depth > EXIT_DIVING_WATER_LEVEL ||
!inDivingState && depth > EXIT_DIVING_WATER_LEVEL - 0.800000){

ToggleDiving(false);
}
}
if (diving){
if (depth > EXIT_DIVING_WATER_LEVEL - 0.800000){
thePlayer.BlockAction(33, 'Diving', /* NOP */, /
* NOP */, /* NOP */);
} else {
thePlayer.UnblockAction(33, 'Diving');
}
}
/* NOP */;
}
private function SpawnWaterSplash(splash : CName){
var splashPosition : Vector;
var splashEntity : CEntity;
if (splashEntityTemplate){
splashPosition = parent.GetWorldPosition();
splashPosition.Z = theGame.GetWorld().GetWaterLevel(spla
shPosition, true) - 0.100000;
splashEntity = theGame.CreateEntity(splashEntityTemplate
, splashPosition, parent.GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
splashEntity.PlayEffect(splash, /* NOP */);
splashEntity.DestroyAfter(5.000000);
}
/* NOP */;
}
private function ReleaseDiveDown() : Bool{
if (theInput.IsActionPressed('DiveDown')){
theInput.ForceDeactivateAction('DiveDown');
parent.RaiseEvent('TouchedBottom');
return true;
}
return false;
/* NOP */;
}
private function GetSubmergeDepth() : Float{
return parentMAC.GetSubmergeDepth();
/* NOP */;
}
private function CheckWaterDepth(minDepth : Float) : Bool{
var depth : Float;
depth = currentWaterDepth;
if (depth >= minDepth){
return true;
} else if (depth < 0){
return true;
}
return false;
/* NOP */;
}
private function ChangeEmergeSpeed(value : Float){
if (defaultEmergeSpeed <= 0){
defaultEmergeSpeed = parentMAC.GetEmergeSpeed();
}
parentMAC.SetEmergeSpeed(value);
/* NOP */;
}
private function ResetEmergeSpeed(){

parentMAC.SetEmergeSpeed(defaultEmergeSpeed);
/* NOP */;
}
private function CalculateWindPower(){
var tempWindPower : Float;
var water_depthDiff : Float;
water_depthDiff = PowF(ClampF(currentWaterDepth / 12.000000, 0.0
00000, 1.000000), 1.400000);
tempWindPower = VecLength(theGame.GetWindAtPointForVisuals(paren
t.GetWorldPosition()));
windPower = tempWindPower * LerpF(water_depthDiff, 0.050000, 1.0
00000, /* NOP */);
/* NOP */;
/* NOP */;
}
private function ToggleSwimStagger(toggle : Bool){
if (toggle && !diving){
parent.SetBehaviorVariable('swimStagger', 1.000000, /* N
OP */);
parent.BlockAction(6, 'swimStagger', /* NOP */, /* NOP *
/, /* NOP */);
} else if (!toggle && diving){
parent.SetBehaviorVariable('swimStagger', 0.000000, /* N
OP */);
parent.BlockAllActions('swimStagger', false, /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function SwimmingStagger(optional dt : Float, optional id :
Int32){
ToggleSwimStagger(false);
/* NOP */;
}
private function SetBehaviorGraphVariables(f : Float){
var animSpeedMult : Float;
if (f <= 0.000000){
animSpeedMult = 1.000000;
} else {
animSpeedMult = 0.750000;
}
parent.SetBehaviorVariable('isSwimming', f, /* NOP */);
parent.SetBehaviorVariable('animSpeedMultForOverlay', animSpeedM
ult, /* NOP */);
/* NOP */;
}
public function PredictWaterDepth(pos : Vector){
predictedWaterDepth = theGame.GetWorld().GetWaterDepth(pos, /* N
OP */);
/* NOP */;
}
public function OnOceanTriggerLeave() : Bool{
virtual_parent.OnOceanTriggerLeave();
SetBehaviorGraphVariables(0.000000);
parent.RaiseForceEvent('FromSwimming');
parent.RaiseForceEvent('SwimmingStop');
parent.GotoStateAuto();
/* NOP */;
}
public function OnDivingEnd() : Bool{

if (!diving){
SpawnWaterSplash('man_surfacing_splash');
parent.GetMovingAgentComponent().ResetHeight();
}
/* NOP */;
}
public function OnTeleportToStartPos() : Bool{
parent.Teleport(startSwimPos);
parent.RaiseForceEvent('ToAwake');
/* NOP */;
}
public function OnTeleportToStartPosEnd() : Bool{
parent.SetIsMovable(true);
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetSwimming(false);
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetAnimatedMovement(false);
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetGravity(true);
/* NOP */;
}
public function OnWaterBottomTouch() : Bool{
if (diving){
blockDiveDown = true;
parent.AddTimer('ReleaseBlockDiveDown', 0.100000, false,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (ReleaseDiveDown()){
LogSwimming("Touched Bottom");
}
}
/* NOP */;
}
public timer function ReleaseBlockDiveDown(optional dt : Float, optional
id : Int32){
blockDiveDown = false;
/* NOP */;
}
public function OnParentSpawned() : Bool{
if (!splashEntityTemplate){
splashEntityTemplate = (CEntityTemplate)LoadResource('wa
ter_splashes', /* NOP */);
}
/* NOP */;
}
public function OnDiveInput(divePitch : Float) : Bool{
if (diving){
theGame.GetGameCamera().ForceManualControlVerTimeout();
theGame.GetGameCamera().ForceManualControlHorTimeout();
}
/* NOP */;
}
public function OnEmptyStamina() : Bool{
}
public function OnAllowShallowWaterCheck() : Bool{
return !swimming && !diving && !walkDeep;
/* NOP */;
}
public function OnCheckDiving() : Bool{
return diving;
/* NOP */;

}
public function OnAllowSwimmingSprint() : Bool{
return swimming || diving && !CheckIdle() && parent.IsRunPressed
();
/* NOP */;
}
public function OnAllowedDiveDown() : Bool{
if (!diving){
return true;
}
return !minSubmergeDepthReached && !blockDiveDown;
/* NOP */;
}
public function OnDiving(dir : Int32) : Bool{
return true;
/* NOP */;
}
public function OnDive() : Bool{
if (!diving && swimming && !parent.HasBuff(57)){
theInput.ForceDeactivateAction('DiveUp');
if (CheckWaterDepth(MIN_WATER_LEVEL_FOR_DIVING)){
if (parent.RaiseEvent('Dive')){
return true;
}
} else if (parent.RaiseEvent('DiveFail')){
SpawnWaterSplash('man_surfacing_splash');
return false;
}
}
return false;
/* NOP */;
}
public function OnHitAnimationStart() : Bool{
if (CheckWaterDepth(2.000000)){
divingStarting = true;
parent.SetBIsCombatActionAllowed(false);
ToggleDiving(true);
}
/* NOP */;
}
public function OnDiveAnimationStart() : Bool{
divingStarting = true;
parent.SetBIsCombatActionAllowed(false);
ToggleDiving(true);
jumpToWaterInProgress = false;
/* NOP */;
}
public function OnDiveAnimationEnd() : Bool{
divingStarting = false;
parent.SetBIsCombatActionAllowed(true);
parent.SetBIsInCombatAction(false);
parent.GetMovingAgentComponent().SetHeight(1.000000);
/* NOP */;
}
public function OnDivingStateStart() : Bool{
inDivingState = true;
parent.GetMovingAgentComponent().SetHeight(1.000000);
/* NOP */;
}
public function OnDivingStateStop() : Bool{

inDivingState = false;
parent.GetMovingAgentComponent().ResetHeight();
/* NOP */;
}
public function OnSwimStart() : Bool{
divingEnd = false;
swimStart = true;
if (!swimming){
parentMAC.SetSwimming(true);
}
/* NOP */;
}
public function OnSwimEnd() : Bool{
swimStart = false;
/* NOP */;
}
public function OnIdleStart() : Bool{
swimStart = false;
parent.SetIsInAir(false);
if (!swimming){
parentMAC.SetSwimming(false);
}
/* NOP */;
}
public function OnIdleEnd() : Bool{
}
public function OnDivingEndStart() : Bool{
divingEnd = true;
/* NOP */;
}
public function OnDivingEndStop() : Bool{
divingEnd = false;
/* NOP */;
}
public function OnJumpToWaterStart() : Bool{
jumpToWaterInProgress = true;
/* NOP */;
}
public function OnJumpToDiveStart() : Bool{
divingStarting = true;
/* NOP */;
}
public function OnJumpToWaterEnd() : Bool{
parent.SetIsInAir(false);
divingStarting = false;
jumpToWaterInProgress = false;
/* NOP */;
}
public function OnSwimToIdleStart() : Bool{
blockPopState = true;
PredictWaterDepth(parent.GetWorldPosition() + parent.GetHeadingV
ector() * swimToIdleAnimDist);
usePredicitonDepth = true;
/* NOP */;
}
public function OnSwimToIdleEnd() : Bool{
blockPopState = false;
usePredicitonDepth = false;
/* NOP */;
}

public function OnPerformEvade(playerEvadeType : EPlayerEvadeType) : Boo


l{
if (!parent.HasStaminaToUseAction(6, /* NOP */, /* NOP */, /* NO
P */)){
parent.SoundEvent("gui_ingame_low_stamina_warning", /* N
OP */, /* NOP */);
} else {
if (playerEvadeType == 1){
parent.bIsRollAllowed = true;
}
return PerformEvade(playerEvadeType);
}
return false;
/* NOP */;
}
public function PerformEvade(playerEvadeType : EPlayerEvadeType) : Bool{
if (!diving){
return false;
}
parent.SetBehaviorVariable('combatActionType', 2, /* NOP */);
/* NOP */;
OnDodgeBoost();
parent.RaiseEvent('Dodge');
parent.DrainStamina(7, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */);
return true;
/* NOP */;
}
public function OnDodgeBoost() : Bool{
parent.AddTimer('DodgeBoostTimeOut', 1.000000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
parent.SetBehaviorVariable('dodgeBoost', 1.000000, /* NOP */);
if (parent.rangedWeapon.GetCurrentStateName() != 'State_WeaponWa
it'){
parent.SetBehaviorVariable('dodgeBoostPlaySpeed', 3.0000
00, /* NOP */);
} else {
parent.SetBehaviorVariable('dodgeBoostPlaySpeed', 1.0000
00, /* NOP */);
}
/* NOP */;
}
public timer function DodgeBoostTimeOut(optional dt : Float, optional id
: Int32){
parent.SetBehaviorVariable('dodgeBoost', 0.000000, /* NOP */);
/* NOP */;
}
private function ProcessPlayerOrientation(){
var newOrientationTarget : EOrientationTarget;
var customOrientationInfo : SCustomOrientationInfo;
var customOrientationTarget : EOrientationTarget;
if (parent.GetCustomOrientationTarget(customOrientationInfo)){
customOrientationTarget = customOrientationInfo.orientat
ionTarget;
} else {
customOrientationTarget = 5;
}
if (parent.moveTarget && parent.moveTarget.IsAlive()){
newOrientationTarget = 1;
} else if ((W3PlayerWitcher)parent && (W3PlayerWitcher)parent.Is

CastingSign() && !parent.IsInCombat()){


newOrientationTarget = 4;
} else if (parent.GetTarget() && parent.IsInCombatAction()){
newOrientationTarget = 1;
} else {
newOrientationTarget = 0;
}
if (parent.IsThrowingItemWithAim()){
newOrientationTarget = 4;
}
if (customOrientationTarget != 5){
newOrientationTarget = customOrientationTarget;
}
if (newOrientationTarget != parent.GetOrientationTarget()){
parent.SetOrientationTarget(newOrientationTarget);
}
/* NOP */;
}
public function EnableSprintingCamera(flag : Bool){
if (parent.sprintingCamera){
parent.sprintingCamera = false;
theGame.GetGameCamera().StopAnimation('camera_shake_loop
_lvl1_1');
}
/* NOP */;
}
public function EnableRunCamera(flag : Bool){
if (parent.runningCamera){
parent.runningCamera = false;
theGame.GetGameCamera().StopAnimation('camera_shake_loop
_lvl1_5');
}
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
theGame.GetGameCamera().SetCollisionOffset(Vector(0.000000, 0.00
0000, 1.000000));
if (theGame.IsFocusModeActive()){
return false;
} else if (parent.OnGameCameraTick(moveData, dt)){
return true;
}
return false;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var cameraRotation : EulerAngles;
var cameraPosition : Vector;
var waterLevel : Float;
var diff : Float;
var cameraPitch : Float;
var divePitch : Float;
var angleDistBetweenPlayerAndCamera : Float;
var playerToTargetVector : Vector;
var playerToTargetAngles : EulerAngles;
var playerToTargetPitch : Float;
cameraPosition = theCamera.GetCameraPosition();
waterLevel = theGame.GetWorld().GetWaterLevel(cameraPosition, tr

ue);
diff = cameraPosition.Z - waterLevel;
UpdateDivingPitch();
if (cameraIsUnderwater && diff >= 0){
parent.PlayEffect('water_effect_surfacing', /* NOP */);
cameraIsUnderwater = false;
theSound.SoundEvent("fx_underwater_off");
} else if (!cameraIsUnderwater && diff < 0){
cameraIsUnderwater = true;
theSound.SoundEvent("fx_underwater_on");
}
cameraRotation = theCamera.GetCameraRotation();
cameraPitch = AngleNormalize180(cameraRotation.Pitch);
angleDistBetweenPlayerAndCamera = AbsF(AngleDistance(parent.GetH
eading(), VecHeading(theCamera.GetCameraDirection())));
if (cameraPitch < 0 && !OnAllowedDiveDown() || angleDistBetweenP
layerAndCamera > 135){
parent.SetBehaviorVariable('cameraPitch', 0.000000, /* N
OP */);
} else {
parent.SetBehaviorVariable('cameraPitch', cameraPitch, /
* NOP */);
}
if (parent.IsCameraLockedToTarget()){
playerToTargetVector = parent.GetDisplayTarget().GetWorl
dPosition() - parent.GetWorldPosition();
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(playerToTargetVector), 0.500000);
playerToTargetAngles = VecToRotation(playerToTargetVecto
r);
playerToTargetPitch = playerToTargetAngles.Pitch + 10;
moveData.pivotRotationController.SetDesiredPitch(playerT
oTargetPitch * -1, 0.500000);
} else if (moveData.pivotRotationController.controllerName == 'D
iving'){
divePitch = parent.GetBehaviorVariable('divePitch', /* N
OP */);
if (divePitch <= -1.000000){
moveData.pivotRotationController.SetDesiredPitch
(-89.000000, /* NOP */);
moveData.pivotRotationController.minPitch = -80.
000000;
moveData.pivotRotationController.maxPitch = -60.
000000;
} else if (divePitch >= 1.000000){
moveData.pivotRotationController.SetDesiredPitch
(89.000000, /* NOP */);
moveData.pivotRotationController.maxPitch = 80.0
00000;
moveData.pivotRotationController.minPitch = 60.0
00000;
} else {
if (!thePlayer.GetIsSprinting()){
moveData.pivotRotationController.SetDesi
redPitch(0.000000, /* NOP */);
}
moveData.pivotRotationController.minPitch = -45.
000000;
moveData.pivotRotationController.maxPitch = 45.0
00000;

}
} else if (divingEnd){
moveData.pivotRotationController.SetDesiredPitch(-10.000
000, 3.000000);
theGame.GetGameCamera().ForceManualControlHorTimeout();
} else if (moveData.pivotRotationController.controllerName == 'S
wimming'){
moveData.pivotRotationController.SetDesiredPitch(-10.000
000, /* NOP */);
}
if (moveData.pivotPositionController.controllerName == 'Diving')
{
if (parent.rawPlayerSpeed == 0){
moveData.pivotPositionController.offsetZ = 1.750
000;
} else {
moveData.pivotPositionController.offsetZ = 1.150
000;
}
}
if (theGame.IsFocusModeActive()){
moveData.pivotDistanceController.SetDesiredDistance(1.00
0000, /* NOP */);
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(theCamera.GetCameraDirection()), /* NOP */);
} else if (moveData.pivotDistanceController.controllerName == 'D
iving'){
if (cameraPitch < 0 && diff >= -0.250000){
moveData.pivotDistanceController.SetDesiredDista
nce(0, /* NOP */);
} else if (parent.rawPlayerSpeed == 0){
moveData.pivotDistanceController.SetDesiredDista
nce(2.250000, /* NOP */);
} else {
moveData.pivotDistanceController.SetDesiredDista
nce(2.750000, /* NOP */);
}
}
super.OnGameCameraPostTick(moveData, dt);
/* NOP */;
}
public function OnIsCameraUnderwater() : Bool{
return cameraIsUnderwater;
/* NOP */;
}
private function UpdateCameraShooting(moveData : SCameraMovementData, ti
meDelta : Float){
}
private function UpdateDivingPitch(){
if (parent.rangedWeapon && parent.rangedWeapon.GetCurrentStateNa
me() != 'State_WeaponWait'){
thePlayer.SetBehaviorVariable('divePitch', 0.000000, /*
NOP */);
} else if (theInput.IsActionPressed('DiveUp')){
if (thePlayer.bLAxisReleased){
thePlayer.SetBehaviorVariable('divePitch', 1.000
000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('divePitch', 0.900
000, /* NOP */);

}
} else if (theInput.IsActionPressed('DiveDown')){
if (thePlayer.bLAxisReleased){
thePlayer.SetBehaviorVariable('divePitch', -1.00
0000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('divePitch', -0.90
0000, /* NOP */);
}
} else {
thePlayer.SetBehaviorVariable('divePitch', 0.000000, /*
NOP */);
}
/* NOP */;
}
private function TurnOnSwimmingCamera(){
theGame.GetGameCamera().ChangePivotRotationController('Swimming'
);
theGame.GetGameCamera().ChangePivotDistanceController('Default')
;
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
/* NOP */;
}
private function TurnOnDivingCamera(){
theGame.GetGameCamera().ChangePivotRotationController('Diving');
theGame.GetGameCamera().ChangePivotPositionController('Diving');
theGame.GetGameCamera().ChangePivotDistanceController('Diving');
/* NOP */;
}
public function OnAnimEvent_TurnOnDiving(animEventName : CName, animEven
tType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
OnDiveAnimationStart();
/* NOP */;
}
public function OnAnimEvent_AllowSwitchToDiving(animEventName : CName, a
nimEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (CheckWaterDepth(MIN_WATER_LEVEL_FOR_DIVING)){
parent.SetBehaviorVariable('AllowSwitchToDiving', 1.0000
00, /* NOP */);
} else {
parent.SetBehaviorVariable('AllowSwitchToDiving', 0.0000
00, /* NOP */);
}
/* NOP */;
}
private function LogSwimming(text : String){
/* NOP */;
/* NOP */;
}
}
import abstract class CEffectDummyComponent{
}
class CBTTaskRiderSetRaceAlongPathActionOnHorseDef extends IBehTreeRiderTaskDefi
nition{
public function OnSpawn(taskGen : IBehTreeTask){
var myParams : CAIRiderRaceAlongPathActionParams;
var task : CBTTaskRiderSetRaceAlongPathActionOnHorse;

task = (CBTTaskRiderSetRaceAlongPathActionOnHorse)taskGen;
task.horseRaceAlongPathAction = new CAIRaceAlongPathAction in th
is;
task.horseRaceAlongPathAction.OnCreated();
myParams = (CAIRiderRaceAlongPathActionParams)GetAIParametersByC
lassName('CAIRiderRaceAlongPathActionParams');
myParams.CopyTo((CAIRaceAlongPathParams)task.horseRaceAlongPathA
ction.params);
task.horseRaceAlongPathAction.OnManualRuntimeCreation();
/* NOP */;
}
}
import struct CPathComponent{
import public final function FindClosestEdge(point : Vector) : Int32;
import public final function GetAlphaOnEdge(point : Vector, edgeIdx : In
t32, epsilon : Float) : Float;
import public final function GetClosestPointOnPath(point : Vector, epsil
on : Float) : Vector;
import public final function GetClosestPointOnPathExt(point : Vector, ed
geIdx : Int32, edgeAlpha : Float, epsilon : Float) : Vector;
import public final function GetDistanceToPath(point : Vector, epsilon :
Float) : Float;
import public final function GetNextPointOnPath(point : Vector, distance
: Float, isEndOfPath : Bool, epsilon : Float) : Vector;
import public final function GetNextPointOnPathExt(edgeIdx : Int32, edge
Alpha : Float, distance : Float, isEndOfPath : Bool, epsilon : Float) : Vector;
import public final function GetWorldPoint(index : Int32) : Vector;
import public final function GetPointsCount() : Int32;
}
import struct CAreaComponent{
import public final function TestEntityOverlap(ent : CEntity) : Bool;
import public final function TestPointOverlap(point : Vector) : Bool;
import public final function GetWorldPoints(points : array<Vector>);
}
class CBTTaskRiderAdjustToHorse extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var ticket : SMovementAdjustmentRequestTicket;
public latent function Main() : EBTNodeStatus{
var actor : CActor;
var movementAdjustor : CMovementAdjustor;
var riderData : CAIStorageRiderData;
var dir : Vector;
var targetYaw : Float;
var time : Float;
var squaredDistance : Float;
var angle : EulerAngles;
actor = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
movementAdjustor = actor.GetMovingAgentComponent().GetMovementAd
justor();
if (!riderData.sharedParams.GetHorse()){
return 1;
}
squaredDistance = VecDistanceSquared(riderData.sharedParams.GetH
orse().GetWorldPosition(), GetActor().GetWorldPosition());
if (squaredDistance > 5.000000 * 5.000000){
return 1;

}
dir = riderData.sharedParams.GetHorse().GetWorldPosition() - act
or.GetWorldPosition();
angle = VecToRotation(dir);
targetYaw = angle.Yaw;
time = 0.500000;
ticket = movementAdjustor.CreateNewRequest('AdjustToHorse');
movementAdjustor.AdjustmentDuration(ticket, time);
movementAdjustor.RotateTo(ticket, targetYaw);
Sleep(time);
return 2;
/* NOP */;
}
public function OnDeactivate(){
var actor : CActor;
var movementAdjustor : CMovementAdjustor;
actor = GetActor();
movementAdjustor = actor.GetMovingAgentComponent().GetMovementAd
justor();
movementAdjustor.Cancel(ticket);
/* NOP */;
}
public function Initialize(){
var riderData : CAIStorageRiderData;
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CAreaTestComponent{
}
class CBTTaskRiderNotifyScriptedActionOnHorse extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
public function OnActivate() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
riderData.sharedParams.scriptedActionPending = true;
return 0;
/* NOP */;
}
public function OnDeactivate(){
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
riderData.sharedParams.scriptedActionPending = false;
/* NOP */;
}
public function Initialize(){
var riderData : CAIStorageRiderData;
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CNegativeAreaComponent{
}

class CBTTaskRiderNotifyHorseAboutCombatTarget extends IBehTreeTask{


private var aiStorageHandler : CAIStorageHandler;
public function OnDeactivate(){
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
riderData.sharedParams.combatTarget = GetCombatTarget();
riderData.sharedParams.GetHorse().SignalGameplayEvent('RiderComb
atTargetUpdated');
/* NOP */;
}
public function Initialize(){
var riderData : CAIStorageRiderData;
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CStorySceneSectionVariantElementInfo{
}
import abstract class CPlanarShapeComponent{
}
class CBTTaskRiderNotifyHorseAboutMounting extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var horseComp : W3HorseComponent;
public function OnActivate() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
horseComp = (CNewNPC)riderData.sharedParams.GetHorse().GetHorseC
omponent();
horseComp.OnRiderWantsToMount();
return 0;
/* NOP */;
}
public function Initialize(){
var riderData : CAIStorageRiderData;
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CCameraComponent{
}
class CBTTaskRiderStopAttack extends IBehTreeTask{
private var aiStorageHandler : CAIStorageHandler;
private var horse : CNewNPC;
public function OnActivate() : EBTNodeStatus{
var riderData : CAIStorageRiderData;
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
horse = (CNewNPC)riderData.sharedParams.GetHorse();
horse.SignalGameplayEvent('StopAttackOnHorse');
GetNPC().SetIsInHitAnim(true);
return 0;

/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetIsInHitAnim(false);
/* NOP */;
}
public function Initialize(){
var riderData : CAIStorageRiderData;
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
/* NOP */;
}
}
import abstract class CStickerComponent{
}
class CBTTaskSailorMountBoat extends IBehTreeTask{
public var boatTag : CName;
public var aiStorageHandler : CAIStorageHandler;
public var instantMount : Bool;
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var actor : CActor;
var riderData : CAIStorageRiderData;
var boatEntity : CEntity;
var mountType : EMountType;
actor = GetActor();
mountType = 2;
boatEntity = theGame.GetEntityByTag(boatTag);
if (!boatEntity){
return 1;
}
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
EntityHandleSet(riderData.sharedParams.boat, boatEntity);
if (instantMount == false){
mountType = 1;
}
actor.SignalGameplayEventParamInt('RidingManagerMountBoat', moun
tType);
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 1){
if (riderData.ridingManagerMountError){
return 1;
}
return 2;
}
SleepOneFrame();
}
return 2;
/* NOP */;
}

}
import abstract class CSkeletonBoneSlot{
}
class CBTTaskSailorDismountBoat extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var actor : CActor;
var riderData : CAIStorageRiderData;
actor = GetActor();
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
actor.SignalGameplayEventParamInt('RidingManagerDismountBoat', 8
);
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 3){
if (riderData.ridingManagerMountError){
return 1;
}
return 2;
}
SleepOneFrame();
}
EntityHandleSet(riderData.sharedParams.boat, NULL);
return 2;
/* NOP */;
}
}
import abstract class CExternalProxyComponent{
}
class CBTTaskCondIsMountedOnBoat extends IBehTreeTask{
public var aiStorageHandler : CAIStorageHandler;
public var riderData : CAIStorageRiderData;
public function IsAvailable() : Bool{
if (!riderData){
riderData = (CAIStorageRiderData)aiStorageHandler.Get();
}
if (riderData && riderData.sharedParams && EntityHandleGet(rider
Data.sharedParams.boat)){
return true;
}
return false;
/* NOP */;
}
public function Initialize(){
aiStorageHandler = new CAIStorageHandler in this;
aiStorageHandler.Initialize('RiderData', '*CAIStorageRiderData',
this);
aiStorageHandler.Get();
/* NOP */;

}
}
import abstract class CExternalProxyAttachment{
}
import abstract class CColorShift{
}
import abstract class SCharacterWindParams{
}
import abstract class CAnimDangleConstraint_Dress{
}
class CCameraPivotPositionControllerJump extends ICustomCameraScriptedPivotPosit
ionController{
public editable var useExactCamera : Bool;
private var originalOffset : Vector;
public editable var zOffset : Float;
private var originalPosition : Vector;
private var originalHeight : Float;
public editable var blendXYSpeed : Float;
public editable var blendXYSpeedWithTime : Bool;
public editable var blendXYSpeedTimeStart : Float;
public editable var blendXYSpeedTimeEnd : Float;
public editable var blendXYSpeedMin : Float;
public editable var blendXYSpeedMax : Float;
public editable var blendZSpeedStart : Float;
public editable var blendZSpeedEnd : Float;
private editable inlined var blendCurve : CCurve;
public editable var blendZBasedOn : ECameraBlendSpeedMode;
private var blendZHeightMaxDif : Float;
public editable var blendZDistToForceStart : Float;
public editable var blendZDistToForceEnd : Float;
private var blendZDistToForceMaxCur : Float;
public editable var blendZSpeedTimeMin : Float;
public editable var blendZSpeedTimeTotal : Float;
private var blendZSpeedTimeCur : Float;
public editable var addOffset : Bool;
public editable var verticalDownOffsetMax : Float;
public editable var verticalDownTimeMax : Float;
public editable var verticalDownTimeMin : Float;
private var isInInterior : Bool;
public editable var blendZInteriorTimeToFall : Float;
public editable var blendZSpeedInterior : Float;
public editable var blendZSpeedInteriorFall : Float;
public editable var heightTraceAlwaysAdjust : Bool;
public editable var heightTraceEnabled : Bool;
public editable var heightTraceDownMax : Float;
private var heightTraceTotalAdded : Float;
private var heightTraceAccumulated : Float;
private var heightTraceMax : Float;
private var heightTraceTotal : Float;
public editable var heightTraceSpeed : Float;
public editable var heightTraceSpeedDownMin : Float;
public editable var heightTraceSpeedDownMax : Float;
private var heightTraceCollFlags : array<CName>;
private var heightTraceCollFlagsInit : Bool;
public editable var heightTraceDown : Bool;

public editable var heightTraceDownTimeMin : Float;


public editable var heightTraceDownTimeMax : Float;
public editable var traceForwardExtraOffset : Float;
private var heightTraceAdjusting : Bool;
private var heightAdjustingTime : Float;
public editable var boneFollowName : CName;
private var boneFollow : Int32;
public editable var startFollowBoneTime : Float;
public editable var followBoneOnFall : Bool;
private var falling : Bool;
public editable var forceOnGround : Bool;
public editable var debugLog : Bool;
private var zeroVector : Vector;
protected function ControllerUpdate(currentPosition : Vector, currentVel
ocity : Vector, timeDelta : Float){
timeDelta *= theGame.GetTimeScale(/* NOP */);
if (useExactCamera){
UpdateExactCamera(currentPosition, currentVelocity, time
Delta);
} else {
UpdateOldCamera(currentPosition, currentVelocity, timeDe
lta);
}
/* NOP */;
}
private function UpdateExactCamera(currentPosition : Vector, currentVelo
city : Vector, timeDelta : Float){
var blendZCoef : Float;
if (timeDelta <= 0.000000){
return;
}
if (blendZSpeedTimeCur < 0.000000){
originalOffset = currentPosition - GetFollowPos();
originalHeight = currentPosition.Z;
heightTraceTotalAdded = 0.000000;
blendZSpeedTimeCur = 0.000000;
InitHeightTrace(currentPosition);
zeroVector = Vector(0.000000, 0.000000, 0.000000);
return;
}
if (blendZSpeedTimeCur >= startFollowBoneTime && boneFollow == 1 && followBoneOnFall || !falling){
if (IsNameValid(boneFollowName)){
boneFollow = thePlayer.GetBoneIndex(boneFollowNa
me);
} else {
boneFollow = -1;
}
}
currentPosition = GetFollowPos() + originalOffset;
if (!forceOnGround){
blendZCoef = ComputeBlendZCoef(timeDelta, currentPositio
n.Z);
if (blendZCoef > 0.000000){
originalHeight = BlendF(originalHeight, currentP
osition.Z, blendZCoef);
}
}
if (heightTraceEnabled){
originalHeight += ComputeTaceHeightAdded(currentPosition

, timeDelta);
}
currentPosition.Z = originalHeight;
if (falling){
blendZSpeedTimeCur += timeDelta * 4.000000;
} else {
blendZSpeedTimeCur += timeDelta;
}
/* NOP */;
}
private function UpdateOldCamera(currentPosition : Vector, currentVeloci
ty : Vector, timeDelta : Float){
var blendXYCoef : Float;
var blendZCoef : Float;
var targetPosition : Vector;
if (blendZSpeedTimeCur < 0.000000){
originalPosition = currentPosition;
originalHeight = currentPosition.Z;
originalOffset = Vector(0.000000, 0.000000, 0.000000);
originalOffset = currentPosition - ComputeTargetPos();
blendZSpeedTimeCur = 0.000000;
}
targetPosition = ComputeTargetPos();
if (blendXYSpeedWithTime){
blendXYCoef = ClampF(blendZSpeedTimeCur, blendXYSpeedTim
eStart, blendXYSpeedTimeEnd);
blendXYCoef = MapF(blendXYCoef, blendXYSpeedTimeStart, b
lendXYSpeedTimeEnd, blendXYSpeedMin, blendXYSpeedMax);
blendXYCoef = MinF(timeDelta * blendXYCoef, 1.000000);
} else if (blendXYSpeed <= 0.000000){
blendXYCoef = 1.000000;
} else {
blendXYCoef = MinF(timeDelta * blendXYSpeed, 1.000000);
}
blendZCoef = ComputeBlendZCoef(timeDelta, targetPosition.Z);
originalPosition.X = BlendF(originalPosition.X, targetPosition.X
, blendXYCoef);
originalPosition.Y = BlendF(originalPosition.Y, targetPosition.Y
, blendXYCoef);
if (!forceOnGround){
if (blendZCoef > 0.000000){
originalPosition.Z = BlendF(originalPosition.Z,
targetPosition.Z, blendZCoef);
}
}
if (heightTraceEnabled){
if (blendZSpeedTimeCur < 0.000000){
InitHeightTrace(targetPosition);
}
originalPosition.Z += ComputeTaceHeightAdded(targetPosit
ion, timeDelta);
}
if (falling){
blendZSpeedTimeCur += timeDelta * 4.000000;
} else {
blendZSpeedTimeCur += timeDelta;
}
currentPosition = originalPosition;
currentVelocity = Vector(0.000000, 0.000000, 0.000000);
if (debugLog && timeDelta > 0.000000){

/* NOP */;
}
/* NOP */;
}
protected function ControllerActivate(currentOffset : Float){
var auxVector : Vector;
var jumpType : EJumpType;
blendZSpeedTimeCur = -10.000000;
blendZHeightMaxDif = 0.000000;
falling = false;
if (thePlayer.substateManager.GetStateCur() == 'Jump'){
jumpType = thePlayer.substateManager.m_SharedDataO.m_Jum
pTypeE;
if (jumpType == 0 || jumpType == 9 || jumpType == 12){
falling = true;
}
}
isInInterior = !thePlayer.IsActionAllowed(14) || !thePlayer.IsAc
tionAllowed(26);
boneFollow = -1;
heightTraceAccumulated = 0.000000;
heightTraceTotal = 0.000000;
blendZDistToForceMaxCur = 0.000000;
if (debugLog){
/* NOP */;
}
/* NOP */;
}
private function GetFollowPos() : Vector{
if (boneFollow >= 0){
return GetBoneToFollowPosition();
} else {
return thePlayer.GetWorldPosition();
}
/* NOP */;
}
private function GetBoneToFollowPosition() : Vector{
var position : Vector;
position = thePlayer.HACK_ForceGetBonePosition(boneFollow);
if (position == zeroVector){
position = thePlayer.GetWorldPosition();
}
return position;
/* NOP */;
}
private function ComputeTargetPos() : Vector{
var offset : Vector;
var position : Vector;
if (boneFollow >= 0){
position = GetBoneToFollowPosition();
} else {
position = thePlayer.GetWorldPosition();
}
offset = ComputeOffset();
position += offset + originalOffset;
return position;
/* NOP */;
}
private function ComputeOffset() : Vector{
var verticalDisp : Float;

if (addOffset){
verticalDisp = ClampF(blendZSpeedTimeCur, verticalDownTi
meMin, verticalDownTimeMax);
verticalDisp = MapF(verticalDisp, verticalDownTimeMin, v
erticalDownTimeMax, 0.000000, 1.000000);
verticalDisp *= verticalDownOffsetMax;
return Vector(0, 0, zOffset - verticalDisp);
}
return Vector(0, 0, zOffset);
/* NOP */;
}
private function ComputeBlendZCoef(timeDelta : Float, height : Float) :
Float{
var blendZSpeed : Float;
var distanceInZ : Float;
if (timeDelta <= 0.000000){
return 0.000000;
}
if (isInInterior){
if (blendZSpeedTimeCur < blendZInteriorTimeToFall){
blendZSpeed = blendZSpeedInterior;
} else {
blendZSpeed = blendZSpeedInteriorFall;
}
} else if (blendZBasedOn == 1){
distanceInZ = AbsF(height - originalHeight);
if (blendZDistToForceMaxCur < distanceInZ){
blendZDistToForceMaxCur = distanceInZ;
}
if (blendZDistToForceMaxCur >= blendZDistToForceStart){
blendZDistToForceMaxCur = MinF(blendZDistToForce
MaxCur, blendZDistToForceEnd);
blendZSpeed = MapF(blendZDistToForceMaxCur, blen
dZDistToForceStart, blendZDistToForceEnd, blendZSpeedStart, blendZSpeedEnd);
}
} else if (blendZBasedOn == 2){
distanceInZ = originalHeight - height;
if (blendZHeightMaxDif < distanceInZ){
blendZHeightMaxDif = distanceInZ;
}
if (blendZHeightMaxDif <= blendZDistToForceStart){
return 0.000000;
} else {
blendZSpeed = ClampF(blendZHeightMaxDif, blendZD
istToForceStart, blendZDistToForceEnd);
blendZSpeed = MapF(blendZSpeed, blendZDistToForc
eStart, blendZDistToForceEnd, blendZSpeedStart, blendZSpeedEnd);
}
} else if (blendZBasedOn == 0){
if (blendCurve){
if (blendZSpeedTimeCur < blendZSpeedTimeMin){
blendZSpeed = 0.000000;
} else {
blendZSpeed = MinF(blendZSpeedTimeCur, b
lendZSpeedTimeTotal);
blendZSpeed = MapF(blendZSpeed, blendZSp
eedTimeMin, blendZSpeedTimeTotal, 0.000000, 1.000000);
blendZSpeed = blendCurve.GetValue(blendZ
Speed);
blendZSpeed = MapF(blendZSpeed, 0.000000

, 1.000000, blendZSpeedStart, blendZSpeedEnd);


}
} else if (blendZSpeedTimeCur < blendZSpeedTimeMin){
blendZSpeed = 0.000000;
} else {
blendZSpeed = MapF(MinF(blendZSpeedTimeCur, blen
dZSpeedTimeTotal), blendZSpeedTimeMin, blendZSpeedTimeTotal, blendZSpeedStart, b
lendZSpeedEnd);
}
}
return MinF(timeDelta * blendZSpeed, 1.000000);
/* NOP */;
}
private function InitHeightTrace(position : Vector){
var heightNow : Float;
if (!heightTraceCollFlagsInit){
heightTraceCollFlags.PushBack('Terrain');
heightTraceCollFlags.PushBack('Static');
heightTraceCollFlagsInit = true;
}
if (ComputeGroundHeight(position, heightNow)){
heightTraceMax = heightNow;
} else {
heightTraceMax = position.Z;
}
heightTraceAdjusting = false;
/* NOP */;
}
private function ComputeTaceHeightAdded(position : Vector, deltaTime : F
loat) : Float{
var groundHeight : Float;
var addedHeight : Float;
var result : Bool;
var traceSpeed : Float;
result = ComputeGroundHeight(position, groundHeight);
if (result){
if (heightTraceAlwaysAdjust || groundHeight > heightTrac
eMax || heightTraceDown && blendZSpeedTimeCur > heightTraceDownTimeMin){
heightTraceAccumulated += groundHeight - heightT
raceMax;
heightTraceMax = groundHeight;
}
}
if (heightTraceAccumulated > 0.000000 || !heightTraceDown){
traceSpeed = heightTraceSpeed * heightTraceAccumulated;
} else {
traceSpeed = ClampF(blendZSpeedTimeCur, heightTraceDownT
imeMin, heightTraceDownTimeMax);
traceSpeed = MapF(heightTraceDownTimeMin, heightTraceDow
nTimeMax, heightTraceSpeedDownMin, heightTraceSpeedDownMax, traceSpeed);
}
addedHeight = SignF(heightTraceAccumulated) * MinF(AbsF(heightTr
aceAccumulated), MinF(deltaTime * traceSpeed, 1.000000));
heightTraceAccumulated -= addedHeight;
heightTraceTotal += addedHeight;
if (debugLog && deltaTime > 0.000000){
/* NOP */;
}
return addedHeight;
/* NOP */;

}
private function ComputeTaceHeightAddedState(position : Vector, deltaTim
e : Float) : Float{
var groundHeight : Float;
var addedHeight : Float;
var result : Bool;
var traceSpeed : Float;
result = ComputeGroundHeight(position, groundHeight);
if (result){
heightTraceAccumulated = groundHeight - heightTraceMax;
}
if (!heightTraceAdjusting){
if (heightTraceAccumulated != 0.000000){
heightTraceAdjusting = true;
heightAdjustingTime = 0.000000;
}
}
if (heightTraceAdjusting){
addedHeight = deltaTime * MinF(heightAdjustingTime, 3.00
0000) * SignF(heightTraceAccumulated) * 100.000000;
addedHeight = ClampF(addedHeight, -AbsF(heightTraceAccum
ulated), AbsF(heightTraceAccumulated));
heightTraceMax -= addedHeight;
heightAdjustingTime += deltaTime;
return addedHeight;
}
return 0.000000;
/* NOP */;
}
private function ComputeGroundHeight(position : Vector, height : Float)
: Bool{
var world : CWorld;
var posOrigin : Vector;
var posEnd : Vector;
var posCollided : Vector;
var normalCollided : Vector;
var res : Bool;
position += thePlayer.GetWorldForward() * traceForwardExtraOffse
t;
height = position.Z - heightTraceDownMax;
world = theGame.GetWorld();
if (!world){
return false;
}
posOrigin = position;
posOrigin.Z += 0.200000;
posEnd = position;
posEnd.Z -= heightTraceDownMax;
res = world.StaticTrace(posOrigin, posEnd, posCollided, normalCo
llided, heightTraceCollFlags);
if (res){
height = posCollided.Z;
return true;
}
return false;
/* NOP */;
}
}
import abstract class CDressMeshComponent{

}
import abstract class IStorySceneChoiceLineAction{
}
import abstract class CCameraOrientedComponent{
}
import abstract class CStorySceneChoiceLine{
}
import abstract class IAnimationController{
}
import abstract class CSingleAnimationController{
}
import abstract class CSequentialAnimationController{
}
import abstract class CRandomAnimationController{
}
import abstract class CRandomWithWeightAnimationController{
}
import abstract class ISceneChoiceMemo{
}
import abstract class CAnimatedEntity{
}
import abstract class CBezierMovableComponent{
}
class CR4InventoryMenu extends CR4MenuBase{
private var _playerInv : W3GuiPlayerInventoryComponent;
private var _paperdollInv : W3GuiPaperdollInventoryComponent;
private var _containerInv : W3GuiContainerInventoryComponent;
private var _shopInv : W3GuiShopInventoryComponent;
private var _horseInv : W3GuiContainerInventoryComponent;
private var _horsePaperdollInv : W3GuiHorseInventoryComponent;
private var _currentInv : W3GuiBaseInventoryComponent;
private var _currentMouseInv : W3GuiBaseInventoryComponent;
private var _quantityPopupData : QuantityPopupData;
private var _statsContext : W3PlayerStatsContext;
private var _paperdollContext : W3InventoryPaperdollContext;
private var _invContext : W3InventoryGridContext;
private var _externGridContext : W3ExternalGridContext;
private var _bookPopupData : BookPopupFeedback;
private var _charStatsPopupData : CharacterStatsPopupData;
private var _itemInfoPopupData : ItemInfoPopupData;
private var _destroyConfPopData : W3DestroyItemConfPopup;
private var drawHorse : Bool;
private var m_player : CEntity;
protected var _inv : CInventoryComponent;
protected var _container : W3Container;
protected var _shopNpc : CNewNPC;
protected var _tooltipDataProvider : W3TooltipComponent;
protected var currentlySelectedTab : Int32;

protected var _defaultInventoryState : EInventoryMenuState;


protected var _currentState : EInventoryMenuState;
private var optionsItemActions : array<EInventoryActionType>;
private var _sentStats : array<SentStatsData>;
private var _currentQuickSlot : EEquipmentSlots;
private var _currentEqippedQuickSlot : EEquipmentSlots;
private var MAX_ITEM_NR : Int32;
private var currentItemsNr : Int32;
private var m_menuInited : Bool;
private var m_isPadConnected : Bool;
private var m_isUsingPad : Bool;
private var m_hidePaperdoll : Bool;
private var m_tagsFilter : array<CName>;
private var m_ignoreSaveData : Bool;
private var m_selectionModeActive : Bool;
private var m_selectionModeItem : SItemUniqueId;
private var m_lastSelectedModuleID : Int32;
private var m_lastSelectedModuleBindingName : String;
public var currentSelectedItem : SItemUniqueId;
private var m_fxPaperdollRemoveItem : CScriptedFlashFunction;
private var m_fxInventoryRemoveItem : CScriptedFlashFunction;
private var m_fxInventoryUpdateFilter : CScriptedFlashFunction;
private var m_fxForceSelectItem : CScriptedFlashFunction;
private var m_fxForceSelectPaperdollSlot : CScriptedFlashFunction;
private var m_fxSetFilteringMode : CScriptedFlashFunction;
private var m_fxRemoveContainerItem : CScriptedFlashFunction;
private var m_fxHideSelectionMode : CScriptedFlashFunction;
private var m_fxSetNewFlagsForTabs : CScriptedFlashFunction;
public var hackHideStatTooltip : Bool;
public var hackHideItemTooltip : Bool;
public function OnConfigUI() : Bool{
var l_flashPaperdoll : CScriptedFlashSprite;
var l_flashInventory : CScriptedFlashSprite;
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var l_obj : IScriptable;
var l_containerNpc : CNewNPC;
var l_horse : CActor;
var l_initData : W3InventoryInitData;
m_initialSelectionsToIgnore = 2;
drawHorse = false;
m_menuInited = false;
super.OnConfigUI();
l_obj = GetMenuInitData();
_container = (W3Container)l_obj;
l_containerNpc = (CNewNPC)l_obj;
l_initData = (W3InventoryInitData)l_obj;
if (l_initData){
_container = (W3Container)l_initData.containerNPC;
if (!_container){
l_containerNpc = (CNewNPC)l_initData.containerNP
C;
}
m_tagsFilter = l_initData.filterTagsList;
m_ignoreSaveData = true;
}
if (l_containerNpc){
if (l_containerNpc.HasTag('Merchant')){
m_initialSelectionsToIgnore = 3;
_shopNpc = l_containerNpc;

m_ignoreSaveData = true;
}
}
m_flashModule = GetMenuFlash();
m_fxSetFilteringMode = m_flashModule.GetMemberFlashFunction("set
FilteringMode");
m_fxPaperdollRemoveItem = m_flashModule.GetMemberFlashFunction("
paperdollRemoveItem");
m_fxInventoryRemoveItem = m_flashModule.GetMemberFlashFunction("
inventoryRemoveItem");
m_fxInventoryUpdateFilter = m_flashModule.GetMemberFlashFunction
("forceSelectTab");
m_fxForceSelectItem = m_flashModule.GetMemberFlashFunction("forc
eSelectItem");
m_fxForceSelectPaperdollSlot = m_flashModule.GetMemberFlashFunct
ion("forceSelectPaperdollSlot");
m_fxRemoveContainerItem = m_flashModule.GetMemberFlashFunction("
shopRemoveItem");
m_fxHideSelectionMode = m_flashModule.GetMemberFlashFunction("hi
deSelectionMode");
m_fxSetNewFlagsForTabs = m_flashModule.GetMemberFlashFunction("s
etNewFlagsForTabs");
_inv = thePlayer.GetInventory();
_playerInv = new W3GuiPlayerInventoryComponent in this;
_playerInv.Initialize(_inv);
_playerInv.filterTagList = m_tagsFilter;
if (m_tagsFilter.Size() > 0){
_playerInv.SetFilterType(0);
}
_currentInv = _playerInv;
_paperdollInv = new W3GuiPaperdollInventoryComponent in this;
_paperdollInv.Initialize(_inv);
_horseInv = new W3GuiContainerInventoryComponent in this;
_horseInv.Initialize(GetWitcherPlayer().GetHorseManager().GetInv
entoryComponent());
_horsePaperdollInv = new W3GuiHorseInventoryComponent in this;
_horsePaperdollInv.Initialize(GetWitcherPlayer().GetHorseManager
().GetInventoryComponent());
_tooltipDataProvider = new W3TooltipComponent in this;
_tooltipDataProvider.initialize(_inv, m_flashValueStorage);
theGame.GetGuiManager().SetBackgroundTexture(LoadResource("inven
tory_background", /* NOP */));
m_flashValueStorage.SetFlashString("inventory.grid.paperdoll.poc
kets", GetLocStringByKeyExt("panel_inventory_paperdoll_slotname_quickitems"), /*
NOP */);
m_flashValueStorage.SetFlashString("inventory.grid.paperdoll.pot
ions", GetLocStringByKeyExt("panel_inventory_paperdoll_slotname_potions"), /* NO
P */);
m_flashValueStorage.SetFlashString("inventory.grid.paperdoll.pet
ards", GetLocStringByKeyExt("panel_inventory_paperdoll_slotname_petards"), /* NO
P */);
m_flashValueStorage.SetFlashString("playerstats.stats.name", Get
LocStringByKeyExt("panel_common_statistics_name"), /* NOP */);
if (_container){
_containerInv = new W3GuiContainerInventoryComponent in
this;
_containerInv.Initialize(_container.GetInventory());
if (m_tagsFilter.Size() > 0){
if (m_tagsFilter.FindFirst('HideOwnerInventory')
!= -1){

_containerInv.HideAllItems();
}
}
_playerInv.currentDefaultItemAction = 9;
_paperdollInv.currentDefaultItemAction = 9;
m_flashValueStorage.SetFlashString("inventory.grid.conta
iner.name", _container.GetDisplayName(false), /* NOP */);
_defaultInventoryState = 2;
} else if (_shopNpc){
_shopInv = new W3GuiShopInventoryComponent in this;
_shopNpc.GetInventory().UpdateLoot();
_shopNpc.GetInventory().ClearGwintCards();
_shopNpc.GetInventory().ClearTHmaps();
_shopNpc.GetInventory().ClearKnownRecipes();
_shopInv.Initialize(_shopNpc.GetInventory());
_tooltipDataProvider.setShopInventory(_shopNpc.GetInvent
ory());
_playerInv.SetShopInvCmp(_shopInv);
_playerInv.currentDefaultItemAction = 10;
m_flashValueStorage.SetFlashString("inventory.grid.conta
iner.name", _shopNpc.GetDisplayName(false), /* NOP */);
_defaultInventoryState = 1;
UpdateMerchantData();
if (theGame.GetTutorialSystem() && theGame.GetTutorialSy
stem().IsRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpeningM
enu('ShopMenu');
}
} else if (l_containerNpc){
_containerInv = new W3GuiContainerInventoryComponent in
this;
_containerInv.Initialize(l_containerNpc.GetInventory());
_playerInv.currentDefaultItemAction = 9;
_paperdollInv.currentDefaultItemAction = 9;
m_flashValueStorage.SetFlashString("inventory.grid.conta
iner.name", l_containerNpc.GetDisplayName(false), /* NOP */);
_defaultInventoryState = 2;
} else {
_defaultInventoryState = 0;
}
RestoreSaved();
UpdateData();
UpdateEncumbranceInfo();
UpdatePlayerStatisticsData();
m_menuInited = true;
if (m_menuState == 'None'){
m_menuState = 'CharacterInventory';
}
ApplyMenuState(m_menuState);
_currentEqippedQuickSlot = GetCurrentEquippedQuickSlot();
SelectCurrentModule();
SetInitialTabNewFlags();
/* NOP */;
}
public function OnGuiSceneEntitySpawned(entity : CEntity) : Bool{
var arr : array<CName>;
Event_OnGuiSceneEntitySpawned();
m_player = entity;
arr.PushBack('Inventory');
m_player.ActivateBehaviorsSync(arr);

(CActor)m_player.SetBehaviorMimicVariable('gameplayMimicsMode',
3);
/* NOP */;
}
public function OnGuiSceneEntityDestroyed() : Bool{
Event_OnGuiSceneEntityDestroyed();
/* NOP */;
}
private function RestoreSaved(){
}
public function OnSortingRequested() : Bool{
_playerInv.CleanupItemsGridPosition();
updateCurrentTab();
/* NOP */;
}
public function OnTabDataRequested(tabIndex : Int32, isHorse : Bool) : B
ool{
PopulateTabData(tabIndex);
/* NOP */;
}
public function OnTabChanged(tabIndex : Int32) : Bool{
var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
var tutStateOil : W3TutorialManagerUIHandlerStateOils;
var tutStateBooks : W3TutorialManagerUIHandlerStateBooks;
var tutStateArmorUpgrades : W3TutorialManagerUIHandlerStateArmor
Upgrades;
var tutStateFood : W3TutorialManagerUIHandlerStateFood;
var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateS
econdPotionEquip;
var tutStateRecipeReading : W3TutorialManagerUIHandlerStateRecip
eReading;
currentlySelectedTab = tabIndex;
if (tabIndex == 1 && ShouldProcessTutorial('TutorialPotionCanEqu
ip2')){
tutStatePot = (W3TutorialManagerUIHandlerStatePotions)th
eGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStatePot){
tutStatePot.OnPotionTabSelected();
}
}
if (tabIndex == 1 && ShouldProcessTutorial('TutorialFoodSelectTa
b')){
tutStateFood = (W3TutorialManagerUIHandlerStateFood)theG
ame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateFood){
tutStateFood.OnPotionTabSelected();
}
}
if (tabIndex == 1 && ShouldProcessTutorial('TutorialOilCanEquip2
')){
tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGa
me.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateOil){
tutStateOil.OnOilTabSelected();
}
}
if (ShouldProcessTutorial('TutorialBooksSelectTab')){
tutStateBooks = (W3TutorialManagerUIHandlerStateBooks)th
eGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateBooks){

tutStateBooks.OnSelectedTab(tabIndex == 1);
} else {
tutStateRecipeReading = (W3TutorialManagerUIHand
lerStateRecipeReading)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateRecipeReading){
tutStateRecipeReading.OnSelectedTab(tabI
ndex == 1);
}
}
}
if (tabIndex == 0 && ShouldProcessTutorial('TutorialArmorSockets
SelectTab')){
tutStateArmorUpgrades = (W3TutorialManagerUIHandlerState
ArmorUpgrades)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateArmorUpgrades){
tutStateArmorUpgrades.OnTabSelected();
}
}
if (tabIndex == 1 && ShouldProcessTutorial('TutorialPotionCanEqu
ip1')){
tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerS
tateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateSecondPotionEquip){
tutStateSecondPotionEquip.OnPotionTabSelected();
}
}
/* NOP */;
}
public function updateCurrentTab(){
if (currentlySelectedTab != -1){
PopulateTabData(currentlySelectedTab);
}
/* NOP */;
}
public function PopulateTabData(tabIndex : Int32){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
switch(tabIndex){
case 0:
_playerInv.SetFilterType(1);
_playerInv.GetInventoryFlashArray(l_flashArray, l_flashO
bject);
break;
case 1:
_playerInv.SetFilterType(3);
_playerInv.GetInventoryFlashArray(l_flashArray, l_flashO
bject);
break;
case 2:
_playerInv.SetFilterType(4);
_playerInv.GetInventoryFlashArray(l_flashArray, l_flashO
bject);
break;
case 3:
_playerInv.SetFilterType(5);
_playerInv.GetInventoryFlashArray(l_flashArray, l_flashO
bject);

break;
case 4:
_playerInv.SetFilterType(6);
_playerInv.GetInventoryFlashArray(l_flashArray, l_flashO
bject);
break;
}
PopulateDataForTab(tabIndex, l_flashArray);
/* NOP */;
}
private function PopulateDataForTab(tabIndex : Int32, entriesArray : CSc
riptedFlashArray){
var l_flashObject : CScriptedFlashObject;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashObject.SetMemberFlashInt("tabIndex", tabIndex);
l_flashObject.SetMemberFlashArray("tabData", entriesArray);
if (entriesArray.GetLength() > 0){
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
m_flashValueStorage.SetFlashObject("player.inventory.menu.tabs.d
ata" + tabIndex, l_flashObject, /* NOP */);
/* NOP */;
}
public function SetInitialTabNewFlags(){
var hasNewItems : array<Bool>;
var currentFilter : EInventoryFilterType;
currentFilter = _playerInv.GetFilterType();
_playerInv.SetFilterType(1);
hasNewItems.PushBack(_playerInv.HasNewFlagOnItem());
_playerInv.SetFilterType(3);
hasNewItems.PushBack(_playerInv.HasNewFlagOnItem());
_playerInv.SetFilterType(4);
hasNewItems.PushBack(_playerInv.HasNewFlagOnItem());
_playerInv.SetFilterType(5);
hasNewItems.PushBack(_playerInv.HasNewFlagOnItem());
_playerInv.SetFilterType(6);
hasNewItems.PushBack(_playerInv.HasNewFlagOnItem());
_playerInv.SetFilterType(currentFilter);
m_fxSetNewFlagsForTabs.InvokeSelfFiveArgs(FlashArgBool(hasNewIte
ms[0]), FlashArgBool(hasNewItems[1]), FlashArgBool(hasNewItems[2]), FlashArgBool
(hasNewItems[3]), FlashArgBool(hasNewItems[4]));
/* NOP */;
}
public function getTabFromItem(item : SItemUniqueId) : InventoryMenuTabI
ndexes{
var inventoryFilterType : EInventoryFilterType;
inventoryFilterType = _playerInv.GetFilterTypeByItem(item);
return getTabFromFilter(inventoryFilterType);
/* NOP */;
}
public function getTabFromFilter(inventoryFilterType : EInventoryFilterT
ype) : InventoryMenuTabIndexes{
switch(inventoryFilterType){
case 1:
return 0;

case 3:
return 1;
case 4:
return 2;
case 5:
return 3;
case 6:
return 4;
}
return 4;
/* NOP */;
}
public function UpdateEncumbranceInfo(){
var encumbrance : Int32;
var encumbranceMax : Int32;
var hasHorseUpgrade : Bool;
encumbrance = GetWitcherPlayer().GetEncumbrance();
encumbranceMax = GetWitcherPlayer().GetMaxRunEncumbrance(hasHors
eUpgrade);
UpdateItemsCounter();
/* NOP */;
}
public function GetCurrentInventoryState() : EInventoryMenuState{
return _currentState;
/* NOP */;
}
private function SetInventoryState(targetMode : Int32){
drawHorse = false;
_currentState = targetMode;
m_flashValueStorage.SetFlashInt("inventory.mode", _currentState,
/* NOP */);
switch(targetMode){
case 0:
m_fxSetFilteringMode.InvokeSelfOneArg(FlashArgBool(false
));
UpdateEntityTemplate();
break;
case 1:
UpdateShop();
m_fxSetFilteringMode.InvokeSelfOneArg(FlashArgBool(false
));
break;
case 2:
UpdateContainer();
m_fxSetFilteringMode.InvokeSelfOneArg(FlashArgBool(m_tag
sFilter.Size() > 0));
break;
case 3:
drawHorse = true;
UpdateHorseInventory();
UpdateHorsePaperdoll();
m_fxSetFilteringMode.InvokeSelfOneArg(FlashArgBool(false
));
break;
default:
break;
}
/* NOP */;
}
private function UpdateEntityTemplate(){

var templateFilename : String;


var appearance : CName;
var environmentFilename : String;
var environmentSunRotation : EulerAngles;
var cameraLookAt : Vector;
var cameraRotation : EulerAngles;
var cameraDistance : Float;
var updateItems : Bool;
var fov : Float;
var guiSceneController : CR4GuiSceneController;
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
if (!guiSceneController){
return;
}
if (drawHorse){
templateFilename = "HorseForUI";
appearance = 'None';
environmentSunRotation.Yaw = 250;
environmentSunRotation.Pitch = 10;
cameraLookAt.Z = 1;
cameraRotation.Yaw = 88.599998;
cameraRotation.Pitch = 355;
cameraDistance = 3.170000;
fov = 35.000000;
updateItems = true;
} else {
templateFilename = "GeraltForUI";
appearance = 'None';
environmentSunRotation.Yaw = 0;
environmentSunRotation.Pitch = 0;
cameraLookAt.Z = 1;
cameraRotation.Yaw = 190.710007;
cameraRotation.Pitch = 5;
cameraDistance = 3.350000;
fov = 35.000000;
updateItems = true;
}
guiSceneController.SetEntityTemplate(templateFilename);
guiSceneController.SetCamera(cameraLookAt, cameraRotation, camer
aDistance, fov);
guiSceneController.SetEnvironmentAndSunRotation("DefaultEnvironm
entForUI", environmentSunRotation);
guiSceneController.SetEntityAppearance(appearance);
guiSceneController.SetEntityItems(updateItems);
/* NOP */;
}
public function SetMenuState(newState : CName){
super.SetMenuState(newState);
if (m_menuInited){
ApplyMenuState(newState);
}
/* NOP */;
}
protected function ApplyMenuState(newState : CName){
/* NOP */;
switch(newState){
case 'CharacterInventory':
SetInventoryState(_defaultInventoryState);
break;

case 'HorseInventory':
SetInventoryState(3);
break;
}
/* NOP */;
}
public function UpdateData(){
updateCurrentTab();
PaperdollUpdateAll();
UpdateItemsCounter();
UpdatePlayerStatisticsData();
/* NOP */;
}
public function InventoryUpdateItem(item : SItemUniqueId){
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
if (!_inv.ItemHasTag(item, 'NoShow')){
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
itemDataObject = tempFlashObject.CreateFlashObject("red.
game.witcher3.menus.common.ItemDataStub");
_playerInv.SetInventoryFlashObjectForItem(item, itemData
Object);
itemDataObject.SetMemberFlashInt("tabIndex", getTabFromF
ilter(_playerInv.GetFilterTypeByItem(item)));
m_flashValueStorage.SetFlashObject("inventory.grid.playe
r.itemUpdate", itemDataObject, /* NOP */);
}
/* NOP */;
}
public function ShopUpdateItem(item : SItemUniqueId){
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
itemDataObject = tempFlashObject.CreateFlashObject("red.game.wit
cher3.menus.common.ItemDataStub");
_shopInv.SetInventoryFlashObjectForItem(item, itemDataObject);
itemDataObject.SetMemberFlashInt("tabIndex", GetTabIndexForSlot(
getTabFromFilter(_shopInv.GetInventoryComponent().GetFilterTypeByItem(item))));
m_flashValueStorage.SetFlashObject("inventory.grid.container.ite
mUpdate", itemDataObject, /* NOP */);
/* NOP */;
}
public function InventoryUpdateItems(itemsList : array<SItemUniqueId>){
var i : Int32;
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
var itemsDataList : CScriptedFlashArray;
itemsDataList = m_flashValueStorage.CreateTempFlashArray();
tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
i = 0;
while (i < itemsList.Size()){
itemDataObject = tempFlashObject.CreateFlashObject("red.
game.witcher3.menus.common.ItemDataStub");
_playerInv.SetInventoryFlashObjectForItem(itemsList[i],
itemDataObject);
itemDataObject.SetMemberFlashInt("tabIndex", getTabFromF
ilter(_playerInv.GetFilterTypeByItem(itemsList[i])));

itemsDataList.PushBackFlashObject(itemDataObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("inventory.grid.player.itemsUp
date", itemsDataList);
/* NOP */;
}
public function InventoryRemoveItem(item : SItemUniqueId, keepSelectionI
dx : Bool){
m_fxInventoryRemoveItem.InvokeSelfTwoArgs(FlashArgUInt(ItemToFla
shUInt(item)), FlashArgBool(keepSelectionIdx));
/* NOP */;
}
public function ShopRemoveItem(item : SItemUniqueId){
m_fxRemoveContainerItem.InvokeSelfOneArg(FlashArgUInt(ItemToFlas
hUInt(item)));
/* NOP */;
}
public function PaperdollRemoveItem(item : SItemUniqueId){
m_fxPaperdollRemoveItem.InvokeSelfOneArg(FlashArgUInt(ItemToFlas
hUInt(item)));
/* NOP */;
}
public function PaperdollUpdateItemsList(itemsList : array<SItemUniqueId
>){
var i : Int32;
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
var itemsDataList : CScriptedFlashArray;
itemsDataList = m_flashValueStorage.CreateTempFlashArray();
tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
i = 0;
while (i < itemsList.Size()){
itemDataObject = tempFlashObject.CreateFlashObject("red.
game.witcher3.menus.common.ItemDataStub");
_paperdollInv.SetInventoryFlashObjectForItem(itemsList[i
], itemDataObject);
itemsDataList.PushBackFlashObject(itemDataObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("inventory.grid.paperdoll.item
s.update", itemsDataList);
/* NOP */;
}
public function PaperdollUpdateItem(item : SItemUniqueId){
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
itemDataObject = tempFlashObject.CreateFlashObject("red.game.wit
cher3.menus.common.ItemDataStub");
_paperdollInv.SetInventoryFlashObjectForItem(item, itemDataObjec
t);
m_flashValueStorage.SetFlashObject("inventory.grid.paperdoll.ite
m.update", itemDataObject, /* NOP */);
/* NOP */;
}
public function PaperdollUpdateHorseItem(item : SItemUniqueId){
var tempFlashObject : CScriptedFlashObject;

var itemDataObject : CScriptedFlashObject;


tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
itemDataObject = tempFlashObject.CreateFlashObject("red.game.wit
cher3.menus.common.ItemDataStub");
_horsePaperdollInv.SetInventoryFlashObjectForItem(item, itemData
Object);
m_flashValueStorage.SetFlashObject("inventory.grid.paperdoll.ite
m.update", itemDataObject, /* NOP */);
/* NOP */;
}
public function UpdateItemData(item : SItemUniqueId){
var l_flashObject : CScriptedFlashObject;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
_playerInv.SetInventoryFlashObjectForItem(item, l_flashObject);
m_flashValueStorage.SetFlashObject("inventory.grid.player.item",
l_flashObject, /* NOP */);
/* NOP */;
}
public function PaperdollUpdateAll(){
UpdateItemsList("inventory.grid.paperdoll", _paperdollInv, _hors
ePaperdollInv);
/* NOP */;
}
public function UpdateHorsePaperdoll(){
UpdateItemsList("inventory.grid.paperdoll.horse", _horsePaperdol
lInv, /* NOP */);
/* NOP */;
}
public function UpdateHorseInventory(){
UpdateItemsList("inventory.grid.container", _horseInv, /* NOP */
);
/* NOP */;
}
public function UpdateContainer(){
UpdateItemsList("inventory.grid.container", _containerInv, /* NO
P */);
/* NOP */;
}
public function UpdateShop(){
UpdateItemsList("inventory.grid.container", _shopInv, /* NOP */)
;
/* NOP */;
}
private function UpdateItemsList(flashBinding : String, targetInventory
: W3GuiBaseInventoryComponent, secondaryInventory : W3GuiBaseInventoryComponent)
{
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
if (targetInventory){
targetInventory.GetInventoryFlashArray(l_flashArray, l_f
lashObject);
}
if (secondaryInventory){
secondaryInventory.GetInventoryFlashArray(l_flashArray,
l_flashObject);

}
if (l_flashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(flashBinding, l_flashA
rray);
}
/* NOP */;
}
private function UpdateItemsCounter(){
var itemsNr : Int32;
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
itemsNr = commonMenu.UpdateItemsCounter();
}
if (itemsNr >= MAX_ITEM_NR && currentItemsNr != itemsNr){
currentItemsNr = itemsNr;
}
/* NOP */;
}
public function OnGetItemData(item : SItemUniqueId, compareItemType : In
t32) : Bool{
ShowItemTooltip(item, compareItemType);
/* NOP */;
}
public function OnGetItemDataForMouse(item : SItemUniqueId, compareItemT
ype : Int32) : Bool{
ShowItemMouseTooltip(item, compareItemType);
/* NOP */;
}
public function OnShowStatTooltip(statName : CName) : Bool{
ShowStatTooltip(statName);
/* NOP */;
}
public function OnGetEmptyPaperdollTooltip(equipID : Int32, isLocked : B
ool) : Bool{
ShowEmptySlotTooltip(equipID);
/* NOP */;
}
public function ShowStatTooltip(statName : CName){
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
switch(statName){
case 'vitality':
GetHealthTooltipData(statsList);
break;
case 'toxicity':
GetToxicityTooltipData(statsList);
break;
case 'stamina':
GetStaminaTooltipData(statsList);
break;
case 'focus':
GetAdrenalineTooltipData(statsList);
break;
case 'stat_offense':
GetOffenseTooltipData(statsList);
break;

case 'stat_defense':
GetDefenseTooltipData(statsList);
break;
case 'stat_signs':
GetSignsTooltipData(statsList);
break;
}
resultData.SetMemberFlashString("title", GetLocStringByKeyExt(st
atName));
resultData.SetMemberFlashString("description", GetLocStringByKey
Ext(statName + "_desc"));
resultData.SetMemberFlashArray("statsList", statsList);
m_flashValueStorage.SetFlashObject("statistic.tooltip.data", res
ultData, /* NOP */);
/* NOP */;
}
public function HideStatTooltip(){
m_flashValueStorage.SetFlashBool("statistic.tooltip.hide", hackH
ideStatTooltip, /* NOP */);
hackHideStatTooltip = !hackHideStatTooltip;
/* NOP */;
}
public function GetItemExpTooltipData(item : SItemUniqueId) : CScriptedF
lashObject{
_tooltipDataProvider.setCurrentInventory(GetCurrentInventory(ite
m));
return _tooltipDataProvider.GetExItemData(item, _currentInv == _
shopInv);
/* NOP */;
}
public function ShowEmptySlotTooltip(slotId : Int32){
var tooltipData : CScriptedFlashObject;
_tooltipDataProvider.setCurrentInventory(GetCurrentInventory(Get
InvalidUniqueId()));
tooltipData = _tooltipDataProvider.GetEmptySlotData(slotId);
m_flashValueStorage.SetFlashObject("context.tooltip.data", toolt
ipData, /* NOP */);
/* NOP */;
}
public function OnClearSlotNewFlag(item : SItemUniqueId) : Bool{
var curInventory : CInventoryComponent;
var uiData : SInventoryItemUIData;
curInventory = GetCurrentInventory(item);
if (curInventory.IsIdValid(item)){
uiData = curInventory.GetInventoryItemUIData(item);
uiData.isNew = false;
curInventory.SetInventoryItemUIData(item, uiData);
}
/* NOP */;
}
public function ShowItemTooltip(item : SItemUniqueId, compareItemType :
Int32){
var tooltipData : CScriptedFlashObject;
_tooltipDataProvider.setCurrentInventory(GetCurrentInventory(ite
m));
tooltipData = _tooltipDataProvider.GetTooltipData(item, _current
Inv == _shopInv, true);
m_flashValueStorage.SetFlashObject("context.tooltip.data", toolt
ipData, /* NOP */);
/* NOP */;

}
public function ShowItemMouseTooltip(item : SItemUniqueId, compareItemTy
pe : Int32){
var tooltipData : CScriptedFlashObject;
_tooltipDataProvider.setCurrentInventory(GetInventoryComponent(_
currentMouseInv));
tooltipData = _tooltipDataProvider.GetTooltipData(item, _current
MouseInv == _shopInv, true);
m_flashValueStorage.SetFlashObject("context.tooltip.data", toolt
ipData, /* NOP */);
/* NOP */;
}
public function HideItemTooltip(){
m_flashValueStorage.SetFlashBool("context.tooltip.hide", hackHid
eItemTooltip, /* NOP */);
hackHideItemTooltip = !hackHideItemTooltip;
/* NOP */;
}
public function GetCurrentInventoryComponent() : W3GuiBaseInventoryCompo
nent{
return _currentInv;
/* NOP */;
}
public function GetCurrentInventory(item : SItemUniqueId) : CInventoryCo
mponent{
return GetInventoryComponent(_currentInv);
/* NOP */;
}
public function GetInventoryComponent(_targetInv : W3GuiBaseInventoryCom
ponent) : CInventoryComponent{
if (_targetInv == _shopInv){
return _shopNpc.GetInventory();
} else if (_targetInv == _containerInv){
return _container.GetInventory();
} else if (_targetInv == _horsePaperdollInv){
return _horsePaperdollInv.GetInventoryComponent();
} else {
return _inv;
}
/* NOP */;
}
public function getShopInventory() : CInventoryComponent{
if (_shopNpc){
return _shopNpc.GetInventory();
}
return NULL;
/* NOP */;
}
public function GetFilterType(item : SItemUniqueId) : EInventoryFilterTy
pe{
return _paperdollInv.GetFilterTypeByItem(item);
/* NOP */;
}
public function GetItemDefaultActionName(item : SItemUniqueId) : String{
var itemAction : EInventoryActionType;
itemAction = GetItemDefaultAction(item);
return GetItemActionFriendlyName(itemAction, GetWitcherPlayer().
IsItemEquipped(item));
/* NOP */;
}

public function GetItemDefaultAction(item : SItemUniqueId) : EInventoryA


ctionType{
var itemAction : EInventoryActionType;
itemAction = _playerInv.GetItemActionType(item, true);
return itemAction;
/* NOP */;
}
private function GetHealthTooltipData(GFxData : CScriptedFlashArray){
var maxHealth : Float;
var curHealth : Float;
var inCombatRegen : Float;
var outOfCombatRegen : Float;
var inCombatRegenStr : String;
var outOfCombatRegenStr : String;
maxHealth = thePlayer.GetStatMax(0);
curHealth = thePlayer.GetStatPercents(0);
inCombatRegen = CalculateAttributeValue(thePlayer.GetAttributeVa
lue('vitalityCombatRegen', /* NOP */, /* NOP */), /* NOP */);
outOfCombatRegen = CalculateAttributeValue(thePlayer.GetAttribut
eValue('vitalityRegen', /* NOP */, /* NOP */), /* NOP */);
inCombatRegenStr = NoTrailZeros(RoundTo(inCombatRegen, 1));
outOfCombatRegenStr = NoTrailZeros(RoundTo(outOfCombatRegen, 1))
;
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_h
ealth", RoundMath(maxHealth * curHealth));
PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_h
ealth", RoundMath(maxHealth));
PushStatItem(GFxData, "panel_common_statistics_tooltip_incombat_
regen", inCombatRegenStr);
PushStatItem(GFxData, "panel_common_statistics_tooltip_outofcomb
at_regen", outOfCombatRegenStr);
/* NOP */;
}
private function GetToxicityTooltipData(GFxData : CScriptedFlashArray){
var maxToxicity : Float;
var curToxicity : Float;
var lockedToxicity : Float;
var toxicityThreshold : Float;
maxToxicity = thePlayer.GetStatMax(3);
curToxicity = thePlayer.GetStat(3, true);
lockedToxicity = thePlayer.GetStat(3, /* NOP */) - curToxicity;
toxicityThreshold = GetWitcherPlayer().GetToxicityDamageThreshol
d();
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_t
oxicity", RoundMath(curToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_m
aximum", RoundMath(maxToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_locked",
RoundMath(lockedToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_threshold
", RoundMath(toxicityThreshold));
PushStatItem(GFxData, "panel_common_statistics_tooltip_degenerat
ion", RoundMath(0));
/* NOP */;
}
private function GetStaminaTooltipData(GFxData : CScriptedFlashArray){
var maxStamina : Float;
var regenStamia : Float;
var value : SAbilityAttributeValue;
value = thePlayer.GetAttributeValue('staminaRegen', /* NOP */, /

* NOP */);
regenStamia = value.valueMultiplicative / 0.340000;
maxStamina = thePlayer.GetStatMax(2);
PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_s
tamina ", RoundMath(maxStamina));
PushStatItem(GFxData, "panel_common_statistics_tooltip_regenerat
ion_rate", NoTrailZeros(RoundTo(regenStamia, 2)));
/* NOP */;
}
private function GetAdrenalineTooltipData(GFxData : CScriptedFlashArray)
{
var maxAdrenaline : Float;
var curAdrenaline : Float;
maxAdrenaline = thePlayer.GetStatMax(4);
curAdrenaline = thePlayer.GetStat(4, /* NOP */);
PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenalin
e_current", FloorF(curAdrenaline));
PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenalin
e_max", RoundMath(maxAdrenaline));
/* NOP */;
}
private function GetOffenseTooltipData(GFxData : CScriptedFlashArray){
var curStats : SPlayerOffenseStats;
curStats = GetWitcherPlayer().GetOffenseStatsList();
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_dps", StatToStr(curStats.steelFastDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_crit_chance", StatToStr(curStats.steelFastCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_crit_dmg", StatToStr(curStats.steelFastCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_dps", StatToStr(curStats.steelStrongDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_crit_chance", StatToStr(curStats.steelStrongCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_crit_dmg", StatToStr(curStats.steelStrongCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa
st_dps", StatToStr(curStats.silverFastDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa
st_crit_chance", StatToStr(curStats.silverFastCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa
st_crit_dmg", StatToStr(curStats.silverFastCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_dps", StatToStr(curStats.silverStrongDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_crit_chance", StatToStr(curStats.silverStrongCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_crit_dmg", StatToStr(curStats.silverStrongCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_
dps", StatToStr(curStats.crossbowCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_
crit_chance", StatToStr(curStats.crossbowSteelDmg));
/* NOP */;
}
private function GetDefenseTooltipData(GFxData : CScriptedFlashArray){
PushStatItem(GFxData, "panel_common_statistics_tooltip_armor", "
");
PushStatItem(GFxData, "slashing_resistance", GetStatValue('slash
ing_resistance_perc') + "%");
PushStatItem(GFxData, "piercing_resistance", GetStatValue('pierc

ing_resistance_perc') + "%");
PushStatItem(GFxData, "bludgeoning_resistance", GetStatValue('bl
udgeoning_resistance_perc') + "%");
PushStatItem(GFxData, "rending_resistance", GetStatValue('rendin
g_resistance_perc') + "%");
PushStatItem(GFxData, "elemental_resistance", GetStatValue('elem
ental_resistance_perc') + "%");
PushStatItem(GFxData, "poison_resistance", GetStatValue('poison_
resistance_perc') + "%");
PushStatItem(GFxData, "fire_resistance", GetStatValue('fire_resi
stance_perc') + "%");
PushStatItem(GFxData, "bleeding_resistance", GetStatValue('bleed
ing_resistance_perc') + "%");
PushStatItem(GFxData, "knockdown_resistance", GetStatValue('knoc
kdown_resistance_perc') + "%");
/* NOP */;
}
private function GetSignsTooltipData(GFxData : CScriptedFlashArray){
var sp : SAbilityAttributeValue;
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
sp = witcher.GetTotalSignSpellPower(6);
PushStatItem(GFxData, 'aard_intensity', RoundMath(sp.valueMultip
licative * 100) + "%");
sp = witcher.GetTotalSignSpellPower(7);
PushStatItem(GFxData, 'igni_intensity', RoundMath(sp.valueMultip
licative * 100) + "%");
sp = witcher.GetTotalSignSpellPower(8);
PushStatItem(GFxData, 'yrden_intensity', RoundMath(sp.valueMulti
plicative * 100) + "%");
sp = witcher.GetTotalSignSpellPower(9);
PushStatItem(GFxData, 'quen_intensity', RoundMath(sp.valueMultip
licative * 100) + "%");
sp = witcher.GetTotalSignSpellPower(10);
PushStatItem(GFxData, 'axii_intensity', RoundMath(sp.valueMultip
licative * 100) + "%");
/* NOP */;
}
private function PushStatItem(statsList : CScriptedFlashArray, label : S
tring, value : String){
var statItemData : CScriptedFlashObject;
statItemData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
statItemData.SetMemberFlashString("name", GetLocStringByKeyExt(l
abel));
statItemData.SetMemberFlashString("value", value);
statsList.PushBackFlashObject(statItemData);
/* NOP */;
}
private function StatToStr(value : Float) : String{
return NoTrailZeros(RoundTo(value, 1));
/* NOP */;
}
private function UpdatePlayerStatisticsData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var valueStr : String;
var statsNr : Int32;
var statName : CName;
var i : Int32;

var lastSentStatString : String;


l_flashArray = m_flashValueStorage.CreateTempFlashArray();
AddCharacterStatU("mainSilverStat", 'silverdamage', "panel_commo
n_statistics_tooltip_silver_dps", "attack_silver", l_flashArray, m_flashValueSto
rage);
AddCharacterStatU("mainSteelStat", 'steeldamage', "panel_common_
statistics_tooltip_steel_dps", "attack_steel", l_flashArray, m_flashValueStorage
);
AddCharacterStat("mainResStat", 'armor', "attribute_name_armor",
"armor", l_flashArray, m_flashValueStorage);
AddCharacterStat("mainMagicStat", 'spell_power', "stat_signs", "
spell_power", l_flashArray, m_flashValueStorage);
AddCharacterStat("majorStat1", 'vitality', "vitality", "vitality
", l_flashArray, m_flashValueStorage);
m_flashValueStorage.SetFlashArray("playerstats.stats", l_flashAr
ray);
/* NOP */;
}
private function updateSentStatValue(statName : CName, statValue : Strin
g){
var sentStat : SentStatsData;
var i : Int32;
i = 0;
while (i < _sentStats.Size()){
if (_sentStats[i].statName == statName){
_sentStats[i].statValue = statValue;
return;
}
i += 1;
}
sentStat.statName = statName;
sentStat.statValue = statValue;
_sentStats.PushBack(sentStat);
/* NOP */;
}
private function getLastSentStatValue(statName : CName) : String{
var i : Int32;
i = 0;
while (i < _sentStats.Size()){
if (_sentStats[i].statName == statName){
return _sentStats[i].statValue;
}
i += 1;
}
return "";
/* NOP */;
}
private function GetSignStat(targetSkill : ESkill) : String{
var powerStatValue : SAbilityAttributeValue;
var damageTypeName : CName;
var points : Float;
GetWitcherPlayer().GetSignStats(targetSkill, damageTypeName, poi
nts, powerStatValue);
return NoTrailZeros(RoundMath(powerStatValue.valueMultiplicative
* 100)) + " %";
/* NOP */;
}
public function GetCurrentEquippedQuickSlot() : EEquipmentSlots{
var currentSelectedQuickItem : SItemUniqueId;
var itemOnSlot : SItemUniqueId;

var i : Int32;
var slot : EEquipmentSlots;
slot = 0;
currentSelectedQuickItem = GetWitcherPlayer().GetSelectedItemId(
);
i = 10;
while (i < 11 + 1){
if (GetWitcherPlayer().GetItemEquippedOnSlot(i, itemOnSl
ot)){
if (currentSelectedQuickItem == itemOnSlot){
return i;
}
}
i += 1;
}
return 0;
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
}
public function OnGlobalUpdate() : Bool{
UpdateData();
/* NOP */;
}
public function OnSetInventoryGridFilter(item : SItemUniqueId) : Bool{
var filterType : EInventoryFilterType;
filterType = _playerInv.GetFilterTypeByItem(item);
_playerInv.SetFilterType(filterType);
m_fxInventoryUpdateFilter.InvokeSelfOneArg(FlashArgUInt(getTabFr
omFilter(filterType)));
/* NOP */;
}
public function OnSaveItemGridPosition(item : SItemUniqueId, gridPos : I
nt32) : Bool{
SetGridPosition(item, gridPos);
/* NOP */;
}
private function SetGridPosition(item : SItemUniqueId, gridPos : Int32){
var UIData : SInventoryItemUIData;
UIData = _inv.GetInventoryItemUIData(item);
UIData.gridPosition = gridPos;
_inv.SetInventoryItemUIData(item, UIData);
/* NOP */;
}
private function GetGridPosition(item : SItemUniqueId) : Int32{
var UIData : SInventoryItemUIData;
UIData = _inv.GetInventoryItemUIData(item);
return UIData.gridPosition;
/* NOP */;
}
public function OnTooltipLoaded() : Bool{
}
public function OnHighlightPaperDollSlot(slotType : Int32) : Bool{
m_flashValueStorage.SetFlashInt("inventory.grid.paperdoll.highli
ght", slotType, /* NOP */);
/* NOP */;
}
public function OnClosingMenu() : Bool{
SaveStateData();
super.OnClosingMenu();

theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosingMenu('Sho
pMenu');
}
theGame.GetGuiManager().SendCustomUIEvent('ClosingShopMenu');
if (_playerInv){
delete _playerInv;
}
if (_paperdollInv){
delete _paperdollInv;
}
if (_horseInv){
delete _horseInv;
}
if (_horsePaperdollInv){
delete _horsePaperdollInv;
}
if (_tooltipDataProvider){
delete _tooltipDataProvider;
}
if (_containerInv){
delete _containerInv;
}
if (_shopInv){
delete _shopInv;
}
if (_quantityPopupData){
delete _quantityPopupData;
}
if (_statsContext){
delete _statsContext;
}
if (_paperdollContext){
delete _paperdollContext;
}
if (_invContext){
delete _invContext;
}
if (_externGridContext){
delete _externGridContext;
}
if (_bookPopupData){
delete _bookPopupData;
}
if (_charStatsPopupData){
_charStatsPopupData.ClosePopupOverlay();
delete _charStatsPopupData;
}
if (_itemInfoPopupData){
delete _itemInfoPopupData;
}
if (_destroyConfPopData){
delete _destroyConfPopData;
}
/* NOP */;
}
public function OnCloseMenu() : Bool{

CloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
if (_currentEqippedQuickSlot != 0){
GetWitcherPlayer().ClearSelectedItemId();
GetWitcherPlayer().SelectQuickslotItem(_currentEqippedQu
ickSlot);
}
if (_container){
_container.OnContainerClosed();
}
/* NOP */;
}
public function OnSetActiveItem() : Bool{
/* NOP */;
/* NOP */;
}
public function OnSwapItems(playerItem : SItemUniqueId, paperdollItem :
SItemUniqueId, paperdollSlot : Int32) : Bool{
OnEquipItem(playerItem, paperdollSlot, 1);
/* NOP */;
}
public function OnPutInSocket(item : SItemUniqueId) : Bool{
var targetList : array<Int32>;
var itemOnSlot : SItemUniqueId;
var uiStateRunes : W3TutorialManagerUIHandlerStateRunes;
var uiStateArmorUpgrades : W3TutorialManagerUIHandlerStateArmorU
pgrades;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
if (ShouldProcessTutorial('TutorialRunesSelectSword') &&
thePlayer.inv.ItemHasTag(item, 'WeaponUpgrade')){
uiStateRunes = (W3TutorialManagerUIHandlerStateR
unes)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateRunes){
uiStateRunes.OnSelectingSword();
}
} else if (ShouldProcessTutorial('TutorialArmorSocketsSe
lectTab') && thePlayer.inv.ItemHasTag(item, 'ArmorUpgrade')){
uiStateArmorUpgrades = (W3TutorialManagerUIHandl
erStateArmorUpgrades)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateArmorUpgrades){
uiStateArmorUpgrades.OnSelectingArmor();
}
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(1, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(1);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(2, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(2);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(3, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(3);

}
if (GetWitcherPlayer().GetItemEquippedOnSlot(4, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(4);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(5, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(5);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(6, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(6);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(9, itemOnSl
ot) && _playerInv.CanBeUpgradedBy(itemOnSlot, item)){
targetList.PushBack(9);
}
if (targetList.Size() > 0){
ShowSelectionMode(item, targetList);
} else {
showNotification(GetLocStringByKeyExt("panel_inv
entory_notification_no_upgradable_items"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
}
/* NOP */;
}
public function ShowApplyOilMode(item : SItemUniqueId){
var targetList : array<Int32>;
var itemOnSlot : SItemUniqueId;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return;
}
if (_inv.ItemHasTag(item, 'SteelOil') && GetWitcherPlayer().GetI
temEquippedOnSlot(2, itemOnSlot) && thePlayer.inv.IsItemSteelSwordUsableByPlayer
(itemOnSlot)){
targetList.PushBack(2);
}
if (_inv.ItemHasTag(item, 'SilverOil') && GetWitcherPlayer().Get
ItemEquippedOnSlot(1, itemOnSlot) && thePlayer.inv.IsItemSilverSwordUsableByPlay
er(itemOnSlot)){
targetList.PushBack(1);
}
if (targetList.Size() > 0){
ShowSelectionMode(item, targetList);
}
/* NOP */;
}
public function OnRepairItem(item : SItemUniqueId) : Bool{
var targetList : array<Int32>;
var itemOnSlot : SItemUniqueId;
if (_inv.ItemHasTag(item, 'WeaponReapairKit')){
if (GetWitcherPlayer().GetItemEquippedOnSlot(2, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(2);

}
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(1, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(1);
}
}
}
if (_inv.ItemHasTag(item, 'ArmorReapairKit')){
if (GetWitcherPlayer().GetItemEquippedOnSlot(3, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(3);
}
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(4, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(4);
}
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(5, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(5);
}
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(6, itemOnSl
ot)){
if (GetWitcherPlayer().IsItemRepairAble(itemOnSl
ot)){
targetList.PushBack(6);
}
}
}
if (targetList.Size() > 0){
ShowSelectionMode(item, targetList);
} else {
showNotification(GetLocStringByKeyExt("panel_inventory_n
othing_to_repair"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
public function TryEquipToPockets(item : SItemUniqueId, slot : Int32) :
Bool{
var targetList : array<Int32>;
if (slot == 10 || slot == 11){
targetList.PushBack(10);
targetList.PushBack(11);
} else if (slot == 7 || slot == 8){
targetList.PushBack(7);
targetList.PushBack(8);
} else if (slot == 14 || slot == 15){
targetList.PushBack(14);

targetList.PushBack(15);
}
if (targetList.Size() > 0){
if (theInput.LastUsedPCInput()){
EquipToFirstEmptySocket(item, targetList);
} else {
ShowSelectionMode(item, targetList);
}
return true;
}
return false;
/* NOP */;
}
private function EquipToFirstEmptySocket(itemId : SItemUniqueId, targetS
lotList : array<Int32>){
var i : Int32;
var len : Int32;
var currentSlot : Int32;
var equippedItem : SItemUniqueId;
len = targetSlotList.Size();
if (len > 0){
i = 0;
while (i < len){
currentSlot = targetSlotList[i];
GetWitcherPlayer().GetItemEquippedOnSlot(current
Slot, equippedItem);
if (!_inv.IsIdValid(equippedItem)){
OnEquipItem(itemId, currentSlot, 1);
return;
}
i += 1;
}
OnEquipItem(itemId, targetSlotList[len - 1], 1);
}
/* NOP */;
}
public function OnDropOnPaperdoll(item : SItemUniqueId, slot : Int32, qu
antity : Int32) : Bool{
OnEquipItem(item, slot, quantity);
/* NOP */;
}
public function OnApplyOil(item : SItemUniqueId, slot : Int32) : Bool{
ApplyOil(item, slot);
/* NOP */;
}
public function OnApplyUpgrade(item : SItemUniqueId, slot : Int32) : Boo
l{
ApplyUpgrade(item, slot);
/* NOP */;
}
public function OnApplyRepairKit(item : SItemUniqueId, slot : Int32) : B
ool{
ApplyRepairKit(item, slot);
/* NOP */;
}
public function OnEquipItem(item : SItemUniqueId, slot : Int32, quantity
: Int32) : Bool{
var paperdollItemsToUpdate : array<SItemUniqueId>;
var itemOnSlot : SItemUniqueId;
var boltsItem : SItemUniqueId;

var OnSlot : Bool;


var hItem : SItemUniqueId;
var uiData : SInventoryItemUIData;
var keepSelection : Bool;
var abls : array<CName>;
var i : Int32;
var itemAlreadyEuipped : Bool;
OnSlot = false;
itemAlreadyEuipped = false;
if (_currentInv == _containerInv){
if (_shopNpc){
BuyItem(item, quantity);
UpdateShop();
UpdatePlayerStatisticsData();
} else {
TakeItem(item, quantity);
UpdateContainer();
UpdatePlayerStatisticsData();
}
} else if (_shopNpc){
SellItem(item, quantity);
UpdateShop();
UpdatePlayerStatisticsData();
} else if (_containerInv){
GiveItem(item, quantity);
UpdateContainer();
UpdatePlayerStatisticsData();
} else {
if (thePlayer.inv.GetItemLevel(item) > thePlayer.GetLeve
l()){
showNotification(GetLocStringByKeyExt("panel_inv
entory_cannot_equip_low_level"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
/* NOP */;
GetWitcherPlayer().GetItemEquippedOnSlot(slot, itemOnSlo
t);
if (slot == 17){
if (!GetWitcherPlayer().IsAnyItemEquippedOnSlot(
9)){
showNotification(GetLocStringByKeyExt("p
anel_inventory_cannot_equip_bolts"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
} else if (_inv.ItemHasTag(itemOnSlot, theGame.p
arams.TAG_INFINITE_AMMO)){
if (_inv.GetItemName(itemOnSlot) == 'Har
poon Bolt'){
showNotification(GetLocStringByK
eyExt("menu_cannot_perform_action_now"), /* NOP */);
OnPlaySoundEvent("gui_global_den
ied");
return false;
}
OnSlot = true;
}
}
if (slot == 26 || slot == 27 || slot == 28 || slot == 29
){

if (!GetWitcherPlayer().GetHorseManager()){
return true;
}
if (slot == 29 && _inv.IsIdValid(item)){
abls.Clear();
_inv.GetItemAbilities(item, abls);
i = 0;
while (i < abls.Size()){
if (abls[i] == 'base_trophy_stat
s'){
} else {
thePlayer.AddAbility(abl
s[i], /* NOP */);
}
i += 1;
}
}
hItem = GetWitcherPlayer().GetHorseManager().Mov
eItemToHorse(item, 1);
itemOnSlot = GetWitcherPlayer().GetHorseManager(
).EquipItem(hItem);
if (_inv.IsIdValid(itemOnSlot)){
InventoryRemoveItem(item, true);
InventoryUpdateItem(itemOnSlot);
} else {
InventoryRemoveItem(item, false);
}
if (slot == 29 && _inv.IsIdValid(itemOnSlot)){
abls.Clear();
_inv.GetItemAbilities(itemOnSlot, abls);
i = 0;
while (i < abls.Size()){
if (abls[i] == 'base_trophy_stat
s'){
} else {
thePlayer.RemoveAbility(
abls[i]);
}
i += 1;
}
}
PaperdollUpdateHorseItem(hItem);
UpdateEncumbranceInfo();
PlayItemEquipSound(_horsePaperdollInv.GetInvento
ryComponent().GetItemCategory(item));
return true;
} else {
PlayItemEquipSound(_inv.GetItemCategory(item));
}
itemAlreadyEuipped = GetWitcherPlayer().IsItemEquipped(i
tem);
_playerInv.EquipItem(item, slot);
UpdatePlayerStatisticsData();
(CActor)m_player.SetBehaviorMimicVariable('gameplayMimic
sMode', 3);
switch(_inv.GetItemCategory(item)){
case 'armor':
m_player.RaiseEvent('ShowArmor_Inv');
break;
case 'gloves':

m_player.RaiseEvent('ShowGlove_Inv');
break;
case 'pants':
m_player.RaiseEvent('ShowPants_Inv');
break;
case 'boots':
m_player.RaiseEvent('ShowBoots_Inv');
break;
case 'steelsword':
m_player.RaiseEvent('DrawSteelSword_Inv');
break;
case 'silversword':
m_player.RaiseEvent('DrawSilverSword_Inv');
break;
case 'crossbow':
m_player.RaiseEvent('DrawCrossbow_Inv');
break;
default:
break;
}
}
if (!OnSlot && _inv.IsIdValid(itemOnSlot) && !_inv.ItemHasTag(it
emOnSlot, 'NoShow')){
SetGridPosition(itemOnSlot, GetGridPosition(item));
keepSelection = !_inv.ItemHasTag(itemOnSlot, 'NoShow');
InventoryRemoveItem(item, keepSelection);
if (!itemAlreadyEuipped){
InventoryUpdateItem(itemOnSlot);
} else {
paperdollItemsToUpdate.PushBack(itemOnSlot);
}
} else {
InventoryRemoveItem(item, /* NOP */);
}
UpdateEncumbranceInfo();
if (slot == 9){
PaperdollUpdateAll();
} else {
paperdollItemsToUpdate.PushBack(item);
PaperdollUpdateItemsList(paperdollItemsToUpdate);
}
OnSaveItemGridPosition(item, -1);
UpdateGuiSceneEntityItems();
/* NOP */;
}
public function FindEmptySlot(first : EEquipmentSlots, last : EEquipment
Slots, outSlot : Int32) : Bool{
var i : Int32;
var itemOnSlot : SItemUniqueId;
i = first;
while (i < last + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, itemOnSlot);
if (!_inv.IsIdValid(itemOnSlot)){
outSlot = i;
return true;
}
i += 1;
}
return false;
/* NOP */;

}
public function FindMaskSlot(first : EEquipmentSlots, last : EEquipmentS
lots, outSlot : Int32) : Bool{
var i : Int32;
var itemOnSlot : SItemUniqueId;
i = first;
while (i < last + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, itemOnSlot);
if (_inv.IsItemMask(itemOnSlot)){
outSlot = i;
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnUnequipItem(item : SItemUniqueId, moveToIndex : Int32)
: Bool{
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
return UnequipItem(item, moveToIndex);
/* NOP */;
}
public function UnequipItem(item : SItemUniqueId, moveToIndex : Int32) :
Bool{
var filterType : EInventoryFilterType;
var itemOnSlot : SItemUniqueId;
var crossbowOnSlot : SItemUniqueId;
var horseItem : SItemUniqueId;
var slot : EEquipmentSlots;
var forceInvAllUpdate : Bool;
var abls : array<CName>;
var i : Int32;
forceInvAllUpdate = false;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
if (_horsePaperdollInv.GetInventoryComponent().IsIdValid(item) &
& _horsePaperdollInv.isHorseItem(item)){
slot = _horsePaperdollInv.GetInventoryComponent().GetSlo
tForItemId(item);
horseItem = GetWitcherPlayer().GetHorseManager().Unequip
Item(slot);
PlayItemUnequipSound(_inv.GetItemCategory(horseItem));
m_fxInventoryUpdateFilter.InvokeSelfOneArg(FlashArgUInt(
GetTabIndexForSlot(slot)));
InventoryUpdateItem(horseItem);
PaperdollUpdateAll();
UpdateEncumbranceInfo();
if (slot == 29 && _inv.IsIdValid(horseItem)){
abls.Clear();
_inv.GetItemAbilities(horseItem, abls);

i = 0;
while (i < abls.Size()){
if (abls[i] == 'base_trophy_stats'){
} else {
thePlayer.RemoveAbility(abls[i])
;
}
i += 1;
}
}
PlayItemUnequipSound(_horsePaperdollInv.GetInventoryComp
onent().GetItemCategory(item));
return true;
}
if (_containerInv){
GiveItem(item, 1);
UpdateContainer();
InventoryUpdateItem(item);
PaperdollRemoveItem(item);
UpdatePlayerStatisticsData();
} else if (_inv.IsIdValid(item)){
if (_inv.IsItemBolt(item) && _inv.ItemHasTag(item, theGa
me.params.TAG_INFINITE_AMMO)){
return false;
}
/* NOP */;
if (moveToIndex > -1){
_playerInv.MoveItem(item, moveToIndex);
}
PlayItemUnequipSound(_inv.GetItemCategory(item));
if (_inv.IsItemCrossbow(item) && GetWitcherPlayer().GetI
temEquippedOnSlot(17, itemOnSlot)){
_playerInv.UnequipItem(itemOnSlot);
PaperdollRemoveItem(itemOnSlot);
if (!_inv.ItemHasTag(itemOnSlot, theGame.params.
TAG_INFINITE_AMMO)){
forceInvAllUpdate = true;
}
}
_playerInv.UnequipItem(item);
filterType = _playerInv.GetFilterTypeByItem(item);
_playerInv.SetFilterType(filterType);
UpdateInventoryFilter(filterType);
if (forceInvAllUpdate){
PopulateTabData(getTabFromItem(item));
} else {
InventoryUpdateItem(item);
}
PaperdollRemoveItem(item);
if (_inv.IsItemBolt(item) && GetWitcherPlayer().GetItemE
quippedOnSlot(17, itemOnSlot)){
PaperdollUpdateItem(itemOnSlot);
}
UpdatePlayerStatisticsData();
}
UpdateEncumbranceInfo();
UpdateGuiSceneEntityItems();
switch(_inv.GetItemCategory(item)){
case 'steelsword':
m_player.RaiseEvent('RemoveSteelSword_Inv');

break;
case 'silversword':
m_player.RaiseEvent('RemoveSilverSword_Inv');
break;
case 'crossbow':
m_player.RaiseEvent('RemoveCrossbow_Inv');
break;
default:
break;
}
return true;
/* NOP */;
}
public function UpdateInventoryFilter(filterType : EInventoryFilterType)
{
m_fxInventoryUpdateFilter.InvokeSelfOneArg(FlashArgUInt(getTabFr
omFilter(filterType)));
/* NOP */;
}
public function OnDragItemStarted(itemId : SItemUniqueId) : Bool{
var filterType : EInventoryFilterType;
var slot : EEquipmentSlots;
if (_horsePaperdollInv.GetInventoryComponent().IsIdValid(itemId)
&& _horsePaperdollInv.isHorseItem(itemId)){
slot = _horsePaperdollInv.GetInventoryComponent().GetSlo
tForItemId(itemId);
m_fxInventoryUpdateFilter.InvokeSelfOneArg(FlashArgUInt(
GetTabIndexForSlot(slot)));
} else {
filterType = _playerInv.GetFilterTypeByItem(itemId);
UpdateInventoryFilter(filterType);
}
/* NOP */;
}
public function OnEmptySlotActivate(equipID : Int32) : Bool{
var targetTabIndex : InventoryMenuTabIndexes;
targetTabIndex = GetTabIndexForSlot(equipID);
m_flashValueStorage.SetFlashInt("OnTabSelectRequested", -1, /* N
OP */);
m_flashValueStorage.SetFlashInt("OnTabSelectRequested", targetTa
bIndex, /* NOP */);
/* NOP */;
}
protected function GetTabIndexForSlot(equipID : Int32) : Int32{
switch(equipID){
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 9:
case 17:
case 29:
case 26:
case 27:
case 28:
default:
return 0;
case 7:

case 8:
return 1;
case 10:
case 11:
return 4;
case 14:
case 15:
}
return 1;
return 0;
/* NOP */;
}
public function OnDropItem(item : SItemUniqueId, quantity : Int32) : Boo
l{
if (_inv.ItemHasTag(item, 'SilverOil') || _inv.ItemHasTag(item,
'SteelOil') || _inv.ItemHasTag(item, 'Petard') || _inv.ItemHasTag(item, 'Potion'
) && _inv.GetItemCategory(item) != 'edibles' && _playerInv.CanDrop(item)){
if (_destroyConfPopData){
delete _destroyConfPopData;
}
_destroyConfPopData = new W3DestroyItemConfPopup in this
;
_destroyConfPopData.SetMessageTitle("");
_destroyConfPopData.SetMessageText(GetLocStringByKeyExt(
"panel_inventory_message_destroy_item"));
_destroyConfPopData.menuRef = this;
_destroyConfPopData.item = item;
_destroyConfPopData.quantity = quantity;
_destroyConfPopData.BlurBackground = true;
RequestSubMenu('PopupMenu', _destroyConfPopData);
} else {
DropItem(item, quantity);
}
/* NOP */;
}
public function OnReadBook(item : SItemUniqueId) : Bool{
var itemCategory : CName;
var tutStateBooks : W3TutorialManagerUIHandlerStateBooks;
var tutStateRecipeReading : W3TutorialManagerUIHandlerStateRecip
eReading;
var isSthLearned : Bool;
ReadBook(item);
itemCategory = thePlayer.inv.GetItemCategory(item);
isSthLearned = false;
if (itemCategory == 'alchemy_recipe' || itemCategory == 'craftin
g_schematic'){
if (!thePlayer.inv.ItemHasTag(item, 'BookReaded')){
thePlayer.inv.AddItemTag(item, 'BookReaded');
UpdateData();
updateCurrentTab();
isSthLearned = true;
}
}
if (ShouldProcessTutorial('TutorialBooksSelectTab')){
tutStateBooks = (W3TutorialManagerUIHandlerStateBooks)th
eGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateBooks){
tutStateBooks.OnBookRead();
} else if (isSthLearned){
tutStateRecipeReading = (W3TutorialManagerUIHand

lerStateRecipeReading)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateRecipeReading){
tutStateRecipeReading.OnBookRead();
}
}
}
/* NOP */;
}
public function OnUpgradeItem(item : SItemUniqueId, slot : Int32, quanti
ty : Int32) : Bool{
var swordItem : SItemUniqueId;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
if (_inv.ItemHasTag(item, 'SilverOil')){
GetWitcherPlayer().GetItemEquippedOnSlot(1, swor
dItem);
} else if (_inv.ItemHasTag(item, 'SteelOil')){
GetWitcherPlayer().GetItemEquippedOnSlot(2, swor
dItem);
}
if (_inv.IsIdValid(swordItem)){
_playerInv.UpgradeItem(swordItem, item);
UpdateData();
}
}
/* NOP */;
}
public function OnTransferItem(item : SItemUniqueId, quantity : Int32, m
oveToIdx : Int32) : Bool{
if (_currentInv == _containerInv){
TakeItem(item, quantity);
} else {
GiveItem(item, quantity);
}
UpdateData();
UpdateContainer();
/* NOP */;
}
public function OnSellItem(itemId : SItemUniqueId, quantity : Int32) : B
ool{
var invItem : SInventoryItem;
var itemPrice : Int32;
var newShopItem : SItemUniqueId;
if (!_playerInv.GetInventoryComponent().IsIdValid(itemId)){
return false;
}
invItem = _playerInv.GetInventoryComponent().GetItem(itemId);
itemPrice = _shopInv.GetInventoryComponent().GetInventoryItemPri
ceModified(invItem, true);
if (itemPrice <= 0 || !_playerInv.CanDrop(itemId)){
showNotification(GetLocStringByKeyExt("panel_shop_not_fo
r_sale"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
/* NOP */;
if (quantity <= 1){

newShopItem = SellItem(itemId, quantity);


if (GetInvalidUniqueId() != newShopItem){
InventoryRemoveItem(itemId, /* NOP */);
UpdateItemsCounter();
UpdatePlayerStatisticsData();
ShopUpdateItem(newShopItem);
UpdateEncumbranceInfo();
}
} else if (_shopInv.GetInventoryComponent().GetMoney() < itemPri
ce){
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_shopkeeper_not_enough_money"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
OpenQuantityPopup(itemId, 0, quantity);
}
/* NOP */;
}
public function OnBuyItem(item : SItemUniqueId, quantity : Int32, moveTo
Idx : Int32) : Bool{
var itemName : CName;
var tutorialState : W3TutorialManagerUIHandlerStateShop;
var result : Bool;
/* NOP */;
itemName = _shopInv.GetItemName(item);
if (quantity <= 1){
result = BuyItem(item, quantity);
if (result && ShouldProcessTutorial('TutorialShopBuy') &
& theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler
.GetCurrentStateName() == 'Shop' && itemName == 'Local pepper vodka'){
tutorialState = (W3TutorialManagerUIHandlerState
Shop)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
tutorialState.OnBoughtItem();
}
} else if (_shopInv.GetInventoryComponent().GetInventoryItemPric
eModified(_shopInv.GetInventoryComponent().GetItem(item), false) > thePlayer.Get
Money()){
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_not_enough_money"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
OpenQuantityPopup(item, 1, quantity);
}
/* NOP */;
}
private function OpenQuantityPopup(itemId : SItemUniqueId, action : EQua
ntityTransferFunction, maxValue : Int32){
var invItem : SInventoryItem;
var maxAffordable : Int32;
var money : Int32;
if (_quantityPopupData){
delete _quantityPopupData;
}
_quantityPopupData = new QuantityPopupData in this;
switch(action){
case 0:
invItem = _playerInv.GetInventoryComponent().GetItem(ite
mId);
_quantityPopupData.itemCost = _shopInv.GetInventoryCompo
nent().GetInventoryItemPriceModified(invItem, true);

_quantityPopupData.showPrice = true;
money = _shopInv.GetInventoryComponent().GetMoney();
maxAffordable = FloorF(money / _quantityPopupData.itemCo
st);
maxAffordable = Min(maxAffordable, maxValue);
_quantityPopupData.minValue = Min(1, maxAffordable);
break;
case 1:
_quantityPopupData.itemCost = _shopInv.GetInventoryCompo
nent().GetItemPriceModified(itemId, false);
_quantityPopupData.showPrice = true;
money = thePlayer.GetMoney();
maxAffordable = FloorF(money / _quantityPopupData.itemCo
st);
maxAffordable = Min(maxAffordable, maxValue);
_quantityPopupData.minValue = Min(1, maxAffordable);
break;
case 2:
case 3:
case 4:
_quantityPopupData.showPrice = false;
maxAffordable = maxValue;
_quantityPopupData.minValue = 1;
break;
}
_quantityPopupData.itemId = itemId;
_quantityPopupData.currentValue = maxAffordable;
_quantityPopupData.maxValue = maxValue;
_quantityPopupData.actionType = action;
_quantityPopupData.inventoryRef = this;
RequestSubMenu('PopupMenu', _quantityPopupData);
/* NOP */;
}
public function TakeItem(item : SItemUniqueId, quantity : Int32){
_containerInv.GiveItem(item, _playerInv, quantity, /* NOP */);
/* NOP */;
}
public function GiveItem(item : SItemUniqueId, quantity : Int32){
if (_container && _container.OnTryToGiveItem(item)){
_playerInv.GiveItem(item, _containerInv, quantity, /* NO
P */);
} else if (_containerInv){
_playerInv.GiveItem(item, _containerInv, quantity, /* NO
P */);
}
/* NOP */;
}
public function BuyItem(item : SItemUniqueId, quantity : Int32) : Bool{
var filterType : EInventoryFilterType;
var resultValue : Bool;
var startingQuantity : Int32;
var newItemID : SItemUniqueId;
var itemCategory : CName;
theTelemetry.LogWithLabelAndValue(34, _shopInv.GetItemName(item)
, quantity);
filterType = _shopInv.GetFilterTypeByItem(item);
resultValue = _shopInv.GiveItem(item, _playerInv, quantity, newI
temID);
if (resultValue){
itemCategory = thePlayer.GetInventory().GetItemCategory(

newItemID);
if (itemCategory != 'gwint'){
_playerInv.SetFilterType(filterType);
UpdateInventoryFilter(filterType);
InventoryUpdateItem(newItemID);
}
theSound.SoundEvent('gui_inventory_buy');
UpdateEncumbranceInfo();
UpdatePlayerMoney();
UpdatePlayerStatisticsData();
UpdateItemsCounter();
UpdateMerchantData();
if (itemCategory == 'alchemy_recipe' || itemCategory ==
'crafting_schematic'){
thePlayer.GetInventory().ReadSchematicsAndRecipe
s(newItemID);
}
if (_shopInv.GetItemQuantity(item) == 0){
ShopRemoveItem(item);
} else {
ShopUpdateItem(item);
}
} else {
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_not_enough_money"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
return resultValue;
/* NOP */;
}
public function SellItem(item : SItemUniqueId, quantity : Int32) : SItem
UniqueId{
var shopInvComponent : CInventoryComponent;
var newItemID : SItemUniqueId;
var itemCost : Int32;
var shopMoney : Int32;
var invItem : SInventoryItem;
var preSellQty : Int32;
var uiDataGrid : SInventoryItemUIData;
newItemID = GetInvalidUniqueId();
if (_shopNpc){
theTelemetry.LogWithLabelAndValue(33, _playerInv.GetItem
Name(item), quantity);
invItem = _playerInv.GetInventoryComponent().GetItem(ite
m);
shopInvComponent = _shopInv.GetInventoryComponent();
itemCost = shopInvComponent.GetInventoryItemPriceModifie
d(invItem, true) * quantity;
shopMoney = shopInvComponent.GetMoney();
preSellQty = _playerInv.GetInventoryComponent().GetItemQ
uantity(item);
if (shopMoney < itemCost){
showNotification(GetLocStringByKeyExt("panel_sho
p_notification_shopkeeper_not_enough_money"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else if (_shopInv.ReceiveItem(item, _playerInv, quanti
ty, newItemID)){
theSound.SoundEvent('gui_inventory_sell');
UpdatePlayerMoney();
UpdateMerchantData();

UpdateItemsCounter();
if (preSellQty == 1 || preSellQty == quantity){
uiDataGrid = _playerInv.GetInventoryComp
onent().GetInventoryItemUIData(item);
uiDataGrid.gridPosition = -1;
_playerInv.GetInventoryComponent().SetIn
ventoryItemUIData(item, uiDataGrid);
}
} else {
showNotification(GetLocStringByKeyExt("panel_sho
p_not_for_sale"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
}
return newItemID;
/* NOP */;
}
public function DropItem(item : SItemUniqueId, quantity : Int32) : Bool{
var itemOnSlot : SItemUniqueId;
var boltSlot : SItemUniqueId;
var updateBoltsInInv : Bool;
updateBoltsInInv = false;
if (thePlayer.IsInCombat() && _inv.IsItemMounted(item) || _inv.I
sItemHeld(item)){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
if (_playerInv.CanDrop(item)){
if (quantity <= 1){
if (_inv.ItemHasTag(item, 'Potion') && _inv.GetI
temCategory(item) != 'edibles'){
OnPlaySoundEvent("gui_inv_potion");
} else {
OnPlaySoundEvent("gui_inventory_drop");
}
if (_inv.IsItemCrossbow(item) && GetWitcherPlaye
r().GetItemEquippedOnSlot(9, itemOnSlot)){
if (itemOnSlot == item && GetWitcherPlay
er().GetItemEquippedOnSlot(17, itemOnSlot)){
updateBoltsInInv = !_inv.ItemHas
Tag(itemOnSlot, theGame.params.TAG_INFINITE_AMMO);
PaperdollRemoveItem(itemOnSlot);
_playerInv.UnequipItem(itemOnSlo
t);
if (updateBoltsInInv){
InventoryUpdateItem(item
OnSlot);
}
}
}
FinalDropItem(item, quantity);
PaperdollRemoveItem(item);
InventoryRemoveItem(item, /* NOP */);
UpdateItemsCounter();
UpdatePlayerStatisticsData();
UpdateGuiSceneEntityItems();
} else {
OpenQuantityPopup(item, 4, quantity);

}
} else {
OnPlaySoundEvent("gui_global_denied");
}
return true;
/* NOP */;
}
public function FinalDropItem(item : SItemUniqueId, quantity : Int32){
var uiDataGrid : SInventoryItemUIData;
uiDataGrid = _inv.GetInventoryItemUIData(item);
uiDataGrid.gridPosition = -1;
_inv.SetInventoryItemUIData(item, uiDataGrid);
if (_inv.ItemHasTag(item, 'SilverOil') || _inv.ItemHasTag(item,
'SteelOil') || _inv.ItemHasTag(item, 'Petard') || _inv.ItemHasTag(item, 'Potion'
) && _inv.GetItemCategory(item) != 'edibles'){
_inv.RemoveItem(item, /* NOP */);
_inv.DespawnItem(item);
} else {
_playerInv.DropItem(item, quantity);
}
OnSaveItemGridPosition(item, -1);
/* NOP */;
}
public function UpdatePlayerMoney(){
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.UpdatePlayerOrens();
}
/* NOP */;
}
public function UpdateMerchantData(){
var l_merchantData : CScriptedFlashObject;
if (_shopNpc){
l_merchantData = m_flashValueStorage.CreateTempFlashObje
ct(/* NOP */);
GetNpcInfo(_shopNpc, l_merchantData);
m_flashValueStorage.SetFlashObject("inventory.merchant.i
nfo", l_merchantData, /* NOP */);
}
/* NOP */;
}
public function OnSetCurrentPlayerGrid(value : String) : Bool{
if (value == "inventory.grid.container"){
if (_shopInv){
_currentInv = _shopInv;
} else {
_currentInv = _containerInv;
}
} else if (value == "inventory.paperdoll.horse"){
_currentInv = _horsePaperdollInv;
} else {
_currentInv = _playerInv;
}
/* NOP */;
}
public function OnConsumeItem(item : SItemUniqueId) : Bool{
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);

OnPlaySoundEvent("gui_global_denied");
} else {
_playerInv.ConsumeItem(item);
FactsAdd("item_use_" + _playerInv.GetItemName(item), 1,
3);
if (_currentInv.GetItemQuantity(item) > 0){
InventoryUpdateItem(item);
} else {
InventoryRemoveItem(item, /* NOP */);
}
UpdateItemsCounter();
UpdatePlayerStatisticsData();
}
/* NOP */;
}
public function OnMoveItem(item : SItemUniqueId, moveToIndex : Int32) :
Bool{
_playerInv.MoveItem(item, moveToIndex);
InventoryUpdateItem(item);
m_flashValueStorage.SetFlashInt("inventory.grid.player.offset",
0, /* NOP */);
/* NOP */;
}
public function OnMoveItems(item : SItemUniqueId, moveToIndex : Int32, i
temSecond : SItemUniqueId, moveToSecondIndex : Int32) : Bool{
var itemsList : array<SItemUniqueId>;
_playerInv.MoveItems(item, moveToIndex, itemSecond, moveToSecond
Index);
itemsList.PushBack(item);
itemsList.PushBack(itemSecond);
InventoryUpdateItems(itemsList);
/* NOP */;
}
public function OnContainerFilterSelected(filterType : EInventoryFilterT
ype) : Bool{
UpdateContainer();
/* NOP */;
}
public function SaveStateData(){
UISavedData.openedCategories.Clear();
UISavedData.openedCategories.PushBack(GetFilterTypeName(_playerI
nv.GetFilterType()));
m_guiManager.UpdateUISavedData(GetMenuName(), UISavedData.opened
Categories, 'None', UISavedData.selectedModule, UISavedData.gridItem, UISavedDat
a.slotID);
/* NOP */;
}
public function OnModuleSelected(moduleID : Int32, moduleBindingName : S
tring) : Bool{
/* NOP */;
super.OnModuleSelected(moduleID, moduleBindingName);
m_lastSelectedModuleID = moduleID;
m_lastSelectedModuleBindingName = moduleBindingName;
if (m_selectionModeActive){
return false;
}
switch(moduleBindingName){
case "inventory.grid.player":
ResetContext();
createInventoryContext();

break;
case "inventory.grid.paperdoll.horse":
case "inventory.paperdoll":
ResetContext();
createPaperdollContext();
break;
case "inventory.stats":
ResetContext();
createStatContext();
break;
case "inventory.grid.container":
ResetContext();
createExternalContext();
break;
default:
break;
}
/* NOP */;
}
protected function createStatContext(){
if (_statsContext){
delete _statsContext;
}
_statsContext = new W3PlayerStatsContext in this;
_statsContext.SetInventoryRef(this);
m_currentContext = _statsContext;
ActivateContext(m_currentContext);
/* NOP */;
}
protected function createPaperdollContext(){
if (_paperdollContext){
delete _paperdollContext;
}
_paperdollContext = new W3InventoryPaperdollContext in this;
_paperdollContext.SetInventoryRef(this);
_paperdollContext.SetSecondInventoryComponentRef(GetWitcherPlaye
r().GetHorseManager().GetInventoryComponent());
m_currentContext = _paperdollContext;
ActivateContext(m_currentContext);
/* NOP */;
}
protected function createInventoryContext(){
if (_invContext){
delete _invContext;
}
_invContext = new W3InventoryGridContext in this;
_invContext.SetInventoryRef(this);
m_currentContext = _invContext;
ActivateContext(m_currentContext);
/* NOP */;
}
protected function createExternalContext(){
if (_externGridContext){
delete _externGridContext;
}
_externGridContext = new W3ExternalGridContext in this;
_externGridContext.SetInventoryRef(this);
m_currentContext = _externGridContext;
ActivateContext(m_currentContext);
/* NOP */;

}
public function OnSelectInventoryItem(itemId : SItemUniqueId, slot : Int
32, positionX : Float, positionY : Float) : Bool{
var inventoryGridContext : W3InventoryItemContext;
var tutorialState : W3TutorialManagerUIHandlerStateRunes;
var tutorialStateBooks : W3TutorialManagerUIHandlerStateBooks;
var tutorialStateFood : W3TutorialManagerUIHandlerStateFood;
var tutorialStateRecipeReading : W3TutorialManagerUIHandlerState
RecipeReading;
inventoryGridContext = (W3InventoryItemContext)m_currentContext;
SaveSelectedItem(itemId);
if (inventoryGridContext){
inventoryGridContext.SetContextMenuData(positionX, posit
ionY);
inventoryGridContext.SetCurrentSlot(slot);
inventoryGridContext.SetCurrentItem(itemId);
}
if (ShouldProcessTutorial('TutorialRunesSelectRune') && theGame.
GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurren
tStateName() == 'Runes'){
tutorialState = (W3TutorialManagerUIHandlerStateRunes)th
eGame.GetTutorialSystem().uiHandler.GetCurrentState();
tutorialState.OnSelectedItem(itemId);
}
if (ShouldProcessTutorial('TutorialBooksSelectTab') && theGame.G
etTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrent
StateName() == 'Books'){
tutorialStateBooks = (W3TutorialManagerUIHandlerStateBoo
ks)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
tutorialStateBooks.OnSelectedItem(itemId);
}
if (ShouldProcessTutorial('TutorialFoodSelectTab') && theGame.Ge
tTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentS
tateName() == 'Food'){
tutorialStateFood = (W3TutorialManagerUIHandlerStateFood
)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
tutorialStateFood.OnSelectedItem(itemId);
}
if (ShouldProcessTutorial('TutorialBooksSelectTab') && theGame.G
etTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrent
StateName() == 'RecipeReading'){
tutorialStateRecipeReading = (W3TutorialManagerUIHandler
StateRecipeReading)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
tutorialStateRecipeReading.OnSelectedItem(itemId);
}
/* NOP */;
}
public function OnSelectPaperdollItem(itemId : SItemUniqueId, slot : Int
32, positionX : Float, positionY : Float) : Bool{
var paperdollContext : W3InventoryPaperdollContext;
if (slot == 26 || slot == 27 || slot == 28 || slot == 29){
OnSetCurrentPlayerGrid("inventory.paperdoll.horse");
} else {
OnSetCurrentPlayerGrid("inventory.paperdoll");
}
paperdollContext = (W3InventoryPaperdollContext)m_currentContext
;
UISavedData.slotID = slot;
if (paperdollContext){
paperdollContext.SetContextMenuData(positionX, positionY

);
paperdollContext.SetCurrentSlot(slot);
paperdollContext.SetCurrentItem(itemId);
}
/* NOP */;
}
public function OnSelectPlayerStat(statId : CName) : Bool{
var statContext : W3PlayerStatsContext;
statContext = (W3PlayerStatsContext)m_currentContext;
if (statContext){
statContext.SetStatName(statId);
}
/* NOP */;
}
public function SaveSelectedItem(itemId : SItemUniqueId){
UISavedData.gridItem = itemId;
/* NOP */;
}
public function ReadBook(item : SItemUniqueId){
theSound.SoundEvent('gui_inventory_read');
_playerInv.ReadBook(item);
ShowBookPopup(GetLocStringByKeyExt(_inv.GetItemLocalizedNameByUn
iqueID(item)), _playerInv.GetBookText(item));
/* NOP */;
}
public function ShowBookPopup(BookTitle : String, BookText : String){
if (_bookPopupData){
delete _bookPopupData;
}
_bookPopupData = new BookPopupFeedback in this;
_bookPopupData.SetMessageTitle(BookTitle);
_bookPopupData.SetMessageText(BookText);
RequestSubMenu('PopupMenu', _bookPopupData);
/* NOP */;
}
public function OnShowFullStats() : Bool{
if (_charStatsPopupData){
delete _charStatsPopupData;
}
_charStatsPopupData = new CharacterStatsPopupData in this;
_charStatsPopupData.HideTutorial = true;
RequestSubMenu('PopupMenu', _charStatsPopupData);
/* NOP */;
}
public function OnPlaySound(soundKey : String) : Bool{
theSound.SoundEvent(soundKey);
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
/* NOP */;
if (m_currentContext){
m_currentContext.HandleUserFeedback(NavCode);
}
/* NOP */;
}
public function OnMouseInputHandled(NavCodeAnalog : String, itemId : SIt
emUniqueId, slotId : Int32, moduleBinding : String) : Bool{
var curInvContext : W3InventoryItemContext;
OnModuleSelected(0, moduleBinding);

curInvContext = (W3InventoryItemContext)m_currentContext;
if (curInvContext){
curInvContext.SetCurrentItem(itemId);
curInvContext.SetCurrentSlot(slotId);
curInvContext.HandleUserFeedback(NavCodeAnalog);
}
/* NOP */;
}
public function OnSetMouseInventoryComponent(moduleBinding : String, slo
tId : Int32) : Bool{
if (moduleBinding == "inventory.grid.container"){
if (_shopInv){
_currentMouseInv = _shopInv;
} else {
_currentMouseInv = _containerInv;
}
} else if (moduleBinding == "inventory.paperdoll"){
if (slotId == 26 || slotId == 27 || slotId == 28 || slot
Id == 29){
_currentMouseInv = _horsePaperdollInv;
} else {
_currentMouseInv = _playerInv;
}
} else {
_currentMouseInv = _playerInv;
}
/* NOP */;
}
public function OnShowItemPopup(item : SItemUniqueId) : Bool{
}
public function ShowItemInfoPopup(item : SItemUniqueId){
if (_itemInfoPopupData){
delete _itemInfoPopupData;
}
_itemInfoPopupData = new ItemInfoPopupData in this;
_itemInfoPopupData.inventoryRef = this;
_itemInfoPopupData.invRef = GetCurrentInventory(item);
_itemInfoPopupData.itemId = item;
RequestSubMenu('PopupMenu', _itemInfoPopupData);
/* NOP */;
}
public function OnItemPopupClosed(){
m_flashValueStorage.SetFlashBool("render.to.texture.texture.visi
ble", true, /* NOP */);
/* NOP */;
}
private function UpdateGuiSceneEntityItems(){
var guiSceneController : CR4GuiSceneController;
if (_currentState != 0){
return;
}
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
if (!guiSceneController){
return;
}
guiSceneController.SetEntityItems(true);
/* NOP */;
}
public function OnInventoryItemSelected(itemId : SItemUniqueId) : Bool{

}
public function ShowSelectionMode(sourceItem : SItemUniqueId, targetSlot
List : array<Int32>){
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var i : Int32;
if (m_selectionModeActive){
return;
}
if (targetSlotList.Size() == 0){
return;
}
if (!_inv.IsIdValid(sourceItem)){
return;
}
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
l_flashObject.SetMemberFlashInt("sourceItem", ItemToFlashUInt(so
urceItem));
i = 0;
while (i < targetSlotList.Size()){
l_flashArray.PushBackFlashInt(targetSlotList[i]);
i += 1;
}
OnPlaySoundEvent("gui_global_panel_open");
l_flashObject.SetMemberFlashArray("validSlots", l_flashArray);
m_selectionModeItem = sourceItem;
ResetContext();
m_flashValueStorage.SetFlashObject("inventory.selection.mode.sho
w", l_flashObject, /* NOP */);
m_selectionModeActive = true;
/* NOP */;
}
public function HideSelectionMode(){
if (!m_selectionModeActive){
return;
}
m_fxHideSelectionMode.InvokeSelf();
m_selectionModeActive = false;
OnModuleSelected(m_lastSelectedModuleID, m_lastSelectedModuleBin
dingName);
/* NOP */;
}
public function OnSelectionModeCancelRequested() : Bool{
var uiStateRunes : W3TutorialManagerUIHandlerStateRunes;
var uiStateArmorUpgrades : W3TutorialManagerUIHandlerStateArmorU
pgrades;
if (ShouldProcessTutorial('TutorialRunesSelectSword')){
uiStateRunes = (W3TutorialManagerUIHandlerStateRunes)the
Game.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateRunes){
uiStateRunes.OnSelectingSwordAborted();
}
} else if (ShouldProcessTutorial('TutorialArmorSocketsSelectTab'
)){
uiStateArmorUpgrades = (W3TutorialManagerUIHandlerStateA
rmorUpgrades)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateArmorUpgrades){
uiStateArmorUpgrades.OnSelectingArmorAborted();

}
}
OnPlaySoundEvent("gui_global_panel_close");
HideSelectionMode();
/* NOP */;
}
public function OnSelectionModeTargetChosen(targetSlot : Int32) : Bool{
var alreadyEquippedItem : Bool;
var curItemInSlot : SItemUniqueId;
var otherMask : SItemUniqueId;
alreadyEquippedItem = false;
if (_playerInv.isPotionItem(m_selectionModeItem) || _playerInv.i
sPetardItem(m_selectionModeItem) || _playerInv.isQuickslotItem(m_selectionModeIt
em) || _playerInv.isFoodItem(m_selectionModeItem)){
if (_inv.IsItemMask(m_selectionModeItem)){
if (targetSlot == 10){
GetWitcherPlayer().GetItemEquippedOnSlot
(11, otherMask);
} else if (targetSlot == 11){
GetWitcherPlayer().GetItemEquippedOnSlot
(10, otherMask);
}
}
alreadyEquippedItem = GetWitcherPlayer().GetItemEquipped
OnSlot(targetSlot, curItemInSlot);
PlayItemEquipSound(_inv.GetItemCategory(m_selectionModeI
tem));
_playerInv.EquipItem(m_selectionModeItem, targetSlot);
UpdatePlayerStatisticsData();
if (alreadyEquippedItem && _inv.IsIdValid(curItemInSlot)
){
InventoryRemoveItem(m_selectionModeItem, true);
InventoryUpdateItem(curItemInSlot);
} else {
InventoryRemoveItem(m_selectionModeItem, /* NOP
*/);
}
if (_inv.IsItemMask(m_selectionModeItem) && _inv.IsItemM
ask(otherMask)){
PaperdollRemoveItem(otherMask);
InventoryUpdateItem(otherMask);
}
PaperdollUpdateItem(m_selectionModeItem);
} else if (_inv.ItemHasTag(m_selectionModeItem, 'Upgrade')){
ApplyUpgrade(m_selectionModeItem, targetSlot);
} else if (_inv.ItemHasTag(m_selectionModeItem, 'SteelOil') || _
inv.ItemHasTag(m_selectionModeItem, 'SilverOil')){
ApplyOil(m_selectionModeItem, targetSlot);
} else if (_inv.ItemHasTag(m_selectionModeItem, 'WeaponReapairKi
t') || _inv.ItemHasTag(m_selectionModeItem, 'ArmorReapairKit')){
ApplyRepairKit(m_selectionModeItem, targetSlot);
}
HideSelectionMode();
UpdateGuiSceneEntityItems();
/* NOP */;
}
private function ApplyUpgrade(itemId : SItemUniqueId, targetSlot : Int32
){
var curItemInSlot : SItemUniqueId;
var uiStateRunes : W3TutorialManagerUIHandlerStateRunes;

var uiStateArmorUpgrades : W3TutorialManagerUIHandlerStateArmorU


pgrades;
if (GetWitcherPlayer().GetItemEquippedOnSlot(targetSlot, curItem
InSlot)){
if (targetSlot == 1 || targetSlot == 2){
OnPlaySoundEvent("gui_inventory_rune_attach");
} else {
OnPlaySoundEvent("gui_inventory_armorupgrade_att
ach");
}
if (_inv.EnhanceItemScript(curItemInSlot, itemId)){
if (_inv.IsIdValid(itemId) && _inv.GetItemQuanti
ty(itemId) > 0){
InventoryUpdateItem(itemId);
} else {
InventoryRemoveItem(itemId, /* NOP */);
}
PaperdollUpdateItem(curItemInSlot);
if (ShouldProcessTutorial('TutorialRunesSelectSw
ord')){
uiStateRunes = (W3TutorialManagerUIHandl
erStateRunes)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateRunes){
uiStateRunes.OnUpgradedItem();
}
}
if (ShouldProcessTutorial('TutorialArmorSocketsS
electTab')){
uiStateArmorUpgrades = (W3TutorialManage
rUIHandlerStateArmorUpgrades)theGame.GetTutorialSystem().uiHandler.GetCurrentSta
te();
if (uiStateArmorUpgrades){
uiStateArmorUpgrades.OnUpgradedI
tem();
}
}
}
}
/* NOP */;
}
private function ApplyOil(itemId : SItemUniqueId, targetSlot : Int32){
var curItemInSlot : SItemUniqueId;
OnPlaySoundEvent("gui_preparation_potion");
if (_inv.GetItemEquippedOnSlot(targetSlot, curItemInSlot)){
GetWitcherPlayer().ApplyOil(itemId, curItemInSlot);
InventoryUpdateItem(m_selectionModeItem);
PaperdollUpdateItem(curItemInSlot);
} else {
return;
}
/* NOP */;
}
private function ApplyRepairKit(itemId : SItemUniqueId, targetSlot : Int
32){
var curItemInSlot : SItemUniqueId;
OnPlaySoundEvent("gui_inventory_repair");
if (_inv.GetItemEquippedOnSlot(targetSlot, curItemInSlot)){
GetWitcherPlayer().RepairItem(itemId, curItemInSlot);
if (_inv.IsIdValid(itemId) && _inv.GetItemQuantity(itemI
d) > 0){

InventoryUpdateItem(itemId);
} else {
InventoryRemoveItem(itemId, /* NOP */);
}
PaperdollUpdateItem(curItemInSlot);
} else {
return;
}
/* NOP */;
}
public function UpdateAllItemData(){
UpdateItemsCounter();
UpdatePlayerStatisticsData();
UpdateGuiSceneEntityItems();
UpdateEncumbranceInfo();
/* NOP */;
}
public final function GetCurrentlySelectedTab() : Int32{
return currentlySelectedTab;
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
import abstract class CBehaviorGraphControlRigNode{
}
import abstract class TCrDefinition{
}
import abstract class TCrPropertySet{
}
import abstract class CControlRigSettings{
}
import abstract class CStorySceneInput{
}
import abstract class CImpostorMeshComponent{
}
import abstract class CStorySceneFlowSwitch{
}
import abstract class CStreamingAreaComponent{
}
import abstract class CTeleportDetectorData{
}
import abstract class CStorySceneLinkHub{
}
import abstract class STeleportBone{
}
import struct CStorySceneOutput{
public editable var action : EStorySceneOutputAction;

}
import struct CClothComponent{
import public final function SetSimulated(value : Bool);
import public final function SetMaxDistanceScale(scale : Float);
import public final function SetFrozen(frozen : Bool);
}
import struct CGameplayEffectsComponent{
import public final function SetGameplayEffectFlag(flag : EEntityGamepla
yEffectFlags, value : Bool);
import public final function GetGameplayEffectFlag(flag : EEntityGamepla
yEffectFlags) : Bool;
import public final function ResetGameplayEffectFlag(flag : EEntityGamep
layEffectFlags) : Bool;
}
import struct CDismembermentComponent{
import public final function IsWoundDefined(woundName : CName) : Bool;
import public final function SetVisibleWound(woundName : CName, spawnEnt
ity : Bool, createParticles : Bool, dropEquipment : Bool, playSound : Bool, dire
ction : Vector, playEffect : Bool);
import public final function ClearVisibleWound();
import public final function GetVisibleWoundName() : CName;
import public final function CreateWoundParticles(woundName : CName) : B
ool;
import public final function GetNearestWoundName(positionMS : Vector, no
rmalMS : Vector, woundTypeFlags : EWoundTypeFlags) : CName;
import public final function GetNearestWoundNameForBone(boneIndex : Int3
2, normalWS : Vector, woundTypeFlags : EWoundTypeFlags) : CName;
import public final function GetWoundsNames(names : array<CName>, woundT
ypeFlags : EWoundTypeFlags);
import public final function IsExplosionWound(woundName : CName) : Bool;
import public final function IsFrostWound(woundName : CName) : Bool;
import public final function GetMainCurveName(woundName : CName) : CName
;
}
import abstract class CStorySceneFlowCondition{
}
import abstract class SDismembermentWoundSingleSpawn{
}
import abstract class CStorySceneRandomizer{
}
import abstract class CDismembermentWound{
}
import abstract class SDismembermentWoundDecal{
}
import abstract class CEntityDismemberment{
}
class W3ShrineEffectParams extends W3BuffCustomParams{
public var isFromMutagen23 : Bool;
}

import abstract class SDismembermentWoundFilter{


}
import abstract class VoicetagAppearancePair{
}
import abstract class SEntityTemplateColoringEntry{
}
import abstract class CStorySceneVideoSection{
}
import abstract class SEntityTemplateOverride{
}
import abstract class CComponentReference{
}
import abstract class CEntityBodyPartState{
}
import abstract class SVoicesetSlot{
}
import abstract class CEntityBodyPart{
}
class W3MutagenBuffCustomParams extends W3PotionParams{
public var toxicityOffset : Float;
}
import abstract class CEntityAppearance{
}
import abstract class CEntityExternalAppearance{
}
import abstract class SAttachmentReplacement{
}
import abstract class SAttachmentReplacements{
}
import abstract class SStreamedAttachment{
}
import abstract class CBoxComponent{
}
import struct CTriggerAreaComponent{
import public final function
cludedChannes : Int32);
import public final function
ls);
import public final function
nnels);
import public final function
ls);
import public final function
nnels);

SetChannelMask(includedChannels : Int32, ex
AddIncludedChannel(channel : ETriggerChanne
RemoveIncludedChannel(channel : ETriggerCha
AddExcludedChannel(channel : ETriggerChanne
RemoveExcludedChannel(channel : ETriggerCha

public function GetGameplayEntitiesInArea(entities : array<CGameplayEnti


ty>, range : Float, onlyActors : Bool){
var i : Int32;
var curr : Int32;
var size : Int32;
var source : CEntity;
var box : Box;
box = GetBoundingBox();
if (range == 0){
range = GetBoxRange(box);
} else {
range = MinF(range, GetBoxRange(box));
}
source = GetEntity();
if (onlyActors){
FindGameplayEntitiesInRange(entities, source, range, 100
0, /* NOP */, 32 + 2, (CGameplayEntity)source, /* NOP */);
} else {
FindGameplayEntitiesInRange(entities, source, range, 100
0, /* NOP */, 32, (CGameplayEntity)source, /* NOP */);
}
size = entities.Size();
curr = 0;
i = 0;
while (i < size){
if (TestEntityOverlap(entities[i])){
entities[curr] = entities[i];
curr += 1;
}
i += 1;
}
entities.Resize(curr);
/* NOP */;
}
}
import abstract class CTriggerAreaExpansionPackComponent{
}
import abstract class CScenesTableEntry{
}
import struct CTriggerActivatorComponent{
import public final function SetRadius(radius : Float);
import public final function SetHeight(height : Float);
import public final function AddTriggerChannel(channel : ETriggerChannel
s);
import public final function RemoveTriggerChannel(channel : ETriggerChan
nels);
}
import abstract class CSoftTriggerAreaComponent{
}
class W3Effect_WellFed extends W3RegenEffect{
private var level : Int32;
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
var eff : W3Effect_WellFed;
eff = (W3Effect_WellFed)e;

if (eff.level >= level){


return 4;
} else {
return 1;
}
/* NOP */;
}
public function CacheSettings(){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var tmpName : CName;
var customAbilityName : CName;
var type : EEffectType;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
EffectNameToType(tmpName, type, customAbilityName);
if (effectType == type){
if (!dm.GetCustomNodeAttributeValueInt(main.subN
odes[i], 'level', level)){
level = 0;
}
break;
}
i += 1;
}
/* NOP */;
}
}
import struct CSoundAmbientAreaComponent{
}
class W3Effect_WellHydrated extends W3RegenEffect{
private var level : Int32;
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
var eff : W3Effect_WellHydrated;
eff = (W3Effect_WellHydrated)e;
if (eff.level >= level){
return 4;
} else {
return 1;
}
/* NOP */;
}
public function CacheSettings(){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var tmpName : CName;
var customAbilityName : CName;
var type : EEffectType;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();

main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
EffectNameToType(tmpName, type, customAbilityName);
if (effectType == type){
if (!dm.GetCustomNodeAttributeValueInt(main.subN
odes[i], 'level', level)){
level = 0;
}
break;
}
i += 1;
}
/* NOP */;
}
}
import abstract class SReverbDefinition{
}
import abstract class SStorySceneCameraBlendKey{
}
import abstract class SSoundGameParameterValue{
}
import abstract class CCutsceneTemplate{
}
import abstract class CCutsceneInstance{
}
import abstract class SCutsceneActorDef{
}
import abstract class ICutsceneModifier{
}
import abstract class CCutsceneModifierFreezer{
}
import abstract class CBgCutsceneEntity{
}
import abstract class CAllocatedBehaviorGraphOutput{
}
import abstract class CAllocatedLipsyncBehaviorGraphOutput{
}
import abstract class CBehaviorGraph{
}
import abstract class CBehaviorGraphInstance{
}
import abstract class SBehaviorSnapshotDataStateMachine{
}

import abstract class CBehaviorGraphInstanceSnapshot{


}
import abstract class SBehaviorGraphInstanceSlot{
}
import abstract class CBehaviorGraphStack{
}
import abstract class CBehaviorGraphStackSnapshot{
}
import abstract class CBehaviorNodeSyncData{
}
import abstract class CBehaviorGraphNode{
}
import abstract class CBehaviorGraphContainerNode{
}
import abstract class CBehaviorGraph2DVariableNode{
}
import abstract class CBehaviorGraph2DVectorVariableNode{
}
import abstract class CBehaviorGraph2DMultiVariablesNode{
}
import abstract class CBehaviorGraphStageNode{
}
class W3Effect_DoTHPRegenReduce extends CBaseGameplayEffect{
public function GetEffectValue() : SAbilityAttributeValue{
return effectValue;
/* NOP */;
}
}
import abstract class CBehaviorGraphBaseNode{
}
import abstract class CBehaviorGraphValueBaseNode{
}
import abstract class CAnimationSyncToken{
}
import abstract class CBehaviorGraphAnimationExtNode{
}
import abstract class CBehaviorGraphAnimationSwitchNode{
}
import abstract class CBehaviorGraphAnimationManualSwitchNode{
}
import abstract class CBehaviorGraphAnimationEnumSwitchNode{

}
import abstract class CBehaviorGraphAnimationEnumSequentialSwitchNode{
}
import abstract class CBehaviorGraphAnimationRandomSwitchNode{
}
import abstract class CBehaviorGraphAnimationBaseSlotNode{
}
import abstract class CBehaviorGraphMimicBaseSlotNode{
}
import abstract class CBehaviorGraphAnimationSlotNode{
}
import abstract class CBehaviorGraphMimicSlotNode{
}
import abstract class CBehaviorGraphMimicEventSlotNode{
}
import abstract class CBehaviorGraphBaseMimicNode{
}
class CEncounterDataManager extends IScriptable{
public editable var resetOnFullRespawn : Bool;
public editable inlined saved var disabledCreaturesGroups : array<Creatu
resGroupDef>;
private saved var killedCreatures : Int32;
private saved var currentlySpawnedCreatures : Int32;
private saved var spawnedCreatures : Int32;
private saved var lostCreatures : Int32;
private saved var killedCreaturesByEntry : array<CreatureCounterDef>;
private saved var currentlySpawnedCreaturesByEntry : array<CreatureCount
erDef>;
private saved var spawnedCreaturesByEntry : array<CreatureCounterDef>;
private saved var lostCreaturesByEntry : array<CreatureCounterDef>;
private saved var disbledMonitors : array<ISpawnTreeSpawnMonitorInitiali
zer>;
public var ownerTasksToPerform : array<SOwnerEncounterTaskParams>;
public var externalTasksToPerform : array<SExternalEncounterTaskParams>;
public function ProcessFullRespawn(){
if (resetOnFullRespawn){
ResetData();
}
/* NOP */;
}
private function ResetData(){
killedCreatures = 0;
currentlySpawnedCreatures = 0;
spawnedCreatures = 0;
lostCreatures = 0;
killedCreaturesByEntry.Clear();
currentlySpawnedCreaturesByEntry.Clear();
spawnedCreaturesByEntry.Clear();
lostCreaturesByEntry.Clear();
disbledMonitors.Clear();
/* NOP */;

}
public function DisableMonitor(monitor : ISpawnTreeSpawnMonitorInitializ
er){
disbledMonitors.PushBack(monitor);
/* NOP */;
}
public function IsMonitorEnabled(monitor : ISpawnTreeSpawnMonitorInitial
izer) : Bool{
var i : Int32;
i = 0;
while (i < disbledMonitors.Size()){
if (monitor == disbledMonitors[i]){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public function AddOwnerTask(_task : SOwnerEncounterTaskParams){
_task.setTime = theGame.GetGameTime();
ownerTasksToPerform.PushBack(_task);
/* NOP */;
}
public function AddExternalTask(_task : SExternalEncounterTaskParams){
_task.setTime = theGame.GetGameTime();
externalTasksToPerform.PushBack(_task);
/* NOP */;
}
public function RemoveOwnerTask(_task : SOwnerEncounterTaskParams){
ownerTasksToPerform.Remove(_task);
/* NOP */;
}
public function RemoveExternalTask(_task : SExternalEncounterTaskParams)
{
externalTasksToPerform.Remove(_task);
/* NOP */;
}
public function SetOwnerTaskUniqueId(_task : SOwnerEncounterTaskParams){
var i : Int32;
var ID : Int32;
i = 0;
while (i < ownerTasksToPerform.Size()){
if (ownerTasksToPerform[i].ID == ID){
ID += 1;
}
i += 1;
}
_task.ID = ID;
/* NOP */;
}
public function SetExternalTaskUniqueId(_task : SExternalEncounterTaskPa
rams){
var i : Int32;
var ID : Int32;
i = 0;
while (i < externalTasksToPerform.Size()){
if (externalTasksToPerform[i].ID == ID){
ID += 1;
}

i += 1;
}
_task.ID = ID;
/* NOP */;
}
public function GetOwnerTaskByID(_id : Int32, task : SOwnerEncounterTask
Params) : Bool{
var i : Int32;
i = 0;
while (i < ownerTasksToPerform.Size()){
if (ownerTasksToPerform[i].ID == _id){
task = ownerTasksToPerform[i];
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetExternalTaskByID(_id : Int32, task : SExternalEncount
erTaskParams) : Bool{
var i : Int32;
i = 0;
while (i < externalTasksToPerform.Size()){
if (externalTasksToPerform[i].ID == _id){
task = externalTasksToPerform[i];
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function DisableCreaturesGroup(groupName : CName, sourceName : CN
ame){
var i : Int32;
var k : Int32;
var creaturesGroupEntry : CreaturesGroupDef;
i = 0;
while (i < disabledCreaturesGroups.Size()){
if (disabledCreaturesGroups[i].groupName == groupName){
if (sourceName != 'None'){
k = 0;
while (k < disabledCreaturesGroups[i].so
urcesNames.Size()){
if (disabledCreaturesGroups[i].s
ourcesNames[k] == sourceName){
return;
}
k += 1;
}
disabledCreaturesGroups[i].sourcesNames.
PushBack(sourceName);
} else {
disabledCreaturesGroups[i].disabledBySou
rces += 1;
}
return;
}
i += 1;

}
creaturesGroupEntry = InitCreaturesGroupEntry(groupName);
if (sourceName != 'None'){
creaturesGroupEntry.sourcesNames.PushBack(sourceName);
} else {
creaturesGroupEntry.disabledBySources += 1;
}
disabledCreaturesGroups.PushBack(creaturesGroupEntry);
/* NOP */;
}
public function EnableCreaturesGroup(groupName : CName, sourceName : CNa
me){
var i : Int32;
var k : Int32;
i = 0;
while (i < disabledCreaturesGroups.Size()){
if (disabledCreaturesGroups[i].groupName == groupName){
if (sourceName != 'None'){
k = 0;
while (k < disabledCreaturesGroups[i].so
urcesNames.Size()){
if (disabledCreaturesGroups[i].s
ourcesNames[k] == sourceName){
disabledCreaturesGroups[
i].sourcesNames.Remove(disabledCreaturesGroups[i].sourcesNames[k]);
}
k += 1;
}
} else if (disabledCreaturesGroups[i].disabledBy
Sources > 0){
disabledCreaturesGroups[i].disabledBySou
rces -= 1;
}
if (disabledCreaturesGroups[i].disabledBySources
<= 0 && disabledCreaturesGroups[i].sourcesNames.Size() <= 0){
disabledCreaturesGroups.Remove(disabledC
reaturesGroups[i]);
}
return;
}
i += 1;
}
/* NOP */;
}
private function InitCreaturesGroupEntry(groupName : CName) : CreaturesG
roupDef{
var creaturesGroupEntry : CreaturesGroupDef;
creaturesGroupEntry.groupName = groupName;
return creaturesGroupEntry;
/* NOP */;
}
public function GetDisabledCreaturesGroupSourcesAmount(groupName : CName
) : Int32{
var i : Int32;
i = 0;
while (i < disabledCreaturesGroups.Size()){
if (disabledCreaturesGroups[i].groupName == groupName){
return disabledCreaturesGroups[i].disabledBySour
ces;
}

i += 1;
}
return 0;
/* NOP */;
}
public function IsCreatureGroupDisableByAnySource(groupName : CName) : B
ool{
var i : Int32;
i = 0;
while (i < disabledCreaturesGroups.Size()){
if (disabledCreaturesGroups[i].groupName == groupName){
if (disabledCreaturesGroups[i].sourcesNames.Size
() > 0){
return true;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function AddLostCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < lostCreaturesByEntry.Size()){
if (lostCreaturesByEntry[i].entryName == entryName){
lostCreaturesByEntry[i].creatureAmount += 1;
return;
}
i += 1;
}
creatureEntry = InitCreatureCounterEntry(entryName);
creatureEntry.creatureAmount += 1;
lostCreaturesByEntry.PushBack(creatureEntry);
/* NOP */;
}
public function RemoveLostCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < lostCreaturesByEntry.Size()){
if (lostCreaturesByEntry[i].entryName == entryName){
if (lostCreaturesByEntry[i].creatureAmount > 0){
lostCreaturesByEntry[i].creatureAmount = 1;
}
return;
}
i += 1;
}
/* NOP */;
}
public function GetLostCreaturesByEntry(entryName : CName) : Int32{
var i : Int32;
i = 0;
while (i < lostCreaturesByEntry.Size()){
if (lostCreaturesByEntry[i].entryName == entryName){
return lostCreaturesByEntry[i].creatureAmount;
}

i += 1;
}
return 0;
/* NOP */;
}
public function AddKilledCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < killedCreaturesByEntry.Size()){
if (killedCreaturesByEntry[i].entryName == entryName){
killedCreaturesByEntry[i].creatureAmount += 1;
return;
}
i += 1;
}
creatureEntry = InitCreatureCounterEntry(entryName);
creatureEntry.creatureAmount += 1;
killedCreaturesByEntry.PushBack(creatureEntry);
/* NOP */;
}
public function AddSpawnedCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < spawnedCreaturesByEntry.Size()){
if (spawnedCreaturesByEntry[i].entryName == entryName){
spawnedCreaturesByEntry[i].creatureAmount += 1;
return;
}
i += 1;
}
creatureEntry = InitCreatureCounterEntry(entryName);
creatureEntry.creatureAmount += 1;
spawnedCreaturesByEntry.PushBack(creatureEntry);
/* NOP */;
}
public function RemoveSpawnedCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < spawnedCreaturesByEntry.Size()){
if (spawnedCreaturesByEntry[i].entryName == entryName){
if (spawnedCreaturesByEntry[i].creatureAmount >
0){
spawnedCreaturesByEntry[i].creatureAmoun
t -= 1;
}
return;
}
i += 1;
}
/* NOP */;
}
public function SetCurrentlySpawnedCreatureByEntry(entryName : CName, sp
awnedValue : Int32){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < currentlySpawnedCreaturesByEntry.Size()){

if (currentlySpawnedCreaturesByEntry[i].entryName == ent
ryName){
currentlySpawnedCreaturesByEntry[i].creatureAmou
nt = spawnedValue;
return;
}
i += 1;
}
creatureEntry = InitCreatureCounterEntry(entryName);
creatureEntry.creatureAmount = spawnedValue;
currentlySpawnedCreaturesByEntry.PushBack(creatureEntry);
/* NOP */;
}
public function AddCurrentlySpawnedCreatureByEntry(entryName : CName){
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < currentlySpawnedCreaturesByEntry.Size()){
if (currentlySpawnedCreaturesByEntry[i].entryName == ent
ryName){
currentlySpawnedCreaturesByEntry[i].creatureAmou
nt += 1;
return;
}
i += 1;
}
creatureEntry = InitCreatureCounterEntry(entryName);
creatureEntry.creatureAmount += 1;
currentlySpawnedCreaturesByEntry.PushBack(creatureEntry);
/* NOP */;
}
public function RemoveCurrentlySpawnedCreatureByEntry(entryName : CName)
{
var i : Int32;
var creatureEntry : CreatureCounterDef;
i = 0;
while (i < currentlySpawnedCreaturesByEntry.Size()){
if (currentlySpawnedCreaturesByEntry[i].entryName == ent
ryName){
if (currentlySpawnedCreaturesByEntry[i].creature
Amount > 0){
currentlySpawnedCreaturesByEntry[i].crea
tureAmount -= 1;
}
return;
}
i += 1;
}
/* NOP */;
}
public function GetKilledCreaturesByEntry(entryName : CName) : Int32{
var i : Int32;
i = 0;
while (i < killedCreaturesByEntry.Size()){
if (killedCreaturesByEntry[i].entryName == entryName){
return killedCreaturesByEntry[i].creatureAmount;
}
i += 1;
}
return 0;

/* NOP */;
}
public function GetCurrentlySpawnedCreaturesByEntry(entryName : CName) :
Int32{
var i : Int32;
i = 0;
while (i < currentlySpawnedCreaturesByEntry.Size()){
if (currentlySpawnedCreaturesByEntry[i].entryName == ent
ryName){
return currentlySpawnedCreaturesByEntry[i].creat
ureAmount;
}
i += 1;
}
return 0;
/* NOP */;
}
public function GetSpawnedCreaturesByEntry(entryName : CName) : Int32{
var i : Int32;
i = 0;
while (i < spawnedCreaturesByEntry.Size()){
if (spawnedCreaturesByEntry[i].entryName == entryName){
return spawnedCreaturesByEntry[i].creatureAmount
;
}
i += 1;
}
return 0;
/* NOP */;
}
private function InitCreatureCounterEntry(entryName : CName) : CreatureC
ounterDef{
var creatureEntry : CreatureCounterDef;
creatureEntry.entryName = entryName;
return creatureEntry;
/* NOP */;
}
public function AddKilledCreature(){
killedCreatures += 1;
/* NOP */;
}
public function AddSpawnedCreature(){
spawnedCreatures += 1;
/* NOP */;
}
public function RemoveSpawnedCreature(){
if (spawnedCreatures > 0){
spawnedCreatures -= 1;
}
/* NOP */;
}
public function GetKilledCreatures() : Int32{
return killedCreatures;
/* NOP */;
}
public function GetCurrentlySpawnedCreatures() : Int32{
return currentlySpawnedCreatures;
/* NOP */;
}
public function GetSpawnedCreatures() : Int32{

return spawnedCreatures;
/* NOP */;
}
public function SetCurrentlySpawnedCreaturesAmount(spawnedValue : Int32)
{
currentlySpawnedCreatures = spawnedValue;
/* NOP */;
}
}
import abstract class CBehaviorGraphMimicLipsyncFilterNode{
}
import abstract class CBehaviorGraphAnimationSlotWithCurveNode{
}
struct SOwnerEncounterTaskParams{
editable var triggerWhenOutsideOwnerEncounterArea : Bool;
editable var deactivateEncounter : Bool;
editable inlined var delay : GameTimeWrapper;
editable var factOnTaskPerformed : String;
editable var spawnTreeNodesToActivate : array<CName>;
editable var spawnTreeNodesToDeactivate : array<CName>;
editable var encounterPhasetoActivate : CName;
editable var creaturesGroupToDisable : array<CName>;
editable var creaturesGroupToEnable : array<CName>;
editable var sourceName : CName;
editable var forceDespawn : Bool;
var ID : Int32;
var setTime : GameTime;
}
import abstract class CBehaviorGraphMimicSlotWithCurveNode{
}
import abstract class CBehaviorGraphMimicSlotWithSwapingNode{
}
struct SExternalEncounterTaskParams{
editable var triggerWhenOutsideOwnerEncounterArea : Bool;
editable var shouldEncounterChangeState : Bool;
editable var enableEncounter : Bool;
editable var encounterTag : CName;
editable inlined var delay : GameTimeWrapper;
editable var factOnTaskPerformed : String;
editable var spawnTreeNodesToActivate : array<CName>;
editable var spawnTreeNodesToDeactivate : array<CName>;
editable var creaturesGroupToDisable : array<CName>;
editable var creaturesGroupToEnable : array<CName>;
editable var sourceName : CName;
editable var forceDespawn : Bool;
editable var encounterPhasetoActivate : CName;
var ID : Int32;
var setTime : GameTime;
}
import abstract class CBehaviorGraphAnimationAdditiveSlotNode{
}
import abstract class CBehaviorGraphAnimationSelAdditiveSlotNode{

}
import abstract class CBehaviorGraphMimicAdditiveSlotNode{
}
import abstract class CBehaviorGraphAnimationLipsyncSlotNode{
}
import abstract class CBehaviorGraphMimicsAnimationNode{
}
import abstract class CBehaviorGraphMimicsEventAnimationNode{
}
import abstract class CBehaviorGraphMimicsBoneAnimationNode{
}
import abstract class CBehaviorGraphMimicsGeneratorNode{
}
import abstract class IBehaviorMimicConstraint{
}
import abstract class CBehaviorMimicLookAtConstraint{
}
import abstract class CBehaviorMimicHeadConstraint{
}
import abstract class CBehaviorMimiLipsyncCorrectionConstraint{
}
import abstract class CBehaviorGraphMimicsConverterNode{
}
import abstract class CBehaviorMimicCloseEyesConstraint{
}
import abstract class CBehaviorGraphMimicsBoneConverterNode{
}
import abstract class CBehaviorGraphMimicsBlendNode{
}
import abstract class CBehaviorGraphMimicGainNode{
}
import abstract class CBehaviorGraphMimicMathOpNode{
}
import abstract class CBehaviorGraphMimicFilterNode{
}
import abstract class CBehaviorGraphMimicFilterNodeInvert{
}
import abstract class CBehaviorGraphMimicOutputNode{
}
import abstract class CBehaviorGraphMimicStageNode{

}
struct CreaturesGroupDef{
editable var groupName : CName;
var disabledBySources : Int32;
editable var sourcesNames : array<CName>;
}
import abstract class CBehaviorGraphMimicParentInputNode{
}
import abstract class CBehaviorGraphMimicAnimationManualSwitchNode{
}
import abstract class CBehaviorGraphMimicAnimationEnumSwitchNode{
}
import abstract class CBehaviorGraphPoseSlotNode{
}
struct CreatureCounterDef{
var entryName : CName;
var creatureAmount : Int32;
}
import abstract class IBehaviorSyncMethod{
}
import abstract class CBehaviorSyncMethodNone{
}
import abstract class IBehaviorSyncMethodEvent{
}
import abstract class CBehaviorSyncMethodEventStart{
}
import abstract class CBehaviorSyncMethodEventProp{
}
import struct ISpawnTreeSpawnMonitorInitializer{
import public final function GetNumCreaturesSpawned() : Int32;
import public final function GetNumCreaturesToSpawn() : Int32;
import public final function GetNumCreaturesDead() : Int32;
public function MonitorCreatureSpawned(actor : CActor, spawnTreeEntry :
CBaseCreatureEntry, encounter : CEncounter){
}
public function MonitorCreatureLost(actor : CActor, spawnTreeEntry : CBa
seCreatureEntry, encounter : CEncounter){
}
public function MonitorCreatureKilled(actor : CActor, spawnTreeEntry : C
BaseCreatureEntry, encounter : CEncounter){
}
public function GetFriendlyName() : String{
return "Monitor";
/* NOP */;
}
}
import abstract class CBehaviorSyncMethodTime{

}
import abstract class CBehaviorSyncMethodDuration{
}
import abstract class CBehaviorSyncMethodOffset{
}
import abstract class CBehaviorSyncMethodProp{
}
import abstract class CBehaviorSyncMethodSyncPoints{
}
import abstract class CBehaviorSyncMethodSyncPointsStartOnly{
}
import abstract class CBehaviorGraphBlendNode{
}
import abstract class CBehaviorGraphBlend3Node{
}
import abstract class CBehaviorGraphBlendAdditiveNode{
}
class CAIIdleRedefinitionParameters extends CAIRedefinitionParameters{
public editable inlined var idleTree : CAIIdleTree;
}
import abstract class CBehaviorGraphBlendMultipleNode{
}
class CAIRiderIdleRedefinitionParameters extends CAIRedefinitionParameters{
public editable inlined var riderIdleTree : CAIRiderIdle;
public function Init(){
riderIdleTree = new CAINpcIdleHorseRider in this;
riderIdleTree.OnCreated();
/* NOP */;
}
}
import abstract class CBehaviorGraphBlendOverrideNode{
}
class CAIFlightIdleRedefinitionParameters extends CAIRedefinitionParameters{
public editable inlined var freeFlight : IAIFlightIdleTree;
}
import abstract class CBehaviorGraphBlockEventNode{
}
class CAIStartingBehaviorParameters extends CAIRedefinitionParameters{
public editable inlined var startingBehavior : IAIActionTree;
public editable var startingBehaviorPriority : Int32;
public function SetPriority(p : Int32){
startingBehaviorPriority = p;
/* NOP */;
}
}

import abstract class CBehaviorGraphSyncOverrideNode{


}
class CAIRiderStartingBehaviorParameters extends CAIRedefinitionParameters{
public editable inlined var startingBehavior : IRiderActionTree;
public editable var startingBehaviorPriority : Int32;
public function SetPriority(p : Int32){
startingBehaviorPriority = p;
/* NOP */;
}
}
import abstract class CBehaviorGraphJoinNode{
}
class CBridgePiece extends CScriptedDestroyableComponent{
public var entityPos : Vector;
public var compPos : Vector;
public var totalTime : Float;
public var z : CEntity;
public final function IdleTick(time : Float){
totalTime = 0;
/* NOP */;
}
public final function PreDestroyTick(time : Float){
totalTime += time;
entityPos = GetEntity().GetWorldPosition();
compPos = GetWorldPosition() - entityPos;
SetPosition(Vector(compPos.X, compPos.Y, SinF(totalTime * 5) * 0
.100000));
if (totalTime < GetContactDestroyDelayValue()){
return;
}
if (totalTime > GetDestroyTimeDurationValue()){
m_state = 2;
totalTime = 0;
}
/* NOP */;
}
public final function DestroyTick(time : Float){
totalTime += time;
m_state = 3;
/* NOP */;
}
public final function PostDestroyTick(time : Float){
}
}
import abstract class CBehaviorGraphInjectorNode{
}
class W3SpawnEntityOnAnimEvent extends CScriptedComponent{
public editable var animEvent : CName;
public editable var entityName : CName;
private var entityTemplate : CEntityTemplate;
public function OnComponentAttached() : Bool{
var l_actor : CActor;
l_actor = (CActor)GetEntity();
if (l_actor){

l_actor.AddAnimEventChildCallback(this, animEvent, 'OnAn


imEvent_Custom');
}
entityTemplate = (CEntityTemplate)LoadResource(entityName, /* NO
P */);
/* NOP */;
}
public function OnAnimEvent_Custom(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SpawnEntity();
/* NOP */;
}
public function SpawnEntity(){
var spawnPos : Vector;
var entity : CEntity;
var damageAreaEntity : CDamageAreaEntity;
if (!entityTemplate){
return;
}
spawnPos = GetEntity().GetWorldPosition();
entity = theGame.CreateEntity(entityTemplate, spawnPos, GetEntit
y().GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
damageAreaEntity = (CDamageAreaEntity)entity;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)GetEntity();
}
/* NOP */;
}
}
import abstract class CBehaviorGraphMotionExBlendNode{
}
class W3WindEffectOnGroundComponent extends CSelfUpdatingComponent{
public editable var maxDistanceFromGround : Float;
public editable var activeAtStart : Bool;
public editable var playOnAnimEvent : Bool;
public editable var activateOnAnimEvent : Bool;
public editable var animEvent : CName;
public editable var deactivateAnimEvent : CName;
public editable var delayBetweenEffects : Float;
public editable var effectTemplate : CEntityTemplate;
private var m_isActive : Bool;
private var m_effectEntity : CEntity;
private var m_collisionGroupNames : array<CName>;
private var m_delayUntilNextEffect : Float;
public function OnComponentAttached() : Bool{
var l_actor : CActor;
m_collisionGroupNames.PushBack('Terrain');
m_collisionGroupNames.PushBack('Foliage');
m_collisionGroupNames.PushBack('Boat');
m_collisionGroupNames.PushBack('Platfmors');
m_collisionGroupNames.PushBack('Static');
l_actor = (CActor)GetEntity();
if (l_actor && playOnAnimEvent || activateOnAnimEvent){
l_actor.AddAnimEventChildCallback(this, animEvent, 'OnAn
imEvent_Custom');
l_actor.AddAnimEventChildCallback(this, deactivateAnimEv
ent, 'OnAnimEvent_Custom');
}

StartTicking();
m_isActive = false;
if (activeAtStart){
Activate();
}
/* NOP */;
}
public function OnAnimEvent_Custom(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == animEvent){
PlayEffect();
if (activateOnAnimEvent){
Activate();
}
} else if (animEventName == deactivateAnimEvent){
Deactivate();
}
/* NOP */;
}
public function OnComponentTick(_Dt : Float) : Bool{
m_delayUntilNextEffect -= _Dt;
if (m_isActive){
PlayEffect();
}
/* NOP */;
}
public function Activate(){
m_isActive = true;
StartTicking();
/* NOP */;
}
public function Deactivate(){
m_isActive = false;
m_effectEntity.StopAllEffects();
m_delayUntilNextEffect = 0;
/* NOP */;
}
private function PlayEffect(){
var l_pos : Vector;
var l_contact : Vector;
var l_normal : Vector;
var l_waterLevel : Float;
var l_distanceFromWater : Float;
var l_distanceFromGround : Float;
var l_actor : CActor;
if (m_delayUntilNextEffect > 0){
return;
}
l_actor = (CActor)GetEntity();
l_pos = l_actor.GetWorldPosition();
l_waterLevel = theGame.GetWorld().GetWaterLevel(l_pos, /* NOP */
);
l_distanceFromWater = l_pos.Z - l_waterLevel;
l_distanceFromGround = l_actor.GetDistanceFromGround(maxDistance
FromGround, /* NOP */);
if (l_distanceFromGround >= maxDistanceFromGround && l_distanceF
romWater >= maxDistanceFromGround){
return;
}
if (!m_effectEntity){

m_effectEntity = theGame.CreateEntity(effectTemplate, Ve
ctor(0, 0, 0), GetEntity().GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
}
l_contact = l_pos;
if (l_distanceFromWater < l_distanceFromGround){
l_contact.Z -= l_distanceFromWater;
m_effectEntity.Teleport(l_contact);
m_effectEntity.PlayEffect('water', /* NOP */);
} else {
l_contact.Z -= l_distanceFromGround;
m_effectEntity.Teleport(l_contact);
m_effectEntity.PlayEffect('ground', /* NOP */);
}
m_delayUntilNextEffect = delayBetweenEffects;
/* NOP */;
}
}
import abstract class CBehaviorGraphMotionExValueNode{
}
import abstract class CBehaviorGraphMotionRotChangeValueNode{
}
class CAIMultiRedefinitionParameters extends CAIRedefinitionParameters{
public editable inlined var subParams : array<CAIRedefinitionParameters>
;
}
import abstract class CBehaviorGraphOutputNode{
}
import abstract class CBehaviorGraphOverrideFloatTracksNode{
}
class CAICommunityRedefinitionParameters extends CAIIdleRedefinitionParameters{
public editable var useDefaultIdleBehaviors : Bool;
public editable var canFlyInIdle : Bool;
}
import abstract class CBehaviorGraphVariableBaseNode{
}
import abstract class CBehaviorGraphVariableNode{
}
class CAICombatDecoratorRedefinitionParameters extends CAIRedefinitionParameters
{
public editable inlined var combatDecorator : CAICombatDecoratorTree;
}
import abstract class CBehaviorGraphInternalVariableNode{
}
import abstract class CBehaviorGraphSetInternalVariableFloatInOutNode{
}
class CAINpcWorkIdle extends CAIIdleTree{
public editable inlined var actionPointSelector : CActionPointSelector;

public editable var actionPointMoveType : EMoveType;


public var params : CAINpcWorkIdleParams;
public function Init(){
var selector : CSimpleActionPointSelector;
selector = new CSimpleActionPointSelector in this;
actionPointSelector = selector;
/* NOP */;
}
}
import abstract class CBehaviorGraphSetInternalVariableNode{
}
import struct CSpawnTreeInitializerActionpointSpawner{
//NULL type for spawner
}
import abstract class CBehaviorGraphInternalVariableCounterNode{
}
import abstract class CBehaviorGraphEventWatchdogNode{
}
class W3OnSpawnPortal extends CEntity{
public editable var fxName : CName;
public editable var fxTimeout : Float;
public editable var creatureAppearAfter : Float;
private var spawnedActor : CActor;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
PlayEffect(fxName, this);
AddTimer('StopFxTimer', fxTimeout, false, /* NOP */, /* NOP */,
true, /* NOP */);
/* NOP */;
}
public function HideCreature(_actor : CActor){
spawnedActor = _actor;
SetVisibility(spawnedActor, false);
AddTimer('ShowCreatureTimer', creatureAppearAfter, false, /* NOP
*/, /* NOP */, true, /* NOP */);
/* NOP */;
}
public function SetFxTimeout(_timeout : Float){
fxTimeout = _timeout;
/* NOP */;
}
public function SetFxName(_fxName : CName){
fxName = _fxName;
/* NOP */;
}
public timer function StopFxTimer(optional _timeDelta : Float, optional
id : Int32){
StopEffect(fxName);
AddTimer('DestroyPortalTimer', 3.500000 + creatureAppearAfter, f
alse, /* NOP */, /* NOP */, true, /* NOP */);
/* NOP */;
}
public timer function DestroyPortalTimer(optional _timeDelta : Float, op
tional id : Int32){
Destroy();
/* NOP */;

}
public timer function ShowCreatureTimer(optional _timeDelta : Float, opt
ional id : Int32){
SetVisibility(spawnedActor, true);
/* NOP */;
}
private function SetVisibility(_actor : CActor, _isVisible : Bool){
_actor.SetVisibility(_isVisible);
/* NOP */;
}
}
import abstract class CBehaviorGraphVectorValueBaseNode{
}
import abstract class CBehaviorGraphVectorVariableNode{
}
import abstract class CBehaviorGraphInternalVectorVariableNode{
}
import abstract class CBehaviorGraphConstantVectorValueNode{
}
import abstract class CBehaviorGraphVectorMathNode{
}
import abstract class CBehaviorGraphVectorVariableInputSocket{
}
import abstract class SR4LootNameProperty{
//NULL type for lootName
}
import abstract class CBehaviorGraphVectorVariableOutputSocket{
}
import abstract class CBehaviorGraphParentInputNode{
}
import abstract class CBehaviorGraphParentValueInputNode{
}
import abstract class CBehaviorGraphParentVectorValueInputNode{
}
class CExplorationStateInvalid extends CExplorationStateAbstract{
private function InitializeSpecific(_Exploration : CExplorationStateMana
ger){
m_ExplorationO = _Exploration;
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'Invalid';
}
m_StateTypeE = 1;
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
}
public function StateWantsToEnter() : Bool{
return false;

/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
return true;
/* NOP */;
}
private function StateEnterSpecific(prevStateName : CName){
thePlayer.AbortSign();
/* NOP */;
}
public function StateChangePrecheck() : CName{
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
}
private function StateExitSpecific(nextStateName : CName){
}
public function CanInteract() : Bool{
return true;
/* NOP */;
}
}
struct SItemExt{
editable var itemName : SItemNameProperty;
editable var quantity : Int32;
}
import abstract class CBehaviorGraphAnimationInputSocket{
}
import abstract class CBehaviorGraphExactlyAnimationInputSocket{
}
import abstract class CBehaviorGraphAnimationOutputSocket{
}
import abstract class CBehaviorGraphVariableInputSocket{
}
import abstract class CBehaviorGraphVariableOutputSocket{
}
import abstract class CBehaviorGraphStateInSocket{
}
import abstract class CBehaviorGraphStateOutSocket{
}
import abstract class CBaseCreatureEntry{
//NULL type for quantityMin
//NULL type for quantityMax
//NULL type for baseSpawner
//NULL type for group
}
import abstract class CBehaviorGraphTransitionSocket{
}

import abstract class CBehaviorGraphMimicAnimationInputSocket{


}
import abstract class CBehaviorGraphMimicAnimationOutputSocket{
}
import abstract class CBehaviorGraphCharacterRotationNode{
}
import abstract class CBehaviorGraphAdjustDirectionNode{
}
import abstract class CStorySceneLine{
}
import abstract class CBehaviorGraphTopLevelNode{
}
import abstract class CBehaviorGraphDampValueNode{
}
statemachine class CMonsterNestEntity extends CInteractiveEntity{
public editable var bombActivators : array<CName>;
public editable var lootOnNestDestroyed : CEntityTemplate;
public editable var interactionOnly : Bool;
public editable var desiredPlayerToEntityDistance : Float;
public editable var matchPlayerHeadingWithHeadingOfTheEntity : Bool;
public editable var settingExplosivesTime : Float;
public editable var shouldPlayFXOnExplosion : Bool;
public editable var appearanceChangeDelayAfterExplosion : Float;
public editable var shouldDealDamageOnExplosion : Bool;
public editable var factSetAfterFindingNest : String;
public editable var factSetAfterSuccessfulDestruction : String;
public editable var linkingMode : Bool;
public editable var linkedEncounterHandle : EntityHandle;
public editable var linkedEncounterTag : CName;
public editable var setDestructionFactImmediately : Bool;
public editable var expOnNestDestroyed : Int32;
public editable var bonusExpOnBossKilled : Int32;
public editable var addExpOnlyOnce : Bool;
public editable saved var nestUpdateDefintion : SMonsterNestUpdateDefini
tion;
public editable var monsterNestType : ENestType;
public var explodeAfter : Float;
public var nestBurnedAfter : Float;
public var playerInventory : CInventoryComponent;
public var usedBomb : SItemUniqueId;
public var encounter : CEncounter;
public saved var nestFound : Bool;
public var messageTimestamp : Float;
public var bossKilled : Bool;
public var container : W3Container;
public var bossKilledCounter : Int32;
public saved var expWasAdded : Bool;
public var bombEntity : CEntity;
public var bombEntityTemplate : CEntityTemplate;
public var bombName : CName;
public var actionBlockingExceptions : array<EInputActionBlock>;
public var saveLockIdx : Int32;
public saved var voicesetTime : GameTime;

public saved var voicesetTry : GameTime;


public saved var voicesetPlayed : Bool;
public saved var canPlayVset : Bool;
public var airDmg : Bool;
public autobind interactionComponent : CInteractionComponent = "CInterac
tionComponent0";
public saved var wasExploded : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (spawnData.restored){
SetMappinOnLoad();
if (wasExploded){
SetFocusModeVisibility(0, /* NOP */);
if (IsBossProtectingNest()){
ApplyAppearance('nest_destroyed');
GotoState('NestDestroyedBoss', /* NOP */
, /* NOP */);
} else {
ApplyAppearance('nest_destroyed');
GotoState('NestDestroyed', /* NOP */, /*
NOP */);
}
} else {
SetFocusModeVisibility(1, /* NOP */);
GotoStateAuto();
}
} else {
GotoStateAuto();
SetFocusModeVisibility(1, /* NOP */);
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
if (!interactionOnly && !wasExploded){
GetEncounter();
wasExploded = true;
interactionComponent.SetEnabled(false);
airDmg = false;
GotoState('Explosion', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
if (!interactionOnly && !wasExploded){
GetEncounter();
wasExploded = true;
interactionComponent.SetEnabled(false);
airDmg = true;
GotoState('Explosion', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
if (!wasExploded && !interactionComponent.IsEnabled() && interac
tionComponent){

interactionComponent.SetEnabled(true);
}
if (!nestFound){
if (interactionComponentName != "triggerQuestArea"){
return false;
}
FactsAdd(factSetAfterFindingNest, 1, /* NOP */);
commonMapManager.SetEntityMapPinDiscoveredScript(false,
entityName, true);
nestFound = true;
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator != thePlayer || !thePlayer.CanPerformPlayerAction(
/* NOP */)){
return false;
}
if (interactionComponent && wasExploded && interactionComponent.
IsEnabled()){
interactionComponent.SetEnabled(false);
}
if (PlayerHasBombActivator()){
if (interactionComponent && interactionComponent.IsEnabl
ed()){
theGame.CreateNoSaveLock('nestSettingExplosives'
, saveLockIdx, /* NOP */, /* NOP */);
wasExploded = true;
GetEncounter();
interactionComponent.SetEnabled(false);
GotoState('SettingExplosives', /* NOP */, /* NOP
*/);
}
return true;
} else {
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_destroy_nest_bomb_lacking"));
messageTimestamp = theGame.GetEngineTimeAsSeconds();
}
return false;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (area == (CTriggerAreaComponent)GetComponent("VoiceSetTrigger
") && CanPlayVoiceSet()){
if (!voicesetPlayed || theGame.GetGameTime() > voicesetT
ime + GameTimeCreate(0, 0, 5, 0)){
thePlayer.PlayVoiceset(90, GetVoicesetName(monst
erNestType), /* NOP */);
voicesetTime = theGame.GetGameTime();
voicesetPlayed = true;
}
}
/* NOP */;
}
public function CanPlayVoiceSet() : Bool{
return !thePlayer.IsSpeaking(/* NOP */) && !thePlayer.IsInNonGam
eplayCutscene() && !thePlayer.IsCombatMusicEnabled() && canPlayVset && !wasExplo

ded;
/* NOP */;
}
public function GetVoicesetName(val : ENestType) : CName{
switch(val){
case 0:
return 'MonsterNestDrowners';
case 1:
return 'MonsterNestDraconids';
case 2:
return 'MonsterNestEndriags';
case 3:
return 'MonsterNestGhuls';
case 4:
return 'MonsterNestHarpies';
case 5:
return 'MonsterNestNekkers';
case 6:
return 'MonsterNestRorfiends';
case 7:
return 'MonsterNestSirens';
case 8:
return 'MonsterNestWiwerns';
default:
}
return 'None';
/* NOP */;
}
private function SetMappinOnLoad(){
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
if (wasExploded || expWasAdded){
commonMapManager.SetEntityMapPinDisabled(entityName, tru
e);
} else if (nestFound){
commonMapManager.SetEntityMapPinDiscoveredScript(false,
entityName, true);
}
/* NOP */;
}
public function PlayerHasBombActivator() : Bool{
var i : Int32;
var j : Int32;
var items : array<SItemUniqueId>;
playerInventory = thePlayer.GetInventory();
i = 0;
while (i < bombActivators.Size()){
if (playerInventory.HasItem(bombActivators[i])){
items.Clear();
items = playerInventory.GetItemsByName(bombActiv
ators[i]);
j = 0;
while (j < items.Size()){
if (playerInventory.SingletonItemGetAmmo
(items[j]) > 0){
usedBomb = items[j];
return true;
}
j += 1;
}

}
i += 1;
}
return false;
/* NOP */;
}
public function OnAnimEvent_Custom(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'AttachBomb' && IsNameValid(bombName)){
bombEntityTemplate = (CEntityTemplate)LoadResource(bombN
ame, /* NOP */);
bombEntity = theGame.CreateEntity(bombEntityTemplate, th
ePlayer.GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */);
bombEntity.CreateAttachment(thePlayer, 'l_weapon', /* NO
P */, /* NOP */);
} else if (animEventName == 'DetachBomb'){
bombEntity.DestroyAfter(0.500000);
bombEntity.BreakAttachment();
PlayEffect('deploy', /* NOP */);
}
/* NOP */;
}
public function OnAnimEvent_AttachBomb(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3 && IsNameValid(bombName)){
bombEntityTemplate = (CEntityTemplate)LoadResource(bombN
ame, /* NOP */);
bombEntity = theGame.CreateEntity(bombEntityTemplate, th
ePlayer.GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */);
bombEntity.CreateAttachment(thePlayer, 'l_weapon', /* NO
P */, /* NOP */);
thePlayer.RemoveAnimEventChildCallback(this, 'AttachBomb
');
}
/* NOP */;
}
public function OnAnimEvent_DetachBomb(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
bombEntity.DestroyAfter(0.500000);
bombEntity.BreakAttachment();
PlayEffect('deploy', /* NOP */);
thePlayer.BlockAllActions('DestroyNest', false, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.RemoveAnimEventChildCallback(this, 'DetachBomb
');
}
/* NOP */;
}
public function AddExp(){
if (addExpOnlyOnce && expWasAdded){
return;
}
expWasAdded = true;
GetWitcherPlayer().AddPoints(1, expOnNestDestroyed, true);
/* NOP */;
}
public function BlockPlayerNestInteraction(){

actionBlockingExceptions.PushBack(14);
actionBlockingExceptions.PushBack(26);
thePlayer.BlockAllActions('DestroyNest', true, actionBlockingExc
eptions, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function AddBonusExp(){
GetWitcherPlayer().AddPoints(1, bonusExpOnBossKilled, true);
/* NOP */;
}
public function GetEncounter(){
if (linkingMode){
encounter = (CEncounter)EntityHandleGet(linkedEncounterH
andle);
} else {
encounter = (CEncounter)theGame.GetEntityByTag(linkedEnc
ounterTag);
}
if (!encounter){
/* NOP */;
}
/* NOP */;
}
public function SetBossKilled(killed : Bool){
if (!encounter){
GetEncounter();
}
bossKilled = killed;
encounter.EnableEncounter(false);
AddBonusExp();
/* NOP */;
}
public function SetRebuild(isRebuilding : Bool){
nestUpdateDefintion.isRebuilding = isRebuilding;
/* NOP */;
}
public function IncrementBossKilledCounter(){
bossKilledCounter += 1;
/* NOP */;
}
public function GetBossKilledCounter() : Int32{
return bossKilledCounter;
/* NOP */;
}
public timer function ProcessRebuildingSchedule(optional timeDelta : Gam
eTime, optional id : Int32){
if (nestUpdateDefintion.isRebuilding){
if (encounter){
if (!encounter.IsPlayerInEncounterArea()){
GotoState('NestRebuild', /* NOP */, /* N
OP */);
} else {
AddGameTimeTimer('ProcessRebuildingSched
ule', GameTimeCreate(0, 2, 0, 0), false, /* NOP */, /* NOP */, true, true);
}
} else if (VecDistance2D(GetWorldPosition(), thePlayer.G
etWorldPosition()) > 30.000000){
GotoState('NestRebuild', /* NOP */, /* NOP */);
} else {
AddGameTimeTimer('ProcessRebuildingSchedule', Ga

meTimeCreate(0, 2, 0, 0), false, /* NOP */, /* NOP */, true, true);


}
}
/* NOP */;
}
public timer function SpawnBoss(optional time : Float, optional id : Int
32){
encounter.SetSpawnPhase(nestUpdateDefintion.bossPhaseToActivate)
;
/* NOP */;
}
public function IsBossProtectingNest() : Bool{
if (nestUpdateDefintion.hasBoss && !bossKilled){
return true;
} else {
return false;
}
/* NOP */;
}
public function RebuildNest(){
AddGameTimeTimer('ProcessRebuildingSchedule', nestUpdateDefintio
n.nestRebuildSchedule.gameTime, false, /* NOP */, /* NOP */, true, true);
/* NOP */;
}
public function IsSetDestructionFactImmediately() : Bool{
return setDestructionFactImmediately;
/* NOP */;
}
}
import abstract class CBehaviorGraphDampAngularValueNode{
}
import abstract class CBehaviorGraphDampAngularValueNodeDiff{
}
import abstract class CBehaviorGraphDampVectorValueNode{
}
import abstract class CBehaviorGraphCurveDampValueNode{
}
import abstract class CBehaviorGraphCurveMapValueNode{
}
import abstract class CBehaviorGraphCustomDampValueNode{
}
import abstract class CBehaviorGraphRandomNode{
}
import abstract class CBehaviorGraphRandomSelectNode{
}
import abstract class CBehaviorGraphMimicRandomNode{
}
import abstract class CBehaviorGraphMimicRandomBlendNode{
}

import abstract class CBehaviorGraphMimicEyesCorrectionNode{


}
import abstract class CBehaviorGraphMimicBlinkControllerNode{
}
import abstract class CBehaviorGraphMimicBlinkControllerNode_Setter{
}
import abstract class CBehaviorGraphMimicBlinkControllerNode_Watcher{
}
import abstract class CBehaviorGraphMimicBlinkControllerNode_Blend{
}
import abstract class SBehaviorGraphStateBehaviorGraphSyncInfo{
}
import abstract class CBehaviorGraphPointerTransitionNode{
}
import abstract class CBehaviorGraphPointerStateNode{
}
import abstract class CBehaviorGraphDefaultSelfActStateNode{
}
import abstract class CBehaviorGraphComboStateNode{
}
struct SIdleAEntryGeneratorParam{
editable var creatureEntry : SCreatureEntryEntryGeneratorNodeParam;
editable inlined var idleTree : CAIIdleTree;
editable var guartArea : SGuardAreaEntryGeneratorNodeParam;
}
import abstract class CBehaviorGraphOffensiveComboStateNode{
}
import abstract class CBehaviorGraphDefensiveComboStateNode{
}
import abstract class CBehaviorGraphSimpleDefensiveComboStateNode{
}
import abstract class Bezier2dHandle{
}
import struct CSpawnTreeInitializerIdleAI{
public editable inlined var ai : CAIIdleRedefinitionParameters;
public function Init(){
ai = new CAIIdleRedefinitionParameters in this;
ai.OnCreated();
/* NOP */;
}
}
import struct CSpawnTreeInitializerGuardArea{
//NULL type for guardAreaTag
//NULL type for pursuitAreaTag

}
import abstract class CBehaviorGraphComboLevelModifier{
}
struct SWanderWorkCetegoriesForCreatureDefinitionEntryGeneratorParam{
editable var creatureDefinition : SCreatureDefinitionWrapper;
editable var categories : array<SEncounterActionPointSelectorPairScr>;
}
import abstract class CBehaviorGraphComboStartingAnimationModifier{
}
import abstract class CBehaviorGraphComboCooldownModifier{
}
import abstract class CStorySceneEventCameraInterpolationKey{
}
import abstract class CBehaviorGraphComboTransitionNode{
}
class CSpawnTreeInitializerSmartWanderAndWorkAI extends ISpawnTreeInitializerIdl
eSmartAI{
public function GetObjectForPropertiesEdition() : IScriptable{
if (ai && (CAINpcActiveIdle)ai.idleTree){
return (CAINpcActiveIdle)ai.idleTree;
}
return this;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "WanderAndWork SmartAI";
/* NOP */;
}
public function Init(){
super.Init();
ai.idleTree = new CAINpcActiveIdle in this;
ai.idleTree.OnCreated();
/* NOP */;
}
}
import abstract class CBehaviorGraphGlobalComboTransitionNode{
}
import abstract class CStorySceneEventPlacementInterpolationKey{
}
class CAIWanderWithHistory extends CAIWanderTree{
public editable inlined var params : CAINpcHistoryWanderParams;
public function Init(){
params = new CAINpcHistoryWanderParams in this;
params.OnCreated();
/* NOP */;
}
}
import struct CWanderActionPointSelector{
//NULL type for apTags

//NULL
//NULL
//NULL
//NULL
//NULL
//NULL

type
type
type
type
type
type

for
for
for
for
for
for

areaTags
apAreaTag
delay
categories
radius
chooseClosestAP

}
import abstract class SBehaviorComboDistance{
}
import abstract class CStorySceneEventLightPropertiesInterpolationKey{
}
import abstract class SBehaviorComboDirection{
}
struct SWanderEntryGeneratorParam{
editable var qualityMin : Int32;
editable var qualityMax : Int32;
editable var creatureDefinition : SCreatureDefinitionWrapper;
editable var spawnWayPointTag : TagList;
editable var wanderPointsGroupTag : CName;
}
import abstract class CStorySceneEventClothDisablingInterpolationKey{
}
class CSpawnTreeInitializerSmartWanderAI extends ISpawnTreeInitializerIdleSmartA
I{
public function GetObjectForPropertiesEdition() : IScriptable{
if (ai && (CAIWanderWithHistory)ai.idleTree){
return (CAIWanderWithHistory)ai.idleTree;
}
return this;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "Wanderpoints SmartAI";
/* NOP */;
}
public function Init(){
super.Init();
ai.idleTree = new CAIWanderWithHistory in this;
ai.idleTree.OnCreated();
/* NOP */;
}
}
import abstract class SBehaviorComboAttack{
}
import abstract class CStorySceneEventMorphInterpolationKey{
}
struct SWorkCetegoriesForCreatureDefinitionEntryGeneratorParam{
editable var creatureDefinition : SCreatureDefinitionWrapper;
editable var workCategories : SWorkCategoriesWrapper;
}

import abstract class CBehaviorGraphFlowConnectionNode{


}
import abstract class CStorySceneEventDangleDisablingInterpolationKey{
}
class CSpawnTreeInitializerSmartWorkAI extends ISpawnTreeInitializerIdleSmartAI{
public function GetObjectForPropertiesEdition() : IScriptable{
if (ai && (CAINpcWorkIdle)ai.idleTree){
return (CAINpcWorkIdle)ai.idleTree;
}
return this;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "Work SmartAI";
/* NOP */;
}
public function Init(){
super.Init();
ai.idleTree = new CAINpcWorkIdle in this;
ai.idleTree.OnCreated();
/* NOP */;
}
public function GetSubInitializerClassName() : CName{
return 'CSpawnTreeInitializerActionpointSpawner';
/* NOP */;
}
public function GetContextMenuSpecialOptions(names : array<String>){
if (subInitializer){
names.PushBack("Update spawner");
} else {
names.PushBack("Default spawner");
}
/* NOP */;
}
public function CreateSpawner(visibility : ESpawnTreeSpawnVisibility){
var spawner : CSpawnTreeInitializerActionpointSpawner;
var workTree : CAINpcWorkIdle;
var selector : CSimpleActionPointSelector;
if (!ai){
return;
}
workTree = (CAINpcWorkIdle)ai.idleTree;
if (!workTree){
return;
}
selector = (CSimpleActionPointSelector)workTree.actionPointSelec
tor;
if (!selector){
return;
}
if (subInitializer){
spawner = (CSpawnTreeInitializerActionpointSpawner)subIn
itializer;
} else {
spawner = new CSpawnTreeInitializerActionpointSpawner in
this;
subInitializer = spawner;
}

spawner.spawner.categories = selector.categories;
spawner.spawner.tags = selector.apTags;
spawner.spawner.visibility = visibility;
/* NOP */;
}
public function RunSpecialOption(option : Int32){
CreateSpawner(0);
/* NOP */;
}
}
import abstract class CBehaviorGraphFlowTransitionNode{
}
import abstract class CStorySceneDanglesShakeEventInterpolationKey{
}
import abstract class CBehaviorGraphFrozenStateNode{
}
import abstract class CStorySceneEventPropPlacementInterpolationKey{
}
import struct CSpawnTreeInitializerSetAppearance{
//NULL type for appearanceName
//NULL type for onlySetOnSpawnAppearance
}
import struct CSpawnTreeInitializerAddTag{
//NULL type for onlySetOnSpawnAppearance
import public final function AddTag(tag : CName);
}
import abstract class CBehaviorGraphStateTransitionBlendNode{
}
import abstract class CStorySceneEventCameraLightInterpolationKey{
}
class W3MapInitData extends W3MenuInitData{
private var m_triggeredExitEntity : Bool;
private var m_usedFastTravelEntity : CEntity;
private var m_isSailing : Bool;
public function GetTriggeredExitEntity() : Bool{
return m_triggeredExitEntity;
/* NOP */;
}
public function SetTriggeredExitEntity(triggeredExitEntity : Bool){
m_triggeredExitEntity = triggeredExitEntity;
/* NOP */;
}
public function GetUsedFastTravelEntity() : CEntity{
return m_usedFastTravelEntity;
/* NOP */;
}
public function SetUsedFastTravelEntity(entity : CEntity){
m_usedFastTravelEntity = entity;
/* NOP */;
}
public function GetIsSailing() : Bool{

return m_isSailing;
/* NOP */;
}
public function SetIsSailing(isSailing : Bool){
m_isSailing = isSailing;
/* NOP */;
}
}
import abstract class CBehaviorGraphStateTransitionGlobalBlendStreamingNode{
}
import abstract class CQuestGraph{
}
import abstract class CBehaviorGraphStateTransitionMatchToPoseNode{
}
import abstract class CBehaviorGraphStateTransitionMatchFromPoseNode{
}
import abstract class CBehaviorGraphMatchFromPoseNode{
}
import abstract class SCachedConnections{
}
import abstract class CBehaviorGraphStatePelvisTransitionNode{
}
import abstract class CBehaviorGraphStateMachineNode{
}
import abstract class CBehaviorGraphSelfActivatingStateMachineNode{
}
import abstract class CBehaviorGraphSelfActivatingOverrideStateMachineNode{
}
import struct CQuestGraphBlock{
}
import abstract class CBehaviorGraphSyncOverrideStateMachineNode{
}
import abstract class CBehaviorGraphSelfActivatingAdditiveStateMachineNode{
}
import abstract class CBehaviorGraphDefaultSelfActAdditiveStateNode{
}
import abstract class CBehaviorGraphStateAdditiveTransitionNode{
}
import abstract class SBlockDesc{
}
import abstract class CBehaviorGraphRotateBoneNode{
}

import abstract class CBehaviorGraphRotateLimitNode{


}
import abstract class CBehaviorGraphPivotRotationNode{
}
import abstract class CBehaviorGraphActorTiltNode{
}
import abstract class SQuestThreadSuspensionData{
}
class W3FocusModeEffectIntensity extends CObject{
public var chooseEntityStrategy : EFocusModeChooseEntityStrategy;
public var bestEntity : CEntity;
public var bestDistance : Float;
public var lastDistance : Float;
public var bestIntensity : Float;
public var lastIntensity : Float;
public function Init(strategy : EFocusModeChooseEntityStrategy){
chooseEntityStrategy = strategy;
bestEntity = NULL;
bestDistance = 0.000000;
lastDistance = 0.000000;
bestIntensity = 0.000000;
lastIntensity = 0.000000;
/* NOP */;
}
public function Update(entity : CEntity, distance : Float, intensity : F
loat){
if (IsBestEntity(distance, intensity)){
bestEntity = entity;
bestDistance = distance;
bestIntensity = intensity;
}
/* NOP */;
}
public function ForceUpdate(entity : CEntity, distance : Float, intensit
y : Float){
bestEntity = entity;
bestDistance = distance;
bestIntensity = intensity;
/* NOP */;
}
public function ValueChanged() : Bool{
return bestIntensity != lastIntensity;
/* NOP */;
}
public function GetValue(reset : Bool) : Float{
return lastIntensity;
/* NOP */;
}
public function GetBestEntity() : CEntity{
return bestEntity;
/* NOP */;
}
public function Reset(){
lastIntensity = bestIntensity;
bestIntensity = 0.000000;
bestDistance = 0.000000;

bestEntity = NULL;
/* NOP */;
}
public function IsBestEntity(distance : Float, intensity : Float) : Bool
{
if (!bestEntity){
return true;
}
if (chooseEntityStrategy == 1){
return intensity > bestIntensity;
} else {
return distance < bestDistance;
}
/* NOP */;
}
}
import abstract class CBehaviorGraphFilterNode{
}
import abstract class CBehaviorGraphTranslateBoneNode{
}
class W3MonsterClue extends W3AnimationInteractionEntity{
public editable saved var isAvailable : Bool;
public editable saved var isInteractive : Bool;
public editable saved var isReusable : Bool;
public editable saved var isVisible : Bool;
public editable saved var isIgnoringFM : Bool;
public editable var playerVoiceset : EPlayerVoicesetType;
public editable var clueEntries : array<String>;
public editable var maxDetectionDistance : Float;
public editable var testLineOfSight : Bool;
public editable var medallionVibration : Bool;
public editable var medallionVibrationDistance : Float;
public editable var medallionVibrationBehavior : EFocusClueMedallionReac
tion;
public saved var medallionVibratedEver : Bool;
public var medallionVibratedInSession : Bool;
public const var accuracyTreshold : Float;
public editable inlined var eventOnDetected : array<IPerformableAction>;
public editable var detectionDelay : Float;
public saved var wasDetected : Bool;
public saved var wasSeen : Bool;
public editable saved var isVisibleAsClue : Bool;
public var linkedFocusArea : W3FocusAreaTrigger;
public var dimmingStarted : Bool;
public var focusModeController : CFocusModeController;
public const var INTERACTION_COMPONENT_NAME : String;
public function OnStreamIn() : Bool{
ProcessReleaseVersions();
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tags : array<CName>;
if (!spawnData.restored){
wasSeen = false;
wasDetected = false;
}
focusModeController = theGame.GetFocusModeController();

UpdateInteraction(/* NOP */);


UpdateVisibility();
/* NOP */;
}
public function OnUpdateFocus(distance : Float, accuracy : Float) : Bool
{
CheckDistances(distance, accuracy);
/* NOP */;
}
public function OnInteractionAttached(interaction : CInteractionComponen
t) : Bool{
if (interaction && interaction.GetName() == INTERACTION_COMPONEN
T_NAME){
UpdateInteraction(interaction);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator == thePlayer && thePlayer.IsActionAllowed(12)){
thePlayer.OnMeleeForceHolster(false);
thePlayer.OnRangedForceHolster(true, /* NOP */, /* NOP *
/);
DetectClue();
if (animationForAllInteractions == true || actionName ==
"Examine"){
PlayInteractionAnimation();
}
UpdateInteraction(/* NOP */);
dimmingStarted = true;
focusModeController.SetDimmingForClue(this);
PlayClueVoiceset(playerVoiceset);
if (ShouldProcessTutorial('TutorialFocusClues')){
FactsAdd("tut_clue_interacted", 1, 1);
}
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
ApplyAppearance("02_on_hit");
super.OnAardHit(sign);
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
ApplyAppearance("02_on_hit");
super.OnIgniHit(sign);
/* NOP */;
}
public function OnWeaponHit(act : W3DamageAction) : Bool{
ApplyAppearance("02_on_hit");
super.OnWeaponHit(act);
/* NOP */;
}
public function ShouldBlockGameplayActionsOnInteraction() : Bool{
return false;
/* NOP */;
}
public function OnDimmingFinished() : Bool{
dimmingStarted = false;
UpdateVisibility();

/* NOP */;
}
public function SetAvailable(newIsAvailable : Bool){
if (isAvailable != newIsAvailable){
isAvailable = newIsAvailable;
UpdateInteraction(/* NOP */);
UpdateVisibility();
OnAvailabilityChange();
}
/* NOP */;
}
public function SetInteractive(newIsInteractive : Bool){
isInteractive = newIsInteractive;
UpdateInteraction(/* NOP */);
UpdateVisibility();
/* NOP */;
}
public function OnAvailabilityChange() : Bool{
}
public function GetIsAvailable() : Bool{
return isAvailable;
/* NOP */;
}
public function GetIsInteractive() : Bool{
return isInteractive;
/* NOP */;
}
public function GetIsReusable() : Bool{
return isReusable;
/* NOP */;
}
public function GetIsVisible() : Bool{
return isVisible;
/* NOP */;
}
public function GetWasDetected() : Bool{
return wasDetected;
/* NOP */;
}
public function GetIsIgnoringFM() : Bool{
return isIgnoringFM;
/* NOP */;
}
public function PlayClueVoiceset(voicesetEnum : EPlayerVoicesetType){
switch(voicesetEnum){
case 13:
break;
case 0:
thePlayer.PlayVoiceset(90, "MonsterNestDrowners", /* NOP
*/);
break;
case 1:
thePlayer.PlayVoiceset(90, "MiscFreshTracks", /* NOP */)
;
break;
case 2:
thePlayer.PlayVoiceset(90, "MiscFollowingTracks", /* NOP
*/);
break;
case 3:

thePlayer.PlayVoiceset(90, "MiscBloodTrail", /* NOP */);


break;
case 4:
thePlayer.PlayVoiceset(90, "MiscInvestigateArea", /* NOP
*/);
break;
case 5:
thePlayer.PlayVoiceset(90, "MiscHideoutFound", /* NOP */
);
break;
case 6:
thePlayer.PlayVoiceset(90, "MiscFindOtherWay", /* NOP */
);
break;
case 7:
thePlayer.PlayVoiceset(90, "MiscAnotherVictim", /* NOP *
/);
break;
case 8:
thePlayer.PlayVoiceset(90, "MiscUnevenFight", /* NOP */)
;
break;
case 9:
thePlayer.PlayVoiceset(90, "MiscALotOfBlood", /* NOP */)
;
break;
case 10:
thePlayer.PlayVoiceset(90, "MiscGenericRemarks", /* NOP
*/);
break;
case 11:
thePlayer.PlayVoiceset(90, "About_trophy", /* NOP */);
break;
case 12:
thePlayer.PlayVoiceset(90, "FasterHorse", /* NOP */);
break;
}
/* NOP */;
}
public function IsInteractiveInternal() : Bool{
if (isIgnoringFM){
return isAvailable && isInteractive && !wasDetected || i
sReusable;
} else {
return isAvailable && isInteractive && wasSeen && !wasDe
tected || isReusable;
}
/* NOP */;
}
public function UpdateInteraction(comp : CComponent){
var enabled : Bool;
if (!comp){
comp = GetComponent(INTERACTION_COMPONENT_NAME);
}
if (comp){
enabled = false;
if (IsInteractiveInternal()){
if (!isPlayingInteractionAnim){
enabled = true;
}

}
comp.SetEnabled(enabled);
} else {
LogAssert(false, "Monster clue <<" + this + ">> has no I
nteractiveClue component");
}
/* NOP */;
}
public function UpdateVisibility(){
var count : Int32;
if (isVisible){
if (isVisibleAsClue){
SetFocusModeVisibility(2, /* NOP */);
} else {
SetFocusModeVisibility(1, /* NOP */);
}
} else {
SetFocusModeVisibility(0, /* NOP */);
}
/* NOP */;
}
public function ChangeAttribute(actionType : EFocusClueAttributeAction,
currentValue : Bool, changeFlag : Bool) : Bool{
if (actionType == 0){
return changeFlag;
} else if (actionType == 1){
if (changeFlag){
return true;
}
} else if (actionType == 2){
if (changeFlag){
return false;
}
} else if (actionType == 3){
if (changeFlag){
return !currentValue;
}
}
return currentValue;
/* NOP */;
}
public function SetAttributes(actionType : EFocusClueAttributeAction, ch
angeIsAvailable : Bool, changeIsInteractive : Bool, changeIsReusable : Bool, cha
ngeIsVisible : Bool, changeWasDetected : Bool, changeisIgnoringFM : Bool){
isAvailable = ChangeAttribute(actionType, isAvailable, changeIsA
vailable);
isInteractive = ChangeAttribute(actionType, isInteractive, chang
eIsInteractive);
isReusable = ChangeAttribute(actionType, isReusable, changeIsReu
sable);
isVisible = ChangeAttribute(actionType, isVisible, changeIsVisib
le);
wasDetected = ChangeAttribute(actionType, wasDetected, changeWas
Detected);
isIgnoringFM = ChangeAttribute(actionType, isIgnoringFM, changei
sIgnoringFM);
UpdateInteraction(/* NOP */);
UpdateVisibility();
/* NOP */;
}

public function AddFacts(){


var i : Int32;
var size : Int32;
size = clueEntries.Size();
i = 0;
while (i < size){
FactsAdd(clueEntries[i], /* NOP */, /* NOP */);
LogQuest("Fact " + clueEntries[i] + " was added");
i += 1;
}
/* NOP */;
}
public function RemoveFacts(){
var i : Int32;
var size : Int32;
size = clueEntries.Size();
i = 0;
while (i < size){
FactsRemove(clueEntries[i]);
LogQuest("Fact " + clueEntries[i] + " was removed");
i += 1;
}
/* NOP */;
}
public function OnPlayerActionEnd() : Bool{
super.OnPlayerActionEnd();
UpdateInteraction(/* NOP */);
/* NOP */;
}
public function CheckDistances(distance : Float, accuracy : Float){
var allowVibration : Bool;
var intensity : Float;
var recentDialogueTime : GameTime;
var currentTime : GameTime;
if (isAvailable && isVisible && !wasDetected){
OnDetectionDistance(distance < maxDetectionDistance, acc
uracy);
if (medallionVibration){
if (distance < medallionVibrationDistance){
if (focusModeController.GetBlockVibratio
ns() == false){
allowVibration = false;
if (medallionVibrationBehavior =
= 2){
allowVibration = true;
} else if (medallionVibrationBeh
avior == 1){
if (!medallionVibratedEv
er){
medallionVibrate
dEver = true;
allowVibration =
true;
}
} else if (medallionVibrationBeh
avior == 0){
if (!medallionVibratedIn
Session){
medallionVibrate
dInSession = true;

allowVibration =
true;
}
}
if (allowVibration){
recentDialogueTime = the
Game.GetRecentDialogOrCutsceneEndGameTime();
currentTime = theGame.Ge
tGameTime();
if (GameTimeToSeconds(cu
rrentTime) - GameTimeToSeconds(recentDialogueTime) >= ConvertRealTimeSecondsToGa
meSeconds(4)){
IndicateClue();
focusModeControl
ler.SetBlockVibrations(true);
AddTimer('ResetF
ocusVibrationBlockTimer', 5.500000, false, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
}
}
}
}
}
}
/* NOP */;
}
private function IndicateClue(){
focusModeController.SetMedallionIntensity(this, 0.000000, 2.0000
00);
focusModeController.SetFocusAreaIntensity(1.000000);
/* NOP */;
}
public timer function ResetFocusVibrationBlockTimer(optional delta : Flo
at, optional id : Int32){
focusModeController.SetBlockVibrations(false);
/* NOP */;
}
public function MarkSeenClues(){
var nodes : array<CNode>;
var i : Int32;
var size : Int32;
var monsterClue : W3MonsterClue;
theGame.GetNodesByTags(GetTags(), nodes, true);
size = nodes.Size();
i = 0;
while (i < size){
monsterClue = (W3MonsterClue)nodes[i];
if (monsterClue && monsterClue != this && !monsterClue.w
asSeen){
monsterClue.wasSeen = true;
monsterClue.UpdateInteraction(/* NOP */);
monsterClue.UpdateVisibility();
}
i += 1;
}
/* NOP */;
}
public function OnDetectionDistance(inRange : Bool, accuracy : Float) :
Bool{
if (inRange){

if (!isInteractive){
if (accuracy >= accuracyTreshold){
wasSeen = true;
if (!wasDetected){
DetectClue();
}
}
} else if (!wasSeen && accuracy >= accuracyTreshold){
wasSeen = true;
UpdateInteraction(/* NOP */);
UpdateVisibility();
MarkSeenClues();
}
}
/* NOP */;
}
public function OnClueDetected() : Bool{
wasDetected = true;
AddFacts();
focusModeController.ReusableClueDetected(this);
TriggerPerformableEvent(eventOnDetected, this);
/* NOP */;
}
public function OnManageClue(operations : array<EClueOperation>) : Bool{
var i : Int32;
var size : Int32;
size = operations.Size();
i = 0;
while (i < size){
switch(operations[i]){
case 0:
isVisible = true;
SetAvailable(true);
break;
case 1:
isVisible = false;
SetAvailable(false);
break;
case 2:
break;
default:
break;
}
i += 1;
}
/* NOP */;
}
public function DetectClue(){
if (!wasDetected || isReusable){
if (detectionDelay > 0.000000){
AddTimer('DelayedClueDetection', detectionDelay,
false, /* NOP */, /* NOP */, true, /* NOP */);
} else {
OnClueDetected();
if (linkedFocusArea){
linkedFocusArea.SmartFocusAreaCheck();
}
}
}
/* NOP */;

}
public timer function DelayedClueDetection(optional t : Float, optional
id : Int32){
OnClueDetected();
if (linkedFocusArea){
linkedFocusArea.SmartFocusAreaCheck();
}
/* NOP */;
}
public function ResetClue(removeFacts : Bool, leaveVisible : Bool){
isVisibleAsClue = leaveVisible;
if (medallionVibrationBehavior == 0){
medallionVibratedInSession = true;
} else if (medallionVibrationBehavior == 1){
medallionVibratedEver = true;
}
UpdateInteraction(/* NOP */);
if (!dimmingStarted){
UpdateVisibility();
}
if (removeFacts){
RemoveFacts();
}
/* NOP */;
}
public function GetFocusActionName() : CName{
if (IsInteractiveInternal()){
return super.GetFocusActionName();
}
return 'None';
/* NOP */;
}
public function CanShowFocusInteractionIcon() : Bool{
return !wasDetected;
/* NOP */;
}
public function ProcessReleaseVersions(){
if (FactsQuerySum("release_jp") >= 1){
ProcessStaticMeshesReleaseVersions('release_jp_hide', /*
NOP */);
ProcessMeshesReleaseVersions('release_jp_hide', /* NOP *
/);
ProcessRigidMeshesReleaseVersions('release_jp_hide', /*
NOP */);
ProcessDecalsReleaseVersions('release_jp_hide', /* NOP *
/);
}
/* NOP */;
}
public function ProcessDecalsReleaseVersions(hideTag : CName, showTag :
CName){
var decals : array<CComponent>;
var decal : CDecalComponent;
var i : Int32;
decals = GetComponentsByClassName('CDecalComponent');
if (decals.Size() > 0){
i = 0;
while (i < decals.Size()){
decal = (CDecalComponent)decals[i];
if (decal.HasTag(hideTag) && hideTag != 'None'){

decal.SetVisible(false);
}
if (decal.HasTag(showTag) && showTag != 'None'){
decal.SetVisible(true);
}
i += 1;
}
}
/* NOP */;
}
public function ProcessStaticMeshesReleaseVersions(hideTag : CName, show
Tag : CName){
var meshes : array<CComponent>;
var staticMesh : CStaticMeshComponent;
var i : Int32;
meshes = GetComponentsByClassName('CStaticMeshComponent');
if (meshes.Size() > 0){
i = 0;
while (i < meshes.Size()){
staticMesh = (CStaticMeshComponent)meshes[i];
if (staticMesh.HasTag(hideTag) && hideTag != 'No
ne'){
staticMesh.SetVisible(false);
}
if (staticMesh.HasTag(showTag) && showTag != 'No
ne'){
staticMesh.SetVisible(true);
}
i += 1;
}
}
/* NOP */;
}
public function ProcessMeshesReleaseVersions(hideTag : CName, showTag :
CName){
var meshes : array<CComponent>;
var mesh : CMeshComponent;
var i : Int32;
meshes = GetComponentsByClassName('CMeshComponent');
if (meshes.Size() > 0){
i = 0;
while (i < meshes.Size()){
mesh = (CStaticMeshComponent)meshes[i];
if (mesh.HasTag(hideTag) && hideTag != 'None'){
mesh.SetVisible(false);
}
if (mesh.HasTag(showTag) && showTag != 'None'){
mesh.SetVisible(true);
}
i += 1;
}
}
/* NOP */;
}
public function ProcessRigidMeshesReleaseVersions(hideTag : CName, showT
ag : CName){
var meshes : array<CComponent>;
var mesh : CRigidMeshComponent;
var i : Int32;
meshes = GetComponentsByClassName('CRigidMeshComponent');

if (meshes.Size() > 0){


i = 0;
while (i < meshes.Size()){
mesh = (CRigidMeshComponent)meshes[i];
if (mesh.HasTag(hideTag) && hideTag != 'None'){
mesh.SetVisible(false);
}
if (mesh.HasTag(showTag) && showTag != 'None'){
mesh.SetVisible(true);
}
i += 1;
}
}
/* NOP */;
}
}
import abstract class CBehaviorGraphEngineValueNode{
}
import abstract class CBehaviorGraphEngineVectorValueNode{
}
import abstract class CBehaviorGraphMathNode{
}
import abstract class CBehaviorGraphWrapNode{
}
import abstract class CBehaviorGraphWaveValueNode{
}
import abstract class CBehaviorGraphFloatValueNode{
}
import abstract class CBehaviorGraphValueModifierNode{
}
import abstract class CBehaviorGraphEditorValueNode{
}
import abstract class CBehaviorGraphRandomValueNode{
}
import abstract class CBehaviorGraphMapWorldSpaceDirectionToModelSpaceRangeNode{
}
import abstract class CQuestPhase{
}
import abstract class CBehaviorGraphMapRangeNode{
}
import abstract class CBehaviorGraphMapToDiscreteNode{
}
import abstract class CBehaviorGraphSnapToZeroNode{
}
import abstract class CBehaviorGraphCameraControllerNode{

}
import abstract class CBehaviorGraphCameraVerticalDampNode{
}
class CExplorationStateClimb extends CExplorationStateAbstract{
public var m_ClimbOracleO : CExplorationClimbOracle;
private editable var enabled : Bool;
private editable inlined var climbTypes : array<CClimbType>;
private var climbCur : CClimbType;
private editable inlined var heightMaxToRun : Float;
private editable inlined var platformHeightMinAir : Float;
private editable inlined var platformHeightMin : Float;
private var climbPoint : Vector;
private var wallNormal : Vector;
private var heightTarget : Float;
private var vaultingFound : EClimbRequirementVault;
private var platformFound : EClimbRequirementPlatform;
private var curPlayerStateType : EClimbRequirementType;
private var vaultEndsFalling : Bool;
private var ended : Bool;
private var canWalk : Bool;
private var canRun : Bool;
private var canFall : Bool;
public editable var animDurationLimit : Float;
public editable var slideDistMaxOnRun : Float;
private editable var autoClimb : Bool;
private editable var autoClimbOnAir : Bool;
private editable var inputAngleToEnter : Float;
private editable var inputAngleToRun : Float;
private var inputAttemptsTop : Bool;
private var inputDirection : Vector;
private editable var inputAirHold : Bool;
private editable var inputAirTimeGap : Bool;
private editable var inputTimeGapCheck : Float;
private var characterRadius : Float;
private var adjustInitiallRotat : Float;
private var adjustRotation : Float;
private var adjustTranslation : Vector;
private var adjustInitialRotDone : Bool;
private var adjustRotDone : Bool;
private var adjustTransDone : Bool;
private var adjustSpeedMax : Float;
private var adjustSpeedRequire : Bool;
private var adjustSpeedEndTime : Float;
private var adjust2Dduration : Float;
private var adjust2Speed : Float;
private var adjust2Translation : Vector;
private var heightToAdd : Float;
private var pelvisTransMax : Float;
private var pelvisTransAllow : Bool;
private var pelvisTransState : EOutsideCapsuleState;
private var pelvisTranslationN : CName;
private var pelvisTransCur : Float;
private var pelvisTransTarget : Float;
private var pelvisTransSpeed : Float;
private var pelvisTransSpeedOut : Float;
private editable var behAnimAdjustInitRot : CName;
private editable var behAnimAdjustRot : CName;
private editable var behAnimAdjustTrans : CName;

private editable var behAnimEnded : CName;


private editable var behAnimCanWalk : CName;
private editable var behAnimCanRun : CName;
private editable var behAnimCanFall : CName;
private editable var behEnableIK : CName;
private editable var behDisablePelvisTrans : CName;
private editable var behEnableHandsIK : CName;
private editable var behEnableHandLIK : CName;
private editable var behEnableHandRIK : CName;
private editable var behDisableHandsIK : CName;
private editable var behDisableHandLIK : CName;
private editable var behDisableHandRIK : CName;
private editable var behHeightTypeEnum : CName;
private editable var behVaultTypeEnum : CName;
private editable var behPlatformTypeEnum : CName;
private editable var behStateTypeEnum : CName;
private editable var behGoToRun : CName;
private editable var behGoToWalk : CName;
private editable var behToRun : CName;
private editable var behVarEnd : CName;
private editable var behAnimSpeed : CName;
private editable var continousHandIK : Bool;
private editable var handIKMinDistToEnable : Float;
private editable var handIKMaxDist : Float;
private editable var handIKForwardOffset : Float;
private editable var handIKHalfMaxHeight : Float;
private editable var handIKBlendSpeedIn : Float;
private editable var handIKBlendSpeedOut : Float;
private editable var handThickness : Float;
protected var boneRightHand : CName;
protected var boneLeftHand : CName;
protected var boneIndexRightHand : Int32;
protected var boneIndexLeftHand : Int32;
protected var rightHandOffset : Float;
protected var leftHandOffset : Float;
protected var rightHandOffsetCur : Float;
protected var leftHandOffsetCur : Float;
protected var handIKEnabled : Bool;
protected var handIKEnabledLeft : Bool;
protected var handIKEnabledRight : Bool;
protected var handIKqueuedL : Bool;
protected var handIKqueuedR : Bool;
private var handIKLRayOrigin : Vector;
private var handIKLRayEnd : Vector;
private var handIKLRayCollision : Vector;
private var handIKRRayOrigin : Vector;
private var handIKRRayEnd : Vector;
private var handIKRRayCollision : Vector;
private var collisionObstaclesNames : array<CName>;
protected editable inlined var cameraSetVault : CCameraParametersSet;
protected editable inlined var cameraSetJump : CCameraParametersSet;
private editable var updateCameraManual : Bool;
private editable var updateCameraAnim : Bool;
private var camOriginalPosition : Vector;
private var camOriginalRotation : EulerAngles;
private var camCurRotation : EulerAngles;
private var camOriginalOffset : Vector;
private var camStart : Bool;
private var camFollowBoneID : Int32;
private editable var camFollowBoneName : CName;

private
private
private
private
private
private
private

var vectorUp : Vector;


editable var forceAirCollision : Bool;
editable var forceJumpGrab : Bool;
editable var noAdjustor : Bool;
editable var noPelvisCorection : Bool;
saved var restoreUsableItemLAtEnd : Bool;
function InitializeSpecific(_Exploration : CExplorationStateMana

ger){
var heightTotalMin : Float;
var heightTotalMax : Float;
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'Climb';
}
m_StateTypeE = 2;
m_InputContextE = 2;
m_UpdatesWhileInactiveB = true;
m_HolsterIsFastB = true;
LogExplorationClimb(" Initialized Log channel: ExplorationStat
eClimb");
SetCanSave(false);
if (climbTypes.Size() <= 0){
LogExplorationError("No climb data was found in state CE
xplorationStateClimb");
return;
}
InitClimbs();
ComputeMinMaxHeight(heightTotalMin, heightTotalMax);
if (!m_ClimbOracleO){
m_ClimbOracleO = new CExplorationClimbOracle in this;
}
m_ClimbOracleO.Initialize(m_ExplorationO, heightTotalMin, height
TotalMax, MinF(platformHeightMin, platformHeightMinAir), characterRadius);
boneIndexRightHand = m_ExplorationO.m_OwnerE.GetBoneIndex(boneRi
ghtHand);
boneIndexLeftHand = m_ExplorationO.m_OwnerE.GetBoneIndex(boneLef
tHand);
camFollowBoneID = m_ExplorationO.m_OwnerE.GetBoneIndex(camFollow
BoneName);
collisionObstaclesNames.PushBack('Terrain');
collisionObstaclesNames.PushBack('Static');
collisionObstaclesNames.PushBack('Platforms');
collisionObstaclesNames.PushBack('Fence');
collisionObstaclesNames.PushBack('Boat');
collisionObstaclesNames.PushBack('BoatDocking');
collisionObstaclesNames.PushBack('Foliage');
collisionObstaclesNames.PushBack('Dynamic');
collisionObstaclesNames.PushBack('Destructible');
collisionObstaclesNames.PushBack('RigidBody');
vectorUp = Vector(0.000000, 0.000000, 1.000000);
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
}
public function StateWantsToEnter() : Bool{
ComputeInput();
curPlayerStateType = FindPlayerState();
m_ExplorationO.m_SharedDataO.m_ClimbStateTypeE = curPlayerStateT
ype;
if (!OracleWantsToEnter()){
return false;

}
if (!PreRefineIsValid()){
return false;
}
RefinePlayerState();
if (!FindApropriateClimb()){
return false;
}
PostRefineState();
return true;
/* NOP */;
}
private function DebugEnterToClimb(){
heightTarget = 2.600000;
vaultingFound = 0;
vaultEndsFalling = false;
platformFound = 0;
climbPoint = m_ExplorationO.m_OwnerE.GetWorldPosition() + m_Expl
orationO.m_OwnerE.GetWorldForward() * 1.000000 + m_ExplorationO.m_OwnerE.GetWorl
dUp() * 2.600000;
wallNormal = -m_ExplorationO.m_OwnerE.GetWorldForward();
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
if (!InputWantsToEnter()){
return false;
}
if (!thePlayer.IsActionAllowed(38) || !thePlayer.IsActionAllowed
(6) || !thePlayer.IsActionAllowed(10)){
return false;
}
if (thePlayer.IsInCombat()){
return false;
}
return true;
/* NOP */;
}
private function StateEnterSpecific(prevStateName : CName){
if (prevStateName == 'Swim'){
thePlayer.GotoState('Exploration', /* NOP */, /* NOP */)
;
}
SetInitialMovementAdjustor();
m_ExplorationO.m_MoverO.SetManualMovement(true);
thePlayer.RemoveTimer('DelayedSheathSword', /* NOP */);
thePlayer.OnRangedForceHolster(true, true, /* NOP */);
pelvisTransCur = 0.000000;
pelvisTransState = 0;
SetBehaviorData();
camStart = true;
SetProperCameraAnim(true, 1.000000);
if (m_ExplorationO.m_IsDebugModeB){
DebugLogSuccesfullClimb();
}
canFall = false;
ended = false;
canWalk = false;
adjustInitialRotDone = false;
canRun = false;
adjustRotDone = false;

adjustTransDone = false;
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(false, /* NOP */);
leftHandOffset = 0.000000;
rightHandOffset = 0.000000;
rightHandOffsetCur = 0.000000;
leftHandOffsetCur = 0.000000;
handIKEnabled = false;
handIKEnabledLeft = false;
handIKEnabledRight = false;
handIKqueuedL = false;
handIKqueuedR = false;
adjust2Dduration = 0.000000;
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.OnUseSelectedItem(true);
restoreUsableItemLAtEnd = true;
}
thePlayer.AbortSign();
/* NOP */;
}
protected function AddActionsToBlock(){
AddActionToBlock(1);
/* NOP */;
}
public function GetIfCameraIsKept() : Bool{
return false;
/* NOP */;
}
public function GetCameraSet(cameraSet : CCameraParametersSet) : Bool{
if (curPlayerStateType == 1 || curPlayerStateType == 2 && camera
SetJump){
cameraSet = cameraSetJump;
return true;
} else if (vaultingFound == 1 && cameraSetVault){
cameraSet = cameraSetVault;
return true;
}
return super.GetCameraSet(cameraSet);
/* NOP */;
}
private function AddAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimCanFall, 'On
AnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimEnded, 'OnAn
imEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimCanWalk, 'On
AnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimCanRun, 'OnA
nimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimAdjustInitRo
t, 'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimAdjustRot, '
OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behAnimAdjustTrans,
'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behDisablePelvisTra
ns, 'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behEnableIK, 'OnAni
mEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behEnableHandsIK, '
OnAnimEvent_SubstateManager');

m_ExplorationO.m_OwnerE.AddAnimEventCallback(behEnableHandLIK, '
OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behEnableHandRIK, '
OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behDisableHandsIK,
'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behDisableHandLIK,
'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(behDisableHandRIK,
'OnAnimEvent_SubstateManager');
/* NOP */;
}
public function StateChangePrecheck() : CName{
if (canFall){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behVarEnd, 3
, /* NOP */);
if (vaultingFound == 1){
return 'Jump';
} else if (m_ExplorationO.IsOnGround()){
return 'Idle';
} else {
return 'StartFalling';
}
}
if (m_ExplorationO.CanChangeBetwenStates(GetStateName(), 'Idle')
){
if (AbsF(m_ExplorationO.m_InputO.GetHeadingDiffFromPlaye
rF()) < inputAngleToRun){
if (canRun && thePlayer.GetIsRunning()){
if (m_ExplorationO.m_InputO.IsModuleCons
iderable()){
m_ExplorationO.SendAnimEvent(beh
GoToRun, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehav
iorVariable(behVarEnd, 2, /* NOP */);
return 'Idle';
}
} else if (canWalk){
if (m_ExplorationO.m_InputO.IsModuleCons
iderable()){
m_ExplorationO.m_OwnerE.SetBehav
iorVariable(behVarEnd, 1, /* NOP */);
m_ExplorationO.SendAnimEvent(beh
GoToWalk, /* NOP */);
return 'Idle';
}
}
} else if (canRun || canWalk && m_ExplorationO.m_InputO.
IsModuleConsiderable()){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behV
arEnd, 4, /* NOP */);
return 'Idle';
}
}
if (ended || m_ExplorationO.GetStateTimeF() > animDurationLimit)
{
if (vaultEndsFalling || !m_ExplorationO.m_CollisionManag
erO.CheckLandBelow(0.200000, Vector(0.000000, 0.000000, 0.000000), true)){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behV
arEnd, 3, /* NOP */);

if (vaultingFound == 1){
return 'Jump';
} else {
return 'StartFalling';
}
} else if (m_ExplorationO.CanChangeBetwenStates(GetState
Name(), 'Idle')){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behV
arEnd, 4, /* NOP */);
return 'Idle';
}
}
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
var posCur : Vector;
if (adjustSpeedRequire){
if (m_ExplorationO.GetStateTimeF() >= adjustSpeedEndTime
){
ApplyAnimationSpeed(1.000000);
adjustSpeedRequire = false;
}
}
UpdateAdjusting2D(_Dt);
UpdateHandsIK(_Dt);
UpdateTranslationOutsideCapsule(_Dt);
UpdateRunOrWalk();
CheckVerticalSlideEnd();
/* NOP */;
}
private function StateExitSpecific(nextStateName : CName){
var movAdj : CMovementAdjustor;
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
movAdj.CancelByName('ClimbAdjusInitialRotation');
movAdj.CancelByName('ClimbAdjustments');
movAdj.CancelByName('ClimbAdjusTranslation');
movAdj.CancelByName('ClimbAdjusRotation');
movAdj.CancelByName('ClimbFakeGravity');
CorrectPelvisStartEnd();
if (adjustSpeedRequire){
ApplyAnimationSpeed(1.000000);
}
if (m_ExplorationO.GetStateTimeF() < 0.250000){
CancelCameraAnimation();
}
if (vaultingFound == 0){
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(true, /* NOP
*/);
}
StopHandIK(true, true);
m_ExplorationO.m_MoverO.SetManualMovement(false);
if (restoreUsableItemLAtEnd){
restoreUsableItemLAtEnd = false;
thePlayer.OnUseSelectedItem(/* NOP */);
}
thePlayer.ReapplyCriticalBuff();
/* NOP */;
}
public function StateUpdateInactive(_Dt : Float){

UpdateAndSetHandsIKBlend(_Dt);
/* NOP */;
}
private function RemoveAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimCanFall);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimEnded);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimCanWalk);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimCanRun);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimAdjustIni
tRot);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimAdjustRot
);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behAnimAdjustTra
ns);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behDisablePelvis
Trans);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behEnableIK);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behEnableHandsIK
);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behEnableHandLIK
);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behEnableHandRIK
);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behDisableHandsI
K);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behDisableHandLI
K);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(behDisableHandRI
K);
/* NOP */;
}
public function ReactToLoseGround() : Bool{
return true;
/* NOP */;
}
public function ReactToHitGround() : Bool{
return true;
/* NOP */;
}
public function CanInteract() : Bool{
return false;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
var duration : Float;
var unwantedEvent : Bool;
var text : String;
duration = -1.000000;
unwantedEvent = false;
if (animEventName == behAnimCanFall){
canFall = true;
} else if (animEventName == behAnimEnded){
ended = true;
canWalk = true;
canRun = true;
} else if (!canWalk && animEventName == behAnimCanWalk){
canWalk = true;
} else if (!canRun && animEventName == behAnimCanRun){
canRun = true;

} else if (animEventName == behAnimAdjustInitRot && !adjustIniti


alRotDone){
duration = GetEventDurationFromEventAnimInfo(animInfo);
StartMovementAdjustorInitialRotation(duration);
} else if (animEventName == behAnimAdjustRot && !adjustRotDone){
duration = GetEventDurationFromEventAnimInfo(animInfo);
StartMovementAdjustorRotation(duration);
} else if (animEventName == behAnimAdjustTrans && !adjustTransDo
ne){
duration = GetEventDurationFromEventAnimInfo(animInfo);
StartMovementAdjustorTranslation(duration);
if (pelvisTransAllow && pelvisTransState == 0){
pelvisTransState = 1;
}
} else if (animEventName == behDisablePelvisTrans){
CorrectPelvisStartEnd();
} else if (animEventName == behEnableIK){
if (vaultingFound == 0){
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(true,
/* NOP */);
} else
} else
} else
} else
} else
} else
} else

ApplyFakeGravity();
}
if (animEventName == behEnableHandsIK){
handIKqueuedL = true;
handIKqueuedR = true;
if (animEventName == behEnableHandLIK){
handIKqueuedL = true;
if (animEventName == behEnableHandRIK){
handIKqueuedR = true;
if (animEventName == behDisableHandsIK){
StopHandIK(true, true);
if (animEventName == behDisableHandLIK){
StopHandIK(true, false);
if (animEventName == behDisableHandRIK){
StopHandIK(false, true);
{
unwantedEvent = true;

}
if (!unwantedEvent){
text = "GotEvent: " + animEventName;
if (duration >= 0.000000){
text += " duration " + duration;
}
LogExplorationClimb(text);
}
/* NOP */;
}
private function InitClimbs(){
var i : Int32;
i = 0;
while (i < climbTypes.Size()){
InitializeClimb(i);
i += 1;
}
/* NOP */;
}
private function InitializeClimb(i : Int32){
if (climbTypes[i].heightUseDefaults){
switch(climbTypes[i].type){
case 0:

climbTypes[i].heightMin = 0.300000;
climbTypes[i].heightMax = 0.750000;
break;
case 1:
climbTypes[i].heightMin = 0.750000;
climbTypes[i].heightMax = 1.500000;
break;
case 2:
climbTypes[i].heightMin = 1.500000;
climbTypes[i].heightMax = 2.000000;
break;
case 3:
climbTypes[i].heightMin = 2.000000;
climbTypes[i].heightMax = 2.500000;
break;
case 4:
climbTypes[i].heightMin = 2.500000;
climbTypes[i].heightMax = 3.000000;
break;
case 5:
climbTypes[i].heightMin = 3.000000;
climbTypes[i].heightMax = 4.000000;
break;
}
if (climbTypes[i].type == 1){
climbTypes[i].heightExact = 1.000000;
} else {
climbTypes[i].heightExact = climbTypes[i].height
Min;
}
} else {
climbTypes[i].heightUseDefaults = climbTypes[i].heightUs
eDefaults;
}
/* NOP */;
}
private function ComputeMinMaxHeight(heightTotalMin : Float, heightTotal
Max : Float){
var i : Int32;
heightTotalMin = climbTypes[0].heightMin;
heightTotalMax = climbTypes[0].heightMax;
platformHeightMin = 1000.000000;
platformHeightMinAir = 1000.000000;
heightMaxToRun = 0.000000;
i = 0;
while (i < climbTypes.Size()){
if (climbTypes[i].requiredState == 4 && heightMaxToRun <
climbTypes[i].heightMax){
heightMaxToRun = climbTypes[i].heightMax;
}
if (climbTypes[i].requiredPlatform == 1){
if (climbTypes[i].requiredState == 1 || climbTyp
es[i].requiredState == 2){
if (climbTypes[i].heightMin < platformHe
ightMinAir){
platformHeightMinAir = climbType
s[i].heightMin;
}
} else if (climbTypes[i].heightMin < platformHei
ghtMin){

platformHeightMin = climbTypes[i].height
Min;
}
}
if (heightTotalMax < climbTypes[i].heightMax){
heightTotalMax = climbTypes[i].heightMax;
}
if (heightTotalMin > climbTypes[i].heightMin){
heightTotalMin = climbTypes[i].heightMin;
}
i += 1;
}
/* NOP */;
}
private function FindPlayerState() : EClimbRequirementType{
if (m_ExplorationO.GetStateTypeCur() == 2){
if (forceAirCollision){
return 2;
} else if (forceJumpGrab){
return 1;
}
if (m_ExplorationO.GetStateCur() == 'AirCollision'){
return 2;
}
return 1;
} else if (m_ExplorationO.GetStateTypeCur() == 3){
return 3;
} else if (thePlayer.GetIsRunning() && m_ExplorationO.m_InputO.I
sModuleConsiderable()){
return 4;
}
return 0;
/* NOP */;
}
private function InputWantsToEnter() : Bool{
if (m_ExplorationO.m_InputO.IsExplorationJustPressed()){
return true;
} else if (m_ExplorationO.GetStateTypeCur() == 2 && m_Exploratio
nO.m_InputO.IsExplorationPressed()){
return true;
} else {
return false;
}
/* NOP */;
}
private function ComputeInput(){
inputAttemptsTop = !thePlayer.GetIsRunning();
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
inputDirection = m_ExplorationO.m_InputO.GetMovementOnPl
aneNormalizedV();
} else {
inputDirection = m_ExplorationO.m_OwnerE.GetWorldForward
();
}
/* NOP */;
}
private function OracleWantsToEnter() : Bool{
var originPosition : Vector;
var logFails : Bool;
var distanceType : EClimbDistanceType;

var requireInputDir : Bool;


logFails = m_ExplorationO.m_InputO.IsExplorationJustPressed();
originPosition = m_ExplorationO.m_OwnerE.GetWorldPosition();
distanceType = GetDistanceType();
requireInputDir = m_ExplorationO.m_InputO.IsModuleConsiderable()
;
m_ClimbOracleO.ComputeAll(inputAttemptsTop, originPosition, inpu
tDirection, distanceType, requireInputDir, logFails);
if (!m_ClimbOracleO.CanWeClimb()){
return false;
}
m_ClimbOracleO.GetClimbData(heightTarget, vaultingFound, vaultEn
dsFalling, platformFound, climbPoint, wallNormal);
return true;
/* NOP */;
}
private function GetDistanceType() : EClimbDistanceType{
if (curPlayerStateType == 1){
return 1;
} else if (curPlayerStateType == 4){
return 2;
} else if (curPlayerStateType == 2){
return 2;
}
return 0;
/* NOP */;
}
private function PreRefineIsValid() : Bool{
var dot : Float;
var distance2D : Float;
if (curPlayerStateType == 4 && heightTarget < 0.750000){
LogExplorationClimb("Climb skipped because of running st
ate and height < 0.75f");
return false;
}
if (curPlayerStateType == 4 && heightTarget >= 3.000000){
distance2D = VecDistanceSquared2D(climbPoint, m_Explorat
ionO.m_OwnerE.GetWorldPosition());
if (distance2D > slideDistMaxOnRun * slideDistMaxOnRun){
LogExplorationClimb("Climb skipped because of ru
nning state and distance " + distance2D + " > " + slideDistMaxOnRun * slideDistM
axOnRun);
return false;
}
}
if (curPlayerStateType == 4){
dot = VecDot(wallNormal, inputDirection);
if (dot > -0.650000){
LogExplorationClimb("Climb skipped because of ru
nning state and dot from input to wall " + dot + " > -0.65f");
return false;
}
}
return true;
/* NOP */;
}
private function RefinePlayerState(){
if (curPlayerStateType == 4 && heightTarget > heightMaxToRun){
curPlayerStateType = 0;
}

if (platformFound == 1){
if (curPlayerStateType == 1 || curPlayerStateType == 2){
if (heightTarget < platformHeightMinAir){
platformFound = 0;
}
} else if (heightTarget < platformHeightMin){
platformFound = 0;
}
}
/* NOP */;
}
private function PostRefineState(){
var characterPos : Vector;
var distance2D : Float;
return;
if (curPlayerStateType == 4){
characterPos = m_ExplorationO.m_OwnerMAC.GetWorldPositio
n();
distance2D = VecDistance2D(characterPos, climbPoint);
if (distance2D < climbCur.forwardDistExact){
curPlayerStateType = 0;
FindApropriateClimb();
}
}
/* NOP */;
}
private function FindApropriateClimb() : Bool{
var i : Int32;
var searchingForState : EClimbRequirementType;
searchingForState = curPlayerStateType;
if (searchingForState == 2){
searchingForState = 1;
}
i = 0;
while (i < climbTypes.Size()){
if (climbTypes[i].requiredState != searchingForState){
} else if (vaultingFound != climbTypes[i].requiredVault)
{
} else if (platformFound != climbTypes[i].requiredPlatfo
rm){
} else if (climbTypes[i].heightMax < heightTarget || cli
mbTypes[i].heightMin > heightTarget){
} else {
climbCur = climbTypes[i];
return true;
}
i += 1;
}
LogExplorationClimb(" Could not find adequate climb type. height
Target: " + heightTarget + ", State required: " + curPlayerStateType + ", vaulti
ngFound: " + vaultingFound + ", platformFound: " + platformFound);
return false;
/* NOP */;
}
private function SetBehaviorData(){
m_ExplorationO.m_SharedDataO.SetFotForward(/* NOP */);
SetTranslationToBehaviour();
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behVarEnd, 0, /* NOP
*/);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behHeightTypeEnum, c

limbCur.type, /* NOP */);


m_ExplorationO.m_OwnerE.SetBehaviorVariable(behVaultTypeEnum, cl
imbCur.requiredVault, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behPlatformTypeEnum,
climbCur.requiredPlatform, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behStateTypeEnum, cl
imbCur.requiredState, /* NOP */);
if (climbCur.requiredVault == 1){
m_ExplorationO.m_SharedDataO.m_JumpTypeE = 9;
m_ExplorationO.m_OwnerE.SetBehaviorVariable('JumpType',
9, /* NOP */);
} else {
m_ExplorationO.m_SharedDataO.m_JumpTypeE = 0;
m_ExplorationO.m_OwnerE.SetBehaviorVariable('JumpType',
0, /* NOP */);
}
/* NOP */;
}
private function SetProperCameraAnim(reset : Bool, speed : Float){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
if (!updateCameraAnim || !climbCur.playCameraAnimation){
return;
}
animation.animation = climbCur.cameraAnimation;
animation.priority = 10;
animation.blendIn = 0.500000;
animation.blendOut = 0.500000;
animation.weight = 1.000000;
animation.speed = speed;
animation.loop = false;
animation.additive = false;
animation.reset = reset;
camera.PlayAnimation(animation);
/* NOP */;
}
private function CancelCameraAnimation(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
camera.StopAnimation(climbCur.cameraAnimation);
/* NOP */;
}
private function SetInitialMovementAdjustor(){
m_ExplorationO.m_OwnerMAC.GetMovementAdjustor().CancelByName('tu
rnOnJump');
ApplyAnimationSpeed(1.000000);
PrepareMovementAdjustorParameters();
/* NOP */;
}
private function PrepareMovementAdjustorParameters(){
var initialrotation : Float;
var rotation : Float;
var translation : Vector;
var translationBackDist : Float;
var distanceToAdd : Float;
var characterPos : Vector;
var translationGoesBack : Bool;
var isCiri : Bool;
heightToAdd = heightTarget - climbCur.heightExact;

characterRadius = 0.400000;
characterPos = m_ExplorationO.m_OwnerMAC.GetWorldPosition();
rotation = VecHeading(-wallNormal);
translation = climbPoint - characterPos;
initialrotation = VecHeading(translation);
translation += wallNormal * characterRadius;
translationBackDist = MaxF(0.000000, VecDot(translation, wallNor
mal));
isCiri = false;
if ((W3ReplacerCiri)thePlayer){
isCiri = true;
}
if (isCiri){
translationBackDist += 0.125000;
} else {
translationBackDist += 0.050000;
}
distanceToAdd = VecLength(translation);
translation -= wallNormal * characterRadius - climbCur.forwardDi
stExact;
translation.Z = heightToAdd;
adjustInitiallRotat = initialrotation;
adjustRotation = rotation;
adjustTranslation = translation;
adjustInitialRotDone = false;
adjustRotDone = false;
adjustTransDone = false;
adjustSpeedRequire = false;
if (translationBackDist > 0.000000){
StartMovementAdjustorInitialTranslation(translationBackD
ist * wallNormal);
}
/* NOP */;
}
private function StartMovementAdjustorTranslation(duration : Float){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
var ticket2 : SMovementAdjustmentRequestTicket;
var distance : Float;
var speed : Float;
var timeRequired : Float;
var animSpeedCoef : Float;
if (noAdjustor){
return;
}
if (adjustTranslation == Vector(0, 0, 0)){
return;
}
distance = VecLength(adjustTranslation);
speed = distance / duration;
if (speed > adjustSpeedMax){
timeRequired = distance / adjustSpeedMax;
animSpeedCoef = duration / timeRequired;
duration = timeRequired;
adjustSpeedRequire = true;
adjustSpeedEndTime = m_ExplorationO.GetStateTimeF() + du
ration;
ApplyAnimationSpeed(animSpeedCoef);
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();

ticket = movAdj.CreateNewRequest('ClimbAdjusTranslation');
movAdj.AdjustmentDuration(ticket, duration);
movAdj.AdjustLocationVertically(ticket, true);
movAdj.SlideBy(ticket, adjustTranslation);
adjust2Dduration = duration;
adjust2Translation = Vector(adjustTranslation.X, adjustTranslati
on.Y, 0.000000);
adjust2Speed = VecLength2D(adjust2Translation) / duration;
adjustTransDone = true;
/* NOP */;
}
private function StartMovementAdjustorInitialRotation(duration : Float){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
var angle : Float;
if (noAdjustor){
return;
}
if (adjustInitiallRotat == m_ExplorationO.m_OwnerE.GetHeading())
{
return;
}
angle = AngleDistance(adjustInitiallRotat, adjustRotation);
if (AbsF(angle) > 90.000000){
adjustInitiallRotat = adjustRotation;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
ticket = movAdj.CreateNewRequest('ClimbAdjusInitialRotation');
movAdj.AdjustmentDuration(ticket, duration);
movAdj.LockMovementInDirection(ticket, adjustInitiallRotat);
movAdj.RotateTo(ticket, adjustInitiallRotat);
adjustInitialRotDone = true;
/* NOP */;
}
private function StartMovementAdjustorInitialTranslation(translationBack
: Vector){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (noAdjustor){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
ticket = movAdj.CreateNewRequest('ClimbAdjusInitialTranslation')
;
movAdj.AdjustmentDuration(ticket, 0.100000);
movAdj.AdjustLocationVertically(ticket, true);
movAdj.SlideBy(ticket, translationBack);
/* NOP */;
}
private function StartMovementAdjustorRotation(duration : Float){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (noAdjustor){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
movAdj.CancelByName('ClimbAdjusInitialRotation');
if (adjustRotation == m_ExplorationO.m_OwnerE.GetHeading()){
return;
}

ticket = movAdj.CreateNewRequest('ClimbAdjusRotation');
movAdj.AdjustmentDuration(ticket, duration);
movAdj.RotateTo(ticket, adjustRotation);
adjustRotDone = true;
/* NOP */;
}
private function ApplyFakeGravity(){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (noAdjustor){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
ticket = movAdj.CreateNewRequest('ClimbFakeGravity');
movAdj.AdjustmentDuration(ticket, 0.500000);
movAdj.AdjustLocationVertically(ticket, true);
movAdj.SlideBy(ticket, Vector(0.000000, 0.000000, -0.750000));
adjustTransDone = true;
/* NOP */;
}
private function UpdateAdjusting2D(_Dt : Float){
var movAdj : CMovementAdjustor;
var distance : Float;
if (adjust2Dduration > 0.000000){
movAdj.AddOneFrameTranslationVelocity(adjust2Translation
* adjust2Speed);
adjust2Dduration -= _Dt;
}
/* NOP */;
}
private function ApplyAnimationSpeed(speed : Float){
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behAnimSpeed, speed,
/* NOP */);
SetProperCameraAnim(false, speed);
/* NOP */;
}
private function StartMovementAdjustorCorrectPelvis(){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (noPelvisCorection || noAdjustor){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
ticket = movAdj.CreateNewRequest('ClimbAdjusPelvisCorrection');
movAdj.AdjustmentDuration(ticket, 0.200000);
movAdj.SlideBy(ticket, m_ExplorationO.m_OwnerE.GetWorldForward()
* pelvisTransCur);
/* NOP */;
}
private function StartHandIK(left : Bool, right : Bool){
var rightHand : Vector;
var leftHand : Vector;
var normal : Vector;
var world : CWorld;
if (left){
leftHand = m_ExplorationO.m_OwnerE.GetBoneWorldPositionB
yIndex(boneIndexLeftHand);
leftHand.Z = climbPoint.Z;
handIKLRayOrigin = leftHand + m_ExplorationO.m_OwnerE.Ge
tWorldForward() * handIKForwardOffset;

handIKLRayEnd = handIKLRayOrigin;
handIKLRayOrigin.Z += handIKHalfMaxHeight;
handIKLRayEnd.Z -= handIKHalfMaxHeight;
world = theGame.GetWorld();
if (world){
if (world.SweepTest(handIKLRayOrigin, handIKLRay
End, 0.200000, handIKLRayCollision, normal, collisionObstaclesNames)){
leftHandOffset = handIKLRayCollision.Z leftHand.Z + handThickness;
if (AbsF(leftHandOffset) >= handIKMinDis
tToEnable){
handIKEnabledLeft = true;
leftHandOffset = ClampF(leftHand
Offset, -handIKMaxDist, handIKMaxDist);
}
}
}
}
if (right){
rightHand = m_ExplorationO.m_OwnerE.GetBoneWorldPosition
ByIndex(boneIndexRightHand);
rightHand.Z = climbPoint.Z;
handIKRRayOrigin = rightHand + m_ExplorationO.m_OwnerE.G
etWorldForward() * handIKForwardOffset;
handIKRRayEnd = handIKRRayOrigin;
handIKRRayOrigin.Z += handIKHalfMaxHeight;
handIKRRayEnd.Z -= handIKHalfMaxHeight;
if (theGame.GetWorld().SweepTest(handIKRRayOrigin, handI
KRRayEnd, 0.200000, handIKRRayCollision, normal, collisionObstaclesNames)){
rightHandOffset = handIKRRayCollision.Z - rightH
and.Z + handThickness;
if (AbsF(rightHandOffset) >= handIKMinDistToEnab
le){
handIKEnabledRight = true;
rightHandOffset = ClampF(rightHandOffset
, -handIKMaxDist, handIKMaxDist);
}
}
}
if (handIKEnabledLeft || handIKEnabledRight){
m_ExplorationO.m_OwnerMAC.SetEnabledHandsIK(true);
handIKEnabled = true;
}
/* NOP */;
}
private function StopHandIK(left : Bool, right : Bool){
if (left){
leftHandOffset = 0.000000;
handIKEnabledLeft = false;
}
if (right){
rightHandOffset = 0.000000;
handIKEnabledRight = false;
}
/* NOP */;
}
private function UpdateHandsIK(_Dt : Float){
if (handIKqueuedL || handIKqueuedR){
StartHandIK(handIKqueuedL, handIKqueuedR);
if (handIKqueuedL && handIKEnabledLeft){

handIKqueuedL = false;
}
if (handIKqueuedR && handIKEnabledRight){
handIKqueuedR = false;
}
} else if (continousHandIK){
if (handIKEnabledLeft || handIKEnabledRight){
StartHandIK(handIKEnabledLeft, handIKEnabledRigh
t);
}
}
UpdateAndSetHandsIKBlend(_Dt);
/* NOP */;
}
private function UpdateAndSetHandsIKBlend(_Dt : Float){
if (handIKEnabledLeft || handIKEnabledRight || AbsF(leftHandOffs
etCur) > 0.000000 || AbsF(rightHandOffsetCur) > 0.000000){
if (leftHandOffset == 0.000000){
leftHandOffsetCur = BlendLinearF(leftHandOffsetC
ur, leftHandOffset, _Dt * handIKBlendSpeedOut);
} else {
leftHandOffsetCur = BlendLinearF(leftHandOffsetC
ur, leftHandOffset, _Dt * handIKBlendSpeedIn);
}
if (rightHandOffset == 0.000000){
rightHandOffsetCur = BlendLinearF(rightHandOffse
tCur, rightHandOffset, _Dt * handIKBlendSpeedOut);
} else {
rightHandOffsetCur = BlendLinearF(rightHandOffse
tCur, rightHandOffset, _Dt * handIKBlendSpeedIn);
}
m_ExplorationO.m_OwnerMAC.SetHandsIKOffsets(leftHandOffs
etCur, rightHandOffsetCur);
} else if (handIKEnabled && !handIKEnabledLeft && !handIKEnabled
Right && leftHandOffsetCur == 0.000000 && rightHandOffsetCur == 0.000000){
m_ExplorationO.m_OwnerMAC.SetEnabledHandsIK(false);
handIKEnabled = false;
}
/* NOP */;
}
private function UpdateTranslationOutsideCapsule(_Dt : Float){
switch(pelvisTransState){
case 0:
break;
case 1:
UpdateTargetPelvisTranslationTarget();
pelvisTransCur = BlendLinearF(pelvisTransCur, pelvisTran
sTarget, pelvisTransSpeed * _Dt);
SetTranslationToBehaviour();
if (pelvisTransCur < pelvisTransSpeed * _Dt){
pelvisTransState = 2;
}
break;
case 2:
UpdateTargetPelvisTranslationTarget();
pelvisTransCur = pelvisTransTarget;
SetTranslationToBehaviour();
break;
case 3:
break;

}
/* NOP */;
}
private function UpdateTargetPelvisTranslationTarget(){
var directionToPoint : Vector;
directionToPoint = climbPoint - m_ExplorationO.m_OwnerE.GetWorld
Position();
directionToPoint.Z = 0.000000;
directionToPoint = directionToPoint * VecDot(directionToPoint, m
_ExplorationO.m_OwnerE.GetWorldForward());
pelvisTransTarget = VecLength2D(directionToPoint) - characterRad
ius + 0.100000;
pelvisTransTarget = ClampF(pelvisTransTarget, 0.000000, pelvisTr
ansMax);
/* NOP */;
}
private function CorrectPelvisStartEnd(){
if (pelvisTransState == 2 || pelvisTransState == 1){
pelvisTransState = 3;
pelvisTransTarget = 0.000000;
ResetTranslationToBehaviour();
StartMovementAdjustorCorrectPelvis();
}
/* NOP */;
}
private function SetTranslationToBehaviour(){
if (noPelvisCorection){
return;
}
m_ExplorationO.m_OwnerMAC.SetAdditionalOffsetToConsumeMS(Vector(
0.000000, pelvisTransCur, 0.000000), EulerAngles(0.000000, 0.000000, 0.000000),
1.000000);
/* NOP */;
}
private function ResetTranslationToBehaviour(){
if (noPelvisCorection){
return;
}
m_ExplorationO.m_OwnerMAC.SetAdditionalOffsetToConsumeMS(Vector(
0.000000, pelvisTransCur, 0.000000), EulerAngles(0.000000, 0.000000, 0.000000),
0.100000);
/* NOP */;
}
private function UpdateRunOrWalk(){
var runValue : Float;
if (m_ExplorationO.m_InputO.IsModuleConsiderable() && AbsF(m_Exp
lorationO.m_InputO.GetHeadingDiffFromPlayerF()) < inputAngleToRun){
if (thePlayer.GetIsRunning()){
runValue = 1.000000;
} else {
runValue = 0.500000;
}
} else {
runValue = 0.000000;
}
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behToRun, runValue,
/* NOP */);
/* NOP */;
}
private function CheckVerticalSlideEnd(){

var posCur : Vector;


if (vaultingFound == 0){
posCur = m_ExplorationO.m_OwnerE.GetWorldPosition();
if (posCur.Z > heightTarget + 0.100000){
m_ExplorationO.m_CollisionManagerO.EnableVertica
lSliding(false);
}
}
/* NOP */;
}
public function UpdateCameraIfNeeded(moveData : SCameraMovementData, dt
: Float) : Bool{
var blend : Float;
var targetPos : Vector;
var position : Vector;
var rotation : EulerAngles;
var positionDesired : Vector;
var rotationDesired : EulerAngles;
var inputX : Float;
var inputY : Float;
if (!updateCameraManual){
return false;
}
targetPos = m_ExplorationO.m_OwnerE.GetBoneWorldPositionByIndex(
camFollowBoneID);
rotationDesired = m_ExplorationO.m_OwnerE.GetWorldRotation();
if (camStart == true){
camOriginalPosition = moveData.pivotPositionValue;
camOriginalRotation = moveData.pivotRotationValue;
camCurRotation = rotationDesired;
camOriginalOffset = moveData.cameraLocalSpaceOffset;
camStart = false;
}
inputX = theInput.GetActionValue('GI_AxisRightX');
inputY = theInput.GetActionValue('GI_AxisRightY');
camCurRotation.Yaw = camCurRotation.Yaw - inputX * dt * 200.0000
00;
camCurRotation.Pitch = ClampF(camCurRotation.Pitch + inputY * dt
* 100.000000, -45.000000, 45.000000);
camOriginalRotation.Yaw = LerpAngleF(dt * 5.000000, camOriginalR
otation.Yaw, camCurRotation.Yaw);
camOriginalRotation.Pitch = LerpAngleF(dt * 5.000000, camOrigina
lRotation.Pitch, camCurRotation.Pitch);
positionDesired = targetPos - m_ExplorationO.GetWorldForward() *
0.800000 + m_ExplorationO.m_OwnerE.GetWorldUp() * 0.800000;
camOriginalPosition = LerpV(camOriginalPosition, positionDesired
, dt * 2.000000);
moveData.pivotPositionValue = camOriginalPosition;
moveData.pivotRotationValue = camOriginalRotation;
moveData.cameraLocalSpaceOffset = camOriginalOffset;
moveData.pivotPositionVelocity = Vector(0.000000, 0.000000, 0.00
0000);
moveData.pivotRotationVelocity = EulerAngles(0.000000, 0.000000,
0.000000);
return true;
/* NOP */;
}
public function GetDebugText() : String{
var text : String;
text = climbCur.type + ", " + climbCur.requiredVault + ", " + cl

imbCur.requiredPlatform + ", " + climbCur.requiredState + ", " + "PelvisT: " + p


elvisTransCur;
return text;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, active : Bool) : Bool{
var colorAux : Color;
m_ClimbOracleO.OnVisualDebug(frame, flag, active);
colorAux = Color(80, 200, 80);
frame.DrawText(GetClimbTypeText(), climbPoint + Vector(0.000000,
0.000000, 1.000000) + VecFromHeading(adjustRotation) * 2.000000, colorAux);
colorAux = Color(100, 255, 100);
frame.DrawSphere(climbPoint, 0.100000, colorAux);
frame.DrawLine(climbPoint, climbPoint + wallNormal, colorAux);
colorAux = Color(255, 255, 255);
frame.DrawLine(handIKLRayOrigin, handIKLRayEnd, colorAux);
frame.DrawText("IK: " + leftHandOffsetCur, handIKLRayCollision,
colorAux);
frame.DrawLine(handIKRRayOrigin, handIKRRayEnd, colorAux);
frame.DrawText("IK: " + rightHandOffsetCur, handIKRRayCollision,
colorAux);
return true;
/* NOP */;
}
private function DebugLogSuccesfullClimb(){
LogExplorationClimb("------------------ Climb Found -----------------");
LogExplorationClimb(GetClimbTypeText());
LogExplorationClimb("Translation " + VecToString(adjustTranslati
on) + ", Rotation " + adjustRotation + ", heightToAdd " + heightToAdd);
m_ClimbOracleO.DebugLogSuccesfullClimb();
LogExplorationClimb("------------------ ------ -----------------");
/* NOP */;
}
private function GetClimbTypeText() : String{
return climbCur.requiredState + ", " + climbCur.type + ", " + cl
imbCur.requiredVault + ", " + climbCur.requiredPlatform;
/* NOP */;
}
}
import abstract class CBehaviorGraphGetBoneTransformNode{
}
import abstract class CBehaviorEventDescription{
}
import abstract class CBaseBehaviorVariable{
}
class CR4HudModuleInteractions extends CR4HudModuleBase{
public var bShowHoldIndicator : Bool;
public var bShowInteraction : Bool;
public var bShowFocusInteractions : Bool;
private var m_fxDisableHoldIndicator : CScriptedFlashFunction;
private var m_fxEnableHoldIndicator : CScriptedFlashFunction;
private var m_fxSetInteractionKeySFF : CScriptedFlashFunction;
private var m_fxSetInteractionIconSFF : CScriptedFlashFunction;

private var m_fxSetInteractionTextSFF : CScriptedFlashFunction;


private var m_fxSetInteractionIconAndTextSFF : CScriptedFlashFunction;
private var m_fxSetInteractionKeyIconAndTextSFF : CScriptedFlashFunction
;
private
private
private
private

var
var
var
var

m_fxAddFocusInteractionIconSFF : CScriptedFlashFunction;
m_fxSetInteractionHoldDuration : CScriptedFlashFunction;
m_fxRemoveFocusInteractionIconSFF : CScriptedFlashFunction;
m_fxUpdateFocusInteractionIconPositionSFF : CScriptedFlashFu

nction;
private var m_fxSetVisibilitySFF : CScriptedFlashFunction;
private var m_fxSetVisibilityExSFF : CScriptedFlashFunction;
private var m_fxSetPositionsSFF : CScriptedFlashFunction;
private var _interactionEntity : CGameplayEntity;
private var _interactionEntityComponent : CInteractionComponent;
private var m_focusInteractionIcons : array<SFocusInteractionIcon>;
private var m_previouslyShow : Bool;
private var m_previousInteractionEntity : CGameplayEntity;
private var m_previousDisplayEntity : CGameplayEntity;
private var m_previousDisplayEntityDataRet : Bool;
private var m_forceUpdate : Bool;
private var m_currentHoldInteraction : CName;
private const var FOCUS_INTERACION_UPDATE_INTERVAL : Float;
private const var FOCUS_INTERACION_RADIUS : Float;
private const var FOCUS_INTERACTION_OPAQUE_ICON_RADIUS : Float;
private const var FOCUS_INTERACTION_TRANSPARENT_ICON_RADIUS : Float;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
flashModule = GetModuleFlash();
m_anchorName = "ScaleOnly";
m_fxEnableHoldIndicator = flashModule.GetMemberFlashFunction("En
ableHoldIndicator");
m_fxDisableHoldIndicator = flashModule.GetMemberFlashFunction("D
isableHoldIndicator");
m_fxSetInteractionKeySFF = flashModule.GetMemberFlashFunction("S
etInteractionKey");
m_fxSetInteractionIconSFF = flashModule.GetMemberFlashFunction("
SetInteractionIcon");
m_fxSetInteractionTextSFF = flashModule.GetMemberFlashFunction("
SetInteractionText");
m_fxSetInteractionIconAndTextSFF = flashModule.GetMemberFlashFun
ction("SetInteractionIconAndText");
m_fxSetInteractionKeyIconAndTextSFF = flashModule.GetMemberFlash
Function("SetInteractionKeyIconAndText");
m_fxSetInteractionHoldDuration = flashModule.GetMemberFlashFunct
ion("SetHoldDuration");
m_fxAddFocusInteractionIconSFF = flashModule.GetMemberFlashFunct
ion("AddFocusInteractionIcon");
m_fxRemoveFocusInteractionIconSFF = flashModule.GetMemberFlashFu
nction("RemoveFocusInteractionIcon");
m_fxUpdateFocusInteractionIconPositionSFF = flashModule.GetMembe
rFlashFunction("UpdateFocusInteractionIconPosition");
m_fxSetVisibilitySFF = flashModule.GetMemberFlashFunction("SetVi
sibility");
m_fxSetVisibilityExSFF = flashModule.GetMemberFlashFunction("Set
VisibilityEx");
m_fxSetPositionsSFF = flashModule.GetMemberFlashFunction("SetPos
itions");
super.OnConfigUI();
m_forceUpdate = false;
ShowElement(false, /* NOP */);

theGame.GetGuiManager().checkHoldIndicator();
/* NOP */;
}
public function OnRequestShowHold() : Bool{
bShowHoldIndicator = true;
/* NOP */;
}
public function OnRequestHideHold() : Bool{
bShowHoldIndicator = false;
/* NOP */;
}
public function OnHoldInteractionCallback() : Bool{
switch(m_currentHoldInteraction){
case 'HorseDismount':
thePlayer.OnDismountActionScriptCallback();
break;
case 'PlaceOfPower':
break;
default:
break;
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var screenPos : Vector;
var displayEntity : CGameplayEntity;
var displayEntityDataRet : Bool;
var currentlyShow : Bool;
var actionName : CName;
var actionText : String;
var key : Int32;
var key2 : Int32;
var keys : array<EInputKey>;
var showInteractionIcon : Bool;
displayEntity = thePlayer.GetDisplayTarget();
if (_interactionEntityComponent && _interactionEntityComponent.G
etActionName() == "Finish"){
if (!thePlayer.IsHoldingDeadlySword()){
_interactionEntity = NULL;
displayEntity = NULL;
}
}
currentlyShow = bShowInteraction || displayEntity || bShowFocusI
nteractions || bShowHoldIndicator && !thePlayer.IsInNonGameplayCutscene();
if (m_previouslyShow != currentlyShow){
m_previouslyShow = currentlyShow;
ShowElement(currentlyShow, bShowHoldIndicator);
}
displayEntityDataRet = false;
if (!_interactionEntity && displayEntity){
displayEntityDataRet = displayEntity.GetInteractionData(
actionName, actionText);
}
if (m_forceUpdate || m_previousInteractionEntity != _interaction
Entity || m_previousDisplayEntity != displayEntity || m_previousDisplayEntityDat
aRet != displayEntityDataRet){
m_forceUpdate = false;
m_previousInteractionEntity = _interactionEntity;
m_previousDisplayEntity = displayEntity;
m_previousDisplayEntityDataRet = displayEntityDataRet;

if (_interactionEntity){
key = _interactionEntityComponent.GetInteraction
Key();
actionName = _interactionEntityComponent.GetInpu
tActionName();
actionText = _interactionEntityComponent.GetInte
ractionFriendlyName();
theInput.GetPCKeysForAction(actionName, keys);
if (keys.Size()){
key2 = keys[0];
}
showInteractionIcon = true;
if (actionName == 'Finish' && theInput.LastUsedP
CInput()){
showInteractionIcon = false;
}
m_fxSetInteractionKeyIconAndTextSFF.InvokeSelfFo
urArgs(FlashArgInt(key), FlashArgInt(key2), FlashArgString(actionName), FlashArg
String(GetLocStringByKeyExt(actionText)));
m_fxSetVisibilityExSFF.InvokeSelfFiveArgs(FlashA
rgBool(true), FlashArgBool(false), FlashArgBool(true), FlashArgBool(showInteract
ionIcon), FlashArgBool(true));
} else if (displayEntity){
if (displayEntityDataRet){
m_fxSetInteractionIconAndTextSFF.InvokeS
elfTwoArgs(FlashArgString(actionName), FlashArgString(GetLocStringByKeyExt(actio
nText)));
m_fxSetVisibilityExSFF.InvokeSelfFiveArg
s(FlashArgBool(true), FlashArgBool(true), FlashArgBool(true), FlashArgBool(false
), FlashArgBool(true));
} else {
m_fxSetVisibilityExSFF.InvokeSelfFiveArg
s(FlashArgBool(true), FlashArgBool(false), FlashArgBool(true), FlashArgBool(fals
e), FlashArgBool(false));
}
} else {
m_fxSetVisibilitySFF.InvokeSelfTwoArgs(FlashArgB
ool(false), FlashArgBool(false));
}
}
if (_interactionEntity){
if (GetInteractionScreenPosition(_interactionEntity, _in
teractionEntityComponent, screenPos, /* NOP */)){
m_fxSetPositionsSFF.InvokeSelfTwoArgs(FlashArgNu
mber(screenPos.X), FlashArgNumber(screenPos.Y));
}
} else if (displayEntity){
if (GetInteractionScreenPosition(displayEntity, NULL, sc
reenPos, /* NOP */)){
m_fxSetPositionsSFF.InvokeSelfTwoArgs(FlashArgNu
mber(screenPos.X), FlashArgNumber(screenPos.Y));
}
}
UpdateFocusInteractionIcons();
/* NOP */;
}
public function OnInteractionsUpdated(component : CInteractionComponent)
: Bool{
var inputActionName : CName;
var actionName : String;

var text : String;


var key : Int32;
var delay : Float;
var interaction : Bool;
var flashValueStorage : CScriptedFlashValueStorage;
var door : W3NewDoor;
var gameplayEnt : CGameplayEntity;
flashValueStorage = GetModuleFlashValueStorage();
if (component){
gameplayEnt = (CGameplayEntity)component.GetEntity();
actionName = component.GetActionName();
if (actionName == "Finish" && gameplayEnt.HasAbility('Fo
rceFinisher')){
SetInteractionEntity(NULL, NULL);
} else {
SetInteractionEntity(gameplayEnt, component);
}
} else {
SetInteractionEntity(NULL, NULL);
}
if (component && thePlayer.IsActionAllowed(21)){
thePlayer.SetIsInsideInteraction(true);
inputActionName = component.GetInputActionName();
if (inputActionName == 'MountHorse'){
thePlayer.SetIsInsideHorseInteraction(true, comp
onent.GetEntity());
}
component.UpdateIconOffset();
door = (W3NewDoor)component.GetEntity();
if (door){
door.UpdateIconOffset(0, 0);
}
delay = -1;
switch(inputActionName){
case 'InteractHold':
delay = -1;
break;
case 'HorseDismount':
delay = 0.500000;
break;
default:
delay = -1;
break;
}
m_fxSetInteractionHoldDuration.InvokeSelfOneArg(FlashArg
Number(delay));
if (!bShowInteraction && actionName != "Finish" && !theP
layer.IsUsingVehicle()){
bShowInteraction = true;
} else if (component.IsEnabledOnHorse()){
bShowInteraction = true;
}
} else {
thePlayer.SetIsInsideInteraction(false);
thePlayer.SetIsInsideHorseInteraction(false, NULL);
bShowInteraction = false;
}
/* NOP */;
}
public function GetInteractionScreenPosition(interactionEntity : CEntity

, interactionComponent : CInteractionComponent, screenPos : Vector, normalized :


Bool) : Bool{
if (!interactionEntity){
return false;
}
if ((CActor)interactionEntity){
if (GetBaseScreenPosition(screenPos, interactionEntity,
/* NOP */, /* NOP */, /* NOP */, normalized)){
return true;
}
} else if (GetBaseScreenPosition(screenPos, interactionEntity, i
nteractionComponent, /* NOP */, /* NOP */, normalized)){
return true;
}
return false;
/* NOP */;
}
protected function SetInteractionEntity(entity : CGameplayEntity, comp :
CInteractionComponent){
_interactionEntity = entity;
_interactionEntityComponent = comp;
/* NOP */;
}
public function IsInteractionInCameraView(interactionComponent : CIntera
ctionComponent) : Bool{
var interactionEntity : CEntity;
var screenPos : Vector;
if (!interactionComponent){
return false;
}
interactionEntity = interactionComponent.GetEntity();
if (!interactionEntity){
return false;
}
if (GetInteractionScreenPosition(interactionEntity, interactionC
omponent, screenPos, true)){
return screenPos.X >= 0.000000 && screenPos.X <= 1.00000
0 && screenPos.Y >= 0.000000 && screenPos.Y <= 1.000000;
}
return false;
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
return false;
/* NOP */;
}
public function ForceUpdateModule(){
m_forceUpdate = true;
/* NOP */;
}
public function EnableHoldIndicator(gpadKeyCode : Int32, kbKeyCode : Int
32, label : String, holdDuration : Float, intName : CName){
var locLabel : String;
locLabel = GetLocStringByKeyExt(label);
m_currentHoldInteraction = intName;
m_fxEnableHoldIndicator.InvokeSelfFourArgs(FlashArgInt(gpadKeyCo
de), FlashArgInt(kbKeyCode), FlashArgString(locLabel), FlashArgNumber(holdDurati
on));
/* NOP */;

}
public function DisableHoldIndicator(){
m_currentHoldInteraction = 'None';
m_fxDisableHoldIndicator.InvokeSelf();
/* NOP */;
}
public function AddFocusInteractionIcon(entity : CEntity, actionName : C
Name){
var i : Int32;
var id : Int32;
var icon : SFocusInteractionIcon;
var component : CInteractionComponent;
var fixedActionName : CName;
var door : W3NewDoor;
id = entity.GetGuidHash();
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (m_focusInteractionIcons[i].m_id == id){
m_focusInteractionIcons[i].m_valid = true;
return;
}
i += 1;
}
icon.m_id = id;
door = (W3NewDoor)entity;
if (door){
door.UpdateIconOffset(0, 0);
icon.m_actionName = 'Door';
} else {
icon.m_actionName = actionName;
}
icon.m_entity = entity;
icon.m_valid = true;
icon.m_canBeSeen = false;
icon.m_isSeen = false;
m_focusInteractionIcons.PushBack(icon);
/* NOP */;
}
public function InvalidateAllFocusInteractionIcons(){
var i : Int32;
i = 0;
while (i < m_focusInteractionIcons.Size()){
m_focusInteractionIcons[i].m_valid = false;
i += 1;
}
/* NOP */;
}
public function RemoveAllFocusInteractionIcons(){
var i : Int32;
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (m_focusInteractionIcons[i].m_isSeen){
m_fxRemoveFocusInteractionIconSFF.InvokeSelfOneA
rg(FlashArgInt(m_focusInteractionIcons[i].m_id));
}
i += 1;
}
m_focusInteractionIcons.Clear();
/* NOP */;
}

public function UpdateFocusInteractionIcons(){


var i : Int32;
var playerPos : Vector;
var screenPos : Vector;
var alpha : Float;
var iconIndex : Int32;
var components : array<CComponent>;
bShowFocusInteractions = m_focusInteractionIcons.Size() > 0;
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (m_focusInteractionIcons[i].m_valid){
i += 1;
} else {
if (m_focusInteractionIcons[i].m_isSeen){
m_fxRemoveFocusInteractionIconSFF.Invoke
SelfOneArg(FlashArgInt(m_focusInteractionIcons[i].m_id));
}
m_focusInteractionIcons.EraseFast(i);
}
/* NOP */;
}
if (bShowInteraction){
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (m_focusInteractionIcons[i].m_isSeen){
m_focusInteractionIcons[i].m_isSeen = fa
lse;
m_fxRemoveFocusInteractionIconSFF.Invoke
SelfOneArg(FlashArgInt(m_focusInteractionIcons[i].m_id));
}
i += 1;
}
} else {
playerPos = thePlayer.GetWorldPosition();
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (GetBaseScreenPosition(screenPos, m_focusInte
ractionIcons[i].m_entity, (CInteractionComponent)m_focusInteractionIcons[i].m_en
tity.GetComponentByClassName('CInteractionComponent'), /* NOP */, /* NOP */, /*
NOP */)){
if (IsPointOnScreen(screenPos)){
m_focusInteractionIcons[i].m_scr
eenPos = screenPos;
m_focusInteractionIcons[i].m_can
BeSeen = true;
m_focusInteractionIcons[i].m_dis
tanceSquared = VecDistanceSquared(playerPos, m_focusInteractionIcons[i].m_entity
.GetWorldPosition());
} else {
m_focusInteractionIcons[i].m_can
BeSeen = false;
}
} else {
m_focusInteractionIcons[i].m_canBeSeen =
false;
}
i += 1;
}
iconIndex = -1;
i = 0;

while (i < m_focusInteractionIcons.Size()){


if (m_focusInteractionIcons[i].m_canBeSeen){
if (iconIndex == -1){
iconIndex = i;
} else if (m_focusInteractionIcons[iconI
ndex].m_distanceSquared > m_focusInteractionIcons[i].m_distanceSquared){
iconIndex = i;
}
}
i += 1;
}
i = 0;
while (i < m_focusInteractionIcons.Size()){
if (iconIndex != i){
if (m_focusInteractionIcons[i].m_isSeen)
{
m_focusInteractionIcons[i].m_isS
een = false;
m_fxRemoveFocusInteractionIconSF
F.InvokeSelfOneArg(FlashArgInt(m_focusInteractionIcons[i].m_id));
}
}
i += 1;
}
if (iconIndex > -1){
if (!m_focusInteractionIcons[iconIndex].m_isSeen
){
m_focusInteractionIcons[iconIndex].m_isS
een = true;
m_fxAddFocusInteractionIconSFF.InvokeSel
fTwoArgs(FlashArgInt(m_focusInteractionIcons[iconIndex].m_id), FlashArgString(m_
focusInteractionIcons[iconIndex].m_actionName));
m_fxUpdateFocusInteractionIconPositionSF
F.InvokeSelfThreeArgs(FlashArgInt(m_focusInteractionIcons[iconIndex].m_id), Flas
hArgNumber(m_focusInteractionIcons[iconIndex].m_screenPos.X), FlashArgNumber(m_f
ocusInteractionIcons[iconIndex].m_screenPos.Y));
if (m_focusInteractionIcons[iconIndex].m
_actionName == 'Aard' && ShouldProcessTutorial('TutorialDestructiblesDescription
')){
components = m_focusInteractionI
cons[iconIndex].m_entity.GetComponentsByClassName('CDestructionSystemComponent')
;
if (components.Size() == 0){
components = m_focusInte
ractionIcons[iconIndex].m_entity.GetComponentsByClassName('CBoatDestructionCompo
nent');
}
if (components.Size() > 0){
FactsAdd("tut_fm_destr_p
repared", /* NOP */, /* NOP */);
}
}
} else {
m_fxUpdateFocusInteractionIconPositionSF
F.InvokeSelfThreeArgs(FlashArgInt(m_focusInteractionIcons[iconIndex].m_id), Flas
hArgNumber(m_focusInteractionIcons[iconIndex].m_screenPos.X), FlashArgNumber(m_f
ocusInteractionIcons[iconIndex].m_screenPos.Y));
}
}
}

/* NOP */;
}
public function GetFocusInteractionUpdateInterval() : Float{
return FOCUS_INTERACION_UPDATE_INTERVAL;
/* NOP */;
}
public function GetFocusInteractionRadius() : Float{
return FOCUS_INTERACION_RADIUS;
/* NOP */;
}
public function OnInputContextChanged(){
m_forceUpdate = true;
/* NOP */;
}
}
import abstract class CBehaviorVariable{
}
import abstract class CMultiTransitionCondition{
}
import abstract class IQuestSpawnsetAction{
}
import abstract class CCompositeTransitionCondition{
}
import abstract class CCompositeSimultaneousTransitionCondition{
}
import abstract class CVariableValueStateTransitionCondition{
}
import abstract class CInternalVariableStateTransitionCondition{
}
import abstract class CEventStateTransitionCondition{
}
import abstract class CAlwaysTransitionCondition{
}
state CPlayerStateTraverseExploration in CPlayer extends CPlayerStateBase{
private var exploration : SExplorationQueryToken;
private var running : Bool;
private var prevState : CName;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
prevState = prevStateName;
running = true;
parent.AddTimer('UpdateTraverser', 0.000000, true, false, 0, /*
NOP */, /* NOP */);
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
theGame.GetGameCamera().ChangePivotDistanceController('Default')
;
ProcessExploration();
/* NOP */;
}

public function OnCanLeaveState(newState : CName) : Bool{


if (newState == 'PlayerDialogScene'){
return true;
}
return !running;
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var traverser : CScriptedExplorationTraverser;
traverser = parent.GetTraverser();
LogAssert(!traverser, "TraverseExploration::SetExploration, 'tra
verser' is still set");
LogAssert(exploration.valid, "TraverseExploration::OnLeaveState,
'exploration' is still valid");
traverser = NULL;
exploration.valid = false;
parent.RemoveTimer('UpdateTraverser', /* NOP */);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public final function SetExploration(e : SExplorationQueryToken){
var traverser : CScriptedExplorationTraverser;
traverser = parent.GetTraverser();
LogAssert(exploration.valid, "TraverseExploration::SetExploratio
n, 'exploration' is already set");
LogAssert(traverser, "TraverseExploration::SetExploration, 'trav
erser' is already set");
exploration = e;
/* NOP */;
}
public entry function ProcessExploration(){
var traverser : CScriptedExplorationTraverser;
var actionResult : Bool;
traverser = parent.GetTraverser();
if (exploration.valid){
/* NOP */;
actionResult = parent.ActionExploration(exploration, /*
NOP */, /* NOP */);
if (actionResult){
/* NOP */;
} else {
/* NOP */;
}
/* NOP */;
} else {
LogAssert(exploration.valid, "TraverseExploration::SetEx
ploration, 'exploration' is not set");
LogAssert(traverser, "TraverseExploration::SetExploratio
n, 'traverser' is not set");
}
exploration.valid = false;
traverser = NULL;
running = false;
parent.PopState(/* NOP */);
/* NOP */;
}
}
import abstract class CIsRagdolledTransitionCondition{
}

import abstract class CAnimEventTransitionCondition{


}
import abstract class CDelayStateTransitionCondition{
}
import abstract class CTimeThresholdStateTransitionCondition{
}
import abstract class CParentInputValueStateTransitionCondition{
}
import abstract class CAnimationEndCondition{
}
import abstract class CBehaviorGraphAlignToGroundNode{
}
import abstract class CBehaviorGraphChooseRecoverFromRagdollAnimNode{
}
import abstract class CBehaviorGraphGetCustomTrackNode{
}
import abstract class CBehaviorGraphGetFloatTrackNode{
}
import abstract class CBehaviorGraphComparatorNode{
}
class CExplorationStateSlide extends CExplorationStateAbstract{
protected var subState : ESlidingSubState;
private editable var enableWallSlide : Bool;
protected editable var useSmothedCoefOnIdle : Bool;
protected editable var angleMinDefault : Float;
protected editable var anglefMax : Float;
protected editable var coefExtraToStop : Float;
protected editable var slideCoefRelatedToInput : Bool;
protected editable var dotToStartForward : Float;
protected editable var coefToStartBackward : Float;
protected editable var coefToStartCenter : Float;
protected editable var coefToStartForward : Float;
protected editable var useWideTerrainCheckToEnter : Bool;
protected var updateMaterials : Bool;
protected editable var materialParams : array<SSlidingMaterialPresetPara
ms>;
protected editable var materialNamesToPresets : array<SSlidingMaterialNa
mesToPresets>;
protected editable var materialParamsDefaultN : CName;
protected var materialDefault : Int32;
protected var materialCurId : Int32;
protected var materialNameCur : CName;
protected editable var minTimeToIdle : Float;
protected editable var orientingInitial : Float;
protected editable var initialImpulse : Float;
protected var startedFromJump : Bool;
protected var startedFromRoll : Bool;
protected editable var orientingSpeedMin : Float;
protected editable var orientingSpeedMax : Float;

protected editable var orientingMaxSlope : Float;


protected editable var timeToHardSlide : Float;
protected editable var behGraphEventSlideHard : CName;
protected editable var requireSpeedToExit : Bool;
protected editable var speedToExitForward : Float;
protected editable var speedToExitCenter : Float;
protected editable var speedToExitBackward : Float;
protected editable var exitingTimeMinSoft : Float;
protected var exitingTimeCur : Float;
protected editable var exitingTimeTotal : Float;
protected editable var exitingTimeTotalInput : Float;
private var stoppingFriction : Bool;
protected editable var cooldownMax : Float;
protected var cooldownCur : Float;
protected var landCoolingDown : Bool;
protected editable var landCoolDownTime : Float;
protected editable var fromJumpBehGraphEvent : CName;
protected editable var fromRollBehGraphEvent : CName;
protected editable var jumpAllowed : Bool;
protected editable var jumpCoolDownTime : Float;
protected editable var fallSpeedMaxConsidered : Float;
protected editable var fallSpeedCoef : Float;
protected editable var fallHorizImpulse : Float;
protected editable var fallHorizImpulseCancel : Float;
protected editable var fallExtraVertImpulse : Float;
protected editable var slidingPhysicsSpeed : Float;
protected editable var movementParams : SSlidingMovementParams;
protected editable var movementStoppingParams : SSlidingMovementParams;
protected editable var usePhysics : Bool;
protected var slideDirectionDamped : Vector;
protected editable var smoothedDirBlendCoef : Float;
private editable var slideKills : Bool;
private var m_DeadB : Bool;
protected editable var toFallEnabled : Bool;
protected var toFallTimeCur : Float;
protected editable var toConsiderFallTimeTotal : Float;
protected editable var toFallTimeTotal : Float;
protected editable var toFallSlopeCoefMin : Float;
protected editable var toFallSlopeSpeedMin : Float;
protected editable var toFallSlopeCoef : Float;
protected editable var toFallSpeedCoef : Float;
protected editable var toFallRecoverCoef : Float;
protected editable var toFallCameraLevel : Int32;
private var cameraShakeState : ESlideCameraShakeState;
protected editable var cameraAnimName : CName;
protected editable var behTripToDeath : CName;
protected editable var behHeightVar : CName;
protected editable var behInclinationVar : CName;
protected editable var behTurnVar : CName;
protected editable var behAccelVar : CName;
protected editable var behRightFootForwardVar : CName;
protected editable var inclinationBlendSpeed : Float;
protected editable var inclinationStart : Float;
protected editable var turnInclinationMax : Float;
protected editable var turnInclinationBlend : Float;
protected editable var turnInclinationCur : Float;
protected editable var inclinationEnterTimeMax : Float;
protected var inclinationEnterTimeCur : Float;
protected var inclination : Float;
protected editable var behForwardVar : CName;

protected editable var behSlideRestart : CName;


protected editable var behSlideEnd : CName;
protected editable var behSlideEndRun : CName;
protected editable var behSlideEndIdle : CName;
protected editable var boneToStickName : CName;
protected var boneToStickId : Int32;
protected editable var animEventHardSliding : CName;
protected var lockedOnHardSliding : Bool;
protected editable var particlesEnabled : Bool;
protected editable var particlesName : CName;
protected editable var boneLeftFoot : CName;
protected editable var boneRightFoot : CName;
protected var timeToRespawnParticlesCur : Float;
protected editable var timeToRespawnParticlesMax : Float;
private function InitializeSpecific(_Exploration : CExplorationStateMana
ger){
var angleMin : Float;
var i : Int32;
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'Slide';
}
SetCanSave(false);
m_ExplorationO.m_OwnerMAC.SetSliding(false);
updateMaterials = m_ExplorationO.m_MoverO.m_UseMaterialsB;
if (updateMaterials){
GrabOrCreateDefaultMaterialParams();
materialCurId = materialDefault;
angleMin = 90.000000;
i = 0;
while (i < materialParams.Size()){
if (angleMin > materialParams[i].angleMin){
angleMin = materialParams[i].angleMin;
}
if (angleMin > materialParams[i].angleMinRain){
angleMin = materialParams[i].angleMinRai
n;
}
i += 1;
}
m_ExplorationO.m_SharedDataO.terrainSlidePresetName = ma
terialParamsDefaultN;
}
m_ExplorationO.m_MoverO.SetSlidingLimits(angleMin, anglefMax);
m_ExplorationO.m_MoverO.SetSlidingParams(movementParams);
m_ExplorationO.m_MoverO.SetSlidingMaterialParams(materialParams[
materialCurId].angleMin, materialParams[materialCurId].frictionMultiplier);
boneToStickId = m_ExplorationO.m_OwnerE.GetBoneIndex(boneToStick
Name);
m_StateTypeE = 1;
m_InputContextE = 2;
m_UpdatesWhileInactiveB = true;
toFallTimeCur = 0.000000;
/* NOP */;
}
protected function AddActionsToBlock(){
AddActionToBlock(0);
AddActionToBlock(8);
AddActionToBlock(24);
AddActionToBlock(25);
AddActionToBlock(29);

/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
if (enableWallSlide){
AddStateToTheDefaultChangeList('WallSlide', -1.000000);
}
/* NOP */;
}
public function StateWantsToEnter() : Bool{
if (!WantsToEnterBasic(/* NOP */)){
return false;
}
if (useWideTerrainCheckToEnter){
if (!WantsToEnterWide()){
return false;
}
}
return true;
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
if (!thePlayer.IsActionAllowed(39)){
return false;
}
if (!m_ExplorationO.IsOnGround()){
return false;
}
return cooldownCur <= 0.000000;
/* NOP */;
}
private function StateEnterSpecific(prevStateName : CName){
var velocity : Vector;
var slideDir : Vector;
var slideNormal : Vector;
var slidingDirDot : Float;
var slidingForward : Bool;
var isRightFootForward : Bool;
m_DeadB = false;
startedFromJump = prevStateName == 'Jump' && m_ExplorationO.GetS
tateTimeF() >= m_ExplorationO.m_SharedDataO.m_SkipLandAnimTimeMaxF;
startedFromRoll = prevStateName == 'Roll';
if (startedFromJump || prevStateName == 'WallSlide'){
CheckLandingDamage();
}
landCoolingDown = prevStateName == 'Land' || prevStateName == 'J
ump';
m_ExplorationO.m_MoverO.SetSlidingParams(movementParams);
m_ExplorationO.m_MoverO.SetSlideSpeedMode(false);
SetTerrainParameters();
m_ExplorationO.m_OwnerMAC.SetSliding(usePhysics);
m_ExplorationO.m_OwnerMAC.SetSlidingSpeed(slidingPhysicsSpeed);
m_ExplorationO.m_MoverO.GetSlideDirAndNormal(slideDir, slideNorm
al);
velocity = m_ExplorationO.m_MoverO.GetMovementVelocity();
velocity -= slideNormal * VecDot(slideNormal, velocity);
velocity += slideDir * initialImpulse;
m_ExplorationO.m_MoverO.SetVelocity(velocity);
slideDirectionDamped = slideDir;
m_ExplorationO.m_SharedDataO.m_JumpDirectionForcedV = slideDir;
inclination = m_ExplorationO.m_MoverO.GetRealSlideAngle();

inclinationEnterTimeCur = inclinationEnterTimeMax;
turnInclinationCur = 0.000000;
slidingDirDot = VecDot(slideDir, m_ExplorationO.m_OwnerE.GetWorl
dForward());
slidingForward = slidingDirDot >= 0.000000;
m_ExplorationO.SetBehaviorParamBool(behForwardVar, slidingForwar
d, /* NOP */);
if (slidingForward){
isRightFootForward = !m_ExplorationO.m_MoverO.IsRightFoo
tForwardTowardsDir(slideDir);
} else {
isRightFootForward = VecDot(slideDir, m_ExplorationO.m_O
wnerE.GetWorldRight()) < 0.000000;
}
m_ExplorationO.SetBehaviorParamBool(behRightFootForwardVar, isRi
ghtFootForward, /* NOP */);
BlockActions();
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(false, /* NOP */);
if (particlesEnabled){
thePlayer.PlayEffectOnBone(particlesName, boneLeftFoot,
/* NOP */);
thePlayer.PlayEffectOnBone(particlesName, boneRightFoot,
/* NOP */);
timeToRespawnParticlesCur = timeToRespawnParticlesMax;
}
toFallCameraLevel = 0;
cameraShakeState = 0;
if (startedFromJump || startedFromRoll){
subState = 2;
lockedOnHardSliding = true;
} else {
subState = 0;
lockedOnHardSliding = false;
}
exitingTimeCur = 0.000000;
thePlayer.AbortSign();
/* NOP */;
}
private function AddAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.AddAnimEventCallback(animEventHardSlidin
g, 'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback('DisableFeetIK', 'O
nAnimEvent_SubstateManager');
/* NOP */;
}
public function StateChangePrecheck() : CName{
if (m_DeadB){
return GetStateName();
}
if (jumpAllowed && m_ExplorationO.GetStateTimeF() >= jumpCoolDow
nTime){
if (!thePlayer.IsCombatMusicEnabled()){
if (m_ExplorationO.StateWantsAndCanEnter('Jump')
){
return 'Jump';
} else if (m_ExplorationO.StateWantsAndCanEnter(
'Climb')){
return 'Climb';
}
}

}
if (subState >= 4){
return 'Idle';
}
if (!lockedOnHardSliding && m_ExplorationO.GetStateTimeF() > exi
tingTimeMinSoft){
if (StateWantsToExit()){
return 'Idle';
}
}
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
var slideDirection : Vector;
var slideNormal : Vector;
var slideCoef : Float;
var targetYaw : Float;
var finalOrientingSpeed : Float;
var newInclination : Float;
var turn : Float;
var accel : Float;
if (m_DeadB){
return;
}
SubstateChangePrecheck(_Dt);
slideCoef = m_ExplorationO.m_MoverO.GetSlideCoef(true, /* NOP */
);
m_ExplorationO.m_MoverO.GetSlideDirAndNormal(slideDirection, sli
deNormal);
UpdateForcedDirection(slideDirection);
finalOrientingSpeed = ComputeOrientingSpeed(slideCoef);
if (slideCoef > 0.000000){
targetYaw = VecHeading(slideDirection);
} else if (m_ExplorationO.m_MoverO.GetMovementSpeedF() > 1.00000
0){
targetYaw = m_ExplorationO.m_MoverO.GetMovementSpeedHead
ingF();
} else {
targetYaw = m_ExplorationO.m_OwnerE.GetHeading();
}
if (!usePhysics && subState != 4){
stoppingFriction = subState == 3 || !WantsToEnterBasic(t
rue);
m_ExplorationO.m_MoverO.UpdateSlidingInertialMovementWit
hInput(_Dt, turn, accel, stoppingFriction, targetYaw, finalOrientingSpeed);
}
UpdateAngleToRotateToAdaptToSlope(slideDirection, _Dt);
m_ExplorationO.m_MoverO.SetSlideSpeedMode(m_ExplorationO.GetStat
eTimeF() > toConsiderFallTimeTotal);
if (slideKills){
UpdateFallCoef(_Dt);
}
if (particlesEnabled && timeToRespawnParticlesMax > 0.000000){
timeToRespawnParticlesCur -= _Dt;
if (timeToRespawnParticlesCur <= 0.000000){
thePlayer.PlayEffectOnBone(particlesName, boneLe
ftFoot, /* NOP */);
thePlayer.PlayEffectOnBone(particlesName, boneRi
ghtFoot, /* NOP */);

timeToRespawnParticlesCur = timeToRespawnParticl
esMax;
}
}
turn *= turnInclinationMax;
turnInclinationCur = BlendF(turnInclinationCur, turn, turnInclin
ationBlend * _Dt);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behTurnVar, turnIncl
inationCur, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behAccelVar, accel,
/* NOP */);
/* NOP */;
}
private function StateExitSpecific(nextStateName : CName){
m_ExplorationO.m_OwnerMAC.SetSliding(false);
if (nextStateName == 'Idle'){
LogExploration("Left slide to Idle");
if (exitingTimeCur < exitingTimeTotal){
m_ExplorationO.SendAnimEvent(behSlideEndRun, /*
NOP */);
} else {
m_ExplorationO.SendAnimEvent(behSlideEndIdle, /*
NOP */);
}
} else if (nextStateName == 'CombatExploration'){
LogExploration("Left slide to Combat");
if (exitingTimeCur < exitingTimeTotal){
m_ExplorationO.SendAnimEvent(behSlideEndRun, /*
NOP */);
} else {
m_ExplorationO.SendAnimEvent(behSlideEndIdle, /*
NOP */);
}
}
thePlayer.SetBIsCombatActionAllowed(true);
if (m_ExplorationO.m_MoverO.GetMovementSpeedF() > 5.000000){
thePlayer.SetIsSprinting(true);
m_ExplorationO.m_OwnerMAC.SetGameplayRelativeMoveSpeed(2
.000000);
}
cooldownCur = cooldownMax;
subState = 0;
if (particlesEnabled){
thePlayer.StopEffect(particlesName);
}
StopCameraAnim();
if (nextStateName == 'StartFalling'){
PrepareFallFromSlide();
}
if (nextStateName != 'StartFalling'){
thePlayer.GoToCombatIfWanted();
}
/* NOP */;
}
private function PrepareFallFromSlide(){
var macVelocity : Vector;
var impulse : Vector;
impulse = m_ExplorationO.m_OwnerE.GetWorldForward();
impulse.Z = 0.000000;
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){

impulse *= fallHorizImpulseCancel;
}
if (VecDot(impulse, m_ExplorationO.m_InputO.GetMovementOnPlaneV(
)) < 0.000000){
impulse *= fallHorizImpulseCancel;
} else {
impulse *= fallHorizImpulse;
}
macVelocity = m_ExplorationO.m_OwnerMAC.GetVelocity();
macVelocity.Z = 0.000000;
if (VecLengthSquared(macVelocity) > fallSpeedMaxConsidered * fal
lSpeedMaxConsidered){
macVelocity = VecNormalize(macVelocity) * fallSpeedMaxCo
nsidered;
}
impulse += macVelocity * fallSpeedCoef;
m_ExplorationO.m_MoverO.SetVelocity(impulse);
m_ExplorationO.m_SharedDataO.m_CanFallSetVelocityB = false;
/* NOP */;
}
private function RemoveAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(animEventHardSli
ding);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback('DisableFeetIK')
;
/* NOP */;
}
public function StateUpdateInactive(_Dt : Float){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
cooldownCur -= _Dt;
toFallTimeCur = MaxF(0.000000, toFallTimeCur - toFallRecoverCoef
* _Dt);
/* NOP */;
}
public function GetBehaviorEventName() : CName{
if (startedFromJump){
return fromJumpBehGraphEvent;
} else if (startedFromRoll){
return fromRollBehGraphEvent;
}
return m_BehaviorEventN;
/* NOP */;
}
public function GetBehaviorIsEventForced(fromState : CName) : Bool{
return true;
/* NOP */;
}
public function GetDebugText() : String{
var text : String;
switch(subState){
case 0:
text = "Entering";
break;
case 1:
text = "Soft Sliding";
break;
case 2:
text = "Hard Sliding";

break;
case 3:
text = "Exiting";
break;
case 4:
text = "Exited";
break;
default:
text = "Unknown substate";
}
text += ". StoppingFriction: " + stoppingFriction;
return text;
/* NOP */;
}
private function GrabOrCreateDefaultMaterialParams(){
var defaultMaterial : SSlidingMaterialPresetParams;
var index : Int32;
materialDefault = -1;
index = FindPresetByName(materialParamsDefaultN);
if (index >= 0){
materialDefault = index;
LogSlidingTerrain("found default sliding terrain paramet
ers in the array");
} else {
LogSlidingTerrain("NOT found default sliding terrain par
ameters in the array, creating defaults");
defaultMaterial.presetName = materialParamsDefaultN;
defaultMaterial.angleMin = angleMinDefault;
defaultMaterial.angleMinRain = angleMinDefault;
defaultMaterial.frictionMultiplier = 1.000000;
defaultMaterial.frictionMultiplierRain = 1.000000;
materialParams.PushBack(defaultMaterial);
materialDefault = materialParams.Size() - 1;
}
/* NOP */;
}
private function WantsToEnterBasic(checkingForExit : Bool) : Bool{
var dot : Float;
var coef : Float;
var result : Bool;
if (useSmothedCoefOnIdle && m_ExplorationO.GetStateCur() == 'Idl
e' || m_ExplorationO.GetStateCur() == 'CombatExploration'){
if (!m_ExplorationO.m_OwnerMAC.IsSliding()){
return false;
}
}
SetTerrainParameters();
if (checkingForExit){
coef = m_ExplorationO.m_MoverO.GetSlideCoef(true, coefEx
traToStop);
} else {
coef = m_ExplorationO.m_MoverO.GetSlideCoef(true, /* NOP
*/);
}
if (coef <= 0.000000){
return false;
}
if (coef < coefToStartBackward){
if (m_ExplorationO.GetStateCur() == 'Land'){
return false;

}
}
dot = m_ExplorationO.m_InputO.GetInputDirOnSlopeDot();
if (slideCoefRelatedToInput){
if (dot <= -dotToStartForward){
result = coef >= coefToStartBackward;
} else if (dot >= dotToStartForward){
result = coef >= coefToStartForward;
} else {
result = coef >= coefToStartCenter;
}
} else if (dot >= dotToStartForward){
result = coef >= coefToStartForward;
} else {
result = coef >= coefToStartBackward;
}
if (!result){
return false;
}
return true;
/* NOP */;
}
public function WantsToEnterWide() : Bool{
var coefWideAverage : Float;
var coefWideGlobal : Float;
coefWideGlobal = m_ExplorationO.m_MoverO.GetSlideWideCoefFromTer
rain(false);
if (coefWideGlobal == 0.000000 || coefWideGlobal < coefToStartFo
rward){
return false;
}
coefWideAverage = m_ExplorationO.m_MoverO.GetSlideWideCoefFromTe
rrain(true);
if (coefWideAverage == 0.000000 || coefWideAverage < coefToStart
Forward){
return false;
}
return true;
/* NOP */;
}
private function StateWantsToExit() : Bool{
if (requireSpeedToExit){
if (!SpeedAllowsExit()){
return false;
}
}
if (WantsToEnterBasic(true)){
return false;
}
return true;
/* NOP */;
}
private function SpeedAllowsExit() : Bool{
var dot : Float;
var speed : Float;
var slowEnough : Bool;
speed = m_ExplorationO.m_MoverO.GetMovementSpeedF();
dot = m_ExplorationO.m_InputO.GetInputDirOnSlopeDot();
if (dot <= -dotToStartForward){
slowEnough = speed < speedToExitBackward;

} else if (dot >= dotToStartForward){


slowEnough = speed < speedToExitForward;
} else {
slowEnough = speed < speedToExitCenter;
}
if (!slowEnough){
return false;
}
return true;
/* NOP */;
}
private function UpdateFallCoef(_Dt : Float){
var speed : Float;
var slideCoef : Float;
var isGoingToFall : Bool;
isGoingToFall = false;
if (!toFallEnabled || m_DeadB){
return;
}
speed = VecLength(m_ExplorationO.m_MoverO.GetDisplacementLastFra
me()) / _Dt;
speed = ClampF(speed / m_ExplorationO.m_MoverO.GetSlideSpeedMax(
), 0.000000, 1.000000);
slideCoef = m_ExplorationO.m_MoverO.GetRawSlideCoef(true);
if (subState == 3){
toFallTimeCur = MaxF(0.000000, toFallTimeCur - toFallRec
overCoef * _Dt);
} else if (slideCoef >= toFallSlopeCoefMin && speed >= toFallSlo
peSpeedMin && m_ExplorationO.GetStateTimeF() > toConsiderFallTimeTotal){
toFallTimeCur += _Dt;
isGoingToFall = true;
ApplySlideDamage(_Dt);
} else {
toFallTimeCur = MaxF(0.000000, toFallTimeCur - toFallRec
overCoef * _Dt);
}
if (toFallTimeCur >= toFallTimeTotal){
}
m_ExplorationO.m_MoverO.SetSlideSpeedMode(isGoingToFall);
SetProperCameraAnim(slideCoef >= toFallSlopeCoefMin);
/* NOP */;
}
private function ApplySlideDamage(_Dt : Float){
var action : W3DamageAction;
var damageValue : Float;
action = new W3DamageAction in this;
action.Initialize(NULL, thePlayer, NULL, "SlidingDamage", 0, 2,
false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.SetCanPlayHitParticle(false);
damageValue = toFallTimeCur / toFallTimeTotal * thePlayer.GetMax
Health() * _Dt;
action.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, damageValue)
;
theGame.damageMgr.ProcessAction(action);
delete action;
/* NOP */;
}
private function SetProperCameraAnim(increasing : Bool){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;

var newState : ESlideCameraShakeState;


camera = theGame.GetGameCamera();
if (toFallTimeCur > 0.000000){
newState = 2;
} else {
newState = 0;
}
if (cameraShakeState == newState){
return;
}
cameraShakeState = newState;
switch(cameraShakeState){
case 2:
animation.weight = 4.000000;
break;
case 1:
StopCameraAnim();
animation.weight = 1.200000;
break;
case 0:
StopCameraAnim();
return;
break;
}
animation.animation = cameraAnimName;
animation.priority = 3;
animation.blendIn = 0.100000;
animation.blendOut = 0.100000;
animation.speed = 3.000000;
animation.additive = true;
animation.reset = false;
animation.loop = true;
camera.PlayAnimation(animation);
/* NOP */;
}
private function StopCameraAnim(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
camera.StopAnimation(cameraAnimName);
/* NOP */;
}
protected function CheckLandingDamage(){
var fallDiff : Float;
var jumpTotalDiff : Float;
var damagePerc : Float;
m_ExplorationO.m_SharedDataO.CalculateFallingHeights(fallDiff, j
umpTotalDiff);
damagePerc = m_ExplorationO.m_OwnerE.ApplyFallingDamage(fallDiff
, true);
m_ExplorationO.m_SharedDataO.ResetHeightFallen();
if (damagePerc >= 1.000000){
m_ExplorationO.m_SharedDataO.GoToRagdoll();
}
LogExploration("Landed height difference " + jumpTotalDiff);
if (damagePerc >= 1.000000){
LogExploration("DEAD from falling");
} else if (damagePerc > 0.000000){
LogExploration("Damaged: " + damagePerc * 100.000000 + "
%");
} else {

LogExploration("Not Damaged from falling");


}
/* NOP */;
}
private function SetTerrainParameters(){
var newMaterial : CName;
var isItRaining : Bool;
if (!updateMaterials){
return;
}
newMaterial = m_ExplorationO.m_OwnerMAC.GetMaterialName();
if (newMaterial == 'None'){
LogSlidingTerrain("!!!! Error: No material found");
return;
}
if (newMaterial == materialNameCur){
return;
}
materialNameCur = newMaterial;
LogSlidingTerrain("Ground material changed: " + materialNameCur)
;
materialCurId = FindMaterialId(materialNameCur);
m_ExplorationO.m_SharedDataO.terrainSlidePresetName = materialPa
rams[materialCurId].presetName;
if (isItRaining){
m_ExplorationO.m_MoverO.SetSlidingMaterialParams(materia
lParams[materialCurId].angleMin, materialParams[materialCurId].frictionMultiplie
r);
} else {
m_ExplorationO.m_MoverO.SetSlidingMaterialParams(materia
lParams[materialCurId].angleMinRain, materialParams[materialCurId].frictionMulti
plierRain);
}
/* NOP */;
}
private function FindMaterialId(materialName : CName) : Int32{
var presetName : CName;
var maxCount : Int32;
var i : Int32;
maxCount = materialNamesToPresets.Size();
i = 0;
while (i < maxCount){
if (materialName == materialNamesToPresets[i].materialNa
me){
presetName = materialNamesToPresets[i].presetNam
e;
LogSlidingTerrain("Material preset corresponding
to name " + materialName + " found, named " + presetName);
break;
}
i += 1;
}
if (i >= maxCount){
LogSlidingTerrain("Material preset corresponding to this
material name ( " + materialName + " ) name not found, using default preset");
return materialDefault;
}
return FindPresetByName(presetName);
/* NOP */;
}

private function FindPresetByName(presetName : CName) : Int32{


var maxCount : Int32;
var i : Int32;
maxCount = materialParams.Size();
i = 0;
while (i < maxCount){
if (presetName == materialParams[i].presetName){
LogSlidingTerrain("Material presset " + presetNa
me + " found");
return i;
}
i += 1;
}
LogSlidingTerrain("!!!ERROR: The preset name " + presetName + "
does not exist in the array materialParams");
return materialDefault;
/* NOP */;
}
private function UpdateForcedDirection(slideDir : Vector){
var jumpDirection : Vector;
switch(subState){
case 0:
jumpDirection = slideDir;
break;
case 1:
case 2:
jumpDirection = m_ExplorationO.m_MoverO.GetMovementVeloc
ityNormalized();
break;
case 3:
case 4:
jumpDirection = m_ExplorationO.m_InputO.GetMovementOnPla
neNormalizedV();
break;
}
m_ExplorationO.m_SharedDataO.m_JumpDirectionForcedV = jumpDirect
ion;
/* NOP */;
}
private function ComputeOrientingSpeed(slideCoef : Float) : Float{
var speed : Float;
switch(subState){
case 0:
speed = orientingInitial;
break;
case 1:
case 2:
speed = MapF(slideCoef, 0.000000, orientingMaxSlope, ori
entingSpeedMin, orientingSpeedMax);
break;
case 3:
speed = MapF(slideCoef, 0.000000, orientingMaxSlope, ori
entingSpeedMin, orientingSpeedMax);
break;
default:
LogExplorationError("Missing state in ComputeOrientingSp
eed function in script explorationStateSlide.ws");
speed = orientingInitial;
}
if (m_ExplorationO.m_InputO.IsSprintPressed()){

speed *= 0.500000;
}
return speed;
/* NOP */;
}
private function SubstateChangePrecheck(_Dt : Float){
if (landCoolingDown){
if (StateWantsToExit()){
subState = 4;
return;
}
if (m_ExplorationO.GetStateTimeF() >= landCoolDownTime){
landCoolingDown = false;
}
}
switch(subState){
case 0:
if (m_ExplorationO.GetStateTimeF() >= minTimeToIdle){
subState = 1;
}
break;
case 1:
if (m_ExplorationO.GetStateTimeF() >= timeToHardSlide){
subState = 2;
lockedOnHardSliding = true;
m_ExplorationO.SendAnimEvent(behGraphEventSlideH
ard, /* NOP */);
}
break;
case 2:
if (StateWantsToExit()){
subState = 3;
m_ExplorationO.SendAnimEvent(behSlideEnd, /* NOP
*/);
exitingTimeCur = 0.000000;
}
break;
case 3:
if (WantsToEnterBasic(/* NOP */)){
subState = 1;
m_ExplorationO.m_MoverO.SetSlidingParams(movemen
tParams);
m_ExplorationO.SendAnimEvent(behSlideRestart, /*
NOP */);
} else {
exitingTimeCur += _Dt;
if (exitingTimeCur > 0.200000){
m_ExplorationO.m_MoverO.SetSlidingParams
(movementStoppingParams);
}
if (exitingTimeCur > exitingTimeTotalInput){
if (m_ExplorationO.m_InputO.IsModuleCons
iderable()){
subState = 4;
}
if (exitingTimeCur > exitingTimeTotal){
subState = 4;
}
}
}

break;
case 4:
break;
}
/* NOP */;
}
private function UpdateAngleToRotateToAdaptToSlope(slideDirection : Vect
or, _Dt : Float){
var world : CWorld;
var res : Bool;
var bonePos : Vector;
var boneIdlePos : Vector;
var boneRayOrigin : Vector;
var boneRayEnd : Vector;
var slideNormal : Vector;
var pos : Vector;
var normal : Vector;
var boneDist : Float;
var boneHeight : Float;
var IKSucceeded : Bool;
var newInclination : Float;
res = false;
IKSucceeded = false;
if (true){
newInclination = m_ExplorationO.m_MoverO.GetRealSlideAng
le();
}
if (inclinationEnterTimeCur <= 0.000000){
inclination = BlendLinearF(inclination, newInclination,
inclinationBlendSpeed * _Dt);
} else {
inclination = BlendLinearF(inclination, newInclination,
1.000000 - inclinationEnterTimeCur / inclinationEnterTimeMax);
inclinationEnterTimeCur -= _Dt;
}
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behInclinationVar, i
nclination, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(behHeightVar, 0.1000
00, /* NOP */);
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
if (animEventName == animEventHardSliding){
lockedOnHardSliding = true;
} else if (animEventName == 'DisableFeetIK'){
}
/* NOP */;
}
private function UpdateCollisions(){
}
public function ReactToLoseGround() : Bool{
if (subState > 0){
SetReadyToChangeTo('StartFalling');
}
return true;
/* NOP */;
}
public function ReactToHitGround() : Bool{
return true;

/* NOP */;
}
public function ReactToSlide() : Bool{
return true;
/* NOP */;
}
public function CanInteract() : Bool{
return false;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, active : Bool) : Bool{
frame.DrawText("Slide To Fall: " + toFallTimeCur * 100 + "%", m_
ExplorationO.m_OwnerE.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000),
Color(80, 200, 80));
/* NOP */;
}
}
import abstract class CBehaviorGraphEnumComparatorNode{
}
import abstract class CMinigame{
}
class CR4HudModuleSignInfo extends CR4HudModuleBase{
private var _iconName : String;
private var _CurrentSelectedSign : ESignType;
private var m_fxShowBckArrowSFF : CScriptedFlashFunction;
private var m_fxEnableSFF : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
m_anchorName = "mcAnchorSignInfo";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxShowBckArrowSFF = flashModule.GetMemberFlashFunction("ShowBc
kArrow");
m_fxEnableSFF = flashModule.GetMemberFlashFunction("EnableElemen
t");
_CurrentSelectedSign = GetWitcherPlayer().GetEquippedSign();
_iconName = GetSignIcon();
UpdateSignData();
ShowElement(true, /* NOP */);
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (thePlayer.GetEquippedSign() != _CurrentSelectedSign){
_CurrentSelectedSign = thePlayer.GetEquippedSign();
UpdateSignData();
}
/* NOP */;
}
public function OnSignInfoShowBckArrow(bShow : Bool) : Bool{
ShowBckArrow(bShow);
/* NOP */;
}
public function UpdateSignData(){
var flashValueStorage : CScriptedFlashValueStorage;
flashValueStorage = GetModuleFlashValueStorage();
flashValueStorage.SetFlashString('signinfo.iconname', GetSignIco

n(), -1);
/* NOP */;
}
private function GetSignIcon() : String{
if ((W3ReplacerCiri)thePlayer){
return "hud/radialmenu/mcCiriPower.png";
}
return GetSignIconByType(_CurrentSelectedSign);
/* NOP */;
}
private function GetSignIconByType(signType : ESignType) : String{
switch(signType){
case 0:
return "hud/radialmenu/mcAard.png";
case 1:
return "hud/radialmenu/mcYrden.png";
case 2:
return "hud/radialmenu/mcIgni.png";
case 3:
return "hud/radialmenu/mcQuen.png";
case 4:
return "hud/radialmenu/mcAxii.png";
default:
}
return "";
/* NOP */;
}
public function ShowBckArrow(bShow : Bool){
m_fxShowBckArrowSFF.InvokeSelfOneArg(FlashArgBool(bShow));
/* NOP */;
}
public function EnableElement(enable : Bool){
m_fxEnableSFF.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
}
import abstract class IBehaviorGraphNotifier{
}
import abstract class CBehaviorGraphConstraintNode{
}
class CR4HudModuleItemInfo extends CR4HudModuleBase{
private var m_currentItemSelected : SItemUniqueId;
private var m_currentItemOnSlot1 : SItemUniqueId;
private var m_currentItemOnSlot2 : SItemUniqueId;
private var m_lastBoltItem : SItemUniqueId;
private var m_currentItemSelectedAmmo : Int32;
private var m_currentItemOnSlot1Ammo : Int32;
private var m_currentItemOnSlot2Ammo : Int32;
private var m_fxEnableSFF : CScriptedFlashFunction;
private var m_fxUpdateElementSFF : CScriptedFlashFunction;
private var m_fxHideSlotsSFF : CScriptedFlashFunction;
private var m_fxSetAlwaysDisplayed : CScriptedFlashFunction;
private var m_flashValueStorage : CScriptedFlashValueStorage;
private var m_fxSetItemInfo : CScriptedFlashFunction;
private var m_IsPlayerCiri : Bool;
private var cached_item0 : SItemUniqueId;
private var cached_item1 : SItemUniqueId;

private var cached_item2 : SItemUniqueId;


public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorItemInfo";
m_flashValueStorage = GetModuleFlashValueStorage();
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxEnableSFF = flashModule.GetMemberFlashFunction("EnableElemen
t");
m_fxUpdateElementSFF = flashModule.GetMemberFlashFunction("Updat
eElement");
m_fxHideSlotsSFF = flashModule.GetMemberFlashFunction("HideSlots
");
m_fxSetAlwaysDisplayed = flashModule.GetMemberFlashFunction("set
AlwaysDisplayed");
m_fxSetItemInfo = flashModule.GetMemberFlashFunction("setItemInf
o");
ClearItems();
SetTickInterval(0.250000);
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('ItemInfoModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var item0 : SItemUniqueId;
var item1 : SItemUniqueId;
var item2 : SItemUniqueId;
if (!CanTick(timeDelta)){
return true;
}
if (m_IsPlayerCiri != thePlayer.IsCiri()){
m_IsPlayerCiri = thePlayer.IsCiri();
if (m_IsPlayerCiri){
ClearItems();
}
m_fxHideSlotsSFF.InvokeSelfOneArg(FlashArgBool(!m_IsPlay
erCiri));
}
if (m_IsPlayerCiri){
item0 = GetCiriItem();
UpdateItem(item0, m_currentItemSelected, m_currentItemSe
lectedAmmo, 0, 0);
} else {
item0 = GetWitcherPlayer().GetSelectedItemId();
GetWitcherPlayer().GetItemEquippedOnSlot(14, item1);
GetWitcherPlayer().GetItemEquippedOnSlot(15, item2);
UpdateItem(item0, m_currentItemSelected, m_currentItemSe
lectedAmmo, 0, 0);
cached_item0 = item0;
UpdateItem(item1, m_currentItemOnSlot1, m_currentItemOnS
lot1Ammo, 1, 1);
UpdateItem(item2, m_currentItemOnSlot2, m_currentItemOnS
lot2Ammo, 2, 2);
cached_item2 != item2;
}
if (thePlayer.IsCombatMusicEnabled() || thePlayer.GetHealthPerce
nts() < 1.000000){

SetAlwaysDisplayed(true);
} else {
SetAlwaysDisplayed(false);
}
/* NOP */;
}
public function GetCiriItem() : SItemUniqueId{
var ret : array<SItemUniqueId>;
ret = thePlayer.GetInventory().GetItemsByName('q403_ciri_meteor'
);
return ret[0];
/* NOP */;
}
public function ResetItems(){
var invalidGUID : SItemUniqueId;
m_currentItemSelected = invalidGUID;
m_currentItemOnSlot1 = invalidGUID;
m_currentItemOnSlot2 = invalidGUID;
/* NOP */;
}
public function UpdateItem(currItem : SItemUniqueId, prevItem : SItemUni
queId, prevItemAmmo : Int32, bindingID : HudItemInfoBinding, slotId : Int32){
var updateItem : Bool;
var ammo : Int32;
var tempItem : SItemUniqueId;
var dummy : SItemUniqueId;
updateItem = false;
ammo = 0;
if (prevItem != currItem){
updateItem = true;
prevItem = currItem;
}
if (thePlayer.GetInventory().IsIdValid(currItem)){
if (thePlayer.GetInventory().IsItemSingletonItem(currIte
m)){
ammo = thePlayer.inv.SingletonItemGetAmmo(currIt
em);
if (prevItemAmmo != ammo){
updateItem = true;
prevItemAmmo = ammo;
}
} else if (thePlayer.GetInventory().IsItemCrossbow(currI
tem)){
GetWitcherPlayer().GetItemEquippedOnSlot(17, tem
pItem);
ammo = thePlayer.GetInventory().GetItemQuantity(
tempItem);
if (prevItemAmmo != ammo){
updateItem = true;
prevItemAmmo = ammo;
}
if (!updateItem && m_lastBoltItem != tempItem){
updateItem = true;
}
m_lastBoltItem = tempItem;
} else if (thePlayer.GetInventory().ItemHasTag(currItem,
'Edibles')){
ammo = thePlayer.GetInventory().GetItemQuantity(
currItem);
if (prevItemAmmo != ammo){

updateItem = true;
prevItemAmmo = ammo;
}
} else {
prevItemAmmo = -1;
if (slotId == 1){
UpdateItemData(dummy, 1);
}
if (slotId == 2){
UpdateItemData(dummy, 2);
}
}
} else {
prevItemAmmo = -1;
if (slotId == 1){
UpdateItemData(dummy, 1);
}
if (slotId == 2){
UpdateItemData(dummy, 2);
}
}
if (updateItem){
UpdateItemData(currItem, bindingID);
}
/* NOP */;
}
public function ClearItems(){
var dummy : SItemUniqueId;
UpdateItemData(dummy, 0);
UpdateItemData(dummy, 1);
UpdateItemData(dummy, 2);
m_currentItemSelected = dummy;
m_currentItemOnSlot1 = dummy;
m_currentItemOnSlot2 = dummy;
/* NOP */;
}
public function UpdateItemData(item : SItemUniqueId, bindingID : HudItem
InfoBinding){
var ammo : Int32;
var ammoStr : String;
var itemName : String;
var fontColor : String;
var icon : String;
var category : String;
var btn : Int32;
var pcBtn : Int32;
var inventory : CInventoryComponent;
if (!thePlayer.GetInventory().IsIdValid(item)){
icon = "";
category = "";
itemName = "";
ammoStr = "";
btn = 0;
pcBtn = -1;
} else {
inventory = thePlayer.GetInventory();
icon = inventory.GetItemIconPathByUniqueID(item);
category = inventory.GetItemCategory(item);
itemName = inventory.GetItemLocalizedNameByUniqueID(item
);

itemName = GetLocStringByKeyExt(itemName);
fontColor = "<font color="#FFFFFF">";
if (inventory.ItemHasTag(item, 'Edibles')){
ammo = thePlayer.inv.GetItemQuantity(item);
ammoStr = fontColor + ammo + "</font>";
} else if (inventory.IsItemSingletonItem(item)){
ammo = thePlayer.inv.SingletonItemGetAmmo(item);
if (ammo == 0){
fontColor = "<font color="#FF0000">";
}
ammoStr = fontColor + ammo + "/" + thePlayer.inv
.SingletonItemGetMaxAmmo(item) + "</font>";
} else if (inventory.IsItemCrossbow(item)){
GetWitcherPlayer().GetItemEquippedOnSlot(17, ite
m);
ammo = inventory.GetItemQuantity(item);
if (inventory.ItemHasTag(item, theGame.params.TA
G_INFINITE_AMMO)){
ammoStr = fontColor + "" + "</font>";
} else {
if (ammo == 0){
fontColor = "<font color="#FF000
0">";
}
ammoStr = fontColor + ammo + "</font>";
}
} else {
ammoStr = "";
}
itemName = fontColor + itemName + "</font>";
if (theInput.GetContext() == 'RadialMenu'){
btn = GetKeyByBinding(bindingID);
pcBtn = GetPCKeyByBinding(bindingID);
} else {
btn = 0;
pcBtn = 0;
}
}
m_fxSetItemInfo.InvokeSelfSevenArgs(FlashArgInt(bindingID), Flas
hArgString(icon), FlashArgString(category), FlashArgString(itemName), FlashArgSt
ring(ammoStr), FlashArgInt(btn), FlashArgInt(pcBtn));
/* NOP */;
}
private function GetKeyByBinding(bindingName : HudItemInfoBinding) : Int
32{
var outKeys : array<EInputKey>;
switch(bindingName){
case 0:
theInput.GetPadKeysForAction('ThrowItem', outKeys);
break;
case 1:
theInput.GetPadKeysForAction('DrinkPotion1', outKeys);
break;
case 2:
theInput.GetPadKeysForAction('DrinkPotion2', outKeys);
break;
}
return outKeys[0];
/* NOP */;
}

private function GetPCKeyByBinding(bindingName : HudItemInfoBinding) : I


nt32{
var outKeys : array<EInputKey>;
switch(bindingName){
case 0:
theInput.GetPCKeysForAction('ThrowItem', outKeys);
break;
case 1:
theInput.GetPCKeysForAction('DrinkPotion1', outKeys);
break;
case 2:
theInput.GetPCKeysForAction('DrinkPotion2', outKeys);
break;
}
return outKeys[0];
/* NOP */;
}
protected function UpdatePosition(anchorX : Float, anchorY : Float){
var l_flashModule : CScriptedFlashSprite;
var tempX : Float;
var tempY : Float;
l_flashModule = GetModuleFlash();
tempX = anchorX + 300.000000 * 1.000000 - theGame.GetUIHorizonta
lFrameScale();
tempY = anchorY - 200.000000 * 1.000000 - theGame.GetUIVerticalF
rameScale();
l_flashModule.SetX(tempX);
l_flashModule.SetY(tempY);
/* NOP */;
}
public function ForceShowElement(){
m_fxUpdateElementSFF.InvokeSelf();
/* NOP */;
}
public function EnableElement(enable : Bool){
}
public function ShowElementIgnoreState(show : Bool, bImmediately : Bool)
{
if (m_bEnabled){
m_fxShowElementSFF.InvokeSelfThreeArgs(FlashArgBool(show
), FlashArgBool(bImmediately), FlashArgBool(true));
}
/* NOP */;
}
public function SetAlwaysDisplayed(value : Bool){
m_fxSetAlwaysDisplayed.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
}
import abstract class CBehaviorConstraintBoneObject{
}
import abstract class IActorConditionType{
}
abstract class W3Condition extends CObject{
public function Test(out actor : CActor) : Bool{
}
}

import abstract class CBehaviorConstraintVectorObject{


}
import abstract class CBehaviorConstraintComponentObject{
}
import abstract class CBehaviorGraphConstraintNodeLookAt{
}
import abstract class CBehaviorGraphLookAtNode{
}
import abstract class IGameplayEntConditionType{
}
import abstract class CBehaviorGraphLookAtUsingAnimationsProcessingNode{
}
import abstract class CBehaviorGraphLookAtUsingAnimationsCommonBaseNode{
}
import abstract class CBehaviorGraphLookAtUsingAnimationsNode{
}
import abstract class CBehaviorGraphLookAtUsingEmbeddedAnimationsNode{
}
import abstract class SLookAtAnimationPairInstance{
}
import abstract class SLookAtAnimationPairInputBasedInstance{
}
import abstract class SSimpleAnimationPlayback{
}
class CExplorationStateSkatingDash extends CExplorationStateAbstract{
protected var skateGlobal : CExplorationSkatingGlobal;
protected editable var impulse : Float;
protected editable var timeMax : Float;
protected editable var timeToChainMin : Float;
protected editable var sharpTurnSpeed : Float;
protected editable var holdTurnSpeed : Float;
protected var sharpTurn : Bool;
protected editable var sharpTurnTime : Float;
protected editable var behAttackEvent : CName;
protected editable var behLeftFootParam : CName;
protected var boneRightFoot : CName;
protected var boneLeftFoot : CName;
protected var boneIndexRightFoot : Int32;
protected var boneIndexLeftFoot : Int32;
private editable var behEventEnd : CName;
protected function InitializeSpecific(_Exploration : CExplorationStateMa
nager){
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'SkateDash';
}
skateGlobal = _Exploration.m_SharedDataO.m_SkateGlobalC;
boneIndexRightFoot = m_ExplorationO.m_OwnerE.GetBoneIndex(boneRi

ghtFoot);
boneIndexLeftFoot = m_ExplorationO.m_OwnerE.GetBoneIndex(boneLef
tFoot);
m_StateTypeE = 4;
m_UpdatesWhileInactiveB = true;
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
AddStateToTheDefaultChangeList('SkateDashAttack', /* NOP */);
AddStateToTheDefaultChangeList('SkateJump', /* NOP */);
AddStateToTheDefaultChangeList('SkateHitLateral', /* NOP */);
/* NOP */;
}
public function StateWantsToEnter() : Bool{
return m_ExplorationO.m_InputO.IsDashJustPressed();
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
if (!HasEnoughStamina()){
return false;
}
return skateGlobal.IsDashReady();
/* NOP */;
}
protected function StateEnterSpecific(prevStateName : CName){
var finalImpulse : Float;
skateGlobal.SetSpeedLevel(1, true);
skateGlobal.ImpulseNotExceedingMaxSpeedLevel(impulse);
BlockStamina();
m_ExplorationO.m_MoverO.SetSkatingTurnSpeed(sharpTurnSpeed);
sharpTurn = true;
SetTheForwardFoot();
/* NOP */;
}
public function StateChangePrecheck() : CName{
if (m_ExplorationO.GetStateTimeF() > timeMax){
return 'SkateRun';
} else if (m_ExplorationO.GetStateTimeF() < timeToChainMin){
return GetStateName();
}
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
var accel : Float;
var turn : Float;
var braking : Bool;
skateGlobal.UpdateRandomAttack();
skateGlobal.UpdateDashAttack();
if (sharpTurn && m_ExplorationO.GetStateTimeF() >= sharpTurnTime
){
skateGlobal.ApplyDefaultParams();
sharpTurn = false;
}
m_ExplorationO.m_MoverO.UpdateSkatingMovement(_Dt, accel, turn,
braking, /* NOP */, /* NOP */);
skateGlobal.SetBehParams(accel, braking, turn);
/* NOP */;
}
public function StateUpdateInactive(_Dt : Float){

skateGlobal.UpdateDashCooldown(_Dt);
/* NOP */;
}
private function StateExitSpecific(nextStateName : CName){
skateGlobal.ConsumeDashCooldown();
skateGlobal.StartFlowTimeGap();
/* NOP */;
}
private function SetTheForwardFoot(){
var startRightFoot : Bool;
startRightFoot = m_ExplorationO.m_MoverO.IsRightFootForward();
m_ExplorationO.SetBehaviorParamBool(behLeftFootParam, !startRigh
tFoot, /* NOP */);
/* NOP */;
}
private function HasEnoughStamina() : Bool{
return thePlayer.HasStaminaToUseAction(9, /* NOP */, /* NOP */,
/* NOP */);
/* NOP */;
}
private function BlockStamina(){
thePlayer.DrainStamina(9, /* NOP */, /* NOP */, /* NOP */, /* NO
P */, /* NOP */);
/* NOP */;
}
public function ReactToLoseGround() : Bool{
SetReadyToChangeTo('StartFalling');
return true;
/* NOP */;
}
public function ReactToHitGround() : Bool{
return true;
/* NOP */;
}
public function CanInteract() : Bool{
return false;
/* NOP */;
}
}
import abstract class SSimpleAnimationPlaybackSet{
}
class W3FlammableAreaTrigger extends W3EffectAreaTrigger{
public editable var activeFor : Float;
public editable var fxOnExplosion : CName;
public editable var fxOnSustain : CName;
public editable var explosionRange : Float;
public editable var explosionDamage : SAbilityAttributeValue;
public editable var igniteFlammableAreasAfter : Float;
private var isActive : Bool;
private var area : CTriggerAreaComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
area = (CTriggerAreaComponent)GetComponentByClassName('CTriggerA
reaComponent');
/* NOP */;
}
public function Ignite(){
if (IsActive()){
return;

}
SetActive(true);
Explode();
PlayEffect(fxOnSustain, /* NOP */);
if (activeFor > 0.000000){
AddTimer('Extinguish', activeFor, /* NOP */, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private function Explode(){
var i : Int32;
var entitiesInRange : array<CGameplayEntity>;
var damage : W3DamageAction;
var actor : CActor;
var dmgVal : Float;
var flammableArea : W3FlammableAreaTrigger;
PlayEffect(fxOnExplosion, /* NOP */);
GCameraShake(0.500000, true, GetWorldPosition(), explosionRange,
/* NOP */, /* NOP */, /* NOP */);
area.GetGameplayEntitiesInArea(entitiesInRange, explosionRange,
/* NOP */);
i = 0;
while (i < entitiesInRange.Size()){
actor = (CActor)entitiesInRange[i];
if (actor){
damage = new W3DamageAction in this;
damage.Initialize(this, entitiesInRange[i], this
, this, 0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
dmgVal = explosionDamage.valueAdditive + explosi
onDamage.valueMultiplicative * actor.GetMaxHealth();
damage.AddDamage(theGame.params.DAMAGE_NAME_FIRE
, dmgVal);
damage.AddEffectInfo(10, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(damage);
delete damage;
} else {
flammableArea = (W3FlammableAreaTrigger)entities
InRange[i];
if (flammableArea){
flammableArea.AddTimer('OnFireHitAfter',
igniteFlammableAreasAfter, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/);
} else {
entitiesInRange[i].OnFireHit(this);
}
}
i += 1;
}
/* NOP */;
}
public timer function Extinguish(optional td : Float, optional id : Int3
2){
StopAllEffects();
SetActive(false);
RemoveTimer('ProcessArea', /* NOP */);
/* NOP */;
}

public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC


omponent) : Bool{
if (!IsActive()){
if (activator.GetEntity().HasTag(theGame.params.TAG_OPEN
_FIRE)){
Ignite();
} else {
return false;
}
}
super.OnAreaEnter(area, activator);
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
if (IsActive()){
return false;
}
super.OnFireHit(source);
Ignite();
/* NOP */;
}
public timer function OnFireHitAfter(optional td : Float, optional id :
Int32){
OnFireHit(this);
/* NOP */;
}
private function IsActive() : Bool{
return isActive;
/* NOP */;
}
private function SetActive(val : Bool){
isActive = val;
/* NOP */;
}
}
import abstract class CBehaviorGraphSynchronizeAnimationsToParentNode{
}
class CExplorationInterceptorStateAbstract extends CExplorationStateTransitionAb
stract{
protected editable var m_InterceptStateN : CName;
public function IsMachForThisStates(_FromN : CName, _ToN : CName) : Bool
{
return m_InterceptStateN == _ToN;
/* NOP */;
}
}
import abstract class SSynchronizeAnimationToParentInstance{
}
import abstract class CBehaviorGraphPointCloudLookAtNode{
}
import abstract class IBehaviorGraphPointCloudLookAtTransition_Vector{
}
import abstract class CCommunity{
}

import abstract class CBehaviorGraphPointCloudLookAtTransition_Vertical{


}
import abstract class CBehaviorGraphPointCloudLookAtTransition_Spherical{
}
struct genericSceneDefinition{
editable var voicesTag : CName;
editable var storyScene : CStoryScene;
editable var input : CName;
}
import abstract class CBehaviorGraphRecentlyUsedAnimsStateNode{
}
import abstract class IQuestTimeFunction{
}
import abstract class CBehaviorGraphIk2Node{
}
import abstract class CBehaviorGraphIk3Node{
}
class CExplorationStateJump extends CExplorationStateAbstract{
private editable var jumpEnabled : Bool;
protected var m_SubstateE : EJumpSubState;
protected var m_OrientationInitialF : Float;
protected var m_MaxHeightReachedF : Float;
protected editable var m_SlopeAngleMaxToJump : Float;
protected editable var m_UseGenericJumpB : Bool;
protected editable var m_AllowSprintJumpB : Bool;
protected var m_JumpParmsS : SJumpParams;
protected editable inlined var m_JumpParmsGenericS : SJumpParams;
protected editable inlined var m_JumpParmsIdleS : SJumpParams;
protected editable inlined var m_JumpParmsIdleToWalkS : SJumpParams;
protected editable inlined var m_JumpParmsWalkS : SJumpParams;
protected editable inlined var m_JumpParmsWalkHighS : SJumpParams;
protected editable inlined var m_JumpParmsRunS : SJumpParams;
protected editable inlined var m_JumpParmsSprintS : SJumpParams;
protected editable inlined var m_JumpParmsFallS : SJumpParams;
protected editable inlined var m_JumpParmsHitS : SJumpParams;
protected editable inlined var m_JumpParmsSlideS : SJumpParams;
protected editable inlined var m_JumpParmsVaultS : SJumpParams;
protected editable inlined var m_JumpParmsToWaterS : SJumpParams;
protected editable inlined var m_JumpParmsKnockBackS : SJumpParams;
protected editable inlined var m_JumpParmsKnockBackFallS : SJumpParams;
protected editable inlined var m_JumpParmsSkateIdleS : SJumpParams;
protected editable var m_SprintJumpNeedsStaminaB : Bool;
protected editable var m_SprintJumpTimeExtraF : Float;
protected editable var m_SprintJumpTimeGapF : Float;
protected editable var m_ConserveHorizontalCoefF : Float;
protected editable var m_ConserveVertUpCoefF : Float;
protected editable var m_ConserveVertDownCoefF : Float;
protected editable var m_ConserveHorizontalMaxF : Float;
protected editable var m_ConserveVertUpMaxF : Float;
protected editable var m_ConserveVertDownMaxF : Float;
protected editable var m_SpeedSqrMinToConserveF : Float;
protected editable var m_ReactToHitCeilingB : Bool;

protected var m_HitCeilingB : Bool;


protected editable var m_BehEventPredictLandN : CName;
protected editable var m_BehListenInertialJumpN : CName;
protected editable var m_BehListenFinishTakeOffN : CName;
protected editable var m_BehParamJumpTypeN : CName;
protected editable var m_BehEventPredictingS : CName;
protected editable var m_BehEventPredictTypeS : CName;
protected editable var m_BehParamIsHandledByAnimS : CName;
protected editable var m_BehParamWalkOrSprintS : CName;
protected editable var m_BehParamNormalLandS : CName;
protected editable var m_BehEventCeilingHit : CName;
protected editable var m_InteractAlwaysB : Bool;
protected editable var m_InteractTimeMinFallF : Float;
protected editable var m_InteractTimeMinF : Float;
protected editable var m_InteractTimeMinVaultF : Float;
protected editable var m_InteractHeightFallMaxF : Float;
protected editable var m_InteractTimeAdjustingF : Float;
protected editable var m_InteractDistanceExtraF : Float;
protected editable var m_InteractSpeedDiffAllowedF : Float;
protected editable var m_InteractOwnerOffsetV : Vector;
protected editable var m_LockingJumpOnInteractionAreaB : Bool;
protected editable var m_LockingJumpOnHorseAreaB : Bool;
protected editable var m_AllowJumpInSlopesB : Bool;
protected editable var m_FallDistToUseHelpF : Float;
protected editable var m_FallRecoverMaxHeightUpF : Float;
protected editable var m_FallRecoverMaxHeightDownF : Float;
protected editable var m_FallRecoverMaxDistF : Float;
private var m_CanSetVelocityB : Bool;
private editable var m_ForceIdleJumpOnColliisonB : Bool;
private editable var m_ForceIdleJumpHeightFreeF : Float;
private editable var m_ForceIdleJumpDistFreeF : Float;
private var m_InteractionLastLockingF : Float;
protected editable var m_LandPredictedB : Bool;
protected editable var m_LandGroundPredictB : Bool;
protected editable var m_LandWaterPredictB : Bool;
protected editable var m_LandPredictTimeMin : Float;
protected editable var m_LandPredictionTimeF : Float;
private var m_CollisionGroupsNamesNArr : array<CName>;
private var m_LandPredicedTypeE : ELandPredictionType;
private var m_LandPredicedCoefF : Float;
private editable var m_LandPredicedBlendF : Float;
private editable var m_SlopedLandZF : Float;
private var m_JumpOriginalPositionV : Vector;
protected editable var m_CameraDebugB : Bool;
protected var m_CameraStartB : Bool;
protected var m_CameraPositionV : Vector;
protected var m_CameraRotationEA : EulerAngles;
protected editable var m_CameraTimeToEndF : Float;
protected editable var cameraRoationName : CName;
protected editable var cameraToFallHeightNeed : Float;
private var cameraFallIsSet : Bool;
private editable var m_CollideBehGraphSideNameS : CName;
private var m_CollidingSideE : ESideSelected;
private editable var m_CooldownTotalF : Float;
private var m_CooldownCurF : Float;
private var useWalkJump : Bool;
private var useIdleWalkJump : Bool;
private var useHighJump : Bool;
private var jumpingOnIdleIsForward : Bool;
private var jumpIdleWhenObstructed : Bool;

protected function InitializeSpecific(_Exploration : CExplorationStateMa


nager){
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'Jump';
}
SetCanSave(false);
m_JumpParmsIdleS.m_JumpTypeE = 1;
m_JumpParmsIdleToWalkS.m_JumpTypeE = 2;
m_JumpParmsWalkS.m_JumpTypeE = 3;
m_JumpParmsWalkHighS.m_JumpTypeE = 4;
m_JumpParmsRunS.m_JumpTypeE = 5;
m_JumpParmsSprintS.m_JumpTypeE = 6;
m_JumpParmsFallS.m_JumpTypeE = 0;
m_JumpParmsHitS.m_JumpTypeE = 8;
m_JumpParmsSlideS.m_JumpTypeE = 7;
m_JumpParmsSkateIdleS.m_JumpTypeE = 11;
m_JumpParmsVaultS.m_JumpTypeE = 9;
m_JumpParmsToWaterS.m_JumpTypeE = 10;
m_JumpParmsKnockBackS.m_JumpTypeE = 12;
m_JumpParmsKnockBackFallS.m_JumpTypeE = 13;
m_JumpParmsRunS.m_TakeOffTimeF = 0.200000;
m_JumpParmsSprintS.m_TakeOffTimeF = 0.200000;
m_CollidingSideE = 0;
m_StateTypeE = 2;
m_InputContextE = 2;
m_UpdatesWhileInactiveB = true;
/* NOP */;
}
protected function AddActionsToBlock(){
super.AddActionsToBlock();
AddActionToBlock(0);
AddActionToBlock(4);
AddActionToBlock(33);
if (m_JumpParmsS.m_JumpTypeE == 10){
AddActionToBlock(14);
}
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
}
public function StateWantsToEnter() : Bool{
var potentialTarget : Vector;
var angle : Float;
var direction : Vector;
if (m_CooldownCurF > 0.000000){
return false;
}
if (!m_ExplorationO.m_InputO.IsJumpJustPressed()){
return false;
}
if (thePlayer.IsInCombatAction()){
return false;
}
if (thePlayer.IsInShallowWater()){
return false;
}
if (m_InteractionLastLockingF > 0.000000){
if (!m_ExplorationO.m_InputO.IsJumpJustReleased()){
return false;
}

}
if (!m_AllowJumpInSlopesB){
direction = m_ExplorationO.m_MoverO.GetSlideDir();
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
if (VecDot(VecNormalize(direction), m_Exploratio
nO.m_InputO.GetMovementOnPlaneNormalizedV()) < -0.200000){
angle = m_ExplorationO.m_MoverO.GetRealS
lideAngle();
angle = m_ExplorationO.m_MoverO.ConvertA
ngleDegreeToSlidECoef(angle);
if (angle >= m_ExplorationO.m_MoverO.Get
SlidingLimitMinCur()){
return false;
}
}
}
}
return true;
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
if (curStateName == 'Swim'){
return false;
}
if (curStateName == 'StartFalling' || curStateName == 'AirCollis
ion'){
return true;
}
if (curStateName == 'Land' && m_ExplorationO.m_SharedDataO.m_Jum
pTypeE == 12 || m_ExplorationO.m_SharedDataO.m_JumpTypeE == 13){
return true;
}
if (curStateName == 'Vault'){
return true;
}
if (!thePlayer.IsActionAllowed(10) || !thePlayer.IsActionAllowed
(6)){
if (m_ExplorationO.m_InputO.IsJumpJustPressed()){
thePlayer.DisplayActionDisallowedHudMessage(10,
false, false, true, /* NOP */);
}
return false;
}
return true;
/* NOP */;
}
protected function StateEnterSpecific(prevStateName : CName){
GetProperJumpTypeParameters(prevStateName);
SetSpeedOverrideCheck();
SaveProperJumpParameters();
SetBehaviorParameters();
GetJumpInitialOrientation();
SetInitialOrientation();
AddConservingVelocityToTheParams();
AddActionsToBlock();
BlockActions();
thePlayer.OnRangedForceHolster(true, false, /* NOP */);
BlockStamina(prevStateName);
if (prevStateName != 'StartFalling'){
m_ExplorationO.m_SharedDataO.ResetHeightFallen();

}
ChangeTo(0);
m_CameraStartB = true;
m_LandPredictedB = false;
m_JumpOriginalPositionV = m_ExplorationO.m_OwnerE.GetWorldPositi
on();
m_ExplorationO.m_SharedDataO.m_JumpSwimRotationF = 20.000000;
m_ExplorationO.m_SharedDataO.m_JumpIsTooSoonToLandB = true;
m_ExplorationO.m_SharedDataO.m_ShouldFlipFootOnLandB = m_JumpPar
msS.m_FlipFeetOnLandB;
m_ExplorationO.m_SharedDataO.m_DontRecalcFootOnLandB = m_JumpPar
msS.m_DontRecalcFootOnLand;
if (m_JumpParmsS.m_JumpTypeE == 9 && m_ExplorationO.m_SharedData
O.m_ClimbStateTypeE == 4){
m_ExplorationO.m_SharedDataO.m_DontRecalcFootOnLandB = t
rue;
}
m_HitCeilingB = false;
cameraFallIsSet = false;
m_ExplorationO.m_MoverO.SetManualMovement(true);
thePlayer.AbortSign();
/* NOP */;
}
public function GetIfCameraIsKept() : Bool{
return m_JumpParmsS.m_JumpTypeE == 9;
/* NOP */;
}
private function AddAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.AddAnimEventCallback(m_BehListenFinishTa
keOffN, 'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback(m_BehListenInertial
JumpN, 'OnAnimEvent_SubstateManager');
m_ExplorationO.m_OwnerE.AddAnimEventCallback('AnimEnd', 'OnAnimE
vent_SubstateManager');
/* NOP */;
}
public function GetBehaviorEventName() : CName{
if (m_JumpParmsS.m_JumpTypeE == 0){
return 'Fall';
}
return m_StateNameN;
/* NOP */;
}
public function GetBehaviorIsEventForced(fromState : CName) : Bool{
return fromState == 'CombatExploration';
/* NOP */;
}
public function NeedsBehaviorConfirmation() : Bool{
return m_BehaviorNeedsConfirmB && m_JumpParmsS.m_JumpTypeE != 0
|| m_JumpParmsS.m_JumpTypeE != 9;
/* NOP */;
}
private function StateEnterConfirmedSpecific(){
}
public function StateChangePrecheck() : CName{
if (CanWeCheckForInteraction()){
if (m_ExplorationO.StateWantsAndCanEnter('Climb')){
return 'Climb';
}
}

if (ShouldAirCollide()){
return 'AirCollision';
}
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
var l_DispF : Vector;
var l_VerticalDispF : Float;
l_VerticalDispF = 0.000000;
switch(m_SubstateE){
case 0:
if (m_JumpParmsS.m_TakeOffTimeF >= 0.000000 && m_Explora
tionO.GetStateTimeF() >= m_JumpParmsS.m_TakeOffTimeF){
ChangeTo(1);
}
if (m_ExplorationO.GetStateTimeF() >= m_JumpParmsS.m_Sta
rtOrientTimeF && m_ExplorationO.m_InputO.IsModuleConsiderable()){
m_ExplorationO.m_MoverO.UpdateOrientToInput(m_Ju
mpParmsS.m_OrientationSpeedF, _Dt);
}
if (m_JumpParmsS.m_HorImpulseAtStartB){
Update2DLogicMovement(_Dt);
}
break;
case 1:
if (CheckLandPrediction()){
ChangeTo(3);
}
Update2DLogicMovement(_Dt);
break;
case 2:
if (CheckLandPrediction()){
ChangeTo(3);
}
Update2DLogicMovement(_Dt);
l_VerticalDispF = UpdateVerticalMovement(_Dt);
break;
case 3:
m_LandPredicedCoefF = MinF(m_LandPredicedCoefF + m_LandP
redicedBlendF * _Dt, 1.000000);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_BehEventPr
edictingS, m_LandPredicedCoefF, /* NOP */);
Update2DLogicMovement(_Dt);
l_VerticalDispF = UpdateVerticalMovement(_Dt);
break;
}
if (m_JumpParmsS.m_JumpTypeE == 10){
m_ExplorationO.m_SharedDataO.m_JumpSwimRotationF = MaxF(
-60.000000, m_ExplorationO.m_SharedDataO.m_JumpSwimRotationF - _Dt * 100.000000)
;
m_ExplorationO.m_OwnerE.SetBehaviorVariable('Slide_Incli
nation', m_ExplorationO.m_SharedDataO.m_JumpSwimRotationF, /* NOP */);
thePlayer.OnMeleeForceHolster(true);
}
if (m_ExplorationO.m_SharedDataO.m_JumpIsTooSoonToLandB && m_Exp
lorationO.GetStateTimeF() >= m_JumpParmsS.m_TimeToPrepareForLandF){
m_ExplorationO.m_SharedDataO.m_JumpIsTooSoonToLandB = fa
lse;
}

m_ExplorationO.m_SharedDataO.UpdateFallHeight();
UpdateCameraChange();
/* NOP */;
}
public function StateUpdateInactive(_Dt : Float){
if (m_LockingJumpOnInteractionAreaB && thePlayer.IsInsideInterac
tion() && thePlayer.IsActionAllowed(21)){
m_InteractionLastLockingF = m_ExplorationO.m_InputO.GetJ
umpTimeGap() + _Dt;
} else if (m_LockingJumpOnHorseAreaB && thePlayer.IsMountingHors
eAllowed(true)){
m_InteractionLastLockingF = m_ExplorationO.m_InputO.GetJ
umpTimeGap() + _Dt;
} else {
m_InteractionLastLockingF -= _Dt;
}
m_CooldownCurF -= _Dt;
/* NOP */;
}
private function UpdateCameraChange(){
if (cameraFallIsSet){
return;
}
if (m_JumpParmsS.m_JumpTypeE == 10 && m_ExplorationO.GetStateTim
eF() >= 0.200000){
ChangeCameraToFall();
} else if (m_ExplorationO.m_SharedDataO.GetFallingHeight() <= -c
ameraToFallHeightNeed){
ChangeCameraToFall();
}
/* NOP */;
}
private function StateExitSpecific(nextStateName : CName){
thePlayer.SetBIsCombatActionAllowed(true);
if (nextStateName == m_ExplorationO.GetDefaultStateName()){
m_ExplorationO.SendAnimEvent('AnimEndAUX', /* NOP */);
}
if (nextStateName != 'Land' && nextStateName != 'AirCollision' &
& nextStateName != 'Slide' && nextStateName != 'Idle' && nextStateName != 'Inter
action' && nextStateName != 'Climb' && nextStateName != 'Swim'){
m_ExplorationO.SendAnimEvent('Idle', /* NOP */);
}
if (nextStateName != 'AirCollision' && nextStateName != 'Climb'
&& nextStateName != 'Land'){
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(true, 0.05000
0);
}
m_ExplorationO.m_MoverO.SetManualMovement(false);
m_CooldownCurF = m_CooldownTotalF;
m_ExplorationO.m_SharedDataO.SetFallFromCritical(false);
LogExploration(GetStateName() + ": Jumped distance: " + VecDista
nce(m_ExplorationO.m_OwnerE.GetWorldPosition(), m_JumpOriginalPositionV) + " Hei
ght: " + m_ExplorationO.m_SharedDataO.GetFallingMaxHeightReached());
/* NOP */;
}
private function RemoveAnimEventCallbacks(){
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(m_BehListenFinis
hTakeOffN);
m_ExplorationO.m_OwnerE.RemoveAnimEventCallback(m_BehListenInert
ialJumpN);

m_ExplorationO.m_OwnerE.RemoveAnimEventCallback('AnimEnd');
/* NOP */;
}
public function GetDebugText() : String{
var text : String;
text = "Type: " + m_JumpParmsS.m_JumpTypeE + " SubState: ";
switch(m_SubstateE){
case 0:
text += " Take Off";
break;
case 1:
text += " Flight";
break;
case 2:
text += " Inertial";
break;
case 3:
text += " PredictingLand";
break;
default:
text += " Unknown substate";
break;
}
return text;
/* NOP */;
}
private function GetProperJumpTypeParameters(prevStateName : CName){
var l_JumpTypeE : EJumpType;
l_JumpTypeE = GetJumpTypeThatShouldPlay(prevStateName);
SetJumpParametersBasedOnType(l_JumpTypeE);
if (m_UseGenericJumpB){
if (m_JumpParmsS.m_JumpTypeE == 1 || m_JumpParmsS.m_Jump
TypeE == 3 || m_JumpParmsS.m_JumpTypeE == 4 || m_JumpParmsS.m_JumpTypeE == 5 ||
m_JumpParmsS.m_JumpTypeE == 6){
l_JumpTypeE = m_JumpParmsS.m_JumpTypeE;
m_JumpParmsS = m_JumpParmsGenericS;
m_JumpParmsS.m_HorImpulseF = VecLength(m_Explora
tionO.m_OwnerMAC.GetVelocity());
m_JumpParmsS.m_JumpTypeE = l_JumpTypeE;
}
}
/* NOP */;
}
private function SetSpeedOverrideCheck(){
if (m_JumpParmsS.m_JumpTypeE == 0){
m_CanSetVelocityB = m_ExplorationO.m_SharedDataO.m_CanFa
llSetVelocityB;
} else if (m_JumpParmsS.m_JumpTypeE == 13){
m_CanSetVelocityB = false;
} else {
m_CanSetVelocityB = true;
}
m_ExplorationO.m_SharedDataO.m_CanFallSetVelocityB = true;
/* NOP */;
}
private function SaveProperJumpParameters(){
m_ExplorationO.m_SharedDataO.m_JumpTypeE = m_JumpParmsS.m_JumpTy
peE;
m_ExplorationO.m_SharedDataO.m_LandingOnWater = false;
LogExploration(" Jump type: " + m_JumpParmsS.m_JumpTypeE);

/* NOP */;
}
private function GetJumpTypeThatShouldPlay(prevStateName : CName) : EJum
pType{
var dir : Vector;
var normal : Vector;
var toWater : Bool;
if (m_ExplorationO.m_SharedDataO.GetFallFromCritical()){
return 13;
}
if (prevStateName == 'Land' && m_ExplorationO.m_SharedDataO.m_Ju
mpTypeE == 12 || m_ExplorationO.m_SharedDataO.m_JumpTypeE == 13){
return 13;
}
if (m_ExplorationO.m_InputO.IsJumpPressed() && m_ExplorationO.m_
SharedDataO.hackKnockBackAlways){
return 12;
}
if (prevStateName == 'Interaction'){
return 0;
}
if (m_ExplorationO.m_InputO.IsSprintPressed() || m_ExplorationO.
m_InputO.IsJumpPressed()){
if (m_ExplorationO.m_CollisionManagerO.GetJumpGoesToWate
r()){
toWater = true;
} else if (m_ExplorationO.m_SharedDataO.GetJumpToWaterAr
ea()){
toWater = true;
m_ExplorationO.m_SharedDataO.m_JumpDirectionForc
edV = m_ExplorationO.m_SharedDataO.m_JumpToWaterForcedDirV;
} else {
toWater = false;
}
if (toWater){
thePlayer.OnRangedForceHolster(/* NOP */, /* NOP
*/, /* NOP */);
return 10;
}
}
if (prevStateName == 'Climb'){
return 9;
}
if (prevStateName == 'AirCollision'){
return 8;
}
if (prevStateName == 'StartFalling'){
return 0;
} else if (prevStateName == 'Slide'){
return 7;
} else if (m_ExplorationO.GetStateType(prevStateName) == 4){
return 11;
} else if (m_ExplorationO.m_InputO.IsModuleConsiderable() && m_E
xplorationO.m_MoverO.GetRealSlideAngle() >= 36.000000){
m_ExplorationO.m_MoverO.GetSlideDirAndNormal(dir, normal
);
if (VecDot(VecNormalize(dir), m_ExplorationO.m_InputO.Ge
tMovementOnPlaneNormalizedV()) < -0.200000){
return 3;
}

}
if (thePlayer.GetSprintingTime() > 0.200000){
if (m_AllowSprintJumpB && !m_SprintJumpNeedsStaminaB ||
thePlayer.HasStaminaToUseAction(10, /* NOP */, /* NOP */, /* NOP */)){
return 6;
} else {
return 5;
}
} else if (jumpIdleWhenObstructed && m_ForceIdleJumpOnColliisonB
&& m_ExplorationO.m_CollisionManagerO.CheckCollisionsToNoStepOnInputDir(m_Force
IdleJumpDistFreeF, m_ForceIdleJumpHeightFreeF)){
LogExploration("Collision forced idle jump");
return 1;
}
if (thePlayer.IsOnBoat()){
if (m_ExplorationO.m_CollisionManagerO.GetJumpGoesOutOfB
oat()){
return 5;
}
} else if (thePlayer.GetIsRunning()){
return 5;
} else if (m_ExplorationO.m_InputO.IsModuleConsiderable() || pre
vStateName == 'TurnToJump'){
if (!useWalkJump || thePlayer.GetIsRunning()){
return 5;
}
if (useHighJump && m_ExplorationO.m_CollisionManagerO.Ch
eckCollisionsInJumpTrajectory(0.500000, 2.500000)){
return 4;
}
if (useIdleWalkJump && m_ExplorationO.m_SharedDataO.m_Ti
meSinceIdleF < 0.200000){
return 2;
} else {
return 3;
}
}
if (jumpingOnIdleIsForward){
return 2;
}
return 1;
/* NOP */;
}
private function SetJumpParametersBasedOnType(type : EJumpType){
switch(type){
case 1:
m_JumpParmsS = m_JumpParmsIdleS;
break;
case 2:
m_JumpParmsS = m_JumpParmsIdleToWalkS;
break;
case 3:
m_JumpParmsS = m_JumpParmsWalkS;
break;
case 4:
m_JumpParmsS = m_JumpParmsWalkHighS;
break;
case 5:
m_JumpParmsS = m_JumpParmsRunS;
break;

case 6:
m_JumpParmsS = m_JumpParmsSprintS;
break;
case 0:
m_JumpParmsS = m_JumpParmsFallS;
break;
case 7:
m_JumpParmsS = m_JumpParmsSlideS;
break;
case 8:
m_JumpParmsS = m_JumpParmsHitS;
break;
case 9:
m_JumpParmsS = m_JumpParmsVaultS;
break;
case 11:
m_JumpParmsS = m_JumpParmsSkateIdleS;
break;
case 10:
m_JumpParmsS = m_JumpParmsToWaterS;
break;
case 12:
m_JumpParmsS = m_JumpParmsKnockBackS;
break;
case 13:
m_JumpParmsS = m_JumpParmsKnockBackFallS;
break;
default:
m_JumpParmsS = m_JumpParmsWalkS;
LogExplorationError("Trying to get jump params for a mis
sing jump type");
break;
}
/* NOP */;
}
private function BlockStamina(prevStateName : CName){
if (prevStateName != 'StartFalling'){
thePlayer.DrainStamina(10, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
/* NOP */;
}
private function AddConservingVelocityToTheParams(){
var conserving : Float;
var velocity : Vector;
var jumpDirection : Vector;
if (!m_JumpParmsS.m_UsePhysicJumpB){
return;
}
jumpDirection = VecFromHeading(m_OrientationInitialF);
velocity = m_ExplorationO.m_MoverO.GetMovementVelocity();
if (m_CanSetVelocityB && m_JumpParmsS.m_HorImpulseAtStartB){
LogExploration("Jump Conserve: Impulse at start: " + m_J
umpParmsS.m_HorImpulseF);
m_ExplorationO.m_MoverO.SetVelocity(jumpDirection * m_Ju
mpParmsS.m_HorImpulseF);
}
if (VecLengthSquared(velocity) < m_SpeedSqrMinToConserveF){
LogExploration("Jump Conserve: No Conserved Speed, going
too slow");

return;
}
conserving = VecDot(velocity, jumpDirection);
if (m_JumpParmsS.m_ConserveCoefsB){
conserving *= m_ConserveHorizontalCoefF;
conserving = MinF(conserving, m_ConserveHorizontalMaxF);
if (m_JumpParmsS.m_ConserveAddB){
conserving = m_JumpParmsS.m_HorImpulseF + conser
ving;
} else {
conserving = ClampF(conserving, -m_JumpParmsS.m_
HorImpulseF, m_JumpParmsS.m_HorImpulseF);
}
m_JumpParmsS.m_HorImpulseF = conserving;
LogExploration("Jump Conserve: Conserved Horizontal spee
d: " + conserving);
}
if (m_JumpParmsS.m_ConserveCoefsB){
conserving = VecDot(velocity, Vector(0.000000, 0.000000,
1.000000));
if (velocity.Z >= 0.000000){
conserving *= m_ConserveVertUpCoefF;
conserving = MinF(conserving, m_ConserveVertUpMa
xF);
} else {
conserving *= m_ConserveVertDownCoefF;
conserving = MaxF(conserving, -m_ConserveVertDow
nMaxF);
}
if (m_JumpParmsS.m_ConserveAddB){
conserving = m_JumpParmsS.m_VerticalMovementS.m_
VertImpulseF + conserving;
} else if (velocity.Z >= 0.000000){
conserving = MaxF(m_JumpParmsS.m_VerticalMovemen
tS.m_VertImpulseF, conserving);
} else {
conserving = MaxF(0.000000, m_JumpParmsS.m_Verti
calMovementS.m_VertImpulseF + conserving);
}
m_JumpParmsS.m_VerticalMovementS.m_VertImpulseF = conser
ving;
LogExploration("Jump Conserve: Conserved Vertical speed:
" + conserving);
}
/* NOP */;
}
private function WantsToInteractWithExploration() : Bool{
var exploration : SExplorationQueryToken;
var queryContext : SExplorationQueryContext;
if (m_ExplorationO.m_SharedDataO.m_UseClimbB){
return false;
}
queryContext.inputDirectionInWorldSpace = m_ExplorationO.m_Input
O.GetMovementOnPlaneV();
queryContext.forJumping = true;
queryContext.dontDoZAndDistChecks = true;
exploration = theGame.QueryExplorationSync(m_ExplorationO.m_Owne
rE, queryContext);
if (!exploration.valid){
return false;

}
if (!IsInteractionPointInRange(exploration.pointOnEdge)){
return false;
}
m_ExplorationO.m_SharedDataO.SetExplorationToken(exploration, Ge
tStateName());
return true;
/* NOP */;
}
private function CanWeCheckForInteraction() : Bool{
if (!m_InteractAlwaysB){
return false;
}
if (false){
return false;
}
if (m_JumpParmsS.m_JumpTypeE == 9){
if (AbsF(m_ExplorationO.m_InputO.GetHeadingDiffFromPlaye
rF()) > 60.000000){
return false;
} else if (m_InteractTimeMinVaultF > m_ExplorationO.GetS
tateTimeF()){
return false;
} else {
m_InteractTimeMinVaultF = m_InteractTimeMinVault
F;
}
} else if (m_JumpParmsS.m_JumpTypeE == 0){
if (m_InteractTimeMinFallF > m_ExplorationO.GetStateTime
F()){
return false;
}
} else if (m_InteractTimeMinF > m_ExplorationO.GetStateTimeF()){
return false;
}
if (-m_ExplorationO.m_SharedDataO.GetFallingHeight() > m_Interac
tHeightFallMaxF){
return false;
}
if (!m_ExplorationO.m_InputO.IsModuleConsiderable()){
return false;
}
return true;
/* NOP */;
}
private function IsInteractionPointInRange(point : Vector) : Bool{
var explorationOwnerPosition : Vector;
var explorationDirection : Vector;
var speed : Vector;
var coef : Float;
var aux : Float;
if (m_JumpParmsS.m_JumpTypeE == 0){
if (-m_ExplorationO.m_SharedDataO.GetFallingHeight() <=
m_FallDistToUseHelpF){
if (VecDot(m_ExplorationO.m_InputO.GetMovementOn
PlaneV(), Vector(speed.X, speed.Y, 0.000000)) < 0.500000){
return IsInteractionPointInRangeOnStartF
alling(point);
}
}

}
explorationOwnerPosition = GetExplorationOwnerPosition();
explorationDirection = point - explorationOwnerPosition;
if (m_JumpParmsS.m_UsePhysicJumpB){
speed = m_ExplorationO.m_MoverO.GetMovementVelocity();
} else {
speed = m_ExplorationO.m_OwnerMAC.GetVelocity();
}
coef = speed.Z * explorationDirection.Z;
if (coef < -m_InteractSpeedDiffAllowedF){
return false;
}
coef = VecDot(speed, explorationDirection);
if (coef < -m_InteractSpeedDiffAllowedF){
return false;
}
coef = VecLength(speed) * m_InteractTimeAdjustingF + m_InteractD
istanceExtraF;
aux = VecLength(explorationDirection);
if (coef < aux){
return false;
}
return true;
/* NOP */;
}
private function IsInteractionPointInRangeOnStartFalling(point : Vector)
: Bool{
var explorationOwnerPosition : Vector;
explorationOwnerPosition = GetExplorationOwnerPosition();
if (explorationOwnerPosition.Z > point.Z + m_FallRecoverMaxHeigh
tUpF){
return false;
}
if (explorationOwnerPosition.Z < point.Z - m_FallRecoverMaxHeigh
tDownF){
return false;
}
if (VecDistance(point, explorationOwnerPosition) > m_FallRecover
MaxDistF){
return false;
}
LogExploration("FallRecover");
return true;
/* NOP */;
}
private function ShouldAirCollide() : Bool{
if (m_HitCeilingB){
return false;
}
if (m_JumpParmsS.m_JumpTypeE == 10){
return false;
}
if (m_ExplorationO.GetStateTimeF() < m_JumpParmsS.m_TimeToCheckC
ollisionsF){
return false;
}
if (m_SubstateE <= 0){
return false;
}
if (HasQueuedState()){

return false;
}
if (m_JumpParmsS.m_JumpTypeE == 11){
return false;
}
if (!m_ExplorationO.StateWantsAndCanEnter('AirCollision')){
return false;
}
return true;
/* NOP */;
}
private function ShouldSideCollide() : Bool{
if (m_ExplorationO.m_InputO.IsSprintJustPressed()){
m_CollidingSideE = 1;
}
return true;
/* NOP */;
}
private function GetExplorationOwnerPosition() : Vector{
var position : Vector;
position = m_ExplorationO.m_OwnerE.GetWorldPosition() + m_Explor
ationO.m_OwnerE.GetWorldForward() * m_InteractOwnerOffsetV.X + m_ExplorationO.m_
OwnerE.GetWorldRight() * m_InteractOwnerOffsetV.Y + m_ExplorationO.m_OwnerE.GetW
orldUp() * m_InteractOwnerOffsetV.Z;
return position;
/* NOP */;
}
private function Update2DLogicMovement(_Dt : Float){
if (m_JumpParmsS.m_AllowAirDisplacementControlB || m_Exploration
O.GetStateTimeF() > 2.000000){
m_ExplorationO.m_MoverO.UpdateMovementOnPlaneWithInput(_
Dt);
} else {
m_ExplorationO.m_MoverO.UpdateMovementOnPlaneWithInertia
(_Dt);
}
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
m_ExplorationO.m_MoverO.UpdateOrientToInput(m_JumpParmsS
.m_OrientationSpeedF, _Dt);
}
/* NOP */;
}
private function UpdateVerticalMovement(_Dt : Float) : Float{
return m_ExplorationO.m_MoverO.UpdatePerfectMovementVertical(_Dt
);
/* NOP */;
}
private function ChangeTo(jumpSubstate : EJumpSubState){
m_SubstateE = jumpSubstate;
LogExploration("
Substate changing to: " + m_SubstateE);
switch(jumpSubstate){
case 0:
ChangeToTakeOff();
break;
case 1:
ChangeToFlight();
break;
case 2:
ChangeToInertial();
break;

case 3:
ChangeToPredictingLand();
break;
}
/* NOP */;
}
private function ChangeToTakeOff(){
if (m_JumpParmsS.m_TakeOffTimeF == 0.000000){
ChangeTo(1);
}
/* NOP */;
}
private function ChangeToFlight(){
var succeeded : Bool;
var direction : Vector;
m_ExplorationO.m_MoverO.SetPlaneMovementParams(m_JumpParmsS.m_Ho
rMovementS);
direction = VecFromHeading(m_OrientationInitialF);
if (m_CanSetVelocityB && !m_JumpParmsS.m_HorImpulseAtStartB){
m_ExplorationO.m_MoverO.SetVelocity(direction * m_JumpPa
rmsS.m_HorImpulseF);
}
m_ExplorationO.m_OwnerMAC.SetEnabledFeetIK(false, /* NOP */);
if (m_JumpParmsS.m_UsePhysicJumpB && m_JumpParmsS.m_JumpTypeE !=
6){
ChangeTo(2);
}
m_ExplorationO.m_MoverO.SetVerticalSpeed(m_JumpParmsS.m_Vertical
MovementS.m_VertImpulseF);
/* NOP */;
}
private function ChangeToInertial(){
var velocity : Vector;
var vertVelocity : Float;
m_ExplorationO.m_MoverO.SetPlaneMovementParams(m_JumpParmsFallS.
m_HorMovementS);
m_ExplorationO.m_MoverO.SetVerticalMovementParams(m_JumpParmsFal
lS.m_VerticalMovementS);
if (!m_JumpParmsS.m_RecalcSpeedOnInertialB){
return;
}
velocity = m_ExplorationO.m_OwnerMAC.GetVelocity();
vertVelocity = velocity.Z;
velocity.Z = 0.000000;
m_ExplorationO.m_MoverO.SetVelocity(velocity);
if (m_JumpParmsS.m_VerticalMovementS.m_VertImpulseF != 0.000000)
{
m_ExplorationO.m_MoverO.SetVerticalSpeed(m_JumpParmsS.m_
VerticalMovementS.m_VertImpulseF);
} else {
m_ExplorationO.m_MoverO.SetVerticalSpeed(vertVelocity);
}
/* NOP */;
}
private function ChangeToPredictingLand(){
var succeeded : Bool;
succeeded = m_ExplorationO.SendAnimEvent(m_BehEventPredictLandN,
/* NOP */);
if (!succeeded){
LogExplorationWarning("Invalid predict land event name")

;
}
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_BehEventPredictTyp
eS, m_LandPredicedTypeE, /* NOP */);
/* NOP */;
}
private function CheckLandPrediction() : Bool{
var velocity : Vector;
var vertVelocity : Float;
var world : CWorld;
var res : Bool;
var distanceToCheck : Float;
var posCurrent : Vector;
var posPredicted : Vector;
var posCollided : Vector;
var normalCollided : Vector;
if (m_LandPredictedB){
return false;
}
if (!m_LandGroundPredictB && !m_LandWaterPredictB){
return false;
}
if (m_JumpParmsS.m_JumpTypeE == 10){
return false;
}
if (!m_JumpParmsS.m_UsePhysicJumpB && m_ExplorationO.GetStateTim
eF() < m_LandPredictTimeMin){
return false;
}
if (m_JumpParmsS.m_UsePhysicJumpB){
vertVelocity = m_ExplorationO.m_MoverO.GetMovementVertic
alSpeedF();
} else {
velocity = m_ExplorationO.m_OwnerMAC.GetVelocity();
vertVelocity = velocity.Z;
}
if (vertVelocity >= 0.000000){
return false;
}
posCurrent = m_ExplorationO.m_OwnerE.GetWorldPosition();
distanceToCheck = vertVelocity * m_LandPredictionTimeF;
posPredicted = posCurrent + Vector(0.000000, 0.000000, distanceT
oCheck);
if (m_LandWaterPredictB){
if (m_ExplorationO.m_CollisionManagerO.IsThereWaterAndIs
ItDeepEnough(posCurrent, posPredicted.Z, 0.400000)){
m_LandPredicedTypeE = 2;
m_ExplorationO.m_SharedDataO.m_LandingOnWater =
true;
m_LandPredictedB = true;
return true;
}
}
if (m_LandGroundPredictB){
world = theGame.GetWorld();
res = world.StaticTrace(posCurrent, posPredicted, posCol
lided, normalCollided, m_CollisionGroupsNamesNArr);
if (res){
if (AbsF(normalCollided.Z) <= m_SlopedLandZF){
m_LandPredicedTypeE = 0;

} else {
m_LandPredicedTypeE = 1;
}
m_LandPredictedB = true;
return true;
}
}
return false;
/* NOP */;
}
private function SetBehaviorParameters(){
var startRightFoot : Bool;
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_BehParamJumpTypeN,
m_JumpParmsS.m_JumpTypeE, /* NOP */);
if (m_JumpParmsS.m_JumpTypeE != 9 && m_JumpParmsS.m_JumpTypeE !=
8){
if (m_JumpParmsS.m_JumpTypeE == 2){
m_ExplorationO.m_SharedDataO.ForceFotForward(tru
e);
} else {
m_ExplorationO.m_SharedDataO.SetFotForward(/* NO
P */);
}
}
m_ExplorationO.SetBehaviorParamBool(m_BehParamIsHandledByAnimS,
!m_JumpParmsS.m_UsePhysicJumpB, /* NOP */);
m_LandPredicedCoefF = 0.000000;
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_BehEventPredicting
S, m_LandPredicedCoefF, /* NOP */);
m_ExplorationO.m_OwnerE.SetBehaviorVariable(m_BehParamNormalLand
S, m_JumpParmsS.m_JumpTypeE, /* NOP */);
if (m_JumpParmsS.m_JumpTypeE == 10){
}
/* NOP */;
}
private function SetInitialOrientation(){
var movAdj : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (m_ExplorationO.m_OwnerE.GetHeading() == m_OrientationInitial
F){
return;
}
movAdj = m_ExplorationO.m_OwnerMAC.GetMovementAdjustor();
ticket = movAdj.CreateNewRequest('turnOnJump');
movAdj.AdjustmentDuration(ticket, 0.300000);
movAdj.RotateTo(ticket, m_OrientationInitialF);
/* NOP */;
}
private function HasToTurnBack() : Bool{
var turnAround : Bool;
turnAround = AngleDistance(m_OrientationInitialF, m_ExplorationO
.m_OwnerE.GetHeading()) >= 90.000000;
if (turnAround){
return true;
}
return false;
/* NOP */;
}
private function GetJumpInitialOrientation(){
var yawDifference : Float;

var yawExceeding : Float;


if (m_JumpParmsS.m_ExternalDirectionForcedB){
m_OrientationInitialF = VecHeading(m_ExplorationO.m_Shar
edDataO.m_JumpDirectionForcedV);
} else {
m_OrientationInitialF = m_ExplorationO.m_OwnerE.GetHeadi
ng();
if (m_ExplorationO.m_InputO.IsModuleConsiderable()){
yawDifference = m_ExplorationO.m_InputO.GetHeadi
ngDiffFromYawF(m_OrientationInitialF);
if (AbsF(yawDifference) < m_JumpParmsS.m_StartDi
rectionIgnoreF){
m_OrientationInitialF = m_ExplorationO.m
_InputO.GetHeadingOnPlaneF();
if (m_JumpParmsS.m_StartDirectionAllowan
ceF < 180.000000){
yawExceeding = yawDifference - m
_JumpParmsS.m_StartDirectionAllowanceF;
if (yawExceeding > 0.000000){
m_OrientationInitialF -=
yawExceeding;
}
yawExceeding = yawDifference + m
_JumpParmsS.m_StartDirectionAllowanceF;
if (yawExceeding < 0.000000){
m_OrientationInitialF -=
yawExceeding;
}
}
}
}
}
/* NOP */;
}
public function UpdateCameraIfNeeded(moveData : SCameraMovementData, dt
: Float) : Bool{
return true;
/* NOP */;
}
private function ChangeCameraToFall(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
camera.ChangePivotRotationController(cameraRoationName);
cameraFallIsSet = true;
/* NOP */;
}
public function ReactToHitCeiling() : Bool{
if (m_ReactToHitCeilingB && !m_HitCeilingB){
m_ExplorationO.m_OwnerE.RaiseEvent(m_BehEventCeilingHit)
;
m_HitCeilingB = true;
}
return true;
/* NOP */;
}
public function ReactToLoseGround() : Bool{
return true;
/* NOP */;
}
public function ReactToHitGround() : Bool{

var direction : Vector;


var dot : Float;
var time : Float;
if (m_ExplorationO.GetStateTimeF() <= 0.000000){
return true;
}
if (m_SubstateE == 0){
return true;
}
if (m_JumpParmsS.m_JumpTypeE != 0){
time = m_ExplorationO.GetStateTimeF();
if (time < m_JumpParmsS.m_TakeOffTimeF){
return true;
}
if (time < 0.100000){
return true;
}
}
if (m_ExplorationO.m_MoverO.GetMovementVerticalSpeedF() == 0.000
000){
direction = m_ExplorationO.m_OwnerMAC.GetVelocityBasedOn
RequestedMovement();
dot = VecDot(direction, m_ExplorationO.m_OwnerMAC.GetTer
rainNormal(false));
if (dot >= -0.000100){
LogExploration(GetStateName() + ": HitGround, Bu
t done nothing cause GetVelocityBasedOnRequestedMovement is moving away from the
terrain normal");
return true;
}
} else {
direction = m_ExplorationO.m_MoverO.GetMovementVelocity(
);
dot = VecDot(direction, m_ExplorationO.m_OwnerMAC.GetTer
rainNormal(false));
if (dot > 0.000000){
LogExploration(GetStateName() + ": HitGround, Bu
t done nothing cause GetMovementVelocity().Z is > 0.0f");
return true;
}
}
if (m_ExplorationO.StateWantsAndCanEnter('Slide')){
SetReadyToChangeTo('Slide');
return true;
}
if (m_JumpParmsS.m_JumpTypeE == 11){
SetReadyToChangeTo('SkateLand');
return true;
}
if (m_SubstateE >= 1){
SetReadyToChangeTo('Land');
return true;
}
LogExploration(GetStateName() + ": HitGround, But did nothing wi
th it cause the jump state is not ready to land still");
return true;
/* NOP */;
}
public function CanInteract() : Bool{
return false;

/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo){
if (animEventName == m_BehListenFinishTakeOffN){
if (m_SubstateE == 0 || m_SubstateE == 1){
ChangeTo(2);
}
} else if (m_SubstateE != 2){
if (animEventName == m_BehListenInertialJumpN){
ChangeTo(2);
} else if (animEventName == 'AnimEnd'){
ChangeTo(2);
}
}
/* NOP */;
}
}
import abstract class CBehaviorGraphLookAtSystemNode{
}
import abstract class CBehaviorGraphConstraintNodeChain{
}
import abstract class CBehaviorGraphMimicLookAtSystemNode{
}
import abstract class CBehaviorGraphConstraintNodeCameraLookAt{
}
class CExplorationStateSkatingDrift extends CExplorationStateAbstract{
protected var skateGlobal : CExplorationSkatingGlobal;
protected editable var impulse : Float;
protected editable var impulseSpeedMax : Float;
protected var sharpTurn : Bool;
protected editable var sharpTurnTime : Float;
protected editable var sharpTurnSpeed : Float;
protected editable var holdTurnSpeed : Float;
protected editable var chainTimeToDrift : Float;
protected var exiting : Bool;
protected editable var timeEndingMax : Float;
protected var timeEndingFlow : Bool;
protected var timeEndingCur : Float;
protected editable var behDriftRestart : CName;
protected editable var behDriftEnd : CName;
protected editable var behDriftLeftSide : CName;
protected var sideIsLeft : Bool;
private function InitializeSpecific(_Exploration : CExplorationStateMana
ger){
if (!IsNameValid(m_StateNameN)){
m_StateNameN = 'SkateDrift';
}
skateGlobal = _Exploration.m_SharedDataO.m_SkateGlobalC;
m_StateTypeE = 4;
/* NOP */;
}
private function AddDefaultStateChangesSpecific(){
AddStateToTheDefaultChangeList('SkateDash', /* NOP */);
AddStateToTheDefaultChangeList('SkateBackwards', /* NOP */);

AddStateToTheDefaultChangeList('SkateJump', /* NOP */);


AddStateToTheDefaultChangeList('SkateHitLateral', /* NOP */);
/* NOP */;
}
public function StateWantsToEnter() : Bool{
if (skateGlobal.ShouldStop(true)){
return false;
}
return m_ExplorationO.m_InputO.IsDriftPressed();
/* NOP */;
}
public function StateCanEnter(curStateName : CName) : Bool{
return true;
/* NOP */;
}
protected function StateEnterSpecific(prevStateName : CName){
var impulseResulting : Float;
sideIsLeft = m_ExplorationO.m_InputO.GetHeadingDiffFromPlayerF()
< 0.000000;
skateGlobal.m_DrifIsLeft = sideIsLeft;
m_ExplorationO.SetBehaviorParamBool(behDriftLeftSide, !sideIsLef
t, /* NOP */);
impulseResulting = MaxF(0.000000, impulseSpeedMax - m_Exploratio
nO.m_MoverO.GetMovementSpeedF());
impulseResulting - MinF(impulse, impulseResulting);
m_ExplorationO.m_MoverO.AddSpeed(impulseResulting);
if (skateGlobal.CheckIfIsInFlowGapAndConsume()){
skateGlobal.DecreaseSpeedLevel(true, false);
} else {
skateGlobal.DecreaseSpeedLevel(false, true);
}
m_ExplorationO.m_MoverO.SetSkatingTurnSpeed(sharpTurnSpeed);
exiting = false;
timeEndingCur = 0.000000;
sharpTurn = true;
timeEndingFlow = false;
skateGlobal.m_Drifting = true;
/* NOP */;
}
public function StateChangePrecheck() : CName{
if (timeEndingCur > timeEndingMax){
return 'SkateRun';
}
return super.StateChangePrecheck();
/* NOP */;
}
protected function StateUpdateSpecific(_Dt : Float){
var accel : Float;
var turn : Float;
var braking : Bool;
skateGlobal.UpdateRandomAttack();
m_ExplorationO.m_MoverO.UpdateSkatingMovement(_Dt, accel, turn,
braking, true, sideIsLeft);
UpdateExit(_Dt, braking);
skateGlobal.SetBehParams(accel, braking, turn);
/* NOP */;
}
protected function StateExitSpecific(nextStateName : CName){
skateGlobal.m_Drifting = false;
skateGlobal.StartFlowTimeGap();

/* NOP */;
}
protected function UpdateExit(_Dt : Float, braking : Bool){
if (skateGlobal.ShouldStop(braking)){
SetReadyToChangeTo('SkateIdle');
}
if (StateWantsToEnter()){
if (timeEndingCur > 0.000000){
if (m_ExplorationO.GetStateTimeF() >= chainTimeT
oDrift){
SetReadyToChangeTo('SkateRun');
}
skateGlobal.CancelFlowTimeGap();
m_ExplorationO.SendAnimEvent(behDriftRestart, /*
NOP */);
timeEndingCur = 0.000000;
skateGlobal.m_Drifting = true;
}
} else {
timeEndingCur += _Dt;
if (!timeEndingFlow && timeEndingCur > timeEndingMax - s
kateGlobal.GetMaxFlowTimeGap()){
timeEndingFlow = true;
m_ExplorationO.SendAnimEvent(behDriftEnd, /* NOP
*/);
skateGlobal.m_Drifting = false;
}
}
/* NOP */;
}
public function ReactToLoseGround() : Bool{
SetReadyToChangeTo('StartFalling');
return true;
/* NOP */;
}
public function ReactToHitGround() : Bool{
return true;
/* NOP */;
}
public function CanInteract() : Bool{
return false;
/* NOP */;
}
}
import abstract class CBehaviorGraphConstraintNodeCameraFocus{
}
import abstract class STwoBonesIKSolverBoneData{
}
import abstract class STwoBonesIKSolverData{
}
import abstract class STwoBonesIKSolver{
}
import abstract class SApplyRotationIKSolverData{
}

import abstract class QuestScriptParam{


}
import abstract class SApplyRotationIKSolver{
}
import abstract class CBehaviorGraphConstraintNodeRoll{
}
import abstract class CBehaviorGraphConstraintNodeParentAlign{
}
import abstract class CBehaviorGraphConstraintNodeBoneInterpolate{
}
import abstract class CBehaviorGraphConstraintReset{
}
import abstract class CBehaviorGraphAnimEventTrackNode{
}
import abstract class CBehaviorGraphHeadingNode{
}
import abstract class CBehaviorGraphMotionExRotAngleNode{
}
import abstract class CBehaviorGraphMotionExToAngleNode{
}
import struct IActorLatentAction{
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
return NULL;
/* NOP */;
}
}
import abstract class CBehaviorGraphPositionControllerBaseNode{
}
import abstract class CBehaviorGraphCutsceneControllerNode{
}
import struct IAITree{
import public final function OnCreated();
public function Init(){
}
}
import struct CMovingPhysicalAgentComponent{
import public final function IsPhysicalMovementEnabled() : Bool;
import public final function SetAnimatedMovement(enable : Bool);
import public final function IsAnimatedMovement() : Bool;
import public final function GetPhysicalState() : ECharacterPhysicsState
;
import public final function SetGravity(flag : Bool);
import public final function SetBehaviorCallbackNeed(flag : Bool);
import public final function SetSwimming(flag : Bool);
import public final function SetWaterLevel(value : Float);

import
import
import
import
import
import
import
import
import
import

public
public
public
public
public
public
public
public
public
public

final
final
final
final
final
final
final
final
final
final

function
function
function
function
function
function
function
function
function
function

GetWaterLevel() : Float;
GetSubmergeDepth() : Float;
SetDiving(diving : Bool);
IsDiving() : Bool;
SetEmergeSpeed(value : Float);
GetEmergeSpeed() : Float;
SetRagdollPushingMul(value : Float);
GetRagdollPushingMul() : Float;
ApplyVelocity(vel : Vector);
RegisterEventListener(listener : IScriptabl

e);
import public final function UnregisterEventListener(listener : IScripta
ble);
import public final function SetPushable(pushable : Bool);
import public final function IsOnGround() : Bool;
import public final function IsCollidesWithCeiling() : Bool;
import public final function IsCollidesOnSide() : Bool;
import public final function IsFalling() : Bool;
import public final function IsSliding() : Bool;
import public final function GetSlideDir() : Vector;
import public final function GetSlideCoef() : Float;
import public final function SetSlidingSpeed(speed : Float);
import public final function SetSlidingLimits(min : Float, max : Float);
import public final function SetSliding(enable : Bool);
import public final function EnableAdditionalVerticalSlidingIteration(en
able : Bool);
import public final function IsAdditionalVerticalSlidingIterationEnabled
() : Bool;
import public final function SetTerrainLimits(min : Float, max : Float);
import public final function SetTerrainInfluence(mul : Float);
import public final function GetCapsuleHeight() : Float;
import public final function GetCapsuleRadius() : Float;
import public final function GetSlopePitch() : Float;
import public final function GetTerrainNormal(damped : Bool) : Vector;
import public final function GetTerrainNormalWide(normalAverage : Vector
, normalGlobal : Vector, directionToCheck : Vector, separationH : Float, separat
ionF : Float, separationB : Float);
import public final function SetVirtualControllersPitch(pitch : Float);
import public final function GetCollisionDataCount() : Int32;
import public final function GetCollisionData(index : Int32) : SCollisio
nData;
import public final function GetCollisionCharacterDataCount() : Int32;
import public final function GetCollisionCharacterData(index : Int32) :
SCollisionData;
import public final function GetGroundGridCollisionOn(side : ECollisionS
ides) : Bool;
import public final function EnableCollisionPrediction(enable : Bool);
import public final function EnableVirtualControllerCollisionResponse(vi
rtualControllerName : CName, enable : Bool);
import public final function GetMaterialName() : CName;
}
import abstract class CBehaviorGraphRotationControllerNode{
}
import abstract class CBehaviorGraphPositionControllerNode{
}
import abstract class CBehaviorGraphPositionControllerWithDampNode{
}

import abstract class CBehTreeNodeTemplateDefinition{


}
import abstract class CBehaviorGraphMotionExFilterNode{
}
import abstract class CBehaviorGraphMemoryNode{
}
import abstract class CBehaviorGraphValueAccNode{
}
import abstract class CBehaviorGraphInputNode{
}
import abstract class CBehaviorGraphTPoseNode{
}
import abstract class CBehaviorGraphIdentityPoseNode{
}
import abstract class CBehaviorGraphConstraintCameraDialog{
}
import abstract class CBehaviorGraphScriptNode{
}
import abstract class ICharacterCustomizationOperation{
}
import abstract class SBehaviorScriptContext{
}
import abstract class CBehaviorGraphOneMinusNode{
}
import abstract class CBehaviorGraphValueClampNode{
}
import abstract class CBehaviorGraphSelectionValueNode{
}
import abstract class CBehaviorGraphValueInterpolationNode{
}
import abstract class CBehaviorGraphLatchValueNode{
}
import abstract class CBehaviorGraphLatchVectorValueNode{
}
import abstract class CBehaviorGraphLatchForSomeTimeValueNode{
}
import abstract class CBehaviorGraphTimerValueNode{
}
import abstract class CBehaviorGraphMimicsModifierNode{
}

import abstract class CBehaviorGraphSpeedModulationNode{


}
import abstract class CBehaviorGraphSpringAngularDampValueNode{
}
import abstract class CBehaviorGraphSpringDampValueNode{
}
import abstract class StorySceneDefinition{
}
import abstract class CBehaviorGraphOptSpringDampValueNode{
}
import abstract class CBehaviorGraphPoseConstraintNode{
}
import abstract class CBehaviorGraphPoseConstraintWithTargetNode{
}
class CR4HudModuleMessage extends CR4HudModuleBase{
private var _bDuringDisplay : Bool;
private var _flashValueStorage : CScriptedFlashValueStorage;
public function OnConfigUI() : Bool{
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorMessage";
super.OnConfigUI();
_flashValueStorage = GetModuleFlashValueStorage();
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('MessageModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (!_bDuringDisplay){
if (CheckPendingMessages()){
DisplayPendingMessage();
}
}
/* NOP */;
}
public function OnMessageHidden() : Bool{
thePlayer.RemoveHudMessageByIndex(0);
_bDuringDisplay = false;
_flashValueStorage.SetFlashString('hud.message', "", /* NOP */);
/* NOP */;
}
public function CheckPendingMessages() : Bool{
if (thePlayer.GetHudMessagesSize() > 0){
return true;
}
return false;
/* NOP */;
}
public function DisplayPendingMessage(){
var str : String;
var strDebug : String;

_bDuringDisplay = true;
str = thePlayer.GetHudPendingMessage();
strDebug = GetLocStringByKey(str);
if (strDebug != ""){
str = strDebug;
}
_flashValueStorage.SetFlashString('hud.message', str, /* NOP */)
;
ShowElement(true, /* NOP */);
/* NOP */;
}
}
import abstract class CBehaviorGraphMimicPoseNode{
}
import abstract class CAnimConstraintsParam{
}
import abstract class CAnimGlobalParam{
}
import abstract class CAnimBehaviorsParam{
}
import abstract class CAnimAnimsetsParam{
}
import abstract class CAnimMimicParam{
}
import abstract class CBehaviorGraphAnimationManualSlotNode{
}
import abstract class CBehaviorGraphAnimationManualWithInputSlotNode{
}
import abstract class CBehaviorGraphAnimationMixerSlotNode{
}
import abstract class CBehaviorGraphMimicManualSlotNode{
}
import abstract class SRuntimeAnimationData{
}
import abstract class SAnimationFullState{
}
import abstract class SAnimationMappedPose{
}
import abstract class SSlotEventAnim{
}
import abstract class CAnimSlotsParam{
}
import abstract class VirtualAnimation{
}

import abstract class VirtualAnimationMotion{


}
import abstract class VirtualAnimationPoseFK{
}
import abstract class VirtualAnimationPoseIK{
}
import abstract class SAbilityAttribute{
}
import abstract class VirtualAnimationLayer{
}
import abstract class ISkeletalAnimationSetEntryParam{
}
import abstract class CSkeletalAnimationTrajectoryParam{
}
import abstract class CSkeletalAnimationTrajectoryTrackParam{
}
import abstract class IInventoryInitializer{
}
import abstract class CSkeletalAnimationAttackTrajectoryParam{
}
import abstract class CAnimPointCloudLookAtParam{
}
import abstract class CInventoryDefinitionEntry{
}
import struct AnimationTrajectoryPlayerScriptWrapper{
import public final function Init(entity : CEntity, slotName : CName);
import public final function Deinit();
import public final function SelectAnimation(input : SAnimationTrajector
yPlayerInput) : SAnimationTrajectoryPlayerToken;
import public final function PlayAnimation(animationToken : SAnimationTr
ajectoryPlayerToken) : Bool;
import public final function Tick(dt : Float);
import public final function IsPlayingAnimation() : Bool;
import public final function IsBeforeSyncTime() : Bool;
import public final function UpdateCurrentPoint(pointWS : Vector);
import public final function UpdateCurrentPointM(l2w : Matrix, pointWS :
Vector);
import public final function GetTime() : Float;
import public final latent function WaitForSyncTime() : Bool;
import public final latent function WaitForFinish() : Bool;
}
import abstract class SAnimationTrajectoryPlayerToken{
}
import abstract class SAnimationTrajectoryPlayerInput{
}

import abstract class Matrix{


//NULL type for W
}
import abstract class CSkeletalAnimationHitParam{
}
import abstract class CBehaviorGraphRetargetCharacterNode{
}
class CR4HudModuleTimeLapse extends CR4HudModuleBase{
private var m_fxSetShowTimeSFF : CScriptedFlashFunction;
private var m_fxSetTimeLapseMessage : CScriptedFlashFunction;
private var m_fxSetTimeLapseAdditionalMessage : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorTimelapse";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetShowTimeSFF = flashModule.GetMemberFlashFunction("SetShow
Time");
m_fxSetTimeLapseMessage = flashModule.GetMemberFlashFunction("ha
ndleTimelapseTextSet");
m_fxSetTimeLapseAdditionalMessage = flashModule.GetMemberFlashFu
nction("handleTimelapseAdditionalTextSet");
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('TimeLapseModule', true);
}
/* NOP */;
}
public function SetShowTime(showTime : Float){
m_fxSetShowTimeSFF.InvokeSelfOneArg(FlashArgNumber(showTime * 10
00));
/* NOP */;
}
public function SetTimeLapseMessage(localisationKey : String){
var str : String;
str = GetLocStringByKeyExt(localisationKey);
if (str == "#" || StrUpper(str) == "#NONE"){
m_fxSetTimeLapseMessage.InvokeSelfOneArg(FlashArgString(
""));
} else {
m_fxSetTimeLapseMessage.InvokeSelfOneArg(FlashArgString(
str));
}
/* NOP */;
}
public function SetTimeLapseAdditionalMessage(localisationKey : String){
var str : String;
str = GetLocStringByKeyExt(localisationKey);
if (str == "#" || StrUpper(str) == "#NONE"){
m_fxSetTimeLapseAdditionalMessage.InvokeSelfOneArg(Flash
ArgString(""));
} else {
m_fxSetTimeLapseAdditionalMessage.InvokeSelfOneArg(Flash
ArgString(str));
}

/* NOP */;
}
public function Show(bShow : Bool){
ShowElement(bShow, /* NOP */);
/* NOP */;
}
}
import abstract class CBehaviorGraphRetargetCharacterNodeMethod_Scale{
}
import abstract class CBehaviorGraphRetargetCharacterNodeMethod_Skeleton{
}
import abstract class CBehaviorGraphRetargetCharacterNodeMethod_SkeletonMapper{
}
import abstract class CAnimDangleComponent{
}
import abstract class CAnimDangleBufferComponent{
}
import abstract class IAnimDangleConstraint{
}
import abstract class CAnimSkeletalDangleConstraint{
}
import abstract class CAnimSkeletalMultiDangleConstraint{
}
import abstract class CAnimSkeletalMultiDangleConstraint_Painter{
}
import abstract class CAnimDangleConstraint_Collar{
}
import abstract class CAnimDangleConstraint_Pusher{
}
import abstract class CJobAction{
}
import abstract class CAnimDangleConstraint_Hood{
}
import struct CTimerScriptKeyword{
//NULL type for timeDeltaUnscaled
//NULL type for timeDelta
}
class W3Trap extends W3MonsterClue{
public const var ARM_INTERACTION_COMPONENT_NAME : String;
public const var DISARM_INTERACTION_COMPONENT_NAME : String;
protected saved var m_IsActive : Bool;
protected var m_Targets : array<CNode>;
protected saved var m_isArmed : Bool;
protected saved var m_wasSprung : Bool;
protected saved var m_isPlayingAnimation : Bool;

private var isPlayingInteractionAnim : Bool;


private editable var activeByDefault : Bool;
private editable var factOnArm : SFactParameters;
private editable var factOnDisarm : SFactParameters;
private editable var factOnActivation : SFactParameters;
private editable var factOnDeactivation : SFactParameters;
private editable var deactivateAfterTime : Float;
private editable var appearanceActivated : String;
private editable var appearanceDeactived : String;
private editable var appearanceArmed : String;
private editable var appearanceDisarmed : String;
private editable var canBeArmed : Bool;
private editable var interactibleAfterSprung : Bool;
private editable var willActivateWhenHit : Bool;
private editable var soundOnArm : CName;
private editable var soundOnDisarm : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
m_IsActive = false;
if (activeByDefault){
Activate(/* NOP */);
}
UpdateVisibility();
StructFactsHack();
UpdateInteraction(/* NOP */);
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (interactionComponentName == "Arm"){
if (m_isPlayingAnimation){
return false;
}
}
if (interactionComponentName == "Disarm"){
if (m_isPlayingAnimation){
return false;
}
}
return true;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator != thePlayer && !thePlayer.IsActionAllowed(12)){
return false;
}
if (actionName == "Arm"){
m_isArmed = true;
m_isPlayingAnimation = true;
AddTimer('ArmTrapTimer', interactionAnimTime, false, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (actionName == "Disarm"){
m_isPlayingAnimation = true;
AddTimer('DisarmTrapTimer', interactionAnimTime, false,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
PlayInteractionAnimation();
super.OnInteraction(actionName, activator);

/* NOP */;
}
public function OnClueDetected() : Bool{
super.OnClueDetected();
UpdateInteraction(/* NOP */);
/* NOP */;
}
public function OnWeaponHit(act : W3DamageAction) : Bool{
if (willActivateWhenHit){
Activate(/* NOP */);
}
/* NOP */;
}
public function Activate(_Target : CNode){
if (!m_IsActive){
m_IsActive = true;
m_wasSprung = true;
AddTimer('Update', 0, true, /* NOP */, /* NOP */, true,
/* NOP */);
if (factOnActivation.ID != ""){
if (FactsDoesExist(factOnActivation.ID)){
FactsSet(factOnActivation.ID, factOnActi
vation.value, factOnActivation.validFor);
} else {
FactsAdd(factOnActivation.ID, factOnActi
vation.value, factOnActivation.validFor);
}
}
ApplyAppearance(appearanceActivated);
if (deactivateAfterTime > 0){
AddTimer('Deactivate', deactivateAfterTime, /* N
OP */, /* NOP */, /* NOP */, true, /* NOP */);
}
}
if (_Target){
m_Targets.PushBack(_Target);
}
DisableAllInteractions();
/* NOP */;
}
public timer function Deactivate(optional _Delta : Float, optional id :
Int32){
if (m_IsActive){
m_IsActive = false;
RemoveTimer('Update', /* NOP */);
if (factOnDeactivation.ID != ""){
if (FactsDoesExist(factOnDeactivation.ID)){
FactsSet(factOnDeactivation.ID, factOnDe
activation.value, factOnDeactivation.validFor);
} else {
FactsAdd(factOnDeactivation.ID, factOnDe
activation.value, factOnDeactivation.validFor);
}
}
ApplyAppearance(appearanceDeactived);
}
RemoveTimer('Deactivate', /* NOP */);
UpdateInteraction(/* NOP */);
/* NOP */;
}

public final function RemoveTarget(_Target : CNode){


m_Targets.Remove(_Target);
/* NOP */;
}
private timer function ArmTrapTimer(optional _Delta : Float, optional id
: Int32){
GetWitcherPlayer().DisplayHudMessage("panel_hud_message_trap_arm
ed");
if (IsNameValid(soundOnArm)){
SoundEvent(soundOnArm, /* NOP */, /* NOP */);
}
Arm(true);
m_isPlayingAnimation = false;
/* NOP */;
}
private timer function DisarmTrapTimer(optional _Delta : Float, optional
id : Int32){
GetWitcherPlayer().DisplayHudMessage("panel_hud_message_trap_dis
armed");
if (IsNameValid(soundOnDisarm)){
SoundEvent(soundOnDisarm, /* NOP */, /* NOP */);
}
Arm(false);
m_isPlayingAnimation = false;
/* NOP */;
}
public function Arm(shouldArm : Bool){
if (shouldArm){
m_isArmed = true;
ApplyAppearance(appearanceArmed);
UpdateInteraction(/* NOP */);
} else {
m_isArmed = false;
ApplyAppearance(appearanceDisarmed);
Deactivate(/* NOP */, /* NOP */);
}
SetFacts();
/* NOP */;
}
public function UpdateInteraction(comp : CComponent){
var armComp : CComponent;
var disarmComp : CComponent;
armComp = GetComponent(ARM_INTERACTION_COMPONENT_NAME);
disarmComp = GetComponent(DISARM_INTERACTION_COMPONENT_NAME);
if (GetWasDetected() && armComp && disarmComp){
if (m_isArmed){
armComp.SetEnabled(false);
disarmComp.SetEnabled(true);
} else {
if (canBeArmed){
if (m_wasSprung){
if (interactibleAfterSprung){
armComp.SetEnabled(true)
;
}
} else {
armComp.SetEnabled(true);
}
}
disarmComp.SetEnabled(false);

}
} else {
LogAssert(false, "Trap <<" + this + ">> doesn't have bot
h Arm and Disarm Interactive components");
}
super.UpdateInteraction(comp);
/* NOP */;
}
public function DisableAllInteractions(){
var armComp : CComponent;
var disarmComp : CComponent;
armComp = GetComponent(ARM_INTERACTION_COMPONENT_NAME);
disarmComp = GetComponent(DISARM_INTERACTION_COMPONENT_NAME);
if (armComp && disarmComp){
armComp.SetEnabled(false);
disarmComp.SetEnabled(false);
}
/* NOP */;
}
private function SetFacts(){
if (!m_isArmed){
if (factOnDisarm.ID != ""){
if (!FactsDoesExist(factOnDisarm.ID)){
FactsAdd(factOnDisarm.ID, factOnDisarm.v
alue, factOnDisarm.validFor);
}
}
if (factOnArm.ID != ""){
if (FactsDoesExist(factOnArm.ID)){
FactsRemove(factOnArm.ID);
}
}
} else {
if (factOnDisarm.ID != ""){
if (FactsDoesExist(factOnDisarm.ID)){
FactsRemove(factOnDisarm.ID);
}
}
if (factOnArm.ID != ""){
if (!FactsDoesExist(factOnArm.ID)){
FactsAdd(factOnArm.ID, factOnArm.value,
factOnArm.validFor);
}
}
}
/* NOP */;
}
private function StructFactsHack(){
if (factOnArm.ID != ""){
if (factOnArm.value == 0){
factOnArm.value = 1;
}
if (factOnArm.validFor == 0){
factOnArm.validFor = -1;
}
}
if (factOnDisarm.ID != ""){
if (factOnDisarm.value == 0){
factOnDisarm.value = 1;
}

if (factOnDisarm.validFor == 0){
factOnDisarm.validFor = -1;
}
}
if (factOnActivation.ID != ""){
if (factOnActivation.value == 0){
factOnActivation.value = 1;
}
if (factOnActivation.validFor == 0){
factOnActivation.validFor = -1;
}
}
if (factOnDeactivation.ID != ""){
if (factOnDeactivation.value == 0){
factOnDeactivation.value = 1;
}
if (factOnDeactivation.validFor == 0){
factOnDeactivation.validFor = -1;
}
}
/* NOP */;
}
public function OnManageTrap(operations : array<ETrapOperation>, activat
or : CActor) : Bool{
var i : Int32;
var size : Int32;
if (m_isArmed){
size = operations.Size();
i = 0;
while (i < size){
switch(operations[i]){
case 0:
Activate(activator);
break;
case 1:
Deactivate(/* NOP */, /* NOP */);
break;
}
i += 1;
}
}
/* NOP */;
}
}
import abstract class CAnimDangleConstraint_Breast{
}
import abstract class CAnimDangleConstraint_Hinge{
}
import abstract class CJobForceOutAction{
}
import abstract class CAnimDangleConstraint_Dyng{
}
import abstract class CJobTreeNode{
}

import abstract class CAnimationSyncToken_Dyng{


}
import abstract class CBehaviorGraphBlendMultipleCondNode{
}
import abstract class CBehaviorGraphBlendMultipleCondNode_ConstDampMethod{
}
import abstract class CBehaviorGraphBlendMultipleCondNode_Multi{
}
import abstract class CBehaviorGraphBlendMultipleCondNode_AnimEvent{
}
import abstract class CBehaviorGraphBlendMultipleCondNode_AnimEnd{
}
import abstract class CBehaviorGraphCharacterMotionToWSNode{
}
import struct CDropPhysicsComponent{
import public final function DropMeshByName(meshName : String, direction
: Vector, curveName : CName) : Bool;
import public final function DropMeshByTag(meshTag : CName, direction :
Vector, curveName : CName) : Bool;
}
class W3IllusionSpawner extends CGameplayEntity{
private editable var m_illusionTemplate : CEntityTemplate;
public editable var m_factOnDispelOverride : String;
private var l_illusion : CEntity;
private var spawnedIllusion : W3IllusionaryObstacle;
public editable var m_discoveryOneliner : EIllusionDiscoveredOneliner;
public editable var m_factOnDiscoveryOverride : String;
public editable var discoveryOnelinerTag : String;
public editable var spawnedObstacleTags : array<CName>;
private saved var m_wasDestroyed : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (!m_wasDestroyed){
SpawnIllusion();
}
/* NOP */;
}
public function SpawnIllusion(){
var i : Int32;
l_illusion = theGame.CreateEntity(m_illusionTemplate, GetWorldPo
sition(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
spawnedIllusion = (W3IllusionaryObstacle)l_illusion;
if (m_factOnDispelOverride != ""){
spawnedIllusion.OverrideIllusionObstacleFactOnSpawn(m_fa
ctOnDispelOverride);
}
if (m_factOnDiscoveryOverride != ""){
spawnedIllusion.OverrideIllusionObstacleFactOnDiscovery(
m_factOnDiscoveryOverride);
}
spawnedIllusion.SetOneLinerHandling(m_discoveryOneliner);
spawnedIllusion.SetDiscoveryOnelinerTag(discoveryOnelinerTag);

i = 0;
while (i < spawnedObstacleTags.Size()){
spawnedIllusion.AddTag(spawnedObstacleTags[i]);
i += 1;
}
spawnedIllusion.SetIllusionSpawner(this);
/* NOP */;
}
public function ManualDispel(){
spawnedIllusion.Dispel();
spawnedIllusion.DestroyObstacle(/* NOP */);
/* NOP */;
}
public function SetDestroyed(){
m_wasDestroyed = true;
/* NOP */;
}
}
import abstract class CBrushBuilder{
}
import abstract class CBrushCompiledData{
}
statemachine class W3IllusionaryObstacle extends CGameplayEntity{
private editable var focusAreaIntensity : Float;
public editable saved var isEnabled : Bool;
protected editable var m_disappearanceEffectDuration : Float;
public editable var m_addFactOnDispel : String;
public editable var m_addFactOnDiscovery : String;
public editable var discoveryOnelinerTag : String;
private saved var m_discoveryOneliner : EIllusionDiscoveredOneliner;
private saved var m_illusionDiscoveredEver : Bool;
private var m_illusionDiscoveredThisSession : Bool;
private var interactionComponent : CInteractionComponent;
private var meshComponent : CMeshComponent;
private var m_effectRange : Float;
private saved var m_wasDestroyed : Bool;
private var m_illusionSpawner : W3IllusionSpawner;
private saved var isFocusAreaActive : Bool;
public editable var focusModeHighlight : EFocusModeVisibility;
public var i : Int32;
public var l_entitiesAround : array<CGameplayEntity>;
public var l_illusion : W3IllusionaryObstacle;
public var saveLockID : Int32;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (m_wasDestroyed){
Destroy();
} else {
if (!spawnData.restored){
m_illusionDiscoveredEver = false;
}
m_illusionDiscoveredThisSession = false;
SetFocusModeVisibility(focusModeHighlight, /* NOP */);
GotoStateAuto();
}
/* NOP */;
}
public function SetOneLinerHandling(h : EIllusionDiscoveredOneliner){

m_discoveryOneliner = h;
/* NOP */;
}
public function Dispel(){
meshComponent = (CMeshComponent)GetComponentByClassName('CMeshCo
mponent');
PlayEffect('dissapear', /* NOP */);
AddTimer('DeactivateFocusArea', m_disappearanceEffectDuration, f
alse, /* NOP */, /* NOP */, true, /* NOP */);
interactionComponent.SetEnabled(false);
if (m_addFactOnDispel != ""){
FactsAdd(m_addFactOnDispel, 1, /* NOP */);
}
/* NOP */;
}
private timer function DeactivateFocusArea(optional _delta : Float, opti
onal id : Int32){
isFocusAreaActive = false;
theGame.GetFocusModeController().SetFocusAreaIntensity(0.000000)
;
/* NOP */;
}
public function OverrideIllusionObstacleFactOnSpawn(overrideFactName : S
tring){
m_addFactOnDispel = overrideFactName;
/* NOP */;
}
public function OverrideIllusionObstacleFactOnDiscovery(overrideFactName
: String){
m_addFactOnDiscovery = overrideFactName;
/* NOP */;
}
public function SetDestroyed(){
m_wasDestroyed = true;
if (m_illusionSpawner){
m_illusionSpawner.SetDestroyed();
}
/* NOP */;
}
public function SetIllusionSpawner(_illusionSpawner : W3IllusionSpawner)
{
m_illusionSpawner = _illusionSpawner;
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (interactionComponentName != "dispel" || activator != thePlay
er || !isEnabled || thePlayer.GetPlayerAction() != 0){
return false;
}
if (!interactionComponent){
interactionComponent = (CInteractionComponent)GetCompone
nt('dispel');
}
return PlayerHasMedallion();
/* NOP */;
}
public function DestroyObstacle(destroyAfter : Float){
if (destroyAfter == 0.000000){
destroyAfter = m_disappearanceEffectDuration;

}
AddTimer('DestroyTimer', destroyAfter, false, /* NOP */, /* NOP
*/, true, /* NOP */);
SetDestroyed();
/* NOP */;
}
public function SetIllusionEnabled(enabled : Bool){
isEnabled = enabled;
/* NOP */;
}
public function PlayerHasMedallion() : Bool{
var playerInventory : CInventoryComponent;
playerInventory = thePlayer.GetInventory();
if (playerInventory.HasItem('Illusion Medallion')){
return true;
}
return false;
/* NOP */;
}
public final function SetDiscoveryOnelinerTag(t : String){
discoveryOnelinerTag = t;
/* NOP */;
}
public function DispelAllIlussions(){
FindGameplayEntitiesInSphere(l_entitiesAround, thePlayer.GetWorl
dPosition(), m_effectRange, 999, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < l_entitiesAround.Size()){
l_illusion = (W3IllusionaryObstacle)l_entitiesAround[i];
if (l_illusion){
l_illusion.Dispel();
if (l_illusion != this){
l_illusion.DestroyObstacle(m_disappearan
ceEffectDuration);
}
}
i += 1;
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator != thePlayer || !thePlayer.CanPerformPlayerAction(
/* NOP */)){
return false;
}
interactionComponent.SetEnabled(false);
GotoState('Interacting', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var play : Bool;
var groupDiscovered : Bool;
var i : Int32;
var tags : array<CName>;
if (activator.GetEntity() != thePlayer || m_wasDestroyed || !isE
nabled || !PlayerHasMedallion()){
return false;
}

if (activator.GetEntity() == thePlayer && FactsQuerySum("blocked


_illusion_oneliner") == 0 && thePlayer.IsAlive() && thePlayer.inv.GetItemQuantit
yByTag(theGame.params.TAG_ILLUSION_MEDALLION, /* NOP */) > 0){
play = false;
groupDiscovered = false;
tags = GetTags();
i = 0;
while (i < tags.Size()){
if (FactsQuerySum("io_disc_" + NameToString(tags
[i]))){
play = false;
groupDiscovered = true;
break;
}
i += 1;
}
if (!groupDiscovered){
if (m_discoveryOneliner == 2){
play = true;
} else if (m_discoveryOneliner == 1){
if (!m_illusionDiscoveredEver){
m_illusionDiscoveredEver = true;
play = true;
}
} else if (m_discoveryOneliner == 0){
if (!m_illusionDiscoveredThisSession){
m_illusionDiscoveredThisSession
= true;
play = true;
}
}
}
if (play){
thePlayer.PlayVoiceset(90, "OnUsingEye", /* NOP
*/);
FactsAdd("blocked_illusion_oneliner", 1, CeilF(t
hePlayer.delayBetweenIllusionOneliners));
isFocusAreaActive = true;
theGame.GetFocusModeController().SetFocusAreaInt
ensity(focusAreaIntensity);
if (activator.GetEntity() == thePlayer && m_addF
actOnDiscovery != "" && thePlayer.inv.GetItemQuantityByTag(theGame.params.TAG_IL
LUSION_MEDALLION, /* NOP */) > 0){
if (!FactsDoesExist(m_addFactOnDiscovery
)){
FactsAdd(m_addFactOnDiscovery, 1
, /* NOP */);
}
}
}
if (discoveryOnelinerTag != ""){
FactsAdd("io_disc_" + discoveryOnelinerTag, /* N
OP */, /* NOP */);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() != thePlayer){

return false;
}
isFocusAreaActive = false;
theGame.GetFocusModeController().SetFocusAreaIntensity(0.000000)
;
/* NOP */;
}
}
import abstract class EmitterDurationSettings{
}
import abstract class EmitterDelaySettings{
}
import abstract class IParticleInitializer{
}
import abstract class SEntityActionsRouterEntry{
}
import abstract class IParticleModificator{
}
import abstract class CParticleComponent{
}
import abstract class CSTableEntry{
}
import abstract class CParticleDrawerBillboard{
}
import abstract class CParticleDrawerRain{
}
import abstract class CSStoryPhaseTimetableEntry{
}
import abstract class CParticleDrawerEmitterOrientation{
}
import abstract class CParticleDrawerMotionBlur{
}
import abstract class CParticleDrawerSphereAligned{
}
import abstract class IEngineSpawnStrategy{
}
import abstract class CParticleDrawerTrail{
}
import abstract class CParticleDrawerFacingTrail{
}
import abstract class CParticleDrawerScreen{
}

import abstract class CParticleDrawerMesh{


}
import abstract class CParticleDrawerBeam{
}
import abstract class CCommunityInitializers{
}
import abstract class CParticleInitializerPosition{
}
import abstract class CParticleInitializerSize{
}
import abstract class CParticleInitializerSize3D{
}
statemachine class W3BeeSwarm extends CGameplayEntity{
public editable var damageVal : SAbilityAttributeValue;
public editable var destroyEntAfter : Float;
public editable var velocity : Float;
public editable var bIsEnabled : Bool;
public editable var AIReactionRange : Float;
public editable var ignoreNPCsFriendlyToPlayer : Bool;
public editable var maxChaseDistance : Float;
public editable var desiredTargetTag : CName;
public editable var excludedEntitiesTags : array<CName>;
private var originEntity : CGameplayEntity;
private var originPoint : Vector;
private var victims : array<SSwarmVictim>;
private var buffParams : SCustomEffectParams;
private var targets : array<CGameplayEntity>;
private var activeDistanceSquared : Float;
public const var PLAYER_PRESENCE_CHECK_DISTANCE : Float;
public const var PRESENCE_CHECK_DT : Float;
public const var TARGETS_CHECK_DT : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
originPoint = GetWorldPosition();
activeDistanceSquared = MaxF(maxChaseDistance, PLAYER_PRESENCE_C
HECK_DISTANCE);
activeDistanceSquared *= activeDistanceSquared;
Enable(bIsEnabled);
/* NOP */;
}
public function Enable(flag : Bool){
bIsEnabled = flag;
if (bIsEnabled){
if (velocity <= 0.010000){
GotoState('Stationary', /* NOP */, /* NOP */);
} else {
GotoState('FarFromPlayer', /* NOP */, /* NOP */)
;
}
} else {
GotoState('Disabled', /* NOP */, /* NOP */);
}
/* NOP */;
}

public function SetVelocity(newVel : Float){


if (newVel == 0){
GotoState('Stationary', /* NOP */, /* NOP */);
} else if (IsPlayerTooFar()){
GotoState('FarFromPlayer', /* NOP */, /* NOP */);
} else {
GotoState('BeeSwarm_Idle', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function IsPlayerTooFar() : Bool{
var originToPlayerDistSq : Float;
if (!thePlayer){
return true;
}
originToPlayerDistSq = VecDistanceSquared(GetOriginPoint(), theP
layer.GetWorldPosition());
return originToPlayerDistSq > activeDistanceSquared;
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
if (bIsEnabled){
Enable(false);
PlayEffect('bee_fire', /* NOP */);
AddTimer('DestroyEnt', destroyEntAfter, /* NOP */, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
}
super.OnFireHit(source);
/* NOP */;
}
public timer function DestroyEnt(optional dt : Float, optional id : Int3
2){
if (buffParams.buffSpecificParams){
delete buffParams.buffSpecificParams;
}
Destroy();
/* NOP */;
}
public function SetSwarmOriginEntity(e : CGameplayEntity){
originEntity = e;
/* NOP */;
}
public function GetOriginPoint() : Vector{
if (originEntity){
return originEntity.GetWorldPosition();
}
return originPoint;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var victim : CActor;
var swarmVictim : SSwarmVictim;
var wasVictimBefore : Bool;
var i : Int32;
var cnt : Int32;
if (area.GetName() == "damageArea"){
victim = (CActor)activator.GetEntity();
if (victim){
wasVictimBefore = false;

cnt = 0;
i = 0;
while (i < victims.Size()){
if (victims[i].actor == victim){
wasVictimBefore = true;
victims[i].inTrigger = true;
}
if (victims[i].inTrigger){
cnt += 1;
}
i += 1;
}
if (!wasVictimBefore){
swarmVictim.actor = victim;
swarmVictim.timeInSwarm = 0.000000;
swarmVictim.inTrigger = true;
victims.PushBack(swarmVictim);
cnt += 1;
}
if (cnt == 1){
AddTimer('ApplyEffect', 0.100000, true,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
return true;
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var victim : CActor;
var i : Int32;
var empty : Bool;
if (area.GetName() == "damageArea"){
victim = (CActor)activator.GetEntity();
if (victim){
i = 0;
while (i < victims.Size()){
if (victims[i].actor == victim){
victims[i].inTrigger = false;
break;
}
i += 1;
}
empty = true;
i = 0;
while (i < victims.Size()){
if (victims[i].inTrigger){
empty = false;
break;
}
i += 1;
}
if (empty){
RemoveTimer('ApplyEffect', /* NOP */);
}
return true;
}
}
/* NOP */;

}
public timer function ApplyEffect(optional deltaTime : Float, optional i
d : Int32){
var i : Int32;
var specParams : W3BuffDoTParams;
var damageAction : W3DamageAction;
var damage : Float;
if (buffParams.effectType == 0){
specParams = new W3BuffDoTParams in this;
specParams.isEnvironment = true;
buffParams.vibratePadLowFreq = 0.100000;
buffParams.vibratePadHighFreq = 0.200000;
buffParams.effectType = 52;
buffParams.creator = this;
buffParams.sourceName = "beeSwarm";
buffParams.duration = 1;
buffParams.effectValue = damageVal;
buffParams.buffSpecificParams = specParams;
}
i = 0;
while (i < victims.Size()){
if (!victims[i].inTrigger){
} else {
victims[i].timeInSwarm += deltaTime;
if ((CPlayer)victims[i].actor || CeilF(victims[i
].timeInSwarm) % 15 < 3){
victims[i].actor.AddEffectCustom(buffPar
ams);
} else {
damageAction = new W3DamageAction in the
Game;
damageAction.Initialize(this, victims[i]
.actor, NULL, "beeSwarm3Plus", 0, 2, false, false, false, true, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
damage = deltaTime * damageVal.valueAddi
tive + damageVal.valueMultiplicative * victims[i].actor.GetMaxHealth();
damageAction.AddDamage(theGame.params.DA
MAGE_NAME_PHYSICAL, damage);
damageAction.SetIsDoTDamage(deltaTime);
damageAction.SetIgnoreArmor(true);
damageAction.SetCanPlayHitParticle(false
);
theGame.damageMgr.ProcessAction(damageAc
tion);
delete damageAction;
}
}
i += 1;
}
/* NOP */;
}
public timer function CheckForTargets(optional dt : Float, optional id :
Int32){
var i : Int32;
var j : Int32;
var distSq : Float;
var orig : Vector;
targets.Clear();
FindGameplayEntitiesInCylinder(targets, GetWorldPosition(), AIRe
actionRange, 10, 10000, 'None', 4 + 16384, /* NOP */, /* NOP */);

distSq = maxChaseDistance - 1 * maxChaseDistance - 1;


orig = GetOriginPoint();
i = targets.Size() - 1;
while (i >= 0){
if (VecDistanceSquared(targets[i].GetWorldPosition(), or
ig) > distSq){
targets.Erase(i);
} else if (ignoreNPCsFriendlyToPlayer && targets[i] != t
hePlayer && GetAttitudeBetween(targets[i], thePlayer) == 0){
targets.Erase(i);
} else {
j = 0;
while (j < excludedEntitiesTags.Size()){
if (targets[i].HasTag(excludedEntitiesTa
gs[j])){
targets.Erase(i);
break;
}
j += 1;
}
}
i -= 1;
}
/* NOP */;
}
public function HasTarget() : Bool{
return targets.Size() > 0;
/* NOP */;
}
public function GetTargets() : array<CGameplayEntity>{
return targets;
/* NOP */;
}
public function ClearVictims(){
victims.Clear();
/* NOP */;
}
}
import abstract class CParticleInitializerColor{
}
import abstract class CParticleInitializerAlpha{
}
import abstract class CSStoryPhaseSpawnTimetableEntry{
}
import abstract class CParticleInitializerLifeTime{
}
import abstract class CParticleInitializerRotation{
}
import struct ISpawnTreeInitializerCommunityAI{
public editable inlined var ai : CAIRedefinitionParameters;
public function Init(){
var params : CAINpcWorkIdleParams;
var newAi : CAIMultiRedefinitionParameters;
var subparams : array<CAIRedefinitionParameters>;

var idleAI : CAICommunityRedefinitionParameters;


var combatAI : CAICombatDecoratorRedefinitionParameters;
var workIdle : CAINpcWorkIdle;
super.Init();
idleAI = new CAICommunityRedefinitionParameters in this;
idleAI.OnCreated();
workIdle = new CAINpcWorkIdle in this;
idleAI.idleTree = workIdle;
workIdle.OnCreated();
workIdle.actionPointSelector = new CCommunityActionPointSelector
in workIdle;
combatAI = new CAICombatDecoratorRedefinitionParameters in this;
combatAI.OnCreated();
combatAI.combatDecorator = new CAICombatDecoratorCommunity in th
is;
combatAI.combatDecorator.OnCreated();
combatAI.OnManualRuntimeCreation();
newAi = new CAIMultiRedefinitionParameters in this;
newAi.OnCreated();
newAi.subParams.Resize(2);
newAi.subParams[0] = idleAI;
newAi.subParams[1] = combatAI;
newAi.OnManualRuntimeCreation();
ai = newAi;
/* NOP */;
}
}
import abstract class CParticleInitializerRotation3D{
}
class W3AnimatedContainer extends W3Container{
public editable var animationForAllInteractions : Bool;
public editable var interactionName : String;
public editable var holsterWeaponAtTheBeginning : Bool;
public editable var interactionAnim : EPlayerExplorationAction;
public editable var slotAnimName : CName;
public editable var interactionAnimTime : Float;
public editable var desiredPlayerToEntityDistance : Float;
public editable var matchPlayerHeadingWithHeadingOfTheEntity : Bool;
public editable var attachThisObjectOnAnimEvent : Bool;
public editable var attachSlotName : CName;
public editable var attachAnimName : CName;
public editable var detachAnimName : CName;
private var objectAttached : Bool;
private var objectCachedPos : Vector;
private var objectCachedRot : EulerAngles;
public function OnDetaching() : Bool{
if (isPlayingInteractionAnim){
OnPlayerActionEnd();
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
super.OnInteraction(actionName, activator);
if (activator == thePlayer && thePlayer.IsActionAllowed(12) && t
hePlayer.CanPerformPlayerAction(true)){
if (animationForAllInteractions == true || actionName ==
interactionName && !lockedByKey){

PlayInteractionAnimation();
}
}
/* NOP */;
}
public function ProcessLoot(){
}
public function OnStreamIn() : Bool{
super.OnStreamIn();
/* NOP */;
}
public function OnContainerClosed(){
if (!HasQuestItem()){
StopEffect('quest_highlight_fx');
}
if (isPlayingInteractionAnim){
thePlayer.PlayerStopAction(interactionAnim);
}
super.OnContainerClosed();
/* NOP */;
}
public function PlayInteractionAnimation(){
if (interactionAnim == 1 && !IsNameValid(slotAnimName)){
super.ProcessLoot();
return;
}
if (interactionAnim != 0){
if (attachThisObjectOnAnimEvent){
thePlayer.AddAnimEventChildCallback(this, attach
AnimName, 'OnAnimEvent_Custom');
thePlayer.AddAnimEventChildCallback(this, detach
AnimName, 'OnAnimEvent_Custom');
}
thePlayer.RegisterForPlayerAction(this, false);
if (ShouldBlockGameplayActionsOnInteraction()){
BlockGameplayActions(true);
}
if (!GetToPointAndStartAction()){
OnPlayerActionEnd();
}
isPlayingInteractionAnim = true;
if (interactionAnim == 1){
return;
}
if (interactionAnimTime < 1.000000){
interactionAnimTime = 1.000000;
}
if (skipInventoryPanel){
AddTimer('TimerDeactivateAnimation', interaction
AnimTime, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
super.ProcessLoot();
}
/* NOP */;
}
public function BlockGameplayActions(lock : Bool){
var exceptions : array<EInputActionBlock>;
exceptions.PushBack(19);
if (lock && holsterWeaponAtTheBeginning){

thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);


}
if (lock){
thePlayer.BlockAllActions('W3AnimationInteractionEntity'
, true, exceptions, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.BlockAllActions('W3AnimationInteractionEntity'
, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function ShouldBlockGameplayActionsOnInteraction() : Bool{
return true;
/* NOP */;
}
public function GetToPointAndStartAction() : Bool{
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = thePlayer.GetMovingAgentComponent().GetMoveme
ntAdjustor();
ticket = movementAdjustor.CreateNewRequest('InteractionEntity');
movementAdjustor.AdjustmentDuration(ticket, 0.500000);
if (matchPlayerHeadingWithHeadingOfTheEntity){
movementAdjustor.RotateTowards(ticket, this, /* NOP */);
}
if (desiredPlayerToEntityDistance >= 0){
movementAdjustor.SlideTowards(ticket, this, desiredPlaye
rToEntityDistance, /* NOP */);
}
return thePlayer.PlayerStartAction(interactionAnim, slotAnimName
);
/* NOP */;
}
private function AttachObject(){
if (objectAttached){
return;
}
objectCachedPos = GetWorldPosition();
objectCachedRot = GetWorldRotation();
CreateAttachment(thePlayer, attachSlotName, /* NOP */, /* NOP */
);
objectAttached = true;
/* NOP */;
}
private function DetachObject(){
if (!objectAttached){
return;
}
BreakAttachment();
TeleportWithRotation(objectCachedPos, objectCachedRot);
objectAttached = false;
/* NOP */;
}
public function OnPlayerActionStartFinished() : Bool{
if (!skipInventoryPanel){
ShowLoot();
}
/* NOP */;
}
public function OnPlayerActionEnd() : Bool{

isPlayingInteractionAnim = false;
thePlayer.UnregisterForPlayerAction(this, false);
thePlayer.RemoveAnimEventChildCallback(this, attachAnimName);
thePlayer.RemoveAnimEventChildCallback(this, detachAnimName);
if (ShouldBlockGameplayActionsOnInteraction()){
BlockGameplayActions(false);
}
DetachObject();
/* NOP */;
}
public function OnAnimEvent_Custom(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == attachAnimName && attachThisObjectOnAnimEve
nt){
AttachObject();
} else if (animEventName == detachAnimName){
DetachObject();
}
/* NOP */;
}
public timer function TimerDeactivateAnimation(optional td : Float, opti
onal id : Int32){
TakeAllItems();
OnContainerClosed();
/* NOP */;
}
}
import abstract class CParticleInitializerRotationRate{
}
import abstract class CParticleInitializerRotationRate3D{
}
import abstract class CParticleInitializerSpawnCircle{
}
import abstract class CParticleInitializerSpawnBox{
}
import abstract class CParticleInitializerSpawnSphere{
}
import abstract class CCommunitySpawnStrategy{
}
import abstract class CParticleInitializerVelocity{
}
import abstract class CParticleInitializerVelocitySpread{
}
import abstract class CParticleInitializerVelocityInherit{
}
import abstract class CParticleInitializerRandomFlip{
}
abstract class W3CookingPlace extends W3Container{
public editable var cookingTime : Float;

private var schematics : array<SCookingSchematic>;


protected var isActive : Bool;
protected var cookingStarted : Bool;
protected var cookingCompleted : Bool;
protected autobind secondaryLootInteractionComponent : CInteractionCompo
nent = "Loot2";
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
LoadXMLData();
if (schematics.Size() <= 0){
/* NOP */;
}
isActive = true;
cookingCompleted = false;
cookingStarted = false;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var hud : CR4ScriptedHud;
if (activator != thePlayer || isInteractionBlocked){
return false;
}
if (actionName != "Container"){
return false;
}
if (cookingCompleted){
TakeAllItems();
OnContainerClosed();
cookingCompleted = false;
if (lootInteractionComponent && secondaryLootInteraction
Component){
lootInteractionComponent.SetEnabled(true);
secondaryLootInteractionComponent.SetEnabled(fal
se);
}
} else {
theGame.RequestMenuWithBackground('InventoryMenu', 'Comm
onMenu', this);
}
return true;
/* NOP */;
}
public function OnContainerClosed(){
super.OnContainerClosed();
if (!IsEmpty() && isActive){
if (Cook()){
CookingStarted();
}
}
/* NOP */;
}
private function LoadXMLData(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var tmpName : CName;
var tmpInt : Int32;
var schem : SCookingSchematic;
var i : Int32;

var j : Int32;
var k : Int32;
var ing : SItemParts;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('cooking_recipes');
i = 0;
while (i < main.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'name_name', tmpName)){
schem.schemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'cookedItem_name', tmpName)){
schem.cookedItemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNodes[i],
'cookedItemQuantity', tmpInt)){
schem.cookedItemQuantity = tmpInt;
}
ingredients = dm.GetCustomDefinitionSubNode(main.subNode
s[i], 'ingredients');
k = 0;
while (k < ingredients.subNodes.Size()){
ing.itemName = 'None';
ing.quantity = -1;
if (dm.GetCustomNodeAttributeValueName(ingredien
ts.subNodes[k], 'item_name', tmpName)){
ing.itemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueInt(ingredient
s.subNodes[k], 'quantity', tmpInt)){
ing.quantity = tmpInt;
}
schem.ingredients.PushBack(ing);
k += 1;
}
schematics.PushBack(schem);
schem.cookedItemName = 'None';
schem.ingredients.Clear();
schem.schemName = 'None';
i += 1;
}
/* NOP */;
}
protected function CookingStarted(){
cookingStarted = true;
if (lootInteractionComponent){
lootInteractionComponent.SetEnabled(false);
}
AddTimer('Cooking', cookingTime, false, /* NOP */, /* NOP */, tr
ue, /* NOP */);
/* NOP */;
}
protected function CookingDone(){
cookingStarted = false;
if (!IsEmpty()){
cookingCompleted = true;
if (lootInteractionComponent && secondaryLootInteraction
Component){
lootInteractionComponent.SetEnabled(false);

secondaryLootInteractionComponent.SetEnabled(tru
e);
}
} else {
cookingCompleted = false;
if (lootInteractionComponent && secondaryLootInteraction
Component){
lootInteractionComponent.SetEnabled(true);
secondaryLootInteractionComponent.SetEnabled(fal
se);
}
}
/* NOP */;
}
private timer function Cooking(optional dt : Float, optional id : Int32)
{
CookingDone();
/* NOP */;
}
protected function Cook() : Bool{
var allItems : array<SItemUniqueId>;
var ingredients : array<SItemParts>;
var matchedIngredients : array<SItemParts>;
var tmpItems : array<SItemUniqueId>;
var tmpIngredient : SItemParts;
var tmpSchematicsIterator : Int32;
var tmpSchematic : SCookingSchematic;
var i : Int32;
var tmpQuantity : Int32;
var quantity : Int32;
if (inv){
inv.GetAllItems(allItems);
}
if (allItems.Size() == 0){
return false;
}
i = 0;
while (i < allItems.Size()){
tmpIngredient.itemName = inv.GetItemName(allItems[i]);
tmpIngredient.quantity = inv.GetItemQuantity(allItems[i]
);
ingredients.PushBack(tmpIngredient);
i += 1;
}
tmpSchematicsIterator = FindSchematicForIngredients(ingredients,
matchedIngredients);
if (tmpSchematicsIterator != -1){
tmpSchematic = schematics[tmpSchematicsIterator];
i = 0;
while (i < matchedIngredients.Size()){
tmpQuantity = FloorF(matchedIngredients[i].quant
ity / tmpSchematic.ingredients[i].quantity);
if (i == 0 || tmpQuantity <= quantity){
quantity = tmpQuantity;
}
i += 1;
}
UseSchematic(schematics[tmpSchematicsIterator], quantity
);
i = 0;

while (i < matchedIngredients.Size()){


matchedIngredients[i].quantity *= quantity;
i += 1;
}
UseIngredients(matchedIngredients);
return true;
}
if (allItems.Size() > 1){
return false;
}
if (tmpIngredient.quantity > 1){
tmpSchematicsIterator = FindSchematicByIngredientName(tm
pIngredient.itemName);
} else {
return false;
}
if (tmpSchematicsIterator != -1){
tmpSchematic = schematics[tmpSchematicsIterator];
if (tmpSchematic.ingredients.Size() == 1){
tmpIngredient = tmpSchematic.ingredients[0];
if (!inv){
quantity = 0;
} else {
quantity = FloorF(inv.GetItemQuantity(al
lItems[0]) / tmpIngredient.quantity);
}
tmpIngredient.quantity *= quantity;
UseSchematic(tmpSchematic, quantity);
matchedIngredients.Clear();
matchedIngredients.PushBack(tmpIngredient);
UseIngredients(matchedIngredients);
return true;
}
}
return false;
/* NOP */;
}
private function UseSchematic(schematic : SCookingSchematic, quantity :
Int32){
var i : Int32;
if (!quantity){
quantity = 1;
}
/* NOP */;
i = 0;
while (i < quantity){
if (schematic.cookedItemQuantity >= 1){
/* NOP */;
if (inv){
inv.AddAnItem(schematic.cookedItemName,
schematic.cookedItemQuantity, /* NOP */, /* NOP */, /* NOP */);
}
}
i += 1;
}
switch(schematic.schemName){
case 'Voodoo doll Curse':
VoodooDollCurse();
break;
case 'Treasure Nekker':

TreasureNekker();
break;
case 'Spawn Random Enemies':
SpawnRandomEnemies();
break;
case 'Master of Puppets':
break;
default:
break;
}
/* NOP */;
}
private function UseIngredients(items : array<SItemParts>){
var i : Int32;
var j : Int32;
var itemIds : array<SItemUniqueId>;
if (!inv){
return;
}
i = 0;
while (i < items.Size()){
itemIds = inv.GetItemsIds(items[i].itemName);
j = 0;
while (j < itemIds.Size()){
if (!inv.ItemHasTag(itemIds[j], 'Quest') && inv.
GetItemName(itemIds[j]) != 'Philosophers Stone'){
inv.RemoveItem(itemIds[j], items[i].quan
tity);
}
j += 1;
}
i += 1;
}
/* NOP */;
}
protected function FindSchematicForIngredients(ingredients : array<SItem
Parts>, matchedIngredients : array<SItemParts>) : Int32{
var i : Int32;
var j : Int32;
var k : Int32;
var outIngredient : SItemParts;
i = 0;
while (i < schematics.Size()){
matchedIngredients.Clear();
j = 0;
while (j < schematics[i].ingredients.Size()){
k = 0;
while (k < ingredients.Size()){
if (schematics[i].ingredients[j].itemNam
e == ingredients[k].itemName){
if (schematics[i].ingredients[j]
.quantity <= ingredients[k].quantity){
matchedIngredients.PushB
ack(ingredients[k]);
}
}
k += 1;
}
j += 1;
}

if (matchedIngredients.Size() == schematics[i].ingredien
ts.Size()){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
protected function FindSchematicByIngredientName(ingredientName : CName)
: Int32{
var i : Int32;
var j : Int32;
i = 0;
while (i < schematics.Size()){
j = 0;
while (j < schematics[i].ingredients.Size()){
if (schematics[i].ingredients[j].itemName == ing
redientName){
return i;
}
j += 1;
}
i += 1;
}
return -1;
/* NOP */;
}
protected function VoodooDollCurse(){
}
protected function TreasureNekker(){
}
protected function SpawnRandomEnemies(){
}
}
import abstract class CSEntitiesEntry{
}
import abstract class CParticleInitializerCollisionSpawn{
}
import abstract class CSStoryPhaseEntry{
}
import abstract class CParticleModificatorSizeOverLife{
}
import abstract class CParticleModificatorSize3DOverLife{
}
import abstract class CParticleModificatorVelocityOverLife{
}
struct SSwarmVictim{
var actor : CActor;
var timeInSwarm : Float;
var inTrigger : Bool;
}

import abstract class CParticleModificatorColorOverLife{


}
import abstract class CSStoryPhaseTimetableACategoriesEntry{
}
import abstract class CParticleModificatorAlphaOverLife{
}
import abstract class CParticleModificatorAlphaByDistance{
}
import abstract class CSStoryPhaseTimetableActionEntry{
}
import abstract class CParticleModificatorAlphaOverEffect{
}
import abstract class CSStoryPhaseTimetableACategoriesTimetableEntry{
}
import abstract class CParticleModificatorRotationOverLife{
}
class W3CampfirePlace extends W3CookingPlace{
protected var victims : array<CActor>;
public var bombs : array<SItemUniqueId>;
protected function CookingStarted(){
super.CookingStarted();
PlayEffect('fire_big', /* NOP */);
/* NOP */;
}
protected function CookingDone(){
StopEffect('fire_big');
ExplodeBombs();
bombs.Clear();
super.CookingDone();
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
super.OnFireHit(source);
if (!isActive){
isActive = true;
PlayEffect('fire_01', /* NOP */);
OnContainerClosed();
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
super.OnAardHit(sign);
if (isActive){
isActive = false;
StopEffect('fire_01');
}
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
var victim : CActor;
if (interactionComponentName == "DamageArea"){

victim = (CActor)activator;
if (victim && isActive){
victims.PushBack(victim);
if (victims.Size() == 1){
AddTimer('ApplyBurning', 0.100000, true,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
} else {
super.OnInteractionActivated(interactionComponentName, a
ctivator);
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
var victim : CActor;
if (interactionComponentName == "DamageArea"){
victim = (CActor)activator;
if (victims.Contains(victim)){
victims.Remove(victim);
if (victims.Size() == 0){
RemoveTimer('ApplyBurning', /* NOP */);
}
}
}
super.OnInteractionDeactivated(interactionComponentName, activat
or);
/* NOP */;
}
public timer function ApplyBurning(optional dt : Float, optional id : In
t32){
var i : Int32;
i = 0;
while (i < victims.Size()){
victims[i].AddEffectDefault(18, this, GetName(), /* NOP
*/);
i += 1;
}
/* NOP */;
}
public function OnContainerClosed(){
var allItems : array<SItemUniqueId>;
var i : Int32;
bombs.Clear();
if (inv && !IsEmpty() && isActive){
inv.GetAllItems(allItems);
i = 0;
while (i < allItems.Size()){
if (inv.IsItemBomb(allItems[i])){
bombs.PushBack(allItems[i]);
}
i += 1;
}
}
super.OnContainerClosed();
if (!cookingStarted && bombs.Size() >= 1){
CookingStarted();
}
/* NOP */;

}
public function ExplodeBombs(){
var i : Int32;
var bombEntity : W3Petard;
if (!inv){
return;
}
i = 0;
while (i < bombs.Size()){
bombEntity = (W3Petard)inv.GetDeploymentItemEntity(bombs
[i], GetWorldPosition(), /* NOP */, /* NOP */);
if (bombEntity){
inv.RemoveItem(bombs[i], inv.GetItemQuantity(bom
bs[i]));
bombEntity.Initialize(NULL, /* NOP */);
bombEntity.ProcessEffect(/* NOP */, /* NOP */);
}
i += 1;
}
/* NOP */;
}
protected function VoodooDollCurse(){
var params : SCustomEffectParams;
params.effectType = 18;
params.creator = this;
params.duration = 30;
thePlayer.AddEffectCustom(params);
/* NOP */;
}
}
import abstract class CParticleModificatorRotation3DOverLife{
}
import abstract class CParticleModificatorRotationRateOverLife{
}
class W3treasureHuntContainer extends W3Container{
public editable inlined var OnLootedEvents : array<W3SwitchEvent>;
public function OnContainerClosed(){
if (IsEmpty()){
ProcessOnLootedEvents();
}
super.OnContainerClosed();
/* NOP */;
}
public function ProcessOnLootedEvents(){
ActivateEvents(OnLootedEvents);
/* NOP */;
}
private function ActivateEvents(events : array<W3SwitchEvent>){
var i : Int32;
var size : Int32;
size = events.Size();
i = 0;
while (i < size){
if (events[i]){
events[i].TriggerArgNode(this, thePlayer);
}
i += 1;

}
/* NOP */;
}
}
import abstract class CParticleModificatorRotationRate3DOverLife{
}
import abstract class CSSceneTimetableScenesEntry{
}
import abstract class CParticleModificatorAcceleration{
}
import abstract class CSSceneTimetableEntry{
}
import abstract class CParticleModificatorTarget{
}
import abstract class CParticleModificatorTargetNode{
}
import abstract class CParticleModificatorTextureAnimation{
}
import abstract class CCommunityAreaType{
}
import abstract class CParticleModificatorVelocityTurbulize{
}
import abstract class CParticleModificatorCollision{
}
import abstract class IEvaluator{
}
import struct CActionPointManager{
import public final function HasPreferredNextAPs(currApID : SActionPoint
Id) : Bool;
import public final function GetSeqNextActionPoint(currApID : SActionPoi
ntId) : SActionPointId;
import public final function GetJobTree(apID : SActionPointId) : CJobTre
e;
import public final function ResetItems(apID : SActionPointId);
import public final function GetGoToPosition(apID : SActionPointId, plac
ePos : Vector, placeRot : Float) : Bool;
import public final function GetActionExecutionPosition(apID : SActionPo
intId, placePos : Vector, placeRot : Float) : Bool;
import public final function GetFriendlyAPName(apID : SActionPointId) :
String;
import public final function IsBreakable(apID : SActionPointId) : Bool;
import public final function GetPlacementImportance(apID : SActionPointI
d) : EWorkPlacementImportance;
import public final function IsFireSourceDependent(apID : SActionPointId
) : Bool;
}
import abstract class CEvaluatorFloatConst{

}
import abstract class ISpawnTreeInitializerAI{
public function Init(){
}
}
import abstract class CEvaluatorFloatRandomUniform{
}
import abstract class CEvaluatorFloatStartEnd{
}
import abstract class CEvaluatorFloatCurve{
}
statemachine class CBoatRacingGateEntity extends CGameplayEntity{
public editable var nextGate : EntityHandle;
public editable var factOnReaching : String;
private var nextGateEntity : CBoatRacingGateEntity;
private var isActive : Bool;
private var isReached : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var boat : W3Boat;
boat = (W3Boat)activator.GetEntity();
if (area == (CTriggerAreaComponent)GetComponent("trigger") && bo
at && boat.GetBoatComponent().user == thePlayer){
if (IsActive() && !IsReached()){
SetIsReached(true);
GotoState('Inactive', /* NOP */, /* NOP */);
ActivateNextGate();
AddFactOnReaching();
}
}
/* NOP */;
}
private function ActivateNextGate(){
nextGateEntity = (CBoatRacingGateEntity)EntityHandleGet(nextGate
);
if (nextGateEntity){
nextGateEntity.GotoState('Active', /* NOP */, /* NOP */)
;
}
/* NOP */;
}
private function AddFactOnReaching(){
if (factOnReaching != ""){
FactsAdd(factOnReaching, 1, /* NOP */);
}
/* NOP */;
}
public function SetIsActive(val : Bool){
isActive = val;
/* NOP */;
}

public function IsActive() : Bool{


return isActive;
/* NOP */;
}
public function SetIsReached(val : Bool){
isReached = val;
/* NOP */;
}
public function IsReached() : Bool{
return isReached;
/* NOP */;
}
public function ActivateGate(){
GotoState('Active', /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class CEvaluatorFloatRainStrength{
}
import abstract class CEvaluatorColorConst{
}
import abstract class CEvaluatorColorRandom{
}
import abstract class CEvaluatorColorStartEnd{
}
import abstract class CEvaluatorColorCurve{
}
import abstract class CAIPerformCustomWorkTree{
}
import abstract class CEvaluatorVectorConst{
}
import abstract class CEvaluatorVectorRandomUniform{
}
import abstract class CEvaluatorVectorCurve{
}
import abstract class CEvaluatorVectorStartEnd{
}
import struct CScriptSoundSystem{
private var currentGameState : ESoundGameState;
private var defaultGameState : ESoundGameState;
private var defaultStates : array<ESoundGameState>;
public var stateChangeTimestamp : Float;
public var stateCheckCooldown : Float;
private var isGameStopped : Bool;
private var currentThreatRating : Float;
private var desiredThreatRating : Float;
private var lastThreatUpdateTime : Float;
private var lastThreatDampTime : Float;
private var threatUpdateCooldown : Float;

private var threatDampCooldown : Float;


private var threatDamper : SpringDamper;
private var monsterHunt : Bool;
private var monster : Bool;
private var isBlackscreen : Bool;
private var soundSystemSettings : C2dArray;
public var threatWeight : Int32;
public var levelWeight : Int32;
public var tweakWeight : Float;
import public function SoundSwitch(swichGroupName : String, stateName :
String);
import private function SoundState(stateGroupName : String, stateName :
String);
import public function SoundEvent(eventName : String);
import public function SoundParameter(parameterName : String, value : Fl
oat, duration : Float);
import public function SoundGlobalParameter(parameterName : String, valu
e : Float, duration : Float);
import public function SoundSequence(sequenceName : String, sequence : a
rray<String>);
import public function SoundEventAddToSave(eventName : String);
import public function SoundEventClearSaved();
public function OnBlackscreenStart() : Bool{
if (!isBlackscreen){
isBlackscreen = true;
if (!IsValidBlackscreenState(currentGameState)){
SoundState("game_state", GameStateToString(15));
}
}
/* NOP */;
}
public function OnBlackscreenEnd() : Bool{
if (isBlackscreen){
isBlackscreen = false;
SoundState("game_state", GameStateToString(currentGameSt
ate));
}
/* NOP */;
}
private function IsValidBlackscreenState(gameState : ESoundGameState) :
Bool{
return gameState == 15 || gameState == 13;
/* NOP */;
}
public function Initialize(){
threatDamper = new SpringDamper in this;
threatDamper.Init(0.000000, 0.000000);
threatDamper.SetSmoothTime(3.500000);
FillDefaultStatesArray();
UpdateSoundSettings();
defaultGameState = 1;
EnterDefaultState();
/* NOP */;
}
public function IsInDefaultState() : Bool{
if (defaultStates.Contains(currentGameState)){
return true;
}
return false;
/* NOP */;

}
private function IsThisStateDefault(gameState : ESoundGameState) : Bool{
if (defaultStates.Contains(gameState)){
return true;
}
return false;
/* NOP */;
}
private function EnterDefaultState(){
SoundGameStateChange(defaultGameState);
/* NOP */;
}
private function SoundGameStateChange(gameState : ESoundGameState){
var isCombatMusicEnabled : Bool;
if (thePlayer){
isCombatMusicEnabled = thePlayer.IsCombatMusicEnabled();
} else {
isCombatMusicEnabled = false;
}
currentGameState = gameState;
stateChangeTimestamp = theGame.GetEngineTimeAsSeconds();
if (isCombatMusicEnabled){
if (!thePlayer.IsSoundStateCombatMusic(gameState)){
/* NOP */;
thePlayer.OnCombatFinished();
}
} else if (thePlayer.IsSoundStateCombatMusic(gameState)){
/* NOP */;
thePlayer.OnCombatStart();
}
if (!isBlackscreen || isBlackscreen && IsValidBlackscreenState(g
ameState)){
SoundState("game_state", GameStateToString(gameState));
/* NOP */;
}
/* NOP */;
}
public function ChangeSoundState(stateGroupName : String, stateName : St
ring) : Bool{
if (stateGroupName == "game_state"){
/* NOP */;
return false;
}
SoundState(stateGroupName, stateName);
return true;
/* NOP */;
}
public function EnterGameState(gameState : ESoundGameState) : Bool{
if (currentGameState != gameState){
if (IsThisStateDefault(gameState)){
/* NOP */;
return false;
}
SoundGameStateChange(gameState);
return true;
}
return false;
/* NOP */;
}
public function LeaveGameState(gameState : ESoundGameState) : Bool{

if (currentGameState != gameState){
/* NOP */;
return false;
}
EnterDefaultState();
return true;
/* NOP */;
}
public function GetCurrentGameState() : ESoundGameState{
return currentGameState;
/* NOP */;
}
public function SetDefaultGameState(gameState : ESoundGameState){
if (IsThisStateDefault(gameState)){
if (gameState != defaultGameState){
defaultGameState = gameState;
if (defaultGameState != 7){
monsterHunt = false;
monster = false;
}
if (currentGameState != defaultGameState){
EnterDefaultState();
}
}
} else {
/* NOP */;
}
/* NOP */;
}
public function GetDefaultGameState() : ESoundGameState{
return defaultGameState;
/* NOP */;
}
public function GetMonster() : Bool{
return monster;
/* NOP */;
}
public function GetMonsterHunt() : Bool{
return monsterHunt;
/* NOP */;
}
public function InitializeAreaMusic(worldArea : EAreaName){
switch(worldArea){
case 1:
SoundEvent("play_music_nomansgrad");
break;
case 2:
SoundEvent("play_music_skellige");
break;
case 3:
SoundEvent("play_music_kaer_morhen");
break;
case 4:
case 8:
SoundEvent("play_music_prologue");
break;
case 5:
SoundEvent("play_music_wyzima_castle");
break;
case 6:

SoundEvent("play_music_misty_island");
break;
case 7:
SoundEvent("play_music_spiral");
break;
case 0:
LogAssert(false, "theSound.InitializeAreaMusic: undefine
d area! No music set!");
break;
default:
LogAssert(false, "theSound.InitializeAreaMusic: unsuppor
ted area type <<" + worldArea + ">> passed! Music not set!");
break;
}
/* NOP */;
}
private function GameStateToString(enumName : ESoundGameState) : String{
switch(enumName){
case 0:
return "";
case 1:
return "exploration";
case 2:
return "exploration_night";
case 3:
return "focus_exploration";
case 4:
return "focus_exploration_night";
case 6:
return "combat";
case 7:
return "combat_monster_hunt";
case 8:
return "dialog_scene";
case 9:
return "dialog_scene_night";
case 10:
return "cutscene";
case 11:
return "minigames";
case 12:
return "death";
case 13:
return "movie";
case 14:
return "boat";
case 15:
return "music_only";
case 16:
return "underwater";
case 17:
return "underwater_combat";
case 5:
return "underwater_focus";
case 20:
return "underwater_combat_focus";
case 18:
return "pause";
case 19:
return "gwent";

default:
}
return "";
/* NOP */;
}
public function Finalize(){
SoundGameStateChange(0);
SoundEvent("fx_underwater_off");
SoundEvent("stop_music");
/* NOP */;
}
private function FillDefaultStatesArray(){
defaultStates.PushBack(1);
defaultStates.PushBack(2);
defaultStates.PushBack(16);
defaultStates.PushBack(6);
defaultStates.PushBack(7);
defaultStates.PushBack(17);
defaultStates.PushBack(18);
/* NOP */;
}
public function SetIsGameStopped(val : Bool){
isGameStopped = val;
/* NOP */;
}
public function GetIsGameStopped() : Bool{
return isGameStopped;
/* NOP */;
}
public function StopMusic(){
SoundEvent("stop_music");
/* NOP */;
}
public function SendThreatRating(){
if (lastThreatUpdateTime + threatUpdateCooldown < theGame.GetEng
ineTimeAsSeconds()){
CalculateThreat();
}
if (currentThreatRating < 0.990000 * desiredThreatRating || curr
entThreatRating > 1.010000 * desiredThreatRating && lastThreatDampTime + threatD
ampCooldown < theGame.GetEngineTimeAsSeconds()){
UpdateThreatDamp();
}
/* NOP */;
}
public function CalculateThreat(){
var actors : array<CActor>;
var actorsSize : Int32;
var i : Int32;
var v : Int32;
var totalWeight : Float;
var tempThreat : Float;
var tempSum : Float;
var tempSumElements : Float;
var tempMaxElement : Float;
var l_tempthreat : Float;
var l_levelget : Float;
var finalSoundValue : Int32;
var monsterCategory : EMonsterCategory;
var soundName : CName;

var isTeleporting : Bool;


var canBeTargeted : Bool;
var canBeHitByFists : Bool;
monsterHunt = false;
monster = false;
totalWeight = 0.000000;
actors = thePlayer.GetNPCsAndPlayersInRange(70, 10, 'None', 256
+ 4);
actorsSize = actors.Size();
i = 0;
while (i < actorsSize){
theGame.GetMonsterParamsForActor(actors[i], monsterCateg
ory, soundName, isTeleporting, canBeTargeted, canBeHitByFists);
tempThreat = (CNewNPC)actors[i].GetThreatLevel();
if ((CNewNPC)actors[i].useSoundValue == true){
finalSoundValue += (CNewNPC)actors[i].GetSoundVa
lue();
LogSound("finalSoundValue is " + finalSoundValu
e);
}
if (tempThreat > 2){
totalWeight += tempThreat;
} else {
tempSum += tempThreat;
tempSumElements += 1;
if (tempThreat > tempMaxElement){
tempMaxElement = tempThreat;
}
}
if (MonsterCategoryIsMonster(monsterCategory)){
monster = true;
}
i += 1;
}
if (tempSum){
totalWeight += tempMaxElement;
if (tempSumElements > 1){
totalWeight += tempSum / tempSumElements * 0.500
000 + 0.300000 * tempSumElements;
}
}
tempThreat = totalWeight * threatWeight;
l_levelget = thePlayer.GetLevel();
l_levelget = l_levelget / levelWeight;
l_levelget = 1 - l_levelget;
tempThreat = tempThreat * l_levelget;
tempThreat = tempThreat * tweakWeight;
l_tempthreat = tempThreat;
desiredThreatRating = ClampF(tempThreat * 100, 0.000000, 100.000
000);
desiredThreatRating += finalSoundValue;
lastThreatUpdateTime = theGame.GetEngineTimeAsSeconds();
LogSound("Threat rating recalculated - current desired value = "
+ desiredThreatRating);
/* NOP */;
}
public function UpdateThreatDamp(){
var dt : Float;
var prev : Float;
dt = ClampF(theGame.GetEngineTimeAsSeconds() - lastThreatDampTim

e, 0.000000, threatDampCooldown);
prev = currentThreatRating;
currentThreatRating = threatDamper.UpdateAndGet(dt, desiredThrea
tRating);
if (prev < currentThreatRating){
threatDamper.SetSmoothTime(0.500000);
} else {
threatDamper.SetSmoothTime(2.000000);
}
SoundParameter('threat_rating', currentThreatRating, /* NOP */);
LogSound("Threat rating updated - current value = " + currentThr
eatRating);
lastThreatDampTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function IsMonsterFromMonsterHunt(monster : CActor) : Bool{
return monster.HasAbility('MonsterHunt');
/* NOP */;
}
public function UpdateSoundSettings(){
soundSystemSettings = LoadCSV("gameplay\globals\sound_threat_set
tings.csv");
threatWeight = StringToInt(soundSystemSettings.GetValueAt(1, 0),
/* NOP */);
levelWeight = StringToInt(soundSystemSettings.GetValueAt(1, 1),
/* NOP */);
tweakWeight = StringToFloat(soundSystemSettings.GetValueAt(1, 2)
, /* NOP */);
LogSound("threatWeight = " + threatWeight);
LogSound("levelWeight = " + levelWeight);
LogSound("tweakWeight = " + tweakWeight);
/* NOP */;
}
}
class SpringDamper extends CObject{
protected var destValue : Float;
protected var currValue : Float;
protected var velValue : Float;
protected var smoothTime : Float;
public final function SetSmoothTime(value : Float){
smoothTime = value;
/* NOP */;
}
public final function Init(curr : Float, dest : Float){
currValue = curr;
destValue = dest;
velValue = 0.000000;
/* NOP */;
}
public final function Reset(){
destValue = 0.000000;
currValue = 0.000000;
velValue = 0.000000;
/* NOP */;
}
public final function SetValue(value : Float){
destValue = value;
/* NOP */;
}

public final function GetValue() : Float{


return currValue;
/* NOP */;
}
public final function GetDestValue() : Float{
return destValue;
/* NOP */;
}
public final function Update(dt : Float){
var omega : Float;
var x : Float;
var exp : Float;
var diff : Float;
var temp : Float;
if (smoothTime > 0.000000){
omega = 2.000000 / smoothTime;
x = omega * dt;
exp = 1.000000 / 1.000000 + x + 0.480000 * x * x + 0.235
000 * x * x * x;
diff = currValue - destValue;
temp = velValue + omega * diff * dt;
velValue = velValue - omega * temp * exp;
currValue = destValue + diff + temp * exp;
} else if (dt > 0.000000){
velValue = destValue - currValue / dt;
currValue = destValue;
}
/* NOP */;
}
public final function UpdateAndGet(dt : Float, value : Float) : Float{
SetValue(value);
Update(dt);
return GetValue();
/* NOP */;
}
public function UpdateManual(current : Float, velocity : Float, dest : F
loat, dt : Float){
currValue = current;
velValue = velocity;
destValue = dest;
super.Update(dt);
current = currValue;
velocity = velValue;
/* NOP */;
}
}
import struct C2dArray{
import public final
tring;
import public final
ring;
import public final
2) : CName;
import public final
) : CName;
import public final
import public final
g) : Int32;
import public final

function GetValueAt(column : Int32, row : Int32) : S


function GetValue(header : String, row : Int32) : St
function GetValueAtAsName(column : Int32, row : Int3
function GetValueAsName(header : String, row : Int32
function GetNumRows() : Int32;
function GetRowIndexAt(column : Int32, value : Strin
function GetRowIndex(header : String, value : String

) : Int32;
}
import abstract class CSoundEntityParam{
}
statemachine class W3AardEntity extends W3SignEntity{
public editable var aspects : array<SAardAspect>;
public editable var effects : array<SAardEffects>;
public editable var waterTestOffsetZ : Float;
public editable var waterTestDistancePerc : Float;
public var projectileCollision : array<CName>;
public var processThrow_alternateCast : Bool;
public function GetSignType() : ESignType{
return 0;
/* NOP */;
}
public function OnStarted() : Bool{
if (IsAlternateCast()){
if ((CPlayer)owner.GetActor()){
GetWitcherPlayer().FailFundamentalsFirstAchievem
entCondition();
}
} else {
super.OnStarted();
}
projectileCollision.Clear();
projectileCollision.PushBack('Projectile');
projectileCollision.PushBack('Door');
projectileCollision.PushBack('Static');
projectileCollision.PushBack('Character');
projectileCollision.PushBack('ParticleCollider');
if (owner.ChangeAspect(this, 37)){
CacheActionBuffsFromSkill();
GotoState('AardCircleCast', /* NOP */, /* NOP */);
} else {
GotoState('AardConeCast', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
}
protected function ProcessThrow(alternateCast : Bool){
if (owner.IsPlayer()){
ProcessThrow_MainTick(alternateCast);
} else {
processThrow_alternateCast = alternateCast;
AddTimer('ProcessThrowTimer', 0.000000, /* NOP */, /* NO
P */, 2, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function ProcessThrowTimer(optional dt : Float, optional id
: Int32){
ProcessThrow_MainTick(processThrow_alternateCast);
/* NOP */;
}
protected function ProcessThrow_MainTick(alternateCast : Bool){
var projectile : W3SignProjectile;
var spawnPos : Vector;

var collisionPos : Vector;


var collisionNormal : Vector;
var waterCollTestPos : Vector;
var spawnRot : EulerAngles;
var heading : Vector;
var distance : Float;
var waterZ : Float;
var ownerActor : CActor;
var dispersionLevel : Int32;
var attackRange : CAIAttackRange;
var movingAgent : CMovingPhysicalAgentComponent;
var hitsWater : Bool;
var collisionGroupNames : array<CName>;
ownerActor = owner.GetActor();
if (owner.IsPlayer()){
GCameraShake(effects[fireMode].cameraShakeStrength, true
, GetWorldPosition(), 30.000000, /* NOP */, /* NOP */, /* NOP */);
}
if (owner.CanUseSkill(56)){
switch(owner.GetSkillLevel(56)){
case 1:
distance = aspects[fireMode].distanceUpgrade1;
break;
case 2:
distance = aspects[fireMode].distanceUpgrade2;
break;
case 3:
distance = aspects[fireMode].distanceUpgrade3;
break;
default:
LogAssert(false, "W3AardEntity.ProcessThrow: S_M
agic_s20 skill level out of bounds!");
}
} else {
distance = aspects[fireMode].distance;
}
if (owner.HasCustomAttackRange()){
attackRange = theGame.GetAttackRangeForEntity(this, owne
r.GetCustomAttackRange());
} else if (owner.CanUseSkill(56)){
dispersionLevel = owner.GetSkillLevel(56);
if (dispersionLevel == 1){
if (!alternateCast){
attackRange = theGame.GetAttackRangeForE
ntity(this, 'cone_upgrade1');
} else {
attackRange = theGame.GetAttackRangeForE
ntity(this, 'blast_upgrade1');
}
} else if (dispersionLevel == 2){
if (!alternateCast){
attackRange = theGame.GetAttackRangeForE
ntity(this, 'cone_upgrade2');
} else {
attackRange = theGame.GetAttackRangeForE
ntity(this, 'blast_upgrade2');
}
} else if (dispersionLevel == 3){
if (!alternateCast){
attackRange = theGame.GetAttackRangeForE

ntity(this, 'cone_upgrade3');
} else {
attackRange = theGame.GetAttackRangeForE
ntity(this, 'blast_upgrade3');
}
}
} else if (!alternateCast){
attackRange = theGame.GetAttackRangeForEntity(this, 'con
e');
} else {
attackRange = theGame.GetAttackRangeForEntity(this, 'bla
st');
}
spawnPos = GetWorldPosition();
spawnRot = GetWorldRotation();
heading = GetHeadingVector();
if (alternateCast){
spawnPos.Z -= 0.500000;
projectile = (W3SignProjectile)theGame.CreateEntity(aspe
cts[fireMode].projTemplate, spawnPos - heading * 0.700000, spawnRot, /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
projectile.ExtInit(owner, skillEnum, this, /* NOP */);
projectile.SetAttackRange(attackRange);
projectile.SphereOverlapTest(distance, projectileCollisi
on);
} else {
spawnPos -= 0.700000 * heading;
projectile = (W3SignProjectile)theGame.CreateEntity(aspe
cts[fireMode].projTemplate, spawnPos, spawnRot, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
projectile.ExtInit(owner, skillEnum, this, /* NOP */);
projectile.SetAttackRange(attackRange);
projectile.ShootCakeProjectileAtPosition(aspects[fireMod
e].cone, 3.500000, 0.000000, 30.000000, spawnPos + heading * distance, distance,
projectileCollision);
}
if (alternateCast){
movingAgent = (CMovingPhysicalAgentComponent)ownerActor.
GetMovingAgentComponent();
hitsWater = movingAgent.GetSubmergeDepth() < 0;
} else {
waterCollTestPos = GetWorldPosition() + heading * distan
ce * waterTestDistancePerc;
waterCollTestPos.Z += waterTestOffsetZ;
collisionGroupNames.PushBack('Terrain');
waterZ = theGame.GetWorld().GetWaterLevel(waterCollTestP
os, true);
if (theGame.GetWorld().StaticTrace(GetWorldPosition(), w
aterCollTestPos, collisionPos, collisionNormal, collisionGroupNames)){
if (waterZ > collisionPos.Z && waterZ > waterCol
lTestPos.Z){
hitsWater = true;
} else {
hitsWater = false;
}
} else {
hitsWater = waterCollTestPos.Z <= waterZ;
}
}
super.PlayAardFX(hitsWater);

AddTimer('DelayedDestroyTimer', 0.100000, true, /* NOP */, /* NO


P */, true, /* NOP */);
/* NOP */;
}
public final function PlayAardFX(hitsWater : Bool){
var dispersionLevel : Int32;
if (owner.CanUseSkill(56)){
dispersionLevel = owner.GetSkillLevel(56);
if (dispersionLevel == 1){
PlayEffect(effects[fireMode].baseCommonThrowEffe
ctUpgrade1, /* NOP */);
if (hitsWater){
PlayEffect(effects[fireMode].throwEffect
WaterUpgrade1, /* NOP */);
} else {
PlayEffect(effects[fireMode].throwEffect
SoilUpgrade1, /* NOP */);
}
} else if (dispersionLevel == 2){
PlayEffect(effects[fireMode].baseCommonThrowEffe
ctUpgrade2, /* NOP */);
if (hitsWater){
PlayEffect(effects[fireMode].throwEffect
WaterUpgrade2, /* NOP */);
} else {
PlayEffect(effects[fireMode].throwEffect
SoilUpgrade2, /* NOP */);
}
} else if (dispersionLevel == 3){
PlayEffect(effects[fireMode].baseCommonThrowEffe
ctUpgrade3, /* NOP */);
if (hitsWater){
PlayEffect(effects[fireMode].throwEffect
WaterUpgrade3, /* NOP */);
} else {
PlayEffect(effects[fireMode].throwEffect
SoilUpgrade3, /* NOP */);
}
}
} else {
PlayEffect(effects[fireMode].baseCommonThrowEffect, /* N
OP */);
if (hitsWater){
PlayEffect(effects[fireMode].throwEffectWater, /
* NOP */);
} else {
PlayEffect(effects[fireMode].throwEffectSoil, /*
NOP */);
}
}
if (owner.CanUseSkill(48)){
switch(dispersionLevel){
case 0:
PlayEffect(effects[fireMode].throwEffectSPNoUpgr
ade, /* NOP */);
break;
case 1:
PlayEffect(effects[fireMode].throwEffectSPUpgrad
e1, /* NOP */);
break;

case 2:
PlayEffect(effects[fireMode].throwEffectSPUpgrad
e2, /* NOP */);
break;
case 3:
PlayEffect(effects[fireMode].throwEffectSPUpgrad
e3, /* NOP */);
break;
}
}
if (owner.CanUseSkill(42)){
switch(dispersionLevel){
case 0:
PlayEffect(effects[fireMode].throwEffectDmgNoUpg
rade, /* NOP */);
break;
case 1:
PlayEffect(effects[fireMode].throwEffectDmgUpgra
de1, /* NOP */);
break;
case 2:
PlayEffect(effects[fireMode].throwEffectDmgUpgra
de2, /* NOP */);
break;
case 3:
PlayEffect(effects[fireMode].throwEffectDmgUpgra
de3, /* NOP */);
break;
}
}
/* NOP */;
}
public timer function DelayedDestroyTimer(optional dt : Float, optional
id : Int32){
var active : Bool;
if (owner.CanUseSkill(56)){
switch(owner.GetSkillLevel(56)){
case 1:
active = IsEffectActive(effects[fireMode].baseCo
mmonThrowEffectUpgrade1, /* NOP */);
break;
case 2:
active = IsEffectActive(effects[fireMode].baseCo
mmonThrowEffectUpgrade2, /* NOP */);
break;
case 3:
active = IsEffectActive(effects[fireMode].baseCo
mmonThrowEffectUpgrade3, /* NOP */);
break;
default:
LogAssert(false, "W3AardEntity.DelayedDestroyTim
er: S_Magic_s20 skill level out of bounds!");
}
} else {
active = IsEffectActive(effects[fireMode].baseCommonThro
wEffect, /* NOP */);
}
if (!active){
Destroy();
}

/* NOP */;
}
}
import abstract class CSoundListenerComponent{
}
import abstract class CAreaEnvironmentComponent{
}
import abstract class CRagdoll{
}
import abstract class CGraphBlock{
}
import abstract class CGraphHelperBlock{
}
import abstract class CCommentGraphBlock{
}
import abstract class CDescriptionGraphBlock{
}
import abstract class IMaterialDefinition{
}
class W3Effect_YrdenHealthDrain extends W3DamageOverTimeEffect{
private var hitFxDelay : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
hitFxDelay = 0.900000 + RandF() / 5;
SetEffectValue();
/* NOP */;
}
protected function SetEffectValue(){
effectValue = thePlayer.GetSkillAttributeValue(47, 'direct_damag
e_per_sec', false, true) * thePlayer.GetSkillLevel(47);
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
hitFxDelay -= dt;
if (hitFxDelay <= 0){
hitFxDelay = 0.900000 + RandF() / 5;
target.PlayEffect('yrden_shock', /* NOP */);
}
/* NOP */;
}
}
import abstract class CMaterialBlockInterpolator{
}
import abstract class CMaterialBlock{
}
import abstract class CMaterialParameter{
}

import abstract class IMaterial{


}
import abstract class SEncounterActionPointSelectorPair{
//NULL type for chance
}
import abstract class CMaterialInstance{
}
import abstract class CMaterialGraph{
}
import abstract class CCharacter{
}
import abstract class CMaterialParameterColor{
}
import abstract class CMaterialParameterTexture{
}
import abstract class CMaterialParameterTextureArray{
}
import abstract class CMaterialParameterCube{
}
import abstract class CMaterialParameterVector{
}
import abstract class CMaterialParameterScalar{
}
import abstract class CMaterialParameterEngineValue{
}
import abstract class CJournalBase{
//NULL type for baseName
//NULL type for guid
import public final function GetUniqueScriptTag() : CName;
import public final function GetOrder() : Int32;
}
import abstract class CMaterialParameterEnvColorGroup{
}
import abstract class CMaterialOverrideAttachment{
}
import abstract class CJournalPath{
}
import abstract class CMaterialOverrideAttachmentSelectByChunk{
}
import abstract class CMaterialOverrideComponent{
}

import abstract class CCollisionMesh{


}
import abstract class CCollisionShapeConvex{
}
statemachine class W3Elevator extends CGameplayEntity{
public editable var appearanceOnTop : String;
public editable var appearanceOnGround : String;
public editable var speed : Float;
public saved var currentHeight : Float;
public saved var targetNodeHeight : Float;
public saved var currentSpeed : Float;
public saved var initialSpeed : Float;
public saved var isOnTop : Bool;
public saved var movementStarted : Bool;
public saved var onTopPosChecked : Bool;
public saved var initialHeight : Float;
public saved var pos : Vector;
public saved var onTopPos : Vector;
public var heightDifference : Float;
public var goingUp : Bool;
public var playerOnElevator : Bool;
public var playerAttached : Bool;
public var deniedAreaCreated : Bool;
public var blockedActions : array<EInputActionBlock>;
public var entityTemplate : CEntityTemplate;
public var deniedArea1 : CEntity;
public var deniedArea2 : CEntity;
public var deniedArea3 : CEntity;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
pos = GetWorldPosition();
if (currentHeight != 0){
pos.Z = currentHeight;
Teleport(pos);
}
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);
blockedActions.PushBack(24);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(41);
/* NOP */;
}
public latent function ProcessAttachement(){
var entMatrix : Matrix;
var createEntityHelper : CCreateEntityHelper;
var offsetPos : Vector;

if (!entityTemplate){
entityTemplate = (CEntityTemplate)LoadResourceAsync("den
ied_area", /* NOP */);
}
if (playerOnElevator && thePlayer.IsAlive()){
if (!playerAttached){
if (currentSpeed < 0){
CalcEntitySlotMatrix('goDownSlot', entMa
trix);
thePlayer.GetMovingAgentComponent().SetA
dditionalOffsetToConsumePointWS(entMatrix, 0.600000);
thePlayer.CreateAttachment(this, 'goDown
Slot', /* NOP */, /* NOP */);
} else {
CalcEntitySlotMatrix('goUpSlot', entMatr
ix);
thePlayer.GetMovingAgentComponent().SetA
dditionalOffsetToConsumePointWS(entMatrix, 0.600000);
thePlayer.CreateAttachment(this, 'goUpSl
ot', /* NOP */, /* NOP */);
}
thePlayer.GetMovingAgentComponent().SetEnabledFe
etIK(false, /* NOP */);
BlockActions(true);
playerAttached = true;
}
if (deniedAreaCreated){
deniedArea1.Destroy();
deniedArea2.Destroy();
deniedArea3.Destroy();
deniedAreaCreated = false;
}
} else {
if (playerAttached){
thePlayer.BreakAttachment();
thePlayer.GetMovingAgentComponent().SetEnabledFe
etIK(true, /* NOP */);
BlockActions(false);
playerAttached = false;
}
if (isOnTop && !deniedAreaCreated){
if (!createEntityHelper){
createEntityHelper = new CCreateEntityHe
lper in this;
}
theGame.CreateEntityAsync(createEntityHelper, en
tityTemplate, onTopPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
while (createEntityHelper.IsCreating()){
SleepOneFrame();
}
deniedArea1 = createEntityHelper.GetCreatedEntit
y();
offsetPos = onTopPos;
offsetPos.Z += 2.500000;
theGame.CreateEntityAsync(createEntityHelper, en
tityTemplate, offsetPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
while (createEntityHelper.IsCreating()){
SleepOneFrame();

}
deniedArea2 = createEntityHelper.GetCreatedEntit
y();
offsetPos.Z += 2.000000;
theGame.CreateEntityAsync(createEntityHelper, en
tityTemplate, offsetPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
while (createEntityHelper.IsCreating()){
SleepOneFrame();
}
deniedArea3 = createEntityHelper.GetCreatedEntit
y();
deniedArea1.RemoveTag('climb');
deniedArea1.AddTag('no_climb');
deniedArea2.RemoveTag('climb');
deniedArea2.AddTag('no_climb');
deniedArea3.RemoveTag('climb');
deniedArea3.AddTag('no_climb');
deniedAreaCreated = true;
}
}
/* NOP */;
}
public function BlockActions(block : Bool){
var i : Int32;
if (blockedActions.Size() > 0){
i = 0;
while (i < blockedActions.Size()){
if (block){
thePlayer.BlockAction(blockedActions[i],
'Elevator', /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.UnblockAction(blockedActions[i
], 'Elevator');
}
i += 1;
}
}
/* NOP */;
}
public function IsOnTop() : Bool{
return isOnTop;
/* NOP */;
}
public function OnEndMovement(){
if (playerAttached){
thePlayer.BreakAttachment();
thePlayer.GetMovingAgentComponent().SetEnabledFeetIK(tru
e, /* NOP */);
BlockActions(false);
playerAttached = false;
}
if (isOnTop && deniedAreaCreated){
deniedArea1.Destroy();
deniedArea2.Destroy();
deniedArea3.Destroy();
deniedAreaCreated = false;
}
/* NOP */;
/* NOP */;

}
public function OnStartMovement(){
/* NOP */;
/* NOP */;
}
}
import abstract class CCollisionShapeTriMesh{
}
import abstract class CCollisionShapeBox{
}
import abstract class CCollisionShapeCapsule{
}
import abstract class CCollisionShapeSphere{
}
class W3TrapProjectileStatue extends W3Trap{
private editable var m_Projectile : CEntityTemplate;
private editable var m_IsStatic : Bool;
private editable var m_RotationSpeed : Float;
private editable var m_FirstShootDelay : Float;
private editable var m_FireRate : Float;
private editable var m_MaxShots : Float;
private editable var m_MinAngleToStartShooting : Float;
private editable var m_MaxAimingPitchCorrection : Float;
private editable var m_TargetPositionPrediction : Float;
private editable var m_ProjectileIsCocked : Bool;
private editable var m_ProjectileSpeed : Float;
private editable var m_ProjectileLifeSpan : Float;
private editable var m_ProjectileFollowTarget : Bool;
private var m_DelayUntilNextProjectile : Float;
private saved var m_ShotsLeft : Float;
private var m_CockedProjectile : W3AdvancedProjectile;
private var m_DelayToNextSorting : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
m_ShotsLeft = m_MaxShots;
if (m_ProjectileIsCocked){
CockProjectile();
}
/* NOP */;
}
private final timer function Update(optional _dT : Float, optional id :
Int32){
var i : Int32;
var l_target : CNode;
var l_shootPos : Vector;
var l_vectToTarget : Vector;
var l_angleToTarget : Float;
var l_targetPosition : Vector;
var l_currentPos : Vector;
var l_actorTarget : CActor;
i = m_Targets.Size() - 1;
while (i >= 0){
l_actorTarget = (CActor)m_Targets[i];
if (!l_actorTarget && (CComponent)m_Targets[i]){
l_actorTarget = (CActor)(CComponent)m_Targets[i]

.GetEntity();
}
if (l_actorTarget && !l_actorTarget.IsAlive()){
m_Targets.EraseFast(i);
}
i -= 1;
}
if (m_ShotsLeft == 0 || m_Targets.Size() == 0){
Deactivate(/* NOP */, /* NOP */);
return;
}
if (m_DelayToNextSorting <= 0){
SortNodesByDistance(GetWorldPosition(), m_Targets);
m_DelayToNextSorting = 2;
}
m_DelayToNextSorting -= _dT;
l_target = m_Targets[0];
l_targetPosition = l_target.GetWorldPosition();
l_currentPos = GetWorldPosition();
l_targetPosition.Z = l_currentPos.Z;
l_vectToTarget = l_targetPosition - GetWorldPosition();
l_angleToTarget = VecGetAngleBetween(GetHeadingVector(), l_vectT
oTarget);
if (!m_IsStatic){
if (l_angleToTarget > m_RotationSpeed * _dT){
RotateTowardsTarget(_dT);
}
}
if (l_angleToTarget <= m_MinAngleToStartShooting){
if (m_ShotsLeft != 0){
ShootProjectile(_dT);
}
}
if (m_ProjectileIsCocked && m_DelayUntilNextProjectile > 0 && m_
DelayUntilNextProjectile < m_FireRate * 0.500000){
CockProjectile();
}
if (m_CockedProjectile){
m_CockedProjectile.TeleportWithRotation(GetShootingPosit
ion(), GetWorldRotation());
}
/* NOP */;
}
private function RotateTowardsTarget(_dT : Float){
var l_currentPos : Vector;
var l_vectToTarget : Vector;
var l_targetPosition : Vector;
var l_yawToTarget : Float;
var l_currentHeading : Vector;
var l_newHeading : Vector;
var l_headingAngle : EulerAngles;
var l_toTargetAngle : EulerAngles;
var l_headingYaw : Float;
var l_toTargetYaw : Float;
var l_newRotation : EulerAngles;
var l_targetEntity : CEntity;
var l_currentMatrix : Matrix;
var l_newMatrix : Matrix;
var l_rotationMatrix : Matrix;
l_targetEntity = (CComponent)m_Targets[0].GetEntity();

if (m_TargetPositionPrediction > 0 && (CActor)l_targetEntity){


l_targetPosition = (CActor)l_targetEntity.PredictWorldPo
sition(m_TargetPositionPrediction);
} else {
l_targetPosition = m_Targets[0].GetWorldPosition();
}
l_currentPos = GetWorldPosition();
l_vectToTarget = l_targetPosition - GetWorldPosition();
l_currentHeading = GetHeadingVector();
l_headingAngle = VecToRotation(l_currentHeading);
l_toTargetAngle = VecToRotation(l_vectToTarget);
l_headingYaw = l_headingAngle.Yaw;
l_toTargetYaw = l_toTargetAngle.Yaw;
l_yawToTarget = AngleDistance(l_headingYaw, l_toTargetYaw);
l_currentMatrix = GetLocalToWorld();
if (m_RotationSpeed < 0 || l_yawToTarget < m_RotationSpeed * _dT
){
l_rotationMatrix = MatrixBuiltRotation(EulerAngles(0, -l
_yawToTarget, 0));
} else if (l_yawToTarget > 0){
l_rotationMatrix = MatrixBuiltRotation(EulerAngles(0, -m
_RotationSpeed * _dT, 0));
} else {
l_rotationMatrix = MatrixBuiltRotation(EulerAngles(0, m_
RotationSpeed * _dT, 0));
}
l_newMatrix = l_currentMatrix * l_rotationMatrix;
l_newRotation = MatrixGetRotation(l_newMatrix);
if (l_yawToTarget != 0){
TeleportWithRotation(l_currentPos, l_newRotation);
}
/* NOP */;
}
public final function Activate(_Target : CNode){
Activate(_Target);
if (m_FirstShootDelay > 0){
m_DelayUntilNextProjectile = m_FirstShootDelay;
}
/* NOP */;
}
private function GetShootingPosition() : Vector{
var slotWorldPos : Vector;
var slotMatrix : Matrix;
if (CalcEntitySlotMatrix('projectile_origin', slotMatrix)){
slotWorldPos = MatrixGetTranslation(slotMatrix);
} else {
LogAssert(false, "Trap" + this + " has no projectile_ori
gin slot. Setting projectiel to trap's local 0.0.0");
slotWorldPos = Vector(0, 0, 0);
}
return slotWorldPos;
/* NOP */;
}
private function CockProjectile(){
var l_shootPos : Vector;
if (m_CockedProjectile){
return;
}
l_shootPos = GetShootingPosition();
m_CockedProjectile = (W3AdvancedProjectile)theGame.CreateEntity(

m_Projectile, l_shootPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /


* NOP */, /* NOP */);
/* NOP */;
}
private function ShootProjectile(_dT : Float){
var l_trapPos : Vector;
var l_targetEntityPos : Vector;
var l_targetPosition : Vector;
var l_chestPosition : Vector;
var l_movingAgent : CMovingPhysicalAgentComponent;
var l_targetHeight : Float;
var l_toTarget : Vector;
var l_trapForward : Vector;
var l_trapRight : Vector;
var l_toTargetAngle : EulerAngles;
var l_trapAngle : EulerAngles;
var l_toTargetPitch : Float;
var l_trapForwardPitch : Float;
var l_pitchToTarget : Float;
var l_pitchedForward : Vector;
var l_targetEntity : CEntity;
var l_targetIsHigher : Bool;
m_DelayUntilNextProjectile -= _dT;
if (m_DelayUntilNextProjectile > 0){
return;
}
CockProjectile();
m_CockedProjectile.Init(this);
l_targetPosition = GetShootingPosition() + GetHeadingVector() *
20;
if (m_MaxAimingPitchCorrection > 0){
l_targetEntity = (CComponent)m_Targets[0].GetEntity();
l_trapPos = GetWorldPosition();
l_movingAgent = (CMovingPhysicalAgentComponent)(CActor)l
_targetEntity.GetMovingAgentComponent();
if (l_movingAgent){
l_targetHeight = l_movingAgent.GetCapsuleHeight(
);
}
l_chestPosition = l_targetEntity.GetWorldPosition() + Ve
ctor(0, 0, l_targetHeight * 0.700000);
l_targetEntityPos = l_chestPosition;
l_toTarget = l_targetEntityPos - l_trapPos;
l_trapForward = GetWorldForward();
l_trapAngle = VecToRotation(l_trapForward);
l_toTargetAngle = VecToRotation(l_toTarget);
l_trapForwardPitch = l_trapAngle.Pitch;
l_toTargetPitch = l_toTargetAngle.Pitch;
l_pitchToTarget = AngleDistance(l_trapForwardPitch, l_to
TargetPitch);
l_targetIsHigher = l_pitchToTarget > 0;
if (AbsF(l_pitchToTarget) > m_MaxAimingPitchCorrection){
l_pitchToTarget = m_MaxAimingPitchCorrection;
}
l_trapRight = GetWorldRight();
if (l_targetIsHigher){
l_pitchedForward = VecRotateAxis(l_trapForward,
l_trapRight, Deg2Rad(AbsF(l_pitchToTarget)));
} else {
l_pitchedForward = VecRotateAxis(l_trapForward,

l_trapRight, Deg2Rad(360 - AbsF(l_pitchToTarget)));


}
l_targetPosition = GetShootingPosition() + l_pitchedForw
ard * 20;
}
if (m_ProjectileFollowTarget){
m_CockedProjectile.ShootProjectileAtNode(0, m_Projectile
Speed, m_Targets[0], /* NOP */, /* NOP */);
} else {
m_CockedProjectile.ShootProjectileAtPosition(0, m_Projec
tileSpeed, l_targetPosition, /* NOP */, /* NOP */);
}
if (m_ProjectileLifeSpan > 0){
m_CockedProjectile.SetLifeSpan(m_ProjectileLifeSpan);
}
m_CockedProjectile = NULL;
m_DelayUntilNextProjectile = m_FireRate;
if (m_ShotsLeft > 0){
m_ShotsLeft -= 1;
}
/* NOP */;
}
}
import abstract class CFXBase{
}
class W3TrapTripwire extends W3Trap{
public editable inlined var eventOnTripped : array<IPerformableAction>;
public editable saved var maxUseCount : Int32;
private editable var excludedActorsTags : array<CName>;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var l_actor : CActor;
l_actor = (CActor)activator.GetEntity();
if (l_actor && ShouldExcludeActor(l_actor) || maxUseCount == 0){
return true;
}
if (m_isArmed){
Activate(activator.GetEntity());
}
/* NOP */;
}
private function ShouldExcludeActor(_Actor : CActor) : Bool{
var i : Int32;
var actorTags : array<CName>;
if (_Actor && excludedActorsTags.Size() > 0){
actorTags = _Actor.GetTags();
i = 0;
while (i < excludedActorsTags.Size()){
if (actorTags.Contains(excludedActorsTags[i])){
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
public function Activate(_Target : CNode){

var passedNode : CActor;


SpringTripwire(_Target);
super.Activate(_Target);
/* NOP */;
}
public function SpringTripwire(_Target : CNode){
TriggerPerformableEventArgNode(eventOnTripped, this, _Target);
PlayEffect('trap_sprung', /* NOP */);
if (maxUseCount != -1){
maxUseCount -= 1;
}
if (maxUseCount == 0){
m_isArmed = false;
m_IsActive = false;
}
/* NOP */;
}
}
import abstract class CFXDefinition{
}
class W3Effect_Bleeding extends W3DamageOverTimeEffect{
public function OnDamageDealt(dealtDamage : Bool){
if (!dealtDamage){
shouldPlayTargetEffect = false;
if (target.IsEffectActive(targetEffectName, /* NOP */)){
StopTargetFX();
}
} else {
shouldPlayTargetEffect = true;
if (!target.IsEffectActive(targetEffectName, /* NOP */))
{
PlayTargetFX();
}
}
/* NOP */;
}
}
import abstract class CFXTrackItemCurveBase{
}
import abstract class CFXTrackItemParameterFloat{
}
import abstract class CFXTrackItemSoundEvent{
}
import abstract class CFXTrackItemCameraShake{
}
import abstract class CFXTrackItemParameterColor{
}
import abstract class CFXTrackItemParticles{
}
import abstract class CFXTrackItemPause{
}

import abstract class CFXTrackItemRadialBlur{


}
import abstract class CFXTrackItemFullscreenBlur{
}
class W3ImmobilizeEffect extends W3CriticalEffect{
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
}
import abstract class CFXTrackItemMovement{
}
class W3BlindnessEffect extends W3CriticalEffect{
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (isOnPlayer){
thePlayer.HardLockToTarget(false);
}

/* NOP */;
}
}
import abstract class CFXTrackItemFlare{
}
class W3Effect_AutoEssenceRegen extends W3AutoRegenEffect{
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStatPercents(1) >= 1.000000){
target.StopEssenceRegen();
}
/* NOP */;
}
}
import struct CR4MapPinEntity{
//NULL type for entityName
}
import abstract class CFXTrackItemMaterialOverride{
}
class W3Effect_AutoMoraleRegen extends W3AutoRegenEffect{
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStatPercents(5) >= 1.000000){
target.StopMoraleRegen();
}
/* NOP */;
}
}
import abstract class CFXTrackItemGlobalSpacePhysicalForce{
}
class W3Effect_AutoStaminaRegen extends W3AutoRegenEffect{
private var regenModeIsCombat : Bool;
private var cachedPlayer : CR4Player;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
regenModeIsCombat = true;
if (isOnPlayer){
cachedPlayer = (CR4Player)target;
}
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
if (isOnPlayer){
cachedPlayer = (CR4Player)target;
}
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
if (isOnPlayer){
if (regenModeIsCombat != cachedPlayer.IsInCombat()){
regenModeIsCombat = !regenModeIsCombat;
if (regenModeIsCombat){

attributeName = RegenStatEnumToName(rege
nStat);
} else {
attributeName = 'staminaOutOfCombatRegen
';
}
SetEffectValue();
}
if (cachedPlayer.IsInCombat()){
if (thePlayer.IsGuarded()){
effectValue = target.GetAttributeValue('
staminaRegenGuarded', /* NOP */, /* NOP */);
} else {
attributeName = RegenStatEnumToName(rege
nStat);
SetEffectValue();
}
}
}
super.OnUpdate(dt);
if (target.GetStatPercents(2) >= 1.000000){
target.StopStaminaRegen();
}
/* NOP */;
}
protected function SetEffectValue(){
effectValue = target.GetAttributeValue(attributeName, /* NOP */,
/* NOP */);
/* NOP */;
}
}
import abstract class CFXTrackItemDisableHDRAdaptation{
}
class W3Effect_AutoVitalityRegen extends W3AutoRegenEffect{
private var regenModeIsCombat : Bool;
private var cachedPlayer : CR4Player;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (isOnPlayer){
cachedPlayer = (CR4Player)target;
}
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
if (isOnPlayer){
cachedPlayer = (CR4Player)target;
}
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
if (isOnPlayer && regenModeIsCombat != cachedPlayer.IsInCombat()
){
regenModeIsCombat = !regenModeIsCombat;
if (regenModeIsCombat){
attributeName = 'vitalityCombatRegen';
} else {
attributeName = RegenStatEnumToName(regenStat);

}
SetEffectValue();
}
super.OnUpdate(deltaTime);
if (target.GetStatPercents(0) >= 1.000000){
target.StopVitalityRegen();
}
/* NOP */;
}
protected function SetEffectValue(){
effectValue = target.GetAttributeValue(attributeName, /* NOP */,
/* NOP */);
/* NOP */;
}
}
import abstract class CJournalContainerEntry{
}
import abstract class CFXTrackItemEnvironmentModifier{
}
class W3Effect_AutoAirRegen extends W3AutoRegenEffect{
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStatPercents(6) >= 1.000000){
target.StopAirRegen();
}
/* NOP */;
}
}
import abstract class CFXTrackItemBrightnessTint{
}
class W3Effect_AutoPanicRegen extends W3AutoRegenEffect{
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStatPercents(7) >= 1.000000){
target.StopPanicRegen();
}
/* NOP */;
}
}
import abstract class CFXTrackItemDynamicLight{
}
class W3Effect_AutoSwimmingStaminaRegen extends W3AutoRegenEffect{
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStatPercents(9) >= 1.000000){
target.StopSwimmingStaminaRegen();
}
/* NOP */;
}
}
import abstract class CFXTrackItemForceFeedback{
}

class W3Effect_DoppelgangerEssenceRegen extends CBaseGameplayEffect{


private var usesVitality : Bool;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
usesVitality = target.UsesVitality();
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
usesVitality = target.UsesVitality();
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
var l_summonerComponent : W3SummonerComponent;
var l_doppelgangers : array<CEntity>;
var i : Int32;
var l_amountToHeal : Float;
var stat : EBaseCharacterStats;
l_summonerComponent = (W3SummonerComponent)target.GetComponentBy
ClassName('W3SummonerComponent');
l_doppelgangers = l_summonerComponent.GetSummonedEntities();
i = 0;
while (i < l_doppelgangers.Size()){
if (l_doppelgangers[i].GetBehaviorVariable('isDancing',
/* NOP */) == 1){
l_amountToHeal += 0.010000;
}
i += 1;
}
if (l_amountToHeal > 0){
if (usesVitality){
stat = 0;
} else {
stat = 1;
}
effectManager.CacheStatUpdate(stat, deltaTime * target.G
etMaxHealth() * l_amountToHeal);
}
/* NOP */;
}
}
class W3Effect_AdrenalineDrain extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var witcher : W3PlayerWitcher;
witcher = (W3PlayerWitcher)target;
if (!witcher){
LogEffects("W3Effect_AdrenalineDrain.OnEffectAdded: tryi
ng to add on non-witcher, aborting!");
isActive = false;
return false;
}
super.OnEffectAdded(customParams);
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
var drainVal : Float;
if (target.IsInCombat()){
isActive = false;

}
drainVal = dt * effectValue.valueAdditive + target.GetStatMax(4)
+ effectValue.valueBase * effectValue.valueMultiplicative;
(CR4Player)target.DrainFocus(drainVal);
if (target.GetStat(4, /* NOP */) <= 0.001000){
isActive = false;
}
/* NOP */;
}
}
class W3WraithBlindnessEffect extends W3BlindnessEffect{
}
import abstract class CFXExplosionImplosionPhysicalForce{
}
class W3Effect_HeavyKnockdown extends W3CriticalEffect{
public function CacheSettings(){
super.CacheSettings();
allowedHits[1] = false;
allowedHits[5] = false;
allowedHits[2] = false;
allowedHits[3] = false;
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectAddedPost() : Bool{
super.OnEffectAddedPost();
target.FinishQuen();
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
var mac : CMovingPhysicalAgentComponent;
var isInAir : Bool;
if (isActive){
timeActive += deltaTime;
}
if (pauseCounters.Size() == 0){

if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
}
if (timeLeft <= 0){
if (!timeEndedHandled){
timeEndedHandled = true;
if (isActive && this == target.GetCurrentlyAnima
tedCS()){
target.RequestCriticalAnimStop(target.Is
InAir());
} else {
LogCritical("Deactivating not animated C
S <<" + criticalStateType + ">>");
isActive = false;
}
} else if (isActive){
isInAir = target.IsInAir();
target.RequestCriticalAnimStop(isInAir);
isActive = isInAir;
}
}
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
duration = MaxF(1.000000, duration);
/* NOP */;
}
}
import abstract class SItemReward{
//NULL type for amount
//NULL type for item
}
import abstract class CFXFractureDesctruction{
}
class W3Effect_Hypnotized extends W3CriticalEffect{
public var customCameraStackIndex : Int32;
public var envID : Int32;
public var fxEntity : CEntity;
public var gameplayVisibilityFlag : Bool;
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(29);
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();

if (isOnPlayer && GetCreator() && !GetCreator().IsAlive()){


timeLeft = 0;
}
if (isOnPlayer && witcher.HasBuff(24) && witcher.GetPotionBuffLe
vel(24) >= 2){
timeLeft = 0;
}
super.OnUpdate(deltaTime);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var customCameraParams : SCustomCameraParams;
var actor : CActor;
var template : CEntityTemplate;
var environment : CEnvironmentDefinition;
super.OnEffectAdded(customParams);
if (isOnPlayer){
thePlayer.HardLockToTarget(false);
actor = (CActor)GetCreator();
gameplayVisibilityFlag = actor.GetGameplayVisibility();
actor.SetGameplayVisibility(false);
customCameraParams.source = actor;
customCameraParams.useCustomCamera = true;
customCameraParams.cameraParams.enums.Resize(2);
customCameraParams.cameraParams.enums[0].enumType = 'ECu
stomCameraType';
customCameraParams.cameraParams.enums[0].enumValue = 1;
customCameraParams.cameraParams.enums[1].enumType = 'ECu
stomCameraController';
customCameraParams.cameraParams.enums[1].enumValue = 0;
thePlayer.AddCustomOrientationTarget(3, 'HypnotizedEffec
t');
template = (CEntityTemplate)LoadResource("bies_fx", /* N
OP */);
fxEntity = theGame.CreateEntity(template, thePlayer.GetW
orldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */
);
if (fxEntity){
fxEntity.CreateAttachment(thePlayer, /* NOP */,
/* NOP */, /* NOP */);
fxEntity.DestroyAfter(duration);
}
environment = (CEnvironmentDefinition)LoadResource("env_
bies_hypnotize", /* NOP */);
envID = ActivateEnvironmentDefinition(environment, 1000,
1, 1.000000);
theGame.SetEnvironmentID(envID);
if (actor){
actor.SignalGameplayEvent('HypnotizeAdded');
}
}
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
super.CumulateWith(effect);
if (fxEntity){
fxEntity.DestroyAfter(timeLeft);
}
/* NOP */;
}

public function OnEffectRemoved() : Bool{


var customCameraParams : SCustomCameraParams;
var actor : CActor;
if (isOnPlayer){
DeactivateEnvironment(envID, 1);
actor = (CActor)GetCreator();
actor.SetGameplayVisibility(gameplayVisibilityFlag);
if (actor){
actor.SignalGameplayEvent('HypnotizeRemoved');
}
GetCreator().StopEffect('third_eye_fx');
thePlayer.RemoveCustomOrientationTarget('HypnotizedEffec
t');
}
super.OnEffectRemoved();
/* NOP */;
}
}
import abstract class CFXSpawnerComponent{
}
class W3Effect_WitchHypnotized extends W3CriticalEffect{
public var customCameraStackIndex : Int32;
public var fxEntity : CEntity;
public var envID : Int32;
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
super.OnUpdate(deltaTime);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var customCameraParams : SCustomCameraParams;
var actor : CActor;
var template : CEntityTemplate;
var environment : CEnvironmentDefinition;
super.OnEffectAdded(customParams);

if (isOnPlayer){
actor = (CActor)GetCreator();
customCameraParams.source = actor;
customCameraParams.useCustomCamera = true;
customCameraParams.cameraParams.enums.Resize(2);
customCameraParams.cameraParams.enums[0].enumType = 'ECu
stomCameraType';
customCameraParams.cameraParams.enums[0].enumValue = 1;
customCameraParams.cameraParams.enums[1].enumType = 'ECu
stomCameraController';
customCameraParams.cameraParams.enums[1].enumValue = 0;
thePlayer.AddCustomOrientationTarget(3, 'HypnotizedEffec
t');
template = (CEntityTemplate)LoadResource("bies_fx", /* N
OP */);
fxEntity = theGame.CreateEntity(template, thePlayer.GetW
orldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */
);
if (fxEntity){
fxEntity.CreateAttachment(thePlayer, /* NOP */,
/* NOP */, /* NOP */);
fxEntity.DestroyAfter(duration);
}
environment = (CEnvironmentDefinition)LoadResource("env_
bies_hypnotize", /* NOP */);
envID = ActivateEnvironmentDefinition(environment, 1000,
1, 1.000000);
theGame.SetEnvironmentID(envID);
if (actor){
actor.SignalGameplayEvent('HypnotizeAdded');
}
}
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
super.CumulateWith(effect);
if (fxEntity){
fxEntity.DestroyAfter(timeLeft);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var customCameraParams : SCustomCameraParams;
var actor : CActor;
if (isOnPlayer){
DeactivateEnvironment(envID, 1);
actor = (CActor)GetCreator();
if (actor){
actor.SignalGameplayEvent('HypnotizeRemoved');
}
thePlayer.RemoveCustomOrientationTarget('HypnotizedEffec
t');
}
super.OnEffectRemoved();
/* NOP */;
}
}
import abstract class CFXWaterSpawner{
}

class W3Effect_Knockdown extends W3CriticalEffect{


public function CacheSettings(){
super.CacheSettings();
allowedHits[1] = false;
allowedHits[5] = false;
allowedHits[2] = false;
allowedHits[3] = false;
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectAddedPost() : Bool{
super.OnEffectAddedPost();
target.FinishQuen();
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
var mac : CMovingPhysicalAgentComponent;
var isInAir : Bool;
if (isActive){
timeActive += deltaTime;
}
if (pauseCounters.Size() == 0){
if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
}
if (timeLeft <= 0){
if (!timeEndedHandled){
timeEndedHandled = true;
if (isActive && this == target.GetCurrentlyAnima
tedCS()){
target.RequestCriticalAnimStop(target.Is
InAir());
} else {
LogCritical("Deactivating not animated C
S <<" + criticalStateType + ">>");
isActive = false;

}
} else if (isActive){
isInAir = target.IsInAir();
target.RequestCriticalAnimStop(isInAir);
isActive = isInAir;
}
}
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
duration = MaxF(1.000000, duration);
/* NOP */;
}
}
import abstract class SReward{
//NULL type for experience
//NULL type for level
//NULL type for achievement
//NULL type for gold
//NULL type for items
}
import abstract class CFXSimpleSpawner{
}
class W3Effect_KnockdownTypeApplicator extends W3ApplicatorEffect{
private saved var customEffectValue : SAbilityAttributeValue;
private saved var customDuration : Float;
private saved var customAbilityName : CName;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var aardPower : Float;
var tags : array<CName>;
var i : Int32;
var appliedType : EEffectType;
var null : SAbilityAttributeValue;
var npc : CNewNPC;
var params : SCustomEffectParams;
var mutagen : CBaseGameplayEffect;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var encumbranceBonus : Float;
if (target == thePlayer && thePlayer.HasBuff(80)){
mutagen = thePlayer.GetBuff(80, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(mutagen.GetAbilityName(), 'resistGainRate', min, max);
encumbranceBonus = GetWitcherPlayer().GetEncumbrance() *
CalculateAttributeValue(GetAttributeRandomizedValue(min, max), /* NOP */);
resistance += encumbranceBonus / 100;
}
if (effectValue.valueMultiplicative + effectValue.valueAdditive
> 0){
aardPower = effectValue.valueMultiplicative * 1 - resist
ance / 1 + effectValue.valueAdditive / 100;
} else {
aardPower = creatorPowerStat.valueMultiplicative * 1 - r
esistance / 1 + creatorPowerStat.valueAdditive / 100;
}
npc = (CNewNPC)target;

if (npc && npc.HasShieldedAbility()){


if (npc.IsShielded(GetCreator())){
if (aardPower >= 1.200000){
appliedType = 46;
} else {
appliedType = 13;
}
} else {
if (aardPower >= 1.200000){
appliedType = 9;
}
if (aardPower >= 1.000000){
appliedType = 46;
} else {
appliedType = 13;
}
}
} else if (target.HasAbility('mon_type_huge')){
if (aardPower >= 1.200000){
appliedType = 46;
} else {
appliedType = 13;
}
} else if (target.HasAbility('WeakToAard')){
appliedType = 9;
} else if (aardPower >= 1.200000){
appliedType = 6;
} else if (aardPower >= 0.950000){
appliedType = 9;
} else if (aardPower >= 0.750000){
appliedType = 46;
} else {
appliedType = 13;
}
appliedType = ModifyHitSeverityBuff(target, appliedType);
params.effectType = appliedType;
params.creator = GetCreator();
params.sourceName = sourceName;
params.isSignEffect = isSignEffect;
params.customPowerStatValue = creatorPowerStat;
params.customAbilityName = customAbilityName;
params.duration = customDuration;
params.effectValue = customEffectValue;
target.AddEffectCustom(params);
isActive = true;
duration = 0;
/* NOP */;
}
public function Init(params : SEffectInitInfo){
customDuration = params.duration;
customEffectValue = params.customEffectValue;
customAbilityName = params.customAbilityName;
super.Init(params);
/* NOP */;
}
}
import abstract class CFXTrackItemSetDissolve{
}

class W3Effect_Paralyzed extends W3ImmobilizeEffect{


}
import abstract class CRewardGroup{
}
import abstract class CFoliageScene{
}
class W3Effect_LongStagger extends W3Effect_Stagger{
}
import abstract class CFoliageResource{
}
class W3Effect_Stagger extends W3CriticalEffect{
private var timeToEnableDodge : Float;
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var tags : array<CName>;
var i : Int32;
var actor : CActor;
if (isOnPlayer){
blockedActions.PushBack(23);
blockedActions.PushBack(11);
}
super.OnEffectAdded(customParams);
if (isOnPlayer && !thePlayer.IsUsingVehicle()){
actor = (CActor)EntityHandleGet(creatorHandle);
if (actor){
thePlayer.SetCustomRotation('Stagger', VecHeadin
g(actor.GetWorldPosition() - thePlayer.GetWorldPosition()), 0.000000, 0.200000,
false);
}
}
tags = target.GetTags();
i = 0;

while (i < tags.Size()){


FactsAdd("actor_" + NameToString(tags[i]) + "_was_stunne
d", 1, CeilF(duration) + 1);
i += 1;
}
/* NOP */;
}
public function OnTimeUpdated(dt : Float){
super.OnTimeUpdated(dt);
timeToEnableDodge -= dt;
if (timeToEnableDodge <= 0.000000 && isOnPlayer){
thePlayer.UnblockAction(23, EffectTypeToName(effectType)
);
thePlayer.UnblockAction(11, EffectTypeToName(effectType)
);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
if (isOnPlayer){
thePlayer.UnblockAction(23, EffectTypeToName(effectType)
);
thePlayer.UnblockAction(11, EffectTypeToName(effectType)
);
}
/* NOP */;
}
}
import abstract class SFoliageLODSetting{
}
class W3Effect_Swarm extends W3CriticalDOTEffect{
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(25);
blockedActions.PushBack(29);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var dot : SDoTDamage;
if (effectValue.valueAdditive + effectValue.valueMultiplicative
> 0){
dot.damageTypeName = theGame.params.DAMAGE_NAME_PHYSICAL
;
dot.hitsVitality = DamageHitsVitality(dot.damageTypeName
);
dot.hitsEssence = DamageHitsEssence(dot.damageTypeName);
damages.PushBack(dot);
}
super.OnEffectAdded(customParams);
if (isOnPlayer){
thePlayer.SoundEvent("animals_crow_swarm_attack_hit_loop
", /* NOP */, /* NOP */);
thePlayer.SoundEvent("grunt_vo_geralt_impact_light_loop"
, /* NOP */, /* NOP */);

if (thePlayer.playerAiming.GetCurrentStateName() == 'Wai
ting'){
thePlayer.AddCustomOrientationTarget(2, 'SwarmEf
fect');
}
}
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
var player : CR4Player;
player = thePlayer;
super.OnUpdate(deltaTime);
if (isOnPlayer){
if (player.bLAxisReleased){
player.SetOrientationTargetCustomHeading(player.
GetHeading(), 'SwarmEffect');
} else if (player.GetPlayerCombatStance() == 1){
player.SetOrientationTargetCustomHeading(VecHead
ing(player.moveTarget.GetWorldPosition() - player.GetWorldPosition()), 'SwarmEff
ect');
} else {
player.SetOrientationTargetCustomHeading(VecHead
ing(theCamera.GetCameraDirection()), 'SwarmEffect');
}
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
if (isOnPlayer){
thePlayer.SoundEvent("animals_crow_swarm_attack_hit_loop
_end", /* NOP */, /* NOP */);
thePlayer.SoundEvent("grunt_vo_geralt_impact_light_loop_
end", /* NOP */, /* NOP */);
thePlayer.RemoveCustomOrientationTarget('SwarmEffect');
}
/* NOP */;
}
protected function IsImmuneToAllDamage(dt : Float) : Bool{
if (damages.Size() == 0){
return false;
}
return super.IsImmuneToAllDamage(dt);
/* NOP */;
}
}
import struct CVisualDebug{
import public final function AddText(dbgName : CName, text : String, pos
ition : Vector, absolutePos : Bool, line : Uint8, color : Color, background : Bo
ol, timeout : Float);
import public final function AddSphere(dbgName : CName, radius : Float,
position : Vector, absolutePos : Bool, color : Color, timeout : Float);
import public final function AddBox(dbgName : CName, size : Vector, posi
tion : Vector, rotation : EulerAngles, absolutePos : Bool, color : Color, timeou
t : Float);
import public final function AddAxis(dbgName : CName, scale : Float, pos
ition : Vector, rotation : EulerAngles, absolutePos : Bool, timeout : Float);
import public final function AddLine(dbgName : CName, startPosition : Ve
ctor, endPosition : Vector, absolutePos : Bool, color : Color, timeout : Float);

import public final function AddBar(dbgName : CName, x : Int32, y : Int3


2, width : Int32, height : Int32, progress : Float, color : Color, text : String
, timeout : Float);
import public final function AddBarColorSmooth(dbgName : CName, x : Int3
2, y : Int32, width : Int32, height : Int32, progress : Float, color : Color, te
xt : String, timeout : Float);
import public final function AddBarColorAreas(dbgName : CName, x : Int32
, y : Int32, width : Int32, height : Int32, progress : Float, text : String, tim
eout : Float);
import public final function AddArrow(dbgName : CName, start : Vector, e
nd : Vector, arrowPostionOnLine01 : Float, arrowSizeX : Float, arrowSizeY : Floa
t, absolutePos : Bool, color : Color, overlay : Bool, timeout : Float);
import public final function RemoveText(dbgName : CName);
import public final function RemoveSphere(dbgName : CName);
import public final function RemoveBox(dbgName : CName);
import public final function RemoveAxis(dbgName : CName);
import public final function RemoveLine(dbgName : CName);
import public final function RemoveBar(dbgName : CName);
import public final function RemoveArrow(dbgName : CName);
}
class W3Effect_SnowstormQ403 extends W3Effect_Snowstorm{
protected function StopEffects(){
var temp : Bool;
temp = usesCam;
usesCam = false;
super.StopEffects();
usesCam = temp;
if (isOnPlayer){
theGame.GetGameCamera().StopEffect('q403_battle_frost');
}
/* NOP */;
}
protected function PlayEffects(){
var temp : Bool;
temp = usesCam;
usesCam = false;
super.PlayEffects();
usesCam = temp;
if (isOnPlayer){
theGame.GetGameCamera().PlayEffect('q403_battle_frost',
/* NOP */);
}
/* NOP */;
}
}
import struct CDebugAttributesManager{
import public final function AddAttribute(debugName : CName, propertyNam
e : CName, context : IScriptable, groupName : CName) : Bool;
}
class W3Effect_Snowstorm extends W3CriticalDOTEffect{
protected saved var usesCam : Bool;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var params : W3SnowstormCustomParams;
usesCam = false;
if (isOnPlayer){
thePlayer.UnblockAction(21, EffectTypeToName(effectType)
);

params = (W3SnowstormCustomParams)customParams;
if (params && params.showCamEffect){
usesCam = true;
}
}
PlayEffects();
super.OnEffectAdded(customParams);
/* NOP */;
}
public function OnEffectAddedPost() : Bool{
super.OnEffectAddedPost();
if (isOnPlayer && GetWitcherPlayer()){
GetWitcherPlayer().FinishQuen();
}
/* NOP */;
}
protected function OnPaused(){
super.OnPaused();
StopEffects();
/* NOP */;
}
protected function OnResumed(){
super.OnResumed();
PlayEffects();
/* NOP */;
}
public function OnEffectRemoved() : Bool{
StopEffects();
super.OnEffectRemoved();
/* NOP */;
}
protected function StopEffects(){
target.StopEffectIfActive('critical_frozen');
target.StopEffectIfActive('ice_breath_gameplay');
if (usesCam){
theGame.GetGameCamera().StopEffect('frost');
}
/* NOP */;
}
protected function PlayEffects(){
target.PlayEffectSingle('critical_frozen', /* NOP */);
target.PlayEffectSingle('ice_breath_gameplay', /* NOP */);
if (usesCam){
theGame.GetGameCamera().PlayEffect('frost', /* NOP */);
}
/* NOP */;
}
}
import abstract class CLocalizedContent{
}
class W3Effect_Pull extends W3ImmobilizeEffect{
private var movementAdjustor : CMovementAdjustor;
private var ticket : SMovementAdjustmentRequestTicket;
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(23);
blockedActions.PushBack(11);
/* NOP */;

}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var player : CR4Player;
var headingVector : Vector;
player = thePlayer;
super.OnEffectAdded(customParams);
target.PlayEffectSingle('web', /* NOP */);
if (isOnPlayer){
if (GetCreator()){
headingVector = GetCreator().GetWorldPosition()
- target.GetWorldPosition();
} else {
headingVector = target.GetHeadingVector();
}
movementAdjustor = target.GetMovingAgentComponent().GetM
ovementAdjustor();
movementAdjustor.CancelAll();
ticket = movementAdjustor.CreateNewRequest('EffectPull')
;
movementAdjustor.Continuous(ticket);
movementAdjustor.ReplaceRotation(ticket, /* NOP */);
movementAdjustor.RotateTo(ticket, VecHeading(headingVect
or));
movementAdjustor.RotateTowards(ticket, GetCreator(), /*
NOP */);
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, 2160
);
movementAdjustor.MaxLocationAdjustmentSpeed(ticket, 5, /
* NOP */);
movementAdjustor.KeepActiveFor(ticket, duration);
movementAdjustor.SlideTowards(ticket, GetCreator(), 2, 3
);
movementAdjustor.NotifyScript(ticket, this, 'OnSlideFini
sh', 1);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
target.StopEffect('web');
target.SetBehaviorVariable('bCriticalStopped', 1, /* NOP */);
movementAdjustor.Cancel(ticket);
super.OnEffectRemoved();
/* NOP */;
}
public function OnSlideFinish(requestName : CName, notify : EMovementAdj
ustmentNotify) : Bool{
var actor : CActor;
actor = (CActor)GetCreator();
if (actor){
actor.SignalGameplayEvent('SlideFinish');
}
timeLeft = 0;
/* NOP */;
}
}
import abstract class CVoicesetParam{
}
import abstract class CNavmeshComponent{

}
class W3Effect_CounterStrikeHit extends W3CriticalEffect{
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var actor : CActor;
super.OnEffectAdded(customParams);
if (isOnPlayer && !thePlayer.IsUsingVehicle()){
actor = (CActor)EntityHandleGet(creatorHandle);
if (actor){
thePlayer.SetCustomRotation('Stagger', VecHeadin
g(actor.GetWorldPosition() - thePlayer.GetWorldPosition()), 0.000000, 0.200000,
false);
}
}
/* NOP */;
}
}
import abstract class CNavmeshBorderAreaComponent{
}
class W3Effect_Ragdoll extends W3CriticalEffect{
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(6);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(23);
blockedActions.PushBack(11);

blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
var mac : CMovingPhysicalAgentComponent;
var isInAir : Bool;
if (isActive){
timeActive += deltaTime;
}
if (pauseCounters.Size() == 0){
if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
}
if (timeLeft <= 0){
if (!timeEndedHandled){
timeEndedHandled = true;
if (isActive && this == target.GetCurrentlyAnima
tedCS()){
target.RequestCriticalAnimStop(target.Is
InAir());
} else {
LogCritical("Deactivating not animated C
S <<" + criticalStateType + ">>");
isActive = false;
}
} else if (isActive){
isInAir = target.IsInAir();
target.RequestCriticalAnimStop(isInAir);
isActive = isInAir;
}
}
/* NOP */;
}
}
import abstract class SBgNpcJobTree{
}
import abstract class CNavmeshGenerationRootComponent{
}
class W3Effect_BleedingTracking extends W3DamageOverTimeEffect{
private var bloodTemplate : CEntityTemplate;
private var bloodSpawnTimer : Float;
private const var BLOOD_SPAWN_DELAY_MIN : Int32;
private const var BLOOD_SPAWN_DELAY_MAX : Int32;
public function OnDamageDealt(dealtDamage : Bool){
if (!dealtDamage){
shouldPlayTargetEffect = false;

StopTargetFX();
} else {
shouldPlayTargetEffect = true;
PlayTargetFX();
}
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
var pos : Vector;
var posTo : Vector;
var posUp : Vector;
var tempV : Vector;
var posDown : Vector;
super.OnUpdate(dt);
bloodSpawnTimer -= dt;
if (bloodSpawnTimer <= 0){
pos = target.GetWorldPosition();
posUp = pos;
posUp.Z += 0.200000;
posDown = pos;
posDown.Z -= 50;
if (theGame.GetWorld().StaticTrace(posUp, posDown, posTo
, tempV, /* NOP */)){
posTo.Z += 0.050000;
} else {
posTo = posUp;
}
theGame.CreateEntity(bloodTemplate, posTo, EulerAngles(0
, RandF() * 360, 0), /* NOP */, /* NOP */, /* NOP */, 2, /* NOP */);
bloodSpawnTimer = RandRangeF(BLOOD_SPAWN_DELAY_MAX, BLOO
D_SPAWN_DELAY_MIN);
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
bloodTemplate = (CEntityTemplate)LoadResource("tracking_bolt_blo
od", /* NOP */);
bloodSpawnTimer = 0;
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
bloodTemplate = (CEntityTemplate)LoadResource("tracking_bolt_blo
od", /* NOP */);
bloodSpawnTimer = 0;
/* NOP */;
}
}
import abstract class CPathLibRoughtTerrainComponent{
}
class W3Effect_Poison extends W3DamageOverTimeEffect{
}
import abstract class CNavmeshInputAttachment{
}
class W3Effect_PoisonCritical extends W3CriticalDOTEffect{

public function CacheSettings(){


super.CacheSettings();
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(29);
/* NOP */;
}
}
import abstract class CNavmesh{
}
class W3Effect_VitalityDrain extends W3DamageOverTimeEffect{
public function OnDamageDealt(dealtDamage : Bool){
if (!dealtDamage){
shouldPlayTargetEffect = false;
StopTargetFX();
} else {
shouldPlayTargetEffect = true;
PlayTargetFX();
}
/* NOP */;
}
}
import abstract class CNavmeshFactory{
}
class W3Effect_AirDrain extends CBaseGameplayEffect{
public function OnUpdate(deltaTime : Float) : Bool{
var drain : Float;
super.OnUpdate(deltaTime);
if (target.GetStat(6, /* NOP */) <= 0){
target.AddEffectDefault(109, target, "NoAir", /* NOP */)
;
} else {
drain = MaxF(0, deltaTime * effectValue.valueAdditive +
effectValue.valueMultiplicative * target.GetStatMax(6));
effectManager.CacheStatUpdate(6, -drain);
}
if (isOnPlayer && thePlayer.CanPlaySpecificVoiceset()){
thePlayer.PlayVoiceset(100, "coughing", /* NOP */);
thePlayer.SetCanPlaySpecificVoiceset(false);
thePlayer.AddTimer('ResetSpecificVoicesetFlag', 10.00000
0, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (!isOnPlayer){
isActive = false;
return false;
}
target.PauseEffects(59, 'AirDrain', /* NOP */, /* NOP */, /* NOP
*/);
/* NOP */;
}

public function OnEffectRemoved() : Bool{


super.OnEffectRemoved();
target.ResumeEffects(59, 'AirDrain');
/* NOP */;
}
}
import abstract class CPathLibSettings{
}
class W3Effect_AirDrainDive extends CBaseGameplayEffect{
private var effectValueMultInIdle : SAbilityAttributeValue;
private var effectValueMultWhileSprinting : SAbilityAttributeValue;
public function OnUpdate(deltaTime : Float) : Bool{
var drain : Float;
var statee : CR4PlayerStateSwimming;
var val : SAbilityAttributeValue;
super.OnUpdate(deltaTime);
if (isOnPlayer && !thePlayer.OnCheckDiving()){
isActive = false;
return false;
}
if (target.GetStat(6, /* NOP */) <= 0){
if (!target.HasBuff(57)){
target.AddEffectDefault(57, target, "NoAir", /*
NOP */);
}
} else {
val = effectValue;
drain = MaxF(0, deltaTime * val.valueAdditive + val.valu
eMultiplicative * target.GetStatMax(6));
if (isOnPlayer){
statee = (CR4PlayerStateSwimming)thePlayer.GetCu
rrentState();
}
if (statee){
if (statee.CheckIdle()){
drain *= effectValueMultInIdle.valueAddi
tive;
}
} else {
drain *= effectValueMultInIdle.valueAdditive;
}
effectManager.CacheStatUpdate(6, -drain);
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnEffectAdded(customParams);
if (!isOnPlayer){
isActive = false;
return true;
}
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'airDrainMultInIdle', min, max);
effectValueMultInIdle = GetAttributeRandomizedValue(min, max);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'airDrainMultWhileSprinting', min, max);

effectValueMultWhileSprinting = GetAttributeRandomizedValue(min,
max);
target.PauseEffects(59, 'AirDrainDiving', /* NOP */, /* NOP */,
/* NOP */);
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnLoad(t, eff);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'airDrainMultInIdle', min, max);
effectValueMultInIdle = GetAttributeRandomizedValue(min, max);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'airDrainMultWhileSprinting', min, max);
effectValueMultWhileSprinting = GetAttributeRandomizedValue(min,
max);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.ResumeEffects(59, 'AirDrainDiving');
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
duration = -1;
/* NOP */;
}
}
import abstract class IBgNpcTriggerAction{
}
import abstract class CPathLibWorld{
}
class W3Effect_StaminaDrainSwimming extends CBaseGameplayEffect{
private var effectValueMovement : SAbilityAttributeValue;
private var effectValueSprinting : SAbilityAttributeValue;
private var effectValueColdWater : SAbilityAttributeValue;
public function OnUpdate(deltaTime : Float) : Bool{
var drain : Float;
var drainAdd : Float;
var drainMult : Float;
var statee : CR4PlayerStateSwimming;
var currStat : Float;
var rangeA : Float;
var rangeB : Float;
var rangeC : Float;
var currentWaterDepth : Float;
drainMult = 0.000000;
super.OnUpdate(deltaTime);
statee = (CR4PlayerStateSwimming)thePlayer.GetCurrentState();
if (!statee){
return true;
}
currStat = target.GetStat(9, /* NOP */);
if (currStat <= 0){
statee.OnEmptyStamina();

}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (!isOnPlayer){
isActive = false;
return true;
}
ReadXMLValues();
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
ReadXMLValues();
/* NOP */;
}
private function ReadXMLValues(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'staminaDrainMovement', min, max);
effectValueMovement = GetAttributeRandomizedValue(min, max);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'staminaDrainSprinting', min, max);
effectValueSprinting = GetAttributeRandomizedValue(min, max);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'staminaDrainColdWater', min, max);
effectValueColdWater = GetAttributeRandomizedValue(min, max);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.ResumeEffects(2, 'SwimmingStaminaDrain');
target.ResumeEffects(106, 'SwimmingStaminaDrain');
/* NOP */;
}
}
import abstract class SNavmeshParams{
}
class W3Effect_StaminaDrain extends CBaseGameplayEffect{
private var effectValueDrain : SAbilityAttributeValue;
public function OnUpdate(deltaTime : Float) : Bool{
var drain : Float;
var drainAdd : Float;
var drainMult : Float;
drainMult = 0.000000;
super.OnUpdate(deltaTime);
drainAdd += effectValueDrain.valueAdditive;
drainMult += effectValueDrain.valueMultiplicative;
drain = MaxF(0.000000, drainAdd);
drain += MaxF(0.000000, target.GetStatMax(2) * drainMult);
drain *= deltaTime;
if (drain > 0){
effectManager.CacheStatUpdate(2, -drain);
}
/* NOP */;
}

public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{


super.OnEffectAdded(customParams);
if (!isOnPlayer){
isActive = false;
return true;
}
ReadXMLValues();
target.PauseEffects(2, 'StaminaDrain', true, /* NOP */, /* NOP *
/);
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
target.PauseEffects(2, 'StaminaDrain', true, /* NOP */, /* NOP *
/);
ReadXMLValues();
/* NOP */;
}
private function ReadXMLValues(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'staminaDrain', min, max);
effectValueDrain = GetAttributeRandomizedValue(min, max);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.ResumeEffects(2, 'StaminaDrain');
/* NOP */;
}
}
import abstract class CSwfResource{
}
class W3Potion_Cat extends CBaseGameplayEffect{
private saved var highlightObjectsRange : Float;
private saved var highlightEnemiesRange : Float;
private var witcher : W3PlayerWitcher;
private var isScreenFxActive : Bool;
private var timeSinceLastHighlight : Float;
private var timeSinceLastEnemyHighlight : Float;
private const var HIGHLIGHT_REFRESH_DT : Float;
private const var ENEMY_HIGHLIGHT_DT : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnEffectAdded(customParams);
if (!isOnPlayer){
LogAssert(false, "W3Potion_Cat.OnEffectAdded: added not
on player character!");
timeLeft = 0;
return true;
}
witcher = GetWitcherPlayer();
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'highlightObjectsRange', min, max);
highlightObjectsRange = CalculateAttributeValue(GetAttributeRand
omizedValue(min, max), /* NOP */);

theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'highlightEnemiesRange', min, max);
highlightEnemiesRange = CalculateAttributeValue(GetAttributeRand
omizedValue(min, max), /* NOP */);
timeSinceLastHighlight = 0;
timeSinceLastEnemyHighlight = 0;
super.EnableScreenFx(true);
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (highlightObjectsRange > 0){
timeSinceLastHighlight += dt;
if (timeSinceLastHighlight >= HIGHLIGHT_REFRESH_DT){
timeSinceLastHighlight = 0;
witcher.HighlightObjects(highlightObjectsRange,
1);
}
}
if (highlightEnemiesRange > 0){
timeSinceLastEnemyHighlight += dt;
if (timeSinceLastEnemyHighlight >= ENEMY_HIGHLIGHT_DT){
timeSinceLastEnemyHighlight = 0;
witcher.HighlightEnemies(highlightEnemiesRange,
1);
}
}
/* NOP */;
}
protected function OnPaused(){
super.OnPaused();
super.EnableScreenFx(false);
/* NOP */;
}
protected function OnResumed(){
super.OnResumed();
super.EnableScreenFx(true);
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
witcher = GetWitcherPlayer();
timeSinceLastHighlight = 0;
timeSinceLastEnemyHighlight = 0;
if (!IsPaused(/* NOP */)){
super.EnableScreenFx(true);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.EnableScreenFx(false);
super.OnEffectRemoved();
/* NOP */;
}
private final function EnableScreenFx(en : Bool){
if (en){
EnableCatViewFx(1.000000);
SetTintColorsCatViewFx(Vector(0.100000, 0.120000, 0.1300
00, 0.600000), Vector(0.075000, 0.100000, 0.110000, 0.600000), 0.200000);
SetBrightnessCatViewFx(350.000000);

SetViewRangeCatViewFx(200.000000);
SetPositionCatViewFx(Vector(0, 0, 0, 0), true);
SetHightlightCatViewFx(Vector(0.300000, 0.100000, 0.1000
00, 0.100000), 0.050000, 1.500000);
SetFogDensityCatViewFx(0.500000, /* NOP */);
isScreenFxActive = true;
} else {
isScreenFxActive = false;
DisableCatViewFx(1.000000);
}
/* NOP */;
}
}
class W3Potion_FullMoon extends W3ChangeMaxStatEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (GetBuffLevel() == 3){
thePlayer.GainStat(0, thePlayer.GetStat(3, /* NOP */));
}
/* NOP */;
}
}
import abstract class SSwfHeaderInfo{
}
class W3Potion_GoldenOriole extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (GetBuffLevel() < 3){
target.RemoveAllBuffsOfType(19);
target.RemoveAllBuffsOfType(15);
}
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
super.CumulateWith(effect);
if (GetBuffLevel() < 3){
target.RemoveAllBuffsOfType(19);
target.RemoveAllBuffsOfType(15);
}
/* NOP */;
}
protected function GetEffectStrength() : Float{
var i : Int32;
var val : SAbilityAttributeValue;
var tmp : SAbilityAttributeValue;
var ret : Float;
var isPoint : Bool;
var dm : CDefinitionsManagerAccessor;
var atts : array<CName>;
dm.GetAbilityAttributes(abilityName, atts);
i = 0;
while (i < atts.Size()){
if (IsNonPhysicalResistStat(ResistStatNameToEnum(atts[i]
, isPoint))){
dm.GetAbilityAttributeValue(abilityName, atts[i]
, val, tmp);
if (isPoint){

ret += CalculateAttributeValue(val, /* N
OP */);
} else {
ret += 100 * CalculateAttributeValue(val
, /* NOP */);
}
}
i += 1;
}
return ret;
/* NOP */;
}
}
import abstract class SFlashRenderTargetCamera{
}
class W3Potion_KillerWhale extends W3ChangeMaxStatEffect{
private var visionStrength : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
SetUnderWaterBrightness(visionStrength);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
SetUnderWaterBrightness(1);
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnLoad(t, eff);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'vision_strength', min, max);
visionStrength = CalculateAttributeValue(GetAttributeRandomizedV
alue(min, max), /* NOP */);
/* NOP */;
}
public function CacheSettings(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.CacheSettings();
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, 'vision_strength', min, max);
visionStrength = CalculateAttributeValue(GetAttributeRandomizedV
alue(min, max), /* NOP */);
/* NOP */;
}
}
class W3Potion_MariborForest extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var adrenalineBonus : Float;
super.OnEffectAdded(customParams);
if (GetBuffLevel() == 3){
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(abilityName, StatEnumToName(4), min, max);

adrenalineBonus = CalculateAttributeValue(GetAttributeRa
ndomizedValue(min, max), /* NOP */);
target.GainStat(4, adrenalineBonus);
}
/* NOP */;
}
}
import abstract class CClipMap{
}
class W3Potion_PetriPhiltre extends W3RaisePowerStatEffect{
}
class W3Potion_Swallow extends W3Potion_VitalityRegen{
}
class W3Potion_TawnyOwl extends W3RegenEffect{
public function OnTimeUpdated(deltaTime : Float){
var currentHour : Int32;
var level : Int32;
var toxicityThreshold : Float;
if (isActive && pauseCounters.Size() == 0){
timeActive += deltaTime;
if (duration != -1){
level = GetBuffLevel();
currentHour = GameTimeHours(theGame.GetGameTime(
));
if (level < 3 || currentHour > GetHourForDayPart
(1) && currentHour < GetHourForDayPart(3)){
timeLeft -= deltaTime;
}
if (timeLeft <= 0){
if (thePlayer.CanUseSkill(60)){
toxicityThreshold = thePlayer.Ge
tStatMax(3);
toxicityThreshold *= 1 - Calcula
teAttributeValue(thePlayer.GetSkillAttributeValue(60, 'toxicity_threshold', fals
e, true), /* NOP */) * GetWitcherPlayer().GetSkillLevel(60);
}
if (isPotionEffect && target == thePlaye
r && thePlayer.CanUseSkill(60) && thePlayer.GetStat(3, true) > toxicityThreshold
){
} else {
isActive = false;
}
}
}
OnUpdate(deltaTime);
}
/* NOP */;
}
}
import abstract class CTerrainTile{
}
class W3Potion_Thunderbolt extends W3RaisePowerStatEffect{
}

import abstract class CUmbraScene{


}
class W3Potion_WhiteHoney extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
target.ForceSetStat(3, 0);
thePlayer.RemoveAllPotionEffectsBut(this);
/* NOP */;
}
}
import abstract class CUmbraTile{
}
class W3Potion_WhiteRaffardDecoction extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var vitality : Float;
var vitAtt : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
super.OnEffectAdded(customParams);
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, StatEnumToName(0), min, max);
vitAtt = GetAttributeRandomizedValue(min, max);
vitality = target.GetStatMax(0) * vitAtt.valueMultiplicative + v
itAtt.valueAdditive;
target.GainStat(0, vitality);
if (GetBuffLevel() == 3){
target.SetImmortalityMode(2, 64, /* NOP */);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
if (GetBuffLevel() == 3){
target.SetImmortalityMode(0, 64, /* NOP */);
}
/* NOP */;
}
}
class W3Potion_PheromoneNekker extends W3Potion_Pheromone{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
theGame.SetGlobalAttitude('AG_nekker', 'player', 0);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
theGame.SetGlobalAttitude('AG_nekker', 'player', 2);
/* NOP */;
}
}
import abstract class CGameResource{
}
class W3Potion_PheromoneDrowner extends W3Potion_Pheromone{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{

super.OnEffectAdded(customParams);
theGame.SetGlobalAttitude('AG_drowner', 'player', 0);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
theGame.SetGlobalAttitude('AG_drowner', 'player', 2);
/* NOP */;
}
}
import abstract class CResourceSceneFile{
}
class W3Potion_PheromoneBear extends W3Potion_Pheromone{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
theGame.SetGlobalAttitude('AG_bear_berserker', 'player', 0);
theGame.SetGlobalAttitude('q201_cage_bear', 'player', 0);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
theGame.SetGlobalAttitude('AG_bear_berserker', 'player', 2);
theGame.SetGlobalAttitude('q201_cage_bear', 'player', 2);
/* NOP */;
}
}
import abstract class CApexResource{
}
class W3Effect_AxiiGuardMe extends CBaseGameplayEffect{
private var drainStaminaOnExit : Bool;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var npc : CNewNPC;
var bonusAbilityName : CName;
var skillLevel : Int32;
var i : Int32;
super.OnEffectAdded(customParams);
npc = (CNewNPC)target;
(CAIStorageReactionData)npc.GetAIStorageObject('ReactionData').R
esetAttitudes(npc);
if (npc.HasAttitudeTowards(thePlayer) && npc.GetAttitude(thePlay
er) == 2){
npc.ResetAttitude(thePlayer);
}
if (npc.HasTag('animal') || npc.IsHorse()){
npc.SetTemporaryAttitudeGroup('animals_charmed', 2);
} else {
npc.SetTemporaryAttitudeGroup('npc_charmed', 2);
}
npc.SignalGameplayEvent('AxiiGuardMeAdded');
npc.SignalGameplayEvent('NoticedObjectReevaluation');
skillLevel = GetWitcherPlayer().GetSkillLevel(41);
bonusAbilityName = thePlayer.GetSkillAbilityName(41);
i = 0;
while (i < skillLevel){
target.AddAbility(bonusAbilityName, true);
i += 1;

}
if (npc.IsHorse()){
npc.GetHorseComponent().ResetPanic();
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var npc : CNewNPC;
var bonusAbilityName : CName;
super.OnEffectRemoved();
npc = (CNewNPC)target;
if (npc){
npc.ResetTemporaryAttitudeGroup(2);
npc.SignalGameplayEvent('NoticedObjectReevaluation');
(CAIStorageReactionData)npc.GetAIStorageObject('Reaction
Data').ResetAttitudes(npc);
}
if (drainStaminaOnExit){
target.DrainStamina(13, target.GetStat(2, /* NOP */), /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
}
bonusAbilityName = thePlayer.GetSkillAbilityName(41);
while (target.HasAbility(bonusAbilityName)){
target.RemoveAbility(bonusAbilityName);
}
/* NOP */;
}
public function SetDrainStaminaOnExit(){
drainStaminaOnExit = true;
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
if (duration > 0){
duration = MaxF(8.000000, duration);
}
/* NOP */;
}
}
import abstract class SAnimationSequencePartDefinition{
//NULL type for animation
//NULL type for syncType
//NULL type for syncEventName
//NULL type for shouldSlide
//NULL type for shouldRotate
//NULL type for finalPosition
//NULL type for finalHeading
//NULL type for blendInTime
//NULL type for blendOutTime
//NULL type for sequenceIndex
//NULL type for useRefBone
//NULL type for rotationTypeUsingRefBone
//NULL type for disableProxyCollisions
//NULL type for allowBreakBeforeAtAfterEventsStart
//NULL type for allowBreakAtStartBeforeEventsEnd
}
import abstract class CApexClothResource{
}

class W3Effect_ShrineAard extends W3Effect_Shrine{


}
import abstract class CApexDestructionResource{
}
class W3Effect_ShrineAxii extends W3Effect_Shrine{
}
class W3Effect_ShrineIgni extends W3Effect_Shrine{
}
import abstract class CGlobalWater{
}
class W3Effect_ShrineQuen extends W3Effect_Shrine{
}
import abstract class CResourceSimplexTree{
}
class W3Effect_ShrineYrden extends W3Effect_Shrine{
}
import struct CNormalBlendComponent{
}
class W3Effect_EnhancedArmor extends CBaseGameplayEffect{
}
import abstract class CNormalBlendAttachment{
}
class W3Effect_EnhancedWeapon extends CBaseGameplayEffect{
}
class W3Effect_AirBoost extends W3ChangeMaxStatEffect{
}
class W3Effect_Edible extends W3RegenEffect{
}
class W3Effect_LowHealth extends CBaseGameplayEffect{
}
class W3Effect_Slowdown extends CBaseGameplayEffect{
private saved var slowdownCauserId : Int32;
private saved var decayPerSec : Float;
private saved var decayDelay : Float;
private saved var delayTimer : Float;
private saved var slowdown : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var dm : CDefinitionsManagerAccessor;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var prc : Float;
var pts : Float;
super.OnEffectAdded(customParams);
dm = theGame.GetDefinitionsManager();

dm.GetAbilityAttributeValue(abilityName, 'decay_per_sec', min, m


ax);
decayPerSec = CalculateAttributeValue(GetAttributeRandomizedValu
e(min, max), /* NOP */);
dm.GetAbilityAttributeValue(abilityName, 'decay_delay', min, max
);
decayDelay = CalculateAttributeValue(GetAttributeRandomizedValue
(min, max), /* NOP */);
slowdown = CalculateAttributeValue(effectValue, /* NOP */);
target.GetResistValue(6, pts, prc);
slowdown = slowdown * 1 - ClampF(prc, 0, 1);
slowdownCauserId = target.SetAnimationSpeedMultiplier(1 - slowdo
wn, /* NOP */);
delayTimer = 0;
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
if (decayDelay >= 0 && decayPerSec > 0){
if (delayTimer >= decayDelay){
target.ResetAnimationSpeedMultiplier(slowdownCau
serId);
slowdown -= decayPerSec * dt;
if (slowdown > 0){
slowdownCauserId = target.SetAnimationSp
eedMultiplier(1 - slowdown, /* NOP */);
} else {
isActive = false;
}
} else {
delayTimer += dt;
}
}
super.OnUpdate(dt);
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
super.CumulateWith(effect);
delayTimer = 0;
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.ResetAnimationSpeedMultiplier(slowdownCauserId);
/* NOP */;
}
}
class W3Effect_SlowdownFrost extends CBaseGameplayEffect{
private saved var slowdownCauserId : Int32;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
slowdownCauserId = target.SetAnimationSpeedMultiplier(0.700000,
/* NOP */);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
target.ResetAnimationSpeedMultiplier(slowdownCauserId);
super.OnEffectRemoved();
/* NOP */;
}

}
class W3Effect_SlowdownAxii extends W3Effect_Slowdown{
}
import abstract class CCurveEntity{
}
class W3Effect_AbilityOnLowHP extends CBaseGameplayEffect{
private var lowHPAbilityName : CName;
public function CacheSettings(){
var dm : CDefinitionsManagerAccessor;
var i : Int32;
var attributes : array<CName>;
super.CacheSettings();
attributeName = 'healthPercents';
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(abilityName, attributes);
i = 0;
while (i < attributes.Size()){
if (dm.IsAbilityDefined(attributes[i])){
lowHPAbilityName = attributes[i];
break;
}
i += 1;
}
/* NOP */;
}
public function OnUpdate(deltaTime : Float) : Bool{
super.OnUpdate(deltaTime);
if (target.GetHealthPercents() * 100 <= effectValue.valueAdditiv
e){
target.AddAbility(lowHPAbilityName, false);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.RemoveAbility(lowHPAbilityName);
/* NOP */;
}
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
if (lowHPAbilityName != (W3Effect_AbilityOnLowHP)e.lowHPAbilityN
ame){
return 3;
}
return super.GetSelfInteraction(e);
/* NOP */;
}
}
class W3Effect_Drowning extends W3DamageOverTimeEffect{
public var m_NoSaveLockInt : Int32;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
target.PlayEffectSingle('underwater_drowning', /* NOP */);
target.PauseHPRegenEffects('drowning', /* NOP */);
theGame.CreateNoSaveLock("player_drowning", m_NoSaveLockInt, /*
NOP */, /* NOP */);

/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStat(6, /* NOP */) > 0 || isOnPlayer && !thePlayer
.OnCheckDiving()){
isActive = false;
return false;
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
target.StopEffect('underwater_drowning');
super.OnEffectRemoved();
target.ResumeHPRegenEffects('drowning');
theGame.ReleaseNoSaveLock(m_NoSaveLockInt);
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
duration = -1;
/* NOP */;
}
}
class W3Effect_Choking extends W3DamageOverTimeEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
target.PauseHPRegenEffects('choking', /* NOP */);
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (target.GetStat(6, /* NOP */) > 0){
isActive = false;
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.ResumeHPRegenEffects('choking');
/* NOP */;
}
}
import abstract class CCurveControlPointComponent{
}
class W3Effect_OverEncumbered extends CBaseGameplayEffect{
private var timeSinceLastMessage : Float;
private const var OVERWEIGHT_MESSAGE_DELAY : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (!isOnPlayer){
LogAssert(false, "W3Effect_OverEncumbered.OnEffectAdded:
adding effect <<" + effectType + ">> on non-player actor - aborting!");
timeLeft = 0;
return false;
}
(CR4Player)target.BlockAction(14, 'OverEncumbered', true, /* NOP

*/, /* NOP */);


/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
(CR4Player)target.UnblockAction(14, 'OverEncumbered');
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
/* NOP */;
}
}
import abstract class CCurveTangentControlPointEntity{
}
class W3Effect_SilverDust extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
target.PauseEffects(3, 'silver_dust', /* NOP */, /* NOP */, /* N
OP */);
super.BlockAbilities(true);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
target.ResumeEffects(3, 'silver_dust');
super.BlockAbilities(false);
super.OnEffectRemoved();
/* NOP */;
}
private final function BlockAbilities(block : Bool){
var ret : Bool;
ret = target.BlockAbility('Swarm', block, /* NOP */) || ret;
ret = target.BlockAbility('SwarmShield', block, /* NOP */) || re
t;
ret = target.BlockAbility('SwarmTeleport', block, /* NOP */) ||
ret;
ret = target.BlockAbility('Shapeshifter', block, /* NOP */) || r
et;
ret = target.BlockAbility('ShadowForm', block, /* NOP */) || ret
;
ret = target.BlockAbility('MistForm', block, /* NOP */) || ret;
ret = target.BlockAbility('MistCharge', block, /* NOP */) || ret
;
ret = target.BlockAbility('Flashstep', block, /* NOP */) || ret;
ret = target.BlockAbility('FullMoon', block, /* NOP */) || ret;
ret = target.BlockAbility('EssenceRegen', block, /* NOP */) || r
et;
if (block && ret){
target.PlayEffect('transformation_block', /* NOP */);
} else if (!block){
target.StopEffect('transformation_block');
}
/* NOP */;
}
}
import abstract class CCurveTangentControlPointComponent{
}

class W3Effect_WeatherBonus extends CBaseGameplayEffect{


}
import abstract class SDynamicDecalMaterialInfo{
}
class W3Effect_BoostedEssenceRegen extends W3RegenEffect{
}
import abstract class CDynamicFoliageComponent{
}
class W3Effect_BoostedStaminaRegen extends W3RegenEffect{
}
import abstract class CSwitchableFoliageResourceFactory{
}
class W3Effect_Drunkenness extends CBaseGameplayEffect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
EnableDrunkFx(1.000000);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
DisableDrunkFx(1.000000);
super.OnEffectRemoved();
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
if (!IsPaused(/* NOP */)){
EnableDrunkFx(1.000000);
}
/* NOP */;
}
protected function OnPaused(){
super.OnPaused();
DisableDrunkFx(/* NOP */);
/* NOP */;
}
protected function OnResumed(){
super.OnResumed();
EnableDrunkFx(/* NOP */);
/* NOP */;
}
}
class W3StaggerAura extends W3Effect_Aura{
}
class W3FireAura extends W3Effect_Aura{
protected function ApplySpawnsOn(entityGE : CGameplayEntity){
if ((CActor)entityGE){
super.ApplySpawnsOn(entityGE);
} else {
entityGE.OnFireHit(GetCreator());
}
/* NOP */;

}
}
class W3Mutagen01_Effect extends W3Mutagen_Effect{
}
import abstract class SFurVisualizers{
}
class W3Mutagen02_Effect extends W3Mutagen_Effect{
}
import abstract class SFurSimulation{
}
class W3Mutagen03_Effect extends W3Mutagen_Effect{
public function OnEffectAddedPost() : Bool{
var i : Int32;
var items : array<SItemUniqueId>;
super.OnEffectAddedPost();
thePlayer.inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (thePlayer.inv.IsItemBomb(items[i]) || !thePlayer.inv
.IsItemMutagenPotion(items[i]) && thePlayer.inv.IsItemPotion(items[i])){
thePlayer.inv.SingletonItemAddAmmo(items[i], 1);
}
i += 1;
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var i : Int32;
var items : array<SItemUniqueId>;
super.OnEffectRemoved();
thePlayer.inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (thePlayer.inv.IsItemBomb(items[i]) || !thePlayer.inv
.IsItemMutagenPotion(items[i]) && thePlayer.inv.IsItemPotion(items[i])){
thePlayer.inv.SingletonItemRemoveAmmo(items[i],
1);
}
i += 1;
}
/* NOP */;
}
}
import abstract class SFurVolume{
}
class W3Mutagen04_Effect extends W3Mutagen_Effect{
}
import abstract class SFurStrandWidth{
}
class W3Mutagen05_Effect extends W3Mutagen_Effect{
}

import abstract class SFurStiffness{


}
class W3Mutagen06_Effect extends W3Mutagen_Effect{
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.RemoveAbilityAll(abilityName);
/* NOP */;
}
}
import abstract class SFurClumping{
}
class W3Mutagen07_Effect extends W3Mutagen_Effect{
}
import abstract class SFurWaveness{
}
class W3Mutagen08_Effect extends W3Mutagen_Effect{
}
import abstract class SFurPhysicalMaterials{
}
class W3Mutagen09_Effect extends W3Mutagen_Effect{
private var hasAbility : Bool;
public function OnUpdate(dt : Float) : Bool{
super.OnUpdate(dt);
if (GetCurWeather() == 0){
if (hasAbility){
target.RemoveAbility(abilityName);
hasAbility = false;
}
} else if (!hasAbility){
target.AddAbility(abilityName, false);
hasAbility = true;
}
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
hasAbility = target.HasAbility(abilityName);
/* NOP */;
}
}
import abstract class SFurColor{
}
class W3Mutagen10_Effect extends W3Mutagen_Effect{
}
import abstract class SFurDiffuse{
}
class W3Mutagen11_Effect extends W3Mutagen_Effect{
}

import abstract class SFurSpecular{


}
class W3Mutagen12_Effect extends W3Mutagen_Effect{
}
import abstract class SFurGlint{
}
class W3Mutagen14_Effect extends W3Mutagen_Effect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (target.IsInCombat()){
target.AddTimer('Mutagen14Timer', 2, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
GetWitcherPlayer().RemoveTimer('Mutagen14Timer', /* NOP */);
super.OnEffectRemoved();
/* NOP */;
}
}
import abstract class SFurShadow{
}
class W3Mutagen15_Effect extends W3Mutagen_Effect{
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
if (target.IsInCombat() && !target.HasAbility(abilityName)){
target.AddAbility(abilityName, false);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
if (target.HasAbility(abilityName)){
target.RemoveAbility(abilityName);
}
/* NOP */;
}
}
import abstract class SFurGraphicalMaterials{
}
class W3Mutagen16_Effect extends W3Mutagen_Effect{
public function OnEffectAddedPost() : Bool{
super.OnEffectAddedPost();
super.UpdateEncumbrance();
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
super.UpdateEncumbrance();
/* NOP */;
}

private final function UpdateEncumbrance(){


var invMenu : CR4InventoryMenu;
if (isOnPlayer){
GetWitcherPlayer().UpdateEncumbrance();
invMenu = (CR4InventoryMenu)(CR4MenuBase)theGame.GetGuiM
anager().GetRootMenu().GetLastChild();
if (invMenu){
invMenu.UpdateEncumbranceInfo();
}
}
/* NOP */;
}
}
import abstract class SFurCulling{
}
class W3Mutagen18_Effect extends W3Mutagen_Effect{
public function OnEffectRemoved() : Bool{
super.OnEffectRemoved();
target.RemoveAbilityAll(abilityName);
/* NOP */;
}
}
import abstract class SFurDistanceLOD{
}
class W3Mutagen19_Effect extends W3Mutagen_Effect{
}
import abstract class SFurDetailLOD{
}
class W3Mutagen21_Effect extends W3Mutagen_Effect{
}
import abstract class SFurLevelOfDetail{
}
class W3Mutagen22_Effect extends W3Mutagen_Effect{
}
import abstract class SFurMaterialSet{
}
class W3Mutagen23_Effect extends W3Mutagen_Effect{
public function OnUpdate(dt : Float) : Bool{
var currentHour : Int32;
var currentMinutes : Int32;
var i : Int32;
var gameTime : GameTime;
var params : SCustomEffectParams;
var shrineBuffs : array<EEffectType>;
var addBuff : Bool;
var shrineParams : W3ShrineEffectParams;
super.OnUpdate(dt);
if (effectManager.HasAnyMutagen23ShrineBuff()){
return true;
}

gameTime = theGame.GetGameTime();
currentHour = GameTimeHours(gameTime);
currentMinutes = GameTimeMinutes(gameTime);
if (currentHour == GetHourForDayPart(1) && currentMinutes < 15 |
| currentHour == GetHourForDayPart(1) - 1 && currentMinutes > 45){
addBuff = true;
} else if (currentHour == GetHourForDayPart(3) && currentMinutes
< 15 || currentHour == GetHourForDayPart(3) - 1 && currentMinutes > 45){
addBuff = true;
} else {
addBuff = false;
}
if (addBuff){
shrineBuffs = GetMinorShrineBuffs();
i = shrineBuffs.Size() - 1;
while (i >= 0){
if (target.HasBuff(shrineBuffs[i])){
shrineBuffs.Erase(i);
}
i -= 1;
}
if (shrineBuffs.Size() == 0){
shrineBuffs = GetMinorShrineBuffs();
}
params.effectType = shrineBuffs[RandRange(shrineBuffs.Si
ze(), /* NOP */)];
params.sourceName = 'Mutagen23';
params.duration = ConvertGameSecondsToRealTimeSeconds(60
* 60 * 6);
shrineParams = new W3ShrineEffectParams in theGame;
shrineParams.isFromMutagen23 = true;
params.buffSpecificParams = shrineParams;
target.AddEffectCustom(params);
delete shrineParams;
}
/* NOP */;
}
}
import abstract class CCurveEntitySpawner{
}
class W3Mutagen24_Effect extends W3Mutagen_Effect{
}
class W3Mutagen27_Effect extends W3Mutagen_Effect{
}
import abstract class SEventGroupsRanges{
}
import abstract class SSavegameInfo{
//NULL type for slotType
//NULL type for slotIndex
//NULL type for filename
}
abstract class W3Effect_Aura extends W3ApplicatorEffect{
private saved var isOneTimeOnly : Bool;
private saved var range : Float;

private var flags : Int32;


public function OnUpdate(deltaTime : Float) : Bool{
var ents : array<CGameplayEntity>;
var i : Int32;
super.OnUpdate(deltaTime);
FindGameplayEntitiesInSphere(ents, target.GetWorldPosition(), ra
nge, 1000, 'None', flags, /* NOP */, /* NOP */);
i = 0;
while (i < ents.Size()){
ApplySpawnsOn(ents[i]);
i += 1;
}
if (isOneTimeOnly){
isActive = false;
}
/* NOP */;
}
public function CacheSettings(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var tmpAuraName : CName;
var tmpName : CName;
var i : Int32;
var tmpFloat : Float;
var tmpBool : Bool;
var type : EEffectType;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpAuraName);
EffectNameToType(tmpAuraName, type, tmpName);
if (effectType == type){
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'isOneTimeOnly', tmpBool)){
isOneTimeOnly = tmpBool;
}
if (dm.GetCustomNodeAttributeValueFloat(main.sub
Nodes[i], 'range', tmpFloat)){
range = tmpFloat;
} else {
LogAssert(false, "W3Effect_Aura.CacheSet
tings: no range defined for aura applicator <<" + tmpAuraName + ">>, aborting!")
;
return;
}
}
i += 1;
}
if (!HasNeutralSpawn()){
flags = 4;
} else {
flags = 0;
}
/* NOP */;
}
}

abstract class W3AutoRegenEffect extends W3RegenEffect{


protected function SetEffectValue(){
if (regenStat != 0){
effectValue = target.GetAttributeValue(RegenStatEnumToNa
me(regenStat), /* NOP */, /* NOP */);
}
/* NOP */;
}
}
class W3ExplosiveBolt extends W3BoltProjectile{
public editable var explosionRange : Float;
private var insideToxicClouds : array<W3ToxicCloud>;
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var ents : array<CGameplayEntity>;
var i : Int32;
var waterZ : Float;
var victim : CActor;
var actor : CActor;
if (wasShotUnderWater && hitCollisionsGroups.Contains('Water')){
return true;
}
victim = (CActor)collidingComponent.GetEntity();
SetVictim(victim);
if (!CanCollideWithVictim(victim)){
return true;
}
if (!ProcessProjectileRepulsion(pos, normal)){
if (wasShotUnderWater){
waterZ = theGame.GetWorld().GetWaterLevel(pos, t
rue);
if (waterZ >= pos.Z){
if (victim){
super.OnProjectileCollision(pos,
normal, collidingComponent, hitCollisionsGroups, actorIndex, shapeIndex);
} else {
StopProjectile();
isActive = false;
DestroyAfter(20);
}
return true;
}
}
StopProjectile();
isActive = false;
if (hitCollisionsGroups.Contains('Water') && !hitCollisi
onsGroups.Contains('Terrain')){
PlayEffect('explode_water', /* NOP */);
} else {
PlayEffect('explosion', /* NOP */);
}
pos.Z += 0.100000;
FindGameplayEntitiesInSphere(ents, pos, explosionRange,
100000, /* NOP */, 16384, /* NOP */, /* NOP */);
if (ents.Size() == 0){
pos.Z -= 0.200000;
FindGameplayEntitiesInSphere(ents, pos, explosio
nRange, 100000, /* NOP */, 16384, /* NOP */, /* NOP */);

}
i = 0;
while (i < ents.Size()){
if (ents[i] == this){
} else {
actor = (CActor)ents[i];
if (actor && !actor.IsAlive()){
} else {
ProcessDamageAction(ents[i], Vec
tor(0, 0, 0), 'None');
}
}
i += 1;
}
i = 0;
while (i < insideToxicClouds.Size()){
if (insideToxicClouds[i] && insideToxicClouds[i]
.GetCurrentStateName() == 'Armed'){
(W3ToxicCloudStateArmed)insideToxicCloud
s[i].GetCurrentState().Explode(this);
}
i += 1;
}
DestroyAfter(5);
}
/* NOP */;
}
public final function AddToxicCloud(gas : W3ToxicCloud){
if (gas){
insideToxicClouds.PushBack(gas);
}
/* NOP */;
}
public final function RemoveToxicCloud(gas : W3ToxicCloud){
if (gas){
insideToxicClouds.Remove(gas);
}
/* NOP */;
}
}
import abstract class CCameraEffectTrigger{
}
abstract class W3ChangeMaxStatEffect extends CBaseGameplayEffect{
protected saved var stat : EBaseCharacterStats;
public function Init(params : SEffectInitInfo){
attributeName = StatEnumToName(stat);
super.Init(params);
/* NOP */;
}
}
class W3Potion_Pheromone extends CBaseGameplayEffect{
private saved var abilityNameStr : String;
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
if (abilityName != e.abilityName){
return 3;
}

return super.GetSelfInteraction(e);
/* NOP */;
}
}
import abstract class SPoseLookAtSegmentData{
}
import abstract class IBehaviorPoseConstraintPoseLookAtModifier{
}
import abstract class SGameplayAdditiveAnimation{
}
class W3DestructSelfEntity extends CGameplayEntity{
private editable var destructAfterDelay : Float;
private editable var stopEffectDuration : Float;
private editable var effectToStop : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.SetTimer(destructAfterDelay);
/* NOP */;
}
public final function SetTimer(_DestructAfterDelay : Float){
var delayToStopEffect : Float;
RemoveTimer('Destroy', /* NOP */);
RemoveTimer('StopEffectAfter', /* NOP */);
if (_DestructAfterDelay < 0){
return;
}
if (IsNameValid(effectToStop)){
delayToStopEffect = ClampF(destructAfterDelay - stopEffe
ctDuration, 0, destructAfterDelay);
AddTimer('StopEffectAfter', delayToStopEffect, false, /*
NOP */, /* NOP */, true, /* NOP */);
}
DestroyAfter(destructAfterDelay);
/* NOP */;
}
private final timer function StopEffectAfter(optional delta : Float, opt
ional id : Int32){
StopEffect(effectToStop);
/* NOP */;
}
}
import struct CSpawnTreeInitializerRiderIdleAI{
public editable inlined var ai : CAIRiderIdleRedefinitionParameters;
public function Init(){
ai = new CAIRiderIdleRedefinitionParameters in this;
ai.OnCreated();
/* NOP */;
}
}
import struct CSpawnTreeInitializerIdleFlightAI{
public editable inlined var ai : CAIFlightIdleRedefinitionParameters;
public function Init(){
ai = new CAIFlightIdleRedefinitionParameters in this;
ai.OnCreated();
/* NOP */;

}
}
import struct CSpawnTreeInitializerStartingBehavior{
public editable inlined var ai : CAIStartingBehaviorParameters;
public function Init(){
ai = new CAIStartingBehaviorParameters in this;
ai.OnCreated();
/* NOP */;
}
}
import struct CSpawnTreeInitializerRiderStartingBehavior{
public editable inlined var ai : CAIRiderStartingBehaviorParameters;
public function Init(){
ai = new CAIRiderStartingBehaviorParameters in this;
ai.OnCreated();
/* NOP */;
}
}
import struct CCommunityActionPointSelector{
}
class VectorSpringDamper extends CObject{
protected var destValue : Vector;
protected var currValue : Vector;
protected var velValue : Vector;
protected var smoothTime : Float;
public final function SetSmoothTime(value : Float){
smoothTime = value;
/* NOP */;
}
public final function Init(curr : Vector, dest : Vector){
currValue = curr;
destValue = dest;
velValue = Vector(0.000000, 0.000000, 0.000000);
/* NOP */;
}
public final function Reset(){
destValue = Vector(0.000000, 0.000000, 0.000000);
currValue = Vector(0.000000, 0.000000, 0.000000);
velValue = Vector(0.000000, 0.000000, 0.000000);
/* NOP */;
}
public final function SetValue(value : Vector){
destValue = value;
/* NOP */;
}
public final function GetValue() : Vector{
return currValue;
/* NOP */;
}
public final function GetDestValue() : Vector{
return destValue;
/* NOP */;
}
public final function Update(dt : Float){
var omega : Float;
var x : Float;

var exp : Float;


var diff : Vector;
var temp : Vector;
if (smoothTime > 0.000000){
omega = 2.000000 / smoothTime;
x = omega * dt;
exp = 1.000000 / 1.000000 + x + 0.480000 * x * x + 0.235
000 * x * x * x;
diff = currValue - destValue;
temp = velValue + omega * diff * dt;
velValue = velValue - omega * temp * exp;
currValue = destValue + diff + temp * exp;
} else if (dt > 0.000000){
velValue = destValue - currValue / dt;
currValue = destValue;
}
/* NOP */;
}
public final function UpdateAndGet(dt : Float, value : Vector) : Vector{
SetValue(value);
Update(dt);
return GetValue();
/* NOP */;
}
public function UpdateManual(current : Vector, velocity : Vector, dest :
Vector, dt : Float){
currValue = current;
velValue = velocity;
destValue = dest;
super.Update(dt);
current = currValue;
velocity = velValue;
/* NOP */;
}
}
class CAICombatDecoratorCommunity extends CAICombatDecoratorTree{
}
class CSpawnTreeInitializerSmartDynamicWanderAI extends ISpawnTreeInitializerIdl
eSmartAI{
public function GetObjectForPropertiesEdition() : IScriptable{
if (ai && (CAIDynamicWander)ai.idleTree){
return (CAIDynamicWander)ai.idleTree;
}
return this;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "AreaWander SmartAI";
/* NOP */;
}
public function Init(){
super.Init();
ai.idleTree = new CAIDynamicWander in this;
ai.idleTree.OnCreated();
/* NOP */;
}
}

class CSpawnTreeEncunterStateByEntryMonitorInitializer extends ISpawnTreeSpawnMo


nitorInitializer{
public editable var counterType : EEncounterMonitorCounterType;
public editable var referenceValue : Int32;
public editable var operator : EOperator;
public editable var disableMonitorAfterTasksFinished : Bool;
public editable var factOnConditionMet : String;
public editable inlined var ownerEncounterTasks : array<SOwnerEncounterT
askParams>;
public editable inlined var externalEncounterTasks : array<SExternalEnco
unterTaskParams>;
public function MonitorCreatureKilled(actor : CActor, spawnTreeEntry : C
BaseCreatureEntry, encounter : CEncounter){
var encDatamanager : CEncounterDataManager;
var entryName : CName;
var killedCreatures : Int32;
if (counterType == 0 || counterType == 3 || counterType == 2){
entryName = spawnTreeEntry.nodeName;
encDatamanager = encounter.GetEncounterDataManager();
if (!encDatamanager){
encounter.InitializeEncounterDataManager();
encDatamanager = encounter.GetEncounterDataManag
er();
}
if (!encDatamanager.IsMonitorEnabled(this)){
return;
}
if (counterType == 0){
encDatamanager.AddKilledCreatureByEntry(entryNam
e);
killedCreatures = encDatamanager.GetKilledCreatu
resByEntry(entryName);
} else if (counterType == 3){
encDatamanager.AddLostCreatureByEntry(entryName)
;
killedCreatures = encDatamanager.GetLostCreature
sByEntry(entryName);
} else if (counterType == 2){
encDatamanager.RemoveCurrentlySpawnedCreatureByE
ntry(entryName);
killedCreatures = encDatamanager.GetCurrentlySpa
wnedCreaturesByEntry(entryName);
}
if (TestCondition(killedCreatures)){
SetTasks(encounter);
if (disableMonitorAfterTasksFinished){
encDatamanager.DisableMonitor(this);
}
}
}
/* NOP */;
}
public function MonitorCreatureSpawned(actor : CActor, spawnTreeEntry :
CBaseCreatureEntry, encounter : CEncounter){
var encDatamanager : CEncounterDataManager;
var entryName : CName;
var spawnedCreatures : Int32;
if (counterType == 1 || counterType == 2 || counterType == 3){
entryName = spawnTreeEntry.nodeName;
encDatamanager = encounter.GetEncounterDataManager();

if (!encDatamanager){
encounter.InitializeEncounterDataManager();
encDatamanager = encounter.GetEncounterDataManag
er();
}
if (!encDatamanager.IsMonitorEnabled(this)){
return;
}
if (counterType == 2){
encDatamanager.AddCurrentlySpawnedCreatureByEntr
y(entryName);
spawnedCreatures = encDatamanager.GetCurrentlySp
awnedCreaturesByEntry(entryName);
} else if (counterType == 1){
encDatamanager.AddSpawnedCreatureByEntry(entryNa
me);
spawnedCreatures = encDatamanager.GetSpawnedCrea
turesByEntry(entryName);
} else if (counterType == 3){
encDatamanager.RemoveLostCreatureByEntry(entryNa
me);
spawnedCreatures = encDatamanager.GetLostCreatur
esByEntry(entryName);
}
if (TestCondition(spawnedCreatures)){
SetTasks(encounter);
if (disableMonitorAfterTasksFinished){
encDatamanager.DisableMonitor(this);
}
}
}
/* NOP */;
}
public function MonitorCreatureLost(actor : CActor, spawnTreeEntry : CBa
seCreatureEntry, encounter : CEncounter){
var encDatamanager : CEncounterDataManager;
var entryName : CName;
var spawnedCreatures : Int32;
if (counterType == 3 || counterType == 2){
entryName = spawnTreeEntry.nodeName;
encDatamanager = encounter.GetEncounterDataManager();
if (!encDatamanager){
encounter.InitializeEncounterDataManager();
encDatamanager = encounter.GetEncounterDataManag
er();
}
if (!encDatamanager.IsMonitorEnabled(this)){
return;
}
if (counterType == 2){
encDatamanager.RemoveCurrentlySpawnedCreatureByE
ntry(entryName);
spawnedCreatures = encDatamanager.GetCurrentlySp
awnedCreaturesByEntry(entryName);
} else if (counterType == 3){
encDatamanager.AddLostCreatureByEntry(entryName)
;
spawnedCreatures = encDatamanager.GetLostCreatur
esByEntry(entryName);
}

if (TestCondition(spawnedCreatures)){
SetTasks(encounter);
if (disableMonitorAfterTasksFinished){
encDatamanager.DisableMonitor(this);
}
}
}
/* NOP */;
}
public function TestCondition(value : Int32) : Bool{
switch(operator){
case 0:
return value == referenceValue;
case 1:
return value != referenceValue;
case 2:
return value < referenceValue;
case 3:
return value <= referenceValue;
case 4:
return value > referenceValue;
case 5:
return value >= referenceValue;
default:
}
return false;
/* NOP */;
}
public function SetTasks(encounter : CEncounter){
var i : Int32;
var encDatamanager : CEncounterDataManager;
encDatamanager = encounter.GetEncounterDataManager();
i = 0;
while (i < ownerEncounterTasks.Size()){
encDatamanager.AddOwnerTask(ownerEncounterTasks[i]);
i += 1;
}
i = 0;
while (i < externalEncounterTasks.Size()){
encDatamanager.AddExternalTask(externalEncounterTasks[i]
);
i += 1;
}
encounter.ProcessTasks();
if (!FactsDoesExist(factOnConditionMet)){
FactsAdd(factOnConditionMet, 1, -1);
}
/* NOP */;
}
public function GetFriendlyName() : String{
return "EncounterStateByEntryMonitor";
/* NOP */;
}
}
import struct CCreaturePartyEntry{
//NULL type for partySpawnOrganizer
import public function AddPartyMember(inEditor : Bool) : CSpawnTreeEntry
SubDefinition;
public function GetContextMenuSpecialOptions(names : array<String>){

names.PushBack("Add rider + horse in party");


/* NOP */;
}
public function RunSpecialOption(option : Int32){
var horseMember : CSpawnTreeEntrySubDefinition;
var riderMember : CSpawnTreeEntrySubDefinition;
horseMember = AddPartyMember(true);
riderMember = AddPartyMember(true);
horseMember.creatureDefinition = 'horse_def';
riderMember.creatureDefinition = 'rider_def';
horseMember.partyMemberId = 'horse';
riderMember.partyMemberId = 'rider';
partySpawnOrganizer = new CInstantMountPartySpawnOrganizer in th
is;
/* NOP */;
}
}
import struct CInstantMountPartySpawnOrganizer{
}
class CIdleAIEntryGenerator extends CSpawnTreeBaseEntryGenerator{
public editable var commonSpawnParams : SCreatureEntrySpawnerParams;
public editable var entries : array<SIdleAEntryGeneratorParam>;
public function GetFriendlyName() : String{
return "Idle AI Entries";
/* NOP */;
}
public function GenerateEntries(){
var i : Int32;
var size : Int32;
var entryNode : CCreatureEntry;
var idleInit : CSpawnTreeInitializerIdleAI;
var guardInit : CSpawnTreeInitializerGuardArea;
size = entries.Size();
i = 0;
while (i < size){
entryNode = new CCreatureEntry in this;
AddNodeToTree(entryNode, NULL);
entryNode.nodeName = nodeName;
AplyCreatureSpawnerParams(entryNode, commonSpawnParams);
AplyCreatureEntryParams(entryNode, entries[i].creatureEn
try);
idleInit = new CSpawnTreeInitializerIdleAI in entryNode;
AddInitializerToNode(idleInit, entryNode);
ApplyIdleInitializerCfg(idleInit, entries[i].idleTree);
guardInit = new CSpawnTreeInitializerGuardArea in entryN
ode;
AddInitializerToNode(guardInit, entryNode);
ApplyGuardAreaCfg(guardInit, entries[i].guartArea);
i += 1;
}
/* NOP */;
}
public function ApplyIdleInitializerCfg(init : CSpawnTreeInitializerIdle
AI, idleTree : CAIIdleTree){
init.ai.idleTree = idleTree;
/* NOP */;
}
public function ApplyGuardAreaCfg(init : CSpawnTreeInitializerGuardArea,

cfg : SGuardAreaEntryGeneratorNodeParam){
init.guardAreaTag = cfg.guardAreaTag;
init.pursuitAreaTag = cfg.pursuitAreaTag;
init.pursuitRange = cfg.pursuitRange;
/* NOP */;
}
}
import struct CWanderAndWorkEntryGenerator{
public editable var workCategories : array<SWanderWorkCetegoriesForCreat
ureDefinitionEntryGeneratorParam>;
public editable var commonSpawnParams : SCreatureEntrySpawnerParams;
public editable var commmonWaW : SWanderAndWorkEntryGeneratorCommon;
//NULL type for entries
public function GetFriendlyName() : String{
return "Wander And Work AI";
/* NOP */;
}
public function GenerateEntries(){
var i : Int32;
var size : Int32;
var entryNode : CCreatureEntry;
var wawInit : CSpawnTreeInitializerSmartWanderAndWorkAI;
size = entries.Size();
i = 0;
while (i < size){
entryNode = new CCreatureEntry in this;
AddNodeToTree(entryNode, NULL);
entryNode.nodeName = nodeName;
AplyCreatureSpawnerParams(entryNode, commonSpawnParams);
AplyCreatureEntryParams(entryNode, entries[i].creatureEn
try);
wawInit = new CSpawnTreeInitializerSmartWanderAndWorkAI
in entryNode;
AddInitializerToNode(wawInit, entryNode);
ApplyWaWInitializerCfg(wawInit, entries[i]);
i += 1;
}
/* NOP */;
}
public function ApplyIdleInitializerCfg(init : CSpawnTreeInitializerIdle
AI, idleTree : CAIIdleTree){
init.ai.idleTree = idleTree;
/* NOP */;
}
public function ApplyWaWInitializerCfg(init : CSpawnTreeInitializerSmart
WanderAndWorkAI, cfg : SWanderAndWorkEntryGeneratorParams){
var creature : CName;
var params : CAINpcActiveIdleParams;
var wanderTree : CAIWanderWithHistory;
var workTree : CAINpcWork;
var sel : CWanderActionPointSelector;
var cats : SWanderWorkCetegoriesForCreatureDefinitionEntryGenera
torParam;
var i : Int32;
var size : Int32;
var toAdd : SEncounterActionPointSelectorPair;
creature = cfg.creatureEntry.creatureDefinition.creatureDefiniti
on;
params = (CAINpcActiveIdle)init.ai.idleTree.params;

wanderTree = (CAIWanderWithHistory)params.wanderTree;
wanderTree.params = commmonWaW.wanderParams;
wanderTree.params.wanderPointsGroupTag = cfg.wander.wanderPoints
GroupTag;
workTree = params.workTree;
sel = (CWanderActionPointSelector)workTree.actionPointSelector;
cats = FindCategories(creature);
sel.apTags = cfg.work.apTag;
sel.areaTags = cfg.work.areaTags;
sel.apAreaTag = cfg.work.apAreaTag;
sel.delay = commmonWaW.delay;
workTree.params.spawnToWork = commmonWaW.spawnToWork;
size = cats.categories.Size();
i = 0;
while (i < size){
toAdd.chance = cats.categories[i].chance;
SetName(toAdd, cats.categories[i].category.category);
sel.categories.PushBack(toAdd);
i += 1;
}
/* NOP */;
}
public function FindCategories(creature : CName) : SWanderWorkCetegories
ForCreatureDefinitionEntryGeneratorParam{
var i : Int32;
var size : Int32;
size = workCategories.Size();
i = 0;
while (i < size){
if (workCategories[i].creatureDefinition.creatureDefinit
ion == creature){
return workCategories[i];
}
i += 1;
}
return workCategories[0];
/* NOP */;
}
}
class CWanderEntryGenerator extends CSpawnTreeBaseEntryGenerator{
public editable var entries : array<SWanderEntryGeneratorParam>;
public function GetFriendlyName() : String{
return "Wander Entries";
/* NOP */;
}
public function GenerateEntries(){
var i : Int32;
var size : Int32;
var entryNode : CCreatureEntry;
var initializer : CSpawnTreeInitializerSmartWanderAI;
size = entries.Size();
i = 0;
while (i < size){
entryNode = new CCreatureEntry in this;
AddNodeToTree(entryNode, NULL);
entryNode.nodeName = nodeName;
ApplyCreatureEntryCfg(entryNode, entries[i]);
initializer = new CSpawnTreeInitializerSmartWanderAI in
entryNode;

AddInitializerToNode(initializer, entryNode);
ApplyWanderInitializerCfg(initializer, entries[i]);
i += 1;
}
/* NOP */;
}
public function ApplyCreatureEntryCfg(cEntry : CCreatureEntry, cfg : SWa
nderEntryGeneratorParam){
cEntry.quantityMin = cfg.qualityMin;
cEntry.quantityMax = cfg.qualityMax;
cEntry.baseSpawner.tags = cfg.spawnWayPointTag;
cEntry.creatureDefinition = cfg.creatureDefinition.creatureDefin
ition;
/* NOP */;
}
public function ApplyWanderInitializerCfg(initializer : CSpawnTreeInitia
lizerSmartWanderAI, cfg : SWanderEntryGeneratorParam){
var tree : CAIWanderWithHistory;
tree = (CAIWanderWithHistory)initializer.ai.idleTree;
tree.params.wanderPointsGroupTag = cfg.wanderPointsGroupTag;
/* NOP */;
}
}
import struct CWorkEntryGenerator{
public editable var commonSpawnParams : SCreatureEntrySpawnerParams;
public editable var workCategories : array<SWorkCetegoriesForCreatureDef
initionEntryGeneratorParam>;
//NULL type for entries
public function GetFriendlyName() : String{
return "Work Smart AI Entries";
/* NOP */;
}
public function GenerateEntries(){
var i : Int32;
var size : Int32;
var entryNode : CCreatureEntry;
var initializer : CSpawnTreeInitializerSmartWorkAI;
var appInit : CSpawnTreeInitializerSetAppearance;
var tagInit : CSpawnTreeInitializerAddTag;
size = entries.Size();
i = 0;
while (i < size){
entryNode = new CCreatureEntry in this;
AddNodeToTree(entryNode, NULL);
entryNode.nodeName = nodeName;
AplyCreatureSpawnerParams(entryNode, commonSpawnParams);
AplyCreatureEntryParams(entryNode, entries[i].creatureEn
try);
initializer = new CSpawnTreeInitializerSmartWorkAI in en
tryNode;
AddInitializerToNode(initializer, entryNode);
ApplyWanderInitializerCfg(initializer, entries[i].work,
entries[i].creatureEntry.creatureDefinition.creatureDefinition);
if (entries[i].creatureEntry.appearanceName){
appInit = new CSpawnTreeInitializerSetAppearance
in entryNode;
AddInitializerToNode(appInit, entryNode);
appInit.appearanceName = entries[i].creatureEntr
y.appearanceName;

appInit.onlySetOnSpawnAppearance = true;
}
if (entries[i].creatureEntry.tagToAssign){
tagInit = new CSpawnTreeInitializerAddTag in ent
ryNode;
AddInitializerToNode(tagInit, entryNode);
tagInit.AddTag(entries[i].creatureEntry.tagToAss
ign);
tagInit.onlySetOnSpawnAppearance = true;
}
i += 1;
}
/* NOP */;
}
public function ApplyWanderInitializerCfg(initializer : CSpawnTreeInitia
lizerSmartWorkAI, cfg : SWorkSmartAIEntryGeneratorNodeParam, creature : CName){
var tree : CAINpcWorkIdle;
var sel : CSimpleActionPointSelector;
var cats : SWorkCetegoriesForCreatureDefinitionEntryGeneratorPar
am;
tree = (CAINpcWorkIdle)initializer.ai.idleTree;
sel = (CSimpleActionPointSelector)tree.actionPointSelector;
cats = FindCategories(creature);
sel.categories = cats.workCategories.categories;
sel.apTags = cfg.apTag;
sel.areaTags = cfg.areaTags;
sel.apAreaTag = cfg.apAreaTag;
sel.keepActionPointOnceSelected = cfg.keepActionPointOnceSelecte
d;
tree.actionPointMoveType = cfg.actionPointMoveType;
initializer.CreateSpawner(commonSpawnParams.visibility);
/* NOP */;
}
public function FindCategories(creature : CName) : SWorkCetegoriesForCre
atureDefinitionEntryGeneratorParam{
var i : Int32;
var size : Int32;
size = workCategories.Size();
i = 0;
while (i < size){
if (workCategories[i].creatureDefinition.creatureDefinit
ion == creature){
return workCategories[i];
}
i += 1;
}
return workCategories[0];
/* NOP */;
}
}
class W3AirDrainArea extends CGameplayEntity{
public editable var customDrainPoints : Float;
public editable var customDrainPercents : Float;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
var params : SCustomEffectParams;
actor = (CActor)activator.GetEntity();
if (!actor){

return true;
}
if (customDrainPoints > 0 || customDrainPercents > 0){
params.effectType = 71;
params.creator = this;
params.sourceName = GetName();
params.duration = -1;
params.effectValue.valueAdditive = customDrainPoints;
params.effectValue.valueMultiplicative = customDrainPerc
ents;
actor.AddEffectCustom(params);
} else {
actor.AddEffectDefault(71, this, GetName(), /* NOP */);
}
if ((CPlayer)actor){
theGame.GetGuiManager().GetHudEventController().RunEvent
_OxygenBarModule_SetInGasArea(true);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor){
actor.RemoveBuff(71, false, GetName());
}
if ((CPlayer)actor){
theGame.GetGuiManager().GetHudEventController().RunEvent
_OxygenBarModule_SetInGasArea(false);
FactsAdd("player_was_in_gas_area", 1, 5);
}
/* NOP */;
}
}
class W3GameZoneTrigger extends CEntity{
public var playerEntity : CPlayer;
public var zoneName : CName;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var tags : array<CName>;
var i : Int32;
playerEntity = (CPlayer)activator.GetEntity();
if (playerEntity){
tags = GetTags();
if (tags.Size() > 0){
i = 0;
while (i < tags.Size()){
zoneName = tags[i];
theGame.SetCurrentZone(zoneName);
break;
i += 1;
}
} else {
/* NOP */;
}
}
/* NOP */;
}

public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo


mponent) : Bool{
zoneName = 'None';
/* NOP */;
}
}
class W3BirdAttackTrigger extends CEntity{
public var lair : CFlyingSwarmMasterLair;
public editable var affectedEntityTag : CName;
public editable var attackRequestInterval : Float;
public editable var affectBirdsInRange : Float;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor && IsNameValid(affectedEntityTag) && actor.HasTag(affe
ctedEntityTag)){
if (GetLairEntity()){
lair.RequestGroupStateChange('attackPlayer', /*
NOP */);
AddTimer('RequestAttack', attackRequestInterval,
true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor && IsNameValid(affectedEntityTag) && actor.HasTag(affe
ctedEntityTag)){
if (GetLairEntity()){
RemoveTimer('RequestAttack', /* NOP */);
}
}
/* NOP */;
}
public function GetLairEntity() : Bool{
var entities : array<CGameplayEntity>;
var i : Int32;
var lairLocal : CFlyingSwarmMasterLair;
FindGameplayEntitiesInRange(entities, this, affectBirdsInRange,
100000, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (entities.Size() > i){
lairLocal = (CFlyingSwarmMasterLair)entities[i];
if (lairLocal){
lair = lairLocal;
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public timer function RequestAttack(optional t : Float, optional id : In
t32){
lair.RequestGroupStateChange('attackPlayer', /* NOP */);

/* NOP */;
}
}
class CFloePiece extends CScriptedDestroyableComponent{
public var totalTime : Float;
public var currPosition : Vector;
public final function IdleTick(time : Float){
totalTime = 0;
/* NOP */;
}
public final function PreDestroyTick(time : Float){
totalTime += time;
currPosition = GetLocalPosition();
SetPosition(Vector(currPosition.X, currPosition.Y, SinF(10 * tot
alTime) / 20));
if (totalTime > GetDestroyTimeDurationValue()){
m_state = 2;
totalTime = 0;
}
/* NOP */;
}
public final function DestroyTick(time : Float){
totalTime += time;
m_state = 3;
/* NOP */;
}
public final function PostDestroyTick(time : Float){
}
}
class W3ConditionalTrigger extends CEntity{
public editable inlined var conditionClass : W3Condition;
public editable inlined var effectorClasses : array<IPerformableAction>;
public editable var affectsPlayer : Bool;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
if (activator.GetEntity() == thePlayer && !affectsPlayer){
return false;
}
actor = (CActor)activator.GetEntity();
if (conditionClass.Test(actor)){
TriggerPerformableEventArgNode(effectorClasses, this, ac
tor);
}
/* NOP */;
}
}
class W3GenericSceneArea extends CGameplayEntity{
public editable var scenes : array<genericSceneDefinition>;
public editable var forbiddenFact : String;
public editable var requiredFact : String;
public editable var npcSearchRange : Float;
public editable var ignoreReplacers : Bool;
public editable var includeEnemyNPCs : Bool;
public editable var includeQuestNPCs : Bool;
public var firstPlaySceneDelay : Float;
public var currentSceneDelay : Float;

public var sceneDelay : Float;


public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (activator.GetEntity() != thePlayer){
return false;
}
RestartSceneTimer(firstPlaySceneDelay);
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() != thePlayer){
return false;
}
RemoveTimer('PlaySceneTimer', /* NOP */);
/* NOP */;
}
private function SearchForSceneSpeakers() : array<CNewNPC>{
var entities : array<CGameplayEntity>;
var returnNPCs : array<CNewNPC>;
var targetNPC : CNewNPC;
var i : Int32;
FindGameplayEntitiesInRange(entities, thePlayer, npcSearchRange,
100000, 'None', 1 + 2, /* NOP */, /* NOP */);
i = 0;
while (i < entities.Size()){
targetNPC = (CNewNPC)entities[i];
if (targetNPC){
if (GetIsNPCGroupValid(targetNPC) && targetNPC.I
sAlive() && !targetNPC.IsInDanger() && !targetNPC.IsInCombat() && !GetIsTargetAs
leep(targetNPC) && !targetNPC.IsSpeaking(/* NOP */)){
returnNPCs.PushBack(targetNPC);
}
}
i += 1;
}
return returnNPCs;
/* NOP */;
}
private function GetIsNPCGroupValid(target : CNewNPC) : Bool{
var npcGroup : ENPCGroupType;
npcGroup = target.GetNPCType();
switch(npcGroup){
case 0:
if (includeEnemyNPCs){
return true;
} else {
return false;
}
break;
case 2:
if (includeQuestNPCs){
return true;
} else {
return false;
}
break;
}
return true;
/* NOP */;

}
private function GetIsTargetAsleep(target : CNewNPC) : Bool{
var atWork : Bool;
var atWorkConscious : Bool;
atWork = target.IsAtWork();
atWorkConscious = target.IsConsciousAtWork();
if (atWork == false){
return false;
} else if (atWorkConscious){
return false;
} else {
return true;
}
/* NOP */;
}
private function GetValidScenes(npcVoiceTag : CName) : array<genericScen
eDefinition>{
var i : Int32;
var matchingScenes : array<genericSceneDefinition>;
i = 0;
while (i < scenes.Size()){
if (scenes[i].voicesTag == npcVoiceTag){
matchingScenes.PushBack(scenes[i]);
}
i += 1;
}
return matchingScenes;
/* NOP */;
}
public timer function PlaySceneTimer(optional time : Float, optional id
: Int32){
var isGeralt : Bool;
if (CheckAreaValidity()){
if (!theGame.IsCurrentlyPlayingNonGameplayScene()){
if (FactsQuerySum(forbiddenFact) == 0 && require
dFact == "" || FactsQuerySum(requiredFact) >= 1){
if (ignoreReplacers == true){
isGeralt = (W3PlayerWitcher)theP
layer;
if (isGeralt){
if (thePlayer.IsAlive())
{
if (TryToPlaySce
ne()){
RestartS
ceneTimer(sceneDelay);
return;
}
}
}
} else if (TryToPlayScene()){
RestartSceneTimer(sceneDelay);
return;
}
}
}
RestartSceneTimer(firstPlaySceneDelay);
} else {
RemoveTimer('PlaySceneTimer', /* NOP */);
}

/* NOP */;
}
private function CheckAreaValidity() : Bool{
var comp : CTriggerAreaComponent;
comp = (CTriggerAreaComponent)GetComponentByClassName('CTriggerA
reaComponent');
if (comp){
if (comp.TestEntityOverlap(thePlayer)){
return true;
} else {
return false;
}
} else {
return false;
}
/* NOP */;
}
public function RestartSceneTimer(delay : Float){
if (currentSceneDelay != delay && delay != 0){
currentSceneDelay = delay;
}
AddTimer('PlaySceneTimer', currentSceneDelay, false, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function TryToPlayScene() : Bool{
var speakers : array<CNewNPC>;
var selectedSpeaker : CNewNPC;
var scenes : array<genericSceneDefinition>;
var selectedScene : genericSceneDefinition;
var i : Int32;
speakers = SearchForSceneSpeakers();
if (speakers.Size() == 0){
return false;
}
i = 0;
while (i < speakers.Size()){
selectedSpeaker = speakers[i];
scenes = GetValidScenes(selectedSpeaker.GetVoicetag());
if (scenes.Size() >= 1){
selectedScene = scenes[RandRange(scenes.Size() 1, /* NOP */)];
theGame.GetStorySceneSystem().PlayScene(selected
Scene.storyScene, selectedScene.input);
return true;
}
i += 1;
}
return false;
/* NOP */;
}
}
class W3AirDrainEntity extends CGameplayEntity{
public editable var customDrainPoints : Float;
public editable var customDrainPercents : Float;
public editable var factOnActivated : String;
public editable var factOnDeactivated : String;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{

var actor : CActor;


var params : SCustomEffectParams;
actor = (CActor)activator.GetEntity();
if (customDrainPoints > 0 || customDrainPercents > 0){
params.effectType = 71;
params.creator = this;
params.sourceName = GetName();
params.duration = -1;
params.effectValue.valueAdditive = customDrainPoints;
params.effectValue.valueMultiplicative = customDrainPerc
ents;
actor.AddEffectCustom(params);
} else {
actor.AddEffectDefault(71, this, GetName(), /* NOP */);
}
if ((CPlayer)actor){
theGame.GetGuiManager().GetHudEventController().RunEvent
_OxygenBarModule_SetInGasArea(true);
if (factOnActivated != ""){
FactsAdd(factOnActivated, 1, /* NOP */);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor){
actor.RemoveBuff(71, false, GetName());
}
if ((CPlayer)actor){
theGame.GetGuiManager().GetHudEventController().RunEvent
_OxygenBarModule_SetInGasArea(false);
FactsAdd("player_was_in_gas_area", 1, 5);
if (factOnDeactivated != ""){
FactsAdd(factOnDeactivated, 1, /* NOP */);
}
}
/* NOP */;
}
}
class W3AnimationInteractionEntity extends CGameplayEntity{
public editable var animationForAllInteractions : Bool;
public editable var interactionName : String;
public editable var holsterWeaponAtTheBeginning : Bool;
public editable var interactionAnim : EPlayerExplorationAction;
public editable var slotAnimName : CName;
public editable var interactionAnimTime : Float;
public editable var desiredPlayerToEntityDistance : Float;
public editable var matchPlayerHeadingWithHeadingOfTheEntity : Bool;
public editable var attachThisObjectOnAnimEvent : Bool;
public editable var attachSlotName : CName;
public editable var attachAnimName : CName;
public editable var detachAnimName : CName;
protected var isPlayingInteractionAnim : Bool;
private var objectAttached : Bool;
private var objectCachedPos : Vector;
private var objectCachedRot : EulerAngles;

public function OnDetaching() : Bool{


if (isPlayingInteractionAnim){
OnPlayerActionEnd();
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator == thePlayer && thePlayer.IsActionAllowed(12) && t
hePlayer.CanPerformPlayerAction(/* NOP */)){
if (animationForAllInteractions == true || actionName ==
interactionName){
PlayInteractionAnimation();
}
}
/* NOP */;
}
public function PlayInteractionAnimation(){
if (interactionAnim == 1 && !IsNameValid(slotAnimName)){
return;
}
if (interactionAnim != 0){
if (attachThisObjectOnAnimEvent){
thePlayer.AddAnimEventChildCallback(this, attach
AnimName, 'OnAnimEvent_Custom');
thePlayer.AddAnimEventChildCallback(this, detach
AnimName, 'OnAnimEvent_Custom');
}
thePlayer.RegisterForPlayerAction(this, false);
if (ShouldBlockGameplayActionsOnInteraction()){
BlockGameplayActions(true);
}
if (!GetToPointAndStartAction()){
OnPlayerActionEnd();
}
isPlayingInteractionAnim = true;
if (interactionAnim == 1){
return;
}
if (interactionAnimTime < 1.000000){
interactionAnimTime = 1.000000;
}
AddTimer('TimerDeactivateAnimation', interactionAnimTime
, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function BlockGameplayActions(lock : Bool){
var exceptions : array<EInputActionBlock>;
exceptions.PushBack(19);
if (lock && holsterWeaponAtTheBeginning){
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
}
thePlayer.BlockAllActions('W3AnimationInteractionEntity', lock,
exceptions, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function ShouldBlockGameplayActionsOnInteraction() : Bool{
return true;
/* NOP */;

}
public function GetToPointAndStartAction() : Bool{
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = thePlayer.GetMovingAgentComponent().GetMoveme
ntAdjustor();
ticket = movementAdjustor.CreateNewRequest('InteractionEntity');
movementAdjustor.AdjustmentDuration(ticket, 0.500000);
if (matchPlayerHeadingWithHeadingOfTheEntity){
movementAdjustor.RotateTowards(ticket, this, /* NOP */);
}
if (desiredPlayerToEntityDistance >= 0){
movementAdjustor.SlideTowards(ticket, this, desiredPlaye
rToEntityDistance, /* NOP */);
}
return thePlayer.PlayerStartAction(interactionAnim, slotAnimName
);
/* NOP */;
}
private function AttachObject(){
if (objectAttached){
return;
}
objectCachedPos = GetWorldPosition();
objectCachedRot = GetWorldRotation();
CreateAttachment(thePlayer, attachSlotName, /* NOP */, /* NOP */
);
objectAttached = true;
/* NOP */;
}
private function DetachObject(){
if (!objectAttached){
return;
}
BreakAttachment();
TeleportWithRotation(objectCachedPos, objectCachedRot);
objectAttached = false;
/* NOP */;
}
public function OnPlayerActionEnd() : Bool{
isPlayingInteractionAnim = false;
thePlayer.UnregisterForPlayerAction(this, false);
thePlayer.RemoveAnimEventChildCallback(this, attachAnimName);
thePlayer.RemoveAnimEventChildCallback(this, detachAnimName);
if (ShouldBlockGameplayActionsOnInteraction()){
BlockGameplayActions(false);
}
DetachObject();
/* NOP */;
}
public function OnAnimEvent_Custom(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == attachAnimName && attachThisObjectOnAnimEve
nt){
AttachObject();
}
if (animEventName == detachAnimName){
DetachObject();
}
/* NOP */;

}
public timer function TimerDeactivateAnimation(optional td : Float, opti
onal id : Int32){
thePlayer.PlayerStopAction(interactionAnim);
/* NOP */;
}
}
statemachine class W3BeehiveStandingEntity extends W3AnimatedContainer{
public editable var damageVal : SAbilityAttributeValue;
private var actorsInRange : array<CActor>;
private var wasInteracted : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
GotoState('Idle', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
if (wasInteracted){
GotoState('Agitated', /* NOP */, /* NOP */);
}
super.OnItemGiven(data);
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
wasInteracted = true;
super.OnInteraction(actionName, activator);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor && !actorsInRange.Contains(actor)){
actorsInRange.PushBack(actor);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
actor = (CActor)activator.GetEntity();
if (actor){
actorsInRange.Remove(actor);
}
/* NOP */;
}
public function ClearActorsInRange(){
actorsInRange.Clear();
/* NOP */;
}
public function GetActorsInArea() : array<CActor>{
return actorsInRange;
/* NOP */;
}
}
class CMagicBombEntity extends CGameplayEntity{
public editable var damageRadius : Float;

public
public
public
public
public
public
public

editable var damageVal : Float;


var settlingTime : Float;
var entitiesInRange : array<CGameplayEntity>;
var i : Int32;
var damage : W3DamageAction;
var victim : CActor;
function OnSpawned(spawnData : SEntitySpawnData) : Bool{
Init();
/* NOP */;

}
public function Init(){
PlayEffect('arcane_circle', /* NOP */);
AddTimer('Explode', settlingTime, /* NOP */, /* NOP */, /* NOP *
/, true, /* NOP */);
/* NOP */;
}
public timer function Explode(optional td : Float, optional id : Int32){
StopAllEffects();
Explosion();
/* NOP */;
}
public function Explosion(){
PlayEffect('explosion', /* NOP */);
GCameraShake(0.500000, true, GetWorldPosition(), 15.000000, /* N
OP */, /* NOP */, /* NOP */);
entitiesInRange.Clear();
FindGameplayEntitiesInRange(entitiesInRange, this, damageRadius,
99, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < entitiesInRange.Size()){
victim = (CActor)entitiesInRange[i];
if (victim){
victim.AddEffectDefault(13, this, GetName(), /*
NOP */);
}
damage = new W3DamageAction in this;
damage.Initialize(this, entitiesInRange[i], this, GetNam
e(), 0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */
);
damage.AddDamage(theGame.params.DAMAGE_NAME_ELEMENTAL, d
amageVal);
theGame.damageMgr.ProcessAction(damage);
delete damage;
i += 1;
}
/* NOP */;
}
}
class CPhilippaAttractorTrigger extends CGameplayEntity{
public editable var actorTagToSendInfo : CName;
public editable var triggeredByPlayer : Bool;
public editable var triggeredByBolts : Bool;
public editable var triggeredByBombs : Bool;
public var actor : CActor;
public var lastActivation : Float;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (lastActivation + 1.000000 > theGame.GetEngineTimeAsSeconds()
){

return false;
}
if (activator.GetEntity() == thePlayer && triggeredByPlayer){
actor = theGame.GetActorByTag(actorTagToSendInfo);
actor.SignalGameplayEvent('shootAtPlayer');
lastActivation = theGame.GetEngineTimeAsSeconds();
} else if ((W3BoltProjectile)activator.GetEntity() && triggeredB
yBolts){
actor = theGame.GetActorByTag(actorTagToSendInfo);
actor.SignalGameplayEventParamObject('shootAtPoint', thi
s);
lastActivation = theGame.GetEngineTimeAsSeconds();
} else if ((W3Petard)activator.GetEntity() && triggeredByBombs){
actor = theGame.GetActorByTag(actorTagToSendInfo);
actor.SignalGameplayEventParamObject('shootAtPoint', thi
s);
lastActivation = theGame.GetEngineTimeAsSeconds();
}
/* NOP */;
}
}
class CMagicMineEntity extends CInteractiveEntity{
public editable var tellTime : Float;
public editable var damageVal : Float;
public editable var boatDamageVal : Float;
public editable var damageRadius : Float;
public var mineTrigger : CTriggerAreaComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
mineTrigger = (CTriggerAreaComponent)GetComponent("mineTrigger")
;
Enable(bIsEnabled);
/* NOP */;
}
public function Enable(flag : Bool){
mineTrigger.SetEnabled(flag);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (area == mineTrigger && activator.GetEntity() == thePlayer ||
(CBoatComponent)activator){
Countdown();
}
/* NOP */;
}
public function Countdown(){
PlayEffect('tell', /* NOP */);
AddTimer('Explode', tellTime, /* NOP */, /* NOP */, /* NOP */, t
rue, /* NOP */);
/* NOP */;
}
public timer function Explode(optional td : Float, optional id : Int32){
StopAllEffects();
PlayEffect('explode', /* NOP */);
DealDamage();
GCameraShake(1.500000, true, thePlayer.GetWorldPosition(), 30.00
0000, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}

public function DealDamage(){


var entitiesInRange : array<CGameplayEntity>;
var victim : CActor;
var i : Int32;
var damage : W3DamageAction;
var destructionComp : CBoatDestructionComponent;
entitiesInRange.Clear();
FindGameplayEntitiesInRange(entitiesInRange, this, damageRadius,
99, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < entitiesInRange.Size()){
if ((CActor)entitiesInRange[i]){
victim = (CActor)entitiesInRange[i];
victim.AddEffectDefault(10, this, GetName(), /*
NOP */);
damage = new W3DamageAction in this;
damage.Initialize(this, entitiesInRange[i], this
, GetName(), 0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /
* NOP */);
damage.AddDamage(theGame.params.DAMAGE_NAME_PHYS
ICAL, damageVal);
theGame.damageMgr.ProcessAction(damage);
delete damage;
} else if ((W3Boat)entitiesInRange[i]){
destructionComp = (CBoatDestructionComponent)ent
itiesInRange[i].GetComponentByClassName('CBoatDestructionComponent');
destructionComp.DealDmgToNearestVolume(boatDamag
eVal, GetWorldPosition());
}
i += 1;
}
/* NOP */;
}
}
import statemachine struct CNewNPC{
public editable var isImmortal : Bool;
public editable var isInvulnerable : Bool;
public editable var willBeUnconscious : Bool;
public editable var minUnconsciousTime : Float;
public editable var unstoppable : Bool;
public editable var RemainsTags : array<CName>;
public editable var level : Int32;
public editable var levelFakeAddon : Int32;
public editable var isMiniBossLevel : Bool;
public editable var suppressBroadcastingReactions : Bool;
public editable saved var dontUseReactionOneLiners : Bool;
public editable saved var disableConstrainLookat : Bool;
public editable var isMonsterType_Group : Bool;
public editable var useSoundValue : Bool;
public editable var soundValue : Int32;
public editable var clearInvOnDeath : Bool;
public editable var noAdaptiveBalance : Bool;
public editable var grantNoExperienceAfterKill : Bool;
private autobind horseComponent : W3HorseComponent = single;
private var isHorse : Bool;
private saved var canFlee : Bool;
private var isFallingFromHorse : Bool;
private var immortalityInitialized : Bool;
private var canBeFollowed : Bool;

private var bAgony : Bool;


private var bFinisher : Bool;
private var bPlayDeathAnim : Bool;
private var bAgonyDisabled : Bool;
private var bFinisherInterrupted : Bool;
private var bIsInHitAnim : Bool;
private var threatLevel : Int32;
private var counterWindowStartTime : EngineTime;
private var bIsCountering : Bool;
private var allowBehGraphChange : Bool;
private var aardedFlight : Bool;
public var lastMeleeHitTime : EngineTime;
private saved var preferedCombatStyle : EBehaviorGraph;
private var previousStance : ENpcStance;
private var regularStance : ENpcStance;
private var currentFightStage : ENPCFightStage;
private var currentState : CName;
private var behaviorGraphEventListened : array<CName>;
private var isTemporaryOffGround : Bool;
private var isUnderwater : Bool;
private var isTranslationScaled : Bool;
private var tauntedToAttackTimeStamp : Float;
private var hitCounter : Int32;
private var totalHitCounter : Int32;
public var customHits : Bool;
public var isTeleporting : Bool;
public var itemToEquip : SItemUniqueId;
private saved var wasBleedingBurningPoisoned : Bool;
public var wasInTalkInteraction : Bool;
private var wasInCutscene : Bool;
public var shieldDebris : CItemEntity;
public var lastMealTime : Float;
public var packName : CName;
public var isPackLeader : Bool;
private var mac : CMovingPhysicalAgentComponent;
private saved var isTalkDisabled : Bool;
private var isTalkDisabledTemporary : Bool;
public var combatStorage : CBaseAICombatStorage;
private const var SHIELD_BURN_TIMER : Float;
private var beingHitByIgni : Bool;
private var firstIgniTick : Float;
private var lastIgniTick : Float;
public var isRagdollOn : Bool;
public var m_storedInteractionPri : EInteractionPriority;
//NULL type for npcGroupType
import public final function IsInInterior() : Bool;
import public final function IsInDanger() : Bool;
import public final function IsSeeingNonFriendlyNPC() : Bool;
import public final function IsAIEnabled() : Bool;
import public final function FindActionPoint(apID : SActionPointId, cate
gory : CName);
import public final function GetDefaultDespawnPoint(spawnPoint : Vector)
: Bool;
import public final function NoticeActor(actor : CActor);
import public final function ForgetActor(actor : CActor);
import public final function ForgetAllActors();
import public final function GetNoticedObject(index : Int32) : CActor;
import public final function GetActiveActionPoint() : SActionPointId;
import public final function PlayDialog(forceSpawnedActors : Bool) : Boo
l;

import public final function GetPerceptionRange() : Float;


import public final function GetReactionScript(index : Int32) : CReactio
nScript;
import public final function IfCanSeePlayer() : Bool;
import public final function GetGuardArea() : CAreaComponent;
import public final function SetGuardArea(areaComponent : CAreaComponent
);
import public final function IsConsciousAtWork() : Bool;
import public final function GetCurrentJTType() : Int32;
import public final function IsSittingAtWork() : Bool;
import public final function IsAtWork() : Bool;
import public final function IsPlayingChatScene() : Bool;
import public final function CanUseChatInCurrentAP() : Bool;
import public final function NoticeActorInGuardArea(actor : CActor);
import public final function IsInLeaveAction() : Bool;
public function OnGameDifficultyChanged(previousDifficulty : Int32, curr
entDifficulty : Int32) : Bool{
if (HasAbility('difficulty_CommonEasy')){
RemoveAbility('difficulty_CommonEasy');
}
if (HasAbility('difficulty_CommonMedium')){
RemoveAbility('difficulty_CommonMedium');
}
if (HasAbility('difficulty_CommonHard')){
RemoveAbility('difficulty_CommonHard');
}
if (HasAbility('difficulty_CommonHardcore')){
RemoveAbility('difficulty_CommonHardcore');
}
switch(theGame.GetSpawnDifficultyMode()){
case 1:
AddAbility('difficulty_CommonEasy', /* NOP */);
break;
case 2:
AddAbility('difficulty_CommonMedium', /* NOP */);
break;
case 3:
AddAbility('difficulty_CommonHard', /* NOP */);
break;
case 4:
AddAbility('difficulty_CommonHardcore', /* NOP */);
break;
}
AddTimer('AddLevelBonuses', 0.100000, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function ResetTalkInteractionFlag(optional td : Float, opti
onal id : Int32){
if (!IsSpeaking(/* NOP */)){
wasInTalkInteraction = false;
RemoveTimer('ResetTalkInteractionFlag', /* NOP */);
}
/* NOP */;
}
protected function OnCombatModeSet(toggle : Bool){
super.OnCombatModeSet(toggle);
if (toggle){
SetCombatStartTime();
SetCombatPartStartTime();

super.RecalcLevel();
} else {
ResetCombatStartTime();
ResetCombatPartStartTime();
}
/* NOP */;
}
public function SetImmortalityInitialized(){
immortalityInitialized = true;
/* NOP */;
}
public function SetNPCType(type : ENPCGroupType){
npcGroupType = type;
/* NOP */;
}
public function GetNPCType() : ENPCGroupType{
return npcGroupType;
/* NOP */;
}
public function SetCanBeFollowed(val : Bool){
canBeFollowed = val;
/* NOP */;
}
public function CanBeFollowed() : Bool{
return canBeFollowed;
/* NOP */;
}
public function OnPreAttackEvent(animEventName : CName, animEventType :
EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimI
nfo) : Bool{
var witcher : W3PlayerWitcher;
var levelDiff : Int32;
super.OnPreAttackEvent(animEventName, animEventType, data, animI
nfo);
if (animEventType == 1){
witcher = GetWitcherPlayer();
if (GetTarget() == witcher){
levelDiff = super.GetLevel() - witcher.GetLevel(
);
if (levelDiff < theGame.params.LEVEL_DIFF_DEADLY
){
SetDodgeFeedback(true);
}
}
if (IsCountering()){
if (GetTarget() == witcher && thePlayer.IsAction
Allowed(23) || thePlayer.IsActionAllowed(11) && witcher.GetStat(3, /* NOP */) >
0 && witcher.CanUseSkill(73)){
witcher.StartFrenzy();
}
}
} else if (animEventType == 3){
witcher = GetWitcherPlayer();
if (GetTarget() == witcher){
SetDodgeFeedback(false);
}
}
/* NOP */;
}
public function SetDodgeFeedback(flag : Bool){

if (flag){
thePlayer.SetDodgeFeedbackTarget(this);
} else {
thePlayer.SetDodgeFeedbackTarget(NULL);
}
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
super.OnBlockingSceneEnded(output);
wasInCutscene = true;
/* NOP */;
}
public function WasInCutscene() : Bool{
return wasInCutscene;
/* NOP */;
}
public function IsVIP() : Bool{
var tags : array<CName>;
var i : Int32;
tags = GetTags();
i = 0;
while (i < tags.Size()){
if (tags[i] == 'vip'){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var lvlDiff : Int32;
var playerLevel : Int32;
var heading : Float;
var remainingDuration : Float;
var oldLevel : Int32;
super.OnSpawned(spawnData);
SetThreatLevel();
GotoStateAuto();
isTalkDisabledTemporary = false;
if (!spawnData.restored && !immortalityInitialized){
SetCanPlayHitAnim(true);
if (isInvulnerable){
SetImmortalityMode(2, 1, /* NOP */);
} else if (isImmortal){
SetImmortalityMode(1, 1, /* NOP */);
} else if (willBeUnconscious){
SetImmortalityMode(3, 1, /* NOP */);
SignalGameplayEventParamFloat('ChangeUnconscious
Duration', minUnconsciousTime);
} else if (npcGroupType == 1 || npcGroupType == 3 || npc
GroupType == 2){
SetImmortalityMode(3, 1, /* NOP */);
}
}
if (npcGroupType == 3){
SetOriginalInteractionPriority(5);
RestoreOriginalInteractionPriority();
} else if (npcGroupType == 2){
SetOriginalInteractionPriority(-2);

RestoreOriginalInteractionPriority();
}
mac = (CMovingPhysicalAgentComponent)GetMovingAgentComponent();
if (mac && IsFlying()){
mac.SetAnimatedMovement(true);
}
RegisterCollisionEventsListener();
if (focusModeSoundEffectType == 3){
SetFocusModeSoundEffectType(0);
}
heading = AngleNormalize(GetHeading());
SetBehaviorVariable('requestedFacingDirection', heading, /* NOP
*/);
if (disableConstrainLookat){
SetBehaviorVariable('disableConstraintLookat', 1.000000,
/* NOP */);
}
SoundSwitch("vo_3d", 'vo_3d_long', 'head', /* NOP */);
AddAnimEventCallback('EquipItemL', 'OnAnimEvent_EquipItemL');
AddAnimEventCallback('HideItemL', 'OnAnimEvent_HideItemL');
AddAnimEventCallback('HideWeapons', 'OnAnimEvent_HideWeapons');
AddAnimEventCallback('TemporaryOffGround', 'OnAnimEvent_Temporar
yOffGround');
AddAnimEventCallback('OwlSwitchOpen', 'OnAnimEvent_OwlSwitchOpen
');
AddAnimEventCallback('OwlSwitchClose', 'OnAnimEvent_OwlSwitchClo
se');
AddAnimEventCallback('Goose01OpenWings', 'OnAnimEvent_Goose01Ope
nWings');
AddAnimEventCallback('Goose01CloseWings', 'OnAnimEvent_Goose01Cl
oseWings');
AddAnimEventCallback('Goose02OpenWings', 'OnAnimEvent_Goose02Ope
nWings');
AddAnimEventCallback('Goose02CloseWings', 'OnAnimEvent_Goose02Cl
oseWings');
AddAnimEventCallback('NullifyBurning', 'OnAnimEvent_NullifyBurni
ng');
AddAnimEventCallback('setVisible', 'OnAnimEvent_setVisible');
AddAnimEventCallback('extensionWalk', 'OnAnimEvent_extensionWalk
');
AddAnimEventCallback('weaponSoundType', 'OnAnimEvent_weaponSound
Type');
if (HasAbility('_canBeFollower') && theGame.GetDifficultyMode()
!= 4){
RemoveAbility('_canBeFollower');
}
if (!HasAbility('NoAdaptBalance') && level > 1){
if (theGame.GetDifficultyMode() == 1 || theGame.GetDiffi
cultyMode() == 2 && playerLevel == 1 && npcGroupType != 3 && !HasAbility('Prolog
Modifier')){
AddAbility('PrologModifier', /* NOP */);
}
if (FactsQuerySum("NewGamePlus") > 0){
level += theGame.params.GetNewGamePlusLevel();
}
}
/* NOP */;
}
protected function SetAbilityManager(){
if (npcGroupType != 1){

abilityManager = new W3NonPlayerAbilityManager in this;


}
/* NOP */;
}
protected function SetEffectManager(){
if (npcGroupType != 1){
super.SetEffectManager();
}
/* NOP */;
}
public function SetLevel(_level : Int32){
level = _level;
AddTimer('AddLevelBonuses', 0.100000, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
/* NOP */;
}
private function SetThreatLevel(){
var temp : Float;
temp = CalculateAttributeValue(GetAttributeValue('threat_level',
/* NOP */, /* NOP */), /* NOP */);
if (temp >= 0.000000){
threatLevel = temp;
} else {
LogAssert(false, "No threat_level attribute set. Threat
level set to 0");
threatLevel = 0;
}
/* NOP */;
}
public function ChangeThreatLevel(newValue : Int32){
threatLevel = newValue;
/* NOP */;
}
public function GetHorseUser() : CActor{
if (horseComponent){
return horseComponent.GetCurrentUser();
}
return NULL;
/* NOP */;
}
public function GetPreferedCombatStyle() : EBehaviorGraph{
return preferedCombatStyle;
/* NOP */;
}
public function SetPreferedCombatStyle(_preferedCombatStyle : EBehaviorG
raph){
preferedCombatStyle = _preferedCombatStyle;
/* NOP */;
}
public timer function WeatherBonusCheck(optional dt : Float, optional id
: Int32){
var curGameTime : GameTime;
var dayPart : EDayPart;
var bonusName : CName;
var curEffect : CBaseGameplayEffect;
var moonState : EMoonState;
var weather : EWeatherEffect;
var params : SCustomEffectParams;
if (!IsAlive()){
return;

}
moonState = GetCurMoonState();
curGameTime = GameTimeCreate(/* NOP */, /* NOP */, /* NOP */, /*
NOP */);
dayPart = GetDayPart(curGameTime);
weather = GetCurWeather();
bonusName = (W3NonPlayerAbilityManager)abilityManager.GetWeather
Bonus(dayPart, weather, moonState);
curEffect = GetBuff(51, /* NOP */);
if (curEffect){
if (curEffect.GetAbilityName() == bonusName){
return;
} else {
RemoveBuff(51, /* NOP */, /* NOP */);
}
}
if (bonusName != 'None'){
params.effectType = 51;
params.creator = this;
params.sourceName = "WeatherBonus";
params.customAbilityName = bonusName;
AddEffectCustom(params);
}
/* NOP */;
}
public function IsFlying() : Bool{
var result : Bool;
result = GetCurrentStance() == 5;
return result;
/* NOP */;
}
public function IsRanged() : Bool{
var weapon : SItemUniqueId;
weapon = GetInventory().GetItemFromSlot('l_weapon');
return GetInventory().GetItemCategory(weapon) == 'bow';
/* NOP */;
}
public function IsVisuallyOffGround() : Bool{
if (isTemporaryOffGround){
return true;
}
if (IsFlying()){
return true;
}
return false;
/* NOP */;
}
public function SetIsHorse(){
if (horseComponent){
isHorse = true;
}
/* NOP */;
}
public function IsHorse() : Bool{
return isHorse;
/* NOP */;
}
public function GetHorseComponent() : W3HorseComponent{
if (isHorse){
return horseComponent;

} else {
return NULL;
}
/* NOP */;
}
public function HideHorseAfter(time : Float){
if (!isHorse){
return;
}
SetVisibility(false);
SetGameplayVisibility(false);
AddTimer('HideHorse', time, /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
/* NOP */;
}
private timer function HideHorse(optional delta : Float, optional id : I
nt32){
Teleport(thePlayer.GetWorldPosition() + thePlayer.GetHeadingVect
or() * 1000.000000);
SetVisibility(true);
SetGameplayVisibility(true);
/* NOP */;
}
public function KillHorseAfter(time : Float){
if (!isHorse){
return;
}
AddTimer('KillHorse', time, /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
/* NOP */;
}
private timer function KillHorse(optional delta : Float, optional id : I
nt32){
SetKinematic(false);
Kill(true, /* NOP */, /* NOP */);
SetAlive(false);
GetComponentByClassName('CInteractionComponent').SetEnabled(fals
e);
PlayEffect('hit_ground', /* NOP */);
/* NOP */;
}
public timer function RemoveAxiiFromHorse(optional delta : Float, option
al id : Int32){
RemoveAbility('HorseAxiiBuff');
/* NOP */;
}
public function ToggleCanFlee(val : Bool){
canFlee = val;
/* NOP */;
}
public function GetCanFlee() : Bool{
return canFlee;
/* NOP */;
}
public function SetIsFallingFromHorse(val : Bool){
if (val){
AddBuffImmunity(6, 'SetIsFallingFromHorse', true);
isFallingFromHorse = true;
} else {
RemoveBuffImmunity(6, 'SetIsFallingFromHorse');

isFallingFromHorse = false;
}
/* NOP */;
}
public function GetIsFallingFromHorse() : Bool{
return isFallingFromHorse;
/* NOP */;
}
public function SetCounterWindowStartTime(time : EngineTime){
counterWindowStartTime = time;
/* NOP */;
}
public function GetCounterWindowStartTime() : EngineTime{
return counterWindowStartTime;
/* NOP */;
}
public function GetThreatLevel() : Int32{
return threatLevel;
/* NOP */;
}
public function GetSoundValue() : Int32{
return soundValue;
/* NOP */;
}
public function WasTauntedToAttack(){
tauntedToAttackTimeStamp = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public timer function MaintainSpeedTimer(optional d : Float, optional id
: Int32){
SetBehaviorVariable('Editor_MovementSpeed', 0, /* NOP */);
/* NOP */;
}
public timer function MaintainFlySpeedTimer(optional d : Float, optional
id : Int32){
SetBehaviorVariable('Editor_FlySpeed', 0, /* NOP */);
/* NOP */;
}
public function SetIsInHitAnim(toggle : Bool){
bIsInHitAnim = toggle;
if (!toggle){
SignalGameplayEvent('WasHit');
}
/* NOP */;
}
public function IsInHitAnim() : Bool{
return bIsInHitAnim;
/* NOP */;
}
public function CanChangeBehGraph() : Bool{
return allowBehGraphChange;
/* NOP */;
}
public function WeaponSoundType() : CItemEntity{
var weapon : SItemUniqueId;
weapon = GetInventory().GetItemFromSlot('r_weapon');
return GetInventory().GetItemEntityUnsafe(weapon);
/* NOP */;
}
public function EnableCounterParryFor(time : Float){

bCanPerformCounter = true;
AddTimer('DisableCounterParry', time, false, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function DisableCounterParry(optional td : Float, optional
id : Int32){
bCanPerformCounter = false;
/* NOP */;
}
public final function IsAttacking() : Bool{
if (!combatStorage){
combatStorage = (CBaseAICombatStorage)GetAIStorageObject
('CombatData');
}
if (combatStorage){
return combatStorage.GetIsAttacking();
}
return false;
/* NOP */;
}
public final function RecalcLevel(){
if (!IsAlive()){
return;
}
AddLevelBonuses(0, 0);
/* NOP */;
}
protected function PerformCounterCheck(parryInfo : SParryInfo) : Bool{
return false;
/* NOP */;
}
protected function PerformParryCheck(parryInfo : SParryInfo) : Bool{
var mult : Float;
var isHeavy : Bool;
var npcTarget : CNewNPC;
var fistFightParry : Bool;
if (!parryInfo.canBeParried){
return false;
}
if (IsHuman() && (CHumanAICombatStorage)GetAIStorageObject('Comb
atData').IsProtectedByQuen()){
return false;
}
if (!CanParryAttack()){
return false;
}
if (!FistFightCheck(parryInfo.target, parryInfo.attacker, fistFi
ghtParry)){
return false;
}
if (IsInHitAnim() && HasTag('imlerith')){
return false;
}
npcTarget = (CNewNPC)parryInfo.target;
if (npcTarget.IsShielded(parryInfo.attacker) || !npcTarget.HasSh
ieldedAbility() && parryInfo.targetToAttackerAngleAbs < 90){
isHeavy = IsHeavyAttack(parryInfo.attackActionName);
if (HasStaminaToParry(parryInfo.attackActionName) && Has
Ability('ablParryHeavyAttacks') || !isHeavy){

SetBehaviorVariable('parryAttackType', 0, /* NOP
*/);
if (isHeavy){
SignalGameplayEventParamInt('ParryPerfor
m', 1);
} else {
SignalGameplayEventParamInt('ParryPerfor
m', 0);
}
} else {
SetBehaviorVariable('parryAttackType', 1, /* NOP
*/);
if (isHeavy){
SignalGameplayEventParamInt('ParryStagge
r', 1);
} else {
SignalGameplayEventParamInt('ParryStagge
r', 0);
}
}
if (parryInfo.attacker == thePlayer && parryInfo.attacke
r.IsWeaponHeld('fist') && !parryInfo.target.IsWeaponHeld('fist')){
parryInfo.attacker.SetBehaviorVariable('reflectA
nim', 1.000000, /* NOP */);
parryInfo.attacker.ReactToReflectedAttack(this);
} else if (isHeavy){
ToggleEffectOnShield('heavy_block', true);
} else {
ToggleEffectOnShield('light_block', true);
}
return true;
}
return false;
/* NOP */;
}
public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAtt
ributeValue{
return GetPowerStatValue(1, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function AddLevelBonuses(optional dt : Float, optional id :
Int32){
var i : Int32;
var lvlDiff : Int32;
var ciriEntity : W3ReplacerCiri;
RemoveTimer('AddLevelBonuses', /* NOP */);
ciriEntity = (W3ReplacerCiri)thePlayer;
if (GetNPCType() != 3 && level + CalculateAttributeValue(GetAttr
ibuteValue('level', /* NOP */, true), /* NOP */) < 2){
return;
}
if (HasAbility(theGame.params.ENEMY_BONUS_DEADLY)){
RemoveAbility(theGame.params.ENEMY_BONUS_DEADLY);
} else if (HasAbility(theGame.params.ENEMY_BONUS_HIGH)){
RemoveAbility(theGame.params.ENEMY_BONUS_HIGH);
} else if (HasAbility(theGame.params.ENEMY_BONUS_LOW)){
RemoveAbility(theGame.params.ENEMY_BONUS_LOW);
} else if (HasAbility(theGame.params.MONSTER_BONUS_DEADLY)){
RemoveAbility(theGame.params.MONSTER_BONUS_DEADLY);
} else if (HasAbility(theGame.params.MONSTER_BONUS_HIGH)){

RemoveAbility(theGame.params.MONSTER_BONUS_HIGH);
} else if (HasAbility(theGame.params.MONSTER_BONUS_LOW)){
RemoveAbility(theGame.params.MONSTER_BONUS_LOW);
}
if (IsHuman() && GetStat(1, true) < 0){
if (GetNPCType() != 3){
if (!HasAbility(theGame.params.ENEMY_BONUS_PER_L
EVEL)){
AddAbilityMultiple(theGame.params.ENEMY_
BONUS_PER_LEVEL, level - 1);
}
} else if (!HasAbility(theGame.params.ENEMY_BONUS_PER_LE
VEL)){
AddAbilityMultiple(theGame.params.ENEMY_BONUS_PE
R_LEVEL, 1 + GetWitcherPlayer().GetLevel() + RandRange(11, 13));
}
if (thePlayer.IsCiri() && theGame.GetDifficultyMode() ==
4 && !HasAbility('CiriHardcoreDebuffHuman')){
AddAbility('CiriHardcoreDebuffHuman', /* NOP */)
;
}
if (!ciriEntity && !HasAbility('NPCDoNotGainBoost')){
lvlDiff = CalculateAttributeValue(GetAttributeVa
lue('level', /* NOP */, true), /* NOP */) - thePlayer.GetLevel();
if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY)
{
if (!HasAbility(theGame.params.ENEMY_BON
US_DEADLY)){
AddAbility(theGame.params.ENEMY_
BONUS_DEADLY, true);
AddBuffImmunity(14, 'DeadlyEnemy
', true);
AddBuffImmunity(108, 'DeadlyEnem
y', true);
}
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_
HIGH){
if (!HasAbility(theGame.params.ENEMY_BON
US_HIGH)){
AddAbility(theGame.params.ENEMY_
BONUS_HIGH, true);
}
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_
HIGH){
} else if (!HasAbility(theGame.params.ENEMY_BONU
S_LOW)){
AddAbility(theGame.params.ENEMY_BONUS_LO
W, true);
}
}
} else if (GetStat(0, true) > 0){
if (!ciriEntity && !HasAbility('NPCDoNotGainBoost')){
lvlDiff = CalculateAttributeValue(GetAttributeVa
lue('level', /* NOP */, true), /* NOP */) - thePlayer.GetLevel();
if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY)
{
if (!HasAbility(theGame.params.ENEMY_BON
US_DEADLY)){
AddAbility(theGame.params.ENEMY_
BONUS_DEADLY, true);

AddBuffImmunity(14, 'DeadlyEnemy
', true);
AddBuffImmunity(108, 'DeadlyEnem
y', true);
}
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_
HIGH){
if (!HasAbility(theGame.params.ENEMY_BON
US_HIGH)){
AddAbility(theGame.params.ENEMY_
BONUS_HIGH, true);
}
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_
HIGH){
} else if (!HasAbility(theGame.params.ENEMY_BONU
S_LOW)){
AddAbility(theGame.params.ENEMY_BONUS_LO
W, true);
}
if (!HasAbility(theGame.params.ENEMY_BONUS_PER_L
EVEL)){
AddAbilityMultiple(theGame.params.ENEMY_
BONUS_PER_LEVEL, level - 1);
}
}
} else {
if (CalculateAttributeValue(GetAttributeValue('armor', /
* NOP */, /* NOP */), /* NOP */) > 0){
if (GetIsMonsterTypeGroup()){
if (!HasAbility(theGame.params.MONSTER_B
ONUS_PER_LEVEL_GROUP_ARMORED)){
AddAbilityMultiple(theGame.param
s.MONSTER_BONUS_PER_LEVEL_GROUP_ARMORED, level - 1);
}
} else if (!HasAbility(theGame.params.MONSTER_BO
NUS_PER_LEVEL_ARMORED)){
AddAbilityMultiple(theGame.params.MONSTE
R_BONUS_PER_LEVEL_ARMORED, level - 1);
}
} else if (GetIsMonsterTypeGroup()){
if (!HasAbility(theGame.params.MONSTER_BONUS_PER
_LEVEL_GROUP)){
AddAbilityMultiple(theGame.params.MONSTE
R_BONUS_PER_LEVEL_GROUP, level - 1);
}
} else if (!HasAbility(theGame.params.MONSTER_BONUS_PER_
LEVEL)){
AddAbilityMultiple(theGame.params.MONSTER_BONUS_
PER_LEVEL, level - 1);
}
if (thePlayer.IsCiri() && theGame.GetDifficultyMode() ==
4 && !HasAbility('CiriHardcoreDebuffMonster')){
AddAbility('CiriHardcoreDebuffMonster', /* NOP *
/);
}
if (!ciriEntity && !HasAbility('NPCDoNotGainBoost')){
lvlDiff = CalculateAttributeValue(GetAttributeVa
lue('level', /* NOP */, true), /* NOP */) - thePlayer.GetLevel();
if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY)
{

if (!HasAbility(theGame.params.MONSTER_B
ONUS_DEADLY)){
AddAbility(theGame.params.MONSTE
R_BONUS_DEADLY, true);
AddBuffImmunity(14, 'DeadlyEnemy
', true);
AddBuffImmunity(108, 'DeadlyEnem
y', true);
}
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_
HIGH){
if (!HasAbility(theGame.params.MONSTER_B
ONUS_HIGH)){
AddAbility(theGame.params.MONSTE
R_BONUS_HIGH, true);
}
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_
HIGH){
} else if (!HasAbility(theGame.params.MONSTER_BO
NUS_LOW)){
AddAbility(theGame.params.MONSTER_BONUS_
LOW, true);
}
}
}
/* NOP */;
}
public function GainStat(stat : EBaseCharacterStats, amount : Float){
if (stat == 7 && IsHorse() && thePlayer.GetUsedVehicle() == this
&& thePlayer.HasBuff(97)){
return;
}
super.GainStat(stat, amount);
/* NOP */;
}
public function ForceSetStat(stat : EBaseCharacterStats, val : Float){
if (stat == 7 && IsHorse() && thePlayer.GetUsedVehicle() == this
&& thePlayer.HasBuff(97) && val >= GetStat(7, /* NOP */)){
return;
}
super.ForceSetStat(stat, val);
/* NOP */;
}
public timer function FundamentalsAchFailTimer(optional dt : Float, opti
onal id : Int32){
RemoveTag('failedFundamentalsAchievement');
/* NOP */;
}
protected function CriticalBuffInformBehavior(buff : CBaseGameplayEffect
){
SignalGameplayEventParamInt('CriticalState', GetBuffCriticalType
(buff));
/* NOP */;
}
public function StartCSAnim(buff : CBaseGameplayEffect) : Bool{
if (super.StartCSAnim(buff)){
CriticalBuffInformBehavior(buff);
return true;
}
return false;

/* NOP */;
}
public function CSAnimStarted(buff : CBaseGameplayEffect) : Bool{
return super.StartCSAnim(buff);
/* NOP */;
}
public function SetCanPlayHitAnim(flag : Bool){
if (!flag && IsHuman() && GetAttitude(thePlayer) != 0){
super.SetCanPlayHitAnim(flag);
} else {
super.SetCanPlayHitAnim(flag);
}
/* NOP */;
}
public function OnStartFistfightMinigame() : Bool{
super.OnStartFistfightMinigame();
thePlayer.ProcessLockTarget(this, /* NOP */);
SignalGameplayEventParamInt('ChangePreferedCombatStyle', 14);
SetTemporaryAttitudeGroup('fistfight_opponent', 3);
ForceVulnerableImmortalityMode();
if (!thePlayer.IsFistFightMinigameToTheDeath()){
SetImmortalityMode(3, 16, /* NOP */);
}
FistFightHealthSetup();
/* NOP */;
}
public function OnEndFistfightMinigame() : Bool{
SignalGameplayEvent('ResetPreferedCombatStyle');
ResetTemporaryAttitudeGroup(3);
RestoreImmortalityMode();
LowerGuard();
if (IsKnockedUnconscious()){
SignalGameplayEvent('ForceStopUnconscious');
}
if (!IsAlive()){
Revive();
}
FistFightHealthSetup();
super.OnEndFistfightMinigame();
/* NOP */;
}
private function FistFightHealthSetup(){
if (HasAbility('fistfight_minigame')){
FistFightersHealthDiff();
} else {
return;
}
/* NOP */;
}
private function FistFightersHealthDiff(){
var vitality : Float;
if (HasAbility('StatsFistsTutorial')){
AddAbility('HealthFistFightTutorial', false);
} else if (HasAbility('StatsFistsEasy')){
AddAbility('HealthFistFightEasy', false);
} else if (HasAbility('StatsFistsMedium')){
AddAbility('HealthFistFightMedium', false);
} else if (HasAbility('StatsFistsHard')){
AddAbility('HealthFistFightHard', false);
}

vitality = abilityManager.GetStatMax(0);
SetHealthPerc(100);
/* NOP */;
}
private function ApplyFistFightLevelDiff(){
var lvlDiff : Int32;
var i : Int32;
var attribute : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var ffHP : SAbilityAttributeValue;
var ffAP : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
lvlDiff = CalculateAttributeValue(GetAttributeValue('level', /*
NOP */, true), /* NOP */) - thePlayer.GetLevel();
if (!HasAbility('NPC fists _Stats')){
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue('NPC fists _Stats', 'vitalit
y', min, max);
ffHP = GetAttributeRandomizedValue(min, max);
dm.GetAbilityAttributeValue('NPC fists _Stats', 'attack_
power', min, max);
ffAP = GetAttributeRandomizedValue(min, max);
}
if (lvlDiff < -theGame.params.LEVEL_DIFF_HIGH){
i = 0;
while (i < 5){
AddAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_
LOW, true);
attribute = GetAttributeValue('vitality', /* NOP
*/, /* NOP */);
attribute += ffHP;
if (attribute.valueMultiplicative <= 0){
RemoveAbility(theGame.params.ENEMY_BONUS
_FISTFIGHT_LOW);
return;
}
attribute = GetAttributeValue('attack_power', /*
NOP */, /* NOP */);
attribute += ffAP;
if (attribute.valueMultiplicative <= 0){
RemoveAbility(theGame.params.ENEMY_BONUS
_FISTFIGHT_LOW);
return;
}
i += 1;
}
} else if (lvlDiff < 0){
i = 0;
while (i < -lvlDiff){
AddAbility(theGame.params.ENEMY_BONUS_FISTFIGHT_
LOW, true);
attribute = GetAttributeValue('vitality', /* NOP
*/, /* NOP */);
if (attribute.valueMultiplicative <= 0){
RemoveAbility(theGame.params.ENEMY_BONUS
_FISTFIGHT_LOW);
return;
}
attribute = GetAttributeValue('attack_power', /*

NOP */, /* NOP */);


if (attribute.valueMultiplicative <= 0){
RemoveAbility(theGame.params.ENEMY_BONUS
_FISTFIGHT_LOW);
return;
}
i += 1;
}
} else if (lvlDiff > theGame.params.LEVEL_DIFF_HIGH){
AddAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_
HIGH, 5);
} else if (lvlDiff > 0){
AddAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_
HIGH, lvlDiff);
}
/* NOP */;
}
private function RemoveFistFightLevelDiff(){
RemoveAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_LOW,
5);
RemoveAbilityMultiple(theGame.params.ENEMY_BONUS_FISTFIGHT_HIGH,
5);
/* NOP */;
}
private function IsThisStanceRegular(Stance : ENpcStance) : Bool{
if (Stance == 0 || Stance == 1 || Stance == 2){
return true;
}
return false;
/* NOP */;
}
private function IsThisStanceDefensive(Stance : ENpcStance) : Bool{
if (Stance == 3 || Stance == 3){
return true;
}
return false;
/* NOP */;
}
public function GetCurrentStance() : ENpcStance{
var l_currentStance : Int32;
l_currentStance = GetBehaviorVariable('npcStance', /* NOP */);
return l_currentStance;
/* NOP */;
}
public function GetRegularStance() : ENpcStance{
return regularStance;
/* NOP */;
}
public function ReturnToRegularStance(){
SetBehaviorVariable('npcStance', regularStance, /* NOP */);
/* NOP */;
}
public function IsInRegularStance() : Bool{
if (GetCurrentStance() == GetRegularStance()){
return true;
}
return false;
/* NOP */;
}
public function ChangeStance(newStance : ENpcStance) : Bool{

if (IsThisStanceDefensive(newStance)){
/* NOP */;
} else if (IsThisStanceRegular(newStance)){
if (SetBehaviorVariable('npcStance', newStance, /* NOP *
/)){
regularStance = newStance;
return true;
}
} else {
return SetBehaviorVariable('npcStance', newStance, /* NO
P */);
}
return false;
/* NOP */;
}
public function RaiseGuard() : Bool{
SetGuarded(true);
return true;
/* NOP */;
}
public function LowerGuard() : Bool{
SetGuarded(false);
return true;
/* NOP */;
}
public function IsInAgony() : Bool{
return bAgony;
/* NOP */;
}
public function EnterAgony(){
bAgony = true;
/* NOP */;
}
public function EndAgony(){
bAgony = false;
/* NOP */;
}
public function EnableDeathAndAgony(){
bPlayDeathAnim = true;
bAgonyDisabled = false;
/* NOP */;
}
public function EnableDeath(){
bPlayDeathAnim = true;
/* NOP */;
}
public function EnableAgony(){
bAgonyDisabled = false;
/* NOP */;
}
public function DisableDeathAndAgony(){
bPlayDeathAnim = false;
bAgonyDisabled = true;
/* NOP */;
}
public function DisableAgony(){
bAgonyDisabled = true;
/* NOP */;
}
public function IsAgonyDisabled() : Bool{

return bAgonyDisabled;
/* NOP */;
}
public function IsInFinisherAnim() : Bool{
return bFinisher;
/* NOP */;
}
public function FinisherAnimStart(){
bPlayDeathAnim = false;
bFinisher = true;
SetBehaviorMimicVariable('gameplayMimicsMode', 3);
/* NOP */;
}
public function FinisherAnimInterrupted(){
bPlayDeathAnim = true;
bFinisher = false;
bFinisherInterrupted = true;
/* NOP */;
}
public function ResetFinisherAnimInterruptionState(){
bFinisherInterrupted = false;
/* NOP */;
}
public function WasFinisherAnimInterrupted() : Bool{
return bFinisherInterrupted;
/* NOP */;
}
public function FinisherAnimEnd(){
bFinisher = false;
/* NOP */;
}
public function ShouldPlayDeathAnim() : Bool{
return bPlayDeathAnim;
/* NOP */;
}
public function NPCGetAgonyAnim() : CName{
var agonyType : Float;
agonyType = GetBehaviorVariable('AgonyType', /* NOP */);
if (agonyType == 0){
return 'man_throat_cut_start';
} else if (agonyType == 1){
return 'man_wounded_crawl_killed';
} else {
return 'None';
}
/* NOP */;
}
public function GeraltGetAgonyAnim() : CName{
var agonyType : Float;
agonyType = GetBehaviorVariable('AgonyType', /* NOP */);
if (agonyType == 0){
return 'man_ger_throat_cut_attack_01';
} else if (agonyType == 1){
return 'man_ger_crawl_finish';
} else {
return 'None';
}
/* NOP */;
}
protected function PlayHitAnimation(damageAction : W3DamageAction, animT

ype : EHitReactionType){
var node : CNode;
SetBehaviorVariable('HitReactionWeapon', ProcessSwordOrFistHitRe
action(this, (CActor)damageAction.attacker), /* NOP */);
SetBehaviorVariable('HitReactionType', animType, /* NOP */);
if (damageAction.attacker){
node = (CNode)damageAction.causer;
if (node){
SetHitReactionDirection(node);
} else {
SetHitReactionDirection(damageAction.attacker);
}
SetDetailedHitReaction(damageAction.GetSwingType(), dama
geAction.GetSwingDirection());
}
if (customHits){
damageAction.customHitReactionRequested = true;
} else {
damageAction.hitReactionAnimRequested = true;
}
/* NOP */;
}
public function ReactToBeingHit(damageAction : W3DamageAction, buffNotAp
plied : Bool) : Bool{
var ret : Bool;
var percentageLoss : Float;
var totalHealth : Float;
var damaveValue : Float;
var healthLossToForceLand_perc : SAbilityAttributeValue;
var witcher : W3PlayerWitcher;
var node : CNode;
var boltCauser : W3BoltProjectile;
var attackAction : W3Action_Attack;
damaveValue = damageAction.GetDamageDealt();
totalHealth = GetMaxHealth();
percentageLoss = damaveValue / totalHealth;
healthLossToForceLand_perc = GetAttributeValue('healthLossToForc
eLand_perc', /* NOP */, /* NOP */);
if (percentageLoss >= healthLossToForceLand_perc.valueBase && Ge
tCurrentStance() == 5 || !IsUsingVehicle() && GetCurrentStance() != 6 && !(CMovi
ngPhysicalAgentComponent)GetMovingAgentComponent().IsOnGround()){
if (!(CBaseGameplayEffect)damageAction.causer){
damageAction.AddEffectInfo(9, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
}
}
boltCauser = (W3BoltProjectile)damageAction.causer;
if (boltCauser){
if (HasAbility('AdditiveHits')){
SetUseAdditiveHit(true, true, true);
ret = super.ReactToBeingHit(damageAction, buffNo
tApplied);
if (ret || damageAction.DealsAnyDamage()){
SignalGameplayDamageEvent('BeingHit', da
mageAction);
}
} else if (HasAbility('mon_wild_hunt_default')){
ret = false;
} else if (!boltCauser.HasTag('bodkinbolt') || IsUsingHo
rse(/* NOP */) || RandRange(100, /* NOP */) < 75.000000){

ret = super.ReactToBeingHit(damageAction, buffNo


tApplied);
if (ret || damageAction.DealsAnyDamage()){
SignalGameplayDamageEvent('BeingHit', da
mageAction);
}
} else {
ret = false;
}
} else {
ret = super.ReactToBeingHit(damageAction, buffNotApplied
);
if (ret || damageAction.DealsAnyDamage()){
SignalGameplayDamageEvent('BeingHit', damageActi
on);
}
}
if (damageAction.additiveHitReactionAnimRequested == true){
node = (CNode)damageAction.causer;
if (node){
SetHitReactionDirection(node);
} else {
SetHitReactionDirection(damageAction.attacker);
}
}
if ((CPlayer)damageAction.attacker || !(CNewNPC)damageAction.att
acker && damageAction.DealsAnyDamage()){
theTelemetry.LogWithLabelAndValue(24, damageAction.victi
m.ToString(), damageAction.processedDmg.vitalityDamage + damageAction.processedD
mg.essenceDamage);
}
witcher = GetWitcherPlayer();
if (damageAction.attacker == witcher && HasBuff(36)){
if (!witcher.CanUseSkill(41) || witcher.GetSkillLevel(41
) < 3){
RemoveBuff(36, true, /* NOP */);
}
}
if (damageAction.attacker == thePlayer && damageAction.DealsAnyD
amage() && !damageAction.IsDoTDamage()){
attackAction = (W3Action_Attack)damageAction;
}
return ret;
/* NOP */;
}
public function GetHitCounter(total : Bool) : Int32{
if (total){
return totalHitCounter;
}
return hitCounter;
/* NOP */;
}
public function IncHitCounter(){
hitCounter += 1;
totalHitCounter += 1;
AddTimer('ResetHitCounter', 2.000000, false, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */);
/* NOP */;
}
private timer function ResetHitCounter(optional deta : Float, optional i

d : Int32){
hitCounter = 0;
/* NOP */;
}
public function Kill(ignoreImmortalityMode : Bool, attacker : CGameplayE
ntity, source : CName){
var action : W3DamageAction;
if (theGame.CanLog()){
LogDMHits("CActor.Kill: called for actor <<" + this + ">
>", /* NOP */);
}
action = GetKillAction(ignoreImmortalityMode, attacker, source);
if (IsKnockedUnconscious()){
DisableDeathAndAgony();
OnDeath(action);
} else if (!abilityManager){
OnDeath(action);
} else {
if (ignoreImmortalityMode){
immortalityFlags = 0;
}
theGame.damageMgr.ProcessAction(action);
}
delete action;
/* NOP */;
}
public final function GetLevel() : Int32{
return CalculateAttributeValue(GetAttributeValue('level', /* NOP
*/, true), /* NOP */);
/* NOP */;
}
public function GetExperienceDifferenceLevelName(strLevel : String) : St
ring{
var lvlDiff : Int32;
var level : Int32;
var ciriEntity : W3ReplacerCiri;
ciriEntity = (W3ReplacerCiri)thePlayer;
level = super.GetLevel() + levelFakeAddon;
lvlDiff = level - thePlayer.GetLevel();
if (GetAttitude(thePlayer) != 2){
if (GetAttitudeGroup() != 'npc_charmed'){
strLevel = "";
return "none";
}
}
if (ciriEntity){
strLevel = "<font color="#66FF66">" + level + "</font>";
return "normalLevel";
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY){
strLevel = "";
return "deadlyLevel";
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_HIGH){
strLevel = "<font color="#FF1919">" + level + "</font>";
return "highLevel";
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_HIGH){
strLevel = "<font color="#66FF66">" + level + "</font>";
return "normalLevel";
} else {
strLevel = "<font color="#E6E6E6">" + level + "</font>";
return "lowLevel";

}
return "none";
/* NOP */;
}
private function ShouldGiveExp(attacker : CGameplayEntity) : Bool{
var actor : CActor;
var npc : CNewNPC;
var victimAt : EAIAttitude;
var giveExp : Bool;
victimAt = GetAttitudeBetween(thePlayer, this);
giveExp = false;
if (victimAt == 2){
if (attacker == thePlayer && !(W3PlayerWitcher)thePlayer
){
giveExp = false;
} else if (attacker == thePlayer){
giveExp = true;
} else if (VecDistance(thePlayer.GetWorldPosition(), Get
WorldPosition()) <= 20){
npc = (CNewNPC)attacker;
if (!npc || npc.npcGroupType != 3){
actor = (CActor)attacker;
if (!actor){
giveExp = true;
} else if (actor.HasTag(theGame.params.T
AG_NPC_IN_PARTY) || actor.HasBuff(36)){
giveExp = true;
}
}
}
}
return giveExp;
/* NOP */;
}
public function AddBestiaryKnowledge(){
var manager : CWitcherJournalManager;
manager = theGame.GetJournalManager();
if (GetSfxTag() == 'sfx_arachas' && HasAbility('mon_arachas_armo
red')){
activateBaseBestiaryEntryWithAlias("BestiaryArmoredArach
as", manager);
} else if (GetSfxTag() == 'sfx_arachas' && HasAbility('mon_poiso
n_arachas')){
activateBaseBestiaryEntryWithAlias("BestiaryPoisonousAra
chas", manager);
} else if (GetSfxTag() == 'sfx_bear'){
activateBaseBestiaryEntryWithAlias("BestiaryBear", manag
er);
} else if (GetSfxTag() == 'sfx_alghoul'){
activateBaseBestiaryEntryWithAlias("BestiaryAlghoul", ma
nager);
} else if (HasAbility('mon_greater_miscreant')){
activateBaseBestiaryEntryWithAlias("BestiaryMiscreant",
manager);
} else if (HasAbility('mon_basilisk')){
activateBaseBestiaryEntryWithAlias("BestiaryBasilisk", m
anager);
} else if (GetSfxTag() == 'sfx_cockatrice'){
activateBaseBestiaryEntryWithAlias("BestiaryCockatrice",
manager);

} else if (GetSfxTag() == 'sfx_arachas' && !HasAbility('mon_arac


has_armored') && !HasAbility('mon_poison_arachas')){
activateBaseBestiaryEntryWithAlias("BestiaryCrabSpider",
manager);
} else if (GetSfxTag() == 'sfx_katakan' && HasAbility('mon_ekimm
a')){
activateBaseBestiaryEntryWithAlias("BestiaryEkkima", man
ager);
} else if (GetSfxTag() == 'sfx_elemental_dao'){
activateBaseBestiaryEntryWithAlias("BestiaryElemental",
manager);
} else if (GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endr
iaga_soldier_tailed')){
activateBaseBestiaryEntryWithAlias("BestiaryEndriaga", m
anager);
} else if (GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endr
iaga_worker')){
activateBaseBestiaryEntryWithAlias("BestiaryEndriagaWork
er", manager);
} else if (GetSfxTag() == 'sfx_endriaga' && HasAbility('mon_endr
iaga_soldier_spikey')){
activateBaseBestiaryEntryWithAlias("BestiaryEndriagaTrut
en", manager);
} else if (HasAbility('mon_forktail_young') || HasAbility('mon_f
orktail') || HasAbility('mon_forktail_mh')){
activateBaseBestiaryEntryWithAlias("BestiaryForktail", m
anager);
} else if (GetSfxTag() == 'sfx_ghoul'){
activateBaseBestiaryEntryWithAlias("BestiaryGhoul", mana
ger);
} else if (GetSfxTag() == 'sfx_golem'){
activateBaseBestiaryEntryWithAlias("BestiaryGolem", mana
ger);
} else if (GetSfxTag() == 'sfx_katakan' && !HasAbility('mon_ekim
ma')){
activateBaseBestiaryEntryWithAlias("BestiaryKatakan", ma
nager);
} else if (GetSfxTag() == 'sfx_ghoul' && HasAbility('mon_greater
_miscreant')){
activateBaseBestiaryEntryWithAlias("BestiaryMiscreant",
manager);
} else if (HasAbility('mon_nightwraith') || HasAbility('mon_nigh
twraith_mh')){
activateBaseBestiaryEntryWithAlias("BestiaryMoonwright",
manager);
} else if (HasAbility('mon_noonwraith')){
activateBaseBestiaryEntryWithAlias("BestiaryNoonwright",
manager);
} else if (HasAbility('mon_lycanthrope')){
activateBaseBestiaryEntryWithAlias("BestiaryLycanthrope"
, manager);
} else if (GetSfxTag() == 'sfx_werewolf'){
activateBaseBestiaryEntryWithAlias("BestiaryWerewolf", m
anager);
} else if (GetSfxTag() == 'sfx_wyvern'){
activateBaseBestiaryEntryWithAlias("BestiaryWyvern", man
ager);
} else if (HasAbility('mon_czart')){
activateBaseBestiaryEntryWithAlias("BestiaryCzart", mana
ger);

} else if (GetSfxTag() == 'sfx_bies'){


activateBaseBestiaryEntryWithAlias("BestiaryBies", manag
er);
} else if (GetSfxTag() == 'sfx_wild_dog'){
activateBaseBestiaryEntryWithAlias("BestiaryDog", manage
r);
} else if (GetSfxTag() == 'sfx_drowner'){
activateBaseBestiaryEntryWithAlias("BestiaryDrowner", ma
nager);
}
if (GetSfxTag() == 'sfx_elemental_ifryt'){
activateBaseBestiaryEntryWithAlias("BestiaryFireElementa
l", manager);
} else if (GetSfxTag() == 'sfx_fogling'){
activateBaseBestiaryEntryWithAlias("BestiaryFogling", ma
nager);
} else if (GetSfxTag() == 'sfx_gravehag'){
activateBaseBestiaryEntryWithAlias("BestiaryGraveHag", m
anager);
} else if (GetSfxTag() == 'sfx_gryphon'){
activateBaseBestiaryEntryWithAlias("BestiaryGriffin", ma
nager);
} else if (HasAbility('mon_erynia')){
activateBaseBestiaryEntryWithAlias("BestiaryErynia", man
ager);
} else if (GetSfxTag() == 'sfx_harpy'){
activateBaseBestiaryEntryWithAlias("BestiaryHarpy", mana
ger);
} else if (GetSfxTag() == 'sfx_ice_giant'){
activateBaseBestiaryEntryWithAlias("BestiaryIceGiant", m
anager);
} else if (GetSfxTag() == 'sfx_lessog'){
activateBaseBestiaryEntryWithAlias("BestiaryLeshy", mana
ger);
} else if (GetSfxTag() == 'sfx_nekker'){
activateBaseBestiaryEntryWithAlias("BestiaryNekker", man
ager);
} else if (GetSfxTag() == 'sfx_siren'){
activateBaseBestiaryEntryWithAlias("BestiarySiren", mana
ger);
} else if (HasTag('ice_troll')){
activateBaseBestiaryEntryWithAlias("BestiaryIceTroll", m
anager);
} else if (GetSfxTag() == 'sfx_troll_cave'){
activateBaseBestiaryEntryWithAlias("BestiaryCaveTroll",
manager);
} else if (GetSfxTag() == 'sfx_waterhag'){
activateBaseBestiaryEntryWithAlias("BestiaryWaterHag", m
anager);
} else if (GetSfxTag() == 'sfx_wildhunt_minion'){
activateBaseBestiaryEntryWithAlias("BestiaryWhMinion", m
anager);
} else if (GetSfxTag() == 'sfx_wolf'){
activateBaseBestiaryEntryWithAlias("BestiaryWolf", manag
er);
} else if (GetSfxTag() == 'sfx_wraith'){
activateBaseBestiaryEntryWithAlias("BestiaryWraith", man
ager);
} else if (HasAbility('mon_cyclops')){
activateBaseBestiaryEntryWithAlias("BestiaryCyclop", man

ager);
} else if (HasAbility('mon_ice_golem')){
activateBaseBestiaryEntryWithAlias("BestiaryIceGolem", m
anager);
} else if (HasAbility('mon_gargoyle')){
activateBaseBestiaryEntryWithAlias("BestiaryGargoyle", m
anager);
} else if (HasAbility('mon_rotfiend') || HasAbility('mon_rotfien
d_large')){
activateBaseBestiaryEntryWithAlias("BestiaryGreaterRotFi
end", manager);
}
/* NOP */;
}
public function CalculateExperiencePoints(skipLog : Bool) : Int32{
var finalExp : Int32;
var exp : Float;
var lvlDiff : Int32;
var modDamage : Float;
var modArmor : Float;
var modVitality : Float;
var modOther : Float;
if (grantNoExperienceAfterKill || HasAbility('Zero_XP') || GetNP
CType() == 3){
return 0;
}
modDamage = CalculateAttributeValue(GetAttributeValue('RendingDa
mage', /* NOP */, true), /* NOP */);
modDamage += CalculateAttributeValue(GetAttributeValue('Bludgeon
ingDamage', /* NOP */, true), /* NOP */);
modDamage += CalculateAttributeValue(GetAttributeValue('FireDama
ge', /* NOP */, true), /* NOP */);
modDamage += CalculateAttributeValue(GetAttributeValue('Elementa
lDamage', /* NOP */, true), /* NOP */);
modDamage += CalculateAttributeValue(GetPowerStatValue(0, /* NOP
*/, true), /* NOP */);
modDamage *= 5;
modArmor = CalculateAttributeValue(GetTotalArmor(), /* NOP */) *
100;
modVitality = GetStatMax(1) + 3 * GetStatMax(0);
if (HasAbility('AcidSpit')){
modOther = modOther + 2;
}
if (HasAbility('Aggressive')){
modOther = modOther + 2;
}
if (HasAbility('Charge')){
modOther = modOther + 3;
}
if (HasAbility('ContactBlindness')){
modOther = modOther + 2;
}
if (HasAbility('ContactSlowdown')){
modOther = modOther + 2;
}
if (HasAbility('Cursed')){
modOther = modOther + 2;
}
if (HasAbility('BurnIgnore')){
modOther = modOther + 2;

}
if (HasAbility('DamageBuff')){
modOther = modOther + 2;
}
if (HasAbility('Draconide')){
modOther = modOther + 2;
}
if (HasAbility('Fireball')){
modOther = modOther + 2;
}
if (HasAbility('Flashstep')){
modOther = modOther + 2;
}
if (HasAbility('Flying')){
modOther = modOther + 10;
}
if (HasAbility('Frost')){
modOther = modOther + 4;
}
if (HasAbility('EssenceRegen')){
modOther = modOther + 2;
}
if (HasAbility('Gargoyle')){
modOther = modOther + 2;
}
if (HasAbility('Hypnosis')){
modOther = modOther + 2;
}
if (HasAbility('IceArmor')){
modOther = modOther + 5;
}
if (HasAbility('InstantKillImmune')){
modOther = modOther + 2;
}
if (HasAbility('JumpAttack')){
modOther = modOther + 2;
}
if (HasAbility('Magical')){
modOther = modOther + 2;
}
if (HasAbility('MistForm')){
modOther = modOther + 2;
}
if (HasAbility('MudTeleport')){
modOther = modOther + 2;
}
if (HasAbility('MudAttack')){
modOther = modOther + 2;
}
if (HasAbility('PoisonCloud')){
modOther = modOther + 2;
}
if (HasAbility('PoisonDeath')){
modOther = modOther + 2;
}
if (HasAbility('Rage')){
modOther = modOther + 2;
}
if (HasAbility('Relic')){
modOther = modOther + 5;

}
if (HasAbility('Scream')){
modOther = modOther + 2;
}
if (HasAbility('Shapeshifter')){
modOther = modOther + 5;
}
if (HasAbility('Shout')){
modOther = modOther + 2;
}
if (HasAbility('Spikes')){
modOther = modOther + 2;
}
if (HasAbility('StaggerCounter')){
modOther = modOther + 2;
}
if (HasAbility('StinkCloud')){
modOther = modOther + 2;
}
if (HasAbility('Summon')){
modOther = modOther + 2;
}
if (HasAbility('Tail')){
modOther = modOther + 5;
}
if (HasAbility('Teleport')){
modOther = modOther + 5;
}
if (HasAbility('Thorns')){
modOther = modOther + 2;
}
if (HasAbility('Throw')){
modOther = modOther + 2;
}
if (HasAbility('ThrowFire')){
modOther = modOther + 2;
}
if (HasAbility('ThrowIce')){
modOther = modOther + 2;
}
if (HasAbility('Vampire')){
modOther = modOther + 2;
}
if (HasAbility('Venom')){
modOther = modOther + 2;
}
if (HasAbility('VitalityRegen')){
modOther = modOther + 5;
}
if (HasAbility('Wave')){
modOther = modOther + 2;
}
if (HasAbility('WeakToAard')){
modOther = modOther - 2;
}
if (HasAbility('TongueAttack')){
modOther = modOther + 2;
}
exp = modDamage + modArmor + modVitality + modOther / 99;
if (IsHuman()){

if (exp > 1 + level * 2){


exp = 1 + level * 2;
}
} else if (exp > 5 + level * 4){
exp = 5 + level * 4;
}
if (IsHuman()){
exp = exp + 1;
} else {
exp = exp + 1;
}
if (thePlayer.GetLevel() < 30){
exp = exp / 4;
} else {
exp = exp / 2;
}
lvlDiff = level - thePlayer.GetLevel();
if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY){
exp = 25 + exp * 1.500000;
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_HIGH){
exp = exp * 1.050000;
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_HIGH){
} else {
exp = 2;
}
if (exp > 50){
exp = 50;
}
if (theGame.GetDifficultyMode() == 1){
exp = exp * 1.200000;
} else if (theGame.GetDifficultyMode() == 3){
exp = exp * 0.900000;
} else if (theGame.GetDifficultyMode() == 4){
exp = exp * 0.800000;
}
finalExp = RoundF(exp);
if (!skipLog){
LogStats("--------------------------------");
LogStats("[CALCULATED EXP]
-");
LogStats("- base, without difficulty and -");
LogStats("- level difference bonuses -");
LogStats("--------------------------------");
LogStats(" -> for entity : " + GetName());
LogStats("--------------------------------");
LogStats("* modDamage : " + modDamage);
LogStats("* modArmor : " + modArmor);
LogStats("* modVitality : " + modVitality);
LogStats("+ modOther : " + modOther);
LogStats("--------------------------------");
LogStats(" BASE EXPERIENCE POINTS = [ " + finalExp + " ]
");
LogStats("--------------------------------");
}
return finalExp;
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
var inWater : Bool;
var fists : Bool;
var tmpBool : Bool;

var attackAction : W3Action_Attack;


var expPoints : Int32;
var npcLevel : Int32;
var lvlDiff : Int32;
var weaponID : SItemUniqueId;
var actor : CActor;
var abilityName : CName;
var tmpName : CName;
var abilityCount : Float;
var maxStack : Float;
var itemExpBonus : Float;
var addAbility : Bool;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var bonusExp : SAbilityAttributeValue;
var mutagen : CBaseGameplayEffect;
var monsterCategory : EMonsterCategory;
var allItems : array<SItemUniqueId>;
var attitudeToPlayer : EAIAttitude;
var i : Int32;
var ciriEntity : W3ReplacerCiri;
var blizzard : W3Potion_Blizzard;
ciriEntity = (W3ReplacerCiri)thePlayer;
super.OnDeath(damageAction);
if (!IsHuman() && damageAction.attacker == thePlayer && !ciriEnt
ity){
AddBestiaryKnowledge();
}
if (!WillBeUnconscious()){
if (theGame.GetWorld().GetWaterDepth(GetWorldPosition(),
/* NOP */) > 0){
if (HasEffect('water_death')){
PlayEffectSingle('water_death', /* NOP *
/);
}
} else if (HasEffect('blood_spill')){
PlayEffectSingle('blood_spill', /* NOP */);
}
}
if ((CMovingPhysicalAgentComponent)GetMovingAgentComponent().Has
Ragdoll()){
SetBehaviorVariable('HasRagdoll', 1, /* NOP */);
}
SignalGameplayEventParamObject('OnDeath', damageAction);
theGame.GetBehTreeReactionManager().CreateReactionEvent(this, 'B
attlecryGroupDeath', 1.000000, 20.000000, -1.000000, 1, /* NOP */, /* NOP */);
attackAction = (W3Action_Attack)damageAction;
if ((CMovingPhysicalAgentComponent)GetMovingAgentComponent().Get
SubmergeDepth() < 0){
inWater = true;
DisableAgony();
}
if (IsUsingHorse(/* NOP */)){
SoundEvent("cmb_play_hit_heavy", /* NOP */, /* NOP */);
SoundEvent("grunt_vo_death", /* NOP */, /* NOP */);
}
if (damageAction.attacker == thePlayer && (W3PlayerWitcher)thePl
ayer && thePlayer.GetStat(3, /* NOP */) > 0 && thePlayer.CanUseSkill(74)){
thePlayer.AddAbility(SkillEnumToName(74), true);
if (thePlayer.GetSkillLevel(74) > 1){

thePlayer.AddAbility(SkillEnumToName(74), true);
}
if (thePlayer.GetSkillLevel(74) > 2){
thePlayer.AddAbility(SkillEnumToName(74), true);
}
}
OnChangeDyingInteractionPriorityIfNeeded();
actor = (CActor)damageAction.attacker;
if (ShouldGiveExp(damageAction.attacker)){
npcLevel = CalculateAttributeValue(GetAttributeValue('le
vel', /* NOP */, true), /* NOP */);
lvlDiff = npcLevel - GetWitcherPlayer().GetLevel();
expPoints = CalculateExperiencePoints(/* NOP */);
if (expPoints > 0){
theGame.GetMonsterParamsForActor(this, monsterCa
tegory, tmpName, tmpBool, tmpBool, tmpBool);
if (MonsterCategoryIsMonster(monsterCategory)){
bonusExp = thePlayer.GetAttributeValue('
nonhuman_exp_bonus_when_fatal', /* NOP */, /* NOP */);
} else {
bonusExp = thePlayer.GetAttributeValue('
human_exp_bonus_when_fatal', /* NOP */, /* NOP */);
}
expPoints = RoundMath(expPoints * 1 + CalculateA
ttributeValue(bonusExp, /* NOP */));
GetWitcherPlayer().AddPoints(1, RoundF(expPoints
* theGame.expGlobalMod_kills), false);
}
}
attitudeToPlayer = GetAttitudeBetween(this, thePlayer);
if (attitudeToPlayer == 2 && !HasTag('AchievementKillDontCount')
){
if (actor && actor.HasBuff(36)){
theGame.GetGamerProfile().IncStat(3);
FactsAdd("statistics_cerberus_sign", /* NOP */,
/* NOP */);
}
if (aardedFlight && damageAction.GetBuffSourceName() ==
"FallingDamage"){
theGame.GetGamerProfile().IncStat(4);
}
if (damageAction.IsActionEnvironment()){
theGame.GetGamerProfile().IncStat(5);
FactsAdd("statistics_cerberus_environment", /* N
OP */, /* NOP */);
}
}
if (damageAction.attacker == thePlayer){
theGame.GetMonsterParamsForActor(this, monsterCategory,
tmpName, tmpBool, tmpBool, tmpBool);
if (thePlayer.HasBuff(90)){
if (monsterCategory != 14 || IsRequiredAttitudeB
etween(this, thePlayer, true, /* NOP */, /* NOP */)){
abilityName = thePlayer.GetBuff(90, /* N
OP */).GetAbilityName();
abilityCount = thePlayer.GetAbilityCount
(abilityName);
if (abilityCount == 0){
addAbility = true;
} else {

theGame.GetDefinitionsManager().
GetAbilityAttributeValue(abilityName, 'mutagen18_max_stack', min, max);
maxStack = CalculateAttributeVal
ue(GetAttributeRandomizedValue(min, max), /* NOP */);
if (maxStack >= 0){
addAbility = abilityCoun
t < maxStack;
} else {
addAbility = true;
}
}
if (addAbility){
thePlayer.AddAbility(abilityName
, true);
}
}
}
if (thePlayer.HasBuff(78)){
if (monsterCategory != 14 || IsRequiredAttitudeB
etween(this, thePlayer, true, /* NOP */, /* NOP */)){
mutagen = thePlayer.GetBuff(78, /* NOP *
/);
thePlayer.AddAbility(mutagen.GetAbilityN
ame(), true);
}
}
if (IsRequiredAttitudeBetween(this, thePlayer, true, /*
NOP */, /* NOP */)){
blizzard = (W3Potion_Blizzard)thePlayer.GetBuff(
23, /* NOP */);
if (blizzard){
blizzard.KilledEnemy();
}
}
if (!HasTag('AchievementKillDontCount')){
if (damageAction.GetIsHeadShot() && monsterCateg
ory == 11){
theGame.GetGamerProfile().IncStat(13);
}
if ((W3SignEntity)damageAction.causer || (W3Sign
Projectile)damageAction.causer){
FactsAdd("statistics_cerberus_sign", /*
NOP */, /* NOP */);
} else if ((CBaseGameplayEffect)damageAction.cau
ser && (CBaseGameplayEffect)damageAction.causer.IsSignEffect()){
FactsAdd("statistics_cerberus_sign", /*
NOP */, /* NOP */);
} else if ((W3Petard)damageAction.causer){
FactsAdd("statistics_cerberus_petard", /
* NOP */, /* NOP */);
} else if ((W3BoltProjectile)damageAction.causer
){
FactsAdd("statistics_cerberus_bolt", /*
NOP */, /* NOP */);
} else {
if (!attackAction){
attackAction = (W3Action_Attack)
damageAction;
}
fists = false;

if (attackAction){
weaponID = attackAction.GetWeapo
nId();
if (damageAction.attacker.GetInv
entory().IsItemFists(weaponID)){
FactsAdd("statistics_cer
berus_fists", /* NOP */, /* NOP */);
fists = true;
}
}
if (!fists && damageAction.IsActionMelee
()){
FactsAdd("statistics_cerberus_me
lee", /* NOP */, /* NOP */);
}
}
}
}
if (damageAction.attacker == thePlayer || !(CNewNPC)damageAction
.attacker){
theTelemetry.LogWithLabelAndValue(23, ToString(), super.
GetLevel());
}
if (damageAction.attacker == thePlayer && !HasTag('AchievementKi
llDontCount')){
if (attitudeToPlayer == 2){
if (!HasTag('AchievementSwankDontCount')){
if (FactsQuerySum("statistic_killed_in_1
0_sec") >= 4){
theGame.GetGamerProfile().AddAch
ievement(28);
} else {
FactsAdd("statistic_killed_in_10
_sec", 1, 10);
}
}
if (GetWitcherPlayer() && !thePlayer.ReceivedDam
ageInCombat() && !GetWitcherPlayer().UsedQuenInCombat()){
theGame.GetGamerProfile().IncStat(2);
}
}
if ((W3PlayerWitcher)thePlayer){
if (!thePlayer.DidFailFundamentalsFirstAchieveme
ntCondition() && HasTag(theGame.params.MONSTER_HUNT_ACTOR_TAG) && !HasTag('faile
dFundamentalsAchievement')){
theGame.GetGamerProfile().IncStat(8);
}
}
}
if (!inWater && RandF() < 0.300000 && !WillBeUnconscious() && (W
3IgniProjectile)damageAction.causer){
AddEffectDefault(18, this, 'IgniKill', true);
EnableAgony();
SignalGameplayEvent('ForceAgony');
}
if (attackAction && IsWeaponHeld('fist') && damageAction.attacke
r == thePlayer && !thePlayer.ReceivedDamageInCombat() && !HasTag('AchievementKil
lDontCount')){
weaponID = attackAction.GetWeaponId();
if (thePlayer.inv.IsItemFists(weaponID)){

theGame.GetGamerProfile().AddAchievement(46);
}
}
/* NOP */;
}
public function OnChangeDyingInteractionPriorityIfNeeded() : Bool{
if (WillBeUnconscious()){
return true;
}
if (HasTag('animal')){
return true;
}
SetInteractionPriority(-2);
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
super.OnFireHit(source);
if (HasTag('animal')){
Kill(/* NOP */, /* NOP */, /* NOP */);
}
if (!IsAlive() && IsInAgony()){
SignalGameplayEvent('AbandonAgony');
SetKinematic(false);
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
SignalGameplayEvent('AardHitReceived');
aardedFlight = true;
RemoveAllBuffsOfType(11);
super.OnAardHit(sign);
if (HasTag('small_animal')){
Kill(/* NOP */, /* NOP */, /* NOP */);
}
if (IsShielded(sign.GetCaster())){
ToggleEffectOnShield('aard_cone_hit', true);
} else if (HasAbility('ablIgnoreSigns')){
SignalGameplayEvent('IgnoreSigns');
SetBehaviorVariable('bIgnoreSigns', 1.000000, /* NOP */)
;
AddTimer('IgnoreSignsTimeOut', 0.200000, false, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
if (!IsAlive()){
SignalGameplayEvent('AbandonAgony');
if (!HasAbility('mon_bear_base') && !HasAbility('mon_gol
em_base') && !HasAbility('mon_endriaga_base') && !HasAbility('mon_gryphon_base')
&& !IsAnimal()){
SetKinematic(false);
}
}
/* NOP */;
}
public function OnAxiiHit(sign : W3AxiiProjectile) : Bool{
super.OnAxiiHit(sign);
if (HasAbility('ablIgnoreSigns')){
SignalGameplayEvent('IgnoreSigns');
SetBehaviorVariable('bIgnoreSigns', 1.000000, /* NOP */)
;
AddTimer('IgnoreSignsTimeOut', 0.200000, false, /* NOP *

/, /* NOP */, /* NOP */, /* NOP */);


}
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
var horseComponent : W3HorseComponent;
super.OnIgniHit(sign);
SignalGameplayEvent('IgniHitReceived');
if (HasAbility('ablIgnoreSigns')){
SignalGameplayEvent('IgnoreSigns');
SetBehaviorVariable('bIgnoreSigns', 1.000000, /* NOP */)
;
AddTimer('IgnoreSignsTimeOut', 0.200000, false, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
if (HasAbility('IceArmor')){
RemoveAbility('IceArmor');
StopEffect('ice_armor');
PlayEffect('ice_armor_hit', /* NOP */);
}
if (IsShielded(sign.GetCaster())){
if (sign.IsProjectileFromChannelMode()){
SignalGameplayEvent('BeingHitByIgni');
if (!beingHitByIgni){
beingHitByIgni = true;
firstIgniTick = theGame.GetEngineTimeAsS
econds();
ToggleEffectOnShield('burn', true);
RaiseShield();
}
if (firstIgniTick + SHIELD_BURN_TIMER < theGame.
GetEngineTimeAsSeconds()){
ProcessShieldDestruction();
return false;
}
AddTimer('IgniCleanup', 0.200000, false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
} else {
ToggleEffectOnShield('igni_cone_hit', true);
}
}
horseComponent = GetHorseComponent();
if (horseComponent){
horseComponent.OnIgniHit(sign);
} else {
horseComponent = GetUsedHorseComponent();
if (horseComponent){
horseComponent.OnIgniHit(sign);
}
}
/* NOP */;
}
public function IsBeingHitByIgni() : Bool{
return beingHitByIgni;
/* NOP */;
}
public function ToggleEffectOnShield(effectName : CName, toggle : Bool){
var itemID : SItemUniqueId;
var inv : CInventoryComponent;
inv = GetInventory();

itemID = inv.GetItemFromSlot('l_weapon');
if (toggle){
inv.PlayItemEffect(itemID, effectName);
} else {
inv.StopItemEffect(itemID, effectName);
}
/* NOP */;
}
public timer function IgniCleanup(optional dt : Float, optional id : Int
32){
if (beingHitByIgni){
ToggleEffectOnShield('burn', false);
AddTimer('LowerShield', 0.500000, /* NOP */, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
beingHitByIgni = false;
}
/* NOP */;
}
public timer function IgnoreSignsTimeOut(optional dt : Float, optional i
d : Int32){
SignalGameplayEvent('IgnoreSignsEnd');
SetBehaviorVariable('bIgnoreSigns', 0.000000, /* NOP */);
/* NOP */;
}
public function SetIsTeleporting(b : Bool){
isTeleporting = b;
/* NOP */;
}
public function IsTeleporting() : Bool{
return isTeleporting;
/* NOP */;
}
public function SetUnstoppable(toggle : Bool){
unstoppable = toggle;
/* NOP */;
}
public function IsUnstoppable() : Bool{
return unstoppable;
/* NOP */;
}
public function SetIsCountering(toggle : Bool){
bIsCountering = toggle;
/* NOP */;
}
public function IsCountering() : Bool{
return bIsCountering;
/* NOP */;
}
public timer function Tick(optional deltaTime : Float, optional id : Int
32){
}
private function UpdateBumpCollision(){
var npc : CNewNPC;
var collisionData : SCollisionData;
var collisionNum : Int32;
var i : Int32;
if (mac){
collisionNum = mac.GetCollisionCharacterDataCount();
i = 0;
while (i < collisionNum){

collisionData = mac.GetCollisionCharacterData(i)
;
npc = (CNewNPC)collisionData.entity;
if (npc){
SignalGameplayEvent('AI_GetOutOfTheWay')
;
SignalGameplayEventParamObject('CollideW
ithPlayer', npc);
theGame.GetBehTreeReactionManager().Crea
teReactionEvent(this, 'BumpAction', 1, 1, 1, 1, false, /* NOP */);
break;
}
i += 1;
}
}
/* NOP */;
}
public function SetIsTranslationScaled(b : Bool){
isTranslationScaled = b;
/* NOP */;
}
public function GetIsTranslationScaled() : Bool{
return isTranslationScaled;
/* NOP */;
}
public function OnAnimEvent_EquipItemL(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
GetInventory().MountItem(itemToEquip, true, /* NOP */);
/* NOP */;
}
public function OnAnimEvent_HideItemL(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
GetInventory().UnmountItem(itemToEquip, true);
/* NOP */;
}
public function OnAnimEvent_HideWeapons(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var inventory : CInventoryComponent;
var ids : array<SItemUniqueId>;
var i : Int32;
inventory = GetInventory();
ids = inventory.GetAllWeapons();
i = 0;
while (i < ids.Size()){
if (inventory.IsItemHeld(ids[i]) || inventory.IsItemMoun
ted(ids[i])){
inventory.UnmountItem(ids[i], true);
}
i += 1;
}
/* NOP */;
}
public function OnAnimEvent_TemporaryOffGround(animEventName : CName, an
imEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
isTemporaryOffGround = false;
} else {
isTemporaryOffGround = true;
}
/* NOP */;

}
public function OnAnimEvent_weaponSoundType(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
WeaponSoundType().SetupDrawHolsterSounds();
/* NOP */;
}
public function OnAnimEvent_OwlSwitchOpen(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('owl_01');
/* NOP */;
}
public function OnAnimEvent_OwlSwitchClose(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('owl_02');
/* NOP */;
}
public function OnAnimEvent_Goose01OpenWings(animEventName : CName, anim
EventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('goose_01_wings');
/* NOP */;
}
public function OnAnimEvent_Goose01CloseWings(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('goose_01');
/* NOP */;
}
public function OnAnimEvent_Goose02OpenWings(animEventName : CName, anim
EventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('goose_02_wings');
/* NOP */;
}
public function OnAnimEvent_Goose02CloseWings(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetAppearance('goose_02');
/* NOP */;
}
public function OnAnimEvent_NullifyBurning(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
RemoveAllBuffsOfType(18);
/* NOP */;
}
public function OnAnimEvent_setVisible(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetVisibility(true);
SetGameplayVisibility(true);
/* NOP */;
}
public function OnAnimEvent_extensionWalk(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
SetBehaviorVariable('UsesExtension', 1, /* NOP */);
/* NOP */;
}
public function OnEquippedItem(category : CName, slotName : CName) : Boo
l{
if (slotName == 'r_weapon'){
switch(category){
case 'axe1h':
case 'axe2h':
SetBehaviorVariable('EquippedItemR', 1, /* NOP *
/);

break;
case 'halberd2h':
SetBehaviorVariable('EquippedItemR', 2, /* NOP *
/);
break;
case 'steelsword':
case 'silversword':
SetBehaviorVariable('EquippedItemR', 3, /* NOP *
/);
break;
case 'crossbow':
SetBehaviorVariable('EquippedItemR', 5, /* NOP *
/);
break;
default:
SetBehaviorVariable('EquippedItemR', 0, /* NOP *
/);
break;
}
} else if (slotName == 'l_weapon'){
switch(category){
case 'shield':
SetBehaviorVariable('EquippedItemL', 2, /* NOP *
/);
break;
case 'bow':
SetBehaviorVariable('EquippedItemL', 3, /* NOP *
/);
break;
case 'usable':
SetBehaviorVariable('EquippedItemL', 1, /* NOP *
/);
break;
default:
SetBehaviorVariable('EquippedItemL', 0, /* NOP *
/);
break;
}
}
if (category != 'fist' && category != 'work' && category != 'usa
ble' && IsInCombat() && GetTarget() == thePlayer && thePlayer.GetTarget() == thi
s){
thePlayer.OnTargetWeaponDrawn();
}
/* NOP */;
}
public function OnHolsteredItem(category : CName, slotName : CName) : Bo
ol{
if (slotName == 'r_weapon'){
SetBehaviorVariable('EquippedItemR', 0, /* NOP */);
} else if (slotName == 'l_weapon'){
SetBehaviorVariable('EquippedItemL', 0, /* NOP */);
}
/* NOP */;
}
public function IsTalkDisabled() : Bool{
return isTalkDisabled || isTalkDisabledTemporary;
/* NOP */;
}
public function DisableTalking(disable : Bool, temporary : Bool){

if (temporary){
isTalkDisabledTemporary = disable;
} else {
isTalkDisabled = disable;
}
/* NOP */;
}
public function CanStartTalk() : Bool{
if (super.IsAtWork() && !super.IsConsciousAtWork() || IsTalkDisa
bled()){
return false;
}
if (HasBuff(36) || HasBuff(5)){
return false;
}
return !IsFrozen() && CanTalk(true);
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var horseComponent : W3HorseComponent;
var ciriEntity : W3ReplacerCiri;
var isAtWork : Bool;
var isConciousAtWork : Bool;
/* NOP */;
if (actionName == "Talk"){
/* NOP */;
if (!super.PlayDialog(/* NOP */)){
EnableDynamicLookAt(thePlayer, 5);
ciriEntity = (W3ReplacerCiri)thePlayer;
if (ciriEntity){
} else {
if (!super.IsAtWork() || super.IsConscio
usAtWork()){
PlayVoiceset(100, "greeting_gera
lt", /* NOP */);
} else {
PlayVoiceset(100, "sleeping", /*
NOP */);
}
wasInTalkInteraction = true;
AddTimer('ResetTalkInteractionFlag', 1.0
00000, true, /* NOP */, /* NOP */, true, /* NOP */);
}
}
}
if (actionName == "Finish"){
} else if (actionName == "AxiiCalmHorse"){
SignalGameplayEvent('HorseAxiiCalmDownStart');
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
var stateName : CName;
var horseComp : W3HorseComponent;
if (interactionComponentName == "talk"){
if (activator == thePlayer && thePlayer.CanStartTalk() &
& CanStartTalk()){
return true;

}
} else if (interactionComponentName == "Finish" && activator ==
thePlayer){
stateName = thePlayer.GetCurrentStateName();
if (stateName == 'CombatSteel' || stateName == 'CombatSi
lver'){
return true;
}
} else if (interactionComponentName == "horseMount" && activator
== thePlayer){
if (!thePlayer.IsActionAllowed(42) || thePlayer.IsInAir(
)){
return false;
}
if (horseComponent.IsInHorseAction() || !IsAlive()){
return false;
}
if (GetAttitudeBetween(this, thePlayer) == 2 && !HasBuff
(5) || HasBuff(36)){
return false;
}
if (mac.IsOnNavigableSpace()){
if (theGame.GetWorld().NavigationLineTest(activa
tor.GetWorldPosition(), GetWorldPosition(), 0.050000, false, true)){
if (theGame.TestNoCreaturesOnLine(activa
tor.GetWorldPosition(), GetWorldPosition(), 0.400000, (CActor)activator, this, t
rue)){
return true;
}
return false;
}
} else {
horseComp = GetHorseComponent();
if (horseComp){
horseComp.mountTestPlayerPos = activator
.GetWorldPosition();
horseComp.mountTestPlayerPos.Z += 0.5000
00;
horseComp.mountTestHorsePos = GetWorldPo
sition();
horseComp.mountTestHorsePos.Z += 0.50000
0;
if (!theGame.GetWorld().StaticTrace(hors
eComp.mountTestPlayerPos, horseComp.mountTestHorsePos, horseComp.mountTestEndPos
, horseComp.mountTestNormal, horseComp.mountTestCollisionGroups)){
return true;
}
}
return false;
}
}
return false;
/* NOP */;
}
public function OnInteractionTalkTest() : Bool{
return CanStartTalk();
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{

}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
}
public function OnBehaviorGraphNotification(notificationName : CName, st
ateName : CName) : Bool{
var i : Int32;
i = 0;
while (i < behaviorGraphEventListened.Size()){
if (behaviorGraphEventListened[i] == notificationName){
SignalGameplayEventParamCName(notificationName,
stateName);
}
i += 1;
}
super.OnBehaviorGraphNotification(notificationName, stateName);
/* NOP */;
}
public function ActivateSignalBehaviorGraphNotification(notificationName
: CName){
if (!behaviorGraphEventListened.Contains(notificationName)){
behaviorGraphEventListened.PushBack(notificationName);
}
/* NOP */;
}
public function DeactivateSignalBehaviorGraphNotification(notificationNa
me : CName){
behaviorGraphEventListened.Remove(notificationName);
/* NOP */;
}
public function IsShielded(target : CNode) : Bool{
var targetToSourceAngle : Float;
var protectionAngleLeft : Float;
var protectionAngleRight : Float;
if (target){
if (HasShieldedAbility() && IsGuarded()){
targetToSourceAngle = NodeToNodeAngleDistance(ta
rget, this);
protectionAngleLeft = CalculateAttributeValue(Ge
tAttributeValue('protection_angle_left', /* NOP */, /* NOP */), /* NOP */);
protectionAngleRight = CalculateAttributeValue(G
etAttributeValue('protection_angle_right', /* NOP */, /* NOP */), /* NOP */);
if (targetToSourceAngle < protectionAngleRight &
& targetToSourceAngle > protectionAngleLeft){
return true;
}
}
return false;
} else {
return HasShieldedAbility() && IsGuarded();
}
/* NOP */;
}
public function HasShieldedAbility() : Bool{
var attval : Float;
attval = CalculateAttributeValue(GetAttributeValue('shielded', /
* NOP */, /* NOP */), /* NOP */);
if (attval >= 1.000000){
return true;
} else {

return false;
}
/* NOP */;
}
public function RaiseShield(){
SetBehaviorVariable('bShieldUp', 1.000000, /* NOP */);
/* NOP */;
}
public timer function LowerShield(optional td : Float, optional id : Int
32){
SetBehaviorVariable('bShieldUp', 0.000000, /* NOP */);
/* NOP */;
}
public function ProcessShieldDestruction(){
var shield : CEntity;
if (HasTag('imlerith')){
return;
}
SetBehaviorVariable('bShieldbreak', 1.000000, /* NOP */);
AddEffectDefault(13, thePlayer, "ParryStagger", /* NOP */);
shield = GetInventory().GetItemEntityUnsafe(GetInventory().GetIt
emFromSlot('l_weapon'));
ToggleEffectOnShield('heavy_block', true);
DropItemFromSlot('l_weapon', true);
/* NOP */;
}
public function OnIncomingProjectile(isBomb : Bool) : Bool{
if (IsShielded(thePlayer)){
RaiseShield();
AddTimer('LowerShield', 3.000000, /* NOP */, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function ShouldAttackImmidiately() : Bool{
return tauntedToAttackTimeStamp > 0 && tauntedToAttackTimeStamp
+ 10 > theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function CanAttackKnockeddownTarget() : Bool{
var attval : Float;
attval = CalculateAttributeValue(GetAttributeValue('attackKnocke
ddownTarget', /* NOP */, /* NOP */), /* NOP */);
if (attval >= 1.000000){
return true;
} else {
return false;
}
/* NOP */;
}
public function OnProcessRequiredItemsFinish() : Bool{
var inv : CInventoryComponent;
var heldItems : array<CName>;
var heldItemsNames : array<CName>;
var mountedItems : array<CName>;
inv = GetInventory();
if (thePlayer.GetTarget() == this){
thePlayer.OnTargetWeaponDrawn();
}
SetBehaviorVariable('bIsGuarded', IsGuarded(), /* NOP */);

inv.GetAllHeldAndMountedItemsCategories(heldItems, mountedItems)
;
if (HasShieldedAbility()){
RaiseGuard();
}
inv.GetAllHeldItemsNames(heldItemsNames);
if (heldItemsNames.Contains('fists_lightning') || heldItemsNames
.Contains('fists_fire')){
PlayEffect('hand_fx', /* NOP */);
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(this, 'FireDanger', -1, 5.000000, 1, -1, true, true, /* NOP */);
} else {
StopEffect('hand_fx');
theGame.GetBehTreeReactionManager().RemoveReactionEvent(
this, 'FireDanger');
}
if (mountedItems.Contains('shield')){
AddAbility('CannotBeAttackedFromBehind', false);
LowerGuard();
} else {
RemoveAbility('CannotBeAttackedFromBehind');
}
/* NOP */;
}
public function ProcessSpearDestruction() : Bool{
var appearanceName : CName;
var shouldDrop : Bool;
var spear : CEntity;
appearanceName = 'broken';
spear = GetInventory().GetItemEntityUnsafe(GetInventory().GetIte
mFromSlot('r_weapon'));
spear.ApplyAppearance(appearanceName);
DropItemFromSlot('r_weapon', true);
return true;
/* NOP */;
}
public function PlayVitalSpotAmbientSound(soundEvent : String){
SoundEvent(soundEvent, 'pelvis', /* NOP */);
/* NOP */;
}
public function StopVitalSpotAmbientSound(soundEvent : String){
SoundEvent(soundEvent, 'pelvis', /* NOP */);
/* NOP */;
}
public function OnScriptReloaded() : Bool{
}
public function ChangeFightStage(fightStage : ENPCFightStage){
currentFightStage = fightStage;
SetCurrentFightStage();
/* NOP */;
}
public function SetCurrentFightStage(){
SetBehaviorVariable('npcFightStage', currentFightStage, true);
/* NOP */;
}
public function GetCurrentFightStage() : ENPCFightStage{
return currentFightStage;
/* NOP */;
}
public function SetBleedBurnPoison(){

wasBleedingBurningPoisoned = true;
/* NOP */;
}
public function WasBurnedBleedingPoisoned() : Bool{
return wasBleedingBurningPoisoned;
/* NOP */;
}
public function HasAlternateQuen() : Bool{
var npcStorage : CHumanAICombatStorage;
npcStorage = (CHumanAICombatStorage)GetAIStorageObject('CombatDa
ta');
if (npcStorage && npcStorage.IsProtectedByQuen()){
return true;
}
return false;
/* NOP */;
}
public function GetIsMonsterTypeGroup() : Bool{
return isMonsterType_Group;
/* NOP */;
}
public function UpdateAIVisualDebug(){
}
public function OnAllowBehGraphChange() : Bool{
allowBehGraphChange = true;
/* NOP */;
}
public function OnDisallowBehGraphChange() : Bool{
allowBehGraphChange = false;
/* NOP */;
}
public function OnObstacleCollision(object : CObject, physicalActorindex
: Int32, shapeIndex : Int32) : Bool{
var ent : CEntity;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
if ((CActor)ent != this){
SignalGameplayEventParamObject('CollisionWithObstacle',
ent);
}
/* NOP */;
}
public function OnActorCollision(object : CObject, physicalActorindex :
Int32, shapeIndex : Int32) : Bool{
var ent : CEntity;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
if (ent != this){
SignalGameplayEventParamObject('CollisionWithActor', ent
);
if (horseComponent){
horseComponent.OnCharacterCollision(ent);

}
}
/* NOP */;
}
public function OnActorSideCollision(object : CObject, physicalActorinde
x : Int32, shapeIndex : Int32) : Bool{
var ent : CEntity;
var horseComp : W3HorseComponent;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
if (ent != this){
SignalGameplayEventParamObject('CollisionWithActor', ent
);
if (horseComponent){
horseComponent.OnCharacterSideCollision(ent);
}
}
/* NOP */;
}
public function OnStaticCollision(component : CComponent) : Bool{
SignalGameplayEventParamObject('CollisionWithStatic', component)
;
/* NOP */;
}
public function OnBoatCollision(object : CObject, physicalActorindex : I
nt32, shapeIndex : Int32) : Bool{
var ent : CEntity;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
if (ent != this){
SignalGameplayEventParamObject('CollisionWithBoat', ent)
;
}
/* NOP */;
}
public function IsUnderwater() : Bool{
return isUnderwater;
/* NOP */;
}
public function ToggleIsUnderwater(toggle : Bool){
isUnderwater = toggle;
/* NOP */;
}
public function OnOceanTriggerEnter() : Bool{
SignalGameplayEvent('EnterWater');
/* NOP */;
}
public function OnOceanTriggerLeave() : Bool{
SignalGameplayEvent('LeaveWater');
/* NOP */;
}
public function OnInAirStarted() : Bool{

}
public function OnRagdollOnGround() : Bool{
var params : SCustomEffectParams;
if (GetIsFallingFromHorse()){
params.effectType = 65;
params.creator = this;
params.sourceName = "ragdoll_dismount";
params.duration = 0.500000;
AddEffectCustom(params);
SignalGameplayEvent('RagdollFromHorse');
SetIsFallingFromHorse(false);
} else if (IsInAir()){
SetIsInAir(false);
}
/* NOP */;
}
public function OnRagdollStart() : Bool{
var currentPri : EInteractionPriority;
currentPri = GetInteractionPriority();
if (currentPri != -2 && IsAlive()){
m_storedInteractionPri = currentPri;
SetInteractionPriority(-2);
}
/* NOP */;
}
public function OnNoLongerInRagdoll() : Bool{
aardedFlight = false;
if (m_storedInteractionPri != -1 && IsAlive()){
SetInteractionPriority(m_storedInteractionPri);
m_storedInteractionPri = -1;
}
/* NOP */;
}
public timer function DelayRagdollSwitch(optional td : Float, optional i
d : Int32){
var params : SCustomEffectParams;
if (IsInAir()){
isRagdollOn = true;
params.effectType = 65;
params.duration = 5;
AddEffectCustom(params);
}
/* NOP */;
}
public function OnRagdollIsAwayFromCapsule(ragdollPosition : Vector, ent
ityPosition : Vector) : Bool{
}
public function OnRagdollCloseToCapsule(ragdollPosition : Vector, entity
Position : Vector) : Bool{
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
var abilityName : CName;
var abilityCount : Float;
var maxStack : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var addAbility : Bool;
var witcher : W3PlayerWitcher;
super.OnTakeDamage(action);
if (action.IsActionMelee() && action.DealsAnyDamage()){

witcher = (W3PlayerWitcher)action.attacker;
if (witcher && witcher.HasBuff(82)){
abilityName = thePlayer.GetBuff(82, /* NOP */).G
etAbilityName();
abilityCount = thePlayer.GetAbilityCount(ability
Name);
if (abilityCount == 0){
addAbility = true;
} else {
theGame.GetDefinitionsManager().GetAbili
tyAttributeValue(abilityName, 'mutagen10_max_stack', min, max);
maxStack = CalculateAttributeValue(GetAt
tributeRandomizedValue(min, max), /* NOP */);
if (maxStack >= 0){
addAbility = abilityCount < maxS
tack;
} else {
addAbility = true;
}
}
if (addAbility){
thePlayer.AddAbility(abilityName, true);
}
}
}
if (action.IsActionMelee()){
lastMeleeHitTime = theGame.GetEngineTime();
}
/* NOP */;
}
public function GetInteractionData(actionName : CName, text : String) :
Bool{
if (CanStartTalk() && !IsInCombat()){
actionName = 'Talk';
text = "panel_button_common_talk";
return true;
}
return false;
/* NOP */;
}
public function IsAtWorkDependentOnFireSource() : Bool{
if (IsAPValid(super.GetActiveActionPoint())){
return theGame.GetAPManager().IsFireSourceDependent(supe
r.GetActiveActionPoint());
}
return false;
/* NOP */;
}
public function FinishQuen(){
SignalGameplayEvent('FinishQuen');
/* NOP */;
}
public function IsAxiied() : Bool{
return HasBuff(36) || HasBuff(5);
/* NOP */;
}
}
import statemachine struct W3HorseComponent{
public var lastRider : CActor;

public var originalAttitudeGroup : CName;


public var canDismount : Bool;
public var inCanter : Bool;
public var inGallop : Bool;
public var inputApplied : Bool;
public var controllable : Bool;
private var physMAC : CMovingPhysicalAgentComponent;
private var pitchDamp : SpringDamper;
private var localSpaceControlls : Bool;
private var useSimpleStaminaManagement : Bool;
private var isInCustomSpot : Bool;
private var ignoreTestsCounter : Int32;
private var manualControl : Bool;
private var canFollowNpc : Bool;
private var horseComponentToFollow : W3HorseComponent;
private var potentiallyWild : Bool;
private var canTakeDamageFromFalling : Bool;
public var mountTestPlayerPos : Vector;
public var mountTestHorsePos : Vector;
public var mountTestEndPos : Vector;
public var mountTestNormal : Vector;
public var mountTestCollisionGroups : array<CName>;
public var hideHorse : Bool;
public var killHorse : Bool;
private saved var isMountableByPlayer : Bool;
public var cameraMode : Int32;
protected var inWater : Bool;
protected var isInIdle : Bool;
private var isInHorseAction : Bool;
private saved var firstSpawn : Bool;
private var panicDamper : SpringDamper;
private saved var panicMult : Float;
public const var PANIC_RANGE : Float;
public const var THREAT_MULT : Float;
private var staticPanic : Int32;
private var frontHit : Bool;
private var backHit : Bool;
private var frontLeg : Vector;
private var backLeg : Vector;
protected var currentPitch : Float;
private var horseActor : CActor;
private var panicVibrate : Bool;
private var collidedActors : array<CollsionActorStruct>;
//NULL type for riderSharedParams
import public final function PairWithRider(inRiderSharedParams : CHorseR
iderSharedParams) : Bool;
import public final function Unpair();
import public final function IsTamed() : Bool;
import public final function IsDismounted() : Bool;
import public final function IsFullyMounted() : Bool;
private function InitPanicDamper(){
var vehEnt : CActor;
var panicVal : Float;
vehEnt = (CActor)GetEntity();
if (vehEnt){
panicVal = staticPanic;
panicDamper = new SpringDamper in this;
panicDamper.Init(panicVal, panicVal);
panicDamper.SetSmoothTime(1.600000);
}

/* NOP */;
}
public function SetPanicMult(mult : Float){
panicMult = mult;
/* NOP */;
}
public function IsPlayerHorse() : Bool{
return GetEntity().HasTag('playerHorse');
/* NOP */;
}
public function SetMountableByPlayer(isMountable : Bool){
isMountableByPlayer = isMountable;
horseActor.GetComponent("horseMount").SetEnabled(isMountable);
/* NOP */;
}
public function OnInit() : Bool{
var horseActor : CActor;
var horseNPC : CNewNPC;
var items : array<SItemUniqueId>;
super.OnInit();
if (thePlayer){
thePlayer.MountHorseIfNeeded();
}
if (!pitchDamp){
pitchDamp = new SpringDamper in this;
pitchDamp.SetSmoothTime(0.200000);
}
horseActor = (CActor)GetEntity();
horseActor.AddAnimEventChildCallback(this, 'ActionBlend', 'OnAni
mEvent_ActionBlend');
horseActor.AddAnimEventChildCallback(this, 'JumpFailed', 'OnAnim
Event_JumpFailed');
horseNPC = (CNewNPC)GetEntity();
horseNPC.SetIsHorse();
if (horseActor.GetAttitudeGroup() == 'animals_peacefull'){
potentiallyWild = true;
}
pitchDamp.Init(0.000000, 0.000000);
physMAC = (CMovingPhysicalAgentComponent)GetEntity().GetRootAnim
atedComponent();
physMAC.SetBehaviorCallbackNeed(false);
LogAssert(physMAC, "Horse doesn't have a CMovingPhysicalAgentCom
ponent");
physMAC.RegisterEventListener(this);
physMAC.SetSlidingLimits(0.450000, 0.700000);
physMAC.SetSlidingSpeed(25.000000);
physMAC.SetSliding(true);
physMAC.EnableAdditionalVerticalSlidingIteration(true);
InitPanicDamper();
mountTestCollisionGroups.PushBack('Terrain');
mountTestCollisionGroups.PushBack('Static');
mountTestCollisionGroups.PushBack('Destructible');
if (horseActor.HasTag('playerHorse')){
items = horseActor.GetInventory().GetItemsByCategory('ho
rse_hair');
if (items.Size() == 0){
items = horseActor.GetInventory().AddAnItem('Hor
se Hair 0', /* NOP */, /* NOP */, /* NOP */, /* NOP */);
horseActor.GetInventory().MountItem(items[0], /*
NOP */, /* NOP */);

}
}
if (IsPlayerHorse() && firstSpawn && FactsQuerySum("NewGamePlus"
) > 0){
horseNPC.SetAppearance('player_horse');
}
firstSpawn = false;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
Mount(thePlayer, 2, 0);
/* NOP */;
}
public function OnMountStarted(entity : CEntity, vehicleSlot : EVehicleS
lot) : Bool{
var horseActor : CActor;
horseActor = (CActor)GetEntity();
lastRider = (CActor)entity;
horseActor.GetComponent("horseMount").SetEnabled(false);
if (entity == thePlayer){
thePlayer._SetHorseCurrentlyMounted((CNewNPC)GetEntity()
);
horseActor.SetInteractionPriority(12);
}
horseActor.AddBuffImmunity(36, 'BeingMounted', true);
if (entity != thePlayer){
horseActor.AddBuffImmunity(5, 'BeingMounted', true);
}
super.OnMountStarted(entity, vehicleSlot);
/* NOP */;
}
public function OnMountFinished(entity : CEntity) : Bool{
var horseActor : CActor;
var riderActor : CActor;
var movingAgent : CMovingAgentComponent;
horseActor = (CActor)GetEntity();
riderActor = (CActor)entity;
super.OnMountFinished(entity);
if (IsTamed()){
originalAttitudeGroup = horseActor.GetBaseAttitudeGroup(
);
horseActor.SetBaseAttitudeGroup(riderActor.GetBaseAttitu
deGroup());
}
if (riderActor == thePlayer){
thePlayer.SetIsHorseMounted(true);
horseActor.CanPush(true);
movingAgent = horseActor.GetMovingAgentComponent();
if (movingAgent){
movingAgent.SnapToNavigableSpace(false);
movingAgent.AddTriggerActivatorChannel(256);
}
horseActor.EnablePhysicalMovement(true);
}
/* NOP */;
}
public function OnDismountStarted(entity : CEntity) : Bool{
if (entity == thePlayer && userCombatManager){
userCombatManager.OnDismountStarted();

}
userCombatManager = NULL;
DecrementIgnoreTestsCounter(true);
super.OnDismountStarted(entity);
/* NOP */;
}
public function OnHorseDismount() : Bool{
}
public function OnSettlementEnter() : Bool{
}
public function OnSettlementExit() : Bool{
}
public function OnDismountFinished(entity : CEntity, vehicleSlot : EVehi
cleSlot) : Bool{
var horseActor : CActor;
var riderActor : CActor;
var horseComp : W3HorseComponent;
var movingAgent : CMovingAgentComponent;
super.OnDismountFinished(entity, vehicleSlot);
riderActor = (CActor)entity;
horseActor = (CActor)GetEntity();
if (isMountableByPlayer){
horseActor.GetComponent("horseMount").SetEnabled(true);
}
if (riderActor == thePlayer){
thePlayer._SetHorseCurrentlyMounted(NULL);
thePlayer.SetIsHorseMounted(false);
movingAgent = horseActor.GetMovingAgentComponent();
if (movingAgent){
if (movingAgent.IsOnNavigableSpace()){
movingAgent.SnapToNavigableSpace(true);
}
movingAgent.RemoveTriggerActivatorChannel(256);
}
horseActor.RestoreOriginalInteractionPriority();
horseActor.CanPush(true);
horseActor.EnablePhysicalMovement(false);
}
horseActor = (CActor)GetEntity();
horseActor.RemoveBuffImmunity(36, 'BeingMounted');
horseActor.RemoveBuffImmunity(5, 'BeingMounted');
if (hideHorse){
hideHorse = false;
HideHorse();
} else if (killHorse){
killHorse = false;
KillHorse();
}
/* NOP */;
}
public function GetCurrentPitch() : Float{
return currentPitch;
/* NOP */;
}
public function OnFrontLeg(pos : Vector, normal : Vector) : Bool{
frontHit = true;
frontLeg = pos;
/* NOP */;
}
public function OnBackLeg(pos : Vector, normal : Vector) : Bool{

backHit = true;
backLeg = pos;
/* NOP */;
}
public function ShouldTickInIdle() : Bool{
return lastRider == thePlayer;
/* NOP */;
}
public function OnTick(dt : Float) : Bool{
var rot : EulerAngles;
var lastRiderPlayer : Bool;
horseActor = (CActor)GetEntity();
if (frontHit && backHit){
rot = VecToRotation(VecNormalize(backLeg - frontLeg));
currentPitch = rot.Pitch;
} else if (frontHit){
currentPitch += 5.000000;
} else if (backHit){
currentPitch -= 5.000000;
}
physMAC.SetVirtualControllersPitch(Deg2Rad(pitchDamp.UpdateAndGe
t(dt, currentPitch)));
UpdateCollision();
frontHit = false;
backHit = false;
lastRiderPlayer = lastRider == thePlayer;
UpdatePanic(dt);
if (lastRiderPlayer && riderSharedParams.rider && riderSharedPar
ams.rider.IsInCombat() && !horseActor.HasAbility('HorseAxiiBuff') && !horseActor
.HasAbility('DisableHorsePanic')){
horseActor.PauseEffects(66, 'RiderInCombat', true, /* NO
P */, /* NOP */);
} else {
horseActor.ResumeEffects(66, 'RiderInCombat');
}
/* NOP */;
}
private function UpdateCollision(){
var npc : CNewNPC;
var mac : CMovingPhysicalAgentComponent;
var collidedWithRider : Bool;
var collisionData : SCollisionData;
var collisionNum : Int32;
var i : Int32;
var horseComp : W3HorseComponent;
if (!horseActor){
return;
}
mac = (CMovingPhysicalAgentComponent)horseActor.GetMovingAgentCo
mponent();
if (!mac){
return;
}
collisionNum = mac.GetCollisionCharacterDataCount();
i = 0;
while (i < collisionNum){
collisionData = mac.GetCollisionCharacterData(i);
npc = (CNewNPC)collisionData.entity;
if (npc){
MakeNPCCollide(npc);

}
i += 1;
}
/* NOP */;
}
private function MakeNPCCollide(npc : CNewNPC){
npc.SignalGameplayEvent('AI_GetOutOfTheWay');
if (lastRider == thePlayer){
npc.SignalGameplayEventParamObject('CollideWithPlayer',
thePlayer);
} else {
npc.SignalGameplayEventParamObject('CollideWithPlayer',
GetEntity());
}
theGame.GetBehTreeReactionManager().CreateReactionEvent(npc, 'Bu
mpAction', 1, 1, 1, 1, false, /* NOP */);
/* NOP */;
}
private function UpdatePanic(dt : Float){
var entities : array<CGameplayEntity>;
var maxThreat : Int32;
var i : Int32;
var tempThreat : Float;
var totalThreat : Float;
var npc : CNewNPC;
if (!panicDamper){
return;
}
if (ShouldUpdatePanic()){
FindGameplayEntitiesInCylinder(entities, horseActor.GetW
orldPosition(), PANIC_RANGE, 5.000000, CeilF(100 / THREAT_MULT) + 1, 'None', 1 +
32 + 256 + 4, horseActor, /* NOP */);
i = 0;
while (i < entities.Size()){
npc = (CNewNPC)entities[i];
tempThreat = npc.GetThreatLevel();
if (npc.IsHorse()){
continue;
} else if (npc.IsHuman()){
totalThreat += tempThreat / 4;
} else {
totalThreat += tempThreat;
}
i += 1;
}
} else {
totalThreat = 0.000000;
}
staticPanic = RoundF(totalThreat * THREAT_MULT * panicMult);
staticPanic = RoundF(panicDamper.UpdateAndGet(dt, staticPanic));
if (panicVibrate || GetPanicPercent() >= 0.900000 && thePlayer.G
etUsedHorseComponent() == this){
panicVibrate = true;
theGame.VibrateControllerHard(/* NOP */);
}
if (panicVibrate && GetPanicPercent() < 0.900000 || thePlayer.Ge
tUsedHorseComponent() != this){
panicVibrate = false;
}
/* NOP */;

}
private function ShouldUpdatePanic() : Bool{
var horseActor : CActor;
horseActor = (CActor)GetEntity();
return !horseActor.HasAbility('HorseAxiiBuff') && !horseActor.Ha
sBuff(5) && !horseActor.HasBuff(36) && !horseActor.HasAbility('DisableHorsePanic
') && !thePlayer.HasBuff(97);
/* NOP */;
}
private function ResetPanicUpdate(){
if (staticPanic > 0.000000){
staticPanic = 0;
panicDamper.Init(staticPanic, staticPanic);
}
/* NOP */;
}
public function ResetPanic(){
var actor : CActor;
actor = (CActor)GetEntity();
actor.GainStat(7, actor.GetStatMax(7));
/* NOP */;
}
public function GetPanicPercent() : Float{
var actor : CActor;
var panic : Float;
var maxPanic : Float;
actor = (CActor)GetEntity();
maxPanic = actor.GetStatMax(7);
panic = staticPanic + maxPanic - actor.GetStat(7, /* NOP */);
panic = panic / maxPanic;
return panic;
/* NOP */;
}
public function IsPotentiallyWild() : Bool{
return potentiallyWild;
/* NOP */;
}
public function OnPredictionCollision(pos : Vector, normal : Vector, dis
p : Vector, penetration : Float, actorHeight : Float, diffZ : Float, fromVirtual
Controller : Bool) : Bool{
}
public function OnHeadPredictionCollision(pos : Vector, normal : Vector,
disp : Vector, penetration : Float, actorHeight : Float, diffZ : Float, fromVir
tualController : Bool) : Bool{
}
public function OnFrontPredictionCollision(pos : Vector, normal : Vector
, disp : Vector, penetration : Float, actorHeight : Float, diffZ : Float, fromVi
rtualController : Bool) : Bool{
}
public function OnBackPredictionCollision(pos : Vector, normal : Vector,
disp : Vector, penetration : Float, actorHeight : Float, diffZ : Float, fromVir
tualController : Bool) : Bool{
}
public function OnCharacterCollision(entity : CEntity) : Bool{
var actorEntity : CActor;
actorEntity = (CActor)entity;
if (actorEntity){
ShouldDealDamageToActor(actorEntity, false);
}
/* NOP */;

}
public function OnCharacterSideCollision(entity : CEntity) : Bool{
var actorEntity : CActor;
actorEntity = (CActor)entity;
if (actorEntity){
ShouldDealDamageToActor(actorEntity, true);
}
/* NOP */;
}
public function ShouldDealDamageToActor(collidedActor : CActor, sideColl
ision : Bool){
var attacker : CActor;
attacker = GetCurrentUser();
if (!attacker){
attacker = (CActor)GetEntity();
}
if (IsRequiredAttitudeBetween(attacker, collidedActor, true, /*
NOP */, /* NOP */)){
if (collidedActor.IsUsingHorse(/* NOP */) || (CNewNPC)co
llidedActor.IsHorse()){
return;
} else if (super.InternalGetSpeed() >= 3.000000){
DealDamageToCollidedActor(attacker, collidedActo
r, sideCollision);
}
}
/* NOP */;
}
public function ReactToQuen(){
var damageAction : W3DamageAction;
if (super.InternalGetSpeed() > 0.000000){
if (GetWitcherPlayer().IsQuenActive(true)){
damageAction = new W3DamageAction in this;
damageAction.Initialize((CGameplayEntity)GetEnti
ty(), thePlayer, this, "ReactToQuen", 0, 2, true, false, false, false, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
damageAction.AddDamage(theGame.params.DAMAGE_NAM
E_PHYSICAL, 0.000000);
theGame.damageMgr.ProcessAction(damageAction);
delete damageAction;
ShakeOffRider(2);
thePlayer.FinishQuen();
}
}
/* NOP */;
}
private function DealDamageToCollidedActor(owner : CActor, collidedActor
: CActor, sideCollision : Bool){
var itemId : SItemUniqueId;
var action : W3Action_Attack;
var horse : CActor;
var collisionData : CollsionActorStruct;
horse = (CActor)GetEntity();
itemId = horse.GetInventory().GetItemFromSlot('r_weapon');
if (!horse.GetInventory().IsIdValid(itemId)){
return;
}
if (!CanCollideWithThisActor(collidedActor)){
return;
}

if (!sideCollision || collidedActor.HasBuff(9) || collidedActor.


HasBuff(6)){
action = new W3Action_Attack in theGame.damageMgr;
action.Init(owner, collidedActor, horse, itemId, 'attack
_speed_based', horse.GetName(), 2, false, false, 'attack_speed_based', 4, 0, tru
e, false, false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_PHYSICAL, 50
.000000 * MaxF(super.InternalGetSpeed(), 1));
theGame.damageMgr.ProcessAction(action);
delete action;
}
collisionData.actor = collidedActor;
collisionData.timestamp = theGame.GetEngineTimeAsSeconds();
collidedActors.PushBack(collisionData);
/* NOP */;
}
private function CanCollideWithThisActor(actor : CActor) : Bool{
var i : Int32;
i = collidedActors.Size() - 1;
while (i >= 0){
if (collidedActors[i].timestamp + 1.000000 < theGame.Get
EngineTimeAsSeconds()){
collidedActors.Erase(i);
} else if (collidedActors[i].actor == actor){
return false;
}
i -= 1;
}
return true;
/* NOP */;
}
public final function InternalSetRotation(value : Float){
SetVariable('rotation', value);
/* NOP */;
}
public final function InternalGetRotation() : Float{
return GetVariable('rotation');
/* NOP */;
}
public final function InternalSetDirection(value : Float){
SetVariable('direction', value);
/* NOP */;
}
public final function InternalGetDirection() : Float{
return GetVariable('direction');
/* NOP */;
}
public final function InternalSetSpeed(value : Float){
(CActor)GetEntity().GetMovingAgentComponent().SetGameplayRelativ
eMoveSpeed(value);
SetVariable('speed', value);
/* NOP */;
}
public final function InternalGetSpeed() : Float{
return (CActor)GetEntity().GetMovingAgentComponent().GetRelative
MoveSpeed();
/* NOP */;
}
public final function InternalSetSpeedMultiplier(value : Float){
SetVariable('horseSpeedMult', value);

/* NOP */;
}
public final function GetHorseVelocitySpeed() : Float{
return VecLength2D((CActor)GetEntity().GetMovingAgentComponent()
.GetVelocity());
/* NOP */;
}
public final function InternalResetVariables(){
InternalSetRotation(0.000000);
InternalSetDirection(0.000000);
InternalSetSpeed(0.000000);
/* NOP */;
}
public final function StopTheVehicle(){
var tmpActor : CActor;
tmpActor = (CActor)GetEntity();
tmpActor.SignalGameplayEvent('OnStopHorse');
/* NOP */;
}
public function OnStopTheVehicleInstant() : Bool{
var tmpActor : CActor;
var tmpRider : CActor;
tmpRider = user;
tmpActor = (CActor)GetEntity();
super.InternalSetSpeed(0.000000);
tmpRider.RaiseForceEventWithoutTestCheck('ForceIdle');
tmpActor.RaiseForceEventWithoutTestCheck('ForceIdle');
/* NOP */;
}
public function OnForceStop() : Bool{
}
public function OnHorseStop() : Bool{
}
public function SetManualControl(val : Bool){
manualControl = val;
/* NOP */;
}
public function GetManualControl() : Bool{
return manualControl;
/* NOP */;
}
public function SetIsInCustomSpot(val : Bool){
isInCustomSpot = val;
/* NOP */;
}
public function IsInCustomSpot() : Bool{
return isInCustomSpot;
/* NOP */;
}
public function IncrementIgnoreTestsCounter(){
ignoreTestsCounter += 1;
/* NOP */;
}
public function DecrementIgnoreTestsCounter(reset : Bool){
if (reset){
ignoreTestsCounter = 0;
return;
}
if (ignoreTestsCounter > 0){
ignoreTestsCounter -= 1;

}
/* NOP */;
}
public function ShouldIgnoreTests() : Bool{
return ignoreTestsCounter > 0;
/* NOP */;
}
public function SetCanFollowNpc(val : Bool, horseComp : W3HorseComponent
){
canFollowNpc = val;
horseComponentToFollow = horseComp;
/* NOP */;
}
public function CanFollowNpc() : Bool{
return canFollowNpc;
/* NOP */;
}
public function SetCanTakeDamageFromFalling(val : Bool){
canTakeDamageFromFalling = val;
/* NOP */;
}
public function CanTakeDamageFromFalling() : Bool{
return canTakeDamageFromFalling;
/* NOP */;
}
public function GetHorseComponentToFollow() : W3HorseComponent{
return horseComponentToFollow;
/* NOP */;
}
public function ToggleLocalSpaceControlls(toggle : Bool){
localSpaceControlls = toggle;
/* NOP */;
}
public function IsControllableInLocalSpace() : Bool{
return localSpaceControlls;
/* NOP */;
}
public function ToggleSimpleStaminaManagement(toggle : Bool){
useSimpleStaminaManagement = toggle;
/* NOP */;
}
public function ShouldUseSimpleStaminaManagement() : Bool{
return useSimpleStaminaManagement;
/* NOP */;
}
public function GetCurrentUser() : CActor{
return user;
/* NOP */;
}
public function GetLastRider() : CActor{
return lastRider;
/* NOP */;
}
public function ShakeOffRider(dismountType : EDismountType){
if (user == thePlayer){
IssueCommandToDismount(dismountType);
} else {
user.SignalGameplayEventParamInt('RidingManagerDismountH
orse', dismountType | 1024);
}

/* NOP */;
}
public function IsNotBeingUsed() : Bool{
return riderSharedParams.mountStatus == 3;
/* NOP */;
}
public function OnJumpHack() : Bool{
}
public function Tame(owner : CActor, tame : Bool){
var horseActor : CActor;
horseActor = (CActor)GetEntity();
if (tame && super.IsTamed() == false){
horseActor.SetBaseAttitudeGroup(owner.GetBaseAttitudeGro
up());
horseActor.ResetAttitude(owner);
}
if (tame == false && super.IsTamed()){
horseActor.SetBaseAttitudeGroup('animals_peacefull');
}
/* NOP */;
}
public function OnHideHorse() : Bool{
if (user){
if (user == thePlayer){
IssueCommandToDismount(8);
} else {
user.SignalGameplayEventParamInt('RidingManagerD
ismountHorse', 8 | 1024);
}
hideHorse = true;
} else {
HideHorse();
}
/* NOP */;
}
public function HideHorse(){
OnHitGround();
(CNewNPC)GetEntity().HideHorseAfter(0.100000);
/* NOP */;
}
public function OnKillHorse() : Bool{
if (user){
if (user == thePlayer){
IssueCommandToDismount(8);
} else {
user.SignalGameplayEventParamInt('RidingManagerD
ismountHorse', 8 | 1024);
}
killHorse = true;
} else {
KillHorse();
}
/* NOP */;
}
public function KillHorse(){
(CNewNPC)GetEntity().KillHorseAfter(0.100000);
/* NOP */;
}
public function OnHitGround() : Bool{
var horseActor : CActor;

horseActor = (CActor)GetEntity();
SetVariable('onGround', 1.000000);
(CMovingPhysicalAgentComponent)horseActor.GetComponentByClassNam
e('CMovingPhysicalAgentComponent').SetAnimatedMovement(false);
horseActor.SetIsInAir(false);
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
if (user.IsInCombat()){
user.SignalGameplayEventParamInt('RidingManagerDismountH
orse', 2);
}
/* NOP */;
}
public function OnRiderWantsToMount() : Bool{
GetEntity().GetComponentByClassName('CInteractionComponent').Set
Enabled(false);
/* NOP */;
}
public function OnAnimationStarted(entity : CEntity, animation : CName)
: Bool{
var ac : CAnimatedComponent;
var ass : SAnimatedComponentSlotAnimationSettings;
ac = GetEntity().GetRootAnimatedComponent();
if (ac){
ResetAnimatedComponentSlotAnimationSettings(ass);
ass.blendIn = 0.900000;
ass.blendOut = 0.200000;
if (!ac.PlaySlotAnimationAsync(animation, 'HORSE_MOUNT',
ass)){
/* NOP */;
}
}
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
}
public function OnCriticalEffectAdded(criticalEffect : ECriticalStateTyp
e) : Bool{
}
public function OnOceanTriggerEnter() : Bool{
inWater = true;
/* NOP */;
}
public function OnOceanTriggerLeave() : Bool{
inWater = false;
/* NOP */;
}
public function OnIdleBegin() : Bool{
isInIdle = true;
ToggleHorseAction(false);
/* NOP */;
}
public function OnIdleEnd() : Bool{
isInIdle = false;
/* NOP */;
}
public function OnHorseActionStart() : Bool{
ToggleHorseAction(true);
/* NOP */;

}
public function OnHorseActionStop() : Bool{
ToggleHorseAction(false);
/* NOP */;
}
public function OnHorseFastStopBegin() : Bool{
}
public function OnHorseFastStopEnd() : Bool{
}
public function OnAnimEvent_ActionBlend(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (IsInHorseAction() && animEventType == 1){
ToggleHorseAction(false);
}
/* NOP */;
}
public function OnAnimEvent_JumpFailed(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
public function OnSmartDismount() : Bool{
}
protected function ToggleHorseAction(start : Bool){
if (start){
isInHorseAction = true;
if (userCombatManager){
userCombatManager.OnHorseActionStart();
}
} else if (!start && isInHorseAction){
isInHorseAction = false;
if (userCombatManager){
userCombatManager.OnHorseActionStop();
}
}
/* NOP */;
}
public function OnCheckHorseJump() : Bool{
return false;
/* NOP */;
}
public function IsInHorseAction() : Bool{
return isInHorseAction;
/* NOP */;
}
public function OnEnableCanter() : Bool{
GetEntity().SetBehaviorVariable('isCanterEnabled', 1.000000, /*
NOP */);
/* NOP */;
}
public function OnCanGallop() : Bool{
return false;
/* NOP */;
}
public function OnCanCanter() : Bool{
return false;
/* NOP */;
}
}
import struct CItemEntity{
import public final function GetMeshComponent() : CComponent;

import
import
import
public

public final function GetParentEntity() : CEntity;


public final function GetItemCategory() : CName;
public final function GetItemTags(tags : array<CName>);
function OnGrab() : Bool{
SetupDrawHolsterSounds();
/* NOP */;

}
public function OnPut() : Bool{
SetupDrawHolsterSounds();
/* NOP */;
}
public function OnAttachmentUpdate(parentEntity : CEntity, itemName : CN
ame) : Bool{
var actorParent : CActor;
var dm : CDefinitionsManagerAccessor;
actorParent = (CActor)parentEntity;
if (actorParent){
if (theGame && actorParent.IsHuman()){
if (itemName != 'None'){
dm = theGame.GetDefinitionsManager();
if (dm){
if (2 == dm.GetFilterTypeByItem(
itemName)){
actorParent.AddTimer('De
laySoundInfoUpdate', 1, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
} else {
actorParent.AddTimer('DelaySoundInfoUpda
te', 1, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
}
/* NOP */;
}
public function SetupDrawHolsterSounds(){
var parentEntity : CEntity;
var identification : CName;
var component : CComponent;
parentEntity = super.GetParentEntity();
if (parentEntity){
component = super.GetMeshComponent();
if (component){
identification = GetMeshSoundTypeIdentification(
component);
parentEntity.SoundSwitch("weapon_type", identifi
cation, /* NOP */, /* NOP */);
identification = GetMeshSoundSizeIdentification(
component);
parentEntity.SoundSwitch("weapon_size", identifi
cation, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnItemCollision(object : CObject, physicalActorindex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CActor;
var owner : CActor;
var ent : CEntity;

var component : CComponent;


component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
owner = (CActor)super.GetParentEntity();
if (ent != this && owner && ent != owner){
victim = (CActor)component.GetEntity();
if (victim){
if (physicalActorindex == 0 && shapeIndex == 0 &
& (CMovingAgentComponent)component.HasRagdoll()){
return false;
}
owner.OnCollisionFromItem(victim, this);
}
return true;
}
/* NOP */;
}
}
class CBaseAICombatStorage extends CObject{
private var isAttacking : Bool;
private var isCharging : Bool;
private var isTaunting : Bool;
private var isShooting : Bool;
private var isAiming : Bool;
private var preCombatWarning : Bool;
protected var atackTimeStamp : Float;
protected var tauntTimeStamp : Float;
private var CSArray : array<CriticalStateStruct>;
public function SetIsAttacking(value : Bool, timeStamp : Float){
isAttacking = value;
if (value && timeStamp){
atackTimeStamp = timeStamp;
}
/* NOP */;
}
public function GetIsAttacking() : Bool{
return isAttacking;
/* NOP */;
}
public function SetIsCharging(value : Bool){
isCharging = value;
/* NOP */;
}
public function GetIsCharging() : Bool{
return isCharging;
/* NOP */;
}
public function SetIsTaunting(value : Bool, timeStamp : Float){
isTaunting = value;
if (value && timeStamp){
tauntTimeStamp = timeStamp;
}
/* NOP */;
}
public function GetIsTaunting() : Bool{
return isTaunting;

/* NOP */;
}
public function GetTauntTimeStamp() : Float{
return tauntTimeStamp;
/* NOP */;
}
public function SetIsShooting(value : Bool){
isShooting = value;
/* NOP */;
}
public function SetIsAiming(value : Bool){
isAiming = value;
/* NOP */;
}
public function GetIsShooting() : Bool{
return isShooting;
/* NOP */;
}
public function GetIsAiming() : Bool{
return isAiming;
/* NOP */;
}
public function SetPreCombatWarning(value : Bool){
preCombatWarning = value;
/* NOP */;
}
public function GetPreCombatWarning() : Bool{
return preCombatWarning;
/* NOP */;
}
public function SetCriticalState(cstate : ECriticalStateType, value : Bo
ol, timeOfChange : Float){
var i : Int32;
i = 0;
while (i < CSArray.Size()){
if (CSArray[i].CSType == cstate){
CSArray[i].isActive = value;
if (!value){
CSArray[i].lastTimeActive = timeOfChange
;
}
}
i += 1;
}
/* NOP */;
}
public function GetCriticalState(cstate : ECriticalStateType) : Bool{
var i : Int32;
i = 0;
while (i < CSArray.Size()){
if (CSArray[i].CSType == cstate){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetTimeOfLastCSDeactivation(cstate : ECriticalStateType)
: Float{

var i : Int32;
i = 0;
while (i < CSArray.Size()){
if (CSArray[i].CSType == cstate){
return CSArray[i].lastTimeActive;
}
i += 1;
}
return 0;
/* NOP */;
}
public function Init(){
var temp : CriticalStateStruct;
temp.CSType = 9;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 0;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 2;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 1;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 6;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 8;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 5;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 4;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 3;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 10;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 14;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
temp.CSType = 15;
temp.isActive = false;
temp.lastTimeActive = 0;

CSArray.PushBack(temp);
temp.CSType = 17;
temp.isActive = false;
temp.lastTimeActive = 0;
CSArray.PushBack(temp);
/* NOP */;
}
}
state CNewNPCStateNewIdle in CNewNPC extends CNewNPCStateBase{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
IdleInit();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function IdleInit(){
parent.ActivateAndSyncBehavior('Exploration', /* NOP */);
StateIdle();
/* NOP */;
}
public latent function StateIdle(){
while (true){
Sleep(10.000000);
}
/* NOP */;
}
}
import state CNewNPCStateBase in CNewNPC{
public function OnEnterState(prevStateName : CName) : Bool{
parent.ActionCancelAll();
/* NOP */;
}
}
import state CNewNPCStateReactingBase in CNewNPC{
}
state CNewNPCStateDrinkingBartender in CNewNPC extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.DisableLookAt();
DrinkingBartenderStateInit();
/* NOP */;
}
public entry function DrinkingBartenderStateInit(){
parent.ActivateAndSyncBehavior('npc_drinking_minigame_bartender'
, /* NOP */);
/* NOP */;
}
}
state CNewNPCStateDrinkingNPCContestant in CNewNPC extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.DisableLookAt();
DrinkingNPCContestantStateInit();
/* NOP */;

}
public entry function DrinkingNPCContestantStateInit(){
parent.ActivateAndSyncBehavior('drinking_contestant', /* NOP */)
;
/* NOP */;
}
}
struct SDroppedItem{
var entity : CEntity;
var itemName : CName;
}
struct SBuffImmunity{
saved var buffType : EEffectType;
saved var sources : array<CName>;
}
class CBaseGameplayEffect extends CObject{
protected var timeActive : Float;
protected saved var initialDuration : Float;
protected var duration : Float;
protected var timeLeft : Float;
protected var pauseCounters : array<SBuffPauseLock>;
protected var isActive : Bool;
private var resistStat : ECharacterDefenseStats;
protected var resistance : Float;
protected var creatorPowerStat : SAbilityAttributeValue;
protected var isPausedDuringDialogAndCutscene : Bool;
protected var dontAddAbilityOnTarget : Bool;
protected var canBeAppliedOnDeadTarget : Bool;
protected var effectManager : W3EffectManager;
protected var isPositive : Bool;
protected var isNeutral : Bool;
protected var isNegative : Bool;
protected var isOnPlayer : Bool;
protected var isSignEffect : Bool;
protected var isPotionEffect : Bool;
protected var abilityName : CName;
protected var attributeName : CName;
protected const var effectType : EEffectType;
protected var target : CActor;
protected var creatorHandle : EntityHandle;
protected var effectValue : SAbilityAttributeValue;
protected var potionItemName : CName;
protected var deny : array<EEffectType>;
protected var override : array<EEffectType>;
protected var sourceName : String;
protected var cameraEffectName : CName;
protected var isPlayingCameraEffect : Bool;
protected var switchCameraEffect : Bool;
protected var isCameraEffectNameValid : Bool;
protected var iconPath : String;
protected var showOnHUD : Bool;
protected var effectNameLocalisationKey : String;
protected var effectDescriptionLocalisationKey : String;
protected var targetEffectName : CName;
protected var shouldPlayTargetEffect : Bool;
private var onAddedSound : CName;
private var onRemovedSound : CName;

protected var vibratePadLowFreq : Float;


protected var vibratePadHighFreq : Float;
public function Init(params : SEffectInitInfo){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var null : SAbilityAttributeValue;
var durationSet : Bool;
var points : Float;
var dm : CDefinitionsManagerAccessor;
EntityHandleSet(creatorHandle, params.owner);
effectManager = params.targetEffectManager;
target = params.target;
sourceName = params.sourceName;
durationSet = false;
isSignEffect = params.isSignEffect;
if (params.vibratePadLowFreq > 0){
vibratePadLowFreq = params.vibratePadLowFreq;
}
if (params.vibratePadHighFreq > 0){
vibratePadHighFreq = params.vibratePadHighFreq;
}
if (IsNameValid(params.customAbilityName)){
abilityName = params.customAbilityName;
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, 'duration', min
, max);
duration = CalculateAttributeValue(GetAttributeRandomize
dValue(min, max), /* NOP */);
durationSet = true;
}
if (params.duration != 0 && !durationSet || durationSet && durat
ion == 0){
duration = params.duration;
}
isOnPlayer = (CPlayer)target;
target.GetResistValue(resistStat, points, resistance);
if (params.powerStatValue == null){
params.powerStatValue.valueMultiplicative = 1;
}
creatorPowerStat = params.powerStatValue;
CalculateDuration(true);
timeLeft = duration;
if (!IsNameValid(params.customAbilityName) && params.customEffec
tValue != null){
effectValue = params.customEffectValue;
} else {
SetEffectValue();
}
if (IsNameValid(params.customFXName)){
targetEffectName = params.customFXName;
}
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
target = t;
effectManager = eff;
isOnPlayer = (CR4Player)t;
if (isOnPlayer && !IsPaused(/* NOP */)){
isPlayingCameraEffect = false;
switchCameraEffect = true;

}
/* NOP */;
}
protected function SetEffectValue(){
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
if (!IsNameValid(abilityName)){
return;
}
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, attributeName, min, max
);
effectValue = GetAttributeRandomizedValue(min, max);
/* NOP */;
}
public function CacheSettings(){
var i : Int32;
var size : Int32;
var tmpString : String;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var temp : SCustomNode;
var tmpBool : Bool;
var tmpName : CName;
var customAbilityName : CName;
var tmpFloat : Float;
var type : EEffectType;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
EffectNameToType(tmpName, type, customAbilityName);
if (effectType == type){
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'iconType_name', tmpName)){
iconPath = theGame.effectMgr.GetPathForE
ffectIconTypeName(tmpName);
}
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'showOnHUD', tmpBool)){
showOnHUD = tmpBool;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'defaultAbilityName_name', tmpName)){
abilityName = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'cameraEffectName_name', tmpName)){
cameraEffectName = tmpName;
}
if (!IsNameValid(targetEffectName) && dm.GetCust
omNodeAttributeValueName(main.subNodes[i], 'targetEffectName_name', tmpName)){
targetEffectName = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'resistStatName_name', tmpName)){
resistStat = ResistStatNameToEnum(tmpNam

e, tmpBool);
}
if (dm.GetCustomNodeAttributeValueBool(main.subN
odes[i], 'isPotionEffect', tmpBool)){
isPotionEffect = tmpBool;
}
if (isPotionEffect && !isPositive && !isNeutral
&& !isNegative){
isPositive = true;
isNeutral = false;
isNegative = false;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'onStartSound_name', tmpName)){
onAddedSound = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'onStopSound_name', tmpName)){
onRemovedSound = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'effectNameLocalisationKey_name', tmpName)){
effectNameLocalisationKey = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'effectDescriptionLocalisationKey_name', tmpName)){
effectDescriptionLocalisationKey = tmpNa
me;
}
temp = dm.GetCustomDefinitionSubNode(main.subNod
es[i], 'denies');
if (temp.values.Size() > 0){
size = temp.values.Size();
i = 0;
while (i < size){
if (IsNameValid(temp.values[i]))
{
EffectNameToType(temp.va
lues[i], type, tmpName);
deny.PushBack(type);
}
i += 1;
}
}
temp = dm.GetCustomDefinitionSubNode(main.subNod
es[i], 'overrides');
if (temp.values.Size() > 0){
size = temp.values.Size();
i = 0;
while (i < size){
if (IsNameValid(temp.values[i]))
{
EffectNameToType(temp.va
lues[i], type, tmpName);
override.PushBack(type);
}
i += 1;
}
}
if (iconPath == "" && showOnHUD){

LogEffects("BaseEffect.Initialize: Effec
t " + this + " should show in GUI but has no icon defined!");
}
return;
}
i += 1;
}
LogEffects("BaseEffect.Initialize: Cannot find GUI definitions i
n xml file for effect " + this);
/* NOP */;
}
public function RecalcDuration(){
var prevDuration : Float;
var points : Float;
if (duration == -1){
return;
}
target.GetResistValue(resistStat, points, resistance);
prevDuration = duration;
CalculateDuration(/* NOP */);
timeLeft = timeLeft * duration / prevDuration;
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
var durationResistance : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
if (duration == 0){
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, 'duration', min
, max);
duration = CalculateAttributeValue(GetAttributeRandomize
dValue(min, max), /* NOP */);
}
if (setInitialDuration){
initialDuration = duration;
}
if (duration == -1){
return;
}
if (isNegative){
if (IsCriticalEffect(this)){
durationResistance = MinF(0.990000, resistance);
} else {
durationResistance = resistance;
}
duration = MaxF(0, initialDuration * MaxF(0, creatorPowe
rStat.valueMultiplicative) * 1 - durationResistance);
LogEffects("BaseEffect.CalculateDuration: " + effectType
+ " duration with target resistance (" + NoTrailZeros(resistance) + ") and atta
cker power mul of (" + NoTrailZeros(creatorPowerStat.valueMultiplicative) + ") i
s " + NoTrailZeros(duration) + ", base was " + NoTrailZeros(initialDuration));
}
/* NOP */;
}
public function GetAbilityName() : CName{
return abilityName;
/* NOP */;
}

public function OnEffectAddedPost() : Bool{


var localizationKey : String;
if (target == thePlayer.GetTarget()){
localizationKey = GetEffectNameLocalisationKey();
if (localizationKey != ""){
target.ShowFloatingValue(6, 0.000000, false, loc
alizationKey);
}
}
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var i : Int32;
var potParams : W3PotionParams;
LogAssert(target, "OnEffectAdded: target is NULL!");
isActive = true;
timeActive = 0.000000;
if (IsNameValid(abilityName) && !dontAddAbilityOnTarget){
target.AddAbility(abilityName, true);
}
PlayTargetFX();
isCameraEffectNameValid = IsNameValid(cameraEffectName);
if (isOnPlayer && switchCameraEffect && isCameraEffectNameValid)
{
thePlayer.PlayEffectSingle(cameraEffectName, /* NOP */);
isPlayingCameraEffect = true;
switchCameraEffect = false;
} else {
isPlayingCameraEffect = false;
}
if (isOnPlayer && IsNameValid(onAddedSound)){
theSound.SoundEvent(onAddedSound);
}
if (isOnPlayer && vibratePadLowFreq > 0 || vibratePadHighFreq >
0){
theGame.VibrateController(vibratePadLowFreq, vibratePadH
ighFreq, duration);
}
if (isPotionEffect){
potParams = (W3PotionParams)customParams;
if (potParams){
potionItemName = potParams.potionItemName;
}
}
LogEffects("BaseEffect.OnEffectAdded: effect " + this + " added
to " + target + ", duration=" + NoTrailZeros(duration));
/* NOP */;
}
protected function PlayTargetFX(){
if (IsNameValid(targetEffectName) && shouldPlayTargetEffect){
if (!effectManager.IsPlayingFX(targetEffectName)){
target.PlayEffect(targetEffectName, /* NOP */);
}
effectManager.AddPlayedFX(targetEffectName, sourceName);
}
/* NOP */;
}
protected function StopTargetFX(){
if (IsNameValid(targetEffectName) && !shouldPlayTargetEffect){
if (effectManager.ShouldStopFx(targetEffectName)){

target.StopEffect(targetEffectName);
}
effectManager.RemovePlayedFX(targetEffectName, sourceNam
e);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var i : Int32;
isActive = false;
if (IsNameValid(abilityName)){
target.RemoveAbility(abilityName);
}
if (isOnPlayer && isPlayingCameraEffect && isCameraEffectNameVal
id){
thePlayer.StopEffect(cameraEffectName);
}
shouldPlayTargetEffect = false;
StopTargetFX();
if (isOnPlayer && IsNameValid(onRemovedSound)){
theSound.SoundEvent(onRemovedSound);
}
if (isOnPlayer && theGame.IsSpecificRumbleActive(vibratePadLowFr
eq, vibratePadHighFreq)){
theGame.RemoveSpecificRumble(vibratePadLowFreq, vibrateP
adHighFreq);
}
LogEffects("BaseEffect.OnEffectRemoved: effect <<" + this + ">>
removed from <<" + target + ">>");
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
SwitchCameraEffect();
PlayTargetFX();
/* NOP */;
}
private function SwitchCameraEffect(){
if (isCameraEffectNameValid && isOnPlayer && switchCameraEffect)
{
if (isPlayingCameraEffect){
thePlayer.StopEffect(cameraEffectName);
} else {
thePlayer.PlayEffectSingle(cameraEffectName, /*
NOP */);
}
isPlayingCameraEffect = !isPlayingCameraEffect;
switchCameraEffect = false;
}
/* NOP */;
}
public function OnTargetDeath(){
target.RemoveEffect(this, true);
/* NOP */;
}
public function OnTargetUnconscious(){
target.RemoveEffect(this, true);
/* NOP */;
}
public function OnTargetDeathAnimFinished(){
}

public final function GetInteraction(effect : CBaseGameplayEffect) : EEf


fectInteract{
var i : Int32;
var size : Int32;
var tmp : EEffectInteract;
size = deny.Size();
i = 0;
while (i < size){
if (deny[i] == effect.effectType){
return 1;
}
i += 1;
}
size = override.Size();
i = 0;
while (i < size){
if (override[i] == effect.effectType){
return 2;
}
i += 1;
}
if (effectType == effect.effectType){
tmp = GetSelfInteraction(effect);
if (tmp != 0){
return tmp;
}
}
return 3;
/* NOP */;
}
protected function GetSelfInteraction(e : CBaseGameplayEffect) : EEffect
Interact{
var thisVal : Float;
var otherVal : Float;
if (sourceName != e.sourceName){
return 0;
}
thisVal = GetEffectStrength();
otherVal = e.GetEffectStrength();
if (thisVal > otherVal){
return 2;
} else if (thisVal < otherVal){
return 3;
} else {
if (timeLeft <= 0 && IsCriticalEffect(this)){
return 3;
}
if (timeLeft > e.timeLeft){
return 2;
}
return 4;
}
/* NOP */;
}
protected function GetEffectStrength() : Float{
return CalculateAttributeValue(effectValue, /* NOP */);
/* NOP */;
}
public function CumulateWith(effect : CBaseGameplayEffect){
timeLeft = effect.timeLeft;

duration = effect.duration;
isPotionEffect = effect.isPotionEffect;
creatorHandle = effect.creatorHandle;
sourceName = effect.sourceName;
if (abilityName != effect.abilityName && !dontAddAbilityOnTarget
){
target.RemoveAbility(abilityName);
target.AddAbility(effect.abilityName, /* NOP */);
}
abilityName = effect.abilityName;
if (isOnPlayer){
vibratePadLowFreq = effect.vibratePadLowFreq;
vibratePadHighFreq = effect.vibratePadHighFreq;
if (vibratePadLowFreq > 0 || vibratePadHighFreq > 0){
theGame.OverrideRumbleDuration(vibratePadLowFreq
, vibratePadHighFreq, timeLeft);
}
}
if (isOnPlayer && IsNameValid(onAddedSound)){
theSound.SoundEvent(onAddedSound);
}
/* NOP */;
}
public function OnTimeUpdated(dt : Float){
var toxicityThreshold : Float;
if (isActive && pauseCounters.Size() == 0){
timeActive += dt;
if (duration != -1){
timeLeft -= dt;
if (timeLeft <= 0){
if (isPotionEffect && isOnPlayer && theP
layer.CanUseSkill(60)){
toxicityThreshold = thePlayer.Ge
tStatMax(3) * 1 - CalculateAttributeValue(thePlayer.GetSkillAttributeValue(60, '
toxicity_threshold', false, true), /* NOP */) * thePlayer.GetSkillLevel(60);
if (thePlayer.GetStat(3, true) >
toxicityThreshold){
} else {
isActive = false;
}
} else {
isActive = false;
}
}
}
OnUpdate(dt);
}
/* NOP */;
}
public function Pause(sourceName : CName, singleLock : Bool){
var i : Int32;
var counter : SBuffPauseLock;
i = 0;
while (i < pauseCounters.Size()){
if (pauseCounters[i].sourceName == sourceName){
if (singleLock){
pauseCounters[i].counter = 1;
} else {
pauseCounters[i].counter += 1;
}

return;
}
i += 1;
}
counter.sourceName = sourceName;
counter.counter = 1;
pauseCounters.PushBack(counter);
shouldPlayTargetEffect = false;
StopTargetFX();
if (isPlayingCameraEffect){
switchCameraEffect = true;
SwitchCameraEffect();
}
OnPaused();
/* NOP */;
}
protected function OnPaused(){
}
protected function OnResumed(){
}
public final function Resume(sourceName : CName){
ResumeInternal(sourceName, /* NOP */);
/* NOP */;
}
public final function ResumeForced(){
ResumeInternal('None', true);
/* NOP */;
}
private final function ResumeInternal(sourceName : CName, forced : Bool)
{
var i : Int32;
i = pauseCounters.Size() - 1;
while (i >= 0){
if (forced || pauseCounters[i].sourceName == sourceName)
{
if (pauseCounters[i].counter == 1){
pauseCounters.EraseFast(i);
shouldPlayTargetEffect = true;
PlayTargetFX();
switchCameraEffect = true;
OnResumed();
} else {
pauseCounters[i].counter -= 1;
}
if (!forced){
return;
}
}
i -= 1;
}
/* NOP */;
}
public function IsPaused(sourceName : CName) : Bool{
var i : Int32;
if (sourceName == 'None'){
return pauseCounters.Size() > 0;
}
i = 0;
while (i < pauseCounters.Size()){
if (pauseCounters[i].sourceName == sourceName){

return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetDurationLeft() : Float{
return timeLeft;
/* NOP */;
}
public function GetInitialDuration() : Float{
return duration;
/* NOP */;
}
public function GetCreator() : CGameplayEntity{
return (CGameplayEntity)EntityHandleGet(creatorHandle);
/* NOP */;
}
public function IsPositive() : Bool{
return isPositive;
/* NOP */;
}
public function IsNegative() : Bool{
return isNegative;
/* NOP */;
}
public function IsNeutral() : Bool{
return isNeutral;
/* NOP */;
}
public function ShowOnHUD() : Bool{
return showOnHUD;
/* NOP */;
}
public function GetIcon() : String{
return iconPath;
/* NOP */;
}
public function IsActive() : Bool{
return isActive;
/* NOP */;
}
public function GetEffectNameLocalisationKey() : String{
var str : String;
switch(effectType){
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
str = StrReplace(effectNameLocalisationKey, "effect_Muta
gen0", "item_name_mutagen_");
str = StrReplace(str, "Effect", "");
return str;
case 82:

case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case

83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
str = StrReplace(effectNameLocalisationKey, "effect_Muta
gen", "item_name_mutagen_");
str = StrReplace(str, "Effect", "");
return str;
default:
break;
}
return effectNameLocalisationKey;
/* NOP */;
}
public function GetEffectDescriptionLocalisationKey() : String{
return effectDescriptionLocalisationKey;
/* NOP */;
}
public function GetEffectType() : EEffectType{
return effectType;
/* NOP */;
}
public function IsPotionEffect() : Bool{
return isPotionEffect;
/* NOP */;
}
public function IsSignEffect() : Bool{
return isSignEffect;
/* NOP */;
}
public function SetTimeLeft(t : Float){
timeLeft = t;
/* NOP */;
}
public function IsPausedDuringDialogAndCutscene() : Bool{
return isPausedDuringDialogAndCutscene;
/* NOP */;
}
public function GetSourceName() : String{
return sourceName;
/* NOP */;
}
public function IsOnPlayer() : Bool{
return isOnPlayer;
/* NOP */;
}

public function GetTimeActive() : Float{


return timeActive;
/* NOP */;
}
public function CanBeAppliedOnDeadTarget() : Bool{
return canBeAppliedOnDeadTarget;
/* NOP */;
}
public function GetResistStat() : ECharacterDefenseStats{
return resistStat;
/* NOP */;
}
public function GetBuffResist() : Float{
return resistance;
/* NOP */;
}
public function GetBuffLevel() : Int32{
var level : String;
level = StrAfterLast(abilityName, "_");
if (level == "Level3" || level == "3"){
return 3;
} else if (level == "Level2" || level == "2"){
return 2;
} else {
return 1;
}
/* NOP */;
}
public final function Debug_HAX_FIX(t : CActor){
target = t;
EntityHandleSet(creatorHandle, t);
/* NOP */;
}
public final function RecalcPotionDuration(){
var leftRatio : Float;
var newDuration : Float;
if (!isPotionEffect){
return;
}
leftRatio = timeLeft / duration;
newDuration = GetWitcherPlayer().CalculatePotionDuration(GetInva
lidUniqueId(), (W3Mutagen_Effect)this, potionItemName);
duration = newDuration;
timeLeft = newDuration * leftRatio;
/* NOP */;
}
}
import struct W3AbilityManager{
protected var isInitialized : Bool;
protected saved var blockedAbilities : array<SBlockedAbility>;
//NULL type for difficultyAbilities
//NULL type for ignoresDifficultySettings
//NULL type for owner
//NULL type for charStats
//NULL type for usedDifficultyMode
import public final function CacheStaticScriptData();
import public final function SetInitialStats(diff : EDifficultyMode) : B
ool;
import public final function HasStat(stat : EBaseCharacterStats) : Bool;

import public final function StatAddNew(stat : EBaseCharacterStats, max


: Float);
import public final function RestoreStat(stat : EBaseCharacterStats);
import public final function RestoreStats();
import public function GetStat(stat : EBaseCharacterStats, skipLock : Bo
ol) : Float;
import public final function GetStatMax(stat : EBaseCharacterStats) : Fl
oat;
import public final function GetStatPercents(stat : EBaseCharacterStats)
: Float;
import public final function GetStats(stat : EBaseCharacterStats, curren
t : Float, max : Float) : Bool;
import public final function SetStatPointCurrent(stat : EBaseCharacterSt
ats, val : Float);
import public final function SetStatPointMax(stat : EBaseCharacterStats,
val : Float);
import public final function UpdateStatMax(stat : EBaseCharacterStats);
import public final function HasResistStat(stat : ECharacterDefenseStats
) : Bool;
import public final function GetResistStat(stat : ECharacterDefenseStats
, resistStat : SResistanceValue) : Bool;
import public final function SetResistStat(stat : ECharacterDefenseStats
, resistStat : SResistanceValue);
import public final function ResistStatAddNew(stat : ECharacterDefenseSt
ats);
import public function RecalcResistStat(stat : ECharacterDefenseStats);
import public function GetAttributeValueInternal(attributeName : CName,
tags : array<CName>) : SAbilityAttributeValue;
import public final function CacheDifficultyAbilities();
import public final function UpdateStatsForDifficultyLevel(diff : EDiffi
cultyMode);
import public final function UpdateDifficultyAbilities(diff : EDifficult
yMode);
import public final function GetAllStats_Debug(stats : array<SBaseStat>)
: Bool;
import public final function GetAllResistStats_Debug(stats : array<SResi
stanceValue>) : Bool;
public function PostInit(){
}
public function Init(ownr : CActor, cStats : CCharacterStats, isFromLoad
: Bool, diff : EDifficultyMode) : Bool{
var abs : array<CName>;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
isInitialized = false;
difficultyAbilities.Clear();
ignoresDifficultySettings = false;
super.CacheStaticScriptData();
owner = ownr;
charStats = cStats;
dm = theGame.GetDefinitionsManager();
charStats.GetAbilities(abs, /* NOP */);
i = 0;
while (i < abs.Size()){
if (dm.AbilityHasTag(abs[i], theGame.params.DIFFICULTY_T
AG_IGNORE)){
ignoresDifficultySettings = true;
break;
}
i += 1;

}
if (!ignoresDifficultySettings){
difficultyAbilities.Resize(EnumGetMax('EDifficultyMode')
+ 1);
}
if (!isFromLoad){
usedDifficultyMode = 0;
if (!super.SetInitialStats(diff)){
return false;
}
} else if (!ignoresDifficultySettings){
super.CacheDifficultyAbilities();
}
if (!ignoresDifficultySettings && usedDifficultyMode != diff){
super.UpdateStatsForDifficultyLevel(diff);
}
return true;
/* NOP */;
}
public final function IsInitialized() : Bool{
return isInitialized;
/* NOP */;
}
public function OnOwnerRevived(){
var i : Int32;
super.RestoreStats();
i = blockedAbilities.Size() - 1;
while (i >= 0){
if (blockedAbilities[i].timeWhenEnabledd > 0){
blockedAbilities.EraseFast(i);
}
i -= 1;
}
/* NOP */;
}
protected function CheckForbiddenAttribute(attName : CName) : Bool{
if (theGame.params.IsForbiddenAttribute(attName)){
LogAssert(false, "W3AbilityManager.CheckForbiddenAttribu
te: you are trying to get attribute <<" + attName + ">> in a wrong way - use pro
pper custom function instead!");
return true;
}
return false;
/* NOP */;
}
public function GetAttributeValue(attributeName : CName, tags : array<CN
ame>) : SAbilityAttributeValue{
var val : SAbilityAttributeValue;
if (CheckForbiddenAttribute(attributeName)){
val.valueBase = -9999;
val.valueAdditive = -9999;
val.valueMultiplicative = 100;
return val;
}
return GetAttributeValueInternal(attributeName, tags);
/* NOP */;
}
protected function GetNonBlockedSkillAbilitiesList(tags : array<CName>)
: array<CName>{
var null : array<CName>;

return null;
/* NOP */;
}
public function CheckBlockedAbilities(dt : Float) : Float{
var i : Int32;
var min : Float;
min = 1000000;
i = blockedAbilities.Size() - 1;
while (i >= 0){
if (blockedAbilities[i].timeWhenEnabledd != -1){
blockedAbilities[i].timeWhenEnabledd = MaxF(bloc
kedAbilities[i].timeWhenEnabledd - dt, 0);
if (blockedAbilities[i].timeWhenEnabledd == 0){
BlockAbility(blockedAbilities[i].ability
Name, false, /* NOP */);
} else {
min = MinF(min, blockedAbilities[i].time
WhenEnabledd);
}
}
i -= 1;
}
if (min == 1000000){
min = -1;
}
return min;
/* NOP */;
}
protected final function FindBlockedAbility(abName : CName) : Int32{
var i : Int32;
i = 0;
while (i < blockedAbilities.Size()){
if (blockedAbilities[i].abilityName == abName){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function BlockAbility(abilityName : CName, block : Bool, cooldown
: Float) : Bool{
var i : Int32;
var ab : SBlockedAbility;
var min : Float;
var cnt : Float;
var ret : Bool;
if (!IsNameValid(abilityName)){
return false;
}
i = 0;
while (i < blockedAbilities.Size()){
if (blockedAbilities[i].abilityName == abilityName){
if (!block){
cnt = blockedAbilities[i].count;
blockedAbilities.Erase(i);
if (cnt > 0){
charStats.AddAbility(abilityName
, cnt);
}

return true;
} else {
return false;
}
}
i += 1;
}
if (block){
ab.abilityName = abilityName;
if (cooldown > 0){
ab.timeWhenEnabledd = cooldown;
min = cooldown;
i = 0;
while (i < blockedAbilities.Size()){
if (blockedAbilities[i].timeWhenEnabledd
> 0){
min = MinF(min, blockedAbilities
[i].timeWhenEnabledd);
}
i += 1;
}
owner.AddTimer('CheckBlockedAbilities', min, /*
NOP */, /* NOP */, /* NOP */, true, /* NOP */);
} else {
ab.timeWhenEnabledd = -1;
}
ab.count = owner.GetAbilityCount(abilityName);
ret = charStats.RemoveAbility(abilityName);
blockedAbilities.PushBack(ab);
return ret;
} else {
return false;
}
/* NOP */;
}
public final function IsAbilityBlocked(abilityName : CName) : Bool{
return FindBlockedAbility(abilityName) >= 0;
/* NOP */;
}
public function GetPowerStatValue(stat : ECharacterPowerStats, abilityTa
g : CName) : SAbilityAttributeValue{
var tags : array<CName>;
if (IsNameValid(abilityTag)){
tags.PushBack(abilityTag);
}
return GetAttributeValueInternal(PowerStatEnumToName(stat), tags
);
/* NOP */;
}
protected function MutliplyStatBy(stat : EBaseCharacterStats, val : Floa
t){
if (val > 0){
super.SetStatPointCurrent(stat, MinF(val * GetStat(stat,
true), super.GetStatMax(stat)));
}
/* NOP */;
}
public function GetResistValue(stat : ECharacterDefenseStats, points : F
loat, percents : Float){
var pts : SAbilityAttributeValue;

var prc : SAbilityAttributeValue;


var charPts : SAbilityAttributeValue;
var charPerc : SAbilityAttributeValue;
var buff : W3Mutagen20_Effect;
var resistStat : SResistanceValue;
if (super.GetResistStat(stat, resistStat)){
charPts = resistStat.points;
charPerc = resistStat.percents;
}
if (stat == 16 || stat == 17 || stat == 18){
if (owner.HasBuff(92)){
buff = (W3Mutagen20_Effect)owner.GetBuff(92, /*
NOP */);
buff.GetResistBonus(stat, pts, prc);
charPts = charPts + pts;
charPerc = charPerc + prc;
}
}
points = CalculateAttributeValue(charPts, /* NOP */);
percents = MinF(1, CalculateAttributeValue(charPerc, /* NOP */))
;
return;
/* NOP */;
}
public function UsedHPType() : EBaseCharacterStats{
var j : Int32;
var hasEss : Bool;
var hasVit : Bool;
hasEss = super.HasStat(1) && super.GetStatMax(1) > 0.000000;
hasVit = super.HasStat(0) && super.GetStatMax(0) > 0.000000;
if (hasVit && !hasEss){
return 0;
} else if (!hasVit && hasEss){
return 1;
} else {
return 10;
}
/* NOP */;
}
public function ForceSetStat(stat : EBaseCharacterStats, val : Float){
var prev : Float;
prev = GetStat(stat, /* NOP */);
super.SetStatPointCurrent(stat, MinF(super.GetStatMax(stat), Max
F(0, val)));
if (prev != GetStat(stat, /* NOP */)){
if (stat == 0){
OnVitalityChanged();
} else if (stat == 3){
OnToxicityChanged();
} else if (stat == 4){
OnFocusChanged();
} else if (stat == 6){
OnAirChanged();
}
}
/* NOP */;
}
protected function InternalReduceStat(stat : EBaseCharacterStats, amount
: Float){
super.SetStatPointCurrent(stat, MaxF(0, GetStat(stat, true) - Ma

xF(0, amount)));
/* NOP */;
}
public function DrainAir(cost : Float, delay : Float){
if (cost > 0){
InternalReduceStat(6, cost);
owner.StartAirRegen();
}
if (delay > 0){
owner.PauseEffects(59, 'AirCostDelay', false, delay, /*
NOP */);
}
/* NOP */;
}
public function DrainSwimmingStamina(cost : Float, delay : Float){
if (cost > 0){
InternalReduceStat(9, cost);
owner.StartSwimmingStaminaRegen();
}
if (delay > 0){
owner.PauseEffects(106, 'SwimmingStaminaCostDelay', fals
e, delay, /* NOP */);
}
/* NOP */;
}
public function DrainStamina(action : EStaminaActionType, fixedCost : Fl
oat, fixedDelay : Float, abilityName : CName, dt : Float, costMult : Float) : Fl
oat{
var cost : Float;
var delay : Float;
GetStaminaActionCost(action, cost, delay, fixedCost, fixedDelay,
abilityName, dt, costMult);
if (cost > 0){
InternalReduceStat(2, cost);
owner.StartStaminaRegen();
}
if (delay > 0){
if (IsNameValid(abilityName)){
owner.PauseEffects(2, abilityName, true, delay,
true);
} else {
owner.PauseEffects(2, StaminaActionTypeToName(ac
tion), true, delay, true);
}
}
return cost;
/* NOP */;
}
public function GetStaminaActionCost(action : EStaminaActionType, cost :
Float, delay : Float, fixedCost : Float, fixedDelay : Float, abilityName : CNam
e, dt : Float, costMult : Float){
var costAtt : SAbilityAttributeValue;
var delayAtt : SAbilityAttributeValue;
if (action == 13){
cost = fixedCost;
delay = MaxF(0, fixedDelay);
} else {
GetStaminaActionCostInternal(action, dt > 0.000000, cost
Att, delayAtt, abilityName);
cost = CalculateAttributeValue(costAtt, /* NOP */);

delay =
}
if (costMult !=
cost *=
}
if (dt > 0){
cost *=
}
/* NOP */;

CalculateAttributeValue(delayAtt, /* NOP */);


0){
costMult;
dt;

}
protected function GetStaminaActionCostInternal(action : EStaminaActionT
ype, isPerSec : Bool, cost : SAbilityAttributeValue, delay : SAbilityAttributeVa
lue, abilityName : CName){
var costAttributeName : CName;
var delayAttributeName : CName;
var attribute : CName;
var tags : array<CName>;
var val : SAbilityAttributeValue;
cost = val;
delay = val;
theGame.params.GetStaminaActionAttributes(action, isPerSec, cost
AttributeName, delayAttributeName);
if (action == 12){
if (isPerSec){
attribute = theGame.params.STAMINA_COST_PER_SEC_
DEFAULT;
} else {
attribute = theGame.params.STAMINA_COST_DEFAULT;
}
cost = GetSkillAttributeValue(abilityName, attribute, fa
lse, true);
delay = GetSkillAttributeValue(abilityName, theGame.para
ms.STAMINA_DELAY_DEFAULT, false, true);
} else {
cost = GetAttributeValueInternal(costAttributeName, /* N
OP */);
delay = GetAttributeValueInternal(delayAttributeName, /*
NOP */);
}
cost += GetAttributeValueInternal('stamina_cost_modifier', /* NO
P */);
delay += GetAttributeValueInternal('stamina_delay_modifier', /*
NOP */);
/* NOP */;
}
public function GetSkillAttributeValue(abilityName : CName, attributeNam
e : CName, addBaseCharAttribute : Bool, addSkillModsAttribute : Bool) : SAbility
AttributeValue{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
theGame.GetDefinitionsManager().GetAbilityAttributeValue(ability
Name, attributeName, min, max);
return GetAttributeRandomizedValue(min, max);
/* NOP */;
}
public function DrainFocus(amount : Float){
InternalReduceStat(4, amount);
OnFocusChanged();
/* NOP */;
}

public function DrainMorale(amount : Float){


InternalReduceStat(5, amount);
owner.StartMoraleRegen();
/* NOP */;
}
public function DrainToxicity(amount : Float){
InternalReduceStat(3, amount);
OnToxicityChanged();
/* NOP */;
}
public function DrainVitality(amount : Float){
super.SetStatPointCurrent(0, MaxF(0, GetStat(0, /* NOP */) - Max
F(0, amount)));
owner.StartVitalityRegen();
if (GetStat(0, /* NOP */) <= 0 && owner.UsesVitality()){
owner.SignalGameplayEvent('Death');
owner.SetAlive(false);
}
OnVitalityChanged();
/* NOP */;
}
public function DrainEssence(amount : Float){
super.SetStatPointCurrent(1, MaxF(0, GetStat(1, /* NOP */) - Max
F(0, amount)));
owner.StartEssenceRegen();
if (GetStat(1, /* NOP */) <= 0 && owner.UsesEssence()){
owner.SignalGameplayEvent('Death');
owner.SetAlive(false);
}
/* NOP */;
}
public function AddPanic(amount : Float){
super.SetStatPointCurrent(7, RoundF(MaxF(0, GetStat(7, /* NOP */
) - amount)));
owner.StartPanicRegen();
/* NOP */;
}
public function GainStat(stat : EBaseCharacterStats, amount : Float){
var statWithoutLock : Float;
var statWithLock : Float;
var lock : Float;
statWithoutLock = GetStat(stat, true);
statWithLock = GetStat(stat, false);
lock = statWithLock - statWithoutLock;
super.SetStatPointCurrent(stat, MinF(super.GetStatMax(stat) - lo
ck, statWithoutLock + MaxF(0, amount)));
if (stat == 0){
OnVitalityChanged();
} else if (stat == 3){
OnToxicityChanged();
} else if (stat == 4){
OnFocusChanged();
}
/* NOP */;
}
public function GetApplicatorParamsFor(applicator : W3ApplicatorEffect,
pwrStatValue : SAbilityAttributeValue){
}
public function IgnoresDifficultySettings() : Bool{
return ignoresDifficultySettings;

/* NOP */;
}
protected function OnVitalityChanged(){
}
protected function OnToxicityChanged(){
}
protected function OnFocusChanged(){
}
protected function OnAirChanged(){
}
public function OnAbilityAdded(abilityName : CName){
var idx : Int32;
if (!owner){
return;
}
if (super.IsAbilityBlocked(abilityName)){
idx = super.FindBlockedAbility(abilityName);
blockedAbilities[idx].count += 1;
charStats.RemoveAbility(abilityName);
blockedAbilities[idx].count += 1;
} else {
OnAbilityChanged(abilityName);
}
/* NOP */;
}
public function OnAbilityRemoved(abilityName : CName){
var idx : Int32;
if (!owner){
return;
}
if (super.IsAbilityBlocked(abilityName)){
idx = super.FindBlockedAbility(abilityName);
blockedAbilities[idx].count -= 1;
} else {
OnAbilityChanged(abilityName);
}
/* NOP */;
}
protected function OnAbilityChanged(abilityName : CName){
var atts : array<CName>;
var tags : array<CName>;
var i : Int32;
var size : Int32;
var stat : Int32;
var j : Int32;
var oldMax : Float;
var maxVit : Float;
var maxEss : Float;
var resistStatChanged : Bool;
var tmpBool : Bool;
var dm : CDefinitionsManagerAccessor;
var val : SAbilityAttributeValue;
var buffs : array<CBaseGameplayEffect>;
var regenBuff : W3RegenEffect;
var cannotAddAttributes : array<CName>;
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(abilityName, atts);
resistStatChanged = false;
size = atts.Size();
if (dm.AbilityHasTag(abilityName, theGame.params.DIFFICULTY_TAG_

IGNORE)){
ignoresDifficultySettings = true;
difficultyAbilities.Clear();
usedDifficultyMode = 0;
}
owner.GetListOfCannotAddAttributes(cannotAddAttributes);
i = 0;
while (i < size){
if (cannotAddAttributes.Contains(atts[i])){
} else {
stat = StatNameToEnum(atts[i]);
if (stat != 10){
if (!super.HasStat(stat)){
super.StatAddNew(stat, /* NOP */
);
} else if (abilityName == theGame.params
.GLOBAL_ENEMY_ABILITY || abilityName == theGame.params.GLOBAL_PLAYER_ABILITY ||
abilityName == theGame.params.ENEMY_BONUS_PER_LEVEL){
super.UpdateStatMax(stat);
super.RestoreStat(stat);
} else {
oldMax = super.GetStatMax(stat);
super.UpdateStatMax(stat);
MutliplyStatBy(stat, super.GetSt
atMax(stat) / oldMax);
}
} else {
stat = ResistStatNameToEnum(atts[i], tmp
Bool);
if (stat != 0){
if (super.HasResistStat(stat)){
RecalcResistStat(stat);
resistStatChanged = true
;
} else {
super.ResistStatAddNew(s
tat);
}
} else {
stat = PowerStatNameToEnum(atts[
i]);
if (stat != 2){
owner.UpdateApplicatorBu
ffs();
} else {
stat = RegenStatNameToEn
um(atts[i]);
if (stat != 0 && stat !=
4){
buffs = owner.Ge
tBuffs(/* NOP */, /* NOP */, /* NOP */);
j = 0;
while (j < buffs
.Size()){
regenBuf
f = (W3RegenEffect)buffs[j];
if (rege
nBuff){
if (regenBuff.GetRegenStat() == stat && IsBuffAutoBuff(regenBuff.GetEffectType()

)){
regenBuff.UpdateEffectValue();
break;
}
}
j += 1;
}
if (stat == 2){
owner.St
artEssenceRegen();
}
}
if (!ignoresDifficultySe
ttings && atts[i] == theGame.params.DIFFICULTY_HP_MULTIPLIER){
maxVit = super.G
etStatMax(0);
maxEss = super.G
etStatMax(1);
if (maxVit > 0){
oldMax =
maxVit;
super.Up
dateStatMax(0);
Mutliply
StatBy(0, super.GetStatMax(0) / oldMax);
}
if (maxEss > 0){
oldMax =
maxEss;
super.Up
dateStatMax(1);
Mutliply
StatBy(1, super.GetStatMax(1) / oldMax);
}
}
}
}
}
}
i += 1;
}
if (resistStatChanged){
owner.RecalcEffectDurations();
}
/* NOP */;
}
public function Debug_GetUsedDifficultyMode() : EDifficultyMode{
return usedDifficultyMode;
/* NOP */;
}
}
class W3EffectManager extends CObject{
private var owner : CActor;
private saved var effects : array<CBaseGameplayEffect>;
private saved var statDeltas : array<Float>;
private saved var cachedDamages : array<SEffectCachedDamage>;

private var isReady : Bool;


private saved var currentlyAnimatedCS : CBaseGameplayEffect;
private var currentlyPlayedFX : array<SCurrentBuffFX>;
private saved var pausedEffects : array<STemporarilyPausedEffect>;
private saved var pausedNotAppliedAutoBuffs : array<SPausedAutoEffect>;
private var ownerIsWitcher : Bool;
private var isInitializingAutobuffs : Bool;
private var hasCriticalStateSaveLock : Bool;
private var criticalStateSaveLockId : Int32;
private var vitalityAutoRegenOn : Bool;
private var essenceAutoRegenOn : Bool;
private var staminaAutoRegenOn : Bool;
private var moraleAutoRegenOn : Bool;
private var panicAutoRegenOn : Bool;
private var airAutoRegenOn : Bool;
private var swimmingStaminaAutoRegenOn : Bool;
private var adrenalineAutoRegenOn : Bool;
public final function Initialize(actor : CActor){
var i : Int32;
var effect : CBaseGameplayEffect;
var overridenEffectsIdxs : array<Int32>;
var autoEffects : array<CName>;
var type : EEffectType;
var tmpName : CName;
var npc : CNewNPC;
owner = actor;
ownerIsWitcher = (W3PlayerWitcher)owner;
hasCriticalStateSaveLock = false;
statDeltas.Grow(EnumGetMax('EBaseCharacterStats') + 1);
i = 0;
while (i < statDeltas.Size()){
statDeltas[i] = 0;
i += 1;
}
npc = (CNewNPC)actor;
if (npc){
if (npc.GetNPCType() != 1){
autoEffects = PrepareAutoBuffs();
}
} else if ((CR4Player)actor){
autoEffects = PrepareAutoBuffs();
}
FilterOutExactly(autoEffects, 1);
FilterOutExactly(autoEffects, 3);
FilterOutExactly(autoEffects, 2);
FilterOutExactly(autoEffects, 4);
FilterOutExactly(autoEffects, 66);
FilterOutExactly(autoEffects, 59);
FilterOutExactly(autoEffects, 106);
FilterOutExactly(autoEffects, 50);
if (autoEffects.Size() > 0 && !theGame.IsEffectManagerInitialize
d()){
theGame.InitializeEffectManager();
}
isInitializingAutobuffs = true;
i = 0;
while (i < autoEffects.Size()){
EffectNameToType(autoEffects[i], type, tmpName);
InternalAddEffect(type, owner, 'autobuff', /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NO

P */);
i += 1;
}
isInitializingAutobuffs = false;
isReady = true;
/* NOP */;
}
public final function PerformUpdate(deltaTime : Float){
var i : Int32;
var size : Int32;
var delta : Float;
var action : W3DamageAction;
var wasPaused : Bool;
var carrier : CBaseGameplayEffect;
var pausedBuff : CBaseGameplayEffect;
var cachedDeltaRemoved : Bool;
size = effects.Size();
i = size - 1;
while (i >= 0){
if (effects[i].IsPausedDuringDialogAndCutscene()){
if (theGame.IsDialogOrCutscenePlaying() && !effe
cts[i].IsPaused('dialogOrCutscene')){
if (IsCriticalEffect(effects[i])){
RemoveEffect(effects[i], true);
} else {
effects[i].Pause('dialogOrCutsce
ne', true);
}
} else if (!theGame.IsDialogOrCutscenePlaying()
&& effects[i].IsPaused('dialogOrCutscene')){
effects[i].Resume('dialogOrCutscene');
}
}
if (effects[i].IsPaused(/* NOP */)){
} else if (effects[i].IsActive()){
effects[i].OnTimeUpdated(deltaTime);
} else {
RemoveEffectOnIndex(i, /* NOP */);
}
i -= 1;
}
size = statDeltas.Size();
cachedDeltaRemoved = false;
i = 0;
while (i < size){
delta = statDeltas[i];
if (delta == 0){
continue;
} else {
UpdateStatValueChange(i, delta);
statDeltas[i] = 0;
cachedDeltaRemoved = true;
if (i == 0 || i == 1){
owner.ShowFloatingValue(5, delta, true,
/* NOP */);
}
}
i += 1;
}
size = cachedDamages.Size();

if (size > 0){


action = new W3DamageAction in theGame.damageMgr;
i = 0;
while (i < size){
action.Initialize((CGameplayEntity)EntityHandleG
et(cachedDamages[i].attacker), owner, cachedDamages[i].carrier, cachedDamages[i]
.sourceName, 0, cachedDamages[i].powerStatType, false, false, false, cachedDamag
es[i].isEnvironment, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(cachedDamages[i].dmgType, cache
dDamages[i].dmgVal);
action.SetHitAnimationPlayType(2);
if (cachedDamages[i].dt > 0){
action.SetPointResistIgnored(true);
action.SetIsDoTDamage(cachedDamages[i].d
t);
}
if (cachedDamages[i].dontShowHitParticle){
action.SetCanPlayHitParticle(false);
}
theGame.damageMgr.ProcessAction(action);
carrier = cachedDamages[i].carrier;
if (carrier && carrier.GetEffectType() == 16){
(W3Effect_Bleeding)carrier.OnDamageDealt
(action.DealsAnyDamage());
}
i += 1;
}
delete action;
cachedDamages.Clear();
owner.SetEffectsUpdateTicking(false, /* NOP */);
}
i = pausedEffects.Size() - 1;
while (i >= 0){
if (pausedEffects[i].timeLeft > -1){
pausedEffects[i].timeLeft -= deltaTime;
if (pausedEffects[i].timeLeft <= 0){
pausedEffects[i].buff.Resume(pausedEffec
ts[i].source);
pausedEffects.Erase(i);
}
}
i -= 1;
}
i = pausedNotAppliedAutoBuffs.Size() - 1;
while (i >= 0){
if (pausedNotAppliedAutoBuffs[i].timeLeft > -1){
pausedNotAppliedAutoBuffs[i].timeLeft -= deltaTi
me;
if (pausedNotAppliedAutoBuffs[i].timeLeft <= 0){
pausedNotAppliedAutoBuffs.Erase(i);
}
}
i -= 1;
}
owner.SetEffectsUpdateTicking(false, /* NOP */);
/* NOP */;
}
private final function PrepareAutoBuffs() : array<CName>{
var autoEffects : array<CName>;
owner.GetAutoEffects(autoEffects);

FilterAutoBuff(autoEffects,
FilterAutoBuff(autoEffects,
FilterAutoBuff(autoEffects,
FilterAutoBuff(autoEffects,
return autoEffects;
/* NOP */;

1,
2,
5,
3,

1);
3);
2);
4);

}
private final function FilterAutoBuff(autoEffects : array<CName>, regenS
tat : ECharacterRegenStats, effectType : EEffectType){
var autoName : CName;
var effectValue : SAbilityAttributeValue;
var null : SAbilityAttributeValue;
effectValue = owner.GetAttributeValue(RegenStatEnumToName(regenS
tat), /* NOP */, /* NOP */);
autoName = EffectTypeToName(effectType);
if (!autoEffects.Contains(autoName) && effectValue != null){
autoEffects.PushBack(autoName);
} else if (autoEffects.Contains(autoName) && effectValue == null
){
autoEffects.Remove(autoName);
}
/* NOP */;
}
private final function FilterOutAllApart(autoEffects : array<CName>, eff
ectType : EEffectType){
var i : Int32;
var autoName : CName;
autoName = EffectTypeToName(effectType);
i = autoEffects.Size() - 1;
while (i >= 0){
if (autoEffects[i] != autoName){
autoEffects.Erase(i);
}
i -= 1;
}
/* NOP */;
}
private final function FilterOutExactly(autoEffects : array<CName>, effe
ctType : EEffectType){
var i : Int32;
var autoName : CName;
autoName = EffectTypeToName(effectType);
i = autoEffects.Size() - 1;
while (i >= 0){
if (autoEffects[i] == autoName){
autoEffects.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public final function StartVitalityRegen() : Bool{
if (vitalityAutoRegenOn){
return false;
}
vitalityAutoRegenOn = StartRegenInternal(1, 1);
return vitalityAutoRegenOn;
/* NOP */;
}
public final function StopVitalityRegen(){

if (!vitalityAutoRegenOn){
return;
}
StopRegenInternal(1);
vitalityAutoRegenOn = false;
/* NOP */;
}
public final function StartEssenceRegen() : Bool{
if (essenceAutoRegenOn){
return false;
}
essenceAutoRegenOn = StartRegenInternal(2, 3);
return essenceAutoRegenOn;
/* NOP */;
}
public final function StopEssenceRegen(){
if (!essenceAutoRegenOn){
return;
}
StopRegenInternal(3);
essenceAutoRegenOn = false;
/* NOP */;
}
public final function StartStaminaRegen() : Bool{
if (staminaAutoRegenOn){
return false;
}
staminaAutoRegenOn = StartRegenInternal(5, 2);
return staminaAutoRegenOn;
/* NOP */;
}
public final function StopStaminaRegen(){
if (!staminaAutoRegenOn){
return;
}
StopRegenInternal(2);
staminaAutoRegenOn = false;
/* NOP */;
}
public final function StartMoraleRegen() : Bool{
if (moraleAutoRegenOn){
return false;
}
moraleAutoRegenOn = StartRegenInternal(3, 4);
return moraleAutoRegenOn;
/* NOP */;
}
public final function StopMoraleRegen(){
if (!moraleAutoRegenOn){
return;
}
StopRegenInternal(4);
moraleAutoRegenOn = false;
/* NOP */;
}
public final function StartPanicRegen() : Bool{
if (panicAutoRegenOn){
return false;
}
panicAutoRegenOn = StartRegenInternal(7, 66);

return panicAutoRegenOn;
/* NOP */;
}
public final function StopPanicRegen(){
if (!panicAutoRegenOn){
return;
}
StopRegenInternal(66);
panicAutoRegenOn = false;
/* NOP */;
}
public final function StartAirRegen() : Bool{
if (airAutoRegenOn){
return false;
}
airAutoRegenOn = StartRegenInternal(6, 59);
return airAutoRegenOn;
/* NOP */;
}
public final function StopAirRegen(){
if (!airAutoRegenOn){
return;
}
StopRegenInternal(59);
airAutoRegenOn = false;
/* NOP */;
}
public final function StartSwimmingStaminaRegen() : Bool{
if (swimmingStaminaAutoRegenOn){
return false;
}
swimmingStaminaAutoRegenOn = StartRegenInternal(8, 106);
return airAutoRegenOn;
/* NOP */;
}
public final function StopSwimmingStaminaRegen(){
if (!airAutoRegenOn){
return;
}
StopRegenInternal(106);
airAutoRegenOn = false;
/* NOP */;
}
private final function StopRegenInternal(effectType : EEffectType){
var effect : CBaseGameplayEffect;
effect = GetEffect(effectType, /* NOP */);
RemoveEffect(effect, true);
/* NOP */;
}
private final function StartRegenInternal(regenStat : ECharacterRegenSta
ts, effectType : EEffectType) : Bool{
var autoEffects : array<CName>;
var npc : CNewNPC;
var i : Int32;
var addResult : EEffectInteract;
npc = (CNewNPC)owner;
if (npc && npc.GetNPCType() == 1 || !npc && !(CR4Player)owner){
return false;
}
owner.GetAutoEffects(autoEffects);

FilterOutAllApart(autoEffects, effectType);
if (regenStat != 4){
FilterAutoBuff(autoEffects, regenStat, effectType);
}
if (autoEffects.Size() > 0){
addResult = InternalAddEffect(effectType, owner, 'autobu
ff', /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
if (addResult == 3){
return true;
} else if (addResult == 4){
owner.SetEffectsUpdateTicking(true, /* NOP */);
return true;
}
}
return false;
/* NOP */;
}
public final function OnLoad(own : CActor){
var i : Int32;
owner = own;
hasCriticalStateSaveLock = false;
ownerIsWitcher = (W3PlayerWitcher)owner;
i = 0;
while (i < effects.Size()){
effects[i].OnLoad(owner, this);
i += 1;
}
staminaAutoRegenOn = false;
essenceAutoRegenOn = false;
staminaAutoRegenOn = false;
moraleAutoRegenOn = false;
panicAutoRegenOn = false;
airAutoRegenOn = false;
swimmingStaminaAutoRegenOn = false;
adrenalineAutoRegenOn = false;
owner.SetEffectsUpdateTicking(true, /* NOP */);
isReady = true;
/* NOP */;
}
public final function IsReady() : Bool{
return isReady;
/* NOP */;
}
public final function GetCurrentlyAnimatedCS() : CBaseGameplayEffect{
return currentlyAnimatedCS;
/* NOP */;
}
public final function SetCurrentlyAnimatedCS(buff : CBaseGameplayEffect)
{
if (owner == thePlayer){
LogCriticalPlayer("** EffectManager.SetCurrentlyAnimated
CS() - current is now <<" + buff + ">>");
}
if (!buff){
/* NOP */;
}
currentlyAnimatedCS = buff;
/* NOP */;
}

public final function GetCurrentEffects(type : EEffectType, sourceName :


String, partialSourceNameSearch : Bool) : array<CBaseGameplayEffect>{
var i : Int32;
var ret : array<CBaseGameplayEffect>;
var buffOk : Bool;
var sourceNameSet : Bool;
sourceNameSet = sourceName != "" && sourceName != "None" && sour
ceName != "none";
if (type == 0 && !sourceNameSet){
return effects;
}
i = 0;
while (i < effects.Size()){
if (effects[i]){
buffOk = true;
if (type != 0){
if (type != effects[i].GetEffectType()){
buffOk = false;
}
}
if (buffOk){
if (partialSourceNameSearch){
buffOk = StrFindFirst(effects[i]
.GetSourceName(), sourceName) != -1;
} else if (!sourceNameSet){
buffOk = true;
} else {
buffOk = effects[i].GetSourceNam
e() == sourceName;
}
if (buffOk){
ret.PushBack(effects[i]);
}
}
}
i += 1;
}
return ret;
/* NOP */;
}
private final function ApplyEffect(effect : CBaseGameplayEffect, overrid
enEffectsIdxs : array<Int32>, cumulateIdx : Int32, customParams : W3BuffCustomPa
rams) : EEffectInteract{
var i : Int32;
var size : Int32;
size = overridenEffectsIdxs.Size();
i = size - 1;
while (i >= 0){
RemoveEffectOnIndex(overridenEffectsIdxs[i], true);
i -= 1;
}
if (cumulateIdx >= 0){
effects[cumulateIdx].CumulateWith(effect);
delete effect;
return 4;
} else {
effect.OnEffectAdded(customParams);
if (!effect.IsActive()){
LogAssert(false, "W3EffectManager.ApplyEffect: e
ffect <<" + effect + ">> did not add properly (is inactive just after added) to

<<" + owner + ">> and is removed!");


effect.OnEffectRemoved();
return 0;
}
effects.PushBack(effect);
owner.SetEffectsUpdateTicking(true, isInitializingAutobu
ffs);
OnBuffAdded(effect);
effect.OnEffectAddedPost();
if (size > 0){
return 2;
} else {
return 3;
}
}
/* NOP */;
}
private final function OnBuffRemoved(){
if (hasCriticalStateSaveLock && GetCriticalBuffsCount() == 0){
theGame.ReleaseNoSaveLock(criticalStateSaveLockId);
hasCriticalStateSaveLock = false;
}
/* NOP */;
}
private final function OnBuffAdded(effect : CBaseGameplayEffect){
var signEffects : array<CBaseGameplayEffect>;
var npcOwner : CNewNPC;
var mutagen : W3Mutagen13_Effect;
var i : Int32;
var effectType : EEffectType;
effectType = effect.GetEffectType();
if (!hasCriticalStateSaveLock && owner == thePlayer && IsCritica
lEffectType(effectType)){
theGame.CreateNoSaveLock("critical_state", criticalState
SaveLockId, /* NOP */, /* NOP */);
hasCriticalStateSaveLock = true;
}
npcOwner = (CNewNPC)owner;
if (npcOwner && effectType == 18 || effectType == 16 || effectTy
pe == 19 || effectType == 15 && !npcOwner.WasBurnedBleedingPoisoned()){
if (owner.HasBuff(18) && owner.HasBuff(16) && owner.HasB
uff(19) || owner.HasBuff(15)){
theGame.GetGamerProfile().IncStat(1);
npcOwner.SetBleedBurnPoison();
}
}
if (owner == thePlayer && IsBuffShrine(effectType) && HasAllShri
neBuffs()){
theGame.GetGamerProfile().AddAchievement(42);
}
mutagen = (W3Mutagen13_Effect)owner.GetBuff(85, /* NOP */);
if (mutagen && mutagen.IsEffectTypeAffected(effectType)){
effect.SetTimeLeft(mutagen.GetForcedDuration());
}
if (pausedNotAppliedAutoBuffs.Size() > 0 && IsBuffAutoBuff(effec
tType)){
i = pausedNotAppliedAutoBuffs.Size() - 1;
while (i >= 0){
if (pausedNotAppliedAutoBuffs[i].effectType == e
ffectType){

PauseEffect(effect, pausedNotAppliedAuto
Buffs[i].sourceName, pausedNotAppliedAutoBuffs[i].singleLock, pausedNotAppliedAu
toBuffs[i].duration, pausedNotAppliedAutoBuffs[i].useMaxDuration);
pausedNotAppliedAutoBuffs.EraseFast(i);
}
i -= 1;
}
}
/* NOP */;
}
public final function UpdateLocalBuffsArray(localArray : array<CBaseGame
playEffect>){
var i : Int32;
i = localArray.Size() - 1;
while (i >= 0){
if (!effects.Contains(localArray[i])){
localArray.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public final function AddEffectCustom(params : SCustomEffectParams) : EE
ffectInteract{
return InternalAddEffect(params.effectType, params.creator, para
ms.sourceName, params.duration, params.effectValue, params.customAbilityName, pa
rams.customFXName, params.isSignEffect, params.customPowerStatValue, params.buff
SpecificParams, params.vibratePadLowFreq, params.vibratePadHighFreq);
/* NOP */;
}
public final function AddEffectDefault(effectType : EEffectType, creat :
CGameplayEntity, srcName : String, signEffect : Bool) : EEffectInteract{
var none : SAbilityAttributeValue;
var noneParams : W3BuffCustomParams;
return InternalAddEffect(effectType, creat, srcName, 0, none, 'N
one', 'None', signEffect, none, noneParams, /* NOP */, /* NOP */);
/* NOP */;
}
private final function InternalAddEffect(effectType : EEffectType, creat
: CGameplayEntity, srcName : String, inDuration : Float, customVal : SAbilityAt
tributeValue, customAbilityName : CName, customFXName : CName, signEffect : Bool
, powerStatValue : SAbilityAttributeValue, customParams : W3BuffCustomParams, vi
bratePadLowFreq : Float, vibratePadHighFreq : Float) : EEffectInteract{
var effect : CBaseGameplayEffect;
var overridenEffectsIdxs : array<Int32>;
var cumulateIdx : Int32;
var i : Int32;
var npc : CNewNPC;
var actorCreator : CActor;
var action : W3DamageAction;
var hasQuen : Bool;
var damages : array<SRawDamage>;
if (effectType == 0){
LogAssert(false, "EffectManager.AddEffectByType: trying
to add effect of undefined type!");
return 0;
}
if (effectType == 18){
if ((CMovingPhysicalAgentComponent)owner.GetMovingAgentC
omponent().GetSubmergeDepth() <= -1){

LogEffects("EffectManager.InternalAddEffect: uni
t <<" + owner + ">> will not get burning effect since it's underwater!");
return 1;
}
} else if (effectType == 11){
npc = (CNewNPC)owner;
if (npc && npc.IsFlying()){
LogEffects("EffectManager.InternalAddEffect: uni
t <<" + owner + ">> will not get frozen effect since it's currently flying!");
return 1;
}
}
if ((W3PlayerWitcher)owner && GetWitcherPlayer().IsAnyQuenActive
()){
hasQuen = true;
if (effectType == 13 || effectType == 46 || effectType =
= 56){
GetWitcherPlayer().FinishQuen();
LogEffects("EffectManager.InternalAddEffect: Ger
alt has active quen so it breaks and we don't stagger.");
return 1;
}
}
if (srcName == "" && creat){
srcName = creat.GetName();
}
if (!owner.IsAlive() && !effect.CanBeAppliedOnDeadTarget()){
return 1;
}
actorCreator = (CActor)creat;
if (owner.IsImmuneToBuff(effectType) && !actorCreator.HasAbility
('ForceCriticalEffects') || IsCriticalEffectType(effectType)){
LogEffects("EffectManager.InternalAddEffect: unit <<" +
owner + ">> is immune to effect of this type (" + effectType + ")");
return 1;
}
if (actorCreator && GetAttitudeBetween(actorCreator, owner) == 0
&& creat != owner && IsNegativeEffectType(effectType) && effectType != 5 && eff
ectType != 36){
LogAssert(false, "EffectManager.InternalAddEffect: unit
<<" + owner + ">> is friendly to buff creator: <<" + creat + ">> negative buff c
annot be added");
return 1;
}
effect = theGame.effectMgr.MakeNewEffect(effectType, creat, owne
r, this, inDuration, srcName, powerStatValue, customVal, customAbilityName, cust
omFXName, signEffect, vibratePadLowFreq, vibratePadHighFreq);
if (effect){
if (hasQuen || (W3PlayerWitcher)owner && FactsQuerySum("
player_had_quen") > 0 && IsDoTEffect(effect)){
FactsRemove("player_had_quen");
if ((W3DamageOverTimeEffect)effect){
damages = (W3DamageOverTimeEffect)effect
.HAXXX_GetQuenDamages();
} else if ((W3CriticalDOTEffect)effect){
damages = (W3CriticalDOTEffect)effect.HA
XXX_GetQuenDamages();
}
action = new W3DamageAction in theGame;
action.Initialize(creat, owner, effect, srcName,

0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.SetHitAnimationPlayType(2);
i = 0;
while (i < damages.Size()){
action.AddDamage(damages[i].dmgType, dam
ages[i].dmgVal);
i += 1;
}
action.SetPointResistIgnored(true);
action.SetIsDoTDamage(0.100000);
theGame.damageMgr.ProcessAction(action);
delete action;
LogEffects("EffectManager.InternalAddEffect: app
lying DoT when having quen: dealing 0.1s of damage and aborting");
return 1;
}
if (effect.GetDurationLeft() == 0){
LogEffects("EffectManager.InternalAddEffect: uni
t <<" + owner + ">>: effect <<" + effectType + ">> cannot be added as its final
duration is 0.");
LogEffects("EffectManager.InternalAddEffect: thi
s can be due to high unit's resist, which is " + NoTrailZeros(effect.GetBuffResi
st() * 100) + "%.");
return 1;
}
if (signEffect && effectType == 5 || effectType == 7 &&
creat == thePlayer && thePlayer.CanUseSkill(53) && thePlayer.GetSkillLevel(53) =
= 3 && effect.GetDurationLeft() < CalculateAttributeValue(thePlayer.GetSkillAttr
ibuteValue(53, 'duration_to_force_stagger', false, true), /* NOP */)){
LogEffects("EffectManager.InternalAddEffect: Axi
i effect is blocked, will be stagger from S_Magic_s17 skill");
return 1;
}
if (theGame.effectMgr.CheckInteractionWith(this, effect,
effects, overridenEffectsIdxs, cumulateIdx)){
return ApplyEffect(effect, overridenEffectsIdxs,
cumulateIdx, customParams);
} else {
return 1;
}
}
return 0;
/* NOP */;
}
public final function GetDrunkMutagens() : array<CBaseGameplayEffect>{
var i : Int32;
var ret : array<CBaseGameplayEffect>;
var mutagen : W3Mutagen_Effect;
i = 0;
while (i < effects.Size()){
mutagen = (W3Mutagen_Effect)effects[i];
if (mutagen){
ret.PushBack(mutagen);
}
i += 1;
}
return ret;
/* NOP */;
}
public final function GetPotionBuffs() : array<CBaseGameplayEffect>{

var i : Int32;
var ret : array<CBaseGameplayEffect>;
i = 0;
while (i < effects.Size()){
if (effects[i].IsPotionEffect()){
ret.PushBack(effects[i]);
}
i += 1;
}
return ret;
/* NOP */;
}
public final function GetEffect(effectType : EEffectType, sourceName : S
tring) : CBaseGameplayEffect{
var i : Int32;
var size : Int32;
size = effects.Size();
i = 0;
while (i < size){
if (effects[i].GetEffectType() == effectType){
if (StrLen(sourceName) == 0 || sourceName == eff
ects[i].GetSourceName()){
return effects[i];
}
}
i += 1;
}
return NULL;
/* NOP */;
}
public final function RemoveEffect(effect : CBaseGameplayEffect, csForce
dRemove : Bool){
var witcher : W3PlayerWitcher;
var i : Int32;
var autoBuffPause : SPausedAutoEffect;
var isCritical : Bool;
if (!effect || !effects.Contains(effect)){
return;
}
isCritical = IsCriticalEffect(effect);
if (owner == thePlayer && isCritical){
LogCriticalPlayer("EffectManager.RemoveEffect() | " + ef
fect + " - forced: " + csForcedRemove);
}
if (!csForcedRemove && isCritical && currentlyAnimatedCS == effe
ct){
if (effect.IsActive()){
effect.SetTimeLeft(0);
return;
}
}
if (isCritical && effect == owner.GetNewRequestedCS()){
owner.SetNewRequestedCS(NULL);
}
effects.Remove(effect);
if (effects.Size() == 0){
owner.SetEffectsUpdateTicking(false, /* NOP */);
}
effect.OnEffectRemoved();
OnBuffRemoved();

if (ownerIsWitcher){
witcher = GetWitcherPlayer();
if (witcher.GetSkillBonusPotionEffect() == effect){
witcher.ClearSkillBonusPotionEffect();
}
}
if (isCritical && currentlyAnimatedCS == effect){
owner.RaiseEvent('CriticalStateEnded');
SetCurrentlyAnimatedCS(NULL);
}
i = pausedEffects.Size() - 1;
while (i >= 0){
if (pausedEffects[i].buff != effect){
} else {
if (IsBuffAutoBuff(pausedEffects[i].buff.GetEffe
ctType())){
autoBuffPause.effectType = effect.GetEff
ectType();
autoBuffPause.duration = pausedEffects[i
].duration;
autoBuffPause.timeLeft = pausedEffects[i
].timeLeft;
autoBuffPause.sourceName = pausedEffects
[i].source;
autoBuffPause.singleLock = pausedEffects
[i].singleLock;
autoBuffPause.useMaxDuration = pausedEff
ects[i].useMaxDuration;
pausedNotAppliedAutoBuffs.PushBack(autoB
uffPause);
}
pausedEffects.EraseFast(i);
break;
}
i -= 1;
}
delete effect;
/* NOP */;
}
private final function RemoveEffectOnIndex(index : Int32, csForcedRemove
: Bool){
RemoveEffect(effects[index], csForcedRemove);
/* NOP */;
}
public final function RemoveAllPotionEffectsBut(skip : CBaseGameplayEffe
ct){
var size : Int32;
var i : Int32;
size = effects.Size();
i = size - 1;
while (i >= 0){
if (effects[i].IsPotionEffect() && effects[i] != skip){
RemoveEffectOnIndex(i, /* NOP */);
}
i -= 1;
}
/* NOP */;
}
public final function RemoveAllEffectsOfType(type : EEffectType, forced
: Bool){

var i : Int32;
i = effects.Size() - 1;
while (i >= 0){
if (effects[i].GetEffectType() == type){
RemoveEffectOnIndex(i, forced);
}
i -= 1;
}
/* NOP */;
}
public final function RemoveAllNonAutoEffects(){
var autoEffects : array<CName>;
var i : Int32;
var type : EEffectType;
var tmpName : CName;
var autos : array<EEffectType>;
owner.GetAutoEffects(autoEffects);
i = 0;
while (i < autoEffects.Size()){
EffectNameToType(autoEffects[i], type, tmpName);
autos.PushBack(type);
i += 1;
}
if (!autos.Contains(1)){
autos.PushBack(1);
}
if (!autos.Contains(2)){
autos.PushBack(2);
}
if (!autos.Contains(3)){
autos.PushBack(3);
}
if (!autos.Contains(4)){
autos.PushBack(4);
}
i = effects.Size() - 1;
while (i >= 0){
type = effects[i].GetEffectType();
if (!autos.Contains(type)){
RemoveEffectOnIndex(i, true);
}
i -= 1;
}
/* NOP */;
}
public final function OwnerHasDied(){
var i : Int32;
i = effects.Size() - 1;
while (i >= 0){
effects[i].OnTargetDeath();
i -= 1;
}
/* NOP */;
}
public final function OwnerHasEnteredUnconscious(){
var i : Int32;
i = effects.Size() - 1;
while (i >= 0){
effects[i].OnTargetUnconscious();
i -= 1;

}
/* NOP */;
}
public final function OnOwnerRevived(){
var i : Int32;
RemoveAllNonAutoEffects();
cachedDamages.Clear();
SetCurrentlyAnimatedCS(NULL);
i = 0;
while (i < statDeltas.Size()){
statDeltas[i] = 0;
i += 1;
}
ResumeAllBuffsForced();
vitalityAutoRegenOn = false;
essenceAutoRegenOn = false;
staminaAutoRegenOn = false;
moraleAutoRegenOn = false;
panicAutoRegenOn = false;
airAutoRegenOn = false;
swimmingStaminaAutoRegenOn = false;
adrenalineAutoRegenOn = false;
StartStaminaRegen();
StartVitalityRegen();
StartEssenceRegen();
StartMoraleRegen();
StartPanicRegen();
StartAirRegen();
StartSwimmingStaminaRegen();
/* NOP */;
}
public final function OwnerHasFinishedDeathAnim(){
var i : Int32;
i = effects.Size() - 1;
while (i >= 0){
effects[i].OnTargetDeathAnimFinished();
i -= 1;
}
/* NOP */;
}
private final function UpdateStatValueChange(stat : EBaseCharacterStats,
val : Float){
var playerOwner : CR4Player;
if (val > 0){
owner.GainStat(stat, val);
return;
} else if (val == 0){
return;
}
val = -val;
playerOwner = (CR4Player)owner;
switch(stat){
case 2:
owner.DrainStamina(13, val, 1, /* NOP */, /* NOP */, /*
NOP */);
break;
case 3:
if (playerOwner){
playerOwner.DrainToxicity(val);
} else {

LogAssert(false, "W3EffectManager.UpdateStatValu
eChange: trying to drain Toxicity points on non-player!");
}
break;
case 4:
if (playerOwner){
playerOwner.DrainFocus(val);
} else {
LogAssert(false, "W3EffectManager.UpdateStatValu
eChange: trying to drain Focus points on non-player!");
}
break;
case 5:
owner.DrainMorale(val);
break;
case 7:
owner.AddPanic(val);
break;
case 6:
owner.DrainAir(val, /* NOP */);
break;
case 9:
owner.DrainSwimmingStamina(val, /* NOP */);
break;
default:
LogAssert(false, "W3EffectManager.UpdateStatValueChange:
trying to drain invalid stat <<" + stat + ">>!");
break;
}
/* NOP */;
}
public final function HasEffect(effectType : EEffectType) : Bool{
var i : Int32;
var size : Int32;
if (effectType != 0){
size = effects.Size();
i = 0;
while (i < size){
if (effects[i] && effects[i].GetEffectType() ==
effectType){
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
public final function GetEffectTimePercentageByType(effectType : EEffect
Type) : Int32{
var i : Int32;
var size : Int32;
if (effectType != 0){
size = effects.Size();
i = 0;
while (i < size){
if (effects[i].GetEffectType() == effectType){
return GetEffectTimePercentage(effects[i
]);
}

i += 1;
}
}
return 0;
/* NOP */;
}
public final function GetEffectTimePercentage(buff : CBaseGameplayEffect
) : Int32{
var maxDur : Float;
if (buff){
maxDur = buff.GetInitialDuration();
if (maxDur > 0){
return RoundMath(100.000000 * buff.GetDurationLe
ft() / maxDur);
}
}
return 0;
/* NOP */;
}
public final function AddEffectsFromAction(action : W3DamageAction) : Bo
ol{
var i : Int32;
var size : Int32;
var effectInfos : array<SEffectInfo>;
var ret : EEffectInteract;
var signProjectile : W3SignProjectile;
var attackerPowerStatValue : SAbilityAttributeValue;
var retB : Bool;
var applyBuff : Bool;
var signEntity : W3SignEntity;
var canLog : Bool;
canLog = theGame.CanLog();
size = action.GetEffects(effectInfos);
signProjectile = (W3SignProjectile)action.causer;
attackerPowerStatValue = action.GetPowerStatValue();
retB = true;
signEntity = (W3SignEntity)action.causer;
if (!signEntity && signProjectile){
signEntity = signProjectile.GetSignEntity();
}
i = 0;
while (i < size){
if (canLog){
LogDMHits("Trying to add buff <<" + effectInfos[
i].effectType + ">> on target...", action);
}
if (signEntity){
applyBuff = GetSignApplyBuffTest(signEntity.GetS
ignType(), effectInfos[i].effectType, attackerPowerStatValue, signEntity.IsAlter
nateCast(), (CActor)action.attacker);
} else {
applyBuff = GetNonSignApplyBuffTest(effectInfos[
i].applyChance);
}
if (applyBuff){
ret = InternalAddEffect(effectInfos[i].effectTyp
e, action.attacker, action.GetBuffSourceName(), effectInfos[i].effectDuration, e
ffectInfos[i].effectCustomValue, effectInfos[i].effectAbilityName, effectInfos[i
].customFXName, signEntity, attackerPowerStatValue, effectInfos[i].effectCustomP
aram, /* NOP */, /* NOP */);

} else if (signEntity.GetSignType() == 0){


ret = InternalAddEffect(13, action.attacker, act
ion.GetBuffSourceName(), effectInfos[i].effectDuration, effectInfos[i].effectCus
tomValue, effectInfos[i].customFXName, effectInfos[i].effectAbilityName, signEnt
ity, attackerPowerStatValue, effectInfos[i].effectCustomParam, /* NOP */, /* NOP
*/);
}
if (theGame.CanLog()){
if (ret == 0){
retB = false;
LogDMHits("... not valid effect!", actio
n);
} else if (!applyBuff){
LogDMHits("... failed randomization test
.", action);
} else if (ret == 1){
LogDMHits("... denied.", action);
} else if (ret == 2){
LogDMHits("... overriden by other effect
already on target.", action);
} else if (ret == 3){
LogDMHits("... added.", action);
} else if (ret == 4){
LogDMHits("... cumulated with existing e
ffect on target.", action);
}
} else if (ret == 0){
retB = false;
}
i += 1;
}
return retB;
/* NOP */;
}
private final function GetNonSignApplyBuffTest(applyChance : Float) : Bo
ol{
return RandF() < applyChance;
/* NOP */;
}
private final function GetSignApplyBuffTest(signType : ESignType, effect
Type : EEffectType, powerStatValue : SAbilityAttributeValue, isAlternate : Bool,
caster : CActor) : Bool{
var sp : Float;
var res : Float;
var chance : Float;
var tempF : Float;
var chanceBonus : SAbilityAttributeValue;
var witcher : W3PlayerWitcher;
witcher = (W3PlayerWitcher)caster;
if (witcher && witcher.GetPotionBuffLevel(28) == 3){
return true;
}
sp = powerStatValue.valueMultiplicative;
owner.GetResistValue(theGame.effectMgr.GetBuffResistStat(effectT
ype), tempF, res);
chance = sp / theGame.params.MAX_SPELLPOWER_ASSUMED - res;
if (signType == 1 || signType == 4){
chance = 1;
} else if (signType == 2){
if (witcher){

if (witcher.CanUseSkill(45)){
chanceBonus = witcher.GetSkillAttributeV
alue(45, 'chance_bonus', false, true);
chance += chance * chanceBonus.valueMult
iplicative * witcher.GetSkillLevel(45) + chanceBonus.valueAdditive * witcher.Get
SkillLevel(45);
}
if (witcher.CanUseSkill(82)){
chance += CalculateAttributeValue(witche
r.GetSkillAttributeValue(82, 'burning_chance', false, true), /* NOP */);
}
}
} else if (signType == 3 && effectType == 10){
witcher = (W3PlayerWitcher)caster;
if (witcher){
chanceBonus = witcher.GetSkillAttributeValue(49,
'chance_multiplier', false, true);
chance *= CalculateAttributeValue(chanceBonus, /
* NOP */);
}
if (owner.HasAbility('WeakToAard')){
chance = 1;
}
} else if (signType == 0 && owner.HasAbility('WeakToAard')){
chance = 1;
}
chance = ClampF(chance, 0, 1);
LogEffects("Buff <<" + effectType + ">> is from sign, chance = "
+ NoTrailZeros(100 * chance) + "%, spell_power = " + NoTrailZeros(sp) + ", resi
st=" + NoTrailZeros(res));
if (RandF() >= chance){
if (theGame.CanLog()){
LogEffects("Sign buff chance failed - no effect
applied");
}
return false;
} else {
LogEffects("Sign buff chance succeeded!");
}
return true;
/* NOP */;
}
public final function ProcessOnHitEffects(victim : CActor, silverSword :
Bool, steelSword : Bool, sign : Bool){
var i : Int32;
var applicator : W3Effect_ApplicatorOnHit;
i = 0;
while (i < effects.Size()){
applicator = (W3Effect_ApplicatorOnHit)effects[i];
if (applicator){
applicator.ProcessOnHit(victim, silverSword, ste
elSword, sign);
}
i += 1;
}
/* NOP */;
}
public final function PauseEffects(effectType : EEffectType, sourceName
: CName, singleLock : Bool, duration : Float, useMaxDuration : Bool){
var i : Int32;

var pausedAnyBuff : Bool;


var pause : SPausedAutoEffect;
if (duration == 0){
duration = -1;
}
i = 0;
while (i < effects.Size()){
if (effects[i].GetEffectType() == effectType){
PauseEffect(effects[i], sourceName, singleLock,
duration, useMaxDuration);
pausedAnyBuff = true;
}
i += 1;
}
if (!pausedAnyBuff && IsBuffAutoBuff(effectType)){
pause.effectType = effectType;
pause.sourceName = sourceName;
pause.singleLock = singleLock;
pause.duration = duration;
pause.useMaxDuration = useMaxDuration;
pause.timeLeft = duration;
pausedNotAppliedAutoBuffs.PushBack(pause);
}
/* NOP */;
}
private final function PauseEffect(buff : CBaseGameplayEffect, sourceNam
e : CName, singleLock : Bool, duration : Float, useMaxDuration : Bool){
var tpe : STemporarilyPausedEffect;
var j : Int32;
var processed : Bool;
processed = false;
j = 0;
while (j < pausedEffects.Size()){
if (pausedEffects[j].buff == buff && pausedEffects[j].so
urce == sourceName){
if (duration > 0){
if (useMaxDuration){
pausedEffects[j].timeLeft = MaxF
(pausedEffects[j].timeLeft, duration);
} else {
pausedEffects[j].timeLeft = dura
tion;
}
} else if (pausedEffects[j].timeLeft >= 0){
pausedEffects[j].timeLeft = -1;
}
processed = true;
buff = pausedEffects[j].buff;
break;
}
j += 1;
}
if (!processed){
tpe.buff = buff;
tpe.timeLeft = duration;
tpe.duration = duration;
tpe.source = sourceName;
tpe.singleLock = singleLock;
tpe.useMaxDuration = useMaxDuration;
pausedEffects.PushBack(tpe);

}
buff.Pause(sourceName, singleLock);
/* NOP */;
}
public final function PauseAllRegenEffects(sourceName : CName, singleLoc
k : Bool, duration : Float, useMaxDuration : Bool){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
PauseEffects(regenEffect.GetEffectType(), source
Name, singleLock, duration, useMaxDuration);
}
i += 1;
}
/* NOP */;
}
public final function ResumeAllRegenEffects(sourceName : CName){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
ResumeEffects(regenEffect.GetEffectType(), sourc
eName);
}
i += 1;
}
/* NOP */;
}
private final function ResumeAllBuffsForced(){
var i : Int32;
i = 0;
while (i < effects.Size()){
ResumeEffectsInternal(effects[i].GetEffectType(), 'None'
, true);
i += 1;
}
/* NOP */;
}
public final function PauseHPRegenEffects(sourceName : CName, duration :
Float){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
if (regenEffect.GetRegenStat() == 1 || regenEffe
ct.GetRegenStat() == 2){
PauseEffects(effects[i].GetEffectType(),
sourceName, true, duration, /* NOP */);
}
}
i += 1;
}
/* NOP */;

}
public final function PauseStaminaRegen(sourceName : CName){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
if (regenEffect.GetRegenStat() == 5){
PauseEffects(effects[i].GetEffectType(),
sourceName, true, /* NOP */, /* NOP */);
}
}
i += 1;
}
/* NOP */;
}
public final function ResumeStaminaRegen(sourceName : CName){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
if (regenEffect.GetRegenStat() == 5){
ResumeEffects(effects[i].GetEffectType()
, sourceName);
}
}
i += 1;
}
/* NOP */;
}
public final function ResumeHPRegenEffects(sourceName : CName){
var i : Int32;
var regenEffect : W3RegenEffect;
i = 0;
while (i < effects.Size()){
regenEffect = (W3RegenEffect)effects[i];
if (regenEffect){
if (regenEffect.GetRegenStat() == 1 || regenEffe
ct.GetRegenStat() == 2){
ResumeEffects(effects[i].GetEffectType()
, sourceName);
}
}
i += 1;
}
/* NOP */;
}
public final function ResumeEffects(effectType : EEffectType, sourceName
: CName){
ResumeEffectsInternal(effectType, sourceName, /* NOP */);
/* NOP */;
}
private final function ResumeEffectsInternal(effectType : EEffectType, s
ourceName : CName, forced : Bool){
var i : Int32;
var j : Int32;
var removedOneLock : Bool;

i = 0;
while (i < effects.Size()){
if (effects[i].GetEffectType() == effectType && forced |
| effects[i].IsPaused(sourceName)){
if (forced){
effects[i].ResumeForced();
} else {
effects[i].Resume(sourceName);
}
j = 0;
while (j < pausedEffects.Size()){
if (pausedEffects[j].buff == effects[i]
&& forced || sourceName == pausedEffects[j].source){
pausedEffects.EraseFast(j);
}
j += 1;
}
}
i += 1;
}
removedOneLock = false;
i = pausedNotAppliedAutoBuffs.Size() - 1;
while (i >= 0){
if (pausedNotAppliedAutoBuffs[i].effectType == effectTyp
e && forced || pausedNotAppliedAutoBuffs[i].sourceName == sourceName){
if (pausedNotAppliedAutoBuffs[i].singleLock){
pausedNotAppliedAutoBuffs.Erase(i);
continue;
} else if (!removedOneLock){
pausedNotAppliedAutoBuffs.Erase(i);
removedOneLock = true;
}
}
i -= 1;
}
/* NOP */;
}
public final function GetCriticalBuffsCount() : Int32{
var i : Int32;
var cnt : Int32;
cnt = 0;
i = 0;
while (i < effects.Size()){
if (IsCriticalEffect(effects[i])){
cnt += 1;
}
i += 1;
}
return cnt;
/* NOP */;
}
public final function GetCriticalBuffs() : array<CBaseGameplayEffect>{
var i : Int32;
var ret : array<CBaseGameplayEffect>;
i = 0;
while (i < effects.Size()){
if (IsCriticalEffect(effects[i])){
ret.PushBack(effects[i]);
}
i += 1;

}
return ret;
/* NOP */;
}
public final function HasPotionBuff() : Bool{
var i : Int32;
i = 0;
while (i < effects.Size()){
if (effects[i].IsPotionEffect() && effects[i].IsActive()
){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public final function CacheStatUpdate(stat : EBaseCharacterStats, value
: Float){
if (value == 0){
LogAssert(false, "EffectManager.CacheStatUpdate: value i
s 0 for <<" + owner + ">> and stat <<" + stat + ">> !!!");
return;
}
statDeltas[stat] += value;
owner.SetEffectsUpdateTicking(true, /* NOP */);
/* NOP */;
}
public final function CacheDamage(damageTypeName : CName, val : Float, a
ttacker : CGameplayEntity, carrier : CBaseGameplayEffect, DoTdt : Float, dontSho
wHitParticle : Bool, pwrStatType : ECharacterPowerStats, isEnvironment : Bool){
var dmg : SEffectCachedDamage;
var eh : EntityHandle;
if (val <= 0){
LogAssert(false, "EffectManager.CacheDamage: value is <=
0!");
return;
}
EntityHandleSet(eh, attacker);
dmg.dmgType = damageTypeName;
dmg.dmgVal = val;
dmg.attacker = eh;
dmg.carrier = carrier;
dmg.dt = DoTdt;
dmg.dontShowHitParticle = dontShowHitParticle;
dmg.powerStatType = pwrStatType;
dmg.isEnvironment = isEnvironment;
if (carrier){
dmg.sourceName = carrier.GetSourceName();
}
cachedDamages.PushBack(dmg);
owner.SetEffectsUpdateTicking(true, /* NOP */);
/* NOP */;
}
public final function RecalcEffectDurations(){
var i : Int32;
i = 0;
while (i < effects.Size()){
effects[i].RecalcDuration();
i += 1;

}
/* NOP */;
}
public final function UpdateApplicatorBuffs(){
var i : Int32;
var applicator : W3ApplicatorEffect;
i = 0;
while (i < effects.Size()){
applicator = (W3ApplicatorEffect)effects[i];
if (applicator){
applicator.UpdateParams();
}
i += 1;
}
/* NOP */;
}
public final function GetPotionBuffLevel(effectType : EEffectType) : Int
32{
var buff : CBaseGameplayEffect;
buff = GetEffect(effectType, /* NOP */);
if (buff && buff.IsPotionEffect()){
return buff.GetBuffLevel();
}
return 0;
/* NOP */;
}
public final function CanBeRemoved() : Bool{
var i : Int32;
if (effects.Size() > 0){
return false;
}
if (cachedDamages.Size() > 0){
return false;
}
i = 0;
while (i < statDeltas.Size()){
if (statDeltas[i] != 0){
return false;
}
i += 1;
}
i = 0;
while (i < pausedEffects.Size()){
if (pausedEffects[i].duration != -1){
return false;
}
i += 1;
}
i = 0;
while (i < pausedNotAppliedAutoBuffs.Size()){
if (pausedNotAppliedAutoBuffs[i].duration != -1){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public final function ShouldStopFx(fx : CName) : Bool{
var i : Int32;

i = 0;
while (i < currentlyPlayedFX.Size()){
if (currentlyPlayedFX[i].fx == fx){
return currentlyPlayedFX[i].sources.Size() == 1;
}
i += 1;
}
return false;
/* NOP */;
}
public final function IsPlayingFX(fx : CName) : Bool{
var i : Int32;
i = 0;
while (i < currentlyPlayedFX.Size()){
if (currentlyPlayedFX[i].fx == fx){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public final function AddPlayedFX(fx : CName, sourceName : String){
var i : Int32;
var f : SCurrentBuffFX;
i = 0;
while (i < currentlyPlayedFX.Size()){
if (currentlyPlayedFX[i].fx == fx){
if (!currentlyPlayedFX[i].sources.Contains(sourc
eName)){
currentlyPlayedFX[i].sources.PushBack(so
urceName);
}
return;
}
i += 1;
}
f.fx = fx;
f.sources.PushBack(sourceName);
currentlyPlayedFX.PushBack(f);
/* NOP */;
}
public final function RemovePlayedFX(fx : CName, sourceName : String){
var i : Int32;
i = 0;
while (i < currentlyPlayedFX.Size()){
if (currentlyPlayedFX[i].fx == fx){
currentlyPlayedFX[i].sources.Remove(sourceName);
if (currentlyPlayedFX[i].sources.Size() == 0){
currentlyPlayedFX.EraseFast(i);
}
return;
}
i += 1;
}
/* NOP */;
}
public final function SimulateBuffTimePassing(simulatedTime : Float){
var i : Int32;
i = effects.Size() - 1;

while (i >= 0){


if (effects[i].GetInitialDuration() != -1){
RemoveEffectOnIndex(i, true);
}
i -= 1;
}
/* NOP */;
}
public final function Debug_ReleaseCriticalStateSaveLocks(){
if (hasCriticalStateSaveLock){
theGame.ReleaseNoSaveLock(criticalStateSaveLockId);
}
/* NOP */;
}
private final function HasAllShrineBuffs() : Bool{
var aard : Bool;
var axii : Bool;
var igni : Bool;
var quen : Bool;
var yrden : Bool;
var i : Int32;
var type : EEffectType;
i = 0;
while (i < effects.Size()){
type = effects[i].GetEffectType();
switch(type){
case 60:
aard = true;
break;
case 61:
axii = true;
break;
case 62:
igni = true;
break;
case 63:
quen = true;
break;
case 64:
yrden = true;
break;
default:
break;
}
i += 1;
}
return aard && axii && yrden && quen && igni;
/* NOP */;
}
public final function HasAnyMutagen23ShrineBuff() : Bool{
var i : Int32;
var shrineBuff : W3Effect_Shrine;
i = 0;
while (i < effects.Size()){
shrineBuff = (W3Effect_Shrine)effects[i];
if (shrineBuff && shrineBuff.IsFromMutagen23()){
return true;
}
i += 1;
}

return false;
/* NOP */;
}
}
import struct CScriptedExplorationTraverser{
import public function Update(deltaTime : Float);
import public function GetExplorationType(expType : EExplorationType) :
Bool;
}
import abstract class CPreAttackEventData{
//NULL type for rangeName
//NULL type for attackName
//NULL type for Damage_Hostile
//NULL type for Damage_Neutral
//NULL type for Damage_Friendly
//NULL type for weaponSlot
//NULL type for canBeDodged
//NULL type for hitReactionType
//NULL type for Can_Parry_Attack
//NULL type for swingType
//NULL type for swingDir
//NULL type for hitFX
//NULL type for hitBackFX
//NULL type for hitParriedFX
//NULL type for hitBackParriedFX
//NULL type for soundAttackType
}
class CPlayerInput extends CObject{
private saved var actionLocks : array<array<SInputActionLock>>;
private var totalCameraPresetChange : Float;
private var potAction : SInputAction;
private var potPress : Bool;
private var debugBlockSourceName : CName;
private var holdFastMenuInvoked : Bool;
private var pressTimestamp : Float;
private const var DOUBLE_TAP_WINDOW : Float;
private var processedSwordHold : Bool;
public var lastMovementDoubleTapName : CName;
public function Initialize(isFromLoad : Bool, previousInput : CPlayerInp
ut){
if (previousInput){
actionLocks = previousInput.actionLocks;
} else if (!isFromLoad){
actionLocks.Grow(EnumGetMax('EInputActionBlock') + 1);
}
theInput.RegisterListener(this, 'OnCommSprint', 'Sprint');
theInput.RegisterListener(this, 'OnCommSprintToggle', 'SprintTog
gle');
theInput.RegisterListener(this, 'OnCommWalkToggle', 'WalkToggle'
);
theInput.RegisterListener(this, 'OnCommGuard', 'Guard');
theInput.RegisterListener(this, 'OnCommSpawnHorse', 'SpawnHorse'
);
theInput.RegisterListener(this, 'OnCommDrinkPotion1', 'DrinkPoti
on1');
theInput.RegisterListener(this, 'OnCommDrinkPotion2', 'DrinkPoti
on2');

theInput.RegisterListener(this, 'OnCommSteelSword', 'SteelSword'


);
theInput.RegisterListener(this, 'OnCommSilverSword', 'SilverSwor
d');
theInput.RegisterListener(this, 'OnCommSheatheAny', 'SwordSheath
e');
theInput.RegisterListener(this, 'OnCommSheatheSilver', 'SwordShe
atheSilver');
theInput.RegisterListener(this, 'OnCommSheatheSteel', 'SwordShea
theSteel');
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,

'OnToggleSigns', 'ToggleSigns');
'OnSelectSign', 'SelectAard');
'OnSelectSign', 'SelectYrden');
'OnSelectSign', 'SelectIgni');
'OnSelectSign', 'SelectQuen');
'OnSelectSign', 'SelectAxii');
'OnCommDeckEditor', 'PanelGwintD

eckEditor');
theInput.RegisterListener(this, 'OnCommMenuHub', 'HubMenu');
theInput.RegisterListener(this, 'OnCommPanelInv', 'PanelInv');
theInput.RegisterListener(this, 'OnCommHoldFastMenu', 'HoldFastM
enu');
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,

'OnCommPanelChar', 'PanelChar');
'OnCommPanelMed', 'PanelMed');
'OnCommPanelMap', 'PanelMap');
'OnCommPanelMapPC', 'PanelMapPC'

);
theInput.RegisterListener(this, 'OnCommPanelJour', 'PanelJour');
theInput.RegisterListener(this, 'OnCommPanelAlch', 'PanelAlch');
theInput.RegisterListener(this, 'OnCommPanelGlossary', 'PanelGlo
ssary');
theInput.RegisterListener(this, 'OnCommPanelBestiary', 'PanelBes
tiary');
theInput.RegisterListener(this, 'OnCommPanelMeditation', 'PanelM
editation');
theInput.RegisterListener(this, 'OnCommPanelCrafting', 'PanelCra
fting');
theInput.RegisterListener(this, 'OnShowControlsHelp', 'ControlsH
elp');
theInput.RegisterListener(this, 'OnCommPanelUIResize', 'PanelUIR
esize');
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,

'OnCastSign', 'CastSign');
'OnExpFocus', 'Focus');
'OnExpMedallion', 'Medallion');
'OnBoatDismount', 'BoatDismount'

theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
theInput.RegisterListener(this,
Light', 'SpecialAttackWithAlternateLight');
theInput.RegisterListener(this,
Heavy', 'SpecialAttackWithAlternateHeavy');
theInput.RegisterListener(this,
'AttackWithAlternateLight');
theInput.RegisterListener(this,
'AttackWithAlternateHeavy');
theInput.RegisterListener(this,
');
theInput.RegisterListener(this,

'OnDiving', 'DiveDown');
'OnDiving', 'DiveUp');
'OnDivingDodge', 'DiveDodge');
'OnCbtSpecialAttackWithAlternate

);

'OnCbtSpecialAttackWithAlternate
'OnCbtAttackWithAlternateLight',
'OnCbtAttackWithAlternateHeavy',
'OnCbtAttackLight', 'AttackLight
'OnCbtAttackHeavy', 'AttackHeavy

');
theInput.RegisterListener(this, 'OnCbtSpecialAttackLight', 'Spec
ialAttackLight');
theInput.RegisterListener(this, 'OnCbtSpecialAttackHeavy', 'Spec
ialAttackHeavy');
theInput.RegisterListener(this, 'OnCbtDodge', 'Dodge');
theInput.RegisterListener(this, 'OnCbtRoll', 'CbtRoll');
theInput.RegisterListener(this, 'OnMovementDoubleTap', 'Movement
DoubleTapW');
theInput.RegisterListener(this, 'OnMovementDoubleTap', 'Movement
DoubleTapS');
theInput.RegisterListener(this, 'OnMovementDoubleTap', 'Movement
DoubleTapA');
theInput.RegisterListener(this, 'OnMovementDoubleTap', 'Movement
DoubleTapD');
theInput.RegisterListener(this, 'OnCbtLockAndGuard', 'LockAndGua
rd');
theInput.RegisterListener(this, 'OnCbtCameraLockOrSpawnHorse', '
CameraLockOrSpawnHorse');
theInput.RegisterListener(this, 'OnCbtCameraLock', 'CameraLock')
;
theInput.RegisterListener(this, 'OnCbtComboDigitLeft', 'ComboDig
itLeft');
theInput.RegisterListener(this, 'OnCbtComboDigitRight', 'ComboDi
gitRight');
theInput.RegisterListener(this, 'OnCbtCiriSpecialAttack', 'CiriS
pecialAttack');
theInput.RegisterListener(this, 'OnCbtCiriAttackHeavy', 'CiriAtt
ackHeavy');
theInput.RegisterListener(this, 'OnCbtCiriSpecialAttackHeavy', '
CiriSpecialAttackHeavy');
theInput.RegisterListener(this, 'OnCbtCiriDodge', 'CiriDodge');
theInput.RegisterListener(this, 'OnCbtCiriDash', 'CiriDash');
theInput.RegisterListener(this, 'OnCbtThrowItem', 'ThrowItem');
theInput.RegisterListener(this, 'OnCbtThrowItemHold', 'ThrowItem
Hold');
theInput.RegisterListener(this, 'OnCbtThrowCastAbort', 'ThrowCas
tAbort');
theInput.RegisterListener(this, 'OnCiriDrawWeapon', 'CiriDrawWea
pon');
theInput.RegisterListener(this, 'OnCiriHolsterWeapon', 'CiriHols
terWeapon');
if (!theGame.IsFinalBuild()){
theInput.RegisterListener(this, 'OnDbgSpeedUp', 'Debug_S
peedUp');
theInput.RegisterListener(this, 'OnDbgHit', 'Debug_Hit')
;
theInput.RegisterListener(this, 'OnDbgKillTarget', 'Debu
g_KillTarget');
theInput.RegisterListener(this, 'OnDbgKillAll', 'Debug_K
illAllEnemies');
theInput.RegisterListener(this, 'OnDbgKillAllTargetingPl
ayer', 'Debug_KillAllTargetingPlayer');
theInput.RegisterListener(this, 'OnDbgResurrectPlayer',
'Debug_Resurrect');
theInput.RegisterListener(this, 'OnCommPanelFakeHud', 'P
anelFakeHud');
}
theInput.RegisterListener(this, 'OnChangeCameraPreset', 'CameraP
reset');

theInput.RegisterListener(this, 'OnChangeCameraPresetByMouseWhee
l', 'CameraPresetByMouseWheel');
theInput.RegisterListener(this, 'OnMeditationAbort', 'Meditation
Abort');
theInput.RegisterListener(this, 'OnFastMenu', 'FastMenu');
theInput.RegisterListener(this, 'OnIngameMenu', 'IngameMenu');
/* NOP */;
}
public function Destroy(){
}
public function FindActionLockIndex(action : EInputActionBlock, sourceNa
me : CName) : Int32{
var i : Int32;
i = 0;
while (i < actionLocks[action].Size()){
if (actionLocks[action][i].sourceName == sourceName){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function BlockAction(action : EInputActionBlock, sourceName : CNa
me, lock : Bool, keepOnSpawn : Bool, onSpawnedNullPointerHackFix : CPlayer, isFr
omQuest : Bool, isFromPlace : Bool){
var index : Int32;
var isLocked : Bool;
var wasLocked : Bool;
var actionLock : SInputActionLock;
if (action == 7){
index = FindActionLockIndex(action, sourceName);
}
index = FindActionLockIndex(action, sourceName);
wasLocked = actionLocks[action].Size() > 0;
if (lock){
if (index != -1){
return;
}
actionLock.sourceName = sourceName;
actionLock.removedOnSpawn = !keepOnSpawn;
actionLock.isFromQuest = isFromQuest;
actionLock.isFromPlace = isFromPlace;
actionLocks[action].PushBack(actionLock);
} else {
if (index == -1){
return;
}
actionLocks[action].Erase(index);
}
isLocked = actionLocks[action].Size() > 0;
if (isLocked != wasLocked){
OnActionLockChanged(action, isLocked, sourceName, onSpaw
nedNullPointerHackFix);
}
/* NOP */;
}
public final function TutorialForceUnblockRadial() : array<SInputActionL
ock>{
var ret : array<SInputActionLock>;

ret = actionLocks[3];
actionLocks[3].Clear();
thePlayer.SetBIsInputAllowed(true, 'None');
BlockAction(0, 'ToxicGasTutorial', true, true, NULL, false, /* N
OP */);
return ret;
/* NOP */;
}
public final function TutorialForceRestoreRadialLocks(radialLocks : arra
y<SInputActionLock>){
actionLocks[3] = radialLocks;
thePlayer.UnblockAction(0, 'ToxicGasTutorial');
/* NOP */;
}
private function OnActionLockChanged(action : EInputActionBlock, locked
: Bool, sourceName : CName, onSpawnedNullPointerHackFix : CPlayer){
var player : CPlayer;
var lockType : EPlayerInteractionLock;
var hud : CR4ScriptedHud;
var guiManager : CR4GuiManager;
var rootMenu : CR4MenuBase;
if (sourceName == debugBlockSourceName){
sourceName = sourceName;
}
if (action == 5){
theGame.GetCommonMapManager().EnableFastTravelling(!lock
ed);
} else if (action == 21){
if (sourceName == 'InsideCombatAction'){
lockType = 4;
} else {
lockType = 2;
}
if (!thePlayer){
player = onSpawnedNullPointerHackFix;
} else {
player = thePlayer;
}
if (player){
if (locked){
player.LockButtonInteractions(lockType);
} else {
player.UnlockButtonInteractions(lockType
);
}
}
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.ForceInteractionUpdate();
}
} else if (action == 6 && locked && thePlayer){
if (thePlayer.IsUsingVehicle() && thePlayer.GetCurrentSt
ateName() == 'HorseRiding'){
(CActor)thePlayer.GetUsedVehicle().GetMovingAgen
tComponent().ResetMoveRequests();
thePlayer.GetUsedVehicle().SetBehaviorVariable('
2idle', 1, /* NOP */);
thePlayer.SetBehaviorVariable('speed', 0, /* NOP
*/);
thePlayer.SetBehaviorVariable('2idle', 1, /* NOP

*/);
} else if (!thePlayer.IsInAir()){
thePlayer.RaiseForceEvent('Idle');
}
} else if (action == 22){
guiManager = theGame.GetGuiManager();
if (guiManager){
guiManager.UpdateDismountAvailable(locked);
}
} else if (action == 9 || action == 15 || action == 2 || action
== 17 || action == 16 || action == 36 || action == 18 || action == 41 || action
== 46){
guiManager = theGame.GetGuiManager();
if (guiManager && guiManager.IsAnyMenu()){
rootMenu = (CR4MenuBase)guiManager.GetRootMenu()
;
if (rootMenu){
rootMenu.ActionBlockStateChange(action,
locked);
}
}
}
/* NOP */;
}
public function BlockAllActions(sourceName : CName, lock : Bool, excepti
ons : array<EInputActionBlock>, saveLock : Bool, onSpawnedNullPointerHackFix : C
Player, isFromQuest : Bool, isFromPlace : Bool){
var i : Int32;
var size : Int32;
size = EnumGetMax('EInputActionBlock') + 1;
i = 0;
while (i < size){
if (exceptions.Contains(i)){
} else {
BlockAction(i, sourceName, lock, saveLock, onSpa
wnedNullPointerHackFix, isFromQuest, isFromPlace);
}
i += 1;
}
/* NOP */;
}
public final function BlockAllQuestActions(sourceName : CName, lock : Bo
ol){
var action : Int32;
var j : Int32;
var size : Int32;
var isLocked : Bool;
var wasLocked : Bool;
if (lock){
BlockAllActions(sourceName, lock, /* NOP */, true, /* NO
P */, true, /* NOP */);
} else {
size = EnumGetMax('EInputActionBlock') + 1;
action = 0;
while (action < size){
wasLocked = actionLocks[action].Size() > 0;
j = 0;
while (j < actionLocks[action].Size()){
if (actionLocks[action][j].isFromQuest){
actionLocks[action].Erase(j);

}
j += 1;
}
isLocked = actionLocks[action].Size() > 0;
if (wasLocked != isLocked){
OnActionLockChanged(action, isLocked, /*
NOP */, /* NOP */);
}
action += 1;
}
}
/* NOP */;
}
public function BlockAllUIQuestActions(sourceName : CName, lock : Bool){
var i : Int32;
var j : Int32;
var action : Int32;
var size : Int32;
var uiActions : array<Int32>;
var wasLocked : Bool;
var isLocked : Bool;
if (lock){
BlockAction(2, sourceName, true, true, NULL, false, /* N
OP */);
BlockAction(41, sourceName, true, true, NULL, false, /*
NOP */);
BlockAction(46, sourceName, true, true, NULL, false, /*
NOP */);
BlockAction(5, sourceName, true, true, NULL, false, /* N
OP */);
BlockAction(15, sourceName, true, true, NULL, false, /*
NOP */);
BlockAction(16, sourceName, true, true, NULL, false, /*
NOP */);
BlockAction(17, sourceName, true, true, NULL, false, /*
NOP */);
BlockAction(18, sourceName, true, true, NULL, false, /*
NOP */);
} else {
uiActions.Resize(8);
uiActions[0] = 2;
uiActions[1] = 41;
uiActions[2] = 46;
uiActions[3] = 5;
uiActions[4] = 15;
uiActions[5] = 16;
uiActions[6] = 17;
uiActions[7] = 18;
size = uiActions.Size();
i = 0;
while (i < size){
action = uiActions[i];
wasLocked = actionLocks[action].Size() > 0;
j = 0;
while (j < actionLocks[action].Size()){
if (actionLocks[action][j].isFromQuest){
actionLocks[action].Erase(j);
}
j += 1;
}

isLocked = actionLocks[action].Size() > 0;


if (wasLocked != isLocked){
OnActionLockChanged(action, isLocked, /*
NOP */, /* NOP */);
}
i += 1;
}
}
/* NOP */;
}
public function ForceUnlockAllInputActions(alsoQuestLocks : Bool){
var i : Int32;
var j : Int32;
i = 0;
while (i <= EnumGetMax('EInputActionBlock')){
if (alsoQuestLocks){
actionLocks[i].Clear();
OnActionLockChanged(i, false, /* NOP */, /* NOP
*/);
} else {
j = actionLocks[i].Size() - 1;
while (j >= 0){
if (actionLocks[i][j].removedOnSpawn){
actionLocks[i].Erase(j);
}
j -= 1;
}
if (actionLocks[i].Size() == 0){
OnActionLockChanged(i, false, /* NOP */,
/* NOP */);
}
}
i += 1;
}
/* NOP */;
}
public function RemoveLocksOnSpawn(){
var i : Int32;
var j : Int32;
i = 0;
while (i < actionLocks.Size()){
j = actionLocks[i].Size() - 1;
while (j >= 0){
if (actionLocks[i][j].removedOnSpawn){
actionLocks[i].Erase(j);
}
j -= 1;
}
i += 1;
}
/* NOP */;
}
public function GetActionLocks(action : EInputActionBlock) : array<SInpu
tActionLock>{
return actionLocks[action];
/* NOP */;
}
public function GetAllActionLocks() : array<array<SInputActionLock>>{
return actionLocks;
/* NOP */;

}
public function IsActionAllowed(action : EInputActionBlock) : Bool{
var actionAllowed : Bool;
actionAllowed = actionLocks[action].Size() == 0;
return actionAllowed;
/* NOP */;
}
public function IsActionBlockedBy(action : EInputActionBlock, sourceName
: CName) : Bool{
return FindActionLockIndex(action, sourceName) != -1;
/* NOP */;
}
public final function GetActionBlockedHudLockType(action : EInputActionB
lock) : CName{
var i : Int32;
if (action == 28){
return 'None';
}
i = 0;
while (i < actionLocks[action].Size()){
if (actionLocks[action][i].isFromPlace){
return 'place';
}
i += 1;
}
if (actionLocks[action].Size() > 0){
return 'time';
}
return 'None';
/* NOP */;
}
public function OnCommSprint(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
thePlayer.SetSprintActionPressed(true, /* NOP */);
if (thePlayer.rangedWeapon){
thePlayer.rangedWeapon.OnSprintHolster();
}
}
/* NOP */;
}
public function OnCommSprintToggle(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (thePlayer.GetIsSprintToggled()){
thePlayer.SetSprintToggle(false);
} else {
thePlayer.SetSprintToggle(true);
}
}
/* NOP */;
}
public function OnCommWalkToggle(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */) && !thePlayer.GetIsSprinting()
&& !thePlayer.modifyPlayerSpeed){
if (thePlayer.GetIsWalkToggled()){
thePlayer.SetWalkToggle(false);
} else {
thePlayer.SetWalkToggle(true);
}
}
/* NOP */;

}
public function OnCommGuard(action : SInputAction) : Bool{
if (thePlayer.IsCiri() && !GetCiriPlayer().HasSword()){
return false;
}
if (!thePlayer.IsInsideInteraction()){
if (IsActionAllowed(25)){
if (IsReleased(action, /* NOP */) && thePlayer.G
etCurrentStateName() == 'CombatFists'){
thePlayer.OnGuardedReleased();
}
if (IsPressed(action, /* NOP */)){
thePlayer.AddCounterTimeStamp(theGame.Ge
tEngineTime());
thePlayer.SetGuarded(true);
thePlayer.OnPerformGuard();
} else if (IsReleased(action, /* NOP */)){
thePlayer.SetGuarded(false);
}
} else {
thePlayer.DisplayActionDisallowedHudMessage(25,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnCommSpawnHorse(action : SInputAction) : Bool{
var doubleTap : Bool;
if (IsPressed(action, /* NOP */)){
if (pressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEng
ineTimeAsSeconds()){
doubleTap = true;
} else {
doubleTap = false;
}
if (IsActionAllowed(4) && !thePlayer.IsInInterior() && !
thePlayer.IsInAir()){
if (doubleTap || theInput.LastUsedPCInput()){
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.OnUseSelectedItem(true
);
thePlayer.SetPlayerActionToResto
re(4);
} else {
theGame.OnSpawnPlayerHorse();
}
}
} else if (thePlayer.IsInInterior()){
thePlayer.DisplayActionDisallowedHudMessage(28,
false, true, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(4, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
pressTimestamp = theGame.GetEngineTimeAsSeconds();
return true;
}
return false;
/* NOP */;
}

public function OnCommMenuHub(action : SInputAction) : Bool{


if (IsReleased(action, /* NOP */)){
super.PushMenuHub();
}
/* NOP */;
}
public final function PushMenuHub(){
if (theGame.IsBlackscreenOrFading()){
return;
}
theGame.RequestMenu('CommonMenu', /* NOP */);
/* NOP */;
}
public function OnCommPanelChar(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushCharacterScreen();
}
/* NOP */;
}
public final function PushCharacterScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
theGame.RequestMenuWithBackground('CharacterMenu', 'CommonMenu',
/* NOP */);
/* NOP */;
}
public function OnCommPanelInv(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushInventoryScreen();
}
/* NOP */;
}
public final function PushInventoryScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(2)){
theGame.RequestMenuWithBackground('InventoryMenu', 'Comm
onMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(2, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommDeckEditor(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (theGame.IsBlackscreenOrFading()){
return false;
}
if (theGame.GetGwintManager().GetHasDoneTutorial() || th
eGame.GetGwintManager().HasLootedCard()){
if (IsActionAllowed(40)){
theGame.RequestMenu('DeckBuilder', /* NO
P */);
} else {
thePlayer.DisplayActionDisallowedHudMess
age(40, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}

}
}
/* NOP */;
}
public function OnCommPanelMed(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (IsActionAllowed(41)){
GetWitcherPlayer().Meditate();
} else {
thePlayer.DisplayActionDisallowedHudMessage(41,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnCommPanelMapPC(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushMapScreen();
}
/* NOP */;
}
public function OnCommPanelMap(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
super.PushMapScreen();
}
/* NOP */;
}
public final function PushMapScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(15)){
theGame.RequestMenuWithBackground('MapMenu', 'CommonMenu
', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(15, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommPanelJour(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushJournalScreen();
}
/* NOP */;
}
public final function PushJournalScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(17)){
theGame.RequestMenuWithBackground('JournalQuestMenu', 'C
ommonMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(17, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommPanelMeditation(action : SInputAction) : Bool{

if (IsReleased(action, /* NOP */)){


super.PushMeditationScreen();
}
/* NOP */;
}
public final function PushMeditationScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(46)){
theGame.RequestMenuWithBackground('MeditationClockMenu',
'CommonMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(46, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommPanelCrafting(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushCraftingScreen();
}
/* NOP */;
}
public final function PushCraftingScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
theGame.RequestMenuWithBackground('CraftingMenu', 'CommonMenu',
/* NOP */);
/* NOP */;
}
public function OnCommPanelBestiary(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushBestiaryScreen();
}
/* NOP */;
}
public final function PushBestiaryScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(36)){
theGame.RequestMenuWithBackground('GlossaryBestiaryMenu'
, 'CommonMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(36, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommPanelAlch(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushAlchemyScreen();
}
/* NOP */;
}
public final function PushAlchemyScreen(){
if (theGame.IsBlackscreenOrFading()){
return;

}
if (IsActionAllowed(18)){
theGame.RequestMenuWithBackground('AlchemyMenu', 'Common
Menu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(18, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCommPanelGlossary(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
super.PushGlossaryScreen();
}
/* NOP */;
}
public final function PushGlossaryScreen(){
if (theGame.IsBlackscreenOrFading()){
return;
}
if (IsActionAllowed(36)){
theGame.RequestMenuWithBackground('GlossaryEncyclopediaM
enu', 'CommonMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(36, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnShowControlsHelp(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (theGame.IsBlackscreenOrFading()){
return false;
}
}
/* NOP */;
}
public function OnCommPanelUIResize(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (theGame.IsBlackscreenOrFading()){
return false;
}
theGame.RequestMenu('RescaleMenu', /* NOP */);
}
/* NOP */;
}
public function OnCommPanelFakeHud(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (theGame.IsBlackscreenOrFading()){
return false;
}
}
/* NOP */;
}
public function OnCommSteelSword(action : SInputAction) : Bool{
var duringCastSign : Bool;
if (IsPressed(action, /* NOP */)){
processedSwordHold = false;
}
if (theInput.LastUsedGamepad() && theInput.IsActionPressed('Alte

rnate')){
return false;
}
if (IsReleased(action, /* NOP */) || IsPressed(action, /* NOP */
) && thePlayer.GetCurrentMeleeWeaponType() == 0 || thePlayer.GetCurrentMeleeWeap
onType() == 3){
if (!processedSwordHold){
if (IsActionAllowed(1) && thePlayer.GetBIsInputA
llowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady()){
thePlayer.PushCombatActionOnBuffer(14, 1
, /* NOP */);
if (thePlayer.GetBIsCombatActionAllowed(
)){
thePlayer.ProcessCombatActionBuf
fer();
}
}
processedSwordHold = true;
}
}
/* NOP */;
}
public function OnCommSilverSword(action : SInputAction) : Bool{
var duringCastSign : Bool;
if (IsPressed(action, /* NOP */)){
processedSwordHold = false;
}
if (theInput.LastUsedGamepad() && theInput.IsActionPressed('Alte
rnate')){
return false;
}
if (IsReleased(action, /* NOP */) || IsPressed(action, /* NOP */
) && thePlayer.GetCurrentMeleeWeaponType() == 0 || thePlayer.GetCurrentMeleeWeap
onType() == 3){
if (!processedSwordHold){
if (IsActionAllowed(1) && thePlayer.GetBIsInputA
llowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady()){
thePlayer.PushCombatActionOnBuffer(15, 1
, /* NOP */);
if (thePlayer.GetBIsCombatActionAllowed(
) || duringCastSign){
thePlayer.ProcessCombatActionBuf
fer();
}
}
processedSwordHold = true;
}
}
/* NOP */;
}
public function OnCommSheatheAny(action : SInputAction) : Bool{
var duringCastSign : Bool;
if (IsPressed(action, /* NOP */)){
if (thePlayer.GetBIsInputAllowed() && thePlayer.GetWeapo
nHolster().IsMeleeWeaponReady()){
thePlayer.PushCombatActionOnBuffer(16, 1, /* NOP
*/);
if (thePlayer.GetBIsCombatActionAllowed() || dur
ingCastSign){
thePlayer.ProcessCombatActionBuffer();

}
}
processedSwordHold = true;
}
/* NOP */;
}
public function OnCommSheatheSteel(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */) && thePlayer.IsWeaponHeld('stee
lsword') && !processedSwordHold){
OnCommSheatheAny(action);
}
/* NOP */;
}
public function OnCommSheatheSilver(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */) && thePlayer.IsWeaponHeld('silv
ersword') && !processedSwordHold){
OnCommSheatheAny(action);
}
/* NOP */;
}
public function OnCommDrinkPot(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (!potPress){
potPress = true;
potAction = action;
thePlayer.AddTimer('PotDrinkTimer', 0.300000, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
PotDrinkTimer(true);
thePlayer.RemoveTimer('PotDrinkTimer', /* NOP */
);
}
}
/* NOP */;
}
public function PotDrinkTimer(isDoubleTapped : Bool){
thePlayer.RemoveTimer('PotDrinkTimer', /* NOP */);
potPress = false;
if (isDoubleTapped){
OnCommDrinkPotion2(potAction);
} else {
OnCommDrinkPotion1(potAction);
}
/* NOP */;
}
public function OnCbtComboDigitLeft(action : SInputAction) : Bool{
if (theInput.IsActionPressed('Alternate')){
OnTogglePreviousSign(action);
}
/* NOP */;
}
public function OnCbtComboDigitRight(action : SInputAction) : Bool{
if (theInput.IsActionPressed('Alternate')){
OnToggleNextSign(action);
}
/* NOP */;
}
public function OnSelectSign(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
switch(action.aName){

case 'SelectAard':
GetWitcherPlayer().SetEquippedSign(0);
break;
case 'SelectYrden':
GetWitcherPlayer().SetEquippedSign(1);
break;
case 'SelectIgni':
GetWitcherPlayer().SetEquippedSign(2);
break;
case 'SelectQuen':
GetWitcherPlayer().SetEquippedSign(3);
break;
case 'SelectAxii':
GetWitcherPlayer().SetEquippedSign(4);
break;
default:
break;
}
}
/* NOP */;
}
public function OnToggleSigns(action : SInputAction) : Bool{
var tolerance : Float;
tolerance = 2.500000;
if (action.value < -tolerance){
GetWitcherPlayer().TogglePreviousSign();
} else if (action.value > tolerance){
GetWitcherPlayer().ToggleNextSign();
}
/* NOP */;
}
public function OnToggleNextSign(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
GetWitcherPlayer().ToggleNextSign();
}
/* NOP */;
}
public function OnTogglePreviousSign(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
GetWitcherPlayer().TogglePreviousSign();
}
/* NOP */;
}
public function OnToggleItem(action : SInputAction) : Bool{
if (!IsActionAllowed(32)){
thePlayer.DisplayActionDisallowedHudMessage(32, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsReleased(action, /* NOP */)){
if (theInput.GetLastActivationTime(action.aName) < 0.300
000){
GetWitcherPlayer().ToggleNextItem();
}
}
/* NOP */;
}
public function OnCommDrinkPotion1(action : SInputAction) : Bool{
var witcher : W3PlayerWitcher;
var item : SItemUniqueId;

if (thePlayer.IsCiri()){
return false;
}
if (!IsActionAllowed(32)){
thePlayer.DisplayActionDisallowedHudMessage(32, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsPressed(action, /* NOP */)){
witcher = GetWitcherPlayer();
witcher.GetItemEquippedOnSlot(14, item);
if (witcher.inv.ItemHasTag(item, 'Edibles')){
witcher.ConsumeItem(item);
} else if (witcher.ToxicityLowEnoughToDrinkPotion(14, /*
NOP */)){
witcher.DrinkPreparedPotion(14, /* NOP */);
} else {
SendToxicityTooHighMessage();
}
ShowItemInfo();
}
/* NOP */;
}
public function OnCommDrinkPotion2(action : SInputAction) : Bool{
var witcher : W3PlayerWitcher;
var item : SItemUniqueId;
if (thePlayer.IsCiri()){
return false;
}
if (!IsActionAllowed(32)){
thePlayer.DisplayActionDisallowedHudMessage(32, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsPressed(action, /* NOP */)){
witcher = GetWitcherPlayer();
witcher.GetItemEquippedOnSlot(15, item);
if (witcher.inv.ItemHasTag(item, 'Edibles')){
witcher.ConsumeItem(item);
} else if (witcher.ToxicityLowEnoughToDrinkPotion(15, /*
NOP */)){
witcher.DrinkPreparedPotion(15, /* NOP */);
} else {
SendToxicityTooHighMessage();
}
ShowItemInfo();
}
/* NOP */;
}
private function SendToxicityTooHighMessage(){
var messageText : String;
var language : String;
var audioLanguage : String;
if (thePlayer.GetHudMessagesSize() < 2){
messageText = GetLocStringByKeyExt("menu_cannot_perform_
action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_curre
nt_toxicity");
theGame.GetGameLanguageName(audioLanguage, language);
if (language == "AR"){
messageText += thePlayer.abilityManager.GetStat(

3, false) + " / " + thePlayer.abilityManager.GetStatMax(3) + " :";


} else {
messageText += ": " + thePlayer.abilityManager.G
etStat(3, false) + " / " + thePlayer.abilityManager.GetStatMax(3);
}
thePlayer.DisplayHudMessage(messageText);
}
theSound.SoundEvent("gui_global_denied");
/* NOP */;
}
public function ShowItemInfo(){
var hud : CR4ScriptedHud;
var module : CR4HudModuleItemInfo;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInf
oModule");
if (module){
module.ForceShowElement();
}
}
/* NOP */;
}
public function OnDiving(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */) && IsActionAllowed(20)){
if (action.aName == 'DiveDown'){
if (thePlayer.OnAllowedDiveDown()){
if (!thePlayer.OnCheckDiving()){
thePlayer.OnDive();
}
if (thePlayer.bLAxisReleased){
thePlayer.SetBehaviorVariable('d
ivePitch', -1.000000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('d
ivePitch', -0.900000, /* NOP */);
}
thePlayer.OnDiveInput(-1.000000);
if (thePlayer.rangedWeapon.GetCurrentSta
teName() != 'State_WeaponWait'){
thePlayer.OnRangedForceHolster(t
rue, false, /* NOP */);
thePlayer.OnFullyBlendedIdle();
}
}
} else if (action.aName == 'DiveUp'){
if (thePlayer.bLAxisReleased){
thePlayer.SetBehaviorVariable('divePitch
', 1.000000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('divePitch
', 0.900000, /* NOP */);
}
if (thePlayer.rangedWeapon.GetCurrentStateName()
!= 'State_WeaponWait'){
thePlayer.OnRangedForceHolster(true, fal
se, /* NOP */);
thePlayer.OnFullyBlendedIdle();
}
thePlayer.OnDiveInput(1.000000);

}
} else if (IsReleased(action, /* NOP */)){
thePlayer.SetBehaviorVariable('divePitch', 0.000000, /*
NOP */);
thePlayer.OnDiveInput(0.000000);
} else if (IsPressed(action, /* NOP */) && !IsActionAllowed(20))
{
thePlayer.DisplayActionDisallowedHudMessage(20, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnDivingDodge(action : SInputAction) : Bool{
var isDodgeAllowed : Bool;
if (IsPressed(action, /* NOP */)){
isDodgeAllowed = IsActionAllowed(23);
if (isDodgeAllowed && IsActionAllowed(20)){
if (thePlayer.OnCheckDiving() && thePlayer.GetBI
sInputAllowed()){
thePlayer.PushCombatActionOnBuffer(6, 1,
/* NOP */);
if (thePlayer.GetBIsCombatActionAllowed(
)){
thePlayer.ProcessCombatActionBuf
fer();
}
}
} else if (!isDodgeAllowed){
thePlayer.DisplayActionDisallowedHudMessage(23,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(20,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnExpFistFightLight(action : SInputAction) : Bool{
var fistsAllowed : Bool;
if (IsPressed(action, /* NOP */)){
fistsAllowed = IsActionAllowed(8);
if (fistsAllowed && IsActionAllowed(30)){
thePlayer.SetupCombatAction(1, 1);
} else if (!fistsAllowed){
thePlayer.DisplayActionDisallowedHudMessage(8, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(30,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnExpFistFightHeavy(action : SInputAction) : Bool{
var fistsAllowed : Bool;
if (IsPressed(action, /* NOP */)){
fistsAllowed = IsActionAllowed(8);
if (fistsAllowed && IsActionAllowed(31)){
thePlayer.SetupCombatAction(2, 1);
} else if (!fistsAllowed){

thePlayer.DisplayActionDisallowedHudMessage(8, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(31,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnExpFocus(action : SInputAction) : Bool{
if (IsActionAllowed(19)){
if (IsPressed(action, /* NOP */)){
if (thePlayer.GoToCombatIfNeeded(/* NOP */)){
OnCommGuard(action);
return false;
}
theGame.GetFocusModeController().Activate();
} else if (IsReleased(action, /* NOP */)){
theGame.GetFocusModeController().Deactivate();
}
} else {
thePlayer.DisplayActionDisallowedHudMessage(19, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
theGame.GetFocusModeController().Deactivate();
}
/* NOP */;
}
private function ShouldSwitchAttackType() : Bool{
var outKeys : array<EInputKey>;
if (theInput.LastUsedPCInput()){
theInput.GetPCKeysForAction('PCAlternate', outKeys);
if (outKeys.Size() > 0){
if (theInput.IsActionPressed('PCAlternate')){
return true;
}
}
}
return false;
/* NOP */;
}
public function OnCbtAttackWithAlternateLight(action : SInputAction) : B
ool{
CbtAttackPC(action, false);
/* NOP */;
}
public function OnCbtAttackWithAlternateHeavy(action : SInputAction) : B
ool{
CbtAttackPC(action, true);
/* NOP */;
}
public function CbtAttackPC(action : SInputAction, isHeavy : Bool){
var switchAttackType : Bool;
switchAttackType = ShouldSwitchAttackType();
if (!theInput.LastUsedPCInput()){
return;
}
if (thePlayer.IsCiri()){
if (switchAttackType != isHeavy){
OnCbtCiriAttackHeavy(action);
} else {

OnCbtAttackLight(action);
}
} else if (switchAttackType != isHeavy){
OnCbtAttackHeavy(action);
} else {
OnCbtAttackLight(action);
}
/* NOP */;
}
public function OnCbtAttackLight(action : SInputAction) : Bool{
var allowed : Bool;
var checkedFists : Bool;
if (IsPressed(action, /* NOP */)){
if (IsActionAllowed(30)){
if (thePlayer.GetBIsInputAllowed()){
allowed = false;
if (thePlayer.GetCurrentMeleeWeaponType(
) == 3 || thePlayer.GetCurrentMeleeWeaponType() == 0){
checkedFists = true;
if (IsActionAllowed(8)){
allowed = true;
}
} else if (IsActionAllowed(24)){
checkedFists = false;
allowed = true;
}
if (allowed){
thePlayer.SetupCombatAction(1, 1
);
} else if (checkedFists){
thePlayer.DisplayActionDisallowe
dHudMessage(8, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowe
dHudMessage(24, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
} else if (!IsActionBlockedBy(30, 'interaction')){
thePlayer.DisplayActionDisallowedHudMessage(30,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnCbtAttackHeavy(action : SInputAction) : Bool{
var allowed : Bool;
var checkedSword : Bool;
var outKeys : array<EInputKey>;
if (thePlayer.GetBIsInputAllowed()){
if (IsActionAllowed(31)){
allowed = false;
if (thePlayer.GetCurrentMeleeWeaponType() == 3 |
| thePlayer.GetCurrentMeleeWeaponType() == 0){
checkedSword = false;
if (IsActionAllowed(8)){
allowed = true;
}
} else if (IsActionAllowed(24)){
checkedSword = true;
allowed = true;

}
if (allowed){
if (thePlayer.GetCurrentMeleeWeaponType(
) == 3 || thePlayer.GetCurrentMeleeWeaponType() == 0 && IsPressed(action, /* NOP
*/)){
thePlayer.SetupCombatAction(2, 0
);
} else if (IsReleased(action, /* NOP */)
&& theInput.GetLastActivationTime(action.aName) < 0.200000){
thePlayer.SetupCombatAction(2, 0
);
}
} else if (checkedSword){
thePlayer.DisplayActionDisallowedHudMess
age(24, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMess
age(8, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else if (!IsActionBlockedBy(31, 'interaction')){
thePlayer.DisplayActionDisallowedHudMessage(31,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
private function CheckFinisherInput() : Bool{
var enemyInCone : CActor;
var npc : CNewNPC;
var interactionTarget : CInteractionComponent;
var isDeadlySwordHeld : Bool;
interactionTarget = theGame.GetInteractionsManager().GetActiveIn
teraction();
if (interactionTarget && interactionTarget.GetName() == "Finish"
){
npc = (CNewNPC)interactionTarget.GetEntity();
isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
if (theInput.GetActionValue('AttackHeavy') == 1.000000 |
| theInput.GetActionValue('AttackLight') == 1.000000 && isDeadlySwordHeld){
theGame.RemoveTimeScale(theGame.GetTimescaleSour
ce(12));
npc.SignalGameplayEvent('Finisher');
} else if (!isDeadlySwordHeld){
if (thePlayer.IsWeaponHeld('fist')){
thePlayer.SetBehaviorVariable('combatTau
ntType', 1.000000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('combatTau
ntType', 0.000000, /* NOP */);
}
thePlayer.RaiseEvent('CombatTaunt');
}
return true;
}
return false;
/* NOP */;
}
private function IsPlayerAbleToPerformSpecialAttack() : Bool{
if (thePlayer.GetCurrentStateName() == 'Exploration' && !thePlay
er.IsWeaponHeld('silversword') || thePlayer.IsWeaponHeld('steelsword')){

return false;
}
return true;
/* NOP */;
}
public function OnCbtSpecialAttackWithAlternateLight(action : SInputActi
on) : Bool{
CbSpecialAttackPC(action, false);
/* NOP */;
}
public function OnCbtSpecialAttackWithAlternateHeavy(action : SInputActi
on) : Bool{
CbSpecialAttackPC(action, true);
/* NOP */;
}
public function CbSpecialAttackPC(action : SInputAction, isHeavy : Bool)
{
var switchAttackType : Bool;
switchAttackType = ShouldSwitchAttackType();
if (!theInput.LastUsedPCInput()){
return;
}
if (IsPressed(action, /* NOP */)){
if (thePlayer.IsCiri()){
OnCbtCiriSpecialAttackHeavy(action);
} else if (switchAttackType != isHeavy){
OnCbtSpecialAttackHeavy(action);
} else {
OnCbtSpecialAttackLight(action);
}
} else if (IsReleased(action, /* NOP */)){
if (thePlayer.IsCiri()){
OnCbtCiriSpecialAttackHeavy(action);
} else {
OnCbtSpecialAttackHeavy(action);
OnCbtSpecialAttackLight(action);
}
}
/* NOP */;
}
public function OnCbtSpecialAttackLight(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
CancelHoldAttacks();
return true;
}
if (!IsPlayerAbleToPerformSpecialAttack()){
return false;
}
if (!IsActionAllowed(30)){
thePlayer.DisplayActionDisallowedHudMessage(30, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (!IsActionAllowed(44)){
thePlayer.DisplayActionDisallowedHudMessage(44, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsPressed(action, /* NOP */) && thePlayer.CanUseSkill(16)){
thePlayer.PrepareToAttack(/* NOP */, /* NOP */);

thePlayer.SetPlayedSpecialAttackMissingResourceSound(fal
se);
thePlayer.AddTimer('IsSpecialLightAttackInputHeld', 0.00
0010, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCbtSpecialAttackHeavy(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
CancelHoldAttacks();
return true;
}
if (!IsPlayerAbleToPerformSpecialAttack()){
return false;
}
if (!IsActionAllowed(31)){
thePlayer.DisplayActionDisallowedHudMessage(31, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (!IsActionAllowed(45)){
thePlayer.DisplayActionDisallowedHudMessage(45, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsPressed(action, /* NOP */) && thePlayer.CanUseSkill(17)){
thePlayer.PrepareToAttack(/* NOP */, /* NOP */);
thePlayer.SetPlayedSpecialAttackMissingResourceSound(fal
se);
thePlayer.AddTimer('IsSpecialHeavyAttackInputHeld', 0.00
0010, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else if (IsPressed(action, /* NOP */)){
if (theInput.IsActionPressed('AttackHeavy')){
theInput.ForceDeactivateAction('AttackHeavy');
} else if (theInput.IsActionPressed('AttackWithAlternate
Heavy')){
theInput.ForceDeactivateAction('AttackWithAltern
ateHeavy');
}
}
/* NOP */;
}
public function CancelHoldAttacks(){
thePlayer.RemoveTimer('IsSpecialLightAttackInputHeld', /* NOP */
);
thePlayer.RemoveTimer('IsSpecialHeavyAttackInputHeld', /* NOP */
);
thePlayer.RemoveTimer('SpecialAttackLightSustainCost', /* NOP */
);
thePlayer.RemoveTimer('SpecialAttackHeavySustainCost', /* NOP */
);
thePlayer.RemoveTimer('UpdateSpecialAttackLightHeading', /* NOP
*/);
thePlayer.UnblockAction(33, 'SpecialAttack');
if (thePlayer.GetBehaviorVariable('combatActionType', /* NOP */)
== 1){
if (thePlayer.GetBehaviorVariable('playerAttackType', /*
NOP */) == 0 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 1.000000){
thePlayer.SetAttackActionName(SkillEnumToName(16

));
thePlayer.PushCombatActionOnBuffer(7, 0, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
(W3PlayerWitcherStateCombatFists)GetState('Comba
t').ResetTimeToEndCombat();
} else if (thePlayer.GetBehaviorVariable('playerAttackTy
pe', /* NOP */) == 1 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack
', /* NOP */) == 1.000000){
thePlayer.SetAttackActionName(SkillEnumToName(17
));
thePlayer.PushCombatActionOnBuffer(8, 0, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
}
}
/* NOP */;
}
public function OnCbtCiriSpecialAttack(action : SInputAction) : Bool{
if (!GetCiriPlayer().HasSword()){
return false;
}
if (thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActi
onAllowed() && IsPressed(action, /* NOP */)){
if (thePlayer.HasAbility('CiriBlink') && (W3ReplacerCiri
)thePlayer.HasStaminaForSpecialAction(true)){
thePlayer.PrepareToAttack(/* NOP */, /* NOP */);
}
thePlayer.PushCombatActionOnBuffer(10, 1, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
} else if (IsReleased(action, /* NOP */) && thePlayer.GetCombatA
ction() == 10 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) != 0){
thePlayer.PushCombatActionOnBuffer(10, 0, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
}
/* NOP */;
}
public function OnCbtCiriAttackHeavy(action : SInputAction) : Bool{
var specialAttackAction : SInputAction;
if (!GetCiriPlayer().HasSword()){
return false;
}
specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy
');
if (thePlayer.GetBIsInputAllowed() && IsReleased(action, /* NOP
*/) && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack', /* NOP */) ==
0){
if (IsActionAllowed(31) && IsActionAllowed(24)){
if (thePlayer.GetCurrentMeleeWeaponType() == 1){
thePlayer.PrepareToAttack(/* NOP */, /*
NOP */);
thePlayer.SetupCombatAction(2, 0);
if (thePlayer.GetBIsCombatActionAllowed(
)){
thePlayer.ProcessCombatActionBuf
fer();
}
}
} else if (!IsActionBlockedBy(31, 'interaction')){

thePlayer.DisplayActionDisallowedHudMessage(30,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnCbtCiriSpecialAttackHeavy(action : SInputAction) : Boo
l{
if (!GetCiriPlayer().HasSword()){
return false;
}
if (thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActi
onAllowed() && IsPressed(action, /* NOP */)){
theInput.ForceDeactivateAction('AttackWithAlternateHeavy
');
thePlayer.PushCombatActionOnBuffer(11, 1, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
} else if (IsReleased(action, /* NOP */) && thePlayer.GetCombatA
ction() == 11 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) != 0){
theInput.ForceDeactivateAction('CiriAttackHeavy');
theInput.ForceDeactivateAction('AttackWithAlternateHeavy
');
thePlayer.PushCombatActionOnBuffer(11, 0, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
}
/* NOP */;
}
public function OnCbtCiriDodge(action : SInputAction) : Bool{
if (IsActionAllowed(23) && IsPressed(action, /* NOP */) && thePl
ayer.IsAlive()){
if (thePlayer.IsInCombatAction() && thePlayer.GetCombatA
ction() == 10 && thePlayer.GetBehaviorVariable('isCompletingSpecialAttack', /* N
OP */) <= 0){
thePlayer.PushCombatActionOnBuffer(13, 1, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
} else if (thePlayer.GetBIsInputAllowed()){
thePlayer.PushCombatActionOnBuffer(13, 1, /* NOP
*/);
if (thePlayer.GetBIsCombatActionAllowed()){
thePlayer.ProcessCombatActionBuffer();
}
} else if (thePlayer.IsInCombatAction() && thePlayer.Get
BehaviorVariable('combatActionType', /* NOP */) == 0){
if (thePlayer.CanPlayHitAnim() && thePlayer.IsTh
reatened()){
thePlayer.CriticalEffectAnimationInterru
pted("CiriDodge");
thePlayer.PushCombatActionOnBuffer(13, 1
, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
} else {
thePlayer.PushCombatActionOnBuffer(13, 1
, /* NOP */);
}
}
} else if (!IsActionAllowed(23)){
thePlayer.DisplayActionDisallowedHudMessage(23, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);

}
/* NOP */;
}
public function OnCbtCiriDash(action : SInputAction) : Bool{
if (theInput.LastUsedGamepad() && IsPressed(action, /* NOP */)){
thePlayer.StartDodgeTimer();
} else if (IsActionAllowed(23) && thePlayer.IsAlive()){
if (theInput.LastUsedGamepad()){
if (!thePlayer.IsDodgeTimerRunning() && !thePlay
er.IsInsideInteraction() && IsReleased(action, /* NOP */)){
return false;
}
}
if (thePlayer.IsInCombatAction() && thePlayer.GetCombatA
ction() == 10 && thePlayer.GetBehaviorVariable('isCompletingSpecialAttack', /* N
OP */) <= 0){
thePlayer.PushCombatActionOnBuffer(9, 0, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
} else if (thePlayer.GetBIsInputAllowed()){
thePlayer.PushCombatActionOnBuffer(9, 0, /* NOP
*/);
if (thePlayer.GetBIsCombatActionAllowed()){
thePlayer.ProcessCombatActionBuffer();
}
} else if (thePlayer.IsInCombatAction() && thePlayer.Get
BehaviorVariable('combatActionType', /* NOP */) == 0){
if (thePlayer.CanPlayHitAnim() && thePlayer.IsTh
reatened()){
thePlayer.CriticalEffectAnimationInterru
pted("CiriDodge");
thePlayer.PushCombatActionOnBuffer(9, 0,
/* NOP */);
thePlayer.ProcessCombatActionBuffer();
} else {
thePlayer.PushCombatActionOnBuffer(9, 0,
/* NOP */);
}
}
} else if (!IsActionAllowed(23)){
thePlayer.DisplayActionDisallowedHudMessage(23, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCbtDodge(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
thePlayer.EvadePressed(6);
}
/* NOP */;
}
public function OnCbtRoll(action : SInputAction) : Bool{
if (theInput.LastUsedPCInput()){
if (IsPressed(action, /* NOP */)){
thePlayer.EvadePressed(9);
}
} else if (IsPressed(action, /* NOP */)){
thePlayer.StartDodgeTimer();
} else if (IsReleased(action, /* NOP */)){
if (thePlayer.IsDodgeTimerRunning()){

thePlayer.StopDodgeTimer();
if (!thePlayer.IsInsideInteraction()){
thePlayer.EvadePressed(9);
}
}
}
/* NOP */;
}
public function OnMovementDoubleTap(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (!thePlayer.IsDodgeTimerRunning() || action.aName !=
lastMovementDoubleTapName){
thePlayer.StartDodgeTimer();
lastMovementDoubleTapName = action.aName;
} else {
thePlayer.StopDodgeTimer();
thePlayer.EvadePressed(6);
}
}
/* NOP */;
}
public function OnCastSign(action : SInputAction) : Bool{
var signSkill : ESkill;
if (!thePlayer.GetBIsInputAllowed()){
return false;
}
if (IsPressed(action, /* NOP */)){
if (!IsActionAllowed(0)){
thePlayer.DisplayActionDisallowedHudMessage(0, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsab
leItemLBlocked()){
thePlayer.DisplayActionDisallowedHudMessage(28,
false, false, true, /* NOP */);
return false;
}
signSkill = SignEnumToSkillEnum(thePlayer.GetEquippedSig
n());
if (signSkill != 0){
if (!thePlayer.CanUseSkill(signSkill)){
thePlayer.DisplayActionDisallowedHudMess
age(28, false, false, true, /* NOP */);
return false;
}
if (thePlayer.HasStaminaToUseSkill(signSkill, fa
lse, /* NOP */)){
if (GetInvalidUniqueId() != thePlayer.in
v.GetItemFromSlot('l_weapon') && !thePlayer.IsUsableItemLBlocked()){
}
thePlayer.SetupCombatAction(3, 1);
} else {
thePlayer.SoundEvent("gui_no_stamina", /
* NOP */, /* NOP */);
}
}
}
/* NOP */;
}

public function OnThrowBomb(action : SInputAction) : Bool{


var selectedItemId : SItemUniqueId;
selectedItemId = thePlayer.GetSelectedItemId();
if (!thePlayer.inv.IsItemBomb(selectedItemId)){
return false;
}
if (thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0){
if (IsPressed(action, /* NOP */)){
thePlayer.SoundEvent("gui_ingame_low_stamina_war
ning", /* NOP */, /* NOP */);
}
return false;
}
if (IsReleased(action, /* NOP */)){
if (thePlayer.IsThrowHold()){
if (thePlayer.playerAiming.GetAimedTarget()){
if (thePlayer.AllowAttack(thePlayer.play
erAiming.GetAimedTarget(), 4)){
thePlayer.PushCombatActionOnBuff
er(4, 0, /* NOP */);
thePlayer.ProcessCombatActionBuf
fer();
} else {
thePlayer.BombThrowAbort();
}
} else {
thePlayer.PushCombatActionOnBuffer(4, 0,
/* NOP */);
thePlayer.ProcessCombatActionBuffer();
}
thePlayer.SetThrowHold(false);
return true;
} else {
if (!IsActionAllowed(13)){
thePlayer.DisplayActionDisallowedHudMess
age(13, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
} else if (GetWitcherPlayer().GetBombDelay(GetWi
tcherPlayer().GetItemSlot(selectedItemId)) > 0){
return false;
}
if (thePlayer.IsHoldingItemInLHand() && !thePlay
er.IsUsableItemLBlocked()){
thePlayer.SetPlayerActionToRestore(3);
thePlayer.OnUseSelectedItem(true);
return true;
}
if (thePlayer.CanSetupCombatAction_Throw() && th
eInput.GetLastActivationTime(action.aName) < 0.300000){
thePlayer.SetupCombatAction(4, 1);
return true;
}
thePlayer.SetupCombatAction(4, 0);
return true;
}
}
return false;
/* NOP */;
}
public function OnThrowBombHold(action : SInputAction) : Bool{

var locks : array<SInputActionLock>;


var ind : Int32;
var selectedItemId : SItemUniqueId;
selectedItemId = thePlayer.GetSelectedItemId();
if (!thePlayer.inv.IsItemBomb(selectedItemId)){
return false;
}
if (thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0){
if (IsPressed(action, /* NOP */)){
thePlayer.SoundEvent("gui_ingame_low_stamina_war
ning", /* NOP */, /* NOP */);
}
return false;
}
if (IsPressed(action, /* NOP */)){
if (!IsActionAllowed(13)){
thePlayer.DisplayActionDisallowedHudMessage(13,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
} else if (GetWitcherPlayer().GetBombDelay(GetWitcherPla
yer().GetItemSlot(selectedItemId)) > 0){
return false;
}
if (thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsa
bleItemLBlocked()){
thePlayer.SetPlayerActionToRestore(3);
thePlayer.OnUseSelectedItem(true);
return true;
}
if (thePlayer.CanSetupCombatAction_Throw() && theInput.G
etLastActivationTime(action.aName) < 0.300000){
if (thePlayer.GetBIsCombatActionAllowed()){
thePlayer.PushCombatActionOnBuffer(4, 1,
/* NOP */);
thePlayer.ProcessCombatActionBuffer();
}
}
locks = GetActionLocks(13);
ind = FindActionLockIndex(13, 'BombThrow');
if (ind >= 0){
locks.Erase(ind);
}
if (locks.Size() != 0){
return false;
}
thePlayer.SetThrowHold(true);
return true;
}
return false;
/* NOP */;
}
public function OnThrowBombAbort(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
thePlayer.BombThrowAbort();
}
/* NOP */;
}
public function OnCbtThrowItem(action : SInputAction) : Bool{
var isUsableItem : Bool;
var isCrossbow : Bool;

var isBomb : Bool;


var ret : Bool;
var itemId : SItemUniqueId;
if (thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheM
iddleOfHolstering()){
return false;
}
if (thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && theP
layer.GetCurrentStateName() != 'AimThrow'){
return false;
}
itemId = thePlayer.GetSelectedItemId();
if (!thePlayer.inv.IsIdValid(itemId)){
return false;
}
isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
if (!isCrossbow){
isBomb = thePlayer.inv.IsItemBomb(itemId);
if (!isBomb){
isUsableItem = true;
}
}
if (isCrossbow){
if (IsActionAllowed(33)){
if (IsPressed(action, /* NOP */)){
if (thePlayer.IsHoldingItemInLHand() &&
!thePlayer.IsUsableItemLBlocked()){
thePlayer.SetPlayerActionToResto
re(1);
thePlayer.OnUseSelectedItem(true
);
ret = true;
} else if (thePlayer.GetBIsInputAllowed(
) && !thePlayer.IsCurrentlyUsingItemL()){
thePlayer.SetIsAimingCrossbow(tr
ue);
thePlayer.SetupCombatAction(4, 1
);
ret = true;
}
} else if (thePlayer.GetIsAimingCrossbow() && !t
hePlayer.IsCurrentlyUsingItemL()){
thePlayer.SetupCombatAction(4, 0);
thePlayer.SetIsAimingCrossbow(false);
ret = true;
}
} else if (!thePlayer.IsInShallowWater()){
thePlayer.DisplayActionDisallowedHudMessage(33,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (IsPressed(action, /* NOP */)){
thePlayer.AddTimer('IsItemUseInputHeld', 0.00001
0, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
thePlayer.RemoveTimer('IsItemUseInputHeld', /* N
OP */);
}
return ret;
} else if (isBomb){
return OnThrowBomb(action);

} else if (isUsableItem && !thePlayer.IsSwimming() && !thePlayer


.IsFistFighting()){
if (IsActionAllowed(34)){
if (IsPressed(action, /* NOP */) && thePlayer.Ha
sStaminaToUseAction(11, /* NOP */, /* NOP */, /* NOP */)){
thePlayer.SetPlayerActionToRestore(0);
thePlayer.OnUseSelectedItem(/* NOP */);
return true;
}
} else {
thePlayer.DisplayActionDisallowedHudMessage(34,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
return false;
/* NOP */;
}
public function OnCbtThrowItemHold(action : SInputAction) : Bool{
var isBomb : Bool;
var isCrossbow : Bool;
var isUsableItem : Bool;
var itemId : SItemUniqueId;
if (thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheM
iddleOfHolstering()){
return false;
}
if (thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && theP
layer.GetCurrentStateName() != 'AimThrow'){
return false;
}
itemId = thePlayer.GetSelectedItemId();
if (!thePlayer.inv.IsIdValid(itemId)){
return false;
}
isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
if (!isCrossbow){
isBomb = thePlayer.inv.IsItemBomb(itemId);
if (isBomb){
return OnThrowBombHold(action);
} else {
isUsableItem = true;
}
}
if (IsPressed(action, /* NOP */)){
if (isCrossbow && !IsActionAllowed(33)){
thePlayer.DisplayActionDisallowedHudMessage(33,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (isUsableItem){
if (!IsActionAllowed(34)){
thePlayer.DisplayActionDisallowedHudMess
age(34, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
} else if (thePlayer.IsSwimming()){
thePlayer.DisplayActionDisallowedHudMess
age(28, false, false, true, /* NOP */);
return false;
}
}

}
if (IsPressed(action, /* NOP */)){
thePlayer.SetThrowHold(true);
return true;
} else if (IsReleased(action, /* NOP */) && thePlayer.IsThrowHol
d()){
thePlayer.SetupCombatAction(4, 0);
thePlayer.SetThrowHold(false);
return true;
}
return false;
/* NOP */;
}
public function OnCbtThrowCastAbort(action : SInputAction) : Bool{
var player : W3PlayerWitcher;
var throwStage : EThrowStage;
if (thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId())){
return OnThrowBombAbort(action);
}
if (IsPressed(action, /* NOP */)){
player = GetWitcherPlayer();
if (player){
if (player.IsCastingSign()){
player.CastSignAbort();
} else if (thePlayer.inv.IsItemCrossbow(thePlaye
r.inv.GetItemFromSlot('l_weapon'))){
thePlayer.OnRangedForceHolster(/* NOP */
, /* NOP */, /* NOP */);
} else {
throwStage = thePlayer.GetBehaviorVariab
le('throwStage', 3);
if (throwStage == 0 || throwStage == 1){
player.ThrowingAbort();
}
}
}
}
/* NOP */;
}
public function OnCbtSelectLockTarget(inputVector : Vector) : Bool{
var newLockTarget : CActor;
var inputHeading : Float;
var target : CActor;
inputVector.Y = inputVector.Y * -1.000000;
inputHeading = VecHeading(inputVector);
newLockTarget = thePlayer.GetScreenSpaceLockTarget(thePlayer.Get
DisplayTarget(), 180.000000, 1.000000, inputHeading, /* NOP */);
if (newLockTarget){
thePlayer.ProcessLockTarget(newLockTarget, /* NOP */);
}
target = thePlayer.GetTarget();
if (target){
thePlayer.SetSlideTarget(target);
}
/* NOP */;
}
public function OnCbtLockAndGuard(action : SInputAction) : Bool{
if (thePlayer.IsCiri() && !GetCiriPlayer().HasSword()){
return false;
}

if (IsReleased(action, /* NOP */)){


thePlayer.SetGuarded(false);
thePlayer.OnGuardedReleased();
}
if (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentState
Name() == 'CombatFists' && !IsActionAllowed(8)){
thePlayer.DisplayActionDisallowedHudMessage(8, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (IsPressed(action, /* NOP */)){
if (!IsActionAllowed(25)){
if (IsActionBlockedBy(25, 'UsableItem')){
thePlayer.DisplayActionDisallowedHudMess
age(25, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
return true;
}
if (thePlayer.GetCurrentStateName() == 'Exploration'){
thePlayer.GoToCombatIfNeeded(/* NOP */);
}
if (thePlayer.bLAxisReleased){
thePlayer.ResetRawPlayerHeading();
}
if (thePlayer.rangedWeapon && thePlayer.rangedWeapon.Get
CurrentStateName() != 'State_WeaponWait'){
thePlayer.OnRangedForceHolster(true, true, /* NO
P */);
}
thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
thePlayer.SetGuarded(true);
thePlayer.OnPerformGuard();
}
/* NOP */;
}
public function OnCbtCameraLockOrSpawnHorse(action : SInputAction) : Boo
l{
if (OnCbtCameraLock(action)){
return true;
}
if (OnCommSpawnHorse(action)){
return true;
}
return false;
/* NOP */;
}
public function OnCbtCameraLock(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (thePlayer.IsThreatened() || thePlayer.IsActorLockedT
oTarget()){
if (!thePlayer.IsHardLockEnabled() && thePlayer.
GetDisplayTarget() && (CActor)thePlayer.GetDisplayTarget() && IsActionAllowed(37
)){
if (thePlayer.bLAxisReleased){
thePlayer.ResetRawPlayerHeading(
);
}
thePlayer.HardLockToTarget(true);
} else {
thePlayer.HardLockToTarget(false);

}
return true;
}
}
return false;
/* NOP */;
}
public function OnChangeCameraPreset(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
(CCustomCamera)theCamera.GetTopmostCameraObject().NextPr
eset();
}
/* NOP */;
}
public function OnChangeCameraPresetByMouseWheel(action : SInputAction)
: Bool{
var tolerance : Float;
tolerance = 10.000000;
if (action.value * totalCameraPresetChange < 0.000000){
totalCameraPresetChange = 0.000000;
}
totalCameraPresetChange += action.value;
if (totalCameraPresetChange < -tolerance){
(CCustomCamera)theCamera.GetTopmostCameraObject().PrevPr
eset();
totalCameraPresetChange = 0.000000;
} else if (totalCameraPresetChange > tolerance){
(CCustomCamera)theCamera.GetTopmostCameraObject().NextPr
eset();
totalCameraPresetChange = 0.000000;
}
/* NOP */;
}
public function OnMeditationAbort(action : SInputAction) : Bool{
var med : W3PlayerWitcherStateMeditation;
if (!theGame.GetGuiManager().IsAnyMenu()){
med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer()
.GetCurrentState();
if (med){
med.StopRequested(false);
}
}
/* NOP */;
}
public function Dbg_UnlockAllActions(){
var i : Int32;
if (theGame.IsFinalBuild()){
return;
}
i = actionLocks.Size() - 1;
while (i >= 0){
OnActionLockChanged(i, false, /* NOP */, /* NOP */);
i -= 1;
}
actionLocks.Clear();
/* NOP */;
}
public function OnDbgSpeedUp(action : SInputAction) : Bool{
if (theGame.IsFinalBuild()){
return false;

}
if (IsPressed(action, /* NOP */)){
theGame.SetTimeScale(4, theGame.GetTimescaleSource(8), t
heGame.GetTimescalePriority(8), /* NOP */, /* NOP */);
} else if (IsReleased(action, /* NOP */)){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(8));
}
/* NOP */;
}
public function OnDbgHit(action : SInputAction) : Bool{
if (theGame.IsFinalBuild()){
return false;
}
if (IsReleased(action, /* NOP */)){
thePlayer.SetBehaviorVariable('HitReactionDirection', 1,
/* NOP */);
thePlayer.SetBehaviorVariable('isAttackReflected', 0, /*
NOP */);
thePlayer.SetBehaviorVariable('HitReactionType', 2, /* N
OP */);
thePlayer.SetBehaviorVariable('HitReactionWeapon', 0, /*
NOP */);
thePlayer.SetBehaviorVariable('HitSwingDirection', 2, /*
NOP */);
thePlayer.SetBehaviorVariable('HitSwingType', 0, /* NOP
*/);
thePlayer.RaiseForceEvent('Hit');
thePlayer.OnRangedForceHolster(true, /* NOP */, /* NOP *
/);
GetWitcherPlayer().SetCustomRotation('Hit', thePlayer.Ge
tHeading() + 180, 1080.000000, 0.100000, false);
thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit")
;
}
/* NOP */;
}
public function OnDbgKillTarget(action : SInputAction) : Bool{
var target : CActor;
if (theGame.IsFinalBuild()){
return false;
}
target = thePlayer.GetTarget();
if (target && IsReleased(action, /* NOP */)){
target.Kill(/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnDbgKillAll(action : SInputAction) : Bool{
if (theGame.IsFinalBuild()){
return false;
}
if (IsReleased(action, /* NOP */)){
thePlayer.DebugKillAll();
}
/* NOP */;
}
public function OnDbgResurrectPlayer(action : SInputAction) : Bool{
if (theGame.IsFinalBuild()){
return false;
}

if (IsReleased(action, /* NOP */)){


thePlayer.CheatResurrect();
}
/* NOP */;
}
public function OnDbgKillAllTargetingPlayer(action : SInputAction) : Boo
l{
var i : Int32;
var all : array<CActor>;
if (theGame.IsFinalBuild()){
return false;
}
if (IsPressed(action, /* NOP */)){
all = GetActorsInRange(thePlayer, 10000, 10000, 'None',
true);
i = 0;
while (i < all.Size()){
if (all[i] != thePlayer && all[i].GetTarget() ==
thePlayer){
all[i].Kill(/* NOP */, /* NOP */, /* NOP
*/);
}
i += 1;
}
}
/* NOP */;
}
public function OnBoatDismount(action : SInputAction) : Bool{
var boatComp : CBoatComponent;
var stopAction : SInputAction;
stopAction = theInput.GetAction('GI_Decelerate');
if (IsReleased(action, /* NOP */) && theInput.LastUsedPCInput()
|| stopAction.value < 0.700000 && stopAction.lastFrameValue < 0.700000){
if (thePlayer.IsActionAllowed(22)){
boatComp = (CBoatComponent)thePlayer.GetUsedVehi
cle().GetComponentByClassName('CBoatComponent');
boatComp.IssueCommandToDismount(1);
} else {
thePlayer.DisplayActionDisallowedHudMessage(22,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnCiriDrawWeapon(action : SInputAction) : Bool{
var duringCastSign : Bool;
if (IsReleased(action, /* NOP */) || IsPressed(action, /* NOP */
) && thePlayer.GetCurrentMeleeWeaponType() == 0 || thePlayer.GetCurrentMeleeWeap
onType() == 3){
if (thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCo
mbatActionAllowed()){
if (thePlayer.GetCurrentMeleeWeaponType() == 1 &
& !thePlayer.IsThreatened()){
thePlayer.OnEquipMeleeWeapon(0, false, /
* NOP */);
} else {
thePlayer.OnEquipMeleeWeapon(1, false, /
* NOP */);
}
}

} else if (IsReleased(action, /* NOP */) || IsPressed(action, /*


NOP */) && thePlayer.GetCurrentMeleeWeaponType() == 1 || thePlayer.GetCurrentMe
leeWeaponType() == 2){
super.CiriSheatheWeapon();
}
/* NOP */;
}
public function OnCiriHolsterWeapon(action : SInputAction) : Bool{
var currWeaponType : EPlayerWeapon;
if (IsPressed(action, /* NOP */)){
currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
if (currWeaponType == 1 || currWeaponType == 2){
super.CiriSheatheWeapon();
}
}
/* NOP */;
}
private final function CiriSheatheWeapon(){
if (thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActi
onAllowed() && !thePlayer.IsThreatened()){
thePlayer.OnEquipMeleeWeapon(0, false, /* NOP */);
}
/* NOP */;
}
public function OnCommHoldFastMenu(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
holdFastMenuInvoked = true;
super.PushInventoryScreen();
}
/* NOP */;
}
public function OnFastMenu(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
if (holdFastMenuInvoked){
holdFastMenuInvoked = false;
return false;
}
if (theGame.IsBlackscreenOrFading()){
return false;
}
if (theGame.GetGuiManager().IsAnyMenu()){
return false;
}
if (IsActionAllowed(35)){
theGame.SetMenuToOpen('None');
theGame.RequestMenu('CommonMenu', /* NOP */);
} else {
thePlayer.DisplayActionDisallowedHudMessage(35,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnIngameMenu(action : SInputAction) : Bool{
var openedPanel : CName;
openedPanel = theGame.GetMenuToOpen();
if (IsReleased(action, /* NOP */) && openedPanel != 'GlossaryTut
orialsMenu' && !theGame.GetGuiManager().IsAnyMenu()){
if (theGame.IsBlackscreenOrFading()){
return false;

}
theGame.SetMenuToOpen('None');
theGame.RequestMenu('CommonIngameMenu', /* NOP */);
}
/* NOP */;
}
public final function Debug_ClearAllActionLocks(action : EInputActionBlo
ck, all : Bool){
var i : Int32;
if (all){
Dbg_UnlockAllActions();
} else {
OnActionLockChanged(action, false, /* NOP */, /* NOP */)
;
actionLocks[action].Clear();
}
/* NOP */;
}
}
import struct CInventoryComponent{
public editable var priceMult : Float;
public editable var priceRepairMult : Float;
public editable var priceRepair : Float;
public editable var fundsType : EInventoryFundsType;
private var recentlyAddedItems : array<SItemUniqueId>;
private var fundsMax : Int32;
private var daysToIncreaseFunds : Int32;
public var listeners : array<IInventoryScriptedListener>;
import public final function GetItemModifierFloat(itemId : SItemUniqueId
, modName : CName, defValue : Float) : Float;
import public final function SetItemModifierFloat(itemId : SItemUniqueId
, modName : CName, val : Float);
import public final function GetItemModifierInt(itemId : SItemUniqueId,
modName : CName, defValue : Int32) : Int32;
import public final function SetItemModifierInt(itemId : SItemUniqueId,
modName : CName, val : Int32);
import public final function GetItemFromSlot(slotName : CName) : SItemUn
iqueId;
import public final function GetItemsNames() : array<CName>;
import public final function GetItemCount(useAssociatedInventory : Bool)
: Int32;
import public final function GetItemName(itemId : SItemUniqueId) : CName
;
import public final function GetItemCategory(itemId : SItemUniqueId) : C
Name;
import public final function GetItemClass(itemId : SItemUniqueId) : EInv
entoryItemClass;
import public final function ItemHasTag(itemId : SItemUniqueId, tag : CN
ame) : Bool;
import public final function GetItemTags(itemId : SItemUniqueId, tags :
array<CName>) : Bool;
import public final function AddItemTag(itemId : SItemUniqueId, tag : CN
ame) : Bool;
import public final function RemoveItemTag(itemId : SItemUniqueId, tag :
CName) : Bool;
import public final function GetItemByItemEntity(itemEntity : CItemEntit
y) : SItemUniqueId;
import public final function GetItemQuantity(itemId : SItemUniqueId) : I
nt32;

import public final function GetItemQuantityByName(itemName : CName, use


AssociatedInventory : Bool) : Int32;
import public final function GetItemQuantityByCategory(itemCategory : CN
ame, useAssociatedInventory : Bool) : Int32;
import public final function GetItemQuantityByTag(itemTag : CName, useAs
sociatedInventory : Bool) : Int32;
import public final function GetAllItemsQuantity(useAssociatedInventory
: Bool) : Int32;
import public final function GetItemEntityUnsafe(itemId : SItemUniqueId)
: CItemEntity;
import public final function GetItemBaseAttributes(itemId : SItemUniqueI
d, attributes : array<CName>);
import public final function GetItemAttributes(itemId : SItemUniqueId, a
ttributes : array<CName>);
import public final function GetItemAttributeValue(itemId : SItemUniqueI
d, attributeName : CName, abilityTags : array<CName>, withoutTags : Bool) : SAbi
lityAttributeValue;
import public final function GetItemAbilityAttributeValue(itemId : SItem
UniqueId, attributeName : CName, abilityName : CName) : SAbilityAttributeValue;
import public final function GetItemAbilities(itemId : SItemUniqueId, ab
ilities : array<CName>);
import public final function GetItemContainedAbilities(itemId : SItemUni
queId, abilities : array<CName>);
import private final function GiveItem(otherInventory : CInventoryCompon
ent, itemId : SItemUniqueId, quantity : Int32) : array<SItemUniqueId>;
import public final function HasItem(item : CName) : Bool;
import private final function AddMultiItem(item : CName, quantity : Int3
2, informGui : Bool, markAsNew : Bool, lootable : Bool) : array<SItemUniqueId>;
import private final function AddSingleItem(item : CName, informGui : Bo
ol, markAsNew : Bool, lootable : Bool) : SItemUniqueId;
import public final function RemoveItem(itemId : SItemUniqueId, quantity
: Int32) : Bool;
import public final function MountItem(itemId : SItemUniqueId, toHand :
Bool, force : Bool) : Bool;
import public final function UnmountItem(itemId : SItemUniqueId, destroy
Entity : Bool) : Bool;
import public final function ThrowAwayItem(itemId : SItemUniqueId, quant
ity : Int32) : Bool;
import public final function ThrowAwayAllItems() : CEntity;
import public final function ThrowAwayItemsFiltered(excludedTags : array
<CName>) : CEntity;
import public final function ThrowAwayLootableItems(skipNoDropNoShow : B
ool) : CEntity;
import public final function PrintInfo();
import public final function DespawnItem(itemId : SItemUniqueId);
import public final function GetAllItems(items : array<SItemUniqueId>);
import public final function GetItemsByTag(tag : CName) : array<SItemUni
queId>;
import public final function GetItemsByCategory(category : CName) : arra
y<SItemUniqueId>;
import public final function IsIdValid(itemId : SItemUniqueId) : Bool;
import public final function GetItemEnhancementSlotsCount(itemId : SItem
UniqueId) : Int32;
import public final function GetItemEnhancementItems(itemId : SItemUniqu
eId, names : array<CName>);
import public final function GetItemEnhancementCount(itemId : SItemUniqu
eId) : Int32;
import public final function HasEnhancementItemTag(enhancedItemId : SIte
mUniqueId, slotIndex : Int32, tag : CName) : Bool;
import private function EnhanceItem(enhancedItemId : SItemUniqueId, exte

nsionItemId : SItemUniqueId) : Bool;


import private function RemoveItemEnhancementByIndex(enhancedItemId : SI
temUniqueId, slotIndex : Int32) : Bool;
import private function RemoveItemEnhancementByName(enhancedItemId : SIt
emUniqueId, extensionItemName : CName) : Bool;
import public final function GetCraftedItemName(itemId : SItemUniqueId)
: CName;
import public final function IsItemMounted(itemId : SItemUniqueId) : Boo
l;
import public final function IsItemHeld(itemId : SItemUniqueId) : Bool;
import public final function GetDeploymentItemEntity(itemId : SItemUniqu
eId, position : Vector, rotation : EulerAngles, allocateIdTag : Bool) : CEntity;
import public final function PlayItemEffect(itemId : SItemUniqueId, effe
ctName : CName);
import public final function StopItemEffect(itemId : SItemUniqueId, effe
ctName : CName);
import public final function DropItem(itemId : SItemUniqueId, removeFrom
Inv : Bool);
import public final function GetItemHoldSlot(itemId : SItemUniqueId) : C
Name;
import public final function EnableLoot(enable : Bool);
import public final function UpdateLoot();
import public final function AddItemsFromLootDefinition(lootDefinitionNa
me : CName);
import public final function IsLootRenewable() : Bool;
import public final function IsReadyToRenew() : Bool;
import public final function RemoveAllItems();
import public final function GetInventoryItemUIData(item : SItemUniqueId
) : SInventoryItemUIData;
import public final function SetInventoryItemUIData(item : SItemUniqueId
, data : SInventoryItemUIData);
import public final function GetSchematicIngredients(itemName : SItemUni
queId, quantity : array<Int32>, names : array<CName>);
import public final function GetSchematicRequiredCraftsmanType(craftName
: SItemUniqueId) : CName;
import public final function GetSchematicRequiredCraftsmanLevel(craftNam
e : SItemUniqueId) : CName;
import public final function GetItemRecyclingParts(itemId : SItemUniqueI
d) : array<SItemParts>;
import public final function GetItemGridSize(itemId : SItemUniqueId) : I
nt32;
import public final function HasItemDurability(itemId : SItemUniqueId) :
Bool;
import public final function GetItemDurability(itemId : SItemUniqueId) :
Float;
import private final function SetItemDurability(itemId : SItemUniqueId,
durability : Float);
import public final function GetItemInitialDurability(itemId : SItemUniq
ueId) : Float;
import public final function GetItemMaxDurability(itemId : SItemUniqueId
) : Float;
import public final function ActivateQuestBonus();
import public final function GetItem(itemId : SItemUniqueId) : SInventor
yItem;
import public final function GetFundsModifier() : Float;
import public final function GetItemPriceDisassemble(invItem : SInventor
yItem) : Int32;
import public final function GetItemPriceRemoveUpgrade(invItem : SInvent
oryItem) : Int32;
import public final function GetItemPriceRepair(invItem : SInventoryItem

, costRepairPoint : Int32, costRepairTotal : Int32);


import public final function GetItemPriceModified(itemId : SItemUniqueId
, playerSellingItem : Bool) : Int32;
import public final function GetInventoryItemPriceModified(invItem : SIn
ventoryItem, playerSellingItem : Bool) : Int32;
import public final function GetItemPrice(itemId : SItemUniqueId) : Int3
2;
import public final function GetItemWeight(id : SItemUniqueId) : Float;
import public final function TotalItemStats(invItem : SInventoryItem) :
Float;
import public final function GetItemSetName(itemId : SItemUniqueId) : CN
ame;
import public final function SortInventoryUIData();
import public final function AddItemCraftedAbility(itemId : SItemUniqueI
d, abilityName : CName, allowDuplicate : Bool);
import public final function RemoveItemCraftedAbility(itemId : SItemUniq
ueId, abilityName : CName);
import public final function AddItemBaseAbility(item : SItemUniqueId, ab
ilityName : CName);
import public final function RemoveItemBaseAbility(item : SItemUniqueId,
abilityName : CName);
import public final function PreviewItemAttributeAfterUpgrade(baseItemId
: SItemUniqueId, upgradeItemId : SItemUniqueId, attributeName : CName, baseInve
ntory : CInventoryComponent, upgradeInventory : CInventoryComponent) : SAbilityA
ttributeValue;
import public final function GetItemLocalizedNameByUniqueID(itemUniqueId
: SItemUniqueId) : String;
import public final function GetItemLocalizedDescriptionByUniqueID(itemU
niqueId : SItemUniqueId) : String;
import public final function GetItemLocalizedNameByName(itemName : CName
) : String;
import public final function GetItemLocalizedDescriptionByName(itemName
: CName) : String;
import public final function GetItemIconPathByUniqueID(itemUniqueId : SI
temUniqueId) : String;
import public final function GetItemIconPathByName(itemName : CName) : S
tring;
import public final function GetNumOfStackedItems(itemUniqueId : SItemUn
iqueId) : Int32;
import public final function NotifyScriptedListeners(notify : Bool);
import public final function InitInvFromTemplate(resource : CEntityTempl
ate);
import private final function BalanceItemsWithPlayerLevel(playerLevel :
Int32);
import public final function NotifyItemLooted(item : SItemUniqueId);
import public final function ResetContainerData();
public function GetFundsType() : EInventoryFundsType{
return fundsType;
/* NOP */;
}
public function GetDaysToIncreaseFunds() : Int32{
return daysToIncreaseFunds;
/* NOP */;
}
public function GetFundsMax() : Float{
if (2 == fundsType){
return 5000;
} else if (3 == fundsType){
return 2500;
} else if (1 == fundsType){

return 7500;
}
return -1;
/* NOP */;
}
public function SetupFunds(){
if (2 == fundsType){
AddMoney(500 * super.GetFundsModifier());
} else if (1 == fundsType){
AddMoney(1000 * super.GetFundsModifier());
} else if (3 == fundsType){
AddMoney(200 * super.GetFundsModifier());
}
/* NOP */;
}
public function IncreaseFunds(){
if (GetMoney() < GetFundsMax()){
if (2 == fundsType){
AddMoney(125 * super.GetFundsModifier());
} else if (3 == fundsType){
AddMoney(100 * super.GetFundsModifier());
} else if (1 == fundsType){
AddMoney(500 * super.GetFundsModifier());
}
}
/* NOP */;
}
public function GetMoney() : Int32{
return super.GetItemQuantityByName('Crowns', /* NOP */);
/* NOP */;
}
public function AddMoney(amount : Int32){
if (amount > 0){
super.AddAnItem('Crowns', amount, /* NOP */, /* NOP */,
/* NOP */);
if (thePlayer == GetEntity()){
theTelemetry.LogWithValue(12, amount);
}
}
/* NOP */;
}
public function RemoveMoney(amount : Int32){
if (amount > 0){
RemoveItemByName('Crowns', amount);
if (thePlayer == GetEntity()){
theTelemetry.LogWithValue(12, -amount);
}
}
/* NOP */;
}
public final function GetItemArmorTotal(item : SItemUniqueId) : SAbility
AttributeValue{
var armor : SAbilityAttributeValue;
var armorBonus : SAbilityAttributeValue;
var durMult : Float;
armor = GetItemAttributeValue(item, theGame.params.ARMOR_VALUE_N
AME, /* NOP */, /* NOP */);
armorBonus = GetRepairObjectBonusValueForArmor(item);
durMult = theGame.params.GetDurabilityMultiplier(GetItemDurabili
tyRatio(item), false);

return armor * durMult + armorBonus;


/* NOP */;
}
public final function GetItemLevel(item : SItemUniqueId) : Int32{
var itemCategory : CName;
var itemAttributes : array<SAbilityAttributeValue>;
var itemName : CName;
var isWitcherGear : Bool;
var isRelicGear : Bool;
var level : Int32;
itemCategory = GetItemCategory(item);
itemName = GetItemName(item);
isWitcherGear = false;
isRelicGear = false;
if (RoundMath(CalculateAttributeValue(GetItemAttributeValue(item
, 'quality', /* NOP */, /* NOP */), /* NOP */)) == 5){
isWitcherGear = true;
}
if (RoundMath(CalculateAttributeValue(GetItemAttributeValue(item
, 'quality', /* NOP */, /* NOP */), /* NOP */)) == 4){
isRelicGear = true;
}
switch(itemCategory){
case 'armor':
case 'boots':
case 'gloves':
case 'pants':
itemAttributes.PushBack(GetItemAttributeValue(item, 'arm
or', /* NOP */, /* NOP */));
break;
case 'silversword':
itemAttributes.PushBack(GetItemAttributeValue(item, 'Sil
verDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Blu
dgeoningDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Ren
dingDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Ele
mentalDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Fir
eDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Pie
rcingDamage', /* NOP */, /* NOP */));
break;
case 'steelsword':
itemAttributes.PushBack(GetItemAttributeValue(item, 'Sla
shingDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Blu
dgeoningDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Ren
dingDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Ele
mentalDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Fir
eDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Sil
verDamage', /* NOP */, /* NOP */));
itemAttributes.PushBack(GetItemAttributeValue(item, 'Pie
rcingDamage', /* NOP */, /* NOP */));
break;

case 'crossbow':
itemAttributes.PushBack(GetItemAttributeValue(item, 'att
ack_power', /* NOP */, /* NOP */));
break;
default:
break;
}
level = theGame.params.GetItemLevel(itemCategory, itemAttributes
, itemName);
if (isWitcherGear){
level = level - 2;
}
if (isRelicGear){
level = level - 1;
}
if (level < 1){
level = 1;
}
return level;
/* NOP */;
}
public function GetItemLevelColor(lvl_item : Int32) : String{
var color : String;
if (lvl_item > thePlayer.GetLevel()){
color = "<font color = '#9F1919'>";
} else {
color = "<font color = '#57DE57'>";
}
return color;
/* NOP */;
}
public final function AutoBalanaceItemsWithPlayerLevel(){
var playerLevel : Int32;
playerLevel = thePlayer.GetLevel();
if (playerLevel < 0){
playerLevel = 0;
}
BalanceItemsWithPlayerLevel(playerLevel);
/* NOP */;
}
public function GetItemsByName(itemName : CName) : array<SItemUniqueId>{
var ret : array<SItemUniqueId>;
var i : Int32;
if (!IsNameValid(itemName)){
return ret;
}
super.GetAllItems(ret);
i = ret.Size() - 1;
while (i >= 0){
if (super.GetItemName(ret[i]) != itemName){
ret.EraseFast(i);
}
i -= 1;
}
return ret;
/* NOP */;
}
public final function GetSingletonItems() : array<SItemUniqueId>{
return GetItemsByTag(theGame.params.TAG_ITEM_SINGLETON);
/* NOP */;

}
public function IsEmpty(bSkipNoDropNoShow : Bool) : Bool{
var i : Int32;
var itemIds : array<SItemUniqueId>;
if (bSkipNoDropNoShow){
super.GetAllItems(itemIds);
i = itemIds.Size() - 1;
while (i >= 0){
if (!super.ItemHasTag(itemIds[i], theGame.params
.TAG_DONT_SHOW) && !super.ItemHasTag(itemIds[i], 'NoDrop')){
return false;
} else if (super.ItemHasTag(itemIds[i], 'Lootabl
e')){
return false;
}
i -= 1;
}
return true;
}
return super.GetItemCount(/* NOP */) <= 0;
/* NOP */;
}
public function GetAllHeldAndMountedItemsCategories(heldItems : array<CN
ame>, mountedItems : array<CName>){
var allItems : array<SItemUniqueId>;
var i : Int32;
super.GetAllItems(allItems);
i = allItems.Size() - 1;
while (i >= 0){
if (super.IsItemHeld(allItems[i])){
heldItems.PushBack(super.GetItemCategory(allItem
s[i]));
} else if (super.IsItemMounted(allItems[i])){
mountedItems.PushBack(super.GetItemCategory(allI
tems[i]));
}
i -= 1;
}
/* NOP */;
}
public function GetAllHeldItemsNames(heldItems : array<CName>){
var allItems : array<SItemUniqueId>;
var i : Int32;
super.GetAllItems(allItems);
i = allItems.Size() - 1;
while (i >= 0){
if (super.IsItemHeld(allItems[i])){
heldItems.PushBack(super.GetItemName(allItems[i]
));
}
i -= 1;
}
/* NOP */;
}
public function HasMountedItemByTag(tag : CName) : Bool{
var i : Int32;
var allItems : array<SItemUniqueId>;
if (!IsNameValid(tag)){
return false;
}

allItems = super.GetItemsByTag(tag);
i = 0;
while (i < allItems.Size()){
if (super.IsItemMounted(allItems[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function HasHeldOrMountedItemByTag(tag : CName) : Bool{
var i : Int32;
var allItems : array<SItemUniqueId>;
if (!IsNameValid(tag)){
return false;
}
allItems = super.GetItemsByTag(tag);
i = 0;
while (i < allItems.Size()){
if (super.IsItemMounted(allItems[i]) || super.IsItemHeld
(allItems[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetItemsIds(itemName : CName) : array<SItemUniqueId>{
var allItems : array<SItemUniqueId>;
var i : Int32;
var localItemName : CName;
super.GetAllItems(allItems);
i = allItems.Size() - 1;
while (i >= 0){
localItemName = super.GetItemName(allItems[i]);
if (localItemName != itemName || !super.IsIdValid(allIte
ms[i])){
allItems.EraseFast(i);
}
i -= 1;
}
return allItems;
/* NOP */;
}
public function ItemHasAbility(item : SItemUniqueId, abilityName : CName
) : Bool{
var abilities : array<CName>;
super.GetItemAbilities(item, abilities);
return abilities.Contains(abilityName);
/* NOP */;
}
public function GetItemAbilitiesWithAttribute(id : SItemUniqueId, attrib
uteName : CName, attributeVal : Float) : array<CName>{
var i : Int32;
var abs : array<CName>;
var ret : array<CName>;
var dm : CDefinitionsManagerAccessor;
var val : Float;

var min : SAbilityAttributeValue;


var max : SAbilityAttributeValue;
super.GetItemAbilities(id, abs);
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < abs.Size()){
dm.GetAbilityAttributeValue(abs[i], attributeName, min,
max);
val = CalculateAttributeValue(GetAttributeRandomizedValu
e(min, max), /* NOP */);
if (val == attributeVal){
ret.PushBack(abs[i]);
}
i += 1;
}
return ret;
/* NOP */;
}
public function GetItemAbilitiesWithTag(itemId : SItemUniqueId, tag : CN
ame, abilities : array<CName>){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var allAbilities : array<CName>;
dm = theGame.GetDefinitionsManager();
super.GetItemAbilities(itemId, allAbilities);
i = 0;
while (i < allAbilities.Size()){
if (dm.AbilityHasTag(allAbilities[i], tag)){
abilities.PushBack(allAbilities[i]);
}
i += 1;
}
/* NOP */;
}
public final function GiveMoneyTo(otherInventory : CInventoryComponent,
quantity : Int32, informGUI : Bool){
var moneyId : array<SItemUniqueId>;
moneyId = GetItemsByName('Crowns');
GiveItemTo(otherInventory, moneyId[0], quantity, false, true, in
formGUI);
/* NOP */;
}
public final function GiveItemTo(otherInventory : CInventoryComponent, i
temId : SItemUniqueId, quantity : Int32, refreshNewFlag : Bool, forceTransferNoD
rops : Bool, informGUI : Bool) : SItemUniqueId{
var arr : array<SItemUniqueId>;
var itemName : CName;
var i : Int32;
var uiData : SInventoryItemUIData;
if (quantity == 0){
quantity = 1;
}
quantity = Clamp(quantity, 0, GetItemQuantity(itemId));
if (quantity == 0){
return GetInvalidUniqueId();
}
itemName = GetItemName(itemId);
if (!forceTransferNoDrops && ItemHasTag(itemId, 'NoDrop') && !It
emHasTag(itemId, 'Lootable')){
LogItems("Cannot transfer item <<" + itemName + ">> as i

t has the NoDrop tag set!!!");


return GetInvalidUniqueId();
}
if (IsItemSingletonItem(itemId)){
if (otherInventory == thePlayer.inv && otherInventory.Ge
tItemQuantityByName(itemName, /* NOP */) > 0){
LogAssert(false, "CInventoryComponent.GiveItemTo
: cannot add singleton item as player already has this item!");
return GetInvalidUniqueId();
} else {
arr = GiveItem(otherInventory, itemId, quantity)
;
}
} else {
arr = GiveItem(otherInventory, itemId, quantity);
}
if (otherInventory == thePlayer.inv){
theTelemetry.LogWithLabelAndValue(31, itemName, quantity
);
if (!theGame.AreSavesLocked() && IsItemQuest(itemId) ||
GetItemQuality(itemId) >= 4){
theGame.RequestAutoSave("item gained", false);
}
}
if (refreshNewFlag){
i = 0;
while (i < arr.Size()){
uiData = otherInventory.GetInventoryItemUIData(a
rr[i]);
uiData.isNew = true;
otherInventory.SetInventoryItemUIData(arr[i], ui
Data);
i += 1;
}
}
return arr[0];
/* NOP */;
}
public final function GiveAllItemsTo(otherInventory : CInventoryComponen
t, forceTransferNoDrops : Bool, informGUI : Bool){
var items : array<SItemUniqueId>;
GetAllItems(items);
GiveItemsTo(otherInventory, items, forceTransferNoDrops, informG
UI);
/* NOP */;
}
public final function GiveItemsTo(otherInventory : CInventoryComponent,
items : array<SItemUniqueId>, forceTransferNoDrops : Bool, informGUI : Bool) : a
rray<SItemUniqueId>{
var i : Int32;
var ret : array<SItemUniqueId>;
i = 0;
while (i < items.Size()){
ret.PushBack(GiveItemTo(otherInventory, items[i], GetIte
mQuantity(items[i]), true, forceTransferNoDrops, informGUI));
i += 1;
}
return ret;
/* NOP */;
}

public final function HasItemById(id : SItemUniqueId) : Bool{


var arr : array<SItemUniqueId>;
GetAllItems(arr);
return arr.Contains(id);
/* NOP */;
}
public function HasItemByTag(tag : CName) : Bool{
var temp : array<SItemUniqueId>;
temp = super.GetItemsByTag(tag);
return temp.Size() > 0;
/* NOP */;
}
public function HasInfiniteBolts() : Bool{
var ids : array<SItemUniqueId>;
var i : Int32;
ids = super.GetItemsByTag(theGame.params.TAG_INFINITE_AMMO);
i = 0;
while (i < ids.Size()){
if (super.IsItemBolt(ids[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function HasGroundBolts() : Bool{
var ids : array<SItemUniqueId>;
var i : Int32;
ids = super.GetItemsByTag(theGame.params.TAG_GROUND_AMMO);
i = 0;
while (i < ids.Size()){
if (super.IsItemBolt(ids[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function HasUnderwaterBolts() : Bool{
var ids : array<SItemUniqueId>;
var i : Int32;
ids = super.GetItemsByTag(theGame.params.TAG_UNDERWATER_AMMO);
i = 0;
while (i < ids.Size()){
if (super.IsItemBolt(ids[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public final function AddAnItem(item : CName, quantity : Int32, dontInfo
rmGui : Bool, dontMarkAsNew : Bool, showAsRewardInUIHax : Bool) : array<SItemUni
queId>{
var arr : array<SItemUniqueId>;
var i : Int32;
var isReadableItem : Bool;

if (theGame.GetDefinitionsManager().IsItemSingletonItem(item) &&
GetEntity() == thePlayer){
if (GetItemQuantityByName(item, /* NOP */) > 0){
arr = GetItemsIds(item);
} else {
arr.PushBack(AddSingleItem(item, !dontInformGui,
!dontMarkAsNew, /* NOP */));
}
quantity = 1;
} else if (quantity < 2){
arr.PushBack(AddSingleItem(item, !dontInformGui, !dontMa
rkAsNew, /* NOP */));
} else {
arr = AddMultiItem(item, quantity, !dontInformGui, !dont
MarkAsNew, /* NOP */);
}
if (this == thePlayer.GetInventory()){
if (ItemHasTag(arr[0], 'ReadableItem')){
UpdateInitialReadState(arr[0]);
}
if (showAsRewardInUIHax || ItemHasTag(arr[0], 'GwintCard
')){
thePlayer.DisplayItemRewardNotification(GetItemN
ame(arr[0]), quantity);
}
}
return arr;
/* NOP */;
}
private final function InternalRemoveItems(ids : array<SItemUniqueId>, q
uantity : Int32){
var i : Int32;
var currQuantityToTake : Int32;
i = 0;
while (i < ids.Size()){
currQuantityToTake = Min(quantity, GetItemQuantity(ids[i
]));
if (GetEntity() == thePlayer){
GetWitcherPlayer().RemoveGwentCard(GetItemName(i
ds[i]), currQuantityToTake);
}
RemoveItem(ids[i], currQuantityToTake);
quantity -= currQuantityToTake;
if (quantity == 0){
return;
}
LogAssert(quantity > 0, "CInventoryComponent.InternalRem
oveItems(" + GetItemName(ids[i]) + "): somehow took too many items! Should be "
+ -quantity + " less... Investigate!");
i += 1;
}
/* NOP */;
}
public function RemoveItemByName(itemName : CName, quantity : Int32) : B
ool{
var totalItemCount : Int32;
var ids : array<SItemUniqueId>;
totalItemCount = super.GetItemQuantityByName(itemName, /* NOP */
);
if (totalItemCount < quantity || quantity == 0){

return false;
}
if (quantity == 0){
quantity = 1;
} else if (quantity < 0){
quantity = totalItemCount;
}
ids = GetItemsIds(itemName);
if (GetEntity() == thePlayer && thePlayer.GetSelectedItemId() ==
ids[0]){
thePlayer.ClearSelectedItemId();
}
super.InternalRemoveItems(ids, quantity);
return true;
/* NOP */;
}
public function RemoveItemByCategory(itemCategory : CName, quantity : In
t32) : Bool{
var totalItemCount : Int32;
var ids : array<SItemUniqueId>;
var selectedItemId : SItemUniqueId;
var i : Int32;
totalItemCount = super.GetItemQuantityByCategory(itemCategory, /
* NOP */);
if (totalItemCount < quantity){
return false;
}
if (quantity == 0){
quantity = 1;
} else if (quantity < 0){
quantity = totalItemCount;
}
ids = super.GetItemsByCategory(itemCategory);
if (GetEntity() == thePlayer){
selectedItemId = thePlayer.GetSelectedItemId();
i = 0;
while (i < ids.Size()){
if (selectedItemId == ids[i]){
thePlayer.ClearSelectedItemId();
break;
}
i += 1;
}
}
super.InternalRemoveItems(ids, quantity);
return true;
/* NOP */;
}
public function RemoveItemByTag(itemTag : CName, quantity : Int32) : Boo
l{
var totalItemCount : Int32;
var ids : array<SItemUniqueId>;
var i : Int32;
var selectedItemId : SItemUniqueId;
totalItemCount = super.GetItemQuantityByTag(itemTag, /* NOP */);
if (totalItemCount < quantity){
return false;
}
if (quantity == 0){
quantity = 1;

} else if (quantity < 0){


quantity = totalItemCount;
}
ids = super.GetItemsByTag(itemTag);
if (GetEntity() == thePlayer){
selectedItemId = thePlayer.GetSelectedItemId();
i = 0;
while (i < ids.Size()){
if (selectedItemId == ids[i]){
thePlayer.ClearSelectedItemId();
break;
}
i += 1;
}
}
super.InternalRemoveItems(ids, quantity);
return true;
/* NOP */;
}
public final function HasQuestItem() : Bool{
var allItems : array<SItemUniqueId>;
var i : Int32;
allItems = GetItemsByTag('Quest');
i = 0;
while (i < allItems.Size()){
if (!ItemHasTag(allItems[i], theGame.params.TAG_DONT_SHO
W)){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function SetItemDurabilityScript(itemId : SItemUniqueId, durabili
ty : Float){
var oldDur : Float;
oldDur = super.GetItemDurability(itemId);
if (oldDur == durability){
return;
}
if (durability < oldDur){
if (ItemHasAbility(itemId, 'MA_Indestructible')){
return;
}
if (GetEntity() == thePlayer && ShouldProcessTutorial('T
utorialDurability')){
if (durability <= theGame.params.ITEM_DAMAGED_DU
RABILITY && oldDur > theGame.params.ITEM_DAMAGED_DURABILITY){
FactsAdd("tut_item_damaged", 1, /* NOP *
/);
}
}
}
super.SetItemDurability(itemId, durability);
/* NOP */;
}
public function ReduceItemDurability(itemId : SItemUniqueId, forced : Bo
ol) : Bool{
var dur : Float;

var value : Float;


var durabilityDiff : Float;
var itemToughness : Float;
var chance : Int32;
if (!super.IsIdValid(itemId) || !super.HasItemDurability(itemId)
|| ItemHasAbility(itemId, 'MA_Indestructible') || super.ItemHasTag(itemId, 'Sec
ondaryWeapon')){
return false;
}
if (super.IsItemWeapon(itemId)){
chance = theGame.params.DURABILITY_WEAPON_LOSE_CHANCE;
value = theGame.params.GetWeaponDurabilityLoseValue();
} else if (super.IsItemAnyArmor(itemId)){
chance = theGame.params.DURABILITY_ARMOR_LOSE_CHANCE;
value = theGame.params.DURABILITY_ARMOR_LOSE_VALUE;
}
dur = super.GetItemDurability(itemId);
if (dur == 0){
return false;
}
if (forced || RandRange(100, /* NOP */) < chance){
itemToughness = CalculateAttributeValue(super.GetItemAtt
ributeValue(itemId, 'toughness', /* NOP */, /* NOP */), /* NOP */);
if (itemToughness > 0.000000 && itemToughness <= 1.00000
0){
durabilityDiff = dur - value * itemToughness;
SetItemDurabilityScript(itemId, MaxF(durabilityD
iff, 0));
} else {
SetItemDurabilityScript(itemId, MaxF(dur - value
, 0));
}
}
return true;
/* NOP */;
}
public function GetItemDurabilityRatio(itemId : SItemUniqueId) : Float{
if (!super.IsIdValid(itemId) || !super.HasItemDurability(itemId)
){
return -1;
}
return super.GetItemDurability(itemId) / super.GetItemMaxDurabil
ity(itemId);
/* NOP */;
}
public function GetItemResistStatWithDurabilityModifiers(itemId : SItemU
niqueId, stat : ECharacterDefenseStats, points : SAbilityAttributeValue, percent
s : SAbilityAttributeValue){
var mult : Float;
var null : SAbilityAttributeValue;
points = null;
percents = null;
if (!super.IsItemAnyArmor(itemId)){
return;
}
mult = theGame.params.GetDurabilityMultiplier(GetItemDurabilityR
atio(itemId), false);
points = super.GetItemAttributeValue(itemId, ResistStatEnumToNam
e(stat, true), /* NOP */, /* NOP */);
percents = super.GetItemAttributeValue(itemId, ResistStatEnumToN

ame(stat, false), /* NOP */, /* NOP */);


points = points * mult;
percents = percents * mult;
/* NOP */;
}
public function GetItemResistanceTypes(id : SItemUniqueId) : array<EChar
acterDefenseStats>{
var ret : array<ECharacterDefenseStats>;
var i : Int32;
var stat : ECharacterDefenseStats;
var atts : array<CName>;
var tmpBool : Bool;
if (!super.IsIdValid(id)){
return ret;
}
super.GetItemAttributes(id, atts);
i = 0;
while (i < atts.Size()){
stat = ResistStatNameToEnum(atts[i], tmpBool);
if (stat != 0 && !ret.Contains(stat)){
ret.PushBack(stat);
}
i += 1;
}
return ret;
/* NOP */;
}
public function Created(){
LoadBooksDefinitions();
/* NOP */;
}
public function ClearGwintCards(){
var attr : SAbilityAttributeValue;
var allItems : array<SItemUniqueId>;
var card : array<SItemUniqueId>;
var iHave : Int32;
var shopHave : Int32;
var i : Int32;
allItems = super.GetItemsByCategory('gwint');
i = allItems.Size() - 1;
while (i >= 0){
attr = super.GetItemAttributeValue(allItems[i], 'max_cou
nt', /* NOP */, /* NOP */);
card = thePlayer.GetInventory().GetItemsByName(super.Get
ItemName(allItems[i]));
iHave = thePlayer.GetInventory().GetItemQuantity(card[0]
);
shopHave = RoundF(attr.valueBase);
if (iHave >= shopHave){
super.RemoveItem(allItems[i], super.GetItemQuant
ity(allItems[i]));
}
i -= 1;
}
/* NOP */;
}
public function ClearTHmaps(){
var attr : SAbilityAttributeValue;
var allItems : array<SItemUniqueId>;
var map : array<SItemUniqueId>;

var i : Int32;
var thCompleted : Bool;
var iHave : Int32;
var shopHave : Int32;
allItems = super.GetItemsByTag('ThMap');
i = allItems.Size() - 1;
while (i >= 0){
attr = super.GetItemAttributeValue(allItems[i], 'max_cou
nt', /* NOP */, /* NOP */);
map = thePlayer.GetInventory().GetItemsByName(super.GetI
temName(allItems[i]));
thCompleted = FactsDoesExist(super.GetItemName(allItems[
i]));
iHave = thePlayer.GetInventory().GetItemQuantity(map[0])
;
shopHave = RoundF(attr.valueBase);
if (iHave >= shopHave || thCompleted){
super.RemoveItem(allItems[i], super.GetItemQuant
ity(allItems[i]));
}
i -= 1;
}
/* NOP */;
}
public final function ClearKnownRecipes(){
var witcher : W3PlayerWitcher;
var recipes : array<CName>;
var craftRecipes : array<CName>;
var i : Int32;
var itemName : CName;
var allItems : array<SItemUniqueId>;
witcher = GetWitcherPlayer();
if (!witcher){
return;
}
recipes = witcher.GetAlchemyRecipes();
craftRecipes = witcher.GetCraftingSchematicsNames();
ArrayOfNamesAppend(recipes, craftRecipes);
GetAllItems(allItems);
i = allItems.Size() - 1;
while (i >= 0){
itemName = GetItemName(allItems[i]);
if (recipes.Contains(itemName)){
RemoveItem(allItems[i], GetItemQuantity(allItems
[i]));
}
i -= 1;
}
/* NOP */;
}
public function LoadBooksDefinitions(){
var readableArray : array<SItemUniqueId>;
var i : Int32;
readableArray = super.GetItemsByTag('ReadableItem');
i = 0;
while (i < readableArray.Size()){
if (IsBookRead(readableArray[i])){
} else {
UpdateInitialReadState(readableArray[i]);
}

i += 1;
}
/* NOP */;
}
public function UpdateInitialReadState(item : SItemUniqueId){
var abilitiesArray : array<CName>;
var i : Int32;
super.GetItemAbilities(item, abilitiesArray);
i = 0;
while (i < abilitiesArray.Size()){
if (abilitiesArray[i] == 'WasRead'){
ReadBook(item);
break;
}
i += 1;
}
/* NOP */;
}
public function IsBookRead(item : SItemUniqueId) : Bool{
var bookName : CName;
var bResult : Bool;
bookName = super.GetItemName(item);
bResult = IsBookReadByName(bookName);
return bResult;
/* NOP */;
}
public function IsBookReadByName(bookName : CName) : Bool{
var bookFactName : String;
bookFactName = GetBookReadFactName(bookName);
if (FactsDoesExist(bookFactName)){
return FactsQuerySum(bookFactName);
}
return false;
/* NOP */;
}
public function ReadBook(item : SItemUniqueId){
var bookName : CName;
var abilitiesArray : array<CName>;
var i : Int32;
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
bookName = super.GetItemName(item);
if (!IsBookRead(item) && super.ItemHasTag(item, 'FastTravel')){
super.GetItemAbilities(item, abilitiesArray);
i = 0;
while (i < abilitiesArray.Size()){
commonMapManager.SetEntityMapPinDiscoveredScript
(true, abilitiesArray[i], true);
i += 1;
}
}
ReadBookByNameId(bookName, item, false);
if (super.ItemHasTag(item, 'PerkBook')){
}
/* NOP */;
}
public function GetBookText(item : SItemUniqueId) : String{
return ReplaceTagsToIcons(GetLocStringByKeyExt(super.GetItemLoca
lizedNameByUniqueID(item) + "_text"));
/* NOP */;

}
public function ReadSchematicsAndRecipes(item : SItemUniqueId){
var itemCategory : CName;
var itemName : CName;
var player : W3PlayerWitcher;
ReadBook(item);
player = GetWitcherPlayer();
if (!player){
return;
}
itemName = super.GetItemName(item);
itemCategory = super.GetItemCategory(item);
if (itemCategory == 'alchemy_recipe'){
if (player.CanLearnAlchemyRecipe(itemName)){
player.AddAlchemyRecipe(itemName, /* NOP */, /*
NOP */);
player.GetInventory().AddItemTag(item, 'NoShow')
;
}
} else if (itemCategory == 'crafting_schematic'){
player.AddCraftingSchematic(itemName, /* NOP */, /* NOP
*/);
player.GetInventory().AddItemTag(item, 'NoShow');
}
/* NOP */;
}
public function ReadBookByName(bookName : CName, unread : Bool){
var bookFactName : String;
if (IsBookReadByName(bookName) != unread){
return;
}
bookFactName = "BookReadState_" + bookName;
bookFactName = StrReplace(bookFactName, " ", "_");
if (unread){
FactsSubstract(bookFactName, 1);
} else {
FactsAdd(bookFactName, 1, /* NOP */);
if (!IsAlchemyRecipe(bookName) && !IsCraftingSchematic(b
ookName)){
theGame.GetGamerProfile().IncStat(12);
}
if (AddBestiaryFromBook(bookName)){
return;
}
}
/* NOP */;
}
public function ReadBookByNameId(bookName : CName, itemId : SItemUniqueI
d, unread : Bool){
var bookFactName : String;
if (IsBookReadByName(bookName) != unread){
return;
}
bookFactName = "BookReadState_" + bookName;
bookFactName = StrReplace(bookFactName, " ", "_");
if (unread){
FactsSubstract(bookFactName, 1);
} else {
FactsAdd(bookFactName, 1, /* NOP */);
if (!IsAlchemyRecipe(bookName) && !IsCraftingSchematic(b

ookName)){
theGame.GetGamerProfile().IncStat(12);
}
if (AddBestiaryFromBook(bookName)){
return;
} else {
ReadSchematicsAndRecipes(itemId);
}
}
/* NOP */;
}
private function AddBestiaryFromBook(bookName : CName) : Bool{
var i : Int32;
var j : Int32;
var r : Int32;
var manager : CWitcherJournalManager;
var resource : array<CJournalResource>;
var entryBase : CJournalBase;
var childGroups : array<CJournalBase>;
var childEntries : array<CJournalBase>;
var descriptionGroup : CJournalCreatureDescriptionGroup;
var descriptionEntry : CJournalCreatureDescriptionEntry;
manager = theGame.GetJournalManager();
switch(bookName){
case 'Beasts vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryWolf", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryDog", /* NOP */));
break;
case 'Beasts vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryBear", /* NOP */));
break;
case 'Cursed Monsters vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryWerewolf", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryLycanthrope", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
24', /* NOP */, /* NOP */);
break;
case 'Cursed Monsters vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryWerebear", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryMiscreant", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
11', /* NOP */, /* NOP */);
break;
case 'Draconides vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryCockatrice", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryBasilisk", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
3', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
23', /* NOP */, /* NOP */);
break;

case 'Draconides vol 2':


resource.PushBack((CJournalResource)LoadResource("Bestia
ryWyvern", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryForktail", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
10', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
17', /* NOP */, /* NOP */);
break;
case 'Hybrid Monsters vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryHarpy", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryErynia", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
rySiren", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
rySuccubus", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
14', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
21', /* NOP */, /* NOP */);
break;
case 'Hybrid Monsters vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryGriffin", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
4', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
27', /* NOP */, /* NOP */);
break;
case 'Insectoids vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryEndriagaWorker", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryEndriagaTruten", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryEndriaga", /* NOP */));
break;
case 'Insectoids vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryCrabSpider", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryArmoredArachas", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryPoisonousArachas", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
2', /* NOP */, /* NOP */);
break;
case 'Magical Monsters vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryGolem", /* NOP */));
break;
case 'Magical Monsters vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryElemental", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryIceGolem", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia

ryFireElemental", /* NOP */));


resource.PushBack((CJournalResource)LoadResource("Bestia
ryWhMinion", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
20', /* NOP */, /* NOP */);
break;
case 'Necrophage vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryGhoul", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryAlghoul", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryGreaterRotFiend", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryDrowner", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
15', /* NOP */, /* NOP */);
break;
case 'Necrophage vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryGraveHag", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryWaterHag", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryFogling", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
5', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
9', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
18', /* NOP */, /* NOP */);
break;
case 'Relict Monsters vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryBies", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryCzart", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
8', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
16', /* NOP */, /* NOP */);
break;
case 'Relict Monsters vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryLeshy", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
rySilvan", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
22', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
26', /* NOP */, /* NOP */);
break;
case 'Specters vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryMoonwright", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryNoonwright", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryPesta", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen

6', /* NOP */, /* NOP */);


GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
13', /* NOP */, /* NOP */);
break;
case 'Specters vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryWraith", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryHim", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
19', /* NOP */, /* NOP */);
break;
case 'Ogres vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryNekker", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryIceTroll", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryCaveTroll", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
12', /* NOP */, /* NOP */);
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
25', /* NOP */, /* NOP */);
break;
case 'Ogres vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryCyclop", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryIceGiant", /* NOP */));
break;
case 'Vampires vol 1':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryEkkima", /* NOP */));
resource.PushBack((CJournalResource)LoadResource("Bestia
ryHigherVampire", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
7', /* NOP */, /* NOP */);
break;
case 'Vampires vol 2':
resource.PushBack((CJournalResource)LoadResource("Bestia
ryKatakan", /* NOP */));
GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen
1', /* NOP */, /* NOP */);
break;
default:
return false;
}
r = 0;
while (r < resource.Size()){
if (!resource[r]){
} else {
entryBase = resource[r].GetEntry();
if (entryBase){
manager.ActivateEntry(entryBase, 1, /* N
OP */, /* NOP */);
manager.SetEntryHasAdvancedInfo(entryBas
e, true);
theGame.GetGuiManager().ShowNotification
(GetLocStringByKeyExt("panel_hud_journal_entry_bestiary_new"), /* NOP */);
theSound.SoundEvent("gui_ingame_new_jour

nal");
manager.GetAllChildren(entryBase, childG
roups);
i = 0;
while (i < childGroups.Size()){
descriptionGroup = (CJournalCrea
tureDescriptionGroup)childGroups[i];
if (descriptionGroup){
manager.GetAllChildren(d
escriptionGroup, childEntries);
j = 0;
while (j < childEntries.
Size()){
descriptionEntry
= (CJournalCreatureDescriptionEntry)childEntries[j];
if (descriptionE
ntry){
manager.
ActivateEntry(descriptionEntry, 1, /* NOP */, /* NOP */);
}
j += 1;
}
break;
}
i += 1;
}
}
}
r += 1;
}
if (resource.Size() > 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function GetWeaponDTNames(id : SItemUniqueId, dmgNames : array<CN
ame>) : Int32{
var attrs : array<CName>;
var i : Int32;
var size : Int32;
dmgNames.Clear();
if (super.IsIdValid(id)){
super.GetItemAttributes(id, attrs);
size = attrs.Size();
i = 0;
while (i < size){
if (IsDamageTypeNameValid(attrs[i])){
dmgNames.PushBack(attrs[i]);
}
i += 1;
}
if (dmgNames.Size() == 0){
LogAssert(false, "CInventoryComponent.GetWeaponD
TNames: weapon <<" + super.GetItemName(id) + ">> has no damage types defined!");
}
}
return dmgNames.Size();
/* NOP */;

}
public function GetWeapons() : array<SItemUniqueId>{
var ids : array<SItemUniqueId>;
var ids2 : array<SItemUniqueId>;
ids = super.GetItemsByCategory('monster_weapon');
ids2 = super.GetItemsByTag('Weapon');
ArrayOfIdsAppend(ids, ids2);
return ids;
/* NOP */;
}
public function GetHeldWeapons() : array<SItemUniqueId>{
var i : Int32;
var w : array<SItemUniqueId>;
w = GetWeapons();
i = w.Size() - 1;
while (i >= 0){
if (!super.IsItemHeld(w[i])){
w.EraseFast(i);
}
i -= 1;
}
return w;
/* NOP */;
}
public function GetHeldWeaponsWithCategory(category : CName, items : arr
ay<SItemUniqueId>){
var i : Int32;
items = super.GetItemsByCategory(category);
i = items.Size() - 1;
while (i >= 0){
if (!super.IsItemHeld(items[i])){
items.EraseFast(i);
}
i -= 1;
}
/* NOP */;
}
public function GetPotionItemBuffData(id : SItemUniqueId, type : EEffect
Type, customAbilityName : CName) : Bool{
var size : Int32;
var i : Int32;
var arr : array<CName>;
if (super.IsIdValid(id)){
super.GetItemContainedAbilities(id, arr);
size = arr.Size();
i = 0;
while (i < size){
if (IsEffectNameValid(arr[i])){
EffectNameToType(arr[i], type, customAbi
lityName);
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
public function RecycleItem(id : SItemUniqueId, level : ECraftsmanLevel)
: array<SItemUniqueId>{

var itemsAdded : array<SItemUniqueId>;


var currentAdded : array<SItemUniqueId>;
var parts : array<SItemParts>;
var i : Int32;
parts = super.GetItemRecyclingParts(id);
i = 0;
while (i < parts.Size()){
if (3 == level){
currentAdded = super.AddAnItem(parts[i].itemName
, parts[i].quantity, /* NOP */, /* NOP */, /* NOP */);
} else if (2 == level && parts[i].quantity > 1){
currentAdded = super.AddAnItem(parts[i].itemName
, RandRange(parts[i].quantity, 1), /* NOP */, /* NOP */, /* NOP */);
} else {
currentAdded = super.AddAnItem(parts[i].itemName
, 1, /* NOP */, /* NOP */, /* NOP */);
}
itemsAdded.PushBack(currentAdded[0]);
i += 1;
}
super.RemoveItem(id, /* NOP */);
return itemsAdded;
/* NOP */;
}
public function GetItemBuffs(id : SItemUniqueId, buffs : array<SEffectIn
fo>) : Int32{
var attrs : array<CName>;
var abs : array<CName>;
var absFast : array<CName>;
var i : Int32;
var k : Int32;
var type : EEffectType;
var abilityName : CName;
var buff : SEffectInfo;
var dm : CDefinitionsManagerAccessor;
buffs.Clear();
if (!super.IsIdValid(id)){
return 0;
}
super.GetItemContainedAbilities(id, absFast);
if (absFast.Size() == 0){
return 0;
}
super.GetItemAbilities(id, abs);
dm = theGame.GetDefinitionsManager();
k = 0;
while (k < abs.Size()){
dm.GetContainedAbilities(abs[k], attrs);
buff.applyChance = CalculateAttributeValue(super.GetItem
AbilityAttributeValue(id, 'buff_apply_chance', abs[k]), /* NOP */) * ArrayOfName
sCount(abs, abs[k]);
i = 0;
while (i < attrs.Size()){
if (IsEffectNameValid(attrs[i])){
EffectNameToType(attrs[i], type, ability
Name);
buff.effectType = type;
buff.effectAbilityName = abilityName;
buffs.PushBack(buff);
if (absFast.Size() == 1){

return buffs.Size();
} else {
absFast.EraseFast(0);
}
}
i += 1;
}
k += 1;
}
return buffs.Size();
/* NOP */;
}
public function DropItemInBag(item : SItemUniqueId, quantity : Int32){
var entities : array<CGameplayEntity>;
var i : Int32;
var owner : CActor;
var bag : W3ActorRemains;
var template : CEntityTemplate;
var tabbags : array<CName>;
if (super.ItemHasTag(item, 'NoDrop')){
return;
}
owner = (CActor)GetEntity();
FindGameplayEntitiesInRange(entities, owner, 0.500000, 100, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < entities.Size()){
bag = (W3ActorRemains)entities[i];
if (bag){
break;
}
i += 1;
}
if (!bag){
template = (CEntityTemplate)LoadResource("lootbag", /* N
OP */);
tabbags.PushBack('lootbag');
bag = (W3ActorRemains)theGame.CreateEntity(template, own
er.GetWorldPosition(), owner.GetWorldRotation(), true, false, false, 2, tabbags)
;
}
super.GiveItemTo(bag.GetInventory(), item, quantity, false, /* N
OP */, /* NOP */);
if (bag.GetInventory().IsEmpty(/* NOP */)){
delete bag;
return;
}
bag.LootDropped(/* NOP */);
theTelemetry.LogWithLabelAndValue(32, super.GetItemName(item), q
uantity);
if (thePlayer.IsSwimming()){
bag.PlayPropertyAnimation('float', 0, /* NOP */, /* NOP
*/);
}
/* NOP */;
}
public final function AddRepairObjectItemBonuses(buffArmor : Bool, buffS
words : Bool, ammoArmor : Int32, ammoWeapon : Int32) : Bool{
var upgradedSomething : Bool;
var isArmor : Bool;

var i : Int32;
var ammo : Int32;
var currAmmo : Int32;
var items : array<SItemUniqueId>;
var items2 : array<SItemUniqueId>;
if (buffArmor){
items = GetItemsByTag(theGame.params.TAG_ARMOR);
}
if (buffSwords){
items2 = GetItemsByTag(theGame.params.TAG_PLAYER_STEELSW
ORD);
ArrayOfIdsAppend(items, items2);
items2.Clear();
items2 = GetItemsByTag(theGame.params.TAG_PLAYER_SILVERS
WORD);
ArrayOfIdsAppend(items, items2);
}
upgradedSomething = false;
i = 0;
while (i < items.Size()){
if (IsItemAnyArmor(items[i])){
isArmor = true;
ammo = ammoArmor;
} else {
isArmor = false;
ammo = ammoWeapon;
}
currAmmo = GetItemModifierInt(items[i], 'repairObjectBon
usAmmo', 0);
if (ammo > currAmmo){
SetItemModifierInt(items[i], 'repairObjectBonusA
mmo', ammo);
upgradedSomething = true;
if (currAmmo == 0){
if (isArmor){
AddItemCraftedAbility(items[i],
theGame.params.REPAIR_OBJECT_BONUS_ARMOR_ABILITY, false);
} else {
AddItemCraftedAbility(items[i],
theGame.params.REPAIR_OBJECT_BONUS_WEAPON_ABILITY, false);
}
}
}
i += 1;
}
return upgradedSomething;
/* NOP */;
}
public final function ReduceItemRepairObjectBonusCharge(item : SItemUniq
ueId){
var currAmmo : Int32;
currAmmo = GetItemModifierInt(item, 'repairObjectBonusAmmo', 0);
if (currAmmo > 0){
SetItemModifierInt(item, 'repairObjectBonusAmmo', currAm
mo - 1);
if (currAmmo == 1){
if (IsItemAnyArmor(item)){
RemoveItemCraftedAbility(item, theGame.p
arams.REPAIR_OBJECT_BONUS_ARMOR_ABILITY);
} else {

RemoveItemCraftedAbility(item, theGame.p
arams.REPAIR_OBJECT_BONUS_WEAPON_ABILITY);
}
}
}
/* NOP */;
}
public final function GetRepairObjectBonusValueForArmor(armor : SItemUni
queId) : SAbilityAttributeValue{
var retVal : SAbilityAttributeValue;
var bonusValue : SAbilityAttributeValue;
var baseArmor : SAbilityAttributeValue;
if (GetItemModifierInt(armor, 'repairObjectBonusAmmo', 0) > 0){
bonusValue = GetItemAttributeValue(armor, theGame.params
.REPAIR_OBJECT_BONUS, /* NOP */, /* NOP */);
baseArmor = GetItemAttributeValue(armor, theGame.params.
ARMOR_VALUE_NAME, /* NOP */, /* NOP */);
baseArmor.valueMultiplicative += 1;
retVal.valueAdditive = bonusValue.valueAdditive + Calcul
ateAttributeValue(baseArmor, /* NOP */) * bonusValue.valueMultiplicative;
}
return retVal;
/* NOP */;
}
public function CanItemHaveOil(id : SItemUniqueId) : Bool{
return super.IsItemSteelSwordUsableByPlayer(id) || super.IsItemS
ilverSwordUsableByPlayer(id);
/* NOP */;
}
public function ItemHasOilApplied(id : SItemUniqueId) : Bool{
var dm : CDefinitionsManagerAccessor;
var i : Int32;
var abs : array<CName>;
super.GetItemAbilities(id, abs);
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < abs.Size()){
if (dm.AbilityHasTag(abs[i], theGame.params.OIL_ABILITY_
TAG)){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetSwordOil(sword : SItemUniqueId) : CName{
var i : Int32;
var tempI : Int32;
var tempAF : array<Float>;
var dm : CDefinitionsManagerAccessor;
var oilAbility : CName;
var isSteelSword : Bool;
var itemCategory : CName;
var swordAbilities : array<CName>;
var oilAbs : array<CName>;
var items : array<CName>;
if (!super.IsIdValid(sword)){
return 'None';
}

itemCategory = super.GetItemCategory(sword);
if (itemCategory == 'steelsword'){
isSteelSword = true;
} else if (itemCategory == 'silversword'){
isSteelSword = false;
} else {
return 'None';
}
super.GetItemAbilities(sword, swordAbilities);
dm = theGame.GetDefinitionsManager();
oilAbility = 'None';
i = 0;
while (i < swordAbilities.Size()){
if (dm.AbilityHasTag(swordAbilities[i], theGame.params.O
IL_ABILITY_TAG)){
oilAbility = swordAbilities[i];
break;
}
i += 1;
}
if (!IsNameValid(oilAbility)){
return 'None';
}
if (isSteelSword){
items = dm.GetItemsWithTag('SteelOil');
} else {
items = dm.GetItemsWithTag('SilverOil');
}
i = 0;
while (i < items.Size()){
dm.GetItemAbilitiesWithWeights(items[i], GetEntity() ==
thePlayer, oilAbs, tempAF, tempI, tempI);
if (oilAbs.Contains(oilAbility)){
return items[i];
}
i += 1;
}
LogAssert(false, "W3PlayerWitcher.GetOilAppliedOnSword: sword ha
s some oil but this oil is not defined in XMLs!");
return 'None';
/* NOP */;
}
public function GetItemRelativeTooltipType(id : SItemUniqueId, invOther
: CInventoryComponent, idOther : SItemUniqueId) : ECompareType{
if (super.GetItemCategory(id) == invOther.GetItemCategory(idOthe
r) || super.ItemHasTag(id, 'PlayerSteelWeapon') && invOther.ItemHasTag(idOther,
'PlayerSteelWeapon') || super.ItemHasTag(id, 'PlayerSilverWeapon') && invOther.I
temHasTag(idOther, 'PlayerSilverWeapon') || super.ItemHasTag(id, 'PlayerSecondar
yWeapon') && invOther.ItemHasTag(idOther, 'PlayerSecondaryWeapon')){
return 1;
}
return 0;
/* NOP */;
}
private function FormatFloatForTooltip(fValue : Float) : String{
var valueInt : Int32;
var valueDec : Int32;
var strValue : String;
if (fValue < 0){
valueInt = CeilF(fValue);

valueDec = RoundMath(fValue - valueInt * -100);


} else {
valueInt = FloorF(fValue);
valueDec = RoundMath(fValue - valueInt * 100);
}
strValue = valueInt + ".";
if (valueDec < 10){
strValue += "0" + valueDec;
} else {
strValue += "" + valueDec;
}
return strValue;
/* NOP */;
}
public function SetPriceMultiplier(mult : Float){
priceMult = mult;
/* NOP */;
}
public function GetMerchantPriceModifier(shopNPC : CNewNPC, item : SItem
UniqueId) : Float{
var areaPriceMult : Float;
var itemPriceMult : Float;
var importPriceMult : Float;
var finalPriceMult : Float;
var tag : CName;
var zoneName : EZoneName;
zoneName = theGame.GetCurrentZone();
switch(zoneName){
case 1:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('crow_perch_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 2:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('spitfire_bluff_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 3:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('the_mire_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 4:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('mudplough_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 5:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('grayrocks_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 6:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('the_descent_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 7:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('crookback_bog_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 8:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('bald_mountain_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 9:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('novigrad_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 10:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('homestead_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 11:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt

ributeValue('gustfields_price_mult', /* NOP */, /* NOP */), /* NOP */);


case 12:
areaPriceMult = CalculateAttributeValue(thePlayer.GetAtt
ributeValue('oxenfurt_price_mult', /* NOP */, /* NOP */), /* NOP */);
case 0:
areaPriceMult = 1;
}
if (super.ItemHasTag(item, 'weapon')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('weapon_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'armor')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('armor_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'crafting')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('crafting_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'alchemy')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('alchemy_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'alcohol')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('alcohol_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'food')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('food_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'fish')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('fish_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'books')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('books_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'valuables')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('valuables_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'junk')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('junk_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'orens')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('orens_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'florens')){
itemPriceMult = CalculateAttributeValue(shopNPC.GetAttri
buteValue('florens_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else {
itemPriceMult = 1;
}
if (super.ItemHasTag(item, 'novigrad')){
importPriceMult = CalculateAttributeValue(shopNPC.GetAtt
ributeValue('novigrad_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'nilfgard')){
importPriceMult = CalculateAttributeValue(shopNPC.GetAtt
ributeValue('nilfgard_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'nomansland')){
importPriceMult = CalculateAttributeValue(shopNPC.GetAtt
ributeValue('nomansland_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'skellige')){
importPriceMult = CalculateAttributeValue(shopNPC.GetAtt
ributeValue('skellige_price_mult', /* NOP */, /* NOP */), /* NOP */);
} else if (super.ItemHasTag(item, 'nonhuman')){
importPriceMult = CalculateAttributeValue(shopNPC.GetAtt

ributeValue('nonhuman_price_mult', /* NOP */, /* NOP */), /* NOP */);


} else {
importPriceMult = 1;
}
finalPriceMult = areaPriceMult * itemPriceMult * importPriceMult
* priceMult;
return finalPriceMult;
/* NOP */;
}
public function SetRepairPriceMultiplier(mult : Float){
priceRepairMult = mult;
/* NOP */;
}
public function GetRepairPriceModifier(repairNPC : CNewNPC) : Float{
return priceRepairMult;
/* NOP */;
}
public function GetRepairPrice(item : SItemUniqueId) : Float{
var currDiff : Float;
currDiff = super.GetItemMaxDurability(item) - super.GetItemDurab
ility(item);
return priceRepair * currDiff;
/* NOP */;
}
public function GetTooltipData(itemId : SItemUniqueId, localizedName : S
tring, localizedDescription : String, price : Int32, localizedCategory : String,
itemStats : array<SAttributeTooltip>, localizedFluff : String){
if (!super.IsIdValid(itemId)){
return;
}
localizedName = super.GetItemLocalizedNameByUniqueID(itemId);
localizedDescription = super.GetItemLocalizedDescriptionByUnique
ID(itemId);
localizedFluff = "IMPLEMENT ME - fluff text";
price = super.GetItemPriceModified(itemId, false);
localizedCategory = GetItemCategoryLocalisedString(super.GetItem
Category(itemId));
GetItemStats(itemId, itemStats);
/* NOP */;
}
public function GetItemBaseStats(itemId : SItemUniqueId, itemStats : arr
ay<SAttributeTooltip>){
var attributes : array<CName>;
var dm : CDefinitionsManagerAccessor;
var oilAbilities : array<CName>;
var oilAttributes : array<CName>;
var weights : array<Float>;
var i : Int32;
var j : Int32;
var idx : Int32;
var oilStatsCount : Int32;
var oilName : CName;
var oilStats : array<SAttributeTooltip>;
var oilStatFirst : SAttributeTooltip;
super.GetItemBaseAttributes(itemId, attributes);
oilName = GetSwordOil(itemId);
if (oilName != 'None'){
dm = theGame.GetDefinitionsManager();
dm.GetItemAbilitiesWithWeights(oilName, GetEntity() == t
hePlayer, oilAbilities, weights, i, j);

oilAttributes = dm.GetAbilitiesAttributes(oilAbilities);
oilStatsCount = oilAttributes.Size();
idx = 0;
while (idx < oilStatsCount){
attributes.Remove(oilAttributes[idx]);
idx += 1;
}
}
GetItemTooltipAttributes(itemId, attributes, itemStats);
/* NOP */;
}
public function GetItemStats(itemId : SItemUniqueId, itemStats : array<S
AttributeTooltip>){
var attributes : array<CName>;
super.GetItemAttributes(itemId, attributes);
GetItemTooltipAttributes(itemId, attributes, itemStats);
/* NOP */;
}
private function GetItemTooltipAttributes(itemId : SItemUniqueId, attrib
utes : array<CName>, itemStats : array<SAttributeTooltip>){
var itemCategory : CName;
var i : Int32;
var j : Int32;
var settingsSize : Int32;
var attributeString : String;
var attributeColor : String;
var attributeName : CName;
var isPercentageValue : String;
var primaryStatLabel : String;
var statLabel : String;
var stat : SAttributeTooltip;
var attributeVal : SAbilityAttributeValue;
settingsSize = theGame.tooltipSettings.GetNumRows();
itemStats.Clear();
itemCategory = super.GetItemCategory(itemId);
i = 0;
while (i < settingsSize){
attributeString = theGame.tooltipSettings.GetValueAt(0,
i);
if (StrLen(attributeString) <= 0){
} else {
attributeName = 'None';
j = 0;
while (j < attributes.Size()){
if (NameToString(attributes[j]) == attri
buteString){
attributeName = attributes[j];
break;
}
j += 1;
}
if (!IsNameValid(attributeName)){
} else if (itemCategory == 'silversword' && attr
ibuteName == 'SlashingDamage'){
} else if (itemCategory == 'steelsword' && attri
buteName == 'SilverDamage'){
} else {
attributeColor = theGame.tooltipSettings
.GetValueAt(1, i);
isPercentageValue = theGame.tooltipSetti

ngs.GetValueAt(2, i);
attributeVal = super.GetItemAttributeVal
ue(itemId, attributeName, /* NOP */, /* NOP */);
stat.attributeColor = attributeColor;
stat.percentageValue = isPercentageValue
;
stat.primaryStat = IsPrimaryStatById(ite
mId, attributeName, primaryStatLabel);
stat.value = 0;
stat.originName = attributeName;
if (attributeVal.valueBase != 0){
statLabel = GetAttributeNameLocS
tr(attributeName, false);
stat.value = attributeVal.valueB
ase;
}
if (attributeVal.valueMultiplicative !=
0){
statLabel = GetAttributeNameLocS
tr(attributeName, false);
stat.value = attributeVal.valueM
ultiplicative;
stat.percentageValue = true;
}
if (attributeVal.valueAdditive != 0){
statLabel = GetAttributeNameLocS
tr(attributeName, false);
stat.value = attributeVal.valueA
dditive;
}
if (stat.value != 0){
stat.attributeName = statLabel;
itemStats.PushBack(stat);
}
}
}
i += 1;
}
/* NOP */;
}
public function GetItemStatsFromName(itemName : CName, itemStats : array
<SAttributeTooltip>){
var itemCategory : CName;
var i : Int32;
var j : Int32;
var settingsSize : Int32;
var attributeString : String;
var attributeColor : String;
var attributeName : CName;
var isPercentageValue : String;
var attributes : array<CName>;
var itemAbilities : array<CName>;
var tmpArray : array<CName>;
var weights : array<Float>;
var stat : SAttributeTooltip;
var attributeVal : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
var primaryStatLabel : String;

var statLabel : String;


settingsSize = theGame.tooltipSettings.GetNumRows();
dm = theGame.GetDefinitionsManager();
dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlaye
r, itemAbilities, weights, i, j);
attributes = dm.GetAbilitiesAttributes(itemAbilities);
itemStats.Clear();
itemCategory = dm.GetItemCategory(itemName);
i = 0;
while (i < settingsSize){
attributeString = theGame.tooltipSettings.GetValueAt(0,
i);
if (StrLen(attributeString) <= 0){
} else {
attributeName = 'None';
j = 0;
while (j < attributes.Size()){
if (NameToString(attributes[j]) == attri
buteString){
attributeName = attributes[j];
break;
}
j += 1;
}
if (!IsNameValid(attributeName)){
} else if (itemCategory == 'silversword' && attr
ibuteName == 'SlashingDamage'){
} else if (itemCategory == 'steelsword' && attri
buteName == 'SilverDamage'){
} else {
attributeColor = theGame.tooltipSettings
.GetValueAt(1, i);
isPercentageValue = theGame.tooltipSetti
ngs.GetValueAt(2, i);
dm.GetAbilitiesAttributeValue(itemAbilit
ies, attributeName, min, max, /* NOP */);
attributeVal = GetAttributeRandomizedVal
ue(min, max);
stat.attributeColor = attributeColor;
stat.percentageValue = isPercentageValue
;
stat.primaryStat = IsPrimaryStat(itemCat
egory, attributeName, primaryStatLabel);
stat.value = 0;
stat.originName = attributeName;
if (attributeName == 'toxicity_offset'){
statLabel = GetAttributeNameLocS
tr('toxicity', false);
} else {
statLabel = GetAttributeNameLocS
tr(attributeName, false);
}
if (attributeVal.valueBase != 0){
stat.value = attributeVal.valueB
ase;
}
if (attributeVal.valueMultiplicative !=
0){
stat.value = attributeVal.valueM
ultiplicative;

stat.percentageValue = true;
}
if (attributeVal.valueAdditive != 0){
statLabel = GetAttributeNameLocS
tr(attributeName, false);
stat.value = stat.value + attrib
uteVal.valueAdditive;
}
if (stat.value != 0){
stat.attributeName = statLabel;
itemStats.PushBack(stat);
}
}
}
i += 1;
}
/* NOP */;
}
public function IsThereItemOnSlot(slot : EEquipmentSlots) : Bool{
var player : W3PlayerWitcher;
player = (W3PlayerWitcher)GetEntity();
if (player){
return player.IsAnyItemEquippedOnSlot(slot);
} else {
return false;
}
/* NOP */;
}
public function GetItemEquippedOnSlot(slot : EEquipmentSlots, item : SIt
emUniqueId) : Bool{
var player : W3PlayerWitcher;
player = (W3PlayerWitcher)GetEntity();
if (player){
return player.GetItemEquippedOnSlot(slot, item);
} else {
return false;
}
/* NOP */;
}
public function GetOilNameOnSword(steel : Bool) : CName{
var player : W3PlayerWitcher;
player = (W3PlayerWitcher)GetEntity();
if (player){
return player.GetOilAppliedOnSword(steel);
} else {
return 'None';
}
/* NOP */;
}
public function GetItemPrimaryStat(itemId : SItemUniqueId, attributeLabe
l : String, attributeVal : Float){
var attributeName : CName;
var attributeValue : SAbilityAttributeValue;
GetItemPrimaryStatImplById(itemId, attributeLabel, attributeVal,
attributeName);
attributeValue = super.GetItemAttributeValue(itemId, attributeNa
me, /* NOP */, /* NOP */);
if (attributeValue.valueBase != 0){
attributeVal = attributeValue.valueBase;
}

if (attributeValue.valueMultiplicative != 0){
attributeVal = attributeValue.valueMultiplicative;
}
if (attributeValue.valueAdditive != 0){
attributeVal = attributeValue.valueAdditive;
}
/* NOP */;
}
public function GetItemStatByName(itemName : CName, statName : CName, re
sultValue : Float){
var dm : CDefinitionsManagerAccessor;
var attributes : array<CName>;
var itemAbilities : array<CName>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var attributeValue : SAbilityAttributeValue;
var tmpInt : Int32;
var tmpArray : array<Float>;
dm = theGame.GetDefinitionsManager();
dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlaye
r, itemAbilities, tmpArray, tmpInt, tmpInt);
attributes = dm.GetAbilitiesAttributes(itemAbilities);
dm.GetAbilitiesAttributeValue(itemAbilities, statName, min, max,
/* NOP */);
attributeValue = GetAttributeRandomizedValue(min, max);
if (attributeValue.valueBase != 0){
resultValue = attributeValue.valueBase;
}
if (attributeValue.valueMultiplicative != 0){
resultValue = attributeValue.valueMultiplicative;
}
if (attributeValue.valueAdditive != 0){
resultValue = attributeValue.valueAdditive;
}
/* NOP */;
}
public function GetItemPrimaryStatFromName(itemName : CName, attributeLa
bel : String, attributeVal : Float, primAttrName : CName){
var dm : CDefinitionsManagerAccessor;
var attributeName : CName;
var attributes : array<CName>;
var itemAbilities : array<CName>;
var attributeValue : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var tmpInt : Int32;
var tmpArray : array<Float>;
dm = theGame.GetDefinitionsManager();
GetItemPrimaryStatImpl(dm.GetItemCategory(itemName), attributeLa
bel, attributeVal, attributeName);
dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlaye
r, itemAbilities, tmpArray, tmpInt, tmpInt);
attributes = dm.GetAbilitiesAttributes(itemAbilities);
tmpInt = 0;
while (tmpInt < attributes.Size()){
if (attributes[tmpInt] == attributeName){
dm.GetAbilitiesAttributeValue(itemAbilities, att
ributeName, min, max, /* NOP */);
attributeValue = GetAttributeRandomizedValue(min
, max);

primAttrName = attributeName;
break;
}
tmpInt += 1;
}
if (attributeValue.valueBase != 0){
attributeVal = attributeValue.valueBase;
}
if (attributeValue.valueMultiplicative != 0){
attributeVal = attributeValue.valueMultiplicative;
}
if (attributeValue.valueAdditive != 0){
attributeVal = attributeValue.valueAdditive;
}
/* NOP */;
}
public function IsPrimaryStatById(itemId : SItemUniqueId, attributeName
: CName, attributeLabel : String) : Bool{
var attrValue : Float;
var attrName : CName;
GetItemPrimaryStatImplById(itemId, attributeLabel, attrValue, at
trName);
return attrName == attributeName;
/* NOP */;
}
private function GetItemPrimaryStatImplById(itemId : SItemUniqueId, attr
ibuteLabel : String, attributeVal : Float, attributeName : CName){
var itemOnSlot : SItemUniqueId;
var categoryName : CName;
var abList : array<CName>;
attributeName = 'None';
attributeLabel = "";
categoryName = super.GetItemCategory(itemId);
if (categoryName == 'bolt' || categoryName == 'petard'){
super.GetItemAttributes(itemId, abList);
if (abList.Contains('FireDamage')){
attributeName = 'FireDamage';
} else if (abList.Contains('PiercingDamage')){
attributeName = 'PiercingDamage';
} else if (abList.Contains('PiercingDamage')){
attributeName = 'PiercingDamage';
} else if (abList.Contains('PoisonDamage')){
attributeName = 'PoisonDamage';
} else if (abList.Contains('BludgeoningDamage')){
attributeName = 'BludgeoningDamage';
} else {
attributeName = 'PhysicalDamage';
}
attributeLabel = GetAttributeNameLocStr(attributeName, f
alse);
} else if (categoryName == 'secondary'){
super.GetItemAttributes(itemId, abList);
if (abList.Contains('BludgeoningDamage')){
attributeName = 'BludgeoningDamage';
} else {
attributeName = 'PhysicalDamage';
}
attributeLabel = GetAttributeNameLocStr(attributeName, f
alse);
} else if (categoryName == 'steelsword'){

super.GetItemAttributes(itemId, abList);
if (abList.Contains('SlashingDamage')){
attributeName = 'SlashingDamage';
attributeLabel = GetLocStringByKeyExt("panel_inv
entory_tooltip_damage");
} else if (abList.Contains('BludgeoningDamage')){
attributeName = 'BludgeoningDamage';
} else if (abList.Contains('PiercingDamage')){
attributeName = 'PiercingDamage';
} else {
attributeName = 'PhysicalDamage';
}
if (attributeLabel == ""){
attributeLabel = GetAttributeNameLocStr(attribut
eName, false);
}
} else {
GetItemPrimaryStatImpl(categoryName, attributeLabel, att
ributeVal, attributeName);
}
/* NOP */;
}
public function IsPrimaryStat(categoryName : CName, attributeName : CNam
e, attributeLabel : String) : Bool{
var attrValue : Float;
var attrName : CName;
GetItemPrimaryStatImpl(categoryName, attributeLabel, attrValue,
attrName);
return attrName == attributeName;
/* NOP */;
}
private function GetItemPrimaryStatImpl(categoryName : CName, attributeL
abel : String, attributeVal : Float, attributeName : CName){
attributeName = 'None';
attributeLabel = "";
switch(categoryName){
case 'steelsword':
attributeName = 'SlashingDamage';
attributeLabel = GetLocStringByKeyExt("panel_inventory_t
ooltip_damage");
break;
case 'silversword':
attributeName = 'SilverDamage';
attributeLabel = GetLocStringByKeyExt("panel_inventory_t
ooltip_damage");
break;
case 'armor':
case 'gloves':
case 'gloves':
case 'boots':
case 'pants':
attributeName = 'armor';
break;
case 'potion':
case 'oil':
break;
case 'bolt':
case 'petard':
attributeName = 'PhysicalDamage';
break;

case 'crossbow':
default:
attributeLabel = "";
attributeVal = 0;
return;
break;
}
if (attributeLabel == ""){
attributeLabel = GetAttributeNameLocStr(attributeName, f
alse);
}
/* NOP */;
}
public function CanBeCompared(itemId : SItemUniqueId) : Bool{
var wplayer : W3PlayerWitcher;
var itemSlot : EEquipmentSlots;
var equipedItem : SItemUniqueId;
var isArmorOrWeapon : Bool;
isArmorOrWeapon = super.IsItemAnyArmor(itemId) || super.IsItemWe
apon(itemId);
if (!isArmorOrWeapon){
return false;
}
wplayer = GetWitcherPlayer();
if (wplayer.IsItemEquipped(itemId)){
return false;
}
itemSlot = GetSlotForItemId(itemId);
wplayer.GetItemEquippedOnSlot(itemSlot, equipedItem);
if (!super.IsIdValid(equipedItem)){
return false;
}
return true;
/* NOP */;
}
public final function SingletonItemRefillAmmo(id : SItemUniqueId){
SetItemModifierInt(id, 'ammo_current', SingletonItemGetMaxAmmo(i
d));
theGame.GetGlobalEventsManager().OnScriptedEvent(4, /* NOP */, /
* NOP */);
/* NOP */;
}
public function SingletonItemSetAmmo(id : SItemUniqueId, quantity : Int3
2){
var amount : Int32;
if (super.ItemHasTag(id, theGame.params.TAG_INFINITE_AMMO)){
amount = -1;
} else {
amount = Clamp(quantity, 0, SingletonItemGetMaxAmmo(id))
;
}
super.SetItemModifierInt(id, 'ammo_current', amount);
theGame.GetGlobalEventsManager().OnScriptedEvent(4, /* NOP */, /
* NOP */);
/* NOP */;
}
public function SingletonItemAddAmmo(id : SItemUniqueId, quantity : Int3
2){
var ammo : Int32;
if (quantity <= 0){

return;
}
ammo = super.GetItemModifierInt(id, 'ammo_current', /* NOP */);
if (ammo == -1){
return;
}
ammo = Clamp(ammo + quantity, 0, SingletonItemGetMaxAmmo(id));
super.SetItemModifierInt(id, 'ammo_current', ammo);
theGame.GetGlobalEventsManager().OnScriptedEvent(4, /* NOP */, /
* NOP */);
/* NOP */;
}
public function SingletonItemsRefillAmmo(){
var i : Int32;
var singletonItems : array<SItemUniqueId>;
var alco : SItemUniqueId;
var arrStr : array<String>;
var witcher : W3PlayerWitcher;
var itemLabel : String;
witcher = GetWitcherPlayer();
if (GetEntity() == witcher && super.HasNotFilledSingletonItem())
{
alco = witcher.GetAlcoholForAlchemicalItemsRefill();
if (!super.IsIdValid(alco)){
theGame.GetGuiManager().ShowNotification(GetLocS
tringByKeyExt("message_common_alchemy_items_cannot_refill"), /* NOP */);
theSound.SoundEvent("gui_global_denied");
return;
} else {
arrStr.PushBack(super.GetItemName(alco));
itemLabel = GetLocStringByKeyExt(super.GetItemLo
calizedNameByUniqueID(alco));
theGame.GetGuiManager().ShowNotification(itemLab
el + " - " + GetLocStringByKeyExtWithParams("message_common_alchemy_items_refill
ed", /* NOP */, /* NOP */, arrStr, /* NOP */), /* NOP */);
theSound.SoundEvent("gui_alchemy_brew");
super.RemoveItem(alco, /* NOP */);
}
}
singletonItems = super.GetSingletonItems();
i = 0;
while (i < singletonItems.Size()){
super.SingletonItemRefillAmmo(singletonItems[i]);
i += 1;
}
/* NOP */;
}
public function SingletonItemsRefillAmmoNoAlco(){
var i : Int32;
var singletonItems : array<SItemUniqueId>;
var alco : SItemUniqueId;
var arrStr : array<String>;
var witcher : W3PlayerWitcher;
var itemLabel : String;
witcher = GetWitcherPlayer();
if (GetEntity() == witcher && super.HasNotFilledSingletonItem())
{
arrStr.PushBack(super.GetItemName(alco));
itemLabel = GetLocStringByKeyExt(super.GetItemLocalizedN
ameByUniqueID(alco));

theGame.GetGuiManager().ShowNotification(itemLabel + " " + GetLocStringByKeyExtWithParams("message_common_alchemy_items_refilled", /*


NOP */, /* NOP */, arrStr, /* NOP */), /* NOP */);
theSound.SoundEvent("gui_alchemy_brew");
}
singletonItems = super.GetSingletonItems();
i = 0;
while (i < singletonItems.Size()){
super.SingletonItemRefillAmmo(singletonItems[i]);
i += 1;
}
/* NOP */;
}
private final function HasNotFilledSingletonItem() : Bool{
var i : Int32;
var singletonItems : array<SItemUniqueId>;
singletonItems = GetSingletonItems();
i = 0;
while (i < singletonItems.Size()){
if (SingletonItemGetAmmo(singletonItems[i]) < SingletonI
temGetMaxAmmo(singletonItems[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function SingletonItemRemoveAmmo(itemID : SItemUniqueId, quantity
: Int32){
var ammo : Int32;
if (!super.IsItemSingletonItem(itemID) || super.ItemHasTag(itemI
D, theGame.params.TAG_INFINITE_AMMO)){
return;
}
if (quantity <= 0){
quantity = 1;
}
ammo = super.GetItemModifierInt(itemID, 'ammo_current', /* NOP *
/);
ammo = Max(0, ammo - quantity);
super.SetItemModifierInt(itemID, 'ammo_current', ammo);
if (ammo == 0 && ShouldProcessTutorial('TutorialAlchemyRefill')
&& FactsQuerySum("q001_nightmare_ended") > 0){
FactsAdd('tut_alch_refill', 1, /* NOP */);
}
theGame.GetGlobalEventsManager().OnScriptedEvent(4, /* NOP */, /
* NOP */);
/* NOP */;
}
public function SingletonItemGetAmmo(itemID : SItemUniqueId) : Int32{
if (!super.IsItemSingletonItem(itemID)){
return 0;
}
return super.GetItemModifierInt(itemID, 'ammo_current', /* NOP *
/);
/* NOP */;
}
public function SingletonItemGetMaxAmmo(itemID : SItemUniqueId) : Int32{
var ammo : Int32;

ammo = RoundMath(CalculateAttributeValue(super.GetItemAttributeV
alue(itemID, 'ammo', /* NOP */, /* NOP */), /* NOP */));
if (GetEntity() == GetWitcherPlayer() && ammo > 0){
if (super.IsItemBomb(itemID) && thePlayer.CanUseSkill(65
)){
ammo += thePlayer.GetSkillLevel(65);
}
if (thePlayer.HasBuff(75) && super.IsItemBomb(itemID) ||
!super.IsItemMutagenPotion(itemID) && super.IsItemPotion(itemID)){
ammo += 1;
}
}
return ammo;
/* NOP */;
}
public final function IsItemSteelSwordUsableByPlayer(item : SItemUniqueI
d) : Bool{
return ItemHasTag(item, theGame.params.TAG_PLAYER_STEELSWORD) &&
!ItemHasTag(item, 'SecondaryWeapon');
/* NOP */;
}
public final function IsItemSilverSwordUsableByPlayer(item : SItemUnique
Id) : Bool{
return ItemHasTag(item, theGame.params.TAG_PLAYER_SILVERSWORD) &
& !ItemHasTag(item, 'SecondaryWeapon');
/* NOP */;
}
public final function IsItemFists(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'fist';
/* NOP */;
}
public final function IsItemWeapon(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'Weapon') || ItemHasTag(item, 'WeaponTab
');
/* NOP */;
}
public final function IsItemCrossbow(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'crossbow';
/* NOP */;
}
public final function IsItemChestArmor(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'armor';
/* NOP */;
}
public final function IsItemBody(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'Body');
/* NOP */;
}
public final function IsItemBoots(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'boots';
/* NOP */;
}
public final function IsItemGloves(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'gloves';
/* NOP */;
}
public final function IsItemPants(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'trousers' || GetItemCategory(it
em) == 'pants';
/* NOP */;

}
public final function IsItemTrophy(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'trophy';
/* NOP */;
}
public final function IsItemMask(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'mask';
/* NOP */;
}
public final function IsItemBomb(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'petard';
/* NOP */;
}
public final function IsItemBolt(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'bolt';
/* NOP */;
}
public final function IsItemUpgrade(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'upgrade';
/* NOP */;
}
public final function IsItemTool(item : SItemUniqueId) : Bool{
return GetItemCategory(item) == 'tool';
/* NOP */;
}
public final function IsItemPotion(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'Potion');
/* NOP */;
}
public final function IsItemOil(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'SilverOil') || ItemHasTag(item, 'SteelO
il');
/* NOP */;
}
public final function IsItemAnyArmor(item : SItemUniqueId) : Bool{
return ItemHasTag(item, theGame.params.TAG_ARMOR);
/* NOP */;
}
public final function IsItemUpgradeable(item : SItemUniqueId) : Bool{
return ItemHasTag(item, theGame.params.TAG_ITEM_UPGRADEABLE);
/* NOP */;
}
public final function IsItemIngredient(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'AlchemyIngredient') || ItemHasTag(item,
'CraftingIngredient');
/* NOP */;
}
public final function IsItemDismantleKit(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'DismantleKit');
/* NOP */;
}
public final function IsItemHorseBag(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'HorseBag');
/* NOP */;
}
public final function IsItemAlchemyItem(item : SItemUniqueId) : Bool{
return IsItemOil(item) || IsItemPotion(item) || IsItemBomb(item)
|| ItemHasTag(item, 'QuickSlot') || ItemHasTag(item, 'ReadableItem');
/* NOP */;
}

public final function IsItemSingletonItem(item : SItemUniqueId) : Bool{


return ItemHasTag(item, theGame.params.TAG_ITEM_SINGLETON);
/* NOP */;
}
public final function IsItemQuest(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'Quest');
/* NOP */;
}
public final function IsItemFood(item : SItemUniqueId) : Bool{
return ItemHasTag(item, 'Edibles') || ItemHasTag(item, 'Drinks')
;
/* NOP */;
}
public final function IsItemSecondaryWeapon(item : SItemUniqueId) : Bool
{
return ItemHasTag(item, 'SecondaryWeapon');
/* NOP */;
}
public final function IsItemMutagenPotion(item : SItemUniqueId) : Bool{
return IsItemPotion(item) && ItemHasTag(item, 'Mutagen');
/* NOP */;
}
public final function IsItemSetItem(item : SItemUniqueId) : Bool{
return ItemHasTag(item, theGame.params.ITEM_SET_TAG_BEAR) || Ite
mHasTag(item, theGame.params.ITEM_SET_TAG_GRYPHON) || ItemHasTag(item, theGame.p
arams.ITEM_SET_TAG_LYNX) || ItemHasTag(item, theGame.params.ITEM_SET_TAG_WOLF);
/* NOP */;
}
public function GetArmorType(item : SItemUniqueId) : EArmorType{
if (super.ItemHasTag(item, 'LightArmor')){
return 1;
} else if (super.ItemHasTag(item, 'MediumArmor')){
return 2;
} else if (super.ItemHasTag(item, 'HeavyArmor')){
return 3;
}
return 0;
/* NOP */;
}
public final function GetAlchemyCraftableItems() : array<SItemUniqueId>{
var items : array<SItemUniqueId>;
var i : Int32;
GetAllItems(items);
i = items.Size() - 1;
while (i >= 0){
if (!IsItemPotion(items[i]) && !IsItemBomb(items[i]) &&
!IsItemOil(items[i])){
items.EraseFast(i);
}
i -= 1;
}
return items;
/* NOP */;
}
public function IsItemEncumbranceItem(item : SItemUniqueId) : Bool{
if (super.ItemHasTag(item, theGame.params.TAG_ENCUMBRANCE_ITEM_F
ORCE_YES)){
return true;
}
if (super.ItemHasTag(item, theGame.params.TAG_ENCUMBRANCE_ITEM_F

ORCE_NO)){
return false;
}
if (super.IsItemBody(item)){
return false;
}
return true;
/* NOP */;
}
public function GetItemEncumbrance(item : SItemUniqueId) : Float{
if (IsItemEncumbranceItem(item)){
if (super.GetItemCategory(item) == 'quest' || super.GetI
temCategory(item) == 'key' || super.IsItemAlchemyItem(item) || super.IsItemIngre
dient(item)){
return 0.010000 * super.GetItemQuantity(item);
} else if (super.GetItemCategory(item) == 'usable' || su
per.GetItemCategory(item) == 'upgrade' || super.GetItemCategory(item) == 'junk')
{
return 0.010000 + super.GetItemWeight(item) * su
per.GetItemQuantity(item) * 0.200000;
} else {
return 0.010000 + super.GetItemWeight(item) * su
per.GetItemQuantity(item) * 0.500000;
}
}
return 0;
/* NOP */;
}
public function GetFilterTypeByItem(item : SItemUniqueId) : EInventoryFi
lterType{
var filterType : EInventoryFilterType;
if (super.ItemHasTag(item, 'Quest')){
return 5;
} else if (super.IsItemIngredient(item)){
return 4;
} else if (super.IsItemAlchemyItem(item)){
return 3;
} else if (super.IsItemAnyArmor(item)){
return 2;
} else if (super.IsItemWeapon(item)){
return 1;
} else {
return 6;
}
/* NOP */;
}
public function IsItemQuickslotItem(item : SItemUniqueId) : Bool{
return IsSlotQuickslot(GetSlotForItemId(item));
/* NOP */;
}
public function GetCrossbowAmmo(id : SItemUniqueId) : Int32{
if (!super.IsItemCrossbow(id)){
return -1;
}
return CalculateAttributeValue(super.GetItemAttributeValue(id, '
ammo', /* NOP */, /* NOP */), /* NOP */);
/* NOP */;
}
public function GetSlotForItemId(item : SItemUniqueId) : EEquipmentSlots
{

var tags : array<CName>;


var player : W3PlayerWitcher;
var slot : EEquipmentSlots;
player = (W3PlayerWitcher)GetEntity();
super.GetItemTags(item, tags);
slot = GetSlotForItem(super.GetItemCategory(item), tags, player)
;
if (!player){
return slot;
}
if (IsMultipleSlot(slot)){
if (slot == 7 && player.IsAnyItemEquippedOnSlot(slot)){
if (!player.IsAnyItemEquippedOnSlot(8)){
slot = 8;
}
} else if (slot == 10 && player.IsAnyItemEquippedOnSlot(
slot)){
if (!player.IsAnyItemEquippedOnSlot(11)){
slot = 11;
}
} else if (slot == 14 && player.IsAnyItemEquippedOnSlot(
slot)){
if (!player.IsAnyItemEquippedOnSlot(15)){
slot = 15;
}
} else if (slot == 18 && player.IsAnyItemEquippedOnSlot(
slot)){
if (!player.IsAnyItemEquippedOnSlot(19)){
slot = 19;
} else if (!player.IsAnyItemEquippedOnSlot(20)){
slot = 20;
} else if (!player.IsAnyItemEquippedOnSlot(21)){
slot = 21;
}
} else if (slot == 22 && player.IsAnyItemEquippedOnSlot(
slot)){
if (!player.IsAnyItemEquippedOnSlot(23)){
slot = 23;
} else if (!player.IsAnyItemEquippedOnSlot(24)){
slot = 24;
} else if (!player.IsAnyItemEquippedOnSlot(25)){
slot = 25;
}
}
}
return slot;
/* NOP */;
}
public function GetAllWeapons() : array<SItemUniqueId>{
return super.GetItemsByTag('Weapon');
/* NOP */;
}
public function GetSpecifiedPlayerItemsQuest(steelSword : Bool, silverSw
ord : Bool, armor : Bool, boots : Bool, gloves : Bool, pants : Bool, trophy : Bo
ol, mask : Bool, bombs : Bool, crossbow : Bool, secondaryWeapon : Bool, equipped
Only : Bool) : array<SItemUniqueId>{
var items : array<SItemUniqueId>;
var allItems : array<SItemUniqueId>;
var i : Int32;
super.GetAllItems(allItems);

i = 0;
while (i < allItems.Size()){
if (steelSword && super.IsItemSteelSwordUsableByPlayer(a
llItems[i]) || silverSword && super.IsItemSilverSwordUsableByPlayer(allItems[i])
|| armor && super.IsItemChestArmor(allItems[i]) || boots && super.IsItemBoots(a
llItems[i]) || gloves && super.IsItemGloves(allItems[i]) || pants && super.IsIte
mPants(allItems[i]) || trophy && super.IsItemTrophy(allItems[i]) || mask && supe
r.IsItemMask(allItems[i]) || bombs && super.IsItemBomb(allItems[i]) || crossbow
&& super.IsItemCrossbow(allItems[i]) || super.IsItemBolt(allItems[i]) || seconda
ryWeapon && super.IsItemSecondaryWeapon(allItems[i])){
if (!equippedOnly || equippedOnly && (W3PlayerWi
tcher)GetEntity() && GetWitcherPlayer().IsItemEquipped(allItems[i])){
if (!super.ItemHasTag(allItems[i], 'NoDr
op')){
items.PushBack(allItems[i]);
}
}
}
i += 1;
}
return items;
/* NOP */;
}
public function OnItemRemoved(itemId : SItemUniqueId, quantity : Int32)
: Bool{
var ent : CGameplayEntity;
var crossbows : array<SItemUniqueId>;
var witcher : W3PlayerWitcher;
var refill : W3RefillableContainer;
witcher = GetWitcherPlayer();
if (GetEntity() == witcher){
if (super.IsItemCrossbow(itemId) && HasInfiniteBolts()){
crossbows = super.GetItemsByCategory('crossbow')
;
crossbows.Remove(itemId);
if (crossbows.Size() == 0){
RemoveItemByName('Bodkin Bolt', super.Ge
tItemQuantityByName('Bodkin Bolt', /* NOP */));
RemoveItemByName('Harpoon Bolt', super.G
etItemQuantityByName('Harpoon Bolt', /* NOP */));
}
} else if (super.IsItemBolt(itemId) && witcher.IsItemEqu
ipped(itemId) && witcher.inv.GetItemQuantity(itemId) == quantity){
witcher.UnequipItem(itemId);
}
if (super.IsItemCrossbow(itemId) && witcher.IsItemEquipp
ed(itemId) && witcher.rangedWeapon){
witcher.rangedWeapon.ClearDeployedEntity(true);
witcher.rangedWeapon = NULL;
}
if (super.GetItemCategory(itemId) == 'usable'){
if (witcher.IsHoldingItemInLHand() && itemId ==
witcher.currentlyEquipedItemL){
witcher.HideUsableItem(true);
}
}
if (witcher.IsItemEquipped(itemId) && quantity >= witche
r.inv.GetItemQuantity(itemId)){
witcher.UnequipItem(itemId);
}

}
if (GetEntity() == thePlayer && super.IsItemWeapon(itemId) && su
per.IsItemHeld(itemId) || super.IsItemMounted(itemId)){
thePlayer.OnHolsteredItem(super.GetItemCategory(itemId),
'r_weapon');
}
ent = (CGameplayEntity)GetEntity();
if (ent){
ent.OnItemTaken(itemId, quantity);
}
if (super.IsLootRenewable()){
refill = (W3RefillableContainer)GetEntity();
if (refill){
refill.AddTimer('Refill', 20, true, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function GenerateItemLevel(item : SItemUniqueId){
var stat : SAbilityAttributeValue;
var lvl : Int32;
var i : Int32;
var quality : Int32;
quality = RoundMath(CalculateAttributeValue(super.GetItemAttribu
teValue(item, 'quality', /* NOP */, /* NOP */), /* NOP */));
if (!super.ItemHasTag(item, 'AutogenForceLevel')){
if (quality == 5){
lvl = RoundF(GetWitcherPlayer().GetLevel() + Ran
dRangeF(2, 0));
} else if (quality == 4){
lvl = RoundF(GetWitcherPlayer().GetLevel() + Ran
dRangeF(1, -2));
} else if (quality == 3){
lvl = RoundF(GetWitcherPlayer().GetLevel() + Ran
dRangeF(-1, -3));
if (RandF() > 0.900000){
lvl = GetWitcherPlayer().GetLevel();
}
} else if (quality == 2){
lvl = RoundF(GetWitcherPlayer().GetLevel() + Ran
dRangeF(-2, -5));
if (RandF() > 0.950000){
lvl = GetWitcherPlayer().GetLevel();
}
} else {
lvl = RoundF(GetWitcherPlayer().GetLevel() + Ran
dRangeF(-2, -8));
if (RandF() == 0){
lvl = GetWitcherPlayer().GetLevel();
}
}
} else {
lvl = GetWitcherPlayer().GetLevel() - 1;
}
if (lvl < 1){
lvl = 1;
}
if (lvl > 70){
lvl = 70;

}
if (super.ItemHasTag(item, 'PlayerSteelWeapon') && !ItemHasAbili
ty(item, 'autogen_steel_base')){
super.AddItemCraftedAbility(item, 'autogen_steel_base',
/* NOP */);
i = 0;
while (i < lvl){
if (!super.ItemHasTag(item, 'AutogenForceLevel')
){
super.AddItemCraftedAbility(item, 'autog
en_steel_dmg', true);
} else {
super.AddItemCraftedAbility(item, 'autog
en_fixed_steel_dmg', true);
}
i += 1;
}
} else if (super.ItemHasTag(item, 'PlayerSilverWeapon') && !Item
HasAbility(item, 'autogen_silver_base')){
super.AddItemCraftedAbility(item, 'autogen_silver_base',
/* NOP */);
i = 0;
while (i < lvl){
if (!super.ItemHasTag(item, 'AutogenForceLevel')
){
super.AddItemCraftedAbility(item, 'autog
en_silver_dmg', true);
} else {
super.AddItemCraftedAbility(item, 'autog
en_fixed_silver_dmg', true);
}
i += 1;
}
} else if (super.GetItemCategory(item) == 'armor' && !ItemHasAbi
lity(item, 'autogen_armor_base')){
super.AddItemCraftedAbility(item, 'autogen_armor_base',
/* NOP */);
i = 0;
while (i < lvl){
if (!super.ItemHasTag(item, 'AutogenForceLevel')
){
super.AddItemCraftedAbility(item, 'autog
en_armor_armor', true);
} else {
super.AddItemCraftedAbility(item, 'autog
en_fixed_armor_armor', true);
}
i += 1;
}
} else if (super.GetItemCategory(item) == 'boots' || super.GetIt
emCategory(item) == 'pants' && !ItemHasAbility(item, 'autogen_pants_base')){
super.AddItemCraftedAbility(item, 'autogen_pants_base',
/* NOP */);
i = 0;
while (i < lvl){
if (!super.ItemHasTag(item, 'AutogenForceLevel')
){
super.AddItemCraftedAbility(item, 'autog
en_pants_armor', true);
} else {

super.AddItemCraftedAbility(item, 'autog
en_fixed_pants_armor', true);
}
i += 1;
}
} else if (super.GetItemCategory(item) == 'gloves' && !ItemHasAb
ility(item, 'autogen_gloves_base')){
super.AddItemCraftedAbility(item, 'autogen_gloves_base',
/* NOP */);
i = 0;
while (i < lvl){
if (!super.ItemHasTag(item, 'AutogenForceLevel')
){
super.AddItemCraftedAbility(item, 'autog
en_gloves_armor', true);
} else {
super.AddItemCraftedAbility(item, 'autog
en_fixed_gloves_armor', true);
}
i += 1;
}
}
/* NOP */;
}
public function OnItemAdded(data : SItemChangedData) : Bool{
var i : Int32;
var j : Int32;
var ent : CGameplayEntity;
var allCardsNames : array<CName>;
var foundCardsNames : array<CName>;
var allStringNamesOfCards : array<String>;
var foundCardsStringNames : array<String>;
var gwintCards : array<SItemUniqueId>;
var itemName : CName;
var witcher : W3PlayerWitcher;
var itemCategory : CName;
var dm : CDefinitionsManagerAccessor;
var locKey : String;
var leaderCardsHack : array<CName>;
ent = (CGameplayEntity)GetEntity();
if (data.informGui){
recentlyAddedItems.PushBack(data.ids[0]);
if (super.ItemHasTag(data.ids[0], 'FocusObject')){
GetWitcherPlayer().GetMedallion().Activate(true,
3.000000);
}
}
if (super.ItemHasTag(data.ids[0], 'Autogen')){
GenerateItemLevel(data.ids[0]);
}
witcher = GetWitcherPlayer();
if (ent == witcher){
i = 0;
while (i < data.ids.Size()){
if (super.GetItemModifierInt(data.ids[i], 'ItemQ
ualityModified', /* NOP */) <= 0){
AddRandomEnhancementToItem(data.ids[i]);
}
if (super.ItemHasTag(data.ids[0], theGame.params
.GWINT_CARD_ACHIEVEMENT_TAG)){

leaderCardsHack.PushBack('gwint_card_emh
yr_gold');
leaderCardsHack.PushBack('gwint_card_emh
yr_silver');
leaderCardsHack.PushBack('gwint_card_emh
yr_bronze');
leaderCardsHack.PushBack('gwint_card_fol
test_gold');
leaderCardsHack.PushBack('gwint_card_fol
test_silver');
leaderCardsHack.PushBack('gwint_card_fol
test_bronze');
leaderCardsHack.PushBack('gwint_card_fra
ncesca_gold');
leaderCardsHack.PushBack('gwint_card_fra
ncesca_silver');
leaderCardsHack.PushBack('gwint_card_fra
ncesca_bronze');
leaderCardsHack.PushBack('gwint_card_ere
din_gold');
leaderCardsHack.PushBack('gwint_card_ere
din_silver');
leaderCardsHack.PushBack('gwint_card_ere
din_bronze');
dm = theGame.GetDefinitionsManager();
allCardsNames = theGame.GetDefinitionsMa
nager().GetItemsWithTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
gwintCards = super.GetItemsByTag(theGame
.params.GWINT_CARD_ACHIEVEMENT_TAG);
allStringNamesOfCards.PushBack('gwint_na
me_emhyr');
allStringNamesOfCards.PushBack('gwint_na
me_emhyr');
allStringNamesOfCards.PushBack('gwint_na
me_emhyr');
allStringNamesOfCards.PushBack('gwint_na
me_foltest');
allStringNamesOfCards.PushBack('gwint_na
me_foltest');
allStringNamesOfCards.PushBack('gwint_na
me_foltest');
allStringNamesOfCards.PushBack('gwint_na
me_francesca');
allStringNamesOfCards.PushBack('gwint_na
me_francesca');
allStringNamesOfCards.PushBack('gwint_na
me_francesca');
allStringNamesOfCards.PushBack('gwint_na
me_eredin');
allStringNamesOfCards.PushBack('gwint_na
me_eredin');
allStringNamesOfCards.PushBack('gwint_na
me_eredin');
j = 0;
while (j < allCardsNames.Size()){
itemName = allCardsNames[j];
locKey = dm.GetItemLocalisationK
eyName(allCardsNames[j]);
if (!allStringNamesOfCards.Conta
ins(locKey)){

allStringNamesOfCards.Pu
shBack(locKey);
}
j += 1;
}
if (gwintCards.Size() >= allStringNamesO
fCards.Size()){
foundCardsNames.Clear();
j = 0;
while (j < gwintCards.Size()){
itemName = super.GetItem
Name(gwintCards[j]);
locKey = dm.GetItemLocal
isationKeyName(itemName);
if (!foundCardsStringNam
es.Contains(locKey) || leaderCardsHack.Contains(itemName)){
foundCardsString
Names.PushBack(locKey);
}
j += 1;
}
if (foundCardsStringNames.Size()
>= allStringNamesOfCards.Size()){
theGame.GetGamerProfile(
).AddAchievement(51);
FactsAdd("gwint_all_card
s_collected", 1, -1);
}
}
}
itemCategory = super.GetItemCategory(data.ids[0]
);
if (itemCategory == 'alchemy_recipe' || itemCate
gory == 'crafting_schematic'){
ReadSchematicsAndRecipes(data.ids[0]);
}
if (super.ItemHasTag(data.ids[i], 'GwintCard')){
witcher.AddGwentCard(super.GetItemName(d
ata.ids[i]), data.quantity);
}
i += 1;
}
}
if (super.IsItemSingletonItem(data.ids[0])){
i = 0;
while (i < data.ids.Size()){
if (!super.GetItemModifierInt(data.ids[i], 'is_i
nitialized', 0)){
super.SingletonItemRefillAmmo(data.ids[i
]);
super.SetItemModifierInt(data.ids[i], 'i
s_initialized', 1);
}
i += 1;
}
}
if (ent){
ent.OnItemGiven(data);
}
/* NOP */;

}
public function AddRandomEnhancementToItem(item : SItemUniqueId){
var itemCategory : CName;
var itemQuality : Int32;
var ability : CName;
var ent : CGameplayEntity;
itemCategory = super.GetItemCategory(item);
itemQuality = RoundMath(CalculateAttributeValue(super.GetItemAtt
ributeValue(item, 'quality', /* NOP */, /* NOP */), /* NOP */));
if (itemCategory == 'armor'){
switch(itemQuality){
case 2:
ability = 'quality_masterwork_armor';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkArmorAbility(), true);
break;
case 3:
ability = 'quality_magical_armor';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalArmorAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkArmorAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalArmorAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkArmorAbility(), true);
}
break;
default:
break;
}
} else if (itemCategory == 'gloves'){
switch(itemQuality){
case 2:
ability = 'quality_masterwork_gloves';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkGlovesAbility(), true);
break;
case 3:
ability = 'quality_magical_gloves';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalGlovesAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkGlovesAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalGlovesAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkGlovesAbility(), true);
}
break;

default:
break;
}
} else if (itemCategory == 'pants'){
switch(itemQuality){
case 2:
ability = 'quality_masterwork_pants';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkPantsAbility(), true);
break;
case 3:
ability = 'quality_magical_pants';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalPantsAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkPantsAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalPantsAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkPantsAbility(), true);
}
break;
default:
break;
}
} else if (itemCategory == 'boots'){
switch(itemQuality){
case 2:
ability = 'quality_masterwork_boots';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkBootsAbility(), true);
break;
case 3:
ability = 'quality_magical_boots';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalBootsAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkBootsAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalBootsAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkBootsAbility(), true);
}
break;
default:
break;
}
} else if (itemCategory == 'steelsword'){
switch(itemQuality){
case 2:

ability = 'quality_masterwork_steelsword';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkWeaponAbility(), true);
break;
case 3:
ability = 'quality_magical_steelsword';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalWeaponAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkWeaponAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalWeaponAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkWeaponAbility(), true);
}
break;
default:
break;
}
} else if (itemCategory == 'silversword'){
switch(itemQuality){
case 2:
ability = 'quality_masterwork_silversword';
super.AddItemCraftedAbility(item, theGame.params
.GetRandomMasterworkWeaponAbility(), true);
break;
case 3:
ability = 'quality_magical_silversword';
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalWeaponAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkWeaponAbility(), true);
}
if (RandF() > 0.500000){
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMagicalWeaponAbility(), true);
} else {
super.AddItemCraftedAbility(item, theGam
e.params.GetRandomMasterworkWeaponAbility(), true);
}
break;
default:
break;
}
}
if (IsNameValid(ability)){
super.AddItemCraftedAbility(item, ability, false);
super.SetItemModifierInt(item, 'ItemQualityModified', 1)
;
}
/* NOP */;
}
public function GetItemQuality(itemId : SItemUniqueId) : Int32{

var itemQuality : Float;


var itemQualityAtribute : SAbilityAttributeValue;
var excludedTags : array<CName>;
var tempItemQualityAtribute : SAbilityAttributeValue;
excludedTags.PushBack(theGame.params.OIL_ABILITY_TAG);
itemQualityAtribute = super.GetItemAttributeValue(itemId, 'quali
ty', excludedTags, true);
itemQuality = itemQualityAtribute.valueAdditive;
if (itemQuality == 0){
itemQuality = 1;
}
return RoundMath(itemQuality);
/* NOP */;
}
public function GetItemQualityFromName(itemName : CName, min : Int32, ma
x : Int32){
var dm : CDefinitionsManagerAccessor;
var attributeName : CName;
var attributes : array<CName>;
var itemAbilities : array<CName>;
var attributeMin : SAbilityAttributeValue;
var attributeMax : SAbilityAttributeValue;
var tmpInt : Int32;
var tmpArray : array<Float>;
dm = theGame.GetDefinitionsManager();
dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlaye
r, itemAbilities, tmpArray, tmpInt, tmpInt);
attributes = dm.GetAbilitiesAttributes(itemAbilities);
tmpInt = 0;
while (tmpInt < attributes.Size()){
if (attributes[tmpInt] == 'quality'){
dm.GetAbilitiesAttributeValue(itemAbilities, 'qu
ality', attributeMin, attributeMax, /* NOP */);
min = RoundMath(CalculateAttributeValue(attribut
eMin, /* NOP */));
max = RoundMath(CalculateAttributeValue(attribut
eMax, /* NOP */));
break;
}
tmpInt += 1;
}
/* NOP */;
}
public function GetRecentlyAddedItems() : array<SItemUniqueId>{
return recentlyAddedItems;
/* NOP */;
}
public function GetRecentlyAddedItemsListSize() : Int32{
return recentlyAddedItems.Size();
/* NOP */;
}
public function RemoveItemFromRecentlyAddedList(itemId : SItemUniqueId)
: Bool{
var i : Int32;
i = 0;
while (i < recentlyAddedItems.Size()){
if (recentlyAddedItems[i] == itemId){
recentlyAddedItems.EraseFast(i);
return true;
}

i += 1;
}
return false;
/* NOP */;
}
public function AddListener(listener : IInventoryScriptedListener){
if (listeners.FindFirst(listener) == -1){
listeners.PushBack(listener);
if (listeners.Size() == 1){
super.NotifyScriptedListeners(true);
}
}
/* NOP */;
}
public function RemoveListener(listener : IInventoryScriptedListener){
if (listeners.Remove(listener)){
if (listeners.Size() == 0){
if (GetEntity() != thePlayer){
super.NotifyScriptedListeners(false);
}
}
}
/* NOP */;
}
public function OnInventoryScriptedEvent(eventType : EInventoryEventType
, itemId : SItemUniqueId, quantity : Int32, fromAssociatedInventory : Bool) : Bo
ol{
var i : Int32;
var size : Int32;
size = listeners.Size();
i = size - 1;
while (i >= 0){
listeners[i].OnInventoryScriptedEvent(eventType, itemId,
quantity, fromAssociatedInventory);
i -= 1;
}
if (GetEntity() == GetWitcherPlayer() && eventType == 2 || event
Type == 3){
GetWitcherPlayer().UpdateEncumbrance();
}
/* NOP */;
}
public function GetSkillMutagenColor(item : SItemUniqueId) : ESkillColor
{
var abs : array<CName>;
if (!super.ItemHasTag(item, 'MutagenIngredient')){
return 0;
}
super.GetItemAbilities(item, abs);
if (abs.Contains('mutagen_color_green')){
return 2;
}
if (abs.Contains('mutagen_color_blue')){
return 1;
}
if (abs.Contains('mutagen_color_red')){
return 3;
}
if (abs.Contains('lesser_mutagen_color_green')){
return 2;

}
if (abs.Contains('lesser_mutagen_color_blue')){
return 1;
}
if (abs.Contains('lesser_mutagen_color_red')){
return 3;
}
if (abs.Contains('greater_mutagen_color_green')){
return 2;
}
if (abs.Contains('greater_mutagen_color_blue')){
return 1;
}
if (abs.Contains('greater_mutagen_color_red')){
return 3;
}
return 0;
/* NOP */;
}
public function NotifyEnhancedItem(enhancedItemId : SItemUniqueId){
var weapons : array<SItemUniqueId>;
var sword : CWitcherSword;
var i : Int32;
sword = (CWitcherSword)super.GetItemEntityUnsafe(enhancedItemId)
;
sword.UpdateEnhancements(super.GetItemEnhancementCount(enhancedI
temId));
/* NOP */;
}
public function EnhanceItemScript(enhancedItemId : SItemUniqueId, extens
ionItemId : SItemUniqueId) : Bool{
var i : Int32;
var enhancements : array<CName>;
var runeword : Runeword;
if (EnhanceItem(enhancedItemId, extensionItemId)){
NotifyEnhancedItem(enhancedItemId);
super.GetItemEnhancementItems(enhancedItemId, enhancemen
ts);
if (theGame.runewordMgr.GetRuneword(enhancements, runewo
rd)){
i = 0;
while (i < runeword.abilities.Size()){
super.AddItemBaseAbility(enhancedItemId,
runeword.abilities[i]);
i += 1;
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveItemEnhancementByIndexScript(enhancedItemId : SIte
mUniqueId, slotIndex : Int32) : Bool{
var i : Int32;
var enhancements : array<CName>;
var runeword : Runeword;
var hasRuneword : Bool;
var names : array<CName>;
super.GetItemEnhancementItems(enhancedItemId, enhancements);

hasRuneword = theGame.runewordMgr.GetRuneword(enhancements, rune


word);
super.GetItemEnhancementItems(enhancedItemId, names);
if (RemoveItemEnhancementByIndex(enhancedItemId, slotIndex)){
NotifyEnhancedItem(enhancedItemId);
if (hasRuneword){
i = 0;
while (i < runeword.abilities.Size()){
super.RemoveItemBaseAbility(enhancedItem
Id, runeword.abilities[i]);
i += 1;
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveItemEnhancementByNameScript(enhancedItemId : SItem
UniqueId, extensionItemName : CName) : Bool{
var i : Int32;
var enhancements : array<CName>;
var runeword : Runeword;
var hasRuneword : Bool;
super.GetItemEnhancementItems(enhancedItemId, enhancements);
hasRuneword = theGame.runewordMgr.GetRuneword(enhancements, rune
word);
if (RemoveItemEnhancementByName(enhancedItemId, extensionItemNam
e)){
NotifyEnhancedItem(enhancedItemId);
super.AddAnItem(extensionItemName, 1, true, true, /* NOP
*/);
if (hasRuneword){
i = 0;
while (i < runeword.abilities.Size()){
super.RemoveItemBaseAbility(enhancedItem
Id, runeword.abilities[i]);
i += 1;
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveAllItemEnhancements(enhancedItemId : SItemUniqueId
){
var count : Int32;
var i : Int32;
count = super.GetItemEnhancementCount(enhancedItemId);
i = count - 1;
while (i >= 0){
RemoveItemEnhancementByIndexScript(enhancedItemId, i);
i -= 1;
}
/* NOP */;
}
public function GetHeldAndMountedItems(items : array<CName>){
var allItems : array<SItemUniqueId>;
var i : Int32;

var itemName : CName;


super.GetAllItems(allItems);
items.Clear();
i = 0;
while (i < allItems.Size()){
if (super.IsItemHeld(allItems[i]) || super.IsItemMounted
(allItems[i])){
itemName = super.GetItemName(allItems[i]);
items.PushBack(itemName);
}
i += 1;
}
/* NOP */;
}
}
import abstract class SJournalQuestObjectiveData{
//NULL type for status
//NULL type for objectiveEntry
}
state CPlayerStateAttached in CPlayer extends CPlayerStateBase{
public var attachedTo : CEntity;
public var slot : CName;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.EnableCharacterCollisions(false);
parent.SetBIsInputAllowed(false, 'AttachedStateEnter');
parent.CreateAttachment(attachedTo, slot, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.BreakAttachment();
parent.EnableCharacterCollisions(true);
parent.SetBIsInputAllowed(true, 'StateAttachedLeave');
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function SetupState(entity : CEntity, toSlot : CName){
attachedTo = entity;
slot = toSlot;
/* NOP */;
}
}
import state CPlayerStateBase in CPlayer{
import public final function CreateNoSaveLock();
public function CanAccesFastTravel(target : W3FastTravelEntity) : Bool{
return true;
/* NOP */;
}
}
state CPlayerStateBoardObserving in CPlayer extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);

/* NOP */;
}
}
import state CPlayerStateMovable in CPlayer{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.AddTimer('ProcessMovement', 0.001000, true, false, 0, /*
NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var currRotation : EulerAngles;
var agent : CMovingAgentComponent;
agent = parent.GetMovingAgentComponent();
super.OnLeaveState(nextStateName);
parent.RemoveTimer('ProcessMovement', 0);
if (agent){
agent.SetBehaviorVariable('headingChange', 0);
}
/* NOP */;
}
public timer function ProcessMovement(optional timeDelta : Float, option
al id : Int32){
var action : EActorActionType;
var r4player : CR4Player;
r4player = (CR4Player)parent;
if (parent.GetIsMovable()){
action = parent.GetCurrentActionType();
if (action == 0){
if (r4player){
r4player.SetDefaultLocomotionController(
);
}
} else {
MonitorInput();
}
} else {
ResetMovementFlags();
}
/* NOP */;
}
private function ResetMovementFlags(){
var currRotation : EulerAngles;
currRotation = parent.GetWorldRotation();
parent.rawPlayerSpeed = 0.000000;
parent.rawPlayerAngle = 0.000000;
parent.rawPlayerHeading = currRotation.Yaw;
/* NOP */;
}
private function MonitorInput(){
if (theInput.GetActionValue('GI_AxisLeftX') != 0 || theInput.Get
ActionValue('GI_AxisLeftY') != 0){
thePlayer.SignalGameplayEvent('StopPlayerActionOnInput')
;
}
/* NOP */;
}
}

state CPlayerStatePlayerDialogScene in CPlayer extends CPlayerStateBase{


private var cachedPrevStateName : CName;
public function OnEnterState(prevStateName : CName) : Bool{
var player : W3PlayerWitcher;
var sign : W3SignEntity;
var horse : CNewNPC;
var scabbardsComp : CAnimatedComponent;
player = (W3PlayerWitcher)parent;
theInput.SetContext('Scene');
parent.EnableHardLock(false);
thePlayer.OnPlayerActionEnd();
if (player){
sign = player.GetCurrentSignEntity();
if (sign){
sign.OnSignAborted(/* NOP */);
}
player.BombThrowAbort();
}
scabbardsComp = (CAnimatedComponent)thePlayer.GetComponent("scab
bards_skeleton");
if (scabbardsComp){
scabbardsComp.SetBehaviorVariable('inScene', 1.000000);
}
player.GetMovingAgentComponent().ResetMoveRequests();
/* NOP */;
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 0);
cachedPrevStateName = prevStateName;
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var scabbardsComp : CAnimatedComponent;
scabbardsComp = (CAnimatedComponent)thePlayer.GetComponent("scab
bards_skeleton");
if (scabbardsComp){
scabbardsComp.SetBehaviorVariable('inScene', 0.000000);
}
parent.rawPlayerHeading = parent.GetHeading();
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 1);
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
var ciri : W3ReplacerCiri;
parent.OnBlockingSceneEnded(output);
parent.RegisterCollisionEventsListener();
if (output){
if (output.action == 1){
if (cachedPrevStateName == 'CombatSteel' || cach
edPrevStateName == 'CombatSilver'){
parent.PopState(false);
}
} else if (output.action == 2){
parent.FindAndMountVehicle(1, 100.000000);
return true;
} else if (output.action == 3){
parent.FindAndMountVehicle(4, 100.000000);
return true;
} else if (output.action == 5){
ciri = (W3ReplacerCiri)thePlayer;
if (ciri){
parent.GotoState('CombatSteel', false, /

* NOP */);
return true;
} else if (GetWitcherPlayer().IsItemEquippedByCa
tegoryName('silversword')){
parent.GotoState('CombatSilver', false,
/* NOP */);
return true;
}
} else if (output.action == 4){
if (GetWitcherPlayer().IsItemEquippedByCategoryN
ame('steelsword')){
parent.GotoState('CombatSteel', false, /
* NOP */);
return true;
}
} else if (output.action == 6){
parent.GotoState('CombatFists', false, /* NOP */
);
return true;
}
}
parent.PopState(true);
/* NOP */;
}
}
state CPlayerStateDrinkingPlayerContestant in CPlayer extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.DisableLookAt();
theSound.EnterGameState(11);
Init();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
theSound.LeaveGameState(11);
/* NOP */;
}
public entry function Init(){
parent.ActivateAndSyncBehavior('drinking_contestant', /* NOP */)
;
/* NOP */;
}
}
state CPlayerStateApproachTheVehicle in CPlayer extends CPlayerStateBase{
private var vehicle : CVehicleComponent;
private var slotNumber : Int32;
public function OnEnterState(prevStateName : CName) : Bool{
parent.BlockAllActions('MountVehicle', true, /* NOP */, true, /*
NOP */, /* NOP */, /* NOP */);
super.OnEnterState(prevStateName);
ProcessApproachTheVehicle();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
LogAssert(!vehicle, "ApproachTheVehicle::OnLeaveState, 'vehicle'
is still set");
vehicle = NULL;
super.OnLeaveState(nextStateName);
/* NOP */;

}
public final function SetupState(v : CVehicleComponent, sn : Int32){
LogAssert(!vehicle, "ApproachTheVehicle::SetupState, 'vehicle' i
s already set");
LogAssert(sn >= 0, "ApproachTheVehicle::SetupState, 'slotNumber'
is not equal or greater then 0");
vehicle = v;
slotNumber = sn;
/* NOP */;
}
public entry function ProcessApproachTheVehicle(){
var actionResult : Bool;
var slotPosition : Vector;
var slotHeading : Float;
var slidingDuration : Float;
var temp : CVehicleComponent;
actionResult = false;
if (vehicle){
vehicle.GetSlotPositionAndHeading(slotNumber, slotPositi
on, slotHeading);
slidingDuration = super.CalcSlidingDuration(slotPosition
);
actionResult = parent.ActionSlideToWithHeading(slotPosit
ion, slotHeading, slidingDuration, /* NOP */);
} else {
LogAssert(vehicle, "ApproachTheVehicle::Process, 'vehicl
e' is not set");
}
temp = vehicle;
vehicle = NULL;
if (actionResult){
if (temp.GetVehicleType() == 0){
(W3HorseComponent)temp.IssueCommandToMount(paren
t, 1, 0);
}
} else {
parent.PopState(true);
}
/* NOP */;
}
protected final function CalcSlidingDuration(destination : Vector) : Flo
at{
return VecDistance(parent.GetWorldPosition(), destination) / 4.0
00000;
/* NOP */;
}
public function CanAccesFastTravel(target : W3FastTravelEntity) : Bool{
if (vehicle){
return vehicle.CanAccesFastTravel(target);
}
return true;
/* NOP */;
}
}
state CPlayerStateDismountBoat in CPlayer extends CPlayerStateDismountTheVehicle
{
public var boatComp : CBoatComponent;
public var remainingSlideDuration : Float;
public var fromPassenger : Bool;

public function OnEnterState(prevStateName : CName) : Bool{


super.OnEnterState(prevStateName);
boatComp = (CBoatComponent)vehicle;
ProcessDismountBoat();
parent.AddTimer('StandUpPositionCorrection', 0.000100, true, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.RemoveTimer('StandUpPositionCorrection', /* NOP */);
theGame.RequestAutoSave("dismounted_boat", false);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public cleanup function DismountCleanup(){
super.DismountCleanup();
parent.SignalGameplayEventParamInt('RidingManagerDismountBoat',
8 | 1024);
/* NOP */;
}
public entry function ProcessDismountBoat(){
var dismountError : Bool;
var riderData : CAIStorageRiderData;
var position : Vector;
var rotQuat : Vector;
dismountError = false;
parent.SetCleanupFunction('DismountCleanup');
dismountType = 1;
riderData = thePlayer.GetRiderData();
parent.SignalGameplayEventParamInt('RidingManagerDismountBoat',
dismountType);
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 3){
break;
}
if (riderData.ridingManagerMountError == true){
parent.PopState(/* NOP */);
break;
}
SleepOneFrame();
}
parent.ClearCleanupFunction();
parent.RemoveTimer('StandUpPositionCorrection', /* NOP */);
boatComp.DismountFinished();
boatComp = NULL;
boatComp.ToggleVehicleCamera(false);
EntityHandleSet(riderData.sharedParams.boat, NULL);
if (parent.IsAlive()){
parent.PopState(true);
}
/* NOP */;
}
public function DismountFromPassenger(fromPass : Bool){
fromPassenger = fromPass;
/* NOP */;
}
public timer function StandUpPositionCorrection(optional timeDelta : Flo
at, optional id : Int32){
var position : Vector;

var rotQuat : Vector;


if (fromPassenger){
boatComp.GetSlotTransform('seat_passenger', position, ro
tQuat);
} else {
boatComp.GetSlotTransform('seat', position, rotQuat);
}
(CR4Player)parent.HACK_BoatDismountPositionCorrection(position);
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
virtual_parent.OnDeath(damageAction);
parent.EnableCollisions(true);
parent.RaiseForceEvent('Death');
/* NOP */;
}
}
state CPlayerStateDismountTheVehicle in CPlayer extends CPlayerStatePostUseVehic
le{
public var vehicle : CVehicleComponent;
public var dismountType : EDismountType;
public function OnEnterState(prevStateName : CName) : Bool{
parent.AddAnimEventCallback('enable_physics', 'OnAnimEvent_enabl
e_physics');
parent.AddAnimEventCallback('disableFeetIK', 'OnAnimEvent_disabl
eFeetIK');
parent.AddAnimEventCallback('enableFeetIK', 'OnAnimEvent_enableF
eetIK');
parent.BlockAllActions('DismountVehicle', true, /* NOP */, true,
/* NOP */, /* NOP */, /* NOP */);
HACK_DeactivatePhysicsRepresentation();
thePlayer.substateManager.m_SharedDataO.ResetHeightFallen();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
LogAssert(!vehicle, "DismountTheVehicle::OnLeaveState, 'vehicle'
is still set");
vehicle = NULL;
super.OnLeaveState(nextStateName);
parent.RegisterCollisionEventsListener();
thePlayer.ResetRawPlayerHeading();
parent.BlockAllActions('DismountVehicle', false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
parent.UnblockAction(33, 'DismountVehicle2');
parent.SetUsedVehicle(NULL);
parent.SetBehaviorVariable('keepSpineUpright', 0.000000, /* NOP
*/);
HACK_ActivatePhysicsRepresentation();
/* NOP */;
}
public final function SetupState(v : CVehicleComponent, inDismountType :
EDismountType){
LogAssert(!vehicle, "DismountTheVehicle::SetupState, 'vehicle' i
s already set");
vehicle = v;
dismountType = inDismountType;
/* NOP */;
}
public cleanup function DismountCleanup(){

vehicle = NULL;
HACK_ActivatePhysicsRepresentation();
/* NOP */;
}
public function ContinuedState(){
parent.PopState(true);
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
moveData.pivotRotationController.SetDesiredHeading(VecHeading(th
eCamera.GetCameraDirection()), /* NOP */);
/* NOP */;
}
public function OnAnimEvent_enable_physics(animEventName : CName, animEv
entType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
HACK_ActivatePhysicsRepresentation();
parent.BreakAttachment();
/* NOP */;
}
public function OnAnimEvent_disableFeetIK(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
public function OnAnimEvent_enableFeetIK(animEventName : CName, animEven
tType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
}
import state CPlayerStateUseVehicle in CPlayer{
public function OnEnterState(prevStateName : CName) : Bool{
}
public function OnLeaveState(nextStateName : CName) : Bool{
}
public function OnVehicleStateTick(dt : Float) : Bool{
}
}
import state CPlayerStatePostUseVehicle in CPlayer{
import public final function HACK_DeactivatePhysicsRepresentation();
import public final function HACK_ActivatePhysicsRepresentation();
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
(CR4Player)parent.OnCombatActionEndComplete();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnVehicleStateTick(dt : Float) : Bool{
}
}
import abstract class CSystemLayerGroup{
}
statemachine class CMajorPlaceOfPowerEntity extends CInteractiveEntity{
public autobind interactionComponent : CInteractionComponent = "activati
onComponent";
public editable var buffType : EShrineBuffs;

public
public
public
public
public
public
public
public
public
public
public
public
public
public

editable var buffUniqueName : String;


editable var fxOnIdle : CName;
editable var fxOnChannel : CName;
editable var fxOnSuccess : CName;
var channelingTime : Float;
var buffDuration : Float;
var buffCooldown : GameTime;
saved var skillPointGranted : Bool;
saved var isRecharging : Bool;
saved var lastUsed : GameTime;
saved var isPlaceOfPowerInIdle : Bool;
saved var voicesetTimestamp : GameTime;
saved var initialVoicesetPlayed : Bool;
function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (spawnData.restored && isRecharging && theGame.GetGameTime()
< lastUsed + super.GetBuffCooldown()){
buffCooldown = lastUsed + super.GetBuffCooldown() - theG
ame.GetGameTime();
GotoState('PlaceOfPower_Recharging', /* NOP */, /* NOP *
/);
} else {
buffCooldown = super.GetBuffCooldown();
GotoStateAuto();
}
/* NOP */;
}
private final function GetBuffCooldown() : GameTime{
return GameTimeCreate(0, 0, 0, CeilF(ConvertRealTimeSecondsToGam
eSeconds(60)));
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator != thePlayer || !thePlayer.CanPerformPlayerAction(
/* NOP */)){
return false;
}
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
GotoState('PlaceOfPower_Channeling', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (isRecharging || GetCurrentStateName() != 'PlaceOfPower_Idle'
){
return false;
} else {
return true;
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var vect : Vector;
var tags : array<CName>;
mapManager = theGame.GetCommonMapManager();
if (area == (CTriggerAreaComponent)GetComponent("VoiceSetTrigger
") && isPlaceOfPowerInIdle && !thePlayer.IsCombatMusicEnabled() && !thePlayer.Is
InNonGameplayCutscene()){

theGame.VibrateController(0, 0.300000, 1.000000);


GetWitcherPlayer().GetMedallion().Activate(true, 5.00000
0);
if (CanPlayVoiceSet()){
thePlayer.PlayVoiceset(100, 'DetectPlaceOfPower'
, /* NOP */);
voicesetTimestamp = theGame.GetGameTime();
initialVoicesetPlayed = true;
}
}
if (area == (CTriggerAreaComponent)GetComponent("FirstDiscoveryT
rigger") && activator.GetEntity() == thePlayer){
GetComponent("FirstDiscoveryTrigger").SetEnabled(false);
mapManager.SetEntityMapPinDiscoveredScript(false, entity
Name, true);
}
/* NOP */;
}
public function CanPlayVoiceSet() : Bool{
if (thePlayer.IsSpeaking(/* NOP */)){
return false;
} else if (!initialVoicesetPlayed){
return true;
} else if (theGame.GetGameTime() > voicesetTimestamp + GameTimeC
reate(0, 0, 0, CeilF(ConvertRealTimeSecondsToGameSeconds(120)))){
return true;
} else {
return false;
}
/* NOP */;
}
}
class CPopsGasEntity extends CInteractiveEntity{
public editable var restorationTime : Float;
public editable var settlingTime : Float;
public editable var fxOnSpawn : CName;
public editable var immunityFact : String;
public var i : Int32;
public var settled : Bool;
public var victim : CActor;
public var victims : array<CActor>;
public var poisonArea : CTriggerAreaComponent;
public var buffParams : SCustomEffectParams;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
poisonArea = (CTriggerAreaComponent)GetComponent('PoisonArea');
super.Enable(bIsEnabled);
/* NOP */;
}
public final function Enable(flag : Bool){
if (poisonArea){
poisonArea.SetEnabled(flag);
}
Spawn(flag);
/* NOP */;
}
public final function Spawn(flag : Bool){
if (flag){
PlayEffect(fxOnSpawn, /* NOP */);
AddTimer('Settle', settlingTime, /* NOP */, /* NOP */, /

* NOP */, /* NOP */, /* NOP */);


} else {
StopEffect(fxOnSpawn);
RemoveTimer('Settle', /* NOP */);
}
/* NOP */;
}
public timer function Settle(optional deltaTime : Float, optional id : I
nt32){
settled = true;
if (poisonArea){
poisonArea.SetEnabled(true);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (FactsQuerySum(immunityFact) > 0 && activator.GetEntity() ==
thePlayer){
return false;
}
victim = (CActor)activator.GetEntity();
if (victim){
if ((CR4Player)victim){
victim.PlayVoiceset(100, "coughing", /* NOP */);
}
victims.PushBack(victim);
if (victims.Size() == 1){
if (buffParams.effectType == 0){
buffParams.effectType = 15;
buffParams.creator = this;
buffParams.duration = 1.000000;
buffParams.sourceName = "PopsGasAfflicti
on";
}
AddTimer('PoisonVictim', 0.100000, true, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
victim = (CActor)activator.GetEntity();
if (victim && victims.Contains(victim)){
victims.Remove(victim);
if (victims.Size() == 0){
RemoveTimer('PoisonVictim', /* NOP */);
}
}
/* NOP */;
}
public timer function Restore(optional deltaTime : Float, optional id :
Int32){
super.Spawn(bIsEnabled);
/* NOP */;
}
public timer function PoisonVictim(optional deltaTime : Float, optional
id : Int32){
var i : Int32;

i = 0;
while (i < victims.Size()){
victims[i].AddEffectCustom(buffParams);
i += 1;
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
if (bIsEnabled && settled){
settled = false;
if (poisonArea){
poisonArea.SetEnabled(false);
}
victims.Clear();
StopAllEffects();
AddTimer('Restore', restorationTime, /* NOP */, /* NOP *
/, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
}
state CRiftEntityStateOpened in CRiftEntity extends CScriptableState{
public var enableEncounterOnStart : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.currState = 'Opened';
parent.PlayEffect('rift_activate', /* NOP */);
parent.CreateCollisionEntity();
OpenRift();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
enableEncounterOnStart = true;
/* NOP */;
}
public entry function OpenRift(){
Sleep(parent.activationDelay);
if (enableEncounterOnStart){
parent.EnableEncounter(true);
}
parent.EnableColdArea(true);
if (parent.closeAfter != -1){
parent.AddTimer('DeactivateRiftAfter', parent.closeAfter
, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
}
parent.OnDiscovered(true);
/* NOP */;
}
public function OnOpenedRiftCheck() : Bool{
return true;
/* NOP */;
}
public function DontEnableEncounterOnStart(){
enableEncounterOnStart = false;
/* NOP */;
}
}

class W3SmellyCheese extends W3AirDrainEntity{


public editable var deactivatedByAard : Bool;
public editable var smellEffectName : CName;
public editable var aardedEffectName : CName;
public editable var reactivateTimer : Float;
public saved var deactivated : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (deactivated){
PlayEffect(aardedEffectName, /* NOP */);
GetComponent('CheeseSmell').SetEnabled(false);
} else {
PlayEffect(smellEffectName, /* NOP */);
GetComponent('CheeseSmell').SetEnabled(true);
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
if (!deactivated && deactivatedByAard){
super.OnAardHit(sign);
StopEffect(smellEffectName);
PlayEffect(aardedEffectName, /* NOP */);
GetComponent('CheeseSmell').SetEnabled(false);
deactivated = true;
if (reactivateTimer > 0.000000){
AddTimer('ReactivateVisuals', reactivateTimer, f
alse, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public timer function ReactivateVisuals(optional delta : Float, optional
id : Int32){
StopEffect(aardedEffectName);
PlayEffect(smellEffectName, /* NOP */);
AddTimer('ReactivateLogic', 0.650000, false, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function ReactivateLogic(optional delta : Float, optional i
d : Int32){
GetComponent('CheeseSmell').SetEnabled(true);
deactivated = false;
/* NOP */;
}
}
class CInteractiveEntity extends CR4MapPinEntity{
protected editable saved var bIsEnabled : Bool;
protected var bIsActive : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
Init();
/* NOP */;
}
public function Init(){
Activate(bIsEnabled);
/* NOP */;
}
public function Activate(flag : Bool){
bIsActive = flag;
/* NOP */;

}
public function EnableEntity(flag : Bool){
bIsEnabled = flag;
Init();
/* NOP */;
}
}
import abstract class SBehaviorGraphAnimatedRagdollDirDefinition{
}
class W3SnowMound extends CInteractiveEntity{
public editable var TagRemovedAfterMelt : CName;
private var isMelted : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
if (!HasTag(theGame.params.TAG_SOFT_LOCK)){
AddTag(theGame.params.TAG_SOFT_LOCK);
}
if (!HasTag('softLock_Igni')){
AddTag('softLock_Igni');
}
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
PlayEffect('igni', /* NOP */);
MeltSnow();
super.OnIgniHit(sign);
/* NOP */;
}
protected function MeltSnow(){
if (isMelted){
return;
}
ApplyAppearance("02_puddle");
RemoveTag(TagRemovedAfterMelt);
RemoveTag(theGame.params.TAG_SOFT_LOCK);
RemoveTag('softLock_Igni');
/* NOP */;
}
}
state W3ToxicCloudStateArmed in W3ToxicCloud extends CScriptableState{
private var isExploding : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
var area : CTriggerAreaComponent;
var actors : array<CActor>;
var i : Int32;
isExploding = false;
area = parent.GetPoisonAreaUnsafe();
area.SetEnabled(true);
if (area && area.TestEntityOverlap(thePlayer)){
parent.SetCanBeTargeted(false);
} else {
parent.SetCanBeTargeted(true);
}
actors = parent.GetActorsInPoisonRange();
i = 0;
while (i < actors.Size()){
if (actors[i].HasTag(theGame.params.TAG_OPEN_FIRE)){

Explode(actors[i]);
}
i += 1;
}
if (parent.IsActorInPoisonRange(thePlayer)){
parent.SetCanBeTargeted(false);
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
if (isExploding){
return true;
}
parent.OnFireHit(source);
if ((W3ToxicCloud)source){
parent.chainedExplosion = true;
}
Explode(source);
/* NOP */;
}
public function Explode(source : CEntity){
var i : Int32;
var entitiesInRange : array<CGameplayEntity>;
var damage : W3DamageAction;
var actor : CActor;
var dmgVal : Float;
isExploding = true;
actor = (CActor)source;
if (actor && actor.HasBuff(18) && parent.IsFromBomb()){
theGame.GetGamerProfile().IncStat(7);
}
parent.StopAllEffects();
parent.StopPoisonTimer();
parent.PlayEffectSingle(parent.fxOnExplode, /* NOP */);
GCameraShake(0.500000, true, parent.GetWorldPosition(), parent.G
etCamShakeRadius(), /* NOP */, /* NOP */, /* NOP */);
entitiesInRange = parent.GetEntitiesInExplosionRange();
entitiesInRange.Remove(parent);
i = 0;
while (i < entitiesInRange.Size()){
if ((W3SignEntity)entitiesInRange[i] || (W3SignProjectil
e)entitiesInRange[i]){
} else {
actor = (CActor)entitiesInRange[i];
if (actor){
damage = new W3DamageAction in parent;
damage.Initialize(parent, entitiesInRang
e[i], parent, parent, 0, 2, false, false, false, true, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
dmgVal = parent.explosionDamage.valueAdd
itive + parent.explosionDamage.valueMultiplicative * actor.GetMaxHealth();
damage.AddDamage(theGame.params.DAMAGE_N
AME_FIRE, dmgVal);
damage.AddEffectInfo(10, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
damage.SetSuppressHitSounds(true);
if (RandF() < parent.burningChance){
damage.AddEffectInfo(18, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}

theGame.damageMgr.ProcessAction(damage);
delete damage;
} else {
entitiesInRange[i].OnFireHit(parent);
}
}
i += 1;
}
parent.GotoState('Wait', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
parent.StopAllEffects();
parent.OnAardHit(sign);
parent.GotoState('Wait', /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class SBehaviorGraphAnimatedRagdollDirReplacement{
}
class W3EffectItem extends CItemEntity{
public editable var effectName : CName;
public function OnGrab() : Bool{
if (effectName != 'None'){
DestroyEffect(effectName);
PlayEffectSingle(effectName, this);
}
super.OnGrab();
/* NOP */;
}
public function OnPut() : Bool{
if (effectName != 'None'){
StopEffectIfActive(effectName);
}
super.OnPut();
/* NOP */;
}
}
class W3LightSource extends W3UsableItem{
public function OnUsed(usedBy : CEntity) : Bool{
blockedActions.PushBack(31);
blockedActions.PushBack(45);
super.OnUsed(usedBy);
thePlayer.UnblockAction(0, 'UsableItem');
PlayEffect('light_on', /* NOP */);
thePlayer.AddTag(theGame.params.TAG_OPEN_FIRE);
/* NOP */;
}
public function OnHidden(usedBy : CEntity) : Bool{
thePlayer.RemoveTag(theGame.params.TAG_OPEN_FIRE);
super.OnHidden(usedBy);
StopEffect('light_on');
/* NOP */;
}
}
class W3QuestUsableItem extends W3UsableItem{

public
public
public
public
public

editable var factAddedOnUse : String;


editable var factValue : Int32;
editable var factTimeValid : Int32;
editable var removeFactOnHide : Bool;
function OnUsed(usedBy : CEntity) : Bool{
super.OnUsed(usedBy);
FactsAdd(factAddedOnUse, factValue, factTimeValid);
/* NOP */;

}
public function OnHidden(hiddenBy : CEntity) : Bool{
super.OnHidden(hiddenBy);
if (removeFactOnHide){
FactsRemove(factAddedOnUse);
}
/* NOP */;
}
}
class W3MagicOilLamp extends W3QuestUsableItem{
public function OnUsed(usedBy : CEntity) : Bool{
super.OnUsed(usedBy);
PlayEffect('light_on', /* NOP */);
/* NOP */;
}
public function OnHidden(usedBy : CEntity) : Bool{
super.OnHidden(usedBy);
StopEffect('light_on');
/* NOP */;
}
}
class W3Potestaquisitor extends W3QuestUsableItem{
public editable var detectableTag : CName;
public editable var detectableRange : Float;
public editable var closestRange : Float;
public editable var potestaquisitorFact : String;
public editable var soundEffectType : EFocusModeSoundEffectType;
public editable var effect : CName;
public var registeredAnomalies : array<CGameplayEntity>;
public var previousClosestAnomaly : CGameplayEntity;
public function OnUsed(usedBy : CEntity) : Bool{
PlayEffect(effect, /* NOP */);
StartScanningAnomalies(true);
super.OnUsed(usedBy);
/* NOP */;
}
public function OnHidden(hiddenBy : CEntity) : Bool{
StopEffect(effect);
StartScanningAnomalies(false);
super.OnHidden(hiddenBy);
/* NOP */;
}
private function StartScanningAnomalies(shouldStart : Bool){
if (shouldStart){
registeredAnomalies.Clear();
ScanningAnomalies(0.000000, /* NOP */);
AddTimer('ScanningAnomalies', 0.500000, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
} else {
RemoveTimer('ScanningAnomalies', /* NOP */);

StopScanningAnomalies();
}
/* NOP */;
}
private timer function ScanningAnomalies(optional dt : Float, optional i
d : Int32){
var i : Int32;
var closestAnomalyIndex : Int32;
var registeredAnomaliesSize : Int32;
var foundAnomaliesSize : Int32;
var foundAnomalies : array<CGameplayEntity>;
var foundAnomaliesDistances : array<Float>;
var currentClosestAnomaly : CGameplayEntity;
var dist : Float;
FindGameplayEntitiesInRange(foundAnomalies, thePlayer, detectabl
eRange, 100000, detectableTag, /* NOP */, /* NOP */, /* NOP */);
foundAnomaliesSize = foundAnomalies.Size();
i = 0;
while (i < foundAnomaliesSize){
if (!registeredAnomalies.Contains(foundAnomalies[i])){
registeredAnomalies.PushBack(foundAnomalies[i]);
foundAnomalies[i].SetFocusModeSoundEffectType(so
undEffectType);
foundAnomalies[i].SoundEvent("qu_nml_401_vacuum_
detector_loop_start", /* NOP */, /* NOP */);
}
i += 1;
}
i = 0;
while (i < registeredAnomaliesSize){
if (!registeredAnomalies[i].HasTag(detectableTag)){
registeredAnomalies.Remove(registeredAnomalies[i
]);
}
i += 1;
}
registeredAnomaliesSize = registeredAnomalies.Size();
foundAnomaliesDistances.Resize(registeredAnomaliesSize);
if (registeredAnomaliesSize > 0){
i = registeredAnomaliesSize - 1;
while (i > -1){
if (!registeredAnomalies[i].HasTag(detectableTag
)){
registeredAnomalies.Remove(registeredAno
malies[i]);
}
i -= 1;
}
foundAnomaliesSize = foundAnomalies.Size();
i = 0;
while (i < registeredAnomaliesSize){
foundAnomaliesDistances[i] = VecDistance(registe
redAnomalies[i].GetWorldPosition(), GetWorldPosition());
i += 1;
}
closestAnomalyIndex = ArrayFindMinF(foundAnomaliesDistan
ces);
currentClosestAnomaly = registeredAnomalies[closestAnoma
lyIndex];
dist = foundAnomaliesDistances[closestAnomalyIndex];

if (previousClosestAnomaly.GetName() != currentClosestAn
omaly.GetName()){
previousClosestAnomaly.StopAllEffects();
previousClosestAnomaly.SoundEvent("qu_nml_401_va
cuum_detector_intensity_1", /* NOP */, /* NOP */);
FactsRemove(potestaquisitorFact);
}
if (dist < detectableRange){
if (dist > detectableRange * 0.750000){
if (FactsQuerySum(potestaquisitorFact) !
= 1){
FactsSet(potestaquisitorFact, 1,
-1);
}
currentClosestAnomaly.SoundEvent("qu_nml
_401_vacuum_detector_intensity_1", /* NOP */, /* NOP */);
UpdateEffect('signal_01');
} else if (dist > detectableRange * 0.500000){
if (FactsQuerySum(potestaquisitorFact) !
= 2){
FactsSet(potestaquisitorFact, 2,
-1);
}
currentClosestAnomaly.SoundEvent("qu_nml
_401_vacuum_detector_intensity_2", /* NOP */, /* NOP */);
UpdateEffect('signal_02');
} else if (dist > detectableRange * 0.250000){
if (FactsQuerySum(potestaquisitorFact) !
= 3){
FactsSet(potestaquisitorFact, 3,
-1);
}
currentClosestAnomaly.SoundEvent("qu_nml
_401_vacuum_detector_intensity_3", /* NOP */, /* NOP */);
PlayEffect('signal_03', /* NOP */);
} else if (dist > closestRange){
if (FactsQuerySum(potestaquisitorFact) !
= 4){
FactsSet(potestaquisitorFact, 4,
-1);
}
currentClosestAnomaly.SoundEvent("qu_nml
_401_vacuum_detector_intensity_4", /* NOP */, /* NOP */);
UpdateEffect('signal_04');
} else {
if (FactsQuerySum(potestaquisitorFact) !
= 5){
FactsSet(potestaquisitorFact, 5,
-1);
}
currentClosestAnomaly.SoundEvent("qu_nml
_401_vacuum_detector_intensity_5", /* NOP */, /* NOP */);
UpdateEffect('signal_activated');
}
} else if (FactsDoesExist(potestaquisitorFact)){
FactsRemove(potestaquisitorFact);
}
previousClosestAnomaly = currentClosestAnomaly;
}
/* NOP */;

}
private function UpdateEffect(effectName : CName){
StopAllEffects();
PlayEffect(effectName, /* NOP */);
/* NOP */;
}
private function StopScanningAnomalies(){
var i : Int32;
var soundOffEffectType : EFocusModeSoundEffectType;
i = 0;
while (i < registeredAnomalies.Size()){
soundOffEffectType = 3;
registeredAnomalies[i].SetFocusModeSoundEffectType(sound
OffEffectType);
registeredAnomalies[i].SoundEvent("qu_nml_401_vacuum_det
ector_loop_stop", /* NOP */, /* NOP */);
i += 1;
}
FactsRemove(potestaquisitorFact);
/* NOP */;
}
}
statemachine class W3AardObstacle extends CInteractiveEntity{
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (!spawnData.restored){
GotoStateAuto();
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
super.OnAardHit(sign);
/* NOP */;
}
}
class W3BuffImmunityEntity extends CGameplayEntity{
public editable var immunities : array<EEffectType>;
public editable saved var range : Float;
public editable saved var isActive : Bool;
protected var actorsInRange : array<CActor>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (isActive){
AddTimer('UpdateActors', 0.500000, true, /* NOP */, /* N
OP */, true, /* NOP */);
}
super.OnSpawned(spawnData);
/* NOP */;
}
public function ToggleActivate(toggle : Bool){
if (toggle && !isActive){
AddTimer('UpdateActors', 0.500000, true, /* NOP */, /* N
OP */, true, /* NOP */);
} else if (!toggle && isActive){
RemoveTimer('UpdateActors', /* NOP */);
RemoveImmunityFromActorsInRange();
}
isActive = toggle;
/* NOP */;
}

public timer function UpdateActors(optional dt : Float, optional id : In


t32){
var entities : array<CGameplayEntity>;
var newActors : array<CActor>;
var actor : CActor;
var index : Int32;
var i : Int32;
var size : Int32;
FindGameplayEntitiesInSphere(entities, GetWorldPosition(), range
, -1, 'None', 4, /* NOP */, /* NOP */);
size = entities.Size();
i = 0;
while (i < size){
actor = (CActor)entities[i];
if (actor){
index = actorsInRange.FindFirst(actor);
if (index != -1){
actorsInRange.EraseFast(index);
} else {
ToggleBuffImmunity(actor, true);
}
newActors.PushBack(actor);
}
i += 1;
}
RemoveImmunityFromActorsInRange();
actorsInRange = newActors;
/* NOP */;
}
private function RemoveImmunityFromActorsInRange(){
var i : Int32;
var size : Int32;
size = actorsInRange.Size();
i = 0;
while (i < size){
ToggleBuffImmunity(actorsInRange[i], false);
i += 1;
}
/* NOP */;
}
protected function ToggleBuffImmunity(actor : CActor, toggle : Bool){
var i : Int32;
i = 0;
while (i < immunities.Size()){
if (toggle){
actor.AddBuffImmunity(immunities[i], 'BuffImmuni
tyInteractiveEntity', true);
} else {
actor.RemoveBuffImmunity(immunities[i], 'BuffImm
unityInteractiveEntity');
}
i += 1;
}
/* NOP */;
}
}
class W3CombatDamageEntity extends CInteractiveEntity{
public var victims : array<CActor>;
public var victim : CActor;

public var isActive : Bool;


public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
area = (CTriggerAreaComponent)GetComponent("SpikyRocks");
victim = (CActor)activator.GetEntity();
victim.AddEffectDefault(18, this, 'environment', /* NOP */);
/* NOP */;
}
}
statemachine class W3FlammableDamageEntity extends CInteractiveEntity{
public editable var explosionEntity : CEntityTemplate;
public var spawnedExplosion : CDamageAreaEntity;
public var victim : CActor;
public var pos : Vector;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (!spawnData.restored){
GotoStateAuto();
}
/* NOP */;
}
public function SpawnDamageArea(){
spawnedExplosion = (CDamageAreaEntity)theGame.CreateEntity(explo
sionEntity, pos, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/);
/* NOP */;
}
public function PlayBurningEffect(){
var burningTime : Float;
burningTime = RandRangeF(80.000000, 32.000000);
PlayEffect('burning_fx', /* NOP */);
AddTimer('TurnOnFireFading', burningTime, /* NOP */, /* NOP */,
/* NOP */, true, /* NOP */);
/* NOP */;
}
public timer function TurnOnFireFading(optional deltaTime : Float, optio
nal id : Int32){
PlayEffect('smoke_fx', /* NOP */);
StopEffect('burning_fx');
spawnedExplosion.Destroy();
/* NOP */;
}
}
statemachine class W3DestroyableTerrain extends CInteractiveEntity{
public var m_destroyableElements : array<array<CScriptedDestroyableCompo
nent>>;
public var m_piecesIdToSplit : array<Int32>;
public var m_player : CPlayer;
public var m_activated : Bool;
public var m_componentName : String;
public var m_randNumber : Int32;
public var tickTime : Float;
public var tickInterval : Float;
public var currRandNumbId : Int32;
public var currRandNumbTime : Float;
private editable var m_numOfPiecesToDestroy : Int32;
private editable var m_timeBetweenRandomDestroyMin : Int32;
private editable var m_timeBetweenRandomDestroyMax : Int32;
public function GetDestroyableElement(type : Int32, id : Int32) : CScrip

tedDestroyableComponent{
return m_destroyableElements[type][id];
/* NOP */;
}
public function GetDestroyableElements(type : Int32) : array<CScriptedDe
stroyableComponent>{
return m_destroyableElements[type];
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tmpString : String;
var i : Int32;
var destroyWay : EDestroyWay;
var destroyComp : CScriptedDestroyableComponent;
var m_destroyableElementsRandom : array<CScriptedDestroyableComp
onent>;
var m_destroyableElementsTimed : array<CScriptedDestroyableCompo
nent>;
var m_destroyableElementsOnContact : array<CScriptedDestroyableC
omponent>;
var m_destroyableElementsOnDistance : array<CScriptedDestroyable
Component>;
if (!spawnData.restored){
}
i = 0;
while (i < m_numOfPiecesToDestroy){
tmpString = m_componentName + i;
destroyComp = (CScriptedDestroyableComponent)GetComponen
t(tmpString);
destroyWay = destroyComp.GetDestroyWay();
switch(destroyWay){
case 0:
m_destroyableElementsRandom.PushBack(destroyComp
);
break;
case 1:
m_destroyableElementsTimed.PushBack(destroyComp)
;
break;
case 2:
m_destroyableElementsOnContact.PushBack(destroyC
omp);
break;
case 3:
m_destroyableElementsOnDistance.PushBack(destroy
Comp);
break;
}
i += 1;
}
currRandNumbId = 1;
currRandNumbTime = RandRange(m_timeBetweenRandomDestroyMax, /* N
OP */);
m_destroyableElements.PushBack(m_destroyableElementsRandom);
m_destroyableElements.PushBack(m_destroyableElementsTimed);
m_destroyableElements.PushBack(m_destroyableElementsOnContact);
m_destroyableElements.PushBack(m_destroyableElementsOnDistance);
m_randNumber = RandRange(m_timeBetweenRandomDestroyMax, /* NOP *
/);
AddTimer('updateTick', tickInterval, true, /* NOP */, /* NOP */,

/* NOP */, /* NOP */);


/* NOP */;
}
public timer function updateTick(optional time : Float, optional id : In
t32){
var i : Int32;
var dist : Float;
var comp : CScriptedDestroyableComponent;
var elements : array<CScriptedDestroyableComponent>;
if (m_activated){
tickTime += time;
elements = m_destroyableElements[0];
i = 0;
while (i < elements.Size()){
comp = elements[i];
dist = VecDistance(comp.GetWorldPosition(), theP
layer.GetWorldPosition());
if (tickTime > currRandNumbTime && currRandNumbI
d == i && elements[i].m_state == 0){
elements[i].m_state = 1;
} else if (elements[i].m_state == 1){
elements[i].PreDestroyTick(time);
} else if (elements[i].m_state == 2){
elements[i].DestroyTick(time);
} else if (elements[i].m_state == 3){
elements[i].PostDestroyTick(time);
if (currRandNumbId == i){
currRandNumbId = RandRange(eleme
nts.Size(), /* NOP */);
currRandNumbTime = tickTime + Ra
ndRange(m_timeBetweenRandomDestroyMax, /* NOP */);
}
} else {
elements[i].IdleTick(time);
}
i += 1;
}
elements = m_destroyableElements[1];
i = 0;
while (i < elements.Size()){
comp = elements[i];
dist = VecDistance(comp.GetWorldPosition(), theP
layer.GetWorldPosition());
if (tickTime < elements[i].GetDestroyAtTimeValue
() && elements[i].m_state == 0){
elements[i].m_state = 1;
} else if (elements[i].m_state == 1){
elements[i].PreDestroyTick(time);
} else if (elements[i].m_state == 2){
elements[i].DestroyTick(time);
} else if (elements[i].m_state == 3){
elements[i].PostDestroyTick(time);
} else {
elements[i].IdleTick(time);
}
i += 1;
}
elements = m_destroyableElements[2];
i = 0;
while (i < elements.Size()){

comp = elements[i];
dist = VecDistance(comp.GetWorldPosition(), theP
layer.GetWorldPosition());
if (dist < 1.500000 && elements[i].m_state == 0)
{
elements[i].m_state = 1;
} else if (elements[i].m_state == 1){
elements[i].PreDestroyTick(time);
} else if (elements[i].m_state == 2){
elements[i].DestroyTick(time);
} else if (elements[i].m_state == 3){
elements[i].PostDestroyTick(time);
} else {
elements[i].IdleTick(time);
}
i += 1;
}
elements = m_destroyableElements[3];
i = 0;
while (i < elements.Size()){
comp = elements[i];
dist = VecDistance(comp.GetWorldPosition(), theP
layer.GetWorldPosition());
if (dist < elements[i].GetDistanceToTargetValue(
) && elements[i].m_state == 0){
elements[i].m_state = 1;
} else if (m_destroyableElements[3][i].m_state =
= 1){
elements[i].PreDestroyTick(time);
} else if (elements[i].m_state == 2){
elements[i].DestroyTick(time);
} else if (elements[i].m_state == 3){
elements[i].PostDestroyTick(time);
} else {
elements[i].IdleTick(time);
}
i += 1;
}
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
m_activated = true;
tickTime = 0;
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
}
}
state W3DestroyableTerrainStateOnIdle in W3DestroyableTerrain extends CScriptabl
eState{
public function OnEnterState(prevStateName : CName) : Bool{
}
public function OnLeaveState(prevStateName : CName) : Bool{
}
}

statemachine class W3Bridge extends W3DestroyableTerrain{


public var m_currentFxID : Int32;
private var entryTime : Float;
private var timerInterval : Float;
public var rot : EulerAngles;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
m_componentName = "CBridgePiece";
super.OnSpawned(spawnData);
AddTimer('tickTimer', timerInterval, true, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
GotoStateAuto();
/* NOP */;
}
public timer function tickTimer(optional time : Float, optional id : Int
32){
var floatHeadingCross : Vector;
var playerHeading : Vector;
var mpac : CMovingPhysicalAgentComponent;
var dir : Vector;
var pos : Vector;
var diff : Vector;
var arrowA : Vector;
var arrowB : Vector;
var rotAngle : Float;
var side : Int32;
var offset : Vector;
var slideDir : Vector;
var mat : Matrix;
entryTime += time;
rot = GetWorldRotation();
rot.Yaw = 0;
rot.Pitch = SinF(entryTime * 2);
pos = GetWorldPosition();
if (m_player){
mpac = (CMovingPhysicalAgentComponent)m_player.GetMoving
AgentComponent();
slideDir.X = 0;
slideDir.Z = 0.010000;
slideDir.Y = -rot.Pitch;
pos = mpac.GetAgentPosition();
pos.Z += 0.100000;
mpac.ApplyVelocity(slideDir);
mpac.SetRotation(rot);
}
TeleportWithRotation(GetWorldPosition(), rot);
/* NOP */;
}
public function Split(){
var pieceID : Int32;
var comp : CFloePiece;
comp = (CFloePiece)GetDestroyableElement(0, m_currentFxID - 1);
comp.DestroyTick(0);
m_currentFxID = m_currentFxID + 1;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
super.OnAreaEnter(area, activator);
PushState('OnPreDestroy');
/* NOP */;

}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
super.OnAreaExit(area, activator);
/* NOP */;
}
}
state W3DestroyableTerrainStateOnPreDestroy in W3DestroyableTerrain extends CScr
iptableState{
public function OnEnterState(prevStateName : CName) : Bool{
}
public function OnLeaveState(prevStateName : CName) : Bool{
}
}
state W3DestroyableTerrainStateOnDestroy in W3DestroyableTerrain extends CScript
ableState{
public function OnEnterState(prevStateName : CName) : Bool{
}
public function OnLeaveState(prevStateName : CName) : Bool{
}
}
struct SAardAspect{
editable var
editable var
editable var
editable var
editable var
editable var
}

projTemplate : CEntityTemplate;
cone : Float;
distance : Float;
distanceUpgrade1 : Float;
distanceUpgrade2 : Float;
distanceUpgrade3 : Float;

class W3EntitySpawner extends W3UsableEntity{


public editable var entityTemplate : CEntityTemplate;
public editable var appearanceAfterSpawn : CName;
public editable var autoSpawn : Bool;
public editable var spawnDelay : Float;
public editable var numberOfUses : Int32;
public editable var spawnNearPlayer : Bool;
public editable var avoidNodeWithTag : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (autoSpawn){
if (spawnDelay > 0.000000){
AddTimer('TimerSpawnEntity', spawnDelay, false,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
super.OnSpawned(spawnData);
/* NOP */;
}
public function CanBeUsed() : Bool{
return numberOfUses != 0;
/* NOP */;
}
public timer function TimerSpawnEntity(optional td : Float, optional id
: Int32){
UseEntity();
/* NOP */;
}

public function UseEntity(){


var spawnPosition : Vector;
var storedZ : Float;
var nodeToAvoid : CNode;
var nodePosition : Vector;
var normalizedToNodeDir : Vector;
var distance : Float;
spawnPosition = GetWorldPosition();
storedZ = spawnPosition.Z;
if (entityTemplate){
if (numberOfUses != 0){
if (spawnNearPlayer){
spawnPosition = thePlayer.GetWorldPositi
on() + VecRingRand(0.000000, 7.000000);
}
nodeToAvoid = theGame.GetNodeByTag(avoidNodeWith
Tag);
if (nodeToAvoid){
nodePosition = nodeToAvoid.GetWorldPosit
ion();
spawnPosition.Z = nodePosition.Z;
distance = VecDistance2D(spawnPosition,
nodePosition);
if (distance < 3.000000){
normalizedToNodeDir = VecNormali
ze2D(thePlayer.GetWorldPosition() - nodePosition);
spawnPosition = nodePosition + 3
.000000 * normalizedToNodeDir;
}
}
spawnPosition.Z = storedZ;
theGame.CreateEntity(entityTemplate, spawnPositi
on, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (numberOfUses > 0){
numberOfUses -= 1;
}
}
if (appearanceAfterSpawn != 'None' && numberOfUses == 0){
ApplyAppearance(appearanceAfterSpawn);
}
/* NOP */;
}
}
struct SAardEffects{
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var
editable var

baseCommonThrowEffect : CName;
baseCommonThrowEffectUpgrade1 : CName;
baseCommonThrowEffectUpgrade2 : CName;
baseCommonThrowEffectUpgrade3 : CName;
throwEffectSoil : CName;
throwEffectSoilUpgrade1 : CName;
throwEffectSoilUpgrade2 : CName;
throwEffectSoilUpgrade3 : CName;
throwEffectSPNoUpgrade : CName;
throwEffectSPUpgrade1 : CName;
throwEffectSPUpgrade2 : CName;
throwEffectSPUpgrade3 : CName;
throwEffectDmgNoUpgrade : CName;
throwEffectDmgUpgrade1 : CName;

editable
editable
editable
editable
editable
editable
editable

var
var
var
var
var
var
var

throwEffectDmgUpgrade2 : CName;
throwEffectDmgUpgrade3 : CName;
throwEffectWater : CName;
throwEffectWaterUpgrade1 : CName;
throwEffectWaterUpgrade2 : CName;
throwEffectWaterUpgrade3 : CName;
cameraShakeStrength : Float;

}
import abstract class CSeatComponent{
}
statemachine class W3FloeEntity extends W3DestroyableTerrain{
public var m_currentFxID : Int32;
private var entryTime : Float;
private var timerInterval : Float;
public var rot : EulerAngles;
public function EnableEffectOne(stop : Bool){
if (!stop){
StopEffect('fire1');
} else {
PlayEffect('fire1', /* NOP */);
}
/* NOP */;
}
public function EnableEffectTwo(stop : Bool){
if (!stop){
StopEffect('fire2');
} else {
PlayEffect('fire2', /* NOP */);
}
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
m_componentName = "CFloePiece";
super.OnSpawned(spawnData);
AddTimer('tickTimer', timerInterval, true, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
GotoStateAuto();
/* NOP */;
}
public timer function tickTimer(optional time : Float, optional id : Int
32){
var floatHeadingCross : Vector;
var playerHeading : Vector;
var mpac : CMovingPhysicalAgentComponent;
var dir : Vector;
var pos : Vector;
var diff : Vector;
var arrowA : Vector;
var arrowB : Vector;
var rotAngle : Float;
var side : Int32;
var offset : Vector;
var slideDir : Vector;
var mat : Matrix;
entryTime += time;
rot = GetWorldRotation();
rot.Yaw = 0;
rot.Pitch = SinF(entryTime * 2) * 0.500000;

pos = GetWorldPosition();
if (m_player){
mpac = (CMovingPhysicalAgentComponent)m_player.GetMoving
AgentComponent();
}
/* NOP */;
}
public function Split(){
var pieceID : Int32;
var comp : CFloePiece;
comp = (CFloePiece)GetDestroyableElement(0, m_currentFxID - 1);
comp.DestroyTick(0);
if (m_currentFxID == 1){
EnableEffectOne(false);
} else if (m_currentFxID == 2){
EnableEffectTwo(false);
}
m_currentFxID = m_currentFxID + 1;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
super.OnAreaEnter(area, activator);
PushState('OnPreDestroy');
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
super.OnAreaExit(area, activator);
/* NOP */;
}
}
statemachine class W3IgniObstacleEntity extends CInteractiveEntity{
public var staticIgniObstacle : CComponent;
public var iceWallStage1 : CDrawableComponent;
public var iceWallStage2 : CDrawableComponent;
public var iceWallStage2Melted : CDrawableComponent;
public var iceWallStage3 : CDrawableComponent;
public var iceWallStage3Melted : CDrawableComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (!spawnData.restored){
GotoStateAuto();
}
Init();
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
}
public function Init(){
staticIgniObstacle = GetComponent("StaticIgniObstacle");
iceWallStage1 = (CDrawableComponent)GetComponent("IceWallStage1"
);
iceWallStage2 = (CDrawableComponent)GetComponent("IceWallStage2"
);
iceWallStage2Melted = (CDrawableComponent)GetComponent("IceWallS
tage2Melted");
iceWallStage3 = (CDrawableComponent)GetComponent("IceWallStage3"
);
iceWallStage3Melted = (CDrawableComponent)GetComponent("IceWallS

tage3Melted");
/* NOP */;
}
}
class CUsableEntity extends CInteractiveEntity{
protected editable var bCanBeUsed : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
/* NOP */;
}
public function Init(){
EnableInteraction(bCanBeUsed);
super.Init();
/* NOP */;
}
public function Activate(flag : Bool){
super.Activate(flag);
/* NOP */;
}
public function EnableInteraction(flag : Bool){
var interactionComponent : CInteractionComponent;
interactionComponent = (CInteractionComponent)GetComponentByClas
sName('CInteractionComponent');
if (interactionComponent){
interactionComponent.SetEnabled(flag);
}
/* NOP */;
}
}
class CScheduledUsableEntity extends CUsableEntity{
public editable var bUseSwitchingSchedule : Bool;
public editable var switchOnHour : Int32;
public editable var switchOffHour : Int32;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (actionName == "Interact"){
if (bIsActive){
Activate(false);
} else {
Activate(true);
}
}
/* NOP */;
}
public function Init(){
if (bIsEnabled){
if (bUseSwitchingSchedule){
AddTimer('ProcessSwitchingSchedule', 10.000000,
true, false, /* NOP */, /* NOP */, /* NOP */);
} else {
RemoveTimer('ProcessSwitchingSchedule', /* NOP *
/);
}
}

super.Init();
/* NOP */;
}
public function Activate(flag : Bool){
if (flag){
if (bUseSwitchingSchedule){
AddTimer('ProcessSwitchingSchedule', 10.000000,
true, false, /* NOP */, /* NOP */, /* NOP */);
}
} else if (bUseSwitchingSchedule){
}
super.Activate(flag);
/* NOP */;
}
public timer function ProcessSwitchingSchedule(optional time : Float, op
tional id : Int32){
var currentTime : Int32;
currentTime = GameTimeHours(GameTimeCreate(/* NOP */, /* NOP */,
/* NOP */, /* NOP */));
if (switchOnHour > switchOffHour){
if (bIsActive){
if (currentTime >= switchOffHour && currentTime
< switchOnHour){
Activate(false);
}
} else if (currentTime >= switchOnHour || currentTime <
switchOffHour){
Activate(true);
}
} else if (bIsActive){
if (currentTime >= switchOffHour || currentTime < switch
OnHour){
Activate(false);
}
} else if (currentTime >= switchOnHour && currentTime < switchOf
fHour){
Activate(true);
}
/* NOP */;
}
}
class W3LightEntityDamaging extends CLightEntitySimple{
public editable var hitReactionType : EHitReactionType;
public editable var damagePerSec : Float;
public editable var appliesBurning : Bool;
private var area : CTriggerAreaComponent;
private var entitiesInRange : array<CGameplayEntity>;
private var entitiesInRangeEnterTime : array<EngineTime>;
private var buffDamageVal : SAbilityAttributeValue;
private var damageDealingEnabled : Bool;
private var buffParams : SCustomEffectParams;
private var spawned : Bool;
private const var FIRE_DAMAGE_FX : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
area = (CTriggerAreaComponent)GetComponentByClassName('CTriggerA
reaComponent');
LogAssert(area, "W3LightEntityDamaging.OnSpawned: damageable lig
ht source has no damage area!!!!");
if (appliesBurning){

buffDamageVal.valueAdditive = damagePerSec;
}
spawned = true;
super.OnSpawned(spawnData);
/* NOP */;
}
protected function TurnLightOn(){
var ents : array<CGameplayEntity>;
var time : EngineTime;
var i : Int32;
if (!spawned){
return;
}
super.TurnLightOn();
area.SetEnabled(true);
area.GetGameplayEntitiesInArea(ents, 10, /* NOP */);
ArrayOfGameplayEntitiesAppendUnique(entitiesInRange, ents);
time = theGame.GetEngineTime();
i = 0;
while (i < ents.Size()){
entitiesInRangeEnterTime.PushBack(time);
i += 1;
}
if (entitiesInRange.Size() > 0){
AddTimer('TickTimer', 0.000100, true, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
/* NOP */;
}
protected function TurnLightOff(){
if (!spawned){
return;
}
super.TurnLightOff();
area.SetEnabled(false);
entitiesInRange.Clear();
entitiesInRangeEnterTime.Clear();
RemoveTimer('TickTimer', /* NOP */);
/* NOP */;
}
public function EnableDamage(en : Bool){
damageDealingEnabled = en;
/* NOP */;
}
public timer function TickTimer(optional dt : Float, optional id : Int32
){
var action : W3DamageAction;
var i : Int32;
var actor : CActor;
if (entitiesInRange.Size() <= 0){
RemoveTimer('TickTimer', /* NOP */);
return;
}
if (!damageDealingEnabled){
return;
}
if (appliesBurning && buffParams.effectType == 0){
buffParams.effectType == 18;
buffParams.creator = this;
buffParams.sourceName = "damageable_light_source";

buffParams.duration = 0.500000;
buffParams.effectValue = buffDamageVal;
}
if (entitiesInRange.Size() > 0){
action = new W3DamageAction in this;
i = entitiesInRange.Size() - 1;
while (i >= 0){
actor = (CActor)entitiesInRange[i];
if (actor){
if (!actor.IsAlive()){
entitiesInRange.EraseFast(i);
entitiesInRangeEnterTime.EraseFa
st(i);
entitiesInRange[i].OnFireHit(this);
} else if (appliesBurning){
actor.AddEffectCustom(buffParams
);
} else {
action.Initialize(this, actor, t
his, 'damageable_light_source', hitReactionType, 2, false, false, false, true, F
IRE_DAMAGE_FX, FIRE_DAMAGE_FX, /* NOP */, /* NOP */);
if (actor.IsEffectActive(FIRE_DA
MAGE_FX, /* NOP */) || EngineTimeToFloat(theGame.GetEngineTime() - entitiesInRan
geEnterTime[i]) < 1){
action.SetCanPlayHitPart
icle(false);
}
action.SetIsDoTDamage(dt);
action.AddDamage(theGame.params.
DAMAGE_NAME_FIRE, damagePerSec * dt);
theGame.damageMgr.ProcessAction(
action);
}
} else {
entitiesInRange[i].OnFireHit(this);
}
i -= 1;
}
delete action;
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var ent : CGameplayEntity;
var actor : CActor;
if (!spawned){
return false;
}
ent = (CGameplayEntity)activator.GetEntity();
if (ent && !entitiesInRange.Contains(ent)){
entitiesInRange.PushBack(ent);
entitiesInRangeEnterTime.PushBack(theGame.GetEngineTime(
));
actor = (CActor)ent;
if (actor){
actor.PauseHPRegenEffects('W3LightEntityDamaging
', -1);
}
if (entitiesInRange.Size() == 1){

AddTimer('TickTimer', 0.000100, true, /* NOP */,


/* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var ent : CGameplayEntity;
var actor : CActor;
if (!spawned){
return false;
}
ent = (CGameplayEntity)activator.GetEntity();
if (ent){
entitiesInRangeEnterTime.Erase(entitiesInRange.FindFirst
(ent));
entitiesInRange.Remove(ent);
actor = (CActor)ent;
if (actor){
actor.ResumeHPRegenEffects('W3LightEntityDamagin
g');
if (actor.IsEffectActive(FIRE_DAMAGE_FX, /* NOP
*/)){
actor.StopEffect(FIRE_DAMAGE_FX);
}
}
}
/* NOP */;
}
}
struct SAxiiEffects{
editable var castEffect : CName;
editable var throwEffect : CName;
}
class W3SignOwner extends CObject{
protected var actor : CActor;
protected function BaseInit(parentActor : CActor){
actor = parentActor;
/* NOP */;
}
public function GetActor() : CActor{
return actor;
/* NOP */;
}
public function GetPlayer() : W3PlayerWitcher{
return NULL;
/* NOP */;
}
public function IsPlayer() : Bool{
return false;
/* NOP */;
}
public function InitCastSign(signEntity : W3SignEntity) : Bool{
return true;
/* NOP */;
}
public function ChangeAspect(signEntity : W3SignEntity, newSkill : ESkil

l) : Bool{
return false;
/* NOP */;
}
public function SetCurrentlyCastSign(type : ESignType, entity : W3SignEn
tity){
}
public function GetSkillAbilityName(skill : ESkill) : CName{
return 'None';
/* NOP */;
}
public function GetSkillLevel(skill : ESkill) : Int32{
return 1;
/* NOP */;
}
public function GetSkillAttributeValue(skill : ESkill, attributeName : C
Name, addBaseCharAttribute : Bool, addSkillModsAttribute : Bool) : SAbilityAttri
buteValue{
var dummy : SAbilityAttributeValue;
return dummy;
/* NOP */;
}
public function GetPowerStatValue(stat : ECharacterPowerStats, abilityTa
g : CName) : SAbilityAttributeValue{
var dummy : SAbilityAttributeValue;
return dummy;
/* NOP */;
}
public function CanUseSkill(skill : ESkill) : Bool{
return false;
/* NOP */;
}
public function IsSkillEquipped(skill : ESkill) : Bool{
return false;
/* NOP */;
}
public function HasStaminaToUseSkill(skill : ESkill, perSec : Bool, sign
Hack : Bool) : Bool{
return false;
/* NOP */;
}
public function LockCameraToTarget(flag : Bool){
}
public function LockActorToTarget(flag : Bool){
}
public function RemoveTemporarySkills(){
}
public function GetHandAimPitch() : Float{
return 0.000000;
/* NOP */;
}
public function HasCustomAttackRange() : Bool{
return false;
/* NOP */;
}
public function GetCustomAttackRange() : CName{
return 'None';
/* NOP */;
}
public function OnDelayOrientationChange() : Bool{

return true;
/* NOP */;
}
public function OnProcessCastingOrientation(isContinueCasting : Bool) :
Bool{
return true;
/* NOP */;
}
}
statemachine class RangedWeapon extends CItemEntity{
protected var owner : CActor;
protected var ownerPlayer : CR4Player;
protected var ownerPlayerWitcher : W3PlayerWitcher;
protected var isPlayer : Bool;
protected var inv : CInventoryComponent;
protected var previousAmmoItemName : CName;
protected var deployedEnt : W3BoltProjectile;
protected var isSettingOwnerOrientation : Bool;
protected var isDeployedEntAiming : Bool;
protected var isAimingWeapon : Bool;
protected var isShootingWeapon : Bool;
protected var isWeaponLoaded : Bool;
protected var recoilLevel : Int32;
protected var setFullWeight : Bool;
protected var noSaveLockCombatAction : Int32;
protected var performedDraw : Bool;
protected var shootingIsComplete : Bool;
public var wasBLAxisReleased : Bool;
protected var bLAxisWasReleased : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
Initialize((CActor)GetParentEntity());
/* NOP */;
}
public function OnChangeTo(newState : CName) : Bool{
if (GetCurrentStateName() != newState){
GotoState(newState, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnRangedWeaponPress() : Bool{
SetBehaviorGraphVariables('isAimingWeapon', true, /* NOP */);
SetBehaviorGraphVariables('isShootingWeapon', false, /* NOP */);
/* NOP */;
}
public function OnRangedWeaponRelease() : Bool{
SetBehaviorGraphVariables('isAimingWeapon', false, /* NOP */);
SetBehaviorGraphVariables('isShootingWeapon', true, /* NOP */);
/* NOP */;
}
public function OnWeaponWait() : Bool{
thePlayer.UnblockAction(22, 'ShootingCrossbow');
thePlayer.UnblockAction(42, 'ShootingCrossbow');
/* NOP */;
}
public function OnWeaponDrawStart() : Bool{
ownerPlayer.SetBehaviorVariable('failSafeDraw', 0.000000, /* NOP
*/);
if (!isSettingOwnerOrientation){

isSettingOwnerOrientation = true;
SetOwnerOrientation();
}
OnChangeTo('State_WeaponDraw');
/* NOP */;
}
public function OnWeaponReloadStart() : Bool{
RaiseForceEvent('WeaponCrossbow_Reload');
OnChangeTo('State_WeaponReload');
/* NOP */;
}
public function OnWeaponReload() : Bool{
var id : SItemUniqueId;
if (ownerPlayerWitcher.GetItemEquippedOnSlot(17, id)){
ReloadWeapon(id);
} else {
OnForceHolster(/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
/* NOP */;
}
public function OnWeaponReloadEnd() : Bool{
}
public function OnWeaponAimStart() : Bool{
ProcessFullBodyAnimWeight(/* NOP */);
OnChangeTo('State_WeaponAim');
/* NOP */;
}
public function OnWeaponShootStart() : Bool{
SetBehaviorGraphVariables('isAimingWeapon', false, /* NOP */);
SetBehaviorGraphVariables('isShootingWeapon', false, /* NOP */);
SetBehaviorGraphVariables('recoilLevel', false, 0);
OnChangeTo('State_WeaponShoot');
/* NOP */;
}
public function OnWeaponAimEnd() : Bool{
}
public function OnProcessThrowEvent(animEventName : CName) : Bool{
if (deployedEnt){
deployedEnt.OnProcessThrowEvent(animEventName);
if (animEventName == 'ProjectileThrow'){
SetDeployedEntVisibility(true);
RaiseForceEvent('WeaponCrossbow_Shoot');
super.ClearDeployedEntity(false);
ReloadWeaponWithOrWithoutAnimIfNeeded();
isSettingOwnerOrientation = false;
}
}
if (animEventName == 'OnWeaponReload'){
OnWeaponReload();
if (!ownerPlayer.IsUsingVehicle() && ownerPlayer.GetBeha
viorVariable('isShootingWeapon', /* NOP */) == 0.000000 && ownerPlayer.GetBehavi
orVariable('isAimingWeapon', /* NOP */) == 0.000000){
if (ownerPlayer.GetPlayerCombatStance() == 1 ||
ownerPlayer.IsSwimming()){
AddTimer('HolsterAfterDelay', 0.000000,
/* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
}

/* NOP */;
}
public function OnWeaponShootEnd() : Bool{
if (!ownerPlayer.bLAxisReleased){
ExitCombatAction();
}
/* NOP */;
}
public function OnWeaponHolsterStart() : Bool{
ExitCombatAction();
ownerPlayer.SetBehaviorVariable('forceHolsterForOverlay', 0.0000
00, /* NOP */);
if (ownerPlayer.PerformingCombatAction() == 0){
ownerPlayer.RemoveCustomOrientationTarget('RangedWeapon'
);
}
OnChangeTo('State_WeaponHolster');
/* NOP */;
}
public function OnWeaponHolsterEnd() : Bool{
ExitCombatAction();
/* NOP */;
}
public function OnWeaponToNormalTransStart() : Bool{
AddTimer('ProcessFullBodyAnimWeightTimer', 0.000000, true, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnWeaponToNormalTransEnd() : Bool{
RemoveTimer('ProcessFullBodyAnimWeightTimer', /* NOP */);
/* NOP */;
}
public function OnReplaceAmmo() : Bool{
}
public function OnForceHolster(forceUpperBodyAnim : Bool, instant : Bool
, dropItem : Bool) : Bool{
var itemId : SItemUniqueId;
theInput.ForceDeactivateAction('ThrowItem');
theInput.ForceDeactivateAction('ThrowItemHold');
if (instant){
itemId = ownerPlayer.inv.GetItemFromSlot('l_weapon');
ownerPlayer.HolsterItems(true, itemId, /* NOP */, /* NOP
*/);
thePlayer.BlockAllActions('RangedWeapon', false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.BlockAllActions('RangedWeaponReload', false, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.BlockAllActions('RangedWeaponAiming', false, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.UnblockAction(22, 'ShootingCrossbow');
thePlayer.UnblockAction(42, 'ShootingCrossbow');
thePlayer.UnblockAction(13, 'ShootingCrossbow');
thePlayer.UnblockAction(1, 'RangedWeaponAiming');
thePlayer.UnblockAction(1, 'RangedWeaponReload');
ResetAllSettings();
Unlock();
OnChangeTo('State_WeaponWait');
thePlayer.playerAiming.StopAiming();
}
/* NOP */;

}
public function Initialize(newOwner : CActor){
owner = newOwner;
ownerPlayer = (CR4Player)owner;
ownerPlayerWitcher = (W3PlayerWitcher)owner;
if (ownerPlayer){
isPlayer = true;
}
if (GetCurrentStateName() != 'State_WeaponWait'){
OnChangeTo('State_WeaponWait');
}
/* NOP */;
}
public function IsWeaponBeingUsed() : Bool{
if (GetCurrentStateName() == 'State_WeaponShoot' && !IsShootingC
omplete()){
return true;
} else if (GetCurrentStateName() == 'State_WeaponReload'){
return true;
} else if (isShootingWeapon || isAimingWeapon){
return true;
} else {
return false;
}
/* NOP */;
}
protected function ReloadWeaponWithOrWithoutAnimIfNeeded() : Bool{
var t : Float;
if (!deployedEnt){
if (!PlayOwnerReloadAnim()){
OnWeaponReload();
SetDeployedEntVisibility(false);
return false;
}
t = ownerPlayer.GetBehaviorVariable('animSpeedMultForOve
rlay', /* NOP */);
SetBehaviorVariable('animSpeedMult', ownerPlayer.GetBeha
viorVariable('animSpeedMultForOverlay', /* NOP */), /* NOP */);
return true;
} else {
SetBehaviorGraphVariables('isWeaponLoaded', true, /* NOP
*/);
return false;
}
/* NOP */;
}
protected function SetBehaviorGraphVariables(varName : CName, flag : Boo
l, num : Int32){
if (varName == 'isWeaponLoaded'){
ownerPlayer.SetBehaviorVariable('isWeaponLoaded', flag,
/* NOP */);
ownerPlayer.SetBehaviorVariable('isWeaponLoadedRider', f
lag, /* NOP */);
SetBehaviorVariable('isWeaponLoaded', flag, /* NOP */);
isWeaponLoaded = flag;
} else if (varName == 'isShootingWeapon'){
ownerPlayer.SetBehaviorVariable('isShootingWeapon', flag
, /* NOP */);
ownerPlayer.SetBehaviorVariable('isShootingWeaponRider',
flag, /* NOP */);

isShootingWeapon = flag;
} else if (varName == 'isAimingWeapon'){
ownerPlayer.SetBehaviorVariable('isAimingWeapon', flag,
/* NOP */);
ownerPlayer.SetBehaviorVariable('isAimingWeaponRider', f
lag, /* NOP */);
isAimingWeapon = flag;
} else if (varName == 'recoilLevel'){
ownerPlayer.SetBehaviorVariable('recoilLevel', num, /* N
OP */);
SetBehaviorVariable('recoilLevel', num, /* NOP */);
recoilLevel = num;
}
/* NOP */;
}
protected function RaiseOwnerGraphEvents(eventName : CName, force : Bool
) : Bool{
if (force){
return ownerPlayer.RaiseForceEvent(eventName);
} else {
return ownerPlayer.RaiseEvent(eventName);
}
/* NOP */;
}
protected function PlayOwnerReloadAnim() : Bool{
return false;
/* NOP */;
}
protected function ReloadWeapon(id : SItemUniqueId) : Bool{
var crossbowId : SItemUniqueId;
var mat : Matrix;
if (!deployedEnt){
LogThrowable("Equipped bullet item " + inv.GetItemName(i
d));
CalcEntitySlotMatrix('bolt', mat);
MatrixGetTranslation(mat);
deployedEnt = (W3BoltProjectile)inv.GetDeploymentItemEnt
ity(id, MatrixGetTranslation(mat), MatrixGetRotation(mat), /* NOP */);
ownerPlayerWitcher.GetItemEquippedOnSlot(9, crossbowId);
deployedEnt.InitializeCrossbow(ownerPlayer, id, crossbow
Id);
if (!deployedEnt.CreateAttachment(this, 'bolt', /* NOP *
/, /* NOP */)){
LogThrowable("Cannot attach thrown item to weapo
n!");
LogAssert(false, "CActor.OnAnimEvent(ProjectileA
ttach): Cannot attach thrown item to actor!");
return false;
}
SetBehaviorGraphVariables('isWeaponLoaded', true, /* NOP
*/);
previousAmmoItemName = inv.GetItemName(id);
return true;
}
LogThrowable("Error : Ranged weapon already has a deployed entit
y attached!");
return false;
/* NOP */;
}
protected function Lock(){

var actionBlockingExceptions : array<EInputActionBlock>;


if (ownerPlayer.IsUsingVehicle() && (W3Boat)ownerPlayer.GetUsedV
ehicle()){
actionBlockingExceptions.PushBack(2);
actionBlockingExceptions.PushBack(35);
}
actionBlockingExceptions.PushBack(10);
actionBlockingExceptions.PushBack(3);
actionBlockingExceptions.PushBack(6);
actionBlockingExceptions.PushBack(9);
actionBlockingExceptions.PushBack(11);
actionBlockingExceptions.PushBack(38);
actionBlockingExceptions.PushBack(39);
actionBlockingExceptions.PushBack(14);
actionBlockingExceptions.PushBack(15);
actionBlockingExceptions.PushBack(16);
actionBlockingExceptions.PushBack(17);
actionBlockingExceptions.PushBack(18);
actionBlockingExceptions.PushBack(19);
actionBlockingExceptions.PushBack(23);
actionBlockingExceptions.PushBack(24);
actionBlockingExceptions.PushBack(26);
actionBlockingExceptions.PushBack(30);
actionBlockingExceptions.PushBack(31);
actionBlockingExceptions.PushBack(8);
actionBlockingExceptions.PushBack(32);
actionBlockingExceptions.PushBack(33);
actionBlockingExceptions.PushBack(36);
actionBlockingExceptions.PushBack(41);
actionBlockingExceptions.PushBack(0);
actionBlockingExceptions.PushBack(21);
actionBlockingExceptions.PushBack(12);
actionBlockingExceptions.PushBack(43);
actionBlockingExceptions.PushBack(20);
actionBlockingExceptions.PushBack(25);
theGame.CreateNoSaveLock('RangedWeapon', noSaveLockCombatAction,
/* NOP */, /* NOP */);
thePlayer.BlockAllActions('RangedWeapon', true, actionBlockingEx
ceptions, false, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
protected function Unlock(){
thePlayer.BlockAllActions('RangedWeapon', false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
theGame.ReleaseNoSaveLock(noSaveLockCombatAction);
/* NOP */;
}
protected function SetOwnerOrientation(){
}
public timer function ProcessFullBodyAnimWeightTimer(optional time : Flo
at, optional id : Int32){
ProcessFullBodyAnimWeight(/* NOP */);
/* NOP */;
}
public timer function InputLockFailsafe(optional time : Float, optional
id : Int32){
var item : SItemUniqueId;
if (!ownerPlayer.IsUsingVehicle()){
if (GetCurrentStateName() == 'State_WeaponAim' || GetCur
rentStateName() == 'State_WeaponShoot' || GetCurrentStateName() == 'State_Weapon

Reload'){
item = ownerPlayer.inv.GetItemFromSlot('l_weapon
');
if (!ownerPlayer.inv.IsIdValid(item) && ownerPla
yer.inv.IsItemCrossbow(item)){
OnForceHolster(false, true, /* NOP */);
}
}
if (GetCurrentStateName() != 'State_WeaponWait'){
if (!ownerPlayer.GetBIsCombatActionAllowed() &&
ownerPlayer.GetBehaviorVariable('combatActionType', /* NOP */) == 0 && ownerPlay
er.GetBehaviorVariable('fullBodyAnimWeight', /* NOP */) == 1.000000){
OnForceHolster(true, true, /* NOP */);
}
if (ownerPlayer.IsInShallowWater() && !ownerPlay
er.IsSwimming()){
OnForceHolster(true, false, /* NOP */);
}
if (ownerPlayer.GetPlayerCombatStance() == 0 ||
ownerPlayer.GetPlayerCombatStance() == 2){
if (IsShootingComplete() || ownerPlayer.
GetIsShootingFriendly() && wasBLAxisReleased && !ownerPlayer.bLAxisReleased){
OnForceHolster(true, false, /* N
OP */);
}
}
}
if (!isAimingWeapon && !isShootingWeapon && !ownerPlayer
.lastAxisInputIsMovement){
if (IsShootingComplete() && GetCurrentStateName(
) == 'State_WeaponShoot' || GetCurrentStateName() == 'State_WeaponAim'){
SetOwnerOrientation();
}
}
}
wasBLAxisReleased = ownerPlayer.bLAxisReleased;
/* NOP */;
}
public function OnSprintHolster(){
if (ownerPlayer.GetCurrentStateName() == 'Exploration' || ownerP
layer.GetCurrentStateName() == 'Swimming'){
if (ownerPlayer.GetBehaviorVariable('isShootingWeapon',
/* NOP */) == 0.000000 && ownerPlayer.GetBehaviorVariable('isAimingWeapon', /* N
OP */) == 0.000000){
if (GetCurrentStateName() == 'State_WeaponShoot'
){
if (shootingIsComplete){
OnForceHolster(true, false, /* N
OP */);
}
} else if (GetCurrentStateName() == 'State_Weapo
nAim'){
OnForceHolster(true, false, /* NOP */);
}
}
}
/* NOP */;
}
protected function ProcessFullBodyAnimWeight(forceUpperBodyAnim : Bool)
: Bool{

return true;
/* NOP */;
}
protected function ExitCombatAction() : Bool{
if (ownerPlayer && !ownerPlayer.IsInCombatAction()){
if (!ownerPlayer.IsInCombat() && ownerPlayer.bLAxisRelea
sed){
ownerPlayer.RaiseEvent('ForceAlertToNormalTransi
tion');
} else {
ownerPlayer.RaiseEvent('ForceBlendOut');
}
return true;
}
return false;
/* NOP */;
}
protected function ProcessCharacterRotationInCombat(){
}
public final function ClearDeployedEntity(destroyBolt : Bool){
if (destroyBolt && deployedEnt && deployedEnt.IsStopped()){
deployedEnt.Destroy();
}
deployedEnt = NULL;
/* NOP */;
}
public function IsDeployedEntAiming() : Bool{
return isDeployedEntAiming;
/* NOP */;
}
public function GetDeployedEntity() : W3AdvancedProjectile{
return deployedEnt;
/* NOP */;
}
protected function SetDeployedEntVisibility(flag : Bool){
if (deployedEnt){
deployedEnt.SetVisibility(flag);
}
/* NOP */;
}
public function ProcessCanAttackWhenNotInCombat(){
if (!ownerPlayer.IsCombatMusicEnabled() || ownerPlayer.playerAim
ing.GetCurrentStateName() == 'Aiming' && !CanAttackWhenNotInCombat()){
ownerPlayer.SetIsShootingFriendly(true);
ownerPlayer.SetBehaviorVariable('isShootingFriendly', 1.
000000, /* NOP */);
ownerPlayer.SetBehaviorVariable('isShootingFriendlyForOv
erlay', 1.000000, /* NOP */);
} else {
ownerPlayer.SetIsShootingFriendly(false);
ownerPlayer.SetBehaviorVariable('isShootingFriendly', 0.
000000, /* NOP */);
ownerPlayer.SetBehaviorVariable('isShootingFriendlyForOv
erlay', 0.000000, /* NOP */);
}
/* NOP */;
}
public function CanAttackWhenNotInCombat() : Bool{
var shootTarget : CActor;
var weaponToThrowPosDist : Float;

weaponToThrowPosDist = VecDistance(ownerPlayer.playerAiming.GetT
hrowPosition(), ownerPlayer.playerAiming.GetThrowStartPosition());
if (ownerPlayer.GetDisplayTarget() && ownerPlayer.IsDisplayTarge
tTargetable()){
shootTarget = (CActor)ownerPlayer.GetDisplayTarget();
} else {
shootTarget = (CActor)ownerPlayer.slideTarget;
}
if (isDeployedEntAiming){
if (ownerPlayer.playerAiming.GetSweptFriendly() || weapo
nToThrowPosDist < 1.000000){
return false;
} else {
return true;
}
} else if (shootTarget && shootTarget.IsHuman() && !ownerPlayer.
IsThreat(shootTarget, /* NOP */)){
return false;
} else {
return true;
}
/* NOP */;
}
public function PerformedDraw() : Bool{
return performedDraw;
/* NOP */;
}
protected function ResetAllSettings(){
ownerPlayer.SetBehaviorVariable('inAimThrow', 0.000000, /* NOP *
/);
ownerPlayer.SetBehaviorVariable('inAimThrowForOverlay', 0.000000
, /* NOP */);
ownerPlayer.SetBehaviorVariable('dodgeBoost', 0.000000, /* NOP *
/);
isSettingOwnerOrientation = false;
ExitCombatAction();
ownerPlayer.RemoveCustomOrientationTarget('RangedWeapon');
ownerPlayer.SetBehaviorVariable('hasCrossbowHeld', 0.000000, /*
NOP */);
ownerPlayer.GetMovingAgentComponent().EnableVirtualController('C
rossbow', false);
if (isDeployedEntAiming){
isDeployedEntAiming = false;
deployedEnt.StopAiming(true);
}
if (!ownerPlayer.IsUsingVehicle()){
ownerPlayer.OnEnableAimingMode(false);
}
/* NOP */;
}
protected timer function HolsterAfterDelay(optional timeDelta : Float, o
ptional id : Int32){
ownerPlayer.SetBehaviorVariable('canHolsterAfterDelay', 1.000000
, /* NOP */);
ownerPlayer.SetBehaviorVariable('canHolsterAfterDelayHorse', 1.0
00000, /* NOP */);
RemoveTimer('HolsterAfterDelay', /* NOP */);
RemoveTimer('HolsterWhenMovingTimer', /* NOP */);
/* NOP */;
}

protected timer function HolsterWhenMovingTimer(optional timeDelta : Flo


at, optional id : Int32){
var stateCur : CName;
var canHolsterAfterDelay : Bool;
stateCur = ownerPlayer.substateManager.GetStateCur();
if (!ownerPlayer.bLAxisReleased && ownerPlayer.GetCurrentStateNa
me() != 'AimThrow' && bLAxisWasReleased){
canHolsterAfterDelay = true;
} else if (stateCur == 'Jump' || stateCur == 'Ragdoll' || stateC
ur == 'Slide' || stateCur == 'TurnToJump'){
canHolsterAfterDelay = true;
} else if (ownerPlayer.IsSwimming() && !ownerPlayer.bLAxisReleas
ed){
canHolsterAfterDelay = true;
}
if (canHolsterAfterDelay){
ownerPlayer.SetBehaviorVariable('canHolsterAfterDelay',
1.000000, /* NOP */);
RemoveTimer('HolsterAfterDelay', /* NOP */);
RemoveTimer('HolsterWhenMovingTimer', /* NOP */);
}
bLAxisWasReleased = ownerPlayer.bLAxisReleased;
/* NOP */;
}
protected function ProcessEnableRadialSlot(){
}
public function IsShootingComplete() : Bool{
return shootingIsComplete;
/* NOP */;
}
}
class W3ConfuseEffect extends W3CriticalEffect{
private saved var drainStaminaOnExit : Bool;
private var criticalHitBonus : Float;
public function GetCriticalHitChanceBonus() : Float{
return criticalHitBonus;
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var params : W3ConfuseEffectCustomParams;
var npc : CNewNPC;
super.OnEffectAdded(customParams);
if (isOnPlayer){
thePlayer.HardLockToTarget(false);
}
params = (W3ConfuseEffectCustomParams)customParams;
if (params){
criticalHitBonus = params.criticalHitChanceBonus;
}
npc = (CNewNPC)target;
if (npc){
npc.LowerGuard();
if (npc.IsHorse()){
if (npc.GetHorseComponent().IsDismounted()){
npc.GetHorseComponent().ResetPanic();
}
if (IsSignEffect() && npc.IsHorse()){
npc.SetTemporaryAttitudeGroup('animals_c
harmed', 2);

npc.SignalGameplayEvent('NoticedObjectRe
evaluation');
}
}
}
/* NOP */;
}
public function CacheSettings(){
super.CacheSettings();
blockedActions.PushBack(0);
blockedActions.PushBack(1);
blockedActions.PushBack(4);
blockedActions.PushBack(8);
blockedActions.PushBack(10);
blockedActions.PushBack(14);
blockedActions.PushBack(13);
blockedActions.PushBack(33);
blockedActions.PushBack(34);
blockedActions.PushBack(24);
blockedActions.PushBack(25);
blockedActions.PushBack(26);
blockedActions.PushBack(27);
blockedActions.PushBack(29);
blockedActions.PushBack(30);
blockedActions.PushBack(31);
blockedActions.PushBack(44);
blockedActions.PushBack(45);
blockedActions.PushBack(32);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var npc : CNewNPC;
super.OnEffectRemoved();
npc = (CNewNPC)target;
if (npc){
npc.ResetTemporaryAttitudeGroup(2);
npc.SignalGameplayEvent('NoticedObjectReevaluation');
}
if (npc && npc.IsHorse()){
npc.SignalGameplayEvent('WasCharmed');
}
if (drainStaminaOnExit){
target.DrainStamina(13, target.GetStat(2, /* NOP */), /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function SetDrainStaminaOnExit(){
drainStaminaOnExit = true;
/* NOP */;
}
}
struct SIgniChannelDT{
var actor : CActor;
var dtSinceLastTest : Float;
}
struct SIgniAspect{
editable var projTemplate : CEntityTemplate;

editable var cone : Float;


editable var distance : Float;
editable var upgradedDistance : Float;
}
struct SIgniEffects{
editable var
editable var
editable var
editable var
editable var
editable var
}

throwEffect : CName;
forestEffect : CName;
upgradedThrowEffect : CName;
meltArmorEffect : CName;
combustibleEffect : CName;
throwEffectSpellPower : CName;

import abstract class SBoatDestructionVolume{


//NULL type for areaHealth
//NULL type for volumeLocalPosition
}
class W3ForestTrigger extends CEntity{
public saved var isPlayerInForest : Bool;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if ((CPlayer)activator.GetEntity()){
isPlayerInForest = true;
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if ((CPlayer)activator.GetEntity()){
isPlayerInForest = false;
}
/* NOP */;
}
public function IsPlayerInForest() : Bool{
return isPlayerInForest;
/* NOP */;
}
}
class W3IgniProjectile extends W3SignProjectile{
private var channelCollided : Bool;
private var dt : Float;
private var isUsed : Bool;
public function SetDT(d : Float){
dt = d;
/* NOP */;
}
public function IsUsed() : Bool{
return isUsed;
/* NOP */;
}
public function SetIsUsed(used : Bool){
isUsed = used;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{

var rot : EulerAngles;


var rotImp : EulerAngles;
var v : Vector;
var posF : Vector;
var pos2 : Vector;
var n : Vector;
var igniEntity : W3IgniEntity;
var ent : CEntity;
var colEnt : CEntity;
var template : CEntityTemplate;
var f : Float;
var test : Bool;
var postEffect : CGameplayFXSurfacePost;
channelCollided = true;
igniEntity = (W3IgniEntity)signEntity;
if (signEntity.IsAlternateCast()){
test = !collidingComponent && hitCollisionsGroups.Contai
ns('Terrain') || collidingComponent && !(CActor)collidingComponent.GetEntity();
colEnt = collidingComponent.GetEntity();
if ((W3BoltProjectile)colEnt || (W3SignEntity)colEnt ||
(W3SignProjectile)colEnt){
test = false;
}
if (test){
f = theGame.GetEngineTimeAsSeconds();
if (f - igniEntity.lastFxSpawnTime >= 1){
igniEntity.lastFxSpawnTime = f;
template = (CEntityTemplate)LoadResource
("igni_object_fx", /* NOP */);
rot.Pitch = AcosF(VecDot(Vector(0, 0, 0)
, normal));
rot.Yaw = GetHeading();
rot.Roll = 0.000000;
posF = pos + VecNormalize(pos - signEnti
ty.GetWorldPosition());
if (theGame.GetWorld().StaticTrace(pos,
posF, pos2, n, igniEntity.projectileCollision)){
ent = theGame.CreateEntity(templ
ate, pos2, rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
ent.AddTimer('TimerStopVisualFX'
, 5, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
postEffect = theGame.GetSurfaceP
ostFX();
postEffect.AddSurfacePostFXGroup
(pos2, 0.500000, 8.000000, 10.000000, 0.300000, 1);
}
}
}
if (!hitCollisionsGroups.Contains('Water')){
v = GetWorldPosition() - signEntity.GetWorldPosi
tion();
rot = MatrixGetRotation(MatrixBuildFromDirection
Vector(-v));
igniEntity.ShowChannelingCollisionFx(GetWorldPos
ition(), rot, -v);
}
}
return super.OnProjectileCollision(pos, normal, collidingCompone
nt, hitCollisionsGroups, actorIndex, shapeIndex);
/* NOP */;

}
protected function ProcessCollision(collider : CGameplayEntity, pos : Ve
ctor, normal : Vector){
var signPower : SAbilityAttributeValue;
var channelDmg : SAbilityAttributeValue;
var burnChance : Float;
var maxArmorReduction : Float;
var applyNbr : Int32;
var i : Int32;
var npc : CNewNPC;
var armorRedAblName : CName;
var currentReduction : Int32;
var actorVictim : CActor;
var ownerActor : CActor;
var dmg : Float;
var performBurningTest : Bool;
var igniEntity : W3IgniEntity;
var postEffect : CGameplayFXSurfacePost;
postEffect = theGame.GetSurfacePostFX();
postEffect.AddSurfacePostFXGroup(pos, 0.500000, 8.000000, 10.000
000, 2.500000, 1);
if (hitEntities.Contains(collider)){
return;
}
hitEntities.PushBack(collider);
super.ProcessCollision(collider, pos, normal);
ownerActor = owner.GetActor();
actorVictim = (CActor)action.victim;
npc = (CNewNPC)collider;
if (signEntity.IsAlternateCast()){
igniEntity = (W3IgniEntity)signEntity;
performBurningTest = igniEntity.UpdateBurningChance(acto
rVictim, dt);
if (igniEntity.hitEntities.Contains(collider)){
channelCollided = true;
action.SetHitEffect('None', /* NOP */, /* NOP */
);
action.SetHitEffect('None', true, /* NOP */);
action.SetHitEffect('None', false, true);
action.SetHitEffect('None', true, true);
action.ClearDamage();
channelDmg = owner.GetSkillAttributeValue(signSk
ill, 'channeling_damage', false, true);
dmg = channelDmg.valueAdditive + channelDmg.valu
eMultiplicative * actorVictim.GetMaxHealth();
dmg *= dt;
action.AddDamage(theGame.params.DAMAGE_NAME_FIRE
, dmg);
action.SetIsDoTDamage(dt);
if (!collider){
return;
}
} else {
igniEntity.hitEntities.PushBack(collider);
}
if (!performBurningTest){
action.ClearEffects();
}
}
if (npc && npc.IsShielded(ownerActor)){

collider.OnIgniHit(this);
return;
}
signPower = signEntity.GetOwner().GetTotalSignSpellPower(signEnt
ity.GetSkill());
if (!owner.IsPlayer()){
burnChance = signPower.valueMultiplicative;
if (RandF() < burnChance){
action.AddEffectInfo(18, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
}
dmg = CalculateAttributeValue(signPower, /* NOP */);
if (dmg <= 0){
dmg = 20;
}
action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, dmg);
}
if (signEntity.IsAlternateCast()){
action.SetHitAnimationPlayType(2);
} else {
action.SetHitEffect('igni_cone_hit', false, false);
action.SetHitEffect('igni_cone_hit', true, false);
action.SetHitReactionType(3, false);
}
theGame.damageMgr.ProcessAction(action);
if (owner.CanUseSkill(44) && (CActor)collider){
maxArmorReduction = CalculateAttributeValue(owner.GetSki
llAttributeValue(44, 'max_armor_reduction', false, true), /* NOP */) * GetWitche
rPlayer().GetSkillLevel(44);
applyNbr = RoundMath(100 * maxArmorReduction * signPower
.valueMultiplicative / theGame.params.MAX_SPELLPOWER_ASSUMED);
armorRedAblName = SkillEnumToName(44);
currentReduction = (CActor)collider.GetAbilityCount(armo
rRedAblName);
applyNbr -= currentReduction;
i = 0;
while (i < applyNbr){
action.victim.AddAbility(armorRedAblName, true);
i += 1;
}
}
collider.OnIgniHit(this);
/* NOP */;
}
public function OnAttackRangeHit(entity : CGameplayEntity) : Bool{
entity.OnIgniHit(this);
/* NOP */;
}
public function OnRangeReached() : Bool{
var v : Vector;
var rot : EulerAngles;
if (!channelCollided){
v = GetWorldPosition() - signEntity.GetWorldPosition();
rot = MatrixGetRotation(MatrixBuildFromDirectionVector(v));
(W3IgniEntity)signEntity.ShowChannelingRangeFx(GetWorldP
osition(), rot);
}
isUsed = false;
super.OnRangeReached();

/* NOP */;
}
public function IsProjectileFromChannelMode() : Bool{
return signSkill == 38;
/* NOP */;
}
}
state CR4PlayerStateUseGenericVehicle in CR4Player extends CPlayerStateUseVehicl
e{
protected var vehicle : CVehicleComponent;
protected var camera : CCustomCamera;
private var signSlotNames : array<CName>;
protected var fovVel : Float;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.SetOrientationTarget(3);
camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
if ((W3ReplacerCiri)parent){
parent.SetBehaviorVariable('test_ciri_replacer', 1.00000
0, /* NOP */);
} else {
signSlotNames.PushBack('Slot2');
signSlotNames.PushBack('Slot3');
signSlotNames.PushBack('Slot4');
signSlotNames.PushBack('Slot5');
(W3PlayerWitcher)parent.EnableRadialSlotsWithSource(true
, signSlotNames, 'throwProjectileOnVehicle');
signSlotNames.Clear();
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.HideUsableItem(true);
}
if ((W3HorseComponent)vehicle){
signSlotNames.PushBack('Yrden');
signSlotNames.PushBack('Quen');
signSlotNames.PushBack('Igni');
signSlotNames.PushBack('Aard');
signSlotNames.PushBack('Slot4');
signSlotNames.PushBack('Slot5');
if (thePlayer.GetVehicleCachedSign() == 5){
thePlayer.SetVehicleCachedSign((W3Player
Witcher)parent.GetEquippedSign());
}
(W3PlayerWitcher)parent.SetEquippedSign(4);
(W3PlayerWitcher)parent.EnableRadialSlotsWithSou
rce(false, signSlotNames, 'useVehicle');
} else if ((CBoatComponent)vehicle){
signSlotNames.PushBack('Slot1');
signSlotNames.PushBack('Slot2');
signSlotNames.PushBack('Slot4');
signSlotNames.PushBack('Slot5');
signSlotNames.PushBack('Yrden');
signSlotNames.PushBack('Quen');
signSlotNames.PushBack('Igni');
signSlotNames.PushBack('Aard');
signSlotNames.PushBack('Axii');
if (thePlayer.GetVehicleCachedSign() == 5){
thePlayer.SetVehicleCachedSign((W3Player
Witcher)parent.GetEquippedSign());
}

(W3PlayerWitcher)parent.SelectQuickslotItem(9);
(W3PlayerWitcher)parent.SetEquippedSign(5);
(W3PlayerWitcher)parent.EnableRadialSlotsWithSou
rce(false, signSlotNames, 'useVehicle');
}
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
if ((W3PlayerWitcher)parent){
(W3PlayerWitcher)parent.EnableRadialSlotsWithSource(true
, signSlotNames, 'useVehicle');
if (thePlayer.GetVehicleCachedSign() != 5){
(W3PlayerWitcher)parent.SetEquippedSign(thePlaye
r.GetVehicleCachedSign());
}
}
signSlotNames.Clear();
if (nextStateName != 'None'){
thePlayer.SetVehicleCachedSign(5);
}
if (nextStateName != 'DismountHorse'){
parent.OnRangedForceHolster(true, true, /* NOP */);
}
super.OnLeaveState(nextStateName);
/* NOP */;
}
public final function SetVehicle(v : CVehicleComponent){
var vehEnt : CGameplayEntity;
vehicle = v;
if (vehicle){
vehEnt = (CGameplayEntity)vehicle.GetEntity();
vehEnt.AddTag(theGame.params.TAG_PLAYERS_MOUNTED_VEHICLE
);
}
/* NOP */;
}
public function DismountVehicle(){
}
public function BeginState(prevStateName : CName){
Init();
/* NOP */;
}
public function ContinuedState(){
var pos : Vector;
pos = parent.GetWorldPosition();
vehicle.GetEntity().Teleport(pos);
vehicle.Mount(parent, 4, 0);
/* NOP */;
}
public function EndState(nextStateName : CName){
var vehEnt : CGameplayEntity;
super.DetachFromVehicle();
vehEnt = (CGameplayEntity)vehicle.GetEntity();
vehEnt.RemoveTag(theGame.params.TAG_PLAYERS_MOUNTED_VEHICLE);
vehicle = NULL;
/* NOP */;
}
protected function Init(){
}

protected final function DetachFromVehicle(){


parent.BreakAttachment();
/* NOP */;
}
public function CanAccesFastTravel(target : W3FastTravelEntity) : Bool{
if (vehicle){
return vehicle.CanAccesFastTravel(target);
}
return true;
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
var rightStickVector : Vector;
var rightStickLength : Float;
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.HideUsableItem(true);
}
if (parent.IsHardLockEnabled()){
if (parent.IsPCModeEnabled()){
rightStickVector.X = theInput.GetActionValue('GI
_MouseDampX');
rightStickVector.Y = theInput.GetActionValue('GI
_MouseDampY');
} else {
rightStickVector.X = theInput.GetActionValue('GI
_AxisRightX');
rightStickVector.Y = theInput.GetActionValue('GI
_AxisRightY');
}
rightStickLength = VecLength(rightStickVector);
if (rightStickLength > 0){
parent.bRAxisReleased = false;
} else {
parent.bRAxisReleased = true;
}
if (!parent.ProcessLockTargetSelectionInput(rightStickVe
ctor, rightStickLength)){
parent.ProcessLockTargetSelectionInput(rightStic
kVector, rightStickLength);
}
if (rightStickLength >= 0.300000){
FindTarget();
}
} else {
FindTarget();
}
/* NOP */;
}
public function OnHitStart() : Bool{
parent.SetIsInHitAnim(true);
vehicle.GetUserCombatManager().OnHitStart();
/* NOP */;
}
public function OnHitEnd() : Bool{
parent.SetIsInHitAnim(false);
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
vehicle.GetUserCombatManager().OnCombatActionEnd();
return parent.OnCombatActionEnd();

/* NOP */;
}
protected function ShouldEnableBoatMusic(){
if (parent.ShouldEnableCombatMusic()){
theSound.LeaveGameState(14);
} else {
theSound.EnterGameState(14);
}
/* NOP */;
}
public function FindTarget(){
var i : Int32;
var size : Int32;
var targets : array<CActor>;
var theChosenOne : CActor;
var selectionWeights : STargetSelectionWeights;
var flyingNPCs : Bool;
var targetingInfo : STargetingInfo;
var hud : CR4ScriptedHud;
var playerPosition : Vector;
var cameraPosition : Vector;
var cameraDirection : Vector;
targets = parent.GetMoveTargets();
targetingInfo.source = parent;
targetingInfo.canBeTargetedCheck = true;
targetingInfo.coneCheck = false;
targetingInfo.coneHalfAngleCos = 1.000000;
targetingInfo.coneDist = parent.softLockDistVehicle;
targetingInfo.coneHeadingVector = Vector(0.000000, 1.000000, 0.0
00000);
targetingInfo.distCheck = true;
targetingInfo.invisibleCheck = true;
targetingInfo.navMeshCheck = false;
targetingInfo.inFrameCheck = true;
targetingInfo.frameScaleX = 1.000000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = 1.500000;
targetingInfo.rsHeadingCheck = false;
targetingInfo.rsHeadingLimitCos = 1.000000;
i = 0;
while (i < targets.Size()){
targetingInfo.targetEntity = targets[i];
if (!parent.IsEntityTargetable(targetingInfo, /* NOP */)
|| !parent.CanBeTargetedIfSwimming(targets[i], /* NOP */)){
targets.Erase(i);
i -= 1;
} else if ((CNewNPC)targets[i].GetCurrentStance() == 5){
flyingNPCs = true;
}
i += 1;
}
if (!flyingNPCs){
targetingInfo.source = parent;
targetingInfo.canBeTargetedCheck = true;
targetingInfo.coneCheck = false;
targetingInfo.coneHalfAngleCos = 1.000000;
targetingInfo.coneDist = thePlayer.findMoveTargetDistMax
+ 7.000000;
targetingInfo.coneHeadingVector = Vector(0.000000, 1.000

000, 0.000000);
if (parent.playerAiming.GetCurrentStateName() == 'Aiming
'){
targetingInfo.distCheck = false;
} else {
targetingInfo.distCheck = true;
}
targetingInfo.invisibleCheck = false;
targetingInfo.navMeshCheck = false;
targetingInfo.inFrameCheck = false;
targetingInfo.frameScaleX = 0.600000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = 1.500000;
targetingInfo.rsHeadingCheck = false;
targetingInfo.rsHeadingLimitCos = 1.000000;
i = 0;
while (i < targets.Size()){
targetingInfo.targetEntity = targets[i];
if (!parent.IsEntityTargetable(targetingInfo, /*
NOP */)){
targets.Erase(i);
i -= 1;
}
i += 1;
}
}
playerPosition = thePlayer.GetWorldPosition();
cameraPosition = theCamera.GetCameraPosition();
cameraDirection = theCamera.GetCameraDirection();
size = targets.Size();
if (size > 0 && parent.IsThreatened()){
(CActor)vehicle.GetEntity().SignalGameplayEvent('RiderCo
mbatTargetUpdated');
if (parent.playerAiming.GetCurrentStateName() == 'Aiming
'){
theChosenOne = parent.playerAiming.GetAimedTarge
t();
if (!theChosenOne){
selectionWeights.angleWeight = 1.000000;
selectionWeights.distanceWeight = 0.0000
00;
selectionWeights.distanceRingWeight = 0.
000000;
theChosenOne = parent.SelectTarget(targe
ts, false, cameraPosition, cameraDirection, selectionWeights, /* NOP */);
}
} else if ((W3Boat)parent.GetUsedVehicle()){
selectionWeights.angleWeight = 1.000000;
selectionWeights.distanceWeight = 0.000000;
selectionWeights.distanceRingWeight = 0.000000;
theChosenOne = parent.SelectTarget(targets, fals
e, cameraPosition, cameraDirection, selectionWeights, /* NOP */);
} else {
selectionWeights.angleWeight = 0.000000;
selectionWeights.distanceWeight = 1.000000;
selectionWeights.distanceRingWeight = 0.000000;
theChosenOne = parent.SelectTarget(targets, fals
e, playerPosition, cameraDirection, selectionWeights, /* NOP */);
}

}
if (parent.GetDisplayTarget() && parent.rangedWeapon && parent.r
angedWeapon.GetCurrentStateName() == 'State_WeaponShoot' && !parent.rangedWeapon
.IsShootingComplete() && parent.playerAiming.GetCurrentStateName() == 'Waiting')
{
theChosenOne == parent.GetDisplayTarget();
}
if (parent.GetBIsCombatActionAllowed() || !parent.GetDisplayTarg
et() && !parent.IsActorLockedToTarget()){
parent.slideTarget = theChosenOne;
parent.moveTarget = theChosenOne;
parent.SetDisplayTarget(theChosenOne);
parent.SetTarget(theChosenOne, /* NOP */);
}
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var playerToTargetVector : Vector;
var playerToTargetAngles : EulerAngles;
var playerToTargetDist : Float;
var playerToTargetPitch : Float;
var pitch : Float;
var offset : Float;
var distance : Float;
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(parent.thrownEntityHa
ndle);
camera = theGame.GetGameCamera();
if (!camera){
return true;
}
if (parent.rangedWeapon || thrownEntity && parent.playerAiming.G
etCurrentStateName() == 'Aiming' || parent.vehicleCbtMgrAiming){
return true;
}
if (parent.IsCameraLockedToTarget()){
DampFloatSpring(camera.fov, fovVel, 60.000000, 1.000000,
dt);
playerToTargetVector = parent.GetDisplayTarget().GetWorl
dPosition() - parent.GetWorldPosition();
playerToTargetDist = VecLength(playerToTargetVector);
if (parent.IsOnBoat()){
moveData.pivotRotationController.SetDesiredHeadi
ng(VecHeading(playerToTargetVector), 1.000000);
} else {
moveData.pivotRotationController.SetDesiredHeadi
ng(VecHeading(playerToTargetVector), 0.500000);
}
if (AbsF(playerToTargetVector.Z) <= 1.000000){
offset = ClampF(playerToTargetDist * 0.060000 +
2.200000, 2.200000, 2.500000);
pitch = ClampF(playerToTargetDist * -2.000000 +
30.000000, 10.000000, 30.000000);
moveData.pivotRotationController.SetDesiredPitch
(-pitch, 0.500000);
} else {
playerToTargetAngles = VecToRotation(playerToTar
getVector);
playerToTargetPitch = ClampF(playerToTargetAngle

s.Pitch + 20, -45, 50);


offset = ClampF(playerToTargetPitch * -0.023000
+ 2.500000, 2.500000, 3.200000);
moveData.pivotRotationController.SetDesiredPitch
(playerToTargetPitch * -1, 0.500000);
}
moveData.pivotPositionController.offsetZ = offset;
parent.OnGameCameraPostTick(moveData, dt);
return true;
}
/* NOP */;
}
}
class W3Blood extends CEntity{
public editable var lifetime : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
if (lifetime <= 0){
lifetime = 30;
}
AddTimer('DestroyTimer2', 30, /* NOP */, /* NOP */, /* NOP */, /
* NOP */, /* NOP */);
/* NOP */;
}
public timer function DestroyTimer2(optional dt : Float, optional id : I
nt32){
if (thePlayer.WasVisibleInScaledFrame(this, 1, 1)){
AddTimer('DestroyWhenNotVisible', 2, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
} else {
Destroy();
}
/* NOP */;
}
public timer function DestroyWhenNotVisible(optional dt : Float, optiona
l id : Int32){
if (!thePlayer.WasVisibleInScaledFrame(this, 1, 1)){
Destroy();
RemoveTimer('DestroyWhenNotVisible', /* NOP */);
}
/* NOP */;
}
}
struct SQuenEffects{
editable var
editable var
editable var
editable var
editable var
editable var
}

lastingEffectUpgNone : CName;
lastingEffectUpg1 : CName;
lastingEffectUpg2 : CName;
lastingEffectUpg3 : CName;
castEffect : CName;
cameraShakeStranth : Float;

state W3SignEntityStateNormalCast in W3SignEntity extends W3SignEntityStateBaseC


ast{
public function OnEnterState(prevStateName : CName) : Bool{
var player : CR4Player;
var cost : Float;
var stamina : Float;

super.OnEnterState(prevStateName);
return true;
/* NOP */;
}
public function OnEnded(isEnd : Bool) : Bool{
var player : CR4Player;
var cost : Float;
var stamina : Float;
super.OnEnded(isEnd);
/* NOP */;
}
}
class W3VisualFx extends CEntity{
public editable var effectName : CName;
public editable var destroyEffectTime : Float;
private var timedFxDestroyName : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (IsNameValid(effectName)){
PlayEffect(effectName, /* NOP */);
}
if (destroyEffectTime > 0){
AddTimer('TimerStopVisualFX', destroyEffectTime, false,
/* NOP */, /* NOP */, true, /* NOP */);
}
super.OnSpawned(spawnData);
/* NOP */;
}
public function SetDestroyTime(time : Float){
RemoveTimer('TimerStopVisualFX', /* NOP */);
RemoveTimer('DestroyVisualFX', /* NOP */);
destroyEffectTime = time;
if (destroyEffectTime > 0){
AddTimer('TimerStopVisualFX', destroyEffectTime, false,
/* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public function DestroyOnFxEnd(fxName : CName){
if (timedFxDestroyName == 'None'){
timedFxDestroyName = fxName;
AddTimer('TimerDestroyOnFxEnd', 0.200000, true, /* NOP *
/, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public timer function TimerDestroyOnFxEnd(optional dt : Float, optional
id : Int32){
if (!IsEffectActive(timedFxDestroyName, /* NOP */)){
Destroy();
}
/* NOP */;
}
public timer function TimerStopVisualFX(optional td : Float, optional id
: Int32){
FunctionStopVisualFX();
/* NOP */;
}
protected function FunctionStopVisualFX(){
StopEffect(effectName);

AddTimer('DestroyVisualFX', 5.000000, false, /* NOP */, /* NOP *


/, true, /* NOP */);
/* NOP */;
}
public timer function DestroyVisualFX(optional td : Float, optional id :
Int32){
Destroy();
/* NOP */;
}
}
statemachine class W3AxiiEntity extends W3SignEntity{
public editable var effects : array<SAxiiEffects>;
public editable var projTemplate : CEntityTemplate;
public editable var distance : Float;
public editable var projSpeed : Float;
protected var targets : array<CActor>;
protected var orientationTarget : CActor;
public function GetSignType() : ESignType{
return 4;
/* NOP */;
}
public function Init(inOwner : W3SignOwner, prevInstance : W3SignEntity,
skipCastingAnimation : Bool) : Bool{
var ownerActor : CActor;
var prevSign : W3SignEntity;
ownerActor = inOwner.GetActor();
if ((CPlayer)ownerActor){
prevSign = GetWitcherPlayer().GetSignEntity(4);
if (prevSign){
prevSign.OnSignAborted(true);
}
}
ownerActor.SetBehaviorVariable('bStopSign', 0.000000, /* NOP */)
;
if (inOwner.CanUseSkill(53) && inOwner.GetSkillLevel(53) > 1){
ownerActor.SetBehaviorVariable('bSignUpgrade', 1.000000,
/* NOP */);
} else {
ownerActor.SetBehaviorVariable('bSignUpgrade', 0.000000,
/* NOP */);
}
return super.Init(inOwner, prevInstance, skipCastingAnimation);
/* NOP */;
}
public function OnProcessSignEvent(eventName : CName) : Bool{
if (eventName == 'axii_ready'){
PlayEffect(effects[fireMode].throwEffect, /* NOP */);
} else if (eventName == 'horse_cast_begin'){
OnHorseStarted();
} else {
return super.OnProcessSignEvent(eventName);
}
return true;
/* NOP */;
}
public function OnStarted() : Bool{
var player : CR4Player;
var i : Int32;
SelectTargets();

i = 0;
while (i < targets.Size()){
AddMagic17Effect(targets[i]);
i += 1;
}
Attach(true, /* NOP */);
player = (CR4Player)owner.GetActor();
if (player){
GetWitcherPlayer().FailFundamentalsFirstAchievementCondi
tion();
player.AddTimer('ResetPadBacklightColorTimer', 2, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
PlayEffect(effects[fireMode].castEffect, /* NOP */);
if (owner.ChangeAspect(this, 41)){
CacheActionBuffsFromSkill();
GotoState('AxiiChanneled', /* NOP */, /* NOP */);
} else {
GotoState('AxiiCast', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnHorseStarted(){
Attach(true, /* NOP */);
PlayEffect(effects[fireMode].castEffect, /* NOP */);
/* NOP */;
}
private final function IsTargetValid(actor : CActor, isAdditionalTarget
: Bool) : Bool{
var npc : CNewNPC;
var horse : W3HorseComponent;
var attitude : EAIAttitude;
if (!actor){
return false;
}
if (!actor.IsAlive()){
return false;
}
attitude = GetAttitudeBetween(owner.GetActor(), actor);
if (isAdditionalTarget && attitude != 2){
return false;
}
npc = (CNewNPC)actor;
if (attitude == 0){
if (npc.GetNPCType() == 2 && !actor.HasTag(theGame.param
s.TAG_AXIIABLE_LOWER_CASE) && !actor.HasTag(theGame.params.TAG_AXIIABLE)){
return false;
}
}
if (npc){
horse = npc.GetHorseComponent();
if (horse && !horse.IsDismounted()){
if (horse.GetCurrentUser() != owner.GetActor()){
return false;
}
}
}
return true;
/* NOP */;
}

private function SelectTargets(){


var projCount : Int32;
var i : Int32;
var j : Int32;
var actors : array<CActor>;
var finalActors : array<CActor>;
var ownerPos : Vector;
var ownerActor : CActor;
var actor : CActor;
if (owner.CanUseSkill(55)){
projCount = 2;
} else {
projCount = 1;
}
targets.Clear();
actor = (CActor)thePlayer.slideTarget;
if (actor && super.IsTargetValid(actor, false)){
targets.PushBack(actor);
projCount -= 1;
if (projCount == 0){
return;
}
}
ownerActor = owner.GetActor();
ownerPos = ownerActor.GetWorldPosition();
actors = ownerActor.GetNPCsAndPlayersInCone(15, VecHeading(owner
Actor.GetHeadingVector()), 120, 20, /* NOP */, 4 + 16384);
i = actors.Size() - 1;
while (i >= 0){
if (ownerActor == actors[i] || actor == actors[i] || !su
per.IsTargetValid(actors[i], true)){
actors.Erase(i);
}
i -= 1;
}
if (actors.Size() > 0){
finalActors.PushBack(actors[0]);
}
i = 1;
while (i < actors.Size()){
j = 0;
while (j < finalActors.Size()){
if (VecDistance(ownerPos, actors[i].GetWorldPosi
tion()) < VecDistance(ownerPos, finalActors[j].GetWorldPosition())){
finalActors.Insert(j, actors[i]);
break;
}
j += 1;
}
if (j == finalActors.Size()){
finalActors.PushBack(actors[i]);
}
i += 1;
}
if (finalActors.Size() > 0){
i = 0;
while (i < projCount){
if (finalActors[i]){
targets.PushBack(finalActors[i]);
} else {

break;
}
i += 1;
}
}
/* NOP */;
}
protected function ProcessThrow(){
var proj : W3AxiiProjectile;
var i : Int32;
var spawnPos : Vector;
var spawnRot : EulerAngles;
spawnPos = GetWorldPosition();
spawnRot = GetWorldRotation();
StopEffect(effects[fireMode].castEffect);
PlayEffect('axii_sign_push', /* NOP */);
i = 0;
while (i < targets.Size()){
proj = (W3AxiiProjectile)theGame.CreateEntity(projTempla
te, spawnPos, spawnRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
proj.PreloadEffect(proj.projData.flyEffect);
proj.ExtInit(owner, skillEnum, this, /* NOP */);
proj.PlayEffect(proj.projData.flyEffect, /* NOP */);
proj.ShootProjectileAtNode(0, projSpeed, targets[i], /*
NOP */, /* NOP */);
i += 1;
}
/* NOP */;
}
public function OnEnded(isEnd : Bool) : Bool{
var buff : EEffectInteract;
var conf : W3ConfuseEffect;
var i : Int32;
var duration : SAbilityAttributeValue;
var durationAnimal : SAbilityAttributeValue;
var casterActor : CActor;
var dur : Float;
var durAnimals : Float;
var params : SCustomEffectParams;
var staggerParams : SCustomEffectParams;
var npcTarget : CNewNPC;
var jobTreeType : EJobTreeType;
casterActor = owner.GetActor();
ProcessThrow();
StopEffect(effects[fireMode].throwEffect);
i = 0;
while (i < targets.Size()){
RemoveMagic17Effect(targets[i]);
i += 1;
}
RemoveMagic17Effect(orientationTarget);
if (IsAlternateCast()){
thePlayer.LockToTarget(false);
thePlayer.EnableManualCameraControl(true, 'AxiiEntity');
}
if (targets.Size() > 0){
duration = thePlayer.GetSkillAttributeValue(skillEnum, '
duration', false, true);
durationAnimal = thePlayer.GetSkillAttributeValue(skillE
num, 'duration_animals', false, true);

duration.valueMultiplicative = 1.000000;
durationAnimal.valueMultiplicative = 1.000000;
if (owner.CanUseSkill(55)){
duration -= owner.GetSkillAttributeValue(55, 'du
ration', false, true) * 3 - owner.GetSkillLevel(55);
durationAnimal -= owner.GetSkillAttributeValue(5
5, 'duration', false, true) * 3 - owner.GetSkillLevel(55);
}
dur = CalculateAttributeValue(duration, /* NOP */);
durAnimals = CalculateAttributeValue(durationAnimal, /*
NOP */);
params.creator = casterActor;
params.sourceName = "axii_" + skillEnum;
params.customPowerStatValue = casterActor.GetTotalSignSp
ellPower(skillEnum);
params.isSignEffect = true;
i = 0;
while (i < targets.Size()){
npcTarget = (CNewNPC)targets[i];
if (targets[i].IsAnimal() || npcTarget.IsHorse()
){
params.duration = durAnimals;
} else {
params.duration = dur;
}
jobTreeType = npcTarget.GetCurrentJTType();
if (jobTreeType == 2){
params.effectType = 36;
} else if (IsAlternateCast() && owner.GetActor()
== thePlayer && GetAttitudeBetween(targets[i], owner.GetActor()) == 0){
params.effectType = 5;
} else {
params.effectType = actionBuffs[0].effec
tType;
}
RemoveMagic17Effect(targets[i]);
buff = targets[i].AddEffectCustom(params);
if (buff == 3 || buff == 2 || buff == 4){
targets[i].OnAxiied(casterActor);
if (owner.CanUseSkill(54)){
conf = (W3ConfuseEffect)targets[
i].GetBuff(params.effectType, "axii_" + skillEnum);
conf.SetDrainStaminaOnExit();
}
} else if (owner.CanUseSkill(53) && owner.GetSki
llLevel(53) == 3){
staggerParams = params;
staggerParams.effectType = 13;
params.duration = 0;
targets[i].AddEffectCustom(staggerParams
);
} else {
owner.GetActor().SetBehaviorVariable('ax
iiResisted', 1.000000, /* NOP */);
}
i += 1;
}
}
super.OnEnded(/* NOP */);
/* NOP */;

}
public function OnSignAborted(force : Bool) : Bool{
HAXX_THIS_SHT__AXII_ABORTED();
super.OnSignAborted(force);
/* NOP */;
}
public function HAXX_THIS_SHT__AXII_ABORTED(){
var i : Int32;
i = 0;
while (i < targets.Size()){
RemoveMagic17Effect(targets[i]);
i += 1;
}
RemoveMagic17Effect(orientationTarget);
/* NOP */;
}
public function OnDisplayTargetChange(newTarget : CActor){
var buffParams : SCustomEffectParams;
if (!owner.CanUseSkill(53) || owner.GetSkillLevel(53) == 0){
return;
}
if (newTarget == orientationTarget){
return;
}
RemoveMagic17Effect(orientationTarget);
orientationTarget = newTarget;
AddMagic17Effect(orientationTarget);
/* NOP */;
}
private function AddMagic17Effect(target : CActor){
var buffParams : SCustomEffectParams;
if (!target || owner.GetActor() != GetWitcherPlayer() || !GetWit
cherPlayer().CanUseSkill(53)){
return;
}
buffParams.effectType = 114;
buffParams.creator = this;
buffParams.sourceName = "axii_immobilize";
buffParams.duration = 10;
buffParams.effectValue.valueAdditive = 0.999000;
buffParams.isSignEffect = true;
target.AddEffectCustom(buffParams);
/* NOP */;
}
private function RemoveMagic17Effect(target : CActor){
if (target){
target.RemoveBuff(114, true, "axii_immobilize");
}
/* NOP */;
}
}
import abstract class SPartyWaypointHandle{
}
state W3SignEntityStateChanneling in W3SignEntity extends W3SignEntityStateBaseC
ast{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.cachedCost = -1.000000;

theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(parent.owner.GetActor(), 'CastSignAction', -1, 8.000000, 0.200000, -1, true, /
* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
caster.GetActor().ResumeEffects(2, 'SignCast');
theGame.GetBehTreeReactionManager().RemoveReactionEvent(parent.o
wner.GetActor(), 'CastSignAction');
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(parent.owner.GetActor(), 'CastSignAction', -1, 8.000000, -1.000000, -1, true,
/* NOP */, /* NOP */);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnThrowing() : Bool{
var actor : CActor;
var player : CR4Player;
var stamina : Float;
if (super.OnThrowing()){
actor = caster.GetActor();
player = (CR4Player)actor;
if (player){
if (parent.cachedCost <= 0.000000){
parent.cachedCost = player.GetStaminaAct
ionCost(12, SkillEnumToName(parent.skillEnum), 0);
}
stamina = player.GetStat(2, /* NOP */);
}
actor.DrainStamina(12, 0, 0, SkillEnumToName(parent.skil
lEnum), /* NOP */, /* NOP */);
actor.StartStaminaRegen();
actor.PauseEffects(2, 'SignCast', true, /* NOP */, /* NO
P */);
if (player && parent.cachedCost > stamina && player.CanU
seSkill(89)){
player.DrainFocus(1);
}
return true;
}
return false;
/* NOP */;
}
public function OnCheckChanneling() : Bool{
return true;
/* NOP */;
}
public function Update() : Bool{
var multiplier : Float;
var stamina : Float;
var leftStaminaCostPerc : Float;
var leftStaminaCost : Float;
var player : CR4Player;
var reductionCounter : Int32;
var stop : Bool;
var costReduction : SAbilityAttributeValue;
player = caster.GetPlayer();
if (player){
stop = false;
if (ShouldStopChanneling()){

stop = true;
} else if (player.CanUseSkill(88)){
if (player.GetStat(2, /* NOP */) <= 0 && player.
GetStat(4, /* NOP */) <= 0){
stop = true;
} else {
stop = false;
}
} else {
stop = player.GetStat(2, /* NOP */) <= 0;
}
}
if (stop){
OnEnded(/* NOP */);
return false;
} else {
if (player && !(W3QuenEntity)parent){
theGame.VibrateControllerLight(/* NOP */);
}
reductionCounter = caster.GetSkillLevel(parent.skillEnum
) - 1;
multiplier = 1;
if (reductionCounter > 0){
costReduction = caster.GetSkillAttributeValue(pa
rent.skillEnum, 'stamina_cost_reduction_after_1', false, false) * reductionCount
er;
multiplier = 1 - costReduction.valueMultiplicati
ve;
}
if (!virtual_parent.GetSignType() == 3 && caster.CanUseS
kill(40) && multiplier == 0){
if (player){
if (parent.cachedCost <= 0.000000){
parent.cachedCost = multiplier *
player.GetStaminaActionCost(12, SkillEnumToName(parent.skillEnum), theTimer.tim
eDelta);
}
stamina = player.GetStat(2, /* NOP */);
}
if (multiplier > 0.000000){
caster.GetActor().DrainStamina(12, 0, 0,
SkillEnumToName(parent.skillEnum), theTimer.timeDelta, multiplier);
}
if (player && parent.cachedCost > stamina){
leftStaminaCost = parent.cachedCost - st
amina;
leftStaminaCostPerc = leftStaminaCost /
player.GetStatMax(2);
player.DrainFocus(leftStaminaCostPerc);
}
}
caster.OnProcessCastingOrientation(true);
}
return true;
/* NOP */;
}
protected function ShouldStopChanneling() : Bool{
var currentInputContext : CName;
if (theInput.GetActionValue('CastSignHold') > 0.000000){
return false;

} else {
return true;
}
/* NOP */;
}
}
state W3SignEntityStateActive in W3SignEntity extends CScriptableState{
public var caster : W3SignOwner;
public function OnEnterState(prevStateName : CName) : Bool{
caster = parent.owner;
/* NOP */;
}
public function OnSignAborted(force : Bool) : Bool{
if (force){
parent.StopAllEffects();
parent.GotoState('Finished', /* NOP */, /* NOP */);
}
/* NOP */;
}
}
import abstract class IEquipmentInitializer{
}
import abstract class CEquipmentDefinitionEntry{
}
class W3Mutagen17_Effect extends W3Mutagen_Effect{
private var hasBoost : Bool;
public function OnUpdate(dt : Float) : Bool{
var cnt : Int32;
super.OnUpdate(dt);
if (!hasBoost){
cnt = 0;
if (FactsQuerySum("ach_counter") > 0){
cnt += 1;
}
if (FactsQuerySum("ach_attack") > 0){
cnt += 1;
}
if (FactsQuerySum("ach_sign") > 0){
cnt += 1;
}
if (FactsQuerySum("ach_bomb") > 0){
cnt += 1;
}
if (FactsQuerySum("ach_crossbow") > 0){
cnt += 1;
}
if (cnt >= 3){
target.AddAbility(abilityName, false);
hasBoost = true;
}
}
/* NOP */;
}
public function HasBoost() : Bool{
return hasBoost;
/* NOP */;

}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
target.RemoveAbility(abilityName);
/* NOP */;
}
public function ClearBoost(){
hasBoost = false;
target.RemoveAbility(abilityName);
/* NOP */;
}
}
state W3SignEntityStateBaseCast in W3SignEntity extends CScriptableState{
public var caster : W3SignOwner;
public function OnEnterState(prevStateName : CName) : Bool{
caster = parent.owner;
if (caster.IsPlayer() && !(W3QuenEntity)parent || (W3YrdenEntity
)parent){
caster.GetPlayer().GetMovingAgentComponent().EnableVirtu
alController('Signs', true);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
caster.GetActor().SetBehaviorVariable('IsCastingSign', 0, /* NOP
*/);
caster.SetCurrentlyCastSign(5, NULL);
/* NOP */;
/* NOP */;
}
public function OnThrowing() : Bool{
if (caster.IsPlayer()){
FactsAdd("ach_sign", 1, 4);
theGame.GetGamerProfile().CheckLearningTheRopes();
}
return true;
/* NOP */;
}
public function OnEnded(isEnd : Bool) : Bool{
parent.OnEnded(isEnd);
parent.GotoState('Finished', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnSignAborted(force : Bool) : Bool{
parent.CleanUp();
parent.StopAllEffects();
parent.GotoState('Finished', /* NOP */, /* NOP */);
/* NOP */;
}
}
abstract class CBTTaskCastSign extends CBTTaskAttack{
protected var resourceName : CName;
protected var entityTemplate : CEntityTemplate;
protected var signEntity : W3SignEntity;
protected var action : W3DamageAction;
protected var signType : ESignType;
protected var attackRangeName : CName;
private var signOwner : W3SignOwnerBTTaskCastSign;

public function IsAvailable() : Bool{


return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
signOwner = new W3SignOwnerBTTaskCastSign in this;
signOwner.Init(GetActor(), this);
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
entityTemplate = (CEntityTemplate)LoadResourceAsync(resourceName
, /* NOP */);
if (entityTemplate){
signEntity = (W3SignEntity)theGame.CreateEntity(entityTe
mplate, GetActor().GetWorldPosition(), GetActor().GetWorldRotation(), /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
LogAssert(signEntity, "Sign entity in CBTTaskCastSign is
not a W3SignEntity type");
}
SetupSignType();
GetActor().SetBehaviorVariable('signType', signType, /* NOP */);
if (signEntity){
signEntity.Init(signOwner, NULL, /* NOP */);
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
Ended();
delete signOwner;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (signEntity){
signEntity.OnProcessSignEvent(animEventName);
}
if (animEventName == 'cast_begin'){
Started();
} else if (animEventName == 'cast_throw'){
Throw();
} else if (animEventName == 'cast_end'){
Ended();
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
public function Started(){
}
public function Throw(){
}
public function Ended(){
signEntity.StopAllEffects();
signEntity.OnEnded(/* NOP */);
signEntity = NULL;
/* NOP */;
}

public function SetupSignType(){


if (signEntity){
signType = signEntity.GetSignType();
} else {
LogAssert(false, "Sign entity not found or SetupSignType
not specialized in CBTTaskCastSign");
signType = 5;
}
/* NOP */;
}
public function GetAttackRangeType() : CName{
return attackRangeName;
/* NOP */;
}
}
struct SYrdenEffects{
editable var castEffect : CName;
editable var placeEffect : CName;
editable var shootEffect : CName;
editable var activateEffect : CName;
}
import struct CAIAttackRange{
//NULL type for rangeMax
import public final function Test(sourceEntity : CGameplayEntity, target
Entity : CGameplayEntity) : Bool;
import public final function GatherEntities(sourceEntity : CGameplayEnti
ty, entities : array<CGameplayEntity>);
}
import abstract class IEdEntitySetupEffector{
}
import abstract class CActionPoint{
}
class W3MagicalThing extends CProjectileTrajectory{
private var dmg : Float;
public function ExtInit(caster : CActor, damage : Float){
Init(caster);
dmg = -damage;
/* NOP */;
}
public function ThrowAt(target : CActor){
ShootProjectileAtNode(3.000000, 3.000000, thePlayer, /* NOP */,
/* NOP */);
PlayEffect('concentration', /* NOP */);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CActor;
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
}
if (victim && victim != caster){
/* NOP */;
StopProjectile();

StopAllEffects();
Destroy();
}
/* NOP */;
}
public function OnRangeReached() : Bool{
Destroy();
/* NOP */;
}
}
import abstract class CHudResource{
}
class W3PhysicalThing extends CProjectileTrajectory{
private var dmg : Float;
private var big : Bool;
public function ExtInit(caster : CActor, damage : Float){
Init(caster);
dmg = damage;
/* NOP */;
}
public function ThrowAt(target : CActor){
ShootProjectileAtNode(3.000000, 3.000000, thePlayer, /* NOP */,
/* NOP */);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CActor;
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
}
if (victim && victim != caster){
/* NOP */;
StopProjectile();
Destroy();
}
/* NOP */;
}
public function OnRangeReached() : Bool{
Destroy();
/* NOP */;
}
}
import abstract class CMenuResource{
}
abstract class W3PhysicalSwitch extends W3Switch{
public editable var switchOnAnimationType : PhysicalSwitchAnimationType;
public editable var switchOffAnimationType : PhysicalSwitchAnimationType
;
protected var showActorAnimation : Bool;
protected function ActivateEvents(events : array<W3SwitchEvent>){
if (showActorAnimation){
}
super.ActivateEvents(events);
/* NOP */;

}
public function Enable(enable : Bool){
super.Enable(enable);
/* NOP */;
}
public function Lock(lock : Bool){
super.Lock(lock);
/* NOP */;
}
}
import abstract class CPopupResource{
}
class W3CollectiblePlaces extends CGameplayEntity{
public editable var xpPoints : Int32;
public saved var wasDiscovered : Bool;
public var allTags : array<CName>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (wasDiscovered || GetCollectibleInstanceTag() == ""){
GetComponent("CollectibleInteraction").SetEnabled(false)
;
GetComponent("Medallion").SetEnabled(false);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (!FactsDoesExist(GetCollectibleInstanceTag())){
if (actionName == "Use" && activator == thePlayer){
PlayEffect('select_fx', this);
GetWitcherPlayer().AddPoints(1, xpPoints, true);
FactsAdd(GetCollectibleInstanceTag(), 1, /* NOP
*/);
FactsAdd("collected_power_place", 1, /* NOP */);
/* NOP */;
GetComponent("CollectibleInteraction").SetEnable
d(false);
GetComponent("Medallion").SetEnabled(false);
wasDiscovered = true;
}
}
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (interactionComponentName == "Medallion" && activator == theP
layer){
GetWitcherPlayer().GetMedallion().Activate(true, 5.00000
0);
}
/* NOP */;
}
public function GetCollectibleInstanceTag() : String{
var i : Int32;
var factToAdd : String;
allTags = GetTags();
if (allTags.Size() == 0 || allTags.Size() > 1){
return "";
} else {

i = 0;
while (i < allTags.Size()){
factToAdd = NameToString(allTags[i]);
return factToAdd;
i += 1;
}
}
/* NOP */;
}
}
import abstract class SHudDescription{
}
import abstract class SMenuDescription{
}
statemachine class W3WitchesCage extends CEntity{
}
class W3ClueCorpse extends W3MonsterClue{
public editable var woundName : CName;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
AddTimer('ApplyDismemberment', 0.200000, false, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
UpdateVisibility();
/* NOP */;
}
public function OnStreamIn() : Bool{
super.OnStreamIn();
UpdateVisibility();
/* NOP */;
}
public timer function ApplyDismemberment(optional time : Float, optional
id : Int32){
UpdateVisibility();
/* NOP */;
}
public function UpdateVisibility(){
var component : CDismembermentComponent;
ProcessReleaseVersions();
super.UpdateVisibility();
component = (CDismembermentComponent)GetComponentByClassName('CD
ismembermentComponent');
if (component){
if (woundName != 'None' && component.IsWoundDefined(woun
dName)){
component.ClearVisibleWound();
component.SetVisibleWound(woundName, /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
}

import abstract class SPopupDescription{


}
class W3DisarmClue extends W3MonsterClue{
public editable var connectedTripwireTag : CName;
public var connectedTripwire : W3TripwireSwitch;
public function OnClueDetected() : Bool{
AddTimer('DisarmTimer', interactionAnimTime, true, /* NOP */, /*
NOP */, true, /* NOP */);
/* NOP */;
}
public timer function DisarmTimer(optional td : Float, optional id : Int
32){
isVisibleAsClue = false;
super.OnClueDetected();
connectedTripwire = (W3TripwireSwitch)theGame.GetEntityByTag(con
nectedTripwireTag);
if (connectedTripwire){
connectedTripwire.Disarm();
}
Destroy();
/* NOP */;
}
}
class W3DaoPillarObstacle extends W3DurationObstacle{
private editable var damageValue : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
AddTimer('Appear', 0.500000, /* NOP */, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
/* NOP */;
}
private timer function Appear(optional _Delta : Float, optional id : Int
32){
var i : Int32;
var l_entitiesInRange : array<CGameplayEntity>;
var l_range : Float;
var l_actor : CActor;
var none : SAbilityAttributeValue;
var l_damage : W3DamageAction;
var l_summonedEntityComp : W3SummonedEntityComponent;
var l_summoner : CActor;
l_summonedEntityComp = (W3SummonedEntityComponent)GetComponentBy
ClassName('W3SummonedEntityComponent');
if (!l_summonedEntityComp){
return;
}
l_summoner = l_summonedEntityComp.GetSummoner();
l_range = 1;
PlayEffect('circle_stone', /* NOP */);
FindGameplayEntitiesInRange(l_entitiesInRange, this, l_range, 10
00, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < l_entitiesInRange.Size()){
l_actor = (CActor)l_entitiesInRange[i];
if (!l_actor){
} else if (l_actor == l_summoner){
} else {

l_damage = new W3DamageAction in this;


l_damage.Initialize(l_summoner, l_actor, l_summo
ner, l_summoner.GetName(), 2, 2, false, false, false, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
l_damage.AddDamage(theGame.params.DAMAGE_NAME_PH
YSICAL, damageValue);
l_damage.AddEffectInfo(10, 1, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(l_damage);
delete l_damage;
}
i += 1;
}
/* NOP */;
}
}
class W3IceSpike extends W3DurationObstacle{
private editable var damageValue : Float;
private editable var weaponSlot : CName;
private var canBeDestroyed : Bool;
private var destroyAfterTime : Float;
private var delayToDealDamage : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var i : Int32;
var l_destructible : CDestructionSystemComponent;
var l_drawableCmps : array<CComponent>;
var l_cmp : CDrawableComponent;
super.OnSpawned(spawnData);
l_destructible = (CDestructionSystemComponent)GetComponentByClas
sName('CDestructionSystemComponent');
if (l_destructible){
canBeDestroyed = true;
}
if (destroyAfterTime > 0){
DestroyAfter(destroyAfterTime);
}
Appear(/* NOP */, /* NOP */);
/* NOP */;
}
private timer function Appear(optional _Delta : Float, optional id : Int
32){
PlayEffect('appear', /* NOP */);
AddTimer('DealDamage', delayToDealDamage, false, /* NOP */, /* N
OP */, true, /* NOP */);
/* NOP */;
}
private timer function DealDamage(optional _Delta : Float, optional id :
Int32){
var i : Int32;
var l_actorsRange : array<CActor>;
var l_range : Float;
var l_actor : CActor;
var none : SAbilityAttributeValue;
var l_damageAction : W3DamageAction;
var l_summonedEntityComp : W3SummonedEntityComponent;
var l_summoner : CActor;
var l_damageAttr : SAbilityAttributeValue;
var l_inv : CInventoryComponent;
var l_weaponId : SItemUniqueId;

var l_damageValue : Float;


var l_damageNames : array<CName>;
var l_attribute : CName;
l_summonedEntityComp = (W3SummonedEntityComponent)GetComponentBy
ClassName('W3SummonedEntityComponent');
if (!l_summonedEntityComp){
return;
}
l_summoner = l_summonedEntityComp.GetSummoner();
l_range = 0.300000;
l_actorsRange = GetActorsInRange(this, l_range, -1, /* NOP */, t
rue);
i = 0;
while (i < l_actorsRange.Size()){
l_actor = l_actorsRange[i];
if (l_actor == l_summoner){
} else {
l_damageAction = new W3DamageAction in this;
l_damageAction.Initialize(l_summoner, l_actor, l
_summoner, l_summoner.GetName(), 2, 2, false, false, false, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
l_summoner.GetVisualDebug().AddSphere('Detection
Range', l_range, GetWorldPosition(), true, /* NOP */, /* NOP */);
l_summoner.GetVisualDebug().AddText('DetectionRa
ngeText', "Ice", GetWorldPosition(), true, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
if (l_summoner && IsNameValid(weaponSlot)){
l_inv = l_summoner.GetInventory();
l_weaponId = l_inv.GetItemFromSlot(weapo
nSlot);
l_inv.GetWeaponDTNames(l_weaponId, l_dam
ageNames);
l_attribute = GetBasicAttackDamageAttrib
uteName(theGame.params.ATTACK_NAME_HEAVY, theGame.params.DAMAGE_NAME_FROST);
l_damageAttr = l_summoner.GetAttributeVa
lue(l_attribute, /* NOP */, /* NOP */);
l_damageAttr.valueBase = l_summoner.GetT
otalWeaponDamage(l_weaponId, l_damageNames[0], GetInvalidUniqueId());
l_damageValue = l_damageAttr.valueBase *
l_damageAttr.valueMultiplicative + l_damageAttr.valueAdditive;
if (l_damageValue > 0){
l_damageAction.AddDamage(theGame
.params.DAMAGE_NAME_FROST, l_damageValue);
} else {
l_damageAction.AddDamage(theGame
.params.DAMAGE_NAME_PHYSICAL, damageValue);
}
} else {
l_damageAction.AddDamage(theGame.params.
DAMAGE_NAME_PHYSICAL, damageValue);
}
theGame.damageMgr.ProcessAction(l_damageAction);
delete l_damageAction;
}
i += 1;
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
if (canBeDestroyed){

ShowDestructible();
DestroyAfter(1.500000);
}
/* NOP */;
}
private function SpecificDisappear(){
canBeDestroyed = false;
/* NOP */;
}
private function ShowDestructible(){
var l_destructible : CDestructionSystemComponent;
var l_mesh : CMeshComponent;
l_destructible = (CDestructionSystemComponent)GetComponentByClas
sName('CDestructionSystemComponent');
l_destructible.SetVisible(true);
l_mesh = (CMeshComponent)GetComponentByClassName('CMeshComponent
');
if (l_mesh){
l_mesh.SetVisible(false);
}
/* NOP */;
}
}
import abstract class IMenuTimeParam{
}
import abstract class IMenuBackgroundVideoParam{
}
class W3WitchBoilingWaterObstacle extends W3DurationObstacle{
private editable var applyDebuffType : EEffectType;
private editable var debuffDuration : Float;
private editable var simpleDamageAction : Bool;
private editable var damageValue : Float;
private editable var allowDmgValueOverrideFromXML : Bool;
private editable var attackDelay : Float;
private editable var attackRadius : Float;
private editable var increaseRadiusDelta : Float;
private editable var ignoreVictimWithTag : CName;
private editable var preAttackEffectName : CName;
private editable var attackEffectName : CName;
private editable var hitReactionType : EHitReactionType;
private editable var loopedAttack : Bool;
private var summoner : CActor;
private var params : SCustomEffectParams;
private var effectComponent : CComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
effectComponent = GetComponentByClassName('CEffectDummyComponent
');
if (IsNameValid(preAttackEffectName)){
PlayEffect(preAttackEffectName, /* NOP */);
}
AddTimer('Appear', attackDelay, loopedAttack, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
if (increaseRadiusDelta > 0){
AddTimer('ScaleEffect', 0.010000, true, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
}

/* NOP */;
}
private timer function Appear(optional _Delta : Float, optional id : Int
32){
var i : Int32;
var l_entitiesInRange : array<CGameplayEntity>;
var l_damage : W3DamageAction;
var l_actor : CActor;
var none : SAbilityAttributeValue;
var l_tempBool : Bool;
if (!l_tempBool){
if (!SetParams()){
return;
}
l_tempBool = true;
}
if (IsNameValid(attackEffectName)){
PlayEffect(attackEffectName, /* NOP */);
}
FindGameplayEntitiesInRange(l_entitiesInRange, this, attackRadiu
s, 1000, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < l_entitiesInRange.Size()){
l_actor = (CActor)l_entitiesInRange[i];
if (!l_actor){
} else if (l_actor == summoner){
} else if (IsNameValid(ignoreVictimWithTag) && l_actor.H
asTag(ignoreVictimWithTag)){
} else if (!l_actor.IsCurrentlyDodging()){
if (damageValue > 0){
if (simpleDamageAction){
l_damage = new W3DamageAction in
this;
l_damage.Initialize(summoner, l_
actor, summoner, summoner.GetName(), hitReactionType, 2, false, false, false, tr
ue, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
l_damage.AddDamage(theGame.param
s.DAMAGE_NAME_PHYSICAL, damageValue);
theGame.damageMgr.ProcessAction(
l_damage);
delete l_damage;
}
if (applyDebuffType != 0){
l_actor.AddEffectCustom(params);
}
}
}
i += 1;
}
/* NOP */;
}
public function SetParams() : Bool{
var l_dm : CDefinitionsManagerAccessor;
var l_summonedEntityComp : W3SummonedEntityComponent;
var l_dmg_min : SAbilityAttributeValue;
var l_dmg_max : SAbilityAttributeValue;
l_dm = theGame.GetDefinitionsManager();
l_summonedEntityComp = (W3SummonedEntityComponent)GetComponentBy
ClassName('W3SummonedEntityComponent');
if (!l_summonedEntityComp){

return false;
}
summoner = l_summonedEntityComp.GetSummoner();
if (allowDmgValueOverrideFromXML){
l_dm.GetAbilityAttributeValue('environment_DamageStats',
'witch_boiling_water', l_dmg_min, l_dmg_max);
if (l_dmg_max.valueBase * l_dmg_max.valueMultiplicative
> 0){
damageValue = l_dmg_max.valueBase * l_dmg_max.va
lueMultiplicative;
}
} else {
l_dmg_max.valueAdditive = damageValue;
}
if (applyDebuffType != 0){
params.effectType = applyDebuffType;
params.sourceName = 'witch_boiling_water';
params.duration = debuffDuration;
params.effectValue = l_dmg_max;
params.customFXName = 'bla';
}
return true;
/* NOP */;
}
public timer function ScaleEffect(optional deltaTime : Float, optional i
d : Int32){
var l_currentScaleRate : Float;
var l_scaleVector : Vector;
attackRadius += increaseRadiusDelta * deltaTime;
l_currentScaleRate += increaseRadiusDelta * deltaTime;
l_scaleVector.X = l_currentScaleRate;
l_scaleVector.Y = l_currentScaleRate;
l_scaleVector.Z = l_currentScaleRate;
effectComponent.SetScale(l_scaleVector);
/* NOP */;
}
private function SpecificDisappear(){
damageValue = 0;
/* NOP */;
}
}
import abstract class IMenuDisplayParam{
}
class CFoodBoidPointOfInterest extends CBoidPointOfInterestComponentScript{
public editable var expirationTime : Int32;
private var useCounter : Float;
public var entity : CEntity;
public var poiDisp : W3POIDispenser;
public var poi : W3PointOfInterestEntity;
public function OnUsed(count : Int32, deltaTime : Float){
useCounter += deltaTime * count;
if (useCounter > expirationTime){
entity = GetEntity();
poi = (W3PointOfInterestEntity)entity;
if (poi){
poiDisp = poi.GetDispenser();
if (poi.CanBeDestroyed()){
poiDisp.DespawnPOI(poi);

} else {
poiDisp.DeactivatePOI(poi);
}
} else {
entity.GetComponentByClassName('CFoodBoidPointOf
Interest').SetEnabled(false);
}
}
/* NOP */;
}
}
import abstract class CMenuDef{
}
import abstract class IPopupTimeParam{
}
import abstract class CPopupDef{
}
class TextPopupData extends W3PopupData{
protected var m_TextContent : String;
protected var m_TextTitle : String;
public var m_DisplayGreyBackground : Bool;
public function SetMessageText(value : String){
m_TextContent = value;
/* NOP */;
}
public function SetMessageTitle(value : String){
m_TextTitle = value;
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = parentFlashValueStorage.CreateTempFlashObject(/*
NOP */);
l_flashObject.SetMemberFlashString("ContentRef", GetContentRef()
);
l_flashObject.SetMemberFlashString("TextContent", m_TextContent)
;
l_flashObject.SetMemberFlashString("TextTitle", m_TextTitle);
l_flashObject.SetMemberFlashBool("backgroundVisible", m_DisplayG
reyBackground);
return l_flashObject;
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_exit", "escape-gamepad_B", 27)
;
/* NOP */;
}
protected function GetContentRef() : String{
return "TextPopupRef";
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
/* NOP */;
if (KeyCode == "escape-gamepad_B"){

ClosePopup();
}
/* NOP */;
}
}
import abstract class CWizardQuestionNode{
}
import struct CCustomCamera{
//NULL type for fov
//NULL type for allowAutoRotation
import public final function Activate(blendTime : Float);
import public final function GetActivePivotPositionController() : ICusto
mCameraPivotPositionController;
import public final function GetActivePivotRotationController() : ICusto
mCameraPivotRotationController;
import public final function GetActivePivotDistanceController() : ICusto
mCameraPivotDistanceController;
import public final function ChangePivotPositionController(_name : CName
) : Bool;
import public final function ChangePivotRotationController(_name : CName
) : Bool;
import public final function ChangePivotDistanceController(_name : CName
) : Bool;
import public final function BlendToPivotPositionController(_name : CNam
e, blendTime : Float) : Bool;
import public final function GetActivePreset() : SCustomCameraPreset;
import public final function PlayAnimation(animation : SCameraAnimationD
efinition);
import public final function StopAnimation(animation : CName);
import public final function FindCurve(curveName : CName) : CCurve;
import public final function SetManualRotationHorTimeout(timeOut : Float
);
import public final function SetManualRotationVerTimeout(timeOut : Float
);
import public final function GetManualRotationHorTimeout() : Float;
import public final function GetManualRotationVerTimeout() : Float;
import public final function IsManualControledHor() : Bool;
import public final function IsManualControledVer() : Bool;
import public final function ForceManualControlHorTimeout();
import public final function ForceManualControlVerTimeout();
import public final function EnableManualControl(enable : Bool);
import public final function ChangePreset(preset : CName);
import public final function NextPreset();
import public final function PrevPreset();
import public final function SetCollisionOffset(offset : Vector);
import public final function EnableScreenSpaceCorrection(enable : Bool);
import public final function SetAllowAutoRotation(allow : Bool);
public function ResetCollisionOffset(){
super.SetCollisionOffset(Vector(0.000000, 0.000000, 1.500000));
/* NOP */;
}
public function SetFov(val : Float){
fov = val;
/* NOP */;
}
public timer function TimerTurnOnEffect(optional td : Float, optional id
: Int32){
PlayEffect('focus_mode', /* NOP */);

/* NOP */;
}
public function ChangePivotController(controllerName : CName, blendTime
: Float, forcePosition : Bool) : Bool{
return false;
/* NOP */;
}
public function ChangeMovementController(controllerName : CName) : Bool{
return false;
/* NOP */;
}
}
import struct CR4SecondScreenManagerScriptProxy{
import public final function SendGlobalMapPins(mappins : array<SCommonMa
pPinInstance>);
import public final function SendAreaMapPins(areaType : Int32, mappins :
array<SCommonMapPinInstance>);
import public final function SendGameMenuOpen();
import public final function SendGameMenuClose();
import public final function SendFastTravelEnable();
import public final function SendFastTravelDisable();
import public final function PrintJsonObjectsMemoryUsage();
private function FastTravelLocal(mapPinTag : CName){
}
private function FastTravelGlobal(areaType : Int32, mapPinTag : CName){
}
}
import struct CR4KinectSpeechRecognizerListenerScriptProxy{
import public final function IsSupported() : Bool;
import public final function IsEnabled() : Bool;
import public final function SetEnabled(enable : Bool);
private function OnListenerRegistered(){
/* NOP */;
if (super.IsSupported() == false && super.IsEnabled() == true){
super.SetEnabled(false);
}
/* NOP */;
}
private function OnAudioProblem(audioProblem : Int32){
/* NOP */;
/* NOP */;
}
private function OnRecognizedCommand(recognizedCommand : Int32, semantic
Names : array<String>, semanticValues : array<String>, confidenceScore : Float){
var i : Int32;
var s : Int32;
if (theGame){
if (theGame.IsDialogOrCutscenePlaying() || IsKinectBlock
ed()){
return;
}
}
/* NOP */;
/* NOP */;
if (confidenceScore > 0.600000){
switch(recognizedCommand){
case 0:
break;

case 1:
if (semanticValues[0] == "aard"){
GetWitcherPlayer().SetEquippedSign(SignS
tringToEnum('Aard'));
} else if (semanticValues[0] == "axii"){
GetWitcherPlayer().SetEquippedSign(SignS
tringToEnum('Axii'));
} else if (semanticValues[0] == "quen"){
GetWitcherPlayer().SetEquippedSign(SignS
tringToEnum('Quen'));
} else if (semanticValues[0] == "igni"){
GetWitcherPlayer().SetEquippedSign(SignS
tringToEnum('Igni'));
} else if (semanticValues[0] == "yrden"){
GetWitcherPlayer().SetEquippedSign(SignS
tringToEnum('Yrden'));
}
break;
case 2:
break;
case 3:
if (semanticValues[0] == "map"){
GetWitcherPlayer().GetInputHandler().Pus
hMapScreen();
break;
}
if (semanticValues[0] == "quests"){
GetWitcherPlayer().GetInputHandler().Pus
hJournalScreen();
break;
}
if (semanticValues[0] == "inventory"){
GetWitcherPlayer().GetInputHandler().Pus
hInventoryScreen();
break;
}
if (semanticValues[0] == "character"){
GetWitcherPlayer().GetInputHandler().Pus
hCharacterScreen();
break;
}
if (semanticValues[0] == "glossary"){
GetWitcherPlayer().GetInputHandler().Pus
hGlossaryScreen();
}
}
}
s = semanticNames.Size();
i = 0;
while (i < s){
/* NOP */;
i += 1;
}
/* NOP */;
}
private function OnHypothesisAvailable(hypothesis : String){
/* NOP */;
/* NOP */;
}
private function IsKinectBlocked() : Bool{

var result : Bool;


result = false;
if (theGame.GetGuiManager().IsModalPopupShown()){
result = true;
}
return result;
/* NOP */;
}
}
import struct CTicketsDefaultConfiguration{
import public function SetupTicketSource(ticketName : CName, ticketPoolS
ize : Int32, minimalImportance : Float);
private function Init(){
SetupTicketSource('TICKET_Melee', 100, 100.000000);
SetupTicketSource('TICKET_Charge', 100, 100.000000);
SetupTicketSource('TICKET_Special', 100, 100.000000);
SetupTicketSource('TICKET_Taunt', 100, 100.000000);
SetupTicketSource('TICKET_Range', 100, 100.000000);
SetupTicketSource('TICKET_Aim', 100, 100.000000);
SetupTicketSource('TICKET_Approach', 100, 100.000000);
SetupTicketSource('TICKET_Swim', 100, 100.000000);
SetupTicketSource('TICKET_ReactionScene', 5, 0.000000);
SetupTicketSource('TICKET_PreCombatWarning', 100, 0.000000);
SetupTicketSource('TICKET_Tutorial', 100, 0.000000);
/* NOP */;
}
}
import struct CR4GlobalEventsScriptsDispatcher{
public var listenersByCategory : array<array<IGlobalEventScriptedListene
r>>;
import public final function RegisterForCategoryFilterName(eventCategory
: EGlobalEventCategory, filter : CName) : Bool;
import public final function RegisterForCategoryFilterNameArray(eventCat
egory : EGlobalEventCategory, filter : array<CName>) : Bool;
import public final function RegisterForCategoryFilterString(eventCatego
ry : EGlobalEventCategory, filter : String) : Bool;
import public final function RegisterForCategoryFilterStringArray(eventC
ategory : EGlobalEventCategory, filter : array<String>) : Bool;
import public final function UnregisterFromCategoryFilterName(eventCateg
ory : EGlobalEventCategory, filter : CName) : Bool;
import public final function UnregisterFromCategoryFilterNameArray(event
Category : EGlobalEventCategory, filter : array<CName>) : Bool;
import public final function UnregisterFromCategoryFilterString(eventCat
egory : EGlobalEventCategory, filter : String) : Bool;
import public final function UnregisterFromCategoryFilterStringArray(eve
ntCategory : EGlobalEventCategory, filter : array<String>) : Bool;
import public final function AddFilterNameForCategory(eventCategory : EG
lobalEventCategory, filter : CName) : Bool;
import public final function AddFilterNameArrayForCategory(eventCategory
: EGlobalEventCategory, filter : array<CName>) : Bool;
import public final function AddFilterStringForCategory(eventCategory :
EGlobalEventCategory, filter : String) : Bool;
import public final function AddFilterStringArrayForCategory(eventCatego
ry : EGlobalEventCategory, filter : array<String>) : Bool;
import public final function RemoveFilterNameFromCategory(eventCategory
: EGlobalEventCategory, filter : CName) : Bool;
import public final function RemoveFilterNameArrayFromCategory(eventCate
gory : EGlobalEventCategory, filter : array<CName>) : Bool;

import public final function RemoveFilterStringFromCategory(eventCategor


y : EGlobalEventCategory, filter : String) : Bool;
import public final function RemoveFilterStringArrayFromCategory(eventCa
tegory : EGlobalEventCategory, filter : array<String>) : Bool;
public function OnScriptedEvent(scriptedEventCategory : EScriptedEventCa
tegory, scriptedEventType : EScriptedEventType, eventParam : CName) : Bool{
OnGlobalEventName(GetGlobalEventCategory(scriptedEventCategory),
GetGlobalEventType(scriptedEventType), eventParam);
/* NOP */;
}
public function OnScriptedEventName(scriptedEventCategory : EScriptedEve
ntCategory, scriptedEventType : EScriptedEventType, eventParam : CName) : Bool{
OnGlobalEventName(GetGlobalEventCategory(scriptedEventCategory),
GetGlobalEventType(scriptedEventType), eventParam);
/* NOP */;
}
public function OnScriptedEventString(scriptedEventCategory : EScriptedE
ventCategory, scriptedEventType : EScriptedEventType, eventParam : String) : Boo
l{
OnGlobalEventString(GetGlobalEventCategory(scriptedEventCategory
), GetGlobalEventType(scriptedEventType), eventParam);
/* NOP */;
}
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
var index : Int32;
var i : Int32;
var size : Int32;
if (listenersByCategory.Size() == 0){
return false;
}
index = eventCategory;
if (index > 0 && index < listenersByCategory.Size()){
size = listenersByCategory[index].Size();
if (size == 0){
return false;
}
i = 0;
while (i < size){
listenersByCategory[index][i].OnGlobalEventName(
eventCategory, eventType, eventParam);
i += 1;
}
}
return true;
/* NOP */;
}
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
var index : Int32;
var i : Int32;
var size : Int32;
if (listenersByCategory.Size() == 0){
return false;
}
index = eventCategory;
if (index > 0 && index < listenersByCategory.Size()){
size = listenersByCategory[index].Size();
if (size == 0){
return false;

}
i = 0;
while (i < size){
listenersByCategory[index][i].OnGlobalEventStrin
g(eventCategory, eventType, eventParam);
i += 1;
}
}
return true;
/* NOP */;
}
public function Init(){
listenersByCategory.Resize(14);
/* NOP */;
}
public function IsCustomScriptsCategory(eventCategory : EGlobalEventCate
gory) : Bool{
return eventCategory >= 4;
/* NOP */;
}
public function AddListener(eventCategory : EGlobalEventCategory, listen
er : IGlobalEventScriptedListener) : Bool{
var index : Int32;
if (listenersByCategory.Size() == 0){
Init();
}
index = eventCategory;
if (index > 0 && index < listenersByCategory.Size()){
if (listenersByCategory[index].FindFirst(listener) == -1
){
listenersByCategory[index].PushBack(listener);
return true;
}
}
return false;
/* NOP */;
}
public function AddListenerFilterName(eventCategory : EGlobalEventCatego
ry, listener : IGlobalEventScriptedListener, filter : CName) : Bool{
var index : Int32;
if (AddListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 1){
super.RegisterForCategoryFilterName(even
tCategory, filter);
} else {
super.AddFilterNameForCategory(eventCate
gory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function AddListenerFilterNameArray(eventCategory : EGlobalEventC
ategory, listener : IGlobalEventScriptedListener, filter : array<CName>) : Bool{
var index : Int32;
if (AddListener(eventCategory, listener)){

if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 1){
super.RegisterForCategoryFilterNameArray
(eventCategory, filter);
} else {
super.AddFilterNameArrayForCategory(even
tCategory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function AddListenerFilterString(eventCategory : EGlobalEventCate
gory, listener : IGlobalEventScriptedListener, filter : String) : Bool{
var index : Int32;
if (AddListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 1){
super.RegisterForCategoryFilterString(ev
entCategory, filter);
} else {
super.AddFilterStringForCategory(eventCa
tegory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function AddListenerFilterStringArray(eventCategory : EGlobalEven
tCategory, listener : IGlobalEventScriptedListener, filter : array<String>) : Bo
ol{
var index : Int32;
if (AddListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 1){
super.RegisterForCategoryFilterStringArr
ay(eventCategory, filter);
} else {
super.AddFilterStringArrayForCategory(ev
entCategory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveListener(eventCategory : EGlobalEventCategory, lis
tener : IGlobalEventScriptedListener) : Bool{
var index : Int32;
if (listenersByCategory.Size() == 0){
return false;
}

index = eventCategory;
if (index > 0 && index < listenersByCategory.Size()){
if (listenersByCategory[index].Remove(listener)){
return true;
}
}
return false;
/* NOP */;
}
public function RemoveListenerFilterName(eventCategory : EGlobalEventCat
egory, listener : IGlobalEventScriptedListener, filter : CName) : Bool{
var index : Int32;
if (RemoveListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 0){
super.UnregisterFromCategoryFilterName(e
ventCategory, filter);
} else {
super.RemoveFilterNameFromCategory(event
Category, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveListenerFilterNameArray(eventCategory : EGlobalEve
ntCategory, listener : IGlobalEventScriptedListener, filter : array<CName>) : Bo
ol{
var index : Int32;
if (RemoveListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 0){
super.UnregisterFromCategoryFilterNameAr
ray(eventCategory, filter);
} else {
super.RemoveFilterNameArrayFromCategory(
eventCategory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveListenerFilterString(eventCategory : EGlobalEventC
ategory, listener : IGlobalEventScriptedListener, filter : String) : Bool{
var index : Int32;
if (RemoveListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 0){
super.UnregisterFromCategoryFilterString
(eventCategory, filter);
} else {
super.RemoveFilterStringFromCategory(eve
ntCategory, filter);

}
}
return true;
}
return false;
/* NOP */;
}
public function RemoveListenerFilterStringArray(eventCategory : EGlobalE
ventCategory, listener : IGlobalEventScriptedListener, filter : array<String>) :
Bool{
var index : Int32;
if (RemoveListener(eventCategory, listener)){
if (!IsCustomScriptsCategory(eventCategory)){
index = eventCategory;
if (listenersByCategory[index].Size() == 0){
super.UnregisterFromCategoryFilterString
Array(eventCategory, filter);
} else {
super.RemoveFilterStringArrayFromCategor
y(eventCategory, filter);
}
}
return true;
}
return false;
/* NOP */;
}
}
import abstract class CGlabalTicketSourceProvider{
}
class CR4HudModuleDeathScreen extends CR4HudModuleBase{
private var m_fxSetShowBlackscreenSFF : CScriptedFlashFunction;
public var m_flashValueStorage : CScriptedFlashValueStorage;
public var hasSaveData : Bool;
public var isOpened : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
isOpened = false;
m_anchorName = "ScaleOnly";
m_flashValueStorage = GetModuleFlashValueStorage();
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetShowBlackscreenSFF = flashModule.GetMemberFlashFunction("
setShowBlackscreen");
PopulateData();
SetTickInterval(1);
/* NOP */;
}
public function PopulateData(){
var l_FlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
l_FlashArray = m_flashValueStorage.CreateTempFlashArray();
hasSaveData = hasSaveDataToLoad();
if (hasSaveData){
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
if (theGame.GetPlatform() == 1){
l_DataFlashObject.SetMemberFlashString("label",

GetLocStringByKeyExt("panel_button_deathscreen_load_x1"));
} else if (theGame.GetPlatform() == 2){
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_button_deathscreen_load_ps4"));
} else {
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_button_deathscreen_load"));
}
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int('Load'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
l_DataFlashObject.SetMemberFlashString("label", GetLocSt
ringByKeyExt("panel_button_deathscreen_respawn"));
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int('Respawn'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
}
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_button_common_quittomainmenu"));
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashUInt('Qui
t'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
m_flashValueStorage.SetFlashArray("hud.deathscreen.list", l_Flas
hArray);
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (isOpened){
if (!CanTick(timeDelta)){
return true;
}
if (hasSaveData != hasSaveDataToLoad()){
PopulateData();
}
if (theGame.IsBlackscreen() || theGame.IsFading()){
m_fxSetShowBlackscreenSFF.InvokeSelfOneArg(Flash
ArgBool(true));
theGame.FadeInAsync(0);
}
}
/* NOP */;
}
public function OnPress(tag : CName) : Bool{
switch(tag){
case 'Load':
OnLoad();
break;
case 'Respawn':
OnRespawn();
break;
case 'Quit':
OnQuit();
break;
}
/* NOP */;
}

public function OnOpened(opened : Bool) : Bool{


var tutorialPopupRef : CR4TutorialPopup;
if (opened){
tutorialPopupRef = (CR4TutorialPopup)theGame.GetGuiManag
er().GetPopup('TutorialPopup');
if (tutorialPopupRef){
tutorialPopupRef.ClosePopup();
}
PopulateData();
theSound.EnterGameState(12);
theSound.SoundEvent('gui_global_player_death_thump');
theGame.Pause("DeathScreen");
} else {
theGame.Unpause("DeathScreen");
}
isOpened = opened;
/* NOP */;
}
public function OnLoad() : Bool{
var initData : W3MenuInitData;
initData = new W3MenuInitData in this;
initData.setDefaultState('LoadGame');
theGame.RequestMenuWithBackground('IngameMenu', 'CommonIngameMen
u', initData);
/* NOP */;
}
public function OnQuit() : Bool{
theGame.GetGuiManager().TryQuitGame();
isOpened = false;
/* NOP */;
}
public function OnRespawn() : Bool{
theGame.SetIsRespawningInLastCheckpoint();
theGame.LoadLastGameInit(true);
/* NOP */;
}
}
import abstract class CCarryableItemsRegistry{
}
import struct W3GameParams{
private var dm : CDefinitionsManagerAccessor;
private var main : SCustomNode;
public const var BASE_ABILITY_TAG : CName;
public const var PASSIVE_BONUS_ABILITY_TAG : CName;
private var forbiddenAttributes : array<CName>;
public var GLOBAL_ENEMY_ABILITY : CName;
public var ENEMY_BONUS_PER_LEVEL : CName;
public var ENEMY_BONUS_FISTFIGHT_LOW : CName;
public var ENEMY_BONUS_FISTFIGHT_HIGH : CName;
public var ENEMY_BONUS_LOW : CName;
public var ENEMY_BONUS_HIGH : CName;
public var ENEMY_BONUS_DEADLY : CName;
public var MONSTER_BONUS_PER_LEVEL : CName;
public var MONSTER_BONUS_PER_LEVEL_GROUP : CName;
public var MONSTER_BONUS_PER_LEVEL_ARMORED : CName;
public var MONSTER_BONUS_PER_LEVEL_GROUP_ARMORED : CName;
public var MONSTER_BONUS_LOW : CName;
public var MONSTER_BONUS_HIGH : CName;

public var MONSTER_BONUS_DEADLY : CName;


public var GLOBAL_PLAYER_ABILITY : CName;
public const var NOT_A_SKILL_ABILITY_TAG : CName;
public const var ALCHEMY_COOKED_ITEM_TYPE_POTION : String;
public const var ALCHEMY_COOKED_ITEM_TYPE_BOMB : String;
public const var ALCHEMY_COOKED_ITEM_TYPE_OIL : String;
public const var OIL_ABILITY_TAG : CName;
public const var ATTACK_NAME_LIGHT : CName;
public const var ATTACK_NAME_HEAVY : CName;
public const var ATTACK_NAME_SUPERHEAVY : CName;
public const var ATTACK_NO_DAMAGE : CName;
public const var MAX_DYNAMICALLY_SPAWNED_BOATS : Int32;
public const var MAX_THROW_RANGE : Float;
public const var UNDERWATER_THROW_RANGE : Float;
public const var PROXIMITY_PETARD_IDLE_DETONATION_TIME : Float;
public const var BOMB_THROW_DELAY : Float;
public const var CONTAINER_DYNAMIC_DESTROY_TIMEOUT : Int32;
public const var CRITICAL_HIT_CHANCE : CName;
public const var CRITICAL_HIT_DAMAGE_BONUS : CName;
public const var CRITICAL_HIT_FX : CName;
public const var HEAD_SHOT_CRIT_CHANCE_BONUS : Float;
public const var BACK_ATTACK_CRIT_CHANCE_BONUS : Float;
public const var DAMAGE_NAME_DIRECT : CName;
public const var DAMAGE_NAME_PHYSICAL : CName;
public const var DAMAGE_NAME_SILVER : CName;
public const var DAMAGE_NAME_SLASHING : CName;
public const var DAMAGE_NAME_PIERCING : CName;
public const var DAMAGE_NAME_BLUDGEONING : CName;
public const var DAMAGE_NAME_RENDING : CName;
public const var DAMAGE_NAME_ELEMENTAL : CName;
public const var DAMAGE_NAME_FIRE : CName;
public const var DAMAGE_NAME_FORCE : CName;
public const var DAMAGE_NAME_FROST : CName;
public const var DAMAGE_NAME_POISON : CName;
public const var DAMAGE_NAME_SHOCK : CName;
public const var DAMAGE_NAME_MORALE : CName;
public const var DAMAGE_NAME_STAMINA : CName;
public const var FOCUS_DRAIN_PER_HIT : Float;
public const var UNINTERRUPTED_HITS_CAMERA_EFFECT_REGULAR_ENEMY : CName;
public const var UNINTERRUPTED_HITS_CAMERA_EFFECT_BIG_ENEMY : CName;
public const var MONSTER_RESIST_THRESHOLD_TO_REFLECT_FISTS : Float;
public const var ARMOR_VALUE_NAME : CName;
public const var LOW_HEALTH_EFFECT_SHOW : Float;
public const var UNDERWATER_CROSSBOW_DAMAGE_BONUS : Float;
public const var IGNI_SPELL_POWER_MILT : Float;
public var DIFFICULTY_TAG_EASY : CName;
public var DIFFICULTY_TAG_MEDIUM : CName;
public var DIFFICULTY_TAG_HARD : CName;
public var DIFFICULTY_TAG_HARDCORE : CName;
public var DIFFICULTY_TAG_DIFF_ABILITY : CName;
public var DIFFICULTY_HP_MULTIPLIER : CName;
public var DIFFICULTY_DMG_MULTIPLIER : CName;
public var DIFFICULTY_TAG_IGNORE : CName;
public const var DISMEMBERMENT_ON_DEATH_CHANCE : Int32;
public const var FINISHER_ON_DEATH_CHANCE : Int32;
public const var DURABILITY_ARMOR_LOSE_CHANCE : Int32;
public const var DURABILITY_WEAPON_LOSE_CHANCE : Int32;
public const var DURABILITY_ARMOR_LOSE_VALUE : Float;
private const var DURABILITY_WEAPON_LOSE_VALUE : Float;
private const var DURABILITY_WEAPON_LOSE_VALUE_HARDCORE : Float;

public const var DURABILITY_ARMOR_CHEST_WEIGHT : Int32;


public const var DURABILITY_ARMOR_PANTS_WEIGHT : Int32;
public const var DURABILITY_ARMOR_BOOTS_WEIGHT : Int32;
public const var DURABILITY_ARMOR_GLOVES_WEIGHT : Int32;
public const var DURABILITY_ARMOR_MISS_WEIGHT : Int32;
protected var durabilityThresholdsWeapon : array<SDurabilityThreshold>;
protected var durabilityThresholdsArmor : array<SDurabilityThreshold>;
public const var TAG_REPAIR_CONSUMABLE_ARMOR : CName;
public const var TAG_REPAIR_CONSUMABLE_STEEL : CName;
public const var TAG_REPAIR_CONSUMABLE_SILVER : CName;
public const var ITEM_DAMAGED_DURABILITY : Int32;
public var INTERACTIVE_REPAIR_OBJECT_MAX_DURS : array<Int32>;
public const var CFM_SLOWDOWN_RATIO : Float;
public const var LIGHT_HIT_FX : CName;
public const var LIGHT_HIT_BACK_FX : CName;
public const var LIGHT_HIT_PARRIED_FX : CName;
public const var LIGHT_HIT_BACK_PARRIED_FX : CName;
public const var HEAVY_HIT_FX : CName;
public const var HEAVY_HIT_BACK_FX : CName;
public const var HEAVY_HIT_PARRIED_FX : CName;
public const var HEAVY_HIT_BACK_PARRIED_FX : CName;
public const var LOW_HP_SHOW_LEVEL : Float;
public const var TAG_ARMOR : CName;
public const var TAG_ENCUMBRANCE_ITEM_FORCE_YES : CName;
public const var TAG_ENCUMBRANCE_ITEM_FORCE_NO : CName;
public const var TAG_ITEM_UPGRADEABLE : CName;
public const var TAG_DONT_SHOW : CName;
public const var TAG_DONT_SHOW_ONLY_IN_PLAYERS : CName;
public const var TAG_ITEM_SINGLETON : CName;
public const var TAG_INFINITE_AMMO : CName;
public const var TAG_UNDERWATER_AMMO : CName;
public const var TAG_GROUND_AMMO : CName;
public const var TAG_ILLUSION_MEDALLION : CName;
public const var TAG_PLAYER_STEELSWORD : CName;
public const var TAG_PLAYER_SILVERSWORD : CName;
private var ARMOR_MASTERWORK_ABILITIES : array<CName>;
private var ARMOR_MAGICAL_ABILITIES : array<CName>;
private var GLOVES_MASTERWORK_ABILITIES : array<CName>;
private var GLOVES_MAGICAL_ABILITIES : array<CName>;
private var PANTS_MASTERWORK_ABILITIES : array<CName>;
private var PANTS_MAGICAL_ABILITIES : array<CName>;
private var BOOTS_MASTERWORK_ABILITIES : array<CName>;
private var BOOTS_MAGICAL_ABILITIES : array<CName>;
private var WEAPON_MASTERWORK_ABILITIES : array<CName>;
private var WEAPON_MAGICAL_ABILITIES : array<CName>;
public const var ITEM_SET_TAG_BEAR : CName;
public const var ITEM_SET_TAG_GRYPHON : CName;
public const var ITEM_SET_TAG_LYNX : CName;
public const var ITEM_SET_TAG_WOLF : CName;
public const var BOUNCE_ARROWS_ABILITY : CName;
public const var TAG_ALCHEMY_REFILL_ALCO : CName;
public const var REPAIR_OBJECT_BONUS_ARMOR_ABILITY : CName;
public const var REPAIR_OBJECT_BONUS_WEAPON_ABILITY : CName;
public const var REPAIR_OBJECT_BONUS : CName;
public const var CIRI_SWORD_NAME : CName;
private var newGamePlusLevel : Int32;
private const var NEW_GAME_PLUS_LEVEL_ADD : Int32;
public const var TAG_STEEL_OIL : CName;
public const var TAG_SILVER_OIL : CName;
public const var HEAVY_STRIKE_COST_MULTIPLIER : Float;

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const
const

var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var
var

PARRY_HALF_ANGLE : Int32;
PARRY_STAGGER_REDUCE_DAMAGE_LARGE : Float;
PARRY_STAGGER_REDUCE_DAMAGE_SMALL : Float;
POTION_QUICKSLOTS_COUNT : Int32;
TAG_STEEL_SOCKETABLE : CName;
TAG_SILVER_SOCKETABLE : CName;
TAG_ARMOR_SOCKETABLE : CName;
TAG_ABILITY_SOCKET : CName;
STAMINA_COST_PARRY_ATTRIBUTE : CName;
STAMINA_COST_COUNTERATTACK_ATTRIBUTE : CName;
STAMINA_COST_EVADE_ATTRIBUTE : CName;
STAMINA_COST_SWIMMING_PER_SEC_ATTRIBUTE : CName;
STAMINA_COST_SUPER_HEAVY_ACTION_ATTRIBUTE : CName;
STAMINA_COST_HEAVY_ACTION_ATTRIBUTE : CName;
STAMINA_COST_LIGHT_ACTION_ATTRIBUTE : CName;
STAMINA_COST_DODGE_ATTRIBUTE : CName;
STAMINA_COST_SPRINT_ATTRIBUTE : CName;
STAMINA_COST_SPRINT_PER_SEC_ATTRIBUTE : CName;
STAMINA_COST_JUMP_ATTRIBUTE : CName;
STAMINA_COST_USABLE_ITEM_ATTRIBUTE : CName;
STAMINA_COST_DEFAULT : CName;
STAMINA_COST_PER_SEC_DEFAULT : CName;
STAMINA_COST_ROLL_ATTRIBUTE : CName;
STAMINA_COST_LIGHT_SPECIAL_ATTRIBUTE : CName;
STAMINA_COST_HEAVY_SPECIAL_ATTRIBUTE : CName;
STAMINA_DELAY_PARRY_ATTRIBUTE : CName;
STAMINA_DELAY_COUNTERATTACK_ATTRIBUTE : CName;
STAMINA_DELAY_EVADE_ATTRIBUTE : CName;
STAMINA_DELAY_SWIMMING_ATTRIBUTE : CName;
STAMINA_DELAY_SUPER_HEAVY_ACTION_ATTRIBUTE : CName;
STAMINA_DELAY_HEAVY_ACTION_ATTRIBUTE : CName;
STAMINA_DELAY_LIGHT_ACTION_ATTRIBUTE : CName;
STAMINA_DELAY_DODGE_ATTRIBUTE : CName;
STAMINA_DELAY_SPRINT_ATTRIBUTE : CName;
STAMINA_DELAY_JUMP_ATTRIBUTE : CName;
STAMINA_DELAY_USABLE_ITEM_ATTRIBUTE : CName;
STAMINA_DELAY_DEFAULT : CName;
STAMINA_DELAY_ROLL_ATTRIBUTE : CName;
STAMINA_DELAY_LIGHT_SPECIAL_ATTRIBUTE : CName;
STAMINA_DELAY_HEAVY_SPECIAL_ATTRIBUTE : CName;
STAMINA_SEGMENT_SIZE : Int32;
TOXICITY_DAMAGE_THRESHOLD : Float;
TUT_POS_INVENTORY_X : Float;
TUT_POS_INVENTORY_Y : Float;
TUT_POS_ALCHEMY_X : Float;
TUT_POS_ALCHEMY_Y : Float;
TUT_POS_CHAR_DEV_X : Float;
TUT_POS_CHAR_DEV_Y : Float;
DEBUG_CHEATS_ENABLED : Bool;
SKILL_GLOBAL_PASSIVE_TAG : CName;
TAG_OPEN_FIRE : CName;
TAG_MONSTER_SKILL : CName;
TAG_EXPLODING_GAS : CName;
ON_HIT_HP_REGEN_DELAY : Float;
TAG_NPC_IN_PARTY : CName;
TAG_PLAYERS_MOUNTED_VEHICLE : CName;
TAG_SOFT_LOCK : CName;
MAX_SPELLPOWER_ASSUMED : Float;
NPC_RESIST_PER_LEVEL : Float;
XP_PER_LEVEL : Int32;

public
public
public
public
public
public
public
public
public
public
public

const var XP_MINIBOSS_BONUS : Float;


const var XP_BOSS_BONUS : Float;
const var ADRENALINE_DRAIN_AFTER_COMBAT_DELAY : Float;
const var KEYBOARD_KEY_FONT_COLOR : String;
const var MONSTER_HUNT_ACTOR_TAG : CName;
const var GWINT_CARD_ACHIEVEMENT_TAG : CName;
const var TAG_AXIIABLE : CName;
const var TAG_AXIIABLE_LOWER_CASE : CName;
const var LEVEL_DIFF_DEADLY : Int32;
const var LEVEL_DIFF_HIGH : Int32;
function Init(){
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('global_params');
InitForbiddenAttributesList();
super.SetWeaponDurabilityModifiers();
super.SetArmorDurabilityModifiers();
InitArmorAbilities();
InitGlovesAbilities();
InitPantsAbilities();
InitBootsAbilities();
InitWeaponAbilities();
INTERACTIVE_REPAIR_OBJECT_MAX_DURS.Resize(5);
INTERACTIVE_REPAIR_OBJECT_MAX_DURS[0] = 70;
INTERACTIVE_REPAIR_OBJECT_MAX_DURS[1] = 50;
INTERACTIVE_REPAIR_OBJECT_MAX_DURS[2] = 0;
INTERACTIVE_REPAIR_OBJECT_MAX_DURS[3] = 0;
INTERACTIVE_REPAIR_OBJECT_MAX_DURS[4] = 0;
/* NOP */;

}
private final function SetWeaponDurabilityModifiers(){
var dur : SDurabilityThreshold;
dur.difficulty = 1;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.975000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.950000;
durabilityThresholdsWeapon.PushBack(dur);
dur.difficulty = 2;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.950000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.900000;
durabilityThresholdsWeapon.PushBack(dur);
dur.difficulty = 3;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.925000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.850000;

durabilityThresholdsWeapon.PushBack(dur);
dur.difficulty = 4;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.900000;
durabilityThresholdsWeapon.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.800000;
durabilityThresholdsWeapon.PushBack(dur);
/* NOP */;
}
private final function SetArmorDurabilityModifiers(){
var dur : SDurabilityThreshold;
dur.difficulty = 1;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.975000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.950000;
durabilityThresholdsArmor.PushBack(dur);
dur.difficulty = 2;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.950000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.900000;
durabilityThresholdsArmor.PushBack(dur);
dur.difficulty = 3;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.925000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.850000;
durabilityThresholdsArmor.PushBack(dur);
dur.difficulty = 4;
dur.thresholdMax = 1.250000;
dur.multiplier = 1.000000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.750000;
dur.multiplier = 0.900000;
durabilityThresholdsArmor.PushBack(dur);
dur.thresholdMax = 0.500000;
dur.multiplier = 0.800000;
durabilityThresholdsArmor.PushBack(dur);
/* NOP */;
}
public final function GetWeaponDurabilityLoseValue() : Float{
if (theGame.GetDifficultyMode() == 4){
return DURABILITY_WEAPON_LOSE_VALUE_HARDCORE;

} else {
return DURABILITY_WEAPON_LOSE_VALUE;
}
/* NOP */;
}
private function InitArmorAbilities(){
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_Armor');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_SlashingResistance');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_PiercingResistance');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_BludgeoningResistance');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_RendingResistance');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_ElementalResistance');
ARMOR_MASTERWORK_ABILITIES.PushBack('MA_BurningResistance');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_PoisonResistance');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_BleedingResistance');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_Vitality');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_AdrenalineGain');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_AardIntensity');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_IgniIntensity');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_QuenIntensity');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_YrdenIntensity');
ARMOR_MAGICAL_ABILITIES.PushBack('MA_AxiiIntensity');
/* NOP */;
}
private function InitGlovesAbilities(){
GLOVES_MASTERWORK_ABILITIES.PushBack('MA_Armor');
GLOVES_MASTERWORK_ABILITIES.PushBack('MA_BurningResistance');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_PoisonResistance');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_BleedingResistance');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_AardIntensity');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_IgniIntensity');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_QuenIntensity');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_YrdenIntensity');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_AxiiIntensity');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_AttackPowerMult');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_CriticalChance');
GLOVES_MAGICAL_ABILITIES.PushBack('MA_CriticalDamage');
/* NOP */;
}
private function InitPantsAbilities(){
PANTS_MASTERWORK_ABILITIES.PushBack('MA_Armor');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_SlashingResistance');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_PiercingResistance');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_BludgeoningResistance');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_RendingResistance');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_ElementalResistance');
PANTS_MASTERWORK_ABILITIES.PushBack('MA_BurningResistance');
PANTS_MAGICAL_ABILITIES.PushBack('MA_PoisonResistance');
PANTS_MAGICAL_ABILITIES.PushBack('MA_BleedingResistance');
PANTS_MAGICAL_ABILITIES.PushBack('MA_Vitality');
PANTS_MAGICAL_ABILITIES.PushBack('MA_StaminaRegeneration');
/* NOP */;
}
private function InitBootsAbilities(){
BOOTS_MASTERWORK_ABILITIES.PushBack('MA_Armor');
BOOTS_MASTERWORK_ABILITIES.PushBack('MA_BurningResistance');
BOOTS_MAGICAL_ABILITIES.PushBack('MA_PoisonResistance');
BOOTS_MAGICAL_ABILITIES.PushBack('MA_BleedingResistance');
BOOTS_MAGICAL_ABILITIES.PushBack('MA_StaminaRegeneration');
BOOTS_MAGICAL_ABILITIES.PushBack('MA_AdrenalineGain');

/* NOP */;
}
private function InitWeaponAbilities(){
WEAPON_MASTERWORK_ABILITIES.PushBack('MA_ArmorPenetration');
WEAPON_MASTERWORK_ABILITIES.PushBack('MA_CriticalChance');
WEAPON_MASTERWORK_ABILITIES.PushBack('MA_CriticalDamage');
WEAPON_MASTERWORK_ABILITIES.PushBack('MA_BleedingChance');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_AdrenalineGain');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_AardIntensity');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_IgniIntensity');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_QuenIntensity');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_YrdenIntensity');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_AxiiIntensity');
WEAPON_MAGICAL_ABILITIES.PushBack('MA_PoisonChance');
/* NOP */;
}
private function InitForbiddenAttributesList(){
var i : Int32;
var size : Int32;
size = EnumGetMax('EBaseCharacterStats') + 1;
i = 0;
while (i < size){
forbiddenAttributes.PushBack(StatEnumToName(i));
i += 1;
}
size = EnumGetMax('ECharacterDefenseStats') + 1;
i = 0;
while (i < size){
forbiddenAttributes.PushBack(ResistStatEnumToName(i, tru
e));
forbiddenAttributes.PushBack(ResistStatEnumToName(i, fal
se));
i += 1;
}
size = EnumGetMax('ECharacterPowerStats') + 1;
i = 0;
while (i < size){
forbiddenAttributes.PushBack(PowerStatEnumToName(i));
i += 1;
}
/* NOP */;
}
public function IsForbiddenAttribute(nam : CName) : Bool{
if (!IsNameValid(nam)){
return true;
}
return forbiddenAttributes.Contains(nam);
/* NOP */;
}
public function GetDurabilityMultiplier(durabilityRatio : Float, isWeapo
n : Bool) : Float{
if (isWeapon){
return GetDurMult(durabilityRatio, durabilityThresholdsW
eapon);
} else {
return GetDurMult(durabilityRatio, durabilityThresholdsA
rmor);
}
/* NOP */;
}

private function GetDurMult(durabilityRatio : Float, durs : array<SDurab


ilityThreshold>) : Float{
var i : Int32;
var currDiff : EDifficultyMode;
currDiff = theGame.GetDifficultyMode();
i = durs.Size() - 1;
while (i >= 0){
if (durs[i].difficulty == currDiff){
if (durabilityRatio <= durs[i].thresholdMax){
return durs[i].multiplier;
}
}
i -= 1;
}
return durs[0].multiplier;
/* NOP */;
}
public function GetRandomMasterworkArmorAbility() : CName{
return ARMOR_MASTERWORK_ABILITIES[RandRange(ARMOR_MASTERWORK_ABI
LITIES.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMagicalArmorAbility() : CName{
return ARMOR_MAGICAL_ABILITIES[RandRange(ARMOR_MAGICAL_ABILITIES
.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMasterworkGlovesAbility() : CName{
return GLOVES_MASTERWORK_ABILITIES[RandRange(GLOVES_MASTERWORK_A
BILITIES.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMagicalGlovesAbility() : CName{
return GLOVES_MAGICAL_ABILITIES[RandRange(GLOVES_MAGICAL_ABILITI
ES.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMasterworkPantsAbility() : CName{
return PANTS_MASTERWORK_ABILITIES[RandRange(PANTS_MASTERWORK_ABI
LITIES.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMagicalPantsAbility() : CName{
return PANTS_MAGICAL_ABILITIES[RandRange(PANTS_MAGICAL_ABILITIES
.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMasterworkBootsAbility() : CName{
return BOOTS_MASTERWORK_ABILITIES[RandRange(BOOTS_MASTERWORK_ABI
LITIES.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMagicalBootsAbility() : CName{
return BOOTS_MAGICAL_ABILITIES[RandRange(BOOTS_MAGICAL_ABILITIES
.Size(), /* NOP */)];
/* NOP */;
}
public function GetRandomMasterworkWeaponAbility() : CName{
return WEAPON_MASTERWORK_ABILITIES[RandRange(WEAPON_MASTERWORK_A
BILITIES.Size(), /* NOP */)];

/* NOP */;
}
public function GetRandomMagicalWeaponAbility() : CName{
return WEAPON_MAGICAL_ABILITIES[RandRange(WEAPON_MAGICAL_ABILITI
ES.Size(), /* NOP */)];
/* NOP */;
}
public function GetStaminaActionAttributes(action : EStaminaActionType,
getCostPerSec : Bool, costAttributeName : CName, delayAttributeName : CName){
switch(action){
case 1:
costAttributeName = STAMINA_COST_LIGHT_ACTION_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_LIGHT_ACTION_ATTRIBUT
E;
return;
case 2:
costAttributeName = STAMINA_COST_HEAVY_ACTION_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_HEAVY_ACTION_ATTRIBUT
E;
return;
case 3:
costAttributeName = STAMINA_COST_SUPER_HEAVY_ACTION_ATTR
IBUTE;
delayAttributeName = STAMINA_DELAY_SUPER_HEAVY_ACTION_AT
TRIBUTE;
return;
case 15:
costAttributeName = STAMINA_COST_LIGHT_SPECIAL_ATTRIBUTE
;
delayAttributeName = STAMINA_DELAY_LIGHT_SPECIAL_ATTRIBU
TE;
return;
case 2:
costAttributeName = STAMINA_COST_HEAVY_SPECIAL_ATTRIBUTE
;
delayAttributeName = STAMINA_DELAY_HEAVY_SPECIAL_ATTRIBU
TE;
return;
case 4:
costAttributeName = STAMINA_COST_PARRY_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_PARRY_ATTRIBUTE;
return;
case 5:
costAttributeName = STAMINA_COST_COUNTERATTACK_ATTRIBUTE
;
delayAttributeName = STAMINA_DELAY_COUNTERATTACK_ATTRIBU
TE;
return;
case 6:
costAttributeName = STAMINA_COST_DODGE_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_DODGE_ATTRIBUTE;
return;
case 14:
costAttributeName = STAMINA_COST_ROLL_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_ROLL_ATTRIBUTE;
return;
case 7:
costAttributeName = STAMINA_COST_EVADE_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_EVADE_ATTRIBUTE;
return;

case 8:
if (getCostPerSec){
costAttributeName = STAMINA_COST_SWIMMING_PER_SE
C_ATTRIBUTE;
}
delayAttributeName = STAMINA_DELAY_SWIMMING_ATTRIBUTE;
return;
case 9:
if (getCostPerSec){
costAttributeName = STAMINA_COST_SPRINT_PER_SEC_
ATTRIBUTE;
} else {
costAttributeName = STAMINA_COST_SPRINT_ATTRIBUT
E;
}
delayAttributeName = STAMINA_DELAY_SPRINT_ATTRIBUTE;
return;
case 10:
costAttributeName = STAMINA_COST_JUMP_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_JUMP_ATTRIBUTE;
return;
case 11:
costAttributeName = STAMINA_COST_USABLE_ITEM_ATTRIBUTE;
delayAttributeName = STAMINA_DELAY_USABLE_ITEM_ATTRIBUTE
;
return;
case 12:
if (getCostPerSec){
costAttributeName = STAMINA_COST_PER_SEC_DEFAULT
;
} else {
costAttributeName = STAMINA_COST_DEFAULT;
}
delayAttributeName = STAMINA_DELAY_DEFAULT;
return;
default:
}
LogAssert(false, "W3GameParams.GetStaminaActionAttributes : unkn
own stamina action type <<" + action + ">> !!");
return;
/* NOP */;
}
public function GetItemLevel(itemCategory : CName, itemAttributes : arra
y<SAbilityAttributeValue>, itemName : CName) : Int32{
var stat : SAbilityAttributeValue;
var stat_f : Float;
var stat1 : SAbilityAttributeValue;
var stat2 : SAbilityAttributeValue;
var stat3 : SAbilityAttributeValue;
var stat4 : SAbilityAttributeValue;
var stat5 : SAbilityAttributeValue;
var stat6 : SAbilityAttributeValue;
var stat7 : SAbilityAttributeValue;
var stat_min : Float;
var stat_add : Float;
var level : Int32;
if (itemCategory == 'armor'){
stat_min = 25;
stat_add = 5;
stat = itemAttributes[0];

level = FloorF(1 + stat.valueBase - stat_min / stat_add)


;
} else if (itemCategory == 'boots'){
stat_min = 5;
stat_add = 2;
stat = itemAttributes[0];
level = FloorF(1 + stat.valueBase - stat_min / stat_add)
;
} else if (itemCategory == 'gloves'){
stat_min = 1;
stat_add = 2;
stat = itemAttributes[0];
level = FloorF(1 + stat.valueBase - stat_min / stat_add)
;
} else if (itemCategory == 'pants'){
stat_min = 5;
stat_add = 2;
stat = itemAttributes[0];
level = FloorF(1 + stat.valueBase - stat_min / stat_add)
;
} else if (itemCategory == 'silversword'){
stat_min = 90;
stat_add = 10;
stat1 = itemAttributes[0];
stat2 = itemAttributes[1];
stat3 = itemAttributes[2];
stat4 = itemAttributes[3];
stat5 = itemAttributes[4];
stat6 = itemAttributes[5];
stat_f = stat1.valueBase - 1 + stat2.valueBase - 1 + sta
t3.valueBase - 1 + stat4.valueBase - 1 + stat5.valueBase - 1 + stat6.valueBase 1;
level = CeilF(1 + 1 + stat_f - stat_min / stat_add);
} else if (itemCategory == 'steelsword'){
stat_min = 25;
stat_add = 8;
stat1 = itemAttributes[0];
stat2 = itemAttributes[1];
stat3 = itemAttributes[2];
stat4 = itemAttributes[3];
stat5 = itemAttributes[4];
stat6 = itemAttributes[5];
stat7 = itemAttributes[6];
stat_f = stat1.valueBase - 1 + stat2.valueBase - 1 + sta
t3.valueBase - 1 + stat4.valueBase - 1 + stat5.valueBase - 1 + stat6.valueBase 1 + stat7.valueBase - 1;
level = CeilF(1 + 1 + stat_f - stat_min / stat_add);
} else if (itemCategory == 'bolt'){
if (itemName == 'Tracking Bolt'){
level = 2;
} else if (itemName == 'Bait Bolt'){
level = 2;
} else if (itemName == 'Blunt Bolt'){
level = 2;
} else if (itemName == 'Broadhead Bolt'){
level = 10;
} else if (itemName == 'Target Point Bolt'){
level = 5;
} else if (itemName == 'Split Bolt'){
level = 15;

} else if (itemName == 'Explosive Bolt'){


level = 20;
} else if (itemName == 'Blunt Bolt Legendary'){
level = 5;
} else if (itemName == 'Broadhead Bolt Legendary'){
level = 20;
} else if (itemName == 'Target Point Bolt Legendary'){
level = 15;
} else if (itemName == 'Blunt Bolt Legendary'){
level = 12;
} else if (itemName == 'Split Bolt Legendary'){
level = 24;
} else if (itemName == 'Explosive Bolt Legendary'){
level = 26;
}
} else if (itemCategory == 'crossbow'){
stat = itemAttributes[0];
level = 1;
if (stat.valueMultiplicative > 1.010000){
level = 2;
}
if (stat.valueMultiplicative > 1.100000){
level = 4;
}
if (stat.valueMultiplicative > 1.200000){
level = 8;
}
if (stat.valueMultiplicative > 1.300000){
level = 11;
}
if (stat.valueMultiplicative > 1.400000){
level = 15;
}
if (stat.valueMultiplicative > 1.500000){
level = 19;
}
if (stat.valueMultiplicative > 1.600000){
level = 22;
}
if (stat.valueMultiplicative > 1.700000){
level = 25;
}
if (stat.valueMultiplicative > 1.800000){
level = 27;
}
if (stat.valueMultiplicative > 1.900000){
level = 32;
}
}
level = level - 1;
if (level < 1){
level = 1;
}
if (level > 70){
level = 70;
}
return level;
/* NOP */;
}
public final function SetNewGamePlusLevel(playerLevel : Int32){

newGamePlusLevel = playerLevel + NEW_GAME_PLUS_LEVEL_ADD;


/* NOP */;
}
public final function GetNewGamePlusLevel() : Int32{
return newGamePlusLevel;
/* NOP */;
}
}
class DialogueSliderData extends SliderPopupData{
public var dialogueRef : CR4HudModuleDialog;
protected function GetContentRef() : String{
return "QuantityPopupRef";
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_accept", "enter-gamepad_A", 13
);
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
if (KeyCode == "enter-gamepad_A"){
dialogueRef.DialogueSliderDataPopupResult(currentValue,
/* NOP */);
ClosePopup();
}
/* NOP */;
}
}
class W3WhiteFrostWaveProjectile extends CProjectileTrajectory{
private var frostEntity : W3WhiteFrost;
public function SetWhiteFrost(f : W3WhiteFrost){
frostEntity = f;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var ent : CGameplayEntity;
if (collidingComponent){
ent = (CGameplayEntity)collidingComponent.GetEntity();
if (ent){
frostEntity.Collided(ent);
}
}
/* NOP */;
}
}
class W3WhiteFrost extends W3Petard{
public editable var waveProjectileTemplate : CEntityTemplate;
public editable var freezeNPCFadeInTime : Float;
public editable var waveSpeedModifier : Float;
public editable var HAX_waveRadius : Float;
private var collisionMask : array<CName>;
private var shaderSpeed : Float;
private var totalTime : Float;
private var collidedEntities : array<CGameplayEntity>;
private var waveProjectile : W3WhiteFrostWaveProjectile;

protected function ProcessLoopEffect(){


SnapComponents(false);
LoopComponentsEnable(true);
ProcessEffectPlayFXs(false);
totalTime = 0;
shaderSpeed = HAX_waveRadius / impactParams.surfaceFX.fxFadeInTi
me * waveSpeedModifier;
AddTimer('OnTimeEnded', loopDuration, false, /* NOP */, /* NOP *
/, true, /* NOP */);
AddTimer('WaveProjectile', 0.300000, true, /* NOP */, /* NOP */,
true, /* NOP */);
WaveProjectile(0.300000, /* NOP */);
/* NOP */;
}
protected function LoadDataFromItemXMLStats(){
var customParam : W3FrozenEffectCustomParams;
var i : Int32;
super.LoadDataFromItemXMLStats();
customParam = new W3FrozenEffectCustomParams in this;
customParam.freezeFadeInTime = freezeNPCFadeInTime;
i = 0;
while (i < impactParams.buffs.Size()){
if (impactParams.buffs[i].effectType == 11){
impactParams.buffs[i].effectCustomParam = custom
Param;
break;
}
i += 1;
}
/* NOP */;
}
public timer function WaveProjectile(optional dt : Float, optional id :
Int32){
totalTime += dt;
if (!waveProjectile){
waveProjectile = (W3WhiteFrostWaveProjectile)theGame.Cre
ateEntity(waveProjectileTemplate, GetWorldPosition(), /* NOP */, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
waveProjectile.Init(this);
waveProjectile.SetWhiteFrost(this);
collisionMask.PushBack('Character');
collisionMask.PushBack('Static');
collisionMask.PushBack('RigidBody');
collisionMask.PushBack('Corpse');
}
waveProjectile.SphereOverlapTest(totalTime * shaderSpeed, collis
ionMask);
thePlayer.GetVisualDebug().AddSphere(EffectTypeToName(RandRange(
EnumGetMax('EEffectType'), /* NOP */)), totalTime * shaderSpeed, GetWorldPositio
n(), true, Color(0, 0, 255), 0.150000);
if (totalTime >= impactParams.surfaceFX.fxFadeInTime){
RemoveTimer('WaveProjectile', /* NOP */);
waveProjectile.Destroy();
}
/* NOP */;
}
public function Collided(ent : CGameplayEntity){
var ents : array<CGameplayEntity>;
var owner : CEntity;
if (collidedEntities.Contains(ent)){

return;
}
owner = EntityHandleGet(ownerHandle);
if (owner && IsRequiredAttitudeBetween(ent, owner, false, false,
true)){
return;
}
collidedEntities.PushBack(ent);
ents.PushBack(ent);
ProcessMechanicalEffect(ents, true, /* NOP */);
ent.OnFrostHit(this);
/* NOP */;
}
}
class W3Herb extends W3RefillableContainer{
protected autobind foliageComponent : CSwitchableFoliageComponent = sing
le;
protected var isEmptyAppearance : Bool;
public function GetStaticMapPinTag(tag : CName){
var items : array<SItemUniqueId>;
tag = 'None';
if (foliageComponent){
if (foliageComponent.GetEntry() == 'empty'){
return;
}
} else if (isEmptyAppearance){
return;
}
if (IsEmpty()){
return;
}
if (!inv){
return;
}
if (inv.GetItemCount(/* NOP */) == 0){
return;
}
inv.GetAllItems(items);
tag = inv.GetItemName(items[0]);
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
OnStreamIn();
if (inv.IsEmpty(/* NOP */)){
AddTimer('Refill', 20, true, /* NOP */, /* NOP */, /* NO
P */, /* NOP */);
}
if (lootInteractionComponent){
lootInteractionComponent.SetEnabled(!inv || !inv.IsEmpty
(/* NOP */));
}
if (foliageComponent){
if (inv.IsEmpty(/* NOP */)){
foliageComponent.SetAndSaveEntry('empty');
} else {
foliageComponent.SetAndSaveEntry('full');
}
}
/* NOP */;

}
public function ApplyAppearance(appearanceName : String){
if (appearanceName == "2_empty"){
isEmptyAppearance = true;
} else {
isEmptyAppearance = false;
}
super.ApplyAppearance(appearanceName);
/* NOP */;
}
protected function PreRefillContainer(){
inv.ResetContainerData();
/* NOP */;
}
}
struct SLevelDefinition{
var number : Int32;
var requiredTotalExp : Int32;
var addedSkillPoints : Int32;
var addedMutationPoints : Int32;
var addedKnowledgePoints : Int32;
}
struct SSpendablePoints{
saved var free : Int32;
saved var used : Int32;
}
import abstract class CSectorDataMerged{
}
import struct CDoorComponent{
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
import public function
}

Open(force : Bool, unlock : Bool);


Close(force : Bool);
IsOpen() : Bool;
IsLocked() : Bool;
AddForceImpulse(origin : Vector, force : Float);
InstantClose();
InstantOpen(unlock : Bool);
AddDoorUser(actor : CActor);
EnebleDoors(enable : Bool);
IsInteractive() : Bool;
IsTrapdoor() : Bool;
InvertMatrixForDoor(m : Matrix) : Matrix;
Unsuppress();

import struct CInteractionComponent{


private editable var isEnabledOnHorse : Bool;
public editable var aimVector : Vector;
public editable var iconOffset : Vector;
public editable var iconOffsetSlotName : CName;
//NULL type for isEnabledInCombat
//NULL type for shouldIgnoreLocks
import public final function GetActionName() : String;
import public final function SetActionName(actionName : String);
import public final function GetInteractionFriendlyName() : String;
import public final function GetInteractionKey() : Int32;
import public final function GetInputActionName() : CName;

public function IsEnabledOnHorse() : Bool{


return isEnabledOnHorse;
/* NOP */;
}
public function IsEnabledInCombat() : Bool{
return isEnabledInCombat;
/* NOP */;
}
public function ShouldIgnoreLocks() : Bool{
return shouldIgnoreLocks;
/* NOP */;
}
public function EnableInCombat(enable : Bool){
isEnabledInCombat = enable;
/* NOP */;
}
public final function SetIconOffset(offset : Vector){
iconOffset = offset;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (theGame.GetInteractionsManager().GetActiveInteraction() == t
his){
if (thePlayer.IsInCombat() && !thePlayer.IsSwimming()){
if (IsEnabledInCombat()){
return false;
} else {
return true;
}
} else if (thePlayer.IsInCombatAction() || thePlayer.IsC
rossbowHeld()){
return true;
} else {
return false;
}
} else {
return true;
}
/* NOP */;
}
public final function UpdateIconOffset(){
var l_entity : CEntity;
var l_localToWorld : Matrix;
var l_worldToLocal : Matrix;
var l_slotMatrix : Matrix;
var l_slotWorldPos : Vector;
var l_offset : Vector;
var l_box : Box;
if (!IsNameValid(iconOffsetSlotName)){
return;
}
l_entity = GetEntity();
if (l_entity.CalcEntitySlotMatrix(iconOffsetSlotName, l_slotMatr
ix)){
l_localToWorld = GetLocalToWorld();
l_worldToLocal = MatrixGetInverted(l_localToWorld);
l_slotWorldPos = MatrixGetTranslation(l_slotMatrix);
l_offset = VecTransform(l_worldToLocal, l_slotWorldPos);
SetIconOffset(l_offset);

}
/* NOP */;
}
}
import struct W3LockableEntity{
private editable saved var keyItemName : CName;
private editable saved var removeKeyOnUse : Bool;
private editable var enabledByFact : String;
private editable var factOnLockedAttempt : String;
private editable var factOnUnlockedByKey : String;
protected autobind mainInteractionComponent : CDoorComponent = single;
protected saved var isEnabled : Bool;
protected var isPlayerInActivationRange : Bool;
protected var isInteractionBlocked : Bool;
//NULL type for lockedByKey
//NULL type for isEnabledOnSpawn
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
if (!spawnData.restored){
if (StrLen(enabledByFact) > 0){
isEnabled = FactsDoesExist(enabledByFact);
} else {
isEnabled = isEnabledOnSpawn;
}
}
Enable(isEnabled, /* NOP */, /* NOP */);
CheckLock();
/* NOP */;
}
public function UpdateComponents(newActiveComponentName : String){
var component : CComponent;
var statee : Bool;
component = GetComponent("Locked");
if (component){
statee = newActiveComponentName == "Locked";
component.SetEnabled(statee);
} else if (lockedByKey){
LogAssert(false, "W3LockableEntity.UpdateInteractionComp
onents: Entity <<" + this + ">> is locked but has no Locked interaction componen
t!");
LogLockable("W3LockableEntity.UpdateInteractionComponent
s: Entity <<" + this + ">> is locked but has no Locked interaction component!");
}
component = GetComponent("Unlock");
if (component){
statee = newActiveComponentName == "Unlock";
component.SetEnabled(statee);
}
statee = newActiveComponentName == "Main";
OnStateChange(statee);
/* NOP */;
}
public function OnStateChange(newState : Bool) : Bool{
if (mainInteractionComponent){
mainInteractionComponent.SetEnabled(newState);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)

: Bool{
if (activator != thePlayer || isInteractionBlocked){
return false;
}
if (lockedByKey){
if (!IsNameValid(keyItemName)){
GetWitcherPlayer().DisplayHudMessage("panel_hud_
message_just_locked");
if (factOnLockedAttempt != ""){
FactsAdd(factOnLockedAttempt, 1, 1);
}
return true;
}
if (!thePlayer.inv.HasItem(keyItemName)){
GetWitcherPlayer().DisplayHudMessage("panel_hud_
message_locked");
if (factOnLockedAttempt != ""){
FactsAdd(factOnLockedAttempt, 1, 1);
}
return true;
} else {
if (factOnUnlockedByKey != ""){
FactsAdd(factOnUnlockedByKey, 1, /* NOP
*/);
}
GetWitcherPlayer().DisplayHudMessage("panel_hud_
message_unlock");
Unlock();
return true;
}
}
return false;
/* NOP */;
}
public function IsLocked() : Bool{
return lockedByKey;
/* NOP */;
}
public function ToggleLock(){
if (IsLocked()){
Unlock();
} else {
Lock('anykey', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function Unlock(){
if (IsNameValid(keyItemName) && removeKeyOnUse){
thePlayer.inv.RemoveItemByName(keyItemName, 1);
}
UpdateComponents("Main");
lockedByKey = false;
PlayUnlockAudio();
/* NOP */;
}
private function PlayUnlockAudio(){
if ((W3Door)this || (W3NewDoor)this){
SoundEvent("global_doors_wooden_unlock", /* NOP */, /* N
OP */);
}

/* NOP */;
}
public function Lock(keyName : CName, removeKey : Bool, smoooth : Bool){
var mainAsDoors : CDoorComponent;
mainAsDoors = (CDoorComponent)GetComponentByClassName('CDoorComp
onent');
if (mainAsDoors){
if (smoooth){
mainAsDoors.Close(true);
} else {
mainAsDoors.InstantClose();
}
}
OnLock();
removeKeyOnUse = removeKey;
lockedByKey = true;
keyItemName = keyName;
UpdateComponents("Locked");
/* NOP */;
}
protected function OnLock(){
}
protected function CheckLock(){
if (lockedByKey){
Lock(keyItemName, removeKeyOnUse, /* NOP */);
}
/* NOP */;
}
public function Enable(e : Bool, skipInteractionUpdate : Bool, questForc
edEnable : Bool){
isEnabled = e;
if (e){
if (lockedByKey){
if (mainInteractionComponent){
mainInteractionComponent.InstantClose();
}
UpdateComponents("Locked");
} else {
UpdateComponents("Main");
}
} else {
UpdateComponents("");
}
if (isPlayerInActivationRange && !skipInteractionUpdate){
ShowInteractionComponent();
}
/* NOP */;
}
public function ShowInteractionComponent(){
if (isEnabled){
if (lockedByKey){
if (IsNameValid(keyItemName) && thePlayer.inv.Ha
sItem(keyItemName)){
UpdateComponents("Unlock");
} else {
UpdateComponents("Locked");
thePlayer.nearbyLockedContainersNoKey.Pu
shBack(this);
}
} else {

UpdateComponents("Main");
}
} else {
UpdateComponents("");
}
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (activator == thePlayer){
isPlayerInActivationRange = true;
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
if (activator == thePlayer){
isPlayerInActivationRange = false;
thePlayer.nearbyLockedContainersNoKey.Remove(this);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (StrLen(enabledByFact) > 0 && activator.GetEntity() == thePla
yer){
AddTimer('RefreshFactStatus', 0.001000, true, /* NOP */,
/* NOP */, true, /* NOP */);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (StrLen(enabledByFact) > 0 && activator.GetEntity() == thePla
yer){
RemoveTimer('RefreshFactStatus', /* NOP */);
}
/* NOP */;
}
public timer function RefreshFactStatus(optional dt : Float, optional id
: Int32){
if (isEnabled != FactsDoesExist(enabledByFact)){
LogLockable("W3LockableEntity.RefreshFactStatus: enablin
g fact status is different than the enabled state of <<" + this + ">>, changing
enabled state to " + !isEnabled);
Enable(!isEnabled, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnStreamIn() : Bool{
Enable(isEnabled, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLockForced() : Bool{
Unlock();
/* NOP */;
}
public function GetKeyName() : CName{
return keyItemName;
/* NOP */;

}
public function IsEnabled() : Bool{
return isEnabled;
/* NOP */;
}
public function SetInteractionBlocked(b : Bool){
isInteractionBlocked = b;
/* NOP */;
}
}
class CR4HudModuleWolfHead extends CR4HudModuleBase{
private var m_fxSetVitality : CScriptedFlashFunction;
private var m_fxSetStamina : CScriptedFlashFunction;
private var m_fxSetToxicity : CScriptedFlashFunction;
private var m_fxSetExperience : CScriptedFlashFunction;
private var m_fxSetLockedToxicity : CScriptedFlashFunction;
private var m_fxSetDeadlyToxicity : CScriptedFlashFunction;
private var m_fxShowStaminaNeeded : CScriptedFlashFunction;
private var m_fxSwitchWolfActivation : CScriptedFlashFunction;
private var m_fxSetPositiveEffectsCounterSFF : CScriptedFlashFunction;
private var m_fxSetNegativeEffectsCounterSFF : CScriptedFlashFunction;
private var m_fxSetSignIconSFF : CScriptedFlashFunction;
private var m_fxSetSignTextSFF : CScriptedFlashFunction;
private var m_fxSetFocusPointsSFF : CScriptedFlashFunction;
private var m_fxLockFocusPointsSFF : CScriptedFlashFunction;
private var m_fxSetCiriAsMainCharacter : CScriptedFlashFunction;
private var m_fxSetShowNewLevelIndicator : CScriptedFlashFunction;
private var m_fxSetAlwaysDisplayed : CScriptedFlashFunction;
private var m_fxDisplayOverloadedIcon : CScriptedFlashFunction;
private var m_LastVitality : Float;
private var m_LastMaxVitality : Float;
private var m_LastStamina : Float;
private var m_LastMaxStamina : Float;
private var m_LastExperience : Float;
private var m_LastMaxExperience : Float;
private var m_LastToxicity : Float;
private var m_LastLockedToxicity : Float;
private var m_LastMaxToxicity : Float;
private var m_bLastDeadlyToxicity : Bool;
private var m_medallionActivated : Bool;
private var m_oveloadedIconVisible : Bool;
private var m_focusPoints : Int32;
private var m_iCurrentPositiveEffectsSize : Int32;
private var m_iCurrentNegativeEffectsSize : Int32;
private var m_signIconName : String;
private var m_CurrentSelectedSign : ESignType;
private var m_IsPlayerCiri : Bool;
private var m_curToxicity : Float;
private var m_lockedToxicity : Float;
private var m_curVitality : Float;
private var m_maxVitality : Float;
private var playStaminaSoundCue : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorWolfHead";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetVitality = flashModule.GetMemberFlashFunction("setVitalit

y");
m_fxSetStamina = flashModule.GetMemberFlashFunction("setStamina"
);
m_fxSetToxicity = flashModule.GetMemberFlashFunction("setToxicit
y");
m_fxSetExperience = flashModule.GetMemberFlashFunction("setExper
ience");
m_fxSetLockedToxicity = flashModule.GetMemberFlashFunction("setL
ockedToxicity");
m_fxSetDeadlyToxicity = flashModule.GetMemberFlashFunction("setD
eadlyToxicity");
m_fxShowStaminaNeeded = flashModule.GetMemberFlashFunction("show
StaminaNeeded");
m_fxSwitchWolfActivation = flashModule.GetMemberFlashFunction("s
witchWolfActivation");
m_fxSetPositiveEffectsCounterSFF = flashModule.GetMemberFlashFun
ction("setPositiveEffectsCounter");
m_fxSetNegativeEffectsCounterSFF = flashModule.GetMemberFlashFun
ction("setNegativeEffectsCounter");
m_fxSetSignIconSFF = flashModule.GetMemberFlashFunction("setSign
Icon");
m_fxSetSignTextSFF = flashModule.GetMemberFlashFunction("setSign
Text");
m_fxSetFocusPointsSFF = flashModule.GetMemberFlashFunction("setF
ocusPoints");
m_fxLockFocusPointsSFF = flashModule.GetMemberFlashFunction("loc
kFocusPoints");
m_fxSetCiriAsMainCharacter = flashModule.GetMemberFlashFunction(
"setCiriAsMainCharacter");
m_fxSetShowNewLevelIndicator = flashModule.GetMemberFlashFunctio
n("setShowNewLevelIndicator");
m_fxSetAlwaysDisplayed = flashModule.GetMemberFlashFunction("set
AlwaysDisplayed");
m_fxDisplayOverloadedIcon = flashModule.GetMemberFlashFunction("
displayOverloadedIcon");
m_CurrentSelectedSign = thePlayer.GetEquippedSign();
m_fxSetSignIconSFF.InvokeSelfOneArg(FlashArgString(GetSignIcon()
));
SetTickInterval(0.500000);
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('WolfMedalion', true);
}
DisplayNewLevelIndicator();
/* NOP */;
}
public function DisplayNewLevelIndicator(){
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
if (levelManager.GetPointsFree(0) > 0){
if (!thePlayer.IsCiri()){
m_fxSetShowNewLevelIndicator.InvokeSelfOneArg(Fl
ashArgBool(true));
} else {
m_fxSetShowNewLevelIndicator.InvokeSelfOneArg(Fl
ashArgBool(false));
}
} else {
m_fxSetShowNewLevelIndicator.InvokeSelfOneArg(FlashArgBo
ol(false));

}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
UpdateVitality();
UpdateStamina();
UpdateToxicity();
UpdateSignData();
if (!CanTick(timeDelta)){
return true;
}
UpdateExperience();
UpdateMedallion();
UpdateFocusPoints();
UpdateStateByPlayer();
if (thePlayer.IsCombatMusicEnabled() || m_curToxicity > 0.000000
|| m_lockedToxicity > 0.000000 || m_curVitality < m_maxVitality){
SetAlwaysDisplayed(true);
} else {
SetAlwaysDisplayed(false);
}
/* NOP */;
}
public function UpdateVitality(){
var l_currentVitality : Float;
var l_currentMaxVitality : Float;
thePlayer.GetStats(0, l_currentVitality, l_currentMaxVitality);
m_curVitality = l_currentVitality;
m_maxVitality = l_currentMaxVitality;
if (l_currentVitality != m_LastVitality || l_currentMaxVitality
!= m_LastMaxVitality){
m_fxSetVitality.InvokeSelfOneArg(FlashArgNumber(l_curren
tVitality / l_currentMaxVitality));
m_LastVitality = l_currentVitality;
m_LastMaxVitality = l_currentMaxVitality;
}
/* NOP */;
}
public function UpdateStamina(){
var l_curStamina : Float;
var l_curMaxStamina : Float;
var l_tooLowStaminaIndication : Float;
l_tooLowStaminaIndication = thePlayer.GetShowToLowStaminaIndicat
ion();
thePlayer.GetStats(2, l_curStamina, l_curMaxStamina);
if (m_LastStamina != l_curStamina || m_LastMaxStamina != l_curMa
xStamina){
m_fxSetStamina.InvokeSelfOneArg(FlashArgNumber(l_curStam
ina / l_curMaxStamina));
m_LastStamina = l_curStamina;
m_LastMaxStamina = l_curMaxStamina;
if (l_curStamina <= l_curMaxStamina * 0.600000){
playStaminaSoundCue = true;
}
if (l_curStamina <= 0){
thePlayer.SoundEvent("gui_no_stamina", /* NOP */
, /* NOP */);
theGame.VibrateControllerVeryLight(/* NOP */);
} else if (l_curStamina >= l_curMaxStamina && playStamin
aSoundCue){

thePlayer.SoundEvent("gui_stamina_recharged", /*
NOP */, /* NOP */);
theGame.VibrateControllerVeryLight(/* NOP */);
playStaminaSoundCue = false;
}
}
if (l_tooLowStaminaIndication > 0){
m_fxShowStaminaNeeded.InvokeSelfOneArg(FlashArgNumber(l_
tooLowStaminaIndication / l_curMaxStamina));
thePlayer.SetShowToLowStaminaIndication(0);
}
/* NOP */;
}
public function UpdateToxicity(){
var curToxicity : Float;
var curMaxToxicity : Float;
var curLockedToxicity : Float;
var damageThreshold : Float;
var curDeadlyToxicity : Bool;
thePlayer.GetStats(3, curToxicity, curMaxToxicity);
curLockedToxicity = thePlayer.GetStat(3, /* NOP */) - curToxicit
y;
m_curToxicity = curToxicity;
m_lockedToxicity = curLockedToxicity;
if (m_LastToxicity != curToxicity || m_LastMaxToxicity != curMax
Toxicity || m_LastLockedToxicity != curLockedToxicity){
if (m_LastLockedToxicity != curLockedToxicity || m_LastM
axToxicity != curMaxToxicity){
m_fxSetLockedToxicity.InvokeSelfOneArg(FlashArgN
umber(curLockedToxicity / curMaxToxicity));
m_LastLockedToxicity = curLockedToxicity;
}
m_fxSetToxicity.InvokeSelfOneArg(FlashArgNumber(curToxic
ity + m_LastLockedToxicity / curMaxToxicity));
m_LastToxicity = curToxicity;
m_LastMaxToxicity = curMaxToxicity;
damageThreshold = GetWitcherPlayer().GetToxicityDamageTh
reshold();
curDeadlyToxicity = curToxicity >= damageThreshold * cur
MaxToxicity;
if (m_bLastDeadlyToxicity != curDeadlyToxicity){
m_fxSetDeadlyToxicity.InvokeSelfOneArg(FlashArgB
ool(curDeadlyToxicity));
m_bLastDeadlyToxicity = curDeadlyToxicity;
}
}
/* NOP */;
}
public function UpdateExperience(){
var curExperience : Float;
var curMaxExperience : Float;
curExperience = GetCurrentExperience() - GetLevelExperience();
curMaxExperience = GetTargetExperience() - GetLevelExperience();
if (m_LastExperience != curExperience || m_LastMaxExperience !=
curMaxExperience){
m_fxSetExperience.InvokeSelfOneArg(FlashArgNumber(curExp
erience / curMaxExperience));
m_LastExperience = curExperience;
m_LastMaxExperience = curMaxExperience;
}

/* NOP */;
}
private function GetCurrentExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetPointsTotal(1);
/* NOP */;
}
private function GetLevelExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetTotalExpForCurrLevel();
/* NOP */;
}
private function GetTargetExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetTotalExpForNextLevel();
/* NOP */;
}
public function UpdateMedallion(){
var l_curMedallionActivated : Bool;
l_curMedallionActivated = GetWitcherPlayer().GetMedallion().IsAc
tive();
if (m_medallionActivated != l_curMedallionActivated){
m_medallionActivated = l_curMedallionActivated;
m_fxSwitchWolfActivation.InvokeSelfOneArg(FlashArgBool(m
_medallionActivated));
}
/* NOP */;
}
private function UpdateFocusPoints(){
var curFocusPoints : Int32;
curFocusPoints = FloorF(GetWitcherPlayer().GetStat(4, /* NOP */)
);
if (m_focusPoints != curFocusPoints){
m_focusPoints = curFocusPoints;
m_fxSetFocusPointsSFF.InvokeSelfOneArg(FlashArgInt(m_foc
usPoints));
}
/* NOP */;
}
public function ResetFocusPoints(){
var curFocusPoints : Int32;
curFocusPoints = FloorF(GetWitcherPlayer().GetStat(4, /* NOP */)
);
m_fxSetFocusPointsSFF.InvokeSelfOneArg(FlashArgInt(curFocusPoint
s));
/* NOP */;
}
public function LockFocusPoints(value : Int32){
if (value <= 3){
m_fxLockFocusPointsSFF.InvokeSelfOneArg(FlashArgInt(valu
e));
}
/* NOP */;
}
public function UpdateSignData(){
if (thePlayer.GetEquippedSign() != m_CurrentSelectedSign){
m_CurrentSelectedSign = thePlayer.GetEquippedSign();

m_fxSetSignIconSFF.InvokeSelfOneArg(FlashArgString(GetSi
gnIcon()));
m_fxSetSignTextSFF.InvokeSelfOneArg(FlashArgString(GetLo
cStringByKeyExt(SignEnumToString(m_CurrentSelectedSign))));
}
/* NOP */;
}
public function UpdateStateByPlayer(){
if (thePlayer.IsCiri() != m_IsPlayerCiri){
m_IsPlayerCiri = thePlayer.IsCiri();
m_fxSetCiriAsMainCharacter.InvokeSelfOneArg(FlashArgBool
(m_IsPlayerCiri));
DisplayNewLevelIndicator();
}
/* NOP */;
}
private function GetSignIcon() : String{
if ((W3ReplacerCiri)thePlayer){
return "hud/radialmenu/mcCiriPower.png";
}
return GetSignIconByType(m_CurrentSelectedSign);
/* NOP */;
}
private function GetSignIconByType(signType : ESignType) : String{
switch(signType){
case 0:
return "hud/radialmenu/mcAard.png";
case 1:
return "hud/radialmenu/mcYrden.png";
case 2:
return "hud/radialmenu/mcIgni.png";
case 3:
return "hud/radialmenu/mcQuen.png";
case 4:
return "hud/radialmenu/mcAxii.png";
default:
}
return "";
/* NOP */;
}
public function ShowLevelUpIndicator(value : Bool){
m_fxSetShowNewLevelIndicator.InvokeSelfOneArg(FlashArgBool(value
));
/* NOP */;
}
public function SetAlwaysDisplayed(value : Bool){
m_fxSetAlwaysDisplayed.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
}
import abstract class SRaycastHitResult{
//NULL type for distance
//NULL type for component
//NULL type for position
//NULL type for normal
}
struct SRiddleNodePositionDef{
editable var animName : CName;

editable
editable
editable
editable
editable
editable
editable

var
var
var
var
var
var
var

changePosTime : Float;
fxName : CName;
pairedRiddleNodes : array<SPairedRiddleNodeDef>;
isPositionValid : Bool;
externalRiddleFx : SExternalRiddleEffectEntityDef;
igni : Bool;
aard : Bool;

}
import abstract class SSweepHitResult{
}
import abstract class SScriptRaycastId{
}
import abstract class SScriptSweepId{
}
import struct CScriptBatchQueryAccessor{
import public final latent function RayCast(start : Vector, end : Vector
, result : array<SRaycastHitResult>, collisionGroupsNames : array<CName>, queryF
lags : Int32) : Bool;
import public final function RayCastSync(start : Vector, end : Vector, r
esult : array<SRaycastHitResult>, collisionGroupsNames : array<CName>) : Bool;
import public final function RayCastAsync(start : Vector, end : Vector,
collisionGroupsNames : array<CName>, queryFlags : Int32) : SScriptRaycastId;
import public final latent function RayCastDir(start : Vector, direction
: Vector, distance : Float, result : array<SRaycastHitResult>, collisionGroupsN
ames : array<CName>, queryFlags : Int32) : Bool;
import public final function RayCastDirSync(start : Vector, direction :
Vector, distance : Float, result : array<SRaycastHitResult>, collisionGroupsName
s : array<CName>) : Bool;
import public final function RayCastDirAsync(start : Vector, direction :
Vector, distance : Float, collisionGroupsNames : array<CName>, queryFlags : Int
32) : SScriptRaycastId;
import public final function GetRayCastState(queryId : SScriptRaycastId,
result : array<SRaycastHitResult>) : EBatchQueryState;
import public final latent function Sweep(start : Vector, end : Vector,
radius : Float, result : array<SSweepHitResult>, collisionGroupsNames : array<CN
ame>, queryFlags : Int32) : Bool;
import public final function SweepAsync(start : Vector, end : Vector, ra
dius : Float, collisionGroupsNames : array<CName>, queryFlags : Int32) : SScript
SweepId;
import public final latent function SweepDir(start : Vector, direction :
Vector, radius : Float, distance : Float, result : array<SSweepHitResult>, coll
isionGroupsNames : array<CName>, queryFlags : Int32) : Bool;
import public final function SweepDirAsync(start : Vector, direction : V
ector, radius : Float, distance : Float, collisionGroupsNames : array<CName>, qu
eryFlags : Int32) : SScriptSweepId;
import public final function GetSweepState(queryId : SScriptSweepId, res
ult : array<SSweepHitResult>) : EBatchQueryState;
}
class W3RiddleServer extends CGameplayEntity{
public editable inlined var OnGoodCombinationEvents : array<W3SwitchEven
t>;
public saved var pairedNodes : array<EntityHandle>;
public saved var riddleNodesNumber : Int32;
public saved var isDisabled : Bool;
public var nodesAtValidPosNumber : Int32;

public function UpdatePairedRiddleNodes(){


var i : Int32;
var k : Int32;
var playEffect : Bool;
var changed : Bool;
var currentPairedRiddleNodesIds : array<Int32>;
var currentNode : W3RiddleNode;
var pairedNode : W3RiddleNode;
var notPairedNode : CEntity;
var notPairedNodeName : String;
changed = true;
while (changed){
changed = false;
i = 0;
while (i < pairedNodes.Size()){
pairedNode = (W3RiddleNode)EntityHandleGet(paire
dNodes[i]);
if (!pairedNode){
notPairedNode = EntityHandleGet(pairedNo
des[i]);
notPairedNodeName = notPairedNode.GetNam
e();
LogAssert(false, "Handled entity array"
+ notPairedNodeName + " contains an entity which is not a W3RiddleNode");
} else {
playEffect = false;
k = 0;
while (k < pairedNode.positions[pairedNo
de.currentPos].pairedRiddleNodes.Size()){
currentNode = (W3RiddleNode)theG
ame.GetEntityByTag(pairedNode.positions[pairedNode.currentPos].pairedRiddleNodes
[k].pairedRiddleNodeTag);
if (currentNode.isEffectOn && cu
rrentNode.currentPos == pairedNode.positions[pairedNode.currentPos].pairedRiddle
Nodes[k].pairedRiddleNodeRequiredPos){
playEffect = true;
currentPairedRiddleNodes
Ids.PushBack(k);
pairedNode.PlayExternalE
ffectOnpairedNodeByID(k);
} else {
pairedNode.StopExternalE
ffectOnpairedNodeByID(k);
}
k += 1;
}
pairedNode.SetCurrentPairedRiddleNodesId
s(currentPairedRiddleNodesIds);
if (playEffect && !pairedNode.isEffectOn
){
pairedNode.PlayEffects();
changed = true;
} else if (!playEffect && pairedNode.isE
ffectOn){
pairedNode.StopEffects();
changed = true;
}
}
i += 1;
}

}
/* NOP */;
}
public function AddPairedRiddleNode(riddleNode : W3RiddleNode){
var riddleNodeHandle : EntityHandle;
EntityHandleSet(riddleNodeHandle, riddleNode);
pairedNodes.PushBack(riddleNodeHandle);
/* NOP */;
}
public function AddRiddleNode(){
riddleNodesNumber += 1;
/* NOP */;
}
public function AddValidPosition(){
nodesAtValidPosNumber += 1;
CheckCombination();
/* NOP */;
}
public function CheckCombination(){
var combinationNumber : Int32;
if (nodesAtValidPosNumber == riddleNodesNumber){
ActivateEvents(OnGoodCombinationEvents);
isDisabled = true;
}
/* NOP */;
}
public function RemoveValidPosition(){
nodesAtValidPosNumber -= 1;
/* NOP */;
}
private function ActivateEvents(events : array<W3SwitchEvent>){
var i : Int32;
var size : Int32;
if (isDisabled){
return;
}
size = events.Size();
i = 0;
while (i < size){
if (events[i]){
events[i].TriggerArgNode(this, thePlayer);
}
i += 1;
}
/* NOP */;
}
}
class W3RiddleNode extends CGameplayEntity{
public editable var positions : array<SRiddleNodePositionDef>;
public editable var riddleServerTag : CName;
public editable var factOnPositionValid : String;
public editable var useFocusModeHelper : Bool;
public saved var currentPos : Int32;
public saved var rewind : Bool;
public saved var currentPairedRiddleNodeID : Int32;
public saved var currentPairedRiddleNodesIDS : array<Int32>;
public var riddleServer : W3RiddleServer;
public saved var wasAddedToServer : Bool;
public var lastPosID : Int32;

public
public
public
public
public

var isDisabled : Bool;


var isEffectOn : Bool;
var isOnValidPosition : Bool;
var initializeServerCounter : Int32;
function OnSpawned(spawnData : SEntitySpawnData) : Bool{
lastPosID = positions.Size() - 1;
InitializeServer();
/* NOP */;

}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
if (positions[currentPos].igni && !isDisabled){
ChangePosition();
}
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
if (positions[currentPos].aard && !isDisabled){
ChangePosition();
}
/* NOP */;
}
public function InitializeServer(){
var i : Int32;
if (!riddleServer){
riddleServer = (W3RiddleServer)theGame.GetEntityByTag(ri
ddleServerTag);
}
if (riddleServer){
if (!wasAddedToServer){
wasAddedToServer = true;
riddleServer.AddRiddleNode();
i = 0;
while (i < positions.Size()){
if (positions[i].pairedRiddleNodes.Size(
) > 0){
riddleServer.AddPairedRiddleNode
(this);
}
i += 1;
}
}
SetPosition();
} else {
AddTimer('InitializeServerTimer', 1.000000, true, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function InitializeServerTimer(optional timeDelta : Float,
optional id : Int32){
if (riddleServer || initializeServerCounter >= 10){
initializeServerCounter = 0;
RemoveTimer('InitializeServerTimer', /* NOP */);
} else {
InitializeServer();
initializeServerCounter += 1;
}
/* NOP */;
}
public function SetCurrentPairedRiddleNodeId(id : Int32){

currentPairedRiddleNodeID = id;
/* NOP */;
}
public function AddCurrentPairedRiddleNodeId(id : Int32){
currentPairedRiddleNodesIDS.PushBack(id);
/* NOP */;
}
public function RemoveCurrentPairedRiddleNodeId(id : Int32){
currentPairedRiddleNodesIDS.Remove(id);
/* NOP */;
}
public function SetCurrentPairedRiddleNodesIds(ids : array<Int32>){
currentPairedRiddleNodesIDS = ids;
/* NOP */;
}
public function PlayEffects(){
var externalFxEntity : CEntity;
if (positions[currentPos].fxName != 'None'){
PlayEffectSingle(positions[currentPos].fxName, /* NOP */
);
}
if (positions[currentPos].externalRiddleFx.entityTag != 'None' &
& !positions[currentPos].externalRiddleFx.isEffectOn){
externalFxEntity = theGame.GetEntityByTag(positions[curr
entPos].externalRiddleFx.entityTag);
externalFxEntity.PlayEffectSingle(positions[currentPos].
externalRiddleFx.fxName, /* NOP */);
positions[currentPos].externalRiddleFx.isEffectOn = true
;
}
isEffectOn = true;
/* NOP */;
}
public function PlayExternalEffectOnpairedNodeByID(id : Int32){
var externalFxEntity : CEntity;
if (positions[currentPos].pairedRiddleNodes[id].externalRiddleFx
.entityTag != 'None' && !positions[currentPos].pairedRiddleNodes[id].externalRid
dleFx.isEffectOn){
externalFxEntity = theGame.GetEntityByTag(positions[curr
entPos].pairedRiddleNodes[id].externalRiddleFx.entityTag);
externalFxEntity.PlayEffectSingle(positions[currentPos].
pairedRiddleNodes[id].externalRiddleFx.fxName, /* NOP */);
positions[currentPos].pairedRiddleNodes[id].externalRidd
leFx.isEffectOn = true;
}
/* NOP */;
}
public function StopExternalEffectOnpairedNodeByID(id : Int32){
var externalFxEntity : CEntity;
if (positions[currentPos].pairedRiddleNodes[id].externalRiddleFx
.entityTag != 'None' && positions[currentPos].pairedRiddleNodes[id].externalRidd
leFx.isEffectOn){
externalFxEntity = theGame.GetEntityByTag(positions[curr
entPos].pairedRiddleNodes[id].externalRiddleFx.entityTag);
externalFxEntity.StopEffect(positions[currentPos].paired
RiddleNodes[id].externalRiddleFx.fxName);
positions[currentPos].pairedRiddleNodes[id].externalRidd
leFx.isEffectOn = false;
}
/* NOP */;

}
public function StopEffects(){
var i : Int32;
var pairedID : Int32;
var externalFxEntity : CEntity;
if (positions[currentPos].fxName != 'None'){
StopEffect(positions[currentPos].fxName);
}
if (positions[currentPos].externalRiddleFx.entityTag != 'None' &
& positions[currentPos].externalRiddleFx.isEffectOn){
externalFxEntity = theGame.GetEntityByTag(positions[curr
entPos].externalRiddleFx.entityTag);
externalFxEntity.StopEffect(positions[currentPos].extern
alRiddleFx.fxName);
positions[currentPos].externalRiddleFx.isEffectOn = fals
e;
}
i = 0;
while (i < currentPairedRiddleNodesIDS.Size()){
pairedID = currentPairedRiddleNodesIDS[i];
if (positions[currentPos].pairedRiddleNodes[pairedID].ex
ternalRiddleFx.entityTag != 'None'){
externalFxEntity = theGame.GetEntityByTag(positi
ons[currentPos].pairedRiddleNodes[pairedID].externalRiddleFx.entityTag);
externalFxEntity.StopEffect(positions[currentPos
].pairedRiddleNodes[pairedID].externalRiddleFx.fxName);
positions[currentPos].pairedRiddleNodes[pairedID
].externalRiddleFx.isEffectOn = false;
}
i += 1;
}
isEffectOn = false;
/* NOP */;
}
public function ChangePosition(){
StopEffects();
if (currentPos == lastPosID){
rewind = true;
}
if (currentPos == 0){
rewind = false;
}
if (!rewind){
currentPos += 1;
SetPosition();
} else {
SetPosition();
currentPos -= 1;
}
LogQuest("RiddleNode <<" + GetName() + ">> is at position <<" +
currentPos + ">>");
/* NOP */;
}
public function SetPosition(){
if (isDisabled){
return;
}
if (!rewind){
if (positions[currentPos].animName != 'None'){
isDisabled = true;

PlayPropertyAnimation(positions[currentPos].anim
Name, 1, positions[currentPos].changePosTime, /* NOP */);
}
AddTimer('SetPositionTimer', positions[currentPos].chang
ePosTime, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
if (positions[currentPos].animName != 'None'){
isDisabled = true;
PlayPropertyAnimation(positions[currentPos].anim
Name, 1, positions[currentPos].changePosTime, 1);
}
AddTimer('SetPositionTimer', positions[currentPos].chang
ePosTime, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function SetPositionTimer(optional timeDelta : Float, optio
nal id : Int32){
isDisabled = false;
if (!riddleServer){
InitializeServer();
}
if (factOnPositionValid != ""){
if (positions[currentPos].isPositionValid){
FactsAdd(factOnPositionValid, 1, -1);
} else if (FactsQuerySum(factOnPositionValid) > 0){
FactsAdd(factOnPositionValid, -1, -1);
}
}
if (positions[currentPos].isPositionValid){
if (!isOnValidPosition){
if (!wasAddedToServer){
wasAddedToServer = true;
riddleServer.AddRiddleNode();
}
riddleServer.AddValidPosition();
isOnValidPosition = true;
}
if (useFocusModeHelper){
SetFocusModeVisibility(1, /* NOP */);
}
} else if (!positions[currentPos].isPositionValid){
if (isOnValidPosition){
if (!wasAddedToServer){
wasAddedToServer = true;
riddleServer.AddRiddleNode();
}
riddleServer.RemoveValidPosition();
isOnValidPosition = false;
}
if (useFocusModeHelper){
SetFocusModeVisibility(2, /* NOP */);
}
}
if (positions[currentPos].pairedRiddleNodes.Size() == 0){
PlayEffects();
}
riddleServer.UpdatePairedRiddleNodes();
/* NOP */;
}

}
class ConfirmationPopupData extends TextPopupData{
protected function DefineDefaultButtons(){
AddButtonDef(GetAcceptText(), "enter-gamepad_A", 69);
AddButtonDef(GetDeclineText(), "escape-gamepad_B", 27);
/* NOP */;
}
protected function GetContentRef() : String{
return "ConfirmationPopupRef";
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
/* NOP */;
if (KeyCode == "enter-gamepad_A"){
OnUserAccept();
ClosePopup();
} else if (KeyCode == "escape-gamepad_B"){
OnUserDecline();
ClosePopup();
}
/* NOP */;
}
protected function OnUserAccept(){
}
protected function OnUserDecline(){
}
protected function GetAcceptText() : String{
return "panel_button_common_accept";
/* NOP */;
}
protected function GetDeclineText() : String{
return "panel_button_common_exit";
/* NOP */;
}
}
class CR4ListBaseMenu extends CR4MenuBase{
protected const var DATA_BINDING_NAME : String;
protected const var DATA_BINDING_NAME_SUBLIST : String;
protected const var DATA_BINDING_NAME_DESCRIPTION : String;
protected const var ITEMS_SIZE : Int32;
protected var m_journalManager : CWitcherJournalManager;
public var currentTag : CName;
public var lastSentTag : CName;
public var openedTabs : array<CName>;
public var itemsNames : array<CName>;
public function OnConfigUI() : Bool{
super.OnConfigUI();
openedTabs = UISavedData.openedCategories;
m_journalManager = theGame.GetJournalManager();
/* NOP */;
}
public function OnClosingMenu() : Bool{
SaveStateData();
super.OnClosingMenu();
theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
/* NOP */;
}

public function OnCloseMenu() : Bool{


var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.ChildRequestCloseMenu();
}
theSound.SoundEvent('gui_global_quit');
CloseMenu();
/* NOP */;
}
public function SaveStateData(){
m_guiManager.UpdateUISavedData(GetMenuName(), UISavedData.opened
Categories, currentTag, UISavedData.selectedModule, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnCategoryOpened(categoryName : CName, opened : Bool) :
Bool{
var i : Int32;
if (categoryName == 'None'){
return false;
}
if (opened){
if (UISavedData.openedCategories.FindFirst(categoryName)
== -1){
UISavedData.openedCategories.PushBack(categoryNa
me);
}
} else {
i = UISavedData.openedCategories.FindFirst(categoryName)
;
if (i > -1){
UISavedData.openedCategories.Erase(i);
}
}
/* NOP */;
}
public function OnEntryRead(tag : CName) : Bool{
var journalEntry : CJournalBase;
journalEntry = m_journalManager.GetEntryByTag(tag);
m_journalManager.SetEntryUnread(journalEntry, false);
/* NOP */;
}
public function OnEntrySelected(tag : CName) : Bool{
var journalEntry : CJournalBase;
var journalQuestObj : CJournalQuestObjective;
currentTag = tag;
journalEntry = m_journalManager.GetEntryByTag(tag);
if (journalEntry){
journalQuestObj = (CJournalQuestObjective)journalEntry;
if (lastSentTag != tag && !journalQuestObj){
lastSentTag = tag;
UpdateDescription(tag);
UpdateImage(tag);
UpdateItems(tag);
}
theGame.NotifyOpeningJournalEntry(journalEntry);
} else if (lastSentTag != tag){
lastSentTag = tag;
UpdateDescription(tag);
UpdateImage(tag);

UpdateItems(tag);
}
/* NOP */;
}
public function OnEntryPress(tag : CName) : Bool{
}
protected function HandleMenuLoaded(){
super.HandleMenuLoaded();
OnEntrySelected(currentTag);
/* NOP */;
}
public function PopulateData(){
}
public function CreateItems(itemsNames : array<CName>) : CScriptedFlashA
rray{
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var i : Int32;
if (itemsNames.Size() < 1){
m_flashValueStorage.SetFlashBool(DATA_BINDING_NAME_SUBLI
ST + ".visible", false, /* NOP */);
return NULL;
}
m_flashValueStorage.SetFlashBool(DATA_BINDING_NAME_SUBLIST + ".v
isible", true, /* NOP */);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < itemsNames.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
FillItemInformation(l_flashObject, i);
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
return l_flashArray;
/* NOP */;
}
public function FillItemInformation(flashObject : CScriptedFlashObject,
index : Int32){
var itemName : CName;
var dm : CDefinitionsManagerAccessor;
itemName = itemsNames[index];
dm = theGame.GetDefinitionsManager();
flashObject.SetMemberFlashInt("id", index + 1);
flashObject.SetMemberFlashInt("quantity", GetItemQuantity(index)
);
flashObject.SetMemberFlashString("iconPath", dm.GetItemIconPath(
itemName));
flashObject.SetMemberFlashInt("gridPosition", index);
flashObject.SetMemberFlashInt("gridSize", 1);
flashObject.SetMemberFlashInt("slotType", 1);
flashObject.SetMemberFlashBool("isNew", false);
flashObject.SetMemberFlashBool("needRepair", false);
flashObject.SetMemberFlashInt("actionType", 0);
flashObject.SetMemberFlashInt("price", 0);
flashObject.SetMemberFlashString("userData", "");
flashObject.SetMemberFlashString("category", "");
/* NOP */;
}
public function GetItemQuantity(id : Int32) : Int32{

var itemName : CName;


var playerInv : CInventoryComponent;
itemName = itemsNames[id];
playerInv = thePlayer.GetInventory();
return playerInv.GetItemQuantityByName(itemName, /* NOP */);
/* NOP */;
}
public function OnGetItemData(item : Int32, compareItemType : Int32) : B
ool{
var itemName : String;
var category : CName;
var typeStr : String;
var weight : Float;
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
item = item - 1;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
itemName = dm.GetItemLocalisationKeyName(itemsNames[item]);
itemName = GetLocStringByKeyExt(itemName);
resultData.SetMemberFlashString("ItemName", itemName);
resultData.SetMemberFlashString("PriceValue", dm.GetItemPrice(it
emsNames[item]));
category = dm.GetItemCategory(itemsNames[item]);
if (dm.ItemHasTag(itemsNames[item], 'Quest') || dm.ItemHasTag(it
emsNames[item], 'AlchemyIngredient') || dm.ItemHasTag(itemsNames[item], 'Craftin
gIngredient') || dm.ItemHasTag(itemsNames[item], 'Potion') || dm.ItemHasTag(item
sNames[item], 'SilverOil') || dm.ItemHasTag(itemsNames[item], 'SteelOil') || cat
egory == 'petard' || category == 'bolt'){
weight = 0;
} else {
weight = 1;
}
resultData.SetMemberFlashString("WeightValue", NoTrailZeros(weig
ht));
resultData.SetMemberFlashString("ItemRarity", "");
typeStr = GetItemCategoryLocalisedString(category);
resultData.SetMemberFlashString("ItemType", typeStr);
resultData.SetMemberFlashString("DurabilityValue", "");
resultData.SetMemberFlashString("IconPath", dm.GetItemIconPath(i
temsNames[item]));
resultData.SetMemberFlashString("ItemCategory", category);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
public function UpdateDescription(entryName : CName){
}
public function UpdateImage(entryName : CName){
}
public function UpdateItems(tag : CName){
}
}
abstract class W3VirtualSwitch extends W3Switch{
protected editable var requiredSwitches : array<SRequiredSwitch>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{

super.OnSpawned(spawnData);
if (!spawnData.restored){
AddTimer('OnGetRequiredSwitches', 0.100000, /* NOP */, /
* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public timer function OnGetRequiredSwitches(optional timeDelta : Float,
optional id : Int32){
var i : Int32;
var switchEntity : W3Switch;
i = requiredSwitches.Size();
while (i >= 0){
switchEntity = GetSwitchByTag(requiredSwitches[i].requir
edSwitchTag);
if (switchEntity){
switchEntity.AddLinkToVirtualSwitch(this);
} else {
requiredSwitches.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public function Notify(out activeSwitch : W3Switch){
}
protected function Fail(failed : W3Switch){
/* NOP */;
/* NOP */;
}
public function Turn(on : Bool, actor : CActor, force : Bool, skip : Boo
l){
if (IsAvailable() || force){
if (on && IsOff() || IsUndefined()){
ProcessPostTurnActions(force, skip);
OnAnimSwitchedOn();
} else if (!on && IsOn() || IsUndefined()){
ProcessPostTurnActions(force, skip);
OnAnimSwitchedOff();
}
}
/* NOP */;
}
}
state W3PlayerWitcherStateApproachInteractionState in W3PlayerWitcher extends CR
4PlayerStateExtendedMovable{
private var objectPointHeading : Float;
private var objectHeadingSet : Bool;
private var stopRequested : Bool;
private var objectEntity : CEntity;
private var switchOn : Bool;
private var switchAnimationType : PhysicalSwitchAnimationType;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
thePlayer.OnRangedForceHolster(true, /* NOP */, /* NOP */);
parent.BlockAction(1, 'Interaction', false, /* NOP */, /* NOP */
);
parent.AddTimer('InputCheckDelay', 0.500000, true, false, 0, /*
NOP */, /* NOP */);

parent.AddTimer('ApproachTimeout', 4.000000, /* NOP */, /* NOP *


/, /* NOP */, /* NOP */, /* NOP */);
InitStateApproachInteraction(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.RemoveTimer('InputCheck', 0);
parent.UnblockAction(1, 'Interaction');
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function InitStateApproachInteraction(prevStateName : CName
){
var ticket : SMovementAdjustmentRequestTicket;
var movementAdjustor : CMovementAdjustor;
var toObjectEntity : Vector;
var moveToPosition : Vector;
var moveToRotation : EulerAngles;
var parentPosition : Vector;
var parentRadius : Float;
parent.LockEntryFunction(true);
if (objectEntity){
parentPosition = parent.GetWorldPosition();
parentRadius = parent.GetRadius();
toObjectEntity = parentPosition - objectEntity.GetWorldP
osition();
if (VecLength2D(toObjectEntity) > 0.834100){
moveToRotation = objectEntity.GetWorldRotation()
;
moveToPosition = objectEntity.GetWorldPosition()
- 0.834100 * VecNormalize(VecFromHeading(moveToRotation.Yaw + 180)) - 0.130000
* VecNormalize(VecFromHeading(moveToRotation.Yaw + 90));
parent.GetVisualDebug().AddSphere('approachInter
actionPos', parentRadius, moveToPosition, true, Color(255, 0, 0), 3.000000);
if (theGame.GetWorld().NavigationLineTest(parent
Position, moveToPosition, parentRadius, /* NOP */, /* NOP */) && theGame.GetWorl
d().NavigationCircleTest(moveToPosition, parentRadius, /* NOP */)){
parent.ActionMoveTo(moveToPosition, 0, 0
.001000, 0.300000, /* NOP */);
}
}
}
PlaySyncInteractionAnimation();
parent.LockEntryFunction(false);
StopApproach();
/* NOP */;
}
public function SetObjectPointHeading(head : Float, obj : CEntity){
objectPointHeading = head;
objectEntity = obj;
/* NOP */;
}
public function SetSyncInteractionAnimation(on : Bool, switchType : Phys
icalSwitchAnimationType){
switchOn = on;
switchAnimationType = switchType;
/* NOP */;
}
public function PlaySyncInteractionAnimation(){
switch(switchAnimationType){

case 1:
if (switchOn){
theGame.GetSyncAnimManager().SetupSimpleSyncAnim
('SwitchLeverOff', thePlayer, objectEntity);
} else {
theGame.GetSyncAnimManager().SetupSimpleSyncAnim
('SwitchLeverOn', thePlayer, objectEntity);
}
break;
case 2:
if (switchOn){
theGame.GetSyncAnimManager().SetupSimpleSyncAnim
('SwitchButtonOff', thePlayer, objectEntity);
} else {
theGame.GetSyncAnimManager().SetupSimpleSyncAnim
('SwitchButtonOn', thePlayer, objectEntity);
}
break;
}
/* NOP */;
}
public function OnReactToBeingHit(damageAction : W3DamageAction) : Bool{
var ret : Bool;
ret = virtual_parent.OnReactToBeingHit(damageAction);
parent.LockEntryFunction(false);
StopApproach();
return ret;
/* NOP */;
}
private function SetInteractionComponent(b : Bool){
var component : CComponent;
if (objectEntity){
component = objectEntity.GetComponentByClassName('CInter
actionComponent');
}
if (component){
component.SetEnabled(b);
}
/* NOP */;
}
private function StopApproach(){
parent.PopState(true);
/* NOP */;
}
public timer function InputCheckDelay(optional timeDelta : Float, option
al id : Int32){
parent.AddTimer('InputCheck', 0.001000, true, false, 0, /* NOP *
/, /* NOP */);
/* NOP */;
}
public timer function InputCheck(optional timeDelta : Float, optional id
: Int32){
var action : EActorActionType;
if (parent.GetIsMovable()){
action = parent.GetCurrentActionType();
if (action != 0){
if (theInput.GetActionValue('GI_AxisLeftX') != 0
|| theInput.GetActionValue('GI_AxisLeftY') != 0){
parent.LockEntryFunction(false);
StopApproach();

}
}
}
/* NOP */;
}
public timer function ApproachTimeout(optional timeDelta : Float, option
al id : Int32){
PlaySyncInteractionAnimation();
parent.LockEntryFunction(false);
StopApproach();
/* NOP */;
}
}
struct SRequiredSwitch{
editable var requiredSwitchTag : CName;
editable var switchState : ERequiredSwitchState;
}
abstract class W3Switch extends CGameplayEntity{
public editable var isInitiallyEnabled : Bool;
public editable var isInitiallyLocked : Bool;
public editable var isInitiallyOn : Bool;
public editable var maxUseCount : Int32;
public editable saved var skipEventsAtBeginning : Bool;
public editable inlined var whenOnEvents : array<W3SwitchEvent>;
public editable inlined var whenOffEvents : array<W3SwitchEvent>;
public editable inlined var whenSwitchedEvents : array<W3SwitchEvent>;
protected saved var currentState : ESwitchState;
protected saved var enabled : Bool;
protected saved var locked : Bool;
protected saved var totalUseCount : Int32;
protected saved var skipEvents : Bool;
protected saved var virtualSwitchesLinkedHandle : array<EntityHandle>;
protected saved var lastActivatorHandle : EntityHandle;
protected var restoreUsableItemL : Bool;
public const var BEH_ON : Float;
public const var BEH_OFF : Float;
public const var BEH_ON_FROM_OFF : Float;
public const var BEH_OFF_FROM_ON : Float;
public function __PrintState(prefix : Bool){
if (prefix){
/* NOP */;
} else {
/* NOP */;
}
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
__PrintState(/* NOP */);
if (!spawnData.restored){
currentState = 0;
Reset(0, 0, 0, true, skipEventsAtBeginning);
} else {
RestoreAfterSave();
}
/* NOP */;
}
public function OnAnimSwitchedOff() : Bool{
currentState = 1;

__PrintState(true);
if (skipEvents){
skipEvents = false;
} else {
ActivateEvents(whenOffEvents);
ActivateEvents(whenSwitchedEvents);
NotifyVirtualSwitches();
}
EntityHandleSet(lastActivatorHandle, NULL);
if (restoreUsableItemL){
thePlayer.OnUseSelectedItem(/* NOP */);
}
/* NOP */;
}
public function OnAnimSwitchingOn() : Bool{
currentState = 2;
__PrintState(true);
/* NOP */;
}
public function OnAnimSwitchedOn() : Bool{
currentState = 3;
__PrintState(true);
if (skipEvents){
skipEvents = false;
} else {
ActivateEvents(whenOnEvents);
ActivateEvents(whenSwitchedEvents);
NotifyVirtualSwitches();
}
EntityHandleSet(lastActivatorHandle, NULL);
if (restoreUsableItemL){
thePlayer.OnUseSelectedItem(/* NOP */);
}
/* NOP */;
}
public function OnAnimSwitchingOff() : Bool{
currentState = 4;
__PrintState(true);
/* NOP */;
}
public function OnManageSwitch(operations : array<ESwitchOperation>, for
ce : Bool, skipEvents : Bool) : Bool{
var i : Int32;
var size : Int32;
size = operations.Size();
i = 0;
while (i < size){
switch(operations[i]){
case 0:
Turn(true, thePlayer, force, skipEvents);
break;
case 1:
Turn(false, thePlayer, force, skipEvents);
break;
case 2:
Toggle(thePlayer, force, skipEvents);
break;
case 3:
Reset(0, 0, 0, force, skipEvents);
break;

case 4:
Enable(true);
break;
case 5:
Enable(false);
break;
case 6:
Lock(true);
break;
case 7:
Lock(false);
break;
}
i += 1;
}
/* NOP */;
}
public function Reset(enable : EResetSwitchMode, lock : EResetSwitchMode
, on : EResetSwitchMode, force : Bool, skipEvents : Bool){
totalUseCount = 0;
if (enable == 0){
enabled = isInitiallyEnabled;
} else if (enable == 2){
enabled = true;
} else if (enable == 3){
enabled = false;
}
if (lock == 0){
Lock(isInitiallyLocked);
} else if (lock == 2){
Lock(true);
} else if (lock == 3){
Lock(false);
}
if (on == 0){
if (isInitiallyOn){
Turn(true, NULL, force, skipEvents);
} else {
Turn(false, NULL, force, skipEvents);
}
} else if (on == 2){
Turn(true, NULL, force, skipEvents);
} else if (on == 3){
Turn(false, NULL, force, skipEvents);
}
/* NOP */;
}
public function RestoreAfterSave(){
var prevState : ESwitchState;
/* NOP */;
prevState = currentState;
switch(currentState){
case 0:
LogAssert(false, "Switch shouldn't have undefined state
after loading");
break;
case 1:
currentState = 0;
Turn(false, NULL, true, true);
break;

case 4:
currentState = 0;
Turn(false, NULL, true, skipEvents);
break;
case 3:
currentState = 0;
Turn(true, NULL, true, true);
break;
case 2:
currentState = 0;
Turn(true, NULL, true, skipEvents);
break;
}
if (currentState == 0 && prevState != 0){
currentState = prevState;
if (currentState == 4){
currentState = 1;
} else if (currentState == 2){
currentState = 3;
}
}
/* NOP */;
}
public function Turn(on : Bool, actor : CActor, force : Bool, skipEvents
: Bool){
var wasTurned : Bool;
wasTurned = false;
if (IsAvailable() || force){
if (on && IsOff() || IsUndefined()){
SetBehaviorVariable('SwitchState', BEH_ON, /* NO
P */);
wasTurned = true;
} else if (!on && IsOn() || IsUndefined()){
SetBehaviorVariable('SwitchState', BEH_OFF, /* N
OP */);
wasTurned = true;
}
}
if (wasTurned){
ProcessPostTurnActions(force, skipEvents);
EntityHandleSet(lastActivatorHandle, actor);
}
/* NOP */;
}
public function ProcessPostTurnActions(force : Bool, skip : Bool){
skipEvents = skip;
if (!force){
totalUseCount += 1;
if (IsUseCountReached()){
Enable(false);
}
}
/* NOP */;
}
public function Toggle(actor : CActor, force : Bool, skip : Bool){
if (IsOn()){
Turn(false, actor, force, skip);
} else if (IsOff()){
Turn(true, actor, force, skip);
}

/* NOP */;
}
public function Enable(enable : Bool){
enabled = enable;
/* NOP */;
}
public function Lock(lock : Bool){
locked = lock;
GetComponent("Locked").SetEnabled(lock);
GetComponent("Unlocked").SetEnabled(!lock);
/* NOP */;
}
public function IsEnabled() : Bool{
return enabled;
/* NOP */;
}
public function IsLocked() : Bool{
return locked;
/* NOP */;
}
public function IsOn() : Bool{
return currentState == 3;
/* NOP */;
}
public function IsOff() : Bool{
return currentState == 1;
/* NOP */;
}
public function IsSwitchingOn() : Bool{
return currentState == 2;
/* NOP */;
}
public function IsSwitchingOff() : Bool{
return currentState == 4;
/* NOP */;
}
public function IsUndefined() : Bool{
return currentState == 0;
/* NOP */;
}
public function IsUseCountReached() : Bool{
if (maxUseCount < 0){
return false;
}
return totalUseCount >= maxUseCount;
/* NOP */;
}
public function IsAvailable() : Bool{
return IsEnabled() && !IsLocked() && !IsUseCountReached();
/* NOP */;
}
public function AddLinkToVirtualSwitch(virtual : W3VirtualSwitch){
var localHandle : EntityHandle;
if (virtual){
EntityHandleSet(localHandle, virtual);
virtualSwitchesLinkedHandle.PushBack(localHandle);
}
/* NOP */;
}
public function NotifyVirtualSwitches(){

var i : Int32;
var size : Int32;
var virtualSwitchLinked : W3VirtualSwitch;
size = virtualSwitchesLinkedHandle.Size();
i = 0;
while (i < size){
virtualSwitchLinked = (W3VirtualSwitch)EntityHandleGet(v
irtualSwitchesLinkedHandle[i]);
virtualSwitchLinked.Notify(this);
i += 1;
}
/* NOP */;
}
protected function ActivateEvents(events : array<W3SwitchEvent>){
var i : Int32;
var size : Int32;
var lastActivator : CActor;
size = events.Size();
i = 0;
while (i < size){
if (events[i]){
lastActivator = (CActor)EntityHandleGet(lastActi
vatorHandle);
events[i].TriggerArgNode(this, lastActivator);
}
i += 1;
}
/* NOP */;
}
}
class W3TreasureHuntMappinEntity extends CR4MapPinEntity{
private saved var mappinSet : Bool;
private var isDisabled : Bool;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (entityName != 'None' && !mappinSet && !isDisabled){
Enable();
}
/* NOP */;
}
public function Enable(){
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
mapManager.SetEntityMapPinDiscoveredScript(false, entityName, tr
ue);
mappinSet = true;
/* NOP */;
}
public function Disable(){
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
isDisabled = true;
mapManager.SetEntityMapPinDiscoveredScript(false, entityName, fa
lse);
/* NOP */;
}
}
import abstract class SBehaviorGroup{

}
import abstract class SQuestBehaviorEvent{
}
import abstract class SQuestBehaviorNotification{
}
class W3Door extends W3LockableEntity{
public editable var rotDir : Int32;
public editable var initiallyOpened : Bool;
public editable var factOnPlayerDoorOpen : CName;
private saved var isOpened : Bool;
protected autobind openInteractionComponent : CInteractionComponent = "O
pen";
protected autobind closeInteractionComponent : CInteractionComponent = "
Close";
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (closeInteractionComponent){
closeInteractionComponent.SetEnabled(false);
}
if (!spawnData.restored && initiallyOpened || spawnData.restored
&& isOpened){
isOpened = false;
Open();
} else {
isOpened = false;
}
SetFocusModeVisibility(1, /* NOP */);
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var processed : Bool;
if (activator != thePlayer || isInteractionBlocked){
return false;
}
processed = super.OnInteraction(actionName, activator);
if (processed){
return true;
}
if (actionName == "Open"){
if (Open()){
FactsAdd(factOnPlayerDoorOpen, 1, 3);
}
} else if (actionName == "Close"){
Close();
}
/* NOP */;
}
public function OnManageDoor(operations : array<EDoorOperation>, force :
Bool) : Bool{
var i : Int32;
var size : Int32;
size = operations.Size();
i = 0;
while (i < size){
switch(operations[i]){
case 0:

if (CanBeOpened(force)){
Open();
}
break;
case 1:
if (CanBeClosed(force)){
Close();
}
break;
case 2:
Toggle(force);
break;
case 3:
if (!IsLocked()){
Lock('anykey', /* NOP */, /* NOP */);
}
break;
case 4:
if (IsLocked()){
Unlock();
}
break;
case 5:
ToggleLock();
break;
}
i += 1;
}
/* NOP */;
}
public function Close(){
var rot : EulerAngles;
if (!isOpened){
return;
}
rot = GetWorldRotation();
rot.Yaw = rot.Yaw - rotDir;
TeleportWithRotation(GetWorldPosition(), rot);
if (closeInteractionComponent){
closeInteractionComponent.SetEnabled(false);
}
if (openInteractionComponent){
openInteractionComponent.SetEnabled(true);
}
isOpened = false;
/* NOP */;
}
public function Toggle(force : Bool){
if (IsOpened()){
if (CanBeClosed(force)){
Close();
}
} else if (CanBeOpened(force)){
Open();
}
/* NOP */;
}
public function CanBeOpened(force : Bool) : Bool{
return !IsOpened() && !IsLocked() || force;
/* NOP */;

}
public function CanBeClosed(force : Bool) : Bool{
return IsOpened() && !IsLocked() || force;
/* NOP */;
}
public function IsOpened() : Bool{
return isOpened;
/* NOP */;
}
public function Open() : Bool{
var rot : EulerAngles;
if (isOpened){
return false;
}
rot = GetWorldRotation();
rot.Yaw = rot.Yaw + rotDir;
TeleportWithRotation(GetWorldPosition(), rot);
if (openInteractionComponent){
openInteractionComponent.SetEnabled(false);
}
if (closeInteractionComponent){
closeInteractionComponent.SetEnabled(true);
}
isOpened = true;
if (IsLocked()){
Unlock();
}
return true;
/* NOP */;
}
protected function OnLock(){
Close();
/* NOP */;
}
public function OnStateChange(newState : Bool) : Bool{
if (isOpened){
if (closeInteractionComponent){
closeInteractionComponent.SetEnabled(newState);
}
} else if (openInteractionComponent){
openInteractionComponent.SetEnabled(newState);
}
super.OnStateChange(newState);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
super.OnInteractionActivated(interactionComponentName, activator
);
if (activator == thePlayer){
ShowInteractionComponent();
}
/* NOP */;
}
}
class W3FocusAreaTrigger extends CGameplayEntity{
private const var rumbleIntensityModifier : Float;
private var isDisabled : Bool;
public editable saved var intensity : Float;

public saved var isActive : Bool;


public editable var linkedClues : array<EntityHandle>;
public editable var linkedCluesTags : array<CName>;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
}
public function OnAreaActivated(area : CTriggerAreaComponent, activated
: Bool) : Bool{
}
public function Disable(){
isDisabled = true;
ChangeFocusAreaIntensity(0.000000);
/* NOP */;
}
public function Enable(){
isDisabled = false;
/* NOP */;
}
public function ChangeFocusAreaIntensity(newIntensity : Float){
}
private function SetupClueConnections(){
var i : Int32;
var k : Int32;
var count : Int32;
var linkedClueSize : Int32;
var ent : CEntity;
var clue : W3MonsterClue;
var clueEntities : array<CEntity>;
linkedClueSize = linkedClues.Size();
i = 0;
while (i < linkedClueSize){
ent = EntityHandleGet(linkedClues[i]);
clue = (W3MonsterClue)ent;
if (clue){
clue.linkedFocusArea = this;
count += 1;
LogQuest("Focus Area: linked clue added correctl
y");
}
i += 1;
}
i = 0;
while (i < linkedCluesTags.Size()){
theGame.GetEntitiesByTag(linkedCluesTags[i], clueEntitie
s);
k = 0;
while (k < clueEntities.Size()){
clue = (W3MonsterClue)clueEntities[i];
if (clue){
clue.linkedFocusArea = this;
count += 1;
LogQuest("Focus Area: linked clue added
correctly");
}
k += 1;
}
i += 1;

}
LogQuest("Focus Area: Connections processed: " + IntToString(i))
;
/* NOP */;
}
public function SmartFocusAreaCheck(){
var i : Int32;
var k : Int32;
var linkedClueSize : Int32;
var ent : CEntity;
var clue : W3MonsterClue;
var shouldBeActive : Bool;
var clueEntities : array<CEntity>;
linkedClueSize = linkedClues.Size();
shouldBeActive = false;
i = 0;
while (i < linkedClueSize){
ent = EntityHandleGet(linkedClues[i]);
clue = (W3MonsterClue)ent;
if (clue){
if (clue.wasDetected == false){
shouldBeActive = true;
}
}
i += 1;
}
i = 0;
while (i < linkedCluesTags.Size()){
theGame.GetEntitiesByTag(linkedCluesTags[i], clueEntitie
s);
k = 0;
while (k < clueEntities.Size()){
clue = (W3MonsterClue)clueEntities[i];
if (clue){
if (clue.wasDetected == false){
shouldBeActive = true;
}
}
k += 1;
}
i += 1;
}
if (shouldBeActive == true){
if (intensity > 1.000000){
ChangeFocusAreaIntensity(intensity - 1.000000);
LogQuest("Focus Area: Smart clue changed intensi
ty to: " + FloatToString(intensity));
} else {
LogQuest("Focus Area: Intensity already at 1, no
change due to smart clue");
}
} else {
ChangeFocusAreaIntensity(0.000000);
LogQuest("Focus Area: Smart clue changed intensity to: "
+ FloatToString(intensity));
}
/* NOP */;
}
}

statemachine class CGateEntity extends W3LockableEntity{


private saved var currState : CName;
private var speedModifier : Float;
private editable var initiallyOpened : Bool;
private editable var startSound : CName;
private editable var stopSound : CName;
private var runTime : Float;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (spawnData.restored){
if (currState == 'Closed'){
CloseGate(0.010000);
} else {
OpenGate(0.010000);
}
} else {
HandleInitialState();
}
/* NOP */;
}
public function OnStreamIn() : Bool{
if (!theGame.IsActive()){
return false;
}
if (currState == 'Closed'){
EnableDeniedArea(true);
} else {
PlayPropertyAnimation('raise', 1, 0.010000, 0);
EnableDeniedArea(false);
}
super.OnStreamIn();
/* NOP */;
}
private function HandleInitialState(){
if (initiallyOpened){
OpenGate(0.010000);
} else {
CloseGate(0.010000);
}
/* NOP */;
}
public function CloseGate(passedSpeedModifier : Float){
SetSpeedModifier(passedSpeedModifier);
PlayGateSounds();
GotoState('Closed', /* NOP */, /* NOP */);
/* NOP */;
}
public function OpenGate(passedSpeedModifier : Float){
SetSpeedModifier(passedSpeedModifier);
PlayGateSounds();
GotoState('Opened', /* NOP */, /* NOP */);
/* NOP */;
}
public function EnableDeniedArea(toggle : Bool){
var deniedArea : CDeniedAreaComponent;
deniedArea = (CDeniedAreaComponent)GetComponent("deniedArea");
if (deniedArea){
deniedArea.SetEnabled(toggle);
}
/* NOP */;
}

public function PlayGateSounds(){


if (runTime * speedModifier >= 2.000000){
SoundEvent(startSound, /* NOP */, /* NOP */);
AddTimer('StopGateSounds', runTime * speedModifier - 1.0
00000, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function StopGateSounds(optional td : Float, optional id :
Int32){
SoundEvent(stopSound, /* NOP */, /* NOP */);
/* NOP */;
}
public function GetCurrState() : CName{
return currState;
/* NOP */;
}
public function SetCurrState(stateName : CName){
currState = stateName;
/* NOP */;
}
public function GetSpeedModifier() : Float{
return speedModifier;
/* NOP */;
}
public function SetSpeedModifier(passedSpeedModifier : Float){
if (passedSpeedModifier < 0.010000){
speedModifier = 0.010000;
} else {
speedModifier = passedSpeedModifier;
}
/* NOP */;
}
}
class W3PhysicalDamageMechanism extends CGameplayEntity{
public editable var dmgValue : Float;
public editable var hitReactionType : EHitReactionType;
private var isActive : Bool;
private var isMoving : Bool;
public function Activate(){
isActive = true;
isMoving = true;
/* NOP */;
}
public function Deactivate(){
isActive = false;
isMoving = false;
/* NOP */;
}
public function IsActive() : Bool{
return isActive;
/* NOP */;
}
public function OnManageMechanism(operations : array<EPhysicalDamagemech
anismOperation>) : Bool{
var i : Int32;
var size : Int32;
size = operations.Size();
i = 0;

while (i < size){


switch(operations[i]){
case 0:
Activate();
break;
case 1:
Deactivate();
break;
}
i += 1;
}
/* NOP */;
}
public function OnActorCollision(object : CObject, physicalActorindex :
Int32, shapeIndex : Int32) : Bool{
var action : W3DamageAction;
var victim : CActor;
var ent : CEntity;
var component : CComponent;
component = (CComponent)object;
if (!component){
return false;
}
ent = component.GetEntity();
if (ent != this){
if (!isActive || !isMoving){
return true;
}
victim = (CActor)component.GetEntity();
if (victim){
action = new W3DamageAction in theGame.damageMgr
;
action.Initialize(this, victim, component, GetNa
me(), hitReactionType, 0, true, false, false, true, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_PHYS
ICAL, dmgValue);
theGame.damageMgr.ProcessAction(action);
delete action;
isActive = false;
AddTimer('ActivateTimer', 1.000000, false, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
LogAssert(false, "physicalDamageMechanism: I sho
uld be doing damage");
}
return true;
}
/* NOP */;
}
public function OnPropertyAnimationFinished(propertyName : CName, animat
ionName : CName) : Bool{
isMoving = false;
/* NOP */;
}
protected timer function ActivateTimer(optional dt : Float, optional id
: Int32){
isActive = true;
/* NOP */;
}
}

import abstract class IUIConditionType{


}
import struct CHorseRiderSharedParams{
public var hasFallenFromHorse : Bool;
public var scriptedActionPending : Bool;
public var isPlayingAnimWithRider : Bool;
public var combatTarget : CActor;
//NULL type for mountStatus
//NULL type for vehicleSlot
//NULL type for rider
//NULL type for horse
//NULL type for boat
public function GetHorse() : CActor{
return horse;
/* NOP */;
}
}
struct EncounterEntryDetails{
editable var encounterTag : CName;
editable var canBeRepeated : Bool;
editable var occurenceTime : EOcurrenceTime;
editable var questFileEntry : array<CEntityTemplate>;
}
import struct CComboAspect{
import public final
String;
import public final
: array<CName>);
import public final
ionName : CName);
import public final
ame : CName);
}

function CreateComboString(leftSide : Bool) : CCombo


function AddLinks(animationName : CName, connections
function AddLink(animationName : CName, linkedAnimat
function AddHit(animationName : CName, hitAnimationN

statemachine class W3MicroQuestActivator extends CGameplayEntity{


public editable var microQuestEntries : array<EncounterEntryDetails>;
public var selectedEntriesList : array<EncounterEntryDetails>;
public var chosenMicroQuestTag : CName;
public var isPlayerInArea : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
if (!spawnData.restored){
GotoStateAuto();
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
isPlayerInArea = false;
/* NOP */;
}
public function GetCurrentTime() : Int32{
var currentTime : GameTime;

var currentHour : Int32;


currentTime = theGame.GetGameTime();
currentHour = GameTimeHours(currentTime);
return currentHour;
/* NOP */;
}
public function CanMicroQuestBeStarted(mQEntry : EncounterEntryDetails)
: Bool{
var cTime : Int32;
var oTime : EOcurrenceTime;
cTime = GetCurrentTime();
oTime = mQEntry.occurenceTime;
if (oTime == 0){
return true;
} else if (oTime == 1){
if (cTime > 7 && cTime < 20){
return true;
}
} else if (oTime == 2){
if (cTime > 20 && cTime < 24 || cTime > 0 && cTime < 7){
return true;
}
}
return false;
/* NOP */;
}
public function QuestAvailableAgain(){
var i : Int32;
i = 0;
while (i < selectedEntriesList.Size()){
if (selectedEntriesList[i].canBeRepeated){
FactsRemove(NameToString(selectedEntriesList[i].
encounterTag));
break;
}
i += 1;
}
/* NOP */;
}
public timer function BackToInactive(optional deltaTime : Float, optiona
l id : Int32){
}
}
import abstract class SComboAnimationData{
}
import struct CComboString{
import public final function AddAttack(animationName : CName, distance :
EAttackDistance);
import public final function AddDirAttack(animationName : CName, directi
on : EAttackDirection, distance : EAttackDistance);
import public final function AddDirAttacks(animationNameFront : CName, a
nimationNameBack : CName, animationNameLeft : CName, animationNameRight : CName,
distance : EAttackDistance);
}
import abstract class ICustomCameraPivotPositionController{
//NULL type for offsetZ
import public final function SetDesiredPosition(position : Vector, mult

: Float);
import public final function Update(currPosition : Vector, currVelocity
: Vector, timeDelta : Float);
public function Reset(){
}
}
class W3MonsterHuntInvestigationArea extends CGameplayEntity{
public editable saved var enabled : Bool;
public editable var investigationMusicStartEvent : String;
public editable var investigationMusicStopEvent : String;
public editable var requiredTrackedQuest : CName;
public var active : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (enabled){
if (CheckAreaValidity()){
ProcessAreaActivation();
}
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (enabled){
if (activator.GetEntity() == thePlayer){
UpdateCurrentInvestigationArea();
ProcessAreaActivation();
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (enabled){
if (activator.GetEntity() == thePlayer){
RemoveTimer('QuestTrackerCheckTimer', /* NOP */)
;
SwitchInvestigationMusic(false);
}
}
/* NOP */;
}
private function CheckAreaValidity() : Bool{
var comp : CTriggerAreaComponent;
comp = (CTriggerAreaComponent)GetComponentByClassName('CTriggerA
reaComponent');
if (comp){
if (comp.TestEntityOverlap(thePlayer)){
return true;
} else {
return false;
}
} else {
return false;
}
/* NOP */;
}
private function SwitchInvestigationMusic(turnOn : Bool){
if (turnOn){
if (!active){

theSound.SoundEvent(investigationMusicStartEvent
);
active = true;
}
} else if (active){
theSound.SoundEvent(investigationMusicStopEvent);
theSound.SoundEventClearSaved();
active = false;
}
/* NOP */;
}
public function SetInvestigationAreaEnabled(isEnabled : Bool, silentTurn
Off : Bool){
if (isEnabled){
enabled = isEnabled;
if (CheckAreaValidity()){
UpdateCurrentInvestigationArea();
ProcessAreaActivation();
}
} else {
enabled = isEnabled;
if (CheckAreaValidity()){
RemoveTimer('QuestTrackerCheckTimer', /* NOP */)
;
if (!silentTurnOff){
SwitchInvestigationMusic(false);
} else {
active = false;
}
}
}
/* NOP */;
}
public function SetInvestigationAreaActive(isActive : Bool){
active = isActive;
/* NOP */;
}
private function ProcessAreaActivation(){
if (GetIsRequiredQuestTracked()){
SwitchInvestigationMusic(true);
} else {
SwitchInvestigationMusic(false);
}
if (requiredTrackedQuest != 'None'){
AddTimer('QuestTrackerCheckTimer', 0.500000, true, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
}
thePlayer.SetCurrentMonsterHuntInvestigationArea(this);
/* NOP */;
}
private function GetIsRequiredQuestTracked() : Bool{
var journalManager : CWitcherJournalManager;
var trackedQuest : CJournalQuest;
var requiredQuest : CJournalQuest;
if (requiredTrackedQuest == 'None'){
return true;
}
journalManager = theGame.GetJournalManager();
trackedQuest = journalManager.GetTrackedQuest();
requiredQuest = (CJournalQuest)journalManager.GetEntryByTag(requ

iredTrackedQuest);
if (trackedQuest == requiredQuest){
return true;
} else {
return false;
}
/* NOP */;
}
public timer function QuestTrackerCheckTimer(optional dt : Float, option
al id : Int32){
if (GetIsRequiredQuestTracked()){
SwitchInvestigationMusic(true);
} else {
SwitchInvestigationMusic(false);
}
/* NOP */;
}
private function UpdateCurrentInvestigationArea(){
var prevArea : W3MonsterHuntInvestigationArea;
prevArea = thePlayer.currentMonsterHuntInvestigationArea;
if (prevArea && prevArea != this){
prevArea.RemoveTimer('QuestTrackerCheckTimer', /* NOP */
);
prevArea.SetInvestigationAreaActive(false);
}
/* NOP */;
}
}
import abstract class ICustomCameraPivotRotationController{
//NULL type for maxPitch
//NULL type for minPitch
import public final function SetDesiredHeading(heading : Float, mult : F
loat);
import public final function SetDesiredPitch(pitch : Float, mult : Float
);
import public final function RotateHorizontal(right : Bool, mult : Float
);
import public final function RotateVertical(up : Bool, mult : Float);
import public final function StopRotating();
import public final function Update(currRotation : EulerAngles, currVelo
city : EulerAngles, timeDelta : Float);
}
abstract class W3ClueCondition extends CObject{
public function CheckCondition(waypoint : CNode) : Bool{
/* NOP */;
return false;
/* NOP */;
}
}
import abstract class ICustomCameraPivotDistanceController{
import public final function SetDesiredDistance(distance : Float, mult :
Float);
import public final function Update(currDistance : Float, currVelocity :
Float, timeDelta : Float);
}
import abstract class ICustomCameraPositionController{

}
import abstract class CCustomCameraBlendPPC{
}
class W3ClueWaypoint extends CObject{
public editable var waypointTag : CName;
public editable var clueStateInWaypoint : EBoidClueState;
public editable var conditionsLogicalOperator : ELogicalOperator;
public editable inlined var waypointReachedConditions : array<W3ClueCond
ition>;
public function WaypointReached() : Bool{
var waypointNode : CNode;
var i : Int32;
var size : Int32;
var checkResult : Bool;
var finalResult : Bool;
waypointNode = theGame.GetNodeByTag(waypointTag);
if (conditionsLogicalOperator == 0){
finalResult = true;
} else {
finalResult = false;
}
if (waypointNode){
size = waypointReachedConditions.Size();
i = 0;
while (i < size){
checkResult = waypointReachedConditions[i].Check
Condition(waypointNode);
if (conditionsLogicalOperator == 0){
if (checkResult == false){
return false;
}
} else if (conditionsLogicalOperator == 1){
if (checkResult == true){
return true;
}
}
i += 1;
}
}
return finalResult;
/* NOP */;
}
}
import abstract class SCustomCameraPreset{
}
class CR4OverlayMenu extends CR4MenuBase{
public var m_BlurBackground : Bool;
public var m_PauseGame : Bool;
public function OnConfigUI() : Bool{
super.OnConfigUI();
if (m_BlurBackground){
BlurBackground(this, true);
}
/* NOP */;
}
public function OnCloseMenu() : Bool{

RequestClose();
/* NOP */;
}
public function OnClosingMenu() : Bool{
if (m_BlurBackground){
BlurBackground(this, false);
}
super.OnClosingMenu();
/* NOP */;
}
public function RequestClose(){
CloseMenu();
/* NOP */;
}
protected function BlurBackground(firstLayer : CR4MenuBase, value : Bool
){
if (firstLayer.m_parentMenu){
BlurBackground(firstLayer.m_parentMenu, value);
firstLayer.m_parentMenu.BlurLayer(value);
}
/* NOP */;
}
}
class CR4MenuItemSelect extends CR4OverlayMenu{
protected var _itemsInv : W3GuiItemSelectComponent;
protected var _invComponent : CInventoryComponent;
protected var _initData : W3ItemSelectMenuInitData;
public function OnConfigUI() : Bool{
super.OnConfigUI();
MakeModal(true);
/* NOP */;
_initData = (W3ItemSelectMenuInitData)GetMenuInitData();
_invComponent = thePlayer.GetInventory();
_itemsInv = new W3GuiItemSelectComponent in this;
_itemsInv.Initialize(_invComponent);
_itemsInv.InitFilter(_initData);
UpdateData();
/* NOP */;
}
public function OnSelectItem(item : SItemUniqueId) : Bool{
/* NOP */;
_initData.applyItemSelection(item);
RequestClose();
/* NOP */;
}
public function RequestClose(){
if (_initData){
delete _initData;
}
super.RequestClose();
/* NOP */;
}
protected function UpdateData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_itemsInv.GetInventoryFlashArray(l_flashArray, l_flashObject);

/* NOP */;
m_flashValueStorage.SetFlashArray("items.list.data", l_flashArra
y);
/* NOP */;
}
}
import struct CFlyingSwarmScriptInput{
//NULL type for groupList
import public final function CreateGroup(toSpawnCount : Int32, spawnPoiT
ype : CName, groupState : CName, fromOtherGroup_Id : CFlyingGroupId);
import public final function RemoveGroup(groupId : CFlyingGroupId);
import public final function MoveBoidToGroup(groupIdA : CFlyingGroupId,
count : Int32, groupIdB : CFlyingGroupId);
}
class CR4PreparationPotionsAndBombsMenu extends CR4MenuBase{
private var _gridInv : W3GuiPreparationPotionsAndBombsInventoryComponent
;
private var _currentInv : W3GuiBaseInventoryComponent;
protected var _inv : CInventoryComponent;
private var optionsItemActions : array<EInventoryActionType>;
private var _currentQuickSlot : EEquipmentSlots;
private const var ITEMS_SIZE : Int32;
public function OnConfigUI() : Bool{
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
super.OnConfigUI();
_inv = thePlayer.GetInventory();
_gridInv = new W3GuiPreparationPotionsAndBombsInventoryComponent
in this;
_gridInv.Initialize(_inv);
_currentInv = _gridInv;
UpdateData();
m_flashValueStorage.SetFlashString("common.grid.name", GetLocStr
ingByKeyExt("panel_preparation_potionsandbombs_grid_name"), -1);
m_flashValueStorage.SetFlashString("preparation.potionsandbombs.
sublist.name", GetLocStringByKeyExt("panel_preparation_potionsandbombs_slots_des
cription"), -1);
UpdatePlayerOrens();
UpdatePlayerLevel();
UpdateNavigationTitles();
/* NOP */;
}
public function UpdateData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_gridInv.GetInventoryFlashArray(l_flashArray, l_flashObject);
m_flashValueStorage.SetFlashArray("common.grid", l_flashArray);
UpdatePotions();
UpdateBombs();
/* NOP */;
}
public function UpdateBombs(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var rewardItems : array<SItemUniqueId>;

var item : SItemUniqueId;


var i : Int32;
var _inv : CInventoryComponent;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_inv = GetWitcherPlayer().GetInventory();
i = 7;
while (i < 8 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item);
rewardItems.PushBack(item);
i += 1;
}
i = 0;
while (i < ITEMS_SIZE){
item = rewardItems[i];
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", ItemToFlashUInt(it
em));
if (_inv.IsItemSingletonItem(item)){
l_flashObject.SetMemberFlashInt("quantity", theP
layer.inv.SingletonItemGetAmmo(item));
} else {
l_flashObject.SetMemberFlashInt("quantity", _inv
.GetItemQuantity(item));
}
l_flashObject.SetMemberFlashString("iconPath", _inv.GetI
temIconPathByUniqueID(item));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("preparation.bombs.equipped.it
ems", l_flashArray);
/* NOP */;
}
public function UpdatePotions(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var rewardItems : array<SItemUniqueId>;
var item : SItemUniqueId;
var i : Int32;
var _inv : CInventoryComponent;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_inv = GetWitcherPlayer().GetInventory();
i = 14;
while (i < 15 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item);
rewardItems.PushBack(item);
i += 1;
}
i = 0;
while (i < ITEMS_SIZE){

item = rewardItems[i];
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", ItemToFlashUInt(it
em));
if (_inv.IsItemSingletonItem(item)){
l_flashObject.SetMemberFlashInt("quantity", theP
layer.inv.SingletonItemGetAmmo(item));
} else {
l_flashObject.SetMemberFlashInt("quantity", _inv
.GetItemQuantity(item));
}
l_flashObject.SetMemberFlashString("iconPath", _inv.GetI
temIconPathByUniqueID(item));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("preparation.potions.equipped.
items", l_flashArray);
/* NOP */;
}
private function UpdatePlayerOrens(){
var orens : Int32;
orens = thePlayer.GetMoney();
m_flashValueStorage.SetFlashInt("inventory.playerdetails.money",
orens, -1);
/* NOP */;
}
private function UpdatePlayerLevel(){
m_flashValueStorage.SetFlashInt("inventory.playerdetails.level",
GetCurrentLevel(), -1);
m_flashValueStorage.SetFlashString("inventory.playerdetails.expe
rience", GetCurrentExperience(), -1);
/* NOP */;
}
private function GetCurrentLevel() : Int32{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetLevel();
/* NOP */;
}
private function GetCurrentExperience() : String{
var levelManager : W3LevelManager;
var str : String;
levelManager = GetWitcherPlayer().levelManager;
str = levelManager.GetPointsTotal(1) + "/" + levelManager.GetTot
alExpForNextLevel();
return str;
/* NOP */;
}
public function UpdateTooltipCompareData(item : SItemUniqueId, compareIt

em : SItemUniqueId, tooltipInv : CInventoryComponent, tooltipName : String){


var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var compareItemStats : array<SAttributeTooltip>;
var itemStats : array<SAttributeTooltip>;
var i : Int32;
var j : Int32;
var price : Int32;
var nam : String;
var descript : String;
var fluff : String;
var category : String;
var itemName : String;
var attributeVal : SAbilityAttributeValue;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
if (tooltipInv.IsIdValid(item)){
itemName = tooltipInv.GetItemLocalizedNameByUniqueID(ite
m);
itemName = GetLocStringByKeyExt(itemName);
m_flashValueStorage.SetFlashString(tooltipName + ".title
", itemName, -1);
} else {
m_flashValueStorage.SetFlashString(tooltipName + ".title
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".price
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".weigh
t", "", -1);
m_flashValueStorage.SetFlashArray(tooltipName + ".stats"
, l_flashArray);
m_flashValueStorage.SetFlashString(tooltipName + ".descr
iption", "", -1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName +
".icon", "", -1);
m_flashValueStorage.SetFlashString(tooltipName +
".category", "", -1);
}
return;
}
if (tooltipInv.GetItemName(item) != _inv.GetItemName(compareItem
)){
_inv.GetTooltipData(compareItem, nam, descript, price, c
ategory, compareItemStats, fluff);
}
tooltipInv.GetTooltipData(item, nam, descript, price, category,
itemStats, fluff);
itemName = "none";
i = 0;
while (i < itemStats.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
j = 0;
while (j < compareItemStats.Size()){
itemName = "positive";
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
if (itemStats[j].value < compareItemStat

s[i].value){
itemName = "negative";
} else if (itemStats[j].value == compare
ItemStats[i].value){
itemName = "neutral";
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", itemName);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value * 100) + " %");
} else {
l_flashObject.SetMemberFlashString("value", "+"
+ NoTrailZeros(itemStats[i].value));
}
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray(tooltipName + ".stats", l_flas
hArray);
m_flashValueStorage.SetFlashString(tooltipName + ".price", toolt
ipInv.GetItemPrice(item), -1);
attributeVal = _inv.GetItemAttributeValue(item, 'weight', /* NOP
*/, /* NOP */);
m_flashValueStorage.SetFlashString(tooltipName + ".weight", attr
ibuteVal.valueAdditive, -1);
m_flashValueStorage.SetFlashString(tooltipName + ".description",
GetLocStringByKeyExt("panel_inventory_tooltip_description_selected"), -1);
m_flashValueStorage.SetFlashBool(tooltipName + ".display", true,
-1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName + ".icon"
, tooltipInv.GetItemIconPathByUniqueID(item), -1);
m_flashValueStorage.SetFlashString(tooltipName + ".categ
ory", tooltipInv.GetItemCategory(item), -1);
}
/* NOP */;
}
public function UpdateNavigationTitles(){
m_flashValueStorage.SetFlashString("inventory.navigation.title",
GetLocStringByKeyExt("panel_title_preapration"), -1);
m_flashValueStorage.SetFlashString("inventory.navigation.previou
s", "", -1);
m_flashValueStorage.SetFlashString("inventory.navigation.next",
"", -1);
/* NOP */;
}
public function GetItemDefaultAction(item : SItemUniqueId) : String{
return "[[panel_button_inventory_equip]]";
/* NOP */;
}
public function OnCloseMenu() : Bool{
var parentMenu : CR4MenuBase;
CloseMenu();
parentMenu = (CR4MenuBase)GetMenuInitData();
parentMenu.OnCloseMenu();
parentMenu.CloseMenu();

/* NOP */;
}
public function OnEquipItem(item : SItemUniqueId, slot : Int32, quantity
: Int32) : Bool{
var i : Int32;
var itemOnSlot : SItemUniqueId;
if (slot == 10){
i = 10;
while (i < 11 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item
OnSlot);
if (!_inv.IsIdValid(itemOnSlot)){
slot = i;
_currentQuickSlot = slot;
break;
}
i += 1;
}
}
if (slot == 14){
i = 14;
while (i < 15 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item
OnSlot);
if (!_inv.IsIdValid(itemOnSlot)){
slot = i;
GetWitcherPlayer().EquipItemInGivenSlot(
item, slot, false, /* NOP */);
break;
}
i += 1;
}
}
if (slot == 7){
i = 7;
while (i < 8 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item
OnSlot);
if (!_inv.IsIdValid(itemOnSlot)){
slot = i;
break;
}
i += 1;
}
}
_gridInv.EquipItem(item, slot);
UpdateData();
/* NOP */;
}
public function OnUpdateTooltipCompareData(item : SItemUniqueId, compare
ItemType : Int32, tooltipName : String) : Bool{
var itemName : String;
var compareItem : SItemUniqueId;
itemName = _inv.GetItemName(item);
UpdateTooltipCompareData(item, compareItem, _inv, tooltipName);
/* NOP */;
}
}
class CR4PreparationMenu extends CR4MenuBase{

protected var _gridInv : W3GuiPreparationInventoryComponent;


protected var _inv : CInventoryComponent;
public function OnConfigUI() : Bool{
initMeditationState();
m_flashModule = GetMenuFlash();
m_flashValueStorage = GetMenuFlashValueStorage();
super.OnConfigUI();
_inv = thePlayer.GetInventory();
_gridInv = new W3GuiPreparationInventoryComponent in this;
_gridInv.Initialize(_inv);
ShowRenderToTexture("");
m_flashValueStorage.SetFlashBool("journal.rewards.panel.visible"
, false, /* NOP */);
setMenuMode();
updateSlotsItems();
UpdateOilSlotLocks();
sendTrackedMonsterInfo();
/* NOP */;
}
public function OnCloseMenu() : Bool{
var medd : W3PlayerWitcherStateMeditation;
var waitt : W3PlayerWitcherStateMeditationWaiting;
theSound.SoundEvent('gui_global_quit');
CloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
if (_gridInv){
delete _gridInv;
}
if (thePlayer.GetCurrentStateName() == 'MeditationWaiting'){
waitt = (W3PlayerWitcherStateMeditationWaiting)thePlayer
.GetCurrentState();
if (waitt){
waitt.StopRequested(/* NOP */);
}
} else {
medd = (W3PlayerWitcherStateMeditation)GetWitcherPlayer(
).GetCurrentState();
if (medd){
medd.StopRequested(/* NOP */);
}
}
/* NOP */;
}
public function OnGuiSceneEntitySpawned(entity : CEntity) : Bool{
Event_OnGuiSceneEntitySpawned();
UpdateItemsFromEntity(entity);
/* NOP */;
}
public function OnGuiSceneEntityDestroyed() : Bool{
Event_OnGuiSceneEntityDestroyed();
/* NOP */;
}
public function UpdateItemsFromEntity(entity : CEntity){
var l_creature : CJournalCreature;
var hasCreature : Bool;
var trackType : PreparationTrackType;
var creatureDataComponent : CCreatureDataComponent;
var itemsFlashArray : CScriptedFlashArray;

var journalManager : CWitcherJournalManager;


journalManager = theGame.GetJournalManager();
hasCreature = getCurrentTrackedCreatureTag(l_creature, trackType
);
if (hasCreature && l_creature && journalManager.GetEntryHasAdvan
cedInfo(l_creature)){
creatureDataComponent = (CCreatureDataComponent)entity.G
etComponentByClassName('CCreatureDataComponent');
if (creatureDataComponent){
itemsFlashArray = CreateItems(creatureDataCompon
ent.GetItemsUsedAgainstCreature());
}
}
if (itemsFlashArray && itemsFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", true, /* NOP */);
m_flashValueStorage.SetFlashArray("tracked.monster.recom
mended.items", itemsFlashArray);
} else {
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", false, /* NOP */);
}
/* NOP */;
}
private function CreateItems(itemsNames : array<CName>) : CScriptedFlash
Array{
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
if (itemsNames.Size() < 1){
return NULL;
}
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < itemsNames.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", i + 1);
l_flashObject.SetMemberFlashInt("quantity", 1);
l_flashObject.SetMemberFlashString("iconPath", dm.GetIte
mIconPath(itemsNames[i]));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
return l_flashArray;
/* NOP */;
}
public function getCurrentTrackedCreatureTag(journalCreature : CJournalC
reature, trackedType : PreparationTrackType) : Bool{

var journalManager : CWitcherJournalManager;


var currentlyTrackedCreature : CJournalCreature;
var currentlyTrackedCreatureName : CName;
var currentlyTrackedQuest : CJournalQuest;
journalManager = theGame.GetJournalManager();
currentlyTrackedQuest = journalManager.GetTrackedQuest();
if (currentlyTrackedQuest.GetType() == 3){
currentlyTrackedCreatureName = currentlyTrackedQuest.Get
HuntingQuestCreatureTag();
currentlyTrackedCreature = (CJournalCreature)journalMana
ger.GetEntryByTag(currentlyTrackedCreatureName);
if (currentlyTrackedCreature){
trackedType = 1;
journalCreature = currentlyTrackedCreature;
return true;
}
}
currentlyTrackedCreature = journalManager.GetCurrentlyBuffedCrea
ture();
if (currentlyTrackedCreature){
trackedType = 2;
journalCreature = currentlyTrackedCreature;
return true;
}
return false;
/* NOP */;
}
public function SetButtons(){
AddInputBinding("panel_button_common_navigation", "gamepad_L3",
/* NOP */);
super.SetButtons();
/* NOP */;
}
public function UpdateOilSlotLocks(){
m_flashValueStorage.SetFlashBool("preparation.slot.silversword.l
ocked", !_inv.IsThereItemOnSlot(1), /* NOP */);
m_flashValueStorage.SetFlashBool("preparation.slot.steelsword.lo
cked", !_inv.IsThereItemOnSlot(2), /* NOP */);
/* NOP */;
}
public function UpdateToxicityBar(){
var curToxicity : Float;
var curMaxToxicity : Float;
curToxicity = thePlayer.GetStat(3, /* NOP */);
curMaxToxicity = thePlayer.GetStatMax(3);
m_flashValueStorage.SetFlashNumber("preparation.toxicity.bar.max
", curMaxToxicity, -1);
m_flashValueStorage.SetFlashNumber("preparation.toxicity.bar.val
ue", curToxicity, -1);
/* NOP */;
}
private function sendTrackedMonsterInfo(){
var monsterData : CScriptedFlashObject;
var trackType : PreparationTrackType;
var foundCreature : Bool;
var currentlyTrackedCreature : CJournalCreature;
var itemsFlashArray : CScriptedFlashArray;
monsterData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
foundCreature = getCurrentTrackedCreatureTag(currentlyTrackedCre

ature, trackType);
if (foundCreature){
monsterData.SetMemberFlashInt("trackType", trackType);
if (trackType == 1){
monsterData.SetMemberFlashString("trackTypeStr",
GetLocStringByKeyExt("panel_preparation_quest_tracked_monster"));
} else {
monsterData.SetMemberFlashString("trackTypeStr",
GetLocStringByKeyExt("panel_preparation_quest_buffed_monster"));
}
monsterData.SetMemberFlashString("monsterIconPath", "ico
ns/monsters/" + currentlyTrackedCreature.GetImage());
monsterData.SetMemberFlashString("monsterName", GetLocSt
ringById(currentlyTrackedCreature.GetNameStringId()));
monsterData.SetMemberFlashString("bgImgPath", currentlyT
rackedCreature.GetImage());
monsterData.SetMemberFlashString("txtDesc", GetDescripti
on(currentlyTrackedCreature));
itemsFlashArray = CreateItems(currentlyTrackedCreature.G
etItemsUsedAgainstCreature());
if (itemsFlashArray && itemsFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashBool("journal.reward
s.panel.visible", true, /* NOP */);
m_flashValueStorage.SetFlashArray("tracked.monst
er.recommended.items", itemsFlashArray);
} else {
m_flashValueStorage.SetFlashBool("journal.reward
s.panel.visible", false, /* NOP */);
}
ShowRenderToTexture("");
} else {
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", false, /* NOP */);
monsterData.SetMemberFlashInt("trackType", 0);
monsterData.SetMemberFlashString("trackTypeStr", GetLocS
tringByKeyExt("panel_preparation_no_tracked_monster"));
monsterData.SetMemberFlashString("monsterIconPath", "ico
ns/monsters/ICO_NoMonster.png");
}
m_flashValueStorage.SetFlashObject("preparation.tracked.monster.
info", monsterData, /* NOP */);
/* NOP */;
}
public function GetDescription(currentCreature : CJournalCreature) : Str
ing{
var journalManager : CWitcherJournalManager;
var i : Int32;
var str : String;
var locStrId : Int32;
var descriptionsGroup : CJournalCreatureDescriptionGroup;
var tmpGroup : CJournalCreatureDescriptionGroup;
var description : CJournalCreatureDescriptionEntry;
journalManager = theGame.GetJournalManager();
str = "";
i = 0;
while (i < currentCreature.GetNumChildren()){
tmpGroup = (CJournalCreatureDescriptionGroup)currentCrea
ture.GetChild(i);
if (tmpGroup){
descriptionsGroup = tmpGroup;

break;
}
i += 1;
}
i = 0;
while (i < descriptionsGroup.GetNumChildren()){
description = (CJournalCreatureDescriptionEntry)descript
ionsGroup.GetChild(i);
if (journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();
str += GetLocStringById(locStrId) + "<br>";
}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
private function initMeditationState(){
var medState : W3PlayerWitcherStateMeditation;
medState = (W3PlayerWitcherStateMeditation)GetMenuInitData();
/* NOP */;
}
protected function equipTypeToTabIndex(equipId : Int32) : PreparationMen
uTabIndexes{
switch(equipId){
case 7:
case 8:
return 0;
case 14:
case 15:
return 1;
case 1:
case 2:
return 2;
case 18:
case 19:
case 20:
case 21:
return 3;
}
return 0;
/* NOP */;
}
protected function tabIndexToItemType(tabIndex : Int32) : EPreporationIt
emType{
switch(tabIndex){
case 0:
return 1;
case 1:
return 2;
case 2:
return 3;
case 3:
return 4;
default:
}

return 0;
return 0;
/* NOP */;
}
public function OnTabDataRequested(tabIndex : Int32) : Bool{
PopulateTabData(tabIndex);
/* NOP */;
}
public function PopulateTabData(tabIndex : Int32){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
switch(tabIndex){
case 0:
_gridInv.GetContainerItems(l_flashArray, l_flashObject,
1);
break;
case 1:
_gridInv.GetContainerItems(l_flashArray, l_flashObject,
2);
break;
case 2:
_gridInv.GetContainerItems(l_flashArray, l_flashObject,
3);
break;
case 3:
_gridInv.GetContainerItems(l_flashArray, l_flashObject,
4);
break;
}
PopulateDataForTab(tabIndex, l_flashArray);
/* NOP */;
}
private function PopulateDataForTab(tabIndex : Int32, entriesArray : CSc
riptedFlashArray){
var l_flashObject : CScriptedFlashObject;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashObject.SetMemberFlashInt("tabIndex", tabIndex);
l_flashObject.SetMemberFlashArray("tabData", entriesArray);
m_flashValueStorage.SetFlashObject("preparations.items.tab.data"
+ tabIndex, l_flashObject, /* NOP */);
/* NOP */;
}
private function updateSlotsItems(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_gridInv.GetSlotsItems(l_flashArray, l_flashObject, /* NOP */);
m_flashValueStorage.SetFlashArray("preparations.slots.list", l_f
lashArray);
UpdateToxicityBar();
/* NOP */;
}
private function setMenuMode(){
var RootMenu : CR4CommonMenu;

RootMenu = (CR4CommonMenu)GetRootMenu();
if (RootMenu){
}
/* NOP */;
}
public function OnSelectInventoryItem(itemId : SItemUniqueId, slot : Int
32) : Bool{
if (_inv.IsIdValid(itemId)){
_gridInv.ClearItemIsNewFlag(itemId);
}
/* NOP */;
}
public function OnEquipItemPrep(item : SItemUniqueId, equipID : Int32) :
Bool{
var itemOnSlot : SItemUniqueId;
var weaponId : SItemUniqueId;
if (equipID == 1){
if (_inv.IsIdValid(item) && _inv.GetItemEquippedOnSlot(1
, weaponId)){
GetWitcherPlayer().ApplyOil(item, weaponId);
}
} else if (equipID == 2){
if (_inv.IsIdValid(item) && _inv.GetItemEquippedOnSlot(2
, weaponId)){
GetWitcherPlayer().ApplyOil(item, weaponId);
}
} else {
GetWitcherPlayer().GetItemEquippedOnSlot(equipID, itemOn
Slot);
if (_inv.IsIdValid(itemOnSlot)){
_gridInv.UnequipItem(itemOnSlot);
}
_gridInv.EquipItemInGivenSlot(item, equipID);
}
updateSlotsItems();
PopulateTabData(equipTypeToTabIndex(equipID));
UpdateToxicityBar();
/* NOP */;
}
public function OnUnequipItemPrep(equipID : Int32) : Bool{
var itemOnSlot : SItemUniqueId;
GetWitcherPlayer().GetItemEquippedOnSlot(equipID, itemOnSlot);
if (_inv.IsIdValid(itemOnSlot) && equipID != 1 && equipID != 2){
/* NOP */;
GetWitcherPlayer().UnequipItemFromSlot(equipID, false);
PopulateTabData(equipTypeToTabIndex(equipID));
updateSlotsItems();
}
/* NOP */;
}
private function GetLocItemOilCategory(item : SItemUniqueId) : String{
var typeStr : String;
var itemTags : array<CName>;
var i : Int32;
var silverOil : Bool;
var steelOil : Bool;
typeStr = GetLocStringByKeyExt("item_category_" + _inv.GetItemCa
tegory(item));
if (_gridInv.isOilItem(item) && _inv.GetItemTags(item, itemTags)
){

silverOil = false;
steelOil = false;
i = 0;
while (i < itemTags.Size()){
if (itemTags[i] == 'SteelOil'){
steelOil = true;
} else if (itemTags[i] == 'SilverOil'){
silverOil = true;
}
i += 1;
}
if (steelOil && !silverOil){
typeStr = GetLocStringByKeyExt("panel_inventory_
paperdoll_slotname_steel_oil");
} else if (silverOil && !steelOil){
typeStr = GetLocStringByKeyExt("panel_inventory_
paperdoll_slotname_silver_oil");
}
}
return typeStr;
/* NOP */;
}
public function OnGetItemData(item : SItemUniqueId, compareItemType : In
t32) : Bool{
var compareItem : SItemUniqueId;
var itemUIData : SInventoryItemUIData;
var itemWeight : SAbilityAttributeValue;
var compareItemStats : array<SAttributeTooltip>;
var itemStats : array<SAttributeTooltip>;
var itemName : String;
var category : String;
var typeStr : String;
var weight : Float;
var primaryStatLabel : String;
var primaryStatValue : Float;
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
GetWitcherPlayer().GetItemEquippedOnSlot(compareItemType, compar
eItem);
itemName = _inv.GetItemName(item);
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
if (!_inv.IsIdValid(item)){
return false;
}
_inv.GetItemPrimaryStat(item, primaryStatLabel, primaryStatValue
);
itemName = _inv.GetItemLocalizedNameByUniqueID(item);
itemName = GetLocStringByKeyExt(itemName);
resultData.SetMemberFlashString("ItemName", itemName);
if (_inv.GetItemName(item) != _inv.GetItemName(compareItem)){
_inv.GetItemStats(compareItem, compareItemStats);
}
_inv.GetItemStats(item, itemStats);
CompareItemsStats(itemStats, compareItemStats, statsList);
resultData.SetMemberFlashArray("StatsList", statsList);
resultData.SetMemberFlashString("PriceValue", _inv.GetItemPrice(
item));
if (_inv.ItemHasTag(item, 'Quest') || _inv.IsItemIngredient(item

) || _inv.IsItemAlchemyItem(item)){
weight = 0;
} else {
itemWeight = _inv.GetItemAttributeValue(item, 'weight',
/* NOP */, /* NOP */);
weight = itemWeight.valueBase;
}
resultData.SetMemberFlashString("WeightValue", NoTrailZeros(weig
ht));
resultData.SetMemberFlashString("ItemRarity", GetItemRarityDescr
iption(item, _inv));
category = GetItemCategoryLocalisedString(_inv.GetItemCategory(i
tem));
if (_gridInv.isOilItem(item)){
typeStr = GetLocItemOilCategory(item);
} else {
typeStr = GetLocStringByKeyExt("item_category_" + _inv.G
etItemCategory(item));
}
resultData.SetMemberFlashString("ItemType", typeStr);
resultData.SetMemberFlashString("UniqueDescription", GetLocStrin
gByKeyExt(_inv.GetItemLocalizedDescriptionByUniqueID(item)));
if (_inv.HasItemDurability(item)){
resultData.SetMemberFlashString("DurabilityValue", NoTra
ilZeros(_inv.GetItemDurability(item) / _inv.GetItemMaxDurability(item) * 100));
} else {
resultData.SetMemberFlashString("DurabilityValue", "");
}
resultData.SetMemberFlashString("PrimaryStatLabel", primaryStatL
abel);
resultData.SetMemberFlashNumber("PrimaryStatValue", primaryStatV
alue);
if (theGame.IsPadConnected()){
resultData.SetMemberFlashString("IconPath", _inv.GetItem
IconPathByUniqueID(item));
resultData.SetMemberFlashString("ItemCategory", category
);
}
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
public function OnGetEmptyPaperdollTooltip(equipID : Int32, isLocked : B
ool) : Bool{
var statsList : CScriptedFlashArray;
var resultData : CScriptedFlashObject;
statsList = m_flashValueStorage.CreateTempFlashArray();
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
if (isLocked){
resultData.SetMemberFlashString("ItemName", GetLocString
ByKeyExt("panel_inventory_tooltip_locked_slot"));
} else {
resultData.SetMemberFlashString("ItemName", GetLocString
ByKeyExt("panel_inventory_tooltip_empty_slot"));
}
resultData.SetMemberFlashArray("StatsList", statsList);
resultData.SetMemberFlashString("PriceValue", 0);
resultData.SetMemberFlashString("WeightValue", 0);
resultData.SetMemberFlashString("ItemRarity", "");

if (equipID == 1 || equipID == 2){


resultData.SetMemberFlashString("ItemType", GetLocString
ByKeyExt("panel_inventory_paperdoll_slotname_oils"));
} else {
resultData.SetMemberFlashString("ItemType", GetLocString
ByKeyExt(GetLocNameFromEquipSlot(equipID)));
}
resultData.SetMemberFlashString("DurabilityValue", "");
resultData.SetMemberFlashString("PrimaryStatLabel", "");
resultData.SetMemberFlashNumber("PrimaryStatValue", 0);
resultData.SetMemberFlashString("IconPath", "");
resultData.SetMemberFlashString("ItemCategory", "");
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
public function OnGetAppliedOilTooltip(equipID : Int32) : Bool{
var oilName : CName;
var statsList : CScriptedFlashArray;
var resultData : CScriptedFlashObject;
if (equipID == 1){
oilName = _inv.GetOilNameOnSword(false);
} else if (equipID == 2){
oilName = _inv.GetOilNameOnSword(true);
} else {
return false;
}
if (oilName == 'None'){
return false;
}
statsList = m_flashValueStorage.CreateTempFlashArray();
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
resultData.SetMemberFlashString("ItemName", GetLocStringByKeyExt
(_inv.GetItemLocalizedNameByName(oilName)));
resultData.SetMemberFlashArray("StatsList", statsList);
resultData.SetMemberFlashString("PriceValue", 0);
resultData.SetMemberFlashString("WeightValue", 0);
resultData.SetMemberFlashString("ItemRarity", "");
if (equipID == 1){
resultData.SetMemberFlashString("ItemType", GetLocString
ByKeyExt("panel_inventory_paperdoll_slotname_silver_oil"));
} else if (equipID == 2){
resultData.SetMemberFlashString("ItemType", GetLocString
ByKeyExt("panel_inventory_paperdoll_slotname_steel_oil"));
}
resultData.SetMemberFlashString("DurabilityValue", "");
resultData.SetMemberFlashString("PrimaryStatLabel", "");
resultData.SetMemberFlashNumber("PrimaryStatValue", 0);
resultData.SetMemberFlashString("IconPath", _inv.GetItemIconPath
ByName(oilName));
resultData.SetMemberFlashString("ItemCategory", "");
resultData.SetMemberFlashString("UniqueDescription", GetLocStrin
gByKeyExt(_inv.GetItemLocalizedDescriptionByName(oilName)));
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
public function CompareItemsStats(itemStats : array<SAttributeTooltip>,
compareItemStats : array<SAttributeTooltip>, compResult : CScriptedFlashArray){

var l_flashObject : CScriptedFlashObject;


var attributeVal : SAbilityAttributeValue;
var strDifference : String;
var percentDiff : Float;
var nDifference : Float;
var i : Int32;
var j : Int32;
var price : Int32;
strDifference = "none";
i = 0;
while (i < itemStats.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
l_flashObject.SetMemberFlashString("color", itemStats[i]
.attributeColor);
j = 0;
while (j < compareItemStats.Size()){
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
nDifference = itemStats[j].value - compa
reItemStats[i].value;
percentDiff = AbsF(nDifference / itemSta
ts[j].value);
if (nDifference > 0){
if (percentDiff < 0.250000){
strDifference = "better"
;
} else if (percentDiff > 0.75000
0){
strDifference = "wayBett
er";
} else {
strDifference = "reallyB
etter";
}
} else if (nDifference < 0){
if (percentDiff < 0.250000){
strDifference = "worse";
} else if (percentDiff > 0.75000
0){
strDifference = "wayWors
e";
} else {
strDifference = "reallyW
orse";
}
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", strDifference
);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value * 100) + " %");
} else if (itemStats[i].value < 0){
l_flashObject.SetMemberFlashString("value", NoTr

ailZeros(itemStats[i].value));
} else {
l_flashObject.SetMemberFlashString("value", "+"
+ NoTrailZeros(itemStats[i].value));
}
compResult.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
public function GetItemRarityDescription(item : SItemUniqueId, tooltipIn
v : CInventoryComponent) : String{
var itemQuality : Int32;
itemQuality = tooltipInv.GetItemQuality(item);
return GetItemRarityDescriptionFromInt(itemQuality);
/* NOP */;
}
}
class CR4PreparationMutagensMenu extends CR4MenuBase{
private var _gridInv : W3GuiPreparationMutagensInventoryComponent;
private var _currentInv : W3GuiBaseInventoryComponent;
protected var _inv : CInventoryComponent;
private var optionsItemActions : array<EInventoryActionType>;
private var _currentQuickSlot : EEquipmentSlots;
private const var TOXICTY_BAR_DATA_BINDING_KEY : String;
private const var MUTAGENS_SIZE : Int32;
private var initialized : Bool;
public function OnConfigUI() : Bool{
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
if (initialized){
return false;
}
super.OnConfigUI();
_inv = thePlayer.GetInventory();
_gridInv = new W3GuiPreparationMutagensInventoryComponent in thi
s;
_gridInv.Initialize(_inv);
_currentInv = _gridInv;
UpdateData();
m_flashValueStorage.SetFlashString("common.grid.name", GetLocStr
ingByKeyExt("panel_preparation_mutagens_grid_name"), -1);
m_flashValueStorage.SetFlashString(TOXICTY_BAR_DATA_BINDING_KEY
+ "description", GetLocStringByKeyExt("panel_preparation_toxicitybar_description
"), -1);
m_flashValueStorage.SetFlashString("preparation.mutagens.sublist
.name", GetLocStringByKeyExt("panel_preparation_mutagens_sublist_name"), -1);
UpdatePlayerOrens();
UpdatePlayerLevel();
UpdateNavigationTitles();
UpdateToxicityBar();
initialized = true;
/* NOP */;
}
public function UpdateData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);

l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_gridInv.GetInventoryFlashArray(l_flashArray, l_flashObject);
m_flashValueStorage.SetFlashArray("common.grid", l_flashArray);
UpdateMutagens();
/* NOP */;
}
public function UpdateToxicityBar(){
var curToxicity : Float;
var curMaxToxicity : Float;
var lockedToxicity : Float;
curToxicity = thePlayer.GetStat(3, /* NOP */);
curMaxToxicity = thePlayer.GetStatMax(3);
lockedToxicity = curToxicity - thePlayer.GetStat(3, true);
m_flashValueStorage.SetFlashNumber(TOXICTY_BAR_DATA_BINDING_KEY
+ "max", curMaxToxicity, -1);
m_flashValueStorage.SetFlashNumber(TOXICTY_BAR_DATA_BINDING_KEY
+ "value", curToxicity, -1);
m_flashValueStorage.SetFlashNumber(TOXICTY_BAR_DATA_BINDING_KEY
+ "locked", lockedToxicity, -1);
/* NOP */;
}
public function UpdateMutagens(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var items : array<SItemUniqueId>;
var item : SItemUniqueId;
var i : Int32;
var _inv : CInventoryComponent;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_inv = GetWitcherPlayer().GetInventory();
i = 18;
while (i < 21 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, item);
items.PushBack(item);
i += 1;
}
i = 0;
while (i < MUTAGENS_SIZE){
item = items[i];
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", ItemToFlashUInt(it
em));
if (_inv.IsItemSingletonItem(item)){
l_flashObject.SetMemberFlashInt("quantity", theP
layer.inv.SingletonItemGetAmmo(item));
} else {
l_flashObject.SetMemberFlashInt("quantity", _inv
.GetItemQuantity(item));
}
l_flashObject.SetMemberFlashString("iconPath", _inv.GetI
temIconPathByUniqueID(item));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");

l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("preparation.mutagens.equipped
.items", l_flashArray);
/* NOP */;
}
private function UpdatePlayerOrens(){
var orens : Int32;
orens = thePlayer.GetMoney();
m_flashValueStorage.SetFlashInt("inventory.playerdetails.money",
orens, -1);
/* NOP */;
}
private function UpdatePlayerLevel(){
m_flashValueStorage.SetFlashInt("inventory.playerdetails.level",
GetCurrentLevel(), -1);
m_flashValueStorage.SetFlashString("inventory.playerdetails.expe
rience", GetCurrentExperience(), -1);
/* NOP */;
}
private function GetCurrentLevel() : Int32{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetLevel();
/* NOP */;
}
private function GetCurrentExperience() : String{
var levelManager : W3LevelManager;
var str : String;
levelManager = GetWitcherPlayer().levelManager;
str = levelManager.GetPointsTotal(1) + "/" + levelManager.GetTot
alExpForNextLevel();
return str;
/* NOP */;
}
public function UpdateTooltipCompareData(item : SItemUniqueId, compareIt
em : SItemUniqueId, tooltipInv : CInventoryComponent, tooltipName : String){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var compareItemStats : array<SAttributeTooltip>;
var itemStats : array<SAttributeTooltip>;
var i : Int32;
var j : Int32;
var price : Int32;
var nam : String;
var descript : String;
var fluff : String;
var category : String;
var itemName : String;
var attributeVal : SAbilityAttributeValue;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
if (tooltipInv.IsIdValid(item)){
itemName = tooltipInv.GetItemLocalizedNameByUniqueID(ite
m);
itemName = GetLocStringByKeyExt(itemName);
m_flashValueStorage.SetFlashString(tooltipName + ".title
", itemName, -1);
} else {

m_flashValueStorage.SetFlashString(tooltipName + ".title
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".price
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".weigh
t", "", -1);
m_flashValueStorage.SetFlashArray(tooltipName + ".stats"
, l_flashArray);
m_flashValueStorage.SetFlashString(tooltipName + ".descr
iption", "", -1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName +
".icon", "", -1);
m_flashValueStorage.SetFlashString(tooltipName +
".category", "", -1);
}
return;
}
if (tooltipInv.GetItemName(item) != _inv.GetItemName(compareItem
)){
_inv.GetTooltipData(compareItem, nam, descript, price, c
ategory, compareItemStats, fluff);
}
tooltipInv.GetTooltipData(item, nam, descript, price, category,
itemStats, fluff);
itemName = "none";
i = 0;
while (i < itemStats.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
j = 0;
while (j < compareItemStats.Size()){
itemName = "positive";
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
if (itemStats[j].value < compareItemStat
s[i].value){
itemName = "negative";
} else if (itemStats[j].value == compare
ItemStats[i].value){
itemName = "neutral";
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", itemName);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value * 100) + " %");
} else {
l_flashObject.SetMemberFlashString("value", "+"
+ NoTrailZeros(itemStats[i].value));
}
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray(tooltipName + ".stats", l_flas

hArray);
m_flashValueStorage.SetFlashString(tooltipName + ".price", toolt
ipInv.GetItemPrice(item), -1);
attributeVal = _inv.GetItemAttributeValue(item, 'weight', /* NOP
*/, /* NOP */);
m_flashValueStorage.SetFlashString(tooltipName + ".weight", attr
ibuteVal.valueAdditive, -1);
m_flashValueStorage.SetFlashString(tooltipName + ".description",
GetLocStringByKeyExt("panel_inventory_tooltip_description_selected"), -1);
m_flashValueStorage.SetFlashBool(tooltipName + ".display", true,
-1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName + ".icon"
, tooltipInv.GetItemIconPathByUniqueID(item), -1);
m_flashValueStorage.SetFlashString(tooltipName + ".categ
ory", tooltipInv.GetItemCategory(item), -1);
}
UpdateToxicityBar();
/* NOP */;
}
public function UpdateNavigationTitles(){
}
public function UpdateRightMenuOptionsData(item : SItemUniqueId){
}
public function GetItemDefaultAction(item : SItemUniqueId) : String{
return "FIXME";
/* NOP */;
}
public function OnCloseMenu() : Bool{
var parentMenu : CR4MenuBase;
CloseMenu();
parentMenu = (CR4MenuBase)GetMenuInitData();
parentMenu.OnCloseMenu();
parentMenu.CloseMenu();
/* NOP */;
}
public function OnEquipItem(item : SItemUniqueId, slot : Int32, quantity
: Int32) : Bool{
var i : Int32;
var itemOnSlot : SItemUniqueId;
slot = 18;
i = 18;
while (i < 21 + 1){
GetWitcherPlayer().GetItemEquippedOnSlot(i, itemOnSlot);
if (!_inv.IsIdValid(itemOnSlot)){
slot = i;
break;
}
i += 1;
}
UpdateData();
UpdateToxicityBar();
/* NOP */;
}
public function OnSetCurrentPlayerGrid(value : String) : Bool{
}
public function OnMoveItem(item : SItemUniqueId, moveToIndex : Int32) :
Bool{
_gridInv.MoveItem(item, moveToIndex);
UpdateData();

/* NOP */;
}
public function OnMoveItems(item : SItemUniqueId, moveToIndex : Int32, i
temSecond : SItemUniqueId, moveToSecondIndex : Int32) : Bool{
_gridInv.MoveItems(item, moveToIndex, itemSecond, moveToSecondIn
dex);
UpdateData();
/* NOP */;
}
public function OnUpdateTooltipCompareData(item : SItemUniqueId, compare
ItemType : Int32, tooltipName : String) : Bool{
}
public function OnUpdateRightMenuOptions(item : SItemUniqueId) : Bool{
}
public function OnRightMenuOptionChoosen(itemId : SItemUniqueId, quantit
y : Int32, actionValue : Int32) : Bool{
}
}
class CR4PreparationOilsMenu extends CR4MenuBase{
private var _gridInv : W3GuiPreparationOilsInventoryComponent;
private var _currentInv : W3GuiBaseInventoryComponent;
protected var _inv : CInventoryComponent;
private var optionsItemActions : array<EInventoryActionType>;
private var _currentQuickSlot : EEquipmentSlots;
private const var ITEMS_SIZE : Int32;
public function OnConfigUI() : Bool{
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
super.OnConfigUI();
_inv = thePlayer.GetInventory();
_gridInv = new W3GuiPreparationOilsInventoryComponent in this;
_gridInv.Initialize(_inv);
_currentInv = _gridInv;
UpdateData();
m_flashValueStorage.SetFlashString("common.grid.name", GetLocStr
ingByKeyExt("panel_preparation_oils_grid_name"), -1);
m_flashValueStorage.SetFlashString("preparation.oils.sublist.nam
e", GetLocStringByKeyExt("panel_preparation_oils_sublist_name"), -1);
UpdatePlayerOrens();
UpdatePlayerLevel();
UpdateNavigationTitles();
/* NOP */;
}
public function UpdateData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_gridInv.GetInventoryFlashArray(l_flashArray, l_flashObject);
m_flashValueStorage.SetFlashArray("common.grid", l_flashArray);
UpdateBombs();
/* NOP */;
}
public function UpdateBombs(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var rewardItems : array<SItemUniqueId>;
var item : SItemUniqueId;

var i : Int32;
var _inv : CInventoryComponent;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
_inv = GetWitcherPlayer().GetInventory();
GetWitcherPlayer().GetItemEquippedOnSlot(2, item);
rewardItems.PushBack(item);
GetWitcherPlayer().GetItemEquippedOnSlot(1, item);
rewardItems.PushBack(item);
i = 0;
while (i < ITEMS_SIZE){
item = rewardItems[i];
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", ItemToFlashUInt(it
em));
l_flashObject.SetMemberFlashInt("quantity", _inv.GetItem
Quantity(item));
l_flashObject.SetMemberFlashString("iconPath", _inv.GetI
temIconPathByUniqueID(item));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("preparation.oils.equipped.ite
ms", l_flashArray);
/* NOP */;
}
private function UpdatePlayerOrens(){
var orens : Int32;
orens = thePlayer.GetMoney();
m_flashValueStorage.SetFlashInt("inventory.playerdetails.money",
orens, -1);
/* NOP */;
}
private function UpdatePlayerLevel(){
m_flashValueStorage.SetFlashInt("inventory.playerdetails.level",
GetCurrentLevel(), -1);
m_flashValueStorage.SetFlashString("inventory.playerdetails.expe
rience", GetCurrentExperience(), -1);
/* NOP */;
}
private function GetCurrentLevel() : Int32{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetLevel();
/* NOP */;
}
private function GetCurrentExperience() : String{
var levelManager : W3LevelManager;
var str : String;
levelManager = GetWitcherPlayer().levelManager;
str = levelManager.GetPointsTotal(1) + "/" + levelManager.GetTot

alExpForNextLevel();
return str;
/* NOP */;
}
public function UpdateTooltipCompareData(item : SItemUniqueId, compareIt
em : SItemUniqueId, tooltipInv : CInventoryComponent, tooltipName : String){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var compareItemStats : array<SAttributeTooltip>;
var itemStats : array<SAttributeTooltip>;
var i : Int32;
var j : Int32;
var price : Int32;
var nam : String;
var descript : String;
var fluff : String;
var category : String;
var itemName : String;
var attributeVal : SAbilityAttributeValue;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
if (tooltipInv.IsIdValid(item)){
itemName = tooltipInv.GetItemLocalizedNameByUniqueID(ite
m);
itemName = GetLocStringByKeyExt(itemName);
m_flashValueStorage.SetFlashString(tooltipName + ".title
", itemName, -1);
} else {
m_flashValueStorage.SetFlashString(tooltipName + ".title
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".price
", "", -1);
m_flashValueStorage.SetFlashString(tooltipName + ".weigh
t", "", -1);
m_flashValueStorage.SetFlashArray(tooltipName + ".stats"
, l_flashArray);
m_flashValueStorage.SetFlashString(tooltipName + ".descr
iption", "", -1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName +
".icon", "", -1);
m_flashValueStorage.SetFlashString(tooltipName +
".category", "", -1);
}
return;
}
if (tooltipInv.GetItemName(item) != _inv.GetItemName(compareItem
)){
_inv.GetTooltipData(compareItem, nam, descript, price, c
ategory, compareItemStats, fluff);
}
tooltipInv.GetTooltipData(item, nam, descript, price, category,
itemStats, fluff);
itemName = "none";
i = 0;
while (i < itemStats.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
j = 0;

while (j < compareItemStats.Size()){


itemName = "positive";
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
if (itemStats[j].value < compareItemStat
s[i].value){
itemName = "negative";
} else if (itemStats[j].value == compare
ItemStats[i].value){
itemName = "neutral";
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", itemName);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value * 100) + " %");
} else {
l_flashObject.SetMemberFlashString("value", "+"
+ NoTrailZeros(itemStats[i].value));
}
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray(tooltipName + ".stats", l_flas
hArray);
m_flashValueStorage.SetFlashString(tooltipName + ".price", toolt
ipInv.GetItemPrice(item), -1);
attributeVal = _inv.GetItemAttributeValue(item, 'weight', /* NOP
*/, /* NOP */);
m_flashValueStorage.SetFlashString(tooltipName + ".weight", attr
ibuteVal.valueAdditive, -1);
m_flashValueStorage.SetFlashString(tooltipName + ".description",
GetLocStringByKeyExt("panel_inventory_tooltip_description_selected"), -1);
m_flashValueStorage.SetFlashBool(tooltipName + ".display", true,
-1);
if (theGame.IsPadConnected()){
m_flashValueStorage.SetFlashString(tooltipName + ".icon"
, tooltipInv.GetItemIconPathByUniqueID(item), -1);
m_flashValueStorage.SetFlashString(tooltipName + ".categ
ory", tooltipInv.GetItemCategory(item), -1);
}
/* NOP */;
}
public function UpdateNavigationTitles(){
m_flashValueStorage.SetFlashString("inventory.navigation.title",
GetLocStringByKeyExt("panel_title_preapration"), -1);
m_flashValueStorage.SetFlashString("inventory.navigation.previou
s", "", -1);
m_flashValueStorage.SetFlashString("inventory.navigation.next",
"", -1);
/* NOP */;
}
public function GetItemDefaultAction(item : SItemUniqueId) : String{
return "[[panel_button_inventory_equip]]";
/* NOP */;
}
public function OnCloseMenu() : Bool{

var parentMenu : CR4MenuBase;


CloseMenu();
parentMenu = (CR4MenuBase)GetMenuInitData();
parentMenu.OnCloseMenu();
parentMenu.CloseMenu();
/* NOP */;
}
public function OnUpgradeItem(item : SItemUniqueId, slot : Int32, quanti
ty : Int32) : Bool{
var swordItem : SItemUniqueId;
var invalid : SItemUniqueId;
if (_inv.ItemHasTag(item, 'SilverOil')){
GetWitcherPlayer().GetItemEquippedOnSlot(1, swordItem);
} else if (_inv.ItemHasTag(item, 'SteelOil')){
GetWitcherPlayer().GetItemEquippedOnSlot(2, swordItem);
}
if (_inv.IsIdValid(swordItem)){
_gridInv.UpgradeItem(swordItem, item);
UpdateData();
}
UpdateTooltipCompareData(item, invalid, _inv, "tooltip");
/* NOP */;
}
public function OnUpdateTooltipCompareData(item : SItemUniqueId, compare
ItemType : Int32, tooltipName : String) : Bool{
var itemName : String;
var compareItem : SItemUniqueId;
itemName = _inv.GetItemName(item);
UpdateTooltipCompareData(item, compareItem, _inv, tooltipName);
/* NOP */;
}
}
class CR4RyanAlchemyMenu extends CR4Menu{
private const var KEY_RECIPE_LIST : String;
private var m_flashValueStorage : CScriptedFlashValueStorage;
private var m_alchemyManager : W3AlchemyManager;
private var m_inventory : CInventoryComponent;
private var m_recipeList : array<SAlchemyRecipe>;
public function OnConfigUI() : Bool{
m_flashValueStorage = GetMenuFlashValueStorage();
m_inventory = thePlayer.inv;
PopulateData();
/* NOP */;
}
public function OnCloseMenu() : Bool{
CloseMenu();
/* NOP */;
}
public function OnBrew(_RecipeIndex : Int32) : Bool{
var l_recipe : SAlchemyRecipe;
l_recipe = m_recipeList[_RecipeIndex];
if (m_alchemyManager.CanCookRecipe(l_recipe.recipeName) == 0){
m_alchemyManager.CookItem(l_recipe.recipeName);
}
PopulateData();
/* NOP */;
}
private function PopulateData(){
var i : Int32;

var l_recipeFlashArray : CScriptedFlashArray;


var l_recipeDataFlashObject : CScriptedFlashObject;
var l_recipeName : String;
var l_recipeCanBeBrewed : Bool;
m_alchemyManager = new W3AlchemyManager in this;
m_alchemyManager.Init(/* NOP */);
m_recipeList = m_alchemyManager.GetRecipes(false);
l_recipeFlashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < m_recipeList.Size()){
l_recipeName = m_recipeList[i].recipeName;
l_recipeCanBeBrewed = m_alchemyManager.CanCookRecipe(m_r
ecipeList[i].recipeName) == 0;
l_recipeDataFlashObject = m_flashValueStorage.CreateTemp
FlashObject(/* NOP */);
l_recipeDataFlashObject.SetMemberFlashString("label", l_
recipeName);
l_recipeDataFlashObject.SetMemberFlashBool("canBeBrewed"
, l_recipeCanBeBrewed);
l_recipeFlashArray.SetElementFlashObject(i, l_recipeData
FlashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray(KEY_RECIPE_LIST, l_recipeFlash
Array);
/* NOP */;
}
}
class CR4PopupBase extends CR4Popup{
protected var m_flashValueStorage : CScriptedFlashValueStorage;
protected var m_flashModule : CScriptedFlashSprite;
protected var m_fxSetArabicAligmentMode : CScriptedFlashFunction;
protected var m_fxSwapAcceptCancel : CScriptedFlashFunction;
protected var m_fxSetControllerType : CScriptedFlashFunction;
protected var m_fxSetPlatform : CScriptedFlashFunction;
protected var m_fxSetGamepadType : CScriptedFlashFunction;
protected var m_fxLockControlScheme : CScriptedFlashFunction;
protected var m_guiManager : CR4GuiManager;
public function OnConfigUI() : Bool{
m_guiManager = theGame.GetGuiManager();
m_flashValueStorage = GetPopupFlashValueStorage();
m_flashModule = GetPopupFlash();
m_fxSetControllerType = m_flashModule.GetMemberFlashFunction("se
tControllerType");
m_fxSetPlatform = m_flashModule.GetMemberFlashFunction("setPlatf
orm");
m_fxSetArabicAligmentMode = m_flashModule.GetMemberFlashFunction
("setArabicAligmentMode");
m_fxSwapAcceptCancel = m_flashModule.GetMemberFlashFunction("swa
pAcceptCancel");
m_fxSetGamepadType = m_flashModule.GetMemberFlashFunction("setGa
mepadType");
m_fxLockControlScheme = m_flashModule.GetMemberFlashFunction("lo
ckControlScheme");
UpdateControlSchemeLock();
SetControllerType(theInput.LastUsedGamepad());
SetPlatformType(theGame.GetPlatform());
setArabicAligmentMode();
UpdateAcceptCancelSwaping();

/* NOP */;
}
public function OnClosingPopup() : Bool{
var initData : IScriptable;
initData = GetPopupInitData();
if (initData){
delete initData;
}
/* NOP */;
}
public function UpdateAcceptCancelSwaping(){
var inGameConfigWrapper : CInGameConfigWrapper;
var configValue : Bool;
if (m_fxSwapAcceptCancel){
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
configValue = inGameConfigWrapper.GetVarValue('Controls'
, 'SwapAcceptCancel');
m_fxSwapAcceptCancel.InvokeSelfOneArg(FlashArgBool(confi
gValue));
}
/* NOP */;
}
protected function UpdateControlSchemeLock(){
if (m_fxLockControlScheme && m_guiManager){
m_fxLockControlScheme.InvokeSelfOneArg(FlashArgUInt(m_gu
iManager.GetLockedControlScheme()));
}
/* NOP */;
}
protected function SetControllerType(isGamepad : Bool){
if (m_fxSetControllerType){
m_fxSetControllerType.InvokeSelfOneArg(FlashArgBool(isGa
mepad));
}
/* NOP */;
}
protected function SetPlatformType(platformType : Platform){
if (m_fxSetPlatform){
m_fxSetPlatform.InvokeSelfOneArg(FlashArgInt(platformTyp
e));
}
/* NOP */;
}
public function setArabicAligmentMode(){
var language : String;
var audioLanguage : String;
theGame.GetGameLanguageName(audioLanguage, language);
if (m_fxSetArabicAligmentMode){
m_fxSetArabicAligmentMode.InvokeSelfOneArg(FlashArgBool(
language == "AR"));
}
/* NOP */;
}
public function OnPlaySoundEvent(soundName : String) : Bool{
theSound.SoundEvent(soundName);
/* NOP */;
}
}
class W3MonsterHuntNPC extends CNewNPC{

public const var MONSTER_HUNT_TARGET_TAG : CName;


private var bossBarOn : Bool;
public saved var musicOn : Bool;
public editable var displayBossBar : Bool;
public editable saved var switchMusic : Bool;
public editable saved var questFocusSoundOnSpawn : Bool;
public editable var dontTagForAchievement : Bool;
public editable var disableDismemberment : Bool;
public editable var combatMusicStartEvent : String;
public editable var combatMusicStopEvent : String;
public editable var associatedInvestigationAreasTag : CName;
public saved var investigationAreasProcessed : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tags : array<CName>;
super.OnSpawned(spawnData);
if (theGame.IsActive()){
tags = GetTags();
if (!HasTag(MONSTER_HUNT_TARGET_TAG) && !dontTagForAchie
vement){
tags.PushBack(MONSTER_HUNT_TARGET_TAG);
}
if (!HasTag('HideHealthBarModule') && displayBossBar){
tags.PushBack('HideHealthBarModule');
}
SetTags(tags);
}
AddTimer('MonsterHuntNPCBossBarTimer', 0.500000, true, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
if (questFocusSoundOnSpawn){
SetFocusModeSoundEffectType(1);
}
if (disableDismemberment){
if (!HasAbility('DisableDismemberment')){
AddAbility('DisableDismemberment', false);
}
}
/* NOP */;
}
public function OnDestroyed() : Bool{
super.OnDestroyed();
ShowMonsterHuntBossFightIndicator(false);
SwitchMonsterHuntCombatMusic(false);
RemoveTimer('MonsterHuntNPCBossBarTimer', /* NOP */);
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
super.OnDeath(damageAction);
ShowMonsterHuntBossFightIndicator(false);
SwitchMonsterHuntCombatMusic(false);
RemoveTimer('MonsterHuntNPCBossBarTimer', /* NOP */);
/* NOP */;
}
public timer function MonsterHuntNPCBossBarTimer(optional delta : Float,
optional id : Int32){
if (IfCanSeePlayer() || thePlayer.GetDisplayTarget() == this &&
!bossBarOn){
if (GetAttitudeBetween(thePlayer, this) == 2){
if (displayBossBar){
ShowMonsterHuntBossFightIndicator(true);
}

SwitchAssociatedInvestigationAreas(false);
SwitchMonsterHuntCombatMusic(true);
}
} else if (VecDistance(GetWorldPosition(), thePlayer.GetWorldPos
ition()) >= 45.000000 || GetAttitudeBetween(thePlayer, this) != 2){
if (displayBossBar){
ShowMonsterHuntBossFightIndicator(false);
}
SwitchMonsterHuntCombatMusic(false);
}
/* NOP */;
}
private function ShowMonsterHuntBossFightIndicator(enable : Bool){
var hud : CR4ScriptedHud;
var bossFocusModule : CR4HudModuleBossFocus;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
bossFocusModule = (CR4HudModuleBossFocus)hud.GetHudModul
e("BossFocusModule");
if (bossFocusModule){
if (enable && !bossBarOn){
bossFocusModule.ShowBossIndicator(true,
'None', this);
bossBarOn = true;
return;
} else if (!enable && bossBarOn){
bossFocusModule.ShowBossIndicator(false,
'None', /* NOP */);
bossBarOn = false;
}
}
}
/* NOP */;
}
public function SwitchMonsterHuntCombatMusic(enable : Bool){
if (!switchMusic){
return;
}
if (enable){
theSound.SoundEvent(combatMusicStartEvent);
musicOn = true;
} else if (musicOn){
theSound.SoundEvent(combatMusicStopEvent);
musicOn = false;
}
/* NOP */;
}
public function GetIsBossbarOn() : Bool{
return bossBarOn;
/* NOP */;
}
private function SwitchAssociatedInvestigationAreas(enable : Bool){
var entitesList : array<CEntity>;
var area : W3MonsterHuntInvestigationArea;
var i : Int32;
if (!IsNameValid(associatedInvestigationAreasTag) || investigati
onAreasProcessed){
return;
}
theGame.GetEntitiesByTag(associatedInvestigationAreasTag, entite

sList);
i = 0;
while (i < entitesList.Size()){
area = (W3MonsterHuntInvestigationArea)entitesList[i];
if (area){
area.SetInvestigationAreaEnabled(enable, true);
}
i += 1;
}
investigationAreasProcessed = true;
/* NOP */;
}
}
import abstract class ICustomCameraCollisionController{
}
class W3NonPlayerAbilityManager extends W3AbilityManager{
private var weatherBonuses : array<SWeatherBonus>;
public function Init(ownr : CActor, cStats : CCharacterStats, isFromLoad
: Bool, diff : EDifficultyMode) : Bool{
var ret : Bool;
var i : Int32;
var npc : CNewNPC;
if (!ownr){
LogAssert(false, "W3NonPlayerAbilityManager.Init: owner
is NULL!!!!");
return false;
}
npc = (CNewNPC)ownr;
if (!npc){
LogAssert(false, "W3NonPlayerAbilityManager.Init: owner
is not an NPC!!!!");
return false;
}
ownr.AddAbility(theGame.params.GLOBAL_ENEMY_ABILITY, /* NOP */);
weatherBonuses.Clear();
if (!isFromLoad){
npc.AddTimer('AddLevelBonuses', 0.100000, true, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
ret = super.Init(ownr, cStats, isFromLoad, diff);
if (!ret){
return false;
}
InitSkills();
InitWeatherBonuses();
isInitialized = true;
return true;
/* NOP */;
}
public function PostInit(){
}
protected function OnVitalityChanged(){
}
protected function OnToxicityChanged(){
}
protected function OnFocusChanged(){
}
protected function OnAirChanged(){

}
private function InitWeatherBonuses(){
var dm : CDefinitionsManagerAccessor;
var abs : array<CName>;
var atts : array<CName>;
var i : Int32;
var j : Int32;
var abilityTags : array<CName>;
var bonus : SWeatherBonus;
abs = owner.GetAbilities(false);
dm = theGame.GetDefinitionsManager();
dm.GetUniqueContainedAbilities(abs, atts);
i = 0;
while (i < atts.Size()){
if (StrBeginsWith(NameToString(atts[i]), "WeatherBonusEf
fect")){
dm.GetAbilityTags(atts[i], abilityTags);
j = 0;
while (j < abilityTags.Size()){
switch(abilityTags[j]){
case 'Dawn':
bonus.dayPart = 1;
break;
case 'Noon':
bonus.dayPart = 2;
break;
case 'Dusk':
bonus.dayPart = 3;
break;
case 'Midnight':
bonus.dayPart = 4;
break;
case 'Clear':
bonus.weather = 0;
break;
case 'Rain':
bonus.weather = 1;
break;
case 'Snow':
bonus.weather = 2;
break;
case 'AnyWeather':
bonus.weather = 5;
break;
case 'FullMoon':
bonus.moonState = 1;
break;
case 'RedMoon':
bonus.moonState = 2;
break;
case 'NoMoon':
bonus.moonState = 0;
break;
case 'AnyMoon':
bonus.moonState = 3;
break;
default:
break;
}
j += 1;

}
bonus.ability = atts[i];
weatherBonuses.PushBack(bonus);
}
i += 1;
}
if (weatherBonuses.Size() > 0){
owner.AddTimer('WeatherBonusCheck', 5, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function GetWeatherBonus(dayPart : EDayPart, weather : EWeatherEf
fect, moonState : EMoonState) : CName{
var i : Int32;
var bonus : SWeatherBonus;
i = 0;
while (i < weatherBonuses.Size()){
bonus = weatherBonuses[i];
if (bonus.dayPart == dayPart && bonus.weather == weather
|| bonus.weather == 5 && bonus.moonState == moonState || bonus.moonState == 3){
return bonus.ability;
}
i += 1;
}
return 'None';
/* NOP */;
}
private function InitSkills(){
var atts : array<CName>;
var i : Int32;
var size : Int32;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
charStats.GetAllContainedAbilities(atts);
size = atts.Size();
i = 0;
while (i < size){
if (!IsBasicAttack(atts[i]) && !dm.AbilityHasTag(atts[i]
, theGame.params.DIFFICULTY_TAG_DIFF_ABILITY) && !dm.AbilityHasTag(atts[i], theG
ame.params.NOT_A_SKILL_ABILITY_TAG)){
charStats.AddAbility(atts[i], /* NOP */);
}
i += 1;
}
/* NOP */;
}
protected function GetAttributeValueInternal(attributeName : CName, tags
: array<CName>) : SAbilityAttributeValue{
var ret : SAbilityAttributeValue;
var i : Int32;
ret = super.GetAttributeValueInternal(attributeName, tags);
i = 0;
while (i < blockedAbilities.Size()){
if (charStats.HasAbility(blockedAbilities[i].abilityName
, /* NOP */)){
ret -= charStats.GetAbilityAttributeValue(attrib
uteName, blockedAbilities[i].abilityName);
}
i += 1;

}
return ret;
/* NOP */;
}
}
class W3TripwireSwitch extends W3PhysicalSwitch{
protected editable var autoSwitchOnLeave : Bool;
protected var entities : array<CEntity>;
protected var delayedTurnOffEntity : CEntity;
protected var delayedTurnOnEntity : CEntity;
protected editable var connectedTrapClueTag : CName;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var entity : CEntity;
entity = activator.GetEntity();
if (!entities.Contains(entity)){
entities.PushBack(entity);
}
/* NOP */;
TurnOnIfPossible(entity);
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var entity : CEntity;
entity = activator.GetEntity();
entities.Remove(entity);
/* NOP */;
TurnOffIfPossible(entity);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
var entity : CEntity;
entity = thePlayer;
if (!entities.Contains(entity)){
entities.PushBack(entity);
}
/* NOP */;
TurnOnIfPossible(entity);
entities.Remove(entity);
/* NOP */;
TurnOffIfPossible(entity);
/* NOP */;
}
public timer function OnCheckInventoryEntities(optional delta : Float, o
ptional id : Int32){
var i : Int32;
var size : Int32;
var entity : CEntity;
var inventory : CInventoryComponent;
size = entities.Size();
i = 0;
while (i < size){
entity = entities[i];
if ((W3ActorRemains)entity){
inventory = (CInventoryComponent)entity.GetCompo
nentByClassName('CInventoryComponent');
if (inventory){
if (inventory.IsEmpty(/* NOP */)){

entities.Remove(entity);
TurnOffIfPossible(NULL);
}
}
} else {
i += 1;
}
/* NOP */;
}
/* NOP */;
}
public function TurnOnIfPossible(entity : CEntity){
var connectedTrapClue : CEntity;
if (IsAvailable()){
if (IsOff()){
/* NOP */;
Turn(true, (CActor)entity, false, false);
PlayEffect('trap_sprung', /* NOP */);
ApplyAppearance('sprung');
connectedTrapClue = theGame.GetEntityByTag(conne
ctedTrapClueTag);
if (connectedTrapClue){
connectedTrapClue.Destroy();
}
AddTimer('OnCheckInventoryEntities', 0.200000, t
rue, /* NOP */, /* NOP */, true, /* NOP */);
RemoveTimer('OnDelayedTurnOff', /* NOP */);
RemoveTimer('OnDelayedTurnOn', /* NOP */);
} else if (IsSwitchingOff()){
/* NOP */;
delayedTurnOnEntity = entity;
AddTimer('OnDelayedTurnOn', 0.200000, /* NOP */,
/* NOP */, /* NOP */, true, /* NOP */);
}
}
/* NOP */;
}
public function TurnOffIfPossible(entity : CEntity){
if (entities.Size() == 0 && autoSwitchOnLeave && IsAvailable()){
if (IsOn()){
/* NOP */;
Turn(false, (CActor)entity, false, false);
RemoveTimer('OnCheckInventoryEntities', /* NOP *
/);
RemoveTimer('OnDelayedTurnOff', /* NOP */);
RemoveTimer('OnDelayedTurnOn', /* NOP */);
} else if (IsSwitchingOn()){
/* NOP */;
delayedTurnOffEntity = entity;
AddTimer('OnDelayedTurnOff', 0.200000, /* NOP */
, /* NOP */, /* NOP */, true, /* NOP */);
}
}
/* NOP */;
}
public timer function OnDelayedTurnOn(optional delta : Float, optional i
d : Int32){
/* NOP */;
TurnOnIfPossible(delayedTurnOnEntity);
/* NOP */;

}
public timer function OnDelayedTurnOff(optional delta : Float, optional
id : Int32){
/* NOP */;
TurnOffIfPossible(delayedTurnOffEntity);
/* NOP */;
}
public function Disarm(){
Enable(false);
ApplyAppearance('sprung');
/* NOP */;
}
}
statemachine class W3IgniEntity extends W3SignEntity{
private var collisionFxEntity : CEntity;
private var rangeFxEntity : CEntity;
private var channelBurnTestDT : array<SIgniChannelDT>;
private var lastCollisionFxPos : Vector;
private const var CHANNELLING_BURN_TEST_FREQUENCY : Float;
public editable var aspects : array<SIgniAspect>;
public editable var effects : array<SIgniEffects>;
private var forestTrigger : W3ForestTrigger;
public var projectileCollision : array<CName>;
public var hitEntities : array<CGameplayEntity>;
public var lastFxSpawnTime : Float;
public function GetSignType() : ESignType{
return 2;
/* NOP */;
}
public function OnStarted() : Bool{
var player : CR4Player;
Attach(true, /* NOP */);
channelBurnTestDT.Clear();
player = (CR4Player)owner.GetActor();
if (player){
GetWitcherPlayer().FailFundamentalsFirstAchievementCondi
tion();
player.AddTimer('ResetPadBacklightColorTimer', 2, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
projectileCollision.Clear();
projectileCollision.PushBack('Projectile');
projectileCollision.PushBack('Door');
projectileCollision.PushBack('Static');
projectileCollision.PushBack('Character');
projectileCollision.PushBack('Terrain');
projectileCollision.PushBack('Ragdoll');
projectileCollision.PushBack('Destructible');
projectileCollision.PushBack('RigidBody');
projectileCollision.PushBack('Dangles');
projectileCollision.PushBack('Water');
projectileCollision.PushBack('Projectile');
projectileCollision.PushBack('Foliage');
projectileCollision.PushBack('Boat');
projectileCollision.PushBack('BoatDocking');
projectileCollision.PushBack('Platforms');
projectileCollision.PushBack('Corpse');
projectileCollision.PushBack('ParticleCollider');
if (owner.ChangeAspect(this, 38)){

CacheActionBuffsFromSkill();
GotoState('IgniChanneled', /* NOP */, /* NOP */);
} else {
GotoState('IgniCast', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function UpdateBurningChance(actor : CActor, dt : Float) : Bool{
var i : Int32;
var j : Int32;
var temp : SIgniChannelDT;
if (!actor){
return false;
}
i = -1;
j = 0;
while (j < channelBurnTestDT.Size()){
if (channelBurnTestDT[j].actor == actor){
i = j;
break;
}
j += 1;
}
if (i >= 0){
channelBurnTestDT[i].dtSinceLastTest += dt;
} else {
temp.actor = actor;
temp.dtSinceLastTest = dt;
channelBurnTestDT.PushBack(temp);
i = channelBurnTestDT.Size() - 1;
}
if (channelBurnTestDT[i].dtSinceLastTest >= CHANNELLING_BURN_TES
T_FREQUENCY){
channelBurnTestDT[i].dtSinceLastTest -= CHANNELLING_BURN
_TEST_FREQUENCY;
return true;
}
return false;
/* NOP */;
}
protected function InitThrown(){
var entity : CEntity;
entity = theGame.GetEntityByTag('forest');
if (entity){
forestTrigger = (W3ForestTrigger)entity;
}
if (false){
PlayEffect(effects[fireMode].upgradedThrowEffect, /* NOP
*/);
} else if (!IsAlternateCast() && owner.CanUseSkill(43)){
PlayEffect(effects[0].throwEffectSpellPower, /* NOP */);
} else {
PlayEffect(effects[fireMode].throwEffect, /* NOP */);
}
if (!IsAlternateCast()){
if (owner.CanUseSkill(44)){
PlayEffect(effects[0].meltArmorEffect, /* NOP */
);
}
if (owner.CanUseSkill(45)){

PlayEffect(effects[0].combustibleEffect, /* NOP
*/);
}
}
if (owner.IsPlayer() && forestTrigger && forestTrigger.IsPlayerI
nForest()){
PlayEffect(effects[fireMode].forestEffect, /* NOP */);
}
/* NOP */;
}
public function BroadcastSignCast_Override(){
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'FireDanger', 5, 8.000000, -1.000000, -1, true, true, /* NOP */);
/* NOP */;
}
public function ShowChannelingCollisionFx(pos : Vector, rot : EulerAngle
s, normall : Vector){
var collisionFxTemplate : CEntityTemplate;
var coll : Vector;
var normal : Vector;
if (VecDistance(lastCollisionFxPos, pos) > 0.350000){
lastCollisionFxPos = pos;
if (theGame.GetWorld().StaticTrace(GetWorldPosition(), p
os, coll, normal, /* NOP */)){
pos = coll;
}
pos = pos + normall * 0.100000;
if (!collisionFxEntity){
collisionFxTemplate = (CEntityTemplate)LoadResou
rce("gameplay\sign\igni_channeling_collision_fx", /* NOP */);
collisionFxEntity = theGame.CreateEntity(collisi
onFxTemplate, pos, rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
collisionFxEntity.TeleportWithRotation(pos, rot)
;
}
}
AddTimer('CollisionFXTimedOutDestroy', 0.300000, /* NOP */, /* N
OP */, /* NOP */, true, /* NOP */);
/* NOP */;
}
public function ShowChannelingRangeFx(pos : Vector, rot : EulerAngles){
var rangeFxTemplate : CEntityTemplate;
if (!rangeFxEntity){
rangeFxTemplate = (CEntityTemplate)LoadResource("gamepla
y\sign\igni_channeling_range_fx", /* NOP */);
rangeFxEntity = theGame.CreateEntity(rangeFxTemplate, po
s, rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
rangeFxEntity.TeleportWithRotation(pos, rot);
}
AddTimer('RangeFXTimedOutDestroy', 0.100000, /* NOP */, /* NOP *
/, /* NOP */, true, /* NOP */);
/* NOP */;
}
protected function CleanUp(){
hitEntities.Clear();
super.CleanUp();
/* NOP */;
}

public timer function CollisionFXTimedOutDestroy(optional dt : Float, op


tional id : Int32){
if (collisionFxEntity){
collisionFxEntity.AddTimer('TimerStopVisualFX', 0.001000
, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public timer function RangeFXTimedOutDestroy(optional dt : Float, option
al id : Int32){
if (rangeFxEntity){
rangeFxEntity.AddTimer('TimerStopVisualFX', 0.001000, /*
NOP */, /* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
}
import abstract class SCameraDistanceInfo{
}
class W3FactionReputationPoints extends CObject{
public saved var currentReputationPoints : Int32;
public saved var negativeReputationPoints : Int32;
}
import struct CWayPointComponent{
}
import abstract class SMapPinType{
}
import abstract class ISkeletalAnimationImporter{
}
import abstract class ISkeletalAnimationExporter{
}
statemachine class W3POIDispenser extends CGameplayEntity{
public editable var pointsTag : CName;
public editable var onExitDespawnAllAfter : Int32;
public editable var shouldUseRandomRespawnTime : Bool;
public editable var respawnInterval : Float;
public editable var poiEntity : W3POIEntities;
public var spawnedPOIs : array<W3PointOfInterestEntity>;
public var activatorArea : CTriggerAreaComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
activatorArea = (CTriggerAreaComponent)GetComponentByClassName('
CTriggerAreaComponent');
if (IsPlayerNear()){
ActivateFoodDispenser(true);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (area == activatorArea && IsDispenserAvailable()){
ActivateFoodDispenser(true);
}

/* NOP */;
}
public function OnAreaExtit(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
ActivateFoodDispenser(false);
/* NOP */;
}
public function IsDispenserAvailable() : Bool{
var allPoints : array<CNode>;
allPoints = GetPOISpawnPoints();
if (pointsTag != 'None' && allPoints.Size() > 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function GetPOISpawnPoints() : array<CNode>{
var points : array<CNode>;
theGame.GetNodesByTag(pointsTag, points);
return points;
/* NOP */;
}
public function GetPointToActive() : CNode{
var allPoints : array<CNode>;
var i : Int32;
allPoints = GetPOISpawnPoints();
i = RandRange(allPoints.Size(), /* NOP */);
return allPoints[i];
/* NOP */;
}
public function GetEntitySpawnPos(selectedPoint : CNode) : Vector{
var local2world : Matrix;
var offset : Vector;
var entSpawnPos : Vector;
var terrainHeight : Float;
local2world = selectedPoint.GetLocalToWorld();
offset = Vector(RandRangeF(1.500000, -1.500000), RandRangeF(1.50
0000, -1.500000), 0.000000);
entSpawnPos = VecTransform(local2world, offset);
terrainHeight = entSpawnPos.Z;
theGame.GetWorld().NavigationComputeZ(selectedPoint.GetWorldPosi
tion(), terrainHeight - 2.000000, terrainHeight + 2.000000, terrainHeight);
entSpawnPos.Z = terrainHeight + 0.050000;
return entSpawnPos;
/* NOP */;
}
public function GetRespawnInterval() : Float{
if (respawnInterval < 5){
return respawnInterval;
} else {
return 10.000000;
}
/* NOP */;
}
public function SpawnPOI(){
var i : Int32;
var entSpawnPoint : CNode;
var spawnedFoodEntity : W3PointOfInterestEntity;
entSpawnPoint = GetPointToActive();

if (spawnedPOIs.Size() <= poiEntity.maxSpawnedEntities){


i = spawnedPOIs.Size();
while (i < poiEntity.maxSpawnedEntities){
spawnedFoodEntity = (W3PointOfInterestEntity)the
Game.CreateEntity(poiEntity.poiEntityTemplate, GetEntitySpawnPos(entSpawnPoint),
/* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
spawnedFoodEntity.AssignDispenser(this);
spawnedPOIs.PushBack(spawnedFoodEntity);
i += 1;
}
}
/* NOP */;
}
public timer function RespawnPOI(optional deltaTime : Float, optional id
: Int32){
SpawnPOI();
/* NOP */;
}
public function DespawnPOI(entity : W3PointOfInterestEntity){
var i : Int32;
i = spawnedPOIs.Size() - 1;
while (i >= 0){
if (entity == spawnedPOIs[i]){
spawnedPOIs.Erase(i);
if (entity){
entity.Destroy();
}
}
i -= 1;
}
/* NOP */;
}
public function DeactivatePOI(entity : W3PointOfInterestEntity){
var i : Int32;
i = 0;
while (i < spawnedPOIs.Size()){
if (entity == spawnedPOIs[i]){
entity.GetComponentByClassName('CFoodBoidPointOf
Interest').SetEnabled(false);
}
i += 1;
}
/* NOP */;
}
public timer function DespawnAllPOIs(optional deltaTime : Float, optiona
l id : Int32){
var i : Int32;
i = spawnedPOIs.Size() - 1;
while (i >= 0){
spawnedPOIs[i].Destroy();
spawnedPOIs.Erase(i);
i -= 1;
}
/* NOP */;
}
public function IsPlayerNear() : Bool{
var dispenserArea : CAreaComponent;
dispenserArea = activatorArea;
return dispenserArea.TestEntityOverlap(thePlayer);
/* NOP */;

}
public function ActivateFoodDispenser(isOn : Bool){
if (isOn){
PushState('Active');
} else {
PopState(true);
}
/* NOP */;
}
}
class W3PointOfInterestEntity extends CGameplayEntity{
public editable var toDestroy : Bool;
public var assignedDispenser : W3POIDispenser;
public function AssignDispenser(activator : W3POIDispenser){
assignedDispenser = activator;
/* NOP */;
}
public function GetDispenser() : W3POIDispenser{
return assignedDispenser;
/* NOP */;
}
public function CanBeDestroyed() : Bool{
return toDestroy;
/* NOP */;
}
}
import struct CBoidPointOfInterestComponent{
import public function Disable(disable : Bool);
}
import abstract class CExtAnimCutsceneHideTerrainEvent{
}
class W3FlyingSwarmStateChangeRequest extends CObject{
public var groupId : CFlyingGroupId;
public var stateName : CName;
public function Init(id : CFlyingGroupId, newState : CName){
groupId = id;
stateName = newState;
/* NOP */;
}
}
class W3FlyingSwarmCreateGroupRequest extends CObject{
public var boidCount : Int32;
public var spawnPOI : CName;
public function Init(inBoidCount : Int32, inSpawnPOI : CName){
boidCount = inBoidCount;
spawnPOI = inSpawnPOI;
/* NOP */;
}
}
class GotoRequest extends CObject{
public var groupId : CFlyingGroupId;
public var groupState : CName;
public var groupStateSetOnArrival : CName;
public var targetPoiComponent : CBoidPointOfInterestComponent;

public
public
public
public
public
public
public

var
var
var
var
var
var
var

targetNode : CNode;
delay : Float;
delayTimer : Float;
factID : String;
factValue : Int32;
groupCenterWhenStart : Vector;
init : Bool;

}
import abstract class SStaticMapPin{
}
import struct CScriptedAction{
public function Perform(parnt : CEntity){
LogAssert(false, "CScriptedAction::Perform() not implemented");
/* NOP */;
}
public function PerformArgNode(parnt : CEntity, node : CNode){
Perform(parnt);
/* NOP */;
}
public function PerformArgFloat(parnt : CEntity, value : Float){
Perform(parnt);
/* NOP */;
}
}
class W3Rat extends CNewNPC{
public editable saved var hasCollision : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
SetInteractionPriority(0);
EnableCharacterCollisions(hasCollision);
/* NOP */;
}
public function OnChangeDyingInteractionPriorityIfNeeded() : Bool{
EnableCollisions(false);
/* NOP */;
}
}
state CR4PlayerStateUnconscious in CR4Player extends CR4PlayerStateExtendedMovab
le{
private const var duration : Float;
private var isUnconscious : Bool;
private var killedByGuard : Bool;
private var killedByElevator : Bool;
private var wasInFFMiniGame : Bool;
private var m_storedInteractionPri : EInteractionPriority;
private var cachedID : SItemUniqueId;
private var itemEnt1 : CEntity;
private var itemEnt2 : CEntity;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.BlockAllActions('PlayerUnconscious', true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
wasInFFMiniGame = parent.IsFistFightMinigameEnabled();
SetIsUnconscious(true);
CacheSwordInHand();
ChangeInteractionPriority();

ProcessUncounscious();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
theGame.FadeInAsync(/* NOP */);
parent.BlockAllActions('PlayerUnconscious', false, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
SetIsUnconscious(false);
parent.SetBehaviorVariable('unconsciousEnd', 0, /* NOP */);
killedByGuard = false;
killedByElevator = false;
wasInFFMiniGame = false;
ResetInteractionPriority();
parent.Revive();
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
if (killedByGuard){
moveData.pivotRotationController.SetDesiredHeading(paren
t.GetHeading() * -1, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-45, /*
NOP */);
}
/* NOP */;
}
public entry function ProcessUncounscious(){
parent.RaiseForceEvent('Unconscious');
if (killedByGuard){
Sleep(1.000000);
theGame.FadeOutAsync(1.500000, /* NOP */);
Sleep(1.500000);
HideWeapon();
TakeMoneyFromPlayer();
TimeFlow();
RestoreSword();
theGame.FadeIn(1.500000);
Sleep(1.500000);
DisplayMessage();
} else if (killedByElevator){
Sleep(1.000000);
theGame.FadeOutAsync(1.500000, /* NOP */);
Sleep(1.500000);
HideWeapon();
TeleportAwayFromElevator();
TimeFlow();
RestoreSword();
theGame.FadeIn(1.500000);
Sleep(1.500000);
} else if (wasInFFMiniGame){
Sleep(1.000000);
theGame.FadeOut(1.500000, /* NOP */);
HideWeapon();
parent.RaiseForceEvent('ForceIdle');
Sleep(1.500000);
parent.GotoStateAuto();
} else {

Sleep(0.500000);
theGame.FadeOut(1.500000, /* NOP */);
HideWeapon();
theGame.FadeInAsync(1.500000);
}
parent.SetBehaviorVariable('unconsciousEnd', 1, /* NOP */);
Sleep(9.000000);
parent.GotoStateAuto();
/* NOP */;
}
public latent function HideWeapon(){
thePlayer.SetRequiredItems('Any', 'None');
thePlayer.ProcessRequiredItems(true);
parent.OnForcedHolsterWeapon();
/* NOP */;
}
public latent function TimeFlow(){
var storedHoursPerMinute : Float;
var fastForward : CGameFastForwardSystem;
storedHoursPerMinute = theGame.GetHoursPerMinute();
fastForward = theGame.GetFastForwardSystem();
fastForward.BeginFastForward(/* NOP */, /* NOP */);
theGame.SetHoursPerMinute(10 * duration);
Sleep(duration);
fastForward.AllowFastForwardSelfCompletion();
theGame.SetHoursPerMinute(storedHoursPerMinute);
/* NOP */;
}
public function ChangeInteractionPriority(){
if (parent.GetInteractionPriority() != -2){
m_storedInteractionPri = parent.GetInteractionPriority()
;
parent.SetInteractionPriority(-2);
}
/* NOP */;
}
public function ResetInteractionPriority(){
if (m_storedInteractionPri != -1){
parent.SetInteractionPriority(m_storedInteractionPri);
}
m_storedInteractionPri = -1;
/* NOP */;
}
public function TakeMoneyFromPlayer(){
var amount : Float;
amount = thePlayer.GetMoney();
switch(theGame.GetDifficultyLevel()){
case 1:
amount *= 0.250000;
break;
case 2:
amount *= 0.500000;
break;
case 3:
amount *= 0.750000;
break;
case 4:
break;
default:
amount *= 0;

break;
}
thePlayer.RemoveMoney(amount);
/* NOP */;
}
public function RemoveArmor(){
var inv : CInventoryComponent;
var ids : array<SItemUniqueId>;
var id : SItemUniqueId;
var i : Int32;
inv = thePlayer.GetInventory();
if (inv.GetItemEquippedOnSlot(1, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(2, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(3, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(4, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(5, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(6, id)){
ids.PushBack(id);
}
if (inv.GetItemEquippedOnSlot(9, id)){
ids.PushBack(id);
}
i = 0;
while (i < ids.Size()){
GetWitcherPlayer().UnequipItem(ids[i]);
i += 1;
}
/* NOP */;
}
public function TeleportPlayerToNewPosition(){
var nodes : array<CNode>;
var currentPos : Vector;
var minDist : Float;
var dist : Float;
var selectedNode : Int32;
var i : Int32;
theGame.GetNodesByTag('player_guard_respawn', nodes);
if (nodes.Size() > 0){
currentPos = thePlayer.GetWorldPosition();
i = 0;
while (i < nodes.Size()){
dist = VecDistanceSquared(currentPos, nodes[i].G
etWorldPosition());
if (i == 0 || minDist > dist){
minDist = dist;
selectedNode = i;
}
i += 1;
}
if (selectedNode != -1){

thePlayer.TeleportToNode(nodes[selectedNode], tr
ue);
}
}
/* NOP */;
}
public function TeleportAwayFromElevator(){
var node : CNode;
var selectedNode : Int32;
theGame.GetNodeByTag('player_elevator_respawn');
if (node){
thePlayer.TeleportToNode(node, true);
}
/* NOP */;
}
public function CacheSwordInHand(){
var inv : CInventoryComponent;
var idLWeapon : SItemUniqueId;
inv = thePlayer.GetInventory();
cachedID = inv.GetItemFromSlot('r_weapon');
itemEnt1 = parent.inv.GetItemEntityUnsafe(cachedID);
idLWeapon = inv.GetItemFromSlot('l_weapon');
if (parent.inv.IsIdValid(idLWeapon) && !parent.inv.IsItemCrossbo
w(idLWeapon)){
itemEnt2 = parent.inv.GetItemEntityUnsafe(idLWeapon);
}
/* NOP */;
}
public function RestoreSword(){
var inv : CInventoryComponent;
var category : CName;
var id : SItemUniqueId;
inv = thePlayer.GetInventory();
itemEnt1.Destroy();
itemEnt2.Destroy();
if (inv.IsIdValid(cachedID) && GetWitcherPlayer()){
category = inv.GetItemCategory(cachedID);
if (category == 'steelsword'){
if (!inv.GetItemEquippedOnSlot(2, id)){
GetWitcherPlayer().EquipItemInGivenSlot(
cachedID, 2, false, false);
} else {
GetWitcherPlayer().UnequipItem(cachedID)
;
GetWitcherPlayer().EquipItemInGivenSlot(
cachedID, 2, false, false);
}
} else if (category == 'silversword'){
if (!inv.GetItemEquippedOnSlot(1, id)){
GetWitcherPlayer().EquipItemInGivenSlot(
cachedID, 1, false, false);
} else {
GetWitcherPlayer().UnequipItem(cachedID)
;
GetWitcherPlayer().EquipItemInGivenSlot(
cachedID, 1, false, false);
}
}
}
/* NOP */;

}
public function DisplayMessage(){
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyExt("panel
_hud_message_guards_took_money"));
/* NOP */;
}
public function SetIsUnconscious(flag : Bool){
isUnconscious = flag;
if (isUnconscious){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(thePlayer, 'PlayerUnconsciousAction', -1.000000, 60.000000, -1, -1, tr
ue, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCheckUnconscious() : Bool{
return isUnconscious;
/* NOP */;
}
public function OnKilledByGuard() : Bool{
killedByGuard = true;
/* NOP */;
}
public function OnKilledByElevator() : Bool{
killedByElevator = true;
/* NOP */;
}
}
import abstract class CFlyingGroupId{
}
struct SMenuTab{
var MenuName : CName;
var MenuLabel : String;
var Visible : Bool;
var Enabled : Bool;
var Restricted : Bool;
var ParentMenu : CName;
var MenuState : CName;
}
import struct CJournalQuestObjective{
import public final function GetTitleStringId() : Int32;
import public final function GetWorld() : Int32;
import public final function GetCount() : Int32;
import public final function GetCounterType() : eQuestObjectiveType;
import public final function GetBookShortcut() : CName;
import public final function GetItemShortcut() : CName;
import public final function GetRecipeShortcut() : CName;
import public final function GetMonsterShortcut() : CJournalBase;
import public final function GetParentQuest() : CJournalQuest;
}
import struct CScriptedFlashSprite{
import public final function GetChildFlashSprite(memberName : String) :
CScriptedFlashSprite;
import public final function GetChildFlashTextField(memberName : String)
: CScriptedFlashTextField;
import public final function GotoAndPlayFrameNumber(frame : Int32);

import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import
import

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final
final

function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function
function

GotoAndPlayFrameLabel(frame : String);
GotoAndStopFrameNumber(frame : Int32);
GotoAndStopFrameLabel(frame : String);
GetAlpha() : Float;
GetRotation() : Float;
GetVisible() : Bool;
GetX() : Float;
GetY() : Float;
GetZ() : Float;
GetXRotation() : Float;
GetYRotation() : Float;
GetXScale() : Float;
GetYScale() : Float;
GetZScale() : Float;
SetAlpha(alpha : Float);
SetRotation(degrees : Float);
SetVisible(visible : Bool);
SetPosition(x : Float, y : Float);
SetScale(xscale : Float);
SetX(x : Float);
SetY(y : Float);
SetZ(z : Float);
SetXRotation(degrees : Float);
SetYRotation(degrees : Float);
SetXScale(xscale : Float);
SetYScale(yscale : Float);
SetZScale(zscale : Float);

}
import struct CScriptedFlashFunction{
import public final function InvokeSelf();
import public final function InvokeSelfOneArg(arg0 : SFlashArg);
import public final function InvokeSelfTwoArgs(arg0 : SFlashArg, arg1 :
SFlashArg);
import public final function InvokeSelfThreeArgs(arg0 : SFlashArg, arg1
: SFlashArg, arg2 : SFlashArg);
import public final function InvokeSelfFourArgs(arg0 : SFlashArg, arg1 :
SFlashArg, arg2 : SFlashArg, arg3 : SFlashArg);
import public final function InvokeSelfFiveArgs(arg0 : SFlashArg, arg1 :
SFlashArg, arg2 : SFlashArg, arg3 : SFlashArg, arg4 : SFlashArg);
import public final function InvokeSelfSixArgs(arg0 : SFlashArg, arg1 :
SFlashArg, arg2 : SFlashArg, arg3 : SFlashArg, arg4 : SFlashArg, arg5 : SFlashAr
g);
import public final function InvokeSelfSevenArgs(arg0 : SFlashArg, arg1
: SFlashArg, arg2 : SFlashArg, arg3 : SFlashArg, arg4 : SFlashArg, arg5 : SFlash
Arg, arg6 : SFlashArg);
import public final function InvokeSelfEightArgs(arg0 : SFlashArg, arg1
: SFlashArg, arg2 : SFlashArg, arg3 : SFlashArg, arg4 : SFlashArg, arg5 : SFlash
Arg, arg6 : SFlashArg, arg7 : SFlashArg);
}
import struct CScriptedFlashArray{
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
t;

ClearElements();
GetLength() : Int32;
SetLength(length : Int32);
GetElementFlashBool(index : Int32) : Bool;
GetElementFlashInt(index : Int32) : Int32;
GetElementFlashUInt(index : Int32) : Int32;
GetElementFlashNumber(index : Int32) : Floa

import public final function GetElementFlashString(index : Int32) : Stri


ng;
import public final
iptedFlashObject;
import public final
import public final
: CScriptedFlashObject);
import public final
: String);
import public final
Bool);
import public final
nt32);
import public final
Int32);
import public final
: Float);
import public final
bject);
import public final
import public final
import public final
import public final
import public final
import public final
import public final
);
}

function GetElementFlashObject(index : Int32) : CScr


function PopBack();
function SetElementFlashObject(index : Int32, value
function SetElementFlashString(index : Int32, value
function SetElementFlashBool(index : Int32, value :
function SetElementFlashInt(index : Int32, value : I
function SetElementFlashUInt(index : Int32, value :
function SetElementFlashNumber(index : Int32, value
function PushBackFlashObject(value : CScriptedFlashO
function
function
function
function
function
function
function

PushBackFlashString(value : String);
PushBackFlashBool(value : Bool);
PushBackFlashInt(value : Int32);
PushBackFlashUInt(value : Int32);
PushBackFlashNumber(value : Float);
RemoveElement(index : Int32);
RemoveElements(index : Int32, count : Int32

struct SKeyBinding{
var ActionID : Int32;
var LocalizationKey : String;
var Gamepad_NavCode : String;
var Keyboard_KeyCode : Int32;
var Enabled : Bool;
var IsLocalized : Bool;
}
import struct CScriptedFlashObject{
import public final function
: CScriptedFlashObject;
import public final function
import public final function
CScriptedFlashObject;
import public final function
CScriptedFlashArray;
import public final function
: CScriptedFlashFunction;
import public final function
String;
import public final function
ool;
import public final function
t32;
import public final function
nt32;
import public final function
Float;
import public final function
alue : CScriptedFlashObject);

CreateFlashObject(flashClassName : String)
CreateFlashArray() : CScriptedFlashArray;
GetMemberFlashObject(memberName : String) :
GetMemberFlashArray(memberName : String) :
GetMemberFlashFunction(memberName : String)
GetMemberFlashString(memberName : String) :
GetMemberFlashBool(memberName : String) : B
GetMemberFlashInt(memberName : String) : In
GetMemberFlashUInt(memberName : String) : I
GetMemberFlashNumber(memberName : String) :
SetMemberFlashObject(memberName : String, v

import public final function


lue : CScriptedFlashArray);
import public final function
value : CScriptedFlashFunction);
import public final function
alue : String);
import public final function
ue : Bool);
import public final function
e : Int32);
import public final function
ue : Int32);
import public final function
alue : Float);
}

SetMemberFlashArray(memberName : String, va
SetMemberFlashFunction(memberName : String,
SetMemberFlashString(memberName : String, v
SetMemberFlashBool(memberName : String, val
SetMemberFlashInt(memberName : String, valu
SetMemberFlashUInt(memberName : String, val
SetMemberFlashNumber(memberName : String, v

class W3ContextManager extends CObject{


protected var m_currentContext : W3UIContext;
protected var m_commonMenuRef : CR4CommonMenu;
public function Init(targetCommonMenu : CR4CommonMenu){
m_commonMenuRef = targetCommonMenu;
/* NOP */;
}
public function ActivateContext(targetContext : W3UIContext){
m_currentContext = targetContext;
m_currentContext.Init(this);
updateInputFeedback();
/* NOP */;
}
public function HandleUserInput(navCode : String, actionId : Int32){
if (m_currentContext){
m_currentContext.HandleUserFeedback(navCode);
}
/* NOP */;
}
public function updateInputFeedback(){
var bindingsList : array<SKeyBinding>;
if (m_commonMenuRef && m_currentContext){
m_currentContext.GetButtonsList(bindingsList);
m_commonMenuRef.UpdateContextButtons(bindingsList, true)
;
}
/* NOP */;
}
}
class W3UIContext extends CObject{
protected var m_inputBindings : array<SKeyBinding>;
protected var m_contextBindings : array<SKeyBinding>;
protected var m_managerRef : W3ContextManager;
public function HandleUserFeedback(keyName : String){
}
public function Deactivate(){
m_inputBindings.Clear();
m_contextBindings.Clear();
m_managerRef.updateInputFeedback();
/* NOP */;
}
public function Init(ownerManager : W3ContextManager){
m_managerRef = ownerManager;

/* NOP */;
}
public function GetButtonsList(externalList : array<SKeyBinding>){
var i : Int32;
i = 0;
while (i < m_inputBindings.Size()){
externalList.PushBack(m_inputBindings[i]);
i += 1;
}
/* NOP */;
}
protected function AddInputBinding(label : String, padNavCode : String,
keyboardNavCode : Int32, useInContextMenu : Bool, IsLocalized : Bool){
var bindingDef : SKeyBinding;
bindingDef.Gamepad_NavCode = padNavCode;
bindingDef.Keyboard_KeyCode = keyboardNavCode;
bindingDef.LocalizationKey = label;
bindingDef.IsLocalized = IsLocalized;
m_inputBindings.PushBack(bindingDef);
if (useInContextMenu){
m_contextBindings.PushBack(bindingDef);
}
/* NOP */;
}
protected function IsPadBindingExist(padNavCode : String) : Bool{
var i : Int32;
var len : Int32;
len = m_contextBindings.Size();
i = 0;
while (i < len){
if (m_contextBindings[i].Gamepad_NavCode == padNavCode){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
}
import struct CScriptedFlashValueStorage{
import public final function SetFlashObject(key : String, value : CScrip
tedFlashObject, index : Int32);
import public final function SetFlashArray(key : String, value : CScript
edFlashArray);
import public final function SetFlashString(key : String, value : String
, index : Int32);
import public final function SetFlashBool(key : String, value : Bool, in
dex : Int32);
import public final function SetFlashInt(key : String, value : Int32, in
dex : Int32);
import public final function SetFlashUInt(key : String, value : Int32, i
ndex : Int32);
import public final function SetFlashNumber(key : String, value : Float,
index : Int32);
import public final function CreateTempFlashArray() : CScriptedFlashArra
y;
import public final function CreateTempFlashObject(flashClassName : Stri
ng) : CScriptedFlashObject;
}

import abstract class CHudModule{


import public final function GetModuleFlash() : CScriptedFlashSprite;
import public final function GetModuleFlashValueStorage() : CScriptedFla
shValueStorage;
}
import struct CScriptedFlashTextField{
import public final function GetText() : String;
import public final function GetTextHtml() : String;
import public final function SetText(text : String);
import public final function SetTextHtml(htmlText : String);
}
import struct IRiderActionTree{
}
class W3ContextMenu extends W3PopupData{
public var positionX : Float;
public var positionY : Float;
public var contextRef : W3UIContext;
public var actionsList : array<SKeyBinding>;
public var curActionNavCode : String;
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var l_flashResultObject : CScriptedFlashObject;
var bindingsCount : Int32;
var i : Int32;
l_flashArray = parentFlashValueStorage.CreateTempFlashArray();
bindingsCount = actionsList.Size();
i = 0;
while (i < bindingsCount){
l_flashObject = parentFlashValueStorage.CreateTempFlashO
bject(/* NOP */);
l_flashObject.SetMemberFlashString("label", GetLocString
ByKeyExt(actionsList[i].LocalizationKey));
l_flashObject.SetMemberFlashString("NavCode", actionsLis
t[i].Gamepad_NavCode);
l_flashObject.SetMemberFlashInt("ActionId", i);
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
l_flashResultObject = parentFlashValueStorage.CreateTempFlashObj
ect(/* NOP */);
l_flashResultObject.SetMemberFlashArray("ActionsList", l_flashAr
ray);
l_flashResultObject.SetMemberFlashNumber("positionX", positionX)
;
l_flashResultObject.SetMemberFlashNumber("positionY", positionY)
;
l_flashResultObject.SetMemberFlashString("ContentRef", GetConten
tRef());
return l_flashResultObject;
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
/* NOP */;
if (KeyCode == "escape-gamepad_B"){

ClosePopup();
} else if (KeyCode == "enter-gamepad_A"){
contextRef.HandleUserFeedback(curActionNavCode);
ClosePopup();
}
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_accept", "enter-gamepad_A", 13
);
AddButtonDef("panel_button_common_exit", "escape-gamepad_B", 27)
;
/* NOP */;
}
protected function GetContentRef() : String{
return "ContextMenuRef";
/* NOP */;
}
}
abstract class W3GuiBaseInventoryComponent extends CObject{
protected var _inv : CInventoryComponent;
protected var filteredItems : array<SItemUniqueId>;
private var ITEM_NEED_REPAIR_DISPLAY_VALUE : Int32;
public function Initialize(inv : CInventoryComponent){
ITEM_NEED_REPAIR_DISPLAY_VALUE = theGame.params.ITEM_DAMAGED_DUR
ABILITY;
_inv = inv;
/* NOP */;
}
protected function InvalidateItems(items : array<SItemUniqueId>){
}
public function GetInventoryComponent() : CInventoryComponent{
return _inv;
/* NOP */;
}
public function GetItemName(item : SItemUniqueId) : CName{
return _inv.GetItemName(item);
/* NOP */;
}
public function GiveItem(itemId : SItemUniqueId, customer : W3GuiBaseInv
entoryComponent, quantity : Int32, newItemID : SItemUniqueId) : Bool{
var invalidatedItems : array<SItemUniqueId>;
var success : Bool;
if (quantity < 1){
quantity = 1;
}
success = false;
if (customer.ReceiveItem(itemId, this, quantity, newItemID)){
success = true;
invalidatedItems.PushBack(itemId);
InvalidateItems(invalidatedItems);
}
return success;
/* NOP */;
}
public function ReceiveItem(itemId : SItemUniqueId, giver : W3GuiBaseInv
entoryComponent, quantity : Int32, newItemID : SItemUniqueId) : Bool{
var invalidatedItems : array<SItemUniqueId>;
var success : Bool;

success = false;
if (quantity < 1){
quantity = 1;
}
newItemID = giver._inv.GiveItemTo(_inv, itemId, quantity, true,
/* NOP */, /* NOP */);
if (newItemID != GetInvalidUniqueId()){
invalidatedItems.PushBack(newItemID);
InvalidateItems(invalidatedItems);
success = true;
}
return success;
/* NOP */;
}
public function CanDrop(item : SItemUniqueId) : Bool{
var canDrop : Bool;
canDrop = !_inv.ItemHasTag(item, 'NoDrop') && !_inv.ItemHasTag(i
tem, 'Quest');
if (canDrop && FactsQuerySum("tut_forced_preparation") > 0 && _i
nv.GetItemName(item) == 'Thunderbolt 1'){
canDrop = false;
}
return canDrop;
/* NOP */;
}
public function DropItem(item : SItemUniqueId, quantity : Int32){
var invalidatedItems : array<SItemUniqueId>;
if (CanDrop(item)){
_inv.DropItemInBag(item, quantity);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
}
/* NOP */;
}
public function ClearItemIsNewFlag(item : SItemUniqueId){
var invalidatedItems : array<SItemUniqueId>;
var uiData : SInventoryItemUIData;
uiData = _inv.GetInventoryItemUIData(item);
uiData.isNew = false;
_inv.SetInventoryItemUIData(item, uiData);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function GetInventoryFlashArray(flashArray : CScriptedFlashArray,
flashObject : CScriptedFlashObject){
var i : Int32;
var item : SItemUniqueId;
var rawItems : array<SItemUniqueId>;
var l_flashObject : CScriptedFlashObject;
_inv.GetAllItems(rawItems);
filteredItems.Clear();
i = 0;
while (i < rawItems.Size()){
item = rawItems[i];
if (ShouldShowItem(item)){
filteredItems.PushBack(item);
l_flashObject = flashObject.CreateFlashObject("r
ed.game.witcher3.menus.common.ItemDataStub");
SetInventoryFlashObjectForItem(item, l_flashObje

ct);
flashArray.PushBackFlashObject(l_flashObject);
}
i += 1;
}
/* NOP */;
}
public function HasNewFlagOnItem() : Bool{
var i : Int32;
var item : SItemUniqueId;
var rawItems : array<SItemUniqueId>;
var uiData : SInventoryItemUIData;
_inv.GetAllItems(rawItems);
filteredItems.Clear();
i = 0;
while (i < rawItems.Size()){
item = rawItems[i];
if (ShouldShowItem(item)){
uiData = _inv.GetInventoryItemUIData(item);
if (uiData.isNew){
return true;
break;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function ShouldShowItem(item : SItemUniqueId) : Bool{
var itemTags : array<CName>;
_inv.GetItemTags(item, itemTags);
if (itemTags.Contains(theGame.params.TAG_DONT_SHOW)){
return false;
}
if (_inv.GetItemName(item) == 'Crowns'){
return false;
}
if (_inv.GetEntity() == thePlayer && itemTags.Contains(theGame.p
arams.TAG_DONT_SHOW_ONLY_IN_PLAYERS)){
return false;
}
return true;
/* NOP */;
}
public function GetItemActionType(item : SItemUniqueId, bGetDefault : Bo
ol) : EInventoryActionType{
var actionType : EInventoryActionType;
var itemCategory : CName;
var tags : array<CName>;
var debugi : Int32;
actionType = 0;
itemCategory = _inv.GetItemCategory(item);
_inv.GetItemTags(item, tags);
if (tags.Contains('NoUse')){
actionType = 0;
} else if (tags.Contains('Weapon') || tags.Contains('Armor') ||
tags.Contains('QuickSlot') || tags.Contains('Potion') || tags.Contains('Petard')
|| tags.Contains('PlayerSilverWeapon') || tags.Contains('PlayerSteelWeapon') ||
tags.Contains('PlayerSecondaryWeapon') || tags.Contains('PlayerRangedWeapon') |

| tags.Contains('bolt')){
actionType = 1;
} else if (itemCategory == 'oil'){
if (tags.Contains(theGame.params.TAG_STEEL_OIL) && tags.
Contains(theGame.params.TAG_SILVER_OIL)){
actionType = 2;
} else if (tags.Contains(theGame.params.TAG_STEEL_OIL)){
actionType = 3;
} else if (tags.Contains(theGame.params.TAG_SILVER_OIL))
{
actionType = 4;
} else {
actionType = 2;
}
} else if (tags.Contains('Edibles') || tags.Contains('Drinks')){
actionType = 6;
} else if (tags.Contains('ReadableItem')){
actionType = 7;
} else if (tags.Contains('SingletonItem')){
actionType = 14;
}
if (actionType == 0){
/* NOP */;
debugi = 0;
while (debugi < tags.Size()){
/* NOP */;
debugi += 1;
}
/* NOP */;
}
return actionType;
/* NOP */;
}
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
var uiData : SInventoryItemUIData;
var slotType : EEquipmentSlots;
var curr : Float;
var max : Float;
var gridSize : Int32;
var equipped : Int32;
var canDrop : Bool;
var charges : String;
var cantEquip : Bool;
var quantity : Int32;
uiData = _inv.GetInventoryItemUIData(item);
slotType = GetItemEquippedSlot(item);
equipped = GetCurrentSlotForItem(item);
canDrop = !_inv.ItemHasTag(item, 'Quest') && !_inv.ItemHasTag(it
em, 'NoDrop');
if (slotType == 11){
slotType = 10;
}
flashObject.SetMemberFlashInt("id", ItemToFlashUInt(item));
if (!_inv.IsItemOil(item)){
if (_inv.IsItemSingletonItem(item)){
charges = thePlayer.inv.SingletonItemGetAmmo(ite
m) + "/" + thePlayer.inv.SingletonItemGetMaxAmmo(item);
flashObject.SetMemberFlashString("charges", char
ges);

quantity = 1;
flashObject.SetMemberFlashInt("quantity", quanti
ty);
} else {
quantity = _inv.GetItemQuantity(item);
flashObject.SetMemberFlashInt("quantity", quanti
ty);
}
}
flashObject.SetMemberFlashString("iconPath", _inv.GetItemIconPat
hByUniqueID(item));
flashObject.SetMemberFlashInt("gridPosition", uiData.gridPositio
n);
gridSize = Clamp(uiData.gridSize, 1, 2);
flashObject.SetMemberFlashInt("gridSize", gridSize);
flashObject.SetMemberFlashInt("slotType", slotType);
flashObject.SetMemberFlashBool("isNew", uiData.isNew);
flashObject.SetMemberFlashBool("isOilApplied", _inv.ItemHasOilAp
plied(item) && !_inv.IsItemOil(item));
flashObject.SetMemberFlashInt("equipped", equipped);
flashObject.SetMemberFlashInt("quality", _inv.GetItemQuality(ite
m));
flashObject.SetMemberFlashInt("socketsCount", _inv.GetItemEnhanc
ementSlotsCount(item));
flashObject.SetMemberFlashInt("socketsUsedCount", _inv.GetItemEn
hancementCount(item));
flashObject.SetMemberFlashInt("groupId", -1);
flashObject.SetMemberFlashBool("isSilverOil", _inv.ItemHasTag(it
em, 'SilverOil'));
flashObject.SetMemberFlashBool("isSteelOil", _inv.ItemHasTag(ite
m, 'SteelOil'));
flashObject.SetMemberFlashBool("isArmorUpgrade", _inv.ItemHasTag
(item, 'ArmorUpgrade'));
flashObject.SetMemberFlashBool("isWeaponUpgrade", _inv.ItemHasTa
g(item, 'WeaponUpgrade'));
flashObject.SetMemberFlashBool("isArmorRepairKit", _inv.ItemHasT
ag(item, 'ArmorReapairKit'));
flashObject.SetMemberFlashBool("isWeaponRepairKit", _inv.ItemHas
Tag(item, 'WeaponReapairKit'));
flashObject.SetMemberFlashBool("showExtendedTooltip", true);
if (_inv.HasItemDurability(item)){
curr = RoundMath(_inv.GetItemDurability(item) / _inv.Get
ItemMaxDurability(item) * 100);
if (curr <= ITEM_NEED_REPAIR_DISPLAY_VALUE){
flashObject.SetMemberFlashBool("needRepair", tru
e);
} else {
flashObject.SetMemberFlashBool("needRepair", fal
se);
}
} else {
flashObject.SetMemberFlashBool("needRepair", false);
}
if (thePlayer.IsInCombatAction() && IsUnequipSwordIsAlllowed(ite
m)){
flashObject.SetMemberFlashInt("actionType", 0);
} else {
flashObject.SetMemberFlashInt("actionType", GetItemActio
nType(item, /* NOP */));
}

cantEquip = false;
if (_inv.GetItemLevel(item) > thePlayer.GetLevel()){
cantEquip = true;
}
flashObject.SetMemberFlashBool("cantEquip", cantEquip);
flashObject.SetMemberFlashString("category", _inv.GetItemCategor
y(item));
/* NOP */;
}
public function GetItemQuantity(item : SItemUniqueId) : Int32{
if (_inv.IsIdValid(item)){
return _inv.GetItemQuantity(item);
}
return 0;
/* NOP */;
}
protected function IsUnequipSwordIsAlllowed(item : SItemUniqueId) : Bool
{
var tags : array<CName>;
var equipedItem : SItemUniqueId;
equipedItem = _inv.GetItemFromSlot('r_weapon');
if (_inv.IsIdValid(equipedItem)){
if (_inv.IsItemSteelSwordUsableByPlayer(equipedItem) &&
_inv.IsItemSteelSwordUsableByPlayer(item) || _inv.IsItemSilverSwordUsableByPlaye
r(equipedItem) && _inv.IsItemSilverSwordUsableByPlayer(item)){
return true;
}
}
return false;
/* NOP */;
}
public function isHorseItem(item : SItemUniqueId) : Bool{
return _inv.ItemHasTag(item, 'Saddle') || _inv.ItemHasTag(item,
'HorseBag') || _inv.ItemHasTag(item, 'Trophy') || _inv.ItemHasTag(item, 'Blinder
s');
/* NOP */;
}
protected function GetCurrentSlotForItem(item : SItemUniqueId) : Int32{
return GetWitcherPlayer().GetItemSlot(item);
/* NOP */;
}
protected function GetItemEquippedSlot(item : SItemUniqueId) : EEquipmen
tSlots{
return _inv.GetSlotForItemId(item);
/* NOP */;
}
protected function GetTooltipText(item : SItemUniqueId) : String{
return GetItemTooltipText(item, _inv);
/* NOP */;
}
public function CanBeUpgradedBy(targetItem : SItemUniqueId, upgradeItem
: SItemUniqueId) : Bool{
var socketsCount : Int32;
var usedSocketsCount : Int32;
var emptySocketsCount : Int32;
var targetTag : CName;
socketsCount = _inv.GetItemEnhancementSlotsCount(targetItem);
usedSocketsCount = _inv.GetItemEnhancementCount(targetItem);
emptySocketsCount = socketsCount - usedSocketsCount;
if (emptySocketsCount <= 0){

return false;
}
if (_inv.ItemHasTag(upgradeItem, 'WeaponUpgrade')){
targetTag = 'sword1h';
} else if (_inv.ItemHasTag(upgradeItem, 'ArmorUpgrade')){
targetTag = 'Armor';
}
return _inv.ItemHasTag(targetItem, targetTag);
/* NOP */;
}
public function isQuestItem(item : SItemUniqueId) : Bool{
return _inv.ItemHasTag(item, 'Quest');
/* NOP */;
}
public function isQuickslotItem(item : SItemUniqueId) : Bool{
return _inv.ItemHasTag(item, 'QuickSlot');
/* NOP */;
}
public function isWeaponItem(item : SItemUniqueId) : Bool{
return _inv.IsItemWeapon(item);
/* NOP */;
}
public function isArmorItem(item : SItemUniqueId) : Bool{
return _inv.IsItemAnyArmor(item);
/* NOP */;
}
public function isUpgradeItem(item : SItemUniqueId) : Bool{
return _inv.IsItemUpgrade(item);
/* NOP */;
}
public function isToolItem(item : SItemUniqueId) : Bool{
return _inv.IsItemTool(item);
/* NOP */;
}
public function isPotionItem(item : SItemUniqueId) : Bool{
return _inv.IsItemPotion(item);
/* NOP */;
}
public function isOilItem(item : SItemUniqueId) : Bool{
return _inv.IsItemOil(item);
/* NOP */;
}
public function isPetardItem(item : SItemUniqueId) : Bool{
return _inv.IsItemBomb(item);
/* NOP */;
}
public function isAlchemyItem(item : SItemUniqueId) : Bool{
return _inv.IsItemAlchemyItem(item);
/* NOP */;
}
public function isFoodItem(item : SItemUniqueId) : Bool{
return _inv.IsItemFood(item);
/* NOP */;
}
public function isIngredientItem(item : SItemUniqueId) : Bool{
return _inv.IsItemIngredient(item);
/* NOP */;
}
public function isItemSchematic(item : SItemUniqueId) : Bool{
return _inv.GetItemCategory(item) == 'crafting_schematic' || _in

v.GetItemCategory(item) == 'alchemy_recipe';
/* NOP */;
}
public function GetFilterTypeByItem(item : SItemUniqueId) : EInventoryFi
lterType{
var filterType : EInventoryFilterType;
if (isQuestItem(item) && !isHorseItem(item)){
return 5;
} else if (isIngredientItem(item)){
return 4;
} else if (isAlchemyItem(item)){
return 3;
} else if (isWeaponItem(item) || isArmorItem(item) || isUpgradeI
tem(item) || isHorseItem(item) || isToolItem(item)){
return 1;
} else {
return 6;
}
/* NOP */;
}
public final function GetAllItems() : array<SItemUniqueId>{
var items : array<SItemUniqueId>;
_inv.GetAllItems(items);
return items;
/* NOP */;
}
public function GetBookText(item : SItemUniqueId) : String{
if (_inv.GetItemCategory(item) == 'alchemy_recipe'){
return GetAlchemyBookText(item);
} else if (_inv.GetItemCategory(item) == 'crafting_schematic'){
return GetSchematicBookText(item);
} else {
return _inv.GetBookText(item);
}
/* NOP */;
}
public function GetAlchemyBookText(item : SItemUniqueId) : String{
var dm : CDefinitionsManagerAccessor;
var finalString : String;
var tempString : String;
var recipe : SAlchemyRecipe;
var currentIngredient : SItemParts;
var htmlNewline : String;
var itemType : EInventoryFilterType;
var i : Int32;
var craftedItemName : CName;
var color : String;
var attributes : array<SAttributeTooltip>;
var minWeightAttribute : SAbilityAttributeValue;
var maxWeightAttribute : SAbilityAttributeValue;
var minQuality : Int32;
var maxQuality : Int32;
htmlNewline = "&#10;";
recipe = getAlchemyRecipeFromName(_inv.GetItemName(item));
dm = theGame.GetDefinitionsManager();
craftedItemName = recipe.cookedItemName;
_inv.GetItemStatsFromName(craftedItemName, attributes);
_inv.GetItemQualityFromName(craftedItemName, minQuality, maxQual
ity);
dm.GetItemAttributeValueNoRandom(craftedItemName, true, 'weight'

, minWeightAttribute, maxWeightAttribute);
itemType = dm.GetFilterTypeByItem(craftedItemName);
finalString = GetLocStringByKeyExt("panel_crafting_book_start")
+ ":" + htmlNewline;
finalString += GetItemRarityDescriptionFromInt(minQuality) + htm
lNewline;
finalString += "<font color="#C4B7AA">" + GetLocStringByKeyExt(_
inv.GetItemLocalizedNameByName(craftedItemName)) + "</font>" + htmlNewline;
tempString = GetLocStringByKeyExt(GetFilterTypeName(itemType)) +
" / " + GetLocStringByKeyExt("item_category_" + dm.GetItemCategory(craftedItemN
ame));
finalString += "<font color="#FF8832">" + tempString + "</font>"
+ htmlNewline;
finalString += htmlNewline;
finalString += "<font color="#C49560">" + GetLocStringByKeyExt(_
inv.GetItemLocalizedDescriptionByName(craftedItemName)) + "</font>" + htmlNewlin
e;
finalString += htmlNewline;
i = 0;
while (i < attributes.Size()){
color = attributes[i].attributeColor;
tempString = "<font color="#" + color + "">";
tempString += attributes[i].attributeName + ": ";
if (attributes[i].percentageValue){
tempString += NoTrailZeros(attributes[i].value *
100) + " %";
} else {
tempString += NoTrailZeros(attributes[i].value);
}
tempString += "</font>" + htmlNewline;
finalString += tempString;
i += 1;
}
if (minWeightAttribute.valueBase > 0){
finalString += htmlNewline + GetLocStringByKeyExt("attri
bute_name_weight") + ": " + NoTrailZeros(minWeightAttribute.valueBase) + htmlNew
line;
}
finalString += GetLocStringByKeyExt("panel_crafting_ingredients_
start") + ":" + htmlNewline;
i = 0;
while (i < recipe.requiredIngredients.Size()){
currentIngredient = recipe.requiredIngredients[i];
tempString = GetLocStringByKeyExt(_inv.GetItemLocalizedN
ameByName(currentIngredient.itemName));
finalString += currentIngredient.quantity + "x " + tempS
tring + htmlNewline;
i += 1;
}
return finalString;
/* NOP */;
}
public function GetSchematicBookText(item : SItemUniqueId) : String{
var dm : CDefinitionsManagerAccessor;
var finalString : String;
var tempString : String;
var htmlNewline : String;
var craftingSchematic : SCraftingSchematic;
var craftedItemName : CName;
var currentIngredient : SItemParts;

var i : Int32;
var color : String;
var attributes : array<SAttributeTooltip>;
var minWeightAttribute : SAbilityAttributeValue;
var maxWeightAttribute : SAbilityAttributeValue;
var minQuality : Int32;
var maxQuality : Int32;
var itemType : EInventoryFilterType;
var delimiter : String;
var prefix : String;
var language : String;
var audioLanguage : String;
theGame.GetGameLanguageName(audioLanguage, language);
if (language == "AR"){
delimiter = "";
prefix = "&nbsp;";
} else {
delimiter = ": ";
prefix = "";
}
htmlNewline = "&#10;";
dm = theGame.GetDefinitionsManager();
craftingSchematic = getCraftingSchematicFromName(_inv.GetItemNam
e(item));
craftedItemName = craftingSchematic.craftedItemName;
_inv.GetItemStatsFromName(craftedItemName, attributes);
_inv.GetItemQualityFromName(craftedItemName, minQuality, maxQual
ity);
itemType = dm.GetFilterTypeByItem(craftedItemName);
dm.GetItemAttributeValueNoRandom(craftedItemName, true, 'weight'
, minWeightAttribute, maxWeightAttribute);
finalString = GetLocStringByKeyExt("panel_crafting_book_start")
+ htmlNewline;
finalString += "<font color="#C4B7AA">" + GetLocStringByKeyExt(_
inv.GetItemLocalizedNameByName(craftedItemName)) + "</font>" + htmlNewline;
finalString += GetItemRarityDescriptionFromInt(minQuality) + htm
lNewline;
tempString = GetLocStringByKeyExt(GetFilterTypeName(itemType)) +
" / " + GetLocStringByKeyExt("item_category_" + dm.GetItemCategory(craftedItemN
ame));
finalString += "<font color="#FF8832">" + tempString + "</font>"
+ htmlNewline;
finalString += htmlNewline;
finalString += "<font color="#C49560">" + GetLocStringByKeyExt(_
inv.GetItemLocalizedDescriptionByName(craftedItemName)) + "</font>" + htmlNewlin
e;
finalString += htmlNewline;
finalString += _inv.GetItemLevelColor(theGame.GetDefinitionsMana
ger().GetItemLevelFromName(craftedItemName)) + GetLocStringByKeyExt('panel_inven
tory_item_requires_level') + " " + theGame.GetDefinitionsManager().GetItemLevelF
romName(craftedItemName) + "</font><br>";
finalString += htmlNewline;
i = 0;
while (i < attributes.Size()){
color = attributes[i].attributeColor;
tempString = "<font color="#" + color + "">";
tempString += attributes[i].attributeName + delimiter;
if (attributes[i].percentageValue){
tempString += NoTrailZeros(attributes[i].value *
100) + " %" + prefix;

} else {
tempString += NoTrailZeros(attributes[i].value)
+ prefix;
}
tempString += "</font>" + htmlNewline;
finalString += tempString;
i += 1;
}
if (maxQuality > 1 && maxQuality < 4){
if (minQuality != maxQuality){
finalString += "<font color="#AAFFFC">" + GetLoc
StringByKeyExt("panel_crafting_number_random_attributes") + delimiter + minQuali
ty - 1 + " - " + maxQuality - 1 + prefix + " </font>" + htmlNewline;
} else {
finalString += "<font color="#AAFFFC">" + GetLoc
StringByKeyExt("panel_crafting_number_random_attributes") + delimiter + minQuali
ty - 1 + prefix + " </font>" + htmlNewline;
}
}
if (minWeightAttribute.valueBase > 0){
finalString += htmlNewline + GetLocStringByKeyExt("attri
bute_name_weight") + delimiter + NoTrailZeros(minWeightAttribute.valueBase) + pr
efix + htmlNewline;
}
finalString += GetLocStringByKeyExt("panel_crafting_ingredients_
start") + htmlNewline;
i = 0;
while (i < craftingSchematic.ingredients.Size()){
currentIngredient = craftingSchematic.ingredients[i];
tempString = GetLocStringByKeyExt(_inv.GetItemLocalizedN
ameByName(currentIngredient.itemName));
finalString += currentIngredient.quantity + "x " + tempS
tring + htmlNewline;
i += 1;
}
return finalString;
/* NOP */;
}
}
import struct IGameplayEffectExecutor{
public function Execute(executor : CGameplayEntity, target : CActor, sou
rce : String) : Bool{
return false;
/* NOP */;
}
public function GetEffectIconPath() : String{
return "";
/* NOP */;
}
public function GetEffectNameLocalisationKey() : String{
return "";
/* NOP */;
}
public function GetEffectDescriptionLocalisationKey() : String{
return "";
/* NOP */;
}
}

class W3GuiHorseInventoryComponent extends W3GuiBaseInventoryComponent{


protected function ShouldShowItem(item : SItemUniqueId) : Bool{
return isEquipped(item);
/* NOP */;
}
protected function isEquipped(item : SItemUniqueId) : Bool{
var horseMgr : W3HorseManager;
horseMgr = GetWitcherPlayer().GetHorseManager();
if (horseMgr){
return horseMgr.IsItemEquipped(item);
}
return false;
/* NOP */;
}
protected function GetCurrentSlotForItem(item : SItemUniqueId) : Int32{
var horseMgr : W3HorseManager;
horseMgr = GetWitcherPlayer().GetHorseManager();
if (horseMgr){
return horseMgr.GetHorseSlotForItem(item);
}
return -1;
/* NOP */;
}
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
var canDrop : Bool;
super.SetInventoryFlashObjectForItem(item, flashObject);
canDrop = !_inv.ItemHasTag(item, 'Quest') && !_inv.ItemHasTag(it
em, 'NoDrop');
flashObject.SetMemberFlashBool("canDrop", canDrop);
flashObject.SetMemberFlashInt("groupId", 1);
/* NOP */;
}
}
import abstract class CVitalSpot{
}
struct SUISavedData{
var panelName : CName;
var selectedTag : CName;
var openedCategories : array<CName>;
var gridItem : SItemUniqueId;
var slotID : Int32;
var selectedModule : Int32;
}
class CR4GuiSceneController extends CObject{
private var _isEntitySpawning : Bool;
private var _entityTemplateAlias : String;
private var _entityAppearance : CName;
private var _environmentAlias : String;
private var _environmentSunRotation : EulerAngles;
private var _cameraUpdate : Bool;
private var _cameraLookAt : Vector;
private var _cameraRotation : EulerAngles;
private var _cameraDistance : Float;
private var _fov : Float;
private var _updateItems : Bool;
private var _entityPosition : Vector;

private var _entityRotation : EulerAngles;


private var _entityScale : Vector;
private var _updateEntityTransform : Bool;
public function OnGuiSceneEntitySpawned(){
_isEntitySpawning = false;
if (_entityTemplateAlias != ""){
SetEntityTemplate(_entityTemplateAlias);
_entityTemplateAlias = "";
} else {
if (_entityAppearance != 'None'){
SetEntityAppearance(_entityAppearance);
_entityAppearance = 'None';
}
if (_environmentAlias != ""){
SetEnvironmentAndSunRotation(_environmentAlias,
_environmentSunRotation);
_environmentAlias = "";
}
if (_cameraUpdate){
_cameraUpdate = false;
SetCamera(_cameraLookAt, _cameraRotation, _camer
aDistance, _fov);
}
if (_updateItems){
_updateItems = false;
SetEntityItems(_updateItems);
}
if (_updateEntityTransform){
_updateEntityTransform = false;
SetEntityTransform(_entityPosition, _entityRotat
ion, _entityScale);
}
}
/* NOP */;
}
public function OnGuiSceneEntityDestroyed(){
}
public function SetEntityTemplate(entityTemplateAlias : String){
var templateResource : CEntityTemplate;
if (_isEntitySpawning){
_entityTemplateAlias = entityTemplateAlias;
} else {
templateResource = (CEntityTemplate)LoadResource(entityT
emplateAlias, /* NOP */);
if (templateResource){
_isEntitySpawning = true;
theGame.GetGuiManager().SetSceneEntityTemplate(t
emplateResource, /* NOP */);
}
}
/* NOP */;
}
public function SetEntityAppearance(appearance : CName){
if (_isEntitySpawning){
_entityAppearance = appearance;
} else {
theGame.GetGuiManager().ApplyAppearanceToSceneEntity(app
earance);
}
/* NOP */;

}
public function SetEnvironmentAndSunRotation(environmentAlias : String,
environmentSunRotation : EulerAngles){
var environment : CEnvironmentDefinition;
if (_isEntitySpawning){
_environmentAlias = environmentAlias;
_environmentSunRotation = environmentSunRotation;
} else {
environment = (CEnvironmentDefinition)LoadResource(envir
onmentAlias, /* NOP */);
if (environment){
theGame.GetGuiManager().SetSceneEnvironmentAndSu
nPosition(environment, environmentSunRotation);
}
}
/* NOP */;
}
public function SetCamera(cameraLookAt : Vector, cameraRotation : EulerA
ngles, cameraDistance : Float, fov : Float){
if (_isEntitySpawning){
_cameraUpdate = true;
_cameraLookAt = cameraLookAt;
_cameraRotation = cameraRotation;
_cameraDistance = cameraDistance;
_fov = fov;
} else {
theGame.GetGuiManager().SetupSceneCamera(cameraLookAt, c
ameraRotation, cameraDistance, fov);
}
/* NOP */;
}
public function SetEntityTransform(position : Vector, rotation : EulerAn
gles, scale : Vector){
if (_isEntitySpawning){
_updateEntityTransform = true;
_entityPosition = position;
_entityRotation = rotation;
_entityScale = scale;
} else {
theGame.GetGuiManager().SetEntityTransform(position, rot
ation, scale);
}
/* NOP */;
}
public function SetEntityItems(updateItems : Bool){
var inventory : CInventoryComponent;
var items : array<CName>;
var witcher : W3PlayerWitcher;
if (_isEntitySpawning){
_updateItems = updateItems;
} else {
inventory = thePlayer.GetInventory();
if (inventory){
inventory.GetHeldAndMountedItems(items);
witcher = (W3PlayerWitcher)thePlayer;
if (witcher){
witcher.GetMountableItems(items);
}
theGame.GetGuiManager().UpdateSceneEntityItems(i
tems);

}
}
/* NOP */;
}
}
class CR4HudEventController extends CObject{
private var delayedEvents : array<CHudEvent>;
private function FindDelayedEvent(eventName : String) : Int32{
var i : Int32;
i = 0;
while (i < delayedEvents.Size()){
if (delayedEvents[i].eventName == eventName){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function RunEvent_MinimapModule_NotifyPlayerEnteredInterior(areaP
os : Vector, areaYaw : Float, texture : String){
var hudEvent : CNotifyPlayerEnteredInteriorEvent;
var minimapModule : CR4HudModuleMinimap2;
var hud : CR4ScriptedHud;
var foundIndex : Int32;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
minimapModule = (CR4HudModuleMinimap2)hud.GetHudModule("
Minimap2Module");
if (minimapModule){
minimapModule.NotifyPlayerEnteredInterior(areaPo
s, areaYaw, texture);
return;
}
}
CheckDelayedEvent();
foundIndex = FindDelayedEvent("NotifyPlayerEnteredInterior");
if (foundIndex < 0){
hudEvent = new CNotifyPlayerEnteredInteriorEvent in this
;
hudEvent.moduleName = "Minimap2Module";
hudEvent.eventName = "NotifyPlayerEnteredInterior";
hudEvent.areaPos = areaPos;
hudEvent.areaYaw = areaYaw;
hudEvent.texture = texture;
delayedEvents.PushBack(hudEvent);
/* NOP */;
} else {
hudEvent = (CNotifyPlayerEnteredInteriorEvent)delayedEve
nts[foundIndex];
hudEvent.areaPos = areaPos;
hudEvent.areaYaw = areaYaw;
hudEvent.texture = texture;
/* NOP */;
}
/* NOP */;
}
public function RunEvent_MinimapModule_NotifyPlayerExitedInterior(){
var hudEvent : CNotifyPlayerExitedInteriorEvent;

var minimapModule : CR4HudModuleMinimap2;


var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
minimapModule = (CR4HudModuleMinimap2)hud.GetHudModule("
Minimap2Module");
if (minimapModule){
minimapModule.NotifyPlayerExitedInterior();
return;
}
}
CheckDelayedEvent();
hudEvent = new CNotifyPlayerExitedInteriorEvent in this;
hudEvent.moduleName = "Minimap2Module";
hudEvent.eventName = "NotifyPlayerExitedInterior";
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_MinimapModule_NotifyPlayerMountedBoat(){
var hudEvent : CNotifyPlayerMountedBoatEvent;
var minimapModule : CR4HudModuleMinimap2;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
minimapModule = (CR4HudModuleMinimap2)hud.GetHudModule("
Minimap2Module");
if (minimapModule){
minimapModule.NotifyPlayerMountedBoat();
return;
}
}
CheckDelayedEvent();
hudEvent = new CNotifyPlayerMountedBoatEvent in this;
hudEvent.moduleName = "Minimap2Module";
hudEvent.eventName = "NotifyPlayerMountedBoat";
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_MinimapModule_NotifyPlayerDismountedBoat(){
var hudEvent : CNotifyPlayerDismountedBoatEvent;
var minimapModule : CR4HudModuleMinimap2;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
minimapModule = (CR4HudModuleMinimap2)hud.GetHudModule("
Minimap2Module");
if (minimapModule){
minimapModule.NotifyPlayerDismountedBoat();
return;
}
}
CheckDelayedEvent();
hudEvent = new CNotifyPlayerDismountedBoatEvent in this;
hudEvent.moduleName = "Minimap2Module";
hudEvent.eventName = "NotifyPlayerDismountedBoat";
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;

}
public function RunEvent_QuestsModule_OnQuestTrackingStarted(journalQues
t : CJournalQuest){
var hudEvent : COnQuestTrackingStartedEvent;
var questsModule : CR4HudModuleQuests;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
questsModule = (CR4HudModuleQuests)hud.GetHudModule("Que
stsModule");
if (questsModule){
questsModule.OnQuestTrackingStarted(journalQuest
);
return;
}
}
CheckDelayedEvent();
hudEvent = new COnQuestTrackingStartedEvent in this;
hudEvent.moduleName = "QuestsModule";
hudEvent.eventName = "OnQuestTrackingStarted";
hudEvent.journalQuest = journalQuest;
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_QuestsModule_OnTrackedQuestObjectiveHighlighted
(journalObjective : CJournalQuestObjective, journalObjectiveIndex : Int32){
var hudEvent : COnTrackedQuestObjectiveHighlightedEvent;
var questsModule : CR4HudModuleQuests;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
questsModule = (CR4HudModuleQuests)hud.GetHudModule("Que
stsModule");
if (questsModule){
questsModule.OnTrackedQuestObjectiveHighlighted(
journalObjective, journalObjectiveIndex);
return;
}
}
CheckDelayedEvent();
hudEvent = new COnTrackedQuestObjectiveHighlightedEvent in this;
hudEvent.moduleName = "QuestsModule";
hudEvent.eventName = "OnTrackedQuestObjectiveHighlighted";
hudEvent.journalObjective = journalObjective;
hudEvent.journalObjectiveIndex = journalObjectiveIndex;
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_ControlsFeedbackModule_Update(inputContextName
: CName){
var hudEvent : CNotifyInputContextChangedEvent;
var controlsFeedbackModule : CR4HudModuleControlsFeedback;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
controlsFeedbackModule = (CR4HudModuleControlsFeedback)h
ud.GetHudModule("ControlsFeedbackModule");
if (controlsFeedbackModule){

controlsFeedbackModule.UpdateInputContext(inputC
ontextName);
return;
}
}
CheckDelayedEvent();
hudEvent = new CNotifyInputContextChangedEvent in this;
hudEvent.moduleName = "ControlsFeedbackModule";
hudEvent.eventName = "UpdateInputContext";
hudEvent.inputContextName = inputContextName;
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_BossFocusModule_ShowBossIndicator(enable : Bool
, bossTag : CName){
var hudEvent : CNotifyBossIndicatorShownEvent;
var bossFocusModule : CR4HudModuleBossFocus;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
bossFocusModule = (CR4HudModuleBossFocus)hud.GetHudModul
e("BossFocusModule");
if (bossFocusModule){
bossFocusModule.ShowBossIndicator(enable, bossTa
g, /* NOP */);
return;
}
}
CheckDelayedEvent();
hudEvent = new CNotifyBossIndicatorShownEvent in this;
hudEvent.moduleName = "BossFocusModule";
hudEvent.eventName = "ShowBossIndicator";
hudEvent.enable = enable;
hudEvent.bossTag = bossTag;
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;
}
public function RunEvent_OxygenBarModule_SetInGasArea(entered : Bool){
var hudEvent : COnGasAreaEvent;
var oxygenBarModule : CR4HudModuleOxygenBar;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
oxygenBarModule = (CR4HudModuleOxygenBar)hud.GetHudModul
e("OxygenBarModule");
if (oxygenBarModule){
oxygenBarModule.SetIsInGasArea(entered);
return;
}
}
CheckDelayedEvent();
hudEvent = new COnGasAreaEvent in this;
hudEvent.moduleName = "OxygenBarModule";
hudEvent.eventName = "SetInGasArea";
hudEvent.entered = entered;
delayedEvents.PushBack(hudEvent);
/* NOP */;
/* NOP */;

}
private function CheckDelayedEvent(){
if (delayedEvents.Size() > 200){
delete delayedEvents[0];
delayedEvents.Erase(0);
}
/* NOP */;
}
public function RunDelayedEvents(){
var i : Int32;
var hud : CR4ScriptedHud;
var module : CHudModule;
if (delayedEvents.Size() == 0){
return;
}
hud = (CR4ScriptedHud)theGame.GetHud();
if (!hud){
return;
}
i = 0;
while (i < delayedEvents.Size()){
module = hud.GetHudModule(delayedEvents[i].moduleName);
if (module){
RunDelayedEvent(module, delayedEvents[i]);
/* NOP */;
delete delayedEvents[i];
delayedEvents.Erase(i);
} else {
i += 1;
}
/* NOP */;
}
/* NOP */;
}
private function RunDelayedEvent(module : CHudModule, delayedEvent : CHu
dEvent){
var onQuestTrackingStartedEvent : COnQuestTrackingStartedEvent;
var onTrackedQuestObjectiveHighlightedEvent : COnTrackedQuestObj
ectiveHighlightedEvent;
var onInputContextChangedEvent : CNotifyInputContextChangedEvent
;
var notifyPlayerEnteredInteriorEvent : CNotifyPlayerEnteredInter
iorEvent;
var notifyPlayerExitedInteriorEvent : CNotifyPlayerExitedInterio
rEvent;
var notifyPlayerMountedBoatEvent : CNotifyPlayerMountedBoatEvent
;
var notifyPlayerDismountedBoatEvent : CNotifyPlayerDismountedBoa
tEvent;
var onBossIndicatorShownEvent : CNotifyBossIndicatorShownEvent;
var onGasAreaEvent : COnGasAreaEvent;
var minimapModule : CR4HudModuleMinimap2;
var questsModule : CR4HudModuleQuests;
var controlsFeedbackModule : CR4HudModuleControlsFeedback;
var bossFocusModule : CR4HudModuleBossFocus;
var oxygenBarModule : CR4HudModuleOxygenBar;
switch(delayedEvent.moduleName){
case "Minimap2Module":
minimapModule = (CR4HudModuleMinimap2)module;
if (minimapModule){

switch(delayedEvent.eventName){
case "NotifyPlayerEnteredInterior":
notifyPlayerEnteredInteriorEvent = (CNot
ifyPlayerEnteredInteriorEvent)delayedEvent;
minimapModule.NotifyPlayerEnteredInterio
r(notifyPlayerEnteredInteriorEvent.areaPos, notifyPlayerEnteredInteriorEvent.are
aYaw, notifyPlayerEnteredInteriorEvent.texture);
break;
case "NotifyPlayerExitedInterior":
notifyPlayerExitedInteriorEvent = (CNoti
fyPlayerExitedInteriorEvent)delayedEvent;
minimapModule.NotifyPlayerExitedInterior
();
break;
case "NotifyPlayerMountedBoat":
notifyPlayerMountedBoatEvent = (CNotifyP
layerMountedBoatEvent)delayedEvent;
minimapModule.NotifyPlayerMountedBoat();
break;
case "NotifyPlayerDismountedBoat":
notifyPlayerDismountedBoatEvent = (CNoti
fyPlayerDismountedBoatEvent)delayedEvent;
minimapModule.NotifyPlayerDismountedBoat
();
break;
}
}
break;
case "QuestsModule":
questsModule = (CR4HudModuleQuests)module;
if (questsModule){
switch(delayedEvent.eventName){
case "OnQuestTrackingStarted":
onQuestTrackingStartedEvent = (COnQuestT
rackingStartedEvent)delayedEvent;
questsModule.OnQuestTrackingStarted(onQu
estTrackingStartedEvent.journalQuest);
break;
case "OnTrackedQuestObjectiveHighlighted":
onTrackedQuestObjectiveHighlightedEvent
= (COnTrackedQuestObjectiveHighlightedEvent)delayedEvent;
questsModule.OnTrackedQuestObjectiveHigh
lighted(onTrackedQuestObjectiveHighlightedEvent.journalObjective, onTrackedQuest
ObjectiveHighlightedEvent.journalObjectiveIndex);
break;
}
}
break;
case "ControlsFeedbackModule":
controlsFeedbackModule = (CR4HudModuleControlsFeedback)m
odule;
if (controlsFeedbackModule){
onInputContextChangedEvent = (CNotifyInputContex
tChangedEvent)delayedEvent;
controlsFeedbackModule.UpdateInputContext(onInpu
tContextChangedEvent.inputContextName);
}
break;
case "BossFocusModule":
bossFocusModule = (CR4HudModuleBossFocus)module;

if (bossFocusModule){
onBossIndicatorShownEvent = (CNotifyBossIndicato
rShownEvent)delayedEvent;
bossFocusModule.ShowBossIndicator(onBossIndicato
rShownEvent.enable, onBossIndicatorShownEvent.bossTag, /* NOP */);
}
break;
case "OxygenBarModule":
oxygenBarModule = (CR4HudModuleOxygenBar)module;
if (oxygenBarModule){
onGasAreaEvent = (COnGasAreaEvent)delayedEvent;
oxygenBarModule.SetIsInGasArea(onGasAreaEvent.en
tered);
}
break;
default:
break;
}
/* NOP */;
}
}
struct SGlossaryEntry{
var panelName : CName;
var newEntry : CJournalBase;
var tag : CName;
}
struct SMappinEntry{
var newMappin : CName;
var newMappinType : CName;
}
import abstract class CBehTreeStrafingAlgorithmDefinition{
}
class CInGameConfigBufferedWrapper extends CObject{
public var inGameConfig : CInGameConfigWrapper;
public var buffer : array<SInGameConfigBufferedEntry>;
public function FillAppendWithGroup(groupName : CName){
var varsNum : Int32;
var counter : Int32;
var varValue : String;
var bufferEntry : SInGameConfigBufferedEntry;
var found : Bool;
var i : Int32;
varsNum = inGameConfig.GetVarsNumByGroupName(groupName);
bufferEntry.groupName = groupName;
counter = 0;
while (counter < varsNum){
bufferEntry.varName = inGameConfig.GetVarNameByGroupName
(groupName, counter);
found = false;
i = 0;
while (i < buffer.Size()){
if (buffer[i].groupName == bufferEntry.groupName
&& buffer[i].varName == bufferEntry.varName){
found = true;
break;
}

i += 1;
}
if (found == false){
bufferEntry.varValue = inGameConfig.GetVarValue(
groupName, bufferEntry.varName);
buffer.PushBack(bufferEntry);
}
counter += 1;
}
/* NOP */;
}
public function GetVarValue(groupName : CName, varName : CName) : String
{
var i : Int32;
i = 0;
while (i < buffer.Size()){
if (buffer[i].groupName == groupName && buffer[i].varNam
e == varName){
return buffer[i].varValue;
}
i += 1;
}
return inGameConfig.GetVarValue(groupName, varName);
/* NOP */;
}
public function SetVarValue(groupName : CName, varName : CName, varValue
: String){
var i : Int32;
var bufferEntry : SInGameConfigBufferedEntry;
var found : Bool;
found = false;
i = 0;
while (i < buffer.Size()){
if (buffer[i].groupName == groupName && buffer[i].varNam
e == varName){
buffer[i].varValue = varValue;
found = true;
break;
}
i += 1;
}
if (found == false){
bufferEntry.groupName = groupName;
bufferEntry.varName = varName;
bufferEntry.varValue = varValue;
bufferEntry.startValue = inGameConfig.GetVarValue(groupN
ame, varName);
buffer.PushBack(bufferEntry);
}
/* NOP */;
}
public function AnyBufferedVarHasTag(tag : CName) : Bool{
var i : Int32;
i = 0;
while (i < buffer.Size()){
if (inGameConfig.DoVarHasTag(buffer[i].groupName, buffer
[i].varName, tag) && buffer[i].startValue != buffer[i].varValue){
return true;
}
i += 1;

}
return false;
/* NOP */;
}
public function ApplyNewValues(){
var i : Int32;
i = 0;
while (i < buffer.Size()){
inGameConfig.SetVarValue(buffer[i].groupName, buffer[i].
varName, buffer[i].varValue);
i += 1;
}
/* NOP */;
}
public function FlushBuffer(){
ApplyNewValues();
buffer.Clear();
/* NOP */;
}
public function UndoAndFlushBuffer(){
var i : Int32;
i = 0;
while (i < buffer.Size()){
inGameConfig.SetVarValue(buffer[i].groupName, buffer[i].
varName, buffer[i].startValue);
i += 1;
}
buffer.Clear();
/* NOP */;
}
public function IsEmpty() : Bool{
if (buffer.Size() > 0){
return false;
}
return true;
/* NOP */;
}
public function ClearBuffer(){
buffer.Clear();
/* NOP */;
}
}
class W3MessagePopupData extends CObject{
public var actionsList : array<UserMessageActionData>;
public var titleText : String;
public var messageText : String;
public var messageId : Int32;
public var autoLocalize : Bool;
public var messageType : EUserDialogButtons;
public var priority : Int32;
public var progress : Float;
public var progressType : EUserMessageProgressType;
public var progressTag : CName;
public function setActionsByType(msgType : EUserDialogButtons){
var curUserActionData : UserMessageActionData;
messageType = msgType;
switch(messageType){
case 0:
curUserActionData.actionId = 0;

curUserActionData.label = GetLocStringByKeyExt("panel_co
mmon_ok");
actionsList.PushBack(curUserActionData);
break;
case 1:
curUserActionData.actionId = 0;
curUserActionData.label = GetLocStringByKeyExt("panel_co
mmon_ok");
actionsList.PushBack(curUserActionData);
curUserActionData.actionId = 1;
curUserActionData.label = GetLocStringByKeyExt("panel_co
mmon_cancel");
actionsList.PushBack(curUserActionData);
break;
case 2:
curUserActionData.actionId = 3;
curUserActionData.label = GetLocStringByKeyExt("panel_co
mmon_yes");
actionsList.PushBack(curUserActionData);
curUserActionData.actionId = 4;
curUserActionData.label = GetLocStringByKeyExt("panel_co
mmon_no");
actionsList.PushBack(curUserActionData);
break;
case 3:
default:
break;
}
/* NOP */;
}
}
import struct CR4Menu{
import public function GetSubMenu() : CMenu;
import public function MakeModal(make : Bool) : Bool;
import public function SetRenderGameWorldOverride(override : Bool);
}
import struct CR4Popup{
import public function MakeModal(make : Bool) : Bool;
}
import abstract class IBehTreeTicketAlgorithmDefinition{
}
class CR4StartScreenMenu extends CR4MenuBase{
private var _fadeDuration : Float;
protected var m_fxSetFadeDuration : CScriptedFlashFunction;
protected var m_fxSetIsStageDemo : CScriptedFlashFunction;
protected var m_fxStartFade : CScriptedFlashFunction;
private var m_fxSetGameLogoLanguage : CScriptedFlashFunction;
protected var m_fxSetText : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var languageName : String;
var audioLanguageName : String;
super.OnConfigUI();
_fadeDuration = thePlayer.GetStartScreenFadeDuration();
m_fxSetFadeDuration = GetMenuFlash().GetMemberFlashFunction("Set
FadeDuration");
m_fxStartFade = GetMenuFlash().GetMemberFlashFunction("startClos

ingTimer");
m_fxSetText = GetMenuFlash().GetMemberFlashFunction("setDisplaye
dText");
SetFadeTime();
theInput.StoreContext('EMPTY_CONTEXT');
setStandardtext();
theGame.GetGuiManager().OnEnteredStartScreen();
theGame.SetActiveUserPromiscuous();
m_fxSetGameLogoLanguage = m_flashModule.GetMemberFlashFunction("
setGameLogoLanguage");
theGame.GetGameLanguageName(audioLanguageName, languageName);
m_fxSetGameLogoLanguage.InvokeSelfOneArg(FlashArgString(language
Name));
theSound.StopMusic();
theSound.SoundEvent("play_music_main_menu");
theSound.SoundEvent("mus_main_menu_theme_fire_only");
theGame.ResetFadeLock("Entering start screen");
if (theGame.IsBlackscreen()){
theGame.FadeInAsync(/* NOP */);
}
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (!thePlayer.GetStartScreenEndWithBlackScreen()){
theGame.FadeInAsync(thePlayer.GetStartScreenFadeInDurati
on());
}
thePlayer.SetStartScreenIsOpened(false);
CloseMenu();
theInput.RestoreContext('EMPTY_CONTEXT', true);
theGame.GetGuiManager().SetIsDuringFirstStartup(false);
theSound.SoundEvent("stop_music");
/* NOP */;
}
private function SetFadeTime(){
var time : Int32;
time = 1000 * _fadeDuration;
m_fxSetFadeDuration.InvokeSelfOneArg(FlashArgNumber(time));
theGame.FadeInAsync(_fadeDuration);
/* NOP */;
}
public function startFade(){
m_fxStartFade.InvokeSelf();
/* NOP */;
}
public function OnKeyPress() : Bool{
if (theGame.isUserSignedIn()){
startFade();
}
/* NOP */;
}
public function OnPlaySoundEvent(soundName : String) : Bool{
}
public function setStandardtext(){
if (theGame.GetPlatform() == 1){
m_fxSetText.InvokeSelfOneArg(FlashArgString(GetLocString
ByKeyExt("panel_button_press_any_X1")));
} else if (theGame.GetPlatform() == 2){
m_fxSetText.InvokeSelfOneArg(FlashArgString(GetLocString
ByKeyExt("panel_button_press_any_PS4")));

} else {
m_fxSetText.InvokeSelfOneArg(FlashArgString(GetLocString
ByKeyExt("panel_button_press_any")));
}
/* NOP */;
}
public function setWaitingText(){
m_fxSetText.InvokeSelfOneArg(FlashArgString(GetLocStringByKeyExt
("panel_please_wait")));
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
class CR4HudModuleDialog extends CR4HudModuleBase{
private var m_fxSentenceSetSFF : CScriptedFlashFunction;
private var m_fxPreviousSentenceSetSFF : CScriptedFlashFunction;
private var m_fxPreviousSentenceHideSFF : CScriptedFlashFunction;
private var m_fxSentenceHideSFF : CScriptedFlashFunction;
private var m_fxChoiceTimeoutSetSFF : CScriptedFlashFunction;
private var m_fxChoiceTimeoutHideSFF : CScriptedFlashFunction;
private var m_fxSkipConfirmShowSFF : CScriptedFlashFunction;
private var m_fxSkipConfirmHideSFF : CScriptedFlashFunction;
private var m_fxSetBarValueSFF : CScriptedFlashFunction;
private var m_fxSetCanBeSkipped : CScriptedFlashFunction;
private var monsterBarganingPopupMenu : CR4MenuPopup;
private var m_guiManager : CR4GuiManager;
private var m_LastNegotiationResult : ENegotiationResult;
private var currentReward : CName;
private var currentRewardMultiply : Float;
private var isBet : Bool;
public var isPopupOpened : Bool;
private var isGwentMode : Bool;
public var anger : Float;
private var currentGold : Int32;
private var minimalHagglingReward : Int32;
private var maxHaggleValue : Int32;
private var NPCsPrettyClose : Float;
private var NPCsTooMuch : Float;
protected var lastSetChoices : array<SSceneChoice>;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
m_anchorName = "ScaleOnly";
flashModule = GetModuleFlash();
m_guiManager = theGame.GetGuiManager();
m_fxSentenceSetSFF = flashModule.GetMemberFlashFunction("Sentenc
eSet");
m_fxPreviousSentenceSetSFF = flashModule.GetMemberFlashFunction(
"PreviousSentenceSet");
m_fxPreviousSentenceHideSFF = flashModule.GetMemberFlashFunction
("PreviousSentenceHide");
m_fxSentenceHideSFF = flashModule.GetMemberFlashFunction("Senten
ceHide");
m_fxChoiceTimeoutSetSFF = flashModule.GetMemberFlashFunction("Ch
oiceTimeoutSet");
m_fxChoiceTimeoutHideSFF = flashModule.GetMemberFlashFunction("C
hoiceTimeoutHide");
m_fxSkipConfirmShowSFF = flashModule.GetMemberFlashFunction("Ski
pConfirmShow");

m_fxSkipConfirmHideSFF = flashModule.GetMemberFlashFunction("Ski
pConfirmHide");
m_fxSetBarValueSFF = flashModule.GetMemberFlashFunction("setBarV
alue");
m_fxSetCanBeSkipped = flashModule.GetMemberFlashFunction("setCan
BeSkipped");
UpdateCanBeSkipped(theGame.GetStorySceneSystem().IsSkippingLineA
llowed());
super.OnConfigUI();
/* NOP */;
}
public function SetGwentMode(value : Bool){
isGwentMode = value;
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
}
public function UpdateCanBeSkipped(canBeSkipped : Bool){
m_fxSetCanBeSkipped.InvokeSelfOneArg(FlashArgBool(canBeSkipped))
;
/* NOP */;
}
public function OnMissingContentDialogClosed(){
SendDialogChoicesToUI(lastSetChoices, false);
/* NOP */;
}
public function OnDialogOptionSelected(index : Int32) : Bool{
var system : CStorySceneSystem;
system = theGame.GetStorySceneSystem();
/* NOP */;
/* NOP */;
/* NOP */;
system.SendSignal(1, index);
/* NOP */;
}
public function OnDialogOptionAccepted(index : Int32) : Bool{
var system : CStorySceneSystem;
var acceptedChoice : SSceneChoice;
var progress : Float;
system = theGame.GetStorySceneSystem();
acceptedChoice = lastSetChoices[index];
/* NOP */;
/* NOP */;
/* NOP */;
if (!acceptedChoice.disabled){
system.SendSignal(0, index);
m_guiManager.RequestMouseCursor(false);
theGame.ForceUIAnalog(false);
} else if (acceptedChoice.dialogAction == 2){
if (!theGame.IsContentAvailable(acceptedChoice.playGoChu
nk)){
progress = theGame.ProgressToContentAvailable(ac
ceptedChoice.playGoChunk);
theSound.SoundEvent("gui_global_denied");
theGame.GetGuiManager().ShowProgressDialog(UMID_
MissingContentOnDialogError, "", "panel_map_cannot_travel_downloading_content",
true, 0, progress, 1, acceptedChoice.playGoChunk);
} else {
system.SendSignal(0, index);
m_guiManager.RequestMouseCursor(false);

theGame.ForceUIAnalog(false);
}
} else {
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
public function OnDialogSkipped(value : Int32) : Bool{
var system : CStorySceneSystem;
system = theGame.GetStorySceneSystem();
/* NOP */;
/* NOP */;
/* NOP */;
system.SendSignal(2, value);
/* NOP */;
}
public function OnDialogSentenceSet(text : String){
if (theGame.isDialogDisplayDisabled){
text = "";
}
m_fxSentenceSetSFF.InvokeSelfOneArg(FlashArgString(text));
/* NOP */;
}
public function OnDialogPreviousSentenceSet(text : String){
if (theGame.isDialogDisplayDisabled){
text = "";
}
m_fxPreviousSentenceSetSFF.InvokeSelfOneArg(FlashArgString(text)
);
/* NOP */;
}
public function OnDialogPreviousSentenceHide(){
m_fxPreviousSentenceHideSFF.InvokeSelf();
/* NOP */;
}
public function OnDialogSentenceHide(){
m_fxSentenceHideSFF.InvokeSelf();
/* NOP */;
}
public function OnDialogChoicesSet(choices : array<SSceneChoice>){
SendDialogChoicesToUI(choices, true);
m_guiManager.RequestMouseCursor(true);
theGame.ForceUIAnalog(true);
/* NOP */;
}
private function SendDialogChoicesToUI(choices : array<SSceneChoice>, al
lowContentMissingDialog : Bool){
var i : Int32;
var flashValueStorage : CScriptedFlashValueStorage;
var choiceFlashArray : CScriptedFlashArray;
var choiceFlashObject : CScriptedFlashObject;
var hasContentMissing : Bool;
var missingContent : CName;
var progress : Float;
hasContentMissing = false;
flashValueStorage = GetModuleFlashValueStorage();
choiceFlashArray = flashValueStorage.CreateTempFlashArray();
lastSetChoices = choices;
i = 0;
while (i < lastSetChoices.Size()){

choiceFlashObject = flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
choiceFlashObject.SetMemberFlashString("name", lastSetCh
oices[i].description);
choiceFlashObject.SetMemberFlashInt("icon", lastSetChoic
es[i].dialogAction);
choiceFlashObject.SetMemberFlashBool("read", lastSetChoi
ces[i].previouslyChoosen == false);
choiceFlashObject.SetMemberFlashBool("emphasis", lastSet
Choices[i].emphasised);
if (lastSetChoices[i].disabled && lastSetChoices[i].dial
ogAction == 2){
if (theGame.IsContentAvailable(lastSetChoices[i]
.playGoChunk)){
choiceFlashObject.SetMemberFlashBool("lo
cked", false);
} else {
hasContentMissing = true;
missingContent = lastSetChoices[i].playG
oChunk;
choiceFlashObject.SetMemberFlashBool("lo
cked", lastSetChoices[i].disabled);
}
} else {
choiceFlashObject.SetMemberFlashBool("locked", l
astSetChoices[i].disabled);
}
choiceFlashArray.SetElementFlashObject(i, choiceFlashObj
ect);
i += 1;
}
if (allowContentMissingDialog && hasContentMissing && !theGame.I
sContentAvailable(missingContent)){
progress = theGame.ProgressToContentAvailable(missingCon
tent);
theSound.SoundEvent("gui_global_denied");
theGame.GetGuiManager().ShowProgressDialog(UMID_MissingC
ontentOnDialogError, "", "panel_map_cannot_travel_downloading_content", true, 0,
progress, 1, missingContent);
}
flashValueStorage.SetFlashArray("hud.dialog.choices", choiceFlas
hArray);
SetGwentMode(false);
/* NOP */;
}
public function OnDialogChoiceTimeoutSet(timeOutPercent : Float){
m_fxChoiceTimeoutSetSFF.InvokeSelfOneArg(FlashArgNumber(timeOutP
ercent));
/* NOP */;
}
public function OnDialogChoiceTimeoutHide(){
m_guiManager.RequestMouseCursor(false);
theGame.ForceUIAnalog(false);
m_fxChoiceTimeoutHideSFF.InvokeSelf();
/* NOP */;
}
public function OnDialogSkipConfirmShow(){
m_fxSkipConfirmShowSFF.InvokeSelf();
/* NOP */;
}

public function OnDialogSkipConfirmHide(){


m_fxSkipConfirmHideSFF.InvokeSelf();
/* NOP */;
}
public function OpenMonsterHuntNegotiationPopup(rewardName : CName, mini
malGold : Int32, alwaysSuccessful : Bool){
var popupData : DialogueMonsterBarganingSliderData;
var rewrd : SReward;
var maxMult : Float;
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu('Mon
sterHuntNegotiationMenu');
}
popupData = new DialogueMonsterBarganingSliderData in this;
popupData.ScreenPosX = 0.050000;
popupData.ScreenPosY = 0.500000;
theGame.GetReward(rewardName, rewrd);
currentReward = rewardName;
isBet = false;
isPopupOpened = true;
m_fxSetBarValueSFF.InvokeSelfOneArg(FlashArgNumber(0));
popupData.SetMessageTitle(GetLocStringByKeyExt("panel_hud_dialog
ue_title_negotiation"));
popupData.dialogueRef = this;
popupData.BlurBackground = false;
popupData.m_DisplayGreyBackground = false;
if (anger == 0){
currentRewardMultiply = 1.000000;
minimalHagglingReward = FloorF(minimalGold);
maxMult = RandRangeF(0.500000, 0.200000);
maxHaggleValue = FloorF(minimalGold * 1.000000 + maxMult
);
currentGold = minimalHagglingReward;
if (alwaysSuccessful){
NPCsPrettyClose = 1.000000 + maxMult;
NPCsTooMuch = NPCsPrettyClose;
} else {
NPCsPrettyClose = 1.000000 + RandRangeF(0.700000
, 0.000000) * maxMult;
NPCsTooMuch = NPCsPrettyClose + 0.300000 * maxMu
lt;
}
LogHaggle("");
LogHaggle("Haggling for " + rewardName);
LogHaggle("min/base gold: " + minimalGold);
LogHaggle("max bar value: " + maxHaggleValue);
LogHaggle("default bar value (1.0): " + NoTrailZeros(cur
rentGold));
LogHaggle("deal/pretty close border (" + NoTrailZeros(NP
CsPrettyClose) + "): " + NoTrailZeros(NPCsPrettyClose * minimalGold));
LogHaggle("pretty close/too much border (" + NoTrailZero
s(NPCsTooMuch) + "): " + NoTrailZeros(NPCsTooMuch * minimalGold));
LogHaggle("");
popupData.currentValue = minimalHagglingReward;
} else {
popupData.currentValue = currentGold;
}
popupData.minValue = minimalGold;
popupData.baseValue = minimalGold;

popupData.anger = anger;
popupData.maxValue = maxHaggleValue;
theGame.RequestMenu('PopupMenu', popupData);
/* NOP */;
}
public function OpenBetPopup(rewardName : CName, overrideCurrent : Int32
){
var rewrd : SReward;
var popupData : BettingSliderData;
var flashValueStorage : CScriptedFlashValueStorage;
if (isGwentMode && thePlayer.GetMoney() == 0){
thePlayer.SetRewardMultiplier(rewardName, 0);
return;
}
flashValueStorage = GetModuleFlashValueStorage();
OnDialogPreviousSentenceSet("");
OnDialogSentenceSet("");
popupData = new BettingSliderData in this;
popupData.ScreenPosX = 0.620000;
popupData.ScreenPosY = 0.650000;
theGame.GetReward(rewardName, rewrd);
currentReward = rewardName;
currentRewardMultiply = 0;
isBet = true;
isPopupOpened = true;
popupData.SetMessageTitle(GetLocStringByKeyExt("panel_hud_dialog
ue_title_bet"));
popupData.dialogueRef = this;
popupData.BlurBackground = false;
popupData.minValue = 1;
popupData.maxValue = rewrd.gold;
if (overrideCurrent > 0){
popupData.currentValue = Max(1, Min(rewrd.gold, thePlaye
r.GetMoney())) * overrideCurrent / 100;
} else {
popupData.currentValue = rewrd.gold;
}
theGame.RequestMenu('PopupMenu', popupData);
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu('Bet
Menu');
}
/* NOP */;
}
public function DialogueSliderDataPopupResult(value : Float, monsterBarg
aningPopupMenuParent : CR4MenuPopup){
var rewrd : SReward;
var a : Float;
theGame.GetReward(currentReward, rewrd);
if (isBet){
currentRewardMultiply = value / rewrd.gold * 2;
thePlayer.RemoveMoney(RoundF(value));
thePlayer.SetRewardMultiplier(currentReward, currentRewa
rdMultiply);
isBet = false;
} else {
currentGold = FloorF(value);
currentRewardMultiply = value / rewrd.gold;
LogHaggle("Offering " + NoTrailZeros(value) + ", mult of

" + NoTrailZeros(currentRewardMultiply));
if (currentRewardMultiply > NPCsTooMuch){
m_LastNegotiationResult = 0;
a = RandRangeF(60, 40);
LogHaggle("Too Much. Increasing anger from " + N
oTrailZeros(anger) + " to " + NoTrailZeros(anger + a));
anger += a;
} else if (currentRewardMultiply > NPCsPrettyClose){
m_LastNegotiationResult = 1;
a = RandRangeF(20, 10);
LogHaggle("Pretty Close. Increasing anger from "
+ NoTrailZeros(anger) + " to " + NoTrailZeros(anger + a));
anger += a;
} else {
m_LastNegotiationResult = 2;
anger = 0;
LogHaggle("Deal!");
thePlayer.SetRewardMultiplier(currentReward, cur
rentRewardMultiply);
}
LogHaggle("");
if (anger >= 100){
m_LastNegotiationResult = 3;
anger = 0;
LogHaggle("NPC is furious - game over.");
LogHaggle("");
thePlayer.SetRewardMultiplier(currentReward, 1.0
00000);
}
isBet = false;
}
if (m_LastNegotiationResult == 2 || m_LastNegotiationResult == 3
&& theGame.GetTutorialSystem() && theGame.GetTutorialSystem().IsRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosingMenu('Mon
sterHuntNegotiationMenu');
}
m_fxSetBarValueSFF.InvokeSelfOneArg(FlashArgNumber(anger));
isPopupOpened = false;
/* NOP */;
}
public function GetLastNegotiationResult() : ENegotiationResult{
return m_LastNegotiationResult;
/* NOP */;
}
public function IsPopupOpened() : Bool{
return isPopupOpened;
/* NOP */;
}
}
class CR4MessagePopup extends CR4PopupBase{
private var m_messagesQueue : array<W3MessagePopupData>;
private var m_isMessageShown : Bool;
private var m_fxHideMessage : CScriptedFlashFunction;
private var m_fxPrepareMessageShow : CScriptedFlashFunction;
private var m_fxDisplayProgressBar : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var initDataObject : W3MessagePopupData;
super.OnConfigUI();
m_fxHideMessage = m_flashModule.GetMemberFlashFunction("hideMess

age");
m_fxDisplayProgressBar = m_flashModule.GetMemberFlashFunction("s
howProgressBar");
m_fxPrepareMessageShow = m_flashModule.GetMemberFlashFunction("p
repareMessageShowing");
initDataObject = (W3MessagePopupData)GetPopupInitData();
if (!initDataObject){
initDataObject = theGame.GetGuiManager().lastMessageData
;
}
if (!initDataObject || theGame.GetGuiManager().GetHideMessageReq
uestId() == initDataObject.messageId){
ClosePopup();
} else {
ShowMessage(initDataObject);
theInput.StoreContext('EMPTY_CONTEXT');
}
MakeModal(true);
m_guiManager.ForceHideMouseCursor(true);
theGame.ForceUIAnalog(true);
/* NOP */;
}
public function OnClosingPopup() : Bool{
super.OnClosingPopup();
theInput.RestoreContext('EMPTY_CONTEXT', true);
theGame.ForceUIAnalog(false);
m_guiManager.ForceHideMouseCursor(false);
/* NOP */;
}
public function OnAllMessagesShown() : Bool{
ClosePopup();
/* NOP */;
}
public function OnUserAction(messageId : Int32, actionId : Int32) : Bool
{
theGame.GetGuiManager().UserDialogCallback(messageId, actionId);
/* NOP */;
}
protected function AddMessageToQueue(messageData : W3MessagePopupData) :
Int32{
var iterator : Int32;
var messageListSize : Int32;
var curMessage : W3MessagePopupData;
var targetIndex : Int32;
targetIndex = -1;
messageListSize = m_messagesQueue.Size();
iterator = 0;
while (iterator < messageListSize){
curMessage = m_messagesQueue[iterator];
if (curMessage.priority < messageData.priority){
targetIndex = iterator;
break;
}
iterator += 1;
}
if (targetIndex == -1 || targetIndex >= messageListSize){
targetIndex = messageListSize;
m_messagesQueue.PushBack(messageData);
} else {
m_messagesQueue.Insert(targetIndex, messageData);

}
return targetIndex;
/* NOP */;
}
public function ShowMessage(messageData : W3MessagePopupData){
var queueIndex : Int32;
queueIndex = AddMessageToQueue(messageData);
if (queueIndex == 0){
SendMessageToAS(messageData);
}
/* NOP */;
}
public function GetCurrentMessageData() : W3MessagePopupData{
if (m_messagesQueue.Size() > 0){
return m_messagesQueue[0];
}
return NULL;
/* NOP */;
}
public function GetCurrentMsgId() : Int32{
if (m_messagesQueue.Size() > 0){
return m_messagesQueue[0].messageId;
}
return -1;
/* NOP */;
}
protected function SendMessageToAS(messageData : W3MessagePopupData){
var tempGfxObject : CScriptedFlashObject;
var gfxDataObject : CScriptedFlashObject;
var gfxActionData : CScriptedFlashObject;
var gfxActionList : CScriptedFlashArray;
var actionsList : array<UserMessageActionData>;
var i : Int32;
var len : Int32;
var msgText : String;
var currentMsgId : Int32;
m_fxPrepareMessageShow.InvokeSelfOneArg(FlashArgInt(messageData.
messageId));
currentMsgId = messageData.messageId;
tempGfxObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
gfxDataObject = tempGfxObject.CreateFlashObject("red.game.witche
r3.data.SysMessageData");
gfxDataObject.SetMemberFlashInt("id", currentMsgId);
gfxDataObject.SetMemberFlashInt("type", messageData.messageType)
;
gfxDataObject.SetMemberFlashInt("priority", messageData.priority
);
if (!messageData.autoLocalize){
msgText = messageData.messageText;
} else {
msgText = ReplaceTagsToIcons(GetLocStringByKeyExt(messag
eData.messageText));
}
gfxDataObject.SetMemberFlashString("messageText", msgText);
if (messageData.titleText == ""){
gfxDataObject.SetMemberFlashString("titleText", "");
} else {
gfxDataObject.SetMemberFlashString("titleText", ReplaceT
agsToIcons(GetLocStringByKeyExt(messageData.titleText)));

}
DisplayProgressBar(messageData.progress, messageData.progressTyp
e);
actionsList = messageData.actionsList;
len = actionsList.Size();
gfxActionList = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < len){
gfxActionData = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
gfxActionData.SetMemberFlashInt("id", actionsList[i].act
ionId);
gfxActionData.SetMemberFlashString("label", actionsList[
i].label);
gfxActionList.PushBackFlashObject(gfxActionData);
i += 1;
}
gfxDataObject.SetMemberFlashArray("buttonList", gfxActionList);
m_flashValueStorage.SetFlashObject("message.show", gfxDataObject
, /* NOP */);
/* NOP */;
}
public function HideMessage(messageId : Int32){
m_fxHideMessage.InvokeSelfOneArg(FlashArgInt(messageId));
/* NOP */;
}
public function OnMessageHidden() : Bool{
var hiddingMessage : W3MessagePopupData;
hiddingMessage = GetCurrentMessageData();
theGame.GetGuiManager().OnMessageHiding(hiddingMessage.messageId
);
m_messagesQueue.Erase(0);
if (m_messagesQueue.Size() > 0){
SendMessageToAS(m_messagesQueue[0]);
} else {
ClosePopup();
}
/* NOP */;
}
public function DisplayProgressBar(progressValue : Float, progressType :
EUserMessageProgressType){
var refreshRate : Float;
var displayString : String;
displayString = "";
switch(progressType){
case 1:
refreshRate = 2000;
displayString = "_SHOW_PERC_";
break;
case 2:
refreshRate = 200;
break;
default:
refreshRate = -1;
break;
}
m_fxDisplayProgressBar.InvokeSelfThreeArgs(FlashArgNumber(progre
ssValue), FlashArgNumber(refreshRate), FlashArgString(displayString));
/* NOP */;
}

public function OnProgressUpdateRequested() : Bool{


var progressValue : Float;
var currentMessageData : W3MessagePopupData;
currentMessageData = GetCurrentMessageData();
if (currentMessageData){
progressValue = currentMessageData.progress;
switch(currentMessageData.progressType){
case 1:
progressValue = theGame.ProgressToContentAvailab
le(currentMessageData.progressTag);
break;
case 2:
progressValue = currentMessageData.progress - 2;
currentMessageData.progress = progressValue;
if (progressValue <= 0){
HideMessage(currentMessageData.messageId
);
return true;
}
break;
}
DisplayProgressBar(progressValue, currentMessageData.pro
gressType);
}
/* NOP */;
}
}
class W3MenuInitData extends CObject{
public var ignoreSaveSystem : Bool;
private var m_defaultState : CName;
public function getDefaultState() : CName{
return m_defaultState;
/* NOP */;
}
public function setDefaultState(value : CName){
m_defaultState = value;
/* NOP */;
}
}
import abstract class CBehaviorGraphVectorVariableBaseNode{
}
class W3NotificationData extends CObject{
public var messageText : String;
public var duration : Float;
}
import abstract class SReactionSceneEvent{
}
class W3PortalConfirmationPopupData extends ConfirmationPopupData{
protected function OnUserAccept(){
theGame.GetGuiManager().SetUsePortal(true, true);
/* NOP */;
}
protected function OnUserDecline(){
theGame.GetGuiManager().SetUsePortal(false, true);
/* NOP */;

}
protected function GetAcceptText() : String{
return "panel_button_common_accept";
/* NOP */;
}
protected function GetDeclineText() : String{
return "panel_button_common_exit";
/* NOP */;
}
}
class CHudEvent extends CObject{
public var moduleName : String;
public var eventName : String;
}
class CNotifyPlayerEnteredInteriorEvent extends CHudEvent{
public var areaPos : Vector;
public var areaYaw : Float;
public var texture : String;
}
class CNotifyPlayerExitedInteriorEvent extends CHudEvent{
}
class CNotifyPlayerMountedBoatEvent extends CHudEvent{
}
class CNotifyPlayerDismountedBoatEvent extends CHudEvent{
}
class COnQuestTrackingStartedEvent extends CHudEvent{
public var journalQuest : CJournalQuest;
}
class CR4HudModuleQuests extends CR4HudModuleBase{
private var m_systemQuest : CJournalQuest;
private var m_systemObjectives : array<SJournalQuestObjectiveData>;
private var m_userObjectives : array<SJournalQuestObjectiveData>;
private var m_updateEvents : array<SUpdateEvent>;
private var manager : CWitcherJournalManager;
private var m_fxShowTrackedQuestSFF : CScriptedFlashFunction;
private var m_fxUpdateObjectiveCounterSFF : CScriptedFlashFunction;
private var m_fxUpdateObjectiveHighlightSFF : CScriptedFlashFunction;
private var m_fxUpdateObjectiveUnhighlightAllSFF : CScriptedFlashFunctio
n;
private var m_fxSetSystemQuestInfo : CScriptedFlashFunction;
private var m_fxSetUserQuestInfo : CScriptedFlashFunction;
private var m_guiManager : CR4GuiManager;
private var m_hud : CR4ScriptedHud;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
m_anchorName = "mcAnchorQuest";
super.OnConfigUI();
m_guiManager = theGame.GetGuiManager();
m_hud = (CR4ScriptedHud)theGame.GetHud();
flashModule = GetModuleFlash();
m_fxShowTrackedQuestSFF = flashModule.GetMemberFlashFunction("Sh
owTrackedQuest");
m_fxUpdateObjectiveCounterSFF = flashModule.GetMemberFlashFuncti

on("UpdateObjectiveCounter");
m_fxUpdateObjectiveHighlightSFF = flashModule.GetMemberFlashFunc
tion("UpdateObjectiveHighlight");
m_fxUpdateObjectiveUnhighlightAllSFF = flashModule.GetMemberFlas
hFunction("UpdateObjectiveUnhighlightAll");
m_fxSetSystemQuestInfo = flashModule.GetMemberFlashFunction("Set
SystemQuestInfo");
m_fxSetUserQuestInfo = flashModule.GetMemberFlashFunction("SetUs
erQuestInfo");
manager = theGame.GetJournalManager();
theInput.RegisterListener(this, 'OnHighlightNextObjective', 'Hig
hlightObjective');
UpdateQuest();
if (m_hud){
m_hud.UpdateHudConfig('QuestsModule', true);
}
/* NOP */;
}
public function OnLevelUp(){
UpdateQuest();
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var i : Int32;
var e : SUpdateEvent;
var systemObjectives : array<SJournalQuestObjectiveData>;
var sendSystemObjectives : Bool;
sendSystemObjectives = false;
if (CheckIfUpdateIsAllowed() && m_updateEvents.Size()){
systemObjectives = m_systemObjectives;
i = 0;
while (i < m_updateEvents.Size()){
e = m_updateEvents[i];
if (e.delay == 0){
switch(e.eventType){
case 0:
UpdateQuest();
break;
case 1:
break;
case 2:
UpdateObjectives();
sendSystemObjectives = true;
break;
case 3:
SendObjectiveCounter((CJournalQu
estObjective)e.journalBase);
break;
case 4:
HighlightObjective((CJournalQues
tObjective)e.journalBase, e.index);
break;
}
m_updateEvents.Erase(i);
} else {
m_updateEvents[i].delay -= 1;
i += 1;
}
/* NOP */;
}

if (sendSystemObjectives){
SendObjectives();
}
}
/* NOP */;
}
public function CheckIfUpdateIsAllowed() : Bool{
switch(m_hud.currentInputContext){
case 'FastMenu':
case 'TutorialPopup':
case 'RadialMenu':
case 'Scene':
return false;
break;
default:
return true;
}
return true;
/* NOP */;
}
public function OnHighlightNextObjective(action : SInputAction) : Bool{
var walkToggleAction : SInputAction;
if (thePlayer.IsCameraLockedToTarget() && thePlayer.GetCurrentSt
ateName() == 'Exploration' || thePlayer.GetCurrentStateName() == 'TraverseExplor
ation'){
thePlayer.HardLockToTarget(false);
} else if (thePlayer.IsActionAllowed(7)){
walkToggleAction = theInput.GetAction('WalkToggle');
if (IsReleased(action, /* NOP */) && walkToggleAction.la
stFrameValue < 0.700000 && walkToggleAction.value < 0.700000){
if (ShouldProcessTutorial('TutorialObjectiveSwit
ching')){
FactsAdd('tut_switched_objective', /* NO
P */, /* NOP */);
}
theGame.GetJournalManager().SetPrevNextHighlight
edObjective(true);
}
}
/* NOP */;
}
public function OnQuestTrackingStarted(journalQuest : CJournalQuest){
var e : SUpdateEvent;
e.eventType = 0;
e.delay = 0;
e.journalBase = journalQuest;
m_updateEvents.PushBack(e);
/* NOP */;
}
public function OnTrackedQuestUpdated(journalQuest : CJournalQuest){
var e : SUpdateEvent;
e.eventType = 1;
e.delay = 1;
e.journalBase = journalQuest;
m_updateEvents.PushBack(e);
/* NOP */;
}
public function OnTrackedQuestObjectivesUpdated(journalObjective : CJour
nalQuestObjective){
var e : SUpdateEvent;

e.eventType = 2;
e.delay = 1;
e.journalBase = journalObjective;
m_updateEvents.PushBack(e);
/* NOP */;
}
public function OnTrackedQuestObjectiveCounterUpdated(journalObjective :
CJournalQuestObjective){
var e : SUpdateEvent;
e.eventType = 3;
e.delay = 1;
e.journalBase = journalObjective;
m_updateEvents.PushBack(e);
/* NOP */;
}
public function OnTrackedQuestObjectiveHighlighted(journalObjective : CJ
ournalQuestObjective, objectiveIndex : Int32){
var e : SUpdateEvent;
e.eventType = 4;
e.delay = 2;
e.journalBase = journalObjective;
e.index = objectiveIndex;
m_updateEvents.PushBack(e);
/* NOP */;
}
private function Test(){
var objectives1 : array<SJournalQuestObjectiveData>;
var objectives2 : array<SJournalQuestObjectiveData>;
theGame.GetJournalManager().GetTrackedQuestObjectivesData(object
ives1);
HAXGetTrackedObjectives(objectives2);
if (objectives1.Size() != objectives2.Size()){
/* NOP */;
}
/* NOP */;
}
private function UpdateQuest(){
m_systemQuest = manager.GetTrackedQuest();
if (m_systemQuest){
UpdateObjectives();
SendQuestName();
SendObjectives();
ShowQuestTracker(true);
} else {
ShowQuestTracker(false);
}
/* NOP */;
}
private function UpdateObjectives(){
var l_objectives : array<SJournalQuestObjectiveData>;
var i : Int32;
theGame.GetJournalManager().GetTrackedQuestObjectivesData(l_obje
ctives);
m_systemObjectives.Clear();
i = 0;
while (i < l_objectives.Size()){
if (l_objectives[i].status == 1){
m_systemObjectives.PushBack(l_objectives[i]);
}
i += 1;

}
/* NOP */;
}
public function HAXGetTrackedObjectives(l_objectives : array<SJournalQue
stObjectiveData>){
var journalQuest : CJournalQuest;
var l_questPhase : CJournalQuestPhase;
var l_objective : CJournalQuestObjective;
var journalObjectiveData : SJournalQuestObjectiveData;
var l_objectiveStatus : EJournalStatus;
var i : Int32;
var j : Int32;
journalQuest = manager.GetTrackedQuest();
i = 0;
while (i < journalQuest.GetNumChildren()){
l_questPhase = (CJournalQuestPhase)journalQuest.GetChild
(i);
if (l_questPhase){
j = 0;
while (j < l_questPhase.GetNumChildren()){
l_objective = (CJournalQuestObjective)l_
questPhase.GetChild(j);
l_objectiveStatus = manager.GetEntryStat
us(l_objective);
if (l_objectiveStatus > 0){
journalObjectiveData.status = l_
objectiveStatus;
journalObjectiveData.objectiveEn
try = l_objective;
l_objectives.PushBack(journalObj
ectiveData);
}
j += 1;
}
}
i += 1;
}
/* NOP */;
}
private function SendQuestName(){
var flashValueStorage : CScriptedFlashValueStorage;
var questName : String;
var searchQuestName : String;
var questCount : Int32;
var questLevel : Int32;
var lvlDiff : Int32;
var j : Int32;
var questTooHard : Bool;
var questLevels : C2dArray;
var questLevelsCount : Int32;
var iterQuestLevels : Int32;
flashValueStorage = GetModuleFlashValueStorage();
questName = GetLocStringById(m_systemQuest.GetTitleStringId());
if (questName == ""){
questName = "MISSING_QUEST_NAME: " + m_systemQuest.baseN
ame;
}
questLevelsCount = theGame.questLevelsContainer.Size();
iterQuestLevels = 0;
while (iterQuestLevels < questLevelsCount){

questLevels = theGame.questLevelsContainer[iterQuestLeve
ls];
questCount = questLevels.GetNumRows();
j = 0;
while (j < questCount){
searchQuestName = questLevels.GetValueAtAsName(0
, j);
if (searchQuestName == m_systemQuest.baseName){
questLevel = NameToInt(questLevels.GetVa
lueAtAsName(1, j));
if (FactsQuerySum("NewGamePlus") > 0){
questLevel += theGame.params.Get
NewGamePlusLevel();
}
}
j += 1;
}
iterQuestLevels += 1;
}
lvlDiff = questLevel - thePlayer.GetLevel();
if ((W3ReplacerCiri)thePlayer){
questTooHard = false;
} else {
questTooHard = lvlDiff >= theGame.params.LEVEL_DIFF_HIGH
;
}
m_fxSetSystemQuestInfo.InvokeSelfThreeArgs(FlashArgString(questN
ame), FlashArgInt(GetColorByQuestType(m_systemQuest)), FlashArgBool(questTooHard
));
/* NOP */;
}
private function SendObjectives(){
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var data : SJournalQuestObjectiveData;
var i : Int32;
var objectiveName : String;
l_flashArray = GetModuleFlashValueStorage().CreateTempFlashArray
();
i = 0;
while (i < m_systemObjectives.Size()){
data = m_systemObjectives[i];
l_flashObject = GetModuleFlashValueStorage().CreateTempF
lashObject(/* NOP */);
objectiveName = GetLocStringById(data.objectiveEntry.Get
TitleStringId());
if (objectiveName == ""){
objectiveName = "MISSING_OBJECTIVE_NAME: " + dat
a.objectiveEntry.baseName;
}
l_flashObject.SetMemberFlashString("name", objectiveName
+ GetCounterText(data.objectiveEntry));
l_flashObject.SetMemberFlashInt("status", data.status);
if (m_guiManager.FindDisplayedObjectiveGUID(data.objecti
veEntry.guid)){
l_flashObject.SetMemberFlashBool("isNew", false)
;
} else {
l_flashObject.SetMemberFlashBool("isNew", true);
m_guiManager.SaveDisplayedObjectiveGUID(data.obj

ectiveEntry.guid);
}
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
GetModuleFlashValueStorage().SetFlashArray("hud.quest.system.obj
ectives", l_flashArray);
ShowQuestTracker(m_systemObjectives.Size() > 0);
/* NOP */;
}
public function SendObjectiveCounter(objective : CJournalQuestObjective)
{
var str : String;
if (objective.GetCount() <= 0){
return;
}
str = GetLocStringById(objective.GetTitleStringId()) + GetCounte
rText(objective);
m_fxUpdateObjectiveCounterSFF.InvokeSelfThreeArgs(FlashArgInt(0)
, FlashArgInt(GetObjectiveIndex(objective)), FlashArgString(str));
/* NOP */;
}
public function HighlightObjective(objective : CJournalQuestObjective, o
bjectiveIndex : Int32){
var commonMapManager : CCommonMapManager;
var journalManager : CWitcherJournalManager;
var i : Int32;
var highlightedObjective : CJournalQuestObjective;
var highlightedMapPin : CJournalQuestMapPin;
commonMapManager = theGame.GetCommonMapManager();
journalManager = theGame.GetJournalManager();
m_fxUpdateObjectiveUnhighlightAllSFF.InvokeSelf();
m_fxUpdateObjectiveHighlightSFF.InvokeSelfThreeArgs(FlashArgInt(
objectiveIndex), FlashArgBool(true), FlashArgBool(true));
/* NOP */;
}
private function ShowQuestTracker(show : Bool){
m_fxShowTrackedQuestSFF.InvokeSelfTwoArgs(FlashArgInt(0), FlashA
rgBool(show));
/* NOP */;
}
private function GetObjectiveIndex(objective : CJournalQuestObjective) :
Int32{
var i : Int32;
i = 0;
while (i < m_systemObjectives.Size()){
if (objective == m_systemObjectives[i].objectiveEntry){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function GetCounterText(objectiveEntry : CJournalQuestObjective)
: String{
var language : String;
var audioLanguage : String;
theGame.GetGameLanguageName(audioLanguage, language);
if (objectiveEntry.GetCount() > 0){

if (language == "AR"){
return manager.GetQuestObjectiveCount(objectiveE
ntry.guid) + "/" + objectiveEntry.GetCount() + "&nbsp;";
} else {
return "&nbsp;" + manager.GetQuestObjectiveCount
(objectiveEntry.guid) + "/" + objectiveEntry.GetCount();
}
}
return "";
/* NOP */;
}
protected function GetColorByQuestType(journalQuest : CJournalQuest) : I
nt32{
switch(journalQuest.GetType()){
case 0:
return 16763904;
case 1:
return 12288567;
case 2:
case 3:
case 4:
return 12632256;
}
return 16777215;
/* NOP */;
}
public function ShowElement(show : Bool, bImmediately : Bool){
m_fxShowElementSFF.InvokeSelfTwoArgs(FlashArgBool(show), FlashAr
gBool(bImmediately));
/* NOP */;
}
public function SetEnabled(value : Bool){
m_bEnabled = value;
m_fxSetEnabledSFF.InvokeSelfOneArg(FlashArgBool(m_bEnabled));
/* NOP */;
}
}
class COnTrackedQuestObjectiveHighlightedEvent extends CHudEvent{
public var journalObjective : CJournalQuestObjective;
public var journalObjectiveIndex : Int32;
}
import abstract class CBehTreeDistanceBasedTicketAlgorithmField{
}
class CNotifyInputContextChangedEvent extends CHudEvent{
public var inputContextName : CName;
}
class CR4HudModuleControlsFeedback extends CR4HudModuleBase{
private var m_fxSetSwordTextSFF : CScriptedFlashFunction;
private var m_fxMakeVisible : CScriptedFlashFunction;
private var m_flashValueStorage : CScriptedFlashValueStorage;
private var m_currentInputContext : CName;
private var m_previousInputContext : CName;
private var m_currentPlayerWeapon : EPlayerWeapon;
private var m_displaySprint : Bool;
private var m_displayJump : Bool;
private var m_displayCallHorse : Bool;

private var m_displayDiveDown : Bool;


private var m_displayGallop : Bool;
private var m_displayCanter : Bool;
private var m_movementLockType : EPlayerMovementLockType;
private var m_lastUsedPCInput : Bool;
private var m_CurrentHorseComp : W3HorseComponent;
private const var KEY_CONTROLS_FEEDBACK_LIST : String;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorControlsFeedback";
m_displaySprint = thePlayer.IsActionAllowed(14);
super.OnConfigUI();
flashModule = GetModuleFlash();
m_flashValueStorage = GetModuleFlashValueStorage();
m_fxSetSwordTextSFF = flashModule.GetMemberFlashFunction("setSwo
rdText");
m_fxMakeVisible = flashModule.GetMemberFlashFunction("MakeVisibl
e");
SetTickInterval(0.500000);
hud = (CR4ScriptedHud)theGame.GetHud();
UpdateInputContext(hud.currentInputContext);
if (hud){
hud.UpdateHudConfig('ControlsFeedbackModule', true);
}
/* NOP */;
}
public function UpdateInputContext(inputContextName : CName){
m_currentInputContext = inputContextName;
if (m_currentInputContext == 'JumpClimb'){
SendInputContextActions('Exploration', /* NOP */);
return;
}
SendInputContextActions(inputContextName, /* NOP */);
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (!CanTick(timeDelta) || !GetEnabled()){
return true;
}
if (m_currentPlayerWeapon != thePlayer.GetCurrentMeleeWeaponType
()){
m_currentPlayerWeapon = thePlayer.GetCurrentMeleeWeaponT
ype();
UpdateSwordDisplay();
}
if (m_lastUsedPCInput != theInput.LastUsedPCInput()){
UpdateInputContextActions();
} else if (m_currentInputContext == thePlayer.GetExplorationInpu
tContext() || m_currentInputContext == 'JumpClimb'){
if (m_displaySprint != thePlayer.IsActionAllowed(14) ||
thePlayer.movementLockType != m_movementLockType || m_displayCallHorse != thePla
yer.IsActionAllowed(4) || m_displayJump != thePlayer.IsActionAllowed(10)){
UpdateInputContextActions();
}
} else if (m_currentInputContext == 'Diving' || m_currentInputCo
ntext == 'Swimming'){
if (m_displaySprint != thePlayer.IsActionAllowed(14) ||
m_displayDiveDown != thePlayer.OnAllowedDiveDown()){
UpdateInputContextActions();

}
} else if (m_currentInputContext == 'Horse'){
m_CurrentHorseComp = thePlayer.GetUsedHorseComponent();
if (m_displayGallop != m_CurrentHorseComp.OnCanGallop()
|| m_displayCanter != m_CurrentHorseComp.OnCanCanter()){
UpdateInputContextActions();
}
}
/* NOP */;
}
public function UpdateInputContextActions(){
if (m_currentInputContext != thePlayer.GetCombatInputContext()){
if (m_currentInputContext == 'JumpClimb'){
SendInputContextActions('Exploration', true);
} else {
SendInputContextActions(m_currentInputContext, t
rue);
}
}
/* NOP */;
}
public function ForceModuleUpdate(){
SendInputContextActions(m_currentInputContext, true);
/* NOP */;
}
public function SetEnabled(value : Bool){
super.SetEnabled(value);
SendInputContextActions(m_currentInputContext, true);
/* NOP */;
}
private function UpdateSwordDisplay(){
switch(m_currentPlayerWeapon){
case 2:
m_fxSetSwordTextSFF.InvokeSelfOneArg(FlashArgString(GetL
ocStringByKeyExt("panel_inventory_paperdoll_slotname_silver")));
break;
case 1:
m_fxSetSwordTextSFF.InvokeSelfOneArg(FlashArgString(GetL
ocStringByKeyExt("panel_inventory_paperdoll_slotname_steel")));
break;
default:
m_fxSetSwordTextSFF.InvokeSelfOneArg(FlashArgString(""))
;
break;
}
/* NOP */;
}
private function SendInputContextActions(inputContextName : CName, isFor
ced : Bool){
var l_FlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var bindingGFxData : CScriptedFlashObject;
var bindingGFxData2 : CScriptedFlashObject;
var l_ActionsArray : array<CName>;
var l_swimingSprint : Bool;
var i : Int32;
var outKeys : array<EInputKey>;
var outKeysPC : array<EInputKey>;
var labelPrefix : String;
var curAction : CName;

var bracketOpeningSymbol : String;


var bracketClosingSymbol : String;
var actionLabel : String;
var attackKeysPC : array<EInputKey>;
var attackModKeysPC : array<EInputKey>;
var alterAttackKeysPC : array<EInputKey>;
var modifier : EInputKey;
GetBracketSymbols(bracketOpeningSymbol, bracketClosingSymbol, /*
NOP */);
l_FlashArray = m_flashValueStorage.CreateTempFlashArray();
l_ActionsArray.Clear();
l_swimingSprint = false;
if (GetEnabled()){
if (!isForced && m_previousInputContext == m_currentInpu
tContext || m_previousInputContext == 'JumpClimb' && m_currentInputContext == 'E
xploration' || m_previousInputContext == 'Exploration' && m_currentInputContext
== 'JumpClimb'){
return;
}
m_movementLockType = thePlayer.movementLockType;
m_displaySprint = thePlayer.IsActionAllowed(14);
m_displayCallHorse = thePlayer.IsActionAllowed(4);
m_lastUsedPCInput = theInput.LastUsedPCInput();
m_displayDiveDown = thePlayer.OnAllowedDiveDown();
m_displayJump = thePlayer.IsActionAllowed(10);
m_CurrentHorseComp = thePlayer.GetUsedHorseComponent();
m_displayGallop = m_CurrentHorseComp.OnCanGallop();
m_displayCanter = m_CurrentHorseComp.OnCanCanter();
switch(inputContextName){
case 'JumpClimb':
return;
case 'Exploration':
if (m_displaySprint){
l_ActionsArray.PushBack('Sprint');
}
if (m_displayJump){
l_ActionsArray.PushBack('Jump');
}
if (!thePlayer.IsCiri()){
l_ActionsArray.PushBack('Focus');
if (m_displayCallHorse){
l_ActionsArray.PushBack('SpawnHo
rse');
}
}
break;
case 'Exploration_Replacer_Ciri':
if (m_displaySprint){
l_ActionsArray.PushBack('Sprint');
}
if (m_displayJump){
l_ActionsArray.PushBack('Jump');
}
break;
case 'Horse':
if (m_displayGallop){
l_ActionsArray.PushBack('Gallop');
}
if (m_displayCanter){
l_ActionsArray.PushBack('Canter');

case

case
case

case

case
case
case

case

}
l_ActionsArray.PushBack('HorseDismount');
break;
'Boat':
l_ActionsArray.PushBack('GI_Accelerate');
l_ActionsArray.PushBack('GI_Decelerate');
l_ActionsArray.PushBack('BoatDismount');
break;
'BoatPassenger':
l_ActionsArray.PushBack('BoatDismount');
break;
'Swimming':
l_ActionsArray.PushBack('DiveDown');
if (m_displaySprint){
l_ActionsArray.PushBack('Sprint');
}
l_swimingSprint = true;
break;
'Diving':
if (m_displayDiveDown){
l_ActionsArray.PushBack('DiveDown');
}
l_ActionsArray.PushBack('DiveUp');
if (m_displaySprint){
l_ActionsArray.PushBack('Sprint');
}
l_swimingSprint = true;
break;
'FistFight':
'CombatFists':
'Combat':
if (thePlayer.IsInCombatFist()){
l_ActionsArray.PushBack('AttackLight');
l_ActionsArray.PushBack('AttackHeavy');
l_ActionsArray.PushBack('LockAndGuard');
l_ActionsArray.PushBack('Dodge');
} else {
l_ActionsArray.PushBack('AttackLight');
l_ActionsArray.PushBack('AttackHeavy');
l_ActionsArray.PushBack('Dodge');
l_ActionsArray.PushBack('CastSign');
}
break;
'Combat_Replacer_Ciri':
l_ActionsArray.PushBack('AttackLight');
l_ActionsArray.PushBack('CiriDodge');
if (thePlayer.HasAbility('CiriCharge')){
l_ActionsArray.PushBack('CiriSpecialAtta

ckHeavy');
}
if (thePlayer.HasAbility('CiriBlink')){
l_ActionsArray.PushBack('CiriSpecialAtta
ck');
}
break;
default:
break;
}
i = 0;
while (i < l_ActionsArray.Size()){

curAction = l_ActionsArray[i];
outKeys.Clear();
outKeysPC.Clear();
theInput.GetPadKeysForAction(curAction, outKeys)
;
if (m_lastUsedPCInput){
modifier = 0;
attackModKeysPC.Clear();
theInput.GetPCKeysForAction('PCAlternate
', attackModKeysPC);
switch(curAction){
case 'AttackLight':
attackKeysPC.Clear();
theInput.GetPCKeysForAction('Att
ackWithAlternateLight', attackKeysPC);
if (attackKeysPC.Size() > 0 && a
ttackKeysPC[0] != 0){
outKeysPC.PushBack(attac
kKeysPC[0]);
} else {
alterAttackKeysPC.Clear(
);
theInput.GetPCKeysForAct
ion('AttackWithAlternateHeavy', alterAttackKeysPC);
if (attackModKeysPC.Size
() > 0 && alterAttackKeysPC.Size() > 0 && attackModKeysPC[0] != 0 && alterAttack
KeysPC[0] != 0){
outKeysPC.PushBa
ck(alterAttackKeysPC[0]);
modifier = attac
kModKeysPC[0];
}
}
break;
case 'AttackHeavy':
case 'CiriSpecialAttackHeavy':
attackKeysPC.Clear();
theInput.GetPCKeysForAction('Att
ackWithAlternateHeavy', attackKeysPC);
if (attackKeysPC.Size() > 0 && a
ttackKeysPC[0] != 0){
outKeysPC.PushBack(attac
kKeysPC[0]);
} else {
alterAttackKeysPC.Clear(
);
theInput.GetPCKeysForAct
ion('AttackWithAlternateLight', alterAttackKeysPC);
if (attackModKeysPC.Size
() > 0 && alterAttackKeysPC.Size() > 0 && attackModKeysPC[0] != 0 && alterAttack
KeysPC[0] != 0){
outKeysPC.PushBa
ck(alterAttackKeysPC[0]);
modifier = attac
kModKeysPC[0];
}
}
break;
default:
theInput.GetPCKeysForAction(curA

ction, outKeysPC);
break;
}
}
switch(curAction){
case 'Sprint':
break;
case 'HorseDismount':
outKeys.PushBack(137);
break;
default:
break;
}
l_DataFlashObject = m_flashValueStorage.CreateTe
mpFlashObject(/* NOP */);
bindingGFxData = l_DataFlashObject.CreateFlashOb
ject("red.game.witcher3.data.KeyBindingData");
bindingGFxData.SetMemberFlashInt("gamepad_keyCod
e", outKeys[0]);
if (outKeysPC.Size() > 0){
bindingGFxData.SetMemberFlashInt("keyboa
rd_keyCode", outKeysPC[0]);
} else {
bindingGFxData.SetMemberFlashInt("keyboa
rd_keyCode", 0);
}
if (modifier != 0){
bindingGFxData.SetMemberFlashInt("altKey
Code", modifier);
}
if (curAction == 'Sprint' && m_currentInputConte
xt != 'Swimming' && m_currentInputContext != 'Diving'){
if (m_movementLockType != 0){
curAction = 'Run';
}
}
switch(curAction){
case 'Gallop':
labelPrefix = "<font color="#CD7D03">" +
bracketOpeningSymbol + GetLocStringByKeyExt("ControlLayout_doubleTap") + bracke
tClosingSymbol + "</font>";
break;
case 'SpawnHorse':
if (!m_lastUsedPCInput){
labelPrefix = "<font color="#CD7
D03">" + bracketOpeningSymbol + GetLocStringByKeyExt("ControlLayout_doubleTap")
+ bracketClosingSymbol + "</font>";
} else {
labelPrefix = "";
}
break;
case 'Sprint':
if (!theInput.IsToggleSprintBound()){
labelPrefix = "<font color="#CD7
D03">" + bracketOpeningSymbol + GetLocStringByKeyExt("ControlLayout_hold") + bra
cketClosingSymbol + "</font>";
}
break;
case 'HorseDismount':
if (m_lastUsedPCInput){

labelPrefix = "";
} else {
labelPrefix = "<font color="#CD7
D03">" + bracketOpeningSymbol + GetLocStringByKeyExt("ControlLayout_hold") + bra
cketClosingSymbol + "</font>";
}
break;
case 'Run':
case 'GI_Accelerate':
case 'GI_Decelerate':
case 'Canter':
case 'Focus':
case 'Roll':
case 'DiveUp':
case 'DiveDown':
case 'CiriSpecialAttackHeavy':
case 'CiriSpecialAttack':
labelPrefix = "<font color="#CD7D03">" +
bracketOpeningSymbol + GetLocStringByKeyExt("ControlLayout_hold") + bracketClos
ingSymbol + "</font>";
break;
default:
labelPrefix = "";
break;
}
if (curAction == 'Jump'){
actionLabel = GetLocStringByKeyExt("pane
l_button_common_jump");
} else if (curAction == 'Sprint' && m_currentInp
utContext == 'Swimming' || m_currentInputContext == 'Diving'){
actionLabel = GetLocStringByKeyExt("pane
l_input_action_fast_swiming");
} else if (curAction == 'SpawnHorse'){
actionLabel = GetLocStringByKeyExt("Cont
rolLayout_SummonHorse");
} else if (curAction == 'BoatDismount' && inputC
ontextName == 'Boat'){
actionLabel = GetLocStringByKeyExt("pane
l_button_common_disembark");
} else if (curAction == 'CiriDodge'){
actionLabel = GetLocStringByKeyExt("Cont
rolLayout_Dodge");
} else if (curAction == 'CiriSpecialAttackHeavy'
){
actionLabel = GetLocStringByKeyExt("Cont
rolLayout_CiriCharge");
} else if (curAction == 'CiriSpecialAttack'){
actionLabel = GetLocStringByKeyExt("Cont
rolLayout_CiriBlink");
} else {
actionLabel = GetLocStringByKeyExt("pane
l_input_action_" + StrLower(curAction));
}
bindingGFxData.SetMemberFlashString("label", " <
font color="#FFFFFF">" + actionLabel + "</font> " + labelPrefix);
l_FlashArray.PushBackFlashObject(bindingGFxData)
;
i += 1;
}
}

if (l_ActionsArray.Size() > 0){


m_flashValueStorage.SetFlashArray(KEY_CONTROLS_FEEDBACK_
LIST, l_FlashArray);
} else {
m_fxMakeVisible.InvokeSelfOneArg(FlashArgBool(false));
}
m_previousInputContext = m_currentInputContext;
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
return super.UpdateScale(scale * 0.750000, flashModule);
/* NOP */;
}
protected function UpdatePosition(anchorX : Float, anchorY : Float){
var l_flashModule : CScriptedFlashSprite;
var tempX : Float;
var tempY : Float;
l_flashModule = GetModuleFlash();
tempX = anchorX - 300.000000 * 1.000000 - theGame.GetUIHorizonta
lFrameScale();
tempY = anchorY - 200.000000 * 1.000000 - theGame.GetUIVerticalF
rameScale();
l_flashModule.SetX(tempX);
l_flashModule.SetY(tempY);
/* NOP */;
}
public function OnControllerChanged() : Bool{
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
}
}
class CNotifyBossIndicatorShownEvent extends CHudEvent{
public var enable : Bool;
public var bossTag : CName;
}
class CR4HudModuleBossFocus extends CR4HudModuleBase{
private var m_bossEntity : CActor;
private var m_bossName : String;
private var m_fxSetBossName : CScriptedFlashFunction;
private var m_fxSetBossHealth : CScriptedFlashFunction;
private var m_fxSetEssenceDamage : CScriptedFlashFunction;
private var m_lastHealthPercentage : Int32;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorBossFocus";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetBossName = flashModule.GetMemberFlashFunction("setBossNam
e");
m_fxSetBossHealth = flashModule.GetMemberFlashFunction("setBossH
ealth");
m_fxSetEssenceDamage = flashModule.GetMemberFlashFunction("setEs
senceDamage");
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){

hud.UpdateHudConfig('BossFocusModule', true);
}
/* NOP */;
}
public function ShowBossIndicator(enable : Bool, bossTag : CName, bossEn
tity : CActor){
if (enable){
if (bossEntity){
m_bossEntity = bossEntity;
UpdateNameAndHealth(true);
} else {
thePlayer.SetBossTag(bossTag);
UpdateNameAndHealth(true);
}
} else {
thePlayer.SetBossTag('None');
OnHide();
m_bossEntity = NULL;
m_bossName = "";
}
/* NOP */;
}
private function OnShow(){
ShowElement(true, /* NOP */);
if (m_bossEntity){
m_bossEntity.AddTag('HideHealthBarModule');
}
/* NOP */;
}
private function OnHide(){
ShowElement(false, /* NOP */);
if (m_bossEntity){
m_bossEntity.RemoveTag('HideHealthBarModule');
m_bossEntity = NULL;
m_bossName = "";
}
/* NOP */;
}
private function UpdateNameAndHealth(onShow : Bool){
var bossName : String;
var bossTag : CName;
var l_currentHealthPercentage : Int32;
if (!m_bossEntity){
bossTag = thePlayer.GetBossTag();
if (IsNameValid(bossTag)){
m_bossEntity = theGame.GetActorByTag(bossTag);
if (m_bossEntity){
OnShow();
}
}
} else if (onShow){
OnShow();
}
if (m_bossEntity){
bossName = m_bossEntity.GetDisplayName(/* NOP */);
if (onShow || m_bossName != bossName){
m_bossName = bossName;
m_fxSetBossName.InvokeSelfOneArg(FlashArgString(
m_bossEntity.GetDisplayName(/* NOP */)));
}

if (onShow){
m_fxSetEssenceDamage.InvokeSelfOneArg(FlashArgBo
ol(m_bossEntity.UsesEssence()));
}
l_currentHealthPercentage = CeilF(100 * m_bossEntity.Get
HealthPercents());
if (m_lastHealthPercentage != l_currentHealthPercentage)
{
m_fxSetBossHealth.InvokeSelfOneArg(FlashArgInt(l
_currentHealthPercentage));
m_lastHealthPercentage = l_currentHealthPercenta
ge;
}
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (!m_bossEntity){
UpdateNameAndHealth(true);
} else {
UpdateNameAndHealth(false);
}
/* NOP */;
}
}
class COnGasAreaEvent extends CHudEvent{
public var entered : Bool;
}
import struct ITicketAlgorithmScriptDefinition{
}
class CR4HudModuleOxygenBar extends CR4HudModuleBase{
private var m_fxSetOxygeneSFF : CScriptedFlashFunction;
private var oxygenePerc : Float;
private var forceShowElement : Bool;
private var bOxygeneBar : Bool;
private var bIsBarFull : Bool;
private saved var isInGasArea : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorOxygenBar";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetOxygeneSFF = flashModule.GetMemberFlashFunction("setOxyge
ne");
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('OxygenBarModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var player : CR4Player;
var check : Bool;
player = thePlayer;
check = forceShowElement || player.OnCheckDiving() || !bIsBarFul
l && player.IsSwimming() || isInGasArea || !bIsBarFull && FactsQuerySum("player_

was_in_gas_area");
if (check){
UpdateOxygene();
}
/* NOP */;
}
private function UpdateOxygene(){
var percents : Float;
percents = thePlayer.GetStatPercents(6);
if (percents != oxygenePerc){
oxygenePerc = percents;
bIsBarFull = percents == 1;
m_fxSetOxygeneSFF.InvokeSelfOneArg(FlashArgNumber(percen
ts));
}
/* NOP */;
}
public function EnableElement(enable : Bool){
bOxygeneBar = !enable;
ShowElement(enable, /* NOP */);
/* NOP */;
}
public function ForceShowElement(force : Bool){
forceShowElement = force;
/* NOP */;
}
public function SetIsInGasArea(b : Bool){
isInGasArea = b;
/* NOP */;
}
}
import abstract class CTicketSourceConfiguration{
}
import abstract class CSwarmCellMap{
}
class CR4MenuPopup extends CR4OverlayMenu{
public var m_DataObject : W3PopupData;
private var m_initialized : Bool;
private var m_HideTutorial : Bool;
private var m_fxSetBarValueSFF : CScriptedFlashFunction;
private var rttItemLoaded : Bool;
private var itemRotation : EulerAngles;
private var itemPosition : Vector;
private var itemScale : Vector;
private var itemCat : CName;
public function OnConfigUI() : Bool{
m_initialized = false;
MakeModal(true);
m_flashModule = GetMenuFlash();
m_flashValueStorage = GetMenuFlashValueStorage();
m_forceHideTutorial = false;
m_hideTutorial = true;
super.OnConfigUI();
m_fxSetBarValueSFF = m_flashModule.GetMemberFlashFunction("setBa
rValue");
m_DataObject = (W3PopupData)GetMenuInitData();
if (!m_DataObject){

CloseMenu();
} else {
m_DataObject.SetupOverlayRef(this);
m_BlurBackground = m_DataObject.BlurBackground;
m_PauseGame = m_DataObject.PauseGame;
m_HideTutorial = m_DataObject.HideTutorial;
CreatePopupInstance(m_DataObject);
}
if (m_BlurBackground){
BlurBackground(this, true);
}
if (m_PauseGame){
theGame.Pause("Popup");
}
if (m_HideTutorial){
theGame.GetGuiManager().HideTutorial(true, true);
}
theInput.StoreContext('EMPTY_CONTEXT');
theGame.GetGuiManager().RequestMouseCursor(true);
theGame.ForceUIAnalog(true);
m_initialized = true;
/* NOP */;
}
public function SetButtons(){
}
public function OnSetQuantity(QuantityValue : Int32) : Bool{
var quantityData : SliderPopupData;
quantityData = (SliderPopupData)m_DataObject;
if (quantityData){
quantityData.currentValue = QuantityValue;
}
/* NOP */;
}
public function OnContextActionChange(navCode : String, autoExec : Bool)
: Bool{
var contextMenuData : W3ContextMenu;
contextMenuData = (W3ContextMenu)m_DataObject;
if (contextMenuData){
contextMenuData.curActionNavCode = navCode;
if (autoExec){
contextMenuData.OnUserFeedback("enter-gamepad_A"
);
}
}
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
m_DataObject.OnUserFeedback(NavCode);
/* NOP */;
}
public function OnClosingMenu() : Bool{
var commonMenuRef : CR4CommonMenu;
commonMenuRef = theGame.GetGuiManager().GetCommonMenu();
if (commonMenuRef){
commonMenuRef.UpdateInputFeedback();
}
if (m_initialized){
if (m_HideTutorial){
theGame.GetGuiManager().HideTutorial(false, true

);
}
if (m_PauseGame){
theGame.Unpause("Popup");
}
theInput.RestoreContext('EMPTY_CONTEXT', false);
theGame.GetGuiManager().RequestMouseCursor(false);
theGame.ForceUIAnalog(false);
}
super.OnClosingMenu();
/* NOP */;
}
public function RequestClose(){
if (m_DataObject){
delete m_DataObject;
}
super.RequestClose();
/* NOP */;
}
protected function CreatePopupInstance(PopupDataObject : W3PopupData){
var GFxDataObject : CScriptedFlashObject;
var GFxButtonsListData : CScriptedFlashArray;
m_DataObject = PopupDataObject;
GFxDataObject = m_DataObject.GetGFxData(m_flashValueStorage);
GFxButtonsListData = m_DataObject.GetGFxButtons(m_flashValueStor
age);
GFxDataObject.SetMemberFlashArray("ButtonsList", GFxButtonsListD
ata);
GFxDataObject.SetMemberFlashNumber("ScreenPosX", m_DataObject.Sc
reenPosX);
GFxDataObject.SetMemberFlashNumber("ScreenPosY", m_DataObject.Sc
reenPosY);
m_flashValueStorage.SetFlashObject("popup.data", GFxDataObject,
/* NOP */);
/* NOP */;
}
public function UpdatePopupInstance(PopupDataObject : W3PopupData){
CreatePopupInstance(PopupDataObject);
/* NOP */;
}
protected function BlurBackground(firstLayer : CR4MenuBase, value : Bool
){
if (firstLayer.m_parentMenu){
BlurBackground(firstLayer.m_parentMenu, value);
firstLayer.m_parentMenu.BlurLayer(value);
}
/* NOP */;
}
public function SetBarValue(value : Float){
m_fxSetBarValueSFF.InvokeSelfOneArg(FlashArgNumber(value));
/* NOP */;
}
public function ShowItemRTT(templateName : String, itemCategory : CName)
{
rttItemLoaded = false;
itemCat = itemCategory;
ShowRenderToTexture(templateName);
/* NOP */;
}
public function HideItemRTT(){

m_flashValueStorage.SetFlashBool("render.to.texture.texture.visi
ble", false, /* NOP */);
/* NOP */;
}
protected function UpdateSceneEntityFromCreatureDataComponent(entity : C
Entity){
super.UpdateSceneEntityFromCreatureDataComponent(entity);
UpdateItemScale();
m_flashValueStorage.SetFlashBool("render.to.texture.texture.visi
ble", true, /* NOP */);
m_flashValueStorage.SetFlashBool("render.to.texture.loading", fa
lse, /* NOP */);
rttItemLoaded = true;
/* NOP */;
}
private function UpdateItemScale(){
var guiSceneController : CR4GuiSceneController;
var itemScaleKoeff : Float;
itemScaleKoeff = 2;
itemPosition.X = 0;
itemPosition.Y = 0;
itemPosition.Z = 0;
switch(itemCat){
case 'bolt':
case 'secondary':
case 'steelsword':
itemScaleKoeff = 2;
break;
case 'silversword':
break;
case 'crossbow':
itemScaleKoeff = 3;
break;
case 'armor':
itemScaleKoeff = 1.300000;
break;
case 'pants':
itemScaleKoeff = 2;
break;
case 'gloves':
itemScaleKoeff = 1.300000;
break;
case 'boots':
itemScaleKoeff = 3;
break;
return;
break;
default:
break;
}
itemScale.X = itemScaleKoeff;
itemScale.Y = itemScaleKoeff;
itemScale.Z = itemScaleKoeff;
guiSceneController.SetEntityTransform(itemPosition, itemRotation
, itemScale);
/* NOP */;
}
public function OnGuiSceneEntitySpawned(entity : CEntity) : Bool{
UpdateItemScale();
UpdateSceneEntityFromCreatureDataComponent(entity);

Event_OnGuiSceneEntitySpawned();
/* NOP */;
}
public function OnRotateItemRight() : Bool{
RotateItem(-10);
/* NOP */;
}
public function OnRotateItemLeft() : Bool{
RotateItem(10);
/* NOP */;
}
private function RotateItem(delta : Float){
var guiSceneController : CR4GuiSceneController;
if (rttItemLoaded){
guiSceneController = theGame.GetGuiManager().GetSceneCon
troller();
if (guiSceneController){
itemRotation.Yaw += delta;
guiSceneController.SetEntityTransform(itemPositi
on, itemRotation, itemScale);
}
}
/* NOP */;
}
}
import abstract class CFlyingSwarmGroup{
//NULL type for groupId
//NULL type for currentGroupState
//NULL type for changeGroupState
//NULL type for groupCenter
//NULL type for toDespawnCount
//NULL type for boidCount
//NULL type for despawnPoiType
//NULL type for toSpawnCount
//NULL type for spawnPoiType
}
class CR4BlacksmithMenu extends CR4MenuBase{
private var _disassembleInv : W3GuiDisassembleInventoryComponent;
private var _repairInv : W3GuiRepairInventoryComponent;
private var _socketInv : W3GuiSocketsInventoryComponent;
private var _curInv : W3GuiBaseInventoryComponent;
protected var _tooltipDataProvider : W3TooltipComponent;
protected var _inv : CInventoryComponent;
protected var _fixerNpc : CNewNPC;
protected var _fixerInventory : CInventoryComponent;
private var m_menuInited : Bool;
private var m_lastConfirmedDisassembleQuantity : Int32;
private var MAX_ITEM_NR : Int32;
private var currentItemsNr : Int32;
private var InitDataConfirmation : PriceConfirmationPopupData;
private var repairAllPopupData : RepairAllPopupData;
private var quantityPopupData : QuantityPopupData;
private var m_fxRemoveItem : CScriptedFlashFunction;
private var m_fxConfirmAction : CScriptedFlashFunction;
private var m_fxSetPlayerMoney : CScriptedFlashFunction;
private var m_fxSetXActionLabel : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var l_flashPaperdoll : CScriptedFlashSprite;

var l_flashInventory : CScriptedFlashSprite;


var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var l_obj : IScriptable;
var l_fixerEntity : CGameplayEntity;
var l_initData : W3InventoryInitData;
var hasUpgrades : Bool;
var items : array<SItemUniqueId>;
var i : Int32;
m_menuInited = false;
super.OnConfigUI();
m_initialSelectionsToIgnore = 0;
l_obj = GetMenuInitData();
l_initData = (W3InventoryInitData)l_obj;
if (l_initData){
l_fixerEntity = l_initData.containerNPC;
} else {
l_fixerEntity = (CGameplayEntity)l_obj;
}
if (l_fixerEntity){
_fixerNpc = (CNewNPC)l_fixerEntity;
_fixerInventory = l_fixerEntity.GetInventory();
}
_inv = thePlayer.GetInventory();
m_flashModule = GetMenuFlash();
m_fxConfirmAction = m_flashModule.GetMemberFlashFunction("confir
mAction");
m_fxSetPlayerMoney = m_flashModule.GetMemberFlashFunction("setPl
ayerMoney");
m_fxRemoveItem = m_flashModule.GetMemberFlashFunction("removeIte
m");
m_fxSetXActionLabel = m_flashModule.GetMemberFlashFunction("setX
ActionLabel");
_tooltipDataProvider = new W3TooltipComponent in this;
_tooltipDataProvider.initialize(_inv, m_flashValueStorage);
_tooltipDataProvider.setCurrentInventory(_inv);
_repairInv = new W3GuiRepairInventoryComponent in this;
_repairInv.Initialize(_inv);
_repairInv.merchantInv = _fixerInventory;
_repairInv.repairArmors = true;
_repairInv.repairSwords = true;
_repairInv.masteryLevel = 5;
_socketInv = new W3GuiSocketsInventoryComponent in this;
_socketInv.Initialize(_inv);
_socketInv.SetSocketsFilter(true);
_socketInv.merchantInv = _fixerInventory;
_disassembleInv = new W3GuiDisassembleInventoryComponent in this
;
_disassembleInv.Initialize(_inv);
_disassembleInv.merchantInv = _fixerInventory;
m_menuInited = true;
ApplyMenuState(m_menuState);
m_flashValueStorage.SetFlashString("repair.grid.player.name", Ge
tLocStringByKeyExt("panel_inventory_grid_name"), /* NOP */);
/* NOP */;
}
public function SetMenuState(newState : CName){
var i : Int32;
var hasUpgrades : Bool;
var items : array<SItemUniqueId>;

if (newState == 'Sockets'){
m_initialSelectionsToIgnore = 1;
}
super.SetMenuState(newState);
if (m_menuInited){
ApplyMenuState(newState);
}
if (m_menuState == 'Sockets' && ShouldProcessTutorial('TutorialU
pgRemovalDescription')){
thePlayer.inv.GetAllItems(items);
hasUpgrades = false;
i = 0;
while (i < items.Size()){
if (thePlayer.inv.GetItemEnhancementCount(items[
i]) > 0){
hasUpgrades = true;
break;
}
i += 1;
}
GameplayFactsSet("tutorial_upg_removal_cond", hasUpgrade
s);
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(GetM
enuName());
} else if (m_menuState == 'Disassemble' && ShouldProcessTutorial
('TutorialDismantleDescription')){
items = _curInv.GetAllItems();
i = 0;
while (i < items.Size()){
if (_curInv.ShouldShowItem(items[i])){
GameplayFactsSet("tut_dismantle_cond", 1
);
theGame.GetTutorialSystem().uiHandler.On
OpeningMenu(GetMenuName());
break;
}
i += 1;
}
}
/* NOP */;
}
protected function ApplyMenuState(newState : CName){
switch(newState){
case 'Repair':
_curInv = _repairInv;
break;
case 'Sockets':
_curInv = _socketInv;
break;
case 'Disassemble':
_curInv = _disassembleInv;
break;
default:
break;
}
UpdateRepairAllInputFeedback(newState);
UpdateData();
/* NOP */;
}
protected function UpdateRepairAllInputFeedback(newState : CName){

var repairString : String;


var totalRepairCost : Int32;
repairString = "";
if (newState == 'Repair'){
totalRepairCost = _repairInv.GetTotalRepairCost();
if (totalRepairCost > 0){
repairString = GetLocStringByKeyExt("panel_butto
n_common_repair_all") + " (" + totalRepairCost + ")";
}
}
m_fxSetXActionLabel.InvokeSelfOneArg(FlashArgString(repairString
));
/* NOP */;
}
public function OnClearSlotNewFlag(item : SItemUniqueId) : Bool{
RemoveNewItemMark(item);
/* NOP */;
}
public function RemoveNewItemMark(item : SItemUniqueId){
if (_inv.IsIdValid(item)){
_curInv.ClearItemIsNewFlag(item);
}
/* NOP */;
}
public function HandleActionConfirmation(value : Bool){
m_fxConfirmAction.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
public function OnRequestConfirmation(itemId : SItemUniqueId, price : In
t32) : Bool{
if (m_menuState == 'Disassemble' && _inv.GetItemQuantity(itemId)
> 1){
if (_inv.GetMoney() < price){
showNotification(GetLocStringByKeyExt("panel_sho
p_notification_not_enough_money"), /* NOP */);
HandleActionConfirmation(false);
OnPlaySoundEvent("gui_global_denied");
} else {
ShowDisassembleQuantityPopup(itemId, price);
}
} else {
ShowConfirmationPopup(itemId, price, 1);
}
/* NOP */;
}
public function ShowConfirmationPopup(itemId : SItemUniqueId, price : In
t32, quantity : Int32){
var confirmationTitle : String;
var confirmationText : String;
var costRepairPoint : Int32;
var invItem : SInventoryItem;
var playerMoney : Int32;
playerMoney = _inv.GetMoney();
invItem = _inv.GetItem(itemId);
switch(m_menuState){
case 'Repair':
confirmationText = "panel_repair_popup_repair_item_text"
;
confirmationTitle = "panel_button_common_repair";
break;

case 'Sockets':
confirmationText = "panel_blacksmith_remove_improvement_
confirmation";
confirmationTitle = "panel_title_blacksmith_sockets";
break;
case 'Disassemble':
confirmationText = "panel_repair_popup_disassemble_item_
text";
confirmationTitle = "panel_title_blacksmith_disassamble"
;
m_lastConfirmedDisassembleQuantity = quantity;
break;
default:
confirmationText = "ERROR: Undefined menu state";
confirmationTitle = "ERROR: Undefined menu state";
break;
}
if (playerMoney >= price){
if (m_lastConfirmedDisassembleQuantity > 1){
HandleActionConfirmation(true);
} else {
InitDataConfirmation = new PriceConfirmationPopu
pData in this;
InitDataConfirmation.menuRef = this;
InitDataConfirmation.BlurBackground = true;
if (confirmationText != ""){
InitDataConfirmation.SetMessageText(GetL
ocStringByKeyExt(confirmationText));
}
if (confirmationTitle != ""){
InitDataConfirmation.SetMessageTitle(Get
LocStringByKeyExt(confirmationTitle));
}
InitDataConfirmation.SetPrice(price);
RequestSubMenu('PopupMenu', InitDataConfirmation
);
}
} else {
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_not_enough_money"), /* NOP */);
HandleActionConfirmation(false);
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
public function OnDisassembleStack(itemId : SItemUniqueId, price : Int32
, quantity : Int32){
var playerMoney : Int32;
playerMoney = _inv.GetMoney();
if (playerMoney >= price){
m_lastConfirmedDisassembleQuantity = quantity;
HandleActionConfirmation(true);
} else {
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_not_enough_money"), /* NOP */);
HandleActionConfirmation(false);
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}

private function ShowDisassembleQuantityPopup(itemId : SItemUniqueId, pr


ice : Int32){
var maxValue : Int32;
maxValue = _inv.GetItemQuantity(itemId);
if (quantityPopupData){
delete quantityPopupData;
}
quantityPopupData = new QuantityPopupData in this;
quantityPopupData.showPrice = true;
quantityPopupData.itemCost = price;
quantityPopupData.itemId = itemId;
quantityPopupData.minValue = 1;
quantityPopupData.currentValue = _inv.GetItemQuantity(itemId);
quantityPopupData.maxValue = _inv.GetItemQuantity(itemId);
quantityPopupData.actionType = 5;
quantityPopupData.blacksmithRef = this;
RequestSubMenu('PopupMenu', quantityPopupData);
/* NOP */;
}
public function OnRemoveImprovements(item : SItemUniqueId, price : Int32
) : Bool{
var socketItems : array<CName>;
var itemsListText : String;
var idx : Int32;
var len : Int32;
_inv.GetItemEnhancementItems(item, socketItems);
itemsListText = GetLocStringByKeyExt("panel_blacksmith_items_add
ed");
len = socketItems.Size();
idx = 0;
while (idx < len){
itemsListText += "<br/> +" + GetLocStringByKeyExt(_inv.G
etItemLocalizedNameByName(socketItems[idx]));
idx += 1;
}
_fixerInventory.AddMoney(price);
_inv.RemoveMoney(price);
_inv.RemoveAllItemEnhancements(item);
if (_inv.GetItemQuantity(item) > 1){
UpdateItem(item);
} else {
RemoveItem(item);
}
UpdatePlayerMoney();
UpdateMerchantData();
theSound.SoundEvent('gui_inventory_buy');
/* NOP */;
}
public function OnDisassembleItem(item : SItemUniqueId, price : Int32) :
Bool{
var partList : array<SItemParts>;
var currentPartList : array<SItemParts>;
var runesList : array<CName>;
var itemsListText : String;
var idx : Int32;
var len : Int32;
var i : Int32;
var x : Int32;
var entryFound : Bool;
var itemsCount : Int32;

var craftComp : W3CraftsmanComponent;


var itemsAdded : array<SItemUniqueId>;
var itemsToUpdate : array<SItemUniqueId>;
var curPart : SItemUniqueId;
itemsListText = "<font face="$BoldFont">" + GetLocStringByKeyExt
("panel_blacksmith_items_removed") + ": </font>";
itemsListText += "<br/>" + GetLocStringByKeyExt(_inv.GetItemLoca
lizedNameByUniqueID(item)) + " x" + m_lastConfirmedDisassembleQuantity;
partList = _inv.GetItemRecyclingParts(item);
len = partList.Size();
idx = 0;
while (idx < len){
partList[idx].quantity = _inv.GetItemQuantityByName(part
List[idx].itemName, /* NOP */);
idx += 1;
}
itemsListText += "<br/>" + "<font face="$BoldFont">" + GetLocStr
ingByKeyExt("panel_blacksmith_items_added") + ": </font>";
_fixerInventory.AddMoney(price * m_lastConfirmedDisassembleQuant
ity);
_inv.RemoveMoney(price * m_lastConfirmedDisassembleQuantity);
if (_inv.GetItemEnhancementCount(item) > 0){
_inv.GetItemEnhancementItems(item, runesList);
idx = 0;
while (idx < runesList.Size()){
_inv.AddAnItem(runesList[idx], /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
itemsListText += "<br/>" + GetLocStringByKeyExt(
_inv.GetItemLocalizedNameByName(runesList[idx])) + " x1";
idx += 1;
}
}
craftComp = (W3CraftsmanComponent)_fixerNpc.GetComponentByClassN
ame('W3CraftsmanComponent');
i = 0;
while (i < m_lastConfirmedDisassembleQuantity){
if (craftComp){
if (craftComp.IsCraftsmanType(1)){
itemsAdded = _inv.RecycleItem(item, craf
tComp.GetCraftsmanLevel(1));
} else if (craftComp.IsCraftsmanType(2)){
itemsAdded = _inv.RecycleItem(item, craf
tComp.GetCraftsmanLevel(2));
} else {
itemsAdded = _inv.RecycleItem(item, 1);
}
} else {
itemsAdded = _inv.RecycleItem(item, 1);
}
i += 1;
}
idx = 0;
while (idx < len){
itemsCount = _inv.GetItemQuantityByName(partList[idx].it
emName, /* NOP */) - partList[idx].quantity;
itemsListText += "<br/>" + GetLocStringByKeyExt(_inv.Get
ItemLocalizedNameByName(partList[idx].itemName)) + " x" + itemsCount;
idx += 1;
}
showNotification(itemsListText, /* NOP */);

if (_inv.GetItemQuantity(item) > 0){


itemsToUpdate.PushBack(item);
} else {
RemoveItem(item);
}
len = itemsAdded.Size();
idx = 0;
while (idx < len){
curPart = itemsAdded[idx];
partList.Clear();
partList = _inv.GetItemRecyclingParts(curPart);
if (partList.Size() > 0){
itemsToUpdate.PushBack(curPart);
}
idx += 1;
}
if (itemsToUpdate.Size() > 0){
UpdateItemsList(itemsToUpdate);
}
UpdatePlayerMoney();
UpdateMerchantData();
theSound.SoundEvent('gui_inventory_buy');
/* NOP */;
}
public function OnStartCrafting() : Bool{
OnPlaySoundEvent("gui_crafting_craft_item");
/* NOP */;
}
public function OnRepairItem(item : SItemUniqueId, price : Int32) : Bool
{
_repairInv.RepairItem(item, 1);
_fixerInventory.AddMoney(price);
_inv.RemoveMoney(price);
if (_inv.GetItemQuantity(item) > 1){
UpdateItem(item);
} else {
RemoveItem(item);
}
UpdatePlayerMoney();
UpdateMerchantData();
theSound.SoundEvent('gui_inventory_buy');
theSound.SoundEvent('gui_inventory_repair');
UpdateRepairAllInputFeedback('Repair');
/* NOP */;
}
public function OnRepairAllItems() : Bool{
var totalRepairCost : Int32;
totalRepairCost = _repairInv.GetTotalRepairCost();
if (_inv.GetMoney() < totalRepairCost){
showNotification(GetLocStringByKeyExt("panel_shop_notifi
cation_not_enough_money"), /* NOP */);
HandleActionConfirmation(false);
OnPlaySoundEvent("gui_global_denied");
} else {
repairAllPopupData = new RepairAllPopupData in this;
repairAllPopupData.menuRef = this;
repairAllPopupData.BlurBackground = true;
repairAllPopupData.SetPrice(totalRepairCost);
RequestSubMenu('PopupMenu', repairAllPopupData);
}

/* NOP */;
}
public function RepairAll(){
var emptyString : String;
var totalRepairCost : Int32;
emptyString = "";
totalRepairCost = _repairInv.GetTotalRepairCost();
_repairInv.RepairAllItems(1);
_fixerInventory.AddMoney(totalRepairCost);
_inv.RemoveMoney(totalRepairCost);
UpdatePlayerMoney();
UpdateMerchantData();
theSound.SoundEvent('gui_inventory_buy');
theSound.SoundEvent('gui_inventory_repair');
InventoryUpdateAll();
m_fxSetXActionLabel.InvokeSelfOneArg(FlashArgString(emptyString)
);
/* NOP */;
}
public function OnGetItemData(item : SItemUniqueId, compareItemType : In
t32) : Bool{
ShowItemTooltip(item, compareItemType);
/* NOP */;
}
public function OnGlobalUpdate() : Bool{
UpdateData();
/* NOP */;
}
public function OnSaveItemGridPosition(item : SItemUniqueId, gridPos : I
nt32) : Bool{
var UIData : SInventoryItemUIData;
UIData = _inv.GetInventoryItemUIData(item);
UIData.gridPosition = gridPos;
/* NOP */;
}
public function UpdateData(){
InventoryUpdateAll();
UpdateItemsCounter();
UpdateMerchantData();
m_fxSetPlayerMoney.InvokeSelfOneArg(FlashArgInt(thePlayer.GetMon
ey()));
/* NOP */;
}
public function InventoryUpdateAll(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
if (_curInv){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashArray = m_flashValueStorage.CreateTempFlashArray(
);
_curInv.GetInventoryFlashArray(l_flashArray, l_flashObje
ct);
m_flashValueStorage.SetFlashArray("repair.grid.player",
l_flashArray);
}
/* NOP */;
}
public function UpdateMerchantData(){
var l_merchantData : CScriptedFlashObject;

l_merchantData = m_flashValueStorage.CreateTempFlashObject(/* NO
P */);
GetNpcInfo(_fixerNpc, l_merchantData);
m_flashValueStorage.SetFlashObject("blacksmith.merchant.info", l
_merchantData, /* NOP */);
/* NOP */;
}
public function InventoryUpdateItems(itemsList : array<SItemUniqueId>){
var i : Int32;
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
var itemsDataList : CScriptedFlashArray;
if (_curInv){
itemsDataList = m_flashValueStorage.CreateTempFlashArray
();
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
i = 0;
while (i < itemsList.Size()){
itemDataObject = tempFlashObject.CreateFlashObje
ct("red.game.witcher3.menus.common.ItemDataStub");
_curInv.SetInventoryFlashObjectForItem(itemsList
[i], itemDataObject);
itemsDataList.PushBackFlashObject(itemDataObject
);
i += 1;
}
m_flashValueStorage.SetFlashArray("repair.grid.player.it
emsUpdate", itemsDataList);
}
/* NOP */;
}
public function UpdatePlayerMoney(){
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.UpdatePlayerOrens();
}
/* NOP */;
}
private function UpdateItemsList(itemsList : array<SItemUniqueId>){
var tempFlashObject : CScriptedFlashObject;
var tempFlashArray : CScriptedFlashArray;
var itemDataObject : CScriptedFlashObject;
var idx : Int32;
var len : Int32;
tempFlashObject = m_flashValueStorage.CreateTempFlashObject(/* N
OP */);
tempFlashArray = m_flashValueStorage.CreateTempFlashArray();
len = itemsList.Size();
idx = 0;
while (idx < len){
itemDataObject = tempFlashObject.CreateFlashObject("red.
game.witcher3.menus.common.ItemDataStub");
_curInv.SetInventoryFlashObjectForItem(itemsList[idx], i
temDataObject);
tempFlashArray.PushBackFlashObject(itemDataObject);
idx += 1;
}
m_flashValueStorage.SetFlashArray("blacksmith.item.list.update",

tempFlashArray);
/* NOP */;
}
private function UpdateItem(item : SItemUniqueId){
var tempFlashObject : CScriptedFlashObject;
var itemDataObject : CScriptedFlashObject;
if (_curInv){
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
itemDataObject = tempFlashObject.CreateFlashObject("red.
game.witcher3.menus.common.ItemDataStub");
_curInv.SetInventoryFlashObjectForItem(item, itemDataObj
ect);
m_flashValueStorage.SetFlashObject("blacksmith.items.upd
ate", itemDataObject, /* NOP */);
}
/* NOP */;
}
private function RemoveItem(item : SItemUniqueId){
m_fxRemoveItem.InvokeSelfTwoArgs(FlashArgUInt(ItemToFlashUInt(it
em)), FlashArgBool(false));
/* NOP */;
}
private function UpdateItemsCounter(){
var itemsNr : Int32;
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
itemsNr = commonMenu.UpdateItemsCounter();
}
if (itemsNr >= MAX_ITEM_NR && currentItemsNr != itemsNr){
currentItemsNr = itemsNr;
}
/* NOP */;
}
public function GetCurrentInventory() : CInventoryComponent{
return _inv;
/* NOP */;
}
public function GetItemDefaultActionName(item : SItemUniqueId) : String{
var itemAction : EInventoryActionType;
itemAction = GetItemDefaultAction(item);
return GetItemActionFriendlyName(itemAction, GetWitcherPlayer().
IsItemEquipped(item));
/* NOP */;
}
public function GetItemDefaultAction(item : SItemUniqueId) : EInventoryA
ctionType{
return 12;
/* NOP */;
}
public function OnCloseMenu() : Bool{
CloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
/* NOP */;
}
public function OnClosingMenu() : Bool{
if (_repairInv){

delete _repairInv;
}
if (_socketInv){
delete _socketInv;
}
if (InitDataConfirmation){
delete InitDataConfirmation;
}
if (quantityPopupData){
delete quantityPopupData;
}
if (repairAllPopupData){
delete repairAllPopupData;
}
theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
super.OnClosingMenu();
/* NOP */;
}
public function OnMoveItem(item : SItemUniqueId, moveToIndex : Int32) :
Bool{
}
public function OnMoveItems(item : SItemUniqueId, moveToIndex : Int32, i
temSecond : SItemUniqueId, moveToSecondIndex : Int32) : Bool{
}
public function OnPlaySound(soundKey : String) : Bool{
theSound.SoundEvent(soundKey);
/* NOP */;
}
public function OnSetCurrentPlayerGrid(value : String) : Bool{
}
public function OnEquipItem(item : SItemUniqueId, slot : Int32, quantity
: Int32) : Bool{
}
public function ShowItemTooltip(item : SItemUniqueId, compareItemType :
Int32){
var tooltipData : CScriptedFlashObject;
tooltipData = _tooltipDataProvider.GetTooltipData(item, true, tr
ue);
m_flashValueStorage.SetFlashObject("context.tooltip.data", toolt
ipData, /* NOP */);
/* NOP */;
}
public function OnShowItemPopup(item : SItemUniqueId) : Bool{
var initData : ItemInfoPopupData;
initData = new ItemInfoPopupData in this;
initData.invRef = GetCurrentInventory();
initData.itemId = item;
RequestSubMenu('PopupMenu', initData);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
public function OnAppendGFxButton(actionId : Int32, gamepadNavCode : Str
ing, keyboardKeyCode : Int32, label : String, holdPrefix : Bool) : Bool{
var newButtonDef : SKeyBinding;
RemoveGFxButtonById(actionId);
newButtonDef.ActionID = actionId;
newButtonDef.Gamepad_NavCode = gamepadNavCode;
newButtonDef.Keyboard_KeyCode = keyboardKeyCode;

if (holdPrefix){
newButtonDef.LocalizationKey = GetHoldLabel() + " " + Ge
tLocStringByKeyExt(label);
newButtonDef.IsLocalized = true;
} else {
newButtonDef.LocalizationKey = label;
}
if (actionId == 1002){
newButtonDef.IsLocalized = true;
}
m_GFxInputBindings.PushBack(newButtonDef);
/* NOP */;
}
}
import abstract class CExtAnimSoundEvent{
}
state W3PlayerWitcherStateCombatSilver in W3PlayerWitcher extends W3PlayerWitche
rStateCombatSword{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.OnEquipMeleeWeapon(2, true, /* NOP */);
CombatSilverInit(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CombatSilverDone(nextStateName);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function GetSwordType() : CName{
return 'silversword';
/* NOP */;
}
public entry function CombatSilverInit(prevStateName : CName){
parent.OnEquipMeleeWeapon(2, false, /* NOP */);
parent.SetBIsCombatActionAllowed(true);
BuildComboPlayer();
ProcessStartupAction(startupAction);
CombatSilverLoop();
/* NOP */;
}
public entry function CombatSilverDone(nextStateName : CName){
if (nextStateName != 'AimThrow' && nextStateName != 'CombatSteel
' && nextStateName != 'CombatFists'){
parent.SetBehaviorVariable('playerCombatStance', 0, /* N
OP */);
}
/* NOP */;
}
private latent function CombatSilverLoop(){
while (true){
Sleep(0.500000);
}
/* NOP */;
}
public final function HACK_ExternalCombatComboUpdate(timeDelta : Float){
InteralCombatComboUpdate(timeDelta);
/* NOP */;

}
}
state W3PlayerWitcherStateCombatSteel in W3PlayerWitcher extends W3PlayerWitcher
StateCombatSword{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
CombatSteelInit(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CombatSteelDone(nextStateName);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function GetSwordType() : CName{
return 'steelsword';
/* NOP */;
}
public entry function CombatSteelInit(prevStateName : CName){
parent.OnEquipMeleeWeapon(1, true, /* NOP */);
parent.SetBIsCombatActionAllowed(true);
BuildComboPlayer();
ProcessStartupAction(startupAction);
CombatSteelLoop();
/* NOP */;
}
public entry function CombatSteelDone(nextStateName : CName){
if (nextStateName != 'AimThrow' && nextStateName != 'CombatSilve
r' && nextStateName != 'CombatFists'){
parent.SetBehaviorVariable('playerCombatStance', 0, /* N
OP */);
}
/* NOP */;
}
private latent function CombatSteelLoop(){
while (true){
Sleep(0.500000);
}
/* NOP */;
}
public final function HACK_ExternalCombatComboUpdate(timeDelta : Float){
InteralCombatComboUpdate(timeDelta);
/* NOP */;
}
}
import struct CJournalTutorialGroup{
import public final function GetNameStringId() : Int32;
import public final function GetImage() : String;
}
import struct CJournalTutorial{
import public final function
import public final function
import public final function
import public final function
}

GetDescriptionStringId() : Int32;
GetNameStringId() : Int32;
GetImagePath() : String;
GetVideoPath() : String;

class W3TooltipComponent extends CObject{

protected var m_playerInv : CInventoryComponent;


protected var m_itemInv : CInventoryComponent;
protected var m_shopInv : CInventoryComponent;
protected var m_flashValueStorage : CScriptedFlashValueStorage;
public function initialize(inventory : CInventoryComponent, flashValueSt
orage : CScriptedFlashValueStorage){
m_playerInv = inventory;
m_flashValueStorage = flashValueStorage;
/* NOP */;
}
public function setCurrentInventory(invComponent : CInventoryComponent){
m_itemInv = invComponent;
/* NOP */;
}
public function setShopInventory(invComponent : CInventoryComponent){
m_shopInv = invComponent;
/* NOP */;
}
public function GetEmptySlotData(equipID : Int32) : CScriptedFlashObject
{
var tooltipData : CScriptedFlashObject;
tooltipData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
tooltipData.SetMemberFlashString("ItemType", GetLocStringByKeyEx
t(GetLocNameFromEquipSlot(equipID)));
tooltipData.SetMemberFlashString("Description", GetLocStringByKe
yExt("panel_inventory_tooltip_empty_slot"));
return tooltipData;
/* NOP */;
}
public function GetEmptyPreparationSlotData(equipID : Int32, isLocked :
Bool) : CScriptedFlashObject{
var tooltipData : CScriptedFlashObject;
tooltipData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
if (isLocked){
tooltipData.SetMemberFlashString("Description", GetLocSt
ringByKeyExt("panel_inventory_tooltip_locked_slot"));
} else {
tooltipData.SetMemberFlashString("Description", GetLocSt
ringByKeyExt("panel_inventory_tooltip_empty_slot"));
}
if (equipID == 1 || equipID == 2){
tooltipData.SetMemberFlashString("ItemType", GetLocStrin
gByKeyExt("panel_inventory_paperdoll_slotname_oils"));
} else {
tooltipData.SetMemberFlashString("ItemType", GetLocStrin
gByKeyExt(GetLocNameFromEquipSlot(equipID)));
}
return tooltipData;
/* NOP */;
}
public function GetBaseItemData(item : SItemUniqueId, itemInvComponent :
CInventoryComponent, isShopItem : Bool, compareWithItem : SItemUniqueId, compar
eItemInv : CInventoryComponent) : CScriptedFlashObject{
var wplayer : W3PlayerWitcher;
var tooltipData : CScriptedFlashObject;
var genericStatsList : CScriptedFlashArray;
var statsList : CScriptedFlashArray;
var propsList : CScriptedFlashArray;

var socketsList : CScriptedFlashArray;


var itemName : CName;
var itemLabel : String;
var itemSlot : EEquipmentSlots;
var equipedItem : SItemUniqueId;
var equipedItemName : CName;
var equipedItemStats : array<SAttributeTooltip>;
var weightAttribute : SAbilityAttributeValue;
var categoryName : CName;
var categoryLabel : String;
var typeString : String;
var typeDesc : String;
var weightValue : Float;
var primaryStatLabel : String;
var primaryStatValue : Float;
var primaryStatOriginValue : Float;
var primaryStatDiff : String;
var primaryStatDiffValue : Float;
var primaryStatDiffStr : String;
var eqPrimaryStatLabel : String;
var eqPrimaryStatValue : Float;
var primaryStatDurabilityPenalty : Float;
var durMult : Float;
var uniqueDescription : String;
var durabilityValue : Int32;
var durabilityStrValue : String;
var durabilityLabel : String;
var durabilityRatio : Float;
var armorType : String;
var notForSaleText : String;
var enableComparing : Bool;
var itemStats : array<SAttributeTooltip>;
var compStats : array<SAttributeTooltip>;
var isWeaponOrArmor : Bool;
var hackStat : SItemGenericStat;
var isArmorOrWeapon : Bool;
var tmpStr : String;
var invItem : SInventoryItem;
var invItemPrice : Int32;
var invItemPriceString : String;
var allItems : array<SItemUniqueId>;
var i : Int32;
var j : Int32;
var m_schematicList : array<CName>;
var m_recipeList : array<CName>;
var itemCategory : CName;
var requiredLevel : String;
var additionalDescription : String;
var alchRecipe : SAlchemyRecipe;
var craftSchematic : SCraftingSchematic;
var craftItemName : CName;
var craftItemCategory : CName;
var craftItemSlot : EEquipmentSlots;
var ignorePrimaryStat : Bool;
var itemAttributePrefix : String;
var canBeCompared : Bool;
var itemLevel : Int32;
var definitionsMgr : CDefinitionsManagerAccessor;
if (!IsInited()){
/* NOP */;

return NULL;
}
if (!itemInvComponent.IsIdValid(item)){
/* NOP */;
return NULL;
}
if (!compareItemInv){
compareItemInv = m_playerInv;
}
definitionsMgr = theGame.GetDefinitionsManager();
wplayer = GetWitcherPlayer();
tooltipData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
propsList = tooltipData.CreateFlashArray();
socketsList = tooltipData.CreateFlashArray();
statsList = tooltipData.CreateFlashArray();
isArmorOrWeapon = itemInvComponent.IsItemAnyArmor(item) || itemI
nvComponent.IsItemWeapon(item);
itemName = itemInvComponent.GetItemName(item);
itemLabel = GetLocStringByKeyExt(itemInvComponent.GetItemLocaliz
edNameByUniqueID(item));
itemSlot = itemInvComponent.GetSlotForItemId(item);
categoryName = itemInvComponent.GetItemCategory(item);
additionalDescription = "";
craftItemName = 'None';
if (categoryName == 'crafting_schematic'){
craftSchematic = GetSchematicDataFromXML(itemName);
craftItemName = craftSchematic.craftedItemName;
} else if (categoryName == 'alchemy_recipe'){
alchRecipe = GetRecipeDataFromXML(itemName);
craftItemName = alchRecipe.cookedItemName;
}
if (craftItemName != 'None'){
craftItemCategory = definitionsMgr.GetItemCategory(craft
ItemName);
itemInvComponent.GetItemStatsFromName(craftItemName, ite
mStats);
wplayer.GetItemEquippedOnSlot(GetSlotForItemByCategory(c
raftItemCategory), equipedItem);
additionalDescription = "<br/><br/><font size = '21' col
or = '#B58D45'>";
additionalDescription += StrUpperUTF(GetLocStringByKeyEx
t(m_playerInv.GetItemLocalizedNameByName(craftItemName))) + "</font>";
ignorePrimaryStat = false;
itemAttributePrefix = "";
} else {
itemInvComponent.GetItemBaseStats(item, itemStats);
if (compareItemInv.IsIdValid(compareWithItem)){
equipedItem = compareWithItem;
} else {
wplayer.GetItemEquippedOnSlot(itemSlot, equipedI
tem);
}
ignorePrimaryStat = isArmorOrWeapon;
if (isArmorOrWeapon){
itemAttributePrefix = "+";
}
}
if (categoryName == 'gwint'){
additionalDescription += GetGwintCardDescription(GetWitc

herPlayer().GetGwentCardIndex(itemName));
}
AddItemStats(itemStats, statsList, tooltipData, ignorePrimarySta
t, itemAttributePrefix);
AddBuffStats(item, itemInvComponent, statsList, tooltipData);
primaryStatDiff = "none";
primaryStatDiffValue = 0;
primaryStatDiffStr = "";
eqPrimaryStatValue = 0;
if (compareItemInv.IsIdValid(equipedItem)){
equipedItemName = compareItemInv.GetItemName(equipedItem
);
if (compareItemInv.GetItemCategory(equipedItem) == 'cros
sbow'){
GetCrossbowPrimatyStat(equipedItem, compareItemI
nv, eqPrimaryStatLabel, eqPrimaryStatValue);
} else {
compareItemInv.GetItemPrimaryStat(equipedItem, e
qPrimaryStatLabel, eqPrimaryStatValue);
}
canBeCompared = isArmorOrWeapon;
} else {
canBeCompared = false;
}
if (categoryName == 'crossbow'){
GetCrossbowPrimatyStat(item, itemInvComponent, primarySt
atLabel, primaryStatOriginValue);
} else {
itemInvComponent.GetItemPrimaryStat(item, primaryStatLab
el, primaryStatOriginValue);
}
if (isArmorOrWeapon){
primaryStatValue = RoundMath(primaryStatOriginValue);
eqPrimaryStatValue = RoundMath(eqPrimaryStatValue);
primaryStatDiff = GetStatDiff(primaryStatValue, eqPrimar
yStatValue);
primaryStatDiffValue = primaryStatValue - eqPrimaryStatV
alue;
if (primaryStatDiffValue > 0){
primaryStatDiffStr = "<font color="#19D900">+" +
NoTrailZeros(primaryStatDiffValue) + "</font>";
} else if (primaryStatDiffValue < 0){
primaryStatDiffStr = "<font color="#E00000">" +
NoTrailZeros(primaryStatDiffValue) + "</font>";
}
}
if (itemInvComponent.IsItemWeapon(item)){
tooltipData.SetMemberFlashNumber("PrimaryStatDelta", 0.1
00000);
} else {
tooltipData.SetMemberFlashNumber("PrimaryStatDelta", 0);
}
weightValue = itemInvComponent.GetItemEncumbrance(item);
if (categoryName == 'horse_bag' || categoryName == 'horse_blinde
r' || categoryName == 'horse_saddle'){
categoryLabel = GetLocStringByKeyExt("item_category_misc
");
} else if (itemInvComponent.ItemHasTag(item, 'SecondaryWeapon'))
{
categoryLabel = GetLocStringByKeyExt("item_category_seco

ndary");
} else {
categoryLabel = GetLocStringByKeyExt("item_category_" +
categoryName);
}
typeString = GetLocStringByKeyExt(GetFilterTypeName(itemInvCompo
nent.GetFilterTypeByItem(item)));
uniqueDescription = "";
if (!isArmorOrWeapon){
uniqueDescription = GetLocStringByKeyExt(itemInvComponen
t.GetItemLocalizedDescriptionByUniqueID(item));
}
uniqueDescription += additionalDescription;
if (categoryName == 'armor' || categoryName == 'pants' || catego
ryName == 'boots' || categoryName == 'gloves'){
armorType = "";
if (itemInvComponent.ItemHasTag(item, 'LightArmor')){
armorType = GetLocStringByKeyExt("item_type_ligh
t_armor");
} else if (itemInvComponent.ItemHasTag(item, 'MediumArmo
r')){
armorType = GetLocStringByKeyExt("item_type_medi
um_armor");
} else if (itemInvComponent.ItemHasTag(item, 'HeavyArmor
')){
armorType = GetLocStringByKeyExt("item_type_heav
y_armor");
}
typeDesc = armorType;
} else {
typeDesc = categoryLabel;
}
if (itemInvComponent.IsItemAnyArmor(item) || itemInvComponent.Is
ItemBolt(item) || itemInvComponent.IsItemWeapon(item)){
itemLevel = itemInvComponent.GetItemLevel(item);
requiredLevel = itemInvComponent.GetItemLevelColor(itemL
evel) + " " + GetLocStringByKeyExt('panel_inventory_item_requires_level') + " "
+ itemLevel + "</font>";
} else {
requiredLevel = "";
}
tooltipData.SetMemberFlashString("RequiredLevel", requiredLevel)
;
if (categoryName == 'alchemy_recipe'){
m_recipeList = GetWitcherPlayer().GetAlchemyRecipes();
itemInvComponent.GetAllItems(allItems);
j = 0;
while (j < m_recipeList.Size()){
if (itemInvComponent.GetItemName(item) == m_reci
peList[j]){
typeDesc = "<font color='#FF0000'>" + Ge
tLocStringByKeyExt("item_recipe_known");
break;
}
j += 1;
}
categoryLabel = GetLocStringByKeyExt("item_category_misc
");
} else if (categoryName == 'crafting_schematic'){
m_schematicList = GetWitcherPlayer().GetCraftingSchemati

csNames();
itemInvComponent.GetAllItems(allItems);
j = 0;
while (j < m_schematicList.Size()){
if (itemInvComponent.GetItemName(item) == m_sche
maticList[j]){
typeDesc = "<font color='#FF0000'>" + Ge
tLocStringByKeyExt("item_schematic_known");
break;
}
j += 1;
}
}
AddOilInfo(item, itemInvComponent, tooltipData);
AddSocketsInfo(item, itemInvComponent, socketsList);
tmpStr = FloatToStringPrec(weightValue, 2);
addGFxItemStat(propsList, "weight", tmpStr, "attribute_name_weig
ht", /* NOP */);
durMult = 1;
if (isArmorOrWeapon && !itemInvComponent.ItemHasTag(item, 'bolt'
)){
durabilityRatio = itemInvComponent.GetItemDurability(ite
m) / itemInvComponent.GetItemMaxDurability(item);
durabilityValue = RoundMath(durabilityRatio * 100);
durabilityStrValue = IntToString(durabilityValue) + " %"
;
durabilityLabel = GetLocStringByKeyExt("panel_inventory_
tooltip_durability");
if (durabilityValue <= theGame.params.ITEM_DAMAGED_DURAB
ILITY){
durabilityStrValue = "<font color='#E70000'>" +
durabilityStrValue + "</font>";
durabilityLabel = "<font color='#E70000'>" + dur
abilityLabel + "</font>";
tooltipData.SetMemberFlashString("DurabilityDesc
ription", GetLocStringByKeyExt("tooltip_durability_description"));
}
addGFxItemStat(propsList, "repair", durabilityStrValue,
durabilityLabel, true);
durMult = theGame.params.GetDurabilityMultiplier(durabil
ityRatio, itemInvComponent.IsItemWeapon(item));
if (durMult < 1){
primaryStatDurabilityPenalty = primaryStatValue
- RoundMath(primaryStatOriginValue * durMult);
}
}
if (m_shopInv){
if (isShopItem == true){
invItemPrice = m_shopInv.GetItemPriceModified(it
em, false);
invItemPriceString = invItemPrice;
if (m_shopInv.GetItemQuantity(item) > 1){
invItemPriceString += " (" + m_shopInv.G
etItemQuantity(item) * invItemPrice + ")";
}
addGFxItemStat(propsList, "price", invItemPriceS
tring, "panel_inventory_item_price", /* NOP */);
} else {
invItem = m_playerInv.GetItem(item);
invItemPrice = m_shopInv.GetInventoryItemPriceMo

dified(invItem, true);
if (invItemPrice < 0 || m_playerInv.ItemHasTag(i
tem, 'Quest')){
tooltipData.SetMemberFlashString("Warnin
gMessage", GetLocStringByKeyExt("panel_shop_not_for_sale"));
addGFxItemStat(propsList, "notforsale",
" ", /* NOP */, /* NOP */);
} else {
invItemPriceString = invItemPrice;
if (m_playerInv.GetItemQuantity(item) >
1){
invItemPriceString += " (" + m_p
layerInv.GetItemQuantity(item) * invItemPrice + ")";
}
addGFxItemStat(propsList, "price", invIt
emPriceString, "panel_inventory_item_price", /* NOP */);
}
}
} else {
invItemPrice = itemInvComponent.GetItemPrice(item);
invItemPriceString = invItemPrice;
if (itemInvComponent.GetItemQuantity(item) > 1){
invItemPriceString += " (" + itemInvComponent.Ge
tItemQuantity(item) * invItemPrice + ")";
}
addGFxItemStat(propsList, "price", invItemPriceString, "
panel_inventory_item_price", /* NOP */);
}
if (m_playerInv.IsIdValid(compareWithItem)){
tooltipData.SetMemberFlashString("EquippedTitle", GetLoc
StringByKeyExt("panel_blacksmith_equipped"));
}
tooltipData.SetMemberFlashUInt("ItemId", ItemToFlashUInt(item));
tooltipData.SetMemberFlashString("ItemType", typeDesc);
tooltipData.SetMemberFlashString("ItemName", itemLabel);
tooltipData.SetMemberFlashString("ItemRarity", GetItemRarityDesc
ription(item, itemInvComponent));
tooltipData.SetMemberFlashString("IconPath", itemInvComponent.Ge
tItemIconPathByUniqueID(item));
tooltipData.SetMemberFlashString("ItemCategory", categoryLabel);
tooltipData.SetMemberFlashString("Description", uniqueDescriptio
n);
tooltipData.SetMemberFlashArray("SocketsList", socketsList);
tooltipData.SetMemberFlashArray("StatsList", statsList);
tooltipData.SetMemberFlashArray("PropertiesList", propsList);
tooltipData.SetMemberFlashString("PrimaryStatLabel", primaryStat
Label);
tooltipData.SetMemberFlashString("PrimaryStatDiff", primaryStatD
iff);
tooltipData.SetMemberFlashString("PrimaryStatDiffStr", primarySt
atDiffStr);
tooltipData.SetMemberFlashNumber("PrimaryStatValue", primaryStat
Value);
tooltipData.SetMemberFlashNumber("PrimaryStatDurabilityPenalty",
primaryStatDurabilityPenalty);
tooltipData.SetMemberFlashBool("CanBeCompared", canBeCompared);
tooltipData.SetMemberFlashBool("EnableFullScreenInfo", isArmorOr
Weapon);
return tooltipData;
/* NOP */;

}
private function GetCrossbowPrimatyStat(itemId : SItemUniqueId, itemInvC
omponent : CInventoryComponent, primaryStatLabel : String, primaryStatValue : Fl
oat){
var itemOnSlot : SItemUniqueId;
var crossbowPower : SAbilityAttributeValue;
var crossbowStatValueMult : Float;
crossbowPower = itemInvComponent.GetItemAttributeValue(itemId, '
attack_power', /* NOP */, /* NOP */);
crossbowStatValueMult = crossbowPower.valueMultiplicative;
if (crossbowStatValueMult == 0){
crossbowStatValueMult = 1;
}
GetWitcherPlayer().GetItemEquippedOnSlot(17, itemOnSlot);
if (itemInvComponent.IsIdValid(itemOnSlot)){
itemInvComponent.GetItemPrimaryStat(itemOnSlot, primaryS
tatLabel, primaryStatValue);
primaryStatValue = primaryStatValue * crossbowStatValueM
ult;
} else {
itemInvComponent.GetItemStatByName('Bodkin Bolt', 'Pierc
ingDamage', primaryStatValue);
primaryStatValue = primaryStatValue * crossbowStatValueM
ult;
}
primaryStatLabel = GetLocStringByKeyExt("panel_inventory_tooltip
_damage");
/* NOP */;
}
private function AddSocketsInfo(itemId : SItemUniqueId, itemInvComponent
: CInventoryComponent, flashDataObj : CScriptedFlashArray){
var socketsCount : Int32;
var usedSocketsCount : Int32;
var emptySocketsCount : Int32;
var socketItems : array<CName>;
var idx : Int32;
var curUpgradeName : CName;
var curUpgradeLocName : String;
var upgradeBonusValue : String;
var upgradeBonus : Float;
var upgradeStats : array<SAttributeTooltip>;
var upgradeStatFirst : SAttributeTooltip;
socketsCount = itemInvComponent.GetItemEnhancementSlotsCount(ite
mId);
usedSocketsCount = itemInvComponent.GetItemEnhancementCount(item
Id);
emptySocketsCount = socketsCount - usedSocketsCount;
itemInvComponent.GetItemEnhancementItems(itemId, socketItems);
idx = 0;
while (idx < socketItems.Size()){
curUpgradeName = socketItems[idx];
curUpgradeLocName = GetLocStringByKeyExt(itemInvComponen
t.GetItemLocalizedNameByName(curUpgradeName));
itemInvComponent.GetItemStatsFromName(curUpgradeName, up
gradeStats);
if (upgradeStats.Size() > 0){
upgradeStatFirst = upgradeStats[0];
if (upgradeStatFirst.percentageValue){
upgradeBonusValue = "<font color="#ACACA
C">+" + RoundMath(upgradeStatFirst.value * 100) + " %</font>";

} else {
upgradeBonusValue = "<font color="#ACACA
C">+" + RoundMath(upgradeStatFirst.value) + "</font>";
}
upgradeBonusValue += "<font color="#B69A68"> " +
upgradeStatFirst.attributeName + " (" + curUpgradeLocName + ")</font>";
addGFxItemStat(flashDataObj, "equipped", upgrade
BonusValue, /* NOP */, /* NOP */);
} else {
addGFxItemStat(flashDataObj, "equipped", curUpgr
adeLocName, /* NOP */, /* NOP */);
}
idx += 1;
}
upgradeBonusValue = "<font color="#515151">" + GetLocStringByKey
Ext("panel_blacksmith_empty_socket") + "</font>";
idx = 0;
while (idx < emptySocketsCount){
addGFxItemStat(flashDataObj, "empty", upgradeBonusValue,
/* NOP */, /* NOP */);
idx += 1;
}
/* NOP */;
}
private function AddOilInfo(itemId : SItemUniqueId, itemInvComponent : C
InventoryComponent, flashDataObj : CScriptedFlashObject){
var oilName : CName;
var oilLocName : String;
var oilCharges : Int32;
var oilMaxCharges : Int32;
var oilBonus : Float;
var oilStats : array<SAttributeTooltip>;
var oilStatFirst : SAttributeTooltip;
var oilBonusValue : String;
oilName = itemInvComponent.GetSwordOil(itemId);
if (oilName != 'None'){
oilLocName = GetLocStringByKeyExt(itemInvComponent.GetIt
emLocalizedNameByName(oilName));
oilCharges = itemInvComponent.GetItemModifierInt(itemId,
'oil_charges', /* NOP */);
oilMaxCharges = itemInvComponent.GetItemModifierInt(item
Id, 'oil_max_charges', /* NOP */);
itemInvComponent.GetItemStatsFromName(oilName, oilStats)
;
if (oilStats.Size() > 0){
oilStatFirst = oilStats[0];
if (oilStatFirst.percentageValue){
oilBonusValue = "<font color="#ACACAC">+
" + RoundMath(oilStatFirst.value * 100) + " %</font>";
} else {
oilBonusValue = "<font color="#ACACAC">+
" + RoundMath(oilStatFirst.value) + "</font>";
}
}
oilBonusValue = oilBonusValue + "<font color="#B69A68">
" + oilStatFirst.attributeName + " (" + oilLocName + ")(" + oilCharges + "/" + o
ilMaxCharges + ")</font>";
flashDataObj.SetMemberFlashString("appliedOilInfo", oilB
onusValue);
}

/* NOP */;
}
private function AddItemStats(itemStats : array<SAttributeTooltip>, resu
ltGFxArray : CScriptedFlashArray, rootGFxObject : CScriptedFlashObject, ignorePr
imaryStat : Bool, defaultPrefix : String){
var l_flashObject : CScriptedFlashObject;
var currentStat : SAttributeTooltip;
var i : Int32;
var statsCount : Int32;
var maxToxicity : Int32;
var valuePrefix : String;
var valuePostfix : String;
var valueString : String;
statsCount = itemStats.Size();
i = 0;
while (i < statsCount){
currentStat = itemStats[i];
if (!ignorePrimaryStat || !currentStat.primaryStat){
if (currentStat.originName == 'toxicity_offset')
{
currentStat.attributeName = GetAttribute
NameLocStr('toxicity', false);
currentStat.originName = 'toxicity';
currentStat.value = 80;
currentStat.percentageValue = false;
}
if (currentStat.originName == 'toxicity'){
maxToxicity = RoundMath(thePlayer.GetSta
tMax(3));
valuePrefix = "";
valuePostfix = "/" + maxToxicity;
} else if (currentStat.originName == 'duration')
{
valuePrefix = "";
valuePostfix = " " + GetLocStringByKeyEx
t("per_second");
} else {
valuePrefix = defaultPrefix;
valuePostfix = "";
}
if (currentStat.percentageValue){
valueString = NoTrailZeros(RoundMath(cur
rentStat.value * 100)) + " %";
} else {
valueString = NoTrailZeros(RoundMath(cur
rentStat.value));
}
l_flashObject = rootGFxObject.CreateFlashObject(
/* NOP */);
l_flashObject.SetMemberFlashString("id", NameToS
tring(currentStat.originName));
l_flashObject.SetMemberFlashString("name", curre
ntStat.attributeName);
l_flashObject.SetMemberFlashString("color", curr
entStat.attributeColor);
l_flashObject.SetMemberFlashString("value", valu
ePrefix + valueString + valuePostfix);
l_flashObject.SetMemberFlashNumber("floatValue",
currentStat.value);
resultGFxArray.PushBackFlashObject(l_flashObject

);
}
i += 1;
}
/* NOP */;
}
private function AddBuffStats(itemId : SItemUniqueId, itemInvComponent :
CInventoryComponent, resultGFxArray : CScriptedFlashArray, rootGFxObject : CScr
iptedFlashObject){
var curFlashObject : CScriptedFlashObject;
var buffDuration : Float;
var idx : Int32;
var len : Int32;
var curBufValue : Float;
var curBufValueStr : String;
var t1 : Int32;
var t2 : Int32;
if (itemInvComponent.ItemHasTag(itemId, 'Edibles') || itemInvCom
ponent.ItemHasTag(itemId, 'Drinks')){
buffDuration = GetBuffDuration(itemId, itemInvComponent)
;
} else if (itemInvComponent.IsItemBomb(itemId)){
buffDuration = GetBuffDuration(itemId, itemInvComponent)
;
}
if (buffDuration > 0){
len = resultGFxArray.GetLength();
idx = 0;
while (idx < len){
curFlashObject = resultGFxArray.GetElementFlashO
bject(idx);
if (curFlashObject.GetMemberFlashString("id") ==
NameToString('duration')){
curBufValue = curFlashObject.GetMemberFl
ashNumber("floatValue");
curBufValue += buffDuration;
curBufValueStr = NoTrailZeros(RoundMath(
curBufValue)) + " " + GetLocStringByKeyExt("per_second");
curFlashObject.SetMemberFlashString("val
ue", curBufValueStr);
curFlashObject.SetMemberFlashNumber("flo
atValue", curBufValue);
return;
}
idx += 1;
}
curBufValueStr = NoTrailZeros(RoundMath(buffDuration)) +
" " + GetLocStringByKeyExt("per_second");
curFlashObject = rootGFxObject.CreateFlashObject(/* NOP
*/);
curFlashObject.SetMemberFlashString("name", GetAttribute
NameLocStr('duration', false));
curFlashObject.SetMemberFlashString("value", curBufValue
Str);
curFlashObject.SetMemberFlashNumber("floatValue", buffDu
ration);
resultGFxArray.PushBackFlashObject(curFlashObject);
}
/* NOP */;
}

public function GetExItemData(item : SItemUniqueId, isShopItem : Bool) :


CScriptedFlashObject{
var tooltipData : CScriptedFlashObject;
if (!IsInited()){
/* NOP */;
return NULL;
}
return GetBaseItemData(item, m_itemInv, isShopItem, /* NOP */, /
* NOP */);
/* NOP */;
}
public function GetTooltipData(itemId : SItemUniqueId, isShopItem : Bool
, compareItem : Bool) : CScriptedFlashObject{
var wplayer : W3PlayerWitcher;
var itemSlot : EEquipmentSlots;
var equipedItemId : SItemUniqueId;
var selectedItemData : CScriptedFlashObject;
var equippedItemData : CScriptedFlashObject;
var isArmorOrWeapon : Bool;
if (!IsInited()){
/* NOP */;
return NULL;
}
selectedItemData = GetBaseItemData(itemId, m_itemInv, isShopItem
, /* NOP */, /* NOP */);
if (compareItem){
itemSlot = m_itemInv.GetSlotForItemId(itemId);
wplayer = GetWitcherPlayer();
wplayer.GetItemEquippedOnSlot(itemSlot, equipedItemId);
if (m_playerInv.IsIdValid(equipedItemId) && equipedItemI
d != itemId){
isArmorOrWeapon = m_playerInv.IsItemAnyArmor(equ
ipedItemId) || m_playerInv.IsItemWeapon(equipedItemId);
if (isArmorOrWeapon){
if (isShopItem){
equippedItemData = GetBaseItemDa
ta(equipedItemId, m_playerInv, isShopItem, itemId, m_shopInv);
} else {
equippedItemData = GetBaseItemDa
ta(equipedItemId, m_playerInv, isShopItem, itemId, m_playerInv);
}
selectedItemData.SetMemberFlashObject("e
quippedItemData", equippedItemData);
}
}
}
return selectedItemData;
/* NOP */;
}
protected function GetGenStatsGFxData(itemStats : array<SItemGenericStat
>, comparingItemsStats : array<SItemGenericStat>, enableCompare : Bool) : CScrip
tedFlashArray{
var curStatData : CScriptedFlashObject;
var statListData : CScriptedFlashArray;
var curStat : SItemGenericStat;
var compValue : String;
var i : Int32;
var j : Int32;
var statsCount : Int32;
var compStatsCount : Int32;

var foundComp : Bool;


var maxToxicity : Int32;
var durationPostfix : String;
statListData = m_flashValueStorage.CreateTempFlashArray();
statsCount = itemStats.Size();
compStatsCount = comparingItemsStats.Size();
i = 0;
while (i < statsCount){
foundComp = false;
curStat = itemStats[i];
if (!curStat.statName == "duration" || curStat.statName
== "toxicity" && RoundMath(curStat.value) <= 1){
compValue = "none";
if (enableCompare){
j = 0;
while (j < compStatsCount){
if (curStat.statName == comparin
gItemsStats[i].statName){
compValue = GetStatDiff(
curStat.value, comparingItemsStats[i].value);
foundComp = true;
break;
}
j += 1;
}
if (!foundComp){
compValue = "wayBetter";
}
}
curStatData = m_flashValueStorage.CreateTempFlas
hObject(/* NOP */);
if (curStat.statName == "toxicity_offset"){
curStatData.SetMemberFlashString("type",
"toxicity");
} else {
curStatData.SetMemberFlashString("type",
curStat.statName);
}
if (curStat.statName == "toxicity" || curStat.st
atName == "toxicity_offset"){
maxToxicity = RoundMath(thePlayer.GetSta
tMax(3));
if (curStat.statName == "toxicity_offset
"){
curStatData.SetMemberFlashString
("value", RoundMath(curStat.value * 100) + "/" + maxToxicity);
} else {
curStatData.SetMemberFlashString
("value", RoundMath(curStat.value) + "/" + maxToxicity);
}
} else if (curStat.statName == "duration"){
durationPostfix = GetLocStringByKeyExt("
per_second");
curStatData.SetMemberFlashString("value"
, RoundMath(curStat.value) + " " + durationPostfix);
} else {
curStatData.SetMemberFlashString("icon",
compValue);
}
statListData.PushBackFlashObject(curStatData);

}
i += 1;
}
return statListData;
/* NOP */;
}
protected function GetMutagenGenStatsGFxData() : CScriptedFlashArray{
var curStatData : CScriptedFlashObject;
var statListData : CScriptedFlashArray;
statListData = m_flashValueStorage.CreateTempFlashArray();
curStatData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
curStatData.SetMemberFlashString("type", "toxicity");
curStatData.SetMemberFlashString("value", GetLocStringByKeyExt("
panel_tooltip_mutagen_toxicity_warning"));
statListData.PushBackFlashObject(curStatData);
return statListData;
/* NOP */;
}
protected function GetBuffDuration(itemId : SItemUniqueId, inv : CInvent
oryComponent) : Float{
var buffs : array<SEffectInfo>;
var i : Int32;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dValue : Float;
inv.GetItemBuffs(itemId, buffs);
i = 0;
while (i < buffs.Size()){
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(buffs[i].effectAbilityName, 'duration', min, max);
dValue = CalculateAttributeValue(GetAttributeRandomizedV
alue(min, max), /* NOP */);
if (dValue > 0){
return dValue;
}
i += 1;
}
return 0;
/* NOP */;
}
protected function GetGenericStats(item : SItemUniqueId, inv : CInventor
yComponent) : array<SItemGenericStat>{
var curStat : SAttributeTooltip;
var i : Int32;
var j : Int32;
var count : Int32;
var settingsSize : Int32;
var attrListSize : Int32;
var attributes : array<CName>;
var attrName : String;
var attrType : String;
var attrValue : Float;
var attrMult : Float;
var genStats : array<SItemGenericStat>;
var curGenStat : SItemGenericStat;
inv.GetItemAttributes(item, attributes);
attrListSize = attributes.Size();
settingsSize = theGame.tooltipSettings.GetNumRows();
AppendDefaultGenericStats(genStats, item, inv);

i = 0;
while (i < settingsSize){
j = 0;
while (j < attrListSize){
attrName = theGame.tooltipSettings.GetValueAt(0,
i);
attrType = theGame.tooltipSettings.GetValueAt(3,
i);
if (attrName == NameToString(attributes[j]) && a
ttrType != ""){
attrMult = theGame.tooltipSettings.GetVa
lueAt(4, i);
attrValue = GetAttributeValue(item, attr
ibutes[j], inv) * attrMult;
if (attrType == "duration"){
AppendGenericStat(genStats, attr
Type, attrValue, true);
} else {
AppendGenericStat(genStats, attr
Type, attrValue, /* NOP */);
}
break;
}
j += 1;
}
i += 1;
}
return genStats;
/* NOP */;
}
protected function AppendDefaultGenericStats(statsList : array<SItemGene
ricStat>, item : SItemUniqueId, inv : CInventoryComponent){
var buffDuration : Float;
if (inv.ItemHasTag(item, 'Edibles') || inv.ItemHasTag(item, 'Dri
nks')){
buffDuration = GetBuffDuration(item, inv);
AddGenericStat(statsList, 'toxicity', 0);
AddGenericStat(statsList, 'duration', buffDuration);
} else if (inv.IsItemBomb(item)){
buffDuration = GetBuffDuration(item, inv);
AddGenericStat(statsList, 'duration', buffDuration);
} else if (inv.IsItemPotion(item)){
AddGenericStat(statsList, 'toxicity', 0);
AddGenericStat(statsList, 'duration', 0);
} else if (inv.IsItemAnyArmor(item) || inv.IsItemWeapon(item)){
AddGenericStat(statsList, 'attack', 0);
AddGenericStat(statsList, 'defence', 0);
AddGenericStat(statsList, 'magic', 0);
AddGenericStat(statsList, 'vitality', 0);
}
/* NOP */;
}
protected function AddGenericStat(statsList : array<SItemGenericStat>, s
tatName : String, statValue : Float){
var newStat : SItemGenericStat;
newStat.statName = statName;
newStat.value = statValue;
statsList.PushBack(newStat);
/* NOP */;
}

protected function AppendGenericStat(statsList : array<SItemGenericStat>


, statName : String, statValue : Float, resetValue : Bool){
var i : Int32;
var len : Int32;
var newStat : SItemGenericStat;
len = statsList.Size();
i = 0;
while (i < len){
if (statsList[i].statName == statName){
if (resetValue){
statsList[i].value = statValue;
} else {
statsList[i].value += statValue;
}
return;
}
i += 1;
}
/* NOP */;
}
protected function GetAttributeValue(item : SItemUniqueId, statName : CN
ame, inv : CInventoryComponent) : Float{
var statValue : Float;
var attributeVal : SAbilityAttributeValue;
attributeVal = inv.GetItemAttributeValue(item, statName, /* NOP
*/, /* NOP */);
if (attributeVal.valueBase != 0){
statValue = attributeVal.valueBase;
}
if (attributeVal.valueMultiplicative != 0){
statValue = attributeVal.valueMultiplicative;
}
if (attributeVal.valueAdditive != 0){
statValue = attributeVal.valueAdditive;
}
return statValue;
/* NOP */;
}
protected function IsInited() : Bool{
return m_itemInv && m_playerInv && m_flashValueStorage;
/* NOP */;
}
private function addGFxItemStat(targetArray : CScriptedFlashArray, type
: String, value : String, label : String, isHtml : Bool){
var resultData : CScriptedFlashObject;
var labelLoc : String;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
resultData.SetMemberFlashString("type", type);
resultData.SetMemberFlashString("value", value);
if (label != ""){
if (!isHtml){
labelLoc = GetLocStringByKeyExt(label);
} else {
labelLoc = label;
}
resultData.SetMemberFlashString("label", labelLoc);
}
targetArray.PushBackFlashObject(resultData);
/* NOP */;

}
public function GetItemRarityDescription(item : SItemUniqueId, tooltipIn
v : CInventoryComponent) : String{
var itemQuality : Int32;
itemQuality = tooltipInv.GetItemQuality(item);
switch(itemQuality){
case 1:
return "<font color='#7b7877'>" + GetLocStringByKeyExt("
panel_inventory_item_rarity_type_common") + "</font>";
case 2:
return "<font color='#3661dc'>" + GetLocStringByKeyExt("
panel_inventory_item_rarity_type_masterwork") + "</font>";
case 3:
return "<font color='#959500'>" + GetLocStringByKeyExt("
panel_inventory_item_rarity_type_magic") + "</font>";
case 4:
return "<font color='#934913'>" + GetLocStringByKeyExt("
panel_inventory_item_rarity_type_relic") + "</font>";
case 5:
return "<font color='#197319'>" + GetLocStringByKeyExt("
panel_inventory_item_rarity_type_set") + "</font>";
default:
}
return "ERROR";
/* NOP */;
}
private function CompareItemsStats(itemStats : array<SAttributeTooltip>,
compareItemStats : array<SAttributeTooltip>, compResult : CScriptedFlashArray,
rootGFxObject : CScriptedFlashObject, dontCompare : Bool, extendedData : Bool){
CalculateStatsComparance(itemStats, compareItemStats, rootGFxObj
ect, compResult, true, dontCompare, extendedData);
/* NOP */;
}
private function getCategoryDescription(itemCategory : CName) : String{
switch(itemCategory){
case 'steelsword':
case 'silversword':
case 'crossbow':
case 'secondary':
case 'armor':
case 'pants':
case 'gloves':
case 'boots':
case 'armor':
case 'bolt':
return GetLocStringByKeyExt("item_category_" + itemCateg
ory + "_desc");
break;
default:
return "";
break;
}
return "";
/* NOP */;
}
private function GetGwintCardDescription(cardIndex : Int32) : String{
var cardString : String;
var gwintManager : CR4GwintManager;
var cardDefinition : SCardDefinition;
var tempStr : String;

var abilityName : String;


var abilityDescription : String;
gwintManager = theGame.GetGwintManager();
cardDefinition = gwintManager.GetCardDefinition(cardIndex);
if (cardDefinition.index == -1){
return "Failed to get card definition";
}
cardString += GetLocStringByKeyExt("gwint_tooltip_faction_header
") + ": ";
switch(cardDefinition.faction){
case 0:
cardString += "<font color='#7b7877'>" + GetLocStringByK
eyExt("gwint_faction_name_neutral") + "</font>";
break;
case 1:
cardString += "<font color='#5B0302'>" + GetLocStringByK
eyExt("gwint_faction_name_no_mans_land") + "</font>";
break;
case 2:
cardString += "<font color='#BCAE3C'>" + GetLocStringByK
eyExt("gwint_faction_name_nilfgaard") + "</font>";
break;
case 3:
cardString += "<font color='#495382'>" + GetLocStringByK
eyExt("gwint_faction_name_northern_kingdom") + "</font>";
break;
case 4:
cardString += "<font color='#076807'>" + GetLocStringByK
eyExt("gwint_faction_name_scoiatael") + "</font>";
break;
}
cardString += "<br/>" + GetLocStringByKeyExt("gwint_tooltip_card
_type") + ": ";
if (cardDefinition.index >= 1000){
cardString += "<font color='#7b7877'>" + GetLocStringByK
eyExt("gwint_tooltip_card_type_leader") + "</font>";
if (cardDefinition.effectFlags.Size() == 1 && cardDefini
tion.effectFlags[0] != 0){
switch(cardDefinition.effectFlags[0]){
case 7:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_melee_scorch_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_melee_scorch");
break;
case 8:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_eleventh_card_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_eleventh_card");
break;
case 9:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_clear_weather_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_clear_weather");
break;
case 10:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_pick_weather_title");

abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_pick_weather");
break;
case 11:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_pick_rain_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_pick_rain");
break;
case 12:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_pick_fog_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_pick_fog");
break;
case 13:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_pick_frost_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_pick_frost");
break;
case 14:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_view_enemy_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_view_enemy");
break;
case 15:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_resurect_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_resurect");
break;
case 16:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_resurect_enemy_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_resurect_enemy");
break;
case 17:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_bin_pick_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_bin_pick");
break;
case 18:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_melee_horn_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_melee_horn");
break;
case 19:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_range_horn_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_range_horn");
break;
case 20:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_siege_horn_title");

abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_siege_horn");
break;
case 21:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_siege_scorch_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_siege_scorch");
break;
case 22:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_ldr_counter_king_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_ldr_counter_king");
break;
}
}
} else if (cardDefinition.typeFlags & 8 == 8){
if (cardDefinition.typeFlags & 128 == 128){
cardString += "<font color='#7b7877'>" + GetLocS
tringByKeyExt("gwint_card_tooltip_hero_title") + "</font>";
} else {
cardString += "<font color='#7b7877'>" + GetLocS
tringByKeyExt("gwint_tooltip_card_type_creature") + "</font>";
}
cardString += "<br/>" + GetLocStringByKeyExt("gwint_tut_
unitcardrange_title") + ": ";
if (cardDefinition.typeFlags & 1 == 1){
tempStr = GetLocStringByKeyExt("gwint_tutorial_u
nit_range_close");
tempStr = StrReplaceAll(tempStr, "<br>", "");
cardString += "<font color='#7b7877'>" + tempStr
;
if (cardDefinition.typeFlags & 2 == 2){
tempStr = GetLocStringByKeyExt("gwint_tu
torial_unit_range_long");
tempStr = StrReplaceAll(tempStr, "<br>",
"");
cardString += ", " + tempStr + "</font>"
;
} else {
cardString += "</font>";
}
} else if (cardDefinition.typeFlags & 2 == 2){
tempStr = GetLocStringByKeyExt("gwint_tutorial_u
nit_range_long");
tempStr = StrReplaceAll(tempStr, "<br>", "");
cardString += "<font color='#7b7877'>" + tempStr
+ "</font>";
} else if (cardDefinition.typeFlags & 4 == 4){
tempStr = GetLocStringByKeyExt("gwint_tutorial_u
nit_range_siege");
tempStr = StrReplaceAll(tempStr, "<br>", "");
cardString += "<font color='#7b7877'>" + tempStr
+ "</font>";
}
cardString += "<br/>" + GetLocStringByKeyExt("gwint_tut_
unitcardstrength_title") + ": " + "<font color='#7b7877'>" + cardDefinition.powe
r + "</font>";
if (cardDefinition.effectFlags.Size() == 1 && cardDefini

tion.effectFlags[0] != 0){
switch(cardDefinition.effectFlags[0]){
case 7:
break;
case 31:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_summon_clones_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_summon_clones");
break;
case 33:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_nurse_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_nurse");
break;
case 34:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_spy_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_spy");
break;
case 35:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_same_type_morale_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_same_type_morale");
break;
case 32:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_improve_neightbours_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_improve_neightbours");
break;
case 27:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_horn_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_horn");
break;
}
} else if (cardDefinition.typeFlags & 2 == 2 && cardDefi
nition.typeFlags & 1 == 1){
abilityName = GetLocStringByKeyExt("gwint_card_t
ooltip_agile_title");
abilityDescription = GetLocStringByKeyExt("gwint
_card_tooltip_agile");
} else if (cardDefinition.typeFlags & 128 == 128){
abilityName = GetLocStringByKeyExt("gwint_card_t
ooltip_hero_title");
abilityDescription = GetLocStringByKeyExt("gwint
_card_tooltip_hero");
}
} else {
cardString += "<font color='#7b7877'>" + GetLocStringByK
eyExt("gwint_tooltip_card_type_special");
if (cardDefinition.typeFlags & 16 == 16){
cardString += ", " + GetLocStringByKeyExt("gwint
_tooltip_card_type_weather");
}

cardString += "</font>";
if (cardDefinition.effectFlags.Size() == 1 && cardDefini
tion.effectFlags[0] != 0){
switch(cardDefinition.effectFlags[0]){
case 23:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_frost_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_frost");
break;
case 24:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_fog_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_fog");
break;
case 25:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_rain_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_rain");
break;
case 30:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_clearsky_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_clearsky");
break;
case 26:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_dummy_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_dummy");
break;
case 27:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_horn_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_horn");
break;
case 29:
abilityName = GetLocStringByKeyExt("gwin
t_card_tooltip_scorch_title");
abilityDescription = GetLocStringByKeyEx
t("gwint_card_tooltip_scorch");
break;
}
}
}
if (abilityName != "" && abilityDescription != ""){
cardString += "<br/>" + GetLocStringByKeyExt("gwint_tut_
unitcardspecialability_title") + ": " + "<font color='#7b7877'>" + abilityName +
"<br/>" + abilityDescription;
}
return cardString;
/* NOP */;
}
public function GetSchematicDataFromXML(schematicName : CName) : SCrafti
ngSchematic{
var curSchematicName : CName;

var i : Int32;
var j : Int32;
var k : Int32;
var tmpInt : Int32;
var ing : SItemParts;
var schem : SCraftingSchematic;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('crafting_schematics');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', curSchematicName);
if (curSchematicName == schematicName){
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'craftedItem_name', curSchematicName)){
schem.craftedItemName = curSchematicName
;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'craftsmanType_name', curSchematicName)){
schem.requiredCraftsmanType = ParseCraft
smanTypeStringToEnum(curSchematicName);
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'craftsmanLevel_name', curSchematicName)){
schem.requiredCraftsmanLevel = ParseCraf
tsmanLevelStringToEnum(curSchematicName);
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'price', tmpInt)){
schem.baseCraftingPrice = tmpInt;
}
ingredients = dm.GetCustomDefinitionSubNode(main
.subNodes[i], 'ingredients');
k = 0;
while (k < ingredients.subNodes.Size()){
ing.itemName = 'None';
ing.quantity = -1;
if (dm.GetCustomNodeAttributeValueName(i
ngredients.subNodes[k], 'item_name', curSchematicName)){
ing.itemName = curSchematicName;
}
if (dm.GetCustomNodeAttributeValueInt(in
gredients.subNodes[k], 'quantity', tmpInt)){
ing.quantity = tmpInt;
}
schem.ingredients.PushBack(ing);
k += 1;
}
schem.schemName = curSchematicName;
return schem;
}
i += 1;
}
return schem;
/* NOP */;
}

public function GetRecipeDataFromXML(recipeName : CName) : SAlchemyRecip


e{
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var tmpBool : Bool;
var tmpName : CName;
var tmpString : String;
var tmpInt : Int32;
var ing : SItemParts;
var i : Int32;
var k : Int32;
var rec : SAlchemyRecipe;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('alchemy_recipies');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
if (tmpName == recipeName){
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'cookedItem_name', tmpName)){
rec.cookedItemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(main.subN
odes[i], 'type_name', tmpName)){
rec.typeName = tmpName;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'level', tmpInt)){
rec.level = tmpInt;
}
if (dm.GetCustomNodeAttributeValueString(main.su
bNodes[i], 'cookedItemType', tmpString)){
rec.cookedItemType = AlchemyCookedItemTy
peStringToEnum(tmpString);
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'cookedItemQuantity', tmpInt)){
rec.cookedItemQuantity = tmpInt;
}
ingredients = dm.GetCustomDefinitionSubNode(main
.subNodes[i], 'ingredients');
k = 0;
while (k < ingredients.subNodes.Size()){
ing.itemName = 'None';
ing.quantity = -1;
if (dm.GetCustomNodeAttributeValueName(i
ngredients.subNodes[k], 'item_name', tmpName)){
ing.itemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueInt(in
gredients.subNodes[k], 'quantity', tmpInt)){
ing.quantity = tmpInt;
}
rec.requiredIngredients.PushBack(ing);
k += 1;
}
rec.recipeName = recipeName;
rec.cookedItemIconPath = dm.GetItemIconPath(rec.

cookedItemName);
rec.recipeIconPath = dm.GetItemIconPath(rec.reci
peName);
break;
}
i += 1;
}
return rec;
/* NOP */;
}
}
class CR4HudModuleBase extends CR4HudModule{
protected var m_fxSetControllerType : CScriptedFlashFunction;
protected var m_fxSetPlatform : CScriptedFlashFunction;
protected var m_fxShowElementSFF : CScriptedFlashFunction;
protected var m_fxSetMaxOpacitySFF : CScriptedFlashFunction;
protected var m_fxSetEnabledSFF : CScriptedFlashFunction;
protected var m_fxSetScaleFromWSSFF : CScriptedFlashFunction;
protected var m_fxShowTutorialHighlightSFF : CScriptedFlashFunction;
protected var m_anchorName : String;
protected var curResolutionWidth : Float;
protected var curResolutionHeight : Float;
protected var m_bEnabled : Bool;
protected var m_tickInterval : Float;
protected var m_tickCounter : Float;
public function OnConfigUI() : Bool{
var l_flashModule : CScriptedFlashSprite;
l_flashModule = GetModuleFlash();
AddHudModuleReference(this);
m_fxSetControllerType = l_flashModule.GetMemberFlashFunction("se
tControllerType");
m_fxSetPlatform = l_flashModule.GetMemberFlashFunction("setPlatf
orm");
m_fxShowElementSFF = l_flashModule.GetMemberFlashFunction("ShowE
lement");
m_fxSetMaxOpacitySFF = l_flashModule.GetMemberFlashFunction("Set
MaxOpacity");
m_fxSetEnabledSFF = l_flashModule.GetMemberFlashFunction("SetEna
bled");
m_fxSetScaleFromWSSFF = l_flashModule.GetMemberFlashFunction("Se
tScaleFromWS");
m_fxShowTutorialHighlightSFF = l_flashModule.GetMemberFlashFunct
ion("ShowTutorialHighlight");
SetControllerType(theInput.LastUsedGamepad());
SetPlatformType(theGame.GetPlatform());
SnapToAnchorPosition();
/* NOP */;
}
public function AddHudModuleReference(hudModule : CR4HudModuleBase){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.AddHudModuleReference(hudModule);
}
/* NOP */;
}
public function ShowElement(show : Bool, bImmediately : Bool){
m_fxShowElementSFF.InvokeSelfTwoArgs(FlashArgBool(show), FlashAr
gBool(bImmediately));

/* NOP */;
}
public function SetEnabled(value : Bool){
m_bEnabled = value;
m_fxSetEnabledSFF.InvokeSelfOneArg(FlashArgBool(m_bEnabled));
/* NOP */;
}
public function GetEnabled() : Bool{
return m_bEnabled;
/* NOP */;
}
public function SnapToAnchorPosition(){
var l_hud : CR4ScriptedHud;
var l_hudModuleAnchors : CR4HudModuleAnchors;
var l_mcAnchor : CScriptedFlashSprite;
var l_flashModule : CScriptedFlashSprite;
var l_scale : Float;
var anchorX : Float;
var anchorY : Float;
if (m_anchorName == ""){
return;
}
if (m_anchorName != "ScaleOnly"){
l_hud = (CR4ScriptedHud)theGame.GetHud();
l_hudModuleAnchors = (CR4HudModuleAnchors)l_hud.GetHudMo
dule("AnchorsModule");
if (!l_hudModuleAnchors){
return;
}
l_mcAnchor = l_hudModuleAnchors.GetAnchorSprite(m_anchor
Name);
anchorX = l_mcAnchor.GetX();
anchorY = l_mcAnchor.GetY();
}
l_flashModule = GetModuleFlash();
m_fxSetMaxOpacitySFF.InvokeSelfOneArg(FlashArgNumber(theGame.Get
UIOpacity()));
l_scale = theGame.GetUIScale() + theGame.GetUIGamepadScaleGain()
;
if (UpdateScale(l_scale, l_flashModule)){
UpdatePosition(anchorX, anchorY);
}
/* NOP */;
}
protected function UpdatePosition(anchorX : Float, anchorY : Float){
var tempX : Float;
var tempY : Float;
var l_flashModule : CScriptedFlashSprite;
l_flashModule = GetModuleFlash();
tempX = anchorX - curResolutionWidth / 2 * theGame.GetUIHorizont
alFrameScale() + curResolutionWidth / 2;
tempY = anchorY - curResolutionHeight / 2 * theGame.GetUIVertica
lFrameScale() + curResolutionHeight / 2;
l_flashModule.SetX(tempX);
l_flashModule.SetY(tempY);
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
m_fxSetScaleFromWSSFF.InvokeSelfOneArg(FlashArgNumber(scale));

if (m_anchorName == "ScaleOnly"){
return false;
}
return true;
/* NOP */;
}
public function OnBreakPoint(text : String) : Bool{
/* NOP */;
/* NOP */;
}
public function ShowTutorialHighlight(bShow : Bool, tutorialHighlightNam
e : String){
m_fxShowTutorialHighlightSFF.InvokeSelfTwoArgs(FlashArgBool(bSho
w), FlashArgString(tutorialHighlightName));
/* NOP */;
}
protected function SetControllerType(isGamepad : Bool){
if (m_fxSetControllerType){
m_fxSetControllerType.InvokeSelfOneArg(FlashArgBool(isGa
mepad));
}
/* NOP */;
}
protected function SetPlatformType(platformType : Platform){
if (m_fxSetPlatform){
m_fxSetPlatform.InvokeSelfOneArg(FlashArgInt(platformTyp
e));
}
/* NOP */;
}
public function SetTickInterval(tickInterval : Float){
if (tickInterval < 0){
tickInterval = 0;
} else if (tickInterval > 1){
tickInterval = 1;
}
m_tickInterval = tickInterval;
/* NOP */;
}
public function CanTick(timeDelta : Float) : Bool{
m_tickCounter -= timeDelta;
if (m_tickCounter < 0){
m_tickCounter += m_tickInterval;
return true;
}
return false;
/* NOP */;
}
public function OnPlaySoundEvent(soundName : String) : Bool{
theSound.SoundEvent(soundName);
/* NOP */;
}
}
class CR4HudModuleAnchors extends CR4HudModuleBase{
private var m_fxUpdateAnchorsPositions : CScriptedFlashFunction;
private var m_fxUpdateAnchorsAspectRatio : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;

flashModule = GetModuleFlash();
m_fxUpdateAnchorsPositions = flashModule.GetMemberFlashFunction(
"UpdateAnchorsPositions");
m_fxUpdateAnchorsAspectRatio = flashModule.GetMemberFlashFunctio
n("UpdateAnchorsAspectRatio");
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudScale();
}
/* NOP */;
}
public function GetAnchorSprite(_AnchorName : String) : CScriptedFlashSp
rite{
var flashModule : CScriptedFlashSprite;
flashModule = GetModuleFlash();
return flashModule.GetChildFlashSprite(_AnchorName);
/* NOP */;
}
public function UpdateAnchorsPositions(){
m_fxUpdateAnchorsPositions.InvokeSelf();
/* NOP */;
}
public function UpdateAnchorsAspectRatio(){
var width : Int32;
var height : Int32;
theGame.GetCurrentViewportResolution(width, height);
m_fxUpdateAnchorsAspectRatio.InvokeSelfTwoArgs(FlashArgInt(width
), FlashArgInt(height));
/* NOP */;
}
}
state CR4PlayerStateCombat in CR4Player extends CR4PlayerStateExtendedMovable{
protected var comboDefinition : CComboDefinition;
public var comboPlayer : CComboPlayer;
protected var updatePosition : Bool;
private var bIsSwitchingDirection : Bool;
protected var currentWeapon : EPlayerWeapon;
private var comboAttackA_Id : Int32;
private var comboAttackA_Target : CGameplayEntity;
private var comboAttackA_Sliding : Bool;
private var comboAttackB_Id : Int32;
private var comboAttackB_Target : CGameplayEntity;
private var comboAttackB_Sliding : Bool;
private var comboAspectName : CName;
private var enemiesInRange : array<CActor>;
private var positionWeightsDest : array<Float>;
private var positionWeights : array<Float>;
private var positionVelocity : array<Float>;
private var positionWeightDamper : SpringDamper;
private var dodgeDirection : EPlayerEvadeDirection;
private var zoomOutForApproachingAttacker : Bool;
private var slideDistanceOffset : Float;
protected var startupAction : EInitialAction;
protected var startupBuff : CBaseGameplayEffect;
protected var isInCriticalState : Bool;
private var realCombat : Bool;
private var lastVitality : Float;
private var timeToCheckCombatEndCur : Float;
private var timeToCheckCombatEndMax : Float;

private var timeToExitCombatFromSprinting : Float;


public var cFMCameraZoomIsEnabled : Bool;
public var cachedStance : EPlayerCombatStance;
public var disableCombatStanceTimer : Bool;
public var evadeTarget : CActor;
public var wasLockedToTarget : Bool;
public var angle : Float;
public var cachedDodgeDirection : EPlayerEvadeDirection;
public var prevRawLeftJoyRot : Float;
public var evadeTargetPos : Vector;
public var cachedRawDodgeHeading : Float;
public var turnInPlaceBeforeDodge : Bool;
public var dodgePlaylistFwd : array<Float>;
public var dodgePlaylistFlipFwd : array<Float>;
public var dodgePlaylistBck : array<Float>;
public var cachedPlayerAttackType : CName;
public var farAttackMinDist : Float;
public var previousSlideTarget : CGameplayEntity;
public var finisherDist : Float;
public var isOnHighSlope : Bool;
public var prevPlayerToTargetDist : Float;
public var wasDecreasing : Bool;
public var enableSoftLock : Bool;
public var wasInCloseCombat : Bool;
private var ticketRequests : array<Int32>;
private var ticketNames : array<CName>;
public function SetupState(initialAction : EInitialAction, initialBuff :
CBaseGameplayEffect){
startupAction = initialAction;
startupBuff = initialBuff;
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
var i : Int32;
parent.AddAnimEventCallback('AllowInput', 'OnAnimEvent_AllowInpu
t');
parent.AddAnimEventCallback('AllowRoll', 'OnAnimEvent_AllowRoll'
);
parent.AddAnimEventCallback('ForceAttack', 'OnAnimEvent_ForceAtt
ack');
parent.AddAnimEventCallback('PunchHand_Left', 'OnAnimEvent_Punch
Hand');
parent.AddAnimEventCallback('PunchHand_Right', 'OnAnimEvent_Punc
hHand');
super.OnEnterState(prevStateName);
parent.AddTimer('CombatComboUpdate', 0, true, false, 0, /* NOP *
/, /* NOP */);
parent.AddTimer('CombatEndCheck', 0.100000, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 2);
CombatInit();
/* NOP */;
StatsInit();
/* NOP */;
}
public function StatsInit(){
realCombat = thePlayer.IsInCombat();
lastVitality = thePlayer.GetStat(0, /* NOP */);
/* NOP */;
}

public function OnLeaveState(nextStateName : CName) : Bool{


var skillAbilityName : CName;
super.OnLeaveState(nextStateName);
parent.RemoveTimer('CombatComboUpdate', /* NOP */);
parent.RemoveTimer('CombatEndCheck', /* NOP */);
if (nextStateName != 'AimThrow'){
OnCombatActionEndComplete();
}
if (nextStateName != 'CombatFocusMode_SelectSpot'){
if (comboPlayer){
comboPlayer.Deinit();
}
}
parent.SetInteractionPriority(0);
super.CleanUpComboStuff();
skillAbilityName = SkillEnumToName(74);
while (thePlayer.HasAbility(skillAbilityName)){
thePlayer.RemoveAbility(skillAbilityName);
}
/* NOP */;
}
public function OnStateCanGoToCombat() : Bool{
return true;
/* NOP */;
}
public entry function CombatInit(){
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
camera.ChangePivotPositionController('Default');
parent.AddTimer('CombatLoop', 0, true, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
/* NOP */;
}
public timer function CombatLoop(optional timeDelta : Float, optional id
: Int32){
ProcessPlayerOrientation();
ProcessPlayerCombatStance();
parent.GetVisualDebug().AddArrow('heading3', parent.GetWorldPosi
tion(), parent.GetWorldPosition() + VecFromHeading(parent.cachedRawPlayerHeading
), 1.000000, 0.200000, 0.200000, true, Color(255, 0, 255), true, /* NOP */);
UpdateIsInAir();
StatsUpdate();
/* NOP */;
}
private function UpdateIsInAir(){
var mac : CMovingPhysicalAgentComponent;
var isInGround : Bool;
if (thePlayer.IsRagdolled()){
return;
}
mac = (CMovingPhysicalAgentComponent)thePlayer.GetMovingAgentCom
ponent();
if (mac){
isInGround = mac.IsOnGround();
thePlayer.SetIsInAir(!isInGround);
}
/* NOP */;
}
public function StatsUpdate(){
var curVitality : Float;

curVitality = thePlayer.GetStat(0, /* NOP */);


lastVitality = curVitality;
/* NOP */;
}
public timer function CombatEndCheck(optional timeDelta : Float, optiona
l id : Int32){
if (!parent.IsInCombat()){
if (timeToCheckCombatEndCur < 0.000000){
parent.GoToExplorationIfNeeded();
} else {
timeToCheckCombatEndCur -= timeDelta;
}
} else {
timeToCheckCombatEndCur = timeToCheckCombatEndMax;
}
/* NOP */;
}
public function ResetTimeToEndCombat(){
timeToCheckCombatEndCur = timeToCheckCombatEndMax;
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
virtual_parent.OnCombatActionEnd();
/* NOP */;
}
public function OnCFMCameraZoomFail() : Bool{
CFMCameraZoomFail();
/* NOP */;
}
public entry function CFMCameraZoomFail(){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
animation.animation = 'camera_combat_focus_fail';
animation.priority = 4;
animation.blendIn = 0.100000;
animation.blendOut = 0.100000;
animation.weight = 1.000000;
animation.speed = 1.000000;
animation.loop = false;
animation.additive = true;
animation.reset = true;
camera.PlayAnimation(animation);
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
if (super.OnGameCameraTick(moveData, dt)){
return true;
}
if (thePlayer.IsFistFightMinigameEnabled()){
theGame.GetGameCamera().ChangePivotRotationController('E
xploration');
theGame.GetGameCamera().ChangePivotDistanceController('D
efault');
theGame.GetGameCamera().ChangePivotPositionController('D
efault');
moveData.pivotRotationController = theGame.GetGameCamera
().GetActivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera

().GetActivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera
().GetActivePivotPositionController();
moveData.pivotPositionController.SetDesiredPosition(theP
layer.GetWorldPosition(), /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-10.000
000, /* NOP */);
moveData.pivotRotationController.maxPitch = 50.000000;
moveData.pivotDistanceController.SetDesiredDistance(3.50
0000, /* NOP */);
moveData.pivotPositionController.offsetZ = 1.300000;
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(1.000000, 2.000000, 0), 0.300000, dt);
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(parent.GetDisplayTarget().GetWorldPosition() - parent.GetWorldPosition())
+ 60.000000, 0.500000);
}
if (parent.IsThreatened() || parent.GetPlayerMode().GetForceComb
atMode()){
theGame.GetGameCamera().ChangePivotDistanceController('S
criptedCombat');
moveData.pivotDistanceController = theGame.GetGameCamera
().GetActivePivotDistanceController();
}
return false;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var enemies : array<CActor>;
var buff : CBaseGameplayEffect;
var targetCapsuleHeight : Float;
var offset : Float;
var playerToTargetVector : Vector;
enemies = parent.GetMoveTargets();
if (parent.movementLockType == 2){
if (enemies.Size() == 1){
if (parent.IsCombatMusicEnabled() || parent.GetP
layerMode().GetForceCombatMode()){
UpdateCameraInterior(moveData, dt);
} else {
parent.UpdateCameraInterior(moveData, dt
);
}
return true;
} else if (!parent.IsCombatMusicEnabled() && !parent.IsI
nCombatAction()){
parent.UpdateCameraInterior(moveData, dt);
return true;
}
}
buff = parent.GetCurrentlyAnimatedCS();
if (parent.IsInCombatAction() || buff && !parent.IsInCombat() ||
!parent.moveTarget && parent.moveTarget.IsAlive() && parent.IsThreat(parent.mov
eTarget, /* NOP */) || parent.GetPlayerCombatStance() == 2){
parent.UpdateCameraCombatActionButNotInCombat(moveData,
dt);
}
if (!parent.IsInCombatAction()){
virtual_parent.UpdateCameraSprint(moveData, dt);

}
if (virtual_parent.UpdateCameraForSpecialAttack(moveData, dt)){
return true;
}
if (parent.IsCameraLockedToTarget() && !cameraChanneledSignEnabl
ed){
UpdateCameraInterior(moveData, dt);
return true;
}
if (parent.GetPlayerCombatStance() == 1){
if (enemies.Size() <= 1 && parent.moveTarget){
targetCapsuleHeight = (CMovingPhysicalAgentCompo
nent)parent.moveTarget.GetMovingAgentComponent().GetCapsuleHeight();
if (targetCapsuleHeight > 2.000000){
playerToTargetVector = parent.moveTarget
.GetWorldPosition() - parent.GetWorldPosition();
offset = 2 - targetCapsuleHeight + playe
rToTargetVector.Z / -2;
offset = ClampF(offset, 0.000000, 1.0000
00);
DampVectorSpring(moveData.cameraLocalSpa
ceOffset, moveData.cameraLocalSpaceOffsetVel, Vector(moveData.cameraLocalSpaceOf
fset.X, moveData.cameraLocalSpaceOffset.Y, moveData.cameraLocalSpaceOffset.Z + o
ffset), 1.000000, dt);
}
}
}
super.OnGameCameraPostTick(moveData, dt);
/* NOP */;
}
private function ProcessPlayerOrientation(){
var newOrientationTarget : EOrientationTarget;
var customOrientationInfo : SCustomOrientationInfo;
var customOrientationTarget : EOrientationTarget;
if (parent.GetCustomOrientationTarget(customOrientationInfo)){
customOrientationTarget = customOrientationInfo.orientat
ionTarget;
} else {
customOrientationTarget = 5;
}
if (parent.moveTarget){
if (parent.moveTarget.GetGameplayVisibility()){
newOrientationTarget = 1;
} else if (parent.playerMoveType > 0){
newOrientationTarget = 3;
} else {
newOrientationTarget = 0;
}
} else if (parent.IsCastingSign() && !parent.IsInCombat()){
newOrientationTarget = 4;
} else {
newOrientationTarget = 0;
}
if (parent.IsGuarded()){
if (parent.moveTarget){
if (VecDistance(parent.moveTarget.GetWorldPositi
on(), parent.GetWorldPosition()) > parent.findMoveTargetDist){
newOrientationTarget = 3;
}
} else if (!parent.delayOrientationChange){

newOrientationTarget = 3;
}
}
if (parent.IsThrowingItemWithAim()){
newOrientationTarget = 4;
}
if (customOrientationTarget != 5){
newOrientationTarget = customOrientationTarget;
}
if (parent.delayOrientationChange){
newOrientationTarget = parent.GetOrientationTarget();
}
if (newOrientationTarget != parent.GetOrientationTarget()){
parent.SetOrientationTarget(newOrientationTarget);
}
/* NOP */;
}
protected function ProcessPlayerCombatStance(){
var targetCapsuleHeight : Float;
var stance : EPlayerCombatStance;
var playerToTargetVector : Vector;
var playerToTargetDist : Float;
var wasVisibleInCam : Bool;
var moveTargetNPC : CNewNPC;
parent.findMoveTargetDistMin = 10.000000;
moveTargetNPC = (CNewNPC)parent.moveTarget;
if (parent.GetPlayerCombatStance() == 1 || parent.GetPlayerComba
tStance() == 3){
parent.findMoveTargetDist = parent.findMoveTargetDistMax
;
} else {
parent.findMoveTargetDist = parent.findMoveTargetDistMin
;
}
if (parent.moveTarget && moveTargetNPC.GetCurrentStance() != 5 &
& parent.enableStrafe && parent.IsThreat(parent.moveTarget, /* NOP */) && parent
.IsEnemyVisible(parent.moveTarget)){
playerToTargetVector = parent.moveTarget.GetNearestPoint
InPersonalSpace(parent.GetWorldPosition()) - parent.GetWorldPosition();
playerToTargetDist = VecLength(playerToTargetVector);
if (playerToTargetDist <= parent.findMoveTargetDist){
stance = 1;
} else if (parent.findMoveTargetDist <= parent.findMoveT
argetDistMin){
targetCapsuleHeight = (CMovingPhysicalAgentCompo
nent)parent.moveTarget.GetMovingAgentComponent().GetCapsuleHeight();
if (targetCapsuleHeight > 2.000000){
parent.findMoveTargetDistMin = 15.000000
;
parent.findMoveTargetDist = parent.findM
oveTargetDistMin;
if (playerToTargetDist <= parent.findMov
eTargetDist){
stance = 1;
} else {
stance = 2;
}
} else {
stance = 2;
}

} else {
stance = 2;
}
} else if (moveTargetNPC && moveTargetNPC.GetCurrentStance() ==
5){
if (AbsF(playerToTargetVector.Z) < 25 && VecLength2D(pla
yerToTargetVector) < parent.findMoveTargetDist * 2.000000){
stance = 1;
} else {
stance = 2;
}
} else if (parent.IsCastingSign() && !parent.IsInCombat()){
stance = 0;
} else {
stance = parent.GetPlayerCombatStance();
}
if (!parent.IsEnemyVisible(parent.moveTarget)){
if (parent.GetPlayerCombatStance() == 1 || parent.IsInCo
mbat()){
stance = 2;
}
}
if (parent.IsGuarded()){
stance = 3;
} else if (stance == 3){
stance = 2;
}
if (!parent.IsThreatened()){
stance = 0;
}
if (FactsQuerySum("force_stance_normal") > 0){
stance = 0;
}
if (parent.GetPlayerCombatStance() == 1 && stance != 1 && stance
!= 3){
if (!parent.IsEnemyVisible(parent.moveTarget) && playerT
oTargetDist <= parent.findMoveTargetDist){
DisableCombatStance(5.000000, stance);
} else {
SetStance(stance);
}
} else {
SetStance(stance);
}
/* NOP */;
}
protected function DisableCombatStance(timeDelta : Float, stance : EPlay
erCombatStance){
cachedStance = stance;
if (!disableCombatStanceTimer){
disableCombatStanceTimer = true;
parent.AddTimer('DisableCombatStanceTimer', timeDelta, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function DisableCombatStanceTimer(optional timeDelta : Flo
at, optional id : Int32){
SetStance(cachedStance);
/* NOP */;

}
protected function SetStance(stance : EPlayerCombatStance){
parent.RemoveTimer('DisableCombatStanceTimer', /* NOP */);
disableCombatStanceTimer = false;
parent.SetPlayerCombatStance(stance, /* NOP */);
if (stance == 1 || stance == 3){
parent.RestoreOriginalInteractionPriority();
parent.SetScriptMoveTarget(parent.moveTarget);
} else {
parent.SetInteractionPriority(0);
parent.SetScriptMoveTarget(NULL);
}
/* NOP */;
}
public function OnAnimEvent_AllowInput(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (!parent.GetBIsCombatActionAllowed() && !parent.IsActorLocked
ToTarget()){
if (animEventType == 1){
parent.EnableFindTarget(true);
}
}
virtual_parent.OnAnimEvent_AllowInput(animEventName, animEventTy
pe, animInfo);
/* NOP */;
}
public function OnAnimEvent_AllowRoll(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
parent.bIsRollAllowed = false;
}
/* NOP */;
}
public function OnAnimEvent_ForceAttack(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
parent.RemoveTimer('ProcessAttackTimer', /* NOP */);
ProcessAttack(cachedPlayerAttackType, true);
/* NOP */;
}
public function OnAnimEvent_PunchHand(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'PunchHand_Left'){
parent.SetBehaviorVariable('punchHand', 0.000000, /* NOP
*/);
} else if (animEventName == 'PunchHand_Right'){
parent.SetBehaviorVariable('punchHand', 1.000000, /* NOP
*/);
}
/* NOP */;
}
public function OnPreAttackEvent(animEventName : CName, animEventType :
EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimI
nfo) : Bool{
var res : Bool;
res = virtual_parent.OnPreAttackEvent(animEventName, animEventTy
pe, data, animInfo);
if (animEventType == 3 && parent.HasHitTarget()){
comboPlayer.PlayHit();
}
return res;

/* NOP */;
}
public function OnPerformGuard() : Bool{
OnInterruptAttack();
/* NOP */;
}
public function OnPerformEvade(playerEvadeType : EPlayerEvadeType) : Boo
l{
if (playerEvadeType == 1){
parent.bIsRollAllowed = true;
PerformEvade(1, false);
} else if (playerEvadeType == 0){
PerformEvade(1, true);
}
/* NOP */;
}
public entry function PerformEvade(playerEvadeType : EPlayerEvadeType, i
sRolling : Bool){
var rawDodgeHeading : Float;
var predictedDodgePos : Vector;
var lineWidth : Float;
var noCreatureOnLine : Bool;
var tracePosFrom : Vector;
var playerToTargetRot : EulerAngles;
var predictedDodgePosNormal : Vector;
var dodgeNum : Float;
var randNum : Int32;
var randMax : Int32;
var i : Int32;
var submergeDepth : Float;
var dodgeLength : Float;
var intersectPoint : Vector;
var intersectLength : Float;
var playerToPoint : Float;
var moveTargets : array<CActor>;
var playerToTargetAngleDiff : Float;
var playerToRawAngleDiff : Float;
var playerToCamAngleDiff : Float;
var targetCapsuleRadius : Float;
parent.ResetUninterruptedHitsCount();
parent.SetIsCurrentlyDodging(true, isRolling);
parent.RemoveTimer('UpdateDodgeInfoTimer', /* NOP */);
if (parent.IsHardLockEnabled() && parent.GetTarget()){
evadeTarget = parent.GetTarget();
} else {
parent.FindMoveTarget();
evadeTarget = parent.moveTarget;
}
if (isRolling){
dodgeLength = 6.500000;
} else if (parent.GetCurrentStateName() == 'CombatFists'){
dodgeLength = 3.000000;
} else {
dodgeLength = 3.500000;
}
intersectLength = dodgeLength * 0.750000;
evadeTargetPos = evadeTarget.PredictWorldPosition(0.400000);
dodgeDirection = GetEvadeDirection(playerEvadeType);
rawDodgeHeading = GetRawDodgeHeading();
parent.evadeHeading = rawDodgeHeading;

predictedDodgePos = VecFromHeading(rawDodgeHeading) * dodgeLengt


h + parent.GetWorldPosition();
parent.GetVisualDebug().AddSphere('predictedDodgePos', 0.250000,
predictedDodgePos, true, Color(0, 128, 256), 5.000000);
parent.GetVisualDebug().AddSphere('evadeTargetPos', 0.250000, ev
adeTargetPos, true, Color(255, 255, 0), 5.000000);
parent.GetVisualDebug().AddArrow('DodgeVector', parent.GetWorldP
osition(), predictedDodgePos, 1.000000, 0.200000, 0.200000, true, Color(0, 128,
256), true, 5.000000);
turnInPlaceBeforeDodge = false;
if (evadeTarget){
intersectPoint = VecFromHeading(rawDodgeHeading) * VecDo
t(VecFromHeading(rawDodgeHeading), evadeTargetPos - parent.GetWorldPosition()) +
parent.GetWorldPosition();
parent.GetVisualDebug().AddArrow('DodgeVector', parent.G
etWorldPosition(), VecFromHeading(rawDodgeHeading) * intersectLength + parent.Ge
tWorldPosition(), 1.000000, 0.200000, 0.200000, true, Color(0, 128, 256), true,
5.000000);
parent.GetVisualDebug().AddArrow('DodgeVector2', interse
ctPoint, evadeTargetPos, 1.000000, 0.200000, 0.200000, true, Color(0, 128, 256),
true, 5.000000);
moveTargets = parent.GetMoveTargets();
playerToTargetAngleDiff = AbsF(AngleDistance(parent.GetH
eading(), VecHeading(evadeTargetPos - parent.GetWorldPosition())));
playerToRawAngleDiff = AbsF(AngleDistance(rawDodgeHeadin
g, parent.GetHeading()));
if (parent.playerMoveType == 2 || parent.playerMoveType
> 2 && parent.GetSprintingTime() > 0.120000){
if (playerToRawAngleDiff < 90){
dodgeDirection = 0;
} else {
dodgeDirection = 4;
turnInPlaceBeforeDodge = true;
}
} else {
if (playerToTargetAngleDiff > 90){
if (playerToRawAngleDiff < 90){
dodgeDirection = 0;
turnInPlaceBeforeDodge = true;
} else if (VecLength(intersectPoint - pa
rent.GetWorldPosition()) < intersectLength){
if (theGame.TestNoCreaturesOnLin
e(parent.GetWorldPosition(), predictedDodgePos, 0.100000, parent, NULL, true)){
dodgeDirection = 4;
} else {
dodgeDirection = 4;
turnInPlaceBeforeDodge =
true;
}
} else {
dodgeDirection = 4;
turnInPlaceBeforeDodge = true;
}
} else if (playerToRawAngleDiff < 90){
if (VecLength(intersectPoint - parent.Ge
tWorldPosition()) < intersectLength){
if (theGame.TestNoCreaturesOnLin
e(parent.GetWorldPosition(), predictedDodgePos, 0.100000, parent, NULL, true)){
dodgeDirection = 0;
turnInPlaceBeforeDodge =

true;
} else {
dodgeDirection = 0;
}
} else {
dodgeDirection = 0;
}
} else if (VecLength(intersectPoint - parent.Get
WorldPosition()) < intersectLength && AbsF(AngleDistance(VecHeading(intersectPoi
nt - parent.GetWorldPosition()), rawDodgeHeading)) < 10.000000){
if (theGame.TestNoCreaturesOnLine(parent
.GetWorldPosition(), predictedDodgePos, 0.100000, parent, NULL, true)){
dodgeDirection = 4;
} else {
dodgeDirection = 4;
turnInPlaceBeforeDodge = true;
}
} else {
dodgeDirection = 4;
}
targetCapsuleRadius = (CMovingPhysicalAgentCompo
nent)evadeTarget.GetMovingAgentComponent().GetCapsuleRadius();
if (parent.IsHardLockEnabled() && targetCapsuleR
adius > 0.800000){
playerToCamAngleDiff = AbsF(AngleDistanc
e(parent.GetHeading(), VecHeading(theCamera.GetCameraDirection())));
if (playerToCamAngleDiff > 0 && playerTo
CamAngleDiff < 110){
if (playerToRawAngleDiff < 90){
dodgeDirection = 0;
turnInPlaceBeforeDodge =
false;
}
}
if (playerToCamAngleDiff > 60 && playerT
oCamAngleDiff < 135){
if (playerToRawAngleDiff > 120){
dodgeDirection = 4;
turnInPlaceBeforeDodge =
true;
}
}
}
}
}
if (!SkipStaminaDodgeEvadeCost()){
if (isRolling){
parent.DrainStamina(14, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
} else {
parent.DrainStamina(6, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
}
}
if (dodgeDirection == 0){
if (evadeTarget){
evadeTarget.SignalGameplayEventParamInt('Time2Do
dge', 6);
if (wasLockedToTarget){
parent.SetUnpushableTarget(evadeTarget);

}
}
}
if (!theGame.GetWorld().StaticTrace(predictedDodgePos + Vector(0
, 0, 5), predictedDodgePos + Vector(0, 0, -5), predictedDodgePos, predictedDodge
PosNormal, /* NOP */)){
playerToTargetRot.Pitch = 0.000000;
} else {
playerToTargetRot = VecToRotation(predictedDodgePos - pa
rent.GetWorldPosition());
}
submergeDepth = (CMovingPhysicalAgentComponent)parent.GetMovingA
gentComponent().GetSubmergeDepth();
FillDodgePlaylists(isRolling);
if (!parent.GetWeaponHolster().IsMeleeWeaponReady()){
dodgeNum = 0;
} else if (!turnInPlaceBeforeDodge){
if (dodgeDirection == 4){
parent.SetBehaviorVariable('dodgeNum', dodgePlay
listBck[dodgePlaylistBck.Size() - 1], /* NOP */);
dodgePlaylistBck.EraseFast(dodgePlaylistBck.Size
() - 1);
} else {
parent.SetBehaviorVariable('dodgeNum', dodgePlay
listFwd[dodgePlaylistFwd.Size() - 1], /* NOP */);
dodgePlaylistFwd.EraseFast(dodgePlaylistFwd.Size
() - 1);
}
} else if (dodgeDirection == 0){
parent.SetBehaviorVariable('dodgeNum', dodgePlaylistFlip
Fwd[dodgePlaylistFlipFwd.Size() - 1], /* NOP */);
dodgePlaylistFlipFwd.EraseFast(dodgePlaylistFlipFwd.Size
() - 1);
}
parent.SetBehaviorVariable('combatActionType', 2, /* NOP */);
parent.SetBehaviorVariable('playerEvadeDirection', dodgeDirectio
n, /* NOP */);
parent.SetBehaviorVariable('turnInPlaceBeforeDodge', 0.000000, /
* NOP */);
parent.SetBehaviorVariable('isRolling', isRolling, /* NOP */);
if (turnInPlaceBeforeDodge){
parent.SetBehaviorVariable('turnInPlaceBeforeDodge', 1.0
00000, /* NOP */);
}
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
parent.SetCustomRotation('Dodge', GetDodgeHeading(playerEvadeTyp
e), 0.000000, 0.100000, false);
if (turnInPlaceBeforeDodge){
Sleep(0.400000);
} else {
Sleep(0.300000);
}
if (parent.bLAxisReleased){
cachedRawDodgeHeading = rawDodgeHeading;
} else {
cachedRawDodgeHeading = GetRawDodgeHeading();
}
parent.SetCustomRotation('Dodge', GetDodgeHeadingForMovementHead

ing(cachedRawDodgeHeading), 90.000000, 0.000000, false);


parent.BindMovementAdjustmentToEvent('Dodge', 'Dodge');
parent.AddTimer('UpdateDodgeInfoTimer', 0, true, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
parent.WaitForBehaviorNodeDeactivation('DodgeComplete', 0.700000
);
parent.RemoveTimer('UpdateDodgeInfoTimer', /* NOP */);
parent.SetIsCurrentlyDodging(false, /* NOP */);
/* NOP */;
}
private function FillDodgePlaylists(isRolling : Bool){
var linearSequence : array<Float>;
var i : Int32;
var rand : Int32;
var numOfAnims : Int32;
if (dodgePlaylistFwd.Size() <= 0){
dodgePlaylistFwd = CreatePlaylist(2);
}
if (dodgePlaylistFlipFwd.Size() <= 0){
dodgePlaylistFlipFwd = CreatePlaylist(2);
}
if (dodgePlaylistBck.Size() <= 0){
dodgePlaylistBck = CreatePlaylist(3);
}
/* NOP */;
}
private function CreatePlaylist(numOfAnims : Int32) : array<Float>{
var linearSequence : array<Float>;
var i : Int32;
var rand : Int32;
var playList : array<Float>;
linearSequence.Clear();
i = 0;
while (i < numOfAnims){
linearSequence.PushBack(i);
i += 1;
}
i = 0;
while (i < numOfAnims){
rand = RandRange(linearSequence.Size(), 0);
playList.PushBack(linearSequence[rand]);
linearSequence.Erase(rand);
i += 1;
}
return playList;
/* NOP */;
}
private function SkipStaminaDodgeEvadeCost() : Bool{
var targetNPC : CNewNPC;
targetNPC = (CNewNPC)parent.GetTarget();
if (targetNPC){
if (targetNPC.IsAttacking() && parent.CanUseSkill(24)){
return true;
}
}
return false;
/* NOP */;
}
protected function GetEvadeDirection(playerEvadeType : EPlayerEvadeType)
: EPlayerEvadeDirection{

var rawToHeadingAngleDiff : Float;


var evadeDirection : EPlayerEvadeDirection;
var unusedActor : CActor;
var inputToleranceFwd : Float;
var inputToleranceBck : Float;
var checkedHeading : Vector;
var moveTargets : array<CActor>;
var tempAngleDiff : Float;
moveTargets = parent.GetMoveTargets();
inputToleranceFwd = 45.000000;
inputToleranceBck = 135.000000;
if (playerEvadeType == 1){
checkedHeading = VecFromHeading(parent.GetCombatActionHe
ading());
if (parent.GetPlayerCombatStance() == 1 || parent.GetPla
yerCombatStance() == 3){
inputToleranceFwd = 90.000000;
inputToleranceBck = 90.000000;
rawToHeadingAngleDiff = AngleDistance(VecHeading
(evadeTarget.GetWorldPosition() - parent.GetWorldPosition()), parent.GetCombatAc
tionHeading());
} else {
rawToHeadingAngleDiff = AngleDistance(parent.Get
Heading(), parent.GetCombatActionHeading());
}
} else if (playerEvadeType == 2){
if (wasLockedToTarget){
inputToleranceFwd = 30.000000;
inputToleranceBck = 30.000000;
rawToHeadingAngleDiff = AngleDistance(VecHeading
(evadeTargetPos - parent.GetWorldPosition()), parent.GetCombatActionHeading());
} else {
rawToHeadingAngleDiff = AngleDistance(parent.Get
Heading(), parent.GetCombatActionHeading());
}
} else {
rawToHeadingAngleDiff = AngleDistance(parent.GetHeading(
), parent.GetCombatActionHeading());
}
if (parent.lAxisReleasedAfterCounterNoCA){
evadeDirection = 4;
} else if (parent.GetIsSprinting()){
evadeDirection = 0;
} else if (rawToHeadingAngleDiff >= -1 * inputToleranceFwd && ra
wToHeadingAngleDiff < inputToleranceFwd){
evadeDirection = 0;
} else if (rawToHeadingAngleDiff >= inputToleranceFwd && rawToHe
adingAngleDiff < 180 - inputToleranceBck){
evadeDirection = 6;
} else if (rawToHeadingAngleDiff >= -180 + inputToleranceBck &&
rawToHeadingAngleDiff < -1 * inputToleranceFwd){
evadeDirection = 2;
} else {
evadeDirection = 4;
}
return evadeDirection;
/* NOP */;
}
public function GetRawDodgeHeading() : Float{
var heading : Float;

if (wasLockedToTarget){
if (dodgeDirection == 0){
heading = VecHeading(evadeTargetPos - parent.Get
WorldPosition());
} else if (dodgeDirection == 2){
heading = VecHeading(evadeTargetPos - parent.Get
WorldPosition()) + 90;
} else if (dodgeDirection == 6){
heading = VecHeading(evadeTargetPos - parent.Get
WorldPosition()) - 90;
} else {
heading = VecHeading(evadeTargetPos - parent.Get
WorldPosition()) - 180;
}
} else {
if (parent.lAxisReleasedAfterCounterNoCA){
heading = parent.GetHeading() + 180;
} else {
heading = parent.rawPlayerHeading;
}
if (parent.lAxisReleasedAfterCounterNoCA && evadeTarget)
{
heading = VecHeading(parent.GetWorldPosition() evadeTarget.GetWorldPosition());
}
}
parent.GetVisualDebug().AddArrow('Dodge', parent.GetWorldPositio
n(), parent.GetWorldPosition() + VecFromHeading(heading) * 3, 1.000000, 0.200000
, 0.200000, true, Color(256, 128, 128), true, 5.000000);
return heading;
/* NOP */;
}
public function GetDodgeHeading(playerEvadeType : EPlayerEvadeType) : Fl
oat{
var unusedActor : CActor;
var rawDodgeHeading : Float;
var dodgeHeading : Float;
rawDodgeHeading = GetRawDodgeHeading();
if (dodgeDirection == 0){
dodgeHeading = rawDodgeHeading;
} else if (dodgeDirection == 6){
dodgeHeading = rawDodgeHeading + 90;
} else if (dodgeDirection == 2){
dodgeHeading = rawDodgeHeading - 90;
} else {
dodgeHeading = rawDodgeHeading + 180;
}
return dodgeHeading;
/* NOP */;
}
public timer function UpdateDodgeInfoTimer(optional time : Float, option
al id : Int32){
if (wasLockedToTarget && evadeTarget){
parent.UpdateCustomRotationHeading('Dodge', VecHeading(e
vadeTargetPos - parent.GetWorldPosition()));
parent.UpdateCustomLockMovementHeading('DodgeMovement',
GetRawDodgeHeading());
} else {
if (!parent.bLAxisReleased){
cachedRawDodgeHeading = GetRawDodgeHeading();

}
parent.UpdateCustomRotationHeading('Dodge', GetDodgeHead
ingForMovementHeading(cachedRawDodgeHeading));
}
/* NOP */;
}
public function GetDodgeHeadingForMovementHeading(movementHeading : Floa
t) : Float{
var heading : Float;
if (evadeTarget && parent.bLAxisReleased){
heading = parent.GetHeading();
}
if (dodgeDirection == 0){
heading = movementHeading;
} else if (dodgeDirection == 6){
heading = movementHeading + 90;
} else if (dodgeDirection == 2){
heading = movementHeading - 90;
} else {
heading = movementHeading + 180;
}
if (turnInPlaceBeforeDodge){
return heading + 180;
}
return heading;
/* NOP */;
}
public timer function UpdateRollInfoTimer(optional time : Float, optiona
l id : Int32){
var playerToTargetDist : Float;
var evadeTargetSpeed : Float;
if (wasLockedToTarget && evadeTarget){
parent.UpdateCustomRotationHeading('Roll', GetRawDodgeHe
ading());
parent.UpdateCustomLockMovementHeading('RollMovement', G
etRawDodgeHeading());
} else if (!parent.bLAxisReleased){
parent.UpdateCustomRotationHeading('Roll', parent.rawPla
yerHeading);
} else {
parent.UpdateCustomRotationHeading('Roll', VecHeading(pa
rent.GetHeadingVector()));
}
parent.GetVisualDebug().AddArrow('dodgeInitialHeading', parent.G
etWorldPosition(), parent.GetWorldPosition() + VecFromHeading(parent.rawPlayerHe
ading) * 3, 1.000000, 0.200000, 0.200000, true, Color(256, 128, 256), true, 5.00
0000);
/* NOP */;
}
protected function GetLandingEvadeDirection(landAt : Vector, evadingHead
ing : Float) : EPlayerEvadeDirection{
var playerToTargetHeading : Float;
var headingDiff : Float;
var changeDirection : EPlayerEvadeDirection;
var dontChangeAngle : Float;
var currentDodgeFwdHeading : Float;
dontChangeAngle = 180;
playerToTargetHeading = VecHeading(evadeTargetPos - landAt);
currentDodgeFwdHeading = GetDodgeHeadingForMovementHeading(evadi
ngHeading);

headingDiff = AngleDistance(playerToTargetHeading, currentDodgeF


wdHeading);
if (headingDiff >= -dontChangeAngle && headingDiff < dontChangeA
ngle){
changeDirection = 0;
} else if (headingDiff >= dontChangeAngle){
changeDirection = 6;
} else {
changeDirection = 2;
}
if (changeDirection == 0){
return dodgeDirection;
}
if (changeDirection == 6){
switch(dodgeDirection){
case 0:
return 6;
case 6:
return 4;
case 4:
return 2;
case 2:
return 0;
}
}
if (changeDirection == 2){
switch(dodgeDirection){
case 0:
return 2;
case 6:
return 0;
case 4:
return 6;
case 2:
return 4;
}
}
return dodgeDirection;
/* NOP */;
}
private final function CleanUpComboStuff(){
comboAttackA_Id = -1;
comboAttackB_Id = -1;
comboAttackA_Target = NULL;
comboAttackB_Target = NULL;
comboAttackA_Sliding = false;
comboAttackB_Sliding = false;
comboAspectName = 'None';
/* NOP */;
}
private final function CacheComboAttack(attackId : Int32, slideTarget :
CGameplayEntity, sliding : Bool, aspectName : CName){
comboAttackB_Id = comboAttackA_Id;
comboAttackB_Target = comboAttackA_Target;
comboAttackB_Sliding = comboAttackA_Sliding;
comboAttackA_Id = attackId;
comboAttackA_Target = slideTarget;
comboAttackA_Sliding = sliding;
comboAspectName = aspectName;
/* NOP */;

}
public final function BuildComboPlayer(){
if (!comboPlayer){
BuildCombo();
}
if (comboPlayer){
comboPlayer.Init();
}
/* NOP */;
}
private final function BuildCombo(){
comboDefinition = new CComboDefinition in this;
OnCreateAttackAspects();
comboPlayer = new CComboPlayer in this;
if (!comboPlayer.Build(comboDefinition, parent)){
/* NOP */;
}
comboPlayer.SetDurationBlend(0.200000);
CleanUpComboStuff();
/* NOP */;
}
public function OnCreateAttackAspects() : Bool{
}
public function OnPerformAttack(playerAttackType : CName) : Bool{
var actor : CActor;
var finish : CComponent;
var playerToTargetHeading : Float;
var shouldFaceTarget : Bool;
var aiStorageObject : IScriptable;
var newTarget : CActor;
if (parent.DisableManualCameraControlStackHasSource('Finisher'))
{
return false;
}
if (!thePlayer.IsCombatMusicEnabled() && !thePlayer.CanAttackWhe
nNotInCombat(1, false, newTarget, /* NOP */)){
if (parent.IsInCombatActionFriendly()){
return false;
}
actor = (CActor)parent.slideTarget;
shouldFaceTarget = true;
if (shouldFaceTarget){
parent.SetBehaviorVariable('playerToTargetDistFo
rOverlay', VecDistance(parent.GetWorldPosition(), actor.GetNearestPointInPersona
lSpace(parent.GetWorldPosition())), /* NOP */);
} else {
parent.SetBehaviorVariable('playerToTargetDistFo
rOverlay', 50.000000, /* NOP */);
}
aiStorageObject = actor.GetAIStorageObject('ReactionData
');
if (virtual_parent.DisplayCannotAttackMessage(actor)){
return false;
} else {
if (parent.RaiseAttackFriendlyEvent(actor)){
return true;
}
return false;
}
} else {

if (parent.IsInCombatActionFriendly()){
parent.RaiseEvent('CombatActionFriendlyEnd');
}
parent.SendAttackReactionEvent();
ProcessAttackApproach(playerAttackType);
parent.ObtainTicketFromCombatTarget('TICKET_Melee', 1000
0);
parent.ObtainTicketFromCombatTarget('TICKET_Range', 1000
0);
parent.RemoveTimer('FreeTickets', /* NOP */);
}
/* NOP */;
}
private function IsInCombatAction_Attack() : Bool{
return parent.IsInCombatAction_Attack();
/* NOP */;
}
public entry function ProcessAttackApproach(playerAttackType : CName){
var playerToTargetDist : Float;
var playerToTargetVec : Vector;
var actor : CActor;
var npc : CNewNPC;
var isDeadlySwordHeld : Bool;
actor = (CActor)parent.slideTarget;
npc = (CNewNPC)parent.slideTarget;
FactsAdd("ach_attack", 1, 4);
theGame.GetGamerProfile().CheckLearningTheRopes();
if (actor && !npc || npc.GetCurrentStance() != 5){
finisherDist = 1.500000;
actor.IsAttacked(true);
if (actor.GetComponent("Finish").IsEnabled() && parent.G
etCurrentStateName() == 'CombatSteel' || parent.GetCurrentStateName() == 'Combat
Silver'){
parent.OnForceTicketUpdate();
}
playerToTargetDist = GetPlayerToTargetDistance(true, 1.0
00000, /* NOP */);
playerToTargetVec = parent.GetWorldPosition() - actor.Ge
tWorldPosition();
if (AbsF(playerToTargetVec.Z) > 1.000000){
isOnHighSlope = true;
} else {
isOnHighSlope = false;
}
if (parent.GetCurrentStateName() == 'CombatFists'){
farAttackMinDist = 3.000000;
} else {
farAttackMinDist = 4.000000;
}
if (actor.GetComponent("Finish").IsEnabled() && playerTo
TargetDist < GetMaxAttackDist() + 1.000000 && parent.GetCurrentStateName() == 'C
ombatSteel' || parent.GetCurrentStateName() == 'CombatSilver'){
isDeadlySwordHeld = parent.IsDeadlySwordHeld();
if (playerToTargetDist < finisherDist || !isDead
lySwordHeld){
ProcessAttack(playerAttackType, false);
} else if (parent.IsInCombatAction() && parent.G
etBehaviorVariable('combatActionType', /* NOP */) == 8){
if (previousSlideTarget != actor){
EnableAttackApproach(playerAttac

kType);
}
} else {
EnableAttackApproach(playerAttackType);
}
} else if (parent.approachAttack == 0){
if (playerToTargetDist > farAttackMinDist && pla
yerToTargetDist < parent.softLockDist){
if (parent.IsInCombatAction() && parent.
GetBehaviorVariable('combatActionType', /* NOP */) == 8){
if (previousSlideTarget != actor
){
EnableAttackApproach(pla
yerAttackType);
}
} else {
EnableAttackApproach(playerAttac
kType);
}
} else {
ProcessAttack(playerAttackType, false);
}
} else {
ProcessAttack(playerAttackType, false);
}
} else {
ProcessAttack(playerAttackType, false);
}
/* NOP */;
}
public entry function EnableAttackApproach(playerAttackType : CName){
var playerToTargetHeading : Float;
previousSlideTarget = parent.slideTarget;
playerToTargetHeading = VecHeading(parent.slideTarget.GetWorldPo
sition() - parent.GetWorldPosition());
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
parent.SetBehaviorVariable('combatActionType', 8, /* NOP */);
parent.SetCustomRotation('PreAttack_Rotation', playerToTargetHea
ding, 0.000000, 0.200000, false);
parent.CustomLockMovement('PreAttack_Movement', playerToTargetHe
ading);
parent.BindMovementAdjustmentToEvent('PreAttack_Movement', 'PreA
ttack_Movement');
cachedPlayerAttackType = playerAttackType;
parent.SetBehaviorVariable('approachDirectionWS', playerToTarget
Heading, /* NOP */);
parent.SetBehaviorVariable('approachDirectionLS', AngleDistance(
parent.GetHeading(), playerToTargetHeading) / 180, /* NOP */);
parent.AddTimer('ProcessAttackTimer', 0.100000, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function ProcessAttackTimer(optional time : Float, optional
id : Int32){
var slideDistance : Float;
var playerToTargetDist : Float;
var playerToTargetHeading : Float;
playerToTargetDist = GetPlayerToTargetDistance(true, 1.000000, /

* NOP */);
playerToTargetHeading = VecHeading(parent.slideTarget.GetWorldPo
sition() - parent.GetWorldPosition());
parent.SetBehaviorVariable('approachDirectionWS', playerToTarget
Heading, /* NOP */);
parent.SetBehaviorVariable('approachDirectionLS', AngleDistance(
parent.GetHeading(), playerToTargetHeading) / 180, /* NOP */);
parent.UpdateCustomLockMovementHeading('PreAttack_Movement', pla
yerToTargetHeading);
parent.UpdateCustomRotationHeading('PreAttack_Movement', playerT
oTargetHeading);
if (!parent.slideTarget){
ProcessAttack(cachedPlayerAttackType, true);
} else if (parent.slideTarget.GetComponent("Finish").IsEnabled()
){
playerToTargetDist = GetPlayerToTargetDistance(false, 1.
000000, /* NOP */);
if (playerToTargetDist < finisherDist){
ProcessAttack(cachedPlayerAttackType, true);
}
} else if (isOnHighSlope){
if (playerToTargetDist < 2.000000){
ProcessAttack(cachedPlayerAttackType, true);
}
} else if (playerToTargetDist < farAttackMinDist){
ProcessAttack(cachedPlayerAttackType, true);
}
if (playerToTargetDist < prevPlayerToTargetDist){
wasDecreasing = true;
} else if (wasDecreasing && playerToTargetDist > prevPlayerToTar
getDist){
wasDecreasing = false;
ProcessAttack(cachedPlayerAttackType, true);
}
prevPlayerToTargetDist = playerToTargetDist;
/* NOP */;
}
public timer function AttackTimerEnd(optional time : Float, optional id
: Int32){
var slideTargetNPC : CNewNPC;
slideTargetNPC = (CNewNPC)parent.slideTarget;
if (!slideTargetNPC || !slideTargetNPC.IsInFinisherAnim() || !pa
rent.isInFinisher){
parent.SetSlideTarget(parent.GetCombatActionTarget(1));
ProcessAttack(cachedPlayerAttackType, true);
}
/* NOP */;
}
public entry function ProcessAttack(playerAttackType : CName, performApp
roachAttack : Bool){
var temp1 : CName;
var temp2 : Bool;
var temp3 : Bool;
var temp4 : Bool;
var playerToTargetVec : Vector;
var playerToTargetRot : EulerAngles;
var targetCapsuleHeight : Float;
var attackTarget : CActor;
var tempPos1 : Vector;
var tempPos2 : Vector;

var noSlideTargetPos : Vector;


var noSlideTargetNormal : Vector;
var temp : CActor;
var npc : CNewNPC;
var npcAttackTarget : CNewNPC;
var witcher : W3PlayerWitcher;
var i : Int32;
var isDeadlySwordHeld : Bool;
var comp : CComponent;
var compEnabled : Bool;
var useNormalAttack : Bool;
parent.RemoveTimer('ProcessAttackTimer', /* NOP */);
parent.RemoveTimer('AttackTimerEnd', /* NOP */);
npc = (CNewNPC)parent.slideTarget;
comp = npc.GetComponent("Finish");
compEnabled = comp.IsEnabled();
isDeadlySwordHeld = parent.IsDeadlySwordHeld();
if (npc && compEnabled && VecDistance(parent.GetWorldPosition(),
npc.GetNearestPointInBothPersonalSpaces(parent.GetWorldPosition())) < 1.500000
|| !isDeadlySwordHeld){
if (!isDeadlySwordHeld){
if (parent.IsWeaponHeld('fist')){
parent.SetBehaviorVariable('combatTauntT
ype', 1.000000, /* NOP */);
} else {
parent.SetBehaviorVariable('combatTauntT
ype', 0.000000, /* NOP */);
}
if (parent.RaiseEvent('CombatTaunt')){
parent.PlayBattleCry('BattleCryTaunt', 1
.000000, true, true);
}
} else if (parent.IsWeaponHeld('steelsword') || parent.I
sWeaponHeld('silversword')){
if (!theGame.GetWorld().NavigationLineTest(paren
t.GetWorldPosition(), npc.GetWorldPosition(), 0.400000, /* NOP */, /* NOP */)){
useNormalAttack = true;
comp.SetEnabled(false);
} else if (!parent.isInFinisher){
npc.SignalGameplayEvent('Finisher');
parent.AddTimer('AttackTimerEnd', 0.2000
00, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
parent.SetBehaviorVariable('combatTauntType', 0.
000000, /* NOP */);
if (parent.RaiseEvent('CombatTaunt')){
parent.PlayBattleCry('BattleCryTaunt', 1
.000000, true, true);
}
}
} else {
useNormalAttack = true;
}
if (useNormalAttack){
parent.GetMovingAgentComponent().GetMovementAdjustor().C
ancelAll();
if (!comboPlayer){
super.BuildComboPlayer();
}

enableSoftLock = true;
if (parent.IsInCombat() && thePlayer.IsSprintActionPress
ed() && !parent.bLAxisReleased && !parent.IsActorLockedToTarget() && parent.GetF
orceDisableUpdatePosition()){
enableSoftLock = false;
}
updatePosition = true;
if (!enableSoftLock){
updatePosition = false;
}
attackTarget = (CActor)parent.slideTarget;
npcAttackTarget = (CNewNPC)attackTarget;
if (attackTarget){
attackTarget.SetUnpushableTarget(parent);
parent.SetUnpushableTarget(attackTarget);
}
parent.SetBehaviorVariable('combatActionType', 0, /* NOP
*/);
if (parent.slideTarget){
playerToTargetVec = parent.slideTarget.GetWorldP
osition() - parent.GetWorldPosition();
} else {
tempPos1 = parent.GetWorldPosition() + parent.Ge
tHeadingVector() * 4;
tempPos1.Z += 10.000000;
tempPos2 = tempPos1;
tempPos2.Z -= 20.000000;
theGame.GetWorld().StaticTrace(tempPos1, tempPos
2, noSlideTargetPos, noSlideTargetNormal, /* NOP */);
playerToTargetVec = parent.GetWorldPosition() noSlideTargetPos;
}
if (playerAttackType == theGame.params.ATTACK_NAME_LIGHT
){
if (npc){
npc.SignalGameplayEventParamInt('Time2Do
dge', 0);
}
if (parent.GetCurrentStateName() == 'CombatFists
'){
if (parent.slideTarget){
if (!attackTarget || !parent.IsT
hreat(attackTarget, /* NOP */)){
comboPlayer.PlayAttack('
AttackLightNoTarget');
} else {
comboPlayer.PlayAttack('
AttackLight');
}
} else {
comboPlayer.PlayAttack('AttackLi
ghtNoTarget');
}
} else if (npc && npc.IsUsingHorse(/* NOP */)){
comboPlayer.PlayAttack('AttackLightVsRid
er');
} else if (!parent.IsInShallowWater() && npc &&
npc.GetCurrentStance() == 5 || npc.IsInAir()){
if (playerToTargetVec.Z >= 0.000000){
comboPlayer.PlayAttack('AttackLi

ghtFlying');
} else {
comboPlayer.PlayAttack('AttackLi
ghtSlopeDown');
}
} else {
if (attackTarget){
targetCapsuleHeight = (CMovingPh
ysicalAgentComponent)attackTarget.GetMovingAgentComponent().GetCapsuleHeight();
} else {
targetCapsuleHeight = 0;
}
playerToTargetRot = VecToRotation(player
ToTargetVec);
if (playerToTargetVec.Z > 0.400000 && Ab
sF(playerToTargetRot.Pitch) > 12.000000 || parent.IsInShallowWater()){
comboPlayer.PlayAttack('AttackLi
ghtSlopeUp');
} else if (playerToTargetVec.Z < -0.3500
00 && AbsF(playerToTargetRot.Pitch) > 12.000000){
comboPlayer.PlayAttack('AttackLi
ghtSlopeDown');
} else if (!parent.slideTarget){
comboPlayer.PlayAttack('AttackLi
ght');
} else if (targetCapsuleHeight < 1.50000
0){
comboPlayer.PlayAttack('AttackLi
ghtCapsuleShort');
} else {
comboPlayer.PlayAttack('AttackLi
ght');
}
}
virtual_parent.OnCombatActionStart();
} else if (playerAttackType == theGame.params.ATTACK_NAM
E_HEAVY){
thePlayer.PlayBattleCry('BattleCryAttack', 0.100
000, /* NOP */, /* NOP */);
if (parent.GetCurrentStateName() == 'CombatFists
'){
if (parent.slideTarget){
if (!attackTarget || !parent.IsT
hreat(attackTarget, /* NOP */)){
comboPlayer.PlayAttack('
AttackHeavyNoTarget');
} else {
comboPlayer.PlayAttack('
AttackHeavy');
}
} else {
comboPlayer.PlayAttack('AttackHe
avyNoTarget');
}
} else {
if (npc && npc.IsUsingHorse(/* NOP */)){
comboPlayer.PlayAttack('AttackHe
avyVsRider');
} else if (parent.slideTarget){
if (npc && npc.GetCurrentStance(

) == 5 || npc.IsInAir()){
comboPlayer.PlayAttack('
AttackHeavyFlying');
} else {
comboPlayer.PlayAttack('
AttackHeavy');
}
} else {
comboPlayer.PlayAttack('AttackHe
avy');
}
witcher = (W3PlayerWitcher)parent;
if (witcher){
witcher.ToggleSpecialAttackHeavy
Allowed(true);
parent.AddTimer('SpecialAttackHe
avyAllowedTimer', 0.200000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/);
}
}
virtual_parent.OnCombatActionStart();
} else {
/* NOP */;
}
}
/* NOP */;
}
public timer function SpecialAttackHeavyAllowedTimer(optional time : Flo
at, optional id : Int32){
(W3PlayerWitcher)parent.ToggleSpecialAttackHeavyAllowed(false);
/* NOP */;
}
public function OnInterruptAttack() : Bool{
parent.RaiseEvent('AttackInterrupt');
/* NOP */;
}
public function OnComboAttackCallback(callbackInfo : SComboAttackCallbac
kInfo){
var angle : Float;
var playerHeading : Float;
var playerToTargetHeading : Float;
var playerToTargetAngleDiff : Float;
var playerToTargetDist : Float;
var farAttackMinDist : Float;
var mediumAttackMinDist : Float;
var enableCloseCombatRadius : Bool;
var isHumanoid : Bool;
var maxAttackDist : Float;
var actorTarget : CActor;
var isLightAttack : Bool;
var attackTarget : CGameplayEntity;
var playerToTargetVec : Vector;
var attackTargetActor : CActor;
/* NOP */;
callbackInfo.outShouldRotate = true;
if (callbackInfo.inAspectName == 'AttackLight' || callbackInfo.i
nAspectName == 'AttackLightNoTarget' || callbackInfo.inAspectName == 'AttackLigh
tCapsuleShort' || callbackInfo.inAspectName == 'AttackLightFlying' || callbackIn
fo.inAspectName == 'AttackLightSlopeDown' || callbackInfo.inAspectName == 'Attac
kLightSlopeUp' || callbackInfo.inAspectName == 'AttackLightVsRider' || callbackI

nfo.inAspectName == 'AttackLightFar'){
isLightAttack = true;
} else {
isLightAttack = false;
}
playerToTargetVec = parent.slideTarget.GetWorldPosition() - pare
nt.GetWorldPosition();
if (parent.slideTarget && enableSoftLock && !(CNewNPC)parent.sli
deTarget || (CActor)parent.slideTarget.GetGameplayVisibility() && (CNewNPC)paren
t.slideTarget.GetCurrentStance() != 5 || playerToTargetVec.Z < 2.500000 || paren
t.IsActorLockedToTarget()){
attackTarget = parent.slideTarget;
if (parent.HasAbility('NoTransOnHitCheat')){
parent.SetHitReactTransScale(0.000000);
} else if (parent.HasAbility('NoCloseCombatCheat')){
parent.SetHitReactTransScale(1.000000);
} else if (isLightAttack && callbackInfo.inStringAttackC
ounter >= 2 && !(CActor)parent.slideTarget.IsGuarded() && !wasInCloseCombat){
parent.SetHitReactTransScale(0.500000);
} else {
parent.SetHitReactTransScale(1.000000);
}
playerToTargetDist = GetPlayerToTargetDistance(true, par
ent.GetHitReactTransScale(), 0.200000);
if (!parent.GetBIsCombatActionAllowed()){
if (playerToTargetDist > parent.softLockDist){
parent.EnableFindTarget(true);
parent.SetSlideTarget(parent.GetTarget()
);
playerToTargetDist = GetPlayerToTargetDi
stance(true, parent.GetHitReactTransScale(), 0.200000);
}
}
attackTargetActor = (CActor)parent.slideTarget;
attackTargetActor.IsAttacked(true);
if (parent.GetPlayerCombatStance() == 1 || parent.GetPla
yerCombatStance() == 3){
callbackInfo.outRotateToEnemyAngle = VecHeading(
parent.slideTarget.GetWorldPosition() - parent.GetWorldPosition());
} else {
callbackInfo.outRotateToEnemyAngle = parent.GetC
ombatActionHeading();
}
if ((CActor)parent.slideTarget){
callbackInfo.outSlideToPosition = (CActor)parent
.slideTarget.GetNearestPointInBothPersonalSpaces(parent.GetWorldPosition());
} else {
callbackInfo.outSlideToPosition = parent.slideTa
rget.GetWorldPosition();
}
playerToTargetAngleDiff = AngleDistance(callbackInfo.out
RotateToEnemyAngle, parent.GetHeading());
callbackInfo.outShouldTranslate = false;
if (parent.GetCurrentStateName() == 'CombatFists'){
farAttackMinDist = 2.000000;
mediumAttackMinDist = 0.750000;
} else {
farAttackMinDist = 2.500000;
mediumAttackMinDist = 1.000000;
}

enableCloseCombatRadius = false;
actorTarget = (CActor)parent.slideTarget;
if (actorTarget && CalculateAttributeValue(actorTarget.G
etAttributeValue('humanoid', /* NOP */, /* NOP */), /* NOP */) > 0.000000){
isHumanoid = true;
} else {
isHumanoid = false;
}
if (parent.GetIsSprinting()){
callbackInfo.outDistance = 2;
} else if (playerToTargetDist > parent.softLockDist){
callbackInfo.outDistance = 1;
} else if (playerToTargetDist > farAttackMinDist){
callbackInfo.outDistance = 2;
} else if (playerToTargetDist > mediumAttackMinDist){
callbackInfo.outDistance = 1;
} else {
callbackInfo.outDistance = 1;
}
if (parent.slideTarget && (CActor)parent.slideTarget){
if ((CActor)parent.slideTarget.IsCurrentlyDodgin
g()){
callbackInfo.outDistance = 1;
}
if (GetAttitudeBetween(parent, parent.slideTarge
t) != 2){
callbackInfo.outDistance = 1;
}
}
if (callbackInfo.inAspectName == 'AttackNeutral'){
if (playerToTargetDist > 1.000000 || parent.HasA
bility('NoCloseCombatCheat')){
callbackInfo.outDistance = 1;
} else {
callbackInfo.outDistance = 0;
}
}
if (callbackInfo.outDistance != 0 || callbackInfo.inAspe
ctName == 'AttackHeavy'){
wasInCloseCombat = false;
} else {
wasInCloseCombat = true;
}
} else {
callbackInfo.outShouldTranslate = false;
callbackInfo.outSlideToPosition = parent.GetWorldPositio
n() + VecFromHeading(parent.GetCombatActionHeading());
callbackInfo.outRotateToEnemyAngle = parent.GetCombatAct
ionHeading();
playerToTargetAngleDiff = AngleDistance(callbackInfo.out
RotateToEnemyAngle, VecHeading(parent.GetHeadingVector()));
if (parent.GetIsSprinting()){
callbackInfo.outDistance = 2;
} else {
callbackInfo.outDistance = 1;
}
}
if (playerToTargetAngleDiff < -135.000000){
callbackInfo.outDirection = 3;
} else if (playerToTargetAngleDiff < -45.000000){

callbackInfo.outDirection = 2;
} else if (playerToTargetAngleDiff > 135.000000){
callbackInfo.outDirection = 3;
} else if (playerToTargetAngleDiff > 45.000000){
callbackInfo.outDirection = 1;
} else {
callbackInfo.outDirection = 0;
}
if (callbackInfo.inStringAttackCounter == 0 || callbackInfo.inGl
obalAttackCounter == 0){
parent.SetBIsFirstAttackInCombo(true);
} else if (callbackInfo.inStringAttackCounter >= 2){
parent.SetBIsFirstAttackInCombo(false);
}
if (callbackInfo.inAspectName == 'AttackNeutral'){
callbackInfo.outDirection = 0;
}
if (callbackInfo.inAspectName == 'AttackNeutral'){
callbackInfo.outAttackType = 0;
} else if (callbackInfo.inStringAttackCounter == 0 || AbsF(playe
rToTargetAngleDiff) >= 45.000000 || playerToTargetDist > farAttackMinDist || !pa
rent.slideTarget){
callbackInfo.outAttackType = 1;
callbackInfo.outShouldTranslate = true;
} else {
callbackInfo.outAttackType = 0;
}
if (callbackInfo.outShouldTranslate){
super.MarkSlidePosition(callbackInfo.outSlideToPosition)
;
}
if (parent.GetBehaviorVariable('combatIdleStance', /* NOP */) >
0.800000){
callbackInfo.outLeftString = false;
} else {
callbackInfo.outLeftString = true;
}
if (callbackInfo.inAspectName == 'AttackHeavy'){
parent.SetBehaviorVariable('playerAttackType', 1, /* NOP
*/);
} else {
parent.SetBehaviorVariable('playerAttackType', 0, /* NOP
*/);
}
parent.EnableCloseCombatCharacterRadius(enableCloseCombatRadius)
;
super.CacheComboAttack(callbackInfo.inAttackId, attackTarget, ca
llbackInfo.outShouldTranslate, callbackInfo.inAspectName);
/* NOP */;
}
private function GetMaxAttackDist() : Float{
var maxAttackDist : Float;
if (parent.approachAttack == 0){
maxAttackDist = 0.000000;
} else if (parent.approachAttack == 2){
maxAttackDist = 7.000000;
} else {
maxAttackDist = 4.000000;
}
return maxAttackDist;

/* NOP */;
}
private function GetPlayerToTargetDistance(getPredictedDistance : Bool,
translationScale : Float, customTime : Float) : Float{
var predictionTime : Float;
var targetCapsuleRadius : Float;
var nearestPoint : Vector;
var nearestPointNoPredict : Vector;
var predictedPos : Vector;
var currentPos : Vector;
var scaledCurrToPredictedVector : Vector;
var capsuleOffsetVec : Vector;
var dist : Float;
var distPredict : Float;
var slideTargetNPC : CNewNPC;
if ((CActor)parent.slideTarget){
targetCapsuleRadius = (CMovingPhysicalAgentComponent)(CA
ctor)parent.slideTarget.GetMovingAgentComponent().GetCapsuleRadius();
}
if (customTime > 0.000000){
predictionTime = customTime;
} else {
predictionTime = 0.800000;
}
if (getPredictedDistance && (CActor)parent.slideTarget && !paren
t.slideTarget.IsRagdolled()){
currentPos = parent.slideTarget.GetWorldPosition();
predictedPos = (CActor)parent.slideTarget.PredictWorldPo
sition(predictionTime);
scaledCurrToPredictedVector = predictedPos - currentPos
* translationScale;
predictedPos = currentPos + scaledCurrToPredictedVector;
capsuleOffsetVec = targetCapsuleRadius * VecNormalize(pa
rent.GetWorldPosition() - parent.slideTarget.GetWorldPosition());
nearestPoint = predictedPos + capsuleOffsetVec;
} else {
nearestPoint = parent.slideTarget.GetWorldPosition() + t
argetCapsuleRadius * VecNormalize(parent.GetWorldPosition() - parent.slideTarget
.GetWorldPosition());
}
nearestPointNoPredict = parent.slideTarget.GetWorldPosition() +
capsuleOffsetVec;
distPredict = VecDistance(parent.GetWorldPosition(), nearestPoin
t);
dist = VecDistance(parent.GetWorldPosition(), nearestPointNoPred
ict);
if (distPredict > dist){
parent.GetVisualDebug().AddSphere('playerToTargetDist',
0.250000, nearestPoint, true, Color(128, 128, 128), 3.000000);
return distPredict;
} else {
slideTargetNPC = (CNewNPC)parent.slideTarget;
if (slideTargetNPC && slideTargetNPC.IsAttacking() && sl
ideTargetNPC.GetTarget() == parent){
parent.GetVisualDebug().AddSphere('playerToTarge
tDist', 0.250000, nearestPoint, true, Color(128, 128, 128), 3.000000);
return distPredict;
} else {
parent.GetVisualDebug().AddSphere('playerToTarge
tDist', 0.250000, nearestPointNoPredict, true, Color(128, 128, 128), 3.000000);

return dist;
}
}
/* NOP */;
}
public timer function CombatComboUpdate(optional timeDelta : Float, opti
onal id : Int32){
var stateName : CName;
super.InteralCombatComboUpdate(timeDelta);
if (thePlayer.IsInCombatAction_Attack() && !thePlayer.IsInCombat
ActionFriendly()){
thePlayer.ProcessWeaponCollision();
}
/* NOP */;
}
protected final function InteralCombatComboUpdate(timeDelta : Float){
var slidePosition : Vector;
var slideRotationVector : Vector;
var slideRotation : Float;
var targetNearestPoint : Vector;
var playerToTargetDist : Float;
var playerRadius : Float;
var heading : Float;
if (comboAttackA_Target){
if ((CActor)comboAttackA_Target){
playerToTargetDist = VecDistance(parent.GetWorld
Position(), (CActor)comboAttackA_Target.GetNearestPointInBothPersonalSpaces(pare
nt.GetWorldPosition()));
} else {
playerToTargetDist = VecDistance(parent.GetWorld
Position(), comboAttackA_Target.GetWorldPosition());
}
if (!(CActor)comboAttackA_Target.GetGameplayVisibility()
){
updatePosition = false;
}
if (parent.GetOrientationTarget() == 3 || parent.GetOrie
ntationTarget() == 4 && playerToTargetDist > 1.500000){
updatePosition = false;
}
if (parent.moveTarget && !parent.IsThreat(parent.moveTar
get, /* NOP */) && comboAttackA_Target){
if (VecDistance(comboAttackA_Target.GetWorldPosi
tion(), parent.GetWorldPosition()) > parent.interactDist || AbsF(AngleDistance(p
arent.GetCombatActionHeading(), VecHeading(comboAttackA_Target.GetWorldPosition(
) - parent.GetWorldPosition()))) > 90.000000){
updatePosition = false;
}
}
if (updatePosition && comboAttackA_Id != -1){
if ((CActor)comboAttackA_Target){
targetNearestPoint = (CActor)comboAttack
A_Target.GetNearestPointInPersonalSpace(parent.GetWorldPosition());
} else {
targetNearestPoint = comboAttackA_Target
.GetWorldPosition();
}
playerRadius = (CMovingPhysicalAgentComponent)pa
rent.GetMovingAgentComponent().GetCapsuleRadius();
slidePosition = playerRadius * VecNormalize(pare

nt.GetWorldPosition() - comboAttackA_Target.GetWorldPosition()) + targetNearestP


oint;
slideRotationVector = comboAttackA_Target.GetWor
ldPosition() - parent.GetWorldPosition();
slideRotation = VecHeading(slideRotationVector);
comboPlayer.UpdateTarget(comboAttackA_Id, slideP
osition, slideRotation, true, true);
if (comboAttackA_Sliding){
MarkSlidePosition(slidePosition);
}
}
if (!updatePosition && comboAttackA_Id != -1){
comboPlayer.UpdateTarget(comboAttackA_Id, parent
.GetWorldPosition() + VecFromHeading(parent.GetCombatActionHeading()), parent.Ge
tCombatActionHeading(), true, true);
}
} else if (comboAttackA_Id != -1 && parent.IsInCombatAction() &&
parent.GetBehaviorVariable('combatActionType', /* NOP */) == 0.000000){
comboPlayer.UpdateTarget(comboAttackA_Id, parent.GetWorl
dPosition() + VecFromHeading(parent.GetCombatActionHeading()), parent.GetCombatA
ctionHeading(), true, true);
}
if (comboPlayer){
comboPlayer.Update(timeDelta);
}
/* NOP */;
}
private final function MarkSlidePosition(position : Vector){
parent.GetVisualDebug().AddSphere('slidePos', 0.500000, position
, true, Color(255, 0, 255), 5.000000);
/* NOP */;
}
public final function ResetComboPlayerAndGoToIdle(){
comboPlayer.Deinit();
parent.GetRootAnimatedComponent().RaiseBehaviorForceEvent('ToIdl
e');
/* NOP */;
}
private function BlockAllCombatTickets(block : Bool){
var combatData : CCombatDataComponent;
var tmpTicketRequest : Int32;
var i : Int32;
combatData = parent.GetCombatDataComponent();
if (ticketNames.Size() <= 0){
InitTicketNames();
}
ReleaseTicketRequests();
if (block){
i = 0;
while (i < ticketNames.Size()){
tmpTicketRequest = combatData.TicketSourceOverri
deRequest(ticketNames[i], 0, 10000000.000000);
ticketRequests.PushBack(tmpTicketRequest);
i += 1;
}
ForceTicketUpdate();
}
/* NOP */;
}
private function ReleaseTicketRequests(){

var i : Int32;
var combatData : CCombatDataComponent;
combatData = parent.GetCombatDataComponent();
i = 0;
while (i < ticketRequests.Size()){
combatData.TicketSourceClearRequest(ticketNames[i], tick
etRequests[i]);
i += 1;
}
ticketRequests.Clear();
/* NOP */;
}
private function ForceTicketUpdate(){
var i : Int32;
var combatData : CCombatDataComponent;
combatData = parent.GetCombatDataComponent();
i = 0;
while (i < ticketRequests.Size()){
combatData.ForceTicketImmediateImportanceUpdate(ticketNa
mes[i]);
i += 1;
}
/* NOP */;
}
private function InitTicketNames(){
ticketNames.PushBack('TICKET_Melee');
ticketNames.PushBack('TICKET_Range');
ticketNames.PushBack('TICKET_Special');
ticketNames.PushBack('TICKET_Charge');
/* NOP */;
}
public function OnBlockAllCombatTickets(block : Bool) : Bool{
BlockAllCombatTickets(block);
/* NOP */;
}
public function OnForceTicketUpdate() : Bool{
ForceTicketUpdate();
/* NOP */;
}
public function OnCombatActionEndComplete() : Bool{
parent.EnableCloseCombatCharacterRadius(false);
parent.OnCombatActionEndComplete();
parent.SetBIsFirstAttackInCombo(false);
/* NOP */;
}
}
class CR4HudModuleDamagedItems extends CR4HudModuleBase{
private var m_fxSetItemDamaged : CScriptedFlashFunction;
private var damagedItems : array<Bool>;
private var inv : CInventoryComponent;
private var isDisplayed : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorDamagedItems";
damagedItems.Grow(6);
super.OnConfigUI();
inv = GetWitcherPlayer().GetInventory();
flashModule = GetModuleFlash();

m_fxSetItemDamaged = flashModule.GetMemberFlashFunction("setItem
Damaged");
SetTickInterval(1);
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('DamagedItemsModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (!CanTick(timeDelta)){
return true;
}
CheckDamagedItems();
/* NOP */;
}
private function CheckDamagedItems(){
var i : Int32;
var item : SItemUniqueId;
var isItemDamaged : Bool;
var damagedItemsCount : Int32;
var durItem : Float;
if (!inv){
inv = GetWitcherPlayer().GetInventory();
}
damagedItemsCount = 0;
i = 1;
while (i <= 6){
if (inv.GetItemEquippedOnSlot(i, item)){
if (inv.HasItemDurability(item)){
durItem = RoundMath(inv.GetItemDurabilit
y(item) / inv.GetItemMaxDurability(item) * 100);
isItemDamaged = durItem <= theGame.param
s.ITEM_DAMAGED_DURABILITY;
} else {
isItemDamaged = false;
}
if (isItemDamaged != damagedItems[i - 1]){
damagedItems[i - 1] = isItemDamaged;
m_fxSetItemDamaged.InvokeSelfTwoArgs(Fla
shArgInt(i), FlashArgBool(isItemDamaged));
}
if (isItemDamaged){
damagedItemsCount += 1;
}
}
i += 1;
}
if (damagedItemsCount == 0){
if (isDisplayed){
ShowElement(false, false);
isDisplayed = false;
}
} else if (!isDisplayed){
ShowElement(true, false);
isDisplayed = true;
}
/* NOP */;
}
public function OnItemUnequippedFromSlot(slot : Int32){

damagedItems[slot - 1] = false;
m_fxSetItemDamaged.InvokeSelfTwoArgs(FlashArgInt(slot), FlashArg
Bool(false));
/* NOP */;
}
}
import abstract class SSceneChoice{
//NULL type for disabled
//NULL type for dialogAction
//NULL type for playGoChunk
//NULL type for description
//NULL type for previouslyChoosen
//NULL type for emphasised
}
import struct CR4LocomotionDirectControllerScript{
public function Activate() : Bool{
return true;
/* NOP */;
}
public function UpdateLocomotion(){
}
public function Deactivate(){
}
}
class CR4HudModuleSubtitles extends CR4HudModuleBase{
private var m_fxAddSubtitleSFF : CScriptedFlashFunction;
private var m_fxRemoveSubtitleSFF : CScriptedFlashFunction;
private var m_fxUpdateWidthSFF : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var configValue : String;
var inGameConfigWrapper : CInGameConfigWrapper;
m_anchorName = "ScaleOnly";
flashModule = GetModuleFlash();
m_fxAddSubtitleSFF = flashModule.GetMemberFlashFunction("addSubt
itle");
m_fxRemoveSubtitleSFF = flashModule.GetMemberFlashFunction("remo
veSubtitle");
m_fxUpdateWidthSFF = flashModule.GetMemberFlashFunction("updateW
idth");
super.OnConfigUI();
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
configValue = inGameConfigWrapper.GetVarValue('Localization', 'S
ubtitles');
SetEnabled(configValue == "true");
/* NOP */;
}
public function OnSubtitleAdded(id : Int32, speakerNameDisplayText : Str
ing, htmlString : String) : Bool{
if (theGame.isDialogDisplayDisabled){
speakerNameDisplayText = "";
htmlString = "";
}
m_fxAddSubtitleSFF.InvokeSelfThreeArgs(FlashArgInt(id), FlashArg
String(speakerNameDisplayText), FlashArgString(htmlString));
/* NOP */;
}

public function OnSubtitleRemoved(id : Int32) : Bool{


m_fxRemoveSubtitleSFF.InvokeSelfOneArg(FlashArgInt(id));
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
m_fxUpdateWidthSFF.InvokeSelfOneArg(FlashArgNumber(theGame.GetUI
HorizontalFrameScale()));
return super.UpdateScale(scale, flashModule);
/* NOP */;
}
}
class CR4HudModuleOneliners extends CR4HudModuleBase{
private var m_hud : CR4ScriptedHud;
private var m_fxCreateOnelinerSFF : CScriptedFlashFunction;
private var m_fxRemoveOnelinerSFF : CScriptedFlashFunction;
private var m_flashModule : CScriptedFlashSprite;
private var m_oneliners : array<OnelinerDefinition>;
private const var VISIBILITY_DISTANCE_SQUARED : Float;
public function OnConfigUI() : Bool{
m_anchorName = "ScaleOnly";
m_flashModule = GetModuleFlash();
m_fxCreateOnelinerSFF = m_flashModule.GetMemberFlashFunction("Cr
eateOneliner");
m_fxRemoveOnelinerSFF = m_flashModule.GetMemberFlashFunction("Re
moveOneliner");
super.OnConfigUI();
m_hud = (CR4ScriptedHud)theGame.GetHud();
if (m_hud){
m_hud.UpdateHudConfig('OnelinersModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var target : CActor;
var screenPos : Vector;
var i : Int32;
var mcOneliner : CScriptedFlashSprite;
i = 0;
while (i < m_oneliners.Size()){
mcOneliner = m_flashModule.GetChildFlashSprite("mcOnelin
er" + m_oneliners[i].m_ID);
if (mcOneliner){
target = m_oneliners[i].m_Target;
if (target && IsTargetCloseEnough(target)){
if (GetBaseScreenPosition(screenPos, tar
get, NULL, 0, true, /* NOP */)){
screenPos.Y -= 90;
mcOneliner.SetPosition(screenPos
.X, screenPos.Y);
mcOneliner.SetVisible(true);
} else {
mcOneliner.SetVisible(false);
}
} else {
mcOneliner.SetVisible(false);
}
}
i += 1;

}
/* NOP */;
}
public function OnCreateOneliner(target : CEntity, value : String, ID :
Int32) : Bool{
var oneliner : OnelinerDefinition;
/* NOP */;
if (theGame.isDialogDisplayDisabled){
value = "";
}
oneliner.m_Target = (CActor)target;
oneliner.m_Text = value;
oneliner.m_ID = ID;
m_oneliners.PushBack(oneliner);
m_fxCreateOnelinerSFF.InvokeSelfTwoArgs(FlashArgInt(ID), FlashAr
gString(value));
/* NOP */;
}
public function OnRemoveOneliner(ID : Int32) : Bool{
var i : Int32;
/* NOP */;
i = 0;
while (i < m_oneliners.Size()){
if (m_oneliners[i].m_ID == ID){
m_oneliners.Erase(i);
m_fxRemoveOnelinerSFF.InvokeSelfOneArg(FlashArgI
nt(ID));
return true;
}
i += 1;
}
/* NOP */;
}
private function IsTargetCloseEnough(target : CActor) : Bool{
return VecDistanceSquared(target.GetWorldPosition(), thePlayer.G
etWorldPosition()) < VISIBILITY_DISTANCE_SQUARED;
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
return false;
/* NOP */;
}
}
import struct CJournalCharacter{
import public final function
import public final function
import public final function
ance;
import public final function
}

GetNameStringId() : Int32;
GetImagePath() : String;
GetCharacterImportance() : ECharacterImport
GetEntityTemplateFilename() : String;

import abstract class SEntityMapPinInfo{


//NULL type for entityName
//NULL type for entityType
//NULL type for fastTravelTeleportWayPointPosition
//NULL type for fastTravelTeleportWayPointRotation
//NULL type for entityPosition
}

import struct CJournalCharacterDescription{


import public final function GetDescriptionStringId() : Int32;
}
import abstract class SQuestMapPinInfo{
}
import struct CJournalGlossary{
import public final function GetTitleStringId() : Int32;
import public final function GetImagePath() : String;
}
import struct CJournalGlossaryDescription{
import public final function GetDescriptionStringId() : Int32;
}
import abstract class SAreaMapPinInfo{
//NULL type for areaType
//NULL type for position
//NULL type for worldPath
//NULL type for requiredChunk
//NULL type for localisationName
//NULL type for localisationDescription
}
import struct CJournalStoryBookPage{
import public final function GetTitleStringId() : Int32;
}
state CR4PlayerStateExtendedMovable in CR4Player extends CPlayerStateMovable{
protected var parentMAC : CMovingPhysicalAgentComponent;
protected var currentStateName : CName;
public var cameraChanneledSignEnabled : Bool;
protected var interiorCameraDesiredPositionMult : Float;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
currentStateName = parent.GetCurrentStateName();
parentMAC = (CMovingPhysicalAgentComponent)parent.GetMovingAgent
Component();
parent.AddAnimEventCallback('CombatStanceLeft', 'OnAnimEvent_Com
batStanceLeft');
parent.AddAnimEventCallback('CombatStanceRight', 'OnAnimEvent_Co
mbatStanceRight');
if (prevStateName == 'PlayerDialogScene'){
parent.OnRangedForceHolster(true, true, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.RemoveAnimEventCallback('CombatStanceLeft');
parent.RemoveAnimEventCallback('CombatStanceRight');
parent.ResumeEffects(2, 'Sprint');
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnAnimEvent_CombatStanceLeft(animEventName : CName, anim
EventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
parent.SetCombatIdleStance(0.000000);
/* NOP */;

}
public function OnAnimEvent_CombatStanceRight(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
parent.SetCombatIdleStance(1.000000);
/* NOP */;
}
public function OnSpawnHorse() : Bool{
virtual_parent.ReapplyCriticalBuff();
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
var depth : Float;
var fallDist : Float;
var waterLevel : Float;
virtual_parent.OnPlayerTickTimer(deltaTime);
if (parent.IsInWaterTrigger() && thePlayer.IsAlive() && currentS
tateName != 'Swimming' && currentStateName != 'AimThrow'){
if (parent.GetFallDist(fallDist) || parent.IsRagdolled()
){
waterLevel = theGame.GetWorld().GetWaterDepth(pa
rent.GetWorldPosition(), true);
if (waterLevel > -parent.ENTER_SWIMMING_WATER_LE
VEL && waterLevel != 10000){
depth = parentMAC.GetSubmergeDepth();
if (depth < -0.100000){
parent.GotoState('Swimming', /*
NOP */, /* NOP */);
}
}
} else {
depth = parentMAC.GetSubmergeDepth();
if (depth < parent.ENTER_SWIMMING_WATER_LEVEL){
if (thePlayer.GetCurrentStateName() == '
AimThrow'){
parent.OnRangedForceHolster(true
, /* NOP */, /* NOP */);
}
parent.GotoState('Swimming', /* NOP */,
/* NOP */);
}
}
}
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
if (virtual_parent.OnGameCameraTick(moveData, dt)){
return true;
}
cameraChanneledSignEnabled = parent.UpdateCameraChanneledSign(mo
veData, dt);
if (cameraChanneledSignEnabled){
return true;
}
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
if (parent.DisableManualCameraControlStackHasSource('Finisher'))
{

moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(moveDat
a.pivotRotationValue.Pitch, /* NOP */);
}
parent.OnGameCameraPostTick(moveData, dt);
/* NOP */;
}
protected function SetInteriorCameraDesiredPositionMult(_interiorCameraD
esiredPositionMult : Float){
interiorCameraDesiredPositionMult = _interiorCameraDesiredPositi
onMult;
/* NOP */;
}
protected function UpdateCameraInterior(moveData : SCameraMovementData,
timeDelta : Float){
var destYaw : Float;
var targetPos : Vector;
var playerToTargetVector : Vector;
var playerToTargetAngles : EulerAngles;
var playerToTargetPitch : Float;
var _tempVelocity : Float;
theGame.GetGameCamera().ChangePivotRotationController('CombatInt
erior');
theGame.GetGameCamera().ChangePivotDistanceController('Default')
;
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
DampFloatSpring(interiorCameraDesiredPositionMult, _tempVelocity
, 10.000000, 0.700000, timeDelta);
moveData.pivotPositionController.SetDesiredPosition(parent.GetWo
rldPosition(), interiorCameraDesiredPositionMult);
moveData.pivotDistanceController.SetDesiredDistance(3.500000, /*
NOP */);
if (parent.IsCameraLockedToTarget()){
if (parent.GetDisplayTarget()){
playerToTargetVector = parent.GetDisplayTarget()
.GetWorldPosition() - parent.GetWorldPosition();
moveData.pivotRotationController.SetDesiredHeadi
ng(VecHeading(playerToTargetVector), 0.500000);
} else {
moveData.pivotRotationController.SetDesiredHeadi
ng(moveData.pivotRotationValue.Yaw, 0.500000);
}
if (AbsF(playerToTargetVector.Z) <= 1.000000){
if (parent.IsGuarded()){
moveData.pivotRotationController.SetDesi
redPitch(-25.000000, /* NOP */);
} else {
moveData.pivotRotationController.SetDesi
redPitch(-15.000000, /* NOP */);
}
} else {
playerToTargetAngles = VecToRotation(playerToTar

getVector);
playerToTargetPitch = playerToTargetAngles.Pitch
+ 10;
moveData.pivotRotationController.SetDesiredPitch
(playerToTargetPitch * -1, 0.500000);
}
} else if (parent.IsGuarded()){
moveData.pivotRotationController.SetDesiredPitch(-25.000
000, /* NOP */);
} else {
moveData.pivotRotationController.SetDesiredPitch(-15.000
000, /* NOP */);
}
moveData.pivotPositionController.offsetZ = 1.550000;
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(0.000000, 0.000000, 0.000000), 1.000000, timeDelta)
;
/* NOP */;
}
}
import struct CJournalPlace{
import public final function GetNameStringId() : Int32;
import public final function GetImage() : String;
}
import abstract class CR4LootItemDefinition{
}
import abstract class CR4LootContainerParam{
}
import struct CJournalPlaceDescription{
import public final function GetDescriptionStringId() : Int32;
}
class CR4HudModuleJournalUpdate extends CR4HudModuleBase{
private var _bDuringDisplay : Bool;
private var m_fxShowJournalUpdateSFF : CScriptedFlashFunction;
private var m_fxSetJournalUpdateStatusSFF : CScriptedFlashFunction;
private var m_fxSetJournalUpdateStatusTextSFF : CScriptedFlashFunction;
private var m_fxClearJournalUpdateSFF : CScriptedFlashFunction;
private var m_fxSetIconSFF : CScriptedFlashFunction;
private var questsUpdates : array<CJournalQuest>;
private var journalUpdates : array<SJournalUpdate>;
private var manager : CWitcherJournalManager;
private var m_guiManager : CR4GuiManager;
private var m_flashValueStorage : CScriptedFlashValueStorage;
private var m_defaultInputBindings : array<SKeyBinding>;
private var bWasRemoved : Bool;
private var defaultDisplayTime : Float;
private var defaultTrackableDisplayTime : Float;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorJournalUpdate";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_flashValueStorage = GetModuleFlashValueStorage();
m_fxShowJournalUpdateSFF = flashModule.GetMemberFlashFunction("S

howJournalUpdate");
m_fxSetJournalUpdateStatusSFF = flashModule.GetMemberFlashFuncti
on("SetJournalUpdateStatus");
m_fxClearJournalUpdateSFF = flashModule.GetMemberFlashFunction("
ClearJournalUpdate");
m_fxSetIconSFF = flashModule.GetMemberFlashFunction("SetIcon");
manager = theGame.GetJournalManager();
m_guiManager = theGame.GetGuiManager();
hud = (CR4ScriptedHud)theGame.GetHud();
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (!_bDuringDisplay){
if (CheckPending()){
DisplayPending();
}
} else if (journalUpdates.Size() > 0){
if (!CheckSceneAndCutsceneDisplay(journalUpdates[0].stat
us, journalUpdates[0].isQuestUpdate)){
m_fxClearJournalUpdateSFF.InvokeSelf();
OnRemoveUpdate();
OnShowUpdateEnd();
}
}
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
}
public function CheckPending() : Bool{
if (GetPendingSize() > 0 && theInput.GetContext() != 'RadialMenu
' && theInput.GetContext() != 'Death'){
return true;
}
return false;
/* NOP */;
}
public function DisplayPending(){
var title : String;
var offset : Int32;
var isTrackableQuest : Bool;
_bDuringDisplay = true;
if ((CJournalQuest)journalUpdates[0].journalEntry){
if (!CheckSceneAndCutsceneDisplay(journalUpdates[0].stat
us, journalUpdates[0].isQuestUpdate)){
if (journalUpdates.Size() > 0){
journalUpdates.Erase(0);
}
_bDuringDisplay = false;
return;
}
}
title = journalUpdates[0].title;
offset = 1;
if (journalUpdates[0].iconPath != ""){
offset += 4;
}
m_fxSetJournalUpdateStatusSFF.InvokeSelfOneArg(FlashArgInt(journ
alUpdates[0].status + offset));
isTrackableQuest = IsTrackableQuest();

if (journalUpdates[0].displayTime == 0){
if (isTrackableQuest){
journalUpdates[0].displayTime = defaultTrackable
DisplayTime;
} else {
journalUpdates[0].displayTime = defaultDisplayTi
me;
}
}
m_fxShowJournalUpdateSFF.InvokeSelfThreeArgs(FlashArgString(jour
nalUpdates[0].text), FlashArgString(title), FlashArgNumber(journalUpdates[0].dis
playTime));
m_fxSetIconSFF.InvokeSelfOneArg(FlashArgString(journalUpdates[0]
.iconPath));
ShowElement(true, /* NOP */);
if (journalUpdates[0].soundEvent == ""){
journalUpdates[0].soundEvent = "gui_ingame_quest_active"
;
}
if (journalUpdates[0].soundEvent != "" && bWasRemoved){
if (!theGame.IsBlackscreen() || theGame.IsFading()){
OnPlaySoundEvent(journalUpdates[0].soundEvent);
}
}
m_defaultInputBindings.Clear();
if (theInput.GetContext() != 'Scene' && journalUpdates[0].journa
lEntry || IsNameValid(journalUpdates[0].entryTag) && !thePlayer.IsCiri()){
if (isTrackableQuest){
RegisterTrackQuestBindings();
}
SetButtons((CJournalQuest)journalUpdates[0].journalEntry
);
}
UpdateInputFeedback();
bWasRemoved = false;
/* NOP */;
}
public function RegisterTrackQuestBindings(){
var outKeys : array<EInputKey>;
var outKeysPC : array<EInputKey>;
outKeys.Clear();
outKeysPC.Clear();
theInput.GetPadKeysForAction('TrackQuest', outKeys);
theInput.GetPCKeysForAction('TrackQuest', outKeysPC);
theInput.RegisterListener(this, 'OnTrackQuest', 'TrackQuest');
if (outKeys.Size() + outKeysPC.Size() > 0){
AddInputBinding("panel_button_journal_track", "gamepad_R
_Hold", outKeysPC[0]);
}
/* NOP */;
}
public function IsTrackableQuest() : Bool{
var curUpdatedQuest : CJournalQuest;
var curTrackedQuest : CJournalQuest;
curUpdatedQuest = (CJournalQuest)manager.GetEntryByGuid(journalU
pdates[0].journalEntry.guid);
curTrackedQuest = theGame.GetJournalManager().GetTrackedQuest();
if (curUpdatedQuest && curUpdatedQuest != curTrackedQuest && jou
rnalUpdates[0].status < 2 && manager.GetEntryStatus(curUpdatedQuest) < 2){
return true;

}
return false;
/* NOP */;
}
public function GetQuestStatusTitle(status : EJournalStatus, questType :
eQuestType) : String{
var str : String;
if (questType == 3){
switch(status){
case 1:
str = "panel_journal_monstercontract_update_acti
ve";
break;
case 2:
str = "panel_journal_monstercontract_update_succ
ess";
break;
case 3:
str = "panel_journal_monstercontract_update_fail
ed";
break;
case 0:
str = "panel_journal_monstercontract_update_new"
;
break;
}
} else {
switch(status){
case 1:
str = "panel_journal_quest_update_active";
break;
case 2:
str = "panel_journal_quest_update_success";
break;
case 3:
str = "panel_journal_quest_update_failed";
break;
case 0:
str = "panel_journal_quest_update_new";
break;
}
}
return GetLocStringByKeyExt(str);
/* NOP */;
}
public function GetPendingSize() : Int32{
return journalUpdates.Size();
/* NOP */;
}
public function AddQuestUpdate(journalQuest : CJournalQuest, isQuestUpda
te : Bool){
var newJournalUpdate : SJournalUpdate;
var status : EJournalStatus;
newJournalUpdate.journalEntry = journalQuest;
newJournalUpdate.text = GetLocStringById(journalQuest.GetTitleSt
ringId());
newJournalUpdate.isQuestUpdate = isQuestUpdate;
status = manager.GetEntryStatus(journalQuest);
if (thePlayer.IsNewQuest(newJournalUpdate.journalEntry.guid) &&
status == 1){

newJournalUpdate.status = 0;
newJournalUpdate.soundEvent = "gui_ingame_quest_active";
} else {
newJournalUpdate.status = status;
switch(status){
case 1:
newJournalUpdate.soundEvent = "gui_ingame_new_jo
urnal";
break;
case 2:
newJournalUpdate.soundEvent = "gui_ingame_quest_
success";
break;
case 3:
newJournalUpdate.soundEvent = "gui_ingame_quest_
fail";
break;
}
}
newJournalUpdate.title = GetQuestStatusTitle(newJournalUpdate.st
atus, journalQuest.GetType());
if (!HasQuestPendingUpdate(journalQuest, newJournalUpdate.status
)){
journalUpdates.PushBack(newJournalUpdate);
}
/* NOP */;
}
public function CheckSceneAndCutsceneDisplay(status : EJournalStatus, is
QuestUpdate : Bool) : Bool{
if (theInput.GetContext() == 'Scene' && journalUpdates[0].iconPa
th == ""){
if (isQuestUpdate){
if (status == 2 || status == 3){
return true;
} else {
return false;
}
} else {
return false;
}
}
return true;
/* NOP */;
}
public function AddCraftingSchematicUpdate(schematicName : CName){
var newJournalUpdate : SJournalUpdate;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_definitionsManager = theGame.GetDefinitionsManager();
newJournalUpdate.text = GetLocStringByKeyExt(m_definitionsManage
r.GetItemLocalisationKeyName(schematicName));
newJournalUpdate.status = 0;
newJournalUpdate.iconPath = m_definitionsManager.GetItemIconPath
(schematicName);
newJournalUpdate.panelName = 'CraftingMenu';
newJournalUpdate.entryTag = schematicName;
newJournalUpdate.soundEvent = "gui_ingame_new_journal";
newJournalUpdate.title = GetLocStringByKeyExt("panel_hud_craftin
gschematic_update_new_entry");
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;

}
public function AddAlchemySchematicUpdate(schematicName : CName){
var newJournalUpdate : SJournalUpdate;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_definitionsManager = theGame.GetDefinitionsManager();
newJournalUpdate.text = GetLocStringByKeyExt(m_definitionsManage
r.GetItemLocalisationKeyName(schematicName));
newJournalUpdate.status = 0;
newJournalUpdate.iconPath = m_definitionsManager.GetItemIconPath
(schematicName);
newJournalUpdate.panelName = 'AlchemyMenu';
newJournalUpdate.entryTag = schematicName;
newJournalUpdate.soundEvent = "gui_ingame_new_journal";
newJournalUpdate.title = GetLocStringByKeyExt("panel_hud_alchemy
schematic_update_new_entry");
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function AddJournalUpdate(journalEntry : CJournalBase, isDescript
ion : Bool){
var newJournalUpdate : SJournalUpdate;
if (!HasJournalPendingUpdate(journalEntry)){
newJournalUpdate.text = GetEntryText(journalEntry);
newJournalUpdate.journalEntry = journalEntry;
newJournalUpdate.status = 1;
newJournalUpdate.soundEvent = "gui_ingame_new_journal";
newJournalUpdate.title = GetEntryTitle(journalEntry, isD
escription);
journalUpdates.PushBack(newJournalUpdate);
}
/* NOP */;
}
public function GetEntryText(journalEntry : CJournalBase) : String{
var str : String;
var creatureEntry : CJournalCreature;
var glossaryEntry : CJournalGlossary;
var characterEntry : CJournalCharacter;
creatureEntry = (CJournalCreature)journalEntry;
glossaryEntry = (CJournalGlossary)journalEntry;
characterEntry = (CJournalCharacter)journalEntry;
if (creatureEntry){
str = GetLocStringById(creatureEntry.GetNameStringId());
} else if (glossaryEntry){
str = GetLocStringById(glossaryEntry.GetTitleStringId())
;
} else if (characterEntry){
str = GetLocStringById(characterEntry.GetNameStringId())
;
}
return str;
/* NOP */;
}
public function GetEntryTitle(journalEntry : CJournalBase, isDescription
: Bool) : String{
var str : String;
var creatureEntry : CJournalCreature;
var glossaryEntry : CJournalGlossary;
var characterEntry : CJournalCharacter;
creatureEntry = (CJournalCreature)journalEntry;
glossaryEntry = (CJournalGlossary)journalEntry;

characterEntry = (CJournalCharacter)journalEntry;
if (creatureEntry){
str = "panel_hud_journal_entry_bestiary";
} else if (glossaryEntry){
str = "panel_hud_journal_entry_glossary";
} else if (characterEntry){
str = "panel_hud_journal_entry_character";
}
if (isDescription){
str += "_update";
} else {
str += "_new";
}
return GetLocStringByKeyExt(str);
/* NOP */;
}
public function AddLevelUpUpdate(level : Int32){
var newJournalUpdate : SJournalUpdate;
var arrInt : array<Int32>;
newJournalUpdate.soundEvent = "gui_ingame_level_up";
newJournalUpdate.text = GetLocStringByKeyExt("panel_character_av
ailablepoints") + ": " + GetWitcherPlayer().levelManager.GetPointsFree(0);
newJournalUpdate.status = 1;
newJournalUpdate.iconPath = "icons\skills\level_gained.png";
newJournalUpdate.displayTime = 7000;
if (level < 51){
arrInt.PushBack(level);
newJournalUpdate.title = GetLocStringByKeyExtWithParams(
"panel_hud_level_update_level_reached", arrInt, /* NOP */, /* NOP */, /* NOP */)
;
} else {
newJournalUpdate.title = GetLocStringByKeyExt("panel_hud
_level_update_level_up");
}
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function AddExperienceUpdate(exp : Int32){
var newJournalUpdate : SJournalUpdate;
var arrInt : array<Int32>;
if (exp <= 0){
return;
}
newJournalUpdate.soundEvent = "";
arrInt.PushBack(exp);
newJournalUpdate.text = GetLocStringByKeyExtWithParams("hud_comb
at_log_gained_experience", arrInt, /* NOP */, /* NOP */, /* NOP */);
newJournalUpdate.status = 1 + 1;
newJournalUpdate.iconPath = "icons\skills\exp_gained.png";
newJournalUpdate.title = GetLocStringByKey("panel_hud_item_updat
e_recived_experience");
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function AddMapPinUpdate(mapPinName : CName){
var newJournalUpdate : SJournalUpdate;
newJournalUpdate.text = GetLocStringByKeyExt(StrLower("map_locat
ion_" + mapPinName));
newJournalUpdate.status = 1;
newJournalUpdate.soundEvent = "gui_ingame_new_mappin";

newJournalUpdate.title = GetLocStringByKeyExt("panel_hud_map_upd
ate_new_entry");
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function AddItemRecivedDuringSceneUpdate(itemName : CName, quanti
ty : Int32){
var newJournalUpdate : SJournalUpdate;
var inv : CInventoryComponent;
inv = GetWitcherPlayer().GetInventory();
newJournalUpdate.text = GetLocStringByKeyExt(inv.GetItemLocalize
dNameByName(itemName));
newJournalUpdate.status = 0;
newJournalUpdate.iconPath = inv.GetItemIconPathByName(itemName);
if (itemName == 'experience'){
newJournalUpdate.title = GetLocStringByKeyExt("panel_hud
_item_update_recived_experience");
} else {
newJournalUpdate.title = GetLocStringByKeyExt("panel_hud
_item_update_recived");
newJournalUpdate.soundEvent = "gui_ingame_new_reward_ite
m";
}
if (quantity > 1){
newJournalUpdate.text += " x " + quantity;
}
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function HasQuestPendingUpdate(journalQuest : CJournalQuest, stat
us : EJournalStatus) : Bool{
var i : Int32;
if (status == 1){
i = 0;
while (i < journalUpdates.Size()){
if (journalUpdates[i].status != 3 && journalUpda
tes[i].status != 2){
if (journalUpdates[i].journalEntry.guid
== journalQuest.guid){
return true;
}
}
i += 1;
}
}
return false;
/* NOP */;
}
public function HasJournalPendingUpdate(journalBase : CJournalBase) : Bo
ol{
var i : Int32;
i = 0;
while (i < journalUpdates.Size()){
if (journalUpdates[i].journalEntry.guid == journalBase.g
uid){
return true;
}
i += 1;
}
return false;

/* NOP */;
}
public function ForceAddJournalUpdateInfo(locKeyText : String, locKeyTit
le : String){
var newJournalUpdate : SJournalUpdate;
var status : EJournalStatus;
if (locKeyText == "" || locKeyText == " "){
newJournalUpdate.text = GetTrackedQuestName();
} else {
newJournalUpdate.text = GetLocStringByKeyExt(locKeyText)
;
}
newJournalUpdate.status = 1;
if (locKeyTitle == "" || locKeyTitle == " "){
newJournalUpdate.title = GetQuestStatusTitle(newJournalU
pdate.status, 0);
} else {
newJournalUpdate.title = GetLocStringByKeyExt(locKeyTitl
e);
}
journalUpdates.PushBack(newJournalUpdate);
/* NOP */;
}
public function GetTrackedQuestName() : String{
var trackedQuests : CJournalQuest;
trackedQuests = manager.GetTrackedQuest();
return GetLocStringById(trackedQuests.GetTitleStringId());
/* NOP */;
}
public function OnRemoveUpdate() : Bool{
if (journalUpdates.Size() > 0){
journalUpdates.Erase(0);
}
bWasRemoved = true;
/* NOP */;
}
public function OnShowUpdateEnd() : Bool{
theInput.UnregisterListener(this, 'OnShowEntryInPanel');
thePlayer.UnblockAction(35, 'JournalUpdate');
if (journalUpdates.Size() > 0 && (CJournalQuest)journalUpdates[0
].journalEntry){
theInput.UnregisterListener(this, 'OnTrackQuest');
}
_bDuringDisplay = false;
/* NOP */;
/* NOP */;
}
public function OnShowEntryInPanel(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */) && !thePlayer.IsCiri()){
/* NOP */;
OpenEntryInPanel();
}
/* NOP */;
}
public function OnTrackQuest(action : SInputAction) : Bool{
var l_quest : CJournalBase;
var l_questStatus : EJournalStatus;
var walkToggleAction : SInputAction;
l_quest = journalUpdates[0].journalEntry;
walkToggleAction = theInput.GetAction('WalkToggle');

if (IsReleased(action, /* NOP */) && walkToggleAction.lastFrameV


alue < 0.700000 && walkToggleAction.value < 0.700000 && l_quest && !thePlayer.Is
Ciri()){
l_questStatus = manager.GetEntryStatus(l_quest);
if (l_questStatus == 1){
manager.SetTrackedQuest(l_quest);
}
}
/* NOP */;
}
public function OpenEntryInPanel(){
if ((CJournalQuest)journalUpdates[0].journalEntry){
OpenQuestPanel();
} else if ((CJournalCreature)journalUpdates[0].journalEntry){
OpenGlossaryPanel('GlossaryBestiaryMenu');
} else if ((CJournalCharacter)journalUpdates[0].journalEntry){
OpenGlossaryPanel('GlossaryEncyclopediaMenu');
} else if ((CJournalGlossary)journalUpdates[0].journalEntry){
OpenGlossaryPanel('GlossaryEncyclopediaMenu');
} else if (journalUpdates[0].entryTag){
OpenSchematicPanel();
}
/* NOP */;
}
public function OpenGlossaryPanel(panelName : CName){
var uiSavedData : SUISavedData;
var journalEntry : CJournalBase;
if (thePlayer.IsActionAllowed(36)){
journalEntry = journalUpdates[0].journalEntry;
uiSavedData = m_guiManager.GetUISavedData(panelName);
uiSavedData.selectedTag = journalEntry.GetUniqueScriptTa
g();
uiSavedData.panelName = panelName;
m_guiManager.UpdateUISavedData(panelName, uiSavedData.op
enedCategories, uiSavedData.selectedTag, uiSavedData.selectedModule, /* NOP */,
/* NOP */);
uiSavedData = m_guiManager.GetUISavedData('GlossaryParen
t');
uiSavedData.selectedTag = panelName;
uiSavedData.panelName = 'GlossaryParent';
m_guiManager.UpdateUISavedData('GlossaryParent', uiSaved
Data.openedCategories, uiSavedData.selectedTag, uiSavedData.selectedModule, /* N
OP */, /* NOP */);
theGame.RequestMenuWithBackground(panelName, 'CommonMenu
', /* NOP */);
}
/* NOP */;
}
public function OpenSchematicPanel(){
var uiSavedData : SUISavedData;
if (thePlayer.IsActionAllowed(36)){
uiSavedData = m_guiManager.GetUISavedData(journalUpdates
[0].panelName);
uiSavedData.selectedTag = journalUpdates[0].entryTag;
uiSavedData.panelName = journalUpdates[0].panelName;
m_guiManager.UpdateUISavedData(journalUpdates[0].panelNa
me, uiSavedData.openedCategories, uiSavedData.selectedTag, uiSavedData.selectedM
odule, /* NOP */, /* NOP */);
uiSavedData = m_guiManager.GetUISavedData('GlossaryParen
t');

uiSavedData.selectedTag = journalUpdates[0].panelName;
uiSavedData.panelName = 'GlossaryParent';
m_guiManager.UpdateUISavedData('GlossaryParent', uiSaved
Data.openedCategories, uiSavedData.selectedTag, uiSavedData.selectedModule, /* N
OP */, /* NOP */);
theGame.RequestMenuWithBackground(journalUpdates[0].pane
lName, 'CommonMenu', /* NOP */);
}
/* NOP */;
}
public function OpenQuestPanel(){
var uiSavedData : SUISavedData;
var questEntry : CJournalQuest;
var panelName : CName;
if (thePlayer.IsActionAllowed(17)){
questEntry = (CJournalQuest)journalUpdates[0].journalEnt
ry;
panelName = 'JournalQuestMenu';
uiSavedData = m_guiManager.GetUISavedData(panelName);
uiSavedData.selectedTag = questEntry.GetUniqueScriptTag(
);
uiSavedData.panelName = panelName;
m_guiManager.UpdateUISavedData(panelName, uiSavedData.op
enedCategories, questEntry.GetUniqueScriptTag(), uiSavedData.selectedModule, /*
NOP */, /* NOP */);
uiSavedData = m_guiManager.GetUISavedData('JournalParent
');
uiSavedData.selectedTag = panelName;
uiSavedData.panelName = 'JournalParent';
m_guiManager.UpdateUISavedData('JournalParent', uiSavedD
ata.openedCategories, uiSavedData.selectedTag, uiSavedData.selectedModule, /* NO
P */, /* NOP */);
theGame.RequestMenuWithBackground(panelName, 'CommonMenu
', /* NOP */);
}
/* NOP */;
}
protected function GatherBindersArray(resultArray : CScriptedFlashArray,
bindersList : array<SKeyBinding>, isContextBinding : Bool){
var tempFlashObject : CScriptedFlashObject;
var bindingGFxData : CScriptedFlashObject;
var curBinding : SKeyBinding;
var bindingsCount : Int32;
var i : Int32;
bindingsCount = bindersList.Size();
i = 0;
while (i < bindingsCount){
curBinding = bindersList[i];
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
bindingGFxData = tempFlashObject.CreateFlashObject("red.
game.witcher3.data.KeyBindingData");
bindingGFxData.SetMemberFlashString("gamepad_navEquivale
nt", curBinding.Gamepad_NavCode);
bindingGFxData.SetMemberFlashInt("keyboard_keyCode", cur
Binding.Keyboard_KeyCode);
bindingGFxData.SetMemberFlashString("label", GetLocStrin
gByKeyExt(curBinding.LocalizationKey));
bindingGFxData.SetMemberFlashString("isContextBinding",
isContextBinding);

resultArray.PushBackFlashObject(bindingGFxData);
i += 1;
}
/* NOP */;
}
protected function UpdateInputFeedback(){
var gfxDataList : CScriptedFlashArray;
gfxDataList = m_flashValueStorage.CreateTempFlashArray();
GatherBindersArray(gfxDataList, m_defaultInputBindings, /* NOP *
/);
m_flashValueStorage.SetFlashArray("hud.journalupdate.buttons.set
up", gfxDataList);
/* NOP */;
}
public function SetButtons(isJournalEntry : Bool){
}
protected function AddInputBinding(label : String, padNavCode : String,
keyboardKeyCode : Int32){
var bindingDef : SKeyBinding;
bindingDef.Gamepad_NavCode = padNavCode;
bindingDef.Keyboard_KeyCode = keyboardKeyCode;
bindingDef.LocalizationKey = label;
m_defaultInputBindings.PushBack(bindingDef);
/* NOP */;
}
}
class CR4HudModuleConsole extends CR4HudModuleBase{
private var m_fxHudConsoleMsg : CScriptedFlashFunction;
private var m_fxTestHudConsole : CScriptedFlashFunction;
private var m_fxCleanupHudConsole : CScriptedFlashFunction;
private var _iDuringDisplay : Int32;
private const var MAX_CONSOLE_MESSEGES_DISPLAYED : Int32;
private var NEW_ITEM_DELAY : Float;
private var displayTime : Float;
private var pendingMessages : array<String>;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "mcAnchorConsole";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxHudConsoleMsg = flashModule.GetMemberFlashFunction("showMess
age");
m_fxTestHudConsole = flashModule.GetMemberFlashFunction("debugMe
ssage");
m_fxCleanupHudConsole = flashModule.GetMemberFlashFunction("clea
nup");
displayTime = NEW_ITEM_DELAY;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('ConsoleModule', true);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (_iDuringDisplay < MAX_CONSOLE_MESSEGES_DISPLAYED){
displayTime += timeDelta;
if (CheckPendingMessages() && displayTime > NEW_ITEM_DEL
AY){

DisplayConsoleMsg(pendingMessages[0]);
_iDuringDisplay += 1;
displayTime = 0;
/* NOP */;
pendingMessages.Erase(0);
}
}
/* NOP */;
}
public function CheckPendingMessages() : Bool{
if (pendingMessages.Size() > 0){
return true;
}
return false;
/* NOP */;
}
public function OnMessageHidden(value : String) : Bool{
_iDuringDisplay = Max(0, _iDuringDisplay - 1);
/* NOP */;
displayTime = 0;
if (_iDuringDisplay == 0){
ConsoleCleanup();
}
/* NOP */;
}
public function ConsoleMsg(msgText : String){
pendingMessages.PushBack(msgText);
/* NOP */;
}
public function DisplayConsoleMsg(msgText : String){
m_fxHudConsoleMsg.InvokeSelfOneArg(FlashArgString(msgText));
ShowElement(true, true);
/* NOP */;
}
public function ConsoleTest(){
m_fxTestHudConsole.InvokeSelf();
/* NOP */;
}
public function ConsoleCleanup(){
m_fxCleanupHudConsole.InvokeSelf();
ShowElement(false, false);
/* NOP */;
}
protected function UpdatePosition(anchorX : Float, anchorY : Float){
var l_flashModule : CScriptedFlashSprite;
var tempX : Float;
var tempY : Float;
l_flashModule = GetModuleFlash();
tempX = anchorX + 300.000000 * 1.000000 - theGame.GetUIHorizonta
lFrameScale();
tempY = anchorY;
l_flashModule.SetX(tempX);
l_flashModule.SetY(tempY);
/* NOP */;
}
}
import abstract class CFistfightOpponent{
}

import abstract class CForceFieldEntity{


}
state W3PlayerWitcherStateCombatSword in W3PlayerWitcher extends CR4PlayerStateC
ombat{
protected var bIsInPirouette : Bool;
protected var swordId : SItemUniqueId;
public function OnEnterState(prevStateName : CName) : Bool{
var npcs : array<CActor>;
var i : Int32;
theInput.SetContext(parent.GetCombatInputContext());
super.OnEnterState(prevStateName);
parent.AddAnimEventCallback('FinishSpecialHeavyAttack', 'OnAnimE
vent_FinishSpecialHeavyAttack');
InitSwordItem();
CombatSwordInit();
npcs = GetActorsInRange(thePlayer, 5, 20, 'None', true);
i = 0;
while (i < npcs.Size()){
if (GetAttitudeBetween(thePlayer, npcs[i]) == 2){
npcs[i].SignalGameplayEvent('DrawSword');
}
i += 1;
}
/* NOP */;
}
public function GetSwordType() : CName{
return 'None';
/* NOP */;
}
protected function InitSwordItem(){
var items : array<SItemUniqueId>;
var category : CName;
category = GetSwordType();
parent.inv.GetHeldWeaponsWithCategory(category, items);
swordId = items[0];
parent.inv.PlayItemEffect(swordId, 'rune_blast_loop');
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
parent.RemoveAnimEventCallback('FinishSpecialHeavyAttack');
parent.inv.StopItemEffect(swordId, 'rune_blast_loop');
/* NOP */;
}
protected function ProcessStartupAction(action : EInitialAction){
switch(action){
case 1:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(1, 1);
break;
case 2:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(2, 1);
break;
default:
/* NOP */;
}
/* NOP */;
}

public entry function CombatSwordInit(){


CombatSwordLoop();
/* NOP */;
}
public latent function CombatSwordLoop(){
while (true){
Sleep(0.500000);
}
/* NOP */;
}
public function OnCreateAttackAspects() : Bool{
super.CreateAttackLightAspect();
super.CreateAttackHeavyAspect();
super.CreateAttackLightFarAspect();
super.CreateAttackHeavyFarAspect();
super.CreateAttackLightFlyingAspect();
super.CreateAttackHeavyFlyingAspect();
super.CreateAttackLightAspectSlopeUp();
super.CreateAttackLightAspectSlopeDown();
super.CreateAttackLightCapsuleShort();
super.CreateAttackLightVsRiderAspect();
super.CreateAttackHeavyVsRiderAspect();
super.CreateAttackNeutral();
super.CreateAttackNeutralUnconscious();
/* NOP */;
}
private final function CreateAttackLightAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLight');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_3_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_4_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_3_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_rp_50m

s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_rp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_rp_50
ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_3_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_4_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_5_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_6_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 1);
aspect.AddLink('man_geralt_sword_attack_close_combo_l_1', 'man_g
eralt_sword_attack_close_combo_r_2');
aspect.AddLink('man_geralt_sword_attack_close_combo_l_4', 'man_g
eralt_sword_attack_close_combo2_r_1');
aspect.AddLink('man_geralt_sword_attack_close_combo2_r_1', 'man_
geralt_sword_attack_close_combo2_l_2');
aspect.AddLink('man_geralt_sword_attack_close_combo2_l_3', 'man_
geralt_sword_attack_close_combo2_r_4');
aspect.AddLink('man_geralt_sword_attack_close_combo2_r_4', 'man_
geralt_sword_attack_close_combo2_r_5');
aspect.AddLink('man_geralt_sword_attack_close_combo2_r_5', 'man_
geralt_sword_attack_close_combo_r_2');
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_3_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_4_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_lp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_lp_50

ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_3_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_4_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_5_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_6_lp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms', 1);
aspect.AddLink('man_geralt_attack_close_30ms_r_1', 'man_geralt_s
word_attack_close_combo_l_1');
aspect.AddLink('man_geralt_sword_attack_close_combo_r_2', 'man_g
eralt_sword_attack_close_combo_l_3');
aspect.AddLink('man_geralt_sword_attack_close_combo_l_3', 'man_g
eralt_sword_attack_close_combo_l_4');
aspect.AddLink('man_geralt_sword_attack_close_combo2_r_1', 'man_
geralt_sword_attack_close_combo2_l_2');
aspect.AddLink('man_geralt_sword_attack_close_combo2_l_2', 'man_
geralt_sword_attack_close_combo2_l_3');
/* NOP */;
}
private final function CreateAttackHeavyAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavy');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_strong_1_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_2_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_3_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_4_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_5_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_6_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_7_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_8_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_9_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_10_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_rp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_rp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_rp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_r
p_80ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_back_1_rp_8
0ms', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_left_1_rp_8
0ms', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_right_1_rp_
80ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_1_rp_70ms', 1);

str.AddAttack('man_geralt_sword_attack_strong_2_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_3_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_4_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_5_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_6_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_7_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_8_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_9_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_10_rp_70ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_strong_1_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_2_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_3_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_4_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_5_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_6_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_7_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_8_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_9_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_10_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_lp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_lp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_lp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_back_1_lp_8
0ms', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_left_1_lp_8
0ms', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_right_1_lp_
80ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_1_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_2_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_3_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_4_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_5_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_6_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_7_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_8_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_9_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_10_lp_70ms', 1);
/* NOP */;
}
private final function CreateAttackLightFarAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightFar');

str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 0,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 3,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 1,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 2,
str.AddAttack('man_geralt_sword_approach_attack_1', 2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 0,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 3,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 1,
str.AddDirAttack('man_geralt_sword_approach_attack_1', 2,
str.AddAttack('man_geralt_sword_approach_attack_1', 2);
/* NOP */;

2);
2);
2);
2);
2);
2);
2);
2);

}
private final function CreateAttackHeavyFarAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavyFar');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_far_forward_1_lp_8
0ms', 2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_far_forward_1_l
p_80ms', 2, 2);
str.AddAttack('man_geralt_sword_approach_attack_1', 2);
/* NOP */;
}
private final function CreateAttackLightFlyingAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightFlying');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_3_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 1)
;

str.AddDirAttack('man_geralt_sword_attack_fast_3_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_3_rp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_rp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_3_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_6_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_3_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_6_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms', 1);
/* NOP */;
}
private final function CreateAttackHeavyFlyingAspect(){
var aspect : CComboAspect;
var str : CComboString;

aspect = comboDefinition.CreateComboAspect('AttackHeavyFlying');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_strong_4_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_9_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_rp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_rp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_rp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_4_rp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_9_rp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_rp_70ms'
, 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_rp_70ms'
, 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_rp_70ms
', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_4_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_9_rp_70ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_strong_3_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_8_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_lp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_lp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_lp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_3_lp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_8_lp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_lp_70ms'
, 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_lp_70ms'
, 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_lp_70ms
', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_3_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_8_lp_70ms', 1);
/* NOP */;
}
private final function CreateAttackLightVsRiderAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightVsRider')
;
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',

1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms',

0);
0);
0);
1);
1);
1);

/* NOP */;
}
private final function CreateAttackHeavyVsRiderAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavyVsRider')
;
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_strong_10_rp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_rp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_rp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_rp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_10_rp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_rp_70ms'
, 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_rp_70ms'
, 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_rp_70ms
', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_10_rp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_4_rp_70ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_strong_9_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_10_lp_70ms', 0,
1);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_lp_70ms'
, 3, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_lp_70ms'
, 1, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_lp_70ms
', 2, 1);
str.AddDirAttack('man_geralt_sword_attack_strong_9_lp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_10_lp_70ms', 0,
2);
str.AddDirAttack('man_geralt_sword_attack_strong_back_1_lp_70ms'
, 3, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_left_1_lp_70ms'
, 1, 2);
str.AddDirAttack('man_geralt_sword_attack_strong_right_1_lp_70ms
', 2, 2);
str.AddAttack('man_geralt_sword_attack_strong_9_lp_70ms', 1);
str.AddAttack('man_geralt_sword_attack_strong_10_lp_70ms', 1);
/* NOP */;
}
private final function CreateAttackLightAspectSlopeUp(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightSlopeUp')
;
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',

3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_2_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0, 2)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_2_lp_40ms', 1);
/* NOP */;
}
private final function CreateAttackLightAspectSlopeDown(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightSlopeDown
');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0, 0)
;

str.AddDirAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_3_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_rp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_rp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_rp_50
ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_5_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_8_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_1_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 0)

;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_lp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_lp_50
ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_5_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_6_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_1_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_5_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_6_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
/* NOP */;

0);
0);
0);
0);
0);
1);
1);
1);
1);
1);

}
private final function CreateAttackLightCapsuleShort(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightCapsuleSh
ort');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 0)

;
str.AddDirAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_3_rp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_rp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_rp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_rp_50
ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_5_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_8_rp_40ms', 0);
str.AddAttack('man_geralt_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_5_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_7_rp_40ms', 1);
str.AddAttack('man_geralt_sword_attack_fast_8_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_attack_fast_1_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 0)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 0);

str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('man_geralt_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_5_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_6_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_7_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_9_lp_40ms', 0, 1)
;
str.AddDirAttack('man_geralt_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('man_geralt_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_back_2_lp_50m
s', 3, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_left_2_lp_50m
s', 1, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_1_lp_50
ms', 2, 2);
str.AddDirAttack('man_geralt_sword_attack_fast_far_right_2_lp_50
ms', 2, 2);
str.AddAttack('man_geralt_sword_attack_fast_1_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_5_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_6_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_1_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_5_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_6_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_7_lp_40ms',
str.AddAttack('man_geralt_sword_attack_fast_9_lp_40ms',
/* NOP */;

0);
0);
0);
0);
0);
1);
1);
1);
1);
1);

}
private final function CreateAttackNeutral(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackNeutral');
str = aspect.CreateComboString(false);
str.AddDirAttack('combat_locomotion_sucker_punch_40ms_close', 0,
0);
str.AddDirAttack('combat_locomotion_sucker_punch_70ms_far', 0, 1
);
str.AddAttack('combat_locomotion_sucker_punch_40ms_close', 0);
str.AddAttack('combat_locomotion_sucker_punch_70ms_far', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('combat_locomotion_sucker_punch_40ms_close', 0,
0);

str.AddDirAttack('combat_locomotion_sucker_punch_70ms_far', 0, 1
);
str.AddAttack('combat_locomotion_sucker_punch_40ms_close', 0);
str.AddAttack('combat_locomotion_sucker_punch_70ms_far', 1);
/* NOP */;
}
private final function CreateAttackNeutralUnconscious(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackNeutralUnconsc
ious');
str = aspect.CreateComboString(false);
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddAttack('combat_locomotion_kick_1', 0);
str.AddAttack('combat_locomotion_kick_2', 0);
str.AddAttack('combat_locomotion_kick_3', 0);
str.AddAttack('combat_locomotion_kick_1', 1);
str.AddAttack('combat_locomotion_kick_2', 1);
str.AddAttack('combat_locomotion_kick_3', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddAttack('combat_locomotion_kick_1', 0);
str.AddAttack('combat_locomotion_kick_2', 0);
str.AddAttack('combat_locomotion_kick_3', 0);
str.AddAttack('combat_locomotion_kick_1', 1);
str.AddAttack('combat_locomotion_kick_2', 1);
str.AddAttack('combat_locomotion_kick_3', 1);
/* NOP */;

0);
0);
0);
1);
1);
1);

0);
0);
0);
1);
1);
1);

}
protected function PerformPirouette(){
var vx : Float;
var vy : Float;
var mgt : Float;
var vec : Vector;
var startPoint : Vector;
var targetPoint : Vector;
var distanceToTarget : Float;
startPoint = thePlayer.GetWorldPosition();
targetPoint = thePlayer.GetTarget().GetWorldPosition();
distanceToTarget = VecDistance(startPoint, targetPoint);
vx = targetPoint.X - startPoint.X;
vy = targetPoint.Y - startPoint.Y;
mgt = SqrtF(vx * vx + vy * vy);
vx /= mgt;
vy /= mgt;
vec.X = startPoint.X + vx * mgt + distanceToTarget;
vec.Y = startPoint.Y + vy * mgt + distanceToTarget;
thePlayer.ActionMoveOnCurveToAsync(vec, distanceToTarget, true);
/* NOP */;
}

public function OnPerformSpecialAttack(isLightAttack : Bool, enableAttac


k : Bool) : Bool{
var actor : CActor;
var playerToTargetHeading : Float;
var staminaCostPerSec : Float;
var newTarget : CActor;
if (!thePlayer.IsCombatMusicEnabled() && enableAttack && !isLigh
tAttack && !thePlayer.CanAttackWhenNotInCombat(8, false, newTarget, /* NOP */)){
thePlayer.RemoveTimer('IsSpecialLightAttackInputHeld', /
* NOP */);
thePlayer.RemoveTimer('IsSpecialHeavyAttackInputHeld', /
* NOP */);
thePlayer.RemoveTimer('SpecialAttackLightSustainCost', /
* NOP */);
thePlayer.RemoveTimer('SpecialAttackHeavySustainCost', /
* NOP */);
thePlayer.RemoveTimer('UpdateSpecialAttackLightHeading',
/* NOP */);
if (!isLightAttack){
parent.RaiseCombatActionFriendlyEvent();
actor = (CActor)parent.slideTarget;
playerToTargetHeading = VecHeading(actor.GetWorl
dPosition() - parent.GetWorldPosition());
parent.SetCustomRotation('Attack', playerToTarge
tHeading, 0.000000, 0.300000, false);
}
} else {
if (enableAttack){
theGame.GetBehTreeReactionManager().CreateReacti
onEvent(parent, 'PlayerSpecialAttack', -1.000000, 20.000000, 0.250000, -1, /* NO
P */, /* NOP */);
parent.BlockAction(33, 'SpecialAttack', /* NOP *
/, /* NOP */, /* NOP */);
} else {
theGame.GetBehTreeReactionManager().RemoveReacti
onEvent(parent, 'PlayerSpecialAttack');
parent.UnblockAction(33, 'SpecialAttack');
}
if (isLightAttack){
if (enableAttack){
parent.SetSlideTarget(NULL);
parent.AddTimer('SpecialAttackLightSusta
inCost', 0.001000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
parent.RemoveTimer('IsSpecialLightAttack
InputHeld', /* NOP */);
parent.RemoveTimer('IsSpecialHeavyAttack
InputHeld', /* NOP */);
parent.RemoveTimer('SpecialAttackLightSu
stainCost', /* NOP */);
parent.ResumeStaminaRegen('WhirlSkill');
}
PerformSpecialAttackLight(enableAttack);
} else {
if (enableAttack){
parent.specialHeavyStartEngineTime = the
Game.GetEngineTime();
if (parent.GetStatPercents(2) > 0.990000
){
staminaCostPerSec = parent.GetSt

aminaActionCost(12, parent.GetSkillAbilityName(17), 1.000000);


parent.specialHeavyChargeDuratio
n = parent.GetStatMax(2) / staminaCostPerSec;
}
parent.AddTimer('SpecialAttackHeavySusta
inCost', 0.001000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
parent.DrainStamina(12, 0, 0, parent.Get
SkillAbilityName(17), /* NOP */, /* NOP */);
} else {
parent.RemoveTimer('SpecialAttackHeavySu
stainCost', /* NOP */);
}
PerformSpecialAttackHeavy(enableAttack);
}
}
/* NOP */;
}
public entry function PerformSpecialAttackLight(enableAttack : Bool){
var temp : Float;
if (parent.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 0.000000){
if (enableAttack){
parent.AddCustomOrientationTarget(2, 'SpecialAtt
ackLight');
parent.SetBehaviorVariable('isPerformingSpecialA
ttack', 1.000000, /* NOP */);
temp = parent.GetBehaviorVariable('combatActionT
ype', /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
parent.SetBehaviorVariable('combatActionType', 1
, /* NOP */);
parent.SetBehaviorVariable('playerAttackType', 0
, /* NOP */);
if (parent.bLAxisReleased){
parent.SetOrientationTargetCustomHeading
(parent.GetHeading(), 'SpecialAttackLight');
} else {
parent.SetOrientationTargetCustomHeading
(parent.rawPlayerHeading, 'SpecialAttackLight');
}
parent.AddTimer('UpdateSpecialAttackLightHeading
', 0.000000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else if (!enableAttack && parent.IsInCombatAction() && parent.
GetBehaviorVariable('combatActionType', /* NOP */) == 1 && parent.GetBehaviorVar
iable('playerAttackType', /* NOP */) == 0){
parent.SetBehaviorVariable('isPerformingSpecialAttack',
0.000000, /* NOP */);
parent.RemoveCustomOrientationTarget('SpecialAttackLight
');
parent.RemoveTimer('UpdateSpecialAttackLightHeading', /*
NOP */);
}
/* NOP */;
}
public timer function UpdateSpecialAttackLightHeading(optional time : Fl
oat, optional id : Int32){
if (parent.bLAxisReleased){

parent.SetOrientationTargetCustomHeading(parent.GetHeadi
ng(), 'SpecialAttackLight');
} else {
parent.SetOrientationTargetCustomHeading(parent.rawPlaye
rHeading, 'SpecialAttackLight');
}
/* NOP */;
}
public entry function PerformSpecialAttackHeavy(enableAttack : Bool){
var playerToTargetDist : Float;
var completeSpecialAttackTime : Float;
if (parent.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 0.000000){
if (enableAttack){
parent.AddCustomOrientationTarget(1, 'SpecialAtt
ackHeavy');
parent.SetBehaviorVariable('isPerformingSpecialA
ttack', 1.000000, /* NOP */);
parent.SetBehaviorVariable('playerAttackType', 1
, /* NOP */);
parent.SetBehaviorVariable('combatActionType', 1
, /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
parent.specialAttackCamera = true;
}
} else if (!enableAttack && parent.IsInCombatAction() && parent.
GetBehaviorVariable('combatActionType', /* NOP */) == 1 && parent.GetBehaviorVar
iable('playerAttackType', /* NOP */) == 1){
parent.SetBehaviorVariable('isPerformingSpecialAttack',
0.000000, /* NOP */);
parent.RemoveCustomOrientationTarget('SpecialAttackHeavy
');
}
/* NOP */;
}
public function OnAnimEvent_FinishSpecialHeavyAttack(animEventName : CNa
me, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : B
ool{
var animation : SCameraAnimationDefinition;
var specialHeavyAnimDuration : Float;
if (animEventType == 1){
animation.animation = 'camera_shake_loop_lvl1_1';
animation.priority = 3;
animation.blendIn = 0.100000;
animation.blendOut = 0.100000;
animation.weight = 2.000000;
animation.speed = 1.000000;
animation.loop = true;
animation.additive = true;
animation.reset = true;
theGame.GetGameCamera().PlayAnimation(animation);
specialHeavyAnimDuration = GetEventDurationFromEventAnim
Info(animInfo);
specialHeavyAnimDuration += EngineTimeToFloat(theGame.Ge
tEngineTime() - parent.specialHeavyStartEngineTime);
parent.specialHeavyChargeDuration = MinF(parent.specialH
eavyChargeDuration, specialHeavyAnimDuration);
}

/* NOP */;
}
public function OnSAHeavyStartComplete() : Bool{
theGame.GetGameCamera().StopAnimation('camera_shake_loop_lvl1_1'
);
parent.UnblockAction(33, 'SpecialAttack');
parent.RemoveTimer('SpecialAttackHeavySustainCost', /* NOP */);
/* NOP */;
}
}
state W3ReplacerCiriStateCombatSword in W3ReplacerCiri extends CR4PlayerStateCom
bat{
private var specialAttackHeading : Float;
private var completeSpecialAttackDist : Float;
private var specialAttackStartTimeStamp : Float;
private var isCompletingSpecialAttack : Bool;
private var specialAttackSphere : CMeshComponent;
private var specialAttackSphereEnt : CEntity;
private saved var specialAttackEffectTemplate : CEntityTemplate;
private saved var ciriPhantomTemplate : CEntityTemplate;
private saved var ciriGhostFxTemplate : CEntityTemplate;
private var buttonWasHeld : Bool;
private var specialAttackRadius : Float;
private const var HOLD_SPECIAL_ATTACK_BUTTON_TIME : Float;
private const var ATTACK_RADIUS_INITIAL_VAL : Float;
private const var ATTACK_RADIUS_MAXIMUM_VAL : Float;
private const var ATTACK_RADIUS_INCREASE_SPEED : Float;
private const var SPECIAL_ATTACK_MAX_TARGETS : Int32;
private const var DODGE_DISTANCE : Float;
private const var DASH_DISTANCE : Float;
private const var SPECIAL_ATTACK_HEAVY_MAX_DIST : Float;
private const var teleportToLastPos : Bool;
private var lastTarget : CActor;
private var _distances : array<Float>;
private var _vectors : array<Vector>;
private saved var attackAnimsListLP : array<CName>;
private saved var attackAnimsListRP : array<CName>;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
theInput.SetContext(parent.GetCombatInputContext());
parent.OnEquipMeleeWeapon(1, true, /* NOP */);
theGame.GetBehTreeReactionManager().CreateReactionEvent(thePlaye
r, 'DrawWeapon', 0.000000, 10.000000, 2.000000, -1, /* NOP */, /* NOP */);
if (!ciriGhostFxTemplate){
ciriGhostFxTemplate = (CEntityTemplate)LoadResource('cir
i_ghost', /* NOP */);
}
if (!ciriPhantomTemplate){
ciriPhantomTemplate = (CEntityTemplate)LoadResource('cir
i_phantom', /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
Interrupt();
super.OnLeaveState(nextStateName);
theInput.SetContext(parent.GetExplorationInputContext());
/* NOP */;
}

protected function ProcessStartupAction(action : EInitialAction){


switch(action){
case 1:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(1, 1);
break;
case 2:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(2, 1);
break;
default:
/* NOP */;
}
/* NOP */;
}
public function OnCreateAttackAspects() : Bool{
super.CreateAttackLightAspect();
super.CreateAttackLightFarAspect();
super.CreateAttackLightFlyingAspect();
super.CreateAttackLightAspectSlopeUp();
super.CreateAttackLightAspectSlopeDown();
super.CreateAttackLightCapsuleShort();
super.CreateAttackNeutral();
super.CreateAttackNeutralUnconscious();
super.CreateAttackLightVsRiderAspect();
/* NOP */;
}
private final function CreateAttackLightAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLight');
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 1);

str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_rp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_lp_50
ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0);

str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_3_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_3_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
/* NOP */;

0);
0);
0);
1);
1);
1);
1);

}
private final function CreateAttackLightFarAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightFar');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 0, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 3, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 1, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 2, 2);
str.AddAttack('man_geralt_sword_approach_attack_1', 2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 0, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 3, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 1, 2);
str.AddDirAttack('man_geralt_sword_approach_attack_1', 2, 2);
str.AddAttack('man_geralt_sword_approach_attack_1', 2);
/* NOP */;
}
private final function CreateAttackLightFlyingAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightFlying');
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 2);

str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_4_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_lp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_3_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_3_lp_40ms',
/* NOP */;

0);
0);
1);
1);

}
private final function CreateAttackLightAspectSlopeUp(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightSlopeUp')
;
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',

3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword _attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 1);
/* NOP */;
}
private final function CreateAttackLightAspectSlopeDown(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightSlopeDown
');
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);

str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_rp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_lp_50

ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
/* NOP */;

0);
0);
0);
1);
1);
1);

}
private final function CreateAttackLightVsRiderAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightVsRider')
;
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0, 2)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword _attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 2)
;

str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 1);
/* NOP */;
}
private final function CreateAttackLightCapsuleShort(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightCapsuleSh
ort');
str = aspect.CreateComboString(false);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_rp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_rp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_rp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_rp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_rp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_rp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_rp_50
ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 0);
str.AddAttack('woman_ciri_sword_attack_fast_1_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_3_rp_40ms', 1);
str.AddAttack('woman_ciri_sword_attack_fast_5_rp_40ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 0)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 0)

;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 0);
str.AddDirAttack('woman_ciri_sword_attack_fast_1_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_2_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_4_lp_40ms', 0, 1)
;
str.AddDirAttack('woman_ciri_sword_attack_fast_back_1_lp_40ms',
3, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_left_1_lp_40ms',
1, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_right_1_lp_40ms',
2, 1);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_forward_1_lp_
50ms', 0, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_back_1_lp_50m
s', 3, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_left_1_lp_50m
s', 1, 2);
str.AddDirAttack('woman_ciri_sword_attack_fast_far_right_1_lp_50
ms', 2, 2);
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_1_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_2_lp_40ms',
str.AddAttack('woman_ciri_sword_attack_fast_4_lp_40ms',
/* NOP */;

0);
0);
0);
1);
1);
1);

}
private final function CreateAttackNeutral(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackNeutral');
str = aspect.CreateComboString(false);
str.AddDirAttack('combat_locomotion_sucker_punch_40ms_close', 0,
0);
str.AddDirAttack('combat_locomotion_sucker_punch_70ms_far', 0, 1
);
str.AddAttack('combat_locomotion_sucker_punch_40ms_close', 0);
str.AddAttack('combat_locomotion_sucker_punch_70ms_far', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('combat_locomotion_sucker_punch_40ms_close', 0,
0);
str.AddDirAttack('combat_locomotion_sucker_punch_70ms_far', 0, 1
);
str.AddAttack('combat_locomotion_sucker_punch_40ms_close', 0);
str.AddAttack('combat_locomotion_sucker_punch_70ms_far', 1);
/* NOP */;
}
private final function CreateAttackNeutralUnconscious(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackNeutralUnconsc
ious');

str = aspect.CreateComboString(false);
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddAttack('combat_locomotion_kick_1', 0);
str.AddAttack('combat_locomotion_kick_2', 0);
str.AddAttack('combat_locomotion_kick_3', 0);
str.AddAttack('combat_locomotion_kick_1', 1);
str.AddAttack('combat_locomotion_kick_2', 1);
str.AddAttack('combat_locomotion_kick_3', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddDirAttack('combat_locomotion_kick_1', 0,
str.AddDirAttack('combat_locomotion_kick_2', 0,
str.AddDirAttack('combat_locomotion_kick_3', 0,
str.AddAttack('combat_locomotion_kick_1', 0);
str.AddAttack('combat_locomotion_kick_2', 0);
str.AddAttack('combat_locomotion_kick_3', 0);
str.AddAttack('combat_locomotion_kick_1', 1);
str.AddAttack('combat_locomotion_kick_2', 1);
str.AddAttack('combat_locomotion_kick_3', 1);
/* NOP */;

0);
0);
0);
1);
1);
1);

0);
0);
0);
1);
1);
1);

}
public function OnPerformSpecialAttack(startAttack : Bool) : Bool{
if (!parent.IsAlive() || parent.IsCurrentlyDodging()){
return false;
}
if (startAttack && !parent.HasAbility('CiriBlink') || !parent.Ha
sStaminaForSpecialAction(/* NOP */)){
if (parent.HasAbility('CiriBlink')){
thePlayer.DisplayActionDisallowedHudMessage(44,
/* NOP */, /* NOP */, true, /* NOP */);
}
return false;
}
if (startAttack){
theGame.GetBehTreeReactionManager().CreateReactionEvent(
parent, 'PlayerSpecialAttack', -1.000000, 20.000000, 0.250000, -1, /* NOP */, /*
NOP */);
} else {
theGame.GetBehTreeReactionManager().RemoveReactionEvent(
parent, 'PlayerSpecialAttack');
}
PerformSpecialAttack(startAttack);
return true;
/* NOP */;
}
public function OnPerformSpecialAttackHeavy(startAttack : Bool) : Bool{
if (!parent.IsAlive() || parent.IsCurrentlyDodging()){
return false;
}
if (startAttack && !parent.HasAbility('CiriCharge') || !parent.H
asStaminaForSpecialAction(/* NOP */)){
parent.SetCombatAction(1);
OnPerformAttack(theGame.params.ATTACK_NAME_LIGHT);

return false;
} else {
PerformSpecialAttackHeavy(startAttack);
}
return true;
/* NOP */;
}
public function OnPerformCounter() : Bool{
if (!parent.IsAlive()){
return false;
}
PerformCounter();
/* NOP */;
}
public function OnPerformDodge() : Bool{
if (!parent.IsAlive()){
return false;
}
if (thePlayer.IsTerrainTooSteepToRunUp()){
return false;
}
PerformDodge(/* NOP */, /* NOP */);
/* NOP */;
}
public function OnPerformDash() : Bool{
if (!parent.IsAlive()){
return false;
}
if (thePlayer.IsTerrainTooSteepToRunUp()){
return false;
}
PerformDodge(true, /* NOP */);
/* NOP */;
}
public function OnPerformDashAttack() : Bool{
if (!parent.IsAlive()){
return false;
}
if (thePlayer.IsTerrainTooSteepToRunUp()){
return false;
}
PerformDodge(true, true);
/* NOP */;
}
public function OnHitStart() : Bool{
Interrupt();
virtual_parent.OnHitStart();
/* NOP */;
}
public function OnCombatActionEndComplete() : Bool{
Interrupt();
super.OnCombatActionEndComplete();
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
Interrupt();
virtual_parent.OnDeath(damageAction);
/* NOP */;
}
public timer function ReleaseButtonHack(optional dt : Float, optional id

: Int32){
parent.OnSpecialActionHeavyEnd();
/* NOP */;
}
public entry function PerformSpecialAttack(startAttack : Bool){
var playerToTargetDist : Float;
var completeSpecialAttackTime : Float;
if (parent.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 0.000000){
if (startAttack){
if (ShouldProcessTutorial('TutorialCiriBlink')){
FactsAdd('tut_ciri_blinking', /* NOP */,
/* NOP */);
}
parent.SetCanPlayHitAnim(true);
SpecialAttackSphereCleanup();
parent.AddCustomOrientationTarget(1, 'CiriSpecia
lAttack');
parent.SetBehaviorVariable('isPerformingSpecialA
ttack', 1.000000, /* NOP */);
parent.SetBehaviorVariable('isCompletingSpecialA
ttack', 0.000000, /* NOP */);
parent.SetBehaviorVariable('specialAttackInPlace
', 0.000000, /* NOP */);
parent.SetBehaviorVariable('playerAttackType', 2
.000000, /* NOP */);
parent.SetBehaviorVariable('combatActionType', 1
, /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
isCompletingSpecialAttack = false;
buttonWasHeld = false;
specialAttackRadius = ATTACK_RADIUS_INITIAL_VAL;
parent.specialAttackCamera = false;
if (!specialAttackEffectTemplate){
specialAttackEffectTemplate = (CEntityTe
mplate)LoadResource('special_attack_ciri', /* NOP */);
}
specialAttackStartTimeStamp = theGame.GetEngineT
imeAsSeconds();
parent.AddTimer('SpecialAttackTimer', 0, true, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else if (!startAttack && !isCompletingSpecialAttack){
parent.RemoveTimer('SpecialAttackTimer', /* NOP */);
parent.SetBehaviorVariable('isPerformingSpecialAttack',
0.000000, /* NOP */);
isCompletingSpecialAttack = true;
parent.specialAttackCamera = false;
CompleteSpecialAttack(/* NOP */);
parent.RemoveCustomOrientationTarget('CiriSpecialAttack'
);
}
/* NOP */;
}
public entry function PerformSpecialAttackHeavy(startAttack : Bool){
parent.SetCleanupFunction('PerformSpecialAttackHeavyCleanup');
if (parent.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 0.000000){

if (startAttack){
if (ShouldProcessTutorial('TutorialCiriCharge'))
{
FactsAdd('tut_ciri_charging', /* NOP */,
/* NOP */);
}
parent.SetCanPlayHitAnim(true);
parent.AddCustomOrientationTarget(1, 'CiriSpecia
lAttack');
parent.SetBehaviorVariable('isPerformingSpecialA
ttack', 1.000000, /* NOP */);
parent.SetBehaviorVariable('isCompletingSpecialA
ttack', 0.000000, /* NOP */);
parent.SetBehaviorVariable('playerAttackType', 3
.000000, /* NOP */);
parent.SetBehaviorVariable('combatActionType', 1
, /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
isCompletingSpecialAttack = false;
buttonWasHeld = false;
parent.specialAttackCamera = true;
specialAttackStartTimeStamp = theGame.GetEngineT
imeAsSeconds() + 0.200000;
}
} else if (!startAttack && !isCompletingSpecialAttack){
isCompletingSpecialAttack = true;
parent.specialAttackCamera = false;
CompleteSpecialAttackHeavy();
parent.RemoveCustomOrientationTarget('CiriSpecialAttack'
);
}
/* NOP */;
}
public entry function PerformCounter(){
parent.SetCanPlayHitAnim(false);
parent.AddCustomOrientationTarget(1, 'CiriSpecialAttack');
parent.SetBehaviorVariable('specialAttackInPlace', 0.000000, /*
NOP */);
parent.SetBehaviorVariable('playerAttackType', 2.000000, /* NOP
*/);
parent.SetBehaviorVariable('combatActionType', 1, /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
virtual_parent.OnCombatActionStart();
}
parent.specialAttackCamera = false;
buttonWasHeld = false;
isCompletingSpecialAttack = true;
CompleteSpecialAttack(true);
/* NOP */;
}
public entry function PerformDodge(dash : Bool, attackDash : Bool){
var evadeDirection : EPlayerEvadeDirection;
var angleDist : Float;
var cameraHeadingVec : Vector;
var newHeadingVec : Vector;
var targetPos : Vector;
var currentPos : Vector;
var correctedPos : Vector;

var tempPos : Vector;


var distance : Float;
var angleToTarget : Float;
var heading : Float;
var slideDuration : Float;
var collision : array<CName>;
var res : Bool;
distance = VecDistance(parent.GetWorldPosition(), (CActor)parent
.slideTarget.PredictWorldPosition(0.200000));
if (attackDash && !parent.slideTarget || distance < (CActor)pare
nt.slideTarget.GetRadius() + parent.GetRadius() + 2.500000){
OnPerformAttack(theGame.params.ATTACK_NAME_LIGHT);
return;
}
parent.LockEntryFunction(true);
parent.SetIsCurrentlyDodging(true, true);
parent.EnableCharacterCollisions(false);
SpecialAttackSphereCleanup();
parent.SetBehaviorVariable('combatActionType', 12, /* NOP */);
cameraHeadingVec = theCamera.GetCameraDirection();
if (parent.bLAxisReleased){
evadeDirection = 4;
heading = VecHeading(cameraHeadingVec * -1);
} else {
heading = parent.rawPlayerHeading;
angleDist = AngleDistance(parent.GetHeading(), heading);
if (angleDist > 135){
evadeDirection = 4;
} else if (angleDist > 45){
evadeDirection = 6;
} else if (angleDist > -45){
evadeDirection = 0;
} else if (angleDist > -135){
evadeDirection = 2;
} else {
evadeDirection = 4;
}
}
parent.SetCombatActionHeading(heading);
angleDist = AngleNormalize(heading + 180);
parent.SetBehaviorVariable('playerEvadeDirection', evadeDirectio
n, /* NOP */);
parent.SetBehaviorVariable('requestedDodgeDirection', angleDist,
/* NOP */);
parent.SetBehaviorVariable('isPerformingSpecialAttack', 1.000000
, /* NOP */);
if (parent.RaiseForceEvent('CombatAction')){
res = parent.WaitForBehaviorNodeActivation('CombatAction
Activation', 0.500000);
if (!res){
parent.SetIsCurrentlyDodging(false, /* NOP */);
parent.LockEntryFunction(false);
return;
}
virtual_parent.OnCombatActionStart();
} else {
parent.SetIsCurrentlyDodging(false, /* NOP */);
parent.LockEntryFunction(false);
return;
}

parent.RaiseEvent('ItemEndL');
parent.ResetUninterruptedHitsCount();
parent.WaitForBehaviorNodeDeactivation('SpecialAttackCiriStart',
0.170000);
newHeadingVec = VecFromHeading(heading);
currentPos = parent.GetWorldPosition();
if (dash && parent.HasStaminaForDash(false)){
angleToTarget = NodeToNodeAngleDistance(parent.slideTarg
et, parent);
if (parent.slideTarget && attackDash || !parent.bLAxisRe
leased && AbsF(AngleDistance(parent.GetHeading() - angleToTarget, heading)) < 50
){
if (distance > 4.000000){
distance = ClampF(distance, DODGE_DISTAN
CE, distance - (CActor)parent.slideTarget.GetRadius() - 1.800000);
} else {
distance = ClampF(distance, distance + p
arent.GetRadius() + (CActor)parent.slideTarget.GetRadius(), DODGE_DISTANCE);
}
newHeadingVec = VecFromHeading(AngleNormalize180
(parent.GetHeading() - angleToTarget));
targetPos = currentPos + newHeadingVec * distanc
e;
} else {
distance = DASH_DISTANCE;
targetPos = currentPos + newHeadingVec * distanc
e;
}
} else {
distance = DODGE_DISTANCE;
targetPos = currentPos + newHeadingVec * distance;
}
tempPos = currentPos;
tempPos.Z += 1.000000;
correctedPos = targetPos;
correctedPos.Z += 1.000000;
collision.PushBack('Static');
collision.PushBack('Terrain');
if (theGame.GetWorld().SweepTest(tempPos, correctedPos, 0.100000
, correctedPos, tempPos, collision)){
targetPos = correctedPos;
targetPos.Z = currentPos.Z;
}
parent.StopEffect('Burning');
slideDuration = distance * 0.040000;
slideDuration = ClampF(slideDuration, 0.100000, 0.200000);
if (dash && parent.slideTarget){
SlideToNewPosition(slideDuration, targetPos, newHeadingV
ec, /* NOP */);
} else {
SlideToNewPosition(slideDuration, targetPos, /* NOP */,
/* NOP */);
}
parent.StopEffect('Burning');
Appear();
parent.RaiseEvent('ForceBlendOut');
parent.SetIsCurrentlyDodging(false, /* NOP */);
parent.LockEntryFunction(false);
if (parent.moveTarget){
angleDist = AngleDistance(parent.GetHeading(), VecHeadin

g(parent.moveTarget.GetWorldPosition() - parent.GetWorldPosition()));
if (angleDist > 135){
evadeDirection = 4;
} else if (angleDist > 45){
evadeDirection = 6;
} else if (angleDist > -45){
evadeDirection = 0;
} else if (angleDist > -135){
evadeDirection = 2;
} else {
evadeDirection = 4;
}
} else {
evadeDirection = 0;
}
parent.SetBehaviorVariable('playerEvadeDirection', evadeDirectio
n, /* NOP */);
Appear();
parent.SetBehaviorVariable('isPerformingSpecialAttack', 0.000000
, /* NOP */);
parent.EnableCharacterCollisions(true);
parent.SetIsCurrentlyDodging(false, /* NOP */);
if (attackDash){
OnPerformAttack(theGame.params.ATTACK_NAME_LIGHT);
}
/* NOP */;
}
protected function UpdateCameraInterior(moveData : SCameraMovementData,
timeDelta : Float){
var destYaw : Float;
var targetPos : Vector;
var playerToTargetVector : Vector;
var playerToTargetAngles : EulerAngles;
var playerToTargetPitch : Float;
if (parent.IsCameraLockedToTarget() && parent.IsInCombatAction()
&& parent.GetBehaviorVariable('combatActionType', /* NOP */) == 12){
SetInteriorCameraDesiredPositionMult(0.500000);
moveData.pivotPositionController.SetDesiredPosition(pare
nt.GetWorldPosition(), 0.500000);
playerToTargetVector = parent.GetDisplayTarget().GetWorl
dPosition() - parent.GetWorldPosition();
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(playerToTargetVector), 0.500000);
if (AbsF(playerToTargetVector.Z) <= 1.000000){
if (parent.IsGuarded()){
moveData.pivotRotationController.SetDesi
redPitch(-25.000000, /* NOP */);
} else {
moveData.pivotRotationController.SetDesi
redPitch(-15.000000, /* NOP */);
}
} else {
playerToTargetAngles = VecToRotation(playerToTar
getVector);
playerToTargetPitch = playerToTargetAngles.Pitch
+ 10;
moveData.pivotRotationController.SetDesiredPitch
(playerToTargetPitch * -1, 0.500000);
}
} else {

super.UpdateCameraInterior(moveData, timeDelta);
}
/* NOP */;
}
public entry function Interrupt(){
if (!isCompletingSpecialAttack){
isCompletingSpecialAttack = true;
SpecialAttackCleanup();
parent.RemoveCustomOrientationTarget('CiriSpecialAttack'
);
parent.GetMovingAgentComponent().GetMovementAdjustor().C
ancelAll();
} else if (parent.IsCurrentlyDodging()){
parent.GetMovingAgentComponent().GetMovementAdjustor().C
ancelAll();
parent.SetBehaviorVariable('isPerformingSpecialAttack',
0.000000, /* NOP */);
}
Appear();
/* NOP */;
}
private latent function CompleteSpecialAttack(jumpBehindTarget : Bool){
var cachedPos : Vector;
var cachedRot : EulerAngles;
var cachedHeadingVec : Vector;
var targets : array<CActor>;
var phantom : W3CiriPhantom;
var newHeadingVec : Vector;
var newPosition : Vector;
var targetPos : Vector;
var distance : Float;
var correctedZ : Float;
cachedPos = parent.GetWorldPosition();
cachedRot = parent.GetWorldRotation();
cachedHeadingVec = parent.GetHeadingVector();
SpecialAttackSphereCleanup();
parent.AddBuffImmunity_AllNegative('CiriSpecial', true);
parent.StopEffect('critical_poison');
if (jumpBehindTarget){
lastTarget = (CActor)parent.slideTarget;
if (!lastTarget.GetGameplayVisibility()){
lastTarget = NULL;
}
} else if (specialAttackStartTimeStamp + HOLD_SPECIAL_ATTACK_BUT
TON_TIME < theGame.GetEngineTimeAsSeconds()){
buttonWasHeld = true;
} else {
while (!parent.RaiseEvent('ForceBlendOut')){
SleepOneFrame();
}
return;
}
parent.SetBehaviorVariable('isCompletingSpecialAttack', 1.000000
, /* NOP */);
if (buttonWasHeld){
FindSpecialAttackTargets(targets, SPECIAL_ATTACK_MAX_TAR
GETS);
}
if (!isCompletingSpecialAttack){
return;

}
if (buttonWasHeld){
parent.SetBehaviorVariable('specialAttackInPlace', 1.000
000, /* NOP */);
Disappear();
ExecuteSpecialAttack(targets);
}
PhantomsCleanup();
if (lastTarget){
targetPos = lastTarget.GetWorldPosition();
newHeadingVec = VecNormalize(cachedPos - targetPos);
if (!buttonWasHeld){
RotateToNewHeading(0, VecNormalize(targetPos - c
achedPos));
Disappear();
}
lastTarget.IsAttacked(true);
if (jumpBehindTarget){
distance = lastTarget.GetRadius() + parent.GetRa
dius() + 0.010000;
} else {
distance = lastTarget.GetRadius() + parent.GetRa
dius() + 1.800000;
}
if (distance < 1.500000){
distance = 1.500000;
}
newPosition = targetPos - newHeadingVec * distance;
if (!theGame.GetWorld().NavigationComputeZ(newPosition,
newPosition.Z - 1, newPosition.Z + 1, correctedZ)){
SlideToNewPosition(GetSlideDuration(cachedPos),
cachedPos, cachedHeadingVec, true);
} else {
SlideToNewPosition(GetSlideDuration(newPosition)
, newPosition, newHeadingVec, /* NOP */);
}
lastTarget = NULL;
} else {
parent.SetBehaviorVariable('specialAttackInPlace', 1.000
000, /* NOP */);
if (targets.Size() > 0){
parent.OnSlideToNewPositionStart(GetSlideDuratio
n(newPosition), cachedPos, cachedHeadingVec);
SlideToNewPosition(GetSlideDuration(cachedPos),
cachedPos, cachedHeadingVec, true);
} else {
parent.OnSlideToNewPositionStart(0.400000, cache
dPos, cachedHeadingVec);
SlideToNewPosition(0.400000, cachedPos, cachedHe
adingVec, true);
}
}
Appear();
parent.RemoveBuffImmunity_AllNegative('CiriSpecial');
/* NOP */;
}
private latent function CompleteSpecialAttackHeavy(){
var buttonHeldTime : Float;
var newHeadingVec : Vector;
var destinationPos : Vector;

var distance : Float;


var angleToTarget : Float;
var vecDistance : Float;
var slideDuration : Float;
var npc : CNewNPC;
buttonHeldTime = theGame.GetEngineTimeAsSeconds() - specialAttac
kStartTimeStamp;
parent.SetCombatIdleStance(0.000000);
parent.DrainResourceForSpecialAttack();
parent.SetBehaviorVariable('isCompletingSpecialAttack', 1.000000
, /* NOP */);
parent.MakeInvulnerable(true);
if (parent.slideTarget && GetAttitudeBetween(parent, parent.slid
eTarget) == 2){
angleToTarget = NodeToNodeAngleDistance(parent.slideTarg
et, parent);
}
newHeadingVec = VecFromHeading(AngleNormalize180(parent.GetHeadi
ng() - angleToTarget));
vecDistance = VecDistance(parent.GetWorldPosition(), parent.slid
eTarget.GetWorldPosition());
distance = ClampF(buttonHeldTime, HOLD_SPECIAL_ATTACK_BUTTON_TIM
E, 2.000000);
distance = SPECIAL_ATTACK_HEAVY_MAX_DIST * distance * 0.250000;
distance = ClampF(distance, vecDistance + distance, SPECIAL_ATTA
CK_HEAVY_MAX_DIST);
destinationPos = parent.GetWorldPosition() + newHeadingVec * dis
tance;
slideDuration = distance / 30;
slideDuration = ClampF(slideDuration, 0.100000, 0.400000);
parent.EnableSpecialAttackHeavyCollsion(true);
SlideToNewPosition(slideDuration, destinationPos, newHeadingVec,
/* NOP */);
Sleep(0.050000);
parent.EnableSpecialAttackHeavyCollsion(false);
parent.MakeInvulnerable(false);
parent.SetBehaviorVariable('isPerformingSpecialAttack', 0.000000
, /* NOP */);
isCompletingSpecialAttack = false;
/* NOP */;
}
private function PerformSpecialAttackHeavyCleanup(){
parent.SetBehaviorVariable('isCompletingSpecialAttack', 1.000000
, /* NOP */);
parent.EnableSpecialAttackHeavyCollsion(false);
parent.MakeInvulnerable(false);
parent.SetBehaviorVariable('isPerformingSpecialAttack', 0.000000
, /* NOP */);
isCompletingSpecialAttack = false;
/* NOP */;
}
private function EnergyBurst(radius : Float){
var entities : array<CGameplayEntity>;
var i : Int32;
FindGameplayEntitiesInSphere(entities, parent.GetWorldPosition()
, radius, 50, 'None', 32 + 4 + 256 + 16384, parent, /* NOP */);
i = 0;
while (i < entities.Size()){
(CActor)entities[i].AddEffectDefault(9, parent, 'CiriEne
rgyBurst', /* NOP */);

i += 1;
}
/* NOP */;
}
private function SpecialAttackCleanup(){
SpecialAttackSphereCleanup();
PhantomsCleanup();
parent.RemoveTimer('SpecialAttackTimer', /* NOP */);
parent.SetBehaviorVariable('isCompletingSpecialAttack', 0.000000
, /* NOP */);
parent.SetBehaviorVariable('isPerformingSpecialAttack', 0.000000
, /* NOP */);
isCompletingSpecialAttack = false;
parent.MakeInvulnerable(false);
parent.SetBehaviorVariable('specialAttackInPlace', 1.000000, /*
NOP */);
Appear();
/* NOP */;
}
private function SpecialAttackSphereCleanup(){
parent.RemoveTimer('SpecialAttackTimer', /* NOP */);
if (specialAttackSphereEnt){
specialAttackSphereEnt.PlayEffect('fade', /* NOP */);
specialAttackSphereEnt.DestroyAfter(0.600000);
}
specialAttackSphereEnt = NULL;
specialAttackSphere = NULL;
/* NOP */;
}
private function PhantomsCleanup(){
parent.DestroyPhantoms();
/* NOP */;
}
private function SpawnSpecialAttackSphere(){
specialAttackSphereEnt = theGame.CreateEntity(specialAttackEffec
tTemplate, parent.GetWorldPosition(), parent.GetWorldRotation(), /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function SpecialAttackTimer(optional dt : Float, optional i
d : Int32){
if (!buttonWasHeld && specialAttackStartTimeStamp + HOLD_SPECIAL
_ATTACK_BUTTON_TIME < theGame.GetEngineTimeAsSeconds()){
buttonWasHeld = true;
}
if (buttonWasHeld){
if (!specialAttackSphereEnt){
SpawnSpecialAttackSphere();
}
if (parent.HasAbility('Ciri_Rage')){
specialAttackRadius += dt * ATTACK_RADIUS_INCREA
SE_SPEED * 2;
} else {
specialAttackRadius += dt * ATTACK_RADIUS_INCREA
SE_SPEED;
}
if (specialAttackRadius >= ATTACK_RADIUS_MAXIMUM_VAL){
specialAttackRadius = ATTACK_RADIUS_MAXIMUM_VAL;
parent.RemoveTimer('SpecialAttackTimer', /* NOP
*/);

}
if (!specialAttackSphere){
specialAttackSphere = (CMeshComponent)specialAtt
ackSphereEnt.GetComponentByClassName('CMeshComponent');
}
if (specialAttackSphere){
specialAttackSphere.SetScale(Vector(specialAttac
kRadius, specialAttackRadius, specialAttackRadius));
}
}
/* NOP */;
}
private function Appear(){
parent.SetBehaviorVariable('isCompletingSpecialAttack', 0.000000
, /* NOP */);
parent.RaiseEvent('SACiriAppear');
parent.MakeInvulnerable(false);
parent.ToggleRageEffect(true);
/* NOP */;
}
private latent function Disappear(){
parent.ToggleRageEffect(false);
parent.MakeInvulnerable(true);
parent.WaitForBehaviorNodeDeactivation('DisappearEnd', 2.000000)
;
/* NOP */;
}
private latent function SlideToNewPosition(duration : Float, newPos : Ve
ctor, newHeading : Vector, alsoTeleport : Bool){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = parent.GetMovingAgentComponent().GetMovementA
djustor();
movementAdjustor.CancelAll();
ticket = movementAdjustor.CreateNewRequest('CiriSpecialAttackSli
de');
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, 1000000.0000
00);
movementAdjustor.AdjustmentDuration(ticket, duration);
movementAdjustor.SlideTo(ticket, newPos);
if (newHeading != Vector(0, 0, 0)){
movementAdjustor.RotateTo(ticket, VecHeading(newHeading)
);
}
if (duration > 0){
Sleep(duration);
}
if (alsoTeleport && VecDistanceSquared(newPos, parent.GetWorldPo
sition()) > 0.250000){
parent.Teleport(newPos);
}
/* NOP */;
}
private latent function RotateToNewHeading(duration : Float, newHeading
: Vector){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = parent.GetMovingAgentComponent().GetMovementA
djustor();
movementAdjustor.CancelAll();

ticket = movementAdjustor.CreateNewRequest('CiriDodgeRotation');
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, 1000000.0000
00);
movementAdjustor.AdjustmentDuration(ticket, duration);
if (newHeading != Vector(0, 0, 0)){
movementAdjustor.RotateTo(ticket, VecHeading(newHeading)
);
}
if (duration > 0){
Sleep(duration);
}
/* NOP */;
}
private latent function SlideToNewNode(duration : Float, node : CNode){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = parent.GetMovingAgentComponent().GetMovementA
djustor();
movementAdjustor.CancelAll();
ticket = movementAdjustor.CreateNewRequest('CiriSpecialAttackSli
de');
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, 1000000.0000
00);
movementAdjustor.AdjustmentDuration(ticket, duration);
movementAdjustor.SlideTowards(ticket, node, /* NOP */, /* NOP */
);
Sleep(duration);
/* NOP */;
}
private function GetProperHeadingForCamera(vec : Vector, use90 : Bool) :
Vector{
var vec90_left : Vector;
var vec90_right : Vector;
var vec45_left : Vector;
var vec45_right : Vector;
var vec135_left : Vector;
var vec135_right : Vector;
var cameraHeading : Float;
var distTo90_left : Float;
var distTo90_right : Float;
var distTo45_left : Float;
var distTo135_left : Float;
var distTo45_right : Float;
var distTo135_right : Float;
var chosenVector : Vector;
var i : Int32;
cameraHeading = VecHeading(theCamera.GetCameraDirection());
if (use90){
vec90_left = VecRotByAngleXY(vec, -90);
vec90_right = VecRotByAngleXY(vec, 90);
distTo90_left = AngleDistance(cameraHeading, VecHeading(
vec90_left));
distTo90_right = AngleDistance(cameraHeading, VecHeading
(vec90_right));
if (AbsF(distTo90_left) < AbsF(distTo90_right)){
return vec90_left;
} else {
return vec90_right;
}
} else {

_vectors.Clear();
_distances.Clear();
vec45_left = VecRotByAngleXY(vec, -45);
_vectors.PushBack(vec45_left);
vec135_left = VecRotByAngleXY(vec, -135);
_vectors.PushBack(vec135_left);
vec45_right = VecRotByAngleXY(vec, 45);
_vectors.PushBack(vec45_right);
vec135_right = VecRotByAngleXY(vec, 135);
_vectors.PushBack(vec135_right);
distTo45_left = AngleDistance(cameraHeading, VecHeading(
vec45_left));
_distances.PushBack(AbsF(distTo45_left));
distTo135_left = AngleDistance(cameraHeading, VecHeading
(vec135_left));
_distances.PushBack(AbsF(distTo135_left));
distTo45_right = AngleDistance(cameraHeading, VecHeading
(vec45_right));
_distances.PushBack(AbsF(distTo45_right));
distTo135_right = AngleDistance(cameraHeading, VecHeadin
g(vec135_right));
_distances.PushBack(AbsF(distTo135_right));
return _vectors[ArrayFindMinF(_distances)];
}
/* NOP */;
}
private function IsPositionSupaCool(pos : Vector) : Bool{
return theGame.GetWorld().NavigationCircleTest(pos, parent.GetRa
dius(), /* NOP */);
/* NOP */;
}
private function GetBetterPosition(oldPosition : Vector, newPosition : V
ector) : Bool{
return theGame.GetWorld().NavigationFindSafeSpot(oldPosition, pa
rent.GetRadius(), 3 * parent.GetRadius(), newPosition);
/* NOP */;
}
private function FindSpecialAttackTargets(targets : array<CActor>, maxEn
emiesNo : Int32){
var i : Int32;
targets = parent.GetNPCsAndPlayersInRange(specialAttackRadius, m
axEnemiesNo, 'None', 256 + 4 + 32);
i = targets.Size() - 1;
while (i >= 0){
if (!parent.IsEnemyVisible(targets[i]) || !targets[i].Ge
tGameplayVisibility()){
targets.Erase(i);
}
i -= 1;
}
/* NOP */;
}
private latent function ExecuteSpecialAttack(targets : array<CActor>){
var i : Int32;
var j : Int32;
var targetPos : Vector;
var playerPos : Vector;
var spawnPos : Vector;
var spawnHeading : Vector;
var spawnRot : EulerAngles;

var dist : Float;


var slideDuration : Float;
var oneTarget : Bool;
playerPos = parent.GetWorldPosition();
parent.DrainResourceForSpecialAttack();
i = 0;
while (i < targets.Size()){
if (i == targets.Size() - 1 && teleportToLastPos){
lastTarget = targets[i];
break;
}
PhantomsCleanup();
if (targets.Size() == 1){
oneTarget = true;
j = 0;
while (j < 2){
dist = targets[i].GetRadius() + parent.G
etRadius() + 1.800000;
if (j == 1){
GetSpawnPosAndRot(targets[i], -9
5, dist, spawnPos, spawnRot);
} else if (j == 0){
GetSpawnPosAndRot(targets[i], 95
, dist, spawnPos, spawnRot);
}
SpawnPhantomWithAnim(spawnPos, spawnRot,
targets[i], /* NOP */);
Sleep(0.200000);
j += 1;
}
lastTarget = targets[i];
} else {
dist = targets[i].GetRadius() + parent.GetRadius
() + 1.800000;
GetSpawnPosAndRot(targets[i], 0, dist, spawnPos,
spawnRot);
SpawnPhantomWithAnim(spawnPos, spawnRot, targets
[i], /* NOP */);
Sleep(0.050000);
}
targets[i].IsAttacked(true);
targetPos = targets[i].GetWorldPosition();
slideDuration = GetSlideDuration(targetPos);
parent.OnSlideToNewPositionStart(slideDuration, targetPo
s, GetProperHeadingForCamera(targets[i].GetHeadingVector(), oneTarget));
SlideToNewNode(slideDuration, targets[i]);
i += 1;
}
/* NOP */;
}
private function GetSlideDuration(destinationPos : Vector) : Float{
var slideDistance : Float;
var slideDuration : Float;
slideDistance = VecDistance(parent.GetWorldPosition(), destinati
onPos);
slideDuration = slideDistance / 10;
slideDuration = ClampF(slideDuration, 0.100000, 0.400000);
return slideDuration;
/* NOP */;
}

private function GetSpawnPosAndRot(target : CNode, angleDiff : Float, di


stOffset : Float, spawnPos : Vector, spawnRot : EulerAngles){
var headingVec : Vector;
headingVec = VecFromHeading(AngleNormalize180(target.GetHeading(
) + angleDiff));
spawnRot = VecToRotation(headingVec);
spawnPos = GetSpawnOffsetPosition(target.GetWorldPosition(), hea
dingVec, distOffset);
/* NOP */;
}
private function GetSpawnOffsetPosition(targetPos : Vector, headingVec :
Vector, offset : Float) : Vector{
var pos : Vector;
var newPos : Vector;
var normal : Vector;
pos = targetPos - headingVec * offset;
if (theGame.GetWorld().NavigationFindSafeSpot(pos, parent.GetRad
ius(), 2.000000, newPos)){
if (theGame.GetWorld().StaticTrace(newPos + Vector(0, 0,
3), newPos - Vector(0, 0, 3), newPos, normal, /* NOP */)){
headingVec = targetPos - newPos;
return newPos;
}
}
return pos;
/* NOP */;
}
private latent function SpawnPhantomWithAnim(position : Vector, rotation
: EulerAngles, target : CActor, animationName : CName){
var phantom : W3CiriPhantom;
var animComp : CAnimatedComponent;
var res : Bool;
phantom = (W3CiriPhantom)theGame.CreateEntity(ciriPhantomTemplat
e, position, rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (phantom){
if (!IsNameValid(animationName)){
SelectRandomAnim(animationName);
}
phantom.Init(parent, target);
AddPhantom(phantom);
animComp = (CAnimatedComponent)phantom.GetComponentByCla
ssName('CAnimatedComponent');
if (animComp){
res = animComp.PlaySlotAnimationAsync(animationN
ame, 'GAMEPLAY_SLOT', /* NOP */);
}
}
res = false;
/* NOP */;
}
private latent function SpawnPhantomInFrozenFrame(position : Vector, rot
ation : EulerAngles, anim : Float){
var phantom : W3CiriPhantom;
var animComp : CAnimatedComponent;
var res : Bool;
phantom = (W3CiriPhantom)theGame.CreateEntity(ciriGhostFxTemplat
e, position, rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (phantom){
phantom.Init(parent, NULL);
AddPhantom(phantom);

animComp = (CAnimatedComponent)phantom.GetComponentByCla
ssName('CAnimatedComponent');
if (animComp){
animComp.SetBehaviorVariable('anim', anim);
animComp.SetBehaviorVariable('combatIdleStance',
parent.GetBehaviorVariable('combatIdleStance', 0));
}
phantom.DestroyAfter(1.500000);
}
res = false;
/* NOP */;
}
private function AddPhantom(phantom : W3CiriPhantom){
parent.AddPhantom(phantom);
/* NOP */;
}
private function SelectRandomAnim(animName : CName){
var anim : CName;
var index : Int32;
if (attackAnimsListLP.Size() == 0 && attackAnimsListRP.Size() ==
0){
attackAnimsListLP.PushBack('woman_ciri_sword_attack_fast
_1_lp_40ms');
attackAnimsListLP.PushBack('woman_ciri_sword_attack_fast
_2_lp_40ms');
attackAnimsListLP.PushBack('woman_ciri_sword_attack_fast
_3_lp_40ms');
attackAnimsListLP.PushBack('woman_ciri_sword_attack_fast
_4_lp_40ms');
attackAnimsListRP.PushBack('woman_ciri_sword_attack_fast
_1_rp_40ms');
attackAnimsListRP.PushBack('woman_ciri_sword_attack_fast
_2_rp_40ms');
attackAnimsListRP.PushBack('woman_ciri_sword_attack_fast
_3_rp_40ms');
attackAnimsListRP.PushBack('woman_ciri_sword_attack_fast
_4_rp_40ms');
attackAnimsListRP.PushBack('woman_ciri_sword_attack_fast
_5_rp_40ms');
}
if (RandRange(100, 0) > 50){
index = RandRange(attackAnimsListLP.Size(), /* NOP */);
anim = attackAnimsListLP[index];
} else {
index = RandRange(attackAnimsListRP.Size(), /* NOP */);
anim = attackAnimsListRP[index];
}
animName = anim;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
super.OnGameCameraPostTick(moveData, dt);
if (!parent.IsCameraLockedToTarget() && parent.GetPlayerCombatSt
ance() == 1){
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(theCamera.GetCameraDirection()), /* NOP */);
}
/* NOP */;
}

}
state W3ReplacerCiriStateCombatSteel in W3ReplacerCiri extends W3ReplacerCiriSta
teCombatSword{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
CombatSteelInit(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CombatSteelDone(nextStateName);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function CombatSteelInit(prevStateName : CName){
parent.OnEquipMeleeWeapon(1, false, /* NOP */);
parent.SetBIsCombatActionAllowed(true);
parent.SetBehaviorVariable('test_ciri_replacer', 1.000000, /* NO
P */);
parent.LockEntryFunction(false);
BuildComboPlayer();
ProcessStartupAction(startupAction);
CombatSteelLoop();
/* NOP */;
}
public entry function CombatSteelDone(nextStateName : CName){
if (nextStateName != 'AimThrow' && nextStateName != 'CombatSilve
r' && nextStateName != 'CombatFists'){
parent.SetBehaviorVariable('playerCombatStance', 0, /* N
OP */);
}
/* NOP */;
}
private latent function CombatSteelLoop(){
while (true){
Sleep(0.500000);
}
/* NOP */;
}
public final function HACK_ExternalCombatComboUpdate(timeDelta : Float){
InteralCombatComboUpdate(timeDelta);
/* NOP */;
}
}
import struct CR4FinisherDLC{
//NULL type for woundName
//NULL type for finisherSide
//NULL type for finisherAnimName
//NULL type for rightCameraAnimName
//NULL type for backCameraAnimName
//NULL type for leftCameraAnimName
//NULL type for frontCameraAnimName
import public function IsFinisherForAnim(eventAnimInfo : SAnimationEvent
AnimInfo) : Bool;
}
import abstract class CVegetationBrushFactory{
}

import abstract class CR4EntityExternalAppearanceDLC{


}
import abstract class SFoliageInstanceStatistics{
}
import abstract class CAnimationBufferMultipart{
}
import abstract class CParticleComponentCooked{
}
state CStoryScenePlayerStateGameplay in CStoryScenePlayer extends CScriptableSta
te{
public function OnBlockingSceneStarted(scene : CStoryScene) : Bool{
parent.OnBlockingSceneStarted(scene);
parent.PushState('Blocking');
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
if (prevStateName == 'Blocking'){
theSound.LeaveGameState(theSound.GetCurrentGameState());
} else if (prevStateName == 'Cutscene'){
theSound.LeaveGameState(10);
} else if (prevStateName == 'Movie'){
theSound.LeaveGameState(13);
}
/* NOP */;
}
}
state CStoryScenePlayerStateBlocking in CStoryScenePlayer extends CScriptableSta
te{
public function OnCutsceneStarted() : Bool{
parent.PushState('Cutscene');
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
parent.OnBlockingSceneEnded(output);
parent.PopState(false);
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
if (theGame.envMgr.IsNight()){
theSound.EnterGameState(9);
} else {
theSound.EnterGameState(8);
}
if (theGame.GetGameplayConfigBoolValue('enableSceneRewind')){
theInput.RegisterListener(this, 'OnDbgRestartSection', '
SCN_DBG_RestartSection');
theInput.RegisterListener(this, 'OnDbgRestartScene', 'SC
N_DBG_RestartScene');
}
/* NOP */;
}
public function OnDbgRestartSection(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */) && theInput.GetLastActivationT
ime(action.aName) < 0.300000){
parent.RestartSection();

}
/* NOP */;
}
public function OnDbgRestartScene(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
parent.RestartScene();
}
/* NOP */;
}
}
state CStoryScenePlayerStateCutscene in CStoryScenePlayer extends CScriptableSta
te{
public function OnEnterState(prevStateName : CName) : Bool{
theSound.EnterGameState(10);
/* NOP */;
}
public function OnCutsceneEnded() : Bool{
parent.PopState(false);
/* NOP */;
}
}
state CStoryScenePlayerStateMovie in CStoryScenePlayer extends CScriptableState{
public function OnEnterSate(prevStateName : CName) : Bool{
theSound.EnterGameState(13);
/* NOP */;
}
public function OnMovieEnded() : Bool{
parent.PopState(false);
/* NOP */;
}
}
import abstract class CCommonGameResource{
}
import abstract class CCommonGame{
public var tooltipSettings :
import public final function
ing, mapPinName : CName);
import public final function
tring, position : Vector, rotation :
import public final function
import public final function
import public final function
import public final function
me, names : array<CName>, priorities
import public final function
me) : Bool;
import public final function
import public final function
;
import public final function
ay<CName>;
import public final function
erAccessor;
import public final function
yContext : SExplorationQueryContext)
import public final function

C2dArray;
ScheduleWorldChangeToMapPin(worldPath : Str
ScheduleWorldChangeToPosition(worldPath : S
EulerAngles);
EnableSubtitles(enable : Bool);
AreSubtitlesEnabled() : Bool;
GetReactionsMgr() : CReactionsManager;
GetIngredientCategoryElements(catName : CNa
: array<Int32>);
IsIngredientCategorySpecified(catName : CNa
GetIngredientCathegories() : array<CName>;
GetSetItems(setName : CName) : array<CName>
GetItemSetAbilities(itemName : CName) : arr
GetDefinitionsManager() : CDefinitionsManag
QueryExplorationSync(entity : CEntity, quer
: SExplorationQueryToken;
QueryExplorationFromObjectSync(entity : CEn

tity, object : CEntity, queryContext


ueryToken;
import public final function
p : CName) : EAIAttitude;
import public final function
p : CName, attitude : EAIAttitude) :
import public final function
rd) : Bool;
import public final function
import public final function
import public final function
import public final function
nfo>) : Bool;
import public final function
Bool;
import public final function
gameInfo) : String;
import public final function
meInfo>) : Bool;
import public final function
);
import public final function
import public final function
32;
import public final function
Int32, info : SSavegameInfo) : Bool;
import public final function
y<CName>);
import public final function
;
import public final function
import public final function
import public final function
;
import public final function
import public final function
import public final function
g) : Bool;
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
NPC>);
import public final function
import public final function
import public final function
CActor>);
import public final function
import public final function
import public final function
difier : IEntityStateChangeRequest);
import public final function
t32, unique : Bool, allowCheckpoints
import public final function
import public final function
import public final function
import public final function

: SExplorationQueryContext) : SExplorationQ
GetGlobalAttitude(srcGroup : CName, dstGrou
SetGlobalAttitude(srcGroup : CName, dstGrou
Bool;
GetReward(rewardName : CName, rewrd : SRewa
LoadLastGameInit(suppressVideo : Bool);
LoadGameInit(info : SSavegameInfo);
GetLoadGameProgress() : ELoadGameResult;
ListSavedGames(fileNames : array<SSavegameI
ImportSave(savegameInfo : SSavegameInfo) :
GetDisplayNameForSavedGame(savegame : SSave
ListW2SavedGames(savedGames : array<SSavega
SaveGame(type : ESaveGameType, slot : Int32
DeleteSavedGame(savegame : SSavegameInfo);
GetNumSaveSlots(type : ESaveGameType) : Int
GetSaveInSlot(type : ESaveGameType, slot :
GetContentRequiredByLastSave(content : arra
RequestScreenshotData(save : SSavegameInfo)
IsScreenshotDataReady() : Bool;
FreeScreenshotData();
ShouldShowSaveCompatibilityWarning() : Bool
CenterMouse();
MoveMouseTo(xpos : Float, ypos : Float);
RequestNewGame(gameResourceFilename : Strin
RequestEndGame();
RequestExit();
GetGameResourceList() : array<String>;
GetGameRelease() : String;
GetCurrentLocale() : String;
GetNPCByTag(tag : CName) : CNewNPC;
GetNPCsByTag(tag : CName, npcs : array<CNew
GetAllNPCs(npcs : array<CNewNPC>);
GetActorByTag(tag : CName) : CActor;
GetActorsByTag(tag : CName, actors : array<
GetAPManager() : CActionPointManager;
GetStorySceneSystem() : CStorySceneSystem;
AddStateChangeRequest(entityTag : CName, mo
CreateNoSaveLock(reason : String, lock : In
: Bool);
ReleaseNoSaveLock(lock : Int32);
ReleaseNoSaveLockByName(lockName : String);
AreSavesLocked() : Bool;
GetGameLanguageId(audioLang : Int32, subtit

leLang : Int32);
import public final function GetGameLanguageName(audioLang : String, sub
titleLang : String);
import public final function GetGameLanguageIndex(audioLang : Int32, sub
titleLang : Int32);
import public final function GetAllAvailableLanguages(textLanguages : ar
ray<String>, speechLanguages : array<String>);
import public final function SwitchGameLanguageByIndex(audioLang : Int32
, subtitleLang : Int32);
import public final function ReloadLanguage();
import public final function IsGameTimePaused() : Bool;
import public final function IsInvertCameraX() : Bool;
import public final function IsInvertCameraY() : Bool;
import public final function SetInvertCameraX(invert : Bool);
import public final function SetInvertCameraY(invert : Bool);
import public final function SetInvertCameraXOnMouse(invert : Bool);
import public final function SetInvertCameraYOnMouse(invert : Bool);
import public final function IsCameraAutoRotX() : Bool;
import public final function IsCameraAutoRotY() : Bool;
import public final function SetCameraAutoRotX(flag : Bool);
import public final function SetCameraAutoRotY(flag : Bool);
import public final function ConfigSave();
import public final function AreSavesInitialized() : Bool;
import public final function ChangePlayer(playerTemplate : String, appea
rance : CName);
import public final function GetBehTreeReactionManager() : CBehTreeReact
ionManager;
import public final function ForceUIAnalog(value : Bool);
import public final function RequestMenu(menuName : CName, initData : IS
criptable);
import public final function CloseMenu(menuName : CName);
import public final function RequestPopup(popupName : CName, initData :
IScriptable);
import public final function ClosePopup(popupName : CName);
import public final function GetHud() : CHud;
import public final function GetInGameConfigWrapper() : CInGameConfigWra
pper;
import public final function GetCommunitySystem() : CCommunitySystem;
import public final function GetAttackRangeForEntity(sourceEntity : CEnt
ity, attackName : CName) : CAIAttackRange;
import public final function GiveReward(rewardName : CName, targetEntity
: CEntity);
import public final function ConvertToStrayActor(actor : CActor) : Bool;
import public final function CreateEntityAsync(createEntityHelper : CCre
ateEntityHelper, entityTemplate : CEntityTemplate, pos : Vector, rot : EulerAngl
es, useAppearancesFromIncludes : Bool, forceBehaviorPose : Bool, doNotAdjustPlac
ement : Bool, persistanceMode : EPersistanceMode, tagList : array<CName>) : Int3
2;
import public final function TestNoCreaturesOnLocation(pos : Vector, rad
ius : Float, ignoreActor : CActor) : Bool;
import public final function TestNoCreaturesOnLine(pos0 : Vector, pos1 :
Vector, lineWidth : Float, ignoreActor0 : CActor, ignoreActor1 : CActor, ignore
GhostCharacters : Bool) : Bool;
import public final function RequestAutoSave(reason : String, force : Bo
ol);
import public final function CalculateTimePlayed() : GameTime;
import public final function GetUIHorizontalPlusFrameScale() : Float;
import public final function GetDLCManager() : CDLCManager;
import public final function AreConfigResetInThisSession() : Bool;
import public final function HasShownConfigChangedMessage() : Bool;

import public final function SetHasShownConfigChangedMessage(value : Boo


l);
import
import
import
import
public
}

public final function GetApplicationVersion() : String;


public final function IsSoftwareCursor() : Bool;
public final function ShowHardwareCursor();
public final function HideHardwareCursor();
function OnBeforeWorldChange(out worldName : String) : Bool{

}
import struct CProjectileTrajectory{
protected editable var alarmRadius : Float;
public var victim : CGameplayEntity;
public var yrdenAlternate : W3YrdenEntity;
//NULL type for caster
//NULL type for bounceOfVelocityPreserve
//NULL type for radius
import public final function Init(caster : CEntity);
import public function ShootProjectileAtPosition(angle : Float, velocity
: Float, target : Vector, range : Float, collisionGroups : array<CName>);
import public function ShootProjectileAtNode(angle : Float, velocity : F
loat, target : CNode, range : Float, collisionGroups : array<CName>);
import public function ShootProjectileAtBone(angle : Float, velocity : F
loat, target : CEntity, targetBone : CName, range : Float, collisionGroups : arr
ay<CName>);
import public final function StopProjectile();
import public function ShootCakeProjectileAtPosition(cakeAngle : Float,
cakeHeight : Float, shootAngle : Float, velocity : Float, target : Vector, range
: Float, collisionGroups : array<CName>);
import public final function BounceOff(collisionNormal : Vector, colliis
onPosition : Vector);
import public final function IsBehindWall(testComponent : CComponent, co
llisionGroupsNames : array<CName>) : Bool;
import public final function SphereOverlapTest(radius : Float, collision
Groups : array<CName>);
import public final function IsStopped() : Bool;
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var beehive : CBeehiveEntity;
theGame.GetBehTreeReactionManager().CreateReactionEventCustomCen
ter(caster, 'Danger', 30, alarmRadius, 2, -1, true, true, pos);
if (collidingComponent){
beehive = (CBeehiveEntity)collidingComponent.GetEntity()
;
if (beehive && (CThrowable)this){
beehive.OnShotByProjectile();
}
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
ProcessProjectileRepulsion(pos, normal);
}
/* NOP */;
}
public function ProcessProjectileRepulsion(pos : Vector, normal : Vector
) : Bool{
if (victim.HasAbility('RepulseProjectiles')){
Init(victim);
bounceOfVelocityPreserve = 0.800000;
super.BounceOff(normal, pos);

return true;
}
return false;
/* NOP */;
}
public function SetVictim(entity : CGameplayEntity){
victim = entity;
/* NOP */;
}
public function OnRangeReached() : Bool{
}
public final function SetIsInYrdenAlternateRange(yrden : W3YrdenEntity){
yrdenAlternate = yrden;
/* NOP */;
}
public function OnProjectileShot(targetCurrentPosition : Vector, target
: CNode) : Bool{
var s : W3YrdenEntityStateYrdenShock;
if (yrdenAlternate){
s = (W3YrdenEntityStateYrdenShock)yrdenAlternate.GetCurr
entState();
if (s){
s.ShootDownProjectile(this);
}
}
/* NOP */;
}
}
statemachine class W3YrdenEntity extends W3SignEntity{
public editable var effects : array<SYrdenEffects>;
public editable var projTemplate : CEntityTemplate;
public editable var projDestroyFxEntTemplate : CEntityTemplate;
protected var ActorsInArea : array<CActor>;
protected var flyersInArea : array<CNewNPC>;
protected var trapDuration : Float;
protected var charges : Int32;
public function GetSignType() : ESignType{
return 1;
/* NOP */;
}
public function SkillUnequipped(skill : ESkill){
var i : Int32;
super.SkillUnequipped(skill);
if (skill == 47){
i = 0;
while (i < ActorsInArea.Size()){
ActorsInArea[i].RemoveBuff(49, /* NOP */, /* NOP
*/);
i += 1;
}
}
/* NOP */;
}
public function SkillEquipped(skill : ESkill){
var i : Int32;
var params : SCustomEffectParams;
super.SkillEquipped(skill);
if (skill == 47){
params.effectType = 49;

params.creator = owner.GetActor();
params.sourceName = "yrden_mode0";
params.isSignEffect = true;
i = 0;
while (i < ActorsInArea.Size()){
ActorsInArea[i].AddEffectCustom(params);
i += 1;
}
}
/* NOP */;
}
public function OnProcessSignEvent(eventName : CName) : Bool{
if (eventName == 'yrden_draw_ready'){
PlayEffect('yrden_cast', /* NOP */);
} else {
return super.OnProcessSignEvent(eventName);
}
return true;
/* NOP */;
}
public final function ClearActorsInArea(){
var i : Int32;
i = 0;
while (i < ActorsInArea.Size()){
ActorsInArea[i].SignalGameplayEventParamObject('LeavesYr
den', this);
i += 1;
}
ActorsInArea.Clear();
flyersInArea.Clear();
/* NOP */;
}
protected function GetSignStats(){
var chargesAtt : SAbilityAttributeValue;
var trapDurationAtt : SAbilityAttributeValue;
super.GetSignStats();
chargesAtt = owner.GetSkillAttributeValue(skillEnum, 'charge_cou
nt', false, true);
trapDurationAtt = owner.GetSkillAttributeValue(skillEnum, 'trap_
duration', false, true);
trapDurationAtt += owner.GetActor().GetTotalSignSpellPower(skill
Enum);
trapDurationAtt.valueMultiplicative -= 1;
charges = CalculateAttributeValue(chargesAtt, /* NOP */);
trapDuration = CalculateAttributeValue(trapDurationAtt, /* NOP *
/);
/* NOP */;
}
public function OnStarted() : Bool{
var player : CR4Player;
Attach(true, true);
player = (CR4Player)owner.GetActor();
if (player){
GetWitcherPlayer().FailFundamentalsFirstAchievementCondi
tion();
player.AddTimer('ResetPadBacklightColorTimer', 2, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
PlayEffect('cast_yrden', /* NOP */);
if (owner.ChangeAspect(this, 39)){

CacheActionBuffsFromSkill();
GotoState('YrdenChanneled', /* NOP */, /* NOP */);
} else {
GotoState('YrdenCast', /* NOP */, /* NOP */);
}
/* NOP */;
}
protected latent function Place(){
var trapPos : Vector;
var trapPosTest : Vector;
var trapPosResult : Vector;
var collisionNormal : Vector;
var rot : EulerAngles;
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
witcher.yrdenEntities.PushBack(this);
super.DisablePreviousYrdens();
Detach();
SleepOneFrame();
trapPos = GetWorldPosition();
trapPosTest = owner.GetActor().GetWorldPosition();
trapPosTest.Z -= 0.500000;
rot = GetWorldRotation();
rot.Pitch = 0;
rot.Roll = 0;
if (theGame.GetWorld().StaticTrace(trapPos, trapPosTest, trapPos
Result, collisionNormal, /* NOP */)){
trapPosResult.Z += 0.100000;
TeleportWithRotation(trapPosResult, rot);
} else {
TeleportWithRotation(trapPos, rot);
}
SleepOneFrame();
AddTimer('TimedCanceled', trapDuration, /* NOP */, /* NOP */, /*
NOP */, true, /* NOP */);
/* NOP */;
}
private final function DisablePreviousYrdens(){
var maxCount : Int32;
var i : Int32;
var size : Int32;
var currCount : Int32;
var isAlternate : Bool;
var witcher : W3PlayerWitcher;
isAlternate = IsAlternateCast();
witcher = GetWitcherPlayer();
size = witcher.yrdenEntities.Size();
maxCount = 1;
currCount = 0;
if (!isAlternate && owner.CanUseSkill(46) && owner.GetSkillLevel
(46) >= 2){
maxCount += 1;
}
i = size - 1;
while (i >= 0){
if (!witcher.yrdenEntities[i]){
witcher.yrdenEntities.Erase(i);
} else if (witcher.yrdenEntities[i].IsAlternateCast() ==
isAlternate){
currCount += 1;

if (currCount > maxCount){


witcher.yrdenEntities[i].OnSignAborted(t
rue);
}
}
i -= 1;
}
/* NOP */;
}
public timer function TimedCanceled(optional delta : Float, optional id
: Int32){
var i : Int32;
var areas : array<CComponent>;
CleanUp();
StopAllEffects();
areas = GetComponentsByClassName('CTriggerAreaComponent');
i = 0;
while (i < areas.Size()){
areas[i].SetEnabled(false);
i += 1;
}
i = 0;
while (i < ActorsInArea.Size()){
ActorsInArea[i].BlockAbility('Flying', false, /* NOP */)
;
i += 1;
}
super.ClearActorsInArea();
DestroyAfter(6);
/* NOP */;
}
protected function NotifyGameplayEntitiesInArea(componentName : CName){
var entities : array<CGameplayEntity>;
var triggerAreaComp : CTriggerAreaComponent;
var i : Int32;
var ownerActor : CActor;
ownerActor = owner.GetActor();
triggerAreaComp = (CTriggerAreaComponent)GetComponent(componentN
ame);
triggerAreaComp.GetGameplayEntitiesInArea(entities, 6.000000, /*
NOP */);
i = 0;
while (i < entities.Size()){
if (!(CActor)entities[i]){
entities[i].OnYrdenHit(ownerActor);
}
i += 1;
}
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags, selected : Bool) : Bool{
}
}
import abstract class CNewNPCStateIdle{
}
class DialogueMonsterBarganingSliderData extends DialogueSliderData{
public var baseValue : Int32;

public var anger : Float;


protected function GetContentRef() : String{
return "QuantityMonsterBarganingPopupRef";
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_accept", "enter-gamepad_A", 13
);
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
if (KeyCode == "enter-gamepad_A"){
if (dialogueRef.IsPopupOpened()){
dialogueRef.DialogueSliderDataPopupResult(curren
tValue, PopupRef);
ClosePopup();
}
}
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = super.GetGFxData(parentFlashValueStorage);
l_flashObject.SetMemberFlashInt("baseValue", baseValue);
l_flashObject.SetMemberFlashNumber("anger", anger);
return l_flashObject;
/* NOP */;
}
}
class BettingSliderData extends DialogueSliderData{
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = super.GetGFxData(parentFlashValueStorage);
l_flashObject.SetMemberFlashInt("playerMoney", thePlayer.GetMone
y());
l_flashObject.SetMemberFlashBool("displayMoneyIcon", true);
return l_flashObject;
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
if (KeyCode == "enter-gamepad_A"){
if (currentValue > thePlayer.GetMoney()){
theGame.GetGuiManager().ShowNotification(GetLocS
tringByKeyExt("panel_shop_notification_not_enough_money"), /* NOP */);
return;
}
dialogueRef.DialogueSliderDataPopupResult(currentValue,
/* NOP */);
ClosePopup();
}
/* NOP */;
}
}
import abstract class IEntityTargetingAction{
}

state CR4PlayerStateExploration in CR4Player extends CR4PlayerStateExtendedMovab


le{
private var wantsToSheatheWeapon : Bool;
private var m_lastUsedPCInput : Bool;
public var cachedPos : Vector;
public var constDamper : ConstDamper;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
theInput.SetContext(parent.GetExplorationInputContext());
parent.SetPlayerCombatStance(0, true);
theGame.GetGuiManager().DisableHudHoldIndicator();
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetSwimming(false);
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetDiving(false);
if (parent.GetCurrentMeleeWeaponType() == 1){
parent.SetBehaviorVariable('playerWeapon', 1, /* NOP */)
;
} else if (parent.GetCurrentMeleeWeaponType() == 2){
parent.SetBehaviorVariable('playerWeapon', 2, /* NOP */)
;
}
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 1);
ExplorationInit(prevStateName);
/* NOP */;
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.RemoveTimer('ResetStanceTimer', /* NOP */);
parent.RemoveTimer('ExplorationLoop', /* NOP */);
CameraCleanup();
(CMovingPhysicalAgentComponent)parent.GetMovingAgentComponent().
SetTerrainInfluence(0.400000);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnStateCanGoToCombat() : Bool{
return true;
/* NOP */;
}
public function OnStateCanUpdateExplorationSubstates() : Bool{
return true;
/* NOP */;
}
public final function NeedsToSheatheWeapon(sheatheWeapon : Bool){
wantsToSheatheWeapon = sheatheWeapon;
/* NOP */;
}
public entry function ExplorationInit(prevStateName : CName){
var stupidArray : array<CName>;
var comp : CMovingPhysicalAgentComponent;
stupidArray.PushBack('Gameplay');
parent.LockEntryFunction(true);
m_lastUsedPCInput = false;
parent.BlockAllActions('ExplorationInit', true, /* NOP */, true,
parent, /* NOP */, /* NOP */);
if (prevStateName == 'TraverseExploration' || prevStateName == '
PlayerDialogScene'){
parent.ActivateBehaviors(stupidArray);
} else {

parent.ActivateAndSyncBehaviors(stupidArray, /* NOP */);


}
parent.OnCombatActionEndComplete();
if (!parent.pcGamePlayInitialized){
parent.pcGamePlayInitialized = true;
parent.RaiseForceEvent('ForceIdle');
}
parent.BlockAllActions('ExplorationInit', false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
parent.UnblockAction(41, 'vehicle');
if (parent.IsInShallowWater()){
parent.SetBehaviorVariable('shallowWater', 1.000000, /*
NOP */);
}
parent.SetOrientationTarget(0);
parent.ClearCustomOrientationInfoStack();
parent.SetBIsInputAllowed(true, 'ExplorationInit');
parent.AddTimer('ResetStanceTimer', 1.000000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
parent.findMoveTargetDistMin = 10.000000;
InitCamera();
parent.LockEntryFunction(false);
while (!comp){
comp = (CMovingPhysicalAgentComponent)parent.GetMovingAg
entComponent();
}
comp.SetTerrainInfluence(0.000000);
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 1);
parent.AddTimer('ExplorationLoop', 0.010000, true, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function ExplorationLoop(optional time : Float, optional id
: Int32){
ProcessPlayerOrientation();
parent.SetBehaviorMimicVariable('gameplayMimicsMode', 1);
if (parent.IsThreatened()){
if (parent.moveTarget && VecDistance(parent.moveTarget.G
etWorldPosition(), parent.GetWorldPosition()) < parent.findMoveTargetDist){
parent.playerMode.UpdateCombatMode(/* NOP */);
}
}
/* NOP */;
}
public timer function ResetStanceTimer(optional time : Float, optional i
d : Int32){
if (parent.GetCombatIdleStance() == 0.000000){
if (!parent.IsInGuardedState()){
parent.SetCombatIdleStance(1.000000);
}
}
/* NOP */;
}
private function ProcessPlayerOrientation(){
var playerToTargetDist : Float;
var playerCurrCombatStance : EPlayerCombatStance;
var playerToTargetAngle : Float;
var customOrientationInfo : SCustomOrientationInfo;
var customOrientationTarget : EOrientationTarget;
if (parent.GetCustomOrientationTarget(customOrientationInfo)){

customOrientationTarget = customOrientationInfo.orientat
ionTarget;
} else {
customOrientationTarget = 5;
}
if (!parent.GetIsSprinting() && !virtual_parent.GetBIsCombatActi
onAllowed() && parent.GetTarget()){
parent.SetOrientationTarget(1);
} else if (customOrientationTarget == 5){
parent.SetOrientationTarget(0);
}
if (customOrientationTarget != 5){
parent.SetOrientationTarget(customOrientationTarget);
}
/* NOP */;
}
private function InitCamera(){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
if (camera){
camera.ChangePivotPositionController('Default');
camera.ChangePivotDistanceController('Default');
}
animation.animation = 'camera_exploration';
animation.priority = 0;
animation.blendIn = 0.000000;
animation.blendOut = 0.000000;
animation.weight = 0.500000;
animation.speed = 1.000000;
animation.loop = true;
animation.additive = true;
animation.reset = true;
/* NOP */;
}
private function CameraCleanup(){
if (theGame.GetGameCamera()){
theGame.GetGameCamera().StopAnimation('camera_exploratio
n');
}
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
if (super.OnGameCameraTick(moveData, dt)){
return true;
}
if (m_lastUsedPCInput != theInput.LastUsedPCInput()){
m_lastUsedPCInput = theInput.LastUsedPCInput();
if (m_lastUsedPCInput){
theGame.GetGameCamera().SetManualRotationHorTime
out(5);
theGame.GetGameCamera().SetManualRotationVerTime
out(3);
} else {
theGame.GetGameCamera().SetManualRotationHorTime
out(1.500000);
theGame.GetGameCamera().SetManualRotationVerTime
out(3);
}

}
switch(parent.GetPlayerAction()){
case 2:
UpdateCameraMeditation(moveData, dt);
break;
case 3:
UpdateCameraClueGround(moveData, dt);
break;
default:
if (parent.IsCameraLockedToTarget()){
UpdateCameraInterior(moveData, dt);
} else if (!thePlayer.interiorCamera && parent.IsInShall
owWater()){
return false;
} else if (parent.movementLockType == 1 || parent.moveme
ntLockType == 2){
if (parent.IsCombatMusicEnabled() || parent.GetP
layerMode().GetForceCombatMode()){
UpdateCameraInterior(moveData, dt);
} else {
parent.UpdateCameraInterior(moveData, dt
);
}
} else {
if (parent.IsSprintActionPressed()){
parent.wasRunning = false;
}
return false;
}
return true;
}
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var buff : CBaseGameplayEffect;
var angles : EulerAngles;
var playerVel : Float;
var tempVel : Float;
if (!constDamper){
constDamper = new ConstDamper in this;
constDamper.SetDamp(1.000000);
}
if (parent.rangedWeapon && parent.rangedWeapon.GetCurrentStateNa
me() != 'State_WeaponWait'){
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
}
buff = parent.GetCurrentlyAnimatedCS();
if (parent.IsInCombatAction() || buff && !parent.IsInCombat()){
parent.UpdateCameraCombatActionButNotInCombat(moveData,
dt);
}
playerVel = VecDistance(cachedPos, parent.GetWorldPosition()) /
dt;
cachedPos = parent.GetWorldPosition();
if (parent.rawPlayerSpeed <= 0){
constDamper.Reset();
}
playerVel = constDamper.UpdateAndGet(dt, playerVel);

if (playerVel < 0.500000 || parent.rawPlayerSpeed <= 0 && !paren


t.IsInCombatAction()){
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(moveDat
a.pivotRotationValue.Pitch, /* NOP */);
}
if (parent.playerMoveType >= 2 && parent.movementLockType == 0){
moveData.pivotDistanceController.SetDesiredDistance(2.85
0000, 0.500000);
angles = VecToRotation(parent.GetMovingAgentComponent().
GetVelocity());
if (AbsF(angles.Pitch) < 5.000000){
moveData.pivotRotationController.SetDesiredPitch
(-9.200000, /* NOP */);
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, moveData.cameraLocalSpaceOffset + Vector(0, 0, -0.
150000), 1.000000, dt);
}
parent.UpdateCameraSprint(moveData, dt);
super.OnGameCameraPostTick(moveData, dt);
/* NOP */;
}
public function OnGameCameraExplorationRotCtrlChange() : Bool{
if (parent.playerMoveType >= 2){
theGame.GetGameCamera().ChangePivotRotationController('E
xplorationRun');
return true;
} else if (parent.movementLockType == 0){
return parent.OnGameCameraExplorationRotCtrlChange();
}
return false;
/* NOP */;
}
private function UpdateCameraMeditation(moveData : SCameraMovementData,
timeDelta : Float){
moveData.pivotPositionController.offsetZ = 0.800000;
moveData.pivotPositionController.SetDesiredPosition(parent.GetWo
rldPosition(), /* NOP */);
moveData.pivotRotationController.SetDesiredHeading(parent.GetHea
ding() - 30.000000, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-2.000000, /* N
OP */);
moveData.pivotDistanceController.SetDesiredDistance(1.300000, /*
NOP */);
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(-0.500000, 0.000000, 0.000000), 1.000000, timeDelta
);
/* NOP */;
}
private function UpdateCameraClueGround(moveData : SCameraMovementData,
timeDelta : Float){
moveData.pivotPositionController.offsetZ = 1.000000;
moveData.pivotPositionController.SetDesiredPosition(parent.GetWo
rldPosition(), /* NOP */);
moveData.pivotRotationController.SetDesiredHeading(parent.GetHea
ding() + 50.000000, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-5.000000, /* N
OP */);

moveData.pivotDistanceController.SetDesiredDistance(1.800000, /*
NOP */);
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(0.700000, 0.000000, 0.000000), 1.000000, timeDelta)
;
/* NOP */;
}
public entry function Mount(vehicle : CVehicleComponent, mountType : EVe
hicleMountType){
vehicle.Mount(parent, mountType, 0);
/* NOP */;
}
public function OnReactToBeingHit(damageAction : W3DamageAction) : Bool{
var destHeading : Float;
var angleToRotate : Float;
var attacker : CActor;
if (parent.IsUsingVehicle() == false && damageAction.attacker){
destHeading = VecHeading(damageAction.attacker.GetWorldP
osition() - parent.GetWorldPosition());
angleToRotate = AngleDistance(destHeading, parent.GetHea
ding());
parent.SetBehaviorVariable('hitAngleToRotate', angleToRo
tate, /* NOP */);
attacker = (CActor)damageAction.attacker;
if (attacker && IsRequiredAttitudeBetween(parent, attack
er, true, /* NOP */, /* NOP */) && parent.IsThreat(attacker, /* NOP */)){
parent.playerMode.UpdateCombatMode(/* NOP */);
}
}
/* NOP */;
}
public function OnHit(damageData : W3DamageAction, attackType : CName, h
itAnimationPlayType : EActionHitAnim) : Bool{
virtual_parent.ReactToBeingHit(damageData, /* NOP */);
/* NOP */;
}
}
import abstract class IComponentTargetingAction{
}
import abstract class CAddFactPerformableAction{
}
import abstract class CEnableComponentsPerformableAction{
}
import abstract class CEnableEncounterAction{
}
import abstract class CPlayPropertyAnimationAction{
}
import abstract class SBaseStat{
}
import abstract class IEffectManagmentPerformableAction{
}
import abstract class CPlayEffectPerformableAction{

}
import abstract class CStopAllEffectsPerformableAction{
}
import abstract class CStopEffectPerformableAction{
}
import abstract class CActionPointActivationSwitcher{
}
import abstract class CEnabledDeniedAreaAction{
}
import abstract class CActionBroadcastEvent{
}
import struct CScriptedComponent{
}
import abstract class CGameWorld{
}
import abstract class IGameSystem{
}
import abstract class CAttitudeManager{
}
import abstract class CFactsDB{
}
import struct CInteractionsManager{
private var activeInteraction : CInteractionComponent;
public function CanProcessGuiInteractions(activator : CEntity) : Bool{
if (!(CPlayer)activator){
return false;
}
if (thePlayer.IsInAir() || !thePlayer.substateManager.CanInterac
t() || thePlayer.GetCurrentStateName() == 'Meditation'){
return false;
}
return true;
/* NOP */;
}
public function CanProcessInteractionInput(action : SInputAction) : Bool
{
var outSprintKeys : array<EInputKey>;
var outInteractionKeys : array<EInputKey>;
if (!activeInteraction || !(CR4ScriptedHud)theGame.GetHud().IsIn
teractionInCameraView(activeInteraction)){
return false;
}
if (theInput.LastUsedPCInput()){
return IsPressed(action, /* NOP */);
}
if (theInput.GetActionValue('GI_AxisLeftX') == 0.000000 && theIn
put.GetActionValue('GI_AxisLeftY') == 0.000000 || !thePlayer.IsActionAllowed(14)
){
return IsPressed(action, /* NOP */);

} else if (thePlayer.GetHowLongSprintButtonWasPressed() > 0.1200


00){
theInput.GetPadKeysForAction('Sprint', outSprintKeys);
theInput.GetPadKeysForAction(action.aName, outInteractio
nKeys);
if (outSprintKeys.Size() > 0 && outInteractionKeys.Size(
) > 0 && outSprintKeys[0] == outInteractionKeys[0]){
return false;
} else {
return IsPressed(action, /* NOP */);
}
} else {
return IsReleased(action, /* NOP */);
}
/* NOP */;
}
public function GetSelectionWeights(selectionWeights : STargetSelectionW
eights){
if (thePlayer.IsThreatened()){
selectionWeights.angleWeight = 0.000000;
selectionWeights.distanceWeight = 1.000000;
selectionWeights.distanceRingWeight = 0.000000;
} else {
selectionWeights.angleWeight = 0.400000;
selectionWeights.distanceWeight = 0.600000;
selectionWeights.distanceRingWeight = 0.000000;
}
/* NOP */;
}
public function GetSelectionData(selectionData : STargetSelectionData){
if (thePlayer.lastAxisInputIsMovement){
selectionData.headingVector = thePlayer.GetHeadingVector
();
} else {
selectionData.headingVector = theCamera.GetCameraDirecti
on();
}
selectionData.headingVector.Z = 0.000000;
selectionData.headingVector = VecNormalize2D(selectionData.headi
ngVector);
selectionData.softLockDistance = thePlayer.softLockDist;
/* NOP */;
}
public function GetBlockedActions(blockedActions : array<String>){
if (!thePlayer.IsActionAllowed(43)){
blockedActions.PushBack("Loot");
blockedActions.PushBack("Container");
blockedActions.PushBack("Take");
blockedActions.PushBack("GatherHerbs");
}
if ((W3ReplacerCiri)thePlayer){
blockedActions.PushBack("Ignite");
blockedActions.PushBack("Extinguish");
blockedActions.PushBack("FastTravel");
}
if (thePlayer.IsInCombatAction()){
blockedActions.PushBack("MountHorse");
}
/* NOP */;
}

public function OnGuiInteractionChanged(newInteraction : CInteractionCom


ponent) : Bool{
if (ShouldProcessInteractionTutorials()){
theGame.GetTutorialSystem().SetInteraction(newInteractio
n);
}
activeInteraction = newInteraction;
return true;
/* NOP */;
}
public function GetActiveInteraction() : CInteractionComponent{
return activeInteraction;
/* NOP */;
}
}
import struct CCreateEntityHelper{
import public function IsCreating() : Bool;
import public function Reset();
import public function GetCreatedEntity() : CEntity;
import public function SetPostAttachedCallback(caller : IScriptable, fun
cName : CName);
}
import struct CGameFastForwardSystem{
import public function BeginFastForward(dontSpawnHostilesClose : Bool, c
overWithBlackscreen : Bool);
import public function EndFastForward();
import public function AllowFastForwardSelfCompletion();
import public function RequestFastForwardShutdown(coverWithBlackscreen :
Bool);
}
import struct CDefinitionsManagerAccessor{
import public final function GetItemAbilitiesWithWeights(itemName : CNam
e, playerItem : Bool, abilities : array<CName>, weights : array<Float>, minAbili
ties : Int32, maxAbilities : Int32);
import public final function GetItemCategory(itemName : CName) : CName;
import public final function ItemHasTag(itemName : CName, tag : CName) :
Bool;
import public final function GetItemsWithTag(tag : CName) : array<CName>
;
import public final function GetItemEquipTemplate(itemName : CName) : St
ring;
import public final function GetUsableItemType(itemName : CName) : EUsab
leItemType;
import public final function TestWitchcraft();
import public final function ValidateLootDefinitions(listAllItemDefs : B
ool);
import public final function ValidateRecyclingParts(listAllItemDefs : Bo
ol);
import public final function ValidateCraftingDefinitions(listAllItemDefs
: Bool);
import public final function GetCustomDefinition(definition : CName) : S
CustomNode;
import public final function GetSubNodeByAttributeValueAsCName(node : SC
ustomNode, rootNodeName : CName, attributeName : CName, attributeValue : CName)
: Bool;
import public final function GetItemHoldSlot(itemName : CName, playerIte
m : Bool) : CName;

import public final function GetItemPrice(itemName : CName) : Int32;


import public final function GetItemUpgradeListName(itemName : CName, pl
ayerItem : Bool) : CName;
import public final function GetItemLocalisationKeyName(itemName : CName
) : String;
import public final function GetItemLocalisationKeyDesc(itemName : CName
) : String;
import public final function GetItemIconPath(itemName : CName) : String;
import public final function GetAttributeValueAsInt(node : SCustomNodeAt
tribute, val : Int32) : Bool;
import public final function GetAttributeValueAsFloat(node : SCustomNode
Attribute, val : Float) : Bool;
import public final function GetAttributeValueAsBool(node : SCustomNodeA
ttribute, val : Bool) : Bool;
import public final function GetAttributeValueAsString(node : SCustomNod
eAttribute) : String;
import public final function GetAttributeValueAsCName(node : SCustomNode
Attribute) : CName;
import public final function GetAttributeName(node : SCustomNodeAttribut
e) : CName;
import public final function GetAbilityTags(ability : CName, tags : arra
y<CName>);
import public final function GetAbilityAttributes(ability : CName, attri
b : array<CName>);
import public final function GetAbilityAttributeValue(abilityName : CNam
e, attributeName : CName, valMin : SAbilityAttributeValue, valMax : SAbilityAttr
ibuteValue);
import public final function GetAbilitiesAttributeValue(abilitiesNames :
array<CName>, attributeName : CName, valMin : SAbilityAttributeValue, valMax :
SAbilityAttributeValue, tags : array<CName>);
import public final function IsAbilityDefined(abilityName : CName) : Boo
l;
import public final function GetContainedAbilities(abilityName : CName,
abilities : array<CName>);
import public final function GetUniqueContainedAbilities(abilities : arr
ay<CName>, outAbilities : array<CName>);
import public final function AbilityHasTag(ability : CName, tag : CName)
: Bool;
import public final function GetCustomDefinitionSubNode(node : SCustomNo
de, subnode : CName) : SCustomNode;
import public final function FindAttributeIndex(node : SCustomNode, attN
ame : CName) : Int32;
import public final function GetCustomNodeAttributeValueString(node : SC
ustomNode, attName : CName, val : String) : Bool;
import public final function GetCustomNodeAttributeValueName(node : SCus
tomNode, attName : CName, val : CName) : Bool;
import public final function GetCustomNodeAttributeValueInt(node : SCust
omNode, attName : CName, val : Int32) : Bool;
import public final function GetCustomNodeAttributeValueBool(node : SCus
tomNode, attName : CName, val : Bool) : Bool;
import public final function GetCustomNodeAttributeValueFloat(node : SCu
stomNode, attName : CName, val : Float) : Bool;
public function GetItemAttributeValueNoRandom(itemName : CName, playerIt
em : Bool, attributeName : CName, min : SAbilityAttributeValue, max : SAbilityAt
tributeValue){
var abs : array<CName>;
var temp : array<Float>;
var tempInt : Int32;
super.GetItemAbilitiesWithWeights(itemName, playerItem, abs, tem
p, tempInt, tempInt);

super.GetAbilitiesAttributeValue(abs, attributeName, min, max, /


* NOP */);
/* NOP */;
}
public function IsItemBolt(item : CName) : Bool{
return super.GetItemCategory(item) == 'bolt';
/* NOP */;
}
public function IsItemSingletonItem(itemName : CName) : Bool{
return super.ItemHasTag(itemName, theGame.params.TAG_ITEM_SINGLE
TON);
/* NOP */;
}
public function IsItemBomb(item : CName) : Bool{
return super.GetItemCategory(item) == 'petard';
/* NOP */;
}
public function IsItemPotion(item : CName) : Bool{
return super.ItemHasTag(item, 'Potion');
/* NOP */;
}
public function IsItemIngredient(item : CName) : Bool{
return super.ItemHasTag(item, 'AlchemyIngredient') || super.Item
HasTag(item, 'CraftingIngredient');
/* NOP */;
}
public function IsItemOil(item : CName) : Bool{
return super.ItemHasTag(item, 'SilverOil') || super.ItemHasTag(i
tem, 'SteelOil');
/* NOP */;
}
public function IsItemWeapon(item : CName) : Bool{
return super.ItemHasTag(item, 'Weapon') || super.ItemHasTag(item
, 'WeaponTab');
/* NOP */;
}
public function IsItemAnyArmor(item : CName) : Bool{
return super.ItemHasTag(item, theGame.params.TAG_ARMOR);
/* NOP */;
}
public function IsItemAlchemyItem(item : CName) : Bool{
return IsItemOil(item) || IsItemPotion(item) || IsItemBomb(item)
;
/* NOP */;
}
public function GetFilterTypeByItem(itemName : CName) : EInventoryFilter
Type{
var filterType : EInventoryFilterType;
if (super.ItemHasTag(itemName, 'Quest')){
return 5;
} else if (IsItemIngredient(itemName)){
return 4;
} else if (IsItemAlchemyItem(itemName)){
return 3;
} else if (IsItemAnyArmor(itemName)){
return 2;
} else if (IsItemWeapon(itemName)){
return 1;
} else {
return 6;

}
/* NOP */;
}
public final function ItemHasAttribute(itemName : CName, playerItem : Bo
ol, attributeName : CName) : Bool{
var min : Int32;
var max : Int32;
var abs : array<CName>;
var atts : array<CName>;
var w : array<Float>;
GetItemAbilitiesWithWeights(itemName, playerItem, abs, w, min, m
ax);
atts = GetAbilitiesAttributes(abs);
return atts.Contains(attributeName);
/* NOP */;
}
public final function IsRecipeForMutagenPotion(recipeName : CName) : Boo
l{
var main : SCustomNode;
var i : Int32;
var checkedRecipeName : CName;
var cookedItemName : CName;
main = GetCustomDefinition('alchemy_recipes');
i = 0;
while (i < main.subNodes.Size()){
if (GetCustomNodeAttributeValueName(main.subNodes[i], 'n
ame_name', checkedRecipeName) && checkedRecipeName == recipeName){
if (GetCustomNodeAttributeValueName(main.subNode
s[i], 'cookedItem_name', cookedItemName)){
if (ItemHasTag(cookedItemName, 'Mutagen'
) && GetItemCategory(cookedItemName) == 'potion'){
return true;
}
}
return false;
}
i += 1;
}
return false;
/* NOP */;
}
public final function AbilityHasAttribute(ability : CName, attribute : C
Name) : Bool{
var atts : array<CName>;
GetAbilityAttributes(ability, atts);
return atts.Contains(attribute);
/* NOP */;
}
public final function GetAbilitiesAttributes(abilities : array<CName>) :
array<CName>{
var i : Int32;
var k : Int32;
var atts : array<CName>;
var temp : array<CName>;
i = 0;
while (i < abilities.Size()){
GetAbilityAttributes(abilities[i], temp);
k = 0;
while (k < temp.Size()){
if (!atts.Contains(temp[k])){

atts.PushBack(temp[k]);
}
k += 1;
}
i += 1;
}
return atts;
/* NOP */;
}
public function GetAbilityDamages(abilityName : CName, damages : array<S
RawDamage>) : Int32{
var i : Int32;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var atts : array<CName>;
var dmg : SRawDamage;
damages.Clear();
super.GetAbilityAttributes(abilityName, atts);
i = 0;
while (i < atts.Size()){
if (IsDamageTypeNameValid(atts[i])){
dmg.dmgType = atts[i];
super.GetAbilityAttributeValue(abilityName, atts
[i], min, max);
dmg.dmgVal = CalculateAttributeValue(GetAttribut
eRandomizedValue(min, max), /* NOP */);
damages.PushBack(dmg);
}
i += 1;
}
return damages.Size();
/* NOP */;
}
public final function GetItemLevelFromName(itemName : CName) : Int32{
var itemCategory : CName;
var itemAttributes : array<SAbilityAttributeValue>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var isWitcherGear : Bool;
var isRelicGear : Bool;
var level : Int32;
isWitcherGear = false;
isRelicGear = false;
GetItemAttributeValueNoRandom(itemName, false, 'quality', min, m
ax);
if (min.valueAdditive == 5){
isWitcherGear = true;
}
if (min.valueAdditive == 4){
isRelicGear = true;
}
itemCategory = GetItemCategory(itemName);
switch(itemCategory){
case 'armor':
case 'boots':
case 'gloves':
case 'pants':
GetItemAttributeValueNoRandom(itemName, false, 'armor',
min, max);
itemAttributes.PushBack(max);

break;
case 'silversword':
GetItemAttributeValueNoRandom(itemName, false, 'SilverDa
mage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Bludgeon
ingDamage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'RendingD
amage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Elementa
lDamage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'FireDama
ge', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Piercing
Damage', min, max);
itemAttributes.PushBack(max);
break;
case 'steelsword':
GetItemAttributeValueNoRandom(itemName, false, 'Slashing
Damage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Bludgeon
ingDamage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'RendingD
amage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Elementa
lDamage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'FireDama
ge', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'SilverDa
mage', min, max);
itemAttributes.PushBack(max);
GetItemAttributeValueNoRandom(itemName, false, 'Piercing
Damage', min, max);
itemAttributes.PushBack(max);
break;
case 'crossbow':
GetItemAttributeValueNoRandom(itemName, false, 'attack_p
ower', min, max);
itemAttributes.PushBack(max);
break;
default:
break;
}
level = theGame.params.GetItemLevel(itemCategory, itemAttributes
, itemName);
if (isWitcherGear){
level = level - 2;
}
if (isRelicGear){
level = level - 1;
}

if (level < 1){


level = 1;
}
return level;
/* NOP */;
}
}
import abstract class CGameplayDLCMounterScripted{
}
import abstract class IBoidLairEntity{
//NULL type for spawnLimit
}
import abstract class CSwarmLairEntity{
import public function Disable(disable : Bool);
}
import struct CBoidPointOfInterestComponentScript{
public function OnUsed(count : Int32, deltaTime : Float){
}
}
import abstract class SGameplayEventParamInt{
}
import abstract class SGameplayEventParamFloat{
}
import abstract class SGameplayEventParamCName{
}
import abstract class CBoidActivationTriggerComponent{
}
import abstract class CBoidAreaComponent{
}
class CFocusModeCombatCamera_CurveDamp_MC extends CObject{
public editable var distanceCurveName : CName;
public editable var yawCurveName : CName;
public editable var pitchCurveName : CName;
public editable var fovCurveName : CName;
public editable var desiredPitch : Float;
public editable var autoTimeUpdate : Bool;
protected var distanceDamper : CurveDamper;
protected var yawDamper : AngleCurveDamper;
protected var pitchDamper : AngleCurveDamper;
protected var fovDamper : CurveDamper;
protected var distanceStart : Float;
protected var pitchStart : Float;
protected var yawStart : Float;
protected var position : Vector;
protected var rotation : EulerAngles;
protected var timeScale : Float;
protected function ControllerUpdate(timeDelta : Float){
if (autoTimeUpdate){
timeDelta = theTimer.timeDeltaUnscaled;
InternalUpdate(timeDelta);

}
/* NOP */;
}
protected function ControllerRotate(hasYaw : Bool, angleYaw : Float, has
Pitch : Bool, anglePitch : Float){
}
protected function ControllerSetDesiredYaw(yaw : Float){
yawDamper.SetValue(yaw);
/* NOP */;
}
protected function ControllerSetDesiredPitch(pitch : Float){
pitchDamper.SetValue(desiredPitch);
/* NOP */;
}
protected function ControllerSetDesiredDistance(distance : Float){
distanceDamper.SetValue(distance);
/* NOP */;
}
protected function ControllerGetPosition(posOut : Vector){
posOut = position;
/* NOP */;
}
protected function ControllerGetRotation(rotOut : EulerAngles){
rotOut = rotation;
/* NOP */;
}
protected function ControllerGetDistance(distance : Float){
distance = distanceDamper.GetValue();
/* NOP */;
}
protected function ControllerSetRotation(rotation : EulerAngles){
pitchDamper.Init(rotation.Pitch, rotation.Pitch);
yawDamper.Init(rotation.Yaw, rotation.Yaw);
UpdatePositionAndRotation();
/* NOP */;
}
protected function ControllerSetDistance(distance : Float){
distanceDamper.Init(distance, distance);
UpdatePositionAndRotation();
/* NOP */;
}
protected function ControllerSetFov(inFov : Float){
if (fovDamper){
fovDamper.Init(inFov, inFov);
}
/* NOP */;
}
protected function ControllerGetFov(outFov : Float){
if (fovDamper){
outFov = fovDamper.GetValue();
}
/* NOP */;
}
public function ManualUpdate(timeDelta : Float){
InternalUpdate(timeDelta);
/* NOP */;
}
public function SetManualMode(flag : Bool){
autoTimeUpdate = flag;
/* NOP */;

}
public function SetTimeScale(scale : Float){
timeScale = scale;
/* NOP */;
}
public function IsInterpolating() : Bool{
return distanceDamper.IsRunning() || yawDamper.IsRunning() || pi
tchDamper.IsRunning();
/* NOP */;
}
public function GetProgress() : Float{
var pA : Float;
var pB : Float;
var pC : Float;
pA = distanceDamper.GetProgress();
pB = yawDamper.GetProgress();
pC = pitchDamper.GetProgress();
return pA + pB + pC / 3.000000;
/* NOP */;
}
public function ResetValues(yaw : Float, pitch : Float, distance : Float
){
yawDamper.ResetValue(yaw);
pitchDamper.ResetValue(pitch);
distanceDamper.ResetValue(distance);
/* NOP */;
}
public function ResetDistanceValue(distance : Float){
distanceDamper.ResetValue(distance);
/* NOP */;
}
protected function InternalUpdate(timeDelta : Float){
timeDelta *= timeScale;
distanceDamper.Update(timeDelta);
yawDamper.Update(timeDelta);
pitchDamper.Update(timeDelta);
fovDamper.Update(timeDelta);
UpdatePositionAndRotation();
/* NOP */;
}
protected function CheckDampers(){
var curveD : CCurve;
var curveY : CCurve;
var curveP : CCurve;
var curveF : CCurve;
if (!distanceDamper){
distanceDamper = new CurveDamper in this;
distanceDamper.SetCurve(curveD);
}
if (!yawDamper){
yawDamper = new AngleCurveDamper in this;
yawDamper.SetCurve(curveY);
}
if (!pitchDamper){
pitchDamper = new AngleCurveDamper in this;
pitchDamper.SetCurve(curveP);
}
if (!fovDamper){
fovDamper = new CurveDamper in this;
fovDamper.SetCurve(curveF);

}
/* NOP */;
}
protected function GetDistanceForUpdate() : Float{
return distanceDamper.GetValue();
/* NOP */;
}
protected function UpdatePositionAndRotation(){
var mat : Matrix;
var newDistance : Float;
var newYaw : Float;
var newPitch : Float;
newDistance = GetDistanceForUpdate();
newPitch = pitchDamper.GetValue();
newYaw = yawDamper.GetValue();
newPitch = AngleNormalize180(newPitch);
newYaw = AngleNormalize180(newYaw);
rotation.Pitch = newPitch;
rotation.Yaw = newYaw;
rotation.Roll = 0.000000;
position = RotForward(rotation) * -newDistance;
/* NOP */;
}
}
import abstract class CAIPresetParam{
}
class CFocusModeCombatCamera_CurveDamp_Rot_MC extends CFocusModeCombatCamera_Cur
veDamp_MC{
public editable var rollCurveName : CName;
public editable var posCurveName : CName;
protected var rollDamper : AngleCurveDamper;
protected var posDamper : CurveDamper3d;
protected function InternalUpdate(timeDelta : Float){
rollDamper.Update(timeDelta * timeScale);
posDamper.Update(timeDelta * timeScale);
super.InternalUpdate(timeDelta);
/* NOP */;
}
protected function CheckDampers(){
var curve : CCurve;
super.CheckDampers();
if (!rollDamper){
rollDamper = new AngleCurveDamper in this;
rollDamper.SetCurve(curve);
}
if (!posDamper){
posDamper = new CurveDamper3d in this;
posDamper.SetCurve(curve);
}
/* NOP */;
}
protected function UpdatePositionAndRotation(){
var newYaw : Float;
var newPitch : Float;
var newRoll : Float;
newPitch = pitchDamper.GetValue();
newYaw = yawDamper.GetValue();
newRoll = rollDamper.GetValue();

newPitch = AngleNormalize180(newPitch);
newYaw = AngleNormalize180(newYaw);
newRoll = AngleNormalize180(newRoll);
rotation.Pitch = newPitch;
rotation.Yaw = newYaw;
rotation.Roll = newRoll;
position = posDamper.GetValue();
/* NOP */;
}
}
import abstract class CGameplayWindComponent{
}
class CFocusModeCombatCamera_CurveDamp_PC extends CObject{
public editable var pivotCurveName : CName;
public editable var autoTimeUpdate : Bool;
public var pivotDamper : CurveDamper3d;
public var timeScale : Float;
protected function ControllerUpdate(timeDelta : Float){
if (autoTimeUpdate){
timeDelta = theTimer.timeDeltaUnscaled;
super.InternalUpdate(timeDelta);
}
/* NOP */;
}
protected function ControllerSetPosition(position : Vector){
}
protected function ControllerSetDesiredPosition(position : Vector){
pivotDamper.SetValue(position);
/* NOP */;
}
protected function ControllerGetPosition(position : Vector){
position = pivotDamper.GetValue();
/* NOP */;
}
public function ManualUpdate(timeDelta : Float){
super.InternalUpdate(timeDelta);
/* NOP */;
}
public function IsInterpolating() : Bool{
return pivotDamper.IsRunning();
/* NOP */;
}
public function ResetValue(pivot : Vector){
pivotDamper.ResetValue(pivot);
/* NOP */;
}
public function SetTimeScale(scale : Float){
timeScale = scale;
/* NOP */;
}
private final function InternalUpdate(timeDelta : Float){
pivotDamper.Update(timeScale * timeDelta);
/* NOP */;
}
private final function CheckDampers(){
var curveP : CCurve;
if (!pivotDamper){
pivotDamper = new CurveDamper3d in this;

pivotDamper.SetCurve(curveP);
}
/* NOP */;
}
}
import abstract class CEdWizardSavedAnswers{
}
abstract state W3PlayerWitcherStateMeditationBase in W3PlayerWitcher extends CR4
PlayerStateExtendedMovable{
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(-1.500000, 0.000000, 0.000000), 0.500000, dt);
return true;
/* NOP */;
}
public function StopRequested(out closeUI : Bool){
}
public function OnReactToBeingHit(damageAction : W3DamageAction) : Bool{
var ret : Bool;
var tox : W3Effect_Toxicity;
ret = virtual_parent.OnReactToBeingHit(damageAction);
tox = (W3Effect_Toxicity)damageAction.causer;
if (!tox){
StopRequested(true);
}
return ret;
/* NOP */;
}
}
import abstract class CActionAreaComponent{
}
import abstract class CActionAreaBlendActor{
}
import abstract class CVertexEditorEntity{
}
import abstract class CVertexComponent{
}
import struct CInteractionAreaComponent{
//NULL type for performScriptedTest
import public final function GetRangeMin() : Float;
import public final function GetRangeMax() : Float;
import public final function SetRanges(rangeMin : Float, rangeMax : Floa
t, height : Float);
import public final function SetRangeAngle(rangeAngle : Int32);
import public final function SetCheckLineOfSight(flag : Bool);
}
import abstract class CInteractionToComponentComponent{
}
import abstract class CInteractionTooltipComponent{
}

import abstract class STargetSelectionWeights{


//NULL type for angleWeight
//NULL type for distanceWeight
//NULL type for distanceRingWeight
}
import abstract class STargetSelectionData{
//NULL type for headingVector
//NULL type for softLockDistance
}
state CR4PlayerStateDismountHorse in CR4Player extends CPlayerStateDismountTheVe
hicle{
public var horseComp : W3HorseComponent;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
horseComp = (W3HorseComponent)vehicle;
parent.AddAnimEventCallback('SlideBack', 'OnAnimEvent_SlideBack'
);
ProcessDismountHorse();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var horseRiderSharedParams : CHorseRiderSharedParams;
thePlayer.RemoveBuffImmunity(53, 'HorseRidingBuffImmunity');
parent.RemoveTimer('CheckSwimmingOnDismount', /* NOP */);
parent.RemoveAnimEventCallback('SlideBack');
parent.EnableCollisions(true);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public cleanup function DismountCleanup(){
super.DismountCleanup();
parent.SignalGameplayEventParamInt('RidingManagerDismountHorse',
8 | 1024);
/* NOP */;
}
public entry function ProcessDismountHorse(){
var riderData : CAIStorageRiderData;
var weaponType : EPlayerWeapon;
var target : CActor;
var position : Vector;
riderData = thePlayer.GetRiderData();
parent.SetCleanupFunction('DismountCleanup');
parent.SignalGameplayEventParamInt('RidingManagerDismountHorse',
dismountType);
parent.AddTimer('CheckSwimmingOnDismount', 0.000000, true, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
SleepOneFrame();
if (dismountType == 2){
if (parent.rangedWeapon && parent.rangedWeapon.GetCurren
tStateName() != 'State_WeaponWait'){
parent.WaitForBehaviorNodeActivation('shakeOffSt
art', 0.500000);
parent.OnRangedForceHolster(true, true, /* NOP *
/);
}
parent.WaitForBehaviorNodeActivation('recoverStart', 3.0
00000);

target = (CActor)thePlayer.GetDisplayTarget();
if (target && thePlayer.IsInCombat()){
weaponType = thePlayer.GetMostConvenientMeleeWea
pon(target, true);
thePlayer.OnEquipMeleeWeapon(weaponType, false,
false);
}
} else {
parent.OnRangedForceHolster(true, true, /* NOP */);
theInput.SetContext(thePlayer.GetExplorationInputContext
());
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0
&& riderData.sharedParams.mountStatus == 3){
break;
}
if (riderData.ridingManagerMountError == true){
parent.PopState(/* NOP */);
break;
}
SleepOneFrame();
}
}
parent.ClearCleanupFunction();
parent.PopState(true);
/* NOP */;
}
public function OnAnimEvent_AllowFall(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
HACK_ActivatePhysicsRepresentation();
/* NOP */;
}
public function OnAnimEvent_SlideBack(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var pointToSlide : Vector;
var heading : Vector;
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
if (animEventType == 1){
pointToSlide = parent.GetWorldPosition();
heading = parent.GetHeadingVector();
pointToSlide -= heading * 1.000000;
movementAdjustor = parent.GetMovingAgentComponent().GetM
ovementAdjustor();
movementAdjustor.CancelAll();
ticket = movementAdjustor.CreateNewRequest('SlideBack');
movementAdjustor.BindToEventAnimInfo(ticket, animInfo, /
* NOP */);
movementAdjustor.ScaleAnimation(ticket, /* NOP */, /* NO
P */, /* NOP */);
movementAdjustor.SlideTo(ticket, pointToSlide);
movementAdjustor.Continuous(ticket);
}
/* NOP */;
}
public timer function CheckSwimmingOnDismount(optional dt : Float, optio
nal id : Int32){
var depth : Float;
var fallDist : Float;
var waterLevel : Float;

if (!thePlayer.IsSwimming() && thePlayer.IsAlive()){


depth = (CMovingPhysicalAgentComponent)parent.GetMovingA
gentComponent().GetSubmergeDepth();
if (depth < parent.ENTER_SWIMMING_WATER_LEVEL){
parent.RemoveTimer('CheckSwimmingOnDismount', /*
NOP */);
parent.GotoState('Swimming', /* NOP */, /* NOP *
/);
}
}
/* NOP */;
}
}
import abstract class SBTNodeResult{
}
import struct IBehTreeValueEnum{
}
import abstract class CBehTreeValList{
}
import abstract class CBehTreeValFloat{
}
import abstract class CBehTreeValBool{
}
import abstract class CBehTreeValInt{
}
import abstract class CBehTreeValVector{
}
import abstract class CBehTreeValTemplate{
}
import abstract class CBehTreeValFile{
}
import abstract class CBehTreeValString{
}
import abstract class CBehTreeValCName{
}
state CR4PlayerStateHorseRiding in CR4Player extends CR4PlayerStateUseGenericVeh
icle{
private var dismountRequest : Bool;
private var vehicleCombatMgr : W3HorseCombatManager;
private var meleeTicketRequest : Int32;
private var rangeTicketRequest : Int32;
private var scabbardsComp : CAnimatedComponent;
private var initCamera : Bool;
private var currDesiredDist : Float;
private var cameraManualRotationDisabled : Bool;
private var wasTrailCameraActive : Bool;
private var trailCameraTimeStamp : Float;
private var trailCameraCooldown : Float;

protected function Init(){


super.Init();
if (!vehicleCombatMgr){
vehicleCombatMgr = new W3HorseCombatManager in this;
}
vehicleCombatMgr.Setup(parent, vehicle);
vehicleCombatMgr.GotoStateAuto();
vehicle.SetCombatManager(vehicleCombatMgr);
initCamera = true;
CheckForWeapons();
ProcessHorseRiding();
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
/* NOP */;
ChangeTicketPool(true);
scabbardsComp = (CAnimatedComponent)parent.GetComponent("scabbar
ds_skeleton");
scabbardsComp.SetBehaviorVariable('onHorse', 0.500000);
thePlayer.SoundEvent("amb_g_speed_wind_start", 'head', /* NOP */
);
parent.findMoveTargetDistMin = 20.000000;
parent.AddTimer('EnableDynamicCanter', 0.500000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
parent.SetBehaviorVariable('playerRider', 1.000000, /* NOP */);
dismountRequest = false;
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var camera : CCustomCamera;
camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
camera.EnableManualControl(true);
cameraManualRotationDisabled = false;
if (nextStateName == 'PlayerDialogScene' || nextStateName == 'Np
cDialogScene'){
(W3HorseComponent)vehicle.OnStopTheVehicleInstant();
parent.SignalGameplayEventParamInt('RidingManagerDismoun
tHorse', 8 | 1024);
} else {
theGame.ActivateHorseCamera(false, 0.000000, /* NOP */);
}
ChangeTicketPool(false);
camera.fov = 60;
scabbardsComp.SetBehaviorVariable('onHorse', 0.000000);
thePlayer.SoundEvent("amb_g_speed_wind_stop", 'head', /* NOP */)
;
parent.findMoveTargetDistMin = 10.000000;
vehicleCombatMgr.Destroy();
dismountRequest = false;
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnCombatStart() : Bool{
parent.OnCombatStart();
parent.AddTimer('DrawWeaponIfNeeded', 0.000000, /* NOP */, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnCombatFinished() : Bool{

virtual_parent.OnCombatFinished();
parent.RemoveTimer('DrawWeaponIfNeeded', /* NOP */);
/* NOP */;
}
public function OnDismountActionScriptCallback() : Bool{
(W3HorseComponent)vehicle.OnHorseDismount();
/* NOP */;
}
public timer function DrawWeaponIfNeeded(optional dt : Float, optional i
d : Int32){
if (parent.IsInCombat()){
if (parent.GetTarget()){
vehicleCombatMgr.OnDrawWeaponRequest();
parent.RemoveTimer('DrawWeaponIfNeeded', /* NOP
*/);
}
} else {
parent.RemoveTimer('DrawWeaponIfNeeded', /* NOP */);
}
/* NOP */;
}
public timer function EnableDynamicCanter(optional dt : Float, optional
id : Int32){
var horseComp : W3HorseComponent;
horseComp = (W3HorseComponent)(CR4PlayerStateHorseRiding)thePlay
er.GetState('HorseRiding').vehicle;
horseComp.OnEnableCanter();
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
var target : CNode;
var dismountDirection : Float;
var angleDistance : Float;
target = damageAction.attacker;
if (target){
angleDistance = NodeToNodeAngleDistance(target, parent);
if (AbsF(angleDistance) < 50){
dismountDirection = 0.000000;
} else if (angleDistance <= -50){
dismountDirection = 1.000000;
} else {
dismountDirection = 2.000000;
}
} else {
dismountDirection = 0.000000;
}
parent.SetBehaviorVariable('dismountDirection', dismountDirectio
n, /* NOP */);
virtual_parent.OnDeath(damageAction);
parent.ClearCleanupFunction();
PlayerDied();
/* NOP */;
}
public entry function ProcessHorseRiding(){
parent.SetCleanupFunction('RidingCleanup');
LogAssert(vehicle, "HorseRiding::ProcessHorseRiding - vehicle is
null");
Sleep(0.100000);
while (!dismountRequest){
FindTarget();

parent.BreakPheromoneEffect();
Sleep(0.200000);
}
if (parent.IsAlive()){
parent.ClearCleanupFunction();
parent.GotoState('DismountHorse', true, /* NOP */);
}
/* NOP */;
}
public entry function PlayerDied(){
var playerHorseRiderSharedParams : CHorseRiderSharedParams;
parent.RaiseForceEvent('Death');
parent.BreakAttachment();
parent.WaitForBehaviorNodeDeactivation('dismountRagdollEnd', 0.5
00000);
parent.SetKinematic(false);
parent.EnableCollisions(true);
parent.EnableCharacterCollisions(true);
parent.RegisterCollisionEventsListener();
(W3HorseComponent)vehicle.OnDismountStarted(parent);
parent.GetRiderData().OnInstantDismount(parent);
playerHorseRiderSharedParams = parent.GetRiderData().sharedParam
s;
playerHorseRiderSharedParams.mountStatus = 3;
(W3HorseComponent)vehicle.OnDismountFinished(parent, 0);
parent.SetUsedVehicle(NULL);
/* NOP */;
}
public cleanup function RidingCleanup(){
vehicle.ToggleVehicleCamera(false);
parent.SignalGameplayEventParamInt('RidingManagerDismountHorse',
8 | 1024);
parent.EnableCharacterCollisions(true);
parent.RegisterCollisionEventsListener();
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
var camera : CCustomCamera;
if (!cameraManualRotationDisabled && parent.IsCameraLockedToTarg
et()){
camera = (CCustomCamera)theCamera.GetTopmostCameraObject
();
camera.EnableManualControl(false);
cameraManualRotationDisabled = true;
} else if (cameraManualRotationDisabled && !parent.IsCameraLocke
dToTarget()){
camera = (CCustomCamera)theCamera.GetTopmostCameraObject
();
camera.EnableManualControl(true);
cameraManualRotationDisabled = false;
}
parent.UpdateLookAtTarget();
return vehicleCombatMgr.OnGameCameraTick(moveData, dt);
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var camera : CCustomCamera;
var horseSpeed : Float;

var horseComp : W3HorseComponent;


var shouldStopCamera : Bool;
var angleDistanceBetweenCameraAndHorse : Float;
if (!parent.IsAlive()){
moveData.pivotDistanceController.SetDesiredDistance(4.00
0000, /* NOP */);
moveData.pivotPositionController.SetDesiredPosition(pare
nt.GetWorldPosition(), /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-40, /*
NOP */);
return true;
}
camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
if (super.OnGameCameraPostTick(moveData, dt)){
if (parent.IsCameraLockedToTarget()){
moveData.pivotDistanceController.SetDesiredDista
nce(3.500000, 3.000000);
currDesiredDist = 3.500000;
} else {
moveData.pivotDistanceController.SetDesiredDista
nce(2.200000, 3.000000);
currDesiredDist = 2.200000;
}
return true;
}
horseComp = (W3HorseComponent)vehicle;
if (vehicleCombatMgr.IsInSwordAttackCombatAction()){
moveData.pivotDistanceController.SetDesiredDistance(5.40
0000, /* NOP */);
currDesiredDist = 5.400000;
} else if (!horseComp.inCanter && !horseComp.inGallop && !horseC
omp.OnCheckHorseJump()){
moveData.pivotDistanceController.SetDesiredDistance(2.40
0000, /* NOP */);
currDesiredDist = 2.400000;
if (!horseComp.OnCheckHorseJump()){
moveData.pivotRotationController.SetDesiredPitch
(horseComp.GetCurrentPitch() - 10, /* NOP */);
}
} else if (horseComp.inCanter && !horseComp.OnCheckHorseJump()){
moveData.pivotDistanceController.SetDesiredDistance(4.90
0000, /* NOP */);
currDesiredDist = 4.900000;
} else if (horseComp.inGallop && !horseComp.OnCheckHorseJump()){
moveData.pivotDistanceController.SetDesiredDistance(4.10
0000, /* NOP */);
currDesiredDist = 4.100000;
}
if (horseComp.OnCheckHorseJump()){
moveData.pivotDistanceController.SetDesiredDistance(curr
DesiredDist, /* NOP */);
} else {
moveData.pivotRotationController.SetDesiredPitch(horseCo
mp.GetCurrentPitch() - 10, /* NOP */);
}
if (vehicleCombatMgr.IsInSwordAttackCombatAction() || horseComp.
inCanter){
shouldStopCamera = false;
} else {
shouldStopCamera = false;

}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(0, 0, 0), 0.300000, dt);
if (horseComp.cameraMode == 1){
if (!camera.IsManualControledHor() && horseComp.inputApp
lied){
if (!horseComp.inCanter && !horseComp.inGallop &
& !vehicleCombatMgr.IsInSwordAttackCombatAction()){
if (trailCameraTimeStamp + trailCameraCo
oldown > theGame.GetEngineTimeAsSeconds()){
parent.OnGameCameraPostTick(move
Data, dt);
return shouldStopCamera;
} else if (trailCameraTimeStamp + trailC
ameraCooldown < theGame.GetEngineTimeAsSeconds() && wasTrailCameraActive){
moveData.pivotRotationVelocity.Y
aw = 0.000000;
wasTrailCameraActive = false;
}
angleDistanceBetweenCameraAndHorse = Abs
F(AngleDistance(VecHeading(theCamera.GetCameraDirection()), parent.GetHeading())
);
if (angleDistanceBetweenCameraAndHorse <
30.000000){
moveData.pivotRotationController
.SetDesiredHeading(parent.GetHeading(), 0.500000);
} else if (angleDistanceBetweenCameraAnd
Horse < 90.000000){
moveData.pivotRotationController
.SetDesiredHeading(parent.GetHeading(), 0.350000);
} else {
moveData.pivotRotationController
.SetDesiredHeading(parent.GetHeading(), 0.200000);
}
parent.OnGameCameraPostTick(moveData, dt
);
return true;
} else {
wasTrailCameraActive = true;
trailCameraTimeStamp = theGame.GetEngine
TimeAsSeconds();
}
} else if (wasTrailCameraActive){
moveData.pivotRotationVelocity.Yaw = 0.000000;
wasTrailCameraActive = false;
}
}
parent.OnGameCameraPostTick(moveData, dt);
return shouldStopCamera;
/* NOP */;
}
private function CheckForWeapons(){
if (parent.GetCurrentMeleeWeaponType() == 1 || parent.GetCurrent
MeleeWeaponType() == 2){
OnDrawWeaponStart();
}
/* NOP */;
}
public function ChangeTicketPool(apply : Bool){
var combatData : CCombatDataComponent;

combatData = parent.GetCombatDataComponent();
if (apply){
if (meleeTicketRequest == -1){
meleeTicketRequest = combatData.TicketSourceOver
rideRequest('TICKET_Melee', 400, 0.000000);
}
if (rangeTicketRequest == -1){
rangeTicketRequest = combatData.TicketSourceOver
rideRequest('TICKET_Range', 100, 0.000000);
}
} else {
if (meleeTicketRequest != -1 && combatData.TicketSourceC
learRequest('TICKET_Melee', meleeTicketRequest)){
meleeTicketRequest = -1;
}
if (rangeTicketRequest != -1 && combatData.TicketSourceC
learRequest('TICKET_Range', rangeTicketRequest)){
rangeTicketRequest = -1;
}
}
/* NOP */;
}
public function DismountVehicle(){
dismountRequest = true;
/* NOP */;
}
private function HorseHit(){
var action : W3DamageAction;
var targets : array<CActor>;
var victims : array<CActor>;
var attackpoint : Vector;
var size : Int32;
var i : Int32;
parent.GetVisibleEnemies(targets);
attackpoint = parent.GetWorldPosition() + parent.GetWorldForward
() * 1.500000;
size = targets.Size();
i = 0;
while (i < size){
if (VecLengthSquared(targets[i].GetWorldPosition() - att
ackpoint) < 1.000000){
victims.PushBack(targets[i]);
}
i += 1;
}
if (victims.Size() > 0){
action = new W3DamageAction in this;
action.Initialize(parent, victims[0], vehicle, parent.Ge
tName(), 2, 0, true, false, false, false, /* NOP */, /* NOP */, /* NOP */, /* NO
P */);
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING,
50.000000);
theGame.damageMgr.ProcessAction(action);
delete action;
}
/* NOP */;
}
public function OnAnimEvent_ActionBlend(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){

parent.SetBIsCombatActionAllowed(true);
}
virtual_parent.OnAnimEvent_ActionBlend(animEventName, animEventT
ype, animInfo);
/* NOP */;
}
public function OnAnimEvent_Sign(animEventName : CName, animEventType :
EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
vehicleCombatMgr.OnProcessAnimEvent(animEventName);
/* NOP */;
}
public function OnAnimEvent_Throwable(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
vehicleCombatMgr.OnProcessAnimEvent(animEventName);
/* NOP */;
}
public function OnDrawWeaponStart() : Bool{
parent.SetBehaviorVariable('isHoldingWeaponR', 1.000000, true);
parent.SetBehaviorVariable('swordAdditiveBlendWeight', 1.000000,
/* NOP */);
/* NOP */;
}
public function OnHolsterWeaponStart() : Bool{
parent.SetBehaviorVariable('isHoldingWeaponR', 0.000000, true);
parent.SetBehaviorVariable('swordAdditiveBlendWeight', 0.000000,
/* NOP */);
/* NOP */;
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
virtual_parent.OnTakeDamage(action);
/* NOP */;
}
public function OnRaiseSignEvent() : Bool{
return vehicleCombatMgr.OnRaiseSignEvent();
/* NOP */;
}
public function OnProcessCastingOrientation(isContinueCasting : Bool) :
Bool{
}
}
import abstract class CBehTreeValRes{
}
import abstract class CBehTreeValEntityHandle{
}
import abstract class CBehTreeValSteeringGraph{
}
import abstract class CBehTreeValFormation{
}
state W3VehicleCombatManagerStateNull in W3VehicleCombatManager extends CScripta
bleState{
public var rider : CR4Player;
public var horseComp : W3HorseComponent;
public function OnEnterState(prevStateName : CName) : Bool{
rider = parent.rider;
rider.vehicleCbtMgrAiming = false;

rider.playerAiming.StopAiming();
if (parent.isInCombatAction){
rider.OnCombatActionEnd();
parent.isInCombatAction = false;
}
horseComp = (W3HorseComponent)parent.vehicle;
rider.UnblockAction(13, 'BombThrow');
rider.UnblockAction(33, 'BombThrow');
ShouldEnterNextState();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.isInCombatAction = true;
/* NOP */;
}
public entry function ShouldEnterNextState(){
SleepOneFrame();
if (horseComp && !horseComp.IsFullyMounted()){
parent.GotoState('MountingInProgress', /* NOP */, /* NOP
*/);
} else if (horseComp && horseComp.IsInHorseAction()){
parent.GotoState('HorseAction', /* NOP */, /* NOP */);
} else if (!rider.GetWeaponHolster().IsMeleeWeaponReady()){
parent.GotoState('ChangeSwordState', /* NOP */, /* NOP *
/);
} else if (theInput.IsActionPressed('VehicleAttack')){
StartAttackAction();
} else if (theInput.IsActionPressed('VehicleItemAction')){
StartItemAction();
} else if (theInput.IsActionPressed('VehicleCastSign')){
StartCastSignAction();
}
/* NOP */;
}
public function OnItemAction(action : SInputAction) : Bool{
var itemId : SItemUniqueId;
var selectedItemId : SItemUniqueId;
var process : Bool;
if (horseComp && !horseComp.IsFullyMounted()){
parent.GotoState('MountingInProgress', /* NOP */, /* NOP
*/);
return false;
}
if (rider.IsOnBoat() && rider.GetCurrentStateName() != 'Sailing'
&& rider.GetCurrentStateName() != 'SailingPassive'){
return false;
}
if (rider.IsInAir() || rider.GetWeaponHolster().IsOnTheMiddleOfH
olstering()){
return false;
}
itemId = rider.GetSelectedItemId();
if (!rider.inv.IsIdValid(itemId)){
return false;
}
if (rider.inv.IsItemCrossbow(itemId)){
if (rider.IsActionAllowed(33)){
if (IsPressed(action, /* NOP */)){
if (rider.GetBIsInputAllowed()){
process = true;

}
} else if (rider.GetIsAimingCrossbow()){
process = true;
}
} else {
thePlayer.DisplayActionDisallowedHudMessage(28,
/* NOP */, /* NOP */, true, /* NOP */);
}
} else if (rider.inv.IsItemBomb(itemId)){
if (!rider.IsActionAllowed(13)){
thePlayer.DisplayActionDisallowedHudMessage(28,
/* NOP */, /* NOP */, true, /* NOP */);
return false;
}
if (rider.inv.SingletonItemGetAmmo(itemId) == 0){
return false;
}
if (IsPressed(action, /* NOP */)){
if (thePlayer.CanSetupCombatAction_Throw() && th
eInput.GetLastActivationTime(action.aName) < 0.300000){
process = true;
}
}
}
if (process && IsPressed(action, /* NOP */)){
StartItemAction();
}
/* NOP */;
}
public function OnCastSign(action : SInputAction) : Bool{
if (horseComp && !horseComp.IsFullyMounted()){
parent.GotoState('MountingInProgress', /* NOP */, /* NOP
*/);
return false;
}
if (IsPressed(action, /* NOP */)){
StartCastSignAction();
}
/* NOP */;
}
public function OnAttack(action : SInputAction) : Bool{
if (horseComp && !horseComp.IsFullyMounted()){
parent.GotoState('MountingInProgress', /* NOP */, /* NOP
*/);
return false;
}
if (IsPressed(action, /* NOP */)){
StartAttackAction();
}
/* NOP */;
}
public function OnAirBorn() : Bool{
parent.GotoState('InAir', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnHorseActionStart() : Bool{
parent.GotoState('HorseAction', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnMeleeWeaponNotReady() : Bool{

parent.GotoState('ChangeSwordState', /* NOP */, /* NOP */);


/* NOP */;
}
public function OnHitStart() : Bool{
parent.GotoState('BeingHit', /* NOP */, /* NOP */);
/* NOP */;
}
public function StartItemAction(){
if (rider.GetInventory().IsItemBomb(rider.GetSelectedItemId()) &
& rider.inv.SingletonItemGetAmmo(rider.GetSelectedItemId()) > 0){
parent.GotoState('ThrowBomb', /* NOP */, /* NOP */);
} else if (rider.GetInventory().IsItemCrossbow(rider.GetSelected
ItemId())){
rider.SetBehaviorVariable('actionType', 0, /* NOP */);
rider.rangedWeapon = (Crossbow)rider.GetInventory().GetI
temEntityUnsafe(rider.GetSelectedItemId());
rider.rangedWeapon.OnRangedWeaponPress();
rider.BlockAction(22, 'ShootingCrossbow', /* NOP */, /*
NOP */, /* NOP */);
rider.BlockAction(42, 'ShootingCrossbow', /* NOP */, /*
NOP */, /* NOP */);
parent.GotoState('ShootCrossbow', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function StartCastSignAction(){
parent.GotoState('CastSign', /* NOP */, /* NOP */);
/* NOP */;
}
public function StartAttackAction(){
if (rider.GetWeaponHolster().IsMeleeWeaponReady()){
if (thePlayer.IsWeaponHeld('steelsword') || thePlayer.Is
WeaponHeld('silversword')){
parent.GotoState('SwordAttack', /* NOP */, /* NO
P */);
} else {
DrawWeapon();
}
}
/* NOP */;
}
public function OnDrawWeaponRequest() : Bool{
DrawWeapon();
/* NOP */;
}
public function DrawWeapon(){
var weaponType : EPlayerWeapon;
if (GetWitcherPlayer() && rider.IsActionAllowed(1)){
if (rider.GetTarget()){
weaponType = rider.GetMostConvenientMeleeWeapon(
rider.GetTarget(), /* NOP */);
if (weaponType == 2 && GetWitcherPlayer().IsItem
EquippedByCategoryName('silversword')){
if (rider.GetCurrentMeleeWeaponType() !=
2){
rider.OnEquipMeleeWeapon(2, fals
e, false);
}
} else if (GetWitcherPlayer().IsItemEquippedByCa
tegoryName('steelsword')){

if (rider.GetCurrentMeleeWeaponType() !=
1){
rider.OnEquipMeleeWeapon(1, fals
e, false);
}
}
} else if (GetWitcherPlayer().IsItemEquippedByCategoryNa
me('steelsword')){
if (rider.GetCurrentMeleeWeaponType() != 1){
rider.OnEquipMeleeWeapon(1, false, false
);
}
} else if (GetWitcherPlayer().IsItemEquippedByCategoryNa
me('silversword')){
if (rider.GetCurrentMeleeWeaponType() != 2){
rider.OnEquipMeleeWeapon(2, false, false
);
}
}
} else if (rider.IsActionAllowed(1)){
if (rider.GetCurrentMeleeWeaponType() != 1){
rider.OnEquipMeleeWeapon(1, false, false);
}
}
/* NOP */;
}
}
import abstract class CBehTreeValEMoveType{
}
state CR4PlayerStateMountTheVehicle in CR4Player extends CPlayerStateBase{
protected var vehicle : CVehicleComponent;
protected var mountType : EMountType;
protected var vehicleSlot : EVehicleSlot;
private var camera : CCustomCamera;
public function OnEnterState(prevStateName : CName) : Bool{
var exceptions : array<EInputActionBlock>;
exceptions.PushBack(6);
exceptions.PushBack(22);
parent.BlockAllActions('MountVehicle', true, exceptions, true, /
* NOP */, /* NOP */, /* NOP */);
camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
super.OnEnterState(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
vehicle = NULL;
parent.RemoveTimer('UpdateTraverser', /* NOP */);
parent.BlockAllActions('MountVehicle', false, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public final function SetupState(v : CVehicleComponent, inMountType : EM
ountType, inVehicleSlot : EVehicleSlot){
LogAssert(!vehicle, "MountTheVehicle::SetupState, 'vehicle' is a
lready set");
vehicle = v;
mountType = inMountType;

vehicleSlot = inVehicleSlot;
/* NOP */;
}
public cleanup function MountCleanup(){
}
protected function OnMountingFailed(){
vehicle.OnDismountStarted(parent);
vehicle.OnDismountFinished(parent, thePlayer.GetRiderData().shar
edParams.vehicleSlot);
parent.ActionCancelAll();
parent.EnableCharacterCollisions(true);
parent.RegisterCollisionEventsListener();
/* NOP */;
}
public function ContinuedState(){
parent.PopState(true);
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var vehicleHeading : Float;
vehicleHeading = vehicle.GetHeading();
moveData.pivotRotationController.SetDesiredHeading(vehicleHeadin
g, 0.250000);
return true;
/* NOP */;
}
}
import abstract class CBehTreeValEExplorationType{
}
state CR4PlayerStateMountBoat in CR4Player extends CR4PlayerStateMountTheVehicle
{
public var boatComp : CBoatComponent;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
boatComp = (CBoatComponent)vehicle;
if (boatComp){
ProcessMountBoat();
} else {
LogAssert(vehicle, "MountBoat::ProcessMountTheVehicle, '
vehicle' is not set");
}
if (vehicleSlot == 1){
theInput.SetContext('BoatPassenger');
} else {
theInput.SetContext('Boat');
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
/* NOP */;
}
public cleanup function MountCleanup(){
super.MountCleanup();
parent.SignalGameplayEventParamInt('RidingManagerDismountBoat',
8 | 1024);
/* NOP */;

}
public entry function ProcessMountBoat(){
var mountError : Bool;
var riderData : CAIStorageRiderData;
mountError = false;
parent.SetCleanupFunction('MountCleanup');
SleepOneFrame();
if (mountType == 2){
parent.OnHitGround();
}
parent.EnableCharacterCollisions(false);
boatComp.ToggleVehicleCamera(true);
riderData = thePlayer.GetRiderData();
riderData.sharedParams.vehicleSlot = vehicleSlot;
EntityHandleSet(riderData.sharedParams.boat, boatComp.GetEntity(
));
parent.SignalGameplayEventParamInt('RidingManagerMountBoat', mou
ntType);
while (true){
if (riderData.GetRidingManagerCurrentTask() == 0 && ride
rData.sharedParams.mountStatus == 1){
break;
}
if (riderData.ridingManagerMountError == true){
parent.EnableCharacterCollisions(true);
parent.ClearCleanupFunction();
OnMountingFailed();
parent.PopState(/* NOP */);
break;
}
SleepOneFrame();
}
parent.ClearCleanupFunction();
theGame.ConvertToStrayActor((CActor)boatComp.GetEntity());
boatComp.IssueCommandToUseVehicle();
/* NOP */;
}
private function OnMountingFailed(){
super.OnMountingFailed();
/* NOP */;
}
private function GetMountFacing() : EPlayerBoatMountFacing{
var ret : EPlayerBoatMountFacing;
var angleToInteract : Float;
angleToInteract = AngleNormalize(180 + parent.GetHeading() - par
ent.GetUsedVehicle().GetHeading());
if (angleToInteract >= 45 && angleToInteract < 135){
ret = 4;
} else if (angleToInteract >= 135 && angleToInteract < 225){
ret = 2;
} else if (angleToInteract >= 225 && angleToInteract < 315){
ret = 3;
} else {
ret = 1;
}
return ret;
/* NOP */;
}
}

import abstract class IBehTreeNodeCompositeDefinition{


}
struct SFocusInteractionIcon{
var m_id : Int32;
var m_actionName : CName;
var m_entity : CEntity;
var m_screenPos : Vector;
var m_distanceSquared : Float;
var m_valid : Bool;
var m_canBeSeen : Bool;
var m_isSeen : Bool;
}
state CR4PlayerStateSailing in CR4Player extends CR4PlayerStateUseGenericVehicle
{
private var boatLogic : CBoatComponent;
private var remainingSlideDuration : Float;
private var vehicleCombatMgr : W3VehicleCombatManager;
private var dismountRequest : Bool;
private const var angleToSeatFromBack : Float;
private const var angleToSeatFromForward : Float;
private var angleDamper : Float;
private var offsetDamper : Float;
private var rudderDamper : Float;
private var cameraSide : Float;
protected function Init(){
super.Init();
if (!vehicleCombatMgr){
vehicleCombatMgr = new W3VehicleCombatManager in this;
}
parent.UnblockAction(33, 'DismountVehicle2');
dismountRequest = false;
vehicleCombatMgr.Setup(parent, vehicle);
vehicleCombatMgr.GotoStateAuto();
vehicle.SetCombatManager(vehicleCombatMgr);
parent.SetOrientationTarget(3);
boatLogic = (CBoatComponent)vehicle;
ProcessBoatSailing();
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
super.OnEnterState(prevStateName);
/* NOP */;
parent.SetBehaviorVariable('keepSpineUpright', 0.000000, /* NOP
*/);
commonMapManager.NotifyPlayerMountedBoat();
InitCamera();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
theInput.SetContext(parent.GetExplorationInputContext());
parent.SetBehaviorVariable('keepSpineUpright', 1.000000, /* NOP
*/);
commonMapManager.NotifyPlayerDismountedBoat();
super.OnLeaveState(nextStateName);

theInput.GetContext();
/* NOP */;
}
public entry function ProcessBoatSailing(){
var axis : Float;
parent.SetCleanupFunction('SailingCleanup');
LogAssert(vehicle, "Sailing::ProcessBoatSailing - vehicle is nul
l");
while (!dismountRequest){
FindTarget();
Sleep(0.200000);
}
parent.ClearCleanupFunction();
(CPlayerStateDismountBoat)parent.GetState('DismountBoat').SetupS
tate(boatLogic, 1);
(CPlayerStateDismountBoat)parent.GetState('DismountBoat').Dismou
ntFromPassenger(false);
parent.GotoState('DismountBoat', true, /* NOP */);
/* NOP */;
}
public cleanup function SailingCleanup(){
vehicle.ToggleVehicleCamera(false);
vehicle.OnDismountStarted(parent);
vehicle.OnDismountFinished(parent, thePlayer.GetRiderData().shar
edParams.vehicleSlot);
parent.EnableCollisions(true);
parent.RegisterCollisionEventsListener();
/* NOP */;
}
public function DismountVehicle(){
dismountRequest = true;
/* NOP */;
}
public function OnReactToBeingHit(damageAction : W3DamageAction) : Bool{
var boatHitDirection : Int32;
var angleDistance : Float;
var target : CNode;
target = damageAction.attacker;
if (target){
angleDistance = NodeToNodeAngleDistance(target, parent);
if (AbsF(angleDistance) < 45){
boatHitDirection = 0;
} else if (AbsF(angleDistance) > 135){
boatHitDirection = 1;
} else if (angleDistance > 45){
boatHitDirection = 3;
} else if (angleDistance < -45){
boatHitDirection = 2;
} else {
boatHitDirection = 0;
}
} else {
boatHitDirection = 0;
}
parent.SetBehaviorVariable('boatHitDirection', boatHitDirection,
/* NOP */);
virtual_parent.OnReactToBeingHit(damageAction);
/* NOP */;
}
private function InitCamera(){

camera.ChangePivotRotationController('Boat_RC');
camera.ChangePivotDistanceController('Boat_DC');
/* NOP */;
}
private final function GetGearRatio(gear : Int32) : Float{
if (gear == 1 || gear == -1){
return 1.000000;
}
if (gear == 2){
return 1.500000;
}
if (gear == 3){
return 2.200000;
}
return 0.000000;
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
var turnFactor : Float;
var velocityRatio : Float;
var sailCameraOffset : Float;
var fovDistPitch : Vector;
var offsetZ : Float;
var offsetUp : Vector;
var sailOffset : Float;
var boatPPC : CCustomCameraBoatPPC;
parent.UpdateLookAtTarget();
ShouldEnableBoatMusic();
turnFactor = theInput.GetActionValue('GI_AxisLeftX');
rudderDamper = rudderDamper + dt * 6.000000 * turnFactor - rudde
rDamper;
boatLogic.SetRudderDir(parent, rudderDamper);
if (vehicleCombatMgr.IsInCombatAction()){
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
} else {
moveData.pivotRotationController.SetDesiredHeading(paren
t.GetHeading() - rudderDamper * 20.000000, /* NOP */);
}
if (vehicleCombatMgr.OnGameCameraTick(moveData, dt)){
return true;
}
theGame.GetGameCamera().ChangePivotDistanceController('Boat_DC')
;
theGame.GetGameCamera().ChangePivotRotationController('Boat_RC')
;
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
if (boatLogic.GameCameraTick(fovDistPitch, offsetZ, sailOffset,
dt, false)){
boatPPC = (CCustomCameraBoatPPC)moveData.pivotPositionCo
ntroller;
if (boatPPC){
offsetUp = Vector(0.000000, 0.000000, offsetZ);
boatPPC.SetPivotOffset(offsetUp);

}
moveData.pivotRotationController.SetDesiredPitch(fovDist
Pitch.Z, /* NOP */);
moveData.pivotDistanceController.SetDesiredDistance(fovD
istPitch.Y, /* NOP */);
sailCameraOffset = boatLogic.GetSailTilt() * sailOffset;
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(sailCameraOffset, 0.000000, 0.000000), 0.50
0000, dt);
}
return true;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
if (super.OnGameCameraPostTick(moveData, dt)){
return true;
}
/* NOP */;
}
public function CanAccesFastTravel(target : W3FastTravelEntity) : Bool{
return target.canBeReachedByBoat;
/* NOP */;
}
}
import abstract class CBehTreeNodeScriptDecoratorDefinition{
}
import abstract class CBehTreeNodeScriptTerminalDefinition{
}
import abstract class CBehTreeNodeBaseRotateToTargetDefinition{
}
state CR4PlayerStateSailingPassive in CR4Player extends CR4PlayerStateUseGeneric
Vehicle{
private var boatLogic : CBoatComponent;
private var dismountRequest : Bool;
private var vehicleCombatMgr : W3VehicleCombatManager;
private var rudderDamper : Float;
protected function Init(){
super.Init();
boatLogic = (CBoatComponent)vehicle;
/* NOP */;
}
public function OnEnterState(prevStateName : CName) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
super.OnEnterState(prevStateName);
if (!vehicleCombatMgr){
vehicleCombatMgr = new W3VehicleCombatManager in this;
}
dismountRequest = false;
vehicleCombatMgr.Setup(parent, vehicle);
vehicleCombatMgr.GotoStateAuto();
vehicle.SetCombatManager(vehicleCombatMgr);
ProcessBoatSailingPassive();
theGame.GetGameCamera().SetAllowAutoRotation(false);
commonMapManager.NotifyPlayerMountedBoat();

/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
super.OnLeaveState(nextStateName);
theGame.GetGameCamera().SetAllowAutoRotation(true);
commonMapManager.NotifyPlayerDismountedBoat();
/* NOP */;
}
public entry function ProcessBoatSailingPassive(){
var axis : Float;
parent.EnableCollisions(false);
theSound.SoundEvent("boat_sail_temp_loop");
theSound.EnterGameState(14);
parent.CreateAttachment(boatLogic.GetEntity(), 'seat_passenger',
/* NOP */, /* NOP */);
while (!dismountRequest){
FindTarget();
Sleep(0.200000);
}
parent.ClearCleanupFunction();
(CPlayerStateDismountBoat)parent.GetState('DismountBoat').SetupS
tate(boatLogic, 1);
(CPlayerStateDismountBoat)parent.GetState('DismountBoat').Dismou
ntFromPassenger(true);
parent.GotoState('DismountBoat', true, /* NOP */);
/* NOP */;
}
public function DismountVehicle(){
dismountRequest = true;
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
var turnFactor : Float;
var velocityRatio : Float;
var sailCameraOffset : Float;
var fovDistPitch : Vector;
var offsetZ : Float;
var offsetUp : Vector;
var sailOffset : Float;
var boatPPC : CCustomCameraBoatPPC;
parent.UpdateLookAtTarget();
ShouldEnableBoatMusic();
rudderDamper = rudderDamper + dt * 6.000000 * turnFactor - rudde
rDamper;
boatLogic.SetRudderDir(parent, rudderDamper);
if (vehicleCombatMgr.IsInCombatAction()){
moveData.pivotRotationController.minPitch = -55.000000;
moveData.pivotRotationController.maxPitch = theGame.GetG
ameplayConfigFloatValue('debugA');
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
} else {
moveData.pivotRotationController.minPitch = -55.000000;
moveData.pivotRotationController.maxPitch = -3;
moveData.pivotRotationController.SetDesiredHeading(paren
t.GetHeading() - rudderDamper * 20.000000, /* NOP */);
}

if (vehicleCombatMgr.OnGameCameraTick(moveData, dt)){
return true;
}
theGame.GetGameCamera().ChangePivotDistanceController('Boat_DC')
;
theGame.GetGameCamera().ChangePivotRotationController('Boat_RC')
;
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
if (boatLogic.GameCameraTick(fovDistPitch, offsetZ, sailOffset,
dt, true)){
camera.fov = fovDistPitch.X;
boatPPC = (CCustomCameraBoatPPC)moveData.pivotPositionCo
ntroller;
if (boatPPC){
offsetUp = Vector(0.000000, 0.000000, offsetZ);
boatPPC.SetPivotOffset(offsetUp);
}
moveData.pivotRotationController.SetDesiredPitch(fovDist
Pitch.Z, /* NOP */);
moveData.pivotDistanceController.SetDesiredDistance(fovD
istPitch.Y, /* NOP */);
sailCameraOffset = boatLogic.GetSailTilt() * sailOffset;
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(sailCameraOffset, 0.000000, 0.000000), 0.50
0000, dt);
}
return true;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
if (super.OnGameCameraPostTick(moveData, dt)){
return true;
}
/* NOP */;
}
}
import abstract class CBehTreeNodeAtomicRotateToTargetDefinition{
}
import abstract class CBehTreeNodeFinishAnimationsDefinition{
}
import abstract class CBehTreeNodeBreakAnimationsDefinition{
}
import abstract class CBehTreeNodeAtomicMatchActionTargetRotationDefinition{
}
import abstract class CBehTreeNodeAtomicTeleportDefinition{
}
import abstract class CBehTreeNodeTeleportToActionTargetDefinition{
}

import abstract class SCurveDataEntry{


}
import abstract class CBehTreeNodeTeleportToActionTargetCheckPositionDefinition{
}
import abstract class CBehTreeNodeAtomicTeleportToActionPointDefinition{
}
import abstract class CBehTreeNodeAttachToCurveDefinition{
}
import abstract class CBehTreeNodeFlyOnCurveDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToActionTargetDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToWanderpointDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToCombatTargetDefinition{
}
state W3VehicleCombatManagerStateSwordAttack in W3VehicleCombatManager extends C
ScriptableState{
public var rider : CR4Player;
private var horizontalVal : Float;
private var speedMultCasuserId : Int32;
private var slowMoSpeedCurrVal : Float;
private var slowMoVelocityCurrVal : Float;
private var isSlowMoOn : Bool;
private const var ATTACK_TIMEOUT : Float;
private const var ATTACK_STAMINA_PER_SEC : Float;
private const var ATTACK_COOLDOWN : Float;
private const var CHANGE_SIDE_THRESHOLD : Float;
private var attackInProgress : Bool;
public const var FIRST_SWEEP_DELAY : Float;
public const var SECOND_SWEEP_DELAY : Float;
public const var BASE_DAMAGE : Float;
public function OnEnterState(prevStateName : CName) : Bool{
parent.vehicle.OnCombatAction(3);
rider = parent.rider;
rider.AddAbility('ForceDismemberment', /* NOP */);
rider.BlockAction(1, 'OnHorseCombatAction', /* NOP */, /* NOP */
, /* NOP */);
if ((W3ReplacerCiri)rider){
rider.SetBehaviorVariable('ciriReinsNoOffset', 1.000000,
true);
}
slowMoSpeedCurrVal = 1.000000;
slowMoVelocityCurrVal = 0.000000;
InitAndBeginSwordAttack();
/* NOP */;
}
public function OnLeaveState(nexStateName : CName) : Bool{

attackInProgress = false;
rider.RemoveAbility('ForceDismemberment');
rider.UnblockAction(1, 'OnHorseCombatAction');
if ((W3ReplacerCiri)rider){
rider.SetBehaviorVariable('ciriReinsNoOffset', 0.000000,
true);
}
if (thePlayer.GetHorseCombatSlowMo()){
TurnOffSlowMo();
}
super.OnLeaveState(nexStateName);
/* NOP */;
}
public entry function InitAndBeginSwordAttack(){
rider.SetBehaviorVariable('attackRelease', 0.000000, /* NOP */);
ChooseInitialOrientation();
BeginSwordAttack();
parent.PopState(true);
/* NOP */;
}
private function ChooseInitialOrientation(){
var heading : Float;
var riderPos : Vector;
var targetPos : Vector;
var target : CActor;
riderPos = rider.GetWorldPosition();
target = rider.GetTarget();
if (target){
targetPos = target.GetWorldPosition();
heading = VecHeading(targetPos - riderPos);
horizontalVal = AngleDistance(rider.GetHeading(), headin
g) / 180.000000;
} else if (RandRange(100, /* NOP */) > 50){
horizontalVal = 1;
} else {
horizontalVal = -1;
}
if (horizontalVal > CHANGE_SIDE_THRESHOLD){
rider.SetBehaviorVariable('aimHorizontalSword', 0.000000
, /* NOP */);
} else if (horizontalVal < -CHANGE_SIDE_THRESHOLD){
rider.SetBehaviorVariable('aimHorizontalSword', 1.000000
, /* NOP */);
}
/* NOP */;
}
public latent function BeginSwordAttack(){
var res : Bool;
if (rider.GetBehaviorVariable('actionType', /* NOP */) != 3){
rider.SetBehaviorVariable('actionType', 3, /* NOP */);
rider.WaitForBehaviorNodeActivation('attackActionOn', 0.
500000);
}
rider.RaiseEvent('actionStart');
res = rider.WaitForBehaviorNodeActivation('ActionOn', 0.500000);
if (!res){
parent.PopState(true);
}
if (theInput.IsActionReleased('VehicleAttack')){
ChooseAttackHeight();

rider.SetBehaviorVariable('attackRelease', 1.000000, /*
NOP */);
attackInProgress = false;
DoAttack();
rider.WaitForBehaviorNodeActivation('ActionOff', 5.00000
0);
parent.PopState(true);
} else {
attackInProgress = true;
AdjustOrientationAndMaintainTimeout();
}
/* NOP */;
}
public latent function AdjustOrientationAndMaintainTimeout(){
var heading : Float;
var riderPos : Vector;
var targetPos : Vector;
var startTimeStamp : Float;
var frameTimeStamp : Float;
var target : CActor;
startTimeStamp = theGame.GetEngineTimeAsSeconds();
frameTimeStamp = startTimeStamp;
while (startTimeStamp + ATTACK_TIMEOUT >= theGame.GetEngineTimeA
sSeconds()){
if (thePlayer.GetHorseCombatSlowMo() && ShouldActivateSl
owMo()){
if (startTimeStamp + 0.100000 < theGame.GetEngin
eTimeAsSeconds()){
DampFloatSpring(slowMoSpeedCurrVal, slow
MoVelocityCurrVal, 0.300000, 0.100000, theGame.GetEngineTimeAsSeconds() - frameT
imeStamp);
TurnOnSlowMo();
}
} else {
TurnOffSlowMo();
}
riderPos = rider.GetWorldPosition();
target = rider.GetTarget();
if (target){
target.IsAttacked(true);
targetPos = target.GetWorldPosition();
heading = VecHeading(targetPos - riderPos);
horizontalVal = AngleDistance(rider.GetHeading()
, heading) / 180.000000;
}
rider.SetBehaviorVariable('aimHorizontal', horizontalVal
, /* NOP */);
if (horizontalVal > CHANGE_SIDE_THRESHOLD){
rider.SetBehaviorVariable('aimHorizontalSword',
0.000000, /* NOP */);
} else if (horizontalVal < -CHANGE_SIDE_THRESHOLD){
rider.SetBehaviorVariable('aimHorizontalSword',
1.000000, /* NOP */);
}
frameTimeStamp = theGame.GetEngineTimeAsSeconds();
SleepOneFrame();
}
AbortAttack();
/* NOP */;
}

public entry function GoBackFromSlowMo(){


var frameTimeStamp : Float;
slowMoVelocityCurrVal = 0.000000;
frameTimeStamp = theGame.GetEngineTimeAsSeconds();
while (true){
DampFloatSpring(slowMoSpeedCurrVal, slowMoVelocityCurrVa
l, 1.000000, 0.050000, theGame.GetEngineTimeAsSeconds() - frameTimeStamp);
TurnOnSlowMo();
frameTimeStamp = theGame.GetEngineTimeAsSeconds();
SleepOneFrame();
if (slowMoSpeedCurrVal > 0.990000){
break;
}
}
rider.WaitForBehaviorNodeActivation('ActionOff', 1.000000);
parent.PopState(true);
/* NOP */;
}
public function OnAttack(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */) && attackInProgress && rider.G
etCurrentMeleeWeaponType() == 1 || rider.GetCurrentMeleeWeaponType() == 2){
if (CanPerformAttack()){
FinishAttack();
} else {
AbortAttack();
}
}
/* NOP */;
}
public function OnHorseActionStart() : Bool{
if (attackInProgress){
AbortAttack();
}
/* NOP */;
}
public function OnHitStart() : Bool{
if (attackInProgress){
AbortAttack();
}
/* NOP */;
}
public function OnDismountStarted() : Bool{
if (attackInProgress){
AbortAttack();
}
parent.OnDismountStarted();
/* NOP */;
}
public entry function AbortAttack(){
attackInProgress = false;
theInput.ForceDeactivateAction('VehicleAttack');
rider.SetBehaviorVariable('attackRelease', 2.000000, /* NOP */);
if (thePlayer.GetHorseCombatSlowMo() && isSlowMoOn){
GoBackFromSlowMo();
} else {
rider.WaitForBehaviorNodeActivation('ActionOff', 10.0000
00);
parent.PopState(true);
}
/* NOP */;

}
public entry function FinishAttack(){
ChooseAttackHeight();
rider.SetBehaviorVariable('attackRelease', 1.000000, /* NOP */);
if (rider == thePlayer){
thePlayer.SendAttackReactionEvent();
}
attackInProgress = false;
DoAttack();
if (thePlayer.GetHorseCombatSlowMo() && isSlowMoOn){
GoBackFromSlowMo();
} else {
rider.WaitForBehaviorNodeActivation('ActionOff', 5.00000
0);
parent.PopState(true);
}
/* NOP */;
}
public function CanPerformAttack() : Bool{
var currHorizontalVal : Float;
var entities : array<CGameplayEntity>;
var i : Int32;
var actor : CActor;
var npc : CNewNPC;
var horse : CActor;
var anyHostilesInRange : Bool;
var anyFriendliesInRange : Bool;
var attitude : EAIAttitude;
currHorizontalVal = rider.GetBehaviorVariable('aimHorizontal', /
* NOP */);
if (currHorizontalVal >= 0){
rider.GatherEntitiesInAttackRange(entities, 'horse_right
');
} else {
rider.GatherEntitiesInAttackRange(entities, 'horse_left'
);
}
horse = (CActor)parent.vehicle.GetEntity();
if (entities.Size() > 0){
i = 0;
while (i < entities.Size()){
actor = (CActor)entities[i];
if (actor == rider || actor == horse){
} else if (actor){
attitude = GetAttitudeBetween(rider, act
or);
npc = (CNewNPC)actor;
if (npc && npc.GetNPCType() == 3 && atti
tude != 2){
anyFriendliesInRange = true;
}
if (attitude == 0){
anyFriendliesInRange = true;
} else if (attitude == 2){
anyHostilesInRange = true;
}
}
i += 1;
}
}

if (!anyFriendliesInRange || anyHostilesInRange){
return true;
} else {
return false;
}
/* NOP */;
}
public function ChooseAttackHeight(){
var verticalVal : Float;
var riderPos : Vector;
var targetPos : Vector;
var target : CActor;
riderPos = rider.GetWorldPosition();
target = rider.GetTarget();
if (target){
targetPos = target.GetWorldPosition();
if (target.IsUsingHorse(/* NOP */)){
if (riderPos.Z < targetPos.Z + 0.300000){
verticalVal = 1.000000;
} else {
verticalVal = 0.000000;
}
} else if (riderPos.Z + 1.000000 < targetPos.Z){
verticalVal = 1.000000;
} else {
verticalVal = 0.000000;
}
} else {
verticalVal = 0.000000;
}
rider.SetBehaviorVariable('aimVertical', verticalVal, /* NOP */)
;
/* NOP */;
}
public latent function DoAttack(){
var horse : CNewNPC;
var speed : Float;
var currHorizontalVal : Float;
var entities : array<CGameplayEntity>;
var attackRanges : array<CName>;
var res : Bool;
res = rider.WaitForBehaviorNodeActivation('HorseAttackEndStarted
', 0.500000);
if (!res){
return;
}
horse = (CNewNPC)rider.GetUsedVehicle();
speed = horse.GetMovingAgentComponent().GetRelativeMoveSpeed();
currHorizontalVal = rider.GetBehaviorVariable('aimHorizontalSwor
d', /* NOP */);
attackRanges = FillAttackRangesArray(currHorizontalVal);
entities.Clear();
if (thePlayer.GetHorseCombatSlowMo()){
Sleep(0.120000);
entities = GatherEntitiesInAttackRanges(speed, attackRan
ges);
if (entities.Size() > 0){
DealDamageToHostiles(entities, speed, BASE_DAMAG
E);
}

} else {
Sleep(FIRST_SWEEP_DELAY);
entities = GatherEntitiesInAttackRanges(speed, attackRan
ges);
if (entities.Size() > 0){
DealDamageToHostiles(entities, speed, BASE_DAMAG
E);
} else {
Sleep(SECOND_SWEEP_DELAY);
entities = GatherEntitiesInAttackRanges(speed, a
ttackRanges);
if (entities.Size() > 0){
DealDamageToHostiles(entities, speed, BA
SE_DAMAGE);
}
}
}
/* NOP */;
}
private function FillAttackRangesArray(horizontalVal : Float) : array<CN
ame>{
var attackRanges : array<CName>;
if (horizontalVal == 0.000000){
attackRanges.PushBack('horse_right');
attackRanges.PushBack('horse_right_1');
attackRanges.PushBack('horse_right_2');
} else if (horizontalVal == 1.000000){
attackRanges.PushBack('horse_left');
attackRanges.PushBack('horse_left_1');
attackRanges.PushBack('horse_left_2');
}
return attackRanges;
/* NOP */;
}
private function GatherEntitiesInAttackRanges(speed : Float, attackRange
s : array<CName>) : array<CGameplayEntity>{
var entities : array<CGameplayEntity>;
if (speed < 3.000000){
rider.GatherEntitiesInAttackRange(entities, attackRanges
[0]);
thePlayer.SetDebugAttackRange(attackRanges[0]);
} else if (speed >= 3.000000 && speed < 4.000000){
rider.GatherEntitiesInAttackRange(entities, attackRanges
[1]);
thePlayer.SetDebugAttackRange(attackRanges[1]);
if (entities.Size() == 0){
rider.GatherEntitiesInAttackRange(entities, atta
ckRanges[0]);
thePlayer.SetDebugAttackRange(attackRanges[0]);
}
} else if (speed >= 4.000000){
rider.GatherEntitiesInAttackRange(entities, attackRanges
[2]);
thePlayer.SetDebugAttackRange(attackRanges[2]);
if (entities.Size() == 0){
rider.GatherEntitiesInAttackRange(entities, atta
ckRanges[1]);
thePlayer.SetDebugAttackRange(attackRanges[1]);
if (entities.Size() == 0){
rider.GatherEntitiesInAttackRange(entiti

es, attackRanges[0]);
thePlayer.SetDebugAttackRange(attackRang
es[0]);
}
}
}
return entities;
/* NOP */;
}
private function DealDamageToHostiles(entities : array<CGameplayEntity>,
speed : Float, baseDamage : Float){
var damage : W3Action_Attack;
var i : Int32;
var actor : CActor;
var horse : CNewNPC;
var bloodTrailParam : CBloodTrailEffect;
var weaponId : SItemUniqueId;
horse = (CNewNPC)rider.GetUsedVehicle();
damage = new W3Action_Attack in this;
i = 0;
while (i < entities.Size()){
actor = (CActor)entities[i];
if (actor == rider || actor == horse || GetAttitudeBetwe
en(rider, actor) != 2){
} else if (actor){
actor.DrainStamina(13, 100, 1, /* NOP */, /* NOP
*/, /* NOP */);
damage.Init(rider, actor, NULL, rider.GetInvento
ry().GetItemFromSlot('r_weapon'), 'attack_heavy', rider.GetName(), 2, false, fal
se, 'attack_heavy', 4, 4, true, false, false, false, /* NOP */, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
if (speed < 2){
damage.AddDamage(theGame.params.DAMAGE_N
AME_DIRECT, baseDamage);
} else {
damage.AddDamage(theGame.params.DAMAGE_N
AME_DIRECT, baseDamage * MaxF(1.100000 + speed, 1));
}
if (speed >= 4.000000){
damage.AddEffectInfo(10, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
damage.SetSoundAttackType('wpn_slice');
theGame.damageMgr.ProcessAction(damage);
actor.PlayEffect('heavy_hit_horseriding', /* NOP
*/);
bloodTrailParam = (CBloodTrailEffect)actor.GetGa
meplayEntityParam('CBloodTrailEffect');
if (bloodTrailParam){
weaponId = thePlayer.inv.GetItemFromSlot
('r_weapon');
thePlayer.inv.PlayItemEffect(weaponId, '
blood_trail_horseriding');
}
}
i += 1;
}
delete damage;
/* NOP */;
}

private function TurnOnSlowMo(){


theSound.SoundEvent("gui_slowmo_start");
theGame.SetTimeScale(slowMoSpeedCurrVal, theGame.GetTimescaleSou
rce(11), theGame.GetTimescalePriority(11), false, /* NOP */);
speedMultCasuserId = thePlayer.SetAnimationSpeedMultiplier(1 / s
lowMoSpeedCurrVal * 0.500000, speedMultCasuserId);
isSlowMoOn = true;
/* NOP */;
}
private function TurnOffSlowMo(){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(11));
thePlayer.ResetAnimationSpeedMultiplier(speedMultCasuserId);
theSound.SoundEvent("gui_slowmo_end");
isSlowMoOn = false;
/* NOP */;
}
private function ShouldActivateSlowMo() : Bool{
var actors : array<CActor>;
if (!thePlayer.IsInCombat()){
return false;
}
actors = thePlayer.GetAttackableNPCsAndPlayersInCone(10.000000,
thePlayer.GetHeading(), 100.000000, 10, /* NOP */);
if (actors.Size() > 0){
return true;
}
return false;
/* NOP */;
}
}
import abstract class CBehTreeNodeAtomicMoveToCustomPointDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToActionPointDefinition{
}
import abstract class CBehTreeNodeAtomicMoveToPredefinedPathDefinition{
}
import abstract class CBehTreeNodeAtomicPursueTargetDefinition{
}
import abstract class CBehTreeNodeAtomicActionDefinition{
}
import abstract class CBehTreeNodeAtomicPlayAnimationDefinition{
}
import abstract class CBehTreeNodeAtomicPlayAnimationEventDefinition{
}
state W3VehicleCombatManagerStateRangedAttack in W3VehicleCombatManager extends
CScriptableState{
protected var rider : CR4Player;
protected var aiming : Bool;
protected var fire : Bool;
protected var wasAborted : Bool;
public var horizontalVal : Float;
public function OnEnterState(prevStateName : CName) : Bool{

rider = parent.rider;
aiming = false;
fire = false;
wasAborted = false;
if (theInput.IsActionPressed('VehicleItemActionHold')){
ItemActionHold();
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
if (wasAborted){
theInput.ForceDeactivateAction('VehicleItemAction');
}
/* NOP */;
}
public function OnItemAction(action : SInputAction) : Bool{
if (rider.GetCurrentStateName() == 'DismountHorse' || rider.IsIn
HitAnim()){
return false;
}
if (IsReleased(action, /* NOP */)){
fire = true;
}
/* NOP */;
}
public function OnItemActionHold(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
ItemActionHold();
}
/* NOP */;
}
public function ItemActionHold(){
aiming = true;
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, timeDel
ta : Float) : Bool{
var verticalVal : Float;
var localOffset : Vector;
var rot : EulerAngles;
var headBoneIdx : Int32;
var playerPos : Vector;
var playerToCamHeadingDist : Float;
var playerToCamPitchDist : Float;
var camOffsetVec : Vector;
var playerToCamAngleDiff : Float;
if (!aiming && rider.GetDisplayTarget() && rider.GetDisplayTarge
t() != rider.GetUsedVehicle()){
rider.SetOrientationTarget(1);
headBoneIdx = rider.GetHeadBoneIndex();
if (headBoneIdx >= 0){
playerPos = MatrixGetTranslation(rider.GetBoneWo
rldMatrixByIndex(headBoneIdx));
}
rot = VecToRotation(rider.GetLookAtPosition() - playerPo
s);
rider.GetVisualDebug().AddSphere('whyutrat4', 1.000000,
rider.GetLookAtPosition(), true, Color(255, 0, 0), 0.200000);
if (rider.GetCurrentStateName() == 'SailingPassive'){
horizontalVal = AngleDistance(rider.GetHeading()

+ 180, rot.Yaw) / 180.000000;


} else {
horizontalVal = AngleDistance(rider.GetHeading()
, rot.Yaw) / 180.000000;
}
verticalVal = ClampF(rot.Pitch, -90.000000, 90.000000) /
-90.000000;
} else {
if (rider.GetThrownEntity() && (W3Petard)rider.GetThrown
Entity()){
rider.ProcessCanAttackWhenNotInCombatBomb();
} else {
rider.rangedWeapon.ProcessCanAttackWhenNotInComb
at();
}
rider.SetOrientationTarget(3);
if (rider.GetCurrentStateName() == 'SailingPassive'){
horizontalVal = AngleDistance(rider.GetHeading()
+ 180, moveData.pivotRotationValue.Yaw) / 180.000000;
} else {
horizontalVal = AngleDistance(rider.GetHeading()
, moveData.pivotRotationValue.Yaw) / 180.000000;
}
verticalVal = ClampF(moveData.pivotRotationValue.Pitch,
-90.000000, 90.000000) / 90.000000;
}
rider.SetBehaviorVariable('aimHorizontal', horizontalVal, /* NOP
*/);
rider.SetBehaviorVariable('aimVertical', verticalVal, /* NOP */)
;
rider.vehicleCbtMgrAiming = aiming;
if (!aiming){
theGame.GetGameCamera().EnableScreenSpaceCorrection(true
);
return false;
}
localOffset = Vector(1.400000, 0, 0.150000);
DampVectorConst(moveData.cameraLocalSpaceOffset, localOffset, 4.
000000, timeDelta);
return true;
/* NOP */;
}
public function OnProcessAnimEvent(animEventName : CName) : Bool{
if (rider.inv.IsItemCrossbow(rider.inv.GetItemFromSlot('l_weapon
'))){
rider.rangedWeapon.OnProcessThrowEvent(animEventName);
}
/* NOP */;
}
public function OnItemActionAbort(action : SInputAction) : Bool{
AbortItemAction();
/* NOP */;
}
public function AbortItemAction() : Bool{
var player : W3PlayerWitcher;
var throwStage : EThrowStage;
var allowAbort : Bool;
if (thePlayer.playerAiming.GetCurrentStateName() == 'Aiming'){
allowAbort = true;
}

if (rider.rangedWeapon && rider.rangedWeapon.GetCurrentStateName


() != 'State_WeaponWait'){
if (!rider.rangedWeapon.IsWeaponBeingUsed()){
allowAbort = true;
}
}
if (!allowAbort){
return false;
}
wasAborted = true;
aiming = false;
return true;
/* NOP */;
}
public function OnHorseActionStart() : Bool{
AbortItemAction();
/* NOP */;
}
public function OnHitStart() : Bool{
}
}
import abstract class CBehTreeNodeAtomicDamageReactionDefinition{
}
import abstract class CBehTreeNodeDecoratorGuardRetreatDefinition{
}
import abstract class IBehTreeNodeDecoratorSteeringTargeterDefinition{
}
state W3VehicleCombatManagerStateThrowProjectile in W3VehicleCombatManager exten
ds W3VehicleCombatManagerStateRangedAttack{
public var abortThrow : Bool;
public var thrownEntity : CThrowable;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
rider.radialSlots.Clear();
rider.radialSlots.PushBack('Slot2');
rider.radialSlots.PushBack('Slot3');
rider.radialSlots.PushBack('Slot4');
rider.radialSlots.PushBack('Slot5');
rider.EnableRadialSlotsWithSource(false, rider.radialSlots, 'thr
owProjectileOnVehicle');
if (!parent.wasBombReleased && thrownEntity){
rider.RaiseEvent('actionShootEnd');
thrownEntity.StopAiming(false);
thrownEntity.Destroy();
thrownEntity = NULL;
}
parent.wasBombReleased = false;
thrownEntity = (CThrowable)rider.GetInventory().GetDeploymentIte
mEntity(rider.GetSelectedItemId(), rider.GetWorldPosition(), /* NOP */, true);
thrownEntity.Initialize(rider, rider.GetSelectedItemId());
EntityHandleSet(rider.thrownEntityHandle, thrownEntity);
if (theInput.IsActionPressed('VehicleItemActionHold')){
ItemActionHold();
}
parent.SetCleanupFunction('ThrowProjectileCleanup');
OneFrameDelayHACK();

/* NOP */;
}
public cleanup function ThrowProjectileCleanup(){
if (thrownEntity){
thrownEntity.StopAiming(false);
if (!parent.wasBombReleased){
rider.RaiseEvent('actionShootEnd');
parent.wasBombReleased = true;
thrownEntity.Destroy();
thrownEntity = NULL;
}
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
aiming = false;
abortThrow = false;
rider.EnableRadialSlotsWithSource(true, rider.radialSlots, 'thro
wProjectileOnVehicle');
if (thrownEntity){
thrownEntity.StopAiming(false);
if (!parent.wasBombReleased){
rider.RaiseEvent('actionShootEnd');
parent.wasBombReleased = true;
thrownEntity.Destroy();
thrownEntity = NULL;
}
}
/* NOP */;
}
public entry function OneFrameDelayHACK(){
Sleep(0.100000);
while (!rider.RaiseEvent('actionStart')){
SleepOneFrame();
}
rider.WaitForBehaviorNodeDeactivation('ActionOn', 2.500000);
while (!fire && !abortThrow){
SleepOneFrame();
}
FireProjectile(abortThrow);
/* NOP */;
}
public function OnItemAction(action : SInputAction) : Bool{
if (thrownEntity){
super.OnItemAction(action);
}
/* NOP */;
}
public function OnItemActionHold(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
ItemActionHold();
}
/* NOP */;
}
public function ItemActionHold(){
if (thrownEntity){
super.ItemActionHold();
if (!fire){
thrownEntity.StartAiming();
}

}
/* NOP */;
}
public function OnItemActionAbort(action : SInputAction) : Bool{
if (IsReleased(action, /* NOP */)){
AbortItemAction();
}
/* NOP */;
}
public function AbortItemAction() : Bool{
if (super.AbortItemAction()){
abortThrow = true;
theInput.ForceDeactivateAction('VehicleItemAction');
rider.UnblockAction(13, 'BombThrow');
return true;
}
return false;
/* NOP */;
}
public function OnProcessAnimEvent(animEventName : CName) : Bool{
thrownEntity.OnProcessThrowEvent(animEventName);
if (animEventName == 'ProjectileThrow'){
parent.wasBombReleased = true;
}
/* NOP */;
}
public latent function FireProjectile(abort : Bool){
var res : Bool;
var eventName : CName;
if (rider.GetIsShootingFriendly() || abort){
eventName = 'actionStop';
} else {
eventName = 'actionShoot';
}
if (rider.RaiseEvent(eventName)){
if (eventName == 'actionStop'){
Sleep(0.300000);
thrownEntity.BreakAttachment();
thrownEntity.Destroy();
thrownEntity = NULL;
rider.playerAiming.StopAiming();
parent.wasBombReleased = true;
} else {
rider.playerAiming.RemoveAimingSloMo();
}
aiming = false;
res = rider.WaitForBehaviorNodeActivation('ActionOff', 5
.000000);
parent.PopState(true);
}
/* NOP */;
}
}
import abstract class CBehTreeNodeDecoratorSetSteeringTargetNodeDefinition{
}
import abstract class CBehTreeNodeDecoratorSetSteeringNamedTargetNodeDefinition{
}

class W3BoulderProjectile extends W3AdvancedProjectile{


public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var spawnEntityTemplate : CEntityTemplate;
public editable var onCollisionAppearanceName : CName;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !hitCollisionsGroups.Contains('Static') && !projec
tileHitGround && !collidedEntities.Contains(victim)){
VictimCollision(victim);
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
ProjectileHitGround();
} else if (hitCollisionsGroups.Contains('Water')){
ProjectileHitGround();
}
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){
DealDamageToVictim(victim);
DeactivateProjectile(victim);
/* NOP */;
}
protected function DealDamageToVictim(victim : CGameplayEntity){
var action : W3DamageAction;
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 2, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
if (projEfect != 0){
action.AddEffectInfo(projEfect, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
}
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING, projDMG
);
action.SetIgnoreArmor(ignoreArmor);

action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
collidedEntities.PushBack(victim);
/* NOP */;
}
protected function PlayCollisionEffect(victim : CGameplayEntity){
if (victim == thePlayer && thePlayer.GetCurrentlyCastSign() == 3
&& (W3PlayerWitcher)thePlayer.IsCurrentSignChanneled()){
} else {
PlayEffect(onCollisionFxName, /* NOP */);
}
/* NOP */;
}
protected function DeactivateProjectile(victim : CGameplayEntity){
StopEffect(initFxName);
if (IsNameValid(onCollisionAppearanceName)){
ApplyAppearance(onCollisionAppearanceName);
}
PlayCollisionEffect(victim);
isActive = false;
DestroyAfter(5.000000);
/* NOP */;
}
protected function ProjectileHitGround(){
var ent : CEntity;
var damageAreaEntity : CDamageAreaEntity;
if (spawnEntityTemplate){
ent = theGame.CreateEntity(spawnEntityTemplate, GetWorld
Position(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
damageAreaEntity = (CDamageAreaEntity)ent;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)caster;
StopEffect(initFxName);
projectileHitGround = true;
}
}
DeactivateProjectile(/* NOP */);
/* NOP */;
}
}
import abstract class CBehTreeNodeCustomSteeringDefinition{
}
class W3TraceGroundProjectile extends W3AdvancedProjectile{
public editable var samplingFreq : Float;
public editable var effectName : CName;
public editable var onRangedReachedDestroyAfter : Float;
protected var comp : CEffectDummyComponent;
public function OnProjectileInit() : Bool{
comp = (CEffectDummyComponent)GetComponentByClassName('CEffectDu
mmyComponent');
if (comp){
isActive = true;
AddTimer('Sampling', samplingFreq, true, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
Sampling(0.000000, /* NOP */);
}

/* NOP */;
}
public function OnRangeReached() : Bool{
RemoveTimer('Sampling', /* NOP */);
StopAllEffects();
StopProjectile();
AddTimer('TimeDestroy', onRangedReachedDestroyAfter, false, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function Sampling(optional dt : Float, optional id : Int32)
{
var newPosition : Vector;
var zDiff : Float;
if (!isActive){
return;
}
newPosition = comp.GetLocalPosition();
if (doTrace(comp, zDiff)){
newPosition.Z += zDiff;
comp.SetPosition(newPosition);
Loop();
}
/* NOP */;
}
private function Loop(){
PlayEffect(effectName, /* NOP */);
/* NOP */;
}
private function doTrace(comp : CComponent, outZdiff : Float) : Bool{
var currPosition : Vector;
var outPosition : Vector;
var outNormal : Vector;
var tempPosition1 : Vector;
var tempPosition2 : Vector;
currPosition = comp.GetWorldPosition();
tempPosition1 = currPosition;
tempPosition1.Z -= 5;
tempPosition2 = currPosition;
tempPosition2.Z += 2;
if (theGame.GetWorld().StaticTrace(tempPosition2, tempPosition1,
outPosition, outNormal, /* NOP */)){
outZdiff = outPosition.Z - currPosition.Z;
return true;
}
return false;
/* NOP */;
}
}
import abstract class CBehTreeNodeKeepDistanceDefinition{
}
class W3ElementalIfrytProjectile extends W3TraceGroundProjectile{
private var action : W3DamageAction;
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;

}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !collidedEntities.Contains(victim)){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, 200.00
0000);
action.AddEffectInfo(18, 2.000000, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
isActive = false;
delete action;
}
/* NOP */;
}
}
import abstract class CBehTreeNodeFleeReactionDefinition{
}
class W3EredinFrostProjectile extends W3TraceGroundProjectile{
private var action : W3DamageAction;
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !collidedEntities.Contains(victim)){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,

caster.GetName(), 2, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FROST, projD
MG);
action.AddEffectInfo(projEfect, 2.000000, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
isActive = false;
delete action;
}
/* NOP */;
}
}
import abstract class CBehTreeNodePredefinedPathDefinition{
}
class W3ElementalDaoProjectile extends W3TraceGroundProjectile{
private var action : W3DamageAction;
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !collidedEntities.Contains(victim)){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 0, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddEffectInfo(9, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_ELEMENTAL, 2
00.000000);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
isActive = false;
delete action;
}
/* NOP */;
}
}
import abstract class CBehTreeNodeDecoratorPassMetaobstaclesDefinition{
}

class W3StoneProjectile extends W3AdvancedProjectile{


public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var stoneTemplate : CEntityTemplate;
private var action : W3DamageAction;
private autobind comp : CMeshComponent = single;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
isActive = true;
AddTimer('Rotate', 0.000000, true, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !collidedEntities.Contains(victim)){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 0, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddEffectInfo(9, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING,
200.000000);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
isActive = false;
PlayEffect(onCollisionFxName, /* NOP */);
StopEffect(initFxName);
delete action;
}
return true;
/* NOP */;
}
public function OnRangeReached() : Bool{
var ent : CEntity;
PlayEffect(onCollisionFxName, /* NOP */);
StopEffect(initFxName);
if (comp){
comp.SetVisible(false);
}
ent = theGame.CreateEntity(stoneTemplate, GetWorldPosition(), Ge

tWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
ent.PlayEffect('destroy', /* NOP */);
isActive = false;
DestroyAfter(5.000000);
return true;
/* NOP */;
}
public timer function Rotate(optional dt : Float, optional id : Int32){
var rot : EulerAngles;
if (!comp){
return;
}
rot = comp.GetLocalRotation();
rot.Yaw += 0.500000;
comp.SetRotation(rot);
/* NOP */;
}
}
import abstract class CBehTreeNodePredefinedPathWithCompanionDefinition{
}
class W3EnvironmentProjectile extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var stopFxOnDeactivate : CName;
public editable var onCollisionFxName : CName;
public editable var ignoreVictimsWithTag : CName;
private var action : W3DamageAction;
private autobind comp : CMeshComponent = single;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
isActive = true;
AddTimer('Rotate', 0.000000, true, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !collidedEntities.Contains(victim) && victim != ca
ster){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 0, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP

*/, /* NOP */);


action.AddEffectInfo(13, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_BLUDGEONING,
200.000000);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
if (IsNameValid(onCollisionFxName)){
PlayEffect(onCollisionFxName, /* NOP */);
}
if (IsNameValid(initFxName)){
StopEffect(initFxName);
}
if (IsNameValid(stopFxOnDeactivate)){
StopEffect(stopFxOnDeactivate);
}
delete action;
bounceOfVelocityPreserve = 0.200000;
BounceOff(normal, pos);
Init(victim);
return true;
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
StopProjectile();
if (IsNameValid(initFxName)){
StopEffect(initFxName);
}
if (IsNameValid(stopFxOnDeactivate)){
StopEffect(stopFxOnDeactivate);
}
isActive = false;
return true;
}
/* NOP */;
}
public function OnRangeReached() : Bool{
var ent : CEntity;
if (IsNameValid(onCollisionFxName)){
PlayEffect(onCollisionFxName, /* NOP */);
}
if (IsNameValid(initFxName)){
StopEffect(initFxName);
}
if (IsNameValid(stopFxOnDeactivate)){
StopEffect(stopFxOnDeactivate);
}
return true;
/* NOP */;
}
public timer function Rotate(optional dt : Float, optional id : Int32){
var rot : EulerAngles;
if (!comp){
return;
}
rot = comp.GetLocalRotation();
rot.Yaw += 0.500000;
comp.SetRotation(rot);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{

var rigidMesh : CMeshComponent;


var randAngleOffset : Float;
super.OnAardHit(sign);
StopProjectile();
rigidMesh = (CMeshComponent)GetComponentByClassName('CRigidMeshC
omponent');
if (rigidMesh){
rigidMesh.SetEnabled(true);
} else {
randAngleOffset = RandRangeF(10, -10);
bounceOfVelocityPreserve = 0.700000;
BounceOff(VecFromHeading(thePlayer.GetHeading() + randAn
gleOffset), GetWorldPosition());
Init(thePlayer);
}
/* NOP */;
}
}
import abstract class IBehTreeNodeDecoratorDefinition{
}
class BeamProjectile extends W3AdvancedProjectile{
public editable var beamFx : CName;
public editable var pullEffectDuration : Float;
public function OnProjectileInit() : Bool{
caster.PlayEffect(beamFx, this);
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var customDamageValuePerSec : SAbilityAttributeValue;
var res : Bool;
var comp : CComponent;
var params : SCustomEffectParams;
var targetCmp : CComponent;
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim && !collidedEntities.Contains(victim)){
StopProjectile();
DestroyAfter(5.000000);
res = CreateAttachment(victim, 'torso3_effect', /* NOP *
/, /* NOP */);
if (!res){
CreateAttachment(victim, /* NOP */, /* NOP */, /
* NOP */);
}
targetCmp = victim.GetComponent('torso3effect');
if (targetCmp){
caster.PlayEffect(beamFx, targetCmp);

} else {
caster.PlayEffect(beamFx, victim);
}
params.effectType = 53;
params.creator = (CGameplayEntity)caster;
params.duration = pullEffectDuration;
params.effectValue = customDamageValuePerSec;
(CActor)victim.AddEffectCustom(params);
collidedEntities.PushBack(victim);
isActive = false;
}
return false;
/* NOP */;
}
public function OnRangeReached() : Bool{
if (!isActive){
return true;
}
isActive = false;
if (!victim){
caster.StopEffect(beamFx);
(CActor)caster.SignalGameplayEvent('ProjectileMissed');
}
DestroyAfter(1.000000);
/* NOP */;
}
}
import abstract class CBehTreeNodeConditionSpeedEngineValDefinition{
}
import abstract class CBehTreeNodeScriptConditionalDecoratorDefinition{
}
class PoisonProjectile extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var spawnEntityOnGround : Bool;
public editable var spawnEntityTemplate : CEntityTemplate;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);

if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==


0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !projectileHitGround && !collidedEntities.Contains
(victim)){
VictimCollision(victim);
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
ProjectileHitGround();
} else if (hitCollisionsGroups.Contains('Water')){
ProjectileHitGround();
}
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){
DealDamageToVictim(victim);
PlayCollisionEffect(victim);
SpawnEntity(spawnEntityOnGround);
DeactivateProjectile();
/* NOP */;
}
protected function DealDamageToVictim(victim : CGameplayEntity){
var action : W3DamageAction;
action = new W3DamageAction in theGame;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_POISON, projDMG);
action.AddEffectInfo(19, 2.000000, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
collidedEntities.PushBack(victim);
/* NOP */;
}
protected function PlayCollisionEffect(victim : CGameplayEntity){
if (victim == thePlayer && thePlayer.GetCurrentlyCastSign() == 3
&& (W3PlayerWitcher)thePlayer.IsCurrentSignChanneled()){
} else {
PlayEffect(onCollisionFxName, /* NOP */);
}
/* NOP */;
}
protected function DeactivateProjectile(){
isActive = false;
StopEffect(initFxName);
DestroyAfter(0.010000);
/* NOP */;
}
protected function ProjectileHitGround(){
SpawnEntity(spawnEntityOnGround);
PlayEffect(onCollisionFxName, /* NOP */);
DeactivateProjectile();
/* NOP */;
}
protected function SpawnEntity(onGround : Bool){
var ent : CEntity;

var damageAreaEntity : CDamageAreaEntity;


var entPos : Vector;
var normal : Vector;
if (spawnEntityTemplate){
entPos = GetWorldPosition();
if (onGround){
theGame.GetWorld().StaticTrace(entPos + Vector(0
, 0, 3), entPos - Vector(0, 0, 3), entPos, normal, /* NOP */);
}
ent = theGame.CreateEntity(spawnEntityTemplate, entPos,
GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
damageAreaEntity = (CDamageAreaEntity)ent;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)caster;
StopEffect(initFxName);
projectileHitGround = true;
}
}
/* NOP */;
}
public function OnRangeReached() : Bool{
DestroyAfter(5.000000);
/* NOP */;
}
}
import abstract class CBehTreeNodeConditionTeleportToWorkDefinition{
}
class DebuffProjectile extends W3AdvancedProjectile{
public editable var debuffType : EEffectType;
public editable var damageTypeName : CName;
public editable var customDuration : Float;
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var specialFxOnVictimName : CName;
public editable var applyDebuffIfNoDmgWasDealt : Bool;
public editable var bounceOnVictimHit : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
if (!IsNameValid(damageTypeName)){
damageTypeName = theGame.params.DAMAGE_NAME_PIERCING;
}
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var action : W3DamageAction;
var params : SCustomEffectParams;
var ignore : Bool;
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
} else {
victim = NULL;
}

super.OnProjectileCollision(pos, normal, collidingComponent, hit


CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
ignore = true;
}
if (victim && !collidedEntities.Contains(victim)){
StopProjectile();
DestroyAfter(5.000000);
StopEffect(initFxName);
PlayEffect(onCollisionFxName, /* NOP */);
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 1, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
if (projDMG > 0){
action.AddDamage(damageTypeName, projDMG);
}
if (customDuration > 0 && (CActor)victim){
params.effectType = debuffType;
params.creator = NULL;
params.sourceName = "debuff_projectile";
params.duration = customDuration;
(CActor)victim.AddEffectCustom(params);
} else {
action.AddEffectInfo(debuffType, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
action.SetProcessBuffsIfNoDamage(applyDebuffIfNo
DmgWasDealt);
}
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
if (applyDebuffIfNoDmgWasDealt){
victim.PlayEffect(specialFxOnVictimName, /* NOP
*/);
}
if (bounceOnVictimHit){
BounceOff(normal, pos);
Init(victim);
return true;
}
collidedEntities.PushBack(victim);
isActive = false;
} else if (!victim && !ignore){
StopProjectile();
DestroyAfter(5.000000);
StopEffect(initFxName);
PlayEffect(onCollisionFxName, /* NOP */);
isActive = false;
}
return false;
/* NOP */;
}
public function OnRangeReached() : Bool{
isActive = false;
StopEffect(initFxName);
DestroyAfter(1.000000);

/* NOP */;
}
}
import abstract class CBehTreeNodeAlreadyAtWorkDefinition{
}
class W3FireballProjectile extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var spawnEntityTemplate : CEntityTemplate;
public editable var decreasePlayerDmgBy : Float;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !hitCollisionsGroups.Contains('Static') && !projec
tileHitGround && !collidedEntities.Contains(victim)){
VictimCollision(victim);
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
ProjectileHitGround();
} else if (hitCollisionsGroups.Contains('Water')){
ProjectileHitGround();
}
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){
DealDamageToVictim(victim);
DeactivateProjectile(victim);
/* NOP */;
}
protected function DealDamageToVictim(victim : CGameplayEntity){
var action : W3DamageAction;
action = new W3DamageAction in theGame;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);

if (victim == thePlayer){
projDMG = projDMG - projDMG * decreasePlayerDmgBy;
}
action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, projDMG);
action.AddEffectInfo(18, 2.000000, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
collidedEntities.PushBack(victim);
/* NOP */;
}
protected function PlayCollisionEffect(victim : CGameplayEntity){
if (victim == thePlayer && thePlayer.GetCurrentlyCastSign() == 3
&& (W3PlayerWitcher)thePlayer.IsCurrentSignChanneled()){
} else {
PlayEffect(onCollisionFxName, /* NOP */);
}
/* NOP */;
}
protected function DeactivateProjectile(victim : CGameplayEntity){
isActive = false;
StopEffect(initFxName);
DestroyAfter(5.000000);
PlayCollisionEffect(victim);
/* NOP */;
}
protected function ProjectileHitGround(){
var ent : CEntity;
var damageAreaEntity : CDamageAreaEntity;
var actorsAround : array<CActor>;
var i : Int32;
if (spawnEntityTemplate){
ent = theGame.CreateEntity(spawnEntityTemplate, GetWorld
Position(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
damageAreaEntity = (CDamageAreaEntity)ent;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)caster;
projectileHitGround = true;
}
} else {
actorsAround = GetActorsInRange(this, 2, /* NOP */, /* N
OP */, true);
i = 0;
while (i < actorsAround.Size()){
DealDamageToVictim(actorsAround[i]);
i += 1;
}
}
DeactivateProjectile(/* NOP */);
/* NOP */;
}
public function OnRangeReached() : Bool{
DestroyAfter(5.000000);
/* NOP */;
}
}
import abstract class IBehTreeNodeWorkRelatedConditionDefinition{

}
import abstract class CBehTreeNodeIsAtWorkConditionDefinition{
}
import abstract class CBehTreeNodeCanUseChatSceneConditionDefinition{
}
class W3IceMeteorProjectile extends W3MeteorProjectile{
protected function DealDamageToVictim(victim : CGameplayEntity){
var action : W3DamageAction;
action = new W3DamageAction in theGame;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 2, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FROST, projDMG);
action.AddEffectInfo(45, 2.000000, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
collidedEntities.PushBack(victim);
/* NOP */;
}
}
import abstract class CBehTreeNodeIsSittingInInteriorConditionDefinition{
}
class W3LightningBoltProjectile extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var spawnEntityTemplate : CEntityTemplate;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var ignore : Bool;
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
ignore = true;

}
if (victim && !projectileHitGround && !collidedEntities.Contains
(victim)){
VictimCollision(victim);
} else if (!victim && !ignore){
ProjectileHitGround();
}
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){
DealDamageToVictim(victim);
PlayCollisionEffect(victim);
DeactivateProjectile();
/* NOP */;
}
protected function DealDamageToVictim(victim : CGameplayEntity){
var action : W3DamageAction;
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_SHOCK, projDMG);
action.AddEffectInfo(12, 2.000000, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
collidedEntities.PushBack(victim);
/* NOP */;
}
protected function PlayCollisionEffect(victim : CGameplayEntity){
if (victim == thePlayer && thePlayer.GetCurrentlyCastSign() == 3
&& (W3PlayerWitcher)thePlayer.IsCurrentSignChanneled()){
} else {
PlayEffect(onCollisionFxName, /* NOP */);
}
/* NOP */;
}
protected function DeactivateProjectile(){
isActive = false;
StopEffect(initFxName);
/* NOP */;
}
protected function ProjectileHitGround(){
var ent : CEntity;
var damageAreaEntity : CDamageAreaEntity;
PlayEffect(onCollisionFxName, /* NOP */);
if (spawnEntityTemplate){
ent = theGame.CreateEntity(spawnEntityTemplate, GetWorld
Position(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
damageAreaEntity = (CDamageAreaEntity)ent;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)caster;
StopEffect(initFxName);
projectileHitGround = true;
}
}
DeactivateProjectile();
/* NOP */;

}
public function OnRangeReached() : Bool{
DestroyAfter(5.000000);
/* NOP */;
}
}
import abstract class CBehTreeDecoratorUninterruptableDefinition{
}
class W3IceSpearProjectile extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var spawnEntityTemplate : CEntityTemplate;
public editable var customDuration : Float;
public editable var onCollisionVictimFxName : CName;
public editable var immediatelyStopVictimFX : Bool;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var ignore : Bool;
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.IsCiri() || thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
victim = NULL;
ignore = true;
}
if (victim && !projectileHitGround && !collidedEntities.Contains
(victim)){
VictimCollision();
} else if (!victim && !ignore){
ProjectileHitGround();
}
/* NOP */;
}
protected function DestroyRequest(){
StopEffect(initFxName);
PlayEffect(onCollisionFxName, /* NOP */);
DestroyAfter(2.000000);
/* NOP */;
}
protected function PlayCollisionEffect(){

PlayEffect(onCollisionFxName, /* NOP */);


/* NOP */;
}
protected function VictimCollision(){
DealDamageToVictim();
PlayCollisionEffect();
DeactivateProjectile();
/* NOP */;
}
protected function DealDamageToVictim(){
var targetSlowdown : CActor;
var action : W3DamageAction;
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FROST, projDMG);
if (projEfect != 0){
if (customDuration > 0){
action.AddEffectInfo(projEfect, customDuration,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
action.AddEffectInfo(projEfect, /* NOP */, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
}
}
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
if (IsNameValid(onCollisionVictimFxName)){
victim.PlayEffect(onCollisionVictimFxName, /* NOP */);
}
if (immediatelyStopVictimFX){
victim.StopEffect(onCollisionVictimFxName);
}
/* NOP */;
}
protected function DeactivateProjectile(){
isActive = false;
StopEffect(initFxName);
DestroyAfter(5.000000);
/* NOP */;
}
protected function ProjectileHitGround(){
var ent : CEntity;
var damageAreaEntity : CDamageAreaEntity;
PlayEffect(onCollisionFxName, /* NOP */);
if (spawnEntityTemplate){
ent = theGame.CreateEntity(spawnEntityTemplate, GetWorld
Position(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
damageAreaEntity = (CDamageAreaEntity)ent;
if (damageAreaEntity){
damageAreaEntity.owner = (CActor)caster;
StopEffect(initFxName);
projectileHitGround = true;
}
}
DeactivateProjectile();
/* NOP */;

}
}
import abstract class CBehTreeNodeSelectPartyMemberDefinition{
}
class W3SpawnMeteor extends W3AdvancedProjectile{
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var onCollisionFxName2 : CName;
public editable var startFxName : CName;
private var ent : CEntity;
private var projectileHitGround : Bool;
private var playerPos : Vector;
private var projPos : Vector;
private var projSpawnPos : Vector;
public function OnProjectileInit() : Bool{
var ent : CEntity;
var spawnEntityTemplate : CEntityTemplate;
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){
DealDamageToVictim(victim);
DeactivateProjectile();
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (victim == thePlayer && GetAttitudeBetween(victim, caster) ==
0 || thePlayer.IsCurrentlyDodging() && thePlayer.GetBehaviorVariable('isRolling
', /* NOP */) == 1.000000){
victim = NULL;
}
if (victim && !projectileHitGround && !collidedEntities.Contains
(victim)){
VictimCollision(victim);
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
ProjectileHitGround();
} else if (hitCollisionsGroups.Contains('Water')){
ProjectileHitGround();
}
/* NOP */;
}
protected function DeactivateProjectile(){

isActive = false;
StopEffect(initFxName);
DestroyAfter(5.000000);
/* NOP */;
}
protected function PlayCollisionEffect(victim : CGameplayEntity){
PlayEffect(onCollisionFxName, /* NOP */);
PlayEffect(onCollisionFxName2, /* NOP */);
/* NOP */;
}
protected function SummonCreatureEvent(){
}
public function ProjectileHitGround(){
var entities : array<CGameplayEntity>;
var landPos : Vector;
var action : W3DamageAction;
landPos = GetWorldPosition();
PlayCollisionEffect(/* NOP */);
GCameraShake(3, 5, landPos, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
SummonCreatureEvent();
FindGameplayEntitiesInSphere(entities, landPos, 5, 1, 'PLAYER',
/* NOP */, /* NOP */, /* NOP */);
victim = (CActor)entities[0];
if (victim){
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this,
caster.GetName(), 0, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.AddEffectInfo(13, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
isActive = false;
delete action;
}
DeactivateProjectile();
/* NOP */;
}
protected function DealDamageToVictim(victim : CGameplayEntity){
var targetSlowdown : CActor;
var action : W3DamageAction;
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 1, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FROST, projDMG);
targetSlowdown = (CActor)victim;
action.AddEffectInfo(6, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
action.SetCanPlayHitParticle(false);
theGame.damageMgr.ProcessAction(action);
delete action;
/* NOP */;
}
}
import abstract class CBehTreeNodeConditionPartyMembersCountDefinition{
}

class W3AirDrainProjectile extends W3AdvancedProjectile{


public editable var destructionEntity : CEntityTemplate;
public editable var markerEntityTemplate : CEntityTemplate;
public editable var AirToDrain : Float;
public editable var initFxName : CName;
public editable var onCollisionFxName : CName;
public editable var onCollisionFxName2 : CName;
private var markerEntity : CEntity;
private var projectileHitGround : Bool;
public function OnProjectileInit() : Bool{
PlayEffect(initFxName, /* NOP */);
projectileHitGround = false;
isActive = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
if (!isActive){
return true;
}
if (hitCollisionsGroups.Contains('Water')){
return true;
}
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
if (victim && !projectileHitGround && !collidedEntities.Contains
(victim)){
VictimCollision(victim);
return true;
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
DeactivateProjectile(true);
return true;
}
return false;
/* NOP */;
}
protected function DeactivateProjectile(fast : Bool){
isActive = false;
StopEffect(initFxName);
PlayCollisionEffect();
/* NOP */;
}
protected function PlayCollisionEffect(){
var animComp : CAnimatedComponent;
PlayEffect(onCollisionFxName, /* NOP */);
PlayEffect(onCollisionFxName2, /* NOP */);
animComp = (CAnimatedComponent)GetComponentByClassName('CAnimate
dComponent');
if (animComp){
RaiseEvent('destroy');
}
/* NOP */;
}
protected function VictimCollision(victim : CGameplayEntity){

if (victim == thePlayer){
thePlayer.DrainAir(AirToDrain, 0);
GCameraShake(3, 5, GetWorldPosition(), /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
DeactivateProjectile(/* NOP */);
/* NOP */;
}
}
import abstract class CBehTreeNodeSelectFormationLeaderDefinition{
}
import abstract class CBehTreeNodeChoiceDefinition{
}
import abstract class CBehTreeNodeEvaluatingSelectorDefinition{
}
import struct IBehTreeTask{
//NULL type for isActive
import public final function GetActor() : CActor;
import public final function GetNPC() : CNewNPC;
import public final function GetLocalTime() : Float;
import public final function SetNamedTarget(targetName : CName, node : C
Node);
import public final function GetNamedTarget(targetName : CName) : CNode;
import public final function GetActionTarget() : CNode;
import public final function SetActionTarget(node : CNode);
import public final function GetCombatTarget() : CActor;
import public final function SetCombatTarget(target : CActor);
import public final function RunMain();
import public final function Complete(success : Bool);
import public final function SetEventRetvalCName(val : CName) : Bool;
import public final function SetEventRetvalFloat(val : Float) : Bool;
import public final function SetEventRetvalInt(val : Int32) : Bool;
import public final function GetEventParamCName(defaultVal : CName) : CN
ame;
import public final function GetEventParamBaseDamage() : CBaseDamage;
import public final function GetEventParamFloat(defaultVal : Float) : Fl
oat;
import public final function GetEventParamInt(defaultVal : Int32) : Int3
2;
import public final function GetEventParamObject() : IScriptable;
import public final function UnregisterFromAnimEvent(eventId : CName);
import public final function UnregisterFromGameplayEvent(eventId : CName
);
import public final function SetIsInCombat(inCombat : Bool);
import public final function SetCustomTarget(target : Vector, heading :
Float) : Bool;
import public final function GetCustomTarget(target : Vector, heading :
Float) : Bool;
public function InitializeCombatStorage() : CAIStorageHandler{
var storageHandler : CAIStorageHandler;
var actor : CActor;
var className : CName;
storageHandler = new CAIStorageHandler in this;
actor = super.GetActor();
className = '*CBaseAICombatStorage';
if (actor.HasTag('eredin')){

className = '*CBossAICombatStorage';
} else if (actor.IsHuman() || actor.GetMovingAgentComponent().Ge
tName() == "wild_hunt_base"){
className = '*CHumanAICombatStorage';
}
storageHandler.Initialize('CombatData', className, this);
return storageHandler;
/* NOP */;
}
}
import struct IBehTreeObjectDefinition{
import protected final function
oat);
import protected final function
;
import protected final function
String);
import protected final function
ame);
import protected final function
);
import protected final function
t;
import protected final function
import protected final function
2;
import protected final function
ring;
import protected final function
e;
import protected final function
import protected final function
table;
import protected final function
Name) : IAIParameters;
}

SetValFloat(v : CBehTreeValFloat, n : Fl
SetValInt(v : CBehTreeValInt, n : Int32)
SetValString(v : CBehTreeValString, n :
SetValCName(v : CBehTreeValCName, n : CN
SetValBool(v : CBehTreeValBool, n : Bool
GetValFloat(v : CBehTreeValFloat) : Floa
GetValInt(v : CBehTreeValInt) : Int32;
GetValEnum(v : IBehTreeValueEnum) : Int3
GetValString(v : CBehTreeValString) : St
GetValCName(v : CBehTreeValCName) : CNam
GetValBool(v : CBehTreeValBool) : Bool;
GetObjectByVar(varName : CName) : IScrip
GetAIParametersByClassName(className : C

class W3ObjectProjectile extends CProjectileTrajectory{


private var action : W3DamageAction;
private var owner : CActor;
public function SetOwner(actor : CActor){
owner = actor;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CGameplayEntity;
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
if (victim){
action = new W3DamageAction in this;
action.AddDamage(theGame.params.DAMAGE_NAME_PIERCING, 20
.000000);
action.attacker = owner;

action.victim = victim;
theGame.damageMgr.ProcessAction(action);
delete action;
}
/* NOP */;
}
public function OnRangeReached() : Bool{
StopAllEffects();
StopProjectile();
Destroy();
/* NOP */;
}
public timer function TimeDestroy(optional deltaTime : Float, optional i
d : Int32){
Destroy();
/* NOP */;
}
}
import abstract class CBehTreeFactory{
}
import abstract class CBehTreeNodeLoopDecoratorDefinition{
}
class CQuestCombatManagerBlock extends IQuestCombatManagerBaseBlock{
public editable inlined var combatStyle : CAINpcCombatStyle;
public function GetBlockName() : String{
return "CombatManager: Human";
/* NOP */;
}
public function GetAITree() : IAITree{
return combatStyle;
/* NOP */;
}
public function GetContextMenuSpecialOptions(names : array<String>){
names.PushBack("VesemirTutorial");
names.PushBack("OneHandedSword");
names.PushBack("OneHandedAxe");
names.PushBack("OneHandedBlunt");
names.PushBack("OneHandedAny");
names.PushBack("Fists");
names.PushBack("Shield");
names.PushBack("Bow");
names.PushBack("Crossbow");
names.PushBack("TwoHandedHammer");
names.PushBack("TwoHandedAxe");
names.PushBack("TwoHandedHalberd");
names.PushBack("TwoHandedSpear");
names.PushBack("Witcher");
/* NOP */;
}
public function RunSpecialOption(option : Int32){
switch(option){
case 0:
combatStyle = new CAINpcVesemirTutorialCombatStyle in th
is;
combatStyle.OnCreated();
break;
case 1:

combatStyle = new CAINpcOneHandedSwordCombatStyle in thi


s;
combatStyle.OnCreated();
break;
case 2:
combatStyle = new CAINpcOneHandedAxeCombatStyle in this;
combatStyle.OnCreated();
break;
case 3:
combatStyle = new CAINpcOneHandedBluntCombatStyle in thi
s;
combatStyle.OnCreated();
break;
case 4:
combatStyle = new CAINpcOneHandedAnyCombatStyle in this;
combatStyle.OnCreated();
break;
case 5:
combatStyle = new CAINpcFistsCombatStyle in this;
combatStyle.OnCreated();
break;
case 6:
combatStyle = new CAINpcShieldCombatStyle in this;
combatStyle.OnCreated();
break;
case 7:
combatStyle = new CAINpcBowCombatStyle in this;
combatStyle.OnCreated();
break;
case 8:
combatStyle = new CAINpcCrossbowCombatStyle in this;
combatStyle.OnCreated();
break;
case 9:
combatStyle = new CAINpcTwoHandedHammerCombatStyle in th
is;
combatStyle.OnCreated();
break;
case 10:
combatStyle = new CAINpcTwoHandedAxeCombatStyle in this;
combatStyle.OnCreated();
break;
case 11:
combatStyle = new CAINpcTwoHandedHalberdCombatStyle in t
his;
combatStyle.OnCreated();
break;
case 12:
combatStyle = new CAINpcTwoHandedSpearCombatStyle in thi
s;
combatStyle.OnCreated();
break;
case 13:
combatStyle = new CAINpcWitcherCombatStyle in this;
combatStyle.OnCreated();
break;
default:
return;
}
/* NOP */;

}
}
import abstract class CBehTreeNodeLoopWithTimelimitDecoratorDefinition{
}
class CQuestMonsterCombatManagerBlock extends IQuestCombatManagerBaseBlock{
public editable inlined var combatLogic : CAIMonsterCombatLogic;
public function GetBlockName() : String{
return "CombatManager: Monster";
/* NOP */;
}
public function GetAITree() : IAITree{
return combatLogic;
/* NOP */;
}
public function GetContextMenuSpecialOptions(names : array<String>){
names.PushBack("Witch1");
names.PushBack("Witch2");
names.PushBack("Witch3");
/* NOP */;
}
public function RunSpecialOption(option : Int32){
switch(option){
case 0:
combatLogic = new CAIWitchCombatLogic in this;
combatLogic.OnCreated();
break;
case 1:
combatLogic = new CAIWitch2CombatLogic in this;
combatLogic.OnCreated();
break;
case 2:
combatLogic = new CAIWitchCombatLogic in this;
combatLogic.OnCreated();
break;
default:
return;
}
/* NOP */;
}
}
import abstract class CBehTreeNodeSequenceDefinition{
}
import abstract class CBehTreeNodePersistantSequenceDefinition{
}
import struct CJournalQuest{
import public final function
import public final function
import public final function
import public final function
}

GetTitleStringId() : Int32;
GetType() : eQuestType;
GetWorld() : Int32;
GetHuntingQuestCreatureTag() : CName;

import abstract class CBehTreeNodeSequenceCheckAvailabilityDefinition{


}
import abstract class CBehTreeNodeSequenceFowardAndBackDefinition{

}
import abstract class CBehTreeNodeSelectorDefinition{
}
struct SJournalUpdate{
var text : String;
var title : String;
var status : EJournalStatus;
var journalEntry : CJournalBase;
var iconPath : String;
var panelName : CName;
var entryTag : CName;
var soundEvent : String;
var isQuestUpdate : Bool;
var displayTime : Float;
}
import abstract class CBehTreeNodeProbabilitySelectorDefinition{
}
import abstract class IBehTreeNodeSpecialDefinition{
}
import abstract class CBehTreeNodeParallelDefinition{
}
import abstract class IBehTreeMetanodeDefinition{
}
import abstract class IBehTreeVoidDefinition{
}
import abstract class CBehTreeCommentDefinition{
}
state W3TutorialManagerUIHandlerStateTutHandlerBaseState in W3TutorialManagerUIH
andler extends CScriptableState{
protected var defaultTutorialMessage : STutorialMessage;
private var currentlyShownHint : CName;
public function OnEnterState(prevStateName : CName) : Bool{
defaultTutorialMessage.type = 1;
defaultTutorialMessage.forceToQueueFront = true;
defaultTutorialMessage.canBeShownInMenus = true;
defaultTutorialMessage.canBeShownInDialogs = true;
defaultTutorialMessage.hintPositionType = 4;
defaultTutorialMessage.disableHorizontalResize = true;
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
theGame.GetTutorialSystem().uiHandler.UnregisterUIHint(GetStateN
ame(), /* NOP */);
/* NOP */;
}
protected final function QuitState(){
var entersNew : Bool;
if (this != theGame.GetTutorialSystem().uiHandler.GetCurrentStat
e()){
return;
}

entersNew = theGame.GetTutorialSystem().uiHandler.UnregisterUIHi
nt(GetStateName(), /* NOP */);
if (!entersNew){
virtual_parent.GotoState('Tutorial_Idle', /* NOP */, /*
NOP */);
}
/* NOP */;
}
protected final function CloseHint(n : CName){
theGame.GetTutorialSystem().HideTutorialHint(n, /* NOP */, /* NO
P */);
currentlyShownHint = 'None';
/* NOP */;
}
protected final function IsCurrentHint(h : CName) : Bool{
return currentlyShownHint == h;
/* NOP */;
}
protected final function ShowHint(tutorialScriptName : CName, x : Float,
y : Float, durationType : ETutorialHintDurationType, highlights : array<STutori
alHighlight>, fullscreen : Bool, isHudTutorial : Bool){
var tut : STutorialMessage;
tut = defaultTutorialMessage;
tut.tutorialScriptTag = tutorialScriptName;
tut.highlightAreas = highlights;
tut.forceToQueueFront = true;
tut.canBeShownInMenus = true;
tut.isHUDTutorial = isHudTutorial;
tut.disableHorizontalResize = true;
if (x != 0 || y != 0){
tut.hintPositionType = 3;
} else {
tut.hintPositionType = 0;
}
tut.hintPosX = x;
tut.hintPosY = y;
if (durationType == 0){
tut.hintDurationType = 5;
} else {
tut.hintDurationType = durationType;
}
if (fullscreen){
tut.blockInput = true;
tut.pauseGame = true;
tut.fullscreen = true;
}
theGame.GetTutorialSystem().DisplayTutorial(tut);
currentlyShownHint = tutorialScriptName;
/* NOP */;
}
public function OnMenuClosing(menuName : CName) : Bool{
}
public function OnMenuClosed(menuName : CName) : Bool{
}
public function OnMenuOpening(menuName : CName) : Bool{
}
public function OnMenuOpened(menuName : CName) : Bool{
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{

}
}
import abstract class CBehTreeNodeSubtreeDefinition{
}
import abstract class CBehTreeNodeSubtreeListDefinition{
}
import abstract class CBehTreeNodeConditionDefinition{
}
import abstract class CBehTreeNodeConditionChanceDefinition{
}
import abstract class CBehTreeNodeConditionTrueDefinition{
}
import abstract class CBehTreeNodeConditionReactionEventDefinition{
}
import abstract class CBehTreeNodeConditionDistanceToActionTargetDefinition{
}
import abstract class CBehTreeNodeConditionDistanceToNamedTargetDefinition{
}
import abstract class CBehTreeNodeConditionDistanceToCombatTargetDefinition{
}
import abstract class CBehTreeNodeConditionDistanceToCustomTargetDefinition{
}
import abstract class CBehTreeNodeConditionLineofSightDefinition{
}
import abstract class CBehTreeNodeConditionTargetNoticedDefinition{
}
import abstract class CBehTreeNodeConditionCombatTargetNoticedDefinition{
}
import abstract class CBehTreeNodeConditionLineofSightToNamedTargetDefinition{
}
import abstract class IBehTreeNodeConditionCheckRotationDefinition{
}
import abstract class CBehTreeNodeConditionCheckRotationToCombatTargetDefinition
{
}
import abstract class CBehTreeNodeConditionCheckRotationToActionTargetDefinition
{
}
import abstract class CBehTreeNodeConditionIsConsciousAtWorkDefinition{
}
import abstract class CBehTreeNodeConditionIsWorkingDefinition{

}
import abstract class CBehTreeNodeBaseConditionalTreeDefinition{
}
import abstract class CBehTreeNodeConditionalTreeDefinition{
}
import abstract class CBehTreeNodeConditionalTreeNPCTypeDefinition{
}
import abstract class CBehTreeNodeConditionalFlagTreeDefinition{
}
import abstract class CBehTreeNodeConditionalChooseBranchDefinition{
}
import abstract class CBehTreeNodeConditionIsInAttackRangeDefinition{
}
import abstract class CBehTreeNodeConditionIsInCameraViewDefinition{
}
import abstract class IBehTreeNodeConditionIsInGuardAreaDefinition{
}
import abstract class CBehTreeNodeConditionIsActionTargetInGuardAreaDefinition{
}
import abstract class CBehTreeNodeConditionIsThisActorInGuardAreaDefinition{
}
import abstract class CBehTreeNodeConditionIsCustomTargetInGuardAreaDefinition{
}
import abstract class CBehTreeNodeConditionClearLineToTargetDefinition{
}
import abstract class CBehTreeNodeConditionHasCombatTargetDefinition{
}
import abstract class CBehTreeNodeArbitratorDefinition{
}
import abstract class CBehTreeNodeBaseForcedBehaviorDefinition{
}
import abstract class CBehTreeNodeForcedBehaviorDefinition{
}
import abstract class CBehTreeNodeExternalListenerDefinition{
}
import abstract class CBehTreeNodeScriptedActionsListReaderDefinition{
}
import abstract class CBehTreeNodePlaySceneDefinition{
}
import abstract class CBehTreeNodeDecoratorLookAtDefinition{

}
import abstract class CBehTreeNodeAtomicLookAtDefinition{
}
import abstract class IBehTreeNodeSetupCustomMoveDataDefinition{
}
import abstract class CBehTreeNodeSetupCustomMoveTargetToPositionDefinition{
}
import abstract class CBehTreeNodeSetCustomMoveTargetToInteractionPointDefintion
{
}
import abstract class CBehTreeNodeSetCustomMoveTargetToDestinationPointDefintion
{
}
import abstract class CBehTreeNodeNotifyDoorDefinition{
}
import abstract class CBehTreeNodeAtomicIdleDefinition{
}
import abstract class IBehTreeNodeExplorationQueueDecoratorDefinition{
}
import abstract class CBehTreeNodeExplorationQueueRegisterDefinition{
}
import abstract class CBehTreeNodeExplorationQueueUseDefinition{
}
import abstract class CBehTreeNodeDecoratorSnapToNavigationDefinition{
}
import abstract class CBehTreeNodeCompleteImmediatelyDefinition{
}
import abstract class CBehTreeNodeSelectTargetByTagDecoratorDefinition{
}
import abstract class CBehTreeNodeSelectTargetByTagDefinition{
}
import abstract class CBehTreeNodeSelectTargetByTagInAreaDecoratorDefinition{
}
import abstract class CBehTreeNodeDecoratorSelectRandomTerrainPositionInAreaDefi
nition{
}
import abstract class CBehTreeNodeCasualMovementDecoratorDefinition{
}
import abstract class CBehTreeNodeSelectPatrolingTargetDecoratorDefinition{
}
import abstract class CBehTreeNodeSelectWanderingTargetDecoratorDefinition{

}
import abstract class CBehTreeNodeWanderingTaggedTargetDecoratorDefinition{
}
import abstract class CBehTreeNodeRandomWanderingTargetDefinition{
}
import abstract class CBehTreeNodeHistoryWanderingTargetDefinition{
}
import abstract class CBehTreeNodeDynamicWanderingTargetDefinition{
}
import abstract class CBehTreeDecoratorSelectFleeDestinationDefinition{
}
import abstract class CBehTreeNodeDecoratorSetupFormationDefinition{
}
import abstract class CBehTreeNodeDecoratorLeadFormationDefinition{
}
import abstract class CBehTreeNodeSelectActionPointDecoratorDefinition{
}
import abstract class CBehTreeNodePartyWorkSynchronizerDecoratorDefinition{
}
statemachine class W3FoodDispenser extends CGameplayEntity{
public editable var foodEntity : CEntityTemplate;
public editable var maxSpawnedFood : Int32;
public var spawnedFood : array<CEntity>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
if (IsPlayerNear()){
ActivateFoodDispenser(true);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
ActivateFoodDispenser(true);
/* NOP */;
}
public function OnAreaExtit(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
ActivateFoodDispenser(false);
/* NOP */;
}
public function GetEntitySpawnPos() : Vector{
var local2world : Matrix;
var offset : Vector;
var entSpawnPos : Vector;
local2world = GetLocalToWorld();
offset = Vector(RandRangeF(1.500000, -1.500000), RandRangeF(1.50
0000, -1.500000), 0.000000);
entSpawnPos = VecTransform(local2world, offset);
return entSpawnPos;
/* NOP */;

}
public timer function SpawnFood(optional deltaTime : Float, optional id
: Int32){
var i : Int32;
var spawnedFoodEntity : CEntity;
if (spawnedFood.Size() <= maxSpawnedFood){
i = spawnedFood.Size();
while (i < maxSpawnedFood){
spawnedFoodEntity = theGame.CreateEntity(foodEnt
ity, GetEntitySpawnPos(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
spawnedFood.PushBack(spawnedFoodEntity);
i += 1;
}
}
AddTimer('DespawnFood', 20.000000, false, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
/* NOP */;
}
public timer function DespawnFood(optional deltaTime : Float, optional i
d : Int32){
spawnedFood.Clear();
/* NOP */;
}
public function IsPlayerNear() : Bool{
var dispenserArea : CAreaComponent;
dispenserArea = (CAreaComponent)GetComponentByClassName('CTrigge
rAreaComponent');
return dispenserArea.TestEntityOverlap(thePlayer);
/* NOP */;
}
public function ActivateFoodDispenser(isOn : Bool){
if (isOn){
PushState('Active');
} else {
PopState(true);
}
/* NOP */;
}
}
import abstract class CBehTreeNodePerformWorkDefinition{
}
import abstract class CBehTreeNodeWorkDecoratorDefinition{
}
import abstract class CBehTreeNodeCustomWorkDefinition{
}
import abstract class CBehTreeNodeDespawnDefinition{
}
import abstract class CBehTreeMetanodeWorkInitializer{
}
import abstract class CBehTreeNodeActivationDelayDecoratorDefinition{
}
import abstract class CBehTreeNodeDelayActivationDecoratorDefinition{

}
import abstract class CBehTreeNodeDurationDecoratorDefinition{
}
import abstract class CBehTreeNodeDurationRangeDecoratorDefinition{
}
import abstract class CBehTreeNodePokeDecoratorDefinition{
}
import abstract class CBehTreeNodeDecoratorSemaphoreDefinition{
}
import abstract class CBehTreeNodeDecoratorPriorityOnSemaphoreDefinition{
}
import abstract class CBehTreeDecoratorActivePriorityDefinition{
}
import abstract class IBehTreeNodeDecoratorAsyncQueryDefinition{
}
import abstract class IBehTreeNodeDecoratorAsyncResultDefinition{
}
import abstract class IBehTreeNodeDecoratorWalkableSpotQueryDefinition{
}
import abstract class CBehTreeNodeDecoratorWalkableSpotRingQueryDefinition{
}
import abstract class CBehTreeNodeDecoratorWalkableSpotClosestQueryDefinition{
}
import abstract class CBehTreeNodeDecoratorWalkableSpotResultDefintion{
}
import abstract class CBehTreeNodeDecoratorCompleteInProximityDefinition{
}
import abstract class IBehTreeDynamicNodeBaseDefinition{
}
import abstract class CBehTreeDynamicNodeDefinition{
}
import abstract class CBehTreeNodeComplexConditionDefinition{
}
import abstract class IBehTreeAtomicBinaryCondition{
}
import abstract class CBehTreeAtomicANDCondition{
}
import abstract class CBehTreeAtomicORCondition{
}
import abstract class CBehTreeAtomicNOTCondition{

}
import abstract class CBehTreeAtomicTestSubtreeCondition{
}
import abstract class CBehTreeNodeConditionCounterDefinition{
}
import abstract class CBehTreeNodeConditionCounterNewDefinition{
}
import abstract class IBehTreeNodeConditionWasEventFiredRecentlyBaseDefinition{
}
import abstract class CBehTreeNodeConditionWasEventFiredRecentlyDefinition{
}
import abstract class CBehTreeNodeConditionWasAnyOfEventsFiredRecentlyDefinition
{
}
import abstract class CBehTreeAtomicSteerWithTargetDefinition{
}
import abstract class CBehTreeAtomicSteerWithCustomTargetDefinition{
}
import struct CAIDefaults{
}
import struct CAIParameters{
}
import struct CAIRedefinitionParameters{
}
import abstract class IAISpawnTreeParameters{
}
import abstract class CGuardAreaParameters{
}
import abstract class CIdleBehaviorsDefaultParameters{
}
import struct CAIActionSequence{
}
import abstract class SGameplayEventParamObject{
}
import abstract class SArbitratorQueryData{
}
import abstract class SPlaySceneRequestData{
}
state W3BoatSpawnerStateSpawnBoatLatentHack in W3BoatSpawner extends CScriptable
State{
public function OnEnterState(prevStateName : CName) : Bool{

if (!parent.isAttemptingBoatSpawn){
parent.isAttemptingBoatSpawn = true;
parent.AddTimer('DelayedSpawnBoat', 0.100000, /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
GotoStateAuto();
}
/* NOP */;
}
public function OnDelayedSpawnedBoat() : Bool{
Hack_Entry_Name_Collision_Bug_W3BoatSpawner_SpawnBoatLatentHack(
);
parent.isAttemptingBoatSpawn = false;
GotoStateAuto();
/* NOP */;
}
public entry function Hack_Entry_Name_Collision_Bug_W3BoatSpawner_SpawnB
oatLatentHack(){
var entityTemplate : CEntityTemplate;
var boat : W3Boat;
var pos : Vector;
entityTemplate = (CEntityTemplate)LoadResourceAsync('boat', /* N
OP */);
if (entityTemplate){
pos = parent.GetWorldPosition();
pos.Z = theGame.GetWorld().GetWaterLevel(pos, /* NOP */)
;
boat = (W3Boat)theGame.CreateEntity(entityTemplate, pos,
parent.GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, 2, /* NOP */);
if (boat){
EntityHandleSet(parent.spawnedBoat, boat);
}
}
/* NOP */;
}
}
import abstract class SBehTreeDynamicNodeEventData{
}
import statemachine struct W3BoatSpawner{
public saved var spawnedBoat : EntityHandle;
public editable var respawnDistance : Float;
public var isAttemptingBoatSpawn : Bool;
public function OnSpawned(spawndata : SEntitySpawnData) : Bool{
if (!isAttemptingBoatSpawn){
if (!EntityHandleGet(spawnedBoat) && GetCurrentStateName
() != 'SpawnBoatLatentHack'){
GotoState('SpawnBoatLatentHack', /* NOP */, /* N
OP */);
} else {
GotoStateAuto();
}
}
/* NOP */;
}
public function OnStreamIn() : Bool{
var currentStateName : CName;
if (!isAttemptingBoatSpawn){
currentStateName = GetCurrentStateName();

if (!EntityHandleGet(spawnedBoat) && currentStateName !=


'SpawnBoatLatentHack'){
GotoState('SpawnBoatLatentHack', /* NOP */, /* N
OP */);
} else {
GotoStateAuto();
}
}
/* NOP */;
}
public function OnStreamOut() : Bool{
var boat : CEntity;
var distToBoat : Float;
boat = EntityHandleGet(spawnedBoat);
if (boat){
distToBoat = VecDistance2D(GetWorldPosition(), boat.GetW
orldPosition());
if (distToBoat > respawnDistance){
theGame.AddDynamicallySpawnedBoatHandle(spawnedB
oat);
EntityHandleSet(spawnedBoat, NULL);
}
}
GotoStateAuto();
/* NOP */;
}
public timer function DelayedSpawnBoat(optional td : Float, optional id
: Int32){
RemoveTimer('DelayedSpawnBoat', /* NOP */);
(W3BoatSpawnerStateSpawnBoatLatentHack)GetState('SpawnBoatLatent
Hack').OnDelayedSpawnedBoat();
/* NOP */;
}
}
import abstract class SBehTreeDynamicNodeCancelEventData{
}
import statemachine struct CBoatBodyComponent{
import public function TriggerCutsceneStart();
import public function TriggerCutsceneEnd();
public function OnComponentAttached() : Bool{
GotoStateAuto();
/* NOP */;
}
public function OnCutsceneStarted() : Bool{
}
public function OnCutsceneEnded() : Bool{
}
}
import abstract class CBehTreeValAreaSelectionMode{
}
import abstract class SBehTreeAreaSelection{
}
import abstract class SForcedBehaviorEventData{
}

import abstract class SDynamicNodeSaveStateRequestEventData{


}
import abstract class CBaseDamage{
//NULL type for attacker
//NULL type for causer
//NULL type for hitReactionAnimRequested
//NULL type for victim
//NULL type for hitLocation
//NULL type for momentum
}
import struct CAIStorageHandler{
import public final function Initialize(itemName : CName, classId : CNam
e, owner : IScriptable) : Bool;
import public final function InitializeExternal(itemName : CName, classI
d : CName, actor : CActor) : Bool;
import public final function Get() : IScriptable;
}
import abstract class CBehTreeWorkData{
}
import abstract class CBehTreeGuardAreaData{
}
import abstract class CBehTreeNodeBaseIdleDynamicRootDefinition{
}
import abstract class CBehTreeNodeIdleDynamicRootDefinition{
}
import abstract class CBehTreePositioningRequest{
}
struct OnelinerDefinition{
var m_Target : CActor;
var m_Text : String;
var m_ID : Int32;
}
import abstract class SPositioningFilter{
}
state W3HorseComponentStateExploration in W3HorseComponent extends CScriptableSt
ate{
private var parentActor : CActor;
private var isStopping : Bool;
private var isSlowlyStopping : Bool;
private var destSpeed : Float;
private var currSpeed : Float;
private var staminaCooldown : Float;
private var staminaCooldownTimer : Float;
private var staminaBreak : Bool;
private var speedImpulseTimestamp : Float;
private var dismountRequest : Bool;
private var roadFollowBlock : Float;
private var speedLocks : array<CName>;
private var speedRestriction : Float;
private var useSimpleStaminaManagement : Bool;

private var inclinationCheckCollisionGroups : array<CName>;


private var waterCheckCollisionGroups : array<CName>;
private var threatSum : Float;
private var triedDoubleTap : Bool;
private var mac : CMovingAgentComponent;
private var isFollowingRoad : Bool;
private var shouldGoToCanterAfterStop : Bool;
private var currSpeedSound : Float;
private var desiredSpeedSound : Float;
private var jumpStartPos : Vector;
private var jumpEndPos : Vector;
private var noSaveLock : Int32;
public const var MIN_SPEED : Float;
public const var SLOW_SPEED : Float;
public const var WALK_SPEED : Float;
public const var TROT_SPEED : Float;
public const var GALLOP_SPEED : Float;
public const var CANTER_SPEED : Float;
public var threatApplicationTimestamp : Float;
private var dismountFinishedTimeStamp : Float;
private var timeAfterDismountFinished : Float;
public var cachedCombatAction : EVehicleCombatAction;
private var stopRequest : Bool;
private var isRefusingToGo : Bool;
public var collisionAnimTimestamp : Float;
public var collsionAnimCooldown : Float;
private var prediction : CHorsePrediction;
private const var INPUTMAG_TROT : Float;
private const var INPUTMAG_WALK : Float;
public const var HEADING_WT : Float;
public const var INPUT_WT : Float;
public const var NAVDATA_RADIUS : Float;
public const var NAVDATA_LENGTH_MOD_TROT : Float;
public const var NAVDATA_LENGTH_MOD_GALLOP : Float;
public const var NAVDATA_LENGTH_MOD_CANTER : Float;
public const var INCLINATION_MAX_ANGLE : Float;
public const var INCLINATION_BASE_DIST : Float;
public const var INCLINATION_TESTS_COUNT_TROT : Int32;
public const var INCLINATION_TESTS_COUNT_GALLOP : Int32;
public const var INCLINATION_TESTS_COUNT_CANTER : Int32;
public const var INCLINATION_Z_OFFSET : Float;
public const var WATER_MAX_DEPTH : Float;
public const var WATER_DIST_TROT : Float;
public const var WATER_DIST_GALLOP : Float;
public const var WATER_DIST_CANTER : Float;
private const var NAVTEST_RADIUS : Float;
private var rl : Float;
private var fb : Float;
private var startSlidingTimeStamp : Float;
private var notSlidingTimeStamp : Float;
private const var SLIDING_MINSLIDINGCOEF : Float;
private const var SLIDING_MAXSLIDINTIME : Float;
private const var SLIDING_MAXROTATIONSPEED : Float;
private var requestJump : Bool;
private var isInJumpAnim : Bool;
private var startTestingLanding : Bool;
private var maintainSpeedTimer : Float;
private var speedTimeoutValue : Float;
private var accelerateTimestamp : Float;
private const var DOUBLE_TAP_WINDOW : Float;

private var jumpPressTimestamp : Float;


private var voicsetTimeStamp : Float;
private var voicsetFasterTimeStamp : Float;
private var voicsetSlowerTimeSTamp : Float;
private const var VOICESET_COOLDOWN : Float;
private const var VOICESET_FASTER_COOLDOWN : Float;
private const var VOICESET_SLOWER_COOLDOWN : Float;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
theInput.RegisterListener(this, 'OnSpeedPress', 'Canter');
theInput.RegisterListener(this, 'OnSpeedHold', 'Gallop');
theInput.RegisterListener(this, 'OnDecelerate', 'Decelerate');
theInput.RegisterListener(this, 'OnStop', 'Stop');
theInput.RegisterListener(this, 'OnHorseJump', 'HorseJump');
theInput.RegisterListener(this, 'OnHorseDismountKeyboard', 'Hors
eDismount');
parentActor = (CActor)parent.GetEntity();
mac = parentActor.GetMovingAgentComponent();
parentActor.SetBehaviorVariable('isCanterEnabled', 0.000000, /*
NOP */);
super.Prepare();
InitCollisionGroups();
ResetSoundParameters();
mac.SetEnabledFeetIK(true, /* NOP */);
theGame.GetGuiManager().EnableHudHoldIndicator(137, 0, "panel_in
put_action_horsedismount", 0.400000, 'HorseDismount');
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
ResetForceStop();
super.Restore();
UnregisterInput();
mac.SetEnabledFeetIK(true, /* NOP */);
super.OnLeaveState(nextStateName);
/* NOP */;
}
private function UnregisterInput(){
theInput.UnregisterListener(this, 'Canter');
theInput.UnregisterListener(this, 'Gallop');
theInput.UnregisterListener(this, 'Decelerate');
theInput.UnregisterListener(this, 'Stop');
theInput.UnregisterListener(this, 'HorseJump');
theInput.UnregisterListener(this, 'HorseDismount');
theGame.GetGuiManager().DisableHudHoldIndicator();
/* NOP */;
}
private function IsSpeedLocked(ignoredLock : CName) : Bool{
if (ignoredLock != 'None'){
if (speedLocks.Size() == 1 && speedLocks.Contains(ignore
dLock)){
return false;
} else {
return speedLocks.Size() > 0;
}
} else {
return speedLocks.Size() > 0;
}
/* NOP */;
}
private function ToggleSpeedLock(lockName : CName, toggle : Bool){

if (toggle){
if (!speedLocks.Contains(lockName)){
speedLocks.PushBack(lockName);
}
} else {
speedLocks.Remove(lockName);
if (!speedLocks.Contains('OnStop') && lockName != 'OnGal
lop' && theInput.IsActionPressed('Gallop') && !dismountRequest && currSpeed <= G
ALLOP_SPEED){
if (shouldGoToCanterAfterStop){
destSpeed = CANTER_SPEED;
}
GallopPressed();
}
}
/* NOP */;
}
private function LeaveThisState(){
timeAfterDismountFinished = 0.000000;
parent.PopState(true);
/* NOP */;
}
public function OnTick(dt : Float) : Bool{
parent.OnTick(dt);
if (dismountRequest || thePlayer.IsActionAllowed(6)){
super.UpdateLogic(dt);
super.UpdateDebugGUI();
} else {
super.ResetRotation();
}
if (!parent.user){
timeAfterDismountFinished += dt;
if (timeAfterDismountFinished > 2.000000){
LeaveThisState();
}
}
/* NOP */;
}
public function OnMountStarted(entity : CEntity, vehicleSlot : EVehicleS
lot) : Bool{
parent.OnMountStarted(entity, vehicleSlot);
LeaveThisState();
/* NOP */;
}
public function OnMountFinished(entity : CEntity) : Bool{
parent.OnMountFinished(entity);
/* NOP */;
}
public function OnDismountStarted(entity : CEntity) : Bool{
thePlayer.SetBehaviorVariable('playerWouldLikeToMove', 0.000000,
/* NOP */);
UnregisterInput();
parent.OnDismountStarted(entity);
/* NOP */;
}
public function OnDismountFinished(entity : CEntity, vehicleSlot : EVehi
cleSlot) : Bool{
parent.OnDismountFinished(entity, vehicleSlot);
parent.ResetPanic();
timeAfterDismountFinished = 0.000000;

/* NOP */;
}
public function OnIdleBegin() : Bool{
parent.OnIdleBegin();
isInJumpAnim = false;
isStopping = false;
isSlowlyStopping = false;
if (!parent.user){
LeaveThisState();
}
ResetForceStop();
/* NOP */;
}
public function OnIdleEnd() : Bool{
parent.OnIdleEnd();
/* NOP */;
}
public function OnHorseFastStopBegin() : Bool{
isStopping = true;
/* NOP */;
}
public function OnHorseFastStopEnd() : Bool{
if (dismountRequest){
parent.IssueCommandToDismount(1);
}
isStopping = false;
/* NOP */;
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
var actorAttacker : CNewNPC;
var isMonster : Bool;
var threatMult : Int32;
if (parentActor.HasAbility('DisableHorsePanic') || thePlayer.Has
Buff(97)){
return false;
}
actorAttacker = (CNewNPC)action.attacker;
isMonster = actorAttacker.IsMonster();
if (isMonster){
threatMult = 2;
} else {
threatMult = 1;
}
parentActor.AddPanic(actorAttacker.GetThreatLevel() * 10 * threa
tMult);
/* NOP */;
}
public function OnCriticalEffectAdded(criticalEffect : ECriticalStateTyp
e) : Bool{
if (parentActor.HasAbility('DisableHorsePanic') || thePlayer.Has
Buff(97)){
if (thePlayer.IsActionAllowed(6)){
return false;
} else if (!isInJumpAnim){
parent.ShakeOffRider(2);
}
} else if (criticalEffect != 12){
parentActor.AddPanic(100);
}
/* NOP */;

}
public function OnCombatAction(action : EVehicleCombatAction) : Bool{
cachedCombatAction = action;
if (action == 3 || action == 0 || action == 1){
if (currSpeed > MIN_SPEED){
if (action != 3){
speedRestriction = GALLOP_SPEED;
}
ToggleSpeedLock('OnAttack', true);
}
} else if (action == 2){
speedRestriction = TROT_SPEED;
} else {
speedRestriction = GALLOP_SPEED;
}
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
speedRestriction = CANTER_SPEED;
ToggleSpeedLock('OnAttack', false);
/* NOP */;
}
public function OnSettlementEnter() : Bool{
if (thePlayer.GetIsHorseRacing()){
return false;
} else {
speedRestriction = GALLOP_SPEED;
if (currSpeed > speedRestriction){
thePlayer.DisplayActionDisallowedHudMessage(28,
/* NOP */, true, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
public function OnSettlementExit() : Bool{
speedRestriction = CANTER_SPEED;
/* NOP */;
}
public function OnCanGallop() : Bool{
return speedRestriction >= CANTER_SPEED && CanCanter();
/* NOP */;
}
public function OnCanCanter() : Bool{
if (speedRestriction >= GALLOP_SPEED){
return true;
}
return false;
/* NOP */;
}
public function OnStopTheVehicleInstant() : Bool{
super.Reset();
parent.OnStopTheVehicleInstant();
/* NOP */;
}
public function OnForceStop() : Bool{
destSpeed = MIN_SPEED;
speedRestriction = MIN_SPEED;
stopRequest = true;
/* NOP */;
}

public function OnHorseStop() : Bool{


destSpeed = MIN_SPEED;
/* NOP */;
}
private function ResetForceStop(){
if (stopRequest){
stopRequest = false;
speedRestriction = CANTER_SPEED;
}
/* NOP */;
}
public function OnJumpHack() : Bool{
if (!isInJumpAnim){
parent.GenerateEvent('jumpHACK');
}
/* NOP */;
}
public function OnHorseWalkBackWallStart() : Bool{
isRefusingToGo = true;
/* NOP */;
}
public function OnHorseWalkBackWallEnd() : Bool{
isRefusingToGo = false;
/* NOP */;
}
private function CanPlayCollisionAnim() : Bool{
return collisionAnimTimestamp + collsionAnimCooldown < theGame.G
etEngineTimeAsSeconds();
/* NOP */;
}
private final function Prepare(){
Reset();
if (!prediction){
prediction = new CHorsePrediction in this;
}
/* NOP */;
}
private final function Restore(){
Reset();
parent.InternalResetVariables();
thePlayer.GetVisualDebug().RemoveBar('horseSpeed');
thePlayer.GetVisualDebug().RemoveBar('horseStamina');
thePlayer.GetVisualDebug().RemoveBar('horseStaminaBar');
thePlayer.GetVisualDebug().RemoveBar('horsePanic');
thePlayer.GetVisualDebug().RemoveBar('pitch');
/* NOP */;
}
private final function Reset(){
currSpeed = MIN_SPEED;
destSpeed = MIN_SPEED;
speedLocks.Clear();
staminaBreak = false;
dismountRequest = false;
stopRequest = false;
isInJumpAnim = false;
isStopping = false;
startSlidingTimeStamp = -1.000000;
notSlidingTimeStamp = -1.000000;
parent.GetEntity().SetBehaviorVariable('rotationBlend', 0.000000
, /* NOP */);

theGame.ReleaseNoSaveLock(noSaveLock);
theGame.GetGuiManager().EnableHudHoldIndicator(137, 0, "panel_in
put_action_horsedismount", 0.400000, 'HorseDismount');
/* NOP */;
}
private final function ResetRotation(){
parent.InternalSetRotation(0.000000);
parent.InternalSetDirection(0.000000);
/* NOP */;
}
private final function ProcessControlInput(lr : Float, fb : Float, timeD
elta : Float, useLocalSpace : Bool){
var inputVec : Vector;
var inputVecInWS : Vector;
var mac : CMovingAgentComponent;
var horseHeadingInCamSpace : Float;
var dir : Float;
var rot : Float;
var inputMagnitude : Float;
var predInfo : SPredictionInfo;
var braking : Bool;
var prevDir : Float;
var steeringCorrection : Bool;
var stickInput : Bool;
if (!thePlayer.GetIsMovable() && !dismountRequest || speedRestri
ction == MIN_SPEED){
destSpeed = MIN_SPEED;
parent.InternalSetRotation(0.000000);
parent.InternalSetDirection(0.000000);
return;
}
if (lr || fb){
inputVec.X = lr;
inputVec.Y = fb;
if (useLocalSpace){
inputVecInWS = GetInputVectorInLocalSpace(lr, fb
);
} else {
inputVecInWS = GetInputVectorInCamSpace(lr, fb);
}
stickInput = true;
} else {
inputVec = parent.GetEntity().GetHeadingVector();
inputVecInWS = inputVec;
}
if (ShouldApplyCorrection(lr, fb)){
steeringCorrection = ApplyCorrection(inputVecInWS, dir,
lr, fb);
thePlayer.GetVisualDebug().AddText('SteeringCorrection',
"SteeringCorrection : On ", thePlayer.GetWorldPosition() + Vector(0.000000, 0.0
00000, 2.000000), true, /* NOP */, Color(0, 255, 0), /* NOP */, /* NOP */);
} else {
if (isFollowingRoad && roadFollowBlock == 0.000000){
roadFollowBlock = 1.000000;
isFollowingRoad = false;
mac = (CActor)parent.GetEntity().GetMovingAgentC
omponent();
mac.ResetRoadFollowing();
}
thePlayer.GetVisualDebug().AddText('SteeringCorrection',

"SteeringCorrection : Off", thePlayer.GetWorldPosition() + Vector(0.000000, 0.0


00000, 2.000000), true, /* NOP */, Color(255, 0, 0), /* NOP */, /* NOP */);
}
if (isFollowingRoad && lr || fb && roadFollowBlock == 0.000000){
roadFollowBlock = 1.000000;
isFollowingRoad = false;
mac = (CActor)parent.GetEntity().GetMovingAgentComponent
();
mac.ResetRoadFollowing();
}
if (lr || fb || steeringCorrection){
inputMagnitude = VecLength2D(inputVec);
if (steeringCorrection){
} else if (useLocalSpace){
dir = -VecHeading(inputVec);
} else {
horseHeadingInCamSpace = AngleDistance(theCamera
.GetCameraHeading(), parent.GetHeading());
dir = AngleDistance(-VecHeading(inputVec), horse
HeadingInCamSpace);
}
dir = AngleNormalize180(dir) / 180.000000;
if (steeringCorrection){
rot = dir * 2 * inputMagnitude;
} else if (useLocalSpace){
if (theInput.LastUsedGamepad()){
rot = ClampF(dir, -0.500000, 0.500000) *
inputMagnitude;
if (currSpeed <= TROT_SPEED){
rot *= 0.800000;
}
} else {
rot = dir;
}
} else if (currSpeed <= TROT_SPEED){
rot = 2 * dir * inputMagnitude;
} else {
rot = 1.500000 * dir * inputMagnitude;
}
prevDir = parent.InternalGetDirection();
if (speedLocks.Contains('OnStop') && AbsF(dir) < 0.17000
0){
parent.InternalSetRotation(0.000000);
parent.InternalSetDirection(0.000000);
} else if (inputMagnitude >= 0.900000 && useLocalSpace &
& AbsF(dir) >= 0.750000 || !useLocalSpace && AbsF(dir) > 0.750000 && AbsF(prevDi
r) < 0.170000 && destSpeed > MIN_SPEED && !parent.IsInCustomSpot()){
parent.InternalSetRotation(0.000000);
parent.InternalSetDirection(0.000000);
destSpeed = MIN_SPEED;
braking = true;
PlayVoicesetSlowerHorse();
} else if (parent.riderSharedParams.mountStatus != 0){
if (prevDir > 0.900000 && dir < -0.700000){
if (useLocalSpace){
parent.InternalSetRotation(0.500
000);
} else {
parent.InternalSetRotation(1.000
000);

}
parent.InternalSetDirection(1.000000);
} else if (prevDir < -0.900000 && dir > 0.700000
){
if (useLocalSpace){
parent.InternalSetRotation(-0.50
0000);
} else {
parent.InternalSetRotation(-1.00
0000);
}
parent.InternalSetDirection(-1.000000);
} else {
parent.InternalSetRotation(rot);
parent.InternalSetDirection(dir);
}
}
if (braking){
} else if (!IsSpeedLocked(/* NOP */) && stickInput && cu
rrSpeed < GALLOP_SPEED && currSpeed > MIN_SPEED || AbsF(dir) < 0.050000){
if (currSpeed < TROT_SPEED){
if (inputMagnitude > INPUTMAG_TROT){
destSpeed = TROT_SPEED;
} else if (inputMagnitude > INPUTMAG_WAL
K){
destSpeed = WALK_SPEED;
} else {
destSpeed = SLOW_SPEED;
}
SpursKick();
speedImpulseTimestamp = theGame.GetEngin
eTimeAsSeconds();
}
}
} else {
ResetRotation();
if (speedImpulseTimestamp + 0.200000 > theGame.GetEngine
TimeAsSeconds()){
destSpeed = MIN_SPEED;
}
if (destSpeed > MIN_SPEED){
predInfo = prediction.CollectPredictionInfo(pare
nt, 10.000000, 0.000000, parent.inWater);
if (predInfo.turnAngle != 0.000000){
dir = -predInfo.turnAngle / 180.000000;
rot = dir;
parent.InternalSetRotation(rot);
parent.InternalSetDirection(dir);
}
}
}
if (IsRiderInCombatAction()){
OnCombatAction(cachedCombatAction);
}
/* NOP */;
}
private function ShouldApplyCorrection(stickInputX : Float, stickInputY
: Float) : Bool{
var inputVec : Vector;
var inputHeading : Float;

var horseHeading : Float;


var angleDistanceBetweenInputAndHorse : Float;
inputVec = GetInputVectorInCamSpace(stickInputX, stickInputY);
angleDistanceBetweenInputAndHorse = AbsF(AngleDistance(VecHeadin
g(inputVec), parent.GetHeading()));
if (!stickInputX && !stickInputY){
if (theInput.IsActionPressed('Canter')){
return true;
} else {
return false;
}
} else if (currSpeed > TROT_SPEED && angleDistanceBetweenInputAn
dHorse > 55.000000){
return false;
} else if (currSpeed > MIN_SPEED && angleDistanceBetweenInputAnd
Horse < 55.000000){
return true;
} else if (isStopping){
return true;
} else {
return false;
}
/* NOP */;
}
private function ApplyCorrection(inputVector : Vector, correctedDir : Fl
oat, stickInputX : Float, stickInputY : Float) : Bool{
var stickInput : Bool;
var horseHeadingVec : Vector;
var mac : CMovingAgentComponent;
var currentDir : Float;
var speed : Float;
var speedModifier : Float;
var dirModifier : Float;
var followRoad : Bool;
var maxAngleForAdjustingDir : Float;
var cachedVec : Vector;
var correctedDirV : Vector;
var desiredDirectionVec : Vector;
var angleDistance : Float;
var startPos : Vector;
var endPos : Vector;
dirModifier = 1.000000;
stickInput = stickInputX || stickInputY;
horseHeadingVec = parent.GetEntity().GetHeadingVector();
mac = (CActor)parent.GetEntity().GetMovingAgentComponent();
currentDir = parent.GetEntity().GetHeading();
speedModifier = MaxF(0.250000, stickInputY);
if (currSpeed == CANTER_SPEED){
speed = 18.750000;
if (!stickInput && !thePlayer.GetIsHorseRacing()){
dirModifier = 3.000000;
followRoad = true;
maxAngleForAdjustingDir = 90.000000;
} else {
dirModifier = 2.000000;
speed *= speedModifier;
maxAngleForAdjustingDir = 15.000000;
}
correctedDirV = VecNormalize2D(inputVector * 0.300000 +
horseHeadingVec * 0.700000);

} else if (currSpeed == GALLOP_SPEED){


speed = 12.500000;
if (!stickInput && !thePlayer.GetIsHorseRacing()){
dirModifier = 2.000000;
followRoad = true;
maxAngleForAdjustingDir = 90.000000;
} else {
dirModifier = 2.000000;
speed *= speedModifier;
maxAngleForAdjustingDir = 15.000000;
}
correctedDirV = VecNormalize2D(inputVector * 0.300000 +
horseHeadingVec * 0.700000);
} else {
speed = 3.750000 * speedModifier;
dirModifier = 1.500000;
maxAngleForAdjustingDir = 90.000000;
correctedDirV = VecNormalize2D(inputVector * 0.400000 +
horseHeadingVec * 0.600000);
}
cachedVec = correctedDirV;
desiredDirectionVec = inputVector;
if (followRoad && !thePlayer.GetIsHorseRacing() && roadFollowBlo
ck == 0.000000){
if (mac.StartRoadFollowing(speed, 45.000000, 10.000000,
correctedDirV)){
isFollowingRoad = true;
} else {
isFollowingRoad = false;
}
}
if (!parent.IsInCustomSpot()){
if (!isFollowingRoad){
mac.AdjustRequestedMovementDirectionNavMesh(corr
ectedDirV, speed, maxAngleForAdjustingDir, 10, 6, desiredDirectionVec, /* NOP */
);
}
} else if (currSpeed > TROT_SPEED){
isFollowingRoad = true;
}
if (cachedVec == correctedDirV){
correctedDirV = inputVector;
}
correctedDir = VecHeading(correctedDirV);
angleDistance = AngleDistance(currentDir, correctedDir);
correctedDir = ClampF(angleDistance * dirModifier, -180, 180);
startPos = parent.GetEntity().GetWorldPosition();
endPos = startPos + speed * correctedDirV;
(CActor)parent.GetEntity().GetVisualDebug().AddArrow('correction
Line', startPos, endPos, 1, 0.300000, 0.300000, true, Color(255, 255, 255), true
, 1.000000);
return true;
/* NOP */;
}
private function ShouldStopBecauseOfCorrection(inputVecInWS : Vector, co
rrectionVec : Vector) : Bool{
var angleDistBetwenHorseHeadingAndInput : Float;
var angleDistBetwenHorseHeadingAndCorrection : Float;
var angleDistBetwenInputAndCorrection : Float;
var horseHeading : Float;

horseHeading = parent.GetEntity().GetHeading();
angleDistBetwenHorseHeadingAndInput = AngleDistance(horseHeading
, VecHeading(inputVecInWS));
angleDistBetwenHorseHeadingAndCorrection = AngleDistance(horseHe
ading, VecHeading(correctionVec));
angleDistBetwenInputAndCorrection = AngleDistance(VecHeading(inp
utVecInWS), VecHeading(correctionVec));
if (AbsF(angleDistBetwenInputAndCorrection) < 10){
return false;
}
if (AbsF(angleDistBetwenHorseHeadingAndInput) > 45 && AbsF(angle
DistBetwenHorseHeadingAndCorrection) > 150 || AbsF(angleDistBetwenInputAndCorrec
tion) > 45){
return true;
}
return false;
/* NOP */;
}
private function PerformNavDataTest() : Bool{
var startPoint : Vector;
var endPoint : Vector;
var initialHeading : Vector;
var lengthMod : Float;
startPoint = parent.GetWorldPosition();
initialHeading = parent.GetHeadingVector();
if (currSpeed <= TROT_SPEED){
lengthMod = NAVDATA_LENGTH_MOD_TROT;
} else if (currSpeed == GALLOP_SPEED){
lengthMod = NAVDATA_LENGTH_MOD_GALLOP;
} else {
lengthMod = NAVDATA_LENGTH_MOD_CANTER;
}
endPoint = startPoint + initialHeading * lengthMod;
if (theGame.GetWorld().NavigationLineTest(startPoint, endPoint,
NAVDATA_RADIUS, false, true)){
return true;
}
return false;
/* NOP */;
}
private function PerformInclinationTest(stickInputX : Float, stickInputY
: Float) : Bool{
var startPoint : Vector;
var rawEndPoint : Vector;
var tempEndPoint : Vector;
var linkingStartPoint : Vector;
var linkingEndPoint : Vector;
var linkingTempPoint : Vector;
var normal : Vector;
var initialHeading : Vector;
var inputVec : Vector;
var horseHeadingVec : Vector;
var angle : Float;
var i : Int32;
var iterationsCount : Int32;
var speed : Float;
startPoint = parent.GetWorldPosition();
speed = MaxF(currSpeed, destSpeed);
if (stickInputX || stickInputY){
inputVec = GetInputVectorInCamSpace(stickInputX, stickIn

putY);
horseHeadingVec = parent.GetHeadingVector();
initialHeading = VecNormalize2D(inputVec * 0.500000 + ho
rseHeadingVec * 1.000000);
} else {
initialHeading = parent.GetHeadingVector();
}
if (speed <= TROT_SPEED){
iterationsCount = INCLINATION_TESTS_COUNT_TROT;
} else if (speed == GALLOP_SPEED){
iterationsCount = INCLINATION_TESTS_COUNT_GALLOP;
} else {
iterationsCount = INCLINATION_TESTS_COUNT_CANTER;
}
i = 0;
while (i < iterationsCount){
rawEndPoint = startPoint + initialHeading * INCLINATION_
BASE_DIST;
angle = GetInclinationBetweenPoints(startPoint, rawEndPo
int, tempEndPoint, INCLINATION_Z_OFFSET);
if (angle == 180.000000){
return false;
}
if (i < 2){
linkingStartPoint = startPoint;
linkingStartPoint.Z += 2.350000;
linkingEndPoint = tempEndPoint;
linkingEndPoint.Z += 0.500000;
if (theGame.GetWorld().StaticTrace(linkingStartP
oint, linkingEndPoint, linkingTempPoint, normal, inclinationCheckCollisionGroups
)){
return false;
}
}
if (angle < -INCLINATION_MAX_ANGLE){
return false;
} else if (angle > INCLINATION_MAX_ANGLE){
if (currSpeed > TROT_SPEED){
destSpeed = MinF(currSpeed, TROT_SPEED);
} else {
return false;
}
}
switch(i){
case 0:
(CActor)parent.GetEntity().GetVisualDebug().AddS
phere('c1', 1, tempEndPoint, true, Color(255, 1, 0), 3.000000);
break;
case 1:
(CActor)parent.GetEntity().GetVisualDebug().AddS
phere('c2', 1, tempEndPoint, true, Color(255, 1, 0), 3.000000);
break;
case 2:
(CActor)parent.GetEntity().GetVisualDebug().AddS
phere('c3', 1, tempEndPoint, true, Color(255, 1, 0), 3.000000);
break;
case 3:
(CActor)parent.GetEntity().GetVisualDebug().AddS
phere('c4', 1, tempEndPoint, true, Color(255, 1, 0), 3.000000);
break;

case 4:
(CActor)parent.GetEntity().GetVisualDebug().AddS
phere('c5', 1, tempEndPoint, true, Color(255, 1, 0), 3.000000);
break;
default:
break;
}
startPoint = tempEndPoint;
i += 1;
}
return true;
/* NOP */;
}
private function GetInclinationBetweenPoints(startPoint : Vector, rawEnd
Point : Vector, endPoint : Vector, zOffset : Float) : Float{
var rawEndPointWithZOffsetUp : Vector;
var rawEndPointWithZOffsetDown : Vector;
var normal : Vector;
var heightDiff : Float;
rawEndPointWithZOffsetUp = rawEndPoint;
rawEndPointWithZOffsetUp.Z += zOffset;
rawEndPointWithZOffsetDown = rawEndPoint;
rawEndPointWithZOffsetDown.Z -= zOffset;
if (!theGame.GetWorld().SweepTest(rawEndPointWithZOffsetUp, rawE
ndPointWithZOffsetDown, 0.050000, endPoint, normal, inclinationCheckCollisionGro
ups)){
return 180.000000;
}
if (startPoint.Z * endPoint.Z >= 0){
heightDiff = AbsF(startPoint.Z - endPoint.Z);
} else {
heightDiff = AbsF(startPoint.Z) + AbsF(endPoint.Z);
}
if (startPoint.Z >= endPoint.Z){
return -Rad2Deg(AtanF(heightDiff, INCLINATION_BASE_DIST)
);
} else {
return Rad2Deg(AtanF(heightDiff, INCLINATION_BASE_DIST))
;
}
/* NOP */;
}
private function GetLocalInclination(inPoint : Vector) : Float{
var startPoint : Vector;
var rawEndPoint : Vector;
var tempEndPoint : Vector;
var initialHeading : Vector;
if (inPoint != Vector(0, 0, 0)){
startPoint = inPoint;
} else {
startPoint = parent.GetWorldPosition();
}
initialHeading = parent.GetHeadingVector();
rawEndPoint = startPoint + initialHeading * 1.500000;
return GetInclinationBetweenPoints(startPoint, rawEndPoint, temp
EndPoint, 2.000000);
/* NOP */;
}
private function PerformWaterTest(stickInputX : Float, stickInputY : Flo
at) : Bool{

var startPoint : Vector;


var endPoint : Vector;
var cachedEndPoint : Vector;
var bridgeCheckUp : Vector;
var bridgeCheckDown : Vector;
var bridgeCheckOutPoint : Vector;
var normal : Vector;
var initialHeading : Vector;
var inputVec : Vector;
var horseHeadingVec : Vector;
var waterDepth : Float;
var speed : Float;
startPoint = parent.GetWorldPosition();
speed = MaxF(currSpeed, destSpeed);
if (stickInputX || stickInputY){
inputVec = GetInputVectorInCamSpace(stickInputX, stickIn
putY);
horseHeadingVec = parent.GetHeadingVector();
initialHeading = VecNormalize2D(inputVec * 0.500000 + ho
rseHeadingVec * 1.000000);
} else {
initialHeading = parent.GetHeadingVector();
}
if (speed <= TROT_SPEED){
endPoint = startPoint + initialHeading * WATER_DIST_TROT
;
cachedEndPoint = endPoint;
endPoint.Z += WATER_DIST_TROT + 1.000000;
} else if (speed == GALLOP_SPEED){
endPoint = startPoint + initialHeading * WATER_DIST_GALL
OP;
cachedEndPoint = endPoint;
endPoint.Z += WATER_DIST_GALLOP + 1.000000;
} else {
endPoint = startPoint + initialHeading * WATER_DIST_CANT
ER;
cachedEndPoint = endPoint;
endPoint.Z += WATER_DIST_CANTER + 1.000000;
}
bridgeCheckUp = cachedEndPoint;
bridgeCheckUp.Z += 5.000000;
bridgeCheckDown = cachedEndPoint;
bridgeCheckDown.Z -= 10.000000;
if (theGame.GetWorld().SweepTest(bridgeCheckUp, bridgeCheckDown,
0.050000, bridgeCheckOutPoint, normal, waterCheckCollisionGroups)){
return true;
}
waterDepth = theGame.GetWorld().GetWaterDepth(endPoint, true);
if (waterDepth < WATER_MAX_DEPTH || waterDepth == 10000.000000){
return true;
} else {
return false;
}
/* NOP */;
}
private function PerformWaterJumpTest() : Bool{
var startPoint : Vector;
var endPoint : Vector;
var endPointWithBuffer : Vector;
var bridgeCheckUp : Vector;

var bridgeCheckDown : Vector;


var bridgeCheckOutPoint : Vector;
var normal : Vector;
var initialHeading : Vector;
var horseHeadingVec : Vector;
var waterDepth : Float;
var testedPoints : array<Vector>;
var i : Int32;
startPoint = parent.GetWorldPosition();
initialHeading = parent.GetHeadingVector();
if (currSpeed <= TROT_SPEED){
endPoint = startPoint + initialHeading * 5.000000;
endPointWithBuffer = startPoint + initialHeading * 10.00
0000;
} else if (currSpeed == GALLOP_SPEED){
endPoint = startPoint + initialHeading * 8.000000;
endPointWithBuffer = startPoint + initialHeading * 14.00
0000;
} else {
endPoint = startPoint + initialHeading * 9.000000;
endPointWithBuffer = startPoint + initialHeading * 22.00
0000;
}
testedPoints.PushBack(endPoint);
testedPoints.PushBack(endPointWithBuffer);
i = 0;
while (i < 2){
bridgeCheckUp = testedPoints[i];
bridgeCheckUp.Z += 5.000000;
bridgeCheckDown = testedPoints[i];
bridgeCheckDown.Z -= 10.000000;
if (!theGame.GetWorld().SweepTest(bridgeCheckUp, bridgeC
heckDown, 0.050000, bridgeCheckOutPoint, normal, waterCheckCollisionGroups)){
waterDepth = theGame.GetWorld().GetWaterDepth(te
stedPoints[i], true);
if (waterDepth > WATER_MAX_DEPTH && waterDepth !
= 10000.000000){
return false;
}
}
i += 1;
}
return true;
/* NOP */;
}
private function PerformFallJumpTest() : Bool{
var startPoint : Vector;
var endPoint : Vector;
var endPointWithZOffsetUp : Vector;
var endPointWithZOffsetDown : Vector;
var intersectionPoint : Vector;
var tempVector : Vector;
var afterLandingEndPoint : Vector;
var initialHeading : Vector;
var anticipationDist : Float;
var afterLandingDist : Float;
var angle : Float;
startPoint = parent.GetWorldPosition();
initialHeading = parent.GetHeadingVector();
if (currSpeed <= TROT_SPEED){

anticipationDist = 5.000000;
afterLandingDist = 4.000000;
} else if (currSpeed == GALLOP_SPEED){
anticipationDist = 7.000000;
afterLandingDist = 5.000000;
} else {
anticipationDist = 9.000000;
afterLandingDist = 6.000000;
}
endPoint = startPoint + initialHeading * anticipationDist;
endPointWithZOffsetUp = endPoint;
endPointWithZOffsetUp.Z += 10.000000;
endPointWithZOffsetDown = endPoint;
if (theGame.GetWorld().StaticTrace(endPointWithZOffsetUp, endPoi
ntWithZOffsetDown, intersectionPoint, tempVector, inclinationCheckCollisionGroup
s)){
afterLandingEndPoint = intersectionPoint + initialHeadin
g * afterLandingDist;
angle = GetInclinationBetweenPoints(intersectionPoint, a
fterLandingEndPoint, tempVector, 4.500000);
if (angle < -INCLINATION_MAX_ANGLE || angle > INCLINATIO
N_MAX_ANGLE){
return false;
} else {
angle = GetInclinationBetweenPoints(afterLanding
EndPoint, afterLandingEndPoint - parent.GetWorldRight() * 0.500000, tempVector,
4.500000);
if (angle < -INCLINATION_MAX_ANGLE || angle > IN
CLINATION_MAX_ANGLE || angle > 90){
return false;
}
angle = GetInclinationBetweenPoints(afterLanding
EndPoint, afterLandingEndPoint + parent.GetWorldRight() * 0.500000, tempVector,
4.500000);
if (angle < -INCLINATION_MAX_ANGLE || angle > IN
CLINATION_MAX_ANGLE || angle > 90){
return false;
}
angle = GetLocalInclination(tempVector);
if (angle < -INCLINATION_MAX_ANGLE || angle > IN
CLINATION_MAX_ANGLE){
return false;
} else {
return true;
}
}
}
endPointWithZOffsetUp = endPoint;
endPointWithZOffsetDown = startPoint + initialHeading * anticipa
tionDist + 4.000000;
endPointWithZOffsetDown.Z -= 8.000000;
if (!theGame.GetWorld().StaticTrace(endPointWithZOffsetUp, endPo
intWithZOffsetDown, intersectionPoint, tempVector, inclinationCheckCollisionGrou
ps)){
return false;
} else {
afterLandingEndPoint = intersectionPoint + initialHeadin
g * afterLandingDist;
angle = GetInclinationBetweenPoints(intersectionPoint, a
fterLandingEndPoint, tempVector, 4.500000);

if (angle < -INCLINATION_MAX_ANGLE || angle > INCLINATIO


N_MAX_ANGLE){
return false;
} else {
angle = GetLocalInclination(tempVector);
if (angle < -INCLINATION_MAX_ANGLE || angle > IN
CLINATION_MAX_ANGLE){
return false;
} else {
return true;
}
}
}
return true;
/* NOP */;
}
private function PerformObstructionJumpTest() : Bool{
var startPoint : Vector;
var endPoint : Vector;
var tempEndPoint : Vector;
var normal : Vector;
var initialHeading : Vector;
startPoint = parent.GetWorldPosition();
initialHeading = parent.GetHeadingVector();
endPoint = startPoint + initialHeading * 3.000000;
startPoint.Z += 1.500000;
endPoint.Z += 1.500000;
if (theGame.GetWorld().StaticTrace(startPoint, endPoint, tempEnd
Point, normal, inclinationCheckCollisionGroups)){
return false;
}
return true;
/* NOP */;
}
private function PerformAutoJumpTest(stickInputX : Float, stickInputY :
Float) : Bool{
var startPoint : Vector;
var testedHeading : Vector;
var inputVec : Vector;
var horseHeadingVec : Vector;
var furthestAccessiblePointForJumpTest : Vector;
var angleDistanceBetweenInputAndHorse : Float;
var angleDistanceBetweenCameraAndHorse : Float;
var anticipationDist : Float;
var afterLandingDist : Float;
startPoint = parent.GetWorldPosition();
if (stickInputX || stickInputY){
inputVec = GetInputVectorInCamSpace(stickInputX, stickIn
putY);
horseHeadingVec = parent.GetHeadingVector();
testedHeading = VecNormalize2D(inputVec * 0.250000 + hor
seHeadingVec * 1.000000);
} else {
testedHeading = parent.GetHeadingVector();
}
if (theInput.IsActionPressed('Canter')){
if (!LineTest(startPoint, testedHeading, 2.500000, 1.000
000, furthestAccessiblePointForJumpTest, true)){
if (SweepTest(startPoint, testedHeading, anticip
ationDist, 0.900000, 0.450000)){

return false;
}
angleDistanceBetweenInputAndHorse = AbsF(AngleDi
stance(VecHeading(inputVec), parent.GetHeading()));
angleDistanceBetweenCameraAndHorse = AbsF(AngleD
istance(VecHeading(theCamera.GetCameraDirection()), parent.GetHeading()));
if (!stickInputX || stickInputY && angleDistance
BetweenCameraAndHorse <= 45 || stickInputX || stickInputY && angleDistanceBetwee
nInputAndHorse <= 45){
if (currSpeed == CANTER_SPEED){
anticipationDist = 8.000000;
afterLandingDist = 4.000000;
} else {
anticipationDist = 6.500000;
afterLandingDist = 3.000000;
}
if (CircleTest(startPoint, testedHeading
, anticipationDist, 0.500000)){
if (SweepTest(startPoint, tested
Heading, anticipationDist, 2.100000, 0.750000)){
if (LineTest(startPoint
+ testedHeading * anticipationDist, testedHeading, afterLandingDist, 0.000000, f
urthestAccessiblePointForJumpTest, /* NOP */)){
return true;
}
}
}
}
}
}
return false;
/* NOP */;
}
private function GetInputVectorInCamSpace(stickInputX : Float, stickInpu
tY : Float) : Vector{
var inputVec : Vector;
var inputHeading : Float;
inputVec.X = stickInputX;
inputVec.Y = stickInputY;
inputVec = VecNormalize2D(inputVec);
inputHeading = AngleDistance(theCamera.GetCameraHeading(), -VecH
eading(inputVec));
inputVec = VecFromHeading(inputHeading);
return inputVec;
/* NOP */;
}
private function GetInputVectorInLocalSpace(stickInputX : Float, stickIn
putY : Float) : Vector{
var inputVec : Vector;
var inputHeading : Float;
inputVec.X = stickInputX;
inputVec.Y = stickInputY;
inputVec = VecNormalize2D(inputVec);
inputHeading = AngleDistance(parent.GetEntity().GetHeading(), -V
ecHeading(inputVec));
inputVec = VecFromHeading(inputHeading);
return inputVec;
/* NOP */;
}
private function LineTest(startPos : Vector, heading : Vector, anticipat

ionDist : Float, speedFactor : Float, furthestAccessiblePoint : Vector, sideTest


s : Bool) : Bool{
var endPos : Vector;
var endPosLeft : Vector;
var endPosRight : Vector;
endPos = startPos + heading * anticipationDist + parent.GetHeadi
ngVector() * speedFactor * currSpeed;
if (theGame.GetWorld().NavigationLineTest(startPos, endPos, NAVT
EST_RADIUS, false, true)){
return true;
} else if (sideTests){
endPosLeft = startPos + VecRotateAxis(endPos - startPos,
Vector(0, 0, 1), Deg2Rad(30.000000));
endPosRight = startPos + VecRotateAxis(endPos - startPos
, Vector(0, 0, 1), Deg2Rad(-30.000000));
if (theGame.GetWorld().NavigationLineTest(startPos, endP
osLeft, NAVTEST_RADIUS, false, true)){
return true;
} else if (theGame.GetWorld().NavigationLineTest(startPo
s, endPosRight, 0.150000, false, true)){
return true;
} else {
theGame.GetWorld().NavigationClearLineInDirectio
n(startPos, endPos, NAVTEST_RADIUS, furthestAccessiblePoint);
return false;
}
} else {
theGame.GetWorld().NavigationClearLineInDirection(startP
os, endPos, NAVTEST_RADIUS, furthestAccessiblePoint);
return false;
}
/* NOP */;
}
private function CircleTest(startPos : Vector, heading : Vector, anticip
ationDist : Float, radius : Float) : Bool{
var endPos : Vector;
var dummyFloat : Float;
endPos = startPos + heading * anticipationDist;
if (theGame.GetWorld().NavigationCircleTest(endPos, radius, /* N
OP */)){
if (theGame.GetWorld().NavigationComputeZ(endPos, endPos
.Z - 4.000000, endPos.Z + 1.000000, dummyFloat)){
return true;
} else {
return false;
}
} else {
return false;
}
/* NOP */;
}
private function SweepTest(startPos : Vector, heading : Vector, anticipa
tionDist : Float, heightOffset : Float, radius : Float) : Bool{
var endPos : Vector;
var outPos : Vector;
var normal : Vector;
endPos = startPos + heading * anticipationDist;
startPos.Z += heightOffset;
endPos.Z += heightOffset;
if (!theGame.GetWorld().SweepTest(startPos, endPos, radius, outP

os, normal, inclinationCheckCollisionGroups)){


return true;
} else {
return false;
}
/* NOP */;
}
private final function UpdateLogic(dt : Float){
var actorParent : CActor;
var player : W3PlayerWitcher;
var slidingDisablesControll : Bool;
if (GetSubmergeDepth() < -2.000000 || CheckSliding(slidingDisabl
esControll)){
OnHideHorse();
}
if (roadFollowBlock > 0.000000){
roadFollowBlock -= dt;
if (roadFollowBlock < 0.000000){
roadFollowBlock = 0.000000;
}
}
useSimpleStaminaManagement = parent.ShouldUseSimpleStaminaManage
ment();
if (thePlayer.GetIsMovable() && IsHorseControllable() && !dismou
ntRequest && !slidingDisablesControll){
rl = theInput.GetActionValue('GI_AxisLeftX');
fb = theInput.GetActionValue('GI_AxisLeftY');
} else {
rl = 0.000000;
fb = 0.000000;
}
parent.inputApplied = rl || fb;
SetTimeoutForCurrentSpeed();
MaintainCameraVariables(dt);
if (!useSimpleStaminaManagement && destSpeed > GALLOP_SPEED || !
IsSpeedLocked(/* NOP */) && destSpeed > MIN_SPEED && !rl && !fb || !IsSpeedLocke
d(/* NOP */) && destSpeed > TROT_SPEED){
if (maintainSpeedTimer > speedTimeoutValue){
destSpeed = MaxF(MIN_SPEED, destSpeed - 1.000000
);
maintainSpeedTimer = 0.000000;
} else {
maintainSpeedTimer += dt;
}
}
actorParent = (CActor)parent.GetEntity();
if (useSimpleStaminaManagement && currSpeed > GALLOP_SPEED && !i
sFollowingRoad){
actorParent.DrainStamina(13, 3.330000 * dt, 1.000000, 'N
one', 0.000000, 1.000000);
if (actorParent.GetStat(2, /* NOP */) <= 0.000000){
staminaBreak = true;
staminaCooldownTimer = 0.000000;
theGame.VibrateControllerVeryLight(/* NOP */);
}
}
destSpeed = MinF(destSpeed, speedRestriction);
if (currSpeed > destSpeed && currSpeed < GALLOP_SPEED){
PlayVoicesetSlowerHorse();
}

ProcessControlInput(rl, fb, dt, parent.IsControllableInLocalSpac


e() || parent.riderSharedParams.mountStatus == 0);
if (!PerformNavDataTest() && !isInJumpAnim){
if (PerformInclinationTest(rl, fb) && PerformWaterTest(r
l, fb)){
ToggleSpeedLock('OnNavStop', false);
if (PerformAutoJumpTest(rl, fb)){
Jump();
}
} else if (!isFollowingRoad && !parent.ShouldIgnoreTests
()){
destSpeed = MIN_SPEED;
ToggleSpeedLock('OnNavStop', true);
if (!isRefusingToGo && parent.isInIdle && CanPla
yCollisionAnim() && rl != 0.000000 || fb != 0.000000){
parent.GenerateEvent('WallCollision');
collisionAnimTimestamp = theGame.GetEngi
neTimeAsSeconds();
}
} else {
ToggleSpeedLock('OnNavStop', false);
}
} else {
ToggleSpeedLock('OnNavStop', false);
}
if (requestJump){
if (PerformObstructionJumpTest() && PerformWaterJumpTest
() && PerformFallJumpTest()){
Jump();
} else {
if (!isRefusingToGo && parent.isInIdle && CanPla
yCollisionAnim()){
parent.GenerateEvent('WallCollision');
collisionAnimTimestamp = theGame.GetEngi
neTimeAsSeconds();
}
requestJump = false;
}
}
if (staminaBreak){
if (staminaCooldownTimer > staminaCooldown){
staminaBreak = false;
}
staminaCooldownTimer += dt;
currSpeed = MinF(GALLOP_SPEED, currSpeed);
destSpeed = currSpeed;
}
if (currSpeed != destSpeed){
currSpeed = destSpeed;
if (currSpeed == MIN_SPEED && !parent.isInIdle){
isSlowlyStopping = true;
} else {
isSlowlyStopping = false;
}
}
parent.InternalSetSpeedMultiplier(1.000000);
parent.InternalSetSpeed(currSpeed);
CalculateSoundParameters(dt);
thePlayer.SoundParameter("horse_speed", currSpeedSound, 'head',
/* NOP */, /* NOP */);

actorParent.SoundParameter("horse_stamina", actorParent.GetStatP
ercents(2) * 100, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
private final function CheckSliding(_slidingDisablesControll : Bool) : B
ool{
var mac : CMovingPhysicalAgentComponent;
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
var emptyTicket : SMovementAdjustmentRequestTicket;
var l_sliding : Bool;
var l_onGround : Bool;
var l_slidingTime : Float;
var l_slideCoef : Float;
var l_slideDir : Vector;
_slidingDisablesControll = false;
mac = (CMovingPhysicalAgentComponent)parentActor.GetMovingAgentC
omponent();
if (mac){
l_sliding = mac.IsSliding();
l_onGround = mac.IsOnGround();
if (l_sliding || !l_onGround && !isInJumpAnim){
notSlidingTimeStamp = -1.000000;
if (startSlidingTimeStamp <= 0.000000){
startSlidingTimeStamp = theGame.GetEngin
eTimeAsSeconds();
}
if (l_sliding){
l_slideDir = mac.GetSlideDir();
l_slideCoef = mac.GetSlideCoef();
/* NOP */;
movementAdjustor = mac.GetMovementAdjust
or();
ticket = movementAdjustor.GetRequest('Ho
rseSliding');
if (ticket == emptyTicket){
ticket = movementAdjustor.Create
NewRequest('HorseSliding');
}
movementAdjustor.MaxRotationAdjustmentSp
eed(ticket, SLIDING_MAXROTATIONSPEED);
movementAdjustor.RotateTo(ticket, VecHea
ding(l_slideDir));
_slidingDisablesControll = true;
}
l_slidingTime = theGame.GetEngineTimeAsSeconds()
- startSlidingTimeStamp;
if (l_slidingTime >= SLIDING_MAXSLIDINTIME && l_
slideCoef >= SLIDING_MINSLIDINGCOEF){
/* NOP */;
return true;
}
} else {
movementAdjustor = mac.GetMovementAdjustor();
movementAdjustor.CancelByName('HorseSliding');
mac.SetEnabledFeetIK(true, 0.500000);
if (notSlidingTimeStamp <= 0){
notSlidingTimeStamp = theGame.GetEngineT
imeAsSeconds();
}

if (theGame.GetEngineTimeAsSeconds() - notSlidin
gTimeStamp >= 0.500000){
if (startSlidingTimeStamp > 0.000000){
l_slidingTime = theGame.GetEngin
eTimeAsSeconds() - startSlidingTimeStamp;
/* NOP */;
}
startSlidingTimeStamp = -1.000000;
}
}
}
return false;
/* NOP */;
}
private final function Jump(){
if (!(CActor)parent.GetEntity().IsInAir()){
parent.GenerateEvent('jump');
}
requestJump = false;
/* NOP */;
}
public function OnBehJumpStarted() : Bool{
var horse : CActor;
horse = (CActor)parent.GetEntity();
isInJumpAnim = true;
requestJump = false;
startTestingLanding = false;
jumpStartPos = parent.GetEntity().GetWorldPosition();
parent.SetVariable('onGround', 0.000000);
horse.AddAnimEventChildCallback(parent, 'Jumping', 'OnAnimEvent_
Jumping');
(CMovingPhysicalAgentComponent)horse.GetMovingAgentComponent().S
etAnimatedMovement(true);
horse.SetIsInAir(true);
parent.userCombatManager.OnAirBorn();
theGame.CreateNoSaveLock('horse_in_air', noSaveLock, /* NOP */,
/* NOP */);
theGame.GetGuiManager().DisableHudHoldIndicator();
/* NOP */;
}
public function OnBehJumpEnded() : Bool{
var horse : CActor;
horse = (CActor)parent.GetEntity();
horse.RemoveAnimEventChildCallback(parent, 'Jumping');
isInJumpAnim = false;
theGame.ReleaseNoSaveLock(noSaveLock);
if (parent.user == thePlayer){
theGame.GetGuiManager().EnableHudHoldIndicator(137, 0, "
panel_input_action_horsedismount", 0.400000, 'HorseDismount');
}
/* NOP */;
}
public function OnHideHorse() : Bool{
parent.OnHideHorse();
/* NOP */;
}
public function OnKillHorse() : Bool{
parent.OnKillHorse();
/* NOP */;
}

public function OnAnimEvent_Jumping(animEventName : CName, animEventType


: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var mac : CMovingPhysicalAgentComponent;
if (animEventType == 1){
startTestingLanding = true;
} else {
mac = (CMovingPhysicalAgentComponent)(CActor)parent.GetE
ntity().GetMovingAgentComponent();
if (mac.IsOnGround()){
OnHitGround();
}
}
/* NOP */;
}
public function OnHitGround() : Bool{
var horse : CActor;
horse = (CActor)parent.GetEntity();
if (horse.IsInAir() && startTestingLanding){
jumpEndPos = parent.GetEntity().GetWorldPosition();
if (parent.CanTakeDamageFromFalling()){
(CGameplayEntity)parent.GetEntity().OnDamageFrom
Falling(parent, 0.000000, -jumpStartPos.Z - jumpEndPos.Z + 5.000000);
} else {
parent.SetCanTakeDamageFromFalling(true);
}
parent.SetVariable('onGround', 1.000000);
(CMovingPhysicalAgentComponent)horse.GetMovingAgentCompo
nent().SetAnimatedMovement(false);
horse.SetIsInAir(false);
parent.userCombatManager.OnLanded();
theGame.VibrateControllerLight(/* NOP */);
if (parent.user == thePlayer){
theGame.GetGuiManager().EnableHudHoldIndicator(1
37, 0, "panel_input_action_horsedismount", 0.400000, 'HorseDismount');
}
}
/* NOP */;
}
public function OnCheckHorseJump() : Bool{
return isInJumpAnim;
/* NOP */;
}
private function CanCanter() : Bool{
return thePlayer.m_SettlementBlockCanter < 1 || thePlayer.GetIsH
orseRacing();
/* NOP */;
}
public function OnSpeedPress(action : SInputAction) : Bool{
var actorParent : CActor;
if (IsHorseControllable() && !dismountRequest && thePlayer.IsAct
ionAllowed(6)){
if (IsPressed(action, /* NOP */)){
if (accelerateTimestamp + DOUBLE_TAP_WINDOW >= t
heGame.GetEngineTimeAsSeconds()){
triedDoubleTap = true;
} else {
triedDoubleTap = false;
}
if (CanCanter() && !IsSpeedLocked(/* NOP */) ||
speedLocks.Contains('OnAttack')){

if (currSpeed >= CANTER_SPEED){


destSpeed = CANTER_SPEED;
ToggleSpeedLock('OnGallop', true
);
} else if (triedDoubleTap){
destSpeed = CANTER_SPEED;
SpursKick();
if (useSimpleStaminaManagement){
ToggleSpeedLock('OnGallo
p', true);
}
}
if (!FactsDoesExist("debug_fact_stamina_
pony") && !useSimpleStaminaManagement){
if (destSpeed > GALLOP_SPEED){
actorParent = (CActor)pa
rent.GetEntity();
actorParent.DrainStamina
(9, 0.000000, speedTimeoutValue, /* NOP */, /* NOP */, /* NOP */);
if (actorParent.GetStat(
2, /* NOP */) < 0.100000){
staminaBreak = t
rue;
staminaCooldownT
imer = 0.000000;
}
}
}
}
accelerateTimestamp = theGame.GetEngineTimeAsSec
onds();
maintainSpeedTimer = 0.000000;
} else if (IsReleased(action, /* NOP */)){
shouldGoToCanterAfterStop = false;
ToggleSpeedLock('OnGallop', false);
}
}
/* NOP */;
}
public function OnSpeedHold(action : SInputAction) : Bool{
var horseCompToFollow : W3HorseComponent;
thePlayer.SetBehaviorVariable('playerWouldLikeToMove', 1.000000,
/* NOP */);
if (IsHorseControllable() && IsPressed(action, /* NOP */) && !di
smountRequest){
if (!IsSpeedLocked(/* NOP */) && OnCanCanter()){
GallopPressed();
SpursKick();
}
} else if (IsReleased(action, /* NOP */)){
ToggleSpeedLock('OnGallop', false);
}
if (triedDoubleTap && !CanCanter() && IsPressed(action, /* NOP *
/)){
thePlayer.DisplayActionDisallowedHudMessage(28, /* NOP *
/, thePlayer.m_SettlementBlockCanter >= 1, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnDecelerate(action : SInputAction) : Bool{

if (IsReleased(action, /* NOP */)){


if (IsHorseControllable() && !IsRiderInCombatAction() &&
!dismountRequest){
if (currSpeed == MIN_SPEED){
parent.GenerateEvent('rearing');
}
}
}
/* NOP */;
}
public function OnStop(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */) && IsHorseControllable() && !di
smountRequest){
destSpeed = MIN_SPEED;
ToggleSpeedLock('OnStop', true);
if (ShouldProcessTutorial('TutorialHorseStop')){
FactsAdd("tut_horse_stopping", /* NOP */, /* NOP
*/);
}
} else if (IsReleased(action, /* NOP */)){
ToggleSpeedLock('OnStop', false);
parent.InternalSetDirection(0.000000);
if (ShouldProcessTutorial('TutorialHorseStop')){
FactsRemove("tut_horse_stopping");
}
}
/* NOP */;
}
public function OnHorseJump(action : SInputAction) : Bool{
var dummyParameter : Vector;
if (IsPressed(action, /* NOP */)){
jumpPressTimestamp = theGame.GetEngineTimeAsSeconds();
}
if (thePlayer.playerAiming.GetCurrentStateName() == 'Aiming'){
return false;
}
if (IsHorseControllable() && !IsRiderInCombatAction() && parent.
IsFullyMounted()){
if (!dismountRequest && IsReleased(action, /* NOP */) &&
jumpPressTimestamp + 0.200000 > theGame.GetEngineTimeAsSeconds() && thePlayer.G
etIsMovable() && !isInJumpAnim){
requestJump = true;
}
}
/* NOP */;
}
public function OnHorseDismountKeyboard(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (!DismountHorse()){
theInput.ForceDeactivateAction('HorseJump');
} else {
theGame.GetGuiManager().DisableHudHoldIndicator(
);
}
}
/* NOP */;
}
public function OnHorseDismount() : Bool{
if (!DismountHorse()){
theInput.ForceDeactivateAction('HorseJump');

} else {
theGame.GetGuiManager().DisableHudHoldIndicator();
}
/* NOP */;
}
private function DismountHorse() : Bool{
if (thePlayer.IsActionAllowed(22) && !IsRiderInCombatAction() &&
!isInJumpAnim && !dismountRequest && parent.canDismount && !parent.IsInHorseAct
ion()){
SetupDismount();
return true;
}
return false;
/* NOP */;
}
public function OnSmartDismount() : Bool{
SetupDismount();
/* NOP */;
}
public function SetupDismount(){
if (currSpeed == MIN_SPEED && !isSlowlyStopping || isStopping){
OnForceStop();
parent.user.SetBehaviorVariable('dismountType', 0.000000
, /* NOP */);
} else if (currSpeed >= GALLOP_SPEED && VecLength2D(GetHorseVelo
city()) > 6.000000){
parent.user.SetBehaviorVariable('dismountType', 2.000000
, /* NOP */);
destSpeed = GALLOP_SPEED;
} else {
parent.user.SetBehaviorVariable('dismountType', 1.000000
, /* NOP */);
destSpeed = TROT_SPEED;
}
if (!isStopping){
parent.IssueCommandToDismount(1);
}
dismountRequest = true;
/* NOP */;
}
private function IsRiderInCombatAction() : Bool{
return parent.userCombatManager.IsInCombatAction();
/* NOP */;
}
private final function UpdateDebugGUI(){
var p : Float;
var text : String;
var rot : EulerAngles;
var actorParent : CActor;
rot = parent.GetWorldRotation();
p = currSpeed / 2.000000;
text = "Speed: " + currSpeed;
thePlayer.GetVisualDebug().AddBarColorAreas('horseSpeed', 50, 50
, 250, 50, p, text, /* NOP */);
thePlayer.GetVisualDebug().AddBar('horseStamina', 305, 50, 25, 5
0, 1.000000, Color(0, 0, 0), /* NOP */, /* NOP */);
actorParent = (CActor)parent.GetEntity();
if (!staminaBreak){
text = "Stamina: " + actorParent.GetStat(2, /* NOP */);
} else {

text = "Stamina: " + actorParent.GetStat(2, /* NOP */) +


" <break>";
}
p = actorParent.GetStatPercents(2);
thePlayer.GetVisualDebug().AddBarColorSmooth('horseStaminaBar',
50, 110, 280, 30, p, Color(255, 255, 0), text, /* NOP */);
text = "Panic: " + actorParent.GetStat(7, /* NOP */) + " / " + a
ctorParent.GetStatMax(7);
p = actorParent.GetStatPercents(7);
thePlayer.GetVisualDebug().AddBarColorAreas('horsePanic', 50, 15
0, 280, 30, p, text, /* NOP */);
text = "pitch: " + rot.Pitch;
thePlayer.GetVisualDebug().AddBarColorSmooth('pitch', 50, 180, 2
80, 30, 0, Color(0, 255, 0), text, /* NOP */);
/* NOP */;
}
private function SetTimeoutForCurrentSpeed(){
switch(currSpeed){
case CANTER_SPEED:
if (thePlayer.IsInCombat()){
speedTimeoutValue = 2.000000;
} else {
speedTimeoutValue = 0.500000;
}
break;
case GALLOP_SPEED:
if (thePlayer.IsInCombat()){
speedTimeoutValue = 2.000000;
} else {
speedTimeoutValue = 0.500000;
}
break;
case TROT_SPEED:
if (dismountRequest){
speedTimeoutValue = 0.500000;
} else {
speedTimeoutValue = 0.000000;
}
break;
case WALK_SPEED:
if (dismountRequest){
speedTimeoutValue = 0.500000;
} else {
speedTimeoutValue = 0.000000;
}
break;
case SLOW_SPEED:
if (dismountRequest){
speedTimeoutValue = 0.500000;
} else {
speedTimeoutValue = 0.000000;
}
break;
case MIN_SPEED:
speedTimeoutValue = 0.000000;
break;
}
/* NOP */;
}
private function IsHorseControllable() : Bool{

var actor : CActor;


actor = (CActor)parent.GetEntity();
return actor && actor.GetBaseAttitudeGroup() != 'animals_peacefu
l' && parent.controllable;
/* NOP */;
}
private function MaintainCameraVariables(dt : Float){
if (currSpeed == CANTER_SPEED){
parent.inCanter = true;
parent.inGallop = false;
} else if (currSpeed == GALLOP_SPEED){
parent.inGallop = true;
parent.inCanter = false;
} else {
parent.inCanter = false;
parent.inGallop = false;
}
/* NOP */;
}
private function GallopPressed(){
if (OnCanCanter()){
if (currSpeed < GALLOP_SPEED && destSpeed != CANTER_SPEE
D){
destSpeed = GALLOP_SPEED;
}
ToggleSpeedLock('OnGallop', true);
}
/* NOP */;
}
private function SpursKick(){
if (!IsRiderInCombatAction() && currSpeed < destSpeed){
if (currSpeed != GALLOP_SPEED){
PlayVoicesetFasterHorse();
if (destSpeed == CANTER_SPEED){
parent.GenerateEvent('spursKickHard');
} else {
parent.GenerateEvent('spursKick');
}
}
}
/* NOP */;
}
private function PlayVoicesetFasterHorse(){
var currentTime : Float;
currentTime = theGame.GetEngineTimeAsSeconds();
if (CanPlayVoiceset(currentTime) && voicsetFasterTimeStamp + VOI
CESET_FASTER_COOLDOWN <= currentTime && RandRange(100, /* NOP */) < 25){
if (parent.IsPlayerHorse()){
thePlayer.PlayVoiceset(100, 'FasterHorseRoach',
/* NOP */);
} else {
thePlayer.PlayVoiceset(100, 'FasterHorse', /* NO
P */);
}
voicsetFasterTimeStamp = currentTime;
voicsetTimeStamp = currentTime;
}
/* NOP */;
}
private function PlayVoicesetSlowerHorse(){

var currentTime : Float;


currentTime = theGame.GetEngineTimeAsSeconds();
if (CanPlayVoiceset(currentTime) && voicsetSlowerTimeSTamp + VOI
CESET_SLOWER_COOLDOWN <= currentTime && RandRange(100, /* NOP */) < 25){
if (parent.IsPlayerHorse()){
thePlayer.PlayVoiceset(100, 'SlowerHorseRoach',
/* NOP */);
} else {
thePlayer.PlayVoiceset(100, 'SlowerHorse', /* NO
P */);
}
voicsetSlowerTimeSTamp = currentTime;
voicsetTimeStamp = currentTime;
}
/* NOP */;
}
private function CanPlayVoiceset(_currentTime : Float) : Bool{
return parent.user == GetWitcherPlayer() && !dismountRequest &&
!thePlayer.IsThreatened() && !thePlayer.IsSpeaking(/* NOP */) && voicsetTimeStam
p + VOICESET_COOLDOWN <= _currentTime;
/* NOP */;
}
private function GetHorseVelocity() : Vector{
return (CActor)parent.GetEntity().GetMovingAgentComponent().GetV
elocity();
/* NOP */;
}
private function GetSubmergeDepth() : Float{
return (CMovingPhysicalAgentComponent)(CActor)parent.GetEntity()
.GetMovingAgentComponent().GetSubmergeDepth();
/* NOP */;
}
private function IsHorseOnNavMesh() : Bool{
return (CMovingPhysicalAgentComponent)(CActor)parent.GetEntity()
.GetMovingAgentComponent().IsOnNavigableSpace();
/* NOP */;
}
private function InitCollisionGroups(){
inclinationCheckCollisionGroups.PushBack('Terrain');
inclinationCheckCollisionGroups.PushBack('Static');
inclinationCheckCollisionGroups.PushBack('Destructible');
inclinationCheckCollisionGroups.PushBack('Door');
waterCheckCollisionGroups.PushBack('Static');
waterCheckCollisionGroups.PushBack('Destructible');
/* NOP */;
}
private function CalculateSoundParameters(dt : Float){
if (desiredSpeedSound != currSpeed){
desiredSpeedSound = currSpeed;
}
currSpeedSound = InterpTo_F(currSpeedSound, desiredSpeedSound, d
t, 2.000000);
/* NOP */;
}
private function ResetSoundParameters(){
currSpeedSound = 0.000000;
desiredSpeedSound = 0.000000;
/* NOP */;
}
}

import abstract class SClosestSpotFilter{


}
import abstract class SAIPositionPrediction{
}
import abstract class CBehTreeSpawnContext{
}
import abstract class CAISteeringGraphData{
}
import abstract class CBehTreeCustomMoveData{
}
import abstract class CBehTreeCounterData{
}
import struct ISpawnScriptCondition{
public function TestCondition(encounter : CEncounter) : Bool{
return true;
/* NOP */;
}
}
import abstract class CSpawnTreeFactory{
}
import abstract class ISpawnTreeCompositeNode{
}
import abstract class CSpawnTreeNode{
}
import abstract class CSpawnTreeParallelNode{
}
import abstract class CSpawnTreeSelectRandomNode{
}
struct SUpdateEvent{
var eventType : EUpdateEventType;
var delay : Int32;
var journalBase : CJournalBase;
var index : Int32;
}
import abstract class ISpawnTreeDecorator{
}
import abstract class CSpawnTreeDecoratorInitializersList{
}
import abstract class CSpawnTreeVoidDecorator{
}
import struct ISpawnTreeScriptedDecorator{
}

import abstract class CSpawnTreeIncludeTreeNode{


}
import abstract class CSpawnTreeEntryList{
}
import abstract class CSpawnTreeWaypointSpawner{
//NULL type for tags
//NULL type for spawnpointDelay
//NULL type for visibility
}
import abstract class ISpawnTreeLeafNode{
}
import struct CSpawnTreeBaseEntryGenerator{
import public function RemoveChildren();
import public function AddNodeToTree(newNode : ISpawnTreeBaseNode, paren
tNode : ISpawnTreeBaseNode);
import public function AddInitializerToNode(newNode : ISpawnTreeInitiali
zer, parentNode : ISpawnTreeBaseNode);
import public function SetName(pair : SEncounterActionPointSelectorPair,
catName : CName);
public function GetContextMenuSpecialOptions(names : array<String>){
names.PushBack("Generate entries");
/* NOP */;
}
public function RunSpecialOption(option : Int32){
RemoveChildren();
GenerateEntries();
/* NOP */;
}
public function AplyCreatureEntryParams(cEntry : CCreatureEntry, cfg : S
CreatureEntryEntryGeneratorNodeParam){
cEntry.quantityMin = cfg.qualityMin;
cEntry.quantityMax = cfg.qualityMax;
cEntry.creatureDefinition = cfg.creatureDefinition.creatureDefin
ition;
cEntry.baseSpawner.tags = cfg.spawnWayPointTag;
cEntry.group = cfg.group;
/* NOP */;
}
public function AplyCreatureSpawnerParams(cEntry : CCreatureEntry, cfg :
SCreatureEntrySpawnerParams){
cEntry.baseSpawner.spawnpointDelay = cfg.spawnpointDelay;
cEntry.baseSpawner.visibility = cfg.visibility;
/* NOP */;
}
public function GenerateEntries(){
}
public function GetFriendlyName() : String{
return "Entry generator";
/* NOP */;
}
}
struct SCreatureEntrySpawnerParams{
editable var visibility : ESpawnTreeSpawnVisibility;
editable var spawnpointDelay : Float;
}

struct SWanderAndWorkEntryGeneratorCommon{
editable inlined var wanderParams : CAINpcHistoryWanderParams;
editable var spawnToWork : Bool;
editable var delay : Float;
}
import abstract class SCreatureDefinitionWrapper{
//NULL type for creatureDefinition
}
import abstract class SWorkCategoriesWrapper{
//NULL type for categories
}
import struct CJournalQuestPhase{
}
import abstract class SWorkCategoryWrapper{
//NULL type for category
}
import abstract class SCreatureEntryEntryGeneratorNodeParam{
//NULL type for qualityMin
//NULL type for qualityMax
//NULL type for creatureDefinition
//NULL type for spawnWayPointTag
//NULL type for group
//NULL type for appearanceName
//NULL type for tagToAssign
}
import abstract class SWanderHistoryEntryGeneratorParams{
//NULL type for wanderPointsGroupTag
}
import abstract class SWorkWanderSmartAIEntryGeneratorParam{
//NULL type for apTag
//NULL type for areaTags
//NULL type for apAreaTag
}
import abstract class SWorkSmartAIEntryGeneratorNodeParam{
//NULL type for apTag
//NULL type for areaTags
//NULL type for apAreaTag
//NULL type for keepActionPointOnceSelected
//NULL type for actionPointMoveType
}
import struct CCreatureEntry{
//NULL type for creatureDefinition
}
import struct CJournalQuestMapPin{
import public final function GetMapPinID() : CName;
import public final function GetRadius() : Float;
}
import abstract class CPartySpawnpointOrganizer{

}
import abstract class CSpawnTreeQuestNode{
}
import abstract class CSpawnTreeTimetableEntry{
}
import abstract class CSpawnTreeConditionNode{
}
import abstract class SCompiledInitializer{
}
import abstract class ISpawnTreeSpawnMonitorBaseInitializer{
}
import abstract class CSpawnTreeInitializerSpawnLimitMonitor{
}
import abstract class CSpawnTreeInitializerCollectDetachedSetup{
}
import struct ISpawnTreeInitializerToggleBehavior{
}
import struct ISpawnTreeScriptedInitializer{
public function Init(actor : CActor) : Bool{
return true;
/* NOP */;
}
public function GetEditorFriendlyName() : String{
return "Abstract Scripted initializer";
/* NOP */;
}
}
import abstract class ISpawnTreeInitializerGuardAreaBase{
//NULL type for pursuitRange
}
import struct CSpawnTreeInitializerGuardAreaByHandle{
}
import abstract class CSpawnTreeInitializerAttitude{
}
import abstract class CSpawnTreeDespawnInitializer{
}
import abstract class CSpawnTreeInitializerPersistent{
}
import abstract class CSpawnTreeAIDespawnInitializer{
}
import abstract class SSpawnTreeDespawnConfiguration{
}
import abstract class SSpawnTreeAIDespawnConfiguration{

}
import abstract class SCompiledSpawnStrategyInitializer{
}
import abstract class CSimpleSpawnStrategy{
}
import abstract class CMultiRangeSpawnStrategy{
}
import abstract class SSpawnTreeEntryStealCreatureState{
}
import abstract class SSpawnTreeEntrySetup{
}
import abstract class CSpawnTreeActionPointSpawner{
//NULL type for categories
//NULL type for tags
//NULL type for visibility
}
import abstract class ISpawnTreeSpawnerInitializer{
}
import struct CSpawnTreeInitializerWaypointSpawner{
}
import abstract class CSpawnTreeInitializerBaseStartingBehavior{
}
import abstract class CSpawnTreeInitializerForceCombat{
}
import abstract class CSpawnTreeInitializerRainHandler{
}
import abstract class CGameplayDestructionSystemComponent{
}
import abstract class CPatrolPointComponent{
}
import abstract class CWanderPointComponent{
}
import abstract class CDeniedAreaSaveable{
}
import abstract class CDeniedAreaBlock{
}
class W3LevelManager extends CObject{
private var owner : W3PlayerWitcher;
private saved var levelDefinitions : array<SLevelDefinition>;
private saved var level : Int32;
private saved var points : array<SSpendablePoints>;
public function Initialize(){
var tmp : SSpendablePoints;

var i : Int32;
tmp.free = 0;
tmp.used = 0;
i = 0;
while (i <= EnumGetMax('ESpendablePointType')){
points.PushBack(tmp);
i += 1;
}
/* NOP */;
}
public function PostInit(own : W3PlayerWitcher, bFromLoad : Bool){
owner = own;
if (!bFromLoad){
LoadLevelingDataFromXML();
level = levelDefinitions[0].number;
}
/* NOP */;
}
public final function ResetCharacterDev(){
var i : Int32;
i = 0;
while (i < points.Size()){
points[i].free += points[i].used;
points[i].used = 0;
i += 1;
}
/* NOP */;
}
private function LoadLevelingDataFromXML(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var i : Int32;
var temp : Int32;
var levelDef : SLevelDefinition;
var tmpLevels : array<Int32>;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('leveling');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'num
ber', temp);
tmpLevels.PushBack(temp);
i += 1;
}
ArraySortInts(tmpLevels);
i = 1;
while (i < tmpLevels.Size() - 1){
if (tmpLevels[i - 1] + 1 != tmpLevels[i]){
LogAssert(false, "W3LevelManager.LoadLevelingDat
aFromXML: There is a gap in levels definitions - between levels " + tmpLevels[i
- 1] + " and " + tmpLevels[i]);
return;
}
i += 1;
}
/* NOP */;
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'num
ber', temp);

levelDef.number = temp;
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'req
uiredTotalExp', temp);
levelDef.requiredTotalExp = temp;
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'add
edSkillPoints', temp);
levelDef.addedSkillPoints = temp;
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'add
edMutationPoints', temp);
levelDef.addedMutationPoints = temp;
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'add
edKnowledgePoints', temp);
levelDef.addedKnowledgePoints = temp;
levelDefinitions.PushBack(levelDef);
i += 1;
}
/* NOP */;
}
public function AddPoints(type : ESpendablePointType, amount : Int32, sh
ow : Bool){
var total : Int32;
var arrInt : array<Int32>;
var hudWolfHeadModule : CR4HudModuleWolfHead;
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (amount <= 0){
LogAssert(false, "W3LevelManager.AddPoints: amount of <<
" + type + ">> is <= 0 !!!");
return;
}
if (type == 1 && level == 70){
return;
}
points[type].free += amount;
if (type == 1){
while (true){
total = GetTotalExpForNextLevel();
if (total > 0 && GetPointsTotal(1) >= total){
GainLevel(true);
GetWitcherPlayer().AddAbility(GetWitcher
Player().GetLevelupAbility(GetWitcherPlayer().GetLevel()), /* NOP */);
} else {
break;
}
}
theTelemetry.LogWithValue(9, amount);
arrInt.PushBack(amount);
hud.OnExperienceUpdate(amount, show);
} else if (type == 0){
theTelemetry.LogWithValue(10, amount);
hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModu
le("WolfHeadModule");
if (hudWolfHeadModule){
hudWolfHeadModule.ShowLevelUpIndicator(show);
}
}
/* NOP */;
}
public function SpendPoints(type : ESpendablePointType, amount : Int32){
if (amount <= 0){

LogAssert(false, "W3LevelManager.SpendPoints: amount to


spend is <=0");
return;
}
if (points[type].free >= amount){
points[type].free -= amount;
points[type].used += amount;
} else {
LogAssert(false, "W3LevelManager.SpendPoints: trying to
spend more than you have!");
}
/* NOP */;
}
public function GetPointsFree(type : ESpendablePointType) : Int32{
return points[type].free;
/* NOP */;
}
public function GetPointsUsed(type : ESpendablePointType) : Int32{
return points[type].used;
/* NOP */;
}
public function GetPointsTotal(type : ESpendablePointType) : Int32{
return points[type].free + points[type].used;
/* NOP */;
}
public function GetLevel() : Int32{
var _level : Int32;
_level = level;
if (_level > 70){
_level = 70;
}
return _level;
/* NOP */;
}
public function GetMaxLevel() : Int32{
return levelDefinitions[levelDefinitions.Size() - 1].number;
/* NOP */;
}
public function GetTotalExpForCurrLevel() : Int32{
if (level > 0){
return levelDefinitions[level - 1].requiredTotalExp;
} else {
return 0;
}
/* NOP */;
}
public function GetTotalExpForNextLevel() : Int32{
if (level < levelDefinitions[levelDefinitions.Size() - 1].number
){
return levelDefinitions[level].requiredTotalExp;
} else {
return -1;
}
/* NOP */;
}
private function GainLevel(show : Bool){
var totalExp : Int32;
if (level == levelDefinitions[levelDefinitions.Size() - 1].numbe
r){
LogAssert(false, "W3LevelManager.GainLevel: already at m

ax level, so why trying to gain a level?");


return;
}
level += 1;
totalExp = points[1].used + points[1].free;
points[1].used = levelDefinitions[level].requiredTotalExp;
points[1].free = totalExp - points[1].used;
theTelemetry.LogWithValue(8, level);
if (levelDefinitions[level].addedSkillPoints > 0){
AddPoints(0, levelDefinitions[level].addedSkillPoints, s
how);
}
owner.OnLevelGained(level, show);
/* NOP */;
}
public function AutoLevel(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var skills : array<SSkill>;
var skillType : ESkill;
var i : Int32;
var priority : Int32;
var freePoints : Int32;
var tmpInt : Int32;
var tmpName : CName;
var type : ESpendablePointType;
skills = thePlayer.GetPlayerSkills();
dm = theGame.GetDefinitionsManager();
type = 0;
freePoints = GetPointsFree(type);
tmpInt = 1;
i = 0;
while (i < skills.Size()){
dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'pri
ority', priority);
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'sk
ill_name', tmpName);
skillType = SkillNameToEnum(tmpName);
if (freePoints > 0 && GetWitcherPlayer().CanLearnSkill(s
kills[i].skillType) && priority == tmpInt){
tmpInt += 1;
GetWitcherPlayer().AddSkill(skills[i].skillType,
true);
skills.Erase(i);
}
i += 1;
}
/* NOP */;
}
}
import abstract class CMetalinkComponent{
}
import abstract class CMetalinkWithAIQueueComponent{
}
import abstract class CMetalinDestinationComponent{
}

import abstract class CWayPointsCollection{


}
import abstract class SMoveLocomotionGoal{
}
import abstract class SAnimatedSlideSettings{
//NULL type for animation
//NULL type for slotName
//NULL type for useRotationDeltaPolicy
//NULL type for blendIn
//NULL type for blendOut
}
import abstract class SActionMatchToSettings{
}
import abstract class SActionMatchToTarget{
}
import abstract class SMovementAdjustmentRequestTicket{
}
import abstract class SAnimationProxyData{
}
import abstract class CFormationFactory{
}
import abstract class CSteeringFormationLogic{
}
import abstract class CSlotFormationLogic{
}
import abstract class CFormationPatternCompositeNode{
}
import abstract class CFormationPatternRepeatNode{
}
import abstract class CFormationPatternSlotsNode{
}
import abstract class CFormationLeaderData{
}
import abstract class CAISteeringFormationLeaderData{
}
import abstract class CAISlotFormationLeaderData{
}
import abstract class CAIFormationData{
}
import abstract class SFormationSteeringInput{
}
import abstract class IFormationSteeringTask{

}
import abstract class IFormationFragmentarySteeringTask{
}
import abstract class CFormationSteerToLeaderSteeringTask{
}
import abstract class CFormationSteerToCenterOfMassSteeringTask{
}
import abstract class CFormationDontBackDownSteeringTask{
}
import abstract class CFormationFaceSteeringTask{
}
import abstract class CFormationSteerToPathSteeringTask{
}
import abstract class CFormationKeepDistanceToMembersSteeringTask{
}
import abstract class CFormationKeepSpeedSteeringTask{
}
import abstract class CFormationKeepAwaylLeaderSteeringTask{
}
import abstract class CFormationKeepComradesSpeedSteeringTask{
}
import abstract class CFormationDontFallBehindSteeringTask{
}
import abstract class CFormationSteerToSlotSteeringTask{
}
import abstract class CFormationCatchupSlotSteeringTask{
}
import abstract class IFormationSteeringCondition{
}
import abstract class CFormationIsMovingSteeringCondition{
}
import abstract class CFormationIsBrokenSteeringCondition{
}
import struct CReactionsManager{
import public final function BroadcastStaticInterestPoint(interestPoint
: CInterestPoint, position : Vector, timeout : Float);
import public final function BroadcastDynamicInterestPoint(interestPoint
: CInterestPoint, node : CNode, timeout : Float);
import public final function SendStaticInterestPoint(target : CNewNPC, i
nterestPoint : CInterestPoint, position : Vector, timeout : Float);
import public final function SendDynamicInterestPoint(target : CNewNPC,
interestPoint : CInterestPoint, node : CNode, timeout : Float);
}

import abstract class CInterestPointComponent{


}
import struct CInterestPointInstance{
import public final function GetParentPoint() : CInterestPoint;
import public final function GetWorldPosition() : Vector;
import public final function GetNode() : CNode;
import public final function GetGeneratedFieldName() : CName;
import public final function GetFieldStrength(position : Vector) : Float
;
import public final function SetFieldStrengthMultiplier(param : Float);
import public final function GetFieldStrengthMultiplier() : Float;
import public final function SetTestParameter(param : Float);
import public final function GetTestParameter() : Float;
}
import struct CScriptedInterestPoint{
public function SetupInstance(instance : CInterestPointInstance, source
: IScriptable){
instance.SetFieldStrengthMultiplier(0.000000);
/* NOP */;
}
}
import abstract class CReactionOrCondition{
}
class W3MainMenuInitData extends W3MenuInitData{
private var m_panelXOffset : Int32;
public function GetPanelXOffset() : Int32{
return m_panelXOffset;
/* NOP */;
}
public function SetPanelXOffset(value : Int32){
m_panelXOffset = value;
/* NOP */;
}
}
import abstract class CReactionAndCondition{
}
import struct CReactionScriptedCondition{
public function Perform(source : CNode, target : CNode, interestPoint :
CInterestPointInstance) : Bool{
return true;
/* NOP */;
}
}
import abstract class CReactionSendEvent{
}
import abstract class CReactionMultiAction{
}
import abstract class CReactionQuestNotification{
}

import abstract class CReactionAttitudeChange{


}
import struct CReactionScript{
public function Perform(npc : CNewNPC, interestPoint : CInterestPointIns
tance, reactionIndex : Int32){
}
}
import struct CBehTreeReactionManager{
private var suppressedAreas : array<CAreaComponent>;
import public final function RemoveReactionEvent(invoker : CEntity, even
tName : CName) : Bool;
import public final function CreateReactionEvent(invoker : CEntity, even
tName : CName, lifetime : Float, distanceRange : Float, broadcastInterval : Floa
t, recipientCount : Int32, skipInvoker : Bool, setActionTargetOnBroadcast : Bool
) : Bool;
import public final function CreateReactionEventCustomCenter(invoker : C
Entity, eventName : CName, lifetime : Float, distanceRange : Float, broadcastInt
erval : Float, recipientCount : Int32, skipInvoker : Bool, setActionTargetOnBroa
dcast : Bool, customCenter : Vector) : Bool;
import public final function InitReactionScene(invoker : CEntity, eventN
ame : CName, lifetime : Float, distanceRange : Float, broadcastInterval : Float,
recipientCount : Int32) : Bool;
import public final function AddReactionSceneGroup(voiceset : String, gr
oup : CName);
public function RegisterReactionSceneGroups(){
GlobalRegisterReactionSceneGroups();
/* NOP */;
}
public function SuppressReactions(toggle : Bool, areaTag : CName){
var areaEnt : CEntity;
var areaCmp : CAreaComponent;
areaEnt = theGame.GetEntityByTag(areaTag);
if (areaEnt){
areaCmp = (CAreaComponent)areaEnt.GetComponentByClassNam
e('CAreaComponent');
}
if (!areaCmp){
return;
}
if (toggle){
if (!suppressedAreas.Contains(areaCmp)){
suppressedAreas.PushBack(areaCmp);
}
} else {
suppressedAreas.Remove(areaCmp);
}
/* NOP */;
}
public function CreateReactionEventIfPossible(invoker : CEntity, eventNa
me : CName, lifetime : Float, distanceRange : Float, broadcastInterval : Float,
recipientCount : Int32, skipInvoker : Bool, setActionTargetOnBroadcast : Bool, c
ustomCenter : Vector){
var suppressed : Bool;
suppressed = IsInSuppressed(invoker);
if (!suppressed){
if (customCenter == Vector(0, 0, 0)){
super.CreateReactionEvent(invoker, eventName, li
fetime, distanceRange, broadcastInterval, recipientCount, skipInvoker, setAction

TargetOnBroadcast);
} else {
super.CreateReactionEventCustomCenter(invoker, e
ventName, lifetime, distanceRange, broadcastInterval, recipientCount, skipInvoke
r, setActionTargetOnBroadcast, customCenter);
}
LogReactionSystem(eventName + " was sent by " + invoker
+ ". lifetime=" + lifetime + " distance=" + distanceRange + " interval=" + broad
castInterval);
}
/* NOP */;
}
private function IsInSuppressed(invoker : CEntity) : Bool{
var invokerPosition : Vector;
var i : Int32;
var size : Int32;
var npc : CNewNPC;
npc = (CNewNPC)invoker;
if (npc.suppressBroadcastingReactions){
return true;
}
if ((CActor)invoker.IsInFistFightMiniGame()){
return true;
}
invokerPosition = invoker.GetWorldPosition();
size = suppressedAreas.Size();
i = 0;
while (i < size){
if (suppressedAreas[i].TestPointOverlap(invokerPosition)
){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
}
import struct CReactionSceneActorComponent{
}
import abstract class CCircularPotentialField{
}
import abstract class CSoundPotentialField{
}
import abstract class CMoveSteeringBehaviorFactory{
}
import abstract class IMoveSNComposite{
}
class W3ApplyLoadConfirmation extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
public var saveSlotRef : SSavegameInfo;
protected function OnUserAccept(){
menuRef.LoadSaveRequested(saveSlotRef);
menuRef.disableAccountPicker = false;

/* NOP */;
}
protected function OnUserDecline(){
menuRef.disableAccountPicker = false;
menuRef.SetIgnoreInput(false);
/* NOP */;
}
protected function ClosePopup(){
if (menuRef){
menuRef.disableAccountPicker = false;
menuRef.SetIgnoreInput(false);
}
super.ClosePopup();
/* NOP */;
}
}
import abstract class CMoveSNComposite{
}
import abstract class CMoveSNCondition{
}
class W3SaveGameConfirmation extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
public var type : ESaveGameType;
public var slot : Int32;
protected function OnUserAccept(){
if (menuRef){
menuRef.SetIgnoreInput(false);
}
menuRef.executeSave(type, slot);
/* NOP */;
}
protected function OnUserDecline(){
if (menuRef){
menuRef.SetIgnoreInput(false);
}
/* NOP */;
}
protected function ClosePopup(){
if (menuRef){
menuRef.SetIgnoreInput(false);
}
super.ClosePopup();
/* NOP */;
}
}
import abstract class CMoveSNTask{
}
class W3NewGameConfirmation extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
protected function OnUserAccept(){
menuRef.NewGameRequested();
/* NOP */;
}
protected function OnUserDecline(){
}

protected function ClosePopup(){


super.ClosePopup();
/* NOP */;
}
}
import abstract class CMoveSTChangeSpeed{
}
import abstract class IManageSpeedSteeringTask{
}
class W3ActionConfirmation extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
public var actionID : Int32;
protected function OnUserAccept(){
menuRef.OnActionConfirmed(actionID);
/* NOP */;
}
protected function OnUserDecline(){
}
protected function ClosePopup(){
super.ClosePopup();
/* NOP */;
}
}
import abstract class CMoveSTMaintainSpeed{
}
import abstract class CMoveSTMaintainRandomSpeed{
}
class W3DeleteSaveConf extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
public var type : ESaveGameType;
public var slot : Int32;
public var saveMode : Bool;
protected function OnUserAccept(){
if (menuRef){
menuRef.DeleteSave(type, slot,
menuRef.disableAccountPicker =
menuRef.SetIgnoreInput(false);
}
super.ClosePopup();
/* NOP */;
}
protected function OnUserDecline(){
if (menuRef){
menuRef.disableAccountPicker =
menuRef.SetIgnoreInput(false);
}
/* NOP */;
}
protected function ClosePopup(){
if (menuRef){
menuRef.disableAccountPicker =
menuRef.SetIgnoreInput(false);
}
super.ClosePopup();

saveMode);
false;

false;

false;

/* NOP */;
}
}
import abstract class CMoveSTResetSteering{
}
import abstract class CMoveSTStop{
}
class W3DifficultyChangeConfirmation extends ConfirmationPopupData{
public var menuRef : CR4IngameMenu;
public var targetDifficulty : Int32;
protected function OnUserAccept(){
theGame.SetDifficultyLevel(targetDifficulty);
theGame.OnDifficultyChanged(targetDifficulty);
/* NOP */;
}
protected function OnUserDecline(){
menuRef.CancelDifficultyChange();
/* NOP */;
}
protected function ClosePopup(){
if (menuRef){
menuRef.CancelDifficultyChange();
}
super.ClosePopup();
/* NOP */;
}
}
import abstract class CMoveSTStopOnFreezing{
}
import abstract class CMoveSTArrive{
}
import abstract class CMoveSTApplySteering{
}
import abstract class CMoveSTApplyAnimationSteering{
}
import abstract class CMoveSTRotate{
}
class IngameMenuStructureCreator extends CObject{
public var parentMenu : CR4IngameMenu;
public var m_flashValueStorage : CScriptedFlashValueStorage;
public var m_flashConstructor : CScriptedFlashObject;
protected function CreateMenuItem(id : String, label : String, tag : Int
32, type : Int32, createEmptyChildList : Bool, listTitle : String) : CScriptedFl
ashObject{
var l_DataFlashObject : CScriptedFlashObject;
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_label : String;
l_label = GetLocStringByKeyExt(label);
if (l_label == ""){
l_label = "#" + label;
}

l_DataFlashObject = m_flashConstructor.CreateFlashObject("red.ga
me.witcher3.menus.mainmenu.IngameMenuEntry");
l_DataFlashObject.SetMemberFlashString("id", id);
l_DataFlashObject.SetMemberFlashString("label", l_label);
l_DataFlashObject.SetMemberFlashUInt("tag", tag);
l_DataFlashObject.SetMemberFlashUInt("type", type);
if (listTitle){
l_DataFlashObject.SetMemberFlashString("listTitle", GetL
ocStringByKeyExt(listTitle));
} else {
l_DataFlashObject.SetMemberFlashString("listTitle", GetL
ocStringByKeyExt(label));
}
if (createEmptyChildList){
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFl
ashArray();
l_DataFlashObject.SetMemberFlashArray("subElements", l_C
hildMenuFlashArray);
}
return l_DataFlashObject;
/* NOP */;
}
public function PopulateMenuData() : CScriptedFlashArray{
var l_DataFlashArray : CScriptedFlashArray;
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var l_subDataFlashObject : CScriptedFlashObject;
var l_titleString : String;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
if (parentMenu.isMainMenu){
if (hasSaveDataToLoad()){
l_DataFlashObject = CreateMenuItem("continue", "
panel_continue", NameToFlashUInt('Continue'), 11, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlash
Object);
}
l_DataFlashObject = CreateMenuItem("NewGame", "panel_new
game", NameToFlashUInt('NewGame'), 2, false, "newgame_difficulty");
l_ChildMenuFlashArray = CreateDifficultyListArray();
l_DataFlashObject.SetMemberFlashArray("subElements", l_C
hildMenuFlashArray);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
} else {
l_DataFlashObject = CreateMenuItem("resume", "panel_resu
me", NameToFlashUInt('Resume'), 1, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
if (!parentMenu.isMainMenu){
if (theGame.GetPlatform() == 1){
l_titleString = "panel_mainmenu_savegame_x1";
} else if (theGame.GetPlatform() == 2){
l_titleString = "panel_mainmenu_savegame_ps4";
} else {
l_titleString = "panel_mainmenu_savegame";
}
l_DataFlashObject = CreateMenuItem("mainmenu_savegame",
l_titleString, NameToFlashUInt('SaveGame'), 5, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
if (hasSaveDataToLoad()){

l_DataFlashObject = CreateMenuItem("mainmenu_loadgame",
"panel_mainmenu_loadgame", NameToFlashUInt('LoadGame'), 4, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
l_DataFlashObject = CreateMenuItem("mainmenu_options", "panel_ma
inmenu_options", NameToFlashUInt('Options'), 100, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
if (!parentMenu.isMainMenu){
if (thePlayer.IsActionAllowed(36)){
l_DataFlashObject = CreateMenuItem("mainmenu_Tut
orials", "panel_mainmenu_tutorials", NameToFlashUInt('Tutorials'), 12, true, /*
NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlash
Object);
}
if (theGame.GetGwintManager().GetHasDoneTutorial() || th
eGame.GetGwintManager().HasLootedCard()){
l_DataFlashObject = CreateMenuItem("mainmenu_Gwe
nt", "panel_mainmenu_gwent", NameToFlashUInt('Gwent'), 22, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlash
Object);
}
}
if (theGame.GetPlatform() == 1){
l_DataFlashObject = CreateMenuItem("mainmenu_help", "pan
el_mainmenu_help", NameToFlashUInt('Help'), 14, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
if (!parentMenu.isMainMenu){
l_DataFlashObject = CreateMenuItem("button_common_quitto
mainmenu", "panel_button_common_quittomainmenu", NameToFlashUInt('QuitGame'), 6,
true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
if (theGame.GetPlatform() == 0){
l_DataFlashObject = CreateMenuItem("button_closeGame", "
menu_main_quit", NameToFlashUInt('CloseGame'), 18, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
if (parentMenu.isMainMenu && theGame.IsDebugQuestMenuEnabled() &
& !theGame.IsFinalBuild()){
l_DataFlashObject = CreateMenuItem("debug_menu", "DBG Qu
est Menu", NameToFlashUInt('DebugMenu'), 21, true, /* NOP */);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
}
return l_DataFlashArray;
/* NOP */;
}
protected function CreateDifficultyListArray() : CScriptedFlashArray{
var l_optionChildList : CScriptedFlashArray;
l_optionChildList = m_flashValueStorage.CreateTempFlashArray();
AddDifficulyOptionItem(1, l_optionChildList);
AddDifficulyOptionItem(2, l_optionChildList);
AddDifficulyOptionItem(3, l_optionChildList);
AddDifficulyOptionItem(4, l_optionChildList);
return l_optionChildList;
/* NOP */;
}
protected function AddDifficulyOptionItem(difficulty : EDifficultyMode,
parentArray : CScriptedFlashArray){

var l_ChildMenuFlashArray : CScriptedFlashArray;


var l_DataFlashObject : CScriptedFlashObject;
var displayName : String;
var descriptionText : String;
switch(difficulty){
case 1:
displayName = "panel_mainmenu_dificulty_easy_title";
descriptionText = "panel_mainmenu_dificulty_easy_descrip
tion";
break;
case 2:
displayName = "panel_mainmenu_dificulty_normal_title";
descriptionText = "panel_mainmenu_dificulty_normaldescri
ption_description";
break;
case 3:
displayName = "panel_mainmenu_dificulty_hard_title";
descriptionText = "panel_mainmenu_dificulty_hard_descrip
tion";
break;
case 4:
displayName = "panel_mainmenu_dificulty_hardcore_title";
descriptionText = "panel_mainmenu_dificulty_hardcore_des
cription";
break;
}
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_Tutorials
");
l_DataFlashObject.SetMemberFlashUInt("tag", difficulty);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt(displayName));
l_DataFlashObject.SetMemberFlashString("description", GetLocStri
ngByKeyExt(descriptionText));
l_DataFlashObject.SetMemberFlashString("listTitle", GetLocString
ByKeyExt("newgame_tutorials"));
l_DataFlashObject.SetMemberFlashUInt("type", 2);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
AddNewgameTutorialOption(difficulty, l_ChildMenuFlashArray);
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
/* NOP */;
}
protected function AddNewgameTutorialOption(difficulty : EDifficultyMode
, parentArray : CScriptedFlashArray){
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_Tutorials
");
l_DataFlashObject.SetMemberFlashUInt("tag", 1);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_on"));
l_DataFlashObject.SetMemberFlashString("listTitle", GetLocString
ByKeyExt("newgame_import"));
l_DataFlashObject.SetMemberFlashUInt("type", 2);

l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
AddNewgameSimulateImportOption(difficulty, true, l_ChildMenuFlas
hArray);
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_Tutorials
");
l_DataFlashObject.SetMemberFlashUInt("tag", 0);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_off"));
l_DataFlashObject.SetMemberFlashString("listTitle", GetLocString
ByKeyExt("newgame_import"));
l_DataFlashObject.SetMemberFlashUInt("type", 2);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
AddNewgameSimulateImportOption(difficulty, false, l_ChildMenuFla
shArray);
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
/* NOP */;
}
protected function AddNewgameSimulateImportOption(difficulty : EDifficul
tyMode, tutorialsOn : Bool, parentArray : CScriptedFlashArray){
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var savesToImport : array<SSavegameInfo>;
var tag : Int32;
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_simulate_
on");
tag = difficulty;
if (tutorialsOn){
tag += 1024;
}
tag += 2048;
l_DataFlashObject.SetMemberFlashUInt("tag", tag);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_on"));
if (theGame.GetDLCManager().IsNewGamePlusAvailable()){
l_DataFlashObject.SetMemberFlashUInt("type", 2);
l_DataFlashObject.SetMemberFlashString("listTitle", GetL
ocStringByKeyExt("newgame_plus"));
AddNewGamePlusOption(tag, l_ChildMenuFlashArray);
} else {
l_DataFlashObject.SetMemberFlashUInt("type", 17);
}
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray

();
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_simulate_
off");
tag = difficulty;
if (tutorialsOn){
tag += 1024;
}
l_DataFlashObject.SetMemberFlashUInt("tag", tag);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_off"));
if (theGame.GetDLCManager().IsNewGamePlusAvailable()){
l_DataFlashObject.SetMemberFlashUInt("type", 2);
l_DataFlashObject.SetMemberFlashString("listTitle", GetL
ocStringByKeyExt("newgame_plus"));
AddNewGamePlusOption(tag, l_ChildMenuFlashArray);
} else {
l_DataFlashObject.SetMemberFlashUInt("type", 17);
}
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
if (theGame.GetPlatform() == 0){
theGame.ListW2SavedGames(savesToImport);
if (savesToImport.Size() != 0){
tag = difficulty;
if (tutorialsOn){
tag += 1024;
}
tag += 4096;
l_DataFlashObject = m_flashValueStorage.CreateTe
mpFlashObject(/* NOP */);
l_ChildMenuFlashArray = m_flashValueStorage.Crea
teTempFlashArray();
l_DataFlashObject.SetMemberFlashString("id", "ma
inmenu_import_witcher_two");
l_DataFlashObject.SetMemberFlashUInt("tag", tag)
;
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_importsave"));
if (theGame.GetDLCManager().IsNewGamePlusAvailab
le()){
l_DataFlashObject.SetMemberFlashUInt("ty
pe", 23);
l_DataFlashObject.SetMemberFlashString("
listTitle", GetLocStringByKeyExt("newgame_plus"));
AddNewGamePlusOption(tag, l_ChildMenuFla
shArray);
} else {
l_DataFlashObject.SetMemberFlashUInt("ty
pe", 23);
}
l_DataFlashObject.SetMemberFlashArray("subElemen
ts", l_ChildMenuFlashArray);
parentArray.PushBackFlashObject(l_DataFlashObjec
t);
}
}
/* NOP */;
}
protected function AddNewGamePlusOption(tag : Int32, parentArray : CScri

ptedFlashArray){
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_newgame_p
lus");
l_DataFlashObject.SetMemberFlashUInt("tag", tag);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_on"));
l_DataFlashObject.SetMemberFlashUInt("type", 26);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_newGame")
;
l_DataFlashObject.SetMemberFlashUInt("tag", tag);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_option_value_off"));
l_DataFlashObject.SetMemberFlashUInt("type", 17);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
parentArray.PushBackFlashObject(l_DataFlashObject);
/* NOP */;
}
protected function CreateImortedSaveGamesArray() : CScriptedFlashArray{
var i : Int32;
var flashObject : CScriptedFlashObject;
var savedGames : CScriptedFlashArray;
var savedGamesList : array<SSavegameInfo>;
savedGames = m_flashValueStorage.CreateTempFlashArray();
theGame.ListW2SavedGames(savedGamesList);
i = 0;
while (i < savedGamesList.Size()){
flashObject = m_flashValueStorage.CreateTempFlashObject(
/* NOP */);
flashObject.SetMemberFlashString("id", savedGamesList[i]
.filename);
flashObject.SetMemberFlashString("label", savedGamesList
[i].filename);
flashObject.SetMemberFlashString("tag", i);
flashObject.SetMemberFlashString("iconPath", "");
flashObject.SetMemberFlashString("description", "");
savedGames.PushBackFlashObject(flashObject);
i += 1;
}
return savedGames;
/* NOP */;
}
}
import abstract class CMoveSTSnapToMinimalVelocity{
}

import abstract class CMoveSTMove{


}
import abstract class CMoveSTMoveWithOffset{
}
import abstract class CMoveSTFinalStep{
}
import abstract class CMoveSTKeepNavdata{
}
import abstract class CMoveSTMatchHeadingOrientation{
}
import abstract class CMoveSTKeepAwayWalls{
}
import abstract class CMoveSTKeepAwayWallsInPathfollow{
}
import abstract class CMoveSTSeparateFromActors{
}
import abstract class CMoveSTStep{
}
import abstract class CMoveSTSlide{
}
import abstract class CMoveSTSetBehaviorVariable{
}
import abstract class CMoveSTSetFlags{
}
import abstract class CMoveSTSetupRotationChange{
}
import abstract class CMoveSTMapRotationChangeUsingCustomRotation{
}
import abstract class CMoveSTSetMaxDirectionChange{
}
import abstract class CMoveSTSetMaxRotationChange{
}
import abstract class CMoveSTSetAcceleration{
}
import abstract class CMoveSTAvoidObstacles{
}
class CR4CommonIngameMenu extends CR4MenuBase{
private var m_menuData : array<SMenuTab>;
private var m_flashModule : CScriptedFlashSprite;
protected var currentMenuName : CName;
public var reopenRequested : Bool;
public function OnConfigUI() : Bool{

var menuName : CName;


if (!thePlayer.IsAlive() && !thePlayer.OnCheckUnconscious() || t
heGame.HasBlackscreenRequested() || theGame.IsDialogOrCutscenePlaying()){
CloseMenu();
} else {
m_hideTutorial = true;
m_forceHideTutorial = true;
super.OnConfigUI();
menuName = theGame.GetMenuToOpen();
theGame.GetGuiManager().RequestMouseCursor(true);
if (theInput.LastUsedPCInput()){
theGame.MoveMouseTo(0.170000, 0.360000);
}
menuName = 'IngameMenu';
theSound.SoundEvent("system_pause");
SetupMenu();
OnRequestSubMenu(menuName, GetMenuInitData());
theInput.StoreContext('EMPTY_CONTEXT');
}
/* NOP */;
}
public function OnClosingMenu() : Bool{
super.OnClosingMenu();
if (m_configUICalled){
theGame.GetGuiManager().RequestMouseCursor(false);
theSound.SoundEvent("system_resume");
theInput.RestoreContext('EMPTY_CONTEXT', false);
OnPlaySoundEvent("gui_global_panel_close");
}
/* NOP */;
}
public function OnRequestSubMenu(menuName : CName, initData : IScriptabl
e){
RequestSubMenu(menuName, initData);
currentMenuName = menuName;
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
}
public function OnSwipe(swipe : Int32) : Bool{
}
private function DefineMenuItem(itemName : CName, itemLabel : String, pa
rentMenuItem : CName){
var newMenuItem : SMenuTab;
newMenuItem.MenuName = itemName;
newMenuItem.MenuLabel = itemLabel;
newMenuItem.Enabled = true;
newMenuItem.Visible = true;
newMenuItem.ParentMenu = parentMenuItem;
m_menuData.PushBack(newMenuItem);
/* NOP */;
}
private function SetupMenu(){
}
public function OnCloseMenu() : Bool{
}
public function CloseMenuRequest(){
var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();

if (!menu){
CloseMenu();
}
/* NOP */;
}
public function ChildRequestCloseMenu(){
var menu : CR4MenuBase;
var menuToOpen : CName;
var initData : W3MainMenuInitData;
initData = new W3MainMenuInitData in this;
if (reopenRequested){
reopenRequested = false;
OnRequestSubMenu('IngameMenu', GetMenuInitData());
} else {
menu = (CR4MenuBase)GetSubMenu();
if (menu){
menuToOpen = GetParentMenuName(currentMenuName);
if (menuToOpen){
OnRequestSubMenu(menuToOpen, initData);
} else {
CloseMenu();
}
}
}
/* NOP */;
}
public function GetParentMenuName(menu : CName) : CName{
var i : Int32;
var parentName : CName;
var CurDataItem : SMenuTab;
i = 0;
while (i < m_menuData.Size()){
CurDataItem = m_menuData[i];
if (CurDataItem.MenuName == menu){
parentName = CurDataItem.ParentMenu;
}
i += 1;
}
return parentName;
/* NOP */;
}
public function PlayOpenSoundEvent(){
OnPlaySoundEvent("gui_global_panel_open");
/* NOP */;
}
}
import abstract class CMoveSTCollisionResponse{
}
import abstract class CMoveSTForwardCollisionResponse{
}
class CR4CommonMainMenu extends CR4MenuBase{
private var m_menuData : array<SMenuTab>;
private var m_flashModule : CScriptedFlashSprite;
private var m_fxSetMovieData : CScriptedFlashFunction;
public var importSelected : Bool;
public var reopenRequested : Bool;
protected var currentMenuName : CName;

public function OnConfigUI() : Bool{


var menuName : CName;
var inGameConfigWrapper : CInGameConfigWrapper;
var overlayPopupRef : CR4OverlayPopup;
super.OnConfigUI();
m_flashModule = GetMenuFlash();
theGame.GetGuiManager().OnEnteredMainMenu();
menuName = 'IngameMenu';
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (!overlayPopupRef){
theGame.RequestPopup('OverlayPopup', /* NOP */);
}
theGame.GetGuiManager().RequestMouseCursor(true);
if (theInput.LastUsedPCInput()){
theGame.MoveMouseTo(0.170000, 0.360000);
}
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
inGameConfigWrapper.SetVarValue('Hidden', 'HasSetup', "true");
theGame.SaveUserSettings();
SetupMenu();
OnRequestSubMenu(menuName, GetMenuInitData());
theGame.FadeInAsync(300);
theInput.StoreContext('MAIN_MENU_CONTEXT');
theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
updateHudConfigs();
theSound.SoundEvent("play_music_main_menu");
theSound.SoundEvent("mus_main_menu_theme");
/* NOP */;
}
private function updateHudConfigs(){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfigs();
}
/* NOP */;
}
public function GetCurrentBackgroundMovie() : String{
return "mainmenu.usm";
/* NOP */;
}
public function OnClosingMenu() : Bool{
if (m_configUICalled){
theInput.RestoreContext('MAIN_MENU_CONTEXT', true);
}
theGame.GetGuiManager().RequestMouseCursor(false);
super.OnClosingMenu();
/* NOP */;
}
public function OnRequestSubMenu(menuName : CName, initData : IScriptabl
e){
RequestSubMenu(menuName, initData);
currentMenuName = menuName;
/* NOP */;
}
public function OnSwipe(swipe : Int32) : Bool{
}
private function DefineMenuItem(itemName : CName, itemLabel : String, pa
rentMenuItem : CName){

var newMenuItem : SMenuTab;


newMenuItem.MenuName = itemName;
newMenuItem.MenuLabel = itemLabel;
newMenuItem.Enabled = true;
newMenuItem.Visible = true;
newMenuItem.ParentMenu = parentMenuItem;
m_menuData.PushBack(newMenuItem);
/* NOP */;
}
private function SetupMenu(){
}
public function OnCloseMenu() : Bool{
var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();
if (menu){
menu.CloseMenu();
}
CloseMenu();
/* NOP */;
}
public function CloseMenuRequest(){
var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();
if (!menu){
CloseMenu();
}
/* NOP */;
}
public function ChildRequestCloseMenu(){
var menu : CR4MenuBase;
var menuToOpen : CName;
if (reopenRequested){
reopenRequested = false;
OnRequestSubMenu('IngameMenu', GetMenuInitData());
} else {
menu = (CR4MenuBase)GetSubMenu();
if (menu){
menuToOpen = GetParentMenuName(currentMenuName);
if (menuToOpen){
OnRequestSubMenu(menuToOpen, GetMenuInit
Data());
} else {
CloseMenu();
}
}
}
/* NOP */;
}
public function GetParentMenuName(menu : CName) : CName{
var i : Int32;
var parentName : CName;
var CurDataItem : SMenuTab;
i = 0;
while (i < m_menuData.Size()){
CurDataItem = m_menuData[i];
if (CurDataItem.MenuName == menu){
parentName = CurDataItem.ParentMenu;
}
i += 1;
}

return parentName;
/* NOP */;
}
protected function GatherBindersArray(resultArray : CScriptedFlashArray,
bindersList : array<SKeyBinding>, isContextBinding : Bool){
var tempFlashObject : CScriptedFlashObject;
var bindingGFxData : CScriptedFlashObject;
var curBinding : SKeyBinding;
var bindingsCount : Int32;
var i : Int32;
bindingsCount = bindersList.Size();
i = 0;
while (i < bindingsCount){
curBinding = bindersList[i];
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
bindingGFxData = tempFlashObject.CreateFlashObject("red.
game.witcher3.data.KeyBindingData");
bindingGFxData.SetMemberFlashString("gamepad_navEquivale
nt", curBinding.Gamepad_NavCode);
bindingGFxData.SetMemberFlashInt("keyboard_keyCode", cur
Binding.Keyboard_KeyCode);
bindingGFxData.SetMemberFlashString("label", GetLocStrin
gByKeyExt(curBinding.LocalizationKey));
bindingGFxData.SetMemberFlashString("isContextBinding",
isContextBinding);
resultArray.PushBackFlashObject(bindingGFxData);
i += 1;
}
/* NOP */;
}
protected function UpdateInputFeedback(){
var gfxDataList : CScriptedFlashArray;
gfxDataList = m_flashValueStorage.CreateTempFlashArray();
GatherBindersArray(gfxDataList, m_defaultInputBindings, /* NOP *
/);
m_flashValueStorage.SetFlashArray("mainmenu.buttons.setup", gfxD
ataList);
/* NOP */;
}
public function SetButtons(){
AddInputBinding("panel_button_common_exit", "escape-gamepad_B",
27);
AddInputBinding("panel_button_common_use", "enter-gamepad_A", 13
);
AddInputBinding("panel_button_common_navigation", "gamepad_L3",
/* NOP */);
UpdateInputFeedback();
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
public function SetMenuAlpha(value : Int32){
m_flashModule.SetAlpha(value);
/* NOP */;
}
}
import abstract class CMoveSTAdjustRotationChanges{
}

import abstract class CMoveSTKeepAwayTarget{


}
class CR4DeathScreenMenu extends CR4MenuBase{
public var hasSaveData : Bool;
private var m_fxShowInputFeedback : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var tutorialPopupRef : CR4TutorialPopup;
super.OnConfigUI();
PopulateData();
m_fxShowInputFeedback = m_flashModule.GetMemberFlashFunction("sh
owInputFeedback");
tutorialPopupRef = (CR4TutorialPopup)theGame.GetGuiManager().Get
Popup('TutorialPopup');
if (tutorialPopupRef){
tutorialPopupRef.ClosePopup();
}
theSound.EnterGameState(12);
theSound.SoundEvent('gui_global_player_death_thump');
theGame.Pause("DeathScreen");
theGame.ResetFadeLock('DeathScreenMenu');
theGame.FadeInAsync(1.200000);
m_guiManager.RequestMouseCursor(true);
/* NOP */;
}
private function updateHudConfigs(){
}
public function OnClosingMenu() : Bool{
m_guiManager.RequestMouseCursor(false);
theInput.RestoreContext('EMPTY_CONTEXT', true);
super.OnClosingMenu();
theGame.Unpause("DeathScreen");
/* NOP */;
}
public function OnRequestSubMenu(menuName : CName, initData : IScriptabl
e){
RequestSubMenu(menuName, initData);
/* NOP */;
}
public function OnCloseMenu() : Bool{
var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();
if (menu){
menu.CloseMenu();
}
CloseMenu();
/* NOP */;
}
public function CloseMenuRequest(){
var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();
if (!menu){
CloseMenu();
}
/* NOP */;
}
public function ChildRequestCloseMenu(){
var menu : CR4MenuBase;
var menuToOpen : CName;

if (hasSaveData != hasSaveDataToLoad()){
PopulateData();
}
m_fxShowInputFeedback.InvokeSelfOneArg(FlashArgBool(true));
/* NOP */;
}
public function PopulateData(){
var l_FlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
l_FlashArray = m_flashValueStorage.CreateTempFlashArray();
hasSaveData = hasSaveDataToLoad();
if (hasSaveData){
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
l_DataFlashObject.SetMemberFlashString("label", GetLocSt
ringByKeyExt("panel_button_deathscreen_respawn"));
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int('Respawn'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
if (theGame.GetPlatform() == 1){
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_button_deathscreen_load_x1"));
} else if (theGame.GetPlatform() == 2){
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_button_deathscreen_load_ps4"));
} else {
l_DataFlashObject.SetMemberFlashString("label",
GetLocStringByKeyExt("panel_button_deathscreen_load"));
}
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int('Load'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
}
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_button_common_quittomainmenu"));
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashUInt('Qui
t'));
l_FlashArray.PushBackFlashObject(l_DataFlashObject);
m_flashValueStorage.SetFlashArray("hud.deathscreen.list", l_Flas
hArray);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
public function SetMenuAlpha(value : Int32){
m_flashModule.SetAlpha(value);
/* NOP */;
}
public function OnPress(tag : CName) : Bool{
switch(tag){
case 'Load':
OnLoad();
break;
case 'Respawn':
OnRespawn();
break;

case 'Quit':
OnQuit();
break;
}
/* NOP */;
}
public function HideInputFeedback(){
m_fxShowInputFeedback.InvokeSelfOneArg(FlashArgBool(false));
/* NOP */;
}
public function OnLoad() : Bool{
var initData : W3MenuInitData;
initData = new W3MenuInitData in this;
initData.setDefaultState('LoadGame');
RequestSubMenu('IngameMenu', initData);
/* NOP */;
}
public function OnQuit() : Bool{
theGame.GetGuiManager().TryQuitGame();
/* NOP */;
}
public function OnRespawn() : Bool{
theGame.SetIsRespawningInLastCheckpoint();
theGame.LoadLastGameInit(true);
/* NOP */;
}
}
import abstract class CMoveSTMoveTightening{
}
import abstract class CMoveSTResolveStucking{
}
import abstract class CMoveSCAgentSpeed{
}
import abstract class CMoveSteeringCompositeCondition{
}
import abstract class CMoveSCHeadingOutputLength{
}
import abstract class CMoveSCGoalChannel{
}
import abstract class CMoveSCIsGoalSet{
}
import abstract class CMoveSCIsGoalHeadingSet{
}
import abstract class CMoveSCOrientationMatchHeading{
}
import abstract class CMoveSCFlags{
}
import abstract class CMoveSCCompareBehaviorVariable{
}

import abstract class CMoveSCWaitingForNotification{


}
import abstract class CMoveSCWasNotificationReceived{
}
import abstract class CMoveSCWasEventTriggered{
}
import abstract class CMoveSCAnimEvent{
}
import abstract class CMoveSCHeadingToGoalAngle{
}
import abstract class CMoveSCArrival{
}
import abstract class CMoveSCDistanceToGoal{
}
import abstract class CMoveSCDistanceToDestination{
}
import abstract class CMoveSCDistanceToTarget{
}
import struct CMoveSCScriptedCondition{
}
import abstract class CMoveSCHasTargetNodeSetCondition{
}
import abstract class CMoveSCNavigationClearLine{
}
import abstract class CMoveSTWalkSideBySide{
}
import abstract class CMoveSCWalkSideBySide{
}
import abstract class CMoveSTMaintainTargetSpeed{
}
import abstract class CMoveSTSaneMaintainTargetSpeed{
}
import abstract class CMoveSTFaceTargetFacing{
}
import abstract class CTeleporter{
}
import struct CMoveTRGScript{
//NULL type for agent
//NULL type for timeDelta
import public function SetHeadingGoal(goal : SMoveLocomotionGoal, headin
g : Vector);

import public function SetOrientationGoal(goal : SMoveLocomotionGoal, or


ientation : Float, alwaysSet : Bool);
import public function SetSpeedGoal(goal : SMoveLocomotionGoal, speed :
Float);
import public function SetMaxWaitTime(goal : SMoveLocomotionGoal, time :
Float);
import public function MatchDirectionWithOrientation(goal : SMoveLocomot
ionGoal, enable : Bool);
import public function SetFulfilled(goal : SMoveLocomotionGoal, isFulfil
led : Bool);
import public final function Seek(pos : Vector) : Vector;
import public final function Flee(pos : Vector) : Vector;
import public final function Pursue(agent : CMovingAgentComponent) : Vec
tor;
import public final function FaceTarget(pos : Vector) : Vector;
public function UpdateChannels(out goal : SMoveLocomotionGoal){
}
}
import abstract class CMoveSTSpeedMultOnPath{
}
import abstract class IMoveTargetSteeringTask{
}
import abstract class CMoveSTKeepDistanceToTarget{
}
import abstract class CMoveSTNeverBackDown{
}
import abstract class CMoveSTFaceTarget{
}
import abstract class IMoveTargetPositionSteeringTask{
}
import abstract class StorySceneFactory{
}
import abstract class CStorySceneChoiceLineActionScripted{
}
import abstract class CStorySceneChoiceLineActionScriptedContentGuard{
}
import abstract class CStorySceneChoiceLineActionStallForContent{
}
import abstract class CStorySceneActionMoveTo{
}
import abstract class CStorySceneActionSlide{
}
import abstract class CStorySceneActionTeleport{
}
import abstract class CStorySceneActionStopWork{
}

import abstract class CStorySceneActionStartWork{


}
import abstract class CStorySceneActionRotateToPlayer{
}
import abstract class CStorySceneActionEquipItem{
}
import abstract class ApertureDofParams{
}
import abstract class CEventGeneratorCameraParams{
}
import abstract class CStorySceneWaypointComponent{
}
import abstract class CStorySceneDialogsetFactory{
}
import abstract class IStorySceneItem{
}
struct CreditsSection{
var sectionName : String;
var positionNames : array<String>;
var crewNames : array<String>;
var displayTime : Float;
var positionX : Int32;
var positionY : Int32;
var delay : Float;
}
import abstract class SStorySceneAttachmentInfo{
}
import abstract class SStorySceneLightTrackingInfo{
}
import abstract class StorySceneExpectedActor{
}
import abstract class CStorySceneActorTemplate{
}
import abstract class CStorySceneActorPosition{
}
import abstract class CAbstractStorySceneLine{
}
import abstract class CStorySceneComment{
}
import abstract class CStorySceneQuestChoiceLine{
}
import abstract class CStorySceneCutscenePlayer{

}
import abstract class CStorySceneScriptLine{
}
import abstract class CStorySceneBlockingElement{
}
import abstract class CStoryScenePauseElement{
}
import abstract class StorySceneScriptParam{
}
import abstract class CStorySceneGraph{
}
import abstract class CStorySceneGraphBlock{
}
import abstract class CStorySceneGraphSocket{
}
import abstract class CStorySceneInputBlock{
}
struct SMovieData{
var movieName : String;
var isSkipable : Bool;
var showLogo : Bool;
}
import abstract class CStorySceneLinkHubBlock{
}
import abstract class CStorySceneOutputBlock{
}
import abstract class CStorySceneSectionBlock{
}
import abstract class CStorySceneCutsceneSection{
}
struct SMenuButtonDef{
var NavigationCode : String;
var LocalisationKey : String;
var enabled : Bool;
}
import abstract class CStorySceneCutsceneSectionBlock{
}
import abstract class CStorySceneFlowConditionBlock{
}
import abstract class CStorySceneFlowSwitchBlock{
}
import abstract class CStorySceneRandomBlock{

}
import abstract class CStorySceneScriptingBlock{
}
import struct CStorySceneSpawner{
public editable var useSpawnerLocation : Bool;
//NULL type for storyScene
//NULL type for inputName
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tags : array<CName>;
if (useSpawnerLocation == true){
tags = GetTags();
ArrayOfNamesAppend(tags, storyScene.GetRequiredPositionT
ags());
SetTags(tags);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (actionName == "Talk"){
theGame.GetStorySceneSystem().PlayScene(storyScene, inpu
tName);
}
/* NOP */;
}
}
import abstract class CStorySceneVideoBlock{
}
import abstract class CStorySceneVideoElement{
}
import abstract class CExtAnimDialogKeyPoseMarker{
}
import abstract class CExtAnimDialogKeyPoseDuration{
}
class W3GuiPlayerInventoryComponent extends W3GuiBaseInventoryComponent{
private var _shopInvCmp : W3GuiShopInventoryComponent;
private var _filterType : EInventoryFilterType;
private var _currentItemCategoryType : CName;
public var bPaperdoll : Bool;
public var currentDefaultItemAction : EInventoryActionType;
public var filterTagList : array<CName>;
protected function InvalidateItems(items : array<SItemUniqueId>){
}
public function SetShopInvCmp(targetShopInvCmp : W3GuiShopInventoryCompo
nent){
_shopInvCmp = targetShopInvCmp;
/* NOP */;
}
public function SetFilterType(filterType : EInventoryFilterType){
_filterType = filterType;
/* NOP */;
}
public function GetFilterType() : EInventoryFilterType{

return _filterType;
/* NOP */;
}
public function SetItemCategoryType(cat : CName){
_currentItemCategoryType = cat;
/* NOP */;
}
public function SwapItems(gridItem : SItemUniqueId, paperdollItem : SIte
mUniqueId){
var invalidatedItems : array<SItemUniqueId>;
var uiDataPaperdoll : SInventoryItemUIData;
var uiDataGrid : SInventoryItemUIData;
var mountToHand : Bool;
var result : Bool;
uiDataGrid = _inv.GetInventoryItemUIData(gridItem);
uiDataPaperdoll = _inv.GetInventoryItemUIData(paperdollItem);
uiDataPaperdoll.gridPosition = uiDataGrid.gridPosition;
uiDataGrid.gridPosition = -1;
_inv.SetInventoryItemUIData(paperdollItem, uiDataPaperdoll);
_inv.SetInventoryItemUIData(gridItem, uiDataGrid);
mountToHand = _inv.IsItemHeld(paperdollItem);
result = GetWitcherPlayer().UnequipItem(paperdollItem);
if (result){
result = GetWitcherPlayer().EquipItem(gridItem, 10, moun
tToHand);
}
invalidatedItems.PushBack(gridItem);
invalidatedItems.PushBack(paperdollItem);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function EquipItem(item : SItemUniqueId, slot : Int32){
var invalidatedItems : array<SItemUniqueId>;
GetWitcherPlayer().EquipItem(item, slot, /* NOP */);
thePlayer.SetUpdateQuickSlotItems(true);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function EquipItemInGivenSlot(item : SItemUniqueId, slot : Int32)
{
var invalidatedItems : array<SItemUniqueId>;
GetWitcherPlayer().EquipItemInGivenSlot(item, slot, false, /* NO
P */);
thePlayer.SetUpdateQuickSlotItems(true);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function UnequipItem(item : SItemUniqueId){
var invalidatedItems : array<SItemUniqueId>;
GetWitcherPlayer().UnequipItem(item);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function DropItem(item : SItemUniqueId, quantity : Int32){
GetWitcherPlayer().DropItem(item, quantity);
super.DropItem(item, quantity);
/* NOP */;

}
public function UpgradeItem(item : SItemUniqueId, upgrade : SItemUniqueI
d){
var invalidatedItems : array<SItemUniqueId>;
GetWitcherPlayer().ApplyOil(upgrade, item);
_inv.RemoveItem(upgrade, 1);
invalidatedItems.PushBack(item);
invalidatedItems.PushBack(upgrade);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function ConsumeItem(item : SItemUniqueId){
var invalidatedItems : array<SItemUniqueId>;
var itemCategory : CName;
itemCategory = _inv.GetItemCategory(item);
thePlayer.ConsumeItem(item);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function MoveItem(item : SItemUniqueId, moveToIndex : Int32){
var invalidatedItems : array<SItemUniqueId>;
var uiDataGrid : SInventoryItemUIData;
uiDataGrid = _inv.GetInventoryItemUIData(item);
uiDataGrid.gridPosition = moveToIndex;
_inv.SetInventoryItemUIData(item, uiDataGrid);
invalidatedItems.PushBack(item);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function MoveItems(item : SItemUniqueId, moveToIndex : Int32, ite
mSecond : SItemUniqueId, moveSecondToIndex : Int32){
var invalidatedItems : array<SItemUniqueId>;
var uiDataGrid : SInventoryItemUIData;
var uiDataGridSecond : SInventoryItemUIData;
uiDataGrid = _inv.GetInventoryItemUIData(item);
uiDataGridSecond = _inv.GetInventoryItemUIData(itemSecond);
uiDataGrid.gridPosition = moveToIndex;
uiDataGridSecond.gridPosition = moveSecondToIndex;
_inv.SetInventoryItemUIData(item, uiDataGrid);
_inv.SetInventoryItemUIData(itemSecond, uiDataGridSecond);
invalidatedItems.PushBack(item);
invalidatedItems.PushBack(itemSecond);
InvalidateItems(invalidatedItems);
/* NOP */;
}
public function CleanupItemsGridPosition(){
var i : Int32;
var len : Int32;
var curItemId : SItemUniqueId;
var itemsList : array<SItemUniqueId>;
var currentUiData : SInventoryItemUIData;
_inv.GetAllItems(itemsList);
len = itemsList.Size();
i = 0;
while (i < len){
curItemId = itemsList[i];
currentUiData = _inv.GetInventoryItemUIData(curItemId);
currentUiData.gridPosition = -1;
_inv.SetInventoryItemUIData(curItemId, currentUiData);

i += 1;
}
/* NOP */;
}
public function ReadBook(item : SItemUniqueId){
_inv.ReadBook(item);
/* NOP */;
}
public function IsBookRead(item : SItemUniqueId) : Bool{
return _inv.IsBookRead(item);
/* NOP */;
}
public function UpdateTooltip(item : SItemUniqueId, secondItem : SItemUn
iqueId){
}
public function GetItemName(item : SItemUniqueId) : CName{
return _inv.GetItemName(item);
/* NOP */;
}
public function GetCraftedItemInfo(craftedItemName : CName, targetObject
: CScriptedFlashObject){
var playerInv : CInventoryComponent;
var wplayer : W3PlayerWitcher;
var dm : CDefinitionsManagerAccessor;
var htmlNewline : String;
var minQuality : Int32;
var maxQuality : Int32;
var color : String;
var itemType : EInventoryFilterType;
var minWeightAttribute : SAbilityAttributeValue;
var maxWeightAttribute : SAbilityAttributeValue;
var i : Int32;
var attributes : array<SAttributeTooltip>;
var itemName : String;
var itemDesc : String;
var rarity : String;
var rarityId : Int32;
var type : String;
var weight : String;
var attributesStr : String;
var requiredLevel : String;
var primaryStatDiff : String;
var primaryStatLabel : String;
var primaryStatValue : Float;
var primaryStatDiffValue : Float;
var primaryStatDiffStr : String;
var eqPrimaryStatLabel : String;
var eqPrimaryStatValue : Float;
var primaryStatName : CName;
var itemCategory : CName;
var dontCompare : Bool;
var itemSlot : EEquipmentSlots;
var equipedItemId : SItemUniqueId;
var equipedItemStats : array<SAttributeTooltip>;
var attributesList : CScriptedFlashArray;
var addDescription : String;
htmlNewline = "&#10;";
wplayer = GetWitcherPlayer();
dm = theGame.GetDefinitionsManager();
_inv.GetItemStatsFromName(craftedItemName, attributes);

_inv.GetItemQualityFromName(craftedItemName, minQuality, maxQual


ity);
itemType = dm.GetFilterTypeByItem(craftedItemName);
dm.GetItemAttributeValueNoRandom(craftedItemName, true, 'weight'
, minWeightAttribute, maxWeightAttribute);
itemName = GetLocStringByKeyExt(_inv.GetItemLocalizedNameByName(
craftedItemName));
itemDesc = GetLocStringByKeyExt(_inv.GetItemLocalizedDescription
ByName(craftedItemName));
rarityId = minQuality;
rarity = GetItemRarityDescriptionFromInt(minQuality);
type = GetLocStringByKeyExt("item_category_" + dm.GetItemCategor
y(craftedItemName));
weight = GetLocStringByKeyExt("attribute_name_weight") + ": " +
NoTrailZeros(minWeightAttribute.valueBase);
itemCategory = dm.GetItemCategory(craftedItemName);
itemSlot = GetSlotForItemByCategory(itemCategory);
wplayer.GetItemEquippedOnSlot(itemSlot, equipedItemId);
playerInv = thePlayer.GetInventory();
eqPrimaryStatValue = 0;
if (playerInv.IsIdValid(equipedItemId)){
playerInv.GetItemStats(equipedItemId, equipedItemStats);
playerInv.GetItemPrimaryStat(equipedItemId, eqPrimarySta
tLabel, eqPrimaryStatValue);
}
dontCompare = itemCategory == 'potion' || itemCategory == 'petar
d' || itemCategory == 'oil';
playerInv.GetItemPrimaryStatFromName(craftedItemName, primarySta
tLabel, primaryStatValue, primaryStatName);
primaryStatDiff = "none";
primaryStatDiffValue = 0;
primaryStatDiffStr = "";
if (!dontCompare){
primaryStatDiff = GetStatDiff(primaryStatValue, eqPrimar
yStatValue);
primaryStatDiffValue = RoundMath(primaryStatValue) - Rou
ndMath(eqPrimaryStatValue);
if (primaryStatDiffValue > 0){
primaryStatDiffStr = "<font color="#19D900"> +"
+ NoTrailZeros(primaryStatDiffValue) + "</font>";
} else if (primaryStatDiffValue < 0){
primaryStatDiffStr = "<font color="#E00000"> " +
NoTrailZeros(primaryStatDiffValue) + "</font>";
}
if (dm.IsItemWeapon(craftedItemName)){
targetObject.SetMemberFlashNumber("PrimaryStatDe
lta", 0.100000);
} else {
targetObject.SetMemberFlashNumber("PrimaryStatDe
lta", 0);
}
}
if (dm.IsItemAnyArmor(craftedItemName) || dm.IsItemBolt(craftedI
temName) || dm.IsItemWeapon(craftedItemName)){
requiredLevel = _inv.GetItemLevelColor(theGame.GetDefini
tionsManager().GetItemLevelFromName(craftedItemName)) + GetLocStringByKeyExt('pa
nel_inventory_item_requires_level') + " " + theGame.GetDefinitionsManager().GetI
temLevelFromName(craftedItemName) + "</font>";
targetObject.SetMemberFlashString("requiredLevel", requi
redLevel);

}
attributesList = targetObject.CreateFlashArray();
CalculateStatsComparance(attributes, equipedItemStats, targetObj
ect, attributesList, true, dontCompare, /* NOP */);
attributesStr = "";
i = 0;
while (i < attributes.Size()){
color = attributes[i].attributeColor;
attributesStr += "<font color="#" + color + "">";
attributesStr += attributes[i].attributeName + ": ";
if (attributes[i].percentageValue){
attributesStr += RoundMath(attributes[i].value *
100) + " %";
} else {
attributesStr += RoundMath(attributes[i].value);
}
attributesStr += "</font>" + htmlNewline;
i += 1;
}
addDescription = "";
if (maxQuality > 1 && maxQuality < 4){
addDescription += "<font color="#AAFFFC">" + minQuality
- 1 + " - " + maxQuality - 1 + " " + GetLocStringByKeyExt("panel_crafting_number
_random_attributes") + "</font>";
}
targetObject.SetMemberFlashString("additionalDescription", addDe
scription);
targetObject.SetMemberFlashString("itemName", itemName);
targetObject.SetMemberFlashString("itemDescription", itemDesc);
targetObject.SetMemberFlashString("rarity", rarity);
targetObject.SetMemberFlashInt("rarityId", rarityId);
targetObject.SetMemberFlashString("type", type);
targetObject.SetMemberFlashString("weight", weight);
targetObject.SetMemberFlashString("attributes", attributesStr);
targetObject.SetMemberFlashArray("attributesList", attributesLis
t);
targetObject.SetMemberFlashString("PrimaryStatLabel", primarySta
tLabel);
targetObject.SetMemberFlashNumber("PrimaryStatValue", primarySta
tValue);
targetObject.SetMemberFlashString("PrimaryStatDiff", primaryStat
Diff);
targetObject.SetMemberFlashString("PrimaryStatDiffStr", primaryS
tatDiffStr);
/* NOP */;
}
protected function isEquipped(item : SItemUniqueId) : Bool{
return GetWitcherPlayer().IsItemEquipped(item);
/* NOP */;
}
protected function getQuickslotId(item : SItemUniqueId) : Int32{
return GetWitcherPlayer().GetItemSlot(item);
/* NOP */;
}
public function SetInventoryFlashObjectForItem(itemId : SItemUniqueId, f
lashObject : CScriptedFlashObject){
var equipped : Int32;
var slotType : EEquipmentSlots;
var itemCategory : CName;
var itemName : CName;

var bRead : Bool;


var invItem : SInventoryItem;
var itemCost : Int32;
var itemNotForSale : Bool;
var isDefaultBolt : Bool;
var canDrop : Bool;
var dropBlockedByTutorial : Bool;
super.SetInventoryFlashObjectForItem(itemId, flashObject);
isDefaultBolt = _inv.IsItemBolt(itemId) && _inv.ItemHasTag(itemI
d, theGame.params.TAG_INFINITE_AMMO);
itemName = _inv.GetItemName(itemId);
slotType = GetItemEquippedSlot(itemId);
equipped = GetWitcherPlayer().GetItemSlot(itemId);
flashObject.SetMemberFlashInt("equipped", equipped);
flashObject.SetMemberFlashBool("cantUnequip", isDefaultBolt);
itemCategory = _inv.GetItemCategory(itemId);
if (_inv.ItemHasTag(itemId, 'ReadableItem')){
bRead = _inv.IsBookRead(itemId);
flashObject.SetMemberFlashBool("isReaded", bRead);
}
if (_shopInvCmp){
invItem = GetInventoryComponent().GetItem(itemId);
itemCost = _shopInvCmp.GetInventoryComponent().GetInvent
oryItemPriceModified(invItem, true);
if (itemCost <= 0 || _inv.ItemHasTag(itemId, 'Quest')){
itemNotForSale = true;
}
canDrop = false;
} else {
dropBlockedByTutorial = FactsQuerySum("tut_forced_prepar
ation") > 0 && _inv.GetItemName(itemId) == 'Thunderbolt 1';
canDrop = !_inv.ItemHasTag(itemId, 'NoDrop') && !_inv.It
emHasTag(itemId, 'Quest') && !dropBlockedByTutorial && !isDefaultBolt;
}
flashObject.SetMemberFlashBool("canDrop", canDrop);
flashObject.SetMemberFlashBool("disableAction", itemNotForSale);
/* NOP */;
}
public function GetOnlyMiscItems(items : array<SItemUniqueId>){
var tempItems : array<SItemUniqueId>;
var tempItemsToRemove : array<SItemUniqueId>;
var i : Int32;
_inv.GetAllItems(tempItems);
tempItemsToRemove = _inv.GetItemsByTag('AlchemyIngridient');
i = 0;
while (i < tempItemsToRemove.Size()){
tempItems.Remove(tempItemsToRemove[i]);
i += 1;
}
/* NOP */;
tempItemsToRemove = _inv.GetItemsByTag('CraftingIngridient');
i = 0;
while (i < tempItemsToRemove.Size()){
tempItems.Remove(tempItemsToRemove[i]);
i += 1;
}
/* NOP */;
tempItemsToRemove = _inv.GetItemsByTag('Quest');
i = 0;
while (i < tempItemsToRemove.Size()){

tempItems.Remove(tempItemsToRemove[i]);
i += 1;
}
/* NOP */;
/* NOP */;
tempItemsToRemove = _inv.GetAllWeapons();
i = 0;
while (i < tempItemsToRemove.Size()){
tempItems.Remove(tempItemsToRemove[i]);
i += 1;
}
/* NOP */;
i = tempItems.Size() - 1;
while (i > -1){
if (_inv.IsItemAnyArmor(tempItems[i])){
tempItems.Erase(i);
}
i -= 1;
}
/* NOP */;
items = tempItems;
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var itemCategory : CName;
var itemName : CName;
if (bPaperdoll){
return super.ShouldShowItem(item);
}
if (!super.ShouldShowItem(item)){
return false;
}
if (!filterByTagsList(item)){
return false;
}
if (_filterType != 5 && _inv.ItemHasTag(item, 'Quest') && !isHor
seItem(item)){
return false;
}
itemName = _inv.GetItemName(item);
itemCategory = _inv.GetItemCategory(item);
if (itemCategory == 'schematic'){
return false;
}
if (isEquipped(item)){
return false;
}
return CheckIfShouldShowItem(item);
/* NOP */;
}
private function filterByTagsList(item : SItemUniqueId) : Bool{
var i : Int32;
var len : Int32;
len = filterTagList.Size();
i = 0;
while (i < len){
if (!_inv.ItemHasTag(item, filterTagList[i])){
return false;
}
i += 1;

}
return true;
/* NOP */;
}
private function CheckShowItemByCategory(item : SItemUniqueId, itemCateg
ory : CName) : Bool{
var itemName : CName;
itemName = _inv.GetItemName(item);
if (_filterType != 6){
return CheckIfShouldShowItem(item);
} else if (_inv.GetSlotForItemId(item) != 0 && _currentItemCateg
oryType != 'None'){
if (_inv.IsItemQuickslotItem(item)){
switch(_currentItemCategoryType){
case 'quick1':
case 'quick2':
return true;
}
} else if (itemCategory == _currentItemCategoryType){
return true;
} else if (_inv.IsItemSteelSwordUsableByPlayer(item) &&
_currentItemCategoryType == 'steel'){
return true;
} else if (_inv.IsItemSilverSwordUsableByPlayer(item) &&
_currentItemCategoryType == 'silver'){
return true;
}
} else if (_inv.GetSlotForItemId(item) == 0 && _currentItemCateg
oryType == 'None'){
return CheckIfShouldShowItem(item);
}
return false;
/* NOP */;
}
private function CheckIfShouldShowItem(item : SItemUniqueId) : Bool{
var shouldShow : Bool;
shouldShow = false;
switch(_filterType){
case 6:
shouldShow = !isFoodItem(item) && !isIngredientItem(item
) && !isQuestItem(item) && !isWeaponItem(item) && !isArmorItem(item) && !isAlche
myItem(item) && !isUpgradeItem(item) && !isItemSchematic(item) && !isToolItem(it
em) && !isHorseItem(item);
break;
case 5:
shouldShow = isQuestItem(item) && !isHorseItem(item);
break;
case 4:
shouldShow = isIngredientItem(item);
break;
case 1:
shouldShow = isWeaponItem(item) || isArmorItem(item) ||
isUpgradeItem(item) || isHorseItem(item) || isToolItem(item);
break;
case 3:
shouldShow = isAlchemyItem(item) || isFoodItem(item);
break;
case 8:
shouldShow = !isHorseItem(item);
break;

case 0:
shouldShow = true;
break;
default:
break;
}
return shouldShow;
/* NOP */;
}
protected function HAXIsMiscItem(item : SItemUniqueId) : Bool{
return !_inv.ItemHasTag(item, 'CraftingIngredient') && !isQuestI
tem(item) && _inv.GetSlotForItemId(item) == 0;
/* NOP */;
}
protected function GetItems(items : array<SItemUniqueId>){
switch(_filterType){
case 6:
case 1:
case 2:
case 4:
case 3:
_inv.GetAllItems(items);
break;
case 5:
items = _inv.GetItemsByTag('Quest');
break;
default:
break;
}
/* NOP */;
}
public function GetItemActionType(item : SItemUniqueId, bGetDefault : Bo
ol) : EInventoryActionType{
if (!bGetDefault && currentDefaultItemAction != 0){
return currentDefaultItemAction;
} else {
return super.GetItemActionType(item, /* NOP */);
}
/* NOP */;
}
}
import abstract class CStorySceneComponent{
}
import abstract class CSceneAreaComponent{
}
import struct CStorySceneSystem{
import public final function SendSignal(signal : EStorySceneSignalType,
value : Int32);
import public final function PlayScene(scene : CStoryScene, input : Stri
ng);
import public final function IsSkippingLineAllowed() : Bool;
}
import abstract class CFactsDBChoiceMemo{
}
import abstract class CStorySceneEventDuration{

}
import abstract class CStorySceneEventCustomCamera{
}
import abstract class CStorySceneEventAnimClip{
}
import abstract class CStorySceneEventCameraAnim{
}
import abstract class SVoiceWeightCurve{
}
import abstract class CStorySceneEventCurveAnimation{
}
import abstract class CStorySceneEventWalk{
}
import abstract class CStorySceneEventAnimation{
}
class W3GuiDisassembleInventoryComponent extends W3GuiPlayerInventoryComponent{
public var merchantInv : CInventoryComponent;
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
super.SetInventoryFlashObjectForItem(item, flashObject);
addRecyclingPartsList(item, flashObject);
addSocketsListInfo(item, flashObject);
flashObject.SetMemberFlashBool("enableComparison", _inv.CanBeCom
pared(item));
flashObject.SetMemberFlashInt("gridPosition", -1);
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var itemTags : array<CName>;
var parts : array<SItemParts>;
var showItem : Bool;
if (GetWitcherPlayer().IsItemEquipped(item)){
return false;
}
_inv.GetItemTags(item, itemTags);
parts = _inv.GetItemRecyclingParts(item);
showItem = !itemTags.Contains(theGame.params.TAG_DONT_SHOW) && !
itemTags.Contains(theGame.params.TAG_DONT_SHOW_ONLY_IN_PLAYERS) && !_inv.IsItemQ
uest(item);
return parts.Size() > 0 && showItem;
/* NOP */;
}
private function addRecyclingPartsList(item : SItemUniqueId, flashObject
: CScriptedFlashObject){
var idx : Int32;
var len : Int32;
var partList : array<SItemParts>;
var curPart : SItemParts;
var partDataList : CScriptedFlashArray;
var curPartData : CScriptedFlashObject;
var invItem : SInventoryItem;
invItem = _inv.GetItem(item);

partList = _inv.GetItemRecyclingParts(item);
len = partList.Size();
partDataList = flashObject.CreateFlashArray();
idx = 0;
while (idx < len){
curPart = partList[idx];
curPartData = flashObject.CreateFlashObject(/* NOP */);
curPartData.SetMemberFlashString("name", GetLocStringByK
eyExt(_inv.GetItemLocalizedNameByName(curPart.itemName)));
curPartData.SetMemberFlashString("iconPath", _inv.GetIte
mIconPathByName(curPart.itemName));
curPartData.SetMemberFlashInt("quantity", 1);
partDataList.PushBackFlashObject(curPartData);
idx += 1;
}
flashObject.SetMemberFlashArray("partList", partDataList);
flashObject.SetMemberFlashBool("disableAction", GetWitcherPlayer
().IsItemEquipped(item));
flashObject.SetMemberFlashInt("actionPrice", merchantInv.GetItem
PriceDisassemble(invItem));
/* NOP */;
}
private function addSocketsListInfo(item : SItemUniqueId, flashObject :
CScriptedFlashObject){
var idx : Int32;
var socketsCount : Int32;
var usedSocketsCount : Int32;
var socketItems : array<CName>;
var socketList : CScriptedFlashArray;
var socketData : CScriptedFlashObject;
_inv.GetItemEnhancementItems(item, socketItems);
socketsCount = _inv.GetItemEnhancementSlotsCount(item);
usedSocketsCount = _inv.GetItemEnhancementCount(item);
socketList = flashObject.CreateFlashArray();
idx = 0;
while (idx < usedSocketsCount){
socketData = flashObject.CreateFlashObject(/* NOP */);
socketData.SetMemberFlashString("name", GetLocStringByKe
yExt(_inv.GetItemLocalizedNameByName(socketItems[idx])));
socketData.SetMemberFlashString("iconPath", _inv.GetItem
IconPathByName(socketItems[idx]));
socketList.PushBackFlashObject(socketData);
idx += 1;
}
flashObject.SetMemberFlashArray("socketsData", socketList);
flashObject.SetMemberFlashInt("socketsCount", socketsCount);
/* NOP */;
}
}
import abstract class CStorySceneEventAdditiveAnimation{
}
import abstract class CStorySceneEventOverrideAnimation{
}
class W3GuiRepairInventoryComponent extends W3GuiBaseInventoryComponent{
public var merchantInv : CInventoryComponent;
public var masteryLevel : Int32;
public var repairSwords : Bool;

public var repairArmors : Bool;


public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
var durabilityValue : String;
var costOfService : Int32;
var costRepairPoint : Int32;
var isEquipped : Bool;
var invItem : SInventoryItem;
super.SetInventoryFlashObjectForItem(item, flashObject);
invItem = _inv.GetItem(item);
durabilityValue = IntToString(_inv.GetItemDurability(item) / _in
v.GetItemMaxDurability(item) * 100) + "%";
merchantInv.GetItemPriceRepair(invItem, costRepairPoint, costOfS
ervice);
isEquipped = GetWitcherPlayer().IsItemEquipped(item);
flashObject.SetMemberFlashBool("enableComparison", _inv.CanBeCom
pared(item));
flashObject.SetMemberFlashBool("isEquipped", isEquipped);
flashObject.SetMemberFlashString("durability", durabilityValue);
flashObject.SetMemberFlashBool("disableAction", _inv.GetItemQual
ity(item) > masteryLevel);
flashObject.SetMemberFlashInt("actionPrice", costOfService);
flashObject.SetMemberFlashInt("gridPosition", -1);
/* NOP */;
}
public function GetTotalRepairCost() : Int32{
var i : Int32;
var rawItems : array<SItemUniqueId>;
var item : SItemUniqueId;
var invItem : SInventoryItem;
var costOfService : Int32;
var costRepairPoint : Int32;
var totalCost : Int32;
_inv.GetAllItems(rawItems);
totalCost = 0;
i = 0;
while (i < rawItems.Size()){
item = rawItems[i];
if (ShouldShowItem(item)){
invItem = _inv.GetItem(item);
merchantInv.GetItemPriceRepair(invItem, costRepa
irPoint, costOfService);
totalCost += costOfService;
}
i += 1;
}
return totalCost;
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var durabilityFlag : Bool;
var itemName : CName;
itemName = GetItemName(item);
durabilityFlag = false;
if (CanRepairItem(item)){
if (_inv.HasItemDurability(item)){
if (_inv.GetItemDurability(item) < _inv.GetItemM
axDurability(item)){
durabilityFlag = true;
}

}
}
durabilityFlag = super.ShouldShowItem(item) && durabilityFlag;
return durabilityFlag;
/* NOP */;
}
public function RepairItem(item : SItemUniqueId, priceModiffier : Float)
{
_inv.SetItemDurabilityScript(item, _inv.GetItemMaxDurability(ite
m));
_inv.RemoveMoney(_inv.GetRepairPrice(item) * priceModiffier);
/* NOP */;
}
public function RepairAllItems(priceModiffier : Float){
var items : array<SItemUniqueId>;
var i : Int32;
_inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (CanRepairItem(items[i])){
if (_inv.HasItemDurability(items[i])){
if (_inv.GetItemDurability(items[i]) < _
inv.GetItemMaxDurability(items[i])){
RepairItem(items[i], priceModiff
ier);
}
}
}
i += 1;
}
/* NOP */;
}
public function CanRepairItem(item : SItemUniqueId) : Bool{
if (repairArmors && _inv.IsItemAnyArmor(item) || repairSwords &&
_inv.IsItemSteelSwordUsableByPlayer(item) || _inv.IsItemSilverSwordUsableByPlay
er(item)){
return true;
}
return false;
/* NOP */;
}
public function GetRepairPrice(item : SItemUniqueId) : Float{
return _inv.GetRepairPrice(item);
/* NOP */;
}
public function GetRepairAllPrice() : Float{
var items : array<SItemUniqueId>;
var i : Int32;
var price : Float;
price = 0;
_inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (CanRepairItem(items[i])){
if (_inv.HasItemDurability(items[i])){
if (_inv.GetItemDurability(items[i]) < _
inv.GetItemMaxDurability(items[i])){
price += GetRepairPrice(items[i]
);
}

}
}
i += 1;
}
return price;
/* NOP */;
}
}
import abstract class CStorySceneEventCustomCameraInstance{
}
import abstract class CStorySceneEventStartBlendToGameplayCamera{
}
class W3GuiSocketsInventoryComponent extends W3GuiPlayerInventoryComponent{
public var merchantInv : CInventoryComponent;
protected var m_upgradeItem : SItemUniqueId;
protected var m_useSocketsFilter : Bool;
public function SetUpgradableFilter(item : SItemUniqueId){
m_upgradeItem = item;
/* NOP */;
}
public function SetSocketsFilter(value : Bool){
m_useSocketsFilter = value;
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var upgradeFilter : Bool;
var socketFilter : Bool;
if (_inv.IsIdValid(m_upgradeItem)){
upgradeFilter = CanBeUpgradedBy(item, m_upgradeItem);
} else {
upgradeFilter = true;
}
if (m_useSocketsFilter){
socketFilter = HasFilledSockets(item);
} else {
socketFilter = true;
}
return upgradeFilter && socketFilter;
/* NOP */;
}
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
var invItem : SInventoryItem;
super.SetInventoryFlashObjectForItem(item, flashObject);
invItem = _inv.GetItem(item);
addSocketsListInfo(item, flashObject);
flashObject.SetMemberFlashBool("enableComparison", _inv.CanBeCom
pared(item));
flashObject.SetMemberFlashInt("actionPrice", merchantInv.GetItem
PriceRemoveUpgrade(invItem));
flashObject.SetMemberFlashInt("gridPosition", -1);
/* NOP */;
}
private function addSocketsListInfo(item : SItemUniqueId, flashObject :
CScriptedFlashObject){
var idx : Int32;
var socketsCount : Int32;

var usedSocketsCount : Int32;


var socketItems : array<CName>;
var socketList : CScriptedFlashArray;
var socketData : CScriptedFlashObject;
_inv.GetItemEnhancementItems(item, socketItems);
socketsCount = _inv.GetItemEnhancementSlotsCount(item);
usedSocketsCount = _inv.GetItemEnhancementCount(item);
socketList = flashObject.CreateFlashArray();
idx = 0;
while (idx < usedSocketsCount){
socketData = flashObject.CreateFlashObject(/* NOP */);
socketData.SetMemberFlashString("name", GetLocStringByKe
yExt(_inv.GetItemLocalizedNameByName(socketItems[idx])));
socketData.SetMemberFlashString("iconPath", _inv.GetItem
IconPathByName(socketItems[idx]));
socketList.PushBackFlashObject(socketData);
idx += 1;
}
flashObject.SetMemberFlashArray("socketsData", socketList);
flashObject.SetMemberFlashInt("socketsCount", socketsCount);
/* NOP */;
}
private function HasFilledSockets(targetItem : SItemUniqueId) : Bool{
var usedSocketsCount : Int32;
usedSocketsCount = _inv.GetItemEnhancementCount(targetItem);
return usedSocketsCount > 0;
/* NOP */;
}
}
import abstract class CStorySceneEventDespawn{
}
import abstract class CStorySceneEventVisibility{
}
import abstract class CStorySceneEventApplyAppearance{
}
import abstract class CStorySceneEventMimicLod{
}
import abstract class CStorySceneEventUseHiresShadows{
}
import abstract class CStorySceneEventPropVisibility{
}
import abstract class CStorySceneEventWeatherChange{
}
import abstract class CStorySceneEventEnterActor{
}
import abstract class CStorySceneEventExitActor{
}
import abstract class CStorySceneEventFade{
}

class PriceConfirmationPopupData extends ConfirmationPopupData{


private var m_Price : Float;
public var menuRef : CR4BlacksmithMenu;
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = parentFlashValueStorage.CreateTempFlashObject(/*
NOP */);
l_flashObject.SetMemberFlashString("ContentRef", GetContentRef()
);
l_flashObject.SetMemberFlashString("TextContent", m_TextContent)
;
l_flashObject.SetMemberFlashString("TextTitle", m_TextTitle);
l_flashObject.SetMemberFlashNumber("ItempPrice", m_Price);
return l_flashObject;
/* NOP */;
}
public function SetPrice(value : Float){
m_Price = value;
/* NOP */;
}
protected function GetContentRef() : String{
return "PriceConfirmationPopupRef";
/* NOP */;
}
protected function OnUserAccept(){
menuRef.HandleActionConfirmation(true);
ClosePopup();
/* NOP */;
}
protected function OnUserDecline(){
menuRef.HandleActionConfirmation(false);
ClosePopup();
/* NOP */;
}
}
import abstract class CStorySceneEventLookAt{
}
import abstract class CStorySceneEventLookAtDuration{
}
class RepairAllPopupData extends ConfirmationPopupData{
private var m_Price : Float;
public var menuRef : CR4BlacksmithMenu;
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = parentFlashValueStorage.CreateTempFlashObject(/*
NOP */);
l_flashObject.SetMemberFlashString("ContentRef", GetContentRef()
);
l_flashObject.SetMemberFlashString("TextContent", "");
l_flashObject.SetMemberFlashString("TextTitle", GetLocStringByKe
yExt("panel_button_common_repair_all"));
l_flashObject.SetMemberFlashNumber("ItempPrice", m_Price);
return l_flashObject;
/* NOP */;
}

public function SetPrice(value : Float){


m_Price = value;
/* NOP */;
}
protected function GetContentRef() : String{
return "PriceConfirmationPopupRef";
/* NOP */;
}
protected function OnUserAccept(){
menuRef.RepairAll();
ClosePopup();
/* NOP */;
}
protected function OnUserDecline(){
ClosePopup();
/* NOP */;
}
}
import abstract class SStorySceneEventLookAtBlinkSettings{
}
import abstract class CStorySceneEventGameplayLookAt{
}
class QuantityPopupData extends SliderPopupData{
public var itemId : SItemUniqueId;
public var itemCost : Float;
public var showPrice : Bool;
public var actionType : EQuantityTransferFunction;
public var inventoryRef : CR4InventoryMenu;
public var blacksmithRef : CR4BlacksmithMenu;
protected function GetPopupTitle() : String{
var titleText : String;
switch(actionType){
case 0:
titleText = "panel_inventory_quantity_popup_sell";
break;
case 1:
titleText = "panel_inventory_quantity_popup_buy";
break;
case 2:
titleText = "panel_inventory_quantity_popup_transfer";
break;
case 3:
titleText = "panel_inventory_quantity_popup_transfer";
break;
case 4:
titleText = "panel_inventory_quantity_popup_drop";
break;
case 5:
titleText = "panel_title_blacksmith_disassamble";
break;
default:
titleText = "";
}
return titleText;
/* NOP */;
}
protected function GetContentRef() : String{

return "QuantityPopupRef";
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_accept", "enter-gamepad_A", 69
);
AddButtonDef("panel_button_common_exit", "escape-gamepad_B", 27)
;
AddButtonDef("panel_button_common_adjust", "gamepad_L3", /* NOP
*/);
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = super.GetGFxData(parentFlashValueStorage);
l_flashObject.SetMemberFlashNumber("ItempPrice", itemCost);
l_flashObject.SetMemberFlashBool("ShowPrice", showPrice);
l_flashObject.SetMemberFlashString("TextTitle", GetLocStringByKe
yExt(GetPopupTitle()));
return l_flashObject;
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
var newItemId : SItemUniqueId;
var curInventory : CInventoryComponent;
var updateInfiniteBolts : Bool;
var isItemEquipped : Bool;
updateInfiniteBolts = false;
if (KeyCode == "escape-gamepad_B"){
if (actionType == 5 && blacksmithRef){
blacksmithRef.HandleActionConfirmation(false);
}
ClosePopup();
} else if (KeyCode == "enter-gamepad_A"){
switch(actionType){
case 0:
newItemId = inventoryRef.SellItem(itemId, curren
tValue);
curInventory = inventoryRef.getShopInventory();
if (curInventory && curInventory.IsIdValid(newIt
emId)){
if (currentValue == maxValue){
inventoryRef.InventoryRemoveItem
(itemId, /* NOP */);
} else {
inventoryRef.InventoryUpdateItem
(itemId);
}
inventoryRef.ShopUpdateItem(newItemId);
inventoryRef.UpdatePlayerMoney();
inventoryRef.UpdateMerchantData();
}
break;
case 1:
inventoryRef.BuyItem(itemId, currentValue);
inventoryRef.UpdatePlayerMoney();
inventoryRef.UpdateMerchantData();
break;
case 2:

inventoryRef.GiveItem(itemId, currentValue);
inventoryRef.UpdateData();
break;
case 3:
inventoryRef.TakeItem(itemId, currentValue);
inventoryRef.UpdateData();
break;
case 4:
curInventory = inventoryRef.GetCurrentInventory(
itemId);
isItemEquipped = GetWitcherPlayer().IsItemEquipp
ed(itemId);
if (curInventory.IsItemBolt(itemId) && !curInven
tory.ItemHasTag(itemId, theGame.params.TAG_INFINITE_AMMO)){
updateInfiniteBolts = true;
}
inventoryRef.FinalDropItem(itemId, currentValue)
;
if (currentValue == maxValue){
if (updateInfiniteBolts){
inventoryRef.PaperdollUpdateAll(
);
} else {
inventoryRef.PaperdollRemoveItem
(itemId);
}
inventoryRef.InventoryRemoveItem(itemId,
/* NOP */);
} else {
inventoryRef.InventoryUpdateItem(itemId)
;
}
break;
case 5:
if (blacksmithRef){
blacksmithRef.OnDisassembleStack(itemId,
itemCost * currentValue, currentValue);
}
break;
default:
break;
}
inventoryRef.UpdateAllItemData();
ClosePopup();
}
/* NOP */;
}
}
import abstract class CStorySceneEventMimics{
}
import abstract class CStorySceneEventMimicsAnim{
}
import abstract class CStorySceneEventMimicsPose{
}
import abstract class CStorySceneEventMimicsFilter{
}

import abstract class CStorySceneEventRotate{


}
import abstract class CStorySceneEventSound{
}
import abstract class CStorySceneEventHitSound{
}
import abstract class CStorySceneEventCamera{
}
import abstract class CStorySceneEventGameplayCamera{
}
import abstract class CStorySceneEventCameraBlend{
}
class W3InventoryInitData extends W3MenuInitData{
public var containerNPC : CGameplayEntity;
public var filterTagsList : array<CName>;
}
import abstract class CStorySceneCameraBlendEvent{
}
import abstract class CStorySceneEventOpenDoor{
}
import abstract class CStorySceneEventCsCamera{
}
import abstract class CStorySceneEventWorldEntityEffect{
}
import abstract class CStorySceneEventReward{
}
import abstract class CStorySceneEventTimelapse{
}
import abstract class CStorySceneEventHideScabbard{
}
import abstract class CStorySceneEventCameraLight{
}
import abstract class SStorySceneCameraLightMod{
}
import abstract class CStorySceneEventAttachPropToSlot{
}
import abstract class CStorySceneEventBlend{
}
import abstract class CStorySceneEventCurveBlend{
}

import abstract class CStorySceneEventEnhancedCameraBlend{


}
import abstract class CStorySceneEventChangePose{
}
import abstract class CStorySceneEventOverridePlacement{
}
import abstract class CStorySceneEventOverridePlacementDuration{
}
import abstract class CStorySceneEventChangeActorGameState{
}
import abstract class SStorySceneEventGroupEntry{
}
import abstract class CStorySceneEventGroup{
}
import abstract class CStorySceneEventEquipItem{
}
import abstract class CStorySceneMorphEvent{
}
import abstract class CStorySceneDisablePhysicsClothEvent{
}
import abstract class CStorySceneDanglesShakeEvent{
}
import abstract class CStorySceneDisableDangleEvent{
}
import abstract class CStorySceneResetClothAndDanglesEvent{
}
import abstract class CStorySceneActorEffectEvent{
}
import abstract class CStoryScenePropEffectEvent{
}
import abstract class CStorySceneActorEffectEventDuration{
}
import abstract class CStorySceneEventDialogLine{
}
import abstract class CStorySceneEventScenePropPlacement{
}
import abstract class CStorySceneEventWorldPropPlacement{
}
import abstract class CStorySceneEventPoseKey{
}

class ItemInfoPopupData extends TextPopupData{


public var invRef : CInventoryComponent;
public var itemId : SItemUniqueId;
public var inventoryRef : CR4InventoryMenu;
protected var invComponent : CInventoryComponent;
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var flashDataObject : CScriptedFlashObject;
var tooltipComponent : W3TooltipComponent;
invComponent = thePlayer.GetInventory();
tooltipComponent = new W3TooltipComponent in this;
tooltipComponent.initialize(invComponent, parentFlashValueStorag
e);
tooltipComponent.setCurrentInventory(invRef);
flashDataObject = tooltipComponent.GetExItemData(itemId, /* NOP
*/);
flashDataObject.SetMemberFlashString("ContentRef", GetContentRef
());
return flashDataObject;
/* NOP */;
}
public function SetupOverlayRef(target : CR4MenuPopup){
var defMgr : CDefinitionsManagerAccessor;
var templateName : String;
var itemCategory : CName;
super.SetupOverlayRef(target);
defMgr = theGame.GetDefinitionsManager();
templateName = defMgr.GetItemEquipTemplate(invRef.GetItemName(it
emId));
itemCategory = invRef.GetItemCategory(itemId);
/* NOP */;
}
protected function ClosePopup(){
inventoryRef.OnItemPopupClosed();
PopupRef.RequestClose();
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
if (KeyCode == "escape-gamepad_B"){
ClosePopup();
}
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_exit", "escape-gamepad_B", 27)
;
/* NOP */;
}
protected function GetContentRef() : String{
return "ItemInfoPopupRef";
/* NOP */;
}
}
import abstract class SSSBoneTransform{
}
import abstract class SSSTrackTransform{
}

import abstract class CStorySceneEventLightProperties{


}
import abstract class CStorySceneEventInterpolation{
}
import abstract class CStorySceneEventCameraInterpolation{
}
class CR4CharacterMenu extends CR4MenuBase{
protected var initDataBuySkill : W3BuySkillConfirmation;
private var _playerInv : W3GuiPlayerInventoryComponent;
protected var _inv : CInventoryComponent;
private var _charStatsPopupData : CharacterStatsPopupData;
private var _sentStats : array<SentStatsData>;
protected var currentlySelectedTab : Int32;
private var m_fxPaperdollChanged : CScriptedFlashFunction;
private var m_fxClearSkillSlot : CScriptedFlashFunction;
private var m_fxNotifySkillUpgraded : CScriptedFlashFunction;
private var m_previousSkillBonuses : array<String>;
public function OnConfigUI() : Bool{
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var filterTagsList : array<CName>;
super.OnConfigUI();
m_initialSelectionsToIgnore = 3;
m_fxPaperdollChanged = m_flashModule.GetMemberFlashFunction("onP
aperdollChanged");
m_fxClearSkillSlot = m_flashModule.GetMemberFlashFunction("clear
SkillSlot");
m_fxNotifySkillUpgraded = m_flashModule.GetMemberFlashFunction("
notifySkillUpgraded");
SendCombatState();
_inv = thePlayer.GetInventory();
_playerInv = new W3GuiPlayerInventoryComponent in this;
_playerInv.Initialize(_inv);
filterTagsList.PushBack('MutagenIngredient');
_playerInv.SetFilterType(4);
_playerInv.filterTagList = filterTagsList;
UpdateData(true);
/* NOP */;
}
public function OnClosingMenu() : Bool{
var hud : CR4ScriptedHud;
super.OnClosingMenu();
if (GetCurrentSkillPoints() < 1){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.OnShowLevelUpIndicator(false);
}
}
if (_charStatsPopupData){
_charStatsPopupData.ClosePopupOverlay();
delete _charStatsPopupData;
}
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (_playerInv){
delete _playerInv;

}
CloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
/* NOP */;
}
public function OnTabDataRequested(tabIndex : Int32) : Bool{
PopulateTabData(tabIndex);
/* NOP */;
}
public function OnTabChanged(tabIndex : Int32) : Bool{
var uiState : W3TutorialManagerUIHandlerStateCharDevMutagens;
currentlySelectedTab = tabIndex;
if (tabIndex == 4 && ShouldProcessTutorial('TutorialMutagenDescr
iption')){
uiState = (W3TutorialManagerUIHandlerStateCharDevMutagen
s)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiState){
uiState.SelectedMutagensTab();
}
}
/* NOP */;
}
private function PopulateTabData(tabIndex : Int32){
switch(tabIndex){
case 0:
PopulateDataForTabWithSkills(0, 1);
break;
case 1:
PopulateDataForTabWithSkills(1, 2);
break;
case 2:
PopulateDataForTabWithSkills(2, 3);
break;
case 3:
PopulateDataForTabWithSkills(3, 4);
break;
case 4:
PopulateDataForMutagenTab();
break;
}
/* NOP */;
}
private function PopulateDataForTabWithSkills(tabIndex : Int32, skillTyp
e : ESkillPath){
var gfxSkill : CScriptedFlashObject;
var gfxSkillsList : CScriptedFlashArray;
var skillsList : array<SSkill>;
var curSkill : SSkill;
var i : Int32;
var len : Int32;
gfxSkillsList = m_flashValueStorage.CreateTempFlashArray();
skillsList = thePlayer.GetPlayerSkills();
len = skillsList.Size();
i = 1;
while (i < len){
curSkill = skillsList[i];
if (curSkill.skillPath == skillType && curSkill.skillSub
Path != 0 && curSkill.skillSubPath != 31){

gfxSkill = m_flashValueStorage.CreateTempFlashOb
ject(/* NOP */);
GetSkillGFxObject(curSkill, gfxSkill);
gfxSkillsList.PushBackFlashObject(gfxSkill);
}
i += 1;
}
PopulateDataForTab(tabIndex, gfxSkillsList);
/* NOP */;
}
private function PopulateDataForMutagenTab(){
var mutagenItemData : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
mutagenItemData = m_flashValueStorage.CreateTempFlashArray();
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
if (_playerInv){
_playerInv.GetInventoryFlashArray(mutagenItemData, l_fla
shObject);
}
PopulateDataForTab(4, mutagenItemData);
/* NOP */;
}
private function PopulateDataForTab(tabIndex : Int32, entriesArray : CSc
riptedFlashArray){
var l_flashObject : CScriptedFlashObject;
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
l_flashObject.SetMemberFlashInt("tabIndex", tabIndex);
l_flashObject.SetMemberFlashArray("tabData", entriesArray);
if (entriesArray.GetLength() > 0){
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
m_flashValueStorage.SetFlashObject("character.menu.tabs.data" +
tabIndex, l_flashObject, /* NOP */);
/* NOP */;
}
private function GetTabForSkill(skillID : ESkill) : CharacterMenuTabInde
xes{
var skill : SSkill;
skill = thePlayer.GetPlayerSkill(skillID);
switch(skill.skillPath){
case 1:
case 0:
return 0;
case 2:
return 1;
case 3:
return 2;
case 4:
return 3;
}
return 0;
/* NOP */;
}
public function OnStartApplyMode() : Bool{

OnPlaySoundEvent("gui_global_panel_open");
/* NOP */;
}
public function OnCancelApplyMode() : Bool{
OnPlaySoundEvent("gui_global_panel_close");
/* NOP */;
}
public function OnInventoryItemSelected(itemId : SItemUniqueId) : Bool{
if (_inv.IsIdValid(itemId)){
_playerInv.ClearItemIsNewFlag(itemId);
}
/* NOP */;
}
public function OnBuySkill(skill : ESkill, slotID : Int32) : Bool{
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
tryUnequipSkill(skill);
thePlayer.AddSkill(skill, /* NOP */);
thePlayer.EquipSkill(skill, slotID);
OnPlaySoundEvent("gui_character_buy_skill");
UpdateSkillPoints();
PopulateTabData(GetTabForSkill(skill));
}
/* NOP */;
}
public function OnSwapSkill(skill1 : ESkill, slotID1 : Int32, skill2 : E
Skill, slotID2 : Int32) : Bool{
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
thePlayer.EquipSkill(skill1, slotID1);
thePlayer.EquipSkill(skill2, slotID2);
UpdateAppliedSkills();
UpdateSkillPoints();
UpdateMutagens();
UpdatePlayerStatisticsData();
UpdateGroupsData();
OnPlaySoundEvent("gui_character_add_skill");
}
/* NOP */;
}
public function OnEquipSkill(skill : ESkill, slotID : Int32) : Bool{
var oldSkill : ESkill;
var foundSkill : Bool;
var oldSkillSlot : Int32;
var targetSlot : SSkillSlot;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
foundSkill = thePlayer.GetSkillOnSlot(slotID, oldSkill);
OnPlaySoundEvent("gui_character_add_skill");
if (!foundSkill || oldSkill != skill){
tryUnequipSkill(skill);

thePlayer.EquipSkill(skill, slotID);
PopulateTabData(GetTabForSkill(skill));
if (oldSkillSlot != -1){
m_fxClearSkillSlot.InvokeSelfOneArg(Flas
hArgInt(oldSkillSlot));
}
UpdateAppliedSkill(slotID);
UpdateGroupsData();
UpdateMutagens();
UpdatePlayerStatisticsData();
if (oldSkill != 0){
PopulateTabData(GetTabForSkill(oldSkill)
);
}
m_fxPaperdollChanged.InvokeSelf();
}
}
/* NOP */;
}
public function OnUnequipSkill(slotID : Int32) : Bool{
var skill : ESkill;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
thePlayer.GetSkillOnSlot(slotID, skill);
OnPlaySoundEvent("gui_character_remove_skill");
/* NOP */;
thePlayer.UnequipSkill(slotID);
PopulateTabData(GetTabForSkill(skill));
UpdateAppliedSkill(slotID);
UpdateGroupsData();
UpdateMutagens();
UpdatePlayerStatisticsData();
m_fxPaperdollChanged.InvokeSelf();
}
/* NOP */;
}
public function OnUpgradeSkill(skillID : ESkill) : Bool{
var skill : SSkill;
skill = thePlayer.GetPlayerSkill(skillID);
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
initDataBuySkill = new W3BuySkillConfirmation in this;
initDataBuySkill.HideTutorial = true;
if (skill.level == 0){
initDataBuySkill.SetMessageTitle(GetLocStringByK
eyExt("panel_character_popup_title_buy_skill"));
initDataBuySkill.SetMessageText(GetLocStringByKe
yExt("panel_character_popup_title_buy_skill_text"));
} else {
initDataBuySkill.SetMessageTitle(GetLocStringByK
eyExt("panel_character_popup_title_upgrade_skill"));
initDataBuySkill.SetMessageText(GetLocStringByKe
yExt("panel_character_popup_title_upgrade_skill_text"));
}

initDataBuySkill.characterMenuRef = this;
initDataBuySkill.targetSkill = skillID;
initDataBuySkill.BlurBackground = true;
RequestSubMenu('PopupMenu', initDataBuySkill);
}
/* NOP */;
}
public function OnEquipMutagen(itemID : SItemUniqueId, slotId : EEquipme
ntSlots) : Bool{
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
GetWitcherPlayer().EquipItemInGivenSlot(itemID, slotId,
false, /* NOP */);
OnPlaySoundEvent("gui_character_place_mutagen");
UpdateMutagens();
UpdateGroupsData();
PopulateTabData(4);
UpdatePlayerStatisticsData();
m_fxPaperdollChanged.InvokeSelf();
}
/* NOP */;
}
public function OnUnequipMutagen(slotID : Int32) : Bool{
var mutagen : SItemUniqueId;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
/* NOP */;
GetWitcherPlayer().UnequipItemFromSlot(slotID, /* NOP */
);
OnPlaySoundEvent("gui_character_remove_mutagen");
RemoveMutagenBonus();
UpdateMutagens();
UpdateGroupsData();
UpdatePlayerStatisticsData();
PopulateTabData(4);
m_fxPaperdollChanged.InvokeSelf();
}
/* NOP */;
}
protected function tryUnequipSkill(skill : ESkill){
var currentSkillSlotIdx : Int32;
var res : Bool;
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
} else {
currentSkillSlotIdx = thePlayer.GetSkillSlotIndexFromSki
ll(skill);
/* NOP */;
if (currentSkillSlotIdx > -1){
res = thePlayer.UnequipSkill(currentSkillSlotIdx
+ 1);
}

m_fxClearSkillSlot.InvokeSelfOneArg(FlashArgInt(currentS
killSlotIdx + 1));
RemoveMutagenBonus();
UpdateMutagens();
}
/* NOP */;
}
public function handleBuySkillConfirmation(skill : ESkill){
var m_guiManager : CR4GuiManager;
thePlayer.AddSkill(skill, /* NOP */);
OnPlaySoundEvent("gui_character_buy_skill");
UpdateSkillPoints();
PopulateTabData(GetTabForSkill(skill));
UpdateAppliedSkillIfEquipped(skill);
UpdatePlayerStatisticsData();
UpdateMutagens();
UpdateGroupsData();
m_guiManager = theGame.GetGuiManager();
m_guiManager.RegisterNewSkillEntry(skill);
m_fxNotifySkillUpgraded.InvokeSelfOneArg(FlashArgInt(skill));
/* NOP */;
}
public function UpdateData(tabs : Bool){
if (tabs){
PopulateTabData(0);
PopulateTabData(1);
PopulateTabData(2);
PopulateTabData(3);
PopulateTabData(4);
}
UpdateAppliedSkills();
UpdateSkillPoints();
UpdateMutagens();
UpdatePlayerStatisticsData();
UpdateGroupsData();
/* NOP */;
}
protected function UpdateGroupsData(){
var gfxGroupsList : CScriptedFlashArray;
var i : Int32;
var j : Int32;
gfxGroupsList = m_flashValueStorage.CreateTempFlashArray();
RemoveMutagenBonus();
gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(1));
gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(2));
gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(3));
gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(4));
m_flashValueStorage.SetFlashArray("character.groups.bonus", gfxG
roupsList);
/* NOP */;
}
private function RemoveMutagenBonus(){
var i : Int32;
i = 0;
while (i < 20){
thePlayer.RemoveAbility('greater_mutagen_color_green_x')
;
thePlayer.RemoveAbility('greater_mutagen_color_red_x');
thePlayer.RemoveAbility('greater_mutagen_color_blue_x');
thePlayer.RemoveAbility('lesser_mutagen_color_green_x');

thePlayer.RemoveAbility('lesser_mutagen_color_red_x');
thePlayer.RemoveAbility('lesser_mutagen_color_blue_x');
thePlayer.RemoveAbility('mutagen_color_green_x');
thePlayer.RemoveAbility('mutagen_color_red_x');
thePlayer.RemoveAbility('mutagen_color_blue_x');
i += 1;
}
/* NOP */;
}
private function GetGroupBonusDescription(groupId : Int32) : String{
var defManager : CDefinitionsManagerAccessor;
var curAttributeValue : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var curAttributeCalc : Float;
var curDescription : String;
var curAbilityName : CName;
var attributes : array<CName>;
var curColorCount : Int32;
var i : Int32;
var hasAbility : Bool;
var mutagen : SItemUniqueId;
var hasMutagen : Bool;
var mutagenStats : array<SAttributeTooltip>;
var attributeValue : Float;
var synergyBonus : Float;
var pam : W3PlayerAbilityManager;
hasMutagen = GetWitcherPlayer().GetItemEquippedOnSlot(thePlayer.
GetMutagenSlotIDFromGroupID(groupId), mutagen);
pam = (W3PlayerAbilityManager)thePlayer.abilityManager;
curAbilityName = thePlayer.GetSkillGroupBonus(groupId);
curColorCount = 1 + thePlayer.GetGroupBonusCount(thePlayer.GetIn
ventory().GetSkillMutagenColor(mutagen), groupId);
hasAbility = thePlayer.HasAbility(curAbilityName);
if (curAbilityName == 'None' || !hasAbility && !hasMutagen){
return "";
}
if (hasMutagen){
_inv.GetItemStats(mutagen, mutagenStats);
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_
color_red_synergy_bonus'){
thePlayer.AddAbilityMultiple('mutagen_color_red_
x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_
color_green_synergy_bonus'){
thePlayer.AddAbilityMultiple('mutagen_color_gree
n_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_
color_blue_synergy_bonus'){
thePlayer.AddAbilityMultiple('mutagen_color_blue
_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_
color_lesser_red_synergy_bonus'){
thePlayer.AddAbilityMultiple('lesser_mutagen_col
or_red_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_

color_lesser_green_synergy_bonus'){
thePlayer.AddAbilityMultiple('lesser_mutagen_col
or_green_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_
color_lesser_blue_synergy_bonus'){
thePlayer.AddAbilityMultiple('lesser_mutagen_col
or_blue_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'greater_
mutagen_color_red_synergy_bonus'){
thePlayer.AddAbilityMultiple('greater_mutagen_co
lor_red_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'greater_
mutagen_color_green_synergy_bonus'){
thePlayer.AddAbilityMultiple('greater_mutagen_co
lor_green_x', curColorCount - 1);
}
if (pam.GetMutagenBonusAbilityName(mutagen) == 'greater_
mutagen_color_blue_synergy_bonus'){
thePlayer.AddAbilityMultiple('greater_mutagen_co
lor_blue_x', curColorCount - 1);
}
i = 0;
while (i < mutagenStats.Size()){
curDescription = mutagenStats[i].attributeName +
" ";
if (i > 0){
curDescription += ", ";
}
if (hasAbility){
attributeValue = mutagenStats[i].value *
curColorCount;
} else {
attributeValue = mutagenStats[i].value *
curColorCount;
}
if (GetWitcherPlayer().CanUseSkill(76)){
synergyBonus = CalculateAttributeValue(G
etWitcherPlayer().GetSkillAttributeValue(76, 'synergy_bonus', false, false), /*
NOP */);
synergyBonus *= GetWitcherPlayer().GetSk
illLevel(76);
attributeValue += attributeValue * syner
gyBonus;
}
if (mutagenStats[i].percentageValue){
curDescription += "+" + RoundMath(attrib
uteValue * 100) + "%";
} else {
curDescription += "+" + RoundMath(attrib
uteValue);
}
i += 1;
}
}
return curDescription;
/* NOP */;
}

protected function CreateBonusGFxData(index : Int32) : CScriptedFlashObj


ect{
var gfxGroupBonus : CScriptedFlashObject;
var description : String;
description = GetGroupBonusDescription(index);
if (index > m_previousSkillBonuses.Size()){
m_previousSkillBonuses.PushBack(description);
} else if (m_previousSkillBonuses[index] != description){
m_previousSkillBonuses[index] = description;
if (description == ""){
OnPlaySoundEvent("gui_character_synergy_effect_l
ose");
} else {
OnPlaySoundEvent("gui_character_synergy_effect")
;
}
}
gfxGroupBonus = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
gfxGroupBonus.SetMemberFlashString('description', description);
return gfxGroupBonus;
/* NOP */;
}
protected function UpdateAppliedSkills(){
var gfxSlots : CScriptedFlashObject;
var gfxSlotsList : CScriptedFlashArray;
var curSlot : SSkillSlot;
var equipedSkill : SSkill;
var skillSlots : array<SSkillSlot>;
var slotsCount : Int32;
var i : Int32;
gfxSlotsList = m_flashValueStorage.CreateTempFlashArray();
skillSlots = thePlayer.GetSkillSlots();
slotsCount = skillSlots.Size();
/* NOP */;
i = 0;
while (i < slotsCount){
curSlot = skillSlots[i];
equipedSkill = thePlayer.GetPlayerSkill(curSlot.socketed
Skill);
gfxSlots = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
GetSkillGFxObject(equipedSkill, gfxSlots);
gfxSlots.SetMemberFlashInt('tabId', GetTabForSkill(curSl
ot.socketedSkill));
gfxSlots.SetMemberFlashInt('slotId', curSlot.id);
gfxSlots.SetMemberFlashInt('unlockedOnLevel', curSlot.un
lockedOnLevel);
gfxSlots.SetMemberFlashInt('groupID', curSlot.groupID);
gfxSlots.SetMemberFlashBool('unlocked', curSlot.unlocked
);
gfxSlotsList.PushBackFlashObject(gfxSlots);
i += 1;
}
m_flashValueStorage.SetFlashArray("character.skills.slots", gfxS
lotsList);
/* NOP */;
}
protected function GetSlotForSkill(skill : ESkill) : Int32{
var curSlot : SSkillSlot;

var skillSlots : array<SSkillSlot>;


var slotsCount : Int32;
var i : Int32;
var slotID : Int32;
slotID = -1;
skillSlots = thePlayer.GetSkillSlots();
slotsCount = skillSlots.Size();
i = 0;
while (i < slotsCount){
curSlot = skillSlots[i];
if (curSlot.socketedSkill == skill){
slotID = curSlot.id;
break;
}
i += 1;
}
return slotID;
/* NOP */;
}
protected function UpdateAppliedSkillIfEquipped(skill : ESkill){
var slotId : Int32;
slotId = GetSlotForSkill(skill);
if (slotId != -1){
UpdateAppliedSkill(slotId);
}
/* NOP */;
}
protected function UpdateAppliedSkill(slotID : Int32){
var curSlot : SSkillSlot;
var skillSlots : array<SSkillSlot>;
var slotsCount : Int32;
var i : Int32;
var foundSlot : Bool;
foundSlot = false;
skillSlots = thePlayer.GetSkillSlots();
slotsCount = skillSlots.Size();
i = 0;
while (i < slotsCount){
curSlot = skillSlots[i];
if (curSlot.id == slotID){
foundSlot = true;
break;
}
i += 1;
}
if (foundSlot){
SendEquippedSkillInfo(curSlot);
}
/* NOP */;
}
protected function SendEquippedSkillInfo(curSlot : SSkillSlot){
var gfxSlot : CScriptedFlashObject;
var equipedSkill : SSkill;
equipedSkill = thePlayer.GetPlayerSkill(curSlot.socketedSkill);
gfxSlot = m_flashValueStorage.CreateTempFlashObject(/* NOP */);
GetSkillGFxObject(equipedSkill, gfxSlot);
gfxSlot.SetMemberFlashInt('tabId', GetTabForSkill(curSlot.socket
edSkill));
gfxSlot.SetMemberFlashInt('slotId', curSlot.id);
gfxSlot.SetMemberFlashInt('unlockedOnLevel', curSlot.unlockedOnL

evel);
gfxSlot.SetMemberFlashInt('groupID', curSlot.groupID);
gfxSlot.SetMemberFlashBool('unlocked', curSlot.unlocked);
m_flashValueStorage.SetFlashObject("character.skills.slot.update
", gfxSlot, /* NOP */);
/* NOP */;
}
protected function UpdateMutagens(){
var idx : Int32;
var mutCount : Int32;
var slotUnlocked : Bool;
var gfxMutSlot : CScriptedFlashObject;
var gfxMutSlotsList : CScriptedFlashArray;
var skillMutagenSlots : array<SMutagenSlot>;
var currentMutSlot : SMutagenSlot;
var invComponent : CInventoryComponent;
var playerInv : W3GuiPlayerInventoryComponent;
invComponent = thePlayer.GetInventory();
playerInv = new W3GuiPlayerInventoryComponent in this;
playerInv.Initialize(invComponent);
gfxMutSlotsList = m_flashValueStorage.CreateTempFlashArray();
skillMutagenSlots = thePlayer.GetPlayerSkillMutagens();
mutCount = skillMutagenSlots.Size();
idx = 0;
while (idx < mutCount){
currentMutSlot = skillMutagenSlots[idx];
gfxMutSlot = m_flashValueStorage.CreateTempFlashObject(/
* NOP */);
slotUnlocked = GetWitcherPlayer().GetLevel() >= currentM
utSlot.unlockedAtLevel;
gfxMutSlot.SetMemberFlashInt('slotId', currentMutSlot.eq
uipmentSlot);
gfxMutSlot.SetMemberFlashInt('groupId', currentMutSlot.s
killGroupID);
gfxMutSlot.SetMemberFlashString('slotType', currentMutSl
ot.equipmentSlot);
gfxMutSlot.SetMemberFlashBool('unlocked', slotUnlocked);
gfxMutSlot.SetMemberFlashInt('unlockedAtLevel', currentM
utSlot.unlockedAtLevel);
if (invComponent.IsIdValid(currentMutSlot.item)){
playerInv.SetInventoryFlashObjectForItem(current
MutSlot.item, gfxMutSlot);
gfxMutSlot.SetMemberFlashString('color', invComp
onent.GetSkillMutagenColor(currentMutSlot.item));
} else {
gfxMutSlot.SetMemberFlashString('color', 0);
}
gfxMutSlotsList.PushBackFlashObject(gfxMutSlot);
idx += 1;
}
m_flashValueStorage.SetFlashArray("character.skills.mutagens", g
fxMutSlotsList);
/* NOP */;
}
protected function GetSkillGFxObject(curSkill : SSkill, dataObject : CSc
riptedFlashObject){
var skillColor : ESkillColor;
var subPathName : String;
skillColor = thePlayer.GetSkillColor(curSkill.skillType);
dataObject.SetMemberFlashInt('id', curSkill.skillType);

dataObject.SetMemberFlashInt('skillTypeId', curSkill.skillType);
dataObject.SetMemberFlashInt('level', curSkill.level);
dataObject.SetMemberFlashInt('maxLevel', curSkill.maxLevel);
dataObject.SetMemberFlashInt('requiredPointsSpent', curSkill.req
uiredPointsSpent);
dataObject.SetMemberFlashString('dropDownLabel', GetLocStringByK
eyExt(SkillPathTypeToName(curSkill.skillPath)));
dataObject.SetMemberFlashString('skillType', curSkill.skillType)
;
dataObject.SetMemberFlashString('skillPath', curSkill.skillPath)
;
dataObject.SetMemberFlashString('skillSubPath', SkillSubPathType
ToName(curSkill.skillSubPath));
dataObject.SetMemberFlashString('abilityName', curSkill.abilityN
ame);
dataObject.SetMemberFlashString('cost', curSkill.cost);
dataObject.SetMemberFlashString('iconPath', curSkill.iconPath);
dataObject.SetMemberFlashString('isCoreSkill', curSkill.isCoreSk
ill);
dataObject.SetMemberFlashString('skillPathPoints', SkillsPathsPo
intsSpent(curSkill));
dataObject.SetMemberFlashString('positionID', curSkill.positionI
D);
dataObject.SetMemberFlashString('color', skillColor);
dataObject.SetMemberFlashBool('hasRequiredPointsSpent', CheckIfL
ocked(curSkill));
dataObject.SetMemberFlashBool('updateAvailable', CheckIfAvailabl
e(curSkill));
dataObject.SetMemberFlashBool('notEnoughPoints', GetCurrentSkill
Points() <= 0);
if (curSkill.skillType == 0){
dataObject.SetMemberFlashBool('isEquipped', false);
} else {
dataObject.SetMemberFlashBool('isEquipped', thePlayer.Is
SkillEquipped(curSkill.skillType));
}
dataObject.SetMemberFlashBool('isCoreSkill', curSkill.isCoreSkil
l);
/* NOP */;
}
protected function CheckIfLocked(skill : SSkill) : Bool{
var skillType : ESkill;
skillType = SkillNameToEnum(skill.abilityName);
return GetWitcherPlayer().HasSpentEnoughPoints(skillType);
/* NOP */;
}
protected function SkillsPathsPointsSpent(skill : SSkill) : Int32{
var skillType : ESkill;
skillType = SkillNameToEnum(skill.abilityName);
return GetWitcherPlayer().PathPointsForSkillsPath(skillType);
/* NOP */;
}
protected function UpdateSkillPoints(){
m_flashValueStorage.SetFlashInt("character.skills.points", GetCu
rrentSkillPoints(), /* NOP */);
/* NOP */;
}
private function CheckIfAvailable(skill : SSkill) : Bool{
var skillType : ESkill;
skillType = SkillNameToEnum(skill.abilityName);

return GetWitcherPlayer().CanLearnSkill(skillType);
/* NOP */;
}
private function GetCurrentSkillPoints() : Int32{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetPointsFree(0);
/* NOP */;
}
private function GetSkillTooltipDescriptionForSkillLevel(targetSkill : S
Skill, skillLevel : Int32) : String{
var baseString : String;
var locKey : String;
if (skillLevel == 2){
locKey = targetSkill.localisationDescriptionLevel2Key;
} else if (skillLevel >= 3){
locKey = targetSkill.localisationDescriptionLevel3Key;
} else {
locKey = targetSkill.localisationDescriptionKey;
}
if (skillLevel == 0){
skillLevel = 1;
}
if (targetSkill.skillType <= 36){
baseString = GetSwordSkillsTooltipDescription(targetSkil
l, skillLevel, locKey);
} else if (targetSkill.skillType <= 56){
baseString = GetSignSkillsTooltipDescription(targetSkill
, skillLevel, locKey);
} else if (targetSkill.skillType <= 77){
baseString = GetAlchemySkillsTooltipDescription(targetSk
ill, skillLevel, locKey);
} else if (targetSkill.skillType <= 92){
baseString = GetPerkTooltipDescription(targetSkill, skil
lLevel, locKey);
}
return baseString;
/* NOP */;
}
private function GetSwordSkillsTooltipDescription(targetSkill : SSkill,
skillLevel : Int32, locKey : String) : String{
var baseString : String;
var argsInt : array<Int32>;
var argsFloat : array<Float>;
var arg : Float;
var arg_focus : Float;
var ability : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue('sword_adrenalinegain', 'focus_gain'
, min, max);
ability = GetAttributeRandomizedValue(min, max);
arg_focus = ability.valueAdditive;
switch(targetSkill.skillType){
case 6:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key);

} else if (skillLevel >= 3){


baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key);
} else {
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionKey);
}
break;
case 7:
ability = GetWitcherPlayer().GetTotalSignSpellPower(7);
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(7, theGame.params.DAMAGE_NAME_FIRE, false, true), /* NOP */);
arg *= ability.valueMultiplicative;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 8:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key);
} else if (skillLevel >= 3){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key);
} else {
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionKey);
}
ability += GetWitcherPlayer().GetSkillAttributeValue(8,
'trap_duration', false, true);
ability += GetWitcherPlayer().GetTotalSignSpellPower(8);
ability.valueMultiplicative -= 1;
arg = CalculateAttributeValue(ability, /* NOP */);
baseString += "<br><br>" + GetLocStringByKeyExt("attribu
te_name_duration") + " : " + RoundMath(arg) + " " + GetLocStringByKeyExt("per_se
cond");
break;
case 9:
ability = GetWitcherPlayer().GetTotalSignSpellPower(9);
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(9, 'shield_health', false, false), /* NOP */) * ability.valueMul
tiplicative;
arg /= RoundMath(thePlayer.GetStat(0, true));
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 10:
ability = GetWitcherPlayer().GetTotalSignSpellPower(10);
ability += GetWitcherPlayer().GetSkillAttributeValue(10,
'duration', false, true);
argsInt.PushBack(RoundMath(CalculateAttributeValue(abili
ty, /* NOP */)));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 5:
ability = GetWitcherPlayer().GetSkillAttributeValue(5, P
owerStatEnumToName(0), false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *

100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 16:
ability = GetWitcherPlayer().GetSkillAttributeValue(16,
'cost_reduction', false, false);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100 * skillLevel));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 17:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(17, theGame.params.CRITICAL_HIT_CHANCE, false, false), /* NOP */
) * skillLevel;
argsInt.PushBack(Min(RoundMath(arg * 100), 100));
ability = GetWitcherPlayer().GetSkillAttributeValue(17,
'adrenaline_final_damage_bonus', false, false);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 18:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(18, 'instant_kill_chance', false, false), /* NOP */) * skillLeve
l;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 19:
ability = GetWitcherPlayer().GetSkillAttributeValue(19,
PowerStatEnumToName(0), false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 20:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(20, 'dmg_per_sec', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(20, 'duration', false, false), /* NOP */);
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 21:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(21, 'armor_reduction_perc', false, false), /* NOP */) * skillLev
el;
argsInt.PushBack(RoundMath(arg * 100));

baseString = GetLocStringByKeyExtWithParams(locKey, args


Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 22:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(22, theGame.params.CRITICAL_HIT_CHANCE, false, false), /* NOP */
) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 23:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(23, theGame.params.CRITICAL_HIT_CHANCE, false, false), /* NOP */
) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(23, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false), /*
NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 24:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(24, 'damage_reduction', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 25:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key) + "<br>" + GetLocStringByKeyExt("focus_gain") +
": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
} else if (skillLevel >= 3){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key) + "<br>" + GetLocStringByKeyExt("focus_gain") +
": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
} else {
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionKey) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +"
+ RoundF(arg_focus * 100 * skillLevel) + "%";
}
break;
case 26:
ability = GetWitcherPlayer().GetSkillAttributeValue(26,
'attack_power', false, false);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 27:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil

lAttributeValue(27, 'duration', false, false), /* NOP */) * skillLevel;


argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 28:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(28, 'slowdown_mod', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 30:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(30, 'focus_gain', false, false), /* NOP */) * skillLevel;
argsFloat.PushBack(arg);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, argsFloat, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 31:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(31, 'focus_drain_reduction', false, false), /* NOP */) * skillLe
vel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 32:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(32, theGame.params.CRITICAL_HIT_CHANCE, false, false), /* NOP */
) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(32, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false), /*
NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 33:
if (skillLevel > 1){
arg = CalculateAttributeValue(GetWitcherPlayer()
.GetSkillAttributeValue(33, 'healing_bonus', false, false), /* NOP */) * skillLe
vel - 1;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locK
ey, argsInt, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("f
ocus_gain") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
} else {
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionKey) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +"
+ RoundF(arg_focus * 100 * skillLevel) + "%";
}
break;
case 34:

ability = GetWitcherPlayer().GetSkillAttributeValue(34,
'spell_power', false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 35:
ability = GetWitcherPlayer().GetSkillAttributeValue(35,
'focus_gain', false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueBase * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
case 36:
ability = GetWitcherPlayer().GetSkillAttributeValue(36,
PowerStatEnumToName(0), false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("focus_gai
n") + ": +" + RoundF(arg_focus * 100 * skillLevel) + "%";
break;
default:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key);
break;
}
if (skillLevel >= 3){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key);
break;
}
baseString = GetLocStringByKeyExt(targetSkill.localisati
onDescriptionKey);
}
return baseString;
/* NOP */;
}
private function GetSignSkillsTooltipDescription(targetSkill : SSkill, s
killLevel : Int32, locKey : String) : String{
var baseString : String;
var argsInt : array<Int32>;
var argsFloat : array<Float>;
var arg : Float;
var penaltyReduction : Float;
var arg_stamina : Float;
var ability : SAbilityAttributeValue;
var penalty : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue('magic_staminaregen', 'staminaRegen'
, min, max);
ability = GetAttributeRandomizedValue(min, max);
arg_stamina = ability.valueMultiplicative;

switch(targetSkill.skillType){
case 37:
penaltyReduction = 1 - skillLevel + 1 * CalculateAttribu
teValue(GetWitcherPlayer().GetSkillAttributeValue(37, 'spell_power_penalty_reduc
tion', true, true), /* NOP */);
penalty = GetWitcherPlayer().GetSkillAttributeValue(37,
PowerStatEnumToName(1), false, false);
arg = -penalty.valueMultiplicative * penaltyReduction;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 38:
ability = GetWitcherPlayer().GetSkillAttributeValue(38,
'stamina_cost_reduction_after_1', false, false) * skillLevel - 1;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 39:
argsInt.PushBack(10 + 2 * skillLevel - 1);
argsInt.PushBack(25 * skillLevel - 1);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 40:
argsInt.PushBack(10 + 2 * skillLevel - 1);
argsInt.PushBack(25 * skillLevel - 1);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 41:
ability = GetWitcherPlayer().GetSkillAttributeValue(41,
PowerStatEnumToName(0), false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
ability = GetWitcherPlayer().GetSkillAttributeValue(41,
'duration', false, false);
argsInt.PushBack(RoundMath(ability.valueBase));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
case 42:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(42, theGame.params.DAMAGE_NAME_FORCE, false, false), /* NOP */)
* skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/

" + GetLocStringByKeyExt("per_second");
break;
case 43:
ability = GetWitcherPlayer().GetSkillAttributeValue(43,
PowerStatEnumToName(1), false, false);
ability.valueMultiplicative *= skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 44:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(44, 'max_armor_reduction', false, false), /* NOP */) * skillLeve
l;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 45:
ability = GetWitcherPlayer().GetSkillAttributeValue(45,
'chance_bonus', false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueAdditive * 100))
;
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 46:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(46, 'trap_duration', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(46, 'charge_count', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
if (skillLevel > 1){
argsInt.PushBack(2);
} else {
argsInt.PushBack(1);
}
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 47:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(47, 'direct_damage_per_sec', false, false), /* NOP */) * skillLe
vel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;

case 48:
ability = GetWitcherPlayer().GetSkillAttributeValue(48,
PowerStatEnumToName(1), false, false);
ability.valueMultiplicative *= skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 49:
argsInt.PushBack(10 + 2 * skillLevel - 1);
argsInt.PushBack(25 * skillLevel - 1);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 50:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(50, 'discharge_percent', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 51:
ability = GetWitcherPlayer().GetSkillAttributeValue(51,
PowerStatEnumToName(1), false, false);
ability.valueMultiplicative *= skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 52:
ability = GetWitcherPlayer().GetSkillAttributeValue(52,
PowerStatEnumToName(1), false, false);
ability.valueMultiplicative *= skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 53:
argsInt.PushBack(10 + 2 * skillLevel - 1);
argsInt.PushBack(25 * skillLevel - 1);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 54:
ability = GetWitcherPlayer().GetSkillAttributeValue(54,

PowerStatEnumToName(1), false, false);


ability.valueMultiplicative *= skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 55:
argsInt.PushBack(10 + 2 * skillLevel - 1);
argsInt.PushBack(25 * skillLevel - 1);
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
case 56:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(56, 'range', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */) + "<br>" + GetLocStringByKeyExt("attribute
_name_staminaregen") + ": +" + NoTrailZeros(arg_stamina * 100 * skillLevel) + "/
" + GetLocStringByKeyExt("per_second");
break;
}
return baseString;
/* NOP */;
}
private function GetAlchemySkillsTooltipDescription(targetSkill : SSkill
, skillLevel : Int32, locKey : String) : String{
var baseString : String;
var argsInt : array<Int32>;
var argsFloat : array<Float>;
var arg : Float;
var arg_duration : Float;
var ability : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue('alchemy_potionduration', 'potion_du
ration', min, max);
ability = GetAttributeRandomizedValue(min, max);
arg_duration = CalculateAttributeValue(ability, /* NOP */);
switch(targetSkill.skillType){
case 58:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(58, 'threshold', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 59:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(59, 'vitality_gain_perc', false, false), /* NOP */) * skillLevel
;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args

Int, /* NOP */, /* NOP */, /* NOP */);


break;
case 60:
arg = 1 - CalculateAttributeValue(GetWitcherPlayer().Get
SkillAttributeValue(60, 'toxicity_threshold', false, false), /* NOP */) * skillL
evel;
argsInt.PushBack(Max(0, RoundMath(arg * 100)));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 61:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(61, 'apply_chance', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(Min(100, RoundMath(arg * 100)));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 62:
arg = 5 * skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 63:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(63, 'ammo_bonus', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(Min(100, RoundMath(arg * 100)));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 64:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(64, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false), /*
NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 65:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(65, 'item_count', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 66:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(66, 'slowdown_mod', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 67:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(67, 'PhysicalDamage', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 68:

arg = 1 + skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 69:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(69, 'skill_chance', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 70:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(70, 'vitality', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 71:
ability = GetWitcherPlayer().GetSkillAttributeValue(71,
'duration', false, false) * skillLevel;
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 72:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(72, 'toxicityRegen', false, false), /* NOP */) * skillLevel;
if (arg < 0){
arg = -arg;
}
argsInt.PushBack(RoundMath(arg));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 74:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(74, 'critical_hit_chance', false, false), /* NOP */) * skillLeve
l;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 76:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(76, 'synergy_bonus', false, false), /* NOP */) * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 77:
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(EffectTypeToName(37), StatEnumToName(0), min, max);
ability = GetAttributeRandomizedValue(min, max);
arg = ability.valueMultiplicative * skillLevel;
argsInt.PushBack(RoundMath(arg * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);

break;
default:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key);
break;
}
if (skillLevel >= 3){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key);
break;
}
baseString = GetLocStringByKeyExt(targetSkill.localisati
onDescriptionKey);
}
baseString += "<br>" + GetLocStringByKeyExt("attribute_potion_du
ration_time") + ": +" + RoundF(arg_duration * 100 * skillLevel) + "%";
return baseString;
/* NOP */;
}
private function GetPerkTooltipDescription(targetSkill : SSkill, skillLe
vel : Int32, locKey : String) : String{
var baseString : String;
var argsInt : array<Int32>;
var argsFloat : array<Float>;
var arg : Float;
var ability : SAbilityAttributeValue;
switch(targetSkill.skillType){
case 80:
ability = GetWitcherPlayer().GetSkillAttributeValue(80,
'vitalityRegen_tooltip', false, true);
argsInt.PushBack(RoundMath(CalculateAttributeValue(abili
ty, /* NOP */)));
ability = GetWitcherPlayer().GetSkillAttributeValue(80,
'staminaRegen_tooltip', false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
GetWitcherPlayer().GetStatMax(2)));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 81:
ability = GetWitcherPlayer().GetSkillAttributeValue(81,
PowerStatEnumToName(0), false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 83:
ability = GetWitcherPlayer().GetSkillAttributeValue(83,
'vitality', false, true);
argsInt.PushBack(RoundMath(ability.valueBase));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 84:
arg = CalculateAttributeValue(GetWitcherPlayer().GetSkil
lAttributeValue(84, 'critical_hit_chance_fast_style', false, true), /* NOP */);
argsInt.PushBack(RoundMath(arg * 100));
ability = GetWitcherPlayer().GetSkillAttributeValue(84,

'attack_power_fast_style', false, true);


argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 85:
ability = GetWitcherPlayer().GetSkillAttributeValue(85,
'spell_power', false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
ability = GetWitcherPlayer().GetSkillAttributeValue(85,
'staminaRegen', false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 86:
ability = GetWitcherPlayer().GetSkillAttributeValue(86,
'vitality', false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
ability = GetWitcherPlayer().GetSkillAttributeValue(86,
'attack_power_heavy_style', false, true);
argsInt.PushBack(RoundMath(ability.valueMultiplicative *
100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 89:
ability = GetWitcherPlayer().GetSkillAttributeValue(89,
'focus_gain', false, true);
argsInt.PushBack(RoundMath(ability.valueBase * 100));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
case 91:
ability = GetWitcherPlayer().GetSkillAttributeValue(91,
'toxicity', false, true);
argsInt.PushBack(RoundMath(ability.valueBase));
baseString = GetLocStringByKeyExtWithParams(locKey, args
Int, /* NOP */, /* NOP */, /* NOP */);
break;
default:
if (skillLevel == 2){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel2Key);
break;
}
if (skillLevel >= 3){
baseString = GetLocStringByKeyExt(targetSkill.lo
calisationDescriptionLevel3Key);
break;
}
baseString = GetLocStringByKeyExt(targetSkill.localisati
onDescriptionKey);
}
return baseString;
/* NOP */;

}
private function GetSkillTooltipDescription(targetSkill : SSkill, curren
tLevelDesc : String, nextLevelDesc : String){
currentLevelDesc = "";
nextLevelDesc = "";
if (targetSkill.level > 0){
if (!targetSkill.isCoreSkill){
currentLevelDesc += "<font color="#C1925B">" + G
etLocStringByKeyExt("panel_character_tooltip_skill_desc_current_level") + ":</fo
nt>&#10;";
}
currentLevelDesc += GetSkillTooltipDescriptionForSkillLe
vel(targetSkill, targetSkill.level);
}
if (targetSkill.level < targetSkill.maxLevel){
nextLevelDesc += "<font color="#C1925B">" + GetLocString
ByKeyExt("panel_character_tooltip_skill_desc_next_level") + ":</font>&#10;";
nextLevelDesc += GetSkillTooltipDescriptionForSkillLevel
(targetSkill, targetSkill.level + 1);
}
/* NOP */;
}
public function OnNotEnoughtPoints() : Bool{
theSound.SoundEvent("gui_global_denied");
showNotification(GetLocStringByKeyExt("message_common_not_enough
_skill_points"), /* NOP */);
/* NOP */;
}
public function OnGetSkillTooltipData(targetSkill : ESkill, compareItemT
ype : Int32) : Bool{
var resultGFxData : CScriptedFlashObject;
var targetSkillData : SSkill;
var targetSubPathLocName : String;
var skillCurrentLevelDesc : String;
var skillNextLevelDesc : String;
var skillLevelString : String;
var skillNumPoitnsNeeded : Int32;
resultGFxData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
targetSkillData = thePlayer.GetPlayerSkill(targetSkill);
if (targetSkillData.isCoreSkill){
targetSubPathLocName = "";
} else {
targetSubPathLocName = GetLocStringByKeyExt(SkillSubPath
ToLocalisationKey(targetSkillData.skillSubPath));
}
resultGFxData.SetMemberFlashString('skillSubCategory', targetSub
PathLocName);
resultGFxData.SetMemberFlashString('skillName', GetLocStringByKe
yExt(targetSkillData.localisationNameKey));
GetSkillTooltipDescription(targetSkillData, skillCurrentLevelDes
c, skillNextLevelDesc);
resultGFxData.SetMemberFlashString('currentLevelDescription', sk
illCurrentLevelDesc);
resultGFxData.SetMemberFlashString('nextLevelDescription', skill
NextLevelDesc);
resultGFxData.SetMemberFlashString('isCoreSkill', targetSkillDat
a.isCoreSkill);
if (targetSkillData.isCoreSkill){
skillLevelString = "";

} else {
skillLevelString = " " + targetSkillData.level + "/" + t
argetSkillData.maxLevel;
}
resultGFxData.SetMemberFlashString('skillLevelString', skillLeve
lString);
resultGFxData.SetMemberFlashInt('level', targetSkillData.level);
resultGFxData.SetMemberFlashInt('maxLevel', targetSkillData.maxL
evel);
if (targetSkillData.isCoreSkill || CheckIfLocked(targetSkillData
)){
skillNumPoitnsNeeded = -1;
} else {
skillNumPoitnsNeeded = targetSkillData.requiredPointsSpe
nt;
}
resultGFxData.SetMemberFlashNumber('requiredPointsSpent', skillN
umPoitnsNeeded);
resultGFxData.SetMemberFlashString('IconPath', targetSkillData.i
conPath);
resultGFxData.SetMemberFlashBool('hasEnoughPoints', CheckIfLocke
d(targetSkillData));
resultGFxData.SetMemberFlashInt('curSkillPoints', GetCurrentSkil
lPoints());
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tGFxData, /* NOP */);
/* NOP */;
}
public function OnGetEmptySlotTooltipData(unlockedAtLevel : Int32) : Boo
l{
var resultGFxData : CScriptedFlashObject;
resultGFxData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
resultGFxData.SetMemberFlashString('skillName', GetLocStringByKe
yExt("panel_character_tooltip_skill_empty_title"));
resultGFxData.SetMemberFlashString('currentLevelDescription', Ge
tLocStringByKeyExt("panel_character_tooltip_skill_empty_desc"));
resultGFxData.SetMemberFlashString('nextLevelDescription', "");
resultGFxData.SetMemberFlashString('skillLevelString', "");
resultGFxData.SetMemberFlashString('isCoreSkill', false);
resultGFxData.SetMemberFlashInt('level', -1);
resultGFxData.SetMemberFlashInt('maxLevel', -1);
resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\s
kill_slot_empty.png");
resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tGFxData, /* NOP */);
/* NOP */;
}
public function OnGetLockedTooltipData(unlockedAtLevel : Int32) : Bool{
var resultGFxData : CScriptedFlashObject;
resultGFxData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
resultGFxData.SetMemberFlashString('skillName', GetLocStringByKe
yExt("panel_character_tooltip_skill_locked_title"));
resultGFxData.SetMemberFlashString('currentLevelDescription', Ge
tLocStringByKeyExt("panel_character_tooltip_skill_locked_desc") + ": " + unlocke
dAtLevel);

resultGFxData.SetMemberFlashString('nextLevelDescription', "");
resultGFxData.SetMemberFlashString('skillLevelString', "");
resultGFxData.SetMemberFlashInt('level', -1);
resultGFxData.SetMemberFlashInt('maxLevel', -1);
resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\s
kill_slot_locked.png");
resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tGFxData, /* NOP */);
/* NOP */;
}
public function OnGetMutagenEmptyTooltipData(unlockedAtLevel : Int32) :
Bool{
var resultGFxData : CScriptedFlashObject;
resultGFxData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
resultGFxData.SetMemberFlashString('skillName', GetLocStringByKe
yExt("panel_character_tooltip_mutagen_empty_title"));
resultGFxData.SetMemberFlashString('currentLevelDescription', Ge
tLocStringByKeyExt("panel_character_tooltip_mutagen_empty_desc"));
resultGFxData.SetMemberFlashString('nextLevelDescription', "");
resultGFxData.SetMemberFlashString('skillLevelString', "");
resultGFxData.SetMemberFlashInt('level', -1);
resultGFxData.SetMemberFlashInt('maxLevel', -1);
resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\m
utagen_slot_empty.png");
resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tGFxData, /* NOP */);
/* NOP */;
}
public function OnGetMutagenLockedTooltipData(unlockedAtLevel : Int32) :
Bool{
var resultGFxData : CScriptedFlashObject;
resultGFxData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
resultGFxData.SetMemberFlashString('skillName', GetLocStringByKe
yExt("panel_character_tooltip_mutagen_locked_title"));
resultGFxData.SetMemberFlashString('currentLevelDescription', Ge
tLocStringByKeyExt("panel_character_tooltip_mutagen_locked_desc") + ": " + unloc
kedAtLevel);
resultGFxData.SetMemberFlashString('nextLevelDescription', "");
resultGFxData.SetMemberFlashString('skillLevelString', "");
resultGFxData.SetMemberFlashInt('level', -1);
resultGFxData.SetMemberFlashInt('maxLevel', -1);
resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\m
utagen_slot_locked.png");
resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tGFxData, /* NOP */);
/* NOP */;
}
public function OnGetItemData(item : SItemUniqueId, compareItemType : In
t32) : Bool{

var tooltipInv : CInventoryComponent;


var compareItem : SItemUniqueId;
var itemUIData : SInventoryItemUIData;
var itemWeight : SAbilityAttributeValue;
var compareItemStats : array<SAttributeTooltip>;
var itemStats : array<SAttributeTooltip>;
var itemName : String;
var category : String;
var typeStr : String;
var weight : Float;
var primaryStatLabel : String;
var primaryStatValue : Float;
var categoryDescription : String;
var durabilityValue : String;
var oilName : CName;
var idx : Int32;
var socketsCount : Int32;
var usedSocketsCount : Int32;
var emptySocketsCount : Int32;
var socketItems : array<CName>;
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
var propsList : CScriptedFlashArray;
var tmpStr : String;
GetWitcherPlayer().GetItemEquippedOnSlot(compareItemType, compar
eItem);
tooltipInv = _inv;
itemName = tooltipInv.GetItemName(item);
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
propsList = m_flashValueStorage.CreateTempFlashArray();
if (tooltipInv.IsIdValid(item)){
_inv.GetItemPrimaryStat(item, primaryStatLabel, primaryS
tatValue);
itemName = tooltipInv.GetItemLocalizedNameByUniqueID(ite
m);
itemName = GetLocStringByKeyExt(itemName);
resultData.SetMemberFlashString("ItemName", itemName);
if (tooltipInv.GetItemName(item) != _inv.GetItemName(com
pareItem)){
_inv.GetItemStats(compareItem, compareItemStats)
;
}
tooltipInv.GetItemStats(item, itemStats);
CompareItemsStats(itemStats, compareItemStats, statsList
);
resultData.SetMemberFlashArray("StatsList", statsList);
if (tooltipInv.ItemHasTag(item, 'Quest') || tooltipInv.I
sItemIngredient(item) || tooltipInv.IsItemAlchemyItem(item)){
weight = 0;
} else {
weight = tooltipInv.GetItemEncumbrance(item);
}
category = GetItemCategoryLocalisedString(tooltipInv.Get
ItemCategory(item));
typeStr = GetLocStringByKeyExt("item_category_" + toolti
pInv.GetItemCategory(item));
resultData.SetMemberFlashString("ItemType", typeStr);
categoryDescription = getCategoryDescription(tooltipInv.

GetItemCategory(item));
resultData.SetMemberFlashString("CommonDescription", cat
egoryDescription);
resultData.SetMemberFlashString("UniqueDescription", Get
LocStringByKeyExt(tooltipInv.GetItemLocalizedDescriptionByUniqueID(item)));
resultData.SetMemberFlashString("PrimaryStatLabel", prim
aryStatLabel);
resultData.SetMemberFlashNumber("PrimaryStatValue", prim
aryStatValue);
resultData.SetMemberFlashString("ItemRarity", GetItemRar
ityDescription(item, tooltipInv));
resultData.SetMemberFlashString("IconPath", tooltipInv.G
etItemIconPathByUniqueID(item));
resultData.SetMemberFlashString("ItemCategory", category
);
tmpStr = NoTrailZeros(weight);
addGFxItemStat(propsList, "weight", tmpStr, "attribute_n
ame_weight");
addGFxItemStat(propsList, "price", tooltipInv.GetItemPri
ce(item), "panel_inventory_item_price");
oilName = _inv.GetSwordOil(item);
if (oilName != 'None'){
addGFxItemStat(propsList, "oil", GetLocStringByK
eyExt(_inv.GetItemLocalizedNameByName(oilName)), /* NOP */);
}
socketsCount = _inv.GetItemEnhancementSlotsCount(item);
usedSocketsCount = _inv.GetItemEnhancementCount(item);
emptySocketsCount = socketsCount - usedSocketsCount;
_inv.GetItemEnhancementItems(item, socketItems);
idx = 0;
while (idx < socketItems.Size()){
addGFxItemStat(propsList, "socket", GetLocString
ByKeyExt(socketItems[idx]), /* NOP */);
idx += 1;
}
idx = 0;
while (idx < emptySocketsCount){
addGFxItemStat(propsList, "empty_socket", GetLoc
StringByKeyExt("panel_inventory_tooltip_empty_socket"), /* NOP */);
idx += 1;
}
resultData.SetMemberFlashArray("PropertiesList", propsLi
st);
m_flashValueStorage.SetFlashObject("context.tooltip.data
", resultData, /* NOP */);
}
/* NOP */;
}
public function CompareItemsStats(itemStats : array<SAttributeTooltip>,
compareItemStats : array<SAttributeTooltip>, compResult : CScriptedFlashArray){
var l_flashObject : CScriptedFlashObject;
var attributeVal : SAbilityAttributeValue;
var strDifference : String;
var strDifValue : String;
var percentDiff : Float;
var nDifference : Float;
var i : Int32;
var j : Int32;
var price : Int32;
var statsCount : Int32;

strDifference = "none";
statsCount = itemStats.Size();
i = 0;
while (i < statsCount){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
l_flashObject.SetMemberFlashString("color", itemStats[i]
.attributeColor);
j = 0;
while (j < compareItemStats.Size()){
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
nDifference = itemStats[j].value - compa
reItemStats[i].value;
percentDiff = AbsF(nDifference / itemSta
ts[j].value);
if (nDifference > 0){
strDifValue = "(+" + NoTrailZero
s(nDifference) + ")";
if (percentDiff < 0.250000){
strDifference = "better"
;
} else if (percentDiff > 0.75000
0){
strDifference = "wayBett
er";
} else {
strDifference = "reallyB
etter";
}
} else if (nDifference < 0){
strDifValue = "(" + RoundMath(nD
ifference) + ")";
if (percentDiff < 0.250000){
strDifference = "worse";
} else if (percentDiff > 0.75000
0){
strDifference = "wayWors
e";
} else {
strDifference = "reallyW
orse";
}
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", strDifference
);
l_flashObject.SetMemberFlashBool("primaryStat", itemStat
s[j].primaryStat);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", "+ "
+ RoundMath(itemStats[i].value * 100) + " %");
} else {
l_flashObject.SetMemberFlashString("value", "+ "
+ RoundMath(itemStats[i].value) + strDifValue);

}
compResult.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
private function getCategoryDescription(itemCategory : CName) : String{
switch(itemCategory){
case 'steelsword':
case 'silversword':
case 'crossbow':
case 'secondary':
case 'armor':
case 'pants':
case 'gloves':
case 'boots':
case 'armor':
case 'bolt':
return GetLocStringByKeyExt("item_category_" + itemCateg
ory + "_desc");
break;
default:
return "";
break;
}
return "";
/* NOP */;
}
public function GetItemRarityDescription(item : SItemUniqueId, tooltipIn
v : CInventoryComponent) : String{
var itemQuality : Int32;
itemQuality = tooltipInv.GetItemQuality(item);
return GetItemRarityDescriptionFromInt(itemQuality);
/* NOP */;
}
private function addGFxItemStat(targetArray : CScriptedFlashArray, type
: String, value : String, label : String){
var resultData : CScriptedFlashObject;
var labelLoc : String;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
resultData.SetMemberFlashString("type", type);
resultData.SetMemberFlashString("value", value);
if (label != ""){
labelLoc = GetLocStringByKeyExt(label);
resultData.SetMemberFlashString("label", labelLoc);
}
targetArray.PushBackFlashObject(resultData);
/* NOP */;
}
public function UpdatePlayerStatisticsData(){
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var valueStr : String;
var statsNr : Int32;
var statName : CName;
var i : Int32;
var lastSentStatString : String;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
AddCharacterStatU("mainSilverStat", 'silverdamage', "panel_commo

n_statistics_tooltip_silver_dps", "attack_silver", l_flashArray, m_flashValueSto


rage);
AddCharacterStatU("mainSteelStat", 'steeldamage', "panel_common_
statistics_tooltip_steel_dps", "attack_steel", l_flashArray, m_flashValueStorage
);
AddCharacterStat("mainResStat", 'armor', "attribute_name_armor",
"armor", l_flashArray, m_flashValueStorage);
AddCharacterStat("mainMagicStat", 'spell_power', "stat_signs", "
spell_power", l_flashArray, m_flashValueStorage);
AddCharacterStat("majorStat1", 'vitality', "vitality", "vitality
", l_flashArray, m_flashValueStorage);
m_flashValueStorage.SetFlashArray("playerstats.stats", l_flashAr
ray);
/* NOP */;
}
private function updateSentStatValue(statName : CName, statValue : Strin
g){
var sentStat : SentStatsData;
var i : Int32;
i = 0;
while (i < _sentStats.Size()){
if (_sentStats[i].statName == statName){
_sentStats[i].statValue = statValue;
return;
}
i += 1;
}
sentStat.statName = statName;
sentStat.statValue = statValue;
_sentStats.PushBack(sentStat);
/* NOP */;
}
private function getLastSentStatValue(statName : CName) : String{
var i : Int32;
i = 0;
while (i < _sentStats.Size()){
if (_sentStats[i].statName == statName){
return _sentStats[i].statValue;
}
i += 1;
}
return "";
/* NOP */;
}
public function OnSelectPlayerStat(statId : CName) : Bool{
ShowStatTooltip(statId);
/* NOP */;
}
public function OnStatisticsLostFocus() : Bool{
m_flashValueStorage.SetFlashBool("statistic.tooltip.hide", true,
/* NOP */);
/* NOP */;
}
public function ShowStatTooltip(statName : CName){
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
switch(statName){

case 'vitality':
GetHealthTooltipData(statsList);
break;
case 'toxicity':
GetToxicityTooltipData(statsList);
break;
case 'stamina':
GetStaminaTooltipData(statsList);
break;
case 'focus':
GetAdrenalineTooltipData(statsList);
break;
case 'stat_offense':
GetOffenseTooltipData(statsList);
break;
case 'stat_defense':
GetDefenseTooltipData(statsList);
break;
case 'stat_signs':
GetSignsTooltipData(statsList);
break;
}
resultData.SetMemberFlashString("title", GetLocStringByKeyExt(st
atName));
resultData.SetMemberFlashString("description", GetLocStringByKey
Ext(statName + "_desc"));
resultData.SetMemberFlashArray("statsList", statsList);
m_flashValueStorage.SetFlashObject("statistic.tooltip.data", res
ultData, /* NOP */);
/* NOP */;
}
private function GetHealthTooltipData(GFxData : CScriptedFlashArray){
var maxHealth : Float;
var curHealth : Float;
var inCombatRegen : Float;
var outOfCombatRegen : Float;
maxHealth = thePlayer.GetStatMax(0);
curHealth = thePlayer.GetStatPercents(0);
inCombatRegen = CalculateAttributeValue(thePlayer.GetAttributeVa
lue('vitalityCombatRegen', /* NOP */, /* NOP */), /* NOP */);
outOfCombatRegen = CalculateAttributeValue(thePlayer.GetAttribut
eValue('vitalityRegen', /* NOP */, /* NOP */), /* NOP */);
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_h
ealth", RoundMath(maxHealth * curHealth));
PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_h
ealth", RoundMath(maxHealth));
PushStatItem(GFxData, "panel_common_statistics_tooltip_incombat_
regen", NoTrailZeros(RoundTo(inCombatRegen, 1)));
PushStatItem(GFxData, "panel_common_statistics_tooltip_outofcomb
at_regen", NoTrailZeros(RoundTo(outOfCombatRegen, 1)));
/* NOP */;
}
private function GetToxicityTooltipData(GFxData : CScriptedFlashArray){
var maxToxicity : Float;
var curToxicity : Float;
var lockedToxicity : Float;
var toxicityThreshold : Float;
maxToxicity = thePlayer.GetStatMax(3);
curToxicity = thePlayer.GetStat(3, true);
lockedToxicity = thePlayer.GetStat(3, /* NOP */) - curToxicity;

toxicityThreshold = GetWitcherPlayer().GetToxicityDamageThreshol
d();
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_t
oxicity", RoundMath(curToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_current_m
aximum", RoundMath(maxToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_locked",
RoundMath(lockedToxicity));
PushStatItem(GFxData, "panel_common_statistics_tooltip_threshold
", RoundMath(toxicityThreshold));
PushStatItem(GFxData, "panel_common_statistics_tooltip_degenerat
ion", RoundMath(0));
/* NOP */;
}
private function GetStaminaTooltipData(GFxData : CScriptedFlashArray){
var maxStamina : Float;
var regenStamia : Float;
var value : SAbilityAttributeValue;
value = thePlayer.GetAttributeValue('staminaRegen', /* NOP */, /
* NOP */);
regenStamia = value.valueMultiplicative / 0.340000;
maxStamina = thePlayer.GetStatMax(2);
PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_s
tamina ", RoundMath(maxStamina));
PushStatItem(GFxData, "panel_common_statistics_tooltip_regenerat
ion_rate", NoTrailZeros(RoundTo(regenStamia, 2)));
/* NOP */;
}
private function GetAdrenalineTooltipData(GFxData : CScriptedFlashArray)
{
var maxAdrenaline : Float;
var curAdrenaline : Float;
maxAdrenaline = thePlayer.GetStatMax(4);
curAdrenaline = thePlayer.GetStat(4, /* NOP */);
PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenalin
e_current", FloorF(curAdrenaline));
PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenalin
e_max", RoundMath(maxAdrenaline));
/* NOP */;
}
private function GetOffenseTooltipData(GFxData : CScriptedFlashArray){
var curStats : SPlayerOffenseStats;
curStats = GetWitcherPlayer().GetOffenseStatsList();
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_dps", StatToStr(curStats.steelFastDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_crit_chance", StatToStr(curStats.steelFastCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fas
t_crit_dmg", StatToStr(curStats.steelFastCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_dps", StatToStr(curStats.steelStrongDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_crit_chance", StatToStr(curStats.steelStrongCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_str
ong_crit_dmg", StatToStr(curStats.steelStrongCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa
st_dps", StatToStr(curStats.silverFastDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa
st_crit_chance", StatToStr(curStats.silverFastCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fa

st_crit_dmg", StatToStr(curStats.silverFastCritDmg) + "%");


PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_dps", StatToStr(curStats.silverStrongDPS));
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_crit_chance", StatToStr(curStats.silverStrongCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_st
rong_crit_dmg", StatToStr(curStats.silverStrongCritDmg) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_
dps", StatToStr(curStats.crossbowCritChance) + "%");
PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_
crit_chance", StatToStr(curStats.crossbowSteelDmg));
/* NOP */;
}
private function GetDefenseTooltipData(GFxData : CScriptedFlashArray){
PushStatItem(GFxData, "panel_common_statistics_tooltip_armor", "
");
PushStatItem(GFxData, "slashing_resistance", GetStatValue('slash
ing_resistance_perc') + "%");
PushStatItem(GFxData, "piercing_resistance", GetStatValue('pierc
ing_resistance_perc') + "%");
PushStatItem(GFxData, "bludgeoning_resistance", GetStatValue('bl
udgeoning_resistance_perc') + "%");
PushStatItem(GFxData, "rending_resistance", GetStatValue('rendin
g_resistance_pec') + "%");
PushStatItem(GFxData, "elemental_resistance", GetStatValue('elem
ental_resistance_perc') + "%");
PushStatItem(GFxData, "poison_resistance", GetStatValue('poison_
resistance_perc') + "%");
PushStatItem(GFxData, "fire_resistance", GetStatValue('fire_resi
stance_perc') + "%");
PushStatItem(GFxData, "bleeding_resistance", GetStatValue('bleed
ing_resistance_perc') + "%");
PushStatItem(GFxData, "knockdown_resistance", GetStatValue('knoc
kdown_resistance_perc') + "%");
/* NOP */;
}
private function GetSignsTooltipData(GFxData : CScriptedFlashArray){
var sp : SAbilityAttributeValue;
var witcher : W3PlayerWitcher;
var str : String;
witcher = GetWitcherPlayer();
sp = witcher.GetTotalSignSpellPower(6);
str = RoundMath(sp.valueMultiplicative * 100) + "%";
PushStatItem(GFxData, 'aard_intensity', str);
sp = witcher.GetTotalSignSpellPower(7);
str = RoundMath(sp.valueMultiplicative * 100) + "%";
PushStatItem(GFxData, 'igni_intensity', str);
sp = witcher.GetTotalSignSpellPower(8);
str = RoundMath(sp.valueMultiplicative * 100) + "%";
PushStatItem(GFxData, 'yrden_intensity', str);
sp = witcher.GetTotalSignSpellPower(9);
str = RoundMath(sp.valueMultiplicative * 100) + "%";
PushStatItem(GFxData, 'quen_intensity', str);
sp = witcher.GetTotalSignSpellPower(10);
str = RoundMath(sp.valueMultiplicative * 100) + "%";
PushStatItem(GFxData, 'axii_intensity', str);
/* NOP */;
}
private function GetSignStat(targetSkill : ESkill) : String{
var powerStatValue : SAbilityAttributeValue;

var damageTypeName : CName;


var points : Float;
GetWitcherPlayer().GetSignStats(targetSkill, damageTypeName, poi
nts, powerStatValue);
return NoTrailZeros(RoundMath(powerStatValue.valueMultiplicative
* 100)) + " %";
/* NOP */;
}
private function StatToStr(value : Float) : String{
return NoTrailZeros(RoundTo(value, 1));
/* NOP */;
}
private function PushStatItem(statsList : CScriptedFlashArray, label : S
tring, value : String){
var statItemData : CScriptedFlashObject;
statItemData = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
statItemData.SetMemberFlashString("name", GetLocStringByKeyExt(l
abel));
statItemData.SetMemberFlashString("value", value);
statsList.PushBackFlashObject(statItemData);
/* NOP */;
}
public function OnShowFullStats() : Bool{
if (_charStatsPopupData){
delete _charStatsPopupData;
}
_charStatsPopupData = new CharacterStatsPopupData in this;
_charStatsPopupData.HideTutorial = true;
RequestSubMenu('PopupMenu', _charStatsPopupData);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
import abstract class CStorySceneEventPlacementInterpolation{
}
import abstract class CStorySceneEventLightPropertiesInterpolation{
}
class W3BuySkillConfirmation extends ConfirmationPopupData{
public var characterMenuRef : CR4CharacterMenu;
public var targetSkill : ESkill;
protected function OnUserAccept(){
characterMenuRef.handleBuySkillConfirmation(targetSkill);
/* NOP */;
}
protected function OnUserDecline(){
super.OnUserDecline();
theSound.SoundEvent("gui_global_panel_close");
/* NOP */;
}
}
import abstract class CStorySceneEventClothDisablingInterpolation{
}
class CharacterStatsPopupData extends TextPopupData{

public var m_flashValueStorage : CScriptedFlashValueStorage;


protected function GetContentRef() : String{
return "StatisticsFullRef";
/* NOP */;
}
protected function DefineDefaultButtons(){
AddButtonDef("panel_button_common_exit", "escape-gamepad_B", 27)
;
AddButtonDef("input_feedback_scroll_text", "gamepad_R_Scroll", /
* NOP */);
/* NOP */;
}
public function OnUserFeedback(KeyCode : String){
if (KeyCode == "escape-gamepad_B"){
ClosePopup();
}
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var statsArray : CScriptedFlashArray;
var gfxData : CScriptedFlashObject;
m_flashValueStorage = parentFlashValueStorage;
gfxData = m_flashValueStorage.CreateTempFlashObject(/* NOP */);
statsArray = m_flashValueStorage.CreateTempFlashArray();
gfxData.SetMemberFlashString("ContentRef", GetContentRef());
AddCharacterStat("majorStat1", 'vitality', "vitality", "vitality
", statsArray, m_flashValueStorage);
AddCharacterStat("majorStat2", 'toxicity', "toxicity", "toxicity
", statsArray, m_flashValueStorage);
AddCharacterStat("majorStat3", 'stamina', "stamina", "stamina",
statsArray, m_flashValueStorage);
AddCharacterStat("majorStat4", 'focus', "focus", "focus", statsA
rray, m_flashValueStorage);
AddCharacterStat("majorStat5", 'timeplayed', "message_total_play
_time", "timeplayed", statsArray, m_flashValueStorage);
AddCharacterStat("mainMagicStat", 'spell_power', "stat_signs", "
spell_power", statsArray, m_flashValueStorage);
AddCharacterStatU("mainSilverStat", 'silverdamage', "panel_commo
n_statistics_tooltip_silver_dps", "attack_silver", statsArray, m_flashValueStora
ge);
AddCharacterStatU("mainSteelStat", 'steeldamage', "panel_common_
statistics_tooltip_steel_dps", "attack_steel", statsArray, m_flashValueStorage);
AddCharacterStat("mainResStat", 'armor', "attribute_name_armor",
"armor", statsArray, m_flashValueStorage);
AddCharacterHeader("panel_common_statistics_category_signs", sta
tsArray, m_flashValueStorage);
AddCharacterHeader("Aard", statsArray, m_flashValueStorage);
AddCharacterStatSigns("aardStat1", 'aard_knockdownchance', "attr
ibute_name_knockdown", "", statsArray, m_flashValueStorage);
AddCharacterStatSigns("aardStat2", 'aard_damage', "attribute_nam
e_forcedamage", "", statsArray, m_flashValueStorage);
AddCharacterHeader("Igni", statsArray, m_flashValueStorage);
AddCharacterStatSigns("igniStat1", 'igni_damage', "attribute_nam
e_firedamage", "", statsArray, m_flashValueStorage);
AddCharacterStatSigns("igniStat2", 'igni_burnchance', "effect_bu
rning", "", statsArray, m_flashValueStorage);
AddCharacterHeader("Quen", statsArray, m_flashValueStorage);
AddCharacterStatSigns("quenStat1", 'quen_damageabs', "physical_r
esistance", "", statsArray, m_flashValueStorage);

AddCharacterHeader("Yrden", statsArray, m_flashValueStorage);


AddCharacterStatSigns("yrdenStat1", 'yrden_slowdown', "SlowdownE
ffect", "", statsArray, m_flashValueStorage);
AddCharacterStatSigns("yrdenStat2", 'yrden_damage', "attribute_n
ame_forcedamage", "", statsArray, m_flashValueStorage);
AddCharacterStatSigns("yrdenStat3", 'yrden_duration', "duration"
, "", statsArray, m_flashValueStorage);
AddCharacterHeader("Axii", statsArray, m_flashValueStorage);
AddCharacterStatSigns("axiiStat1", 'axii_duration_confusion', "d
uration", "", statsArray, m_flashValueStorage);
AddCharacterHeader("panel_inventory_tooltip_damage", statsArray,
m_flashValueStorage);
AddCharacterStatU("silverStat2", 'silverFastDPS', "panel_common_
statistics_tooltip_silver_fast_dps", "", statsArray, m_flashValueStorage);
AddCharacterStatU("silverStat3", 'silverFastCritChance', "panel_
common_statistics_tooltip_silver_fast_crit_chance", "", statsArray, m_flashValue
Storage);
AddCharacterStatU("silverStat4", 'silverFastCritDmg', "panel_com
mon_statistics_tooltip_silver_fast_crit_dmg", "", statsArray, m_flashValueStorag
e);
AddCharacterStatU("silverStat5", 'silverStrongDPS', "panel_commo
n_statistics_tooltip_silver_strong_dps", "", statsArray, m_flashValueStorage);
AddCharacterStatU("silverStat6", 'silverStrongCritChance', "pane
l_common_statistics_tooltip_silver_strong_crit_chance", "", statsArray, m_flashV
alueStorage);
AddCharacterStatU("silverStat7", 'silverStrongCritDmg', "panel_c
ommon_statistics_tooltip_silver_strong_crit_dmg", "", statsArray, m_flashValueSt
orage);
AddCharacterStatU2("silverStat9", 'silver_desc_poinsonchance_mul
t', "attribute_name_desc_poinsonchance_mult", "", statsArray, m_flashValueStorag
e);
AddCharacterStatU2("silverStat10", 'silver_desc_bleedingchance_m
ult', "attribute_name_desc_bleedingchance_mult", "", statsArray, m_flashValueSto
rage);
AddCharacterStatU2("silverStat11", 'silver_desc_burningchance_mu
lt', "attribute_name_desc_burningchance_mult", "", statsArray, m_flashValueStora
ge);
AddCharacterStatU2("silverStat12", 'silver_desc_confusionchance_
mult', "attribute_name_desc_confusionchance_mult", "", statsArray, m_flashValueS
torage);
AddCharacterStatU2("silverStat13", 'silver_desc_freezingchance_m
ult', "attribute_name_desc_freezingchance_mult", "", statsArray, m_flashValueSto
rage);
AddCharacterStatU2("silverStat14", 'silver_desc_staggerchance_mu
lt', "attribute_name_desc_staggerchance_mult", "", statsArray, m_flashValueStora
ge);
AddCharacterStatU("steelStat2", 'steelFastDPS', "panel_common_st
atistics_tooltip_steel_fast_dps", "", statsArray, m_flashValueStorage);
AddCharacterStatU("steelStat3", 'steelFastCritChance', "panel_co
mmon_statistics_tooltip_steel_fast_crit_chance", "", statsArray, m_flashValueSto
rage);
AddCharacterStatU("steelStat4", 'steelFastCritDmg', "panel_commo
n_statistics_tooltip_steel_fast_crit_dmg", "", statsArray, m_flashValueStorage);
AddCharacterStatU("steelStat5", 'steelStrongDPS', "panel_common_
statistics_tooltip_steel_strong_dps", "", statsArray, m_flashValueStorage);
AddCharacterStatU("steelStat6", 'steelStrongCritChance', "panel_
common_statistics_tooltip_steel_strong_crit_chance", "", statsArray, m_flashValu
eStorage);
AddCharacterStatU("steelStat7", 'steelStrongCritDmg', "panel_com
mon_statistics_tooltip_steel_strong_crit_dmg", "", statsArray, m_flashValueStora

ge);
AddCharacterStatU2("steelStat9", 'steel_desc_poinsonchance_mult'
, "attribute_name_desc_poinsonchance_mult", "", statsArray, m_flashValueStorage)
;
AddCharacterStatU2("steelStat10", 'steel_desc_bleedingchance_mul
t', "attribute_name_desc_bleedingchance_mult", "", statsArray, m_flashValueStora
ge);
AddCharacterStatU2("steelStat11", 'steel_desc_burningchance_mult
', "attribute_name_desc_burningchance_mult", "", statsArray, m_flashValueStorage
);
AddCharacterStatU2("steelStat12", 'steel_desc_confusionchance_mu
lt', "attribute_name_desc_confusionchance_mult", "", statsArray, m_flashValueSto
rage);
AddCharacterStatU2("steelStat13", 'steel_desc_freezingchance_mul
t', "attribute_name_desc_freezingchance_mult", "", statsArray, m_flashValueStora
ge);
AddCharacterStatU2("steelStat14", 'steel_desc_staggerchance_mult
', "attribute_name_desc_staggerchance_mult", "", statsArray, m_flashValueStorage
);
AddCharacterHeader("item_category_crossbow", statsArray, m_flash
ValueStorage);
AddCharacterStatU("steelStat17", 'crossbowCritChance', "panel_co
mmon_statistics_tooltip_crossbow_crit_chance", "", statsArray, m_flashValueStora
ge);
AddCharacterStatU("steelStat18", 'crossbowSteelDmg', "attribute_
name_piercingdamage", "", statsArray, m_flashValueStorage);
AddCharacterStatU("steelStat19", 'crossbowSilverDmg', "attribute
_name_silverdamage", "", statsArray, m_flashValueStorage);
AddCharacterHeader("panel_common_statistics_category_resistance"
, statsArray, m_flashValueStorage);
AddCharacterStatF("defStat2", 'slashing_resistance_perc', "slash
ing_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat3", 'piercing_resistance_perc', "attri
bute_name_piercing_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat4", 'bludgeoning_resistance_perc', "bl
udgeoning_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat5", 'rending_resistance_perc', "attrib
ute_name_rending_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat6", 'elemental_resistance_perc', "attr
ibute_name_elemental_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat8", 'poison_resistance_perc', "attribu
te_name_poison_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat9", 'bleeding_resistance_perc', "attri
bute_name_bleeding_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStatF("defStat10", 'burning_resistance_perc', "attri
bute_name_burning_resistance_perc", "", statsArray, m_flashValueStorage);
AddCharacterStat("defStat12", 'vitalityRegen', "panel_common_sta
tistics_tooltip_outofcombat_regen", "", statsArray, m_flashValueStorage);
AddCharacterStat("defStat13", 'vitalityCombatRegen', "panel_comm
on_statistics_tooltip_incombat_regen", "", statsArray, m_flashValueStorage);
AddCharacterStat("defStat14", 'staminaOutOfCombatRegen', "attrib
ute_name_staminaregen_out_of_combat", "", statsArray, m_flashValueStorage);
AddCharacterStat("defStat15", 'staminaRegen', "attribute_name_st
aminaregen", "", statsArray, m_flashValueStorage);
AddCharacterHeader("panel_common_statistics_category_additional"
, statsArray, m_flashValueStorage);
AddCharacterStatF("extraStat1", 'bonus_herb_chance', "bonus_herb
_chance", "", statsArray, m_flashValueStorage);
AddCharacterStatU("extraStat2", 'instant_kill_chance_mult', "ins
tant_kill_chance", "", statsArray, m_flashValueStorage);

AddCharacterStatU("extraStat3", 'human_exp_bonus_when_fatal', "h


uman_exp_bonus_when_fatal", "", statsArray, m_flashValueStorage);
AddCharacterStatU("extraStat4", 'nonhuman_exp_bonus_when_fatal',
"nonhuman_exp_bonus_when_fatal", "", statsArray, m_flashValueStorage);
gfxData.SetMemberFlashArray("stats", statsArray);
return gfxData;
/* NOP */;
}
}
import abstract class CStorySceneEventMorphInterpolation{
}
struct SentStatsData{
var statName : CName;
var statValue : String;
}
import abstract class CStorySceneEventDangleDisablingInterpolation{
}
import abstract class CStorySceneEventPropPlacementInterpolation{
}
import abstract class CStorySceneDanglesShakeEventInterpolation{
}
import abstract class CStorySceneEventCameraLightInterpolation{
}
import abstract class CStorySceneEventModifyEnv{
}
import abstract class CStorySceneEventDebugComment{
}
import abstract class SStorySceneSpotLightProperties{
}
import abstract class SStorySceneLightDimmerProperties{
}
import abstract class SStorySceneGameplayActionCallbackInfo{
//NULL type for inGameplayAction
//NULL type for outChangeItems
//NULL type for inActor
//NULL type for inActorHeading
//NULL type for inActorPosition
//NULL type for outDontUseSceneTeleport
}
import abstract class CQuestsSystem{
}
import abstract class CQuestFactory{
}
import abstract class CQuestPhaseFactory{
}

import abstract class CQuestGraphInstance{


}
import abstract class CQuestGraphSocket{
}
import abstract class CQuestCutControlGraphSocket{
}
import abstract class CQuestConditionBlock{
}
import abstract class CQuestCutControlBlock{
}
import abstract class CQuestPauseConditionBlock{
}
import abstract class CQuestSceneBlock{
}
import abstract class CQuestStartBlock{
}
import abstract class CQuestEndBlock{
}
import abstract class CQuestVariedInputsBlock{
}
import abstract class CQuestAndBlock{
}
import abstract class CQuestXorBlock{
}
import abstract class CQuestScopeBlock{
}
class W3PlayerAbilityManager extends W3AbilityManager{
private saved var skills : array<SSkill>;
private saved var resistStatsItems : array<array<SResistanceValue>>;
private saved var toxicityOffset : Float;
private var pathPointsSpent : array<Int32>;
private saved var skillSlots : array<SSkillSlot>;
protected saved var skillAbilities : array<CName>;
private var totalSkillSlotsCount : Int32;
private var tempSkills : array<ESkill>;
private saved var mutagenSlots : array<SMutagenSlot>;
private var temporaryTutorialSkills : array<STutorialTemporarySkill>;
private const var LINK_BONUS_BLUE : CName;
private const var LINK_BONUS_GREEN : CName;
private const var LINK_BONUS_RED : CName;
public final function Init(ownr : CActor, cStats : CCharacterStats, isFr
omLoad : Bool, diff : EDifficultyMode) : Bool{
var skillDefs : array<CName>;
var i : Int32;
isInitialized = false;
if (!ownr){
LogAssert(false, "W3PlayerAbilityManager.Init: owner is

NULL!!!!");
return false;
} else if (!(CPlayer)ownr){
LogAssert(false, "W3PlayerAbilityManager.Init: trying to
create for non-player object!! Aborting!!");
return false;
}
resistStatsItems.Resize(EnumGetMax('EEquipmentSlots') + 1);
pathPointsSpent.Resize(EnumGetMax('ESkillPath') + 1);
ownr.AddAbility(theGame.params.GLOBAL_PLAYER_ABILITY, /* NOP */)
;
if (!Init(ownr, cStats, isFromLoad, diff)){
return false;
}
/* NOP */;
if (!isFromLoad){
InitSkillSlots();
skillDefs = charStats.GetAbilitiesWithTag('SkillDefiniti
onName');
LogAssert(skillDefs.Size() > 0, "W3PlayerAbilityManager.
Init: actor <<" + owner + ">> has no skills!!");
i = 0;
while (i < skillDefs.Size()){
CacheSkills(skillDefs[i], skills);
i += 1;
}
LoadMutagenSlotsDataFromXML();
InitSkills();
PrecacheModifierSkills();
}
isInitialized = true;
return true;
/* NOP */;
}
public function OnOwnerRevived(){
var i : Int32;
super.OnOwnerRevived();
if (owner == GetWitcherPlayer()){
GetWitcherPlayer().RemoveTemporarySkills();
}
/* NOP */;
}
private final function PrecacheModifierSkills(){
var i : Int32;
var j : Int32;
var dm : CDefinitionsManagerAccessor;
var skill : SSkill;
var skillIT : Int32;
dm = theGame.GetDefinitionsManager();
if (!dm){
return;
}
skillIT = 0;
while (skillIT < skills.Size()){
i = 0;
while (i < skills.Size()){
if (i != skillIT){
j = 0;
while (j < skills[skillIT].modifierTags.
Size()){

if (dm.AbilityHasTag(skills[i].a
bilityName, skills[skillIT].modifierTags[j])){
skills[skillIT].precache
dModifierSkills.PushBack(i);
}
j += 1;
}
}
i += 1;
}
skillIT += 1;
}
/* NOP */;
}
public final function PostInit(){
var i : Int32;
var playerLevel : Int32;
if (CanUseSkill(5)){
AddPassiveSkillBuff(5);
}
if ((W3PlayerWitcher)owner){
playerLevel = (W3PlayerWitcher)owner.GetLevel();
i = 0;
while (i < skillSlots.Size()){
skillSlots[i].unlocked = playerLevel >= skillSlo
ts[i].unlockedOnLevel;
i += 1;
}
}
/* NOP */;
}
public final function GetPlayerSkills() : array<SSkill>{
return skills;
/* NOP */;
}
public final function AddTempNonAlchemySkills() : array<SSimpleSkill>{
var i : Int32;
var cnt : Int32;
var j : Int32;
var ret : array<SSimpleSkill>;
var temp : SSimpleSkill;
tempSkills.Clear();
i = 0;
while (i < skills.Size()){
if (skills[i].skillPath == 2 && skills[i].level < skills
[i].maxLevel){
temp.skillType = skills[i].skillType;
temp.level = skills[i].level;
ret.PushBack(temp);
tempSkills.PushBack(skills[i].skillType);
cnt = skills[i].maxLevel - skills[i].level;
j = 0;
while (j < cnt){
AddSkill(skills[i].skillType, true);
j += 1;
}
}
i += 1;
}
return ret;

/* NOP */;
}
public final function GetPlayerSkill(type : ESkill) : SSkill{
return skills[type];
/* NOP */;
}
private final function AddPassiveSkillBuff(skill : ESkill){
if (skill == 5 && GetStat(4, /* NOP */) >= 1){
owner.AddEffectDefault(48, owner, "BattleTranceSkill", /
* NOP */);
}
/* NOP */;
}
private final function ReloadAcquiredSkills(acquiredSkills : array<SRest
oredSkill>){
var i : Int32;
var j : Int32;
j = acquiredSkills.Size() - 1;
while (j >= 0){
i = 0;
while (i < skills.Size()){
if (skills[i].skillType == acquiredSkills[j].ski
llType){
skills[i].level = acquiredSkills[j].leve
l;
skills[i].isNew = acquiredSkills[j].isNe
w;
skills[i].remainingBlockedTime = acquire
dSkills[j].remainingBlockedTime;
if (!skills[i].isCoreSkill){
pathPointsSpent[skills[i].skillP
ath] = pathPointsSpent[skills[i].skillPath] + 1;
}
acquiredSkills.Erase(j);
break;
}
i += 1;
}
j -= 1;
}
/* NOP */;
}
protected final function OnFocusChanged(){
var points : Float;
points = GetStat(4, /* NOP */);
if (points < 1 && owner.HasBuff(48)){
owner.RemoveBuff(48, /* NOP */, /* NOP */);
} else if (points >= 1 && !owner.HasBuff(48)){
if (CanUseSkill(5)){
owner.AddEffectDefault(48, owner, "BattleTranceS
kill", /* NOP */);
}
}
/* NOP */;
}
protected final function OnVitalityChanged(){
var vitPerc : Float;
vitPerc = GetStatPercents(0);
if (vitPerc < theGame.params.LOW_HEALTH_EFFECT_SHOW && !owner.Ha
sBuff(41)){

owner.AddEffectDefault(41, owner, 'vitality_change', /*


NOP */);
} else if (vitPerc >= theGame.params.LOW_HEALTH_EFFECT_SHOW && o
wner.HasBuff(41)){
owner.RemoveBuff(41, /* NOP */, /* NOP */);
}
theTelemetry.SetCommonStatFlt(0, GetStat(0, /* NOP */));
/* NOP */;
}
protected final function OnAirChanged(){
if (GetStat(6, /* NOP */) > 0){
if (owner.HasBuff(57)){
owner.RemoveBuff(57, /* NOP */, /* NOP */);
}
if (owner.HasBuff(109)){
owner.RemoveBuff(109, /* NOP */, /* NOP */);
}
}
/* NOP */;
}
protected final function OnToxicityChanged(){
var tox : Float;
if (!(W3PlayerWitcher)owner){
return;
}
tox = GetStat(3, /* NOP */);
if (tox == 0 && owner.HasBuff(21)){
owner.RemoveBuff(21, /* NOP */, /* NOP */);
} else if (tox > 0 && !owner.HasBuff(21)){
owner.AddEffectDefault(21, owner, 'toxicity_change', /*
NOP */);
}
theTelemetry.SetCommonStatFlt(1, GetStat(3, /* NOP */));
/* NOP */;
}
public final function GetPlayerSkillMutagens() : array<SMutagenSlot>{
return mutagenSlots;
/* NOP */;
}
public final function GetSkillGroupIdOfMutagenSlot(eqSlot : EEquipmentSl
ots) : Int32{
var i : Int32;
i = GetMutagenSlotIndex(eqSlot);
if (i < 0){
return -1;
}
return mutagenSlots[i].skillGroupID;
/* NOP */;
}
public final function IsSkillMutagenSlotUnlocked(eqSlot : EEquipmentSlot
s) : Bool{
var i : Int32;
i = GetMutagenSlotIndex(eqSlot);
if (i < 0){
return false;
}
return (W3PlayerWitcher)owner.GetLevel() >= mutagenSlots[i].unlo
ckedAtLevel;
/* NOP */;
}

private final function GetMutagenSlotForGroupId(groupID : Int32) : EEqui


pmentSlots{
var i : Int32;
i = 0;
while (i < mutagenSlots.Size()){
if (mutagenSlots[i].skillGroupID == groupID){
return mutagenSlots[i].equipmentSlot;
}
i += 1;
}
return 0;
/* NOP */;
}
public final function GetSkillGroupsCount() : Int32{
return mutagenSlots.Size();
/* NOP */;
}
public final function GetSkillGroupIDFromIndex(idx : Int32) : Int32{
if (idx >= 0 && idx < mutagenSlots.Size()){
return mutagenSlots[idx].skillGroupID;
}
return -1;
/* NOP */;
}
private final function GetMutagenSlotIndex(eqSlot : EEquipmentSlots) : I
nt32{
var i : Int32;
i = 0;
while (i < mutagenSlots.Size()){
if (mutagenSlots[i].equipmentSlot == eqSlot){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
private final function GetMutagenSlotIndexFromItemId(item : SItemUniqueI
d) : Int32{
var i : Int32;
i = 0;
while (i < mutagenSlots.Size()){
if (mutagenSlots[i].item == item){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public final function OnSkillMutagenEquipped(item : SItemUniqueId, slot
: EEquipmentSlots, prevColor : ESkillColor){
var i : Int32;
var newColor : ESkillColor;
var tutState : W3TutorialManagerUIHandlerStateCharDevMutagens;
i = GetMutagenSlotIndex(slot);
if (i < 0){
return;
}
mutagenSlots[i].item = item;

newColor = GetSkillGroupColor(mutagenSlots[i].skillGroupID);
LinkUpdate(newColor, prevColor);
if (CanUseSkill(76)){
MutagenSynergyBonusEnable(item, true, GetSkillLevel(76))
;
}
if (ShouldProcessTutorial('TutorialCharDevMutagens')){
tutState = (W3TutorialManagerUIHandlerStateCharDevMutage
ns)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutState){
tutState.EquippedMutagen();
}
}
theTelemetry.LogWithValueStr(16, owner.GetInventory().GetItemNam
e(item));
theGame.GetGamerProfile().CheckTrialOfGrasses();
/* NOP */;
}
public final function OnSkillMutagenUnequipped(item : SItemUniqueId, slo
t : EEquipmentSlots, prevColor : ESkillColor){
var i : Int32;
var newColor : ESkillColor;
i = GetMutagenSlotIndex(slot);
if (i < 0){
return;
}
if (CanUseSkill(76)){
MutagenSynergyBonusEnable(item, false, GetSkillLevel(76)
);
}
mutagenSlots[i].item = GetInvalidUniqueId();
newColor = GetSkillGroupColor(mutagenSlots[i].skillGroupID);
LinkUpdate(newColor, prevColor);
/* NOP */;
}
public final function OnSwappedMutagensPost(a : SItemUniqueId, b : SItem
UniqueId){
var oldSlotIndexA : Int32;
var oldSlotIndexB : Int32;
var oldColorA : ESkillColor;
var oldColorB : ESkillColor;
var newColorA : ESkillColor;
var newColorB : ESkillColor;
oldSlotIndexA = GetMutagenSlotIndexFromItemId(a);
oldSlotIndexB = GetMutagenSlotIndexFromItemId(b);
oldColorA = GetSkillGroupColor(mutagenSlots[oldSlotIndexA].skill
GroupID);
oldColorB = GetSkillGroupColor(mutagenSlots[oldSlotIndexB].skill
GroupID);
mutagenSlots[oldSlotIndexA].item = b;
mutagenSlots[oldSlotIndexB].item = a;
newColorA = GetSkillGroupColor(mutagenSlots[oldSlotIndexA].skill
GroupID);
newColorB = GetSkillGroupColor(mutagenSlots[oldSlotIndexB].skill
GroupID);
LinkUpdate(newColorA, oldColorA);
LinkUpdate(newColorB, oldColorB);
/* NOP */;
}
private final function MutagensSyngergyBonusProcess(enable : Bool, skill

Level : Int32){
var i : Int32;
var inv : CInventoryComponent;
inv = owner.GetInventory();
i = 0;
while (i < mutagenSlots.Size()){
if (inv.IsIdValid(mutagenSlots[i].item)){
MutagenSynergyBonusEnable(mutagenSlots[i].item,
enable, skillLevel);
}
i += 1;
}
/* NOP */;
}
private final function MutagenSynergyBonusEnable(mutagenItemId : SItemUn
iqueId, enable : Bool, bonusSkillLevel : Int32){
var i : Int32;
var count : Int32;
var color : ESkillColor;
count = 1;
i = 0;
while (i < mutagenSlots.Size()){
if (mutagenSlots[i].item == mutagenItemId){
color = owner.GetInventory().GetSkillMutagenColo
r(mutagenItemId);
count += GetGroupBonusCount(color, mutagenSlots[
i].skillGroupID);
break;
}
i += 1;
}
if (enable){
owner.AddAbilityMultiple(GetMutagenBonusAbilityName(muta
genItemId), count * bonusSkillLevel);
} else {
owner.RemoveAbilityMultiple(GetMutagenBonusAbilityName(m
utagenItemId), count * bonusSkillLevel);
}
/* NOP */;
}
public final function GetMutagenBonusAbilityName(mutagenItemId : SItemUn
iqueId) : CName{
var i : Int32;
var abs : array<CName>;
owner.GetInventory().GetItemContainedAbilities(mutagenItemId, ab
s);
i = 0;
while (i < abs.Size()){
if (theGame.GetDefinitionsManager().AbilityHasTag(abs[i]
, 'alchemy_s19')){
return abs[i];
}
i += 1;
}
return 'None';
/* NOP */;
}
public final function GetSkillGroupIdFromSkillSlotId(skillSlotId : Int32
) : Int32{
var i : Int32;

i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].id == skillSlotId){
return skillSlots[i].groupID;
}
i += 1;
}
return -1;
/* NOP */;
}
public function GetMutagenSlotIDFromGroupID(groupID : Int32) : Int32{
return super.GetMutagenSlotForGroupId(groupID);
/* NOP */;
}
public final function GetGroupBonus(groupID : Int32) : CName{
var groupColor : ESkillColor;
var item : SItemUniqueId;
groupColor = GetSkillGroupColor(groupID);
switch(groupColor){
case 0:
return 'None';
case 1:
return LINK_BONUS_BLUE;
case 2:
return LINK_BONUS_GREEN;
case 3:
return LINK_BONUS_RED;
}
/* NOP */;
}
public final function GetGroupBonusCount(commonColor : ESkillColor, grou
pID : Int32) : Int32{
var groupColorCount : Int32;
var item : SItemUniqueId;
groupColorCount = GetSkillGroupColorCount(commonColor, groupID);
return groupColorCount;
/* NOP */;
}
public final function GetSkillGroupColor(groupID : Int32) : ESkillColor{
var i : Int32;
var commonColor : ESkillColor;
var mutagenSlot : EEquipmentSlots;
var skillColors : array<ESkillColor>;
var item : SItemUniqueId;
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].unlocked && skillSlots[i].groupID == g
roupID){
skillColors.PushBack(GetSkillColor(skillSlots[i]
.socketedSkill));
}
i += 1;
}
commonColor = 0;
i = 0;
while (i < skillColors.Size()){
if (skillColors[i] != 0 && skillColors[i] != 4){
if (commonColor == 0){
commonColor = skillColors[i];
} else if (skillColors[i] != commonColor){

commonColor = 0;
break;
}
}
i += 1;
}
if (commonColor == 0){
return 0;
}
mutagenSlot = GetMutagenSlotForGroupId(groupID);
if (IsSkillMutagenSlotUnlocked(mutagenSlot)){
if (GetWitcherPlayer().GetItemEquippedOnSlot(mutagenSlot
, item)){
return owner.GetInventory().GetSkillMutagenColor
(item);
}
}
return commonColor;
/* NOP */;
}
public final function GetSkillGroupColorCount(commonColor : ESkillColor,
groupID : Int32) : ESkillColor{
var count : Int32;
var i : Int32;
var mutagenSlot : EEquipmentSlots;
var skillColors : array<ESkillColor>;
var item : SItemUniqueId;
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].unlocked && skillSlots[i].groupID == g
roupID){
skillColors.PushBack(GetSkillColor(skillSlots[i]
.socketedSkill));
}
i += 1;
}
count = 0;
i = 0;
while (i < skillColors.Size()){
if (skillColors[i] == commonColor){
count = count + 1;
}
i += 1;
}
return count;
/* NOP */;
}
private final function LinkUpdate(newColor : ESkillColor, prevColor : ES
killColor){
if (newColor == prevColor){
return;
}
UpdateLinkBonus(prevColor, false);
UpdateLinkBonus(newColor, true);
/* NOP */;
}
private final function UpdateLinkBonus(a : ESkillColor, added : Bool){
return;
if (added){
if (a == 1){

charStats.AddAbility(LINK_BONUS_BLUE, true);
} else if (a == 2){
charStats.AddAbility(LINK_BONUS_GREEN, true);
} else if (a == 3){
charStats.AddAbility(LINK_BONUS_RED, true);
}
} else if (a == 1){
charStats.RemoveAbility(LINK_BONUS_BLUE);
} else if (a == 2){
charStats.RemoveAbility(LINK_BONUS_GREEN);
} else if (a == 3){
charStats.RemoveAbility(LINK_BONUS_RED);
}
/* NOP */;
}
public final function GetSkillColor(skill : ESkill) : ESkillColor{
switch(skills[skill].skillPath){
case 1:
return 3;
case 2:
return 1;
case 3:
return 2;
case 4:
return 4;
default:
}
return 0;
/* NOP */;
}
public final function GetSkillLevel(skill : ESkill) : Int32{
return skills[skill].level;
/* NOP */;
}
public final function GetSkillMaxLevel(skill : ESkill) : Int32{
return skills[skill].maxLevel;
/* NOP */;
}
public final function GetSkillStaminaUseCost(skill : ESkill, isPerSec :
Bool) : Float{
var reductionCounter : Int32;
var ability : CName;
var attributeName : CName;
var ret : SAbilityAttributeValue;
var costReduction : SAbilityAttributeValue;
ability = 'None';
if (CanUseSkill(skill)){
ability = GetSkillAbilityName(skill);
}
if (isPerSec){
attributeName = theGame.params.STAMINA_COST_PER_SEC_DEFA
ULT;
} else {
attributeName = theGame.params.STAMINA_COST_DEFAULT;
}
ret = GetSkillAttributeValue(ability, attributeName, true, true)
;
reductionCounter = GetSkillLevel(skill) - 1;
if (reductionCounter > 0){
costReduction = GetSkillAttributeValue(ability, 'stamina

_cost_reduction_after_1', false, false) * reductionCounter;


ret -= costReduction;
}
return CalculateAttributeValue(ret, /* NOP */);
/* NOP */;
}
public final function GetSkillAttributeValue(abilityName : CName, attrib
uteName : CName, addBaseCharAttribute : Bool, addSkillModsAttribute : Bool) : SA
bilityAttributeValue{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var ret : SAbilityAttributeValue;
var i : Int32;
var j : Int32;
var dm : CDefinitionsManagerAccessor;
var skill : SSkill;
var skillEnum : ESkill;
var skillLevel : Int32;
ret = GetSkillAttributeValue(abilityName, attributeName, addBase
CharAttribute, addSkillModsAttribute);
if (addSkillModsAttribute){
skillEnum = SkillNameToEnum(abilityName);
if (skillEnum != 0){
skill = skills[skillEnum];
} else {
LogAssert(false, "W3PlayerAbilityManager.GetSkil
lAttributeValue: cannot find skill for ability <<" + abilityName + ">>! Aborting
");
return min;
}
dm = theGame.GetDefinitionsManager();
j = 0;
while (j < skill.precachedModifierSkills.Size()){
i = skill.precachedModifierSkills[j];
if (CanUseSkill(skills[i].skillType)){
dm.GetAbilityAttributeValue(skills[i].ab
ilityName, attributeName, min, max);
skillLevel = skills[i].level;
ret += GetAttributeRandomizedValue(min *
skillLevel, max * skillLevel);
}
j += 1;
}
}
if (addBaseCharAttribute){
ret += GetAttributeValueInternal(attributeName, /* NOP *
/);
}
return ret;
/* NOP */;
}
protected final function GetStaminaActionCostInternal(action : EStaminaA
ctionType, isPerSec : Bool, cost : SAbilityAttributeValue, delay : SAbilityAttri
buteValue, abilityName : CName){
var attributeName : CName;
var skill : ESkill;
GetStaminaActionCostInternal(action, isPerSec, cost, delay, abil
ityName);
if (isPerSec){
attributeName = theGame.params.STAMINA_COST_PER_SEC_DEFA

ULT;
} else {
attributeName = theGame.params.STAMINA_COST_DEFAULT;
}
if (action == 1 && CanUseSkill(1)){
cost += GetSkillAttributeValue(SkillEnumToName(1), attri
buteName, false, true);
} else if (action == 2 && CanUseSkill(2)){
cost += GetSkillAttributeValue(SkillEnumToName(2), attri
buteName, false, true);
} else if (action == 9 || action == 10 && thePlayer.HasBuff(96)
&& !thePlayer.IsInCombat()){
cost.valueAdditive = 0;
cost.valueBase = 0;
cost.valueMultiplicative = 0;
}
if (thePlayer.HasBuff(23) && owner == GetWitcherPlayer() && GetW
itcherPlayer().GetPotionBuffLevel(23) == 3 && thePlayer.HasBuff(48) && GetStatPe
rcents(4) == 1){
cost.valueAdditive = 0;
cost.valueBase = 0;
cost.valueMultiplicative = 0;
}
/* NOP */;
}
protected final function GetNonBlockedSkillAbilitiesList(tags : array<CN
ame>) : array<CName>{
var i : Int32;
var j : Int32;
var ret : array<CName>;
var dm : CDefinitionsManagerAccessor;
var abilityName : CName;
if (tags.Size() == 0){
return ret;
}
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < skillAbilities.Size()){
abilityName = skillAbilities[i];
j = 0;
while (j < tags.Size()){
if (dm.AbilityHasTag(abilityName, tags[j])){
ret.PushBack(abilityName);
}
j += 1;
}
i += 1;
}
return ret;
/* NOP */;
}
public final function IsSkillBlocked(skill : ESkill) : Bool{
return skills[skill].remainingBlockedTime != 0;
/* NOP */;
}
public final function BlockSkill(skill : ESkill, block : Bool, cooldown
: Float) : Bool{
var i : Int32;
var min : Float;
if (block){

if (skills[skill].remainingBlockedTime == -1 || cooldown
> 0 && cooldown <= skills[skill].remainingBlockedTime){
return false;
}
if (cooldown > 0){
skills[skill].remainingBlockedTime = cooldown;
} else {
skills[skill].remainingBlockedTime = -1;
}
min = 1000000;
i = 0;
while (i < skills.Size()){
if (skills[i].remainingBlockedTime > 0){
min = MinF(min, skills[i].remainingBlock
edTime);
}
i += 1;
}
if (min != 1000000){
GetWitcherPlayer().AddTimer('CheckBlockedSkills'
, min, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
}
if (theGame.GetDefinitionsManager().IsAbilityDefined(ski
lls[skill].abilityName) && charStats.HasAbility(skills[skill].abilityName, /* NO
P */)){
BlockAbility(GetSkillAbilityName(skill), block,
cooldown);
}
if (IsSkillEquipped(skill)){
OnSkillUnequip(skill);
}
return true;
} else {
if (skills[skill].remainingBlockedTime == 0){
return false;
}
skills[skill].remainingBlockedTime = 0;
if (theGame.GetDefinitionsManager().IsAbilityDefined(ski
lls[skill].abilityName) && charStats.HasAbility(skills[skill].abilityName, /* NO
P */)){
BlockAbility(GetSkillAbilityName(skill), false,
/* NOP */);
}
if (IsSkillEquipped(skill)){
OnSkillEquip(skill);
}
return true;
}
/* NOP */;
}
public final function CheckBlockedSkills(dt : Float) : Float{
var i : Int32;
var cooldown : Float;
var min : Float;
min = 1000000;
i = 0;
while (i < skills.Size()){
if (skills[i].remainingBlockedTime > 0){
skills[i].remainingBlockedTime = MaxF(0, skills[
i].remainingBlockedTime - dt);

if (skills[i].remainingBlockedTime == 0){
BlockSkill(skills[i].skillType, false, /
* NOP */);
} else {
min = MinF(min, skills[i].remainingBlock
edTime);
}
}
i += 1;
}
if (min == 1000000){
min = -1;
}
return min;
/* NOP */;
}
public final function BlockAbility(abilityName : CName, block : Bool, co
oldown : Float) : Bool{
var i : Int32;
if (BlockAbility(abilityName, block, cooldown)){
if (block){
skillAbilities.Remove(abilityName);
} else {
i = 0;
while (i < skills.Size()){
if (skills[i].abilityName == abilityName
){
if (!theGame.GetDefinitionsManag
er().AbilityHasTag(skills[i].abilityName, theGame.params.SKILL_GLOBAL_PASSIVE_TA
G)){
skillAbilities.PushBack(
abilityName);
}
break;
}
i += 1;
}
}
return true;
}
return false;
/* NOP */;
}
protected final function InitSkills(){
var atts : array<CName>;
var i : Int32;
var size : Int32;
var skillEnum : ESkill;
charStats.GetAllContainedAbilities(atts);
size = atts.Size();
i = 0;
while (i < size){
skillEnum = SkillNameToEnum(atts[i]);
if (skillEnum != 0){
if (!IsAbilityBlocked(atts[i])){
AddSkillInternal(skillEnum, false, false
, true);
}
}
i += 1;

}
/* NOP */;
}
protected final function IsCoreSkill(skill : ESkill) : Bool{
return skills[skill].isCoreSkill;
/* NOP */;
}
protected final function CacheSkills(skillDefinitionName : CName, cache
: array<SSkill>){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var sks : SCustomNode;
var i : Int32;
var size : Int32;
var skillType : ESkill;
var bFound : Bool;
var tmpName : CName;
var skillDefs : array<CName>;
dm = theGame.GetDefinitionsManager();
sks = dm.GetCustomDefinition('skills');
bFound = false;
size = sks.subNodes.Size();
i = 0;
while (i < size){
if (dm.GetCustomNodeAttributeValueName(sks.subNodes[i],
'def_name', tmpName)){
if (tmpName == skillDefinitionName){
bFound = true;
main = sks.subNodes[i];
break;
}
}
i += 1;
}
if (!bFound){
LogAssert(false, "W3AbilityManager.CacheSkills: cannot f
ind skill definition named <<" + skillDefinitionName + ">> aborting!");
return;
}
cache.Clear();
cache.Resize(92);
size = main.subNodes.Size();
i = 0;
while (i < size){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'sk
ill_name', tmpName);
skillType = SkillNameToEnum(tmpName);
if (skillType != 0){
if (cache[skillType].skillType == skillType){
/* NOP */;
} else {
CacheSkill(skillType, tmpName, main.subN
odes[i], cache[skillType]);
}
} else {
LogAssert(false, "W3PlayerAbilityManager.CacheSk
ills: skill <<" + tmpName + ">> is not defined in PST enum, ignoring skill!");
}
i += 1;
}

/* NOP */;
}
private final function CacheSkill(skillType : Int32, abilityName : CName
, definitionNode : SCustomNode, skill : SSkill){
var dm : CDefinitionsManagerAccessor;
var modifiers : SCustomNode;
var reqSkills : SCustomNode;
var pathType : ESkillPath;
var subpathType : ESkillSubPath;
var tmpName : CName;
var tmpInt : Int32;
var k : Int32;
var size : Int32;
var tmpString : String;
var tmpBool : Bool;
dm = theGame.GetDefinitionsManager();
skill.wasEquippedOnUIEnter = false;
skill.level = 0;
skill.skillType = skillType;
skill.abilityName = abilityName;
if (dm.GetCustomNodeAttributeValueName(definitionNode, 'pathType
_name', tmpName)){
pathType = SkillPathNameToType(tmpName);
if (pathType != 0){
skill.skillPath = pathType;
} else if (skill.skillType != 87){
LogAssert(false, "W3PlayerAbilityManager.CacheSk
ill: skill <<" + skill.skillType + ">> has wrong path type set <<" + tmpName + "
>>");
}
}
if (dm.GetCustomNodeAttributeValueName(definitionNode, 'subpathT
ype_name', tmpName)){
subpathType = SkillSubPathNameToType(tmpName);
if (subpathType != 0){
skill.skillSubPath = subpathType;
} else if (skill.skillType != 87){
LogAssert(false, "W3PlayerAbilityManager.CacheSk
ill: skill <<" + skill.skillType + ">> has wrong subpath type set <<" + tmpName
+ ">>");
}
}
reqSkills = dm.GetCustomDefinitionSubNode(definitionNode, 'requi
red_skills');
if (reqSkills.values.Size() > 0){
size = reqSkills.values.Size();
k = 0;
while (k < size){
if (IsNameValid(reqSkills.values[k])){
skill.requiredSkills.PushBack(SkillNameT
oEnum(reqSkills.values[k]));
}
k += 1;
}
}
if (dm.GetCustomNodeAttributeValueBool(reqSkills, 'isAlternative
', tmpBool)){
skill.requiredSkillsIsAlternative = tmpBool;
}
if (dm.GetCustomNodeAttributeValueInt(definitionNode, 'priority'

, tmpInt)){
skill.priority = tmpInt;
}
if (dm.GetCustomNodeAttributeValueInt(definitionNode, 'requiredP
ointsSpent', tmpInt)){
skill.requiredPointsSpent = tmpInt;
}
if (dm.GetCustomNodeAttributeValueString(definitionNode, 'locali
sationName', tmpString)){
skill.localisationNameKey = tmpString;
}
if (dm.GetCustomNodeAttributeValueString(definitionNode, 'locali
sationDescription', tmpString)){
skill.localisationDescriptionKey = tmpString;
}
if (dm.GetCustomNodeAttributeValueString(definitionNode, 'locali
sationDescriptionLevel2', tmpString)){
skill.localisationDescriptionLevel2Key = tmpString;
}
if (dm.GetCustomNodeAttributeValueString(definitionNode, 'locali
sationDescriptionLevel3', tmpString)){
skill.localisationDescriptionLevel3Key = tmpString;
}
if (dm.GetCustomNodeAttributeValueInt(definitionNode, 'cost', tm
pInt)){
skill.cost = tmpInt;
}
if (dm.GetCustomNodeAttributeValueInt(definitionNode, 'maxLevel'
, tmpInt)){
skill.maxLevel = tmpInt;
} else {
skill.maxLevel = 1;
}
if (dm.GetCustomNodeAttributeValueBool(definitionNode, 'isCoreSk
ill', tmpBool)){
skill.isCoreSkill = tmpBool;
}
if (dm.GetCustomNodeAttributeValueInt(definitionNode, 'guiPositi
onID', tmpInt)){
skill.positionID = tmpInt;
}
modifiers = dm.GetCustomDefinitionSubNode(definitionNode, 'modif
ier_tags');
if (modifiers.values.Size() > 0){
size = modifiers.values.Size();
k = 0;
while (k < size){
if (IsNameValid(modifiers.values[k])){
skill.modifierTags.PushBack(modifiers.va
lues[k]);
}
k += 1;
}
}
if (dm.GetCustomNodeAttributeValueString(definitionNode, 'iconPa
th', tmpString)){
skill.iconPath = tmpString;
}
/* NOP */;
}

private final function LoadMutagenSlotsDataFromXML(){


var mut : SCustomNode;
var i : Int32;
var mutagen : SMutagenSlot;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
mut = dm.GetCustomDefinition('mutagen_slots');
i = 0;
while (i < mut.subNodes.Size()){
dm.GetCustomNodeAttributeValueInt(mut.subNodes[i], 'skil
lGroup', mutagen.skillGroupID);
dm.GetCustomNodeAttributeValueInt(mut.subNodes[i], 'unlo
ckedAtLevel', mutagen.unlockedAtLevel);
mutagen.item = GetInvalidUniqueId();
mutagen.equipmentSlot = 22 + i;
if (mutagen.equipmentSlot > 25){
LogAssert(false, "W3PlayerAbilityManager.LoadMut
agenSlotsDataFromXML: too many slots defined in XML!!! Aborting");
return;
}
mutagenSlots.PushBack(mutagen);
i += 1;
}
/* NOP */;
}
public final function AddSkill(skill : ESkill, isTemporary : Bool){
var i : Int32;
var learnedAll : Bool;
var ret : Bool;
var tree : ESkillPath;
var uiStateCharDev : W3TutorialManagerUIHandlerStateCharacterDev
elopment;
var uiStateSpecialAttacks : W3TutorialManagerUIHandlerStateSpeci
alAttacks;
ret = AddSkillInternal(skill, true, isTemporary, /* NOP */);
if (!ret){
return;
}
tree = GetSkillPathType(skill);
learnedAll = true;
i = 0;
while (i < skills.Size()){
if (skills[i].skillPath == tree && skills[i].level == 0)
{
learnedAll = false;
break;
}
i += 1;
}
if (learnedAll){
theGame.GetGamerProfile().AddAchievement(16);
}
if (ShouldProcessTutorial('TutorialCharDevBuySkill')){
uiStateCharDev = (W3TutorialManagerUIHandlerStateCharact
erDevelopment)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateCharDev){
uiStateCharDev.OnBoughtSkill(skill);
}
}
if (ShouldProcessTutorial('TutorialSpecialAttacks') || ShouldPro

cessTutorial('TutorialAlternateSigns')){
uiStateSpecialAttacks = (W3TutorialManagerUIHandlerState
SpecialAttacks)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiStateSpecialAttacks){
uiStateSpecialAttacks.OnBoughtSkill(skill);
}
}
/* NOP */;
}
protected final function AddSkillInternal(skill : ESkill, spendPoints :
Bool, isTemporary : Bool, skipTutorialMessages : Bool) : Bool{
if (skill == 0){
LogAssert(false, "W3AbilityManager.AddSkill: trying to a
dd undefined skill, aborting!");
return false;
}
if (HasLearnedSkill(skill) && skills[skill].level >= skills[skil
l].maxLevel){
LogAssert(false, "W3AbilityManager.AddSkill: trying to a
dd skill already known <<" + SkillEnumToName(skill) + ">>, aborting!");
return false;
}
skills[skill].level += 1;
if (!skills[skill].isCoreSkill){
pathPointsSpent[skills[skill].skillPath] = pathPointsSpe
nt[skills[skill].skillPath] + 1;
}
if (!isTemporary){
LogSkills("Skill <<" + skills[skill].abilityName + ">> l
earned");
if (spendPoints){
(W3PlayerWitcher)owner.levelManager.SpendPoints(
0, skills[skill].cost);
}
if (IsSkillEquipped(skill)){
OnSkillEquippedLevelChange(skill, skills[skill].
level - 1, skills[skill].level);
}
theTelemetry.LogWithValueStr(11, SkillEnumToName(skill))
;
}
return true;
/* NOP */;
}
public final function RemoveTemporarySkill(skill : SSimpleSkill) : Bool{
var ind : Int32;
LogAssert(skill.skillType >= 0, "W3AbilityManager.RemoveTemporar
ySkill: trying to remove undefined skill");
if (!skills[skill.skillType].isCoreSkill){
pathPointsSpent[skills[skill.skillType].skillPath] = pat
hPointsSpent[skills[skill.skillType].skillPath] - skills[skill.skillType].level
- skill.level;
}
skills[skill.skillType].level = skill.level;
if (skills[skill.skillType].level < 1){
ind = GetSkillSlotID(skill.skillType);
if (ind >= 0){
UnequipSkill(ind);
}
}

tempSkills.Remove(skill.skillType);
return true;
/* NOP */;
}
public final function HasLearnedSkill(skill : ESkill) : Bool{
return skills[skill].level > 0;
/* NOP */;
}
private final function GetSkillFromAbilityName(abilityName : CName) : ES
kill{
var i : Int32;
i = 0;
while (i < skills.Size()){
if (skills[i].abilityName == abilityName){
return skills[i].skillType;
}
i += 1;
}
return 0;
/* NOP */;
}
public final function CanLearnSkill(skill : ESkill) : Bool{
var j : Int32;
var hasSomeRequiredSkill : Bool;
if (skill == 0){
return false;
}
if (skills[skill].level >= skills[skill].maxLevel){
return false;
}
if (skills[skill].requiredPointsSpent > 0 && pathPointsSpent[ski
lls[skill].skillPath] < skills[skill].requiredPointsSpent){
return false;
}
if ((W3PlayerWitcher)owner.levelManager.GetPointsFree(0) < skill
s[skill].cost){
return false;
}
return true;
/* NOP */;
}
public final function HasSpentEnoughPoints(skill : ESkill) : Bool{
if (skills[skill].requiredPointsSpent > 0 && pathPointsSpent[ski
lls[skill].skillPath] < skills[skill].requiredPointsSpent){
return false;
}
return true;
/* NOP */;
}
public final function PathPointsSpentInSkillPathOfSkill(skill : ESkill)
: Int32{
return pathPointsSpent[skills[skill].skillPath];
/* NOP */;
}
public final function GetSkillAbilityName(skill : ESkill) : CName{
return skills[skill].abilityName;
/* NOP */;
}
public final function GetSkillLocalisationKeyName(skill : ESkill) : Stri
ng{

return skills[skill].localisationNameKey;
/* NOP */;
}
public final function GetSkillLocalisationKeyDescription(skill : ESkill,
level : Int32) : String{
switch(level){
case 2:
return skills[skill].localisationDescriptionLevel2Key;
case 3:
return skills[skill].localisationDescriptionLevel3Key;
case 4:
return skills[skill].localisationDescriptionLevel3Key;
case 5:
return skills[skill].localisationDescriptionLevel3Key;
default:
}
return skills[skill].localisationDescriptionKey;
/* NOP */;
}
public final function GetSkillIconPath(skill : ESkill) : String{
return skills[skill].iconPath;
/* NOP */;
}
public final function GetSkillSubPathType(skill : ESkill) : ESkillSubPat
h{
return skills[skill].skillSubPath;
/* NOP */;
}
public final function GetSkillPathType(skill : ESkill) : ESkillPath{
return skills[skill].skillPath;
/* NOP */;
}
protected function GetItemResistStatIndex(slot : EEquipmentSlots, stat :
ECharacterDefenseStats) : Int32{
var i : Int32;
var size : Int32;
size = resistStatsItems[slot].Size();
i = 0;
while (i < size){
if (resistStatsItems[slot][i].type == stat){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
protected final function RecalcResistStat(stat : ECharacterDefenseStats)
{
var witcher : W3PlayerWitcher;
var item : SItemUniqueId;
var slot : Int32;
var idxItems : Int32;
var itemResists : array<ECharacterDefenseStats>;
var resistStat : SResistanceValue;
RecalcResistStat(stat);
witcher = (W3PlayerWitcher)owner;
if (!witcher){
return;
}

GetResistStat(stat, resistStat);
slot = 0;
while (slot < resistStatsItems.Size()){
if (witcher.GetItemEquippedOnSlot(slot, item) && witcher
.inv.HasItemDurability(item)){
itemResists = witcher.inv.GetItemResistanceTypes
(item);
if (itemResists.Contains(stat)){
resistStat.points.valueBase -= Calculate
AttributeValue(witcher.inv.GetItemAttributeValue(item, ResistStatEnumToName(stat
, true), /* NOP */, /* NOP */), /* NOP */);
resistStat.percents.valueBase -= Calcula
teAttributeValue(witcher.inv.GetItemAttributeValue(item, ResistStatEnumToName(st
at, false), /* NOP */, /* NOP */), /* NOP */);
SetItemResistStat(slot, stat);
idxItems = GetItemResistStatIndex(slot,
stat);
if (idxItems >= 0){
resistStat.percents.valueBase +=
CalculateAttributeValue(resistStatsItems[slot][idxItems].percents, /* NOP */);
resistStat.points.valueBase += C
alculateAttributeValue(resistStatsItems[slot][idxItems].points, /* NOP */);
}
}
}
slot += 1;
}
SetResistStat(stat, resistStat);
/* NOP */;
}
private final function SetItemResistStat(slot : EEquipmentSlots, stat :
ECharacterDefenseStats){
var item : SItemUniqueId;
var tempResist : SResistanceValue;
var witcher : W3PlayerWitcher;
var i : Int32;
witcher = (W3PlayerWitcher)owner;
if (!witcher){
return;
}
i = GetItemResistStatIndex(slot, stat);
if (witcher.GetItemEquippedOnSlot(slot, item) && witcher.inv.Has
ItemDurability(item)){
if (i >= 0){
witcher.inv.GetItemResistStatWithDurabilityModif
iers(item, stat, resistStatsItems[slot][i].points, resistStatsItems[slot][i].per
cents);
} else {
witcher.inv.GetItemResistStatWithDurabilityModif
iers(item, stat, tempResist.points, tempResist.percents);
tempResist.type = stat;
resistStatsItems[slot].PushBack(tempResist);
}
} else if (i >= 0){
resistStatsItems[slot].Erase(i);
}
/* NOP */;
}
public final function RecalcItemResistDurability(slot : EEquipmentSlots,
itemId : SItemUniqueId){

var i : Int32;
var witcher : W3PlayerWitcher;
var itemResists : array<ECharacterDefenseStats>;
witcher = (W3PlayerWitcher)owner;
if (!witcher){
return;
}
itemResists = witcher.inv.GetItemResistanceTypes(itemId);
i = 0;
while (i < itemResists.Size()){
if (itemResists[i] != 0){
RecalcResistStatFromItem(itemResists[i], slot);
}
i += 1;
}
/* NOP */;
}
private final function RecalcResistStatFromItem(stat : ECharacterDefense
Stats, slot : EEquipmentSlots){
var deltaResist : SResistanceValue;
var prevCachedResist : SResistanceValue;
var idx : Int32;
var resistStat : SResistanceValue;
idx = GetItemResistStatIndex(slot, stat);
prevCachedResist = resistStatsItems[slot][idx];
SetItemResistStat(slot, stat);
deltaResist.points = resistStatsItems[slot][idx].points - prevCa
chedResist.points;
deltaResist.percents = resistStatsItems[slot][idx].percents - pr
evCachedResist.percents;
if (GetResistStat(stat, resistStat)){
resistStat.percents += deltaResist.percents;
resistStat.points += deltaResist.points;
SetResistStat(stat, resistStat);
}
/* NOP */;
}
public final function DrainStamina(action : EStaminaActionType, fixedCos
t : Float, fixedDelay : Float, abilityName : CName, dt : Float, costMult : Float
) : Float{
var cost : Float;
var vitality : Float;
var mutagen : CBaseGameplayEffect;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
if (FactsDoesExist("debug_fact_stamina_boy")){
return 0;
}
cost = DrainStamina(action, fixedCost, fixedDelay, abilityName,
dt, costMult);
if (cost > 0 && dt > 0){
owner.AddTimer('AbilityManager_FloorStaminaSegment', 0.1
00000, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
}
if (cost > 0 && dt <= 0 && owner == thePlayer && thePlayer.HasBu
ff(93)){
mutagen = thePlayer.GetBuff(93, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(mutagen.GetAbilityName(), 'healingRatio', min, max);
vitality = thePlayer.GetStatMax(0);

vitality *= CalculateAttributeValue(GetAttributeRandomiz
edValue(min, max), /* NOP */);
thePlayer.GainStat(0, vitality);
}
if (owner == GetWitcherPlayer() && GetStat(2, true) <= 0.000000)
{
GetWitcherPlayer().GetSignEntity(GetWitcherPlayer().GetC
urrentlyCastSign()).OnSignAborted(true);
}
return cost;
/* NOP */;
}
public final function FloorStaminaSegment(){
}
public final function GetStat(stat : EBaseCharacterStats, skipLock : Boo
l) : Float{
var value : Float;
var lock : Float;
var i : Int32;
value = GetStat(stat, skipLock);
if (stat == 3 && !skipLock && toxicityOffset > 0){
value += toxicityOffset;
}
return value;
/* NOP */;
}
public final function AddToxicityOffset(val : Float){
if (val > 0){
toxicityOffset += val;
}
/* NOP */;
}
public final function RemoveToxicityOffset(val : Float){
if (val > 0){
toxicityOffset -= val;
}
if (toxicityOffset < 0){
toxicityOffset = 0;
}
/* NOP */;
}
public final function GetOffenseStat() : Int32{
var steelDmg : Float;
var silverDmg : Float;
var steelCritChance : Float;
var steelCritDmg : Float;
var silverCritChance : Float;
var silverCritDmg : Float;
var attackPower : SAbilityAttributeValue;
var item : SItemUniqueId;
var value : SAbilityAttributeValue;
if (CanUseSkill(19)){
attackPower += GetSkillAttributeValue(SkillEnumToName(19
), PowerStatEnumToName(0), false, true) * GetSkillLevel(19);
}
if (CanUseSkill(36)){
attackPower += GetSkillAttributeValue(SkillEnumToName(36
), PowerStatEnumToName(0), false, true) * GetSkillLevel(36);
}
attackPower = attackPower * 0.500000;

if (CanUseSkill(23)){
steelCritChance += CalculateAttributeValue(GetSkillAttri
buteValue(SkillEnumToName(23), theGame.params.CRITICAL_HIT_CHANCE, false, true),
/* NOP */) * GetSkillLevel(23);
steelCritDmg += CalculateAttributeValue(GetSkillAttribut
eValue(SkillEnumToName(23), theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, tru
e), /* NOP */) * GetSkillLevel(23);
}
if (CanUseSkill(32)){
steelCritChance += CalculateAttributeValue(GetSkillAttri
buteValue(SkillEnumToName(32), theGame.params.CRITICAL_HIT_CHANCE, false, true),
/* NOP */) * GetSkillLevel(32);
steelCritDmg += CalculateAttributeValue(GetSkillAttribut
eValue(SkillEnumToName(32), theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, tru
e), /* NOP */) * GetSkillLevel(32);
}
steelCritChance /= 2;
steelCritDmg /= 2;
silverCritChance = steelCritChance;
silverCritDmg = steelCritDmg;
if (GetWitcherPlayer().GetItemEquippedOnSlot(2, item)){
value = thePlayer.GetInventory().GetItemAttributeValue(i
tem, theGame.params.DAMAGE_NAME_SLASHING, /* NOP */, /* NOP */);
steelDmg += value.valueBase;
steelCritChance += CalculateAttributeValue(thePlayer.Get
Inventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE, /* N
OP */, /* NOP */), /* NOP */);
steelCritDmg += CalculateAttributeValue(thePlayer.GetInv
entory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, /
* NOP */, /* NOP */), /* NOP */);
} else {
steelDmg += 0;
steelCritChance += 0;
steelCritDmg += 0;
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(1, item)){
value = thePlayer.GetInventory().GetItemAttributeValue(i
tem, theGame.params.DAMAGE_NAME_SILVER, /* NOP */, /* NOP */);
silverDmg += value.valueBase;
silverCritChance += CalculateAttributeValue(thePlayer.Ge
tInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE, /*
NOP */, /* NOP */), /* NOP */);
silverCritDmg += CalculateAttributeValue(thePlayer.GetIn
ventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS,
/* NOP */, /* NOP */), /* NOP */);
} else {
silverDmg += 0;
silverCritChance += 0;
silverCritDmg += 0;
}
steelCritChance += CalculateAttributeValue(GetWitcherPlayer().Ge
tAttributeValue(theGame.params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /* NO
P */);
silverCritChance += CalculateAttributeValue(GetWitcherPlayer().G
etAttributeValue(theGame.params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /* N
OP */);
steelCritDmg += CalculateAttributeValue(GetWitcherPlayer().GetAt
tributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS, /* NOP */, /* NOP */), /*
NOP */);
silverCritDmg += CalculateAttributeValue(GetWitcherPlayer().GetA

ttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS, /* NOP */, /* NOP */), /


* NOP */);
attackPower += GetWitcherPlayer().GetPowerStatValue(0, /* NOP */
, /* NOP */);
steelCritChance *= 100;
silverCritChance *= 100;
steelDmg = steelDmg * 100 - steelCritChance + steelDmg * 1 + ste
elCritDmg * steelCritChance;
steelDmg *= attackPower.valueMultiplicative;
steelDmg /= 100;
silverDmg = silverDmg * 100 - silverCritChance + silverDmg * 1 +
silverCritDmg * silverCritChance;
silverDmg *= attackPower.valueMultiplicative;
silverDmg /= 100;
return RoundMath(steelDmg + silverDmg / 2);
/* NOP */;
}
public final function GetDefenseStat() : Int32{
var valArmor : SAbilityAttributeValue;
var valResists : Float;
var fVal1 : Float;
var fVal2 : Float;
valArmor = thePlayer.GetTotalArmor();
thePlayer.GetResistValue(11, fVal1, fVal2);
valResists += fVal2;
thePlayer.GetResistValue(12, fVal1, fVal2);
valResists += fVal2;
thePlayer.GetResistValue(13, fVal1, fVal2);
valResists += fVal2;
thePlayer.GetResistValue(14, fVal1, fVal2);
valResists += fVal2;
thePlayer.GetResistValue(15, fVal1, fVal2);
valResists += fVal2;
valResists = valResists / 5;
fVal1 = 100 - valArmor.valueBase;
fVal1 *= valResists;
fVal1 += valArmor.valueBase;
return RoundMath(fVal1);
/* NOP */;
}
public final function GetSignsStat() : Float{
var sp : SAbilityAttributeValue;
sp += thePlayer.GetSkillAttributeValue(6, PowerStatEnumToName(1)
, true, true);
sp += thePlayer.GetSkillAttributeValue(7, PowerStatEnumToName(1)
, true, true);
sp += thePlayer.GetSkillAttributeValue(8, PowerStatEnumToName(1)
, true, true);
sp += thePlayer.GetSkillAttributeValue(9, PowerStatEnumToName(1)
, true, true);
sp += thePlayer.GetSkillAttributeValue(10, PowerStatEnumToName(1
), true, true);
sp.valueMultiplicative /= 5;
return sp.valueMultiplicative;
/* NOP */;
}
public function OnLevelGained(currentLevel : Int32) : Bool{
var i : Int32;
i = 0;
while (i < skillSlots.Size()){

if (currentLevel >= skillSlots[i].unlockedOnLevel){


skillSlots[i].unlocked = true;
}
i += 1;
}
/* NOP */;
}
private final function InitSkillSlots(){
var slot : SSkillSlot;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var i : Int32;
var tmpInt : Int32;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('skill_slots');
i = 0;
while (i < main.subNodes.Size()){
if (!dm.GetCustomNodeAttributeValueInt(main.subNodes[i],
'id', slot.id)){
LogAssert(false, "W3PlayerAbilityManager.InitSki
llSlots: slot definition is not valid!");
} else {
if (!dm.GetCustomNodeAttributeValueInt(main.subN
odes[i], 'unlockedOnLevel', slot.unlockedOnLevel)){
slot.unlockedOnLevel = 0;
}
if (!dm.GetCustomNodeAttributeValueInt(main.subN
odes[i], 'group', slot.groupID)){
slot.groupID = -1;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'neighbourUp', tmpInt)){
slot.neighbourUp = tmpInt;
} else {
slot.neighbourUp = -1;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'neighbourDown', tmpInt)){
slot.neighbourDown = tmpInt;
} else {
slot.neighbourDown = -1;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'neighbourLeft', tmpInt)){
slot.neighbourLeft = tmpInt;
} else {
slot.neighbourLeft = -1;
}
if (dm.GetCustomNodeAttributeValueInt(main.subNo
des[i], 'neighbourRight', tmpInt)){
slot.neighbourRight = tmpInt;
} else {
slot.neighbourRight = -1;
}
totalSkillSlotsCount = Max(totalSkillSlotsCount,
slot.id);
/* NOP */;
skillSlots.PushBack(slot);
slot.id = -1;
slot.unlockedOnLevel = 0;

slot.neighbourUp = -1;
slot.neighbourDown = -1;
slot.neighbourLeft = -1;
slot.neighbourRight = -1;
slot.groupID = -1;
}
i += 1;
}
/* NOP */;
}
public final function GetSkillSlotID(skill : ESkill) : Int32{
var i : Int32;
if (skill == 0){
return -1;
}
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].socketedSkill == skill){
if (skillSlots[i].unlocked){
return skillSlots[i].id;
} else {
return -1;
}
}
i += 1;
}
return -1;
/* NOP */;
}
public final function GetSkillSlotIDFromIndex(skillSlotIndex : Int32) :
Int32{
if (skillSlotIndex >= 0 && skillSlotIndex < skillSlots.Size()){
return skillSlots[skillSlotIndex].id;
}
return -1;
/* NOP */;
}
public final function GetSkillSlotIndex(slotID : Int32, checkIfUnlocked
: Bool) : Int32{
var i : Int32;
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].id == slotID){
if (!checkIfUnlocked){
return i;
}
if (skillSlots[i].unlocked){
return i;
} else {
return -1;
}
}
i += 1;
}
return -1;
/* NOP */;
}
public final function GetSkillSlotIndexFromSkill(skill : ESkill) : Int32
{
var i : Int32;

i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].socketedSkill == skill){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public final function EquipSkill(skill : ESkill, slotID : Int32) : Bool{
var idx : Int32;
var prevColor : ESkillColor;
if (!HasLearnedSkill(skill) || IsCoreSkill(skill)){
return false;
}
idx = GetSkillSlotIndex(slotID, true);
if (idx < 0){
return false;
}
prevColor = GetSkillGroupColor(skillSlots[idx].groupID);
UnequipSkill(slotID);
skillSlots[idx].socketedSkill = skill;
LinkUpdate(GetSkillGroupColor(skillSlots[idx].groupID), prevColo
r);
OnSkillEquip(skill);
return true;
/* NOP */;
}
public final function UnequipSkill(slotID : Int32) : Bool{
var idx : Int32;
var prevColor : ESkillColor;
var skill : ESkill;
idx = GetSkillSlotIndex(slotID, true);
if (idx < 0){
return false;
}
if (CanUseSkill(76)){
MutagensSyngergyBonusProcess(false, GetSkillLevel(76));
}
prevColor = GetSkillGroupColor(skillSlots[idx].groupID);
skill = skillSlots[idx].socketedSkill;
skillSlots[idx].socketedSkill = 0;
LinkUpdate(GetSkillGroupColor(skillSlots[idx].groupID), prevColo
r);
OnSkillUnequip(skill);
return true;
/* NOP */;
}
private final function OnSkillEquip(skill : ESkill){
var skillName : CName;
var names : array<CName>;
var buff : W3Effect_Toxicity;
var witcher : W3PlayerWitcher;
var i : Int32;
var isPassive : Bool;
var isNight : Bool;
var m_alchemyManager : W3AlchemyManager;
var recipe : SAlchemyRecipe;
var uiState : W3TutorialManagerUIHandlerStateCharacterDevelopmen

t;
var battleTrance : W3Effect_BattleTrance;
var mutagens : array<CBaseGameplayEffect>;
if (IsCoreSkill(skill)){
return;
}
witcher = GetWitcherPlayer();
AddPassiveSkillBuff(skill);
isPassive = theGame.GetDefinitionsManager().AbilityHasTag(skills
[skill].abilityName, theGame.params.SKILL_GLOBAL_PASSIVE_TAG);
i = 0;
while (i < skills[skill].level){
if (isPassive){
owner.AddAbility(skills[skill].abilityName, true
);
} else {
skillAbilities.PushBack(skills[skill].abilityNam
e);
}
i += 1;
}
if (GetSkillPathType(skill) == 1){
owner.AddAbilityMultiple('sword_adrenalinegain', GetSkil
lLevel(skill));
}
if (GetSkillPathType(skill) == 2){
owner.AddAbilityMultiple('magic_staminaregen', GetSkillL
evel(skill));
}
if (GetSkillPathType(skill) == 3){
owner.AddAbilityMultiple('alchemy_potionduration', GetSk
illLevel(skill));
}
if (CanUseSkill(76)){
MutagensSyngergyBonusProcess(false, GetSkillLevel(76));
MutagensSyngergyBonusProcess(true, GetSkillLevel(76));
} else if (skill == 77){
if (GetWitcherPlayer().GetStatPercents(3) >= GetWitcherP
layer().GetToxicityDamageThreshold()){
owner.AddEffectDefault(37, owner, 'IgnorePain',
/* NOP */);
}
}
if (skill == 75){
m_alchemyManager = new W3AlchemyManager in this;
m_alchemyManager.Init(/* NOP */);
names = witcher.GetAlchemyRecipes();
skillName = SkillEnumToName(75);
i = 0;
while (i < names.Size()){
m_alchemyManager.GetRecipe(names[i], recipe);
if (recipe.cookedItemType != 5 && recipe.cookedI
temType != 0 && recipe.level <= GetSkillLevel(75)){
charStats.AddAbility(skillName, true);
}
i += 1;
}
} else if (skill == 72 && owner.HasBuff(21)){
buff = (W3Effect_Toxicity)owner.GetBuff(21, /* NOP */);
buff.RecalcEffectValue();

} else if (skill == 70){


mutagens = GetWitcherPlayer().GetDrunkMutagens();
if (mutagens.Size() > 0){
charStats.AddAbilityMultiple(GetSkillAbilityName
(skill), GetSkillLevel(skill));
}
} else if (skill == 47){
(W3YrdenEntity)witcher.GetSignEntity(1).SkillEquipped(sk
ill);
} else if (skill == 43){
if (owner.HasBuff(48)){
owner.AddAbility(GetSkillAbilityName(43), /* NOP
*/);
}
} else if (skill == 87){
thePlayer.ChangeAlchemyItemsAbilities(true);
} else if (skill == 76){
} else if (skill == 80){
isNight = theGame.envMgr.IsNight();
SetPerk01Abilities(!isNight, isNight);
} else if (skill == 84){
charStats.RemoveAbility(GetSkillAbilityName(skill));
SetPerkArmorBonus(84, true);
} else if (skill == 85){
charStats.RemoveAbility(GetSkillAbilityName(skill));
SetPerkArmorBonus(85, true);
} else if (skill == 86){
charStats.RemoveAbility(GetSkillAbilityName(skill));
SetPerkArmorBonus(86, true);
} else if (skill == 90){
battleTrance = (W3Effect_BattleTrance)owner.GetBuff(48,
/* NOP */);
if (battleTrance){
battleTrance.OnPerk11Equipped();
}
}
if (GetSkillPathType(skill) == 3){
witcher.RecalcPotionsDurations();
}
if (ShouldProcessTutorial('TutorialCharDevEquipSkill')){
uiState = (W3TutorialManagerUIHandlerStateCharacterDevel
opment)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiState){
uiState.EquippedSkill();
}
}
theGame.GetGamerProfile().CheckTrialOfGrasses();
/* NOP */;
}
private final function OnSkillUnequip(skill : ESkill){
var i : Int32;
var skillLevel : Int32;
var isPassive : Bool;
var petard : W3Petard;
var ents : array<CGameplayEntity>;
var mutagens : array<CBaseGameplayEffect>;
var tox : W3Effect_Toxicity;
var names : array<CName>;
var skillName : CName;
var battleTrance : W3Effect_BattleTrance;

if (IsCoreSkill(skill)){
return;
}
isPassive = theGame.GetDefinitionsManager().AbilityHasTag(skills
[skill].abilityName, theGame.params.SKILL_GLOBAL_PASSIVE_TAG);
i = 0;
while (i < skills[skill].level){
if (isPassive){
owner.RemoveAbility(skills[skill].abilityName);
} else {
skillAbilities.Remove(skills[skill].abilityName)
;
}
i += 1;
}
if (GetSkillPathType(skill) == 1){
owner.RemoveAbilityMultiple('sword_adrenalinegain', GetS
killLevel(skill));
}
if (GetSkillPathType(skill) == 2){
owner.RemoveAbilityMultiple('magic_staminaregen', GetSki
llLevel(skill));
}
if (GetSkillPathType(skill) == 3){
owner.RemoveAbilityMultiple('alchemy_potionduration', Ge
tSkillLevel(skill));
}
if (skill == 47){
(W3YrdenEntity)GetWitcherPlayer().GetSignEntity(1).Skill
Unequipped(skill);
} else if (skill == 43){
owner.RemoveAbility(GetSkillAbilityName(43));
} else if (skill == 61){
owner.RemoveEffect(GetWitcherPlayer().GetSkillBonusPotio
nEffect(), /* NOP */);
} else if (skill == 70){
mutagens = GetWitcherPlayer().GetDrunkMutagens();
if (mutagens.Size() > 0){
charStats.RemoveAbilityMultiple(GetSkillAbilityN
ame(70), GetSkillLevel(skill));
}
} else if (skill == 77){
owner.RemoveBuff(37, /* NOP */, /* NOP */);
} else if (skill == 72 && owner.HasBuff(21)){
tox = (W3Effect_Toxicity)owner.GetBuff(21, /* NOP */);
tox.RecalcEffectValue();
} else if (skill == 75){
names = GetWitcherPlayer().GetAlchemyRecipes();
skillName = SkillEnumToName(75);
i = 0;
while (i < names.Size()){
charStats.RemoveAbility(skillName);
i += 1;
}
} else if (skill == 28){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(4));
} else if (skill == 65){
skillLevel = GetSkillLevel(65);
i = 0;
while (i < skillLevel){

thePlayer.SkillReduceBombAmmoBonus();
i += 1;
}
} else if (skill == 87){
thePlayer.ChangeAlchemyItemsAbilities(false);
} else if (skill == 76){
MutagensSyngergyBonusProcess(false, GetSkillLevel(skill)
);
} else if (skill == 80){
SetPerk01Abilities(false, false);
} else if (skill == 84){
SetPerkArmorBonus(84, false);
} else if (skill == 85){
SetPerkArmorBonus(85, false);
} else if (skill == 86){
SetPerkArmorBonus(86, false);
} else if (skill == 90){
battleTrance = (W3Effect_BattleTrance)owner.GetBuff(48,
/* NOP */);
if (battleTrance){
battleTrance.OnPerk11Unequipped();
}
}
if (GetSkillPathType(skill) == 3){
GetWitcherPlayer().RecalcPotionsDurations();
}
if (CanUseSkill(76)){
MutagensSyngergyBonusProcess(true, GetSkillLevel(76));
}
/* NOP */;
}
private final function SetPerkArmorBonus(skill : ESkill, enable : Bool){
var item : SItemUniqueId;
var armors : array<SItemUniqueId>;
var light : Int32;
var medium : Int32;
var heavy : Int32;
var i : Int32;
var cnt : Int32;
var armorType : EArmorType;
var witcher : W3PlayerWitcher;
if (skill != 84 && skill != 85 && skill != 86){
return;
}
witcher = GetWitcherPlayer();
armors.Resize(4);
if (witcher.inv.GetItemEquippedOnSlot(3, item)){
armors[0] = item;
}
if (witcher.inv.GetItemEquippedOnSlot(4, item)){
armors[1] = item;
}
if (witcher.inv.GetItemEquippedOnSlot(5, item)){
armors[2] = item;
}
if (witcher.inv.GetItemEquippedOnSlot(6, item)){
armors[3] = item;
}
light = 0;
medium = 0;

heavy = 0;
i = 0;
while (i < armors.Size()){
armorType = witcher.inv.GetArmorType(armors[i]);
if (armorType == 1){
light += 1;
} else if (armorType == 2){
medium += 1;
} else if (armorType == 3){
heavy += 1;
}
i += 1;
}
if (skill == 84){
cnt = light;
} else if (skill == 85){
cnt = medium;
} else {
cnt = heavy;
}
if (cnt > 0){
UpdatePerkArmorBonus(skill, enable, cnt);
}
/* NOP */;
}
public final function UpdatePerkArmorBonus(skill : ESkill, enable : Bool
, count : Int32){
var abilityName : CName;
abilityName = GetSkillAbilityName(skill);
if (count == 0){
count = 1;
}
if (enable){
charStats.AddAbilityMultiple(abilityName, count);
} else {
charStats.RemoveAbilityMultiple(abilityName, count);
}
/* NOP */;
}
public final function SetPerk01Abilities(enableDay : Bool, enableNight :
Bool){
var abilityName : CName;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var abs : array<CName>;
var enable : Bool;
abilityName = GetSkillAbilityName(80);
dm = theGame.GetDefinitionsManager();
dm.GetContainedAbilities(abilityName, abs);
i = 0;
while (i < abs.Size()){
if (dm.AbilityHasTag(abs[i], 'Day')){
enable = enableDay;
} else {
enable = enableNight;
}
if (enable){
charStats.AddAbility(abs[i], false);
} else {
charStats.RemoveAbility(abs[i]);

}
i += 1;
}
/* NOP */;
}
private final function OnSkillEquippedLevelChange(skill : ESkill, prevLe
vel : Int32, currLevel : Int32){
var cnt : Int32;
var i : Int32;
var names : array<CName>;
var skillAbilityName : CName;
var mutagens : array<CBaseGameplayEffect>;
var recipe : SAlchemyRecipe;
var m_alchemyManager : W3AlchemyManager;
var ignorePain : W3Effect_IgnorePain;
if (IsCoreSkill(skill)){
return;
}
if (skill == 65){
if (currLevel < prevLevel){
thePlayer.SkillReduceBombAmmoBonus();
}
} else if (skill == 75){
m_alchemyManager = new W3AlchemyManager in this;
m_alchemyManager.Init(/* NOP */);
names = GetWitcherPlayer().GetAlchemyRecipes();
skillAbilityName = SkillEnumToName(75);
cnt = 0;
i = 0;
while (i < names.Size()){
m_alchemyManager.GetRecipe(names[i], recipe);
if (recipe.cookedItemType != 5 && recipe.cookedI
temType != 0 && recipe.level <= GetSkillLevel(75)){
cnt += 1;
}
i += 1;
}
cnt -= owner.GetAbilityCount(skillAbilityName);
if (cnt > 0){
charStats.AddAbilityMultiple(skillAbilityName, c
nt);
} else if (cnt < 0){
charStats.RemoveAbilityMultiple(skillAbilityName
, -cnt);
}
} else if (skill == 70){
mutagens = GetWitcherPlayer().GetDrunkMutagens();
skillAbilityName = GetSkillAbilityName(70);
if (mutagens.Size() > 0){
charStats.AddAbilityMultiple(skillAbilityName, G
etSkillLevel(skill));
} else {
charStats.RemoveAbilityMultiple(skillAbilityName
, GetSkillLevel(skill));
}
} else if (skill == 76){
if (CanUseSkill(76)){
MutagensSyngergyBonusProcess(false, prevLevel);
MutagensSyngergyBonusProcess(true, currLevel);
}

} else if (skill == 77){


if (owner.HasBuff(37)){
ignorePain = (W3Effect_IgnorePain)owner.GetBuff(
37, /* NOP */);
ignorePain.OnSkillLevelChanged(currLevel - prevL
evel);
}
} else if (skill == 87){
if (currLevel == 3){
thePlayer.ChangeAlchemyItemsAbilities(true);
} else if (currLevel == 2 && prevLevel == 3){
thePlayer.ChangeAlchemyItemsAbilities(false);
}
}
if (GetSkillPathType(skill) == 1){
if (currLevel - prevLevel > 0){
owner.AddAbilityMultiple('sword_adrenalinegain',
currLevel - prevLevel);
} else if (currLevel - prevLevel < 0){
owner.RemoveAbilityMultiple('sword_adrenalinegai
n', currLevel - prevLevel);
}
}
if (GetSkillPathType(skill) == 2){
if (currLevel - prevLevel > 0){
owner.AddAbilityMultiple('magic_staminaregen', c
urrLevel - prevLevel);
} else if (currLevel - prevLevel < 0){
owner.RemoveAbilityMultiple('magic_staminaregen'
, currLevel - prevLevel);
}
}
if (GetSkillPathType(skill) == 3){
if (currLevel - prevLevel > 0){
owner.AddAbilityMultiple('alchemy_potionduration
', currLevel - prevLevel);
} else if (currLevel - prevLevel < 0){
owner.RemoveAbilityMultiple('alchemy_potiondurat
ion', currLevel - prevLevel);
}
}
if (GetSkillPathType(skill) == 3){
GetWitcherPlayer().RecalcPotionsDurations();
}
/* NOP */;
}
public final function CanUseSkill(skill : ESkill) : Bool{
var ind : Int32;
if (!IsSkillEquipped(skill)){
return false;
}
if (skills[skill].level < 1){
return false;
}
if (skills[skill].remainingBlockedTime != 0){
return false;
}
if (theGame.GetDefinitionsManager().IsAbilityDefined(skills[skil
l].abilityName) && charStats.HasAbility(skills[skill].abilityName, /* NOP */)){
return !IsAbilityBlocked(skills[skill].abilityName);

}
return true;
/* NOP */;
}
public final function IsSkillEquipped(skill : ESkill) : Bool{
var i : Int32;
var idx : Int32;
if (IsCoreSkill(skill)){
return true;
}
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].socketedSkill == skill){
return true;
}
i += 1;
}
if (tempSkills.Contains(skill)){
return true;
}
return false;
/* NOP */;
}
public final function GetSkillOnSlot(slotID : Int32, skill : ESkill) : B
ool{
var idx : Int32;
if (slotID > 0 && slotID <= totalSkillSlotsCount){
idx = GetSkillSlotIndex(slotID, true);
if (idx >= 0){
skill = skillSlots[idx].socketedSkill;
return true;
}
}
skill = 0;
return false;
/* NOP */;
}
public final function GetSkillSlots() : array<SSkillSlot>{
return skillSlots;
/* NOP */;
}
public final function GetSkillSlotsCount() : Int32{
return totalSkillSlotsCount;
/* NOP */;
}
public final function IsSkillSlotUnlocked(slotIndex : Int32) : Bool{
if (slotIndex >= 0 && slotIndex < skillSlots.Size()){
return skillSlots[slotIndex].unlocked;
}
return false;
/* NOP */;
}
public final function ResetCharacterDev(){
var i : Int32;
var skillType : ESkill;
i = 0;
while (i < skills.Size()){
skillType = skills[i].skillType;
if (IsCoreSkill(skillType)){
} else {

if (IsSkillEquipped(skillType)){
UnequipSkill(GetSkillSlotID(skillType));
}
skills[i].level = 0;
}
i += 1;
}
i = 0;
while (i < pathPointsSpent.Size()){
pathPointsSpent[i] = 0;
i += 1;
}
/* NOP */;
}
public final function TutorialMutagensUnequipPlayerSkills() : array<STut
orialSavedSkill>{
var savedSkills : array<STutorialSavedSkill>;
var i : Int32;
var slots : array<Int32>;
var equippedSkill : ESkill;
var savedSkill : STutorialSavedSkill;
slots = TutorialGetConnectedSkillsSlotsIDs();
i = 0;
while (i < slots.Size()){
if (GetSkillOnSlot(slots[i], equippedSkill) && equippedS
kill != 0){
savedSkill.skillType = equippedSkill;
savedSkill.skillSlotID = slots[i];
savedSkills.PushBack(savedSkill);
UnequipSkill(slots[i]);
}
i += 1;
}
TutorialUpdateUI();
return savedSkills;
/* NOP */;
}
public final function TutorialMutagensEquipOneGoodSkill(){
var slots : array<Int32>;
slots = TutorialGetConnectedSkillsSlotsIDs();
TutorialSelectAndAddTempSkill(/* NOP */, /* NOP */);
EquipSkill(temporaryTutorialSkills[0].skillType, ArrayFindMinInt
(slots));
TutorialUpdateUI();
/* NOP */;
}
public final function TutorialMutagensEquipOneGoodOneBadSkill(){
var slots : array<Int32>;
TutorialSelectAndAddTempSkill(true, /* NOP */);
slots = TutorialGetConnectedSkillsSlotsIDs();
ArraySortInts(slots);
EquipSkill(temporaryTutorialSkills[1].skillType, slots[1]);
TutorialUpdateUI();
/* NOP */;
}
public final function TutorialMutagensEquipThreeGoodSkills(){
var slots : array<Int32>;
TutorialGetRidOfTempSkill(1);
TutorialSelectAndAddTempSkill(false, 1);
TutorialSelectAndAddTempSkill(false, 2);

slots = TutorialGetConnectedSkillsSlotsIDs();
ArraySortInts(slots);
EquipSkill(temporaryTutorialSkills[1].skillType, slots[1]);
EquipSkill(temporaryTutorialSkills[2].skillType, slots[2]);
TutorialUpdateUI();
/* NOP */;
}
public final function TutorialMutagensCleanupTempSkills(savedEquippedSki
lls : array<STutorialSavedSkill>){
TutorialGetRidOfTempSkill(2);
TutorialGetRidOfTempSkill(1);
TutorialGetRidOfTempSkill(0);
EquipSkill(savedEquippedSkills[0].skillType, savedEquippedSkills
[0].skillSlotID);
EquipSkill(savedEquippedSkills[1].skillType, savedEquippedSkills
[1].skillSlotID);
EquipSkill(savedEquippedSkills[2].skillType, savedEquippedSkills
[2].skillSlotID);
TutorialUpdateUI();
/* NOP */;
}
private final function TutorialGetRidOfTempSkill(tutTempArrIdx : Int32){
var tempSkill : ESkill;
var i : Int32;
var ind : Int32;
tempSkill = temporaryTutorialSkills[tutTempArrIdx].skillType;
if (temporaryTutorialSkills[tutTempArrIdx].wasLearned){
if (!skills[tempSkill].isCoreSkill){
pathPointsSpent[skills[tempSkill].skillPath] = p
athPointsSpent[skills[tempSkill].skillPath] - 1;
}
skills[tempSkill].level = 0;
}
ind = GetSkillSlotID(tempSkill);
if (ind >= 0){
UnequipSkill(ind);
}
temporaryTutorialSkills.EraseFast(tutTempArrIdx);
/* NOP */;
}
private final function TutorialSelectAndAddTempSkill(ofWrongColor : Bool
, index : Int32){
var witcher : W3PlayerWitcher;
var mutagenColor : ESkillColor;
var tempSkill : ESkill;
var tutSkill : STutorialTemporarySkill;
var mutagenItemId : SItemUniqueId;
witcher = GetWitcherPlayer();
witcher.GetItemEquippedOnSlot(22, mutagenItemId);
mutagenColor = witcher.inv.GetSkillMutagenColor(mutagenItemId);
if (!ofWrongColor){
if (mutagenColor == 1){
if (index == 0){
tempSkill = 37;
} else if (index == 1){
tempSkill = 38;
} else if (index == 2){
tempSkill = 39;
}
} else if (mutagenColor == 3){

if (index == 0){
tempSkill = 16;
} else if (index == 1){
tempSkill = 17;
} else if (index == 2){
tempSkill = 18;
}
} else if (mutagenColor == 2){
if (index == 0){
tempSkill = 58;
} else if (index == 1){
tempSkill = 59;
} else if (index == 2){
tempSkill = 60;
}
}
} else if (mutagenColor == 2){
tempSkill = 37;
} else {
tempSkill = 58;
}
if (GetSkillLevel(tempSkill) <= 0){
tempSkills.PushBack(tempSkill);
AddSkill(tempSkill, true);
tutSkill.wasLearned = true;
} else {
tutSkill.wasLearned = false;
}
tutSkill.skillType = tempSkill;
temporaryTutorialSkills.PushBack(tutSkill);
/* NOP */;
}
private final function TutorialGetConnectedSkillsSlotsIDs() : array<Int3
2>{
var i : Int32;
var connectedSkillsGroupID : Int32;
var processedSlots : Int32;
var slots : array<Int32>;
connectedSkillsGroupID = GetSkillGroupIdOfMutagenSlot(22);
i = 0;
while (i < skillSlots.Size()){
if (skillSlots[i].groupID == connectedSkillsGroupID){
slots.PushBack(skillSlots[i].id);
processedSlots += 1;
if (processedSlots == 3){
break;
}
}
i += 1;
}
return slots;
/* NOP */;
}
private final function TutorialUpdateUI(){
(CR4CharacterMenu)(CR4MenuBase)theGame.GetGuiManager().GetRootMe
nu().GetLastChild().UpdateData(false);
/* NOP */;
}
public final function Debug_HAX_UnlockSkillSlot(slotIndex : Int32) : Boo
l{

if (!IsSkillSlotUnlocked(slotIndex)){
skillSlots[slotIndex].unlocked = true;
LogSkills("W3PlayerAbilityManager.Debug_HAX_UnlockSkillS
lot: unlocking skill slot " + slotIndex + " for debug purposes");
return true;
}
return false;
/* NOP */;
}
public final function DBG_SkillSlots(){
var i : Int32;
i = 0;
while (i < skillSlots.Size()){
/* NOP */;
i += 1;
}
/* NOP */;
/* NOP */;
}
}
import abstract class CQuestPhaseBlock{
}
import abstract class CQuestPhaseInputBlock{
}
import abstract class CQuestPhaseOutputBlock{
}
import abstract class CQuestContextDialogBlock{
}
import abstract class CQuestFactsDBChangingBlock{
}
import abstract class CQuestStoryPhaseSetterBlock{
}
import abstract class CQuestFastForwardCommunitiesBlock{
}
import abstract class CQuestEncounterPhaseBlock{
}
import abstract class CQuestEncounterManagerBlock{
}
import abstract class CQuestEncounterActivator{
}
import abstract class CQuestCheckpointBlock{
}
import abstract class CQuestLogicOperationCondition{
}
import abstract class CQuestTriggerCondition{
}

import abstract class CQuestInsideTriggerCondition{


}
import abstract class CQuestEnterTriggerCondition{
}
import abstract class CQuestFactsDBConditionBase{
}
import abstract class CQuestFactsDBCondition{
}
import abstract class CQuestGraphMinigameBlock{
}
import abstract class CQuestFactsDBForbiddenCondition{
}
import abstract class CQuestActorCondition{
}
import abstract class CQuestGameplayEntCondition{
}
import abstract class CQuestManyActorsCondition{
}
import abstract class CQuestNoLivingActorsCondition{
}
import abstract class CQCIsAlive{
}
import abstract class CQCHasAbility{
}
import abstract class CQCHasItem{
}
import abstract class CQCDistanceTo{
}
import abstract class CQCHasItemGE{
}
import abstract class CQCAnimationState{
}
import abstract class CQuestTimeCondition{
}
import abstract class CQuestTimePeriodCondition{
}
import abstract class CQuestWaitForCondition{
}
import abstract class CQuestInteractionCondition{
}

import abstract class CQuestFightCondition{


}
import abstract class CQuestReactionCondition{
}
import abstract class CQuestEngineTimeWaitForCondition{
}
import abstract class CQuestThread{
}
import abstract class CQuestInteractionDialogBlock{
}
import abstract class CActivateStoryPhase{
}
import abstract class CDeactivateSpawnset{
}
import abstract class CQuestTimeManagementBlock{
}
import abstract class CPauseTimeFunction{
}
import abstract class CSetTimeFunction{
}
import abstract class CShiftTimeFunction{
}
import abstract class CQuestTeleportBlock{
}
import abstract class CQuestLookAtBlock{
}
import abstract class CQuestCutsceneCondition{
}
import abstract class CQuestTagsPresenceCondition{
}
import abstract class CQuestScriptBlock{
}
import abstract class CQuestLayersHiderBlock{
}
import abstract class CQuestInterestPointBlock{
}
import abstract class SScriptedActionSerializedState{
}
import abstract class CBaseQuestScriptedActionsBlock{
}

import abstract class CQuestScriptedActionsBlock{


}
import abstract class CQuestPokeScriptedActionsBlock{
}
import abstract class SScriptedActionData{
}
import abstract class SBehTreeExternalListenerPtr{
}
import struct CAIQuestScriptedActionsTree{
}
import abstract class CQuestScriptedDialogBlock{
}
import struct CQuestScriptedCondition{
public function Activate(){
}
public function Deactivate(){
}
public function Evaluate() : Bool{
}
}
import struct IPresetActorLatentAction{
}
import abstract class CCustomBehTreeActorLatentAction{
}
import abstract class CQuestCameraBlock{
}
import abstract class CQuestStaticCameraRunBlock{
}
import abstract class CQuestStaticCameraStopBlock{
}
import abstract class CQuestStaticCameraSwitchBlock{
}
import abstract class CQuestStaticCameraSequenceBlock{
}
import abstract class CQuestDeletionMarkerBlock{
}
import struct CQCActorScriptedCondition{
public function Evaluate(out actor : CActor) : Bool{
}
}
import abstract class CQuestLockNPCBlock{
}
import abstract class CQuestUnlockNPCBlock{

}
import abstract class CVirtualContainerEntity{
}
import abstract class CQuestCharacterCustomizerBlock{
}
import abstract class CCCOpClearInventory{
}
import abstract class CCCOpVirtualContainerOp{
}
import abstract class CCCOpItemsToVirtualContainer{
}
import abstract class CCCOpItemsFromVirtualContainer{
}
import abstract class CCCOpCustomizeInventory{
}
import abstract class CCCOpItemsRemoveMatchingVirtualContainer{
}
import abstract class CCCOpItemsRemoveMatchingTemplate{
}
import abstract class CCCOpPreserveVirtualContainerContents{
}
import abstract class CCCOpRestoreVirtualContainerContents{
}
import abstract class CQuestRealtimeDelayCondition{
}
import abstract class CQuestHiResRealtimeDelayCondition{
}
import abstract class CQuestInCombatCondition{
}
import abstract class CQuestStateChangeRequestResetBlock{
}
import abstract class CQCItemQuantity{
}
import abstract class CQCAttitude{
}
import abstract class CQuestCameraFocusCondition{
}
import abstract class CQuestInputCondition{
}
import abstract class CQuestRewardBlock{

}
import abstract class CExtAnimCutsceneQuestEvent{
}
import abstract class CExtAnimCutsceneResetClothAndDangleEvent{
}
import abstract class CExtAnimCutsceneDisableClothEvent{
}
import abstract class CQuestScenePrepareBlock{
}
import abstract class CCounterUtilityGraphBlock{
}
import abstract class CQuestRandomBlock{
}
import abstract class CQuestContentActivatorBlock{
}
import abstract class CQuestEntityMotionBlock{
}
import abstract class CQuestTestBlock{
}
import abstract class CQuestLogStateBlock{
}
import abstract class CQuestMemoryDumpBlock{
}
import abstract class CQuestPerformGCBlock{
}
import abstract class CQuestWaitForTickBlock{
}
import abstract class SInventoryItemUIData{
//NULL type for isNew
//NULL type for gridPosition
//NULL type for gridSize
}
import abstract class SAbilityAttributeValue{
//NULL type for valueMultiplicative
//NULL type for valueBase
//NULL type for valueAdditive
}
state W3PlayerWitcherStateMeditationWaiting in W3PlayerWitcher extends W3PlayerW
itcherStateMeditationBase{
private const var TARGET_HOURS_PER_MINUTE : Float;
private const var BLEND_TIME_SECONDS_REAL : Float;
private var storedHoursPerMinute : Float;
private var waitStartTime : GameTime;
private var requestedTargetTime : GameTime;

private var abortRequested : Bool;


public function OnEnterState(prevStateName : CName) : Bool{
var requestedTargetHour : Int32;
var fastForward : CGameFastForwardSystem;
fastForward = theGame.GetFastForwardSystem();
fastForward.BeginFastForward(/* NOP */, /* NOP */);
parent.LockEntryFunction(true);
storedHoursPerMinute = theGame.GetHoursPerMinute();
waitStartTime = theGame.GetGameTime();
requestedTargetHour = virtual_parent.GetWaitTargetHour();
if (requestedTargetHour > GameTimeHours(waitStartTime)){
requestedTargetTime = GameTimeCreate(GameTimeDays(waitSt
artTime), requestedTargetHour, 0, 0);
} else {
requestedTargetTime = GameTimeCreate(GameTimeDays(waitSt
artTime) + 1, requestedTargetHour, 0, 0);
}
FactsSet('MeditationWaitStartDay', GameTimeDays(waitStartTime),
/* NOP */);
FactsSet('MeditationWaitStartHour', GameTimeHours(waitStartTime)
, /* NOP */);
FactsSet('MeditationStarted', 1, /* NOP */);
parent.LockEntryFunction(false);
Loop_StupidNameCollision();
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
var fastForward : CGameFastForwardSystem;
fastForward = theGame.GetFastForwardSystem();
fastForward.AllowFastForwardSelfCompletion();
FactsSet('MeditationStarted', 0, /* NOP */);
theGame.SetHoursPerMinute(storedHoursPerMinute);
if (abortRequested){
LatentHackMeditationWaitingAbort();
}
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function LatentHackMeditationWaitingAbort(){
var medd : W3PlayerWitcherStateMeditation;
medd = (W3PlayerWitcherStateMeditation)thePlayer.GetState('Medit
ation');
medd.StopMeditation();
/* NOP */;
}
private entry function Loop_StupidNameCollision(){
var blendInTime : Float;
blendInTime = BlendIn();
if (!abortRequested){
KeepWaiting(theGame.GetGameTime() - waitStartTime);
}
BlendOut(2 * BLEND_TIME_SECONDS_REAL - blendInTime);
theGame.SetHoursPerMinute(storedHoursPerMinute);
if (!abortRequested){
theGame.SetGameTime(requestedTargetTime, false);
}
GetWitcherPlayer().MeditationRestoring(super.FinalHack_GetSimula
teBuffTime());
abortRequested = false;
virtual_parent.PopState(/* NOP */);

virtual_parent.PushState('Meditation');
/* NOP */;
}
private latent function BlendIn() : Float{
var blendStartTime : EngineTime;
var currentEngineTime : EngineTime;
var totalBlendTimeSecsReal : Float;
var blendedHPM : Float;
var halfMeditationTime : GameTime;
blendStartTime = theGame.GetEngineTime();
halfMeditationTime = waitStartTime + GameTimeCreateFromGameSecon
ds(GameTimeToSeconds(requestedTargetTime) - GameTimeToSeconds(waitStartTime) / 2
);
while (true){
currentEngineTime = theGame.GetEngineTime();
totalBlendTimeSecsReal = EngineTimeToFloat(currentEngine
Time - blendStartTime);
if (totalBlendTimeSecsReal >= BLEND_TIME_SECONDS_REAL ||
theGame.GetGameTime() >= halfMeditationTime || abortRequested){
break;
}
blendedHPM = storedHoursPerMinute + TARGET_HOURS_PER_MIN
UTE - storedHoursPerMinute * totalBlendTimeSecsReal / BLEND_TIME_SECONDS_REAL;
blendedHPM = MinF(TARGET_HOURS_PER_MINUTE, blendedHPM);
theGame.SetHoursPerMinute(blendedHPM);
SleepOneFrame();
}
return totalBlendTimeSecsReal;
/* NOP */;
}
private latent function BlendOut(estimatedBlendTimeReal : Float){
var blendStartTime : EngineTime;
var currentEngineTime : EngineTime;
var totalBlendTimeSecsReal : Float;
var blendedHPM : Float;
var currentGameTime : GameTime;
blendStartTime = theGame.GetEngineTime();
while (true){
currentGameTime = theGame.GetGameTime();
currentEngineTime = theGame.GetEngineTime();
totalBlendTimeSecsReal = EngineTimeToFloat(currentEngine
Time - blendStartTime);
if (currentGameTime >= requestedTargetTime){
break;
}
if (abortRequested){
blendedHPM = TARGET_HOURS_PER_MINUTE - 4 * TARGE
T_HOURS_PER_MINUTE - storedHoursPerMinute * totalBlendTimeSecsReal / estimatedBl
endTimeReal;
} else {
blendedHPM = TARGET_HOURS_PER_MINUTE - TARGET_HO
URS_PER_MINUTE - storedHoursPerMinute * totalBlendTimeSecsReal / estimatedBlendT
imeReal;
}
blendedHPM = MaxF(storedHoursPerMinute, blendedHPM);
if (blendedHPM == storedHoursPerMinute){
break;
}
theGame.SetHoursPerMinute(blendedHPM);
SleepOneFrame();

}
/* NOP */;
}
private latent function KeepWaiting(blendTime : GameTime){
var currentTime : GameTime;
var commonMenuRef : CR4CommonMenu;
while (true){
currentTime = theGame.GetGameTime();
if (currentTime + blendTime > requestedTargetTime || abo
rtRequested){
break;
}
if (thePlayer.IsThreatened()){
commonMenuRef = theGame.GetGuiManager().GetCommo
nMenu();
if (commonMenuRef){
commonMenuRef.CloseMenu();
}
}
SleepOneFrame();
}
/* NOP */;
}
public function RequestWaitStop(){
abortRequested = true;
/* NOP */;
}
public function StopRequested(closeUI : Bool){
var medd : W3PlayerWitcherStateMeditation;
RequestWaitStop();
medd = (W3PlayerWitcherStateMeditation)thePlayer.GetState('Medit
ation');
medd.StopRequested(closeUI);
/* NOP */;
}
private final function FinalHack_GetSimulateBuffTime() : Float{
var passedSecondsInGameTime : Float;
var passedSecondsInRealTime : Float;
passedSecondsInGameTime = GameTimeToSeconds(theGame.GetGameTime(
) - waitStartTime);
passedSecondsInRealTime = ConvertGameSecondsToRealTimeSeconds(pa
ssedSecondsInGameTime);
return passedSecondsInRealTime;
/* NOP */;
}
}
import abstract class SAbility{
}
import abstract class SInventoryItem{
}
class IInventoryScriptedListener extends CObject{
public function OnInventoryScriptedEvent(eventType : EInventoryEventType
, itemId : SItemUniqueId, quantity : Int32, fromAssociatedInventory : Bool) : Bo
ol{
}
}

import abstract class CInventoryDefinition{


}
import abstract class CInventoryInitializerRandom{
}
import abstract class CInventoryInitializerUniform{
}
import abstract class SItemSet{
}
import abstract class SItemStat{
}
import abstract class SItemDamageCurve{
}
import abstract class SItemTagModifier{
}
import abstract class SItemParts{
//NULL type for itemName
//NULL type for quantity
}
import abstract class SItemChangedData{
//NULL type for informGui
//NULL type for ids
//NULL type for quantity
}
import abstract class SIngredientCategory{
}
import abstract class SIngredientCategoryElement{
}
import abstract class CItemAnimationSyncToken{
}
import abstract class CLootDefinitionBase{
}
import struct CSelfUpdatingComponent{
import public final function StartTicking();
import public final function StopTicking();
import public final function GetIsTicking() : Bool;
}
import abstract class SItemNameProperty{
//NULL type for itemName
}
import abstract class CExtAnimItemEvent{
}
import abstract class CExtAnimItemEffectEvent{
}

import abstract class CExtAnimItemEffectDurationEvent{


}
import abstract class CExtAnimLookAtEvent{
}
import abstract class CExtAnimItemSyncEvent{
}
import abstract class CExtAnimItemSyncDurationEvent{
}
import abstract class CExtAnimItemSyncWithCorrectionEvent{
}
import abstract class CExtAnimItemAnimationEvent{
}
import abstract class CExtAnimItemBehaviorEvent{
}
import abstract class CExtAnimDropItemEvent{
}
import abstract class CExtAnimReattachItemEvent{
}
state W3PlayerWitcherStateMeditation in W3PlayerWitcher extends W3PlayerWitcherS
tateMeditationBase{
private var meditationPointHeading : Float;
private var meditationHeadingSet : Bool;
private var stopRequested : Bool;
private var isSitting : Bool;
private var closeUIOnStop : Bool;
private var cameraIsLeavingState : Bool;
private var isEntryFunctionLocked : Bool;
private var scheduledGoToWaiting : Bool;
private var changedContext : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
parent.AddAnimEventCallback('OpenUI', 'OnAnimEvent_OpenUI');
super.OnEnterState(prevStateName);
meditationHeadingSet = false;
cameraIsLeavingState = false;
if (prevStateName != 'MeditationWaiting'){
stopRequested = false;
closeUIOnStop = false;
}
thePlayer.OnMeleeForceHolster(true);
thePlayer.OnRangedForceHolster(true, /* NOP */, /* NOP */);
InitState(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
if (nextStateName != 'MeditationWaiting'){
FactsAdd('MeditationWaitFinished', 1, 1);
}
virtual_parent.UnblockAction(1, 'Meditation');
parent.SetBehaviorVariable('MeditateAbort', 0, /* NOP */);
super.OnLeaveState(nextStateName);
/* NOP */;

}
public entry function InitState(prevStateName : CName){
var actionSuccess : Bool;
parent.LockEntryFunction(true);
isEntryFunctionLocked = true;
parent.SetBehaviorVariable('MeditateAbort', 0, /* NOP */);
if (prevStateName != 'MeditationWaiting'){
isSitting = false;
virtual_parent.BlockAllActions('Meditation', true, /* NO
P */, false, /* NOP */, /* NOP */, /* NOP */);
while (!meditationHeadingSet){
Sleep(0.100000);
}
virtual_parent.BlockAction(1, 'Meditation', false, /* NO
P */, /* NOP */);
virtual_parent.OnMeleeForceHolster(true);
virtual_parent.OnRangedForceHolster(true, /* NOP */, /*
NOP */);
virtual_parent.BlockAllActions('Meditation', false, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
virtual_parent.BlockAction(1, 'Meditation', false, /* NO
P */, /* NOP */);
if (!theGame.GetGuiManager().IsAnyMenu()){
changedContext = true;
theInput.StoreContext('Meditation');
} else {
changedContext = false;
}
parent.SetBehaviorVariable('MeditateWithIgnite', 0, /* N
OP */);
actionSuccess = virtual_parent.PlayerStartAction(2, /* N
OP */);
} else {
actionSuccess = true;
if (!stopRequested){
}
}
parent.LockEntryFunction(false);
isEntryFunctionLocked = false;
if (!actionSuccess){
StopRequested(true);
}
if (scheduledGoToWaiting){
scheduledGoToWaiting = false;
virtual_parent.PushState('MeditationWaiting');
} else {
Loop();
}
/* NOP */;
}
public function SetMeditationPointHeading(head : Float){
meditationPointHeading = head;
meditationHeadingSet = true;
/* NOP */;
}
public function IsSitting() : Bool{
return isSitting;
/* NOP */;
}
public function OnAnimEvent_OpenUI(animEventName : CName, animEventType

: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{


var mutagen : CBaseGameplayEffect;
if (!stopRequested){
isSitting = true;
cameraIsLeavingState = false;
if (thePlayer.HasBuff(78)){
mutagen = thePlayer.GetBuff(78, /* NOP */);
thePlayer.RemoveAbilityAll(mutagen.GetAbilityNam
e());
}
theGame.RequestMenuWithBackground('MeditationClockMenu',
'CommonMenu', /* NOP */);
}
/* NOP */;
}
public function StopRequested(closeUI : Bool){
stopRequested = true;
closeUIOnStop = closeUI;
parent.SetBehaviorVariable('MeditateAbort', 1, /* NOP */);
/* NOP */;
}
private entry function Loop(){
while (!stopRequested){
Sleep(0.200000);
}
StopMeditation();
/* NOP */;
}
public latent function StopMeditation(){
var campFire : CLightEntitySimple;
var commonMenuRef : CR4CommonMenu;
cameraIsLeavingState = true;
if (closeUIOnStop){
commonMenuRef = theGame.GetGuiManager().GetCommonMenu();
if (commonMenuRef){
commonMenuRef.CloseMenu();
}
}
parent.SetBehaviorVariable('HasCampfire', 0, /* NOP */);
virtual_parent.PlayerStopAction(2);
if (changedContext){
theInput.RestoreContext('Meditation', false);
}
parent.WaitForBehaviorNodeDeactivation('PlayerActionEnd', 10);
if (parent.GetCurrentStateName() == 'Meditation'){
virtual_parent.PopState(true);
}
/* NOP */;
}
public function MeditationWait(targetHour : Int32){
/* NOP */;
virtual_parent.SetWaitTargetHour(targetHour);
if (!isEntryFunctionLocked){
virtual_parent.PushState('MeditationWaiting');
} else {
scheduledGoToWaiting = true;
}
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl

oat) : Bool{
var rotation : EulerAngles;
rotation = parent.GetWorldRotation();
theGame.GetGameCamera().ChangePivotRotationController('Explorati
on');
theGame.GetGameCamera().ChangePivotDistanceController('Default')
;
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
if (!cameraIsLeavingState){
moveData.pivotRotationController.SetDesiredHeading(rotat
ion.Yaw + 180.000000, 0.100000);
moveData.pivotRotationController.SetDesiredPitch(-15, 0.
300000);
moveData.pivotPositionController.offsetZ = 0.500000;
moveData.pivotDistanceController.SetDesiredDistance(3.80
0000, /* NOP */);
super.OnGameCameraTick(moveData, dt);
return true;
}
return false;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var rotation : EulerAngles;
rotation = parent.GetWorldRotation();
if (cameraIsLeavingState){
moveData.pivotRotationController.SetDesiredHeading(rotat
ion.Yaw, 0.100000);
}
/* NOP */;
}
}
import abstract class SJobTreeExecutionContext{
}
import abstract class SJobTreeSettings{
}
import abstract class CJobTreeFactory{
}
import abstract class CJobActionBase{
}
import abstract class CCommunityFactory{
}
import abstract class CCommunityArea{
}
import abstract class CCommunityAreaTypeDefault{

}
class CR4GlossaryStorybookMenu extends CR4ListBaseMenu{
public var allEntries : array<CJournalStoryBookChapter>;
private var guiManager : CR4GuiManager;
public var bMovieIsPlaying : Bool;
private var m_fxSetTitle : CScriptedFlashFunction;
private var m_fxSetText : CScriptedFlashFunction;
private var m_fxShowModules : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var i : Int32;
var tempEntries : array<CJournalBase>;
var entryTemp : CJournalStoryBookChapter;
var status : EJournalStatus;
super.OnConfigUI();
guiManager = theGame.GetGuiManager();
m_flashModule = GetMenuFlash();
m_fxSetTitle = m_flashModule.GetMemberFlashFunction("setTitle");
m_fxSetText = m_flashModule.GetMemberFlashFunction("setText");
m_fxShowModules = m_flashModule.GetMemberFlashFunction("showModu
les");
m_journalManager.GetActivatedOfType('CJournalStoryBookChapter',
tempEntries);
i = 0;
while (i < tempEntries.Size()){
status = m_journalManager.GetEntryStatus(tempEntries[i])
;
if (status == 1){
entryTemp = (CJournalStoryBookChapter)tempEntrie
s[i];
if (entryTemp){
allEntries.PushBack(entryTemp);
}
}
i += 1;
}
PopulateData();
SelectCurrentModule();
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (bMovieIsPlaying){
OnVideoStopped();
} else {
super.OnCloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
}
/* NOP */;
}
public function UpdateImage(tag : CName){
}
public function OnEntryPress(tag : CName) : Bool{
var pageEntry : CJournalStoryBookPage;
var descEntry : CJournalStoryBookPageDescription;
var descEntries : array<CJournalBase>;
var str : String;
var menuSprite : CScriptedFlashSprite;
var i : Int32;

pageEntry = (CJournalStoryBookPage)m_journalManager.GetEntryByTa
g(tag);
if (pageEntry){
m_journalManager.GetActivatedChildren(pageEntry, descEnt
ries);
i = descEntries.Size() - 1;
while (i >= 0){
descEntry = (CJournalStoryBookPageDescription)de
scEntries[i];
if (descEntry){
str = "storybook/" + descEntry.GetVideoF
ilename();
break;
}
i -= 1;
}
}
guiManager.PlayFlashbackVideoAsync(str, /* NOP */);
menuSprite = m_parentMenu.GetMenuFlash();
menuSprite.SetVisible(false);
m_fxShowModules.InvokeSelfOneArg(FlashArgBool(false));
bMovieIsPlaying = true;
/* NOP */;
}
public function OnVideoStopped() : Bool{
var guiManager : CR4GuiManager;
guiManager = theGame.GetGuiManager();
guiManager.CancelFlashbackVideo();
/* NOP */;
}
public function ShowMenuAgain(){
m_fxShowModules.InvokeSelfOneArg(FlashArgBool(true));
/* NOP */;
}
public function SetMovieIsPlaying(value : Bool){
bMovieIsPlaying = value;
/* NOP */;
}
private function PopulateData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var i : Int32;
var j : Int32;
var length : Int32;
var l_groupEntry : CJournalStoryBookChapter;
var l_entry : CJournalStoryBookPage;
var l_tempEntries : array<CJournalBase>;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = allEntries.Size();
i = 0;
while (i < length){
l_groupEntry = allEntries[i];
l_GroupTitle = GetLocStringById(l_groupEntry.GetTitleStr
ingId());

l_GroupTag = l_groupEntry.GetUniqueScriptTag();
l_tempEntries.Clear();
m_journalManager.GetActivatedChildren(l_groupEntry, l_te
mpEntries);
j = 0;
while (j < l_tempEntries.Size()){
l_entry = (CJournalStoryBookPage)l_tempEntries[j
];
if (m_journalManager.GetEntryStatus(l_entry) < 1
){
} else {
l_Title = GetLocStringById(l_entry.GetTi
tleStringId());
l_IconPath = "";
l_IsNew = m_journalManager.IsEntryUnread
(l_entry);
l_Tag = l_entry.GetUniqueScriptTag();
l_DataFlashObject = m_flashValueStorage.
CreateTempFlashObject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("ta
g", NameToFlashUInt(l_Tag));
l_DataFlashObject.SetMemberFlashBool("is
New", l_IsNew);
l_DataFlashObject.SetMemberFlashBool("se
lected", l_Tag == currentTag);
l_DataFlashObject.SetMemberFlashString("
label", l_Title);
l_DataFlashObject.SetMemberFlashString("
iconPath", "icons/tutorials/" + l_IconPath);
l_DataFlashArray.PushBackFlashObject(l_D
ataFlashObject);
}
j += 1;
}
i += 1;
}
if (l_DataFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_D
ataFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
public function UpdateDescription(entryName : CName){
var l_entry : CJournalStoryBookPage;
var l_description : CJournalStoryBookPageDescription;
var description : String;
var title : String;
l_entry = (CJournalStoryBookPage)m_journalManager.GetEntryByTag(
entryName);
description = GetDescription(l_entry);
title = GetLocStringById(l_entry.GetTitleStringId());
m_fxSetTitle.InvokeSelfOneArg(FlashArgString(title));
m_fxSetText.InvokeSelfOneArg(FlashArgString(description));
/* NOP */;
}

public function GetDescription(currentStorybookPage : CJournalStoryBookP


age) : String{
var i : Int32;
var str : String;
var locStrId : Int32;
var description : CJournalStoryBookPageDescription;
str = "";
i = 0;
while (i < currentStorybookPage.GetNumChildren()){
description = (CJournalStoryBookPageDescription)currentS
torybookPage.GetChild(i);
if (m_journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();
str += GetLocStringById(locStrId) + "<br>";
}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function UpdateItems(tag : CName){
}
}
import abstract class CCommunityAreaTypeSpawnRadius{
}
class CR4MapMenu extends CR4MenuBase{
private var m_shownArea : EAreaName;
private var m_currentArea : EAreaName;
private var m_discoveredPinsTypes : array<CName>;
private var m_currentPinTypes : array<MappinTypeInfo>;
private var m_fxSetUserMapPinPosition : CScriptedFlashFunction;
private var m_fxSetMapZooms : CScriptedFlashFunction;
private var m_fxSetMapVisibilityBoundaries : CScriptedFlashFunction;
private var m_fxSetMapScrollingBoundaries : CScriptedFlashFunction;
private var m_fxSetMapSettings : CScriptedFlashFunction;
private var m_fxReinitializeMap : CScriptedFlashFunction;
private var m_fxEnableDebugMode : CScriptedFlashFunction;
private var m_fxEnableUnlimitedZoom : CScriptedFlashFunction;
private var m_fxEnableManualLod : CScriptedFlashFunction;
private var m_fxShowBorders : CScriptedFlashFunction;
private var m_fxSetDefaultPosition : CScriptedFlashFunction;
private var m_flashModule : CScriptedFlashSprite;
public var currentTag : CName;
public function OnConfigUI() : Bool{
var initData : W3MapInitData;
m_menuState = 'GlobalMap';
initData = (W3MapInitData)GetMenuInitData();
if (initData){
if (ShouldProcessTutorial('TutorialFastTravelHighlight')
){
if (initData.GetTriggeredExitEntity() || initDat
a.GetUsedFastTravelEntity() || thePlayer.IsOnBoat()){
GameplayFactsAdd("tutorial_fast_travel_o
pen", 1, 1);

}
}
}
super.OnConfigUI();
m_flashModule = GetMenuFlash();
m_fxSetUserMapPinPosition = m_flashModule.GetMemberFlashFunction
("SetUserMapPinPosition");
m_fxSetMapZooms = m_flashModule.GetMemberFlashFunction("SetMapZo
oms");
m_fxSetMapVisibilityBoundaries = m_flashModule.GetMemberFlashFun
ction("SetMapVisibilityBoundaries");
m_fxSetMapScrollingBoundaries = m_flashModule.GetMemberFlashFunc
tion("SetMapScrollingBoundaries");
m_fxSetMapSettings = m_flashModule.GetMemberFlashFunction("SetMa
pSettings");
m_fxReinitializeMap = m_flashModule.GetMemberFlashFunction("Rein
itializeMap");
m_fxEnableDebugMode = m_flashModule.GetMemberFlashFunction("Enab
leDebugMode");
m_fxEnableUnlimitedZoom = m_flashModule.GetMemberFlashFunction("
EnableUnlimitedZoom");
m_fxEnableManualLod = m_flashModule.GetMemberFlashFunction("Enab
leManualLod");
m_fxShowBorders = m_flashModule.GetMemberFlashFunction("ShowBord
ers");
m_fxSetDefaultPosition = m_flashModule.GetMemberFlashFunction("s
etDefaultMapPostion");
Initialize();
UpdateActiveAreas();
SelectCurrentModule();
UpdateCurrentQuestData();
if (!(W3MenuInitData)GetMenuInitData()){
SetMenuState('GlobalMap');
}
/* NOP */;
}
protected function GetSavedDataMenuName() : CName{
return m_menuState;
/* NOP */;
}
public function Initialize(){
var manager : CCommonMapManager;
var worldPath : String;
var currentJournalArea : Int32;
var currentJournalAreaName : String;
manager = theGame.GetCommonMapManager();
worldPath = theGame.GetWorld().GetDepotPath();
m_currentArea = manager.GetAreaFromWorldPath(worldPath, /* NOP *
/);
currentJournalArea = manager.GetCurrentJournalArea();
currentJournalAreaName = AreaTypeToName(currentJournalArea);
GetMenuFlashValueStorage().SetFlashString("worldmap.global.unive
rse.area", currentJournalAreaName, /* NOP */);
UpdateQuestAreas();
SwitchToHubMap(currentJournalArea);
/* NOP */;
}
private function UpdateQuestAreas(){
var manager : CWitcherJournalManager;
var areasWithQuests : array<Int32>;

var i : Int32;
var flashObject : CScriptedFlashObject;
var flashArray : CScriptedFlashArray;
manager = theGame.GetJournalManager();
areasWithQuests = manager.GetJournalAreasWithQuests();
flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < areasWithQuests.Size()){
flashObject = m_flashValueStorage.CreateTempFlashObject(
/* NOP */);
flashObject.SetMemberFlashString("area", AreaTypeToName(
areasWithQuests[i]));
flashArray.PushBackFlashObject(flashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("worldmap.global.universe.ques
tareas", flashArray);
/* NOP */;
}
public function SetMenuState(newState : CName){
SaveStateData();
super.SetMenuState(newState);
/* NOP */;
GetSavedData();
currentTag = UISavedData.selectedTag;
SelectCurrentModule();
UpdateInputFeedback();
/* NOP */;
}
private function UpdateInputFeedback(){
m_defaultInputBindings.Clear();
SetButtons();
/* NOP */;
}
protected function SetMapTitle(mapTitle : String){
GetMenuFlashValueStorage().SetFlashString("map.name.set", mapTit
le, /* NOP */);
/* NOP */;
}
protected function SetCurrentAreaId(areaId : EAreaName){
GetMenuFlashValueStorage().SetFlashInt("map.current.area.id", ar
eaId, /* NOP */);
/* NOP */;
}
public function OnDebugEvent(id : Int32) : Bool{
/* NOP */;
/* NOP */;
}
public function UpdateData(ignoreSelectionChange : Bool){
var l_flashArray : CScriptedFlashArray;
var fastTravelEntiry : CR4FastTravelEntity;
var playerPos : Vector;
var commonMapManager : CCommonMapManager;
playerPos = thePlayer.GetWorldPosition();
commonMapManager = theGame.GetCommonMapManager();
/* NOP */;
fastTravelEntiry = (CR4FastTravelEntity)GetMenuInitData();
l_flashArray = GetMenuFlashValueStorage().CreateTempFlashArray()
;
UpdateEntityPins(l_flashArray, commonMapManager);

UpdateUserMapPin(l_flashArray);
if (IsCurrentAreaShown()){
UpdatePlayerPin(l_flashArray);
}
GetMenuFlashValueStorage().SetFlashNumber("worldmap.player.posZ"
, playerPos.Z, /* NOP */);
/* NOP */;
if (!ignoreSelectionChange){
GetMenuFlashValueStorage().SetFlashArray("worldmap.globa
l.pins.static", l_flashArray);
} else {
GetMenuFlashValueStorage().SetFlashArray("worldmap.globa
l.pins.static.update", l_flashArray);
}
/* NOP */;
OnGetFiltersData();
/* NOP */;
/* NOP */;
}
private function UpdateCurrentQuestData(){
var curQuestData : CScriptedFlashObject;
var currentQuest : CJournalQuest;
var titleStringId : Int32;
currentQuest = theGame.GetJournalManager().GetTrackedQuest();
if (currentQuest){
titleStringId = currentQuest.GetTitleStringId();
curQuestData = m_flashValueStorage.CreateTempFlashObject
(/* NOP */);
curQuestData.SetMemberFlashString("questName", GetLocStr
ingById(titleStringId));
m_flashValueStorage.SetFlashObject("map.quest.name", cur
QuestData, /* NOP */);
}
/* NOP */;
}
private function UpdatePlayerPin(flashArray : CScriptedFlashArray){
var l_flashObject : CScriptedFlashObject;
var position : Vector;
var playerRotation : EulerAngles;
var playerAngle : Float;
var cameraAngle : Float;
position = thePlayer.GetWorldPosition();
cameraAngle = theCamera.GetCameraHeading();
playerRotation = thePlayer.GetWorldRotation();
playerAngle = -playerRotation.Yaw;
if (playerAngle < 0){
playerAngle += 360.000000;
}
l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject
("red.game.witcher3.data.StaticMapPinData");
l_flashObject.SetMemberFlashUInt("id", NameToFlashUInt('Player')
);
l_flashObject.SetMemberFlashNumber("posX", position.X);
l_flashObject.SetMemberFlashNumber("posY", position.Y);
l_flashObject.SetMemberFlashNumber("posZ", position.Z);
l_flashObject.SetMemberFlashBool("enabled", false);
if ((W3ReplacerCiri)thePlayer){
l_flashObject.SetMemberFlashString("description", GetLoc
StringByKeyExt("map_description_player_ciri"));
l_flashObject.SetMemberFlashString("label", GetLocString

ByKeyExt("map_location_player_ciri"));
} else {
l_flashObject.SetMemberFlashString("description", GetLoc
StringByKeyExt("map_description_player"));
l_flashObject.SetMemberFlashString("label", GetLocString
ByKeyExt("map_location_player"));
}
l_flashObject.SetMemberFlashString("type", NameToString('Player'
));
l_flashObject.SetMemberFlashNumber("radius", 0);
l_flashObject.SetMemberFlashBool("isQuest", false);
l_flashObject.SetMemberFlashBool("isPlayer", true);
l_flashObject.SetMemberFlashNumber("rotation", playerAngle);
flashArray.PushBackFlashObject(l_flashObject);
/* NOP */;
}
private function UpdateUserMapPin(flashArray : CScriptedFlashArray){
var manager : CCommonMapManager;
var l_flashObject : CScriptedFlashObject;
var area : Int32;
var position : Vector;
manager = theGame.GetCommonMapManager();
manager.GetUserMapPin(area, position.X, position.Y);
if (area == 8){
area = 4;
}
if (area != m_shownArea){
position.X = -10000;
position.Y = -10000;
}
position.Z = 0;
l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject
("red.game.witcher3.data.StaticMapPinData");
l_flashObject.SetMemberFlashUInt("id", NameToFlashUInt('User'));
l_flashObject.SetMemberFlashNumber("posX", position.X);
l_flashObject.SetMemberFlashNumber("posY", position.Y);
l_flashObject.SetMemberFlashNumber("posZ", position.Z);
l_flashObject.SetMemberFlashBool("enabled", false);
l_flashObject.SetMemberFlashString("description", GetLocStringBy
KeyExt("map_description_user"));
l_flashObject.SetMemberFlashString("label", GetLocStringByKeyExt
("map_location_user"));
l_flashObject.SetMemberFlashString("type", NameToString('User'))
;
l_flashObject.SetMemberFlashNumber("radius", 0);
l_flashObject.SetMemberFlashBool("isQuest", false);
l_flashObject.SetMemberFlashBool("isPlayer", false);
l_flashObject.SetMemberFlashNumber("rotation", 0);
flashArray.PushBackFlashObject(l_flashObject);
/* NOP */;
}
public function ReinitializeMap(){
m_fxReinitializeMap.InvokeSelf();
/* NOP */;
}
public function UpdateActiveAreas(){
var pinsList : array<SAvailableFastTravelMapPin>;
var curPin : SAvailableFastTravelMapPin;
var availableAreas : array<Bool>;
var i : Int32;

i = 0;
while (i < EnumGetMax('EAreaName') + 1){
availableAreas.PushBack(false);
i += 1;
}
pinsList = theGame.GetCommonMapManager().GetFastTravelPoints(tru
e, true, /* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < pinsList.Size()){
curPin = pinsList[i];
availableAreas[curPin.area] = true;
i += 1;
}
m_flashValueStorage.SetFlashBool("universearea.kaermorhen.active
", availableAreas[3], /* NOP */);
m_flashValueStorage.SetFlashBool("universearea.novigrad.active",
availableAreas[1], /* NOP */);
m_flashValueStorage.SetFlashBool("universearea.nomansland.active
", availableAreas[1], /* NOP */);
m_flashValueStorage.SetFlashBool("universearea.wyzima.active", a
vailableAreas[5], /* NOP */);
m_flashValueStorage.SetFlashBool("universearea.prologvillage.act
ive", availableAreas[4], /* NOP */);
m_flashValueStorage.SetFlashBool("universearea.skellige.active",
availableAreas[2], /* NOP */);
/* NOP */;
}
public function UpdateEntityPins(flashArray : CScriptedFlashArray, commo
nMapManager : CCommonMapManager){
var worldPath : String;
var mapPinInstances : array<SCommonMapPinInstance>;
var mapPinInstancesCount : Int32;
var pin : SCommonMapPinInstance;
var i : Int32;
var l_flashObject : CScriptedFlashObject;
var currentPinTag : CName;
var filterCheck : Bool;
var filterType : CName;
var canShowKnownEntities : Bool;
worldPath = commonMapManager.GetWorldPathFromAreaType(m_shownAre
a);
mapPinInstances = commonMapManager.GetMapPinInstances(worldPath)
;
mapPinInstancesCount = mapPinInstances.Size();
canShowKnownEntities = commonMapManager.CanShowKnownEntities();
m_currentPinTypes.Clear();
i = 0;
while (i < mapPinInstancesCount){
pin = mapPinInstances[i];
if (!pin.isDiscovered && !pin.isKnown){
} else if (pin.type == 'NPC' || pin.type == 'Enemy' || p
in.type == 'EnemyDead' || pin.type == 'GenericFocus' || pin.type == 'Rift' || pi
n.type == 'PointOfInterestMappin' || pin.type == 'Teleport'){
} else if (pin.type == 'User'){
} else {
if (thePlayer.IsSailing()){
if (pin.type == 'RoadSign'){
} else {
}
} else if (pin.type == 'Harbor'){

} else {
}
if (pin.visibleType == 'NotDiscoveredPOI' && !ca
nShowKnownEntities){
} else {
if (pin.isDisabled){
filterType = pin.type;
} else {
filterType = pin.visibleType;
}
AddUniquePinTypeFilter(filterType);
filterCheck = CheckFilter(filterType);
if (filterCheck){
l_flashObject = GetMenuFlashValu
eStorage().CreateTempFlashObject("red.game.witcher3.data.StaticMapPinData");
l_flashObject.SetMemberFlashUInt
("id", NameToFlashUInt(pin.tag));
l_flashObject.SetMemberFlashUInt
("areaId", m_shownArea);
l_flashObject.SetMemberFlashNumb
er("posX", pin.position.X);
l_flashObject.SetMemberFlashNumb
er("posY", pin.position.Y);
l_flashObject.SetMemberFlashNumb
er("posZ", pin.position.Z);
l_flashObject.SetMemberFlashUInt
("pinTag", NameToFlashUInt(pin.tag));
l_flashObject.SetMemberFlashUInt
("pinExtraTag", NameToFlashUInt(pin.extraTag));
l_flashObject.SetMemberFlashBool
("enabled", pin.type == 'RoadSign' || pin.type == 'Harbor');
l_flashObject.SetMemberFlashStri
ng("type", NameToString(pin.visibleType));
l_flashObject.SetMemberFlashNumb
er("radius", pin.visibleRadius);
l_flashObject.SetMemberFlashBool
("isQuest", commonMapManager.IsQuestType(pin.type));
l_flashObject.SetMemberFlashBool
("isPlayer", false);
AddPinTypeData(l_flashObject, pi
n);
flashArray.PushBackFlashObject(l
_flashObject);
}
}
}
i += 1;
}
/* NOP */;
}
private function AddPinTypeData(dataObject : CScriptedFlashObject, targe
tPin : SCommonMapPinInstance){
var definitionManager : CDefinitionsManagerAccessor;
var journalManager : CWitcherJournalManager;
var questMappins : array<CJournalBase>;
var questObjectives : array<CJournalBase>;
var curQuestMappin : CJournalQuestMapPin;
var curObjective : CJournalQuestObjective;
var curQuest : CJournalQuest;
var isTracked : Bool;

var label : String;


var description : String;
definitionManager = theGame.GetDefinitionsManager();
label = "";
description = "";
switch(targetPin.visibleType){
case 'StoryQuest':
case 'ChapterQuest':
case 'SideQuest':
case 'MonsterQuest':
case 'TreasureQuest':
case 'QuestReturn':
case 'HorseRace':
case 'BoatRace':
journalManager = theGame.GetJournalManager();
curObjective = (CJournalQuestObjective)journalManager.Ge
tEntryByGuid(targetPin.guid);
if (curObjective){
curQuest = curObjective.GetParentQuest();
label = GetLocStringById(curQuest.GetTitleString
Id());
description = GetLocStringById(curObjective.GetT
itleStringId());
isTracked = journalManager.GetTrackedQuest().gui
d == curQuest.guid;
dataObject.SetMemberFlashUInt("questTag", NameTo
FlashUInt(curQuest.GetUniqueScriptTag()));
dataObject.SetMemberFlashUInt("objectiveTag", Na
meToFlashUInt(curObjective.GetUniqueScriptTag()));
dataObject.SetMemberFlashBool("tracked", isTrack
ed);
dataObject.SetMemberFlashBool("highlighted", tar
getPin.isHighlighted);
}
break;
case 'Horse':
case 'Rift':
case 'Teleport':
case 'QuestAvailable':
case 'MagicLamp':
case 'Whetstone':
case 'Entrance':
case 'NotDiscoveredPOI':
label = GetLocStringByKeyExt(StrLower("map_location_" +
targetPin.visibleType));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_" + targetPin.visibleType));
break;
case 'MonsterNest':
case 'MonsterNestDisabled':
case 'PlaceOfPower':
case 'PlaceOfPowerDisabled':
case 'TreasureHuntMappin':
case 'TreasureHuntMappinDisabled':
case 'SpoilsOfWar':
case 'SpoilsOfWarDisabled':
case 'BanditCamp':
case 'BanditCampDisabled':
case 'BanditCampfire':
case 'BanditCampfireDisabled':

case
case
case
case
case
case
case
case
case
case

'BossAndTreasure':
'BossAndTreasureDisabled':
'Contraband':
'ContrabandDisabled':
'ContrabandShip':
'ContrabandShipDisabled':
'RescuingTown':
'RescuingTownDisabled':
'DungeonCrawl':
'DungeonCrawlDisabled':
label = GetLocStringByKeyExt(StrLower("map_location_" +

targetPin.type));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_" + targetPin.type));
break;
case 'Shopkeeper':
case 'Blacksmith':
case 'Armorer':
case 'Hairdresser':
label = GetLocStringByKeyExt(StrLower("map_location_" +
targetPin.type));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_" + targetPin.type));
break;
case 'Alchemic':
label = GetLocStringByKeyExt(StrLower("map_location_alch
emic"));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_alchemic"));
break;
case 'Herbalist':
label = GetLocStringByKeyExt(StrLower("herbalist"));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_alchemic"));
break;
case 'Innkeeper':
label = GetLocStringById(175619);
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_shopkeeper"));
break;
case 'Prostitute':
label = GetLocStringByKeyExt("novigrad_courtisan");
description = GetLocStringByKeyExt("map_description_pros
titute");
break;
case 'ArmorRepairTable':
label = GetLocStringByKeyExt("map_location_armor_repair_
table");
description = GetLocStringByKeyExt("map_description_armo
r_repair_table");
break;
case 'Herb':
label = GetLocStringByKeyExt(definitionManager.GetItemLo
calisationKeyName(targetPin.tag));
description = GetLocStringByKeyExt(definitionManager.Get
ItemLocalisationKeyDesc(targetPin.tag));
break;
case 'RoadSign':
label = GetLocStringByKeyExt(StrLower("map_location_" +
targetPin.tag));

description = GetLocStringByKeyExt(StrLower("map_descrip
tion_" + targetPin.tag));
break;
case 'NoticeBoard':
case 'NoticeBoardFull':
label = GetLocStringByKeyExt(StrLower("map_location_noti
ceboard"));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_noticeboard"));
break;
case 'Boat':
label = GetLocStringByKeyExt(StrLower("panel_hud_boat"))
;
description = GetLocStringByKeyExt("map_description_play
er_boat");
break;
default:
if (targetPin.customNameId != 0){
label = GetLocStringById(targetPin.customNameId)
;
description = "";
} else {
label = GetLocStringByKeyExt(StrLower("map_locat
ion_" + targetPin.visibleType));
description = GetLocStringByKeyExt(StrLower("map
_description_" + targetPin.visibleType));
}
break;
}
dataObject.SetMemberFlashString("label", label);
dataObject.SetMemberFlashString("description", description);
/* NOP */;
}
public function OnPinch(value : Float) : Bool{
/* NOP */;
/* NOP */;
}
public function OnClosingMenu() : Bool{
var initData : W3MapInitData;
SaveStateData();
theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
initData = (W3MapInitData)GetMenuInitData();
if (initData){
if (initData && initData.GetTriggeredExitEntity()){
thePlayer.OnTeleportPlayerToPlayableArea(true);
}
}
super.OnClosingMenu();
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
CloseMenu();
/* NOP */;
}
public function SaveStateData(){
switch(m_menuState){

case 'Objectives':
case 'FastTravel':
m_guiManager.UpdateUISavedData(m_menuState, UISavedData.
openedCategories, currentTag, UISavedData.selectedModule, /* NOP */, /* NOP */);
break;
case 'GlobalMap':
return;
}
/* NOP */;
}
public function OnSwitchToWorldMap() : Bool{
/* NOP */;
SetMapTitle(GetLocStringByKeyExt("panel_map_title_worldmap"));
UpdateInputFeedback();
/* NOP */;
}
public function OnSwitchToHubMap(areaName : String) : Bool{
var areaType : EAreaName;
areaType = AreaNameToType(areaName);
SwitchToHubMap(areaType);
/* NOP */;
}
public function OnGetMappointData(pinTag : CName) : Bool{
}
private function AddUniquePinTypeFilter(pinType : CName){
var len : Int32;
var i : Int32;
var isPinExist : Bool;
var curPinData : MappinTypeInfo;
if (pinType == 'Waypoint' || pinType == 'StoryQuest' || pinType
== 'ChapterQuest' || pinType == 'SideQuest' || pinType == 'MonsterQuest' || pinT
ype == 'TreasureQuest'){
return;
}
if (pinType == 'NoticeBoardFull'){
pinType = 'NoticeBoard';
}
if (!m_discoveredPinsTypes.Contains(pinType)){
m_discoveredPinsTypes.PushBack(pinType);
}
len = m_currentPinTypes.Size();
i = 0;
while (i < len){
if (m_currentPinTypes[i].type == pinType){
m_currentPinTypes[i].amount = m_currentPinTypes[
i].amount + 1;
m_currentPinTypes[i].visible = !IsPinFilterDisab
led(pinType);
isPinExist = true;
break;
}
i += 1;
}
if (!isPinExist){
curPinData.type = pinType;
curPinData.amount = 1;
curPinData.visible = !IsPinFilterDisabled(pinType);
m_currentPinTypes.PushBack(curPinData);
}
/* NOP */;

}
private function EnablePinFilter(pinType : CName){
theGame.GetCommonMapManager().SetPinFilterVisible(pinType, true)
;
/* NOP */;
}
private function DisablePinFilter(pinType : CName){
theGame.GetCommonMapManager().SetPinFilterVisible(pinType, false
);
/* NOP */;
}
private function DisableAllPinFilters(exceptions : array<CName>){
var len : Int32;
var i : Int32;
var curPinType : CName;
var manager : CCommonMapManager;
manager = theGame.GetCommonMapManager();
len = m_currentPinTypes.Size();
i = 0;
while (i < len){
curPinType = m_currentPinTypes[i].type;
if (!exceptions.Contains(curPinType)){
manager.SetPinFilterVisible(curPinType, false);
}
i += 1;
}
/* NOP */;
}
private function IsPinFilterDisabled(pinType : CName) : Bool{
return !theGame.GetCommonMapManager().GetPinFilterVisible(pinTyp
e);
/* NOP */;
}
private function CheckFilter(targetType : CName) : Bool{
if (targetType == 'NoticeBoardFull'){
targetType = 'NoticeBoard';
}
return !IsPinFilterDisabled(targetType);
/* NOP */;
}
public function OnGetFiltersData() : Bool{
var currentPinType : MappinTypeInfo;
var filterListGFx : CScriptedFlashArray;
var filterItemGFx : CScriptedFlashObject;
var i : Int32;
var len : Int32;
var label : String;
var description : String;
len = m_currentPinTypes.Size();
filterListGFx = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < len){
currentPinType = m_currentPinTypes[i];
GetPinTypeDescription(currentPinType.type, label, descri
ption);
filterItemGFx = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
filterItemGFx.SetMemberFlashString("label", label);
filterItemGFx.SetMemberFlashString("description", descri
ption);

filterItemGFx.SetMemberFlashString("type", currentPinTyp
e.type);
filterItemGFx.SetMemberFlashUInt("typeId", NameToFlashUI
nt(currentPinType.type));
filterItemGFx.SetMemberFlashBool("enabled", currentPinTy
pe.visible);
filterItemGFx.SetMemberFlashUInt("amount", currentPinTyp
e.amount);
filterListGFx.PushBackFlashObject(filterItemGFx);
i += 1;
}
m_flashValueStorage.SetFlashArray("map.pins.summary", filterList
GFx);
/* NOP */;
}
private function GetPinTypeDescription(pinType : CName, label : String,
description : String){
switch(pinType){
case 'Prostitute':
label = GetLocStringByKeyExt("novigrad_courtisan");
description = GetLocStringByKeyExt("map_description_pros
titute");
break;
case 'ArmorRepairTable':
label = GetLocStringByKeyExt("map_location_armor_repair_
table");
description = GetLocStringByKeyExt("map_description_armo
r_repair_table");
break;
case 'Entrance':
label = GetLocStringByKeyExt("map_location_cave_entrance
");
description = GetLocStringByKeyExt("map_description_cave
_entrance");
break;
case 'Innkeeper':
label = GetLocStringById(175619);
description = GetLocStringByKeyExt("map_description_shop
keeper");
break;
case 'Herbalist':
label = GetLocStringByKeyExt(StrLower("herbalist"));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_alchemic"));
break;
case 'Boat':
label = GetLocStringByKeyExt(StrLower("panel_hud_boat"))
;
description = GetLocStringByKeyExt("map_description_play
er_boat");
break;
default:
label = GetLocStringByKeyExt(StrLower("map_location_" +
pinType));
description = GetLocStringByKeyExt(StrLower("map_descrip
tion_" + pinType));
break;
}
/* NOP */;
}

public function OnUpdateFilter(pinType : CName, enabled : Bool) : Bool{


if (enabled){
EnablePinFilter(pinType);
} else {
DisablePinFilter(pinType);
}
UpdateData(true);
/* NOP */;
}
public function OnRequestFastTravelData() : Bool{
requestFastTravelData();
/* NOP */;
}
public function OnRequestObjectivesMappins() : Bool{
requestObjectivesMappins();
/* NOP */;
}
private function requestFastTravelData(){
var manager : CCommonMapManager;
var pinsList : array<SAvailableFastTravelMapPin>;
var curPin : SAvailableFastTravelMapPin;
var l_flashObject : CScriptedFlashObject;
var l_flashArray : CScriptedFlashArray;
var i : Int32;
var initData : W3MapInitData;
var isSailing : Bool;
var areaName : CName;
manager = theGame.GetCommonMapManager();
isSailing = false;
initData = (W3MapInitData)GetMenuInitData();
if (initData){
isSailing = initData.GetIsSailing();
}
pinsList = manager.GetFastTravelPoints(true, true, isSailing, !i
sSailing, /* NOP */);
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < pinsList.Size()){
curPin = pinsList[i];
if (m_currentArea == 8 && curPin.area != 8){
} else if (m_currentArea != 8 && curPin.area == 8){
} else {
areaName = manager.GetLocalisationNameFromAreaTy
pe(curPin.area);
l_flashObject = m_flashValueStorage.CreateTempFl
ashObject(/* NOP */);
l_flashObject.SetMemberFlashUInt("id", NameToFla
shUInt(curPin.tag));
l_flashObject.SetMemberFlashUInt("areaId", curPi
n.area);
l_flashObject.SetMemberFlashUInt("pinTag", NameT
oFlashUInt(curPin.tag));
l_flashObject.SetMemberFlashString("tag", curPin
.tag);
l_flashObject.SetMemberFlashString("area", AreaT
ypeToName(curPin.area));
l_flashObject.SetMemberFlashString("label", GetL
ocStringByKeyExt(StrLower("map_location_" + curPin.tag)));
l_flashObject.SetMemberFlashBool("selected", cur
rentTag == curPin.tag);

l_flashObject.SetMemberFlashString("description"
, GetLocStringByKeyExt(StrLower("map_description_" + curPin.tag)));
l_flashObject.SetMemberFlashString("enabled", cu
rPin.type);
l_flashObject.SetMemberFlashString("dropDownLabe
l", GetLocStringByKeyExt(areaName));
l_flashObject.SetMemberFlashUInt("dropDownTag",
NameToFlashUInt(areaName));
l_flashObject.SetMemberFlashBool("dropDownOpened
", IsCategoryOpened(areaName));
l_flashArray.PushBackFlashObject(l_flashObject);
}
i += 1;
}
m_flashValueStorage.SetFlashArray("map.pins.list", l_flashArray)
;
/* NOP */;
}
private function requestObjectivesMappins(){
var l_flashArray : CScriptedFlashArray;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
GetQuestMappins(l_flashArray);
m_flashValueStorage.SetFlashArray("map.pins.list", l_flashArray)
;
/* NOP */;
}
protected function GetQuestMappins(flashArray : CScriptedFlashArray){
var journalManager : CWitcherJournalManager;
var currentQuest : CJournalQuest;
var currentPhase : CJournalQuestPhase;
var currentObjective : CJournalQuestObjective;
var questsList : array<CJournalBase>;
var questPinsList : array<SCommonMapPinInstance>;
var questsCount : Int32;
var qIdx : Int32;
var phaseCount : Int32;
var pIdx : Int32;
var objCount : Int32;
var oIdx : Int32;
var currentAreaId : Int32;
var worldPath : String;
var setSelection : Bool;
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
journalManager = theGame.GetJournalManager();
journalManager.GetActivatedOfType('CJournalQuest', questsList);
questsCount = questsList.Size();
qIdx = 0;
while (qIdx < questsCount){
currentQuest = (CJournalQuest)questsList[qIdx];
if (currentQuest && journalManager.GetEntryStatus(curren
tQuest) == 1){
if (currentAreaId == m_currentArea && !setSelect
ion){
setSelection = true;
InsertQuestMappinGroup(flashArray, curre
ntQuest, true);
} else {
InsertQuestMappinGroup(flashArray, curre
ntQuest, false);

}
phaseCount = currentQuest.GetNumChildren();
pIdx = 0;
while (pIdx < phaseCount){
currentPhase = (CJournalQuestPhase)curre
ntQuest.GetChild(pIdx);
if (currentPhase){
objCount = currentPhase.GetNumCh
ildren();
oIdx = 0;
while (oIdx < objCount){
currentObjective = (CJou
rnalQuestObjective)currentPhase.GetChild(oIdx);
if (currentObjective &&
journalManager.GetEntryStatus(currentObjective) == 1){
currentAreaId =
currentObjective.GetWorld();
worldPath = mapM
anager.GetWorldPathFromAreaType(currentAreaId);
questPinsList =
mapManager.GetMapPinInstances(worldPath);
InsertQuestObjec
tiveMappins(flashArray, currentQuest, currentObjective, questPinsList, currentAr
eaId);
}
oIdx += 1;
}
}
pIdx += 1;
}
}
qIdx += 1;
}
/* NOP */;
}
protected function InsertQuestMappinGroup(targetContainer : CScriptedFla
shArray, targetQuest : CJournalQuest, selected : Bool){
var journalManager : CWitcherJournalManager;
var tmpGFxObject : CScriptedFlashObject;
var questStatus : EJournalStatus;
var questAreaId : Int32;
var questArea : String;
var questTitle : String;
var questTag : CName;
var groupTag : CName;
var isActive : Bool;
var isTracked : Bool;
var isStory : Bool;
journalManager = theGame.GetJournalManager();
questAreaId = targetQuest.GetWorld();
groupTag = GetAreaName(questAreaId);
questArea = GetLocStringByKeyExt(groupTag);
questTitle = GetLocStringById(targetQuest.GetTitleStringId());
questTag = targetQuest.GetUniqueScriptTag();
questStatus = journalManager.GetEntryStatus(targetQuest);
isActive = journalManager.GetEntryStatus(targetQuest) == 1;
isTracked = journalManager.GetTrackedQuest().guid == targetQuest
.guid;
isStory = targetQuest.GetType() == 0;
tmpGFxObject = m_flashValueStorage.CreateTempFlashObject(/* NOP

*/);
tmpGFxObject.SetMemberFlashUInt("tag", NameToFlashUInt(questTag)
);
tmpGFxObject.SetMemberFlashUInt("areaId", questAreaId);
tmpGFxObject.SetMemberFlashUInt("status", questStatus);
tmpGFxObject.SetMemberFlashBool("selected", questTag == currentT
ag);
tmpGFxObject.SetMemberFlashString("dropDownLabel", questArea);
tmpGFxObject.SetMemberFlashUInt("dropDownTag", NameToFlashUInt(g
roupTag));
tmpGFxObject.SetMemberFlashBool("dropDownOpened", IsCategoryOpen
ed(groupTag));
tmpGFxObject.SetMemberFlashString("label", questTitle);
tmpGFxObject.SetMemberFlashBool("tracked", isActive && isTracked
);
tmpGFxObject.SetMemberFlashBool("isStory", isStory);
tmpGFxObject.SetMemberFlashBool("isGroupItem", true);
targetContainer.PushBackFlashObject(tmpGFxObject);
/* NOP */;
}
protected function InsertQuestObjectiveMappins(targetContainer : CScript
edFlashArray, targetQuest : CJournalQuest, targetObjective : CJournalQuestObject
ive, commonMappins : array<SCommonMapPinInstance>, area : Int32){
var journalManager : CWitcherJournalManager;
var currentMappin : CJournalQuestMapPin;
var objStatus : EJournalStatus;
var objectiveGFxObject : CScriptedFlashObject;
var mappinsGFxObject : CScriptedFlashObject;
var mappinsGFxArray : CScriptedFlashArray;
var currentLabel : String;
var pinsCount : Int32;
var pinIdx : Int32;
var objTag : CName;
var isTracked : Bool;
var isTrackable : Bool;
var highlightedObjective : CJournalQuestObjective;
journalManager = theGame.GetJournalManager();
highlightedObjective = journalManager.GetHighlightedObjective();
objectiveGFxObject = m_flashValueStorage.CreateTempFlashObject(/
* NOP */);
mappinsGFxArray = m_flashValueStorage.CreateTempFlashArray();
currentLabel = GetLocStringById(targetObjective.GetTitleStringId
());
objStatus = journalManager.GetEntryStatus(targetObjective);
objTag = targetObjective.GetUniqueScriptTag();
isTracked = highlightedObjective == targetObjective;
objectiveGFxObject.SetMemberFlashUInt("tag", NameToFlashUInt(obj
Tag));
objectiveGFxObject.SetMemberFlashInt("status", objStatus);
objectiveGFxObject.SetMemberFlashString("label", currentLabel);
objectiveGFxObject.SetMemberFlashString("dropDownLabel", GetArea
Name(area));
objectiveGFxObject.SetMemberFlashBool("isGroupItem", false);
objectiveGFxObject.SetMemberFlashBool("tracked", isTracked);
pinsCount = targetObjective.GetNumChildren();
pinIdx = 0;
while (pinIdx < pinsCount){
currentMappin = (CJournalQuestMapPin)targetObjective.Get
Child(pinIdx);
if (currentMappin){

mappinsGFxObject = GetQuestMappinData(currentMap
pin.GetMapPinID(), commonMappins);
if (mappinsGFxObject){
mappinsGFxObject.SetMemberFlashString("l
abel", GetLocStringById(targetQuest.GetTitleStringId()));
mappinsGFxObject.SetMemberFlashString("d
escription", GetLocStringById(targetObjective.GetTitleStringId()));
mappinsGFxObject.SetMemberFlashUInt("are
aId", area);
mappinsGFxObject.SetMemberFlashString("a
rea", GetLocStringByKeyExt(GetAreaName(area)));
mappinsGFxArray.PushBackFlashObject(mapp
insGFxObject);
}
}
pinIdx += 1;
}
objectiveGFxObject.SetMemberFlashArray("mappinsList", mappinsGFx
Array);
targetContainer.PushBackFlashObject(objectiveGFxObject);
/* NOP */;
}
protected function GetQuestMappinData(mapPinTag : CName, commonMappins :
array<SCommonMapPinInstance>) : CScriptedFlashObject{
var tmpGFxObject : CScriptedFlashObject;
var curPin : SCommonMapPinInstance;
var pinsCount : Int32;
var i : Int32;
pinsCount = commonMappins.Size();
i = 0;
while (i < pinsCount){
curPin = commonMappins[i];
if (curPin.tag == mapPinTag){
tmpGFxObject = m_flashValueStorage.CreateTempFla
shObject(/* NOP */);
tmpGFxObject.SetMemberFlashUInt("id", NameToFlas
hUInt(curPin.tag));
tmpGFxObject.SetMemberFlashUInt("pinTag", NameTo
FlashUInt(curPin.tag));
tmpGFxObject.SetMemberFlashString("tag", curPin.
tag);
return tmpGFxObject;
}
i += 1;
}
return NULL;
/* NOP */;
}
public function GetAreaDefaultPosition(areaId : Int32, x : Float, y : Fl
oat){
switch(areaId){
case 1:
x = -150;
y = 450;
break;
default:
x = -1;
y = -1;
}
/* NOP */;

}
public function GetAreaName(areaId : Int32) : CName{
var l_questArea : CName;
switch(areaId){
case 0:
l_questArea = 'panel_journal_filters_area_any';
break;
case 1:
l_questArea = 'panel_journal_filters_area_no_mans_land';
break;
case 2:
l_questArea = 'panel_journal_filters_area_skellige';
break;
case 3:
l_questArea = 'panel_journal_filters_area_kaer_morhen';
break;
case 4:
l_questArea = 'panel_journal_filters_area_prolgue_villag
e';
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
}
return l_questArea;
/* NOP */;
}
public function OnHighlightObjective(tag : CName) : Bool{
var l_objective : CJournalQuestObjective;
var journalManager : CWitcherJournalManager;
journalManager = theGame.GetJournalManager();
l_objective = (CJournalQuestObjective)journalManager.GetEntryByT
ag(tag);
if (l_objective && journalManager.GetEntryStatus(l_objective) ==
1){
journalManager.SetHighlightedObjective(l_objective);
}
/* NOP */;
}
public function OnTrackQuest(tag : CName) : Bool{
var journalManager : CWitcherJournalManager;
var l_quest : CJournalBase;
journalManager = theGame.GetJournalManager();
l_quest = journalManager.GetEntryByTag(tag);
journalManager.SetTrackedQuest(l_quest);
/* NOP */;
}
public function SwitchToHubMap(area : EAreaName){
var manager : CCommonMapManager;
var journalArea : EAreaName;
var originArea : EAreaName;
manager = theGame.GetCommonMapManager();
originArea = area;

if (area == 0){
return;
}
if (area == 9 || area == 1){
if (m_currentArea == 1){
journalArea = manager.GetCurrentJournalArea();
} else {
journalArea = area;
}
area = 1;
} else {
journalArea = area;
}
SetMapTitle(GetLocStringByKeyExt(manager.GetLocalisationNameFrom
AreaType(journalArea)));
SetCurrentAreaId(area);
UpdateInputFeedback();
if (area == m_shownArea){
UpdateDefaultPosition(originArea);
ReinitializeMap();
} else {
m_shownArea = area;
UpdateDefaultPosition(originArea);
UpdateTitle();
UpdateMapSettings();
UpdateData(/* NOP */);
}
/* NOP */;
}
public function OnEntrySelected(tag : CName) : Bool{
/* NOP */;
currentTag = tag;
/* NOP */;
}
public function OnSwitchToInterior() : Bool{
/* NOP */;
/* NOP */;
}
public function OnUserMapPinSet(posX : Float, posY : Float) : Bool{
var manager : CCommonMapManager;
var worldPath : String;
var realShownArea : EAreaName;
var position : Vector;
manager = theGame.GetCommonMapManager();
if (m_currentArea == m_shownArea){
worldPath = theGame.GetWorld().GetDepotPath();
realShownArea = manager.GetAreaFromWorldPath(worldPath,
true);
} else {
realShownArea = m_shownArea;
}
position.X = posX;
position.Y = posY;
position.Z = 0;
if (manager.ToggleUserMapPin(realShownArea, position)){
m_fxSetUserMapPinPosition.InvokeSelfThreeArgs(FlashArgBo
ol(true), FlashArgNumber(posX), FlashArgNumber(posY));
theSound.SoundEvent("gui_hubmap_mark_pin");
} else {
m_fxSetUserMapPinPosition.InvokeSelfThreeArgs(FlashArgBo

ol(false), FlashArgNumber(0), FlashArgNumber(0));


}
/* NOP */;
}
public function OnStaticMapPinUsed(pinTag : CName, areaId : Int32) : Boo
l{
var initData : W3MapInitData;
var manager : CCommonMapManager;
var fastTravelEntity : W3FastTravelEntity;
var loadingInitData : W3MenuInitData;
var contentTag : CName;
var progress : Float;
var rootMenu : CR4Menu;
manager = theGame.GetCommonMapManager();
manager = theGame.GetCommonMapManager();
if (!manager){
return false;
}
if (!manager.IsWorldAvailable(areaId)){
contentTag = manager.GetWorldContentTag(areaId);
progress = theGame.ProgressToContentAvailable(contentTag
);
theSound.SoundEvent("gui_global_denied");
theGame.GetGuiManager().ShowProgressDialog(0, "", "panel
_map_cannot_travel_downloading_content", true, 0, progress, 1, contentTag);
return false;
}
if (!thePlayer.IsActionAllowed(5)){
showNotification(GetLocStringByKeyExt("panel_hud_message
_actionnotallowed"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
if (!manager.DBG_IsAllowedFT()){
if (thePlayer.IsSailing()){
initData = (W3MapInitData)GetMenuInitData();
if (initData && initData.GetTriggeredExitEntity(
)){
initData.SetTriggeredExitEntity(false);
}
} else {
initData = (W3MapInitData)GetMenuInitData();
if (!initData){
showNotification(GetLocStringByKeyExt("p
anel_map_cannot_travel"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
fastTravelEntity = (W3FastTravelEntity)initData.
GetUsedFastTravelEntity();
if (fastTravelEntity && fastTravelEntity.entityN
ame == pinTag){
showNotification(GetLocStringByKeyExt("p
anel_map_cannot_travel_already_here"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
return false;
}
if (initData.GetTriggeredExitEntity()){
initData.SetTriggeredExitEntity(false);
}

}
}
manager.UseMapPin(pinTag, true);
if (areaId == -1){
areaId == m_shownArea;
}
if (m_currentArea == areaId){
manager.PerformLocalFastTravelTeleport(pinTag);
theGame.SetGameTime(theGame.GetGameTime() + GameTimeCrea
te(0, RoundF(RandF() * 4), RoundF(RandF() * 60), RoundF(RandF() * 60)), true);
} else {
manager.PerformGlobalFastTravelTeleport(m_shownArea, pin
Tag);
theGame.SetGameTime(theGame.GetGameTime() + GameTimeCrea
te(0, RoundF(RandF() * 10), RoundF(RandF() * 60), RoundF(RandF() * 60)), true);
}
theGame.Unpause("menus");
rootMenu = theGame.GetGuiManager().GetRootMenu();
if (rootMenu){
rootMenu.CloseMenu();
}
return true;
/* NOP */;
}
public function UpdateTitle(){
GetMenuFlashValueStorage().SetFlashString("worldmap.title.set",
GetMapTitle(), -1);
/* NOP */;
}
private function UpdateDefaultPosition(areaId : Int32){
var defX : Float;
var defY : Float;
GetAreaDefaultPosition(areaId, defX, defY);
m_fxSetDefaultPosition.InvokeSelfTwoArgs(FlashArgNumber(defX), F
lashArgNumber(defY));
/* NOP */;
}
private function UpdateMapSettings(){
var mapSize : Float;
var tileCount : Int32;
var textureSize : Int32;
var imagePath : String;
var minLod : Int32;
var maxLod : Int32;
var vminX : Int32;
var vmaxX : Int32;
var vminY : Int32;
var vmaxY : Int32;
var sminX : Int32;
var smaxX : Int32;
var sminY : Int32;
var smaxY : Int32;
var minZoom : Float;
var maxZoom : Float;
var zoom12 : Float;
var zoom23 : Float;
var zoom34 : Float;
mapSize = StringToFloat(theGame.minimapSettings.GetValueAt(1, m_
shownArea), /* NOP */);
tileCount = StringToInt(theGame.minimapSettings.GetValueAt(2, m_

shownArea), /* NOP */);


textureSize = StringToInt(theGame.minimapSettings.GetValueAt(5,
m_shownArea), /* NOP */);
minLod = StringToInt(theGame.minimapSettings.GetValueAt(6, m_sho
wnArea), /* NOP */);
maxLod = StringToInt(theGame.minimapSettings.GetValueAt(7, m_sho
wnArea), /* NOP */);
vminX = StringToInt(theGame.minimapSettings.GetValueAt(11, m_sho
wnArea), /* NOP */);
vmaxX = StringToInt(theGame.minimapSettings.GetValueAt(12, m_sho
wnArea), /* NOP */);
vminY = StringToInt(theGame.minimapSettings.GetValueAt(13, m_sho
wnArea), /* NOP */);
vmaxY = StringToInt(theGame.minimapSettings.GetValueAt(14, m_sho
wnArea), /* NOP */);
sminX = StringToInt(theGame.minimapSettings.GetValueAt(15, m_sho
wnArea), /* NOP */);
smaxX = StringToInt(theGame.minimapSettings.GetValueAt(16, m_sho
wnArea), /* NOP */);
sminY = StringToInt(theGame.minimapSettings.GetValueAt(17, m_sho
wnArea), /* NOP */);
smaxY = StringToInt(theGame.minimapSettings.GetValueAt(18, m_sho
wnArea), /* NOP */);
minZoom = StringToFloat(theGame.minimapSettings.GetValueAt(19, m
_shownArea), /* NOP */);
maxZoom = StringToFloat(theGame.minimapSettings.GetValueAt(20, m
_shownArea), /* NOP */);
zoom12 = StringToFloat(theGame.minimapSettings.GetValueAt(21, m_
shownArea), /* NOP */);
zoom23 = StringToFloat(theGame.minimapSettings.GetValueAt(22, m_
shownArea), /* NOP */);
zoom34 = StringToFloat(theGame.minimapSettings.GetValueAt(23, m_
shownArea), /* NOP */);
imagePath = GetShownMapName();
m_fxSetMapZooms.InvokeSelfFiveArgs(FlashArgNumber(minZoom), Flas
hArgNumber(maxZoom), FlashArgNumber(zoom12), FlashArgNumber(zoom23), FlashArgNum
ber(zoom34));
m_fxSetMapVisibilityBoundaries.InvokeSelfFourArgs(FlashArgInt(vm
inX), FlashArgInt(vmaxX), FlashArgInt(vminY), FlashArgInt(vmaxY));
m_fxSetMapScrollingBoundaries.InvokeSelfFourArgs(FlashArgInt(smi
nX), FlashArgInt(smaxX), FlashArgInt(sminY), FlashArgInt(smaxY));
m_fxSetMapSettings.InvokeSelfSixArgs(FlashArgNumber(mapSize), Fl
ashArgInt(tileCount), FlashArgInt(textureSize), FlashArgInt(minLod), FlashArgInt
(maxLod), FlashArgString(imagePath));
/* NOP */;
}
public function GetShownMapName() : String{
var manager : CCommonMapManager;
manager = theGame.GetCommonMapManager();
return manager.GetMapName(m_shownArea);
/* NOP */;
}
public function GetMapTitle() : String{
var manager : CCommonMapManager;
manager = theGame.GetCommonMapManager();
return manager.GetLocalisationNameFromAreaType(m_shownArea);
/* NOP */;
}
public function IsCurrentAreaShown() : Bool{
return m_currentArea == m_shownArea;

/* NOP */;
}
private function FilterPinsByDuplicateName(pinsArray : array<SCommonMapP
inInstance>) : array<SCommonMapPinInstance>{
var i : Int32;
var j : Int32;
i = 0;
while (i < pinsArray.Size()){
j = pinsArray.Size() - 1;
while (j > i){
if (pinsArray[j].tag == pinsArray[i].tag){
pinsArray.Erase(j);
}
j -= 1;
}
i += 1;
}
return pinsArray;
/* NOP */;
}
public function OnSkipPressed() : Bool{
OnCloseMenu();
/* NOP */;
}
public function OnCategoryOpened(categoryName : CName, opened : Bool) :
Bool{
var i : Int32;
if (categoryName == 'None'){
return false;
}
if (opened){
if (UISavedData.openedCategories.FindFirst(categoryName)
== -1){
UISavedData.openedCategories.PushBack(categoryNa
me);
}
} else {
i = UISavedData.openedCategories.FindFirst(categoryName)
;
if (i > -1){
UISavedData.openedCategories.Erase(i);
}
}
/* NOP */;
}
public function EnableDebugMode(enable : Bool){
m_fxEnableDebugMode.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
public function EnableUnlimitedZoom(enable : Bool){
m_fxEnableUnlimitedZoom.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
public function EnableManualLod(enable : Bool){
m_fxEnableManualLod.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
public function ShowBorders(show : Bool){
m_fxShowBorders.InvokeSelfOneArg(FlashArgBool(show));
/* NOP */;

}
public function PlayOpenSoundEvent(){
}
}
import struct CCommunitySystem{
//NULL type for communitySpawnInitializer
public function Init(){
communitySpawnInitializer = new ISpawnTreeInitializerCommunityAI
in this;
communitySpawnInitializer.Init();
/* NOP */;
}
}
class CR4JournalQuestMenu extends CR4ListBaseMenu{
public var allQuests : array<CJournalQuest>;
public var currentObjectives : array<CJournalQuestObjective>;
public var initialTrackedQuest : CJournalQuest;
public var bDisplayCompleted : Bool;
public var lastSelectedQuestTag : CName;
private var m_fxSetTrackedQuest : CScriptedFlashFunction;
private var m_fxSetTrackedObj : CScriptedFlashFunction;
private var m_fxSetTitle : CScriptedFlashFunction;
private var m_fxSetText : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
UISavedData.selectedTag = m_journalManager.GetTrackedQuest().Get
UniqueScriptTag();
m_initialSelectionsToIgnore = 3;
super.OnConfigUI();
FactsAdd("tutorial_journal_opened", 1, 1);
m_fxSetTrackedQuest = m_flashModule.GetMemberFlashFunction("setC
urrentlyTrackedQuest");
m_fxSetTrackedObj = m_flashModule.GetMemberFlashFunction("setCur
rentlyTrackedObjective");
m_fxSetTitle = m_flashModule.GetMemberFlashFunction("setTitle");
m_fxSetText = m_flashModule.GetMemberFlashFunction("setText");
GetQuests();
PopulateData();
SelectCurrentModule();
UpdateTrackedQuest();
/* NOP */;
}
protected function UpdateTrackedQuest(){
var l_objective : CJournalQuestObjective;
var l_objectiveProgress : String;
var l_objectiveTitle : String;
var l_trackedQuest : CJournalQuest;
l_objective = m_journalManager.GetHighlightedObjective();
l_trackedQuest = m_journalManager.GetTrackedQuest();
if (l_objective){
l_objectiveProgress = "";
if (l_objective.GetCount() > 0){
l_objectiveProgress = " " + m_journalManager.Get
QuestObjectiveCount(l_objective.guid) + "/" + l_objective.GetCount();
}
l_objectiveTitle = GetLocStringById(l_objective.GetTitle
StringId()) + l_objectiveProgress;
m_fxSetTrackedObj.InvokeSelfOneArg(FlashArgString(l_obje
ctiveTitle));

}
if (l_trackedQuest){
m_fxSetTrackedQuest.InvokeSelfOneArg(FlashArgString(GetL
ocStringById(l_trackedQuest.GetTitleStringId())));
}
/* NOP */;
}
public function GetQuests(){
var tempQuests : array<CJournalBase>;
var questTemp : CJournalQuest;
var i : Int32;
m_journalManager.GetActivatedOfType('CJournalQuest', tempQuests)
;
initialTrackedQuest = m_journalManager.GetTrackedQuest();
i = 0;
while (i < tempQuests.Size()){
questTemp = (CJournalQuest)tempQuests[i];
if (questTemp){
allQuests.PushBack(questTemp);
}
i += 1;
}
/* NOP */;
}
public function OnObjectiveRead(tag : CName) : Bool{
var l_objective : CJournalBase;
l_objective = m_journalManager.GetEntryByTag(tag);
m_journalManager.SetEntryUnread(l_objective, false);
UpdateObjectives(currentTag);
/* NOP */;
}
public function OnObjectiveSelected(_ObjectiveID : CName) : Bool{
}
public function OnTrackQuest(tag : CName) : Bool{
var l_quest : CJournalBase;
var oldTrackedQuest : CJournalQuest;
var l_questStatus : EJournalStatus;
l_quest = m_journalManager.GetEntryByTag(tag);
l_questStatus = m_journalManager.GetEntryStatus(l_quest);
if (l_questStatus == 1){
oldTrackedQuest = m_journalManager.GetTrackedQuest();
m_journalManager.SetTrackedQuest(l_quest);
HighlightAnyObjective(l_quest);
OnPlaySoundEvent("gui_journal_track_quest");
UpdateTwoQuests(oldTrackedQuest, (CJournalQuest)l_quest)
;
}
UpdateTrackedQuest();
/* NOP */;
}
protected function HighlightAnyObjective(targetEntry : CJournalBase){
var l_objective : CJournalQuestObjective;
var l_questPhase : CJournalQuestPhase;
var trackedQuest : CJournalQuest;
var i : Int32;
var j : Int32;
var l_objectiveStatus : EJournalStatus;
trackedQuest = (CJournalQuest)targetEntry;
if (trackedQuest){
if (m_journalManager.GetHighlightedObjective().GetParent

Quest() != trackedQuest){
i = 0;
while (i < trackedQuest.GetNumChildren()){
l_questPhase = (CJournalQuestPhase)track
edQuest.GetChild(i);
if (l_questPhase){
j = 0;
while (j < l_questPhase.GetNumCh
ildren()){
l_objective = (CJournalQ
uestObjective)l_questPhase.GetChild(j);
l_objectiveStatus = m_jo
urnalManager.GetEntryStatus(l_objective);
if (l_objectiveStatus ==
1){
m_journalManager
.SetHighlightedObjective(l_objective);
UpdateObjectives
(trackedQuest.GetUniqueScriptTag());
return;
}
j += 1;
}
}
i += 1;
}
}
}
/* NOP */;
}
public function OnEntrySelected(tag : CName) : Bool{
var questEntry : CJournalQuest;
if (tag){
super.OnEntrySelected(tag);
questEntry = (CJournalQuest)m_journalManager.GetEntryByT
ag(tag);
if (questEntry && tag != lastSelectedQuestTag){
lastSelectedQuestTag = tag;
UpdateObjectives(tag);
}
}
/* NOP */;
}
public function OnHighlightObjective(tag : CName) : Bool{
var l_objective : CJournalQuestObjective;
var parentQuest : CJournalBase;
var l_questStatus : EJournalStatus;
var oldTrackedQuest : CJournalQuest;
l_objective = (CJournalQuestObjective)m_journalManager.GetEntryB
yTag(tag);
if (l_objective && m_journalManager.GetEntryStatus(l_objective)
== 1){
if (m_journalManager.GetHighlightedObjective() != l_obje
ctive){
parentQuest = l_objective.GetParentQuest();
if (parentQuest){
l_questStatus = m_journalManager.GetEntr
yStatus(parentQuest);
if (l_questStatus == 1){
oldTrackedQuest = m_journalManag

er.GetTrackedQuest();
m_journalManager.SetTrackedQuest
(parentQuest);
UpdateTwoQuests(oldTrackedQuest,
(CJournalQuest)parentQuest);
}
}
m_journalManager.SetHighlightedObjective(l_objec
tive);
OnPlaySoundEvent("gui_journal_track_quest");
UpdateTrackedQuest();
}
}
/* NOP */;
}
public function UpdateImage(tag : CName){
}
private function UpdateTwoQuests(questOne : CJournalQuest, questTwo : CJ
ournalQuest){
var l_questsFlashArray : CScriptedFlashArray;
l_questsFlashArray = m_flashValueStorage.CreateTempFlashArray();
l_questsFlashArray.PushBackFlashObject(generateFlashObjectForQue
st(questOne));
l_questsFlashArray.PushBackFlashObject(generateFlashObjectForQue
st(questTwo));
if (l_questsFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_q
uestsFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
}
/* NOP */;
}
private function PopulateData(){
var l_questsFlashArray : CScriptedFlashArray;
var i : Int32;
var length : Int32;
var l_quest : CJournalQuest;
var l_questIsTracked : Bool;
var l_questIsSelected : Bool;
var l_questStatus : EJournalStatus;
var l_Tag : CName;
var questLevel : Int32;
l_questsFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = allQuests.Size();
i = 0;
while (i < length){
l_quest = allQuests[i];
l_questStatus = m_journalManager.GetEntryStatus(l_quest)
;
if (l_questStatus != 0){
l_questsFlashArray.PushBackFlashObject(generateF
lashObjectForQuest(l_quest));
l_questIsTracked = m_journalManager.GetTrackedQu
est().guid == l_quest.guid && l_questStatus == 1;
l_Tag = l_quest.GetUniqueScriptTag();
if (l_questIsTracked || l_questIsSelected){
OnEntrySelected(l_Tag);
}
}

i += 1;
}
if (l_questsFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_q
uestsFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
private function generateFlashObjectForQuest(targetQuest : CJournalQuest
) : CScriptedFlashObject{
var l_questsDataFlashObject : CScriptedFlashObject;
var l_questStatus : EJournalStatus;
var j : Int32;
var iterQuestLevels : Int32;
var questLevelsCount : Int32;
var questCount : Int32;
var questLevel : Int32;
var lvlDiff : Int32;
var l_questWorld : Int32;
var l_Tag : CName;
var l_GroupTag : CName;
var l_questType : Int32;
var l_questIsNew : Bool;
var l_areaTag : String;
var l_questTitle : String;
var l_dropdownLabel : String;
var questName : String;
var difficultyColor : String;
var l_questIsTracked : Bool;
var currentArea : EAreaName;
var questLevels : C2dArray;
questLevelsCount = theGame.questLevelsContainer.Size();
currentArea = theGame.GetCommonMapManager().GetCurrentJournalAre
a();
l_questStatus = m_journalManager.GetEntryStatus(targetQuest);
l_Tag = targetQuest.GetUniqueScriptTag();
l_GroupTag = GetAreaName(targetQuest);
l_questTitle = GetLocStringById(targetQuest.GetTitleStringId());
l_questType = targetQuest.GetType();
l_questIsNew = m_journalManager.IsEntryUnread(targetQuest);
l_questIsTracked = m_journalManager.GetTrackedQuest().guid == ta
rgetQuest.guid && l_questStatus == 1;
l_dropdownLabel = "";
questName = "";
iterQuestLevels = 0;
while (iterQuestLevels < questLevelsCount){
questLevels = theGame.questLevelsContainer[iterQuestLeve
ls];
questCount = questLevels.GetNumRows();
j = 0;
while (j < questCount){
questName = questLevels.GetValueAtAsName(0, j);
if (questName == targetQuest.baseName){
questLevel = NameToInt(questLevels.GetVa
lueAtAsName(1, j));

if (FactsQuerySum("NewGamePlus") > 0){


questLevel += theGame.params.Get
NewGamePlusLevel();
}
}
j += 1;
}
iterQuestLevels += 1;
}
lvlDiff = questLevel - thePlayer.GetLevel();
if (lvlDiff >= theGame.params.LEVEL_DIFF_HIGH && ShouldProcessTu
torial('TutorialHighLevelQuests')){
GameplayFactsAdd("tut_high_level_quest", /* NOP */, /* N
OP */);
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(GetM
enuName());
}
if (lvlDiff >= theGame.params.LEVEL_DIFF_DEADLY){
difficultyColor = "<font color='#E02626'>";
} else if (lvlDiff >= theGame.params.LEVEL_DIFF_HIGH){
difficultyColor = "<font color='#D95050'>";
} else if (lvlDiff > -theGame.params.LEVEL_DIFF_HIGH){
difficultyColor = "<font color='#76E376'>";
} else {
difficultyColor = "<font color='#969696'>";
}
if (l_GroupTag != 'None'){
l_areaTag = "<font color='#7A7A7A'>" + GetLocStringByKey
Ext(l_GroupTag) + " | </font>";
} else {
l_areaTag = "";
}
if (questName != "" && questLevel > 1){
l_areaTag = l_areaTag + difficultyColor + GetLocStringBy
KeyExt('panel_item_required_level') + " " + questLevel + "</font>";
} else {
l_areaTag = l_areaTag + GetLocStringByKeyExt(l_GroupTag)
;
}
l_questWorld = targetQuest.GetWorld();
if (l_questStatus == 1){
switch(l_questType){
case 0:
case 1:
l_dropdownLabel = GetLocStringByKeyExt("panel_jo
urnal_queststatus_story");
break;
case 2:
l_dropdownLabel = GetLocStringByKeyExt("panel_jo
urnal_queststatus_side");
break;
case 3:
l_dropdownLabel = GetLocStringByKeyExt("panel_jo
urnal_legend_monsterhunt");
break;
case 4:
l_dropdownLabel = GetLocStringByKeyExt("panel_jo
urnal_legend_treasurehunt");
break;
}

} else if (l_questStatus == 2){


l_dropdownLabel = GetLocStringByKeyExt("panel_journal_le
gend_succed");
} else if (l_questStatus == 3){
l_dropdownLabel = GetLocStringByKeyExt("panel_journal_le
gend_failed");
}
l_questsDataFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
if (l_Tag == 'None'){
/* NOP */;
}
l_questsDataFlashObject.SetMemberFlashUInt("tag", NameToFlashUIn
t(l_Tag));
l_questsDataFlashObject.SetMemberFlashString("dropDownLabel", l_
dropdownLabel);
l_questsDataFlashObject.SetMemberFlashUInt("dropDownTag", NameTo
FlashUInt(l_GroupTag));
l_questsDataFlashObject.SetMemberFlashBool("dropDownOpened", IsC
ategoryOpened(l_GroupTag));
l_questsDataFlashObject.SetMemberFlashInt("isStory", l_questType
);
l_questsDataFlashObject.SetMemberFlashString("iconPath", GetQues
tIconByType(targetQuest.GetType()));
l_questsDataFlashObject.SetMemberFlashBool("isNew", l_questIsNew
);
l_questsDataFlashObject.SetMemberFlashInt("questWorld", l_questW
orld);
l_questsDataFlashObject.SetMemberFlashInt("curWorld", currentAre
a);
l_questsDataFlashObject.SetMemberFlashBool("selected", l_Tag ==
currentTag);
l_questsDataFlashObject.SetMemberFlashInt("status", l_questStatu
s);
l_questsDataFlashObject.SetMemberFlashBool("tracked", l_questIsT
racked);
l_questsDataFlashObject.SetMemberFlashString("label", l_questTit
le);
l_questsDataFlashObject.SetMemberFlashString("secondLabel", l_ar
eaTag);
return l_questsDataFlashObject;
/* NOP */;
}
public function GetQuestIconByType(type : eQuestType) : String{
var retStr : String;
retStr = "icons/quests/";
switch(type){
case 0:
retStr += "story.png";
break;
case 1:
retStr += "chapter.png";
break;
case 2:
retStr += "side.png";
break;
case 3:
retStr += "monsterhunt.png";
break;
case 4:

retStr += "treasurehunt.png";
break;
}
return retStr;
/* NOP */;
}
public function UpdateObjectives(tag : CName){
var l_objectivesTotal : Int32;
var l_questObjectivesFlashArray : CScriptedFlashArray;
var l_questObjectiveDataFlashObject : CScriptedFlashObject;
var l_objective : CJournalQuestObjective;
var questEntry : CJournalQuest;
var l_questPhase : CJournalQuestPhase;
var l_objectiveStatus : EJournalStatus;
var l_objectiveTitle : String;
var l_objectiveProgress : String;
var l_objectiveIsNew : Bool;
var l_objectiveIsTracked : Bool;
var l_objectiveTag : CName;
var i : Int32;
var j : Int32;
var locID : Int32;
var l_objectiveOrder : Int32;
var l_phaseOrder : Int32;
var highlightedObjective : CJournalQuestObjective;
if (m_initialSelectionsToIgnore == 0){
m_initialSelectionsToIgnore = 1;
}
l_questObjectivesFlashArray = m_flashValueStorage.CreateTempFlas
hArray();
questEntry = (CJournalQuest)m_journalManager.GetEntryByTag(tag);
if (!questEntry){
return;
}
highlightedObjective = m_journalManager.GetHighlightedObjective(
);
i = 0;
while (i < questEntry.GetNumChildren()){
l_questPhase = (CJournalQuestPhase)questEntry.GetChild(i
);
if (l_questPhase){
l_phaseOrder = l_questPhase.GetOrder();
j = 0;
while (j < l_questPhase.GetNumChildren()){
l_objective = (CJournalQuestObjective)l_
questPhase.GetChild(j);
l_objectiveStatus = m_journalManager.Get
EntryStatus(l_objective);
if (l_objectiveStatus != 0){
l_questObjectiveDataFlashObject
= m_flashValueStorage.CreateTempFlashObject(/* NOP */);
l_objectiveProgress = "";
if (l_objective.GetCount() > 0){
l_objectiveProgress = "
" + m_journalManager.GetQuestObjectiveCount(l_objective.guid) + "/" + l_objectiv
e.GetCount();
}
l_objectiveTitle = GetLocStringB
yId(l_objective.GetTitleStringId());
l_objectiveIsNew = m_journalMana

ger.IsEntryUnread(l_objective);
l_objectiveIsTracked = highlight
edObjective == l_objective;
l_objectiveOrder = l_objective.G
etOrder();
l_objectiveTag = l_objective.Get
UniqueScriptTag();
l_questObjectiveDataFlashObject.
SetMemberFlashUInt("tag", NameToFlashUInt(l_objectiveTag));
l_questObjectiveDataFlashObject.
SetMemberFlashBool("isNew", l_objectiveIsNew);
l_questObjectiveDataFlashObject.
SetMemberFlashBool("tracked", l_objectiveIsTracked);
l_questObjectiveDataFlashObject.
SetMemberFlashBool("isLegend", false);
l_questObjectiveDataFlashObject.
SetMemberFlashInt("status", l_objectiveStatus);
l_questObjectiveDataFlashObject.
SetMemberFlashString("label", l_objectiveTitle + l_objectiveProgress);
l_questObjectiveDataFlashObject.
SetMemberFlashInt("phaseIndex", l_phaseOrder);
l_questObjectiveDataFlashObject.
SetMemberFlashInt("objectiveIndex", l_objectiveOrder);
l_questObjectivesFlashArray.Push
BackFlashObject(l_questObjectiveDataFlashObject);
}
j += 1;
}
}
i += 1;
}
locID = questEntry.GetTitleStringId();
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBLIST, l_q
uestObjectivesFlashArray);
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_SUBLIST + "
.questname", GetLocStringById(locID), /* NOP */);
/* NOP */;
}
public function GetAreaName(questEntry : CJournalQuest) : CName{
var l_questArea : CName;
switch(questEntry.GetWorld()){
case 0:
l_questArea = 'panel_journal_filters_area_any';
break;
case 1:
l_questArea = 'panel_journal_filters_area_no_mans_land';
break;
case 2:
l_questArea = 'panel_journal_filters_area_skellige';
break;
case 3:
l_questArea = 'panel_journal_filters_area_kaer_morhen';
break;
case 4:
l_questArea = 'panel_journal_filters_area_prolgue_villag
e';
break;
case 5:
l_questArea = 'panel_journal_filters_area_wyzima';
break;

case 6:
l_questArea = 'panel_journal_filters_area_island_of_myst
';
break;
case 7:
l_questArea = 'panel_journal_filters_area_spiral';
break;
case 8:
l_questArea = 'panel_journal_filters_area_prolgue_villag
e';
break;
case 9:
l_questArea = 'panel_journal_filters_area_velen';
break;
}
return l_questArea;
/* NOP */;
}
public function GetDescription(currentQuest : CJournalQuest) : String{
var i : Int32;
var currentIndex : Int32;
var str : String;
var locStrId : Int32;
var placedString : Bool;
var currentJournalDescriptionText : JournalDescriptionText;
var journalDescriptionArray : array<JournalDescriptionText>;
var descriptionsGroup : CJournalQuestDescriptionGroup;
var tmpGroup : CJournalQuestDescriptionGroup;
var description : CJournalQuestDescriptionEntry;
var tempStr : String;
var tempStr2 : String;
str = "";
i = 0;
while (i < currentQuest.GetNumChildren()){
tmpGroup = (CJournalQuestDescriptionGroup)currentQuest.G
etChild(i);
if (tmpGroup){
descriptionsGroup = tmpGroup;
break;
}
i += 1;
}
i = 0;
while (i < descriptionsGroup.GetNumChildren()){
description = (CJournalQuestDescriptionEntry)description
sGroup.GetChild(i);
if (m_journalManager.GetEntryStatus(description) != 0){
currentJournalDescriptionText.stringKey = descri
ption.GetDescriptionStringId();
currentJournalDescriptionText.order = descriptio
n.GetOrder();
currentJournalDescriptionText.groupOrder = descr
iptionsGroup.GetOrder();
currentJournalDescriptionText.currentEntry = des
cription;
if (journalDescriptionArray.Size() == 0){
journalDescriptionArray.PushBack(current
JournalDescriptionText);
} else {
placedString = false;

currentIndex = 0;
while (currentIndex < journalDescription
Array.Size()){
if (journalDescriptionArray[curr
entIndex].groupOrder > currentJournalDescriptionText.groupOrder || journalDescri
ptionArray[currentIndex].groupOrder <= currentJournalDescriptionText.groupOrder
&& journalDescriptionArray[currentIndex].order > currentJournalDescriptionText.o
rder){
journalDescriptionArray.
Insert(Max(0, currentIndex), currentJournalDescriptionText);
placedString = true;
break;
}
currentIndex += 1;
}
if (!placedString){
journalDescriptionArray.PushBack
(currentJournalDescriptionText);
}
}
}
i += 1;
}
i = 0;
while (i < journalDescriptionArray.Size()){
str += GetLocStringById(journalDescriptionArray[i].strin
gKey) + "<br>";
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function UpdateDescription(entryName : CName){
var l_quest : CJournalQuest;
var description : String;
var title : String;
l_quest = (CJournalQuest)m_journalManager.GetEntryByTag(entryNam
e);
description = GetDescription(l_quest);
title = GetLocStringById(l_quest.GetTitleStringId());
m_fxSetTitle.InvokeSelfOneArg(FlashArgString(title));
m_fxSetText.InvokeSelfOneArg(FlashArgString(description));
/* NOP */;
}
public function UpdateItems(tag : CName){
var itemsFlashArray : CScriptedFlashArray;
var l_quest : CJournalQuest;
var rewards : array<CName>;
l_quest = (CJournalQuest)m_journalManager.GetEntryByTag(tag);
return;
rewards = m_journalManager.GetQuestRewards(l_quest);
if (rewards.Size() < 1){
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", false, /* NOP */);
return;
}

m_flashValueStorage.SetFlashBool("journal.rewards.panel.visible"
, true, /* NOP */);
itemsFlashArray = CreateRewards(rewards);
if (itemsFlashArray){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBL
IST + ".reward.items", itemsFlashArray);
}
/* NOP */;
}
private function CreateRewards(rewards : array<CName>) : CScriptedFlashA
rray{
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var i : Int32;
var experience : Int32;
var money : Int32;
var rewrd : SReward;
var moneyItem : SItemReward;
var dm : CDefinitionsManagerAccessor;
var items : array<SItemReward>;
var multiplier : Float;
dm = theGame.GetDefinitionsManager();
experience = 0;
money = 0;
itemsNames.Clear();
i = 0;
while (i < rewards.Size()){
if (theGame.GetReward(rewards[i], rewrd)){
multiplier = thePlayer.GetRewardMultiplier(rewar
ds[i]);
money += rewrd.gold * multiplier;
experience += rewrd.experience;
AppendArrayOfItemRewards(items, rewrd.items);
}
i += 1;
}
if (money > 0){
moneyItem.item = 'Orens';
moneyItem.amount = money;
items.PushBack(moneyItem);
}
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < items.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", i + 1);
l_flashObject.SetMemberFlashInt("quantity", items[i].amo
unt);
l_flashObject.SetMemberFlashString("iconPath", dm.GetIte
mIconPath(items[i].item));
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");

l_flashArray.PushBackFlashObject(l_flashObject);
itemsNames.PushBack(items[i].item);
i += 1;
}
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_SUBLIST + "
.items.experience", IntToString(experience), /* NOP */);
return l_flashArray;
/* NOP */;
}
public function OnGetItemData(item : Int32, compareItemType : Int32) : B
ool{
var itemName : String;
var category : CName;
var typeStr : String;
var weight : Float;
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
item = item - 1;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
itemName = dm.GetItemLocalisationKeyName(itemsNames[item]);
itemName = GetLocStringByKeyExt(itemName);
resultData.SetMemberFlashString("ItemName", itemName);
resultData.SetMemberFlashString("PriceValue", dm.GetItemPrice(it
emsNames[item]));
category = dm.GetItemCategory(itemsNames[item]);
if (dm.ItemHasTag(itemsNames[item], 'Quest') || dm.ItemHasTag(it
emsNames[item], 'AlchemyIngredient') || dm.ItemHasTag(itemsNames[item], 'Craftin
gIngredient') || dm.ItemHasTag(itemsNames[item], 'Potion') || dm.ItemHasTag(item
sNames[item], 'SilverOil') || dm.ItemHasTag(itemsNames[item], 'SteelOil') || cat
egory == 'petard' || category == 'bolt'){
weight = 0;
} else {
weight = 1;
}
resultData.SetMemberFlashString("WeightValue", NoTrailZeros(weig
ht));
resultData.SetMemberFlashString("ItemRarity", "");
typeStr = GetItemCategoryLocalisedString(category);
resultData.SetMemberFlashString("ItemType", typeStr);
resultData.SetMemberFlashString("DurabilityValue", "");
resultData.SetMemberFlashString("IconPath", dm.GetItemIconPath(i
temsNames[item]));
resultData.SetMemberFlashString("ItemCategory", category);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
private function AppendArrayOfItemRewards(first : array<SItemReward>, se
cond : array<SItemReward>){
var i : Int32;
var s : Int32;
s = second.Size();
i = 0;
while (i < s){
first.PushBack(second[i]);
i += 1;

}
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
class CR4AlchemyMenu extends CR4ListBaseMenu{
private var m_alchemyManager : W3AlchemyManager;
private var m_recipeList : array<SAlchemyRecipe>;
private var m_definitionsManager : CDefinitionsManagerAccessor;
private var bCouldCraft : Bool;
protected var _inv : CInventoryComponent;
private var _playerInv : W3GuiPlayerInventoryComponent;
private var m_fxSetCraftingEnabled : CScriptedFlashFunction;
private var m_fxSetCraftedItem : CScriptedFlashFunction;
private var m_fxHideContent : CScriptedFlashFunction;
public var itemsQuantity : array<Int32>;
public function OnConfigUI() : Bool{
var commonMenu : CR4CommonMenu;
super.OnConfigUI();
m_initialSelectionsToIgnore = 2;
_inv = thePlayer.GetInventory();
m_definitionsManager = theGame.GetDefinitionsManager();
_playerInv = new W3GuiPlayerInventoryComponent in this;
_playerInv.Initialize(_inv);
m_alchemyManager = new W3AlchemyManager in this;
m_alchemyManager.Init(/* NOP */);
m_recipeList = m_alchemyManager.GetRecipes(false);
m_fxSetCraftedItem = m_flashModule.GetMemberFlashFunction("setCr
aftedItem");
m_fxSetCraftingEnabled = m_flashModule.GetMemberFlashFunction("s
etCraftingEnabled");
m_fxHideContent = m_flashModule.GetMemberFlashFunction("hideCont
ent");
commonMenu = (CR4CommonMenu)m_parentMenu;
bCouldCraft = true;
m_fxSetCraftingEnabled.InvokeSelfOneArg(FlashArgBool(bCouldCraft
));
PopulateData();
SelectFirstModule();
/* NOP */;
}
public function OnClosingMenu() : Bool{
super.OnClosingMenu();
theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
/* NOP */;
}
public function OnCloseMenu() : Bool{
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.ChildRequestCloseMenu();
}
theSound.SoundEvent('gui_global_quit');
CloseMenu();
/* NOP */;
}
public function OnEntryRead(tag : CName) : Bool{

}
public function OnStartCrafting() : Bool{
OnPlaySoundEvent("gui_alchemy_brew");
/* NOP */;
}
public function OnCraftItem(tag : CName) : Bool{
CreateItem(FindRecipieID(tag));
/* NOP */;
}
public function OnEntryPress(tag : CName) : Bool{
}
public function OnEntrySelected(tag : CName) : Bool{
var uiState : W3TutorialManagerUIHandlerStateAlchemy;
if (tag != 'None'){
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(true));
super.OnEntrySelected(tag);
} else {
lastSentTag = 'None';
currentTag = 'None';
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(false));
}
if (ShouldProcessTutorial('TutorialAlchemySelectRecipe')){
uiState = (W3TutorialManagerUIHandlerStateAlchemy)theGam
e.GetTutorialSystem().uiHandler.GetCurrentState();
if (uiState){
uiState.SelectedRecipe(tag, m_alchemyManager.Can
CookRecipe(tag) == 0);
}
}
/* NOP */;
}
public function OnShowCraftedItemTooltip(tag : CName) : Bool{
}
protected function ShowSelectedItemInfo(tag : CName){
var recipe : SAlchemyRecipe;
var l_DataFlashObject : CScriptedFlashObject;
var itemNameLoc : String;
var imgPath : String;
var canCraft : Bool;
var itemType : EInventoryFilterType;
var gridSize : Int32;
var itemName : CName;
recipe = m_recipeList[FindRecipieID(tag)];
itemName = recipe.cookedItemName;
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
_playerInv.GetCraftedItemInfo(itemName, l_DataFlashObject);
m_flashValueStorage.SetFlashObject("alchemy.menu.crafted.item.to
oltip", l_DataFlashObject, /* NOP */);
itemNameLoc = GetLocStringByKeyExt(_inv.GetItemLocalizedNameByNa
me(itemName));
imgPath = m_definitionsManager.GetItemIconPath(itemName);
canCraft = m_alchemyManager.CanCookRecipe(recipe.recipeName) ==
0;
itemType = m_definitionsManager.GetFilterTypeByItem(itemName);
if (itemType == 1 || itemType == 2){
gridSize = 2;
} else {
gridSize = 1;
}

m_fxSetCraftedItem.InvokeSelfSixArgs(FlashArgUInt(NameToFlashUIn
t(recipe.recipeName)), FlashArgString(itemNameLoc), FlashArgString(imgPath), Fla
shArgBool(canCraft), FlashArgInt(gridSize), FlashArgString(""));
/* NOP */;
}
public function CreateItem(recipeIndex : Int32){
var recipe : SAlchemyRecipe;
var exception : EAlchemyExceptions;
var cookedItemName : String;
recipe = m_recipeList[recipeIndex];
exception = 5;
/* NOP */;
if (bCouldCraft){
exception = m_alchemyManager.CanCookRecipe(recipe.recipe
Name);
if (exception == 0){
m_alchemyManager.CookItem(recipe.recipeName);
if (recipe.level > 1){
m_recipeList = m_alchemyManager.GetRecip
es(false);
}
PopulateData();
UpdateItemsById(recipeIndex);
cookedItemName = GetLocStringByKeyExt(m_definiti
onsManager.GetItemLocalisationKeyName(recipe.cookedItemName));
showNotification(GetLocStringByKeyExt("panel_cra
fting_successfully_crafted") + ": " + cookedItemName, /* NOP */);
OnPlaySoundEvent("gui_crafting_craft_item_comple
te");
}
}
if (exception != 0){
showNotification(GetLocStringByKeyExt(AlchemyExceptionTo
String(exception)), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
private function PopulateData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var recipe : SAlchemyRecipe;
var i : Int32;
var length : Int32;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
var canCraftResult : EAlchemyExceptions;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = m_recipeList.Size();
i = 0;
while (i < length){
recipe = m_recipeList[i];
l_GroupTag = AlchemyCookedItemTypeEnumToName(recipe.cook
edItemType);
l_GroupTitle = GetLocStringByKeyExt(AlchemyCookedItemTyp
eToLocKey(recipe.cookedItemType));

l_Title = GetLocStringByKeyExt(m_definitionsManager.GetI
temLocalisationKeyName(recipe.cookedItemName));
l_IconPath = recipe.recipeIconPath;
l_IsNew = false;
l_Tag = recipe.recipeName;
canCraftResult = m_alchemyManager.CanCookRecipe(recipe.r
ecipeName);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int(l_Tag));
l_DataFlashObject.SetMemberFlashString("dropDownLabel",
l_GroupTitle);
l_DataFlashObject.SetMemberFlashUInt("dropDownTag", Name
ToFlashUInt(l_GroupTag));
l_DataFlashObject.SetMemberFlashBool("dropDownOpened", t
rue);
l_DataFlashObject.SetMemberFlashString("dropDownIcon", "
icons/monsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("isNew", l_IsNew);
l_DataFlashObject.SetMemberFlashString("label", l_Title)
;
l_DataFlashObject.SetMemberFlashString("iconPath", l_Ico
nPath);
if (canCraftResult != 0){
l_DataFlashObject.SetMemberFlashString("cantCook
Reason", GetLocStringByKeyExt(AlchemyExceptionToString(canCraftResult)));
} else {
l_DataFlashObject.SetMemberFlashString("cantCook
Reason", "");
}
l_DataFlashObject.SetMemberFlashBool("isSchematic", fals
e);
l_DataFlashObject.SetMemberFlashInt("canCookStatus", can
CraftResult);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
i += 1;
}
if (l_DataFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_D
ataFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
public function UpdateDescription(tag : CName){
var description : String;
var title : String;
var id : Int32;
id = FindRecipieID(tag);
title = GetLocStringByKeyExt(m_definitionsManager.GetItemLocalis
ationKeyName(m_recipeList[id].cookedItemName));
description = m_definitionsManager.GetItemLocalisationKeyDesc(m_
recipeList[id].cookedItemName);
if (description == "" || description == "<br>"){
description = "panel_journal_quest_empty_description";

}
description = GetLocStringByKeyExt(description);
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_DESCRIPTION
+ ".title", title, /* NOP */);
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_DESCRIPTION
+ ".text", description, /* NOP */);
/* NOP */;
}
public function GetDescription(currentCharacter : CJournalCharacter) : S
tring{
var i : Int32;
var str : String;
var locStrId : Int32;
var description : CJournalCharacterDescription;
str = "";
i = 0;
while (i < currentCharacter.GetNumChildren()){
description = (CJournalCharacterDescription)currentChara
cter.GetChild(i);
if (m_journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();
str += GetLocStringById(locStrId) + "<br>";
}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function FindRecipieID(tag : CName) : Int32{
var i : Int32;
i = 0;
while (i < m_recipeList.Size()){
if (m_recipeList[i].recipeName == tag){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function GetItemQuantity(id : Int32) : Int32{
return _inv.GetItemQuantityByName(itemsNames[id], /* NOP */);
/* NOP */;
}
public function UpdateItems(tag : CName){
UpdateItemsById(FindRecipieID(tag));
ShowSelectedItemInfo(tag);
/* NOP */;
}
private function UpdateItemsById(id : Int32){
var itemsFlashArray : CScriptedFlashArray;
var i : Int32;
itemsNames.Clear();
itemsQuantity.Clear();
i = 0;
while (i < m_recipeList[id].requiredIngredients.Size()){

itemsNames.PushBack(m_recipeList[id].requiredIngredients
[i].itemName);
itemsQuantity.PushBack(m_recipeList[id].requiredIngredie
nts[i].quantity);
i += 1;
}
itemsFlashArray = CreateItems(itemsNames);
if (itemsFlashArray){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBL
IST, itemsFlashArray);
}
/* NOP */;
}
public function FillItemInformation(flashObject : CScriptedFlashObject,
index : Int32){
super.FillItemInformation(flashObject, index);
flashObject.SetMemberFlashInt("reqQuantity", itemsQuantity[index
]);
/* NOP */;
}
public function GetItemRarityDescription(itemName : CName) : String{
var itemQuality : Int32;
itemQuality = 1;
return GetItemRarityDescriptionFromInt(itemQuality);
/* NOP */;
}
private function getCategoryDescription(itemCategory : CName) : String{
switch(itemCategory){
case 'steelsword':
case 'silversword':
case 'crossbow':
case 'secondary':
case 'armor':
case 'pants':
case 'gloves':
case 'boots':
case 'armor':
case 'bolt':
return GetLocStringByKeyExt("item_category_" + itemCateg
ory + "_desc");
break;
default:
return "";
break;
}
return "";
/* NOP */;
}
private function addGFxItemStat(targetArray : CScriptedFlashArray, type
: String, value : String){
var resultData : CScriptedFlashObject;
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
resultData.SetMemberFlashString("type", type);
resultData.SetMemberFlashString("value", value);
targetArray.PushBackFlashObject(resultData);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}

}
import abstract class CSLayerName{
}
class CR4GlossaryBestiaryMenu extends CR4ListBaseMenu{
public var allCreatures : array<CJournalCreature>;
private var m_fxHideContent : CScriptedFlashFunction;
private var m_fxSetTitle : CScriptedFlashFunction;
private var m_fxSetText : CScriptedFlashFunction;
private var m_fxSetImage : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var i : Int32;
var tempCreatures : array<CJournalBase>;
var creatureTemp : CJournalCreature;
var status : EJournalStatus;
super.OnConfigUI();
m_initialSelectionsToIgnore = 2;
m_journalManager.GetActivatedOfType('CJournalCreature', tempCrea
tures);
i = 0;
while (i < tempCreatures.Size()){
status = m_journalManager.GetEntryStatus(tempCreatures[i
]);
if (status == 1){
creatureTemp = (CJournalCreature)tempCreatures[i
];
if (creatureTemp){
allCreatures.PushBack(creatureTemp);
}
}
i += 1;
}
m_fxHideContent = m_flashModule.GetMemberFlashFunction("hideCont
ent");
m_fxSetTitle = m_flashModule.GetMemberFlashFunction("setTitle");
m_fxSetText = m_flashModule.GetMemberFlashFunction("setText");
m_fxSetImage = m_flashModule.GetMemberFlashFunction("setImage");
ShowRenderToTexture("");
m_flashValueStorage.SetFlashBool("journal.rewards.panel.visible"
, false, /* NOP */);
PopulateData();
SelectCurrentModule();
/* NOP */;
}
public function OnGuiSceneEntitySpawned(entity : CEntity) : Bool{
UpdateSceneEntityFromCreatureDataComponent(entity);
Event_OnGuiSceneEntitySpawned();
UpdateItemsFromEntity(entity);
/* NOP */;
}
public function OnGuiSceneEntityDestroyed() : Bool{
Event_OnGuiSceneEntityDestroyed();
/* NOP */;
}
public function OnEntrySelected(tag : CName) : Bool{
if (tag != 'None'){
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(true));
super.OnEntrySelected(tag);
} else {

lastSentTag = 'None';
currentTag = 'None';
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(false));
}
/* NOP */;
}
public function UpdateImage(entryName : CName){
var creature : CJournalCreature;
var templatepath : String;
creature = (CJournalCreature)m_journalManager.GetEntryByTag(entr
yName);
if (creature){
templatepath = creature.GetEntityTemplateFilename();
ShowRenderToTexture("");
templatepath = thePlayer.ProcessGlossaryImageOverride(cr
eature.GetImage(), entryName);
m_fxSetImage.InvokeSelfOneArg(FlashArgString(templatepat
h));
} else {
ShowRenderToTexture("");
m_fxSetImage.InvokeSelfOneArg(FlashArgString(""));
}
/* NOP */;
}
private function PopulateData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var i : Int32;
var length : Int32;
var l_creature : CJournalCreature;
var l_creatureGroup : CJournalCreatureGroup;
var l_Title : String;
var l_Tag : CName;
var l_CategoryTag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_IsNew : Bool;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = allCreatures.Size();
i = 0;
while (i < length){
l_creature = allCreatures[i];
l_creatureGroup = (CJournalCreatureGroup)m_journalManage
r.GetEntryByGuid(l_creature.parentGuid);
l_GroupTitle = GetLocStringById(l_creatureGroup.GetNameS
tringId());
l_CategoryTag = l_creatureGroup.GetUniqueScriptTag();
l_Title = GetLocStringById(l_creature.GetNameStringId())
;
l_Tag = l_creature.GetUniqueScriptTag();
l_IconPath = thePlayer.ProcessGlossaryImageOverride(l_cr
eature.GetImage(), l_Tag);
l_IsNew = m_journalManager.IsEntryUnread(l_creature);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashO
bject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashU
Int(l_Tag));
l_DataFlashObject.SetMemberFlashString("dropDownLabel",
l_GroupTitle);
l_DataFlashObject.SetMemberFlashUInt("dropDownTag", Name

ToFlashUInt(l_CategoryTag));
l_DataFlashObject.SetMemberFlashBool("dropDownOpened", I
sCategoryOpened(l_CategoryTag));
l_DataFlashObject.SetMemberFlashString("dropDownIcon", "
icons/monsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("isNew", l_IsNew);
l_DataFlashObject.SetMemberFlashBool("selected", l_Tag =
= currentTag);
l_DataFlashObject.SetMemberFlashString("label", l_Title)
;
l_DataFlashObject.SetMemberFlashString("iconPath", "icon
s/monsters/" + l_IconPath);
l_DataFlashArray.PushBackFlashObject(l_DataFlashObject);
i += 1;
}
if (l_DataFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_D
ataFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
public function GetDescription(currentCreature : CJournalCreature) : Str
ing{
var i : Int32;
var currentIndex : Int32;
var str : String;
var locStrId : Int32;
var descriptionsGroup : CJournalCreatureDescriptionGroup;
var tmpGroup : CJournalCreatureDescriptionGroup;
var description : CJournalCreatureDescriptionEntry;
var placedString : Bool;
var currentJournalDescriptionText : JournalDescriptionText;
var journalDescriptionArray : array<JournalDescriptionText>;
str = "";
i = 0;
while (i < currentCreature.GetNumChildren()){
tmpGroup = (CJournalCreatureDescriptionGroup)currentCrea
ture.GetChild(i);
if (tmpGroup){
descriptionsGroup = tmpGroup;
break;
}
i += 1;
}
i = 0;
while (i < descriptionsGroup.GetNumChildren()){
description = (CJournalCreatureDescriptionEntry)descript
ionsGroup.GetChild(i);
if (m_journalManager.GetEntryStatus(description) == 1){
currentJournalDescriptionText.stringKey = descri
ption.GetDescriptionStringId();
currentJournalDescriptionText.order = descriptio
n.GetOrder();
currentJournalDescriptionText.groupOrder = descr
iptionsGroup.GetOrder();

if (journalDescriptionArray.Size() == 0){
journalDescriptionArray.PushBack(current
JournalDescriptionText);
} else {
placedString = false;
currentIndex = 0;
while (currentIndex < journalDescription
Array.Size()){
if (journalDescriptionArray[curr
entIndex].groupOrder > currentJournalDescriptionText.groupOrder || journalDescri
ptionArray[currentIndex].groupOrder <= currentJournalDescriptionText.groupOrder
&& journalDescriptionArray[currentIndex].order > currentJournalDescriptionText.o
rder){
journalDescriptionArray.
Insert(Max(0, currentIndex), currentJournalDescriptionText);
placedString = true;
break;
}
currentIndex += 1;
}
if (!placedString){
journalDescriptionArray.PushBack
(currentJournalDescriptionText);
}
}
}
i += 1;
}
i = 0;
while (i < journalDescriptionArray.Size()){
str += GetLocStringById(journalDescriptionArray[i].strin
gKey) + "<br>";
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function UpdateDescription(entryName : CName){
var l_creature : CJournalCreature;
var description : String;
var title : String;
l_creature = (CJournalCreature)m_journalManager.GetEntryByTag(en
tryName);
description = GetDescription(l_creature);
title = GetLocStringById(l_creature.GetNameStringId());
m_fxSetTitle.InvokeSelfOneArg(FlashArgString(title));
m_fxSetText.InvokeSelfOneArg(FlashArgString(description));
/* NOP */;
}
public function UpdateItems(tag : CName){
var itemsFlashArray : CScriptedFlashArray;
var l_creature : CJournalCreature;
var l_creatureParams : SJournalCreatureParams;
var l_creatureEntityTemplateFilename : String;
l_creature = (CJournalCreature)m_journalManager.GetEntryByTag(ta
g);

itemsNames = l_creature.GetItemsUsedAgainstCreature();
itemsFlashArray = CreateItems(itemsNames);
if (itemsFlashArray && itemsFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", true, /* NOP */);
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBL
IST, itemsFlashArray);
} else {
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", false, /* NOP */);
}
/* NOP */;
}
public function UpdateItemsFromEntity(entity : CEntity){
var l_creature : CJournalCreature;
var creatureDataComponent : CCreatureDataComponent;
var itemsFlashArray : CScriptedFlashArray;
l_creature = (CJournalCreature)m_journalManager.GetEntryByTag(cu
rrentTag);
if (l_creature && m_journalManager.GetEntryHasAdvancedInfo(l_cre
ature)){
creatureDataComponent = (CCreatureDataComponent)entity.G
etComponentByClassName('CCreatureDataComponent');
if (creatureDataComponent){
itemsFlashArray = CreateItems(creatureDataCompon
ent.GetItemsUsedAgainstCreature());
}
}
if (itemsFlashArray){
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", true, /* NOP */);
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBL
IST, itemsFlashArray);
} else {
m_flashValueStorage.SetFlashBool("journal.rewards.panel.
visible", false, /* NOP */);
}
/* NOP */;
}
private function CreateItems(itemsNames : array<CName>) : CScriptedFlash
Array{
var l_flashArray : CScriptedFlashArray;
var l_flashObject : CScriptedFlashObject;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var curName : CName;
var curLocName : String;
var curIconPath : String;
dm = theGame.GetDefinitionsManager();
if (itemsNames.Size() < 1){
return NULL;
}
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < itemsNames.Size()){
curName = itemsNames[i];
TryGetSignData(curName, curLocName, curIconPath);
if (curLocName == ""){
curIconPath = dm.GetItemIconPath(curName);
}

l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t("red.game.witcher3.menus.common.ItemDataStub");
l_flashObject.SetMemberFlashInt("id", i + 1);
l_flashObject.SetMemberFlashInt("quantity", 1);
l_flashObject.SetMemberFlashString("iconPath", curIconPa
th);
l_flashObject.SetMemberFlashInt("gridPosition", i);
l_flashObject.SetMemberFlashInt("gridSize", 1);
l_flashObject.SetMemberFlashInt("slotType", 1);
l_flashObject.SetMemberFlashBool("isNew", false);
l_flashObject.SetMemberFlashBool("needRepair", false);
l_flashObject.SetMemberFlashInt("actionType", 0);
l_flashObject.SetMemberFlashInt("price", 0);
l_flashObject.SetMemberFlashString("userData", "");
l_flashObject.SetMemberFlashString("category", "");
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
return l_flashArray;
/* NOP */;
}
private function TryGetSignData(signName : CName, localizationKey : Stri
ng, iconPath : String){
switch(signName){
case 'Yrden':
localizationKey = "Yrden";
iconPath = "hud/radialmenu/mcYrden.png";
break;
case 'Quen':
localizationKey = "Quen";
iconPath = "hud/radialmenu/mcQuen.png";
break;
case 'Igni':
localizationKey = "Igni";
iconPath = "hud/radialmenu/mcIgni.png";
break;
case 'Axii':
localizationKey = "Axii";
iconPath = "hud/radialmenu/mcAxii.png";
break;
case 'Aard':
localizationKey = "Aard";
iconPath = "hud/radialmenu/mcAard.png";
break;
default:
localizationKey = "";
iconPath = "";
}
/* NOP */;
}
public function OnGetItemData(item : Int32, compareItemType : Int32) : B
ool{
var itemName : String;
var category : CName;
var typeStr : String;
var weight : Float;
var iconPath : String;
var resultData : CScriptedFlashObject;
var statsList : CScriptedFlashArray;
var dm : CDefinitionsManagerAccessor;

dm = theGame.GetDefinitionsManager();
item = item - 1;
itemName = itemsNames[item];
resultData = m_flashValueStorage.CreateTempFlashObject(/* NOP */
);
statsList = m_flashValueStorage.CreateTempFlashArray();
TryGetSignData(itemsNames[item], itemName, iconPath);
if (itemName == ""){
iconPath = dm.GetItemIconPath(itemsNames[item]);
itemName = dm.GetItemLocalisationKeyName(itemsNames[item
]);
category = dm.GetItemCategory(itemsNames[item]);
typeStr = GetItemCategoryLocalisedString(category);
} else {
typeStr = GetLocStringByKeyExt("panel_character_skill_si
gns");
}
itemName = GetLocStringByKeyExt(itemName);
resultData.SetMemberFlashString("ItemName", itemName);
resultData.SetMemberFlashString("PriceValue", dm.GetItemPrice(it
emsNames[item]));
resultData.SetMemberFlashString("ItemRarity", "");
resultData.SetMemberFlashString("ItemType", typeStr);
resultData.SetMemberFlashString("DurabilityValue", "");
resultData.SetMemberFlashString("IconPath", iconPath);
resultData.SetMemberFlashString("ItemCategory", category);
m_flashValueStorage.SetFlashObject("context.tooltip.data", resul
tData, /* NOP */);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
class CR4GlossaryEncyclopediaMenu extends CR4ListBaseMenu{
private var m_fxUpdateEntryInfo : CScriptedFlashFunction;
private var m_fxUpdateEntryImage : CScriptedFlashFunction;
private var m_fxSetMovieData : CScriptedFlashFunction;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
super.OnConfigUI();
flashModule = GetMenuFlash();
m_fxUpdateEntryInfo = flashModule.GetMemberFlashFunction("setEnt
ryText");
m_fxUpdateEntryImage = flashModule.GetMemberFlashFunction("setEn
tryImg");
m_fxSetMovieData = m_flashModule.GetMemberFlashFunction("setMovi
eData");
ShowRenderToTexture("");
PopulateData();
/* NOP */;
}
public function OnClosingMenu() : Bool{
super.OnClosingMenu();
/* NOP */;
}
public function OnCloseMenu() : Bool{
super.OnCloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();

}
/* NOP */;
}
private function PopulateData(){
var flashArray : CScriptedFlashArray;
flashArray = m_flashValueStorage.CreateTempFlashArray();
PopulateDataCharacters(flashArray);
m_flashValueStorage.SetFlashArray("glossary.encyclopedia.list",
flashArray);
if (flashArray.GetLength() > 0){
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
private function PopulateDataCharacters(flashArray : CScriptedFlashArray
){
var i : Int32;
var tempCharacters : array<CJournalBase>;
var characterTemp : CJournalCharacter;
var status : EJournalStatus;
m_journalManager.GetActivatedOfType('CJournalCharacter', tempCha
racters);
i = 0;
while (i < tempCharacters.Size()){
characterTemp = (CJournalCharacter)tempCharacters[i];
if (characterTemp){
status = m_journalManager.GetEntryStatus(charact
erTemp);
if (status == 1){
AddCharacterJournalEntryToArray(characte
rTemp, flashArray);
}
}
i += 1;
}
/* NOP */;
}
private function AddCharacterJournalEntryToArray(journalCharacter : CJou
rnalCharacter, flashArray : CScriptedFlashArray){
var l_DataFlashObject : CScriptedFlashObject;
var i : Int32;
var length : Int32;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
l_GroupTag = 'panel_title_glossary_characters';
l_Tag = journalCharacter.GetUniqueScriptTag();
l_Title = GetLocStringById(journalCharacter.GetNameStringId());
l_IconPath = thePlayer.ProcessGlossaryImageOverride(journalChara
cter.GetImagePath(), l_Tag);
l_IsNew = m_journalManager.IsEntryUnread(journalCharacter);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashUInt(l_Ta

g));
l_DataFlashObject.SetMemberFlashString("dropDownLabel", GetLocSt
ringByKeyExt(l_GroupTag));
l_DataFlashObject.SetMemberFlashUInt("dropDownTag", NameToFlashU
Int(l_GroupTag));
l_DataFlashObject.SetMemberFlashBool("dropDownOpened", IsCategor
yOpened(l_GroupTag));
l_DataFlashObject.SetMemberFlashString("dropDownIcon", "icons/mo
nsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("isNew", l_IsNew);
l_DataFlashObject.SetMemberFlashBool("selected", currentTag == l
_Tag);
l_DataFlashObject.SetMemberFlashString("label", l_Title);
l_DataFlashObject.SetMemberFlashString("iconPath", "icons/charac
ters/" + l_IconPath);
flashArray.PushBackFlashObject(l_DataFlashObject);
/* NOP */;
}
public function GetCharacterDescription(currentCharacter : CJournalChara
cter) : String{
var i : Int32;
var str : String;
var locStrId : Int32;
var description : CJournalCharacterDescription;
str = "";
i = 0;
while (i < currentCharacter.GetNumChildren()){
description = (CJournalCharacterDescription)currentChara
cter.GetChild(i);
if (m_journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();
str += GetLocStringById(locStrId) + "<br>";
}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function getCharacterImage(character : CJournalCharacter) : Strin
g{
var entityFilename : String;
entityFilename = character.GetEntityTemplateFilename();
return "img://textures/journal/characters/" + thePlayer.ProcessG
lossaryImageOverride(character.GetImagePath(), character.GetUniqueScriptTag());
/* NOP */;
}
private function PopulateDataLocations(flashArray : CScriptedFlashArray)
{
var i : Int32;
var tempEntries : array<CJournalBase>;
var entryTemp : CJournalPlaceGroup;
var status : EJournalStatus;
m_journalManager.GetActivatedOfType('CJournalPlaceGroup', tempEn
tries);
i = 0;
while (i < tempEntries.Size()){

entryTemp = (CJournalPlaceGroup)tempEntries[i];
if (entryTemp){
status = m_journalManager.GetEntryStatus(tempEnt
ries[i]);
if (status == 1){
AddLocationJournalEntryToArray(entryTemp
, flashArray);
}
}
i += 1;
}
/* NOP */;
}
private function AddLocationJournalEntryToArray(journalEntry : CJournalP
laceGroup, flashArray : CScriptedFlashArray){
var l_DataFlashObject : CScriptedFlashObject;
var j : Int32;
var l_entry : CJournalPlace;
var l_tempEntries : array<CJournalBase>;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
l_GroupTitle = GetLocStringByKeyExt("panel_title_glossary_places
");
l_GroupTag = journalEntry.GetUniqueScriptTag();
m_journalManager.GetActivatedChildren(journalEntry, l_tempEntrie
s);
j = 0;
while (j < l_tempEntries.Size()){
l_entry = (CJournalPlace)l_tempEntries[j];
if (m_journalManager.GetEntryStatus(l_entry) < 1){
} else {
l_Title = GetLocStringById(l_entry.GetNameString
Id());
l_IconPath = l_entry.GetImage();
l_IsNew = m_journalManager.IsEntryUnread(l_entry
);
l_Tag = l_entry.GetUniqueScriptTag();
l_DataFlashObject = m_flashValueStorage.CreateTe
mpFlashObject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", Name
ToFlashUInt(l_Tag));
l_DataFlashObject.SetMemberFlashString("dropDown
Label", l_GroupTitle);
l_DataFlashObject.SetMemberFlashUInt("dropDownTa
g", NameToFlashUInt(l_GroupTag));
l_DataFlashObject.SetMemberFlashBool("dropDownOp
ened", IsCategoryOpened(l_GroupTag));
l_DataFlashObject.SetMemberFlashString("dropDown
Icon", journalEntry.GetImage());
l_DataFlashObject.SetMemberFlashBool("isNew", l_
IsNew);
l_DataFlashObject.SetMemberFlashBool("selected",
l_Tag == currentTag);
l_DataFlashObject.SetMemberFlashString("label",
l_Title);
l_DataFlashObject.SetMemberFlashString("iconPath

", "icons/tutorials/" + l_IconPath);


flashArray.PushBackFlashObject(l_DataFlashObject
);
}
j += 1;
}
/* NOP */;
}
public function GetPlaceDescription(currentEntry : CJournalPlace) : Stri
ng{
var i : Int32;
var str : String;
var locStrId : Int32;
var description : CJournalPlaceDescription;
str = "";
i = 0;
while (i < currentEntry.GetNumChildren()){
description = (CJournalPlaceDescription)currentEntry.Get
Child(i);
if (m_journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();
str += GetLocStringById(locStrId) + "<br>";
}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function getPlaceImage(place : CJournalPlace) : String{
return "img://textures/journal/places/" + place.GetImage();
/* NOP */;
}
private function PopulateDataEvents(flashArray : CScriptedFlashArray){
var i : Int32;
var tempEntries : array<CJournalBase>;
var entryTemp : CJournalGlossaryGroup;
var status : EJournalStatus;
m_journalManager.GetActivatedOfType('CJournalGlossaryGroup', tem
pEntries);
i = 0;
while (i < tempEntries.Size()){
entryTemp = (CJournalGlossaryGroup)tempEntries[i];
if (entryTemp){
status = m_journalManager.GetEntryStatus(entryTe
mp);
if (status == 1){
AddEventJournalEntryToArray(entryTemp, f
lashArray);
}
}
i += 1;
}
/* NOP */;
}
private function AddEventJournalEntryToArray(journalEntry : CJournalGlos
saryGroup, flashArray : CScriptedFlashArray){

var i : Int32;
var l_tempEntries : array<CJournalBase>;
var l_entry : CJournalGlossary;
var l_DataFlashObject : CScriptedFlashObject;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_IsNew : Bool;
l_GroupTitle = GetLocStringByKeyExt("panel_title_glossary_dictio
nary");
m_journalManager.GetActivatedChildren(journalEntry, l_tempEntrie
s);
i = 0;
while (i < l_tempEntries.Size()){
l_entry = (CJournalGlossary)l_tempEntries[i];
if (m_journalManager.GetEntryStatus(l_entry) < 1){
} else {
l_Title = GetLocStringById(l_entry.GetTitleStrin
gId());
l_IconPath = l_entry.GetImagePath();
l_IsNew = m_journalManager.IsEntryUnread(l_entry
);
l_Tag = l_entry.GetUniqueScriptTag();
l_DataFlashObject = m_flashValueStorage.CreateTe
mpFlashObject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", Name
ToFlashUInt(l_Tag));
l_DataFlashObject.SetMemberFlashString("dropDown
Label", l_GroupTitle);
l_DataFlashObject.SetMemberFlashString("dropDown
Icon", "icons/monsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("isNew", l_
IsNew);
l_DataFlashObject.SetMemberFlashBool("selected",
currentTag == l_Tag);
l_DataFlashObject.SetMemberFlashString("label",
l_Title);
l_DataFlashObject.SetMemberFlashString("iconPath
", "icons/tutorials/" + l_IconPath);
flashArray.PushBackFlashObject(l_DataFlashObject
);
}
i += 1;
}
/* NOP */;
}
public function GetEventsDescription(currentEntry : CJournalGlossary) :
String{
var i : Int32;
var str : String;
var locStrId : Int32;
var description : CJournalGlossaryDescription;
str = "";
i = 0;
while (i < currentEntry.GetNumChildren()){
description = (CJournalGlossaryDescription)currentEntry.
GetChild(i);
if (m_journalManager.GetEntryStatus(description) == 1){
locStrId = description.GetDescriptionStringId();

str += GetLocStringById(locStrId) + "<br>";


}
i += 1;
}
if (str == "" || str == "<br>"){
str = GetLocStringByKeyExt("panel_journal_quest_empty_de
scription");
}
return str;
/* NOP */;
}
public function getEventImage(jEvent : CJournalGlossary) : String{
return "img://textures/journal/events/" + jEvent.GetImagePath();
/* NOP */;
}
private function GetGlossaryLocalizedStringById(id : Int32) : String{
return "";
/* NOP */;
}
public function UpdateDescription(entryName : CName){
var journalEntry : CJournalBase;
var characterEntry : CJournalCharacter;
var placeEntry : CJournalPlace;
var eventEntry : CJournalGlossary;
var titleText : String;
var descText : String;
titleText = "";
descText = "";
journalEntry = m_journalManager.GetEntryByTag(entryName);
characterEntry = (CJournalCharacter)journalEntry;
if (characterEntry){
descText = GetCharacterDescription(characterEntry);
titleText = GetLocStringById(characterEntry.GetNameStrin
gId());
}
placeEntry = (CJournalPlace)journalEntry;
if (placeEntry){
descText = GetPlaceDescription(placeEntry);
titleText = GetLocStringById(placeEntry.GetNameStringId(
));
}
eventEntry = (CJournalGlossary)journalEntry;
if (eventEntry){
descText = GetEventsDescription(eventEntry);
titleText = GetLocStringById(eventEntry.GetTitleStringId
());
}
m_fxUpdateEntryInfo.InvokeSelfTwoArgs(FlashArgString(titleText),
FlashArgString(descText));
/* NOP */;
}
public function UpdateImage(tag : CName){
var journalEntry : CJournalBase;
var characterEntry : CJournalCharacter;
var placeEntry : CJournalPlace;
var eventEntry : CJournalGlossary;
var imgLoc : String;
imgLoc = "";
journalEntry = m_journalManager.GetEntryByTag(tag);
characterEntry = (CJournalCharacter)journalEntry;

if (characterEntry){
imgLoc = getCharacterImage(characterEntry);
}
placeEntry = (CJournalPlace)journalEntry;
if (placeEntry){
imgLoc = getPlaceImage(placeEntry);
}
eventEntry = (CJournalGlossary)journalEntry;
if (eventEntry){
imgLoc = getEventImage(eventEntry);
}
if (imgLoc != ""){
m_flashValueStorage.SetFlashBool("render.to.texture.text
ure.visible", false, /* NOP */);
}
m_fxUpdateEntryImage.InvokeSelfOneArg(FlashArgString(imgLoc));
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
class CR4MeditationClockMenu extends CR4MenuBase{
private var m_fxSetBlockMeditation : CScriptedFlashFunction;
private var m_fxSetCanMeditate : CScriptedFlashFunction;
private var m_fxSetGeraltBackgroundVisible : CScriptedFlashFunction;
private var canMeditateWait : Bool;
private var m_fxSet24HRFormat : CScriptedFlashFunction;
private var isGameTimePaused : Bool;
public function OnConfigUI() : Bool{
var commonMenu : CR4CommonMenu;
var locCode : String;
super.OnConfigUI();
GetWitcherPlayer().MeditationClockStart(this);
SendCurrentTimeToAS();
m_fxSetBlockMeditation = m_flashModule.GetMemberFlashFunction("S
etBlockMeditation");
m_fxSet24HRFormat = m_flashModule.GetMemberFlashFunction("Set24H
RFormat");
m_fxSetGeraltBackgroundVisible = m_flashModule.GetMemberFlashFun
ction("setGeraltBackgroundVisible");
theGame.Unpause("menus");
if (GetWitcherPlayer().CanMeditate() && GetWitcherPlayer().CanMe
ditateWait(true)){
canMeditateWait = true;
isGameTimePaused = false;
} else if (theGame.IsGameTimePaused()){
canMeditateWait = false;
isGameTimePaused = true;
}
if (canMeditateWait){
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.SetMeditationMode(true);
}
}
m_fxSetBlockMeditation.InvokeSelfOneArg(FlashArgBool(!canMeditat
eWait));
locCode = GetCurrentTextLocCode();
m_fxSet24HRFormat.InvokeSelfOneArg(FlashArgBool(locCode != "EN")

);
if (GameplayFactsQuerySum("GamePausedNotByUI") > 0 && !thePlayer
.IsInCombat()){
GetWitcherPlayer().MeditationRestoring(0);
}
if (!canMeditateWait){
theGame.Pause("menus");
}
/* NOP */;
}
public function OnClosingMenu() : Bool{
var commonMenu : CR4CommonMenu;
theGame.GetGuiManager().SendCustomUIEvent('ClosedMeditationClock
Menu');
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.SetMeditationMode(false);
}
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (thePlayer.GetCurrentStateName() == 'MeditationWaiting'){
MeditatingEnd();
}
if (!theGame.IsPaused()){
theGame.Pause("menus");
}
GetWitcherPlayer().MeditationClockStop();
CloseMenu();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
/* NOP */;
}
public function SetButtons(){
AddInputBinding("panel_button_common_exit", "escape-gamepad_B",
-1);
super.SetButtons();
/* NOP */;
}
public function UpdateCurrentHours(){
var timeHours : Int32;
var timeMinutes : Int32;
timeHours = GetCurrentDayTime("hours");
timeMinutes = GetCurrentDayTime("minutes");
m_flashValueStorage.SetFlashInt("meditation.clock.hours.update",
timeHours, /* NOP */);
m_flashValueStorage.SetFlashInt("meditation.clock.minutes", time
Minutes, /* NOP */);
/* NOP */;
}
public function SendCurrentTimeToAS(){
var timeHours : Int32;
var timeMinutes : Int32;
timeHours = GetCurrentDayTime("hours");
timeMinutes = GetCurrentDayTime("minutes");
m_flashValueStorage.SetFlashInt("meditation.clock.hours", timeHo
urs, /* NOP */);
m_flashValueStorage.SetFlashInt("meditation.clock.minutes", time
Minutes, /* NOP */);

/* NOP */;
}
public function OnMeditate(dayTime : Float) : Bool{
var medd : W3PlayerWitcherStateMeditation;
if (!canMeditateWait){
super.ShowDisallowedNotification();
} else {
if (theGame.IsPaused()){
theGame.Unpause("menus");
}
GetWitcherPlayer().Meditate();
OnPlaySoundEvent("gui_meditation_start");
/* NOP */;
if (dayTime == GameTimeHours(theGame.GetGameTime())){
return false;
}
medd = (W3PlayerWitcherStateMeditation)thePlayer.GetCurr
entState();
medd.MeditationWait(CeilF(dayTime));
StartWaiting();
}
/* NOP */;
}
public function OnMeditateBlocked() : Bool{
super.ShowDisallowedNotification();
/* NOP */;
}
public function OnStopMeditate() : Bool{
var waitt : W3PlayerWitcherStateMeditationWaiting;
if (thePlayer.GetCurrentStateName() == 'MeditationWaiting'){
waitt = (W3PlayerWitcherStateMeditationWaiting)thePlayer
.GetCurrentState();
if (waitt){
waitt.RequestWaitStop();
}
}
MeditatingEnd();
/* NOP */;
}
public function GetCurrentDayTime(type : String) : Int32{
var gameTime : GameTime;
var currentDays : Int32;
var currentHours : Int32;
var currentMinutes : Int32;
var currentTime : Int32;
gameTime = theGame.GetGameTime();
switch(type){
case "days":
currentTime = GameTimeDays(gameTime);
break;
case "hours":
currentDays = GameTimeDays(gameTime);
currentHours = GameTimeHours(gameTime);
currentTime = currentHours;
break;
case "minutes":
currentDays = GameTimeDays(gameTime);
currentHours = GameTimeHours(gameTime);
currentMinutes = GameTimeMinutes(gameTime);
currentTime = currentMinutes;

break;
}
return currentTime;
/* NOP */;
}
public function StartWaiting(){
theGame.GetCityLightManager().SetUpdateEnabled(false);
m_flashValueStorage.SetFlashBool("meditation.clock.blocked", tru
e, /* NOP */);
SetMenuNavigationEnabled(false);
/* NOP */;
}
public function StopWaiting(){
m_flashValueStorage.SetFlashBool("meditation.clock.blocked", fal
se, /* NOP */);
SetMenuNavigationEnabled(true);
/* NOP */;
}
public function MeditatingEnd(){
theGame.GetCityLightManager().ForceUpdate();
theGame.GetCityLightManager().SetUpdateEnabled(true);
m_flashValueStorage.SetFlashBool("meditation.clock.blocked", fal
se, /* NOP */);
SetMenuNavigationEnabled(true);
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
private final function ShowDisallowedNotification(){
if (thePlayer.IsInCombat()){
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_combat"), /* NOP */);
} else {
showNotification(GetLocStringByKeyExt("menu_cannot_perfo
rm_action_now"), /* NOP */);
}
OnPlaySoundEvent("gui_global_denied");
/* NOP */;
}
}
class CR4CraftingMenu extends CR4ListBaseMenu{
private var m_definitionsManager : CDefinitionsManagerAccessor;
private var bCouldCraft : Bool;
protected var _inv : CInventoryComponent;
private var _playerInv : W3GuiPlayerInventoryComponent;
private var m_craftingManager : W3CraftingManager;
private var m_schematicList : array<CName>;
private var m_npc : CNewNPC;
private var _craftsmanComponent : W3CraftsmanComponent;
private var m_fxSetCraftingEnabled : CScriptedFlashFunction;
private var m_fxSetCraftedItem : CScriptedFlashFunction;
private var m_fxHideContent : CScriptedFlashFunction;
public var itemsQuantity : array<Int32>;
public function OnConfigUI() : Bool{
var commonMenu : CR4CommonMenu;
var l_obj : IScriptable;
var l_npc : CNewNPC;
var l_initData : W3InventoryInitData;
super.OnConfigUI();

m_initialSelectionsToIgnore = 2;
_inv = thePlayer.GetInventory();
m_definitionsManager = theGame.GetDefinitionsManager();
_playerInv = new W3GuiPlayerInventoryComponent in this;
_playerInv.Initialize(_inv);
l_obj = GetMenuInitData();
l_initData = (W3InventoryInitData)l_obj;
if (l_initData){
l_npc = (CNewNPC)l_initData.containerNPC;
} else {
l_npc = (CNewNPC)l_obj;
}
_craftsmanComponent = (W3CraftsmanComponent)l_npc.GetComponentBy
ClassName('W3CraftsmanComponent');
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(GetM
enuName());
}
m_craftingManager = new W3CraftingManager in this;
m_craftingManager.Init(_craftsmanComponent);
m_schematicList = GetWitcherPlayer().GetCraftingSchematicsNames(
);
m_fxSetCraftedItem = m_flashModule.GetMemberFlashFunction("setCr
aftedItem");
m_fxSetCraftingEnabled = m_flashModule.GetMemberFlashFunction("s
etCraftingEnabled");
m_fxHideContent = m_flashModule.GetMemberFlashFunction("hideCont
ent");
if (_craftsmanComponent){
bCouldCraft = true;
m_npc = l_npc;
UpdateMerchantData(l_npc);
}
m_fxSetCraftingEnabled.InvokeSelfOneArg(FlashArgBool(bCouldCraft
));
PopulateData();
SelectFirstModule();
/* NOP */;
}
public function OnClosingMenu() : Bool{
super.OnClosingMenu();
theGame.GetGuiManager().SetLastOpenedCommonMenuName(GetMenuName(
));
/* NOP */;
}
public function OnCloseMenu() : Bool{
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.ChildRequestCloseMenu();
}
theSound.SoundEvent('gui_global_quit');
CloseMenu();
/* NOP */;
}
public function OnEntryRead(tag : CName) : Bool{
}
public function OnStartCrafting() : Bool{
OnPlaySoundEvent("gui_crafting_craft_item");

/* NOP */;
}
public function OnCraftItem(tag : CName) : Bool{
CreateItem(tag);
/* NOP */;
}
public function OnEntryPress(tag : CName) : Bool{
}
public function OnEntrySelected(tag : CName) : Bool{
if (tag != 'None'){
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(true));
super.OnEntrySelected(tag);
} else {
lastSentTag = 'None';
currentTag = 'None';
m_fxHideContent.InvokeSelfOneArg(FlashArgBool(false));
}
/* NOP */;
}
public function OnShowCraftedItemTooltip(tag : CName) : Bool{
}
public function CreateItem(schematic : CName){
var item : SItemUniqueId;
var result : ECraftingException;
var craftedItemNameLoc : String;
var actualSchematic : SCraftingSchematic;
result = 7;
if (bCouldCraft){
result = m_craftingManager.Craft(schematic, item);
if (result == 0){
OnPlaySoundEvent("gui_crafting_craft_item_comple
te");
PopulateData();
UpdateItems(schematic);
m_craftingManager.GetSchematic(schematic, actual
Schematic);
craftedItemNameLoc = GetLocStringByKeyExt(m_defi
nitionsManager.GetItemLocalisationKeyName(actualSchematic.craftedItemName));
showNotification(GetLocStringByKeyExt("panel_cra
fting_successfully_crafted") + ": " + craftedItemNameLoc, /* NOP */);
if (m_npc){
UpdateMerchantData(m_npc);
}
UpdateItemsCounter();
}
}
if (result != 0){
showNotification(GetLocStringByKeyExt(CraftingExceptionT
oString(result)), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
private function UpdateItemsCounter(){
var commonMenu : CR4CommonMenu;
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
commonMenu.UpdateItemsCounter();
commonMenu.UpdatePlayerOrens();
}

/* NOP */;
}
private function PopulateData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var wrongCraftsmanItems : array<CScriptedFlashObject>;
var schematic : SCraftingSchematic;
var schematicName : CName;
var i : Int32;
var length : Int32;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
var canCraftResult : ECraftingException;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = m_schematicList.Size();
i = 0;
while (i < length){
schematicName = m_schematicList[i];
if (m_craftingManager.GetSchematic(schematicName, schema
tic)){
l_GroupTag = m_definitionsManager.GetItemCategor
y(schematic.craftedItemName);
l_GroupTitle = GetLocStringByKeyExt("item_catego
ry_" + l_GroupTag);
l_Title = GetLocStringByKeyExt(m_definitionsMana
ger.GetItemLocalisationKeyName(schematic.schemName));
l_IconPath = m_definitionsManager.GetItemIconPat
h(schematic.craftedItemName);
l_IsNew = false;
l_Tag = schematic.schemName;
l_DataFlashObject = m_flashValueStorage.CreateTe
mpFlashObject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("tag", Name
ToFlashUInt(l_Tag));
l_DataFlashObject.SetMemberFlashString("dropDown
Label", l_GroupTitle);
l_DataFlashObject.SetMemberFlashUInt("dropDownTa
g", NameToFlashUInt(l_GroupTag));
l_DataFlashObject.SetMemberFlashBool("dropDownOp
ened", true);
l_DataFlashObject.SetMemberFlashString("dropDown
Icon", "icons/monsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("isNew", l_
IsNew);
l_DataFlashObject.SetMemberFlashString("label",
l_Title);
l_DataFlashObject.SetMemberFlashString("iconPath
", l_IconPath);
canCraftResult = m_craftingManager.CanCraftSchem
atic(schematicName, bCouldCraft);
if (canCraftResult != 0){
l_DataFlashObject.SetMemberFlashString("
cantCookReason", GetLocStringByKeyExt(CraftingExceptionToString(canCraftResult))
);
} else {
l_DataFlashObject.SetMemberFlashString("

cantCookReason", "");
}
l_DataFlashObject.SetMemberFlashBool("isSchemati
c", true);
l_DataFlashObject.SetMemberFlashInt("canCookStat
us", canCraftResult);
if (canCraftResult == 4){
wrongCraftsmanItems.PushBack(l_DataFlash
Object);
} else {
l_DataFlashArray.PushBackFlashObject(l_D
ataFlashObject);
}
}
i += 1;
}
if (l_DataFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_D
ataFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
public function UpdateMerchantData(targetNpc : CNewNPC){
var l_merchantData : CScriptedFlashObject;
l_merchantData = m_flashValueStorage.CreateTempFlashObject(/* NO
P */);
GetNpcInfo(targetNpc, l_merchantData);
m_flashValueStorage.SetFlashObject("crafting.merchant.info", l_m
erchantData, /* NOP */);
/* NOP */;
}
public function UpdateDescription(tag : CName){
var description : String;
var title : String;
var schematic : SCraftingSchematic;
m_craftingManager.GetSchematic(tag, schematic);
title = GetLocStringByKeyExt(m_definitionsManager.GetItemLocalis
ationKeyName(schematic.craftedItemName));
description = m_definitionsManager.GetItemLocalisationKeyDesc(sc
hematic.craftedItemName);
if (description == "" || description == "<br>" || description ==
"#"){
description = "panel_journal_quest_empty_description";
}
description = GetLocStringByKeyExt(description) + "BBBBBBB";
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_DESCRIPTION
+ ".title", title, /* NOP */);
m_flashValueStorage.SetFlashString(DATA_BINDING_NAME_DESCRIPTION
+ ".text", description, /* NOP */);
/* NOP */;
}
public function UpdateItems(tag : CName){
var itemsFlashArray : CScriptedFlashArray;
var i : Int32;
var schematic : SCraftingSchematic;

m_craftingManager.GetSchematic(tag, schematic);
itemsNames.Clear();
itemsQuantity.Clear();
i = 0;
while (i < schematic.ingredients.Size()){
itemsNames.PushBack(schematic.ingredients[i].itemName);
itemsQuantity.PushBack(schematic.ingredients[i].quantity
);
i += 1;
}
itemsFlashArray = CreateItems(itemsNames);
if (itemsFlashArray){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME_SUBL
IST, itemsFlashArray);
}
ShowSelectedItemInfo(tag);
/* NOP */;
}
protected function ShowSelectedItemInfo(tag : CName){
var schematic : SCraftingSchematic;
var l_DataFlashObject : CScriptedFlashObject;
var itemNameLoc : String;
var imgPath : String;
var canCraft : Bool;
var itemType : EInventoryFilterType;
var gridSize : Int32;
var itemName : CName;
var itemCost : Int32;
var priceStr : String;
var crafterDesc : String;
var levelColor : String;
var crafterRequirements : String;
var rarity : Int32;
var canCraftResult : ECraftingException;
m_craftingManager.GetSchematic(tag, schematic);
itemName = schematic.craftedItemName;
CraftsmanTypeToLocalizationKey(schematic.requiredCraftsmanType);
CraftsmanLevelToLocalizationKey(schematic.requiredCraftsmanLevel
);
l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
_playerInv.GetCraftedItemInfo(itemName, l_DataFlashObject);
canCraftResult = m_craftingManager.CanCraftSchematic(tag, bCould
Craft);
canCraft = canCraftResult == 0;
crafterRequirements = GetLocStringByKeyExt(CraftsmanTypeToLocali
zationKey(schematic.requiredCraftsmanType));
if (bCouldCraft){
if (canCraftResult == 1){
levelColor = "<font color='#E34040'>";
} else {
levelColor = "<font color='#949494'>";
}
crafterRequirements += " / " + levelColor + GetLocString
ByKeyExt(CraftsmanLevelToLocalizationKey(schematic.requiredCraftsmanLevel)) + "<
/font>";
} else {
crafterRequirements += " / " + GetLocStringByKeyExt(Craf
tsmanLevelToLocalizationKey(schematic.requiredCraftsmanLevel));
}

crafterDesc = l_DataFlashObject.GetMemberFlashString("itemDescri
ption");
l_DataFlashObject.SetMemberFlashString("crafterRequirements", cr
afterRequirements);
l_DataFlashObject.SetMemberFlashString("itemDescription", crafte
rDesc);
rarity = l_DataFlashObject.GetMemberFlashInt("rarityId");
m_flashValueStorage.SetFlashObject("blacksmithing.menu.crafted.i
tem.tooltip", l_DataFlashObject, /* NOP */);
itemNameLoc = GetLocStringByKeyExt(_inv.GetItemLocalizedNameByNa
me(itemName));
imgPath = m_definitionsManager.GetItemIconPath(itemName);
itemType = m_definitionsManager.GetFilterTypeByItem(itemName);
if (itemType == 1 || itemType == 2){
gridSize = 2;
} else {
gridSize = 1;
}
if (bCouldCraft){
itemCost = m_craftingManager.GetCraftingCost(tag);
priceStr = GetLocStringByKeyExt("panel_inventory_item_pr
ice") + " ";
if (thePlayer.GetMoney() < itemCost){
priceStr += "<font color="#E34040">" + itemCost
+ "</font>";
} else {
priceStr += "<font color="#3FA524">" + itemCost
+ "</font>";
}
} else {
priceStr = "";
}
m_fxSetCraftedItem.InvokeSelfSevenArgs(FlashArgUInt(NameToFlashU
Int(schematic.schemName)), FlashArgString(itemNameLoc), FlashArgString(imgPath),
FlashArgBool(canCraft), FlashArgInt(gridSize), FlashArgString(priceStr), FlashA
rgInt(rarity));
/* NOP */;
}
public function FillItemInformation(flashObject : CScriptedFlashObject,
index : Int32){
super.FillItemInformation(flashObject, index);
flashObject.SetMemberFlashInt("reqQuantity", itemsQuantity[index
]);
/* NOP */;
}
public final function GetCraftsmanComponent() : W3CraftsmanComponent{
return _craftsmanComponent;
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
import abstract class CSSceneTableEntry{
}
import abstract class CSSpawnType{
}
class W3CraftingManager extends CObject{

private var schematics : array<SCraftingSchematic>;


private var craftMasterComp : W3CraftsmanComponent;
public function Init(masterComp : W3CraftsmanComponent){
craftMasterComp = masterComp;
LoadSchematicsXMLData();
/* NOP */;
}
private function LoadSchematicsXMLData(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var tmpName : CName;
var tmpInt : Int32;
var schem : SCraftingSchematic;
var i : Int32;
var j : Int32;
var k : Int32;
var ing : SItemParts;
var schematicsNames : array<CName>;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('crafting_schematics');
schematicsNames = GetWitcherPlayer().GetCraftingSchematicsNames(
);
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpName);
j = 0;
while (j < schematicsNames.Size()){
if (tmpName == schematicsNames[j]){
if (dm.GetCustomNodeAttributeValueName(m
ain.subNodes[i], 'craftedItem_name', tmpName)){
schem.craftedItemName = tmpName;
}
if (dm.GetCustomNodeAttributeValueName(m
ain.subNodes[i], 'craftsmanType_name', tmpName)){
schem.requiredCraftsmanType = Pa
rseCraftsmanTypeStringToEnum(tmpName);
}
if (dm.GetCustomNodeAttributeValueInt(ma
in.subNodes[i], 'craftedItemQuantity', tmpInt)){
schem.craftedItemCount = tmpInt;
}
if (dm.GetCustomNodeAttributeValueName(m
ain.subNodes[i], 'craftsmanLevel_name', tmpName)){
schem.requiredCraftsmanLevel = P
arseCraftsmanLevelStringToEnum(tmpName);
}
if (dm.GetCustomNodeAttributeValueInt(ma
in.subNodes[i], 'price', tmpInt)){
schem.baseCraftingPrice = tmpInt
;
}
ingredients = dm.GetCustomDefinitionSubN
ode(main.subNodes[i], 'ingredients');
k = 0;
while (k < ingredients.subNodes.Size()){
ing.itemName = 'None';
ing.quantity = -1;
if (dm.GetCustomNodeAttributeVal

ueName(ingredients.subNodes[k], 'item_name', tmpName)){


ing.itemName = tmpName;
}
if (dm.GetCustomNodeAttributeVal
ueInt(ingredients.subNodes[k], 'quantity', tmpInt)){
ing.quantity = tmpInt;
}
schem.ingredients.PushBack(ing);
k += 1;
}
schem.schemName = schematicsNames[j];
schematics.PushBack(schem);
schem.baseCraftingPrice = -1;
schem.craftedItemName = 'None';
schem.ingredients.Clear();
schem.requiredCraftsmanLevel = 0;
schem.requiredCraftsmanType = 0;
schem.schemName = 'None';
schem.craftedItemCount = 0;
break;
}
j += 1;
}
i += 1;
}
/* NOP */;
}
public function CanCraftSchematic(schematicName : CName, checkMerchant :
Bool) : ECraftingException{
var schem : SCraftingSchematic;
var i : Int32;
var cnt : Int32;
GetSchematic(schematicName, schem);
if (checkMerchant){
if (!GetSchematic(schematicName, schem)){
return 6;
}
if (!craftMasterComp.IsCraftsmanType(schem.requiredCraft
smanType)){
return 4;
}
if (craftMasterComp.GetCraftsmanLevel(schem.requiredCraf
tsmanType) < schem.requiredCraftsmanLevel){
return 1;
}
}
i = 0;
while (i < schem.ingredients.Size()){
cnt = thePlayer.inv.GetItemQuantityByName(schem.ingredie
nts[i].itemName, /* NOP */);
if (cnt < schem.ingredients[i].quantity){
return 3;
}
i += 1;
}
if (checkMerchant){
if (thePlayer.GetMoney() < GetCraftingCost(schematicName
)){
return 5;
}

}
return 0;
/* NOP */;
}
public function GetSchematic(s : CName, ret : SCraftingSchematic) : Bool
{
var i : Int32;
i = 0;
while (i < schematics.Size()){
if (schematics[i].schemName == s){
ret = schematics[i];
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetCraftingCost(schematic : CName) : Int32{
var schem : SCraftingSchematic;
if (GetSchematic(schematic, schem)){
return craftMasterComp.CalculateCostOfCrafting(schem.bas
eCraftingPrice);
}
return -1;
/* NOP */;
}
public function Craft(schemName : CName, item : SItemUniqueId) : ECrafti
ngException{
var error : ECraftingException;
var i : Int32;
var j : Int32;
var size : Int32;
var schem : SCraftingSchematic;
var items : array<SItemUniqueId>;
var upgradeItem : array<SItemUniqueId>;
var itemsingr : array<SItemUniqueId>;
var equipAfterCrafting : Bool;
var tutStateSet : W3TutorialManagerUIHandlerStateCraftingSet;
var craftsman : CGameplayEntity;
var upgrades : array<CName>;
var temp : array<CName>;
error = CanCraftSchematic(schemName, true);
if (error != 0){
item = GetInvalidUniqueId();
LogCrafting("Cannot craft schematic <<" + schemName + ">
>. Exception is <<" + error + ">>");
return error;
}
GetSchematic(schemName, schem);
craftsman = (CGameplayEntity)craftMasterComp.GetEntity();
thePlayer.inv.GiveMoneyTo(craftsman.GetInventory(), GetCraftingC
ost(schemName), false);
equipAfterCrafting = false;
i = 0;
while (i < schem.ingredients.Size()){
itemsingr = thePlayer.inv.GetItemsByName(schem.ingredien
ts[i].itemName);
j = 0;
while (j < itemsingr.Size()){

if (thePlayer.inv.IsItemMounted(itemsingr[j]) ||
thePlayer.inv.IsItemHeld(itemsingr[j])){
equipAfterCrafting = true;
}
j += 1;
}
thePlayer.inv.GetItemEnhancementItems(itemsingr[0], temp
);
ArrayOfNamesAppend(upgrades, temp);
temp.Clear();
thePlayer.inv.RemoveItemByName(schem.ingredients[i].item
Name, schem.ingredients[i].quantity);
i += 1;
}
items = thePlayer.inv.AddAnItem(schem.craftedItemName, schem.cra
ftedItemCount, /* NOP */, /* NOP */, /* NOP */);
item = items[0];
if (equipAfterCrafting){
thePlayer.EquipItem(item, /* NOP */, /* NOP */);
}
size = Min(thePlayer.inv.GetItemEnhancementSlotsCount(item), upg
rades.Size());
i = 0;
while (i < size){
upgradeItem = thePlayer.inv.AddAnItem(upgrades[i], 1, tr
ue, true, /* NOP */);
thePlayer.inv.EnhanceItemScript(item, upgradeItem[0]);
i += 1;
}
LogCrafting("Item <<" + schem.craftedItemName + ">> crafted succ
essfully");
if (thePlayer.inv.IsItemSetItem(item) && ShouldProcessTutorial('
TutorialCraftingSets')){
tutStateSet = (W3TutorialManagerUIHandlerStateCraftingSe
t)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateSet){
tutStateSet.OnCraftedSetItem();
}
}
return 0;
/* NOP */;
}
}
import abstract class CSStoryPhaseNames{
}
import abstract class COldCommunitySpawnStrategy{
}
import abstract class SActionPointId{
}
import abstract class CActionPointComponent{
}
import abstract class CEntityUpdaterComponent{
}
import abstract class CJobBreakerComponent{

}
import struct CActionPointSelector{
}
import abstract class CTimetableActionPointSelector{
}
import struct CSimpleActionPointSelector{
//NULL type for categories
//NULL type for apTags
//NULL type for areaTags
//NULL type for apAreaTag
//NULL type for keepActionPointOnceSelected
}
import abstract class CCharacterResource{
}
import struct CJournalManager{
import public final function ActivateEntry(journalEntry : CJournalBase,
status : EJournalStatus, showInfoOnScreen : Bool, activateParents : Bool);
import public final function GetEntryStatus(journalEntry : CJournalBase)
: EJournalStatus;
import public final function IsEntryUnread(journalEntry : CJournalBase)
: Bool;
import public final function SetEntryUnread(journalEntry : CJournalBase,
isUnread : Bool);
import public final function GetEntryByTag(tag : CName) : CJournalBase;
import public final function GetEntryByString(str : String) : CJournalBa
se;
import public final function GetEntryByGuid(guid : CGUID) : CJournalBase
;
import public final function GetNumberOfActivatedOfType(type : CName) :
Int32;
import public final function GetActivatedOfType(type : CName, entries :
array<CJournalBase>);
import public final function GetNumberOfActivatedChildren(parentEntry :
CJournalBase) : Int32;
import public final function GetActivatedChildren(parentEntry : CJournal
Base, entries : array<CJournalBase>);
import public final function GetNumberOfAllChildren(parentEntry : CJourn
alBase) : Int32;
import public final function GetAllChildren(parentEntry : CJournalBase,
entries : array<CJournalBase>);
}
import abstract class CJournalRoot{
}
import abstract class SJournalEntryStatus{
}
import abstract class SJournalEvent{
}
import abstract class SJournalStatusEvent{
}
import abstract class CRewardGroupFactory{

}
import abstract class CBgNpc{
}
import abstract class CBgNpcTriggerComponent{
}
import abstract class CBgNpcItemComponent{
}
import abstract class CBgInteractionComponent{
}
import abstract class CBgRootComponent{
}
import abstract class CBgMeshComponent{
}
import abstract class CBgNpcTriggerActionTalk{
}
import abstract class CBgNpcTriggerActionLookAt{
}
import abstract class CBgNpcTriggerActionSwordReaction{
}
import struct CJournalCreatureGroup{
import public final function GetNameStringId() : Int32;
import public final function GetImage() : String;
}
import abstract class SAnimationSequenceDefinition{
//NULL type for parts
//NULL type for entity
//NULL type for manualSlotName
//NULL type for startForceEvent
//NULL type for raiseEventOnEnd
//NULL type for freezeAtEnd
//NULL type for raiseForceEventOnEnd
}
import abstract class SBehaviorConstraintNodeFloorIKCommonData{
}
import abstract class SBehaviorConstraintNodeFloorIKVerticalBoneData{
}
import abstract class SBehaviorConstraintNodeFloorIKMaintainLookBoneData{
}
import abstract class SBehaviorConstraintNodeFloorIKLegsData{
}
import abstract class SBehaviorConstraintNodeFloorIKCommon{
}
import abstract class SBehaviorConstraintNodeFloorIKVerticalBone{

}
import abstract class SBehaviorConstraintNodeFloorIKMaintainLookBone{
}
struct JournalDescriptionText{
var order : Int32;
var groupOrder : Int32;
var stringKey : Int32;
var currentEntry : CJournalQuestDescriptionEntry;
}
import abstract class SBehaviorConstraintNodeFloorIKLegs{
}
import abstract class SBehaviorConstraintNodeFloorIKCachedTrace{
}
import abstract class SBehaviorConstraintNodeFloorIKLeg{
}
import abstract class SBehaviorConstraintNodeFloorIKWeightHandler{
}
class CCreatureDataComponent extends CScriptedComponent{
public editable var itemsUsedAgainstCreature : array<CName>;
public editable var skillsUsedAgainstCreature : array<CName>;
public editable var cameraDistance : Float;
public editable var cameraLookAtZ : Float;
public editable var cameraRotationYaw : Float;
public editable var cameraRotationPitch : Float;
public editable var environmentSunRotationYaw : Float;
public editable var environmentSunRotationPitch : Float;
public editable var appearance : CName;
public editable var position : Vector;
public editable var scale : Float;
public editable var fov : Float;
public function GetItemsUsedAgainstCreature() : array<CName>{
return itemsUsedAgainstCreature;
/* NOP */;
}
public function GetSkillsUsedAgainstCreature() : array<CName>{
return skillsUsedAgainstCreature;
/* NOP */;
}
public function GetCameraDistance() : Float{
return cameraDistance;
/* NOP */;
}
public function GetCameraLookAtZ() : Float{
return cameraLookAtZ;
/* NOP */;
}
public function GetCameraRotationYaw() : Float{
return cameraRotationYaw;
/* NOP */;
}
public function GetCameraRotationPitch() : Float{
return cameraRotationPitch;
/* NOP */;

}
public function GetEnvironmentSunRotationYaw() : Float{
return environmentSunRotationYaw;
/* NOP */;
}
public function GetEnvironmentSunRotationPitch() : Float{
return environmentSunRotationPitch;
/* NOP */;
}
public function GetDesiredAppearance() : CName{
return appearance;
/* NOP */;
}
public function GetEntityPosition() : Vector{
return position;
/* NOP */;
}
public function GetEntityRotation() : EulerAngles{
var emptyRotation : EulerAngles;
return emptyRotation;
/* NOP */;
}
public function getEntityScale() : Vector{
var returnVal : Vector;
if (scale == 0){
scale = 1;
}
returnVal.X = scale;
returnVal.Y = scale;
returnVal.Z = scale;
return returnVal;
/* NOP */;
}
public function getFov() : Float{
return fov;
/* NOP */;
}
}
import abstract class SBehaviorConstraintNodeFloorIKLegsIKWeightHandler{
}
import abstract class SBehaviorConstraintNodeFloorIKFrontBackWeightHandler{
}
import abstract class SBehaviorConstraintNodeFloorIKDebugTrace{
}
import abstract class CBehaviorConstraintNodeFloorIKBase{
}
import abstract class CBehaviorConstraintNodeFloorIK{
}
import abstract class CBehaviorConstraintNodeFloorIKHandsOnly{
}
import abstract class CBehaviorConstraintNodeFloorIKBipedLong{
}

class CR4GwintBaseMenu extends CR4MenuBase{


protected var quitConfPopup : W3GwintQuitConfPopup;
protected var gwintManager : CR4GwintManager;
protected var flashConstructor : CScriptedFlashObject;
public function OnConfigUI() : Bool{
m_hideTutorial = true;
m_forceHideTutorial = true;
super.OnConfigUI();
flashConstructor = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
gwintManager = theGame.GetGwintManager();
SendCardTemplates();
theInput.StoreContext('EMPTY_CONTEXT');
theGame.ResetFadeLock("GwintStart");
theGame.FadeInAsync(0.200000);
/* NOP */;
}
public function OnClosingMenu() : Bool{
theInput.RestoreContext('EMPTY_CONTEXT', true);
super.OnClosingMenu();
if (quitConfPopup){
delete quitConfPopup;
}
/* NOP */;
}
public function OnQuitGameConfirmed(){
CloseMenu();
/* NOP */;
}
protected function SendCardTemplates(){
var l_flashArray : CScriptedFlashArray;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
AddCardsToFlashArray(l_flashArray, gwintManager.GetCardDefs());
AddCardsToFlashArray(l_flashArray, gwintManager.GetLeaderDefs())
;
m_flashValueStorage.SetFlashArray("gwint.card.templates", l_flas
hArray);
/* NOP */;
}
private function AddCardsToFlashArray(l_flashArray : CScriptedFlashArray
, cards : array<SCardDefinition>){
var l_flashObject : CScriptedFlashObject;
var currentCard : SCardDefinition;
var combinedType : Int32;
var i : Int32;
var imageLoc : String;
i = 0;
while (i < cards.Size()){
currentCard = cards[i];
l_flashObject = flashConstructor.CreateFlashObject("red.
game.witcher3.menus.gwint.CardTemplate");
imageLoc = currentCard.picture;
if (IsNameValid(currentCard.dlcPictureFlag) && theGame.G
etDLCManager().IsDLCAvailable('dlc_008_001') && theGame.GetInGameConfigWrapper()
.GetVarValue('DLC', 'dlc_008_001') == "true"){
imageLoc = currentCard.dlcPicture;
}
l_flashObject.SetMemberFlashInt("index", currentCard.ind
ex);
l_flashObject.SetMemberFlashString("title", GetLocString

ByKeyExt(currentCard.title));
l_flashObject.SetMemberFlashString("description", GetLoc
StringByKeyExt(currentCard.description));
l_flashObject.SetMemberFlashInt("power", currentCard.pow
er);
l_flashObject.SetMemberFlashString("imageLoc", imageLoc)
;
l_flashObject.SetMemberFlashInt("factionIdx", currentCar
d.faction);
l_flashObject.SetMemberFlashInt("typeArray", currentCard
.typeFlags);
AddCardEffectsToFlashObject(l_flashObject, currentCard);
AddSummonFlagsToObject(l_flashObject, currentCard);
l_flashArray.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
private function AddCardEffectsToFlashObject(flashObject : CScriptedFlas
hObject, card : SCardDefinition){
var flashEffectArray : CScriptedFlashArray;
var i : Int32;
flashEffectArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < card.effectFlags.Size()){
flashEffectArray.PushBackFlashInt(card.effectFlags[i]);
i += 1;
}
flashObject.SetMemberFlashArray("effectFlags", flashEffectArray)
;
/* NOP */;
}
private function AddSummonFlagsToObject(flashObject : CScriptedFlashObje
ct, card : SCardDefinition){
var flashSummonArray : CScriptedFlashArray;
var i : Int32;
flashSummonArray = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < card.summonFlags.Size()){
flashSummonArray.PushBackFlashInt(card.summonFlags[i]);
i += 1;
}
flashObject.SetMemberFlashArray("summonFlags", flashSummonArray)
;
/* NOP */;
}
public function CreateDeckDefinitionFlash(deckInfo : SDeckDefinition) :
CScriptedFlashObject{
var deckFlashObject : CScriptedFlashObject;
var indicesFlashArray : CScriptedFlashArray;
var dynCardRequirements : CScriptedFlashArray;
var dynCards : CScriptedFlashArray;
var i : Int32;
deckFlashObject = flashConstructor.CreateFlashObject("red.game.w
itcher3.menus.gwint.GwintDeck");
indicesFlashArray = m_flashValueStorage.CreateTempFlashArray();
deckFlashObject.SetMemberFlashString("deckName", "");
i = 0;
while (i < deckInfo.cardIndices.Size()){
indicesFlashArray.PushBackFlashInt(deckInfo.cardIndices[

i]);
i += 1;
}
deckFlashObject.SetMemberFlashArray("cardIndices", indicesFlashA
rray);
deckFlashObject.SetMemberFlashBool("isUnlocked", deckInfo.unlock
ed);
deckFlashObject.SetMemberFlashInt("selectedKingIndex", deckInfo.
leaderIndex);
deckFlashObject.SetMemberFlashInt("specialCard", deckInfo.specia
lCard);
dynCardRequirements = m_flashValueStorage.CreateTempFlashArray()
;
i = 0;
while (i < deckInfo.dynamicCardRequirements.Size()){
dynCardRequirements.PushBackFlashInt(deckInfo.dynamicCar
dRequirements[i]);
i += 1;
}
deckFlashObject.SetMemberFlashArray("dynamicCardRequirements", d
ynCardRequirements);
dynCards = m_flashValueStorage.CreateTempFlashArray();
i = 0;
while (i < deckInfo.dynamicCards.Size()){
dynCards.PushBackFlashInt(deckInfo.dynamicCards[i]);
i += 1;
}
deckFlashObject.SetMemberFlashArray("dynamicCards", dynCards);
return deckFlashObject;
/* NOP */;
}
public function FillArrayWithCardList(cardList : array<CollectionCard>,
targetArray : CScriptedFlashArray){
var cardInfo : CScriptedFlashObject;
var i : Int32;
i = 0;
while (i < cardList.Size()){
cardInfo = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
cardInfo.SetMemberFlashInt("cardID", cardList[i].cardID)
;
cardInfo.SetMemberFlashInt("numCopies", cardList[i].numC
opies);
targetArray.PushBackFlashObject(cardInfo);
i += 1;
}
/* NOP */;
}
public function OnConfirmSurrender() : Bool{
quitConfPopup = new W3GwintQuitConfPopup in this;
quitConfPopup.SetMessageTitle(GetLocStringByKeyExt("gwint_pass_g
ame"));
quitConfPopup.SetMessageText(GetLocStringByKeyExt("gwint_surrend
er_message_desc"));
quitConfPopup.gwintMenuRef = this;
quitConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', quitConfPopup);
/* NOP */;
}
}

import abstract class CBehaviorConstraintNodeFloorIKQuadruped{


}
import abstract class CBehaviorConstraintNodeFloorIKSixLegs{
}
class W3GwintQuitConfPopup extends ConfirmationPopupData{
public var gwintMenuRef : CR4GwintBaseMenu;
protected function OnUserAccept(){
gwintMenuRef.OnQuitGameConfirmed();
/* NOP */;
}
}
import abstract class CBehaviorConstraintRiderInSaddle{
}
import abstract class SBehaviorConstraintUprightSpineBonesData{
}
import abstract class SBehaviorConstraintUprightSpineBones{
}
import abstract class CBehaviorConstraintUprightSpine{
}
import abstract class SCardDefinition{
//NULL type for index
//NULL type for picture
//NULL type for dlcPictureFlag
//NULL type for dlcPicture
//NULL type for title
//NULL type for description
//NULL type for power
//NULL type for faction
//NULL type for typeFlags
//NULL type for effectFlags
//NULL type for summonFlags
}
import abstract class CBehaviorConstraintApplyOffset{
}
import abstract class SBehaviorConstraintPutLegIntoStirrupData{
}
import abstract class SBehaviorConstraintPutLegIntoStirrup{
}
import abstract class CBehaviorConstraintPutLegsIntoStirrups{
}
import abstract class SBehaviorConstraintTargetWeightHandler{
}
import abstract class SBehaviorConstraintPullStirrupToLegData{
}
import abstract class SBehaviorConstraintPullStirrupToLeg{

}
import abstract class CBehaviorConstraintPullStirrupsToLegs{
}
import abstract class SBehaviorConstraintStirrupsCommmonData{
}
import abstract class SBehaviorConstraintStirrupsCommmon{
}
import abstract class SBehaviorConstraintStirrupData{
}
import abstract class CollectionCard{
//NULL type for cardID
//NULL type for numCopies
}
import abstract class SBehaviorConstraintStirrup{
}
import abstract class CBehaviorConstraintStirrups{
}
class CR4GwintGameMenu extends CR4GwintBaseMenu{
protected var chooseTurnPopup : W3ChooseGwintTurnPopup;
private var m_fxSetWhoStarts : CScriptedFlashFunction;
private var m_fxShowTutorial : CScriptedFlashFunction;
private var playerWon : Bool;
private var tutorialActive : Bool;
public function EnableJournalTutorialEnries(){
var tutSystem : CR4TutorialSystem;
tutSystem = theGame.GetTutorialSystem();
tutSystem.ActivateJournalEntry('gwentintroduction');
tutSystem.ActivateJournalEntry('gwentstartinghand');
tutSystem.ActivateJournalEntry('unitcardstrengthNEW');
tutSystem.ActivateJournalEntry('unitcardrangeNEW');
tutSystem.ActivateJournalEntry('unitcardsspecialabilityNEW');
tutSystem.ActivateJournalEntry('weathercards');
tutSystem.ActivateJournalEntry('redrawcardsNEW');
tutSystem.ActivateJournalEntry('gwintturns');
tutSystem.ActivateJournalEntry('gwintleaders');
tutSystem.ActivateJournalEntry('totalstrengthNEW');
tutSystem.ActivateJournalEntry('gwintpassing');
tutSystem.ActivateJournalEntry('endround');
tutSystem.ActivateJournalEntry('lifegems');
tutSystem.ActivateJournalEntry('protipsgwent');
tutSystem.ActivateJournalEntry('findingcards');
/* NOP */;
}
public function OnConfigUI() : Bool{
super.OnConfigUI();
SendCardValues();
SendPlayerNames();
m_fxSetWhoStarts = m_flashModule.GetMemberFlashFunction("setFirs
tTurn");
m_fxShowTutorial = m_flashModule.GetMemberFlashFunction("showTut
orial");
theGame.GetGuiManager().RequestMouseCursor(true);

if (gwintManager.getDoubleAIEnabled()){
m_flashValueStorage.SetFlashBool("gwint.game.toggleAI",
true, /* NOP */);
}
if (!gwintManager.GetHasDoneTutorial()){
EnableJournalTutorialEnries();
if (!theGame.GetTutorialSystem().AreMessagesEnabled()){
gwintManager.SetHasDoneTutorial(true);
} else {
m_fxShowTutorial.InvokeSelf();
sendTutorialStrings();
tutorialActive = true;
}
}
SendDecksInformation();
theSound.EnterGameState(19);
/* NOP */;
}
public function OnClosingMenu() : Bool{
super.OnClosingMenu();
gwintManager.SetHasDoneTutorial(true);
theGame.GetGuiManager().RequestMouseCursor(false);
if (thePlayer.GetGwintMinigameState() != 16 && thePlayer.GetGwin
tMinigameState() != 32){
if (playerWon){
thePlayer.SetGwintMinigameState(16);
} else {
thePlayer.SetGwintMinigameState(32);
}
}
if (chooseTurnPopup){
delete chooseTurnPopup;
}
theSound.LeaveGameState(19);
theSound.SoundEvent("system_resume");
if (!gwintManager.testMatch && theGame.isUserSignedIn()){
theGame.FadeOutAsync(0, /* NOP */);
theGame.SetFadeLock("Gwint_EndFadeOut");
}
gwintManager.testMatch = false;
/* NOP */;
}
public function OnQuitGameConfirmed(){
playerWon = false;
super.OnQuitGameConfirmed();
/* NOP */;
}
private function SendCardValues(){
var l_flashObject : CScriptedFlashObject;
l_flashObject = flashConstructor.CreateFlashObject("red.game.wit
cher3.menus.gwint.GwintCardValues");
l_flashObject.SetMemberFlashNumber("weatherCardValue", 5.000000)
;
l_flashObject.SetMemberFlashNumber("hornCardValue", 5.000000);
l_flashObject.SetMemberFlashNumber("drawCardValue", 1.000000);
l_flashObject.SetMemberFlashNumber("scorchCardValue", 8.000000);
l_flashObject.SetMemberFlashNumber("summonClonesCardValue", 0.50
0000);
l_flashObject.SetMemberFlashNumber("unsummonCardValue", 2.000000
);

l_flashObject.SetMemberFlashNumber("improveNeighboursCardValue",
4.000000);
l_flashObject.SetMemberFlashNumber("nurseCardValue", 3.000000);
m_flashValueStorage.SetFlashObject("gwint.game.cardValues", l_fl
ashObject, /* NOP */);
/* NOP */;
}
private function SendDecksInformation(){
var playerDeck : SDeckDefinition;
var enemyDeck : SDeckDefinition;
var playerDeckFlash : CScriptedFlashObject;
var enemyDeckFlash : CScriptedFlashObject;
if (tutorialActive){
playerDeck = gwintManager.GetTutorialPlayerDeck();
} else {
playerDeck = gwintManager.GetCurrentPlayerDeck();
}
playerDeckFlash = CreateDeckDefinitionFlash(playerDeck);
enemyDeck = gwintManager.GetCurrentAIDeck();
enemyDeckFlash = CreateDeckDefinitionFlash(enemyDeck);
m_flashValueStorage.SetFlashObject("gwint.game.player.deck", pla
yerDeckFlash, /* NOP */);
m_flashValueStorage.SetFlashObject("gwint.game.enemy.deck", enem
yDeckFlash, /* NOP */);
/* NOP */;
}
private function SendPlayerNames(){
m_flashValueStorage.SetFlashString("gwint.player.name.one", GetL
ocStringByKeyExt("gwint_geralt"), /* NOP */);
m_flashValueStorage.SetFlashString("gwint.player.name.two", GetL
ocStringByKeyExt("gwint_opponent"), /* NOP */);
/* NOP */;
}
public function OnChooseCoinFlip() : Bool{
chooseTurnPopup = new W3ChooseGwintTurnPopup in this;
chooseTurnPopup.SetMessageTitle(GetLocStringByKeyExt("gwint_choo
se_start_player_popup_title"));
chooseTurnPopup.SetMessageText(GetLocStringByKeyExt("gwint_choos
e_start_player_popup_desc"));
chooseTurnPopup.gwintMenuRef = this;
chooseTurnPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', chooseTurnPopup);
/* NOP */;
}
public function OnMatchResult(pWon : Bool) : Bool{
playerWon = pWon;
/* NOP */;
}
public function OnNeutralRoundVictoryAchievement() : Bool{
theGame.GetGamerProfile().AddAchievement(53);
/* NOP */;
}
public function OnHeroRoundVictoryAchievement() : Bool{
theGame.GetGamerProfile().AddAchievement(52);
/* NOP */;
}
public function SetPlayerStarts(playerFirst : Bool){
m_fxSetWhoStarts.InvokeSelfOneArg(FlashArgBool(playerFirst));
/* NOP */;
}

protected function sendTutorialStrings(){


var l_flashArray : CScriptedFlashArray;
var maString : String;
l_flashArray = m_flashValueStorage.CreateTempFlashArray();
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_welcome_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_startinghand_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_unitcardstrength_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_unitcardrange_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_unitcardspecialability_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_weather_cards_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_redraw_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_your_battlefield_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_enemy_battlefield_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_turns_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_leaders_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_playing_cards_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_total_strength_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_passing_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_end_round_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_gems_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_protips_desc")));
l_flashArray.PushBackFlashString(ReplaceTagsToIcons(GetLocString
ByKeyExt("gwint_tut_finding_cards_desc")));
m_flashValueStorage.SetFlashArray("gwint.tutorial.strings", l_fl
ashArray);
/* NOP */;
}
}
import abstract class SBehaviorConstraintPullReinToHandData{
}
import abstract class SBehaviorConstraintPullReinToHand{
}
class W3ChooseGwintTurnPopup extends ConfirmationPopupData{
public var gwintMenuRef : CR4GwintGameMenu;
protected function OnUserAccept(){
gwintMenuRef.SetPlayerStarts(true);
/* NOP */;
}
protected function OnUserDecline(){
gwintMenuRef.SetPlayerStarts(false);

/* NOP */;
}
protected function GetAcceptText() : String{
return "gwint_choose_start_player_go_first";
/* NOP */;
}
protected function GetDeclineText() : String{
return "gwint_choose_start_player_go_second";
/* NOP */;
}
}
import abstract class CBehaviorConstraintPullReinsToHands{
}
import abstract class CBehaviorGraphAimingWithIKNode{
}
import abstract class CBehaviorConstraintMoveHandsByOffset{
}
import abstract class CLookAtStaticParam{
}
import abstract class CBehaviorGraphPoseConstraintPoseLookAtNode{
}
import abstract class CBehaviorGraphPoseConstraintPoseCurveLookAtNode{
}
import abstract class SPoseLookAtSegment{
}
import abstract class SPoseLookAtSegmentDampData{
}
import abstract class CBPCPoseLookAtCurveTrajModifier{
}
import abstract class CBehaviorGraphGameplayAdditiveNode{
}
import abstract class SGameplayAdditiveLevel{
}
import abstract class SDeckDefinition{
//NULL type for cardIndices
//NULL type for leaderIndex
//NULL type for specialCard
//NULL type for unlocked
//NULL type for dynamicCardRequirements
//NULL type for dynamicCards
}
import abstract class SGameplayAdditiveAnimRuntimeData{
}
import abstract class CBehaviorGraphGameplaySoundEventsNode{
}

import abstract class CBehaviorGraphRandomAnimTimeNode{


}
import abstract class CBehaviorGraphScriptStateNode{
}
import abstract class CBehaviorGraphScriptComponentStateNode{
}
import abstract class CBehaviorGraphScriptStateReportingNode{
}
import abstract class CBehaviorGraphDirectionalMovementNode{
}
import abstract class CBehaviorGraphDirectionalMovementStartNode{
}
import abstract class CBehaviorGraphDirectionalMovementStopNode{
}
import abstract class CChangeMovementDirectionTransitionCondition{
}
import abstract class CChangeFacingDirectionTransitionCondition{
}
import abstract class CIsMovingForwardTransitionCondition{
}
import abstract class CBehaviorGraphStateTransitionFinalStepNode{
}
import abstract class CBehaviorGraphChangeDirectionNode{
}
import abstract class CBehaviorGraphFillMovementVariablesUsingSteeringNode{
}
import abstract class CBehaviorGraphRagdollNode{
}
import abstract class CBehaviorGraphAnimatedRagdollNode{
}
import abstract class CBehaviorGraphMaintainVelocityNode{
}
import abstract class CBehaviorGraphStoreBoneNode{
}
import abstract class CBehaviorGraphStoreAnimEventNode{
}
import abstract class CBehaviorGraphRestoreAnimEventNode{
}
import abstract class CBehaviorGraphOnSlopeMovementNode{
}

import abstract class CBehaviorGraphStoreSyncInfoNode{


}
import abstract class CBehaviorGraphRestoreSyncInfoNode{
}
import abstract class CBehaviorGraphConvertSyncInfoIntoCyclesNode{
}
import abstract class CBehaviorGraphFootStepDetectorNode{
}
import abstract class SFootDetectionBoneInfo{
}
import abstract class CExtAnimEffectDurationEvent{
}
import abstract class CExtAnimEffectEvent{
}
import abstract class CExtAnimGameplayMimicEvent{
}
import abstract class CExtAnimLocationAdjustmentEvent{
}
import abstract class CExtAnimMaterialBasedFxEvent{
}
import abstract class CExtAnimOnSlopeEvent{
}
import abstract class CExtAnimRotationAdjustmentEvent{
}
import abstract class CExtAnimRotationAdjustmentLocationBasedEvent{
}
import struct CVehicleComponent{
private var isCameraActivated : Bool;
private var isPlayingSyncAnimation : Bool;
private editable var slots : array<Vector>;
protected editable var mainStateName : CName;
protected editable var passengerStateName : CName;
protected var userCombatManager : W3VehicleCombatManager;
protected var canBoardTheBoat : Bool;
public var commandToMountActorToMount : CActor;
public var commandToMountMountType : EMountType;
public var commandToMountVehicleSlot : EVehicleSlot;
//NULL type for user
import public final latent function PlaySlotAnimation(slot : CName, anim
ation : CName, blendIn : Float, blendOut : Float) : Bool;
import public final function PlaySlotAnimationAsync(slot : CName, animat
ion : CName, blendIn : Float, blendOut : Float) : Bool;
import public final function GetSlotTransform(slotName : CName, translat
ion : Vector, rotQuat : Vector);
import public final function GetDeepDistance(vel : Vector) : Float;
import public final function SetCommandToMountDelayed(ctmd : Bool);
import public final function IsCommandToMountDelayed() : Bool;

import public final function OnDriverMount();


public function OnMountStarted(entity : CEntity, vehicleSlot : EVehicleS
lot) : Bool{
if (vehicleSlot == 0){
user = (CActor)entity;
super.OnDriverMount();
}
/* NOP */;
}
public function OnMountFinished(entity : CEntity) : Bool{
if (entity == thePlayer){
if (userCombatManager){
userCombatManager.OnMountFinished();
}
thePlayer.BlockAction(41, 'vehicle', true, /* NOP */, /*
NOP */);
}
/* NOP */;
}
public function OnDismountStarted(entity : CEntity) : Bool{
}
public function OnDismountFinished(entity : CEntity, vehicleSlot : EVehi
cleSlot) : Bool{
if (vehicleSlot == 0){
user = NULL;
}
if (entity == thePlayer){
ToggleVehicleCamera(false);
thePlayer.UnblockAction(41, 'vehicle');
thePlayer.AddTimer('ReapplyCSTimer', 2.000000, /* NOP */
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCombatAction(action : EVehicleCombatAction) : Bool{
}
public function OnCombatActionEnd() : Bool{
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
}
public function OnInit() : Bool{
var tags : array<CName>;
tags = GetEntity().GetTags();
if (!tags.Contains('vehicle')){
tags.PushBack('vehicle');
GetEntity().SetTags(tags);
}
GotoStateAuto();
/* NOP */;
}
public function OnDeinit() : Bool{
if (GetUser() == thePlayer){
IssueCommandToDismount(8);
}
/* NOP */;
}
public function OnAnimationStarted(entity : CEntity, data : CName) : Boo
l{
PlaySlotAnimationAsync('VEHICLE_SLOT', data, /* NOP */, /* NOP *
/);

/* NOP */;
}
public function CanUseBoardingExploration() : Bool{
return canBoardTheBoat;
/* NOP */;
}
public function GetUserCombatManager() : W3VehicleCombatManager{
return userCombatManager;
/* NOP */;
}
public function Mount(actorToMount : CActor, mountType : EVehicleMountTy
pe, vehicleSlot : EVehicleSlot){
if (actorToMount){
LogAssert(IsMounted() == false, "CVehicleComponent::Moun
t - 'IsMounted' flag is true");
if (mountType == 1){
IssueCommandToApprochToSlot(actorToMount);
} else if (mountType == 3){
TeleportAndMount(actorToMount);
} else if (mountType == 2){
IssueCommandToMount(actorToMount, 1, vehicleSlot
);
} else if (mountType == 4){
IssueCommandToMount(actorToMount, 2, vehicleSlot
);
}
}
/* NOP */;
}
public function IssueCommandToApprochToSlot(entity : CEntity){
(CPlayerStateApproachTheVehicle)entity.GetState('ApproachTheVehi
cle').SetupState(this, 0);
entity.GotoState('ApproachTheVehicle', false, /* NOP */);
/* NOP */;
}
public function OnDelayedCommandToMount(dt : Float) : Bool{
if (thePlayer){
IssueCommandToMount(commandToMountActorToMount, commandT
oMountMountType, commandToMountVehicleSlot);
super.SetCommandToMountDelayed(false);
}
/* NOP */;
}
public function IssueCommandToMount(actorToMount : CActor, mountType : E
MountType, vehicleSlot : EVehicleSlot){
var playerHorseRiderSharedParams : CHorseRiderSharedParams;
if (!thePlayer){
if (!super.IsCommandToMountDelayed()){
super.SetCommandToMountDelayed(true);
commandToMountActorToMount = actorToMount;
commandToMountMountType = mountType;
commandToMountVehicleSlot = vehicleSlot;
}
return;
}
if (actorToMount != thePlayer){
return;
}
super.SetCommandToMountDelayed(false);
if ((W3HorseComponent)this){

playerHorseRiderSharedParams = thePlayer.GetRiderData().
sharedParams;
if (playerHorseRiderSharedParams.mountStatus == 3){
(CR4PlayerStateMountHorse)thePlayer.GetState('Mo
untHorse').SetupState(this, mountType, 0);
thePlayer.GotoState('MountHorse', /* NOP */, /*
NOP */);
}
} else if ((CBoatComponent)this){
(CR4PlayerStateMountBoat)thePlayer.GetState('MountBoat')
.SetupState(this, mountType, vehicleSlot);
thePlayer.GotoState('MountBoat', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function IssueCommandToUseVehicle(){
var riderData : CAIStorageRiderData;
riderData = thePlayer.GetRiderData();
if (riderData.sharedParams.vehicleSlot == 0){
(CR4PlayerStateUseGenericVehicle)thePlayer.GetState(main
StateName).SetVehicle(this);
thePlayer.GotoState(mainStateName, false, /* NOP */);
} else if (passengerStateName){
(CR4PlayerStateUseGenericVehicle)thePlayer.GetState(pass
engerStateName).SetVehicle(this);
thePlayer.GotoState(passengerStateName, false, /* NOP */
);
}
/* NOP */;
}
public function IssueCommandToDismount(dismountType : EDismountType){
var riderData : CAIStorageRiderData;
var boatComponent : CBoatComponent;
riderData = thePlayer.GetRiderData();
if ((W3HorseComponent)this){
(CPlayerStateDismountTheVehicle)thePlayer.GetState('Dism
ountHorse').SetupState(this, dismountType);
if (riderData.sharedParams.vehicleSlot == 0){
(CR4PlayerStateUseGenericVehicle)thePlayer.GetSt
ate(mainStateName).DismountVehicle();
} else if (passengerStateName){
(CR4PlayerStateUseGenericVehicle)thePlayer.GetSt
ate(passengerStateName).DismountVehicle();
}
} else if ((CBoatComponent)this){
boatComponent = (CBoatComponent)this;
if (riderData.sharedParams.vehicleSlot == 0){
boatComponent.dismountStateName = mainStateName;
boatComponent.StopAndDismountBoat();
} else if (passengerStateName){
(CR4PlayerStateUseGenericVehicle)thePlayer.GetSt
ate(passengerStateName).DismountVehicle();
}
}
/* NOP */;
}
public function TeleportAndMount(entity : CEntity){
var slotPosition : Vector;
var slotHeading : Float;
var slotRotation : EulerAngles;

slotRotation.Yaw = slotHeading;
super.GetSlotPositionAndHeading(0, slotPosition, slotHeading);
entity.TeleportWithRotation(slotPosition, slotRotation);
IssueCommandToApprochToSlot(entity);
/* NOP */;
}
public function CanAccesFastTravel(target : W3FastTravelEntity) : Bool{
return true;
/* NOP */;
}
public function InternalGetSpeed() : Float{
}
public function StopTheVehicle(){
}
public function UpdateLogic(){
}
public function SetIsPlayingSyncAnimation(val : Bool){
isPlayingSyncAnimation = val;
/* NOP */;
}
public function GetIsPlayingSyncAnimation() : Bool{
return isPlayingSyncAnimation;
/* NOP */;
}
public function SetCombatManager(combatManager : W3VehicleCombatManager)
{
userCombatManager = combatManager;
userCombatManager.OnMountFinished();
/* NOP */;
}
public function IsMounted() : Bool{
return user;
/* NOP */;
}
public function CanBeUsedBy(entity : CEntity) : Bool{
return !IsMounted() && entity == thePlayer;
/* NOP */;
}
public function ToggleVehicleCamera(val : Bool){
if (val != isCameraActivated){
isCameraActivated = val;
}
/* NOP */;
}
public function GetVehicleType() : EVehicleType{
if ((W3HorseComponent)this){
return 0;
} else if ((CBoatComponent)this){
return 1;
} else {
return 2;
}
/* NOP */;
}
public function AttachEntity(entity : CEntity, slot : CName) : Bool{
return entity.CreateAttachment(GetEntity(), slot, /* NOP */, /*
NOP */);
/* NOP */;
}
public latent function PlaySyncAnimWithUser(user : CActor, eventName : C

Name, deactivationEvent : CName){


SetIsPlayingSyncAnimation(true);
if (user.RaiseForceEventWithoutTestCheck(eventName)){
if (GetEntity().RaiseForceEventWithoutTestCheck(eventNam
e)){
}
user.WaitForBehaviorNodeDeactivation(deactivationEvent,
10.000000);
}
SetIsPlayingSyncAnimation(false);
/* NOP */;
}
public final function GetSlotPositionAndHeading(slotNumber : Int32, posi
tion : Vector, heading : Float){
LogAssert(slotNumber < slots.Size(), "CVehicleComponent: GetSlot
PositionAndHeading, 'slotNumber < slots.Size()");
position = slots[slotNumber];
heading = position.W;
position.W = 1.000000;
position = VecTransform(GetLocalToWorld(), position);
heading = GetHeading() + heading;
/* NOP */;
}
protected final function SetVariable(varName : CName, varValue : Float){
GetEntity().SetBehaviorVariable(varName, varValue, /* NOP */);
if (user){
user.SetBehaviorVariable(varName, varValue, /* NOP */);
}
/* NOP */;
}
protected final function GetVariable(varName : CName) : Float{
return GetEntity().GetBehaviorVariable(varName, /* NOP */);
/* NOP */;
}
protected final function GenerateEvent(eventName : CName){
var tmp : CEntity;
tmp = GetEntity();
tmp.RaiseEventWithoutTestCheck(eventName);
if (user){
user.RaiseEvent(eventName);
}
/* NOP */;
}
public function IsMountingPossible() : Bool{
return !user;
/* NOP */;
}
public function GetUser() : CActor{
return user;
/* NOP */;
}
}
statemachine class W3VehicleCombatManager extends CEntity{
protected var rider : CR4Player;
protected var vehicle : CVehicleComponent;
protected var isInCombatAction : Bool;
protected var wasBombReleased : Bool;
public function Setup(player : CR4Player, _vehicle : CVehicleComponent){
rider = player;

vehicle = _vehicle;
if (rider){
theInput.RegisterListener(this, 'OnItemAction', 'Vehicle
ItemAction');
theInput.RegisterListener(this, 'OnItemActionHold', 'Veh
icleItemActionHold');
theInput.RegisterListener(this, 'OnItemActionAbort', 'Ve
hicleItemActionAbort');
theInput.RegisterListener(this, 'OnCastSign', 'VehicleCa
stSign');
theInput.RegisterListener(this, 'OnAttack', 'VehicleAtta
ck');
}
/* NOP */;
}
public function IsInCombatAction() : Bool{
return isInCombatAction;
/* NOP */;
}
public function IsInSwordAttackCombatAction() : Bool{
return GetCurrentStateName() == 'SwordAttack';
/* NOP */;
}
public function OnRaiseSignEvent() : Bool{
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
return false;
/* NOP */;
}
public function OnAirBorn() : Bool{
}
public function OnLanded() : Bool{
}
public function OnProcessAnimEvent(animEventName : CName) : Bool{
}
public function OnItemActionAbort(action : SInputAction) : Bool{
}
public function OnHorseActionStart() : Bool{
}
public function OnHorseActionStop() : Bool{
}
public function OnMeleeWeaponReady() : Bool{
}
public function OnMeleeWeaponNotReady() : Bool{
}
public function OnHitStart() : Bool{
}
public function OnCombatActionEnd() : Bool{
}
public function OnMountFinished() : Bool{
}
public function OnDismountStarted() : Bool{
GotoStateAuto();
/* NOP */;
}
public function OnDrawWeaponRequest() : Bool{
}
}

import abstract class CAdvancedVehicleComponent{


}
import abstract class CPilotComponent{
}
state CBoatBodyComponentStateIdle in CBoatBodyComponent extends CScriptableState
{
public function OnCutsceneStarted() : Bool{
parent.PushState('Cutscene');
/* NOP */;
}
}
state CBoatBodyComponentStateCutscene in CBoatBodyComponent extends CScriptableS
tate{
public function OnEnterState(prevStateName : CName) : Bool{
parent.TriggerCutsceneStart();
/* NOP */;
}
public function OnCutsceneEnded() : Bool{
parent.TriggerCutsceneEnd();
parent.PopState(false);
/* NOP */;
}
}
import statemachine struct CBoatComponent{
private var effects : ParticleEffectNames;
private var boatEntity : W3Boat;
private var passenger : CActor;
public var sailTilt : Float;
private var sailAnim : CAnimatedComponent;
private var boatAnim : CAnimatedComponent;
private var rudderDir : Float;
private var isChangingSteer : Bool;
private var steerSound : Bool;
private var enableCustomMastRotation : Bool;
public const var IDLE_SPEED_THRESHOLD : Float;
private const var MAST_PARTICLE_THRESHOLD : Float;
private const var TILT_PARTICLE_THRESHOLD : Float;
private const var DIVING_PARTICLE_THRESHOLD : Float;
private const var RUDDER_DIR_THRESHOLD : Float;
private const var WATER_THRESHOLD : Float;
private const var MAST_ROTX_THRESHOLD : Float;
private const var MAST_ROT_SAIL_VAL : Float;
private var fr : Vector;
private var ba : Vector;
private var ri : Vector;
private var le : Vector;
private var prevTurnFactorX : Float;
private var previousGear : Int32;
private var prevMastPosZ : Float;
private var prevMastVelZ : Float;
private var prevFrontPosZ : Float;
private var prevFrontVelZ : Float;
private var prevRightPosZ : Float;
private var prevRightVelZ : Float;
private var prevLeftPosZ : Float;
private var prevLeftVelZ : Float;

private var prevBackPosZ : Float;


private var prevBackVelZ : Float;
private var prevFrontWaterPosZ : Float;
private var sphereSize : Float;
private var mastSlotTransform : Matrix;
private var frontSlotTransform : Matrix;
private var backSlotTransform : Matrix;
private var rightSlotTransform : Matrix;
private var leftSlotTransform : Matrix;
private var wasSailFillSoundPlayed : Bool;
private var boatMastTrailLoopStarted : Bool;
public var dismountStateName : CName;
//NULL type for mountAnimationFinished
//NULL type for sailDir
import public final function GetBuoyancyPointStatus_Front() : Vector;
import public final function GetBuoyancyPointStatus_Back() : Vector;
import public final function GetBuoyancyPointStatus_Right() : Vector;
import public final function GetBuoyancyPointStatus_Left() : Vector;
import public function GetLinearVelocityXY() : Float;
import public function GetBoatBodyMass() : Float;
import public function StopAndDismountBoat();
import public function UseOutOfFrustumTeleportation(enable : Bool);
import public function TriggerCutsceneStart();
import public function TriggerCutsceneEnd();
import public final function TriggerDrowning(globalHitPosition : Vector)
;
import public final function IsDrowning() : Bool;
import public final function MountStarted();
import public final function DismountFinished();
import public final function GetCurrentGear() : Int32;
import public final function GetCurrentSpeed() : Vector;
import public final function GameCameraTick(fovDistPitch : Vector, offse
tZ : Float, sailOffset : Float, dt : Float, passenger : Bool) : Bool;
import public final function GetMaxSpeed() : Float;
public function OnComponentAttached() : Bool{
GotoStateAuto();
/* NOP */;
}
public function OnTriggerBoatDismountAnim() : Bool{
thePlayer.BlockAction(33, 'DismountVehicle2', /* NOP */, /* NOP
*/, /* NOP */);
(CR4PlayerStateUseGenericVehicle)thePlayer.GetState(dismountStat
eName).DismountVehicle();
/* NOP */;
}
public function OnDismountImediete() : Bool{
IssueCommandToDismount(8);
/* NOP */;
}
public function OnInit() : Bool{
boatEntity = super.GetBoatEntity();
if (!boatEntity){
LogBoatFatal("Entity doesn't exist.");
return false;
}
if (InitializeComponents(boatEntity)){
InitializeSlots();
boatEntity.ApplyAppearance('default');
}
/* NOP */;

}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (!user && IsMountPossible()){
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
Mount(thePlayer, 2, 0);
}
/* NOP */;
}
public function OnInteractionPassenger(){
if (!passenger && IsMountPossible()){
thePlayer.OnEquipMeleeWeapon(0, true, /* NOP */);
Mount(thePlayer, 2, 1);
}
/* NOP */;
}
public function IsMountPossible() : Bool{
return thePlayer.IsActionAllowed(42);
/* NOP */;
}
public function OnDrowningDismount() : Bool{
canBoardTheBoat = false;
GetEntity().AddTimer('DrowningDismount', 2.000000, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnDrowningFinished() : Bool{
GetEntity().StopAllEffects();
/* NOP */;
}
public function OnMountStarted(entity : CEntity, vehicleSlot : EVehicleS
lot) : Bool{
if (vehicleSlot == 1){
passenger = (CActor)entity;
}
mountAnimationFinished = false;
boatEntity.GetMountInteractionComponent(/* NOP */).SetEnabled(fa
lse);
UpdateHigherMast(0.000000);
super.OnMountStarted(entity, vehicleSlot);
super.MountStarted();
/* NOP */;
}
public function OnMountFinished(entity : CEntity) : Bool{
mountAnimationFinished = true;
boatEntity.SoundEvent("boat_sail_water_loop", /* NOP */, /* NOP
*/);
boatEntity.SoundEvent("boat_sail_flapping_loop", /* NOP */, /* N
OP */);
enableCustomMastRotation = true;
theSound.EnterGameState(14);
super.OnMountFinished(entity);
/* NOP */;
}
public function OnDismountStarted(entity : CEntity) : Bool{
mountAnimationFinished = false;
entity.StopEffectIfActive('fake_wind_right');
entity.StopEffectIfActive('fake_wind_left');
entity.StopEffectIfActive('fake_wind_back');
boatEntity.SoundEvent("boat_sail_water_loop_stop", /* NOP */, /*

NOP */);
boatEntity.SoundEvent("boat_sail_flapping_loop_stop", /* NOP */,
/* NOP */);
UpdateHigherMast(1.000000);
enableCustomMastRotation = false;
theSound.LeaveGameState(14);
super.OnDismountStarted(entity);
/* NOP */;
}
public function OnDismountFinished(entity : CEntity, vehicleSlot : EVehi
cleSlot) : Bool{
boatEntity.GetMountInteractionComponent(/* NOP */).SetEnabled(tr
ue);
mountAnimationFinished = false;
if (vehicleSlot == 1){
passenger = NULL;
}
super.OnDismountFinished(entity, vehicleSlot);
super.DismountFinished();
/* NOP */;
}
public function GetPassenger() : CActor{
return passenger;
/* NOP */;
}
public function OnTick(dt : Float) : Bool{
var currentFrontPosZ : Float;
var currentFrontVelZ : Float;
var currentFrontAccZ : Float;
var currentRightPosZ : Float;
var currentRightVelZ : Float;
var currentRightAccZ : Float;
var currentMastPosZ : Float;
var currentMastVelZ : Float;
var sailingMaxSpeed : Float;
var currentSpeed : Float;
var isMoving : Bool;
var tilt : Float;
var turnFactor : Float;
var currentGear : Int32;
var fDiff : Float;
var bDiff : Float;
var rDiff : Float;
var lDiff : Float;
if (dt <= 0.000000){
LogBoat("!!!!!!!!!!!!! dt <= 0.f !!!!!!!!!!!!!");
return false;
}
if (!boatEntity){
LogBoatFatal("Entity not set in CBoatComponent::OnTick e
vent.");
return false;
}
fr = super.GetBuoyancyPointStatus_Front();
ba = super.GetBuoyancyPointStatus_Back();
ri = super.GetBuoyancyPointStatus_Right();
le = super.GetBuoyancyPointStatus_Left();
fDiff = fr.Z - fr.W;
bDiff = ba.Z - ba.W;
rDiff = ri.Z - ri.W;

lDiff = le.Z - le.W;


tilt = le.Z - ri.Z;
sailDir = tilt * dt;
sailTilt = tilt;
boatEntity.CalcEntitySlotMatrix('front_splash', frontSlotTransfo
rm);
currentFrontPosZ = frontSlotTransform.W.Z;
currentFrontVelZ = currentFrontPosZ - prevFrontPosZ;
currentFrontAccZ = currentFrontVelZ - prevFrontVelZ;
boatEntity.CalcEntitySlotMatrix('mast_trail', mastSlotTransform)
;
currentMastPosZ = mastSlotTransform.W.Z;
if (tilt > 0.000000){
currentMastVelZ = currentMastPosZ - ri.W;
} else {
currentMastVelZ = currentMastPosZ - le.W;
}
isMoving = GetLinearVelocityXY() > IDLE_SPEED_THRESHOLD;
sailingMaxSpeed = super.GetMaxSpeed();
if (isMoving){
boatEntity.StopEffectIfActive('idle_splash');
currentSpeed = GetLinearVelocityXY() / sailingMaxSpeed;
if (IsInWater(ri) && rDiff < TILT_PARTICLE_THRESHOLD){
boatEntity.PlayEffectSingle('right_splash_strong
er', /* NOP */);
} else {
boatEntity.StopEffectIfActive('right_splash_stro
nger');
}
if (IsInWater(le) && lDiff < TILT_PARTICLE_THRESHOLD){
boatEntity.PlayEffectSingle('left_splash_stronge
r', /* NOP */);
} else {
boatEntity.StopEffectIfActive('left_splash_stron
ger');
}
if (currentMastVelZ < MAST_PARTICLE_THRESHOLD){
boatEntity.PlayEffectSingle('mast_trail', /* NOP
*/);
if (!boatEntity.SoundIsActiveName('boat_mast_tra
il_loop') && !boatMastTrailLoopStarted){
boatEntity.SoundEvent('boat_mast_trail_l
oop', 'mast_trail', true);
boatMastTrailLoopStarted = true;
}
} else {
boatEntity.StopEffectIfActive('mast_trail');
if (boatEntity.SoundIsActiveName('boat_mast_trai
l_loop') && boatMastTrailLoopStarted){
if (!boatEntity.SoundIsActiveName('boat_
mast_trail_loop_stop')){
boatEntity.SoundEvent('boat_mast
_trail_loop_stop', 'mast_trail', true);
boatMastTrailLoopStarted = false
;
}
}
}
if (IsDiving(currentFrontVelZ, prevFrontWaterPosZ, fDiff
)){

boatEntity.SoundEvent("boat_stress", /* NOP */,


/* NOP */);
if (!boatEntity.IsEffectActive('front_splash', /
* NOP */)){
boatEntity.SoundEvent("boat_water_splash
_soft", /* NOP */, /* NOP */);
boatEntity.PlayEffect('front_splash', /*
NOP */);
}
}
} else {
if (IsInWater(le) && IsInWater(ri) && IsInWater(fr) && I
sInWater(ba) && !boatEntity.IsEffectActive('idle_splash', /* NOP */)){
boatEntity.PlayEffect('idle_splash', /* NOP */);
}
SwitchEffectsByGear(0);
boatEntity.StopEffectIfActive('front_splash');
boatEntity.StopEffectIfActive('mast_trail');
boatEntity.StopEffectIfActive('right_splash_stronger');
boatEntity.StopEffectIfActive('left_splash_stronger');
boatEntity.StopEffectIfActive('fake_wind_right');
boatEntity.StopEffectIfActive('fake_wind_left');
boatEntity.StopEffectIfActive('fake_wind_back');
currentSpeed = 0.000000;
}
currentGear = super.GetCurrentGear();
if (passenger){
UpdatePassengerSailAnimByGear(currentGear);
}
if (IsInWater(le) && IsInWater(ri) && IsInWater(fr) && IsInWater
(ba) && currentGear != previousGear){
SwitchEffectsByGear(currentGear);
}
UpdateMastPositionAndRotation(currentGear, tilt, isMoving);
UpdateSoundParams(currentSpeed);
previousGear = currentGear;
prevFrontWaterPosZ = fr.W;
prevFrontPosZ += currentFrontVelZ;
prevFrontVelZ = currentFrontVelZ;
prevMastPosZ += currentMastVelZ;
prevMastVelZ = currentMastVelZ;
prevRightPosZ += currentRightVelZ;
prevRightVelZ = currentRightVelZ;
if (thePlayer.IsOnBoat() && !thePlayer.IsUsingVehicle()){
if (GetWeatherConditionName() == 'WT_Rain_Storm'){
if (thePlayer.GetBehaviorVariable('bRainStormIdl
eAnim', /* NOP */) != 1.000000){
thePlayer.SetBehaviorVariable('bRainStor
mIdleAnim', 1.000000, /* NOP */);
}
} else if (thePlayer.GetBehaviorVariable('bRainStormIdle
Anim', /* NOP */) != 0.000000){
thePlayer.SetBehaviorVariable('bRainStormIdleAni
m', 0.000000, /* NOP */);
}
}
/* NOP */;
}
public final function SetRudderDir(rider : CActor, value : Float){
var aimHorizontal : Float;

var item : SItemUniqueId;


var change : Float;
if (rider == thePlayer){
item = rider.GetInventory().GetItemFromSlot('l_weapon');
if (rider.GetInventory().IsIdValid(item) && rider.GetInv
entory().IsItemCrossbow(item) || thePlayer.GetThrownEntity()){
boatAnim.SetBehaviorVariable('isWeaponInWaitStat
e', 0.000000);
aimHorizontal = rider.GetBehaviorVariable('aimHo
rizontal', /* NOP */);
boatAnim.SetBehaviorVariable('aimHorizontal', ai
mHorizontal);
if (rider.GetInventory().IsItemCrossbow(item) &&
thePlayer.rangedWeapon.GetCurrentStateName() == 'State_WeaponReload' || aimHori
zontal <= -0.250000){
boatAnim.SetBehaviorVariable('latchRudde
rControl', 1.000000);
rider.SetBehaviorVariable('latchRudderCo
ntrol', 1.000000, /* NOP */);
} else {
boatAnim.SetBehaviorVariable('latchRudde
rControl', 0.000000);
rider.SetBehaviorVariable('latchRudderCo
ntrol', 0.000000, /* NOP */);
}
} else {
boatAnim.SetBehaviorVariable('isWeaponInWaitStat
e', 1.000000);
}
}
change = AbsF(rudderDir - value);
if (change > RUDDER_DIR_THRESHOLD){
boatAnim.SetBehaviorVariable('rudderAngle', value);
rider.SetBehaviorVariable('rudderDir', value, /* NOP */)
;
if (!boatEntity.SoundIsActiveName('boat_steering_loop'))
{
boatEntity.SoundEvent('boat_steering_loop', /* N
OP */, /* NOP */);
}
steerSound = true;
} else if (steerSound){
boatEntity.SoundEvent('boat_steering_loop_stop', /* NOP
*/, /* NOP */);
steerSound = false;
}
rudderDir = value;
/* NOP */;
}
private function IsDiving(curVel : Float, cachedWaterPosZ : Float, under
Water : Float) : Bool{
var ret : Bool;
ret = false;
if (underWater < 0.000000 && cachedWaterPosZ > 0.000000 && curVe
l < -DIVING_PARTICLE_THRESHOLD){
ret = true;
}
return ret;
/* NOP */;
}

private function InitializeSlots() : Bool{


var ret : Bool;
ret = false;
prevFrontPosZ = 0.000000;
prevFrontVelZ = 0.000000;
prevMastPosZ = 0.000000;
prevMastVelZ = 0.000000;
prevRightPosZ = 0.000000;
prevRightVelZ = 0.000000;
prevLeftPosZ = 0.000000;
prevLeftVelZ = 0.000000;
if (boatEntity.CalcEntitySlotMatrix('front_splash', frontSlotTra
nsform)){
prevFrontPosZ = frontSlotTransform.W.Z;
ret = true;
} else {
LogBoat("no splash_point_l slot in boat entity");
return false;
}
if (boatEntity.CalcEntitySlotMatrix('right_splash', rightSlotTra
nsform)){
prevRightPosZ = rightSlotTransform.W.Z;
ret = true;
} else {
LogBoat("no right_splash slot in boat entity");
return false;
}
if (boatEntity.CalcEntitySlotMatrix('left_splash', leftSlotTrans
form)){
prevLeftPosZ = leftSlotTransform.W.Z;
ret = true;
} else {
LogBoat("no left_splash slot in boat entity");
return false;
}
if (boatEntity.CalcEntitySlotMatrix('back_splash', backSlotTrans
form)){
prevBackPosZ = backSlotTransform.W.Z;
ret = true;
} else {
LogBoat("no back_splash slot in boat entity");
return false;
}
if (boatEntity.CalcEntitySlotMatrix('mast_trail', mastSlotTransf
orm)){
prevMastPosZ = mastSlotTransform.W.Z;
ret = true;
} else {
LogBoat("no water_trial slot in boat entity");
return false;
}
return ret;
/* NOP */;
}
private function InitializeComponents(e : CEntity) : Bool{
var ret : Bool;
ret = false;
if (!e){
LogBoatFatal("Entity doesn't exist.");
return false;

} else {
boatAnim = (CAnimatedComponent)e.GetComponent('mast_and_
steer');
sailAnim = (CAnimatedComponent)e.GetComponent('sail');
ret = true;
}
return ret;
/* NOP */;
}
public function UpdateHigherMast(mastHeight : Float) : Bool{
if (!boatAnim){
LogBoatFatal("Entity doesn't have mast_and_steer animate
d component, modification aborted.");
return false;
}
boatAnim.SetBehaviorVariable('upperMastHeight', mastHeight);
return true;
/* NOP */;
}
private function UpdateMast(mastAngle : Float, mastHeight : Float, rotat
ionSpeed : Float) : Bool{
if (!boatAnim){
LogBoatFatal("Entity doesn't have mast_and_steer animate
d component, modification aborted.");
return false;
}
boatAnim.SetBehaviorVariable('mastAngle', mastAngle);
boatAnim.SetBehaviorVariable('mastHeight', mastHeight);
boatAnim.SetBehaviorVariable('mastRotationSpeed', rotationSpeed)
;
return true;
/* NOP */;
}
public final function GetBoatEntity() : W3Boat{
return (W3Boat)GetEntity();
/* NOP */;
}
private function UpdateSoundParams(value : Float){
var scaler : Float;
scaler = 0.800000;
value = ClampF(value, 0.000000, 1.000000);
boatEntity.SoundParameter("boat_speed", value, /* NOP */, /* NOP
*/, /* NOP */);
boatEntity.SoundParameter("boat_speed", value, 'mast_trail', 0,
true);
value = ClampF(value * scaler, 0.000000, 1.000000);
boatEntity.SoundParameter("boat_sail_intensity", value, /* NOP *
/, /* NOP */, /* NOP */);
/* NOP */;
}
private function UpdatePassengerSailAnimByGear(currentGear : Int32){
passenger.SetBehaviorVariable('currentGear', currentGear, /* NOP
*/);
/* NOP */;
}
private function IsInWater(vec : Vector) : Bool{
return vec.Z - vec.W < WATER_THRESHOLD;
/* NOP */;
}
public function OnBoatDismountRequest() : Bool{

boatEntity.StopEffectIfActive(effects.rightSplash);
boatEntity.StopEffectIfActive(effects.leftSplash);
boatEntity.StopEffectIfActive(effects.backSplash);
/* NOP */;
}
private function SwitchEffectsByGear(currentGear : Int32){
boatEntity.StopEffectIfActive(effects.rightSplash);
boatEntity.StopEffectIfActive(effects.leftSplash);
boatEntity.StopEffectIfActive(effects.backSplash);
if (currentGear != 0){
switch(currentGear){
case 1:
effects.rightSplash = 'right_splash_slow';
effects.leftSplash = 'left_splash_slow';
effects.backSplash = 'back_splash_slow';
break;
case 2:
effects.rightSplash = 'right_splash_normal';
effects.leftSplash = 'left_splash_normal';
effects.backSplash = 'back_splash_normal';
break;
case 3:
effects.rightSplash = 'right_splash_fast';
effects.leftSplash = 'left_splash_fast';
effects.backSplash = 'back_splash_fast';
break;
}
boatEntity.PlayEffectSingle(effects.rightSplash, /* NOP
*/);
boatEntity.PlayEffectSingle(effects.leftSplash, /* NOP *
/);
boatEntity.PlayEffectSingle(effects.backSplash, /* NOP *
/);
}
/* NOP */;
}
private function UpdateMastPositionAndRotation(gear : Int32, angle : Flo
at, isMoving : Bool){
var mastRot : Float;
mastRot = CalcMastRotation(angle, isMoving, gear);
if (isMoving){
if (!wasSailFillSoundPlayed){
wasSailFillSoundPlayed = true;
boatEntity.SoundEvent("boat_sail_fill", /* NOP *
/, /* NOP */);
}
if (gear == 3){
UpdateMast(mastRot, 1.000000, 0.200000);
} else if (gear == 2){
UpdateMast(mastRot, 0.400000, 0.500000);
} else if (gear != 0){
UpdateMast(mastRot, 0.000000, 1.000000);
}
} else {
UpdateMast(mastRot, 0.000000, 1.000000);
wasSailFillSoundPlayed = false;
}
/* NOP */;
}
private function CalcMastRotation(val : Float, isMoving : Bool, gear : I

nt32) : Float{
var turnFactorY : Float;
var turnFactorX : Float;
if (enableCustomMastRotation){
turnFactorX = theInput.GetActionValue('GI_AxisLeftX');
turnFactorY = theInput.GetActionValue('GI_AxisLeftY');
}
if (isMoving){
if (turnFactorX < MAST_ROTX_THRESHOLD && turnFactorX > MAST_ROTX_THRESHOLD){
if (turnFactorX <= 0.000000){
val = MAST_ROT_SAIL_VAL * prevTurnFactor
X;
} else {
val = MAST_ROT_SAIL_VAL * prevTurnFactor
X;
}
} else if (turnFactorX < -MAST_ROTX_THRESHOLD){
val = 1.000000;
prevTurnFactorX = val;
} else if (turnFactorX > MAST_ROTX_THRESHOLD){
val = -1.000000;
prevTurnFactorX = val;
}
if (gear != -1){
boatEntity.StopEffectIfActive('fake_wind_back');
if (val <= -MAST_ROTX_THRESHOLD){
boatEntity.StopEffectIfActive('fake_wind
_right');
boatEntity.PlayEffectSingle('fake_wind_l
eft', /* NOP */);
} else if (val >= MAST_ROTX_THRESHOLD){
boatEntity.StopEffectIfActive('fake_wind
_left');
boatEntity.PlayEffectSingle('fake_wind_r
ight', /* NOP */);
}
} else {
boatEntity.StopEffectIfActive('fake_wind_left');
boatEntity.StopEffectIfActive('fake_wind_right')
;
boatEntity.PlayEffectSingle('fake_wind_back', /*
NOP */);
}
}
thePlayer.GetVisualDebug().AddText('fake_wind', "fake_wind: " +
val, fr - 1.500000, true, 0, Color(0, 255, 0), true, /* NOP */);
return val;
/* NOP */;
}
public function GetSailDir() : Float{
return sailDir;
/* NOP */;
}
public function GetSailTilt() : Float{
return sailTilt;
/* NOP */;
}
public function OnCutsceneStarted() : Bool{
}

public function OnCutsceneEnded() : Bool{


}
public function IsMountingPossible() : Bool{
return !user || !passenger;
/* NOP */;
}
}
struct ParticleEffectNames{
var rightSplash : CName;
var leftSplash : CName;
var backSplash : CName;
}
import struct W3Boat{
private autobind boatComp : CBoatComponent = single;
private autobind mountInteractionComp : CInteractionComponent = "mountEx
plorationInteraction";
private autobind mountInteractionCompPassenger : CInteractionComponent =
"mountExplorationInteractionPassenger";
private var hasDrowned : Bool;
private saved var canBeDestroyed : Bool;
private var needEnableInteractions : Bool;
import public final function SetTeleportedFromOtherHUB(val : Bool);
public function OnStreamOut() : Bool{
if (theGame.IsBoatMarkedForDestroy(this)){
AddTimer('DelayedDestroyBoat', 0.100000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function DelayedDestroyBoat(optional td : Float, optional i
d : Int32){
RemoveTimer('DelayedDestroyBoat', /* NOP */);
Destroy();
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var player : CR4Player;
player = (CR4Player)activator.GetEntity();
if (player){
if (area.GetName() == "FirstDiscoveryTrigger"){
area.SetEnabled(false);
} else if (area.GetName() == "OnBoatTrigger"){
player.SetIsOnBoat(true);
player.BlockAction(14, 'OnBoatTrigger', false, f
alse, true);
player.BlockAction(4, 'OnBoatTrigger', false, fa
lse, true);
if (!HasDrowned()){
needEnableInteractions = true;
if (mountInteractionComp){
mountInteractionComp.SetEnabled(
true);
}
if (mountInteractionCompPassenger && boa
tComp.user){
mountInteractionCompPassenger.Se
tEnabled(true);

}
}
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var player : CR4Player;
player = (CR4Player)activator.GetEntity();
if (player){
if (area.GetName() == "OnBoatTrigger"){
player.SetIsOnBoat(false);
player.UnblockAction(14, 'OnBoatTrigger');
player.UnblockAction(4, 'OnBoatTrigger');
player.SetBehaviorVariable('bRainStormIdleAnim',
0.000000, /* NOP */);
needEnableInteractions = false;
if (mountInteractionComp){
mountInteractionComp.SetEnabled(false);
}
if (mountInteractionCompPassenger){
mountInteractionCompPassenger.SetEnabled
(false);
}
}
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (interactionComponentName == "mountExplorationInteraction" ||
interactionComponentName == "mountExplorationInteractionPassenger" && activator
== thePlayer && !HasDrowned()){
if (!thePlayer.IsActionAllowed(42)){
return false;
}
return true;
}
/* NOP */;
}
public function OnInteractionAttached(interaction : CInteractionComponen
t) : Bool{
interaction.SetEnabled(needEnableInteractions);
/* NOP */;
}
public timer function DrowningDismount(optional dt : Float, optional id
: Int32){
if (!boatComp){
LogBoatFatal("Entity doesn't have boat component.");
return;
}
boatComp.IssueCommandToDismount(1);
/* NOP */;
}
public function HasDrowned() : Bool{
return hasDrowned;
/* NOP */;
}
public function SetHasDrowned(val : Bool){

hasDrowned = val;
/* NOP */;
}
public function OnStreamIn() : Bool{
}
public function GetBoatComponent() : CBoatComponent{
return boatComp;
/* NOP */;
}
public function GetMountInteractionComponent(forPassenger : Bool) : CInt
eractionComponent{
if (forPassenger){
return mountInteractionCompPassenger;
} else {
return mountInteractionComp;
}
/* NOP */;
}
public function SetCanBeDestroyed(val : Bool){
canBeDestroyed = val;
/* NOP */;
}
public function GetCanBeDestroyed() : Bool{
return canBeDestroyed;
/* NOP */;
}
}
state CBoatComponentStateIdle in CBoatComponent extends CScriptableState{
public function OnCutsceneStarted() : Bool{
parent.PushState('Cutscene');
/* NOP */;
}
}
state CBoatComponentStateCutscene in CBoatComponent extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.TriggerCutsceneStart();
/* NOP */;
}
public function OnCutsceneEnded() : Bool{
parent.TriggerCutsceneEnd();
parent.PopState(false);
/* NOP */;
}
}
import struct CBoatDestructionComponent{
private var boatComponent : CBoatComponent;
private editable var collisionForceThreshold : Float;
public editable saved var partsConfig : array<SBoatPartsConfig>;
private var attachedSirens : array<CActor>;
private var freeSirenGrabSlots : array<CName>;
private var lockedSirenGrabSlots : array<CName>;
//NULL type for destructionVolumes
public function OnComponentAttached() : Bool{
var ent : CEntity;
ent = GetEntity();
boatComponent = (CBoatComponent)ent.GetComponentByClassName('CBo
atComponent');

lockedSirenGrabSlots.Clear();
freeSirenGrabSlots.Clear();
freeSirenGrabSlots.PushBack('siren_grab_01');
freeSirenGrabSlots.PushBack('siren_grab_02');
freeSirenGrabSlots.PushBack('siren_grab_03');
freeSirenGrabSlots.PushBack('siren_grab_04');
freeSirenGrabSlots.PushBack('siren_grab_05');
freeSirenGrabSlots.PushBack('siren_grab_06');
/* NOP */;
}
public function OnLoadGameDropDestructableParts(areaIndex : Int32) : Boo
l{
var i : Int32;
var idxParts : Int32;
var drop : CDropPhysicsComponent;
var dropCompName : String;
var comp : CComponent;
var rigidMeshComp : CRigidMeshComponent;
drop = (CDropPhysicsComponent)GetEntity().GetComponentByClassNam
e('CDropPhysicsComponent');
idxParts = -1;
i = 0;
while (i < partsConfig.Size()){
if (partsConfig[i].destructionVolumeIndex == areaIndex){
idxParts = i;
break;
}
i += 1;
}
if (idxParts >= 0){
i = 0;
while (i < partsConfig[idxParts].parts.Size()){
if (destructionVolumes[areaIndex].areaHealth <=
partsConfig[idxParts].parts[i].hpFalloffThreshold && !partsConfig[idxParts].part
s[i].isPartDropped){
dropCompName = partsConfig[idxParts].par
ts[i].componentName;
comp = GetEntity().GetComponent(dropComp
Name);
rigidMeshComp = (CRigidMeshComponent)com
p;
rigidMeshComp.EnableBuoyancy(false);
drop.DropMeshByName(dropCompName, VecFro
mHeading(GetEntity().GetHeading()), PartNameToCurveName(dropCompName));
partsConfig[idxParts].parts[i].isPartDro
pped = true;
PlayEffectBasedOnDropCompName(dropCompNa
me);
}
i += 1;
}
}
/* NOP */;
}
public function GetClosestFreeGrabSlotInfo(_ActorPosition : Vector, _Act
orHeading : Float, _ClosestSlotName : CName, _Position : Vector, _Heading : Floa
t) : Bool{
var i : Int32;
var l_slotMatrix : Matrix;
var l_slotPos : Vector;

var l_closestDistance : Float;


var l_closestMatrix : Matrix;
var l_closestPos : Vector;
var l_distance : Float;
var l_npcPos : Vector;
var l_slotRotation : EulerAngles;
var l_slotForward : Vector;
var l_slotName : CName;
var l_angleDistance : Float;
if (freeSirenGrabSlots.Size() == 0){
return false;
}
l_closestDistance = 999;
i = 0;
while (i < freeSirenGrabSlots.Size()){
l_slotName = freeSirenGrabSlots[i];
GetEntity().CalcEntitySlotMatrix(l_slotName, l_slotMatri
x);
l_slotPos = MatrixGetTranslation(l_slotMatrix);
l_distance = VecDistance(_ActorPosition, l_slotPos);
if (l_distance < l_closestDistance){
l_closestDistance = l_distance;
l_closestPos = l_slotPos;
l_closestMatrix = l_slotMatrix;
_ClosestSlotName = l_slotName;
}
i += 1;
}
l_slotRotation = MatrixGetRotation(l_closestMatrix);
l_slotForward = RotForward(l_slotRotation);
_Heading = VecHeading(l_slotForward);
_Position = l_closestPos;
l_angleDistance = AngleDistance(_ActorHeading, _Heading);
if (AbsF(l_angleDistance) > 85){
_ClosestSlotName = 'None';
return false;
}
return true;
/* NOP */;
}
public function LockGrabSlot(_SlotName : CName){
if (!IsNameValid(_SlotName)){
return;
}
freeSirenGrabSlots.Remove(_SlotName);
if (!lockedSirenGrabSlots.Contains(_SlotName)){
lockedSirenGrabSlots.PushBack(_SlotName);
}
/* NOP */;
}
public function AttachSiren(_SirenToAttach : CActor){
if (!attachedSirens.Contains(_SirenToAttach)){
attachedSirens.PushBack(_SirenToAttach);
}
/* NOP */;
}
public function DetachSiren(_SirenTodetach : CActor){
attachedSirens.Remove(_SirenTodetach);
/* NOP */;
}

public function FreeGrabSlot(_SlotName : CName){


if (!IsNameValid(_SlotName)){
return;
}
lockedSirenGrabSlots.Remove(_SlotName);
if (!freeSirenGrabSlots.Contains(_SlotName)){
freeSirenGrabSlots.PushBack(_SlotName);
}
/* NOP */;
}
public function OnBoatDestructionVolumeHit(globalHitPos : Vector, health
Taken : Float, areaVolumeIndex : Int32) : Bool{
DealDamage(healthTaken * 30.000000, areaVolumeIndex, globalHitPo
s);
/* NOP */;
}
public function DealDamage(dmg : Float, index : Int32, globalHitPos : Ve
ctor){
var i : Int32;
var drop : CDropPhysicsComponent;
var boat : W3Boat;
if (!boatComponent.user == thePlayer || boatComponent.GetPasseng
er()){
return;
}
ProcessBoatHitAnimation(index);
if (boatComponent.user == thePlayer || boatComponent.GetPassenge
r() == thePlayer){
theGame.VibrateControllerHard(/* NOP */);
}
boat = (W3Boat)GetEntity();
if (!boat.GetCanBeDestroyed()){
return;
}
if (index >= 0 && index < destructionVolumes.Size()){
ReduceHealth(dmg, index, globalHitPos);
return;
}
i = 0;
while (i < destructionVolumes.Size()){
ReduceHealth(dmg, i, globalHitPos);
i += 1;
}
/* NOP */;
}
private function ReduceHealth(dmg : Float, index : Int32, globalHitPos :
Vector){
var i : Int32;
var idxParts : Int32;
var drop : CDropPhysicsComponent;
var dropCompName : String;
var comp : CComponent;
var rigidMeshComp : CRigidMeshComponent;
drop = (CDropPhysicsComponent)GetEntity().GetComponentByClassNam
e('CDropPhysicsComponent');
if (dmg > 0 && boatComponent.user == thePlayer && ShouldProcessT
utorial('TutorialBoatDamage')){
FactsAdd("tutorial_boat_damaged", /* NOP */, /* NOP */);
}
destructionVolumes[index].areaHealth -= dmg;

idxParts = -1;
i = 0;
while (i < partsConfig.Size()){
if (partsConfig[i].destructionVolumeIndex == index){
idxParts = i;
break;
}
i += 1;
}
if (idxParts >= 0){
i = 0;
while (i < partsConfig[idxParts].parts.Size()){
if (destructionVolumes[index].areaHealth <= part
sConfig[idxParts].parts[i].hpFalloffThreshold && !partsConfig[idxParts].parts[i]
.isPartDropped){
dropCompName = partsConfig[idxParts].par
ts[i].componentName;
comp = GetEntity().GetComponent(dropComp
Name);
rigidMeshComp = (CRigidMeshComponent)com
p;
rigidMeshComp.EnableBuoyancy(false);
drop.DropMeshByName(dropCompName, VecFro
mHeading(GetEntity().GetHeading()), PartNameToCurveName(dropCompName));
partsConfig[idxParts].parts[i].isPartDro
pped = true;
PlayEffectBasedOnDropCompName(dropCompNa
me);
}
i += 1;
}
}
if (destructionVolumes[index].areaHealth <= 0.000000){
boatComponent.TriggerDrowning(globalHitPos);
GetEntity().AddTimer('DrowningDismount', 2.000000, /* NO
P */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
boatComponent.GetBoatEntity().SetHasDrowned(true);
boatComponent.GetBoatEntity().SoundEvent("boat_sinking",
/* NOP */, /* NOP */);
i = attachedSirens.Size() - 1;
while (i >= 0){
attachedSirens[i].SignalGameplayEvent('BoatDestr
oyed');
attachedSirens.EraseFast(i);
i -= 1;
}
}
/* NOP */;
}
public function IsDestroyed() : Bool{
var i : Int32;
i = 0;
while (i < destructionVolumes.Size()){
if (destructionVolumes[i].areaHealth <= 0){
return true;
}
i += 1;
}
return false;
/* NOP */;

}
public function DealDmgToNearestVolume(dmgPrcnt : Float, hitPos : Vector
) : Bool{
var index : Int32;
index = GetNearestVolumeIndex(hitPos);
if (index == -1){
return false;
}
ReduceHealth(dmgPrcnt, index, hitPos);
ProcessBoatHitAnimation(index);
return true;
/* NOP */;
}
private function GetNearestVolumeIndex(pos : Vector) : Int32{
var i : Int32;
var nearestDist : Float;
var tempDist : Float;
var boatPos : Vector;
var index : Int32;
var worldPos : Vector;
var boatEnt : CEntity;
var l2w : Matrix;
tempDist = 0.000000;
index = -1;
boatEnt = GetEntity();
l2w = boatEnt.GetLocalToWorld();
boatPos = GetEntity().GetWorldPosition();
i = 0;
while (i < destructionVolumes.Size()){
worldPos = VecTransform(l2w, destructionVolumes[i].volum
eLocalPosition);
tempDist = VecDistance(pos, worldPos);
if (i == 0 || tempDist < nearestDist){
nearestDist = tempDist;
index = i;
}
i += 1;
}
return index;
/* NOP */;
}
public function PartNameToCurveName(partName : String) : CName{
switch(partName){
case "dest_BL_01":
return 'leftBack';
case "dest_ML_01":
return 'leftMiddle';
case "dest_ML_02":
return 'leftMiddle';
case "dest_FL_01":
return 'leftFront';
case "dest_FL_02":
return 'leftFront';
case "dest_BR_01":
return 'rightBack';
case "dest_MR_01":
return 'rightMiddle';
case "dest_MR_02":
return 'rightMiddle';
case "dest_FR_01":

return 'rightFront';
case "dest_FR_02":
return 'rightFront';
default:
}
return 'None';
/* NOP */;
}
public function PlayEffectBasedOnDropCompName(partName : String){
var boatEnt : W3Boat;
var fxName : CName;
boatEnt = (W3Boat)GetEntity();
if (!boatEnt){
return;
}
switch(partName){
case "dest_BL_01":
fxName = 'boat_hit00';
break;
case "dest_ML_01":
fxName = 'boat_hit05';
break;
case "dest_ML_02":
fxName = 'boat_hit08';
break;
case "dest_FL_01":
fxName = 'boat_hit07';
break;
case "dest_FL_02":
fxName = 'boat_hit06';
break;
case "dest_BR_01":
fxName = 'boat_hit09';
break;
case "dest_MR_01":
fxName = 'boat_hit02';
break;
case "dest_MR_02":
fxName = 'boat_hit01';
break;
case "dest_FR_01":
fxName = 'boat_hit04';
break;
case "dest_FR_02":
fxName = 'boat_hit03';
break;
default:
return;
}
boatEnt.PlayEffect(fxName, /* NOP */);
/* NOP */;
}
private function ProcessBoatHitAnimation(volumeHit : Int32){
var boatHitDirection : Int32;
switch(volumeHit){
case 2:
case 5:
boatHitDirection = 0;
break;
case 0:

case 3:
boatHitDirection = 1;
break;
case 4:
boatHitDirection = 2;
break;
case 1:
boatHitDirection = 3;
break;
default:
boatHitDirection = 0;
break;
}
if (boatComponent.user){
boatComponent.user.SetBehaviorVariable('boatHitDirection
', boatHitDirection, /* NOP */);
boatComponent.user.RaiseEvent('BoatHit');
}
if (boatComponent.GetPassenger()){
boatComponent.GetPassenger().SetBehaviorVariable('boatHi
tDirection', boatHitDirection, /* NOP */);
boatComponent.GetPassenger().RaiseEvent('BoatHit');
}
/* NOP */;
}
}
struct SBoatPartsConfig{
editable var destructionVolumeIndex : Int32;
editable saved var parts : array<SBoatDesctructionPart>;
}
import abstract class CExplorationComponent{
}
import abstract class CExpSyncEvent{
}
import abstract class CExpSlideEvent{
}
import abstract class SExplorationQueryContext{
//NULL type for inputDirectionInWorldSpace
//NULL type for maxAngleToCheck
//NULL type for forJumping
//NULL type for dontDoZAndDistChecks
//NULL type for laddersOnly
//NULL type for forAutoTraverseSmall
//NULL type for forAutoTraverseBig
}
import abstract class SExplorationQueryToken{
//NULL type for valid
//NULL type for normal
//NULL type for pointOnEdge
//NULL type for type
//NULL type for usesHands
}
import abstract class CFoundExplorationComponent{

}
import abstract class CJournalBlock{
}
import abstract class CJournalChildBase{
//NULL type for parentGuid
}
import abstract class CJournalContainer{
import public final function GetChild(index : Int32) : CJournalBase;
import public final function GetNumChildren() : Int32;
}
import abstract class CNodesBinaryStorage{
}
import abstract class CSpawnPointComponent{
}
class W3GuiPaperdollInventoryComponent extends W3GuiPlayerInventoryComponent{
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var itemTags : array<CName>;
_inv.GetItemTags(item, itemTags);
/* NOP */;
return super.ShouldShowItem(item) && isEquipped(item);
/* NOP */;
}
protected function GetTooltipText(item : SItemUniqueId) : String{
var debugTooltip : String;
var TooltipType : ECompareType;
return debugTooltip;
/* NOP */;
}
protected function isEquipped(item : SItemUniqueId) : Bool{
var horseMgr : W3HorseManager;
if (isHorseItem(item)){
horseMgr = GetWitcherPlayer().GetHorseManager();
if (horseMgr){
return horseMgr.IsItemEquipped(item);
}
} else {
return GetWitcherPlayer().IsItemEquipped(item);
}
return false;
/* NOP */;
}
public function SetInventoryFlashObjectForItem(itemId : SItemUniqueId, f
lashObject : CScriptedFlashObject){
var slotType : EEquipmentSlots;
var canDrop : Bool;
super.SetInventoryFlashObjectForItem(itemId, flashObject);
slotType = GetCurrentSlotForItem(itemId);
canDrop = !IsMultipleSlot(slotType) && slotType != 17;
if (!canDrop){
flashObject.SetMemberFlashBool("canDrop", false);
}
flashObject.SetMemberFlashInt("slotType", slotType);
/* NOP */;
}

}
import abstract class CPartySpawnPointComponent{
}
class W3GuiContainerInventoryComponent extends W3CommonContainerInventoryCompone
nt{
public function ReceiveItem(item : SItemUniqueId, giver : W3GuiBaseInven
toryComponent, quantity : Int32, newItemID : SItemUniqueId) : Bool{
var invalidatedItems : array<SItemUniqueId>;
var newIds : array<SItemUniqueId>;
var newItem : SItemUniqueId;
var success : Bool;
var itemName : CName;
if (quantity < 1){
quantity = 1;
}
success = false;
itemName = giver._inv.GetItemName(item);
giver._inv.RemoveItem(item, quantity);
newIds = _inv.AddAnItem(itemName, quantity, true, true, /* NOP *
/);
newItem = newIds[0];
if (newItem != GetInvalidUniqueId()){
success = true;
}
return success;
/* NOP */;
}
}
import abstract class SAIMinigameParams{
}
class W3GuiShopInventoryComponent extends W3GuiBaseInventoryComponent{
protected function InvalidateItems(items : array<SItemUniqueId>){
}
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
super.SetInventoryFlashObjectForItem(item, flashObject);
flashObject.SetMemberFlashBool("isNew", false);
/* NOP */;
}
protected function ShopHasInfiniteFunds() : Bool{
return _inv.GetFundsType() == 0;
/* NOP */;
}
public function GiveItem(itemId : SItemUniqueId, customer : W3GuiBaseInv
entoryComponent, quantity : Int32, newItemID : SItemUniqueId) : Bool{
var customerMoney : Int32;
var itemPrice : Int32;
var success : Bool;
var invItem : SInventoryItem;
success = false;
if (quantity < 1){
quantity = 1;
}
customerMoney = customer._inv.GetMoney();
invItem = _inv.GetItem(itemId);
itemPrice = _inv.GetInventoryItemPriceModified(invItem, false) *

quantity;
if (customerMoney >= itemPrice){
success = super.GiveItem(itemId, customer, quantity, new
ItemID);
if (success){
customer._inv.RemoveMoney(itemPrice);
if (!ShopHasInfiniteFunds()){
_inv.AddMoney(itemPrice);
}
}
}
return success;
/* NOP */;
}
public function ReceiveItem(itemId : SItemUniqueId, giver : W3GuiBaseInv
entoryComponent, quantity : Int32, newItemID : SItemUniqueId) : Bool{
var shopMoney : Int32;
var itemCost : Int32;
var success : Bool;
var invItem : SInventoryItem;
shopMoney = _inv.GetMoney();
invItem = giver._inv.GetItem(itemId);
itemCost = _inv.GetInventoryItemPriceModified(invItem, true) * q
uantity;
success = false;
if (itemCost >= 0 && shopMoney >= itemCost || ShopHasInfiniteFun
ds()){
success = super.ReceiveItem(itemId, giver, quantity, new
ItemID);
if (success){
if (!ShopHasInfiniteFunds()){
_inv.RemoveMoney(itemCost);
}
giver._inv.AddMoney(itemCost);
}
}
return success;
/* NOP */;
}
public function GetItemActionType(item : SItemUniqueId, bGetDefault : Bo
ol) : EInventoryActionType{
return 11;
/* NOP */;
}
public function GetItemName(item : SItemUniqueId) : CName{
return _inv.GetItemName(item);
/* NOP */;
}
}
import abstract class CExtAnimProjectileEvent{
}
import abstract class CAIProfile{
}
import abstract class CAIPresetsTemplateParam{
}
import abstract class CAITemplateParam{

}
import abstract class CAIBaseTreeTemplateParam{
}
import abstract class SAIReactionRange{
}
class W3PlayerStatsContext extends W3UIContext{
protected var invMenuRef : CR4InventoryMenu;
protected var statName : CName;
public function SetInventoryRef(TargetInvMenu : CR4InventoryMenu){
invMenuRef = TargetInvMenu;
/* NOP */;
}
public function SetStatName(value : CName){
statName = value;
invMenuRef.ShowStatTooltip(statName);
/* NOP */;
}
protected function updateInputFeedback(){
m_inputBindings.Clear();
m_contextBindings.Clear();
m_managerRef.updateInputFeedback();
invMenuRef.ShowStatTooltip(statName);
/* NOP */;
}
}
import abstract class SAIReactionFactTest{
}
class W3InventoryPaperdollContext extends W3InventoryItemContext{
protected function updateInputFeedback(){
var horsePaperdollInv : W3GuiHorseInventoryComponent;
var currentInventoryState : EInventoryMenuState;
var isBodkinBolt : Bool;
var canDrop : Bool;
var isQuestItem : Bool;
var isSingletonItem : Bool;
var isHorseItem : Bool;
m_inputBindings.Clear();
m_contextBindings.Clear();
if (!invMenuRef || !invComponentRef){
return;
}
currentInventoryState = invMenuRef.GetCurrentInventoryState();
isBodkinBolt = invComponentRef.GetItemName(currentItemId) == 'Bo
dkin Bolt';
canDrop = !invComponentRef.ItemHasTag(currentItemId, 'NoDrop');
isQuestItem = invComponentRef.ItemHasTag(currentItemId, 'Quest')
;
isSingletonItem = invComponentRef.ItemHasTag(currentItemId, 'Sin
gletonItem');
horsePaperdollInv = (W3GuiHorseInventoryComponent)invMenuRef.Get
CurrentInventoryComponent();
if (horsePaperdollInv && horsePaperdollInv.GetInventoryComponent
().IsIdValid(currentItemId) && horsePaperdollInv.isHorseItem(currentItemId)){
isHorseItem = true;
} else {

isHorseItem = false;
}
if (invComponentRef.IsIdValid(currentItemId) && !isBodkinBolt){
if (canDrop && !isQuestItem && !isSingletonItem && !isHo
rseItem && !IsMultipleSlot(currentSlot) && currentSlot != 17){
AddInputBinding("panel_button_common_drop", "gam
epad_Y", 82, true, /* NOP */);
}
AddInputBinding("panel_button_inventory_unequip", "enter
-gamepad_A", 32, true, /* NOP */);
} else if (invSecondComponentRef && invSecondComponentRef.IsIdVa
lid(currentItemId)){
AddInputBinding("panel_button_inventory_unequip", "enter
-gamepad_A", 32, true, /* NOP */);
}
m_managerRef.updateInputFeedback();
/* NOP */;
}
public function HandleUserFeedback(keyName : String){
super.HandleUserFeedback(keyName);
/* NOP */;
}
protected function execurePrimaryAction(){
if (invMenuRef.GetCurrentInventoryState() != 3){
invMenuRef.OnUnequipItem(currentItemId, -1);
} else {
GetWitcherPlayer().GetHorseManager().UnequipItem(current
Slot);
invMenuRef.UpdateInventoryFilter(7);
invMenuRef.UpdateHorsePaperdoll();
invMenuRef.PopulateTabData(invMenuRef.getTabFromItem(cur
rentItemId));
}
/* NOP */;
}
}
import abstract class CSphereAttackRange{
}
import abstract class CCylinderAttackRange{
}
class W3InventoryGridContext extends W3InventoryItemContext{
protected function updateInputFeedback(){
var currentInventoryState : EInventoryMenuState;
var canDrop : Bool;
var isBodkinBolt : Bool;
var isQuestItem : Bool;
var curEquipedItem : SItemUniqueId;
var cantUse : Bool;
var buttonLabel : String;
/* NOP */;
m_inputBindings.Clear();
m_contextBindings.Clear();
if (!invMenuRef || !invComponentRef){
return;
}
currentInventoryState = invMenuRef.GetCurrentInventoryState();
if (invComponentRef.IsIdValid(currentItemId)){

canDrop = !invComponentRef.ItemHasTag(currentItemId, 'No


Drop');
isQuestItem = invComponentRef.ItemHasTag(currentItemId,
'Quest');
isBodkinBolt = invComponentRef.GetItemName(currentItemId
) == 'Bodkin Bolt';
cantUse = FactsQuerySum("tut_forced_preparation") > 0 &&
invComponentRef.GetItemName(currentItemId) == 'Thunderbolt 1';
if (canDrop && cantUse){
canDrop = false;
}
switch(currentInventoryState){
case 0:
if (invComponentRef.ItemHasTag(currentItemId, 'R
eadableItem')){
AddInputBinding("panel_button_inventory_
read", "enter-gamepad_A", 69, true, /* NOP */);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'Edibles') || invComponentRef.ItemHasTag(currentItemId, 'Drinks') || invCom
ponentRef.ItemHasTag(currentItemId, 'Potion')){
if (invComponentRef.IsItemSingletonItem(
currentItemId) && thePlayer.inv.SingletonItemGetAmmo(currentItemId) == 0){
cantUse = true;
}
if (!cantUse){
AddInputBinding("panel_button_in
ventory_consume", "gamepad_X", 69, true, /* NOP */);
}
if (invComponentRef.GetItemName(currentI
temId) != 'q111_imlerith_acorn' && !invComponentRef.ItemHasTag(currentItemId, 'N
oEquip')){
AddInputBinding("panel_button_in
ventory_equip", "enter-gamepad_A", 32, true, /* NOP */);
}
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'Upgrade')){
AddInputBinding("panel_button_inventory_
put_in_socket", "enter-gamepad_A", 69, true, /* NOP */);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'SteelOil') && GetWitcherPlayer().GetItemEquippedOnSlot(2, curEquipedItem)
|| invComponentRef.ItemHasTag(currentItemId, 'SilverOil') && GetWitcherPlayer().
GetItemEquippedOnSlot(1, curEquipedItem)){
AddInputBinding("panel_button_inventory_
upgrade", "enter-gamepad_A", 69, true, /* NOP */);
} else if (invComponentRef.GetSlotForItemId(curr
entItemId) != 0){
AddInputBinding("panel_button_inventory_
equip", "enter-gamepad_A", 32, true, /* NOP */);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'ArmorReapairKit')){
if (GetWitcherPlayer().HasRepairAbleGear
Equiped()){
AddInputBinding("panel_button_hu
d_interaction_useitem", "enter-gamepad_A", 69, true, /* NOP */);
}
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'WeaponReapairKit')){
if (GetWitcherPlayer().HasRepairAbleWapo
nEquiped()){
AddInputBinding("panel_button_hu

d_interaction_useitem", "enter-gamepad_A", 69, true, /* NOP */);


}
}
break;
case 1:
if (!isBodkinBolt){
AddInputBinding("panel_inventory_quantit
y_popup_sell", "enter-gamepad_A", 32, true, /* NOP */);
}
break;
case 2:
AddInputBinding("panel_button_inventory_transfer
", "enter-gamepad_A", 32, true, /* NOP */);
break;
case 3:
if (IsHorseItem(currentItemId)){
AddInputBinding("panel_button_inventory_
equip", "enter-gamepad_A", 32, true, /* NOP */);
} else {
AddInputBinding("panel_button_inventory_
transfer", "enter-gamepad_A", 32, true, /* NOP */);
}
break;
default:
break;
}
if (canDrop && !isQuestItem && !isBodkinBolt && currentI
nventoryState != 1){
AddInputBinding("panel_button_common_drop", "gam
epad_Y", 82, true, /* NOP */);
}
if (invComponentRef.CanBeCompared(currentItemId)){
buttonLabel = GetHoldLabel() + " " + GetLocStrin
gByKeyExt("panel_common_compare");
AddInputBinding(buttonLabel, "gamepad_L2", -1, t
rue, true);
}
}
m_managerRef.updateInputFeedback();
/* NOP */;
}
protected function execurePrimaryAction(){
var currentInventoryState : EInventoryMenuState;
var itemsCount : Int32;
var newId : SItemUniqueId;
if (invComponentRef.IsIdValid(currentItemId)){
currentInventoryState = invMenuRef.GetCurrentInventorySt
ate();
itemsCount = invComponentRef.GetItemQuantity(currentItem
Id);
switch(currentInventoryState){
case 0:
if (invComponentRef.ItemHasTag(currentItemId, 'R
eadableItem')){
invMenuRef.OnReadBook(currentItemId);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'Upgrade')){
invMenuRef.OnPutInSocket(currentItemId);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'WeaponReapairKit') || invComponentRef.ItemHasTag(currentItemId, 'ArmorReap

airKit')){
invMenuRef.OnRepairItem(currentItemId);
} else if (invComponentRef.ItemHasTag(currentIte
mId, 'SteelOil') || invComponentRef.ItemHasTag(currentItemId, 'SilverOil')){
invMenuRef.ShowApplyOilMode(currentItemI
d);
} else if (!invMenuRef.TryEquipToPockets(current
ItemId, currentSlot)){
invMenuRef.OnEquipItem(currentItemId, cu
rrentSlot, itemsCount);
}
break;
case 1:
invMenuRef.OnSellItem(currentItemId, itemsCount)
;
break;
case 2:
invMenuRef.OnTransferItem(currentItemId, itemsCo
unt, -1);
break;
case 3:
if (IsHorseItem(currentItemId)){
newId = GetWitcherPlayer().GetHorseManag
er().MoveItemToHorse(currentItemId, itemsCount);
GetWitcherPlayer().GetHorseManager().Equ
ipItem(newId);
invMenuRef.UpdateHorsePaperdoll();
invMenuRef.PopulateTabData(invMenuRef.ge
tTabFromItem(currentItemId));
} else {
GetWitcherPlayer().GetHorseManager().Mov
eItemToHorse(currentItemId, itemsCount);
invMenuRef.UpdateHorseInventory();
invMenuRef.PopulateTabData(invMenuRef.ge
tTabFromItem(currentItemId));
}
break;
}
}
/* NOP */;
}
}
import abstract class CConeAttackRange{
}
import abstract class CBoxAttackRange{
}
class W3ExternalGridContext extends W3InventoryItemContext{
protected function updateInputFeedback(){
var currentInventoryState : EInventoryMenuState;
var itemCategory : CName;
var canCompare : Bool;
var isSchematic : Bool;
var buttonLabel : String;
m_inputBindings.Clear();
m_contextBindings.Clear();
if (!invMenuRef || !invComponentRef){
return;

}
currentInventoryState = invMenuRef.GetCurrentInventoryState();
if (invComponentRef.IsIdValid(currentItemId)){
switch(currentInventoryState){
case 1:
AddInputBinding("panel_inventory_quantity_popup_
buy", "enter-gamepad_A", 32, true, /* NOP */);
break;
case 2:
case 3:
AddInputBinding("panel_button_inventory_transfer
", "enter-gamepad_A", 32, true, /* NOP */);
break;
}
itemCategory = invComponentRef.GetItemCategory(currentIt
emId);
isSchematic = itemCategory == 'alchemy_recipe' || itemCa
tegory == 'crafting_schematic';
if (invComponentRef.CanBeCompared(currentItemId)){
buttonLabel = GetHoldLabel() + " " + GetLocStrin
gByKeyExt("panel_common_compare");
AddInputBinding(buttonLabel, "gamepad_L2", -1, t
rue, true);
} else if (isSchematic){
AddInputBinding("panel_button_inventory_item_inf
o", "gamepad_L2", 73, true, /* NOP */);
}
}
m_managerRef.updateInputFeedback();
/* NOP */;
}
protected function execurePrimaryAction(){
var currentInventoryState : EInventoryMenuState;
var itemsCount : Int32;
currentInventoryState = invMenuRef.GetCurrentInventoryState();
itemsCount = invComponentRef.GetItemQuantity(currentItemId);
switch(currentInventoryState){
case 1:
invMenuRef.OnBuyItem(currentItemId, itemsCount, -1);
break;
case 2:
invMenuRef.OnTransferItem(currentItemId, itemsCount, -1)
;
break;
case 3:
GetWitcherPlayer().GetHorseManager().MoveItemFromHorse(c
urrentItemId, itemsCount);
invMenuRef.UpdateInventoryFilter(8);
invMenuRef.UpdateHorseInventory();
invMenuRef.PopulateTabData(invMenuRef.getTabFromItem(cur
rentItemId));
break;
}
/* NOP */;
}
}
class BookPopupFeedback extends TextPopupData{
protected function GetContentRef() : String{
return "BookPopupRef";

/* NOP */;
}
}
import abstract class CCCOpScript{
}
import abstract class SNavigationCollectCollisionInCircleData{
}
import struct CNavigationReachabilityQueryInterface{
import public final function GetLastOutput(queryValidTime : Float) : EAs
yncTestResult;
import public final function GetOutputClosestDistance() : Float;
import public final function GetOutputClosestEntity() : CEntity;
import public final function TestActorsList(testType : ENavigationReacha
bilityTestType, originActor : CActor, list : array<CActor>, safeSpotTolerance :
Float, pathfindDinstanceLimit : Float) : EAsyncTestResult;
}
class W3DestroyItemConfPopup extends ConfirmationPopupData{
public var menuRef : CR4InventoryMenu;
public var item : SItemUniqueId;
public var quantity : Int32;
protected function OnUserAccept(){
menuRef.DropItem(item, quantity);
ClosePopup();
/* NOP */;
}
protected function OnUserDecline(){
ClosePopup();
/* NOP */;
}
}
import abstract class SAIAttitudeDummy{
}
import abstract class IEntityStateChangeRequest{
}
import struct CScriptedEntityStateChangeRequest{
public function Execute(out entity : CGameplayEntity){
}
}
import struct CEnableDeniedAreaRequest{
}
import struct CPlaySoundOnActorRequest{
import public function Initialize(boneName : CName, soundName : String,
fadeTime : Float);
}
import abstract class CEquipmentDefinition{
}
import abstract class CEquipmentInitializerRandom{
}

import abstract class CEquipmentInitializerUniform{


}
import abstract class CWaterDebug{
}
import abstract class CVisualDebug_MovementTrajectory{
}
import abstract class SOcclusionSPQuery{
}
import abstract class IDoorAttachment{
}
import abstract class CDoorAttachment_AngleAnimation{
}
import abstract class CDoorAttachment_PropertyAnimation{
}
import abstract class CDoorAttachment_GameplayPush{
}
import abstract class SDoorSoundsEvents{
}
import struct W3Container{
public editable var isDynamic : Bool;
public editable var skipInventoryPanel : Bool;
public editable var focusModeHighlight : EFocusModeVisibility;
public editable var factOnContainerOpened : String;
public var usedByCiri : Bool;
public editable var allowToInjectBalanceItems : Bool;
public editable var disableLooting : Bool;
public editable var disableStealing : Bool;
protected saved var checkedForBonusMoney : Bool;
private saved var usedByClueStash : EntityHandle;
protected autobind inv : CInventoryComponent = single;
protected autobind lootInteractionComponent : CInteractionComponent = "L
oot";
protected var isPlayingInteractionAnim : Bool;
private const var QUEST_HIGHLIGHT_FX : CName;
private const var SKIP_NO_DROP_NO_SHOW : Bool;
import public function SetIsQuestContainer(isQuest : Bool);
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
EnableVisualDebug(208, true);
super.OnSpawned(spawnData);
if (disableLooting){
SetFocusModeVisibility(0, /* NOP */);
super.StopQuestItemFx();
if (lootInteractionComponent){
lootInteractionComponent.SetEnabled(false);
}
CheckLock();
} else {
super.UpdateContainer();
}
/* NOP */;
}

public function OnStreamIn() : Bool{


super.OnStreamIn();
super.UpdateContainer();
/* NOP */;
}
public function OnSpawnedEditor(spawnData : SEntitySpawnData) : Bool{
EnableVisualDebug(208, true);
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow
Flags) : Bool{
frame.DrawText(GetName(), GetWorldPosition() + Vector(0, 0, 1.00
0000), Color(255, 0, 255));
frame.DrawSphere(GetWorldPosition(), 1.000000, Color(255, 0, 255
));
return true;
/* NOP */;
}
public function UpdateFactItems(){
var i : Int32;
var j : Int32;
var items : array<SItemUniqueId>;
var tags : array<CName>;
var factName : String;
if (inv && !disableLooting){
inv.GetAllItems(items);
}
i = 0;
while (i < items.Size()){
tags.Clear();
inv.GetItemTags(items[i], tags);
j = 0;
while (j < tags.Size()){
factName = StrAfterLast(NameToString(tags[j]), "
fact_hidden_");
if (StrLen(factName) > 0){
if (FactsQuerySum(factName) > 0){
inv.RemoveItemTag(items[i], theG
ame.params.TAG_DONT_SHOW);
} else {
inv.AddItemTag(items[i], theGame
.params.TAG_DONT_SHOW);
}
break;
}
j += 1;
}
i += 1;
}
/* NOP */;
}
public function InjectItemsOnLevels(){
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
super.UpdateContainer();
RebalanceItems();
super.OnInteractionActivated(interactionComponentName, activator
);

if (activator == thePlayer){
if (inv && !disableLooting){
inv.UpdateLoot();
if (!checkedForBonusMoney){
checkedForBonusMoney = true;
super.CheckForBonusMoney(0);
}
}
if (!disableLooting && !thePlayer.IsInCombat() || super.
IsEnabledInCombat()){
super.HighlightEntity();
}
if (interactionComponentName == "Medallion" && isMagical
Object){
SenseMagic();
}
if (!IsEmpty() && !disableLooting || lockedByKey){
ShowInteractionComponent();
}
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
super.OnInteractionDeactivated(interactionComponentName, activat
or);
if (activator == thePlayer){
super.UnhighlightEntity();
}
/* NOP */;
}
public final function IsEnabledInCombat() : Bool{
if (!lootInteractionComponent || disableLooting){
return false;
}
return lootInteractionComponent.IsEnabledInCombat();
/* NOP */;
}
public function InformClueStash(){
var clueStash : W3ClueStash;
clueStash = (W3ClueStash)EntityHandleGet(usedByClueStash);
if (clueStash){
clueStash.OnContainerEvent();
}
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
super.OnItemGiven(data);
if (isEnabled){
super.UpdateContainer();
}
InformClueStash();
/* NOP */;
}
public function ReadSchematicsAndRecipes(){
}
public function OnItemTaken(itemId : SItemUniqueId, quantity : Int32) :
Bool{
super.OnItemTaken(itemId, quantity);
if (!super.HasQuestItem()){

super.StopQuestItemFx();
}
InformClueStash();
/* NOP */;
}
public function OnUpdateContainer() : Bool{
}
protected final function UpdateContainer(){
var medalion : CComponent;
var foliageComponent : CSwitchableFoliageComponent;
var itemCategory : CName;
foliageComponent = (CSwitchableFoliageComponent)GetComponentByCl
assName('CSwitchableFoliageComponent');
if (!disableLooting){
UpdateFactItems();
}
if (inv && !disableLooting){
inv.UpdateLoot();
}
if (!theGame.IsActive() || inv && !disableLooting && isEnabled &
& !inv.IsEmpty(SKIP_NO_DROP_NO_SHOW)){
SetFocusModeVisibility(focusModeHighlight, /* NOP */);
AddTag('HighlightedByMedalionFX');
if (foliageComponent){
foliageComponent.SetAndSaveEntry('full');
} else {
ApplyAppearance("1_full");
}
if (HasQuestItem()){
SetIsQuestContainer(true);
PlayQuestItemFx();
}
} else {
SetFocusModeVisibility(0, /* NOP */);
if (foliageComponent && !disableLooting){
foliageComponent.SetAndSaveEntry('empty');
} else {
ApplyAppearance("2_empty");
}
StopQuestItemFx();
}
if (!isMagicalObject){
medalion = GetComponent("Medallion");
if (medalion){
medalion.SetEnabled(false);
}
}
if (lootInteractionComponent){
if (disableLooting){
lootInteractionComponent.SetEnabled(false);
} else {
lootInteractionComponent.SetEnabled(inv && !inv.
IsEmpty(SKIP_NO_DROP_NO_SHOW));
}
}
if (!disableLooting){
OnUpdateContainer();
}
CheckForDimeritium();
CheckLock();

/* NOP */;
}
public function RebalanceItems(){
var i : Int32;
var items : array<SItemUniqueId>;
if (inv && !disableLooting){
inv.AutoBalanaceItemsWithPlayerLevel();
inv.GetAllItems(items);
}
i = 0;
while (i < items.Size()){
if (inv.GetItemModifierInt(items[i], 'ItemQualityModifie
d', /* NOP */) > 0){
} else {
inv.AddRandomEnhancementToItem(items[i]);
}
i += 1;
}
/* NOP */;
}
protected final function HighlightEntity(){
isHighlightedByMedallion = true;
/* NOP */;
}
protected final function UnhighlightEntity(){
StopEffect('medalion_detection_fx');
StopEffect('medalion_fx');
isHighlightedByMedallion = false;
/* NOP */;
}
public final function HasQuestItem() : Bool{
if (!inv || disableLooting){
return false;
}
return inv.HasQuestItem();
/* NOP */;
}
public function CheckForDimeritium(){
if (inv && !disableLooting){
if (inv.HasItemByTag('Dimeritium')){
if (!HasTag('Potestaquisitor')){
AddTag('Potestaquisitor');
}
} else if (HasTag('Potestaquisitor')){
RemoveTag('Potestaquisitor');
}
} else if (HasTag('Potestaquisitor')){
RemoveTag('Potestaquisitor');
}
/* NOP */;
}
public final function OnTryToGiveItem(itemId : SItemUniqueId) : Bool{
return true;
/* NOP */;
}
public function TakeAllItems(){
var targetInv : CInventoryComponent;
var allItems : array<SItemUniqueId>;
var ciriEntity : W3ReplacerCiri;
var i : Int32;

var itemsCategories : array<CName>;


var category : CName;
targetInv = thePlayer.inv;
if (!inv || !targetInv){
return;
}
inv.GetAllItems(allItems);
/* NOP */;
i = 0;
while (i < allItems.Size()){
if (inv.ItemHasTag(allItems[i], 'Lootable') || !inv.Item
HasTag(allItems[i], 'NoDrop') && !inv.ItemHasTag(allItems[i], theGame.params.TAG
_DONT_SHOW)){
inv.NotifyItemLooted(allItems[i]);
if (inv.ItemHasTag(allItems[i], 'HerbGameplay'))
{
category = 'herb';
} else {
category = inv.GetItemCategory(allItems[
i]);
}
if (itemsCategories.FindFirst(category) == -1){
itemsCategories.PushBack(category);
}
inv.GiveItemTo(targetInv, allItems[i], inv.GetIt
emQuantity(allItems[i]), true, false, true);
}
i += 1;
}
if (itemsCategories.Size() == 1){
PlayItemEquipSound(itemsCategories[0]);
} else {
PlayItemEquipSound('generic');
}
/* NOP */;
InformClueStash();
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var processed : Bool;
var allItems : array<SItemUniqueId>;
var i : Int32;
var j : Int32;
var m_schematicList : array<CName>;
var m_recipeList : array<CName>;
var itemCategory : CName;
var attr : SAbilityAttributeValue;
if (activator != thePlayer || isInteractionBlocked || IsEmpty())
{
return false;
}
if (activator == (W3ReplacerCiri)thePlayer){
skipInventoryPanel = true;
usedByCiri = true;
}
if (StrLen(factOnContainerOpened) > 0 && !FactsDoesExist(factOnC
ontainerOpened) && actionName == "Container" || actionName == "Unlock"){
FactsAdd(factOnContainerOpened, 1, -1);
}

m_recipeList = GetWitcherPlayer().GetAlchemyRecipes();
m_schematicList = GetWitcherPlayer().GetCraftingSchematicsNames(
);
if (!HasTag('lootbag')){
inv.GetAllItems(allItems);
i = 0;
while (i < allItems.Size()){
j = 0;
while (j < m_recipeList.Size()){
if (inv.GetItemName(allItems[i]) == m_re
cipeList[j]){
inv.RemoveItem(allItems[i], inv.
GetItemQuantity(allItems[i]));
inv.NotifyItemLooted(allItems[i]
);
inv.AddAnItem('Crowns', RoundF(R
andRangeF(4, 2)), true, true, /* NOP */);
}
j += 1;
}
j = 0;
while (j < m_schematicList.Size()){
if (inv.GetItemName(allItems[i]) == m_sc
hematicList[j]){
inv.RemoveItem(allItems[i], inv.
GetItemQuantity(allItems[i]));
inv.NotifyItemLooted(allItems[i]
);
inv.AddAnItem('Crowns', RoundF(R
andRangeF(4, 2)), true, true, /* NOP */);
}
j += 1;
}
if (GetWitcherPlayer().GetLevel() - 1 > 1 && inv
.GetItemLevel(allItems[i]) == 1 && inv.ItemHasTag(allItems[i], 'Autogen')){
inv.RemoveItemCraftedAbility(allItems[i]
, 'autogen_steel_base');
inv.RemoveItemCraftedAbility(allItems[i]
, 'autogen_silver_base');
inv.RemoveItemCraftedAbility(allItems[i]
, 'autogen_armor_base');
inv.RemoveItemCraftedAbility(allItems[i]
, 'autogen_pants_base');
inv.RemoveItemCraftedAbility(allItems[i]
, 'autogen_gloves_base');
inv.GenerateItemLevel(allItems[i]);
}
if (inv.GetItemCategory(allItems[i]) == 'gwint')
{
inv.ClearGwintCards();
}
if (thePlayer.GetLevel() < 10 && GetInventory().
GetItemLevel(allItems[i]) > thePlayer.GetLevel() + 5){
inv.RemoveItem(allItems[i], inv.GetItemQ
uantity(allItems[i]));
inv.NotifyItemLooted(allItems[i]);
inv.AddAnItem('Crowns', RoundF(RandRange
F(12, 8)), true, true, /* NOP */);
}
i += 1;

}
}
InjectItemsOnLevels();
processed = super.OnInteraction(actionName, activator);
if (processed){
return true;
}
if (actionName != "Container" && actionName != "GatherHerbs"){
return false;
}
ProcessLoot();
return true;
/* NOP */;
}
public function ProcessLoot(){
if (disableLooting){
return;
}
if (skipInventoryPanel || usedByCiri){
TakeAllItems();
OnContainerClosed();
} else {
super.ShowLoot();
}
/* NOP */;
}
public function OnStateChange(newState : Bool) : Bool{
if (lootInteractionComponent){
lootInteractionComponent.SetEnabled(newState);
}
super.OnStateChange(newState);
/* NOP */;
}
public final function ShowLoot(){
var lootData : W3LootPopupData;
lootData = new W3LootPopupData in this;
lootData.targetContainer = this;
theGame.RequestPopup('LootPopup', lootData);
/* NOP */;
}
public function IsEmpty() : Bool{
return !inv || inv.IsEmpty(SKIP_NO_DROP_NO_SHOW);
/* NOP */;
}
public function Enable(e : Bool, skipInteractionUpdate : Bool, questForc
edEnable : Bool){
if (!e && questForcedEnable){
if (e && IsEmpty()){
return;
} else {
super.UpdateContainer();
}
}
super.Enable(e, skipInteractionUpdate, /* NOP */);
/* NOP */;
}
public function OnContainerClosed(){
if (!super.HasQuestItem()){
super.StopQuestItemFx();
}

if (IsEmpty()){
SetFocusModeVisibility(0, /* NOP */);
RemoveTag('HighlightedByMedalionFX');
super.UnhighlightEntity();
Enable(false, /* NOP */, /* NOP */);
ApplyAppearance("2_empty");
if (isDynamic){
Destroy();
return;
}
}
/* NOP */;
}
protected final function CheckForBonusMoney(oldMoney : Int32){
var money : Int32;
var bonusMoney : Int32;
if (!inv){
return;
}
money = inv.GetMoney() - oldMoney;
if (money <= 0){
return;
}
bonusMoney = RoundMath(money * CalculateAttributeValue(thePlayer
.GetAttributeValue('bonus_money', /* NOP */, /* NOP */), /* NOP */));
if (bonusMoney > 0){
inv.AddMoney(bonusMoney);
}
/* NOP */;
}
public final function PlayQuestItemFx(){
PlayEffectSingle(QUEST_HIGHLIGHT_FX, /* NOP */);
/* NOP */;
}
public final function StopQuestItemFx(){
StopEffect(QUEST_HIGHLIGHT_FX);
/* NOP */;
}
public function GetSkipInventoryPanel() : Bool{
return skipInventoryPanel;
/* NOP */;
}
public function CanShowFocusInteractionIcon() : Bool{
return inv && !disableLooting && isEnabled && !inv.IsEmpty(SKIP_
NO_DROP_NO_SHOW);
/* NOP */;
}
public function RegisterClueStash(clueStash : W3ClueStash){
EntityHandleSet(usedByClueStash, clueStash);
/* NOP */;
}
}
import abstract class CCharacterStatsParam{
}
import abstract class CAutoEffectsParam{
}
import abstract class CAttackRangeParam{

}
import abstract class CAttackableArea{
}
import abstract class CPlayerTargetPriority{
}
import abstract class CAlternativeDisplayName{
}
import abstract class CEdEntitySetupListParam{
}
import abstract class CEdSpawnEntitySetupEffector{
}
import abstract class CFXTrackItemPlayPropertyAnim{
}
import abstract class CFXTrackItemPlayItemEffect{
}
import abstract class CExtAnimFootstepEvent{
}
import abstract class CStandPhysicalMaterialAreaComponent{
}
state W3TutorialManagerUIHandlerStatePotions in W3TutorialManagerUIHandler exten
ds W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var CAN_EQUIP : CName;
private const var SELECT_TAB : CName;
private const var EQUIP_POTION : CName;
private const var EQUIP_POTION_THUNDERBOLT : CName;
private const var ON_EQUIPPED : CName;
private var isClosing : Bool;
private var isForcedThunderbolt : Bool;
private var skippingTabSelection : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
var witcher : W3PlayerWitcher;
var currentTab : Int32;
var itemOne : SItemUniqueId;
var itemTwo : SItemUniqueId;
super.OnEnterState(prevStateName);
isClosing = false;
skippingTabSelection = false;
isForcedThunderbolt = FactsQuerySum("tut_forced_preparation") >
0;
if (!isForcedThunderbolt){
witcher = GetWitcherPlayer();
witcher.GetItemEquippedOnSlot(14, itemOne);
witcher.GetItemEquippedOnSlot(15, itemTwo);
if (witcher.inv.IsItemPotion(itemOne) || witcher.inv.IsI
temPotion(itemTwo)){
skippingTabSelection = true;
ShowHint(ON_EQUIPPED, theGame.params.TUT_POS_INV
ENTORY_X, theGame.params.TUT_POS_INVENTORY_Y - 0.100000, /* NOP */, /* NOP */, /
* NOP */, /* NOP */);
TutorialScript('secondPotionEquip', 'None');

} else {
currentTab = (CR4InventoryMenu)(CR4MenuBase)theG
ame.GetGuiManager().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab == 1){
skippingTabSelection = true;
OnPotionTabSelected();
} else {
ShowHint(CAN_EQUIP, theGame.params.TUT_P
OS_INVENTORY_X, theGame.params.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
}
}
} else {
theGame.GetTutorialSystem().uiHandler.LockLeaveMenu(true
);
thePlayer.BlockAction(18, 'tut_forced_preparation', /* N
OP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().UnmarkMessageAsSeen(EQUIP_PO
TION);
ShowHint(CAN_EQUIP, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(CAN_EQUIP);
CloseHint(SELECT_TAB);
CloseHint(EQUIP_POTION);
CloseHint(EQUIP_POTION_THUNDERBOLT);
CloseHint(ON_EQUIPPED);
if (!skippingTabSelection){
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB
);
}
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_POTION);
if (isForcedThunderbolt){
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_POTI
ON_THUNDERBOLT);
}
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == CAN_EQUIP){
highlights.Resize(1);
highlights[0].x = 0.105000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
} else if (hintName == ON_EQUIPPED){
if (isForcedThunderbolt){
theGame.GetTutorialSystem().ForcedAlchemyCleanup

();
}
QuitState();
}
/* NOP */;
}
public function OnPotionTabSelected() : Bool{
CloseHint(SELECT_TAB);
if (isForcedThunderbolt){
ShowHint(EQUIP_POTION_THUNDERBOLT, theGame.params.TUT_PO
S_INVENTORY_X, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* N
OP */);
} else {
ShowHint(EQUIP_POTION, theGame.params.TUT_POS_INVENTORY_
X, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnPotionEquipped(potionItemName : CName) : Bool{
if (isForcedThunderbolt && potionItemName != 'Thunderbolt 1'){
return false;
}
CloseHint(EQUIP_POTION);
CloseHint(EQUIP_POTION_THUNDERBOLT);
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_POTION);
ShowHint(ON_EQUIPPED, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y - 0.100000, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
/* NOP */;
}
}
import abstract class CExtForcedLogicalFootstepAnimEvent{
}
import abstract class CGuiScenePlayer{
}
state W3TutorialManagerUIHandlerStateOils in W3TutorialManagerUIHandler extends
W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var CAN_EQUIP : CName;
private const var SELECT_TAB : CName;
private const var EQUIP_OIL : CName;
private const var ON_EQUIPPED : CName;
private const var OILS_JOURNAL_ENTRY : CName;
private var isClosing : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
isClosing = false;
ShowHint(CAN_EQUIP, theGame.params.TUT_POS_INVENTORY_X, theGame.
params.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().ActivateJournalEntry(OILS_JOURNAL_EN
TRY);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(CAN_EQUIP);
CloseHint(SELECT_TAB);
CloseHint(EQUIP_OIL);

CloseHint(ON_EQUIPPED);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
theGame.GetTutorialSystem().MarkMessageAsSeen(ON_EQUIPPED);
FactsAdd("tut_ui_prep_oils", /* NOP */, /* NOP */);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == CAN_EQUIP){
highlights.Resize(1);
highlights[0].x = 0.105000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
} else if (hintName == ON_EQUIPPED){
QuitState();
}
/* NOP */;
}
public function OnOilTabSelected() : Bool{
CloseHint(SELECT_TAB);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
ShowHint(EQUIP_OIL, theGame.params.TUT_POS_INVENTORY_X, theGame.
params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnOilApplied() : Bool{
CloseHint(EQUIP_OIL);
ShowHint(ON_EQUIPPED, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
theGame.GetTutorialSystem().MarkMessageAsSeen(ON_EQUIPPED);
/* NOP */;
}
}
import abstract class CGuiConfigResourceFactory{
}
state W3TutorialManagerUIHandlerStateBooks in W3TutorialManagerUIHandler extends
W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var SELECT_TAB : CName;
private const var SELECT_BOOK : CName;
private const var USE : CName;
private var isClosing : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
var highlights : array<STutorialHighlight>;
var currentTab : Int32;
super.OnEnterState(prevStateName);
isClosing = false;
currentTab = (CR4InventoryMenu)(CR4MenuBase)theGame.GetGuiManage
r().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab == 1){
OnSelectedTab(true);

} else {
highlights.Resize(1);
highlights[0].x = 0.105000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(SELECT_TAB);
CloseHint(SELECT_BOOK);
CloseHint(USE);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnSelectedItem(itemId : SItemUniqueId) : Bool{
if (IsCurrentHint(SELECT_BOOK) && thePlayer.inv.ItemHasTag(itemI
d, 'ReadableItem')){
CloseHint(SELECT_BOOK);
ShowHint(USE, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else if (IsCurrentHint(USE) && !thePlayer.inv.ItemHasTag(itemI
d, 'ReadableItem')){
CloseHint(USE);
ShowHint(SELECT_BOOK, theGame.params.TUT_POS_INVENTORY_X
, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnSelectedTab(properTab : Bool) : Bool{
if (IsCurrentHint(SELECT_TAB) && properTab){
CloseHint(SELECT_TAB);
ShowHint(SELECT_BOOK, theGame.params.TUT_POS_INVENTORY_X
, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else if (!IsCurrentHint(SELECT_TAB) && !properTab){
CloseHint(SELECT_BOOK);
CloseHint(USE);
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnBookRead() : Bool{
QuitState();
/* NOP */;
}
}
state W3TutorialManagerUIHandlerStateArmorUpgrades in W3TutorialManagerUIHandler
extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var TAB : CName;
private const var UPGRADE : CName;
private const var ITEM : CName;
public function OnEnterState(prevStateName : CName) : Bool{
var highlights : array<STutorialHighlight>;

var currentTab : Int32;


super.OnEnterState(prevStateName);
currentTab = (CR4InventoryMenu)(CR4MenuBase)theGame.GetGuiManage
r().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab != 0){
highlights.Resize(1);
highlights[0].x = 0.060000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(TAB, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
} else {
ShowHint(UPGRADE, theGame.params.TUT_POS_INVENTORY_X, th
eGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CloseHint(TAB);
CloseHint(UPGRADE);
CloseHint(ITEM);
theGame.GetTutorialSystem().MarkMessageAsSeen(TAB);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnSelectingArmor() : Bool{
CloseHint(UPGRADE);
ShowHint(ITEM, theGame.params.TUT_POS_INVENTORY_X, theGame.param
s.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnSelectingArmorAborted() : Bool{
CloseHint(ITEM);
ShowHint(UPGRADE, theGame.params.TUT_POS_INVENTORY_X, theGame.pa
rams.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnUpgradedItem() : Bool{
QuitState();
/* NOP */;
}
public function OnTabSelected() : Bool{
CloseHint(TAB);
ShowHint(UPGRADE, theGame.params.TUT_POS_INVENTORY_X, theGame.pa
rams.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class SGuiSceneDescription{
}
state W3TutorialManagerUIHandlerStateFood in W3TutorialManagerUIHandler extends
W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var SELECT_TAB : CName;
private const var SELECT_FOOD : CName;
private const var EQUIP_FOOD : CName;
private const var USAGE : CName;
private var isClosing : Bool;

public function OnEnterState(prevStateName : CName) : Bool{


var witcher : W3PlayerWitcher;
var currentTab : Int32;
var hasFood : Bool;
var item : SItemUniqueId;
var highlights : array<STutorialHighlight>;
super.OnEnterState(prevStateName);
isClosing = false;
hasFood = false;
witcher = GetWitcherPlayer();
if (witcher.GetItemEquippedOnSlot(14, item)){
if (witcher.inv.IsItemFood(item)){
hasFood = true;
}
}
if (!hasFood && witcher.GetItemEquippedOnSlot(15, item)){
if (witcher.inv.IsItemFood(item)){
hasFood = true;
}
}
if (hasFood){
ShowHint(USAGE, theGame.params.TUT_POS_INVENTORY_X, theG
ame.params.TUT_POS_INVENTORY_Y - 0.100000, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
} else {
if (witcher.inv.GetItemQuantityByTag('Edibles', /* NOP *
/) == 0){
witcher.inv.AddAnItem('Bread', 1, true, false, /
* NOP */);
}
currentTab = (CR4InventoryMenu)(CR4MenuBase)theGame.GetG
uiManager().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab == 1){
OnPotionTabSelected();
} else {
highlights.Resize(1);
highlights[0].x = 0.105000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVE
NTORY_X, theGame.params.TUT_POS_INVENTORY_Y - 0.100000, 3, highlights, /* NOP */
, /* NOP */);
}
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(SELECT_TAB);
CloseHint(SELECT_FOOD);
CloseHint(EQUIP_FOOD);
CloseHint(USAGE);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;

if (closedByParentMenu || isClosing){
return true;
}
if (hintName == USAGE){
QuitState();
}
/* NOP */;
}
public function OnPotionTabSelected() : Bool{
CloseHint(SELECT_TAB);
ShowHint(SELECT_FOOD, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y - 0.100000, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnSelectedItem(itemId : SItemUniqueId) : Bool{
if (IsCurrentHint(SELECT_FOOD) && thePlayer.inv.IsItemFood(itemI
d)){
CloseHint(SELECT_FOOD);
ShowHint(EQUIP_FOOD, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y - 0.100000, 3, /* NOP */, /* NOP */, /* NOP
*/);
} else if (IsCurrentHint(EQUIP_FOOD) && !thePlayer.inv.IsItemFoo
d(itemId)){
CloseHint(EQUIP_FOOD);
ShowHint(SELECT_FOOD, theGame.params.TUT_POS_INVENTORY_X
, theGame.params.TUT_POS_INVENTORY_Y - 0.100000, 3, /* NOP */, /* NOP */, /* NOP
*/);
}
/* NOP */;
}
public function OnFoodEquipped() : Bool{
CloseHint(EQUIP_FOOD);
ShowHint(USAGE, theGame.params.TUT_POS_INVENTORY_X, theGame.para
ms.TUT_POS_INVENTORY_Y - 0.100000, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class CHudResourceFactory{
}
import abstract class CMenuResourceFactory{
}
state W3TutorialManagerUIHandlerStateSecondPotionEquip in W3TutorialManagerUIHan
dler extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var CAN_EQUIP : CName;
private const var SELECT_TAB : CName;
private const var EQUIP_POTION : CName;
private var isClosing : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
var currentTab : Int32;
super.OnEnterState(prevStateName);
isClosing = false;
theGame.GetTutorialSystem().UnmarkMessageAsSeen(EQUIP_POTION);
currentTab = (CR4InventoryMenu)(CR4MenuBase)theGame.GetGuiManage
r().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab == 1){
OnPotionTabSelected();
} else {

ShowHint(CAN_EQUIP, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(CAN_EQUIP);
CloseHint(SELECT_TAB);
CloseHint(EQUIP_POTION);
theGame.GetTutorialSystem().MarkMessageAsSeen(CAN_EQUIP);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
theGame.GetTutorialSystem().MarkMessageAsSeen(EQUIP_POTION);
GameplayFactsRemove("tutorial_equip_potion");
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
}
if (hintName == CAN_EQUIP){
highlights.Resize(1);
highlights[0].x = 0.145000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnPotionTabSelected() : Bool{
CloseHint(SELECT_TAB);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
ShowHint(EQUIP_POTION, theGame.params.TUT_POS_INVENTORY_X, theGa
me.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnPotionEquipped(potionItemName : CName) : Bool{
QuitState();
/* NOP */;
}
}
import abstract class CPopupResourceFactory{
}
import abstract class CFlashProxyComponent{
}
state W3TutorialManagerUIHandlerStateRecipeReading in W3TutorialManagerUIHandler
extends W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var OPEN_INVENTORY : CName;
private const var SELECT_TAB : CName;
private const var SELECT_BOOK : CName;
private const var USE : CName;
private const var READ : CName;

private var isClosing : Bool;


public function OnEnterState(prevStateName : CName) : Bool{
var highlights : array<STutorialHighlight>;
var currentTab : Int32;
super.OnEnterState(prevStateName);
isClosing = false;
CloseHint(OPEN_INVENTORY);
currentTab = (CR4InventoryMenu)(CR4MenuBase)theGame.GetGuiManage
r().GetRootMenu().GetLastChild().GetCurrentlySelectedTab();
if (currentTab == 1){
OnSelectedTab(true);
} else {
highlights.Resize(1);
highlights[0].x = 0.150000;
highlights[0].y = 0.150000;
highlights[0].width = 0.050000;
highlights[0].height = 0.080000;
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(SELECT_TAB);
CloseHint(SELECT_BOOK);
CloseHint(USE);
CloseHint(READ);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT_TAB);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnSelectedItem(itemId : SItemUniqueId) : Bool{
if (IsCurrentHint(SELECT_BOOK) && thePlayer.inv.ItemHasTag(itemI
d, 'ReadableItem')){
CloseHint(SELECT_BOOK);
ShowHint(USE, theGame.params.TUT_POS_INVENTORY_X, theGam
e.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else if (IsCurrentHint(USE) && !thePlayer.inv.ItemHasTag(itemI
d, 'ReadableItem')){
CloseHint(USE);
ShowHint(SELECT_BOOK, theGame.params.TUT_POS_INVENTORY_X
, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnSelectedTab(properTab : Bool) : Bool{
if (IsCurrentHint(SELECT_TAB) && properTab){
CloseHint(SELECT_TAB);
ShowHint(SELECT_BOOK, theGame.params.TUT_POS_INVENTORY_X
, theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else if (!IsCurrentHint(SELECT_TAB) && !properTab){
CloseHint(SELECT_BOOK);
CloseHint(USE);
ShowHint(SELECT_TAB, theGame.params.TUT_POS_INVENTORY_X,
theGame.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnBookRead() : Bool{

CloseHint(USE);
ShowHint(READ, theGame.params.TUT_POS_INVENTORY_X, theGame.param
s.TUT_POS_INVENTORY_Y, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
var highlights : array<STutorialHighlight>;
if (closedByParentMenu || isClosing){
return true;
} else if (hintName == READ){
QuitState();
}
/* NOP */;
}
}
import abstract class CGuiObject{
}
import abstract class IGuiResource{
}
import abstract class IGuiResourceBlock{
}
import abstract class CHudModuleResourceBlock{
}
import abstract class
import public
ta : Int32);
import public
ata : Int32);
import public
import public
alueStorage;
import public
ule;
}

CHud{
final function CreateHudModule(moduleName : String, userDa

import abstract class


import public
import public
ValueStorage;
import public
import public
import public
IScriptable);
import public
}

CMenu{
final function GetMenuFlash() : CScriptedFlashSprite;
final function GetMenuFlashValueStorage() : CScriptedFlash

import abstract class


import public
import public
hValueStorage;
import public
import public
import public
}

CPopup{
final function GetPopupFlash() : CScriptedFlashSprite;
final function GetPopupFlashValueStorage() : CScriptedFlas

final function DiscardHudModule(moduleName : String, userD


final function GetHudFlash() : CScriptedFlashSprite;
final function GetHudFlashValueStorage() : CScriptedFlashV
final function GetHudModule(moduleName : String) : CHudMod

final function GetMenuInitData() : IScriptable;


final function GetMenuName() : CName;
final function RequestSubMenu(menuName : CName, initData :
final function CloseMenu();

final function GetPopupInitData() : IScriptable;


final function GetPopupName() : CName;
final function ClosePopup();

import abstract class IMenuFlashParam{


}
import abstract class CMenuInheritBackgroundVideoParam{
}
import abstract class CMenuBackgroundVideoFileParam{
}
import abstract class CMenuBackgroundVideoAliasParam{
}
import abstract class CMenuClearBackgroundVideoParam{
}
import abstract class CMenuTimeScaleParam{
}
state W3TutorialManagerUIHandlerStateRunes in W3TutorialManagerUIHandler extends
W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var SELECT : CName;
private const var RUNE : CName;
private const var SWORD : CName;
public function OnEnterState(prevStateName : CName) : Bool{
var highlights : array<STutorialHighlight>;
super.OnEnterState(prevStateName);
highlights.Resize(1);
highlights[0].x = 0.060000;
highlights[0].y = 0.145000;
highlights[0].width = 0.060000;
highlights[0].height = 0.090000;
ShowHint(SELECT, theGame.params.TUT_POS_INVENTORY_X, theGame.par
ams.TUT_POS_INVENTORY_Y, 3, highlights, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
CloseHint(SELECT);
CloseHint(RUNE);
CloseHint(SWORD);
theGame.GetTutorialSystem().MarkMessageAsSeen(SELECT);
theGame.GetTutorialSystem().MarkMessageAsSeen(SWORD);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnSelectedItem(itemId : SItemUniqueId) : Bool{
if (IsCurrentHint(SELECT) && thePlayer.inv.ItemHasTag(itemId, 'W
eaponUpgrade')){
CloseHint(SELECT);
ShowHint(RUNE, theGame.params.TUT_POS_INVENTORY_X, theGa
me.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
} else if (IsCurrentHint(RUNE) && !thePlayer.inv.ItemHasTag(item
Id, 'WeaponUpgrade')){
CloseHint(RUNE);
ShowHint(SELECT, theGame.params.TUT_POS_INVENTORY_X, the
Game.params.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnSelectingSword() : Bool{

CloseHint(RUNE);
ShowHint(SWORD, theGame.params.TUT_POS_INVENTORY_X, theGame.para
ms.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnSelectingSwordAborted() : Bool{
CloseHint(SWORD);
ShowHint(RUNE, theGame.params.TUT_POS_INVENTORY_X, theGame.param
s.TUT_POS_INVENTORY_Y, 3, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnUpgradedItem() : Bool{
QuitState();
/* NOP */;
}
}
import abstract class CMenuPauseParam{
}
import abstract class CMenuRenderBackgroundParam{
}
import abstract class CMenuBackgroundEffectParam{
}
import abstract class CMenuHudParam{
}
import abstract class CMenuFlashSymbolParam{
}
import abstract class CMenuFlashSwfParam{
}
import abstract class CPopupTimeScaleParam{
}
import abstract class CPopupPauseParam{
}
import abstract class IScriptedFlash{
}
import abstract class SFlashArg{
}
import abstract class CGuiManager{
}
import abstract class CWizardBaseNode{
}
import abstract class CWizardDefinition{
}
import abstract class CWizardDefinitionFactory{
}
state W3TutorialManagerUIHandlerStateShop in W3TutorialManagerUIHandler extends

W3TutorialManagerUIHandlerStateTutHandlerBaseState{
private const var DESCRIPTION : CName;
private const var BUY : CName;
private const var CLOSE : CName;
private var isClosing : Bool;
private const var SHOP_POS_CLOSE_X : Float;
private const var SHOP_POS_CLOSE_Y : Float;
private const var SHOP_POS_X : Float;
private const var SHOP_POS_Y : Float;
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
isClosing = false;
ShowHint(DESCRIPTION, SHOP_POS_X, SHOP_POS_Y, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
isClosing = true;
CloseHint(DESCRIPTION);
CloseHint(BUY);
CloseHint(CLOSE);
theGame.GetTutorialSystem().MarkMessageAsSeen(BUY);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
if (hintName == DESCRIPTION && !closedByParentMenu && !isClosing
){
CloseHint(DESCRIPTION);
ShowHint(BUY, SHOP_POS_X, SHOP_POS_Y, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
} else if (hintName == BUY && !closedByParentMenu && !isClosing)
{
CloseHint(BUY);
ShowHint(CLOSE, SHOP_POS_X, SHOP_POS_Y, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnBoughtItem() : Bool{
}
}
class W3InventoryItemContext extends W3UIContext{
protected var currentItemId : SItemUniqueId;
protected var currentSlot : EEquipmentSlots;
protected var invMenuRef : CR4InventoryMenu;
protected var invComponentRef : CInventoryComponent;
protected var invSecondComponentRef : CInventoryComponent;
protected var contextMenuPosition_x : Float;
protected var contextMenuPosition_y : Float;
public function Init(ownerManager : W3ContextManager){
super.Init(ownerManager);
invComponentRef = invMenuRef.GetCurrentInventory(GetInvalidUniqu
eId());
/* NOP */;
}
public function SetSecondInventoryComponentRef(ref : CInventoryComponent
){

invSecondComponentRef = ref;
/* NOP */;
}
public function SetInventoryRef(TargetInvMenu : CR4InventoryMenu){
invMenuRef = TargetInvMenu;
/* NOP */;
}
public function SetContextMenuData(posX : Float, posY : Float){
contextMenuPosition_x = posX;
contextMenuPosition_y = posY;
/* NOP */;
}
public function SetCurrentSlot(TargetSlot : EEquipmentSlots){
currentSlot = TargetSlot;
/* NOP */;
}
public function SetCurrentItem(TargetItemId : SItemUniqueId){
if (currentItemId != TargetItemId){
currentItemId = TargetItemId;
updateInputFeedback();
}
/* NOP */;
}
protected function triggerTooltip(){
if (invComponentRef.IsIdValid(currentItemId)){
invMenuRef.ShowItemTooltip(currentItemId, currentSlot);
} else if (currentSlot > 0){
} else {
invMenuRef.HideItemTooltip();
}
/* NOP */;
}
protected function ShowContextMenu(){
var contextMenuData : W3ContextMenu;
if (m_inputBindings.Size() > 0 && invMenuRef){
contextMenuData = new W3ContextMenu in this;
contextMenuData.positionX = contextMenuPosition_x;
contextMenuData.positionY = contextMenuPosition_y;
contextMenuData.contextRef = this;
contextMenuData.actionsList = m_contextBindings;
invMenuRef.RequestSubMenu('PopupMenu', contextMenuData);
}
/* NOP */;
}
public function HandleUserFeedback(keyName : String){
var itemsCount : Int32;
var itemCategory : CName;
var isItemValid : Bool;
var isSchematic : Bool;
var playerInv : W3GuiBaseInventoryComponent;
var notificationText : String;
var language : String;
var audioLanguage : String;
isItemValid = invComponentRef.IsIdValid(currentItemId);
if (!isItemValid && invSecondComponentRef && invSecondComponentR
ef.IsIdValid(currentItemId)){
isItemValid = true;
}
if (!isItemValid){
return;

}
super.HandleUserFeedback(keyName);
itemsCount = invComponentRef.GetItemQuantity(currentItemId);
if (keyName == "gamepad_X"){
if (invComponentRef.ItemHasTag(currentItemId, 'Edibles')
|| invComponentRef.ItemHasTag(currentItemId, 'Drinks')){
invMenuRef.OnConsumeItem(currentItemId);
} else if (invComponentRef.ItemHasTag(currentItemId, 'Po
tion')){
if (GetWitcherPlayer().ToxicityLowEnoughToDrinkP
otion(14, currentItemId)){
GetWitcherPlayer().DrinkPreparedPotion(1
4, currentItemId);
invMenuRef.InventoryUpdateItem(currentIt
emId);
if (thePlayer.inv.GetItemName(currentIte
mId) == 'Mutagen 3'){
invMenuRef.PaperdollUpdateAll();
invMenuRef.PopulateTabData(1);
}
} else {
notificationText = GetLocStringByKeyExt(
"menu_cannot_perform_action_now") + "<br/>" + GetLocStringByKeyExt("panel_common
_statistics_tooltip_current_toxicity");
theGame.GetGameLanguageName(audioLanguag
e, language);
if (language == "AR"){
notificationText += thePlayer.ab
ilityManager.GetStat(3, false) + " / " + thePlayer.abilityManager.GetStatMax(3)
+ " :";
} else {
notificationText += ": " + thePl
ayer.abilityManager.GetStat(3, false) + " / " + thePlayer.abilityManager.GetStat
Max(3);
}
theSound.SoundEvent("gui_global_denied")
;
invMenuRef.showNotification(notification
Text, /* NOP */);
}
}
updateInputFeedback();
} else if (keyName == "enter-gamepad_A"){
if (!theInput.LastUsedPCInput() || IsPadBindingExist(key
Name)){
execurePrimaryAction();
}
} else if (keyName == "gamepad_Y"){
invMenuRef.OnDropItem(currentItemId, itemsCount);
} else if (keyName == "gamepad_L2"){
itemCategory = invComponentRef.GetItemCategory(currentIt
emId);
isSchematic = itemCategory == 'alchemy_recipe' || itemCa
tegory == 'crafting_schematic';
if (isSchematic){
playerInv = invMenuRef.GetCurrentInventoryCompon
ent();
if (playerInv){
invMenuRef.ShowBookPopup(GetLocStringByK
eyExt(invComponentRef.GetItemLocalizedNameByUniqueID(currentItemId)), playerInv.

GetBookText(currentItemId));
}
}
}
/* NOP */;
}
protected function IsHorseItem(currentItemId : SItemUniqueId) : Bool{
if (invComponentRef.ItemHasTag(currentItemId, 'Saddle') || invCo
mponentRef.ItemHasTag(currentItemId, 'HorseBag') || invComponentRef.ItemHasTag(c
urrentItemId, 'Trophy') || invComponentRef.ItemHasTag(currentItemId, 'Blinders')
){
return true;
}
return false;
/* NOP */;
}
protected function updateInputFeedback(){
}
protected function execurePrimaryAction(){
}
}
class W3GuiItemSelectComponent extends W3GuiPlayerInventoryComponent{
protected var _filterData : W3ItemSelectMenuInitData;
public function InitFilter(filterValue : W3ItemSelectMenuInitData){
_filterData = filterValue;
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
if (!_filterData){
return true;
} else if (_filterData.onlyEquipped && !isEquipped(item)){
return false;
} else if (_filterData.onlyUnequipped && isEquipped(item)){
return false;
} else if (!chekTags(item, _filterData.containTags)){
return false;
}
return true;
/* NOP */;
}
protected function isEquipped(item : SItemUniqueId) : Bool{
return GetWitcherPlayer().IsItemEquipped(item);
/* NOP */;
}
protected function chekTags(item : SItemUniqueId, targetTags : array<CNa
me>) : Bool{
var idx : Int32;
idx = 0;
while (idx < targetTags.Size()){
if (!_inv.ItemHasTag(item, targetTags[idx])){
return false;
}
idx += 1;
}
return true;
/* NOP */;
}
}

class W3MerchantNPC extends CNewNPC{


private editable var embeddedScenes : array<MerchantNPCEmbeddedScenes>;
private saved var lastDayOfInteraction : Int32;
public saved var questBonus : Bool;
public editable var cacheMerchantMappin : Bool;
public editable saved var craftingDisabled : Bool;
public var invComp : CInventoryComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var tags : array<CName>;
super.OnSpawned(spawnData);
if (theGame.IsActive()){
if (!HasTag('ShopkeeperEntity')){
tags = GetTags();
tags.PushBack('ShopkeeperEntity');
SetTags(tags);
}
}
invComp = GetInventory();
if (invComp){
if (spawnData.restored == true){
invComp.ClearTHmaps();
invComp.ClearGwintCards();
invComp.ClearKnownRecipes();
if (questBonus == true){
invComp.ActivateQuestBonus();
}
} else {
invComp.SetupFunds();
lastDayOfInteraction = GameTimeDays(theGame.GetG
ameTime());
}
} else {
/* NOP */;
}
/* NOP */;
}
public function ActivateQuestBonus(){
var invComp : CInventoryComponent;
invComp = GetInventory();
if (invComp){
invComp.ActivateQuestBonus();
}
questBonus = true;
/* NOP */;
}
public function HasEmbeddedScenes() : Bool{
if (embeddedScenes.Size() > 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function GetEmbeddedSceneBlocked(conditions : array<MerchantNPCEm
beddedScenesConditions>) : Bool{
var size : Int32;
var i : Int32;
size = conditions.Size();
if (size == 0){
return false;

}
i = 0;
while (i < size){
if (HasTag(conditions[i].applyToTag) || conditions[i].ap
plyToTag == 'None'){
if (conditions[i].requiredFact != "" && FactsQue
rySum(conditions[i].requiredFact) == 0 || FactsQuerySum(conditions[i].forbiddenF
act) >= 1){
return true;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function StartEmbeddedScene() : Bool{
var voiceTag : CName;
var i : Int32;
voiceTag = GetVoicetag();
if (voiceTag){
i = 0;
while (i < embeddedScenes.Size()){
if (embeddedScenes[i].voiceTag == voiceTag){
if (GetEmbeddedSceneBlocked(embeddedScen
es[i].conditions)){
return false;
} else {
theGame.GetStorySceneSystem().Pl
ayScene(embeddedScenes[i].storyScene, embeddedScenes[i].input);
return true;
}
}
i += 1;
}
}
return false;
/* NOP */;
}
public function HasValidEmbeddedScene() : Bool{
var voiceTag : CName;
var i : Int32;
voiceTag = GetVoicetag();
if (embeddedScenes.Size() <= 0){
return false;
}
if (voiceTag){
i = 0;
while (i < embeddedScenes.Size()){
if (embeddedScenes[i].voiceTag == voiceTag){
if (GetEmbeddedSceneBlocked(embeddedScen
es[i].conditions)){
return false;
} else {
return true;
}
}
i += 1;
}
}

return false;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var ciriEntity : W3ReplacerCiri;
var isPlayingChatScene : Bool;
var timeElapsed : Int32;
var gameTimeDay : Int32;
/* NOP */;
if (actionName == "Talk"){
invComp = GetInventory();
if (invComp){
gameTimeDay = GameTimeDays(theGame.GetGameTime()
);
timeElapsed = gameTimeDay - lastDayOfInteraction
;
if (timeElapsed >= invComp.GetDaysToIncreaseFund
s() || timeElapsed < 0){
invComp.IncreaseFunds();
lastDayOfInteraction = gameTimeDay;
}
} else {
/* NOP */;
}
/* NOP */;
isPlayingChatScene = IsPlayingChatScene();
if (HasEmbeddedScenes()){
if (!isPlayingChatScene){
if (!PlayDialog(/* NOP */)){
ciriEntity = (W3ReplacerCiri)the
Player;
if (ciriEntity){
EnableDynamicLookAt(theP
layer, 5);
} else if (!StartEmbeddedScene()
){
super.OnInteraction(acti
onName, activator);
}
}
}
} else {
super.OnInteraction(actionName, activator);
}
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (HasEmbeddedScenes() && interactionComponentName == "talk"){
if (activator == thePlayer && thePlayer.CanStartTalk() |
| HasValidEmbeddedScene() && !wasInTalkInteraction){
return true;
}
}
return super.OnInteractionActivationTest(interactionComponentNam
e, activator);
/* NOP */;
}

public function IsCraftingDisabled() : Bool{


return craftingDisabled;
/* NOP */;
}
public function SetCraftingEnabled(enable : Bool){
craftingDisabled = !enable;
/* NOP */;
}
}
struct MerchantNPCEmbeddedScenes{
editable var voiceTag : CName;
editable var storyScene : CStoryScene;
editable var input : CName;
editable var conditions : array<MerchantNPCEmbeddedScenesConditions>;
}
class W3ItemSelectMenuInitData extends CObject{
public var onlyEquipped : Bool;
public var onlyUnequipped : Bool;
public var containTags : array<CName>;
public function applyItemSelection(item : SItemUniqueId){
}
}
import struct CJournalQuestDescriptionGroup{
}
struct SRange{
editable var min : Int32;
editable var max : Int32;
}
struct SRangeF{
editable var min : Float;
editable var max : Float;
}
struct SPlayerOffenseStats{
var steelFastDmg : Float;
var steelFastCritChance : Float;
var steelFastCritDmg : Float;
var steelFastDPS : Float;
var steelStrongDmg : Float;
var steelStrongCritChance : Float;
var steelStrongCritDmg : Float;
var steelStrongDPS : Float;
var silverFastDmg : Float;
var silverFastCritChance : Float;
var silverFastCritDmg : Float;
var silverFastDPS : Float;
var silverStrongDmg : Float;
var silverStrongCritChance : Float;
var silverStrongCritDmg : Float;
var silverStrongDPS : Float;
var crossbowCritChance : Float;
var crossbowSteelDmg : Float;
var crossbowSteelDmgType : CName;
var crossbowSilverDmg : Float;
}

struct SAvailableFastTravelMapPin{
var tag : CName;
var type : CName;
var area : EAreaName;
}
struct AlignmentTest{
var i : Int32;
var a : Vector;
}
struct SFactParameters{
editable var ID : String;
editable var value : Int32;
editable var validFor : Int32;
}
struct SGameplayFact{
saved var factName : String;
saved var value : Int32;
}
struct SGameplayFactRemoval{
saved var factName : String;
saved var value : Int32;
saved var timerID : Int32;
}
struct SDurabilityThreshold{
var thresholdMax : Float;
var multiplier : Float;
var difficulty : EDifficultyMode;
}
struct SInGameConfigBufferedEntry{
var groupName : CName;
var varName : CName;
var varValue : String;
var startValue : String;
}
struct SPostponedPreAttackEvent{
var entity : CGameplayEntity;
var eventName : CName;
var eventType : EAnimationEventType;
var data : CPreAttackEventData;
var animInfo : SAnimationEventAnimInfo;
}
struct SCombatParams{
var goalId : Int32;
}
struct SAttackEventData{
var animData : CPreAttackEventData;
var weaponId : SItemUniqueId;
var parriedBy : array<CActor>;
}

struct STimescaleSource{
var sourceName : CName;
var sourceType : ETimescaleSource;
var sourcePriority : Int32;
}
struct SNotWorkingOutFunctionParametersHackStruct1{
var outValue : Int32;
var retValue : Bool;
}
struct SStatistic{
var statType : EStatistic;
var registeredAchievements : array<SAchievement>;
}
struct SAchievement{
var type : EAchievement;
var requiredValue : Float;
}
struct SCachedCombatMessage{
var finalIncomingDamage : Float;
var resistPoints : Float;
var resistPercents : Float;
var finalDamage : Float;
var attacker : CGameplayEntity;
var victim : CGameplayEntity;
}
struct STutorialMessage{
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var
editable saved var

type : ETutorialMessageType;
tutorialScriptTag : CName;
journalEntryName : CName;
canBeShownInMenus : Bool;
canBeShownInDialogs : Bool;
glossaryLink : Bool;
enableAcceptButton : Bool;
force : Bool;
disableHorizontalResize : Bool;
forceToQueueFront : Bool;
hintPositionType : ETutorialHintPositionType;
hintPosX : Float;
hintPosY : Float;
hintDuration : Float;
hintCloseOnFactExist : String;
highlightAreas : array<STutorialHighlight>;
disabledPanelsExceptions : array<CName>;
hintPromptScriptTag : CName;
hintPromptPosX : Float;
hintPromptPosY : Float;
hintPromptDuration : Float;
hintPromptCloseFact : String;
markAsSeenOnShow : Bool;
isHUDTutorial : Bool;
hintDurationType : ETutorialHintDurationType;
blockInput : Bool;
pauseGame : Bool;
fullscreen : Bool;
minDuration : Float;

saved var remainingMinDuration : Float;


saved var hideOnMinDurationEnd : Bool;
editable saved var factOnFinishedDisplay : String;
}
struct STutorialHighlight{
editable saved var
editable saved var
editable saved var
editable saved var
}

x : Float;
y : Float;
width : Float;
height : Float;

struct SFXSurfacePostParams{
editable var fxFadeInTime : Float;
editable var fxLastingTime : Float;
editable var fxFadeOutTime : Float;
editable var fxRadius : Float;
editable var fxType : Int32;
}
struct CriticalStateStruct{
var CSType : ECriticalStateType;
var isActive : Bool;
var lastTimeActive : Float;
}
struct SReactionEventData{
editable var eventName : CName;
editable var lifetime : Float;
editable var distance : Float;
editable var broadcastInterval : Float;
editable var recipientCount : Int32;
editable var cooldown : Float;
editable var chanceOfSucceeding : Float;
editable var lastBroadcastTime : Float;
}
struct SQuestCameraRequest{
editable var requestYaw : Bool;
editable var yaw : Float;
editable var requestPitch : Bool;
editable var pitch : Float;
editable var lookAtTag : CName;
editable var duration : Float;
var requestTimeStamp : Float;
}
struct SCameraAnimationData{
editable var animation : CName;
editable var priority : ECameraAnimPriority;
editable var blend : Float;
editable var weight : Float;
editable var loop : Bool;
}
struct SCraftsman{
editable var type : ECraftsmanType;
editable var level : ECraftsmanLevel;
editable var noCraftingCost : Bool;
}

struct SPlaneMovementParameters{
editable var m_SpeedMaxF : Float;
editable var m_AccelF : Float;
editable var m_DecelF : Float;
editable var m_BrakeF : Float;
editable var m_BrakeDotF : Float;
}
struct SVerticalMovementParams{
editable var m_VertImpulseF : Float;
editable var m_VertMaxSpeedF : Float;
editable var m_GravityUpF : Float;
editable var m_GravityDownF : Float;
}
struct SSlidingMovementParams{
editable var m_TurnSpeedF : Float;
editable var m_FrictionSquareF : Float;
editable var m_FrictionLinearF : Float;
editable var m_FrictionConstF : Float;
editable var m_FrictionConstExitF : Float;
editable var m_InputVisualTurnCoefF : Float;
editable var m_GravityF : Float;
editable var m_RestitutionF : Float;
editable var m_InputAccelInfluenceF : Float;
editable var m_InputFrictionCoefMinF : Float;
editable var m_InputFrictionCoefMaxF : Float;
editable var m_InputFrictionBlend : Float;
editable var m_InputStrafeCoefF : Float;
}
struct SSkatingMovementParams{
editable var accel : Float;
editable var decel : Float;
editable var decelMaxSpeed : Float;
editable var brake : Float;
editable var brakeBaseSpeed : Float;
editable var frictionSquare : Float;
editable var frictionLinear : Float;
editable var frictionConst : Float;
editable inlined var turnCurve : CCurve;
editable var gravity : Float;
editable var turnToGravity : Float;
editable var gravitySpeedMax : Float;
}
struct SJumpParams{
editable var m_BehaviorEventN : CName;
editable var m_PredictionTimeF : Float;
editable inlined var m_VerticalMovementS : SVerticalMovementParams;
editable var m_HorImpulseAtStartB : Bool;
editable var m_HorImpulseF : Float;
editable inlined var m_HorMovementS : SPlaneMovementParameters;
editable var m_TakeOffTimeF : Float;
editable var m_StartOrientTimeF : Float;
editable var m_UsePhysicJumpB : Bool;
editable var m_ConserveCoefsB : Bool;
editable var m_ExternalDirectionForcedB : Bool;
editable var m_AllowAirDisplacementControlB : Bool;

editable var m_StartDirectionAllowanceF : Float;


editable var m_StartDirectionIgnoreF : Float;
editable var m_OrientationSpeedF : Float;
editable var m_ConserveAddB : Bool;
editable var m_RecalcSpeedOnInertialB : Bool;
editable var m_TimeToCheckCollisionsF : Float;
editable var m_TimeToPrepareForLandF : Float;
var m_JumpTypeE : EJumpType;
editable var m_DontRecalcFootOnLand : Bool;
editable var m_FlipFeetOnLandB : Bool;
}
struct SLandData{
editable var
editable var
editable var
editable var
editable var
editable var
editable var
}

landType : ELandType;
timeBeforeChain : Float;
cameraShakeStrength : Float;
orientationSpeed : Float;
timeSafetyEnd : Float;
landEndForcedMode : ELandRunForcedMode;
shouldFlipFoot : Bool;

struct MappinTypeInfo{
var type : CName;
var visible : Bool;
var amount : Int32;
}
struct SBlockedAbility{
editable saved var abilityName : CName;
editable saved var timeWhenEnabledd : Float;
saved var count : Int32;
}
class W3Bird extends CGameplayEntity{
public editable var flyingAppearanceName : CName;
public editable var destroyDistance : Float;
public editable var flyCurves : array<CName>;
private var manager : CBirdsManager;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
LogAssert(flyCurves.Size() > 0, "W3Bird.OnSpawned: bird must hav
e at least one fly curve!");
AddAnimEventCallback('ReadyToFly', 'OnAnimEvent_ReadyToFly');
/* NOP */;
}
public function SetBirdManager(m : CBirdsManager){
manager = m;
/* NOP */;
}
public timer function DestructionTimer(optional dt : Float, optional id
: Int32){
var isVisible : Bool;
var x : Float;
var y : Float;
isVisible = theCamera.WorldVectorToViewRatio(GetWorldPosition(),
x, y);
if (isVisible && AbsF(x) > 1.100000 && AbsF(y) > 1.100000){
isVisible = false;
}

if (!isVisible && VecDistance(GetWorldPosition(), theCamera.GetC


ameraPosition()) > destroyDistance){
if (manager){
manager.OnBirdDestroyed(this);
}
Destroy();
}
/* NOP */;
}
public function Fly() : Bool{
var tryFly : Bool;
tryFly = RaiseEvent('Fly');
AddTimer('DestructionTimer', 1, true, /* NOP */, /* NOP */, /* N
OP */, /* NOP */);
if (!tryFly || flyCurves.Size() == 0){
return false;
}
return true;
/* NOP */;
}
public function OnAnimEvent_ReadyToFly(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (IsNameValid(flyingAppearanceName)){
ApplyAppearance(flyingAppearanceName);
}
PlayPropertyAnimation(flyCurves[RandRange(flyCurves.Size() - 1,
0)], 1, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnPropertyAnimationFinished(propertyName : CName, animat
ionName : CName) : Bool{
if (manager){
manager.OnBirdDestroyed(this);
}
Destroy();
/* NOP */;
}
}
class W3CurveFish extends CGameplayEntity{
public editable var destroyDistance : Float;
public editable var swimCurves : array<CName>;
public editable var speedUpChance : Float;
public editable var baseSpeedVariance : Float;
public editable var maxSpeed : Float;
public editable var randomizedAppearances : array<String>;
private var manager : W3CurveFishManager;
private var baseSpeed : Float;
private var selectedSwimCurve : CName;
private var currentSpeed : Float;
private var accelerate : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
selectedSwimCurve = swimCurves[RandRange(swimCurves.Size(), 0)];
super.OnSpawned(spawnData);
LogAssert(swimCurves.Size() > 0, "W3CurveFish.OnSpawned: fish mu
st have at least one swim curve!");
SetupFishBaseSpeed();
if (randomizedAppearances.Size() > 1){
ApplyAppearance(randomizedAppearances[RandRange(randomiz
edAppearances.Size() - 1, 0)]);

}
PlayPropertyAnimation(selectedSwimCurve, 0, baseSpeed, /* NOP */
);
AddTimer('DestructionTimer', 1.000000, true, /* NOP */, /* NOP *
/, true, /* NOP */);
AddTimer('SpeedHandler', 0.100000, true, /* NOP */, /* NOP */, /
* NOP */, /* NOP */);
/* NOP */;
}
public function SetFishManager(m : W3CurveFishManager){
manager = m;
/* NOP */;
}
public function SetupFishBaseSpeed(){
if (baseSpeedVariance < 0.000000){
baseSpeedVariance = 0.000000;
}
baseSpeed = 1.000000 + RandRangeF(baseSpeedVariance, baseSpeedVa
riance * -1.000000);
currentSpeed = baseSpeed;
/* NOP */;
}
public timer function DestructionTimer(optional dt : Float, optional id
: Int32){
var isVisible : Bool;
var x : Float;
var y : Float;
isVisible = theCamera.WorldVectorToViewRatio(GetWorldPosition(),
x, y);
if (isVisible && AbsF(x) > 1.100000 && AbsF(y) > 1.100000){
isVisible = false;
}
if (!isVisible && VecDistance(GetWorldPosition(), theCamera.GetC
ameraPosition()) > destroyDistance){
manager.OnFishDestroyed(this);
Destroy();
}
/* NOP */;
}
public function ModifyFishSpeed(){
SetBehaviorVariable('Speed', currentSpeed * 0.500000, /* NOP */)
;
PlayPropertyAnimation(selectedSwimCurve, 0, currentSpeed, /* NOP
*/);
/* NOP */;
}
public timer function SpeedHandler(optional dt : Float, optional id : In
t32){
var rand : Float;
if (currentSpeed <= baseSpeed){
rand = RandRangeF(1.000000, 0.000000);
if (rand >= speedUpChance){
accelerate = true;
currentSpeed = currentSpeed + 0.100000;
ModifyFishSpeed();
}
} else if (accelerate){
currentSpeed = currentSpeed + 0.100000;
ModifyFishSpeed();
if (currentSpeed >= maxSpeed){

accelerate = false;
}
} else {
currentSpeed = currentSpeed - 0.100000;
ModifyFishSpeed();
}
/* NOP */;
}
public function OnDestroyed() : Bool{
RemoveTimer('SpeedHandler', /* NOP */);
/* NOP */;
}
}
struct SCraftAttribute{
var attributeName : CName;
var valAdditive : Float;
var valMultiplicative : Float;
var displayPercMul : Bool;
var displayPercAdd : Bool;
}
struct SItemUpgrade{
var upgradeName : CName;
var localizedName : CName;
var localizedDescriptionName : CName;
var cost : Int32;
var iconPath : String;
var ability : CName;
var ingredients : array<SItemParts>;
var requiredUpgrades : array<CName>;
}
struct SRawDamage{
editable var dmgType : CName;
editable var dmgVal : Float;
}
struct SCustomEffectParams{
var effectType : EEffectType;
var creator : CGameplayEntity;
var sourceName : String;
var duration : Float;
var effectValue : SAbilityAttributeValue;
var customAbilityName : CName;
var customFXName : CName;
var isSignEffect : Bool;
var customPowerStatValue : SAbilityAttributeValue;
var buffSpecificParams : W3BuffCustomParams;
var vibratePadLowFreq : Float;
var vibratePadHighFreq : Float;
}
class W3BuffCustomParams extends CObject{
}
import struct CR4FastTravelEntity{
//NULL type for isHubExit
//NULL type for canBeReachedByBoat
}

struct SEffectInitInfo{
var owner : CGameplayEntity;
var target : CActor;
var duration : Float;
var sourceName : String;
var targetEffectManager : W3EffectManager;
var powerStatValue : SAbilityAttributeValue;
var customEffectValue : SAbilityAttributeValue;
var customAbilityName : CName;
var customFXName : CName;
var isSignEffect : Bool;
var vibratePadLowFreq : Float;
var vibratePadHighFreq : Float;
}
struct SEffectInfo{
editable var
editable var
editable var
editable var
editable var
editable var
editable var
}

effectType : EEffectType;
effectDuration : Float;
effectAbilityName : CName;
customFXName : CName;
effectCustomValue : SAbilityAttributeValue;
effectCustomParam : W3BuffCustomParams;
applyChance : Float;

struct SEncounterActionPointSelectorPairScr{
editable var category : SWorkCategoryWrapper;
editable var chance : Float;
}
struct SGuardAreaEntryGeneratorNodeParam{
editable var guardAreaTag : CName;
editable var pursuitAreaTag : CName;
editable var pursuitRange : Float;
}
class CAIIdleTree extends CAIMainTree{
}
class CAINpcHistoryWanderParams extends CAINpcTaggedWanderParams{
public editable var rightSideMovement : Bool;
}
struct SMonsterNestUpdateDefinition{
editable saved var isRebuilding : Bool;
editable saved var defaultPhaseToActivate : CName;
editable saved var bossPhaseToActivate : CName;
editable var hasBoss : Bool;
editable var bossSpawnDelay : Float;
editable inlined var nestRebuildSchedule : GameTimeWrapper;
}
struct SItemDataStub{
var id : SItemUniqueId;
var quantity : Int32;
var iconPath : String;
var gridPosition : Int32;
var gridSize : Int32;
var slotType : Int32;

var
var
var
var
var
var
var

isNew : Bool;
actionType : Int32;
price : Int32;
userData : String;
category : String;
equipped : Int32;
isReaded : Bool;

}
struct SAreaItemDefinition{
saved var itemName : CName;
saved var maxCount : Int32;
}
struct SAreaLootParams{
saved var remainingItemDrops : array<SAreaItemDefinition>;
saved var areaType : EAreaName;
}
struct SPetardParams{
saved var damages : array<SRawDamage>;
saved var buffs : array<SEffectInfo>;
saved var ignoresArmor : Bool;
editable var range : Float;
editable var cylinderHeight : Float;
editable var cylinderOffsetZ : Float;
editable var playHitAnimMode : EActionHitAnim;
editable var disabledAbilities : array<SBlockedAbility>;
editable var fxPlayedWhenAbilityDisabled : array<CName>;
editable var fxStoppedWhenAbilityDisabled : array<CName>;
editable var fxPlayedOnHit : array<CName>;
editable var surfaceFX : SFXSurfacePostParams;
editable var fx : array<CName>;
editable var fxWater : array<CName>;
editable var componentsToSnap : array<CName>;
}
struct SPairedRiddleNodeDef{
editable var pairedRiddleNodeTag : CName;
editable var pairedRiddleNodeRequiredPos : Int32;
editable var externalRiddleFx : SExternalRiddleEffectEntityDef;
}
struct SExternalRiddleEffectEntityDef{
editable var entityTag : CName;
editable var fxName : CName;
var isEffectOn : Bool;
}
struct SSignProjectile{
editable var speed : Float;
editable var flyEffect : CName;
editable var hitEffect : CName;
editable var targetHitEffect : CName;
editable var lastingTime : Float;
}
struct W3POIEntities{
editable var poiEntityTemplate : CEntityTemplate;
editable var maxSpawnedEntities : Int32;

}
struct SUITutorial{
editable saved
editable saved
editable saved
editable saved
editable saved
editable saved
editable saved
editable saved
editable saved
}

var
var
var
var
var
var
var
var
var

menuName : CName;
tutorialStateName : CName;
triggerCondition : EUITutorialTriggerCondition;
requiredGameplayFactName : String;
requiredGameplayFactValueInt : Int32;
requiredGameplayFactComparator : ECompareOp;
priority : Int32;
abortOnMenuClose : Bool;
sourceName : String;

struct newGameConfig{
var tutorialsOn : Bool;
var difficulty : Int32;
var simulate_import : Bool;
var import_save_index : Int32;
}
struct SItemAttribute{
var attributeName : CName;
var min : Float;
var max : Float;
}
import struct CJournalQuestDescriptionEntry{
import public final function GetDescriptionStringId() : Int32;
}
class W3FastTravelEntity extends CR4FastTravelEntity{
public editable var onAreaExit : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
theGame.GetSecondScreenManager().SendFastTravelEnable();
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
theGame.GetSecondScreenManager().SendFastTravelDisable();
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var mapManager : CCommonMapManager;
var initData : W3MapInitData;
mapManager = theGame.GetCommonMapManager();
if (!thePlayer.IsActionAllowed(15)){
thePlayer.DisplayActionDisallowedHudMessage(15, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
} else if (!thePlayer.IsActionAllowed(5)){
thePlayer.DisplayActionDisallowedHudMessage(5, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
} else if (mapManager.IsEntityMapPinDisabled(entityName)){
thePlayer.DisplayActionDisallowedHudMessage(28, /* NOP *

/, /* NOP */, true, /* NOP */);


} else if (!theGame.IsBlackscreenOrFading()){
initData = new W3MapInitData in this;
initData.SetUsedFastTravelEntity(this);
initData.ignoreSaveSystem = true;
initData.setDefaultState('FastTravel');
theGame.RequestMenuWithBackground('MapMenu', 'CommonMenu
', initData);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
if (activator.GetEntity() == thePlayer){
SetFocusModeVisibility(1, /* NOP */);
if (isHubExit){
if (!onAreaExit){
if (area == GetComponent("BorderTrigger"
)){
OnPlayerEnteredBorder();
}
} else if (area == GetComponent("BorderTrigger")
){
OnPlayerExitedBorder();
}
} else if (area == GetComponent("FirstDiscoveryTrigger")
){
GetComponent("FirstDiscoveryTrigger").SetEnabled
(false);
mapManager.SetEntityMapPinDiscoveredScript(true,
entityName, true);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() == thePlayer){
SetFocusModeVisibility(0, /* NOP */);
if (isHubExit){
if (onAreaExit){
if (area == GetComponent("BorderTrigger"
)){
OnPlayerEnteredBorder();
}
} else if (area == GetComponent("BorderTrigger")
){
OnPlayerExitedBorder();
}
}
}
/* NOP */;
}
private function OnPlayerEnteredBorder(){
var text : String;
var mapManager : CCommonMapManager;
var position : Vector;
var rotation : EulerAngles;

var shift : Vector;


var finalPosition : Vector;
var normal : Vector;
var mac : CMovingAgentComponent;
var bc : CBoatComponent;
var vehicle : CGameplayEntity;
var gear : Int32;
var useStaticTrace : Bool;
var SHIFT_DISTANCE : Float;
var TELEPORT_TIMER : Float;
var POSITION_DIFF : Vector;
mapManager = theGame.GetCommonMapManager();
SHIFT_DISTANCE = 5;
TELEPORT_TIMER = 5;
POSITION_DIFF.Z = 10000;
position = thePlayer.GetWorldPosition();
rotation = thePlayer.GetWorldRotation();
useStaticTrace = true;
vehicle = thePlayer.GetUsedVehicle();
if (vehicle){
mac = (CMovingAgentComponent)vehicle.GetComponentByClass
Name('CMovingAgentComponent');
if (mac){
shift = mac.GetVelocityBasedOnRequestedMovement(
);
shift.Z = 0;
shift *= -1;
rotation.Yaw += 180;
} else {
bc = (CBoatComponent)vehicle.GetComponentByClass
Name('CBoatComponent');
if (bc){
shift = bc.GetCurrentSpeed();
shift.Z = 0;
shift *= -1;
rotation.Yaw += 90;
useStaticTrace = false;
SHIFT_DISTANCE *= 2;
}
}
} else {
mac = thePlayer.GetMovingAgentComponent();
if (mac){
shift = mac.GetVelocityBasedOnRequestedMovement(
);
shift.Z = 0;
shift *= -1;
rotation.Yaw += 180;
} else {
shift = VecFromHeading(rotation.Yaw);
rotation.Yaw += 180;
}
}
shift = VecNormalize(shift);
shift *= SHIFT_DISTANCE;
if (useStaticTrace){
if (!theGame.GetWorld().StaticTrace(position + shift + P
OSITION_DIFF, position + shift - POSITION_DIFF, finalPosition, normal, /* NOP */
)){
finalPosition = position + shift;

}
} else {
finalPosition = position + shift;
}
if (mapManager.NotifyPlayerEnteredBorder(TELEPORT_TIMER, finalPo
sition, rotation) == 1){
mapManager.AllowSaving(false);
text = GetLocStringByKeyExt("panel_common_end_of_the_wor
ld");
thePlayer.DisplayHudMessage(text);
thePlayer.BlockAction(41, 'EndOfTheWorld', false, false,
true);
thePlayer.BlockAction(42, 'EndOfTheWorld', false, false,
true);
thePlayer.BlockAction(22, 'EndOfTheWorld', false, false,
true);
thePlayer.BlockAction(27, 'EndOfTheWorld', false, false,
true);
if (GetWitcherPlayer()){
thePlayer.PlayVoiceset(100, "Input", /* NOP */);
}
}
/* NOP */;
}
private function OnPlayerExitedBorder(){
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
if (mapManager.NotifyPlayerExitedBorder() == 0){
mapManager.AllowSaving(true);
thePlayer.UnblockAction(41, 'EndOfTheWorld');
thePlayer.UnblockAction(42, 'EndOfTheWorld');
thePlayer.UnblockAction(22, 'EndOfTheWorld');
thePlayer.UnblockAction(27, 'EndOfTheWorld');
}
/* NOP */;
}
}
struct UserMessageActionData{
var actionId : EUserMessageAction;
var label : String;
}
struct TutorialHighlightedArea{
var x : Float;
var y : Float;
var width : Float;
var height : Float;
}
struct SItemGenericStat{
var statName : String;
var value : Float;
var comparence : String;
}
struct SBackgroundPairSpawnedEntity{
editable var entityTemplate : CEntityTemplate;
editable var slotName : CName;
editable var referenceName : CName;

}
struct SMountEvent{
editable var
editable var
editable var
editable var
}

animEventName : CName;
entityReferenceName : CName;
newSlotName : CName;
entityContainingSlot : EBgNPCType;

struct MerchantNPCEmbeddedScenesConditions{
editable var applyToTag : CName;
editable var requiredFact : String;
editable var forbiddenFact : String;
}
struct SParryInfo{
var attacker : CActor;
var target : CActor;
var targetToAttackerAngleAbs : Float;
var targetToAttackerDist : Float;
var attackSwingType : EAttackSwingType;
var attackSwingDir : EAttackSwingDirection;
var attackActionName : CName;
var attackerWeaponId : SItemUniqueId;
var canBeParried : Bool;
}
struct SDrunkMutagen{
var slot : Int32;
var mutagenName : CName;
var toxicityOffset : Float;
var effectType : EEffectType;
}
struct SWitcherSign{
editable var template : CEntityTemplate;
var entity : W3SignEntity;
}
abstract statemachine class W3SignEntity extends CGameplayEntity{
protected var owner : W3SignOwner;
protected var attachedTo : CEntity;
protected var boneIndex : Int32;
protected var fireMode : Int32;
protected var skillEnum : ESkill;
public var signType : ESignType;
public var actionBuffs : array<SEffectInfo>;
public editable var friendlyCastEffect : CName;
protected var cachedCost : Float;
public function GetSignType() : ESignType{
return 5;
/* NOP */;
}
public function OnProcessSignEvent(eventName : CName) : Bool{
/* NOP */;
if (eventName == 'cast_begin'){
if (owner.GetActor() == thePlayer){
thePlayer.SetPadBacklightColorFromSign(GetSignTy
pe());
}

OnStarted();
} else if (eventName == 'cast_throw'){
OnThrowing();
} else if (eventName == 'cast_end'){
OnEnded(/* NOP */);
} else if (eventName == 'cast_friendly_begin'){
Attach(true, /* NOP */);
} else if (eventName == 'cast_friendly_throw'){
OnCastFriendly();
} else {
return false;
}
return true;
/* NOP */;
}
public function Init(inOwner : W3SignOwner, prevInstance : W3SignEntity,
skipCastingAnimation : Bool) : Bool{
var player : CR4Player;
var focus : SAbilityAttributeValue;
owner = inOwner;
fireMode = 0;
GetSignStats();
if (skipCastingAnimation || owner.InitCastSign(this)){
owner.SetCurrentlyCastSign(GetSignType(), this);
CacheActionBuffsFromSkill();
if (!skipCastingAnimation){
AddTimer('BroadcastSignCast', 0.800000, false, /
* NOP */, /* NOP */, true, /* NOP */);
}
player = owner.GetPlayer();
if (player && player.CanUseSkill(89)){
focus = player.GetAttributeValue('focus_gain', /
* NOP */, /* NOP */);
if (player.CanUseSkill(35)){
focus += player.GetSkillAttributeValue(3
5, 'focus_gain', false, true) * player.GetSkillLevel(35);
}
player.GainStat(4, 0.100000 * 1 + CalculateAttri
buteValue(focus, /* NOP */));
}
return true;
} else {
owner.GetActor().SoundEvent("gui_ingame_low_stamina_warn
ing", /* NOP */, /* NOP */);
CleanUp();
Destroy();
return false;
}
/* NOP */;
}
public function OnStarted() : Bool{
var player : CR4Player;
Attach(/* NOP */, /* NOP */);
player = (CR4Player)owner.GetActor();
if (player){
GetWitcherPlayer().FailFundamentalsFirstAchievementCondi
tion();
player.AddTimer('ResetPadBacklightColorTimer', 2, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}

/* NOP */;
}
public function OnThrowing() : Bool{
}
public function OnEnded(isEnd : Bool) : Bool{
var witcher : W3PlayerWitcher;
var abilityName : CName;
var abilityCount : Float;
var maxStack : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var addAbility : Bool;
var mutagen17 : W3Mutagen17_Effect;
var camHeading : Float;
witcher = (W3PlayerWitcher)owner.GetActor();
if (witcher && witcher.IsCurrentSignChanneled() && witcher.GetCu
rrentlyCastSign() != 3 && witcher.bRAxisReleased){
if (!witcher.lastAxisInputIsMovement){
camHeading = VecHeading(theCamera.GetCameraDirec
tion());
if (AngleDistance(GetHeading(), camHeading) < 0)
{
witcher.SetCustomRotation('ChanneledSign
CastEnd', camHeading + witcher.GetOTCameraOffset(), 0.000000, 0.200000, false);
} else {
witcher.SetCustomRotation('ChanneledSign
CastEnd', camHeading - witcher.GetOTCameraOffset(), 0.000000, 0.200000, false);
}
}
witcher.ResetLastAxisInputIsMovement();
}
witcher = (W3PlayerWitcher)owner.GetActor();
if (witcher && witcher.HasBuff(89)){
mutagen17 = (W3Mutagen17_Effect)witcher.GetBuff(89, /* N
OP */);
if (mutagen17.HasBoost()){
mutagen17.ClearBoost();
}
}
if (witcher && witcher.HasBuff(94) && witcher.IsInCombat() && wi
tcher.IsThreatened()){
abilityName = witcher.GetBuff(94, /* NOP */).GetAbilityN
ame();
abilityCount = witcher.GetAbilityCount(abilityName);
if (abilityCount == 0){
addAbility = true;
} else {
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(abilityName, 'mutagen22_max_stack', min, max);
maxStack = CalculateAttributeValue(GetAttributeR
andomizedValue(min, max), /* NOP */);
if (maxStack >= 0){
addAbility = abilityCount < maxStack;
} else {
addAbility = true;
}
}
if (addAbility){
witcher.AddAbility(abilityName, true);
}

}
CleanUp();
/* NOP */;
}
public function OnSignAborted(force : Bool) : Bool{
CleanUp();
Destroy();
/* NOP */;
}
public function OnCheckChanneling() : Bool{
return false;
/* NOP */;
}
public function GetOwner() : CActor{
return owner.GetActor();
/* NOP */;
}
public function SkillUnequipped(skill : ESkill){
}
public function SkillEquipped(skill : ESkill){
}
public function OnNormalCast(){
if (owner.GetActor() == thePlayer && GetWitcherPlayer().IsInitia
lized()){
theGame.VibrateControllerLight(/* NOP */);
}
/* NOP */;
}
public function SetAlternateCast(newSkill : ESkill){
fireMode = 1;
skillEnum = newSkill;
GetSignStats();
/* NOP */;
}
public function IsAlternateCast() : Bool{
return fireMode;
/* NOP */;
}
protected function GetSignStats(){
}
protected function CleanUp(){
owner.RemoveTemporarySkills();
/* NOP */;
}
public function Attach(toSlot : Bool, toWeaponSlot : Bool){
var loc : Vector;
var rot : EulerAngles;
var ownerActor : CActor;
ownerActor = owner.GetActor();
if (toSlot){
if (!toWeaponSlot && ownerActor.HasSlot('sign_slot', tru
e)){
CreateAttachment(ownerActor, 'sign_slot', /* NOP
*/, /* NOP */);
} else {
CreateAttachment(ownerActor, 'l_weapon', /* NOP
*/, /* NOP */);
}
boneIndex = ownerActor.GetBoneIndex('l_weapon');
attachedTo = NULL;

} else {
attachedTo = ownerActor;
boneIndex = ownerActor.GetBoneIndex('l_weapon');
}
if (attachedTo){
if (boneIndex != -1){
loc = MatrixGetTranslation(attachedTo.GetBoneWor
ldMatrixByIndex(boneIndex));
if (ownerActor == thePlayer && (W3AardEntity)thi
s){
rot = VecToRotation(thePlayer.GetLookAtP
osition() - MatrixGetTranslation(thePlayer.GetBoneWorldMatrixByIndex(thePlayer.G
etHeadBoneIndex())));
rot.Pitch = -rot.Pitch;
if (rot.Pitch < 0.000000 && thePlayer.Ge
tPlayerCombatStance() == 0 || thePlayer.GetPlayerCombatStance() == 2){
rot.Pitch = 0.000000;
}
thePlayer.GetVisualDebug().AddSphere('si
gnEntity', 0.300000, thePlayer.GetLookAtPosition(), true, Color(255, 0, 0), 30.0
00000);
thePlayer.GetVisualDebug().AddArrow('sig
nHeading', thePlayer.GetWorldPosition(), thePlayer.GetWorldPosition() + RotForwa
rd(rot) * 4, 1.000000, 0.200000, 0.200000, true, Color(0, 128, 128), true, 10.00
0000);
} else {
rot = attachedTo.GetWorldRotation();
}
} else {
loc = attachedTo.GetWorldPosition();
rot = attachedTo.GetWorldRotation();
}
TeleportWithRotation(loc, rot);
}
if (owner.IsPlayer()){
}
/* NOP */;
}
public function Detach(){
BreakAttachment();
attachedTo = NULL;
boneIndex = -1;
/* NOP */;
}
public function InitSignDataForDamageAction(act : W3DamageAction){
act.SetSignSkill(skillEnum);
FillActionDamageFromSkill(act);
FillActionBuffsFromSkill(act);
/* NOP */;
}
private function FillActionDamageFromSkill(act : W3DamageAction){
var attrs : array<CName>;
var i : Int32;
var size : Int32;
var val : Float;
var dm : CDefinitionsManagerAccessor;
if (!act){
LogSigns("W3SignEntity.FillActionDamageFromSkill: action
does not exist!");
return;

}
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(owner.GetSkillAbilityName(skillEnum), at
trs);
size = attrs.Size();
i = 0;
while (i < size){
if (IsDamageTypeNameValid(attrs[i])){
val = CalculateAttributeValue(owner.GetSkillAttr
ibuteValue(skillEnum, attrs[i], false, true), /* NOP */);
act.AddDamage(attrs[i], val);
}
i += 1;
}
/* NOP */;
}
private function FillActionBuffsFromSkill(act : W3DamageAction){
var i : Int32;
i = 0;
while (i < actionBuffs.Size()){
act.AddEffectInfo(actionBuffs[i].effectType, /* NOP */,
/* NOP */, actionBuffs[i].effectAbilityName, /* NOP */, /* NOP */);
i += 1;
}
/* NOP */;
}
protected function CacheActionBuffsFromSkill(){
var attrs : array<CName>;
var i : Int32;
var size : Int32;
var signAbilityName : CName;
var dm : CDefinitionsManagerAccessor;
var buff : SEffectInfo;
actionBuffs.Clear();
dm = theGame.GetDefinitionsManager();
signAbilityName = owner.GetSkillAbilityName(skillEnum);
dm.GetContainedAbilities(signAbilityName, attrs);
size = attrs.Size();
i = 0;
while (i < size){
if (IsEffectNameValid(attrs[i])){
EffectNameToType(attrs[i], buff.effectType, buff
.effectAbilityName);
actionBuffs.PushBack(buff);
}
i += 1;
}
/* NOP */;
}
public function GetSkill() : ESkill{
return skillEnum;
/* NOP */;
}
public timer function BroadcastSignCast(optional deltaTime : Float, opti
onal id : Int32){
if (owner.IsPlayer()){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(thePlayer, 'CastSignAction', -1, 8.000000, -1.000000, -1, true, /* NOP
*/, /* NOP */);
LogReactionSystem("'CastSignAction' was sent by Player -

single broadcast - distance: 10.0");


}
BroadcastSignCast_Override();
/* NOP */;
}
public function BroadcastSignCast_Override(){
}
public function OnCastFriendly() : Bool{
PlayEffect(friendlyCastEffect, /* NOP */);
AddTimer('DestroyCastFriendlyTimer', 0.100000, true, /* NOP */,
/* NOP */, true, /* NOP */);
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'CastSignAction', -1, 8.000000, -1.000000, -1, true, /* NOP */, /*
NOP */);
thePlayer.GetVisualDebug().AddSphere('dsljkfadsa', 0.500000, Get
WorldPosition(), true, Color(0, 255, 255), 10.000000);
/* NOP */;
}
public timer function DestroyCastFriendlyTimer(optional dt : Float, opti
onal id : Int32){
var active : Bool;
active = IsEffectActive(friendlyCastEffect, /* NOP */);
if (!active){
Destroy();
}
/* NOP */;
}
}
struct SRadialSlotDef{
var slotName : CName;
var disabledBySources : array<CName>;
}
struct SHighlightMappin{
var MappinName : CName;
var MappinState : Bool;
}
struct SInteriorAreaInfo{
var areaName : String;
var isSmallInterior : Bool;
var modifyPlayerSpeed : Bool;
}
struct SCustomOrientationInfo{
var orientationTarget : EOrientationTarget;
var sourceName : CName;
var customHeading : Float;
}
struct SRewardMultiplier{
var rewardName : CName;
var rewardMultiplier : Float;
}
struct SCustomCameraParams{
var source : CActor;
var useCustomCamera : Bool;
var cameraParams : SMultiValue;

}
struct SCustomOrientationParams{
var source : CActor;
var customOrientationTarget : EOrientationTarget;
}
struct SHeadingHistory{
var time : EngineTime;
var headValue : Float;
var speedValue : Float;
}
struct SItem{
editable var itemName : CName;
editable var quantity : Int32;
}
struct SGlossaryImageOverride{
var uniqueTag : CName;
var imageFileName : String;
}
struct SGwentIngDef{
var itemName : CName;
var reqLevel : Int32;
var quantityMin : Int32;
var quantityMax : Int32;
}
struct SQuestPlayerSkill{
editable var skill : ESkill;
editable var skillLevel : Int32;
editable var condition : EQuestPlayerSkillCondition;
}
struct SRadialDesaturation{
editable var value : Bool;
editable var fieldName : String;
}
struct shopQuestItemDef{
editable var itemName : CName;
editable var requiredFact : String;
editable var forbiddenFact : String;
editable var quantity : Int32;
}
struct SBackgroundEntityData{
editable var entityTemplate : CEntityTemplate;
editable var spawnSlotName : CName;
editable var workAnimationEvent : EBackgroundNPCWork_Single;
editable var appearanceName : CName;
}
struct SBoatDesctructionPart{
editable var hpFalloffThreshold : Float;
editable var componentName : String;
saved var isPartDropped : Bool;
}

struct CollsionActorStruct{
var actor : CActor;
var timestamp : Float;
}
class W3TutorialPopupData extends CObject{
public var posX : Float;
public var posY : Float;
public var messageTitle : String;
public var messageText : String;
public var imagePath : String;
public var fadeBackground : Bool;
public var autosize : Bool;
public var enableGlossoryLink : Bool;
public var enableAcceptButton : Bool;
public var canBeShownInMenus : Bool;
public var blockInput : Bool;
public var pauseGame : Bool;
public var fullscreen : Bool;
public var duration : Float;
public var scriptTag : CName;
public var menuRef : CR4TutorialPopup;
public var managerRef : CR4TutorialSystem;
public var closeRequested : Bool;
private var highlightedAreas : array<TutorialHighlightedArea>;
public function AddHighlightedArea(x : Float, y : Float, width : Float,
height : Float){
var newArea : TutorialHighlightedArea;
newArea.x = x;
newArea.y = y;
newArea.width = width;
newArea.height = height;
highlightedAreas.PushBack(newArea);
/* NOP */;
}
public function PlayFeedbackAnim(isCorrect : Bool){
if (menuRef){
menuRef.PlayFeedbackAnim(isCorrect);
}
/* NOP */;
}
public function GetHighlightedAreas() : array<TutorialHighlightedArea>{
return highlightedAreas;
/* NOP */;
}
public function CloseTutorialPopup(willBeCloned : Bool){
if (menuRef){
menuRef.RequestClose(/* NOP */, willBeCloned);
} else {
closeRequested = true;
}
/* NOP */;
}
public function CloseCallback(forceClose : Bool, closedByUser : Bool, wi
llBeCloned : Bool){
if (managerRef){
managerRef.OnTutorialHintClosing(scriptTag, forceClose,
closedByUser, willBeCloned);
}

/* NOP */;
}
}
class W3MerchantComponent extends CScriptedComponent{
public editable var mapPinType : EMerchantMapPinType;
public function GetMapPinType() : CName{
switch(mapPinType){
case 0:
return 'Shopkeeper';
case 1:
return 'Blacksmith';
case 2:
return 'Armorer';
case 3:
return 'BoatBuilder';
case 4:
return 'Hairdresser';
case 6:
return 'Alchemic';
case 5:
return 'Herbalist';
case 7:
return 'Innkeeper';
}
return 'None';
/* NOP */;
}
public function GetScriptInfo(type : CName, cacheable : Bool){
var merchantNPC : W3MerchantNPC;
merchantNPC = (W3MerchantNPC)GetEntity();
type = GetMapPinType();
cacheable = merchantNPC.cacheMerchantMappin;
/* NOP */;
}
}
statemachine class W3NoticeBoard extends CR4MapPinEntity{
public editable saved var visited : Bool;
public editable saved var addedNotes : array<ErrandDetailsList>;
public editable saved var fluffNotices : array<String>;
public editable var entitiesToBeShown : array<CName>;
public editable saved var questEntitiesToBeShown : array<CName>;
public editable saved var questNonActorEntitiesToBeShown : array<CName>;
public editable var InteractionSpawnDelayTime : Float;
public editable var backgroundOverride : String;
public editable var factAddedOnDiscovery : CName;
public var activeErrands : array<ErrandDetailsList>;
public var updatingInteraction : Bool;
public var errandPositionName : String;
public var MAX_DISPLAYED_ERRANDS : Int32;
public var lastTimeInteracted : GameTime;
protected autobind interactionComponent : CInteractionComponent = "LookA
tBoard";
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
updatingInteraction = false;
HACK_FixNamesAndTags();
FixErrands();
UpdateBoard(/* NOP */);
SetCardsVisible(true);

SetFocusModeVisibility(1, /* NOP */);


/* NOP */;
}
public function HACK_FixNamesAndTags(){
if (HasTag('harbor_district_noticeboard')){
if (HasTag('market_noticeboard')){
RemoveTag('market_noticeboard');
}
}
if (HasTag('poppystone_notice_board')){
if (HasTag('inn_crossroads_notice_board')){
RemoveTag('inn_crossroads_notice_board');
}
}
/* NOP */;
}
public function WasVisited() : Bool{
return visited;
/* NOP */;
}
public function FixErrands(){
var i : Int32;
i = addedNotes.Size() - 1;
while (i > -1){
if (addedNotes[i].errandStringKey == ""){
addedNotes.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (activator == thePlayer && ShouldProcessTutorial('TutorialQue
stBoard')){
FactsAdd("tut_near_noticeboard", /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnInteractionDeactivated(interactionComponentName : Stri
ng, activator : CEntity) : Bool{
if (activator == thePlayer && ShouldProcessTutorial('TutorialQue
stBoard')){
FactsSet("tut_near_noticeboard", 0, /* NOP */);
}
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S
tring, activator : CEntity) : Bool{
if (interactionComponentName == "LookAtBoard"){
if (IsEmpty(true)){
return false;
} else {
return true;
}
}
return false;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC

omponent) : Bool{
var mapManager : CCommonMapManager;
var vect : Vector;
var tags : array<CName>;
mapManager = theGame.GetCommonMapManager();
if (activator.GetEntity() == thePlayer){
if (area == (CTriggerAreaComponent)GetComponent("FirstDi
scoveryTrigger")){
GetComponent("FirstDiscoveryTrigger").SetEnabled
(false);
mapManager.SetEntityMapPinDiscoveredScript(false
, entityName, true);
} else if (area == (CTriggerAreaComponent)GetComponent("
UpdateNoticeBoard")){
UpdateBoard(true);
}
UpdateInteraction(true);
}
/* NOP */;
}
public function UpdateInteraction(waitForComponent : Bool){
if (interactionComponent){
if (updatingInteraction){
updatingInteraction = false;
RemoveTimer('EnableInteractionComponentDelayed',
/* NOP */);
}
if (IsEmpty(true)){
interactionComponent.SetEnabled(false);
} else {
interactionComponent.SetEnabled(true);
}
} else if (waitForComponent && !updatingInteraction){
updatingInteraction = true;
AddTimer('EnableInteractionComponentDelayed', Interactio
nSpawnDelayTime, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function EnableInteractionComponentDelayed(optional delta
: Float, optional id : Int32){
updatingInteraction = false;
UpdateInteraction(true);
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var currentGameTime : GameTime;
currentGameTime = theGame.GetGameTime();
if (activator.GetEntity() == thePlayer){
if (area == (CTriggerAreaComponent)GetComponent("UpdateN
oticeBoard")){
if (fluffNotices.Size() == 0 && Have24HoursPasse
d(currentGameTime, lastTimeInteracted)){
ResetFlawErrands();
}
UpdateBoard(/* NOP */);
}
}
/* NOP */;

}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator == thePlayer){
if (!visited){
visited = true;
theGame.GetCommonMapManager().InvalidateStaticMa
pPin(entityName);
}
AddDiscoveredFact();
SetEntitiesKnown();
UpdateBoard(true);
theGame.RequestMenu('NoticeBoardMenu', this);
lastTimeInteracted = theGame.GetGameTime();
}
/* NOP */;
}
private function AddDiscoveredFact(){
if (!FactsDoesExist(factAddedOnDiscovery)){
FactsAdd(factAddedOnDiscovery, 1, -1);
}
/* NOP */;
}
private function SetEntitiesKnown(){
var i : Int32;
var mapManager : CCommonMapManager;
var count : Int32;
mapManager = theGame.GetCommonMapManager();
if (!mapManager){
return;
}
i = 0;
while (i < entitiesToBeShown.Size()){
if (!mapManager.IsEntityMapPinKnown(entitiesToBeShown[i]
)){
mapManager.SetEntityMapPinKnown(entitiesToBeShow
n[i], true);
count += 1;
}
i += 1;
}
if (count > 0 && mapManager.CanShowKnownEntities()){
mapManager.UpdateHud('notdiscoveredpoi');
}
/* NOP */;
}
public function CanAddErrand(candidateToAdd : ErrandDetailsList) : Bool{
var i : Int32;
i = 0;
while (i < addedNotes.Size()){
if (candidateToAdd.errandStringKey == addedNotes[i].erra
ndStringKey){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public function AddErrand(newErrand : ErrandDetailsList){

var i : Int32;
if (CanAddErrand(newErrand)){
addedNotes.Insert(0, newErrand);
} else {
/* NOP */;
}
theGame.GetCommonMapManager().InvalidateStaticMapPin(entityName)
;
/* NOP */;
}
public function SetCardsVisible(bSilent : Bool){
var errandPos : CName;
var i : Int32;
var length : Int32;
var card : CDrawableComponent;
var tempErrand : ErrandDetailsList;
var bOverrideFlaw : Bool;
length = 0;
activeErrands.Clear();
activeErrands.Grow(MAX_DISPLAYED_ERRANDS);
HideAllCards();
i = 0;
while (i < addedNotes.Size()){
bOverrideFlaw = false;
if (CheckFact(addedNotes[i].newQuestFact, true)){
addedNotes[i].errandPosition = -1;
} else {
if (CheckFact(addedNotes[i].forbiddenFact, false
) && CheckFact(addedNotes[i].requiredFact, true)){
switch(addedNotes[i].errandPosition){
case -1:
break;
case 0:
if (addedNotes[i].errandStringKe
y != "flaw"){
bOverrideFlaw = true;
}
addedNotes[i].errandPosition = G
etFirstFreeErrandSlot(bOverrideFlaw);
if (addedNotes[i].errandPosition
== 0){
break;
}
default:
if (addedNotes[i].posX == 0 || a
ddedNotes[i].posY == 0){
addedNotes[i].posX = Ran
dRange(25, -25);
addedNotes[i].posY = Ran
dRange(30, -30);
}
length += 1;
activeErrands[addedNotes[i].erra
ndPosition - 1] = addedNotes[i];
card = (CDrawableComponent)GetCo
mponent(errandPositionName + activeErrands[addedNotes[i].errandPosition - 1].err
andPosition);
card.SetVisible(true);
}
}

if (length >= MAX_DISPLAYED_ERRANDS){


return;
}
}
i += 1;
}
i = length;
while (i < MAX_DISPLAYED_ERRANDS){
if (!bSilent){
tempErrand.errandStringKey = GetRandomFlawErrand
();
}
if (tempErrand.errandStringKey != ""){
tempErrand.newQuestFact = "flaw";
tempErrand.errandPosition = GetFirstFreeErrandSl
ot(/* NOP */);
addedNotes[i].posX = RandRange(25, -25);
addedNotes[i].posY = RandRange(30, -30);
card = (CDrawableComponent)GetComponent(errandPo
sitionName + tempErrand.errandPosition);
card.SetVisible(true);
addedNotes.PushBack(tempErrand);
activeErrands[tempErrand.errandPosition - 1] = a
ddedNotes[i];
}
i += 1;
}
/* NOP */;
}
public function HideAllCards(){
var card : CDrawableComponent;
var i : Int32;
i = 0;
while (i < MAX_DISPLAYED_ERRANDS){
card = (CDrawableComponent)GetComponent(errandPositionNa
me + i + 1);
card.SetVisible(false);
i += 1;
}
/* NOP */;
}
public function GetFirstFreeErrandSlot(bOverrideFlaw : Bool) : Int32{
var i : Int32;
var j : Int32;
i = 0;
while (i < activeErrands.Size()){
if (activeErrands[i].errandStringKey == ""){
j = 0;
while (j < addedNotes.Size()){
if (addedNotes[j].errandPosition > -1 &&
addedNotes[j].errandPosition == i + 1 && CheckFact(addedNotes[j].forbiddenFact,
false) && CheckFact(addedNotes[j].requiredFact, true)){
break;
}
j += 1;
}
if (j == addedNotes.Size()){
return i + 1;
}
}

i += 1;
}
if (bOverrideFlaw){
return RemoveFlawErrand();
}
/* NOP */;
return 0;
/* NOP */;
}
public function RemoveEmptyActiveErrands(){
var i : Int32;
i = activeErrands.Size() - 1;
while (i > -1){
if (activeErrands[i].errandStringKey == ""){
activeErrands.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public function GetRandomFlawErrand() : String{
var randIDX : Int32;
var retString : String;
if (fluffNotices.Size() == 0){
return "";
}
randIDX = RandRange(fluffNotices.Size(), /* NOP */);
retString = fluffNotices[randIDX];
fluffNotices.Erase(randIDX);
return retString;
/* NOP */;
}
public function ResetFlawErrands(){
var i : Int32;
i = addedNotes.Size() - 1;
while (i > -1){
if (addedNotes[i].newQuestFact == "flaw"){
if (addedNotes[i].errandPosition == -1){
fluffNotices.PushBack(addedNotes[i].erra
ndStringKey);
addedNotes.Remove(addedNotes[i]);
}
}
i -= 1;
}
/* NOP */;
}
public function RemoveFlawErrand() : Int32{
var i : Int32;
var ret : Int32;
i = addedNotes.Size() - 1;
while (i > -1){
if (addedNotes[i].newQuestFact == "flaw"){
if (addedNotes[i].errandPosition > 0){
ret = addedNotes[i].errandPosition;
fluffNotices.PushBack(addedNotes[i].erra
ndStringKey);
addedNotes.Remove(addedNotes[i]);
return ret;
}

}
i -= 1;
}
return 0;
/* NOP */;
}
public function CheckFact(factName : String, forbidden : Bool) : Bool{
if (factName != ""){
return FactsDoesExist(factName) == forbidden;
}
return true;
/* NOP */;
}
public function UpdateBoard(bSilent : Bool){
SetCardsVisible(bSilent);
CheckIfEmpty();
/* NOP */;
}
public function CheckIfEmpty(){
var val : Int32;
var exp : Int32;
var tags : array<CName>;
if (HasAnyNote()){
val = 1;
exp = -1;
tags = GetTags();
FactsAdd(tags[0] + "_empty", val, exp);
/* NOP */;
}
/* NOP */;
}
public function IsEmpty(checkFluff : Bool) : Bool{
if (HasAnyNote()){
return false;
}
if (checkFluff && fluffNotices.Size() > 0){
return false;
}
return true;
/* NOP */;
}
public function HasAnyQuest() : Bool{
var i : Int32;
i = 0;
while (i < activeErrands.Size()){
if (activeErrands[i].errandPosition > 0 && activeErrands
[i].newQuestFact != "flaw"){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function HasAnyNote() : Bool{
var i : Int32;
i = 0;
while (i < activeErrands.Size()){
if (activeErrands[i].errandPosition > 0){
return true;

}
i += 1;
}
return false;
/* NOP */;
}
public function RemoveQuest(errandName : String) : Bool{
var i : Int32;
var stillDisplayed : Int32;
var card : CDrawableComponent;
stillDisplayed = 0;
i = 0;
while (i < addedNotes.Size()){
if (addedNotes[i].errandStringKey == errandName){
card = (CDrawableComponent)GetComponent(errandPo
sitionName + addedNotes[i].errandPosition);
card.SetVisible(false);
addedNotes[i].errandPosition = -1;
}
i += 1;
}
i = activeErrands.Size() - 1;
while (i > -1){
if (activeErrands[i].errandStringKey == errandName){
activeErrands.Erase(i);
} else if (activeErrands[i].errandPosition > 0){
stillDisplayed += 1;
}
i -= 1;
}
theGame.GetCommonMapManager().InvalidateStaticMapPin(entityName)
;
if (stillDisplayed == 0){
if (interactionComponent){
interactionComponent.SetEnabled(false);
}
return true;
}
return false;
/* NOP */;
}
public function AddQuestMappin(entityTag : CName, entityType : AQMTN_Ent
ityType){
if (entityType == 0){
ArrayOfNamesPushBackUnique(questEntitiesToBeShown, entit
yTag);
} else {
ArrayOfNamesPushBackUnique(questNonActorEntitiesToBeShow
n, entityTag);
}
/* NOP */;
}
public function AcceptNewQuest(errandName : String) : Bool{
var i : Int32;
var stillDisplayed : Int32;
var card : CDrawableComponent;
stillDisplayed = 0;
i = 0;
while (i < addedNotes.Size()){
if (addedNotes[i].errandStringKey == errandName){

if (addedNotes[i].newQuestFact != "flaw"){
FactsAdd(addedNotes[i].newQuestFact, /*
NOP */, /* NOP */);
}
if (addedNotes[i].addedItemName){
GetWitcherPlayer().GetInventory().AddAnI
tem(addedNotes[i].addedItemName, 1, false, /* NOP */, /* NOP */);
}
card = (CDrawableComponent)GetComponent(errandPo
sitionName + addedNotes[i].errandPosition);
card.SetVisible(false);
addedNotes[i].errandPosition = -1;
}
i += 1;
}
i = activeErrands.Size() - 1;
while (i > -1){
if (activeErrands[i].errandStringKey == errandName){
activeErrands.Erase(i);
} else if (activeErrands[i].errandPosition > 0){
stillDisplayed += 1;
}
i -= 1;
}
theGame.GetCommonMapManager().InvalidateStaticMapPin(entityName)
;
if (stillDisplayed == 0){
if (interactionComponent){
interactionComponent.SetEnabled(false);
}
return true;
}
return false;
/* NOP */;
}
public function GetStaticMapPinType(type : CName){
if (!visited || HasAnyQuest()){
type = 'NoticeBoardFull';
} else {
type = 'NoticeBoard';
}
/* NOP */;
}
}
class SliderPopupData extends TextPopupData{
public var minValue : Int32;
public var maxValue : Int32;
public var currentValue : Int32;
protected function GetContentRef() : String{
return "QuantityPopupRef";
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
var l_flashObject : CScriptedFlashObject;
l_flashObject = super.GetGFxData(parentFlashValueStorage);
l_flashObject.SetMemberFlashInt("minValue", minValue);
l_flashObject.SetMemberFlashInt("maxValue", maxValue);
l_flashObject.SetMemberFlashInt("currentValue", currentValue);

return l_flashObject;
/* NOP */;
}
}
class W3GuiPreparationPotionsAndBombsInventoryComponent extends W3GuiPlayerInven
toryComponent{
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var bShow : Bool;
var itemName : CName;
itemName = _inv.GetItemName(item);
if (_inv.IsItemQuickslotItem(item)){
bShow = true;
} else {
bShow = isPotionItem(item);
}
return bShow;
/* NOP */;
}
}
class W3GuiPreparationInventoryComponent extends W3GuiPlayerInventoryComponent{
protected var _equippedFilter : Bool;
protected var _categoryFilter : Bool;
protected var _categoryFilterValue : EPreporationItemType;
public function GetContainerItems(flashArray : CScriptedFlashArray, flas
hObject : CScriptedFlashObject, groupFilter : EPreporationItemType){
SetupFilter(false, groupFilter);
GetInventoryFlashArray(flashArray, flashObject);
/* NOP */;
}
public function GetSlotsItems(flashArray : CScriptedFlashArray, flashObj
ect : CScriptedFlashObject, groupFilter : EPreporationItemType){
SetupFilter(true, groupFilter);
GetInventoryFlashArray(flashArray, flashObject);
GetOilSlotItemsFlashArray(flashArray, flashObject);
/* NOP */;
}
protected function GetOilSlotItemsFlashArray(flashArray : CScriptedFlash
Array, flashObject : CScriptedFlashObject){
var weaponId : SItemUniqueId;
var l_flashObject : CScriptedFlashObject;
var oilName : CName;
if (_inv.GetItemEquippedOnSlot(1, weaponId)){
oilName = _inv.GetOilNameOnSword(false);
if (oilName != 'None'){
l_flashObject = flashObject.CreateFlashObject("r
ed.game.witcher3.menus.common.ItemDataStub");
FillItemInfoFromOilName(oilName, 1, l_flashObjec
t);
flashArray.PushBackFlashObject(l_flashObject);
}
}
if (_inv.GetItemEquippedOnSlot(2, weaponId)){
oilName = _inv.GetOilNameOnSword(true);
if (oilName != 'None'){
l_flashObject = flashObject.CreateFlashObject("r
ed.game.witcher3.menus.common.ItemDataStub");
FillItemInfoFromOilName(oilName, 2, l_flashObjec
t);

flashArray.PushBackFlashObject(l_flashObject);
}
}
/* NOP */;
}
protected function FillItemInfoFromOilName(oilName : CName, slotType : E
EquipmentSlots, flashObject : CScriptedFlashObject){
flashObject.SetMemberFlashInt("prepItemType", 3);
flashObject.SetMemberFlashInt("sortIdx", 3);
flashObject.SetMemberFlashString("dropDownLabel", GetPrepCategor
yLabel(3));
flashObject.SetMemberFlashInt("equipped", slotType);
flashObject.SetMemberFlashInt("id", -1);
flashObject.SetMemberFlashInt("quantity", 1);
flashObject.SetMemberFlashString("iconPath", _inv.GetItemIconPat
hByName(oilName));
flashObject.SetMemberFlashInt("gridPosition", 0);
flashObject.SetMemberFlashInt("gridSize", 1);
flashObject.SetMemberFlashInt("slotType", slotType);
flashObject.SetMemberFlashBool("isNew", false);
flashObject.SetMemberFlashBool("isOilApplied", false);
flashObject.SetMemberFlashInt("quality", 1);
flashObject.SetMemberFlashInt("socketsCount", 0);
flashObject.SetMemberFlashInt("socketsUsedCount", 0);
/* NOP */;
}
public function SetInventoryFlashObjectForItem(item : SItemUniqueId, fla
shObject : CScriptedFlashObject){
var equipped : Int32;
var slotType : EEquipmentSlots;
var itemPrepType : EPreporationItemType;
var itemCategoryLabel : String;
var itemName : CName;
var itemTags : array<CName>;
var i : Int32;
var silverOil : Bool;
var steelOil : Bool;
super.SetInventoryFlashObjectForItem(item, flashObject);
itemName = _inv.GetItemName(item);
equipped = GetWitcherPlayer().GetItemSlot(item);
itemPrepType = GetItemPrepCategory(item);
itemCategoryLabel = GetPrepCategoryLabel(itemPrepType);
flashObject.SetMemberFlashInt("prepItemType", itemPrepType);
flashObject.SetMemberFlashInt("sortIdx", itemPrepType);
flashObject.SetMemberFlashString("dropDownLabel", itemCategoryLa
bel);
silverOil = false;
steelOil = false;
if (isOilItem(item) && _inv.GetItemTags(item, itemTags)){
i = 0;
while (i < itemTags.Size()){
if (itemTags[i] == 'SteelOil'){
steelOil = true;
} else if (itemTags[i] == 'SilverOil'){
silverOil = true;
}
i += 1;
}
}
flashObject.SetMemberFlashBool("steelOil", steelOil);

flashObject.SetMemberFlashBool("silverOil", silverOil);
/* NOP */;
}
public function GetItemPrepCategory(item : SItemUniqueId) : EPreporation
ItemType{
var itemName : CName;
itemName = _inv.GetItemName(item);
if (isOilItem(item)){
return 3;
} else if (isPotionItem(item)){
return 2;
} else if (_inv.IsItemBomb(item)){
return 1;
} else if (_inv.ItemHasTag(item, 'Mutagen')){
return 4;
} else {
return 0;
}
/* NOP */;
}
public function AddDummyCategoryItem(item : SItemUniqueId, flashObject :
CScriptedFlashObject, flashArray : CScriptedFlashArray){
var l_flashObject : CScriptedFlashObject;
var itemPrepType : EPreporationItemType;
var itemCategoryLabel : String;
l_flashObject = flashObject.CreateFlashObject("red.game.witcher3
.menus.common.ItemDataStub");
itemPrepType = GetItemPrepCategory(item);
itemCategoryLabel = GetPrepCategoryLabel(itemPrepType);
l_flashObject.SetMemberFlashInt("prepItemType", itemPrepType);
l_flashObject.SetMemberFlashInt("sortIdx", itemPrepType);
l_flashObject.SetMemberFlashBool("invisible", true);
l_flashObject.SetMemberFlashString("dropDownLabel", itemCategory
Label);
flashArray.PushBackFlashObject(l_flashObject);
/* NOP */;
}
protected function SetupFilter(checkEquipped : Bool, groupFilter : EPrep
orationItemType){
_equippedFilter = checkEquipped;
if (groupFilter != 0){
_categoryFilter = true;
_categoryFilterValue = groupFilter;
} else {
_categoryFilter = false;
}
/* NOP */;
}
protected function GetPrepCategoryLabel(targetCategory : EPreporationIte
mType) : String{
switch(targetCategory){
case 1:
return "[[item_category_petard]]";
break;
case 2:
return "[[item_category_potion]]";
break;
case 3:
return "[[item_category_oil]]";
break;

case 4:
return "[[panel_preparation_mutagens_sublist_name]]";
break;
}
return "";
/* NOP */;
}
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var l_CategoryCheck : Bool;
var l_EquippedCheck : Bool;
var l_IsEquipped : Bool;
var l_ItemCategory : EPreporationItemType;
l_IsEquipped = isEquipped(item);
l_ItemCategory = GetItemPrepCategory(item);
l_EquippedCheck = _equippedFilter && l_IsEquipped || !_equippedF
ilter && !l_IsEquipped;
l_CategoryCheck = !_categoryFilter || _categoryFilterValue == l_
ItemCategory;
return l_ItemCategory != 0 && l_EquippedCheck && l_CategoryCheck
;
/* NOP */;
}
public function GetItemActionType(item : SItemUniqueId, bGetDefault : Bo
ol) : EInventoryActionType{
if (_inv.ItemHasTag(item, 'Mutagen')){
return 1;
}
return super.GetItemActionType(item, bGetDefault);
/* NOP */;
}
}
class W3GuiPreparationMutagensInventoryComponent extends W3GuiPlayerInventoryCom
ponent{
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var bShow : Bool;
var itemName : CName;
itemName = _inv.GetItemName(item);
bShow = _inv.ItemHasTag(item, 'Mutagen');
return bShow;
/* NOP */;
}
}
class W3GuiPreparationOilsInventoryComponent extends W3GuiPlayerInventoryCompone
nt{
protected function ShouldShowItem(item : SItemUniqueId) : Bool{
var bShow : Bool;
var itemName : CName;
itemName = _inv.GetItemName(item);
return isOilItem(item);
/* NOP */;
}
}
import struct CJournalPlaceGroup{
import public final function GetNameStringId() : Int32;
import public final function GetImage() : String;
}

import struct CJournalGlossaryGroup{


}
import struct CJournalStoryBookChapter{
import public final function GetTitleStringId() : Int32;
import public final function GetImage() : String;
}
import struct CJournalStoryBookPageDescription{
import public final function GetVideoFilename() : String;
import public final function GetDescriptionStringId() : Int32;
}
class W3HorseManager extends CPeristentEntity{
private autobind inv : CInventoryComponent = single;
private saved var horseAbilities : array<CName>;
private saved var itemSlots : array<SItemUniqueId>;
private saved var wasSpawned : Bool;
public function OnCreated(){
itemSlots.Grow(EnumGetMax('EEquipmentSlots') + 1);
Debug_TraceInventories("OnCreated");
/* NOP */;
}
public function GetInventoryComponent() : CInventoryComponent{
return inv;
/* NOP */;
}
public function ApplyHorseUpdateOnSpawn() : Bool{
var ids : array<SItemUniqueId>;
var items : array<SItemUniqueId>;
var eqId : SItemUniqueId;
var i : Int32;
var horseInv : CInventoryComponent;
var horse : CNewNPC;
horse = thePlayer.GetHorseWithInventory();
if (!horse){
return false;
}
horseInv = horse.GetInventory();
horseInv.GetAllItems(items);
Debug_TraceInventories("ApplyHorseUpdateOnSpawn ] BEFORE");
if (!wasSpawned){
i = items.Size() - 1;
while (i >= 0){
if (horseInv.ItemHasTag(items[i], 'HorseTail') |
| horseInv.ItemHasTag(items[i], 'HorseReins')){
} else {
eqId = horseInv.GiveItemTo(inv, items[i]
, 1, false, /* NOP */, /* NOP */);
EquipItem(eqId);
}
i -= 1;
}
wasSpawned = true;
}
i = items.Size() - 1;
while (i >= 0){
if (horseInv.ItemHasTag(items[i], 'HorseTail') || horseI
nv.ItemHasTag(items[i], 'HorseReins')){
} else {

horseInv.RemoveItem(items[i], /* NOP */);


}
i -= 1;
}
i = 0;
while (i < itemSlots.Size()){
if (inv.IsIdValid(itemSlots[i])){
ids = horseInv.AddAnItem(inv.GetItemName(itemSlo
ts[i]), /* NOP */, /* NOP */, /* NOP */, /* NOP */);
horseInv.MountItem(ids[0], /* NOP */, /* NOP */)
;
}
i += 1;
}
horseAbilities.Clear();
horseAbilities = horse.GetAbilities(true);
Debug_TraceInventories("ApplyHorseUpdateOnSpawn ] AFTER");
return true;
/* NOP */;
}
public function IsItemEquipped(id : SItemUniqueId) : Bool{
return itemSlots.Contains(id);
/* NOP */;
}
public function GetItemInSlot(slot : EEquipmentSlots) : SItemUniqueId{
if (slot == 0){
return GetInvalidUniqueId();
} else {
return itemSlots[slot];
}
/* NOP */;
}
public function GetHorseAttributeValue(attributeName : CName, excludeIte
ms : Bool) : SAbilityAttributeValue{
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var val : SAbilityAttributeValue;
if (horseAbilities.Size() == 0){
if (thePlayer.GetHorseWithInventory()){
horseAbilities = thePlayer.GetHorseWithInventory
().GetAbilities(true);
} else if (!excludeItems){
i = 0;
while (i < itemSlots.Size()){
if (itemSlots[i] != GetInvalidUniqueId()
){
val += inv.GetItemAttributeValue
(itemSlots[i], attributeName, /* NOP */, /* NOP */);
}
i += 1;
}
return val;
}
}
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < horseAbilities.Size()){
dm.GetAbilityAttributeValue(horseAbilities[i], attribute

Name, min, max);


val += GetAttributeRandomizedValue(min, max);
i += 1;
}
if (excludeItems){
i = 0;
while (i < itemSlots.Size()){
if (itemSlots[i] != GetInvalidUniqueId()){
val -= inv.GetItemAttributeValue(itemSlo
ts[i], attributeName, /* NOP */, /* NOP */);
}
i += 1;
}
}
return val;
/* NOP */;
}
public function EquipItem(id : SItemUniqueId) : SItemUniqueId{
var horse : CActor;
var ids : array<SItemUniqueId>;
var slot : EEquipmentSlots;
var itemName : CName;
var resMount : Bool;
var abls : array<CName>;
var i : Int32;
var unequippedItem : SItemUniqueId;
if (!inv.IsIdValid(id)){
return GetInvalidUniqueId();
}
slot = GetHorseSlotForItem(id);
if (slot == 0){
return GetInvalidUniqueId();
}
Debug_TraceInventories("EquipItem ] " + inv.GetItemName(id) + "
- BEFORE");
if (inv.IsIdValid(itemSlots[slot])){
unequippedItem = UnequipItem(slot);
}
itemSlots[slot] = id;
horse = thePlayer.GetHorseWithInventory();
if (horse){
itemName = inv.GetItemName(id);
ids = horse.GetInventory().AddAnItem(itemName, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
resMount = horse.GetInventory().MountItem(ids[0], /* NOP
*/, /* NOP */);
if (resMount){
horse.GetInventory().GetItemAbilities(ids[0], ab
ls);
i = 0;
while (i < abls.Size()){
horseAbilities.PushBack(abls[i]);
i += 1;
}
}
} else {
inv.GetItemAbilities(id, abls);
i = 0;
while (i < abls.Size()){
horseAbilities.PushBack(abls[i]);

i += 1;
}
}
theGame.GetGlobalEventsManager().OnScriptedEvent(2, /* NOP */, /
* NOP */);
if (inv.IsItemHorseBag(id)){
GetWitcherPlayer().UpdateEncumbrance();
}
Debug_TraceInventories("EquipItem ] " + inv.GetItemName(id) + "
- AFTER");
return unequippedItem;
/* NOP */;
}
public function AddAbility(abilityName : CName){
var horse : CNewNPC;
horse = thePlayer.GetHorseWithInventory();
if (horse){
horse.AddAbility(abilityName, true);
}
horseAbilities.PushBack(abilityName);
/* NOP */;
}
public function UnequipItem(slot : EEquipmentSlots) : SItemUniqueId{
var itemName : CName;
var horse : CActor;
var ids : array<SItemUniqueId>;
var abls : array<CName>;
var i : Int32;
var oldItem : SItemUniqueId;
var newId : SItemUniqueId;
if (slot == 0){
return GetInvalidUniqueId();
}
if (!inv.IsIdValid(itemSlots[slot])){
return GetInvalidUniqueId();
}
oldItem = itemSlots[slot];
if (inv.IsItemHorseBag(itemSlots[slot])){
GetWitcherPlayer().UpdateEncumbrance();
}
itemName = inv.GetItemName(itemSlots[slot]);
itemSlots[slot] = GetInvalidUniqueId();
horse = thePlayer.GetHorseWithInventory();
Debug_TraceInventories("UnequipItem ] " + itemName + " - BEFORE"
);
if (horse){
ids = horse.GetInventory().GetItemsByName(itemName);
horse.GetInventory().UnmountItem(ids[0], /* NOP */);
horse.GetInventory().RemoveItem(ids[0], /* NOP */);
}
ids = inv.GetItemsByName(itemName);
inv.GetItemAbilities(ids[0], abls);
i = 0;
while (i < abls.Size()){
horseAbilities.Remove(abls[i]);
i += 1;
}
newId = inv.GiveItemTo(thePlayer.inv, oldItem, 1, false, true, f
alse);
theGame.GetGlobalEventsManager().OnScriptedEvent(2, /* NOP */, /

* NOP */);
Debug_TraceInventories("UnequipItem ] " + itemName + " - AFTER")
;
return newId;
/* NOP */;
}
public function Debug_TraceInventory(inventory : CInventoryComponent, ca
tegoryName : CName){
var i : Int32;
var itemsNames : array<CName>;
var items : array<SItemUniqueId>;
if (categoryName == 'None'){
itemsNames = inventory.GetItemsNames();
i = 0;
while (i < itemsNames.Size()){
/* NOP */;
i += 1;
}
} else {
items = inventory.GetItemsByCategory(categoryName);
i = 0;
while (i < items.Size()){
/* NOP */;
i += 1;
}
}
/* NOP */;
}
public function Debug_TraceInventories(heading : String){
return;
if (heading != ""){
/* NOP */;
}
if (thePlayer && thePlayer.GetHorseWithInventory()){
/* NOP */;
/* NOP */;
Debug_TraceInventory(thePlayer.GetHorseWithInventory().G
etInventory(), /* NOP */);
/* NOP */;
}
if (inv){
/* NOP */;
/* NOP */;
Debug_TraceInventory(inv, /* NOP */);
/* NOP */;
}
/* NOP */;
}
public function MoveItemToHorse(id : SItemUniqueId, quantity : Int32) :
SItemUniqueId{
return thePlayer.inv.GiveItemTo(inv, id, quantity, false, true,
false);
/* NOP */;
}
public function MoveItemFromHorse(id : SItemUniqueId, quantity : Int32)
: SItemUniqueId{
return inv.GiveItemTo(thePlayer.inv, id, quantity, false, true,
false);
/* NOP */;
}

public function GetHorseSlotForItem(id : SItemUniqueId) : EEquipmentSlot


s{
var tags : array<CName>;
inv.GetItemTags(id, tags);
if (tags.Contains('Saddle')){
return 27;
} else if (tags.Contains('HorseBag')){
return 28;
} else if (tags.Contains('Trophy')){
return 29;
} else if (tags.Contains('Blinders')){
return 26;
} else {
return 0;
}
/* NOP */;
}
public final function HorseRemoveItemByName(itemName : CName, quantity :
Int32){
var ids : array<SItemUniqueId>;
var slot : EEquipmentSlots;
ids = inv.GetItemsIds(itemName);
slot = GetHorseSlotForItem(ids[0]);
UnequipItem(slot);
inv.RemoveItemByName(itemName, quantity);
/* NOP */;
}
public final function HorseRemoveItemByCategory(itemCategory : CName, qu
antity : Int32){
var ids : array<SItemUniqueId>;
var slot : EEquipmentSlots;
Debug_TraceInventories("HorseRemoveItemByCategory ] " + itemCate
gory + " - BEFORE");
ids = inv.GetItemsByCategory(itemCategory);
slot = GetHorseSlotForItem(ids[0]);
UnequipItem(slot);
inv.RemoveItemByCategory(itemCategory, quantity);
Debug_TraceInventories("HorseRemoveItemByCategory ] " + itemCate
gory + " - AFTER");
/* NOP */;
}
public final function HorseRemoveItemByTag(itemTag : CName, quantity : I
nt32){
var ids : array<SItemUniqueId>;
var slot : EEquipmentSlots;
Debug_TraceInventories("HorseRemoveItemByTag ] " + itemTag + " BEFORE");
ids = inv.GetItemsByTag(itemTag);
slot = GetHorseSlotForItem(ids[0]);
UnequipItem(slot);
inv.RemoveItemByTag(itemTag, quantity);
Debug_TraceInventories("HorseRemoveItemByTag ] " + itemTag + " AFTER");
/* NOP */;
}
public function GetAssociatedInventory() : CInventoryComponent{
return GetWitcherPlayer().GetInventory();
/* NOP */;
}
}

statemachine class W3PlayerWitcher extends CR4Player{


private saved var craftingSchematics : array<CName>;
private saved var alchemyRecipes : array<CName>;
private var levelupAbilities : array<CName>;
private var fastAttackCounter : Int32;
private var heavyAttackCounter : Int32;
private var isInFrenzy : Bool;
private var hasRecentlyCountered : Bool;
private saved var cannotUseUndyingSkill : Bool;
public var canSwitchFocusModeTarget : Bool;
protected var switchFocusModeTargetAllowed : Bool;
private editable var signs : array<SWitcherSign>;
private saved var equippedSign : ESignType;
private var currentlyCastSign : ESignType;
private var signOwner : W3SignOwnerPlayer;
private var usedQuenInCombat : Bool;
public var yrdenEntities : array<W3YrdenEntity>;
private var bDispalyHeavyAttackIndicator : Bool;
private var bDisplayHeavyAttackFirstLevelTimer : Bool;
public var specialAttackHeavyAllowed : Bool;
private saved var companionNPCTag : CName;
private saved var companionNPCTag2 : CName;
private saved var companionNPCIconPath : String;
private saved var companionNPCIconPath2 : String;
private saved var itemSlots : array<SItemUniqueId>;
private var isThrowHoldPressed : Bool;
private var remainingBombThrowDelaySlot1 : Float;
private var remainingBombThrowDelaySlot2 : Float;
private var previouslyUsedBolt : SItemUniqueId;
private var tempLearnedSignSkills : array<SSimpleSkill>;
public saved var autoLevel : Bool;
protected var skillBonusPotionEffect : CBaseGameplayEffect;
public saved var levelManager : W3LevelManager;
public saved var reputationManager : W3Reputation;
private editable var medallionEntity : CEntityTemplate;
private var medallionController : W3MedallionController;
public var bShowRadialMenu : Bool;
private var _HoldBeforeOpenRadialMenuTime : Float;
public var MappinToHighlight : array<SHighlightMappin>;
protected saved var horseManagerHandle : EntityHandle;
private var isInitialized : Bool;
public var findActorTargetTimeStamp : Float;
public var pcModeChanneledSignTimeStamp : Float;
private saved var savedQuenHealth : Float;
private saved var savedQuenDuration : Float;
public var clockMenu : CR4MeditationClockMenu;
private var waitTimeHour : Int32;
private saved var blockedSigns : array<ESignType>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var i : Int32;
var items : array<SItemUniqueId>;
var items2 : array<SItemUniqueId>;
var horseTemplate : CEntityTemplate;
var horseManager : W3HorseManager;
var restoredQuen : W3QuenEntity;
AddAnimEventCallback('ActionBlend', 'OnAnimEvent_ActionBlend');
AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');

AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign')
;
AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
AddAnimEventCallback('ProjectileThrow', 'OnAnimEvent_Throwable')
;
AddAnimEventCallback('OnWeaponReload', 'OnAnimEvent_Throwable');
AddAnimEventCallback('ProjectileAttach', 'OnAnimEvent_Throwable'
);
/* NOP */;
inv = GetInventory();
signOwner = new W3SignOwnerPlayer in this;
signOwner.Init(this);
itemSlots.Resize(EnumGetMax('EEquipmentSlots') + 1);
if (!spawnData.restored){
levelManager = new W3LevelManager in this;
levelManager.Initialize();
inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (inv.IsItemMounted(items[i]) && !inv.IsItemBo
dy(items[i]) || inv.GetItemCategory(items[i]) == 'hair'){
EquipItem(items[i], /* NOP */, /* NOP */
);
}
i += 1;
}
AddAlchemyRecipe('Recipe for Swallow 1', true, true);
AddAlchemyRecipe('Recipe for Cat 1', true, true);
AddAlchemyRecipe('Recipe for White Honey 1', true, true)
;
AddAlchemyRecipe('Recipe for Samum 1', true, true);
AddAlchemyRecipe('Recipe for Grapeshot 1', true, true);
AddAlchemyRecipe('Recipe for Specter Oil 1', true, true)
;
AddAlchemyRecipe('Recipe for Necrophage Oil 1', true, tr
ue);
AddAlchemyRecipe('Recipe for Alcohest 1', true, true);
AddCraftingSchematic('Starting Armor Upgrade schematic 1
', true, true);
AddCraftingSchematic('Thread schematic', true, true);
AddCraftingSchematic('String schematic', true, true);
AddCraftingSchematic('Linen schematic', true, true);
AddCraftingSchematic('Silk schematic', true, true);
AddCraftingSchematic('Resin schematic', true, true);
AddCraftingSchematic('Blasting powder schematic', true,
true);
AddCraftingSchematic('Haft schematic', true, true);
AddCraftingSchematic('Hardened timber schematic', true,
true);
AddCraftingSchematic('Leather squares schematic', true,
true);
AddCraftingSchematic('Leather schematic', true, true);
AddCraftingSchematic('Hardened leather schematic', true,
true);
AddCraftingSchematic('Draconide leather schematic', true
, true);
AddCraftingSchematic('Iron ingot schematic', true, true)

;
AddCraftingSchematic('Steel ingot schematic', true, true
);
AddCraftingSchematic('Steel ingot schematic 1', true, tr
ue);
AddCraftingSchematic('Steel plate schematic', true, true
);
AddCraftingSchematic('Dark iron ingot schematic', true,
true);
AddCraftingSchematic('Dark steel ingot schematic', true,
true);
AddCraftingSchematic('Dark steel ingot schematic 1', tru
e, true);
AddCraftingSchematic('Dark steel plate schematic', true,
true);
AddCraftingSchematic('Silver ore schematic', true, true)
;
AddCraftingSchematic('Silver ingot schematic', true, tru
e);
AddCraftingSchematic('Silver ingot schematic 1', true, t
rue);
AddCraftingSchematic('Silver plate schematic', true, tru
e);
AddCraftingSchematic('Meteorite ingot schematic', true,
true);
AddCraftingSchematic('Meteorite silver ingot schematic',
true, true);
AddCraftingSchematic('Meteorite silver plate schematic',
true, true);
AddCraftingSchematic('Glowing ingot schematic', true, tr
ue);
AddCraftingSchematic('Dwimeryte ore schematic', true, tr
ue);
AddCraftingSchematic('Dwimeryte ingot schematic', true,
true);
AddCraftingSchematic('Dwimeryte ingot schematic 1', true
, true);
AddCraftingSchematic('Dwimeryte plate schematic', true,
true);
} else {
AddTimer('DelayedOnItemMount', 0.100000, true, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
CheckHairItem();
}
super.OnSpawned(spawnData);
AddAlchemyRecipe('Recipe for Mutagen red', true, true);
AddAlchemyRecipe('Recipe for Mutagen green', true, true);
AddAlchemyRecipe('Recipe for Mutagen blue', true, true);
AddAlchemyRecipe('Recipe for Greater mutagen red', true, true);
AddAlchemyRecipe('Recipe for Greater mutagen green', true, true)
;
AddAlchemyRecipe('Recipe for Greater mutagen blue', true, true);
levelupAbilities.PushBack('Lvl1');
levelupAbilities.PushBack('Lvl1');
levelupAbilities.PushBack('Lvl2');
levelupAbilities.PushBack('Lvl3');
levelupAbilities.PushBack('Lvl4');
levelupAbilities.PushBack('Lvl5');
levelupAbilities.PushBack('Lvl6');
levelupAbilities.PushBack('Lvl7');

levelupAbilities.PushBack('Lvl8');
levelupAbilities.PushBack('Lvl9');
levelupAbilities.PushBack('Lvl10');
levelupAbilities.PushBack('Lvl11');
levelupAbilities.PushBack('Lvl12');
levelupAbilities.PushBack('Lvl13');
levelupAbilities.PushBack('Lvl14');
levelupAbilities.PushBack('Lvl15');
levelupAbilities.PushBack('Lvl16');
levelupAbilities.PushBack('Lvl17');
levelupAbilities.PushBack('Lvl18');
levelupAbilities.PushBack('Lvl19');
levelupAbilities.PushBack('Lvl20');
levelupAbilities.PushBack('Lvl21');
levelupAbilities.PushBack('Lvl22');
levelupAbilities.PushBack('Lvl23');
levelupAbilities.PushBack('Lvl24');
levelupAbilities.PushBack('Lvl25');
levelupAbilities.PushBack('Lvl26');
levelupAbilities.PushBack('Lvl27');
levelupAbilities.PushBack('Lvl28');
levelupAbilities.PushBack('Lvl29');
levelupAbilities.PushBack('Lvl30');
levelupAbilities.PushBack('Lvl31');
levelupAbilities.PushBack('Lvl32');
levelupAbilities.PushBack('Lvl33');
levelupAbilities.PushBack('Lvl34');
levelupAbilities.PushBack('Lvl35');
levelupAbilities.PushBack('Lvl36');
levelupAbilities.PushBack('Lvl37');
levelupAbilities.PushBack('Lvl38');
levelupAbilities.PushBack('Lvl39');
levelupAbilities.PushBack('Lvl40');
levelupAbilities.PushBack('Lvl41');
levelupAbilities.PushBack('Lvl42');
levelupAbilities.PushBack('Lvl43');
levelupAbilities.PushBack('Lvl44');
levelupAbilities.PushBack('Lvl45');
levelupAbilities.PushBack('Lvl46');
levelupAbilities.PushBack('Lvl47');
levelupAbilities.PushBack('Lvl48');
levelupAbilities.PushBack('Lvl49');
levelupAbilities.PushBack('Lvl50');
levelupAbilities.PushBack('Lvl51');
levelupAbilities.PushBack('Lvl52');
levelupAbilities.PushBack('Lvl53');
levelupAbilities.PushBack('Lvl54');
levelupAbilities.PushBack('Lvl55');
levelupAbilities.PushBack('Lvl56');
levelupAbilities.PushBack('Lvl57');
levelupAbilities.PushBack('Lvl58');
levelupAbilities.PushBack('Lvl59');
levelupAbilities.PushBack('Lvl60');
levelupAbilities.PushBack('Lvl61');
levelupAbilities.PushBack('Lvl62');
levelupAbilities.PushBack('Lvl63');
levelupAbilities.PushBack('Lvl64');
levelupAbilities.PushBack('Lvl65');
levelupAbilities.PushBack('Lvl66');
levelupAbilities.PushBack('Lvl67');

levelupAbilities.PushBack('Lvl68');
levelupAbilities.PushBack('Lvl69');
levelupAbilities.PushBack('Lvl70');
levelupAbilities.PushBack('Lvl71');
levelupAbilities.PushBack('Lvl72');
levelupAbilities.PushBack('Lvl73');
levelupAbilities.PushBack('Lvl74');
levelupAbilities.PushBack('Lvl75');
levelupAbilities.PushBack('Lvl76');
levelupAbilities.PushBack('Lvl77');
levelupAbilities.PushBack('Lvl78');
levelupAbilities.PushBack('Lvl79');
levelupAbilities.PushBack('Lvl80');
levelupAbilities.PushBack('Lvl81');
levelupAbilities.PushBack('Lvl82');
levelupAbilities.PushBack('Lvl83');
levelupAbilities.PushBack('Lvl84');
levelupAbilities.PushBack('Lvl85');
levelupAbilities.PushBack('Lvl86');
levelupAbilities.PushBack('Lvl87');
levelupAbilities.PushBack('Lvl88');
levelupAbilities.PushBack('Lvl89');
levelupAbilities.PushBack('Lvl90');
levelupAbilities.PushBack('Lvl91');
levelupAbilities.PushBack('Lvl92');
levelupAbilities.PushBack('Lvl93');
levelupAbilities.PushBack('Lvl94');
levelupAbilities.PushBack('Lvl95');
levelupAbilities.PushBack('Lvl96');
levelupAbilities.PushBack('Lvl97');
levelupAbilities.PushBack('Lvl98');
levelupAbilities.PushBack('Lvl99');
levelupAbilities.PushBack('Lvl100');
if (inputHandler){
inputHandler.BlockAllActions('being_ciri', false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
SetBehaviorVariable('test_ciri_replacer', 0.000000, /* NOP */);
if (!spawnData.restored){
abilityManager.GainStat(3, 0);
}
levelManager.PostInit(this, spawnData.restored);
SetBIsCombatActionAllowed(true);
SetBIsInputAllowed(true, 'OnSpawned');
if (!reputationManager){
reputationManager = new W3Reputation in this;
reputationManager.Initialize();
}
theSound.SoundParameter("focus_aim", 1.000000, 1.000000);
theSound.SoundParameter("focus_distance", 0.000000, 1.000000);
currentlyCastSign = 5;
if (!spawnData.restored){
horseTemplate = (CEntityTemplate)LoadResource("horse_man
ager", /* NOP */);
horseManager = (W3HorseManager)theGame.CreateEntity(hors
eTemplate, GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, 2, /*
NOP */);
horseManager.CreateAttachment(this, /* NOP */, /* NOP */
, /* NOP */);
horseManager.OnCreated();

EntityHandleSet(horseManagerHandle, horseManager);
}
RemoveAbility('Ciri_CombatRegen');
RemoveAbility('Ciri_Rage');
RemoveAbility('CiriBlink');
RemoveAbility('CiriCharge');
RemoveAbility('Ciri_Q205');
RemoveAbility('Ciri_Q305');
RemoveAbility('Ciri_Q403');
RemoveAbility('Ciri_Q111');
RemoveAbility('Ciri_Q501');
RemoveAbility('SkillCiri');
if (spawnData.restored && savedQuenHealth > 0.000000 && savedQue
nDuration >= 3.000000){
restoredQuen = (W3QuenEntity)theGame.CreateEntity(signs[
3].template, GetWorldPosition(), GetWorldRotation(), /* NOP */, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
restoredQuen.Init(signOwner, signs[3].entity, true);
restoredQuen.OnStarted();
restoredQuen.OnThrowing();
restoredQuen.OnEnded(/* NOP */);
restoredQuen.SetDataFromSave(savedQuenHealth, savedQuenD
uration);
} else {
savedQuenHealth = 0.000000;
savedQuenDuration = 0.000000;
}
if (!newGamePlusInitialized && FactsQuerySum("NewGamePlus") > 0)
{
super.NewGamePlusInitialize();
}
isInitialized = true;
/* NOP */;
}
public function IsInitialized() : Bool{
return isInitialized;
/* NOP */;
}
private final function NewGamePlusInitialize(){
var questItems : array<CName>;
var i : Int32;
theGame.params.SetNewGamePlusLevel(GetLevel());
inv.RemoveItemByTag('Quest', -1);
theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
i = 0;
while (i < questItems.Size()){
inv.RemoveItemByName(questItems[i], -1);
i += 1;
}
inv.RemoveItemByTag('NoticeBoardNote', -1);
RemoveAllNonAutoBuffs();
RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
RemoveAlchemyRecipe('Recipe for Pops Antidote');
RemoveAlchemyRecipe('Recipe for Czart Lure');
inv.RemoveItemByTag('Trophy', -1);
inv.RemoveItemByCategory('usable', -1);
RemoveAbility('StaminaTutorialProlog');
RemoveAbility('TutorialStaminaRegenHack');
RemoveAbility('area_novigrad');
RemoveAbility('NoRegenEffect');

RemoveAbility('HeavySwimmingStaminaDrain');
RemoveAbility('AirBoost');
RemoveAbility('area_nml');
RemoveAbility('area_skellige');
inv.RemoveItemByTag('GwintCard', -1);
inv.RemoveItemByTag('ReadableItem', -1);
abilityManager.RestoreStats();
(W3PlayerAbilityManager)abilityManager.RemoveToxicityOffset(1000
0);
newGamePlusInitialized = true;
/* NOP */;
}
public timer function BroadcastRain(optional deltaTime : Float, optional
id : Int32){
var rainStrength : Float;
rainStrength = 0;
rainStrength = GetRainStrength();
if (rainStrength > 0.500000){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(thePlayer, 'RainAction', 2.000000, 50.000000, -1.000000, -1, true, /*
NOP */, /* NOP */);
LogReactionSystem("'RainAction' was sent by Player - sin
gle broadcast - distance: 50.0");
}
/* NOP */;
}
public function InitializeParryType(){
var i : Int32;
var j : Int32;
parryTypeTable.Resize(EnumGetMax('EAttackSwingType') + 1);
i = 0;
while (i < EnumGetMax('EAttackSwingType') + 1){
parryTypeTable[i].Resize(EnumGetMax('EAttackSwingDirecti
on') + 1);
i += 1;
}
parryTypeTable[0][0] = 9;
parryTypeTable[0][1] = 9;
parryTypeTable[0][2] = 2;
parryTypeTable[0][3] = 6;
parryTypeTable[1][0] = 0;
parryTypeTable[1][1] = 4;
parryTypeTable[1][2] = 9;
parryTypeTable[1][3] = 9;
parryTypeTable[2][0] = 9;
parryTypeTable[2][1] = 9;
parryTypeTable[2][2] = 1;
parryTypeTable[2][3] = 7;
parryTypeTable[3][0] = 9;
parryTypeTable[3][1] = 9;
parryTypeTable[3][2] = 3;
parryTypeTable[3][3] = 5;
parryTypeTable[4][0] = 8;
parryTypeTable[4][1] = 8;
parryTypeTable[4][2] = 8;
parryTypeTable[4][3] = 8;
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
var items : array<SItemUniqueId>;

var i : Int32;
var size : Int32;
var slot : EEquipmentSlots;
var holdSlot : CName;
super.OnDeath(damageAction);
items = GetHeldItems();
if (rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State
_WeaponWait'){
OnRangedForceHolster(true, true, true);
rangedWeapon.ClearDeployedEntity(true);
}
size = items.Size();
if (size > 0){
i = 0;
while (i < size){
if (inv.IsIdValid(items[i]) && !inv.IsItemCrossb
ow(items[i])){
holdSlot = inv.GetItemHoldSlot(items[i])
;
if (holdSlot == 'l_weapon' && IsHoldingI
temInLHand()){
OnUseSelectedItem(true);
}
DropItemFromSlot(holdSlot, false);
if (holdSlot == 'r_weapon'){
slot = GetItemSlot(items[i]);
if (UnequipItemFromSlot(slot, /*
NOP */)){
/* NOP */;
}
}
}
i += 1;
}
}
/* NOP */;
}
public function HandleMovement(deltaTime : Float){
super.HandleMovement(deltaTime);
rawCameraHeading = theCamera.GetCameraHeading();
/* NOP */;
}
public function ToggleSpecialAttackHeavyAllowed(toggle : Bool){
specialAttackHeavyAllowed = toggle;
/* NOP */;
}
public function GetReputationManager() : W3Reputation{
return reputationManager;
/* NOP */;
}
public function OnRadialMenuItemChoose(selectedItem : String){
var iSlotId : Int32;
if (selectedItem != "Slot3"){
if (rangedWeapon && rangedWeapon.GetCurrentStateName() !
= 'State_WeaponWait'){
OnRangedForceHolster(true, false, /* NOP */);
}
}
switch(selectedItem){
case "Meditation":

theGame.RequestMenuWithBackground('MeditationClockMenu',
'CommonMenu', /* NOP */);
break;
case "Slot1":
SelectQuickslotItem(7);
break;
case "Slot2":
SelectQuickslotItem(8);
break;
case "Slot3":
SelectQuickslotItem(9);
break;
case "Slot4":
SelectQuickslotItem(10);
break;
case "Slot5":
SelectQuickslotItem(11);
break;
default:
SetEquippedSign(SignStringToEnum(selectedItem));
FactsRemove("SignToggled");
break;
}
/* NOP */;
}
public function ToggleNextItem(){
var quickSlotItems : array<EEquipmentSlots>;
var currentSelectedItem : SItemUniqueId;
var item : SItemUniqueId;
var i : Int32;
i = 11;
while (i > 7 - 1){
GetItemEquippedOnSlot(i, item);
if (inv.IsIdValid(item)){
quickSlotItems.PushBack(i);
}
i -= 1;
}
if (!quickSlotItems.Size()){
return;
}
currentSelectedItem = GetSelectedItemId();
if (inv.IsIdValid(currentSelectedItem)){
i = 0;
while (i < quickSlotItems.Size()){
GetItemEquippedOnSlot(quickSlotItems[i], item);
if (currentSelectedItem == item){
if (i == quickSlotItems.Size() - 1){
SelectQuickslotItem(quickSlotIte
ms[0]);
} else {
SelectQuickslotItem(quickSlotIte
ms[i + 1]);
}
return;
}
i += 1;
}
} else {
SelectQuickslotItem(quickSlotItems[0]);

}
/* NOP */;
}
public function SetEquippedSign(signType : ESignType){
if (!super.IsSignBlocked(signType)){
equippedSign = signType;
FactsSet("CurrentlySelectedSign", equippedSign, /* NOP *
/);
}
/* NOP */;
}
public function GetEquippedSign() : ESignType{
return equippedSign;
/* NOP */;
}
public function GetCurrentlyCastSign() : ESignType{
return currentlyCastSign;
/* NOP */;
}
public function SetCurrentlyCastSign(type : ESignType, entity : W3SignEn
tity){
currentlyCastSign = type;
if (type != 5){
signs[currentlyCastSign].entity = entity;
}
/* NOP */;
}
public function GetCurrentSignEntity() : W3SignEntity{
if (currentlyCastSign == 5){
return NULL;
}
return signs[currentlyCastSign].entity;
/* NOP */;
}
public function GetSignEntity(type : ESignType) : W3SignEntity{
if (type == 5){
return NULL;
}
return signs[type].entity;
/* NOP */;
}
public function IsCurrentSignChanneled() : Bool{
if (currentlyCastSign != 5 && signs[currentlyCastSign].entity){
return signs[currentlyCastSign].entity.OnCheckChanneling
();
}
return false;
/* NOP */;
}
public function IsCastingSign() : Bool{
return currentlyCastSign != 5;
/* NOP */;
}
protected function IsInCombatActionCameraRotationEnabled() : Bool{
if (IsInCombatAction() && GetCombatAction() == 0 || GetCombatAct
ion() == 5){
return true;
}
return !bIsInCombatAction;
/* NOP */;

}
public function SetHoldBeforeOpenRadialMenuTime(time : Float){
_HoldBeforeOpenRadialMenuTime = time;
/* NOP */;
}
public function RepairItem(rapairKitId : SItemUniqueId, usedOnItem : SIt
emUniqueId){
var itemMaxDurablity : Float;
var itemCurrDurablity : Float;
var baseRepairValue : Float;
var reapirValue : Float;
var itemAttribute : SAbilityAttributeValue;
itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
itemCurrDurablity = inv.GetItemDurability(usedOnItem);
itemAttribute = inv.GetItemAttributeValue(rapairKitId, 'repairVa
lue', /* NOP */, /* NOP */);
if (inv.IsItemAnyArmor(usedOnItem) || inv.IsItemWeapon(usedOnIte
m)){
baseRepairValue = itemMaxDurablity * itemAttribute.value
Multiplicative;
reapirValue = MinF(itemCurrDurablity + baseRepairValue,
itemMaxDurablity);
inv.SetItemDurabilityScript(usedOnItem, MinF(reapirValue
, itemMaxDurablity));
}
inv.RemoveItem(rapairKitId, 1);
/* NOP */;
}
public function HasRepairAbleGearEquiped() : Bool{
var curEquipedItem : SItemUniqueId;
return GetWitcherPlayer().GetItemEquippedOnSlot(3, curEquipedIte
m) || GetWitcherPlayer().GetItemEquippedOnSlot(4, curEquipedItem) || GetWitcherP
layer().GetItemEquippedOnSlot(5, curEquipedItem) || GetWitcherPlayer().GetItemEq
uippedOnSlot(6, curEquipedItem) == true;
/* NOP */;
}
public function HasRepairAbleWaponEquiped() : Bool{
var curEquipedItem : SItemUniqueId;
return GetWitcherPlayer().GetItemEquippedOnSlot(1, curEquipedIte
m) || GetWitcherPlayer().GetItemEquippedOnSlot(2, curEquipedItem) == true;
/* NOP */;
}
public function IsItemRepairAble(item : SItemUniqueId) : Bool{
return inv.GetItemDurabilityRatio(item) <= 0.999990;
/* NOP */;
}
public function GetOilAppliedOnSword(steel : Bool) : CName{
var hasItem : Bool;
var sword : SItemUniqueId;
if (steel){
hasItem = GetItemEquippedOnSlot(2, sword);
} else {
hasItem = GetItemEquippedOnSlot(1, sword);
}
if (!hasItem){
return 'None';
}
return inv.GetSwordOil(sword);
/* NOP */;
}

public function IsEquippedSwordUpgradedWithOil(steel : Bool, oilName : C


Name) : Bool{
var sword : SItemUniqueId;
var i : Int32;
var minAbs : Int32;
var maxAbs : Int32;
var hasItem : Bool;
var abilities : array<CName>;
var swordAbilities : array<CName>;
var dm : CDefinitionsManagerAccessor;
var weights : array<Float>;
if (steel){
hasItem = GetItemEquippedOnSlot(2, sword);
} else {
hasItem = GetItemEquippedOnSlot(1, sword);
}
if (hasItem){
inv.GetItemAbilities(sword, swordAbilities);
dm = theGame.GetDefinitionsManager();
if (IsNameValid(oilName)){
dm.GetItemAbilitiesWithWeights(oilName, true, ab
ilities, weights, minAbs, maxAbs);
i = 0;
while (i < abilities.Size()){
if (dm.AbilityHasTag(abilities[i], theGa
me.params.OIL_ABILITY_TAG)){
if (swordAbilities.Contains(abil
ities[i])){
return true;
}
}
i += 1;
}
} else {
i = 0;
while (i < swordAbilities.Size()){
if (dm.AbilityHasTag(swordAbilities[i],
theGame.params.OIL_ABILITY_TAG)){
return true;
}
i += 1;
}
}
}
return false;
/* NOP */;
}
public function ApplyOil(oilId : SItemUniqueId, usedOnItem : SItemUnique
Id){
var oilAbilities : array<CName>;
var i : Int32;
var ammo : Float;
var ammoBonus : Float;
var dm : CDefinitionsManagerAccessor;
var swordEquipped : Bool;
var tutStateOil : W3TutorialManagerUIHandlerStateOils;
var sword : CWitcherSword;
if (!CanApplyOilOnItem(oilId, usedOnItem)){
return;
}

dm = theGame.GetDefinitionsManager();
inv.GetItemAbilitiesWithTag(oilId, theGame.params.OIL_ABILITY_TA
G, oilAbilities);
swordEquipped = IsItemEquipped(usedOnItem);
RemoveItemOil(usedOnItem);
i = 0;
while (i < oilAbilities.Size()){
inv.AddItemCraftedAbility(usedOnItem, oilAbilities[i], /
* NOP */);
if (swordEquipped){
AddAbility(oilAbilities[i], /* NOP */);
}
i += 1;
}
if (swordEquipped){
sword = (CWitcherSword)inv.GetItemEntityUnsafe(usedOnIte
m);
sword.ApplyOil(oilAbilities);
}
ammo = CalculateAttributeValue(inv.GetItemAttributeValue(oilId,
'ammo', /* NOP */, /* NOP */), /* NOP */);
if (thePlayer.CanUseSkill(63)){
ammoBonus = CalculateAttributeValue(thePlayer.GetSkillAt
tributeValue(63, 'ammo_bonus', false, false), /* NOP */);
ammo *= 1 + ammoBonus * thePlayer.GetSkillLevel(63);
}
inv.SetItemModifierInt(usedOnItem, 'oil_charges', RoundMath(ammo
));
inv.SetItemModifierInt(usedOnItem, 'oil_max_charges', RoundMath(
ammo));
LogOils("Added oil <<" + inv.GetItemName(oilId) + ">> to <<" + i
nv.GetItemName(usedOnItem) + ">>");
SetFailedFundamentalsFirstAchievementCondition(true);
if (ShouldProcessTutorial('TutorialOilCanEquip3')){
tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGa
me.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateOil){
tutStateOil.OnOilApplied();
}
}
theGame.GetGlobalEventsManager().OnScriptedEvent(3, /* NOP */, /
* NOP */);
/* NOP */;
}
public function ReduceDamage(damageData : W3DamageAction){
var actorAttacker : CActor;
var quen : W3QuenEntity;
var attackRange : CAIAttackRange;
var attackerMovementAdjustor : CMovementAdjustor;
var dist : Float;
var distToAttacker : Float;
var actionHeading : Float;
var attackerHeading : Float;
var attackName : CName;
var useQuenForBleeding : Bool;
super.ReduceDamage(damageData);
quen = (W3QuenEntity)signs[3].entity;
useQuenForBleeding = false;
if (quen && !damageData.DealsAnyDamage() && (W3Effect_Bleeding)d
amageData.causer && damageData.GetDamageValue(theGame.params.DAMAGE_NAME_DIRECT)

> 0.000000){
useQuenForBleeding = true;
}
if (!useQuenForBleeding && !damageData.DealsAnyDamage()){
return;
}
actorAttacker = (CActor)damageData.attacker;
if (actorAttacker && IsCurrentlyDodging() && damageData.CanBeDod
ged()){
actionHeading = evadeHeading;
attackerHeading = actorAttacker.GetHeading();
dist = AngleDistance(actionHeading, attackerHeading);
distToAttacker = VecDistance(GetWorldPosition(), damageD
ata.attacker.GetWorldPosition());
attackName = actorAttacker.GetLastAttackRangeName();
attackRange = theGame.GetAttackRangeForEntity(actorAttac
ker, attackName);
attackerMovementAdjustor = actorAttacker.GetMovingAgentC
omponent().GetMovementAdjustor();
if (AbsF(dist) < 150 && attackName != 'stomp' && attackN
ame != 'anchor_special_far' && attackName != 'anchor_far' || attackName == 'stom
p' || attackName == 'anchor_special_far' || attackName == 'anchor_far' && distTo
Attacker > attackRange.rangeMax * 0.750000){
if (theGame.CanLog()){
LogDMHits("W3PlayerWitcher.ReduceDamage:
Attack dodged by player - no damage done", damageData);
}
damageData.SetAllProcessedDamageAs(0);
damageData.SetWasDodged();
} else if (!damageData.IsActionEnvironment() || damageDa
ta.IsDoTDamage() && CanUseSkill(24)){
damageData.processedDmg.vitalityDamage *= 1 - Ca
lculateAttributeValue(thePlayer.GetSkillAttributeValue(24, 'damage_reduction', f
alse, true), /* NOP */) * thePlayer.GetSkillLevel(24);
if (theGame.CanLog()){
LogDMHits("W3PlayerWitcher.ReduceDamage:
skill S_Sword_s09 reduced damage while dodging", damageData);
}
}
}
if (quen && damageData.GetBuffSourceName() != "FallingDamage"){
if (theGame.CanLog()){
LogDMHits("W3PlayerWitcher.ReduceDamage: Process
ing Quen sign damage reduction...", damageData);
}
quen.OnTargetHit(damageData);
}
/* NOP */;
}
public timer function UndyingSkillCooldown(optional dt : Float, optional
id : Int32){
cannotUseUndyingSkill = false;
/* NOP */;
}
public function OnTakeDamage(action : W3DamageAction) : Bool{
var currVitality : Float;
var hpTriggerTreshold : Float;
var healingFactor : Float;
var abilityName : CName;
var abilityCount : Float;

var maxStack : Float;


var itemDurability : Float;
var addAbility : Bool;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var mutagenQuen : W3SignEntity;
var equipped : array<SItemUniqueId>;
var i : Int32;
currVitality = GetStat(0, /* NOP */);
if (action.processedDmg.vitalityDamage >= currVitality){
if (!cannotUseUndyingSkill && FloorF(GetStat(4, /* NOP *
/)) >= 1 && CanUseSkill(33) && HasBuff(48)){
healingFactor = CalculateAttributeValue(GetSkill
AttributeValue(33, 'healing_factor', false, true), /* NOP */);
healingFactor *= GetStatMax(0);
healingFactor *= GetStat(4, /* NOP */);
healingFactor *= 1 + CalculateAttributeValue(Get
SkillAttributeValue(33, 'healing_bonus', false, true), /* NOP */) * GetSkillLeve
l(33) - 1;
ForceSetStat(0, GetStatMax(0));
action.processedDmg.vitalityDamage = GetStatMax(
0) - healingFactor;
DrainFocus(GetStat(4, /* NOP */));
RemoveBuff(48, /* NOP */, /* NOP */);
cannotUseUndyingSkill = true;
AddTimer('UndyingSkillCooldown', CalculateAttrib
uteValue(GetSkillAttributeValue(33, 'trigger_delay', false, true), /* NOP */), f
alse, /* NOP */, /* NOP */, true, /* NOP */);
} else {
equipped = GetEquippedItems();
i = 0;
while (i < equipped.Size()){
if (!inv.IsIdValid(equipped[i])){
} else {
itemDurability = inv.GetItemDura
bility(equipped[i]);
if (inv.ItemHasAbility(equipped[
i], 'MA_Reinforced') && itemDurability > 0){
inv.SetItemDurabilityScr
ipt(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage));
action.processedDmg.vita
lityDamage = 0;
ForceSetStat(0, 1);
break;
}
}
i += 1;
}
}
}
if (action.DealsAnyDamage() && !(W3Effect_Toxicity)action.causer
){
if (HasBuff(82)){
RemoveAbilityAll(GetBuff(82, /* NOP */).GetAbili
tyName());
}
if (HasBuff(87)){
RemoveAbilityAll(GetBuff(87, /* NOP */).GetAbili
tyName());
}

}
if (HasBuff(91)){
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(GetBuff(91, /* NOP */).GetAbilityName(), 'max_hp_perc_trigger', min, max);
hpTriggerTreshold = GetStatMax(0) * CalculateAttributeVa
lue(GetAttributeRandomizedValue(min, max), /* NOP */);
if (action.GetDamageDealt() >= hpTriggerTreshold){
mutagenQuen = (W3SignEntity)theGame.CreateEntity
(signs[3].template, GetWorldPosition(), GetWorldRotation(), /* NOP */, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
mutagenQuen.Init(signOwner, signs[3].entity, tru
e);
mutagenQuen.OnStarted();
mutagenQuen.OnThrowing();
mutagenQuen.OnEnded(/* NOP */);
}
}
if (action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(
99)){
abilityName = GetBuff(99, /* NOP */).GetAbilityName();
abilityCount = GetAbilityCount(abilityName);
if (abilityCount == 0){
addAbility = true;
} else {
theGame.GetDefinitionsManager().GetAbilityAttrib
uteValue(abilityName, 'mutagen27_max_stack', min, max);
maxStack = CalculateAttributeValue(GetAttributeR
andomizedValue(min, max), /* NOP */);
if (maxStack >= 0){
addAbility = abilityCount < maxStack;
} else {
addAbility = true;
}
}
if (addAbility){
AddAbility(abilityName, true);
}
}
return super.OnTakeDamage(action);
/* NOP */;
}
public function OnStartFistfightMinigame() : Bool{
super.OnStartFistfightMinigame();
BlockAction(2, 'FistFightMinigame', /* NOP */, true, /* NOP */);
BlockAction(32, 'FistFightMinigame', /* NOP */, true, /* NOP */)
;
effectManager.RemoveAllPotionEffectsBut(NULL);
/* NOP */;
}
public function OnEndFistfightMinigame() : Bool{
UnblockAction(2, 'FistFightMinigame');
UnblockAction(32, 'FistFightMinigame');
super.OnEndFistfightMinigame();
/* NOP */;
}
public function GetCriticalHitChance(isHeavyAttack : Bool, target : CAct
or, victimMonsterCategory : EMonsterCategory) : Float{
var ret : Float;
ret = super.GetCriticalHitChance(isHeavyAttack, target, victimMo
nsterCategory);

return ret;
/* NOP */;
}
public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, vict
imMonsterCategory : EMonsterCategory, isStrikeAtBack : Bool) : SAbilityAttribute
Value{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var bonus : SAbilityAttributeValue;
var null : SAbilityAttributeValue;
var oilBonus : SAbilityAttributeValue;
var mutagen : CBaseGameplayEffect;
var vsAttributeName : CName;
bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterC
ategory, isStrikeAtBack);
if (inv.ItemHasOilApplied(weaponId) && GetStat(4, /* NOP */) >=
3 && CanUseSkill(64)){
vsAttributeName = MonsterCategoryToCriticalDamageBonus(v
ictimMonsterCategory);
oilBonus = inv.GetItemAttributeValue(weaponId, vsAttribu
teName, /* NOP */, /* NOP */);
if (oilBonus != null){
bonus += GetSkillAttributeValue(64, theGame.para
ms.CRITICAL_HIT_DAMAGE_BONUS, false, true);
}
}
if (isStrikeAtBack && HasBuff(83)){
mutagen = GetBuff(83, /* NOP */);
theGame.GetDefinitionsManager().GetAbilityAttributeValue
(mutagen.GetAbilityName(), 'damageIncrease', min, max);
bonus += GetAttributeRandomizedValue(min, max);
}
return bonus;
/* NOP */;
}
public function ProcessLockTarget(newLockTarget : CActor, checkLeftStick
Heading : Bool) : Bool{
var newLockTargetFound : Bool;
newLockTargetFound = super.ProcessLockTarget(newLockTarget, chec
kLeftStickHeading);
if (GetCurrentlyCastSign() == 4){
(W3AxiiEntity)GetCurrentSignEntity().OnDisplayTargetChan
ge(newLockTarget);
}
return newLockTargetFound;
/* NOP */;
}
public timer function Mutagen14Timer(optional dt : Float, optional id :
Int32){
var abilityName : CName;
var abilityCount : Float;
var maxStack : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var addAbility : Bool;
abilityName = thePlayer.GetBuff(86, /* NOP */).GetAbilityName();
abilityCount = thePlayer.GetAbilityCount(abilityName);
if (abilityCount == 0){
addAbility = true;
} else {

theGame.GetDefinitionsManager().GetAbilityAttributeValue
(abilityName, 'mutagen14_max_stack', min, max);
maxStack = CalculateAttributeValue(GetAttributeRandomize
dValue(min, max), /* NOP */);
if (maxStack >= 0){
addAbility = abilityCount < maxStack;
} else {
addAbility = true;
}
}
if (addAbility){
thePlayer.AddAbility(abilityName, true);
} else {
RemoveTimer('Mutagen14Timer', /* NOP */);
}
/* NOP */;
}
public final function FailFundamentalsFirstAchievementCondition(){
SetFailedFundamentalsFirstAchievementCondition(true);
/* NOP */;
}
public final function SetUsedQuenInCombat(){
usedQuenInCombat = true;
/* NOP */;
}
public final function UsedQuenInCombat() : Bool{
return usedQuenInCombat;
/* NOP */;
}
public function OnCombatStart() : Bool{
var quenEntity : W3QuenEntity;
var focus : Float;
super.OnCombatStart();
if (IsInCombatActionFriendly()){
SetBIsCombatActionAllowed(true);
SetBIsInputAllowed(true, 'OnCombatActionStart');
}
if (HasBuff(86)){
AddTimer('Mutagen14Timer', 2, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
}
if (HasBuff(87)){
AddAbility(GetBuff(87, /* NOP */).GetAbilityName(), fals
e);
}
quenEntity = (W3QuenEntity)signs[3].entity;
if (quenEntity){
usedQuenInCombat = quenEntity.IsAnyQuenActive();
} else {
usedQuenInCombat = false;
}
if (usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgrad
edWithOil(true, /* NOP */) || IsEquippedSwordUpgradedWithOil(false, /* NOP */)){
SetFailedFundamentalsFirstAchievementCondition(true);
} else if (IsAnyItemEquippedOnSlot(18) || IsAnyItemEquippedOnSlo
t(19) || IsAnyItemEquippedOnSlot(20) || IsAnyItemEquippedOnSlot(21)){
SetFailedFundamentalsFirstAchievementCondition(true);
} else {
SetFailedFundamentalsFirstAchievementCondition(false);
}

if (GetWitcherPlayer().CanUseSkill(35) && GetWitcherPlayer().IsT


hreatened()){
focus = thePlayer.GetStat(4, /* NOP */);
if (focus < 1){
thePlayer.GainStat(4, 1 - focus);
}
}
MeditationForceAbort(true);
/* NOP */;
}
public function OnCombatFinished() : Bool{
var mut17 : W3Mutagen17_Effect;
super.OnCombatFinished();
if (HasBuff(82)){
RemoveAbilityAll(GetBuff(82, /* NOP */).GetAbilityName()
);
}
if (HasBuff(86)){
RemoveAbilityAll(GetBuff(86, /* NOP */).GetAbilityName()
);
}
if (HasBuff(87)){
RemoveAbilityAll(GetBuff(87, /* NOP */).GetAbilityName()
);
}
if (HasBuff(89)){
mut17 = (W3Mutagen17_Effect)GetBuff(89, /* NOP */);
mut17.ClearBoost();
}
if (HasBuff(90)){
RemoveAbilityAll(GetBuff(90, /* NOP */).GetAbilityName()
);
}
if (HasBuff(94)){
RemoveAbilityAll(GetBuff(94, /* NOP */).GetAbilityName()
);
}
if (HasBuff(99)){
RemoveAbilityAll(GetBuff(99, /* NOP */).GetAbilityName()
);
}
if (GetStat(4, /* NOP */) > 0){
AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENA
LINE_DRAIN_AFTER_COMBAT_DELAY, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */)
;
}
usedQuenInCombat = false;
theGame.GetGamerProfile().ResetStat(2);
/* NOP */;
if (ShouldAutoSheathSwordInstantly()){
AddTimer('DelayedSheathSword', 0.500000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
} else {
AddTimer('DelayedSheathSword', 2.000000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
OnBlockAllCombatTickets(false);
/* NOP */;
}
public timer function DelayedAdrenalineDrain(optional dt : Float, option

al id : Int32){
AddEffectDefault(50, this, "after_combat_adrenaline_drain", /* N
OP */);
/* NOP */;
}
protected function Attack(hitTarget : CGameplayEntity, animData : CPreAt
tackEventData, weaponId : SItemUniqueId, parried : Bool, countered : Bool, parri
edBy : array<CActor>, attackAnimationName : CName, hitTime : Float, weaponEntity
: CItemEntity){
var mutagen17 : W3Mutagen17_Effect;
super.Attack(hitTarget, animData, weaponId, parried, countered,
parriedBy, attackAnimationName, hitTime, weaponEntity);
if ((CActor)hitTarget && HasBuff(89)){
mutagen17 = (W3Mutagen17_Effect)GetBuff(89, /* NOP */);
if (mutagen17.HasBoost()){
mutagen17.ClearBoost();
}
}
/* NOP */;
}
public final timer function SpecialAttackLightSustainCost(optional dt :
Float, optional id : Int32){
var focusPerSec : Float;
var cost : Float;
var delay : Float;
var reduction : SAbilityAttributeValue;
var skillLevel : Int32;
if (abilityManager && abilityManager.IsInitialized() && IsAlive(
)){
PauseStaminaRegen('WhirlSkill');
if (GetStat(2, /* NOP */) > 0){
cost = GetStaminaActionCost(12, GetSkillAbilityN
ame(16), dt);
delay = GetStaminaActionDelay(12, GetSkillAbilit
yName(16), dt);
skillLevel = GetSkillLevel(16);
if (skillLevel > 1){
reduction = GetSkillAttributeValue(16, '
cost_reduction', false, true) * skillLevel - 1;
cost = MaxF(0, cost * 1 - reduction.valu
eMultiplicative - reduction.valueAdditive);
}
DrainStamina(13, cost, delay, /* NOP */, /* NOP
*/, /* NOP */);
} else {
GetSkillAttributeValue(16, 'focus_cost_per_sec',
false, true);
focusPerSec = GetWhirlFocusCostPerSec();
DrainFocus(focusPerSec * dt);
}
}
if (GetStat(2, /* NOP */) <= 0 && GetStat(4, /* NOP */) <= 0){
OnPerformSpecialAttack(true, false);
}
/* NOP */;
}
public final function GetWhirlFocusCostPerSec() : Float{
var ability : SAbilityAttributeValue;
var val : Float;
var skillLevel : Int32;

ability = GetSkillAttributeValue(16, 'focus_cost_per_sec_initial


', false, false);
skillLevel = GetSkillLevel(16);
if (skillLevel > 1){
ability -= GetSkillAttributeValue(16, 'cost_reduction',
false, false) * skillLevel - 1;
}
val = CalculateAttributeValue(ability, /* NOP */);
return val;
/* NOP */;
}
public final timer function SpecialAttackHeavySustainCost(optional dt :
Float, optional id : Int32){
var focusHighlight : Float;
var ratio : Float;
var hud : CR4ScriptedHud;
var hudWolfHeadModule : CR4HudModuleWolfHead;
DrainStamina(12, 0, 0, GetSkillAbilityName(17), dt, /* NOP */);
if (GetStat(2, /* NOP */) <= 0){
OnPerformSpecialAttack(false, false);
}
ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavy
StartEngineTime) / specialHeavyChargeDuration;
if (ratio > 0.950000){
ratio = 1;
}
SetSpecialAttackTimeRatio(ratio);
focusHighlight = ratio * GetStatMax(4);
focusHighlight = MinF(focusHighlight, GetStat(4, /* NOP */));
focusHighlight = FloorF(focusHighlight);
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModu
le("WolfHeadModule");
if (hudWolfHeadModule){
hudWolfHeadModule.LockFocusPoints(focusHighlight
);
}
}
/* NOP */;
}
public function OnSpecialAttackHeavyActionProcess(){
var hud : CR4ScriptedHud;
var hudWolfHeadModule : CR4HudModuleWolfHead;
super.OnSpecialAttackHeavyActionProcess();
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModu
le("WolfHeadModule");
if (hudWolfHeadModule){
hudWolfHeadModule.ResetFocusPoints();
}
}
/* NOP */;
}
public timer function IsSpecialLightAttackInputHeld(optional time : Floa
t, optional id : Int32){
var hasResource : Bool;
if (GetCurrentStateName() == 'CombatSteel' || GetCurrentStateNam
e() == 'CombatSilver'){

if (GetBIsCombatActionAllowed() && inputHandler.IsAction


Allowed(24)){
if (GetStat(2, /* NOP */) > 0){
hasResource = true;
} else {
hasResource = GetStat(4, /* NOP */) >= s
uper.GetWhirlFocusCostPerSec() * time;
}
if (hasResource){
SetupCombatAction(7, 1);
RemoveTimer('IsSpecialLightAttackInputHe
ld', /* NOP */);
} else if (!playedSpecialAttackMissingResourceSo
und){
thePlayer.IndicateTooLowAdrenaline();
playedSpecialAttackMissingResourceSound
= true;
}
}
} else {
RemoveTimer('IsSpecialLightAttackInputHeld', /* NOP */);
}
/* NOP */;
}
public timer function IsSpecialHeavyAttackInputHeld(optional time : Floa
t, optional id : Int32){
var cost : Float;
if (GetCurrentStateName() == 'CombatSteel' || GetCurrentStateNam
e() == 'CombatSilver'){
cost = CalculateAttributeValue(GetWitcherPlayer().GetSki
llAttributeValue(17, 'stamina_cost_per_sec', false, false), /* NOP */);
if (GetBIsCombatActionAllowed() && inputHandler.IsAction
Allowed(24)){
if (GetStat(2, /* NOP */) >= cost){
SetupCombatAction(8, 1);
RemoveTimer('IsSpecialHeavyAttackInputHe
ld', /* NOP */);
} else if (!playedSpecialAttackMissingResourceSo
und){
thePlayer.IndicateTooLowAdrenaline();
playedSpecialAttackMissingResourceSound
= true;
}
}
} else {
RemoveTimer('IsSpecialHeavyAttackInputHeld', /* NOP */);
}
/* NOP */;
}
public function EvadePressed(bufferAction : EBufferActionType){
var cat : Float;
if (bufferAction == 6 && IsActionAllowed(23) || bufferAction ==
9 && IsActionAllowed(11)){
if (bufferAction != 9 && ShouldProcessTutorial('Tutorial
Dodge')){
FactsAdd("tut_in_dodge", 1, 2);
if (FactsQuerySum("tut_fight_use_slomo") > 0){
theGame.RemoveTimeScale(theGame.GetTimes
caleSource(13));
FactsRemove("tut_fight_slomo_ON");

}
} else if (bufferAction == 9 && ShouldProcessTutorial('T
utorialRoll')){
FactsAdd("tut_in_roll", 1, 2);
if (FactsQuerySum("tut_fight_use_slomo") > 0){
theGame.RemoveTimeScale(theGame.GetTimes
caleSource(13));
FactsRemove("tut_fight_slomo_ON");
}
}
if (thePlayer.GetBIsInputAllowed()){
if (thePlayer.GetBIsCombatActionAllowed()){
thePlayer.CriticalEffectAnimationInterru
pted("Dodge 2");
thePlayer.PushCombatActionOnBuffer(buffe
rAction, 0, /* NOP */);
thePlayer.ProcessCombatActionBuffer();
} else if (thePlayer.IsInCombatAction() && thePl
ayer.GetBehaviorVariable('combatActionType', /* NOP */) == 0){
if (thePlayer.CanPlayHitAnim() && thePla
yer.IsThreatened()){
thePlayer.CriticalEffectAnimatio
nInterrupted("Dodge 1");
thePlayer.PushCombatActionOnBuff
er(bufferAction, 0, /* NOP */);
thePlayer.ProcessCombatActionBuf
fer();
} else {
thePlayer.PushCombatActionOnBuff
er(bufferAction, 0, /* NOP */);
}
} else if (!thePlayer.IsCurrentSignChanneled()){
thePlayer.PushCombatActionOnBuffer(buffe
rAction, 0, /* NOP */);
}
} else {
if (thePlayer.IsInCombatAction() && thePlayer.Ge
tBehaviorVariable('combatActionType', /* NOP */) == 0){
if (thePlayer.CanPlayHitAnim() && thePla
yer.IsThreatened()){
thePlayer.CriticalEffectAnimatio
nInterrupted("Dodge 3");
thePlayer.PushCombatActionOnBuff
er(bufferAction, 0, /* NOP */);
thePlayer.ProcessCombatActionBuf
fer();
} else {
thePlayer.PushCombatActionOnBuff
er(bufferAction, 0, /* NOP */);
}
}
/* NOP */;
}
} else {
thePlayer.DisplayActionDisallowedHudMessage(23, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function ProcessCombatActionBuffer() : Bool{

var action : EBufferActionType;


var stage : EButtonStage;
var throwStage : EThrowStage;
var actionResult : Bool;
action = BufferCombatAction;
stage = BufferButtonStage;
actionResult = true;
if (isInFinisher){
return false;
}
if (action != 8){
specialAttackCamera = false;
}
if (super.ProcessCombatActionBuffer()){
return true;
}
switch(action){
case 3:
switch(stage){
case 1:
actionResult = CastSign();
/* NOP */;
break;
default:
actionResult = false;
break;
}
break;
case 7:
switch(stage){
case 1:
actionResult = OnPerformSpecialAttack(true, true
);
break;
case 0:
actionResult = OnPerformSpecialAttack(true, fals
e);
break;
default:
actionResult = false;
break;
}
break;
case 8:
switch(stage){
case 1:
actionResult = OnPerformSpecialAttack(false, tru
e);
break;
case 0:
actionResult = OnPerformSpecialAttack(false, fal
se);
break;
default:
actionResult = false;
break;
}
break;
default:
return false;

}
CleanCombatActionBuffer();
if (actionResult){
SetCombatAction(action);
}
return true;
/* NOP */;
}
public function OnPerformSpecialAttack(isLightAttack : Bool, enableAttac
k : Bool) : Bool{
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
super.OnPlayerTickTimer(deltaTime);
if (!IsInCombat()){
fastAttackCounter = 0;
heavyAttackCounter = 0;
}
/* NOP */;
}
protected function PrepareAttackAction(hitTarget : CGameplayEntity, anim
Data : CPreAttackEventData, weaponId : SItemUniqueId, parried : Bool, countered
: Bool, parriedBy : array<CActor>, attackAnimationName : CName, hitTime : Float,
weaponEntity : CItemEntity, attackAction : W3Action_Attack) : Bool{
var ret : Bool;
var skill : ESkill;
ret = super.PrepareAttackAction(hitTarget, animData, weaponId, p
arried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attack
Action);
if (!ret){
return false;
}
if (attackAction.IsActionMelee()){
skill = SkillNameToEnum(attackAction.GetAttackTypeName()
);
if (skill != 0 && CanUseSkill(skill)){
if (IsLightAttack(animData.attackName)){
fastAttackCounter += 1;
} else {
fastAttackCounter = 0;
}
if (IsHeavyAttack(animData.attackName)){
heavyAttackCounter += 1;
} else {
heavyAttackCounter = 0;
}
}
}
AddTimer('FastAttackCounterDecay', 5.000000, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
AddTimer('HeavyAttackCounterDecay', 5.000000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
return true;
/* NOP */;
}
protected function TestParryAndCounter(data : CPreAttackEventData, weapo
nId : SItemUniqueId, parried : Bool, countered : Bool) : array<CActor>{
if (SkillNameToEnum(attackActionName) == 17){
data.Can_Parry_Attack = false;
}
return super.TestParryAndCounter(data, weaponId, parried, counte

red);
/* NOP */;
}
private timer function FastAttackCounterDecay(optional delta : Float, op
tional id : Int32){
fastAttackCounter = 0;
/* NOP */;
}
private timer function HeavyAttackCounterDecay(optional delta : Float, o
ptional id : Int32){
heavyAttackCounter = 0;
/* NOP */;
}
public function GetCraftingSchematicsNames() : array<CName>{
return craftingSchematics;
/* NOP */;
}
public function AddCraftingSchematic(nam : CName, isSilent : Bool, skipT
utorialUpdate : Bool) : Bool{
var i : Int32;
if (!skipTutorialUpdate && ShouldProcessTutorial('TutorialCrafti
ngGotRecipe')){
FactsAdd("tut_received_schematic", /* NOP */, /* NOP */)
;
}
i = 0;
while (i < craftingSchematics.Size()){
if (craftingSchematics[i] == nam){
return false;
}
if (StrCmp(craftingSchematics[i], nam, /* NOP */, /* NOP
*/) > 0){
craftingSchematics.Insert(i, nam);
AddCraftingHudNotification(nam, isSilent);
theGame.GetGlobalEventsManager().OnScriptedEvent
(7, /* NOP */, /* NOP */);
return true;
}
i += 1;
}
craftingSchematics.PushBack(nam);
AddCraftingHudNotification(nam, isSilent);
theGame.GetGlobalEventsManager().OnScriptedEvent(7, /* NOP */, /
* NOP */);
return true;
/* NOP */;
}
public function AddCraftingHudNotification(nam : CName, isSilent : Bool)
{
var hud : CR4ScriptedHud;
if (!isSilent){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.OnCraftingSchematicUpdate(nam);
}
}
/* NOP */;
}
public function AddAlchemyHudNotification(nam : CName, isSilent : Bool){
var hud : CR4ScriptedHud;

if (!isSilent){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.OnAlchemySchematicUpdate(nam);
}
}
/* NOP */;
}
public function GetAlchemyRecipes() : array<CName>{
return alchemyRecipes;
/* NOP */;
}
public function CanLearnAlchemyRecipe(recipeName : CName) : Bool{
var dm : CDefinitionsManagerAccessor;
var recipeNode : SCustomNode;
var i : Int32;
var tmpInt : Int32;
var tmpName : CName;
dm = theGame.GetDefinitionsManager();
if (dm.GetSubNodeByAttributeValueAsCName(recipeNode, 'alchemy_re
cipes', 'name_name', recipeName)){
return true;
}
return false;
/* NOP */;
}
private final function RemoveAlchemyRecipe(recipeName : CName){
alchemyRecipes.Remove(recipeName);
/* NOP */;
}
public function AddAlchemyRecipe(nam : CName, isSilent : Bool, skipTutor
ialUpdate : Bool) : Bool{
var i : Int32;
var potions : Int32;
var bombs : Int32;
var found : Bool;
var m_alchemyManager : W3AlchemyManager;
var recipe : SAlchemyRecipe;
var knownBombTypes : array<String>;
var strRecipeName : String;
var recipeNameWithoutLevel : String;
if (!IsAlchemyRecipe(nam)){
return false;
}
found = false;
i = 0;
while (i < alchemyRecipes.Size()){
if (alchemyRecipes[i] == nam){
return false;
}
if (StrCmp(alchemyRecipes[i], nam, /* NOP */, /* NOP */)
> 0){
alchemyRecipes.Insert(i, nam);
found = true;
AddAlchemyHudNotification(nam, isSilent);
break;
}
i += 1;
}
if (!found){

alchemyRecipes.PushBack(nam);
AddAlchemyHudNotification(nam, isSilent);
}
m_alchemyManager = new W3AlchemyManager in this;
m_alchemyManager.Init(alchemyRecipes);
m_alchemyManager.GetRecipe(nam, recipe);
if (CanUseSkill(75)){
if (recipe.cookedItemType != 5 && recipe.cookedItemType
!= 0 && recipe.level <= GetSkillLevel(75)){
AddAbility(SkillEnumToName(75), true);
}
}
potions = 0;
bombs = 0;
i = 0;
while (i < alchemyRecipes.Size()){
m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
if (recipe.cookedItemType == 1 || recipe.cookedItemType
== 6 || recipe.cookedItemType == 7 || recipe.cookedItemType == 8){
potions += 1;
} else if (recipe.cookedItemType == 2){
strRecipeName = NameToString(alchemyRecipes[i]);
recipeNameWithoutLevel = StrLeft(strRecipeName,
StrLen(strRecipeName) - 2);
if (!knownBombTypes.Contains(recipeNameWithoutLe
vel)){
bombs += 1;
knownBombTypes.PushBack(recipeNameWithou
tLevel);
}
}
i += 1;
}
theGame.GetGamerProfile().SetStat(10, potions);
theGame.GetGamerProfile().SetStat(11, bombs);
theGame.GetGlobalEventsManager().OnScriptedEvent(6, /* NOP */, /
* NOP */);
return true;
/* NOP */;
}
public function GetDisplayHeavyAttackIndicator() : Bool{
return bDispalyHeavyAttackIndicator;
/* NOP */;
}
public function SetDisplayHeavyAttackIndicator(val : Bool){
bDispalyHeavyAttackIndicator = val;
/* NOP */;
}
public function GetDisplayHeavyAttackFirstLevelTimer() : Bool{
return bDisplayHeavyAttackFirstLevelTimer;
/* NOP */;
}
public function SetDisplayHeavyAttackFirstLevelTimer(val : Bool){
bDisplayHeavyAttackFirstLevelTimer = val;
/* NOP */;
}
public function SelectQuickslotItem(slot : EEquipmentSlots){
var item : SItemUniqueId;
GetItemEquippedOnSlot(slot, item);
selectedItemId = item;

/* NOP */;
}
public function GetMedallion() : W3MedallionController{
if (!medallionController){
medallionController = new W3MedallionController in this;
}
return medallionController;
/* NOP */;
}
public final function HighlightObjects(range : Float, highlightTime : Fl
oat){
var ents : array<CGameplayEntity>;
var i : Int32;
FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 10
0, 'HighlightedByMedalionFX', 1, /* NOP */, /* NOP */);
if (highlightTime == 0){
highlightTime = 30;
}
i = 0;
while (i < ents.Size()){
if (!ents[i].IsHighlighted()){
ents[i].SetHighlighted(true);
ents[i].PlayEffectSingle('medalion_detection_fx'
, /* NOP */);
ents[i].AddTimer('MedallionEffectOff', highlight
Time, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
i += 1;
}
/* NOP */;
}
public final function HighlightEnemies(range : Float, highlightTime : Fl
oat){
var ents : array<CGameplayEntity>;
var i : Int32;
var catComponent : CGameplayEffectsComponent;
FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 10
0, /* NOP */, 1 + 4, /* NOP */, /* NOP */);
if (highlightTime == 0){
highlightTime = 5;
}
i = 0;
while (i < ents.Size()){
if (IsRequiredAttitudeBetween(this, ents[i], true, /* NO
P */, /* NOP */)){
catComponent = GetGameplayEffectsComponent(ents[
i]);
if (catComponent){
catComponent.SetGameplayEffectFlag(2, tr
ue);
ents[i].AddTimer('EnemyHighlightOff', hi
ghlightTime, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
i += 1;
}
/* NOP */;
}
public function SpawnMedallionEntity(){
var rot : EulerAngles;

var spawnedMedallion : CEntity;


spawnedMedallion = theGame.GetEntityByTag('new_Witcher_medallion
_FX');
if (!spawnedMedallion){
theGame.CreateEntity(medallionEntity, GetWorldPosition()
, rot, true, false, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public final function InterruptCombatFocusMode(){
if (GetCurrentStateName() == 'CombatFocusMode_SelectSpot'){
SetCanPlayHitAnim(true);
PopState(/* NOP */);
}
/* NOP */;
}
public final function AddBombThrowDelay(bombId : SItemUniqueId){
var slot : EEquipmentSlots;
slot = GetItemSlot(bombId);
if (slot == 12){
return;
}
if (slot == 7 || slot == 10){
remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW
_DELAY;
AddTimer('BombDelay1', 0.100000, true, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
} else if (slot == 8 || slot == 11){
remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW
_DELAY;
AddTimer('BombDelay2', 0.100000, true, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
/* NOP */;
}
public final function GetBombDelay(slot : EEquipmentSlots) : Float{
if (slot == 7 || slot == 10){
return remainingBombThrowDelaySlot1;
} else if (slot == 8 || slot == 11){
return remainingBombThrowDelaySlot2;
}
return 0;
/* NOP */;
}
public timer function BombDelay1(optional dt : Float, optional id : Int3
2){
remainingBombThrowDelaySlot1 -= dt;
if (remainingBombThrowDelaySlot1 <= 0){
RemoveTimer('BombDelay1', /* NOP */);
}
/* NOP */;
}
public timer function BombDelay2(optional dt : Float, optional id : Int3
2){
remainingBombThrowDelaySlot2 -= dt;
if (remainingBombThrowDelaySlot2 <= 0){
RemoveTimer('BombDelay2', /* NOP */);
}
/* NOP */;
}

public function ResetCharacterDev(){


UnequipItemFromSlot(22, /* NOP */);
UnequipItemFromSlot(23, /* NOP */);
UnequipItemFromSlot(24, /* NOP */);
UnequipItemFromSlot(25, /* NOP */);
levelManager.ResetCharacterDev();
(W3PlayerAbilityManager)abilityManager.ResetCharacterDev();
/* NOP */;
}
public function ConsumeItem(itemId : SItemUniqueId) : Bool{
var itemName : CName;
var removedItem : Bool;
var willRemoveItem : Bool;
var edibles : array<SItemUniqueId>;
var toSlot : EEquipmentSlots;
var i : Int32;
var equippedNewEdible : Bool;
itemName = inv.GetItemName(itemId);
if (itemName == 'q111_imlerith_acorn'){
AddPoints(0, 2, true);
removedItem = inv.RemoveItem(itemId, 1);
theGame.GetGuiManager().ShowNotification(GetLocStringByK
eyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("
panel_character_availablepoints") + " +2", /* NOP */);
theSound.SoundEvent("gui_character_buy_skill");
} else if (itemName == 'Clearing Potion'){
ResetCharacterDev();
removedItem = inv.RemoveItem(itemId, 1);
theGame.GetGuiManager().ShowNotification(GetLocStringByK
eyExt("panel_character_popup_character_cleared"), /* NOP */);
theSound.SoundEvent("gui_character_synergy_effect");
} else {
willRemoveItem = inv.GetItemQuantity(itemId) == 1;
if (willRemoveItem){
toSlot = GetItemSlot(itemId);
}
removedItem = super.ConsumeItem(itemId);
if (willRemoveItem && removedItem){
edibles = inv.GetItemsByTag('Edibles');
equippedNewEdible = false;
i = 0;
while (i < edibles.Size()){
if (!IsItemEquipped(edibles[i]) && !inv.
ItemHasTag(edibles[i], 'Alcohol')){
EquipItemInGivenSlot(edibles[i],
toSlot, true, false);
equippedNewEdible = true;
break;
}
i += 1;
}
if (!equippedNewEdible){
i = 0;
while (i < edibles.Size()){
if (!IsItemEquipped(edibles[i]))
{
EquipItemInGivenSlot(edi
bles[i], toSlot, true, false);
break;
}

i += 1;
}
}
}
}
return removedItem;
/* NOP */;
}
public final function GetAlcoholForAlchemicalItemsRefill() : SItemUnique
Id{
var alcos : array<SItemUniqueId>;
var id : SItemUniqueId;
var i : Int32;
var price : Int32;
var minPrice : Int32;
alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO
);
if (alcos.Size() > 0){
minPrice = inv.GetItemPrice(alcos[0]);
price = minPrice;
id = alcos[0];
i = 1;
while (i < alcos.Size()){
price = inv.GetItemPrice(alcos[i]);
if (price < minPrice){
minPrice = price;
id = alcos[i];
}
i += 1;
}
return id;
}
return GetInvalidUniqueId();
/* NOP */;
}
public final function ClearPreviouslyUsedBolt(){
previouslyUsedBolt = GetInvalidUniqueId();
/* NOP */;
}
public final function AddAndEquipInfiniteBolt(forceBodkin : Bool, forceH
arpoon : Bool){
var bolt : array<SItemUniqueId>;
var bodkins : array<SItemUniqueId>;
var harpoons : array<SItemUniqueId>;
var boltItemName : CName;
var i : Int32;
bodkins = inv.GetItemsByName('Bodkin Bolt');
harpoons = inv.GetItemsByName('Harpoon Bolt');
i = bodkins.Size() - 1;
while (i >= 0){
inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i
]));
i -= 1;
}
i = harpoons.Size() - 1;
while (i >= 0){
inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons
[i]));
i -= 1;
}

if (!forceBodkin && forceHarpoon || GetCurrentStateName() == 'Sw


imming' || IsSwimming() || IsDiving()){
boltItemName = 'Harpoon Bolt';
} else {
boltItemName = 'Bodkin Bolt';
}
if (boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUse
dBolt)){
bolt.PushBack(previouslyUsedBolt);
} else {
bolt = inv.AddAnItem(boltItemName, 1, true, true, /* NOP
*/);
if (boltItemName == 'Harpoon Bolt'){
GetItemEquippedOnSlot(17, previouslyUsedBolt);
}
}
EquipItem(bolt[0], 17, /* NOP */);
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
var m_guiManager : CR4GuiManager;
super.OnItemGiven(data);
if (!inv){
inv = GetInventory();
}
if (inv.IsItemEncumbranceItem(data.ids[0])){
UpdateEncumbrance();
}
m_guiManager = theGame.GetGuiManager();
if (m_guiManager){
m_guiManager.RegisterNewItem(data.ids[0]);
}
/* NOP */;
}
public final function CheckForFullyArmedAchievement(){
if (HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasA
llItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) || HasAllItemsFromSet(theGam
e.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WO
LF)){
theGame.GetGamerProfile().AddAchievement(50);
}
/* NOP */;
}
public final function HasAllItemsFromSet(setItemTag : CName) : Bool{
var item : SItemUniqueId;
if (!GetItemEquippedOnSlot(2, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;
}
if (!GetItemEquippedOnSlot(1, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;
}
if (!GetItemEquippedOnSlot(4, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;
}
if (!GetItemEquippedOnSlot(5, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;

}
if (!GetItemEquippedOnSlot(6, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;
}
if (!GetItemEquippedOnSlot(3, item) || !inv.ItemHasTag(item, set
ItemTag)){
return false;
}
if (setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag
== theGame.params.ITEM_SET_TAG_LYNX){
if (!GetItemEquippedOnSlot(9, item) || !inv.ItemHasTag(i
tem, setItemTag)){
return false;
}
}
return true;
/* NOP */;
}
public function GetTotalArmor() : SAbilityAttributeValue{
var armor : SAbilityAttributeValue;
var armorItem : SItemUniqueId;
armor = super.GetTotalArmor();
if (GetItemEquippedOnSlot(3, armorItem)){
armor -= inv.GetItemAttributeValue(armorItem, theGame.pa
rams.ARMOR_VALUE_NAME, /* NOP */, /* NOP */);
armor += inv.GetItemArmorTotal(armorItem);
}
if (GetItemEquippedOnSlot(5, armorItem)){
armor -= inv.GetItemAttributeValue(armorItem, theGame.pa
rams.ARMOR_VALUE_NAME, /* NOP */, /* NOP */);
armor += inv.GetItemArmorTotal(armorItem);
}
if (GetItemEquippedOnSlot(4, armorItem)){
armor -= inv.GetItemAttributeValue(armorItem, theGame.pa
rams.ARMOR_VALUE_NAME, /* NOP */, /* NOP */);
armor += inv.GetItemArmorTotal(armorItem);
}
if (GetItemEquippedOnSlot(6, armorItem)){
armor -= inv.GetItemAttributeValue(armorItem, theGame.pa
rams.ARMOR_VALUE_NAME, /* NOP */, /* NOP */);
armor += inv.GetItemArmorTotal(armorItem);
}
return armor;
/* NOP */;
}
public function ReduceArmorDurability() : EEquipmentSlots{
var r : Int32;
var sum : Int32;
var slot : EEquipmentSlots;
var id : SItemUniqueId;
var prevDurMult : Float;
var currDurMult : Float;
var ratio : Float;
sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
r = RandRange(sum, /* NOP */);

if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT){
slot = 3;
} else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + th
eGame.params.DURABILITY_ARMOR_PANTS_WEIGHT){
slot = 5;
} else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + th
eGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLO
VES_WEIGHT){
slot = 6;
} else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + th
eGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLO
VES_WEIGHT + theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT){
slot = 4;
} else {
return 0;
}
GetItemEquippedOnSlot(slot, id);
ratio = inv.GetItemDurabilityRatio(id);
if (inv.ReduceItemDurability(id, /* NOP */)){
prevDurMult = theGame.params.GetDurabilityMultiplier(rat
io, false);
ratio = inv.GetItemDurabilityRatio(id);
currDurMult = theGame.params.GetDurabilityMultiplier(rat
io, false);
if (currDurMult != prevDurMult){
}
return slot;
}
return 0;
/* NOP */;
}
public function DismantleItem(dismantledItem : SItemUniqueId, toolItem :
SItemUniqueId) : Bool{
var parts : array<SItemParts>;
var i : Int32;
if (!inv.IsItemDismantleKit(toolItem)){
return false;
}
parts = inv.GetItemRecyclingParts(dismantledItem);
if (parts.Size() <= 0){
return false;
}
i = 0;
while (i < parts.Size()){
inv.AddAnItem(parts[i].itemName, parts[i].quantity, true
, false, /* NOP */);
i += 1;
}
inv.RemoveItem(toolItem, /* NOP */);
inv.RemoveItem(dismantledItem, /* NOP */);
return true;
/* NOP */;
}
public function GetItemEquippedOnSlot(slot : EEquipmentSlots, item : SIt
emUniqueId) : Bool{
if (slot == 0 || slot < 0 || slot > EnumGetMax('EEquipmentSlots'
)){
return false;
}
item = itemSlots[slot];

return inv.IsIdValid(item);
/* NOP */;
}
public function GetItemSlotByItemName(itemName : CName) : EEquipmentSlot
s{
var ids : array<SItemUniqueId>;
var i : Int32;
var slot : EEquipmentSlots;
ids = inv.GetItemsByName(itemName);
i = 0;
while (i < ids.Size()){
slot = GetItemSlot(ids[i]);
if (slot != 0){
return slot;
}
i += 1;
}
return 0;
/* NOP */;
}
public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots{
var i : Int32;
if (!inv.IsIdValid(item)){
return 0;
}
i = 0;
while (i < itemSlots.Size()){
if (itemSlots[i] == item){
return i;
}
i += 1;
}
return 0;
/* NOP */;
}
public function GetEquippedItems() : array<SItemUniqueId>{
return itemSlots;
/* NOP */;
}
public function IsItemEquipped(item : SItemUniqueId) : Bool{
if (!inv.IsIdValid(item)){
return false;
}
return itemSlots.Contains(item);
/* NOP */;
}
public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : Bool{
if (slot == 0 || slot < 0 || slot > EnumGetMax('EEquipmentSlots'
)){
return false;
}
return inv.IsIdValid(itemSlots[slot]);
/* NOP */;
}
public function GetFreeQuickslot() : EEquipmentSlots{
if (!inv.IsIdValid(itemSlots[10])){
return 10;
}
if (!inv.IsIdValid(itemSlots[11])){
return 11;

}
return 0;
/* NOP */;
}
public function OnEquipItemRequested(item : SItemUniqueId, ignoreMount :
Bool) : Bool{
var slot : EEquipmentSlots;
if (inv.IsIdValid(item)){
slot = inv.GetSlotForItemId(item);
if (slot != 0){
EquipItemInGivenSlot(item, slot, ignoreMount, /*
NOP */);
}
}
/* NOP */;
}
public function OnUnequipItemRequested(item : SItemUniqueId) : Bool{
UnequipItem(item);
/* NOP */;
}
public function EquipItem(item : SItemUniqueId, slot : EEquipmentSlots,
toHand : Bool) : Bool{
if (!inv.IsIdValid(item)){
return false;
}
if (slot == 0){
slot = inv.GetSlotForItemId(item);
if (slot == 0){
return false;
}
}
return EquipItemInGivenSlot(item, slot, false, toHand);
/* NOP */;
}
protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqu
eId, category : CName) : Bool{
return !IsSlotPotionMutagen(slot) && category != 'usable' && cat
egory != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwear
able');
/* NOP */;
}
protected function ShouldMountItemWithName(itemName : CName) : Bool{
var slot : EEquipmentSlots;
var items : array<SItemUniqueId>;
var category : CName;
var i : Int32;
items = inv.GetItemsByName(itemName);
category = inv.GetItemCategory(items[0]);
slot = GetItemSlot(items[0]);
return ShouldMount(slot, items[0], category);
/* NOP */;
}
public function GetMountableItems(items : array<CName>){
var i : Int32;
var mountable : Bool;
var mountableItems : array<CName>;
i = 0;
while (i < items.Size()){
mountable = ShouldMountItemWithName(items[i]);
if (mountable){

mountableItems.PushBack(items[i]);
}
i += 1;
}
items = mountableItems;
/* NOP */;
}
public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 :
EEquipmentSlots){
var temp : SItemUniqueId;
var pam : W3PlayerAbilityManager;
temp = itemSlots[slot1];
itemSlots[slot1] = itemSlots[slot2];
itemSlots[slot2] = temp;
if (IsSlotSkillMutagen(slot1)){
pam = (W3PlayerAbilityManager)abilityManager;
if (pam){
pam.OnSwappedMutagensPost(itemSlots[slot1], item
Slots[slot2]);
}
}
/* NOP */;
}
public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquip
mentSlots, ignoreMounting : Bool, toHand : Bool) : Bool{
var i : Int32;
var groupID : Int32;
var fistsID : array<SItemUniqueId>;
var pam : W3PlayerAbilityManager;
var isSkillMutagen : Bool;
var armorEntity : CItemEntity;
var armorMeshComponent : CComponent;
var armorSoundIdentification : CName;
var category : CName;
var prevSkillColor : ESkillColor;
var containedAbilities : array<CName>;
var dm : CDefinitionsManagerAccessor;
var armorType : EArmorType;
var otherMask : SItemUniqueId;
var previousItemInSlot : SItemUniqueId;
var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
var tutStateFood : W3TutorialManagerUIHandlerStateFood;
var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateS
econdPotionEquip;
var boltItem : SItemUniqueId;
if (!inv.IsIdValid(item)){
LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot:
invalid item");
return false;
}
if (slot == 0 || slot == 26 || slot == 27 || slot == 28 || slot
== 29){
LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equi
p item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is inv
alid");
return false;
}
if (itemSlots[slot] == item){
return true;
}

if (inv.GetItemLevel(item) > GetLevel()){


return false;
}
previousItemInSlot = itemSlots[slot];
if (IsItemEquipped(item)){
super.SwapEquippedItems(slot, GetItemSlot(item));
return true;
}
isSkillMutagen = IsSlotSkillMutagen(slot);
if (isSkillMutagen){
pam = (W3PlayerAbilityManager)abilityManager;
if (!pam.IsSkillMutagenSlotUnlocked(slot)){
return false;
}
}
if (inv.IsIdValid(previousItemInSlot)){
if (!UnequipItemFromSlot(slot, true)){
LogAssert(false, "W3PlayerWitcher.EquipItem: Can
not equip item <<" + inv.GetItemName(item) + ">> !!");
return false;
}
}
if (inv.IsItemMask(item)){
if (slot == 10){
GetItemEquippedOnSlot(11, otherMask);
} else {
GetItemEquippedOnSlot(10, otherMask);
}
if (inv.IsItemMask(otherMask)){
UnequipItem(otherMask);
}
}
if (isSkillMutagen){
groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
prevSkillColor = pam.GetSkillGroupColor(groupID);
}
itemSlots[slot] = item;
category = inv.GetItemCategory(item);
if (!ignoreMounting && ShouldMount(slot, item, category)){
inv.MountItem(item, toHand, IsSlotSkillMutagen(slot));
}
theTelemetry.LogWithLabelAndValue(29, inv.GetItemName(item), slo
t);
if (slot == 9){
rangedWeapon = (Crossbow)inv.GetItemEntityUnsafe(item);
if (!rangedWeapon){
AddTimer('DelayedOnItemMount', 0.100000, true, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (IsSwimming() || IsDiving()){
GetItemEquippedOnSlot(17, boltItem);
if (inv.IsIdValid(boltItem)){
if (!inv.ItemHasTag(boltItem, 'Underwate
rAmmo')){
super.AddAndEquipInfiniteBolt(fa
lse, true);
}
} else if (!IsAnyItemEquippedOnSlot(17)){
super.AddAndEquipInfiniteBolt(false, tru
e);

}
} else if (!IsAnyItemEquippedOnSlot(17)){
super.AddAndEquipInfiniteBolt(/* NOP */, /* NOP
*/);
}
} else if (slot == 17){
if (rangedWeapon){
if (!IsSwimming() || !IsDiving()){
rangedWeapon.OnReplaceAmmo();
rangedWeapon.OnWeaponReload();
} else {
DisplayHudMessage(GetLocStringByKeyExt("
menu_cannot_perform_action_now"));
}
}
} else if (isSkillMutagen){
pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">
> equipped to slot <<" + slot + ">>");
LogSkillColors("Group bonus color is now <<" + pam.GetSk
illGroupColor(groupID) + ">>");
LogSkillColors("");
}
if (inv.ItemHasAbility(item, 'MA_HtH')){
inv.GetItemContainedAbilities(item, containedAbilities);
fistsID = inv.GetItemsByName('fists');
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < containedAbilities.Size()){
if (dm.AbilityHasTag(containedAbilities[i], 'MA_
HtH')){
inv.AddItemCraftedAbility(fistsID[0], co
ntainedAbilities[i], true);
}
i += 1;
}
}
if (inv.IsItemAnyArmor(item)){
armorType = inv.GetArmorType(item);
pam = (W3PlayerAbilityManager)abilityManager;
if (armorType == 1){
if (CanUseSkill(84)){
pam.UpdatePerkArmorBonus(84, true, /* NO
P */);
}
} else if (armorType == 2){
if (CanUseSkill(85)){
pam.UpdatePerkArmorBonus(85, true, /* NO
P */);
}
} else if (armorType == 3){
if (CanUseSkill(86)){
pam.UpdatePerkArmorBonus(86, true, /* NO
P */);
}
}
}
theGame.GetGlobalEventsManager().OnScriptedEvent(2, /* NOP */, /
* NOP */);
if (ShouldProcessTutorial('TutorialPotionCanEquip3')){

if (slot == 14 || slot == 15){


tutStatePot = (W3TutorialManagerUIHandlerStatePo
tions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStatePot){
tutStatePot.OnPotionEquipped(inv.GetItem
Name(item));
}
tutStateSecondPotionEquip = (W3TutorialManagerUI
HandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentSt
ate();
if (tutStateSecondPotionEquip){
tutStateSecondPotionEquip.OnPotionEquipp
ed(inv.GetItemName(item));
}
}
}
if (ShouldProcessTutorial('TutorialFoodSelectTab')){
if (slot == 14 || slot == 15 && inv.IsItemFood(item)){
tutStateFood = (W3TutorialManagerUIHandlerStateF
ood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
if (tutStateFood){
tutStateFood.OnFoodEquipped();
}
}
}
if (inv.IsItemSetItem(item)){
super.CheckForFullyArmedAchievement();
}
return true;
/* NOP */;
}
private function CheckHairItem(){
var ids : array<SItemUniqueId>;
var i : Int32;
var itemName : CName;
var hairApplied : Bool;
ids = inv.GetItemsByCategory('hair');
i = 0;
while (i < ids.Size()){
itemName = inv.GetItemName(ids[i]);
if (itemName != 'Preview Hair'){
if (hairApplied == false){
inv.MountItem(ids[i], false, /* NOP */);
hairApplied = true;
} else {
inv.RemoveItem(ids[i], 1);
}
}
i += 1;
}
if (hairApplied == false){
ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true,
false, /* NOP */);
inv.MountItem(ids[0], false, /* NOP */);
}
/* NOP */;
}
public timer function DelayedOnItemMount(optional dt : Float, optional i
d : Int32){
var crossbowID : SItemUniqueId;

var invent : CInventoryComponent;


invent = GetInventory();
if (!invent){
return;
}
GetItemEquippedOnSlot(9, crossbowID);
if (invent.IsIdValid(crossbowID)){
rangedWeapon = (Crossbow)invent.GetItemEntityUnsafe(cros
sbowID);
if (rangedWeapon){
RemoveTimer('DelayedOnItemMount', /* NOP */);
}
} else {
RemoveTimer('DelayedOnItemMount', /* NOP */);
}
/* NOP */;
}
public function GetHeldItems() : array<SItemUniqueId>{
var items : array<SItemUniqueId>;
var item : SItemUniqueId;
if (inv.GetItemEquippedOnSlot(1, item) && inv.IsItemHeld(item)){
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(2, item) && inv.IsItemHeld(item)){
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(9, item) && inv.IsItemHeld(item)){
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(10, item) && inv.IsItemHeld(item))
{
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(11, item) && inv.IsItemHeld(item))
{
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(7, item) && inv.IsItemHeld(item)){
items.PushBack(item);
}
if (inv.GetItemEquippedOnSlot(8, item) && inv.IsItemHeld(item)){
items.PushBack(item);
}
return items;
/* NOP */;
}
public function UnequipItemFromSlot(slot : EEquipmentSlots, reequipped :
Bool) : Bool{
var item : SItemUniqueId;
var bolts : SItemUniqueId;
var items : array<SItemUniqueId>;
var retBool : Bool;
var fistsID : array<SItemUniqueId>;
var bolt : array<SItemUniqueId>;
var i : Int32;
var groupID : Int32;
var pam : W3PlayerAbilityManager;
var prevSkillColor : ESkillColor;
var containedAbilities : array<CName>;
var dm : CDefinitionsManagerAccessor;

var armorType : EArmorType;


var isSwimming : Bool;
var hud : CR4ScriptedHud;
var damagedItemModule : CR4HudModuleDamagedItems;
if (slot == 0 || slot < 0 || slot > EnumGetMax('EEquipmentSlots'
) || !inv.IsIdValid(itemSlots[slot])){
return false;
}
if (IsSlotSkillMutagen(slot)){
pam = (W3PlayerAbilityManager)abilityManager;
groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
prevSkillColor = pam.GetSkillGroupColor(groupID);
}
item = itemSlots[slot];
itemSlots[slot] = GetInvalidUniqueId();
if (slot == 9){
OnRangedForceHolster(true, true, /* NOP */);
rangedWeapon.ClearDeployedEntity(true);
rangedWeapon = NULL;
if (GetItemEquippedOnSlot(17, bolts)){
if (inv.ItemHasTag(bolts, theGame.params.TAG_INF
INITE_AMMO)){
inv.RemoveItem(bolts, inv.GetItemQuantit
y(bolts));
}
}
} else if (IsSlotSkillMutagen(slot)){
pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor)
;
LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">
> unequipped from slot <<" + slot + ">>");
LogSkillColors("Group bonus color is now <<" + pam.GetSk
illGroupColor(groupID) + ">>");
LogSkillColors("");
}
if (currentlyEquipedItem == item){
currentlyEquipedItem = GetInvalidUniqueId();
RaiseEvent('ForcedUsableItemUnequip');
}
if (currentlyEquipedItemL == item){
if (currentlyUsedItemL){
currentlyUsedItemL.OnHidden(this);
}
HideUsableItem(true);
}
if (!IsSlotPotionMutagen(slot)){
GetInventory().UnmountItem(item, true);
}
retBool = true;
if (IsAnyItemEquippedOnSlot(9) && slot == 17){
if (inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMM
O)){
inv.RemoveItem(item, inv.GetItemQuantityByName(i
nv.GetItemName(item), /* NOP */));
} else if (!reequipped){
super.AddAndEquipInfiniteBolt(/* NOP */, /* NOP
*/);
}
}
if (slot == 1 || slot == 2){

OnEquipMeleeWeapon(0, true, /* NOP */);


}
if (GetSelectedItemId() == item){
ClearSelectedItemId();
}
if (inv.IsItemBody(item)){
retBool = true;
}
if (retBool && !reequipped){
theTelemetry.LogWithLabelAndValue(30, inv.GetItemName(it
em), slot);
if (slot == 2 && !IsAnyItemEquippedOnSlot(1)){
RemoveBuff(112, /* NOP */, /* NOP */);
} else if (slot == 1 && !IsAnyItemEquippedOnSlot(2)){
RemoveBuff(112, /* NOP */, /* NOP */);
} else if (inv.IsItemAnyArmor(item)){
if (!IsAnyItemEquippedOnSlot(3) && !IsAnyItemEqu
ippedOnSlot(6) && !IsAnyItemEquippedOnSlot(4) && !IsAnyItemEquippedOnSlot(5)){
RemoveBuff(111, /* NOP */, /* NOP */);
}
}
}
if (inv.ItemHasAbility(item, 'MA_HtH')){
inv.GetItemContainedAbilities(item, containedAbilities);
fistsID = inv.GetItemsByName('fists');
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < containedAbilities.Size()){
if (dm.AbilityHasTag(containedAbilities[i], 'MA_
HtH')){
inv.RemoveItemCraftedAbility(fistsID[0],
containedAbilities[i]);
}
i += 1;
}
}
if (inv.IsItemAnyArmor(item)){
armorType = inv.GetArmorType(item);
pam = (W3PlayerAbilityManager)abilityManager;
if (armorType == 1){
if (CanUseSkill(84)){
pam.UpdatePerkArmorBonus(84, false, /* N
OP */);
}
} else if (armorType == 2){
if (CanUseSkill(85)){
pam.UpdatePerkArmorBonus(85, false, /* N
OP */);
}
} else if (armorType == 3){
if (CanUseSkill(86)){
pam.UpdatePerkArmorBonus(86, false, /* N
OP */);
}
}
}
hud = (CR4ScriptedHud)theGame.GetHud();
damagedItemModule = hud.GetDamagedItemModule();
damagedItemModule.OnItemUnequippedFromSlot(slot);
theGame.GetGlobalEventsManager().OnScriptedEvent(2, /* NOP */, /

* NOP */);
return retBool;
/* NOP */;
}
public function UnequipItem(item : SItemUniqueId) : Bool{
if (!inv.IsIdValid(item)){
return false;
}
return UnequipItemFromSlot(itemSlots.FindFirst(item), /* NOP */)
;
/* NOP */;
}
public function DropItem(item : SItemUniqueId, quantity : Int32) : Bool{
if (!inv.IsIdValid(item)){
return false;
}
if (IsItemEquipped(item)){
return UnequipItem(item);
}
return true;
/* NOP */;
}
public function IsItemEquippedByName(itemName : CName) : Bool{
var i : Int32;
i = 0;
while (i < itemSlots.Size()){
if (inv.GetItemName(itemSlots[i]) == itemName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function IsItemEquippedByCategoryName(categoryName : CName) : Boo
l{
var i : Int32;
i = 0;
while (i < itemSlots.Size()){
if (inv.GetItemCategory(itemSlots[i]) == categoryName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetMaxRunEncumbrance(usesHorseBonus : Bool) : Float{
var value : Float;
value = CalculateAttributeValue(GetHorseManager().GetHorseAttrib
uteValue('encumbrance', false), /* NOP */);
usesHorseBonus = value > 0;
value += CalculateAttributeValue(GetAttributeValue('encumbrance'
, /* NOP */, /* NOP */), /* NOP */);
return value;
/* NOP */;
}
public function GetEncumbrance() : Float{
var i : Int32;
var encumbrance : Float;

var items : array<SItemUniqueId>;


var inve : CInventoryComponent;
inve = GetInventory();
inve.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (inv.IsItemEncumbranceItem(items[i])){
encumbrance += inve.GetItemEncumbrance(items[i])
;
}
i += 1;
}
return encumbrance;
/* NOP */;
}
public function UpdateEncumbrance(){
var temp : Bool;
if (GetEncumbrance() >= GetMaxRunEncumbrance(temp) + 1){
if (!HasBuff(39)){
AddEffectDefault(39, NULL, "OverEncumbered", /*
NOP */);
}
} else if (HasBuff(39)){
RemoveAllBuffsOfType(39);
}
/* NOP */;
}
public final function GetSkillGroupIDFromIndex(idx : Int32) : Int32{
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam && pam.IsInitialized()){
return pam.GetSkillGroupIDFromIndex(idx);
}
return -1;
/* NOP */;
}
public final function GetSkillGroupColor(groupID : Int32) : ESkillColor{
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam && pam.IsInitialized()){
return pam.GetSkillGroupColor(groupID);
}
return 0;
/* NOP */;
}
public final function GetSkillGroupsCount() : Int32{
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam && pam.IsInitialized()){
return pam.GetSkillGroupsCount();
}
return 0;
/* NOP */;
}
public function CycleSelectSign(bIsCyclingLeft : Bool) : ESignType{
var signOrder : array<ESignType>;
var i : Int32;
signOrder.PushBack(1);
signOrder.PushBack(3);
signOrder.PushBack(2);

signOrder.PushBack(4);
signOrder.PushBack(0);
i = 0;
while (i < signOrder.Size()){
if (signOrder[i] == equippedSign){
break;
}
i += 1;
}
if (bIsCyclingLeft){
return signOrder[4 + i % 5];
} else {
return signOrder[6 + i % 5];
}
/* NOP */;
}
public function ToggleNextSign(){
SetEquippedSign(CycleSelectSign(false));
FactsAdd("SignToggled", 1, 1);
/* NOP */;
}
public function TogglePreviousSign(){
SetEquippedSign(CycleSelectSign(true));
FactsAdd("SignToggled", 1, 1);
/* NOP */;
}
public function ProcessSignEvent(eventName : CName) : Bool{
if (currentlyCastSign != 5 && signs[currentlyCastSign].entity){
return signs[currentlyCastSign].entity.OnProcessSignEven
t(eventName);
}
return false;
/* NOP */;
}
public function OnProcessCastingOrientation(isContinueCasting : Bool) :
Bool{
var customOrientationTarget : EOrientationTarget;
var checkHeading : Float;
var rotHeading : Float;
var playerToHeadingDist : Float;
var slideTargetActor : CActor;
var newLockTarget : CActor;
var enableNoTargetOrientation : Bool;
var currTime : Float;
enableNoTargetOrientation = true;
if (GetDisplayTarget() && IsDisplayTargetTargetable()){
enableNoTargetOrientation = false;
if (theInput.GetActionValue('CastSignHold') > 0 || IsCur
rentSignChanneled()){
if (IsPCModeEnabled()){
if (EngineTimeToFloat(theGame.GetEngineT
ime()) > pcModeChanneledSignTimeStamp + 1.000000){
enableNoTargetOrientation = true
;
}
} else if (GetCurrentlyCastSign() == 2 || GetCur
rentlyCastSign() == 4){
slideTargetActor = (CActor)GetDisplayTar
get();
if (slideTargetActor && !slideTargetActo

r.GetGameplayVisibility() || !CanBeTargetedIfSwimming(slideTargetActor, /* NOP *


/) || !slideTargetActor.IsAlive()){
SetSlideTarget(NULL);
if (ProcessLockTarget(/* NOP */,
/* NOP */)){
slideTargetActor = (CAct
or)slideTarget;
}
}
if (!slideTargetActor){
LockToTarget(false);
enableNoTargetOrientation = true
;
} else if (IsThreat(slideTargetActor, /*
NOP */) || GetCurrentlyCastSign() == 4){
LockToTarget(true);
} else {
LockToTarget(false);
enableNoTargetOrientation = true
;
}
}
}
if (!enableNoTargetOrientation){
customOrientationTarget = 1;
}
}
if (enableNoTargetOrientation){
if (GetPlayerCombatStance() == 1 && theInput.GetActionVa
lue('CastSignHold') > 0){
if (GetDisplayTarget() && !slideTargetActor){
currTime = EngineTimeToFloat(theGame.Get
EngineTime());
if (currTime > findActorTargetTimeStamp
+ 1.500000){
findActorTargetTimeStamp = currT
ime;
newLockTarget = GetScreenSpaceLo
ckTarget(GetDisplayTarget(), 180.000000, 1.000000, 0.000000, true);
if (newLockTarget && IsThreat(ne
wLockTarget, /* NOP */) && IsCombatMusicEnabled()){
SetTarget(newLockTarget,
true);
SetMoveTargetChangeAllow
ed(true);
SetMoveTarget(newLockTar
get);
SetMoveTargetChangeAllow
ed(false);
SetSlideTarget(newLockTa
rget);
}
}
} else {
ProcessLockTarget(/* NOP */, /* NOP */);
}
}
if (wasBRAxisPushed){
customOrientationTarget = 4;
} else if (!lastAxisInputIsMovement || theInput.LastUsed

PCInput()){
customOrientationTarget = 4;
} else if (theInput.GetActionValue('CastSignHold') > 0){
if (GetOrientationTarget() == 4){
customOrientationTarget = 4;
} else if (GetPlayerCombatStance() == 1 || GetPl
ayerCombatStance() == 3){
customOrientationTarget = 4;
} else {
customOrientationTarget = 0;
}
} else {
customOrientationTarget = 2;
}
}
if (GetCurrentlyCastSign() == 3){
if (theInput.LastUsedPCInput()){
customOrientationTarget = 3;
} else if (IsCurrentSignChanneled()){
if (bLAxisReleased){
customOrientationTarget = 0;
} else {
customOrientationTarget = 3;
}
} else {
customOrientationTarget = 0;
}
}
if (GetCurrentlyCastSign() == 4 && IsCurrentSignChanneled()){
if (slideTarget && (CActor)slideTarget){
checkHeading = VecHeading(slideTarget.GetWorldPo
sition() - GetWorldPosition());
rotHeading = checkHeading;
playerToHeadingDist = AngleDistance(GetHeading()
, checkHeading);
if (playerToHeadingDist > 45){
SetCustomRotation('ChanneledSignAxii', r
otHeading, 0.000000, 0.500000, false);
} else if (playerToHeadingDist < -45){
SetCustomRotation('ChanneledSignAxii', r
otHeading, 0.000000, 0.500000, false);
}
} else {
checkHeading = VecHeading(theCamera.GetCameraDir
ection());
rotHeading = GetHeading();
playerToHeadingDist = AngleDistance(GetHeading()
, checkHeading);
if (playerToHeadingDist > 45){
SetCustomRotation('ChanneledSignAxii', r
otHeading - 22.500000, 0.000000, 0.500000, false);
} else if (playerToHeadingDist < -45){
SetCustomRotation('ChanneledSignAxii', r
otHeading + 22.500000, 0.000000, 0.500000, false);
}
}
}
if (IsActorLockedToTarget()){
customOrientationTarget = 1;
}

AddCustomOrientationTarget(customOrientationTarget, 'Signs');
if (customOrientationTarget == 2){
SetOrientationTargetCustomHeading(GetCombatActionHeading
(), 'Signs');
}
/* NOP */;
}
public function OnRaiseSignEvent() : Bool{
var newTarget : CActor;
if (!thePlayer.IsCombatMusicEnabled() && !thePlayer.CanAttackWhe
nNotInCombat(3, false, newTarget, /* NOP */) || thePlayer.IsOnBoat() && !thePlay
er.IsCombatMusicEnabled()){
if (CastSignFriendly()){
return true;
}
} else {
RaiseEvent('CombatActionFriendlyEnd');
SetBehaviorVariable('SignNum', equippedSign, /* NOP */);
SetBehaviorVariable('combatActionType', 6, /* NOP */);
if (IsPCModeEnabled()){
pcModeChanneledSignTimeStamp = EngineTimeToFloat
(theGame.GetEngineTime());
}
if (RaiseForceEvent('CombatAction')){
OnCombatActionStart();
findActorTargetTimeStamp = EngineTimeToFloat(the
Game.GetEngineTime());
theTelemetry.LogWithValueStr(22, SignEnumToStrin
g(equippedSign));
return true;
}
}
return false;
/* NOP */;
}
public function CastSignFriendly() : Bool{
var actor : CActor;
SetBehaviorVariable('combatActionTypeForOverlay', 6, /* NOP */);
if (RaiseCombatActionFriendlyEvent()){
return true;
}
return false;
/* NOP */;
}
public function CastSign() : Bool{
var equippedSignStr : String;
var newSignEnt : W3SignEntity;
var spawnPos : Vector;
var slotMatrix : Matrix;
if (IsInAir()){
return false;
}
AddTemporarySkills();
if (equippedSign == 0){
CalcEntitySlotMatrix('l_weapon', slotMatrix);
spawnPos = MatrixGetTranslation(slotMatrix);
} else {
spawnPos = GetWorldPosition();
}
newSignEnt = (W3SignEntity)theGame.CreateEntity(signs[equippedSi

gn].template, spawnPos, GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /*


NOP */, /* NOP */);
return newSignEnt.Init(signOwner, signs[equippedSign].entity, /*
NOP */);
/* NOP */;
}
private function HAX_SignToThrowItemRestore(){
var action : SInputAction;
action.value = theInput.GetActionValue('ThrowItemHold');
action.lastFrameValue = 0;
if (IsPressed(action, /* NOP */) && CanSetupCombatAction_Throw()
){
if (inv.IsItemBomb(selectedItemId)){
BombThrowStart();
} else {
UsableItemStart();
}
SetThrowHold(true);
}
/* NOP */;
}
public function OnCFMCameraZoomFail() : Bool{
}
public final function GetDrunkMutagens() : array<CBaseGameplayEffect>{
return effectManager.GetDrunkMutagens();
/* NOP */;
}
public final function GetPotionBuffs() : array<CBaseGameplayEffect>{
return effectManager.GetPotionBuffs();
/* NOP */;
}
public final function RecalcPotionsDurations(){
var i : Int32;
var buffs : array<CBaseGameplayEffect>;
buffs = GetPotionBuffs();
i = 0;
while (i < buffs.Size()){
buffs[i].RecalcPotionDuration();
i += 1;
}
/* NOP */;
}
public function StartFrenzy(){
var ratio : Float;
var duration : Float;
var skillLevel : Int32;
isInFrenzy = true;
skillLevel = GetSkillLevel(73);
ratio = 0.480000 - skillLevel * CalculateAttributeValue(GetSkill
AttributeValue(73, 'slowdown_ratio', false, true), /* NOP */);
duration = skillLevel * CalculateAttributeValue(GetSkillAttribut
eValue(73, 'slowdown_duration', false, true), /* NOP */);
theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(9), theGa
me.GetTimescalePriority(9), /* NOP */, /* NOP */);
AddTimer('SkillFrenzyFinish', duration * ratio, /* NOP */, /* NO
P */, /* NOP */, true, /* NOP */);
/* NOP */;
}
public timer function SkillFrenzyFinish(optional dt : Float, optional id
: Int32){

theGame.RemoveTimeScale(theGame.GetTimescaleSource(9));
isInFrenzy = false;
/* NOP */;
}
public function GetToxicityDamageThreshold() : Float{
var ret : Float;
ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
if (CanUseSkill(58)){
ret += CalculateAttributeValue(GetSkillAttributeValue(58
, 'threshold', false, true), /* NOP */) * GetSkillLevel(58);
}
return ret;
/* NOP */;
}
public final function AddToxicityOffset(val : Float){
(W3PlayerAbilityManager)abilityManager.AddToxicityOffset(val);
if (CanUseSkill(70)){
AddAbilityMultiple(GetSkillAbilityName(70), GetSkillLeve
l(70));
}
/* NOP */;
}
public final function RemoveToxicityOffset(val : Float){
(W3PlayerAbilityManager)abilityManager.RemoveToxicityOffset(val)
;
if (CanUseSkill(70)){
RemoveAbilityMultiple(GetSkillAbilityName(70), GetSkillL
evel(70));
}
/* NOP */;
}
public final function CalculatePotionDuration(item : SItemUniqueId, isMu
tagenPotion : Bool, itemName : CName) : Float{
var duration : Float;
var skillPassiveMod : Float;
var mutagenSkillMod : Float;
var val : SAbilityAttributeValue;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
if (inv.IsIdValid(item)){
duration = CalculateAttributeValue(inv.GetItemAttributeV
alue(item, 'duration', /* NOP */, /* NOP */), /* NOP */);
} else {
theGame.GetDefinitionsManager().GetItemAttributeValueNoR
andom(itemName, true, 'duration', min, max);
duration = CalculateAttributeValue(GetAttributeRandomize
dValue(min, max), /* NOP */);
}
skillPassiveMod = CalculateAttributeValue(GetAttributeValue('pot
ion_duration', /* NOP */, /* NOP */), /* NOP */);
if (isMutagenPotion && CanUseSkill(71)){
val = GetSkillAttributeValue(71, 'duration', false, true
);
mutagenSkillMod = val.valueMultiplicative * GetSkillLeve
l(71);
}
duration = duration * 1 + skillPassiveMod + mutagenSkillMod;
return duration;
/* NOP */;
}

public function ToxicityLowEnoughToDrinkPotion(slotid : EEquipmentSlots,


itemId : SItemUniqueId) : Bool{
var item : SItemUniqueId;
var maxTox : Float;
var potionToxicity : Float;
var toxicityOffset : Float;
var effectType : EEffectType;
var customAbilityName : CName;
if (itemId != GetInvalidUniqueId()){
item = itemId;
} else {
item = itemSlots[slotid];
}
inv.GetPotionItemBuffData(item, effectType, customAbilityName);
maxTox = abilityManager.GetStatMax(3);
potionToxicity = CalculateAttributeValue(inv.GetItemAttributeVal
ue(item, 'toxicity', /* NOP */, /* NOP */), /* NOP */);
toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeVal
ue(item, 'toxicity_offset', /* NOP */, /* NOP */), /* NOP */);
if (effectType != 33){
if (abilityManager.GetStat(3, false) + potionToxicity +
toxicityOffset > maxTox){
return false;
}
}
return true;
/* NOP */;
}
public function DrinkPreparedPotion(slotid : EEquipmentSlots, itemId : S
ItemUniqueId){
var i : Int32;
var ind : Int32;
var toxicityOffset : Float;
var potionToxicity : Float;
var duration : Float;
var hpGainValue : Float;
var maxTox : Float;
var randomPotions : array<EEffectType>;
var effectType : EEffectType;
var customAbilityName : CName;
var factId : CName;
var ret : EEffectInteract;
var atts : array<CName>;
var effectsOld : array<CBaseGameplayEffect>;
var effectsNew : array<CBaseGameplayEffect>;
var factPotionParams : W3Potion_Fact_Params;
var potParams : W3PotionParams;
var mutagenParams : W3MutagenBuffCustomParams;
var item : SItemUniqueId;
var params : SCustomEffectParams;
var potionParams : SCustomEffectParams;
if (itemId != GetInvalidUniqueId()){
item = itemId;
} else {
item = itemSlots[slotid];
}
if (!inv.IsIdValid(item)){
return;
}
if (inv.SingletonItemGetAmmo(item) == 0){

return;
}
inv.GetPotionItemBuffData(item, effectType, customAbilityName);
maxTox = abilityManager.GetStatMax(3);
potionToxicity = CalculateAttributeValue(inv.GetItemAttributeVal
ue(item, 'toxicity', /* NOP */, /* NOP */), /* NOP */);
toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeVal
ue(item, 'toxicity_offset', /* NOP */, /* NOP */), /* NOP */);
if (effectType != 33){
if (abilityManager.GetStat(3, false) + potionToxicity +
toxicityOffset > maxTox){
return;
}
}
customAbilityName = 'None';
inv.GetPotionItemBuffData(item, effectType, customAbilityName);
if (effectType == 43){
inv.GetItemAttributes(item, atts);
i = 0;
while (i < atts.Size()){
if (StrBeginsWith(NameToString(atts[i]), "fact_"
)){
factId = atts[i];
break;
}
i += 1;
}
factPotionParams = new W3Potion_Fact_Params in theGame;
factPotionParams.factName = factId;
factPotionParams.potionItemName = inv.GetItemName(item);
potionParams.buffSpecificParams = factPotionParams;
} else if (inv.ItemHasTag(item, 'Mutagen')){
mutagenParams = new W3MutagenBuffCustomParams in theGame
;
mutagenParams.toxicityOffset = toxicityOffset;
mutagenParams.potionItemName = inv.GetItemName(item);
potionParams.buffSpecificParams = mutagenParams;
} else {
potParams = new W3PotionParams in theGame;
potParams.potionItemName = inv.GetItemName(item);
potionParams.buffSpecificParams = potParams;
}
duration = super.CalculatePotionDuration(item, inv.ItemHasTag(it
em, 'Mutagen'), /* NOP */);
potionParams.effectType = effectType;
potionParams.creator = this;
potionParams.sourceName = "drank_potion";
potionParams.duration = duration;
potionParams.customAbilityName = customAbilityName;
ret = AddEffectCustom(potionParams);
if (factPotionParams){
delete factPotionParams;
}
if (mutagenParams){
delete mutagenParams;
}
inv.SingletonItemRemoveAmmo(item, /* NOP */);
if (ret == 3 || ret == 2 || ret == 4){
abilityManager.GainStat(3, potionToxicity);
if (!IsEffectActive('invisible', /* NOP */)){

PlayEffect('use_potion', /* NOP */);


}
if (inv.ItemHasTag(item, 'Mutagen')){
theGame.GetGamerProfile().CheckTrialOfGrasses();
SetFailedFundamentalsFirstAchievementCondition(t
rue);
}
if (CanUseSkill(59)){
hpGainValue = ClampF(GetStatMax(0) * CalculateAt
tributeValue(GetSkillAttributeValue(59, 'vitality_gain_perc', false, true), /* N
OP */) * GetSkillLevel(59), 0, GetStatMax(0));
GainStat(0, hpGainValue);
}
if (CanUseSkill(61) && !skillBonusPotionEffect && RandF(
) < CalculateAttributeValue(GetSkillAttributeValue(61, 'apply_chance', false, tr
ue), /* NOP */) * GetSkillLevel(61)){
randomPotions.PushBack(22);
randomPotions.PushBack(23);
randomPotions.PushBack(24);
randomPotions.PushBack(25);
randomPotions.PushBack(26);
randomPotions.PushBack(35);
randomPotions.PushBack(27);
randomPotions.PushBack(28);
randomPotions.PushBack(29);
randomPotions.PushBack(30);
randomPotions.PushBack(31);
randomPotions.PushBack(34);
randomPotions.Remove(effectType);
ind = RandRange(randomPotions.Size(), /* NOP */)
;
duration = BonusPotionGetDurationFromXML(randomP
otions[ind]);
if (duration > 0){
effectsOld = GetCurrentEffects();
params.effectType = randomPotions[ind];
params.creator = this;
params.sourceName = SkillEnumToName(61);
params.duration = duration;
ret = AddEffectCustom(params);
if (ret != 0 && ret != 1){
effectsNew = GetCurrentEffects()
;
ind = -1;
i = 0;
while (i < effectsNew.Size()){
if (!effectsOld.Contains
(effectsNew[i])){
ind = i;
break;
}
i += 1;
}
if (ind > -1){
skillBonusPotionEffect =
effectsNew[ind];
}
}
}
}

}
theTelemetry.LogWithLabel(28, inv.GetItemName(item));
if (ShouldProcessTutorial('TutorialPotionAmmo')){
FactsAdd("tut_used_potion", /* NOP */, /* NOP */);
}
SetFailedFundamentalsFirstAchievementCondition(true);
if (GetStat(3, /* NOP */) >= GetStatMax(3)){
DrainVitality(GetStat(0, /* NOP */) / 2);
}
/* NOP */;
}
private function BonusPotionGetDurationFromXML(type : EEffectType) : Flo
at{
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var tmpName : CName;
var typeName : CName;
var itemName : CName;
var abs : array<CName>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var tmpInt : Int32;
var temp : array<Float>;
var i : Int32;
var temp2 : Int32;
var temp3 : Int32;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('alchemy_recipes');
typeName = EffectTypeToName(type);
i = 0;
while (i < main.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'type_name', tmpName)){
if (tmpName == typeName){
if (dm.GetCustomNodeAttributeValueInt(ma
in.subNodes[i], 'level', tmpInt)){
if (tmpInt == 1){
if (dm.GetCustomNodeAttr
ibuteValueName(main.subNodes[i], 'cookedItem_name', itemName)){
if (IsNameValid(
itemName)){
break;
}
}
}
}
}
}
i += 1;
}
if (!IsNameValid(itemName)){
return 0;
}
dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2,
temp3);
dm.GetAbilitiesAttributeValue(abs, 'duration', min, max, /* NOP
*/);
return CalculateAttributeValue(GetAttributeRandomizedValue(min,
max), /* NOP */);

/* NOP */;
}
public function ClearSkillBonusPotionEffect(){
skillBonusPotionEffect = NULL;
/* NOP */;
}
public function GetSkillBonusPotionEffect() : CBaseGameplayEffect{
return skillBonusPotionEffect;
/* NOP */;
}
public final function AddRepairObjectBuff(armor : Bool, weapon : Bool) :
Bool{
var added : Bool;
added = false;
if (weapon && IsAnyItemEquippedOnSlot(1) || IsAnyItemEquippedOnS
lot(2)){
AddEffectDefault(112, this, "repair_object", false);
added = true;
}
if (armor && IsAnyItemEquippedOnSlot(3) || IsAnyItemEquippedOnSl
ot(6) || IsAnyItemEquippedOnSlot(4) || IsAnyItemEquippedOnSlot(5)){
AddEffectDefault(111, this, "repair_object", false);
added = true;
}
return added;
/* NOP */;
}
public function StartCSAnim(buff : CBaseGameplayEffect) : Bool{
if (super.IsAnyQuenActive() && (W3CriticalDOTEffect)buff){
return false;
}
return super.StartCSAnim(buff);
/* NOP */;
}
public function GetPotionBuffLevel(effectType : EEffectType) : Int32{
if (effectManager && effectManager.IsReady()){
return effectManager.GetPotionBuffLevel(effectType);
}
return 0;
/* NOP */;
}
public function OnLevelGained(currentLevel : Int32, show : Bool) : Bool{
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (abilityManager && abilityManager.IsInitialized()){
(W3PlayerAbilityManager)abilityManager.OnLevelGained(cur
rentLevel);
}
if (theGame.GetDifficultyMode() != 4){
Heal(GetStatMax(0));
}
if (currentLevel >= 35){
theGame.GetGamerProfile().AddAchievement(45);
}
if (hud && currentLevel < 70){
hud.OnLevelUpUpdate(currentLevel, show);
}
theGame.RequestAutoSave("level gained", false);
/* NOP */;
}

public function GetSignStats(skill : ESkill, damageType : CName, damageV


al : Float, spellPower : SAbilityAttributeValue){
var i : Int32;
var size : Int32;
var dm : CDefinitionsManagerAccessor;
var attrs : array<CName>;
spellPower = GetPowerStatValue(1, /* NOP */, /* NOP */);
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
size = attrs.Size();
i = 0;
while (i < size){
if (IsDamageTypeNameValid(attrs[i])){
damageVal = CalculateAttributeValue(GetSkillAttr
ibuteValue(skill, attrs[i], false, true), /* NOP */);
damageType = attrs[i];
break;
}
i += 1;
}
/* NOP */;
}
public function SetIgnorePainMaxVitality(val : Float){
if (abilityManager && abilityManager.IsInitialized()){
abilityManager.SetStatPointMax(0, val);
}
/* NOP */;
}
public function OnAnimEvent_ActionBlend(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1 && !disableActionBlend){
if (IsCastingSign()){
ProcessSignEvent('cast_end');
}
FindMoveTarget();
SetCanPlayHitAnim(true);
SetBIsCombatActionAllowed(true);
if (GetFinisherVictim() && GetFinisherVictim().HasAbilit
y('ForceFinisher')){
GetFinisherVictim().SignalGameplayEvent('Finishe
r');
} else if (BufferCombatAction != 0){
if (!IsCombatMusicEnabled()){
SetCombatActionHeading(ProcessCombatActi
onHeading(BufferCombatAction));
FindTarget(/* NOP */, /* NOP */, /* NOP
*/);
UpdateDisplayTarget(true, /* NOP */);
}
if (AllowAttack(GetTarget(), BufferCombatAction)
){
ProcessCombatActionBuffer();
}
} else {
ResumeEffects(2, 'InsideCombatAction');
}
} else if (disableActionBlend){
disableActionBlend = false;
}
/* NOP */;

}
public function OnAnimEvent_Sign(animEventName : CName, animEventType :
EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 0){
ProcessSignEvent(animEventName);
}
/* NOP */;
}
public function OnAnimEvent_Throwable(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thrownEntityHandle);
if (inv.IsItemCrossbow(inv.GetItemFromSlot('l_weapon')) && range
dWeapon.OnProcessThrowEvent(animEventName)){
return true;
} else if (thrownEntity && IsThrowingItem() && thrownEntity.OnPr
ocessThrowEvent(animEventName)){
return true;
}
/* NOP */;
}
public function IsInCombatAction_SpecialAttack() : Bool{
if (IsInCombatAction() && GetCombatAction() == 7 || GetCombatAct
ion() == 8){
return true;
} else {
return false;
}
/* NOP */;
}
protected function WhenCombatActionIsFinished(){
super.WhenCombatActionIsFinished();
RemoveTimer('ProcessAttackTimer', /* NOP */);
RemoveTimer('AttackTimerEnd', /* NOP */);
CastSignAbort();
specialAttackCamera = false;
OnPerformSpecialAttack(true, false);
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
CleanCombatActionBuffer();
super.OnCombatActionEnd();
RemoveTemporarySkills();
/* NOP */;
}
public function OnCombatActionFriendlyEnd() : Bool{
if (IsCastingSign()){
SetBehaviorVariable('IsCastingSign', 0, /* NOP */);
SetCurrentlyCastSign(5, NULL);
/* NOP */;
}
super.OnCombatActionFriendlyEnd();
/* NOP */;
}
public timer function OpenRadialMenu(optional time : Float, optional id
: Int32){
if (GetBIsCombatActionAllowed() && !IsUITakeInput()){
bShowRadialMenu = true;
}
RemoveTimer('OpenRadialMenu', /* NOP */);

/* NOP */;
}
public function OnAddRadialMenuOpenTimer(){
AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGa
me.GetTimeScale(/* NOP */), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/);
/* NOP */;
}
public function SetShowRadialMenuOpenFlag(bSet : Bool){
bShowRadialMenu = bSet;
/* NOP */;
}
public function OnRemoveRadialMenuOpenTimer(){
RemoveTimer('OpenRadialMenu', /* NOP */);
/* NOP */;
}
public function ResetRadialMenuOpenTimer(){
RemoveTimer('OpenRadialMenu', /* NOP */);
if (GetBIsCombatActionAllowed()){
AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime
* theGame.GetTimeScale(/* NOP */), /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
}
/* NOP */;
}
public timer function ResendCompanionDisplayName(optional dt : Float, op
tional id : Int32){
var hud : CR4ScriptedHud;
var companionModule : CR4HudModuleCompanion;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
companionModule = (CR4HudModuleCompanion)hud.GetHudModul
e("CompanionModule");
if (companionModule){
companionModule.ResendDisplayName();
}
}
/* NOP */;
}
public timer function ResendCompanionDisplayNameSecond(optional dt : Flo
at, optional id : Int32){
var hud : CR4ScriptedHud;
var companionModule : CR4HudModuleCompanion;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
companionModule = (CR4HudModuleCompanion)hud.GetHudModul
e("CompanionModule");
if (companionModule){
companionModule.ResendDisplayNameSecond();
}
}
/* NOP */;
}
public function RemoveCompanionDisplayNameTimer(){
RemoveTimer('ResendCompanionDisplayName', /* NOP */);
/* NOP */;
}
public function RemoveCompanionDisplayNameTimerSecond(){
RemoveTimer('ResendCompanionDisplayNameSecond', /* NOP */);
/* NOP */;

}
public function GetCompanionNPCTag() : CName{
return companionNPCTag;
/* NOP */;
}
public function SetCompanionNPCTag(value : CName){
companionNPCTag = value;
/* NOP */;
}
public function GetCompanionNPCTag2() : CName{
return companionNPCTag2;
/* NOP */;
}
public function SetCompanionNPCTag2(value : CName){
companionNPCTag2 = value;
/* NOP */;
}
public function GetCompanionNPCIconPath() : String{
return companionNPCIconPath;
/* NOP */;
}
public function SetCompanionNPCIconPath(value : String){
companionNPCIconPath = value;
/* NOP */;
}
public function GetCompanionNPCIconPath2() : String{
return companionNPCIconPath2;
/* NOP */;
}
public function SetCompanionNPCIconPath2(value : String){
companionNPCIconPath2 = value;
/* NOP */;
}
public function ReactToBeingHit(damageAction : W3DamageAction, buffNotAp
plied : Bool) : Bool{
var chance : Float;
var procQuen : W3SignEntity;
if (!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage()
){
if (inv.IsItemBomb(selectedItemId)){
BombThrowAbort();
} else {
ThrowingAbort();
}
}
if (damageAction.IsActionRanged()){
chance = CalculateAttributeValue(GetAttributeValue('quen
_chance_on_projectile', /* NOP */, /* NOP */), /* NOP */);
if (chance > 0){
chance = ClampF(chance, 0, 1);
if (RandF() < chance){
procQuen = (W3SignEntity)theGame.CreateE
ntity(signs[3].template, GetWorldPosition(), GetWorldRotation(), /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
procQuen.Init(signOwner, signs[3].entity
, true);
procQuen.OnStarted();
procQuen.OnThrowing();
procQuen.OnEnded(/* NOP */);
}

}
}
if (!(W3Effect_Toxicity)damageAction.causer){
MeditationForceAbort(true);
}
if (IsDoingSpecialAttack(false)){
damageAction.SetHitAnimationPlayType(2);
}
return super.ReactToBeingHit(damageAction, buffNotApplied);
/* NOP */;
}
protected function ShouldPauseHealthRegenOnHit() : Bool{
if (HasBuff(29) && GetPotionBuffLevel(29) >= 3){
return false;
}
return true;
/* NOP */;
}
public function SetMappinToHighlight(mappinName : CName, mappinState : B
ool){
var mappinDef : SHighlightMappin;
mappinDef.MappinName = mappinName;
mappinDef.MappinState = mappinState;
MappinToHighlight.PushBack(mappinDef);
/* NOP */;
}
public function ClearMappinToHighlight(){
MappinToHighlight.Clear();
/* NOP */;
}
public function CastSignAbort(){
if (currentlyCastSign != 5 && signs[currentlyCastSign].entity){
signs[currentlyCastSign].entity.OnSignAborted(/* NOP */)
;
}
/* NOP */;
}
public function OnBlockingSceneStarted(scene : CStoryScene) : Bool{
var med : W3PlayerWitcherStateMeditationWaiting;
med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
if (med){
med.StopRequested(true);
}
super.OnBlockingSceneStarted(scene);
/* NOP */;
}
public function GetHorseManager() : W3HorseManager{
return (W3HorseManager)EntityHandleGet(horseManagerHandle);
/* NOP */;
}
public function HorseEquipItem(horsesItemId : SItemUniqueId) : Bool{
var man : W3HorseManager;
man = GetHorseManager();
if (man){
return man.EquipItem(horsesItemId) != GetInvalidUniqueId
();
}
return false;
/* NOP */;
}

public function HorseUnequipItem(slot : EEquipmentSlots) : Bool{


var man : W3HorseManager;
man = GetHorseManager();
if (man){
return man.UnequipItem(slot) != GetInvalidUniqueId();
}
return false;
/* NOP */;
}
public final function HorseRemoveItemByName(itemName : CName, quantity :
Int32){
var man : W3HorseManager;
man = GetHorseManager();
if (man){
man.HorseRemoveItemByName(itemName, quantity);
}
/* NOP */;
}
public final function HorseRemoveItemByCategory(itemCategory : CName, qu
antity : Int32){
var man : W3HorseManager;
man = GetHorseManager();
if (man){
man.HorseRemoveItemByCategory(itemCategory, quantity);
}
/* NOP */;
}
public final function HorseRemoveItemByTag(itemTag : CName, quantity : I
nt32){
var man : W3HorseManager;
man = GetHorseManager();
if (man){
man.HorseRemoveItemByTag(itemTag, quantity);
}
/* NOP */;
}
public function OnPlayerHorseSpawned(horse : CActor) : Bool{
var man : W3HorseManager;
man = GetHorseManager();
if (man){
man.ApplyHorseUpdateOnSpawn();
}
/* NOP */;
}
public function GetAssociatedInventory() : CInventoryComponent{
var man : W3HorseManager;
man = GetHorseManager();
if (man){
return man.GetInventoryComponent();
}
return NULL;
/* NOP */;
}
public final function TutorialMutagensUnequipPlayerSkills() : array<STut
orialSavedSkill>{
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
return pam.TutorialMutagensUnequipPlayerSkills();
/* NOP */;
}

public final function TutorialMutagensEquipOneGoodSkill(){


var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
pam.TutorialMutagensEquipOneGoodSkill();
/* NOP */;
}
public final function TutorialMutagensEquipOneGoodOneBadSkill(){
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam){
pam.TutorialMutagensEquipOneGoodOneBadSkill();
}
/* NOP */;
}
public final function TutorialMutagensEquipThreeGoodSkills(){
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam){
pam.TutorialMutagensEquipThreeGoodSkills();
}
/* NOP */;
}
public final function TutorialMutagensCleanupTempSkills(savedEquippedSki
lls : array<STutorialSavedSkill>){
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills
);
/* NOP */;
}
public function GetOffenseStatsList() : SPlayerOffenseStats{
var playerOffenseStats : SPlayerOffenseStats;
var steelDmg : Float;
var silverDmg : Float;
var elementalSteel : Float;
var elementalSilver : Float;
var steelCritChance : Float;
var steelCritDmg : Float;
var silverCritChance : Float;
var silverCritDmg : Float;
var attackPower : SAbilityAttributeValue;
var fastCritChance : Float;
var fastCritDmg : Float;
var strongCritChance : Float;
var strongCritDmg : Float;
var fastAP : SAbilityAttributeValue;
var strongAP : SAbilityAttributeValue;
var item : SItemUniqueId;
var crossbow : SItemUniqueId;
var value : SAbilityAttributeValue;
var mutagen : CBaseGameplayEffect;
if (!abilityManager || !abilityManager.IsInitialized()){
return playerOffenseStats;
}
if (CanUseSkill(36)){
fastAP += GetSkillAttributeValue(36, PowerStatEnumToName
(0), false, true) * GetSkillLevel(36);
}
if (CanUseSkill(84)){
fastAP += GetAttributeValue('attack_power_fast_style', /

* NOP */, /* NOP */);


fastCritDmg += CalculateAttributeValue(GetAttributeValue
('critical_hit_chance_fast_style', /* NOP */, /* NOP */), /* NOP */);
}
if (CanUseSkill(19)){
strongAP += GetSkillAttributeValue(19, PowerStatEnumToNa
me(0), false, true) * GetSkillLevel(19);
}
if (CanUseSkill(86)){
strongAP += GetAttributeValue('attack_power_heavy_style'
, /* NOP */, /* NOP */);
}
if (CanUseSkill(32)){
fastCritChance += CalculateAttributeValue(GetSkillAttrib
uteValue(32, theGame.params.CRITICAL_HIT_CHANCE, false, true), /* NOP */) * GetS
killLevel(32);
fastCritDmg += CalculateAttributeValue(GetSkillAttribute
Value(32, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true), /* NOP */) * G
etSkillLevel(32);
}
if (CanUseSkill(23)){
strongCritChance += CalculateAttributeValue(GetSkillAttr
ibuteValue(23, theGame.params.CRITICAL_HIT_CHANCE, false, true), /* NOP */) * Ge
tSkillLevel(23);
strongCritDmg += CalculateAttributeValue(GetSkillAttribu
teValue(23, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true), /* NOP */) *
GetSkillLevel(23);
}
if (HasBuff(77) && GetStat(0, /* NOP */) == GetStatMax(0)){
attackPower += GetAttributeValue('damageIncrease', /* NO
P */, /* NOP */);
}
steelCritChance += CalculateAttributeValue(GetAttributeValue(the
Game.params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /* NOP */);
silverCritChance += CalculateAttributeValue(GetAttributeValue(th
eGame.params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /* NOP */);
steelCritDmg += CalculateAttributeValue(GetAttributeValue(theGam
e.params.CRITICAL_HIT_DAMAGE_BONUS, /* NOP */, /* NOP */), /* NOP */);
silverCritDmg += CalculateAttributeValue(GetAttributeValue(theGa
me.params.CRITICAL_HIT_DAMAGE_BONUS, /* NOP */, /* NOP */), /* NOP */);
attackPower += GetPowerStatValue(0, /* NOP */, /* NOP */);
if (GetItemEquippedOnSlot(2, item)){
steelDmg = GetTotalWeaponDamage(item, theGame.params.DAM
AGE_NAME_SLASHING, GetInvalidUniqueId());
steelDmg += GetTotalWeaponDamage(item, theGame.params.DA
MAGE_NAME_PIERCING, GetInvalidUniqueId());
steelDmg += GetTotalWeaponDamage(item, theGame.params.DA
MAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
elementalSteel = CalculateAttributeValue(thePlayer.GetIn
ventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE, /* NOP */
, /* NOP */), /* NOP */);
elementalSteel += CalculateAttributeValue(thePlayer.GetI
nventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST, /* NOP
*/, /* NOP */), /* NOP */);
if (GetInventory().IsItemHeld(item)){
steelCritChance -= CalculateAttributeValue(thePl
ayer.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHAN
CE, /* NOP */, /* NOP */), /* NOP */);
silverCritChance -= CalculateAttributeValue(theP
layer.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHA

NCE, /* NOP */, /* NOP */), /* NOP */);


steelCritDmg -= CalculateAttributeValue(thePlaye
r.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_
BONUS, /* NOP */, /* NOP */), /* NOP */);
silverCritDmg -= CalculateAttributeValue(thePlay
er.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE
_BONUS, /* NOP */, /* NOP */), /* NOP */);
}
steelCritChance += CalculateAttributeValue(thePlayer.Get
Inventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE, /* N
OP */, /* NOP */), /* NOP */);
steelCritDmg += CalculateAttributeValue(thePlayer.GetInv
entory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, /
* NOP */, /* NOP */), /* NOP */);
} else {
steelDmg += 0;
steelCritChance += 0;
steelCritDmg += 0;
}
if (GetItemEquippedOnSlot(1, item)){
silverDmg = GetTotalWeaponDamage(item, theGame.params.DA
MAGE_NAME_SILVER, GetInvalidUniqueId());
elementalSilver = CalculateAttributeValue(thePlayer.GetI
nventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE, /* NOP *
/, /* NOP */), /* NOP */);
elementalSilver += CalculateAttributeValue(thePlayer.Get
Inventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST, /* NOP
*/, /* NOP */), /* NOP */);
if (GetInventory().IsItemHeld(item)){
steelCritChance -= CalculateAttributeValue(thePl
ayer.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHAN
CE, /* NOP */, /* NOP */), /* NOP */);
silverCritChance -= CalculateAttributeValue(theP
layer.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHA
NCE, /* NOP */, /* NOP */), /* NOP */);
steelCritDmg -= CalculateAttributeValue(thePlaye
r.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_
BONUS, /* NOP */, /* NOP */), /* NOP */);
silverCritDmg -= CalculateAttributeValue(thePlay
er.GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE
_BONUS, /* NOP */, /* NOP */), /* NOP */);
}
silverCritChance += CalculateAttributeValue(thePlayer.Ge
tInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE, /*
NOP */, /* NOP */), /* NOP */);
silverCritDmg += CalculateAttributeValue(thePlayer.GetIn
ventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS,
/* NOP */, /* NOP */), /* NOP */);
} else {
silverDmg += 0;
silverCritChance += 0;
silverCritDmg += 0;
}
fastAP += attackPower;
strongAP += attackPower;
playerOffenseStats.steelFastCritChance = steelCritChance + fastC
ritChance * 100;
playerOffenseStats.steelFastCritDmg = steelCritDmg + fastCritDmg
;
if (steelDmg != 0){

playerOffenseStats.steelFastDmg = steelDmg + fastAP.valu


eBase * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSteel;
playerOffenseStats.steelFastCritDmg = steelDmg + fastAP.
valueBase * fastAP.valueMultiplicative + playerOffenseStats.steelFastCritDmg + f
astAP.valueAdditive + elementalSteel;
} else {
playerOffenseStats.steelFastDmg = 0;
playerOffenseStats.steelFastCritDmg = 0;
}
playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDm
g * 100 - playerOffenseStats.steelFastCritChance + playerOffenseStats.steelFastC
ritDmg * playerOffenseStats.steelFastCritChance / 100;
playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDP
S / 0.600000;
playerOffenseStats.steelStrongCritChance = steelCritChance + str
ongCritChance * 100;
playerOffenseStats.steelStrongCritDmg = steelCritDmg + strongCri
tDmg;
if (steelDmg != 0){
playerOffenseStats.steelStrongDmg = steelDmg + strongAP.
valueBase * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSte
el;
playerOffenseStats.steelStrongDmg *= 1.833000;
playerOffenseStats.steelStrongCritDmg = steelDmg + stron
gAP.valueBase * strongAP.valueMultiplicative + playerOffenseStats.steelStrongCri
tDmg + strongAP.valueAdditive + elementalSteel;
playerOffenseStats.steelStrongCritDmg *= 1.833000;
} else {
playerOffenseStats.steelStrongDmg = 0;
playerOffenseStats.steelStrongCritDmg = 0;
}
playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStro
ngDmg * 100 - playerOffenseStats.steelStrongCritChance + playerOffenseStats.stee
lStrongCritDmg * playerOffenseStats.steelStrongCritChance / 100;
playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStro
ngDPS / 1.100000;
playerOffenseStats.silverFastCritChance = silverCritChance + fas
tCritChance * 100;
playerOffenseStats.silverFastCritDmg = silverCritDmg + fastCritD
mg;
if (silverDmg != 0){
playerOffenseStats.silverFastDmg = silverDmg + fastAP.va
lueBase * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSilver;
playerOffenseStats.silverFastCritDmg = silverDmg + fastA
P.valueBase * fastAP.valueMultiplicative + playerOffenseStats.silverFastCritDmg
+ fastAP.valueAdditive + elementalSilver;
} else {
playerOffenseStats.silverFastDmg = 0;
playerOffenseStats.silverFastCritDmg = 0;
}
playerOffenseStats.silverFastDPS = playerOffenseStats.silverFast
Dmg * 100 - playerOffenseStats.silverFastCritChance + playerOffenseStats.silverF
astCritDmg * playerOffenseStats.silverFastCritChance / 100;
playerOffenseStats.silverFastDPS = playerOffenseStats.silverFast
DPS / 0.600000;
playerOffenseStats.silverStrongCritChance = silverCritChance + s
trongCritChance * 100;
playerOffenseStats.silverStrongCritDmg = silverCritDmg + strongC
ritDmg;
if (silverDmg != 0){

playerOffenseStats.silverStrongDmg = silverDmg + strongA


P.valueBase * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalS
ilver;
playerOffenseStats.silverStrongDmg *= 1.833000;
playerOffenseStats.silverStrongCritDmg = silverDmg + str
ongAP.valueBase * strongAP.valueMultiplicative + playerOffenseStats.silverStrong
CritDmg + strongAP.valueAdditive + elementalSilver;
playerOffenseStats.silverStrongCritDmg *= 1.833000;
} else {
playerOffenseStats.silverStrongDmg = 0;
playerOffenseStats.silverStrongCritDmg = 0;
}
playerOffenseStats.silverStrongDPS = playerOffenseStats.silverSt
rongDmg * 100 - playerOffenseStats.silverStrongCritChance + playerOffenseStats.s
ilverStrongCritDmg * playerOffenseStats.silverStrongCritChance / 100;
playerOffenseStats.silverStrongDPS = playerOffenseStats.silverSt
rongDPS / 1.100000;
playerOffenseStats.crossbowCritChance = CalculateAttributeValue(
GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /*
NOP */);
if (CanUseSkill(22)){
playerOffenseStats.crossbowCritChance += CalculateAttrib
uteValue(GetSkillAttributeValue(22, theGame.params.CRITICAL_HIT_CHANCE, false, t
rue), /* NOP */) * GetSkillLevel(22);
}
playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_
NAME_PIERCING;
if (GetItemEquippedOnSlot(17, item)){
steelDmg = CalculateAttributeValue(thePlayer.GetInventor
y().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE, /* NOP */, /* N
OP */), /* NOP */);
if (steelDmg > 0){
playerOffenseStats.crossbowSteelDmg = steelDmg;
playerOffenseStats.crossbowSteelDmgType = theGam
e.params.DAMAGE_NAME_FIRE;
playerOffenseStats.crossbowSilverDmg = steelDmg;
} else {
playerOffenseStats.crossbowSilverDmg = Calculate
AttributeValue(thePlayer.GetInventory().GetItemAttributeValue(item, theGame.para
ms.DAMAGE_NAME_SILVER, /* NOP */, /* NOP */), /* NOP */);
steelDmg = CalculateAttributeValue(thePlayer.Get
Inventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_PIERCING, /*
NOP */, /* NOP */), /* NOP */);
if (steelDmg > 0){
playerOffenseStats.crossbowSteelDmg = st
eelDmg;
playerOffenseStats.crossbowSteelDmgType
= theGame.params.DAMAGE_NAME_PIERCING;
} else {
playerOffenseStats.crossbowSteelDmg = Ca
lculateAttributeValue(thePlayer.GetInventory().GetItemAttributeValue(item, theGa
me.params.DAMAGE_NAME_BLUDGEONING, /* NOP */, /* NOP */), /* NOP */);
playerOffenseStats.crossbowSteelDmgType
= theGame.params.DAMAGE_NAME_BLUDGEONING;
}
}
}
if (GetItemEquippedOnSlot(9, item)){
attackPower += thePlayer.GetInventory().GetItemAttribute
Value(item, PowerStatEnumToName(0), /* NOP */, /* NOP */);

if (CanUseSkill(81)){
attackPower += GetSkillAttributeValue(81, PowerS
tatEnumToName(0), false, true);
}
playerOffenseStats.crossbowSteelDmg = playerOffenseStats
.crossbowSteelDmg + attackPower.valueBase * attackPower.valueMultiplicative + at
tackPower.valueAdditive;
playerOffenseStats.crossbowSilverDmg = playerOffenseStat
s.crossbowSilverDmg + attackPower.valueBase * attackPower.valueMultiplicative +
attackPower.valueAdditive;
} else {
playerOffenseStats.crossbowSteelDmg = 0;
playerOffenseStats.crossbowSilverDmg = 0;
playerOffenseStats.crossbowSteelDmgType = theGame.params
.DAMAGE_NAME_PIERCING;
}
return playerOffenseStats;
/* NOP */;
}
public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTyp
eName : CName, crossbowId : SItemUniqueId) : Float{
var damage : Float;
var durRatio : Float;
var durMod : Float;
var repairObjectBonus : SAbilityAttributeValue;
durMod = 0;
damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, cr
ossbowId);
if (IsPhysicalResistStat(GetResistForDamage(damageTypeName, fals
e))){
repairObjectBonus = inv.GetItemAttributeValue(weaponId,
theGame.params.REPAIR_OBJECT_BONUS, /* NOP */, /* NOP */);
durRatio = -1;
if (inv.IsIdValid(crossbowId) && inv.HasItemDurability(c
rossbowId)){
durRatio = inv.GetItemDurabilityRatio(crossbowId
);
} else if (inv.IsIdValid(weaponId) && inv.HasItemDurabil
ity(weaponId)){
durRatio = inv.GetItemDurabilityRatio(weaponId);
}
if (durRatio >= 0){
durMod = theGame.params.GetDurabilityMultiplier(
durRatio, true);
} else {
durMod = 1;
}
}
return damage * durMod + repairObjectBonus.valueMultiplicative;
/* NOP */;
}
public final function GetSkillPathType(skill : ESkill) : ESkillPath{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillPa
thType(skill);
}
return 0;
/* NOP */;
}
public function GetSkillLevel(s : ESkill) : Int32{

if (abilityManager && abilityManager.IsInitialized()){


return (W3PlayerAbilityManager)abilityManager.GetSkillLe
vel(s);
}
return -1;
/* NOP */;
}
public function GetAxiiLevel() : Int32{
var level : Int32;
level = 1;
if (CanUseSkill(53)){
level += GetSkillLevel(53);
}
return Clamp(level, 1, 4);
/* NOP */;
}
public function IsInFrenzy() : Bool{
return isInFrenzy;
/* NOP */;
}
public function HasRecentlyCountered() : Bool{
return hasRecentlyCountered;
/* NOP */;
}
public function SetRecentlyCountered(counter : Bool){
hasRecentlyCountered = counter;
/* NOP */;
}
public timer function CheckBlockedSkills(optional dt : Float, optional i
d : Int32){
var nextCallTime : Float;
nextCallTime = (W3PlayerAbilityManager)abilityManager.CheckBlock
edSkills(dt);
if (nextCallTime != -1){
AddTimer('CheckBlockedSkills', nextCallTime, /* NOP */,
/* NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public function RemoveTemporarySkills(){
var i : Int32;
var pam : W3PlayerAbilityManager;
if (tempLearnedSignSkills.Size() > 0){
pam = (W3PlayerAbilityManager)abilityManager;
i = 0;
while (i < tempLearnedSignSkills.Size()){
pam.RemoveTemporarySkill(tempLearnedSignSkills[i
]);
i += 1;
}
tempLearnedSignSkills.Clear();
RemoveAbilityAll(SkillEnumToName(34));
}
/* NOP */;
}
public function RemoveTemporarySkill(skill : SSimpleSkill) : Bool{
var pam : W3PlayerAbilityManager;
pam = (W3PlayerAbilityManager)abilityManager;
if (pam && pam.IsInitialized()){
return pam.RemoveTemporarySkill(skill);

}
return false;
/* NOP */;
}
private function AddTemporarySkills(){
if (CanUseSkill(34) && GetStat(4, /* NOP */) >= 3){
tempLearnedSignSkills = (W3PlayerAbilityManager)abilityM
anager.AddTempNonAlchemySkills();
DrainFocus(GetStat(4, /* NOP */));
AddAbilityMultiple(SkillEnumToName(34), GetSkillLevel(34
));
}
/* NOP */;
}
public function HasAlternateQuen() : Bool{
var quenEntity : W3QuenEntity;
quenEntity = (W3QuenEntity)GetCurrentSignEntity();
if (quenEntity){
return quenEntity.IsAlternateCast();
}
return false;
/* NOP */;
}
public function AddPoints(type : ESpendablePointType, amount : Int32, sh
ow : Bool){
levelManager.AddPoints(type, amount, show);
/* NOP */;
}
public function GetLevel() : Int32{
return levelManager.GetLevel();
/* NOP */;
}
public function GetTotalExpForNextLevel() : Int32{
return levelManager.GetTotalExpForNextLevel();
/* NOP */;
}
public function GetPointsTotal(type : ESpendablePointType) : Int32{
return levelManager.GetPointsTotal(type);
/* NOP */;
}
public function IsAutoLeveling() : Bool{
return autoLevel;
/* NOP */;
}
public function SetAutoLeveling(b : Bool){
autoLevel = b;
/* NOP */;
}
public function GetMissingExpForNextLevel() : Int32{
return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(1));
/* NOP */;
}
public timer function HACK_QuenSaveStatus(optional dt : Float, optional
id : Int32){
var quenEntity : W3QuenEntity;
quenEntity = (W3QuenEntity)signs[3].entity;
savedQuenHealth = quenEntity.GetShieldHealth();
savedQuenDuration = quenEntity.GetShieldRemainingDuration();
/* NOP */;
}

public final function OnBasicQuenFinishing(){


RemoveTimer('HACK_QuenSaveStatus', /* NOP */);
savedQuenHealth = 0.000000;
savedQuenDuration = 0.000000;
/* NOP */;
}
public final function IsAnyQuenActive() : Bool{
var quen : W3QuenEntity;
quen = (W3QuenEntity)GetSignEntity(3);
if (quen){
return quen.IsAnyQuenActive();
}
return false;
/* NOP */;
}
public final function IsQuenActive(alternateMode : Bool) : Bool{
if (IsAnyQuenActive() && GetSignEntity(3).IsAlternateCast() == a
lternateMode){
return true;
}
return false;
/* NOP */;
}
public function FinishQuen(){
var quen : W3QuenEntity;
quen = (W3QuenEntity)GetSignEntity(3);
if (quen){
quen.ForceFinishQuen();
}
/* NOP */;
}
public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAtt
ributeValue{
var sp : SAbilityAttributeValue;
var penalty : SAbilityAttributeValue;
var penaltyReduction : Float;
var penaltyReductionLevel : Int32;
sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(1), t
rue, true);
if (signSkill == 37){
penaltyReductionLevel = GetSkillLevel(37) + 1;
if (penaltyReductionLevel > 0){
penaltyReduction = 1 - penaltyReductionLevel * C
alculateAttributeValue(GetSkillAttributeValue(37, 'spell_power_penalty_reduction
', true, true), /* NOP */);
penalty = GetSkillAttributeValue(37, PowerStatEn
umToName(1), false, false);
sp += penalty * penaltyReduction;
}
}
if (signSkill == 6 || signSkill == 37){
sp += GetAttributeValue('spell_power_aard', /* NOP */, /
* NOP */);
} else if (signSkill == 7 || signSkill == 38){
sp += GetAttributeValue('spell_power_igni', /* NOP */, /
* NOP */);
} else if (signSkill == 8 || signSkill == 39){
sp += GetAttributeValue('spell_power_yrden', /* NOP */,
/* NOP */);
} else if (signSkill == 9 || signSkill == 40){

sp += GetAttributeValue('spell_power_quen', /* NOP */, /


* NOP */);
} else if (signSkill == 10 || signSkill == 41){
sp += GetAttributeValue('spell_power_axii', /* NOP */, /
* NOP */);
}
return sp;
/* NOP */;
}
public final function GetGwentCardIndex(cardName : CName) : Int32{
var dm : CDefinitionsManagerAccessor;
dm = theGame.GetDefinitionsManager();
if (dm.ItemHasTag(cardName, 'GwintCardLeader')){
return theGame.GetGwintManager().GwentLeadersNametoInt(c
ardName);
} else if (dm.ItemHasTag(cardName, 'GwintCardNrkd')){
return theGame.GetGwintManager().GwentNrkdNameToInt(card
Name);
} else if (dm.ItemHasTag(cardName, 'GwintCardNlfg')){
return theGame.GetGwintManager().GwentNlfgNameToInt(card
Name);
} else if (dm.ItemHasTag(cardName, 'GwintCardSctl')){
return theGame.GetGwintManager().GwentSctlNameToInt(card
Name);
} else if (dm.ItemHasTag(cardName, 'GwintCardMstr')){
return theGame.GetGwintManager().GwentMstrNameToInt(card
Name);
} else if (dm.ItemHasTag(cardName, 'GwintCardNeutral')){
return theGame.GetGwintManager().GwentNeutralNameToInt(c
ardName);
} else if (dm.ItemHasTag(cardName, 'GwintCardSpcl')){
return theGame.GetGwintManager().GwentSpecialNameToInt(c
ardName);
}
return -1;
/* NOP */;
}
public final function AddGwentCard(cardName : CName, amount : Int32) : B
ool{
var dm : CDefinitionsManagerAccessor;
var cardIndex : Int32;
var i : Int32;
var tut : STutorialMessage;
if (FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTu
torial('TutorialGwentDeckBuilder2')){
tut.type = 1;
tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
tut.journalEntryName = 'TutorialGwentDeckBuilder2';
tut.hintPositionType = 0;
tut.markAsSeenOnShow = true;
tut.hintDurationType = 2;
theGame.GetTutorialSystem().DisplayTutorial(tut);
}
dm = theGame.GetDefinitionsManager();
cardIndex = GetGwentCardIndex(cardName);
if (cardIndex != -1){
FactsAdd("Gwint_Card_Looted", /* NOP */, /* NOP */);
i = 0;
while (i < amount){
theGame.GetGwintManager().AddCardToCollection(ca

rdIndex);
i += 1;
}
}
if (dm.ItemHasTag(cardName, 'GwentTournament')){
if (dm.ItemHasTag(cardName, 'GT1')){
FactsAdd("GwentTournament", 1, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT2')){
FactsAdd("GwentTournament", 2, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT3')){
FactsAdd("GwentTournament", 3, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT4')){
FactsAdd("GwentTournament", 4, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT5')){
FactsAdd("GwentTournament", 5, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT6')){
FactsAdd("GwentTournament", 6, /* NOP
} else if (dm.ItemHasTag(cardName, 'GT7')){
FactsAdd("GwentTournament", 7, /* NOP
}
CheckGwentTournamentDeck();
} else {
return false;
}
return true;
/* NOP */;

*/);
*/);
*/);
*/);
*/);
*/);
*/);

}
public final function RemoveGwentCard(cardName : CName, amount : Int32)
: Bool{
var dm : CDefinitionsManagerAccessor;
var cardIndex : Int32;
var i : Int32;
dm = theGame.GetDefinitionsManager();
if (dm.ItemHasTag(cardName, 'GwintCardLeader')){
cardIndex = theGame.GetGwintManager().GwentLeadersNameto
Int(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
} else if (dm.ItemHasTag(cardName, 'GwintCardNrkd')){
cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt
(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
} else if (dm.ItemHasTag(cardName, 'GwintCardNlfg')){
cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt
(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}

} else if (dm.ItemHasTag(cardName, 'GwintCardSctl')){


cardIndex = theGame.GetGwintManager().GwentSctlNameToInt
(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
} else if (dm.ItemHasTag(cardName, 'GwintCardMstr')){
cardIndex = theGame.GetGwintManager().GwentMstrNameToInt
(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
} else if (dm.ItemHasTag(cardName, 'GwintCardNeutral')){
cardIndex = theGame.GetGwintManager().GwentNeutralNameTo
Int(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
} else if (dm.ItemHasTag(cardName, 'GwintCardSpcl')){
cardIndex = theGame.GetGwintManager().GwentSpecialNameTo
Int(cardName);
i = 0;
while (i < amount){
theGame.GetGwintManager().RemoveCardFromCollecti
on(cardIndex);
i += 1;
}
}
if (dm.ItemHasTag(cardName, 'GwentTournament')){
if (dm.ItemHasTag(cardName, 'GT1')){
FactsSubstract("GwentTournament", 1);
} else if (dm.ItemHasTag(cardName, 'GT2')){
FactsSubstract("GwentTournament", 2);
} else if (dm.ItemHasTag(cardName, 'GT3')){
FactsSubstract("GwentTournament", 3);
} else if (dm.ItemHasTag(cardName, 'GT4')){
FactsSubstract("GwentTournament", 4);
} else if (dm.ItemHasTag(cardName, 'GT5')){
FactsSubstract("GwentTournament", 5);
} else if (dm.ItemHasTag(cardName, 'GT6')){
FactsSubstract("GwentTournament", 6);
} else if (dm.ItemHasTag(cardName, 'GT7')){
FactsSubstract("GwentTournament", 7);
}
CheckGwentTournamentDeck();
} else {
return false;
}
return true;
/* NOP */;
}

public function CheckGwentTournamentDeck(){


var gwentPower : Int32;
var neededGwentPower : Int32;
var checkBreakpoint : Int32;
neededGwentPower = 70;
checkBreakpoint = neededGwentPower / 5;
gwentPower = FactsQuerySum("GwentTournament");
if (gwentPower >= neededGwentPower){
FactsAdd("HasGwentTournamentDeck", 1, /* NOP */);
} else {
if (FactsDoesExist("HasGwentTournamentDeck")){
FactsRemove("HasGwentTournamentDeck");
}
if (gwentPower >= checkBreakpoint){
FactsAdd("GwentTournamentObjective1", 1, /* NOP
*/);
} else if (FactsDoesExist("GwentTournamentObjective1")){
FactsRemove("GwentTournamentObjective1");
}
if (gwentPower >= checkBreakpoint * 2){
FactsAdd("GwentTournamentObjective2", 1, /* NOP
*/);
} else if (FactsDoesExist("GwentTournamentObjective2")){
FactsRemove("GwentTournamentObjective2");
}
if (gwentPower >= checkBreakpoint * 3){
FactsAdd("GwentTournamentObjective3", 1, /* NOP
*/);
} else if (FactsDoesExist("GwentTournamentObjective3")){
FactsRemove("GwentTournamentObjective3");
}
if (gwentPower >= checkBreakpoint * 4){
FactsAdd("GwentTournamentObjective4", 1, /* NOP
*/);
} else if (FactsDoesExist("GwentTournamentObjective4")){
FactsRemove("GwentTournamentObjective4");
}
}
/* NOP */;
}
public function SimulateBuffTimePassing(simulatedTime : Float){
super.SimulateBuffTimePassing(simulatedTime);
FinishQuen();
/* NOP */;
}
public function CanMeditate() : Bool{
var currentStateName : CName;
currentStateName = GetCurrentStateName();
if (currentStateName == 'Exploration' && !CanPerformPlayerAction
(/* NOP */)){
return false;
}
if (GetCurrentStateName() != 'Exploration' && GetCurrentStateNam
e() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting'){
return false;
}
if (GetUsedVehicle()){
return false;
}
return super.CanMeditateHere();

/* NOP */;
}
public final function CanMeditateWait(skipMeditationStateCheck : Bool) :
Bool{
var currState : CName;
currState = GetCurrentStateName();
if (!skipMeditationStateCheck && currState != 'Meditation'){
return false;
}
if (theGame.IsGameTimePaused()){
return false;
}
if (!thePlayer.IsActionAllowed(41)){
return false;
}
return true;
/* NOP */;
}
public final function CanMeditateHere() : Bool{
var pos : Vector;
pos = GetWorldPosition();
if (pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsIn
ShallowWater()){
return false;
}
if (IsThreatened()){
return false;
}
return true;
/* NOP */;
}
public function Meditate(){
var medState : W3PlayerWitcherStateMeditation;
if (!CanMeditate() || GetCurrentStateName() == 'Meditation' || G
etCurrentStateName() == 'MeditationWaiting'){
return;
}
GotoState('Meditation', /* NOP */, /* NOP */);
medState = (W3PlayerWitcherStateMeditation)GetState('Meditation'
);
medState.SetMeditationPointHeading(GetHeading());
/* NOP */;
}
public final function MeditationRestoring(simulatedTime : Float){
if (theGame.GetDifficultyMode() != 3 && theGame.GetDifficultyMod
e() != 4){
Heal(GetStatMax(0));
}
abilityManager.DrainToxicity(abilityManager.GetStat(3, /* NOP */
));
abilityManager.DrainFocus(abilityManager.GetStat(4, /* NOP */));
inv.SingletonItemsRefillAmmo();
SimulateBuffTimePassing(simulatedTime);
/* NOP */;
}
public function MeditationClockStart(m : CR4MeditationClockMenu){
clockMenu = m;
AddTimer('UpdateClockTime', 0.100000, true, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
/* NOP */;

}
public function MeditationClockStop(){
clockMenu = NULL;
RemoveTimer('UpdateClockTime', /* NOP */);
/* NOP */;
}
public timer function UpdateClockTime(optional dt : Float, optional id :
Int32){
if (clockMenu){
clockMenu.UpdateCurrentHours();
} else {
RemoveTimer('UpdateClockTime', /* NOP */);
}
/* NOP */;
}
public function SetWaitTargetHour(t : Int32){
waitTimeHour = t;
/* NOP */;
}
public function GetWaitTargetHour() : Int32{
return waitTimeHour;
/* NOP */;
}
public function MeditationForceAbort(forceCloseUI : Bool){
var waitt : W3PlayerWitcherStateMeditationWaiting;
var medd : W3PlayerWitcherStateMeditation;
var currentStateName : CName;
currentStateName = GetCurrentStateName();
if (currentStateName == 'MeditationWaiting'){
waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurren
tState();
if (waitt){
waitt.StopRequested(forceCloseUI);
}
} else if (currentStateName == 'Meditation'){
medd = (W3PlayerWitcherStateMeditation)GetCurrentState()
;
if (medd){
medd.StopRequested(forceCloseUI);
}
}
if (forceCloseUI && theGame.GetGuiManager().IsAnyMenu()){
theGame.GetGuiManager().GetRootMenu().CloseMenu();
DisplayActionDisallowedHudMessage(41, false, false, true
, false);
}
/* NOP */;
}
public function CheatResurrect(){
super.CheatResurrect();
theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
theInput.RestoreContext('Exploration', true);
/* NOP */;
}
public function Debug_EquipTestingSkills(equip : Bool){
(W3PlayerAbilityManager)abilityManager.OnLevelGained(36);
if (equip){
if (GetSkillLevel(37) == 0){
AddSkill(37, /* NOP */);
}

if (GetSkillLevel(38) == 0){
AddSkill(38, /* NOP */);
}
if (GetSkillLevel(39) == 0){
AddSkill(39, /* NOP */);
}
if (GetSkillLevel(40) == 0){
AddSkill(40, /* NOP */);
}
if (GetSkillLevel(41) == 0){
AddSkill(41, /* NOP */);
}
if (GetSkillLevel(16) == 0){
AddSkill(16, /* NOP */);
}
if (GetSkillLevel(17) == 0){
AddSkill(17, /* NOP */);
}
EquipSkill(37, GetFreeSkillSlot());
EquipSkill(38, GetFreeSkillSlot());
EquipSkill(39, GetFreeSkillSlot());
EquipSkill(40, GetFreeSkillSlot());
EquipSkill(41, GetFreeSkillSlot());
EquipSkill(16, GetFreeSkillSlot());
EquipSkill(17, GetFreeSkillSlot());
} else {
UnequipSkill(GetSkillSlotID(37));
UnequipSkill(GetSkillSlotID(38));
UnequipSkill(GetSkillSlotID(39));
UnequipSkill(GetSkillSlotID(40));
UnequipSkill(GetSkillSlotID(41));
UnequipSkill(GetSkillSlotID(16));
UnequipSkill(GetSkillSlotID(17));
}
/* NOP */;
}
public function Debug_ClearCharacterDevelopment(){
var template : CEntityTemplate;
var entity : CEntity;
var invTesting : CInventoryComponent;
var i : Int32;
var items : array<SItemUniqueId>;
var abs : array<CName>;
delete abilityManager;
delete levelManager;
delete effectManager;
abs = GetAbilities(false);
i = 0;
while (i < abs.Size()){
RemoveAbility(abs[i]);
i += 1;
}
abs.Clear();
GetCharacterStatsParam(abs);
i = 0;
while (i < abs.Size()){
AddAbility(abs[i], /* NOP */);
i += 1;
}
levelManager = new W3LevelManager in this;

levelManager.Initialize();
levelManager.PostInit(this, false);
AddAbility('GeraltSkills_Testing', /* NOP */);
SetAbilityManager();
abilityManager.Init(this, GetCharacterStats(), false, theGame.Ge
tDifficultyMode());
SetEffectManager();
abilityManager.PostInit();
inv.RemoveAllItems();
template = (CEntityTemplate)LoadResource("geralt_inventory_relea
se", /* NOP */);
entity = theGame.CreateEntity(template, Vector(0, 0, 0), /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
invTesting = (CInventoryComponent)entity.GetComponentByClassName
('CInventoryComponent');
invTesting.GiveAllItemsTo(inv, true, /* NOP */);
entity.Destroy();
inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (!inv.ItemHasTag(items[i], 'NoDrop')){
GetWitcherPlayer().EquipItem(items[i], /* NOP */
, /* NOP */);
}
i += 1;
}
Debug_GiveTestingItems(0, /* NOP */);
/* NOP */;
}
public final function Debug_HAX_UnlockSkillSlot(slotIndex : Int32) : Boo
l{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.Debug_HAX_
UnlockSkillSlot(slotIndex);
}
return false;
/* NOP */;
}
public function GetLevelupAbility(id : Int32) : CName{
return levelupAbilities[id];
/* NOP */;
}
public function CanSprint(speed : Float) : Bool{
if (!super.CanSprint(speed)){
return false;
}
if (rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State
_WeaponWait'){
if (GetPlayerCombatStance() == 1){
if (IsSprintActionPressed()){
OnRangedForceHolster(true, false, /* NOP
*/);
}
} else {
return false;
}
}
if (thePlayer.GetCurrentStateName() != 'Swimming' && thePlayer.G
etStat(2, /* NOP */) <= 0){
thePlayer.SetSprintActionPressed(false, true);

return false;
}
return true;
/* NOP */;
}
public function RestoreHorseManager() : Bool{
var horseTemplate : CEntityTemplate;
var horseManager : W3HorseManager;
if (GetHorseManager()){
return false;
}
horseTemplate = (CEntityTemplate)LoadResource("horse_manager", /
* NOP */);
horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplat
e, GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, 2, /* NOP */)
;
horseManager.CreateAttachment(this, /* NOP */, /* NOP */, /* NOP
*/);
horseManager.OnCreated();
EntityHandleSet(horseManagerHandle, horseManager);
return true;
/* NOP */;
}
public final function BlockSignSelection(signType : ESignType, block : B
ool){
if (block && !blockedSigns.Contains(signType)){
blockedSigns.PushBack(signType);
} else if (!block){
blockedSigns.Remove(signType);
}
/* NOP */;
}
public final function IsSignBlocked(signType : ESignType) : Bool{
return blockedSigns.Contains(signType);
/* NOP */;
}
}
class W3SignOwnerPlayer extends W3SignOwner{
public var player : W3PlayerWitcher;
public function Init(parentActor : CActor){
BaseInit(parentActor);
player = (W3PlayerWitcher)parentActor;
LogAssert(player, "W3SignOwnerPlayer initialized with actor that
is not a W3PlayerWitcher");
/* NOP */;
}
public function GetPlayer() : W3PlayerWitcher{
return player;
/* NOP */;
}
public function IsPlayer() : Bool{
return true;
/* NOP */;
}
public function InitCastSign(signEntity : W3SignEntity) : Bool{
if (player.HasStaminaToUseSkill(signEntity.GetSkill(), /* NOP */
, /* NOP */) && player.OnRaiseSignEvent()){
player.OnProcessCastingOrientation(false);
player.SetBehaviorVariable('alternateSignCast', 0, /* NO

P */);
player.SetBehaviorVariable('IsCastingSign', 1, /* NOP */
);
player.BreakPheromoneEffect();
return true;
}
return false;
/* NOP */;
}
public function ChangeAspect(signEntity : W3SignEntity, newSkill : ESkil
l) : Bool{
var newTarget : CActor;
var ret : Bool;
if (!player.CanUseSkill(newSkill)){
ret = false;
} else if (theInput.GetActionValue('CastSignHold') > 0.000000){
if (!player.IsCombatMusicEnabled() && !player.CanAttackW
henNotInCombat(3, true, newTarget, /* NOP */)){
ret = false;
} else {
signEntity.SetAlternateCast(newSkill);
player.SetBehaviorVariable('alternateSignCast',
1, /* NOP */);
ret = true;
}
} else {
ret = false;
}
if (!ret){
signEntity.OnNormalCast();
}
return ret;
/* NOP */;
}
public function GetSkillLevel(skill : ESkill) : Int32{
return player.GetSkillLevel(skill);
/* NOP */;
}
public function SetCurrentlyCastSign(type : ESignType, entity : W3SignEn
tity){
player.SetCurrentlyCastSign(type, entity);
/* NOP */;
}
public function GetSkillAbilityName(skill : ESkill) : CName{
return player.GetSkillAbilityName(skill);
/* NOP */;
}
public function GetSkillAttributeValue(skill : ESkill, attributeName : C
Name, addBaseCharAttribute : Bool, addSkillModsAttribute : Bool) : SAbilityAttri
buteValue{
return player.GetSkillAttributeValue(skill, attributeName, addBa
seCharAttribute, addSkillModsAttribute);
/* NOP */;
}
public function GetPowerStatValue(stat : ECharacterPowerStats, abilityTa
g : CName) : SAbilityAttributeValue{
return player.GetPowerStatValue(stat, abilityTag, /* NOP */);
/* NOP */;
}
public function CanUseSkill(skill : ESkill) : Bool{

return player.CanUseSkill(skill);
/* NOP */;
}
public function IsSkillEquipped(skill : ESkill) : Bool{
return player.IsSkillEquipped(skill);
/* NOP */;
}
public function HasStaminaToUseSkill(skill : ESkill, perSec : Bool, sign
Hack : Bool) : Bool{
return player.HasStaminaToUseSkill(skill, perSec, signHack);
/* NOP */;
}
public function RemoveTemporarySkills(){
player.ResetRawPlayerHeading();
/* NOP */;
}
public function GetHandAimPitch() : Float{
return player.handAimPitch;
/* NOP */;
}
public function OnDelayOrientationChange() : Bool{
return player.OnDelayOrientationChange();
/* NOP */;
}
public function OnProcessCastingOrientation(isContinueCasting : Bool) :
Bool{
return player.OnProcessCastingOrientation(isContinueCasting);
/* NOP */;
}
}
class W3Reputation extends CObject{
public saved var factionReputations : array<W3FactionReputationPoints>;
public var factionName : EFactionName;
public function Initialize(){
if (factionReputations.Size() == 0){
factionReputations.PushBack(new W3FactionReputationPoint
s in this);
factionReputations.PushBack(new W3FactionReputationPoint
s in this);
factionReputations.PushBack(new W3FactionReputationPoint
s in this);
}
/* NOP */;
}
public function SetFactionName(fName : EFactionName){
fName = factionName;
/* NOP */;
}
public function GetFaction(i : Int32) : EFactionName{
if (i == 0){
factionName = 0;
} else if (i == 1){
factionName = 1;
} else if (i == 2){
factionName = 2;
}
return factionName;
/* NOP */;
}

public function GetReputationPoints(fName : EFactionName) : Int32{


var currentRepPoints : Int32;
currentRepPoints = factionReputations[fName].currentReputationPo
ints;
return currentRepPoints;
/* NOP */;
}
public function GetNegativeReputationPoints(fName : EFactionName) : Int3
2{
var negativeRepPoints : Int32;
negativeRepPoints = factionReputations[fName].negativeReputation
Points;
return negativeRepPoints;
/* NOP */;
}
public function ChangeReputationAmongFaction(factionName : EFactionName,
addAmount : Int32){
factionReputations[factionName].currentReputationPoints += addAm
ount;
if (addAmount < 0){
factionReputations[factionName].negativeReputationPoints
+= addAmount;
}
if (factionReputations[factionName].currentReputationPoints < 0)
{
factionReputations[factionName].currentReputationPoints
= 0;
} else if (factionReputations[factionName].currentReputationPoin
ts > 100){
factionReputations[factionName].currentReputationPoints
= 100;
}
/* NOP */;
}
public function GetReputationBonuses(reputationLevels : EReputationLevel
, buyPriceMult : Float, sellPriceMult : Float){
switch(reputationLevels){
case 0:
buyPriceMult = 1.300000;
sellPriceMult = 0.300000;
break;
case 1:
buyPriceMult = 1.150000;
sellPriceMult = 0.850000;
break;
case 2:
buyPriceMult = 1;
sellPriceMult = 1;
break;
case 3:
buyPriceMult = 0.850000;
sellPriceMult = 1.150000;
break;
case 4:
buyPriceMult = 0.700000;
sellPriceMult = 1.300000;
break;
}
/* NOP */;
}

public function GetReputationLevel(factionName : EFactionName) : EReputa


tionLevel{
var reputationLevel : EReputationLevel;
var reputationPoints : Int32;
reputationPoints = factionReputations[factionName].currentReputa
tionPoints;
if (reputationPoints <= 15){
reputationLevel = 0;
} else if (reputationPoints <= 40){
reputationLevel = 1;
} else if (reputationPoints <= 60){
reputationLevel = 2;
} else if (reputationPoints <= 80){
reputationLevel = 3;
} else {
reputationLevel = 4;
}
return reputationLevel;
/* NOP */;
}
public function ResetNegativeReputationPoints(factionName : EFactionName
){
factionReputations[factionName].currentReputationPoints -= facti
onReputations[factionName].negativeReputationPoints;
factionReputations[factionName].negativeReputationPoints = 0;
/* NOP */;
}
}
class W3MedallionController extends CObject{
public var deactivateTimer : Float;
public var instantIntensity : Float;
public var isBlocked : Bool;
public var focusModeFactor : Float;
public const var defaultDuration : Float;
public const var defaultTreshold : Float;
public const var maxTreshold : Float;
public function SetInstantIntensity(intensity : Float){
instantIntensity = intensity * maxTreshold;
/* NOP */;
}
public function Activate(activate : Bool, duration : Float){
if (activate){
if (duration == 0.000000){
duration = defaultDuration;
}
deactivateTimer = MaxF(deactivateTimer, theGame.GetEngin
eTimeAsSeconds() + duration);
} else {
deactivateTimer = theGame.GetEngineTimeAsSeconds();
}
/* NOP */;
}
public function BlockActivation(block : Bool){
isBlocked = block;
/* NOP */;
}
public function IsActive() : Bool{
return !isBlocked && focusModeFactor > 0.000000 && instantIntens
ity > 0.000000 || theGame.GetEngineTimeAsSeconds() < deactivateTimer;

/* NOP */;
}
public function GetTreshold() : Float{
if (theGame.GetEngineTimeAsSeconds() < deactivateTimer){
return MaxF(defaultTreshold, instantIntensity) * focusMo
deFactor;
}
return instantIntensity * focusModeFactor;
/* NOP */;
}
public function SetFocusModeFactor(factor : Float){
focusModeFactor = factor;
/* NOP */;
}
}
import statemachine struct CR4Player{
protected var pcGamePlayInitialized : Bool;
private var pcMode : Bool;
protected saved var weaponHolster : WeaponHolster;
public var rangedWeapon : Crossbow;
private var hitReactTransScale : Float;
private var bIsCombatActionAllowed : Bool;
private var currentCombatAction : EBufferActionType;
private var uninterruptedHitsCount : Int32;
private var uninterruptedHitsCameraStarted : Bool;
private var uninterruptedHitsCurrentCameraEffect : CName;
private var counterTimestamps : array<EngineTime>;
private var hitReactionEffect : Bool;
private var lookAtPosition : Vector;
private var orientationTarget : EOrientationTarget;
private var customOrientationTarget : EOrientationTarget;
protected var customOrientationStack : array<SCustomOrientationParams>;
public var delayOrientationChange : Bool;
protected var delayCameraOrientationChange : Bool;
private var actionType : Int32;
private var customOrientationStackIndex : Int32;
private var emptyMoveTargetTimer : Float;
private var onlyOneEnemyLeft : Bool;
public var isInFinisher : Bool;
private var finisherTarget : CGameplayEntity;
private var combatStance : EPlayerCombatStance;
public var approachAttack : Int32;
protected var specialAttackCamera : Bool;
private var specialAttackTimeRatio : Float;
public saved var itemsPerLevel : array<CName>;
public var itemsPerLevelGiven : array<Bool>;
private var playerTickTimerPhase : Int32;
protected var evadeHeading : Float;
public var vehicleCbtMgrAiming : Bool;
public var specialHeavyChargeDuration : Float;
public var specialHeavyStartEngineTime : EngineTime;
public var playedSpecialAttackMissingResourceSound : Bool;
private var noSaveLockCombatActionName : String;
private var noSaveLockCombatAction : Int32;
private var deathNoSaveLock : Int32;
private var noSaveLock : Int32;
protected saved var newGamePlusInitialized : Bool;
protected var BufferAllSteps : Bool;
protected var BufferCombatAction : EBufferActionType;

protected var BufferButtonStage : EButtonStage;


private var keepRequestingCriticalAnimStart : Bool;
private var currentCustomAction : EPlayerExplorationAction;
public var substateManager : CExplorationStateManager;
protected var isOnBoat : Bool;
protected var isInShallowWater : Bool;
public var medallion : W3MedallionFX;
protected var lastMedallionEffect : Float;
private var isInRunAnimation : Bool;
public var interiorTracker : CPlayerInteriorTracker;
public var m_SettlementBlockCanter : Int32;
private var fistFightMinigameEnabled : Bool;
private var isFFMinigameToTheDeath : Bool;
private var FFMinigameEndsithBS : Bool;
public var fistFightTeleportNode : CNode;
public var isStartingFistFightMinigame : Bool;
public var GeraltMaxHealth : Float;
public var fistsItems : array<SItemUniqueId>;
private var gwintAiDifficulty : EGwintDifficultyMode;
private var gwintAiAggression : EGwintAggressionMode;
private var gwintMinigameState : EMinigameState;
private var currentlyMountedHorse : CNewNPC;
private var horseSummonTimeStamp : Float;
private saved var isHorseRacing : Bool;
private var horseCombatSlowMo : Bool;
private var HudMessages : array<String>;
protected var fShowToLowStaminaIndication : Float;
public var showTooLowAdrenaline : Bool;
private var HAXE3Container : W3Container;
private var HAXE3bAutoLoot : Bool;
private var bShowHud : Bool;
private var dodgeFeedbackTarget : CActor;
public saved var displayedQuestsGUID : array<CGUID>;
public saved var rewardsMultiplier : array<SRewardMultiplier>;
public saved var glossaryImageOverride : array<SGlossaryImageOverride>;
private var prevRawLeftJoyRot : Float;
protected var explorationInputContext : CName;
protected var combatInputContext : CName;
protected var combatFistsInputContext : CName;
private var isInsideInteraction : Bool;
private var isInsideHorseInteraction : Bool;
public var horseInteractionSource : CEntity;
public var nearbyLockedContainersNoKey : array<W3LockableEntity>;
private var bMoveTargetChangeAllowed : Bool;
private var moveAdj : CMovementAdjustor;
private var defaultLocomotionController : CR4LocomotionPlayerControllerS
cript;
private var canFollowNpc : Bool;
private var actorToFollow : CActor;
public var terrainPitch : Float;
public var steepSlopeNormalPitch : Float;
public var disableSprintTerrainPitch : Float;
private var submergeDepth : Float;
private var m_useSelectedItemIfSpawned : Bool;
public var navQuery : CNavigationReachabilityQueryInterface;
public saved var rememberedCustomHead : CName;
public editable var delayBetweenIllusionOneliners : Float;
private var battlecry_timeForNext : Float;
private var battlecry_delayMin : Float;
private var battlecry_delayMax : Float;

private var battlecry_lastTry : CName;


private var previousWeather : CName;
private var previousRainStrength : Float;
protected var receivedDamageInCombat : Bool;
protected var prevDayNightIsNight : Bool;
public var failedFundamentalsFirstAchievementCondition : Bool;
private var spawnedTime : Float;
public var currentMonsterHuntInvestigationArea : W3MonsterHuntInvestigat
ionArea;
private var isPerformingPhaseChangeAnimation : Bool;
public var playerMode : W3PlayerMode;
protected saved var selectedItemId : SItemUniqueId;
protected saved var blockedRadialSlots : array<SRadialSlotDef>;
public var enemyCollectionDist : Float;
public var findMoveTargetDistMin : Float;
public var findMoveTargetDistMax : Float;
private var findMoveTargetScaledFrame : Float;
public var interactDist : Float;
protected var bCanFindTarget : Bool;
private var bIsConfirmingEmptyTarget : Bool;
private var displayTarget : CGameplayEntity;
private var isShootingFriendly : Bool;
private var currentSelectedTarget : CActor;
private var selectedTargetToConfirm : CActor;
private var bConfirmTargetTimerIsEnabled : Bool;
public saved var thrownEntityHandle : EntityHandle;
private var isThrowingItemWithAim : Bool;
private saved var isThrowingItem : Bool;
private var isThrowHoldPressed : Bool;
private var isAimingCrossbow : Bool;
public var playerAiming : PlayerAiming;
public var forceDismember : Bool;
public var forceDismemberName : CName;
public var forceDismemberChance : Int32;
public var forceDismemberExplosion : Bool;
private var finisherVictim : CActor;
public var forceFinisher : Bool;
public var forceFinisherAnimName : CName;
public var forceFinisherChance : Int32;
public var forcedStance : Bool;
private var m_WeaponFXCollisionGroupNames : array<CName>;
private var m_CollisionEffect : CEntity;
private var m_LastWeaponTipPos : Vector;
private var m_CollisionFxTemplate : CEntityTemplate;
private var m_RefreshWeaponFXType : Bool;
private var m_PlayWoodenFX : Bool;
private var m_activePoster : W3Poster;
public var horseOnNavMesh : Bool;
public var testAdjustRequestedMovementDirection : Bool;
public var targeting : CR4PlayerTargeting;
public var targetingPrecalcs : SR4PlayerTargetingPrecalcs;
public var targetingIn : SR4PlayerTargetingIn;
public var targetingOut : SR4PlayerTargetingOut;
public var useNativeTargeting : Bool;
public var visibleActors : array<CActor>;
public var visibleActorsTime : array<Float>;
private var parryTarget : CActor;
private var ragdollTarget : CActor;
private var playerActionEventListeners : array<CGameplayEntity>;
private var playerActionEventBlockingListeners : array<CGameplayEntity>;

private var playerActionSlotAnimName : CName;


private var isHoldingDeadlySword : Bool;
private var reevaluateCurrentWeapon : Bool;
protected var disableActionBlend : Bool;
protected var slideNPC : CNewNPC;
protected var minSlideDistance : Float;
protected var slideTicket : SMovementAdjustmentRequestTicket;
private var gwintCardNumbersArray : array<Int32>;
protected var customCameraStack : array<SCustomCameraParams>;
private var questCameraRequest : SQuestCameraRequest;
private var cameraRequestTimeStamp : Float;
public var wasRunning : Bool;
public var vel : Float;
public var smoothTime : Float;
public var constDamper : ConstDamper;
public var rotMultVel : Float;
public var wasBRAxisPushed : Bool;
private var fovVel : Float;
private var sprintOffset : Vector;
private var previousOffset : Bool;
private var previousRotationVelocity : Float;
private var pivotRotationTimeStamp : Float;
private var disableManualCameraControlStack : array<CName>;
public var customOrientationInfoStack : array<SCustomOrientationInfo>;
private var isSnappedToNavMesh : Bool;
private var snapToNavMeshCachedFlag : Bool;
public saved var navMeshSnapInfoStack : array<CName>;
private var beingWarnedBy : array<CActor>;
protected var hostileEnemies : array<CActor>;
private var hostileMonsters : array<CActor>;
public var canFindPathEnemiesList : array<CActor>;
public var disablecanFindPathEnemiesListUpdate : Bool;
private var lastCanFindPathEnemy : CActor;
private var cachedMoveTarget : CActor;
private var reachabilityTestId : Int32;
private var reachabilityTestId2 : Int32;
public var finishableEnemiesList : array<CActor>;
private var hostileEnemyToRemove : CActor;
private var moveTargets : array<CActor>;
protected var enableStrafe : Bool;
public var isInCombatReason : Int32;
public var canFindPathToEnemy : Bool;
public var combatModeEnt : CEntity;
public var navDist : Float;
public var directDist : Float;
public var reachableEnemyWasTooFar : Bool;
public var reachableEnemyWasTooFarTimeStamp : Float;
public var reachablilityFailed : Bool;
public var reachablilityFailedTimeStamp : Float;
private var isThreatened : Bool;
private var bConfirmDisplayTargetTimerEnabled : Bool;
private var displayTargetToConfirm : CGameplayEntity;
private var currentSelectedDisplayTarget : CGameplayEntity;
private var isDisplayTargetTargetable : Bool;
public var radialSlots : array<CName>;
public var combatModeColor : Color;
private var confirmCombatStanceTimeStamp : Float;
private var isConfirmingCombatStance : Bool;
private var isInHolsterAnim : Bool;
private var dodgeTimerRunning : Bool;

public var forceCanAttackWhenNotInCombat : Int32;


public var countDownToStart : Int32;
private var inWaterTrigger : Bool;
protected var isRotatingInPlace : Bool;
private var isInGuardedState : Bool;
private var restoreUsableItem : Bool;
private var holsterUsableItem : Bool;
private var finisherSaveLock : Int32;
protected saved var currentlyUsingItem : Bool;
private const var MOUNT_DISTANCE_CBT : Float;
private const var MOUNT_ANGLE_CBT : Float;
private const var MOUNT_ANGLE_EXP : Float;
private saved var m_bossTag : CName;
public var loopingCameraShakeAnimName : CName;
//NULL type for horseWithInventory
import public final function IsInInterior() : Bool;
import public final function IsInSettlement() : Bool;
import public final function EnterSettlement(isEntering : Bool);
import public final function GetEnemiesInRange(enemies : array<CActor>);
import public final function GetVisibleEnemies(enemies : array<CActor>);
import public final function IsEnemyVisible(enemy : CActor) : Bool;
import public final function SetupEnemiesCollection(range : Float, heigh
tTolerance : Float, maxEnemies : Int32, tag : CName, flags : Int32);
import public final function ActionDirectControl(controller : CR4Locomot
ionDirectController) : Bool;
import public final function GetCombatDataComponent() : CCombatDataCompo
nent;
import public final function SetPlayerTarget(target : CActor);
import public final function SetPlayerCombatTarget(target : CActor);
import public final function ObtainTicketFromCombatTarget(ticketName : C
Name, ticketsCount : Int32);
import public final function FreeTicketAtCombatTarget();
import public final function SetScriptMoveTarget(target : CActor);
import public final function GetRiderData() : CAIStorageRiderData;
import public final function SetIsInCombat(inCombat : Bool);
import public final function SetBacklightFromHealth(healthPercentage : F
loat);
import private final function SetBacklightColor(color : Vector);
import public final function GetTemplatePathAndAppearance(templatePath :
String, appearance : CName);
import public final function HACK_BoatDismountPositionCorrection(slotPos
: Vector);
import public final function SaveLastMountedHorse(mountedHorse : CActor)
;
import public final function HACK_ForceGetBonePosition(boneIndex : Int32
) : Vector;
public function SetPlayedSpecialAttackMissingResourceSound(b : Bool){
playedSpecialAttackMissingResourceSound = b;
/* NOP */;
}
public function EnablePCMode(flag : Bool){
pcMode = flag;
/* NOP */;
}
public function IsPCModeEnabled() : Bool{
return pcMode && theInput.LastUsedPCInput();
/* NOP */;
}
public function ShouldUsePCModeTargeting() : Bool{
return IsPCModeEnabled() && !lastAxisInputIsMovement;

/* NOP */;
}
public function SetDodgeFeedbackTarget(target : CActor){
dodgeFeedbackTarget = target;
/* NOP */;
}
public function GetDodgeFeedbackTarget() : CActor{
return dodgeFeedbackTarget;
/* NOP */;
}
public function SetSubmergeDepth(depth : Float){
submergeDepth = depth;
/* NOP */;
}
public function GetSubmergeDepth() : Float{
return submergeDepth;
/* NOP */;
}
public function SetActivePoster(poster : W3Poster){
m_activePoster = poster;
/* NOP */;
}
public function RemoveActivePoster(){
m_activePoster = NULL;
/* NOP */;
}
public function GetActivePoster() : W3Poster{
return m_activePoster;
/* NOP */;
}
public function SetHorseNav(val : Bool){
horseOnNavMesh = val;
/* NOP */;
}
public function GetLevel() : Int32{
return 0;
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
AddAnimEventCallback('ThrowHoldTest', 'OnAnimEvent_ThrowHoldTest
');
AddAnimEventCallback('OnWeaponDrawReady', 'OnAnimEvent_OnWeaponD
rawReady');
AddAnimEventCallback('OnWeaponHolsterReady', 'OnAnimEvent_OnWeap
onHolsterReady');
AddAnimEventCallback('AllowTempLookAt', 'OnAnimEvent_AllowTempLo
okAt');
AddAnimEventCallback('SlideToTarget', 'OnAnimEvent_SlideToTarget
');
AddAnimEventCallback('PlayFinisherBlood', 'OnAnimEvent_PlayFinis
herBlood');
AddAnimEventCallback('SlowMo', 'OnAnimEvent_SlowMo');
AddAnimEventCallback('BloodTrailForced', 'OnAnimEvent_BloodTrail
Forced');
AddAnimEventCallback('FadeOut', 'OnAnimEvent_FadeOut');
AddAnimEventCallback('FadeIn', 'OnAnimEvent_FadeIn');
AddAnimEventCallback('DisallowHitAnim', 'OnAnimEvent_DisallowHit
Anim');
AddAnimEventCallback('AllowFall', 'OnAnimEvent_AllowFall');
AddAnimEventCallback('AllowFall2', 'OnAnimEvent_AllowFall2');

AddAnimEventCallback('DettachGround', 'OnAnimEvent_DettachGround
');
AddAnimEventCallback('KillWithRagdoll', 'OnAnimEvent_KillWithRag
doll');
AddAnimEventCallback('pad_vibration', 'OnAnimEvent_pad_vibration
');
AddAnimEventCallback('pad_vibration_light', 'OnAnimEvent_pad_vib
ration_light');
AddAnimEventCallback('RemoveBurning', 'OnAnimEvent_RemoveBurning
');
AddItemPerLevelList();
enemyCollectionDist = findMoveTargetDistMax;
if (!spawnData.restored && !(W3ReplacerCiri)this){
AddTimer('GiveStartingItems', 0.000010, true, /* NOP */,
/* NOP */, true, /* NOP */);
if (!theGame.IsFinalBuild()){
AddAbility('GeraltSkills_Testing', /* NOP */);
AddTimer('Debug_GiveTestingItems', 0.000100, tru
e, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
InitTargeting();
if (spawnData.restored){
}
if (!weaponHolster){
weaponHolster = new WeaponHolster in this;
}
weaponHolster.Initialize(this, spawnData.restored);
if (!interiorTracker){
interiorTracker = new CPlayerInteriorTracker in this;
}
interiorTracker.Init(spawnData.restored);
super.OnSpawned(spawnData);
medallion = new W3MedallionFX in this;
playerMode = new W3PlayerMode in this;
playerMode.Initialize(this);
playerAiming = new PlayerAiming in this;
playerAiming.Initialize(this);
navQuery = new CNavigationReachabilityQueryInterface in this;
EnableFindTarget(true);
AddTimer('CombatCheck', 0.200000, true, /* NOP */, /* NOP */, /*
NOP */, /* NOP */);
substateManager = (CExplorationStateManager)GetComponentByClassN
ame('CExplorationStateManager');
findMoveTargetDist = findMoveTargetDistMax;
super.SetupEnemiesCollection(enemyCollectionDist, findMoveTarget
Dist, 10, 'None', 64 + 256 + 128 + 4);
inputHandler.RemoveLocksOnSpawn();
SetInteractionPriority(0);
prevDayNightIsNight = theGame.envMgr.IsNight();
CheckDayNightCycle();
EnableVisualDebug(1, true);
FactsRemove("blocked_illusion_oneliner");
super.SetFailedFundamentalsFirstAchievementCondition(false);
m_CollisionFxTemplate = (CEntityTemplate)LoadResource('sword_col
ision_fx', /* NOP */);
if (m_WeaponFXCollisionGroupNames.Size() == 0){
m_WeaponFXCollisionGroupNames.PushBack('Static');
m_WeaponFXCollisionGroupNames.PushBack('Foliage');
m_WeaponFXCollisionGroupNames.PushBack('Fence');

m_WeaponFXCollisionGroupNames.PushBack('BoatSide');
m_WeaponFXCollisionGroupNames.PushBack('Door');
m_WeaponFXCollisionGroupNames.PushBack('RigidBody');
m_WeaponFXCollisionGroupNames.PushBack('Dynamic');
m_WeaponFXCollisionGroupNames.PushBack('Destructible');
}
super.ResetPadBacklightColor(/* NOP */);
if (spawnData.restored){
if (IsCurrentlyUsingItemL()){
if (inv.HasItemById(currentlyEquipedItemL)){
OnUseSelectedItem(/* NOP */);
} else {
HideUsableItem(true);
}
}
if (GetCurrentMeleeWeaponType() == 1 || GetCurrentMeleeW
eaponType() == 2){
OnEquipMeleeWeapon(GetCurrentMeleeWeaponType(),
true, true);
}
AddTimer('UnmountCrossbowTimer', 0.010000, true, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
ClearBlockedSlots();
}
(CR4PlayerStateSwimming)GetState('Swimming').OnParentSpawned();
spawnedTime = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function GetTimeSinceSpawned() : Float{
return theGame.GetEngineTimeAsSeconds() - spawnedTime;
/* NOP */;
}
public timer function UnmountCrossbowTimer(optional dt : Float, optional
id : Int32){
var itemId : SItemUniqueId;
itemId = inv.GetItemFromSlot('l_weapon');
if (inv.IsIdValid(itemId) && inv.IsItemCrossbow(itemId)){
rangedWeapon = (Crossbow)inv.GetItemEntityUnsafe(itemId)
;
if (rangedWeapon){
rangedWeapon.Initialize((CActor)rangedWeapon.Get
ParentEntity());
OnRangedForceHolster(true, true, /* NOP */);
RemoveTimer('UnmountCrossbowTimer', /* NOP */);
}
} else {
RemoveTimer('UnmountCrossbowTimer', /* NOP */);
}
/* NOP */;
}
public function OnDestroyed() : Bool{
playerAiming.RemoveAimingSloMo();
if (rangedWeapon){
rangedWeapon.ClearDeployedEntity(true);
}
super.ResetPadBacklightColor(/* NOP */);
theGame.ReleaseNoSaveLock(noSaveLock);
/* NOP */;
}
public function ClearBlockedSlots(){

var i : Int32;
i = 0;
while (i < blockedRadialSlots.Size()){
if (!IsSwimming()){
if (EnableRadialSlot(blockedRadialSlots[i].slotN
ame, 'swimming')){
i -= 1;
}
} else if (!IsUsingVehicle()){
if (EnableRadialSlot(blockedRadialSlots[i].slotN
ame, 'useVehicle')){
i -= 1;
}
} else if (!IsCurrentlyUsingItemL() || !IsUsableItemLBlo
cked()){
if (EnableRadialSlot(blockedRadialSlots[i].slotN
ame, 'usableItemL')){
i -= 1;
}
}
i += 1;
}
/* NOP */;
}
public function RestoreBlockedSlots(){
var i : Int32;
var slotsToBlock : array<CName>;
i = 0;
while (i < blockedRadialSlots.Size()){
slotsToBlock.PushBack(blockedRadialSlots[i].slotName);
i += 1;
}
if (slotsToBlock.Size() > 0){
EnableRadialSlots(false, slotsToBlock);
}
/* NOP */;
}
private function DisableRadialSlot(slotName : CName, sourceName : CName)
: Bool{
var i : Int32;
var k : Int32;
var slotsToBlock : array<CName>;
var blockedRadialSlotEntry : SRadialSlotDef;
slotsToBlock.PushBack(slotName);
i = 0;
while (i < blockedRadialSlots.Size()){
if (blockedRadialSlots[i].slotName == slotName){
if (sourceName != 'None'){
k = 0;
while (k < blockedRadialSlots[i].disable
dBySources.Size()){
if (blockedRadialSlots[i].disabl
edBySources[k] == sourceName){
return false;
}
k += 1;
}
blockedRadialSlots[i].disabledBySources.
PushBack(sourceName);
return false;

}
return false;
}
i += 1;
}
blockedRadialSlotEntry = InitBlockedRadialSlotEntry(slotName);
if (sourceName != 'None'){
blockedRadialSlotEntry.disabledBySources.PushBack(source
Name);
}
blockedRadialSlots.PushBack(blockedRadialSlotEntry);
EnableRadialSlots(false, slotsToBlock);
return true;
/* NOP */;
}
public function EnableRadialSlot(slotName : CName, sourceName : CName) :
Bool{
var i : Int32;
var k : Int32;
var slotsToBlock : array<CName>;
slotsToBlock.PushBack(slotName);
i = 0;
while (i < blockedRadialSlots.Size()){
if (blockedRadialSlots[i].slotName == slotName){
if (sourceName != 'None'){
k = 0;
while (k < blockedRadialSlots[i].disable
dBySources.Size()){
if (blockedRadialSlots[i].disabl
edBySources[k] == sourceName){
blockedRadialSlots[i].di
sabledBySources.Remove(blockedRadialSlots[i].disabledBySources[k]);
}
k += 1;
}
}
if (blockedRadialSlots[i].disabledBySources.Size
() <= 0){
blockedRadialSlots.Remove(blockedRadialS
lots[i]);
EnableRadialSlots(true, slotsToBlock);
return true;
}
return false;
}
i += 1;
}
return false;
/* NOP */;
}
private function InitBlockedRadialSlotEntry(slotName : CName) : SRadialS
lotDef{
var blockedRadialSlotEntry : SRadialSlotDef;
blockedRadialSlotEntry.slotName = slotName;
return blockedRadialSlotEntry;
/* NOP */;
}
public function EnableRadialSlotsWithSource(enable : Bool, slotsToBlock
: array<CName>, sourceName : CName){
var i : Int32;

i = 0;
while (i < slotsToBlock.Size()){
if (enable){
EnableRadialSlot(slotsToBlock[i], sourceName);
} else {
DisableRadialSlot(slotsToBlock[i], sourceName);
}
i += 1;
}
if (blockedRadialSlots.Size() <= 0){
blockedRadialSlots.Clear();
}
/* NOP */;
}
public function RepairItem(out rapairKitId : SItemUniqueId, out usedOnIt
em : SItemUniqueId){
}
public function HasRepairAbleGearEquiped() : Bool{
}
public function HasRepairAbleWaponEquiped() : Bool{
}
public function IsItemRepairAble(out item : SItemUniqueId) : Bool{
}
public function ApplyOil(out oilId : SItemUniqueId, out usedOnItem : SIt
emUniqueId){
}
public function IsEquippedSwordUpgradedWithOil(out steel : Bool, out oil
Name : CName) : Bool{
}
public function GetOilAppliedOnSword(out steel : Bool) : CName{
}
public function CanApplyOilOnItem(oilId : SItemUniqueId, usedOnItem : SI
temUniqueId) : Bool{
if (inv.ItemHasTag(oilId, theGame.params.TAG_STEEL_OIL) && inv.I
sItemSteelSwordUsableByPlayer(usedOnItem)){
return true;
}
if (inv.ItemHasTag(oilId, theGame.params.TAG_SILVER_OIL) && inv.
IsItemSilverSwordUsableByPlayer(usedOnItem)){
return true;
}
return false;
/* NOP */;
}
public final function DidFailFundamentalsFirstAchievementCondition() : B
ool{
return failedFundamentalsFirstAchievementCondition;
/* NOP */;
}
public final function SetFailedFundamentalsFirstAchievementCondition(b :
Bool){
var i : Int32;
var npc : CNewNPC;
failedFundamentalsFirstAchievementCondition = b;
if (failedFundamentalsFirstAchievementCondition){
i = 0;
while (i < hostileEnemies.Size()){
if (hostileEnemies[i].HasTag(theGame.params.MONS
TER_HUNT_ACTOR_TAG)){
npc = (CNewNPC)hostileEnemies[i];

npc.AddTag('failedFundamentalsAchievemen
t');
npc.AddTimer('FundamentalsAchFailTimer',
30 * 60, /* NOP */, /* NOP */, /* NOP */, true, true);
}
i += 1;
}
}
/* NOP */;
}
public function IsInCombatFist() : Bool{
return GetCurrentStateName() == 'CombatFists';
/* NOP */;
}
public function IsInitialized() : Bool{
}
public function IsCiri() : Bool{
return (W3ReplacerCiri)this;
/* NOP */;
}
protected function WouldLikeToMove() : Bool{
var speedVec : Vector;
var speed : Float;
var speedMult : Float;
speedVec.X = theInput.GetActionValue('GI_AxisLeftX');
speedVec.Y = theInput.GetActionValue('GI_AxisLeftY');
speed = VecLength2D(speedVec);
return speed > 0.100000;
/* NOP */;
}
public function HandleMovement(deltaTime : Float){
if (WouldLikeToMove()){
SetBehaviorVariable('playerWouldLikeToMove', 1.000000, /
* NOP */);
} else {
SetBehaviorVariable('playerWouldLikeToMove', 0.000000, /
* NOP */);
}
super.HandleMovement(deltaTime);
/* NOP */;
}
public function BattleCryIsReady() : Bool{
var l_currentTime : Float;
l_currentTime = theGame.GetEngineTimeAsSeconds();
if (l_currentTime >= battlecry_timeForNext){
return true;
}
return false;
/* NOP */;
}
public function PlayBattleCry(_BattleCry : CName, _Chance : Float, _Igno
reDelay : Bool, ignoreRepeatCheck : Bool){
var l_randValue : Float;
var fact : Int32;
fact = FactsQuerySum("force_stance_normal");
if (IsSwimming() || theGame.IsDialogOrCutscenePlaying() || IsInN
onGameplayCutscene() || IsInGameplayScene() || theGame.IsCurrentlyPlayingNonGame
playScene() || theGame.IsFading() || theGame.IsBlackscreen() || FactsQuerySum("f
orce_stance_normal") > 0){
return;

}
if (!ignoreRepeatCheck){
if (battlecry_lastTry == _BattleCry){
return;
}
}
battlecry_lastTry = _BattleCry;
l_randValue = RandF();
if (l_randValue < _Chance && _IgnoreDelay || BattleCryIsReady())
{
thePlayer.PlayVoiceset(90, _BattleCry, /* NOP */);
battlecry_timeForNext = theGame.GetEngineTimeAsSeconds()
+ RandRangeF(battlecry_delayMax, battlecry_delayMin);
}
/* NOP */;
}
public final function OnWeatherChanged(){
if (IsInInterior() || GetCurrentStateName() != 'Exploration' ||
theGame.IsDialogOrCutscenePlaying() || IsInNonGameplayCutscene() || IsInGameplay
Scene() || theGame.IsCurrentlyPlayingNonGameplayScene() || theGame.IsFading() ||
theGame.IsBlackscreen() || GetTimeSinceSpawned() < 60){
return;
}
AddTimer('CommentOnWeather', 1, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
/* NOP */;
}
public final timer function CommentOnWeather(optional _Delta : Float, op
tional _Id : Int32){
var l_weather : CName;
var l_currentArea : EAreaName;
var l_rand : Float;
l_weather = GetWeatherConditionName();
l_currentArea = theGame.GetCommonMapManager().GetCurrentArea();
switch(l_weather){
case 'WT_Clear':
l_rand = RandF();
if (l_rand > 0.660000 && !AreaIsCold() && theGame.envMgr
.IsDay()){
thePlayer.PlayVoiceset(90, 'WeatherHot', /* NOP
*/);
} else if (l_rand > 0.330000){
thePlayer.PlayVoiceset(90, 'WeatherClearingUp',
/* NOP */);
}
break;
case 'WT_Rain_Storm':
thePlayer.PlayVoiceset(90, 'WeatherStormy', /* NOP */);
break;
case 'WT_Light_Clouds':
if (previousRainStrength < GetRainStrength()){
thePlayer.PlayVoiceset(90, 'WeatherLooksLikeRain
', /* NOP */);
} else if (AreaIsCold() && previousWeather == 'WT_Clear'
){
thePlayer.PlayVoiceset(90, 'WeatherCold', /* NOP
*/);
}
break;
case 'WT_Mid_Clouds':

if (previousRainStrength < GetRainStrength()){


thePlayer.PlayVoiceset(90, 'WeatherRaining', /*
NOP */);
} else if (AreaIsCold() && previousWeather == 'WT_Clear'
){
thePlayer.PlayVoiceset(90, 'WeatherCold', /* NOP
*/);
}
break;
case 'WT_Mid_Clouds_Dark':
if (previousWeather != 'WT_Heavy_Clouds' && previousWeat
her != 'WT_Heavy_Clouds_Dark'){
thePlayer.PlayVoiceset(90, 'WeatherWindy', /* NO
P */);
}
break;
case 'WT_Heavy_Clouds':
if (previousWeather != 'WT_Mid_Clouds_Dark' && previousW
eather != 'WT_Heavy_Clouds_Dark'){
thePlayer.PlayVoiceset(90, 'WeatherWindy', /* NO
P */);
}
break;
case 'WT_Heavy_Clouds_Dark':
if (thePlayer.IsOnBoat()){
thePlayer.PlayVoiceset(90, 'WeatherSeaWillStorm'
, /* NOP */);
} else if (previousRainStrength < GetRainStrength()){
thePlayer.PlayVoiceset(90, 'WeatherLooksLikeRain
', /* NOP */);
} else {
thePlayer.PlayVoiceset(90, 'WeatherWindy', /* NO
P */);
}
break;
case 'WT_Snow':
if (RandF() > 0.500000){
thePlayer.PlayVoiceset(90, 'WeatherSnowy', /* NO
P */);
} else {
thePlayer.PlayVoiceset(90, 'WeatherCold', /* NOP
*/);
}
break;
}
previousRainStrength = GetRainStrength();
previousWeather = l_weather;
/* NOP */;
}
public function CanUpdateMovement() : Bool{
if (rangedWeapon && GetBehaviorVariable('fullBodyAnimWeight', /*
NOP */) >= 1.000000 && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait'
){
return false;
}
return true;
/* NOP */;
}
public function SetDefaultLocomotionController(){
if (!defaultLocomotionController){

defaultLocomotionController = new CR4LocomotionPlayerCon


trollerScript in this;
}
super.ActionDirectControl(defaultLocomotionController);
/* NOP */;
}
public function OnPlayerTickTimer(deltaTime : Float) : Bool{
var focusModeController : CFocusModeController;
var cnt : Int32;
super.OnPlayerTickTimer(deltaTime);
HandleMovement(deltaTime);
if (playerAiming.GetCurrentStateName() == 'Aiming'){
FindTarget(/* NOP */, /* NOP */, /* NOP */);
FindNonActorTarget(false, /* NOP */);
UpdateDisplayTarget(/* NOP */, /* NOP */);
UpdateLookAtTarget();
} else if (playerTickTimerPhase == 0){
FindTarget(/* NOP */, /* NOP */, /* NOP */);
} else if (playerTickTimerPhase == 1){
FindNonActorTarget(false, /* NOP */);
} else if (playerTickTimerPhase == 2){
UpdateDisplayTarget(/* NOP */, /* NOP */);
UpdateLookAtTarget();
}
playerTickTimerPhase = playerTickTimerPhase + 1 % 3;
focusModeController = theGame.GetFocusModeController();
focusModeController.UpdateFocusInteractions(deltaTime);
cnt = effectManager.GetCriticalBuffsCount() > 0;
SetBehaviorVariable('hasCriticalBuff', cnt, /* NOP */);
/* NOP */;
}
public function OnDeath(damageAction : W3DamageAction) : Bool{
super.OnDeath(damageAction);
RemoveTimer('RequestCriticalAnimStart', /* NOP */);
EnableFindTarget(false);
BlockAllActions('Death', true, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
EnableHardLock(false);
theGame.CreateNoSaveLock('player_death', deathNoSaveLock, false,
false);
theGame.SetDeathSaveLockId(deathNoSaveLock);
ClearHostileEnemiesList();
RemoveReactions();
super.SetPlayerCombatTarget(NULL);
OnEnableAimingMode(false);
/* NOP */;
}
public function OnRevived(){
super.OnRevived();
BlockAllActions('Death', false, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
theGame.ReleaseNoSaveLock(deathNoSaveLock);
RestartReactionsIfNeeded();
/* NOP */;
}
public function CanStartTalk() : Bool{
if (beingWarnedBy.Size() > 0){
return false;
}
return super.CanStartTalk();

/* NOP */;
}
public function AddCounterTimeStamp(time : EngineTime){
counterTimestamps.PushBack(time);
/* NOP */;
}
public function CheckCounterSpamming(attacker : CActor) : Bool{
var counterWindowStartTime : EngineTime;
var i : Int32;
var spamCounter : Int32;
var reflexAction : Bool;
var testEngineTime : EngineTime;
if (!attacker){
return false;
}
counterWindowStartTime = (CNewNPC)attacker.GetCounterWindowStart
Time();
spamCounter = 0;
reflexAction = false;
if (counterWindowStartTime == testEngineTime){
return false;
}
i = counterTimestamps.Size() - 1;
while (i >= 0){
if (counterTimestamps[i] >= counterWindowStartTime - Eng
ineTimeFromFloat(0.400000)){
spamCounter += 1;
} else {
counterTimestamps.Remove(counterTimestamps[i]);
continue;
}
if (!reflexAction && counterTimestamps[i] >= counterWind
owStartTime){
reflexAction = true;
}
i -= 1;
}
if (spamCounter == 1 && reflexAction){
return true;
}
return false;
/* NOP */;
}
protected function PerformCounterCheck(parryInfo : SParryInfo) : Bool{
var mult : Float;
var parryType : EParryType;
var validCounter : Bool;
var useKnockdown : Bool;
var slideDistance : Float;
var duration : Float;
var playerToTargetRot : EulerAngles;
var zDifference : Float;
var effectType : EEffectType;
var repelType : EPlayerRepelType;
var params : SCustomEffectParams;
var thisPos : Vector;
var attackerPos : Vector;
var fistFightCheck : Bool;
var fistFightCounter : Bool;
var attackerInventory : CInventoryComponent;

var weaponId : SItemUniqueId;


var weaponTags : array<CName>;
repelType = 0;
if (ShouldProcessTutorial('TutorialDodge') || ShouldProcessTutor
ial('TutorialCounter')){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(13));
FactsRemove("tut_fight_slomo_ON");
}
if (!parryInfo.canBeParried){
return false;
}
fistFightCheck = FistFightCheck(parryInfo.target, parryInfo.atta
cker, fistFightCounter);
if (ParryCounterCheck() && parryInfo.targetToAttackerAngleAbs <
theGame.params.PARRY_HALF_ANGLE && fistFightCheck){
validCounter = CheckCounterSpamming(parryInfo.attacker);
if (validCounter){
if (IsInCombatActionFriendly()){
RaiseEvent('CombatActionFriendlyEnd');
}
SetBehaviorVariable('parryType', ChooseParryType
Index(parryInfo), /* NOP */);
SetBehaviorVariable('counter', validCounter, /*
NOP */);
SetBehaviorVariable('parryType', ChooseParryType
Index(parryInfo), /* NOP */);
SetBehaviorVariable('counter', validCounter, /*
NOP */);
SetBehaviorVariable('combatActionType', 9, /* NO
P */);
if (!fistFightCounter){
attackerInventory = parryInfo.attacker.G
etInventory();
weaponId = attackerInventory.GetItemFrom
Slot('r_weapon');
attackerInventory.GetItemTags(weaponId,
weaponTags);
if (parryInfo.attacker.HasAbility('mon_g
ravehag')){
repelType = 3;
parryInfo.attacker.AddEffectDefa
ult(56, this, 'ReflexParryPerformed', /* NOP */);
} else if ((CNewNPC)parryInfo.attacker &
& !(CNewNPC)parryInfo.attacker.IsHuman()){
repelType = 4;
} else if (weaponTags.Contains('spear2h'
)){
repelType = 4;
parryInfo.attacker.AddEffectDefa
ult(56, this, "ReflexParryPerformed", /* NOP */);
parryInfo.attacker.SignalGamepla
yEvent('SpearDestruction');
} else {
thisPos = GetWorldPosition();
attackerPos = parryInfo.attacker
.GetWorldPosition();
playerToTargetRot = VecToRotatio
n(thisPos - attackerPos);
zDifference = thisPos.Z - attack
erPos.Z;

if (playerToTargetRot.Pitch < -5
.000000 && zDifference > 0.350000){
repelType = 2;
ragdollTarget = parryInf
o.attacker;
AddTimer('ApplyCounterRa
gdollTimer', 0.300000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
useKnockdown = false;
if (CanUseSkill(26)){
if (GetSkillLeve
l(26) > 1 && RandF() < GetWitcherPlayer().GetStat(4, /* NOP */) / GetWitcherPlay
er().GetStatMax(4)){
duration
= CalculateAttributeValue(GetSkillAttributeValue(26, 'duration', false, true),
/* NOP */);
useKnock
down = true;
}
}
if (useKnockdown){
repelType = 2;
params.effectTyp
e = 9;
params.creator =
this;
params.sourceNam
e = "ReflexParryPerformed";
params.duration
= duration;
parryInfo.attack
er.AddEffectCustom(params);
} else {
parryInfo.attack
er.AddEffectDefault(56, this, "ReflexParryPerformed", /* NOP */);
}
}
}
parryInfo.attacker.GetInventory().PlayIt
emEffect(parryInfo.attackerWeaponId, 'counterattack');
if (repelType == 0){
if (RandRange(100, /* NOP */) >
50){
repelType = 1;
} else {
repelType = 2;
}
}
SetBehaviorVariable('repelType', repelTy
pe, /* NOP */);
parryInfo.attacker.SetBehaviorVariable('
repelType', repelType, /* NOP */);
} else {
parryInfo.attacker.AddEffectDefault(56,
this, "ReflexParryPerformed", /* NOP */);
}
SetParryTarget(parryInfo.attacker);
SetSlideTarget(parryInfo.attacker);
if (!IsActorLockedToTarget()){
SetMoveTarget(parryInfo.attacker);

}
if (RaiseForceEvent('PerformCounter')){
OnCombatActionStart();
}
SetCustomRotation('Counter', VecHeading(parryInf
o.attacker.GetWorldPosition() - GetWorldPosition()), 0.000000, 0.200000, false);
AddTimer('UpdateCounterRotation', 0.400000, true
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
AddTimer('SetCounterRotation', 0.200000, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
IncreaseUninterruptedHitsCount();
if (IsHeavyAttack(parryInfo.attackActionName)){
mult = theGame.params.HEAVY_STRIKE_COST_
MULTIPLIER;
}
DrainStamina(5, 0, 0, 'None', 0, mult);
theGame.GetGamerProfile().IncStat(6);
} else {
ResetUninterruptedHitsCount();
}
return validCounter;
}
return false;
/* NOP */;
}
public timer function UpdateCounterRotation(optional dt : Float, optiona
l id : Int32){
UpdateCustomRotationHeading('Counter', VecHeading(parryTarget.Ge
tWorldPosition() - GetWorldPosition()));
/* NOP */;
}
public timer function SetCounterRotation(optional dt : Float, optional i
d : Int32){
SetCustomRotation('Counter', VecHeading(parryTarget.GetWorldPosi
tion() - GetWorldPosition()), 360.000000, 0.200000, false);
/* NOP */;
}
private function SetParryTarget(t : CActor){
parryTarget = t;
/* NOP */;
}
public timer function ApplyCounterRagdollTimer(optional time : Float, op
tional id : Int32){
var actor : CActor;
actor = ragdollTarget;
if (actor){
actor.AddEffectDefault(6, this, 'ReflexParryPerformed',
/* NOP */);
}
/* NOP */;
}
public function EnableMode(mode : EPlayerMode, enable : Bool){
playerMode.EnableMode(mode, enable);
/* NOP */;
}
public function GetPlayerMode() : W3PlayerMode{
return playerMode;
/* NOP */;
}
private function GetClosestIncomingAttacker() : CActor{

var i : Int32;
var size : Int32;
var attackerToPlayerDistances : array<Float>;
var closestAttackerIndex : Int32;
var incomingAttackers : array<CActor>;
if (playerMode && playerMode.combatDataComponent){
if (incomingAttackers.Size() <= 0){
playerMode.combatDataComponent.GetTicketSourceOw
ners(incomingAttackers, 'TICKET_Charge');
}
if (incomingAttackers.Size() <= 0){
playerMode.combatDataComponent.GetTicketSourceOw
ners(incomingAttackers, 'TICKET_Melee');
}
if (incomingAttackers.Size() <= 0){
playerMode.combatDataComponent.GetTicketSourceOw
ners(incomingAttackers, 'TICKET_Range');
}
}
size = incomingAttackers.Size();
attackerToPlayerDistances.Resize(size);
if (size > 0){
i = incomingAttackers.Size() - 1;
while (i >= 0){
if (!super.IsEnemyVisible(incomingAttackers[i]))
{
incomingAttackers.EraseFast(i);
}
i -= 1;
}
}
if (size > 0){
i = 0;
while (i < size){
attackerToPlayerDistances[i] = VecDistance(incom
ingAttackers[i].GetWorldPosition(), GetWorldPosition());
i += 1;
}
closestAttackerIndex = ArrayFindMinF(attackerToPlayerDis
tances);
return incomingAttackers[closestAttackerIndex];
} else {
return NULL;
}
/* NOP */;
}
public timer function CombatCheck(optional time : Float, optional id : I
nt32){
var i : Int32;
var strLevel : String;
var temp : String;
var enemies : array<CActor>;
FindMoveTarget();
playerMode.UpdateCombatMode(/* NOP */);
if (super.GetPlayerCombatStance() == 3){
if (GetTarget().GetHealthPercents() > 0.250000){
PlayBattleCry('BattleCryTaunt', 0.200000, /* NOP
*/, /* NOP */);
} else if (GetTarget().IsHuman()){
PlayBattleCry('BattleCryHumansEnd', 0.300000, /*

NOP */, /* NOP */);


} else {
PlayBattleCry('BattleCryMonstersEnd', 0.300000,
/* NOP */, /* NOP */);
}
}
if (IsThreatened() && ShouldProcessTutorial('TutorialMonsterThre
atLevels') && FactsQuerySum("q001_nightmare_ended") > 0){
super.GetEnemiesInRange(enemies);
i = 0;
while (i < enemies.Size()){
strLevel = (CNewNPC)enemies[i].GetExperienceDiff
erenceLevelName(temp);
if (strLevel == "deadlyLevel" || strLevel == "hi
ghLevel"){
FactsAdd("tut_high_threat_monster", /* N
OP */, /* NOP */);
break;
}
i += 1;
}
}
/* NOP */;
}
public function ReceivedDamageInCombat() : Bool{
return receivedDamageInCombat;
/* NOP */;
}
public function OnCombatStart() : Bool{
var weaponType : EPlayerWeapon;
theGame.CreateNoSaveLock('combat', noSaveLock, /* NOP */, /* NOP
*/);
FactsRemove("statistics_cerberus_sign");
FactsRemove("statistics_cerberus_petard");
FactsRemove("statistics_cerberus_bolt");
FactsRemove("statistics_cerberus_fists");
FactsRemove("statistics_cerberus_melee");
FactsRemove("statistics_cerberus_environment");
BlockAction(46, 'InCombat', /* NOP */, /* NOP */, /* NOP */);
BlockAction(7, 'InCombat', /* NOP */, /* NOP */, /* NOP */);
if (!IsUsingBoat() && GetTarget().GetAttitude(this) == 2){
weaponType = GetMostConvenientMeleeWeapon(GetTarget(), /
* NOP */);
if (weaponType == 1 || weaponType == 2){
OnEquipMeleeWeapon(weaponType, false, /* NOP */)
;
}
}
/* NOP */;
}
public function OnCombatFinished() : Bool{
var cnt : Int32;
reevaluateCurrentWeapon = false;
thePlayer.HardLockToTarget(false);
receivedDamageInCombat = false;
cnt = 0;
if (FactsQuerySum("statistics_cerberus_sign") > 0){
cnt += 1;
}
if (FactsQuerySum("statistics_cerberus_petard") > 0){

cnt += 1;
}
if (FactsQuerySum("statistics_cerberus_bolt") > 0){
cnt += 1;
}
if (FactsQuerySum("statistics_cerberus_fists") > 0){
cnt += 1;
}
if (FactsQuerySum("statistics_cerberus_melee") > 0){
cnt += 1;
}
if (FactsQuerySum("statistics_cerberus_environment") > 0){
cnt += 1;
}
FactsRemove("statistics_cerberus_sign");
FactsRemove("statistics_cerberus_petard");
FactsRemove("statistics_cerberus_bolt");
FactsRemove("statistics_cerberus_fists");
FactsRemove("statistics_cerberus_melee");
FactsRemove("statistics_cerberus_environment");
if (cnt >= 3){
theGame.GetGamerProfile().AddAchievement(43);
}
if (theGame.GetTutorialSystem() && FactsQuerySum("TutorialShowSi
lver") > 0){
FactsAdd("tut_show_silver_sword", 1, /* NOP */);
FactsRemove("TutorialShowSilver");
}
SetBehaviorVariable('isInCombatForOverlay', 0.000000, /* NOP */)
;
GoToExplorationIfNeeded();
theGame.ReleaseNoSaveLock(noSaveLock);
/* NOP */;
super.SetFailedFundamentalsFirstAchievementCondition(false);
UnblockAction(46, 'InCombat');
UnblockAction(7, 'InCombat');
/* NOP */;
}
public function OnReactToBeingHit(damageAction : W3DamageAction) : Bool{
var weaponType : EPlayerWeapon;
super.OnReactToBeingHit(damageAction);
if (IsInCombat() && damageAction.attacker && damageAction.attack
er == GetTarget() && !IsUsingVehicle() && IsOnBoat()){
weaponType = GetMostConvenientMeleeWeapon(GetTarget(), /
* NOP */);
if (weaponType != 3 && weaponType != 0 && weaponType !=
GetCurrentMeleeWeaponType()){
OnEquipMeleeWeapon(weaponType, false, /* NOP */)
;
}
}
/* NOP */;
}
public function ReceivedCombatDamage(){
receivedDamageInCombat = true;
/* NOP */;
}
public timer function UninterruptedHitsResetOnIdle(optional dt : Float,
optional id : Int32){
ResetUninterruptedHitsCount();

/* NOP */;
}
public function ResetUninterruptedHitsCount(){
uninterruptedHitsCount = 0;
LogUnitAtt("Uninterrupted attacks reset!!!!");
/* NOP */;
}
public function IncreaseUninterruptedHitsCount(){
uninterruptedHitsCount += 1;
LogUnitAtt("Uninterrupted attacks count increased to " + uninter
ruptedHitsCount);
if (uninterruptedHitsCount == 4){
AddTimer('StartUninterruptedBlurr', 1, false, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
AddTimer('UninterruptedHitsResetOnIdle', 4.000000, false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function StartUninterruptedBlurr(optional dt : Float, optio
nal id : Int32){
var changed : Bool;
var movingAgent : CMovingPhysicalAgentComponent;
var target : CActor;
if (uninterruptedHitsCount < 4){
LogUnitAtt("Stopping camera effect");
thePlayer.StopEffect(uninterruptedHitsCurrentCameraEffec
t);
uninterruptedHitsCurrentCameraEffect = 'None';
uninterruptedHitsCameraStarted = false;
RemoveTimer('StartUninterruptedBlurr', /* NOP */);
} else {
target = GetTarget();
if (target){
movingAgent = (CMovingPhysicalAgentComponent)tar
get.GetMovingAgentComponent();
}
if (!uninterruptedHitsCameraStarted){
LogUnitAtt("Starting camera effect");
AddTimer('StartUninterruptedBlurr', 0.001000, tr
ue, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (movingAgent && movingAgent.GetCapsuleHeight(
) > 2){
uninterruptedHitsCurrentCameraEffect = t
heGame.params.UNINTERRUPTED_HITS_CAMERA_EFFECT_BIG_ENEMY;
} else {
uninterruptedHitsCurrentCameraEffect = t
heGame.params.UNINTERRUPTED_HITS_CAMERA_EFFECT_REGULAR_ENEMY;
}
thePlayer.PlayEffect(uninterruptedHitsCurrentCam
eraEffect, /* NOP */);
uninterruptedHitsCameraStarted = true;
} else {
changed = false;
if (movingAgent && movingAgent.GetCapsuleHeight(
) > 2 && uninterruptedHitsCurrentCameraEffect != theGame.params.UNINTERRUPTED_HI
TS_CAMERA_EFFECT_BIG_ENEMY){
changed = true;
} else if (!movingAgent || movingAgent.GetCapsul
eHeight() <= 2 && uninterruptedHitsCurrentCameraEffect != theGame.params.UNINTER

RUPTED_HITS_CAMERA_EFFECT_REGULAR_ENEMY){
changed = true;
}
if (changed){
thePlayer.StopEffect(uninterruptedHitsCu
rrentCameraEffect);
if (uninterruptedHitsCurrentCameraEffect
== theGame.params.UNINTERRUPTED_HITS_CAMERA_EFFECT_BIG_ENEMY){
uninterruptedHitsCurrentCameraEf
fect = theGame.params.UNINTERRUPTED_HITS_CAMERA_EFFECT_REGULAR_ENEMY;
} else {
uninterruptedHitsCurrentCameraEf
fect = theGame.params.UNINTERRUPTED_HITS_CAMERA_EFFECT_BIG_ENEMY;
}
thePlayer.PlayEffect(uninterruptedHitsCu
rrentCameraEffect, /* NOP */);
}
}
}
/* NOP */;
}
private function PlayerActionBlockGameplayActions(sourceName : CName, lo
ck : Bool, isFromPlace : Bool){
if (lock){
thePlayer.BlockAction(0, sourceName, false, false, isFro
mPlace);
thePlayer.BlockAction(1, sourceName, false, false, isFro
mPlace);
thePlayer.BlockAction(4, sourceName, false, false, isFro
mPlace);
thePlayer.BlockAction(5, sourceName, false, false, isFro
mPlace);
thePlayer.BlockAction(8, sourceName, false, false, isFro
mPlace);
thePlayer.BlockAction(12, sourceName, false, false, isFr
omPlace);
thePlayer.DisableCombatState();
} else {
thePlayer.UnblockAction(0, sourceName);
thePlayer.UnblockAction(1, sourceName);
thePlayer.UnblockAction(4, sourceName);
thePlayer.UnblockAction(5, sourceName);
thePlayer.UnblockAction(8, sourceName);
thePlayer.UnblockAction(12, sourceName);
}
/* NOP */;
}
public function RegisterForPlayerAction(listener : CGameplayEntity, isLo
ckedByPlace : Bool){
if (!playerActionEventListeners.Contains(listener)){
playerActionEventListeners.PushBack(listener);
}
if (listener.ShouldBlockGameplayActionsOnInteraction()){
if (!playerActionEventBlockingListeners.Contains(listene
r)){
playerActionEventBlockingListeners.PushBack(list
ener);
}
if (playerActionEventBlockingListeners.Size() == 1){
PlayerActionBlockGameplayActions('PlayerAction',

true, isLockedByPlace);
}
}
/* NOP */;
}
public function UnregisterForPlayerAction(listener : CGameplayEntity, is
LockedByPlace : Bool){
playerActionEventListeners.Remove(listener);
playerActionEventBlockingListeners.Remove(listener);
if (playerActionEventBlockingListeners.Size() == 0){
PlayerActionBlockGameplayActions('PlayerAction', false,
isLockedByPlace);
}
/* NOP */;
}
public function OnPlayerActionEnd() : Bool{
var i : Int32;
i = playerActionEventListeners.Size() - 1;
while (i >= 0){
playerActionEventListeners[i].OnPlayerActionEnd();
i -= 1;
}
currentCustomAction = 0;
/* NOP */;
}
public function OnPlayerActionStartFinished() : Bool{
var i : Int32;
i = playerActionEventListeners.Size() - 1;
while (i >= 0){
playerActionEventListeners[i].OnPlayerActionStartFinishe
d();
i -= 1;
}
/* NOP */;
}
public function PlayerStartAction(playerAction : EPlayerExplorationActio
n, animName : CName) : Bool{
if (playerAction == 1 && !IsNameValid(animName)){
return false;
}
SetBehaviorVariable('playerStopAction', 0.000000, /* NOP */);
SetBehaviorVariable('playerExplorationAction', playerAction, /*
NOP */);
if (RaiseForceEvent('playerActionStart')){
currentCustomAction = playerAction;
if (playerAction == 1){
playerActionSlotAnimName = animName;
AddTimer('PlayActionAnimWorkaround', 0, false, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
return true;
}
return false;
/* NOP */;
}
public timer function PlayActionAnimWorkaround(optional dt : Float, opti
onal id : Int32){
ActionPlaySlotAnimationAsync('PLAYER_ACTION_SLOT', playerActionS
lotAnimName, 0.200000, 0.200000, true);
/* NOP */;

}
public function PlayerStopAction(playerAction : EPlayerExplorationAction
){
SetBehaviorVariable('playerExplorationAction', playerAction, /*
NOP */);
SetBehaviorVariable('playerStopAction', 1.000000, /* NOP */);
currentCustomAction = 0;
/* NOP */;
}
public function GetPlayerAction() : EPlayerExplorationAction{
return currentCustomAction;
/* NOP */;
}
public function MedallionPing(){
var currTime : Float;
currTime = theGame.GetEngineTimeAsSeconds();
if (lastMedallionEffect < currTime){
lastMedallionEffect = theGame.GetEngineTimeAsSeconds() +
medallion.effectDuration;
medallion.TriggerMedallionFX();
}
/* NOP */;
}
public function CanPerformPlayerAction(alsoOutsideExplorationState : Boo
l) : Bool{
if (!alsoOutsideExplorationState && GetCurrentStateName() != 'Ex
ploration'){
return false;
}
if (isInAir || substateManager && !substateManager.CanInteract()
|| IsInCombatAction() || GetCriticalBuffsCount() > 0){
return false;
}
return true;
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
var keyName : CName;
var i : Int32;
var hud : CR4ScriptedHud;
var message : String;
var inve : CInventoryComponent;
if (data.informGui){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
message = GetLocStringByKeyExt("panel_common_ite
m_received") + ": " + GetLocStringByKeyExt(inv.GetItemLocalizedNameByUniqueID(da
ta.ids[0]));
if (data.quantity > 1){
message += " x" + data.quantity;
}
hud.HudConsoleMsg(message);
}
}
inve = GetInventory();
if (inve.ItemHasTag(data.ids[0], 'key')){
keyName = inve.GetItemName(data.ids[0]);
i = nearbyLockedContainersNoKey.Size() - 1;
while (i >= 0){
if (nearbyLockedContainersNoKey[i].GetKeyName()

== keyName && nearbyLockedContainersNoKey[i].IsEnabled()){


nearbyLockedContainersNoKey[i].UpdateCom
ponents("Unlock");
nearbyLockedContainersNoKey.Remove(nearb
yLockedContainersNoKey[i]);
}
i -= 1;
}
}
if (inve.IsItemAlchemyItem(data.ids[0])){
UpgradeAlchemyItem(data.ids[0], CanUseSkill(87));
}
/* NOP */;
}
public function ChangeAlchemyItemsAbilities(upgrade : Bool){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var items : array<SItemUniqueId>;
inv.GetAllItems(items);
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < items.Size()){
if (inv.IsItemAlchemyItem(items[i])){
UpgradeAlchemyItem(items[i], upgrade);
}
i += 1;
}
/* NOP */;
}
public function UpgradeAlchemyItem(itemID : SItemUniqueId, upgrade : Boo
l){
var j : Int32;
var currLevel : Int32;
var otherLevel : Int32;
var dm : CDefinitionsManagerAccessor;
var abs : array<CName>;
var currAbilities : array<CName>;
var otherAbilities : array<CName>;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
if (!inv.IsItemAlchemyItem(itemID)){
return;
}
currLevel = CalculateAttributeValue(inv.GetItemAttributeValue(it
emID, 'level', /* NOP */, /* NOP */), /* NOP */);
if (currLevel == 3 || currLevel == 2 || currLevel < 2 || currLev
el > 3){
return;
}
currAbilities = inv.GetItemAbilitiesWithAttribute(itemID, 'level
', currLevel);
inv.GetItemContainedAbilities(itemID, abs);
dm = theGame.GetDefinitionsManager();
j = 0;
while (j < abs.Size()){
dm.GetAbilityAttributeValue(abs[j], 'level', min, max);
otherLevel = CalculateAttributeValue(GetAttributeRandomi
zedValue(min, max), /* NOP */);
if (otherLevel == 2 || otherLevel == 3 && otherLevel !=
currLevel){

otherAbilities.PushBack(abs[j]);
}
j += 1;
}
if (otherAbilities.Size() == 0){
LogAssert(false, "CR4Player.UpgradeAlchemyItem: cannot f
ind ability to swap to from <<" + currAbilities[0] + ">> on item <<" + inv.GetIt
emName(itemID) + ">> !!!");
} else {
j = 0;
while (j < currAbilities.Size()){
inv.RemoveItemBaseAbility(itemID, currAbilities[
j]);
j += 1;
}
j = 0;
while (j < otherAbilities.Size()){
inv.AddItemBaseAbility(itemID, otherAbilities[j]
);
j += 1;
}
}
/* NOP */;
}
public function MovAdjRotateToTarget(ticket : SMovementAdjustmentRequest
Ticket){
var movementAdjustor : CMovementAdjustor;
var localOrientationTarget : EOrientationTarget;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
localOrientationTarget = GetOrientationTarget();
if (localOrientationTarget == 2){
movementAdjustor.RotateTo(ticket, GetOrientationTargetCu
stomHeading());
} else if (localOrientationTarget == 1){
if (slideTarget){
movementAdjustor.RotateTowards(ticket, slideTarg
et, /* NOP */);
} else if (lAxisReleasedAfterCounter){
movementAdjustor.RotateTo(ticket, GetHeading());
} else {
movementAdjustor.RotateTo(ticket, GetCombatActio
nHeading());
}
} else if (localOrientationTarget == 0){
if (bLAxisReleased){
movementAdjustor.RotateTo(ticket, GetHeading());
} else {
movementAdjustor.RotateTo(ticket, rawPlayerHeadi
ng);
}
} else if (localOrientationTarget == 4){
movementAdjustor.RotateTo(ticket, VecHeading(theCamera.G
etCameraDirection()));
} else {
movementAdjustor.RotateTo(ticket, rawCameraHeading);
}
/* NOP */;
}
public function UpdateLookAtTarget(){

var localOrientationTarget : EOrientationTarget;


var playerRot : EulerAngles;
var lookAtActive : Float;
var lookAtTarget : Vector;
var headBoneIdx : Int32;
var tempComponent : CDrawableComponent;
var entityHeight : Float;
var useTorsoBone : Bool;
var angles : EulerAngles;
var dir : Vector;
var camZ : Float;
var target : CActor;
lookAtActive = 0.000000;
localOrientationTarget = GetOrientationTarget();
if (localOrientationTarget == 0 || localOrientationTarget == 2){
if (localOrientationTarget == 0){
angles = VecToRotation(GetHeadingVector());
} else if (customOrientationInfoStack.Size() > 0){
angles = VecToRotation(VecFromHeading(customOrie
ntationInfoStack[customOrientationInfoStack.Size() - 1].customHeading));
} else {
angles = VecToRotation(GetHeadingVector());
}
dir = RotForward(angles);
lookAtTarget = dir * 30.000000 + GetWorldPosition();
lookAtTarget.Z += 1.600000;
lookAtActive = 1.000000;
} else if (localOrientationTarget == 3){
headBoneIdx = GetHeadBoneIndex();
if (headBoneIdx >= 0){
lookAtTarget = MatrixGetTranslation(GetBoneWorld
MatrixByIndex(headBoneIdx));
} else {
lookAtTarget = GetWorldPosition();
lookAtTarget.Z += 1.600000;
}
lookAtTarget += theCamera.GetCameraDirection() * 100.000
000;
lookAtActive = 1.000000;
} else if (localOrientationTarget == 4){
dir = theCamera.GetCameraDirection();
angles = VecToRotation(dir);
angles.Pitch = -angles.Pitch + oTCameraPitchOffset;
angles.Yaw -= oTCameraOffset;
dir = RotForward(angles);
lookAtTarget = dir * 30.000000 + GetWorldPosition();
lookAtTarget.Z += 1.600000;
lookAtActive = 1.000000;
} else if (localOrientationTarget == 1){
if (IsInCombatAction()){
if ((W3PlayerWitcher)this.GetCurrentlyCastSign()
!= 5 && GetBehaviorVariable('combatActionType', /* NOP */) == 6 || GetBehaviorV
ariable('combatActionType', /* NOP */) == 4){
useTorsoBone = true;
}
}
if (rangedWeapon && rangedWeapon.GetCurrentStateName() !
= 'State_WeaponWait'){
useTorsoBone = true;
}

if (tempLookAtTarget && (CActor)tempLookAtTarget){


lookAtTarget = ProcessLookAtTargetPosition(tempL
ookAtTarget, useTorsoBone);
lookAtActive = 1.000000;
}
if (GetDisplayTarget() && IsDisplayTargetTargetable()){
lookAtTarget = ProcessLookAtTargetPosition(GetDi
splayTarget(), useTorsoBone);
lookAtActive = 1.000000;
} else {
if (slideTarget){
lookAtTarget = ProcessLookAtTargetPositi
on(slideTarget, useTorsoBone);
} else {
target = GetTarget();
if (target){
lookAtTarget = ProcessLookAtTarg
etPosition(target, useTorsoBone);
}
}
lookAtActive = 1.000000;
}
if (!slideTarget && !IsUsingVehicle()){
playerRot = GetWorldRotation();
lookAtTarget = GetWorldPosition() + VecFromHeadi
ng(playerRot.Yaw) * 100.000000;
lookAtActive = 0.000000;
}
if (useTorsoBone){
lookAtTarget.Z += 0.200000;
}
}
GetVisualDebug().AddSphere('lookAtTarget', 1.000000, lookAtTarge
t, true, Color(255, 0, 0), 3.000000);
SetLookAtPosition(lookAtTarget);
UpdateLookAtVariables(lookAtActive, lookAtTarget);
/* NOP */;
}
private function ProcessLookAtTargetPosition(ent : CGameplayEntity, useT
orsoBone : Bool) : Vector{
var boneIdx : Int32;
var actor : CActor;
var lookAtTarget : Vector;
var tempComponent : CDrawableComponent;
var box : Box;
var entityHeight : Float;
var entityPos : Vector;
var predictedPos : Vector;
var z : Float;
var entMat : Matrix;
actor = (CActor)ent;
entityPos = ent.GetWorldPosition();
lookAtTarget = entityPos;
if (actor){
if (useTorsoBone){
boneIdx = actor.GetTorsoBoneIndex();
} else {
boneIdx = actor.GetHeadBoneIndex();
}
} else {

boneIdx = -1;
}
if (!ent.aimVector.X == 0 && ent.aimVector.Y == 0 && ent.aimVect
or.Z == 0){
entMat = ent.GetLocalToWorld();
lookAtTarget = VecTransform(entMat, ent.aimVector);
} else if (boneIdx >= 0){
lookAtTarget = MatrixGetTranslation(ent.GetBoneWorldMatr
ixByIndex(boneIdx));
} else if (actor){
lookAtTarget.Z += (CMovingPhysicalAgentComponent)actor.G
etMovingAgentComponent().GetCapsuleHeight() * 0.500000;
} else {
tempComponent = (CDrawableComponent)ent.GetComponentByCl
assName('CDrawableComponent');
if (tempComponent.GetObjectBoundingVolume(box)){
entityHeight = box.Max.Z - box.Min.Z;
lookAtTarget = lookAtTarget + Vector(0, 0, entit
yHeight / 2);
}
}
z = (CMovingPhysicalAgentComponent)actor.GetMovingAgentComponent
().GetCapsuleHeight();
if (actor){
if (PredictLookAtTargetPosition(actor, lookAtTarget.Z entityPos.Z, predictedPos)){
lookAtTarget = predictedPos;
}
}
return lookAtTarget;
/* NOP */;
}
private function PredictLookAtTargetPosition(targetActor : CActor, zOffS
et : Float, predictedPos : Vector) : Bool{
var virtualPos : Vector;
var i : Int32;
var dist : Float;
var deltaTime : Float;
var projSpeed : Float;
var projSpeedInt : Vector;
var projAngle : Float;
var e3Hack : Bool;
var currentTimeInCurve : Float;
e3Hack = false;
if (rangedWeapon && rangedWeapon.GetDeployedEntity() && rangedWe
apon.GetCurrentStateName() == 'State_WeaponAim' || rangedWeapon.GetCurrentStateN
ame() == 'State_WeaponShoot'){
projSpeed = rangedWeapon.GetDeployedEntity().projSpeed;
virtualPos = targetActor.GetWorldPosition();
if (e3Hack && targetActor.HasTag('e3_griffin')){
i = 0;
while (i < 10){
dist = VecDistance(rangedWeapon.GetDeplo
yedEntity().GetWorldPosition(), virtualPos);
deltaTime = dist / projSpeed;
virtualPos = targetActor.PredictWorldPos
ition(deltaTime);
i += 1;
}
} else {

return false;
}
virtualPos.Z += zOffSet;
predictedPos = virtualPos;
GetVisualDebug().AddSphere('CrossbowPredictedPos', 1.000
000, virtualPos, true, Color(255, 50, 50), 5.000000);
return true;
}
return false;
/* NOP */;
}
public function SetLookAtPosition(vec : Vector){
lookAtPosition = vec;
/* NOP */;
}
public function GetLookAtPosition() : Vector{
return lookAtPosition;
/* NOP */;
}
public function OnBlockingSceneEnded(output : CStorySceneOutput) : Bool{
super.OnBlockingSceneEnded(output);
/* NOP */;
}
public function GetCurrentMeleeWeaponName() : CName{
return weaponHolster.GetCurrentMeleeWeaponName();
/* NOP */;
}
public function GetCurrentMeleeWeaponType() : EPlayerWeapon{
return weaponHolster.GetCurrentMeleeWeapon();
/* NOP */;
}
public function OnMeleeForceHolster(ignoreActionLock : Bool){
weaponHolster.HolsterWeapon(ignoreActionLock, true);
/* NOP */;
}
public function OnForcedHolsterWeapon() : Bool{
weaponHolster.OnForcedHolsterWeapon();
/* NOP */;
}
public function OnEquippedItem(category : CName, slotName : CName) : Boo
l{
var weaponType : EPlayerWeapon;
if (slotName == 'r_weapon'){
switch(category){
case 'None':
weaponType = 0;
break;
case 'fist':
weaponType = 3;
break;
case 'steelsword':
weaponType = 1;
break;
case 'silversword':
weaponType = 2;
break;
default:
return true;
}
weaponHolster.OnEquippedMeleeWeapon(weaponType);

}
/* NOP */;
}
public function ProcessIsHoldingDeadlySword(){
isHoldingDeadlySword = IsDeadlySwordHeld();
/* NOP */;
}
public function IsHoldingDeadlySword() : Bool{
return isHoldingDeadlySword;
/* NOP */;
}
public function OnHolsteredItem(category : CName, slotName : CName) : Bo
ol{
var weaponType : EPlayerWeapon;
if (slotName == 'r_weapon'){
weaponType = weaponHolster.GetCurrentMeleeWeapon();
switch(category){
case 'fist':
if (weaponType == 3){
weaponHolster.OnEquippedMeleeWeapon(0);
}
return true;
case 'steelsword':
if (weaponType == 1){
weaponHolster.OnEquippedMeleeWeapon(0);
}
return true;
case 'silversword':
if (weaponType == 2){
weaponHolster.OnEquippedMeleeWeapon(0);
}
return true;
default:
}
return true;
}
/* NOP */;
}
public function OnEquipMeleeWeapon(weaponType : EPlayerWeapon, ignoreAct
ionLock : Bool, sheatheIfAlreadyEquipped : Bool) : Bool{
RemoveTimer('DelayedSheathSword', /* NOP */);
weaponHolster.OnEquipMeleeWeapon(weaponType, ignoreActionLock, s
heatheIfAlreadyEquipped, /* NOP */);
m_RefreshWeaponFXType = true;
/* NOP */;
}
public function OnHolsterLeftHandItem() : Bool{
weaponHolster.OnHolsterLeftHandItem();
/* NOP */;
}
public timer function DelayedSheathSword(optional dt : Float, optional i
d : Int32){
if (!IsCombatMusicEnabled()){
if (IsInCombatAction() || !IsActionAllowed(1)){
/* NOP */;
PushCombatActionOnBuffer(16, 1, /* NOP */);
} else {
/* NOP */;
OnEquipMeleeWeapon(0, false, /* NOP */);
}

}
/* NOP */;
}
protected function ShouldAutoSheathSwordInstantly() : Bool{
var enemies : array<CActor>;
var i : Int32;
super.GetEnemiesInRange(enemies);
i = 0;
while (i < enemies.Size()){
if (IsThreat(enemies[i], /* NOP */) && VecDistance(enemi
es[i].GetWorldPosition(), GetWorldPosition()) <= findMoveTargetDist){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public function PrepareToAttack(target : CActor, action : EBufferActionT
ype){
var weaponType : EPlayerWeapon;
if (IsInAir() || !GetBIsCombatActionAllowed()){
return;
}
if (!target){
target = (CActor)displayTarget;
}
if (!target && IsCombatMusicEnabled()){
target = moveTarget;
}
if (!target){
if (GetCurrentStateName() == 'Exploration'){
SetCombatActionHeading(ProcessCombatActionHeadin
g(action));
thePlayer.CanAttackWhenNotInCombat(action, false
, target, /* NOP */);
}
}
weaponHolster.TryToPrepareMeleeWeaponToAttack();
weaponType = GetCurrentMeleeWeaponType();
if (weaponType == 0){
weaponType = GetMostConvenientMeleeWeapon(target, /* NOP
*/);
}
if (!OnStateCanGoToCombat()){
return;
}
GoToCombat(weaponType, /* NOP */);
/* NOP */;
}
public function DisplayCannotAttackMessage(actor : CActor) : Bool{
if (actor && actor.GetMovingAgentComponent().GetName() == "child
_base" || (CNewNPC)actor.GetNPCType() == 2){
DisplayHudMessage(GetLocStringByKeyExt("panel_hud_messag
e_cant_attack_this_target"));
return true;
}
return false;
/* NOP */;
}

public function GetMostConvenientMeleeWeapon(targetToDrawAgainst : CActo


r, ignoreActionLock : Bool) : EPlayerWeapon{
return weaponHolster.GetMostConvenientMeleeWeapon(targetToDrawAg
ainst, ignoreActionLock);
/* NOP */;
}
public function OnTargetWeaponDrawn() : Bool{
var weaponType : EPlayerWeapon;
weaponType = GetCurrentMeleeWeaponType();
if (weaponType == 3){
reevaluateCurrentWeapon = true;
}
/* NOP */;
}
public function GoToCombatIfNeeded(enemy : CActor) : Bool{
var weaponType : EPlayerWeapon;
var target : CActor;
if (!enemy && IsInCombat()){
target = GetTarget();
if (target){
enemy = target;
} else {
enemy = moveTarget;
}
}
if (!ShouldGoToCombat(enemy)){
return false;
}
weaponType = GetCurrentMeleeWeaponType();
if (weaponType == 0 || reevaluateCurrentWeapon && weaponType ==
3 || !IsInCombat() && weaponHolster.IsOnTheMiddleOfHolstering()){
weaponType = weaponHolster.GetMostConvenientMeleeWeapon(
enemy, /* NOP */);
reevaluateCurrentWeapon = false;
}
GoToCombat(weaponType, /* NOP */);
return true;
/* NOP */;
}
public function GoToCombatIfWanted() : Bool{
var weaponType : EPlayerWeapon;
var target : CActor;
var enemy : CActor;
if (!IsInCombat()){
return false;
}
target = GetTarget();
if (target){
enemy = target;
} else {
enemy = moveTarget;
}
weaponType = GetCurrentMeleeWeaponType();
if (weaponType == 0 || !IsInCombat() && weaponHolster.IsOnTheMid
dleOfHolstering()){
weaponType = weaponHolster.GetMostConvenientMeleeWeapon(
enemy, /* NOP */);
}
GoToCombat(weaponType, /* NOP */);
return true;

/* NOP */;
}
public function GoToExplorationIfNeeded() : Bool{
if (!IsInCombatState()){
return false;
}
if (!ShouldGoToExploration()){
return false;
}
weaponHolster.EndedCombat();
GotoState('Exploration', /* NOP */, /* NOP */);
return true;
/* NOP */;
}
public function OnStateCanGoToCombat() : Bool{
return false;
/* NOP */;
}
public function OnStateCanUpdateExplorationSubstates() : Bool{
return false;
/* NOP */;
}
private function ShouldGoToCombat(enemy : CActor) : Bool{
if (!enemy){
return false;
}
if (!OnStateCanGoToCombat()){
return false;
}
if (GetCurrentStateName() == 'AimThrow'){
return false;
}
if (GetCurrentStateName() == 'Swimming'){
return false;
}
if (GetCurrentStateName() == 'TraverseExploration'){
return false;
}
return true;
/* NOP */;
}
private function ShouldGoToExploration() : Bool{
if (IsInCombat()){
return false;
}
if (rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State
_WeaponWait'){
return false;
}
if (IsFistFightMinigameEnabled()){
return false;
}
if (IsKnockedUnconscious()){
return false;
}
if (IsInCombatAction()){
return false;
}
if (GetCriticalBuffsCount() > 0){
return false;

}
return true;
/* NOP */;
}
private function GoToCombat(weaponType : EPlayerWeapon, initialAction :
EInitialAction){
switch(weaponType){
case 2:
(W3PlayerWitcherStateCombatSilver)GetState('CombatSilver
').SetupState(initialAction, /* NOP */);
GoToStateIfNew('CombatSilver', /* NOP */, /* NOP */);
break;
case 1:
(W3PlayerWitcherStateCombatSteel)GetState('CombatSteel')
.SetupState(initialAction, /* NOP */);
GoToStateIfNew('CombatSteel', /* NOP */, /* NOP */);
break;
case 3:
case 0:
default:
(W3PlayerWitcherStateCombatFists)GetState('CombatFists')
.SetupState(initialAction, /* NOP */);
GoToStateIfNew('CombatFists', /* NOP */, /* NOP */);
break;
}
/* NOP */;
}
public function GoToStateIfNew(newState : CName, keepStack : Bool, force
Events : Bool){
if (newState != GetCurrentStateName()){
GotoState(newState, keepStack, forceEvents);
}
/* NOP */;
}
public function GotoState(newState : CName, keepStack : Bool, forceEvent
s : Bool){
super.GotoState(newState, keepStack, forceEvents);
/* NOP */;
}
public function IsThisACombatSuperState(stateName : CName) : Bool{
return stateName == 'Combat' || stateName == 'CombatSteel' || st
ateName == 'CombatSilver' || stateName == 'CombatFists';
/* NOP */;
}
public function GetWeaponHolster() : WeaponHolster{
return weaponHolster;
/* NOP */;
}
public function AbortSign(){
var playerWitcher : W3PlayerWitcher;
var sign : W3SignEntity;
playerWitcher = (W3PlayerWitcher)this;
if (playerWitcher){
sign = playerWitcher.GetCurrentSignEntity();
if (sign){
sign.OnSignAborted(/* NOP */);
}
}
/* NOP */;
}

public function OnAnimEvent_DisallowHitAnim(animEventName : CName, animE


ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
if (BufferCombatAction == 6 || BufferCombatAction == 9 &
& IsInCombatAction() && GetBehaviorVariable('combatActionType', /* NOP */) == 0)
{
ProcessCombatActionBuffer();
disableActionBlend = true;
}
} else if (IsInCombatAction() && GetBehaviorVariable('combatActi
onType', /* NOP */) == 2 && animEventType == 1){
disableActionBlend = false;
}
super.OnAnimEvent_DisallowHitAnim(animEventName, animEventType,
animInfo);
/* NOP */;
}
public function OnAnimEvent_FadeOut(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
theGame.FadeOutAsync(0.200000, Color(0, 0, 0, 1));
/* NOP */;
}
public function OnAnimEvent_FadeIn(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
theGame.FadeInAsync(0.400000);
/* NOP */;
}
public function OnAnimEvent_BloodTrailForced(animEventName : CName, anim
EventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var bloodTrailParam : CBloodTrailEffect;
var weaponId : SItemUniqueId;
if (isInFinisher){
bloodTrailParam = (CBloodTrailEffect)GetFinisherVictim()
.GetGameplayEntityParam('CBloodTrailEffect');
weaponId = inv.GetItemFromSlot('r_weapon');
if (bloodTrailParam){
thePlayer.inv.PlayItemEffect(weaponId, bloodTrai
lParam.GetEffectName());
}
}
/* NOP */;
}
public function OnAnimEvent_SlowMo(animEventName : CName, animEventType
: EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (isInFinisher && DisableManualCameraControlStackHasSource('Fi
nisher')){
if (animEventType != 3){
theGame.SetTimeScale(0.100000, 'AnimEventSlomoMo
', 1000, true, /* NOP */);
} else {
theGame.RemoveTimeScale('AnimEventSlomoMo');
}
}
/* NOP */;
}
public function OnAnimEvent_PlayFinisherBlood(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (isInFinisher){
SpawnFinisherBlood();
}

/* NOP */;
}
public function OnAnimEvent_OnWeaponDrawReady(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
weaponHolster.OnWeaponDrawReady();
/* NOP */;
}
public function OnAnimEvent_OnWeaponHolsterReady(animEventName : CName,
animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
weaponHolster.OnWeaponHolsterReady();
/* NOP */;
}
public function OnAnimEvent_ThrowHoldTest(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thrownEntityHandle);
if (IsThrowHold()){
SetBehaviorVariable('throwStage', 1, /* NOP */);
PushState('AimThrow');
thrownEntity.StartAiming();
} else {
BombThrowRelease();
SetCombatIdleStance(1.000000);
}
/* NOP */;
}
public function OnAnimEvent_AllowTempLookAt(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){
SetTempLookAtTarget(slideTarget);
} else if (animEventType == 3){
SetTempLookAtTarget(NULL);
}
/* NOP */;
}
public function OnAnimEvent_SlideToTarget(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var movementAdjustor : CMovementAdjustor;
if (animEventType == 1){
slideNPC = (CNewNPC)slideTarget;
}
if (!slideNPC){
return false;
}
if (animEventType == 1 && slideNPC.GetGameplayVisibility()){
movementAdjustor = GetMovingAgentComponent().GetMovement
Adjustor();
slideTicket = movementAdjustor.GetRequest('SlideToTarget
');
movementAdjustor.CancelByName('SlideToTarget');
slideTicket = movementAdjustor.CreateNewRequest('SlideTo
Target');
movementAdjustor.BindToEventAnimInfo(slideTicket, animIn
fo, /* NOP */);
movementAdjustor.MaxLocationAdjustmentSpeed(slideTicket,
1000000, /* NOP */);
movementAdjustor.ScaleAnimation(slideTicket, /* NOP */,
/* NOP */, /* NOP */);
minSlideDistance = (CMovingPhysicalAgentComponent)GetMov
ingAgentComponent().GetCapsuleRadius() + (CMovingPhysicalAgentComponent)slideNPC

.GetMovingAgentComponent().GetCapsuleRadius();
movementAdjustor.SlideTowards(slideTicket, slideTarget,
minSlideDistance, minSlideDistance);
} else if (!slideNPC.GetGameplayVisibility()){
movementAdjustor = GetMovingAgentComponent().GetMovement
Adjustor();
movementAdjustor.CancelByName('SlideToTarget');
slideNPC = NULL;
} else {
movementAdjustor = GetMovingAgentComponent().GetMovement
Adjustor();
movementAdjustor.SlideTowards(slideTicket, slideTarget,
minSlideDistance, minSlideDistance);
}
/* NOP */;
}
public function OnAnimEvent_ActionBlend(animEventName : CName, animEvent
Type : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
public function OnAnimEvent_SubstateManager(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
substateManager.OnAnimEvent(animEventName, animEventType, animIn
fo);
/* NOP */;
}
public function OnAnimEvent_AllowFall(animEventName : CName, animEventTy
pe : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (!substateManager.m_OwnerMAC.IsOnGround()){
substateManager.m_SharedDataO.SetFallFromCritical(true);
substateManager.m_MoverO.SetVelocity(-6.000000 * GetWorl
dForward());
substateManager.QueueStateExternal('Jump');
RemoveBuff(9, true, /* NOP */);
RemoveBuff(6, true, /* NOP */);
return true;
}
return false;
/* NOP */;
}
public function OnAnimEvent_AllowFall2(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (!substateManager.m_OwnerMAC.IsOnGround()){
substateManager.QueueStateExternal('Jump');
RemoveBuff(9, true, /* NOP */);
RemoveBuff(6, true, /* NOP */);
}
if (substateManager.StateWantsAndCanEnter('Slide')){
substateManager.QueueStateExternal('Slide');
}
/* NOP */;
}
public function OnAnimEvent_DettachGround(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
public function OnAnimEvent_pad_vibration(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
theGame.VibrateControllerHard(/* NOP */);
/* NOP */;
}
public function OnAnimEvent_pad_vibration_light(animEventName : CName, a

nimEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{


}
public function OnAnimEvent_KillWithRagdoll(animEventName : CName, animE
ventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
}
public function OnAnimEvent_RemoveBurning(animEventName : CName, animEve
ntType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
thePlayer.AddBuffImmunity(18, 'AnimEvent_RemoveBurning', true);
/* NOP */;
}
public function OnBehaviorGraphNotification(notificationName : CName, st
ateName : CName) : Bool{
substateManager.OnBehaviorGraphNotification(notificationName, st
ateName);
if (notificationName == 'PlayerRunActivate'){
isInRunAnimation = true;
} else if (notificationName == 'PlayerRunDeactivate'){
isInRunAnimation = false;
}
/* NOP */;
}
public function OnEnumAnimEvent(animEventName : CName, variant : SEnumVa
riant, animEventType : EAnimationEventType, animEventDuration : Float, animInfo
: SAnimationEventAnimInfo) : Bool{
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
var rotationRate : ERotationRate;
if (animEventName == 'RotateToTarget'){
rotationRate = GetRotationRateFromAnimEvent(variant.enum
Value);
movementAdjustor = GetMovingAgentComponent().GetMovement
Adjustor();
if (animEventType == 1 || animEventType == 2){
if (!movementAdjustor.IsRequestActive(movementAd
justor.GetRequest('RotateToTarget'))){
ticket = movementAdjustor.CreateNewReque
st('RotateToTarget');
if (rotationRate == 0){
movementAdjustor.AdjustmentDurat
ion(ticket, animEventDuration);
} else {
movementAdjustor.Continuous(tick
et);
movementAdjustor.BindToEvent(tic
ket, 'RotateToTarget', /* NOP */);
}
movementAdjustor.DontUseSourceAnimation(
ticket, /* NOP */);
movementAdjustor.ReplaceRotation(ticket,
/* NOP */);
} else {
ticket = movementAdjustor.GetRequest('Ro
tateToTarget');
}
MovAdjRotateToTarget(ticket);
if (rotationRate > 0){
movementAdjustor.MaxRotationAdjustmentSp
eed(ticket, rotationRate);
}
} else if (animEventType == 3){

} else {
ticket = movementAdjustor.GetRequest('RotateToTa
rget');
MovAdjRotateToTarget(ticket);
}
}
super.OnEnumAnimEvent(animEventName, variant, animEventType, ani
mEventDuration, animInfo);
/* NOP */;
}
public function OnTeleported() : Bool{
if (substateManager){
substateManager.OnTeleported();
}
/* NOP */;
}
public function OnStartFistfightMinigame() : Bool{
super.OnStartFistfightMinigame();
SetFistFightMinigameEnabled(true);
FistFightHealthChange(true);
thePlayer.GetPlayerMode().ForceCombatMode(4);
SetImmortalityMode(3, 16, /* NOP */);
thePlayer.SetBehaviorVariable('playerWeaponLatent', 3, /* NOP */
);
GotoCombatStateWithAction(0, /* NOP */);
GetMovingAgentComponent().SnapToNavigableSpace(true);
EquipGeraltFistfightWeapon(true);
BlockAction(3, 'FistfightMinigame', /* NOP */, /* NOP */, /* NOP
*/);
BlockAction(0, 'FistfightMinigame', /* NOP */, /* NOP */, /* NOP
*/);
BlockAction(13, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(34, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(33, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(1, 'FistfightMinigame', /* NOP */, /* NOP */, /* NOP
*/);
BlockAction(14, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(24, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(4, 'FistfightMinigame', /* NOP */, /* NOP */, /* NOP
*/);
BlockAction(11, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(21, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(27, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
BlockAction(2, 'FistfightMinigame', /* NOP */, /* NOP */, /* NOP
*/);
BlockAction(16, 'FistfightMinigame', /* NOP */, /* NOP */, /* NO
P */);
/* NOP */;
}
public function OnEndFistfightMinigame() : Bool{
GetMovingAgentComponent().SnapToNavigableSpace(false);
FistFightHealthChange(false);

thePlayer.GetPlayerMode().ReleaseForceCombatMode(4);
EquipGeraltFistfightWeapon(false);
SetFistFightMinigameEnabled(false);
SetImmortalityMode(0, 16, /* NOP */);
BlockAllActions('FistfightMinigame', false, /* NOP */, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
super.OnEndFistfightMinigame();
/* NOP */;
}
public function GetFistFightFinisher(masterAnimName : CName, slaveAnimIn
dex : CName){
var index : Int32;
index = RandRange(1, /* NOP */);
switch(index){
case 0:
masterAnimName = 'man_fistfight_finisher_1_win';
slaveAnimIndex = 'man_fistfight_finisher_1_looser';
}
/* NOP */;
}
public function SetFistFightMinigameEnabled(flag : Bool){
fistFightMinigameEnabled = flag;
/* NOP */;
}
public function SetFistFightParams(toDeath : Bool, endsWithBS : Bool){
isFFMinigameToTheDeath = toDeath;
FFMinigameEndsithBS = endsWithBS;
/* NOP */;
}
public function IsFistFightMinigameEnabled() : Bool{
return fistFightMinigameEnabled;
/* NOP */;
}
public function IsFistFightMinigameToTheDeath() : Bool{
return isFFMinigameToTheDeath;
/* NOP */;
}
public function FistFightHealthChange(val : Bool){
if (val == true){
GeraltMaxHealth = thePlayer.GetStatMax(0);
ClampGeraltMaxHealth(2000);
SetHealthPerc(100);
} else {
ClampGeraltMaxHealth(GeraltMaxHealth);
SetHealthPerc(100);
}
/* NOP */;
}
public function ClampGeraltMaxHealth(val : Float){
thePlayer.abilityManager.SetStatPointMax(0, val);
/* NOP */;
}
public function EquipGeraltFistfightWeapon(val : Bool){
if (val){
fistsItems = thePlayer.GetInventory().AddAnItem('Geralt
Fistfight Fists', 1, true, true, /* NOP */);
thePlayer.GetInventory().MountItem(fistsItems[0], true,
/* NOP */);
} else {
thePlayer.GetInventory().DropItem(fistsItems[0], true);

}
/* NOP */;
}
public function GetGwintAiDifficulty() : EGwintDifficultyMode{
return gwintAiDifficulty;
/* NOP */;
}
public function SetGwintAiDifficulty(difficulty : EGwintDifficultyMode){
gwintAiDifficulty = difficulty;
/* NOP */;
}
public function GetGwintAiAggression() : EGwintAggressionMode{
return gwintAiAggression;
/* NOP */;
}
public function SetGwintAiAggression(aggression : EGwintAggressionMode){
gwintAiAggression = aggression;
/* NOP */;
}
public function GetGwintMinigameState() : EMinigameState{
return gwintMinigameState;
/* NOP */;
}
public function SetGwintMinigameState(minigameState : EMinigameState){
gwintMinigameState = minigameState;
/* NOP */;
}
public function OnGwintGameRequested(deckName : CName){
var gwintManager : CR4GwintManager;
gwintManager = theGame.GetGwintManager();
gwintMinigameState = 2;
gwintManager.SetEnemyDeckByName(deckName);
if (gwintManager.GetHasDoneTutorial() || !theGame.GetTutorialSys
tem().AreMessagesEnabled()){
gwintManager.gameRequested = true;
theGame.RequestMenu('DeckBuilder', /* NOP */);
} else {
theGame.RequestMenu('GwintGame', /* NOP */);
}
/* NOP */;
}
public function InitGwintCardNumbersArray(arr : array<Int32>){
gwintCardNumbersArray.Clear();
gwintCardNumbersArray = arr;
/* NOP */;
}
public function GetCardNumbersArray() : array<Int32>{
return gwintCardNumbersArray;
/* NOP */;
}
public function AddCustomCamToStack(customCameraParams : SCustomCameraPa
rams) : Int32{
if (customCameraParams.useCustomCamera){
if (customCameraParams.cameraParams.enums[0].enumType !=
'ECustomCameraType'){
/* NOP */;
return -1;
} else {
customCameraStack.PushBack(customCameraParams);
return customCameraStack.Size() - 1;

}
}
return 0;
/* NOP */;
}
public function DisableCustomCamInStack(customCameraStackIndex : Int32){
if (customCameraStackIndex != -1){
customCameraStack[customCameraStackIndex].useCustomCamer
a = false;
} else {
/* NOP */;
}
/* NOP */;
}
public function OnInteriorStateChanged(inInterior : Bool) : Bool{
interiorCamera = inInterior;
/* NOP */;
}
public function OnModifyPlayerSpeed(flag : Bool) : Bool{
modifyPlayerSpeed = flag;
SetBehaviorVariable('modifyPlayerSpeed', modifyPlayerSpeed, /* N
OP */);
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
var targetRotation : EulerAngles;
if (isStartingFistFightMinigame){
moveData.pivotRotationValue = fistFightTeleportNode.GetW
orldRotation();
isStartingFistFightMinigame = false;
}
if (substateManager.UpdateCameraIfNeeded(moveData, dt)){
return true;
}
if (theGame.IsFocusModeActive()){
theGame.GetGameCamera().ChangePivotRotationController('E
xploration');
theGame.GetGameCamera().ChangePivotDistanceController('D
efault');
theGame.GetGameCamera().ChangePivotPositionController('D
efault');
moveData.pivotRotationController = theGame.GetGameCamera
().GetActivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera
().GetActivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera
().GetActivePivotPositionController();
moveData.pivotPositionController.SetDesiredPosition(theP
layer.GetWorldPosition(), /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(-10.000
000, /* NOP */);
moveData.pivotRotationController.maxPitch = 50.000000;
moveData.pivotDistanceController.SetDesiredDistance(3.50
0000, /* NOP */);
if (!interiorCamera){
moveData.pivotPositionController.offsetZ = 1.500
000;
DampVectorSpring(moveData.cameraLocalSpaceOffset
, moveData.cameraLocalSpaceOffsetVel, Vector(0.500000, 2.000000, 0.300000), 0.20

0000, dt);
} else {
moveData.pivotPositionController.offsetZ = 1.300
000;
DampVectorSpring(moveData.cameraLocalSpaceOffset
, moveData.cameraLocalSpaceOffsetVel, Vector(0.500000, 2.300000, 0.500000), 0.30
0000, dt);
}
return true;
}
if (substateManager.m_SharedDataO.IsForceHeading(targetRotation)
){
moveData.pivotRotationController.SetDesiredHeading(targe
tRotation.Yaw, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(targetR
otation.Pitch, /* NOP */);
moveData.pivotRotationValue.Yaw = LerpAngleF(2.100000 *
dt, moveData.pivotRotationValue.Yaw, targetRotation.Yaw);
moveData.pivotRotationValue.Pitch = LerpAngleF(1.000000
* dt, moveData.pivotRotationValue.Pitch, targetRotation.Pitch);
}
if (customCameraStack.Size() > 0){
}
return false;
/* NOP */;
}
public function RequestQuestCamera(camera : SQuestCameraRequest){
questCameraRequest = camera;
questCameraRequest.requestTimeStamp = theGame.GetEngineTimeAsSec
onds();
/* NOP */;
}
public function ResetQuestCameraRequest(){
var cameraRequest : SQuestCameraRequest;
questCameraRequest = cameraRequest;
/* NOP */;
}
public function OnGameCameraPostTick(moveData : SCameraMovementData, dt
: Float) : Bool{
var ent : CEntity;
var playerPos : Vector;
var angles : EulerAngles;
if (questCameraRequest.requestTimeStamp > 0){
if (questCameraRequest.duration > 0 && questCameraReques
t.requestTimeStamp + questCameraRequest.duration < theGame.GetEngineTimeAsSecond
s()){
ResetQuestCameraRequest();
return false;
}
if (questCameraRequest.lookAtTag){
ent = theGame.GetEntityByTag(questCameraRequest.
lookAtTag);
playerPos = GetWorldPosition();
playerPos.Z += 1.800000;
angles = VecToRotation(ent.GetWorldPosition() playerPos);
moveData.pivotRotationController.SetDesiredHeadi
ng(angles.Yaw, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch
(-angles.Pitch, /* NOP */);

} else {
if (questCameraRequest.requestYaw){
angles = GetWorldRotation();
moveData.pivotRotationController.SetDesi
redHeading(angles.Yaw + questCameraRequest.yaw, /* NOP */);
}
if (questCameraRequest.requestPitch){
moveData.pivotRotationController.SetDesi
redPitch(questCameraRequest.pitch, /* NOP */);
}
}
}
/* NOP */;
}
public function UpdateCameraInterior(moveData : SCameraMovementData, tim
eDelta : Float){
var camDist : Float;
var camOffset : Float;
var rotMultDest : Float;
var rotMult : Float;
var angles : EulerAngles;
theGame.GetGameCamera().ChangePivotRotationController('Explorati
onInterior');
theGame.GetGameCamera().ChangePivotDistanceController('Default')
;
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
moveData.pivotPositionController.SetDesiredPosition(GetWorldPosi
tion(), 15.000000);
if (!constDamper){
constDamper = new ConstDamper in this;
constDamper.SetDamp(0.350000);
}
if (rawPlayerSpeed <= 0 || AbsF(AngleDistance(rawPlayerHeading,
GetHeading())) > 135){
constDamper.Reset();
} else {
rotMult = 1.000000;
}
rotMult = constDamper.UpdateAndGet(timeDelta, rotMult);
if (AbsF(AngleDistance(GetHeading(), moveData.pivotRotationValue
.Yaw)) < 135.000000 && rawPlayerSpeed > 0){
moveData.pivotRotationController.SetDesiredHeading(GetHe
ading(), rotMult);
} else {
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, /* NOP */);
}
moveData.pivotDistanceController.SetDesiredDistance(1.500000, /*
NOP */);
angles = VecToRotation(GetMovingAgentComponent().GetVelocity());
if (AbsF(angles.Pitch) < 8.000000 || bLAxisReleased){
moveData.pivotRotationController.SetDesiredPitch(-10.000
000, /* NOP */);

} else {
moveData.pivotRotationController.SetDesiredPitch(-angles
.Pitch - 18.000000, /* NOP */);
}
if (IsGuarded()){
moveData.pivotPositionController.offsetZ = 1.000000;
} else {
moveData.pivotPositionController.offsetZ = 1.300000;
}
if (playerMoveType >= 2){
camDist = -0.500000;
camOffset = 0.250000;
if (!wasRunning){
smoothTime = 1.000000;
wasRunning = true;
}
DampFloatSpring(smoothTime, vel, 0.100000, 0.500000, tim
eDelta);
} else {
camDist = 0.000000;
camOffset = 0.400000;
smoothTime = 0.200000;
wasRunning = false;
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(0.300000, camDist, 0.300000), smoothTime, timeDelta
);
/* NOP */;
}
protected function UpdateCameraChanneledSign(moveData : SCameraMovementD
ata, timeDelta : Float) : Bool{
var screenSpaceOffset : Float;
var screenSpaceOffsetFwd : Float;
var screenSpaceOffsetUp : Float;
var heading : Float;
var pitch : Float;
var playerToTargetRot : EulerAngles;
var rightOffset : Float;
var leftOffset : Float;
var angles : EulerAngles;
var vec : Vector;
rightOffset = -20.000000;
leftOffset = 15.000000;
if (IsCurrentSignChanneled() && GetCurrentlyCastSign() != 3 && G
etCurrentlyCastSign() != 1){
theGame.GetGameCamera().ChangePivotRotationController('S
ignChannel');
theGame.GetGameCamera().ChangePivotDistanceController('S
ignChannel');
moveData.pivotRotationController = theGame.GetGameCamera
().GetActivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera
().GetActivePivotDistanceController();
if (GetCurrentlyCastSign() == 4){
leftOffset = 32.000000;
}
if (oTCameraOffset != leftOffset && oTCameraOffset != ri
ghtOffset){
if (interiorCamera && !moveTarget || AngleDistan
ce(GetHeading(), moveData.pivotRotationValue.Yaw) < 0){

oTCameraOffset = leftOffset;
} else {
oTCameraOffset = rightOffset;
}
}
if (oTCameraOffset == leftOffset){
screenSpaceOffset = 0.650000;
oTCameraPitchOffset = 13.000000;
} else if (oTCameraOffset == rightOffset){
screenSpaceOffset = -0.650000;
oTCameraPitchOffset = 13.000000;
}
moveData.pivotPositionController.offsetZ = 1.300000;
if (!delayCameraOrientationChange){
if (GetOrientationTarget() == 3 || GetOrientatio
nTarget() == 4){
if (bRAxisReleased){
heading = moveData.pivotRotation
Value.Yaw;
pitch = moveData.pivotRotationVa
lue.Pitch;
} else {
heading = moveData.pivotRotation
Value.Yaw + oTCameraOffset;
pitch = moveData.pivotRotationVa
lue.Pitch;
}
} else if (GetOrientationTarget() == 1){
if (GetDisplayTarget()){
vec = GetDisplayTarget().GetWorl
dPosition() - GetWorldPosition();
} else if (slideTarget){
vec = slideTarget.GetWorldPositi
on() - GetWorldPosition();
} else if (GetTarget()){
vec = GetTarget().GetWorldPositi
on() - GetWorldPosition();
} else {
vec = GetHeadingVector();
}
angles = VecToRotation(vec);
heading = angles.Yaw + oTCameraOffset;
pitch = -angles.Pitch - oTCameraPitchOff
set;
} else {
angles = VecToRotation(GetHeadingVector(
));
heading = angles.Yaw + oTCameraOffset;
pitch = -angles.Pitch - oTCameraPitchOff
set;
}
if (!wasBRAxisPushed && !bRAxisReleased){
wasBRAxisPushed = true;
}
moveData.pivotRotationController.SetDesiredHeadi
ng(heading, 2.000000);
moveData.pivotRotationController.SetDesiredPitch
(pitch, /* NOP */);
} else {
moveData.pivotRotationController.SetDesiredHeadi

ng(moveData.pivotRotationValue.Yaw, 1.000000);
moveData.pivotRotationController.SetDesiredPitch
(-oTCameraPitchOffset, /* NOP */);
}
if (moveData.pivotRotationValue.Pitch <= 5.000000 && mov
eData.pivotRotationValue.Pitch >= -15.000000){
screenSpaceOffsetFwd = 1.800000;
screenSpaceOffsetUp = 0.400000;
} else if (moveData.pivotRotationValue.Pitch > 0){
screenSpaceOffsetFwd = moveData.pivotRotationVal
ue.Pitch * 0.007270 + 1.275000;
screenSpaceOffsetFwd = ClampF(screenSpaceOffsetF
wd, 1.500000, 2.200000);
screenSpaceOffsetUp = -moveData.pivotRotationVal
ue.Pitch * 0.007270 + 0.436300;
screenSpaceOffsetUp = ClampF(screenSpaceOffsetUp
, 0, 0.300000);
} else {
if (GetCurrentlyCastSign() == 4){
screenSpaceOffsetFwd = -moveData.pivotRo
tationValue.Pitch * 0.042500 + 0.862500;
screenSpaceOffsetFwd = ClampF(screenSpac
eOffsetFwd, 1.500000, 2.300000);
} else {
screenSpaceOffsetFwd = -moveData.pivotRo
tationValue.Pitch * 0.035000 + 0.750000;
screenSpaceOffsetFwd = ClampF(screenSpac
eOffsetFwd, 1.500000, 2.600000);
}
screenSpaceOffsetUp = -moveData.pivotRotationVal
ue.Pitch * 0.005000 + 0.325000;
screenSpaceOffsetUp = ClampF(screenSpaceOffsetUp
, 0.400000, 0.500000);
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(screenSpaceOffset, screenSpaceOffsetFwd, sc
reenSpaceOffsetUp), 0.250000, timeDelta);
moveData.pivotDistanceController.SetDesiredDistance(2.80
0000, 5.000000);
moveData.pivotPositionController.SetDesiredPosition(GetW
orldPosition(), /* NOP */);
return true;
} else {
wasBRAxisPushed = false;
return false;
}
/* NOP */;
}
protected function UpdateCameraForSpecialAttack(moveData : SCameraMoveme
ntData, timeDelta : Float) : Bool{
var screenSpaceOffset : Float;
var tempHeading : Float;
var cameraOffsetLeft : Float;
var cameraOffsetRight : Float;
if (!specialAttackCamera){
return false;
}
theGame.GetGameCamera().ForceManualControlHorTimeout();
theGame.GetGameCamera().ForceManualControlVerTimeout();
cameraOffsetLeft = 30.000000;

cameraOffsetRight = -30.000000;
theGame.GetGameCamera().ChangePivotRotationController('SignChann
el');
theGame.GetGameCamera().ChangePivotDistanceController('SignChann
el');
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
if (slideTarget){
tempHeading = VecHeading(slideTarget.GetWorldPosition()
- GetWorldPosition());
} else {
tempHeading = GetHeading();
}
oTCameraPitchOffset = 0.000000;
if (interiorCamera && !moveTarget || AngleDistance(tempHeading,
moveData.pivotRotationValue.Yaw) < 0){
oTCameraOffset = cameraOffsetLeft;
} else {
oTCameraOffset = cameraOffsetRight;
}
if (oTCameraOffset == cameraOffsetLeft){
if (delayCameraOrientationChange || delayOrientationChan
ge){
screenSpaceOffset = 0.750000;
moveData.pivotDistanceController.SetDesiredDista
nce(1.600000, 3.000000);
moveData.pivotPositionController.offsetZ = 1.400
000;
moveData.pivotRotationController.SetDesiredPitch
(-15.000000, /* NOP */);
} else {
screenSpaceOffset = 0.700000;
moveData.pivotDistanceController.SetDesiredDista
nce(3.250000, /* NOP */);
moveData.pivotPositionController.offsetZ = 1.200
000;
moveData.pivotRotationController.SetDesiredPitch
(-10.000000, /* NOP */);
}
} else if (oTCameraOffset == cameraOffsetRight){
if (delayCameraOrientationChange || delayOrientationChan
ge){
screenSpaceOffset = -0.850000;
moveData.pivotDistanceController.SetDesiredDista
nce(1.600000, 3.000000);
moveData.pivotPositionController.offsetZ = 1.400
000;
moveData.pivotRotationController.SetDesiredPitch
(-15.000000, /* NOP */);
} else {
screenSpaceOffset = -0.800000;
moveData.pivotDistanceController.SetDesiredDista
nce(3.250000, /* NOP */);
moveData.pivotPositionController.offsetZ = 1.200
000;
moveData.pivotRotationController.SetDesiredPitch
(-10.000000, /* NOP */);
}

} else {
moveData.pivotDistanceController.SetDesiredDistance(1.25
0000, 3.000000);
moveData.pivotPositionController.offsetZ = 1.300000;
moveData.pivotRotationController.SetDesiredPitch(-5.5000
00, /* NOP */);
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(screenSpaceOffset, 0.000000, 0.000000), 1.000000, t
imeDelta);
if (!delayCameraOrientationChange){
if (moveTarget){
moveData.pivotRotationController.SetDesiredHeadi
ng(GetHeading() + oTCameraOffset, 0.500000);
} else {
moveData.pivotRotationController.SetDesiredHeadi
ng(GetHeading() + oTCameraOffset, 1.000000);
}
} else {
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, 1.000000);
}
moveData.pivotPositionController.SetDesiredPosition(GetWorldPosi
tion(), /* NOP */);
return true;
/* NOP */;
}
protected function UpdateCameraSprint(moveData : SCameraMovementData, ti
meDelta : Float){
var angleDiff : Float;
var camOffsetVector : Vector;
var smoothSpeed : Float;
var camera : CCustomCamera;
var camAngularSpeed : Float;
var playerToCamAngle : Float;
var useExplorationSprintCam : Bool;
camera = theGame.GetGameCamera();
if (camera){
if (sprintingCamera){
theGame.GetGameCamera().ForceManualControlVerTim
eout();
playerToCamAngle = AbsF(AngleDistance(GetHeading
(), moveData.pivotRotationValue.Yaw));
useExplorationSprintCam = false;
if (useExplorationSprintCam){
if (playerToCamAngle <= 45){
theGame.GetGameCamera().ChangePi
votRotationController('Sprint');
moveData.pivotRotationController
= theGame.GetGameCamera().GetActivePivotRotationController();
moveData.pivotRotationController
.SetDesiredHeading(GetHeading(), 0.250000);
moveData.pivotRotationController
.SetDesiredPitch(-3.500000, 0.500000);
thePlayer.EnableManualCameraCont
rol(true, 'Sprint');
} else {
thePlayer.EnableManualCameraCont
rol(false, 'Sprint');
}

} else {
thePlayer.EnableManualCameraControl(true
, 'Sprint');
}
if (bRAxisReleased){
if (AbsF(rawLeftJoyRot) > 25){
angleDiff = AngleDistance(GetHea
ding(), moveData.pivotRotationValue.Yaw);
}
pivotRotationTimeStamp = theGame.GetEngi
neTimeAsSeconds();
previousRotationVelocity = 0.000000;
} else if (previousRotationVelocity <= 0 && AbsF
(moveData.pivotRotationVelocity.Yaw) > 250){
pivotRotationTimeStamp = theGame.GetEngi
neTimeAsSeconds();
previousRotationVelocity = AbsF(moveData
.pivotRotationVelocity.Yaw);
}
if (pivotRotationTimeStamp + 0.400000 <= theGame
.GetEngineTimeAsSeconds() && AbsF(moveData.pivotRotationVelocity.Yaw) > 250){
angleDiff = VecHeading(rawRightJoyVec);
}
if (useExplorationSprintCam){
if (playerToCamAngle > 90){
camOffsetVector.X = 0.000000;
smoothSpeed = 1.000000;
} else if (angleDiff > 15.000000){
camOffsetVector.X = -0.800000;
smoothSpeed = 1.000000;
previousOffset = true;
} else if (angleDiff < -15.000000){
camOffsetVector.X = 0.475000;
smoothSpeed = 1.500000;
previousOffset = false;
} else if (previousOffset){
camOffsetVector.X = -0.800000;
smoothSpeed = 1.500000;
} else {
camOffsetVector.X = 0.475000;
smoothSpeed = 1.500000;
}
camOffsetVector.Y = 1.400000;
camOffsetVector.Z = 0.275000;
} else {
smoothSpeed = 0.750000;
camOffsetVector.X = 0.000000;
camOffsetVector.Y = 1.000000;
camOffsetVector.Z = 0.200000;
moveData.pivotRotationController.SetDesi
redPitch(-10.000000, 0.500000);
}
DampVectorConst(sprintOffset, camOffsetVector, s
moothSpeed, timeDelta);
moveData.cameraLocalSpaceOffset = sprintOffset;
DampFloatSpring(camera.fov, fovVel, 70.000000, 1
.000000, timeDelta);
} else {
sprintOffset = moveData.cameraLocalSpaceOffset;
DampFloatSpring(camera.fov, fovVel, 60.000000, 1

.000000, timeDelta);
previousOffset = false;
}
}
/* NOP */;
}
public function EnableSprintingCamera(flag : Bool){
if (!useSprintingCameraAnim){
return;
}
super.EnableSprintingCamera(flag);
if (!flag){
thePlayer.EnableManualCameraControl(true, 'Sprint');
}
/* NOP */;
}
protected function UpdateCameraCombatActionButNotInCombat(moveData : SCa
meraMovementData, timeDelta : Float){
var vel : Vector;
var heading : Float;
var pitch : Float;
var headingMult : Float;
var pitchMult : Float;
var camOffset : Vector;
var buff : CBaseGameplayEffect;
var runningAndAlertNear : Bool;
var desiredDist : Float;
if (!IsCurrentSignChanneled() || GetCurrentlyCastSign() == 3 ||
GetCurrentlyCastSign() == 1 && !specialAttackCamera && !IsInCombatActionFriendly
()){
buff = GetCurrentlyAnimatedCS();
runningAndAlertNear = super.GetPlayerCombatStance() == 1
&& playerMoveType == 2 && !GetDisplayTarget();
if (runningAndAlertNear || super.GetPlayerCombatStance()
== 2 && !IsInCombatAction() && !buff){
camOffset.X = 0.000000;
camOffset.Y = 0.000000;
camOffset.Z = -0.100000;
if (runningAndAlertNear){
moveData.pivotDistanceController.SetDesi
redDistance(4.000000, /* NOP */);
moveData.pivotPositionController.offsetZ
= 1.500000;
}
} else {
camOffset.X = 0.000000;
camOffset.Y = -1.500000;
camOffset.Z = -0.200000;
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(camOffset.X, camOffset.Y, camOffset.Z), 0.4
00000, timeDelta);
sprintOffset = moveData.cameraLocalSpaceOffset;
heading = moveData.pivotRotationValue.Yaw;
if (GetOrientationTarget() == 3 || GetOrientationTarget(
) == 4){
pitch = moveData.pivotRotationValue.Pitch;
} else if (lastAxisInputIsMovement || GetBehaviorVariabl
e('combatActionType', /* NOP */) == 0 || GetBehaviorVariable('combatActionType',
/* NOP */) == 1 || GetBehaviorVariable('combatActionType', /* NOP */) == 6 && !

IsCurrentSignChanneled() && GetCurrentlyCastSign() == 3){


theGame.GetGameCamera().ForceManualControlVerTim
eout();
pitch = -20.000000;
} else {
pitch = moveData.pivotRotationValue.Pitch;
}
headingMult = 1.000000;
pitchMult = 1.000000;
if (GetBehaviorVariable('combatActionType', /* NOP */) =
= 6 && GetEquippedSign() == 0 || GetEquippedSign() == 1 && GetBehaviorVariable('
alternateSignCast', /* NOP */) == 1){
theGame.GetGameCamera().ForceManualControlVerTim
eout();
pitch = -20.000000;
}
if (IsCurrentSignChanneled() && GetCurrentlyCastSign() =
= 3){
pitch = moveData.pivotRotationValue.Pitch;
}
moveData.pivotRotationController.SetDesiredHeading(headi
ng, /* NOP */);
moveData.pivotRotationController.SetDesiredPitch(pitch,
/* NOP */);
}
/* NOP */;
}
public function OnGameCameraExplorationRotCtrlChange() : Bool{
if (substateManager){
return substateManager.OnGameCameraExplorationRotCtrlCha
nge();
}
return false;
/* NOP */;
}
public function SetCustomRotation(customRotationName : CName, rotHeading
: Float, rotSpeed : Float, activeTime : Float, rotateExistingDeltaLocation : Bo
ol){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customRotationName);
movementAdjustor.Cancel(ticket);
ticket = movementAdjustor.CreateNewRequest(customRotationName);
movementAdjustor.Continuous(ticket);
movementAdjustor.ReplaceRotation(ticket, /* NOP */);
movementAdjustor.RotateTo(ticket, rotHeading);
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, rotSpeed);
if (rotSpeed == 0.000000){
movementAdjustor.AdjustmentDuration(ticket, activeTime);
}
movementAdjustor.KeepActiveFor(ticket, activeTime);
movementAdjustor.RotateExistingDeltaLocation(ticket, rotateExist
ingDeltaLocation);
/* NOP */;
}
public function UpdateCustomRotationHeading(customRotationName : CName,
rotHeading : Float){
var movementAdjustor : CMovementAdjustor;

var ticket : SMovementAdjustmentRequestTicket;


movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customRotationName);
movementAdjustor.RotateTo(ticket, rotHeading);
/* NOP */;
}
public function SetCustomRotationTowards(customRotationName : CName, tar
get : CActor, rotSpeed : Float, activeTime : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customRotationName);
movementAdjustor.Cancel(ticket);
ticket = movementAdjustor.CreateNewRequest(customRotationName);
movementAdjustor.Continuous(ticket);
movementAdjustor.ReplaceRotation(ticket, /* NOP */);
movementAdjustor.RotateTowards(ticket, target, /* NOP */);
movementAdjustor.MaxRotationAdjustmentSpeed(ticket, rotSpeed);
if (activeTime > 0.000000){
movementAdjustor.KeepActiveFor(ticket, activeTime);
} else {
movementAdjustor.DontEnd(ticket);
}
/* NOP */;
}
public function CustomLockMovement(customMovementName : CName, heading :
Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customMovementName);
movementAdjustor.Cancel(ticket);
ticket = movementAdjustor.CreateNewRequest(customMovementName);
movementAdjustor.Continuous(ticket);
movementAdjustor.DontEnd(ticket);
movementAdjustor.LockMovementInDirection(ticket, heading);
/* NOP */;
}
public function BindMovementAdjustmentToEvent(customRotationName : CName
, eventName : CName){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customRotationName);
movementAdjustor.BindToEvent(ticket, eventName, /* NOP */);
/* NOP */;
}
public function UpdateCustomLockMovementHeading(customMovementName : CNa
me, heading : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customMovementName);
movementAdjustor.LockMovementInDirection(ticket, heading);
/* NOP */;

}
public function CustomLockDistance(customMovementName : CName, maintainD
istanceTo : CNode, minDist : Float, maxDist : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customMovementName);
movementAdjustor.Cancel(ticket);
ticket = movementAdjustor.CreateNewRequest(customMovementName);
movementAdjustor.Continuous(ticket);
movementAdjustor.SlideTowards(ticket, maintainDistanceTo, minDis
t, maxDist);
/* NOP */;
}
public function UpdateCustomLockDistance(customMovementName : CName, mai
ntainDistanceTo : CNode, minDist : Float, maxDist : Float){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = GetMovingAgentComponent().GetMovementAdjustor
();
ticket = movementAdjustor.GetRequest(customMovementName);
movementAdjustor.SlideTowards(ticket, maintainDistanceTo, minDis
t, maxDist);
/* NOP */;
}
public function EnableManualCameraControl(enable : Bool, sourceName : CN
ame){
if (!enable){
if (!disableManualCameraControlStack.Contains(sourceName
)){
disableManualCameraControlStack.PushBack(sourceN
ame);
}
} else {
disableManualCameraControlStack.Remove(sourceName);
}
if (disableManualCameraControlStack.Size() > 0){
theGame.GetGameCamera().EnableManualControl(false);
} else {
theGame.GetGameCamera().EnableManualControl(true);
}
/* NOP */;
}
public function IsCameraControlDisabled(disabledBySourceName : CName) :
Bool{
if (disabledBySourceName){
return disableManualCameraControlStack.Contains(disabled
BySourceName);
} else {
return disableManualCameraControlStack.Size() > 0;
}
/* NOP */;
}
public function DisableManualCameraControlStackHasSource(sourceName : CN
ame) : Bool{
return disableManualCameraControlStack.Contains(sourceName);
/* NOP */;
}
public function ClearDisableManualCameraControlStack(){

disableManualCameraControlStack.Clear();
theGame.GetGameCamera().EnableManualControl(true);
/* NOP */;
}
public function SetOrientationTarget(target : EOrientationTarget){
if (IsPCModeEnabled() && target == 0){
target = 3;
}
orientationTarget = target;
/* NOP */;
}
public function GetOrientationTarget() : EOrientationTarget{
return orientationTarget;
/* NOP */;
}
public function AddCustomOrientationTarget(orientationTarget : EOrientat
ionTarget, sourceName : CName){
var customOrientationInfo : SCustomOrientationInfo;
var i : Int32;
if (customOrientationInfoStack.Size() > 0){
i = customOrientationInfoStack.Size() - 1;
while (i >= 0){
if (customOrientationInfoStack[i].sourceName ==
sourceName){
customOrientationInfoStack.Erase(i);
}
i -= 1;
}
}
customOrientationInfo.sourceName = sourceName;
customOrientationInfo.orientationTarget = orientationTarget;
customOrientationInfoStack.PushBack(customOrientationInfo);
SetOrientationTarget(orientationTarget);
/* NOP */;
}
public function RemoveCustomOrientationTarget(sourceName : CName){
var customOrientationInfo : SCustomOrientationInfo;
var i : Int32;
if (customOrientationInfoStack.Size() > 0){
i = customOrientationInfoStack.Size() - 1;
while (i >= 0){
if (customOrientationInfoStack[i].sourceName ==
sourceName){
customOrientationInfoStack.Erase(i);
}
i -= 1;
}
} else {
/* NOP */;
}
/* NOP */;
}
protected function ClearCustomOrientationInfoStack(){
customOrientationInfoStack.Clear();
/* NOP */;
}
protected function GetCustomOrientationTarget(infoStack : SCustomOrienta
tionInfo) : Bool{
var size : Int32;
size = customOrientationInfoStack.Size();

if (size <= 0){


return false;
} else {
infoStack = customOrientationInfoStack[size - 1];
return true;
}
/* NOP */;
}
public function SetOrientationTargetCustomHeading(heading : Float, sourc
eName : CName) : Bool{
var i : Int32;
if (customOrientationInfoStack.Size() > 0){
i = customOrientationInfoStack.Size() - 1;
while (i >= 0){
if (customOrientationInfoStack[i].sourceName ==
sourceName){
customOrientationInfoStack[i].customHead
ing = heading;
return true;
}
i -= 1;
}
}
/* NOP */;
return false;
/* NOP */;
}
public function GetOrientationTargetCustomHeading() : Float{
var i : Int32;
if (customOrientationInfoStack.Size() > 0){
i = customOrientationInfoStack.Size() - 1;
while (i >= 0){
if (customOrientationInfoStack[i].orientationTar
get == 2){
return customOrientationInfoStack[i].cus
tomHeading;
}
i -= 1;
}
}
/* NOP */;
return -1.000000;
/* NOP */;
}
public function GetCombatActionOrientationTarget(combatActionType : ECom
batActionType) : EOrientationTarget{
var newCustomOrientationTarget : EOrientationTarget;
var targetEnt : CGameplayEntity;
var targetActor : CActor;
if (GetCurrentStateName() == 'AimThrow'){
newCustomOrientationTarget = 4;
} else {
targetEnt = GetDisplayTarget();
targetActor = (CActor)targetEnt;
if (targetEnt){
if (targetActor){
if (moveTarget){
newCustomOrientationTarget = 1;
} else if (IsSwimming()){
newCustomOrientationTarget = 3;

} else if (lastAxisInputIsMovement){
newCustomOrientationTarget = 0;
} else {
newCustomOrientationTarget = 1;
}
} else if (combatActionType == 10 && targetEnt.H
asTag('softLock_Bolt')){
newCustomOrientationTarget =
} else if (IsSwimming()){
newCustomOrientationTarget =
} else if (lastAxisInputIsMovement){
newCustomOrientationTarget =
} else {
newCustomOrientationTarget =
}
} else if (IsUsingVehicle()){
newCustomOrientationTarget = 3;
} else if (lastAxisInputIsMovement){
if (IsSwimming()){
newCustomOrientationTarget =
} else {
newCustomOrientationTarget =
}
} else {
newCustomOrientationTarget = 3;
}

1;
3;
0;
3;

3;
0;

}
return newCustomOrientationTarget;
/* NOP */;
}
public function GetOrientationTargetHeading(orientationTarget : EOrienta
tionTarget) : Float{
var heading : Float;
if (orientationTarget == 3){
heading = VecHeading(theCamera.GetCameraDirection());
} else if (orientationTarget == 4){
heading = VecHeading(theCamera.GetCameraDirection()) - o
TCameraOffset;
} else if (orientationTarget == 2){
heading = GetOrientationTargetCustomHeading();
} else if (GetDisplayTarget() && orientationTarget == 1){
if ((CActor)GetDisplayTarget()){
heading = VecHeading(GetDisplayTarget().GetWorld
Position() - GetWorldPosition());
} else if (GetDisplayTarget().HasTag('softLock_Bolt')){
heading = VecHeading(GetDisplayTarget().GetWorld
Position() - GetWorldPosition());
} else {
heading = GetHeading();
}
} else {
heading = GetHeading();
}
return heading;
/* NOP */;
}
public function OnDelayOrientationChange() : Bool{
var delayOrientation : Bool;
var delayCameraRotation : Bool;
var moveData : SCameraMovementData;

var time : Float;


time = 0.010000;
if (theInput.GetActionValue('CastSignHold') == 1.000000){
actionType = 0;
if (moveTarget){
delayOrientation = true;
} else if (!GetBIsCombatActionAllowed()){
delayOrientation = true;
}
} else if (theInput.GetActionValue('ThrowItemHold') == 1.000000)
{
actionType = 3;
delayOrientation = true;
} else if (theInput.GetActionValue('SpecialAttackHeavy') == 1.00
0000){
actionType = 2;
if (!slideTarget){
delayOrientation = true;
} else {
delayOrientation = true;
}
} else if (IsGuarded() && !moveTarget){
actionType = 1;
delayOrientation = true;
}
if (delayOrientation){
delayOrientationChange = true;
theGame.GetGameCamera().ForceManualControlHorTimeout();
theGame.GetGameCamera().ForceManualControlVerTimeout();
AddTimer('DelayOrientationChangeTimer', time, true, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
if (delayCameraRotation){
delayCameraOrientationChange = true;
theGame.GetGameCamera().ForceManualControlHorTimeout();
theGame.GetGameCamera().ForceManualControlVerTimeout();
AddTimer('DelayOrientationChangeTimer', time, true, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnDelayOrientationChangeOff() : Bool{
delayOrientationChange = false;
delayCameraOrientationChange = false;
RemoveTimer('DelayOrientationChangeTimer', /* NOP */);
/* NOP */;
}
public timer function DelayOrientationChangeTimer(optional time : Float,
optional id : Int32){
if (actionType == 0 && theInput.GetActionValue('CastSignHold') =
= 0.000000 || actionType == 2 && theInput.GetActionValue('SpecialAttackHeavy') =
= 0.000000 || actionType == 3 && theInput.GetActionValue('ThrowItemHold') == 0.0
00000 || actionType == 1 && !IsGuarded() || VecLength(rawRightJoyVec) > 0.000000
){
OnDelayOrientationChangeOff();
}
/* NOP */;
}
public function SetCombatActionHeading(heading : Float){
combatActionHeading = heading;

/* NOP */;
}
public function GetCombatActionHeading() : Float{
return combatActionHeading;
/* NOP */;
}
protected function EnableCloseCombatCharacterRadius(flag : Bool){
var actor : CActor;
actor = (CActor)slideTarget;
if (flag){
GetMovingAgentComponent().SetVirtualRadius('CloseCombatC
haracterRadius', /* NOP */);
if (actor){
actor.GetMovingAgentComponent().SetVirtualRadius
('CloseCombatCharacterRadius', /* NOP */);
}
} else if (IsInCombat()){
GetMovingAgentComponent().SetVirtualRadius('CombatCharac
terRadius', /* NOP */);
if (actor){
actor.GetMovingAgentComponent().SetVirtualRadius
('CombatCharacterRadius', /* NOP */);
}
} else {
GetMovingAgentComponent().ResetVirtualRadius(/* NOP */);
if (actor){
actor.GetMovingAgentComponent().ResetVirtualRadi
us(/* NOP */);
}
}
/* NOP */;
}
public function SnapToNavMesh(flag : Bool){
var comp : CMovingAgentComponent;
comp = GetMovingAgentComponent();
if (comp){
comp.SnapToNavigableSpace(flag);
isSnappedToNavMesh = flag;
} else {
snapToNavMeshCachedFlag = flag;
AddTimer('DelayedSnapToNavMesh', 0.200000, /* NOP */, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function DelayedSnapToNavMesh(optional dt : Float, optional
id : Int32){
SnapToNavMesh(snapToNavMeshCachedFlag);
/* NOP */;
}
public function EnableSnapToNavMesh(source : CName, enable : Bool){
if (enable){
if (!navMeshSnapInfoStack.Contains(source)){
navMeshSnapInfoStack.PushBack(source);
}
} else if (navMeshSnapInfoStack.Contains(source)){
navMeshSnapInfoStack.Remove(source);
}
if (navMeshSnapInfoStack.Size() > 0){
SnapToNavMesh(true);

} else {
SnapToNavMesh(false);
}
/* NOP */;
}
public function CanSprint(speed : Float) : Bool{
if (speed <= 0.800000){
return false;
}
if (thePlayer.GetIsSprintToggled()){
} else if (!sprintActionPressed){
return false;
} else if (!theInput.IsActionPressed('Sprint') || theInput.LastU
sedGamepad() && IsInsideInteraction() && GetHowLongSprintButtonWasPressed() < 0.
120000){
return false;
}
if (thePlayer.HasBuff(39)){
return false;
}
if (!IsSwimming()){
if (ShouldUseStaminaWhileSprinting() && !GetIsSprinting(
) && !IsInCombat() && GetStatPercents(2) <= 0.900000){
return false;
}
if (!IsCombatMusicEnabled() || IsInFistFightMiniGame() &
& !IsActionAllowed(14) || !IsActionAllowed(26)){
return false;
}
if (IsTerrainTooSteepToRunUp()){
return false;
}
if (IsInCombatAction()){
return false;
}
if (IsInAir()){
return false;
}
}
if (theGame.IsFocusModeActive()){
return false;
}
return true;
/* NOP */;
}
public function SetTerrainPitch(pitch : Float){
terrainPitch = pitch;
/* NOP */;
}
public function IsTerrainTooSteepToRunUp() : Bool{
return terrainPitch <= disableSprintTerrainPitch;
/* NOP */;
}
public function SetTempLookAtTarget(actor : CGameplayEntity){
tempLookAtTarget = actor;
/* NOP */;
}
public function OnBeingWarnedStart(sender : CActor) : Bool{
if (!beingWarnedBy.Contains(sender)){
beingWarnedBy.PushBack(sender);

}
/* NOP */;
}
public function OnBeingWarnedStop(sender : CActor) : Bool{
beingWarnedBy.Remove(sender);
/* NOP */;
}
public function OnCanFindPath(sender : CActor) : Bool{
AddCanFindPathEnemyToList(sender, true);
/* NOP */;
}
public function OnCannotFindPath(sender : CActor) : Bool{
AddCanFindPathEnemyToList(sender, false);
/* NOP */;
}
public function OnBecomeAwareAndCanAttack(sender : CActor) : Bool{
AddEnemyToHostileEnemiesList(sender, true);
OnApproachAttack(sender);
/* NOP */;
}
public function OnBecomeUnawareOrCannotAttack(sender : CActor) : Bool{
AddEnemyToHostileEnemiesList(sender, false);
OnApproachAttackEnd(sender);
OnCannotFindPath(sender);
/* NOP */;
}
public function OnApproachAttack(sender : CActor) : Bool{
AddEnemyToHostileEnemiesList(sender, true);
super.OnApproachAttack(sender);
/* NOP */;
}
public function OnApproachAttackEnd(sender : CActor) : Bool{
AddEnemyToHostileEnemiesList(sender, false);
super.OnApproachAttackEnd(sender);
/* NOP */;
}
public function OnAttack(sender : CActor) : Bool{
super.OnAttack(sender);
/* NOP */;
}
public function OnAttackEnd(sender : CActor) : Bool{
super.OnAttackEnd(sender);
/* NOP */;
}
public function OnHitCeiling() : Bool{
substateManager.ReactOnHitCeiling();
/* NOP */;
}
public function AddEnemyToHostileEnemiesList(actor : CActor, add : Bool)
{
if (add){
RemoveTimer('RemoveEnemyFromHostileEnemiesListTimer', /*
NOP */);
if (!hostileEnemies.Contains(actor)){
hostileEnemies.PushBack(actor);
if (!actor.IsHuman()){
hostileMonsters.PushBack(actor);
}
}
} else if (hostileEnemies.Size() == 1){

if (!actor.IsAlive() || actor.IsKnockedUnconscious()){
hostileEnemies.Remove(actor);
if (!actor.IsHuman()){
hostileMonsters.Remove(actor);
}
} else {
if (hostileEnemyToRemove){
hostileEnemies.Remove(hostileEnemyToRemo
ve);
if (!hostileEnemyToRemove.IsHuman()){
hostileMonsters.Remove(hostileEn
emyToRemove);
}
}
hostileEnemyToRemove = actor;
AddTimer('RemoveEnemyFromHostileEnemiesListTimer
', 3.000000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
hostileEnemies.Remove(actor);
if (!actor.IsHuman()){
hostileMonsters.Remove(actor);
}
}
/* NOP */;
}
public function ShouldEnableCombatMusic() : Bool{
var moveTargetNPC : CNewNPC;
if (thePlayer.GetPlayerMode().GetForceCombatMode()){
return true;
} else if (!IsCombatMusicEnabled()){
if (IsInCombat()){
return true;
} else if (IsThreatened()){
moveTargetNPC = (CNewNPC)moveTarget;
if (moveTargetNPC.IsRanged() && hostileEnemies.C
ontains(moveTargetNPC)){
return true;
} else {
return false;
}
} else {
return false;
}
} else if (thePlayer.IsThreatened() && hostileEnemies.Size() > 0
|| thePlayer.GetPlayerCombatStance() == 1 || IsInCombat() || finishableEnemiesL
ist.Size() > 0 || isInFinisher){
return true;
} else {
return false;
}
/* NOP */;
}
public function AddCanFindPathEnemyToList(actor : CActor, add : Bool){
if (disablecanFindPathEnemiesListUpdate){
return;
}
if (add && !canFindPathEnemiesList.Contains(actor)){
canFindPathEnemiesList.PushBack(actor);
} else if (!add){

canFindPathEnemiesList.Remove(actor);
if (canFindPathEnemiesList.Size() <= 0){
playerMode.UpdateCombatMode(/* NOP */);
}
}
/* NOP */;
}
public function ClearCanFindPathEnemiesList(dt : Float, id : Int32){
canFindPathEnemiesList.Clear();
/* NOP */;
}
public function AddToFinishableEnemyList(actor : CActor, add : Bool){
if (add && !finishableEnemiesList.Contains(actor)){
finishableEnemiesList.PushBack(actor);
} else if (!add){
finishableEnemiesList.Remove(actor);
}
/* NOP */;
}
private timer function ClearFinishableEnemyList(optional dt : Float, opt
ional id : Int32){
finishableEnemiesList.Clear();
/* NOP */;
}
private timer function RemoveEnemyFromHostileEnemiesListTimer(optional t
ime : Float, optional id : Int32){
hostileEnemies.Remove(hostileEnemyToRemove);
if (hostileEnemyToRemove.IsMonster()){
hostileMonsters.Remove(hostileEnemyToRemove);
}
hostileEnemyToRemove = NULL;
/* NOP */;
}
private function ClearHostileEnemiesList(){
hostileEnemies.Clear();
hostileMonsters.Clear();
canFindPathEnemiesList.Clear();
/* NOP */;
}
public function GetMoveTargets() : array<CActor>{
return moveTargets;
/* NOP */;
}
public function GetNumberOfMoveTargets() : Int32{
return moveTargets.Size();
/* NOP */;
}
public function FindMoveTarget(){
var moveTargetDists : array<Float>;
var moveTargetCanPathFinds : array<Bool>;
var aPotentialMoveTargetCanFindPath : Bool;
var newMoveTarget : CActor;
var actors : array<CActor>;
var currentHeading : Float;
var size : Int32;
var i : Int32;
var playerToNewMoveTargetDist : Float;
var playerToMoveTargetDist : Float;
var confirmEmptyMoveTarget : Bool;
var newEmptyMoveTargetTimer : Float;

var wasVisibleInFullFrame : Bool;


var setIsThreatened : Bool;
var enemysTarget : CActor;
var isEnemyInCombat : Bool;
var potentialMoveTargets : array<CActor>;
var onlyThreatTargets : Bool;
thePlayer.SetupEnemiesCollection(enemyCollectionDist, enemyColle
ctionDist, 10, 'None', 64 + 256 + 128 + 4);
if (GetCurrentStateName() != 'PlayerDialogScene' && IsAlive()){
super.GetVisibleEnemies(actors);
if (hostileEnemies.Size() > 0){
i = 0;
while (i < hostileEnemies.Size()){
if (!actors.Contains(hostileEnemies[i]))
{
actors.PushBack(hostileEnemies[i
]);
}
i += 1;
}
}
if (finishableEnemiesList.Size() > 0){
i = 0;
while (i < finishableEnemiesList.Size()){
if (!actors.Contains(finishableEnemiesLi
st[i])){
actors.PushBack(finishableEnemie
sList[i]);
}
i += 1;
}
}
if (moveTarget && !actors.Contains(moveTarget)){
actors.PushBack(moveTarget);
}
FilterActors(actors, onlyThreatTargets, false);
if (actors.Size() > 0){
setIsThreatened = false;
if (onlyThreatTargets){
setIsThreatened = true;
} else {
i = 0;
while (i < actors.Size()){
if (IsThreat(actors[i], /* NOP *
/)){
setIsThreatened = true;
break;
} else {
enemysTarget = actors[i]
.GetTarget();
isEnemyInCombat = actors
[i].IsInCombat();
if (isEnemyInCombat && e
nemysTarget && GetAttitudeBetween(enemysTarget, this) == 0 && enemysTarget.isPla
yerFollower){
setIsThreatened
= true;
break;
}
}

i += 1;
}
}
i = actors.Size() - 1;
while (i >= 0){
if (!actors[i].IsAlive() && !finishableE
nemiesList.Contains(actors[i]) || actors[i].IsKnockedUnconscious() || GetUsedVeh
icle() == actors[i] || !actors[i].CanBeTargeted()){
actors.EraseFast(i);
} else if (!IsThreatened()){
if (!WasVisibleInScaledFrame(act
ors[i], 1.000000, 1.000000)){
actors.EraseFast(i);
}
}
i -= 1;
}
} else if (moveTarget && IsThreat(moveTarget, /* NOP */)
){
setIsThreatened = true;
} else {
setIsThreatened = false;
}
if (setIsThreatened){
enemyCollectionDist = 50.000000;
SetIsThreatened(true);
} else {
if (IsThreatened()){
AddTimer('finishableEnemiesList', 1.0000
00, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
enemyCollectionDist = findMoveTargetDistMax;
SetIsThreatened(false);
}
moveTargets = actors;
potentialMoveTargets = moveTargets;
if (!moveTarget){
enableStrafe = false;
}
if (potentialMoveTargets.Size() > 0){
i = 0;
while (i < potentialMoveTargets.Size()){
if (potentialMoveTargets[i].CanBeStrafed
()){
enableStrafe = true;
}
if (!potentialMoveTargets[i].GetGameplay
Visibility()){
moveTargetDists.PushBack(100.000
000);
} else {
moveTargetDists.PushBack(VecDist
ance(potentialMoveTargets[i].GetNearestPointInPersonalSpace(GetWorldPosition()),
GetWorldPosition()));
}
if (canFindPathEnemiesList.Contains(pote
ntialMoveTargets[i])){
moveTargetCanPathFinds.PushBack(
true);
aPotentialMoveTargetCanFindPath

= true;
} else {
moveTargetCanPathFinds.PushBack(
false);
}
i += 1;
}
if (aPotentialMoveTargetCanFindPath){
i = moveTargetCanPathFinds.Size() - 1;
while (i >= 0){
if (!moveTargetCanPathFinds[i]){
moveTargetCanPathFinds.E
raseFast(i);
potentialMoveTargets.Era
seFast(i);
moveTargetDists.EraseFas
t(i);
}
i -= 1;
}
}
if (moveTargetDists.Size() > 0){
newMoveTarget = potentialMoveTargets[Arr
ayFindMinF(moveTargetDists)];
}
}
if (newMoveTarget && newMoveTarget != moveTarget){
if (moveTarget){
playerToNewMoveTargetDist = VecDistance(
newMoveTarget.GetNearestPointInPersonalSpace(GetWorldPosition()), GetWorldPositi
on());
playerToMoveTargetDist = VecDistance(mov
eTarget.GetNearestPointInPersonalSpace(GetWorldPosition()), GetWorldPosition());
wasVisibleInFullFrame = WasVisibleInScal
edFrame(moveTarget, 1.000000, 1.000000);
if (!IsThreat(moveTarget, /* NOP */) ||
!wasVisibleInFullFrame || !super.IsEnemyVisible(moveTarget) || !moveTarget.IsAli
ve() && !finishableEnemiesList.Contains(moveTarget) || !moveTarget.GetGameplayVi
sibility() || moveTarget.IsAlive() && moveTarget.IsKnockedUnconscious() || wasVi
sibleInFullFrame && super.IsEnemyVisible(moveTarget) && playerToNewMoveTargetDis
t < playerToMoveTargetDist - 0.250000){
SetMoveTarget(newMoveTarget);
}
} else {
SetMoveTarget(newMoveTarget);
}
}
if (!IsThreatened()){
if (moveTarget && !moveTarget.IsAlive() && !fini
shableEnemiesList.Contains(moveTarget) || !WasVisibleInScaledFrame(moveTarget, 0
.800000, 1.000000) || VecDistance(moveTarget.GetWorldPosition(), GetWorldPositio
n()) > theGame.params.MAX_THROW_RANGE){
confirmEmptyMoveTarget = true;
newEmptyMoveTargetTimer = 0.000000;
}
} else if (moveTarget && IsThreat(moveTarget, /* NOP */)
|| finishableEnemiesList.Contains(moveTarget)){
if (!super.IsEnemyVisible(moveTarget)){
confirmEmptyMoveTarget = true;
newEmptyMoveTargetTimer = 5.000000;

} else {
SetMoveTarget(moveTarget);
}
} else if (IsInCombat()){
confirmEmptyMoveTarget = true;
newEmptyMoveTargetTimer = 1.000000;
}
if (confirmEmptyMoveTarget){
if (newEmptyMoveTargetTimer < emptyMoveTargetTim
er){
bIsConfirmingEmptyTarget = false;
emptyMoveTargetTimer = newEmptyMoveTarge
tTimer;
}
ConfirmEmptyMoveTarget(newEmptyMoveTargetTimer);
}
} else {
SetIsThreatened(false);
}
if (IsThreatened() && !IsInFistFightMiniGame()){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(this, 'CombatNearbyAction', 5.000000, 18.000000, -1.000000, -1, true,
/* NOP */, /* NOP */);
} else {
theGame.GetBehTreeReactionManager().RemoveReactionEvent(
this, 'CombatNearbyAction');
}
theSound.SoundParameter("monster_count", hostileMonsters.Size(),
/* NOP */);
/* NOP */;
}
private function ConfirmEmptyMoveTarget(timeDelta : Float){
if (!bIsConfirmingEmptyTarget){
bIsConfirmingEmptyTarget = true;
AddTimer('ConfirmEmptyTargetTimer', timeDelta, /* NOP */
, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function ConfirmEmptyTargetTimer(optional time : Float, op
tional id : Int32){
SetMoveTarget(NULL);
/* NOP */;
}
public function ShouldEnableCombat(unableToPathFind : Bool, forceCombatM
ode : Bool) : Bool{
var shouldFindPathToNPCs : Bool;
var playerToTargetDist : Float;
var canFindPathToTarget : Bool;
var moveTargetNPC : CNewNPC;
var currentTime : Float;
var currentTime2 : Float;
var isReachableEnemyTooFar : Bool;
var reachableEnemyWasTooFarTimeStampDelta : Float;
var reachablilityFailedTimeStampDelta : Float;
var currentTimeTemp : Float;
if (forceCombatMode && isSnappedToNavMesh){
return true;
}
if (!IsThreatened()){

reachableEnemyWasTooFar = false;
reachablilityFailed = false;
isInCombatReason = 0;
return false;
}
if (thePlayer.substateManager.GetStateCur() != 'CombatExploratio
n' && !thePlayer.substateManager.CanChangeToState('CombatExploration') && thePla
yer.substateManager.GetStateCur() != 'Ragdoll'){
reachableEnemyWasTooFar = false;
reachablilityFailed = false;
isInCombatReason = 0;
return false;
}
if (moveTarget){
canFindPathToEnemy = CanFindPathToTarget(unableToPathFin
d, /* NOP */);
currentTimeTemp = EngineTimeToFloat(theGame.GetEngineTim
e());
if (canFindPathToEnemy){
isReachableEnemyTooFar = IsReachableEnemyTooFar(
);
}
if (IsInCombat()){
if (canFindPathToEnemy){
if (forceCombatMode){
return true;
}
reachablilityFailed = false;
reachablilityFailedTimeStamp = currentTi
meTemp;
if (reachableEnemyWasTooFar){
if (isReachableEnemyTooFar){
currentTime = currentTim
eTemp;
if (GetIsSprinting()){
reachableEnemyWa
sTooFarTimeStampDelta = 0.000000;
} else {
reachableEnemyWa
sTooFarTimeStampDelta = 3.000000;
}
if (currentTime > reacha
bleEnemyWasTooFarTimeStamp + reachableEnemyWasTooFarTimeStampDelta){
isInCombatReason
= 0;
unableToPathFind
= true;
return false;
}
} else {
reachableEnemyWasTooFar
= false;
}
} else if (isReachableEnemyTooFar){
reachableEnemyWasTooFar = true;
reachableEnemyWasTooFarTimeStamp
= currentTimeTemp;
} else {
reachableEnemyWasTooFar = false;
}

return true;
} else {
reachableEnemyWasTooFar = false;
reachableEnemyWasTooFarTimeStamp = curre
ntTimeTemp;
if (reachablilityFailed){
if (IsEnemyTooHighToReach()){
reachablilityFailedTimeS
tampDelta = 1.000000;
} else {
reachablilityFailedTimeS
tampDelta = 5.000000;
}
currentTime2 = currentTimeTemp;
if (currentTime2 > reachablility
FailedTimeStamp + reachablilityFailedTimeStampDelta){
unableToPathFind = true;
return false;
}
} else {
reachablilityFailed = true;
reachablilityFailedTimeStamp = c
urrentTimeTemp;
}
return true;
}
} else if (canFindPathToEnemy){
if (forceCombatMode){
reachableEnemyWasTooFar = false;
return true;
}
reachablilityFailed = false;
reachablilityFailedTimeStamp = currentTimeTemp;
moveTargetNPC = (CNewNPC)moveTarget;
playerToTargetDist = VecDistance(moveTarget.GetW
orldPosition(), GetWorldPosition());
if (reachableEnemyWasTooFar && isReachableEnemyT
ooFar || !theGame.GetWorld().NavigationLineTest(GetWorldPosition(), moveTarget.G
etWorldPosition(), 0.400000, /* NOP */, /* NOP */)){
isInCombatReason = 0;
return false;
} else if (playerToTargetDist <= findMoveTargetD
istMin){
isInCombatReason = 1;
} else if (moveTargetNPC.GetCurrentStance() == 5
&& hostileEnemies.Contains(moveTarget)){
isInCombatReason = 2;
} else {
isInCombatReason = 0;
return false;
}
reachableEnemyWasTooFar = false;
return true;
}
} else {
reachableEnemyWasTooFar = false;
reachablilityFailed = false;
}
isInCombatReason = 0;
return false;

/* NOP */;
}
private function CanFindPathToTarget(unableToPathFind : Bool, forcedTarg
et : CNewNPC) : Bool{
var moveTargetNPC : CNewNPC;
var moveTargetsTemp : array<CActor>;
var i : Int32;
var safeSpotTolerance : Float;
var ent : CEntity;
moveTargetsTemp = moveTargets;
i = 0;
while (i < moveTargetsTemp.Size()){
moveTargetNPC = (CNewNPC)moveTargetsTemp[i];
if (moveTargetNPC && moveTargetNPC.GetCurrentStance() ==
5){
isInCombatReason = 2;
return true;
}
i += 1;
}
switch(navQuery.GetLastOutput(0.400000)){
case 0:
isInCombatReason = 0;
return false;
case 1:
ent = navQuery.GetOutputClosestEntity();
if (ent){
combatModeEnt = moveTarget;
}
navDist = navQuery.GetOutputClosestDistance();
isInCombatReason = 1;
return true;
case 2:
return canFindPathToEnemy;
case 3:
if (IsInCombat()){
if (IsEnemyTooHighToReach()){
safeSpotTolerance = 0.000000;
} else {
safeSpotTolerance = 3.000000;
}
} else {
safeSpotTolerance = 0.000000;
}
switch(navQuery.TestActorsList(0, this, moveTargetsTemp,
safeSpotTolerance, 75.000000)){
case 0:
isInCombatReason = 0;
return false;
case 1:
ent = navQuery.GetOutputClosestEntity();
if (ent){
combatModeEnt = moveTarget;
}
navDist = navQuery.GetOutputClosestDistance();
isInCombatReason = 1;
return true;
case 2:
return canFindPathToEnemy;
case 3:

if (IsInCombat()){
return true;
break;
}
return false;
}
}
/* NOP */;
}
private function IsReachableEnemyTooFar() : Bool{
var navDistLimit : Float;
var navDistDivisor : Float;
var playerToTargetVector : Vector;
navDistLimit = findMoveTargetDist;
navDistDivisor = 2.000000;
directDist = VecDistance(combatModeEnt.GetWorldPosition(), thePl
ayer.GetWorldPosition());
playerToTargetVector = GetWorldPosition() - combatModeEnt.GetWor
ldPosition();
if (playerMode.GetForceCombatMode() || isInCombatReason == 2){
return false;
}
if (playerToTargetVector.Z < 0.500000 && navDist > navDistLimit
&& directDist < navDist / navDistDivisor){
return true;
} else {
return false;
}
/* NOP */;
}
private function IsEnemyTooHighToReach() : Bool{
var playerToTargetVector : Vector;
playerToTargetVector = GetWorldPosition() - combatModeEnt.GetWor
ldPosition();
if (playerToTargetVector.Z < -0.500000 && !theGame.GetWorld().Na
vigationLineTest(GetWorldPosition(), combatModeEnt.GetWorldPosition(), 0.400000,
/* NOP */, /* NOP */)){
return true;
} else {
return false;
}
/* NOP */;
}
public function LockToMoveTarget(lockTime : Float){
}
private timer function DisableLockToMoveTargetTimer(optional time : Floa
t, optional id : Int32){
if (!IsActorLockedToTarget()){
SetMoveTargetChangeAllowed(true);
}
/* NOP */;
}
public function SetMoveTargetChangeAllowed(flag : Bool){
}
public function IsMoveTargetChangeAllowed() : Bool{
return bMoveTargetChangeAllowed;
/* NOP */;
}
public function SetMoveTarget(actor : CActor){
if (!actor && ForceCombatModeOverride()){

return;
}
if (IsMoveTargetChangeAllowed() && moveTarget != actor){
moveTarget = actor;
bIsConfirmingEmptyTarget = false;
RemoveTimer('ConfirmEmptyTargetTimer', /* NOP */);
if (!moveTarget){
super.SetScriptMoveTarget(moveTarget);
}
}
/* NOP */;
}
protected function SetIsThreatened(flag : Bool){
var allowSetIsThreatened : Bool;
allowSetIsThreatened = true;
if (ForceCombatModeOverride()){
if (flag || !moveTarget){
allowSetIsThreatened = true;
} else {
allowSetIsThreatened = false;
}
}
if (allowSetIsThreatened){
isThreatened = flag;
}
/* NOP */;
}
public function ForceCombatModeOverride() : Bool{
if (GetPlayerMode().GetForceCombatMode() && canFindPathToEnemy &
& theGame.GetGlobalAttitude(GetBaseAttitudeGroup(), moveTarget.GetBaseAttitudeGr
oup()) == 2){
return true;
} else {
return false;
}
/* NOP */;
}
public function IsThreatened() : Bool{
return isThreatened;
/* NOP */;
}
public function EnableFindTarget(flag : Bool){
var target : CActor;
if (IsActorLockedToTarget()){
target = GetTarget();
if (target && target.IsAlive()){
bCanFindTarget = flag;
} else {
bCanFindTarget = true;
}
} else {
bCanFindTarget = flag;
}
/* NOP */;
}
public function UpdateDisplayTarget(forceUpdate : Bool, forceNullActor :
Bool){
var hud : CR4ScriptedHud;
var tempTarget : CGameplayEntity;
var angleDist1 : Float;

var angleDist2 : Float;


var nonActorTargetMult : Float;
var combatActionType : Int32;
var currTarget : CActor;
var interactionTarget : CInteractionComponent;
var heading : Float;
if (theGame.IsDialogOrCutscenePlaying()){
currentSelectedDisplayTarget = NULL;
if (displayTarget){
ConfirmDisplayTarget(NULL);
}
return;
}
if (forceNullActor){
currTarget = NULL;
} else {
currTarget = GetTarget();
}
currentSelectedDisplayTarget = currTarget;
if (currTarget && !currTarget.IsTargetableByPlayer()){
currentSelectedDisplayTarget = NULL;
ConfirmDisplayTarget(currentSelectedDisplayTarget);
return;
}
nonActorTargetMult = 1.250000;
hud = (CR4ScriptedHud)theGame.GetHud();
if (!IsThreatened()){
if (!bLAxisReleased || lastAxisInputIsMovement){
if (currTarget){
angleDist1 = AbsF(AngleDistance(GetHeadi
ng(), VecHeading(currTarget.GetWorldPosition() - GetWorldPosition())));
} else {
angleDist1 = 360;
}
if (nonActorTarget){
angleDist2 = AbsF(AngleDistance(GetHeadi
ng(), VecHeading(nonActorTarget.GetWorldPosition() - GetWorldPosition())));
} else {
angleDist2 = 360;
}
} else {
if (currTarget){
angleDist1 = AbsF(AngleDistance(theCamer
a.GetCameraHeading(), VecHeading(currTarget.GetWorldPosition() - theCamera.GetCa
meraPosition())));
} else {
angleDist1 = 360;
}
if (nonActorTarget){
angleDist2 = AbsF(AngleDistance(theCamer
a.GetCameraHeading(), VecHeading(nonActorTarget.GetWorldPosition() - theCamera.G
etCameraPosition())));
} else {
angleDist2 = 360;
}
}
} else if (!bLAxisReleased){
if (ShouldUsePCModeTargeting()){
if (currTarget){
angleDist1 = AbsF(AngleDistance(theCamer

a.GetCameraHeading(), VecHeading(currTarget.GetWorldPosition() - theCamera.GetCa


meraPosition())));
} else {
angleDist1 = 360;
}
if (nonActorTarget && IsInCombatAction()){
angleDist2 = nonActorTargetMult * AbsF(A
ngleDistance(theCamera.GetCameraHeading(), VecHeading(nonActorTarget.GetWorldPos
ition() - theCamera.GetCameraPosition())));
} else {
angleDist2 = 360;
}
} else {
if (currTarget){
angleDist1 = AbsF(AngleDistance(rawPlaye
rHeading, VecHeading(currTarget.GetWorldPosition() - GetWorldPosition())));
} else {
angleDist1 = 360;
}
if (nonActorTarget && IsInCombatAction()){
angleDist2 = nonActorTargetMult * AbsF(A
ngleDistance(rawPlayerHeading, VecHeading(nonActorTarget.GetWorldPosition() - Ge
tWorldPosition())));
} else {
angleDist2 = 360;
}
}
} else {
angleDist1 = 0;
angleDist2 = 360;
}
if (angleDist1 < angleDist2){
tempTarget = currTarget;
} else {
tempTarget = nonActorTarget;
}
if (slideTarget && IsInCombatAction()){
combatActionType = GetBehaviorVariable('combatActionType
', /* NOP */);
if (combatActionType == 0 || combatActionType == 1 && Ge
tBehaviorVariable('playerAttackType', /* NOP */) == 1.000000 || combatActionType
== 4 || combatActionType == 6 && !IsCurrentSignChanneled() || combatActionType
== 6 && IsCurrentSignChanneled() && GetCurrentlyCastSign() == 4 || combatActionT
ype == 6 && IsCurrentSignChanneled() && GetCurrentlyCastSign() == 2 || combatAct
ionType == 2 || combatActionType == 3){
if (combatActionType == 6 && GetCurrentlyCastSig
n() == 2 && !IsCombatMusicEnabled()){
currentSelectedDisplayTarget = tempTarge
t;
} else {
currentSelectedDisplayTarget = slideTarg
et;
}
} else {
currentSelectedDisplayTarget = tempTarget;
}
} else if (slideTarget && rangedWeapon && rangedWeapon.GetCurren
tStateName() != 'State_WeaponWait' && playerAiming.GetCurrentStateName() == 'Wai
ting'){
currentSelectedDisplayTarget = slideTarget;

} else {
currentSelectedDisplayTarget = tempTarget;
}
interactionTarget = theGame.GetInteractionsManager().GetActiveIn
teraction();
if (interactionTarget && !IsThreatened() && !IsCastingSign() &&
IsCurrentSignChanneled()){
tempTarget = (CGameplayEntity)interactionTarget.GetEntit
y();
if (tempTarget && tempTarget != GetUsedVehicle()){
currentSelectedDisplayTarget = tempTarget;
SetDisplayTarget(currentSelectedDisplayTarget);
}
}
if ((CActor)currentSelectedDisplayTarget && !(CActor)currentSele
ctedDisplayTarget.GetGameplayVisibility()){
currentSelectedDisplayTarget = NULL;
}
if (displayTarget != currentSelectedDisplayTarget){
if (forceUpdate){
SetDisplayTarget(currentSelectedDisplayTarget);
} else {
ConfirmDisplayTarget(currentSelectedDisplayTarge
t);
}
}
/* NOP */;
}
private function ConfirmDisplayTarget(targetToConfirm : CGameplayEntity)
{
if (targetToConfirm != displayTarget){
displayTargetToConfirm = targetToConfirm;
if (!bConfirmDisplayTargetTimerEnabled){
bConfirmDisplayTargetTimerEnabled = true;
if (targetToConfirm){
AddTimer('ConfirmDisplayTargetTimer', 0.
100000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
AddTimer('ConfirmDisplayTargetTimer', 0.
000000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
}
/* NOP */;
}
private timer function ConfirmDisplayTargetTimer(optional time : Float,
optional id : Int32){
if (displayTargetToConfirm == currentSelectedDisplayTarget){
SetDisplayTarget(displayTargetToConfirm);
}
bConfirmDisplayTargetTimerEnabled = false;
/* NOP */;
}
protected function SetDisplayTarget(e : CGameplayEntity){
var displayTargetActor : CActor;
if (e != displayTarget){
displayTarget = e;
displayTargetActor = (CActor)displayTarget;
super.SetPlayerCombatTarget(displayTargetActor);
if (displayTargetActor && !displayTargetActor.IsTargetab

leByPlayer()){
isDisplayTargetTargetable = false;
} else if (!displayTargetActor && displayTarget != nonAc
torTarget){
isDisplayTargetTargetable = false;
} else {
isDisplayTargetTargetable = true;
}
}
/* NOP */;
}
public function GetDisplayTarget() : CGameplayEntity{
return displayTarget;
/* NOP */;
}
public function IsDisplayTargetTargetable() : Bool{
return isDisplayTargetTargetable;
/* NOP */;
}
public function EnableRadialSlots(enable : Bool, slotNames : array<CName
>){
var hud : CR4ScriptedHud;
var module : CR4HudModuleRadialMenu;
var i : Int32;
hud = (CR4ScriptedHud)theGame.GetHud();
module = (CR4HudModuleRadialMenu)hud.GetHudModule("RadialMenuMod
ule");
i = 0;
while (i < slotNames.Size()){
module.SetDesaturated(!enable, slotNames[i]);
i += 1;
}
/* NOP */;
}
public function IsEnemyInCone(source : CActor, coneHeading : Vector, con
eDist : Float, coneAngle : Float, newLockTarget : CActor) : Bool{
var targets : array<CActor>;
var sourceToTargetDists : array<Float>;
var i : Int32;
var targetingInfo : STargetingInfo;
targets = GetMoveTargets();
if (targets.Size() > 0){
targetingInfo.source = this;
targetingInfo.canBeTargetedCheck = true;
targetingInfo.coneCheck = true;
targetingInfo.coneHalfAngleCos = CosF(Deg2Rad(coneAngle
* 0.500000));
targetingInfo.coneDist = coneDist;
targetingInfo.coneHeadingVector = coneHeading;
targetingInfo.distCheck = true;
targetingInfo.invisibleCheck = true;
targetingInfo.navMeshCheck = true;
targetingInfo.inFrameCheck = false;
targetingInfo.frameScaleX = 1.000000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = 1.500000;
targetingInfo.rsHeadingCheck = false;
targetingInfo.rsHeadingLimitCos = 1.000000;
i = targets.Size() - 1;

while (i >= 0){


targetingInfo.targetEntity = targets[i];
if (!IsEntityTargetable(targetingInfo, /* NOP */
)){
targets.Erase(i);
}
i -= 1;
}
i = 0;
while (i < targets.Size()){
sourceToTargetDists.PushBack(VecDistance(source.
GetWorldPosition(), targets[i].GetWorldPosition()));
i += 1;
}
if (sourceToTargetDists.Size() > 0){
newLockTarget = targets[ArrayFindMinF(sourceToTa
rgetDists)];
} else {
newLockTarget = NULL;
}
}
return targets.Size() > 0;
/* NOP */;
}
public function GetScreenSpaceLockTarget(sourceEnt : CGameplayEntity, co
neAngle : Float, coneDist : Float, coneHeading : Float, inFrameCheck : Bool) : C
Actor{
var source : CActor;
var sourcePos : Vector;
var targetPos : Vector;
var targets : array<CActor>;
var sourceToTargetDists : array<Float>;
var sourceCoord : Vector;
var targetCoord : Vector;
var i : Int32;
var angleDiff : Float;
var sourceToTargetHeading : Float;
var sourceToTargetDist : Float;
var size : Float;
var targetingDist : Float;
var targetingInfo : STargetingInfo;
source = (CActor)sourceEnt;
targets = GetMoveTargets();
if (IsPCModeEnabled()){
if (coneHeading > -45.000000 && coneHeading < 45.000000
|| coneHeading > 135.000000 || coneHeading < -135.000000){
if (coneHeading > 0){
coneHeading = 180 - coneHeading;
} else {
coneHeading = 180 + coneHeading;
}
}
}
i = targets.Size() - 1;
while (i >= 0){
if (!targets[i].GetGameplayVisibility() || !IsThreat(tar
gets[i], /* NOP */) || !super.IsEnemyVisible(targets[i]) || !CanBeTargetedIfSwim
ming(targets[i], /* NOP */) && !IsCastingSign() || GetCurrentlyCastSign() != 4){
targets.Erase(i);
}

i -= 1;
}
if (source){
sourcePos = MatrixGetTranslation(source.GetBoneWorldMatr
ixByIndex(source.GetTorsoBoneIndex()));
} else {
sourcePos = sourceEnt.GetWorldPosition();
}
theCamera.WorldVectorToViewRatio(sourcePos, sourceCoord.X, sourc
eCoord.Y);
targetingDist = softLockDistVehicle;
if (targets.Size() > 0){
targetingInfo.source = this;
targetingInfo.canBeTargetedCheck = true;
targetingInfo.coneCheck = false;
targetingInfo.coneHalfAngleCos = 0.866025;
targetingInfo.coneDist = targetingDist;
targetingInfo.coneHeadingVector = Vector(0.000000, 1.000
000, 0.000000);
targetingInfo.distCheck = true;
targetingInfo.invisibleCheck = true;
targetingInfo.navMeshCheck = false;
if (inFrameCheck){
targetingInfo.inFrameCheck = true;
} else {
targetingInfo.inFrameCheck = false;
}
targetingInfo.frameScaleX = 1.000000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = softLockDist;
if (bRAxisReleased){
targetingInfo.rsHeadingCheck = false;
} else {
targetingInfo.rsHeadingCheck = true;
}
targetingInfo.rsHeadingLimitCos = -0.500000;
i = targets.Size() - 1;
while (i >= 0){
targetPos = MatrixGetTranslation(targets[i].GetB
oneWorldMatrixByIndex(targets[i].GetTorsoBoneIndex()));
theCamera.WorldVectorToViewRatio(targetPos, targ
etCoord.X, targetCoord.Y);
sourceToTargetHeading = VecHeading(targetCoord sourceCoord);
angleDiff = AbsF(AngleDistance(coneHeading, sour
ceToTargetHeading));
targetingInfo.targetEntity = targets[i];
if (!IsEntityTargetable(targetingInfo, /* NOP */
)){
targets.Erase(i);
} else if (!bRAxisReleased && angleDiff > coneAn
gle * 0.500000){
targets.Erase(i);
} else if (targets[i] == sourceEnt){
targets.Erase(i);
}
i -= 1;
}
}

size = targets.Size();
if (size > 0){
i = 0;
while (i < targets.Size()){
targetPos = MatrixGetTranslation(targets[i].GetB
oneWorldMatrixByIndex(targets[i].GetTorsoBoneIndex()));
theCamera.WorldVectorToViewRatio(targetPos, targ
etCoord.X, targetCoord.Y);
sourceToTargetHeading = AbsF(VecHeading(targetCo
ord - sourceCoord));
angleDiff = AngleDistance(180, sourceToTargetHea
ding);
sourceToTargetDist = VecDistance2D(sourceCoord,
targetCoord);
sourceToTargetDists.PushBack(SinF(Deg2Rad(angleD
iff)) * sourceToTargetDist);
i += 1;
}
}
if (targets.Size() > 0){
return targets[ArrayFindMinF(sourceToTargetDists)];
} else {
return NULL;
}
/* NOP */;
}
public function IsEntityTargetable(info : STargetingInfo, usePrecalcs :
Bool) : Bool{
var playerHasBlockingBuffs : Bool;
var sourceActor : CActor;
var targetEntity : CEntity;
var targetActor : CActor;
var targetNPC : CNewNPC;
var sourcePosition : Vector;
var targetPosition : Vector;
var direction : Vector;
var sourceToTargetDist : Float;
var sourceCapsuleRadius : Float;
var mpac : CMovingPhysicalAgentComponent;
var coneDistSq : Float;
var knockDownCheckDistSq : Float;
var sourceToTargetAngleDist : Float;
var b : Bool;
var infoSourceWorldPos : Vector;
var infoTargetWorldPos : Vector;
var finishEnabled : Bool;
if (usePrecalcs){
playerHasBlockingBuffs = targetingIn.playerHasBlockingBu
ffs;
} else {
playerHasBlockingBuffs = thePlayer.HasBuff(5) || thePlay
er.HasBuff(7) || thePlayer.HasBuff(14) || thePlayer.HasBuff(108);
}
if (playerHasBlockingBuffs){
return false;
}
sourceActor = info.source;
targetEntity = info.targetEntity;
if (!sourceActor || !targetEntity){
return false;

}
targetActor = (CActor)targetEntity;
if (info.canBeTargetedCheck && !targetActor.CanBeTargeted()){
return false;
}
if (info.invisibleCheck && !targetActor.GetGameplayVisibility())
{
return false;
}
sourcePosition = sourceActor.GetWorldPosition();
targetPosition = targetEntity.GetWorldPosition();
if (targetActor){
targetNPC = (CNewNPC)targetActor;
if (targetNPC){
if (targetNPC.IsHorse() && !targetNPC.GetHorseCo
mponent().IsDismounted()){
return false;
}
}
}
if (info.distCheck || info.knockDownCheck){
if (usePrecalcs){
if (targetActor){
sourceToTargetDist = Distance2DBetweenCa
psuleAndPoint(targetActor, sourceActor) - targetingPrecalcs.playerRadius;
} else {
sourceToTargetDist = VecDistance2D(sourc
ePosition, targetPosition) - targetingPrecalcs.playerRadius;
}
} else if (targetActor){
sourceToTargetDist = Distance2DBetweenCapsules(s
ourceActor, targetActor);
} else {
sourceToTargetDist = Distance2DBetweenCapsuleAnd
Point(sourceActor, targetEntity);
}
}
if (info.distCheck){
if (sourceToTargetDist >= info.coneDist){
return false;
}
}
if (info.coneCheck || info.rsHeadingCheck){
direction = VecNormalize2D(targetPosition - sourcePositi
on);
}
if (info.coneCheck){
if (VecDot2D(direction, info.coneHeadingVector) < info.c
oneHalfAngleCos){
return false;
}
}
if (info.rsHeadingCheck){
if (usePrecalcs){
if (VecDot2D(direction, targetingIn.lookAtDirect
ion) < info.rsHeadingLimitCos){
return false;
}
} else if (VecDot2D(direction, VecNormalize2D(GetLookAtP
osition() - sourcePosition)) < info.rsHeadingLimitCos){

return false;
}
}
if (info.inFrameCheck && !WasVisibleInScaledFrame(targetEntity,
info.frameScaleX, info.frameScaleY)){
return false;
}
if (info.navMeshCheck && !IsSwimming()){
sourceCapsuleRadius = 0.100000;
if (usePrecalcs){
sourceCapsuleRadius = targetingPrecalcs.playerRa
dius;
} else {
mpac = (CMovingPhysicalAgentComponent)sourceActo
r.GetMovingAgentComponent();
if (mpac){
sourceCapsuleRadius = mpac.GetCapsuleRad
ius();
}
}
if (!theGame.GetWorld().NavigationLineTest(sourcePositio
n, targetPosition, sourceCapsuleRadius, /* NOP */, /* NOP */)){
return false;
}
}
if (info.knockDownCheck){
if (targetActor && !targetActor.IsAlive()){
finishEnabled = targetActor.GetComponent('Finish
').IsEnabled();
if (finishEnabled){
if (finishableEnemiesList.Contains(targe
tActor)){
if (sourceToTargetDist >= info.k
nockDownCheckDist){
return false;
}
}
}
}
}
return true;
/* NOP */;
}
public function CanBeTargetedIfSwimming(actor : CActor, usePrecalcs : Bo
ol) : Bool{
var subDepth : Float;
var isDiving : Bool;
if (!actor){
return false;
}
if (usePrecalcs){
isDiving = targetingIn.isDiving;
} else {
isDiving = IsSwimming() && OnCheckDiving();
}
subDepth = (CMovingPhysicalAgentComponent)actor.GetMovingAgentCo
mponent().GetSubmergeDepth();
if (isDiving){
return subDepth < -1.000000;
} else {

return subDepth >= -1.000000;


}
/* NOP */;
}
private function FilterActors(targets : array<CActor>, onlyThreatsReturn
ed : Bool, usePrecalcs : Bool){
var i : Int32;
var size : Int32;
var foundThreat : Bool;
var foundNonThreat : Bool;
var threatsCount : Int32;
var tmpActor : CActor;
foundThreat = false;
foundNonThreat = false;
size = targets.Size();
i = 0;
threatsCount = 0;
i = 0;
while (i < size){
if (IsThreat(targets[i], usePrecalcs)){
foundThreat = true;
if (i != threatsCount){
tmpActor = targets[i];
targets[i] = targets[threatsCount];
targets[threatsCount] = tmpActor;
}
threatsCount += 1;
} else {
foundNonThreat = true;
}
i += 1;
}
if (foundThreat){
onlyThreatsReturned = true;
if (foundNonThreat){
targets.Resize(threatsCount);
}
}
/* NOP */;
}
private function InternalFindTargetsInCone(targets : array<CActor>, outH
eadingVector : Vector, usePrecalcs : Bool){
var size : Int32;
var i : Int32;
var coneHalfAngleDot : Float;
var coneHeading : Float;
var coneHeadingVector : Vector;
var position : Vector;
var direction : Vector;
var onlyThreatTargetsFound : Bool;
targets.Clear();
super.GetVisibleEnemies(targets);
i = 0;
while (i < finishableEnemiesList.Size()){
if (!targets.Contains(finishableEnemiesList[i])){
targets.PushBack(finishableEnemiesList[i]);
}
i += 1;
}
onlyThreatTargetsFound = false;

FilterActors(targets, onlyThreatTargetsFound, true);


if (IsCombatMusicEnabled() && targets.Size() > 0 && !onlyThreatT
argetsFound && !IsThreat(targets[0], usePrecalcs)){
targets.Clear();
}
coneHeading = 0.000000;
coneHalfAngleDot = 0.000000;
if (orientationTarget == 3 || orientationTarget == 4){
if (usePrecalcs){
coneHeading = targetingPrecalcs.cameraHeading;
} else {
coneHeading = theGame.GetGameCamera().GetHeading
();
}
coneHalfAngleDot = 0.500000;
} else {
if (IsSwimming()){
if (usePrecalcs){
coneHeading = targetingPrecalcs.cameraHe
ading;
} else {
coneHeading = theGame.GetGameCamera().Ge
tHeading();
}
coneHalfAngleDot = 0.173648;
} else if (bLAxisReleased){
if (IsInCombatAction()){
coneHeading = GetCombatActionHeading();
} else if (ShouldUsePCModeTargeting()){
coneHeading = theGame.GetGameCamera().Ge
tHeading();
} else {
coneHeading = cachedRawPlayerHeading;
}
if (IsInCombat()){
if (ShouldUsePCModeTargeting()){
coneHalfAngleDot = -1;
} else {
coneHalfAngleDot = 0.173648;
}
} else {
coneHalfAngleDot = -1.000000;
}
} else {
if (IsInCombatAction()){
coneHeading = GetCombatActionHeading();
} else if (ShouldUsePCModeTargeting()){
coneHeading = theGame.GetGameCamera().Ge
tHeading();
} else {
coneHeading = cachedRawPlayerHeading;
}
if (ShouldUsePCModeTargeting()){
coneHalfAngleDot = -1;
} else {
coneHalfAngleDot = 0.173648;
}
}
coneHeadingVector = VecFromHeading(coneHeading);
position = GetWorldPosition();

i = targets.Size() - 1;
while (i >= 0){
if (!targets[i]){
targets.EraseFast(i);
} else {
direction = VecNormalize2D(targets[i].Ge
tWorldPosition() - position);
if (VecDot2D(coneHeadingVector, directio
n) < coneHalfAngleDot){
targets.EraseFast(i);
}
}
i -= 1;
}
}
outHeadingVector = coneHeadingVector;
/* NOP */;
}
public function InitTargeting(){
var consts : SR4PlayerTargetingConsts;
if (!targeting){
targeting = new CR4PlayerTargeting in this;
}
if (targeting){
consts.softLockDistance = softLockDist;
consts.softLockFrameSize = softLockFrameSize;
targeting.SetConsts(consts);
}
/* NOP */;
}
public function PrepareTargetingIn(actionCheck : Bool, bufferActionType
: EBufferActionType, actionInput : Bool){
var coneDist : Float;
if (actionCheck && bufferActionType == 4){
coneDist = findMoveTargetDist;
} else if (IsSwimming()){
coneDist = theGame.params.MAX_THROW_RANGE;
} else if (super.GetPlayerCombatStance() == 1 && playerMoveType
== 1 || playerMoveType == 0){
coneDist = softLockDist;
} else {
coneDist = findMoveTargetDist;
}
targetingIn.canFindTarget = bCanFindTarget;
targetingIn.playerHasBlockingBuffs = thePlayer.HasBuff(5) || the
Player.HasBuff(7) || thePlayer.HasBuff(14) || thePlayer.HasBuff(108);
targetingIn.isHardLockedToTarget = IsHardLockEnabled();
targetingIn.isActorLockedToTarget = IsActorLockedToTarget();
targetingIn.isCameraLockedToTarget = IsCameraLockedToTarget();
targetingIn.actionCheck = actionCheck;
targetingIn.actionInput = actionInput;
targetingIn.isInCombatAction = IsInCombatAction();
targetingIn.isLAxisReleased = bLAxisReleased;
targetingIn.isLAxisReleasedAfterCounter = lAxisReleasedAfterCoun
ter;
targetingIn.isLAxisReleasedAfterCounterNoCA = lAxisReleasedAfter
CounterNoCA;
targetingIn.lastAxisInputIsMovement = lastAxisInputIsMovement;
targetingIn.isAiming = playerAiming.GetCurrentStateName() == 'Ai
ming';

targetingIn.isSwimming = IsSwimming();
targetingIn.isDiving = IsSwimming() && OnCheckDiving();
targetingIn.isThreatened = IsThreatened();
targetingIn.isCombatMusicEnabled = IsCombatMusicEnabled();
targetingIn.isPcModeEnabled = IsPCModeEnabled();
targetingIn.shouldUsePcModeTargeting = ShouldUsePCModeTargeting(
);
targetingIn.bufferActionType = bufferActionType;
targetingIn.orientationTarget = GetOrientationTarget();
targetingIn.coneDist = coneDist;
targetingIn.findMoveTargetDist = findMoveTargetDist;
targetingIn.cachedRawPlayerHeading = cachedRawPlayerHeading;
targetingIn.combatActionHeading = GetCombatActionHeading();
targetingIn.rawPlayerHeadingVector = VecFromHeading(rawPlayerHea
ding);
targetingIn.lookAtDirection = VecNormalize2D(GetLookAtPosition()
- GetWorldPosition());
targetingIn.moveTarget = moveTarget;
targetingIn.aimingTarget = playerAiming.GetAimedTarget();
targetingIn.displayTarget = (CActor)displayTarget;
targetingIn.finishableEnemies = finishableEnemiesList;
targetingIn.hostileEnemies = hostileEnemies;
targetingIn.defaultSelectionWeights = ProcessSelectionWeights();
/* NOP */;
}
public function ResetTargetingOut(){
targetingOut.target = NULL;
targetingOut.result = false;
targetingOut.confirmNewTarget = false;
targetingOut.forceDisableUpdatePosition = false;
/* NOP */;
}
public function MakeFindTargetPrecalcs(){
var mpac : CMovingPhysicalAgentComponent;
targetingPrecalcs.playerPosition = thePlayer.GetWorldPosition();
targetingPrecalcs.playerHeading = thePlayer.GetHeading();
targetingPrecalcs.playerHeadingVector = thePlayer.GetHeadingVect
or();
targetingPrecalcs.playerHeadingVector.Z = 0;
targetingPrecalcs.playerHeadingVector = VecNormalize2D(targeting
Precalcs.playerHeadingVector);
targetingPrecalcs.playerRadius = 0.500000;
mpac = (CMovingPhysicalAgentComponent)thePlayer.GetMovingAgentCo
mponent();
if (mpac){
targetingPrecalcs.playerRadius = mpac.GetCapsuleRadius()
;
}
targetingPrecalcs.cameraPosition = theCamera.GetCameraPosition()
;
targetingPrecalcs.cameraDirection = theCamera.GetCameraDirection
();
targetingPrecalcs.cameraHeadingVector = targetingPrecalcs.camera
Direction;
targetingPrecalcs.cameraHeadingVector.Z = 0;
targetingPrecalcs.cameraHeadingVector = VecNormalize2D(targeting
Precalcs.cameraHeadingVector);
targetingPrecalcs.cameraHeading = VecHeading(targetingPrecalcs.c
ameraHeadingVector);
/* NOP */;

}
public function GetForceDisableUpdatePosition() : Bool{
return targetingOut.forceDisableUpdatePosition;
/* NOP */;
}
public function SetUseNativeTargeting(use : Bool){
useNativeTargeting = use;
/* NOP */;
}
protected function FindTarget(actionCheck : Bool, action : EBufferAction
Type, actionInput : Bool) : CActor{
if (IsCombatMusicEnabled() && !IsInCombat() && reachableEnemyWas
TooFar){
playerMode.UpdateCombatMode(/* NOP */);
}
PrepareTargetingIn(actionCheck, action, actionInput);
if (useNativeTargeting){
targeting.BeginFindTarget(targetingIn);
targeting.FindTarget();
targeting.EndFindTarget(targetingOut);
} else {
UpdateVisibleActors();
MakeFindTargetPrecalcs();
ResetTargetingOut();
FindTarget_Scripted();
}
if (targetingOut.result){
if (targetingOut.confirmNewTarget){
ConfirmNewTarget(targetingOut.target);
}
return targetingOut.target;
}
return NULL;
/* NOP */;
}
protected function FindTarget_Scripted(){
var currentTarget : CActor;
var newTarget : CActor;
var selectedTarget : CActor;
var displayTargetActor : CActor;
var playerPosition : Vector;
var playerHeadingVector : Vector;
var cameraPosition : Vector;
var cameraHeadingVector : Vector;
var selectionHeadingVector : Vector;
var targetingInfo : STargetingInfo;
var selectionWeights : STargetSelectionWeights;
var targets : array<CActor>;
var isMoveTargetTargetable : Bool;
var targetChangeFromActionInput : Bool;
var retainCurrentTarget : Bool;
playerPosition = GetWorldPosition();
playerHeadingVector = targetingPrecalcs.playerHeadingVector;
cameraPosition = theCamera.GetCameraPosition();
cameraHeadingVector = targetingPrecalcs.cameraHeadingVector;
currentTarget = GetTarget();
if (currentTarget){
if (IsHardLockEnabled() && currentTarget.IsAlive() && !c
urrentTarget.IsKnockedUnconscious()){
if (VecDistanceSquared(playerPosition, currentTa

rget.GetWorldPosition()) > 50.000000 * 50.000000){


HardLockToTarget(false);
} else {
targetingOut.target = currentTarget;
targetingOut.result = true;
return;
}
}
GetVisualDebug().AddSphere('target', 1.000000, currentTa
rget.GetWorldPosition(), true, Color(255, 255, 0), 1.000000);
}
if (bCanFindTarget && !IsActorLockedToTarget()){
if (!targetingIn.playerHasBlockingBuffs){
InternalFindTargetsInCone(targets, selectionHead
ingVector, true);
}
targetingInfo.source = this;
targetingInfo.canBeTargetedCheck = true;
targetingInfo.coneCheck = false;
targetingInfo.coneHalfAngleCos = 1.000000;
targetingInfo.coneDist = targetingIn.coneDist;
targetingInfo.distCheck = true;
targetingInfo.invisibleCheck = true;
targetingInfo.navMeshCheck = false;
if (ShouldUsePCModeTargeting()){
targetingInfo.inFrameCheck = false;
} else {
targetingInfo.inFrameCheck = true;
}
targetingInfo.frameScaleX = 1.000000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = 1.500000;
targetingInfo.rsHeadingCheck = false;
targetingInfo.rsHeadingLimitCos = 1.000000;
if (currentTarget){
targetingInfo.targetEntity = currentTarget;
if (!IsEntityTargetable(targetingInfo, true)){
currentTarget = NULL;
}
if (currentTarget && !CanBeTargetedIfSwimming(cu
rrentTarget, true)){
currentTarget = NULL;
}
}
isMoveTargetTargetable = false;
if (moveTarget){
if (CanBeTargetedIfSwimming(moveTarget, true)){
targetingInfo.targetEntity = moveTarget;
targetingInfo.coneDist = findMoveTargetD
ist;
targetingInfo.inFrameCheck = false;
if (IsEntityTargetable(targetingInfo, tr
ue)){
isMoveTargetTargetable = true;
}
}
}
targetingInfo.coneDist = targetingIn.coneDist;
if (!targetingIn.playerHasBlockingBuffs){

RemoveNonTargetable(targets, targetingInfo, sele


ctionHeadingVector);
}
newTarget = NULL;
if (playerAiming.GetCurrentStateName() == 'Aiming'){
newTarget = playerAiming.GetAimedTarget();
if (!newTarget){
selectionWeights.angleWeight = 1.000000;
selectionWeights.distanceWeight = 0.0000
00;
selectionWeights.distanceRingWeight = 0.
000000;
selectedTarget = SelectTarget(targets, f
alse, cameraPosition, cameraHeadingVector, selectionWeights, true);
newTarget = selectedTarget;
}
} else if (IsSwimming()){
selectionWeights.angleWeight = 0.900000;
selectionWeights.distanceWeight = 0.100000;
selectionWeights.distanceRingWeight = 0.000000;
selectedTarget = SelectTarget(targets, true, cam
eraPosition, cameraHeadingVector, selectionWeights, true);
newTarget = selectedTarget;
} else if (IsThreatened()){
if (IsCameraLockedToTarget()){
if (currentTarget && !currentTarget.GetG
ameplayVisibility()){
ForceSelectLockTarget();
}
}
displayTargetActor = (CActor)displayTarget;
selectedTarget = SelectTarget(targets, true, pla
yerPosition, selectionHeadingVector, targetingIn.defaultSelectionWeights, true);
if (!selectedTarget){
targetingOut.forceDisableUpdatePosition
= true;
}
targetChangeFromActionInput = targetingIn.action
Input && !lAxisReleasedAfterCounter;
if (selectedTarget && !IsThreat(currentTarget, t
rue) || ShouldUsePCModeTargeting() || !IsInCombatAction() && !lAxisReleasedAfter
CounterNoCA || targetChangeFromActionInput){
newTarget = selectedTarget;
} else if (displayTargetActor && bLAxisReleased
&& !ShouldUsePCModeTargeting() || IsInCombatAction() && displayTargetActor.IsAli
ve() || finishableEnemiesList.Contains(displayTargetActor) && displayTargetActor
.GetGameplayVisibility() && super.IsEnemyVisible(displayTargetActor) || finishab
leEnemiesList.Contains(displayTargetActor) && CanBeTargetedIfSwimming(displayTar
getActor, true) && IsThreat(displayTargetActor, true) && WasVisibleInScaledFrame
(displayTargetActor, 1.000000, 1.000000)){
newTarget = displayTargetActor;
} else if (moveTarget && isMoveTargetTargetable
&& !IsInCombatAction() || GetBehaviorVariable('combatActionType', /* NOP */) ==
2 || GetBehaviorVariable('combatActionType', /* NOP */) == 3){
newTarget = moveTarget;
} else {
newTarget = NULL;
}
} else {
retainCurrentTarget = false;

if (lAxisReleasedAfterCounterNoCA){
if (lastAxisInputIsMovement && !IsSwimmi
ng()){
selectionWeights.angleWeight = 0
.375000;
selectionWeights.distanceWeight
= 0.275000;
selectionWeights.distanceRingWei
ght = 0.350000;
selectedTarget = SelectTarget(ta
rgets, false, playerPosition, playerHeadingVector, selectionWeights, true);
if (currentTarget != selectedTar
get){
targetingInfo.targetEnti
ty = selectedTarget;
if (IsEntityTargetable(t
argetingInfo, true)){
retainCurrentTar
get = true;
}
}
} else {
selectionWeights.angleWeight = 0
.750000;
selectionWeights.distanceWeight
= 0.125000;
selectionWeights.distanceRingWei
ght = 0.125000;
selectedTarget = SelectTarget(ta
rgets, false, cameraPosition, cameraHeadingVector, selectionWeights, true);
}
} else {
selectionWeights.angleWeight = 0.600000;
selectionWeights.distanceWeight = 0.4000
00;
selectionWeights.distanceRingWeight = 0.
000000;
selectedTarget = SelectTarget(targets, t
rue, playerPosition, targetingIn.rawPlayerHeadingVector, selectionWeights, true)
;
}
if (retainCurrentTarget){
newTarget = currentTarget;
} else if (IsInCombatAction() && GetBehaviorVari
able('isPerformingSpecialAttack', /* NOP */) == 1.000000){
newTarget = moveTarget;
} else if (selectedTarget){
newTarget = selectedTarget;
} else {
newTarget = NULL;
}
}
targetingOut.confirmNewTarget = true;
} else {
newTarget = NULL;
}
targetingOut.result = true;
targetingOut.target = newTarget;
/* NOP */;
}

public function UpdateVisibleActors(){


var i : Int32;
var now : Float;
now = theGame.GetEngineTimeAsSeconds();
i = visibleActors.Size() - 1;
while (i >= 0){
if (now - visibleActorsTime[i] > 1.000000){
visibleActors.EraseFast(i);
visibleActorsTime.EraseFast(i);
}
i -= 1;
}
/* NOP */;
}
public function RemoveNonTargetable(targets : array<CActor>, info : STar
getingInfo, selectionHeadingVector : Vector){
var i : Int32;
var cameraPosition : Vector;
var cameraDirection : Vector;
var nonCombatCheck : Bool;
var playerToCamPlaneDist : Float;
var targetToCamPlaneDist : Float;
if (targets.Size() == 0){
return;
}
nonCombatCheck = bLAxisReleased && !IsInCombat();
if (nonCombatCheck){
info.coneHeadingVector = targetingPrecalcs.playerHeading
Vector;
if (lastAxisInputIsMovement){
info.coneHeadingVector = selectionHeadingVector;
info.invisibleCheck = false;
info.coneCheck = true;
info.coneHalfAngleCos = 0.766044;
} else {
info.invisibleCheck = false;
info.frameScaleX = 0.900000;
info.frameScaleY = 0.900000;
}
} else {
info.coneHeadingVector = Vector(0.000000, 0.000000, 0.00
0000);
if (IsInCombat()){
info.inFrameCheck = false;
} else if (!bLAxisReleased){
info.coneCheck = true;
if (IsSwimming()){
info.coneHalfAngleCos = -1;
} else {
info.coneHalfAngleCos = 0.866025;
}
info.coneHeadingVector = targetingIn.rawPlayerHe
adingVector;
}
}
cameraPosition = theCamera.GetCameraPosition();
cameraDirection = targetingPrecalcs.cameraDirection;
playerToCamPlaneDist = VecDot2D(cameraDirection, GetWorldPositio
n() - cameraPosition);
i = targets.Size() - 1;

while (i >= 0){


info.targetEntity = targets[i];
if (!CanBeTargetedIfSwimming(targets[i], true)){
targets.EraseFast(i);
} else if (!IsEntityTargetable(info, true)){
targets.EraseFast(i);
} else if (nonCombatCheck && !lastAxisInputIsMovement){
targetToCamPlaneDist = VecDot2D(cameraDirection,
targets[i].GetWorldPosition() - cameraPosition);
if (targetToCamPlaneDist < playerToCamPlaneDist)
{
targets.EraseFast(i);
}
}
i -= 1;
}
/* NOP */;
}
public function CombatModeDebug(){
var visualDebug : CVisualDebug;
var naviQueryMsg : String;
var naviQueryMsg1 : String;
var naviQueryMsg2 : String;
var navSnapMsg : String;
var i : Int32;
visualDebug = GetVisualDebug();
if (IsCombatMusicEnabled()){
visualDebug.AddText('CombatMusic', "CombatMusic : On", t
hePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.700000), true, /* NOP
*/, Color(255, 255, 255), /* NOP */, /* NOP */);
} else {
visualDebug.AddText('CombatMusic', "CombatMusic : Off",
thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.700000), true, /* NO
P */, Color(0, 0, 0), /* NOP */, /* NOP */);
}
if (GetPlayerMode().GetForceCombatMode()){
visualDebug.AddText('ForcedCombatMode', "ForcedCombatMod
e : TRUE", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.600000),
true, /* NOP */, Color(255, 255, 255), /* NOP */, /* NOP */);
} else {
visualDebug.AddText('ForcedCombatMode', "ForcedCombatMod
e : FALSE", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.600000),
true, /* NOP */, Color(0, 0, 0), /* NOP */, /* NOP */);
}
if (IsThreatened()){
if (IsInCombat()){
visualDebug.AddText('CombatMode', "CombatMode :
AlertNear/Far", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.5000
00), true, /* NOP */, Color(255, 0, 0), /* NOP */, /* NOP */);
} else {
visualDebug.AddText('CombatMode', "CombatMode :
CombatExploration", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.
500000), true, /* NOP */, Color(255, 255, 0), /* NOP */, /* NOP */);
}
} else {
visualDebug.AddText('CombatMode', "CombatMode : NormalEx
ploration", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.500000),
true, /* NOP */, Color(0, 255, 0), /* NOP */, /* NOP */);
}
visualDebug.AddText('NaviQuery', naviQueryMsg, combatModeEnt.Get

WorldPosition() + Vector(0.000000, 0.000000, 1.300000), true, /* NOP */, combatM


odeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', naviQueryMsg1, thePlayer.GetWo
rldPosition() + Vector(0.000000, 0.000000, 1.300000), true, /* NOP */, combatMod
eColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery2', naviQueryMsg2, thePlayer.GetWo
rldPosition() + Vector(0.000000, 0.000000, 1.200000), true, /* NOP */, combatMod
eColor, /* NOP */, /* NOP */);
if (isInCombatReason == 0){
visualDebug.AddText('CombatModeReason', "CombatModeReaso
n : ", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.400000), true
, /* NOP */, Color(125, 125, 125), /* NOP */, /* NOP */);
} else if (isInCombatReason == 1){
visualDebug.AddText('CombatModeReason', "CombatModeReaso
n : Geralt CAN pathfind to NPC", thePlayer.GetWorldPosition() + Vector(0.000000,
0.000000, 1.400000), true, /* NOP */, Color(255, 0, 0), /* NOP */, /* NOP */);
} else if (isInCombatReason == 2){
visualDebug.AddText('CombatModeReason', "CombatModeReaso
n : An NPC is flying or ranged", thePlayer.GetWorldPosition() + Vector(0.000000,
0.000000, 1.400000), true, /* NOP */, Color(255, 0, 0), /* NOP */, /* NOP */);
} else if (isInCombatReason == 2){
visualDebug.AddText('CombatModeReason', "CombatModeReaso
n : Forced Combat Mode", thePlayer.GetWorldPosition() + Vector(0.000000, 0.00000
0, 1.400000), true, /* NOP */, Color(255, 0, 0), /* NOP */, /* NOP */);
}
if (reachableEnemyWasTooFar){
combatModeColor.Red = 255;
combatModeColor.Green = 255;
combatModeColor.Blue = 0;
} else {
combatModeColor.Red = 0;
combatModeColor.Green = 255;
combatModeColor.Blue = 0;
}
if (IsThreatened()){
switch(navQuery.GetLastOutput(2.000000)){
case 0:
if (playerMode.GetForceCombatMode()){
if (isSnappedToNavMesh){
visualDebug.AddText('NaviQuery',
"", combatModeEnt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000), tr
ue, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1'
, "Naviquery : Snapped So no need for query", thePlayer.GetWorldPosition() + Vec
tor(0.000000, 0.000000, 1.300000), true, /* NOP */, combatModeColor, /* NOP */,
/* NOP */);
visualDebug.AddText('NaviQuery2'
, "Naviquery : Snapped So no need for query", thePlayer.GetWorldPosition() + Vec
tor(0.000000, 0.000000, 1.200000), true, /* NOP */, combatModeColor, /* NOP */,
/* NOP */);
} else {
visualDebug.AddText('NaviQuery',
"", combatModeEnt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000), tr
ue, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1'
, "Naviquery : Failed", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000
, 1.300000), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery2'
, "Naviquery : Failed", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000
, 1.200000), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);

}
} else {
visualDebug.AddText('NaviQuery', "", com
batModeEnt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000), true, /* N
OP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', "Naviq
uery : Failed", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.3000
00), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery2', "Naviq
uery : Failed", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.2000
00), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
}
break;
case 1:
visualDebug.AddText('NaviQuery', combatModeEnt.G
etName(), combatModeEnt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000
), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', "Naviquery : S
uccess (navDist: " + navDist + ")", thePlayer.GetWorldPosition() + Vector(0.0000
00, 0.000000, 1.300000), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */)
;
visualDebug.AddText('NaviQuery2', "Naviquery : S
uccess (directDist: " + directDist + ")", thePlayer.GetWorldPosition() + Vector(
0.000000, 0.000000, 1.200000), true, /* NOP */, combatModeColor, /* NOP */, /* N
OP */);
break;
case 2:
visualDebug.AddText('NaviQuery', combatModeEnt.G
etName(), combatModeEnt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000
), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', "Naviquery : P
ending (navDist: " + navDist + ")", thePlayer.GetWorldPosition() + Vector(0.0000
00, 0.000000, 1.300000), true, /* NOP */, combatModeColor, /* NOP */, /* NOP */)
;
visualDebug.AddText('NaviQuery2', "Naviquery : P
ending (directDist: " + directDist + ")", thePlayer.GetWorldPosition() + Vector(
0.000000, 0.000000, 1.200000), true, /* NOP */, combatModeColor, /* NOP */, /* N
OP */);
break;
case 3:
visualDebug.AddText('NaviQuery', "", combatModeE
nt.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000), true, /* NOP */, c
ombatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', "Naviquery : I
nvalidated", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.300000)
, true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery2', "Naviquery : I
nvalidated", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.200000)
, true, /* NOP */, combatModeColor, /* NOP */, /* NOP */);
break;
}
} else {
visualDebug.AddText('NaviQuery', "", combatModeEnt.GetWo
rldPosition() + Vector(0.000000, 0.000000, 1.300000), true, /* NOP */, combatMod
eColor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery1', "", thePlayer.GetWorld
Position() + Vector(0.000000, 0.000000, 1.300000), true, /* NOP */, combatModeCo
lor, /* NOP */, /* NOP */);
visualDebug.AddText('NaviQuery2', "", thePlayer.GetWorld
Position() + Vector(0.000000, 0.000000, 1.200000), true, /* NOP */, combatModeCo

lor, /* NOP */, /* NOP */);


}
if (navMeshSnapInfoStack.Size() > 0){
i = navMeshSnapInfoStack.Size() - 1;
while (i >= 0){
navSnapMsg = navSnapMsg + navMeshSnapInfoStack[i
] + " ";
i -= 1;
}
visualDebug.AddText('NavMeshSnap', "NavMeshSnap: Enabled
, Sources : " + navSnapMsg, thePlayer.GetWorldPosition() + Vector(0.000000, 0.00
0000, 1.100000), true, /* NOP */, Color(255, 255, 255), /* NOP */, /* NOP */);
} else {
visualDebug.AddText('NavMeshSnap', "NavMeshSnap: Disable
d", thePlayer.GetWorldPosition() + Vector(0.000000, 0.000000, 1.100000), true, /
* NOP */, Color(0, 0, 0), /* NOP */, /* NOP */);
}
/* NOP */;
}
public function IsCombatMusicEnabled() : Bool{
if (theSound.GetCurrentGameState() == 17 || theSound.GetCurrentG
ameState() == 6 || theSound.GetCurrentGameState() == 7 || theSound.GetCurrentGam
eState() == 20){
return true;
} else {
return false;
}
/* NOP */;
}
public function IsSoundStateCombatMusic(gameState : ESoundGameState) : B
ool{
if (gameState == 17 || gameState == 6 || gameState == 7 || gameS
tate == 20){
return true;
} else {
return false;
}
/* NOP */;
}
private function ConfirmNewTarget(actorToConfirm : CActor){
var leftJoyRotLimit : Float;
var target : CActor;
leftJoyRotLimit = 1.000000;
target = GetTarget();
if (!target || !moveTarget || target && !IsThreat(target, /* NOP
*/) || !target.IsAlive() || VecLength(rawLeftJoyVec) < 0.700000 || IsInCombatAc
tion() && GetBehaviorVariable('combatActionType', /* NOP */) == 2 || VecLength(r
awLeftJoyVec) >= 0.700000 && prevRawLeftJoyRot >= rawLeftJoyRot + leftJoyRotLimi
t || prevRawLeftJoyRot <= rawLeftJoyRot - leftJoyRotLimit || AbsF(AngleDistance(
cachedRawPlayerHeading, VecHeading(GetDisplayTarget().GetWorldPosition() - GetWo
rldPosition()))) > 60 || !IsInCombatAction() && !rangedWeapon || rangedWeapon.Ge
tCurrentStateName() != 'State_WeaponHolster'){
SetPrevRawLeftJoyRot();
if (actorToConfirm != target){
SetTarget(actorToConfirm, /* NOP */);
}
}
/* NOP */;
}
protected function SelectTarget(targets : array<CActor>, useVisibilityCh

eck : Bool, sourcePosition : Vector, headingVector : Vector, selectionWeights :


STargetSelectionWeights, usePrecalcs : Bool) : CActor{
var i : Int32;
var target : CActor;
var selectedTarget : CActor;
var currentTarget : CActor;
var playerPosition : Vector;
var distanceToPlayer : Float;
var priority : Float;
var maxPriority : Float;
var now : Float;
var remove : Bool;
var visibleActorIndex : Int32;
if (useVisibilityCheck){
currentTarget = GetTarget();
playerPosition = GetWorldPosition();
now = theGame.GetEngineTimeAsSeconds();
i = targets.Size() - 1;
while (i >= 0){
target = targets[i];
if (target != currentTarget && !IsPCModeEnabled(
) && !WasVisibleInScaledFrame(target, softLockFrameSize, softLockFrameSize)){
remove = true;
visibleActorIndex = visibleActors.FindFi
rst(target);
if (visibleActorIndex != -1){
if (usePrecalcs){
distanceToPlayer = Dista
nce2DBetweenCapsuleAndPoint(target, this) - targetingPrecalcs.playerRadius;
} else {
distanceToPlayer = Dista
nce2DBetweenCapsules(this, target);
}
if (distanceToPlayer < softLockD
ist && now - visibleActorsTime[i] < 1.000000){
remove = false;
}
}
if (remove){
targets.EraseFast(i);
}
} else {
visibleActorIndex = visibleActors.FindFi
rst(target);
if (visibleActorIndex == -1){
visibleActors.PushBack(target);
visibleActorsTime.PushBack(now);
} else {
visibleActorsTime[visibleActorIn
dex] = now;
}
}
i -= 1;
}
}
selectedTarget = NULL;
maxPriority = -1.000000;
i = targets.Size() - 1;
while (i >= 0){
priority = CalcSelectionPriority(targets[i], selectionWe

ights, sourcePosition, headingVector);


if (priority > maxPriority){
maxPriority = priority;
selectedTarget = targets[i];
}
i -= 1;
}
return selectedTarget;
/* NOP */;
}
public function Distance2DBetweenCapsuleAndPoint(actor : CActor, entity
: CEntity) : Float{
var distance : Float;
var mpac : CMovingPhysicalAgentComponent;
distance = VecDistance2D(actor.GetWorldPosition(), entity.GetWor
ldPosition());
mpac = (CMovingPhysicalAgentComponent)actor.GetMovingAgentCompon
ent();
if (mpac){
distance -= mpac.GetCapsuleRadius();
}
return distance;
/* NOP */;
}
public function Distance2DBetweenCapsules(actor1 : CActor, actor2 : CAct
or) : Float{
var distance : Float;
var mpac : CMovingPhysicalAgentComponent;
distance = VecDistance2D(actor1.GetWorldPosition(), actor2.GetWo
rldPosition());
mpac = (CMovingPhysicalAgentComponent)actor1.GetMovingAgentCompo
nent();
if (mpac){
distance -= mpac.GetCapsuleRadius();
}
mpac = (CMovingPhysicalAgentComponent)actor2.GetMovingAgentCompo
nent();
if (mpac){
distance -= mpac.GetCapsuleRadius();
}
return distance;
/* NOP */;
}
protected function ProcessSelectionWeights() : STargetSelectionWeights{
var selectionWeights : STargetSelectionWeights;
if (ShouldUsePCModeTargeting()){
selectionWeights.angleWeight = 0.750000;
selectionWeights.distanceWeight = 0.250000;
selectionWeights.distanceRingWeight = 0.000000;
return selectionWeights;
}
if (IsInCombatAction() && GetBehaviorVariable('combatActionType'
, /* NOP */) == 2 || GetBehaviorVariable('combatActionType', /* NOP */) == 3){
selectionWeights.angleWeight = 0.575000;
selectionWeights.distanceWeight = 0.175000;
selectionWeights.distanceRingWeight = 0.250000;
}
if (!lAxisReleasedAfterCounter || IsInCombatAction()){
if (theInput.GetActionValue('ThrowItem') == 1.000000 ||
rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait'){

selectionWeights.angleWeight = 1.000000;
selectionWeights.distanceWeight = 0.000000;
selectionWeights.distanceRingWeight = 0.000000;
} else if (!lAxisReleasedAfterCounter){
selectionWeights.angleWeight = 0.550000;
selectionWeights.distanceWeight = 0.450000;
selectionWeights.distanceRingWeight = 0.000000;
} else {
selectionWeights.angleWeight = 0.750000;
selectionWeights.distanceWeight = 0.250000;
selectionWeights.distanceRingWeight = 0.000000;
}
} else if (!IsCurrentSignChanneled()){
selectionWeights.angleWeight = 0.350000;
selectionWeights.distanceWeight = 0.650000;
selectionWeights.distanceRingWeight = 0.000000;
} else {
selectionWeights.angleWeight = 0.275000;
selectionWeights.distanceWeight = 0.375000;
selectionWeights.distanceRingWeight = 0.350000;
}
return selectionWeights;
/* NOP */;
}
protected function CalcSelectionPriority(target : CEntity, selectionWeig
hts : STargetSelectionWeights, sourcePosition : Vector, headingVector : Vector)
: Float{
var sourceToTarget : Vector;
var sourceToTargetDist : Float;
var sourceToTargetAngleDiff : Float;
var selectionPriority : Float;
sourceToTarget = target.GetWorldPosition() - sourcePosition;
sourceToTargetDist = VecLength2D(sourceToTarget);
if (sourceToTargetDist < 0.000100){
sourceToTarget = Vector(0.000000, 0.000000, 0.000000);
} else {
sourceToTarget *= 1.000000 / sourceToTargetDist;
}
sourceToTargetAngleDiff = AbsF(Rad2Deg(AcosF(VecDot2D(sourceToTa
rget, headingVector))));
selectionPriority = selectionWeights.angleWeight * 180 - sourceT
oTargetAngleDiff / 180;
selectionPriority += selectionWeights.distanceWeight * softLockD
ist - sourceToTargetDist / softLockDist;
if (sourceToTargetDist > 0.000000 && sourceToTargetDist <= 6.000
000){
selectionPriority += selectionWeights.distanceRingWeight
* 1.000000;
} else if (sourceToTargetDist > 6.000000 && sourceToTargetDist <
= softLockDist){
selectionPriority += selectionWeights.distanceRingWeight
* 0.400000;
}
return selectionPriority;
/* NOP */;
}
protected function SetTarget(targetActor : CActor, forceSetTarget : Bool
){
var playerToTargetDistance : Float;
var target : CActor;

var allow : Bool;


target = GetTarget();
if (!IsInNonGameplayCutscene()){
allow = true;
}
if (allow){
if (targetActor){
if (targetActor.IsAlive() && !targetActor.IsKnoc
kedUnconscious() || finishableEnemiesList.Contains(targetActor)){
allow = true;
} else {
allow = false;
}
} else {
allow = true;
}
}
if (forceSetTarget){
allow = true;
}
if (allow && target != targetActor){
allow = true;
} else {
allow = false;
}
if (allow){
super.SetPlayerTarget(targetActor);
}
/* NOP */;
}
public function SetSlideTarget(actor : CGameplayEntity){
slideTarget = actor;
if (slideTarget){
super.SetPlayerCombatTarget((CActor)slideTarget);
} else {
/* NOP */;
}
if (slideTarget == nonActorTarget){
UpdateDisplayTarget(true, true);
} else {
UpdateDisplayTarget(/* NOP */, /* NOP */);
}
ConfirmDisplayTargetTimer(0.000000, /* NOP */);
/* NOP */;
}
public function OnForceSelectLockTarget() : Bool{
ForceSelectLockTarget();
/* NOP */;
}
private function ForceSelectLockTarget(){
var newMoveTarget : CActor;
var target : CActor;
newMoveTarget = GetScreenSpaceLockTarget(GetDisplayTarget(), 180
.000000, 1.000000, 90, /* NOP */);
if (!newMoveTarget){
newMoveTarget = GetScreenSpaceLockTarget(GetDisplayTarge
t(), 180.000000, 1.000000, -90, /* NOP */);
}
if (newMoveTarget){
thePlayer.ProcessLockTarget(newMoveTarget, /* NOP */);

target = GetTarget();
if (target){
thePlayer.SetSlideTarget(target);
if (IsHardLockEnabled()){
thePlayer.HardLockToTarget(true);
}
}
} else {
thePlayer.HardLockToTarget(false);
}
/* NOP */;
}
public function SetFinisherVictim(actor : CActor){
finisherVictim = actor;
/* NOP */;
}
public function GetFinisherVictim() : CActor{
return finisherVictim;
/* NOP */;
}
protected function SetNonActorTarget(actor : CGameplayEntity){
if (nonActorTarget != actor){
nonActorTarget = actor;
}
/* NOP */;
}
public timer function DisableTargetHighlightTimer(optional time : Float,
optional id : Int32){
var target : CActor;
target = GetTarget();
if (target){
target.StopEffect('select_character');
}
/* NOP */;
}
public function WasVisibleInScaledFrame(entity : CEntity, frameSizeX : F
loat, frameSizeY : Float) : Bool{
var position : Vector;
var positionFound : Bool;
var inFront : Bool;
var x : Float;
var y : Float;
var boneIndex : Int32;
var actor : CActor;
var gameplayEntity : CGameplayEntity;
var gameplayEntityMatrix : Matrix;
var drawableComp : CDrawableComponent;
var box : Box;
var ok : Bool;
if (!entity){
return false;
}
if (frameSizeX <= 0.000000 && frameSizeY <= 0.000000){
/* NOP */;
return false;
}
if (useNativeTargeting){
return targeting.WasVisibleInScaledFrame(entity, frameSi
zeX, frameSizeY);
}

position = entity.GetWorldPosition();
actor = (CActor)entity;
if (actor){
boneIndex = entity.GetBoneIndex('pelvis');
if (boneIndex == -1){
boneIndex = entity.GetBoneIndex('k_pelvis_g');
}
if (boneIndex != -1){
position = MatrixGetTranslation(entity.GetBoneWo
rldMatrixByIndex(boneIndex));
} else {
position = entity.GetWorldPosition();
position.Z += (CMovingPhysicalAgentComponent)act
or.GetMovingAgentComponent().GetCapsuleHeight() * 0.500000;
}
positionFound = true;
} else {
gameplayEntity = (CGameplayEntity)entity;
if (gameplayEntity && !gameplayEntity.aimVector.X == 0 &
& gameplayEntity.aimVector.Y == 0 && gameplayEntity.aimVector.Z == 0){
gameplayEntityMatrix = gameplayEntity.GetLocalTo
World();
position = VecTransform(gameplayEntityMatrix, ga
meplayEntity.aimVector);
positionFound = true;
}
}
if (!positionFound){
drawableComp = (CDrawableComponent)entity.GetComponentBy
ClassName('CDrawableComponent');
if (drawableComp && drawableComp.GetObjectBoundingVolume
(box)){
position.Z += box.Max.Z - box.Min.Z * 0.660000;
}
}
inFront = theCamera.WorldVectorToViewRatio(position, x, y);
if (!inFront){
return false;
}
x = AbsF(x);
y = AbsF(y);
ok = true;
ok = ok && frameSizeX <= 0.000000 || x < frameSizeX;
ok = ok && frameSizeY <= 0.000000 || y < frameSizeY;
return ok;
/* NOP */;
}
public function HardLockToTarget(flag : Bool){
EnableHardLock(flag);
LockToTarget(flag);
/* NOP */;
}
public function LockToTarget(flag : Bool){
if (IsHardLockEnabled() && !flag){
return;
}
LockCameraToTarget(flag);
LockActorToTarget(flag, /* NOP */);
/* NOP */;
}

public function LockCameraToTarget(flag : Bool){


if (flag && !IsCameraLockedToTarget()){
thePlayer.EnableManualCameraControl(false, 'LockCameraTo
Target');
SetIsCameraLockedToTarget(flag);
} else if (!flag && IsCameraLockedToTarget()){
thePlayer.EnableManualCameraControl(true, 'LockCameraToT
arget');
SetIsCameraLockedToTarget(flag);
}
/* NOP */;
}
public function LockActorToTarget(flag : Bool, withoutIcon : Bool){
var displayTargetActor : CActor;
if (flag){
if (!IsActorLockedToTarget()){
SetIsActorLockedToTarget(flag);
SetMoveTargetChangeAllowed(true);
SetMoveTarget(GetTarget());
SetMoveTargetChangeAllowed(false);
SetTarget(GetTarget(), /* NOP */);
SetSlideTarget(GetTarget());
AddTimer('CheckLockTargetIsAlive', 0.500000, tru
e, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (IsActorLockedToTarget()){
displayTargetActor = (CActor)GetDisplayTarget();
if (displayTargetActor && IsThreat(displayTarget
Actor, /* NOP */) && !withoutIcon){
EnableHardLockIcon(flag);
}
}
} else if (!flag && IsActorLockedToTarget()){
SetIsActorLockedToTarget(flag);
SetMoveTargetChangeAllowed(true);
RemoveTimer('CheckLockTargetIsAlive', /* NOP */);
EnableHardLockIcon(flag);
}
/* NOP */;
}
private function EnableHardLockIcon(flag : Bool){
var hud : CR4ScriptedHud;
var module : CR4HudModuleEnemyFocus;
hud = (CR4ScriptedHud)theGame.GetHud();
module = (CR4HudModuleEnemyFocus)hud.GetHudModule("EnemyFocusMod
ule");
module.SetShowHardLock(flag);
/* NOP */;
}
private timer function CheckLockTargetIsAlive(optional time : Float, opt
ional id : Int32){
var vitality : Float;
var essence : Float;
var actor : CActor;
var target : CActor;
target = (CActor)GetDisplayTarget();
if (!target || !target.IsAlive() || !target.GetGameplayVisibilit
y() || !CanBeTargetedIfSwimming(target, /* NOP */) || !target.UsesVitality() &&
!target.UsesEssence()){
if (!ProcessLockTarget(/* NOP */, /* NOP */)){

HardLockToTarget(false);
}
}
/* NOP */;
}
protected function PlayHitAnimation(damageAction : W3DamageAction, animT
ype : EHitReactionType){
var hitRotation : Float;
if (damageAction.HasAnyCriticalEffect()){
return;
}
if (!substateManager.ReactOnBeingHit() && !IsUsingVehicle()){
return;
}
if (damageAction.GetHitReactionType() == 4){
SetBehaviorVariable('isAttackReflected', 1.000000, /* NO
P */);
} else {
SetBehaviorVariable('isAttackReflected', 0.000000, /* NO
P */);
}
SetBehaviorVariable('HitReactionType', animType, /* NOP */);
SetBehaviorVariable('HitReactionWeapon', ProcessSwordOrFistHitRe
action(this, (CActor)damageAction.attacker), /* NOP */);
if (damageAction.attacker){
SetHitReactionDirection(damageAction.attacker);
SetDetailedHitReaction(damageAction.GetSwingType(), dama
geAction.GetSwingDirection());
}
RaiseForceEvent('Hit');
if (IsUsingBoat()){
SoundEvent("cmb_play_hit_light", /* NOP */, /* NOP */);
return;
}
if (IsUsingVehicle()){
return;
}
if (damageAction.attacker){
hitRotation = VecHeading(damageAction.attacker.GetWorldP
osition() - GetWorldPosition());
if (GetBehaviorVariable('HitReactionDirection', /* NOP *
/) == 1){
hitRotation += 180.000000;
}
SetCustomRotation('Hit', hitRotation, 1080.000000, 0.100
000, false);
}
CriticalEffectAnimationInterrupted("PlayHitAnimation");
/* NOP */;
}
public function ReduceDamage(damageData : W3DamageAction){
super.ReduceDamage(damageData);
if (damageData.attacker == this && damageData.GetBuffSourceName(
) == "petard" || (W3Petard)damageData.causer){
if (theGame.CanLog()){
LogDMHits("CR4Player.ReduceDamage: hitting self
with own bomb - damage reduced by 50%", damageData);
}
damageData.processedDmg.vitalityDamage = damageData.proc
essedDmg.vitalityDamage / 2;

damageData.processedDmg.essenceDamage = damageData.proce
ssedDmg.essenceDamage / 2;
}
/* NOP */;
}
public function GetCriticalHitChance(isHeavyAttack : Bool, target : CAct
or, victimMonsterCategory : EMonsterCategory) : Float{
var critChance : Float;
var oilChanceAttribute : CName;
critChance = 0;
if (FactsQuerySum('debug_fact_critical_boy') > 0){
critChance += 1;
}
if (IsInState('HorseRiding') && (CActor)GetUsedVehicle().GetMovi
ngAgentComponent().GetRelativeMoveSpeed() >= 4.000000){
critChance += 1;
}
critChance += CalculateAttributeValue(GetAttributeValue(theGame.
params.CRITICAL_HIT_CHANCE, /* NOP */, /* NOP */), /* NOP */);
if (isHeavyAttack && CanUseSkill(23)){
critChance += CalculateAttributeValue(GetSkillAttributeV
alue(23, theGame.params.CRITICAL_HIT_CHANCE, false, true), /* NOP */) * GetSkill
Level(23);
} else if (!isHeavyAttack && CanUseSkill(32)){
critChance += CalculateAttributeValue(GetSkillAttributeV
alue(32, theGame.params.CRITICAL_HIT_CHANCE, false, true), /* NOP */) * GetSkill
Level(32);
}
if (target && target.HasBuff(5)){
critChance += (W3ConfuseEffect)target.GetBuff(5, /* NOP
*/).GetCriticalHitChanceBonus();
}
oilChanceAttribute = MonsterCategoryToCriticalChanceBonus(victim
MonsterCategory);
if (IsNameValid(oilChanceAttribute)){
critChance += CalculateAttributeValue(GetAttributeValue(
oilChanceAttribute, /* NOP */, /* NOP */), /* NOP */);
}
return critChance;
/* NOP */;
}
public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, vict
imMonsterCategory : EMonsterCategory, isStrikeAtBack : Bool) : SAbilityAttribute
Value{
var bonus : SAbilityAttributeValue;
var oilBonus : SAbilityAttributeValue;
var vsAttributeName : CName;
bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterC
ategory, isStrikeAtBack);
if (inv.ItemHasOilApplied(weaponId)){
vsAttributeName = MonsterCategoryToCriticalDamageBonus(v
ictimMonsterCategory);
oilBonus = inv.GetItemAttributeValue(weaponId, vsAttribu
teName, /* NOP */, /* NOP */);
bonus += oilBonus;
}
return bonus;
/* NOP */;
}
public function ReactToBeingHit(damageAction : W3DamageAction, buffNotAp

plied : Bool) : Bool{


var strength : Float;
var animType : EHitReactionType;
var sup : Bool;
var boat : CBoatComponent;
var combatActionType : Int32;
var attackAction : W3Action_Attack;
var npc : CNewNPC;
var shakeCam : Bool;
attackAction = (W3Action_Attack)damageAction;
if (!damageAction.IsDoTDamage() && !attackAction || !attackActio
n.IsParried() && !attackAction.IsCountered() && !attackAction.WasDodged()){
npc = (CNewNPC)attackAction.attacker;
if (npc && npc.IsHeavyAttack(attackAction.GetAttackName(
))){
theGame.VibrateControllerVeryHard(/* NOP */);
} else {
theGame.VibrateControllerHard(/* NOP */);
}
}
if ((CActor)GetUsedVehicle() && playerAiming.GetCurrentStateName
() == 'Aiming'){
OnRangedForceHolster(true, true, /* NOP */);
}
combatActionType = GetBehaviorVariable('combatActionType', /* NO
P */);
if (thePlayer.IsCurrentlyDodging() && combatActionType == 3 || c
ombatActionType == 12){
sup = false;
} else if (GetCurrentStateName() == 'DismountHorse'){
sup = false;
} else {
sup = super.ReactToBeingHit(damageAction, buffNotApplied
);
}
sup = false;
if (damageAction.attacker){
theTelemetry.LogWithLabelAndValue(25, damageAction.attac
ker.ToString(), damageAction.processedDmg.vitalityDamage);
}
if (damageAction.DealsAnyDamage()){
if ((W3PlayerWitcher)this && GetWitcherPlayer().IsAnyQue
nActive() && damageAction.IsDoTDamage()){
shakeCam = false;
} else {
shakeCam = true;
}
if (shakeCam){
animType = ModifyHitSeverityReaction(this, damag
eAction.GetHitReactionType());
if (animType == 1 || animType == 5){
strength = 0.100000;
} else if (animType == 2 || animType == 3){
strength = 0.200000;
}
GCameraShakeLight(strength, false, GetWorldPosit
ion(), 10.000000, /* NOP */, /* NOP */, /* NOP */);
}
HitReactionEffect(0.250000);
ResetUninterruptedHitsCount();

}
if (!damageAction.IsDoTDamage() && IsThreatened() && ShouldPause
HealthRegenOnHit()){
PauseHPRegenEffects('being_hit', theGame.params.ON_HIT_H
P_REGEN_DELAY);
}
if (damageAction.processedDmg.vitalityDamage > 0 && !(W3Effect_T
oxicity)damageAction.causer){
ReceivedCombatDamage();
}
if (FactsQuerySum("tut_fight_use_slomo") > 0){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(13));
FactsRemove("tut_fight_slomo_ON");
}
if (!substateManager.ReactOnBeingHit()){
GoToCombatIfNeeded(/* NOP */);
}
return sup;
/* NOP */;
}
protected function ShouldPauseHealthRegenOnHit() : Bool{
return true;
/* NOP */;
}
public function PlayHitEffect(damageAction : W3DamageAction){
super.PlayHitEffect(damageAction);
if (damageAction.DealsAnyDamage() && !damageAction.IsDoTDamage()
){
PlayEffect('hit_screen', /* NOP */);
}
/* NOP */;
}
public function HitReactionEffect(interval : Float){
if (hitReactionEffect){
PlayEffect('radial_blur', /* NOP */);
hitReactionEffect = false;
} else {
AddTimer('HitReactionEffectCooldown', interval, false, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function HitReactionEffectCooldown(optional td : Float, opt
ional id : Int32){
hitReactionEffect = true;
/* NOP */;
}
public function PerformParryCheck(parryInfo : SParryInfo) : Bool{
var mult : Float;
var parryType : EParryType;
var parryDir : EPlayerParryDirection;
var parryHeading : Float;
var fistFightParry : Bool;
var action : W3DamageAction;
var xmlStaminaDamage : Float;
var xmlStaminaDamageName : CName;
xmlStaminaDamageName = 'stamina_damage';
if (CanParryAttack() && FistFightCheck(parryInfo.target, parryIn
fo.attacker, fistFightParry)){
parryHeading = GetParryHeading(parryInfo, parryDir);

SetBehaviorVariable('parryDirection', parryDir, /* NOP *


/);
SetBehaviorVariable('parryDirectionOverlay', parryDir, /
* NOP */);
SetBehaviorVariable('parryType', ChooseParryTypeIndex(pa
rryInfo), /* NOP */);
if (IsInCombatActionFriendly()){
RaiseEvent('CombatActionFriendlyEnd');
}
if (HasStaminaToParry(parryInfo.attackActionName)){
SetBehaviorVariable('combatActionType', 9, /* NO
P */);
if (parryInfo.targetToAttackerDist > 3.000000 &&
!bLAxisReleased && !thePlayer.IsCiri()){
if (!RaiseForceEvent('PerformParryOverla
y')){
return false;
} else {
ClearCustomOrientationInfoStack(
);
}
} else if (RaiseForceEvent('PerformParry')){
OnCombatActionStart();
ClearCustomOrientationInfoStack();
SetSlideTarget(parryInfo.attacker);
SetCustomRotation('Parry', parryHeading,
1080.000000, 0.100000, false);
} else {
return false;
}
} else {
AddEffectDefault(13, parryInfo.attacker, "Parry"
, /* NOP */);
return true;
}
if (parryInfo.attacker.IsWeaponHeld('fist') && !parryInf
o.target.IsWeaponHeld('fist')){
parryInfo.attacker.ReactToReflectedAttack(parryI
nfo.target);
} else {
if (IsInFistFightMiniGame() && fistFightParry){
if (IsNameValid(xmlStaminaDamageName)){
xmlStaminaDamage = CalculateAttr
ibuteValue(parryInfo.attacker.GetAttributeValue(xmlStaminaDamageName, /* NOP */,
/* NOP */), /* NOP */);
DrainStamina(13, xmlStaminaDamag
e, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
DrainStamina(4, 0, 0, 'None', 0, mult);
}
if (IsLightAttack(parryInfo.attackActionName)){
parryInfo.target.PlayEffectOnHeldWeapon(
'light_block', /* NOP */);
} else {
parryInfo.target.PlayEffectOnHeldWeapon(
'heavy_block', /* NOP */);
}
}
return true;

}
return false;
/* NOP */;
}
protected function GetParryHeading(parryInfo : SParryInfo, parryDir : EP
layerParryDirection) : Float{
var targetToAttackerHeading : Float;
var currToTargetAttackerAngleDiff : Float;
targetToAttackerHeading = VecHeading(parryInfo.attacker.GetWorld
Position() - parryInfo.target.GetWorldPosition());
currToTargetAttackerAngleDiff = AngleDistance(VecHeading(parryIn
fo.target.GetHeadingVector()), targetToAttackerHeading);
if (!parryInfo.target.IsWeaponHeld('fist')){
if (currToTargetAttackerAngleDiff > -45 && currToTargetA
ttackerAngleDiff < 45){
parryDir = 0;
return targetToAttackerHeading;
} else if (currToTargetAttackerAngleDiff >= 45 && currTo
TargetAttackerAngleDiff < 135){
parryDir = 3;
return targetToAttackerHeading + 90;
} else if (currToTargetAttackerAngleDiff <= -45 && currT
oTargetAttackerAngleDiff > -135){
parryDir = 1;
return targetToAttackerHeading - 90;
} else {
parryDir = 2;
return targetToAttackerHeading + 180;
}
} else if (currToTargetAttackerAngleDiff > -45 && currToTargetAt
tackerAngleDiff < 45){
parryDir = 0;
return targetToAttackerHeading;
} else if (currToTargetAttackerAngleDiff >= 45 && currToTargetAt
tackerAngleDiff < 180){
parryDir = 3;
return targetToAttackerHeading + 90;
} else if (currToTargetAttackerAngleDiff <= -45 && currToTargetA
ttackerAngleDiff >= -180){
parryDir = 1;
return targetToAttackerHeading - 90;
} else {
parryDir = 2;
return targetToAttackerHeading + 180;
}
/* NOP */;
}
public function ProcessLockTarget(newLockTarget : CActor, checkLeftStick
Heading : Bool) : Bool{
var attackerNearestPoint : Vector;
var playerNearestPoint : Vector;
var incomingAttacker : CActor;
var tempLockTarget : CActor;
var target : CActor;
var useIncomingAttacker : Bool;
if (newLockTarget){
tempLockTarget = newLockTarget;
} else {
incomingAttacker = GetClosestIncomingAttacker();
if (incomingAttacker && incomingAttacker.IsAlive() && Is

UsingVehicle()){
tempLockTarget = incomingAttacker;
useIncomingAttacker = false;
}
if (!useIncomingAttacker){
target = GetTarget();
if (target && target.IsAlive() && target.GetGame
playVisibility() && super.IsEnemyVisible(target) && IsThreat(target, /* NOP */)
&& CanBeTargetedIfSwimming(target, /* NOP */)){
tempLockTarget = FindTarget(/* NOP */, /
* NOP */, /* NOP */);
} else {
tempLockTarget = GetScreenSpaceLockTarge
t(GetDisplayTarget(), 180.000000, 1.000000, 0.000000, /* NOP */);
}
}
}
if (tempLockTarget){
if (IsCombatMusicEnabled() || hostileEnemies.Size() > 0)
{
if (!IsThreat(tempLockTarget, /* NOP */)){
tempLockTarget = NULL;
}
}
}
SetTarget(tempLockTarget, true);
SetMoveTargetChangeAllowed(true);
SetMoveTarget(tempLockTarget);
SetMoveTargetChangeAllowed(false);
SetSlideTarget(tempLockTarget);
if (tempLockTarget){
if (IsActorLockedToTarget()){
EnableHardLockIcon(true);
}
return true;
} else {
return false;
}
/* NOP */;
}
public function IsDoingSpecialAttack(heavy : Bool) : Bool{
var pat : EPlayerAttackType;
if (IsInCombatAction() && GetBehaviorVariable('combatActionType'
, /* NOP */) == 1){
pat = GetBehaviorVariable('playerAttackType', /* NOP */)
;
if (heavy && pat == 1){
return true;
} else if (!heavy && pat == 0){
return true;
}
}
return false;
/* NOP */;
}
public function SetIsCurrentlyDodging(enable : Bool, isRolling : Bool){
super.SetIsCurrentlyDodging(enable, isRolling);
if (isRolling){
SetCanPlayHitAnim(false);
AddBuffImmunity(10, 'Roll', false);

AddBuffImmunity(9, 'Roll', false);


AddBuffImmunity(6, 'Roll', false);
AddBuffImmunity(13, 'Roll', false);
} else {
SetCanPlayHitAnim(true);
RemoveBuffImmunity(10, 'Roll');
RemoveBuffImmunity(9, 'Roll');
RemoveBuffImmunity(6, 'Roll');
RemoveBuffImmunity(13, 'Roll');
}
/* NOP */;
}
public function EnableHardLock(flag : Bool){
super.EnableHardLock(flag);
if (flag && ShouldProcessTutorial('TutorialTargettingWaiting')){
FactsAdd("tut_hardlocked", /* NOP */, /* NOP */);
}
/* NOP */;
}
protected function TestParryAndCounter(data : CPreAttackEventData, weapo
nId : SItemUniqueId, parried : Bool, countered : Bool) : array<CActor>{
var ret : array<CActor>;
if (FactsQuerySum('player_is_the_boss') > 0){
SetDebugAttackRange(data.rangeName);
RemoveTimer('PostAttackDebugRangeClear', /* NOP */);
return ret;
}
ret = super.TestParryAndCounter(data, weaponId, parried, counter
ed);
if (parried){
theGame.GetGamerProfile().ResetStat(6);
}
return ret;
/* NOP */;
}
public function SetSpecialAttackTimeRatio(f : Float){
LogSpecialHeavy(f);
specialAttackTimeRatio = f;
/* NOP */;
}
public function GetSpecialAttackTimeRatio() : Float{
return specialAttackTimeRatio;
/* NOP */;
}
public function OnSpecialAttackHeavyActionProcess(){
SetSpecialAttackTimeRatio(0.000000);
/* NOP */;
}
protected function DoAttack(animData : CPreAttackEventData, weaponId : S
ItemUniqueId, parried : Bool, countered : Bool, parriedBy : array<CActor>, attac
kAnimationName : CName, hitTime : Float){
var shakeStr : Float;
var weapon : EPlayerWeapon;
var targetActor : CActor;
if (animData.attackName == 'attack_heavy_special'){
if (specialAttackTimeRatio != 1){
shakeStr = specialAttackTimeRatio / 3.333000 + 0
.200000;
} else {
shakeStr = 0.500000;

}
GCameraShake(shakeStr, false, GetWorldPosition(), 10, /*
NOP */, /* NOP */, /* NOP */);
} else if (IsHeavyAttack(attackActionName)){
if (parriedBy.Size() > 0){
shakeStr = 0.200000;
} else {
shakeStr = 0.100000;
}
GCameraShake(shakeStr, false, GetWorldPosition(), 10, /*
NOP */, /* NOP */, /* NOP */);
}
targetActor = (CActor)slideTarget;
if (targetActor && hitTargets.Contains(targetActor)){
weapon = GetMostConvenientMeleeWeapon(targetActor, true)
;
if (GetCurrentMeleeWeaponType() != 3 && weapon != GetCur
rentMeleeWeaponType()){
if (weapon == 1){
thePlayer.OnEquipMeleeWeapon(1, true, /*
NOP */);
} else if (weapon == 2){
thePlayer.OnEquipMeleeWeapon(2, true, /*
NOP */);
}
}
}
super.DoAttack(animData, weaponId, parried, countered, parriedBy
, attackAnimationName, hitTime);
/* NOP */;
}
public final function SetPlayerCombatStance(stance : EPlayerCombatStance
, force : Bool){
var stanceInt : Int32;
if (!CanChangeCombatStance(stance, force)){
return;
}
combatStance = stance;
stanceInt = stance;
SetBehaviorVariable('playerCombatStance', stanceInt, /* NOP */);
SetBehaviorVariable('playerCombatStanceForOverlay', stanceInt, /
* NOP */);
if (force){
SetBehaviorVariable('forceCombatStance', 1.000000, /* NO
P */);
} else {
SetBehaviorVariable('forceCombatStance', 0.000000, /* NO
P */);
}
/* NOP */;
}
private function CanChangeCombatStance(stance : EPlayerCombatStance, for
ce : Bool) : Bool{
var currTime : Float;
if (force){
return true;
}
if (IsInFistFightMiniGame()){
return true;
}

if (isInHolsterAnim){
return false;
}
if (combatStance == 0 || combatStance == 2 && stance == 1){
currTime = theGame.GetEngineTimeAsSeconds();
if (!isConfirmingCombatStance){
isConfirmingCombatStance = true;
confirmCombatStanceTimeStamp = currTime;
if (playerMoveType == 0){
SetBehaviorVariable('isInCombatForOverla
y', 0.000000, /* NOP */);
} else {
SetBehaviorVariable('isInCombatForOverla
y', 1.000000, /* NOP */);
}
return false;
} else if (currTime < confirmCombatStanceTimeStamp + 1.0
00000){
if (stance == 1){
return false;
}
} else {
isConfirmingCombatStance = false;
}
} else {
isConfirmingCombatStance = false;
}
return true;
/* NOP */;
}
public function OnHolsterWeaponStart() : Bool{
isInHolsterAnim = true;
/* NOP */;
}
public function OnHolsterWeaponEnd() : Bool{
isInHolsterAnim = false;
/* NOP */;
}
public final function GetPlayerCombatStance() : EPlayerCombatStance{
return combatStance;
/* NOP */;
}
public timer function DelayedDisableFindTarget(optional time : Float, op
tional id : Int32){
if (GetTarget().IsAlive()){
EnableFindTarget(false);
} else {
EnableFindTarget(true);
}
/* NOP */;
}
public function StartDodgeTimer(){
dodgeTimerRunning = true;
thePlayer.AddTimer('DodgeTimer', 0.200000, false, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function StopDodgeTimer(){
RemoveTimer('DodgeTimer', /* NOP */);
dodgeTimerRunning = false;

/* NOP */;
}
public function IsDodgeTimerRunning() : Bool{
return dodgeTimerRunning;
/* NOP */;
}
public timer function DodgeTimer(optional dt : Float, optional id : Int3
2){
dodgeTimerRunning = false;
/* NOP */;
}
public function EvadePressed(bufferAction : EBufferActionType){
}
public function PerformingCombatAction() : EBufferActionType{
return BufferCombatAction;
/* NOP */;
}
public function PushCombatActionOnBuffer(action : EBufferActionType, sta
ge : EButtonStage, allSteps : Bool){
BufferButtonStage = stage;
BufferCombatAction = action;
BufferAllSteps = allSteps;
/* NOP */;
}
protected function ProcessCombatActionHeading(action : EBufferActionType
) : Float{
var processedActionHeading : Float;
HandleMovement(0.000000);
if (ShouldUsePCModeTargeting()){
return theGame.GetGameCamera().GetHeading();
}
if (lAxisReleasedAfterCounter){
ResetCachedRawPlayerHeading();
}
processedActionHeading = cachedRawPlayerHeading;
return processedActionHeading;
/* NOP */;
}
public function ResetRawPlayerHeading(){
if (GetDisplayTarget()){
rawPlayerHeading = VecHeading(GetDisplayTarget().GetWorl
dPosition() - GetWorldPosition());
} else {
rawPlayerHeading = GetHeading();
}
/* NOP */;
}
public function ResetCachedRawPlayerHeading(){
cachedRawPlayerHeading = rawPlayerHeading;
if (GetDisplayTarget() && IsDisplayTargetTargetable() && AbsF(An
gleDistance(VecHeading(GetDisplayTarget().GetWorldPosition() - GetWorldPosition(
)), GetHeading())) < 90.000000){
cachedRawPlayerHeading = VecHeading(GetDisplayTarget().G
etWorldPosition() - GetWorldPosition());
} else {
cachedRawPlayerHeading = GetHeading();
}
if (canResetCachedCombatActionHeading){
cachedCombatActionHeading = cachedRawPlayerHeading;
}

/* NOP */;
}
public function GetCombatActionTarget(action : EBufferActionType) : CGam
eplayEntity{
var selectedTargetableEntity : CGameplayEntity;
if (!IsUsingVehicle()){
selectedTargetableEntity = FindNonActorTarget(true, acti
on);
}
if (selectedTargetableEntity){
return selectedTargetableEntity;
} else {
if (!IsUsingVehicle()){
FindTarget(true, action, true);
} else {
(CR4PlayerStateUseGenericVehicle)GetState('UseGe
nericVehicle').FindTarget();
}
return GetTarget();
}
/* NOP */;
}
private function FindNonActorTarget(actionCheck : Bool, action : EBuffer
ActionType) : CGameplayEntity{
var targetableEntities : array<CGameplayEntity>;
var selectedTargetableEntity : CGameplayEntity;
var selectionPriority : array<Float>;
var selectionWeights : STargetSelectionWeights;
var findEntityDist : Float;
var i : Int32;
var size : Int32;
var playerHeading : Float;
var playerInventory : CInventoryComponent;
var castSignType : ESignType;
var targetingInfo : STargetingInfo;
var playerPosition : Vector;
var cameraPosition : Vector;
var playerHeadingVector : Vector;
var rawPlayerHeadingVector : Vector;
playerPosition = GetWorldPosition();
cameraPosition = theCamera.GetCameraPosition();
rawPlayerHeadingVector = VecFromHeading(rawPlayerHeading);
if (bCanFindTarget && !IsHardLockEnabled()){
if (actionCheck && IsInCombat() && action == 3){
findEntityDist = 6.000000;
selectionWeights.angleWeight = 0.375000;
selectionWeights.distanceWeight = 0.275000;
selectionWeights.distanceRingWeight = 0.350000;
} else if (!IsInCombat() && lastAxisInputIsMovement){
findEntityDist = softLockDist;
selectionWeights.angleWeight = 0.375000;
selectionWeights.distanceWeight = 0.275000;
selectionWeights.distanceRingWeight = 0.350000;
} else {
findEntityDist = softLockDist;
selectionWeights.angleWeight = 0.750000;
selectionWeights.distanceWeight = 0.125000;
selectionWeights.distanceRingWeight = 0.125000;
}
if (!IsInCombat() || !bLAxisReleased){

FindGameplayEntitiesInRange(targetableEntities,
this, findEntityDist, 10, theGame.params.TAG_SOFT_LOCK, /* NOP */, /* NOP */, /*
NOP */);
}
if (targetableEntities.Size() > 0){
playerInventory = GetInventory();
castSignType = GetEquippedSign();
if (!bLAxisReleased){
targetingInfo.source = this;
targetingInfo.canBeTargetedCheck = false
;
targetingInfo.coneCheck = true;
targetingInfo.coneHalfAngleCos = 0.50000
0;
targetingInfo.coneDist = softLockDist;
targetingInfo.coneHeadingVector = rawPla
yerHeadingVector;
targetingInfo.distCheck = true;
targetingInfo.invisibleCheck = false;
targetingInfo.navMeshCheck = false;
targetingInfo.frameScaleX = 1.000000;
targetingInfo.frameScaleY = 1.000000;
targetingInfo.knockDownCheck = false;
targetingInfo.knockDownCheckDist = 0.000
000;
targetingInfo.rsHeadingCheck = false;
targetingInfo.rsHeadingLimitCos = 1.0000
00;
}
i = targetableEntities.Size() - 1;
while (i >= 0){
if (bLAxisReleased){
if (!lastAxisInputIsMovement){
if (!WasVisibleInScaledF
rame(targetableEntities[i], 0.900000, 0.900000)){
targetableEntiti
es.Erase(i);
} else {
}
} else if (!WasVisibleInScaledFr
ame(targetableEntities[i], 1.000000, 1.000000)){
targetableEntities.Erase
(i);
} else {
}
} else {
targetingInfo.targetEntity = tar
getableEntities[i];
if (actionCheck && moveTarget){
targetingInfo.inFrameChe
ck = false;
if (!IsEntityTargetable(
targetingInfo, /* NOP */)){
targetableEntiti
es.Erase(i);
} else {
}
} else {
targetingInfo.inFrameChe
ck = true;

if (!IsEntityTargetable(
targetingInfo, /* NOP */)){
targetableEntiti
es.Erase(i);
} else {
}
}
}
if (actionCheck){
if (action == 4){
if (playerInventory.IsIt
emBomb(GetSelectedItemId()) && !targetableEntities[i].HasTag('softLock_Bomb') ||
playerInventory.IsItemCrossbow(GetSelectedItemId()) && !targetableEntities[i].H
asTag('softLock_Bolt')){
targetableEntiti
es.Erase(i);
} else {
}
} else if (action == 3){
if (castSignType == 0 &&
!targetableEntities[i].HasTag('softLock_Aard') || castSignType == 2 && !targeta
bleEntities[i].HasTag('softLock_Igni') || castSignType == 4 && !targetableEntiti
es[i].HasTag('softLock_Axii') || castSignType == 1 || castSignType == 3){
targetableEntiti
es.Erase(i);
} else {
}
} else if (action == 1 || action
== 2 || action == 8){
if (IsWeaponHeld('fist')
&& !targetableEntities[i].HasTag('softLock_Fist') || !IsWeaponHeld('fist') && !
targetableEntities[i].HasTag('softLock_Weapon')){
targetableEntiti
es.Erase(i);
} else {
}
} else {
targetableEntities.Erase
(i);
}
}
i -= 1;
}
}
if (targetableEntities.Size() > 0){
playerHeading = GetHeading();
playerHeadingVector = GetHeadingVector();
if (IsInCombat()){
i = 0;
while (i < targetableEntities.Size()){
if (bLAxisReleased){
selectionPriority.PushBa
ck(CalcSelectionPriority(targetableEntities[i], selectionWeights, cameraPosition
, rawPlayerHeadingVector));
} else {
selectionPriority.PushBa
ck(CalcSelectionPriority(targetableEntities[i], selectionWeights, playerPosition
, rawPlayerHeadingVector));
}
i += 1;

}
if (selectionPriority.Size() > 0){
selectedTargetableEntity = targe
tableEntities[ArrayFindMaxF(selectionPriority)];
}
} else if (bLAxisReleased){
if (!lastAxisInputIsMovement){
i = 0;
while (i < targetableEntities.Si
ze()){
selectionPriority.PushBa
ck(CalcSelectionPriority(targetableEntities[i], selectionWeights, cameraPosition
, rawPlayerHeadingVector));
i += 1;
}
if (selectionPriority.Size() > 0
){
selectedTargetableEntity
= targetableEntities[ArrayFindMaxF(selectionPriority)];
}
} else if (IsInCombatAction()){
selectedTargetableEntity = nonAc
torTarget;
} else {
i = 0;
while (i < targetableEntities.Si
ze()){
selectionPriority.PushBa
ck(CalcSelectionPriority(targetableEntities[i], selectionWeights, playerPosition
, playerHeadingVector));
i += 1;
}
if (selectionPriority.Size() > 0
){
selectedTargetableEntity
= targetableEntities[ArrayFindMaxF(selectionPriority)];
targetingInfo.source = t
his;
targetingInfo.targetEnti
ty = selectedTargetableEntity;
targetingInfo.canBeTarge
tedCheck = false;
targetingInfo.coneCheck
= true;
targetingInfo.coneHalfAn
gleCos = 0.000000;
targetingInfo.coneDist =
softLockDist;
targetingInfo.coneHeadin
gVector = GetHeadingVector();
targetingInfo.distCheck
= true;
targetingInfo.invisibleC
heck = false;
targetingInfo.navMeshChe
ck = false;
targetingInfo.inFrameChe
ck = false;
targetingInfo.frameScale
X = 1.000000;

targetingInfo.frameScale
Y = 1.000000;
targetingInfo.knockDownC
heck = false;
targetingInfo.knockDownC
heckDist = 0.000000;
targetingInfo.rsHeadingC
heck = false;
targetingInfo.rsHeadingL
imitCos = 1.000000;
if (!IsEntityTargetable(
targetingInfo, /* NOP */)){
selectedTargetab
leEntity = NULL;
}
}
}
} else {
i = 0;
while (i < targetableEntities.Size()){
selectionPriority.PushBack(CalcS
electionPriority(targetableEntities[i], selectionWeights, playerPosition, rawPla
yerHeadingVector));
i += 1;
}
if (selectionPriority.Size() > 0){
selectedTargetableEntity = targe
tableEntities[ArrayFindMaxF(selectionPriority)];
}
}
} else {
selectedTargetableEntity = NULL;
}
}
SetNonActorTarget(selectedTargetableEntity);
return selectedTargetableEntity;
/* NOP */;
}
public function SetupCombatAction(action : EBufferActionType, stage : EB
uttonStage){
var weaponType : EPlayerWeapon;
var canAttackTarget : CGameplayEntity;
var target : CActor;
if (!IsCombatMusicEnabled()){
SetCombatActionHeading(ProcessCombatActionHeading(action
));
FindTarget(/* NOP */, /* NOP */, /* NOP */);
UpdateDisplayTarget(true, /* NOP */);
}
if (displayTarget && IsDisplayTargetTargetable()){
canAttackTarget = displayTarget;
} else if (GetTarget()){
canAttackTarget = GetTarget();
} else if (!target && IsCombatMusicEnabled()){
canAttackTarget = moveTarget;
}
target = (CActor)canAttackTarget;
if (!AllowAttack(target, action)){
return;
}

if (action != 4 && action != 3){


weaponType = weaponHolster.GetCurrentMeleeWeapon();
PrepareToAttack(target, action);
if (weaponType != weaponHolster.GetCurrentMeleeWeapon())
{
if (!weaponType == 0 && weaponHolster.GetCurrent
MeleeWeapon() == 3){
return;
}
}
}
if (action == 8 && !(W3ReplacerCiri)this){
thePlayer.SetAttackActionName(SkillEnumToName(17));
}
CriticalEffectAnimationInterrupted("SetupCombatAction " + action
);
PushCombatActionOnBuffer(action, stage, /* NOP */);
if (GetBIsCombatActionAllowed()){
ProcessCombatActionBuffer();
}
/* NOP */;
}
public function AllowAttack(target : CActor, action : EBufferActionType)
: Bool{
var newTarget : CActor;
var canAttackWhenNotInCombat : Bool;
var messageDisplayed : Bool;
var itemId : SItemUniqueId;
var isShootingCrossbow : Bool;
var isInCorrectState : Bool;
if (target){
if (target.IsTargetableByPlayer()){
if (!target.IsAttackableByPlayer()){
DisplayHudMessage(GetLocStringByKeyExt("
panel_hud_message_cant_attack_this_target"));
return false;
}
}
}
if (GetCurrentStateName() == 'Exploration'){
isInCorrectState = true;
}
if (action == 4){
itemId = thePlayer.GetSelectedItemId();
if (inv.IsIdValid(itemId) && inv.IsItemCrossbow(itemId))
{
isShootingCrossbow = true;
}
if (!isInCorrectState){
if (GetCurrentStateName() == 'AimThrow' && !isSh
ootingCrossbow){
isInCorrectState = true;
}
}
}
if (isInCorrectState){
canAttackWhenNotInCombat = thePlayer.CanAttackWhenNotInC
ombat(action, false, newTarget, target);
}
if (!target){

if (isInCorrectState){
SetCombatActionHeading(ProcessCombatActionHeadin
g(action));
target = newTarget;
}
}
if (isInCorrectState){
if (!canAttackWhenNotInCombat){
if (DisplayCannotAttackMessage(target)){
messageDisplayed = true;
} else if (action == 1 || action == 2 && !RaiseA
ttackFriendlyEvent(target)){
messageDisplayed = true;
} else if (!CanRaiseCombatActionFriendlyEvent(is
ShootingCrossbow)){
messageDisplayed = true;
}
}
if (messageDisplayed){
theInput.ForceDeactivateAction('ThrowItem');
theInput.ForceDeactivateAction('ThrowItemHold');
return false;
}
}
return true;
/* NOP */;
}
public function ProcessCombatActionBuffer() : Bool{
var actionResult : Bool;
var action : EBufferActionType;
var stage : EButtonStage;
var s : SNotWorkingOutFunctionParametersHackStruct1;
var allSteps : Bool;
action = BufferCombatAction;
stage = BufferButtonStage;
allSteps = BufferAllSteps;
if (IsInCombatActionFriendly()){
RaiseEvent('CombatActionFriendlyEnd');
}
if (action != 8 && action != 4 || action == 8 && stage == 1 || a
ction == 4 && stage != 0){
GetMovingAgentComponent().GetMovementAdjustor().CancelAl
l();
SetUnpushableTarget(NULL);
}
if (!action == 6 || action == 9){
SetIsCurrentlyDodging(false, /* NOP */);
}
SetCombatActionHeading(ProcessCombatActionHeading(action));
if (action == 4 && GetInventory().IsItemCrossbow(selectedItemId)
){
if (rangedWeapon && rangedWeapon.GetCurrentStateName() !
= 'State_WeaponShoot' && rangedWeapon.GetCurrentStateName() != 'State_WeaponAim'
|| GetIsShootingFriendly()){
SetSlideTarget(GetCombatActionTarget(action));
}
} else if (!action == 8 && stage == 0 || GetCurrentStateName() =
= 'AimThrow'){
SetSlideTarget(GetCombatActionTarget(action));
}

if (!slideTarget){
/* NOP */;
}
actionResult = true;
switch(action){
case 0:
BufferAllSteps = false;
return true;
break;
case 1:
if (IsCiri()){
return false;
}
switch(stage){
case 1:
DrainStamina(1, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
thePlayer.BreakPheromoneEffect();
actionResult = OnPerformAttack(theGame.params.AT
TACK_NAME_LIGHT);
break;
default:
actionResult = false;
break;
}
break;
case 2:
if (IsCiri()){
return false;
}
switch(stage){
case 0:
DrainStamina(2, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
thePlayer.BreakPheromoneEffect();
actionResult = OnPerformAttack(theGame.params.AT
TACK_NAME_HEAVY);
break;
case 1:
if (GetCurrentStateName() == 'CombatFists'){
DrainStamina(2, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
thePlayer.BreakPheromoneEffect();
actionResult = OnPerformAttack(theGame.p
arams.ATTACK_NAME_HEAVY);
}
break;
default:
actionResult = false;
break;
}
break;
case 4:
switch(stage){
case 1:
if (!(W3PlayerWitcher)this || !IsInCombatActionF
riendly() && !!GetBIsCombatActionAllowed() && GetBehaviorVariable('combatActionT
ype', /* NOP */) == 0 || GetBehaviorVariable('combatActionType', /* NOP */) == 6
){
if (inv.IsItemCrossbow(selectedItemId)){

rangedWeapon = (Crossbow)inv.Get
ItemEntityUnsafe(selectedItemId);
rangedWeapon.OnRangedWeaponPress
();
} else if (inv.IsItemBomb(selectedItemId
) && inv.SingletonItemGetAmmo(selectedItemId) > 0){
BombThrowStart();
} else {
DrainStamina(11, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
UsableItemStart();
}
}
if (!allSteps){
break;
}
case 0:
if (!(W3PlayerWitcher)this || !IsInCombatActionF
riendly() && GetBIsCombatActionAllowed() || !!GetBIsCombatActionAllowed() && Get
BehaviorVariable('combatActionType', /* NOP */) == 0 || GetBehaviorVariable('com
batActionType', /* NOP */) == 6){
if (inv.IsItemCrossbow(selectedItemId)){
rangedWeapon.OnRangedWeaponRelea
se();
} else if (inv.IsItemBomb(selectedItemId
)){
BombThrowRelease();
} else {
UsableItemRelease();
}
}
break;
default:
actionResult = false;
break;
}
break;
case 6:
switch(stage){
case 0:
theGame.GetBehTreeReactionManager().CreateReacti
onEvent(this, 'PlayerEvade', 1.000000, 10.000000, -1.000000, -1, /* NOP */, /* N
OP */);
thePlayer.BreakPheromoneEffect();
actionResult = OnPerformEvade(1);
break;
default:
actionResult = false;
break;
}
break;
case 9:
if (IsCiri()){
return false;
}
switch(stage){
case 0:
theGame.GetBehTreeReactionManager().CreateReacti
onEvent(this, 'PlayerEvade', 1.000000, 10.000000, -1.000000, -1, /* NOP */, /* N
OP */);

thePlayer.BreakPheromoneEffect();
actionResult = OnPerformEvade(0);
break;
case 1:
if (GetBehaviorVariable('combatActionType', /* N
OP */) == 2.000000){
if (GetCurrentStateName() == 'CombatStee
l' || GetCurrentStateName() == 'CombatSilver'){
actionResult = OnPerformEvade(2)
;
} else {
actionResult = OnPerformEvade(0)
;
}
} else if (GetCurrentStateName() == 'CombatSteel
' || GetCurrentStateName() == 'CombatSilver'){
actionResult = OnPerformEvade(1);
actionResult = OnPerformEvade(2);
} else {
actionResult = OnPerformEvade(1);
actionResult = OnPerformEvade(0);
}
break;
default:
actionResult = false;
break;
}
break;
case 14:
switch(stage){
case 1:
if (!IsActionAllowed(1)){
thePlayer.DisplayActionDisallowedHudMess
age(1, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
actionResult = false;
break;
}
if (GetWitcherPlayer().IsItemEquippedByCategoryN
ame('steelsword')){
OnEquipMeleeWeapon(1, false, true);
}
actionResult = false;
break;
default:
actionResult = false;
break;
}
break;
case 15:
switch(stage){
case 1:
if (!IsActionAllowed(1)){
thePlayer.DisplayActionDisallowedHudMess
age(1, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
actionResult = false;
break;
}
if (GetWitcherPlayer().IsItemEquippedByCategoryN
ame('silversword')){
OnEquipMeleeWeapon(2, false, true);

}
actionResult = false;
break;
default:
actionResult = false;
break;
}
break;
case 16:
switch(stage){
case 1:
if (GetCurrentMeleeWeaponType() == 2){
if (GetWitcherPlayer().IsItemEquippedByC
ategoryName('silversword')){
OnEquipMeleeWeapon(2, false, tru
e);
}
} else if (GetCurrentMeleeWeaponType() == 1){
if (GetWitcherPlayer().IsItemEquippedByC
ategoryName('steelsword')){
OnEquipMeleeWeapon(1, false, tru
e);
}
}
actionResult = false;
break;
default:
actionResult = false;
break;
}
break;
default:
return false;
}
CleanCombatActionBuffer();
if (actionResult){
SetCombatAction(action);
if (GetWitcherPlayer().IsInFrenzy()){
GetWitcherPlayer().SkillFrenzyFinish(0, /* NOP *
/);
}
}
return true;
/* NOP */;
}
public function CleanCombatActionBuffer(){
BufferCombatAction = 0;
BufferAllSteps = false;
/* NOP */;
}
public function CancelHoldAttacks(){
thePlayer.RemoveTimer('IsSpecialLightAttackInputHeld', /* NOP */
);
thePlayer.RemoveTimer('IsSpecialHeavyAttackInputHeld', /* NOP */
);
thePlayer.RemoveTimer('SpecialAttackLightSustainCost', /* NOP */
);
thePlayer.RemoveTimer('SpecialAttackHeavySustainCost', /* NOP */
);
thePlayer.RemoveTimer('UpdateSpecialAttackLightHeading', /* NOP

*/);
thePlayer.UnblockAction(33, 'SpecialAttack');
if (thePlayer.GetBehaviorVariable('combatActionType', /* NOP */)
== 1){
if (thePlayer.GetBehaviorVariable('playerAttackType', /*
NOP */) == 0 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack', /* N
OP */) == 1.000000){
thePlayer.SetAttackActionName(SkillEnumToName(16
));
thePlayer.PushCombatActionOnBuffer(7, 0, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
(W3PlayerWitcherStateCombatFists)GetState('Comba
t').ResetTimeToEndCombat();
} else if (thePlayer.GetBehaviorVariable('playerAttackTy
pe', /* NOP */) == 1 && thePlayer.GetBehaviorVariable('isPerformingSpecialAttack
', /* NOP */) == 1.000000){
thePlayer.SetAttackActionName(SkillEnumToName(17
));
thePlayer.PushCombatActionOnBuffer(8, 0, /* NOP
*/);
thePlayer.ProcessCombatActionBuffer();
}
}
/* NOP */;
}
public function RaiseAttackFriendlyEvent(actor : CActor) : Bool{
var playerToTargetHeading : Float;
if (actor && RaiseCombatActionFriendlyEvent()){
SetBehaviorVariable('tauntTypeForOverlay', 0.000000, /*
NOP */);
SetBehaviorVariable('combatActionTypeForOverlay', 0, /*
NOP */);
if (actor){
actor.SignalGameplayEvent('PersonalTauntAction')
;
}
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(this, 'TauntAction', -1.000000, 4.500000, -1, 9999, true, /* NOP */, /
* NOP */);
OnCombatActionStart();
playerToTargetHeading = VecHeading(actor.GetWorldPositio
n() - GetWorldPosition());
SetCustomRotation('Attack', playerToTargetHeading, 0.000
000, 0.300000, false);
return true;
}
return false;
/* NOP */;
}
public function SendAttackReactionEvent(){
var reactionName : CName;
reactionName = 'AttackAction';
if (IsNameValid(reactionName)){
theGame.GetBehTreeReactionManager().CreateReactionEventI
fPossible(this, reactionName, -1.000000, 8.000000, -1, 5, true, /* NOP */, /* NO
P */);
}
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(this, 'outOfMyWay', -1.000000, 2.000000, -1, 5, true, /* NOP */, /* NOP */);

/* NOP */;
}
public function SetForceCanAttackWhenNotInCombat(forceMode : Int32){
forceCanAttackWhenNotInCombat = forceMode;
/* NOP */;
}
public function CanAttackWhenNotInCombat(actionType : EBufferActionType,
altCast : Bool, newTarget : CActor, target : CGameplayEntity) : Bool{
var localTargets : array<CActor>;
var i : Int32;
var size : Int32;
var inputHeading : Float;
var clearanceMin : Float;
var clearanceMax : Float;
var attackLength : Float;
var attackAngle : Float;
var npc : CNewNPC;
var canAttackTarget : CGameplayEntity;
var canAttackTargetActor : CActor;
if (target){
canAttackTarget = target;
} else if (displayTarget && IsDisplayTargetTargetable()){
canAttackTarget = displayTarget;
} else {
canAttackTarget = slideTarget;
}
canAttackTargetActor = (CActor)canAttackTarget;
if (forceCanAttackWhenNotInCombat == 2){
return true;
} else if (forceCanAttackWhenNotInCombat == 1 && !canAttackTarge
t || !canAttackTargetActor.IsHuman()){
return true;
}
if (actionType == 3){
if (thePlayer.GetEquippedSign() != 3 && thePlayer.GetEqu
ippedSign() != 4){
if (CanUseSkill(56)){
if (thePlayer.GetEquippedSign() == 0){
attackLength = 6.000000;
} else if (thePlayer.GetEquippedSign() =
= 2){
attackLength = 4.000000;
} else {
attackLength = 6.000000;
}
} else if (thePlayer.GetEquippedSign() == 0){
attackLength = 9.000000;
} else if (thePlayer.GetEquippedSign() == 2){
attackLength = 6.000000;
} else {
attackLength = 6.000000;
}
if (altCast){
attackAngle = 180.000000;
} else {
attackAngle = 90.000000;
}
if (!lastAxisInputIsMovement){
inputHeading = VecHeading(theCamera.GetC
ameraDirection());

} else if (lAxisReleasedAfterCounter){
inputHeading = GetHeading();
} else {
inputHeading = GetCombatActionHeading();
}
clearanceMin = 1.000000;
clearanceMax = attackLength + 1.000000;
} else if (thePlayer.GetEquippedSign() == 4){
npc = (CNewNPC)canAttackTarget;
if (npc && npc.GetNPCType() == 2 && !npc.HasTag(
theGame.params.TAG_AXIIABLE_LOWER_CASE) && !npc.HasTag(theGame.params.TAG_AXIIAB
LE)){
return false;
} else if (npc && npc.IsUsingHorse(/* NOP */)){
return false;
} else {
return true;
}
} else {
return true;
}
} else if (actionType == 4){
attackLength = theGame.params.MAX_THROW_RANGE;
attackAngle = 90.000000;
if (thePlayer.lastAxisInputIsMovement){
inputHeading = GetCombatActionHeading();
} else {
inputHeading = VecHeading(theCamera.GetCameraDir
ection());
}
clearanceMin = 0.800000;
clearanceMax = attackLength + 3.000000;
} else {
if (actionType == 7 || actionType == 8){
attackLength = 1.900000;
attackAngle = 90.000000;
} else {
if (thePlayer.GetCurrentMeleeWeaponType() == 3 |
| thePlayer.GetCurrentMeleeWeaponType() == 0){
attackLength = 1.200000;
} else {
attackLength = 1.900000;
}
attackAngle = 90.000000;
}
if (lastAxisInputIsMovement){
inputHeading = GetCombatActionHeading();
} else {
inputHeading = VecHeading(theCamera.GetCameraDir
ection());
}
clearanceMin = attackLength / 2.000000;
clearanceMax = attackLength + 3.000000;
}
if (canAttackTarget){
if (canAttackTargetActor && canAttackTargetActor.IsHuman
() || canAttackTargetActor.HasTag('softLock_Friendly')){
if (ShouldPerformFriendlyAction(canAttackTargetA
ctor, inputHeading, attackAngle, clearanceMin, clearanceMax)){
SetSlideTarget(canAttackTargetActor);

newTarget = canAttackTargetActor;
return false;
}
}
}
return true;
thePlayer.GetVisibleEnemies(localTargets);
size = localTargets.Size();
if (size > 0){
i = size - 1;
while (i >= 0){
if (!localTargets[i].IsHuman() && !localTargets[
i].HasTag('softLock_Friendly')){
localTargets.Erase(i);
}
i -= 1;
}
}
size = localTargets.Size();
if (size > 0){
i = 0;
while (i < localTargets.Size()){
if (ShouldPerformFriendlyAction(localTargets[i],
inputHeading, attackAngle, clearanceMin, clearanceMax)){
SetSlideTarget(localTargets[i]);
newTarget = localTargets[i];
return false;
}
i += 1;
}
}
newTarget = NULL;
return true;
/* NOP */;
}
private function ShouldPerformFriendlyAction(actor : CActor, inputHeadin
g : Float, attackAngle : Float, clearanceMin : Float, clearanceMax : Float) : Bo
ol{
var npc : CNewNPC;
var argh : Float;
var playerToTargetDist : Float;
npc = (CNewNPC)actor;
if (npc && GetAttitudeBetween(thePlayer, npc) == 2 || GetAttitud
eBetween(thePlayer, npc) == 1 && npc.GetNPCType() != 3){
} else {
playerToTargetDist = VecDistance(GetWorldPosition(), act
or.PredictWorldPosition(0.500000));
argh = AbsF(AngleDistance(inputHeading, VecHeading(actor
.GetWorldPosition() - thePlayer.GetWorldPosition())));
if (AbsF(AngleDistance(inputHeading, VecHeading(actor.Ge
tWorldPosition() - thePlayer.GetWorldPosition()))) < attackAngle){
if (playerToTargetDist < clearanceMax){
return true;
}
} else if (playerToTargetDist < clearanceMin){
return true;
}
}
return false;
/* NOP */;

}
public function GetHudMessagesSize() : Int32{
return HudMessages.Size();
/* NOP */;
}
public function GetHudPendingMessage() : String{
return HudMessages[0];
/* NOP */;
}
public function DisplayHudMessage(value : String){
if (value == ""){
return;
}
if (GetHudMessagesSize() > 0){
if (HudMessages[HudMessages.Size() - 1] == value){
return;
}
}
HudMessages.PushBack(value);
/* NOP */;
}
private final function DisallowedActionDontShowHack(action : EInputActio
nBlock) : Bool{
var locks : array<SInputActionLock>;
var i : Int32;
if (action == 8 || action == 24 || action == 0 || action == 30 |
| action == 31 || action == 44 || action == 45 && HasBuff(13) || HasBuff(46)){
return true;
}
if (action == 46){
return false;
}
locks = GetActionLocks(action);
i = 0;
while (i < locks.Size()){
if (locks[i].isFromQuest || locks[i].isFromPlace){
return false;
}
i += 1;
}
if (IsCurrentlyUsingItemL()){
if (action == 31 || action == 25){
return false;
}
}
return true;
/* NOP */;
}
public final function DisplayActionDisallowedHudMessage(action : EInputA
ctionBlock, isCombatLock : Bool, isPlaceLock : Bool, isTimeLock : Bool, isDanger
ous : Bool){
var lockType : CName;
if (action != 28 && DisallowedActionDontShowHack(action)){
return;
}
if (IsInCombat() && !IsActionCombat(action)){
isCombatLock = true;
}
if (!isCombatLock && !isPlaceLock && !isTimeLock && action != 28
){

lockType = inputHandler.GetActionBlockedHudLockType(acti
on);
if (lockType == 'combat'){
isCombatLock = true;
} else if (lockType == 'place'){
isPlaceLock = true;
} else if (lockType == 'time'){
isTimeLock = true;
}
}
if (isDangerous){
DisplayHudMessage(GetLocStringByKeyExt("message_meditati
on_too_dangerous"));
} else if (isCombatLock){
DisplayHudMessage(GetLocStringByKeyExt("panel_hud_messag
e_actionnotallowed_combat"));
} else if (isPlaceLock){
DisplayHudMessage(GetLocStringByKeyExt("menu_cannot_perf
orm_action_here"));
} else if (isTimeLock){
DisplayHudMessage(GetLocStringByKeyExt("menu_cannot_perf
orm_action_now"));
}
/* NOP */;
}
public function RemoveHudMessageByString(msg : String, allQueuedInstance
s : Bool){
var i : Int32;
var j : Int32;
i = 0;
while (i < HudMessages.Size()){
if (HudMessages[i] == msg){
HudMessages.EraseFast(i);
if (!allQueuedInstances){
return;
}
break;
}
i += 1;
}
j = HudMessages.Size() - 1;
while (j >= i){
if (HudMessages[i] == msg){
HudMessages.EraseFast(i);
}
j -= 1;
}
/* NOP */;
}
public function RemoveHudMessageByIndex(idx : Int32){
if (idx >= 0 && idx < HudMessages.Size()){
HudMessages.Erase(idx);
}
/* NOP */;
}
public function SetSettlementBlockCanter(valueAdd : Int32){
m_SettlementBlockCanter += valueAdd;
/* NOP */;
}
public function DisplayRaceStart(countDownSecondsNumber : Int32){

var i : Int32;
countDownToStart = countDownSecondsNumber;
i = countDownSecondsNumber;
while (i > 0){
DisplayHudMessage(IntToString(i));
i -= 1;
}
DisplayHudMessage(GetLocStringByKeyExt("panel_hud_message_race_s
tart"));
AddTimer('RaceCountdown', 1, true, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
/* NOP */;
}
public timer function RaceCountdown(optional dt : Float, optional id : I
nt32){
var hud : CR4ScriptedHud;
var messageModule : CR4HudModuleMessage;
countDownToStart -= 1;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
messageModule = (CR4HudModuleMessage)hud.GetHudModule("M
essageModule");
if (messageModule){
messageModule.OnMessageHidden();
}
}
if (countDownToStart <= 0){
RemoveTimer('RaceCountdown', /* NOP */);
}
/* NOP */;
}
public function GetCountDownToStart() : Int32{
return countDownToStart;
/* NOP */;
}
public function HAXE3GetContainer() : W3Container{
return HAXE3Container;
/* NOP */;
}
public function HAXE3SetContainer(container : W3Container){
HAXE3Container = container;
/* NOP */;
}
public function HAXE3GetAutoLoot() : Bool{
return HAXE3bAutoLoot;
/* NOP */;
}
public function HAXE3SetAutoLoot(value : Bool){
HAXE3bAutoLoot = value;
/* NOP */;
}
public function GetShowHud() : Bool{
return bShowHud;
/* NOP */;
}
public function SetShowHud(value : Bool){
bShowHud = value;
/* NOP */;
}
public function DisplayItemRewardNotification(itemName : CName, quantity

: Int32){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
hud.OnItemRecivedDuringScene(itemName, quantity);
/* NOP */;
}
public function IsNewQuest(questGuid : CGUID) : Bool{
var i : Int32;
i = 0;
while (i < displayedQuestsGUID.Size()){
if (displayedQuestsGUID[i] == questGuid){
return false;
}
i += 1;
}
displayedQuestsGUID.PushBack(questGuid);
return true;
/* NOP */;
}
public function GetRewardMultiplier(rewardName : CName) : Float{
var i : Int32;
i = 0;
while (i < rewardsMultiplier.Size()){
if (rewardsMultiplier[i].rewardName == rewardName){
return rewardsMultiplier[i].rewardMultiplier;
}
i += 1;
}
return 1.000000;
/* NOP */;
}
public function GetRewardMultiplierExists(rewardName : CName) : Bool{
var i : Int32;
i = 0;
while (i < rewardsMultiplier.Size()){
if (rewardsMultiplier[i].rewardName == rewardName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function SetRewardMultiplier(rewardName : CName, value : Float){
var i : Int32;
var rewardMultiplier : SRewardMultiplier;
i = 0;
while (i < rewardsMultiplier.Size()){
if (rewardsMultiplier[i].rewardName == rewardName){
rewardsMultiplier[i].rewardMultiplier = value;
return;
}
i += 1;
}
rewardMultiplier.rewardName = rewardName;
rewardMultiplier.rewardMultiplier = value;
rewardsMultiplier.PushBack(rewardMultiplier);
/* NOP */;
}
public function RemoveRewardMultiplier(rewardName : CName){

var i : Int32;
i = 0;
while (i < rewardsMultiplier.Size()){
if (rewardsMultiplier[i].rewardName == rewardName){
rewardsMultiplier.Erase(i);
return;
}
i += 1;
}
/* NOP */;
}
public final function GetCurrentOilAmmo(id : SItemUniqueId) : Int32{
return inv.GetItemModifierInt(id, 'oil_charges', /* NOP */);
/* NOP */;
}
public final function GetMaxOilAmmo(id : SItemUniqueId) : Int32{
return inv.GetItemModifierInt(id, 'oil_max_charges', /* NOP */);
/* NOP */;
}
public final function ReduceOilAmmo(id : SItemUniqueId, ammo : Int32){
var currentAmmo : Int32;
if (ammo == 0){
ammo = 1;
}
currentAmmo = GetCurrentOilAmmo(id);
if (currentAmmo > 0){
currentAmmo = Max(currentAmmo - ammo, 0);
inv.SetItemModifierInt(id, 'oil_charges', currentAmmo);
if (currentAmmo == 0){
RemoveItemOil(id);
if (ShouldProcessTutorial('TutorialAlchemyRefill
') && FactsQuerySum("q001_nightmare_ended") > 0 && GetWitcherPlayer()){
FactsAdd('tut_alch_refill', 1, /* NOP */
);
}
}
}
theGame.GetGlobalEventsManager().OnScriptedEvent(3, /* NOP */, /
* NOP */);
/* NOP */;
}
public function RemoveItemOil(id : SItemUniqueId){
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var abilities : array<CName>;
var sword : CWitcherSword;
dm = theGame.GetDefinitionsManager();
inv.GetItemAbilities(id, abilities);
i = 0;
while (i < abilities.Size()){
if (dm.AbilityHasTag(abilities[i], theGame.params.OIL_AB
ILITY_TAG)){
inv.RemoveItemCraftedAbility(id, abilities[i]);
}
i += 1;
}
inv.SetItemModifierInt(id, 'oil_charges', -1);
inv.SetItemModifierInt(id, 'oil_max_charges', -1);
sword = (CWitcherSword)inv.GetItemEntityUnsafe(id);
sword.RemoveOil();

theGame.GetGlobalEventsManager().OnScriptedEvent(3, /* NOP */, /


* NOP */);
/* NOP */;
}
public function SkillReduceBombAmmoBonus(){
var i : Int32;
var ammo : Int32;
var maxAmmo : Int32;
var items : array<SItemUniqueId>;
items = inv.GetSingletonItems();
i = 0;
while (i < items.Size()){
ammo = inv.GetItemModifierInt(items[i], 'ammo_current',
/* NOP */);
if (ammo > 0){
maxAmmo = inv.SingletonItemGetMaxAmmo(items[i]);
if (ammo > maxAmmo){
inv.SetItemModifierInt(items[i], 'ammo_c
urrent', maxAmmo);
}
}
i += 1;
}
theGame.GetGlobalEventsManager().OnScriptedEvent(4, /* NOP */, /
* NOP */);
/* NOP */;
}
public function ConsumeItem(itemId : SItemUniqueId) : Bool{
var params : SCustomEffectParams;
var buffs : array<SEffectInfo>;
var i : Int32;
var category : CName;
var potionToxicity : Float;
if (!inv.IsIdValid(itemId)){
return false;
}
category = inv.GetItemCategory(itemId);
if (category == 'edibles' || inv.ItemHasTag(itemId, 'Drinks') ||
category == 'alchemy_ingredient' && inv.ItemHasTag(itemId, 'Alcohol')){
if (IsFistFightMinigameEnabled()){
super.DisplayActionDisallowedHudMessage(28, fals
e, false, true, /* NOP */);
return false;
}
inv.GetItemBuffs(itemId, buffs);
i = 0;
while (i < buffs.Size()){
params.effectType = buffs[i].effectType;
params.creator = this;
params.sourceName = "edible";
params.customAbilityName = buffs[i].effectAbilit
yName;
AddEffectCustom(params);
i += 1;
}
if (inv.ItemHasTag(itemId, 'Alcohol')){
potionToxicity = CalculateAttributeValue(inv.Get
ItemAttributeValue(itemId, 'toxicity', /* NOP */, /* NOP */), /* NOP */);
abilityManager.GainStat(3, potionToxicity);
AddEffectDefault(107, NULL, inv.GetItemName(item

Id), /* NOP */);


}
PlayItemConsumeSound(itemId);
}
if (inv.IsItemFood(itemId)){
FactsAdd("consumed_food_cnt", /* NOP */, /* NOP */);
}
if (!inv.RemoveItem(itemId, /* NOP */)){
LogAssert(false, "Failed to remove consumable item from
player inventory!" + inv.GetItemName(itemId));
return false;
}
return true;
/* NOP */;
}
public function MountVehicle(vehicleEntity : CEntity, mountType : EVehic
leMountType, vehicleSlot : EVehicleSlot){
var vehicle : CVehicleComponent;
vehicle = (CVehicleComponent)vehicleEntity.GetComponentByClassNa
me('CVehicleComponent');
if (vehicle){
vehicle.Mount(this, mountType, vehicleSlot);
}
/* NOP */;
}
public function DismountVehicle(vehicleEntity : CEntity, dismountType :
EDismountType){
var vehicle : CVehicleComponent;
vehicle = (CVehicleComponent)vehicleEntity.GetComponentByClassNa
me('CVehicleComponent');
if (vehicle){
vehicle.IssueCommandToDismount(dismountType);
}
/* NOP */;
}
public function HasStaminaToUseAction(action : EStaminaActionType, abili
tyName : CName, dt : Float, multiplier : Float) : Bool{
var cost : Float;
var ret : Bool;
ret = super.HasStaminaToUseAction(action, abilityName, dt, multi
plier);
if (!ret){
SetCombatActionHeading(GetHeading());
if (multiplier == 0){
multiplier = 1;
}
cost = multiplier * GetStaminaActionCost(action, ability
Name, dt);
SetShowToLowStaminaIndication(cost);
}
return ret;
/* NOP */;
}
public timer function AbilityManager_FloorStaminaSegment(optional dt : F
loat, optional id : Int32){
(W3PlayerAbilityManager)abilityManager.FloorStaminaSegment();
/* NOP */;
}
public function DrainToxicity(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && IsAlive(

)){
abilityManager.DrainToxicity(amount);
}
/* NOP */;
}
public function DrainFocus(amount : Float){
if (abilityManager && abilityManager.IsInitialized() && IsAlive(
)){
abilityManager.DrainFocus(amount);
}
/* NOP */;
}
public function GetOffenseStat() : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetOffense
Stat();
}
return 0;
/* NOP */;
}
public function GetDefenseStat() : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetDefense
Stat();
}
return 0;
/* NOP */;
}
public function GetSignsStat() : Float{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSignsSt
at();
}
return 0;
/* NOP */;
}
public function OnOceanTriggerEnter() : Bool{
inWaterTrigger = true;
/* NOP */;
}
public function OnOceanTriggerLeave() : Bool{
inWaterTrigger = false;
/* NOP */;
}
public function IsInWaterTrigger() : Bool{
return inWaterTrigger;
/* NOP */;
}
public function GetSkillColor(skill : ESkill) : ESkillColor{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillCo
lor(skill);
}
return 0;
/* NOP */;
}
public function GetSkillSlotIndexFromSkill(skill : ESkill) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
otIndexFromSkill(skill);

}
return -1;
/* NOP */;
}
public final function GetSkillSlotIndex(slotID : Int32, checkIfUnlocked
: Bool) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
otIndex(slotID, checkIfUnlocked);
}
return -1;
/* NOP */;
}
public final function GetSkillSlotIDFromIndex(skillSlotIndex : Int32) :
Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
otIDFromIndex(skillSlotIndex);
}
return -1;
/* NOP */;
}
public function GetSkillSlotID(skill : ESkill) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
otID(skill);
}
return -1;
/* NOP */;
}
public function GetSkillGroupBonus(groupID : Int32) : CName{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetGroupBo
nus(groupID);
}
return 'None';
/* NOP */;
}
public function GetGroupBonusCount(commonColor : ESkillColor, groupID :
Int32) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetGroupBo
nusCount(commonColor, groupID);
}
return 0;
/* NOP */;
}
public function GetMutagenSlotIDFromGroupID(groupID : Int32) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetMutagen
SlotIDFromGroupID(groupID);
}
return -1;
/* NOP */;
}
public function GetSkillLevel(skill : ESkill) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillLe
vel(skill);
}

return -1;
/* NOP */;
}
public function AddSkill(skill : ESkill, isTemporary : Bool){
if (abilityManager && abilityManager.IsInitialized()){
(W3PlayerAbilityManager)abilityManager.AddSkill(skill, i
sTemporary);
}
/* NOP */;
}
public function GetSkillAbilityName(skill : ESkill) : CName{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillAb
ilityName(skill);
}
return 'None';
/* NOP */;
}
public function HasStaminaToUseSkill(skill : ESkill, perSec : Bool, sign
Hack : Bool) : Bool{
var ret : Bool;
var cost : Float;
cost = GetSkillStaminaUseCost(skill, perSec);
ret = CanUseSkill(skill) && abilityManager.GetStat(2, signHack)
>= cost;
if (!ret && IsSkillSign(skill) && CanUseSkill(88) && GetStat(4,
/* NOP */) >= 1){
ret = true;
}
if (!ret){
SetCombatActionHeading(GetHeading());
SetShowToLowStaminaIndication(cost);
}
return ret;
/* NOP */;
}
protected function GetSkillStaminaUseCost(skill : ESkill, perSec : Bool)
: Float{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSt
aminaUseCost(skill, perSec);
}
return 0;
/* NOP */;
}
public function GetSkillAttributeValue(skill : ESkill, attributeName : C
Name, addBaseCharAttribute : Bool, addSkillModsAttribute : Bool) : SAbilityAttri
buteValue{
var null : SAbilityAttributeValue;
if (abilityManager && abilityManager.IsInitialized()){
return abilityManager.GetSkillAttributeValue(SkillEnumTo
Name(skill), attributeName, addBaseCharAttribute, addSkillModsAttribute);
}
return null;
/* NOP */;
}
public function GetSkillLocalisationKeyName(skill : ESkill) : String{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillLo
calisationKeyName(skill);

}
return "";
/* NOP */;
}
public function GetSkillLocalisationKeyDescription(skill : ESkill) : Str
ing{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillLo
calisationKeyDescription(skill, /* NOP */);
}
return "";
/* NOP */;
}
public function GetSkillIconPath(skill : ESkill) : String{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillIc
onPath(skill);
}
return "";
/* NOP */;
}
public function HasLearnedSkill(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.HasLearned
Skill(skill);
}
return false;
/* NOP */;
}
public function IsSkillEquipped(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.IsSkillEqu
ipped(skill);
}
return false;
/* NOP */;
}
public function CanUseSkill(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.CanUseSkil
l(skill);
}
return false;
/* NOP */;
}
public function CanLearnSkill(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.CanLearnSk
ill(skill);
}
return false;
/* NOP */;
}
public function HasSpentEnoughPoints(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.HasSpentEn
oughPoints(skill);
}
return false;
/* NOP */;

}
public function PathPointsForSkillsPath(skill : ESkill) : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.PathPoints
SpentInSkillPathOfSkill(skill);
}
return -1;
/* NOP */;
}
public function GetPlayerSkills() : array<SSkill>{
var null : array<SSkill>;
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetPlayerS
kills();
}
return null;
/* NOP */;
}
public function GetPlayerSkill(s : ESkill) : SSkill{
var null : SSkill;
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetPlayerS
kill(s);
}
return null;
/* NOP */;
}
public function GetSkillSubPathType(s : ESkill) : ESkillSubPath{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSu
bPathType(s);
}
return 0;
/* NOP */;
}
public function GetSkillSlotsCount() : Int32{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
otsCount();
}
return 0;
/* NOP */;
}
public function GetSkillSlots() : array<SSkillSlot>{
var null : array<SSkillSlot>;
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillSl
ots();
}
return null;
/* NOP */;
}
public function GetPlayerSkillMutagens() : array<SMutagenSlot>{
var null : array<SMutagenSlot>;
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetPlayerS
killMutagens();
}
return null;
/* NOP */;

}
public function BlockSkill(skill : ESkill, block : Bool, cooldown : Floa
t) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.BlockSkill
(skill, block, cooldown);
}
return false;
/* NOP */;
}
public function IsSkillBlocked(skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.IsSkillBlo
cked(skill);
}
return false;
/* NOP */;
}
public function EquipSkill(skill : ESkill, slotID : Int32) : Bool{
var ret : Bool;
var groupID : Int32;
var pam : W3PlayerAbilityManager;
if (abilityManager && abilityManager.IsInitialized()){
pam = (W3PlayerAbilityManager)abilityManager;
ret = pam.EquipSkill(skill, slotID);
if (ret){
groupID = pam.GetSkillGroupIdFromSkillSlotId(slo
tID);
LogSkillColors("Equipped <<" + GetSkillColor(ski
ll) + ">> skill <<" + skill + ">> to group <<" + groupID + ">>");
LogSkillColors("Group bonus color is now <<" + p
am.GetSkillGroupColor(groupID) + ">>");
LogSkillColors("");
}
return ret;
}
return false;
/* NOP */;
}
public function UnequipSkill(slotID : Int32) : Bool{
var ret : Bool;
var groupID : Int32;
var skill : ESkill;
var pam : W3PlayerAbilityManager;
if (abilityManager && abilityManager.IsInitialized()){
pam = (W3PlayerAbilityManager)abilityManager;
GetSkillOnSlot(slotID, skill);
ret = pam.UnequipSkill(slotID);
if (ret){
groupID = pam.GetSkillGroupIdFromSkillSlotId(slo
tID);
LogSkillColors("Unequipped <<" + GetSkillColor(s
kill) + ">> skill <<" + skill + ">> from group <<" + groupID + ">>");
LogSkillColors("Group bonus color is now <<" + p
am.GetSkillGroupColor(groupID) + ">>");
LogSkillColors("");
}
return ret;
}
return false;

/* NOP */;
}
public function GetSkillOnSlot(slotID : Int32, skill : ESkill) : Bool{
if (abilityManager && abilityManager.IsInitialized()){
return (W3PlayerAbilityManager)abilityManager.GetSkillOn
Slot(slotID, skill);
}
skill = 0;
return false;
/* NOP */;
}
public function GetFreeSkillSlot() : Int32{
var i : Int32;
var size : Int32;
var skill : ESkill;
size = (W3PlayerAbilityManager)abilityManager.GetSkillSlotsCount
();
i = 1;
while (i < size){
if (!GetSkillOnSlot(i, skill)){
} else if (skill == 0){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
protected function Attack(hitTarget : CGameplayEntity, animData : CPreAt
tackEventData, weaponId : SItemUniqueId, parried : Bool, countered : Bool, parri
edBy : array<CActor>, attackAnimationName : CName, hitTime : Float, weaponEntity
: CItemEntity){
var attackAction : W3Action_Attack;
if (!PrepareAttackAction(hitTarget, animData, weaponId, parried,
countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction)
){
return;
}
if (attackAction.IsParried() && (CNewNPC)attackAction.victim.IsS
hielded(attackAction.attacker) || (CNewNPC)attackAction.victim.SignalGameplayEve
ntReturnInt('IsDefending', 0) == 1){
thePlayer.SetCanPlayHitAnim(true);
thePlayer.ReactToReflectedAttack(attackAction.victim);
}
theTelemetry.LogWithLabel(21, attackAction.GetAttackName());
theGame.damageMgr.ProcessAction(attackAction);
delete attackAction;
/* NOP */;
}
public function IsHeavyAttack(attackName : CName) : Bool{
var skill : ESkill;
var sup : Bool;
sup = super.IsHeavyAttack(attackName);
if (sup){
return true;
}
if (attackName == 'attack_heavy_special'){
return true;
}
skill = SkillNameToEnum(attackName);

return skill == 2 || skill == 17;


/* NOP */;
}
public function IsLightAttack(attackName : CName) : Bool{
var skill : ESkill;
var sup : Bool;
sup = super.IsLightAttack(attackName);
if (sup){
return true;
}
skill = SkillNameToEnum(attackName);
return skill == 1 || skill == 16;
/* NOP */;
}
public final function ProcessWeaponCollision(){
var l_stateName : CName;
var l_weaponPosition : Vector;
var l_weaponTipPos : Vector;
var l_collidingPosition : Vector;
var l_offset : Vector;
var l_normal : Vector;
var l_slotMatrix : Matrix;
var l_distance : Float;
var l_materialName : CName;
var l_hitComponent : CComponent;
var l_destructibleCmp : CDestructionSystemComponent;
var barrel : COilBarrelEntity;
if (isCurrentlyDodging){
return;
}
l_stateName = GetCurrentStateName();
if (!attackEventInProgress && l_stateName == 'CombatFists'){
return;
}
CalcEntitySlotMatrix('r_weapon', l_slotMatrix);
l_weaponPosition = MatrixGetTranslation(l_slotMatrix);
switch(l_stateName){
case 'CombatFists':
l_offset = MatrixGetAxisX(l_slotMatrix);
l_offset = VecNormalize(l_offset) * 0.250000;
break;
default:
l_offset = MatrixGetAxisZ(l_slotMatrix);
l_offset = VecNormalize(l_offset) * 1.000000;
break;
}
l_weaponTipPos = l_weaponPosition + l_offset;
if (!attackEventInProgress){
if (m_LastWeaponTipPos == Vector(0, 0, 0)){
l_distance = 0;
} else {
l_distance = VecDistance(l_weaponTipPos, m_LastW
eaponTipPos);
}
m_LastWeaponTipPos = l_weaponTipPos;
if (l_distance < 0.350000){
return;
}
}
m_LastWeaponTipPos = l_weaponTipPos;

if (!theGame.GetWorld().StaticTraceWithAdditionalInfo(l_weaponPo
sition, l_weaponTipPos, l_collidingPosition, l_normal, l_materialName, l_hitComp
onent, m_WeaponFXCollisionGroupNames)){
if (l_stateName == 'CombatFists'){
CalcEntitySlotMatrix('l_weapon', l_slotMatrix);
l_weaponPosition = MatrixGetTranslation(l_slotMa
trix);
l_offset = MatrixGetAxisX(l_slotMatrix);
l_offset = VecNormalize(l_offset) * 0.250000;
l_weaponTipPos = l_weaponPosition + l_offset;
if (!theGame.GetWorld().StaticTrace(l_weaponPosi
tion, l_weaponTipPos, l_collidingPosition, l_normal, m_WeaponFXCollisionGroupNam
es)){
return;
}
} else {
return;
}
}
if (!m_CollisionEffect){
m_CollisionEffect = theGame.CreateEntity(m_CollisionFxTe
mplate, l_collidingPosition, EulerAngles(0, 0, 0), /* NOP */, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
m_CollisionEffect.Teleport(l_collidingPosition);
switch(l_stateName){
case 'CombatFists':
m_CollisionEffect.PlayEffect('fist', /* NOP */);
break;
default:
if (m_RefreshWeaponFXType){
m_PlayWoodenFX = IsSwordWooden();
m_RefreshWeaponFXType = false;
}
if (m_PlayWoodenFX){
m_CollisionEffect.PlayEffect('wood', /* NOP */);
} else {
switch(l_materialName){
case 'wood_hollow':
case 'wood_debris':
case 'wood_solid':
m_CollisionEffect.PlayEffect('wood', /*
NOP */);
break;
case 'dirt_hard':
case 'dirt_soil':
case 'hay':
m_CollisionEffect.PlayEffect('fist', /*
NOP */);
break;
case 'stone_debris':
case 'stone_solid':
case 'clay_tile':
case 'gravel_large':
case 'gravel_small':
case 'metal':
case 'custom_sword':
m_CollisionEffect.PlayEffect('sparks', /
* NOP */);
break;

default:
m_CollisionEffect.PlayEffect('wood', /*
NOP */);
break;
}
}
break;
}
if (l_hitComponent){
barrel = (COilBarrelEntity)l_hitComponent.GetEntity();
if (barrel){
barrel.OnFireHit(NULL);
return;
}
}
l_destructibleCmp = (CDestructionSystemComponent)l_hitComponent;
if (l_destructibleCmp && l_stateName != 'CombatFists'){
l_destructibleCmp.ApplyFracture();
}
/* NOP */;
}
public function ReactToReflectedAttack(target : CGameplayEntity){
var hp : Float;
var dmg : Float;
var action : W3DamageAction;
super.ReactToReflectedAttack(target);
if (!(CNewNPC)target.IsShielded(this)){
action = new W3DamageAction in this;
action.Initialize(target, this, NULL, 'None', 4, 0, true
, false, false, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddEffectInfo(13, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
action.SetProcessBuffsIfNoDamage(true);
theGame.damageMgr.ProcessAction(action);
delete action;
}
theGame.VibrateControllerLight(/* NOP */);
/* NOP */;
}
public function GetFallDist(fallDist : Float) : Bool{
var fallDiff : Float;
var jumpTotalDiff : Float;
substateManager.m_SharedDataO.CalculateFallingHeights(fallDiff,
jumpTotalDiff);
if (fallDiff <= 0){
return false;
}
fallDist = fallDiff;
return true;
/* NOP */;
}
public function ApplyFallingDamage(heightDiff : Float, reducing : Bool)
: Float{
var hpPerc : Float;
if (IsSwimming()){
return 0.000000;
}
hpPerc = super.ApplyFallingDamage(heightDiff, reducing);
if (hpPerc > 0){
theGame.VibrateControllerHard(/* NOP */);

if (ShouldProcessTutorial('TutorialFallingDamage')){
FactsAdd("tutorial_falling_damage", /* NOP */, /
* NOP */);
}
}
return hpPerc;
/* NOP */;
}
public function SetShowToLowStaminaIndication(value : Float){
fShowToLowStaminaIndication = value;
/* NOP */;
}
public function GetShowToLowStaminaIndication() : Float{
return fShowToLowStaminaIndication;
/* NOP */;
}
public final function IndicateTooLowAdrenaline(){
SoundEvent("gui_no_adrenaline", /* NOP */, /* NOP */);
showTooLowAdrenaline = true;
/* NOP */;
}
protected function GotoCombatStateWithAction(initialAction : EInitialAct
ion, initialBuff : CBaseGameplayEffect){
if (GetCurrentActionType() == 128){
ActionCancelAll();
}
(W3PlayerWitcherStateCombatFists)GetState('CombatFists').SetupSt
ate(initialAction, initialBuff);
GotoState('CombatFists', /* NOP */, /* NOP */);
/* NOP */;
}
public function IsThreat(actor : CActor, usePrecalcs : Bool) : Bool{
var npc : CNewNPC;
var dist : Float;
var targetCapsuleHeight : Float;
var isDistanceExpanded : Bool;
var distanceToTarget : Float;
var attitude : EAIAttitude;
if (!actor){
return false;
}
if (finishableEnemiesList.Contains(actor)){
return true;
}
if (!actor.IsAlive() || actor.IsKnockedUnconscious()){
return false;
}
npc = (CNewNPC)actor;
if (npc && npc.IsHorse()){
return false;
}
if (hostileEnemies.Contains(actor)){
return true;
}
if (GetAttitudeBetween(this, actor) == 2){
if (usePrecalcs){
distanceToTarget = Distance2DBetweenCapsuleAndPo
int(actor, this) - targetingPrecalcs.playerRadius;
} else {
distanceToTarget = Distance2DBetweenCapsules(thi

s, actor);
}
if (distanceToTarget < findMoveTargetDist + 5.000000){
return true;
}
if (actor.IsInCombat() || IsHardLockEnabled()){
targetCapsuleHeight = (CMovingPhysicalAgentCompo
nent)actor.GetMovingAgentComponent().GetCapsuleHeight();
if (targetCapsuleHeight >= 2.000000 || npc.GetCu
rrentStance() == 5){
if (distanceToTarget < 40.000000){
return true;
}
}
}
}
if (actor.GetAttitudeGroup() == 'npc_charmed'){
if (theGame.GetGlobalAttitude(GetBaseAttitudeGroup(), ac
tor.GetBaseAttitudeGroup()) == 2){
return true;
}
}
return false;
/* NOP */;
}
public function SetBIsCombatActionAllowed(flag : Bool){
bIsCombatActionAllowed = flag;
if (!flag){
SetBIsInCombatAction(true);
} else {
ProcessLAxisCaching();
}
/* NOP */;
}
public function GetBIsCombatActionAllowed() : Bool{
return bIsCombatActionAllowed;
/* NOP */;
}
public function SetCombatAction(action : EBufferActionType){
currentCombatAction = action;
/* NOP */;
}
public function GetCombatAction() : EBufferActionType{
return currentCombatAction;
/* NOP */;
}
protected function WhenCombatActionIsFinished(){
if (IsThrowingItem() || IsThrowingItemWithAim()){
if (inv.IsItemBomb(selectedItemId)){
BombThrowAbort();
} else {
ThrowingAbort();
}
}
if (GetCurrentStateName() != 'DismountHorse'){
OnRangedForceHolster(true, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function IsInCombatAction_Attack() : Bool{

if (IsInCombatAction() && GetCombatAction() == 1 || GetCombatAct


ion() == 2){
return true;
} else {
return false;
}
/* NOP */;
}
public function IsInSpecificCombatAction(specificCombatAction : EBufferA
ctionType) : Bool{
if (IsInCombatAction() && GetCombatAction() == specificCombatAct
ion){
return true;
} else {
return false;
}
/* NOP */;
}
public function IsInRunAnimation() : Bool{
return isInRunAnimation;
/* NOP */;
}
public function SetCombatIdleStance(stance : Float){
SetBehaviorVariable('combatIdleStance', stance, /* NOP */);
SetBehaviorVariable('CombatStanceForOverlay', stance, /* NOP */)
;
if (stance == 0.000000){
/* NOP */;
} else {
/* NOP */;
}
/* NOP */;
}
public function GetCombatIdleStance() : Float{
return GetBehaviorVariable('combatIdleStance', /* NOP */);
/* NOP */;
}
public function OnRotateInPlaceStart() : Bool{
isRotatingInPlace = true;
/* NOP */;
}
public function OnRotateInPlaceEnd() : Bool{
isRotatingInPlace = false;
/* NOP */;
}
public function OnFullyBlendedIdle() : Bool{
if (bLAxisReleased){
ResetRawPlayerHeading();
ResetCachedRawPlayerHeading();
defaultLocomotionController.ResetMoveDirection();
}
/* NOP */;
}
public function OnRunLoopStart() : Bool{
EnableRunCamera(true);
/* NOP */;
}
public function OnRunLoopEnd() : Bool{
EnableRunCamera(false);
/* NOP */;

}
public function OnCombatActionStartBehgraph() : Bool{
var buff : CBaseGameplayEffect;
var action : EBufferActionType;
var cost : Float;
var delay : Float;
OnCombatActionStart();
buff = GetBuff(2, /* NOP */);
action = PerformingCombatAction();
switch(action){
case 1:
abilityManager.GetStaminaActionCost(1, cost, delay, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 2:
abilityManager.GetStaminaActionCost(2, cost, delay, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 4:
abilityManager.GetStaminaActionCost(11, cost, delay, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 5:
abilityManager.GetStaminaActionCost(4, cost, delay, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 6:
abilityManager.GetStaminaActionCost(6, cost, delay, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 9:
abilityManager.GetStaminaActionCost(14, cost, delay, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
case 7:
abilityManager.GetStaminaActionCost(12, cost, delay, 0,
0, GetSkillAbilityName(16), /* NOP */, /* NOP */);
break;
case 8:
abilityManager.GetStaminaActionCost(12, cost, delay, 0,
0, GetSkillAbilityName(17), /* NOP */, /* NOP */);
break;
case 9:
abilityManager.GetStaminaActionCost(7, cost, delay, /* N
OP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
break;
default:
/* NOP */;
}
if (!buff || !buff.IsPaused('InsideCombatAction') && delay > 0){
PauseEffects(2, 'InsideCombatAction', /* NOP */, /* NOP
*/, /* NOP */);
}
/* NOP */;
}
public function HolsterUsableItem() : Bool{
return holsterUsableItem;
/* NOP */;
}
public function IsInGuardedState() : Bool{

return isInGuardedState;
/* NOP */;
}
public function OnGuardedStart() : Bool{
isInGuardedState = true;
/* NOP */;
}
public function OnGuardedEnd() : Bool{
isInGuardedState = false;
/* NOP */;
}
public function OnCombatActionStart() : Bool{
BlockAction(34, 'OnCombatActionStart', /* NOP */, /* NOP */, /*
NOP */);
BlockAction(4, 'OnCombatActionStart', /* NOP */, /* NOP */, /* N
OP */);
/* NOP */;
SetBIsCombatActionAllowed(false);
SetBIsInputAllowed(false, 'OnCombatActionStart');
ClearFinishableEnemyList(0.000000, 0);
bIsInHitAnim = false;
if (rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State
_WeaponWait'){
CleanCombatActionBuffer();
SetIsAimingCrossbow(false);
OnRangedForceHolster(false, true, /* NOP */);
}
holsterUsableItem = false;
if (thePlayer.IsHoldingItemInLHand()){
if (GetBehaviorVariable('combatActionType', /* NOP */) =
= 6){
holsterUsableItem = true;
} else if (GetBehaviorVariable('combatActionType', /* NO
P */) == 0){
if (GetCurrentStateName() == 'CombatFists'){
holsterUsableItem = true;
}
}
}
if (holsterUsableItem){
thePlayer.SetPlayerActionToRestore(5);
thePlayer.OnUseSelectedItem(true);
restoreUsableItem = true;
}
if (GetBehaviorVariable('combatActionType', /* NOP */) != 0 && G
etBehaviorVariable('combatActionType', /* NOP */) != 8){
RemoveTimer('ProcessAttackTimer', /* NOP */);
RemoveTimer('AttackTimerEnd', /* NOP */);
UnblockAction(1, 'OnCombatActionStart_Attack');
} else {
BlockAction(1, 'OnCombatActionStart_Attack', /* NOP */,
/* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnParryOrCounterEnd() : Bool{
OnCombatActionEnd();
SetBIsInCombatAction(false);
/* NOP */;
}

public function OnCombatActionEnd() : Bool{


var item : SItemUniqueId;
var combatActionType : Float;
super.OnCombatActionEnd();
BlockAllActions('OnCombatActionStart', false, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
UnblockAction(1, 'OnCombatActionStart_Attack');
oTCameraOffset = 0.000000;
oTCameraPitchOffset = 0.000000;
SetBIsCombatActionAllowed(true);
SetBIsInputAllowed(true, 'OnCombatActionEnd');
SetCanPlayHitAnim(true);
EnableFindTarget(true);
SetIsCurrentlyDodging(false, /* NOP */);
SetFinisherVictim(NULL);
OnBlockAllCombatTickets(false);
LogStamina("CombatActionEnd");
SetAttackActionName('None');
combatActionType = GetBehaviorVariable('combatActionType', /* NO
P */);
if (GetBehaviorVariable('combatActionType', /* NOP */) == 1){
theGame.GetGameCamera().StopAnimation('camera_shake_loop
_lvl1_1');
OnSpecialAttackHeavyActionProcess();
}
substateManager.ReactToChanceToFallAndSlide();
/* NOP */;
}
public function OnCombatActionFriendlyStart() : Bool{
SetBIsInCombatActionFriendly(true);
OnCombatActionStart();
/* NOP */;
}
public function OnCombatActionFriendlyEnd() : Bool{
SetBIsInCombatActionFriendly(false);
OnCombatActionEnd();
SetBIsInCombatAction(false);
/* NOP */;
}
public function OnHitStart() : Bool{
var timeLeft : Float;
var currentEffects : array<CBaseGameplayEffect>;
var none : SAbilityAttributeValue;
CancelHoldAttacks();
WhenCombatActionIsFinished();
if (isInFinisher){
if (finisherTarget){
(CNewNPC)finisherTarget.SignalGameplayEvent('Fin
isherInterrupt');
}
isInFinisher = false;
finisherTarget = NULL;
SetBIsCombatActionAllowed(true);
}
bIsInHitAnim = true;
OnCombatActionStart();
ResumeEffects(2, 'InsideCombatAction');
if (GetHealthPercents() < 0.300000){
PlayBattleCry('BattleCryBadSituation', 0.100000, true, /
* NOP */);

} else {
PlayBattleCry('BattleCryBadSituation', 0.050000, true, /
* NOP */);
}
/* NOP */;
}
public function OnHitStartSwimming() : Bool{
OnRangedForceHolster(true, true, false);
/* NOP */;
}
public function OnFinisherStart() : Bool{
var currentEffects : array<CBaseGameplayEffect>;
theGame.CreateNoSaveLock("Finisher", finisherSaveLock, true, fal
se);
isInFinisher = true;
finisherTarget = slideTarget;
OnCombatActionStart();
CancelHoldAttacks();
PlayFinisherCameraAnimation(theGame.GetSyncAnimManager().GetFini
sherCameraAnimName());
AddAnimEventCallback('SyncEvent', 'OnFinisherAnimEvent_SyncEvent
');
SetImmortalityMode(2, 32, /* NOP */);
/* NOP */;
}
public function IsPerformingFinisher() : Bool{
return isInFinisher;
/* NOP */;
}
private function PlayFinisherCameraAnimation(cameraAnimName : CName){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
if (IsLastEnemyKilled() && theGame.GetWorld().NavigationCircleTe
st(GetWorldPosition(), 3.000000, /* NOP */)){
camera.StopAnimation('camera_shake_hit_lvl3_1');
animation.animation = cameraAnimName;
animation.priority = 4;
animation.blendIn = 0.150000;
animation.blendOut = 1.000000;
animation.weight = 1.000000;
animation.speed = 1.000000;
animation.reset = true;
camera.PlayAnimation(animation);
thePlayer.EnableManualCameraControl(false, 'Finisher');
}
/* NOP */;
}
public function IsLastEnemyKilled() : Bool{
var tempMoveTargets : array<CActor>;
FindMoveTarget();
tempMoveTargets = GetMoveTargets();
if (tempMoveTargets.Size() <= 0 || !thePlayer.IsThreat(tempMoveT
argets[0], /* NOP */)){
return true;
}
return false;
/* NOP */;
}
public function OnFinisherAnimEvent_SyncEvent(animEventName : CName, ani

mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{


if (finisherTarget){
(CNewNPC)finisherTarget.SignalGameplayEvent('FinisherKil
l');
}
finisherTarget = NULL;
/* NOP */;
}
public function OnFinisherEnd() : Bool{
isInFinisher = false;
finisherTarget = NULL;
theGame.ReleaseNoSaveLock(finisherSaveLock);
RemoveAnimEventCallback('SyncEvent');
SetImmortalityMode(0, 32, /* NOP */);
theGame.RemoveTimeScale('AnimEventSlomoMo');
AddTimer('FinisherEndEnableCamera', 0.500000, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
OnCombatActionEnd();
OnCombatActionEndComplete();
/* NOP */;
}
private timer function FinisherEndEnableCamera(optional dt : Float, opti
onal id : Int32){
thePlayer.EnableManualCameraControl(true, 'Finisher');
/* NOP */;
}
public function SpawnFinisherBlood(){
var weaponEntity : CEntity;
var weaponSlotMatrix : Matrix;
var bloodFxPos : Vector;
var bloodFxRot : EulerAngles;
var tempEntity : CEntity;
weaponEntity = GetInventory().GetItemEntityUnsafe(GetInventory()
.GetItemFromSlot('r_weapon'));
weaponEntity.CalcEntitySlotMatrix('blood_fx_point', weaponSlotMa
trix);
bloodFxPos = MatrixGetTranslation(weaponSlotMatrix);
bloodFxRot = GetWorldRotation();
tempEntity = theGame.CreateEntity((CEntityTemplate)LoadResource(
'finisher_blood', /* NOP */), bloodFxPos, bloodFxRot, /* NOP */, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
tempEntity.PlayEffect('crawl_blood', /* NOP */);
/* NOP */;
}
public function OnCombatActionEndComplete() : Bool{
var buff : CBaseGameplayEffect;
buff = ChooseCurrentCriticalBuffForAnim();
SetCombatAction(0);
UnblockAction(1, 'OnCombatActionStart');
UnblockAction(2, 'OnCombatActionStart');
UnblockAction(34, 'OnCombatActionStart');
UnblockAction(1, 'OnCombatActionStart_Attack');
SetUnpushableTarget(NULL);
SetBIsInCombatAction(false);
SetIsCurrentlyDodging(false, /* NOP */);
SetMoveTargetChangeAllowed(true);
SetCanPlayHitAnim(true);
SetFinisherVictim(NULL);
RemoveBuffImmunity(18, 'AnimEvent_RemoveBurning');
if (rangedWeapon && rangedWeapon.GetCurrentStateName() == 'State

_WeaponWait' && !buff){


ClearCustomOrientationInfoStack();
SetSlideTarget(NULL);
}
UnblockAction(33, 'OnForceHolster');
specialAttackCamera = false;
bIsRollAllowed = false;
if (bLAxisReleased){
ResetRawPlayerHeading();
ResetCachedRawPlayerHeading();
}
ReapplyCriticalBuff();
SetBIsInputAllowed(true, 'OnCombatActionEndComplete');
ResumeEffects(2, 'InsideCombatAction');
bIsInHitAnim = false;
SetBIsCombatActionAllowed(true);
m_LastWeaponTipPos = Vector(0, 0, 0, 0);
AddTimer('FreeTickets', 3.000000, false, /* NOP */, /* NOP */, /
* NOP */, /* NOP */);
/* NOP */;
}
public function OnMovementFullyBlended() : Bool{
SetBehaviorVariable('isPerformingSpecialAttack', 0.000000, /* NO
P */);
if (restoreUsableItem){
restoreUsableItem = false;
SetPlayerActionToRestore(0);
OnUseSelectedItem(/* NOP */);
}
/* NOP */;
}
public function OnCombatMovementStart() : Bool{
SetCombatIdleStance(1.000000);
OnCombatActionEndComplete();
/* NOP */;
}
public timer function FreeTickets(optional dt : Float, optional id : Int
32){
super.FreeTicketAtCombatTarget();
/* NOP */;
}
public function OnGuardedReleased() : Bool{
}
public function OnPerformAttack(playerAttackType : CName) : Bool{
}
public function OnPerformEvade(playerEvadeType : EPlayerEvadeType) : Boo
l{
}
public function OnInterruptAttack() : Bool{
}
public function OnPerformGuard() : Bool{
}
public function OnSpawnHorse() : Bool{
}
public function OnDismountActionScriptCallback() : Bool{
}
public function OnHorseSummonStart() : Bool{
thePlayer.BlockAction(4, 'HorseSummon', /* NOP */, /* NOP */, /*
NOP */);
thePlayer.BlockAction(0, 'HorseSummon', /* NOP */, /* NOP */, /*

NOP */);
thePlayer.BlockAction(33, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(34, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(13, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(24, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(10, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(23, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(30, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(31, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(44, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(45, 'HorseSummon', /* NOP */, /* NOP */, /
* NOP */);
horseSummonTimeStamp = theGame.GetEngineTimeAsSeconds();
/* NOP */;
}
public function OnHorseSummonStop() : Bool{
thePlayer.BlockAllActions('HorseSummon', false, /* NOP */, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function OnCombatActionStartVehicle(action : EVehicleCombatAction
) : Bool{
SetBIsCombatActionAllowed(false);
if (action != 0){
SetIsAimingCrossbow(false);
OnRangedForceHolster(/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnCombatActionEndVehicle() : Bool{
SetBIsCombatActionAllowed(true);
/* NOP */;
}
protected function CriticalBuffInformBehavior(buff : CBaseGameplayEffect
){
if (!CanAnimationReactToCriticalState(buff)){
return;
}
SetBehaviorVariable('CriticalStateType', GetBuffCriticalType(buf
f), /* NOP */);
SetBehaviorVariable('bCriticalState', 1, /* NOP */);
if (CriticalBuffUsesFullBodyAnim(buff)){
RaiseEvent('CriticalState');
}
SetBehaviorVariable('IsInAir', IsInAir(), /* NOP */);
LogCritical("Sending player critical state event for <<" + buff.
GetEffectType() + ">>");
/* NOP */;
}
private function CanAnimationReactToCriticalState(buff : CBaseGameplayEf
fect) : Bool{

var buffCritical : W3CriticalEffect;


var buffCriticalDOT : W3CriticalDOTEffect;
var isHeavyCritical : Bool;
isHeavyCritical = false;
buffCritical = (W3CriticalEffect)buff;
if (buffCritical){
isHeavyCritical = buffCritical.explorationStateHandling
== 0;
} else {
buffCriticalDOT = (W3CriticalDOTEffect)buff;
if (buffCriticalDOT){
isHeavyCritical = buffCriticalDOT.explorationSta
teHandling == 0;
}
}
if (!isHeavyCritical){
if (!CanReactToCriticalState()){
return false;
}
}
return true;
/* NOP */;
}
public function CanReactToCriticalState() : Bool{
return substateManager.CanReactToHardCriticalState();
/* NOP */;
}
public function OnCriticalStateAnimStart() : Bool{
var heading : Float;
var newCritical : ECriticalStateType;
var newReqCS : CBaseGameplayEffect;
OnCombatActionEndComplete();
newReqCS = newRequestedCS;
if (super.OnCriticalStateAnimStart()){
RemoveTimer('IsItemUseInputHeld', /* NOP */);
keepRequestingCriticalAnimStart = false;
CancelHoldAttacks();
if (!IsUsingVehicle()){
newCritical = GetBuffCriticalType(newReqCS);
if (newCritical == 1 || newCritical == 2 || newC
ritical == 4 || newCritical == 14 || newCritical == 3){
if (newReqCS.GetCreator()){
heading = VecHeading(newReqCS.Ge
tCreator().GetWorldPosition() - GetWorldPosition());
} else {
heading = GetHeading();
}
SetCustomRotation('Knockdown', heading,
2160.000000, 0.100000, true);
if (newCritical != 4 && newCritical != 3
){
substateManager.ReactOnCriticalS
tate(true);
}
}
}
return true;
}
return false;
/* NOP */;

}
public function StartCSAnim(buff : CBaseGameplayEffect) : Bool{
if (super.StartCSAnim(buff)){
if (!CriticalBuffUsesFullBodyAnim(buff)){
OnCriticalStateAnimStart();
}
ResumeEffects(2, 'InsideCombatAction');
keepRequestingCriticalAnimStart = true;
AddTimer('RequestCriticalAnimStart', 0, true, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
return true;
}
return false;
/* NOP */;
}
public function CriticalEffectAnimationInterrupted(reason : String) : Bo
ol{
var ret : Bool;
LogCriticalPlayer("R4Player.CriticalEffectAnimationInterrupted()
- because: " + reason);
ret = super.CriticalEffectAnimationInterrupted(reason);
if (ret){
keepRequestingCriticalAnimStart = false;
}
substateManager.ReactOnCriticalState(false);
return ret;
/* NOP */;
}
public function CriticalStateAnimStopped(forceRemoveBuff : Bool){
LogCriticalPlayer("R4Player.CriticalStateAnimStopped() - forced:
" + forceRemoveBuff);
super.CriticalStateAnimStopped(forceRemoveBuff);
substateManager.ReactOnCriticalState(false);
/* NOP */;
}
public timer function RequestCriticalAnimStart(optional dt : Float, opti
onal id : Int32){
if (keepRequestingCriticalAnimStart){
if (newRequestedCS && newRequestedCS.GetDurationLeft() >
0){
CriticalBuffInformBehavior(newRequestedCS);
} else {
keepRequestingCriticalAnimStart = false;
RemoveTimer('RequestCriticalAnimStart', /* NOP *
/);
}
} else {
RemoveTimer('RequestCriticalAnimStart', /* NOP */);
}
/* NOP */;
}
public function OnRagdollUpdate(progress : Float) : Bool{
SetIsInAir(progress == 0);
/* NOP */;
}
public function OnRagdollOnGround() : Bool{
TryToEndRagdollOnGround(0.000000, /* NOP */);
/* NOP */;
}
public function OnRagdollInAir() : Bool{

RemoveTimer('TryToEndRagdollOnGround', /* NOP */);


/* NOP */;
}
public function OnNoLongerInRagdoll() : Bool{
RemoveTimer('TryToEndRagdollOnGround', /* NOP */);
/* NOP */;
}
public timer function TryToEndRagdollOnGround(optional td : Float, optio
nal id : Int32){
var critical : CBaseGameplayEffect;
var type : EEffectType;
critical = GetCurrentlyAnimatedCS();
if (critical){
type = critical.GetEffectType();
if (type == 9 || type == 6 || type == 65){
if (critical.GetTimeActive() >= 2.500000){
SetIsInAir(false);
RequestCriticalAnimStop(/* NOP */);
RemoveTimer('TryToEndRagdollOnGround', /
* NOP */);
} else {
AddTimer('TryToEndRagdollOnGround', 0.20
0000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
return;
}
}
RemoveTimer('TryToEndRagdollOnGround', /* NOP */);
/* NOP */;
}
public function RequestCriticalAnimStop(dontSetCriticalToStopped : Bool)
{
var buff : CBaseGameplayEffect;
buff = GetCurrentlyAnimatedCS();
if (buff && !CriticalBuffUsesFullBodyAnim(buff)){
CriticalStateAnimStopped(false);
}
if (!buff || !CriticalBuffUsesFullBodyAnim(buff)){
SetBehaviorVariable('bCriticalState', 0, /* NOP */);
}
super.RequestCriticalAnimStop(dontSetCriticalToStopped);
/* NOP */;
}
public function SimulateBuffTimePassing(simulatedTime : Float){
effectManager.SimulateBuffTimePassing(simulatedTime);
/* NOP */;
}
public function AddEffectDefault(effectType : EEffectType, creat : CGame
playEntity, srcName : String, isSignEffect : Bool) : EEffectInteract{
var params : SCustomEffectParams;
if (effectType == 13 || effectType == 46 || effectType == 9 || e
ffectType == 6){
params.effectType = effectType;
params.creator = creat;
params.sourceName = srcName;
params.isSignEffect = isSignEffect;
if (effectType == 13){
params.duration = 1.830000;
} else if (effectType == 46){
params.duration = 4;

} else if (effectType == 9){


params.duration = 2.500000;
} else if (effectType == 6){
params.duration = 4;
}
return AddEffectCustom(params);
} else {
return super.AddEffectDefault(effectType, creat, srcName
, isSignEffect);
}
/* NOP */;
}
public function CheatResurrect(){
if (IsAlive()){
return;
}
SetAlive(true);
SetKinematic(true);
delete abilityManager;
delete effectManager;
SetAbilityManager();
abilityManager.Init(this, GetCharacterStats(), false, theGame.Ge
tDifficultyMode());
SetEffectManager();
abilityManager.PostInit();
EnableFindTarget(true);
SetBehaviorVariable('Ragdoll_Weight', 0.000000, /* NOP */);
RaiseForceEvent('RecoverFromRagdoll');
SetCanPlayHitAnim(true);
SetBehaviorVariable('CriticalStateType', 11, /* NOP */);
GoToStateIfNew('Exploration', /* NOP */, /* NOP */);
(CDismembermentComponent)GetComponent('Dismemberment').ClearVisi
bleWound();
SetIsInAir(false);
theInput.SetContext('Exploration');
ResetDeathType();
ForceUnlockAllInputActions(false);
theGame.CloseMenu('DeathScreenMenu');
theSound.LeaveGameState(12);
theGame.ReleaseNoSaveLock(deathNoSaveLock);
/* NOP */;
}
public function SetIsInsideInteraction(b : Bool){
isInsideInteraction = b;
/* NOP */;
}
public function IsInsideInteraction() : Bool{
return isInsideInteraction;
/* NOP */;
}
public function SetIsInsideHorseInteraction(b : Bool, horse : CEntity){
isInsideHorseInteraction = b;
horseInteractionSource = horse;
/* NOP */;
}
public function IsInsideHorseInteraction() : Bool{
return isInsideHorseInteraction;
/* NOP */;
}
public function OnInteractionActivationTest(interactionComponentName : S

tring, activator : CEntity) : Bool{


if (interactionComponentName == "ClimbLadder"){
if (PlayerHasLadderExplorationReady()){
return true;
}
}
return false;
/* NOP */;
}
private function PlayerHasLadderExplorationReady() : Bool{
if (!substateManager.CanInteract()){
return false;
}
if (!substateManager.m_SharedDataO.HasValidLadderExploration()){
return false;
}
return true;
/* NOP */;
}
public function SetGuarded(flag : Bool){
super.SetGuarded(flag);
if (flag && FactsQuerySum("tut_fight_use_slomo") > 0){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(13));
FactsRemove("tut_fight_slomo_ON");
}
/* NOP */;
}
public function IsGuarded() : Bool{
return super.IsGuarded() && !rangedWeapon || rangedWeapon.GetCur
rentStateName() == 'State_WeaponWait';
/* NOP */;
}
public function GetSelectedItemId() : SItemUniqueId{
return selectedItemId;
/* NOP */;
}
public function ClearSelectedItemId(){
selectedItemId = GetInvalidUniqueId();
/* NOP */;
}
public function IsHoldingItemInLHand() : Bool{
return currentlyEquipedItemL != GetInvalidUniqueId();
/* NOP */;
}
public function GetCurrentlyUsedItemL() : W3UsableItem{
return currentlyUsedItemL;
/* NOP */;
}
public function SetPlayerActionToRestore(actionToRestoreType : EPlayerAc
tionToRestore){
playerActionToRestore = actionToRestoreType;
/* NOP */;
}
public function IsCurrentlyUsingItemL() : Bool{
return currentlyUsingItem;
/* NOP */;
}
public function BlockSlotsOnLItemUse(){
var slotsToBlock : array<CName>;
slotsToBlock.PushBack('Slot1');

slotsToBlock.PushBack('Slot2');
slotsToBlock.PushBack('Slot3');
slotsToBlock.PushBack('Slot4');
slotsToBlock.PushBack('Slot5');
slotsToBlock.PushBack('Yrden');
slotsToBlock.PushBack('Quen');
slotsToBlock.PushBack('Igni');
slotsToBlock.PushBack('Axii');
slotsToBlock.PushBack('Aard');
EnableRadialSlotsWithSource(false, slotsToBlock, 'usableItemL');
/* NOP */;
}
public function UnblockSlotsOnLItemUse(){
var slotsToBlock : array<CName>;
slotsToBlock.PushBack('Slot1');
slotsToBlock.PushBack('Slot2');
slotsToBlock.PushBack('Slot3');
slotsToBlock.PushBack('Slot4');
slotsToBlock.PushBack('Slot5');
slotsToBlock.PushBack('Yrden');
slotsToBlock.PushBack('Quen');
slotsToBlock.PushBack('Igni');
slotsToBlock.PushBack('Axii');
slotsToBlock.PushBack('Aard');
EnableRadialSlotsWithSource(true, slotsToBlock, 'usableItemL');
/* NOP */;
}
public function IsUsableItemLBlocked() : Bool{
return isUsableItemBlocked;
/* NOP */;
}
public function HideUsableItem(force : Bool){
if (currentlyEquipedItemL != GetInvalidUniqueId()){
if (force){
if (!RaiseEvent('ItemEndL')){
OnUsingItemsReset();
}
return;
}
RaiseEvent('ItemUseL');
}
/* NOP */;
}
public function ProcessUsableItemsTransition(actionToRestore : EPlayerAc
tionToRestore){
var category : CName;
var signSkill : ESkill;
category = inv.GetItemCategory(selectedItemId);
signSkill = SignEnumToSkillEnum(GetEquippedSign());
switch(actionToRestore){
case 5:
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, true);
}
currentlyEquipedItemL = GetInvalidUniqueId();
return;
case 0:
if (IsSlotQuickslot(inv.GetSlotForItemId(selectedItemId)
) && category == 'usable' && currentlyEquipedItemL != selectedItemId){
if (currentlyUsedItemL){

inv.UnmountItem(currentlyEquipedItemL, t
rue);
}
currentlyEquipedItemL = GetInvalidUniqueId();
OnUseSelectedItem(/* NOP */);
return;
}
break;
case 1:
if (inv.IsItemCrossbow(selectedItemId)){
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, t
rue);
}
currentlyEquipedItemL = GetInvalidUniqueId();
SetIsAimingCrossbow(true);
if (theInput.IsActionPressed('ThrowItem')){
SetupCombatAction(4, 1);
} else {
SetupCombatAction(4, 1);
SetupCombatAction(4, 0);
}
return;
}
break;
case 2:
if (signSkill != 0 && playerActionToRestore == 2){
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, t
rue);
}
currentlyEquipedItemL = GetInvalidUniqueId();
if (HasStaminaToUseSkill(signSkill, false, /* NO
P */)){
if (GetInvalidUniqueId() != inv.GetItemF
romSlot('l_weapon')){
PushCombatActionOnBuffer(3, 1, /
* NOP */);
} else {
SetupCombatAction(3, 1);
}
} else {
thePlayer.SoundEvent("gui_no_stamina", /
* NOP */, /* NOP */);
}
return;
}
break;
case 3:
if (inv.IsItemBomb(selectedItemId)){
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, t
rue);
}
currentlyEquipedItemL = GetInvalidUniqueId();
PrepareToAttack(/* NOP */, /* NOP */);
SetupCombatAction(4, 1);
return;
}
break;

case 4:
theGame.OnSpawnPlayerHorse();
break;
default:
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, true);
}
currentlyEquipedItemL = GetInvalidUniqueId();
return;
}
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, true);
}
currentlyEquipedItemL = GetInvalidUniqueId();
/* NOP */;
}
public function GetUsableItemLtransitionAllowed() : Bool{
return isUsableItemLtransitionAllowed;
/* NOP */;
}
public function SetUsableItemLtransitionAllowed(isAllowed : Bool){
isUsableItemLtransitionAllowed = isAllowed;
/* NOP */;
}
public function OnItemUseLUnBlocked() : Bool{
if (isUsableItemBlocked){
isUsableItemBlocked = false;
UnblockSlotsOnLItemUse();
}
/* NOP */;
}
public function OnItemUseLBlocked() : Bool{
if (!isUsableItemBlocked){
isUsableItemBlocked = true;
BlockSlotsOnLItemUse();
}
/* NOP */;
}
public function OnUsingItemsReset() : Bool{
if (currentlyUsingItem){
OnItemUseLUnBlocked();
OnUsingItemsComplete();
}
/* NOP */;
}
public function OnUsingItemsComplete() : Bool{
if (isUsableItemBlocked){
OnItemUseLUnBlocked();
}
currentlyUsingItem = false;
if (GetUsableItemLtransitionAllowed()){
ProcessUsableItemsTransition(playerActionToRestore);
} else {
if (currentlyUsedItemL){
inv.UnmountItem(currentlyEquipedItemL, true);
}
currentlyEquipedItemL = GetInvalidUniqueId();
}
SetPlayerActionToRestore(0);
/* NOP */;

}
public function OnUseSelectedItem(force : Bool) : Bool{
var category : CName;
var itemEntity : W3UsableItem;
if (isUsableItemBlocked && !force){
return false;
}
if (IsCastingSign()){
return false;
}
if (currentlyEquipedItemL != GetInvalidUniqueId()){
SetBehaviorVariable('SelectedItemL', GetUsableItemTypeBy
Id(currentlyEquipedItemL), /* NOP */);
if (force){
if (RaiseEvent('ItemEndL')){
SetUsableItemLtransitionAllowed(true);
return true;
}
} else if (RaiseEvent('ItemUseL')){
SetUsableItemLtransitionAllowed(true);
return true;
}
} else {
category = inv.GetItemCategory(selectedItemId);
if (category != 'usable'){
return false;
}
SetBehaviorVariable('SelectedItemL', GetUsableItemTypeBy
Id(selectedItemId), /* NOP */);
if (RaiseEvent('ItemUseL')){
currentlyEquipedItemL = selectedItemId;
SetUsableItemLtransitionAllowed(false);
currentlyUsingItem = true;
return true;
}
inv.UnmountItem(selectedItemId, true);
}
/* NOP */;
}
public function ProcessUseSelectedItem(itemEntity : W3UsableItem, should
CallOnUsed : Bool){
currentlyUsedItemL = itemEntity;
DrainStamina(11, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
if (shouldCallOnUsed){
currentlyUsedItemL.OnUsed(thePlayer);
}
/* NOP */;
}
public function GetUsableItemTypeById(itemId : SItemUniqueId) : EUsableI
temType{
var itemName : CName;
itemName = inv.GetItemName(itemId);
return theGame.GetDefinitionsManager().GetUsableItemType(itemNam
e);
/* NOP */;
}
public function StartWaitForItemSpawnAndProccesTask(){
AddTimer('WaitForItemSpawnAndProccesTask', 0.001000, true, /* NO
P */, /* NOP */, /* NOP */, true);

/* NOP */;
}
public function KillWaitForItemSpawnAndProccesTask(){
RemoveTimer('WaitForItemSpawnAndProccesTask', /* NOP */);
/* NOP */;
}
public function AllowUseSelectedItem(){
m_useSelectedItemIfSpawned = true;
/* NOP */;
}
public timer function WaitForItemSpawnAndProccesTask(optional timeDelta
: Float, optional id : Int32){
var itemEntity : W3UsableItem;
var canTaskBeKilled : Bool;
canTaskBeKilled = false;
if (IsCastingSign()){
return;
}
if (selectedItemId == GetInvalidUniqueId()){
canTaskBeKilled = true;
}
itemEntity = (W3UsableItem)inv.GetItemEntityUnsafe(selectedItemI
d);
if (itemEntity && m_useSelectedItemIfSpawned){
canTaskBeKilled = true;
m_useSelectedItemIfSpawned = false;
ProcessUseSelectedItem(itemEntity, true);
}
if (canTaskBeKilled){
KillWaitForItemSpawnAndProccesTask();
}
/* NOP */;
}
public function OnBombProjectileReleased() : Bool{
ResetRawPlayerHeading();
UnblockAction(13, 'BombThrow');
UnblockAction(33, 'BombThrow');
if (GetCurrentStateName() == 'AimThrow'){
PopState(/* NOP */);
}
FactsAdd("ach_bomb", 1, 4);
theGame.GetGamerProfile().CheckLearningTheRopes();
/* NOP */;
}
public function SetIsThrowingItemWithAim(b : Bool){
isThrowingItemWithAim = b;
/* NOP */;
}
public function SetIsThrowingItem(flag : Bool){
isThrowingItem = flag;
/* NOP */;
}
public function IsThrowingItem() : Bool{
return isThrowingItem;
/* NOP */;
}
public function IsThrowingItemWithAim() : Bool{
return isThrowingItemWithAim;
/* NOP */;
}

public function SetThrowHold(b : Bool){


isThrowHoldPressed = b;
/* NOP */;
}
public function IsThrowHold() : Bool{
return isThrowHoldPressed;
/* NOP */;
}
public function SetIsAimingCrossbow(flag : Bool){
isAimingCrossbow = flag;
/* NOP */;
}
public function GetIsAimingCrossbow() : Bool{
return isAimingCrossbow;
/* NOP */;
}
public function OnThrowAnimLeave() : Bool{
var throwStage : EThrowStage;
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thrownEntityHandle);
if (thrownEntity && !thrownEntity.WasThrown()){
throwStage = GetBehaviorVariable('throwStage', 3);
if (inv.IsItemBomb(selectedItemId)){
BombThrowCleanUp();
} else {
ThrowingAbort();
}
}
thrownEntity = NULL;
SetIsThrowingItem(false);
SetIsThrowingItemWithAim(false);
EnableRadialSlotsWithSource(true, radialSlots, 'throwBomb');
UnblockAction(13, 'BombThrow');
UnblockAction(33, 'BombThrow');
/* NOP */;
}
protected function BombThrowStart(){
var slideTargetActor : CActor;
BlockAction(13, 'BombThrow', /* NOP */, /* NOP */, /* NOP */);
BlockAction(33, 'BombThrow', /* NOP */, /* NOP */, /* NOP */);
SetBehaviorVariable('throwStage', 0, /* NOP */);
SetBehaviorVariable('combatActionType', 4, /* NOP */);
if (slideTarget){
AddCustomOrientationTarget(1, 'BombThrow');
slideTargetActor = (CActor)slideTarget;
} else if (lastAxisInputIsMovement){
AddCustomOrientationTarget(1, 'BombThrow');
} else {
AddCustomOrientationTarget(3, 'BombThrow');
}
UpdateLookAtTarget();
SetCustomRotation('Throw', VecHeading(GetLookAtPosition() - GetW
orldPosition()), 0.000000, 0.300000, false);
SetBehaviorVariable('itemType', 0, /* NOP */);
ProcessCanAttackWhenNotInCombatBomb();
if (RaiseForceEvent('CombatAction')){
OnCombatActionStart();
}
theTelemetry.LogWithLabel(26, inv.GetItemName(selectedItemId));
/* NOP */;

}
public function OnThrowAnimStart() : Bool{
var itemId : SItemUniqueId;
var thrownEntity : CThrowable;
radialSlots.Clear();
GetWitcherPlayer().GetItemEquippedOnSlot(7, itemId);
if (GetSelectedItemId() == itemId){
radialSlots.PushBack('Slot2');
} else {
radialSlots.PushBack('Slot1');
}
radialSlots.PushBack('Slot3');
radialSlots.PushBack('Slot4');
radialSlots.PushBack('Slot5');
EnableRadialSlotsWithSource(false, radialSlots, 'throwBomb');
thrownEntity = (CThrowable)inv.GetDeploymentItemEntity(selectedI
temId, /* NOP */, /* NOP */, true);
thrownEntity.Initialize(this, selectedItemId);
EntityHandleSet(thrownEntityHandle, thrownEntity);
SetIsThrowingItem(true);
/* NOP */;
}
public function BombThrowAbort(){
BombThrowCleanUp();
UnblockAction(13, 'BombThrow');
UnblockAction(33, 'BombThrow');
/* NOP */;
}
private function BombThrowCleanUp(){
var throwStage : EThrowStage;
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thrownEntityHandle);
EnableRadialSlotsWithSource(true, radialSlots, 'throwBomb');
throwStage = GetBehaviorVariable('throwStage', 3);
SetBehaviorVariable('throwStage', 3, /* NOP */);
if (GetCurrentStateName() == 'AimThrow'){
PopState(/* NOP */);
thrownEntity.StopAiming(true);
}
if (thrownEntity && !thrownEntity.WasThrown()){
thrownEntity.BreakAttachment();
thrownEntity.Destroy();
}
thrownEntity = NULL;
SetIsThrowingItem(false);
SetIsThrowingItemWithAim(false);
RemoveCustomOrientationTarget('BombThrow');
/* NOP */;
}
public function ProcessCanAttackWhenNotInCombatBomb(){
SetIsShootingFriendly(false);
SetBehaviorVariable('isShootingFriendly', GetIsShootingFriendly(
), /* NOP */);
/* NOP */;
}
public function SetIsShootingFriendly(flag : Bool){
isShootingFriendly = flag;
/* NOP */;
}
public function GetIsShootingFriendly() : Bool{

return isShootingFriendly;
/* NOP */;
}
protected function UsableItemStart(){
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)inv.GetDeploymentItemEntity(selectedI
temId, /* NOP */, /* NOP */, true);
thrownEntity.Initialize(this, selectedItemId);
EntityHandleSet(thrownEntityHandle, thrownEntity);
SetBehaviorVariable('throwStage', 0, /* NOP */);
SetIsThrowingItem(true);
SetBehaviorVariable('combatActionType', 4, /* NOP */);
if (slideTarget){
AddCustomOrientationTarget(1, 'UsableItems');
} else if (lastAxisInputIsMovement){
AddCustomOrientationTarget(1, 'UsableItems');
} else {
AddCustomOrientationTarget(3, 'UsableItems');
}
SetBehaviorVariable('itemType', -1, /* NOP */);
if (RaiseForceEvent('CombatAction')){
OnCombatActionStart();
}
/* NOP */;
}
protected function BombThrowRelease(){
OnDelayOrientationChangeOff();
if (GetIsShootingFriendly()){
BombThrowAbort();
} else {
SetBehaviorVariable('throwStage', 2, /* NOP */);
if (playerAiming.GetCurrentStateName() == 'Aiming'){
SetCustomRotation('Throw', VecHeading(GetLookAtP
osition() - GetWorldPosition()), 0.000000, 0.200000, false);
}
}
/* NOP */;
}
protected function UsableItemRelease(){
OnDelayOrientationChangeOff();
SetBehaviorVariable('throwStage', 2, /* NOP */);
RemoveCustomOrientationTarget('UsableItems');
/* NOP */;
}
public function ThrowingAbort(){
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thrownEntityHandle);
SetBehaviorVariable('throwStage', 3, /* NOP */);
RaiseEvent('actionStop');
if (GetCurrentStateName() == 'AimThrow'){
PopState(/* NOP */);
thrownEntity.StopAiming(true);
}
if (thrownEntity && !thrownEntity.WasThrown()){
thrownEntity.BreakAttachment();
thrownEntity.Destroy();
}
/* NOP */;
}
public function CanSetupCombatAction_Throw() : Bool{

if (!inv.IsIdValid(selectedItemId)){
return false;
}
if (!inv.IsItemSingletonItem(selectedItemId)){
return false;
}
if (!GetBIsInputAllowed()){
return false;
}
if (inv.GetItemQuantity(GetSelectedItemId()) <= 0 && !inv.ItemHa
sTag(selectedItemId, theGame.params.TAG_INFINITE_AMMO)){
return false;
}
if (!inputHandler.IsActionAllowed(13) && GetCurrentStateName() !
= 'Swimming'){
return false;
}
return true;
/* NOP */;
}
public function GetThrownEntity() : CThrowable{
return (CThrowable)EntityHandleGet(thrownEntityHandle);
/* NOP */;
}
public function OnWeaponWait() : Bool{
rangedWeapon.OnWeaponWait();
/* NOP */;
}
public function OnWeaponDrawStart() : Bool{
rangedWeapon.OnWeaponDrawStart();
/* NOP */;
}
public function OnWeaponReloadStart() : Bool{
rangedWeapon.OnWeaponReloadStart();
/* NOP */;
}
public function OnWeaponReloadEnd() : Bool{
rangedWeapon.OnWeaponReloadEnd();
/* NOP */;
}
public function OnWeaponAimStart() : Bool{
rangedWeapon.OnWeaponAimStart();
/* NOP */;
}
public function OnWeaponShootStart() : Bool{
rangedWeapon.OnWeaponShootStart();
/* NOP */;
}
public function OnWeaponShootEnd() : Bool{
rangedWeapon.OnWeaponShootEnd();
/* NOP */;
}
public function OnWeaponAimEnd() : Bool{
rangedWeapon.OnWeaponAimEnd();
/* NOP */;
}
public function OnWeaponHolsterStart() : Bool{
rangedWeapon.OnWeaponHolsterStart();
/* NOP */;
}

public function OnWeaponHolsterEnd() : Bool{


rangedWeapon.OnWeaponHolsterEnd();
/* NOP */;
}
public function OnWeaponToNormalTransStart() : Bool{
rangedWeapon.OnWeaponToNormalTransStart();
/* NOP */;
}
public function OnWeaponToNormalTransEnd() : Bool{
rangedWeapon.OnWeaponToNormalTransEnd();
/* NOP */;
}
public function OnEnableAimingMode(enable : Bool) : Bool{
if (enable){
PushState('AimThrow');
} else if (GetCurrentStateName() == 'AimThrow'){
PopState(/* NOP */);
}
/* NOP */;
}
public function OnRangedForceHolster(forceUpperBodyAnim : Bool, instant
: Bool, dropItem : Bool) : Bool{
if (rangedWeapon){
rangedWeapon.OnForceHolster(forceUpperBodyAnim, instant,
dropItem);
}
/* NOP */;
}
public function IsCrossbowHeld() : Bool{
if (rangedWeapon){
return rangedWeapon.GetCurrentStateName() != 'State_Weap
onWait';
}
return false;
/* NOP */;
}
public function OnBlockAllCombatTickets(release : Bool) : Bool{
if (!release){
(CR4PlayerStateCombat)GetState('Combat').OnBlockAllComba
tTickets(false);
}
/* NOP */;
}
public function OnForceTicketUpdate() : Bool{
}
public function SetHitReactTransScale(f : Float){
hitReactTransScale = f;
/* NOP */;
}
public function GetHitReactTransScale() : Float{
if ((CNewNPC)slideTarget.GetIsTranslationScaled()){
return hitReactTransScale;
} else {
return 1.000000;
}
/* NOP */;
}
public function GetHorseWithInventory() : CNewNPC{
return (CNewNPC)EntityHandleGet(horseWithInventory);
/* NOP */;

}
public function GetHorseCurrentlyMounted() : CNewNPC{
return currentlyMountedHorse;
/* NOP */;
}
public function _SetHorseCurrentlyMounted(horse : CNewNPC){
currentlyMountedHorse = horse;
/* NOP */;
}
public function WasHorseRecentlySummoned() : Bool{
if (horseSummonTimeStamp + 5.000000 > theGame.GetEngineTimeAsSec
onds()){
return true;
}
return false;
/* NOP */;
}
public function IsMountingHorseAllowed(alwaysAllowedInExploration : Bool
) : Bool{
var angle : Float;
var distance : Float;
if (IsInsideHorseInteraction()){
angle = AngleDistance(thePlayer.rawPlayerHeading, VecHea
ding(thePlayer.horseInteractionSource.GetWorldPosition() - thePlayer.GetWorldPos
ition()));
if (thePlayer.IsInCombat()){
if (AbsF(angle) < MOUNT_ANGLE_CBT){
distance = VecDistance(thePlayer.GetWorl
dPosition(), thePlayer.horseInteractionSource.GetWorldPosition());
if (distance < MOUNT_DISTANCE_CBT){
return true;
} else {
return false;
}
} else {
return false;
}
} else if (alwaysAllowedInExploration){
return true;
} else if (AbsF(angle) < MOUNT_ANGLE_EXP){
return true;
} else {
return false;
}
} else {
return false;
}
/* NOP */;
}
public function FollowActor(actor : CActor){
var l_aiTreeDecorator : CAIPlayerActionDecorator;
var l_aiTree_onFoot : CAIFollowSideBySideAction;
var l_aiTree_onHorse : CAIRiderFollowSideBySideAction;
var l_success : Bool;
l_success = false;
actor.AddTag('playerFollowing');
if (thePlayer.IsUsingHorse(/* NOP */)){
l_aiTree_onHorse = new CAIRiderFollowSideBySideAction in
this;
l_aiTree_onHorse.OnCreated();

l_aiTree_onHorse.params.targetTag = 'playerFollowing';
} else {
l_aiTree_onFoot = new CAIFollowSideBySideAction in this;
l_aiTree_onFoot.OnCreated();
l_aiTree_onFoot.params.targetTag = 'playerFollowing';
}
l_aiTreeDecorator = new CAIPlayerActionDecorator in this;
l_aiTreeDecorator.OnCreated();
l_aiTreeDecorator.interruptOnInput = false;
if (thePlayer.IsUsingHorse(/* NOP */)){
l_aiTreeDecorator.scriptedAction = l_aiTree_onHorse;
} else {
l_aiTreeDecorator.scriptedAction = l_aiTree_onFoot;
}
if (l_aiTreeDecorator){
l_success = ForceAIBehavior(l_aiTreeDecorator, 50, /* NO
P */);
} else if (thePlayer.IsUsingHorse(/* NOP */)){
l_success = ForceAIBehavior(l_aiTree_onHorse, 50, /* NOP
*/);
} else {
l_success = ForceAIBehavior(l_aiTree_onFoot, 50, /* NOP
*/);
}
if (l_success){
GetMovingAgentComponent().SetGameplayRelativeMoveSpeed(0
.000000);
}
/* NOP */;
}
public function SetCanFollowNpc(val : Bool, actor : CActor){
canFollowNpc = val;
actorToFollow = actor;
/* NOP */;
}
public function CanFollowNpc() : Bool{
return canFollowNpc;
/* NOP */;
}
public function GetActorToFollow() : CActor{
return actorToFollow;
/* NOP */;
}
public function SetIsSwimming(toggle : Bool){
if (isSwimming != toggle){
thePlayer.substateManager.SetBehaviorParamBool('isSwimmi
ngForOverlay', toggle, /* NOP */);
isSwimming = toggle;
}
/* NOP */;
}
public function RepairItemUsingConsumable(item : SItemUniqueId, consumab
le : SItemUniqueId) : Bool{
var curr : Float;
var max : Float;
var repairValue : Float;
var itemValue : Float;
var repairBonus : Float;
var newDurability : Float;
if (!inv.IsIdValid(item) || !inv.IsIdValid(consumable) || !inv.H

asItemDurability(item)){
return false;
}
curr = inv.GetItemDurability(item);
max = inv.GetItemMaxDurability(item);
if (curr > max){
return false;
}
if (inv.IsItemAnyArmor(item) && inv.ItemHasTag(consumable, theGa
me.params.TAG_REPAIR_CONSUMABLE_ARMOR) || inv.IsItemSilverSwordUsableByPlayer(it
em) && inv.ItemHasTag(consumable, theGame.params.TAG_REPAIR_CONSUMABLE_SILVER) |
| inv.IsItemSteelSwordUsableByPlayer(item) && inv.ItemHasTag(consumable, theGame
.params.TAG_REPAIR_CONSUMABLE_STEEL)){
itemValue = CalculateAttributeValue(inv.GetItemAttribute
Value(consumable, 'durabilityRepairValue', /* NOP */, /* NOP */), /* NOP */);
if (itemValue <= 0){
LogAssert(false, "CR4Player.RepairItemUsingConsu
mable: consumable <<" + inv.GetItemName(consumable) + ">> has <=0 durabilityRepa
irValue!!!");
return false;
}
repairBonus = CalculateAttributeValue(inv.GetItemAttribu
teValue(consumable, 'durabilityBonusValue', /* NOP */, /* NOP */), /* NOP */);
repairValue = max * itemValue / 100;
newDurability = MinF(max, curr + repairValue);
inv.SetItemDurabilityScript(item, newDurability);
inv.RemoveItem(consumable, /* NOP */);
return true;
}
return false;
/* NOP */;
}
private function CheckDayNightCycle(){
var time : GameTime;
var isNight : Bool;
isNight = theGame.envMgr.IsNight();
if (prevDayNightIsNight != isNight){
if (isNight){
OnNightStarted();
} else {
OnDayStarted();
}
prevDayNightIsNight = isNight;
}
if (isNight){
time = theGame.envMgr.GetGameTimeTillNextDay();
} else {
time = theGame.envMgr.GetGameTimeTillNextNight();
}
AddGameTimeTimer('DayNightCycle', time, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function DayNightCycle(optional dt : GameTime, optional id
: Int32){
CheckDayNightCycle();
/* NOP */;
}
public function OnNightStarted() : Bool{
var pam : W3PlayerAbilityManager;

if (CanUseSkill(80)){
pam = (W3PlayerAbilityManager)abilityManager;
pam.SetPerk01Abilities(false, true);
}
/* NOP */;
}
public function OnDayStarted() : Bool{
var pam : W3PlayerAbilityManager;
if (CanUseSkill(80)){
pam = (W3PlayerAbilityManager)abilityManager;
pam.SetPerk01Abilities(true, false);
}
/* NOP */;
}
public function ForceUnlockAllInputActions(alsoQuestLocks : Bool){
if (inputHandler){
inputHandler.ForceUnlockAllInputActions(alsoQuestLocks);
}
/* NOP */;
}
public function SetPrevRawLeftJoyRot(){
prevRawLeftJoyRot = rawLeftJoyRot;
/* NOP */;
}
public function GetPrevRawLeftJoyRot() : Float{
return prevRawLeftJoyRot;
/* NOP */;
}
public function GetExplorationInputContext() : CName{
return explorationInputContext;
/* NOP */;
}
public function GetCombatInputContext() : CName{
return combatInputContext;
/* NOP */;
}
public function SetIsOnBoat(b : Bool){
isOnBoat = b;
/* NOP */;
}
public function IsOnBoat() : Bool{
return isOnBoat;
/* NOP */;
}
public function IsInShallowWater() : Bool{
return isInShallowWater;
/* NOP */;
}
public function OnEnterShallowWater() : Bool{
if (isInShallowWater){
return false;
}
isInShallowWater = true;
BlockAction(23, 'ShallowWater', false, false, true);
BlockAction(26, 'ShallowWater', false, false, true);
BlockAction(33, 'ShallowWater', false, false, true);
BlockAction(10, 'ShallowWater', false, false, true);
SetBehaviorVariable('shallowWater', 1.000000, /* NOP */);
/* NOP */;
}

public function OnExitShallowWater() : Bool{


if (!isInShallowWater){
return false;
}
isInShallowWater = false;
BlockAllActions('ShallowWater', false, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
SetBehaviorVariable('shallowWater', 0.000000, /* NOP */);
/* NOP */;
}
public function TestIsInSettlement() : Bool{
return super.IsInSettlement();
/* NOP */;
}
public function ProcessGlossaryImageOverride(defaultImage : String, uniq
ueTag : CName) : String{
var size : Int32;
var i : Int32;
size = glossaryImageOverride.Size();
if (size == 0){
return defaultImage;
}
i = 0;
while (i < size){
if (glossaryImageOverride[i].uniqueTag == uniqueTag){
return glossaryImageOverride[i].imageFileName;
}
i += 1;
}
return defaultImage;
/* NOP */;
}
public function EnableGlossaryImageOverride(uniqueTag : CName, imageFile
Name : String, enable : Bool){
var imageData : SGlossaryImageOverride;
var size : Int32;
var i : Int32;
i = 0;
while (i < glossaryImageOverride.Size()){
if (glossaryImageOverride[i].uniqueTag == uniqueTag){
glossaryImageOverride.Remove(glossaryImageOverri
de[i]);
}
i += 1;
}
if (enable){
if (IsNameValid(uniqueTag) && imageFileName != ""){
glossaryImageOverride.PushBack(SGlossaryImageOve
rride(uniqueTag, imageFileName));
}
}
/* NOP */;
}
public function SetCurrentMonsterHuntInvestigationArea(area : W3MonsterH
untInvestigationArea){
currentMonsterHuntInvestigationArea = area;
/* NOP */;
}
public function RememberCustomHead(headName : CName){
rememberedCustomHead = headName;

/* NOP */;
}
public function GetRememberedCustomHead() : CName{
return rememberedCustomHead;
/* NOP */;
}
public function ClearRememberedCustomHead(){
rememberedCustomHead = 'None';
/* NOP */;
}
public function CreateTutorialInput(){
var prevInputHandler : CPlayerInput;
prevInputHandler = inputHandler;
inputHandler = new W3PlayerTutorialInput in this;
inputHandler.Initialize(false, prevInputHandler);
if (prevInputHandler){
delete prevInputHandler;
}
/* NOP */;
}
public function CreateInput(){
var oldInputHandler : CPlayerInput;
oldInputHandler = inputHandler;
inputHandler = new CPlayerInput in this;
inputHandler.Initialize(false, oldInputHandler);
/* NOP */;
}
public timer function TutorialSilverCombat(optional dt : Float, optional
id : Int32){
var i : Int32;
var actors : array<CActor>;
if (IsInCombat()){
actors = GetNPCsAndPlayersInRange(20, 1000000, /* NOP */
, 1 + 4);
i = 0;
while (i < actors.Size()){
if (actors[i] && IsRequiredAttitudeBetween(this,
actors[i], true, /* NOP */, /* NOP */) && actors[i].UsesEssence()){
FactsAdd("TutorialShowSilver", /* NOP */
, /* NOP */);
RemoveTimer('TutorialSilverCombat', /* N
OP */);
break;
}
i += 1;
}
}
/* NOP */;
}
public function GetBossTag() : CName{
return m_bossTag;
/* NOP */;
}
public function SetBossTag(bossTag : CName){
m_bossTag = bossTag;
/* NOP */;
}
public timer function DelayedFinisherInputTimer(optional dt : Float, opt
ional id : Int32){
}

public timer function RemoveFinisherCameraAnimationCheck(optional dt : F


loat, optional id : Int32){
if (!isInFinisher && !bLAxisReleased){
theGame.GetSyncAnimManager().OnRemoveFinisherCameraAnima
tion();
RemoveTimer('RemoveFinisherCameraAnimationCheck', /* NOP
*/);
}
/* NOP */;
}
public timer function GameplayFactRemove(optional dt : Float, optional t
imerId : Int32){
theGame.GameplayFactRemoveFromTimer(timerId);
/* NOP */;
}
public timer function GiveStartingItems(optional dt : Float, optional ti
merId : Int32){
var template : CEntityTemplate;
var invEntity : CInventoryComponent;
var entity : CEntity;
var items : array<SItemUniqueId>;
var id : SItemUniqueId;
var i : Int32;
if (inv){
inv.NotifyScriptedListeners(true);
inv.GetAllItems(items);
if (items.Size() <= 0){
return;
}
} else {
return;
}
template = (CEntityTemplate)LoadResource("geralt_inventory_relea
se", /* NOP */);
entity = theGame.CreateEntity(template, Vector(0, 0, 0), /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
invEntity = (CInventoryComponent)entity.GetComponentByClassName(
'CInventoryComponent');
invEntity.GetAllItems(items);
i = 0;
while (i < items.Size()){
id = invEntity.GiveItemTo(inv, items[i], 0, false, true,
/* NOP */);
if (inv.ItemHasTag(id, 'Scabbard')){
inv.MountItem(id, /* NOP */, /* NOP */);
} else if (!inv.IsItemFists(id) && inv.GetItemName(id) !
= 'Cat 1'){
EquipItem(id, /* NOP */, /* NOP */);
} else if (inv.IsItemSingletonItem(id)){
inv.SingletonItemSetAmmo(id, inv.SingletonItemGe
tMaxAmmo(id));
}
i += 1;
}
entity.Destroy();
RemoveTimer('GiveStartingItems', /* NOP */);
/* NOP */;
}
public timer function Debug_GiveTestingItems(optional dt : Float, option
al id : Int32){

var template : CEntityTemplate;


var invTesting : CInventoryComponent;
var entity : CEntity;
var items : array<SItemUniqueId>;
var i : Int32;
var slot : EEquipmentSlots;
if (inv){
inv.GetAllItems(items);
if (items.Size() <= 0){
return;
}
} else {
return;
}
template = (CEntityTemplate)LoadResource("geralt_inventory_inter
nal", /* NOP */);
entity = theGame.CreateEntity(template, Vector(0, 0, 0), /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
invTesting = (CInventoryComponent)entity.GetComponentByClassName
('CInventoryComponent');
invTesting.GiveAllItemsTo(inv, true, /* NOP */);
entity.Destroy();
RemoveTimer('Debug_GiveTestingItems', /* NOP */);
inv.GetAllItems(items);
i = 0;
while (i < items.Size()){
if (inv.IsItemCrossbow(items[i]) || inv.IsItemBomb(items
[i])){
slot = inv.GetSlotForItemId(items[i]);
EquipItem(items[i], slot, /* NOP */);
if ((W3PlayerWitcher)this && inv.IsItemCrossbow(
items[i])){
GetWitcherPlayer().SelectQuickslotItem(s
lot);
}
} else if (inv.IsItemBolt(items[i])){
slot = inv.GetSlotForItemId(items[i]);
EquipItem(items[i], slot, /* NOP */);
}
if (inv.IsItemSingletonItem(items[i])){
inv.SingletonItemSetAmmo(items[i], inv.Singleton
ItemGetMaxAmmo(items[i]));
}
i += 1;
}
/* NOP */;
}
public timer function Debug_RemoveTestingItems(optional dt : Float, opti
onal id : Int32){
var template : CEntityTemplate;
var entity : CEntity;
var invTesting : CInventoryComponent;
var ids : array<SItemUniqueId>;
var i : Int32;
template = (CEntityTemplate)LoadResource("geralt_inventory_inter
nal", /* NOP */);
entity = theGame.CreateEntity(template, Vector(0, 0, 0), /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
invTesting = (CInventoryComponent)entity.GetComponentByClassName
('CInventoryComponent');

invTesting.GetAllItems(ids);
i = 0;
while (i < ids.Size()){
inv.RemoveItemByName(invTesting.GetItemName(ids[i]), inv
Testing.GetItemQuantity(ids[i]));
i += 1;
}
entity.Destroy();
RemoveTimer('Debug_RemoveTestingItems', /* NOP */);
/* NOP */;
}
public timer function Debug_DelayedConsoleCommand(optional dt : Float, o
ptional id : Int32){
inv.AddAnItem('Boots 2 schematic', /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
/* NOP */;
}
public function DBG_SkillSlots(){
(W3PlayerAbilityManager)abilityManager.DBG_SkillSlots();
/* NOP */;
}
public final function SetPadBacklightColor(r : Int32, g : Int32, b : Int
32){
var padBacklightColor : Vector;
padBacklightColor.X = r / 255;
padBacklightColor.Y = g / 255;
padBacklightColor.Z = b / 255;
SetBacklightColor(padBacklightColor);
/* NOP */;
}
public final function SetPadBacklightColorFromSign(signType : ESignType)
{
LogPS4Light("SetPadBacklightColorFromSign... " + signType);
switch(signType){
case 1:
SetPadBacklightColor(200, 81, 255);
break;
case 3:
SetPadBacklightColor(255, 205, 68);
break;
case 2:
SetPadBacklightColor(255, 79, 10);
break;
case 4:
SetPadBacklightColor(255, 255, 255);
break;
case 0:
SetPadBacklightColor(158, 214, 255);
break;
}
/* NOP */;
}
public timer function ResetPadBacklightColorTimer(optional dt : Float, o
ptional id : Int32){
super.ResetPadBacklightColor(/* NOP */);
/* NOP */;
}
public final function ResetPadBacklightColor(skipHeldWeapon : Bool){
var weapons : array<SItemUniqueId>;
var sword : CWitcherSword;

var healthPercentage : Float;


var tmpBacklight : Vector;
if (!skipHeldWeapon){
weapons = inv.GetHeldWeapons();
if (weapons.Size() > 0){
sword = (CWitcherSword)inv.GetItemEntityUnsafe(w
eapons[0]);
if (sword){
tmpBacklight.X = sword.padBacklightColor
.X / 255.000000;
tmpBacklight.Y = sword.padBacklightColor
.Y / 255.000000;
tmpBacklight.Z = sword.padBacklightColor
.Z / 255.000000;
tmpBacklight.W = 1.000000;
SetBacklightColor(tmpBacklight);
LogPS4Light("Setting light from sword te
mplate: " + NoTrailZeros(sword.padBacklightColor.X) + ", " + NoTrailZeros(sword.
padBacklightColor.Y) + ", " + NoTrailZeros(sword.padBacklightColor.Z));
return;
}
}
}
healthPercentage = GetStatPercents(0);
SetBacklightFromHealth(healthPercentage);
LogPS4Light("Setting light from health, " + NoTrailZeros(RoundMa
th(healthPercentage * 100)) + "%");
/* NOP */;
}
public function OnOpenningDoor() : Bool{
if (!thePlayer.IsUsingHorse(/* NOP */)){
RaiseEvent('OpenDoor');
}
/* NOP */;
}
public timer function RemoveQuestCameraShakeTimer(optional dt : Float, o
ptional id : Int32){
RemoveQuestCameraShake(loopingCameraShakeAnimName);
/* NOP */;
}
public function RemoveQuestCameraShake(animName : CName){
var camera : CCustomCamera;
var animation : SCameraAnimationDefinition;
camera = theGame.GetGameCamera();
camera.StopAnimation(animName);
/* NOP */;
}
public function IsPerformingPhaseChangeAnimation() : Bool{
return isPerformingPhaseChangeAnimation;
/* NOP */;
}
public function SetIsPerformingPhaseChangeAnimation(val : Bool){
isPerformingPhaseChangeAnimation = val;
/* NOP */;
}
public function SetTestAdjustRequestedMovementDirection(val : Bool){
testAdjustRequestedMovementDirection = val;
/* NOP */;
}
public function OnVisualDebug(frame : CScriptedRenderFrame, flag : EShow

Flags) : Bool{
var boneFollow : Int32;
var bonePosition : Vector;
var yrdenEntity : W3YrdenEntity;
substateManager.OnVisualDebug(frame, flag);
boneFollow = thePlayer.GetBoneIndex('Reference');
bonePosition = MatrixGetTranslation(thePlayer.GetBoneWorldMatrix
ByIndex(boneFollow));
frame.DrawText("R", bonePosition, Color(50, 200, 70));
boneFollow = thePlayer.GetBoneIndex('Trajectory');
bonePosition = MatrixGetTranslation(thePlayer.GetBoneWorldMatrix
ByIndex(boneFollow));
frame.DrawSphere(bonePosition, 0.100000, Color(200, 50, 70));
frame.DrawText("T", bonePosition, Color(200, 50, 70));
yrdenEntity = (W3YrdenEntity)GetWitcherPlayer().GetSignEntity(1)
;
yrdenEntity.OnVisualDebug(frame, flag, false);
return true;
/* NOP */;
}
public timer function PotDrinkTimer(optional dt : Float, optional id : I
nt32){
inputHandler.PotDrinkTimer(false);
/* NOP */;
}
public function SetIsHorseRacing(val : Bool){
isHorseRacing = val;
/* NOP */;
}
public function GetIsHorseRacing() : Bool{
return isHorseRacing;
/* NOP */;
}
public function SetHorseCombatSlowMo(val : Bool){
horseCombatSlowMo = val;
/* NOP */;
}
public function GetHorseCombatSlowMo() : Bool{
return horseCombatSlowMo;
/* NOP */;
}
public function SetItemsPerLevelGiven(id : Int32){
itemsPerLevelGiven[id] = true;
/* NOP */;
}
private function AddItemPerLevelList(){
var i : Int32;
itemsPerLevel.Clear();
itemsPerLevel.PushBack('O');
itemsPerLevel.PushBack('No Mans Land sword 2');
itemsPerLevel.PushBack('No Mans Land sword 3');
itemsPerLevel.PushBack('Silver sword 2');
itemsPerLevel.PushBack('Boots 01');
itemsPerLevel.PushBack('Novigraadan sword 2');
itemsPerLevel.PushBack('Light armor 01');
itemsPerLevel.PushBack('Heavy boots 01');
itemsPerLevel.PushBack('Nilfgaardian sword 3');
itemsPerLevel.PushBack('Silver sword 3');
itemsPerLevel.PushBack('Heavy gloves 01');
itemsPerLevel.PushBack('Skellige sword 2');

itemsPerLevel.PushBack('Heavy pants 01');


itemsPerLevel.PushBack('Silver sword 4');
itemsPerLevel.PushBack('No Mans Land sword 4');
itemsPerLevel.PushBack('Heavy armor 01');
itemsPerLevel.PushBack('Heavy boots 02');
itemsPerLevel.PushBack('Skellige sword 3');
itemsPerLevel.PushBack('Silver sword 5');
itemsPerLevel.PushBack('Heavy pants 02');
itemsPerLevel.PushBack('Heavy gloves 02');
itemsPerLevel.PushBack('Heavy gloves 02');
itemsPerLevel.PushBack('Heavy armor 02');
itemsPerLevel.PushBack('Scoiatael sword 1');
if (itemsPerLevelGiven.Size() < 49){
itemsPerLevelGiven.Clear();
i = 0;
while (i < itemsPerLevel.Size()){
itemsPerLevelGiven.PushBack(false);
i += 1;
}
}
/* NOP */;
}
public function DealDamageToBoat(dmg : Float, index : Int32, globalHitPo
s : Vector){
var boat : CBoatDestructionComponent;
if (usedVehicle){
boat = (CBoatDestructionComponent)usedVehicle.GetCompone
ntByClassName('CBoatDestructionComponent');
if (boat){
boat.DealDamage(dmg, index, globalHitPos);
}
}
/* NOP */;
}
public function OnStartTeleportingPlayerToPlayableArea(){
var FADEOUT_INTERVAL : Float;
FADEOUT_INTERVAL = 0.500000;
if (thePlayer.IsUsingHorse(/* NOP */)){
if (thePlayer.GetUsedHorseComponent().OnCheckHorseJump()
){
thePlayer.GetUsedHorseComponent().SetCanTakeDama
geFromFalling(false);
}
}
if (thePlayer.IsActionAllowed(5)){
OnOpenMapToLetPlayerGoBackToPlayableArea();
} else {
theGame.FadeOutAsync(FADEOUT_INTERVAL, /* NOP */);
thePlayer.AddTimer('BorderTeleportFadeOutTimer', FADEOUT
_INTERVAL, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function BorderTeleportFadeOutTimer(optional dt : Float, op
tional id : Int32){
OnTeleportPlayerToPlayableArea(false);
/* NOP */;
}
public function OnOpenMapToLetPlayerGoBackToPlayableArea(){
var initData : W3MapInitData;

initData = new W3MapInitData in this;


initData.SetTriggeredExitEntity(true);
initData.ignoreSaveSystem = true;
initData.setDefaultState('FastTravel');
theGame.RequestMenuWithBackground('MapMenu', 'CommonMenu', initD
ata);
/* NOP */;
}
public function OnTeleportPlayerToPlayableArea(afterClosingMap : Bool){
var BLACKSCREEN_INTERVAL : Float;
var manager : CCommonMapManager;
BLACKSCREEN_INTERVAL = 0.500000;
manager = theGame.GetCommonMapManager();
theGame.FadeOutAsync(0, /* NOP */);
thePlayer.TeleportWithRotation(manager.GetBorderTeleportPosition
(), manager.GetBorderTeleportRotation());
thePlayer.AddTimer('BorderTeleportFadeInTimer', BLACKSCREEN_INTE
RVAL, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function BorderTeleportFadeInTimer(optional dt : Float, opt
ional id : Int32){
var FADEIN_INTERVAL : Float;
FADEIN_INTERVAL = 0.500000;
theGame.FadeInAsync(FADEIN_INTERVAL);
/* NOP */;
}
public timer function TestTimer(optional dt : Float, optional id : Int32
){
/* NOP */;
theGame.FadeOutAsync(5, /* NOP */);
/* NOP */;
}
public final function Debug_ReleaseCriticalStateSaveLocks(){
effectManager.Debug_ReleaseCriticalStateSaveLocks();
/* NOP */;
}
public timer function Debug_SpamSpeed(optional dt : Float, optional id :
Int32){
if (currentlyMountedHorse){
LogSpeed("curr player's horse speed: " + NoTrailZeros(cu
rrentlyMountedHorse.GetMovingAgentComponent().GetSpeed()));
} else {
LogSpeed("curr player speed: " + NoTrailZeros(GetMovingA
gentComponent().GetSpeed()));
}
/* NOP */;
}
public timer function RemoveInstantKillSloMo(optional dt : Float, option
al id : Int32){
theGame.RemoveTimeScale(theGame.GetTimescaleSource(14));
/* NOP */;
}
public final function Debug_ClearAllActionLocks(action : EInputActionBlo
ck, all : Bool){
inputHandler.Debug_ClearAllActionLocks(action, all);
/* NOP */;
}
public function OnFocusedCameraBlendBegin(){
}

public function OnFocusedCameraBlendUpdate(progress : Float){


}
public function OnFocusedCameraBlendEnd(){
}
}
state W3PlayerWitcherStateCombatFists in W3PlayerWitcher extends CR4PlayerStateC
ombat{
public var action : SInputAction;
public function OnEnterState(prevStateName : CName) : Bool{
theInput.SetContext(parent.GetCombatInputContext());
super.OnEnterState(prevStateName);
parent.OnEquipMeleeWeapon(3, true, /* NOP */);
CombatFistsInit(prevStateName);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
startupAction = 0;
CombatFistsDone(nextStateName);
super.OnLeaveState(nextStateName);
/* NOP */;
}
public entry function CombatFistsInit(prevStateName : CName){
parent.SetBIsCombatActionAllowed(true);
BuildComboPlayer();
parent.LockEntryFunction(false);
switch(startupAction){
case 1:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(1, 1);
break;
case 2:
parent.SetPrevRawLeftJoyRot();
parent.SetupCombatAction(2, 1);
break;
case 3:
parent.SetupCombatAction(3, 1);
break;
case 4:
if (parent.CanSetupCombatAction_Throw()){
parent.SetupCombatAction(4, 1);
}
break;
case 5:
parent.CriticalBuffInformBehavior(startupBuff);
break;
default:
/* NOP */;
}
CombatFistsLoop();
/* NOP */;
}
public entry function CombatFistsDone(nextStateName : CName){
}
public latent function CombatFistsLoop(){
while (true){
Sleep(0.500000);
}
/* NOP */;
}

public function OnCombatActionStart() : Bool{


parent.SetCombatIdleStance(1.000000);
parent.OnCombatActionStart();
/* NOP */;
}
public function OnCombatActionEnd() : Bool{
parent.OnCombatActionEnd();
/* NOP */;
}
public function OnCombatActionEndComplete() : Bool{
super.OnCombatActionEndComplete();
/* NOP */;
}
public function OnCreateAttackAspects() : Bool{
super.CreateAttackLightNoTargetAspect();
super.CreateAttackHeavyNoTargetAspect();
super.CreateAttackLightAspect();
super.CreateAttackHeavyAspect();
super.CreateAttackLightFarAspect();
super.CreateAttackHeavyFarAspect();
/* NOP */;
}
private final function CreateAttackLightNoTargetAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightNoTarget'
);
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_attack_fast_1_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_1_rh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_2_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_2_rh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_3_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_3_rh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_4_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
1);
str.AddAttack('man_fistfight_attack_fast_1_lh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_1_rh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_2_lh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_2_rh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_3_lh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_3_rh_40ms_short', 1);
str.AddAttack('man_fistfight_attack_fast_4_lh_40ms_short', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_attack_fast_1_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_1_rh_40ms_short', 0,
1);

str.AddDirAttack('man_fistfight_attack_fast_2_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_2_rh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_3_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_3_rh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_4_lh_40ms_short', 0,
1);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
1);
str.AddAttack('man_fistfight_attack_fast_1_lh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_1_rh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_2_lh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_2_rh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_3_lh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_3_rh_40ms_short',
str.AddAttack('man_fistfight_attack_fast_4_lh_40ms_short',
/* NOP */;

1);
1);
1);
1);
1);
1);
1);

}
private final function CreateAttackHeavyNoTargetAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavyNoTarget'
);
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 1);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms', 1);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 1);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms', 1);

str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms',
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms',
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms',
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms',
/* NOP */;

1);
1);
1);
1);

}
private final function CreateAttackLightAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLight');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_close_combo_attack_1', 0, 0);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
0);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
0);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
0);
str.AddDirAttack('man_fistfight_attack_fast_1_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_1_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_2_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_2_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_3_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_3_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_4_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_5_rl_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
1);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_2_lh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_2_rh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_back_1_rh_50ms',
3, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_left_1_rh_50ms',
1, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_right_1_rh_50ms'
, 2, 2);
str.AddAttack('man_fistfight_close_combo_attack_1', 0);
str.AddAttack('man_fistfight_close_combo_attack_2', 0);
str.AddAttack('man_fistfight_close_combo_attack_3', 0);
str.AddAttack('man_fistfight_close_combo_attack_4', 0);
str.AddAttack('man_fistfight_close_combo_attack_5', 0);
str.AddAttack('man_fistfight_close_combo_attack_6', 0);
str.AddAttack('man_fistfight_attack_fast_1_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_1_rh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_2_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_2_rh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_3_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_3_rh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_4_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_5_rl_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_far_forward_1_rh_50ms',
2);

str.AddAttack('man_fistfight_attack_fast_far_forward_2_lh_50ms',
2);
str.AddAttack('man_fistfight_attack_fast_far_forward_2_rh_50ms',
2);
aspect.AddLink('man_fistfight_close_combo_attack_1', 'man_fistfi
ght_close_combo_attack_2');
aspect.AddLink('man_fistfight_close_combo_attack_2', 'man_fistfi
ght_close_combo_attack_3');
aspect.AddLink('man_fistfight_close_combo_attack_3', 'man_fistfi
ght_close_combo_attack_4');
aspect.AddLink('man_fistfight_close_combo_attack_4', 'man_fistfi
ght_close_combo_attack_5');
aspect.AddLink('man_fistfight_close_combo_attack_5', 'man_fistfi
ght_close_combo_attack_6');
aspect.AddLink('man_fistfight_close_combo_attack_6', 'man_fistfi
ght_close_combo_attack_2');
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_close_combo_attack_1', 0, 0);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
0);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
0);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
0);
str.AddDirAttack('man_fistfight_attack_fast_1_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_1_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_2_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_2_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_3_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_3_rh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_4_lh_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_5_rl_40ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_fast_back_1_lh_40ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_fast_left_1_rh_40ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_fast_right_1_rh_40ms', 2,
1);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_2_lh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_2_rh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_back_1_rh_50ms',
3, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_left_1_rh_50ms',
1, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_right_1_rh_50ms'
, 2, 2);
str.AddAttack('man_fistfight_close_combo_attack_1', 0);
str.AddAttack('man_fistfight_close_combo_attack_2', 0);
str.AddAttack('man_fistfight_close_combo_attack_3', 0);
str.AddAttack('man_fistfight_close_combo_attack_4', 0);
str.AddAttack('man_fistfight_close_combo_attack_5', 0);
str.AddAttack('man_fistfight_close_combo_attack_6', 0);
str.AddAttack('man_fistfight_attack_fast_1_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_1_rh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_2_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_2_rh_40ms', 1);

str.AddAttack('man_fistfight_attack_fast_3_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_3_rh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_4_lh_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_5_rl_40ms', 1);
str.AddAttack('man_fistfight_attack_fast_far_forward_1_rh_50ms',
2);
str.AddAttack('man_fistfight_attack_fast_far_forward_2_lh_50ms',
2);
str.AddAttack('man_fistfight_attack_fast_far_forward_2_rh_50ms',
2);
aspect.AddLink('man_fistfight_close_combo_attack_1', 'man_fistfi
ght_close_combo_attack_2');
aspect.AddLink('man_fistfight_close_combo_attack_2', 'man_fistfi
ght_close_combo_attack_3');
aspect.AddLink('man_fistfight_close_combo_attack_3', 'man_fistfi
ght_close_combo_attack_4');
aspect.AddLink('man_fistfight_close_combo_attack_4', 'man_fistfi
ght_close_combo_attack_5');
aspect.AddLink('man_fistfight_close_combo_attack_5', 'man_fistfi
ght_close_combo_attack_6');
aspect.AddLink('man_fistfight_close_combo_attack_6', 'man_fistfi
ght_close_combo_attack_2');
/* NOP */;
}
private final function CreateAttackHeavyAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavy');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
0);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
0);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 0);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_4_ll_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 1);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_rh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_2_ll_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_back_1_rh_80ms'
, 3, 2);

str.AddDirAttack('man_fistfight_attack_heavy_far_left_1_rh_80ms'
, 1, 2);
str.AddDirAttack('man_fistfight_attack_heavy_far_right_1_rh_80ms
', 2, 2);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_4_ll_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_4_ll_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2);
str.AddAttack('man_fistfight_attack_heavy_far_1_rh_80ms', 2);
str.AddAttack('man_fistfight_attack_heavy_far_2_ll_80ms', 2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 0);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
0);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
0);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 0);
str.AddDirAttack('man_fistfight_attack_heavy_1_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_1_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_2_rh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_3_lh_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_4_ll_70ms', 0, 1);
str.AddDirAttack('man_fistfight_attack_heavy_back_1_rh_70ms', 3,
1);
str.AddDirAttack('man_fistfight_attack_heavy_left_1_rh_70ms', 1,
1);
str.AddDirAttack('man_fistfight_attack_heavy_right_1_lh_70ms', 2
, 1);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_rh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_2_ll_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_back_1_rh_80ms'
, 3, 2);
str.AddDirAttack('man_fistfight_attack_heavy_far_left_1_rh_80ms'
, 1, 2);
str.AddDirAttack('man_fistfight_attack_heavy_far_right_1_rh_80ms
', 2, 2);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms',
str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms',
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms',
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms',
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms',

0);
0);
0);
0);
0);

str.AddAttack('man_fistfight_attack_heavy_4_ll_70ms', 0);
str.AddAttack('man_fistfight_attack_heavy_1_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_1_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_2_rh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_3_lh_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_4_ll_70ms', 1);
str.AddAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2);
str.AddAttack('man_fistfight_attack_heavy_far_1_rh_80ms', 2);
str.AddAttack('man_fistfight_attack_heavy_far_2_ll_80ms', 2);
/* NOP */;

s', 0,
s', 3,
s', 1,
s', 2,

}
private final function CreateAttackLightFarAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackLightFar');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
2);
str.AddAttack('man_fistfight_attack_fast_far_forward_1_rh_50ms',

2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 0, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 3, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 1, 2);
str.AddDirAttack('man_fistfight_attack_fast_far_forward_1_rh_50m
s', 2, 2);
str.AddAttack('man_fistfight_attack_fast_far_forward_1_rh_50ms',
2);
/* NOP */;
}
private final function CreateAttackHeavyFarAspect(){
var aspect : CComboAspect;
var str : CComboString;
aspect = comboDefinition.CreateComboAspect('AttackHeavyFar');
str = aspect.CreateComboString(false);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 3,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 1,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2,
2);
str.AddAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2);
str = aspect.CreateComboString(true);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 0,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 3,
2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 1,

2);
str.AddDirAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2,
2);
str.AddAttack('man_fistfight_attack_heavy_far_1_lh_80ms', 2);
/* NOP */;
}
public function OnGuardedReleased() : Bool{
}
public function OnUnconsciousEnd() : Bool{
parent.OnUnconsciousEnd();
/* NOP */;
}
}
statemachine class W3NPCBackgroundPair extends CGameplayEntity{
public editable var work : EBackgroundNPCWork_Paired;
public editable var entitiesToSpawn : array<SBackgroundPairSpawnedEntity
>;
private var spawnedEntities : array<CEntity>;
private var currentAttachments : array<CEntity>;
public var slave : W3NPCBackground;
public var master : W3NPCBackground;
public editable var mountEvents : array<SMountEvent>;
public var masterAC : CAnimatedComponent;
public var slaveAC : CAnimatedComponent;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var i : Int32;
var tmp : Vector;
var newMaster : W3NPCBackground;
var newSlave : W3NPCBackground;
if (work == 0){
LogAssert(false, "W3NPCBackgroundPair.OnSpawned : <<" +
this + ">> has no work type chosen, aborting!");
return false;
}
super.OnSpawned(spawnData);
spawnedEntities.Grow(entitiesToSpawn.Size());
currentAttachments.Grow(entitiesToSpawn.Size());
i = 0;
while (i < entitiesToSpawn.Size()){
spawnedEntities[i] = theGame.CreateEntity(entitiesToSpaw
n[i].entityTemplate, tmp, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
spawnedEntities[i].CreateAttachment(this, entitiesToSpaw
n[i].slotName, /* NOP */, /* NOP */);
currentAttachments[i] = this;
if (!spawnedEntities[i]){
LogAssert(false, "W3NPCBackgroundPair.OnSpawned:
pair <<" + this + ">> cannot find slot <<" + entitiesToSpawn[i].slotName + ">>,
skipping!");
} else {
LogBgNPC("Initial spawn : pair <<" + this + ">>
spawned <<" + spawnedEntities[i] + ">> on slot <<" + entitiesToSpawn[i].slotName
+ ">>");
if (entitiesToSpawn[i].referenceName == 'master'
){
newMaster = (W3NPCBackground)spawnedEnti
ties[i];
if (!newMaster){
LogAssert(false, "W3NPCBackgroun

dPair.OnSpawned: pair <<" + this + ">> master entity must be of class W3NPCBackg
round - aborting!");
return false;
}
if (master){
LogAssert(false, "W3NPCBackgroun
dPair.OnSpawned: pair <<" + this + ">> master entity is defined more than once aborting!");
return false;
}
master = newMaster;
master.SetParentPairedBackgroundNPCEntit
y(this);
masterAC = (CAnimatedComponent)master.Ge
tComponent('man_base');
if (!masterAC){
LogAssert(false, "W3NPCBackgroun
dPair.OnSpawned: pair <<" + this + ">> master's root animated component not foun
d! Make sure it's named 'man_base' - aborting!");
return false;
}
} else if (entitiesToSpawn[i].referenceName == '
slave'){
newSlave = (W3NPCBackground)spawnedEntit
ies[i];
if (!newSlave){
LogAssert(false, "W3NPCBackgroun
dPair.OnSpawned: pair <<" + this + ">> slave entity must be of class W3NPCBackgr
ound - aborting!");
return false;
}
if (slave){
LogAssert(false, "W3NPCBackgroun
dPair.OnSpawned: pair <<" + this + ">> slave entity is defined more than once aborting!");
return false;
}
slave = newSlave;
slave.SetParentPairedBackgroundNPCEntity
(this);
slaveAC = (CAnimatedComponent)slave.GetC
omponent('man_base');
if (!slaveAC){
LogAssert(false, "W3NPCBackgroun
dPair.OnSpawned: pair <<" + this + ">> slave's root animated component not found
! Make sure it's named 'man_base' - aborting!");
return false;
}
}
}
i += 1;
}
LogAssert(master, "W3NPCBackgroundPair.OnSpawned: cannot find ma
ster entity in <<" + this + ">> - aborting!!!");
LogAssert(slave, "W3NPCBackgroundPair.OnSpawned: cannot find sla
ve entity in <<" + this + ">> - aborting!!!");
if (!master || !slave){
return false;
}
masterAC.SetBehaviorVariable('isMaster', 1.000000);

slaveAC.SetBehaviorVariable('isMaster', 0.000000);
masterAC.SetBehaviorVariable('WorkTypeEnum_Paired', work);
slaveAC.SetBehaviorVariable('WorkTypeEnum_Paired', work);
PushState('DoWork');
/* NOP */;
}
public function AttachEntityToSlotRegardlessOfSlotType(i : Int32, slotNa
me : CName, entityContainingSlot : EBgNPCType) : Bool{
var slotEntity : CEntity;
var ret : Bool;
switch(entityContainingSlot){
case 0:
slotEntity = this;
break;
case 1:
slotEntity = master;
break;
case 2:
slotEntity = slave;
break;
}
if (currentAttachments[i] != slotEntity){
spawnedEntities[i].BreakAttachment();
}
ret = spawnedEntities[i].CreateAttachment(slotEntity, slotName,
/* NOP */, /* NOP */);
if (ret){
currentAttachments[i] = slotEntity;
} else {
LogAssert(false, "W3NPCBackgroundPair.OnAnimEvent: bg en
tity <<" + this + ">> :: entity <<" + spawnedEntities[i] + ">> did not get attac
hed to slot <<" + slotName + ">> of <<" + slotEntity + ">> !!!");
}
return ret;
/* NOP */;
}
public function IncomingAnimEvent(eventName : CName){
var i : Int32;
var j : Int32;
var knownEvent : Bool;
var knownEntity : Bool;
knownEvent = false;
j = 0;
while (j < mountEvents.Size()){
if (eventName == mountEvents[j].animEventName){
knownEvent = true;
knownEntity = false;
i = 0;
while (i < entitiesToSpawn.Size()){
if (mountEvents[j].entityReferenceName =
= entitiesToSpawn[i].referenceName){
knownEntity = true;
AttachEntityToSlotRegardlessOfSl
otType(i, mountEvents[j].newSlotName, mountEvents[j].entityContainingSlot);
LogBgNPC("Event mount - pair <<"
+ this + ">> got event <<" + eventName + ">> : mounting <<" + spawnedEntities[i
] + ">> to slot <<" + mountEvents[j].newSlotName + ">> of <<" + mountEvents[j].e
ntityContainingSlot + ">>");
break;
}

i += 1;
}
if (!knownEntity){
LogAssert(false, "W3NPCBackgroundPair.On
AnimEvent: <<" + this + ">> unknown entity with reference name = <<" + mountEven
ts[j].entityReferenceName + ">> - nothing done!");
}
}
j += 1;
}
if (!knownEvent){
LogAssert(false, "W3NPCBackgroundPair.OnAnimEvent: <<" +
this + ">> unknown anim event called <<" + eventName + ">> - nothing done!");
}
/* NOP */;
}
}
class W3NPCBackground extends CGameplayEntity{
public editable var work : EBackgroundNPCWork_Single;
private var parentPairedBackgroundNPCEntity : W3NPCBackgroundPair;
private var isWorkingSingle : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
if (!parentPairedBackgroundNPCEntity){
isWorkingSingle = true;
SetBehaviorVariable('WorkTypeEnum_Single', work, /* NOP
*/);
}
/* NOP */;
}
public function SetParentPairedBackgroundNPCEntity(ent : W3NPCBackground
Pair){
parentPairedBackgroundNPCEntity = ent;
if (isWorkingSingle){
isWorkingSingle = false;
SetBehaviorVariable('WorkTypeEnum_Single', 0, /* NOP */)
;
}
/* NOP */;
}
}
import abstract class CSwarmSoundEmitterComponent{
}
import abstract class CBehTreeNodeEvaluatingChoiceDefinition{
}
import abstract class CBehTreeDecoratorSteeringGraphDefinition{
}
import abstract class CBehTreeNodeDecoratorSetSteeringCustomPositionDefinition{
}
import abstract class CBehTreeNodeBaseAtomicPursueTargetDefinition{
}
import abstract class CBehTreeNodeFollowFormationDefinition{
}

import abstract class CBehTreeNodeCombatFollowFormationDefinition{


}
import abstract class CBehTreeNodeUseExplorationActionDefinition{
}
import abstract class CBehTreeNodeTeleportToMetalinkDestinationDefinition{
}
import abstract class CBehTreeNodeConditionExternalToggleDefinition{
}
import abstract class CBehTreeNodeConditionDistanceToTaggedDefinition{
}
import abstract class CBehTreeNodeConditionCheckRotationToNamedTargetDefinition{
}
import abstract class CBehTreeNodeReactionSceneDefinitionDecorator{
}
import abstract class CBehTreeNodeReactionSceneAssignActorNodeDefinition{
}
import abstract class CBehTreeNodeReactionSceneFlowControllerDefinition{
}
import abstract class CBehTreeNodeReactionSFlowSynchroDecoratorDefinition{
}
import abstract class CBehTreeNodeReactionSceneAssignmentsDefinition{
}
import abstract class CBehTreeNodeReactionSceneEndNodeDefinition{
}
import abstract class IBehTreeNodeConditionalBaseNodeDefinition{
}
import abstract class CBehTreeNodeConditionalNodeDefinition{
}
import abstract class CBehTreeNodeConditionalNameNodeDefinition{
}
import abstract class CBehTreeMetanodeScriptOnSpawnDefinition{
}
import abstract class CBehTreeMetanodeSetupGuardDefinition{
}
import abstract class CEncounterGlobalSettings{
}
import abstract class CPartySpreadOrganizer{
}
class W3Potion_Blizzard extends CBaseGameplayEffect{
private saved var slowdownCauserIds : array<Int32>;
private var slowdownFactor : Float;

private var currentSlowMoDuration : Float;


private const var SLOW_MO_DURATION : Float;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
super.OnEffectAdded(customParams);
slowdownFactor = CalculateAttributeValue(effectValue, /* NOP */)
;
/* NOP */;
}
public function KilledEnemy(){
if (slowdownCauserIds.Size() == 0){
theGame.SetTimeScale(slowdownFactor, theGame.GetTimescal
eSource(1), theGame.GetTimescalePriority(1), /* NOP */, /* NOP */);
slowdownCauserIds.PushBack(target.SetAnimationSpeedMulti
plier(1 / slowdownFactor, /* NOP */));
}
currentSlowMoDuration = 0.000000;
/* NOP */;
}
public function OnLoad(t : CActor, eff : W3EffectManager){
super.OnLoad(t, eff);
super.RemoveSlowMo();
/* NOP */;
}
public function OnTimeUpdated(dt : Float){
if (slowdownCauserIds.Size() > 0){
super.OnTimeUpdated(dt / slowdownFactor);
currentSlowMoDuration += dt / slowdownFactor;
if (currentSlowMoDuration > SLOW_MO_DURATION){
super.RemoveSlowMo();
}
} else {
super.OnTimeUpdated(dt);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
super.RemoveSlowMo();
super.OnEffectRemoved();
/* NOP */;
}
private final function RemoveSlowMo(){
var i : Int32;
i = 0;
while (i < slowdownCauserIds.Size()){
target.ResetAnimationSpeedMultiplier(slowdownCauserIds[i
]);
i += 1;
}
theGame.RemoveTimeScale(theGame.GetTimescaleSource(1));
slowdownCauserIds.Clear();
/* NOP */;
}
}
import abstract class CReactionLookAtAction{
}
import abstract class CReactionVoiceAction{
}

import abstract class CStorySceneOverridePlacementBlend{


}
class W3PlayerTutorialInput extends CPlayerInput{
public function Initialize(isFromLoad : Bool, previousInput : CPlayerInp
ut){
var exceptions : array<EInputActionBlock>;
super.Initialize(isFromLoad, previousInput);
if (!theGame.GetTutorialSystem().HasSeenTutorial('TutorialMoveme
nt')){
theInput.RegisterListener(this, 'OnMovement', 'GI_AxisLe
ftY');
theInput.RegisterListener(this, 'OnMovement', 'GI_AxisLe
ftX');
}
if (!theGame.GetTutorialSystem().HasSeenTutorial('TutorialCamera
')){
theInput.RegisterListener(this, 'OnCameraMovement', 'GI_
AxisRightX');
theInput.RegisterListener(this, 'OnCameraMovement', 'GI_
AxisRightY');
theInput.RegisterListener(this, 'OnCameraMovement', 'GI_
MouseDampX');
theInput.RegisterListener(this, 'OnCameraMovement', 'GI_
MouseDampY');
}
if (!isFromLoad){
exceptions.PushBack(14);
exceptions.PushBack(6);
exceptions.PushBack(21);
exceptions.PushBack(22);
exceptions.PushBack(12);
}
/* NOP */;
}
public function OnCbtThrowItem(action : SInputAction) : Bool{
var ret : Bool;
ret = super.OnCbtThrowItem(action);
if (ret){
if (thePlayer.inv.IsItemCrossbow(thePlayer.GetSelectedIt
emId())){
FactsAdd("tut_crossbow_shot", 1, 1);
} else if (thePlayer.inv.IsItemBomb(thePlayer.GetSelecte
dItemId())){
FactsAdd("tut_bomb_shot", 1, 1);
}
}
return ret;
/* NOP */;
}
public function OnCbtThrowItemHold(action : SInputAction) : Bool{
var ret : Bool;
ret = super.OnCbtThrowItemHold(action);
if (ret){
if (thePlayer.inv.IsItemCrossbow(thePlayer.GetSelectedIt
emId())){
FactsAdd("tut_crossbow_shot", 1, 1);
} else if (thePlayer.inv.IsItemBomb(thePlayer.GetSelecte
dItemId())){
FactsAdd("tut_bomb_shot", 1, 1);

}
}
return ret;
/* NOP */;
}
public function OnMovement(action : SInputAction) : Bool{
FactsAdd("tutorial_player_moved", /* NOP */, /* NOP */);
theInput.UnregisterListener(this, 'GI_AxisLeftY');
theInput.UnregisterListener(this, 'GI_AxisLeftX');
/* NOP */;
}
public function OnCameraMovement(action : SInputAction) : Bool{
FactsAdd("tutorial_camera_moved", /* NOP */, /* NOP */);
theInput.UnregisterListener(this, 'GI_AxisRightX');
theInput.UnregisterListener(this, 'GI_AxisRightY');
theInput.UnregisterListener(this, 'GI_MouseDampX');
theInput.UnregisterListener(this, 'GI_MouseDampY');
/* NOP */;
}
public function OnCastSign(action : SInputAction) : Bool{
super.OnCastSign(action);
super.SignStaminaTest();
/* NOP */;
}
private final function SignStaminaTest(){
var signSkill : ESkill;
if (ShouldProcessTutorial('TutorialStaminaSigns')){
signSkill = SignEnumToSkillEnum(thePlayer.GetEquippedSig
n());
if (signSkill != 0 && !thePlayer.HasStaminaToUseSkill(si
gnSkill, false, /* NOP */)){
FactsAdd("tut_stamina_sign", /* NOP */, /* NOP *
/);
}
}
/* NOP */;
}
}
import abstract class CQuestFactsDBExCondition{
}
import abstract class CQCActorInventory{
}
class CR4HudModuleCrosshair extends CR4HudModuleBase{
public function OnConfigUI() : Bool{
m_anchorName = "mcAnchorCrosshair";
super.OnConfigUI();
/* NOP */;
}
}
import abstract class SItemUniqueIdGenerator{
}
import abstract class CJournalInitialEntriesResource{
}
class CActionLockerByCounter extends CObject{

private saved var lockingNum : Int32;


private var action : EInputActionBlock;
private var lockName : CName;
public function Init(blockingAction : EInputActionBlock, blockingName :
CName){
action = blockingAction;
lockName = blockingName;
/* NOP */;
}
public function Reset(){
lockingNum = 0;
if (thePlayer){
thePlayer.UnblockAction(action, lockName);
}
/* NOP */;
}
public function Lock(lock : Bool){
if (lock){
if (lockingNum == 0){
thePlayer.BlockAction(action, lockName, false, f
alse, true);
}
lockingNum = Max(lockingNum + 1, 1);
} else {
if (lockingNum == 1){
thePlayer.UnblockAction(action, lockName);
}
lockingNum = Max(lockingNum - 1, 0);
}
/* NOP */;
}
}
import abstract class CBehaviorConstraintCalcAdSetOffsetForPelvis{
}
class CR4HudModuleCompanion extends CR4HudModuleBase{
private var m_fxSetNameSFF : CScriptedFlashFunction;
private var m_fxSetPortraitSFF : CScriptedFlashFunction;
private var m_fxSetVitalitySFF : CScriptedFlashFunction;
private var m_fxSetName2SFF : CScriptedFlashFunction;
private var m_fxSetPortrait2SFF : CScriptedFlashFunction;
private var m_fxSetVitality2SFF : CScriptedFlashFunction;
private var bShow : Bool;
private var m_LastVitality : Float;
private var m_LastMaxVitality : Float;
private var m_LastVitality2 : Float;
private var m_LastMaxVitality2 : Float;
private var companionNPC : CNewNPC;
private var companionNPC2 : CNewNPC;
private var companionName : String;
private var companionName2 : String;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
var playerWitcher : W3PlayerWitcher;
playerWitcher = GetWitcherPlayer();
m_anchorName = "mcAnchorCompanion";
super.OnConfigUI();
flashModule = GetModuleFlash();

m_fxSetNameSFF = flashModule.GetMemberFlashFunction("setName");
m_fxSetPortraitSFF = flashModule.GetMemberFlashFunction("setPort
rait");
m_fxSetVitalitySFF = flashModule.GetMemberFlashFunction("setVita
lity");
m_fxSetName2SFF = flashModule.GetMemberFlashFunction("setName2")
;
m_fxSetPortrait2SFF = flashModule.GetMemberFlashFunction("setPor
trait2");
m_fxSetVitality2SFF = flashModule.GetMemberFlashFunction("setVit
ality2");
m_fxSetPortraitSFF.InvokeSelfOneArg(FlashArgString("icons/monste
rs/ICO_MonsterDefault.png"));
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('CompanionModule', true);
}
SetTickInterval(0.500000);
/* NOP */;
}
public function ShowCompanion(showModule : Bool, npcTag : CName, iconPat
h : String){
var playerWitcher : W3PlayerWitcher;
playerWitcher = GetWitcherPlayer();
if (!playerWitcher){
return;
}
if (showModule){
playerWitcher.SetCompanionNPCTag(npcTag);
playerWitcher.SetCompanionNPCIconPath(iconPath);
companionNPC = theGame.GetNPCByTag(npcTag);
if (companionNPC){
bShow = showModule;
ShowElement(showModule, /* NOP */);
if (iconPath == ""){
m_fxSetPortraitSFF.InvokeSelfOneArg(Flas
hArgString("icons/monsters/ICO_MonsterDefault.png"));
} else {
m_fxSetPortraitSFF.InvokeSelfOneArg(Flas
hArgString(iconPath));
}
companionName = companionNPC.GetDisplayName(/* N
OP */);
if (companionName == ""){
playerWitcher.AddTimer('ResendCompanionD
isplayName', 0.200000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_fxSetNameSFF.InvokeSelfOneArg(FlashArg
String(""));
} else {
m_fxSetNameSFF.InvokeSelfOneArg(FlashArg
String(companionName));
playerWitcher.RemoveCompanionDisplayName
Timer();
}
}
} else {
bShow = showModule;
ShowElement(showModule, /* NOP */);
playerWitcher.SetCompanionNPCIconPath("");
playerWitcher.SetCompanionNPCTag('None');

companionNPC = NULL;
playerWitcher.RemoveCompanionDisplayNameTimer();
}
m_fxSetPortrait2SFF.InvokeSelfOneArg(FlashArgString(""));
playerWitcher.SetCompanionNPCIconPath2("");
/* NOP */;
}
public function ShowCompanionSecond(npcTag : CName, iconPath : String){
var playerWitcher : W3PlayerWitcher;
playerWitcher = GetWitcherPlayer();
if (!playerWitcher){
return;
}
if (bShow){
playerWitcher.SetCompanionNPCTag2(npcTag);
playerWitcher.SetCompanionNPCIconPath(iconPath);
companionNPC2 = theGame.GetNPCByTag(npcTag);
if (companionNPC2){
if (iconPath == ""){
m_fxSetPortrait2SFF.InvokeSelfOneArg(Fla
shArgString(""));
} else {
m_fxSetPortrait2SFF.InvokeSelfOneArg(Fla
shArgString(iconPath));
}
companionName2 = companionNPC2.GetDisplayName(/*
NOP */);
if (companionName2 == ""){
playerWitcher.AddTimer('ResendCompanionD
isplayNameSecond', 0.200000, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_fxSetName2SFF.InvokeSelfOneArg(FlashAr
gString(""));
} else {
m_fxSetName2SFF.InvokeSelfOneArg(FlashAr
gString(companionName2));
playerWitcher.RemoveCompanionDisplayName
TimerSecond();
}
}
} else {
playerWitcher.SetCompanionNPCIconPath2("");
playerWitcher.SetCompanionNPCTag2('None');
companionNPC2 = NULL;
playerWitcher.RemoveCompanionDisplayNameTimerSecond();
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var playerWitcher : W3PlayerWitcher;
playerWitcher = GetWitcherPlayer();
if (!playerWitcher){
return true;
}
if (bShow){
UpdateVitality();
UpdateVitality2();
}
if (!CanTick(timeDelta)){
return true;
}

if (!bShow){
if (playerWitcher.GetCompanionNPCTag() != 'None' && !com
panionNPC){
ShowCompanion(true, playerWitcher.GetCompanionNP
CTag(), playerWitcher.GetCompanionNPCIconPath());
}
if (playerWitcher.GetCompanionNPCTag2() != 'None' && !co
mpanionNPC2){
ShowCompanionSecond(playerWitcher.GetCompanionNP
CTag2(), playerWitcher.GetCompanionNPCIconPath2());
}
}
/* NOP */;
}
public function ResendDisplayName(){
companionNPC = theGame.GetNPCByTag(GetWitcherPlayer().GetCompani
onNPCTag());
if (companionNPC){
companionName = companionNPC.GetDisplayName(/* NOP */);
if (companionName != ""){
GetWitcherPlayer().RemoveCompanionDisplayNameTim
er();
m_fxSetNameSFF.InvokeSelfOneArg(FlashArgString(c
ompanionName));
}
}
/* NOP */;
}
public function ResendDisplayNameSecond(){
companionNPC2 = theGame.GetNPCByTag(GetWitcherPlayer().GetCompan
ionNPCTag2());
if (companionNPC2){
companionName2 = companionNPC2.GetDisplayName(/* NOP */)
;
if (companionName2 != ""){
GetWitcherPlayer().RemoveCompanionDisplayNameTim
erSecond();
m_fxSetName2SFF.InvokeSelfOneArg(FlashArgString(
companionName2));
}
}
/* NOP */;
}
public function UpdateVitality(){
var l_currentVitality : Float;
var l_currentMaxVitality : Float;
if (companionNPC){
companionNPC.GetStats(0, l_currentVitality, l_currentMax
Vitality);
if (l_currentVitality != m_LastVitality || l_currentMaxV
itality != m_LastMaxVitality){
m_fxSetVitalitySFF.InvokeSelfOneArg(FlashArgNumb
er(l_currentVitality / l_currentMaxVitality));
m_LastVitality = l_currentVitality;
m_LastMaxVitality = l_currentMaxVitality;
}
}
/* NOP */;
}
public function UpdateVitality2(){

var l_currentVitality : Float;


var l_currentMaxVitality : Float;
if (companionNPC2){
companionNPC2.GetStats(0, l_currentVitality, l_currentMa
xVitality);
if (l_currentVitality != m_LastVitality2 || l_currentMax
Vitality != m_LastMaxVitality2){
m_fxSetVitality2SFF.InvokeSelfOneArg(FlashArgNum
ber(l_currentVitality / l_currentMaxVitality));
m_LastVitality2 = l_currentVitality;
m_LastMaxVitality2 = l_currentMaxVitality;
}
}
/* NOP */;
}
}
statemachine class WeaponHolster extends CObject{
private saved var currentMeleeWeapon : EPlayerWeapon;
protected var queuedMeleeWeapon : EPlayerWeapon;
protected var isQueuedMeleeWeapon : Bool;
protected saved var ownerHandle : EntityHandle;
public var automaticUnholster : Bool;
protected var isMeleeWeaponReady : Bool;
public function OnEquipMeleeWeapon(weapontype : EPlayerWeapon, ignoreAct
ionLock : Bool, sheatheIfAlreadyEquipped : Bool, forceHolster : Bool) : Bool{
}
public function OnEquippedMeleeWeapon(weapontype : EPlayerWeapon) : Bool
{
}
public function OnWeaponDrawReady() : Bool{
}
public function OnWeaponHolsterReady() : Bool{
}
public function OnHolsterLeftHandItem() : Bool{
}
public function Initialize(_owner : CActor, restored : Bool){
var item : SItemUniqueId;
EntityHandleSet(ownerHandle, _owner);
if (!restored){
SetCurrentMeleWeapon(0);
queuedMeleeWeapon = 0;
isQueuedMeleeWeapon = false;
isMeleeWeaponReady = true;
PushState('SelectingWeapon');
} else {
isQueuedMeleeWeapon = false;
isMeleeWeaponReady = true;
queuedMeleeWeapon = 0;
PushState('SelectingWeapon');
}
/* NOP */;
}
protected function SetCurrentMeleWeapon(weapon : EPlayerWeapon){
if (currentMeleeWeapon != weapon){
currentMeleeWeapon = weapon;
}
/* NOP */;
}
public function UpdateRealWeapon(){

var weaponHeld : EPlayerWeapon;


if (thePlayer.IsWeaponHeld('fist')){
weaponHeld = 3;
} else if (thePlayer.IsWeaponHeld('silversword')){
weaponHeld = 2;
} else if (thePlayer.IsWeaponHeld('steelsword') || thePlayer.IsW
eaponHeld('playerSecondary')){
weaponHeld = 1;
} else {
weaponHeld = 0;
}
if (weaponHeld != 0 && (W3ReplacerCiri)thePlayer){
weaponHeld = 1;
}
SetCurrentMeleWeapon(weaponHeld);
/* NOP */;
}
protected function GetOwner() : CActor{
return (CActor)EntityHandleGet(ownerHandle);
/* NOP */;
}
public function HolsterWeapon(ignoreActionLock : Bool, forceHolster : Bo
ol){
var curWeapon : EPlayerWeapon;
curWeapon = GetCurrentMeleeWeapon();
if (curWeapon == 0){
return;
}
OnEquipMeleeWeapon(curWeapon, ignoreActionLock, true, forceHolst
er);
/* NOP */;
}
public function OnForcedHolsterWeapon() : Bool{
SetCurrentMeleWeapon(0);
UpdateBehGraph(/* NOP */);
/* NOP */;
}
public function GetCurrentMeleeWeapon() : EPlayerWeapon{
return currentMeleeWeapon;
/* NOP */;
}
public function GetCurrentMeleeWeaponName() : CName{
return GetWeaponCategoryName(currentMeleeWeapon);
/* NOP */;
}
public function TryToPrepareMeleeWeaponToAttack() : Bool{
if (isMeleeWeaponReady){
thePlayer.RaiseEvent('SwitchWeaponEnd');
}
return isMeleeWeaponReady;
/* NOP */;
}
public function IsOnTheMiddleOfHolstering() : Bool{
return !isMeleeWeaponReady;
/* NOP */;
}
public function IsMeleeWeaponReady() : Bool{
return isMeleeWeaponReady;
/* NOP */;
}

public function EndedCombat(){


if (GetCurrentMeleeWeapon() == 3){
OnEquipMeleeWeapon(0, true, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function GetMostConvenientMeleeWeapon(targetToDrawAgainst : CActo
r, ignoreActionLock : Bool) : EPlayerWeapon{
var ret : EPlayerWeapon;
var inv : CInventoryComponent;
var heldItems : array<CName>;
var mountedItems : array<CName>;
var hasPhysicalWeapon : Bool;
var i : Int32;
var npc : CNewNPC;
if ((W3ReplacerCiri)thePlayer){
if (targetToDrawAgainst){
return 1;
} else {
return 0;
}
}
if (!automaticUnholster){
return 3;
}
if (!targetToDrawAgainst){
return 3;
}
targetToDrawAgainst.GetInventory().GetAllHeldAndMountedItemsCate
gories(heldItems, mountedItems);
if (heldItems.Size() > 0){
i = 0;
while (i < heldItems.Size()){
if (heldItems[i] != 'fist'){
hasPhysicalWeapon = true;
break;
}
i += 1;
}
}
if (!hasPhysicalWeapon && targetToDrawAgainst.GetInventory().Has
HeldOrMountedItemByTag('ForceMeleeWeapon')){
hasPhysicalWeapon = true;
}
npc = (CNewNPC)targetToDrawAgainst;
if (targetToDrawAgainst.IsHuman() && !hasPhysicalWeapon || targe
tToDrawAgainst.GetAttitude(thePlayer) != 2){
ret = 3;
} else if (npc.IsHorse() && !npc.GetHorseComponent().IsDismounte
d()){
ret = 3;
} else if (targetToDrawAgainst.UsesVitality()){
ret = 1;
} else if (targetToDrawAgainst.UsesEssence()){
ret = 2;
} else {
LogAssert(false, "CR4Player.weaponHolsterSelectWeaponToD
raw: target has neither vitality nor essesnce - don't know which weapon to use!"
);
ret = 3;

}
inv = GetOwner().GetInventory();
if (ret == 1 && !GetWitcherPlayer().IsItemEquippedByCategoryName
('steelsword')){
ret = 3;
} else if (ret == 2 && !GetWitcherPlayer().IsItemEquippedByCateg
oryName('silversword')){
ret = 3;
}
if (thePlayer.IsWeaponActionAllowed(ret) || ignoreActionLock){
return ret;
} else {
return 0;
}
/* NOP */;
}
protected function IsThisWeaponAlreadyEquipped(weaponType : EPlayerWeapo
n) : Bool{
if (weaponType == GetCurrentMeleeWeapon()){
return true;
}
return false;
/* NOP */;
}
protected function GetWeaponCategoryName(weaponType : EPlayerWeapon) : C
Name{
switch(weaponType){
case 1:
return 'steelsword';
case 2:
return 'silversword';
case 3:
return 'fist';
case 0:
default:
}
return 'None';
/* NOP */;
}
protected function QueueMeleeWeapon(weapontype : EPlayerWeapon, sheatheI
fAlreadyEquipped : Bool){
if (sheatheIfAlreadyEquipped && weapontype == 2 || weapontype ==
1){
if (IsThisWeaponAlreadyEquipped(weapontype)){
weapontype = 0;
}
}
queuedMeleeWeapon = weapontype;
isQueuedMeleeWeapon = true;
/* NOP */;
}
protected function IsWeaponQueued() : Bool{
return isQueuedMeleeWeapon;
/* NOP */;
}
protected function UnqueueMeleeWeapon(){
isQueuedMeleeWeapon = false;
/* NOP */;
}
protected function EquipQueuedMeleeWeaponIfAny() : Bool{

if (!isQueuedMeleeWeapon){
return false;
}
if (queuedMeleeWeapon == GetCurrentMeleeWeapon()){
isQueuedMeleeWeapon = false;
return false;
}
OnEquipMeleeWeapon(queuedMeleeWeapon, true, /* NOP */, /* NOP */
);
return true;
/* NOP */;
}
public function UpdateBehGraph(init : Bool){
var weapontype : EPlayerWeapon;
var item : SItemUniqueId;
var res : Bool;
var inv : CInventoryComponent;
var tags : array<CName>;
weapontype = GetCurrentMeleeWeapon();
if (weapontype == 0){
weapontype = 3;
}
thePlayer.SetBehaviorVariable('WeaponType', 0, /* NOP */);
if (!GetWitcherPlayer() && weapontype == 3 && thePlayer.IsInComb
at()){
thePlayer.SetBehaviorVariable('playerWeapon', 1, /* NOP
*/);
thePlayer.SetBehaviorVariable('playerWeaponForOverlay',
1, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('playerWeapon', weapontype
, /* NOP */);
thePlayer.SetBehaviorVariable('playerWeaponForOverlay',
weapontype, /* NOP */);
}
if (thePlayer.IsUsingHorse(/* NOP */)){
thePlayer.SetBehaviorVariable('isOnHorse', 1.000000, /*
NOP */);
} else {
thePlayer.SetBehaviorVariable('isOnHorse', 0.000000, /*
NOP */);
}
if (GetWitcherPlayer()){
inv = thePlayer.GetInventory();
if (GetWitcherPlayer().GetItemEquippedOnSlot(2, item)){
inv.GetItemTags(item, tags);
if (tags.Contains('SecondaryWeapon')){
thePlayer.SetBehaviorVariable('secondary
WeaponForOverlay', 1.000000, /* NOP */);
} else {
thePlayer.SetBehaviorVariable('secondary
WeaponForOverlay', 0.000000, /* NOP */);
}
} else {
item = inv.GetItemFromSlot('r_weapon');
inv.GetItemTags(item, tags);
if (inv.IsIdValid(item) && tags.Contains('Second
aryWeapon')){
thePlayer.SetBehaviorVariable('secondary
WeaponForOverlay', 1.000000, /* NOP */);

} else {
thePlayer.SetBehaviorVariable('secondary
WeaponForOverlay', 0.000000, /* NOP */);
}
}
}
switch(weapontype){
case 1:
thePlayer.SetBehaviorVariable('SelectedWeapon', 0, true)
;
thePlayer.SetBehaviorVariable('isHoldingWeaponR', 1.0000
00, true);
if (init){
res = thePlayer.RaiseEvent('DrawWeaponInstant');
}
break;
case 2:
thePlayer.SetBehaviorVariable('SelectedWeapon', 1, true)
;
thePlayer.SetBehaviorVariable('isHoldingWeaponR', 1.0000
00, true);
if (init){
res = thePlayer.RaiseEvent('DrawWeaponInstant');
}
break;
default:
thePlayer.SetBehaviorVariable('isHoldingWeaponR', 0.0000
00, true);
break;
}
/* NOP */;
}
public function UpdateScabbardsBehGraph(){
var weapontype : EPlayerWeapon;
var scabbardsComp : CAnimatedComponent;
weapontype = GetCurrentMeleeWeapon();
scabbardsComp = (CAnimatedComponent)thePlayer.GetComponent("scab
bards_skeleton");
switch(weapontype){
case 1:
scabbardsComp.SetBehaviorVariable('isHoldingWeaponR', 1.
000000);
break;
case 2:
scabbardsComp.SetBehaviorVariable('isHoldingWeaponR', 1.
000000);
break;
default:
scabbardsComp.SetBehaviorVariable('isHoldingWeaponR', 0.
000000);
break;
}
/* NOP */;
}
}
class Crossbow extends RangedWeapon{
protected var shotCount : Int32;
protected var shotCountLimit : Int32;
public var reloadAtStartComplete : Bool;

public function OnWeaponReloadEnd() : Bool{


if (deployedEnt){
ResetShotCount();
}
super.OnWeaponReloadEnd();
/* NOP */;
}
public function OnProcessThrowEvent(animEventName : CName) : Bool{
if (animEventName == 'ProjectileThrow'){
shotCount += 1;
}
super.OnProcessThrowEvent(animEventName);
/* NOP */;
}
public function OnForceHolster(forceUpperBodyAnim : Bool, instant : Bool
, dropItem : Bool) : Bool{
if (GetCurrentStateName() != 'State_WeaponWait' && GetCurrentSta
teName() != 'State_WeaponHolster'){
ProcessFullBodyAnimWeight(forceUpperBodyAnim);
ResetOwnerAndWeapon();
if (instant){
RaiseOwnerGraphEvents('Crossbow_ForceBlendOut',
true);
} else {
RaiseOwnerGraphEvents('Crossbow_Holster', true);
}
}
super.OnForceHolster(forceUpperBodyAnim, instant, dropItem);
/* NOP */;
}
public function OnReplaceAmmo() : Bool{
ClearDeployedEntity(true);
SetBehaviorGraphVariables('isWeaponLoaded', false, /* NOP */);
previousAmmoItemName = 'None';
ResetShotCount();
if (GetCurrentStateName() != 'State_WeaponWait' && GetCurrentSta
teName() != 'State_WeaponHolster'){
OnForceHolster(/* NOP */, /* NOP */, /* NOP */);
} else {
ResetOwnerAndWeapon();
}
/* NOP */;
}
public function OnCrossbowLoadedAnim() : Bool{
SetDeployedEntVisibility(true);
/* NOP */;
}
protected function ResetOwnerAndWeapon(){
SetBehaviorGraphVariables('isAimingWeapon', false, /* NOP */);
SetBehaviorGraphVariables('isShootingWeapon', false, /* NOP */);
if (isWeaponLoaded){
RaiseForceEvent('WeaponCrossbow_Loaded');
} else {
RaiseForceEvent('WeaponCrossbow_Unloaded');
}
/* NOP */;
}
public function Initialize(newOwner : CActor){
inv = (CInventoryComponent)thePlayer.GetComponentByClassName('CI
nventoryComponent');

super.Initialize(newOwner);
if (!reloadAtStartComplete){
AddTimer('ReloadWeaponOnInit', 0.200000, /* NOP */, /* N
OP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function ReloadWeaponOnInit(optional time : Float, optiona
l timerId : Int32){
var id : SItemUniqueId;
var player : W3PlayerWitcher;
if (ownerPlayerWitcher){
if (ownerPlayerWitcher.GetItemEquippedOnSlot(17, id)){
ReloadWeapon(id);
RaiseForceEvent('WeaponCrossbow_Loaded');
reloadAtStartComplete = true;
} else {
OnForceHolster(/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
} else {
Initialize((CActor)GetParentEntity());
}
/* NOP */;
}
protected function RaiseOwnerGraphEvents(eventName : CName, force : Bool
) : Bool{
var tempEventName : CName;
if (ownerPlayer.IsUsingVehicle()){
if (eventName == 'Crossbow_Draw'){
tempEventName = 'VehicleCrossbow_Draw';
} else if (eventName == 'Crossbow_Reload'){
tempEventName = 'VehicleCrossbow_Reload';
} else if (eventName == 'Crossbow_AimShoot'){
tempEventName = 'VehicleCrossbow_AimShoot';
} else if (eventName == 'Crossbow_Holster'){
tempEventName = 'VehicleCrossbow_Holster';
} else if (eventName == 'Crossbow_ForceBlendOut'){
tempEventName = 'VehicleCrossbow_ForceBlendOut';
force = false;
}
} else {
tempEventName = eventName;
}
return super.RaiseOwnerGraphEvents(tempEventName, force);
/* NOP */;
}
protected function PlayOwnerReloadAnim() : Bool{
var shouldPlayAnim : Bool;
if (shotCount >= shotCountLimit){
shouldPlayAnim = true;
} else if (previousAmmoItemName != 'Bodkin Bolt' && previousAmmo
ItemName != 'Harpoon Bolt' && GetSpecialAmmoCount() <= 0){
shouldPlayAnim = true;
} else if (previousAmmoItemName == 'None'){
shouldPlayAnim = true;
} else {
shouldPlayAnim = false;
}
if (shouldPlayAnim){

SetBehaviorGraphVariables('isWeaponLoaded', false, /* NO
P */);
return true;
} else {
return false;
}
/* NOP */;
}
protected function GetSpecialAmmoCount() : Int32{
var count : Int32;
var id : SItemUniqueId;
if (ownerPlayerWitcher){
if (ownerPlayerWitcher.GetItemEquippedOnSlot(17, id)){
if (inv.IsItemBolt(id) && !inv.ItemHasTag(id, th
eGame.params.TAG_INFINITE_AMMO)){
count = ownerPlayerWitcher.inv.GetItemQu
antity(id);
}
} else {
count = 0;
}
}
return count;
/* NOP */;
}
protected function ResetShotCount(){
shotCount = 0;
/* NOP */;
}
protected function SetOwnerOrientation(){
var newCustomOrientationTarget : EOrientationTarget;
newCustomOrientationTarget = ownerPlayer.GetCombatActionOrientat
ionTarget(10);
if (ownerPlayer.GetOrientationTarget() != newCustomOrientationTa
rget){
ownerPlayer.AddCustomOrientationTarget(newCustomOrientat
ionTarget, 'RangedWeapon');
}
if (newCustomOrientationTarget == 2){
ownerPlayer.SetOrientationTargetCustomHeading(ownerPlaye
r.GetCombatActionHeading(), 'RangedWeapon');
}
/* NOP */;
}
protected function ProcessCharacterRotationInCombat(){
}
protected function ProcessFullBodyAnimWeight(forceUpperBodyAnim : Bool)
: Bool{
var isAxisReleased : Bool;
if (wasBLAxisReleased){
isAxisReleased = true;
if (!ownerPlayer.bLAxisReleased && ownerPlayer.IsInputHe
adingReady()){
isAxisReleased = false;
}
} else {
isAxisReleased = ownerPlayer.bLAxisReleased;
}
if (ownerPlayer.GetPlayerCombatStance() == 1){
setFullWeight = true;

}
if (isAxisReleased || ownerPlayer.GetPlayerCombatStance() == 1 |
| ownerPlayer.GetPlayerCombatStance() == 3 && GetCurrentStateName() == 'State_We
aponAim' || GetCurrentStateName() == 'State_WeaponShoot'){
setFullWeight = true;
}
if (isAxisReleased && ownerPlayer.IsInCombatAction() || ownerPla
yer.GetPlayerCombatStance() == 3){
setFullWeight = true;
}
if (isAxisReleased && GetCurrentStateName() == 'State_WeaponDraw
' || GetCurrentStateName() == 'State_WeaponReload'){
setFullWeight = true;
}
if (ownerPlayer.IsSwimming()){
if (!isAxisReleased || theInput.IsActionPressed('DiveUp'
) || theInput.IsActionPressed('DiveDown') && GetCurrentStateName() == 'State_Wea
ponDraw' || GetCurrentStateName() == 'State_WeaponHolster'){
setFullWeight = false;
} else {
setFullWeight = true;
}
}
if (!isAxisReleased && ownerPlayer.GetPlayerCombatStance() == 0
&& !isDeployedEntAiming && !ownerPlayer.IsSwimming()){
setFullWeight = false;
} else if (ownerPlayer.GetIsSprinting() && !isDeployedEntAiming)
{
setFullWeight = false;
} else if (!isAxisReleased && !ownerPlayer.IsSwimming() && GetCu
rrentStateName() == 'State_WeaponHolster' && ownerPlayer.GetPlayerCombatStance()
== 0 || ownerPlayer.GetPlayerCombatStance() == 2){
setFullWeight = false;
} else if (ownerPlayer.IsInAir() || ownerPlayer.GetCriticalBuffs
Count() > 0){
setFullWeight = false;
} else if (ownerPlayer.IsThrowingItem()){
setFullWeight = false;
} else if (ownerPlayer.IsInCombatAction() && GetCurrentStateName
() == 'State_WeaponHolster'){
setFullWeight = false;
} else if (ownerPlayer.playerMoveType == 2 || ownerPlayer.player
MoveType == 3){
setFullWeight = false;
}
if (ownerPlayer.playerMoveType == 3){
setFullWeight = false;
}
if (ownerPlayer.GetCurrentStateName() == 'AimThrow' && !ownerPla
yer.IsInAir()){
setFullWeight = true;
}
if (forceUpperBodyAnim){
setFullWeight = false;
}
if (setFullWeight){
/* NOP */;
} else {
/* NOP */;
if (GetCurrentStateName() == 'State_WeaponReload'){

/* NOP */;
}
}
ownerPlayer.SetBehaviorVariable('fullBodyAnimWeight', setFullWei
ght, /* NOP */);
return setFullWeight;
/* NOP */;
}
protected function ExitCombatAction() : Bool{
if (!super.ExitCombatAction()){
if (ownerPlayer.GetBehaviorVariable('combatActionType',
/* NOP */) == 10){
if (!ownerPlayer.IsInCombat() && ownerPlayer.bLA
xisReleased){
ownerPlayer.RaiseEvent('ForceAlertToNorm
alTransition');
} else {
ownerPlayer.RaiseEvent('ForceBlendOut');
}
return true;
}
}
return false;
/* NOP */;
}
}
class W3MedallionFX extends CEntity{
public var scaleVector : Vector;
public var medallionScaleRate : Float;
public var effectDuration : Float;
private autobind medallionComponent : CComponent = "CMeshComponent medal
ion";
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
AddTimer('ScaleMedallion', 0.010000, true, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
AddTimer('DestroyMedallionFX', effectDuration, false, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
public function TriggerMedallionFX(){
var rot : EulerAngles;
var pos : Vector;
var spawnedEntity : CEntity;
var entityTemplate : CEntityTemplate;
entityTemplate = (CEntityTemplate)LoadResource('medallion_fx', /
* NOP */);
pos = thePlayer.GetWorldPosition();
spawnedEntity = theGame.CreateEntity(entityTemplate, pos, rot, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
spawnedEntity.PlayEffect('medalion_fx', /* NOP */);
/* NOP */;
}
public timer function DestroyMedallionFX(optional deltaTime : Float, opt
ional id : Int32){
RemoveTimer('ScaleMedallion', /* NOP */);
Destroy();
/* NOP */;
}
public timer function ScaleMedallion(optional deltaTime : Float, optiona

l id : Int32){
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
medallionScaleRate += 15.000000 * deltaTime;
scaleVector.X = medallionScaleRate;
scaleVector.Y = medallionScaleRate;
scaleVector.Z = medallionScaleRate;
if (medallionComponent){
medallionComponent.SetScale(scaleVector);
}
witcher.HighlightObjects(medallionScaleRate, /* NOP */);
/* NOP */;
}
}
class CPlayerInteriorTracker extends CObject{
private saved var sprintLocker : CActionLockerByCounter;
private saved var runLocker : CActionLockerByCounter;
private var currentInterior : CNode;
public function Init(restored : Bool){
if (!sprintLocker){
sprintLocker = new CActionLockerByCounter in this;
}
if (!runLocker){
runLocker = new CActionLockerByCounter in this;
}
sprintLocker.Init(26, 'InteriorBlocker');
runLocker.Init(14, 'InteriorBlocker');
if (!restored){
sprintLocker.Reset();
runLocker.Reset();
}
/* NOP */;
}
public function LockSprint(lock : Bool){
sprintLocker.Lock(lock);
/* NOP */;
}
public function LockRun(lock : Bool){
runLocker.Lock(lock);
/* NOP */;
}
public function SetCurrentInterior(_interior : CNode){
currentInterior = _interior;
/* NOP */;
}
public function GetCurrentInterior() : CNode{
return currentInterior;
/* NOP */;
}
}
import abstract class CStrayActorManager{
}
import abstract class CRoadsManager{
}
class CR4LocomotionPlayerControllerScript extends CR4LocomotionDirectControllerS
cript{

public var player : CR4Player;


public var angularInputSpeed : Float;
public var worldMoveDirection : Float;
public var localMoveDirection : Float;
public var previousInputVector : Vector;
public var timerValue : Float;
public var angularSpeed : Float;
public var _inputLocoEnabled : Bool;
public var _inputVecCurr : Vector;
public var _inputVecPrev : Vector;
public var _inputHeading180Curr : Float;
public var _inputHeading180Prev : Float;
public var _inputHeading180LastCached : Float;
public var _inputMagCurr : Float;
public var _inputMagPrev : Float;
public var _inputMagDiffCurr : Float;
public var _inputMagDiffPrev : Float;
public var _inputMagLastCached : Float;
public var speedSlowWalkingMax : Float;
public var speedWalkingMax : Float;
public var speedRunning : Float;
public var speedSprinting : Float;
public var speedSprintingWithPerk : Float;
public var maxTerrainPitchToWalkUp : Float;
public var prevPosition : Vector;
public var prevRotation : EulerAngles;
public var cachedMoveSpeed : Float;
public var stoppedTimeStamp : Float;
public var stopCheckEnabled : Bool;
public var stoppedTimeStampDelta : Float;
public var doubleTapEnabled : Bool;
public var localMoveDirectionPrevFrame : Float;
public var directionSwitchTimeStamp : Float;
public var directionCenteredTimeStamp : Float;
public var isCheckingCentered : Bool;
public var isCheckingCommitToRightTurn : Bool;
public var isCheckingCommitToLeftTurn : Bool;
public var isTurningRight : Bool;
public var isTurningLeft : Bool;
public var commitToRightTurnTimeStamp : Float;
public var commitToLeftTurnTimeStamp : Float;
public var directionSwitchTimeStampDelta : Float;
public var startRightTurnTimeStamp : Float;
public var startLeftTurnTimeStamp : Float;
public var useRightTurnTimeStamp : Bool;
public var useLeftTurnTimeStamp : Bool;
private var fastTurnEnabled : Bool;
public function Activate() : Bool{
player = (CR4Player)agent.GetEntity();
_inputVecCurr = Vector(0.000000, 0.000000, 0.000000);
_inputVecPrev = Vector(0.000000, 0.000000, 0.000000);
player.SetBehaviorVariable('AIControlled', 0.000000, /* NOP */);
stopCheckEnabled = false;
return super.Activate();
/* NOP */;
}
public function Deactivate(){
var movingAgentComponent : CMovingAgentComponent;
movingAgentComponent = player.GetMovingAgentComponent();
player.SetBehaviorVariable('inputDirectionIsNotReady', 0.000000,

/* NOP */);
player.SetBehaviorVariable('AIControlled', 1.000000, /* NOP */);
player.UpdateRequestedDirectionVariables_PlayerDefault();
player.SetIsRunning(false);
player.SetIsWalking(false);
movingAgentComponent.SetGameplayRelativeMoveSpeed(0.000000);
movingAgentComponent.SetGameplayMoveDirection(0.000000);
stopCheckEnabled = false;
super.Deactivate();
/* NOP */;
}
public function UpdateLocomotion(){
var inputInCameraSpace : Float;
var inputAngleToRotate : Float;
var previousSpeed : Float;
var haxStrafe : Float;
var haxForward : Float;
var playerYaw : Float;
var forcedDirection : Float;
var movingAgentComponent : CMovingAgentComponent;
var currPosition : Vector;
var diffPosition : Vector;
var currRotation : EulerAngles;
var diffRotation : Float;
var inputHeading180_WS : Float;
var inputHeading360_WS : Float;
var inputHeading180_CS : Float;
var cameraHeading360_WS : Float;
var inputMagDiff : Float;
var currentTime : Float;
movingAgentComponent = player.GetMovingAgentComponent();
if (player.IsUITakeInput()){
return;
}
previousSpeed = movingAgentComponent.GetRelativeMoveSpeed();
_inputVecPrev = _inputVecCurr;
_inputVecCurr = CalculateInputVector();
_inputHeading180Prev = _inputHeading180Curr;
_inputMagPrev = _inputMagCurr;
ConvertVecToHeadingWS180AndMag(_inputVecCurr, inputHeading180_WS
, _inputMagCurr);
inputHeading360_WS = AngleNormalize(inputHeading180_WS);
cameraHeading360_WS = GetCameraHeading360WS();
inputHeading180_CS = AngleNormalize180(inputHeading360_WS + came
raHeading360_WS);
_inputMagDiffPrev = _inputMagDiffCurr;
_inputMagDiffCurr = _inputMagCurr - _inputMagPrev;
_inputHeading180Curr = inputHeading180_CS;
playerYaw = player.GetHeading();
UpdateInputReadyness();
player.GetVisualDebug().AddArrow('input01', player.GetWorldPosit
ion(), player.GetWorldPosition() + VecFromHeading(cameraHeading360_WS), 1.000000
, 0.100000, 0.100000, true, Color(0, 255, 0), true, /* NOP */);
player.GetVisualDebug().AddArrow('input02', player.GetWorldPosit
ion(), player.GetWorldPosition() + player.GetHeadingVector(), 1.000000, 0.100000
, 0.100000, true, Color(128, 128, 128), true, /* NOP */);
player.GetVisualDebug().AddArrow('input04', player.GetWorldPosit
ion(), player.GetWorldPosition() + VecFromHeading(_inputHeading180LastCached), 1
.000000, 0.200000, 0.200000, true, Color(255, 0, 255), true, /* NOP */);
if (player.GetIsMovable()){

if (HasToForceToFall(forcedDirection)){
localMoveDirection = forcedDirection;
moveSpeed = MaxF(moveSpeed, 0.500000);
_inputHeading180Curr = localMoveDirection * -180
.000000 + playerYaw;
_inputHeading180LastCached = _inputHeading180Cur
r;
MakeInputReady();
} else if (HasToStopBecauseOfSlope()){
moveSpeed = 0.000000;
_inputHeading180Curr = playerYaw;
_inputHeading180LastCached = _inputHeading180Cur
r;
MakeInputReady();
} else {
angularInputSpeed = CalculateInputAngularSpeed()
;
localMoveDirection = CalculateLocalMoveDirection
();
moveSpeed = CalculateMoveSpeed();
currentTime = theGame.GetEngineTimeAsSeconds();
if (moveSpeed <= 0){
if (!stopCheckEnabled){
stopCheckEnabled = true;
stoppedTimeStamp = currentTime;
moveSpeed = cachedMoveSpeed;
if (theInput.LastUsedPCInput()){
stoppedTimeStampDelta =
0.150000;
} else {
stoppedTimeStampDelta =
0.050000;
}
} else if (currentTime > stoppedTimeStam
p + stoppedTimeStampDelta){
moveSpeed = 0;
} else {
moveSpeed = cachedMoveSpeed;
}
} else {
stopCheckEnabled = false;
cachedMoveSpeed = moveSpeed;
}
localMoveDirectionPrevFrame = localMoveDirection
;
currPosition
currRotation
diffPosition
diffRotation

=
=
=
=

player.GetWorldPosition();
player.GetWorldRotation();
currPosition - prevPosition;
AngleDistance(currRotation.Yaw, p

revRotation.Yaw);
prevPosition = currPosition;
prevRotation = currRotation;
ProcessMovementEvent();
if (thePlayer.substateManager.m_MovementCorrecto
rO.ModifySpeedRequired(moveSpeed)){
MakeInputReady();
}
if (thePlayer.HasBuff(39)){
moveSpeed = MinF(moveSpeed, speedWalking
Max);

}
}
} else {
player.playerMoveType = 0;
angularInputSpeed = 0;
moveSpeed = 0;
localMoveDirection = 0;
}
player.SetSubmergeDepth((CMovingPhysicalAgentComponent)player.Ge
tMovingAgentComponent().GetSubmergeDepth());
player.SetBehaviorVariable('submergeDepth', player.GetSubmergeDe
pth(), /* NOP */);
if (player.OnAllowShallowWaterCheck() && !player.IsSwimming() &&
player.GetSubmergeDepth() <= -0.900000){
player.OnEnterShallowWater();
} else {
player.OnExitShallowWater();
}
if (_inputLocoEnabled){
worldMoveDirection = _inputHeading180LastCached;
} else if (moveSpeed > 0.000000){
worldMoveDirection = localMoveDirection * -180.000000 +
playerYaw;
}
if (player.IsOnBoat()){
moveSpeed = MinF(speedSlowWalkingMax, moveSpeed);
}
if (!player.CanUpdateMovement()){
movingAgentComponent.SetGameplayRelativeMoveSpeed(0.0000
00);
player.SetBehaviorVariable('test_moveSpeed', 0.000000, /
* NOP */);
if (!player.IsInputHeadingReady()){
moveSpeed = 0;
}
player.SetBehaviorVariable('playerSpeedForOverlay', move
Speed, /* NOP */);
movingAgentComponent.SetGameplayMoveDirection(playerYaw)
;
} else {
movingAgentComponent.SetGameplayRelativeMoveSpeed(moveSp
eed);
player.SetBehaviorVariable('test_moveSpeed', moveSpeed,
/* NOP */);
player.SetBehaviorVariable('playerSpeedForOverlay', movi
ngAgentComponent.GetRelativeMoveSpeed(), /* NOP */);
movingAgentComponent.SetGameplayMoveDirection(worldMoveD
irection);
}
movingAgentComponent.SetDirectionChangeRate(10000.000000);
player.SetBehaviorVariable('playerInputAngSpeed', angularInputSp
eed, /* NOP */);
UpdateRequestedDirectionVariables(worldMoveDirection, theCamera.
GetCameraHeading());
player.GetVisualDebug().AddArrow('heading1', player.GetWorldPosi
tion(), player.GetWorldPosition() + VecFromHeading(worldMoveDirection), 1.000000
, 0.400000, 0.200000, true, Color(255, 0, 0), true, /* NOP */);
player.SetBehaviorVariable('actorMoveDirection', localMoveDirect
ion, /* NOP */);
angularSpeed = 512.000000;

if (inputAngleToRotate < 0.000000){


angularSpeed = -angularSpeed;
}
player.SetBehaviorVariable('inputSpeedToRotate', angularSpeed, /
* NOP */);
player.SetIsWalking(moveSpeed > 0.100000);
player.SetIsRunning(moveSpeed > 0.850000);
/* NOP */;
}
private function UpdateInputReadyness(){
var inputHeadingReady : Bool;
var inputMagReady : Bool;
var canRecalcInputHeading : Bool;
inputHeadingReady = true;
inputMagReady = true;
canRecalcInputHeading = false;
if (AbsF(_inputMagDiffCurr) > 0.200000){
inputHeadingReady = false;
inputMagReady = false;
canRecalcInputHeading = true;
}
if (inputHeadingReady && _inputMagCurr < 0.001000 && _inputMagPr
ev > 0.100000){
inputHeadingReady = false;
canRecalcInputHeading = true;
}
if (inputHeadingReady && _inputMagDiffCurr < 0.000000 && AbsF(_i
nputVecCurr.X) < 0.001000 && AbsF(_inputVecCurr.Y) > 0.001000 && _inputVecCurr.Y
< _inputVecPrev.Y){
inputHeadingReady = false;
}
if (inputHeadingReady && _inputMagCurr < 0.100000){
inputHeadingReady = false;
}
if (inputHeadingReady && _inputMagPrev < 0.001000 && _inputMagCu
rr > 0.001000){
inputHeadingReady = false;
inputMagReady = false;
}
if (canRecalcInputHeading && _inputMagPrev > 0.001000 && _inputM
agDiffCurr > 0.001000 && _inputMagDiffPrev < 0.001000){
_inputHeading180Curr = _inputHeading180Prev;
inputHeadingReady = true;
inputMagReady = true;
} else if (canRecalcInputHeading && _inputMagPrev > 0.001000 &&
_inputMagDiffCurr < 0.001000 && _inputMagDiffPrev > 0.001000){
_inputHeading180Curr = _inputHeading180Prev;
_inputMagCurr = _inputMagPrev;
inputHeadingReady = true;
inputMagReady = true;
}
if (inputHeadingReady){
_inputHeading180LastCached = _inputHeading180Curr;
player.SetBehaviorVariable('inputDirectionIsNotReady', 0
.000000, /* NOP */);
} else {
player.SetBehaviorVariable('inputDirectionIsNotReady', 1
.000000, /* NOP */);
}
player.SetInputHeadingReady(inputHeadingReady);

if (inputMagReady){
_inputMagLastCached = _inputMagCurr;
}
/* NOP */;
}
private function MakeInputReady(){
player.SetBehaviorVariable('inputDirectionIsNotReady', 0.000000,
/* NOP */);
/* NOP */;
}
private function HasToForceToFall(direction : Float) : Bool{
var fallingDir : Vector;
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(thePlayer.thrownEntit
yHandle);
if (thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentS
tateName() != 'State_WeaponWait'){
return false;
}
if (thrownEntity){
return false;
}
if (thePlayer.substateManager.m_CollisionManagerO.GetHasToFallIn
Direction(direction)){
return true;
}
return false;
/* NOP */;
}
private function HasToStopBecauseOfSlope() : Bool{
var direction : Vector;
var pitch : Float;
pitch = player.terrainPitch;
if (pitch < 90.000000 - maxTerrainPitchToWalkUp){
if (thePlayer.substateManager.m_InputO.IsModuleConsidera
ble()){
direction = thePlayer.substateManager.m_MoverO.G
etSlideDir();
if (VecDot(direction, thePlayer.substateManager.
m_InputO.GetMovementOnPlaneNormalizedV()) < -0.200000){
return true;
}
}
}
return false;
/* NOP */;
}
public function CalculateLocalMoveDirection() : Float{
var direction : Float;
var playerDirCamSpace : Float;
var moveDir : Vector;
var anyInput : Bool;
var corrected : Bool;
playerDirCamSpace = GetPlayerHeadingInCamSpace();
player.SetBehaviorVariable('rawPlayerHeading', playerDirCamSpace
- 180, /* NOP */);
moveDir = GetInputInPlayerSpace(playerDirCamSpace, anyInput);
moveDir = CorrectDirection(moveDir, anyInput, corrected);
if (!anyInput){
return 0.000000;

}
if (corrected){
_inputHeading180Curr = VecHeading(moveDir);
_inputHeading180LastCached = _inputHeading180Curr;
}
direction = -VecHeading(moveDir) - player.GetHeading();
direction = AngleNormalize180(direction);
direction = direction / 180.000000;
return direction;
/* NOP */;
}
public function ResetMoveDirection(){
if (player){
_inputHeading180LastCached = player.GetHeading();
}
/* NOP */;
}
private function GetCameraHeading360WS() : Float{
var cameraDirection : Vector;
var camHeading : Float;
cameraDirection = theCamera.GetCameraDirection();
cameraDirection.Z = 0.000000;
cameraDirection.W = 1.000000;
cameraDirection = VecNormalize2D(cameraDirection);
camHeading = AngleNormalize(VecHeading(cameraDirection));
return camHeading;
/* NOP */;
}
private function GetHeadingInCamSpace(heading : Float) : Float{
var cameraDirection : Vector;
var camHeading : Float;
cameraDirection = theCamera.GetCameraDirection();
cameraDirection.Z = 0.000000;
cameraDirection.W = 1.000000;
cameraDirection = VecNormalize2D(cameraDirection);
camHeading = AngleNormalize(VecHeading(cameraDirection));
heading = AngleNormalize(heading);
return AngleNormalize(heading - camHeading);
/* NOP */;
}
private function GetPlayerHeadingInCamSpace() : Float{
var cameraDirection : Vector;
var camHeading : Float;
var playerHeading : Float;
cameraDirection = theCamera.GetCameraDirection();
cameraDirection.Z = 0;
camHeading = AngleNormalize(VecHeading(cameraDirection));
playerHeading = AngleNormalize(player.GetHeading());
return AngleNormalize(playerHeading - camHeading);
/* NOP */;
}
private function GetInputHeading() : Float{
var inputVector : Vector;
inputVector.X = theInput.GetActionValue('GI_AxisLeftX');
inputVector.Y = theInput.GetActionValue('GI_AxisLeftY');
return AngleNormalize(VecHeading(inputVector));
/* NOP */;
}
private function GetInputInPlayerSpace(playerHeadingInCamSpace : Float,
anyInput : Bool) : Vector{

var inputVector : Vector;


var relativeDirection : Vector;
var direction : Float;
var inputHeading : Float;
inputVector.X = theInput.GetActionValue('GI_AxisLeftX');
inputVector.Y = theInput.GetActionValue('GI_AxisLeftY');
anyInput = inputVector.X != 0.000000 || inputVector.Y != 0.00000
0;
if (anyInput){
inputHeading = AngleNormalize(VecHeading(inputVector));
direction = playerHeadingInCamSpace - inputHeading;
relativeDirection = VecFromHeading(-direction + player.G
etHeading());
} else {
relativeDirection = VecFromHeading(player.GetHeading());
}
return relativeDirection;
/* NOP */;
}
private function CorrectDirection(moveDir : Vector, anyInput : Bool, cor
rected : Bool) : Vector{
var newDir : Vector;
if (thePlayer.substateManager.m_MovementCorrectorO.CorrectDirect
ionToAvoid(moveDir, newDir, anyInput)){
anyInput = true;
moveDir = newDir;
corrected = true;
} else {
corrected = false;
}
return moveDir;
/* NOP */;
}
public function CalculateInputVector() : Vector{
var vec : Vector;
vec.X = theInput.GetActionValue('GI_AxisLeftX');
vec.Y = theInput.GetActionValue('GI_AxisLeftY');
return vec;
/* NOP */;
}
public function ConvertVecToHeadingWS180AndMag(vec : Vector, heading180
: Float, mag : Float){
var vecNorm : Vector;
var heading : Float;
mag = VecLength2D(vec);
vecNorm = VecNormalize2D(vec);
heading = VecHeading(vecNorm);
heading180 = AngleNormalize180(heading);
/* NOP */;
}
public function CalculateInputAngularSpeed() : Float{
var inputVec : Vector;
var angSpeed : Float;
var inputHeading : Float;
var previousInputHeading : Float;
inputVec.X = theInput.GetActionValue('GI_AxisLeftX');
inputVec.Y = theInput.GetActionValue('GI_AxisLeftY');
inputVec = VecNormalize2D(inputVec);
inputHeading = VecHeading(inputVec);
previousInputHeading = VecHeading(previousInputVector);

if (inputHeading < 0.000000){


inputHeading += 360;
}
if (previousInputHeading < 0.000000){
previousInputHeading += 360;
}
angSpeed = inputHeading - previousInputHeading;
if (angSpeed > 180){
angSpeed = -360 - angSpeed;
}
if (angSpeed < -180){
angSpeed = 360 + angSpeed;
}
angSpeed = AbsF(angSpeed);
previousInputVector = inputVec;
return angSpeed;
/* NOP */;
}
public function CalculateMoveSpeed() : Float{
var speedVec : Vector;
var speed : Float;
var rawRightJoyVec : Vector;
var tempInt : Int32;
var terrainAngles : EulerAngles;
var currentTime : Float;
var forceWalkSpeed : Bool;
if (thePlayer.IsCameraControlDisabled('Finisher')){
speed = 0;
} else if (_inputLocoEnabled){
speed = _inputMagLastCached;
} else {
speed = thePlayer.substateManager.m_InputO.GetModuleF();
}
if (thePlayer.IsSwimming()){
if (thePlayer.rangedWeapon && thePlayer.rangedWeapon.Get
CurrentStateName() != 'State_WeaponWait' && thePlayer.rangedWeapon.GetCurrentSta
teName() != 'State_WeaponHolster'){
speed = 0;
}
}
player.terrainPitch = 90.000000 - player.substateManager.m_Mover
O.GetRealSlideAngle();
if (thePlayer.CanSprint(speed)){
if (thePlayer.IsInCombat() && thePlayer.moveTarget && Ve
cDistance(thePlayer.moveTarget.GetWorldPosition(), thePlayer.GetWorldPosition())
< thePlayer.findMoveTargetDistMax){
thePlayer.SetIsSprinting(true);
if (thePlayer.modifyPlayerSpeed || thePlayer.int
eriorCamera){
thePlayer.EnableSprintingCamera(false);
} else if (thePlayer.GetSprintingTime() > 0.2000
00 && !thePlayer.IsInCombatAction()){
thePlayer.EnableSprintingCamera(true);
} else {
thePlayer.EnableSprintingCamera(false);
}
} else {
thePlayer.SetIsSprinting(true);
if (thePlayer.modifyPlayerSpeed || thePlayer.int
eriorCamera){

thePlayer.EnableSprintingCamera(false);
} else {
thePlayer.EnableSprintingCamera(true);
}
}
} else if (!player.disableSprintingTimerEnabled && player.GetIsS
printing()){
player.disableSprintingTimerEnabled = true;
player.AddTimer('DisableSprintingTimer', 0.250000, /* NO
P */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (player.modifyPlayerSpeed){
if (speed > 0.000000){
if (thePlayer.IsRunPressed()){
speed = speedRunning;
} else {
speed = ClampF(speed, 0.000000, speedWal
kingMax);
}
}
} else if (!thePlayer.IsActionAllowed(26) && thePlayer.IsActionA
llowed(14) && !thePlayer.IsCombatMusicEnabled()){
if (speed <= 0.000000){
player.playerMoveType = 0;
} else if (thePlayer.IsSprintActionPressed()){
if (speed > 0.800000){
speed = MinF(speed, speedRunning);
player.playerMoveType = 2;
} else {
speed = speedWalkingMax;
player.playerMoveType = 1;
}
} else {
speed = MapF(MinF(speed, speedRunning), 0.000000
, speedRunning, 0.000000, speedWalkingMax);
player.playerMoveType = 1;
}
} else {
if (theInput.LastUsedGamepad()){
thePlayer.SetWalkToggle(false);
thePlayer.SetSprintToggle(false);
}
if (speed <= 0.000000){
player.playerMoveType = 0;
} else if (!theGame.IsFading() && !theGame.IsBlackscreen
()){
if (player.GetIsSprinting()){
speed = speedSprinting;
player.playerMoveType = 3;
} else if (speed > thePlayer.GetInputModuleNeede
dToRun() && thePlayer.IsActionAllowed(14) || thePlayer.IsCombatMusicEnabled() &&
thePlayer.GetPlayerCombatStance() == 0 && !thePlayer.GetIsWalkToggled() || theP
layer.GetPlayerCombatStance() == 2 || !thePlayer.GetIsWalkToggled() && !thePlaye
r.IsInCombat() && VecLength2D(speedVec) > thePlayer.GetInputModuleNeededToRun())
{
speed = MinF(speed, speedRunning);
player.playerMoveType = 2;
currentTime = EngineTimeToFloat(theGame.
GetEngineTime());
if (localMoveDirection > 0.700000){

if (!isCheckingCommitToRightTurn
){
isCheckingCommitToRightT
urn = true;
commitToRightTurnTimeSta
mp = currentTime;
}
if (isCheckingCommitToRightTurn)
{
if (currentTime >= commi
tToRightTurnTimeStamp + 0.250000){
directionSwitchT
imeStampDelta = 0.000000;
isCheckingCommit
ToRightTurn = false;
isTurningRight =
true;
}
}
} else if (localMoveDirection < -0.70000
0){
if (!isCheckingCommitToLeftTurn)
{
isCheckingCommitToLeftTu
rn = true;
commitToLeftTurnTimeStam
p = currentTime;
}
if (isCheckingCommitToLeftTurn){
if (currentTime >= commi
tToLeftTurnTimeStamp + 0.250000){
directionSwitchT
imeStampDelta = 0.000000;
isCheckingCommit
ToLeftTurn = false;
isTurningLeft =
true;
}
}
}
if (localMoveDirection > 0.000000){
useLeftTurnTimeStamp = false;
if (isTurningLeft){
directionSwitchTimeStamp
= currentTime;
directionSwitchTimeStamp
Delta = 1.000000;
startRightTurnTimeStamp
= currentTime;
useRightTurnTimeStamp =
true;
}
if (useRightTurnTimeStamp && loc
alMoveDirection > 0.300000){
if (currentTime >= start
RightTurnTimeStamp + 0.250000){
directionSwitchT
imeStampDelta = 0.000000;
}
}

isTurningLeft = false;
isCheckingCommitToLeftTurn = fal
se;
} else if (localMoveDirection < 0.000000
){
useRightTurnTimeStamp = false;
if (isTurningRight){
directionSwitchTimeStamp
= currentTime;
directionSwitchTimeStamp
Delta = 1.000000;
startLeftTurnTimeStamp =
currentTime;
useLeftTurnTimeStamp = t
rue;
}
if (useLeftTurnTimeStamp && loca
lMoveDirection < -0.300000){
if (currentTime >= start
LeftTurnTimeStamp + 0.250000){
directionSwitchT
imeStampDelta = 0.000000;
}
}
isTurningRight = false;
isCheckingCommitToRightTurn = fa
lse;
}
if (currentTime < directionSwitchTimeSta
mp + directionSwitchTimeStampDelta){
if (localMoveDirection >= -0.300
000 && localMoveDirection <= 0.300000){
if (!isCheckingCentered)
{
isCheckingCenter
ed = true;
directionCentere
dTimeStamp = currentTime;
} else if (currentTime >
= directionCenteredTimeStamp + 0.000000){
isCheckingCenter
ed = false;
directionSwitchT
imeStampDelta = 0.000000;
isCheckingCommit
ToRightTurn = false;
isCheckingCommit
ToLeftTurn = false;
}
} else {
isCheckingCentered = fal
se;
}
forceWalkSpeed = true;
speed = speedWalkingMax;
} else {
isCheckingCentered = false;
}
if (forceWalkSpeed){
player.SetBehaviorVariable('forc

eWalkSpeed', 1, /* NOP */);


} else {
player.SetBehaviorVariable('forc
eWalkSpeed', 0, /* NOP */);
}
} else {
speed = MinF(speed, speedWalkingMax);
player.playerMoveType = 1;
}
} else {
speed = MinF(speed, speedWalkingMax);
player.playerMoveType = 1;
}
}
if (player.playerMoveType <= 1){
thePlayer.SetSprintToggle(false);
}
tempInt = player.playerMoveType;
player.substateManager.SetBehaviorParamBool('onSteepSlope', theP
layer.IsTerrainTooSteepToRunUp(), /* NOP */);
player.SetBehaviorVariable('terrainPitch', player.terrainPitch,
/* NOP */);
player.SetBehaviorVariable('playerMoveType', tempInt, /* NOP */)
;
player.SetBehaviorVariable('playerMoveTypeForOverlay', tempInt,
/* NOP */);
player.substateManager.SetBehaviorParamBool('runInputPressed', t
hePlayer.IsSprintActionPressed(), /* NOP */);
player.substateManager.SetBehaviorParamBool('ikWeight', player.p
layerMoveType == 1 || player.playerMoveType == 0, /* NOP */);
rawRightJoyVec.X = theInput.GetActionValue('GI_AxisRightX');
rawRightJoyVec.Y = theInput.GetActionValue('GI_AxisRightY');
player.SetBehaviorVariable('cameraSpeed', VecLength2D(rawRightJo
yVec), /* NOP */);
return speed;
/* NOP */;
}
private function ProcessMovementEvent(){
var walkTurnDampSpeed : Float;
var dir : Float;
dir = AbsF(localMoveDirection);
if (angularInputSpeed > 0){
if (dir >= 0.800000 && !player.rangedWeapon || player.ra
ngedWeapon.GetCurrentStateName() == 'State_WeaponWait'){
player.SetBehaviorVariable('latchWalkDirection',
1.000000, /* NOP */);
player.SetBehaviorVariable('walkTurnDampSpeed',
0.500000, /* NOP */);
fastTurnEnabled = false;
player.RaiseEvent('QuickTurnWalk');
} else if (angularInputSpeed > 10.000000 && dir >= 0.250
000 && !player.lAxisReleasedAfterCounterNoCA){
fastTurnEnabled = true;
}
}
if (dir <= 0.027000){
player.SetBehaviorVariable('latchWalkDirection', 0.00000
0, /* NOP */);
fastTurnEnabled = false;
}

player.SetBehaviorVariable('fastTurnEnabled', fastTurnEnabled, /
* NOP */);
/* NOP */;
}
private function UpdateRequestedDirectionVariables(playerHeadingWS : Flo
at, cameraHeadingWS : Float){
var orientationTarget : EOrientationTarget;
var useHeadingWS : Float;
var useFacingWS : Float;
var target : CGameplayEntity;
var canFaceTarget : Bool;
var playerToTargetVec : Vector;
useHeadingWS = playerHeadingWS;
useFacingWS = cameraHeadingWS;
orientationTarget = player.GetOrientationTarget();
if (orientationTarget == 3){
useFacingWS = cameraHeadingWS;
} else if (orientationTarget == 4){
useFacingWS = cameraHeadingWS - player.GetOTCameraOffset
();
} else if (orientationTarget == 1){
target = player.GetTarget();
if (!target){
target = player.moveTarget;
}
if (player.IsCurrentSignChanneled() && player.IsInCombat
Action()){
if (player.GetCurrentlyCastSign() == 3){
target = player.moveTarget;
canFaceTarget = true;
} else if (player.GetCurrentlyCastSign() == 2){
target = player.GetDisplayTarget();
}
canFaceTarget = true;
}
if (target){
playerToTargetVec = target.GetWorldPosition() player.GetWorldPosition();
if (!canFaceTarget){
if (player.GetPlayerCombatStance() == 1)
{
canFaceTarget = true;
} else if (player.GetPlayerCombatStance(
) == 3 && VecLength(playerToTargetVec) < player.findMoveTargetDist){
canFaceTarget = true;
} else if (player.IsActorLockedToTarget(
) && !player.IsHardLockEnabled()){
canFaceTarget = true;
}
}
}
if (canFaceTarget && target){
useFacingWS = VecHeading(playerToTargetVec);
} else {
useFacingWS = player.GetHeading();
}
} else if (orientationTarget == 0){
useFacingWS = player.GetHeading();
} else if (orientationTarget == 2){
useFacingWS = player.GetOrientationTargetCustomHeading()

;
}
player.GetVisualDebug().AddArrow('heading5', player.GetWorldPosi
tion(), player.GetWorldPosition() + VecFromHeading(useFacingWS), 1.000000, 0.400
000, 0.200000, true, Color(0, 0, 255), true, /* NOP */);
player.UpdateRequestedDirectionVariables(useHeadingWS, useFacing
WS);
/* NOP */;
}
}
class W3PlayerMode extends CObject{
public var player : CPlayer;
public var currentMode : EPlayerMode;
public saved var safeMode : Bool;
public saved var combatMode : Bool;
public var combatDataComponent : CCombatDataComponent;
public var combatModeTimer : Float;
public const var combatModeDelay : Float;
public var forceCombatMode : Int32;
public var combatModeBlockedActions : array<EInputActionBlock>;
public var safeModeBlockedActions : array<EInputActionBlock>;
public function Initialize(playerEntity : CPlayer){
player = playerEntity;
currentMode = 0;
if ((CR4Player)playerEntity){
(CR4Player)playerEntity.SetIsInCombat(false);
}
/* NOP */;
}
public function EnableMode(mode : EPlayerMode, enable : Bool){
if (mode == 2){
if (enable){
if (thePlayer.GetTarget().IsHuman()){
thePlayer.PlayBattleCry('BattleCryHumans
Start', 0.100000, /* NOP */, /* NOP */);
} else {
thePlayer.PlayBattleCry('BattleCryMonste
rsStart', 0.100000, /* NOP */, /* NOP */);
}
}
combatMode = enable;
UpdateCurrentMode();
} else if (mode == 1){
safeMode = enable;
UpdateCurrentMode();
}
/* NOP */;
}
public function GetCurrentMode() : EPlayerMode{
return currentMode;
/* NOP */;
}
public function CalcCurrentMode() : EPlayerMode{
if (combatMode){
return 2;
}
if (safeMode){
return 1;
}

return 0;
/* NOP */;
}
public function UpdateCurrentMode(){
var prevMode : EPlayerMode;
prevMode = currentMode;
currentMode = CalcCurrentMode();
if (prevMode != currentMode){
OnModeChanged(prevMode);
}
/* NOP */;
}
public function OnModeChanged(prevMode : EPlayerMode) : Bool{
OnModeEnabled(prevMode, false);
OnModeEnabled(currentMode, true);
thePlayer.SetIsInCombat(combatMode);
/* NOP */;
}
public function OnModeEnabled(mode : EPlayerMode, enabled : Bool){
if (mode == 2){
BlockActions(combatModeBlockedActions, enabled);
} else if (mode == 1){
BlockActions(safeModeBlockedActions, enabled);
if (enabled){
player.DisableCombatState();
}
}
/* NOP */;
}
public function BlockActions(actions : array<EInputActionBlock>, block :
Bool){
var i : Int32;
var size : Int32;
size = actions.Size();
i = 0;
while (i < size){
if (block){
player.BlockAction(actions[i], 'W3PlayerMode', /
* NOP */, /* NOP */, /* NOP */);
} else {
player.UnblockAction(actions[i], 'W3PlayerMode')
;
}
i += 1;
}
/* NOP */;
}
public function UpdateCombatMode(forceUpdate : Bool){
var unableToPathFind : Bool;
if (thePlayer.ShouldEnableCombat(unableToPathFind, forceCombatMo
de)){
combatModeTimer = theGame.GetEngineTimeAsSeconds();
if (!combatMode){
EnableMode(2, true);
}
thePlayer.GoToCombatIfNeeded(/* NOP */);
} else {
if (combatMode && currentMode == 2){
thePlayer.FindMoveTarget();
}

if (combatMode && theGame.GetEngineTimeAsSeconds() - com


batModeTimer > combatModeDelay || unableToPathFind && thePlayer.IsThreatened() |
| forceUpdate){
EnableMode(2, false);
if (unableToPathFind){
unableToPathFind = false;
thePlayer.GoToExplorationIfNeeded();
}
}
}
/* NOP */;
}
public function ForceCombatMode(reason : EForceCombatModeReason){
forceCombatMode = forceCombatMode | reason;
thePlayer.FindMoveTarget();
UpdateCombatMode(true);
/* NOP */;
}
public function ReleaseForceCombatMode(reason : EForceCombatModeReason){
forceCombatMode = forceCombatMode & ~reason;
thePlayer.FindMoveTarget();
UpdateCombatMode(true);
if (!forceCombatMode){
if (!thePlayer.IsCombatMusicEnabled()){
thePlayer.OnCombatFinished();
}
}
/* NOP */;
}
public function GetForceCombatMode() : Bool{
if (forceCombatMode > 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function ShouldForceAlertNearStance() : Bool{
return forceCombatMode >= 4;
/* NOP */;
}
}
statemachine class PlayerAiming extends CObject{
protected var owner : CR4Player;
protected var throwable : CThrowable;
protected var aimType : EAimType;
protected var throwPos : Vector;
protected var sweptFriendly : CEntity;
protected var sweptActors : array<CActor>;
protected var tracePosFrom : Vector;
public var thrownBombImpactRadius : Float;
protected var aimedTarget : CActor;
protected var collisionGroupsNames : array<CName>;
public function Initialize(p : CR4Player){
owner = p;
collisionGroupsNames.PushBack('RigidBody');
collisionGroupsNames.PushBack('Character');
collisionGroupsNames.PushBack('Static');
collisionGroupsNames.PushBack('Debris');

collisionGroupsNames.PushBack('Ragdoll');
collisionGroupsNames.PushBack('Destructible');
collisionGroupsNames.PushBack('Terrain');
collisionGroupsNames.PushBack('Phantom');
collisionGroupsNames.PushBack('Dangles');
collisionGroupsNames.PushBack('Weapon');
collisionGroupsNames.PushBack('Water');
collisionGroupsNames.PushBack('Foliage');
collisionGroupsNames.PushBack('CommunityCollidables');
collisionGroupsNames.PushBack('Boat');
collisionGroupsNames.PushBack('Door');
collisionGroupsNames.PushBack('Platforms');
collisionGroupsNames.PushBack('Corpse');
theGame.RemoveTimeScale(theGame.GetTimescaleSource(4));
GotoState('Waiting', /* NOP */, /* NOP */);
/* NOP */;
}
public function StartAiming(t : CThrowable){
var bomb : W3Petard;
bomb = (W3Petard)t;
if (bomb){
thrownBombImpactRadius = bomb.GetImpactRange();
if (thrownBombImpactRadius == 0){
thrownBombImpactRadius = bomb.GetAoERange();
}
} else {
thrownBombImpactRadius = 0;
}
OnStartAiming(t);
/* NOP */;
}
public function StopAiming(){
OnStopAiming();
/* NOP */;
}
public function RemoveAimingSloMo(){
OnRemoveAimingSloMo();
/* NOP */;
}
public function GetThrowPosition() : Vector{
return throwPos;
/* NOP */;
}
public function GetSweptFriendly() : CEntity{
return sweptFriendly;
/* NOP */;
}
public function GetSweptActors() : array<CActor>{
return sweptActors;
/* NOP */;
}
public function GetThrowStartPosition() : Vector{
return tracePosFrom;
/* NOP */;
}
public function GetAimedTarget() : CActor{
return aimedTarget;
/* NOP */;
}
public function OnStartAiming(t : CThrowable) : Bool{

}
public function OnStopAiming() : Bool{
}
public function OnAddAimingSloMo() : Bool{
}
public function OnRemoveAimingSloMo() : Bool{
}
}
import struct CR4PlayerTargeting{
import public final function SetConsts(consts : SR4PlayerTargetingConsts
);
import public final function BeginFindTarget(inValues : SR4PlayerTargeti
ngIn);
import public final function EndFindTarget(outValues : SR4PlayerTargetin
gOut);
import public final function FindTarget();
import public final function WasVisibleInScaledFrame(entity : CEntity, f
rameSizeX : Float, frameSizeY : Float) : Bool;
}
class ConstDamper extends CObject{
protected var destValue : Float;
protected var currValue : Float;
protected var deltaValue : Float;
public final function SetDamp(_deltaValue : Float){
deltaValue = ClampF(_deltaValue, 0.000000, 10000.000000);
/* NOP */;
}
public final function Init(curr : Float, dest : Float){
currValue = curr;
destValue = dest;
/* NOP */;
}
public final function Reset(){
destValue = 0.000000;
currValue = 0.000000;
/* NOP */;
}
public final function SetValue(value : Float){
destValue = value;
/* NOP */;
}
public final function GetValue() : Float{
return currValue;
/* NOP */;
}
public function Update(dt : Float){
if (currValue < destValue){
currValue = MinF(currValue + dt * deltaValue, destValue)
;
} else {
currValue = MaxF(currValue - dt * deltaValue, destValue)
;
}
/* NOP */;
}
public final function UpdateAndGet(dt : Float, value : Float) : Float{
SetValue(value);
Update(dt);

return GetValue();
/* NOP */;
}
}
import struct CR4Game{
public saved var zoneName : EZoneName;
private var gamerProfile : W3GamerProfile;
private var isDialogOrCutscenePlaying : Bool;
private saved var recentDialogOrCutsceneEndGameTime : GameTime;
public var isCutscenePlaying : Bool;
public var isDialogDisplayDisabled : Bool;
public var witcherLog : W3GameLog;
public var deathSaveLockId : Int32;
private var currentPresence : CName;
private var restoreUsableItemL : Bool;
private saved var gameplayFactsForRemoval : array<SGameplayFactRemoval>;
private saved var gameplayFacts : array<SGameplayFact>;
private saved var tutorialManagerHandle : EntityHandle;
private saved var diffChangePostponed : EDifficultyMode;
private saved var dynamicallySpawnedBoats : array<EntityHandle>;
private saved var dynamicallySpawnedBoatsToDestroy : array<EntityHandle>
;
public var isRespawningInLastCheckpoint : Bool;
private var environmentID : Int32;
public var logEnabled : Bool;
public var globalEventsScriptsDispatcherInternal : CR4GlobalEventsScript
sDispatcher;
public var minimapSettings : C2dArray;
public var playerStatisticsSettings : C2dArray;
public var hudSettings : C2dArray;
public var damageMgr : W3DamageManager;
public var effectMgr : W3GameEffectManager;
private var timescaleSources : array<STimescaleSource>;
public saved var envMgr : W3EnvironmentManager;
public var runewordMgr : W3RunewordManager;
private var questLevelsFilePaths : array<String>;
public var questLevelsContainer : array<C2dArray>;
public var expGlobalModifiers : C2dArray;
public var expGlobalMod_kills : Float;
public var expGlobalMod_quests : Float;
private var syncAnimManager : W3SyncAnimationManager;
private var isSignedIn : Bool;
public var m_runReactionSceneDialog : Bool;
private var uiHorizontalFrameScale : Float;
private var uiVerticalFrameScale : Float;
private var uiScale : Float;
private var uiGamepadScaleGain : Float;
private var uiOpacity : Float;
protected var isColorBlindMode : Bool;
private var menuToOpen : CName;
public var postponedPreAttackEvents : array<SPostponedPreAttackEvent>;
//NULL type for params
import public final function ActivateHorseCamera(activate : Bool, blendT
ime : Float, instantMount : Bool);
import public final function GetFocusModeController() : CFocusModeContro
ller;
import public final function GetSurfacePostFX() : CGameplayFXSurfacePost
;
import public final function GetCommonMapManager() : CCommonMapManager;

import public final function GetJournalManager() : CWitcherJournalManage


r;
import public final function GetLootManager() : CR4LootManager;
import public final function GetCityLightManager() : CCityLightManager;
import public final function GetInteractionsManager() : CInteractionsMan
ager;
import public final function GetGuiManager() : CR4GuiManager;
import public final function GetGlobalEventsScriptsDispatcher() : CR4Glo
balEventsScriptsDispatcher;
import public final function GetFastForwardSystem() : CGameFastForwardSy
stem;
import public final function StartSepiaEffect(fadeInTime : Float) : Bool
;
import public final function StopSepiaEffect(fadeOutTime : Float) : Bool
;
import public final function GetWindAtPoint(point : Vector) : Vector;
import public final function GetWindAtPointForVisuals(point : Vector) :
Vector;
import public final function GetGameCamera() : CCustomCamera;
import public final function GetBuffImmunitiesForActor(actor : CActor) :
CBuffImmunity;
import public final function GetMonsterParamsForActor(actor : CActor, mo
nsterCategory : EMonsterCategory, soundMonsterName : CName, isTeleporting : Bool
, canBeTargeted : Bool, canBeHitByFists : Bool) : Bool;
import public final function GetMonsterParamForActor(actor : CActor, val
: CMonsterParam) : Bool;
import public final function SummonPlayerHorse(teleportToSafeSpot : Bool
, createEntityHelper : CR4CreateEntityHelper);
import public final function GetVolumePathManager() : CVolumePathManager
;
import public final function ToggleMenus();
import public final function ToggleInput();
import public final function NotifyOpeningJournalEntry(jorunalEntry : CJ
ournalBase);
import public final function GetSecondScreenManager() : CR4SecondScreenM
anagerScriptProxy;
import public final function GetKinectSpeechRecognizer() : CR4KinectSpee
chRecognizerListenerScriptProxy;
import public final function GetResourceAliases(aliases : array<String>)
;
import public final function GetTutorialSystem() : CR4TutorialSystem;
import public final function DisplaySystemHelp();
import public final function DisplayUserProfileSystemDialog();
import public final function SetRichPresence(presence : CName);
import public final function SetActiveUserPromiscuous();
import public final function ChangeActiveUser();
import public final function GetActiveUserDisplayName() : String;
import public final function GetPlatform() : Int32;
import public final function IsContentAvailable(content : CName) : Bool;
import public final function ProgressToContentAvailable(content : CName)
: Int32;
import public final function ShouldForceInstallVideo() : Bool;
import public final function OnUserDialogCallback(message : Int32, actio
n : Int32);
import public final function SaveUserSettings();
import public final function GetGwintManager() : CR4GwintManager;
import public final function IsDebugQuestMenuEnabled() : Bool;
import public final function EnableNewGamePlus(enable : Bool);
import public final function StartNewGamePlus(save : SSavegameInfo) : EN
ewGamePlusStatus;

public function SetIsRespawningInLastCheckpoint(){


isRespawningInLastCheckpoint = true;
/* NOP */;
}
public function OnGameSaveListUpdated() : Bool{
var menuBase : CR4MenuBase;
var ingameMenu : CR4IngameMenu;
menuBase = (CR4MenuBase)theGame.GetGuiManager().GetRootMenu();
if (menuBase){
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu();
if (ingameMenu){
ingameMenu.HandleSaveListUpdate();
}
}
/* NOP */;
}
public function OnGameLoadInitFinished() : Bool{
var requiredContent : array<CName>;
var blockedContentTag : CName;
var i : Int32;
var progress : Float;
var loadResult : ELoadGameResult;
var ingameMenu : CR4IngameMenu;
var menuBase : CR4MenuBase;
loadResult = GetLoadGameProgress();
blockedContentTag = 'launch0';
if (loadResult != 5 && loadResult != 4){
theSound.SoundEvent("stop_music");
theSound.SoundEvent("gui_global_game_start");
theGame.GetGuiManager().RequestMouseCursor(false);
}
if (loadResult == 0 || loadResult == 1 || loadResult == 3){
/* NOP */;
isRespawningInLastCheckpoint = false;
return true;
}
if (loadResult == 5){
GetContentRequiredByLastSave(requiredContent);
theSound.SoundEvent("gui_global_denied");
i = requiredContent.Size() - 1;
while (i >= 0){
if (!super.IsContentAvailable(requiredContent[i]
)){
blockedContentTag = requiredContent[i];
break;
}
i -= 1;
}
progress = super.ProgressToContentAvailable(blockedConte
ntTag);
GetGuiManager().ShowProgressDialog(UMID_MissingContentOn
LoadError, "", "error_message_new_game_not_ready", true, 0, progress, 1, blocked
ContentTag);
isRespawningInLastCheckpoint = false;
return true;
}
if (loadResult == 4){
menuBase = (CR4MenuBase)theGame.GetGuiManager().GetRootM
enu();
theSound.SoundEvent("gui_global_denied");

if (menuBase){
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu(
);
if (ingameMenu){
ingameMenu.HandleLoadGameFailed();
}
}
}
if (loadResult != 5 && loadResult != 4 && isRespawningInLastChec
kpoint){
ReleaseNoSaveLock(deathSaveLockId);
theInput.RestoreContext('Exploration', true);
isRespawningInLastCheckpoint = false;
}
/* NOP */;
}
public function OnGameLoadInitFinishedSuccess() : Bool{
GetGuiManager().GetRootMenu().CloseMenu();
/* NOP */;
}
public function IsFocusModeActive() : Bool{
var focusModeController : CFocusModeController;
focusModeController = super.GetFocusModeController();
if (focusModeController){
return focusModeController.IsActive();
}
return false;
/* NOP */;
}
public function EnableLog(enable : Bool){
logEnabled = enable;
/* NOP */;
}
public function CanLog() : Bool{
return logEnabled && !IsFinalBuild();
/* NOP */;
}
public function GetGlobalEventsManager() : CR4GlobalEventsScriptsDispatc
her{
if (!globalEventsScriptsDispatcherInternal){
globalEventsScriptsDispatcherInternal = super.GetGlobalE
ventsScriptsDispatcher();
}
return globalEventsScriptsDispatcherInternal;
/* NOP */;
}
public final function UpdateRichPresence(presence : CName){
SetRichPresence(presence);
currentPresence = presence;
/* NOP */;
}
public final function ClearRichPresence(presence : CName){
var manager : CCommonMapManager;
var currentArea : EAreaName;
if (currentPresence == presence){
manager = theGame.GetCommonMapManager();
currentArea = manager.GetCurrentJournalArea();
currentPresence = manager.GetLocalisationNameFromAreaTyp
e(currentArea);
SetRichPresence(currentPresence);

}
/* NOP */;
}
public function GetSyncAnimManager() : W3SyncAnimationManager{
if (!syncAnimManager){
syncAnimManager = new W3SyncAnimationManager in this;
}
return syncAnimManager;
/* NOP */;
}
public function SetEnvironmentID(id : Int32){
environmentID = id;
/* NOP */;
}
private function SetTimescaleSources(){
timescaleSources.Clear();
timescaleSources.Grow(EnumGetMax('ETimescaleSource') + 1);
timescaleSources[1].sourceType = 1;
timescaleSources[1].sourceName = 'PotionBlizzard';
timescaleSources[1].sourcePriority = 10;
timescaleSources[2].sourceType = 2;
timescaleSources[2].sourceName = 'SlowMotionTask';
timescaleSources[2].sourcePriority = 15;
timescaleSources[3].sourceType = 3;
timescaleSources[3].sourceName = 'HeavyAttack';
timescaleSources[3].sourcePriority = 15;
timescaleSources[4].sourceType = 4;
timescaleSources[4].sourceName = 'ThrowingAim';
timescaleSources[4].sourcePriority = 15;
timescaleSources[10].sourceType = 10;
timescaleSources[10].sourceName = 'RaceSlowMo';
timescaleSources[10].sourcePriority = 10;
timescaleSources[5].sourceType = 5;
timescaleSources[5].sourceName = 'RadialMenu';
timescaleSources[5].sourcePriority = 20;
timescaleSources[6].sourceType = 6;
timescaleSources[6].sourceName = 'CFM_PlayAnim';
timescaleSources[6].sourcePriority = 25;
timescaleSources[7].sourceType = 7;
timescaleSources[7].sourceName = 'CFM_On';
timescaleSources[7].sourcePriority = 20;
timescaleSources[8].sourceType = 8;
timescaleSources[8].sourceName = 'debug_input';
timescaleSources[8].sourcePriority = 30;
timescaleSources[9].sourceType = 9;
timescaleSources[9].sourceName = 'skill_frenzy';
timescaleSources[9].sourcePriority = 15;
timescaleSources[11].sourceType = 11;
timescaleSources[11].sourceName = 'horse_melee';
timescaleSources[11].sourcePriority = 15;
timescaleSources[12].sourceType = 12;
timescaleSources[12].sourceName = 'finisher_input';
timescaleSources[12].sourcePriority = 15;
timescaleSources[13].sourceType = 13;
timescaleSources[13].sourceName = 'tutorial_fight';
timescaleSources[13].sourcePriority = 25;
timescaleSources[14].sourceType = 14;
timescaleSources[14].sourceName = 'instant_kill';
timescaleSources[14].sourcePriority = 5;
/* NOP */;

}
public function GetTimescaleSource(src : ETimescaleSource) : CName{
return timescaleSources[src].sourceName;
/* NOP */;
}
public function GetTimescalePriority(src : ETimescaleSource) : Int32{
return timescaleSources[src].sourcePriority;
/* NOP */;
}
private function UpdateSecondScreen(){
var areaMapPins : array<SAreaMapPinInfo>;
var areaMapPinsCount : Int32;
var index_areas : Int32;
var worldPath : String;
var localMapPins : array<SCommonMapPinInstance>;
var globalMapPins : array<SCommonMapPinInstance>;
var mapPin : SCommonMapPinInstance;
areaMapPins = GetCommonMapManager().GetAreaMapPins();
areaMapPinsCount = areaMapPins.Size();
index_areas = 0;
while (index_areas < areaMapPinsCount){
mapPin.id = areaMapPins[index_areas].areaType;
mapPin.tag = '0';
mapPin.type = 'WorldMap';
mapPin.position = areaMapPins[index_areas].position;
mapPin.isDiscovered = true;
globalMapPins.PushBack(mapPin);
localMapPins = GetCommonMapManager().GetMapPinInstances(
areaMapPins[index_areas].worldPath);
GetSecondScreenManager().SendAreaMapPins(areaMapPins[ind
ex_areas].areaType, localMapPins);
index_areas += 1;
}
GetSecondScreenManager().SendGlobalMapPins(globalMapPins);
/* NOP */;
}
public function isUserSignedIn() : Bool{
if (super.GetPlatform() == 0){
return true;
} else {
return isSignedIn;
}
/* NOP */;
}
public function OnUserSignedIn() : Bool{
isSignedIn = true;
GetGuiManager().OnSignIn();
/* NOP */;
}
public function OnUserSignedOut() : Bool{
isSignedIn = false;
GetGuiManager().OnSignOut();
/* NOP */;
}
public function OnSignInStarted() : Bool{
GetGuiManager().OnSignInStarted();
/* NOP */;
}
public function OnSignInCancelled() : Bool{
GetGuiManager().OnSignInCancelled();

/* NOP */;
}
public function OnConfigValueChanged(varName : CName, value : String){
var kinect : CR4KinectSpeechRecognizerListenerScriptProxy;
kinect = super.GetKinectSpeechRecognizer();
if (varName == 'Kinect'){
if (value == "true"){
kinect.SetEnabled(true);
} else {
kinect.SetEnabled(false);
}
}
/* NOP */;
}
public function LoadQuestLevels(filePath : String){
var index : Int32;
index = questLevelsFilePaths.FindFirst(filePath);
if (index == -1){
questLevelsFilePaths.PushBack(filePath);
questLevelsContainer.PushBack(LoadCSV(filePath));
}
/* NOP */;
}
public function UnloadQuestLevels(filePath : String){
var index : Int32;
index = questLevelsFilePaths.FindFirst(filePath);
if (index != -1){
questLevelsFilePaths.Erase(index);
questLevelsContainer.Erase(index);
}
/* NOP */;
}
public function OnGameStarting(restored : Bool) : Bool{
var diff : Int32;
if (!restored){
gameplayFacts.Clear();
gameplayFactsForRemoval.Clear();
}
if (!FactsDoesExist("lowest_difficulty_used") || GetLowestDiffic
ultyUsed() == 0){
SetLowestDifficultyUsed(GetDifficultyLevel());
}
SetHoursPerMinute(0.250000);
SetTimescaleSources();
isDialogOrCutscenePlaying = false;
params.Init();
witcherLog = new W3GameLog in this;
InitGamerProfile();
damageMgr = new W3DamageManager in this;
tooltipSettings = LoadCSV("gameplay\globals\tooltip_settings.csv
");
minimapSettings = LoadCSV("gameplay\globals\minimap_settings.csv
");
LoadHudSettings();
playerStatisticsSettings = LoadCSV("gameplay\globals\player_stat
istics_settings.csv");
LoadQuestLevels("gameplay\globals\quest_levels.csv");
expGlobalModifiers = LoadCSV("gameplay\globals\exp_mods.csv");
expGlobalMod_kills = StringToFloat(expGlobalModifiers.GetValueAt
(0, 0), /* NOP */);

expGlobalMod_quests = StringToFloat(expGlobalModifiers.GetValueA
t(1, 0), /* NOP */);
InitializeEffectManager();
envMgr = new W3EnvironmentManager in this;
envMgr.Initialize();
runewordMgr = new W3RunewordManager in this;
runewordMgr.Init();
theGame.RequestPopup('OverlayPopup', /* NOP */);
theSound.Initialize();
if (IsLoadingScreenVideoPlaying()){
theSound.EnterGameState(13);
}
/* NOP */;
}
private function InitGamerProfile(){
gamerProfile = new W3GamerProfile in this;
gamerProfile.Init();
/* NOP */;
}
public function GetGamerProfile() : W3GamerProfile{
if (!gamerProfile){
InitGamerProfile();
}
return gamerProfile;
/* NOP */;
}
public function OnTick(){
if (envMgr){
envMgr.Update();
}
if (diffChangePostponed != 0 && thePlayer){
OnDifficultyChanged(diffChangePostponed);
diffChangePostponed = 0;
}
FirePostponedPreAttackEvents();
/* NOP */;
}
public function OnGameStarted(restored : Bool) : Bool{
var focusModeController : CFocusModeController;
focusModeController = super.GetFocusModeController();
if (!restored){
thePlayer.displayedQuestsGUID.Clear();
if (FactsQuerySum("started_new_game") <= 0){
dynamicallySpawnedBoats.Clear();
FactsAdd("started_new_game", 1, /* NOP */);
}
}
if (focusModeController){
focusModeController.OnGameStarted();
}
GetCommonMapManager().OnGameStarted();
super.ClearRichPresence(currentPresence);
theSound.InitializeAreaMusic(GetCommonMapManager().GetCurrentAre
a());
UpdateSecondScreen();
if (thePlayer && thePlayer.teleportedOnBoatToOtherHUB){
thePlayer.SetTeleportedOnBoatToOtherHUB(false);
thePlayer.AddTimer('DelayedSpawnAndMountBoat', 0.001000,
false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}

/* NOP */;
}
public function OnHandleWorldChange() : Bool{
thePlayer.SetTeleportedOnBoatToOtherHUB(true);
/* NOP */;
}
public function OnBeforeWorldChange(worldName : String) : Bool{
var manager : CCommonMapManager;
manager = theGame.GetCommonMapManager();
if (manager){
manager.CacheMapPins();
manager.ForceSettingLoadingScreenVideoForWorld(worldName
);
}
thePlayer.SetUsedVehicle(NULL);
/* NOP */;
}
public function OnAfterLoadingScreenGameStart() : Bool{
theSound.LeaveGameState(13);
theSound.SoundEvent("system_resume");
/* NOP */;
}
public function OnSaveStarted(type : ESaveGameType) : Bool{
/* NOP */;
/* NOP */;
}
public function OnSaveCompleted(type : ESaveGameType, succeeded : Bool)
: Bool{
var hud : CR4ScriptedHud;
var text : String;
/* NOP */;
if (succeeded){
theGame.GetGuiManager().ShowSavingIndicator();
theGame.GetGuiManager().HideSavingIndicator(/* NOP */);
if (theGame.GetPlatform() == 1){
text = "panel_hud_message_gamesaved_X1";
} else if (theGame.GetPlatform() == 2){
text = "panel_hud_message_gamesaved_PS4";
} else {
text = "panel_hud_message_gamesaved";
}
if (type == 1 || type == 5 || type == 4){
hud = (CR4ScriptedHud)GetHud();
if (hud){
hud.HudConsoleMsg(GetLocStringByKeyExt(t
ext));
}
} else {
thePlayer.DisplayHudMessage(text);
}
} else if (type == 2 || type == 3){
if (theGame.GetPlatform() == 1){
text = "panel_hud_message_gamesavedfailed_X1";
} else if (theGame.GetPlatform() == 2){
text = "panel_hud_message_gamesavedfailed_PS4";
} else {
text = "panel_hud_message_gamesavedfailed";
}
theGame.GetGuiManager().ShowUserDialog(0, "", text, 0);
}

/* NOP */;
}
public function OnControllerReconnected() : Bool{
if (!theGame.IsBlackscreen() && theGame.IsActive()){
if (theGame.GetGuiManager().IsAnyMenu()){
theSound.SoundEvent("system_resume_music_only");
} else {
theSound.SoundEvent("system_resume");
}
}
GetGuiManager().OnControllerReconnected();
/* NOP */;
}
public function OnControllerDisconnected() : Bool{
if (!theGame.IsBlackscreen() && theGame.IsActive() && !theGame.G
etGuiManager().IsAnyMenu()){
theSound.SoundEvent("system_pause");
}
GetGuiManager().OnControllerDisconnected();
/* NOP */;
}
public function OnGiveReward(target : CEntity, rewardName : CName, rewrd
: SReward) : Bool{
var i : Int32;
var gameplayEntity : CGameplayEntity;
var inventory : CInventoryComponent;
var multiplier : Float;
var ids : array<SItemUniqueId>;
var itemCategory : CName;
var lvlDiff : Int32;
var moneyWon : Int32;
var expModifier : Float;
if (target == thePlayer){
if (rewrd.experience > 0 && GetWitcherPlayer()){
if (FactsQuerySum("NewGamePlus") > 0){
expModifier = 0.500000;
} else if (FactsQuerySum("witcher3_game_finished
") > 1){
expModifier = 0.500000;
} else {
lvlDiff = rewrd.level - thePlayer.GetLev
el();
if (rewrd.level == 0){
expModifier = 1.000000;
} else if (lvlDiff >= theGame.params.LEV
EL_DIFF_DEADLY){
expModifier = 0.800000;
} else if (lvlDiff >= theGame.params.LEV
EL_DIFF_HIGH){
expModifier = 0.900000;
} else if (lvlDiff > -theGame.params.LEV
EL_DIFF_HIGH){
expModifier = 1.000000;
} else {
expModifier = 0.000000;
}
}
if (expModifier > 0.000000){
GetWitcherPlayer().AddPoints(1, RoundF(r
ewrd.experience * expGlobalMod_quests * expModifier), true);

}
}
if (rewrd.achievement > 0){
theGame.GetGamerProfile().AddAchievement(rewrd.a
chievement);
}
}
gameplayEntity = (CGameplayEntity)target;
if (gameplayEntity){
inventory = gameplayEntity.GetInventory();
if (inventory){
if (rewrd.gold > 0){
multiplier = thePlayer.GetRewardMultipli
er(rewardName);
inventory.AddMoney(rewrd.gold * multipli
er);
thePlayer.RemoveRewardMultiplier(rewardN
ame);
if (target == thePlayer){
moneyWon = rewrd.gold * multipli
er;
if (moneyWon > 0){
thePlayer.DisplayItemRew
ardNotification('Crowns', moneyWon);
}
}
}
i = 0;
while (i < rewrd.items.Size()){
if (rewrd.items[i].amount > 0){
ids = inventory.AddAnItem(rewrd.
items[i].item, rewrd.items[i].amount, /* NOP */, /* NOP */, /* NOP */);
itemCategory = inventory.GetItem
Category(ids[0]);
if (itemCategory == 'alchemy_rec
ipe' || itemCategory == 'crafting_schematic'){
inventory.ReadSchematics
AndRecipes(ids[0]);
}
if (target == thePlayer){
if (!inventory.ItemHasTa
g(ids[0], 'GwintCard')){
thePlayer.Displa
yItemRewardNotification(rewrd.items[i].item, rewrd.items[i].amount);
}
}
}
i += 1;
}
}
}
/* NOP */;
}
public function IsEffectManagerInitialized() : Bool{
if (!effectMgr){
return false;
}
return effectMgr.IsReady();
/* NOP */;
}

public function InitializeEffectManager(){


effectMgr = new W3GameEffectManager in this;
effectMgr.Initialize();
/* NOP */;
}
public function GetLowestDifficultyUsed() : EDifficultyMode{
return FactsQuerySum("lowest_difficulty_used");
/* NOP */;
}
public function SetLowestDifficultyUsed(d : EDifficultyMode){
FactsSet("lowest_difficulty_used", d, /* NOP */);
/* NOP */;
}
public function OnGameEnded() : Bool{
var focusModeController : CFocusModeController;
if (runewordMgr){
delete runewordMgr;
runewordMgr = NULL;
}
focusModeController = super.GetFocusModeController();
if (focusModeController){
focusModeController.OnGameEnded();
}
DeactivateEnvironment(environmentID, 0);
if (effectMgr){
delete effectMgr;
effectMgr = NULL;
}
if (envMgr){
delete envMgr;
envMgr = NULL;
}
if (syncAnimManager){
delete syncAnimManager;
syncAnimManager = NULL;
}
RemoveTimeScale(GetTimescaleSource(5));
theSound.Finalize();
/* NOP */;
/* NOP */;
}
public function SetRunReactionSceneDialog(val : Bool){
m_runReactionSceneDialog = val;
/* NOP */;
}
public function SetIsDialogOrCutscenePlaying(b : Bool){
var witcher : W3PlayerWitcher;
var activePoster : W3Poster;
var hud : CR4ScriptedHud;
var radialModule : CR4HudModuleRadialMenu;
var lootPopup : CR4LootPopup;
var bolts : SItemUniqueId;
isDialogOrCutscenePlaying = b;
recentDialogOrCutsceneEndGameTime = GetGameTime();
if (b){
hud = (CR4ScriptedHud)GetHud();
if (hud){
radialModule = (CR4HudModuleRadialMenu)hud.GetHu
dModule("RadialMenuModule");
if (radialModule && radialModule.IsRadialMenuOpe

ned()){
radialModule.HideRadialMenu();
}
}
lootPopup = (CR4LootPopup)GetGuiManager().GetPopup('Loot
Popup');
if (lootPopup){
lootPopup.ClosePopup();
}
}
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().OnCutsceneOrDialogChange(b);
if (b){
FactsAdd("tut_dialog_started", 1, CeilF(ConvertR
ealTimeSecondsToGameSeconds(1)));
}
}
witcher = GetWitcherPlayer();
if (witcher && witcher.IsAnyQuenActive()){
witcher.FinishQuen();
}
activePoster = thePlayer.GetActivePoster();
if (activePoster){
CloseMenu('PosterMenu');
activePoster.OnEndedObservingPoster();
}
if (b && thePlayer.IsHoldingItemInLHand()){
thePlayer.HideUsableItem(true);
restoreUsableItemL = true;
}
if (!b && restoreUsableItemL){
restoreUsableItemL = false;
if (!thePlayer.IsInCombat()){
thePlayer.OnUseSelectedItem(/* NOP */);
}
}
if (!b && witcher){
if (!witcher.GetItemEquippedOnSlot(17, bolts) || witcher
.inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO)){
witcher.AddAndEquipInfiniteBolt(/* NOP */, /* NO
P */);
}
}
/* NOP */;
}
public final function IsDialogOrCutscenePlaying() : Bool{
return isDialogOrCutscenePlaying;
/* NOP */;
}
public final function GetRecentDialogOrCutsceneEndGameTime() : GameTime{
return recentDialogOrCutsceneEndGameTime;
/* NOP */;
}
public function SetIsCutscenePlaying(b : Bool){
isCutscenePlaying = b;
/* NOP */;
}
public function PopulateMenuQueueStartupOnce(menus : array<CName>){
menus.PushBack('StartupMoviesMenu');

/* NOP */;
}
public function PopulateMenuQueueStartupAlways(menus : array<CName>){
if (super.GetPlatform() != 0){
menus.PushBack('StartScreenMenu');
}
/* NOP */;
}
public function PopulateMenuQueueConfig(menus : array<CName>){
var inGameConfigWrapper : CInGameConfigWrapper;
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
if (super.GetPlatform() != 0){
menus.PushBack('RescaleMenu');
menus.PushBack('MainGammaMenu');
}
/* NOP */;
}
public function PopulateMenuQueueMainOnce(menus : array<CName>){
if (super.GetPlatform() != 0){
menus.PushBack('AutosaveWarningMenu');
}
menus.PushBack('RecapMoviesMenu');
/* NOP */;
}
public function PopulateMenuQueueMainAlways(menus : array<CName>){
menus.PushBack('CommonMainMenu');
/* NOP */;
}
public function GetNewGameDefinitionFilename() : String{
return "game/witcher3.redgame";
/* NOP */;
}
public function GetCurrentZone() : EZoneName{
return zoneName;
/* NOP */;
}
public function SetCurrentZone(tag : CName){
zoneName = ZoneNameToType(tag);
/* NOP */;
}
public function getColorBlindMode() : Bool{
return isColorBlindMode;
/* NOP */;
}
public function setColorBlindMode(value : Bool){
isColorBlindMode = value;
/* NOP */;
}
public function GetMenuToOpen() : CName{
return menuToOpen;
/* NOP */;
}
public function SetMenuToOpen(menu : CName){
menuToOpen = menu;
/* NOP */;
}
public function RequestMenuWithBackground(menu : CName, backgroundMenu :
CName, initData : IScriptable){
var commonMenu : CR4CommonMenu;
var guiManager : CR4GuiManager;

guiManager = super.GetGuiManager();
commonMenu = (CR4CommonMenu)guiManager.GetRootMenu();
if (commonMenu){
commonMenu.SwitchToSubMenu(menu, "");
} else {
if (guiManager.IsAnyMenu()){
guiManager.GetRootMenu().CloseMenu();
}
SetMenuToOpen(menu);
theGame.RequestMenu(backgroundMenu, initData);
}
/* NOP */;
}
public function OpenPopup(DataObject : W3PopupData){
theGame.RequestMenu('PopupMenu', DataObject);
/* NOP */;
}
public function SetUIVerticalFrameScale(value : Float){
uiVerticalFrameScale = value;
/* NOP */;
}
public function GetUIVerticalFrameScale() : Float{
return uiVerticalFrameScale;
/* NOP */;
}
public function SetUIHorizontalFrameScale(value : Float){
var horizontalPlusFrameScale : Float;
uiHorizontalFrameScale = value;
horizontalPlusFrameScale = theGame.GetUIHorizontalPlusFrameScale
();
uiHorizontalFrameScale = uiHorizontalFrameScale * horizontalPlus
FrameScale;
/* NOP */;
}
public function GetUIHorizontalFrameScale() : Float{
return uiHorizontalFrameScale;
/* NOP */;
}
public function SetUIScale(value : Float){
uiScale = value;
/* NOP */;
}
public function GetUIScale() : Float{
return uiScale;
/* NOP */;
}
public function SetUIGamepadScaleGain(value : Float){
uiGamepadScaleGain = value;
/* NOP */;
}
public function GetUIGamepadScaleGain() : Float{
return uiGamepadScaleGain;
/* NOP */;
}
public function SetDeathSaveLockId(i : Int32){
deathSaveLockId = i;
/* NOP */;
}
public function SetUIOpacity(value : Float){
uiOpacity = value;

/* NOP */;
}
public function GetUIOpacity() : Float{
return uiOpacity;
/* NOP */;
}
public function setDialogDisplayDisabled(value : Bool){
isDialogDisplayDisabled = value;
/* NOP */;
}
public function LoadHudSettings(){
var inGameConfigWrapper : CInGameConfigWrapper;
hudSettings = LoadCSV("gameplay\globals\hud_settings.csv");
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
isDialogDisplayDisabled = inGameConfigWrapper.GetVarValue('Local
ization', 'Subtitles') == "false";
SetUIVerticalFrameScale(StringToFloat(inGameConfigWrapper.GetVar
Value('Hidden', 'uiVerticalFrameScale'), /* NOP */));
SetUIHorizontalFrameScale(StringToFloat(inGameConfigWrapper.GetV
arValue('Hidden', 'uiHorizontalFrameScale'), /* NOP */));
uiScale = StringToFloat(theGame.hudSettings.GetValueAt(1, theGam
e.hudSettings.GetRowIndexAt(0, "uiScale")), /* NOP */);
uiOpacity = StringToFloat(theGame.hudSettings.GetValueAt(1, theG
ame.hudSettings.GetRowIndexAt(0, "uiOpacity")), /* NOP */);
/* NOP */;
}
public function OnRefreshUIScaling() : Bool{
var inGameConfigWrapper : CInGameConfigWrapper;
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
SetUIVerticalFrameScale(StringToFloat(inGameConfigWrapper.GetVar
Value('Hidden', 'uiVerticalFrameScale'), /* NOP */));
SetUIHorizontalFrameScale(StringToFloat(inGameConfigWrapper.GetV
arValue('Hidden', 'uiHorizontalFrameScale'), /* NOP */));
/* NOP */;
}
public function OnSpawnPlayerHorse() : Bool{
var createEntityHelper : CR4CreateEntityHelper;
thePlayer.RaiseEvent('HorseSummon');
if (!thePlayer.GetHorseWithInventory() || !thePlayer.GetHorseWit
hInventory().IsAlive() || !thePlayer.WasVisibleInScaledFrame(thePlayer.GetHorseW
ithInventory(), 1.500000, 1.500000) && VecDistanceSquared(thePlayer.GetWorldPosi
tion(), thePlayer.GetHorseWithInventory().GetWorldPosition()) > 900 || VecDistan
ceSquared(thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWor
ldPosition()) > 1600){
createEntityHelper = new CR4CreateEntityHelper in this;
createEntityHelper.SetPostAttachedCallback(this, 'OnPlay
erHorseSummoned');
theGame.SummonPlayerHorse(true, createEntityHelper);
} else {
thePlayer.GetHorseWithInventory().SignalGameplayEventPar
amObject('HorseSummon', thePlayer);
}
thePlayer.OnSpawnHorse();
/* NOP */;
}
private function OnPlayerHorseSummoned(horseEntity : CEntity){
if (FactsQuerySum("q110_geralt_refused_pay") > 0){
(CActor)horseEntity.ApplyAppearance('player_horse_after_
q110');
}

thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject
('HorseSummon', thePlayer);
GetWitcherPlayer().GetHorseManager().ApplyHorseUpdateOnSpawn();
/* NOP */;
}
public function OnTutorialMessageForChoiceLines(flags : Int32) : Bool{
GameplayFactsSet('dialog_choice_flags', flags);
GameplayFactsAdd('dialog_choice_is_set', 1, 1);
/* NOP */;
}
public function OnTutorialMessageForChoiceLineChosen(flags : Int32) : Bo
ol{
GameplayFactsSet('dialog_used_choice_flags', flags);
GameplayFactsAdd('dialog_used_choice_is_set', 1, 1);
/* NOP */;
}
public function GameplayFactsAdd(factName : String, value : Int32, realt
imeSecsValidFor : Int32){
var idx : Int32;
var newFact : SGameplayFact;
var newFactRemoval : SGameplayFactRemoval;
if (value < 0){
return;
} else if (value == 0){
value = 1;
}
idx = GetGameplayFactIndex(factName);
if (idx >= 0){
gameplayFacts[idx].value += value;
} else {
newFact.factName = factName;
newFact.value = value;
gameplayFacts.PushBack(newFact);
}
if (realtimeSecsValidFor > 0){
newFactRemoval.factName = factName;
newFactRemoval.value = value;
newFactRemoval.timerID = thePlayer.AddTimer('GameplayFac
tRemove', realtimeSecsValidFor, /* NOP */, /* NOP */, /* NOP */, true, false);
gameplayFactsForRemoval.PushBack(newFactRemoval);
}
/* NOP */;
}
public function GameplayFactsSet(factName : String, value : Int32){
var idx : Int32;
var newFact : SGameplayFact;
idx = GetGameplayFactIndex(factName);
if (idx >= 0){
gameplayFacts[idx].value = value;
} else {
newFact.factName = factName;
newFact.value = value;
gameplayFacts.PushBack(newFact);
}
/* NOP */;
}
public function GameplayFactsRemove(factName : String){
var i : Int32;
i = 0;
while (i < gameplayFacts.Size()){

if (gameplayFacts[i].factName == factName){
gameplayFacts.EraseFast(i);
return;
}
i += 1;
}
/* NOP */;
}
public function GameplayFactRemoveFromTimer(timerID : Int32){
var idx : Int32;
var factIdx : Int32;
idx = GetGameplayFactsForRemovalIndex(timerID);
if (idx < 0){
LogAssert(false, "CR4Game.GameplayFactRemoveFromTimer: t
rying to process non-existant timer <<" + timerID + ">>");
return;
}
factIdx = GetGameplayFactIndex(gameplayFactsForRemoval[idx].fact
Name);
if (factIdx < 0){
return;
}
gameplayFacts[factIdx].value -= gameplayFactsForRemoval[idx].val
ue;
if (gameplayFacts[factIdx].value <= 0){
gameplayFacts.EraseFast(factIdx);
}
gameplayFactsForRemoval.EraseFast(idx);
/* NOP */;
}
public function GameplayFactsQuerySum(factName : String) : Int32{
var idx : Int32;
idx = GetGameplayFactIndex(factName);
if (idx >= 0){
return gameplayFacts[idx].value;
}
return 0;
/* NOP */;
}
private function GetGameplayFactIndex(factName : String) : Int32{
var i : Int32;
i = 0;
while (i < gameplayFacts.Size()){
if (gameplayFacts[i].factName == factName){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
private function GetGameplayFactsForRemovalIndex(timerID : Int32) : Int3
2{
var i : Int32;
i = 0;
while (i < gameplayFactsForRemoval.Size()){
if (gameplayFactsForRemoval[i].timerID == timerID){
return i;
}
i += 1;

}
return -1;
/* NOP */;
}
public function GetR4ReactionManager() : CR4ReactionManager{
return (CR4ReactionManager)GetBehTreeReactionManager();
/* NOP */;
}
public function GetDifficultyMode() : EDifficultyMode{
var diff : EDifficultyMode;
diff = GetDifficultyLevel();
if (diff == 0){
return 2;
}
return diff;
/* NOP */;
}
public function OnDifficultyChanged(newDifficulty : Int32) : Bool{
var i : Int32;
var lowestDiff : EDifficultyMode;
if (!thePlayer){
diffChangePostponed = newDifficulty;
return false;
}
theTelemetry.SetCommonStatI32(7, newDifficulty);
lowestDiff = GetLowestDifficultyUsed();
if (lowestDiff != newDifficulty && MinDiffMode(lowestDiff, newDi
fficulty) == newDifficulty){
SetLowestDifficultyUsed(newDifficulty);
}
UpdateStatsForDifficultyLevel(GetSpawnDifficultyMode());
/* NOP */;
}
public function OnPlayerChanged(){
var i : Int32;
var buffs : array<CBaseGameplayEffect>;
var witcher : W3PlayerWitcher;
thePlayer.RemoveAllNonAutoBuffs();
buffs = thePlayer.GetBuffs(/* NOP */, /* NOP */, /* NOP */);
i = 0;
while (i < buffs.Size()){
buffs[i].ResumeForced();
i += 1;
}
GetGameCamera().StopEffect('frost');
DisableCatViewFx(1.000000);
thePlayer.StopEffect('critical_low_health');
DisableDrunkFx(/* NOP */);
thePlayer.StopEffect('critical_toxicity');
if (GetWitcherPlayer()){
GetWitcherPlayer().UpdateEncumbrance();
}
UpdateStatsForDifficultyLevel(GetSpawnDifficultyMode());
RemoveAllTimeScales();
/* NOP */;
}
public function GetSpawnDifficultyMode() : EDifficultyMode{
if (thePlayer && thePlayer.IsCiri()){
return MinDiffMode(GetDifficultyMode(), 2);
}

return GetDifficultyMode();
/* NOP */;
}
public function UpdateStatsForDifficultyLevel(difficulty : EDifficultyMo
de){
var i : Int32;
var actor : CActor;
var npcs : array<CNewNPC>;
GetAllNPCs(npcs);
i = 0;
while (i < npcs.Size()){
actor = npcs[i];
if (actor){
actor.UpdateStatsForDifficultyLevel(difficulty);
}
i += 1;
}
/* NOP */;
}
public function CanTrackQuest(questEntry : CJournalQuest) : Bool{
var questName : String;
var baseName : String;
var i : Int32;
var questCount : Int32;
var playerLevel : Int32;
var questLevel : Int32;
var questLevels : C2dArray;
var questLevelsCount : Int32;
var iterQuestLevels : Int32;
baseName = questEntry.baseName;
playerLevel = thePlayer.GetLevel();
if (questEntry.GetType() == 3){
questLevelsCount = theGame.questLevelsContainer.Size();
iterQuestLevels = 0;
while (iterQuestLevels < questLevelsCount){
questLevels = theGame.questLevelsContainer[iterQ
uestLevels];
questCount = questLevels.GetNumRows();
i = 0;
while (i < questCount){
questName = questLevels.GetValueAtAsName
(0, i);
if (questName == baseName){
questLevel = NameToInt(questLeve
ls.GetValueAtAsName(1, i));
return playerLevel >= questLevel
- 5;
}
i += 1;
}
iterQuestLevels += 1;
}
}
return true;
/* NOP */;
}
public function IsBlackscreenOrFading() : Bool{
return IsBlackscreen() || IsFading();
/* NOP */;
}

public function OnPreAttackEvent(entity : CGameplayEntity, animEventName


: CName, animEventType : EAnimationEventType, data : CPreAttackEventData, animI
nfo : SAnimationEventAnimInfo) : Bool{
var postponedPreAttackEvent : SPostponedPreAttackEvent;
postponedPreAttackEvent.entity = entity;
postponedPreAttackEvent.eventName = animEventName;
postponedPreAttackEvent.eventType = animEventType;
postponedPreAttackEvent.data = data;
postponedPreAttackEvent.animInfo = animInfo;
postponedPreAttackEvents.PushBack(postponedPreAttackEvent);
/* NOP */;
}
public function FirePostponedPreAttackEvents(){
var i : Int32;
var size : Int32;
var entity : CGameplayEntity;
size = postponedPreAttackEvents.Size();
i = 0;
while (i < size){
entity = postponedPreAttackEvents[i].entity;
if (entity){
entity.OnPreAttackEvent(postponedPreAttackEvents
[i].eventName, postponedPreAttackEvents[i].eventType, postponedPreAttackEvents[i
].data, postponedPreAttackEvents[i].animInfo);
}
i += 1;
}
postponedPreAttackEvents.Clear();
/* NOP */;
}
public final function AddDynamicallySpawnedBoatHandle(handle : EntityHan
dle){
var i : Int32;
if (EntityHandleGet(handle)){
dynamicallySpawnedBoats.PushBack(handle);
if (dynamicallySpawnedBoats.Size() >= theGame.params.MAX
_DYNAMICALLY_SPAWNED_BOATS){
i = dynamicallySpawnedBoatsToDestroy.Size() - 1;
while (i >= 0){
if (!EntityHandleGet(dynamicallySpawnedB
oats[i])){
dynamicallySpawnedBoats.EraseFas
t(i);
}
i -= 1;
}
if (dynamicallySpawnedBoats.Size() >= theGame.pa
rams.MAX_DYNAMICALLY_SPAWNED_BOATS){
dynamicallySpawnedBoatsToDestroy.PushBac
k(dynamicallySpawnedBoats[0]);
dynamicallySpawnedBoats.Erase(0);
}
}
}
/* NOP */;
}
public final function IsBoatMarkedForDestroy(boat : W3Boat) : Bool{
var handle : EntityHandle;
var i : Int32;
EntityHandleSet(handle, boat);

i = 0;
while (i < dynamicallySpawnedBoatsToDestroy.Size()){
if (handle == dynamicallySpawnedBoatsToDestroy[i]){
dynamicallySpawnedBoatsToDestroy.EraseFast(i);
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public final function VibrateControllerVeryLight(duration : Float){
if (!theInput.LastUsedGamepad()){
return;
}
if (duration == 0){
duration = 0.150000;
}
if (IsSpecificRumbleActive(0.200000, 0)){
OverrideRumbleDuration(0.200000, 0, duration);
} else {
VibrateController(0.200000, 0, duration);
}
/* NOP */;
}
public final function VibrateControllerLight(duration : Float){
if (!theInput.LastUsedGamepad()){
return;
}
if (duration == 0){
duration = 0.200000;
}
if (IsSpecificRumbleActive(0.500000, 0)){
OverrideRumbleDuration(0.500000, 0, duration);
} else {
VibrateController(0.500000, 0, duration);
}
/* NOP */;
}
public final function VibrateControllerHard(duration : Float){
if (!theInput.LastUsedGamepad()){
return;
}
if (duration == 0){
duration = 0.200000;
}
if (IsSpecificRumbleActive(0.750000, 0.750000)){
OverrideRumbleDuration(0.750000, 0.750000, duration);
} else {
VibrateController(0.750000, 0.750000, duration);
}
/* NOP */;
}
public final function VibrateControllerVeryHard(duration : Float){
if (!theInput.LastUsedGamepad()){
return;
}
if (duration == 0){
duration = 0.500000;
}

if (IsSpecificRumbleActive(1, 1)){
OverrideRumbleDuration(1, 1, duration);
} else {
VibrateController(1, 1, duration);
}
/* NOP */;
}
}
class W3GamerProfile extends CObject{
private var statistics : array<SStatistic>;
private var achievementDefinitions : array<SAchievement>;
public function AddAchievement(a : EAchievement){
theGame.UnlockAchievement(AchievementEnumToName(a));
LogAchievements("Achievement <<" + a + ">> unlocked!");
/* NOP */;
}
public function Init(){
LoadXMLAchievementData();
InitStats();
RegisterAchievements();
/* NOP */;
}
public function InitStats(){
InitStat(3);
InitStat(4);
InitStat(5);
InitStat(6);
InitStat(7);
InitStat(10);
InitStat(11);
InitStat(12);
InitStat(13);
InitStat(1);
InitStat(9);
InitStat(8);
InitStat(2);
/* NOP */;
}
private function RegisterAchievements(){
RegisterAchievement(3, 17);
RegisterAchievement(4, 18);
RegisterAchievement(5, 19);
RegisterAchievement(6, 20);
RegisterAchievement(7, 21);
RegisterAchievement(10, 26);
RegisterAchievement(11, 27);
RegisterAchievement(1, 29);
RegisterAchievement(13, 22);
RegisterAchievement(12, 44);
RegisterAchievement(9, 49);
RegisterAchievement(8, 24);
RegisterAchievement(2, 41);
/* NOP */;
}
private function LoadXMLAchievementData(){
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var i : Int32;
var tmpInt : Int32;

var tmpName : CName;


var achievement : SAchievement;
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('achievements');
i = 0;
while (i < main.subNodes.Size()){
if (!dm.GetCustomNodeAttributeValueName(main.subNodes[i]
, 'name_name', tmpName)){
} else {
achievement.type = AchievementNameToEnum(tmpName
);
if (achievement.type == 0){
} else {
if (dm.GetCustomNodeAttributeValueInt(ma
in.subNodes[i], 'requiredValue', tmpInt)){
achievement.requiredValue = tmpI
nt;
}
achievementDefinitions.PushBack(achievem
ent);
achievement.type = 0;
achievement.requiredValue = -1;
}
}
i += 1;
}
/* NOP */;
}
private function GetAchievementIndex(a : EAchievement) : Int32{
var i : Int32;
i = 0;
while (i < achievementDefinitions.Size()){
if (achievementDefinitions[i].type == a){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function CheckLearningTheRopes(){
if (FactsQuerySum("ach_counter") == 1 && FactsQuerySum("ach_atta
ck") == 1 && FactsQuerySum("ach_sign") == 1 && FactsQuerySum("ach_bomb") == 1){
AddAchievement(23);
}
/* NOP */;
}
public final function CheckTrialOfGrasses(){
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
if (!witcher){
return;
}
if (!witcher.IsAnyItemEquippedOnSlot(25)){
return;
}
if (!witcher.IsAnyItemEquippedOnSlot(24)){
return;
}
if (!witcher.IsAnyItemEquippedOnSlot(23)){

return;
}
if (!witcher.IsAnyItemEquippedOnSlot(22)){
return;
}
AddAchievement(25);
/* NOP */;
}
public function ResetStat(statEnum : EStatistic){
var i : Int32;
var idx : Int32;
var statName : CName;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
return;
}
statName = StatisticEnumToName(statEnum);
FactsRemove(statName);
FactsAdd(statName, 0, /* NOP */);
/* NOP */;
}
public function GetStatValue(statEnum : EStatistic) : Int32{
var idx : Int32;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
return -1;
}
return FactsQuerySum(StatisticEnumToName(statEnum));
/* NOP */;
}
public function IncStat(statEnum : EStatistic){
var idx : Int32;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
return;
}
FactsAdd(StatisticEnumToName(statEnum), /* NOP */, /* NOP */);
CheckProgress(statEnum);
/* NOP */;
}
public function SetStat(statEnum : EStatistic, val : Int32){
var idx : Int32;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
return;
}
FactsSet(StatisticEnumToName(statEnum), val, /* NOP */);
CheckProgress(statEnum);
/* NOP */;
}
public function DecStat(statEnum : EStatistic){
var idx : Int32;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
return;
}
FactsSubstract(StatisticEnumToName(statEnum), 1);
/* NOP */;
}
private function CheckProgress(statEnum : EStatistic){

var i : Int32;
var idx : Int32;
var achievementType : EAchievement;
var statName : CName;
var currStatVal : Int32;
idx = GetStatisticIndex(statEnum);
statName = StatisticEnumToName(statEnum);
currStatVal = FactsQuerySum(statName);
i = statistics[idx].registeredAchievements.Size() - 1;
while (i >= 0){
achievementType = statistics[idx].registeredAchievements
[i].type;
if (statistics[idx].registeredAchievements[i].requiredVa
lue <= currStatVal){
AddAchievement(achievementType);
}
i -= 1;
}
/* NOP */;
}
private function GetStatisticIndex(statEnum : EStatistic) : Int32{
var i : Int32;
i = 0;
while (i < statistics.Size()){
if (statistics[i].statType == statEnum){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
private function RegisterAchievement(statEnum : EStatistic, ac : EAchiev
ement){
var idx : Int32;
var aInd : Int32;
idx = GetStatisticIndex(statEnum);
if (idx < 0){
LogAchievements("Cannot register achievement <<" + ac +
">> to game statistics - statistic <<" + statEnum + ">> is no longer updated!");
return;
}
aInd = GetAchievementIndex(ac);
if (aInd < 0){
LogAchievements("Cannot register achievement <<" + ac +
">> to game statistics - achievement already achieved!");
return;
}
statistics[idx].registeredAchievements.PushBack(achievementDefin
itions[aInd]);
/* NOP */;
}
private function InitStat(statEnum : EStatistic){
var stat : SStatistic;
if (FactsQuerySum(StatisticEnumToName(statEnum)) == -1){
return;
}
stat.statType = statEnum;
statistics.PushBack(stat);
/* NOP */;

}
public final function Debug_PrintAchievements(){
var achievement : EAchievement;
var currVal : Int32;
var i : Int32;
var j : Int32;
var k : Int32;
var goto : Bool;
var allFTs : array<SAvailableFastTravelMapPin>;
var foundFTs : array<SAvailableFastTravelMapPin>;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
LogAchievements("");
LogAchievements("Printing current achievements' status:");
i = 0;
while (i < statistics.Size()){
j = 0;
while (j < statistics[i].registeredAchievements.Size()){
achievement = statistics[i].registeredAchievemen
ts[j].type;
currVal = FactsQuerySum(StatisticEnumToName(stat
istics[i].statType));
LogAchievements(achievement + ", progress: " + N
oTrailZeros(currVal) + "/" + NoTrailZeros(statistics[i].registeredAchievements[j
].requiredValue));
j += 1;
}
i += 1;
}
foundFTs = theGame.GetCommonMapManager().GetFastTravelPoints(tru
e, false, false, true, true);
allFTs = theGame.GetCommonMapManager().GetFastTravelPoints(false
, false, false, false, true);
LogAchievements(47 + ", progress: " + foundFTs.Size() + "/100");
if (foundFTs.Size() < 100){
i = allFTs.Size() - 1;
while (i >= 0){
j = 0;
while (j < foundFTs.Size()){
if (allFTs[i].tag == foundFTs[j].tag &&
allFTs[i].type == foundFTs[j].type && allFTs[i].area == foundFTs[j].area){
allFTs.EraseFast(i);
break;
}
j += 1;
}
i -= 1;
}
areaMapPins = theGame.GetCommonMapManager().GetAreaMapPi
ns();
LogAchievements("");
LogAchievements(47 + ": missing " + 100 - foundFTs.Size(
) + " FT points, coords:");
k = 0;
while (k < allFTs.Size()){
goto = false;
i = 0;
while (i < areaMapPins.Size()){
entityMapPins.Clear();
entityMapPins = theGame.GetCommonMapMana

ger().GetEntityMapPins(areaMapPins[i].worldPath);
j = 0;
while (j < entityMapPins.Size()){
if (entityMapPins[j].entityType
== allFTs[k].type && entityMapPins[j].entityName == allFTs[k].tag && areaMapPins
[i].areaType == allFTs[k].area){
LogAchievements(SpaceFil
l(allFTs[k].tag, 35, 0) + " in " + SpaceFill(allFTs[k].area, 30, 0) + " at:
x=" + SpaceFill(RoundMath(entityMapPins[j].entityPosition.X), 5, 1) + ", y=" + S
paceFill(RoundMath(entityMapPins[j].entityPosition.Y), 5, 1) + ", z=" + SpaceFil
l(RoundMath(entityMapPins[j].entityPosition.Z), 5, 1));
goto = true;
break;
}
j += 1;
}
if (goto){
break;
}
i += 1;
}
k += 1;
}
}
LogAchievements("");
/* NOP */;
}
}
class W3GameLog extends CObject{
public const var COLOR_GOLD_BEGIN : String;
public const var COLOR_GOLD_END : String;
private var cachedCombatMessages : array<SCachedCombatMessage>;
public function AddMessage(m : String){
var hud : CR4ScriptedHud;
if (m == ""){
return;
}
hud = (CR4ScriptedHud)theGame.GetHud();
hud.HudConsoleMsg(m);
/* NOP */;
}
private function ShouldShowCombatMessage(attacker : CGameplayEntity, vic
tim : CGameplayEntity) : Bool{
if (!thePlayer.IsThreatened() && !thePlayer.IsInCombat()){
return false;
}
if (attacker && attacker.GetDisplayName(/* NOP */) == "" || vict
im && victim.GetDisplayName(/* NOP */) == ""){
return false;
}
if (attacker == thePlayer || attacker && attacker.HasTag(theGame
.params.TAG_NPC_IN_PARTY) || victim && victim.HasTag(theGame.params.TAG_NPC_IN_P
ARTY)){
return true;
}
if (victim == thePlayer){
return true;
}
return false;

/* NOP */;
}
public function AddCombatMessage(m : String, attacker : CGameplayEntity,
victim : CGameplayEntity){
if (ShouldShowCombatMessage(attacker, victim)){
AddMessage(m);
}
/* NOP */;
}
public function FormatF(f : Float) : String{
var str : String;
var temp : Float;
temp = RoundTo(f, 2);
str = NoTrailZeros(temp);
str = "<font size="20">" + str + "</font>";
return str;
/* NOP */;
}
public function CacheCombatDamageMessage(attacker : CGameplayEntity, vic
tim : CGameplayEntity, finalDamage : Float){
var m : SCachedCombatMessage;
m.finalDamage = finalDamage;
m.attacker = attacker;
m.victim = victim;
cachedCombatMessages.PushBack(m);
/* NOP */;
}
public function CreateCombatMessage(cachedDamageIndex : Int32) : String{
var logPoints : String;
var logPercents : String;
var logPrefix : String;
var returnStr : String;
var arrStr : array<String>;
var msg : SCachedCombatMessage;
if (!ShouldShowCombatMessage(cachedCombatMessages[cachedDamageIn
dex].attacker, cachedCombatMessages[cachedDamageIndex].victim)){
return "";
}
msg = cachedCombatMessages[cachedDamageIndex];
arrStr.PushBack(msg.attacker.GetDisplayName(/* NOP */));
arrStr.PushBack(msg.victim.GetDisplayName(/* NOP */));
arrStr.PushBack(FormatF(msg.finalDamage));
logPrefix = GetLocStringByKeyExtWithParams("hud_combat_log_hit",
/* NOP */, /* NOP */, arrStr, /* NOP */);
if (msg.resistPoints > 0){
logPoints = COLOR_GOLD_BEGIN + FormatF(msg.resistPoints)
+ COLOR_GOLD_END;
} else {
logPoints = "";
}
if (msg.resistPercents > 0){
logPercents = COLOR_GOLD_BEGIN + FormatF(1 - msg.resistP
ercents * 100) + COLOR_GOLD_END;
} else {
logPercents = "";
}
if (logPoints == "" && logPercents == ""){
if (ShouldShowCombatMessage(msg.attacker, msg.victim)){
returnStr = logPrefix;
}

} else if (logPoints == "" && logPercents != ""){


if (ShouldShowCombatMessage(msg.attacker, msg.victim)){
returnStr = logPrefix + " (" + FormatF(msg.final
IncomingDamage) + " * " + logPercents + "%)";
}
} else if (logPoints != "" && logPercents == ""){
if (ShouldShowCombatMessage(msg.attacker, msg.victim)){
returnStr = logPrefix + " (" + FormatF(msg.final
IncomingDamage) + " - " + logPoints + ")";
}
} else if (ShouldShowCombatMessage(msg.attacker, msg.victim)){
returnStr = logPrefix + " ( (" + FormatF(msg.finalIncomi
ngDamage) + " - " + logPoints + ") * " + logPercents + "%)";
}
return returnStr;
/* NOP */;
}
public final function CombatMessageAddGlobalDamageMult(mult : Float){
var i : Int32;
i = 0;
while (i < cachedCombatMessages.Size()){
cachedCombatMessages[i].finalDamage *= mult;
i += 1;
}
/* NOP */;
}
public final function AddCombatDamageMessage(dealtDamage : Bool){
var i : Int32;
i = 0;
while (i < cachedCombatMessages.Size()){
AddMessage(CreateCombatMessage(i));
i += 1;
}
cachedCombatMessages.Clear();
/* NOP */;
}
}
class W3DamageManager extends CObject{
public function ProcessAction(act : W3DamageAction){
var proc : W3DamageManagerProcessor;
proc = new W3DamageManagerProcessor in this;
proc.ProcessAction(act);
delete proc;
/* NOP */;
}
}
class W3GameEffectManager extends CObject{
private var effects : array<CBaseGameplayEffect>;
private var effectNames : array<CName>;
private var isReady : Bool;
private var effectIconTypes : array<SEffectIconType>;
public function Initialize(){
var i : Int32;
var size : Int32;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var effectName : CName;
var iconTypeName : CName;

var iconType : SEffectIconType;


var path : String;
isReady = false;
effects.Clear();
effectNames.Clear();
effectIconTypes.Clear();
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'name_name', effectName)){
if (IsNameValid(effectName)){
effectNames.PushBack(effectName);
} else {
LogAssert(false, "W3GameEffectManager.In
itialize(): not valid effect name <<" + effectName + ">> read from XML file");
}
}
i += 1;
}
main = dm.GetCustomDefinition('effect_icons');
i = 0;
while (i < main.subNodes.Size()){
if (dm.GetCustomNodeAttributeValueName(main.subNodes[i],
'iconType_name', iconTypeName) && dm.GetCustomNodeAttributeValueString(main.sub
Nodes[i], 'path', path)){
iconType.typeName = iconTypeName;
iconType.path = path;
effectIconTypes.PushBack(iconType);
}
i += 1;
}
effects.Grow(EnumGetMax('EEffectType') + 1);
i = 0;
while (i < effectNames.Size()){
if (IsBuffAutoBuff(i)){
CacheEffect(i);
}
i += 1;
}
isReady = true;
/* NOP */;
}
public function GetPathForEffectIconTypeName(type : CName) : String{
var i : Int32;
if (!isReady){
return "";
}
i = 0;
while (i < effectIconTypes.Size()){
if (effectIconTypes[i].typeName == type){
return effectIconTypes[i].path;
}
i += 1;
}
return "";
/* NOP */;
}
public function GetEffectNameLocalisationKey(effect : EEffectType) : Str

ing{
if (!effects[effect]){
CacheEffect(effect);
}
return effects[effect].GetEffectNameLocalisationKey();
/* NOP */;
}
public function GetEffectDescriptionLocalisationKey(effect : EEffectType
) : String{
if (!effects[effect]){
CacheEffect(effect);
}
return effects[effect].GetEffectDescriptionLocalisationKey();
/* NOP */;
}
public function GetEffectIconPath(effect : EEffectType) : String{
if (!effects[effect]){
CacheEffect(effect);
}
return effects[effect].GetIcon();
/* NOP */;
}
public function IsReady() : Bool{
return isReady;
/* NOP */;
}
public function GetEffectTypeFlags(effect : EEffectType, potion : Bool,
positive : Bool, neutral : Bool, negative : Bool, immobilize : Bool, confuse : B
ool, damage : Bool){
if (!effects[effect]){
CacheEffect(effect);
}
potion = effects[effect].IsPotionEffect();
positive = effects[effect].IsPositive();
negative = effects[effect].IsNegative();
neutral = effects[effect].IsNeutral();
if ((W3ImmobilizeEffect)effects[effect]){
immobilize = true;
} else {
immobilize = false;
}
if ((W3ConfuseEffect)effects[effect] || (W3BlindnessEffect)effec
ts[effect]){
confuse = true;
} else {
confuse = false;
}
if ((W3DamageOverTimeEffect)effects[effect]){
damage = true;
} else {
damage = false;
}
/* NOP */;
}
public function MakeNewEffect(effect : EEffectType, ownr : CGameplayEnti
ty, target : CActor, effectManager : W3EffectManager, inDuration : Float, srcNam
e : String, powerStatValue : SAbilityAttributeValue, customVal : SAbilityAttribu
teValue, customAbilityName : CName, customFXName : CName, signEffect : Bool, vib
ratePadLowFreq : Float, vibratePadHighFreq : Float) : CBaseGameplayEffect{
var e : CBaseGameplayEffect;

var params : SEffectInitInfo;


if (effect == 0 || effect == 32 || effect == 55){
return NULL;
}
if (!effects[effect]){
CacheEffect(effect);
}
if (!effects[effect]){
return NULL;
}
e = (CBaseGameplayEffect)effects[effect].Clone(target);
params.owner = ownr;
params.target = target;
params.duration = inDuration;
params.sourceName = srcName;
params.powerStatValue = powerStatValue;
params.customEffectValue = customVal;
params.customAbilityName = customAbilityName;
params.customFXName = customFXName;
params.isSignEffect = signEffect;
params.targetEffectManager = effectManager;
params.vibratePadLowFreq = vibratePadLowFreq;
params.vibratePadHighFreq = vibratePadHighFreq;
e.Init(params);
return e;
/* NOP */;
}
private function CacheEffect(effect : EEffectType){
var ret : Bool;
if (effect == 0 || effect == 32){
return;
}
ret = HACK_NO_MEMORY_TO_COMPILE_CacheEffect_Part1(effect);
if (!ret){
ret = HACK_NO_MEMORY_TO_COMPILE_CacheEffect_Part2(effect
);
}
if (ret){
effects[effect].CacheSettings();
} else {
LogAssert(false, "W3GameEffectManager.CacheEffect: canno
t cache effect of type <<" + effect + ">> unknown type!");
}
/* NOP */;
}
private function HACK_NO_MEMORY_TO_COMPILE_CacheEffect_Part1(effect : EE
ffectType) : Bool{
var found : Bool;
if (effects[effect]){
LogAssert(false, "W3GameEffectManager.CacheEffect: Tries
to cache already cached effect!");
return false;
}
found = true;
switch(effect){
case 3:
effects[effect] = new W3Effect_AutoEssenceRegen in this;
break;
case 4:
effects[effect] = new W3Effect_AutoMoraleRegen in this;

break;
case 2:
effects[effect] = new W3Effect_AutoStaminaRegen in this;
break;
case 1:
effects[effect] = new W3Effect_AutoVitalityRegen in this
;
break;
case 59:
effects[effect] = new W3Effect_AutoAirRegen in this;
break;
case 66:
effects[effect] = new W3Effect_AutoPanicRegen in this;
break;
case 106:
effects[effect] = new W3Effect_AutoSwimmingStaminaRegen
in this;
break;
case 68:
effects[effect] = new W3Effect_DoppelgangerEssenceRegen
in this;
break;
case 50:
effects[effect] = new W3Effect_AdrenalineDrain in this;
break;
case 14:
case
case
case
case
case
case
case
case

effects[effect]
break;
108:
effects[effect]
break;
5:
effects[effect]
break;
6:
effects[effect]
break;
7:
effects[effect]
break;
103:
effects[effect]
break;
8:
effects[effect]
break;
9:
effects[effect]
break;
10:
effects[effect]

= new W3BlindnessEffect in this;


= new W3WraithBlindnessEffect in this;
= new W3ConfuseEffect in this;
= new W3Effect_HeavyKnockdown in this;
= new W3Effect_Hypnotized in this;
= new W3Effect_WitchHypnotized in this;
= new W3ImmobilizeEffect in this;
= new W3Effect_Knockdown in this;
= new W3Effect_KnockdownTypeApplicator i

n this;
break;
case 12:
effects[effect] = new W3Effect_Paralyzed in this;
break;
case 46:
effects[effect] = new W3Effect_LongStagger in this;
break;
case 13:

effects[effect] = new W3Effect_Stagger in this;


break;
case 52:
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case

effects[effect]
break;
113:
effects[effect]
break;
58:
effects[effect]
break;
53:
effects[effect]
break;
56:
effects[effect]
break;
65:
effects[effect]
break;
11:
effects[effect]
break;
16:
effects[effect]
break;
17:
effects[effect]
break;
18:
effects[effect]
break;
19:
effects[effect]
break;
15:
effects[effect]
break;
20:
effects[effect]
break;
21:
effects[effect]
break;
67:
effects[effect]
break;
71:
effects[effect]
break;
101:
effects[effect]
break;
105:
effects[effect]

= new W3Effect_Swarm in this;


= new W3Effect_SnowstormQ403 in this;
= new W3Effect_Snowstorm in this;
= new W3Effect_Pull in this;
= new W3Effect_CounterStrikeHit in this;
= new W3Effect_Ragdoll in this;
= new W3Effect_Frozen in this;
= new W3Effect_Bleeding in this;
= new W3Effect_BleedingTracking in this;
= new W3Effect_Burning in this;
= new W3Effect_Poison in this;
= new W3Effect_PoisonCritical in this;
= new W3Effect_DoTHPRegenReduce in this;
= new W3Effect_Toxicity in this;
= new W3Effect_VitalityDrain in this;
= new W3Effect_AirDrain in this;
= new W3Effect_AirDrainDive in this;
= new W3Effect_StaminaDrainSwimming in t

his;
break;
case 110:
effects[effect] = new W3Effect_StaminaDrain in this;
break;

case 22:
effects[effect] = new W3Potion_BlackBlood in this;
break;
case 23:
effects[effect] = new W3Potion_Blizzard in this;
break;
case 24:
effects[effect] = new W3Potion_Cat in this;
break;
case 25:
effects[effect] = new W3Potion_FullMoon in this;
break;
case 26:
effects[effect] = new W3Potion_GoldenOriole in this;
break;
case 35:
effects[effect] = new W3Potion_KillerWhale in this;
break;
case 27:
effects[effect] = new W3Potion_MariborForest in this;
break;
case 28:
effects[effect] = new W3Potion_PetriPhiltre in this;
break;
case 29:
effects[effect] = new W3Potion_Swallow in this;
break;
case 30:
effects[effect] = new W3Potion_TawnyOwl in this;
break;
case 31:
effects[effect] = new W3Potion_Thunderbolt in this;
break;
case 33:
effects[effect] = new W3Potion_WhiteHoney in this;
break;
case 34:
effects[effect] = new W3Potion_WhiteRaffardDecoction in
this;
break;
case 115:
effects[effect]
break;
case 116:
effects[effect]
break;
case 117:
effects[effect]
break;
case 36:
effects[effect]
break;
case 48:
effects[effect]
break;
case 49:
effects[effect]
break;
case 37:
effects[effect]

= new W3Potion_PheromoneNekker in this;


= new W3Potion_PheromoneDrowner in this;
= new W3Potion_PheromoneBear in this;
= new W3Effect_AxiiGuardMe in this;
= new W3Effect_BattleTrance in this;
= new W3Effect_YrdenHealthDrain in this;
= new W3Effect_IgnorePain in this;

break;
case 60:
effects[effect] = new W3Effect_ShrineAard in this;
break;
case 61:
effects[effect] = new W3Effect_ShrineAxii in this;
break;
case 62:
effects[effect] = new W3Effect_ShrineIgni in this;
break;
case 63:
effects[effect] = new W3Effect_ShrineQuen in this;
break;
case 64:
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case

effects[effect]
break;
111:
effects[effect]
break;
112:
effects[effect]
break;
104:
effects[effect]
break;
40:
effects[effect]
break;
41:
effects[effect]
break;
42:
effects[effect]
break;
45:
effects[effect]
break;
114:
effects[effect]
break;
54:
effects[effect]
break;
57:
effects[effect]
break;
109:
effects[effect]
break;
39:
effects[effect]
break;
72:
effects[effect]
break;
51:
effects[effect]
break;
70:
effects[effect]

= new W3Effect_ShrineYrden in this;


= new W3Effect_EnhancedArmor in this;
= new W3Effect_EnhancedWeapon in this;
= new W3Effect_AirBoost in this;
= new W3Effect_Edible in this;
= new W3Effect_LowHealth in this;
= new W3Effect_Slowdown in this;
= new W3Effect_SlowdownFrost in this;
= new W3Effect_SlowdownAxii in this;
= new W3Effect_AbilityOnLowHP in this;
= new W3Effect_Drowning in this;
= new W3Effect_Choking in this;
= new W3Effect_OverEncumbered in this;
= new W3Effect_SilverDust in this;
= new W3Effect_WeatherBonus in this;
= new W3Effect_BoostedEssenceRegen in th

is;
break;
case 102:
effects[effect] = new W3Effect_BoostedStaminaRegen in th
is;
break;
case 44:
effects[effect] = new W3Effect_WellFed in this;
break;
case 47:
effects[effect]
break;
case 107:
effects[effect]
break;
case 43:
effects[effect]
break;
case 38:
effects[effect]
break;
case 69:
effects[effect]
break;
default:
found = false;
break;
}
return found;
/* NOP */;

= new W3Effect_WellHydrated in this;


= new W3Effect_Drunkenness in this;
= new W3Potion_Fact in this;
= new W3StaggerAura in this;
= new W3FireAura in this;

}
private function HACK_NO_MEMORY_TO_COMPILE_CacheEffect_Part2(effect : EE
ffectType) : Bool{
var found : Bool;
if (effects[effect]){
LogAssert(false, "W3GameEffectManager.CacheEffect: Tries
to cache already cached effect!");
return false;
}
found = true;
switch(effect){
case 73:
effects[effect] = new W3Mutagen01_Effect in this;
break;
case 74:
effects[effect] = new W3Mutagen02_Effect in this;
break;
case 75:
effects[effect] = new W3Mutagen03_Effect in this;
break;
case 76:
effects[effect] = new W3Mutagen04_Effect in this;
break;
case 77:
effects[effect] = new W3Mutagen05_Effect in this;
break;
case 78:
effects[effect] = new W3Mutagen06_Effect in this;
break;
case 79:

effects[effect] = new W3Mutagen07_Effect in this;


break;
case 80:
effects[effect] = new W3Mutagen08_Effect in this;
break;
case 81:
effects[effect] = new W3Mutagen09_Effect in this;
break;
case 82:
effects[effect] = new W3Mutagen10_Effect in this;
break;
case 83:
effects[effect] = new W3Mutagen11_Effect in this;
break;
case 84:
effects[effect] = new W3Mutagen12_Effect in this;
break;
case 85:
effects[effect] = new W3Mutagen13_Effect in this;
break;
case 86:
effects[effect] = new W3Mutagen14_Effect in this;
break;
case 87:
effects[effect] = new W3Mutagen15_Effect in this;
break;
case 88:
effects[effect] = new W3Mutagen16_Effect in this;
break;
case 89:
effects[effect] = new W3Mutagen17_Effect in this;
break;
case 90:
effects[effect] = new W3Mutagen18_Effect in this;
break;
case 91:
effects[effect] = new W3Mutagen19_Effect in this;
break;
case 92:
effects[effect] = new W3Mutagen20_Effect in this;
break;
case 93:
effects[effect] = new W3Mutagen21_Effect in this;
break;
case 94:
effects[effect] = new W3Mutagen22_Effect in this;
break;
case 95:
effects[effect] = new W3Mutagen23_Effect in this;
break;
case 96:
effects[effect] = new W3Mutagen24_Effect in this;
break;
case 97:
effects[effect] = new W3Mutagen25_Effect in this;
break;
case 98:
effects[effect] = new W3Mutagen26_Effect in this;
break;
case 99:

effects[effect] = new W3Mutagen27_Effect in this;


break;
case 100:
effects[effect] = new W3Mutagen28_Effect in this;
break;
default:
found = false;
break;
}
return found;
/* NOP */;
}
public function GetBuffResistStat(effect : EEffectType) : ECharacterDefe
nseStats{
if (!effects[effect]){
CacheEffect(effect);
}
if (!effects[effect]){
return 0;
}
return effects[effect].GetResistStat();
/* NOP */;
}
public function IsBuffNegative(effectType : EEffectType) : Bool{
if (!effects[effectType]){
CacheEffect(effectType);
}
if (!effects[effectType]){
return false;
}
return effects[effectType].IsNegative();
/* NOP */;
}
public function IsEffectNameValid(effectName : CName) : Bool{
var i : Int32;
var size : Int32;
var effectType : String;
var tmp : String;
if (!IsNameValid(effectName)){
return false;
}
size = effectNames.Size();
i = 0;
while (i < size){
if (effectNames[i] == effectName){
return true;
} else {
StrSplitFirst(NameToString(effectName), "_", eff
ectType, tmp);
if (NameToString(effectNames[i]) == effectType){
return true;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function CheckInteractionWith(effectManager : W3EffectManager, ef
fect : CBaseGameplayEffect, interactionEffects : array<CBaseGameplayEffect>, ove

rridenEffectsIdxs : array<Int32>, cumulateIdx : Int32) : Bool{


var i : Int32;
var size : Int32;
var tmpCumulate : Int32;
var interactNew : EEffectInteract;
var interactOld : EEffectInteract;
overridenEffectsIdxs.Clear();
size = interactionEffects.Size();
cumulateIdx = -1;
tmpCumulate = -1;
i = size - 1;
while (i >= 0){
interactNew = effect.GetInteraction(interactionEffects[i
]);
interactOld = interactionEffects[i].GetInteraction(effec
t);
if (interactOld == 4){
tmpCumulate = i;
} else {
if (interactNew == 4){
LogEffects("EffectManager.CheckInteracti
on: new effect <<" + interactionEffects[i] + ">> should be cumulated by old effe
ct <<" + effect + ">> - older is better - DENY");
return false;
}
if (interactNew == 2){
overridenEffectsIdxs.PushBack(i);
}
if (interactNew == 1){
LogEffects("EffectManager.CheckInteracti
on: new effect <<" + effect + ">> denies old effect <<" + interactionEffects[i]
+ ">> - old is removed");
effectManager.RemoveEffect(interactionEf
fects[i], true);
interactionEffects.Erase(i);
return true;
}
if (interactOld == 1){
LogEffects("EffectManager.CheckInteracti
on: old effect <<" + interactionEffects[i] + ">> denies new effect <<" + effect
+ ">> - DENY");
return false;
}
if (interactOld == 2 && interactNew == 3){
LogEffects("EffectManager.CheckInteracti
on: old effect <<" + interactionEffects[i] + ">> overrides new effect <<" + effe
ct + ">> - DENY");
return false;
}
}
i -= 1;
}
cumulateIdx = tmpCumulate;
return true;
/* NOP */;
}
}
class W3EnvironmentManager extends CObject{
public saved var m_envId : Int32;

public
public
public
public
public
public

var lunation : Int32;


var dayStart : Int32;
var nightStart : Int32;
var redMoonPeriod : Int32;
var hourToSwitchEnv : Int32;
function Initialize(){
m_envId = -1;
/* NOP */;

}
public function Update(){
CheckRedMoon();
/* NOP */;
}
public function CheckRedMoon(){
var currentGameTime : GameTime;
var hours : Int32;
currentGameTime = theGame.GetGameTime();
hours = GameTimeHours(currentGameTime);
if (m_envId == -1){
if (super.IsDay() && hours >= hourToSwitchEnv && IsRedMo
on(true)){
}
} else if (super.IsDay() && hours >= hourToSwitchEnv && !IsRedMo
on(true)){
m_envId = -1;
}
/* NOP */;
}
public final function IsNight() : Bool{
var hours : Int32;
hours = GameTimeHours(theGame.GetGameTime());
if (hours >= nightStart || hours < dayStart){
return true;
}
return false;
/* NOP */;
}
public final function IsDay() : Bool{
return !IsNight();
/* NOP */;
}
public function GetGameTimeTillNextNight() : GameTime{
return GetGameTimeTillNextHour(nightStart);
/* NOP */;
}
public function GetGameTimeTillNextDay() : GameTime{
return GetGameTimeTillNextHour(dayStart);
/* NOP */;
}
public function GetGameTimeTillNextHour(targetHour : Int32) : GameTime{
var currDate : GameTime;
var targetDate : GameTime;
var dateDiff : GameTime;
var day : Int32;
var hour : Int32;
currDate = theGame.GetGameTime();
day = GameTimeDays(currDate);
hour = GameTimeHours(currDate);
if (hour >= targetHour){
day += 1;

}
targetDate = GameTimeCreate(day, targetHour, 0, 0);
dateDiff = targetDate - currDate;
return dateDiff;
/* NOP */;
}
private function GetNightNum() : Int32{
var currentGameTime : GameTime;
var nightNum : Int32;
var hours : Int32;
currentGameTime = theGame.GetGameTime();
nightNum = GameTimeDays(currentGameTime);
hours = GameTimeHours(currentGameTime);
if (hours > 12){
nightNum += 1;
}
return nightNum;
/* NOP */;
}
public function IsFullMoon(dontCheckNightCond : Bool) : Bool{
var currentGameTime : GameTime;
var moonStage : Int32;
var hours : Int32;
if (!dontCheckNightCond && !super.IsNight()){
return false;
}
moonStage = GetNightNum() % lunation;
if (moonStage == 8){
return true;
}
return false;
/* NOP */;
}
public function IsRedMoon(dontCheckNightCond : Bool) : Bool{
var moonPeriods : Int32;
if (!IsFullMoon(dontCheckNightCond)){
return false;
}
moonPeriods = GetNightNum() / lunation;
moonPeriods = moonPeriods % redMoonPeriod;
if (moonPeriods == 2){
return true;
}
return false;
/* NOP */;
}
}
class W3RunewordManager extends CObject{
protected saved var runewords : array<Runeword>;
public function Init(){
LoadXMLData();
/* NOP */;
}
public function LoadXMLData(){
var runeword : Runeword;
var i : Int32;
var j : Int32;
var tmpName : CName;
var dm : CDefinitionsManagerAccessor;

var runewordsNode : SCustomNode;


var runesNode : SCustomNode;
var baseAbilitiesNode : SCustomNode;
dm = theGame.GetDefinitionsManager();
runewordsNode = dm.GetCustomDefinition('runewords');
i = 0;
while (i < runewordsNode.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(runewordsNode.subNode
s[i], 'name_name', tmpName);
runeword.wordName = tmpName;
runesNode = dm.GetCustomDefinitionSubNode(runewordsNode.
subNodes[i], 'runes');
j = 0;
while (j < runesNode.subNodes.Size()){
tmpName = runesNode.subNodes[j].values[0];
runeword.runes.PushBack(tmpName);
j += 1;
}
baseAbilitiesNode = dm.GetCustomDefinitionSubNode(runewo
rdsNode.subNodes[i], 'base_abilities');
j = 0;
while (j < baseAbilitiesNode.subNodes.Size()){
tmpName = baseAbilitiesNode.subNodes[j].values[0
];
runeword.abilities.PushBack(tmpName);
j += 1;
}
runewords.PushBack(runeword);
i += 1;
}
/* NOP */;
}
public function GetRuneword(runes : array<CName>, oRuneword : Runeword)
: Bool{
var i : Int32;
var j : Int32;
var size : Int32;
var runeword : Runeword;
i = 0;
while (i <= runewords.Size()){
runeword = runewords[i];
if (runeword.runes.Size() != runes.Size()){
} else {
size = runes.Size();
j = 0;
while (j < size){
if (runeword.runes[j] != runes[j]){
}
j += 1;
}
oRuneword = runeword;
return true;
}
i += 1;
}
return false;
/* NOP */;
}
}

statemachine class W3SyncAnimationManager extends CObject{


protected var syncInstances : array<CAnimationManualSlotSyncInstance>;
public var masterEntity : CGameplayEntity;
public var slaveEntity : CGameplayEntity;
public var dlcFinishersLeftSide : array<CR4FinisherDLC>;
public var dlcFinishersRightSide : array<CR4FinisherDLC>;
public var cameraAnimName : CName;
public function CreateNewSyncInstance(index : Int32) : CAnimationManualS
lotSyncInstance{
var newSyncInstance : CAnimationManualSlotSyncInstance;
newSyncInstance = new CAnimationManualSlotSyncInstance in this;
syncInstances.PushBack(newSyncInstance);
index = syncInstances.Size() - 1;
GotoState('Active', true, /* NOP */);
return newSyncInstance;
/* NOP */;
}
public function GetSyncInstance(index : Int32) : CAnimationManualSlotSyn
cInstance{
return syncInstances[index];
/* NOP */;
}
public function RemoveSyncInstance(instance : CAnimationManualSlotSyncIn
stance){
syncInstances.Remove(instance);
/* NOP */;
}
public function SetupSimpleSyncAnim(syncAction : CName, master : CEntity
, slave : CEntity) : Bool{
var masterDef : SAnimationSequenceDefinition;
var slaveDef : SAnimationSequenceDefinition;
var masterSequencePart : SAnimationSequencePartDefinition;
var slaveSequencePart : SAnimationSequencePartDefinition;
var syncInstance : CAnimationManualSlotSyncInstance;
var instanceIndex : Int32;
var sequenceIndex : Int32;
var actorMaster : CActor;
var actorSlave : CActor;
var temp : CName;
var rot : EulerAngles;
var finisherAnim : Bool;
var pos : Vector;
var syncAnimName : CName;
var node : CNode;
var node1 : CNode;
var rot0 : EulerAngles;
var rot1 : EulerAngles;
syncInstance = CreateNewSyncInstance(instanceIndex);
thePlayer.BlockAction(21, 'SyncManager', /* NOP */, /* NOP */, /
* NOP */);
thePlayer.BlockAction(5, 'SyncManager', /* NOP */, /* NOP */, /*
NOP */);
switch(syncAction){
case 'AgonyCrawl':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = 0.800000 * VecNormali

ze(master.GetWorldPosition() - slave.GetWorldPosition()) + (CActor)slave.GetNear


estPointInPersonalSpace(master.GetWorldPosition());
masterSequencePart.finalHeading = VecHeading(slave.GetWo
rldPosition() - master.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'man_npc_sword_1hand_wound
ed_crawl_killed';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.000000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
break;
case 'DeathFinisher':
syncAnimName = GetFinisherSynAnimName();
if (thePlayer.forceFinisher && thePlayer.forceFinisherAn
imName != 'None'){
thePlayer.SetCombatIdleStance(thePlayer.forcedSt
ance);
}
masterSequencePart.animation = syncAnimName;
masterSequencePart.syncType = 0;
masterSequencePart.useRefBone = 'Reference';
masterSequencePart.rotationTypeUsingRefBone = 0;
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slave.SetKinematic(true);
slaveSequencePart.animation = syncAnimName;
slaveSequencePart.syncType = 0;
slaveSequencePart.useRefBone = 'Reference';
slaveSequencePart.rotationTypeUsingRefBone = 0;
slaveSequencePart.shouldRotate = true;
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.disableProxyCollisions = true;
slaveDef.parts.PushBack(slaveSequencePart);

slaveDef.entity = slave;
slaveDef.manualSlotName = 'FinisherSlot';
slaveDef.freezeAtEnd = false;
cameraAnimName = ProcessFinisherCameraAnimName(syncAnimN
ame);
finisherAnim = true;
break;
case 'EredinPhaseChangePartOne':
syncAnimName = 'eredinbossfight_phasechange_01';
masterSequencePart.animation = syncAnimName;
masterSequencePart.syncType = 0;
masterSequencePart.shouldSlide = false;
masterSequencePart.shouldRotate = false;
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slave.SetKinematic(true);
slaveSequencePart.animation = syncAnimName;
slaveSequencePart.syncType = 0;
slaveSequencePart.shouldRotate = true;
slaveSequencePart.shouldSlide = true;
slaveSequencePart.finalPosition = master.GetWorldPositio
n() + master.GetHeadingVector() * 2.708500;
slaveSequencePart.finalHeading = VecHeading(master.GetWo
rldPosition());
slaveSequencePart.blendInTime = 0.000000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.disableProxyCollisions = true;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
PlayPhaseChangeCameraAnimation('eredinbossfight_phasecha
nge_01');
finisherAnim = false;
break;
case 'EredinPhaseChangePartTwo':
syncAnimName = 'eredinbossfight_phasechange_02';
masterSequencePart.animation = syncAnimName;
masterSequencePart.syncType = 0;
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
node = theGame.GetNodeByTag('eredin_area_2');
rot0 = node.GetWorldRotation();
masterSequencePart.finalPosition = node.GetWorldPosition
();
masterSequencePart.finalHeading = rot0.Yaw;
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';

masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slave.SetKinematic(true);
slaveSequencePart.animation = syncAnimName;
slaveSequencePart.syncType = 0;
slaveSequencePart.shouldRotate = true;
slaveSequencePart.shouldSlide = true;
node1 = theGame.GetNodeByTag('eredinPos');
rot1 = node1.GetWorldRotation();
slaveSequencePart.finalPosition = node1.GetWorldPosition
();
slaveSequencePart.finalHeading = rot1.Yaw;
slaveSequencePart.blendInTime = 0.000000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.disableProxyCollisions = true;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
PlayPhaseChangeCameraAnimation('eredinbossfight_phasecha
nge_02');
finisherAnim = false;
break;
case 'NPCDismountRight':
masterSequencePart.animation = 'horse_dismount_RF_01';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = false;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'MANUAL_DIALOG_SLOT';
masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'horse_dismount_RF_01';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'MANUAL_DIALOG_SLOT';
slaveDef.freezeAtEnd = false;
break;
case 'NPCDismountLeft':
masterSequencePart.animation = 'horse_dismount_LF_01';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = false;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'MANUAL_DIALOG_SLOT';

masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'horse_dismount_LF_01';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'MANUAL_DIALOG_SLOT';
slaveDef.freezeAtEnd = false;
break;
case 'HorseRearing':
masterSequencePart.animation = 'horse_rearing01';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = false;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'MANUAL_DIALOG_SLOT';
masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'horse_rearing01';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'MANUAL_DIALOG_SLOT';
slaveDef.freezeAtEnd = false;
break;
case 'LeshyHeadGrab':
masterSequencePart.animation = 'monster_lessun_attack_gr
ab_neck_quicker';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.finalPosition = master.GetWorldPositi
on() + master.GetHeadingVector();
masterSequencePart.finalHeading = master.GetHeading() +
180;
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'GAMEPLAY_SLOT';
masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'man_ger_sword_heavyhit_fr
ont_lp';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;

slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
break;
case 'SirenCrawlFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = 0.800000 * VecNormali
ze(master.GetWorldPosition() - slave.GetWorldPosition()) + (CActor)slave.GetNear
estPointInPersonalSpace(master.GetWorldPosition());
masterSequencePart.finalHeading = VecHeading(slave.GetWo
rldPosition() - master.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'monster_siren_crawl_death
';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'NekkerKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';

masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'c_knockdown_death';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.allowBreakBeforeAtAfterEventsStart = '
SetRagdoll';
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'DrownerKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'monster_drowner_knockdown
_death';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'GhoulKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;

masterSequencePart.finalHeading = VecHeading(pos - maste


r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'effect_knockdown_death';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'GravehagKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'death_knockdown';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.allowBreakBeforeAtAfterEventsStart = '
SetRagdoll';
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
slave.RaiseForceEvent('FinisherDeath');
break;

case 'HarpyKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'monster_harpy_effect_knoc
kdown_death';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.allowBreakAtStartBeforeEventsEnd = 'Sy
ncEvent';
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
finisherAnim = true;
break;
case 'WolfKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'wolf_knockdown_death';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;

slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'WerewolfKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = 'monstwer_werewolf_knockdo
wn_die';
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'HumanKnockDownFinisher':
masterSequencePart.animation = 'man_ger_crawl_finish';
masterSequencePart.syncType = 2;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
pos = GetActorPosition(slave);
masterSequencePart.finalPosition = 1.150000 * VecNormali
ze(master.GetWorldPosition() - pos) + pos;
masterSequencePart.finalHeading = VecHeading(pos - maste
r.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';

masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
if ((CActor)slave.GetLyingDownFacingDirection() >= 0){
slaveSequencePart.animation = 'man_npc_sword_1ha
nd_hit_knockdown_death';
} else {
slaveSequencePart.animation = 'man_npc_sword_1ha
nd_wounded_crawl_killed';
}
slaveSequencePart.syncType = 2;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.000000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.allowBreakAtStartBeforeEventsEnd = 'Sy
ncEvent';
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.startForceEvent = 'FrozenKinematicRagdoll';
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'HumanComboFinisher':
if (thePlayer.GetCombatIdleStance() <= 0.000000){
syncAnimName = 'man_finisher_02_lp';
} else {
syncAnimName = 'man_finisher_01_rp';
}
masterSequencePart.animation = syncAnimName;
masterSequencePart.syncType = 0;
masterSequencePart.useRefBone = 'Reference';
masterSequencePart.rotationTypeUsingRefBone = 0;
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slave.SetKinematic(true);
slaveSequencePart.animation = syncAnimName;
slaveSequencePart.syncType = 0;
slaveSequencePart.useRefBone = 'Reference';
slaveSequencePart.rotationTypeUsingRefBone = 0;
slaveSequencePart.shouldRotate = true;
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.000000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveSequencePart.disableProxyCollisions = true;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';

slaveDef.freezeAtEnd = true;
finisherAnim = true;
break;
case 'FistFightFinisher':
(CR4Player)master.GetFistFightFinisher(slaveSequencePart
.animation, temp);
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = 0.800000 * VecNormali
ze(master.GetWorldPosition() - slave.GetWorldPosition()) + (CActor)slave.GetNear
estPointInPersonalSpace(master.GetWorldPosition());
masterSequencePart.finalHeading = VecHeading(slave.GetWo
rldPosition() - master.GetWorldPosition());
masterSequencePart.blendInTime = 0.000000;
masterSequencePart.blendOutTime = 0.000000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'FinisherSlot';
masterDef.startForceEvent = 'PerformFinisher';
masterDef.raiseEventOnEnd = 'DoneFinisher';
masterDef.freezeAtEnd = true;
slaveSequencePart.animation = temp;
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.200000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
finisherAnim = true;
break;
case 'SwitchLeverOn':
rot = slave.GetWorldRotation();
pos = GetActorPosition(slave);
masterSequencePart.animation = 'lever_up_to_down_light';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = slave.GetWorldPositio
n() - 0.734100 * VecNormalize(VecFromHeading(rot.Yaw + 180)) - 0.130000 * VecNor
malize(VecFromHeading(rot.Yaw + 90));
masterSequencePart.finalHeading = rot.Yaw + 180;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.200000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'GAMEPLAY_SLOT';
masterDef.freezeAtEnd = false;
masterDef.raiseForceEventOnEnd = 'ForceIdle';
slaveSequencePart.animation = 'lever_up_to_down_light';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';

slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
(W3Switch)slave.ProcessPostTurnActions(false, false);
masterEntity = (CGameplayEntity)master;
slaveEntity = (CGameplayEntity)slave;
break;
case 'SwitchLeverOff':
rot = slave.GetWorldRotation();
pos = GetActorPosition(slave);
masterSequencePart.animation = 'lever_down_to_up_light';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = slave.GetWorldPositio
n() - 0.734100 * VecNormalize(VecFromHeading(rot.Yaw + 180)) - 0.130000 * VecNor
malize(VecFromHeading(rot.Yaw + 90));
masterSequencePart.finalHeading = rot.Yaw + 180;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.200000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'GAMEPLAY_SLOT';
masterDef.freezeAtEnd = false;
masterDef.raiseForceEventOnEnd = 'ForceIdle';
slaveSequencePart.animation = 'lever_down_to_up_light';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
(W3Switch)slave.ProcessPostTurnActions(false, false);
masterEntity = (CGameplayEntity)master;
slaveEntity = (CGameplayEntity)slave;
break;
case 'SwitchButtonOn':
rot = slave.GetWorldRotation();
masterSequencePart.animation = 'push_button_01';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = slave.GetWorldPositio
n() - 0.650000 * VecNormalize(VecFromHeading(rot.Yaw + 180)) - 0.150000 * VecNor
malize(VecFromHeading(rot.Yaw + 90));
masterSequencePart.finalHeading = rot.Yaw + 180;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.200000;

masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'GAMEPLAY_SLOT';
masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'btn_up_to_down';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
(W3Switch)slave.ProcessPostTurnActions(false, false);
break;
case 'SwitchButtonOff':
rot = slave.GetWorldRotation();
masterSequencePart.animation = 'push_button_01';
masterSequencePart.syncType = 0;
masterSequencePart.syncEventName = 'SyncEvent';
masterSequencePart.shouldSlide = true;
masterSequencePart.shouldRotate = true;
masterSequencePart.finalPosition = slave.GetWorldPositio
n() - 0.650000 * VecNormalize(VecFromHeading(rot.Yaw + 180)) - 0.150000 * VecNor
malize(VecFromHeading(rot.Yaw + 90));
masterSequencePart.finalHeading = rot.Yaw + 180;
masterSequencePart.blendInTime = 0.200000;
masterSequencePart.blendOutTime = 0.200000;
masterSequencePart.sequenceIndex = 0;
masterDef.parts.PushBack(masterSequencePart);
masterDef.entity = master;
masterDef.manualSlotName = 'GAMEPLAY_SLOT';
masterDef.freezeAtEnd = false;
slaveSequencePart.animation = 'btn_down_to_up';
slaveSequencePart.syncType = 0;
slaveSequencePart.syncEventName = 'SyncEvent';
slaveSequencePart.shouldSlide = false;
slaveSequencePart.blendInTime = 0.200000;
slaveSequencePart.blendOutTime = 0.000000;
slaveSequencePart.sequenceIndex = 0;
slaveDef.parts.PushBack(slaveSequencePart);
slaveDef.entity = slave;
slaveDef.manualSlotName = 'GAMEPLAY_SLOT';
slaveDef.freezeAtEnd = false;
(W3Switch)slave.ProcessPostTurnActions(false, false);
break;
default:
syncInstances.Remove(syncInstance);
return false;
}
sequenceIndex = syncInstance.RegisterMaster(masterDef);
if (sequenceIndex == -1){
syncInstances.Remove(syncInstance);
return false;
}
actorMaster = (CActor)master;
actorSlave = (CActor)slave;

if (actorMaster){
actorMaster.SignalGameplayEventParamInt('SetupSyncInstan
ce', instanceIndex);
actorMaster.SignalGameplayEventParamInt('SetupSequenceIn
dex', sequenceIndex);
if (finisherAnim){
actorMaster.SignalGameplayEvent('PlayFinisherSyn
cedAnim');
} else {
actorMaster.SignalGameplayEvent('PlaySyncedAnim'
);
}
}
sequenceIndex = syncInstance.RegisterSlave(slaveDef);
if (sequenceIndex == -1){
syncInstances.Remove(syncInstance);
return false;
}
if (actorSlave){
if (syncAction == 'Throat'){
actorSlave.SignalGameplayEventParamCName('SetupE
ndEvent', 'CriticalState');
}
actorSlave.SignalGameplayEventParamInt('SetupSyncInstanc
e', instanceIndex);
actorSlave.SignalGameplayEventParamInt('SetupSequenceInd
ex', sequenceIndex);
if (finisherAnim){
actorSlave.SignalGameplayEvent('PlayFinisherSync
edAnim');
} else {
actorSlave.SignalGameplayEvent('PlaySyncedAnim')
;
}
}
return true;
/* NOP */;
}
private function GetFinisherSynAnimName() : CName{
var syncAnimName : CName;
var syncAnimsNames : array<CName>;
var size : Int32;
var i : Int32;
if (thePlayer.forceFinisher && thePlayer.forceFinisherAnimName !
= 'None'){
return thePlayer.forceFinisherAnimName;
}
if (thePlayer.GetCombatIdleStance() <= 0.000000){
syncAnimsNames.PushBack('man_finisher_02_lp');
syncAnimsNames.PushBack('man_finisher_04_lp');
syncAnimsNames.PushBack('man_finisher_06_lp');
syncAnimsNames.PushBack('man_finisher_07_lp');
syncAnimsNames.PushBack('man_finisher_08_lp');
size = dlcFinishersLeftSide.Size();
i = 0;
while (i < size){
syncAnimsNames.PushBack(dlcFinishersLeftSide[i].
finisherAnimName);
i += 1;
}

} else {
syncAnimsNames.PushBack('man_finisher_01_rp');
syncAnimsNames.PushBack('man_finisher_03_rp');
syncAnimsNames.PushBack('man_finisher_05_rp');
size = dlcFinishersRightSide.Size();
i = 0;
while (i < size){
syncAnimsNames.PushBack(dlcFinishersRightSide[i]
.finisherAnimName);
i += 1;
}
}
return syncAnimsNames[RandRange(syncAnimsNames.Size(), 0)];
/* NOP */;
}
private function PlayPhaseChangeCameraAnimation(animationName : CName){
var camera : CCustomCamera;
var moveTargets : array<CActor>;
var animation : SCameraAnimationDefinition;
var player : CR4Player;
camera = theGame.GetGameCamera();
player = thePlayer;
camera.StopAnimation('camera_shake_hit_lvl3_1');
animation.animation = animationName;
animation.priority = 4;
animation.blendIn = 0.000000;
animation.blendOut = 0.500000;
animation.weight = 1.000000;
animation.speed = 1.000000;
animation.reset = true;
camera.PlayAnimation(animation);
thePlayer.EnableManualCameraControl(false, 'Finisher');
/* NOP */;
}
public function GetFinisherCameraAnimName() : CName{
return cameraAnimName;
/* NOP */;
}
private function SelectDLCFinisherCameraAnimName(finisher : CR4FinisherD
LC, finisherAngle : Int32) : CName{
if (finisherAngle >= 3){
return finisher.rightCameraAnimName;
} else if (finisherAngle >= 2){
return finisher.backCameraAnimName;
} else if (finisherAngle >= 1){
return finisher.leftCameraAnimName;
} else {
return finisher.frontCameraAnimName;
}
/* NOP */;
}
private function GetDLCFinisherCameraAnimName(finisherAnimName : CName,
side : EFinisherSide, finisherAngle : Int32, finisherCameraAnimName : CName) : B
ool{
var size : Int32;
var i : Int32;
var finisher : CR4FinisherDLC;
if (side == 0){
size = dlcFinishersLeftSide.Size();
i = 0;

while (i < size){


finisher = dlcFinishersLeftSide[i];
if (finisher.finisherAnimName == finisherAnimNam
e){
finisherCameraAnimName = SelectDLCFinish
erCameraAnimName(finisher, finisherAngle);
return true;
}
i += 1;
}
} else if (side == 1){
size = dlcFinishersRightSide.Size();
i = 0;
while (i < size){
finisher = dlcFinishersRightSide[i];
if (finisher.finisherAnimName == finisherAnimNam
e){
finisherCameraAnimName = SelectDLCFinish
erCameraAnimName(finisher, finisherAngle);
return true;
}
i += 1;
}
}
return false;
/* NOP */;
}
private function ProcessFinisherCameraAnimName(finisherAnimName : CName)
: CName{
var camera : CCustomCamera;
var playerToCamHeading : Float;
var playerTocamAnimInitialHeading : Float;
var angleDiffs : array<Float>;
var i : Int32;
var finisherCameraAnimName : CName;
var checkDLCs : Bool;
camera = theGame.GetGameCamera();
checkDLCs = false;
playerToCamHeading = VecHeading(camera.GetWorldPosition() - theP
layer.GetWorldPosition());
playerTocamAnimInitialHeading = thePlayer.GetHeading();
i = 0;
while (i < 4){
angleDiffs.PushBack(AbsF(AngleDistance(playerToCamHeadin
g, playerTocamAnimInitialHeading)));
playerTocamAnimInitialHeading += 90.000000;
i += 1;
}
i = ArrayFindMinF(angleDiffs);
if (thePlayer.GetCombatIdleStance() <= 0.000000){
if (i >= 3){
switch(finisherAnimName){
case 'man_finisher_02_lp':
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_right';
break;
case 'man_finisher_04_lp':
finisherCameraAnimName = 'man_finisher_0
4_lp_camera_right';
break;

case 'man_finisher_06_lp':
finisherCameraAnimName = 'man_finisher_0
6_lp_camera_right';
break;
case 'man_finisher_07_lp':
finisherCameraAnimName = 'man_finisher_0
7_lp_camera_right';
break;
case 'man_finisher_08_lp':
finisherCameraAnimName = 'man_finisher_0
8_lp_camera_right';
break;
default:
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_right';
checkDLCs = true;
break;
}
} else if (i >= 2){
switch(finisherAnimName){
case 'man_finisher_02_lp':
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_back';
break;
case 'man_finisher_04_lp':
finisherCameraAnimName = 'man_finisher_0
4_lp_camera_back';
break;
case 'man_finisher_06_lp':
finisherCameraAnimName = 'man_finisher_0
6_lp_camera_back';
break;
case 'man_finisher_07_lp':
finisherCameraAnimName = 'man_finisher_0
7_lp_camera_back';
break;
case 'man_finisher_08_lp':
finisherCameraAnimName = 'man_finisher_0
8_lp_camera_back';
break;
default:
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_back';
checkDLCs = true;
break;
}
} else if (i >= 1){
switch(finisherAnimName){
case 'man_finisher_02_lp':
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_left';
break;
case 'man_finisher_04_lp':
finisherCameraAnimName = 'man_finisher_0
4_lp_camera_left';
break;
case 'man_finisher_06_lp':
finisherCameraAnimName = 'man_finisher_0
6_lp_camera_left';
break;

case 'man_finisher_07_lp':
finisherCameraAnimName = 'man_finisher_0
7_lp_camera_left';
break;
case 'man_finisher_08_lp':
finisherCameraAnimName = 'man_finisher_0
8_lp_camera_left';
break;
default:
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_left';
checkDLCs = true;
break;
}
} else {
switch(finisherAnimName){
case 'man_finisher_02_lp':
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_front';
break;
case 'man_finisher_04_lp':
finisherCameraAnimName = 'man_finisher_0
4_lp_camera_front';
break;
case 'man_finisher_06_lp':
finisherCameraAnimName = 'man_finisher_0
6_lp_camera_front';
break;
case 'man_finisher_07_lp':
finisherCameraAnimName = 'man_finisher_0
7_lp_camera_front';
break;
case 'man_finisher_08_lp':
finisherCameraAnimName = 'man_finisher_0
8_lp_camera_front';
break;
default:
finisherCameraAnimName = 'man_finisher_0
2_lp_camera_front';
checkDLCs = true;
break;
}
}
if (checkDLCs){
GetDLCFinisherCameraAnimName(finisherAnimName, 0
, i, finisherCameraAnimName);
}
} else {
if (i >= 3){
switch(finisherAnimName){
case 'man_finisher_01_rp':
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_right';
break;
case 'man_finisher_03_rp':
finisherCameraAnimName = 'man_finisher_0
3_rp_camera_right';
break;
case 'man_finisher_05_rp':
finisherCameraAnimName = 'man_finisher_0

5_rp_camera_right';
break;
default:
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_right';
checkDLCs = true;
break;
}
} else if (i >= 2){
switch(finisherAnimName){
case 'man_finisher_01_rp':
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_back';
break;
case 'man_finisher_03_rp':
finisherCameraAnimName = 'man_finisher_0
3_rp_camera_back';
break;
case 'man_finisher_05_rp':
finisherCameraAnimName = 'man_finisher_0
5_rp_camera_back';
break;
default:
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_back';
checkDLCs = true;
break;
}
} else if (i >= 1){
switch(finisherAnimName){
case 'man_finisher_01_rp':
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_left';
break;
case 'man_finisher_03_rp':
finisherCameraAnimName = 'man_finisher_0
3_rp_camera_left';
break;
case 'man_finisher_05_rp':
finisherCameraAnimName = 'man_finisher_0
5_rp_camera_left';
break;
default:
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_left';
checkDLCs = true;
break;
}
} else {
switch(finisherAnimName){
case 'man_finisher_01_rp':
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_front';
break;
case 'man_finisher_03_rp':
finisherCameraAnimName = 'man_finisher_0
3_rp_camera_front';
break;
case 'man_finisher_05_rp':
finisherCameraAnimName = 'man_finisher_0

5_rp_camera_front';
break;
default:
finisherCameraAnimName = 'man_finisher_0
1_rp_camera_front';
checkDLCs = true;
break;
}
}
if (checkDLCs){
GetDLCFinisherCameraAnimName(finisherAnimName, 1
, i, finisherCameraAnimName);
}
}
return finisherCameraAnimName;
/* NOP */;
}
public function OnRemoveFinisherCameraAnimation() : Bool{
var camera : CCustomCamera;
camera = theGame.GetGameCamera();
camera.StopAnimation(cameraAnimName);
thePlayer.EnableManualCameraControl(true, 'Finisher');
/* NOP */;
}
public function BreakSyncIfPossible(entity : CEntity) : Bool{
var size : Int32;
var i : Int32;
var result : Bool;
size = syncInstances.Size();
result = false;
i = 0;
while (i < size){
if (syncInstances[i].BreakIfPossible(entity)){
result = true;
}
i += 1;
}
return result;
/* NOP */;
}
private function GetActorPosition(ent : CEntity) : Vector{
var pos : Vector;
var actor : CActor;
var torsoBoneIndex : Int32;
pos = ent.GetWorldPosition();
actor = (CActor)ent;
if (actor){
torsoBoneIndex = actor.GetTorsoBoneIndex();
if (torsoBoneIndex != -1){
pos = MatrixGetTranslation(actor.GetBoneWorldMat
rixByIndex(torsoBoneIndex));
} else {
pos = actor.GetWorldPosition();
}
}
return pos;
/* NOP */;
}
public function AddDlcFinisherLeftSide(finisher : CR4FinisherDLC){
dlcFinishersLeftSide.PushBack(finisher);

/* NOP */;
}
public function RemoveDlcFinisherLeftSide(finisher : CR4FinisherDLC){
dlcFinishersLeftSide.Remove(finisher);
/* NOP */;
}
public function AddDlcFinisherRightSide(finisher : CR4FinisherDLC){
dlcFinishersRightSide.PushBack(finisher);
/* NOP */;
}
public function RemoveDlcFinisherRightSide(finisher : CR4FinisherDLC){
dlcFinishersRightSide.Remove(finisher);
/* NOP */;
}
}
import abstract class CWitcherGameResource{
}
import struct CR4TutorialSystem{
private var currentlyShownTutorialIndex : Int32;
private saved var queuedTutorials : array<STutorialMessage>;
private var m_tutorialHintDataObj : W3TutorialPopupData;
private var delayedQueuedTutorialShowTime : Float;
private var hasDelayedTutorial : Bool;
private var showNextHintInstantly : Bool;
private var enableMenuRestrictions : Bool;
private var allowedMenusList : array<CName>;
public saved var uiHandler : W3TutorialManagerUIHandler;
private saved var seenTutorials : array<CName>;
private var attackProcessed : Bool;
private var testData : W3TutorialPopupData;
private saved var hudMessage : CName;
private saved var invisibleTutorialHint : CName;
private saved var wereMessagesEnabled : Bool;
private const var COMBAT_HINT_POS_X : Float;
private const var COMBAT_HINT_POS_Y : Float;
private const var DIALOG_HINT_POS_X : Float;
private const var DIALOG_HINT_POS_Y : Float;
private const var UI_HINT_POS_X : Float;
private const var UI_HINT_POS_Y : Float;
private const var HINT_SHOW_DELAY : Float;
private const var HINT_DURATION_LONG : Float;
private const var HINT_DURATION_SHORT : Float;
//NULL type for needsTickEvent
public function AreMessagesEnabled() : Bool{
return theGame.GetInGameConfigWrapper().GetVarValue('Gameplay',
'HudTutorialEnabled') == "true";
/* NOP */;
}
public function IsRunning() : Bool{
return FactsQuerySum("tutorial_system_is_running");
/* NOP */;
}
public function IncreaseDodges(){
FactsAdd("tutorial_dodges_cnt", /* NOP */, /* NOP */);
/* NOP */;
}
public function IncreaseRolls(){
FactsAdd("tutorial_rolls_cnt", /* NOP */, /* NOP */);

/* NOP */;
}
public function IncreaseCounters(){
FactsAdd("tutorial_counters_cnt", /* NOP */, /* NOP */);
/* NOP */;
}
public function IncreaseParries(){
FactsAdd("tutorial_parries_cnt", /* NOP */, /* NOP */);
/* NOP */;
}
public function OnGameStart(restored : Bool) : Bool{
super.ClearNonSavedVars();
if (!IsRunning()){
super.ClearSavedVars();
}
if (restored){
if (!IsRunning() || FactsQuerySum("NewGamePlus") > 0){
needsTickEvent = false;
}
}
attackProcessed = false;
ActivateJournalEntry('TutorialJournalSignCast');
ActivateJournalEntry('TutorialJournalHeavyAttacks');
ActivateJournalEntry('TutorialHorseSummon');
ActivateJournalEntry('TutorialJournalLightAttacks');
ActivateJournalEntry('TutorialJournalSpecialAttacks');
ActivateJournalEntry('TutorialCiriCharge');
ActivateJournalEntry('TutorialAdrenaline');
/* NOP */;
}
public final function ClearSavedVars(){
needsTickEvent = true;
queuedTutorials.Clear();
uiHandler = NULL;
seenTutorials.Clear();
invisibleTutorialHint = 'None';
wereMessagesEnabled = false;
hudMessage = 'None';
/* NOP */;
}
public final function ClearNonSavedVars(){
currentlyShownTutorialIndex = -1;
delayedQueuedTutorialShowTime = 0;
hasDelayedTutorial = false;
showNextHintInstantly = false;
enableMenuRestrictions = false;
allowedMenusList.Clear();
attackProcessed = false;
m_tutorialHintDataObj = NULL;
testData = NULL;
/* NOP */;
}
public function TutorialStart(removeTestingSkillsAndItems : Bool){
var dm : CDefinitionsManagerAccessor;
var i : Int32;
var skill : SSimpleSkill;
var abs : array<CName>;
var witcher : W3PlayerWitcher;
if (IsRunning()){
return;

}
super.ClearSavedVars();
wereMessagesEnabled = AreMessagesEnabled();
uiHandler = new W3TutorialManagerUIHandler in this;
thePlayer.CreateTutorialInput();
FactsAdd('tutorial_starting_level', GetWitcherPlayer().GetLevel(
), /* NOP */);
if (removeTestingSkillsAndItems){
dm = theGame.GetDefinitionsManager();
dm.GetContainedAbilities('GeraltSkills_Testing', abs);
witcher = GetWitcherPlayer();
skill.level = 0;
i = 0;
while (i < abs.Size()){
skill.skillType = SkillNameToEnum(abs[i]);
if (skill.skillType != 0){
witcher.RemoveTemporarySkill(skill);
}
i += 1;
}
thePlayer.AddTimer('Debug_RemoveTestingItems', 0.000100,
true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
MarkMessageAsSeen('TutorialDialog');
MarkMessageAsSeen('TutorialContainers');
MarkMessageAsSeen('TutorialLootWindow');
MarkMessageAsSeen('TutorialHorseStop');
MarkMessageAsSeen('TutorialQuestBoard');
MarkMessageAsSeen('TutorialCiriTaunt');
MarkMessageAsSeen('TutorialWrongSwordSteel');
MarkMessageAsSeen('TutorialWrongSwordSilver');
MarkMessageAsSeen('TutorialCampfire');
MarkMessageAsSeen('TutorialPotionAmmo');
MarkMessageAsSeen('TutorialOilAmmo');
FactsSet("tutorial_system_is_running", 1, /* NOP */);
/* NOP */;
}
public function TutorialFinish(){
thePlayer.CreateInput();
FactsSet("tutorial_system_is_running", 0, /* NOP */);
/* NOP */;
}
public function HasSeenTutorial(tutorialScriptTag : CName) : Bool{
return seenTutorials.Contains(tutorialScriptTag);
/* NOP */;
}
public function DisplayTutorial(tut : STutorialMessage){
var i : Int32;
if (!IsRunning()){
return;
}
i = 0;
while (i < queuedTutorials.Size()){
if (queuedTutorials[i].tutorialScriptTag == tut.tutorial
ScriptTag){
return;
}
i += 1;
}
if (!AreMessagesEnabled() && tut.type == 2){

if (tut.markAsSeenOnShow){
MarkMessageAsSeen(tut.tutorialScriptTag);
}
return;
}
if (tut.forceToQueueFront && queuedTutorials.Size() > 0){
HideTutorialHint('None', true, true);
queuedTutorials.Insert(0, tut);
if (CanShowTutorial(tut.canBeShownInDialogs, tut.canBeSh
ownInMenus)){
SelectAndDisplayTutorial(tut);
}
} else {
queuedTutorials.PushBack(tut);
if (queuedTutorials.Size() == 1 && CanShowTutorial(tut.c
anBeShownInDialogs, tut.canBeShownInMenus)){
SelectAndDisplayTutorial(tut);
}
}
/* NOP */;
}
private function CanShowTutorial(canBeShownInDialogs : Bool, canBeShownI
nMenus : Bool) : Bool{
if (!canBeShownInDialogs && theGame.IsDialogOrCutscenePlaying())
{
return false;
}
if (!canBeShownInMenus && theGame.GetGuiManager().IsAnyMenu()){
return false;
}
if (!thePlayer.IsAlive()){
return false;
}
if (theGame.IsBlackscreen() || theGame.IsFading()){
return false;
}
if (FactsQuerySum("NewGamePlus") > 0){
return false;
}
return currentlyShownTutorialIndex < 0;
/* NOP */;
}
public function OnTick(dt : Float) : Bool{
var dbg_launchedTutorial : Bool;
var i : Int32;
var temp : STutorialMessage;
super.ProcessHUDMessage();
if (theGame.GetGuiManager().IsAnyMenu() && queuedTutorials.Size(
) > 0 && m_tutorialHintDataObj){
if (!queuedTutorials[0].canBeShownInMenus){
HideTutorialHint('None', true, true);
}
}
if (wereMessagesEnabled && !AreMessagesEnabled()){
if (queuedTutorials[0].hintDurationType == 3){
HideTutorialHint('None', true, true);
} else {
HideTutorialHint('None', true, /* NOP */);
}
}

if (wereMessagesEnabled != AreMessagesEnabled()){
wereMessagesEnabled = !wereMessagesEnabled;
}
if (hasDelayedTutorial){
if (delayedQueuedTutorialShowTime <= 0){
if (queuedTutorials.Size() > 0){
if (CanShowTutorial(queuedTutorials[0].c
anBeShownInDialogs, queuedTutorials[0].canBeShownInMenus)){
DelayedQueuedTutorialShow();
dbg_launchedTutorial = true;
}
}
hasDelayedTutorial = false;
} else {
delayedQueuedTutorialShowTime -= dt;
}
} else {
i = 0;
while (i < queuedTutorials.Size()){
if (CanShowTutorial(queuedTutorials[i].canBeShow
nInDialogs, queuedTutorials[i].canBeShownInMenus)){
if (showNextHintInstantly){
delayedQueuedTutorialShowTime =
0;
} else {
delayedQueuedTutorialShowTime =
HINT_SHOW_DELAY;
}
hasDelayedTutorial = true;
if (i != 0){
temp = queuedTutorials[i];
queuedTutorials.Insert(0, temp);
queuedTutorials.Erase(i + 1);
}
break;
}
i += 1;
}
}
if (thePlayer.IsThreatened() && ShouldProcessTutorial('TutorialD
odge')){
super.ProcessDodges();
}
if (thePlayer.IsThreatened() && ShouldProcessTutorial('TutorialR
oll')){
super.ProcessRolls();
}
/* NOP */;
}
public final function OnInputDeviceChanged(){
if (queuedTutorials.Size() > 0 && currentlyShownTutorialIndex >=
0){
ReloadMessageOnInputChange(theInput.LastUsedGamepad(), t
rue);
}
/* NOP */;
}
private final function ProcessDodges(){
var ves : CNewNPC;
ves = theGame.GetNPCByTag('vesemir');

if (!ves){
return;
}
if (ves.IsAttacking()){
if (FactsQuerySum('tut_in_dodge')){
attackProcessed = true;
}
} else {
if (attackProcessed && GameplayFactsQuerySum("tut_failed
_dodge") < 1){
IncreaseDodges();
}
attackProcessed = false;
}
/* NOP */;
}
private final function ProcessRolls(){
var ves : CNewNPC;
ves = theGame.GetNPCByTag('vesemir');
if (!ves){
return;
}
if (ves.IsAttacking()){
if (FactsQuerySum('tut_in_roll')){
attackProcessed = true;
}
} else {
if (attackProcessed && GameplayFactsQuerySum("tut_failed
_roll") < 1){
IncreaseRolls();
}
attackProcessed = false;
}
/* NOP */;
}
private function DelayedQueuedTutorialShow(){
SelectAndDisplayTutorial(queuedTutorials[0]);
delayedQueuedTutorialShowTime = 0;
LogTutorial("Show index is now: 0");
/* NOP */;
}
public function OnTutorialClosing(scriptName : CName, closedByUIPanel :
Bool, willBeCloned : Bool) : Bool{
var i : Int32;
var j : Int32;
var inQueue : Bool;
var factOnSeen : String;
i = 0;
while (i < queuedTutorials.Size()){
if (queuedTutorials[i].tutorialScriptTag == scriptName){
factOnSeen = queuedTutorials[i].factOnFinishedDi
splay;
if (!closedByUIPanel){
if (queuedTutorials[i].markAsSeenOnShow)
{
MarkMessageAsSeen(queuedTutorial
s[i].tutorialScriptTag);
}
queuedTutorials.Erase(i);
}

if (i == 0){
currentlyShownTutorialIndex = -1;
LogTutorial("Show index is now: -1");
}
LogTutorial("Closed tutorial <<" + scriptName +
">>, fromUI = " + closedByUIPanel);
RemoveMenuRestrictions();
if (factOnSeen != "" && !willBeCloned){
inQueue = false;
j = 0;
while (j < queuedTutorials.Size()){
if (queuedTutorials[j].tutorialS
criptTag == scriptName){
inQueue = true;
break;
}
j += 1;
}
if (!inQueue){
FactsAdd(factOnSeen, /* NOP */,
/* NOP */);
}
}
break;
}
i += 1;
}
/* NOP */;
}
public function OnTutorialClosed(scriptName : CName, closedByUIPanel : B
ool) : Bool{
uiHandler.OnTutorialClosed(scriptName, closedByUIPanel);
/* NOP */;
}
private function SelectAndDisplayTutorial(tut : STutorialMessage){
if (tut.type == 0){
LogTutorial("SelectAndDisplayTutorial: tutorial <<" + tu
t.tutorialScriptTag + ">> has no type set - not showing!");
LogAssert(false, "SelectAndDisplayTutorial: tutorial <<"
+ tut.tutorialScriptTag + ">> has no type set - not showing!");
}
DisplayTutorialHint(tut);
/* NOP */;
}
private function DisplayTutorialHint(tut : STutorialMessage){
var tutorialEntry : CJournalTutorial;
var i : Int32;
if (!tut.force && HasSeenTutorial(tut.tutorialScriptTag) || !Are
MessagesEnabled()){
if (!AreMessagesEnabled()){
FactsAdd(queuedTutorials[0].factOnFinishedDispla
y, /* NOP */, /* NOP */);
}
queuedTutorials.EraseFast(0);
return;
}
tutorialEntry = GetMessageText(tut.tutorialScriptTag, 0);
if (!tutorialEntry){
queuedTutorials.Erase(0);
return;

}
if (m_tutorialHintDataObj){
}
m_tutorialHintDataObj = new W3TutorialPopupData in this;
m_tutorialHintDataObj.managerRef = this;
m_tutorialHintDataObj.scriptTag = tut.tutorialScriptTag;
m_tutorialHintDataObj.messageTitle = GetLocStringById(tutorialEn
try.GetNameStringId());
m_tutorialHintDataObj.messageText = GetTutorialLocalizedText(tut
orialEntry.GetDescriptionStringId());
m_tutorialHintDataObj.imagePath = tutorialEntry.GetImagePath();
m_tutorialHintDataObj.enableGlossoryLink = false;
m_tutorialHintDataObj.autosize = !tut.disableHorizontalResize;
m_tutorialHintDataObj.blockInput = tut.blockInput;
m_tutorialHintDataObj.pauseGame = tut.pauseGame;
m_tutorialHintDataObj.fullscreen = tut.fullscreen;
m_tutorialHintDataObj.canBeShownInMenus = tut.canBeShownInMenus;
if (tut.hintDurationType == 5 && tut.type != 2){
m_tutorialHintDataObj.enableAcceptButton = true;
m_tutorialHintDataObj.blockInput = true;
}
if (tut.type == 2){
m_tutorialHintDataObj.fullscreen = true;
}
if (tut.isHUDTutorial){
DisplayHUDTutorialHighlight(tut.tutorialScriptTag, true)
;
} else {
i = 0;
while (i < tut.highlightAreas.Size()){
m_tutorialHintDataObj.AddHighlightedArea(tut.hig
hlightAreas[i].x, tut.highlightAreas[i].y, tut.highlightAreas[i].width, tut.high
lightAreas[i].height);
i += 1;
}
}
switch(tut.hintPositionType){
case 0:
m_tutorialHintDataObj.posX = 0;
m_tutorialHintDataObj.posY = 0;
break;
case 1:
m_tutorialHintDataObj.posX = DIALOG_HINT_POS_X;
m_tutorialHintDataObj.posY = DIALOG_HINT_POS_Y;
break;
case 2:
m_tutorialHintDataObj.posX = COMBAT_HINT_POS_X;
m_tutorialHintDataObj.posY = COMBAT_HINT_POS_Y;
break;
case 4:
m_tutorialHintDataObj.posX = UI_HINT_POS_X;
m_tutorialHintDataObj.posY = UI_HINT_POS_Y;
break;
case 3:
m_tutorialHintDataObj.posX = tut.hintPosX;
m_tutorialHintDataObj.posY = tut.hintPosY;
break;
case 5:
m_tutorialHintDataObj.posX = 0;
m_tutorialHintDataObj.posY = 0.430000;

}
if (tut.hintDurationType == 1){
m_tutorialHintDataObj.duration = HINT_DURATION_SHORT * 1
000;
} else if (tut.hintDurationType == 2){
m_tutorialHintDataObj.duration = HINT_DURATION_LONG * 10
00;
} else if (tut.hintDurationType == 3 || tut.hintDurationType ==
5){
m_tutorialHintDataObj.duration = -1;
} else if (tut.hintDurationType == 4 && tut.hintDuration > 0){
m_tutorialHintDataObj.duration = tut.hintDuration * 1000
;
} else {
m_tutorialHintDataObj.duration = tut.hintDuration;
}
ShowTutorialHint(m_tutorialHintDataObj);
ActivateJournalEntry(tut.journalEntryName);
if (tut.disabledPanelsExceptions.Size() > 0){
SetMenuRestrictions(tut.disabledPanelsExceptions);
}
showNextHintInstantly = false;
currentlyShownTutorialIndex = 0;
/* NOP */;
}
private function DisplayHUDTutorialHighlight(tutorialName : CName, bShow
: Bool){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.DisplayTutorialHighlight(tutorialName, bShow);
}
/* NOP */;
}
public function HintFeedback(tutorialScriptTag : CName, negative : Bool)
{
if (m_tutorialHintDataObj && m_tutorialHintDataObj.scriptTag ==
tutorialScriptTag){
m_tutorialHintDataObj.PlayFeedbackAnim(!negative);
}
/* NOP */;
}
public function DEBUG_TestTutorialHint(x : Float, y : Float, w : Float,
h : Float, d : Float){
var testMenusList : array<CName>;
testData = new W3TutorialPopupData in this;
testData.managerRef = this;
testData.enableGlossoryLink = true;
testData.autosize = false;
testData.posX = 0.990000;
testData.posY = 0.990000;
testData.canBeShownInMenus = true;
testData.messageTitle = "Destruir Toda!";
testData.messageText = "Test internetowa usuga tumacze Google byskaw
icznie tumaczy tekst i strony internetowe.";
if (x > 0 && y > 0 && w > 0 && h > 0){
testData.AddHighlightedArea(x, y, w, h);
} else {
testData.AddHighlightedArea(0.500000, 0.800000, 0.100000
, 0.200000);

}
testData.duration = d;
ShowTutorialHint(testData);
m_tutorialHintDataObj = testData;
/* NOP */;
}
public function DEBUG_TestTutFeedback(isCorrect : Bool){
if (testData){
testData.PlayFeedbackAnim(isCorrect);
}
/* NOP */;
}
private function GetMessageText(scriptTag : String, status : EJournalSta
tus) : CJournalTutorial{
var entryBase : CJournalBase;
var resource : CJournalResource;
var manager : CWitcherJournalManager;
var tutorialEntry : CJournalTutorial;
manager = theGame.GetJournalManager();
entryBase = (CJournalResource)LoadResource(scriptTag, /* NOP */)
.GetEntry();
if (!entryBase){
LogAssert(false, "W3TutorialManager.GetMessageText: cann
ot load resource <<" + scriptTag + ">>!");
return NULL;
}
manager.ActivateEntry(entryBase, status, /* NOP */, /* NOP */);
if (theInput.UsesPlaystationPadScript()){
resource = (CJournalResource)LoadResource(scriptTag + "_
ps4", /* NOP */);
}
if (!resource){
resource = (CJournalResource)LoadResource(scriptTag + "_
pad", /* NOP */);
}
if (resource){
entryBase = resource.GetEntry();
if (entryBase){
manager.ActivateEntry(entryBase, status, /* NOP
*/, /* NOP */);
}
}
if (theInput.LastUsedGamepad()){
if (theInput.UsesPlaystationPadScript()){
tutorialEntry = (CJournalTutorial)manager.GetEnt
ryByString(scriptTag + "_ps4");
}
if (!tutorialEntry){
tutorialEntry = (CJournalTutorial)manager.GetEnt
ryByString(scriptTag + "_pad");
}
}
if (!tutorialEntry){
tutorialEntry = (CJournalTutorial)manager.GetEntryByStri
ng(scriptTag);
}
return tutorialEntry;
/* NOP */;
}
public function HideTutorialHint(scriptTag : CName, forceCloseAny : Bool

, dontRemoveFromQueue : Bool){
var i : Int32;
var clone : STutorialMessage;
if (m_tutorialHintDataObj && forceCloseAny || m_tutorialHintData
Obj.scriptTag == scriptTag){
if (forceCloseAny){
scriptTag = queuedTutorials[i].tutorialScriptTag
;
}
if (dontRemoveFromQueue){
clone = queuedTutorials[0];
}
m_tutorialHintDataObj.CloseTutorialPopup(dontRemoveFromQ
ueue);
OnTutorialClosing(scriptTag, false, true);
currentlyShownTutorialIndex = -1;
if (dontRemoveFromQueue){
queuedTutorials.Insert(0, clone);
}
} else if (!dontRemoveFromQueue){
i = 0;
while (i < queuedTutorials.Size()){
if (queuedTutorials[i].tutorialScriptTag == scri
ptTag){
queuedTutorials.Erase(i);
}
i += 1;
}
}
/* NOP */;
}
public function HandleTutorialMessageHidden(scriptTag : CName, forcedClo
se : Bool){
OnTutorialClosing(scriptTag, forcedClose, /* NOP */);
/* NOP */;
}
public function OnTutorialHintClosing(scriptTag : CName, forcedClose : B
ool, closedByUser : Bool, willBeCloned : Bool){
OnTutorialClosing(scriptTag, forcedClose, willBeCloned);
/* NOP */;
}
public function OnTutorialHintClosed(scriptTag : CName, forcedClose : Bo
ol){
OnTutorialClosed(scriptTag, forcedClose);
DisplayHUDTutorialHighlight(scriptTag, false);
/* NOP */;
}
public function HAX_DEBUG_ForceTutorialMessageAsSeen(tutorialScriptTag :
CName, showInJournal : Bool){
}
public function MarkMessageAsSeen(tutorialScriptTag : CName){
if (!seenTutorials.Contains(tutorialScriptTag)){
seenTutorials.PushBack(tutorialScriptTag);
}
/* NOP */;
}
public function UnmarkMessageAsSeen(tutorialScriptTag : CName){
if (seenTutorials.Contains(tutorialScriptTag)){
seenTutorials.Remove(tutorialScriptTag);
}

/* NOP */;
}
public function SetInteraction(component : CInteractionComponent){
var actionName : CName;
var container : Bool;
var talk : Bool;
var door : Bool;
var examine : Bool;
var repairSword : Bool;
var repairArmor : Bool;
var mountBoat : Bool;
var fastTravel : Bool;
var campfire : Bool;
var monsterNest : Bool;
var craftsman : Bool;
var ent : CEntity;
var repairObj : W3ItemRepairObject;
if (component){
actionName = component.GetInputActionName();
ent = component.GetEntity();
repairObj = (W3ItemRepairObject)ent;
if (repairObj){
if (repairObj.RepairsSword()){
repairSword = true;
}
if (repairObj.RepairsArmor()){
repairArmor = true;
}
} else if ((W3FastTravelEntity)ent){
fastTravel = true;
} else if ((CMonsterNestEntity)ent){
monsterNest = true;
} else if (ent.GetComponentByClassName('W3MeditationComp
onent')){
campfire = true;
} else if (ent.GetComponentByClassName('CBoatComponent')
|| (W3Boat)ent || ent.GetComponentByClassName('CBoatDestructionComponent')){
mountBoat = true;
} else if (actionName == 'Container'){
container = true;
} else if (actionName == 'Talk'){
talk = true;
if (ent.GetComponentByClassName('W3CraftsmanComp
onent')){
craftsman = true;
}
} else if (actionName == 'Examine'){
examine = true;
}
}
if (container){
FactsAdd("tutorial_interaction_container", /* NOP */, /*
NOP */);
} else {
FactsRemove("tutorial_interaction_container");
}
if (talk){
FactsAdd("tutorial_interaction_talk", /* NOP */, /* NOP
*/);
} else {

FactsRemove("tutorial_interaction_talk");
}
if (examine){
FactsAdd("tutorial_interaction_examine", /* NOP */, /* N
OP */);
} else {
FactsRemove("tutorial_interaction_examine");
}
if (repairArmor){
FactsAdd("tutorial_interaction_repair_armor", /* NOP */,
/* NOP */);
} else {
FactsRemove("tutorial_interaction_repair_armor");
}
if (repairSword){
FactsAdd("tutorial_interaction_repair_sword", /* NOP */,
/* NOP */);
} else {
FactsRemove("tutorial_interaction_repair_sword");
}
if (mountBoat){
FactsAdd("tutorial_interaction_boat", /* NOP */, /* NOP
*/);
} else {
FactsRemove("tutorial_interaction_boat");
}
if (fastTravel){
FactsAdd("tutorial_interaction_fast_travel", /* NOP */,
/* NOP */);
} else {
FactsRemove("tutorial_interaction_fast_travel");
}
if (campfire){
FactsAdd("tutorial_interaction_campfire", /* NOP */, /*
NOP */);
} else {
FactsRemove("tutorial_interaction_campfire");
}
if (monsterNest){
FactsAdd("tutorial_interaction_mon_nest", /* NOP */, /*
NOP */);
} else {
FactsRemove("tutorial_interaction_mon_nest");
}
if (craftsman){
FactsAdd("tutorial_interaction_craftsman", /* NOP */, /*
NOP */);
} else {
FactsRemove("tutorial_interaction_craftsman");
}
/* NOP */;
}
public function ShowTutorialHint(hintData : W3TutorialPopupData){
theGame.RequestPopup('TutorialPopup', hintData);
/* NOP */;
}
public function ActivateJournalEntry(entryName : CName){
var entryBase : CJournalBase;
var resource : CJournalResource;
var manager : CWitcherJournalManager;

if (!IsNameValid(entryName)){
return;
}
manager = theGame.GetJournalManager();
resource = (CJournalResource)LoadResource(entryName, /* NOP */);
if (resource){
entryBase = resource.GetEntry();
if (entryBase){
manager.ActivateEntry(entryBase, 1, /* NOP */, /
* NOP */);
}
}
resource = (CJournalResource)LoadResource(entryName + "_pad", /*
NOP */);
if (resource){
entryBase = resource.GetEntry();
if (entryBase){
manager.ActivateEntry(entryBase, 1, /* NOP */, /
* NOP */);
}
}
resource = (CJournalResource)LoadResource(entryName + "_ps4", /*
NOP */);
if (resource){
entryBase = resource.GetEntry();
if (entryBase){
manager.ActivateEntry(entryBase, 1, /* NOP */, /
* NOP */);
}
}
/* NOP */;
}
public function GetCurrentlyShownTutorialScriptName() : CName{
if (queuedTutorials.Size() > 0 && m_tutorialHintDataObj && curre
ntlyShownTutorialIndex >= 0){
return queuedTutorials[currentlyShownTutorialIndex].tuto
rialScriptTag;
}
return 'None';
/* NOP */;
}
public function IncreaseGeraltsLightAttacksCount(victimTags : array<CNam
e>){
var i : Int32;
i = 0;
while (i < victimTags.Size()){
FactsAdd("tut_light_attack_" + victimTags[i], /* NOP */,
/* NOP */);
i += 1;
}
/* NOP */;
}
public function IncreaseGeraltsHeavyAttacksCount(victimTags : array<CNam
e>){
var i : Int32;
i = 0;
while (i < victimTags.Size()){
FactsAdd("tut_heavy_attack_" + victimTags[i], /* NOP */,
/* NOP */);
i += 1;

}
/* NOP */;
}
public function OnCutsceneOrDialogChange(isNowOn : Bool){
if (!isNowOn){
return;
}
if (queuedTutorials.Size() > 0 && m_tutorialHintDataObj){
if (!queuedTutorials[0].canBeShownInDialogs){
HideTutorialHint('None', true, true);
}
}
/* NOP */;
}
public function OnGuardSwordWarning(){
FactsAdd("tut_guard_warning", 1, 1);
thePlayer.DisplayHudMessage(GetLocStringByKeyExt("guards_tauntin
g_message"));
/* NOP */;
}
public function OnGuardGeneralWarning(){
thePlayer.DisplayHudMessage(GetLocStringByKeyExt("guards_tauntin
g_message"));
/* NOP */;
}
public function OnGuardLootingWarning(){
thePlayer.DisplayHudMessage(GetLocStringByKeyExt("guards_stealin
g_message"));
if (!HasSeenTutorial('TutorialStealing')){
FactsAdd("tut_stealing", /* NOP */, /* NOP */);
}
/* NOP */;
}
public final function ReloadMessageOnInputChange(startedUsingPad : Bool,
forceShowImmediately : Bool){
var resPad : CJournalResource;
var resCommon : CJournalResource;
var tutorialEntry : CJournalTutorial;
var performReload : Bool;
var manager : CWitcherJournalManager;
if (queuedTutorials.Size() == 0){
return;
}
performReload = false;
if (theInput.UsesPlaystationPadScript()){
resPad = (CJournalResource)LoadResource(queuedTutorials[
0].tutorialScriptTag + "_ps4", /* NOP */);
if (!resPad){
resPad = (CJournalResource)LoadResource(queuedTu
torials[0].tutorialScriptTag + "_pad", /* NOP */);
}
} else {
resPad = (CJournalResource)LoadResource(queuedTutorials[
0].tutorialScriptTag + "_pad", /* NOP */);
}
if (resPad){
performReload = true;
} else {
resCommon = (CJournalResource)LoadResource(queuedTutoria
ls[0].tutorialScriptTag, /* NOP */);

manager = theGame.GetJournalManager();
tutorialEntry = (CJournalTutorial)manager.GetEntryByStri
ng(queuedTutorials[0].tutorialScriptTag);
if (!tutorialEntry){
manager.ActivateEntry(resCommon.GetEntry(), 0, /
* NOP */, /* NOP */);
tutorialEntry = (CJournalTutorial)manager.GetEnt
ryByString(queuedTutorials[0].tutorialScriptTag);
}
if (!tutorialEntry || HasLolcalizationTags(GetLocStringB
yId(tutorialEntry.GetDescriptionStringId()))){
performReload = true;
}
}
if (performReload){
showNextHintInstantly = true;
HideTutorialHint('None', true, true);
if (forceShowImmediately){
DelayedQueuedTutorialShow();
}
}
/* NOP */;
}
private function GetTutorialLocalizedText(locId : Int32) : String{
return ReplaceTagsToIcons(GetLocStringById(locId));
/* NOP */;
}
private function SetMenuRestrictions(enabledMenuList : array<CName>){
var commonMenuRef : CR4CommonMenu;
enableMenuRestrictions = true;
allowedMenusList = enabledMenuList;
commonMenuRef = theGame.GetGuiManager().GetCommonMenu();
if (commonMenuRef){
commonMenuRef.UpdateTutorialRestruction();
}
/* NOP */;
}
private function RemoveMenuRestrictions(){
enableMenuRestrictions = false;
allowedMenusList.Clear();
/* NOP */;
}
public function IsMenuRestrictionsEnable() : Bool{
return enableMenuRestrictions;
/* NOP */;
}
public function GetAllowedMenuList() : array<CName>{
return allowedMenusList;
/* NOP */;
}
public final function Failsafe(){
queuedTutorials.Clear();
HideTutorialHint('None', true, /* NOP */);
currentlyShownTutorialIndex = -1;
delayedQueuedTutorialShowTime = 0;
hasDelayedTutorial = false;
showNextHintInstantly = false;
enableMenuRestrictions = false;
invisibleTutorialHint = 'None';
allowedMenusList.Clear();

/* NOP */;
}
public final function SetHudMessage(tutorialMessageName : CName, on : Bo
ol){
var hud : CR4ScriptedHud;
var messageModule : CR4HudModuleMessage;
if (on){
hudMessage = tutorialMessageName;
} else {
hudMessage = 'None';
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
messageModule = (CR4HudModuleMessage)hud.GetHudM
odule("MessageModule");
if (messageModule){
messageModule.OnMessageHidden();
}
}
}
/* NOP */;
}
private final function ProcessHUDMessage(){
var tutorialEntry : CJournalTutorial;
var msgText : String;
if (IsNameValid(hudMessage) && AreMessagesEnabled()){
tutorialEntry = GetMessageText(hudMessage, 0);
msgText = GetTutorialLocalizedText(tutorialEntry.GetDesc
riptionStringId());
thePlayer.DisplayHudMessage(msgText);
}
/* NOP */;
}
private timer function TutorialInvisibleHint(optional dt : Float, option
al id : Int32){
HideTutorialHint(invisibleTutorialHint, /* NOP */, /* NOP */);
/* NOP */;
}
public final function ForcedAlchemyCleanup(){
uiHandler.LockCloseUIPanels(false);
FactsRemove("tut_forced_preparation");
uiHandler.LockLeaveMenu(false);
thePlayer.BlockAllActions('tut_forced_preparation', false, /* NO
P */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
uiHandler.UnregisterUIHint('ForcedAlchemy', /* NOP */);
uiHandler.UnregisterUIHint('Alchemy', "forced");
uiHandler.UnregisterUIHint('Potions', "forced");
/* NOP */;
}
public final function OnOpeningMenuHandleNonMenuTutorial(){
if (queuedTutorials.Size() > 0 && currentlyShownTutorialIndex >=
0){
if (!queuedTutorials[currentlyShownTutorialIndex].canBeS
hownInMenus){
HideTutorialHint(queuedTutorials[currentlyShownT
utorialIndex].tutorialScriptTag, /* NOP */, true);
}
}
/* NOP */;
}
public final function DEBUG_LogQueuedTutorials(){

var i : Int32;
LogTutorial("Printing tutorial queue:");
i = 0;
while (i < queuedTutorials.Size()){
LogTutorial(i + ") " + queuedTutorials[i].tutorialScript
Tag);
i += 1;
}
/* NOP */;
}
}
statemachine class W3TutorialManagerUIHandler extends CObject{
private saved var listeners : array<SUITutorial>;
private var lastOpenedMenu : CName;
private var isMenuOpened : Bool;
private var postponedUnregisteredMenu : CName;
private function HandleListeners(menuName : CName, isOpened : Bool) : Bo
ol{
var i : Int32;
var factVal : Int32;
var chosenIndex : Int32;
var minPriority : Int32;
if (menuName == 'TutorialPopupMenu'){
return false;
}
if (menuName == 'CommonMenu' && theGame.GameplayFactsQuerySum("s
hopMode") > 0){
return false;
}
if (isOpened){
lastOpenedMenu = menuName;
}
isMenuOpened = isOpened;
minPriority = 1000000;
chosenIndex = -1;
i = 0;
while (i < listeners.Size()){
if (listeners[i].menuName != menuName){
} else if (listeners[i].triggerCondition == 0 && !isOpen
ed){
} else if (listeners[i].requiredGameplayFactName != ""){
factVal = theGame.GameplayFactsQuerySum(listener
s[i].requiredGameplayFactName);
if (!ProcessCompare(listeners[i].requiredGamepla
yFactComparator, factVal, listeners[i].requiredGameplayFactValueInt)){
}
} else if (minPriority > listeners[i].priority){
minPriority = listeners[i].priority;
chosenIndex = i;
}
i += 1;
}
if (chosenIndex >= 0){
GotoState(listeners[chosenIndex].tutorialStateName, /* N
OP */, /* NOP */);
return true;
}
return false;
/* NOP */;

}
public function RegisterUIHint(data : SUITutorial){
listeners.PushBack(data);
/* NOP */;
}
public function UnregisterUIHint(tutorialStateName : CName, sourceName :
String) : Bool{
var i : Int32;
i = 0;
while (i < listeners.Size()){
if (listeners[i].tutorialStateName == tutorialStateName
&& sourceName == "" || listeners[i].sourceName == sourceName){
listeners.EraseFast(i);
if (tutorialStateName == 'Books' || tutorialStat
eName == 'RecipeReading'){
postponedUnregisteredMenu = lastOpenedMe
nu;
return false;
}
if (lastOpenedMenu == listeners[i].menuName && i
sMenuOpened){
return HandleListeners(lastOpenedMenu, t
rue);
} else {
return false;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function OnOpeningMenu(menuName : CName) : Bool{
LogTutorial("UIHandler: OnOpeningMenu <<" + menuName + ">>");
if (menuName == 'CommonMenu' || menuName == 'CommonIngameMenu'){
theGame.GetTutorialSystem().OnOpeningMenuHandleNonMenuTu
torial();
}
if (menuName == 'AlchemyMenu' && ShouldProcessTutorial('Tutorial
AlchemyCook')){
super.ProcessAlchemyTutorialFact();
}
if (menuName == 'CraftingMenu' && ShouldProcessTutorial('Tutoria
lCraftingSchematicsList')){
super.ProcessCraftingTutorialFact();
}
if (menuName == 'InventoryMenu' && ShouldProcessTutorial('Tutori
alRunesSelectRune')){
super.ProcessRunesFact();
}
if (menuName == 'InventoryMenu' && ShouldProcessTutorial('Tutori
alArmorSocketsSelectTab')){
super.ArmorUpgradesTutorialCheck();
}
if (menuName == 'InventoryMenu' && ShouldProcessTutorial('Tutori
alPotionCanEquip2')){
super.ProcessPotionEquipFact();
}
HandleListeners(menuName, true);
OnMenuOpening(menuName);

/* NOP */;
}
private final function ProcessPotionEquipFact(){
var witcher : W3PlayerWitcher;
var isPot1 : Bool;
var isPot2 : Bool;
var pot : SItemUniqueId;
var n : CName;
witcher = GetWitcherPlayer();
if (witcher){
isPot1 = false;
isPot2 = false;
if (witcher.GetItemEquippedOnSlot(14, pot)){
isPot1 = witcher.inv.IsItemPotion(pot);
n = witcher.inv.GetItemName(pot);
}
if (witcher.GetItemEquippedOnSlot(15, pot)){
isPot2 = witcher.inv.IsItemPotion(pot);
n = witcher.inv.GetItemName(pot);
}
if (!isPot1 && !isPot2){
GameplayFactsAdd("tutorial_equip_potion", /* NOP
*/, /* NOP */);
}
}
/* NOP */;
}
private final function ProcessAlchemyTutorialFact(){
var alchemyManager : W3AlchemyManager;
var witcher : W3PlayerWitcher;
var i : Int32;
var recipes : array<CName>;
witcher = GetWitcherPlayer();
if (witcher){
GameplayFactsRemove("tutorial_alch_has_ings");
alchemyManager = new W3AlchemyManager in this;
alchemyManager.Init(/* NOP */);
recipes = witcher.GetAlchemyRecipes();
i = 0;
while (i < recipes.Size()){
if (alchemyManager.CanCookRecipe(recipes[i]) ==
0){
GameplayFactsAdd("tutorial_alch_has_ings
", /* NOP */, /* NOP */);
break;
}
i += 1;
}
delete alchemyManager;
}
/* NOP */;
}
private final function ProcessCraftingTutorialFact(){
var craftingManager : W3CraftingManager;
var i : Int32;
var witcher : W3PlayerWitcher;
var craftsmanComponent : W3CraftsmanComponent;
var recipes : array<CName>;
var craftMenu : CR4CraftingMenu;
var craftingError : ECraftingException;

witcher = GetWitcherPlayer();
if (witcher){
GameplayFactsRemove("tutorial_craft_has_ings");
recipes = witcher.GetCraftingSchematicsNames();
craftMenu = (CR4CraftingMenu)(CR4MenuBase)theGame.GetGui
Manager().GetRootMenu().GetLastChild();
craftsmanComponent = craftMenu.GetCraftsmanComponent();
if (!craftsmanComponent){
return;
}
craftingManager = new W3CraftingManager in this;
craftingManager.Init(craftsmanComponent);
i = 0;
while (i < recipes.Size()){
craftingError = craftingManager.CanCraftSchemati
c(recipes[i], true);
if (craftingError != 4){
GameplayFactsAdd("tutorial_craft_has_ing
s", /* NOP */, /* NOP */);
break;
}
i += 1;
}
delete craftingManager;
}
/* NOP */;
}
private final function ProcessRunesFact(){
var i : Int32;
var weapons : array<SItemUniqueId>;
var item : SItemUniqueId;
if (thePlayer.inv.GetItemQuantityByTag('WeaponUpgrade', /* NOP *
/) > 0){
if (GetWitcherPlayer().GetItemEquippedOnSlot(1, item)){
weapons.PushBack(item);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(2, item)){
weapons.PushBack(item);
}
i = 0;
while (i < weapons.Size()){
if (thePlayer.inv.GetItemEnhancementSlotsCount(w
eapons[i]) > 0){
if (thePlayer.inv.GetItemEnhancementCoun
t(weapons[i]) < thePlayer.inv.GetItemEnhancementSlotsCount(weapons[i])){
GameplayFactsAdd("tut_runes_star
t", /* NOP */, /* NOP */);
return;
}
}
i += 1;
}
}
/* NOP */;
}
private final function ArmorUpgradesTutorialCheck(){
var i : Int32;
var items : array<SItemUniqueId>;
var item : SItemUniqueId;
if (thePlayer.inv.GetItemQuantityByTag('ArmorUpgrade', /* NOP */

) > 0){
if (GetWitcherPlayer().GetItemEquippedOnSlot(3, item)){
items.PushBack(item);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(4, item)){
items.PushBack(item);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(5, item)){
items.PushBack(item);
}
if (GetWitcherPlayer().GetItemEquippedOnSlot(6, item)){
items.PushBack(item);
}
i = 0;
while (i < items.Size()){
if (thePlayer.inv.GetItemEnhancementSlotsCount(i
tems[i]) > 0){
if (thePlayer.inv.GetItemEnhancementCoun
t(items[i]) < thePlayer.inv.GetItemEnhancementSlotsCount(items[i])){
GameplayFactsAdd("tut_arm_upg_st
art", /* NOP */, /* NOP */);
return;
}
}
i += 1;
}
}
/* NOP */;
}
public function OnOpenedMenu(menuName : CName) : Bool{
LogTutorial("UIHandler: OnOpenedMenu <<" + menuName + ">>");
OnMenuOpened(menuName);
/* NOP */;
}
public function OnClosingMenu(menuName : CName) : Bool{
var stateName : CName;
var i : Int32;
LogTutorial("UIHandler: OnClosingMenu <<" + menuName + ">>");
if (menuName == 'PopupMenu' && IsNameValid(postponedUnregistered
Menu)){
HandleListeners(postponedUnregisteredMenu, true);
postponedUnregisteredMenu = 'None';
} else {
HandleListeners(menuName, false);
}
OnMenuClosing(menuName);
stateName = GetCurrentStateName();
if (IsNameValid(stateName)){
i = 0;
while (i < listeners.Size()){
if (listeners[i].tutorialStateName == stateName
&& listeners[i].abortOnMenuClose && listeners[i].menuName == menuName || 'Common
Menu' == menuName){
GotoState('Tutorial_Idle', /* NOP */, /*
NOP */);
break;
}
i += 1;
}
}

/* NOP */;
}
public function OnClosedMenu(menuName : CName) : Bool{
LogTutorial("UIHandler: OnClosedMenu <<" + menuName + ">>");
OnMenuClosed(menuName);
/* NOP */;
}
public function OnMenuClosing(menuName : CName) : Bool{
}
public function OnMenuClosed(menuName : CName) : Bool{
}
public function OnMenuOpening(menuName : CName) : Bool{
}
public function OnMenuOpened(menuName : CName) : Bool{
}
public function OnTutorialClosed(hintName : CName, closedByParentMenu :
Bool) : Bool{
}
public final function LockLeaveMenu(locked : Bool){
var guiManager : CR4GuiManager;
var rootMenu : CR4CommonMenu;
guiManager = theGame.GetGuiManager();
if (guiManager && guiManager.IsAnyMenu()){
rootMenu = (CR4CommonMenu)guiManager.GetRootMenu();
if (rootMenu){
rootMenu.SetLockedInMenu(locked);
}
}
/* NOP */;
}
public final function LockCloseUIPanels(lock : Bool){
var guiManager : CR4GuiManager;
var rootMenu : CR4CommonMenu;
guiManager = theGame.GetGuiManager();
if (guiManager && guiManager.IsAnyMenu()){
rootMenu = (CR4CommonMenu)guiManager.GetRootMenu();
if (rootMenu){
rootMenu.SetLockedInHub(lock);
}
}
/* NOP */;
}
}
statemachine class W3Poster extends CGameplayEntity{
public editable var description : String;
public editable var camera : CEntityTemplate;
public editable var factOnRead : String;
public editable var blendInTime : Float;
public editable var blendOutTime : Float;
public editable var fadeStartDuration : Float;
public editable var fadeEndDuration : Float;
public editable var focusModeHighlight : EFocusModeVisibility;
private var restoreUsableItemAtEnd : Bool;
public var spawnedCamera : CStaticCamera;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
GotoStateAuto();
SetFocusModeVisibility(focusModeHighlight, /* NOP */);
/* NOP */;
}

public function OnInteraction(actionName : String, activator : CEntity)


: Bool{
if (activator == thePlayer){
if (spawnedCamera){
RemoveTimer('DestroyCamera', /* NOP */);
spawnedCamera.Destroy();
}
PushState('PosterObserved');
}
/* NOP */;
}
public function LeavePosterPreview(){
GotoStateAuto();
/* NOP */;
}
public function GetDescription() : String{
return description;
/* NOP */;
}
public function OnStartedObservingPoster(){
var itemL : W3UsableItem;
thePlayer.SetActivePoster(this);
if (thePlayer.IsHoldingItemInLHand()){
itemL = thePlayer.GetCurrentlyUsedItemL();
if (itemL){
itemL.SetVisibility(false);
itemL.DestroyAllEffects();
itemL.OnHidden(thePlayer);
restoreUsableItemAtEnd = true;
}
}
theInput.StoreContext('EMPTY_CONTEXT');
thePlayer.BlockAction(21, 'Poster', /* NOP */, /* NOP */, /* NOP
*/);
thePlayer.SetHideInGame(true);
spawnedCamera = (CStaticCamera)theGame.CreateEntity(camera, GetW
orldPosition(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
spawnedCamera.deactivationDuration = blendOutTime;
spawnedCamera.activationDuration = blendInTime;
spawnedCamera.fadeStartDuration = fadeStartDuration;
spawnedCamera.fadeEndDuration = fadeEndDuration;
spawnedCamera.Run();
theGame.RequestMenu('PosterMenu', this);
/* NOP */;
}
public function OnEndedObservingPoster(){
thePlayer.RemoveActivePoster();
spawnedCamera.Stop();
AddTimer('RestoreGameplay', blendOutTime, false, /* NOP */, /* N
OP */, true, /* NOP */);
/* NOP */;
}
public timer function DestroyCamera(optional dt : Float, optional id : I
nt32){
spawnedCamera.Destroy();
/* NOP */;
}
public timer function RestoreGameplay(optional dt : Float, optional id :
Int32){

var cameraTimeout : Float;


var itemL : W3UsableItem;
cameraTimeout = spawnedCamera.fadeEndDuration + blendOutTime;
thePlayer.SetHideInGame(false);
theInput.RestoreContext('EMPTY_CONTEXT', false);
thePlayer.UnblockAction(21, 'Poster');
AddTimer('DestroyCamera', cameraTimeout, false, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
if (factOnRead != "" && !FactsDoesExist(factOnRead)){
FactsAdd(factOnRead, 1, -1);
}
if (restoreUsableItemAtEnd){
itemL = thePlayer.GetCurrentlyUsedItemL();
if (itemL){
itemL.SetVisibility(true);
itemL.OnUsed(thePlayer);
restoreUsableItemAtEnd = false;
}
}
/* NOP */;
}
}
import abstract class SR4PlayerTargetingPrecalcs{
//NULL type for playerRadius
//NULL type for cameraHeading
//NULL type for playerPosition
//NULL type for playerHeading
//NULL type for playerHeadingVector
//NULL type for cameraPosition
//NULL type for cameraDirection
//NULL type for cameraHeadingVector
}
import abstract class SR4PlayerTargetingIn{
//NULL type for playerHasBlockingBuffs
//NULL type for lookAtDirection
//NULL type for isDiving
//NULL type for canFindTarget
//NULL type for isHardLockedToTarget
//NULL type for isActorLockedToTarget
//NULL type for isCameraLockedToTarget
//NULL type for actionCheck
//NULL type for actionInput
//NULL type for isInCombatAction
//NULL type for isLAxisReleased
//NULL type for isLAxisReleasedAfterCounter
//NULL type for isLAxisReleasedAfterCounterNoCA
//NULL type for lastAxisInputIsMovement
//NULL type for isAiming
//NULL type for isSwimming
//NULL type for isThreatened
//NULL type for isCombatMusicEnabled
//NULL type for isPcModeEnabled
//NULL type for shouldUsePcModeTargeting
//NULL type for bufferActionType
//NULL type for orientationTarget
//NULL type for coneDist
//NULL type for findMoveTargetDist
//NULL type for cachedRawPlayerHeading

//NULL
//NULL
//NULL
//NULL
//NULL
//NULL
//NULL
//NULL

type
type
type
type
type
type
type
type

for
for
for
for
for
for
for
for

combatActionHeading
rawPlayerHeadingVector
moveTarget
aimingTarget
displayTarget
finishableEnemies
hostileEnemies
defaultSelectionWeights

}
import abstract class SR4PlayerTargetingOut{
//NULL type for target
//NULL type for result
//NULL type for confirmNewTarget
//NULL type for forceDisableUpdatePosition
}
import abstract class Color{
//NULL type for Red
//NULL type for Green
//NULL type for Blue
}
state CR4PlayerStateAimThrow in CR4Player extends CR4PlayerStateExtendedMovable{
protected var camera : CCustomCamera;
protected var fovVel : Float;
protected var initialPitch : Float;
private var cachedHorTimeout : Float;
private var cachedVerTimeout : Float;
private var prevState : CName;
private var followTarget : Bool;
private var followPitch : Float;
public var isRotating : Bool;
public function OnEnterState(prevStateName : CName) : Bool{
prevState = prevStateName;
super.OnEnterState(prevStateName);
CreateNoSaveLock();
theInput.SetContext('ThrowHold');
parent.lastAxisInputIsMovement = true;
parent.SetCombatIdleStance(1.000000);
camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
theGame.GetGameCamera().ChangePivotDistanceController('AimThrow'
);
theGame.GetGameCamera().ChangePivotRotationController('AimThrow'
);
camera.EnableScreenSpaceCorrection(false);
OnEnterStateExtended();
/* NOP */;
SearchForTargets();
cachedHorTimeout = camera.GetManualRotationHorTimeout();
cachedVerTimeout = camera.GetManualRotationVerTimeout();
camera.SetManualRotationHorTimeout(1.000000);
camera.SetManualRotationVerTimeout(1.000000);
thePlayer.BreakPheromoneEffect();
/* NOP */;
}
public function OnEnterStateExtended(){
if (!parent.inv.IsItemCrossbow(parent.GetSelectedItemId())){
virtual_parent.SetIsThrowingItemWithAim(true);
} else {

initialPitch = ProcessInitialPitch();
}
virtual_parent.OnDelayOrientationChange();
/* NOP */;
}
public entry function SearchForTargets(){
var target : CActor;
var thrownEntity : CThrowable;
thrownEntity = (CThrowable)EntityHandleGet(parent.thrownEntityHa
ndle);
target = parent.GetTarget();
while (true){
if (target){
if ((CNewNPC)target.IsShielded(thePlayer)){
(CNewNPC)target.OnIncomingProjectile(tru
e);
}
}
if (thrownEntity && (W3Petard)thrownEntity){
parent.ProcessCanAttackWhenNotInCombatBomb();
} else {
parent.rangedWeapon.ProcessCanAttackWhenNotInCom
bat();
}
Sleep(0.100000);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.SetIsShootingFriendly(false);
parent.playerAiming.StopAiming();
camera.fov = 60.000000;
camera.EnableScreenSpaceCorrection(true);
parent.rawPlayerHeading = theCamera.GetCameraHeading();
virtual_parent.RemoveCustomOrientationTarget('AimThrow');
thePlayer.SetBehaviorVariable('walkInPlace', 0.000000, /* NOP */
);
camera.SetManualRotationHorTimeout(cachedHorTimeout);
camera.SetManualRotationVerTimeout(cachedVerTimeout);
if (nextStateName == 'PlayerDialogScene'){
parent.OnRangedForceHolster(true, true, /* NOP */);
}
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnDelayOrientationChangeOff() : Bool{
virtual_parent.AddCustomOrientationTarget(4, 'AimThrow');
parent.SetSlideTarget(NULL);
virtual_parent.OnDelayOrientationChangeOff();
/* NOP */;
}
private function ProcessInitialPitch() : Float{
var angles : EulerAngles;
var aimingTarget : CActor;
var pos : Vector;
var playerpos : Vector;
aimingTarget = (CActor)parent.GetDisplayTarget();
playerpos = parent.GetWorldPosition();
playerpos.Z += 1.800000;
pos = MatrixGetTranslation(aimingTarget.GetBoneWorldMatrixByInde

x(aimingTarget.GetTorsoBoneIndex()));
pos.Z += 0.250000;
angles = VecToRotation(pos - playerpos);
return -angles.Pitch;
/* NOP */;
}
public function OnGameCameraTick(moveData : SCameraMovementData, dt : Fl
oat) : Bool{
var cameraOffset : Float;
var currRotation : EulerAngles;
var angledist : Float;
var rawToCamHeadingDiff : Float;
var camOffsetVec : Vector;
var heading : Float;
var followPosition : Vector;
var enableAimingLookAt : Bool;
theGame.GetGameCamera().ChangePivotRotationController('AimThrow'
);
theGame.GetGameCamera().ChangePivotPositionController('Default')
;
theGame.GetGameCamera().ChangePivotDistanceController('AimThrow'
);
moveData.pivotRotationController = theGame.GetGameCamera().GetAc
tivePivotRotationController();
moveData.pivotDistanceController = theGame.GetGameCamera().GetAc
tivePivotDistanceController();
moveData.pivotPositionController = theGame.GetGameCamera().GetAc
tivePivotPositionController();
moveData.pivotPositionController.SetDesiredPosition(parent.GetWo
rldPosition(), 100.000000);
if (parent.inv.IsItemCrossbow(parent.GetSelectedItemId())){
if (parent.GetPlayerCombatStance() == 1){
followTarget = false;
}
rawToCamHeadingDiff = AngleDistance(parent.rawPlayerHead
ing, moveData.pivotRotationValue.Yaw);
if (!parent.bLAxisReleased){
if (rawToCamHeadingDiff > -45 && rawToCamHeading
Diff < 45){
camOffsetVec.X = 0.500000;
camOffsetVec.Y = 0.500000;
camOffsetVec.Z = 0.180000;
} else if (rawToCamHeadingDiff >= 45 && rawToCam
HeadingDiff < 135){
camOffsetVec.X = 0.550000;
camOffsetVec.Y = 0.550000;
camOffsetVec.Z = 0.150000;
} else if (rawToCamHeadingDiff <= -45 && rawToCa
mHeadingDiff > -135){
camOffsetVec.X = 0.550000;
camOffsetVec.Y = 0.450000;
camOffsetVec.Z = 0.180000;
} else {
camOffsetVec.X = 0.550000;
camOffsetVec.Y = 0.600000;
camOffsetVec.Z = 0.200000;
}
} else {
camOffsetVec.X = 0.430000;
camOffsetVec.Y = 0.520000;

camOffsetVec.Z = 0.220000;
}
if (parent.rangedWeapon && parent.rangedWeapon.GetCurren
tStateName() == 'State_WeaponReload'){
camOffsetVec.X = 0.430000;
camOffsetVec.Y = 0.100000;
camOffsetVec.Z = 0.220000;
}
DampVectorSpring(moveData.cameraLocalSpaceOffset, moveDa
ta.cameraLocalSpaceOffsetVel, Vector(camOffsetVec.X, camOffsetVec.Y, camOffsetVe
c.Z), 0.200000, dt);
parent.oTCameraOffset = 17.000000;
parent.oTCameraPitchOffset = 5.000000;
heading = VecHeading(theCamera.GetCameraDirection());
angledist = AngleDistance(heading, VecHeading(thePlayer.
GetHeadingVector()));
if (angledist < -50 || angledist > 25){
isRotating = true;
parent.SetCustomRotation('Crossbow', heading, 0.
000000, 0.400000, false);
if (parent.bLAxisReleased){
thePlayer.SetBehaviorVariable('playerSpe
edForOverlay', 0.100000, /* NOP */);
thePlayer.SetBehaviorVariable('walkInPla
ce', 1.000000, /* NOP */);
}
} else if (isRotating && angledist < -35 || angledist >
5){
parent.SetCustomRotation('Crossbow', heading, 0.
000000, 0.400000, false);
if (parent.bLAxisReleased){
thePlayer.SetBehaviorVariable('playerSpe
edForOverlay', 0.100000, /* NOP */);
thePlayer.SetBehaviorVariable('walkInPla
ce', 1.000000, /* NOP */);
}
} else {
thePlayer.SetBehaviorVariable('walkInPlace', 0.0
00000, /* NOP */);
isRotating = false;
}
} else {
parent.oTCameraOffset = 32.000000;
parent.oTCameraPitchOffset = 0.000000;
initialPitch = -15.000000;
heading = VecHeading(theCamera.GetCameraDirection());
angledist = AngleDistance(heading, VecHeading(thePlayer.
GetHeadingVector()));
if (moveData.pivotRotationValue.Pitch < -20){
enableAimingLookAt = false;
}
if (enableAimingLookAt){
parent.SetBehaviorVariable('enableAimingLookAt',
1.000000, /* NOP */);
} else {
parent.SetBehaviorVariable('enableAimingLookAt',
0.000000, /* NOP */);
}
if (moveData.pivotRotationValue.Pitch < -20){
parent.SetCustomRotation('BombThrow', heading -

45, 0.000000, 0.100000, false);


} else if (isRotating || angledist < 30 || angledist > 6
0){
isRotating = true;
parent.SetCustomRotation('BombThrow', heading 45, 0.000000, 0.400000, false);
parent.SetBehaviorVariable('enableAimingLookAt',
1.000000, /* NOP */);
}
if (angledist > 40 && angledist < 50){
isRotating = false;
}
camOffsetVec.X = -20 - moveData.pivotRotationValue.Pitch
/ 100 - 0.850000 * -1;
camOffsetVec.X = ClampF(camOffsetVec.X, 0.650000, 0.8500
00);
camOffsetVec.Y = -20 - moveData.pivotRotationValue.Pitch
/ -8 - 0.500000 * -1;
camOffsetVec.Y = ClampF(camOffsetVec.Y, 0.500000, 0.9000
00);
camOffsetVec.Z = -20 - moveData.pivotRotationValue.Pitch
/ -74.070000 * -1;
camOffsetVec.Z = ClampF(camOffsetVec.Z, 0.000000, 0.2700
00);
}
if (parent.GetDisplayTarget()){
followPosition = GetAimPosition();
}
if (!parent.GetPlayerCombatStance() == 1 && parent.delayOrientat
ionChange || !parent.bRAxisReleased){
currRotation = VecToRotation(theCamera.GetCameraDirectio
n());
moveData.pivotRotationController.SetDesiredPitch(moveDat
a.pivotRotationValue.Pitch, 3.000000);
} else {
moveData.pivotRotationController.SetDesiredPitch(initial
Pitch, 3.000000);
}
if (parent.delayOrientationChange){
if (parent.GetPlayerCombatStance() == 1 && parent.GetDis
playTarget()){
moveData.pivotRotationController.SetDesiredHeadi
ng(VecHeading(followPosition - theCamera.GetCameraPosition()), 1.000000);
} else {
moveData.pivotRotationController.SetDesiredHeadi
ng(moveData.pivotRotationValue.Yaw, 1.000000);
}
} else if (thePlayer.bRAxisReleased && parent.GetDisplayTarget()
&& followTarget){
moveData.pivotRotationController.SetDesiredHeading(VecHe
ading(followPosition - theCamera.GetCameraPosition()), 1.000000);
moveData.pivotRotationController.SetDesiredPitch(Process
InitialPitch(), 1.000000);
} else {
moveData.pivotRotationController.SetDesiredHeading(moveD
ata.pivotRotationValue.Yaw, 1.000000);
}
moveData.pivotDistanceController.SetDesiredDistance(1.000000, /*
NOP */);
moveData.pivotPositionController.offsetZ = 1.500000;

DampVectorSpring(moveData.cameraLocalSpaceOffset, moveData.camer
aLocalSpaceOffsetVel, Vector(camOffsetVec.X, camOffsetVec.Y, camOffsetVec.Z), 0.
200000, dt);
return true;
/* NOP */;
}
private function GetAimPosition() : Vector{
var aimVector : Vector;
var target : CGameplayEntity;
var angles : EulerAngles;
target = parent.GetDisplayTarget();
aimVector = target.GetWorldPosition();
angles = VecToRotation(aimVector - parent.GetWorldPosition());
followPitch = -angles.Pitch;
return aimVector;
/* NOP */;
}
public function OnStateCanUpdateExplorationSubstates() : Bool{
return true;
/* NOP */;
}
public function OnCheckDiving() : Bool{
return prevState == 'Swimming';
/* NOP */;
}
public function OnIsCameraUnderwater() : Bool{
return prevState == 'Swimming';
/* NOP */;
}
}
state CR4PlayerStateSkating in CR4Player extends CR4PlayerStateExtendedMovable{
public function OnEnterState(prevStateName : CName) : Bool{
theInput.SetContext('Skating');
parent.SetBIsCombatActionAllowed(false);
SkatingInit();
LogSkating("on enter skating");
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
parent.SetBIsCombatActionAllowed(true);
LogSkating("on leave skating");
/* NOP */;
}
public entry function SkatingInit(){
var behGraphNames : array<CName>;
parent.LockEntryFunction(true);
parent.BlockAllActions('InitSkating', true, /* NOP */, true, /*
NOP */, /* NOP */, /* NOP */);
behGraphNames.PushBack('Skating');
parent.ActivateAndSyncBehaviors(behGraphNames, /* NOP */);
parent.BlockAllActions('InitSkating', false, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
parent.SetBehaviorVariable('playerWeapon', 1, /* NOP */);
parent.SetBehaviorVariable('playerWeaponForOverlay', 1, /* NOP *
/);
parent.SetBehaviorVariable('SelectedWeapon', 0, /* NOP */);
parent.SetBehaviorVariable('WeaponType', 0, /* NOP */);
parent.SetRequiredItems('None', 'steelsword');

parent.ProcessRequiredItems(/* NOP */);


parent.SetOrientationTarget(0);
parent.ClearCustomOrientationInfoStack();
parent.SetBIsInputAllowed(true, 'SkatingInit');
parent.WaitForBehaviorNodeDeactivation('StateChangeComplete', 0.
100000);
parent.LockEntryFunction(false);
/* NOP */;
}
}
import abstract class CR4LocomotionDirectController{
//NULL type for agent
//NULL type for moveSpeed
}
import abstract class SPredictionInfo{
//NULL type for turnAngle
}
import struct CHorsePrediction{
import public final function CollectPredictionInfo(entity : CNode, testD
istance : Float, direction : Float, checkWater : Bool) : SPredictionInfo;
}
import struct CFocusModeController{
public saved var detectedCluesTags : array<CName>;
public var medallionIntensity : W3FocusModeEffectIntensity;
public var dimmingClue : W3MonsterClue;
public var blockVibrations : Bool;
public var focusAreaIntensity : Float;
public const var effectFadeTime : Float;
public const var controllerVibrationFactor : Float;
public const var controllerVibrationDuration : Float;
public var activationSoundTimer : Float;
public const var activationSoundInterval : Float;
public var fastFocusTimer : Float;
public var activateAfterFastFocus : Bool;
public const var fastFocusDuration : Float;
private var isUnderwaterFocus : Bool;
private var isInCombat : Bool;
private var isNight : Bool;
public var focusInteractionsInterval : Float;
import public final function SetActive(active : Bool);
import public final function IsActive() : Bool;
import public final function GetIntensity() : Float;
import public final function EnableVisuals(enable : Bool, desaturation :
Float, highlightBoos : Float);
import public final function EnableExtendedVisuals(enable : Bool, fadeTi
me : Float);
import public final function SetDimming(enable : Bool);
import public final function SetFadeParameters(NearFadeDistance : Float,
FadeDistanceRange : Float, dimmingTIme : Float, dimmingSpeed : Float);
import public final function SetSoundClueEventNames(entity : CGameplayEn
tity, eventStart : CName, eventStop : CName) : Bool;
import public final function ActivateScentClue(entity : CEntity, effectN
ame : CName, duration : Float);
import public final function DeactivateScentClue(entity : CEntity);
public function Activate(){
if (!ActivateFastFocus(true)){

ActivateInternal();
}
/* NOP */;
}
public function GetBlockVibrations() : Bool{
return blockVibrations;
/* NOP */;
}
public function SetBlockVibrations(newState : Bool){
blockVibrations = newState;
/* NOP */;
}
public function ActivateFastFocus(activate : Bool) : Bool{
activateAfterFastFocus = activate;
if (activate && fastFocusDuration > 0.000000){
fastFocusTimer = fastFocusDuration;
return true;
}
return false;
/* NOP */;
}
private function ActivateInternal(){
if (super.IsActive() || !CanUseFocusMode()){
return;
}
super.SetActive(true);
super.EnableVisuals(true, /* NOP */, /* NOP */);
super.EnableExtendedVisuals(true, effectFadeTime);
thePlayer.BlockAction(10, 'focus', /* NOP */, /* NOP */, /* NOP
*/);
/* NOP */;
if (theGame.GetEngineTimeAsSeconds() - activationSoundTimer > ac
tivationSoundInterval){
activationSoundTimer = theGame.GetEngineTimeAsSeconds();
theSound.SoundEvent('expl_focus_start');
}
/* NOP */;
}
public function Deactivate(){
var hud : CR4ScriptedHud;
var module : CR4HudModuleInteractions;
ActivateFastFocus(false);
if (!super.IsActive()){
return;
}
super.SetActive(false);
super.EnableVisuals(false, /* NOP */, /* NOP */);
super.EnableExtendedVisuals(false, effectFadeTime);
if (isUnderwaterFocus){
isUnderwaterFocus = false;
if (isInCombat){
theSound.LeaveGameState(20);
} else {
theSound.LeaveGameState(5);
}
} else if (isNight){
theSound.LeaveGameState(4);
} else {
theSound.LeaveGameState(3);
}

isInCombat = false;
isUnderwaterFocus = false;
isNight = false;
thePlayer.UnblockAction(10, 'focus');
/* NOP */;
theSound.SoundEvent('expl_focus_stop');
if (theGame.GetEngineTimeAsSeconds() - activationSoundTimer > ac
tivationSoundInterval){
activationSoundTimer = theGame.GetEngineTimeAsSeconds();
theSound.SoundEvent('expl_focus_stop_sfx');
}
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
module = (CR4HudModuleInteractions)hud.GetHudModule("Int
eractionsModule");
if (module){
module.RemoveAllFocusInteractionIcons();
}
}
/* NOP */;
}
public function CanUseFocusMode() : Bool{
var stateName : CName;
if (theGame && theGame.IsDialogOrCutscenePlaying()){
return false;
}
if (thePlayer){
stateName = thePlayer.GetCurrentStateName();
return stateName == 'Exploration' || stateName == 'Swimm
ing' || stateName == 'HorseRiding' || stateName == 'Sailing' || stateName == 'Sa
ilingPassive' && thePlayer.IsActionAllowed(19);
}
return false;
/* NOP */;
}
public function Init(){
medallionIntensity = new W3FocusModeEffectIntensity in this;
medallionIntensity.Init(0);
dimmingClue = NULL;
focusAreaIntensity = 0.000000;
/* NOP */;
}
public function DeInit(){
var i : Int32;
var size : Int32;
delete medallionIntensity;
medallionIntensity = NULL;
/* NOP */;
}
public function OnGameStarted() : Bool{
Init();
super.SetFadeParameters(10.000000, 30.000000, 16.000000, 40.0000
00);
/* NOP */;
}
public function OnGameEnded() : Bool{
detectedCluesTags.Clear();
DeInit();
/* NOP */;
}

public function OnTick(timeDelta : Float) : Bool{


var desiredAudioState : ESoundGameState;
var focusModeIntensity : Float;
if (fastFocusTimer > 0.000000){
fastFocusTimer -= timeDelta;
if (fastFocusTimer < 0.000000){
fastFocusTimer = 0.000000;
if (activateAfterFastFocus){
activateAfterFastFocus = false;
ActivateInternal();
}
}
}
if (super.IsActive()){
if (CanUseFocusMode()){
isInCombat = false;
isUnderwaterFocus = thePlayer.OnIsCameraUnderwat
er();
if (isUnderwaterFocus){
isInCombat = thePlayer.ShouldEnableComba
tMusic();
if (isInCombat){
desiredAudioState = 20;
} else {
desiredAudioState = 5;
}
} else {
isNight = theGame.envMgr.IsNight();
if (isNight){
desiredAudioState = 4;
} else {
desiredAudioState = 3;
}
}
if (theSound.GetCurrentGameState() != desiredAud
ioState){
theSound.EnterGameState(desiredAudioStat
e);
}
} else {
Deactivate();
}
}
focusModeIntensity = super.GetIntensity();
UpdateMedallion(focusModeIntensity);
/* NOP */;
}
public function SetDimmingForClue(clue : W3MonsterClue){
dimmingClue = clue;
super.SetDimming(true);
/* NOP */;
}
public function OnFocusModeDimmingFinished(timeDelta : Float) : Bool{
if (dimmingClue){
dimmingClue.OnDimmingFinished();
dimmingClue = NULL;
}
/* NOP */;
}
public function UseControllerVibration(focusModeIntensity : Float) : Boo

l{
return focusAreaIntensity > 0.000000 && focusModeIntensity < 1.0
00000 && controllerVibrationFactor > 0.000000 && thePlayer.GetCurrentStateName()
== 'Exploration';
/* NOP */;
}
public function UpdateMedallion(focusModeIntensity : Float){
var intensity : Float;
intensity = focusAreaIntensity;
if (UseControllerVibration(focusModeIntensity)){
theGame.VibrateController(0, intensity * 1.000000 - focu
sModeIntensity * controllerVibrationFactor, controllerVibrationDuration);
focusAreaIntensity = 0.000000;
}
if (medallionIntensity){
if (medallionIntensity.ValueChanged()){
intensity = MaxF(intensity, medallionIntensity.G
etValue(/* NOP */));
}
medallionIntensity.Reset();
}
GetWitcherPlayer().GetMedallion().SetInstantIntensity(intensity)
;
GetWitcherPlayer().GetMedallion().SetFocusModeFactor(1.000000 focusModeIntensity);
/* NOP */;
}
public function SetMedallionIntensity(entity : CEntity, distance : Float
, intensity : Float){
if (medallionIntensity){
medallionIntensity.Update(entity, distance, intensity);
}
/* NOP */;
}
public function SetFocusAreaIntensity(intensity : Float){
focusAreaIntensity = intensity;
/* NOP */;
}
public function ReusableClueDetected(clue : W3MonsterClue){
var i : Int32;
var j : Int32;
var tags : array<CName>;
tags = clue.GetTags();
i = 0;
while (i < tags.Size()){
j = detectedCluesTags.FindFirst(tags[i]);
if (j == -1){
detectedCluesTags.PushBack(tags[i]);
theGame.GetGlobalEventsManager().OnScriptedEvent
(1, 0, tags[i]);
}
i += 1;
}
/* NOP */;
}
public function WasReusableClueDetected(tag : CName) : Bool{
return detectedCluesTags.FindFirst(tag) != -1;
/* NOP */;
}
public function ResetClue(tag : CName, removeFacts : Bool, leaveVisible

: Bool){
var nodes : array<CNode>;
var clue : W3MonsterClue;
var i : Int32;
var size : Int32;
if (tag == 'None'){
LogQuest("CFocusModeController.ResetClue: empty tag!");
return;
}
theGame.GetNodesByTag(tag, nodes);
size = nodes.Size();
i = 0;
while (i < size){
clue = (W3MonsterClue)nodes[i];
if (clue){
clue.ResetClue(removeFacts, leaveVisible);
}
i += 1;
}
i = detectedCluesTags.FindFirst(tag);
if (i != -1){
detectedCluesTags.Erase(i);
}
/* NOP */;
}
public function UpdateFocusInteractions(deltaTime : Float){
var entities : array<CGameplayEntity>;
var size : Int32;
var i : Int32;
var focusComponent : CFocusActionComponent;
var hud : CR4ScriptedHud;
var module : CR4HudModuleInteractions;
var actionName : CName;
if (super.IsActive()){
focusInteractionsInterval -= deltaTime;
if (focusInteractionsInterval < 0){
hud = (CR4ScriptedHud)theGame.GetHud();
module = (CR4HudModuleInteractions)hud.GetHudMod
ule("InteractionsModule");
module.InvalidateAllFocusInteractionIcons();
focusInteractionsInterval = module.GetFocusInter
actionUpdateInterval();
FindGameplayEntitiesInRange(entities, thePlayer,
module.GetFocusInteractionRadius(), 1000, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
size = entities.Size();
i = 0;
while (i < size){
if (entities[i].CanShowFocusInteractionI
con()){
actionName = entities[i].GetFocu
sActionName();
if (IsNameValid(actionName)){
module.AddFocusInteracti
onIcon(entities[i], actionName);
}
}
i += 1;
}
}

}
/* NOP */;
}
}
import struct CGameplayFXSurfacePost{
import public final function IsActive() : Bool;
import public final function AddSurfacePostFXGroup(position : Vector, fa
deInTime : Float, activeTime : Float, fadeOutTime : Float, range : Float, type :
Int32);
}
import abstract class CQuestBehaviorSyncGraphSocket{
}
import abstract class CQuestBehaviorCtrlBlock{
}
import abstract class CQuestBehaviorEventBlock{
}
import abstract class CQuestBehaviorNotificationBlock{
}
import abstract class CQuestPlayAnimationBlock{
}
import abstract class CManageSwitchBlock{
}
import abstract class CQuestChangeWorldBlock{
}
import abstract class CQuestManageFastTravelBlock{
}
import abstract class CQuestUsedFastTravelCondition{
}
import abstract class CQCIsOpenedMenu{
}
import abstract class CQCIsOpenedJournalEntry{
}
import abstract class CQCIsSentCustomUIEvent{
}
import abstract class CQCIsObjectiveHighlighted{
}
import abstract class CQuestUICondition{
}
import abstract class CTaggedActorsListener{
}
import struct IQuestCombatManagerBaseBlock{
public function GetBlockName() : String{
return "PLZ_REDEFINE_MA_NAME";

/* NOP */;
}
public function GetAITree() : IAITree{
return NULL;
/* NOP */;
}
}
import abstract class CQuestSpawnVehicleBlock{
}
import abstract class CQuestSpawnNotStreamedBoatBlock{
}
import abstract class CQuestResetScriptedActionsBlock{
}
import struct CR4CreateEntityHelper{
}
state W3HorseComponentStateIdle in W3HorseComponent extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.InternalSetSpeedMultiplier(1);
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
super.OnLeaveState(nextStateName);
/* NOP */;
}
public function OnMountStarted(entity : CEntity, vehicleSlot : EVehicleS
lot) : Bool{
parent.OnMountStarted(entity, vehicleSlot);
/* NOP */;
}
public function OnMountFinished(entity : CEntity) : Bool{
parent.OnMountFinished(entity);
if (entity == thePlayer){
parent.PushState('Exploration');
}
/* NOP */;
}
public function OnTick(dt : Float) : Bool{
if (parent.ShouldTickInIdle()){
parent.OnTick(dt);
}
/* NOP */;
}
}
state W3BoatSpawnerStateIdle in W3BoatSpawner extends CScriptableState{
}
import abstract class CDaytimeCondition{
}
import abstract class CPlayerLevelCondition{
}
import abstract class CSpawnConditionFact{

}
import struct CR4ReactionManager{
//NULL type for rainReactionsEnabled
public function SetRainReactionEnabled(enabled : Bool){
rainReactionsEnabled = enabled;
/* NOP */;
}
}
import struct CComboDefinition{
import public final function CreateComboAspect(comboAspect : CName) : CC
omboAspect;
import public final function DeleteComboAspect(comboAspect : CName) : Bo
ol;
import public final function FindComboAspect(comboAspect : CName) : CCom
boAspect;
}
import struct CComboPlayer{
import public final function
import public final function
import public final function
import public final function
: CEntity) : Bool;
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
import public final function
, rot : Float, deltaRotationPolicy :
}

PlayAttack(comboAspect : CName) : Bool;


StopAttack();
PlayHit() : Bool;
Build(definition : CComboDefinition, entity
Init() : Bool;
Deinit();
Update(timeDelta : Float) : Bool;
Pause();
Unpause();
IsPaused() : Bool;
PauseSlider();
UnpauseSlider();
IsSliderPaused() : Bool;
SetDurationBlend(timeDelta : Float);
UpdateTarget(attackId : Int32, pos : Vector
Bool, useRotationScaling : Bool);

import abstract class SComboAttackCallbackInfo{


//NULL type for outShouldRotate
//NULL type for inAspectName
//NULL type for inStringAttackCounter
//NULL type for outRotateToEnemyAngle
//NULL type for outSlideToPosition
//NULL type for outShouldTranslate
//NULL type for outDistance
//NULL type for outDirection
//NULL type for inGlobalAttackCounter
//NULL type for outAttackType
//NULL type for outLeftString
//NULL type for inAttackId
}
import struct CR4HumanoidCombatComponent{
import public final function UpdateSoundInfo();
import public final function GetSoundTypeIdentificationForBone(boneIndex
: Int32) : CName;
import public final function GetBoneClosestToEdge(a : Vector, b : Vector
, preciseSearch : Bool) : Int32;

import public final function GetDefaultSoundInfoMapping() : SSoundInfoMa


pping;
}
import abstract class SSoundInfoMapping{
//NULL type for isDefault
//NULL type for soundTypeIdentification
}
import abstract class SCameraAnimationDefinition{
//NULL type for animation
//NULL type for priority
//NULL type for blendIn
//NULL type for blendOut
//NULL type for weight
//NULL type for speed
//NULL type for additive
//NULL type for reset
//NULL type for loop
}
import abstract class SCameraMovementData{
//NULL type for pivotRotationValue
//NULL type for pivotRotationController
//NULL type for pivotDistanceController
//NULL type for pivotPositionController
//NULL type for cameraLocalSpaceOffset
//NULL type for cameraLocalSpaceOffsetVel
//NULL type for pivotRotationVelocity
//NULL type for pivotPositionValue
//NULL type for pivotPositionVelocity
//NULL type for pivotDistanceValue
//NULL type for pivotDistanceVelocity
}
import abstract class ICustomCameraBaseController{
//NULL type for controllerName
}
import struct CCustomCameraRopePPC{
}
import abstract class CCustomCameraPlayerPPC{
}
import abstract class CCustomCameraDefaultPRC{
}
import abstract class CCustomCameraDefaultPDC{
}
import abstract class CCustomCameraAdditivePDC{
}
import abstract class CCustomCameraSimplePositionController{
}
import abstract class CTrailerCameraPositionController{
}

import struct ICustomCameraScriptedPivotPositionController{


protected function ControllerActivate(out currentOffset : Float){
}
protected function ControllerDeactivate(){
}
protected function ControllerUpdate(out currentPosition : Vector, out cu
rrentVelocity : Vector, out timeDelta : Float){
}
protected function ControllerSetDesiredPosition(out position : Vector, o
ut mult : Float){
}
}
import struct ICustomCameraScriptedPivotRotationController{
protected function ControllerActivate(out currentRotation : EulerAngles)
{
}
protected function ControllerDeactivate(){
}
protected function ControllerUpdate(out currentRotation : EulerAngles, o
ut currentVelocity : EulerAngles, out timeDelta : Float){
}
protected function ControllerSetDesiredYaw(out yaw : Float, out mult : F
loat){
}
protected function ControllerSetDesiredPitch(out pitch : Float, out mult
: Float){
}
protected function ControllerRotateHorizontal(out right : Bool, out mult
: Float){
}
protected function ControllerRotateVertical(out up : Bool, out mult : Fl
oat){
}
protected function ControllerStopRotating(){
}
protected function ControllerGetRotationDelta() : EulerAngles{
}
protected function ControllerUpdateInput(out movedHorizontal : Bool, out
movedVertical : Bool){
}
}
import struct ICustomCameraScriptedPivotDistanceController{
protected function ControllerActivate(out currentDistance : Float){
}
protected function ControllerDeactivate(){
}
protected function ControllerUpdate(out currentDistance : Float, out cur
rentVelocity : Float, out timeDelta : Float){
}
protected function ControllerSetDesiredDistance(out dist : Float, out mu
lt : Float){
}
}
import struct ICustomCameraScriptedPositionController{
protected function ControllerUpdate(moveData : SCameraMovementData, time
Delta : Float){
moveData.pivotPositionController.Update(moveData.pivotPositionVa

lue, moveData.pivotPositionVelocity, timeDelta);


moveData.pivotRotationController.Update(moveData.pivotRotationVa
lue, moveData.pivotRotationVelocity, timeDelta);
moveData.pivotDistanceController.Update(moveData.pivotDistanceVa
lue, moveData.pivotDistanceVelocity, timeDelta);
/* NOP */;
}
protected function ControllerSetPosition(out position : Vector){
}
protected function ControllerSetRotation(out rotation : EulerAngles){
}
protected function ControllerGetPosition() : Vector{
}
protected function ControllerGetRotation() : EulerAngles{
}
}
import struct ICustomCameraScriptedCurveSetPivotPositionController{
import protected final function FindCurve(curveName : CName) : CCurve;
}
import struct ICustomCameraScriptedCurveSetPivotRotationController{
import protected final function FindCurve(curveName : CName) : CCurve;
}
import struct ICustomCameraScriptedCurveSetPivotDistanceController{
import protected final function FindCurve(curveName : CName) : CCurve;
}
import struct ICustomCameraScriptedCurveSetPositionController{
import protected final function FindCurve(curveName : CName) : CCurve;
}
import abstract class CCustomCameraOutdoorCollisionController{
}
import abstract class CCustomCameraAutoAvoidanceCollisionController{
}
import abstract class CCombatCameraPositionController{
}
import struct CDamageData{
public var isActionMelee : Bool;
//NULL type for customHitReactionRequested
//NULL type for additiveHitReactionAnimRequested
//NULL type for processedDmg
}
import abstract class SProcessedDamage{
//NULL type for vitalityDamage
//NULL type for essenceDamage
//NULL type for moraleDamage
//NULL type for staminaDamage
}
import struct CR4GuiManager{
private var lastOpenedCommonMenuName : CName;
private var isColorBlindMode : Bool;
public saved var displayedObjectivesGUID : array<CGUID>;

public saved var UISavedData : array<SUISavedData>;


private var signoutOccurred : Bool;
private var signInChangeInProgress : Bool;
private var isDuringFirstStartup : Bool;
private var ignoreControllerDisconnectionEvents : Bool;
private var controllerDisconnected : Bool;
public var potalConfirmationPending : Bool;
private var pendingPortalConfirmationPauseParam : Bool;
public var mouseCursorRequestStack : Int32;
private var tutHideCounter : Int32;
private var tutForcedhideCounter : Int32;
protected var guiSceneController : CR4GuiSceneController;
protected var hudEventController : CR4HudEventController;
public saved var NewestItems : array<SItemUniqueId>;
public saved var GlossaryEntries : array<SGlossaryEntry>;
public saved var AlchemyEntries : array<SGlossaryEntry>;
public saved var CraftingEntries : array<SGlossaryEntry>;
public saved var SkillsEntries : array<ESkill>;
public saved var MappinEntries : array<SMappinEntry>;
private var bUsePortal : Bool;
private var bUsePortalAnswered : Bool;
private var horseUnmountFeedbackActive : Bool;
private var hideMessageRequestId : Int32;
private var bKinectMessageAlreadyShown : Bool;
private var m_cachedHold : Bool;
private var m_cachedHold_gpadKeyCode : Int32;
private var m_cachedHold_kbKeyCode : Int32;
private var m_cachedHold_label : String;
private var m_cachedHold_holdDuration : Float;
private var m_cachedHold_intName : CName;
private var inGameConfigBufferedWrapper : CInGameConfigBufferedWrapper;
public var lastMessageData : W3MessagePopupData;
import public final function IsAnyMenu() : Bool;
import public final function GetRootMenu() : CR4Menu;
import public final function GetPopup(popupName : CName) : CR4Popup;
import public final function GetPopupList(popupNames : array<CName>);
import public final function SendCustomUIEvent(eventName : CName);
import public final function PlayFlashbackVideoAsync(videoFile : String,
looped : Bool);
import public final function CancelFlashbackVideo();
import public final function SetSceneEntityTemplate(template : CEntityTe
mplate, animationName : CName);
import public final function ApplyAppearanceToSceneEntity(appearanceName
: CName);
import public final function UpdateSceneEntityItems(items : array<CName>
);
import public final function SetSceneCamera(cameraPosition : Vector, cam
eraRotation : EulerAngles);
import public final function SetupSceneCamera(lookAtPos : Vector, camera
Rotation : EulerAngles, distance : Float, fov : Float);
import public final function SetEntityTransform(position : Vector, rotat
ion : EulerAngles, scale : Vector);
import public final function SetSceneEnvironmentAndSunPosition(envDef :
CEnvironmentDefinition, sunRotation : EulerAngles);
import public final function EnableScenePhysics(enable : Bool);
import public final function SetBackgroundTexture(texture : CResource);
public function OnGameStart(newOrRestored : Bool) : Bool{
var ingameMenu : CR4IngameMenu;
ingameMenu = (CR4IngameMenu)theGame.GetGuiManager().GetRootMenu(
);

if (newOrRestored){
hideMessageRequestId = -1;
lastOpenedCommonMenuName = 'None';
displayedObjectivesGUID.Clear();
UISavedData.Clear();
NewestItems.Clear();
GlossaryEntries.Clear();
SkillsEntries.Clear();
MappinEntries.Clear();
AlchemyEntries.Clear();
CraftingEntries.Clear();
tutHideCounter = 0;
tutForcedhideCounter = 0;
m_cachedHold = false;
}
/* NOP */;
}
public
}
public
}
public
}
public
}
public
Wrapper{

function OnGameEnd() : Bool{


function OnWorldStart(newOrRestored : Bool) : Bool{
function OnWorldEnd() : Bool{
function OnFailedCreateMenu() : Bool{
function GetInGameConfigBufferedWrapper() : CInGameConfigBuffered
if (!inGameConfigBufferedWrapper){
inGameConfigBufferedWrapper = new CInGameConfigBufferedW

rapper in this;
inGameConfigBufferedWrapper.inGameConfig = theGame.GetIn
GameConfigWrapper();
}
return inGameConfigBufferedWrapper;
/* NOP */;
}
protected function FinalizeConfigBuffer(keepValues : Bool){
var buffer : CInGameConfigBufferedWrapper;
var menuBase : CR4MenuBase;
var ingameMenu : CR4IngameMenu;
var hud : CR4ScriptedHud;
buffer = GetInGameConfigBufferedWrapper();
if (buffer.buffer.Size() > 0){
if (keepValues){
buffer.ClearBuffer();
theGame.SaveUserSettings();
} else {
buffer.UndoAndFlushBuffer();
theGame.SaveUserSettings();
menuBase = (CR4MenuBase)super.GetRootMenu();
if (menuBase){
ingameMenu = (CR4IngameMenu)menuBase.Get
SubMenu();
if (ingameMenu){
ingameMenu.ReopenMenu();
}
}
}
}
hud = (CR4ScriptedHud)theGame.GetHud();

if (hud){
hud.RefreshHudConfiguration();
}
/* NOP */;
}
public function GetLockedControlScheme() : ELockedControlScheme{
var inGameConfigWrapper : CInGameConfigWrapper;
var configValue : ELockedControlScheme;
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
configValue = inGameConfigWrapper.GetVarValue('Hidden', 'LockCon
trolScheme');
return configValue;
/* NOP */;
}
public function GetCommonMenu() : CR4CommonMenu{
return (CR4CommonMenu)super.GetRootMenu();
/* NOP */;
}
public function GetSceneController() : CR4GuiSceneController{
if (!guiSceneController){
guiSceneController = new CR4GuiSceneController in this;
}
return guiSceneController;
/* NOP */;
}
public function GetHudEventController() : CR4HudEventController{
if (!hudEventController){
hudEventController = new CR4HudEventController in this;
}
return hudEventController;
/* NOP */;
}
public function OnEnteredStartScreen(){
var startScreenMenu : CR4StartScreenMenu;
ignoreControllerDisconnectionEvents = true;
if (signInChangeInProgress){
HideUserDialog(UMID_SigningInPleaseWait);
startScreenMenu = (CR4StartScreenMenu)super.GetRootMenu(
);
if (startScreenMenu){
startScreenMenu.setWaitingText();
}
}
UpdateSignoutMessagePending();
/* NOP */;
}
public function OnEnteredConfigScreen(){
SetIsDuringFirstStartup(false);
ignoreControllerDisconnectionEvents = false;
/* NOP */;
}
public function OnEnteredMainMenu(){
ignoreControllerDisconnectionEvents = false;
if (controllerDisconnected){
ShowControllerDisconnectionMessage();
}
/* NOP */;
}
public function OnControllerDisconnected(){
if (theGame.isUserSignedIn()){

controllerDisconnected = true;
ShowControllerDisconnectionMessage();
theGame.ToggleUserProfileManagerInputProcessing(true);
}
/* NOP */;
}
public function OnControllerReconnected(){
HideUserDialog(UMID_ControllerDisconnected);
controllerDisconnected = false;
/* NOP */;
}
public function ShowControllerDisconnectionMessage(){
var title : String;
var message : String;
if (!ignoreControllerDisconnectionEvents){
switch(theGame.GetPlatform()){
case 2:
title = "msg_controller_disconnected_title_PS4";
message = "error_message_no_controller_ps4";
break;
case 1:
title = "msg_controller_disconnected_title_X1";
message = "error_message_no_controller_x1";
break;
default:
title = "msg_controller_disconnected_title";
message = "error_message_no_controller_x1";
}
ShowUserDialog(UMID_ControllerDisconnected, title, messa
ge, 3);
}
/* NOP */;
}
public function OnSignInStarted(){
var startScreenMenu : CR4StartScreenMenu;
signInChangeInProgress = true;
startScreenMenu = (CR4StartScreenMenu)super.GetRootMenu();
if (startScreenMenu){
startScreenMenu.setWaitingText();
} else {
ShowUserDialog(UMID_SigningInPleaseWait, "", "panel_plea
se_wait", 3);
}
/* NOP */;
}
public function OnSignInCancelled(){
var menuBase : CR4MenuBase;
var startScreenMenu : CR4StartScreenMenu;
var ingameMenu : CR4IngameMenu;
signInChangeInProgress = false;
HideUserDialog(UMID_SigningInPleaseWait);
theGame.ToggleUserProfileManagerInputProcessing(true);
menuBase = (CR4MenuBase)super.GetRootMenu();
startScreenMenu = (CR4StartScreenMenu)menuBase;
if (startScreenMenu){
startScreenMenu.setStandardtext();
UpdateSignoutMessagePending();
} else {
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu();
if (ingameMenu){

ingameMenu.OnUserSignInCancelled();
}
}
/* NOP */;
}
public function OnSignIn(){
var menuBase : CR4MenuBase;
var startScreenMenu : CR4StartScreenMenu;
var ingameMenu : CR4IngameMenu;
signInChangeInProgress = false;
menuBase = (CR4MenuBase)super.GetRootMenu();
startScreenMenu = (CR4StartScreenMenu)menuBase;
if (startScreenMenu){
startScreenMenu.startFade();
} else {
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu();
if (ingameMenu){
ingameMenu.OnUserSignIn();
}
HideUserDialog(UMID_SigningInPleaseWait);
theGame.ToggleUserProfileManagerInputProcessing(true);
}
/* NOP */;
}
public function OnSignOut(){
signoutOccurred = true;
theGame.ToggleUserProfileManagerInputProcessing(true);
/* NOP */;
}
public function ShowKinectMessage(){
var kinectRecognizer : CR4KinectSpeechRecognizerListenerScriptPr
oxy;
var localisedMessage : String;
if (theGame.GetPlatform() != 1){
return;
}
if (bKinectMessageAlreadyShown){
return;
}
kinectRecognizer = theGame.GetKinectSpeechRecognizer();
if (!kinectRecognizer.IsSupported()){
localisedMessage = GetLocStringByKeyExt("error_message_k
inect_not_supported");
bKinectMessageAlreadyShown = true;
ShowNotification(localisedMessage, 9000);
theSound.SoundEvent("gui_global_denied");
}
/* NOP */;
}
public function SetIsDuringFirstStartup(firstStartup : Bool){
isDuringFirstStartup = firstStartup;
/* NOP */;
}
public function UpdateSignoutMessagePending(){
if (signoutOccurred && !isDuringFirstStartup && !signInChangeInP
rogress){
signoutOccurred = false;
ShowUserDialog(UMID_SignedOut, "", "error_message_sign_i
n_change", 0);
}

/* NOP */;
}
public function TryQuitGame(){
ShowUserDialog(UMID_QuitGameMessage, "", "error_message_exit_gam
e", 1);
/* NOP */;
}
public function OnUserSettingsCorrupted(){
ShowUserDialog(UMID_UserSettingsCorrupted, "", "error_message_se
ttings_corrupted", 0);
/* NOP */;
}
public function OnLoadingFailed(sres : ESessionRestoreResult, missingCon
tent : array<CName>){
var specialMsgText : String;
var i : Int32;
var contentKey : String;
var len : Int32;
var len_minus_one : Int32;
var htmlNewline : String;
htmlNewline = "&#10;";
if (sres == 1){
if (theGame.GetPlatform() == 2){
ShowUserDialog(UMID_LoadingFailed, "", "error_me
ssage_damaged_save_PS4", 0);
} else {
ShowUserDialog(UMID_LoadingFailed, "", "error_me
ssage_damaged_save", 0);
}
} else if (sres == 3){
ShowUserDialog(UMID_LoadingFailed, "", "error_message_ne
w_game_not_ready", 0);
} else if (sres == 4 || sres == 5){
if (theGame.GetPlatform() == 2){
ShowUserDialog(UMID_LoadingFailed, "", "error_me
ssage_damaged_save_unavailable_ps4", 0);
} else {
ShowUserDialog(UMID_LoadingFailed, "", "error_me
ssage_damaged_save_unavailable", 0);
}
} else if (sres == 2){
if (theGame.GetPlatform() == 2){
specialMsgText = GetLocStringByKeyExt("error_mes
sage_loadsave_missing_dlc_error_ps4");
} else {
specialMsgText = GetLocStringByKeyExt("error_mes
sage_loadsave_missing_dlc_error_x1");
}
specialMsgText += ":" + htmlNewline;
len = missingContent.Size();
len_minus_one = len - 1;
i = 0;
while (i < len){
contentKey = "content_name_" + NameToString(miss
ingContent[i]);
specialMsgText += GetLocStringByKeyExt(contentKe
y);
if (i < len_minus_one){
specialMsgText += htmlNewline;
}

i += 1;
}
ShowUserDialogAdv(UMID_LoadingFailed, "", specialMsgText
, false, 0);
} else if (sres == 6){
ShowUserDialog(UMID_LoadingFailed, "", "error_save_from_
newer_version", 0);
} else {
ShowUserDialog(UMID_LoadingFailed, "", "error_message_da
maged_save_unavailable", 0);
}
/* NOP */;
}
public function OnCorruptedSaveDataOverwrite(){
ShowUserDialog(UMID_CorruptedSaveDataOverwrite, "", "error_messa
ge_corrupted_save_overwrite", 1);
/* NOP */;
}
public function HideTutorial(value : Bool, forced : Bool){
var tutorialPopupRef : CR4TutorialPopup;
if (!forced){
if (value){
tutHideCounter = tutHideCounter + 1;
} else {
tutHideCounter = tutHideCounter - 1;
}
} else if (value){
tutForcedhideCounter = tutForcedhideCounter + 1;
} else {
tutForcedhideCounter = tutForcedhideCounter - 1;
}
tutorialPopupRef = (CR4TutorialPopup)super.GetPopup('TutorialPop
up');
if (tutorialPopupRef){
tutorialPopupRef.SetInvisible(tutHideCounter > 0, tutFor
cedhideCounter > 0);
}
/* NOP */;
}
public function GetTutorialVisibility(hidden : Bool, forceHidden : Bool)
{
hidden = tutHideCounter > 0;
forceHidden = tutForcedhideCounter > 0;
/* NOP */;
}
public function OnCanSkipChanged(newVal : Bool) : Bool{
var hud : CR4ScriptedHud;
var dialogModule : CR4HudModuleDialog;
/* NOP */;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
dialogModule = hud.GetDialogModule();
if (dialogModule){
dialogModule.UpdateCanBeSkipped(newVal);
}
}
/* NOP */;
}
public function OnSwipe(swipe : Int32) : Bool{
var outKeys : array<CName>;

var lastMenuName : CName;


var allowOpen : Bool;
/* NOP */;
if (theGame.IsBlackscreenOrFading() || theGame.IsDialogOrCutscen
ePlaying()){
return false;
}
if (swipe == 2 || swipe == 3){
if (thePlayer.IsActionAllowed(15)){
theGame.RequestMenuWithBackground('MapMenu', 'Co
mmonMenu', /* NOP */);
}
}
/* NOP */;
}
public function SetLastOpenedCommonMenuName(menuName : CName){
lastOpenedCommonMenuName = menuName;
/* NOP */;
}
public function GetLastOpenedCommonMenuName() : CName{
return lastOpenedCommonMenuName;
/* NOP */;
}
public function FindDisplayedObjectiveGUID(guid : CGUID) : Bool{
if (displayedObjectivesGUID.FindFirst(guid) > -1){
return true;
}
return false;
/* NOP */;
}
public function SaveDisplayedObjectiveGUID(guid : CGUID){
if (!FindDisplayedObjectiveGUID(guid)){
displayedObjectivesGUID.PushBack(guid);
}
/* NOP */;
}
public function UpdateUISavedData(panelName : CName, openedCategories :
array<CName>, selectedTag : CName, selectedModule : Int32, gridItem : SItemUniqu
eId, slotID : Int32){
var i : Int32;
i = 0;
while (i < UISavedData.Size()){
if (UISavedData[i].panelName == panelName){
UISavedData[i].openedCategories = openedCategori
es;
UISavedData[i].selectedTag = selectedTag;
UISavedData[i].gridItem = gridItem;
UISavedData[i].slotID = slotID;
UISavedData[i].selectedModule = selectedModule;
/* NOP */;
return;
}
i += 1;
}
AddNewUISavedData(panelName, openedCategories, selectedTag, sele
ctedModule, gridItem, slotID);
/* NOP */;
}
public function AddNewUISavedData(panelName : CName, openedCategories :
array<CName>, selectedTag : CName, selectedModule : Int32, gridItem : SItemUniqu

eId, slotID : Int32){


var newUIData : SUISavedData;
newUIData.panelName = panelName;
newUIData.openedCategories = openedCategories;
newUIData.selectedTag = selectedTag;
newUIData.gridItem = gridItem;
newUIData.slotID = slotID;
newUIData.selectedModule = selectedModule;
/* NOP */;
UISavedData.PushBack(newUIData);
/* NOP */;
}
public function RemoveUISavedData(panelName : CName){
var i : Int32;
i = 0;
while (i < UISavedData.Size()){
if (UISavedData[i].panelName == panelName){
UISavedData.Erase(i);
return;
}
i += 1;
}
/* NOP */;
}
public function GetUISavedData(panelName : CName) : SUISavedData{
var i : Int32;
var emptyUIData : SUISavedData;
i = 0;
while (i < UISavedData.Size()){
if (UISavedData[i].panelName == panelName){
/* NOP */;
return UISavedData[i];
}
i += 1;
}
return emptyUIData;
/* NOP */;
}
public function GetHideMessageRequestId() : Int32{
return hideMessageRequestId;
/* NOP */;
}
public function ShowUserDialog(messageId : Int32, title : String, messag
e : String, type : EUserDialogButtons){
if (messageId != UMID_ControllerDisconnected){
theGame.ToggleUserProfileManagerInputProcessing(false);
}
ShowProgressDialog(messageId, title, message, true, type, -1, 0,
'None');
/* NOP */;
}
public function ShowUserDialogAdv(messageId : Int32, title : String, mes
sage : String, localizationNeeded : Bool, type : EUserDialogButtons){
if (messageId != UMID_ControllerDisconnected){
theGame.ToggleUserProfileManagerInputProcessing(false);
}
ShowProgressDialog(messageId, title, message, localizationNeeded
, type, -1, 0, 'None');
/* NOP */;
}

public function ShowProgressDialog(messageId : Int32, title : String, me


ssage : String, localizationNeeded : Bool, type : EUserDialogButtons, progressVa
lue : Float, progressType : EUserMessageProgressType, progressTag : CName){
var messageData : W3MessagePopupData;
var messagePopupRef : CR4MessagePopup;
/* NOP */;
messageData = new W3MessagePopupData in this;
messageData.titleText = title;
messageData.messageText = message;
messageData.autoLocalize = localizationNeeded;
messageData.messageId = messageId;
messageData.progress = progressValue;
messageData.progressType = progressType;
messageData.progressTag = progressTag;
if (messageId == UMID_ControllerDisconnected){
messageData.priority = 1;
} else {
messageData.priority = 0;
}
messageData.setActionsByType(type);
lastMessageData = messageData;
messagePopupRef = (CR4MessagePopup)super.GetPopup('MessagePopup'
);
if (!messagePopupRef){
theGame.RequestPopup('MessagePopup', messageData);
hideMessageRequestId = -1;
} else {
messagePopupRef.ShowMessage(messageData);
}
/* NOP */;
}
public function UpdateUserDialogProgress(messageId : Int32, progressValu
e : Float){
var messagePopupRef : CR4MessagePopup;
messagePopupRef = (CR4MessagePopup)super.GetPopup('MessagePopup'
);
if (messagePopupRef && messagePopupRef.GetCurrentMsgId() == mess
ageId){
messagePopupRef.DisplayProgressBar(progressValue, 1);
}
/* NOP */;
}
public function HideUserDialog(messageId : Int32){
var messagePopupRef : CR4MessagePopup;
messagePopupRef = (CR4MessagePopup)super.GetPopup('MessagePopup'
);
if (messagePopupRef){
messagePopupRef.HideMessage(messageId);
} else {
hideMessageRequestId = messageId;
}
/* NOP */;
}
public function UserDialogCallback(messageId : Int32, actionId : EUserMe
ssageAction){
var ingameMenu : CR4IngameMenu;
var menuBase : CR4MenuBase;
var hud : CR4ScriptedHud;
var initData : W3MenuInitData;
var numSaveSlots : Int32;

var saveGames : array<SSavegameInfo>;


var currentSave : SSavegameInfo;
var numSavesAdded : Int32;
var i : Int32;
if (messageId == UMID_QuitGameMessage && actionId == 0){
theGame.RequestEndGame();
} else if (messageId == UMID_MissingContentOnLoadError){
menuBase = (CR4MenuBase)super.GetRootMenu();
if (menuBase){
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu(
);
if (ingameMenu){
ingameMenu.HandleLoadGameFailed();
}
}
} else if (messageId == UMID_MissingContentOnDialogError){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.HandleDialogClosed(messageId);
}
} else if (messageId == UMID_LoadingFailedDamagedData){
menuBase = (CR4MenuBase)super.GetRootMenu();
ingameMenu = (CR4IngameMenu)menuBase.GetSubMenu();
if (ingameMenu){
ingameMenu.OnSaveLoadingFailed();
}
} else if (messageId == UMID_ForceManualSaveWindow){
if (actionId == 0){
initData = new W3MenuInitData in this;
initData.setDefaultState('SaveGame');
theGame.RequestMenu('IngameMenu', initData);
} else {
HideUserDialog(messageId);
}
} else if (messageId == UMID_GraphicsRefreshing){
FinalizeConfigBuffer(actionId == 0);
}
/* NOP */;
theGame.OnUserDialogCallback(messageId, actionId);
theGame.ToggleUserProfileManagerInputProcessing(true);
/* NOP */;
}
public function OnMessageHiding(messageId : Int32){
var ingameMenu : CR4IngameMenu;
var menuBase : CR4MenuBase;
if (messageId == UMID_GraphicsRefreshing){
FinalizeConfigBuffer(false);
}
/* NOP */;
}
public function ShowNotification(messageText : String, duration : Float)
{
var notificationData : W3NotificationData;
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (!overlayPopupRef){
notificationData = new W3NotificationData in this;
notificationData.messageText = messageText;
notificationData.duration = duration;

theGame.RequestPopup('OverlayPopup', notificationData);
} else {
overlayPopupRef.ShowNotification(messageText, duration);
}
/* NOP */;
}
public function RequestMouseCursor(showMouseCursor : Bool){
var notificationData : W3NotificationData;
var overlayPopupRef : CR4OverlayPopup;
if (showMouseCursor){
mouseCursorRequestStack += 1;
} else if (mouseCursorRequestStack > 0){
mouseCursorRequestStack -= 1;
}
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.RequestMouseCursor(showMouseCursor);
}
/* NOP */;
}
public function ForceHideMouseCursor(value : Bool){
var notificationData : W3NotificationData;
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.ForceHideMouseCursor(value);
}
/* NOP */;
}
public function ShowLoadingIndicator(){
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.ShowLoadingIndicator();
}
/* NOP */;
}
public function HideLoadingIndicator(immediateHide : Bool){
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.HideLoadingIndicator(immediateHide);
}
/* NOP */;
}
public function ShowSavingIndicator(){
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.ShowSavingIndicator();
}
/* NOP */;
}
public function HideSavingIndicator(immediateHide : Bool){
var overlayPopupRef : CR4OverlayPopup;

overlayPopupRef = (CR4OverlayPopup)super.GetPopup('OverlayPopup'
);
if (overlayPopupRef){
overlayPopupRef.HideSavingIndicator(immediateHide);
}
/* NOP */;
}
public function UpdateDismountAvailable(blocked : Bool){
if (!blocked){
if (horseUnmountFeedbackActive){
EnableHudHoldIndicator_Impl(137, 0, "panel_input
_action_horsedismount", 0.400000, 'HorseDismount');
}
} else {
DisableHudHoldIndicator_Impl();
}
/* NOP */;
}
public function EnableHudHoldIndicator(gpadKeyCode : Int32, kbKeyCode :
Int32, label : String, holdDuration : Float, intName : CName){
var processRequest : Bool;
processRequest = true;
if (label == "panel_input_action_horsedismount"){
horseUnmountFeedbackActive = true;
if (!thePlayer.IsActionAllowed(22)){
processRequest = false;
}
}
if (processRequest){
EnableHudHoldIndicator_Impl(gpadKeyCode, kbKeyCode, labe
l, holdDuration, intName);
}
/* NOP */;
}
public function EnableHudHoldIndicator_Impl(gpadKeyCode : Int32, kbKeyCo
de : Int32, label : String, holdDuration : Float, intName : CName){
var hud : CR4ScriptedHud;
var intrModule : CR4HudModuleInteractions;
var result : Bool;
result = false;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
intrModule = (CR4HudModuleInteractions)hud.GetHudModule(
"InteractionsModule");
if (intrModule){
result = true;
intrModule.EnableHoldIndicator(gpadKeyCode, kbKe
yCode, label, holdDuration, intName);
}
}
if (!result){
m_cachedHold = true;
m_cachedHold_gpadKeyCode = gpadKeyCode;
m_cachedHold_kbKeyCode = kbKeyCode;
m_cachedHold_label = label;
m_cachedHold_holdDuration = holdDuration;
m_cachedHold_intName = intName;
} else {
m_cachedHold = false;
}

/* NOP */;
}
public function checkHoldIndicator(){
if (m_cachedHold){
EnableHudHoldIndicator_Impl(m_cachedHold_gpadKeyCode, m_
cachedHold_kbKeyCode, m_cachedHold_label, m_cachedHold_holdDuration, m_cachedHol
d_intName);
m_cachedHold = false;
}
/* NOP */;
}
public function DisableHudHoldIndicator(){
horseUnmountFeedbackActive = false;
DisableHudHoldIndicator_Impl();
/* NOP */;
}
private function DisableHudHoldIndicator_Impl(){
var hud : CR4ScriptedHud;
var intrModule : CR4HudModuleInteractions;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
intrModule = (CR4HudModuleInteractions)hud.GetHudModule(
"InteractionsModule");
intrModule.DisableHoldIndicator();
}
/* NOP */;
}
public function RegisterNewItem(item : SItemUniqueId){
var _inv : CInventoryComponent;
var tags : array<CName>;
if (GetWitcherPlayer()){
_inv = GetWitcherPlayer().GetInventory();
if (_inv.IsIdValid(item)){
if (_inv.ItemHasTag(item, 'NoShow')){
return;
}
if (NewestItems.Size() > 2){
NewestItems.Erase(2);
}
NewestItems.Insert(0, item);
}
}
/* NOP */;
}
public function GetNewestItems() : array<SItemUniqueId>{
return NewestItems;
/* NOP */;
}
public function RegisterNewGlossaryEntry(newEntry : CJournalBase, panelN
ame : CName, tag : CName){
var glossaryEntry : SGlossaryEntry;
if (GlossaryEntries.Size() > 2){
GlossaryEntries.Erase(2);
}
glossaryEntry.tag = tag;
glossaryEntry.panelName = panelName;
glossaryEntry.newEntry = newEntry;
GlossaryEntries.Insert(0, glossaryEntry);
/* NOP */;
}

public function GetNewGlossaryEntries() : array<SGlossaryEntry>{


return GlossaryEntries;
/* NOP */;
}
public function RegisterNewAlchemyEntry(tag : CName){
var alchemyEntry : SGlossaryEntry;
if (AlchemyEntries.Size() > 2){
AlchemyEntries.Erase(2);
}
alchemyEntry.tag = tag;
alchemyEntry.panelName = 'panel_title_alchemy';
AlchemyEntries.Insert(0, alchemyEntry);
/* NOP */;
}
public function GetNewAlchemyEntries() : array<SGlossaryEntry>{
return AlchemyEntries;
/* NOP */;
}
public function RegisterNewSkillEntry(newSkill : ESkill){
if (SkillsEntries.Size() > 2){
SkillsEntries.Erase(2);
}
SkillsEntries.Insert(0, newSkill);
/* NOP */;
}
public function GetNewSkillsEntries() : array<ESkill>{
return SkillsEntries;
/* NOP */;
}
public function RegisterNewMappinEntry(newMappin : CName, newMappinType
: CName){
var mappinEntry : SMappinEntry;
var hasTheSameName : Bool;
if (MappinEntries.Size() > 2){
MappinEntries.Erase(2);
}
mappinEntry.newMappin = newMappin;
if (newMappin != newMappinType){
mappinEntry.newMappinType = newMappinType;
hasTheSameName = false;
} else {
hasTheSameName = true;
mappinEntry.newMappinType = 'None';
}
if (MappinEntries.FindFirst(mappinEntry) == -1 || hasTheSameName
){
MappinEntries.Insert(0, mappinEntry);
}
/* NOP */;
}
public function GetNewMappinEntries() : array<SMappinEntry>{
return MappinEntries;
/* NOP */;
}
public function SetUsePortal(usePortal : Bool, popupAnswered : Bool){
bUsePortal = usePortal;
bUsePortalAnswered = popupAnswered;
/* NOP */;
}
public function GetUsePortal() : Bool{

return bUsePortal;
/* NOP */;
}
public function GetUsePortalAnswered() : Bool{
return bUsePortalAnswered;
/* NOP */;
}
public function ResumePortalConfirmationPendingMessage(){
if (potalConfirmationPending){
potalConfirmationPending = false;
DisplayPortalConfirmationPopup(pendingPortalConfirmation
PauseParam, true);
}
/* NOP */;
}
public function DisplayPortalConfirmationPopup(pause : Bool, allowInMenu
: Bool){
var popupData : W3PortalConfirmationPopupData;
if (super.IsAnyMenu() && !allowInMenu){
potalConfirmationPending = true;
pendingPortalConfirmationPauseParam = pause;
} else {
popupData = new W3PortalConfirmationPopupData in this;
popupData.SetMessageTitle(GetLocStringByKeyExt("panel_po
rtal_confirmation_popup_title"));
popupData.SetMessageText(GetLocStringByKeyExt("panel_por
tal_confirmation_popup_text"));
popupData.BlurBackground = true;
popupData.PauseGame = pause;
theGame.RequestMenu('PopupMenu', popupData);
}
/* NOP */;
}
public function IsModalPopupShown() : Bool{
var messagePopupRef : CR4MessagePopup;
var tutorialPopupRef : CR4TutorialPopup;
messagePopupRef = (CR4MessagePopup)super.GetPopup('MessagePopup'
);
tutorialPopupRef = (CR4TutorialPopup)super.GetPopup('TutorialPop
up');
return messagePopupRef || tutorialPopupRef;
/* NOP */;
}
public function DisplayLockedSavePopup(){
if (theGame.GetPlatform() == 1){
ShowNotification(GetLocStringByKeyExt("panel_hud_message
_savelock_x1"), /* NOP */);
} else if (theGame.GetPlatform() == 2){
ShowNotification(GetLocStringByKeyExt("panel_hud_message
_savelock_ps4"), /* NOP */);
} else {
ShowNotification(GetLocStringByKeyExt("panel_hud_message
_savelock"), /* NOP */);
}
theSound.SoundEvent("gui_global_denied");
/* NOP */;
}
public function DisplayNewDlcInstalled(message : String){
ShowUserDialog(0, "", message, 0);
/* NOP */;

}
}
import struct CR4Hud{
import public final function ShowOneliner(text : String, entity : CEntit
y);
import public final function HideOneliner(entity : CEntity);
}
import abstract class CR4HudModule{
}
import struct CInGameConfigWrapper{
import public final function
ring;
import public final function
32;
import public final function
, presetIdx : Int32) : String;
import public final function
dx : Int32);
import public final function
e : CName) : String;
import public final function
e : CName) : String;
import public final function
: CName) : Int32;
import public final function
Name, optionIdx : Int32) : String;
import public final function
CName) : String;
import public final function
ame, varValue : String);
import public final function
rIdx : Int32) : CName;
import public final function
Int32;
import public final function
import public final function
import public final function
import public final function
) : CName;
import public final function
Name) : Bool;
import public final function
ame, tag : CName) : Bool;
import public final function
import public final function
import public final function
import public final function
e) : Bool;
import public final function
import public final function
}

GetGroupDisplayName(groupName : CName) : St
GetGroupPresetsNum(groupName : CName) : Int
GetGroupPresetDisplayName(groupName : CName
ApplyGroupPreset(groupName : CName, presetI
GetVarDisplayType(groupName : CName, varNam
GetVarDisplayName(groupName : CName, varNam
GetVarOptionsNum(groupName : CName, varName
GetVarOption(groupName : CName, varName : C
GetVarValue(groupCName : CName, varCName :
SetVarValue(groupName : CName, varName : CN
GetVarNameByGroupName(groupName : CName, va
GetVarsNumByGroupName(groupName : CName) :
GetGroupsNum() : Int32;
GetGroupName(groupIdx : Int32) : CName;
GetVarsNum(groupIdx : Int32) : Int32;
GetVarName(groupIdx : Int32, varIdx : Int32
IsVarVisible(groupName : CName, varName : C
DoVarHasTag(groupName : CName, varName : CN
IsTagActive(tag : CName) : Bool;
ActivateScriptTag(tag : CName);
DeactivateScriptTag(tag : CName);
DoGroupHasTag(groupName : CName, tag : CNam
IsGroupVisible(groupName : CName) : Bool;
ResetGroupToDefaults(groupName : CName);

import abstract class SMapPinConfig{


}
import struct CCommonMapManager{
private var m_destinationPinTag : CName;

private var m_debugTeleportWaypointTag : CName;


private var m_noSaveLock : Int32;
private var m_dbgShowKnownPins : Bool;
private var m_dbgShowPins : Bool;
private var m_dbgShowAllFT : Bool;
private var m_dbgAllowFT : Bool;
private var m_borderTeleportPosition : Vector;
private var m_borderTeleportRotation : EulerAngles;
private var m_lastGlobalFastTravelArea : Int32;
private var m_lastGlobalFastTravelPosition : Vector;
import public final function InitializeMinimapManager(minimapModule : CR
4HudModule);
import public final function SetHintWaypointParameters(maxRemovalDistanc
e : Float, minPlacingDistance : Float, refreshInterval : Float, pathfindingToler
ance : Float, maxCount : Int32);
import public final function OnChangedMinimapRadius(radius : Float, zoom
: Float);
import public final function IsFastTravellingEnabled() : Bool;
import public final function EnableFastTravelling(enable : Bool);
import public final function IsEntityMapPinKnown(tag : CName) : Bool;
import public final function SetEntityMapPinKnown(tag : CName, set : Boo
l);
import public final function IsEntityMapPinDiscovered(tag : CName) : Boo
l;
import public final function SetEntityMapPinDiscovered(tag : CName, set
: Bool);
import public final function IsEntityMapPinDisabled(tag : CName) : Bool;
import public final function SetEntityMapPinDisabled(tag : CName, set :
Bool);
import public final function IsQuestType(type : CName) : Bool;
import public final function ShowKnownEntities(show : Bool);
import public final function CanShowKnownEntities() : Bool;
import public final function ShowFocusClues(show : Bool);
import public final function ShowHintWaypoints(show : Bool);
import public final function AddQuestLootContainer(container : CEntity);
import public final function DeleteQuestLootContainer(container : CEntit
y);
import public final function CacheMapPins();
import public final function GetMapPinInstances(worldPath : String) : ar
ray<SCommonMapPinInstance>;
import public final function TogglePathsInfo(toggle : Bool);
import public final function ToggleQuestAgentsInfo(toggle : Bool);
import public final function ToggleShopkeepersInfo(toggle : Bool);
import public final function TogglePinsInfo(flags : Int32);
import public final function ExportGlobalMapPins();
import public final function ExportEntityMapPins();
import public final function GetAreaMapPins() : array<SAreaMapPinInfo>;
import public final function GetEntityMapPins(worldPath : String) : arra
y<SEntityMapPinInfo>;
import public final function UseMapPin(pinTag : CName, onStart : Bool) :
Bool;
import public final function UseInteriorsForQuestMapPins(use : Bool);
import public final function EnableShopkeeper(tag : CName, enable : Bool
);
import public final function EnableMapPath(tag : CName, enable : Bool, l
ineWidth : Float, segmentLength : Float, color : Color);
import public final function EnableDynamicMappin(tag : CName, enable : B
ool, type : CName, useAgents : Bool);
import public final function InvalidateStaticMapPin(entityName : CName);
import public final function ToggleUserMapPin(area : EAreaName, position

: Vector) : Bool;
import public final function GetUserMapPin(area : Int32, mapPinX : Float
, mapPinY : Float);
import public final function GetCurrentArea() : Int32;
import public final function NotifyPlayerEnteredBorder(interval : Float,
position : Vector, rotation : EulerAngles) : Int32;
import public final function NotifyPlayerExitedBorder() : Int32;
import public final function IsWorldAvailable(area : Int32) : Bool;
import public final function GetWorldContentTag(area : Int32) : CName;
import public final function GetWorldPercentCompleted(area : Int32) : In
t32;
import public final function SetPinFilterVisible(pinID : CName, visible
: Bool);
import public final function GetPinFilterVisible(pinID : CName) : Bool;
public function OnMapPinChanged() : Bool{
theGame.GetGlobalEventsManager().OnScriptedEvent(8, /* NOP */, /
* NOP */);
/* NOP */;
}
public function SetEntityMapPinDiscoveredScript(isFastTravelPoint : Bool
, tag : CName, set : Bool){
var arr1 : array<SAvailableFastTravelMapPin>;
var previouslyDiscovered : Bool;
var mapPinType : CName;
var m_guiManager : CR4GuiManager;
if (!IsNameValid(tag)){
return;
}
previouslyDiscovered = super.IsEntityMapPinDiscovered(tag);
super.SetEntityMapPinDiscovered(tag, set);
if (!previouslyDiscovered && isFastTravelPoint && set){
arr1 = GetFastTravelPoints(true, false, false, true, tru
e);
if (arr1.Size() >= 100){
theGame.GetGamerProfile().AddAchievement(47);
}
}
if (!previouslyDiscovered && set){
mapPinType = GetMappinType(tag);
if (mapPinType == 'NoticeBoard' || mapPinType == 'Notice
BoardFull'){
UpdateHud('noticeboard');
m_guiManager = theGame.GetGuiManager();
m_guiManager.RegisterNewMappinEntry('noticeboard
', 'noticeboard');
} else if (mapPinType == 'MonsterNest' || mapPinType ==
'PlaceOfPower' || mapPinType == 'TreasureHuntMappin' || mapPinType == 'SpoilsOfW
ar' || mapPinType == 'BanditCamp' || mapPinType == 'BanditCampfire' || mapPinTyp
e == 'BossAndTreasure' || mapPinType == 'Contraband' || mapPinType == 'Contraban
dShip' || mapPinType == 'RescuingTown' || mapPinType == 'DungeonCrawl'){
UpdateHud(mapPinType);
m_guiManager = theGame.GetGuiManager();
m_guiManager.RegisterNewMappinEntry(mapPinType,
mapPinType);
} else if (mapPinType == 'Entrance'){
UpdateHud('entrance');
m_guiManager = theGame.GetGuiManager();
m_guiManager.RegisterNewMappinEntry('entrance',
'entrance');
} else if (ShouldDisplayHudUpdateByType(mapPinType)){

UpdateHud(tag);
m_guiManager = theGame.GetGuiManager();
m_guiManager.RegisterNewMappinEntry(tag, mapPinT
ype);
}
}
if (!ShouldProcessTutorial('TutorialPOIAppeared') && ShouldProce
ssTutorial('TutorialPOIUncovered')){
FactsAdd("tut_uncovered_POI", /* NOP */, /* NOP */);
}
/* NOP */;
}
public function GetMappinType(tag : CName) : CName{
var i : Int32;
var mappinArray : array<SAvailableFastTravelMapPin>;
mappinArray = GetMappins(false, false);
i = 0;
while (i < mappinArray.Size()){
if (mappinArray[i].tag == tag){
return mappinArray[i].type;
}
i += 1;
}
return 'None';
/* NOP */;
}
public function GetMappins(onlyDiscovered : Bool, onlyEnabled : Bool) :
array<SAvailableFastTravelMapPin>{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
var pin : SAvailableFastTravelMapPin;
var pins : array<SAvailableFastTravelMapPin>;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
entityMapPins = super.GetEntityMapPins(areaMapPins[i].wo
rldPath);
j = 0;
while (j < entityMapPins.Size()){
if (onlyDiscovered){
if (!super.IsEntityMapPinDiscovered(enti
tyMapPins[j].entityName)){
}
} else if (onlyEnabled){
if (super.IsEntityMapPinDisabled(entityM
apPins[j].entityName)){
}
} else {
pin.tag = entityMapPins[j].entityName;
pin.type = entityMapPins[j].entityType;
pin.area = areaMapPins[i].areaType;
pins.PushBack(pin);
}
j += 1;
}
i += 1;
}
return pins;

/* NOP */;
}
public function UpdateHud(mappinTag : CName){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
hud.OnMapPinUpdate(mappinTag);
/* NOP */;
}
public function OnGameStarted(){
if (m_destinationPinTag != 'None'){
super.UseMapPin(m_destinationPinTag, false);
m_destinationPinTag = 'None';
} else if (m_debugTeleportWaypointTag != 'None'){
DebugTeleport();
}
theGame.GetLootManager().OnAreaChanged(super.GetCurrentArea());
DBG_UpdateShownFT();
DBG_UpdateShownKnownPins();
DBG_UpdateShownPins();
/* NOP */;
}
public function GetCurrentJournalArea() : Int32{
return GetCurrentJournalAreaByPosition(thePlayer.GetWorldPositio
n());
/* NOP */;
}
public function GetCurrentJournalAreaByPosition(position : Vector) : Int
32{
return GetJournalAreaByPosition(super.GetCurrentArea(), position
);
/* NOP */;
}
public function GetJournalAreaByPosition(area : Int32, position : Vector
) : Int32{
if (area == 1){
if (position.X > 970 || position.Y < 1600){
return 9;
}
} else if (area == 8){
return 4;
}
return area;
/* NOP */;
}
public function AddMapPathToMinimap(path : SMapPathInstance){
var minimapModule : CR4HudModuleMinimap2;
minimapModule = GetMinimap2Module();
if (minimapModule){
minimapModule.AddMapPath(path);
}
/* NOP */;
}
public function DeleteMapPathsFromMinimap(ids : array<Int32>){
var minimapModule : CR4HudModuleMinimap2;
minimapModule = GetMinimap2Module();
if (minimapModule){
minimapModule.DeleteMapPaths(ids);
}
/* NOP */;
}

public function NotifyPlayerEnteredInterior(areaPos : Vector, areaYaw :


Float, texture : String){
theGame.GetGuiManager().GetHudEventController().RunEvent_Minimap
Module_NotifyPlayerEnteredInterior(areaPos, areaYaw, texture);
/* NOP */;
}
public function NotifyPlayerExitedInterior(){
theGame.GetGuiManager().GetHudEventController().RunEvent_Minimap
Module_NotifyPlayerExitedInterior();
/* NOP */;
}
public function NotifyPlayerMountedBoat(){
theGame.GetGuiManager().GetHudEventController().RunEvent_Minimap
Module_NotifyPlayerMountedBoat();
/* NOP */;
}
public function NotifyPlayerDismountedBoat(){
theGame.GetGuiManager().GetHudEventController().RunEvent_Minimap
Module_NotifyPlayerDismountedBoat();
/* NOP */;
}
public function GetCustomMapPinDefinition(definitions : array<SCustomMap
PinDefinition>){
var definition : SCustomMapPinDefinition;
definitions.Clear();
/* NOP */;
}
public function GetKnowableMapPinTypes(types : array<CName>){
types.Clear();
types.PushBack('Entrance');
types.PushBack('MonsterNest');
types.PushBack('PlaceOfPower');
types.PushBack('TreasureHuntMappin');
types.PushBack('SpoilsOfWar');
types.PushBack('BanditCamp');
types.PushBack('BanditCampfire');
types.PushBack('BossAndTreasure');
types.PushBack('Contraband');
types.PushBack('ContrabandShip');
types.PushBack('RescuingTown');
types.PushBack('DungeonCrawl');
/* NOP */;
}
public function GetDiscoverableMapPinTypes(types : array<CName>){
types.Clear();
types.PushBack('RoadSign');
types.PushBack('Harbor');
types.PushBack('MonsterNest');
types.PushBack('PlaceOfPower');
types.PushBack('MagicLamp');
types.PushBack('TreasureHuntMappin');
types.PushBack('PointOfInterestMappin');
types.PushBack('Rift');
types.PushBack('Teleport');
types.PushBack('Whetstone');
types.PushBack('ArmorRepairTable');
types.PushBack('Entrance');
types.PushBack('SpoilsOfWar');
types.PushBack('BanditCamp');
types.PushBack('BanditCampfire');

types.PushBack('BossAndTreasure');
types.PushBack('Contraband');
types.PushBack('ContrabandShip');
types.PushBack('RescuingTown');
types.PushBack('DungeonCrawl');
/* NOP */;
}
public function GetDisableableMapPinTypes(regularTypes : array<CName>, d
isabledTypes : array<CName>){
regularTypes.Clear();
disabledTypes.Clear();
regularTypes.PushBack('MonsterNest');
disabledTypes.PushBack('MonsterNestDisabled');
regularTypes.PushBack('PlaceOfPower');
disabledTypes.PushBack('PlaceOfPowerDisabled');
regularTypes.PushBack('TreasureHuntMappin');
disabledTypes.PushBack('TreasureHuntMappinDisabled');
regularTypes.PushBack('SpoilsOfWar');
disabledTypes.PushBack('SpoilsOfWarDisabled');
regularTypes.PushBack('BanditCamp');
disabledTypes.PushBack('BanditCampDisabled');
regularTypes.PushBack('BanditCampfire');
disabledTypes.PushBack('BanditCampfireDisabled');
regularTypes.PushBack('BossAndTreasure');
disabledTypes.PushBack('BossAndTreasureDisabled');
regularTypes.PushBack('Contraband');
disabledTypes.PushBack('ContrabandDisabled');
regularTypes.PushBack('ContrabandShip');
disabledTypes.PushBack('ContrabandShipDisabled');
regularTypes.PushBack('RescuingTown');
disabledTypes.PushBack('RescuingTownDisabled');
regularTypes.PushBack('DungeonCrawl');
disabledTypes.PushBack('DungeonCrawlDisabled');
/* NOP */;
}
public function OnStartTeleportingPlayerToPlayableArea(position : Vector
, rotation : EulerAngles) : Bool{
m_borderTeleportPosition = position;
m_borderTeleportRotation = rotation;
thePlayer.OnStartTeleportingPlayerToPlayableArea();
/* NOP */;
}
public function GetBorderTeleportPosition() : Vector{
return m_borderTeleportPosition;
/* NOP */;
}
public function GetBorderTeleportRotation() : EulerAngles{
return m_borderTeleportRotation;
/* NOP */;
}
public function ShouldDisplayHudUpdateByType(type : CName) : Bool{
switch(type){
case 'MonsterNest':
case 'PlaceOfPower':
case 'Rift':
case 'Teleport':
case 'Whetstone':
case 'ArmorRepairTable':
case 'MagicLamp':
case 'None':

return false;
}
return true;
/* NOP */;
}
private function GetMinimap2Module() : CR4HudModuleMinimap2{
var hud : CR4ScriptedHud;
var minimapModule : CR4HudModuleMinimap2;
hud = (CR4ScriptedHud)theGame.GetHud();
if (!hud){
return NULL;
}
return (CR4HudModuleMinimap2)hud.GetHudModule("Minimap2Module");
/* NOP */;
}
public function GetAreaMappinsFileName(filePath : String){
filePath = "game\world.w2am";
/* NOP */;
}
public function GetAreaMappinsData(mappins : array<SAreaMapPinInfo>){
var i : Int32;
mappins.Clear();
FillAreaMapPinInfo(mappins, 1, 185, -190, "levels\novigrad\novig
rad.w2w", 'content4', 'map_location_novigrad', 'map_description_novigrad');
FillAreaMapPinInfo(mappins, 2, -567, 665, "levels\skellige\skell
ige.w2w", 'content5', 'map_location_skellige', 'map_description_skellige');
FillAreaMapPinInfo(mappins, 3, 1720, -1098, "levels\kaer_morhen\
kaer_morhen.w2w", 'content6', 'map_location_kaer_morhen', 'map_description_kaer_
morhen');
FillAreaMapPinInfo(mappins, 4, 797, 250, "levels\prolog_village\
prolog_village.w2w", 'content2', 'map_location_prolog_village', 'map_description
_prolog_village');
FillAreaMapPinInfo(mappins, 5, 519, 252, "levels\wyzima_castle\w
yzima_castle.w2w", 'content3', 'map_location_wyzima_castle', 'map_description_wy
zima_castle');
FillAreaMapPinInfo(mappins, 6, -9999, -9999, "levels\island_of_m
ist\island_of_mist.w2w", 'content7', 'map_location_island_of_myst', 'map_descrip
tion_island_of_myst');
FillAreaMapPinInfo(mappins, 7, -9999, -9999, "levels\the_spiral\
spiral.w2w", 'content10', 'map_location_spiral', 'map_description_spiral');
FillAreaMapPinInfo(mappins, 8, 797, 250, "levels\prolog_village_
winter\prolog_village.w2w", 'content12', 'map_location_prolog_village', 'map_des
cription_prolog_village');
FillAreaMapPinInfo(mappins, 9, 176, 91, "levels\novigrad\novigra
d.w2w", 'content4', 'map_location_no_mans_land', 'map_description_no_mans_land')
;
/* NOP */;
}
private function FillAreaMapPinInfo(mappins : array<SAreaMapPinInfo>, ar
eaType : EAreaName, areaPinX : Int32, areaPinY : Int32, worldPath : String, requ
iredChunk : CName, localisationName : CName, localisationDescription : CName){
var info : SAreaMapPinInfo;
info.areaType = areaType;
info.position.X = areaPinX;
info.position.Y = areaPinY;
info.position.Z = 0;
info.worldPath = worldPath;
info.requiredChunk = requiredChunk;
info.localisationName = localisationName;
info.localisationDescription = localisationDescription;

mappins.PushBack(info);
/* NOP */;
}
public function ForceSettingLoadingScreenVideoForWorld(worldName : Strin
g){
var area : Int32;
var manager : CWitcherJournalManager;
manager = theGame.GetJournalManager();
if (manager){
if (m_lastGlobalFastTravelArea != 0){
area = GetJournalAreaByPosition(m_lastGlobalFast
TravelArea, m_lastGlobalFastTravelPosition);
m_lastGlobalFastTravelArea = 0;
} else {
area = GetAreaFromWorldPath(worldName, /* NOP */
);
}
manager.ForceSettingLoadingScreenVideoForWorld(area);
}
/* NOP */;
}
public function PerformLocalFastTravelTeleport(destinationPinTag : CName
){
var position : Vector;
var rotation : EulerAngles;
var contextName : CName;
if (GetLocalFastTravelPointPosition(destinationPinTag, !thePlaye
r.IsSailing(), position, rotation)){
contextName = theGame.GetCommonMapManager().GetLocalisat
ionNameFromAreaType(GetCurrentJournalAreaByPosition(position));
theGame.SetSingleShotLoadingScreen(contextName, /* NOP *
/, /* NOP */);
rotation.Roll = 0.000000;
rotation.Pitch = 0.000000;
thePlayer.TeleportWithRotation(position, rotation);
super.UseMapPin(destinationPinTag, false);
theGame.RequestAutoSave("fast travel", true);
}
/* NOP */;
}
public function PerformGlobalFastTravelTeleport(destinationArea : Int32,
destinationPinTag : CName){
var worldPath : String;
var position : Vector;
var rotation : EulerAngles;
m_destinationPinTag = destinationPinTag;
worldPath = GetWorldPathFromAreaType(destinationArea);
if (StrLen(worldPath) > 0){
if (GetFastTravelPointPosition(worldPath, destinationPin
Tag, !thePlayer.IsSailing(), position, rotation)){
m_lastGlobalFastTravelArea = destinationArea;
m_lastGlobalFastTravelPosition = position;
theGame.ScheduleWorldChangeToPosition(worldPath,
position, rotation);
} else {
theGame.ScheduleWorldChangeToMapPin(worldPath, d
estinationPinTag);
}
theGame.RequestAutoSave("fast travel", true);
}

/* NOP */;
}
public function SetDebugTeleportWaypoint(tag : CName){
m_debugTeleportWaypointTag = tag;
/* NOP */;
}
private function DebugTeleport(){
var entity : CEntity;
if (m_debugTeleportWaypointTag != 'None'){
entity = theGame.GetEntityByTag(m_debugTeleportWaypointT
ag);
if (entity){
thePlayer.TeleportWithRotation(entity.GetWorldPo
sition(), entity.GetWorldRotation());
} else {
LogAssert(false, "Waypoint [" + m_debugTeleportW
aypointTag + "] not found");
}
m_debugTeleportWaypointTag = 'None';
}
/* NOP */;
}
public function GetAreaFromWorldPath(worldPath : String, noWinterPrologV
illage : Bool) : Int32{
var i : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var area : Int32;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].worldPath == worldPath){
area = areaMapPins[i].areaType;
if (!noWinterPrologVillage){
if (area == 8){
area = 4;
}
}
return area;
}
i += 1;
}
return 0;
/* NOP */;
}
public function GetMapName(areaType : Int32) : String{
var i : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var mapName : String;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].areaType == areaType){
mapName = StrAfterLast(areaMapPins[i].worldPath,
StrChar(92));
mapName = StrReplace(mapName, ".w2w", "");
return mapName;
}
i += 1;
}
return "";

/* NOP */;
}
public function GetWorldPathFromAreaType(areaType : Int32) : String{
var i : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].areaType == areaType){
return areaMapPins[i].worldPath;
}
i += 1;
}
return "";
/* NOP */;
}
public function GetLocalisationNameFromAreaType(areaType : Int32) : CNam
e{
var i : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].areaType == areaType){
return areaMapPins[i].localisationName;
}
i += 1;
}
return 'None';
/* NOP */;
}
public function GetLocalisationDescriptionFromAreaType(areaType : Int32)
: CName{
var i : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].areaType == areaType){
return areaMapPins[i].localisationDescription;
}
i += 1;
}
return 'None';
/* NOP */;
}
public function OnManageFastTravelAreas(enable : Bool, show : Bool, affe
ctedAreas : array<Int32>) : Bool{
var i : Int32;
var j : Int32;
var tags : array<CName>;
var area : EAreaName;
var path : String;
i = 0;
while (i < affectedAreas.Size()){
i += 1;
}
/* NOP */;
}
public function OnManageFastTravelPoints(enable : Bool, show : Bool, aff

ectedFastTravelPoints : array<CName>) : Bool{


var i : Int32;
i = 0;
while (i < affectedFastTravelPoints.Size()){
ManageFastTravelPoint(enable, show, affectedFastTravelPo
ints[i]);
i += 1;
}
/* NOP */;
}
public function ManageFastTravelPoint(enable : Bool, show : Bool, tag :
CName){
super.SetEntityMapPinDisabled(tag, !enable);
SetEntityMapPinDiscoveredScript(true, tag, show);
/* NOP */;
}
public function GetFastTravelPoints(onlyDiscovered : Bool, onlyEnabled :
Bool, ignoreLand : Bool, ignoreWater : Bool, ignoreVelenAndPrologueWinter : Boo
l) : array<SAvailableFastTravelMapPin>{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
var pin : SAvailableFastTravelMapPin;
var pins : array<SAvailableFastTravelMapPin>;
var type : CName;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (ignoreVelenAndPrologueWinter && areaMapPins[i].areaT
ype == 9 || areaMapPins[i].areaType == 8){
} else {
entityMapPins = super.GetEntityMapPins(areaMapPi
ns[i].worldPath);
j = 0;
while (j < entityMapPins.Size()){
type = entityMapPins[j].entityType;
if (type != 'RoadSign' && type != 'Harbo
r'){
} else if (ignoreLand && type == 'RoadSi
gn'){
} else if (ignoreWater && type == 'Harbo
r'){
} else if (onlyDiscovered){
if (!super.IsEntityMapPinDiscove
red(entityMapPins[j].entityName)){
}
} else if (onlyEnabled){
if (super.IsEntityMapPinDisabled
(entityMapPins[j].entityName)){
}
} else {
pin.tag = entityMapPins[j].entit
yName;
pin.type = entityMapPins[j].enti
tyType;
pin.area = areaMapPins[i].areaTy
pe;
pins.PushBack(pin);
}

j += 1;
}
}
i += 1;
}
return pins;
/* NOP */;
}
public function HasFastTravelPoints(onlyDiscovered : Bool, onlyEnabled :
Bool, ignoreLand : Bool, ignoreWater : Bool, ignoreVelenAndPrologueWinter : Boo
l) : Bool{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
var type : CName;
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (ignoreVelenAndPrologueWinter && areaMapPins[i].areaT
ype == 9 || areaMapPins[i].areaType == 8){
} else {
entityMapPins = super.GetEntityMapPins(areaMapPi
ns[i].worldPath);
j = 0;
while (j < entityMapPins.Size()){
type = entityMapPins[j].entityType;
if (type != 'RoadSign' && type != 'Harbo
r'){
} else if (ignoreLand && type == 'RoadSi
gn'){
} else if (ignoreWater && type == 'Harbo
r'){
} else if (onlyDiscovered){
if (!super.IsEntityMapPinDiscove
red(entityMapPins[j].entityName)){
}
} else if (onlyEnabled){
if (super.IsEntityMapPinDisabled
(entityMapPins[j].entityName)){
}
} else {
return true;
}
j += 1;
}
}
i += 1;
}
return false;
/* NOP */;
}
public function GetKnownableEntityNames() : array<CName>{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
var names : array<CName>;
var type : CName;
var knowableMapPinTypes : array<CName>;

GetKnowableMapPinTypes(knowableMapPinTypes);
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
entityMapPins = super.GetEntityMapPins(areaMapPins[i].wo
rldPath);
j = 0;
while (j < entityMapPins.Size()){
if (knowableMapPinTypes.Contains(entityMapPins[j
].entityType)){
names.PushBack(entityMapPins[j].entityNa
me);
}
j += 1;
}
i += 1;
}
return names;
/* NOP */;
}
public function GetDiscoverableEntityNames() : array<CName>{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;
var names : array<CName>;
var type : CName;
var discoverableMapPinTypes : array<CName>;
GetDiscoverableMapPinTypes(discoverableMapPinTypes);
areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
entityMapPins = super.GetEntityMapPins(areaMapPins[i].wo
rldPath);
j = 0;
while (j < entityMapPins.Size()){
if (discoverableMapPinTypes.Contains(entityMapPi
ns[j].entityType)){
names.PushBack(entityMapPins[j].entityNa
me);
}
j += 1;
}
i += 1;
}
return names;
/* NOP */;
}
public function GetLocalFastTravelPointPosition(entityName : CName, land
Only : Bool, position : Vector, rotation : EulerAngles) : Bool{
return GetFastTravelPointPosition(theGame.GetWorld().GetDepotPat
h(), entityName, landOnly, position, rotation);
/* NOP */;
}
public function GetFastTravelPointPosition(worldPath : String, entityNam
e : CName, landOnly : Bool, position : Vector, rotation : EulerAngles) : Bool{
var i : Int32;
var j : Int32;
var areaMapPins : array<SAreaMapPinInfo>;
var entityMapPins : array<SEntityMapPinInfo>;

var type : CName;


areaMapPins = super.GetAreaMapPins();
i = 0;
while (i < areaMapPins.Size()){
if (areaMapPins[i].worldPath == worldPath){
entityMapPins = super.GetEntityMapPins(areaMapPi
ns[i].worldPath);
j = 0;
while (j < entityMapPins.Size()){
if (entityMapPins[j].entityName == entit
yName){
if (landOnly && entityMapPins[j]
.entityType == 'RoadSign'){
position = entityMapPins
[j].fastTravelTeleportWayPointPosition;
rotation = entityMapPins
[j].fastTravelTeleportWayPointRotation;
return true;
} else if (!landOnly && entityMa
pPins[j].entityType == 'Harbor'){
position = entityMapPins
[j].fastTravelTeleportWayPointPosition;
rotation = entityMapPins
[j].fastTravelTeleportWayPointRotation;
return true;
}
}
j += 1;
}
break;
}
i += 1;
}
return false;
/* NOP */;
}
public function AllowSaving(allow : Bool){
if (allow){
theGame.ReleaseNoSaveLock(m_noSaveLock);
} else {
m_noSaveLock = 12345;
theGame.CreateNoSaveLock("EndOfTheWorld", m_noSaveLock,
false, false);
}
/* NOP */;
}
public function DBG_ShowKnownPins(show : Bool){
m_dbgShowKnownPins = show;
DBG_UpdateShownKnownPins();
/* NOP */;
}
public function DBG_UpdateShownKnownPins(){
var i : Int32;
var arr : array<CName>;
if (m_dbgShowKnownPins){
arr = GetKnownableEntityNames();
i = 0;
while (i < arr.Size()){
super.SetEntityMapPinKnown(arr[i], true);
i += 1;

}
}
/* NOP */;
}
public function DBG_ShowPins(show : Bool){
m_dbgShowKnownPins = show;
DBG_UpdateShownKnownPins();
m_dbgShowPins = show;
DBG_UpdateShownPins();
/* NOP */;
}
public function DBG_UpdateShownPins(){
var i : Int32;
var arr : array<CName>;
if (m_dbgShowPins){
arr = GetDiscoverableEntityNames();
i = 0;
while (i < arr.Size()){
super.SetEntityMapPinKnown(arr[i], true);
super.SetEntityMapPinDiscovered(arr[i], true);
i += 1;
}
}
/* NOP */;
}
public function DBG_ShowAllFT(show : Bool){
m_dbgShowAllFT = show;
DBG_UpdateShownFT();
/* NOP */;
}
public function DBG_UpdateShownFT(){
var i : Int32;
var arr : array<SAvailableFastTravelMapPin>;
if (m_dbgShowAllFT){
arr = GetFastTravelPoints(false, false, /* NOP */, /* NO
P */, /* NOP */);
i = 0;
while (i < arr.Size()){
super.SetEntityMapPinDiscovered(arr[i].tag, true
);
i += 1;
}
}
/* NOP */;
}
public function DBG_AllowFT(allow : Bool){
m_dbgAllowFT = allow;
/* NOP */;
}
public function DBG_IsAllowedFT() : Bool{
return m_dbgAllowFT;
/* NOP */;
}
}
import abstract class CWorldMap{
}
import abstract class SWorldMapImageInfo{
}

import abstract class SUsedFastTravelEvent{


}
import abstract class SMenuEvent{
}
import abstract class CGameplayFXMedalion{
}
import abstract class SCommonMapPinInstance{
//NULL type for id
//NULL type for tag
//NULL type for type
//NULL type for position
//NULL type for isDiscovered
//NULL type for isKnown
//NULL type for visibleType
//NULL type for isDisabled
//NULL type for extraTag
//NULL type for visibleRadius
//NULL type for guid
//NULL type for isHighlighted
//NULL type for customNameId
}
import abstract class SMapPathDefinition{
}
import abstract class SMapPathInstance{
//NULL type for id
//NULL type for position
//NULL type for color
//NULL type for lineWidth
//NULL type for splinePoints
}
import abstract class SCustomMapPinDefinition{
}
import struct CWitcherJournalManager{
import public final function SetTrackedQuest(journalEntry : CJournalBase
);
import public final function GetTrackedQuest() : CJournalQuest;
import public final function GetHighlightedQuest() : CJournalQuest;
import public final function GetHighlightedObjective() : CJournalQuestOb
jective;
import public final function SetHighlightedObjective(journalEntry : CJou
rnalBase) : Bool;
import public final function SetPrevNextHighlightedObjective(next : Bool
) : Bool;
import public final function GetQuestHasMonsterKnown(journalEntry : CJou
rnalBase) : Bool;
import public final function SetQuestHasMonsterKnown(journalEntry : CJou
rnalBase, isKnown : Bool);
import public final function GetEntryHasAdvancedInfo(journalEntry : CJou
rnalBase) : Bool;
import public final function SetEntryHasAdvancedInfo(journalEntry : CJou
rnalBase, isKnown : Bool);
import public final function GetQuestObjectiveCount(questGuid : CGUID) :

Int32;
import public final function SetQuestObjectiveCount(questGuid : CGUID, n
ewCount : Int32);
import public final function GetCreaturesWithHuntingQuestClue(categoryNa
me : CName, clueIndex : Int32, creatures : array<CJournalCreature>);
import public final function GetNumberOfCluesFoundForQuest(huntingQuest
: CJournalQuest) : Int32;
import public final function GetAllCluesFoundForQuest(huntingQuest : CJo
urnalQuest, creatures : array<CJournalCreatureHuntingClue>);
import public final function SetHuntingClueFoundForQuest(huntingQuest :
CJournalQuest, huntingClue : CJournalCreatureHuntingClue);
import public final function GetTrackedQuestObjectivesData(objectives :
array<SJournalQuestObjectiveData>);
import public final function GetCreatureParams(entityFilename : String,
params : SJournalCreatureParams) : Bool;
import public final function ToggleDebugInfo(debugInfo : Int32);
import public final function ShowLoadingScreenVideo(debugVideo : Bool);
import public final function GetQuestRewards(journalQuest : CJournalQues
t) : array<CName>;
import public final function GetRegularQuestCount() : Int32;
import public final function GetMonsterHuntQuestCount() : Int32;
import public final function GetTreasureHuntQuestCount() : Int32;
import public final function GetQuestProgress() : Int32;
import public final function GetJournalAreasWithQuests() : array<Int32>;
import public final function ForceSettingLoadingScreenVideoForWorld(area
: Int32);
public function GetCurrentlyBuffedCreature() : CJournalCreature{
var foundCreature : CJournalCreature;
var monsterName : CName;
monsterName = GetCurrentlyBuffedCreatureName();
if (monsterName){
foundCreature = (CJournalCreature)GetEntryByTag(monsterN
ame);
}
return foundCreature;
/* NOP */;
}
public function GetCurrentlyBuffedCreatureName() : CName{
var curGameTime : GameTime;
var currentDayPart : EDayPart;
var currentWeatherEffect : EWeatherEffect;
var currentMoonState : EMoonState;
var monsterTag : CName;
monsterTag = 'None';
curGameTime = theGame.GetGameTime();
currentDayPart = GetDayPart(curGameTime);
currentWeatherEffect = GetCurWeather();
currentMoonState = GetCurMoonState();
if (currentWeatherEffect == 0 || currentWeatherEffect == 4){
switch(currentDayPart){
case 0:
case 1:
monsterTag = 'Baba cmentarna';
break;
case 2:
monsterTag = 'bestiary_noonwright';
break;
case 3:
monsterTag = 'bestiary_alghoul';
break;

case 4:
if (currentMoonState == 2){
monsterTag = 'Ogar Dzikiego Gonu';
} else if (currentMoonState == 1){
monsterTag = 'bestiary_werewolf';
} else {
monsterTag = 'bestiary_moonwright';
}
break;
}
} else if (currentWeatherEffect == 2){
switch(currentDayPart){
case 0:
case 1:
monsterTag = 'bestiary_icegiant';
break;
case 2:
monsterTag = 'Troll lodowy';
break;
case 3:
monsterTag = 'bestiary_icegiant';
break;
case 4:
if (currentMoonState == 2){
monsterTag = 'Ogar Dzikiego Gonu';
} else if (currentMoonState == 1){
monsterTag = 'bestiary_werewolf';
} else {
monsterTag = 'bestiary_wraith';
}
break;
}
} else if (currentWeatherEffect == 1 || currentWeatherEffect ==
3){
switch(currentDayPart){
case 0:
case 1:
monsterTag = 'Baba wodna';
break;
case 2:
monsterTag = 'Baba wodna';
break;
case 3:
monsterTag = 'Utopiec';
break;
case 4:
if (currentMoonState == 2){
monsterTag = 'Ogar Dzikiego Gonu';
} else if (currentMoonState == 1){
monsterTag = 'bestiary_werewolf';
} else {
monsterTag = 'bestiary_greater_rotfiend'
;
}
break;
}
}
return monsterTag;
/* NOP */;
}

}
import abstract class SW3BaseStatusEvent{
}
import abstract class SW3JournalObjectiveStatusEvent{
}
import abstract class SW3JournalQuestStatusEvent{
}
import abstract class SW3JournalCharacterEvent{
}
import abstract class SW3JournalCharacterDescriptionEvent{
}
import abstract class SW3JournalGlossaryEvent{
}
import abstract class SW3JournalGlossaryDescriptionEvent{
}
import abstract class SW3JournalTutorialEvent{
}
import abstract class SW3JournalCreatureEvent{
}
import abstract class SW3JournalCreatureDescriptionEvent{
}
import abstract class SW3JournalStoryBookPageEvent{
}
import abstract class SW3JournalPlaceEvent{
}
import abstract class SW3JournalPlaceDescriptionEvent{
}
import abstract class SW3JournalTrackEvent{
}
import abstract class SW3JournalQuestTrackEvent{
}
import abstract class SW3JournalQuestObjectiveTrackEvent{
}
import abstract class SW3JournalQuestObjectiveCounterTrackEvent{
}
import abstract class SW3JournalHighlightEvent{
}
import abstract class SW3JournalHuntingQuestAddedEvent{
}
import abstract class SW3JournalHuntingQuestClueFoundEvent{

}
import abstract class CJournalQuestRoot{
}
import struct CJournalQuestGroup{
import public final function GetTitleStringId() : Int32;
}
import abstract class CJournalQuestItemTag{
}
import abstract class CJournalQuestEnemyTag{
}
import abstract class CJournalCharacterRoot{
}
import struct CJournalCharacterGroup{
}
import abstract class CJournalGlossaryRoot{
}
import abstract class CJournalTutorialRoot{
}
import abstract class CJournalItemRoot{
}
import abstract class CJournalItemGroup{
}
import abstract class CJournalItemSubGroup{
}
import abstract class CJournalItem{
}
import abstract class CJournalItemComponent{
}
import abstract class CJournalCreatureRoot{
}
import struct CJournalCreature{
import public final function
import public final function
import public final function
import public final function
>;
}

GetNameStringId() : Int32;
GetImage() : String;
GetEntityTemplateFilename() : String;
GetItemsUsedAgainstCreature() : array<CName

import struct CJournalCreatureHuntingClueGroup{


}
import struct CJournalCreatureHuntingClue{
}
import abstract class CJournalCreatureGameplayHintGroup{

}
import abstract class CJournalCreatureGameplayHint{
}
import struct CJournalCreatureVitalSpotEntry{
import public final function GetTitleStringId() : Int32;
import public final function GetDescriptionStringId() : Int32;
import public final function GetCreatureEntry() : CJournalCreature;
}
import abstract class CJournalCreatureVitalSpotGroup{
}
import abstract class CJournalStoryBookRoot{
}
import abstract class CJournalPlaceRoot{
}
import abstract class CJournalQuestBlock{
}
import abstract class CJournalQuestObjectiveCounterGraphBlock{
}
import abstract class CJournalQuestMonsterKnownGraphBlock{
}
import abstract class CJournalQuestHuntingBlock{
}
import abstract class CQuestRiderScriptedActionsBlock{
}
import abstract class SJournalCreatureParams{
}
import abstract class CBuffImmunity{
//NULL type for immunityTo
//NULL type for potion
//NULL type for positive
//NULL type for neutral
//NULL type for negative
//NULL type for immobilize
//NULL type for confuse
//NULL type for damage
}
import struct CR4JournalPlaceEntity{
import public function GetJournalPlaceEntry() : CJournalBase;
}
import struct CR4GwintManager{
public var testMatch : Bool;
private var enemyDecksSet : Bool;
private var enemyDecks : array<SDeckDefinition>;
private var selectedEnemyDeck : Int32;
private var doubleAIEnabled : Bool;
public var gameRequested : Bool;

import public final function GetCardDefs() : array<SCardDefinition>;


import public final function GetLeaderDefs() : array<SCardDefinition>;
import public final function GetFactionDeck(faction : eGwintFaction, dec
k : SDeckDefinition) : Bool;
import public final function SetFactionDeck(faction : eGwintFaction, dec
k : SDeckDefinition);
import public final function GetPlayerCollection() : array<CollectionCar
d>;
import public final function GetPlayerLeaderCollection() : array<Collect
ionCard>;
import public final function GetSelectedPlayerDeck() : eGwintFaction;
import public final function SetSelectedPlayerDeck(index : eGwintFaction
);
import public final function UnlockDeck(index : eGwintFaction);
import public final function IsDeckUnlocked(index : eGwintFaction) : Boo
l;
import public final function AddCardToCollection(cardIndex : Int32);
import public final function RemoveCardFromCollection(cardIndex : Int32)
;
import public final function AddCardToDeck(faction : eGwintFaction, card
Index : Int32);
import public final function RemoveCardFromDeck(faction : eGwintFaction,
cardIndex : Int32);
import public final function GetHasDoneTutorial() : Bool;
import public final function SetHasDoneTutorial(value : Bool);
import public final function GetHasDoneDeckTutorial() : Bool;
import public final function SetHasDoneDeckTutorial(value : Bool);
public function HasLootedCard() : Bool{
return FactsDoesExist("Gwint_Card_Looted");
/* NOP */;
}
public function OnGwintSetupNewgame() : Bool{
var northernPlayerDeck : SDeckDefinition;
var nilfgardPlayerDeck : SDeckDefinition;
var scotialPlayerDeck : SDeckDefinition;
var nmlPlayerDeck : SDeckDefinition;
northernPlayerDeck.cardIndices.PushBack(3);
northernPlayerDeck.cardIndices.PushBack(3);
northernPlayerDeck.cardIndices.PushBack(4);
northernPlayerDeck.cardIndices.PushBack(4);
northernPlayerDeck.cardIndices.PushBack(5);
northernPlayerDeck.cardIndices.PushBack(6);
northernPlayerDeck.cardIndices.PushBack(106);
northernPlayerDeck.cardIndices.PushBack(111);
northernPlayerDeck.cardIndices.PushBack(112);
northernPlayerDeck.cardIndices.PushBack(113);
northernPlayerDeck.cardIndices.PushBack(114);
northernPlayerDeck.cardIndices.PushBack(115);
northernPlayerDeck.cardIndices.PushBack(116);
northernPlayerDeck.cardIndices.PushBack(120);
northernPlayerDeck.cardIndices.PushBack(121);
northernPlayerDeck.cardIndices.PushBack(125);
northernPlayerDeck.cardIndices.PushBack(125);
northernPlayerDeck.cardIndices.PushBack(135);
northernPlayerDeck.cardIndices.PushBack(145);
northernPlayerDeck.cardIndices.PushBack(150);
northernPlayerDeck.cardIndices.PushBack(150);
northernPlayerDeck.cardIndices.PushBack(150);
northernPlayerDeck.cardIndices.PushBack(107);
northernPlayerDeck.cardIndices.PushBack(160);

northernPlayerDeck.cardIndices.PushBack(160);
northernPlayerDeck.cardIndices.PushBack(175);
super.AddCardToCollection(108);
super.AddCardToCollection(136);
northernPlayerDeck.leaderIndex = 1001;
northernPlayerDeck.specialCard = -1;
northernPlayerDeck.unlocked = false;
super.SetFactionDeck(3, northernPlayerDeck);
nilfgardPlayerDeck.leaderIndex = 2001;
nilfgardPlayerDeck.specialCard = -1;
nilfgardPlayerDeck.unlocked = false;
super.SetFactionDeck(2, nilfgardPlayerDeck);
scotialPlayerDeck.leaderIndex = 3001;
scotialPlayerDeck.specialCard = -1;
scotialPlayerDeck.unlocked = false;
super.SetFactionDeck(4, scotialPlayerDeck);
nmlPlayerDeck.leaderIndex = 4001;
nmlPlayerDeck.specialCard = -1;
nmlPlayerDeck.unlocked = false;
super.SetFactionDeck(1, nmlPlayerDeck);
super.UnlockDeck(3);
super.UnlockDeck(2);
super.UnlockDeck(4);
super.UnlockDeck(1);
super.SetSelectedPlayerDeck(3);
/* NOP */;
}
public function GetTutorialPlayerDeck() : SDeckDefinition{
var tutorialDeck : SDeckDefinition;
tutorialDeck.cardIndices.PushBack(3);
tutorialDeck.cardIndices.PushBack(3);
tutorialDeck.cardIndices.PushBack(4);
tutorialDeck.cardIndices.PushBack(4);
tutorialDeck.cardIndices.PushBack(5);
tutorialDeck.cardIndices.PushBack(6);
tutorialDeck.cardIndices.PushBack(106);
tutorialDeck.cardIndices.PushBack(111);
tutorialDeck.cardIndices.PushBack(112);
tutorialDeck.cardIndices.PushBack(113);
tutorialDeck.cardIndices.PushBack(114);
tutorialDeck.cardIndices.PushBack(115);
tutorialDeck.cardIndices.PushBack(116);
tutorialDeck.cardIndices.PushBack(120);
tutorialDeck.cardIndices.PushBack(121);
tutorialDeck.cardIndices.PushBack(126);
tutorialDeck.cardIndices.PushBack(127);
tutorialDeck.cardIndices.PushBack(135);
tutorialDeck.cardIndices.PushBack(145);
tutorialDeck.cardIndices.PushBack(150);
tutorialDeck.cardIndices.PushBack(151);
tutorialDeck.cardIndices.PushBack(152);
tutorialDeck.cardIndices.PushBack(107);
tutorialDeck.cardIndices.PushBack(160);
tutorialDeck.cardIndices.PushBack(161);
tutorialDeck.cardIndices.PushBack(175);
tutorialDeck.leaderIndex = 1001;
tutorialDeck.specialCard = -1;
return tutorialDeck;
/* NOP */;
}

protected function setupEnemyDecks(){


if (!enemyDecksSet){
enemyDecksSet = true;
SetupAIDeckDefinitions();
SetupAIDeckDefinitions1();
SetupAIDeckDefinitions2();
SetupAIDeckDefinitions3();
SetupAIDeckDefinitions4();
SetupAIDeckDefinitions5();
SetupAIDeckDefinitions6();
SetupAIDeckDefinitions7();
SetupAIDeckDefinitionsNK();
SetupAIDeckDefinitionsNilf();
SetupAIDeckDefinitionsScoia();
SetupAIDeckDefinitionsNML();
SetupAIDeckDefinitionsPrologue();
SetupAIDeckDefinitionsTournament1();
SetupAIDeckDefinitionsTournament2();
}
/* NOP */;
}
public function setDoubleAIEnabled(value : Bool){
doubleAIEnabled = value;
/* NOP */;
}
public function getDoubleAIEnabled() : Bool{
return doubleAIEnabled;
/* NOP */;
}
public function GetCurrentPlayerDeck() : SDeckDefinition{
var selectedDeck : SDeckDefinition;
super.GetFactionDeck(super.GetSelectedPlayerDeck(), selectedDeck
);
return selectedDeck;
/* NOP */;
}
public function HasUnlockedDeck() : Bool{
if (!super.IsDeckUnlocked(1) && !super.IsDeckUnlocked(2) && !sup
er.IsDeckUnlocked(3) && !super.IsDeckUnlocked(4)){
return false;
}
return true;
/* NOP */;
}
public function SetEnemyDeckIndex(deckIndex : Int32){
selectedEnemyDeck = deckIndex;
/* NOP */;
}
public function SetEnemyDeckByName(deckname : CName){
switch(deckname){
case 'CardProdigy':
selectedEnemyDeck = 0;
break;
case 'Dijkstra':
selectedEnemyDeck = 1;
break;
case 'Baron':
selectedEnemyDeck = 2;
break;
case 'Roche':

case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case
case

selectedEnemyDeck =
break;
'Sjusta':
selectedEnemyDeck =
break;
'Stjepan':
selectedEnemyDeck =
break;
'CrossroadsInnkeeper':
selectedEnemyDeck =
break;
'BoatBuilder':
selectedEnemyDeck =
break;
'MarkizaSerenity':
selectedEnemyDeck =
break;
'Gremista':
selectedEnemyDeck =
break;
'Zoltan':
selectedEnemyDeck =
break;
'Lambert':
selectedEnemyDeck =
break;
'Thaler':
selectedEnemyDeck =
break;
'VimmeVivaldi':
selectedEnemyDeck =
break;
'ScoiaTrader':
selectedEnemyDeck =
break;
'Crach':
selectedEnemyDeck =
break;
'LugosTheMad':
selectedEnemyDeck =
break;
'Hermit':
selectedEnemyDeck =
break;
'Olivier':
selectedEnemyDeck =
break;
'Mousesack':
selectedEnemyDeck =
break;
'NKEasy':
selectedEnemyDeck =
break;
'NKNormal':
selectedEnemyDeck =
break;
'NKHard':
selectedEnemyDeck =
break;
'NilfEasy':

3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
13;
14;
15;
16;
17;
18;
19;
20;
21;
22;

selectedEnemyDeck
break;
case 'NilfNormal':
selectedEnemyDeck
break;
case 'NilfHard':
selectedEnemyDeck
break;
case 'ScoiaEasy':
selectedEnemyDeck
break;
case 'ScoiaNormal':
selectedEnemyDeck
break;
case 'ScoiaHard':
selectedEnemyDeck
break;
case 'NMLEasy':
selectedEnemyDeck
break;
case 'NMLNormal':
selectedEnemyDeck
break;
case 'NMLHard':
selectedEnemyDeck
break;
case 'NilfPrologue':
selectedEnemyDeck
break;
case 'NKTournament':
selectedEnemyDeck
break;
case 'NilfTournament':
selectedEnemyDeck
break;
case 'ScoiaTournament':
selectedEnemyDeck
break;
case 'NMLTournament':
selectedEnemyDeck
break;
default:
selectedEnemyDeck
break;
}
/* NOP */;

= 23;
= 24;
= 25;
= 26;
= 27;
= 28;
= 29;
= 30;
= 31;
= 32;
= 33;
= 34;
= 35;
= 36;
= 23;

}
public function GetCardDefinition(cardIndex : Int32) : SCardDefinition{
var cardDefinitions : array<SCardDefinition>;
var errorDefinition : SCardDefinition;
var currentDefinition : SCardDefinition;
var i : Int32;
if (cardIndex >= 1000){
cardDefinitions = super.GetLeaderDefs();
} else {
cardDefinitions = super.GetCardDefs();
}
i = 0;
while (i < cardDefinitions.Size()){
currentDefinition = cardDefinitions[i];

if (currentDefinition.index == cardIndex){
return currentDefinition;
}
i += 1;
}
errorDefinition.index = -1;
return errorDefinition;
/* NOP */;
}
public function GetCurrentAIDeck() : SDeckDefinition{
setupEnemyDecks();
return enemyDecks[selectedEnemyDeck];
/* NOP */;
}
private function SetupAIDeckDefinitions(){
var CardProdigyDeck : SDeckDefinition;
var DijkstraDeck : SDeckDefinition;
var BaronDeck : SDeckDefinition;
CardProdigyDeck.cardIndices.PushBack(1);
CardProdigyDeck.cardIndices.PushBack(1);
CardProdigyDeck.cardIndices.PushBack(2);
CardProdigyDeck.cardIndices.PushBack(4);
CardProdigyDeck.cardIndices.PushBack(4);
CardProdigyDeck.cardIndices.PushBack(6);
CardProdigyDeck.cardIndices.PushBack(6);
CardProdigyDeck.cardIndices.PushBack(107);
CardProdigyDeck.cardIndices.PushBack(125);
CardProdigyDeck.cardIndices.PushBack(126);
CardProdigyDeck.cardIndices.PushBack(127);
CardProdigyDeck.cardIndices.PushBack(130);
CardProdigyDeck.cardIndices.PushBack(131);
CardProdigyDeck.cardIndices.PushBack(132);
CardProdigyDeck.cardIndices.PushBack(135);
CardProdigyDeck.cardIndices.PushBack(136);
CardProdigyDeck.cardIndices.PushBack(140);
CardProdigyDeck.cardIndices.PushBack(141);
CardProdigyDeck.cardIndices.PushBack(145);
CardProdigyDeck.cardIndices.PushBack(146);
CardProdigyDeck.cardIndices.PushBack(160);
CardProdigyDeck.cardIndices.PushBack(161);
CardProdigyDeck.cardIndices.PushBack(162);
CardProdigyDeck.dynamicCardRequirements.PushBack(165);
CardProdigyDeck.dynamicCards.PushBack(2);
CardProdigyDeck.dynamicCardRequirements.PushBack(175);
CardProdigyDeck.dynamicCards.PushBack(2);
CardProdigyDeck.dynamicCardRequirements.PushBack(185);
CardProdigyDeck.dynamicCards.PushBack(103);
CardProdigyDeck.dynamicCardRequirements.PushBack(205);
CardProdigyDeck.dynamicCards.PushBack(102);
CardProdigyDeck.dynamicCardRequirements.PushBack(205);
CardProdigyDeck.dynamicCards.PushBack(109);
CardProdigyDeck.dynamicCardRequirements.PushBack(225);
CardProdigyDeck.dynamicCards.PushBack(101);
CardProdigyDeck.dynamicCardRequirements.PushBack(225);
CardProdigyDeck.dynamicCards.PushBack(12);
CardProdigyDeck.specialCard = 100;
CardProdigyDeck.leaderIndex = 1001;
enemyDecks.PushBack(CardProdigyDeck);
DijkstraDeck.cardIndices.PushBack(0);
DijkstraDeck.cardIndices.PushBack(0);

DijkstraDeck.cardIndices.PushBack(1);
DijkstraDeck.cardIndices.PushBack(2);
DijkstraDeck.cardIndices.PushBack(3);
DijkstraDeck.cardIndices.PushBack(3);
DijkstraDeck.cardIndices.PushBack(4);
DijkstraDeck.cardIndices.PushBack(4);
DijkstraDeck.cardIndices.PushBack(6);
DijkstraDeck.cardIndices.PushBack(14);
DijkstraDeck.cardIndices.PushBack(105);
DijkstraDeck.cardIndices.PushBack(111);
DijkstraDeck.cardIndices.PushBack(120);
DijkstraDeck.cardIndices.PushBack(121);
DijkstraDeck.cardIndices.PushBack(140);
DijkstraDeck.cardIndices.PushBack(141);
DijkstraDeck.cardIndices.PushBack(145);
DijkstraDeck.cardIndices.PushBack(146);
DijkstraDeck.cardIndices.PushBack(150);
DijkstraDeck.cardIndices.PushBack(160);
DijkstraDeck.cardIndices.PushBack(161);
DijkstraDeck.cardIndices.PushBack(170);
DijkstraDeck.cardIndices.PushBack(175);
DijkstraDeck.dynamicCardRequirements.PushBack(165);
DijkstraDeck.dynamicCards.PushBack(2);
DijkstraDeck.dynamicCardRequirements.PushBack(175);
DijkstraDeck.dynamicCards.PushBack(2);
DijkstraDeck.dynamicCardRequirements.PushBack(185);
DijkstraDeck.dynamicCards.PushBack(16);
DijkstraDeck.dynamicCardRequirements.PushBack(205);
DijkstraDeck.dynamicCards.PushBack(101);
DijkstraDeck.dynamicCardRequirements.PushBack(205);
DijkstraDeck.dynamicCards.PushBack(109);
DijkstraDeck.dynamicCardRequirements.PushBack(225);
DijkstraDeck.dynamicCards.PushBack(116);
DijkstraDeck.dynamicCardRequirements.PushBack(225);
DijkstraDeck.dynamicCards.PushBack(12);
DijkstraDeck.specialCard = 102;
DijkstraDeck.leaderIndex = 1002;
enemyDecks.PushBack(DijkstraDeck);
BaronDeck.cardIndices.PushBack(2);
BaronDeck.cardIndices.PushBack(2);
BaronDeck.cardIndices.PushBack(3);
BaronDeck.cardIndices.PushBack(5);
BaronDeck.cardIndices.PushBack(5);
BaronDeck.cardIndices.PushBack(105);
BaronDeck.cardIndices.PushBack(111);
BaronDeck.cardIndices.PushBack(112);
BaronDeck.cardIndices.PushBack(116);
BaronDeck.cardIndices.PushBack(121);
BaronDeck.cardIndices.PushBack(125);
BaronDeck.cardIndices.PushBack(125);
BaronDeck.cardIndices.PushBack(125);
BaronDeck.cardIndices.PushBack(130);
BaronDeck.cardIndices.PushBack(131);
BaronDeck.cardIndices.PushBack(132);
BaronDeck.cardIndices.PushBack(140);
BaronDeck.cardIndices.PushBack(145);
BaronDeck.cardIndices.PushBack(160);
BaronDeck.cardIndices.PushBack(161);
BaronDeck.cardIndices.PushBack(162);
BaronDeck.cardIndices.PushBack(170);

BaronDeck.dynamicCardRequirements.PushBack(165);
BaronDeck.dynamicCards.PushBack(1);
BaronDeck.dynamicCardRequirements.PushBack(175);
BaronDeck.dynamicCards.PushBack(8);
BaronDeck.dynamicCardRequirements.PushBack(185);
BaronDeck.dynamicCards.PushBack(120);
BaronDeck.dynamicCardRequirements.PushBack(205);
BaronDeck.dynamicCards.PushBack(11);
BaronDeck.dynamicCardRequirements.PushBack(205);
BaronDeck.dynamicCards.PushBack(12);
BaronDeck.dynamicCardRequirements.PushBack(225);
BaronDeck.dynamicCards.PushBack(15);
BaronDeck.dynamicCardRequirements.PushBack(225);
BaronDeck.dynamicCards.PushBack(7);
BaronDeck.specialCard = 109;
BaronDeck.leaderIndex = 1001;
enemyDecks.PushBack(BaronDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions1(){
var RocheDeck : SDeckDefinition;
var SjustaDeck : SDeckDefinition;
RocheDeck.cardIndices.PushBack(0);
RocheDeck.cardIndices.PushBack(0);
RocheDeck.cardIndices.PushBack(1);
RocheDeck.cardIndices.PushBack(1);
RocheDeck.cardIndices.PushBack(4);
RocheDeck.cardIndices.PushBack(6);
RocheDeck.cardIndices.PushBack(101);
RocheDeck.cardIndices.PushBack(120);
RocheDeck.cardIndices.PushBack(121);
RocheDeck.cardIndices.PushBack(125);
RocheDeck.cardIndices.PushBack(126);
RocheDeck.cardIndices.PushBack(127);
RocheDeck.cardIndices.PushBack(135);
RocheDeck.cardIndices.PushBack(136);
RocheDeck.cardIndices.PushBack(140);
RocheDeck.cardIndices.PushBack(141);
RocheDeck.cardIndices.PushBack(145);
RocheDeck.cardIndices.PushBack(146);
RocheDeck.cardIndices.PushBack(150);
RocheDeck.cardIndices.PushBack(151);
RocheDeck.cardIndices.PushBack(170);
RocheDeck.cardIndices.PushBack(175);
RocheDeck.dynamicCardRequirements.PushBack(165);
RocheDeck.dynamicCards.PushBack(15);
RocheDeck.dynamicCardRequirements.PushBack(175);
RocheDeck.dynamicCards.PushBack(2);
RocheDeck.dynamicCardRequirements.PushBack(185);
RocheDeck.dynamicCards.PushBack(10);
RocheDeck.dynamicCardRequirements.PushBack(205);
RocheDeck.dynamicCards.PushBack(11);
RocheDeck.dynamicCardRequirements.PushBack(205);
RocheDeck.dynamicCards.PushBack(8);
RocheDeck.dynamicCardRequirements.PushBack(225);
RocheDeck.dynamicCards.PushBack(12);
RocheDeck.dynamicCardRequirements.PushBack(225);
RocheDeck.dynamicCards.PushBack(7);
RocheDeck.specialCard = -1;
RocheDeck.leaderIndex = 1003;

enemyDecks.PushBack(RocheDeck);
SjustaDeck.cardIndices.PushBack(0);
SjustaDeck.cardIndices.PushBack(0);
SjustaDeck.cardIndices.PushBack(1);
SjustaDeck.cardIndices.PushBack(2);
SjustaDeck.cardIndices.PushBack(12);
SjustaDeck.cardIndices.PushBack(13);
SjustaDeck.cardIndices.PushBack(106);
SjustaDeck.cardIndices.PushBack(108);
SjustaDeck.cardIndices.PushBack(109);
SjustaDeck.cardIndices.PushBack(111);
SjustaDeck.cardIndices.PushBack(112);
SjustaDeck.cardIndices.PushBack(113);
SjustaDeck.cardIndices.PushBack(116);
SjustaDeck.cardIndices.PushBack(125);
SjustaDeck.cardIndices.PushBack(126);
SjustaDeck.cardIndices.PushBack(130);
SjustaDeck.cardIndices.PushBack(131);
SjustaDeck.cardIndices.PushBack(132);
SjustaDeck.cardIndices.PushBack(135);
SjustaDeck.cardIndices.PushBack(136);
SjustaDeck.cardIndices.PushBack(160);
SjustaDeck.cardIndices.PushBack(161);
SjustaDeck.dynamicCardRequirements.PushBack(165);
SjustaDeck.dynamicCards.PushBack(15);
SjustaDeck.dynamicCardRequirements.PushBack(175);
SjustaDeck.dynamicCards.PushBack(2);
SjustaDeck.dynamicCardRequirements.PushBack(185);
SjustaDeck.dynamicCards.PushBack(9);
SjustaDeck.dynamicCardRequirements.PushBack(205);
SjustaDeck.dynamicCards.PushBack(11);
SjustaDeck.dynamicCardRequirements.PushBack(205);
SjustaDeck.dynamicCards.PushBack(8);
SjustaDeck.dynamicCardRequirements.PushBack(225);
SjustaDeck.dynamicCards.PushBack(12);
SjustaDeck.dynamicCardRequirements.PushBack(225);
SjustaDeck.dynamicCards.PushBack(7);
SjustaDeck.specialCard = -1;
SjustaDeck.leaderIndex = 1004;
enemyDecks.PushBack(SjustaDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions2(){
var StjepanDeck : SDeckDefinition;
var CrossroadsDeck : SDeckDefinition;
var BoatBuilderDeck : SDeckDefinition;
StjepanDeck.cardIndices.PushBack(0);
StjepanDeck.cardIndices.PushBack(0);
StjepanDeck.cardIndices.PushBack(3);
StjepanDeck.cardIndices.PushBack(3);
StjepanDeck.cardIndices.PushBack(4);
StjepanDeck.cardIndices.PushBack(5);
StjepanDeck.cardIndices.PushBack(206);
StjepanDeck.cardIndices.PushBack(207);
StjepanDeck.cardIndices.PushBack(208);
StjepanDeck.cardIndices.PushBack(210);
StjepanDeck.cardIndices.PushBack(213);
StjepanDeck.cardIndices.PushBack(214);
StjepanDeck.cardIndices.PushBack(215);
StjepanDeck.cardIndices.PushBack(218);

StjepanDeck.cardIndices.PushBack(235);
StjepanDeck.cardIndices.PushBack(236);
StjepanDeck.cardIndices.PushBack(240);
StjepanDeck.cardIndices.PushBack(241);
StjepanDeck.cardIndices.PushBack(245);
StjepanDeck.cardIndices.PushBack(246);
StjepanDeck.cardIndices.PushBack(247);
StjepanDeck.cardIndices.PushBack(230);
StjepanDeck.cardIndices.PushBack(231);
StjepanDeck.dynamicCardRequirements.PushBack(165);
StjepanDeck.dynamicCards.PushBack(15);
StjepanDeck.dynamicCardRequirements.PushBack(175);
StjepanDeck.dynamicCards.PushBack(230);
StjepanDeck.dynamicCardRequirements.PushBack(185);
StjepanDeck.dynamicCards.PushBack(2);
StjepanDeck.dynamicCardRequirements.PushBack(205);
StjepanDeck.dynamicCards.PushBack(231);
StjepanDeck.dynamicCardRequirements.PushBack(205);
StjepanDeck.dynamicCards.PushBack(8);
StjepanDeck.dynamicCardRequirements.PushBack(225);
StjepanDeck.dynamicCards.PushBack(12);
StjepanDeck.dynamicCardRequirements.PushBack(225);
StjepanDeck.dynamicCards.PushBack(7);
StjepanDeck.specialCard = 9;
StjepanDeck.leaderIndex = 2003;
enemyDecks.PushBack(StjepanDeck);
CrossroadsDeck.cardIndices.PushBack(1);
CrossroadsDeck.cardIndices.PushBack(2);
CrossroadsDeck.cardIndices.PushBack(2);
CrossroadsDeck.cardIndices.PushBack(4);
CrossroadsDeck.cardIndices.PushBack(4);
CrossroadsDeck.cardIndices.PushBack(6);
CrossroadsDeck.cardIndices.PushBack(6);
CrossroadsDeck.cardIndices.PushBack(209);
CrossroadsDeck.cardIndices.PushBack(211);
CrossroadsDeck.cardIndices.PushBack(212);
CrossroadsDeck.cardIndices.PushBack(213);
CrossroadsDeck.cardIndices.PushBack(230);
CrossroadsDeck.cardIndices.PushBack(231);
CrossroadsDeck.cardIndices.PushBack(235);
CrossroadsDeck.cardIndices.PushBack(236);
CrossroadsDeck.cardIndices.PushBack(240);
CrossroadsDeck.cardIndices.PushBack(241);
CrossroadsDeck.cardIndices.PushBack(245);
CrossroadsDeck.cardIndices.PushBack(246);
CrossroadsDeck.cardIndices.PushBack(247);
CrossroadsDeck.cardIndices.PushBack(248);
CrossroadsDeck.cardIndices.PushBack(250);
CrossroadsDeck.cardIndices.PushBack(251);
CrossroadsDeck.cardIndices.PushBack(252);
CrossroadsDeck.cardIndices.PushBack(265);
CrossroadsDeck.dynamicCardRequirements.PushBack(165);
CrossroadsDeck.dynamicCards.PushBack(15);
CrossroadsDeck.dynamicCardRequirements.PushBack(175);
CrossroadsDeck.dynamicCards.PushBack(0);
CrossroadsDeck.dynamicCardRequirements.PushBack(185);
CrossroadsDeck.dynamicCards.PushBack(1);
CrossroadsDeck.dynamicCardRequirements.PushBack(205);
CrossroadsDeck.dynamicCards.PushBack(11);
CrossroadsDeck.dynamicCardRequirements.PushBack(205);

CrossroadsDeck.dynamicCards.PushBack(13);
CrossroadsDeck.dynamicCardRequirements.PushBack(225);
CrossroadsDeck.dynamicCards.PushBack(7);
CrossroadsDeck.dynamicCardRequirements.PushBack(225);
CrossroadsDeck.dynamicCards.PushBack(10);
CrossroadsDeck.specialCard = 201;
CrossroadsDeck.leaderIndex = 2002;
enemyDecks.PushBack(CrossroadsDeck);
BoatBuilderDeck.cardIndices.PushBack(0);
BoatBuilderDeck.cardIndices.PushBack(0);
BoatBuilderDeck.cardIndices.PushBack(1);
BoatBuilderDeck.cardIndices.PushBack(2);
BoatBuilderDeck.cardIndices.PushBack(3);
BoatBuilderDeck.cardIndices.PushBack(4);
BoatBuilderDeck.cardIndices.PushBack(5);
BoatBuilderDeck.cardIndices.PushBack(6);
BoatBuilderDeck.cardIndices.PushBack(202);
BoatBuilderDeck.cardIndices.PushBack(206);
BoatBuilderDeck.cardIndices.PushBack(209);
BoatBuilderDeck.cardIndices.PushBack(214);
BoatBuilderDeck.cardIndices.PushBack(218);
BoatBuilderDeck.cardIndices.PushBack(220);
BoatBuilderDeck.cardIndices.PushBack(235);
BoatBuilderDeck.cardIndices.PushBack(236);
BoatBuilderDeck.cardIndices.PushBack(240);
BoatBuilderDeck.cardIndices.PushBack(241);
BoatBuilderDeck.cardIndices.PushBack(245);
BoatBuilderDeck.cardIndices.PushBack(246);
BoatBuilderDeck.cardIndices.PushBack(250);
BoatBuilderDeck.cardIndices.PushBack(255);
BoatBuilderDeck.cardIndices.PushBack(265);
BoatBuilderDeck.dynamicCardRequirements.PushBack(165);
BoatBuilderDeck.dynamicCards.PushBack(247);
BoatBuilderDeck.dynamicCardRequirements.PushBack(175);
BoatBuilderDeck.dynamicCards.PushBack(248);
BoatBuilderDeck.dynamicCardRequirements.PushBack(185);
BoatBuilderDeck.dynamicCards.PushBack(251);
BoatBuilderDeck.dynamicCardRequirements.PushBack(205);
BoatBuilderDeck.dynamicCards.PushBack(252);
BoatBuilderDeck.dynamicCardRequirements.PushBack(205);
BoatBuilderDeck.dynamicCards.PushBack(260);
BoatBuilderDeck.dynamicCardRequirements.PushBack(225);
BoatBuilderDeck.dynamicCards.PushBack(7);
BoatBuilderDeck.dynamicCardRequirements.PushBack(225);
BoatBuilderDeck.dynamicCards.PushBack(12);
BoatBuilderDeck.specialCard = 200;
BoatBuilderDeck.leaderIndex = 2004;
enemyDecks.PushBack(BoatBuilderDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions3(){
var MarkizaDeck : SDeckDefinition;
var GremistaDeck : SDeckDefinition;
MarkizaDeck.cardIndices.PushBack(0);
MarkizaDeck.cardIndices.PushBack(1);
MarkizaDeck.cardIndices.PushBack(1);
MarkizaDeck.cardIndices.PushBack(2);
MarkizaDeck.cardIndices.PushBack(2);
MarkizaDeck.cardIndices.PushBack(3);
MarkizaDeck.cardIndices.PushBack(3);

MarkizaDeck.cardIndices.PushBack(4);
MarkizaDeck.cardIndices.PushBack(5);
MarkizaDeck.cardIndices.PushBack(6);
MarkizaDeck.cardIndices.PushBack(200);
MarkizaDeck.cardIndices.PushBack(206);
MarkizaDeck.cardIndices.PushBack(208);
MarkizaDeck.cardIndices.PushBack(210);
MarkizaDeck.cardIndices.PushBack(211);
MarkizaDeck.cardIndices.PushBack(213);
MarkizaDeck.cardIndices.PushBack(214);
MarkizaDeck.cardIndices.PushBack(220);
MarkizaDeck.cardIndices.PushBack(221);
MarkizaDeck.cardIndices.PushBack(230);
MarkizaDeck.cardIndices.PushBack(231);
MarkizaDeck.cardIndices.PushBack(245);
MarkizaDeck.cardIndices.PushBack(246);
MarkizaDeck.cardIndices.PushBack(250);
MarkizaDeck.cardIndices.PushBack(251);
MarkizaDeck.cardIndices.PushBack(252);
MarkizaDeck.dynamicCardRequirements.PushBack(165);
MarkizaDeck.dynamicCards.PushBack(235);
MarkizaDeck.dynamicCardRequirements.PushBack(175);
MarkizaDeck.dynamicCards.PushBack(0);
MarkizaDeck.dynamicCardRequirements.PushBack(185);
MarkizaDeck.dynamicCards.PushBack(13);
MarkizaDeck.dynamicCardRequirements.PushBack(205);
MarkizaDeck.dynamicCards.PushBack(12);
MarkizaDeck.dynamicCardRequirements.PushBack(205);
MarkizaDeck.dynamicCards.PushBack(14);
MarkizaDeck.dynamicCardRequirements.PushBack(225);
MarkizaDeck.dynamicCards.PushBack(7);
MarkizaDeck.dynamicCardRequirements.PushBack(225);
MarkizaDeck.dynamicCards.PushBack(10);
MarkizaDeck.specialCard = 202;
MarkizaDeck.leaderIndex = 2001;
enemyDecks.PushBack(MarkizaDeck);
GremistaDeck.cardIndices.PushBack(0);
GremistaDeck.cardIndices.PushBack(0);
GremistaDeck.cardIndices.PushBack(0);
GremistaDeck.cardIndices.PushBack(3);
GremistaDeck.cardIndices.PushBack(4);
GremistaDeck.cardIndices.PushBack(5);
GremistaDeck.cardIndices.PushBack(6);
GremistaDeck.cardIndices.PushBack(14);
GremistaDeck.cardIndices.PushBack(203);
GremistaDeck.cardIndices.PushBack(205);
GremistaDeck.cardIndices.PushBack(210);
GremistaDeck.cardIndices.PushBack(215);
GremistaDeck.cardIndices.PushBack(217);
GremistaDeck.cardIndices.PushBack(230);
GremistaDeck.cardIndices.PushBack(231);
GremistaDeck.cardIndices.PushBack(236);
GremistaDeck.cardIndices.PushBack(260);
GremistaDeck.cardIndices.PushBack(261);
GremistaDeck.cardIndices.PushBack(265);
GremistaDeck.dynamicCardRequirements.PushBack(165);
GremistaDeck.dynamicCards.PushBack(15);
GremistaDeck.dynamicCardRequirements.PushBack(175);
GremistaDeck.dynamicCards.PushBack(12);
GremistaDeck.dynamicCardRequirements.PushBack(185);

GremistaDeck.dynamicCards.PushBack(10);
GremistaDeck.dynamicCardRequirements.PushBack(205);
GremistaDeck.dynamicCards.PushBack(8);
GremistaDeck.dynamicCardRequirements.PushBack(205);
GremistaDeck.dynamicCards.PushBack(9);
GremistaDeck.dynamicCardRequirements.PushBack(225);
GremistaDeck.dynamicCards.PushBack(7);
GremistaDeck.dynamicCardRequirements.PushBack(225);
GremistaDeck.dynamicCards.PushBack(12);
GremistaDeck.specialCard = 11;
GremistaDeck.leaderIndex = 2001;
enemyDecks.PushBack(GremistaDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions4(){
var ZoltanDeck : SDeckDefinition;
var LambertDeck : SDeckDefinition;
var ThalerDeck : SDeckDefinition;
ZoltanDeck.cardIndices.PushBack(1);
ZoltanDeck.cardIndices.PushBack(1);
ZoltanDeck.cardIndices.PushBack(2);
ZoltanDeck.cardIndices.PushBack(2);
ZoltanDeck.cardIndices.PushBack(3);
ZoltanDeck.cardIndices.PushBack(4);
ZoltanDeck.cardIndices.PushBack(5);
ZoltanDeck.cardIndices.PushBack(302);
ZoltanDeck.cardIndices.PushBack(307);
ZoltanDeck.cardIndices.PushBack(320);
ZoltanDeck.cardIndices.PushBack(321);
ZoltanDeck.cardIndices.PushBack(325);
ZoltanDeck.cardIndices.PushBack(326);
ZoltanDeck.cardIndices.PushBack(335);
ZoltanDeck.cardIndices.PushBack(336);
ZoltanDeck.cardIndices.PushBack(337);
ZoltanDeck.cardIndices.PushBack(340);
ZoltanDeck.cardIndices.PushBack(341);
ZoltanDeck.cardIndices.PushBack(342);
ZoltanDeck.cardIndices.PushBack(355);
ZoltanDeck.cardIndices.PushBack(365);
ZoltanDeck.cardIndices.PushBack(366);
ZoltanDeck.dynamicCardRequirements.PushBack(165);
ZoltanDeck.dynamicCards.PushBack(15);
ZoltanDeck.dynamicCardRequirements.PushBack(175);
ZoltanDeck.dynamicCards.PushBack(8);
ZoltanDeck.dynamicCardRequirements.PushBack(185);
ZoltanDeck.dynamicCards.PushBack(9);
ZoltanDeck.dynamicCardRequirements.PushBack(205);
ZoltanDeck.dynamicCards.PushBack(11);
ZoltanDeck.dynamicCardRequirements.PushBack(205);
ZoltanDeck.dynamicCards.PushBack(14);
ZoltanDeck.dynamicCardRequirements.PushBack(225);
ZoltanDeck.dynamicCards.PushBack(7);
ZoltanDeck.dynamicCardRequirements.PushBack(225);
ZoltanDeck.dynamicCards.PushBack(16);
ZoltanDeck.specialCard = 300;
ZoltanDeck.leaderIndex = 3002;
enemyDecks.PushBack(ZoltanDeck);
LambertDeck.cardIndices.PushBack(0);
LambertDeck.cardIndices.PushBack(0);
LambertDeck.cardIndices.PushBack(1);

LambertDeck.cardIndices.PushBack(2);
LambertDeck.cardIndices.PushBack(2);
LambertDeck.cardIndices.PushBack(2);
LambertDeck.cardIndices.PushBack(3);
LambertDeck.cardIndices.PushBack(6);
LambertDeck.cardIndices.PushBack(9);
LambertDeck.cardIndices.PushBack(302);
LambertDeck.cardIndices.PushBack(308);
LambertDeck.cardIndices.PushBack(309);
LambertDeck.cardIndices.PushBack(320);
LambertDeck.cardIndices.PushBack(340);
LambertDeck.cardIndices.PushBack(341);
LambertDeck.cardIndices.PushBack(342);
LambertDeck.cardIndices.PushBack(343);
LambertDeck.cardIndices.PushBack(350);
LambertDeck.cardIndices.PushBack(351);
LambertDeck.cardIndices.PushBack(360);
LambertDeck.cardIndices.PushBack(365);
LambertDeck.cardIndices.PushBack(366);
LambertDeck.dynamicCardRequirements.PushBack(165);
LambertDeck.dynamicCards.PushBack(8);
LambertDeck.dynamicCardRequirements.PushBack(175);
LambertDeck.dynamicCards.PushBack(12);
LambertDeck.dynamicCardRequirements.PushBack(185);
LambertDeck.dynamicCards.PushBack(322);
LambertDeck.dynamicCardRequirements.PushBack(205);
LambertDeck.dynamicCards.PushBack(2);
LambertDeck.dynamicCardRequirements.PushBack(205);
LambertDeck.dynamicCards.PushBack(13);
LambertDeck.dynamicCardRequirements.PushBack(225);
LambertDeck.dynamicCards.PushBack(15);
LambertDeck.dynamicCardRequirements.PushBack(225);
LambertDeck.dynamicCards.PushBack(10);
LambertDeck.specialCard = 11;
LambertDeck.leaderIndex = 3001;
enemyDecks.PushBack(LambertDeck);
ThalerDeck.cardIndices.PushBack(3);
ThalerDeck.cardIndices.PushBack(3);
ThalerDeck.cardIndices.PushBack(4);
ThalerDeck.cardIndices.PushBack(5);
ThalerDeck.cardIndices.PushBack(6);
ThalerDeck.cardIndices.PushBack(6);
ThalerDeck.cardIndices.PushBack(307);
ThalerDeck.cardIndices.PushBack(308);
ThalerDeck.cardIndices.PushBack(309);
ThalerDeck.cardIndices.PushBack(312);
ThalerDeck.cardIndices.PushBack(313);
ThalerDeck.cardIndices.PushBack(320);
ThalerDeck.cardIndices.PushBack(321);
ThalerDeck.cardIndices.PushBack(325);
ThalerDeck.cardIndices.PushBack(326);
ThalerDeck.cardIndices.PushBack(330);
ThalerDeck.cardIndices.PushBack(331);
ThalerDeck.cardIndices.PushBack(332);
ThalerDeck.cardIndices.PushBack(335);
ThalerDeck.cardIndices.PushBack(336);
ThalerDeck.cardIndices.PushBack(355);
ThalerDeck.cardIndices.PushBack(360);
ThalerDeck.cardIndices.PushBack(365);
ThalerDeck.dynamicCardRequirements.PushBack(165);

ThalerDeck.dynamicCards.PushBack(337);
ThalerDeck.dynamicCardRequirements.PushBack(175);
ThalerDeck.dynamicCards.PushBack(15);
ThalerDeck.dynamicCardRequirements.PushBack(185);
ThalerDeck.dynamicCards.PushBack(322);
ThalerDeck.dynamicCardRequirements.PushBack(205);
ThalerDeck.dynamicCards.PushBack(11);
ThalerDeck.dynamicCardRequirements.PushBack(205);
ThalerDeck.dynamicCards.PushBack(14);
ThalerDeck.dynamicCardRequirements.PushBack(225);
ThalerDeck.dynamicCards.PushBack(306);
ThalerDeck.dynamicCardRequirements.PushBack(225);
ThalerDeck.dynamicCards.PushBack(13);
ThalerDeck.specialCard = 7;
ThalerDeck.leaderIndex = 3003;
enemyDecks.PushBack(ThalerDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions5(){
var VimmeDeck : SDeckDefinition;
var ScoiaTraderDeck : SDeckDefinition;
VimmeDeck.cardIndices.PushBack(1);
VimmeDeck.cardIndices.PushBack(1);
VimmeDeck.cardIndices.PushBack(4);
VimmeDeck.cardIndices.PushBack(4);
VimmeDeck.cardIndices.PushBack(5);
VimmeDeck.cardIndices.PushBack(6);
VimmeDeck.cardIndices.PushBack(301);
VimmeDeck.cardIndices.PushBack(305);
VimmeDeck.cardIndices.PushBack(325);
VimmeDeck.cardIndices.PushBack(326);
VimmeDeck.cardIndices.PushBack(335);
VimmeDeck.cardIndices.PushBack(336);
VimmeDeck.cardIndices.PushBack(337);
VimmeDeck.cardIndices.PushBack(340);
VimmeDeck.cardIndices.PushBack(341);
VimmeDeck.cardIndices.PushBack(342);
VimmeDeck.cardIndices.PushBack(343);
VimmeDeck.cardIndices.PushBack(344);
VimmeDeck.cardIndices.PushBack(365);
VimmeDeck.cardIndices.PushBack(366);
VimmeDeck.cardIndices.PushBack(367);
VimmeDeck.dynamicCardRequirements.PushBack(165);
VimmeDeck.dynamicCards.PushBack(0);
VimmeDeck.dynamicCardRequirements.PushBack(175);
VimmeDeck.dynamicCards.PushBack(12);
VimmeDeck.dynamicCardRequirements.PushBack(185);
VimmeDeck.dynamicCards.PushBack(0);
VimmeDeck.dynamicCardRequirements.PushBack(205);
VimmeDeck.dynamicCards.PushBack(16);
VimmeDeck.dynamicCardRequirements.PushBack(205);
VimmeDeck.dynamicCards.PushBack(11);
VimmeDeck.dynamicCardRequirements.PushBack(225);
VimmeDeck.dynamicCards.PushBack(7);
VimmeDeck.dynamicCardRequirements.PushBack(225);
VimmeDeck.dynamicCards.PushBack(14);
VimmeDeck.specialCard = 8;
VimmeDeck.leaderIndex = 3002;
enemyDecks.PushBack(VimmeDeck);
ScoiaTraderDeck.cardIndices.PushBack(0);

ScoiaTraderDeck.cardIndices.PushBack(1);
ScoiaTraderDeck.cardIndices.PushBack(1);
ScoiaTraderDeck.cardIndices.PushBack(2);
ScoiaTraderDeck.cardIndices.PushBack(3);
ScoiaTraderDeck.cardIndices.PushBack(4);
ScoiaTraderDeck.cardIndices.PushBack(5);
ScoiaTraderDeck.cardIndices.PushBack(6);
ScoiaTraderDeck.cardIndices.PushBack(303);
ScoiaTraderDeck.cardIndices.PushBack(305);
ScoiaTraderDeck.cardIndices.PushBack(306);
ScoiaTraderDeck.cardIndices.PushBack(307);
ScoiaTraderDeck.cardIndices.PushBack(308);
ScoiaTraderDeck.cardIndices.PushBack(309);
ScoiaTraderDeck.cardIndices.PushBack(310);
ScoiaTraderDeck.cardIndices.PushBack(311);
ScoiaTraderDeck.cardIndices.PushBack(312);
ScoiaTraderDeck.cardIndices.PushBack(313);
ScoiaTraderDeck.cardIndices.PushBack(320);
ScoiaTraderDeck.cardIndices.PushBack(321);
ScoiaTraderDeck.cardIndices.PushBack(350);
ScoiaTraderDeck.cardIndices.PushBack(351);
ScoiaTraderDeck.cardIndices.PushBack(352);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(165);
ScoiaTraderDeck.dynamicCards.PushBack(2);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(175);
ScoiaTraderDeck.dynamicCards.PushBack(2);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(185);
ScoiaTraderDeck.dynamicCards.PushBack(8);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(205);
ScoiaTraderDeck.dynamicCards.PushBack(11);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(205);
ScoiaTraderDeck.dynamicCards.PushBack(14);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(225);
ScoiaTraderDeck.dynamicCards.PushBack(15);
ScoiaTraderDeck.dynamicCardRequirements.PushBack(225);
ScoiaTraderDeck.dynamicCards.PushBack(16);
ScoiaTraderDeck.specialCard = 10;
ScoiaTraderDeck.leaderIndex = 3001;
enemyDecks.PushBack(ScoiaTraderDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions6(){
var CrachDeck : SDeckDefinition;
var LugosDeck : SDeckDefinition;
var HermitDeck : SDeckDefinition;
CrachDeck.cardIndices.PushBack(1);
CrachDeck.cardIndices.PushBack(1);
CrachDeck.cardIndices.PushBack(2);
CrachDeck.cardIndices.PushBack(2);
CrachDeck.cardIndices.PushBack(3);
CrachDeck.cardIndices.PushBack(4);
CrachDeck.cardIndices.PushBack(4);
CrachDeck.cardIndices.PushBack(5);
CrachDeck.cardIndices.PushBack(407);
CrachDeck.cardIndices.PushBack(410);
CrachDeck.cardIndices.PushBack(415);
CrachDeck.cardIndices.PushBack(417);
CrachDeck.cardIndices.PushBack(420);
CrachDeck.cardIndices.PushBack(423);
CrachDeck.cardIndices.PushBack(425);

CrachDeck.cardIndices.PushBack(427);
CrachDeck.cardIndices.PushBack(435);
CrachDeck.cardIndices.PushBack(440);
CrachDeck.cardIndices.PushBack(443);
CrachDeck.cardIndices.PushBack(447);
CrachDeck.cardIndices.PushBack(450);
CrachDeck.cardIndices.PushBack(451);
CrachDeck.dynamicCardRequirements.PushBack(165);
CrachDeck.dynamicCards.PushBack(452);
CrachDeck.dynamicCardRequirements.PushBack(175);
CrachDeck.dynamicCards.PushBack(453);
CrachDeck.dynamicCardRequirements.PushBack(185);
CrachDeck.dynamicCards.PushBack(8);
CrachDeck.dynamicCardRequirements.PushBack(205);
CrachDeck.dynamicCards.PushBack(11);
CrachDeck.dynamicCardRequirements.PushBack(205);
CrachDeck.dynamicCards.PushBack(14);
CrachDeck.dynamicCardRequirements.PushBack(225);
CrachDeck.dynamicCards.PushBack(7);
CrachDeck.dynamicCardRequirements.PushBack(225);
CrachDeck.dynamicCards.PushBack(10);
CrachDeck.specialCard = 400;
CrachDeck.leaderIndex = 4001;
enemyDecks.PushBack(CrachDeck);
LugosDeck.cardIndices.PushBack(0);
LugosDeck.cardIndices.PushBack(0);
LugosDeck.cardIndices.PushBack(3);
LugosDeck.cardIndices.PushBack(4);
LugosDeck.cardIndices.PushBack(4);
LugosDeck.cardIndices.PushBack(5);
LugosDeck.cardIndices.PushBack(5);
LugosDeck.cardIndices.PushBack(401);
LugosDeck.cardIndices.PushBack(413);
LugosDeck.cardIndices.PushBack(417);
LugosDeck.cardIndices.PushBack(407);
LugosDeck.cardIndices.PushBack(415);
LugosDeck.cardIndices.PushBack(417);
LugosDeck.cardIndices.PushBack(423);
LugosDeck.cardIndices.PushBack(420);
LugosDeck.cardIndices.PushBack(423);
LugosDeck.cardIndices.PushBack(433);
LugosDeck.cardIndices.PushBack(440);
LugosDeck.cardIndices.PushBack(445);
LugosDeck.cardIndices.PushBack(455);
LugosDeck.cardIndices.PushBack(455);
LugosDeck.cardIndices.PushBack(456);
LugosDeck.cardIndices.PushBack(457);
LugosDeck.cardIndices.PushBack(460);
LugosDeck.cardIndices.PushBack(461);
LugosDeck.cardIndices.PushBack(463);
LugosDeck.dynamicCardRequirements.PushBack(165);
LugosDeck.dynamicCards.PushBack(462);
LugosDeck.dynamicCardRequirements.PushBack(175);
LugosDeck.dynamicCards.PushBack(2);
LugosDeck.dynamicCardRequirements.PushBack(185);
LugosDeck.dynamicCards.PushBack(2);
LugosDeck.dynamicCardRequirements.PushBack(205);
LugosDeck.dynamicCards.PushBack(11);
LugosDeck.dynamicCardRequirements.PushBack(205);
LugosDeck.dynamicCards.PushBack(8);

LugosDeck.dynamicCardRequirements.PushBack(225);
LugosDeck.dynamicCards.PushBack(2);
LugosDeck.dynamicCardRequirements.PushBack(225);
LugosDeck.dynamicCards.PushBack(10);
LugosDeck.specialCard = 464;
LugosDeck.leaderIndex = 4002;
enemyDecks.PushBack(LugosDeck);
HermitDeck.cardIndices.PushBack(2);
HermitDeck.cardIndices.PushBack(2);
HermitDeck.cardIndices.PushBack(4);
HermitDeck.cardIndices.PushBack(5);
HermitDeck.cardIndices.PushBack(6);
HermitDeck.cardIndices.PushBack(6);
HermitDeck.cardIndices.PushBack(400);
HermitDeck.cardIndices.PushBack(450);
HermitDeck.cardIndices.PushBack(451);
HermitDeck.cardIndices.PushBack(452);
HermitDeck.cardIndices.PushBack(453);
HermitDeck.cardIndices.PushBack(455);
HermitDeck.cardIndices.PushBack(456);
HermitDeck.cardIndices.PushBack(457);
HermitDeck.cardIndices.PushBack(460);
HermitDeck.cardIndices.PushBack(461);
HermitDeck.cardIndices.PushBack(462);
HermitDeck.cardIndices.PushBack(463);
HermitDeck.cardIndices.PushBack(470);
HermitDeck.cardIndices.PushBack(471);
HermitDeck.cardIndices.PushBack(472);
HermitDeck.cardIndices.PushBack(475);
HermitDeck.cardIndices.PushBack(477);
HermitDeck.dynamicCardRequirements.PushBack(165);
HermitDeck.dynamicCards.PushBack(464);
HermitDeck.dynamicCardRequirements.PushBack(175);
HermitDeck.dynamicCards.PushBack(443);
HermitDeck.dynamicCardRequirements.PushBack(185);
HermitDeck.dynamicCards.PushBack(2);
HermitDeck.dynamicCardRequirements.PushBack(205);
HermitDeck.dynamicCards.PushBack(11);
HermitDeck.dynamicCardRequirements.PushBack(205);
HermitDeck.dynamicCards.PushBack(14);
HermitDeck.dynamicCardRequirements.PushBack(225);
HermitDeck.dynamicCards.PushBack(7);
HermitDeck.dynamicCardRequirements.PushBack(225);
HermitDeck.dynamicCards.PushBack(12);
HermitDeck.specialCard = 476;
HermitDeck.leaderIndex = 4002;
enemyDecks.PushBack(HermitDeck);
/* NOP */;
}
private function SetupAIDeckDefinitions7(){
var OlivierDeck : SDeckDefinition;
var MousesackDeck : SDeckDefinition;
OlivierDeck.cardIndices.PushBack(3);
OlivierDeck.cardIndices.PushBack(4);
OlivierDeck.cardIndices.PushBack(4);
OlivierDeck.cardIndices.PushBack(5);
OlivierDeck.cardIndices.PushBack(5);
OlivierDeck.cardIndices.PushBack(403);
OlivierDeck.cardIndices.PushBack(407);
OlivierDeck.cardIndices.PushBack(410);

OlivierDeck.cardIndices.PushBack(413);
OlivierDeck.cardIndices.PushBack(415);
OlivierDeck.cardIndices.PushBack(420);
OlivierDeck.cardIndices.PushBack(425);
OlivierDeck.cardIndices.PushBack(427);
OlivierDeck.cardIndices.PushBack(440);
OlivierDeck.cardIndices.PushBack(443);
OlivierDeck.cardIndices.PushBack(447);
OlivierDeck.cardIndices.PushBack(450);
OlivierDeck.cardIndices.PushBack(451);
OlivierDeck.cardIndices.PushBack(452);
OlivierDeck.cardIndices.PushBack(453);
OlivierDeck.cardIndices.PushBack(470);
OlivierDeck.cardIndices.PushBack(471);
OlivierDeck.cardIndices.PushBack(472);
OlivierDeck.dynamicCardRequirements.PushBack(165);
OlivierDeck.dynamicCards.PushBack(15);
OlivierDeck.dynamicCardRequirements.PushBack(175);
OlivierDeck.dynamicCards.PushBack(0);
OlivierDeck.dynamicCardRequirements.PushBack(185);
OlivierDeck.dynamicCards.PushBack(0);
OlivierDeck.dynamicCardRequirements.PushBack(205);
OlivierDeck.dynamicCards.PushBack(11);
OlivierDeck.dynamicCardRequirements.PushBack(205);
OlivierDeck.dynamicCards.PushBack(8);
OlivierDeck.dynamicCardRequirements.PushBack(225);
OlivierDeck.dynamicCards.PushBack(7);
OlivierDeck.dynamicCardRequirements.PushBack(225);
OlivierDeck.dynamicCards.PushBack(12);
OlivierDeck.specialCard = -1;
OlivierDeck.leaderIndex = 4002;
enemyDecks.PushBack(OlivierDeck);
MousesackDeck.cardIndices.PushBack(0);
MousesackDeck.cardIndices.PushBack(0);
MousesackDeck.cardIndices.PushBack(1);
MousesackDeck.cardIndices.PushBack(1);
MousesackDeck.cardIndices.PushBack(2);
MousesackDeck.cardIndices.PushBack(3);
MousesackDeck.cardIndices.PushBack(4);
MousesackDeck.cardIndices.PushBack(5);
MousesackDeck.cardIndices.PushBack(6);
MousesackDeck.cardIndices.PushBack(401);
MousesackDeck.cardIndices.PushBack(407);
MousesackDeck.cardIndices.PushBack(415);
MousesackDeck.cardIndices.PushBack(417);
MousesackDeck.cardIndices.PushBack(423);
MousesackDeck.cardIndices.PushBack(450);
MousesackDeck.cardIndices.PushBack(451);
MousesackDeck.cardIndices.PushBack(452);
MousesackDeck.cardIndices.PushBack(455);
MousesackDeck.cardIndices.PushBack(456);
MousesackDeck.cardIndices.PushBack(457);
MousesackDeck.cardIndices.PushBack(460);
MousesackDeck.cardIndices.PushBack(461);
MousesackDeck.cardIndices.PushBack(462);
MousesackDeck.cardIndices.PushBack(463);
MousesackDeck.cardIndices.PushBack(470);
MousesackDeck.cardIndices.PushBack(471);
MousesackDeck.cardIndices.PushBack(472);
MousesackDeck.cardIndices.PushBack(476);

MousesackDeck.cardIndices.PushBack(477);
MousesackDeck.dynamicCardRequirements.PushBack(165);
MousesackDeck.dynamicCards.PushBack(15);
MousesackDeck.dynamicCardRequirements.PushBack(175);
MousesackDeck.dynamicCards.PushBack(12);
MousesackDeck.dynamicCardRequirements.PushBack(185);
MousesackDeck.dynamicCards.PushBack(13);
MousesackDeck.dynamicCardRequirements.PushBack(205);
MousesackDeck.dynamicCards.PushBack(11);
MousesackDeck.dynamicCardRequirements.PushBack(205);
MousesackDeck.dynamicCards.PushBack(14);
MousesackDeck.dynamicCardRequirements.PushBack(225);
MousesackDeck.dynamicCards.PushBack(2);
MousesackDeck.dynamicCardRequirements.PushBack(225);
MousesackDeck.dynamicCards.PushBack(7);
MousesackDeck.specialCard = 403;
MousesackDeck.leaderIndex = 4004;
enemyDecks.PushBack(MousesackDeck);
/* NOP */;
}
private function SetupAIDeckDefinitionsNK(){
var NKEasy : SDeckDefinition;
var NKNormal : SDeckDefinition;
var NKHard : SDeckDefinition;
NKEasy.cardIndices.PushBack(3);
NKEasy.cardIndices.PushBack(4);
NKEasy.cardIndices.PushBack(5);
NKEasy.cardIndices.PushBack(6);
NKEasy.cardIndices.PushBack(13);
NKEasy.cardIndices.PushBack(105);
NKEasy.cardIndices.PushBack(106);
NKEasy.cardIndices.PushBack(107);
NKEasy.cardIndices.PushBack(108);
NKEasy.cardIndices.PushBack(109);
NKEasy.cardIndices.PushBack(111);
NKEasy.cardIndices.PushBack(112);
NKEasy.cardIndices.PushBack(113);
NKEasy.cardIndices.PushBack(114);
NKEasy.cardIndices.PushBack(120);
NKEasy.cardIndices.PushBack(125);
NKEasy.cardIndices.PushBack(126);
NKEasy.cardIndices.PushBack(130);
NKEasy.cardIndices.PushBack(135);
NKEasy.cardIndices.PushBack(136);
NKEasy.cardIndices.PushBack(141);
NKEasy.cardIndices.PushBack(145);
NKEasy.cardIndices.PushBack(150);
NKEasy.cardIndices.PushBack(150);
NKEasy.cardIndices.PushBack(175);
NKEasy.specialCard = -1;
NKEasy.leaderIndex = 1001;
enemyDecks.PushBack(NKEasy);
NKNormal.cardIndices.PushBack(4);
NKNormal.cardIndices.PushBack(4);
NKNormal.cardIndices.PushBack(1);
NKNormal.cardIndices.PushBack(1);
NKNormal.cardIndices.PushBack(0);
NKNormal.cardIndices.PushBack(2);
NKNormal.cardIndices.PushBack(6);
NKNormal.cardIndices.PushBack(100);

NKNormal.cardIndices.PushBack(101);
NKNormal.cardIndices.PushBack(105);
NKNormal.cardIndices.PushBack(106);
NKNormal.cardIndices.PushBack(107);
NKNormal.cardIndices.PushBack(109);
NKNormal.cardIndices.PushBack(113);
NKNormal.cardIndices.PushBack(114);
NKNormal.cardIndices.PushBack(121);
NKNormal.cardIndices.PushBack(120);
NKNormal.cardIndices.PushBack(130);
NKNormal.cardIndices.PushBack(131);
NKNormal.cardIndices.PushBack(140);
NKNormal.cardIndices.PushBack(141);
NKNormal.cardIndices.PushBack(145);
NKNormal.cardIndices.PushBack(146);
NKNormal.cardIndices.PushBack(150);
NKNormal.cardIndices.PushBack(151);
NKNormal.cardIndices.PushBack(175);
NKNormal.dynamicCardRequirements.PushBack(215);
NKNormal.dynamicCards.PushBack(12);
NKNormal.dynamicCardRequirements.PushBack(220);
NKNormal.dynamicCards.PushBack(11);
NKNormal.dynamicCardRequirements.PushBack(230);
NKNormal.dynamicCards.PushBack(10);
NKNormal.specialCard = -1;
NKNormal.leaderIndex = 1002;
enemyDecks.PushBack(NKNormal);
NKHard.cardIndices.PushBack(0);
NKHard.cardIndices.PushBack(1);
NKHard.cardIndices.PushBack(1);
NKHard.cardIndices.PushBack(2);
NKHard.cardIndices.PushBack(2);
NKHard.cardIndices.PushBack(3);
NKHard.cardIndices.PushBack(4);
NKHard.cardIndices.PushBack(6);
NKHard.cardIndices.PushBack(7);
NKHard.cardIndices.PushBack(9);
NKHard.cardIndices.PushBack(10);
NKHard.cardIndices.PushBack(11);
NKHard.cardIndices.PushBack(12);
NKHard.cardIndices.PushBack(100);
NKHard.cardIndices.PushBack(101);
NKHard.cardIndices.PushBack(102);
NKHard.cardIndices.PushBack(103);
NKHard.cardIndices.PushBack(105);
NKHard.cardIndices.PushBack(109);
NKHard.cardIndices.PushBack(116);
NKHard.cardIndices.PushBack(111);
NKHard.cardIndices.PushBack(121);
NKHard.cardIndices.PushBack(120);
NKHard.cardIndices.PushBack(140);
NKHard.cardIndices.PushBack(141);
NKHard.cardIndices.PushBack(145);
NKHard.cardIndices.PushBack(146);
NKHard.cardIndices.PushBack(150);
NKHard.cardIndices.PushBack(175);
NKHard.specialCard = -1;
NKHard.leaderIndex = 1003;
enemyDecks.PushBack(NKHard);
/* NOP */;

}
private function SetupAIDeckDefinitionsNilf(){
var NilfEasy : SDeckDefinition;
var NilfNormal : SDeckDefinition;
var NilfHard : SDeckDefinition;
NilfEasy.cardIndices.PushBack(3);
NilfEasy.cardIndices.PushBack(4);
NilfEasy.cardIndices.PushBack(5);
NilfEasy.cardIndices.PushBack(6);
NilfEasy.cardIndices.PushBack(205);
NilfEasy.cardIndices.PushBack(207);
NilfEasy.cardIndices.PushBack(209);
NilfEasy.cardIndices.PushBack(210);
NilfEasy.cardIndices.PushBack(211);
NilfEasy.cardIndices.PushBack(212);
NilfEasy.cardIndices.PushBack(213);
NilfEasy.cardIndices.PushBack(215);
NilfEasy.cardIndices.PushBack(217);
NilfEasy.cardIndices.PushBack(218);
NilfEasy.cardIndices.PushBack(219);
NilfEasy.cardIndices.PushBack(221);
NilfEasy.cardIndices.PushBack(241);
NilfEasy.cardIndices.PushBack(245);
NilfEasy.cardIndices.PushBack(250);
NilfEasy.cardIndices.PushBack(251);
NilfEasy.specialCard = 260;
NilfEasy.leaderIndex = 2001;
enemyDecks.PushBack(NilfEasy);
NilfNormal.cardIndices.PushBack(0);
NilfNormal.cardIndices.PushBack(1);
NilfNormal.cardIndices.PushBack(1);
NilfNormal.cardIndices.PushBack(2);
NilfNormal.cardIndices.PushBack(2);
NilfNormal.cardIndices.PushBack(3);
NilfNormal.cardIndices.PushBack(3);
NilfNormal.cardIndices.PushBack(6);
NilfNormal.cardIndices.PushBack(200);
NilfNormal.cardIndices.PushBack(201);
NilfNormal.cardIndices.PushBack(203);
NilfNormal.cardIndices.PushBack(207);
NilfNormal.cardIndices.PushBack(209);
NilfNormal.cardIndices.PushBack(210);
NilfNormal.cardIndices.PushBack(208);
NilfNormal.cardIndices.PushBack(213);
NilfNormal.cardIndices.PushBack(218);
NilfNormal.cardIndices.PushBack(230);
NilfNormal.cardIndices.PushBack(235);
NilfNormal.cardIndices.PushBack(236);
NilfNormal.cardIndices.PushBack(240);
NilfNormal.cardIndices.PushBack(245);
NilfNormal.cardIndices.PushBack(246);
NilfNormal.cardIndices.PushBack(247);
NilfNormal.cardIndices.PushBack(250);
NilfNormal.cardIndices.PushBack(251);
NilfNormal.cardIndices.PushBack(252);
NilfNormal.cardIndices.PushBack(260);
NilfNormal.cardIndices.PushBack(261);
NilfNormal.dynamicCardRequirements.PushBack(215);
NilfNormal.dynamicCards.PushBack(15);
NilfNormal.dynamicCardRequirements.PushBack(220);

NilfNormal.dynamicCards.PushBack(202);
NilfNormal.dynamicCardRequirements.PushBack(230);
NilfNormal.dynamicCards.PushBack(7);
NilfNormal.specialCard = -1;
NilfNormal.leaderIndex = 2002;
enemyDecks.PushBack(NilfNormal);
NilfHard.cardIndices.PushBack(0);
NilfHard.cardIndices.PushBack(1);
NilfHard.cardIndices.PushBack(1);
NilfHard.cardIndices.PushBack(2);
NilfHard.cardIndices.PushBack(2);
NilfHard.cardIndices.PushBack(15);
NilfHard.cardIndices.PushBack(16);
NilfHard.cardIndices.PushBack(200);
NilfHard.cardIndices.PushBack(201);
NilfHard.cardIndices.PushBack(202);
NilfHard.cardIndices.PushBack(203);
NilfHard.cardIndices.PushBack(208);
NilfHard.cardIndices.PushBack(213);
NilfHard.cardIndices.PushBack(214);
NilfHard.cardIndices.PushBack(218);
NilfHard.cardIndices.PushBack(230);
NilfHard.cardIndices.PushBack(231);
NilfHard.cardIndices.PushBack(235);
NilfHard.cardIndices.PushBack(236);
NilfHard.cardIndices.PushBack(240);
NilfHard.cardIndices.PushBack(241);
NilfHard.cardIndices.PushBack(245);
NilfHard.cardIndices.PushBack(246);
NilfHard.cardIndices.PushBack(247);
NilfHard.cardIndices.PushBack(250);
NilfHard.cardIndices.PushBack(251);
NilfHard.cardIndices.PushBack(252);
NilfHard.specialCard = 261;
NilfHard.leaderIndex = 2003;
enemyDecks.PushBack(NilfHard);
/* NOP */;
}
private function SetupAIDeckDefinitionsScoia(){
var ScoiaEasy : SDeckDefinition;
var ScoiaNormal : SDeckDefinition;
var ScoiaHard : SDeckDefinition;
ScoiaEasy.cardIndices.PushBack(3);
ScoiaEasy.cardIndices.PushBack(4);
ScoiaEasy.cardIndices.PushBack(5);
ScoiaEasy.cardIndices.PushBack(6);
ScoiaEasy.cardIndices.PushBack(306);
ScoiaEasy.cardIndices.PushBack(307);
ScoiaEasy.cardIndices.PushBack(308);
ScoiaEasy.cardIndices.PushBack(309);
ScoiaEasy.cardIndices.PushBack(310);
ScoiaEasy.cardIndices.PushBack(311);
ScoiaEasy.cardIndices.PushBack(312);
ScoiaEasy.cardIndices.PushBack(320);
ScoiaEasy.cardIndices.PushBack(325);
ScoiaEasy.cardIndices.PushBack(330);
ScoiaEasy.cardIndices.PushBack(331);
ScoiaEasy.cardIndices.PushBack(335);
ScoiaEasy.cardIndices.PushBack(336);
ScoiaEasy.cardIndices.PushBack(337);

ScoiaEasy.cardIndices.PushBack(340);
ScoiaEasy.cardIndices.PushBack(350);
ScoiaEasy.cardIndices.PushBack(351);
ScoiaEasy.cardIndices.PushBack(355);
ScoiaEasy.cardIndices.PushBack(360);
ScoiaEasy.specialCard = -1;
ScoiaEasy.leaderIndex = 3001;
enemyDecks.PushBack(ScoiaEasy);
ScoiaNormal.cardIndices.PushBack(0);
ScoiaNormal.cardIndices.PushBack(1);
ScoiaNormal.cardIndices.PushBack(2);
ScoiaNormal.cardIndices.PushBack(2);
ScoiaNormal.cardIndices.PushBack(3);
ScoiaNormal.cardIndices.PushBack(6);
ScoiaNormal.cardIndices.PushBack(5);
ScoiaNormal.cardIndices.PushBack(16);
ScoiaNormal.cardIndices.PushBack(301);
ScoiaNormal.cardIndices.PushBack(302);
ScoiaNormal.cardIndices.PushBack(303);
ScoiaNormal.cardIndices.PushBack(305);
ScoiaNormal.cardIndices.PushBack(306);
ScoiaNormal.cardIndices.PushBack(307);
ScoiaNormal.cardIndices.PushBack(308);
ScoiaNormal.cardIndices.PushBack(309);
ScoiaNormal.cardIndices.PushBack(313);
ScoiaNormal.cardIndices.PushBack(320);
ScoiaNormal.cardIndices.PushBack(321);
ScoiaNormal.cardIndices.PushBack(322);
ScoiaNormal.cardIndices.PushBack(325);
ScoiaNormal.cardIndices.PushBack(326);
ScoiaNormal.cardIndices.PushBack(330);
ScoiaNormal.cardIndices.PushBack(331);
ScoiaNormal.cardIndices.PushBack(335);
ScoiaNormal.cardIndices.PushBack(336);
ScoiaNormal.cardIndices.PushBack(337);
ScoiaNormal.cardIndices.PushBack(365);
ScoiaNormal.cardIndices.PushBack(366);
ScoiaNormal.cardIndices.PushBack(367);
ScoiaNormal.dynamicCardRequirements.PushBack(215);
ScoiaNormal.dynamicCards.PushBack(12);
ScoiaNormal.dynamicCardRequirements.PushBack(220);
ScoiaNormal.dynamicCards.PushBack(15);
ScoiaNormal.dynamicCardRequirements.PushBack(230);
ScoiaNormal.dynamicCards.PushBack(10);
ScoiaNormal.specialCard = -1;
ScoiaNormal.leaderIndex = 3002;
enemyDecks.PushBack(ScoiaNormal);
ScoiaHard.cardIndices.PushBack(3);
ScoiaHard.cardIndices.PushBack(1);
ScoiaHard.cardIndices.PushBack(1);
ScoiaHard.cardIndices.PushBack(2);
ScoiaHard.cardIndices.PushBack(2);
ScoiaHard.cardIndices.PushBack(0);
ScoiaHard.cardIndices.PushBack(15);
ScoiaHard.cardIndices.PushBack(16);
ScoiaHard.cardIndices.PushBack(7);
ScoiaHard.cardIndices.PushBack(12);
ScoiaHard.cardIndices.PushBack(10);
ScoiaHard.cardIndices.PushBack(300);
ScoiaHard.cardIndices.PushBack(301);

ScoiaHard.cardIndices.PushBack(302);
ScoiaHard.cardIndices.PushBack(303);
ScoiaHard.cardIndices.PushBack(305);
ScoiaHard.cardIndices.PushBack(306);
ScoiaHard.cardIndices.PushBack(308);
ScoiaHard.cardIndices.PushBack(309);
ScoiaHard.cardIndices.PushBack(313);
ScoiaHard.cardIndices.PushBack(320);
ScoiaHard.cardIndices.PushBack(321);
ScoiaHard.cardIndices.PushBack(322);
ScoiaHard.cardIndices.PushBack(325);
ScoiaHard.cardIndices.PushBack(326);
ScoiaHard.cardIndices.PushBack(365);
ScoiaHard.cardIndices.PushBack(366);
ScoiaHard.cardIndices.PushBack(367);
ScoiaHard.specialCard = -1;
ScoiaHard.leaderIndex = 3003;
enemyDecks.PushBack(ScoiaHard);
/* NOP */;
}
private function SetupAIDeckDefinitionsNML(){
var NMLEasy : SDeckDefinition;
var NMLNormal : SDeckDefinition;
var NMLHard : SDeckDefinition;
NMLEasy.cardIndices.PushBack(3);
NMLEasy.cardIndices.PushBack(4);
NMLEasy.cardIndices.PushBack(5);
NMLEasy.cardIndices.PushBack(6);
NMLEasy.cardIndices.PushBack(405);
NMLEasy.cardIndices.PushBack(407);
NMLEasy.cardIndices.PushBack(410);
NMLEasy.cardIndices.PushBack(413);
NMLEasy.cardIndices.PushBack(415);
NMLEasy.cardIndices.PushBack(417);
NMLEasy.cardIndices.PushBack(420);
NMLEasy.cardIndices.PushBack(423);
NMLEasy.cardIndices.PushBack(425);
NMLEasy.cardIndices.PushBack(427);
NMLEasy.cardIndices.PushBack(430);
NMLEasy.cardIndices.PushBack(433);
NMLEasy.cardIndices.PushBack(435);
NMLEasy.cardIndices.PushBack(437);
NMLEasy.cardIndices.PushBack(450);
NMLEasy.cardIndices.PushBack(455);
NMLEasy.cardIndices.PushBack(456);
NMLEasy.cardIndices.PushBack(460);
NMLEasy.cardIndices.PushBack(470);
NMLEasy.cardIndices.PushBack(475);
NMLEasy.specialCard = -1;
NMLEasy.leaderIndex = 4001;
enemyDecks.PushBack(NMLEasy);
NMLNormal.cardIndices.PushBack(4);
NMLNormal.cardIndices.PushBack(5);
NMLNormal.cardIndices.PushBack(1);
NMLNormal.cardIndices.PushBack(1);
NMLNormal.cardIndices.PushBack(2);
NMLNormal.cardIndices.PushBack(2);
NMLNormal.cardIndices.PushBack(6);
NMLNormal.cardIndices.PushBack(0);
NMLNormal.cardIndices.PushBack(400);

NMLNormal.cardIndices.PushBack(402);
NMLNormal.cardIndices.PushBack(403);
NMLNormal.cardIndices.PushBack(407);
NMLNormal.cardIndices.PushBack(410);
NMLNormal.cardIndices.PushBack(415);
NMLNormal.cardIndices.PushBack(417);
NMLNormal.cardIndices.PushBack(423);
NMLNormal.cardIndices.PushBack(425);
NMLNormal.cardIndices.PushBack(450);
NMLNormal.cardIndices.PushBack(451);
NMLNormal.cardIndices.PushBack(452);
NMLNormal.cardIndices.PushBack(453);
NMLNormal.cardIndices.PushBack(460);
NMLNormal.cardIndices.PushBack(463);
NMLNormal.cardIndices.PushBack(461);
NMLNormal.cardIndices.PushBack(462);
NMLNormal.cardIndices.PushBack(464);
NMLNormal.cardIndices.PushBack(475);
NMLNormal.cardIndices.PushBack(476);
NMLNormal.cardIndices.PushBack(477);
NMLNormal.dynamicCardRequirements.PushBack(215);
NMLNormal.dynamicCards.PushBack(401);
NMLNormal.dynamicCardRequirements.PushBack(220);
NMLNormal.dynamicCards.PushBack(16);
NMLNormal.dynamicCardRequirements.PushBack(230);
NMLNormal.dynamicCards.PushBack(15);
NMLNormal.specialCard = -1;
NMLNormal.leaderIndex = 4002;
enemyDecks.PushBack(NMLNormal);
NMLHard.cardIndices.PushBack(1);
NMLHard.cardIndices.PushBack(1);
NMLHard.cardIndices.PushBack(2);
NMLHard.cardIndices.PushBack(2);
NMLHard.cardIndices.PushBack(0);
NMLHard.cardIndices.PushBack(15);
NMLHard.cardIndices.PushBack(16);
NMLHard.cardIndices.PushBack(401);
NMLHard.cardIndices.PushBack(402);
NMLHard.cardIndices.PushBack(403);
NMLHard.cardIndices.PushBack(407);
NMLHard.cardIndices.PushBack(450);
NMLHard.cardIndices.PushBack(451);
NMLHard.cardIndices.PushBack(452);
NMLHard.cardIndices.PushBack(455);
NMLHard.cardIndices.PushBack(456);
NMLHard.cardIndices.PushBack(457);
NMLHard.cardIndices.PushBack(460);
NMLHard.cardIndices.PushBack(463);
NMLHard.cardIndices.PushBack(461);
NMLHard.cardIndices.PushBack(462);
NMLHard.cardIndices.PushBack(464);
NMLHard.cardIndices.PushBack(470);
NMLHard.cardIndices.PushBack(471);
NMLHard.cardIndices.PushBack(472);
NMLHard.cardIndices.PushBack(475);
NMLHard.cardIndices.PushBack(476);
NMLHard.cardIndices.PushBack(477);
NMLHard.specialCard = -1;
NMLHard.leaderIndex = 4003;
enemyDecks.PushBack(NMLHard);

/* NOP */;
}
private function SetupAIDeckDefinitionsPrologue(){
var NilfPrologue : SDeckDefinition;
NilfPrologue.cardIndices.PushBack(3);
NilfPrologue.cardIndices.PushBack(4);
NilfPrologue.cardIndices.PushBack(5);
NilfPrologue.cardIndices.PushBack(6);
NilfPrologue.cardIndices.PushBack(205);
NilfPrologue.cardIndices.PushBack(207);
NilfPrologue.cardIndices.PushBack(209);
NilfPrologue.cardIndices.PushBack(210);
NilfPrologue.cardIndices.PushBack(211);
NilfPrologue.cardIndices.PushBack(212);
NilfPrologue.cardIndices.PushBack(215);
NilfPrologue.cardIndices.PushBack(215);
NilfPrologue.cardIndices.PushBack(217);
NilfPrologue.cardIndices.PushBack(221);
NilfPrologue.cardIndices.PushBack(221);
NilfPrologue.cardIndices.PushBack(241);
NilfPrologue.cardIndices.PushBack(245);
NilfPrologue.cardIndices.PushBack(250);
NilfPrologue.cardIndices.PushBack(251);
NilfPrologue.specialCard = 219;
NilfPrologue.leaderIndex = 2001;
enemyDecks.PushBack(NilfPrologue);
/* NOP */;
}
private function SetupAIDeckDefinitionsTournament1(){
var NKTournament : SDeckDefinition;
var NilfTournament : SDeckDefinition;
NKTournament.cardIndices.PushBack(2);
NKTournament.cardIndices.PushBack(2);
NKTournament.cardIndices.PushBack(0);
NKTournament.cardIndices.PushBack(1);
NKTournament.cardIndices.PushBack(1);
NKTournament.cardIndices.PushBack(3);
NKTournament.cardIndices.PushBack(3);
NKTournament.cardIndices.PushBack(4);
NKTournament.cardIndices.PushBack(102);
NKTournament.cardIndices.PushBack(103);
NKTournament.cardIndices.PushBack(105);
NKTournament.cardIndices.PushBack(109);
NKTournament.cardIndices.PushBack(116);
NKTournament.cardIndices.PushBack(120);
NKTournament.cardIndices.PushBack(140);
NKTournament.cardIndices.PushBack(141);
NKTournament.cardIndices.PushBack(145);
NKTournament.cardIndices.PushBack(160);
NKTournament.cardIndices.PushBack(161);
NKTournament.cardIndices.PushBack(170);
NKTournament.cardIndices.PushBack(175);
NKTournament.dynamicCardRequirements.PushBack(150);
NKTournament.dynamicCards.PushBack(13);
NKTournament.dynamicCardRequirements.PushBack(165);
NKTournament.dynamicCards.PushBack(151);
NKTournament.dynamicCardRequirements.PushBack(170);
NKTournament.dynamicCards.PushBack(12);
NKTournament.dynamicCardRequirements.PushBack(180);
NKTournament.dynamicCards.PushBack(11);

NKTournament.dynamicCardRequirements.PushBack(180);
NKTournament.dynamicCards.PushBack(7);
NKTournament.dynamicCardRequirements.PushBack(180);
NKTournament.dynamicCards.PushBack(15);
NKTournament.dynamicCardRequirements.PushBack(190);
NKTournament.dynamicCards.PushBack(10);
NKTournament.dynamicCardRequirements.PushBack(190);
NKTournament.dynamicCards.PushBack(9);
NKTournament.specialCard = 16;
NKTournament.leaderIndex = 1004;
enemyDecks.PushBack(NKTournament);
NilfTournament.cardIndices.PushBack(0);
NilfTournament.cardIndices.PushBack(0);
NilfTournament.cardIndices.PushBack(0);
NilfTournament.cardIndices.PushBack(1);
NilfTournament.cardIndices.PushBack(1);
NilfTournament.cardIndices.PushBack(2);
NilfTournament.cardIndices.PushBack(2);
NilfTournament.cardIndices.PushBack(6);
NilfTournament.cardIndices.PushBack(200);
NilfTournament.cardIndices.PushBack(201);
NilfTournament.cardIndices.PushBack(202);
NilfTournament.cardIndices.PushBack(203);
NilfTournament.cardIndices.PushBack(208);
NilfTournament.cardIndices.PushBack(213);
NilfTournament.cardIndices.PushBack(214);
NilfTournament.cardIndices.PushBack(218);
NilfTournament.cardIndices.PushBack(230);
NilfTournament.cardIndices.PushBack(231);
NilfTournament.cardIndices.PushBack(235);
NilfTournament.cardIndices.PushBack(236);
NilfTournament.cardIndices.PushBack(240);
NilfTournament.cardIndices.PushBack(241);
NilfTournament.cardIndices.PushBack(260);
NilfTournament.cardIndices.PushBack(261);
NilfTournament.dynamicCardRequirements.PushBack(145);
NilfTournament.dynamicCards.PushBack(15);
NilfTournament.dynamicCardRequirements.PushBack(160);
NilfTournament.dynamicCards.PushBack(16);
NilfTournament.dynamicCardRequirements.PushBack(160);
NilfTournament.dynamicCards.PushBack(12);
NilfTournament.dynamicCardRequirements.PushBack(170);
NilfTournament.dynamicCards.PushBack(248);
NilfTournament.dynamicCardRequirements.PushBack(170);
NilfTournament.dynamicCards.PushBack(11);
NilfTournament.dynamicCardRequirements.PushBack(180);
NilfTournament.dynamicCards.PushBack(7);
NilfTournament.dynamicCardRequirements.PushBack(190);
NilfTournament.dynamicCards.PushBack(9);
NilfTournament.specialCard = -1;
NilfTournament.leaderIndex = 2004;
enemyDecks.PushBack(NilfTournament);
/* NOP */;
}
private function SetupAIDeckDefinitionsTournament2(){
var NMLTournament : SDeckDefinition;
var ScoiaTournament : SDeckDefinition;
ScoiaTournament.cardIndices.PushBack(0);
ScoiaTournament.cardIndices.PushBack(1);
ScoiaTournament.cardIndices.PushBack(2);

ScoiaTournament.cardIndices.PushBack(2);
ScoiaTournament.cardIndices.PushBack(3);
ScoiaTournament.cardIndices.PushBack(4);
ScoiaTournament.cardIndices.PushBack(5);
ScoiaTournament.cardIndices.PushBack(301);
ScoiaTournament.cardIndices.PushBack(302);
ScoiaTournament.cardIndices.PushBack(303);
ScoiaTournament.cardIndices.PushBack(305);
ScoiaTournament.cardIndices.PushBack(306);
ScoiaTournament.cardIndices.PushBack(307);
ScoiaTournament.cardIndices.PushBack(308);
ScoiaTournament.cardIndices.PushBack(309);
ScoiaTournament.cardIndices.PushBack(313);
ScoiaTournament.cardIndices.PushBack(320);
ScoiaTournament.cardIndices.PushBack(321);
ScoiaTournament.cardIndices.PushBack(322);
ScoiaTournament.cardIndices.PushBack(365);
ScoiaTournament.cardIndices.PushBack(366);
ScoiaTournament.cardIndices.PushBack(367);
ScoiaTournament.dynamicCardRequirements.PushBack(145);
ScoiaTournament.dynamicCards.PushBack(15);
ScoiaTournament.dynamicCardRequirements.PushBack(150);
ScoiaTournament.dynamicCards.PushBack(12);
ScoiaTournament.dynamicCardRequirements.PushBack(170);
ScoiaTournament.dynamicCards.PushBack(300);
ScoiaTournament.dynamicCardRequirements.PushBack(180);
ScoiaTournament.dynamicCards.PushBack(11);
ScoiaTournament.dynamicCardRequirements.PushBack(180);
ScoiaTournament.dynamicCards.PushBack(14);
ScoiaTournament.dynamicCardRequirements.PushBack(190);
ScoiaTournament.dynamicCards.PushBack(7);
ScoiaTournament.dynamicCardRequirements.PushBack(190);
ScoiaTournament.dynamicCards.PushBack(10);
ScoiaTournament.specialCard = -1;
ScoiaTournament.leaderIndex = 3004;
enemyDecks.PushBack(ScoiaTournament);
NMLTournament.cardIndices.PushBack(0);
NMLTournament.cardIndices.PushBack(0);
NMLTournament.cardIndices.PushBack(1);
NMLTournament.cardIndices.PushBack(1);
NMLTournament.cardIndices.PushBack(5);
NMLTournament.cardIndices.PushBack(5);
NMLTournament.cardIndices.PushBack(6);
NMLTournament.cardIndices.PushBack(6);
NMLTournament.cardIndices.PushBack(401);
NMLTournament.cardIndices.PushBack(402);
NMLTournament.cardIndices.PushBack(403);
NMLTournament.cardIndices.PushBack(407);
NMLTournament.cardIndices.PushBack(450);
NMLTournament.cardIndices.PushBack(451);
NMLTournament.cardIndices.PushBack(452);
NMLTournament.cardIndices.PushBack(460);
NMLTournament.cardIndices.PushBack(463);
NMLTournament.cardIndices.PushBack(461);
NMLTournament.cardIndices.PushBack(462);
NMLTournament.cardIndices.PushBack(464);
NMLTournament.cardIndices.PushBack(475);
NMLTournament.cardIndices.PushBack(476);
NMLTournament.cardIndices.PushBack(477);
NMLTournament.dynamicCardRequirements.PushBack(145);

NMLTournament.dynamicCards.PushBack(1);
NMLTournament.dynamicCardRequirements.PushBack(155);
NMLTournament.dynamicCards.PushBack(11);
NMLTournament.dynamicCardRequirements.PushBack(160);
NMLTournament.dynamicCards.PushBack(12);
NMLTournament.dynamicCardRequirements.PushBack(160);
NMLTournament.dynamicCards.PushBack(2);
NMLTournament.dynamicCardRequirements.PushBack(170);
NMLTournament.dynamicCards.PushBack(15);
NMLTournament.dynamicCardRequirements.PushBack(175);
NMLTournament.dynamicCards.PushBack(14);
NMLTournament.dynamicCardRequirements.PushBack(180);
NMLTournament.dynamicCards.PushBack(13);
NMLTournament.dynamicCardRequirements.PushBack(190);
NMLTournament.dynamicCards.PushBack(7);
NMLTournament.dynamicCardRequirements.PushBack(190);
NMLTournament.dynamicCards.PushBack(16);
NMLTournament.specialCard = 401;
NMLTournament.leaderIndex = 4004;
enemyDecks.PushBack(NMLTournament);
/* NOP */;
}
public function GwentLeadersNametoInt(val : CName) : Int32{
switch(val){
case 'gwint_card_foltest_bronze':
return 1002;
case 'gwint_card_foltest_silver':
return 1003;
case 'gwint_card_foltest_gold':
return 1004;
case 'gwint_card_emhyr_bronze':
return 2002;
case 'gwint_card_emhyr_silver':
return 2003;
case 'gwint_card_emhyr_gold':
return 2004;
case 'gwint_card_francesca_bronze':
return 3002;
case 'gwint_card_francesca_silver':
return 3003;
case 'gwint_card_francesca_gold':
return 3004;
case 'gwint_card_eredin_bronze':
return 4002;
case 'gwint_card_eredin_silver':
return 4003;
case 'gwint_card_eredin_gold':
return 4004;
default:
}
return 0;
/* NOP */;
}
public function GwentNrkdNameToInt(val : CName) : Int32{
switch(val){
case 'gwint_card_vernon':
return 100;
case 'gwint_card_natalis':
return 101;
case 'gwint_card_esterad':

return 102;
case 'gwint_card_philippa':
return 103;
case 'gwint_card_thaler':
return 105;
case 'gwint_card_dijkstra':
return 109;
case 'gwint_card_trebuchet':
return 121;
case 'gwint_card_siege_tower':
return 170;
case 'gwint_card_ballista':
return 146;
case 'gwint_card_siegfried':
return 107;
case 'gwint_card_blue_stripes':
return 160;
case 'gwint_card_blue_stripes2':
return 160;
case 'gwint_card_blue_stripes3':
return 160;
case 'gwint_card_crinfrid':
return 130;
case 'gwint_card_crinfrid2':
return 130;
case 'gwint_card_crinfrid3':
return 130;
case 'gwint_card_catapult':
return 140;
case 'gwint_card_catapult2':
return 140;
case 'gwint_card_stennis':
return 116;
case 'gwint_card_poor_infantry':
return 125;
case 'gwint_card_poor_infantry2':
return 126;
case 'gwint_card_poor_infantry3':
return 127;
case 'gwint_card_kaedwen':
return 150;
case 'gwint_card_kaedwen2':
return 151;
case 'gwint_card_dun_banner_medic':
return 175;
default:
}
return 0;
/* NOP */;
}
public function GwentNlfgNameToInt(val : CName) : Int32{
switch(val){
case 'gwint_card_letho':
return 200;
case 'gwint_card_black_archer':
return 235;
case 'gwint_card_black_archer2':
return 236;
case 'gwint_card_menno':
return 201;

case 'gwint_card_moorvran':
return 202;
case 'gwint_card_tibor':
return 203;
case 'gwint_card_albrich':
return 205;
case 'gwint_card_combat_engineer':
return 255;
case 'gwint_card_assire':
return 206;
case 'gwint_card_fringilla':
return 208;
case 'gwint_card_cynthia':
return 207;
case 'gwint_card_morteisen':
return 209;
case 'gwint_card_rainfarn':
return 210;
case 'gwint_card_renuald':
return 211;
case 'gwint_card_rotten':
return 212;
case 'gwint_card_shilard':
return 213;
case 'gwint_card_sweers':
return 215;
case 'gwint_card_vanhemar':
return 217;
case 'gwint_card_vattier':
return 218;
case 'gwint_card_vreemde':
return 219;
case 'gwint_card_cahir':
return 220;
case 'gwint_card_puttkammer':
return 221;
case 'gwint_card_heavy_zerri':
return 240;
case 'gwint_card_zerri':
return 241;
case 'gwint_card_impera_brigade':
return 245;
case 'gwint_card_impera_brigade2':
return 245;
case 'gwint_card_impera_brigade3':
return 245;
case 'gwint_card_impera_brigade4':
return 245;
case 'gwint_card_archer_support':
return 230;
case 'gwint_card_archer_support2':
return 231;
case 'gwint_card_siege_support':
return 265;
case 'gwint_card_nausicaa':
return 250;
case 'gwint_card_nausicaa2':
return 250;
case 'gwint_card_nausicaa3':
return 250;

case 'gwint_card_stefan':
return 214;
case 'gwint_card_young_emissary':
return 260;
case 'gwint_card_young_emissary2':
return 261;
default:
}
return 0;
/* NOP */;
}
public function GwentSctlNameToInt(val : CName) : Int32{
switch(val){
case 'gwint_card_eithne':
return 300;
case 'gwint_card_saskia':
return 301;
case 'gwint_card_isengrim':
return 302;
case 'gwint_card_iorveth':
return 303;
case 'gwint_card_milva':
return 306;
case 'gwint_card_dennis':
return 305;
case 'gwint_card_ida':
return 307;
case 'gwint_card_filavandrel':
return 308;
case 'gwint_card_yaevinn':
return 309;
case 'gwint_card_toruviel':
return 310;
case 'gwint_card_riordain':
return 311;
case 'gwint_card_ciaran':
return 312;
case 'gwint_card_barclay':
return 313;
case 'gwint_card_havekar_support':
return 320;
case 'gwint_card_havekar_support2':
return 321;
case 'gwint_card_havekar_support3':
return 322;
case 'gwint_card_vrihedd_brigade':
return 325;
case 'gwint_card_vrihedd_brigade2':
return 326;
case 'gwint_card_dol_infantry':
return 330;
case 'gwint_card_dol_infantry2':
return 331;
case 'gwint_card_dol_infantry3':
return 332;
case 'gwint_card_dol_dwarf':
return 335;
case 'gwint_card_dol_dwarf2':
return 336;
case 'gwint_card_dol_dwarf3':

return 337;
case 'gwint_card_mahakam':
return 340;
case 'gwint_card_mahakam2':
return 341;
case 'gwint_card_mahakam3':
return 342;
case 'gwint_card_mahakam4':
return 343;
case 'gwint_card_mahakam5':
return 344;
case 'gwint_card_elf_skirmisher':
return 350;
case 'gwint_card_elf_skirmisher2':
return 351;
case 'gwint_card_elf_skirmisher3':
return 352;
case 'gwint_card_vrihedd_cadet':
return 355;
case 'gwint_card_dol_archer':
return 360;
case 'gwint_card_havekar_nurse':
return 365;
case 'gwint_card_havekar_nurse2':
return 366;
case 'gwint_card_havekar_nurse3':
return 367;
default:
}
return 0;
/* NOP */;
}
public function GwentMstrNameToInt(val : CName) : Int32{
switch(val){
case 'gwint_card_draug':
return 400;
case 'gwint_card_kayran':
return 401;
case 'gwint_card_imlerith':
return 402;
case 'gwint_card_leshen':
return 403;
case 'gwint_card_forktail':
return 405;
case 'gwint_card_earth_elemental':
return 407;
case 'gwint_card_fiend':
return 410;
case 'gwint_card_plague_maiden':
return 413;
case 'gwint_card_griffin':
return 415;
case 'gwint_card_werewolf':
return 417;
case 'gwint_card_botchling':
return 420;
case 'gwint_card_frightener':
return 423;
case 'gwint_card_ice_giant':
return 425;

case 'gwint_card_endrega':
return 427;
case 'gwint_card_harpy':
return 430;
case 'gwint_card_cockatrice':
return 433;
case 'gwint_card_gargoyle':
return 435;
case 'gwint_card_celaeno_harpy':
return 437;
case 'gwint_card_grave_hag':
return 440;
case 'gwint_card_fire_elemental':
return 443;
case 'gwint_card_fogling':
return 445;
case 'gwint_card_wyvern':
return 447;
case 'gwint_card_arachas_behemoth':
return 450;
case 'gwint_card_arachas':
return 451;
case 'gwint_card_arachas2':
return 452;
case 'gwint_card_arachas3':
return 453;
case 'gwint_card_nekker':
return 455;
case 'gwint_card_nekker2':
return 456;
case 'gwint_card_nekker3':
return 457;
case 'gwint_card_ekkima':
return 460;
case 'gwint_card_fleder':
return 461;
case 'gwint_card_garkain':
return 462;
case 'gwint_card_bruxa':
return 463;
case 'gwint_card_katakan':
return 464;
case 'gwint_card_ghoul':
return 470;
case 'gwint_card_ghoul2':
return 471;
case 'gwint_card_ghoul3':
return 472;
case 'gwint_card_crone_brewess':
return 475;
case 'gwint_card_crone_weavess':
return 476;
case 'gwint_card_crone_whispess':
return 477;
default:
}
return 0;
/* NOP */;
}
public function GwentNeutralNameToInt(val : CName) : Int32{

switch(val){
case 'gwint_card_geralt':
return 7;
case 'gwint_card_vesemir':
return 8;
case 'gwint_card_yennefer':
return 9;
case 'gwint_card_ciri':
return 10;
case 'gwint_card_triss':
return 11;
case 'gwint_card_dandelion':
return 12;
case 'gwint_card_zoltan':
return 13;
case 'gwint_card_emiel':
return 14;
case 'gwint_card_villen':
return 15;
case 'gwint_card_avallach':
return 16;
default:
}
return 0;
/* NOP */;
}
public function GwentSpecialNameToInt(val : CName) : Int32{
switch(val){
case 'gwint_card_dummy':
return 0;
case 'gwint_card_horn':
return 1;
case 'gwint_card_scorch':
return 2;
case 'gwint_card_frost':
return 3;
case 'gwint_card_fog':
return 4;
case 'gwint_card_rain':
return 5;
case 'gwint_card_clear_sky':
return 6;
default:
}
return 0;
/* NOP */;
}
}
import abstract class CVitalSpotsParam{
}
import abstract class SVitalSpotEnableConditions{
}
import struct CR4InteriorAreaComponent{
public editable var isDarkPlace : Bool;
public editable var allowHorseInThisInterior : Bool;
public editable var movementLock : EPlayerMovementLockType;
public function OnPlayerEntered(entered : Bool) : Bool{

switch(movementLock){
case 1:
thePlayer.interiorTracker.LockSprint(entered);
break;
case 2:
thePlayer.interiorTracker.LockRun(entered);
break;
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (activator.GetEntity() != thePlayer){
return false;
}
if (isDarkPlace){
FactsAdd("tut_in_dark_place", /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (activator.GetEntity() != thePlayer){
return false;
}
if (isDarkPlace){
FactsSubstract("tut_in_dark_place", /* NOP */);
}
/* NOP */;
}
}
import abstract class CR4InteriorAreaEntity{
}
import struct CR4EffectComponent{
import public final function PlayEffect(effectName : CName, target : CEn
tity, targetBone : CName);
import public final function StopEffect();
}
import struct CCombatDataComponent{
import public final function GetAttackersCount() : Int32;
import public final function GetTicketSourceOwners(actors : array<CActor
>, ticketName : CName);
import public final function TicketSourceOverrideRequest(ticketName : CN
ame, ticketsCountMod : Int32, minimalImportanceMod : Float) : Int32;
import public final function TicketSourceClearRequest(ticketName : CName
, requestId : Int32) : Bool;
import public final function ForceTicketImmediateImportanceUpdate(ticket
Name : CName);
import public final function HasAttackersInRange(range : Float) : Bool;
}
import abstract class CR4BehTreeInstance{
}
import abstract class CBehTreeNodeStrafingDefinition{
}

import abstract class CBehTreeStrafingAlgorithmListDefinition{


}
import abstract class CBehTreeStrafingAlgorithmFastSurroundDefinition{
}
import abstract class CBehTreeStrafingAlgorithmNeverBackDownDefinition{
}
import abstract class SActiveVitalSpotEventData{
}
import abstract class CBehTreeNodeVitalSpotActiveDefinition{
}
import abstract class CBehTreeNodeConditionAttackersCountDefinition{
}
import abstract class IBehTreeNodeConditionIsInInteriorBaseDefinition{
}
import abstract class CBehTreeNodeConditionAmIInInteriorDefinition{
}
import abstract class CBehTreeNodeConditionIsPlayerInInteriorDefinition{
}
import abstract class CBehTreeNodeConditionAmIOrAPInInteriorDefinition{
}
import abstract class CBehTreeNodeIgnoreInteriorsDuringPathfindingDefinition{
}
import abstract class CBehTreeNodeConditionIsTargetThePlayerDefinition{
}
import abstract class CBehTreeNodeConditionIsDeadDefinition{
}
import abstract class CBehTreeNodeConditionIsEnemyAroundDefinition{
}
import abstract class CBehTreeDecoratorChangeBehaviorGraphDefinition{
}
import abstract class CBehTreeDecoratorSetBehaviorVariableDefinition{
}
import abstract class CBehTreeNodeLandingDecoratorDefinition{
}
import abstract class CBehTreeNodeTakeOffDecoratorDefinition{
}
import abstract class CBehTreeNodeFindLandingSpotDecoratorDefinition{
}
import abstract class CBehTreeNodeDecoratorDisableTalkInteractionDefinition{
}

import abstract class CBehTreeDecoratorOverrideBehaviorVariableDefinition{


}
import abstract class CBehTreeNodeCombatTicketManagerDefinition{
}
import abstract class CBehTreeNodeCombatTicketManagedGetDefinition{
}
import abstract class CBehTreeNodeCombatTicketHasDefinition{
}
import abstract class CBehTreeNodeCombatTicketRequestDefinition{
}
import abstract class CBehTreeNodeCombatTicketReleaseDefinition{
}
import abstract class CBehTreeNodeCombatTicketLockDefinition{
}
import abstract class IBehTreeNodeCombatTargetSelectionBaseDefinition{
}
import abstract class CBehTreeNodeCombatTargetSelectionDefinition{
}
import abstract class CBehTreeValECombatTargetSelectionSkipTarget{
}
import abstract class CBehTreeNodeClosestNonFriendlyTargetSelectionDefinition{
}
import abstract class IBehTreeNodeHLOffenceBaseDefinition{
}
import abstract class IBehTreeNodeHLCombatBaseDefinition{
}
import abstract class CBehTreeNodeHLCombatDefinition{
}
import abstract class CBehTreeNodeHLAnimalCombatDefinition{
}
import abstract class IBehTreeDecoratorBaseHLDangerDefinition{
}
import abstract class CBehTreeDecoratorHLDangerDefinition{
}
import abstract class CBehTreeDecoratorHLDangerTamableDefinition{
}
import abstract class CBehTreeNodeDecoratorHLWildHorseDangerDefinition{
}
import abstract class CBehTreeNodeProlongHLCombatDecoratorDefinition{
}

import abstract class CBehTreeAtomicForgetCombatTargetDefinition{


}
import abstract class CBehTreeNodePCLockControlDecoratorDefinition{
}
import abstract class CBehTreeNodePCReleaseControlDefinition{
}
import abstract class CBehTreeNodeAtomicSailorFollowPathDefinition{
}
import abstract class CBehTreeNodeAtomicSailorMoveToPathDefinition{
}
import abstract class CBehTreeNodeAtomicSailorMoveToDefinition{
}
import abstract class CR4BehTreeNodePredefinedPathWithCompanionDefinition{
}
import abstract class CBehTreeNodeRiderPursueHorseDefinition{
}
import abstract class CBehTreeNodeRiderRotateToHorseDefinition{
}
import abstract class CBehTreeDecoratorRidingManagerDefinition{
}
import abstract class CBehTreeDecoratorRiderHorseReachabilityDefinition{
}
import abstract class CBehTreeNodeDecoratorRidingCheckDefinition{
}
import abstract class CBehTreeNodeRiderIdleDynamicRootDefinition{
}
import abstract class CBehTreeNodeRiderForcedBehaviorDefinition{
}
import abstract class CBehTreeDecoratorRiderPairingLogicDefinition{
}
import abstract class CBehTreeDecoratorRiderPairWithHorseDefinition{
}
import abstract class CBehTreeDecoratorHorsePairWithRiderDefinition{
}
import abstract class CBehTreeNodeRiderWaitHorseScriptedActionDefinition{
}
import abstract class CBehTreeCluePathData{
}
import abstract class CBehTreeNodePredefinedPathRuberBandDefinition{
}

import abstract class IBehTreeNodeAtomicFlightDefinition{


}
import abstract class IBehTreeNodeAtomicFlyAroundBaseDefinition{
}
import abstract class CBehTreeNodeAtomicFlyAroundDefinition{
}
import abstract class CBehTreeNodeAtomicFlyAroundPositionDefinition{
}
import abstract class IBehTreeNodeAtomicFlyToBaseDefinition{
}
import abstract class CBehTreeNodeAtomicFlyToDefinition{
}
import abstract class CBehTreeNodeAtomicFlyToPositionDefinition{
}
import abstract class IBehTreeNodeFlightDecoratorDefinition{
}
import abstract class CBehTreeNodeDecoratorGlideDefinition{
}
import abstract class CBehTreeDecoratorHorseSpeedManagerDefinition{
}
import struct CVolumePathManager{
import public function GetPath(start : Vector, end : Vector, resultPath
: array<Vector>, maxHeight : Float) : Bool;
import public function GetPointAlongPath(start : Vector, end : Vector, d
istAlongPath : Float, maxHeight : Float) : Vector;
import public function IsPathfindingNeeded(start : Vector, end : Vector)
: Bool;
}
import abstract class CBehTreeValEHorseMoveType{
}
import abstract class CBehTreeNodeBroadcastReactionSceneDefinition{
}
import abstract class CBehTreeNodeConditionShouldPursueCombatTargetDefinition{
}
class InterpCurvePointF extends InterpCurvePoint{
public var outVal : Float;
public var arriveTangent : Float;
public var leaveTangent : Float;
}
import abstract class CBehTreeNodeDynamicCombatStyleDefinition{
}
import struct CHorseParkingActionPointSelector{
//NULL type for radius
}

import abstract class CBehTreeNodeSelectTargetOrMountByTagDecoratorDefinition{


}
import abstract class CBehTreeMetanodeSetupCombatReachability{
}
import struct CRainActionPointSelector{
}
import abstract class CBehTreeNodeSendScaredEventDefinition{
}
import abstract class CBehTreeNodeReceiveScaredEventDefinition{
}
import abstract class IBehTreeNodeConditionSpeechDefinition{
}
import abstract class CBehTreeNodeConditionIsInChatSceneDefinition{
}
import abstract class CBehTreeNodeConditionIsSpeakingDefinition{
}
import abstract class CBehTreeNodeConditionHasVoicesetDefintion{
}
import abstract class IBehTreeNodeSpeechDecoratorDefinition{
}
import abstract class CBehTreeNodePlayVoicesetDecoratorDefinition{
}
import abstract class CBehTreeNodePlayVoicesetOnDeactivationDecoratorDefinition{
}
import abstract class SBecomeScaredEventData{
}
import struct CAIStorageRiderData{
//NULL type for sharedParams
//NULL type for ridingManagerCurrentTask
//NULL type for ridingManagerInstantMount
//NULL type for ridingManagerMountError
//NULL type for ridingManagerDismountType
//NULL type for horseScriptedActionTree
import public function PairWithTaggedHorse(actor : CActor, preferedHorse
Tag : CName, range : Float) : Bool;
import public function OnInstantDismount(riderActor : CActor);
public function GetRidingManagerCurrentTask() : ERidingManagerTask{
return ridingManagerCurrentTask;
/* NOP */;
}
}
import struct CAIStorageAnimalData{
public var scared : Bool;
}

import struct CAIStorageHorseData{


public var horseEntity : CActor;
public var horseComponent : W3HorseComponent;
}
import abstract class SBehTreePairHorseEventParam{
}
class InterpCurvePointV extends InterpCurvePoint{
public var outVal : Vector;
public var arriveTangent : Vector;
public var leaveTangent : Vector;
}
import abstract class CBehTreeTicketData{
}
import abstract class IBehTreeTicketAlgorithmDecoratorDefinition{
}
import abstract class CBehTreeTicketAlgorithmRandomizeDefinition{
}
import abstract class IBehTreeTicketAlgorithmListDefinition{
}
import abstract class CBehTreeTicketAlgorithmListSumDefinition{
}
import abstract class CBehTreeConstantTicketAlgorithmDefinition{
}
import abstract class CBehTreeIfActiveTicketAlgorithmDefinition{
}
import abstract class CBehTreeDistanceBasedTicketAlgorithmDefinition{
}
import abstract class CBehTreeTimeBasedTicketAlgorithmDefinition{
}
import struct ITicketAlgorithmScript{
//NULL type for overrideTicketsCount
import public final function GetActor() : CActor;
import public final function GetNPC() : CNewNPC;
import public final function GetLocalTime() : Float;
import public final function GetActionTarget() : CNode;
import public final function GetCombatTarget() : CActor;
import public final function GetTimeSinceMyAcquisition() : Float;
import public final function GetTimeSinceAnyAcquisition() : Float;
import public final function IsActive() : Bool;
import public final function HasTicket() : Bool;
public function CalculateTicketImportance() : Float{
return 1.000000;
/* NOP */;
}
}
abstract class W3CriticalEffect extends CBaseGameplayEffect{
protected var criticalStateType : ECriticalStateType;

protected saved var allowedHits : array<Bool>;


protected var timeEndedHandled : Bool;
private var isDestroyedOnInterrupt : Bool;
private var canPlayAnimation : Bool;
protected var blockedActions : array<EInputActionBlock>;
protected var postponeHandling : ECriticalHandling;
protected var airHandling : ECriticalHandling;
protected var attachedHandling : ECriticalHandling;
protected var onHorseHandling : ECriticalHandling;
public var explorationStateHandling : ECriticalHandling;
private var usesFullBodyAnim : Bool;
public function CacheSettings(){
var i : Int32;
super.CacheSettings();
allowedHits.Grow(EnumGetMax('EHitReactionType') + 1);
i = 0;
while (i < allowedHits.Size()){
allowedHits[i] = true;
i += 1;
}
blockedActions.PushBack(19);
blockedActions.PushBack(20);
blockedActions.PushBack(21);
blockedActions.PushBack(5);
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
if (isActive){
timeActive += deltaTime;
}
if (pauseCounters.Size() == 0){
if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
}
if (timeLeft <= 0 && !timeEndedHandled){
target.SignalGameplayEvent('DisableFinisher');
timeEndedHandled = true;
if (isActive && this == target.GetCurrentlyAnimatedCS())
{
target.RequestCriticalAnimStop(/* NOP */);
} else {
LogCritical("Deactivating not animated CS <<" +
criticalStateType + ">>");
isActive = false;
}
}
/* NOP */;
}
public function GetCriticalStateType() : ECriticalStateType{
return criticalStateType;
/* NOP */;
}
public function IsHitAllowed(hit : EHitReactionType) : Bool{
return allowedHits[hit];
/* NOP */;
}
public function IsDestroyedOnInterrupt() : Bool{
return isDestroyedOnInterrupt;

/* NOP */;
}
public function CanPlayAnimation() : Bool{
return canPlayAnimation;
/* NOP */;
}
public function DisallowPlayAnimation(){
canPlayAnimation = false;
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var i : Int32;
var animHandling : ECriticalHandling;
var veh : CGameplayEntity;
var horseComp : W3HorseComponent;
var boatComp : CBoatComponent;
super.OnEffectAdded(customParams);
if (isOnPlayer){
i = 0;
while (i < blockedActions.Size()){
thePlayer.BlockAction(blockedActions[i], EffectT
ypeToName(effectType), /* NOP */, /* NOP */, /* NOP */);
i += 1;
}
}
if (!isOnPlayer){
target.PauseStaminaRegen('in_critical_state');
}
if (target.IsCriticalTypeHigherThanAllCurrent(criticalStateType)
){
if (target.IsInAir()){
animHandling = airHandling;
} else if (isOnPlayer){
if (!thePlayer.CanReactToCriticalState()){
animHandling = explorationStateHandling;
} else {
veh = thePlayer.GetUsedVehicle();
if ((W3Boat)veh){
animHandling = attachedHandling;
} else if (veh){
horseComp = (CNewNPC)veh.GetHors
eComponent();
horseComp.OnCriticalEffectAdded(
criticalStateType);
animHandling = onHorseHandling;
} else {
animHandling = 0;
}
}
} else {
animHandling = 0;
}
} else {
animHandling = postponeHandling;
}
if (animHandling == 0){
target.StartCSAnim(this);
} else if (animHandling == 2){
LogCritical("Cancelling CS <<" + criticalStateType + ">>
as it cannot play anim right now and its handling wishes to abort in such case"

);
isActive = false;
}
if (isOnPlayer){
theGame.VibrateControllerVeryHard(/* NOP */);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var i : Int32;
super.OnEffectRemoved();
if (isOnPlayer){
i = 0;
while (i < blockedActions.Size()){
thePlayer.UnblockAction(blockedActions[i], Effec
tTypeToName(effectType));
i += 1;
}
}
target.ResumeStaminaRegen('in_critical_state');
if (isOnPlayer){
LogCriticalPlayer("Critical.OnEffectRemoved() | " + this
);
LogCriticalPlayer("");
}
if (this == target.GetCurrentlyAnimatedCS()){
target.RequestCriticalAnimStop(/* NOP */);
}
/* NOP */;
}
public final function UsesFullBodyAnim() : Bool{
return usesFullBodyAnim;
/* NOP */;
}
}
import abstract class CBehTreeScriptTicketAlgorithmDefinition{
}
abstract class W3CriticalDOTEffect extends W3DamageOverTimeEffect{
protected var criticalStateType : ECriticalStateType;
protected saved var allowedHits : array<Bool>;
private var timeEndedHandled : Bool;
private var isDestroyedOnInterrupt : Bool;
private var canPlayAnimation : Bool;
protected var blockedActions : array<EInputActionBlock>;
protected var postponeHandling : ECriticalHandling;
protected var airHandling : ECriticalHandling;
protected var attachedHandling : ECriticalHandling;
protected var onHorseHandling : ECriticalHandling;
public var explorationStateHandling : ECriticalHandling;
private var usesFullBodyAnim : Bool;
public function CacheSettings(){
var i : Int32;
super.CacheSettings();
allowedHits.Grow(EnumGetMax('EHitReactionType') + 1);
i = 0;
while (i < allowedHits.Size()){
allowedHits[i] = true;
i += 1;

}
blockedActions.PushBack(19);
blockedActions.PushBack(20);
blockedActions.PushBack(21);
blockedActions.PushBack(5);
/* NOP */;
}
public function OnUpdate(dt : Float) : Bool{
if (IsImmuneToAllDamage(dt)){
timeLeft = 0;
return true;
}
super.OnUpdate(dt);
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
if (pauseCounters.Size() == 0){
if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
if (!this){
return;
}
}
if (timeLeft <= 0 && !timeEndedHandled){
timeEndedHandled = true;
target.SignalGameplayEvent('DisableFinisher');
if (isOnPlayer){
LogCriticalPlayer("CriticalDOT.OnTimeUpdated() |
" + this + " - timeout");
}
if (isActive && this == target.GetCurrentlyAnimatedCS())
{
target.RequestCriticalAnimStop(/* NOP */);
} else {
LogCritical("Deactivating not animated CS <<" +
criticalStateType + ">>");
if (isOnPlayer){
LogCriticalPlayer("CriticalDOT.OnTimeUpd
ated() | " + this + " - deactivating as it's not animated currently");
}
isActive = false;
}
} else if (timeLeft <= 0 && !target.IsAlive()){
if (isOnPlayer){
LogCriticalPlayer("CriticalDOT.OnTimeUpdated() |
" + this + " - isAlive set to false as target is dead");
}
isActive = false;
}
/* NOP */;
}
public function GetCriticalStateType() : ECriticalStateType{
return criticalStateType;
/* NOP */;
}
public function IsHitAllowed(hit : EHitReactionType) : Bool{
return allowedHits[hit];
/* NOP */;

}
public function IsDestroyedOnInterrupt() : Bool{
return isDestroyedOnInterrupt;
/* NOP */;
}
public function CanPlayAnimation() : Bool{
return canPlayAnimation;
/* NOP */;
}
public function DisallowPlayAnimation(){
canPlayAnimation = false;
/* NOP */;
}
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var i : Int32;
var animHandling : ECriticalHandling;
var veh : CGameplayEntity;
var horseComp : W3HorseComponent;
var boatComp : CBoatComponent;
if (IsImmuneToAllDamage(100000)){
isActive = false;
return true;
}
super.OnEffectAdded(customParams);
if (isOnPlayer){
i = 0;
while (i < blockedActions.Size()){
thePlayer.BlockAction(blockedActions[i], EffectT
ypeToName(effectType), /* NOP */, /* NOP */, /* NOP */);
i += 1;
}
}
if (!isOnPlayer){
target.PauseStaminaRegen('in_critical_state');
}
if (target.IsCriticalTypeHigherThanAllCurrent(criticalStateType)
){
if (target.IsInAir()){
animHandling = airHandling;
} else if (isOnPlayer){
if (!thePlayer.CanReactToCriticalState()){
animHandling = explorationStateHandling;
} else {
veh = thePlayer.GetUsedVehicle();
if ((W3Boat)veh){
animHandling = attachedHandling;
} else if (veh){
horseComp = (CNewNPC)veh.GetHors
eComponent();
horseComp.OnCriticalEffectAdded(
criticalStateType);
animHandling = onHorseHandling;
} else {
animHandling = 0;
}
}
} else {
animHandling = 0;
}
} else {

animHandling = postponeHandling;
}
if (animHandling == 0){
target.StartCSAnim(this);
} else if (animHandling == 2){
LogCritical("Cancelling CS <<" + criticalStateType + ">>
as it cannot play anim right now and its handling wishes to abort in such case"
);
isActive = false;
}
if (isOnPlayer){
theGame.VibrateControllerVeryHard(/* NOP */);
}
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var i : Int32;
super.OnEffectRemoved();
if (isOnPlayer){
i = 0;
while (i < blockedActions.Size()){
thePlayer.UnblockAction(blockedActions[i], Effec
tTypeToName(effectType));
i += 1;
}
}
target.ResumeStaminaRegen('in_critical_state');
if (isOnPlayer){
LogCriticalPlayer("CriticalDOT.OnEffectRemoved() | " + t
his);
LogCriticalPlayer("");
}
if (this == target.GetCurrentlyAnimatedCS()){
target.RequestCriticalAnimStop(/* NOP */);
}
/* NOP */;
}
public final function UsesFullBodyAnim() : Bool{
return usesFullBodyAnim;
/* NOP */;
}
protected function CalculateDuration(setInitialDuration : Bool){
super.CalculateDuration(setInitialDuration);
if (duration < 0.100000){
duration = 0.000000;
LogEffects("W3CriticalDOTEffect.CalculateDuration(): fin
al duration is below 0.1, setting to 0");
}
/* NOP */;
}
}
import abstract class CTicketConfigurationParam{
}
import abstract class CHumbleCrittersLairEntity{
}
import struct CFlyingCrittersLairEntity{
}

import struct CFlyingCrittersLairEntityScript{


public editable var dynamicGroups : Bool;
public editable var doCircling : Bool;
public editable var isAgressive : Bool;
private var initDynamicGroups : Bool;
private var initDoCircling : Bool;
private var initAgressive : Bool;
private var initMain : Bool;
private var isActive : Bool;
private var firstActivation : Bool;
protected var idleGroupIndexArray : array<Int32>;
private var m_requestGroupStateArray : array<CName>;
private var m_requestGroupIdStateArray : array<W3FlyingSwarmStateChangeR
equest>;
private var m_requestCreateGroupArray : array<W3FlyingSwarmCreateGroupRe
quest>;
private var m_allGroupsStateRequest : CName;
private var m_requestAllGroupsDespawn : Bool;
private var m_requestAllGroupChangeState : Bool;
public var m_birdMaster : CGameplayEntity;
private var m_gotoRequestArray : array<GotoRequest>;
private var m_requestCircle : Bool;
private var m_requestSupernatural : Bool;
private var m_requestAttack : Bool;
private var m_requestDespawnTest : Bool;
private var m_requestGroupMerge : Bool;
private var m_requestGroupSplit : Bool;
private var m_requestPopulateGroup : Bool;
import public function GetPoiCountByType(poiType : CName) : Int32;
import public function GetSpawnPointArray(spawnPointArray : array<CName>
);
public function RequestGroupStateChange(groupState : CName, affectAllGro
ups : Bool){
if (affectAllGroups == false){
m_requestGroupStateArray.PushBack(groupState);
} else {
m_allGroupsStateRequest = groupState;
m_requestAllGroupChangeState = true;
}
/* NOP */;
}
public function RequestGroupStateChange_ByGroupId(groupId : CFlyingGroup
Id, groupState : CName){
var flyingSwarmStateChangeRequest : W3FlyingSwarmStateChangeRequ
est;
flyingSwarmStateChangeRequest = new W3FlyingSwarmStateChangeRequ
est in this;
flyingSwarmStateChangeRequest.Init(groupId, groupState);
m_requestGroupIdStateArray.PushBack(flyingSwarmStateChangeReques
t);
/* NOP */;
}
public function RequestCreateGroup(boidCount : Int32, spawnPOI : CName){
var flyingSwarmCreateGroupRequest : W3FlyingSwarmCreateGroupRequ
est;
flyingSwarmCreateGroupRequest = new W3FlyingSwarmCreateGroupRequ
est in this;
flyingSwarmCreateGroupRequest.Init(boidCount, spawnPOI);
m_requestCreateGroupArray.PushBack(flyingSwarmCreateGroupRequest

);
/* NOP */;
}
public function RequestAllGroupsInstantDespawn(){
m_requestAllGroupsDespawn = true;
/* NOP */;
}
public function SetBirdMaster(birdMaster : CGameplayEntity){
m_birdMaster = birdMaster;
/* NOP */;
}
public function SignalArrivalAtNode(groupState : CName, targetNode : CNo
de, groupStateSetOnArrival : CName, groupID : CFlyingGroupId, delay : Float, fac
tID : String, factValue : Int32){
var gotoRequest : GotoRequest;
gotoRequest = new GotoRequest in this;
gotoRequest.groupState = groupState;
gotoRequest.groupId = groupID;
gotoRequest.targetPoiComponent = NULL;
gotoRequest.targetNode = targetNode;
gotoRequest.delay = delay;
gotoRequest.delayTimer = 0.000000;
gotoRequest.factID = factID;
gotoRequest.factValue = factValue;
gotoRequest.groupStateSetOnArrival = groupStateSetOnArrival;
gotoRequest.init = false;
m_gotoRequestArray.PushBack(gotoRequest);
/* NOP */;
}
public function OnBoidPointOfInterestReached(boidCount : Int32, entity :
CEntity, deltaTime : Float){
var action : W3DamageAction;
var damageResistance : Float;
var damage : Float;
var xmlDamageModifier : Float;
if ((CPlayer)entity || m_birdMaster && GetAttitudeBetween(m_bird
Master, entity) == 2){
/* NOP */;
xmlDamageModifier = CalculateAttributeValue((CActor)m_bi
rdMaster.GetAttributeValue('swarm_attack_damage_vitality', /* NOP */, /* NOP */)
, /* NOP */);
damage = xmlDamageModifier * boidCount * deltaTime;
if (damage > 0){
action = new W3DamageAction in this;
action.Initialize(this, (CGameplayEntity)entity,
this, GetName() + "_" + "root_projectile", 0, 0, false, false, false, true, /*
NOP */, /* NOP */, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_REND
ING, damage);
LogCritical("About to apply new swarm effect");
action.AddEffectInfo(52, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
GCameraShake(0.050000, true, thePlayer.GetWorldP
osition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
/* NOP */;
}

public function GroupIdToGroupIndex(scriptInput : CFlyingSwarmScriptInpu


t, groupId : CFlyingGroupId) : Int32{
var i : Int32;
i = 0;
while (i < scriptInput.groupList.Size()){
if (FlyingGroupId_Compare(scriptInput.groupList[i].group
Id, groupId) == true){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function FirstActivation(scriptInput : CFlyingSwarmScriptInput, d
eltaTime : Float){
var i : Int32;
var boidCountPerPOI : Int32;
var localSpawnPointArray : array<CName>;
var spawnPointArray : array<CName>;
GetSpawnPointArray(spawnPointArray);
i = 0;
while (i < spawnPointArray.Size()){
if (GetPoiCountByType(spawnPointArray[i]) != 0){
localSpawnPointArray.PushBack(spawnPointArray[i]
);
}
i += 1;
}
boidCountPerPOI = spawnLimit / localSpawnPointArray.Size();
i = 0;
while (i < localSpawnPointArray.Size()){
scriptInput.CreateGroup(boidCountPerPOI, localSpawnPoint
Array[i], 'idle', /* NOP */);
i += 1;
}
/* NOP */;
}
public function OnActivated(scriptInput : CFlyingSwarmScriptInput, delta
Time : Float){
if (firstActivation == false){
firstActivation = true;
FirstActivation(scriptInput, deltaTime);
}
/* NOP */;
}
public function OnDeactivated(scriptInput : CFlyingSwarmScriptInput, del
taTime : Float){
initDynamicGroups = true;
initDoCircling = true;
initAgressive = true;
initMain = true;
/* NOP */;
}
public function OnTick(scriptInput : CFlyingSwarmScriptInput, active : B
ool, deltaTime : Float){
var poiPos : Vector;
var startPos : Vector;
var endPos : Vector;
var birdMasterPos : Vector;

var birdMasterHeading : Vector;


var dotProduct : Float;
var i : Int32;
var groupIndex : Int32;
var tries : Int32;
var gotoRequest : GotoRequest;
var requestGroupState : CName;
dotProduct = 0.000000;
idleGroupIndexArray.Clear();
if (active == false){
if (isActive != active){
OnDeactivated(scriptInput, deltaTime);
}
return;
}
if (isActive != active){
OnActivated(scriptInput, deltaTime);
}
isActive = active;
if (scriptInput.groupList.Size() == 0){
return;
}
i = 0;
while (i < scriptInput.groupList.Size()){
if (scriptInput.groupList[i].currentGroupState == 'idle'
){
idleGroupIndexArray.PushBack(i);
}
i += 1;
}
if (initMain){
initMain = false;
m_requestGroupStateArray.Clear();
m_requestGroupIdStateArray.Clear();
m_requestAllGroupChangeState = false;
m_requestAllGroupsDespawn = false;
i = 0;
while (i < m_gotoRequestArray.Size()){
groupIndex = GroupIdToGroupIndex(scriptInput, m_
gotoRequestArray[i].groupId);
if (groupIndex != -1){
scriptInput.groupList[groupIndex].change
GroupState = 'idle';
}
i += 1;
}
m_gotoRequestArray.Clear();
}
if (dynamicGroups){
UpdateDynamicGroups(scriptInput, deltaTime);
}
if (doCircling){
UpdateCircling(scriptInput, deltaTime);
}
if (isAgressive){
UpdateAgressive(scriptInput, deltaTime);
}
i = 0;
while (i < m_requestGroupStateArray.Size()){
requestGroupState = m_requestGroupStateArray[i];

groupIndex = -1;
groupIndex = RandRange(idleGroupIndexArray.Size(), /* NO
P */);
scriptInput.groupList[groupIndex].changeGroupState = req
uestGroupState;
i += 1;
}
m_requestGroupStateArray.Clear();
i = m_gotoRequestArray.Size() - 1;
while (i >= 0){
gotoRequest = m_gotoRequestArray[i];
gotoRequest.delayTimer += deltaTime;
if (FlyingGroupId_IsValid(gotoRequest.groupId) == false)
{
groupIndex = idleGroupIndexArray[RandRange(idleG
roupIndexArray.Size(), /* NOP */)];
gotoRequest.groupId = scriptInput.groupList[grou
pIndex].groupId;
}
groupIndex = GroupIdToGroupIndex(scriptInput, gotoReques
t.groupId);
if (groupIndex != -1){
if (gotoRequest.init == false){
gotoRequest.init = true;
scriptInput.groupList[groupIndex].change
GroupState = gotoRequest.groupState;
gotoRequest.groupCenterWhenStart = scrip
tInput.groupList[groupIndex].groupCenter;
}
if (gotoRequest.delay < gotoRequest.delayTimer){
poiPos = gotoRequest.targetNode.GetWorld
Position();
startPos = m_gotoRequestArray[i].groupCe
nterWhenStart;
startPos.Z = 0.000000;
poiPos.Z = 0.000000;
endPos = scriptInput.groupList[groupInde
x].groupCenter;
endPos.Z = 0.000000;
dotProduct = VecDot(poiPos - startPos, p
oiPos - endPos);
if (dotProduct < 0.000000){
scriptInput.groupList[groupIndex
].changeGroupState = 'idle';
if (gotoRequest.groupStateSetOnA
rrival){
scriptInput.groupList[gr
oupIndex].changeGroupState = gotoRequest.groupStateSetOnArrival;
}
if (m_birdMaster){
(CActor)m_birdMaster.Sig
nalGameplayEventParamCName('BoidGoToRequestCompleted', gotoRequest.groupState);
if (gotoRequest.factID){
if (gotoRequest.
factValue){
FactsAdd
(gotoRequest.factID, gotoRequest.factValue, /* NOP */);
} else {
FactsAdd
(gotoRequest.factID, /* NOP */, /* NOP */);

}
}
}
m_gotoRequestArray.Erase(i);
break;
}
}
} else {
m_gotoRequestArray.Erase(i);
break;
}
i -= 1;
}
i = 0;
while (i < m_requestGroupIdStateArray.Size()){
groupIndex = GroupIdToGroupIndex(scriptInput, m_requestG
roupIdStateArray[i].groupId);
if (groupIndex != -1){
scriptInput.groupList[groupIndex].changeGroupSta
te = m_requestGroupIdStateArray[i].stateName;
}
i += 1;
}
m_requestGroupIdStateArray.Clear();
if (m_requestAllGroupChangeState){
i = 0;
while (i < scriptInput.groupList.Size()){
if (scriptInput.groupList[i].currentGroupState !
= m_allGroupsStateRequest){
scriptInput.groupList[i].changeGroupStat
e = m_allGroupsStateRequest;
}
i += 1;
}
}
m_requestAllGroupChangeState = false;
if (m_requestAllGroupsDespawn){
i = 0;
while (i < scriptInput.groupList.Size()){
scriptInput.groupList[i].toDespawnCount = script
Input.groupList[i].boidCount;
scriptInput.groupList[i].despawnPoiType = 'None'
;
i += 1;
}
}
m_requestAllGroupsDespawn = false;
i = 0;
while (i < m_requestCreateGroupArray.Size()){
scriptInput.CreateGroup(m_requestCreateGroupArray[i].boi
dCount, m_requestCreateGroupArray[i].spawnPOI, 'idle', /* NOP */);
i += 1;
}
m_requestCreateGroupArray.Clear();
/* NOP */;
}
public function UpdateDynamicGroups(scriptInput : CFlyingSwarmScriptInpu
t, deltaTime : Float){
var i : Int32;
var indexA : Int32;

var indexB : Int32;


var maxBoidCount : Int32;
var groupIndexToDepopulate : Int32;
var groupIndexToPopulate : Int32;
var minBoidCount : Int32;
var hasMergedThisFrame : Bool;
var spawnPointArray : array<CName>;
hasMergedThisFrame = false;
if (initDynamicGroups){
initDynamicGroups = false;
AddTimer('GroupMergeTimer', RandRangeF(60.000000, 30.000
000), false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
AddTimer('GroupSplitTimer', RandRangeF(60.000000, 30.000
000), false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_requestGroupMerge = false;
m_requestGroupSplit = false;
m_requestPopulateGroup = false;
}
if (m_requestGroupMerge){
m_requestGroupMerge = false;
hasMergedThisFrame = true;
if (idleGroupIndexArray.Size() >= 2){
maxBoidCount = 0;
minBoidCount = 100000;
indexA = -1;
i = 0;
while (i < idleGroupIndexArray.Size()){
if (scriptInput.groupList[idleGroupIndex
Array[i]].boidCount < minBoidCount){
indexA = idleGroupIndexArray[i];
minBoidCount = scriptInput.group
List[indexA].boidCount;
}
i += 1;
}
indexB = idleGroupIndexArray[RandDifferent(index
A, idleGroupIndexArray.Size())];
if (indexA != -1 && indexB != indexA){
if (indexA >= scriptInput.groupList.Size
()){
indexA = 0;
}
scriptInput.MoveBoidToGroup(scriptInput.
groupList[indexA].groupId, scriptInput.groupList[indexA].boidCount, scriptInput.
groupList[indexB].groupId);
scriptInput.RemoveGroup(scriptInput.grou
pList[indexA].groupId);
}
}
}
if (m_requestGroupSplit){
m_requestGroupSplit = false;
if (scriptInput.groupList.Size() < 6){
m_requestPopulateGroup = false;
maxBoidCount = 0;
groupIndexToDepopulate = -1;
if (scriptInput.groupList.Size() >= 2){
i = 0;
while (i < scriptInput.groupList.Size())
{

if (scriptInput.groupList[i].boi
dCount > maxBoidCount){
maxBoidCount = scriptInp
ut.groupList[i].boidCount;
groupIndexToDepopulate =
i;
}
i += 1;
}
if (groupIndexToDepopulate != -1){
GetSpawnPointArray(spawnPointArr
ay);
scriptInput.CreateGroup(scriptIn
put.groupList[groupIndexToDepopulate].boidCount / 2, spawnPointArray[0], 'idle',
scriptInput.groupList[groupIndexToDepopulate].groupId);
}
}
} else {
m_requestGroupMerge = true;
}
}
/* NOP */;
}
public function UpdateCircling(scriptInput : CFlyingSwarmScriptInput, de
ltaTime : Float){
var i : Int32;
if (initDoCircling){
initDoCircling = false;
m_requestCircle = false;
RequestGroupStateChange('circle', /* NOP */);
}
/* NOP */;
}
public function UpdateAgressive(scriptInput : CFlyingSwarmScriptInput, d
eltaTime : Float){
if (initAgressive){
initAgressive = false;
AddTimer('AttackTimer', RandRangeF(30.000000, 15.000000)
, false, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
m_requestAttack = false;
}
if (m_requestAttack){
m_requestAttack = false;
SignalArrivalAtNode('attackPlayer', thePlayer, 'idle', C
FlyingGroupId(), /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
private timer function AttackTimer(optional delta : Float, optional id :
Int32){
m_requestAttack = true;
AddTimer('AttackTimer', RandRangeF(30.000000, 10.000000), false,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
private timer function GroupMergeTimer(optional delta : Float, optional
id : Int32){
m_requestGroupMerge = true;
AddTimer('GroupMergeTimer', RandRangeF(60.000000, 30.000000), fa
lse, /* NOP */, /* NOP */, /* NOP */, /* NOP */);

/* NOP */;
}
private timer function GroupSplitTimer(optional delta : Float, optional
id : Int32){
m_requestGroupSplit = true;
AddTimer('GroupSplitTimer', RandRangeF(60.000000, 30.000000), fa
lse, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class CSwarmCellMapFactory{
}
class CAIPlayerActionDecorator extends IPlayerActionDecorator{
public editable var interruptOnInput : Bool;
}
import abstract class IMoveSTBaseStrafeTarget{
}
import abstract class CMoveSTStrafeSurroundTarget{
}
import abstract class CMoveSTStrafeTargetRandomly{
}
class CAIRiderFollowSideBySideAction extends IRiderActionTree{
public editable inlined var params : CAIRiderFollowSideBySideActionParam
s;
public function Init(){
params = new CAIRiderFollowSideBySideActionParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CMoveSTStrafeTargetOneWay{
}
import abstract class CMoveSCFastSurround{
}
import abstract class CMoveSCTargetsCount{
}
import abstract class CMoveSTApplySteeringToPlayerVariables{
}
import abstract class CMoveSTRuberBand{
}
import abstract class CMoveSTHorse{
}
import abstract class CMoveSCRoadMovement{
}
import abstract class CMoveSTOnRoad{
}

import abstract class CBuffImmunityParam{


}
import struct CMonsterParam{
//NULL type for canBeStrafed
}
import abstract class CPreAttackEvent{
}
import abstract class CBehaviorGraphHorseNode{
}
import abstract class SHorseStateOffsets{
}
import abstract class SAlchemySubstanceData{
}
import abstract class CEntityMapPinsResource{
}
import abstract class CQuestMapPinsResource{
}
import abstract class CAreaMapPinsResource{
}
import abstract class CR4LootDefinitionBase{
}
import abstract class CR4LootContainerDefinition{
}
import abstract class CBehTreeNodeDecoratorCarryingItemManagerDefinition{
}
import abstract class CCarryableItemStorePointComponent{
}
import abstract class CBehTreeDecoratorCarryingItemsBaseDefinition{
}
import abstract class CBehTreeNodeConditionIsCarryingItemDefinition{
}
import abstract class CBehTreeDecoratorFindSourceItemStoreDefinition{
}
import abstract class CBehTreeDecoratorFindDestinationItemStoreDefinition{
}
import abstract class CBehTreeNodeCarryingItemBaseDefinition{
}
import abstract class CBehTreeNodePickItemDefinition{
}
import abstract class CBehTreeNodeDropItemDefinition{

}
import abstract class CBehTreeNodeGreetingReactionSceneDecoratorDefinition{
}
import abstract class CSkeletalAnimationStepClipParam{
}
import abstract class CR4QuestSystem{
}
import abstract class CJournalQuestMappinStateBlock{
}
import abstract class CJournalQuestTrackBlock{
}
import abstract class CExtAnimAttackEvent{
}
class IGlobalEventScriptedListener extends CObject{
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
}
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
}
}
import abstract class CStorySceneAddFactEvent{
}
import abstract class CStorySceneEventSurfaceEffect{
}
import abstract class CExtAnimCutsceneSurfaceEffect{
}
import struct CGameplayLightComponent{
public editable var factOnIgnite : CName;
public var actionBlockingExceptions : array<EInputActionBlock>;
private saved var restoreItemLAtEnd : Bool;
import public function SetLight(toggle : Bool);
import public function SetInteractive(toggle : Bool);
import public function IsLightOn() : Bool;
import public function IsCityLight() : Bool;
import public function IsInteractive() : Bool;
import public function IsAffectedByWeather() : Bool;
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (activator == thePlayer){
if (!thePlayer.CanPerformPlayerAction(isEnabledInCombat)
){
return false;
}
thePlayer.AddAnimEventChildCallback(this, 'SetLight', 'O
nAnimEvent_SetLight');
thePlayer.AddAnimEventChildCallback(this, 'UnlockInterac
tion', 'OnAnimEvent_UnlockInteraction');
}

if (!IsLightOn()){
thePlayer.PlayerStartAction(11, /* NOP */);
BlockPlayerLightInteraction();
} else {
thePlayer.PlayerStartAction(12, /* NOP */);
BlockPlayerLightInteraction();
}
if (thePlayer.IsHoldingItemInLHand()){
thePlayer.OnUseSelectedItem(true);
restoreItemLAtEnd = true;
}
/* NOP */;
}
public function OnAnimEvent_SetLight(animEventName : CName, animEventTyp
e : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
ToggleLight();
thePlayer.RemoveAnimEventChildCallback(this, 'SetLight')
;
}
/* NOP */;
}
public function OnAnimEvent_UnlockInteraction(animEventName : CName, ani
mEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 3){
thePlayer.BlockAllActions('LightInteraction', false, /*
NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
thePlayer.RemoveAnimEventChildCallback(this, 'UnlockInte
raction');
if (restoreItemLAtEnd){
thePlayer.OnUseSelectedItem(/* NOP */);
restoreItemLAtEnd = false;
}
}
/* NOP */;
}
public function ToggleLight(){
if (!IsLightOn()){
SetLight(true);
if (factOnIgnite){
FactsAdd(factOnIgnite, 1, /* NOP */);
}
} else {
SetLight(false);
}
/* NOP */;
}
public function AardHit(){
if (IsInteractive()){
if (IsLightOn()){
SetLight(false);
}
}
/* NOP */;
}
public function IgniHit(){
if (IsInteractive()){
if (!IsLightOn()){
SetLight(true);
}

}
/* NOP */;
}
public function FrostHit(){
if (IsInteractive()){
if (IsLightOn()){
SetLight(false);
}
}
/* NOP */;
}
public function FireHit(){
if (IsInteractive()){
if (!IsLightOn()){
SetLight(true);
if (factOnIgnite){
FactsAdd(factOnIgnite, 1, /* NOP */);
}
}
}
/* NOP */;
}
public function BlockPlayerLightInteraction(){
actionBlockingExceptions.PushBack(14);
actionBlockingExceptions.PushBack(26);
thePlayer.BlockAllActions('LightInteraction', true, actionBlocki
ngExceptions, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
/* NOP */;
}
}
import abstract class CPersistentLightComponent{
}
import struct CCityLightManager{
import public function SetEnabled(toggle : Bool);
import public function IsEnabled() : Bool;
import public function ForceUpdate();
import public function SetUpdateEnabled(value : Bool);
import public function DebugToggleAll(toggle : Bool);
}
import abstract class CFistfightMinigame{
}
import struct CGwintMenuInitData{
}
import abstract class CGwintMinigame{
}
import statemachine struct CBeehiveEntity{
public editable var damageVal : SAbilityAttributeValue;
public editable var destroyEntAfter : Float;
public editable var isFallingObject : Bool;
public editable var desiredTargetTagForBeesSwarm : CName;
public editable var excludedEntitiesTagsForBeeSwarm : array<CName>;
private var isOnFire : Bool;
private var hangingDamageArea : CComponent;
public var actorsInHangArea : array<CActor>;

public var hangingBuffParams : SCustomEffectParams;


public var beesActivated : Bool;
public var activeMovingBees : W3BeeSwarm;
public var activeAttachedBees : W3BeeSwarm;
private const var HANGING_AREA_NAME : CName;
public function OnDetaching() : Bool{
if (activeMovingBees){
activeMovingBees.Destroy();
}
if (activeAttachedBees){
activeAttachedBees.Destroy();
}
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
hangingDamageArea = GetComponent(HANGING_AREA_NAME);
hangingDamageArea.SetEnabled(false);
GotoStateAuto();
/* NOP */;
}
public function OnStreamIn() : Bool{
/* NOP */;
/* NOP */;
}
public function OnStreamOut() : Bool{
/* NOP */;
/* NOP */;
}
public function EnableHangingDamageArea(flag : Bool){
hangingDamageArea.SetEnabled(flag);
if (!flag){
actorsInHangArea.Clear();
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
super.OnFireHit(source);
isOnFire = true;
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
super.OnInteraction(actionName, activator);
/* NOP */;
}
public function IsOnFire() : Bool{
return isOnFire;
/* NOP */;
}
public function OnShotByProjectile(){
var currentStateName : CName;
currentStateName = GetCurrentStateName();
if (currentStateName == 'HangingIntact' || currentStateName == '
HangingBurning'){
Fall();
}
/* NOP */;
}
public function Fall(){

if (!isFallingObject){
return;
}
GotoState('Falling', /* NOP */, /* NOP */);
/* NOP */;
}
public timer function HangAreaDamage(optional dt : Float, optional id :
Int32){
var i : Int32;
i = 0;
while (i < actorsInHangArea.Size()){
actorsInHangArea[i].AddEffectCustom(hangingBuffParams);
i += 1;
}
/* NOP */;
}
public timer function DummyDamage(optional dt : Float, optional id : Int
32){
var i : Int32;
var damage : W3DamageAction;
i = 0;
while (i < actorsInHangArea.Size()){
damage = new W3DamageAction in this;
damage.Initialize(this, actorsInHangArea[i], NULL, this,
0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
damage.AddDamage(theGame.params.DAMAGE_NAME_DIRECT, 0.00
0100);
theGame.damageMgr.ProcessAction(damage);
delete damage;
i += 1;
}
/* NOP */;
}
}
state CBeehiveEntityStateHangingIntact in CBeehiveEntity extends CScriptableStat
e{
public function OnEnterState(prevStateName : CName) : Bool{
parent.EnableHangingDamageArea(true);
parent.PlayEffect('bee_default', /* NOP */);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
parent.OnAardHit(sign);
parent.Fall();
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
parent.OnFireHit(source);
parent.GotoState('HangingBurning', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnLeaveState(prevStateName : CName) : Bool{
parent.EnableHangingDamageArea(false);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
if (area.GetName() == "hangingDamageArea"){

actor = (CActor)activator.GetEntity();
if (actor){
parent.actorsInHangArea.PushBack(actor);
if (parent.actorsInHangArea.Size() == 1){
if (parent.hangingBuffParams.effectType
== 0){
parent.hangingBuffParams.effectT
ype = 52;
parent.hangingBuffParams.vibrate
PadLowFreq = 0.100000;
parent.hangingBuffParams.vibrate
PadHighFreq = 0.200000;
parent.hangingBuffParams.creator
= parent;
parent.hangingBuffParams.sourceN
ame = "hanging beehive";
parent.hangingBuffParams.duratio
n = 0.250000;
parent.hangingBuffParams.effectV
alue = parent.damageVal;
}
parent.AddTimer('HangAreaDamage', 0.2000
00, true, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var actor : CActor;
if (area.GetName() == "hangingDamageArea"){
actor = (CActor)activator.GetEntity();
if (actor){
parent.actorsInHangArea.Remove(actor);
if (parent.actorsInHangArea.Size() == 0){
parent.RemoveTimer('HangAreaDamage', /*
NOP */);
}
}
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
var entityTemplate : CEntityTemplate;
var parentPos : Vector;
var movingBees : W3BeeSwarm;
var attachedBees : W3BeeSwarm;
parent.OnInteraction(actionName, activator);
entityTemplate = (CEntityTemplate)LoadResource('bees', /* NOP */
);
if (entityTemplate && !parent.beesActivated){
parentPos = parent.GetWorldPosition();
movingBees = (W3BeeSwarm)theGame.CreateEntity(entityTemp
late, parentPos, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP *
/);
parent.activeMovingBees = movingBees;
movingBees.damageVal = parent.damageVal;
movingBees.SetSwarmOriginEntity(parent);

if (parent.desiredTargetTagForBeesSwarm != 'None'){
movingBees.desiredTargetTag = parent.desiredTarg
etTagForBeesSwarm;
}
if (parent.excludedEntitiesTagsForBeeSwarm.Size() > 0){
movingBees.excludedEntitiesTags = parent.exclude
dEntitiesTagsForBeeSwarm;
}
parent.beesActivated = true;
parent.GetComponent('Loot').SetEnabled(true);
}
/* NOP */;
}
}
state CBeehiveEntityStateFalling in CBeehiveEntity extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
FallDown();
/* NOP */;
}
public entry function FallDown(){
var groundLevel : Vector;
var currentPos : Vector;
var rot : EulerAngles;
var beehiveComp : CComponent;
beehiveComp = parent.GetComponent('beehive');
beehiveComp.SetEnabled(true);
SetPhysicalEventOnCollision(beehiveComp, parent, /* NOP */);
/* NOP */;
}
public function OnCollision(object : CObject, actorIndex : Int32, shapeI
ndex : Int32) : Bool{
if (parent.IsOnFire()){
parent.GotoState('OnGroundBurned', /* NOP */, /* NOP */)
;
} else {
parent.GotoState('OnGroundActive', /* NOP */, /* NOP */)
;
}
/* NOP */;
}
}
state CBeehiveEntityStateOnGroundActive in CBeehiveEntity extends CScriptableSta
te{
public function OnEnterState(prevStateName : CName) : Bool{
var entityTemplate : CEntityTemplate;
var parentPos : Vector;
var movingBees : W3BeeSwarm;
var attachedBees : W3BeeSwarm;
parent.StopAllEffects();
entityTemplate = (CEntityTemplate)LoadResource('bees', /* NOP */
);
if (entityTemplate){
parentPos = parent.GetWorldPosition();
if (!parent.beesActivated){
movingBees = (W3BeeSwarm)theGame.CreateEntity(en
tityTemplate, parentPos, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
parent.activeMovingBees = movingBees;

movingBees.damageVal = parent.damageVal;
movingBees.SetSwarmOriginEntity(parent);
if (parent.desiredTargetTagForBeesSwarm != 'None
'){
movingBees.desiredTargetTag = parent.des
iredTargetTagForBeesSwarm;
}
if (parent.excludedEntitiesTagsForBeeSwarm.Size(
) > 0){
movingBees.excludedEntitiesTags = parent
.excludedEntitiesTagsForBeeSwarm;
}
parent.beesActivated = true;
}
attachedBees = (W3BeeSwarm)theGame.CreateEntity(entityTe
mplate, parentPos, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP
*/);
parent.activeAttachedBees = attachedBees;
attachedBees.CreateAttachment(parent, /* NOP */, /* NOP
*/, /* NOP */);
attachedBees.SetVelocity(0);
attachedBees.damageVal = parent.damageVal;
attachedBees.SetSwarmOriginEntity(parent);
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
parent.OnFireHit(source);
parent.StopAllEffects();
parent.PlayEffect('fire', /* NOP */);
parent.GotoState('OnGroundBurned', /* NOP */, /* NOP */);
/* NOP */;
}
}
state CBeehiveEntityStateOnGroundBurned in CBeehiveEntity extends CScriptableSta
te{
public function OnEnterState(prevStateName : CName) : Bool{
parent.GetComponent('Loot').SetEnabled(true);
parent.RemoveTag(theGame.params.TAG_SOFT_LOCK);
BrokenEntryFunctionNamesCollision_CBeehiveEntity_OnGroundBurned_
Loop();
/* NOP */;
}
public entry function BrokenEntryFunctionNamesCollision_CBeehiveEntity_O
nGroundBurned_Loop(){
Sleep(10.000000);
parent.StopAllEffects();
/* NOP */;
}
}
state CBeehiveEntityStateHangingBurning in CBeehiveEntity extends CScriptableSta
te{
public function OnEnterState(prevStateName : CName) : Bool{
parent.StopAllEffects();
BurnBeehive();
/* NOP */;
}
public entry function BurnBeehive(){

parent.PlayEffect('fire', /* NOP */);


parent.PlayEffect('bee_fire', /* NOP */);
Sleep(5);
parent.GotoState('Falling', /* NOP */, /* NOP */);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
parent.OnAardHit(sign);
parent.Fall();
/* NOP */;
}
}
import statemachine struct W3ToxicCloud{
public editable var poisonDamage : SAbilityAttributeValue;
public editable var explosionDamage : SAbilityAttributeValue;
public editable var restorationTime : Float;
public editable var settlingTime : Float;
public editable var fxOnSettle : CName;
public editable var fxOnExplode : CName;
public editable var bIsEnabled : Bool;
public editable var usePoisonBuffWithAnim : Bool;
public editable var cameraShakeRadius : Float;
public editable var isEnvironment : Bool;
public editable var burningChance : Float;
public editable var excludedTags : array<CName>;
protected var chainedExplosion : Bool;
protected var entitiesInPoisonRange : array<CActor>;
protected saved var effectType : EEffectType;
private var poisonArea : CTriggerAreaComponent;
private var explosionArea : CTriggerAreaComponent;
private var explodingTargetDamages : array<SRawDamage>;
private var entitiesInExplosionRange : array<CGameplayEntity>;
private var isFromBomb : Bool;
private var buffParams : SCustomEffectParams;
private var buffSpecParams : W3BuffDoTParams;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
super.OnSpawned(spawnData);
chainedExplosion = false;
if (usePoisonBuffWithAnim){
effectType = 15;
} else {
effectType = 19;
}
Enable(bIsEnabled);
/* NOP */;
}
public function OnStreamIn() : Bool{
/* NOP */;
/* NOP */;
}
public function OnStreamOut() : Bool{
/* NOP */;
/* NOP */;
}
public function SetBurningChance(c : Float){
burningChance = c;
/* NOP */;
}
public function SetFromBomb(){

isFromBomb = true;
/* NOP */;
}
public function IsFromBomb() : Bool{
return isFromBomb;
/* NOP */;
}
public function IsActorInPoisonRange(a : CActor) : Bool{
return entitiesInPoisonRange.Contains(a);
/* NOP */;
}
public function SetExplodingTargetDamages(dmg : array<SRawDamage>){
explodingTargetDamages = dmg;
/* NOP */;
}
public function GetExplodingTargetDamages() : array<SRawDamage>{
return explodingTargetDamages;
/* NOP */;
}
public function HasExplodingTargetDamages() : Bool{
return explodingTargetDamages.Size() > 0;
/* NOP */;
}
public function PermanentlyDisable(){
var area : CTriggerAreaComponent;
area = GetPoisonAreaUnsafe();
if (area){
area.SetEnabled(false);
} else {
AddTimer('KeepTryingToDisable', 0.100000, true, /* NOP *
/, /* NOP */, true, /* NOP */);
}
entitiesInPoisonRange.Clear();
super.StopPoisonTimer();
StopAllEffects();
DestroyAfter(5);
/* NOP */;
}
public timer function KeepTryingToDisable(optional dt : Float, optional
id : Int32){
var area : CTriggerAreaComponent;
area = GetPoisonAreaUnsafe();
if (area){
area.SetEnabled(false);
RemoveTimer('KeepTryingToDisable', /* NOP */);
}
/* NOP */;
}
public function Enable(b : Bool){
if (b){
GotoState('Settle', /* NOP */, /* NOP */);
} else {
GotoState('Disabled', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function GetPoisonAreaUnsafe() : CTriggerAreaComponent{
if (!poisonArea){
poisonArea = (CTriggerAreaComponent)GetComponent('Poison
Area');

}
return poisonArea;
/* NOP */;
}
public function GetGasAreaUnsafe() : CTriggerAreaComponent{
if (!explosionArea){
explosionArea = (CTriggerAreaComponent)GetComponent('Exp
losionArea');
}
return explosionArea;
/* NOP */;
}
public function OnManageToxicCloud(operations : array<EToxicCloudOperati
on>){
if (operations.Size() == 0){
return;
}
Enable(operations.Contains(0));
/* NOP */;
}
public function IsChainedExplosion() : Bool{
return chainedExplosion;
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var actor : CActor;
var gameplayEnt : CGameplayEntity;
var i : Int32;
var ent : CEntity;
var expBolt : W3ExplosiveBolt;
ent = activator.GetEntity();
if (area == GetPoisonAreaUnsafe() && ent.HasTag(theGame.params.T
AG_OPEN_FIRE) && GetCurrentStateName() == 'Armed'){
(W3ToxicCloudStateArmed)GetCurrentState().Explode(ent);
return true;
}
if (excludedTags.Size() > 0){
i = 0;
while (i < excludedTags.Size()){
if (ent.HasTag(excludedTags[i])){
return false;
}
i += 1;
}
}
if (area == GetPoisonAreaUnsafe()){
actor = (CActor)ent;
if (actor && !entitiesInPoisonRange.Contains(actor)){
entitiesInPoisonRange.PushBack(actor);
if (entitiesInPoisonRange.Size() == 1){
if (buffParams.effectType == 0){
buffParams.effectType = effectTy
pe;
buffParams.creator = this;
buffParams.duration = 0.500000;
buffParams.effectValue = poisonD
amage;
buffParams.buffSpecificParams =
buffSpecParams;

buffParams.sourceName = 'ToxicGa
sCloud';
}
if (!buffSpecParams){
buffSpecParams = new W3BuffDoTPa
rams in this;
buffSpecParams.isEnvironment = i
sEnvironment;
}
AddTimer('PoisonTimer', 0.010000, true,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if ((CR4Player)actor && GetCurrentStateName() ==
'Armed'){
SetCanBeTargeted(false);
if (thePlayer.CanPlaySpecificVoiceset())
{
thePlayer.PlayVoiceset(100, "cou
ghing", /* NOP */);
thePlayer.SetCanPlaySpecificVoic
eset(false);
thePlayer.AddTimer('ResetSpecifi
cVoicesetFlag', 10.000000, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */
);
}
}
}
} else if (area == GetGasAreaUnsafe()){
gameplayEnt = (CGameplayEntity)ent;
if (gameplayEnt){
entitiesInExplosionRange.PushBack(gameplayEnt);
expBolt = (W3ExplosiveBolt)gameplayEnt;
if (expBolt){
expBolt.AddToxicCloud(this);
}
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var ent : CEntity;
var gameplayEnt : CGameplayEntity;
var actor : CActor;
var expBolt : W3ExplosiveBolt;
ent = activator.GetEntity();
if ((CR4Player)ent && GetCurrentStateName() == 'Armed'){
SetCanBeTargeted(true);
}
if (area == GetPoisonAreaUnsafe()){
actor = (CActor)activator.GetEntity();
if (actor){
entitiesInPoisonRange.Remove(actor);
if (entitiesInPoisonRange.Size() == 0){
super.StopPoisonTimer();
}
}
} else if (area == GetGasAreaUnsafe()){
gameplayEnt = (CGameplayEntity)ent;
if (gameplayEnt){

entitiesInExplosionRange.Remove(gameplayEnt);
expBolt = (W3ExplosiveBolt)gameplayEnt;
if (expBolt){
expBolt.RemoveToxicCloud(this);
}
}
}
/* NOP */;
}
public function ClearEntitiesInPoisonRange(){
entitiesInPoisonRange.Clear();
/* NOP */;
}
public function GetCamShakeRadius() : Float{
return cameraShakeRadius;
/* NOP */;
}
public function GetEntitiesInExplosionRange() : array<CGameplayEntity>{
return entitiesInExplosionRange;
/* NOP */;
}
public function GetActorsInPoisonRange() : array<CActor>{
return entitiesInPoisonRange;
/* NOP */;
}
protected function SetCanBeTargeted(flag : Bool){
if (flag){
if (!HasTag(theGame.params.TAG_SOFT_LOCK)){
AddTag(theGame.params.TAG_SOFT_LOCK);
}
} else {
RemoveTag(theGame.params.TAG_SOFT_LOCK);
}
/* NOP */;
}
public timer function PoisonTimer(optional dt : Float, optional id : Int
32){
var i : Int32;
i = 0;
while (i < entitiesInPoisonRange.Size()){
entitiesInPoisonRange[i].AddEffectCustom(buffParams);
i += 1;
}
/* NOP */;
}
public final function StopPoisonTimer(){
RemoveTimer('PoisonTimer', /* NOP */);
if (buffSpecParams){
delete buffSpecParams;
}
/* NOP */;
}
}
state W3ToxicCloudStateDisabled in W3ToxicCloud extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
var area : CTriggerAreaComponent;
parent.StopAllEffects();
area = parent.GetPoisonAreaUnsafe();
if (area){

area.SetEnabled(false);
} else {
parent.AddTimer('KeepTryingToDisable', 0.100000, true, /
* NOP */, /* NOP */, true, /* NOP */);
}
parent.ClearEntitiesInPoisonRange();
/* NOP */;
}
}
state W3ToxicCloudStateSettle in W3ToxicCloud extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.PlayEffectSingle(parent.fxOnSettle, /* NOP */);
parent.chainedExplosion = false;
BrokenEntryFunctionNamesCollision_W3ToxicCloud_Settle_Loop();
/* NOP */;
}
public entry function BrokenEntryFunctionNamesCollision_W3ToxicCloud_Set
tle_Loop(){
Sleep(parent.settlingTime + RandF());
parent.GotoState('Armed', /* NOP */, /* NOP */);
/* NOP */;
}
}
state W3ToxicCloudStateWait in W3ToxicCloud extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.SetCanBeTargeted(false);
parent.GetPoisonAreaUnsafe().SetEnabled(false);
parent.ClearEntitiesInPoisonRange();
BrokenEntryFunctionNamesCollision_W3ToxicCloud_Wait_Loop();
/* NOP */;
}
public entry function BrokenEntryFunctionNamesCollision_W3ToxicCloud_Wai
t_Loop(){
if (parent.restorationTime < 0){
parent.PermanentlyDisable();
} else {
/* NOP */;
Sleep(parent.restorationTime);
/* NOP */;
parent.GotoState('Settle', /* NOP */, /* NOP */);
}
/* NOP */;
}
}
import struct CR4QuestDLCMounter{
private function LoadQuestLevels(filePath : String){
theGame.LoadQuestLevels(filePath);
/* NOP */;
}
private function UnloadQuestLevels(filePath : String){
theGame.UnloadQuestLevels(filePath);
/* NOP */;
}
}
import abstract class CR4DefinitionsDLCMounter{
}

import abstract class CR4DefinitionsEntitieTemplatesDLCMounter{


}
import abstract class CR4JournalDLCMounter{
}
import abstract class CR4RewardsDLCMounter{
}
import abstract class CR4AttitudesDLCMounter{
}
import abstract class CR4ActionPointCategoriesDLCMounter{
}
import abstract class CR4ScaleformContentDLCMounter{
}
import abstract class CR4EntityTemplateParamDLCMounter{
}
import struct CR4FinishersDLCMounter{
private function LoadFinisher(finisher : CR4FinisherDLC){
if (finisher.finisherSide == 0){
theGame.GetSyncAnimManager().AddDlcFinisherLeftSide(fini
sher);
} else if (finisher.finisherSide == 1){
theGame.GetSyncAnimManager().AddDlcFinisherRightSide(fin
isher);
}
/* NOP */;
}
private function UnloadFinisher(finisher : CR4FinisherDLC){
if (finisher.finisherSide == 0){
theGame.GetSyncAnimManager().RemoveDlcFinisherLeftSide(f
inisher);
} else if (finisher.finisherSide == 1){
theGame.GetSyncAnimManager().RemoveDlcFinisherRightSide(
finisher);
}
/* NOP */;
}
}
import abstract class CR4AnimationsCategoriesDLCMounter{
}
import abstract class CR4SceneAnimationsDLCMounter{
}
import abstract class CR4EntityExternalAppearanceDLCMounter{
}
import abstract class CR4DropPhysicsSetupDLCMounter{
}
import abstract class CR4EntityTemplateSlotDLCMounter{
}

import abstract class CR4VoicetagDLCMounter{


}
import abstract class STargetingInfo{
//NULL type for source
//NULL type for canBeTargetedCheck
//NULL type for coneCheck
//NULL type for coneHalfAngleCos
//NULL type for coneDist
//NULL type for coneHeadingVector
//NULL type for distCheck
//NULL type for invisibleCheck
//NULL type for navMeshCheck
//NULL type for inFrameCheck
//NULL type for frameScaleX
//NULL type for frameScaleY
//NULL type for knockDownCheck
//NULL type for knockDownCheckDist
//NULL type for rsHeadingCheck
//NULL type for rsHeadingLimitCos
//NULL type for targetEntity
}
import abstract class SR4PlayerTargetingConsts{
//NULL type for softLockDistance
//NULL type for softLockFrameSize
}
class CurveDamper extends CObject{
protected var curve : CCurve;
protected var time : Float;
protected var duration : Float;
protected var startValue : Float;
protected var currValue : Float;
protected var destValue : Float;
public final function IsValid() : Bool{
return curve;
/* NOP */;
}
public final function SetCurve(c : CCurve){
curve = c;
duration = curve.GetDuration();
if (duration <= 0.000000){
curve = NULL;
}
/* NOP */;
}
public final function Reset(){
time = 0.000000;
currValue = 0.000000;
startValue = 0.000000;
destValue = 0.000000;
currValue = CalcValue();
/* NOP */;
}
public final function Init(curr : Float, dest : Float){
currValue = curr;
startValue = curr;
destValue = dest;
time = 0.000000;

/* NOP */;
}
public final function SetValue(value : Float){
destValue = value;
time = 0.000000;
/* NOP */;
}
public final function ResetValue(value : Float){
destValue = value;
/* NOP */;
}
public final function GetValue() : Float{
return currValue;
/* NOP */;
}
public final function GetDestValue() : Float{
return destValue;
/* NOP */;
}
public function Update(dt : Float){
if (time + dt < duration){
time += dt;
} else {
time = duration;
}
currValue = CalcValue();
/* NOP */;
}
public final function UpdateAndGet(dt : Float) : Float{
Update(dt);
return GetValue();
/* NOP */;
}
private function CalcValue() : Float{
var progress : Float;
if (curve){
progress = curve.GetValue(time);
return InterpolateValue(progress, startValue, destValue)
;
}
return -1;
/* NOP */;
}
protected function InterpolateValue(progress : Float, a : Float, b : Flo
at) : Float{
return LerpF(progress, a, b, false);
/* NOP */;
}
public final function IsRunning() : Bool{
return time < duration;
/* NOP */;
}
public final function GetProgress() : Float{
if (duration > 0.000000){
return time / duration;
} else {
return 0.000000;
}
/* NOP */;
}

}
class AngleCurveDamper extends CurveDamper{
protected function InterpolateValue(progress : Float, a : Float, b : Flo
at) : Float{
return LerpAngleF(progress, a, b);
/* NOP */;
}
}
import abstract class CR4Telemetry{
}
import abstract class CR4GameResourceFactory{
}
class CurveDamper3d extends CObject{
protected var damperX : CurveDamper;
protected var damperY : CurveDamper;
protected var damperZ : CurveDamper;
public final function IsValid() : Bool{
return damperX.IsValid() && damperY.IsValid() && damperZ.IsValid
();
/* NOP */;
}
public final function SetCurve(c : CCurve){
if (!damperX){
damperX = new CurveDamper in this;
damperY = new CurveDamper in this;
damperZ = new CurveDamper in this;
}
damperX.SetCurve(c);
damperY.SetCurve(c);
damperZ.SetCurve(c);
/* NOP */;
}
public final function Reset(){
damperX.Reset();
damperY.Reset();
damperZ.Reset();
/* NOP */;
}
public final function Init(curr : Vector, dest : Vector){
damperX.Init(curr.X, dest.X);
damperY.Init(curr.Y, dest.Y);
damperZ.Init(curr.Z, dest.Z);
/* NOP */;
}
public final function SetValue(value : Vector){
damperX.SetValue(value.X);
damperY.SetValue(value.Y);
damperZ.SetValue(value.Z);
/* NOP */;
}
public final function ResetValue(value : Vector){
damperX.ResetValue(value.X);
damperY.ResetValue(value.Y);
damperZ.ResetValue(value.Z);
/* NOP */;
}

public final function GetValue() : Vector{


var ret : Vector;
ret.X = damperX.GetValue();
ret.Y = damperY.GetValue();
ret.Z = damperZ.GetValue();
return ret;
/* NOP */;
}
public final function GetDestValue() : Vector{
var ret : Vector;
ret.X = damperX.GetDestValue();
ret.Y = damperY.GetDestValue();
ret.Z = damperZ.GetDestValue();
return ret;
/* NOP */;
}
public function Update(dt : Float){
damperX.Update(dt);
damperY.Update(dt);
damperZ.Update(dt);
/* NOP */;
}
public final function UpdateAndGet(dt : Float) : Vector{
var ret : Vector;
damperX.Update(dt);
damperY.Update(dt);
damperZ.Update(dt);
ret.X = damperX.GetValue();
ret.Y = damperY.GetValue();
ret.Z = damperZ.GetValue();
return ret;
/* NOP */;
}
public final function IsRunning() : Bool{
return damperX.IsRunning() || damperY.IsRunning() || damperZ.IsR
unning();
/* NOP */;
}
}
class W3DamageAction extends CDamageData{
protected var dmgInfos : array<SRawDamage>;
protected var effectInfos : array<SEffectInfo>;
protected var cannotReturnDamage : Bool;
protected var isPointResistIgnored : Bool;
protected var canPlayHitParticle : Bool;
protected var hitAnimationPlayType : EActionHitAnim;
protected var hitReactionType : EHitReactionType;
private var buffSourceName : String;
protected var canBeParried : Bool;
protected var canBeDodged : Bool;
protected var hitFX : CName;
protected var hitBackFX : CName;
protected var hitParriedFX : CName;
protected var hitBackParriedFX : CName;
protected var powerStatType : ECharacterPowerStats;
protected var swingType : EAttackSwingType;
protected var swingDirection : EAttackSwingDirection;
protected var signSkill : ESkill;
protected var isDodged : Bool;

protected var shouldProcessBuffsIfNoDamage : Bool;


private var ignoreImmortalityMode : Bool;
private var dealtFireDamage : Bool;
protected var isDoTDamage : Bool;
protected var isHeadShot : Bool;
protected var killedBySingleHit : Bool;
protected var ignoreArmor : Bool;
protected var supressHitSounds : Bool;
protected var dealtDamage : Bool;
protected var endsQuen : Bool;
protected var armorReducedDamageToZero : Bool;
protected var underwaterDisplayDamageHack : Bool;
protected var parryStagger : Bool;
private var DOTdt : Float;
private var isActionRanged : Bool;
private var isActionWitcherSign : Bool;
private var isActionEnvironment : Bool;
public function Initialize(att : CGameplayEntity, vict : CGameplayEntity
, caus : IScriptable, src : String, hrt : EHitReactionType, pwrStatType : EChara
cterPowerStats, isM : Bool, isR : Bool, isW : Bool, isE : Bool, hitFX_ : CName,
hitBackFX_ : CName, hitParriedFX_ : CName, hitBackParriedFX_ : CName){
Clear();
attacker = att;
victim = vict;
causer = caus;
buffSourceName = src;
hitReactionType = hrt;
powerStatType = pwrStatType;
swingType = 5;
swingDirection = 4;
isActionMelee = isM;
isActionRanged = isR;
isActionWitcherSign = isW;
isActionEnvironment = isE;
if (IsNameValid(hitFX_) || IsNameValid(hitBackFX_) || IsNameVali
d(hitParriedFX_) || IsNameValid(hitBackParriedFX_)){
hitFX = hitFX_;
hitBackFX = hitBackFX_;
hitParriedFX = hitParriedFX_;
hitBackParriedFX = hitBackParriedFX_;
} else {
SetDefaultHitFXs();
}
/* NOP */;
}
protected function Clear(){
processedDmg.essenceDamage = 0;
processedDmg.vitalityDamage = 0;
processedDmg.moraleDamage = 0;
processedDmg.staminaDamage = 0;
hitLocation = Vector(0, 0, 0);
momentum = Vector(0, 0, 0);
causer = NULL;
attacker = NULL;
victim = NULL;
hitReactionAnimRequested = false;
additiveHitReactionAnimRequested = false;
customHitReactionRequested = false;
isActionMelee = false;
dmgInfos.Clear();

effectInfos.Clear();
cannotReturnDamage = false;
isPointResistIgnored = false;
canPlayHitParticle = true;
hitAnimationPlayType = 0;
hitReactionType = 0;
buffSourceName = "";
canBeParried = false;
canBeDodged = false;
hitFX = 'None';
hitBackFX = 'None';
hitParriedFX = 'None';
hitBackParriedFX = 'None';
powerStatType = 2;
swingType = 5;
swingDirection = 4;
signSkill = 0;
isDodged = false;
shouldProcessBuffsIfNoDamage = false;
ignoreImmortalityMode = false;
dealtFireDamage = false;
isDoTDamage = false;
isHeadShot = false;
killedBySingleHit = false;
ignoreArmor = false;
DOTdt = 0;
isActionRanged = false;
isActionWitcherSign = false;
isActionEnvironment = false;
endsQuen = false;
armorReducedDamageToZero = false;
underwaterDisplayDamageHack = false;
parryStagger = false;
/* NOP */;
}
public function SetSignSkill(skill : ESkill){
if (isActionWitcherSign){
signSkill = skill;
}
/* NOP */;
}
public function GetSignSkill() : ESkill{
if (isActionWitcherSign){
return signSkill;
}
return 0;
/* NOP */;
}
public function AddDamage(dmgType : CName, dmgVal : Float){
var dmgInfo : SRawDamage;
var i : Int32;
if (dmgVal <= 0){
return;
}
i = 0;
while (i < dmgInfos.Size()){
if (dmgInfos[i].dmgType == dmgType){
dmgInfos[i].dmgVal += dmgVal;
return;
}

i += 1;
}
dmgInfo.dmgType = dmgType;
dmgInfo.dmgVal = dmgVal;
dmgInfos.PushBack(dmgInfo);
/* NOP */;
}
public function AddEffectInfo(effectType : EEffectType, duration : Float
, effectCustomValue : SAbilityAttributeValue, effectAbilityName : CName, customP
arams : W3BuffCustomParams, buffApplyChance : Float){
var effectInfo : SEffectInfo;
if (effectType == 0){
return;
}
effectInfo.effectType = effectType;
effectInfo.effectDuration = duration;
effectInfo.effectCustomValue = effectCustomValue;
effectInfo.effectAbilityName = effectAbilityName;
effectInfo.effectCustomParam = customParams;
if (buffApplyChance == 0){
buffApplyChance = 1;
}
effectInfo.applyChance = buffApplyChance;
effectInfos.PushBack(effectInfo);
/* NOP */;
}
public function RemoveBuff(index : Int32){
if (index >= 0 && index < effectInfos.Size()){
effectInfos.Erase(index);
}
/* NOP */;
}
public final function RemoveBuffsByType(type : EEffectType){
var i : Int32;
i = effectInfos.Size() - 1;
while (i >= 0){
if (effectInfos[i].effectType == type){
effectInfos.EraseFast(i);
}
i -= 1;
}
/* NOP */;
}
public function SetHitReactionType(hrt : EHitReactionType, setDefaultHit
FXs : Bool){
hitReactionType = hrt;
if (setDefaultHitFXs){
SetDefaultHitFXs();
}
/* NOP */;
}
public function SetHitAnimationPlayType(type : EActionHitAnim){
hitAnimationPlayType = type;
/* NOP */;
}
public function GetHitAnimationPlayType() : EActionHitAnim{
return hitAnimationPlayType;
/* NOP */;
}
public function GetEffects(effects : array<SEffectInfo>) : Int32{

effects.Clear();
effects = effectInfos;
return effects.Size();
/* NOP */;
}
public function GetEffectsCount() : Int32{
return effectInfos.Size();
/* NOP */;
}
public function HasAnyCriticalEffect() : Bool{
var i : Int32;
i = 0;
while (i < effectInfos.Size()){
if (IsCriticalEffectType(effectInfos[i].effectType)){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetEffectTypes(effectTypes : array<EEffectType>) : Int32
{
var i : Int32;
effectTypes.Clear();
i = 0;
while (i < effectInfos.Size()){
effectTypes.PushBack(effectInfos[i].effectType);
i += 1;
}
return effectTypes.Size();
/* NOP */;
}
public function GetDTs(dmgTypes : array<SRawDamage>) : Int32{
dmgTypes.Clear();
dmgTypes = dmgInfos;
return dmgTypes.Size();
/* NOP */;
}
public function GetDTCount() : Int32{
return dmgInfos.Size();
/* NOP */;
}
public function GetDTsNames(dtNames : array<CName>) : Int32{
var i : Int32;
dtNames.Clear();
i = 0;
while (i < dmgInfos.Size()){
dtNames.PushBack(dmgInfos[i].dmgType);
i += 1;
}
return dtNames.Size();
/* NOP */;
}
protected function SetDefaultHitFXs(){
switch(hitReactionType){
case 1:
case 5:
hitFX = theGame.params.LIGHT_HIT_FX;
hitBackFX = theGame.params.LIGHT_HIT_BACK_FX;

hitParriedFX = theGame.params.LIGHT_HIT_PARRIED_FX;
hitBackParriedFX = theGame.params.LIGHT_HIT_BACK_PARRIED
_FX;
break;
case 2:
hitFX = theGame.params.HEAVY_HIT_FX;
hitBackFX = theGame.params.HEAVY_HIT_BACK_FX;
hitParriedFX = theGame.params.HEAVY_HIT_PARRIED_FX;
hitBackParriedFX = theGame.params.HEAVY_HIT_BACK_PARRIED
_FX;
break;
case 0:
hitFX = theGame.params.LIGHT_HIT_FX;
hitBackFX = theGame.params.LIGHT_HIT_BACK_FX;
hitParriedFX = theGame.params.LIGHT_HIT_PARRIED_FX;
hitBackParriedFX = theGame.params.LIGHT_HIT_BACK_PARRIED
_FX;
break;
default:
hitFX = 'None';
hitBackFX = 'None';
hitParriedFX = 'None';
hitBackParriedFX = 'None';
break;
}
/* NOP */;
}
protected function GetPowerStatBonusAbilityTag() : CName{
return 'None';
/* NOP */;
}
public function CanBeParried() : Bool{
return canBeParried;
/* NOP */;
}
public function CanBeDodged() : Bool{
return canBeDodged;
/* NOP */;
}
public function SetPointResistIgnored(b : Bool){
isPointResistIgnored = b;
/* NOP */;
}
public function CanPlayHitParticle() : Bool{
return canPlayHitParticle;
/* NOP */;
}
public function SetCanPlayHitParticle(b : Bool){
canPlayHitParticle = b;
/* NOP */;
}
public function GetBuffSourceName() : String{
return buffSourceName;
/* NOP */;
}
public function GetCannotReturnDamage() : Bool{
return cannotReturnDamage;
/* NOP */;
}
public function SetCannotReturnDamage(b : Bool){

cannotReturnDamage = b;
/* NOP */;
}
public function ClearDamage(){
dmgInfos.Clear();
/* NOP */;
}
public function ClearEffects(){
effectInfos.Clear();
/* NOP */;
}
public function GetHitReactionType() : EHitReactionType{
return hitReactionType;
/* NOP */;
}
public function IsPointResistIgnored() : Bool{
return isPointResistIgnored;
/* NOP */;
}
public function GetSwingType() : EAttackSwingType{
return swingType;
/* NOP */;
}
public function GetSwingDirection() : EAttackSwingDirection{
return swingDirection;
/* NOP */;
}
public function SetWasDodged(){
isDodged = true;
/* NOP */;
}
public function WasDodged() : Bool{
return isDodged;
/* NOP */;
}
public function IsDoTDamage() : Bool{
return isDoTDamage;
/* NOP */;
}
public function SetIsDoTDamage(dt : Float){
isDoTDamage = dt > 0;
DOTdt = dt;
/* NOP */;
}
public function GetDoTdt() : Float{
return DOTdt;
/* NOP */;
}
public function GetHitEffect(isBack : Bool, isParried : Bool) : CName{
if (!isBack && !isParried){
return hitFX;
} else if (isBack && !isParried){
return hitBackFX;
} else if (!isBack && isParried){
return hitParriedFX;
} else {
return hitBackParriedFX;
}
/* NOP */;
}

public function SetHitEffect(newFX : CName, isBack : Bool, isParried : B


ool){
if (!isBack && !isParried){
hitFX = newFX;
} else if (isBack && !isParried){
hitBackFX = newFX;
} else if (!isBack && isParried){
hitParriedFX = newFX;
} else {
hitBackParriedFX = newFX;
}
/* NOP */;
}
public function DealsAnyDamage() : Bool{
var actorVictim : CActor;
if (isDodged){
return false;
}
actorVictim = (CActor)victim;
if (actorVictim){
return actorVictim.UsesVitality() && processedDmg.vitali
tyDamage > 0 || actorVictim.UsesEssence() && processedDmg.essenceDamage > 0;
} else {
return processedDmg.vitalityDamage > 0 || processedDmg.e
ssenceDamage > 0;
}
/* NOP */;
}
public function DealtDamage() : Bool{
return dealtDamage;
/* NOP */;
}
public function SetDealtDamage(){
dealtDamage = true;
/* NOP */;
}
public function DealsPhysicalOrSilverDamage() : Bool{
var i : Int32;
var size : Int32;
size = dmgInfos.Size();
i = 0;
while (i < size){
if (dmgInfos[i].dmgType == theGame.params.DAMAGE_NAME_PH
YSICAL || dmgInfos[i].dmgType == theGame.params.DAMAGE_NAME_SLASHING || dmgInfos
[i].dmgType == theGame.params.DAMAGE_NAME_PIERCING || dmgInfos[i].dmgType == the
Game.params.DAMAGE_NAME_BLUDGEONING || dmgInfos[i].dmgType == theGame.params.DAM
AGE_NAME_RENDING || dmgInfos[i].dmgType == theGame.params.DAMAGE_NAME_SILVER){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function GetDamageDealt() : Float{
var actor : CActor;
actor = (CActor)victim;
if (actor && actor.UsesEssence()){
return processedDmg.essenceDamage;
}

return processedDmg.vitalityDamage;
/* NOP */;
}
public function GetPowerStatValue() : SAbilityAttributeValue{
var result : SAbilityAttributeValue;
var actor : CActor;
var signEntity : W3SignEntity;
var signProjectile : W3SignProjectile;
actor = (CActor)attacker;
if (!actor || powerStatType == 2){
result.valueBase = 0;
result.valueMultiplicative = 1;
return result;
}
signEntity = (W3SignEntity)causer;
signProjectile = (W3SignProjectile)causer;
if (!signEntity && signProjectile){
signEntity = signProjectile.GetSignEntity();
}
if (signEntity){
result = actor.GetTotalSignSpellPower(signEntity.GetSkil
l());
} else {
result = actor.GetPowerStatValue(powerStatType, /* NOP *
/, /* NOP */);
if (IsNameValid(GetPowerStatBonusAbilityTag())){
result += actor.GetPowerStatValue(powerStatType,
GetPowerStatBonusAbilityTag(), /* NOP */);
}
}
if (result.valueMultiplicative < 0){
result.valueMultiplicative = 0.001000;
}
return result;
/* NOP */;
}
public function SetAllProcessedDamageAs(val : Float){
if (val < 0.000000){
val = 0.000000;
}
processedDmg.essenceDamage = val;
processedDmg.vitalityDamage = val;
processedDmg.staminaDamage = val;
processedDmg.moraleDamage = val;
/* NOP */;
}
public function MultiplyAllDamageBy(val : Float){
if (val < 0.000000){
val = 0.000000;
}
processedDmg.essenceDamage *= val;
processedDmg.vitalityDamage *= val;
processedDmg.staminaDamage *= val;
processedDmg.moraleDamage *= val;
/* NOP */;
}
public final function IsActionMelee() : Bool{
return isActionMelee;
/* NOP */;
}

public final function IsActionRanged() : Bool{


return isActionRanged;
/* NOP */;
}
public final function IsActionWitcherSign() : Bool{
return isActionWitcherSign;
/* NOP */;
}
public final function IsActionEnvironment() : Bool{
return isActionEnvironment;
/* NOP */;
}
public final function IsParryStagger() : Bool{
return parryStagger;
/* NOP */;
}
public final function SetParryStagger(){
parryStagger = true;
/* NOP */;
}
public final function ProcessBuffsIfNoDamage() : Bool{
return shouldProcessBuffsIfNoDamage;
/* NOP */;
}
public final function SetProcessBuffsIfNoDamage(b : Bool){
shouldProcessBuffsIfNoDamage = b;
/* NOP */;
}
public final function SetIgnoreImmortalityMode(b : Bool){
ignoreImmortalityMode = b;
/* NOP */;
}
public final function GetIgnoreImmortalityMode() : Bool{
return ignoreImmortalityMode;
/* NOP */;
}
public final function SetDealtFireDamage(b : Bool){
dealtFireDamage = b;
/* NOP */;
}
public final function HasDealtFireDamage() : Bool{
return dealtFireDamage;
/* NOP */;
}
public final function SetHeadShot(){
isHeadShot = true;
/* NOP */;
}
public final function GetIsHeadShot() : Bool{
return isHeadShot;
/* NOP */;
}
public final function SetWasKilledBySingleHit(){
killedBySingleHit = true;
/* NOP */;
}
public final function WasKilledBySingleHit() : Bool{
return killedBySingleHit;
/* NOP */;
}

public final function GetIgnoreArmor() : Bool{


return ignoreArmor;
/* NOP */;
}
public final function SetIgnoreArmor(b : Bool){
ignoreArmor = b;
/* NOP */;
}
public final function SuppressHitSounds() : Bool{
return supressHitSounds;
/* NOP */;
}
public final function SetSuppressHitSounds(b : Bool){
supressHitSounds = b;
/* NOP */;
}
public final function SetEndsQuen(b : Bool){
endsQuen = b;
/* NOP */;
}
public final function EndsQuen() : Bool{
return endsQuen;
/* NOP */;
}
public final function SetArmorReducedDamageToZero(){
armorReducedDamageToZero = true;
/* NOP */;
}
public final function DidArmorReduceDamageToZero() : Bool{
return armorReducedDamageToZero;
/* NOP */;
}
public final function SetUnderwaterDisplayDamageHack(){
underwaterDisplayDamageHack = true;
/* NOP */;
}
public final function GetUnderwaterDisplayDamageHack() : Bool{
return underwaterDisplayDamageHack;
/* NOP */;
}
public final function GetDamageValue(damageName : CName) : Float{
var i : Int32;
i = 0;
while (i < dmgInfos.Size()){
if (dmgInfos[i].dmgType == damageName){
return dmgInfos[i].dmgVal;
}
i += 1;
}
return 0;
/* NOP */;
}
public final function GetDamageValueTotal() : Float{
var i : Int32;
var ret : Float;
ret = 0;
i = 0;
while (i < dmgInfos.Size()){
ret += dmgInfos[i].dmgVal;
i += 1;

}
return ret;
/* NOP */;
}
}
import struct CFocusActionComponent{
//NULL type for actionName
}
import struct CFocusSoundParam{
import public final function
import public final function
import public final function
import public final function
}

GetEventStart() : CName;
GetEventStop() : CName;
GetHearingAngle() : Float;
GetVisualEffectBoneName() : CName;

class W3Effect_Frozen extends W3ImmobilizeEffect{


private saved var killOnHit : Bool;
private var bonusDamagePercents : Float;
private saved var targetWasFlying : Bool;
private var pushPriority : EInteractionPriority;
private var wasKnockedDown : Bool;
public function OnEffectAdded(customParams : W3BuffCustomParams) : Bool{
var params : W3FrozenEffectCustomParams;
var animatedComponent : CAnimatedComponent;
var mpac : CMovingPhysicalAgentComponent;
var npc : CNewNPC;
var isJumping : Bool;
super.OnEffectAdded(customParams);
wasKnockedDown = false;
animatedComponent = (CAnimatedComponent)target.GetComponentByCla
ssName('CAnimatedComponent');
if (animatedComponent){
params = (W3FrozenEffectCustomParams)customParams;
isJumping = false;
npc = (CNewNPC)target;
if (npc){
mpac = (CMovingPhysicalAgentComponent)target.Get
ComponentByClassName('CMovingPhysicalAgentComponent');
targetWasFlying = npc.IsFlying();
if (targetWasFlying){
if (mpac){
mpac.SetAnimatedMovement(false);
}
}
if (npc.IsVisuallyOffGround() && !targetWasFlyin
g){
isJumping = true;
}
} else {
targetWasFlying = false;
}
if (!isJumping){
animatedComponent.FreezePose();
pushPriority = target.GetInteractionPriority();
target.SetInteractionPriority(-2);
} else {
isActive = false;
return true;

}
}
if (target.HasBuff(6) || target.HasBuff(9)){
target.SetStatic();
wasKnockedDown = true;
}
effectManager.PauseAllRegenEffects('FrozenEffect', /* NOP */, /*
NOP */, /* NOP */);
/* NOP */;
}
public function OnEffectRemoved() : Bool{
var animatedComponent : CAnimatedComponent;
var mpac : CMovingPhysicalAgentComponent;
super.OnEffectRemoved();
animatedComponent = (CAnimatedComponent)target.GetComponentByCla
ssName('CAnimatedComponent');
if (animatedComponent){
animatedComponent.UnfreezePoseFadeOut(1.000000);
if (targetWasFlying){
mpac = (CMovingPhysicalAgentComponent)target.Get
ComponentByClassName('CMovingPhysicalAgentComponent');
if (mpac){
mpac.SetAnimatedMovement(true);
}
}
}
target.SignalGameplayEventParamInt('ForceStopCriticalEffect', cr
iticalStateType);
effectManager.ResumeAllRegenEffects('FrozenEffect');
target.RequestCriticalAnimStop(/* NOP */);
target.SetInteractionPriority(pushPriority);
if (wasKnockedDown){
target.SetKinematic(false);
}
/* NOP */;
}
public function KillOnHit() : Bool{
return killOnHit;
/* NOP */;
}
public function OnTimeUpdated(deltaTime : Float){
if (isActive){
timeActive += deltaTime;
}
if (pauseCounters.Size() == 0){
if (duration != -1){
timeLeft -= deltaTime;
}
OnUpdate(deltaTime);
}
if (timeLeft <= 0){
LogCritical("Deactivating not animated CS <<" + critical
StateType + ">>");
isActive = false;
}
/* NOP */;
}
public function CacheSettings(){
var dm : CDefinitionsManagerAccessor;
var min : SAbilityAttributeValue;

var max : SAbilityAttributeValue;


super.CacheSettings();
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributeValue(abilityName, 'hpPercDamageBonusPerHi
t', min, max);
bonusDamagePercents = CalculateAttributeValue(GetAttributeRandom
izedValue(min, max), /* NOP */);
dm.GetAbilityAttributeValue(abilityName, 'killOnHit', min, max);
killOnHit = CalculateAttributeValue(GetAttributeRandomizedValue(
min, max), /* NOP */);
/* NOP */;
}
public function GetAdditionalDamagePercents() : Float{
return bonusDamagePercents;
/* NOP */;
}
}
class W3Action_Attack extends W3DamageAction{
private var weaponId : SItemUniqueId;
private var crossbowId : SItemUniqueId;
private var attackName : CName;
private var attackTypeName : CName;
private var isAttackReflected : Bool;
private var isParried : Bool;
private var isCountered : Bool;
private var attackAnimName : CName;
private var hitTime : Float;
private var weaponEntity : CItemEntity;
private var isCriticalHit : Bool;
private var forceExplosionDismemberment : Bool;
private var weaponSlot : CName;
private var boneIndex : Int32;
private var soundAttackType : CName;
private var instantKill : Bool;
public function Init(attackr : CGameplayEntity, victm : CGameplayEntity,
causr : IScriptable, weapId : SItemUniqueId, attName : CName, src : String, hrt
: EHitReactionType, canParry : Bool, canDodge : Bool, skillName : CName, swType
: EAttackSwingType, swDir : EAttackSwingDirection, isM : Bool, isR : Bool, isW
: Bool, isE : Bool, hitFX_ : CName, hitBackFX_ : CName, hitParriedFX_ : CName, h
itBackParriedFX_ : CName, crossId : SItemUniqueId){
var player : CR4Player;
var powerStat : ECharacterPowerStats;
if (attName == 'None' || !attackr){
LogAssert(false, "W3Action_Attack.Init: missing attack d
ata - debug (attack name OR attacker)!");
return;
}
if (theGame.GetDefinitionsManager().AbilityHasTag(attName, 'Uses
SpellPower')){
powerStat = 1;
} else {
powerStat = 0;
}
super.Initialize(attackr, victm, causr, src, hrt, powerStat, isM
, isR, isW, isE, hitFX_, hitBackFX_, hitParriedFX_, hitBackParriedFX_);
swingType = swType;
swingDirection = swDir;
attackName = attName;
weaponId = weapId;

crossbowId = crossId;
canBeParried = canParry;
canBeDodged = canDodge;
soundAttackType = 'empty';
boneIndex = -1;
player = (CR4Player)attacker;
if (IsBasicAttack(skillName) || player && player.CanUseSkill(Ski
llNameToEnum(skillName))){
attackTypeName = skillName;
} else {
attackTypeName = 'None';
}
FillDataFromWeapon();
FillDataFromAttackName();
/* NOP */;
}
protected function Clear(){
weaponId = GetInvalidUniqueId();
crossbowId = GetInvalidUniqueId();
attackName = 'None';
attackTypeName = 'None';
isAttackReflected = false;
isParried = false;
isCountered = false;
attackAnimName = 'None';
hitTime = 0;
weaponSlot = 'None';
soundAttackType = 'empty';
boneIndex = -1;
forceExplosionDismemberment = false;
weaponEntity = NULL;
isCriticalHit = false;
instantKill = false;
/* NOP */;
}
public function Initialize(att : CGameplayEntity, vict : CGameplayEntity
, caus : IScriptable, src : String, hrt : EHitReactionType, pwrStatType : EChara
cterPowerStats, isM : Bool, isR : Bool, isW : Bool, isE : Bool, hitFX_ : CName,
hitBackFX_ : CName, hitParriedFX_ : CName, hitBackParriedFX_ : CName){
LogAssert(false, "W3Action_Attack.Initialize: my friend... you a
re using wrong constructor :P - use Init()");
/* NOP */;
}
private function FillDataFromWeapon(){
var inv : CInventoryComponent;
var i : Int32;
var size : Int32;
var dmgTypes : array<CName>;
var buffs : array<SEffectInfo>;
var actorAttacker : CActor;
inv = attacker.GetInventory();
actorAttacker = (CActor)attacker;
if (actorAttacker){
size = inv.GetWeaponDTNames(weaponId, dmgTypes);
i = 0;
while (i < size){
AddDamage(dmgTypes[i], actorAttacker.GetTotalWea
ponDamage(weaponId, dmgTypes[i], crossbowId));
i += 1;
}

size = inv.GetItemBuffs(weaponId, buffs);


i = 0;
while (i < size){
AddEffectInfo(buffs[i].effectType, /* NOP */, /*
NOP */, buffs[i].effectAbilityName, /* NOP */, buffs[i].applyChance);
i += 1;
}
}
/* NOP */;
}
private function FillDataFromAttackName(){
var attributes : array<CName>;
var abilities : array<CName>;
var i : Int32;
var size : Int32;
var dm : CDefinitionsManagerAccessor;
var dmgVal : Float;
var dmgAttributeName : CName;
var abilityName : CName;
var type : EEffectType;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var actorAttacker : CActor;
actorAttacker = (CActor)attacker;
dm = theGame.GetDefinitionsManager();
if (actorAttacker && IsBasicAttack(attackName)){
i = 0;
while (i < dmgInfos.Size()){
dmgAttributeName = GetBasicAttackDamageAttribute
Name(attackName, dmgInfos[i].dmgType);
dmgVal = CalculateAttributeValue(actorAttacker.G
etAttributeValue(dmgAttributeName, /* NOP */, /* NOP */), /* NOP */);
if (dmgVal > 0){
AddDamage(dmgInfos[i].dmgType, dmgVal);
}
i += 1;
}
}
dm.GetContainedAbilities(attackName, abilities);
size = abilities.Size();
i = 0;
while (i < size){
if (IsEffectNameValid(abilities[i])){
EffectNameToType(abilities[i], type, abilityName
);
AddEffectInfo(type, /* NOP */, /* NOP */, abilit
yName, /* NOP */, /* NOP */);
}
i += 1;
}
dm.GetContainedAbilities(attackName, attributes);
size = attributes.Size();
i = 0;
while (i < size){
if (IsDamageTypeNameValid(attributes[i])){
dm.GetAbilityAttributeValue(attackName, attribut
es[i], min, max);
dmgVal = CalculateAttributeValue(GetAttributeRan
domizedValue(min, max), /* NOP */);
if (dmgVal > 0){

AddDamage(attributes[i], dmgVal);
}
}
i += 1;
}
/* NOP */;
}
public function GetHitEffect(isBack : Bool, isParried : Bool) : CName{
var ret : CName;
ret = super.GetHitEffect(isBack, isParried);
if (isCriticalHit && hitFX == ret){
ret = theGame.params.CRITICAL_HIT_FX;
}
return ret;
/* NOP */;
}
public function AddDamage(dmgType : CName, dmgVal : Float){
if (theGame.GetDefinitionsManager().AbilityHasTag(attackName, th
eGame.params.ATTACK_NO_DAMAGE)){
return;
}
if (IsActionMelee()){
dmgVal = RandRangeF(dmgVal * 1.100000, dmgVal * 0.900000
);
}
super.AddDamage(dmgType, dmgVal);
/* NOP */;
}
public function AddEffectInfo(effectType : EEffectType, duration : Float
, effectCustomValue : SAbilityAttributeValue, effectAbilityName : CName, customP
arams : W3BuffCustomParams, buffApplyChance : Float){
if (theGame.GetDefinitionsManager().AbilityHasTag(attackName, th
eGame.params.ATTACK_NO_DAMAGE)){
if (effectType == 16){
return;
}
}
super.AddEffectInfo(effectType, duration, effectCustomValue, eff
ectAbilityName, customParams, buffApplyChance);
/* NOP */;
}
public function GetPowerStatBonusAbilityTag() : CName{
return attackName;
/* NOP */;
}
public function GetWeaponId() : SItemUniqueId{
return weaponId;
/* NOP */;
}
public function SetIsParried(b : Bool){
isParried = b;
/* NOP */;
}
public function IsParried() : Bool{
return isParried;
/* NOP */;
}
public function SetIsCountered(b : Bool){
isCountered = b;
/* NOP */;

}
public function IsCountered() : Bool{
return isCountered;
/* NOP */;
}
public function SetAttackAnimName(a : CName){
attackAnimName = a;
/* NOP */;
}
public function GetAttackAnimName() : CName{
return attackAnimName;
/* NOP */;
}
public function SetHitTime(t : Float){
hitTime = t;
/* NOP */;
}
public function GetHitTime() : Float{
return hitTime;
/* NOP */;
}
public function SetWeaponEntity(e : CItemEntity){
weaponEntity = e;
/* NOP */;
}
public function GetWeaponEntity() : CItemEntity{
return weaponEntity;
/* NOP */;
}
public function SetCriticalHit(){
isCriticalHit = true;
/* NOP */;
}
public function IsCriticalHit() : Bool{
return isCriticalHit;
/* NOP */;
}
public function SetForceExplosionDismemberment(){
forceExplosionDismemberment = true;
/* NOP */;
}
public function HasForceExplosionDismemberment() : Bool{
return forceExplosionDismemberment;
/* NOP */;
}
public function SetWeaponSlot(w : CName){
weaponSlot = w;
/* NOP */;
}
public function GetWeaponSlot() : CName{
return weaponSlot;
/* NOP */;
}
public function SetSoundAttackType(s : CName){
soundAttackType = s;
/* NOP */;
}
public function GetSoundAttackType() : CName{
return soundAttackType;
/* NOP */;

}
public function SetInstantKill(){
instantKill = true;
/* NOP */;
}
public function GetInstantKill() : Bool{
return instantKill;
/* NOP */;
}
public function GetAttackName() : CName{
return attackName;
/* NOP */;
}
public function GetAttackTypeName() : CName{
return attackTypeName;
/* NOP */;
}
public function GetPowerStatValue() : SAbilityAttributeValue{
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
var result : SAbilityAttributeValue;
var horseDamageBonus : SAbilityAttributeValue;
var witcherAttacker : W3PlayerWitcher;
var temp : CName;
var actorVictim : CActor;
var actorAttacker : CActor;
var monsterCategory : EMonsterCategory;
var tmpBool : Bool;
var horse : CNewNPC;
var horseSpeed : Float;
var holdRatio : Float;
var i : Int32;
var dm : CDefinitionsManagerAccessor;
var attributes : array<CName>;
var mutagenBuff : W3Mutagen28_Effect;
var playerAttacker : CPlayer;
var mutagen25 : W3Mutagen25_Effect;
result = super.GetPowerStatValue();
actorVictim = (CActor)victim;
actorAttacker = (CActor)attacker;
if (actorVictim && actorAttacker){
theGame.GetMonsterParamsForActor(actorVictim, monsterCat
egory, temp, tmpBool, tmpBool, tmpBool);
actorAttacker.GetInventory().GetItemAbilities(weaponId,
attributes);
result += actorAttacker.GetInventory().GetItemAttributeV
alue(weaponId, MonsterCategoryToAttackPowerBonus(monsterCategory), /* NOP */, /*
NOP */);
playerAttacker = (CPlayer)actorAttacker;
if (playerAttacker && playerAttacker.HasBuff(100)){
mutagenBuff = (W3Mutagen28_Effect)playerAttacker
.GetBuff(100, /* NOP */);
result += mutagenBuff.GetMonsterDamageBonus(mons
terCategory);
}
}
witcherAttacker = (W3PlayerWitcher)attacker;
if (witcherAttacker){
if (witcherAttacker.IsHeavyAttack(attackTypeName) && wit
cherAttacker.CanUseSkill(2)){

result += witcherAttacker.GetSkillAttributeValue
(2, PowerStatEnumToName(0), false, true);
}
if (witcherAttacker.IsHeavyAttack(attackTypeName) && wit
cherAttacker.CanUseSkill(19)){
result += witcherAttacker.GetSkillAttributeValue
(19, PowerStatEnumToName(0), false, true) * witcherAttacker.GetSkillLevel(19);
}
if (witcherAttacker.IsLightAttack(attackTypeName) && wit
cherAttacker.CanUseSkill(36)){
result += witcherAttacker.GetSkillAttributeValue
(36, PowerStatEnumToName(0), false, true) * witcherAttacker.GetSkillLevel(36);
}
if (witcherAttacker.inv.IsIdValid(crossbowId) && witcher
Attacker.CanUseSkill(81)){
result += witcherAttacker.GetSkillAttributeValue
(81, PowerStatEnumToName(0), false, true);
}
if (witcherAttacker.HasRecentlyCountered() && witcherAtt
acker.CanUseSkill(26)){
result += witcherAttacker.GetSkillAttributeValue
(26, PowerStatEnumToName(0), false, true) * witcherAttacker.GetSkillLevel(26);
}
if (witcherAttacker.IsLightAttack(attackTypeName)){
result += witcherAttacker.GetAttributeValue('att
ack_power_fast_style', /* NOP */, /* NOP */);
}
if (witcherAttacker.IsHeavyAttack(attackTypeName)){
result += witcherAttacker.GetAttributeValue('att
ack_power_heavy_style', /* NOP */, /* NOP */);
}
if (SkillNameToEnum(attackTypeName) == 17){
holdRatio = witcherAttacker.GetSpecialAttackTime
Ratio();
max = witcherAttacker.GetSkillAttributeValue(17,
PowerStatEnumToName(0), false, true);
result += max * holdRatio;
}
}
if (actorAttacker){
horse = (CNewNPC)actorAttacker.GetUsedVehicle();
if (horse && horse.IsHorse()){
if (actorAttacker == thePlayer && thePlayer.HasB
uff(97) && IsActionMelee()){
mutagen25 = (W3Mutagen25_Effect)thePlaye
r.GetBuff(97, /* NOP */);
result += mutagen25.GetAttackPowerBonus(
);
}
}
}
dm = theGame.GetDefinitionsManager();
dm.GetAbilityAttributes(attackName, attributes);
i = 0;
while (i < attributes.Size()){
if (PowerStatNameToEnum(attributes[i]) == powerStatType)
{
dm.GetAbilityAttributeValue(attackName, attribut
es[i], min, max);
result += GetAttributeRandomizedValue(min, max);

break;
}
i += 1;
}
if (result.valueMultiplicative < 0){
result.valueMultiplicative = 0.001000;
}
return result;
/* NOP */;
}
public final function GetHitBoneIndex() : Int32{
var weaponEntity : CItemEntity;
var weaponSlotMatrix : Matrix;
var weaponSlotPosition : Vector;
var weaponTipSlotPosition : Vector;
var i : Int32;
var dist : Float;
var min : Float;
var category : CName;
var cr4HumanoidCombatComponent : CR4HumanoidCombatComponent;
if (boneIndex == -1){
category = attacker.GetInventory().GetItemCategory(weapo
nId);
weaponSlotPosition = MatrixGetTranslation(attacker.GetBo
neWorldMatrixByIndex(attacker.GetBoneIndex(weaponSlot)));
if (category == 'monster_weapon'){
boneIndex = victim.GetRootAnimatedComponent().Fi
ndNearestBoneWS(weaponSlotPosition);
} else if (category == 'fist'){
} else {
weaponEntity = attacker.GetInventory().GetItemEn
tityUnsafe(weaponId);
if (weaponEntity){
weaponEntity.CalcEntitySlotMatrix('blood
_fx_point', weaponSlotMatrix);
weaponTipSlotPosition = MatrixGetTransla
tion(weaponSlotMatrix);
cr4HumanoidCombatComponent = (CR4Humanoi
dCombatComponent)victim.GetComponentByClassName('CR4HumanoidCombatComponent');
if (cr4HumanoidCombatComponent){
boneIndex = cr4HumanoidCombatCom
ponent.GetBoneClosestToEdge(weaponSlotPosition, weaponTipSlotPosition, /* NOP */
);
} else {
boneIndex = victim.GetRootAnimat
edComponent().FindNearestBoneToEdgeWS(weaponSlotPosition, weaponTipSlotPosition)
;
}
}
}
}
return boneIndex;
/* NOP */;
}
}
class CR4ScriptedHud extends CR4Hud{
private var m_hudSize : Int32;
private var m_minimapRotationEnabled : Bool;
private var m_minimapZoom : Float;

private var m_HudFlashSFS : CScriptedFlashSprite;


private var m_fxShowModulesSFF : CScriptedFlashFunction;
private var m_fxPrintInfoSFF : CScriptedFlashFunction;
private var m_fxSetInputContextSFF : CScriptedFlashFunction;
private var m_fxSetIsDynamicSFF : CScriptedFlashFunction;
private var m_fxSetControllerType : CScriptedFlashFunction;
private var m_fxSwapAcceptCancel : CScriptedFlashFunction;
protected var m_fxSetGamepadType : CScriptedFlashFunction;
protected var m_fxLockControlScheme : CScriptedFlashFunction;
private var hudModules : array<CR4HudModuleBase>;
public var hudModulesNames : array<CName>;
public var currentInputContext : CName;
public var previousInputContext : CName;
private var m_isDynamic : Bool;
private var m_guiManager : CR4GuiManager;
private var m_deathTimerActive : Bool;
private var m_deathTimer : Float;
private var m_scaleformWidth : Int32;
private var m_scaleformHeight : Int32;
private var m_scaleformOffsetX : Int32;
private var m_scaleformOffsetY : Int32;
private var _cachedEntity : CEntity;
private var _cachedEntityPosition : Vector;
public function OnTick(timeDelta : Float) : Bool{
ClearCachedPositionForEntity();
UpdateLootPopupContext();
if (currentInputContext != theInput.GetContext()){
previousInputContext = currentInputContext;
currentInputContext = theInput.GetContext();
if (IsRadialMenuOpened() && currentInputContext != 'Radi
alMenu' && !IsRadialMenuOverwritenByContext(currentInputContext)){
theInput.RestoreContext('RadialMenu', true);
theInput.StoreContext('RadialMenu');
currentInputContext = 'RadialMenu';
/* NOP */;
} else {
m_fxSetInputContextSFF.InvokeSelfOneArg(FlashArg
String(currentInputContext));
}
GetHudEventController().RunEvent_ControlsFeedbackModule_
Update(currentInputContext);
OnInputContextChanged();
/* NOP */;
/* NOP */;
}
UpdateDeathTimer(timeDelta);
GetHudEventController().RunDelayedEvents();
/* NOP */;
}
protected function UpdateLootPopupContext(){
var lootPopup : CR4LootPopup;
lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('Loot
Popup');
if (lootPopup){
lootPopup.UpdateInputContext();
}
/* NOP */;
}
public function StartDeathTimer(duration : Float){
m_deathTimer = duration;

m_deathTimerActive = true;
/* NOP */;
}
private function UpdateDeathTimer(timeDelta : Float){
var currentMenu : CR4Menu;
if (m_deathTimerActive){
m_deathTimer -= timeDelta;
if (m_deathTimer <= 0.000000){
m_deathTimerActive = false;
currentMenu = theGame.GetGuiManager().GetRootMen
u();
if (currentMenu){
currentMenu.CloseMenu();
}
theGame.RequestMenu('DeathScreenMenu', /* NOP */
);
theInput.StoreContext('Death');
}
}
/* NOP */;
}
private function GetHudEventController() : CR4HudEventController{
return theGame.GetGuiManager().GetHudEventController();
/* NOP */;
}
private function OnInputContextChanged(){
var module : CR4HudModuleInteractions;
module = (CR4HudModuleInteractions)GetHudModule("InteractionsMod
ule");
if (module){
module.OnInputContextChanged();
}
/* NOP */;
}
public function RefreshHudConfiguration(){
UpdateScaleformStageSize();
UpdateHudScale();
UpdateHudConfigs();
/* NOP */;
}
public function UpdateScaleformStageSize(){
var currentWidth : Int32;
var currentHeight : Int32;
var ratio : Float;
theGame.GetCurrentViewportResolution(currentWidth, currentHeight
);
ratio = currentWidth / currentHeight;
if (AbsF(ratio - 4.000000 / 3.000000) < 0.010000){
m_scaleformWidth = 1920;
m_scaleformHeight = 1440;
m_scaleformOffsetX = 0;
m_scaleformOffsetY = -180;
} else if (AbsF(ratio - 21.000000 / 9.000000) < 0.010000){
m_scaleformWidth = 2520;
m_scaleformHeight = 1080;
m_scaleformOffsetX = -300;
m_scaleformOffsetY = 0;
} else {
m_scaleformWidth = 1920;
m_scaleformHeight = 1080;

m_scaleformOffsetX = 0;
m_scaleformOffsetY = 0;
}
/* NOP */;
}
public function GetScaleformPoint(x : Float, y : Float) : Vector{
var normalizedPoint : Vector;
normalizedPoint.X = x * m_scaleformWidth + m_scaleformOffsetX;
normalizedPoint.Y = y * m_scaleformHeight + m_scaleformOffsetY;
return normalizedPoint;
/* NOP */;
}
public function UpdateHudScale(){
var l_hudModuleAnchors : CR4HudModuleAnchors;
l_hudModuleAnchors = (CR4HudModuleAnchors)GetHudModule("AnchorsM
odule");
if (l_hudModuleAnchors){
l_hudModuleAnchors.UpdateAnchorsAspectRatio();
}
if (m_hudSize == 1){
theGame.SetUIGamepadScaleGain(0.250000);
} else {
theGame.SetUIGamepadScaleGain(0.000000);
}
theGame.SetUIOpacity(1);
RescaleModules();
/* NOP */;
}
public function OnConfigUI() : Bool{
var i : Int32;
m_HudFlashSFS = GetHudFlash();
m_guiManager = theGame.GetGuiManager();
UpdateScaleformStageSize();
UpdateHudScale();
m_fxShowModulesSFF = m_HudFlashSFS.GetMemberFlashFunction("ShowM
odules");
m_fxPrintInfoSFF = m_HudFlashSFS.GetMemberFlashFunction("PrintIn
fo");
m_fxSetInputContextSFF = m_HudFlashSFS.GetMemberFlashFunction("S
etInputContext");
m_fxSetIsDynamicSFF = m_HudFlashSFS.GetMemberFlashFunction("SetD
ynamic");
m_fxSetControllerType = m_HudFlashSFS.GetMemberFlashFunction("se
tControllerType");
m_fxSwapAcceptCancel = m_HudFlashSFS.GetMemberFlashFunction("swa
pAcceptCancel");
m_fxSetGamepadType = m_HudFlashSFS.GetMemberFlashFunction("setGa
mepadType");
m_fxLockControlScheme = m_HudFlashSFS.GetMemberFlashFunction("lo
ckControlScheme");
CreateHudModule("AnchorsModule", /* NOP */);
hudModulesNames.PushBack('ControlsFeedbackModule');
hudModulesNames.PushBack('HorseStaminaBarModule');
hudModulesNames.PushBack('HorsePanicBarModule');
hudModulesNames.PushBack('InteractionsModule');
hudModulesNames.PushBack('MessageModule');
hudModulesNames.PushBack('RadialMenuModule');
hudModulesNames.PushBack('QuestsModule');
hudModulesNames.PushBack('SubtitlesModule');
hudModulesNames.PushBack('BuffsModule');

hudModulesNames.PushBack('WolfHeadModule');
hudModulesNames.PushBack('ItemInfoModule');
hudModulesNames.PushBack('OxygenBarModule');
hudModulesNames.PushBack('EnemyFocusModule');
hudModulesNames.PushBack('BossFocusModule');
hudModulesNames.PushBack('DialogModule');
hudModulesNames.PushBack('BoatHealthModule');
hudModulesNames.PushBack('ConsoleModule');
hudModulesNames.PushBack('JournalUpdateModule');
hudModulesNames.PushBack('AreaInfoModule');
hudModulesNames.PushBack('CrosshairModule');
hudModulesNames.PushBack('OnelinersModule');
hudModulesNames.PushBack('Minimap2Module');
hudModulesNames.PushBack('CompanionModule');
hudModulesNames.PushBack('DamagedItemsModule');
hudModulesNames.PushBack('TimeLapseModule');
i = 0;
while (i < hudModulesNames.Size()){
CreateHudModule(NameToString(hudModulesNames[i]), /* NOP
*/);
i += 1;
}
m_fxSetIsDynamicSFF.InvokeSelfOneArg(FlashArgBool(m_isDynamic));
UpdateHudConfigs();
UpdateAcceptCancelSwaping();
UpdateControlSchemeLock();
/* NOP */;
}
public function ForceShow(show : Bool){
m_HudFlashSFS.SetVisible(show);
/* NOP */;
}
public function UpdateAcceptCancelSwaping(){
var inGameConfigWrapper : CInGameConfigWrapper;
var configValue : Bool;
var radialMenuModule : CR4HudModuleRadialMenu;
if (m_fxSwapAcceptCancel){
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
configValue = inGameConfigWrapper.GetVarValue('Controls'
, 'SwapAcceptCancel');
m_fxSwapAcceptCancel.InvokeSelfOneArg(FlashArgBool(confi
gValue));
}
radialMenuModule = (CR4HudModuleRadialMenu)GetHudModule("RadialM
enuModule");
if (radialMenuModule){
radialMenuModule.UpdateSwapAcceptCancel();
}
/* NOP */;
}
protected function UpdateControlSchemeLock(){
if (m_fxLockControlScheme && m_guiManager){
m_fxLockControlScheme.InvokeSelfOneArg(FlashArgUInt(m_gu
iManager.GetLockedControlScheme()));
}
/* NOP */;
}
public function UpdateInputDevice(){
if (m_fxSetControllerType){
m_fxSetControllerType.InvokeSelfOneArg(FlashArgBool(theI

nput.LastUsedGamepad()));
}
/* NOP */;
}
public function UpdateHudConfigs(){
UpdateHudConfig('Subtitles', false);
UpdateHudConfig('HudSize', false);
UpdateHudConfig('TimeLapseModule', false);
UpdateHudConfig('BoatHealthModule', false);
UpdateHudConfig('BossFocusModule', false);
UpdateHudConfig('BuffsModule', false);
UpdateHudConfig('CompanionModule', false);
UpdateHudConfig('ConsoleModule', false);
UpdateHudConfig('DamagedItemsModule', false);
UpdateHudConfig('EnemyFocusModule', false);
UpdateHudConfig('HorsePanicBarModule', false);
UpdateHudConfig('HorseStaminaBarModule', false);
UpdateHudConfig('ItemInfoModule', false);
UpdateHudConfig('Minimap2Module', false);
UpdateHudConfig('DayWeatherIndicator', false);
UpdateHudConfig('TrackedMonster', false);
UpdateHudConfig('OnelinersModule', false);
UpdateHudConfig('OxygenBarModule', false);
UpdateHudConfig('QuestsModule', false);
UpdateHudConfig('WolfMedalion', false);
UpdateHudConfig('MessageModule', false);
UpdateHudConfig('MinimapRotation', false);
UpdateHudConfig('MinimapFocusClues', false);
UpdateHudConfig('MinimapTracksWaypoints', false);
UpdateHudConfig('MiminapPoiQuestionMarks', false);
UpdateHudConfig('ControlsFeedbackModule', false);
UpdateHUD();
/* NOP */;
}
public function UpdateHudConfig(configName : CName, updateHud : Bool){
var configValue : String;
var inGameConfigWrapper : CInGameConfigWrapper;
var module : CR4HudModuleBase;
var enemyFocusModule : CR4HudModuleEnemyFocus;
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
switch(configName){
case 'HudSize':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
SetHudSize(StringToInt(configValue, /* NOP */), true);
break;
case 'Subtitles':
configValue = inGameConfigWrapper.GetVarValue('Localizat
ion', configName);
module = (CR4HudModuleBase)GetHudModule(NameToString('Su
btitlesModule'));
if (module){
module.SetEnabled(configValue == "true");
}
theGame.setDialogDisplayDisabled(configValue == "false")
;
break;
case 'WolfMedalion':
case 'TimeLapseModule':
case 'BoatHealthModule':

case
case
case
case
case
case
case
case
case
case
case
case
case
case

'BossFocusModule':
'CompanionModule':
'ConsoleModule':
'DamagedItemsModule':
'HorsePanicBarModule':
'HorseStaminaBarModule':
'ItemInfoModule':
'Minimap2Module':
'OnelinersModule':
'OxygenBarModule':
'QuestsModule':
'MessageModule':
'BuffsModule':
'ControlsFeedbackModule':
configValue = inGameConfigWrapper.GetVarValue('Hud', con

figName);
if (configName == 'WolfMedalion'){
configName = 'WolfHeadModule';
}
module = (CR4HudModuleBase)GetHudModule(NameToString(con
figName));
if (module){
module.SetEnabled(configValue == "true");
}
break;
case 'EnemyFocusModule':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
enemyFocusModule = (CR4HudModuleEnemyFocus)GetHudModule(
NameToString(configName));
if (enemyFocusModule){
enemyFocusModule.ShowOnlyName(configValue == "fa
lse");
}
break;
case 'DayWeatherIndicator':
break;
case 'TrackedMonster':
break;
case 'MinimapRotation':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
EnableMinimapRotation(configValue == "true");
break;
case 'MinimapFocusClues':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
theGame.GetCommonMapManager().ShowFocusClues(configValue
== "true");
break;
case 'MiminapPoiQuestionMarks':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
theGame.GetCommonMapManager().ShowKnownEntities(configVa
lue == "true");
break;
case 'MinimapTracksWaypoints':
configValue = inGameConfigWrapper.GetVarValue('Hud', con
figName);
theGame.GetCommonMapManager().ShowHintWaypoints(configVa

lue == "true");
break;
}
if (updateHud){
UpdateHUD();
}
/* NOP */;
}
public function EnableBuffedMonsterDisplay(value : Bool){
var minimapModule : CR4HudModuleMinimap2;
minimapModule = (CR4HudModuleMinimap2)GetHudModule("Minimap2Modu
le");
minimapModule.bDisplayBuffedMoster = value;
/* NOP */;
}
public function Toggle24HRFormat(value : Bool){
var minimapModule : CR4HudModuleMinimap2;
minimapModule = (CR4HudModuleMinimap2)GetHudModule("Minimap2Modu
le");
minimapModule.b24HRFormat = value;
minimapModule.RefreshTimeDisplay();
/* NOP */;
}
public function AddHudModuleReference(hudModule : CR4HudModuleBase){
if (hudModules.FindFirst(hudModule) < 0){
hudModules.PushBack(hudModule);
}
/* NOP */;
}
public function HandleDialogClosed(messageId : Int32){
var hudModuleDialog : CR4HudModuleDialog;
if (messageId == UMID_MissingContentOnDialogError){
hudModuleDialog = GetDialogModule();
if (hudModuleDialog){
hudModuleDialog.OnMissingContentDialogClosed();
}
}
/* NOP */;
}
public function GetDialogModule() : CR4HudModuleDialog{
return (CR4HudModuleDialog)GetHudModule("DialogModule");
/* NOP */;
}
public function GetDamagedItemModule() : CR4HudModuleDamagedItems{
return (CR4HudModuleDamagedItems)GetHudModule("DamagedItemsModul
e");
/* NOP */;
}
public function RescaleModules(){
var i : Int32;
i = 0;
while (i < hudModules.Size()){
hudModules[i].SnapToAnchorPosition();
i += 1;
}
/* NOP */;
}
public function IsRadialMenuOpened() : Bool{
var radialMenuModule : CR4HudModuleRadialMenu;
radialMenuModule = (CR4HudModuleRadialMenu)GetHudModule("RadialM

enuModule");
if (radialMenuModule){
return radialMenuModule.IsRadialMenuOpened();
}
return false;
/* NOP */;
}
public function IsRadialMenuOverwritenByContext(context : CName) : Bool{
switch(context){
case 'Scene':
case 'FastMenu':
case 'EMPTY_CONTEXT':
return true;
default:
}
return false;
return false;
/* NOP */;
}
public function OnDialogHudShow() : Bool{
theInput.StoreContext('Scene');
/* NOP */;
}
public function OnDialogHudHide() : Bool{
theInput.RestoreContext('Scene', true);
/* NOP */;
}
public function OnDialogSentenceSet(text : String) : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogSentenceSet(text);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogPreviousSentenceSet(text : String) : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogPreviousSentenceSet(text);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogPreviousSentenceHide() : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogPreviousSentenceHide();
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogSentenceHide() : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();

if (dialogModule){
dialogModule.OnDialogSentenceHide();
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogChoicesSet(choices : array<SSceneChoice>) : Bool
{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogChoicesSet(choices);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogChoiceTimeoutSet(timeOutPercent : Float) : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogChoiceTimeoutSet(timeOutPercent);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogChoiceTimeoutHide() : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogChoiceTimeoutHide();
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogSkipConfirmShow() : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogSkipConfirmShow();
} else {
/* NOP */;
}
/* NOP */;
}
public function OnDialogSkipConfirmHide() : Bool{
var dialogModule : CR4HudModuleDialog;
dialogModule = GetDialogModule();
if (dialogModule){
dialogModule.OnDialogSkipConfirmHide();
} else {
/* NOP */;
}
/* NOP */;
}
public function OnSubtitleAdded(id : Int32, speakerNameDisplayText : Str
ing, htmlString : String) : Bool{

var subtitlesModule : CR4HudModuleSubtitles;


subtitlesModule = (CR4HudModuleSubtitles)GetHudModule("Subtitles
Module");
if (subtitlesModule){
subtitlesModule.OnSubtitleAdded(id, speakerNameDisplayTe
xt, htmlString);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnSubtitleRemoved(id : Int32) : Bool{
var subtitlesModule : CR4HudModuleSubtitles;
subtitlesModule = (CR4HudModuleSubtitles)GetHudModule("Subtitles
Module");
if (subtitlesModule){
subtitlesModule.OnSubtitleRemoved(id);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnVideoSubtitles(subtitles : String) : Bool{
/* NOP */;
if (subtitles != ""){
OnDialogSentenceSet(subtitles);
} else {
OnDialogSentenceHide();
}
/* NOP */;
}
public function OnCreateOneliner(target : CEntity, value : String, ID :
Int32) : Bool{
var onelinersModule : CR4HudModuleOneliners;
onelinersModule = (CR4HudModuleOneliners)GetHudModule("Oneliners
Module");
if (onelinersModule){
onelinersModule.OnCreateOneliner(target, value, ID);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnRemoveOneliner(ID : Int32) : Bool{
var onelinersModule : CR4HudModuleOneliners;
onelinersModule = (CR4HudModuleOneliners)GetHudModule("Oneliners
Module");
if (onelinersModule){
onelinersModule.OnRemoveOneliner(ID);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnInteractionsUpdated(component : CInteractionComponent)
: Bool{
var interactionsModule : CR4HudModuleInteractions;
interactionsModule = (CR4HudModuleInteractions)GetHudModule("Int
eractionsModule");
if (interactionsModule){

interactionsModule.OnInteractionsUpdated(component);
} else {
/* NOP */;
}
/* NOP */;
}
public function IsInteractionInCameraView(interaction : CInteractionComp
onent) : Bool{
var interactionsModule : CR4HudModuleInteractions;
interactionsModule = (CR4HudModuleInteractions)GetHudModule("Int
eractionsModule");
if (interactionsModule){
return interactionsModule.IsInteractionInCameraView(inte
raction);
}
return false;
/* NOP */;
}
public function OnDebugTextShown(text : String) : Bool{
}
public function OnDebugTextHidden() : Bool{
}
public function OnCharacterEvent(journalCharacter : CJournalCharacter) :
Bool{
/* NOP */;
OnJournalUpdate(journalCharacter, false);
m_guiManager.RegisterNewGlossaryEntry(journalCharacter, 'panel_t
itle_glossary_dictionary', /* NOP */);
/* NOP */;
}
public function OnCharacterDescriptionEvent(journalCharacterDescription
: CJournalCharacterDescription) : Bool{
var journalCharacter : CJournalCharacter;
/* NOP */;
journalCharacter = (CJournalCharacter)journalCharacterDescriptio
n.GetParent();
if (journalCharacter){
OnJournalUpdate(journalCharacter, true);
}
/* NOP */;
}
public function OnCreatureEvent(journalCreature : CJournalCreature) : Bo
ol{
/* NOP */;
OnJournalUpdate(journalCreature, false);
m_guiManager.RegisterNewGlossaryEntry(journalCreature, 'panel_ti
tle_glossary_bestiary', /* NOP */);
/* NOP */;
}
public function OnCreatureDescriptionEvent(journalCreatureDescription :
CJournalCreatureDescriptionEntry) : Bool{
var journalCreature : CJournalCreature;
/* NOP */;
journalCreature = (CJournalCreature)journalCreatureDescription.G
etParent();
if (journalCreature){
OnJournalUpdate(journalCreature, true);
}
/* NOP */;
}

public function OnGlossaryEvent(journalGlossary : CJournalGlossary) : Bo


ol{
}
public function OnGlossaryDescriptionEvent(journalGlossaryDescription :
CJournalGlossaryDescription) : Bool{
}
public function OnStoryBookPageEvent(journalStoryBookPage : CJournalStor
yBookPage) : Bool{
/* NOP */;
/* NOP */;
}
public function OnTutorialEvent(journalTutorial : CJournalTutorial) : Bo
ol{
/* NOP */;
/* NOP */;
}
public function OnPlaceEvent(journalPlace : CJournalPlace) : Bool{
/* NOP */;
/* NOP */;
}
public function OnPlaceDescriptionEvent(journalPlaceDescription : CJourn
alPlaceDescription) : Bool{
/* NOP */;
/* NOP */;
}
public function OnQuestEvent(journalQuest : CJournalQuest) : Bool{
/* NOP */;
OnQuestUpdate(journalQuest, true);
/* NOP */;
}
public function OnQuestObjectiveEvent(journalQuest : CJournalQuest, jour
nalObjective : CJournalQuestObjective) : Bool{
/* NOP */;
OnQuestUpdate(journalQuest, false);
/* NOP */;
}
public function OnQuestUpdate(journalQuest : CJournalQuest, isQuestUpdat
e : Bool){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
var manager : CWitcherJournalManager;
var status : Int32;
var id : Int32;
var itemIds : array<SItemUniqueId>;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddQuestUpdate(journalQuest, isQu
estUpdate);
}
manager = theGame.GetJournalManager();
status = manager.GetEntryStatus(journalQuest);
if (status == 2){
thePlayer.inv.GetAllItems(itemIds);
theTelemetry.LogWithLabel(35, "QUEST COMPLETED - ECONOMY
REPORT");
theTelemetry.LogWithLabelAndValue(35, "Crowns", thePlaye
r.GetMoney());
id = itemIds.Size() - 1;
while (id >= 0){
theTelemetry.LogWithLabelAndValue(35, thePlayer.

inv.GetItemName(itemIds[id]), thePlayer.inv.GetItemQuantity(itemIds[id]));
id -= 1;
}
}
/* NOP */;
}
public function OnLevelUpUpdate(level : Int32, show : Bool){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
var hudQuestsModule : CR4HudModuleQuests;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
if (show){
hudJournalUpdateModule.AddLevelUpUpdate(level);
}
if (thePlayer.IsCiri()){
show = false;
}
OnShowLevelUpIndicator(show);
}
hudQuestsModule = (CR4HudModuleQuests)GetHudModule("QuestsModule
");
if (hudQuestsModule){
hudQuestsModule.OnLevelUp();
}
/* NOP */;
}
public function OnShowLevelUpIndicator(show : Bool){
var hudWolfHeadModule : CR4HudModuleWolfHead;
hudWolfHeadModule = (CR4HudModuleWolfHead)GetHudModule("WolfHead
Module");
if (hudWolfHeadModule){
hudWolfHeadModule.ShowLevelUpIndicator(show);
}
/* NOP */;
}
public function OnExperienceUpdate(exp : Int32, show : Bool){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule && show){
if (show){
hudJournalUpdateModule.AddExperienceUpdate(exp);
}
}
/* NOP */;
}
public function OnMapPinUpdate(mapPinTag : CName){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddMapPinUpdate(mapPinTag);
}
/* NOP */;
}
public function OnItemRecivedDuringScene(itemName : CName, quantity : In
t32){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule

("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddItemRecivedDuringSceneUpdate(i
temName, quantity);
}
/* NOP */;
}
public function OnJournalUpdate(journalEntry : CJournalBase, isDescripti
on : Bool){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddJournalUpdate(journalEntry, is
Description);
}
/* NOP */;
}
public function OnCraftingSchematicUpdate(schematicName : CName){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddCraftingSchematicUpdate(schema
ticName);
}
m_guiManager.RegisterNewGlossaryEntry(NULL, 'panel_title_craftin
g', schematicName);
/* NOP */;
}
public function OnAlchemySchematicUpdate(schematicName : CName){
var hudJournalUpdateModule : CR4HudModuleJournalUpdate;
hudJournalUpdateModule = (CR4HudModuleJournalUpdate)GetHudModule
("JournalUpdateModule");
if (hudJournalUpdateModule){
hudJournalUpdateModule.AddAlchemySchematicUpdate(schemat
icName);
}
m_guiManager.RegisterNewAlchemyEntry(schematicName);
/* NOP */;
}
public function OnQuestTrackingStarted(journalQuest : CJournalQuest) : B
ool{
GetHudEventController().RunEvent_QuestsModule_OnQuestTrackingSta
rted(journalQuest);
/* NOP */;
/* NOP */;
}
public function OnTrackedQuestUpdated(journalQuest : CJournalQuest) : Bo
ol{
var hudQuestTrackerModule : CR4HudModuleQuests;
hudQuestTrackerModule = (CR4HudModuleQuests)GetHudModule("Quests
Module");
if (hudQuestTrackerModule){
hudQuestTrackerModule.OnTrackedQuestUpdated(journalQuest
);
} else {
/* NOP */;
}
/* NOP */;

/* NOP */;
}
public function OnTrackedQuestObjectivesUpdated(journalObjective : CJour
nalQuestObjective) : Bool{
var hudQuestTrackerModule : CR4HudModuleQuests;
hudQuestTrackerModule = (CR4HudModuleQuests)GetHudModule("Quests
Module");
if (hudQuestTrackerModule){
hudQuestTrackerModule.OnTrackedQuestObjectivesUpdated(jo
urnalObjective);
} else {
/* NOP */;
}
/* NOP */;
/* NOP */;
}
public function OnTrackedQuestObjectiveCounterUpdated(journalObjective :
CJournalQuestObjective) : Bool{
var hudQuestTrackerModule : CR4HudModuleQuests;
hudQuestTrackerModule = (CR4HudModuleQuests)GetHudModule("Quests
Module");
if (hudQuestTrackerModule){
hudQuestTrackerModule.OnTrackedQuestObjectiveCounterUpda
ted(journalObjective);
} else {
/* NOP */;
}
/* NOP */;
/* NOP */;
}
public function OnTrackedQuestObjectiveHighlighted(journalObjective : CJ
ournalQuestObjective, journalObjectiveIndex : Int32) : Bool{
GetHudEventController().RunEvent_QuestsModule_OnTrackedQuestObje
ctiveHighlighted(journalObjective, journalObjectiveIndex);
/* NOP */;
/* NOP */;
}
public function __PrintInfo(){
m_fxPrintInfoSFF.InvokeSelf();
/* NOP */;
}
private function SetHudSize(size : Int32, update : Bool){
m_hudSize = size;
if (update){
UpdateHudScale();
}
/* NOP */;
}
public function IsEnabledMinimapRotation() : Bool{
return m_minimapRotationEnabled;
/* NOP */;
}
private function EnableMinimapRotation(enable : Bool){
var module : CR4HudModuleMinimap2;
m_minimapRotationEnabled = enable;
module = (CR4HudModuleMinimap2)GetHudModule("Minimap2Module");
if (module){
module.EnableRotation(enable);
}
/* NOP */;

}
public function SetMinimapZoom(zoom : Float){
m_minimapZoom = zoom;
/* NOP */;
}
public function GetMinimapZoom() : Float{
return m_minimapZoom;
/* NOP */;
}
public function HudConsoleMsg(msgText : String){
var module : CR4HudModuleConsole;
module = (CR4HudModuleConsole)GetHudModule("ConsoleModule");
if (module){
module.ConsoleMsg(msgText);
}
/* NOP */;
}
public function HudConsoleTest(){
var module : CR4HudModuleConsole;
module = (CR4HudModuleConsole)GetHudModule("ConsoleModule");
if (module){
module.ConsoleTest();
}
/* NOP */;
}
public function HudConsoleCleanup(){
var module : CR4HudModuleConsole;
module = (CR4HudModuleConsole)GetHudModule("ConsoleModule");
if (module){
module.ConsoleCleanup();
}
/* NOP */;
}
public function SetDynamic(value : Bool){
m_isDynamic = value;
m_fxSetIsDynamicSFF.InvokeSelfOneArg(FlashArgBool(m_isDynamic));
UpdateHUD();
/* NOP */;
}
public function GetDynamic() : Bool{
return m_isDynamic;
/* NOP */;
}
public function UpdateHUD(){
m_fxSetInputContextSFF.InvokeSelfOneArg(FlashArgString(currentIn
putContext));
/* NOP */;
}
public function DisplayTutorialHighlight(tutorialName : CName, bShow : B
ool){
var hudModule : CR4HudModuleBase;
/* NOP */;
switch(tutorialName){
case 'TutorialHorseStamina':
hudModule = (CR4HudModuleBase)GetHudModule("HorseStamina
BarModule");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
break;
case 'TutorialOxygen':

hudModule = (CR4HudModuleBase)GetHudModule("OxygenBarMod
ule");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
break;
case 'TutorialMinimap':
case 'TutorialActiveGoalHighlight':
case 'TutorialMinimapAndQuestLog':
hudModule = (CR4HudModuleBase)GetHudModule("Minimap2Modu
le");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
if (tutorialName != 'TutorialMinimapAndQuestLog'){
break;
}
case 'TutorialMinimapAndQuestLog':
case 'TutorialQuestTodo':
hudModule = (CR4HudModuleBase)GetHudModule("QuestsModule
");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
case
case
case
case

break;
'TutorialFallingDamage':
'TutorialStaminaSigns':
'TutorialStaminaExploration':
'TutorialAdrenaline':
hudModule = (CR4HudModuleBase)GetHudModule("WolfHeadModu

le");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
break;
case 'TutorialBuffs':
hudModule = (CR4HudModuleBase)GetHudModule("BuffsModule"
);
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
case
case
case
case
case
case
case

break;
'TutorialSelectQuen':
'TutorialSelectIgni':
'TutorialSelectAard':
'TutorialSelectAxii':
'TutorialSelectYrden':
'TutorialSelectPetard':
'TutorialSelectCrossbow':
hudModule = (CR4HudModuleBase)GetHudModule("RadialMenuMo

dule");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
break;
case 'TutorialLootWindow':
hudModule = (CR4HudModuleBase)GetHudModule("LootPopupMod
ule");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));
break;
case 'TutorialBoatDamage':
hudModule = (CR4HudModuleBase)GetHudModule("BoatHealthMo
dule");
hudModule.ShowTutorialHighlight(bShow, NameToString(tuto
rialName));

break;
default:
break;
}
/* NOP */;
}
public function IsCachedPositionForEntity(entity : CEntity) : Bool{
return _cachedEntity == entity;
/* NOP */;
}
public function GetCachedPositionForEntity(entity : CEntity) : Vector{
return _cachedEntityPosition;
/* NOP */;
}
public function SetCachedPositionForEntity(entity : CEntity, pos : Vecto
r){
_cachedEntity = entity;
_cachedEntityPosition = pos;
/* NOP */;
}
public function ClearCachedPositionForEntity(){
_cachedEntity = NULL;
/* NOP */;
}
}
class CLightEntitySimple extends CScheduledUsableEntity{
private var isOn : Bool;
public function Activate(flag : Bool){
if (flag){
TurnLightOn();
} else {
TurnLightOff();
}
super.Activate(flag);
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
PlayEffect('aard', /* NOP */);
TurnLightOff();
super.OnAardHit(sign);
/* NOP */;
}
public function OnIgniHit(sign : W3IgniProjectile) : Bool{
PlayEffect('igni', /* NOP */);
TurnLightOn();
super.OnIgniHit(sign);
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
TurnLightOn();
/* NOP */;
}
public function OnFrostHit(source : CGameplayEntity) : Bool{
super.OnFrostHit(source);
TurnLightOff();
/* NOP */;
}
protected function TurnLightOn(){
var comp : CComponent;

if (isOn){
return;
}
StopEffect('smoke');
AddTag(theGame.params.TAG_OPEN_FIRE);
comp = GetComponentByClassName('CLightComponent');
if (comp){
comp.SetEnabled(true);
PlayEffect('fire', /* NOP */);
}
isOn = true;
/* NOP */;
}
protected function TurnLightOff(){
var comp : CComponent;
if (!isOn){
return;
}
StopEffect('fire');
RemoveTag(theGame.params.TAG_OPEN_FIRE);
comp = GetComponentByClassName('CLightComponent');
if (comp){
comp.SetEnabled(false);
}
PlayEffect('smoke', /* NOP */);
AddTimer('StopSmoke', 15, /* NOP */, /* NOP */, /* NOP */, /* NO
P */, /* NOP */);
isOn = false;
/* NOP */;
}
public timer function StopSmoke(optional dt : Float, optional id : Int32
){
StopEffect('smoke');
/* NOP */;
}
public function IsOn() : Bool{
return isOn;
/* NOP */;
}
}
abstract class W3ApplicatorEffect extends CBaseGameplayEffect{
protected saved var spawns : array<SApplicatorSpawnEffect>;
protected function ApplySpawnsOn(victimGE : CGameplayEntity){
var i : Int32;
var victim : CActor;
var params : SCustomEffectParams;
victim = (CActor)victimGE;
if (!victim){
return;
}
i = 0;
while (i < spawns.Size()){
if (victim == GetCreator() && theGame.effectMgr.IsBuffNe
gative(spawns[i].spawnType)){
} else if (IsRequiredAttitudeBetween(victim, GetCreator(
), spawns[i].spawnFlagsHostile, spawns[i].spawnFlagsNeutral, spawns[i].spawnFlag
sFriendly)){
params.effectType = spawns[i].spawnType;
params.creator = GetCreator();

params.sourceName = spawns[i].spawnSourceName;
params.customAbilityName = spawns[i].spawnAbilit
yName;
victim.AddEffectCustom(params);
}
i += 1;
}
/* NOP */;
}
protected function HasNeutralSpawn() : Bool{
var i : Int32;
i = 0;
while (i < spawns.Size()){
if (spawns[i].spawnFlagsNeutral){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function UpdateParams(){
var actor : CActor;
actor = (CActor)GetCreator();
if (!actor){
return;
}
actor.GetApplicatorParamsFor(this, creatorPowerStat);
/* NOP */;
}
public function CacheSettings(){
var appliedEffects : array<SCustomNode>;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var tmpName : CName;
var effectName : CName;
var tmpApplicatorName : CName;
var i : Int32;
var j : Int32;
var tmpFloat : Float;
var tmpBool : Bool;
var tmpSpawn : SApplicatorSpawnEffect;
var type : EEffectType;
super.CacheSettings();
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('effects');
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'na
me_name', tmpApplicatorName);
EffectNameToType(tmpApplicatorName, type, tmpName);
if (effectType == type){
appliedEffects = main.subNodes[i].subNodes;
j = 0;
while (j < appliedEffects.Size()){
if (dm.GetCustomNodeAttributeValueName(a
ppliedEffects[j], 'name_name', effectName)){
EffectNameToType(effectName, typ
e, effectName);
tmpSpawn.spawnType = type;

if (tmpSpawn.spawnType == 0){
LogAssert(false, "W3Appl
icatorEffect.CacheSettings: spawn effect <<" + tmpName + ">> of applicator <<" +
tmpApplicatorName + ">> is not defined! Skipping!");
}
} else {
if (dm.GetCustomNodeAttributeVal
ueName(appliedEffects[j], 'customAbilityName_name', tmpName)){
tmpSpawn.spawnAbilityNam
e = tmpName;
}
if (dm.GetCustomNodeAttributeVal
ueBool(appliedEffects[j], 'affectsHostile', tmpBool)){
tmpSpawn.spawnFlagsHosti
le = tmpBool;
}
if (dm.GetCustomNodeAttributeVal
ueBool(appliedEffects[j], 'affectsNeutral', tmpBool)){
tmpSpawn.spawnFlagsNeutr
al = tmpBool;
}
if (dm.GetCustomNodeAttributeVal
ueBool(appliedEffects[j], 'affectsFriendly', tmpBool)){
tmpSpawn.spawnFlagsFrien
dly = tmpBool;
}
if (!tmpSpawn.spawnFlagsHostile
&& !tmpSpawn.spawnFlagsNeutral && !tmpSpawn.spawnFlagsFriendly){
LogAssert(false, "W3Appl
icatorEffect.CacheSettings: effect <<" + effectName + ">> of applicator <<" + tm
pApplicatorName + ">> has no hostility flags set! Aborting!");
} else {
spawns.PushBack(tmpSpawn
);
tmpSpawn.spawnType = 0;
tmpSpawn.spawnAbilityNam
e = 'None';
tmpSpawn.spawnFlagsHosti
le = false;
tmpSpawn.spawnFlagsNeutr
al = false;
tmpSpawn.spawnFlagsFrien
dly = false;
tmpSpawn.spawnSourceName
= "";
}
}
j += 1;
}
break;
}
i += 1;
}
/* NOP */;
}
}
import struct CCustomCameraBoatPPC{
import public final function SetPivotOffset(offset : Vector);
}

statemachine class W3HorseCombatManager extends W3VehicleCombatManager{


}
class CR4HudModuleEnemyFocus extends CR4HudModuleBase{
private var m_fxSetEnemyName : CScriptedFlashFunction;
private var m_fxSetEnemyHealth : CScriptedFlashFunction;
private var m_fxSetEnemyStamina : CScriptedFlashFunction;
private var m_fxSetEssenceDamage : CScriptedFlashFunction;
private var m_fxSetDodgeFeedback : CScriptedFlashFunction;
private var m_fxSetAttitude : CScriptedFlashFunction;
private var m_fxIsHuman : CScriptedFlashFunction;
private var m_fxSetContraHint : CScriptedFlashFunction;
private var m_fxSetShowHardLock : CScriptedFlashFunction;
private var m_fxSetEnemyLevel : CScriptedFlashFunction;
private var m_fxSetNPCQuestIcon : CScriptedFlashFunction;
private var m_mcFocusArrow : CScriptedFlashSprite;
private var m_fxSetDamageText : CScriptedFlashFunction;
private var m_fxHideDamageText : CScriptedFlashFunction;
private var m_fxShowOnlyName : CScriptedFlashFunction;
private var m_lastTarget : CGameplayEntity;
private var m_lastTargetAttitude : EAIAttitude;
private var m_lastHealthPercentage : Int32;
private var m_wasAxiied : Bool;
private var m_lastStaminaPercentage : Int32;
private var m_nameInterval : Float;
private var m_lastEnemyDifferenceLevel : String;
private var m_lastEnemyLevelString : String;
private var m_lastDodgeFeedbackTarget : CActor;
private var m_showOnlyName : Bool;
private var m_forceUpdate : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_anchorName = "ScaleOnly";
flashModule = GetModuleFlash();
m_fxSetEnemyName = flashModule.GetMemberFlashFunction("setEnemyN
ame");
m_fxSetEnemyHealth = flashModule.GetMemberFlashFunction("setEnem
yHealth");
m_fxSetEnemyStamina = flashModule.GetMemberFlashFunction("setEne
myStamina");
m_fxSetEssenceDamage = flashModule.GetMemberFlashFunction("setEs
senceDamage");
m_fxSetDodgeFeedback = flashModule.GetMemberFlashFunction("setDo
dgeFeedback");
m_fxSetDamageText = flashModule.GetMemberFlashFunction("setDamag
eText");
m_fxHideDamageText = flashModule.GetMemberFlashFunction("hideDam
ageText");
m_fxSetAttitude = flashModule.GetMemberFlashFunction("setAttitud
e");
m_fxIsHuman = flashModule.GetMemberFlashFunction("setStaminaVisi
bility");
m_fxSetContraHint = flashModule.GetMemberFlashFunction("setContr
aHint");
m_fxSetShowHardLock = flashModule.GetMemberFlashFunction("setSho
wHardLock");
m_fxSetEnemyLevel = flashModule.GetMemberFlashFunction("setEnemy
Level");

m_fxSetNPCQuestIcon = flashModule.GetMemberFlashFunction("setNPC
QuestIcon");
m_mcFocusArrow = flashModule.GetChildFlashSprite("mcNPCFocus");
m_fxShowOnlyName = flashModule.GetMemberFlashFunction("ShowOnlyN
ame");
super.OnConfigUI();
m_fxSetEnemyStamina.InvokeSelfOneArg(FlashArgInt(0));
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig('EnemyFocusModule', true);
}
/* NOP */;
}
private function GetAttitudeOfTargetActor(target : CGameplayEntity) : EA
IAttitude{
var targetActor : CActor;
targetActor = (CActor)target;
if (targetActor){
return targetActor.GetAttitude(thePlayer);
}
return 1;
/* NOP */;
}
public function SetDodgeFeedback(target : CActor){
m_fxSetDodgeFeedback.InvokeSelfOneArg(FlashArgBool(!!target));
m_lastDodgeFeedbackTarget = target;
/* NOP */;
}
public function ShowOnlyName(show : Bool){
m_showOnlyName = show;
m_forceUpdate = true;
/* NOP */;
}
public function ShowDamageType(valueType : EFloatingValueType, value : F
loat, stringParam : String){
var label : String;
var color : Float;
if (valueType != 3 && valueType != 6 && value == 0.000000){
return;
}
switch(valueType){
case 1:
label = GetLocStringByKeyExt("attribute_name_critical_hi
t_damage");
color = 16646082;
break;
case 3:
label = GetLocStringByKeyExt("effect_instant_death");
color = 16761538;
break;
case 2:
label = GetLocStringByKeyExt("");
color = 16538459;
break;
case 4:
label = GetLocStringByKeyExt("");
color = 16711680;
break;
case 5:
label = GetLocStringByKeyExt("");

color = 65280;
break;
case 6:
label = GetLocStringByKeyExt(stringParam);
color = 16773360;
break;
default:
label = GetLocStringByKeyExt("");
color = 16773360;
break;
}
SetDamageText(label, CeilF(value), color);
/* NOP */;
}
private function SetDamageText(label : String, value : Int32, color : Fl
oat){
m_fxSetDamageText.InvokeSelfThreeArgs(FlashArgString(label), Fla
shArgNumber(value), FlashArgNumber(color));
/* NOP */;
}
public function HideDamageText(){
m_fxHideDamageText.InvokeSelf();
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
var l_target : CNewNPC;
var l_targetNonActor : CGameplayEntity;
var l_isHuman : Bool;
var l_isDifferentTarget : Bool;
var l_wasAxiied : Bool;
var l_currentHealthPercentage : Int32;
var l_currentStaminaPercentage : Int32;
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;
var marginLeftTop : Vector;
var marginRightBottom : Vector;
var hud : CR4ScriptedHud;
screenMargin = 0.025000;
l_targetNonActor = thePlayer.GetDisplayTarget();
l_target = (CNewNPC)l_targetNonActor;
l_dodgeFeedbackTarget = thePlayer.GetDodgeFeedbackTarget();
hud = (CR4ScriptedHud)theGame.GetHud();
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 {
l_isBoss = false;
}
if (l_target){
if ((CHeartMiniboss)l_target){
ShowElement(false, /* NOP */);
return false;
}
l_isHuman = l_target.IsHuman();
l_isDifferentTarget = l_target != m_lastTarget;
l_wasAxiied = l_target.GetAttitudeGroup() == 'npc_charme
d';
if (l_isDifferentTarget && l_target && !l_target.IsInCom
bat() && IsRequiredAttitudeBetween(thePlayer, l_target, true, /* NOP */, /* NOP
*/)){
l_target.RecalcLevel();
}
if (l_isDifferentTarget || m_forceUpdate){
HideDamageText();
m_fxIsHuman.InvokeSelfOneArg(FlashArgBool(l_isHu
man));
m_fxSetEssenceDamage.InvokeSelfOneArg(FlashArgBo
ol(l_target.UsesEssence()));
UpdateQuestIcon(l_target);
SetDodgeFeedback(NULL);
ShowElement(true, /* NOP */);
m_lastTarget = l_target;
}
l_currentTargetAttitude = l_target.GetAttitude(thePlayer
);
if (l_currentTargetAttitude != 2){
if (l_target.IsVIP()){
l_currentTargetAttitude = 4;
}
}
if (l_isDifferentTarget || m_forceUpdate || l_currentTar
getAttitude != m_lastTargetAttitude || l_wasAxiied != m_wasAxiied){
m_wasAxiied = l_wasAxiied;
if (m_wasAxiied){
m_fxSetAttitude.InvokeSelfOneArg(FlashAr
gInt(3));
} else {
m_fxSetAttitude.InvokeSelfOneArg(FlashAr
gInt(l_currentTargetAttitude));
}
m_lastTargetAttitude = l_currentTargetAttitude;
}
if (m_lastDodgeFeedbackTarget != l_dodgeFeedbackTarget |
| m_forceUpdate){
if (l_currentTargetAttitude == 2){
SetDodgeFeedback(l_dodgeFeedbackTarget);
} else {
SetDodgeFeedback(NULL);
}
m_lastDodgeFeedbackTarget = l_dodgeFeedbackTarge
t;
}
m_nameInterval -= timeDelta;
if (l_isDifferentTarget || m_forceUpdate || m_nameInterv
al < 0){

m_nameInterval = 0.250000;
m_fxSetEnemyName.InvokeSelfOneArg(FlashArgString
(l_target.GetDisplayName(/* NOP */)));
}
l_currentHealthPercentage = CeilF(100 * l_target.GetHeal
thPercents());
if (m_lastHealthPercentage != l_currentHealthPercentage
|| m_forceUpdate){
m_fxSetEnemyHealth.InvokeSelfOneArg(FlashArgInt(
l_currentHealthPercentage));
m_lastHealthPercentage = l_currentHealthPercenta
ge;
}
l_currentStaminaPercentage = CeilF(100 * l_target.GetSta
minaPercents());
if (m_lastStaminaPercentage != l_currentStaminaPercentag
e || m_forceUpdate){
m_fxSetEnemyStamina.InvokeSelfOneArg(FlashArgInt
(l_currentStaminaPercentage));
m_lastStaminaPercentage = l_currentStaminaPercen
tage;
}
l_currentEnemyDifferenceLevel = l_target.GetExperienceDi
fferenceLevelName(l_currentEnemyLevelString);
if (l_isDifferentTarget || m_lastEnemyDifferenceLevel !=
l_currentEnemyDifferenceLevel || m_lastEnemyLevelString != l_currentEnemyLevelS
tring || m_forceUpdate){
m_fxSetEnemyLevel.InvokeSelfTwoArgs(FlashArgStri
ng(l_currentEnemyDifferenceLevel), FlashArgString(l_currentEnemyLevelString));
m_lastEnemyDifferenceLevel = l_currentEnemyDiffe
renceLevel;
m_lastEnemyLevelString = l_currentEnemyLevelStri
ng;
}
if (GetBaseScreenPosition(l_targetScreenPos, l_target, /
* NOP */, /* NOP */, /* NOP */, /* NOP */)){
l_targetScreenPos.Y -= 45;
marginLeftTop = hud.GetScaleformPoint(screenMarg
in, screenMargin);
marginRightBottom = hud.GetScaleformPoint(1 - sc
reenMargin, 1 - screenMargin);
if (l_targetScreenPos.X < marginLeftTop.X){
l_targetScreenPos.X = marginLeftTop.X;
}
if (l_targetScreenPos.X > marginRightBottom.X){
l_targetScreenPos.X = marginRightBottom.
X;
}
if (l_targetScreenPos.Y < marginLeftTop.Y){
l_targetScreenPos.Y = marginLeftTop.Y;
}
if (l_targetScreenPos.Y > marginRightBottom.Y){
l_targetScreenPos.Y = marginRightBottom.
Y;
}
m_mcFocusArrow.SetVisible(true);
m_mcFocusArrow.SetPosition(l_targetScreenPos.X,
l_targetScreenPos.Y);
} else {
m_mcFocusArrow.SetVisible(false);

}
if (l_isBoss || m_showOnlyName || !l_target.IsAlive()){
m_fxShowOnlyName.InvokeSelf();
}
} else if (l_targetNonActor){
l_isDifferentTarget = l_targetNonActor != m_lastTarget;
if (l_isDifferentTarget){
m_fxIsHuman.InvokeSelfOneArg(FlashArgBool(false)
);
m_fxSetEssenceDamage.InvokeSelfOneArg(FlashArgBo
ol(false));
UpdateQuestIcon((CNewNPC)l_targetNonActor);
SetDodgeFeedback(NULL);
ShowElement(true, /* NOP */);
m_fxSetEnemyName.InvokeSelfOneArg(FlashArgString
(""));
m_fxSetAttitude.InvokeSelfOneArg(FlashArgInt(0))
;
m_fxSetEnemyLevel.InvokeSelfTwoArgs(FlashArgStri
ng("none"), FlashArgString(""));
m_lastTarget = l_targetNonActor;
m_lastTargetAttitude = GetAttitudeOfTargetActor(
m_lastTarget);
m_lastHealthPercentage = -1;
m_lastStaminaPercentage = -1;
m_lastEnemyDifferenceLevel = "none";
m_lastEnemyLevelString = "";
}
if (GetBaseScreenPosition(l_targetScreenPos, l_targetNon
Actor, /* NOP */, /* NOP */, /* NOP */, /* NOP */)){
l_targetScreenPos.Y -= 10;
marginLeftTop = hud.GetScaleformPoint(screenMarg
in, screenMargin);
marginRightBottom = hud.GetScaleformPoint(1 - sc
reenMargin, 1 - screenMargin);
if (l_targetScreenPos.X < marginLeftTop.X){
l_targetScreenPos.X = marginLeftTop.X;
}
if (l_targetScreenPos.X > marginRightBottom.X){
l_targetScreenPos.X = marginRightBottom.
X;
}
if (l_targetScreenPos.Y < marginLeftTop.Y){
l_targetScreenPos.Y = marginLeftTop.Y;
}
if (l_targetScreenPos.Y > marginRightBottom.Y){
l_targetScreenPos.Y = marginRightBottom.
Y;
}
m_mcFocusArrow.SetVisible(true);
m_mcFocusArrow.SetPosition(l_targetScreenPos.X,
l_targetScreenPos.Y);
} else {
m_mcFocusArrow.SetVisible(false);
}
} else if (m_lastTarget){
m_lastTarget = NULL;
m_mcFocusArrow.SetVisible(false);
SetDodgeFeedback(NULL);
ShowElement(false, /* NOP */);

} else if (m_mcFocusArrow.GetVisible()){
m_mcFocusArrow.SetVisible(false);
ShowElement(false, /* NOP */);
}
m_forceUpdate = false;
/* NOP */;
}
public function SetContraHint(set : Bool){
m_fxSetContraHint.InvokeSelfOneArg(FlashArgBool(set));
/* NOP */;
}
public function SetShowHardLock(set : Bool){
m_fxSetShowHardLock.InvokeSelfOneArg(FlashArgBool(set));
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
return false;
/* NOP */;
}
private function UpdateQuestIcon(target : CNewNPC){
var mapPinInstances : array<SCommonMapPinInstance>;
var commonMapManager : CCommonMapManager;
var currentPin : SCommonMapPinInstance;
var targetTags : array<CName>;
var i : Int32;
var questIcon : String;
questIcon = "none";
if (target){
targetTags = target.GetTags();
if (targetTags.Size() > 0){
commonMapManager = theGame.GetCommonMapManager()
;
mapPinInstances = commonMapManager.GetMapPinInst
ances(theGame.GetWorld().GetDepotPath());
i = 0;
while (i < mapPinInstances.Size()){
currentPin = mapPinInstances[i];
if (currentPin.tag == targetTags[0]){
switch(currentPin.type){
case 'QuestReturn':
questIcon = "QuestReturn
";
break;
case 'QuestGiverStory':
questIcon = "QuestGiverS
tory";
break;
case 'QuestGiverChapter':
questIcon = "QuestGiverC
hapter";
break;
case 'QuestGiverSide':
case 'QuestAvailable':
questIcon = "QuestGiverS
ide";
break;
case 'MonsterQuest':
questIcon = "MonsterQues
t";

break;
case 'TreasureQuest':
questIcon = "TreasureQue
st";
break;
}
}
i += 1;
}
}
}
m_fxSetNPCQuestIcon.InvokeSelfOneArg(FlashArgString(questIcon));
/* NOP */;
}
}
state CMonsterNestEntityStateIntact in CMonsterNestEntity extends CScriptableSta
te{
public function OnEnterState(prevStateName : CName) : Bool{
parent.canPlayVset = true;
super.OnEnterState(prevStateName);
parent.ApplyAppearance('nest_intact');
/* NOP */;
}
}
state CMonsterNestEntityStateSettingExplosives in CMonsterNestEntity extends CSc
riptableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
if (ShouldProcessTutorial('TutorialMonsterNest')){
FactsAdd("tut_nest_blown", /* NOP */, /* NOP */);
}
PlayAnimationAndSetExplosives();
/* NOP */;
}
public entry function PlayAnimationAndSetExplosives(){
var movementAdjustor : CMovementAdjustor;
var ticket : SMovementAdjustmentRequestTicket;
movementAdjustor = thePlayer.GetMovingAgentComponent().GetMoveme
ntAdjustor();
ticket = movementAdjustor.CreateNewRequest('InteractionEntity');
thePlayer.OnHolsterLeftHandItem();
thePlayer.AddAnimEventChildCallback(parent, 'AttachBomb', 'OnAni
mEvent_AttachBomb');
thePlayer.AddAnimEventChildCallback(parent, 'DetachBomb', 'OnAni
mEvent_DetachBomb');
movementAdjustor.AdjustmentDuration(ticket, 0.500000);
if (parent.matchPlayerHeadingWithHeadingOfTheEntity){
movementAdjustor.RotateTowards(ticket, parent, /* NOP */
);
}
if (parent.desiredPlayerToEntityDistance >= 0){
movementAdjustor.SlideTowards(ticket, parent, parent.des
iredPlayerToEntityDistance, /* NOP */);
}
thePlayer.PlayerStartAction(13, /* NOP */);
parent.BlockPlayerNestInteraction();
Sleep(parent.settingExplosivesTime);
parent.playerInventory.SingletonItemRemoveAmmo(parent.usedBomb,

1);
if (parent.IsBossProtectingNest()){
parent.AddTimer('SpawnBoss', parent.nestUpdateDefintion.
bossSpawnDelay, false, /* NOP */, /* NOP */, true, /* NOP */);
}
Sleep(parent.explodeAfter);
parent.GotoState('Explosion', /* NOP */, /* NOP */);
/* NOP */;
}
}
state CMonsterNestEntityStateExplosion in CMonsterNestEntity extends CScriptable
State{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.canPlayVset = false;
theGame.ReleaseNoSaveLock(parent.saveLockIdx);
Explosion();
/* NOP */;
}
public entry function Explosion(){
var wasDestroyed : Bool;
var parentEntity : CR4MapPinEntity;
var commonMapManager : CCommonMapManager;
var l_pos : Vector;
commonMapManager = theGame.GetCommonMapManager();
ProcessExplosion();
SleepOneFrame();
if (parent.appearanceChangeDelayAfterExplosion > 0){
Sleep(parent.appearanceChangeDelayAfterExplosion);
}
parent.ApplyAppearance('nest_destroyed');
if (parent.lootOnNestDestroyed){
l_pos = parent.GetWorldPosition();
l_pos.Z += 0.500000;
parent.container = (W3Container)theGame.CreateEntity(par
ent.lootOnNestDestroyed, l_pos, parent.GetWorldRotation(), /* NOP */, /* NOP */,
/* NOP */, /* NOP */, /* NOP */);
}
parent.SetFocusModeVisibility(0, /* NOP */);
if (parent.IsSetDestructionFactImmediately()){
FactsAdd(parent.factSetAfterSuccessfulDestruction, 1, /*
NOP */);
}
wasDestroyed = parent.HasTag('WasDestroyed');
parent.AddTag('WasDestroyed');
parentEntity = parent;
if (parentEntity){
if (FactsQuerySum(parentEntity.entityName + "_nest_destr
") == 0){
FactsAdd(parentEntity.entityName + "_nest_destr"
, /* NOP */, /* NOP */);
CheckNestDestructionAchievement(/* NOP */);
}
}
if (!wasDestroyed && !parent.HasTag('AchievementFireInTheHoleExc
luded')){
theGame.GetGamerProfile().IncStat(9);
}
commonMapManager.SetEntityMapPinDisabled(parent.entityName, true

);
parent.AddExp();
if (!parent.airDmg){
parent.PlayEffect('fire', /* NOP */);
} else {
parent.PlayEffect('dust', /* NOP */);
}
if (parent.nestBurnedAfter != 0){
Sleep(parent.nestBurnedAfter);
}
if (!parent.IsSetDestructionFactImmediately()){
FactsAdd(parent.factSetAfterSuccessfulDestruction, 1, /*
NOP */);
}
if (parent.IsBossProtectingNest()){
parent.GotoState('NestDestroyedBoss', /* NOP */, /* NOP
*/);
} else {
parent.GotoState('NestDestroyed', /* NOP */, /* NOP */);
}
/* NOP */;
}
private function ProcessExplosion(){
ProcessExplosionEffects();
if (parent.shouldDealDamageOnExplosion){
ProcessExplosionDamage();
}
/* NOP */;
}
private function ProcessExplosionEffects(){
if (parent.shouldPlayFXOnExplosion && !parent.airDmg){
parent.PlayEffect('explosion', /* NOP */);
}
GCameraShake(0.500000, true, parent.GetWorldPosition(), 1.000000
, /* NOP */, /* NOP */, /* NOP */);
parent.StopEffect('deploy');
/* NOP */;
}
private function ProcessExplosionDamage(){
var damage : W3DamageAction;
var entitiesInRange : array<CGameplayEntity>;
var explosionRadius : Float;
var damageVal : Float;
var i : Int32;
explosionRadius = 3.000000;
damageVal = 50.000000;
FindGameplayEntitiesInSphere(entitiesInRange, parent.GetWorldPos
ition(), explosionRadius, 100, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
entitiesInRange.Remove(parent);
i = 0;
while (i < entitiesInRange.Size()){
if ((CActor)entitiesInRange[i]){
damage = new W3DamageAction in parent;
damage.Initialize(parent, entitiesInRange[i], NU
LL, parent, 0, 2, false, false, false, true, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
damage.AddDamage(theGame.params.DAMAGE_NAME_FIRE
, damageVal);
damage.AddEffectInfo(18, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);

damage.AddEffectInfo(13, /* NOP */, /* NOP */, /


* NOP */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(damage);
delete damage;
} else {
entitiesInRange[i].OnFireHit(parent);
}
i += 1;
}
/* NOP */;
}
}
state CMonsterNestEntityStateNestRebuilding in CMonsterNestEntity extends CScrip
tableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.RebuildNest();
/* NOP */;
}
}
state CMonsterNestEntityStateNestRebuild in CMonsterNestEntity extends CScriptab
leState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
Rebuild();
/* NOP */;
}
public entry function Rebuild(){
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
Sleep(3.000000);
parent.encounter.EnableEncounter(true);
parent.encounter.SetSpawnPhase(parent.nestUpdateDefintion.defaul
tPhaseToActivate);
parent.wasExploded = false;
if (parent.interactionComponent){
parent.interactionComponent.SetEnabled(true);
}
if (!parent.expWasAdded){
commonMapManager.SetEntityMapPinDisabled(parent.entityNa
me, false);
}
if (parent.container){
parent.container.Destroy();
}
parent.GotoState('Intact', /* NOP */, /* NOP */);
/* NOP */;
}
}
state CMonsterNestEntityStateNestDestroyedBoss in CMonsterNestEntity extends CSc
riptableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.StopAllEffects();
if (parent.nestUpdateDefintion.isRebuilding){
parent.GotoState('NestRebuilding', /* NOP */, /* NOP */)
;

}
/* NOP */;
}
}
state CMonsterNestEntityStateNestDestroyed in CMonsterNestEntity extends CScript
ableState{
public function OnEnterState(prevStateName : CName) : Bool{
var commonMapManager : CCommonMapManager;
commonMapManager = theGame.GetCommonMapManager();
super.OnEnterState(prevStateName);
parent.StopAllEffects();
parent.encounter.EnableEncounter(false);
if (parent.nestUpdateDefintion.isRebuilding){
parent.GotoState('NestRebuilding', /* NOP */, /* NOP */)
;
}
/* NOP */;
}
}
state CMajorPlaceOfPowerEntityStatePlaceOfPower_Idle in CMajorPlaceOfPowerEntity
extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.isPlaceOfPowerInIdle = true;
parent.PlayEffect(parent.fxOnIdle, /* NOP */);
if (thePlayer){
thePlayer.PlayerStopAction(2);
}
parent.isRecharging = false;
if (!parent.skillPointGranted){
theGame.GetCommonMapManager().SetEntityMapPinDisabled(pa
rent.entityName, false);
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
parent.StopEffect(parent.fxOnIdle);
parent.isPlaceOfPowerInIdle = false;
/* NOP */;
}
}
state CMajorPlaceOfPowerEntityStatePlaceOfPower_Channeling in CMajorPlaceOfPower
Entity extends CScriptableState{
public var channelingStartTime : Float;
public function OnEnterState(prevStateName : CName) : Bool{
parent.PlayEffect(parent.fxOnChannel, /* NOP */);
channelingStartTime = theGame.GetEngineTimeAsSeconds();
theGame.GetGuiManager().EnableHudHoldIndicator(136, 69, "Interac
tHold", parent.channelingTime, 'PlaceOfPower');
PlaceOfPower_Channel();
/* NOP */;
}
public entry function PlaceOfPower_Channel(){
var test : CName;
var channelPerc : Float;
thePlayer.PlayerStartAction(2, /* NOP */);
while (true){
SleepOneFrame();

if (theInput.IsActionPressed('InteractHold') && !thePlay


er.GetIsWalking() && !thePlayer.GetIsSprinting()){
if (channelingStartTime + parent.channelingTime
> theGame.GetEngineTimeAsSeconds()){
channelPerc = theGame.GetEngineTimeAsSec
onds() - channelingStartTime / parent.channelingTime;
theGame.VibrateController(channelPerc, c
hannelPerc, 0.000100);
continue;
} else {
parent.GotoState('PlaceOfPower_Activated
', /* NOP */, /* NOP */);
}
} else {
test = theInput.GetContext();
parent.GotoState('PlaceOfPower_Idle', /* NOP */,
/* NOP */);
}
}
/* NOP */;
}
public function OnLeaveState(nextStateName : CName) : Bool{
theGame.GetGuiManager().DisableHudHoldIndicator();
parent.StopEffect(parent.fxOnChannel);
/* NOP */;
}
}
state CMajorPlaceOfPowerEntityStatePlaceOfPower_Activated in CMajorPlaceOfPowerE
ntity extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.PlayEffect(parent.fxOnSuccess, /* NOP */);
GrantSkillPointIfPossible();
GrantBuff();
thePlayer.PlayerStopAction(2);
theGame.GetCommonMapManager().SetEntityMapPinDisabled(parent.ent
ityName, true);
parent.GotoState('PlaceOfPower_Recharging', /* NOP */, /* NOP */
);
/* NOP */;
}
private function GrantSkillPointIfPossible(){
if (!parent.skillPointGranted){
GetWitcherPlayer().AddPoints(0, 1, true);
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_pop_skillpoint"));
parent.skillPointGranted = true;
}
/* NOP */;
}
private function GrantBuff(){
var params : SCustomEffectParams;
params.effectType = GetStatFromEnum(parent.buffType);
params.creator = parent;
params.sourceName = parent.buffUniqueName;
params.duration = parent.buffDuration;
thePlayer.AddEffectCustom(params);
switch(parent.buffType){
case 0:
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx

t("panel_hud_message_pop_buff_aard"));
break;
case 1:
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_pop_buff_axii"));
break;
case 2:
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_pop_buff_igni"));
break;
case 3:
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_pop_buff_quen"));
break;
case 4:
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_pop_buff_yrden"));
break;
}
/* NOP */;
}
private function GetStatFromEnum(statName : EShrineBuffs) : EEffectType{
switch(statName){
case 0:
return 60;
case 1:
return 61;
case 2:
return 62;
case 3:
return 63;
case 4:
return 64;
}
/* NOP */;
}
}
state CMajorPlaceOfPowerEntityStatePlaceOfPower_Recharging in CMajorPlaceOfPower
Entity extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
parent.AddGameTimeTimer('Recharge', parent.buffCooldown, false,
/* NOP */, /* NOP */, /* NOP */, true);
parent.isRecharging = true;
parent.lastUsed = theGame.GetGameTime();
/* NOP */;
}
public timer function Recharge(optional timeDelta : GameTime, optional i
d : Int32){
parent.GotoState('PlaceOfPower_Idle', /* NOP */, /* NOP */);
/* NOP */;
}
}
class W3MagicLampEntity extends CInteractiveEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
if (activator.GetEntity() == thePlayer){

if (area == GetComponent("ShowMapPinTrigger")){
GetComponent("ShowMapPinTrigger").SetEnabled(fal
se);
mapManager.SetEntityMapPinDiscoveredScript(false
, entityName, true);
}
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
}
}
class CTeleportEntity extends CInteractiveEntity{
public editable var keyItemName : CName;
public editable var removeKeyOnUse : Bool;
public editable var linkingMode : Bool;
public editable var keepBlackscreen : Bool;
public editable var pairedTeleport : EntityHandle;
public editable var pairedNodeTag : CName;
public editable var oneWayTeleport : Bool;
public editable var activationTime : Float;
public editable var factOnActivate : String;
public editable var factOnTeleport : String;
public var factOnActivateValidFor : Int32;
public var factOnTeleportValidFor : Int32;
public saved var isActivated : Bool;
public var destinationNode : CNode;
public var currentlyTeleporting : Bool;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
EnableTeleport(bIsEnabled);
EnableTeleportArea(false);
if (!spawnData.restored){
isActivated = false;
}
if (isActivated){
PlayEffect('teleport_fx', /* NOP */);
}
/* NOP */;
}
public function EnableTeleport(flag : Bool){
var activationComponent : CComponent;
bIsEnabled = flag;
activationComponent = GetComponent("activationComponent");
if (activationComponent){
activationComponent.SetEnabled(flag);
}
/* NOP */;
}
public function EnableTeleportArea(flag : Bool){
var teleportTriggerArea : CComponent;
teleportTriggerArea = GetComponent("teleportTriggerArea");
if (teleportTriggerArea){
teleportTriggerArea.SetEnabled(flag);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{

if (activator != thePlayer){
return false;
}
if (!isActivated){
if (PlayerHasKey()){
if (removeKeyOnUse){
thePlayer.inv.RemoveItemByName(keyItemNa
me, 1);
}
ActivateTeleport(activationTime);
return true;
} else {
GetWitcherPlayer().DisplayHudMessage(GetLocStrin
gByKeyExt("panel_hud_message_dont_have_required_key"));
return false;
}
}
return false;
/* NOP */;
}
public function PlayerHasKey() : Bool{
if (!IsNameValid(keyItemName)){
return true;
} else if (thePlayer.inv.HasItem(keyItemName)){
return true;
}
return false;
/* NOP */;
}
public function ActivateTeleport(activationTime : Float){
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
mapManager.SetEntityMapPinDiscoveredScript(false, entityName, tr
ue);
if (isActivated){
return;
}
AddFactOnActivation();
if (oneWayTeleport){
EnableTeleport(false);
}
PlayEffect('teleport_fx', /* NOP */);
AddTimer('ActivateTeleportAreaAfter', activationTime, /* NOP */,
/* NOP */, /* NOP */, true, /* NOP */);
/* NOP */;
}
public timer function ActivateTeleportAreaAfter(optional td : Float, opt
ional id : Int32){
isActivated = true;
EnableTeleportArea(true);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (interactionComponentName == "teleportTriggerArea" && isActiv
ated){
if (!currentlyTeleporting){
currentlyTeleporting = true;
theGame.FadeOutAsync(0.200000, /* NOP */);
theInput.StoreContext('EMPTY_CONTEXT');

AddTimer('SetupTeleportData', 0.250000, /* NOP *


/, /* NOP */, /* NOP */, true, /* NOP */);
}
} else if (interactionComponentName == "interactionUpdateCompone
nt"){
UpdateInteractions();
}
/* NOP */;
}
public timer function SetupTeleportData(optional td : Float, optional id
: Int32){
var pairedTeleportEntity : CTeleportEntity;
AddFactOnTeleport();
if (linkingMode){
destinationNode = EntityHandleGet(pairedTeleport);
} else {
destinationNode = theGame.GetEntityByTag(pairedNodeTag);
}
if (!oneWayTeleport){
ActivateTeleport(0.000000);
pairedTeleportEntity = (CTeleportEntity)destinationNode;
if (pairedTeleportEntity){
pairedTeleportEntity.ActivateTeleport(1.000000);
}
} else {
DeactivateTeleport();
}
if (keepBlackscreen){
AddTimer('TeleportMeWithBlackscreen', 0.100000, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
AddTimer('TeleportMe', 0.600000, /* NOP */, /* NOP */, /
* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function TeleportMe(optional td : Float, optional id : Int3
2){
thePlayer.TeleportWithRotation(destinationNode.GetWorldPosition(
) + destinationNode.GetHeadingVector() * 1.500000, destinationNode.GetWorldRotat
ion());
if (thePlayer.GetCurrentStateName() == 'AimThrow'){
thePlayer.OnRangedForceHolster(true, /* NOP */, /* NOP *
/);
}
AddTimer('FadeInAfter', 0.500000, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */);
theInput.RestoreContext('EMPTY_CONTEXT', false);
currentlyTeleporting = false;
/* NOP */;
}
public timer function TeleportMeWithBlackscreen(optional td : Float, opt
ional id : Int32){
thePlayer.TeleportWithRotation(destinationNode.GetWorldPosition(
) + destinationNode.GetHeadingVector() * 1.500000, destinationNode.GetWorldRotat
ion());
theInput.RestoreContext('EMPTY_CONTEXT', false);
currentlyTeleporting = false;
/* NOP */;
}

public function DeactivateTeleport(){


var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
mapManager.SetEntityMapPinDiscoveredScript(false, entityName, fa
lse);
if (!isActivated){
return;
}
StopAllEffects();
isActivated = false;
EnableTeleportArea(false);
EnableTeleport(true);
/* NOP */;
}
public timer function FadeInAfter(optional td : Float, optional id : Int
32){
theGame.FadeInAsync(0.400000);
/* NOP */;
}
public function SetDestinationParameters(nodeTag : CName, factOnTp : Str
ing){
linkingMode = false;
pairedNodeTag = nodeTag;
factOnTeleport = factOnTp;
factOnTeleportValidFor = -1;
/* NOP */;
}
private function UpdateInteractions(){
EnableTeleport(bIsEnabled);
EnableTeleportArea(isActivated);
/* NOP */;
}
private function AddFactOnActivation(){
if (factOnActivate != ""){
FactsAdd(factOnActivate, 1, factOnActivateValidFor);
}
/* NOP */;
}
private function AddFactOnTeleport(){
if (factOnTeleport != ""){
FactsAdd(factOnTeleport, 1, factOnTeleportValidFor);
}
/* NOP */;
}
}
statemachine class CRiftEntity extends CInteractiveEntity{
public editable var linkingMode : Bool;
public editable var controlledEncounter : EntityHandle;
public editable var controlledEncounterTag : CName;
public editable var activationDelay : Float;
public editable var closeAfter : Float;
public editable var canBeDisabled : Bool;
public editable var damageVal : SAbilityAttributeValue;
public editable var factSetAfterRiftWasDisabled : String;
public saved var isIntact : Bool;
public saved var currState : CName;
public var encounter : CEncounter;
public var coldArea : CTriggerAreaComponent;
public var entitiesInRange : array<CActor>;

public
public
public
public
public
public
public

var isEncounterEnabled : Bool;


var buffParams : SCustomEffectParams;
var spawnCounter : Int32;
var encounterSpawnLimit : Int32;
var collisionEntityTemplate : CEntityTemplate;
var collisionEntity : CEntity;
function OnSpawned(spawnData : SEntitySpawnData) : Bool{
PrepareCollisionEntity();
if (linkingMode){
encounter = (CEncounter)EntityHandleGet(controlledEncoun

ter);
} else {
encounter = (CEncounter)theGame.GetEntityByTag(controlle
dEncounterTag);
}
if (!encounter){
/* NOP */;
}
EnableEncounter(false);
coldArea = (CTriggerAreaComponent)GetComponent('coldArea');
EnableColdArea(false);
if (spawnData.restored){
GotoState(currState, /* NOP */, /* NOP */);
} else {
isIntact = true;
GotoStateAuto();
}
/* NOP */;
}
public function ActivateRift(dontActivateEncounter : Bool){
if (isIntact){
if (dontActivateEncounter){
(CRiftEntityStateOpened)GetState('Opened').DontE
nableEncounterOnStart();
}
GotoState('Opened', /* NOP */, /* NOP */);
isIntact = false;
} else if (!isEncounterEnabled && !dontActivateEncounter){
EnableEncounter(true);
}
/* NOP */;
}
public final function SetCanBeDisabled(b : Bool){
canBeDisabled = b;
/* NOP */;
}
public function DeactivateRiftIfPossible(){
if (canBeDisabled){
GotoState('Closed', /* NOP */, /* NOP */);
}
/* NOP */;
}
public function DeactivateRift(){
GotoState('Closed', /* NOP */, /* NOP */);
/* NOP */;
}
public timer function DeactivateRiftAfter(optional td : Float, optional
id : Int32){
DeactivateRift();
/* NOP */;

}
public function IsRiftOpen() : Bool{
return OnOpenedRiftCheck();
/* NOP */;
}
public function OnOpenedRiftCheck() : Bool{
return false;
/* NOP */;
}
public function OnYrdenHit(caster : CGameplayEntity) : Bool{
PlayEffect('rift_dimeritium', /* NOP */);
DeactivateRiftIfPossible();
/* NOP */;
}
public function EnableEncounter(flag : Bool){
encounter.EnableEncounter(flag);
isEncounterEnabled = flag;
/* NOP */;
}
public timer function DisableEncounterAfter(optional td : Float, optiona
l id : Int32){
EnableEncounter(false);
/* NOP */;
}
public function SetSpawnLimit(spawnLimit : Int32){
encounterSpawnLimit = spawnLimit;
/* NOP */;
}
public function IncrementSpawnCounter(){
spawnCounter += 1;
CheckSpawnLimit();
/* NOP */;
}
private function CheckSpawnLimit(){
if (spawnCounter >= encounterSpawnLimit){
AddTimer('DisableEncounterAfter', 0.000000, /* NOP */, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
AddTimer('DeactivateRiftAfter', 2.000000, /* NOP */, /*
NOP */, /* NOP */, true, /* NOP */);
}
/* NOP */;
}
public function EnableColdArea(flag : Bool){
coldArea.SetEnabled(flag);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var victim : CActor;
if ((W3YrdenEntity)activator.GetEntity()){
PlayEffect('rift_dimeritium', /* NOP */);
DeactivateRiftIfPossible();
}
victim = (CActor)activator.GetEntity();
if (victim && GetAttitudeBetween(victim, thePlayer) == 2){
return false;
}
if (victim && !entitiesInRange.Contains(victim)){
entitiesInRange.PushBack(victim);
}

if (entitiesInRange.Size() == 1){
AddTimer('ProcessArea', 0.100000, true, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var victim : CActor;
victim = (CActor)activator.GetEntity();
if (victim && GetAttitudeBetween(victim, thePlayer) == 2){
return false;
}
if (victim && entitiesInRange.Contains(victim)){
entitiesInRange.Remove(victim);
victim.StopEffect('breath');
}
if (entitiesInRange.Size() == 0){
RemoveTimer('ProcessArea', /* NOP */);
}
/* NOP */;
}
public timer function ProcessArea(optional deltaTime : Float, optional i
d : Int32){
var i : Int32;
buffParams.effectType = 58;
buffParams.duration = 0.500000;
buffParams.creator = this;
buffParams.effectValue = damageVal;
i = 0;
while (i < entitiesInRange.Size()){
entitiesInRange[i].AddEffectCustom(buffParams);
entitiesInRange[i].PlayEffect('breath', /* NOP */);
i += 1;
}
/* NOP */;
}
public function PrepareCollisionEntity(){
collisionEntityTemplate = (CEntityTemplate)LoadResource('riftBom
bCollision', /* NOP */);
/* NOP */;
}
public function CreateCollisionEntity(){
if (collisionEntityTemplate){
collisionEntity = theGame.CreateEntity(collisionEntityTe
mplate, GetWorldPosition(), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
}
/* NOP */;
}
public function DestroyCollisionEntity(){
collisionEntity.Destroy();
/* NOP */;
}
public function OnDiscovered(discovered : Bool){
theGame.GetCommonMapManager().SetEntityMapPinDiscoveredScript(fa
lse, entityName, discovered);
/* NOP */;
}
}

state CRiftEntityStateIntact in CRiftEntity extends CScriptableState{


public function OnEnterState(prevStateName : CName) : Bool{
parent.currState = 'Intact';
/* NOP */;
}
}
state CRiftEntityStateClosed in CRiftEntity extends CScriptableState{
public function OnEnterState(prevStateName : CName) : Bool{
super.OnEnterState(prevStateName);
parent.currState = 'Closed';
parent.StopEffect('rift_activate');
parent.DestroyCollisionEntity();
CloseRift();
/* NOP */;
}
public entry function CloseRift(){
parent.EnableEncounter(false);
parent.EnableColdArea(false);
parent.RemoveTimer('ProcessArea', /* NOP */);
if (parent.factSetAfterRiftWasDisabled != ""){
FactsAdd(parent.factSetAfterRiftWasDisabled, 1, /* NOP *
/);
}
parent.OnDiscovered(false);
/* NOP */;
}
}
class W3ItemRepairObject extends CR4MapPinEntity{
private editable var repairSword : Bool;
private editable var repairArmor : Bool;
public editable var chargesArmor : Int32;
public editable var chargesWeapon : Int32;
private autobind interactionComp : CInteractionComponent = single;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
AddTimer('WaitForPlayerSpawn', 0.300000, true, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
if (repairArmor){
AddTag('Armorer');
}
if (repairSword){
AddTag('Blacksmith');
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
if (interactionComp && activator.GetEntity() == GetWitcherPlayer
()){
interactionComp.SetEnabled(CheckIfPlayerCanInteract());
mapManager.SetEntityMapPinDiscoveredScript(false, entity
Name, true);
}
/* NOP */;
}
public function IsWeaponRepairEntity() : Bool{

return repairSword;
/* NOP */;
}
public timer function WaitForPlayerSpawn(optional dt : Float, optional i
d : Int32){
if (!interactionComp || !thePlayer){
return;
}
interactionComp.SetEnabled(CheckIfPlayerCanInteract());
RemoveTimer('WaitForPlayerSpawn', /* NOP */);
/* NOP */;
}
public function CheckIfPlayerCanInteract() : Bool{
return true;
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
if (interactionComp){
interactionComp.SetEnabled(false);
}
/* NOP */;
}
public function OnInteraction(actionName : String, activator : CEntity)
: Bool{
if (GetWitcherPlayer().AddRepairObjectBuff(repairArmor, repairSw
ord)){
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_repair_done"));
if (repairSword){
SoundEvent("gui_inventory_silversword_attach", /
* NOP */, /* NOP */);
} else {
SoundEvent("gui_inventory_armor_attach", /* NOP
*/, /* NOP */);
}
theGame.FadeOutAsync(/* NOP */, /* NOP */);
AddTimer('FadeInTimer', 1, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
} else {
GetWitcherPlayer().DisplayHudMessage(GetLocStringByKeyEx
t("panel_hud_message_repair_nothing"));
}
if (ShouldProcessTutorial('TutorialRepairObjects')){
FactsAdd("tut_repair_interaction", 1, /* NOP */);
}
/* NOP */;
}
private timer function FadeInTimer(optional dt : Float, optional id : In
t32){
theGame.FadeInAsync(/* NOP */);
/* NOP */;
}
public final function RepairsSword() : Bool{
return repairSword;
/* NOP */;
}
public final function RepairsArmor() : Bool{
return repairArmor;
/* NOP */;

}
}
class W3EntranceEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
mapManager = theGame.GetCommonMapManager();
if (activator.GetEntity() == thePlayer){
if (area == (CTriggerAreaComponent)GetComponent("FirstDi
scoveryTrigger")){
GetComponent("FirstDiscoveryTrigger").SetEnabled
(false);
mapManager.SetEntityMapPinDiscoveredScript(false
, entityName, true);
}
}
/* NOP */;
}
}
class W3ActorRemains extends W3AnimatedContainer{
public editable var dismemberOnLoot : Bool;
public editable var dismembermentOnlyWhenLootingTrophy : Bool;
public editable var dismembermentType : EDismembermentWoundTypes;
public editable var dismembermentName : CName;
public editable var manualTrophyTransfer : Bool;
private var owner : CActor;
private var hasTrophy : Bool;
private saved var wasDismembered : Bool;
private saved var trophyItemNames : array<CName>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var commonMapManager : CCommonMapManager;
super.OnSpawned(spawnData);
if (spawnData.restored){
if (HasQuestItem()){
commonMapManager = theGame.GetCommonMapManager()
;
commonMapManager.AddQuestLootContainer(this);
}
}
/* NOP */;
}
public function LootDropped(own : CActor){
owner = own;
if (!HasQuestItem()){
AddTimer('LootTimeout', theGame.params.CONTAINER_DYNAMIC
_DESTROY_TIMEOUT, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnItemGiven(data : SItemChangedData) : Bool{
super.OnItemGiven(data);
if (inv.IsItemTrophy(data.ids[0])){
hasTrophy = true;
}
if (owner){
owner.RemoveDroppedItem(GetInventory().GetItemName(data.
ids[0]), true);
}

/* NOP */;
}
public function OnItemTaken(itemId : SItemUniqueId, quantity : Int32) :
Bool{
var itemName : CName;
super.OnItemTaken(itemId, quantity);
if (inv.IsItemTrophy(itemId)){
itemName = inv.GetItemName(itemId);
trophyItemNames.PushBack(itemName);
}
if (!HasQuestItem()){
StopEffect('quest_highlight_fx');
}
/* NOP */;
}
public function OnContainerClosed(){
if (!HasQuestItem()){
StopEffect('quest_highlight_fx');
}
if (CanDismember() && owner){
theGame.FadeOutAsync(1, /* NOP */);
wasDismembered = true;
AddTimer('ProcessDismembermentTimer', 2, false, /* NOP *
/, /* NOP */, /* NOP */, /* NOP */);
} else {
if (isPlayingInteractionAnim){
thePlayer.PlayerStopAction(interactionAnim);
}
manualTrophyTransfer = false;
FinalizeLooting();
}
/* NOP */;
}
public function HasTrophyItems() : Bool{
var trophyIds : array<SItemUniqueId>;
trophyIds = inv.GetItemsByCategory('trophy');
if (trophyIds.Size() > 0){
return true;
} else {
return false;
}
/* NOP */;
}
public function CanDismember() : Bool{
if (wasDismembered){
return false;
}
if (dismemberOnLoot){
if (!dismembermentOnlyWhenLootingTrophy){
return true;
} else if (dismembermentOnlyWhenLootingTrophy && hasTrop
hy && !HasTrophyItems()){
return true;
} else {
return false;
}
} else {
return false;
}
/* NOP */;

}
public function FinalizeLooting(){
var i : Int32;
var commonMapManager : CCommonMapManager;
var trophyIds : array<SItemUniqueId>;
var eqId : SItemUniqueId;
var witcher : W3PlayerWitcher;
witcher = GetWitcherPlayer();
if (!manualTrophyTransfer || !owner){
if (witcher){
i = 0;
while (i < trophyItemNames.Size()){
trophyIds = witcher.inv.GetItemsByName(t
rophyItemNames[i]);
eqId = witcher.GetHorseManager().MoveIte
mToHorse(trophyIds[0], /* NOP */);
witcher.GetHorseManager().EquipItem(eqId
);
i += 1;
}
trophyItemNames.Clear();
}
}
if (IsEmpty()){
commonMapManager = theGame.GetCommonMapManager();
commonMapManager.DeleteQuestLootContainer(this);
UnhighlightEntity();
Enable(false, /* NOP */, /* NOP */);
Destroy();
}
/* NOP */;
}
public function ProcessDismemberment(){
if (owner){
if (dismembermentName == 'None'){
dismembermentName = owner.GetWoundNameFromWoundT
ype(dismembermentType);
}
owner.SetDismembermentInfo(dismembermentName, owner.GetW
orldPosition() - thePlayer.GetWorldPosition(), true);
owner.AddTimer('DelayedDismemberTimer', 0.050000, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
}
if (isPlayingInteractionAnim){
thePlayer.PlayerStopAction(interactionAnim);
}
if (manualTrophyTransfer){
AddTimer('EndAnimationTimer', 2.100000, false, /* NOP */
, /* NOP */, /* NOP */, /* NOP */);
} else {
AddTimer('FadeInTimer', 1.000000, false, /* NOP */, /* N
OP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function ProcessDismembermentTimer(optional timeDelta : Flo
at, optional id : Int32){
ProcessDismemberment();
/* NOP */;
}

public timer function FadeInTimer(optional timeDelta : Float, optional i


d : Int32){
theGame.FadeInAsync(1);
AddTimer('EndAnimationTimer', 1.100000, false, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
/* NOP */;
}
public timer function EndAnimationTimer(optional timeDelta : Float, opti
onal id : Int32){
FinalizeLooting();
/* NOP */;
}
public timer function LootTimeout(optional td : Float, optional id : Int
32){
if (VecDistance(GetWorldPosition(), thePlayer.GetWorldPosition()
) < 25.000000){
AddTimer('LootTimeout', theGame.params.CONTAINER_DYNAMIC
_DESTROY_TIMEOUT, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else {
Destroy();
}
/* NOP */;
}
public function OnFocusModeEnabled(enabled : Bool) : Bool{
if (enabled && CanShowFocusInteractionIcon()){
PlayEffect('remains_highlight', /* NOP */);
} else {
StopEffect('remains_highlight');
}
/* NOP */;
}
}
class W3POI_SpoilsOfWarEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");
if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_BanditCampEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");

if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_BanditCampfireEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");
if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_BossAndTreasureEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");
if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_ContrabandEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");

if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_ContrabandShipEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");
if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_RescuingTownEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");
if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3POI_DungeonCrawlEntity extends CR4MapPinEntity{
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var mapManager : CCommonMapManager;
var component : CComponent;
if (activator.GetEntity() == thePlayer){
component = GetComponent("FirstDiscoveryTrigger");

if (area == component){
component.SetEnabled(false);
mapManager = theGame.GetCommonMapManager();
if (mapManager){
mapManager.SetEntityMapPinDiscoveredScri
pt(false, entityName, true);
}
}
}
/* NOP */;
}
}
class W3MeteorProjectile_CreateMarkerEntityHelper extends CCreateEntityHelper{
public var owner : W3MeteorProjectile;
public function OnEntityCreated(entity : CEntity) : Bool{
if (owner){
owner.markerEntity = entity;
theGame.GetBehTreeReactionManager().CreateReactionEvent(
owner, 'MeteorMarker', owner.destroyMarkerAfter, owner.explosionRadius, 0.100000
, 999, true, /* NOP */);
owner = NULL;
} else {
entity.StopAllEffects();
entity.DestroyAfter(2.000000);
}
/* NOP */;
}
}
class W3ArrowProjectile extends W3AdvancedProjectile{
public editable var defaultTrail : CName;
public var underwaterTrail : CName;
private var boneName : CName;
private var activeTrail : CName;
private var shouldBeAttachedToVictim : Bool;
protected var isOnFire : Bool;
protected var isUnderwater : Bool;
public function OnProjectileShot(targetCurrentPosition : Vector, target
: CNode) : Bool{
super.OnProjectileShot(targetCurrentPosition, target);
if (!IsNameValid(activeTrail)){
ActivateTrail(defaultTrail);
SoundEvent("cmb_arrow_swoosh", /* NOP */, /* NOP */);
}
/* NOP */;
}
public function OnRangeReached() : Bool{
StopAllEffects();
AddTimer('TimeDestroy', 20, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var actorVictim : CActor;
var casterPos : Vector;
var parryInfo : SParryInfo;
var arrowHitPos : Vector;

var bounce : Bool;


var abs : array<CName>;
var isRolling : Bool;
if (yrdenAlternate){
return true;
}
SetShouldBeAttachedToVictim(true);
if (!isActive){
return true;
}
victim = (CGameplayEntity)collidingComponent.GetEntity();
if (collidingComponent || !hitCollisionsGroups.Contains('Water')
){
RemoveTimer('CheckIfInfWaterLoop', /* NOP */);
}
super.OnProjectileCollision(pos, normal, collidingComponent, hit
CollisionsGroups, actorIndex, shapeIndex);
if (collidingComponent && !hitCollisionsGroups.Contains('Static'
)){
if (!victim || collidedEntities.Contains(victim) || vict
im == caster){
return false;
}
actorVictim = (CActor)victim;
if (hitCollisionsGroups.Contains('Ragdoll') && actorVict
im){
boneName = (CMovingPhysicalAgentComponent)actorV
ictim.GetMovingAgentComponent().GetRagdollBoneName(actorIndex);
}
} else if (hitCollisionsGroups.Contains('Terrain') || hitCollisi
onsGroups.Contains('Static')){
StopProjectile();
isActive = false;
StopActiveTrail();
AddTimer('TimeDestroy', 20, false, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
arrowHitPos = pos + RotForward(GetWorldRotation()) * 0.5
00000;
Teleport(arrowHitPos);
SoundEvent("cmb_arrow_impact_dirt", /* NOP */, /* NOP */
);
return true;
} else if (hitCollisionsGroups.Contains('Water')){
if (isUnderwater){
return false;
}
SoundEvent("cmb_arrow_impact_water", /* NOP */, /* NOP *
/);
CheckIfInfWater();
return true;
} else {
return false;
}
if (!actorVictim){
StopProjectile();
isActive = false;
StopActiveTrail();
AddTimer('TimeDestroy', 20, false, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
ProcessDamageAction(victim, pos, boneName);

SoundEvent("cmb_arrow_impact_wood", /* NOP */, /* NOP */


);
return true;
} else if (victim == thePlayer){
bounce = false;
if (thePlayer.IsCurrentlyDodging() && thePlayer.GetBehav
iorVariable('isRolling', /* NOP */) == 1.000000){
isRolling = true;
} else if (thePlayer.CanParryAttack() && thePlayer.CanUs
eSkill(25)){
parryInfo = thePlayer.ProcessParryInfo((CActor)c
aster, (CActor)victim, 4, 4, 'attack_light', (CActor)caster.GetInventory().GetIt
emFromSlot('l_weapon'), true);
if (thePlayer.PerformParryCheck(parryInfo)){
if (thePlayer.CheckCounterSpamming((CAct
or)caster) && thePlayer.GetSkillLevel(25) > 1){
casterPos = caster.GetWorldPosit
ion();
casterPos.Z += 1.500000;
Init(thePlayer);
if (thePlayer.GetSkillLevel(25)
== 3){
projDMG *= 1 + Calculate
AttributeValue(thePlayer.GetSkillAttributeValue(25, 'damage_increase', false, tr
ue), /* NOP */);
}
ShootProjectileAtPosition(2, pro
jSpeed * 0.700000, casterPos, /* NOP */, /* NOP */);
ActivateTrail('arrow_trail_red')
;
return true;
} else {
bounce = true;
}
}
}
if (!bounce){
abs = thePlayer.GetAbilities(true);
bounce = abs.Contains(theGame.params.BOUNCE_ARRO
WS_ABILITY);
if (bounce){
FactsAdd("sq108_arrow_deflected", /* NOP
*/, /* NOP */);
thePlayer.PlayEffect('bolt_bump', /* NOP
*/);
}
}
if (bounce){
bounceOfVelocityPreserve = 0.700000;
BounceOff(normal, pos);
Init(thePlayer);
ActivateTrail('arrow_trail_orange');
return false;
} else if (!isRolling){
if (actorVictim.IsAlive()){
ProcessDamageAction(actorVictim, pos, bo
neName);
}
SoundEvent("cmb_arrow_impact_body", /* NOP */, /
* NOP */);

if (IsNameValid(boneName)){
AttachArrowToRagdoll(actorVictim, pos, b
oneName);
} else {
StopProjectile();
StopActiveTrail();
isActive = false;
SmartDestroy();
}
}
} else if ((CNewNPC)victim && (CNewNPC)victim.IsShielded(caster)
){
(CNewNPC)victim.SignalGameplayEvent('PerformAdditiveParr
y');
SoundEvent("cmb_arrow_impact_wood", /* NOP */, /* NOP */
);
AttachArrowToShield(actorVictim, pos);
} else {
if (actorVictim.IsAlive()){
if (actorVictim.HasAbility('BounceBoltsWildhunt'
)){
bounceOfVelocityPreserve = 0.100000;
BounceOff(normal, pos);
Init(actorVictim);
PlayEffect('sparks', /* NOP */);
SoundEvent("cmb_arrow_impact_metal", /*
NOP */, /* NOP */);
ActivateTrail('arrow_trail_orange');
return false;
} else {
ProcessDamageAction(actorVictim, pos, bo
neName);
}
} else if (actorVictim.IsInAgony()){
actorVictim.SignalGameplayEvent('AbandonAgony');
actorVictim.SetKinematic(false);
}
SoundEvent("cmb_arrow_impact_body", /* NOP */, /* NOP */
);
if (IsNameValid(boneName)){
AttachArrowToRagdoll(actorVictim, pos, boneName)
;
} else {
StopProjectile();
StopActiveTrail();
isActive = false;
SmartDestroy();
}
}
return true;
/* NOP */;
}
public function OnAardHit(sign : W3AardProjectile) : Bool{
var rigidMesh : CMeshComponent;
super.OnAardHit(sign);
StopProjectile();
rigidMesh = (CMeshComponent)GetComponentByClassName('CRigidMeshC
omponent');
if (rigidMesh){
rigidMesh.SetEnabled(true);

} else {
bounceOfVelocityPreserve = 0.700000;
BounceOff(VecRand2D(), GetWorldPosition());
Init(thePlayer);
}
/* NOP */;
}
public function OnFireHit(source : CGameplayEntity) : Bool{
if (!isUnderwater && isActive){
super.OnFireHit(source);
ToggleFire(true);
}
/* NOP */;
}
public function ToggleFire(toggle : Bool){
if (!isOnFire && toggle){
isOnFire = true;
ActivateTrail('arrow_trail_fire');
PlayEffect('fire', /* NOP */);
} else if (isOnFire && !toggle){
isOnFire = false;
ActivateTrail(defaultTrail);
StopEffect('fire');
}
/* NOP */;
}
public function ToggleUnderwater(toggle : Bool){
if (!isUnderwater && toggle){
isUnderwater = true;
} else if (isUnderwater && !toggle){
isUnderwater = false;
isActive = false;
DestroyAfter(0.500000);
}
/* NOP */;
}
public function SmartDestroy(){
var i : Int32;
var compList : array<CComponent>;
compList = GetComponentsByClassName('CDrawableComponent');
i = 0;
while (i < compList.Size()){
(CDrawableComponent)compList[i].SetVisible(false);
i += 1;
}
AddTimer('TimeDestroy', 3, false, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */);
/* NOP */;
}
public function ActivateTrail(trailName : CName){
if (trailName != activeTrail){
if (activeTrail){
StopEffect(activeTrail);
}
PlayEffect(trailName, /* NOP */);
activeTrail = trailName;
}
/* NOP */;
}
public function StopActiveTrail(){

if (activeTrail){
StopEffect(activeTrail);
activeTrail = 'None';
}
/* NOP */;
}
public timer function CheckIfInfWaterLoop(optional timeDelta : Float, op
tional id : Int32){
if (CheckIfInfWater()){
RemoveTimer('CheckIfInfWaterLoop', /* NOP */);
}
/* NOP */;
}
protected function CheckIfInfWater() : Bool{
var entityPos : Vector;
var waterLevel : Float;
entityPos = GetWorldPosition();
waterLevel = theGame.GetWorld().GetWaterLevel(entityPos, /* NOP
*/);
if (isUnderwater){
if (waterLevel < entityPos.Z){
ToggleUnderwater(false);
ActivateTrail(defaultTrail);
projAngle = 5.000000;
return true;
}
} else if (waterLevel > entityPos.Z){
ToggleUnderwater(true);
ToggleFire(false);
ActivateTrail(underwaterTrail);
projAngle = 2.000000;
return true;
}
return false;
/* NOP */;
}
public function ThrowProjectile(targetPosIn : Vector){
CheckIfInfWater();
AddTimer('CheckIfInfWaterLoop', 0.050000, true, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
/* NOP */;
}
public function AttachArrowToShield(victim : CActor, pos : Vector){
var bones : array<CName>;
var res : Bool;
var inv : CInventoryComponent;
var shield : CEntity;
StopProjectile();
StopActiveTrail();
isActive = false;
inv = victim.GetInventory();
shield = inv.GetItemEntityUnsafe(inv.GetItemFromSlot('l_weapon')
);
CreateAttachment(shield, /* NOP */, /* NOP */, /* NOP */);
CreateAttachmentAtBoneWS(shield, 'Root', pos, GetWorldRotation()
);
/* NOP */;
}
public function AttachArrowToRagdoll(victim : CActor, pos : Vector, bone
Name : CName){

var bones : array<CName>;


var res : Bool;
var arrowHitPos : Vector;
StopProjectile();
StopActiveTrail();
isActive = false;
bones.PushBack('head');
bones.PushBack('hroll');
bones.PushBack('neck');
if (victim == thePlayer && bones.Contains(boneName) || (CNewNPC)
victim.IsHorse()){
SmartDestroy();
} else {
arrowHitPos = pos + RotForward(GetWorldRotation()) * 0.3
00000;
if (boneName){
res = CreateAttachmentAtBoneWS(victim, boneName,
arrowHitPos, GetWorldRotation());
} else {
res = CreateAttachmentAtBoneWS(victim, 'torso3',
arrowHitPos, GetWorldRotation());
}
if (res){
if (victim == thePlayer && !GetShouldBeAttachedT
oVictim()){
AddTimer('TimeDestroy', 0.010000, false,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
} else if (victim == thePlayer){
AddTimer('TimeDestroy', 3, false, /* NOP
*/, /* NOP */, /* NOP */, /* NOP */);
} else {
AddTimer('TimeDestroy', 20, false, /* NO
P */, /* NOP */, /* NOP */, /* NOP */);
}
} else {
SmartDestroy();
}
}
/* NOP */;
}
protected function ProcessDamageAction(victim : CGameplayEntity, pos : V
ector, boneName : CName){
var action : W3DamageAction;
var victimTags : array<CName>;
var attackerTags : array<CName>;
var none : SAbilityAttributeValue;
action = new W3DamageAction in this;
action.Initialize((CGameplayEntity)caster, victim, this, caster.
GetName(), 1, 0, false, true, false, false, /* NOP */, /* NOP */, /* NOP */, /*
NOP */);
if (isOnFire){
action.AddEffectInfo(18, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FIRE, projDM
G);
action.AddDamage(theGame.params.DAMAGE_NAME_SILVER, proj
SilverDMG);
} else {
action.AddDamage(theGame.params.DAMAGE_NAME_PIERCING, pr
ojDMG);

action.AddDamage(theGame.params.DAMAGE_NAME_SILVER, proj
SilverDMG);
}
if (projEfect != 0){
action.AddEffectInfo(projEfect, /* NOP */, /* NOP */, /*
NOP */, /* NOP */, /* NOP */);
}
if ((CNewNPC)victim){
if (boneName == 'head' || boneName == 'neck' || boneName
== 'hroll' || boneName == 'pelvis' && (CNewNPC)victim.IsHuman()){
action.SetHeadShot();
}
}
theGame.damageMgr.ProcessAction(action);
collidedEntities.PushBack(victim);
delete action;
victimTags = victim.GetTags();
attackerTags = caster.GetTags();
AddHitFacts(victimTags, attackerTags, "_arrow_hit", /* NOP */, /
* NOP */);
/* NOP */;
}
public function SetShouldBeAttachedToVictim(val : Bool){
shouldBeAttachedToVictim = val;
/* NOP */;
}
public function GetShouldBeAttachedToVictim() : Bool{
return shouldBeAttachedToVictim;
/* NOP */;
}
}
class CBookMinigameSlot extends CGameplayEntity{
public editable var bookMinigameManagerTag : CName;
public editable var correctBookId : Int32;
public var currentBook : CBookMinigameBook;
public var bookMinigameManager : CBooksMinigameManager;
public function init(){
bookMinigameManager = (CBooksMinigameManager)theGame.GetNodeByTa
g(bookMinigameManagerTag);
/* NOP */;
}
public function FillSlot(newBook : CBookMinigameBook){
currentBook = newBook;
/* NOP */;
}
public function CheckBook() : Bool{
if (currentBook.bookId == correctBookId){
return true;
} else {
return false;
}
/* NOP */;
}
}
class CBookMinigameBook extends CGameplayEntity{
public editable var bookId : Int32;
}

class CBooksMinigameManager extends CGameplayEntity{


public editable var minigameWonFact : String;
public editable var bookSlotTags : array<CName>;
public editable var bookTags : array<CName>;
public var bookSlots : array<CBookMinigameSlot>;
public var books : array<CBookMinigameBook>;
public function init(){
var i : Int32;
var loopSlot : CBookMinigameSlot;
var loopEntity : CBookMinigameBook;
var slotPos : Vector;
bookSlots.Clear();
books.Clear();
if (bookSlotTags.Size() > 0){
i = 0;
while (bookSlotTags.Size() > i){
loopSlot = (CBookMinigameSlot)theGame.GetNodeByT
ag(bookSlotTags[i]);
loopSlot.init();
bookSlots.PushBack(loopSlot);
i += 1;
}
}
i = 0;
if (bookTags.Size() > 0){
i = 0;
while (bookTags.Size() > i){
loopEntity = (CBookMinigameBook)theGame.GetNodeB
yTag(bookTags[i]);
books.PushBack(loopEntity);
i += 1;
}
}
i = 0;
if (books.Size() > 0){
i = 0;
while (books.Size() > i){
books[i].TeleportWithRotation(bookSlots[i].GetWo
rldPosition(), bookSlots[i].GetWorldRotation());
bookSlots[i].FillSlot(books[i]);
i += 1;
}
}
i = 0;
/* NOP */;
}
public function MoveBook(bookSlotNumber : Int32, direction : EBookDirect
ion){
var bookA : CBookMinigameBook;
var bookB : CBookMinigameBook;
var modifiedSlotNum : Int32;
var targetSlotNum : Int32;
if (direction == 1){
modifiedSlotNum = bookSlotNumber - 1;
targetSlotNum = modifiedSlotNum + 1;
} else if (direction == 0){
modifiedSlotNum = bookSlotNumber - 1;
targetSlotNum = modifiedSlotNum - 1;
}
bookA = bookSlots[modifiedSlotNum].currentBook;

bookB = bookSlots[targetSlotNum].currentBook;
bookA.TeleportWithRotation(bookSlots[targetSlotNum].GetWorldPosi
tion(), bookSlots[targetSlotNum].GetWorldRotation());
bookSlots[targetSlotNum].FillSlot(bookA);
bookB.TeleportWithRotation(bookSlots[modifiedSlotNum].GetWorldPo
sition(), bookSlots[modifiedSlotNum].GetWorldRotation());
bookSlots[modifiedSlotNum].FillSlot(bookB);
CheckBooksOrder();
/* NOP */;
}
public function CheckBooksOrder(){
var i : Int32;
i = 0;
i = 0;
while (bookSlots.Size() > i){
if (!bookSlots[i].CheckBook()){
return;
}
i += 1;
}
FactsAdd(minigameWonFact, 1, -1);
/* NOP */;
}
}
class W3QuestCond_EntityComponentEnabled extends CQuestScriptedCondition{
public editable var tag : CName;
public editable var componentName : CName;
public var entity : CEntity;
public var component : CComponent;
public var listener : W3QuestCond_EntityComponentEnabled_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_EntityComponentEnabled_Listen
er in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, tag);
FindEntity();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, tag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindEntity();
if (!entity){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}

public function Evaluate() : Bool{


if (entity){
if (!component){
component = entity.GetComponent(componentName);
}
if (component){
return component.IsEnabled();
}
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindEntity(){
if (entity){
return;
}
entity = theGame.GetEntityByTag(tag);
if (entity && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class W3QuestCond_EntityComponentEnabled_Listener extends IGlobalEventScriptedLi
stener{
public var condition : W3QuestCond_EntityComponentEnabled;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.tag){
condition.FindEntity();
}
/* NOP */;
}
}
class W3QuestCond_EntityComponentExists extends CQuestScriptedCondition{
public editable var tag : CName;
public editable var componentName : CName;
public var entity : CEntity;
public var component : CComponent;
public var listener : W3QuestCond_EntityComponentExists_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_EntityComponentExists_Listene
r in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, tag);
FindEntity();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, tag);
delete listener;
listener = NULL;
}
/* NOP */;
}

public function Activate(){


FindEntity();
if (!entity){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (entity){
return entity.GetComponent(componentName);
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindEntity(){
if (entity){
return;
}
entity = theGame.GetEntityByTag(tag);
if (entity && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class W3QuestCond_EntityComponentExists_Listener extends IGlobalEventScriptedLis
tener{
public var condition : W3QuestCond_EntityComponentExists;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.tag){
condition.FindEntity();
}
/* NOP */;
}
}
class W3QuestCond_A_closerToTargetThan_B extends CQuestScriptedCondition{
public editable var object_A_tag : CName;
public editable var object_B_tag : CName;
public editable var targetTag : CName;
public var listener : W3QuestCond_A_closerToTargetThan_B_Listener;
public var object_A : CNode;
public var object_B : CNode;
public var target : CNode;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_A_closerToTargetThan_B_Listen
er in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2

, listener, object_A_tag);
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, object_B_tag);
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, targetTag);
FindEntities();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, object_A_tag);
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, object_B_tag);
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, targetTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindEntities();
if (!object_A || !object_B || !target){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function ContainsTag(tag : CName) : Bool{
return tag == object_A_tag || tag == object_B_tag || tag == targ
etTag;
/* NOP */;
}
public function FindEntities(){
if (!object_A){
object_A = theGame.GetNodeByTag(object_A_tag);
}
if (!object_B){
object_B = theGame.GetNodeByTag(object_B_tag);
}
if (!target){
target = theGame.GetNodeByTag(targetTag);
}
if (listener && object_A && object_B && target){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
var object_A_pos : Vector;
var object_B_pos : Vector;
var targetPos : Vector;
var object_A_distance : Float;
var object_B_distance : Float;
if (object_A && object_B && target){
object_A_pos = object_A.GetWorldPosition();
object_B_pos = object_B.GetWorldPosition();

targetPos = target.GetWorldPosition();
object_A_distance = VecDistanceSquared2D(object_A_pos, t
argetPos);
object_B_distance = VecDistanceSquared2D(object_B_pos, t
argetPos);
return object_A_distance <= object_B_distance;
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
}
class W3QuestCond_A_closerToTargetThan_B_Listener extends IGlobalEventScriptedLi
stener{
public var condition : W3QuestCond_A_closerToTargetThan_B;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && condition.ContainsTag(eventParam)){
condition.FindEntities();
}
/* NOP */;
}
}
class W3QuestCond_IsEffectActive extends CQuestScriptedCondition{
public editable var effectName : CName;
public editable var entityTag : CName;
public var entity : CEntity;
public var listener : W3QuestCond_IsEffectActive_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_IsEffectActive_Listener in th
is;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, entityTag);
FindEntity();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, entityTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindEntity();
if (!entity){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}

public function Evaluate() : Bool{


if (entity){
return entity.IsEffectActive(effectName, false);
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindEntity(){
entity = theGame.GetEntityByTag(entityTag);
/* NOP */;
}
}
class W3QuestCond_IsEffectActive_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_IsEffectActive;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.entityTag){
condition.FindEntity();
}
/* NOP */;
}
}
class W3QuestCond_GameplayFact extends CQuestScriptedCondition{
public editable var gameplayFactId : String;
public editable var value : Int32;
public editable var comparator : ECompareOp;
public var isFulfilled : Bool;
public var listener : W3QuestCond_GameplayFact_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_GameplayFact_Listener in this
;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
(GetGlobalEventCategory(5), listener, gameplayFactId);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterStr
ing(GetGlobalEventCategory(5), listener, gameplayFactId);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;

}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = ProcessCompare(comparator, GameplayFactsQuerySum(g
ameplayFactId), value);
/* NOP */;
}
}
class W3QuestCond_GameplayFact_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_GameplayFact;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && eventParam == condition.gameplayFactId){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class W3QuestCond_playerKnowsRecipe extends CQuestScriptedCondition{
public editable var recipeName : CName;
public var isFulfilled : Bool;
public var listener : W3QuestCond_playerKnowsRecipe_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_playerKnowsRecipe_Listener in
this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(6), listener);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(6), listener);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{

if (!isFulfilled && !listener){


RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var alchemyRecipes : array<CName>;
var i : Int32;
var player : W3PlayerWitcher;
player = (W3PlayerWitcher)thePlayer;
if (player){
alchemyRecipes = player.GetAlchemyRecipes();
i = 0;
while (i < alchemyRecipes.Size()){
if (recipeName == alchemyRecipes[i]){
isFulfilled = true;
return;
}
i += 1;
}
}
isFulfilled = false;
/* NOP */;
}
}
class W3QuestCond_playerKnowsRecipe_Listener extends IGlobalEventScriptedListene
r{
public var condition : W3QuestCond_playerKnowsRecipe;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class W3QuestCond_playerKnowsSchematics extends CQuestScriptedCondition{
public editable var schematicsName : CName;
public var isFulfilled : Bool;
public var listener : W3QuestCond_playerKnowsSchematics_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_playerKnowsSchematics_Listene
r in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(7), listener);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(7), listener);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){

EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var craftingSchematics : array<CName>;
var i : Int32;
var player : W3PlayerWitcher;
player = (W3PlayerWitcher)thePlayer;
if (player){
craftingSchematics = player.GetCraftingSchematicsNames()
;
i = 0;
while (i < craftingSchematics.Size()){
if (schematicsName == craftingSchematics[i]){
isFulfilled = true;
return;
}
i += 1;
}
}
isFulfilled = false;
/* NOP */;
}
}
class W3QuestCond_playerKnowsSchematics_Listener extends IGlobalEventScriptedLis
tener{
public var condition : W3QuestCond_playerKnowsSchematics;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class W3QuestCond_ActorIsDespawned extends CQuestScriptedCondition{
public editable var actorTag : CName;
public var actors : array<CActor>;
public var listener : W3QuestCond_ActorIsDespawned_Listener;
public function Activate(){
FindActors();
listener = new W3QuestCond_ActorIsDespawned_Listener in this;

listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2, listen
er, actorTag);
/* NOP */;
}
public function Deactivate(){
if (listener){
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, actorTag);
delete listener;
listener = NULL;
}
actors.Clear();
/* NOP */;
}
public function Evaluate() : Bool{
var i : Int32;
i = 0;
while (i < actors.Size()){
if (actors[i]){
return false;
}
i += 1;
}
return true;
/* NOP */;
}
public function FindActors(){
theGame.GetActorsByTag(actorTag, actors);
/* NOP */;
}
}
class W3QuestCond_ActorIsDespawned_Listener extends IGlobalEventScriptedListener
{
public var condition : W3QuestCond_ActorIsDespawned;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.actorTag){
condition.FindActors();
}
/* NOP */;
}
}
class W3QuestCond_BookHasBeenRead extends CQuestScriptedCondition{
public editable var bookName : CName;
public var bookFactName : String;
public var isFulfilled : Bool;
public var listener : W3QuestCond_BookHasBeenRead_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_BookHasBeenRead_Listener in t
his;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
(3, listener, bookFactName);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterStr

ing(3, listener, bookFactName);


delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
bookFactName = "";
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = false;
if (bookFactName == ""){
if (IsNameValid(bookName)){
bookFactName = GetBookReadFactName(bookName);
} else {
LogQuest("W3QuestCond_BookHasBeenRead: invalid b
ook bame <<" + bookName + ">>");
}
}
if (bookFactName != ""){
if (FactsDoesExist(bookFactName)){
isFulfilled = FactsQuerySum(bookFactName);
}
}
/* NOP */;
}
}
class W3QuestCond_BookHasBeenReadExt extends CQuestScriptedCondition{
public editable var bookName : SItemNameProperty;
public var bookFactName : String;
public var isFulfilled : Bool;
public var listener : W3QuestCond_BookHasBeenRead_Listener_Ext;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_BookHasBeenRead_Listener_Ext
in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
(3, listener, bookFactName);
EvaluateImpl();
} else {

theGame.GetGlobalEventsManager().RemoveListenerFilterStr
ing(3, listener, bookFactName);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
bookFactName = "";
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = false;
if (bookFactName == ""){
if (IsNameValid(bookName.itemName)){
bookFactName = GetBookReadFactName(bookName.item
Name);
} else {
LogQuest("W3QuestCond_BookHasBeenRead: invalid b
ook bame <<" + bookName.itemName + ">>");
}
}
if (bookFactName != ""){
if (FactsDoesExist(bookFactName)){
isFulfilled = FactsQuerySum(bookFactName);
}
}
/* NOP */;
}
}
class InterpCurve extends CObject{
public var interpMethod : EInterpMethodType;
}
class W3QuestCond_BookHasBeenRead_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_BookHasBeenRead;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && eventParam == condition.bookFactName){
condition.EvaluateImpl();
}
/* NOP */;

}
}
class W3QuestCond_BookHasBeenRead_Listener_Ext extends IGlobalEventScriptedListe
ner{
public var condition : W3QuestCond_BookHasBeenReadExt;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && eventParam == condition.bookFactName){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class W3QuestCond_CanSeePlayer extends CQuestScriptedCondition{
public editable var actorTag : CName;
public var npc : CNewNPC;
public var listener : W3QuestCond_CanSeePlayer_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_CanSeePlayer_Listener in this
;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, actorTag);
FindActor();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, actorTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindActor();
if (!npc){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (npc){
return npc.IfCanSeePlayer();
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindActor(){
if (npc){
return;

}
npc = theGame.GetNPCByTag(actorTag);
if (npc && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class InterpCurvePoint extends CObject{
public var inVal : Float;
public var interpMode : EInterpCurveMode;
public function InterpCurvePoint(){
}
public function IsCurveKey() : Bool{
return interpMode == 2 || interpMode == 3;
/* NOP */;
}
}
class W3QuestCond_CanSeePlayer_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_CanSeePlayer;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.actorTag){
condition.FindActor();
}
/* NOP */;
}
}
class CStaticCameraArea extends CEntity{
public editable var cameraTag : CName;
public editable var onlyForPlayer : Bool;
public editable var activatorTag : CName;
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
var camera : CStaticCamera;
if (!super.IsActivatorValid(activator)){
return false;
}
camera = (CStaticCamera)theGame.GetNodeByTag(cameraTag);
if (camera){
camera.Run();
GetWitcherPlayer().SetShowHud(false);
} else {
/* NOP */;
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
var camera : CStaticCamera;
if (!super.IsActivatorValid(activator)){
return false;
}
camera = (CStaticCamera)theGame.GetNodeByTag(cameraTag);
if (camera){
if (camera.IsRunning()){
theGame.GetGameCamera().Activate(camera.deactiva

tionDuration);
GetWitcherPlayer().SetShowHud(true);
} else if (!camera.AutoDeactivating()){
/* NOP */;
}
} else {
/* NOP */;
}
/* NOP */;
}
private final function IsActivatorValid(activator : CComponent) : Bool{
if (onlyForPlayer){
return (CPlayer)activator.GetEntity();
} else if (activatorTag){
return activator.GetEntity().HasTag(activatorTag);
} else {
return true;
}
/* NOP */;
}
}
class W3QuestCond_CheckLightState extends CQuestScriptedCondition{
public editable var lightSourceTag : CName;
public editable var targetState : Bool;
public var lightEntity : CEntity;
public var component : CGameplayLightComponent;
public var listener : W3QuestCond_CheckLightState_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_CheckLightState_Listener in t
his;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, lightSourceTag);
FindEntity();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, lightSourceTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindEntity();
if (!lightEntity){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!component){
if (lightEntity){

component = (CGameplayLightComponent)lightEntity
.GetComponentByClassName('CGameplayLightComponent');
} else if (!listener){
RegisterListener(true);
}
}
if (component){
return component.IsLightOn() == targetState;
}
return false;
/* NOP */;
}
public function FindEntity(){
lightEntity = theGame.GetEntityByTag(lightSourceTag);
if (lightEntity && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class CReactionRandomCondition extends CReactionScriptedCondition{
public editable var percentageChance : Int32;
public function Perform(source : CNode, target : CNode, interestPoint :
CInterestPointInstance) : Bool{
if (RandF() * 100.000000 < percentageChance){
return true;
}
return false;
/* NOP */;
}
}
class CSpawner extends CEntity{
public editable var entityTemplate : CEntityTemplate;
public editable var count : Int32;
public editable var immortalityMode : EActorImmortalityMode;
public editable var attitudeOverride : Bool;
public editable var attitudeToPlayer : EAIAttitude;
public editable var hostileSpawnerTag : CName;
public editable var spawnTags : array<CName>;
public editable var respawn : Bool;
public editable var respawnDelay : Float;
public editable var initialHealth : Int32;
public editable var spawnAnimation : EExplorationMode;
private var spawnedNPCs : array<CNewNPC>;
private var respawnTime : array<EngineTime>;
private var respawnNeeded : array<Bool>;
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
var i : Int32;
spawnedNPCs.Clear();
respawnTime.Clear();
respawnNeeded.Clear();
spawnedNPCs.Grow(count);
respawnTime.Grow(count);
respawnNeeded.Grow(count);
i = 0;
while (i < count){
respawnNeeded[i] = true;
i += 1;

}
if (entityTemplate){
AddTimer('Respawn', 1.000000, respawn, /* NOP */, /* NOP
*/, /* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function Respawn(optional t : Float, optional id : Int32){
var i : Int32;
var entity : CEntity;
var npc : CNewNPC;
var tags : array<CName>;
i = spawnedNPCs.Size() - 1;
while (i >= 0){
if (!respawnNeeded[i]){
if (!spawnedNPCs[i] || !spawnedNPCs[i].IsAlive()
){
respawnTime[i] = theGame.GetEngineTime()
+ respawnDelay;
spawnedNPCs[i] = NULL;
respawnNeeded[i] = true;
}
}
i -= 1;
}
i = 0;
while (i < count){
if (respawnNeeded[i] && theGame.GetEngineTime() > respaw
nTime[i]){
entity = theGame.CreateEntity(entityTemplate, Ge
tWorldPosition(), GetWorldRotation(), true, false, false, 0, /* NOP */);
npc = (CNewNPC)entity;
if (npc){
spawnedNPCs[i] = npc;
respawnNeeded[i] = false;
npc.SetImmortalityMode(immortalityMode,
1, /* NOP */);
if (attitudeOverride){
npc.SetAttitude(thePlayer, attit
udeToPlayer);
}
npc.SetBehaviorVariable('SpawnAnim', spa
wnAnimation, /* NOP */);
tags = npc.GetTags();
ArrayOfNamesAppendUnique(tags, spawnTags
);
npc.SetTags(tags);
if (npc.GetBehaviorVariable('SpawnAnim',
/* NOP */) == 1.000000 && npc.IsFlying()){
}
}
}
i += 1;
}
/* NOP */;
}
}
class W3QuestCond_CheckLightState_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_CheckLightState;

public function OnGlobalEventName(eventCategory : EGlobalEventCategory,


eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.lightSourceTag){
condition.FindEntity();
}
/* NOP */;
}
}
class W3KillTestTrigger extends CGameplayEntity{
private var entered : Bool;
private var actors : array<CActor>;
public editable var entityTemplate : CEntityTemplate;
public timer function acttimer(optional dt : Float, optional id : Int32)
{
var i : Int32;
i = 0;
while (i < actors.Size()){
actors[i].Kill(/* NOP */, /* NOP */, /* NOP */);
actors[i].SetBehaviorVariable('Ragdoll_Weight', 1.000000
, /* NOP */);
actors[i].RaiseForceEvent('Ragdoll');
i += 1;
}
actors.Clear();
/* NOP */;
}
public function DoStuff(){
var act : CActor;
var position : Vector;
var rotation : EulerAngles;
position = thePlayer.GetWorldPosition();
rotation = thePlayer.GetWorldRotation();
position += VecFromHeading(rotation.Yaw) * 5.000000;
rotation.Yaw = -rotation.Yaw;
act = (CActor)theGame.CreateEntity(entityTemplate, position, rot
ation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
actors.PushBack(act);
AddTimer('acttimer', 3.000000, false, /* NOP */, /* NOP */, /* N
OP */, /* NOP */);
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
if (false == entered){
entered = true;
DoStuff();
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
entered = false;
/* NOP */;
}
}
class W3QuestCond_Container extends CQuestScriptedCondition{
public editable var containerTag : CName;
public editable var contents : EContainerMode;

public
public
public
public
public

var inventory : CInventoryComponent;


saved var isFulfilled : Bool;
var globalListener : W3QuestCond_Container_GlobalListener;
var inventoryListener : W3QuestCond_Container_InventoryListener;
function RegisterGlobalListener(flag : Bool){
if (flag){
globalListener = new W3QuestCond_Container_GlobalListene

r in this;
globalListener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, globalListener, containerTag);
FindInventory();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, globalListener, containerTag);
delete globalListener;
globalListener = NULL;
}
/* NOP */;
}
public function RegisterInventoryListener(flag : Bool){
if (flag){
inventoryListener = new W3QuestCond_Container_InventoryL
istener in this;
inventoryListener.condition = this;
inventory.AddListener(inventoryListener);
} else {
inventory.RemoveListener(inventoryListener);
delete inventoryListener;
inventoryListener = NULL;
}
/* NOP */;
}
public function Activate(){
isFulfilled = false;
inventory = NULL;
FindInventory();
if (!inventory){
RegisterGlobalListener(true);
} else {
EvaluateImpl();
if (!isFulfilled){
RegisterInventoryListener(true);
}
}
/* NOP */;
}
public function Deactivate(){
if (globalListener){
RegisterGlobalListener(false);
}
if (inventory && inventoryListener){
RegisterInventoryListener(false);
} else if (inventoryListener){
delete inventoryListener;
inventoryListener = NULL;
}
inventory = NULL;
/* NOP */;
}

public function Evaluate() : Bool{


if (!isFulfilled && !inventory && !globalListener){
RegisterGlobalListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var isEmpty : Bool;
if (isFulfilled){
return;
}
if (inventory){
isEmpty = inventory.GetItemCount(true) == 0;
if (isEmpty && contents == 0 || !isEmpty && contents ==
1){
isFulfilled = true;
}
} else if (!globalListener){
LogQuest("W3QuestCond_IsItemQuantityMet: iventory can't
be NULL inside EvaluateImpl");
}
if (isFulfilled && inventory && inventoryListener){
RegisterInventoryListener(false);
}
/* NOP */;
}
public function FindInventory(){
var entities : array<CNode>;
var entity : CGameplayEntity;
var i : Int32;
if (inventory){
return;
}
theGame.GetNodesByTag(containerTag, entities);
if (entities.Size() == 0){
return;
}
i = 0;
while (i < entities.Size()){
entity = (CGameplayEntity)entities[i];
if (entity){
inventory = entity.GetInventory();
if (inventory){
break;
}
} else {
LogQuest("W3QuestCond_Container: found node <<"
+ entities[i] + ">> which is not a gameplay entity and therefore cannot have inv
entory. Isn't this a bug?");
}
i += 1;
}
if (inventory){
if (globalListener){
RegisterGlobalListener(false);
}
EvaluateImpl();
if (!isFulfilled){
RegisterInventoryListener(true);

}
}
/* NOP */;
}
}
class W2BalanceCalc extends CObject{
public var abilities : array<CName>;
public var petards : array<SItemUniqueId>;
public var cost : Float;
public var statVitality : Float;
public var statCurrentVitality : Float;
public var statEssence : Float;
public var statCurrentEssence : Float;
public var statStamina : Float;
public var statCurrentStamina : Float;
public var statFocus : Float;
public var statToxicity : Float;
public var statMorale : Float;
public var statSickness : Float;
public var statParryChance : Float;
public var statDodgeChance : Float;
public var statVitalityRegen : Float;
public var statEssenceRegen : Float;
public var statStaminaRegen : Float;
public var statFocusRegen : Float;
public var statToxicityRegen : Float;
public var statMoraleRegen : Float;
public var statSicknessRegen : Float;
public var statAttackPower : Float;
public var statSpellPower : Float;
public var statEffectDuration : Float;
public var statVitalityDmg : Float;
public var statEssenceDmg : Float;
public var statSpellDmg : Float;
public var statRange : Float;
public var statRadius : Float;
public var statPhysicalRes : Float;
public var statFireRes : Float;
public var statFrostRes : Float;
public var statShockRes : Float;
public var statPoisonRes : Float;
public var statBleedingRes : Float;
public var statIncinerationRes : Float;
public var costVitality : Float;
public var costEssence : Float;
public var costStamina : Float;
public var costFocus : Float;
public var costToxicity : Float;
public var costMorale : Float;
public var costDrunkenness : Float;
public var costSickness : Float;
public var costParryChance : Float;
public var costDodgeChance : Float;
public var costVitalityRegen : Float;
public var costEssenceRegen : Float;
public var costStaminaRegen : Float;
public var costFocusRegen : Float;
public var costToxicityRegen : Float;
public var costMoraleRegen : Float;

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

var costDrunkennessRegen : Float;


var costSicknessRegen : Float;
var costAttackPower : Float;
var costSpellPower : Float;
var costEffectDuration : Float;
var costVitalityDmg : Float;
var costEssenceDmg : Float;
var costSpellDmg : Float;
var costRange : Float;
var costRadius : Float;
var costPhysicalRes : Float;
var costFireRes : Float;
var costFrostRes : Float;
var costShockRes : Float;
var costPoisonRes : Float;
var costBleedingRes : Float;
var costIncinerationRes : Float;
var costconstVitality : Float;
var costconstEssence : Float;
var costconstStamina : Float;
var costconstFocus : Float;
var costconstToxicity : Float;
var costconstMorale : Float;
var costconstDrunkenness : Float;
var costconstSickness : Float;
var costconstParryChance : Float;
var costconstDodgeChance : Float;
var costconstVitalityRegen : Float;
var costconstEssenceRegen : Float;
var costconstStaminaRegen : Float;
var costconstFocusRegen : Float;
var costconstToxicityRegen : Float;
var costconstMoraleRegen : Float;
var costconstDrunkennessRegen : Float;
var costconstSicknessRegen : Float;
var costconstAttackPower : Float;
var costconstSpellPower : Float;
var costconstEffectDuration : Float;
var costconstVitalityDmg : Float;
var costconstEssenceDmg : Float;
var costconstSpellDmg : Float;
var costconstRange : Float;
var costconstRadius : Float;
var costconstPhysicalRes : Float;
var costconstFireRes : Float;
var costconstFrostRes : Float;
var costconstShockRes : Float;
var costconstPoisonRes : Float;
var costconstBleedingRes : Float;
var costconstIncinerationRes : Float;
function SetActorStats(actor : CActor){
var npc : CNewNPC;
npc = (CNewNPC)actor;
abilities = actor.GetAbilities(true);
statVitality = npc.GetStatMax(0);
statEssence = npc.GetStatMax(1);
statStamina = npc.GetStatMax(2);
statFocus = npc.GetStatMax(4);
statToxicity = npc.GetStatMax(3);
statMorale = npc.GetStatMax(5);

statCurrentVitality = npc.GetStat(0, /* NOP */);


statCurrentEssence = npc.GetStat(1, /* NOP */);
statCurrentStamina = npc.GetStat(2, true);
statFocus = npc.GetStat(4, /* NOP */);
statToxicity = npc.GetStat(3, /* NOP */);
statMorale = npc.GetStat(5, /* NOP */);
/* NOP */;
}
public function PrintActorStats(actor : CActor){
var i : Int32;
var size : Int32;
SetCosts();
SetActorStats(actor);
CalculateActorCost();
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
i = 0;
while (i < abilities.Size()){
/* NOP */;
i += 1;
}
/* NOP */;
/* NOP */;
}
public function CalculateActorCost(){

}
public function SetPlayerStats(){
statVitality = thePlayer.GetStatMax(0);
statEssence = thePlayer.GetStatMax(1);
statStamina = thePlayer.GetStatMax(2);
statFocus = thePlayer.GetStatMax(4);
statToxicity = thePlayer.GetStatMax(3);
statMorale = thePlayer.GetStatMax(5);
/* NOP */;
}
public function SetCosts(){
}
public function CalculateCostsForPlayer(){
}
public function PrintPlayerStats(){
SetPlayerStats();
CalculateCostsForPlayer();
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
/* NOP */;
}
}
class ARDebugCameraRot extends ICustomCameraScriptedPivotRotationController{
protected function ControllerUpdate(currentRotation : EulerAngles, curre
ntVelocity : EulerAngles, timeDelta : Float){
currentRotation.Pitch = -89;
currentRotation.Yaw = 0;

currentRotation.Roll = 0;
/* NOP */;
}
protected function ControllerUpdateInput(movedHorizontal : Bool, movedVe
rtical : Bool){
movedHorizontal = true;
movedVertical = false;
/* NOP */;
}
}
class ARDebugCameraDist extends ICustomCameraScriptedPivotDistanceController{
protected function ControllerUpdate(currDistance : Float, currVelocity :
Float, timeDelta : Float){
currDistance = 8;
/* NOP */;
}
}
class W3QuestCond_Container_GlobalListener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_Container;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.containerTag){
condition.FindInventory();
}
/* NOP */;
}
}
class W3DebugScriptBehaviorToolComponent extends CSpriteComponent{
public function OnEditorEnabled(e : CEntity) : Bool{
}
public function OnEditorDisabled() : Bool{
}
public function OnTick(dt : Float) : Bool{
}
}
class W3QuestCond_Container_InventoryListener extends IInventoryScriptedListener
{
public var condition : W3QuestCond_Container;
public function OnInventoryScriptedEvent(eventType : EInventoryEventType
, itemId : SItemUniqueId, quantity : Int32, fromAssociatedInventory : Bool) : Bo
ol{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CHumanAICombatStorage extends CBaseAICombatStorage{
private var parryCount : Int32;
private var activeStyle : EBehaviorGraph;
private var preferedStyle : EBehaviorGraph;
private var leaveCurrentStyle : Bool;
private var processingItems : Bool;
private var processingRequiresIdle : Bool;
private var mutlipleProjectiles : array<W3AdvancedProjectile>;

private var currProjectile : W3AdvancedProjectile;


private var protectedByQuen : Bool;
private var followerAttackCooldown : Float;
private var followerKeepDistanceToPlayer : Bool;
private var isAFollower : Bool;
public function IncParryCount(){
parryCount += 1;
/* NOP */;
}
public function GetParryCount() : Int32{
return parryCount;
/* NOP */;
}
public function ResetParryCount(){
parryCount = 0;
/* NOP */;
}
public function SetPreferedCombatStyle(newStyle : EBehaviorGraph){
preferedStyle = newStyle;
/* NOP */;
}
public function GetPreferedCombatStyle() : EBehaviorGraph{
return preferedStyle;
/* NOP */;
}
public function SetActiveCombatStyle(newStyle : EBehaviorGraph){
activeStyle = newStyle;
leaveCurrentStyle = false;
/* NOP */;
}
public function GetActiveCombatStyle() : EBehaviorGraph{
return activeStyle;
/* NOP */;
}
public function LeaveCurrentCombatStyle(){
leaveCurrentStyle = true;
/* NOP */;
}
public function StopLeavingCurrentCombatStyle(){
leaveCurrentStyle = false;
/* NOP */;
}
public function IsLeavingStyle() : Bool{
return leaveCurrentStyle;
/* NOP */;
}
public function CalculateCombatStylePriority(combatStyle : EBehaviorGrap
h) : Int32{
if (combatStyle == 1){
return -1;
} else if (combatStyle == activeStyle){
if (leaveCurrentStyle){
return 10;
} else {
return 100;
}
} else if (combatStyle == preferedStyle){
return 60;
}
return 50;

/* NOP */;
}
public function ReturnWeaponSubTypeForActiveCombatStyle() : Int32{
switch(activeStyle){
case 9:
return 0;
case 10:
return 1;
case 11:
return 2;
case 12:
return 3;
case 13:
return 4;
case 3:
return 0;
case 4:
return 1;
case 5:
return 2;
case 15:
return 0;
case 16:
return 1;
default:
}
return 0;
return 0;
/* NOP */;
}
public function IsProcessingItems() : Bool{
return processingItems;
/* NOP */;
}
public function SetProcessingItems(toggle : Bool){
processingItems = toggle;
/* NOP */;
}
public function DoesProcessingRequiresIdle() : Bool{
return processingRequiresIdle;
/* NOP */;
}
public function SetProcessingRequiresIdle(toggle : Bool){
processingRequiresIdle = toggle;
/* NOP */;
}
public function SetProjectile(proj : W3AdvancedProjectile){
currProjectile = proj;
/* NOP */;
}
public function GetProjectile() : W3AdvancedProjectile{
return currProjectile;
/* NOP */;
}
public function AddNewProjectile(proj : W3AdvancedProjectile){
mutlipleProjectiles.PushBack(proj);
/* NOP */;
}
public function GetProjectiles() : array<W3AdvancedProjectile>{
return mutlipleProjectiles;

/* NOP */;
}
public function DetachAndDestroyProjectile(){
if (currProjectile){
currProjectile.BreakAttachment();
currProjectile.Destroy();
currProjectile = NULL;
}
/* NOP */;
}
public function SetProtectedByQuen(toggle : Bool){
protectedByQuen = toggle;
/* NOP */;
}
public function IsProtectedByQuen() : Bool{
return protectedByQuen;
/* NOP */;
}
public function BecomeAFollower(){
isAFollower = true;
/* NOP */;
}
public function NoLongerFollowing(){
isAFollower = false;
/* NOP */;
}
public function IsAFollower() : Bool{
return isAFollower;
/* NOP */;
}
public function ShouldAttack(currentTime : Float) : Bool{
if (!isAFollower){
return true;
}
if (atackTimeStamp <= 0 || atackTimeStamp + followerAttackCooldo
wn < currentTime){
return true;
}
return false;
/* NOP */;
}
public function ShouldKeepDistanceToPlayer() : Bool{
if (!isAFollower){
return false;
}
return followerKeepDistanceToPlayer;
/* NOP */;
}
}
abstract class W3AdvancedProjectile extends CThrowable{
public editable var projSpeed : Float;
public editable var projAngle : Float;
public editable var projDMG : Float;
public editable var projSilverDMG : Float;
public editable var ignoreArmor : Bool;
public editable var projEfect : EEffectType;
protected var isActive : Bool;
protected var collidedEntities : array<CGameplayEntity>;
protected var lifeSpan : Float;

public function SetLifeSpan(_duration : Float){


lifeSpan = _duration;
DestroyAfter(lifeSpan);
/* NOP */;
}
public function AddColidedEntity(_colider : CGameplayEntity){
collidedEntities.PushBack(_colider);
/* NOP */;
}
public function ClearColidedEntities(){
collidedEntities.Clear();
/* NOP */;
}
public timer function TimeDestroy(optional deltaTime : Float, optional i
d : Int32){
Destroy();
/* NOP */;
}
public final function ShootProjectileAtPosition(angle : Float, velocity
: Float, target : Vector, range : Float, collisionGroups : array<CName>){
ShootProjectileAtPosition(angle, velocity, target, range, collis
ionGroups);
OnProjectileShot(target, /* NOP */);
/* NOP */;
}
public final function ShootProjectileAtNode(angle : Float, velocity : Fl
oat, target : CNode, range : Float, collisionGroups : array<CName>){
ShootProjectileAtNode(angle, velocity, target, range, collisionG
roups);
OnProjectileShot(target.GetWorldPosition(), /* NOP */);
/* NOP */;
}
public final function ShootProjectileAtBone(angle : Float, velocity : Fl
oat, target : CEntity, targetBone : CName, range : Float, collisionGroups : arra
y<CName>){
ShootProjectileAtBone(angle, velocity, target, targetBone, range
, collisionGroups);
OnProjectileShot(target.GetWorldPosition(), /* NOP */);
/* NOP */;
}
public final function ShootCakeProjectileAtPosition(cakeAngle : Float, c
akeHeight : Float, shootAngle : Float, velocity : Float, target : Vector, range
: Float, collisionGroups : array<CName>){
ShootCakeProjectileAtPosition(cakeAngle, cakeHeight, shootAngle,
velocity, target, range, collisionGroups);
OnProjectileShot(target, /* NOP */);
/* NOP */;
}
public function OnProjectileInit() : Bool{
isActive = false;
/* NOP */;
}
public function OnProjectileShot(targetCurrentPosition : Vector, target
: CNode) : Bool{
isActive = true;
/* NOP */;
}
public function DestroyRequest(){
Destroy();
/* NOP */;

}
}
class CBossAICombatStorage extends CHumanAICombatStorage{
private var isLightbringerAvailable : Bool;
private var isMeteoritesAvailable : Bool;
private var isIceSpikesAvailable : Bool;
private var isBlinkComboAvailable : Bool;
private var isSpecialAttackAvailable : Bool;
private var isParryAvailable : Bool;
private var isSiphonAvailable : Bool;
private var isDodgeAvailable : Bool;
private var isStaminaRegenAvailable : Bool;
private var isPhaseChangeAvailable : Bool;
private var inInSpecialAttack : Bool;
public function SetIsParryAvailable(value : Bool){
isParryAvailable = value;
/* NOP */;
}
public function GetIsParryAvailable() : Bool{
return isParryAvailable;
/* NOP */;
}
public function SetIsSiphonAvailable(value : Bool){
isSiphonAvailable = value;
/* NOP */;
}
public function GetIsSiphonAvailable() : Bool{
return isSiphonAvailable;
/* NOP */;
}
public function SetIsDodgeAvailable(value : Bool){
isDodgeAvailable = value;
/* NOP */;
}
public function GetIsDodgeAvailable() : Bool{
return isDodgeAvailable;
/* NOP */;
}
public function SetIsStaminaRegenAvailable(value : Bool){
isStaminaRegenAvailable = value;
/* NOP */;
}
public function GetIsStaminaRegenAvailable() : Bool{
return isStaminaRegenAvailable;
/* NOP */;
}
public function SetIsPhaseChangeAvailable(value : Bool){
isPhaseChangeAvailable = value;
/* NOP */;
}
public function GetIsPhaseChangeAvailable() : Bool{
return isPhaseChangeAvailable;
/* NOP */;
}
public function SetIsInSpecialAttack(value : Bool){
inInSpecialAttack = value;
/* NOP */;
}
public function GetIsInSpecialAttack() : Bool{

return inInSpecialAttack;
/* NOP */;
}
public function SetIsAttackAvailable(attack : EBossSpecialAttacks, val :
Bool){
switch(attack){
case 0:
isLightbringerAvailable = val;
break;
case 1:
isMeteoritesAvailable = val;
break;
case 2:
isIceSpikesAvailable = val;
break;
case 3:
isBlinkComboAvailable = val;
break;
case 4:
isSpecialAttackAvailable = val;
break;
default:
break;
}
/* NOP */;
}
public function IsAttackAvailable(attack : EBossSpecialAttacks) : Bool{
switch(attack){
case 0:
return isLightbringerAvailable;
case 1:
return isMeteoritesAvailable;
case 2:
return isIceSpikesAvailable;
case 3:
return isBlinkComboAvailable;
case 4:
return isSpecialAttackAvailable;
default:
}
return false;
/* NOP */;
}
}
class CR4HudModuleMinimap2 extends CR4HudModuleBase{
private const var MINIMAP_EXTERIOR_ZOOM : Float;
private const var MINIMAP_INTERIOR_ZOOM : Float;
private const var MINIMAP_BOAT_ZOOM : Float;
private const var HINT_WAYPOINTS_MAX_REMOVAL_DISTANCE : Float;
private const var HINT_WAYPOINTS_MIN_PLACING_DISTANCE : Float;
private const var HINT_WAYPOINTS_REFRESH_INTERVAL : Float;
private const var HINT_WAYPOINTS_PATHFIND_TOLERANCE : Float;
private const var HINT_WAYPOINTS_MAX_COUNT : Int32;
private var m_flashValueStorage : CScriptedFlashValueStorage;
private var m_fxSetMapSettingsSFF : CScriptedFlashFunction;
private var m_fxSetTextureExtensionsSFF : CScriptedFlashFunction;
private var m_fxSetZoomSFF : CScriptedFlashFunction;
private var m_fxSetPlayerRotationSFF : CScriptedFlashFunction;
private var m_fxSetPlayerPositionSFF : CScriptedFlashFunction;

private var m_fxSetPlayerPositionAndRotationSFF : CScriptedFlashFunction


;
private var m_fxNotifyPlayerEnteredInteriorSFF : CScriptedFlashFunction;
private var m_fxNotifyPlayerExitedInteriorSFF : CScriptedFlashFunction;
private var m_fxDoFadingSFF : CScriptedFlashFunction;
private var m_fxEnableRotationSFF : CScriptedFlashFunction;
private var m_fxEnableMask : CScriptedFlashFunction;
private var m_fxEnableDebug : CScriptedFlashFunction;
private var m_fxEnableBorders : CScriptedFlashFunction;
private var m_previousPlayerPosition : Vector;
private var m_previousPlayerAngle : Float;
private var m_previousCameraAngle : Float;
private var m_zoomValue : Float;
private var m_forceUpdate : Bool;
private var m_updateInterval : Float;
private var m_fadedOut : Bool;
private var m_weatherType : CName;
private var m_gameHour : Int32;
private var m_gameMin : Int32;
private var m_buffedMonsterIconPath : CName;
private var m_dayTimeName : CName;
private const var PLAYER_ANGLE_EPSILON : Float;
private const var CAMERA_ANGLE_EPSILON : Float;
private const var GAME_HOUR_DAWN : Int32;
private const var GAME_HOUR_DAY : Int32;
private const var GAME_HOUR_DUSK : Int32;
private const var GAME_HOUR_NIGHT : Int32;
public var b24HRFormat : Bool;
public var bDisplayDayTime : Bool;
public var bDisplayBuffedMoster : Bool;
public function OnConfigUI() : Bool{
var manager : CCommonMapManager;
var flashModule : CScriptedFlashSprite;
var hud : CR4ScriptedHud;
m_flashValueStorage = GetModuleFlashValueStorage();
m_anchorName = "mcAnchorMiniMap";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetMapSettingsSFF = flashModule.GetMemberFlashFunction("SetM
apSettings");
m_fxSetTextureExtensionsSFF = flashModule.GetMemberFlashFunction
("SetTextureExtensions");
m_fxSetZoomSFF = flashModule.GetMemberFlashFunction("SetZoom");
m_fxSetPlayerRotationSFF = flashModule.GetMemberFlashFunction("S
etPlayerRotation");
m_fxSetPlayerPositionSFF = flashModule.GetMemberFlashFunction("S
etPlayerPosition");
m_fxSetPlayerPositionAndRotationSFF = flashModule.GetMemberFlash
Function("SetPlayerPositionAndRotation");
m_fxNotifyPlayerEnteredInteriorSFF = flashModule.GetMemberFlashF
unction("NotifyPlayerEnteredInterior");
m_fxNotifyPlayerExitedInteriorSFF = flashModule.GetMemberFlashFu
nction("NotifyPlayerExitedInterior");
m_fxDoFadingSFF = flashModule.GetMemberFlashFunction("DoFading")
;
m_fxEnableRotationSFF = flashModule.GetMemberFlashFunction("Enab
leRotation");
m_fxEnableMask = flashModule.GetMemberFlashFunction("EnableMask"
);
m_fxEnableDebug = flashModule.GetMemberFlashFunction("EnableDebu

g");
m_fxEnableBorders = flashModule.GetMemberFlashFunction("EnableBo
rders");
b24HRFormat = GetCurrentTextLocCode() != "EN";
LoadMinimapSettings();
m_zoomValue = MINIMAP_EXTERIOR_ZOOM;
SetZoom(m_zoomValue, true);
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
EnableRotation(hud.IsEnabledMinimapRotation());
}
m_fadedOut = true;
DoFading(!m_fadedOut, true);
SetTickInterval(1);
if (hud){
hud.UpdateHudConfig('Minimap2Module', true);
}
manager = theGame.GetCommonMapManager();
if (manager){
manager.InitializeMinimapManager(this);
manager.SetHintWaypointParameters(HINT_WAYPOINTS_MAX_REM
OVAL_DISTANCE, HINT_WAYPOINTS_MIN_PLACING_DISTANCE, HINT_WAYPOINTS_REFRESH_INTER
VAL, HINT_WAYPOINTS_PATHFIND_TOLERANCE, HINT_WAYPOINTS_MAX_COUNT);
}
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
UpdateZoom();
UpdatePlayerPositionAndRotation(timeDelta);
if (!CanTick(timeDelta)){
return true;
}
UpdateWeatherDisplay();
/* NOP */;
}
public function AddMapPath(path : SMapPathInstance){
var pathObject : CScriptedFlashObject;
var pointObject : CScriptedFlashObject;
var pointArray : CScriptedFlashArray;
var i : Int32;
pathObject = GetModuleFlashValueStorage().CreateTempFlashObject(
/* NOP */);
pathObject.SetMemberFlashInt("id", path.id);
pathObject.SetMemberFlashNumber("x", path.position.X);
pathObject.SetMemberFlashNumber("y", path.position.Y);
pathObject.SetMemberFlashInt("color", path.color);
pathObject.SetMemberFlashNumber("lineWidth", path.lineWidth);
pointArray = GetModuleFlashValueStorage().CreateTempFlashArray()
;
i = 0;
while (i < path.splinePoints.Size()){
pointObject = m_flashValueStorage.CreateTempFlashObject(
/* NOP */);
pointObject.SetMemberFlashNumber("x", path.splinePoints[
i].X);
pointObject.SetMemberFlashNumber("y", path.splinePoints[
i].Y);
pointArray.PushBackFlashObject(pointObject);
i += 1;
}

pathObject.SetMemberFlashArray("splinePoints", pointArray);
m_flashValueStorage.SetFlashObject("hud.minimap.paths.add", path
Object, /* NOP */);
/* NOP */;
}
public function DeleteMapPaths(ids : array<Int32>){
var idArray : CScriptedFlashArray;
var idObject : CScriptedFlashObject;
var i : Int32;
idArray = GetModuleFlashValueStorage().CreateTempFlashArray();
i = 0;
while (i < ids.Size()){
idObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
idObject.SetMemberFlashInt("id", ids[i]);
idArray.PushBackFlashObject(idObject);
i += 1;
}
m_flashValueStorage.SetFlashArray("hud.minimap.paths.delete", id
Array);
/* NOP */;
}
public function NotifyPlayerEnteredInterior(areaPos : Vector, areaYaw :
Float, texture : String){
var fullPath : String;
var hud : CR4ScriptedHud;
fullPath = "interiors/" + texture + ".png";
/* NOP */;
m_fxNotifyPlayerEnteredInteriorSFF.InvokeSelfFourArgs(FlashArgNu
mber(areaPos.X), FlashArgNumber(areaPos.Y), FlashArgNumber(areaYaw), FlashArgStr
ing(fullPath));
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.SetMinimapZoom(MINIMAP_INTERIOR_ZOOM);
}
/* NOP */;
}
public function NotifyPlayerExitedInterior(){
var hud : CR4ScriptedHud;
/* NOP */;
m_fxNotifyPlayerExitedInteriorSFF.InvokeSelf();
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.SetMinimapZoom(MINIMAP_EXTERIOR_ZOOM);
}
/* NOP */;
}
public function NotifyPlayerMountedBoat(){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.SetMinimapZoom(MINIMAP_BOAT_ZOOM);
}
/* NOP */;
}
public function NotifyPlayerDismountedBoat(){
var hud : CR4ScriptedHud;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.SetMinimapZoom(MINIMAP_EXTERIOR_ZOOM);

}
/* NOP */;
}
private function UpdateZoom(){
var hud : CR4ScriptedHud;
var zoomValue : Float;
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
zoomValue = hud.GetMinimapZoom();
if (m_zoomValue != zoomValue){
m_zoomValue = zoomValue;
SetZoom(m_zoomValue, false);
}
}
/* NOP */;
}
private function UpdatePlayerPositionAndRotation(timeDelta : Float){
var position : Vector;
var playerRotation : EulerAngles;
var playerAngle : Float;
var cameraAngle : Float;
var hud : CR4ScriptedHud;
var updateMapPins : Bool;
var updatePlayerPosition : Bool;
var updatePlayerRotation : Bool;
updatePlayerPosition = false;
updatePlayerRotation = false;
hud = (CR4ScriptedHud)theGame.GetHud();
position = thePlayer.GetWorldPosition();
cameraAngle = theCamera.GetCameraHeading();
playerRotation = thePlayer.GetWorldRotation();
playerAngle = playerRotation.Yaw;
if (cameraAngle < 0){
cameraAngle += 360.000000;
}
if (playerAngle < 0){
playerAngle += 360.000000;
}
if (m_forceUpdate || AbsF(playerAngle - m_previousPlayerAngle) >
PLAYER_ANGLE_EPSILON || AbsF(cameraAngle - m_previousCameraAngle) > CAMERA_ANGL
E_EPSILON){
m_previousPlayerAngle = playerAngle;
m_previousCameraAngle = cameraAngle;
updatePlayerRotation = true;
}
m_updateInterval -= timeDelta;
if (m_forceUpdate){
m_updateInterval = 0;
}
updateMapPins = false;
if (m_updateInterval <= 0){
updateMapPins = true;
m_forceUpdate = true;
m_updateInterval += 0.200000;
}
if (m_forceUpdate || position.X != m_previousPlayerPosition.X ||
position.Y != m_previousPlayerPosition.Y || position.Z != m_previousPlayerPosit
ion.Z){
m_previousPlayerPosition = position;
updatePlayerPosition = true;

}
if (updatePlayerPosition && updatePlayerRotation){
m_fxSetPlayerPositionAndRotationSFF.InvokeSelfSixArgs(Fl
ashArgNumber(position.X), FlashArgNumber(position.Y), FlashArgNumber(position.Z)
, FlashArgBool(updateMapPins), FlashArgNumber(cameraAngle), FlashArgNumber(playe
rAngle));
} else if (updatePlayerPosition){
m_fxSetPlayerPositionSFF.InvokeSelfFourArgs(FlashArgNumb
er(position.X), FlashArgNumber(position.Y), FlashArgNumber(position.Z), FlashArg
Bool(updateMapPins));
} else if (updatePlayerRotation){
m_fxSetPlayerRotationSFF.InvokeSelfTwoArgs(FlashArgNumbe
r(cameraAngle), FlashArgNumber(playerAngle));
}
m_forceUpdate = false;
/* NOP */;
}
private function UpdateBuffedMonsterDisplay(){
var monsterName : CName;
var monsterIcon : CName;
var journalManager : CWitcherJournalManager;
journalManager = theGame.GetJournalManager();
if (bDisplayBuffedMoster && !thePlayer.IsCiri()){
monsterName = journalManager.GetCurrentlyBuffedCreatureN
ame();
if (monsterName){
monsterIcon = HAXGetMonsterIconFromJournalName(m
onsterName);
}
if (m_buffedMonsterIconPath != monsterIcon){
m_buffedMonsterIconPath = monsterIcon;
m_flashValueStorage.SetFlashString('hud.buffed.m
onster', m_buffedMonsterIconPath, /* NOP */);
m_flashValueStorage.SetFlashString('hud.buffed.t
ext', HAXGetMonsterNameByIcon(m_buffedMonsterIconPath), /* NOP */);
}
} else if (m_buffedMonsterIconPath != 'None'){
m_buffedMonsterIconPath = 'None';
m_flashValueStorage.SetFlashString('hud.buffed.monster',
"", /* NOP */);
}
/* NOP */;
}
private function HAXGetMonsterIconFromJournalName(jourName : CName) : CN
ame{
var iconName : CName;
switch(jourName){
case 'bestiary_siren':
iconName = 'ICO_syrena.png';
break;
default:
case 'bestiary_noonwright':
iconName = 'ICO_poludnica.png';
break;
case 'bestiary_wildhunt':
case 'bestiary_werewolf':
iconName = 'ICO_werewolf.png';
break;
case 'bestiary_ghoul':
iconName = 'ICO_ghul.png';

break;
case 'bestiary_icegiant':
iconName = 'ICO_icegiant.png';
break;
case 'bestiary_water_hag':
iconName = 'ICO_waterhag.png';
break;
}
return iconName;
/* NOP */;
}
private function HAXGetMonsterNameByIcon(icon : CName) : String{
var locKey : String;
switch(icon){
case 'ICO_poludnica.png':
locKey = "panel_hud_monstertype_noonwraith";
break;
case 'ICO_bies.png':
locKey = "panel_hud_monstertype_bies";
break;
case 'ICO_syrena.png':
locKey = "panel_hud_monstertype_siren";
break;
case 'ICO_ghul.png':
locKey = "panel_hud_monstertype_ghul";
break;
case 'ICO_werewolf.png':
locKey = "panel_hud_monstertype_werewolf";
break;
case 'ICO_waterhag.png':
locKey = "panel_hud_monstertype_waterhag";
break;
}
return GetLocStringByKeyExt(locKey);
/* NOP */;
}
private function GetCurrentTimeString() : String{
var gameTime : GameTime;
var hours : Int32;
var minutes : Int32;
var timeString : String;
var timePeriod : String;
gameTime = theGame.GetGameTime();
timeString = "";
timePeriod = "";
hours = GameTimeHours(gameTime);
minutes = GameTimeMinutes(gameTime);
if (!b24HRFormat){
if (hours >= 12){
if (hours > 12){
hours -= 12;
}
timePeriod = " PM";
} else {
if (hours == 0){
hours = 12;
}
timePeriod = " AM";
}
}

timeString = hours + ":";


if (minutes < 10){
timeString += "0";
}
timeString += minutes;
timeString += timePeriod;
return timeString;
/* NOP */;
}
public function RefreshTimeDisplay(){
m_flashValueStorage.SetFlashString('hud.worldcondition.text', Ge
tCurrentTimeString() + " / " + GetLocStringByKeyExt("panel_hud_weathertype_" + m
_weatherType), /* NOP */);
/* NOP */;
}
private function UpdateWeatherDisplay(){
var currentWeather : CName;
var currentDayTimeName : CName;
var curGameTime : GameTime;
var curGameHour : Int32;
var curGameMin : Int32;
var dayPart : EDayPart;
currentWeather = 'Clear';
currentDayTimeName = m_dayTimeName;
curGameTime = GameTimeCreate(/* NOP */, /* NOP */, /* NOP */, /*
NOP */);
curGameHour = GameTimeHours(curGameTime);
curGameMin = GameTimeMinutes(curGameTime);
if (m_gameMin != curGameMin){
if (curGameHour >= 22 || curGameHour < 4){
DoFading(true, false);
} else {
DoFading(false, false);
}
}
if (!thePlayer.IsCiri() && bDisplayDayTime){
if (m_gameHour != curGameHour){
dayPart = GetDayPart(curGameTime);
if (dayPart == 1){
currentDayTimeName = 'Dawn';
} else if (dayPart == 2){
currentDayTimeName = 'Noon';
} else if (dayPart == 3){
currentDayTimeName = 'Dusk';
} else if (dayPart == 4){
currentDayTimeName = 'Midnight';
} else {
LogAssert(false, "UpdateWeatherDisplay:
unknow day part!");
}
}
if (GetRainStrength() > 0){
currentWeather = 'Rain';
} else if (GetSnowStrength() > 0){
currentWeather = 'Snow';
}
if (currentWeather != m_weatherType || currentDayTimeNam
e != m_dayTimeName || m_gameHour != curGameHour || curGameMin != m_gameMin){
m_weatherType = currentWeather;
m_dayTimeName = currentDayTimeName;

m_gameHour = curGameHour;
m_gameMin = curGameMin;
m_flashValueStorage.SetFlashString('hud.worldcon
dition.weather', m_dayTimeName + m_weatherType, /* NOP */);
RefreshTimeDisplay();
}
} else {
m_weatherType = 'None';
m_dayTimeName = 'None';
m_flashValueStorage.SetFlashString('hud.worldcondition.w
eather', "", /* NOP */);
if (m_gameHour != curGameHour || m_gameMin != curGameMin
){
m_gameHour = curGameHour;
m_gameMin = curGameMin;
}
}
/* NOP */;
}
public function EnableMask(enable : Bool){
m_fxEnableMask.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
public function EnableDebug(enable : Bool){
m_fxEnableDebug.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
public function EnableBorders(enable : Bool){
m_fxEnableBorders.InvokeSelfOneArg(FlashArgBool(enable));
/* NOP */;
}
private function LoadMinimapSettings(){
var world : CWorld;
var levelSize : Float;
var tileCount : Int32;
var exteriorTextureSize : Int32;
var interiorTextureSize : Int32;
var exteriorTextureExtension : String;
var interiorTextureExtension : String;
var areaName : Int32;
var levelName : String;
world = theGame.GetWorld();
world.GetTerrainParameters(levelSize, tileCount);
levelName = StrAfterLast(theGame.GetWorld().GetPath(), StrChar(9
2));
levelName = StrReplace(levelName, ".w2w", "");
areaName = AreaNameToType(levelName);
exteriorTextureSize = StringToInt(theGame.minimapSettings.GetVal
ueAt(3, areaName), /* NOP */);
interiorTextureSize = StringToInt(theGame.minimapSettings.GetVal
ueAt(4, areaName), /* NOP */);
exteriorTextureExtension = ExtractStringFromCSV(theGame.minimapS
ettings.GetValueAt(8, areaName));
interiorTextureExtension = ExtractStringFromCSV(theGame.minimapS
ettings.GetValueAt(9, areaName));
if (levelSize == 0){
levelSize = 6000;
}
if (exteriorTextureSize == 0){
exteriorTextureSize = 512;

}
if (interiorTextureSize == 0){
interiorTextureSize = 1024;
}
if (tileCount == 0){
tileCount = 16;
}
if (m_fxSetMapSettingsSFF){
m_fxSetMapSettingsSFF.InvokeSelfFiveArgs(FlashArgString(
levelName), FlashArgNumber(levelSize), FlashArgInt(exteriorTextureSize), FlashAr
gInt(interiorTextureSize), FlashArgInt(tileCount));
}
if (m_fxSetTextureExtensionsSFF){
m_fxSetTextureExtensionsSFF.InvokeSelfTwoArgs(FlashArgSt
ring(exteriorTextureExtension), FlashArgString(interiorTextureExtension));
}
/* NOP */;
}
public function DoFading(fadeOut : Bool, immediately : Bool){
if (m_fadedOut != fadeOut){
m_fadedOut = fadeOut;
m_fxDoFadingSFF.InvokeSelfTwoArgs(FlashArgBool(m_fadedOu
t), FlashArgBool(immediately));
}
/* NOP */;
}
public function EnableRotation(enable : Bool){
m_fxEnableRotationSFF.InvokeSelfOneArg(FlashArgBool(enable));
m_forceUpdate = true;
/* NOP */;
}
public function SetZoom(newValue : Float, immediately : Bool){
var manager : CCommonMapManager;
m_fxSetZoomSFF.InvokeSelfTwoArgs(FlashArgNumber(newValue), Flash
ArgBool(immediately));
m_forceUpdate = true;
manager = theGame.GetCommonMapManager();
if (manager){
manager.OnChangedMinimapRadius(33 / newValue, newValue);
}
/* NOP */;
}
}
class CAIStorageReactionData extends CObject{
private const var TAUNTS_TO_BE_ALARMED : Int32;
private var alarmedTimeStamp : Float;
private var tauntCounter : Int32;
private var lastTauntTimeStamp : Float;
private var temporaryHostileActors : array<CActor>;
public function IsAlarmed(timeStamp : Float) : Bool{
if (alarmedTimeStamp <= 0 || timeStamp + 7 < alarmedTimeStamp){
alarmedTimeStamp = 0.000000;
return false;
}
return true;
/* NOP */;
}
public function IsAngry(timeStamp : Float) : Bool{
return IsAlarmed(timeStamp) && tauntCounter > 0;

/* NOP */;
}
public function SetAlarmed(timeStamp : Float){
alarmedTimeStamp = timeStamp;
/* NOP */;
}
public function IncreaseTauntCounter(timeStamp : Float, owner : CNewNPC)
{
if (lastTauntTimeStamp <= 0 || timeStamp + 7 < lastTauntTimeStam
p){
tauntCounter = 0;
}
tauntCounter += 1;
lastTauntTimeStamp = timeStamp;
if (owner.GetNPCType() == 1){
if (tauntCounter >= 1 && !IsAlarmed(timeStamp)){
alarmedTimeStamp = timeStamp;
tauntCounter = 0;
}
} else if (tauntCounter >= TAUNTS_TO_BE_ALARMED && !IsAlarmed(ti
meStamp)){
alarmedTimeStamp = timeStamp;
tauntCounter = 0;
}
/* NOP */;
}
public function Reset(){
alarmedTimeStamp = 0.000000;
lastTauntTimeStamp = 0.000000;
tauntCounter = 0;
/* NOP */;
}
public function ChangeAttitudeIfNeeded(owner : CNewNPC, _actor : CActor)
{
var currentAttitude : EAIAttitude;
var npcType : ENPCGroupType;
if (!_actor){
return;
}
npcType = owner.GetNPCType();
if (npcType == 1 || npcType == 2){
return;
}
if (_actor == thePlayer && thePlayer.IsInCombat()){
return;
}
if (_actor.HasBuff(36) || owner.HasBuff(36)){
return;
}
currentAttitude = GetAttitudeBetween(owner, _actor);
if (currentAttitude != 1){
return;
}
NewTempHostileActor(owner, _actor);
/* NOP */;
}
public function NewTempHostileActor(owner : CActor, _actor : CActor){
var ownerHorse : CActor;
if (temporaryHostileActors.Contains(_actor)){
return;

}
owner.SetAttitude(_actor, 2);
owner.SignalGameplayEvent('AI_RequestCombatEvaluation');
ownerHorse = (CActor)owner.GetUsedHorseComponent().GetEntity();
if (ownerHorse){
ownerHorse.SetAttitude(_actor, 2);
ownerHorse.SignalGameplayEvent('AI_RequestCombatEvaluati
on');
}
temporaryHostileActors.PushBack(_actor);
/* NOP */;
}
public function ResetAttitudes(owner : CActor){
var i : Int32;
var ownerHorse : CActor;
ownerHorse = (CActor)owner.GetUsedHorseComponent().GetEntity();
i = 0;
while (i < temporaryHostileActors.Size()){
owner.ResetAttitude(temporaryHostileActors[i]);
if (ownerHorse){
ownerHorse.ResetAttitude(temporaryHostileActors[
i]);
}
i += 1;
}
temporaryHostileActors.Clear();
/* NOP */;
}
}
class CBTEnumBehaviorGraph extends IBehTreeValueEnum{
public editable var value : EBehaviorGraph;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class CBTEnumMoveType extends IBehTreeValueEnum{
public editable var value : EMoveType;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class CBTEnumCriticalState extends IBehTreeValueEnum{
public editable var value : ECriticalStateType;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class W3QuestCond_ItemAmmo extends CQuestScriptedCondition{
public editable var itemName : CName;
public editable var ammoQuantity : Int32;
public editable var comparator : ECompareOp;
public saved var isFulfilled : Bool;
public var ammoListener : W3QuestCond_ItemAmmo_AmmoListener;

public var inventoryListener : W3QuestCond_ItemAmmo_InventoryListener;


public function RegisterAmmoListener(flag : Bool){
if (flag){
ammoListener = new W3QuestCond_ItemAmmo_AmmoListener in
this;
ammoListener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(4), ammoListener);
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(4), ammoListener);
delete ammoListener;
ammoListener = NULL;
}
/* NOP */;
}
public function RegisterInventoryListener(flag : Bool){
var inventory : CInventoryComponent;
inventory = thePlayer.GetInventory();
if (!inventory){
return;
}
if (flag){
inventoryListener = new W3QuestCond_ItemAmmo_InventoryLi
stener in this;
inventoryListener.condition = this;
inventory.AddListener(inventoryListener);
EvaluateImpl();
} else {
inventory.RemoveListener(inventoryListener);
delete inventoryListener;
inventoryListener = NULL;
}
/* NOP */;
}
public function Activate(){
EvaluateImpl();
if (!isFulfilled){
RegisterAmmoListener(true);
RegisterInventoryListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (ammoListener){
RegisterAmmoListener(false);
}
if (inventoryListener){
RegisterInventoryListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled){
if (!ammoListener){
RegisterAmmoListener(true);
}
if (!inventoryListener){
RegisterInventoryListener(true);
}

}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var ammo : Int32;
var ids : array<SItemUniqueId>;
ids = thePlayer.inv.GetItemsByName(itemName);
ammo = thePlayer.inv.SingletonItemGetAmmo(ids[0]);
isFulfilled = ProcessCompare(comparator, ammo, ammoQuantity);
/* NOP */;
}
}
class CBTEnumHitReactionType extends IBehTreeValueEnum{
public editable var value : EHitReactionType;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class CBTEnumHitReactionSide extends IBehTreeValueEnum{
public editable var value : EHitReactionSide;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class CBTEnumHitReactionDirection extends IBehTreeValueEnum{
public editable var value : EHitReactionDirection;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class W3QuestCond_ItemAmmo_AmmoListener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_ItemAmmo;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CBTEnumAttackSwingType extends IBehTreeValueEnum{
public editable var value : EAttackSwingType;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class W3QuestCond_ItemAmmo_InventoryListener extends IInventoryScriptedListener{
public var condition : W3QuestCond_ItemAmmo;
public function OnInventoryScriptedEvent(eventType : EInventoryEventType

, itemId : SItemUniqueId, quantity : Int32, fromAssociatedInventory : Bool) : Bo


ol{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CBTEnumAttackSwingDriection extends IBehTreeValueEnum{
public editable var value : EAttackSwingDirection;
public function SetVal(val : Int32){
value = val;
/* NOP */;
}
}
class W3QuestCond_IsItemEquipped extends CQuestScriptedCondition{
public editable var itemName : CName;
public editable var categoryName : CName;
public var isFulfilled : Bool;
public var listener : W3QuestCond_IsItemEquipped_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_IsItemEquipped_Listener in th
is;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(2), listener);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(2), listener);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var player : W3PlayerWitcher;

player = GetWitcherPlayer();
if (player){
if (IsNameValid(itemName)){
isFulfilled = player.IsItemEquippedByName(itemNa
me);
} else if (IsNameValid(categoryName)){
isFulfilled = player.IsItemEquippedByCategoryNam
e(categoryName);
}
}
/* NOP */;
}
}
class CHorseTagAIParameters extends ICustomValAIParameters{
public editable var preferedHorseTag : CName;
public function SetCNameValue(value : CName){
preferedHorseTag = value;
/* NOP */;
}
}
class W3QuestCond_IsItemEquipped_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_IsItemEquipped;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class SpawnOnHorseEffector extends IBehTreeOnSpawnEffector{
public editable var mountOnSpawned : CBehTreeValBool;
public function Run(){
var horseData : CAIStorageHorseData;
var horseEntity : CNewNPC;
var horseComponent : W3HorseComponent;
var owner : CActor;
owner = GetActor();
if (!GetValBool(mountOnSpawned)){
return;
}
horseEntity = (CNewNPC)GetObjectByVar('mountEntity');
if (!horseEntity){
return;
}
horseComponent = horseEntity.GetHorseComponent();
if (!horseComponent){
return;
}
horseData = (CAIStorageHorseData)GetObjectFromAIStorage('HorseDa
ta');
horseData.horseEntity = horseEntity;
horseData.horseComponent = horseComponent;
horseComponent.riderSharedParams.rider = owner;
/* NOP */;
}
}

class W3QuestCond_IsItemQuantityMet extends CQuestScriptedCondition{


public editable var itemName : CName;
public editable var entityTag : CName;
public editable var itemTag : CName;
public editable var itemCategory : CName;
public editable var comparator : ECompareOp;
public editable var count : Int32;
public var inventory : CInventoryComponent;
public saved var isFulfilled : Bool;
public var isTrophy : Bool;
public var globalListener : W3QuestCond_IsItemQuantityMet_GlobalListener
;
public var inventoryListener : W3QuestCond_IsItemQuantityMet_InventoryLi
stener;
public function RegisterGlobalListener(flag : Bool){
if (!IsNameValid(entityTag)){
entityTag = 'PLAYER';
}
if (flag){
globalListener = new W3QuestCond_IsItemQuantityMet_Globa
lListener in this;
globalListener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, globalListener, entityTag);
FindInventory();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, globalListener, entityTag);
delete globalListener;
globalListener = NULL;
}
/* NOP */;
}
public function RegisterInventoryListener(flag : Bool){
if (flag){
inventoryListener = new W3QuestCond_IsItemQuantityMet_In
ventoryListener in this;
inventoryListener.condition = this;
inventory.AddListener(inventoryListener);
} else {
inventory.RemoveListener(inventoryListener);
delete inventoryListener;
inventoryListener = NULL;
}
/* NOP */;
}
public function Activate(){
isFulfilled = false;
inventory = NULL;
FindInventory();
if (!inventory){
RegisterGlobalListener(true);
} else {
EvaluateImpl();
if (!isFulfilled){
RegisterInventoryListener(true);
}
}
/* NOP */;

}
public function Deactivate(){
if (globalListener){
RegisterGlobalListener(false);
}
if (inventory && inventoryListener){
RegisterInventoryListener(false);
} else if (inventoryListener){
delete inventoryListener;
inventoryListener = NULL;
}
inventory = NULL;
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !inventory && !globalListener){
RegisterGlobalListener(true);
}
if (isFulfilled && isTrophy){
if (theGame.GetGuiManager().GetPopup('LootPopup')){
return false;
} else {
return true;
}
} else {
return isFulfilled;
}
/* NOP */;
}
public function EvaluateImpl(){
var itemQuantity : Int32;
var i : Int32;
var itemID : SItemUniqueId;
var items : array<SItemUniqueId>;
var horseInv : CInventoryComponent;
var witcher : W3PlayerWitcher;
if (isFulfilled){
return;
}
witcher = GetWitcherPlayer();
if (inventory){
if (itemName != 'None'){
itemQuantity = inventory.GetItemQuantityByName(i
temName, true);
} else if (itemCategory != 'None'){
itemQuantity = inventory.GetItemQuantityByCatego
ry(itemCategory, true);
} else if (IsNameValid(itemTag)){
itemQuantity = inventory.GetItemQuantityByTag(it
emTag, true);
} else {
itemQuantity = inventory.GetAllItemsQuantity(tru
e);
}
items = inventory.GetItemsIds(itemName);
itemID = items[0];
if (inventory.IsItemTrophy(itemID) || itemCategory == 't
rophy' || itemTag == 'Trophy' || itemTag == 'HorseTrophy'){
isTrophy = true;
}

isFulfilled = ProcessCompare(comparator, itemQuantity, c


ount);
} else {
LogQuest("W3QuestCond_IsItemQuantityMet: iventory can't
be NULL inside EvaluateImpl");
}
if (isFulfilled && inventory && inventoryListener){
RegisterInventoryListener(false);
}
/* NOP */;
}
public function FindInventory(){
var gameplayEntity : CGameplayEntity;
if (inventory){
return;
}
if (IsNameValid(entityTag)){
gameplayEntity = (CGameplayEntity)theGame.GetEntityByTag
(entityTag);
} else {
gameplayEntity = thePlayer;
}
if (gameplayEntity){
inventory = gameplayEntity.GetInventory();
}
if (inventory){
if (globalListener){
RegisterGlobalListener(false);
}
EvaluateImpl();
if (!isFulfilled){
RegisterInventoryListener(true);
}
}
/* NOP */;
}
}
class SetNPCTypeEffector extends IBehTreeOnSpawnEffector{
public editable var groupType : CBehTreeValInt;
public function Run(){
var npcType : ENPCGroupType;
var npc : CNewNPC;
var owner : CActor;
owner = GetActor();
npcType = GetValInt(groupType);
npc = (CNewNPC)owner;
npc.SetNPCType(npcType);
/* NOP */;
}
}
class W3QuestCond_IsItemQuantityMet_GlobalListener extends IGlobalEventScriptedL
istener{
public var condition : W3QuestCond_IsItemQuantityMet;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.entityTag){
condition.FindInventory();
}

/* NOP */;
}
}
class W3QuestCond_IsItemQuantityMet_InventoryListener extends IInventoryScripted
Listener{
public var condition : W3QuestCond_IsItemQuantityMet;
public function OnInventoryScriptedEvent(eventType : EInventoryEventType
, itemId : SItemUniqueId, quantity : Int32, fromAssociatedInventory : Bool) : Bo
ol{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
abstract class IBehTreeFollowerTaskDefinition extends IBehTreeTaskDefinition{
}
class W3BehTreeValNameArray extends IScriptable{
public editable var nameArray : array<CName>;
public function GetArray() : array<CName>{
return nameArray;
/* NOP */;
}
}
class W3QuestCond_IsItemUsed extends CQuestScriptedCondition{
public editable var itemName : CName;
public var factName : String;
public var isFulfilled : Bool;
public var listener : W3QuestCond_IsItemUsed_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_IsItemUsed_Listener in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
(3, listener, factName);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterStr
ing(3, listener, factName);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
factName = "item_use_" + itemName;
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}

/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = FactsQuerySum(factName) > 0;
/* NOP */;
}
}
class W3QuestCond_IsItemUsed_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_IsItemUsed;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && eventParam == condition.factName){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CAICarryingItemsParams extends CAINpcWanderParams{
public editable var storePointTag : CName;
public editable var carryingArea : EntityHandle;
public function Init(){
super.Init();
/* NOP */;
}
}
abstract class
public
public
public
}

CAIWanderTree extends CAIIdleTree{


editable var wanderMoveSpeed : Float;
editable var wanderMoveType : EMoveType;
editable var wanderMaxDistance : Float;

class W3QuestCond_OilApplied extends CQuestScriptedCondition{


public editable var swordType : EQuestSword;
public editable var oilName : CName;
public saved var isFulfilled : Bool;
public var listener : W3QuestCond_OilApplied_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_OilApplied_Listener in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(2), listener);
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(3), listener);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(2), listener);
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(3), listener);

delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
isFulfilled = false;
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var steel : Bool;
var silver : Bool;
if (isFulfilled){
return;
}
if (thePlayer != GetWitcherPlayer()){
LogQuest("W3QuestCond_OilApplied: player is not a witche
r so there can be no oil upgrade!");
return;
}
if (swordType != 1){
silver = GetWitcherPlayer().IsEquippedSwordUpgradedWithO
il(false, oilName);
}
if (swordType != 2){
steel = GetWitcherPlayer().IsEquippedSwordUpgradedWithOi
l(true, oilName);
}
if (swordType == 1){
isFulfilled = steel;
} else if (swordType == 2){
isFulfilled = silver;
} else {
isFulfilled = steel || silver;
}
/* NOP */;
}
}
class W3QuestCond_OilApplied_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_OilApplied;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{

if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CAIChatsInAPTree extends CAISubTree{
}
abstract class CAISubTree extends CAITree{
}
class CBTTaskCanUseChatScene extends IBehTreeTask{
public function IsAvailable() : Bool{
var npc : CNewNPC;
npc = GetNPC();
return npc.CanUseChatInCurrentAP();
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
}
class CBTTaskCanUseChatSceneDef extends IBehTreeReactionTaskDefinition{
}
class CBTTaskIsAtWork extends IBehTreeTask{
public function IsAvailable() : Bool{
var npc : CNewNPC;
var isAtWork : Bool;
npc = GetNPC();
isAtWork = npc.IsAtWork();
return isAtWork;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
}
class CBTTaskIsAtWorkDef extends IBehTreeReactionTaskDefinition{
}
abstract class IAIBaseAction extends IAIActionTree{
public editable var enterExplorationOnStart : Bool;
}
class W3QuestCond_ReusableClueUsed extends CQuestScriptedCondition{
public editable var clueTag : CName;
public editable var resetClue : Bool;
public editable var leaveFacts : Bool;
public editable var keepFocusHighlight : Bool;
public saved var isFulfilled : Bool;
public var listener : W3QuestCond_ReusableClueUsed_Listener;
public function RegisterListener(flag : Bool){
if (flag){

listener = new W3QuestCond_ReusableClueUsed_Listener in


this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(1), listener);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(1), listener);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
isFulfilled = false;
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var focusModeController : CFocusModeController;
if (isFulfilled){
return;
}
focusModeController = theGame.GetFocusModeController();
if (focusModeController){
if (focusModeController.WasReusableClueDetected(clueTag)
){
if (resetClue){
focusModeController.ResetClue(clueTag, !
leaveFacts, keepFocusHighlight);
}
isFulfilled = true;
}
}
/* NOP */;
}
}
class CAIFollowAction extends IAIBaseAction{
public editable inlined var params : CAIFollowParams;
public function Init(){
params = new CAIFollowParams in this;
params.OnCreated();

/* NOP */;
}
}
class CAIFollowParams extends IAIActionParameters{
public editable var targetTag : CName;
public editable var moveType : EMoveType;
public editable var keepDistance : Bool;
public editable var followDistance : Float;
public editable var moveSpeed : Float;
public editable var followTargetSelection : Bool;
public editable var teleportToCatchup : Bool;
public editable var cachupDistance : Float;
public editable var rotateToWhenAtTarget : Bool;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIFollowSideBySideAction extends CAIFollowAction{
public editable var useCustomSteering : Bool;
public editable var customSteeringGraph : CMoveSteeringBehavior;
public function Init(){
super.Init();
customSteeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/
steering/action/follow_side_by_side.w2steer");
params.followDistance = 0.250000;
params.moveType = 3;
/* NOP */;
}
}
class CAIRiderFollowAction extends IRiderActionTree{
public editable inlined var params : CAIRiderFollowActionParams;
public function Init(){
params = new CAIRiderFollowActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIRiderFollowActionParams extends IRiderActionParameters{
public editable var targetTag : CName;
public editable var moveType : EMoveType;
public editable var keepDistance : Bool;
public editable var followDistance : Float;
public editable var moveSpeed : Float;
public editable var followTargetSelection : Bool;
public editable var matchRiderMountStatus : Bool;
public function Init(){
super.Init();
followTargetSelection = false;
/* NOP */;
}
public function CopyTo(followParams : CAIFollowParams){
followParams.targetTag = targetTag;
followParams.moveType = moveType;
followParams.keepDistance = keepDistance;
followParams.followDistance = followDistance;

followParams.moveSpeed = moveSpeed;
/* NOP */;
}
}
class W3QuestCond_ReusableClueUsed_Listener extends IGlobalEventScriptedListener
{
public var condition : W3QuestCond_ReusableClueUsed;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.clueTag){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class W3QuestCond_SwitchState extends CQuestScriptedCondition{
public editable var switchTag : CName;
public editable var stateToCheck : ESwitchStateCondition;
public var switchEntity : W3Switch;
public var listener : W3QuestCond_SwitchState_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_SwitchState_Listener in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, switchTag);
FindSwitch();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, switchTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
FindSwitch();
if (!switchEntity){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (switchEntity){
switch(stateToCheck){
case 0:
return switchEntity.IsOn();
case 1:
return !switchEntity.IsOn();
case 2:
return switchEntity.IsEnabled();
case 3:

return !switchEntity.IsEnabled();
case 4:
return switchEntity.IsLocked();
case 5:
return !switchEntity.IsLocked();
case 6:
return switchEntity.IsUseCountReached();
}
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindSwitch(){
if (switchEntity){
return;
}
switchEntity = (W3Switch)theGame.GetEntityByTag(switchTag);
if (switchEntity && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class CAIRiderFollowSideBySideActionParams extends CAIRiderFollowActionParams{
public editable var useCustomSteering : Bool;
public editable var customSteeringGraph : CMoveSteeringBehavior;
public editable var horseCustomSteeringGraph : CMoveSteeringBehavior;
public function Init(){
customSteeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/
steering/action/follow_side_by_side.w2steer");
horseCustomSteeringGraph = LoadSteeringGraph("gameplay/behaviors
/npc/steering/action/horse_follow_side_by_side.w2steer");
followDistance = 0.000000;
moveType = 3;
super.Init();
/* NOP */;
}
public function CopyTo_SideBySide(followSideBySideAction : CAIFollowSide
BySideAction){
CopyTo(followSideBySideAction.params);
followSideBySideAction.useCustomSteering = true;
followSideBySideAction.customSteeringGraph = horseCustomSteering
Graph;
/* NOP */;
}
}
class W3QuestCond_SwitchState_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_SwitchState;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.switchTag){
condition.FindSwitch();
}
/* NOP */;
}
}

class CAIHorseDoNothingAction extends IAIActionTree{


}
class CAIDoNothingAction extends IAIActionTree{
}
class CAIMoveAlongPathAction extends IAIBaseAction{
public editable inlined var params : CAIMoveAlongPathParams;
public function Init(){
params = new CAIMoveAlongPathParams in this;
params.OnCreated();
/* NOP */;
}
public function OnPostLoad() : Bool{
if (params && !params.steeringGraph){
params.steeringGraph = LoadSteeringGraph("gameplay/behav
iors/npc/steering/action/manual_pathfollow/manual_pathfollow.w2steer");
return true;
}
return false;
/* NOP */;
}
}
class CAIMoveAlongPathParams extends IAIActionParameters{
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var fromBeginning : Bool;
public editable var pathMargin : Float;
public editable var moveTypeBeforePath : EMoveType;
public editable var moveType : EMoveType;
public editable var moveSpeed : Float;
public editable var steeringGraph : CMoveSteeringBehavior;
public editable var arrivalDistance : Float;
public editable var rotateAfterReachStart : Bool;
public editable var useExplorations : Bool;
public editable var dontCareAboutNavigable : Bool;
public editable var tolerance : Float;
public function Init(){
super.Init();
steeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/steeri
ng/action/manual_pathfollow/manual_pathfollow.w2steer");
/* NOP */;
}
}
class W3QuestCond_SelectedSign extends CQuestScriptedCondition{
public editable var signType : ESignType;
private var isFulfilled : Bool;
private var listener : W3QuestCond_SelectedSign_Listener;
public var factsNames : array<String>;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_SelectedSign_Listener in this
;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
Array(3, listener, factsNames);
EvaluateImpl();

} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterStr
ingArray(3, listener, factsNames);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
factsNames.Clear();
factsNames.PushBack("CurrentlySelectedSign");
isFulfilled = false;
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = GetWitcherPlayer().GetEquippedSign() == signType;
/* NOP */;
}
}
class W3QuestCond_SelectedSign_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_SelectedSign;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && condition.factsNames.FindFirst(eventParam) != 1){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CAIMoveAlongPathWithCompanionAction extends CAIMoveAlongPathAction{
public function Init(){
params = new CAIMoveAlongPathWithCompanionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMoveAlongPathWithCompanionParams extends CAIMoveAlongPathParams{
public editable var companionTag : CName;
public editable var maxDistance : Float;

public
public
public
public
public

editable
editable
editable
editable
editable

var
var
var
var
var

minDistance : Float;
companionOffset : Float;
progressWhenCompanionIsAhead : Bool;
progressOnlyWhenCompanionIsAhead : Bool;
matchCompanionSpeed : Bool;

}
class CAIMoveAlongPathAwareOfTailAction extends CAIMoveAlongPathAction{
public function Init(){
params = new CAIMoveAlongPathAwareOfTailParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3QuestCond_UncoveredBoatFTPoint extends CQuestScriptedCondition{
public saved var isFulfilled : Bool;
public var listener : W3QuestCond_UncoveredBoatFTPoint_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_UncoveredBoatFTPoint_Listener
in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListener(GetGlobalEv
entCategory(8), listener);
} else {
theGame.GetGlobalEventsManager().RemoveListener(GetGloba
lEventCategory(8), listener);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);
}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
isFulfilled = theGame.GetCommonMapManager().HasFastTravelPoints(
true, true, true, false, /* NOP */);
/* NOP */;
}
}

class CAIMoveAlongPathAwareOfTailParams extends CAIMoveAlongPathParams{


public editable var tailTag : CName;
public editable var startMovementDistance : Float;
public editable var stopDistance : Float;
}
class W3QuestCond_UncoveredBoatFTPoint_Listener extends IGlobalEventScriptedList
ener{
public var condition : W3QuestCond_UncoveredBoatFTPoint;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CAIRaceAlongPathAction extends CAIMoveAlongPathAction{
public function Init(){
params = new CAIRaceAlongPathParams in this;
params.OnCreated();
/* NOP */;
}
}
class W3QuestCond_WasMeditating extends CQuestScriptedCondition{
public editable var hours : Int32;
public editable var comparator : ECompareOp;
public editable var dayPart : EDayPart;
public editable var meditateToHour : Bool;
public editable var immediateTest : Bool;
public saved var isFulfilled : Bool;
public var listener : W3QuestCond_WasMeditating_Listener;
public var factsNames : array<String>;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_WasMeditating_Listener in thi
s;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterString
Array(3, listener, factsNames);
EvaluateImpl();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterStr
ingArray(3, listener, factsNames);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function Activate(){
factsNames.Clear();
factsNames.PushBack("MeditationWaitFinished");
factsNames.PushBack("MeditationWaitStartDay");
factsNames.PushBack("MeditationWaitStartHour");
factsNames.PushBack("MeditationStarted");
EvaluateImpl();
if (!isFulfilled){
RegisterListener(true);

}
/* NOP */;
}
public function Deactivate(){
if (listener){
RegisterListener(false);
}
/* NOP */;
}
public function Evaluate() : Bool{
if (!isFulfilled && !listener){
RegisterListener(true);
}
return isFulfilled;
/* NOP */;
}
public function EvaluateImpl(){
var startDay : Int32;
var startHour : Int32;
var currentDay : Int32;
var currentHour : Int32;
var targetDay : Int32;
var targetHour : Int32;
var waitHours : Int32;
var currentTime : GameTime;
var meditateTo : Bool;
if (isFulfilled){
return;
}
if (immediateTest){
if (FactsQuerySum("MeditationStarted") <= 0){
return;
}
} else if (FactsQuerySum("MeditationWaitFinished") <= 0){
return;
}
startDay = FactsQuerySum("MeditationWaitStartDay");
startHour = FactsQuerySum("MeditationWaitStartHour");
currentTime = theGame.GetGameTime();
currentHour = GameTimeHours(currentTime);
currentDay = GameTimeDays(currentTime);
if (!meditateToHour || dayPart != 0){
if (dayPart != 0){
waitHours = GetHourForDayPart(dayPart);
} else {
waitHours = hours;
}
targetDay = startDay;
if (startHour + waitHours > 23){
targetDay += 1;
}
targetHour = startHour + waitHours % 24;
meditateTo = false;
} else {
targetDay = startDay;
targetHour = hours;
if (hours <= startHour){
targetDay += 1;
}
meditateTo = true;

}
if (meditateTo){
if (currentDay == targetDay && currentHour == targetHour
){
isFulfilled = true;
}
} else if (comparator == 4){
isFulfilled = currentDay == targetDay && currentHour ==
targetHour;
} else if (comparator
isFulfilled =
argetHour || currentDay < targetDay;
} else if (comparator
isFulfilled =
targetHour || currentDay < targetDay;
} else if (comparator
isFulfilled =
argetHour || currentDay > targetDay;
} else if (comparator
isFulfilled =
targetHour || currentDay > targetDay;
}
/* NOP */;
}
}

== 0){
currentDay == targetDay && currentHour < t
== 1){
currentDay == targetDay && currentHour <=
== 2){
currentDay == targetDay && currentHour > t
== 3){
currentDay == targetDay && currentHour >=

class CAIRaceAlongPathParams extends CAIMoveAlongPathParams{


public function Init(){
super.Init();
steeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/steeri
ng/action/manual_pathfollow/manual_pathfollow_racing.w2steer");
/* NOP */;
}
}
class CAIRiderMoveAlongPathActionParams extends IRiderActionParameters{
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var fromBeginning : Bool;
public editable var pathMargin : Float;
public editable var moveTypeBeforePath : EMoveType;
public editable var moveType : EMoveType;
public editable var moveSpeed : Float;
public editable var steeringGraph : CMoveSteeringBehavior;
public editable var arrivalDistance : Float;
public editable var rotateAfterReachStart : Bool;
public editable var useExplorations : Bool;
public editable var dontCareAboutNavigable : Bool;
public editable var tolerance : Float;
public function Init(){
steeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/steeri
ng/action/manual_pathfollow/manual_pathfollow.w2steer");
/* NOP */;
}
public function CopyTo(moveAlongPathParams : CAIMoveAlongPathParams){
moveAlongPathParams.pathTag = pathTag;
moveAlongPathParams.upThePath = upThePath;
moveAlongPathParams.fromBeginning = fromBeginning;
moveAlongPathParams.pathMargin = pathMargin;
moveAlongPathParams.moveTypeBeforePath = moveTypeBeforePath;

moveAlongPathParams.moveType = moveType;
moveAlongPathParams.moveSpeed = moveSpeed;
moveAlongPathParams.steeringGraph = steeringGraph;
moveAlongPathParams.arrivalDistance = arrivalDistance;
moveAlongPathParams.rotateAfterReachStart = rotateAfterReachStar
t;
moveAlongPathParams.useExplorations = useExplorations;
moveAlongPathParams.dontCareAboutNavigable = dontCareAboutNaviga
ble;
moveAlongPathParams.tolerance = tolerance;
/* NOP */;
}
}
class W3QuestCond_WasMeditating_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_WasMeditating;
public function OnGlobalEventString(eventCategory : EGlobalEventCategory
, eventType : EGlobalEventType, eventParam : String) : Bool{
if (condition && condition.factsNames.FindFirst(eventParam) != 1){
condition.EvaluateImpl();
}
/* NOP */;
}
}
class CAIRiderMoveAlongPathWithCompanionActionParams extends CAIRiderMoveAlongPa
thActionParams{
public editable var companionTag : CName;
public editable var maxDistance : Float;
public editable var minDistance : Float;
public editable var companionOffset : Float;
public editable var progressWhenCompanionIsAhead : Bool;
public editable var progressOnlyWhenCompanionIsAhead : Bool;
public editable var matchCompanionSpeed : Bool;
public function CopyTo_2(moveAlongPathParams : CAIMoveAlongPathWithCompa
nionParams){
CopyTo(moveAlongPathParams);
moveAlongPathParams.matchCompanionSpeed = matchCompanionSpeed;
moveAlongPathParams.companionTag = companionTag;
moveAlongPathParams.maxDistance = maxDistance;
moveAlongPathParams.minDistance = minDistance;
moveAlongPathParams.companionOffset = companionOffset;
moveAlongPathParams.progressWhenCompanionIsAhead = progressWhenC
ompanionIsAhead;
moveAlongPathParams.progressOnlyWhenCompanionIsAhead = progressO
nlyWhenCompanionIsAhead;
/* NOP */;
}
}
class CAIRiderRaceAlongPathActionParams extends IRiderActionParameters{
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var fromBeginning : Bool;
public editable var pathMargin : Float;
public editable var tolerance : Float;
public editable var moveTypeBeforePath : EMoveType;
public editable var moveType : EMoveType;
public editable var moveSpeed : Float;

public
public
public
public
public

editable var steeringGraph : CMoveSteeringBehavior;


editable var arrivalDistance : Float;
editable var rotateAfterReachStart : Bool;
editable var dontCareAboutNavigable : Bool;
function Init(){
super.Init();
steeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/steeri
ng/action/manual_pathfollow/manual_pathfollow_racing.w2steer");
/* NOP */;
}
public function CopyTo(raceAlongPathParams : CAIRaceAlongPathParams){
raceAlongPathParams.pathTag = pathTag;
raceAlongPathParams.upThePath = upThePath;
raceAlongPathParams.fromBeginning = fromBeginning;
raceAlongPathParams.pathMargin = pathMargin;
raceAlongPathParams.tolerance = tolerance;
raceAlongPathParams.moveTypeBeforePath = moveTypeBeforePath;
raceAlongPathParams.moveType = moveType;
raceAlongPathParams.moveSpeed = moveSpeed;
raceAlongPathParams.steeringGraph = steeringGraph;
raceAlongPathParams.arrivalDistance = arrivalDistance;
raceAlongPathParams.steeringGraph = steeringGraph;
raceAlongPathParams.rotateAfterReachStart = rotateAfterReachStar
t;
raceAlongPathParams.dontCareAboutNavigable = dontCareAboutNaviga
ble;
/* NOP */;
}
}
class CAIRiderRideHorseAction extends IRiderActionTree{
public function Init(){
}
public function CopyTo(horseDoNothingAction : CAIHorseDoNothingAction){
}
}
abstract class ISailorActionTree extends IAIActionTree{
}
class CAISailorMountBoatActionParams extends ISailorActionParameters{
public editable var boatTag : CName;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAISailorDismountBoatAction extends ISailorActionTree{
public editable var teleportHere : CName;
}
class CAISailorMoveToActionParams extends ISailorActionParameters{
public editable var boatTag : CName;
public editable var entityTag : CName;
public function Init(){
super.Init();
/* NOP */;
}
}

class CAISailorMoveAlongPathActionParams extends ISailorActionParameters{


public editable var boatTag : CName;
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var startFromBeginning : Bool;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAISailorRaceAlongPathActionParams extends ISailorActionParameters{
public editable var boatTag : CName;
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var startFromBeginning : Bool;
public function Init(){
super.Init();
/* NOP */;
}
}
class W3QuestCond_IsTargetOf extends CQCActorScriptedCondition{
public editable var attackerTag : CName;
public var attacker : CActor;
public var listener : W3QuestCond_IsTargetOf_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_IsTargetOf_Listener in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, attackerTag);
FindAttacker();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, attackerTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function OnActivate(actor : CActor) : Bool{
FindAttacker();
if (!attacker){
RegisterListener(true);
}
return true;
/* NOP */;
}
public function OnDeactivate(actor : CActor) : Bool{
if (listener){
RegisterListener(false);
}
return true;
/* NOP */;
}
public function Evaluate(actor : CActor) : Bool{
if (attacker){
return attacker.GetTarget() == actor;

} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindAttacker(){
if (attacker){
return;
}
if (attackerTag == 'PLAYER'){
attacker = thePlayer;
} else {
attacker = theGame.GetNPCByTag(attackerTag);
}
if (attacker && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class W3QuestCond_IsTargetOf_Listener extends IGlobalEventScriptedListener{
public var condition : W3QuestCond_IsTargetOf;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.attackerTag){
condition.FindAttacker();
}
/* NOP */;
}
}
class CAIMoveToPoint extends IAIBaseAction{
public editable inlined var params : CAIMoveToPointParams;
public function Init(){
params = new CAIMoveToPointParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMoveToPointParams extends IAIActionParameters{
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var destinationPosition : Vector;
public editable var destinationHeading : Float;
public editable var maxIterationsNumber : Int32;
}
class W3QuestCond_ActorRotationToNode extends CQCActorScriptedCondition{
public editable var condition : ECompareOp;
public editable var degrees : Float;
public editable var targetTag : CName;
public var targetNode : CNode;
public var listener : W3QuestCond_ActorRotationToNode_Listener;
public function RegisterListener(flag : Bool){
if (flag){
listener = new W3QuestCond_ActorRotationToNode_Listener

in this;
listener.condition = this;
theGame.GetGlobalEventsManager().AddListenerFilterName(2
, listener, targetTag);
FindTarget();
} else {
theGame.GetGlobalEventsManager().RemoveListenerFilterNam
e(2, listener, targetTag);
delete listener;
listener = NULL;
}
/* NOP */;
}
public function OnActivate(actor : CActor) : Bool{
FindTarget();
if (!targetNode){
RegisterListener(true);
}
return true;
/* NOP */;
}
public function OnDeactivate(actor : CActor) : Bool{
if (listener){
RegisterListener(false);
}
return true;
/* NOP */;
}
public function Evaluate(act : CActor) : Bool{
var l_currentAngle : Float;
if (targetNode){
l_currentAngle = NodeToNodeAngleDistance(targetNode, act
);
l_currentAngle = AbsF(l_currentAngle);
return ProcessCompare(condition, l_currentAngle, degrees
);
} else if (!listener){
RegisterListener(true);
}
return false;
/* NOP */;
}
public function FindTarget(){
if (targetNode){
return;
}
targetNode = theGame.GetNodeByTag(targetTag);
if (targetNode && listener){
RegisterListener(false);
}
/* NOP */;
}
}
class W3QuestCond_ActorRotationToNode_Listener extends IGlobalEventScriptedListe
ner{
public var condition : W3QuestCond_ActorRotationToNode;
public function OnGlobalEventName(eventCategory : EGlobalEventCategory,
eventType : EGlobalEventType, eventParam : CName) : Bool{
if (condition && eventParam == condition.targetTag){

condition.FindTarget();
}
/* NOP */;
}
}
class CAIMoveToAction extends IAIBaseAction{
public editable inlined var params : CAIMoveToParams;
public function Init(){
params = new CAIMoveToParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMoveToParams extends IAIActionParameters{
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var targetTag : CName;
public editable var rotateAfterwards : Bool;
public editable var tolerance : Float;
}
class CAIMoveToActionAwareOfTailParams extends CAIMoveToParams{
public editable var tailTag : CName;
public editable var startMovementDistance : Float;
public editable var stopDistance : Float;
}
class CAIRiderMoveToActionParams extends IRiderActionParameters{
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var targetTag : CName;
public editable var rotateAfterwards : Bool;
public function CopyTo(moveToParams : CAIMoveToParams){
moveToParams.maxDistance = maxDistance;
moveToParams.moveSpeed = moveSpeed;
moveToParams.moveType = moveType;
moveToParams.targetTag = targetTag;
moveToParams.rotateAfterwards = rotateAfterwards;
/* NOP */;
}
}
class CAIPlayAnimationStateAction extends IAIActionTree{
public editable var eventStateName : CName;
}
class CAIPlayAnimationStateParams extends IAIActionParameters{
public editable var eventStateName : CName;
}
class CAIPlayAnimationSlotAction extends IAIActionTree{
public editable var animName : CName;
public editable var slotName : CName;
public editable var blendInTime : Float;
public editable var blendOutTime : Float;
}

abstract class IAIFormationActionTree extends IAIBaseAction{


public editable var formation : CFormation;
}
class CAIFormationFollowActionTree extends IAIFormationActionTree{
public editable var leaderTag : CName;
}
class CAIFormationLeadActionTree extends IAIFormationActionTree{
public editable var leaderSteering : CMoveSteeringBehavior;
public editable var reshapeOnMoveAction : Bool;
public editable inlined var leadSubtree : IAIActionTree;
public function Init(){
leaderSteering = LoadSteeringGraph("gameplay/behaviors/npc/forma
tion/steering_leader/leader_default.w2steer");
reshapeOnMoveAction = true;
/* NOP */;
}
}
class CAIFinishAnimationsAction extends IAIActionTree{
}
class CAIBreakAnimationsAction extends IAIActionTree{
}
class CAIPlayVoiceSetAction extends IAIActionTree{
public editable var voiceSet : String;
public editable var priority : Int32;
}
class CAIPlayVoiceSetParams extends IAIActionParameters{
public editable var voiceSet : String;
public editable var priority : Int32;
}
class CAIRotateToAction extends IAIActionTree{
public editable var targetTag : CName;
public editable var keepRotating : Bool;
}
class CAIWalkToTargetWaitParams extends IAIActionParameters{
public editable var tag : CName;
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var waitForTag : CName;
public editable var timeout : Float;
public editable var testDistance : Float;
}
class CAIActionSequenceParams extends IAIActionParameters{
public editable inlined var actions : array<IAIActionTree>;
}
class CAIActionLoop extends IAIActionTree{
public editable var loopCount : Int32;
public editable inlined var loopedAction : IAIActionTree;
}

class CAIActionPoke extends IAIActionTree{


public editable var pokeEvent : CName;
public editable inlined var pokableScriptedAction : IAIActionTree;
}
class CAIRiderActionSequence extends IRiderActionTree{
public editable inlined var actions : array<IRiderActionTree>;
}
class CAIRiderActionPoke extends IRiderActionTree{
public editable var pokeEvent : CName;
public editable inlined var pokableScriptedAction : IRiderActionTree;
}
import abstract class CCombatDataComponentParam{
}
class CAIWalkToTargetWaitingForActorAction extends IAIActionTree{
public editable var tag : CName;
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var waitForTag : CName;
public editable var timeout : Float;
public editable var testDistance : Float;
}
import abstract class IBehTreeNodeCombatTicketDecoratorBaseDefinition{
}
class CAIPlayEffectAction extends IAIActionTree{
public editable var effectName : CName;
}
import abstract class CBehTreeDecoratorDismountCheckDefinition{
}
class CAIPlayEffectParams extends IAIActionParameters{
public editable var effectName : CName;
}
import abstract class CBehTreeDecoratorCluePathDefinition{
}
class CAIExecuteAttackAction extends IAIActionTree{
public editable var attackParameter : EAttackType;
}
import abstract class CBehTreeNodeFlightIdleDynamicRootDefinition{
}
class CAIExecuteRangeAttackAction extends IAIActionTree{
public editable var attackParameter : EAttackType;
public editable var targetTag : CName;
public editable var projectileName : CName;
}
class CAIDrawTorchAction extends IAIActionTree{
}

class CAIHideTorchAction extends IAIActionTree{


}
class CAIAttachToCurve extends IAIActionTree{
public editable var animationName : CName;
public editable var curveTag : CName;
public editable var curveDummyName : String;
public editable var blendInTime : Float;
public editable var slotAnimation : CName;
}
class CAIWaitForChangingWeaponEndAction extends IAIActionTree{
}
abstract class IActionDecorator extends IAIActionTree{
public editable inlined var scriptedAction : IAIActionTree;
}
class CAIGoToExplorationActionDecorator extends IActionDecorator{
public editable var sheathWeaponsOnStart : Bool;
}
class CAIPlayAnimationUpperBodySlotAction extends IActionDecorator{
public editable var animName : CName;
public editable var interruptScriptedActionOnSlotAnimEnd : Bool;
}
class CAIHandsBehindBackOverlayActionTree extends IActionDecorator{
public editable var duration : Float;
public editable var interruptScriptedActionOnDurationEnd : Bool;
}
class CAICombatModeActionDecorator extends IActionDecorator{
public editable var drawWeaponOnStart : Bool;
public editable var LeftItemType : CName;
public editable var RightItemType : CName;
public editable var changeBehaviorGraphOnStart : Bool;
public editable var behGraph : EBehaviorGraph;
public editable var changeBahviorGraphToExplorationOnDeacitvate : Bool;
public editable var forceCombatModeOnPLAYER : Bool;
}
class CAIInterruptableByHitAction extends IActionDecorator{
public editable var shouldForceHitReaction : Bool;
public editable var hitReactionType : EHitReactionType;
public editable var hitReactionSide : EHitReactionSide;
public editable var hitReactionDirection : EHitReactionDirection;
public editable var hitSwingType : EAttackSwingType;
public editable var hitSwingDirection : EAttackSwingDirection;
}
class CAIInterruptOnHitOrOnCriticalEffect extends IActionDecorator{
public editable var completeOnHit : Bool;
public editable var completeOnCriticalEffect : Bool;
}
class CAIkLookAtActionDecorator extends IActionDecorator{
public editable var lookAtNodeTag : CName;
}

class CAIChangeBehaviorGraphDecorator extends IActionDecorator{


public editable var graphWhenActivate : CName;
public editable var graphWhenDeactivate : CName;
}
class CAIScaredActionDecorator extends IActionDecorator{
}
abstract class IPlayerActionDecorator extends IAIActionTree{
public editable inlined var scriptedAction : CAITree;
}
abstract class IPlayerRiderActionDecorator extends IAIActionTree{
public editable inlined var scriptedAction : IRiderActionTree;
}
class CAIPlayerRiderActionDecorator extends IPlayerRiderActionDecorator{
public editable var interruptOnInput : Bool;
}
class CAIAnimalDefaults extends CAIDefaults{
public editable inlined var combatTree : CAIAnimalCombat;
public editable inlined var idleTree : CAIIdleTree;
public editable inlined var idleDecoratorTree : CAIMonsterIdleDecorator;
public editable inlined var charmedTree : CAIAnimalCharmed;
public editable inlined var deathTree : CAIAnimalDeath;
public editable var isAnimal : Bool;
public function Init(){
var moveOut : CAIActionMoveOut;
combatTree = new CAIAnimalCombat in this;
combatTree.OnCreated();
idleDecoratorTree = new CAIMonsterIdleDecorator in this;
idleDecoratorTree.OnCreated();
charmedTree = new CAIAnimalCharmed in this;
charmedTree.OnCreated();
deathTree = new CAIAnimalDeath in this;
deathTree.OnCreated();
moveOut = new CAIActionMoveOut in this;
moveOut.OnCreated();
idleDecoratorTree.params.reactionTree.params.reactions.PushBack(
moveOut);
/* NOP */;
}
}
class CAIAnimalCombat extends CAICombatTree{
public editable var chanceOfBeingScared : Float;
public editable var chanceOfBeingScaredRerollTime : Float;
public editable var scaredIfTargetRuns : Bool;
public editable var maxTolerableTargetDistance : Float;
public editable var maxFleeRunDistance : Float;
public editable var maxFleeWalkDistance : Float;
public editable var stopFleeingDistance : Float;
public editable var fleeInGroup : Bool;
public editable var neutralIsDanger : Bool;
}
class CAIMonsterIdleDecorator extends CAIIdleDecoratorTree{
public editable inlined var params : CAIMonsterIdleDecoratorParams;

public function Init(){


params = new CAIMonsterIdleDecoratorParams in this;
params.OnCreated();
params.reactionTree = new CAIMonsterReactionsTree in this;
params.reactionTree.OnCreated();
/* NOP */;
}
}
class CAIAnimalCharmed extends CAIIdleTree{
public editable var charmedGotoDistance : Float;
}
class CAIAnimalDeath extends CAINpcDeath{
public function Init(){
params = new CAIAnimalDeathParams in this;
params.OnCreated();
/* NOP */;
}
}
abstract class CAICombatTree extends CAIMainTree{
}
abstract class CAIDeathTree extends CAIMainTree{
}
class CAIRaceHorseDefaults extends CAIHorseDefaults{
public function Init(){
super.Init();
idleDecoratorTree.params.reactionTree.params.reactions.Clear();
/* NOP */;
}
}
class CAINpcDeathParams
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
public editable
}

extends CAIDeathParameters{
var createReactionEvent : CName;
var fxName : CName;
var playFXOnActivate : CName;
var playFXOnDeactivate : CName;
var stopFXOnActivate : CName;
var stopFXOnDeactivate : CName;
var setAppearanceTo : CName;
var changeAppearanceAfter : Float;
var disableAgony : Bool;
var disableCollision : Bool;
var disableCollisionDelay : Float;
var disableCollisionOnAnim : Bool;
var disableCollisionOnAnimDelay : Float;
var destroyAfterAnimDelay : Float;
var spawnEntityAtDeath : Bool;
var entityToSpawn : CName;

class CAIAnimalCombatFlee extends CAICombatTree{


}
class CAIAnimalCombatCurious extends CAICombatTree{
}

class CAIHorseShakeRider extends CAICombatTree{


}
class CAIAnimalQuestCombatParams extends CAICombatParameters{
}
abstract class CAICombatParameters extends CAIMainParameters{
}
class CAIAnimalQuestScaredBehaviour extends CAICombatQuestTree{
}
abstract class CAICombatQuestTree extends CAIMainTree{
}
class CAnimalIdleDecoratorTree extends CAIMainTree{
public function Init(){
}
}
abstract class CAIMainTree extends CAITree{
}
class CAIIdleDecoratorTree extends CAISubTree{
}
abstract class CAIAxiiTree extends CAIMainTree{
}
abstract class CAITauntTree extends CAIMainTree{
}
import abstract class CR4LootParam{
}
abstract class CAICombatDecoratorTree extends CAIMainTree{
}
abstract class CAICustomMainTree extends CAIMainTree{
}
abstract class CAIReactionTree extends CAIMainTree{
}
abstract class CAISoftReactionTree extends CAIMainTree{
}
abstract class CAIFleeTree extends CAISubTree{
}
abstract class CAIActionTree extends CAISubTree{
}
abstract class CAICombatActionTree extends CAIActionTree{
}
abstract class CAIRidingSubTree extends CAISubTree{
}
class CAIRetreatTree extends CAISubTree{

}
class CAIKeepDistanceTree extends CAISubTree{
public editable var moveType : EMoveType;
}
class CAIRunToGAKnockdown extends CAIKeepDistanceTree{
}
abstract class CAIMainParameters extends CAIParameters{
}
abstract class CAICombatDecoratorParameters extends CAIMainParameters{
}
abstract class CAIDeathParameters extends CAIMainParameters{
}
abstract class CAIReactionsParameters extends CAIMainParameters{
}
abstract class CAISoftReactionsParameters extends CAIMainParameters{
}
abstract class CAICustomMainParameters extends CAIMainParameters{
}
abstract class CAIActionTreeParameters extends CAISubTreeParameters{
}
abstract class CAICombatActionParameters extends CAIActionTreeParameters{
}
abstract class CAIWanderParameters extends CAIIdleParameters{
}
abstract class CAIRidingSubTreeParameters extends CAISubTreeParameters{
}
abstract class CAIFleeParameters extends CAISubTreeParameters{
}
abstract class CAIRiderIdle extends CAINpcIdle{
public function Init(){
params = new CAIRiderIdleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINPCGroupTypeRedefinition extends CAIRedefinitionParameters{
public editable var npcGroupType : ENPCGroupType;
}
class CAICarryMiscreantActionTree extends IAICustomActionTree{
public editable var attachmentBone : CName;
public editable var miscreantName : CName;
public editable var behaviorGraph : CName;
public editable var cryStartEventName : CName;
public editable var cryStopEventName : CName;

public editable inlined var carrySubAction : IAIActionTree;


}
class CAIMiscreantAttachActionTree extends IAICustomActionTree{
public var attachmentBone : CName;
public var miscreantName : CName;
public var behaviorGraph : CName;
}
class CAIMiscreantCryActionTree extends IAICustomActionTree{
public var miscreantName : CName;
}
class CAISorceressAttacksBoidActionTree extends IAICustomActionTree{
public editable var animName : CName;
}
class CAISorceressMagicBubbleActionTree extends IAICustomActionTree{
public editable var magicBubbleResourceName : CName;
public editable var deactivate : Bool;
public editable var playAnim : Bool;
}
class CAISorceressFireballCastActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
}
class CAISorceressLightningCastActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
}
class CAISorceressTeleportActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
}
class CAISwarmTeleportAttackActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
}
class CAIFrostAttackActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
public editable var duration : Float;
public editable var clampDurationWhenTargetReached : Float;
}
class CAIForceJumpAttackActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
}
class CAIGryphonCrashActionTree extends IAICustomActionTree{
}
class CAIShootActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
public editable inlined var multipleTargetsTags : W3BehTreeValNameArray;
public editable var numberOfActions : Int32;
public editable var setProjectileOnFire : Bool;
public editable var afterActionIdleDuration : Float;
public editable var afterActionIdleDurationChance : Float;
public editable var useRayCastBeforeShooting : Bool;

public function Init(){


super.Init();
multipleTargetsTags = new W3BehTreeValNameArray in this;
/* NOP */;
}
}
class CAILambertTrainingActionTree extends IAICustomActionTree{
public editable var holdPositionTag : CName;
public editable var maxDistanceToHoldGroundPosition : Float;
public function Init(){
super.Init();
maxDistanceToHoldGroundPosition = 2;
/* NOP */;
}
}
class CAICiriSnowballFightActionTree extends IAICustomActionTree{
public editable var minDistFromTargetToPerformTeleport : Float;
public editable var delayBetweenThrows : Float;
public editable var teleportPointTag : CName;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIMageBossFightActionTree extends IAICustomActionTree{
public editable var minDistFromTargetToPerformTeleport : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIWitcherCastOffensiveSignActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
public editable var castIgniInsteadOfAard : Bool;
}
class CAIKickActionTree extends IAICustomActionTree{
public editable var targetTag : CName;
public editable var distanceToForceStopAciton : Float;
}
abstract class IAIDoorExplorationTree extends IAIExplorationTree{
}
class CAIDoorMoveExplorationTree extends IAIDoorExplorationTree{
}
class CAIUseExplorationActionTree extends IAIExplorationTree{
public editable var explorationType : EExplorationType;
public editable var skipTeleportation : Bool;
}
class CAIRunExplorationActionTreeParams extends IAIActionParameters{
public editable var explorationType : EExplorationType;
public editable var entityTag : CName;
}

abstract class IFlightActionTree extends IAIActionTree{


}
class CFlyToActionTree extends IFlightActionTree{
public editable var acceptDistance : Float;
public editable var targetTag : CName;
public editable var rotateBeforeTakeOff : Bool;
public editable var landAtTargetLocation : Bool;
public editable var landingForwardOffset : Float;
}
class CAIFlyOnCurve extends
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
}

IFlightActionTree{
animationName : CName;
curveTag : CName;
curveDummyName : String;
blendInTime : Float;
slotAnimation : CName;
animValPitch : String;
animValYaw : String;
maxPitchInput : Float;
maxPitchOutput : Float;
maxYawInput : Float;
maxYawOutput : Float;

class CAIFlyFindLandingSpotTree extends IFlightActionTree{


public editable inlined var landingAnimations : array<CAIFlyLandTree>;
}
class CAIFlyLandTree extends IFlightActionTree{
}
class CAIFlyInterruptableAction extends IFlightActionTree{
public editable inlined var interruptableAction : CAISubTree;
}
abstract class IAIFlightIdleTree extends CAIMainTree{
}
class CAIFlightIdleAroundTargets extends IAIFlightIdleTree{
public editable var flightTargetTag : CName;
public editable var flightAroundClosest : Bool;
public editable var flightAroundReselect : Bool;
public editable var flyAroundReselectDurationMin : Float;
public editable var flyAroundReselectDurationMax : Float;
public editable var idleFlightRadiusMin : Float;
public editable var idleFlightRadiusMax : Float;
public editable var idleFlightHeightMin : Float;
public editable var idleFlightHeightMax : Float;
}
class CAICombatSoftReactionsTree extends CAISoftReactionTree{
}
class CAICommonerSoftReactionsTree extends CAISoftReactionTree{
}
class CAIGuardSoftReactionsTree extends CAISoftReactionTree{
}

class CAIQuestSoftReactionsTree extends CAISoftReactionTree{


}
class CAIMainQuestSoftReactionsTree extends CAISoftReactionTree{
}
class CAIChildSoftReactionsTree extends CAISoftReactionTree{
}
class CAINpcReactionsTree extends CAIReactionTree{
public editable inlined var reactions : array<CAINpcActionSubtree>;
protected function OverriderReactionsPriority(priority : Int32, priority
WhileActive : Int32){
var i : Int32;
i = 0;
while (i < reactions.Size()){
reactions[i].reactionPriority = priority;
if (priorityWhileActive > 0){
reactions[i].changePriorityWhileActive = true;
reactions[i].reactionPriorityWhileActive = prior
ityWhileActive;
}
i += 1;
}
/* NOP */;
}
}
abstract class
public
public
public
public
public
public
public
public
public
public
public
public
public
}

CAINpcActionSubtree extends CAISubTree{


editable inlined var reactionLogicTree : CAINpcReaction;
editable var reactionPriority : Int32;
editable var actionEventName : CName;
editable var actionCooldownDistance : Float;
editable var actionCooldownTimeout : Float;
editable var actionFailedCooldown : Float;
editable var dontSetActionTarget : Bool;
editable var changePriorityWhileActive : Bool;
editable var reactionPriorityWhileActive : Int32;
editable var disallowOutsideOfGuardArea : Bool;
editable var forwardAvailabilityToReactionTree : Bool;
editable var disableTalkInteraction : Bool;
editable var disallowWhileOnHorse : Bool;

class CAINpcReaction extends CAISubTree{


public editable var voiceSet : String;
}
class CAIActionBeingHit extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionGetScared in this;
reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)reactionLogicTree.SetParams(10.000000,
false, /* NOP */);
reactionPriority = 60;
actionEventName = 'BeingHitAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0;
disallowWhileOnHorse = false;

/* NOP */;
}
}
class CAIActionBumpTree extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionBump in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "bump";
reactionPriority = 60;
actionEventName = 'BumpAction';
actionCooldownDistance = 1;
actionCooldownTimeout = 1;
dontSetActionTarget = true;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 51;
forwardAvailabilityToReactionTree = true;
/* NOP */;
}
}
class CAIActionCombatNearby extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionObserveFight in this;
reactionLogicTree.OnCreated();
reactionPriority = 55;
actionEventName = 'CombatNearbyAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 54;
/* NOP */;
}
}
class CAIActionDrawSword extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionStopAndComment in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "afraid";
reactionPriority = 24;
actionEventName = 'DrawSwordAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 23;
/* NOP */;
}
}
class W3CiriPhantom extends CGameplayEntity{
private var owner : CActor;
private var target : CActor;
private var rotationDamper : EulerAnglesSpringDamper;
public function Init(setOwner : CActor, setTarget : CActor){
owner = setOwner;
target = setTarget;
InitDamper();

AddTimer('Rotate', 0, true, /* NOP */, /* NOP */, /* NOP */, /*


NOP */);
AddAnimEventCallback('AllowBlend', 'OnAnimEvent_AllowBlend');
AddAnimEventCallback('fx_trail', 'OnAnimEvent_fx_trail');
/* NOP */;
}
private function InitDamper(){
rotationDamper = new EulerAnglesSpringDamper in this;
rotationDamper.Init(GetWorldRotation(), GetWorldRotation());
rotationDamper.SetSmoothTime(0.100000);
/* NOP */;
}
private timer function Rotate(optional dt : Float, optional id : Int32){
RotateToTarget(dt);
/* NOP */;
}
private timer function SlowMoStart(optional dt : Float, optional id : In
t32){
theGame.SetTimeScale(0.100000, 'CiriPhantom', 500, true, true);
AddTimer('SlowMoEnd', 0.050000, /* NOP */, /* NOP */, /* NOP */,
/* NOP */, /* NOP */);
/* NOP */;
}
private timer function SlowMoEnd(optional dt : Float, optional id : Int3
2){
theGame.RemoveTimeScale('CiriPhantom');
/* NOP */;
}
private function RotateToTarget(dt : Float){
var rot : EulerAngles;
var targetPos : Vector;
var headingVec : Vector;
var thisPos : Vector;
var velocity : Vector;
velocity = target.GetMovingAgentComponent().GetVelocity();
velocity.Z = 0;
targetPos = target.GetWorldPosition() + velocity * 0.500000;
thisPos = GetWorldPosition();
headingVec = targetPos - thisPos;
rot = VecToRotation(headingVec);
rot = rotationDamper.UpdateAndGet(dt, rot);
TeleportWithRotation(thisPos, rot);
/* NOP */;
}
public function OnPreAttackEvent(animEventName : CName, animEventType :
EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimI
nfo) : Bool{
var parriedBy : array<CActor>;
var hitTargets : array<CActor>;
var weaponId : SItemUniqueId;
var inventory : CInventoryComponent;
var weaponEntity : CItemEntity;
if (animEventType == 1){
owner.SetAttackData(data);
} else if (animEventType == 3){
inventory = owner.GetInventory();
weaponId = inventory.GetItemFromSlot(data.weaponSlot);
if (!inventory.IsIdValid(weaponId) || data.attackName ==
'None'){
LogAttackEvents("No valid attack data set - skip

ping hit!");
LogAssert(false, "No valid attack data set - ski
pping hit!");
return false;
}
data.canBeDodged = false;
data.attackName = 'attack_heavy';
Attack(target, data, weaponId, parriedBy, GetAnimNameFro
mEventAnimInfo(animInfo), GetLocalAnimTimeFromEventAnimInfo(animInfo), weaponEnt
ity);
}
/* NOP */;
}
protected function Attack(hitTarget : CGameplayEntity, animData : CPreAt
tackEventData, weaponId : SItemUniqueId, parriedBy : array<CActor>, attackAnimat
ionName : CName, hitTime : Float, weaponEntity : CItemEntity){
var action : W3Action_Attack;
var tags : array<CName>;
if (PrepareAttackAction(hitTarget, animData, weaponId, parriedBy
, attackAnimationName, hitTime, weaponEntity, action)){
theGame.damageMgr.ProcessAction(action);
delete action;
}
AddHitFacts(hitTarget.GetTags(), tags, "_phantom_hit", false, /*
NOP */);
AddTimer('SlowMoStart', 0.100000, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */, /* NOP */);
RemoveTimer('Rotate', /* NOP */);
/* NOP */;
}
protected function PrepareAttackAction(hitTarget : CGameplayEntity, anim
Data : CPreAttackEventData, weaponId : SItemUniqueId, parriedBy : array<CActor>,
attackAnimationName : CName, hitTime : Float, weaponEntity : CItemEntity, attac
kAction : W3Action_Attack) : Bool{
var actor : CActor;
if (!hitTarget){
return false;
}
attackAction = new W3Action_Attack in theGame.damageMgr;
attackAction.Init(owner, hitTarget, this, weaponId, animData.att
ackName, GetName(), 2, false, false, animData.attackName, animData.swingType, an
imData.swingDir, true, false, false, false, animData.hitFX, animData.hitBackFX,
animData.hitParriedFX, animData.hitBackParriedFX, /* NOP */);
attackAction.SetAttackAnimName(attackAnimationName);
attackAction.SetHitTime(hitTime);
attackAction.SetWeaponEntity(weaponEntity);
attackAction.SetSoundAttackType(animData.soundAttackType);
actor = (CActor)hitTarget;
if (actor && parriedBy.Contains(actor)){
attackAction.SetIsParried(true);
}
return true;
/* NOP */;
}
public function OnAnimEvent_AllowBlend(animEventName : CName, animEventT
ype : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventType == 1){
SmartSetVisible(false);
}
/* NOP */;

}
public function OnAnimEvent_fx_trail(animEventName : CName, animEventTyp
e : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
PlayEffectOnHeldWeapon('light_trail_fx');
/* NOP */;
}
public function PlayEffectOnHeldWeapon(effectName : CName) : Bool{
var itemId : SItemUniqueId;
var inv : CInventoryComponent;
inv = GetInventory();
itemId = inv.GetItemFromSlot('steel_sword_back_slot');
if (!inv.IsIdValid(itemId)){
itemId = inv.GetItemFromSlot('r_weapon');
if (!inv.IsIdValid(itemId)){
return false;
}
}
inv.PlayItemEffect(itemId, effectName);
return true;
/* NOP */;
}
private function SmartSetVisible(toggle : Bool){
SetHideInGame(!toggle);
/* NOP */;
}
}
class CAIActionAttack extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionTaunt in this;
reactionLogicTree.OnCreated();
reactionPriority = 55;
actionEventName = 'AttackAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 54;
/* NOP */;
}
}
class CAIActionCastSign extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionTaunt in this;
reactionLogicTree.OnCreated();
reactionPriority = 55;
actionEventName = 'CastSignAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 54;
/* NOP */;
}
}
class CAIActionCrossbowShot extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionStopAndComment in this;

reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "afraid";
reactionPriority = 24;
actionEventName = 'CrossbowShotAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 23;
/* NOP */;
}
}
class CAIActionBombExplosion extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionGetScared in this;
reactionLogicTree.OnCreated();
(CAINpcReactionGetScared)reactionLogicTree.SetParams(7.000000, f
alse, /* NOP */);
reactionPriority = 56;
actionEventName = 'BombExplosionAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0;
/* NOP */;
}
}
class CAIActionLooting extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionGuardWarnGeneral in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "afraid";
(CAINpcReactionGuardWarnGeneral)reactionLogicTree.SetParams(true
);
reactionPriority = 50;
actionEventName = 'LootingAction';
actionCooldownDistance = 0.500000;
actionFailedCooldown = 2.000000;
actionCooldownTimeout = 0.100000;
/* NOP */;
}
}
class CAIActionTaunt extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionTaunt in this;
reactionLogicTree.OnCreated();
reactionPriority = 55;
actionEventName = 'TauntAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0.500000;
actionFailedCooldown = 2.000000;
dontSetActionTarget = false;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 54;
/* NOP */;
}
}
class CAIActionRain extends CAINpcActionSubtree{

public function Init(){


reactionLogicTree = new CAINpcReactionRain in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "rain";
reactionPriority = 45;
actionEventName = 'RainReactionEvent';
actionCooldownDistance = 0;
actionCooldownTimeout = 20;
actionFailedCooldown = 300;
disableTalkInteraction = false;
forwardAvailabilityToReactionTree = true;
/* NOP */;
}
}
class CAIActionJump extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionSurprise in this;
reactionLogicTree.OnCreated();
reactionLogicTree.voiceSet = "afraid";
reactionPriority = 24;
actionEventName = 'PlayerJumpAction';
actionCooldownDistance = 0;
actionCooldownTimeout = 0;
changePriorityWhileActive = true;
reactionPriorityWhileActive = 23;
forwardAvailabilityToReactionTree = true;
/* NOP */;
}
}
class CAIActionCombatStarted extends CAINpcActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionSurprise in this;
reactionLogicTree.OnCreated();
(CAINpcReactionSurprise)reactionLogicTree.SetParams(true);
reactionPriority = 45;
actionEventName = 'CombatStarted';
actionCooldownDistance = 0.500000;
actionFailedCooldown = 2.000000;
actionCooldownTimeout = 0.100000;
forwardAvailabilityToReactionTree = true;
/* NOP */;
}
}
class CAIActionGossip extends CAINpcActionSubtree{
public editable var inInWorkBranch : Bool;
public function Init(){
reactionPriority = 21;
actionEventName = 'GossipAction';
actionCooldownDistance = 100;
actionCooldownTimeout = 60;
disableTalkInteraction = false;
/* NOP */;
}
}
class CAIActionQuestion extends CAINpcActionSubtree{
public editable var inInWorkBranch : Bool;

public function Init(){


reactionPriority = 21;
actionEventName = 'QuestionAction';
actionCooldownDistance = 100;
actionCooldownTimeout = 60;
disableTalkInteraction = false;
/* NOP */;
}
}
class CAIActionGreeting extends CAINpcActionSubtree{
public editable var inInWorkBranch : Bool;
public function Init(){
reactionPriority = 21;
actionEventName = 'GreetingAction';
actionCooldownDistance = 100;
actionCooldownTimeout = 60;
disableTalkInteraction = false;
/* NOP */;
}
}
class EulerAnglesSpringDamper extends CObject{
protected var destValue : EulerAngles;
protected var currValue : EulerAngles;
protected var velValue : EulerAngles;
protected var smoothTime : Float;
public final function SetSmoothTime(value : Float){
smoothTime = value;
/* NOP */;
}
public final function Init(curr : EulerAngles, dest : EulerAngles){
currValue = curr;
destValue = dest;
velValue = EulerAngles(0.000000, 0.000000, 0.000000);
/* NOP */;
}
public final function Reset(){
destValue = EulerAngles(0.000000, 0.000000, 0.000000);
currValue = EulerAngles(0.000000, 0.000000, 0.000000);
velValue = EulerAngles(0.000000, 0.000000, 0.000000);
/* NOP */;
}
public final function SetValue(value : EulerAngles){
destValue = value;
/* NOP */;
}
public final function GetValue() : EulerAngles{
return currValue;
/* NOP */;
}
public final function GetDestValue() : EulerAngles{
return destValue;
/* NOP */;
}
public final function Update(dt : Float){
var omega : Float;
var x : Float;
var exp : Float;
var diff : EulerAngles;

var temp : EulerAngles;


if (smoothTime > 0.000000){
omega = 2.000000 / smoothTime;
x = omega * dt;
exp = 1.000000 / 1.000000 + x + 0.480000 * x * x + 0.235
000 * x * x * x;
diff = EulerAngles(AngleDistance(currValue.Pitch, destVa
lue.Pitch), AngleDistance(currValue.Yaw, destValue.Yaw), AngleDistance(currValue
.Roll, destValue.Roll));
temp = EulerMult(EulerAdd(velValue, EulerMult(diff, omeg
a)), dt);
velValue = EulerMult(EulerNeg(velValue, EulerMult(temp,
omega)), exp);
currValue = EulerAdd(destValue, EulerMult(EulerAdd(diff,
temp), exp));
} else if (dt > 0.000000){
velValue = EulerMult(EulerAngles(AngleDistance(destValue
.Pitch, currValue.Pitch), AngleDistance(destValue.Yaw, currValue.Yaw), AngleDist
ance(destValue.Roll, currValue.Roll)), 1.000000 / dt);
currValue = destValue;
}
/* NOP */;
}
public final function UpdateAndGet(dt : Float, value : EulerAngles) : Eu
lerAngles{
SetValue(value);
Update(dt);
return GetValue();
/* NOP */;
}
public function UpdateManual(current : EulerAngles, velocity : EulerAngl
es, dest : EulerAngles, dt : Float){
currValue = current;
velValue = velocity;
destValue = dest;
super.Update(dt);
current = currValue;
velocity = velValue;
/* NOP */;
}
}
class CAIActionBarter extends CAINpcActionSubtree{
public editable var inInWorkBranch : Bool;
public function Init(){
reactionPriority = 21;
actionEventName = 'BarterAction';
actionCooldownDistance = 100;
actionCooldownTimeout = 60;
disableTalkInteraction = false;
/* NOP */;
}
}
class CAIQuestActionPlayerPresence extends CAIActionPlayerPresence{
public function Init(){
super.Init();
(CAINpcReactionStopAndComment)reactionLogicTree.SetParams(100, 1);
actionCooldownTimeout = 0;

/* NOP */;
}
}
class CAINpcReactionGuardWarnSword extends CAINpcReaction{
}
abstract class CAIScaredSubTree extends CAISubTree{
}
class CAIRunOnlyScaredTree extends CAIScaredSubTree{
}
abstract class CAIMonsterIdleAction extends IAIActionTree{
public editable inlined var params : CAIMonsterIdleActionParams;
public function Init(){
params = new CAIMonsterIdleActionParams in this;
params.Init();
/* NOP */;
}
}
class CAIMonsterIdleActionParams extends CAISubTreeParameters{
public editable var cooldown : Float;
public editable var loopTime : Float;
public editable var actionName : CName;
public editable var onlyOnGround : Bool;
}
class CAIMonsterFlyIdleActionParams extends CAIMonsterIdleActionParams{
public editable var minDistanceFromGround : Float;
}
class CAIMonsterIdleEat extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 20.000000;
params.loopTime = 10.000000;
params.actionName = 'Eat';
/* NOP */;
}
}
class CAIMonsterIdleDig extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.loopTime = 10.000000;
params.actionName = 'Dig';
/* NOP */;
}
}
class CAIMonsterIdleClean extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.loopTime = 5.000000;
params.actionName = 'Clean';
/* NOP */;
}
}

class CAIMonsterIdleOnGroundAndClean extends CAIMonsterIdleAction{


public function Init(){
super.Init();
params.cooldown = 100.000000;
params.loopTime = 30.000000;
params.actionName = 'OnGroundAndClean';
/* NOP */;
}
}
class CAIMonsterIdleSit extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 60.000000;
params.loopTime = 30.000000;
params.actionName = 'Sit';
/* NOP */;
}
}
class CAIMonsterIdleLie extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 60.000000;
params.loopTime = 30.000000;
params.actionName = 'Lie';
/* NOP */;
}
}
class CAIMonsterIdleOnGround extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 60.000000;
params.loopTime = 30.000000;
params.actionName = 'OnGround';
/* NOP */;
}
}
class CAIMonsterIdleHowl extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 60.000000;
params.loopTime = 5.000000;
/* NOP */;
}
}
import struct CR4LootManager{
import public final function SetCurrentArea(areaName : String);
import public final function GetCurrentArea() : String;
public function OnAreaChanged(newArea : EAreaName){
super.SetCurrentArea(AreaTypeToName(newArea));
LogRandomLoot("CR4LootManager.OnAreaChanged: active area is now
<<" + super.GetCurrentArea() + ">>");
/* NOP */;
}
}

class CAIMonsterIdleSleep extends


public function Init(){
super.Init();
params.cooldown =
params.loopTime =
params.actionName
/* NOP */;
}
}

CAIMonsterIdleAction{
200.000000;
100.000000;
= 'Sleep';

class CAIMonsterIdleRoll extends CAIMonsterIdleAction{


public function Init(){
super.Init();
params.actionName = 'Roll';
/* NOP */;
}
}
class CAIMonsterIdleStretch extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Stretch';
/* NOP */;
}
}
class CAIMonsterIdleCough extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Cough';
/* NOP */;
}
}
class CAIMonsterIdleStrikeFists extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'StrikeFists';
/* NOP */;
}
}
class CAIMonsterIdleGrowl extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Growl';
/* NOP */;
}
}
class CAIMonsterIdleWings extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Wings';
/* NOP */;
}
}
class CAIMonsterIdleLookAround extends CAIMonsterIdleAction{

public function Init(){


super.Init();
params.cooldown = 0;
params.actionName = 'LookAround';
/* NOP */;
}
}
class CAIMonsterIdleYawn extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Yawn';
/* NOP */;
}
}
class CAIMonsterIdleSniff extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.actionName = 'Sniff';
/* NOP */;
}
}
class CAIMonsterIdleFlyBarrel extends CAIMonsterFlyIdleAction{
public function Init(){
super.Init();
params.actionName = 'FlyBarrel';
/* NOP */;
}
}
class CAIMonsterIdleFlyAirDive extends CAIMonsterFlyIdleAction{
public function Init(){
var flyingParams : CAIMonsterFlyIdleActionParams;
super.Init();
params.actionName = 'FlyAirDive';
flyingParams = (CAIMonsterFlyIdleActionParams)params;
flyingParams.minDistanceFromGround = 13;
/* NOP */;
}
}
class CAIMonsterIdlePlayAround extends CAIMonsterIdleAction{
public function Init(){
super.Init();
params.cooldown = 10.000000;
/* NOP */;
}
}
class CAIAnimalRunWild extends CAIDynamicWander{
public editable var packRegroupEvent : CName;
public editable var leaderRegroupEvent : CName;
}
class CAIMonsterIdle extends CAIIdleTree{
public editable inlined var params : CAIMonsterIdleParams;
}

class CAIMonsterIdleParams extends CAIIdleParameters{


}
class CAIMonsterSearchFoodTree extends CAISubTree{
public editable inlined var params : CAIMonsterSearchFoodIdleParams;
public function Init(){
super.Init();
params = new CAIMonsterSearchFoodIdleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterSearchFoodIdleParams extends CAISubTreeParameters{
public editable var loopTime : Float;
public editable var corpse : Bool;
public editable var meat : Bool;
public editable var vegetable : Bool;
public editable var water : Bool;
public editable var monster : Bool;
public editable var landHeight : Float;
public editable var flyHeight : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIMonsterIdleDecoratorParams extends CAIIdleParameters{
public editable inlined var reactionTree : CAIMonsterReactionsTree;
public editable inlined var searchFoodTree : CAIMonsterSearchFoodTree;
public editable inlined var actions : array<CAIMonsterIdleAction>;
public editable inlined var nightActions : array<CAIMonsterIdleAction>;
public editable var actionCooldown : Float;
public editable var chanceToHuntAtNight : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIMonsterReactionsTree extends CAIReactionTree{
public editable inlined var params : CAIMonsterReactionsTreeParams;
public function Init(){
var searchForTarget : CAIActionSearchForTarget;
var joinSearch : CAIActionAllySearchesTarget;
var playAround : CAIActionPlayWithTarget;
var moveInPack : CAIActionMoveInPack;
var runWildInPack : CAIActionRunWildInPack;
searchForTarget = new CAIActionSearchForTarget in this;
joinSearch = new CAIActionAllySearchesTarget in this;
playAround = new CAIActionPlayWithTarget in this;
moveInPack = new CAIActionMoveInPack in this;
runWildInPack = new CAIActionRunWildInPack in this;
params = new CAIMonsterReactionsTreeParams in this;
params.Init();
searchForTarget.OnCreated();
joinSearch.OnCreated();
playAround.OnCreated();
moveInPack.OnCreated();

runWildInPack.OnCreated();
params.reactions.PushBack(searchForTarget);
params.reactions.PushBack(joinSearch);
params.reactions.PushBack(playAround);
params.reactions.PushBack(moveInPack);
params.reactions.PushBack(runWildInPack);
/* NOP */;
}
}
abstract class W3SignProjectile extends CProjectileTrajectory{
public editable var projData : SSignProjectile;
protected var owner : W3SignOwner;
protected var action : W3DamageAction;
protected var signSkill : ESkill;
protected var wantedTarget : CGameplayEntity;
protected var signEntity : W3SignEntity;
protected var hitEntities : array<CGameplayEntity>;
protected var attackRange : CAIAttackRange;
protected var isReusable : Bool;
public function ExtInit(signOwner : W3SignOwner, sign : ESkill, signEnt
: W3SignEntity, reusable : Bool){
Init(signOwner.GetActor());
owner = signOwner;
signEntity = signEnt;
signSkill = sign;
isReusable = reusable;
/* NOP */;
}
public function ShootTarget(target : CNode, distance : Float, hitOnlyTar
get : Bool, collisionGroups : array<CName>){
var targetPos : Vector;
targetPos = target.GetWorldPosition();
targetPos.Z += 1;
if (hitOnlyTarget){
wantedTarget = (CGameplayEntity)target;
}
PlayEffect(projData.flyEffect, /* NOP */);
ShootProjectileAtPosition(0.000000, 55, targetPos, distance, col
lisionGroups);
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var victim : CGameplayEntity;
var collisionNames : array<CName>;
if (collidingComponent){
victim = (CGameplayEntity)collidingComponent.GetEntity()
;
} else {
victim = NULL;
}
if (signSkill != 38 && !victim || !victim.IsAlive()){
return false;
}
if (wantedTarget && wantedTarget != victim){
return false;
}
collisionNames.PushBack('Terrain');

collisionNames.PushBack('Static');
collisionNames.PushBack('Dynamic');
collisionNames.PushBack('Door');
collisionNames.PushBack('Destructible');
if (IsBehindWall(collidingComponent, collisionNames)){
return false;
}
if ((CActor)victim && ShouldCheckAttitude()){
if (!IsRequiredAttitudeBetween(victim, caster, true, tru
e, /* NOP */)){
return false;
}
}
/* NOP */;
ProcessCollision(victim, pos, normal);
delete action;
if (projData.hitEffect != projData.flyEffect){
StopEffect(projData.flyEffect);
PlayEffect(projData.hitEffect, /* NOP */);
}
DestroyAfter(projData.lastingTime);
/* NOP */;
}
public function SetAttackRange(ar : CAIAttackRange){
attackRange = ar;
/* NOP */;
}
public function GetSignEntity() : W3SignEntity{
return signEntity;
/* NOP */;
}
protected function ShouldCheckAttitude() : Bool{
return true;
/* NOP */;
}
public function ProcessAttackRange(){
var i : Int32;
var size : Int32;
var entities : array<CGameplayEntity>;
var e : CGameplayEntity;
var pos : Vector;
var entPos : Vector;
if (!attackRange){
return;
}
attackRange.GatherEntities(signEntity, entities);
entities.Remove(owner.GetActor());
size = entities.Size();
pos = GetWorldPosition();
i = 0;
while (i < size){
e = entities[i];
if (hitEntities.Contains(e)){
} else if ((CActor)e){
if (!IsRequiredAttitudeBetween(e, caster, true,
true, /* NOP */)){
}
} else if ((W3SignProjectile)e || (W3IgniEntity)e){
} else if ((W3AardProjectile)this && (W3Boat)e){
} else {

entPos = e.GetWorldPosition();
ProcessCollision(e, entPos, entPos - pos);
}
i += 1;
}
/* NOP */;
}
public function OnAttackRangeHit(entity : CGameplayEntity) : Bool{
}
public function OnRangeReached() : Bool{
ProcessAttackRange();
StopAllEffects();
StopProjectile();
hitEntities.Clear();
if (!isReusable){
Destroy();
}
/* NOP */;
}
protected function ProcessCollision(collider : CGameplayEntity, pos : Ve
ctor, normal : Vector){
var gameplayEnt : CGameplayEntity;
gameplayEnt = (CGameplayEntity)caster;
if (gameplayEnt){
action = new W3DamageAction in theGame.damageMgr;
action.Initialize(gameplayEnt, collider, this, caster.Ge
tName() + "_sign", 1, 1, false, false, true, false, /* NOP */, /* NOP */, /* NOP
*/, /* NOP */);
signEntity.InitSignDataForDamageAction(action);
action.hitLocation = pos;
action.SetHitEffect(projData.targetHitEffect, /* NOP */,
/* NOP */);
action.SetHitEffect(projData.targetHitEffect, true, /* N
OP */);
action.SetHitEffect(projData.targetHitEffect, false, tru
e);
action.SetHitEffect(projData.targetHitEffect, true, true
);
} else if (collider){
collider.PlayEffect(projData.targetHitEffect, /* NOP */)
;
}
/* NOP */;
}
public function ClearHitEntities(){
hitEntities.Clear();
/* NOP */;
}
public function GetSignSkill() : ESkill{
return signSkill;
/* NOP */;
}
public function GetCaster() : CEntity{
return caster;
/* NOP */;
}
}
class W3AardProjectile extends W3SignProjectile{
protected function ProcessCollision(collider : CGameplayEntity, pos : Ve

ctor, normal : Vector){


var dmgVal : Float;
var sp : SAbilityAttributeValue;
if (hitEntities.FindFirst(collider) != -1){
return;
}
hitEntities.PushBack(collider);
super.ProcessCollision(collider, pos, normal);
action.SetHitAnimationPlayType(2);
action.SetProcessBuffsIfNoDamage(true);
if (owner.CanUseSkill(42)){
dmgVal = GetWitcherPlayer().GetSkillLevel(42) * Calculat
eAttributeValue(owner.GetSkillAttributeValue(42, theGame.params.DAMAGE_NAME_FORC
E, false, true), /* NOP */);
action.AddDamage(theGame.params.DAMAGE_NAME_FORCE, dmgVa
l);
}
if (!owner.IsPlayer()){
action.AddEffectInfo(10, /* NOP */, /* NOP */, /* NOP */
, /* NOP */, /* NOP */);
}
theGame.damageMgr.ProcessAction(action);
collider.OnAardHit(this);
/* NOP */;
}
public function OnAttackRangeHit(entity : CGameplayEntity) : Bool{
entity.OnAardHit(this);
/* NOP */;
}
}
class W3AxiiProjectile extends W3SignProjectile{
protected function ProcessCollision(collider : CGameplayEntity, pos : Ve
ctor, normal : Vector){
DestroyAfter(3.000000);
collider.OnAxiiHit(this);
/* NOP */;
}
protected function ShouldCheckAttitude() : Bool{
return false;
/* NOP */;
}
}
class CAIDynamicFlyingWander extends CAISubTree{
public editable var chanceToTakeOff : Float;
public editable var chanceToLand : Float;
public editable var landingGroundOffset : Float;
public editable var onSpotLanding : Bool;
public editable var minFlyDistance : Float;
public editable var maxFlyDistance : Float;
public editable var minHeight : Float;
public editable var maxHeight : Float;
public editable var proximityToAllowTakeOff : Float;
public editable var proximityToForceTakeOff : Float;
public editable var distanceFromPlayerToLand : Float;
}
class W3FireAuraManagerComponent extends CR4Component{
public editable var fireAuraEffect : CName;

private var m_PostFxOnGroundCmp : W3PostFXOnGroundComponent;


public function OnComponentAttached() : Bool{
var l_actor : CActor;
l_actor = (CActor)GetEntity();
l_actor.AddAnimEventChildCallback(this, 'ActivateFireAura', 'OnA
nimEvent_ActivateFireAura');
l_actor.AddAnimEventChildCallback(this, 'DeactivateFireAura', 'O
nAnimEvent_DeactivateFireAura');
m_PostFxOnGroundCmp = (W3PostFXOnGroundComponent)l_actor.GetComp
onentByClassName('W3PostFXOnGroundComponent');
/* NOP */;
}
public function OnAardHit() : Bool{
DeactivateAura();
/* NOP */;
}
public function OnIgniHit() : Bool{
ActivateAura();
/* NOP */;
}
public function DeactivateAura(){
var l_actor : CActor;
l_actor = (CActor)GetEntity();
l_actor.StopEffect(fireAuraEffect);
l_actor.PauseEffects(69, 'None', true, /* NOP */, /* NOP */);
m_PostFxOnGroundCmp.StopTicking();
/* NOP */;
}
public function ActivateAura(){
var l_actor : CActor;
l_actor = (CActor)GetEntity();
l_actor.PlayEffectSingle(fireAuraEffect, /* NOP */);
l_actor.ResumeEffects(69, 'None');
m_PostFxOnGroundCmp.StartTicking();
/* NOP */;
}
public function OnAnimEvent_ActivateFireAura(animEventName : CName, anim
EventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
ActivateAura();
/* NOP */;
}
public function OnAnimEvent_DeactivateFireAura(animEventName : CName, an
imEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
DeactivateAura();
/* NOP */;
}
}
abstract class
public
public
public
public
public
public
public
public
public
public
public

CAIBaseMonsterDefaults extends CAIDefaults{


editable inlined var spawnTree : CAIMonsterSpawn;
editable inlined var keepDistance : CAIKeepDistanceTree;
editable inlined var tauntTree : CAIMonsterTaunt;
editable inlined var axiiTree : CAIMonsterAxii;
editable inlined var idleDecoratorTree : CAIMonsterIdleDecorator;
editable inlined var idleTree : CAIIdleTree;
editable var ignoreReachability : Bool;
editable var allowPursueDistance : Float;
editable var canSwim : Bool;
editable var canBury : Bool;
function Init(){

idleDecoratorTree = new CAIMonsterIdleDecorator in this;


idleDecoratorTree.OnCreated();
tauntTree = new CAIMonsterTaunt in this;
tauntTree.OnCreated();
axiiTree = new CAIMonsterAxii in this;
axiiTree.OnCreated();
/* NOP */;
}
}
class CAIMonsterSpawn extends CAISubTree{
public editable inlined var params : CAIMonsterSpawnParams;
public function Init(){
}
}
class CAIMonsterTaunt extends CAITauntTree{
public editable var canBury : Bool;
public editable inlined var params : CAIMonsterTauntParams;
public function Init(){
params = new CAIMonsterTauntParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterAxii extends CAIAxiiTree{
public editable inlined var params : CAIMonsterAxiiParams;
public function Init(){
params = new CAIMonsterAxiiParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterCombat extends CAICombatTree{
public editable inlined var params : CAIMonsterCombatParams;
public function Init(){
params = new CAIMonsterCombatParams in this;
params.OnCreated();
params.reactionTree = new CAIMonsterCombatReactionsTree in this;
params.reactionTree.OnCreated();
/* NOP */;
}
}
class CAIMonsterDeath extends CAINpcDeath{
public function Init(){
super.Init();
params = new CAIMonsterDeathParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIFlyingMonsterCombat extends CAICombatTree{
public editable inlined var params : CAIFlyingMonsterCombatParams;
public function Init(){
params = new CAIFlyingMonsterCombatParams in this;
params.OnCreated();

params.reactionTree = new CAIMonsterCombatReactionsTree in this;


params.reactionTree.OnCreated();
params.reactionTree.params.canFly = true;
/* NOP */;
}
}
class CAIFlyingMonsterDeath extends CAIMonsterDeath{
public function Init(){
super.Init();
params = new CAIFlyingMonsterDeathParams in this;
params.OnCreated();
/* NOP */;
}
}
import abstract class CBehTreeFlightData{
}
class CAIDrownerUnderwaterDefaults extends CAIDrownerDefaults{
}
class CAIRotfiendDefaults extends CAIDrownerDefaults{
public function Init(){
super.Init();
deathTree.params.spawnEntityAtDeath = true;
deathTree.params.entityToSpawn = 'rotfiend_explode';
/* NOP */;
}
}
import abstract class CBehTreeCarryingItemData{
}
import abstract class Vector3{
}
class CAINoonwraithDoppelgangerDefaults extends CAINoonwraithDefaults{
public function Init(){
super.Init();
tauntTree = NULL;
idleDecoratorTree = NULL;
axiiTree = NULL;
combatTree.params.reactionTree = NULL;
/* NOP */;
}
}
import abstract class Vector2{
}
import abstract class Tetrahedron{
}
import abstract class CutCone{
}
import abstract class Box{
//NULL type for Min
//NULL type for Max

}
import abstract class Rect{
}
class W3BackgroundAnimatedEntity extends CGameplayEntity{
public editable var backgroundEntityData : array<SBackgroundEntityData>;
public editable var parentEntity : CEntityTemplate;
public editable var maxSpeed : Float;
public editable var acceleration : Float;
public editable var maxAngleSpeed : Float;
public editable var waypointDistance : Float;
public editable var waypoints : array<EntityHandle>;
public editable var loopMotion : Bool;
public editable var startAtSpawn : Bool;
public editable var maxAngleSpeedThreshold : Float;
public editable var angleAcceleration : Float;
public editable var stoppingDistance : Float;
public editable var endPositionError : Float;
public var angleSpeed : Float;
public var speedScale : Float;
public var previousAngleDistance : Float;
public var nodes : array<CNode>;
public var i : Int32;
public var size : Int32;
public var currTargetIndex : Int32;
public var canMove : Bool;
public var entity : CEntity;
public var entityToAttach : CEntity;
public var currTarget : CNode;
public var position : Vector;
public var targetPos : Vector;
public var currPosition : Vector;
public var direction : Vector;
public var toTarget : Vector;
public var angleDistancePlus : Float;
public var angleDistanceMinus : Float;
public var angleDistance : Float;
public var distanceToTarget : Float;
public var rotation : EulerAngles;
public var desiredRotation : EulerAngles;
public var speed : Float;
public var shouldStop : Bool;
public var maxCurrentAngleSpeed : Float;
public var maxCurrentSpeed : Float;
public function SetupNodes() : Bool{
size = waypoints.Size();
nodes.Resize(size);
i = 0;
while (i < size){
nodes[i] = EntityHandleGet(waypoints[i]);
i += 1;
}
size = nodes.Size();
canMove = true;
i = 0;
while (i < size){
if (!nodes[i]){
canMove = false;
}

i += 1;
}
return canMove;
/* NOP */;
}
public function MoveBetweenWaypoints(timeDelta : Float){
var absAngleDistance : Float;
var clampedDistanceToTarget : Float;
var traceVector : Vector;
var traceNormal : Vector;
var zSpeed : Float;
if (canMove){
direction = entity.GetHeadingVector();
direction.Z = 0;
direction = VecNormalize(direction);
rotation = entity.GetWorldRotation();
currPosition = entity.GetWorldPosition();
currPosition.Z = 0;
currTarget = nodes[currTargetIndex];
if (shouldStop){
clampedDistanceToTarget = distanceToTarget;
if (clampedDistanceToTarget > stoppingDistance){
clampedDistanceToTarget = stoppingDistan
ce;
}
if (clampedDistanceToTarget < endPositionError){
entity.StopEffect('water_trail');
canMove = false;
if (FactsDoesExist("e3_2014_demo")){
} else {
entity.SoundEvent("qu_sk_drakkar
_singing_end", /* NOP */, /* NOP */);
}
} else {
speed = clampedDistanceToTarget * maxCur
rentSpeed / stoppingDistance;
}
} else {
speed = speed + acceleration * timeDelta;
if (speed > maxSpeed){
speed = maxSpeed;
}
maxCurrentSpeed = speed;
}
if (currTarget){
targetPos = currTarget.GetWorldPosition();
targetPos.Z = 0;
toTarget = targetPos - position;
desiredRotation = VecToRotation(toTarget);
angleDistance = desiredRotation.Yaw - rotation.Y
aw;
if (angleDistance < -180){
angleDistance += 360;
} else if (angleDistance > 180){
angleDistance -= 360;
}
absAngleDistance = AbsF(angleDistance);
distanceToTarget = VecDistance2D(targetPos, curr
Position);
if (distanceToTarget <= waypointDistance){

if (currTargetIndex < size - 1){


if (!loopMotion){
shouldStop = true;
}
currTargetIndex += 1;
} else if (loopMotion){
currTargetIndex = 0;
}
}
if (absAngleDistance > 0.100000){
if (absAngleDistance < maxAngleSpeedThre
shold && previousAngleDistance > absAngleDistance){
if (maxCurrentAngleSpeed <= 0){
maxCurrentAngleSpeed = m
axAngleSpeed;
}
angleSpeed = maxCurrentAngleSpee
d * absAngleDistance / maxAngleSpeedThreshold;
} else {
if (angleSpeed < maxAngleSpeed){
angleSpeed += angleAccel
eration * timeDelta;
} else {
angleSpeed = maxAngleSpe
ed;
}
maxCurrentAngleSpeed = angleSpee
d;
}
if (angleDistance < 0){
angleDistance = -1 * angleSpeed;
} else {
angleDistance = angleSpeed;
}
} else {
angleSpeed = 0;
}
}
rotation.Yaw += angleDistance * timeDelta;
position = entity.GetWorldPosition();
position += speed * direction * timeDelta;
entity.TeleportWithRotation(position, rotation);
previousAngleDistance = absAngleDistance;
}
/* NOP */;
}
public function SpawnBackgroundEntities(attachement : CEntity){
var slotName : CName;
var j : Int32;
var backgroundSize : Int32;
backgroundSize = backgroundEntityData.Size();
j = 0;
while (j < backgroundSize){
if (backgroundEntityData[j].entityTemplate){
entityToAttach = theGame.CreateEntity(background
EntityData[j].entityTemplate, GetWorldPosition(), GetWorldRotation(), /* NOP */,
/* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (entityToAttach && backgroundEntityData[j].sp
awnSlotName != 'None' && backgroundEntityData[j].spawnSlotName != 'None'){
entityToAttach.CreateAttachment(attachem

ent, backgroundEntityData[j].spawnSlotName, /* NOP */, /* NOP */);


if (backgroundEntityData[j].appearanceNa
me != 'None' && backgroundEntityData[j].appearanceName != 'None'){
entityToAttach.ApplyAppearance(b
ackgroundEntityData[j].appearanceName);
}
entityToAttach.SetBehaviorVariable('Work
TypeEnum_Single', backgroundEntityData[j].workAnimationEvent, /* NOP */);
}
}
j += 1;
}
/* NOP */;
}
public function StartMoving(){
entity.PlayEffect('water_trail', /* NOP */);
RemoveTimer('TimerMove', /* NOP */);
AddTimer('TimerMove', 0.010000, true, /* NOP */, /* NOP */, /* N
OP */, /* NOP */);
if (FactsDoesExist("e3_2014_demo")){
} else {
entity.SoundEvent("qu_sk_drakkar_singing", /* NOP */, /*
NOP */);
}
/* NOP */;
}
public function OnSpawned(spawnData : SEntitySpawnData) : Bool{
entity = theGame.CreateEntity(parentEntity, GetWorldPosition(),
GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (entity){
SetupNodes();
SpawnBackgroundEntities(entity);
if (startAtSpawn){
StartMoving();
}
}
/* NOP */;
}
public timer function TimerMove(optional td : Float, optional id : Int32
){
MoveBetweenWaypoints(td);
/* NOP */;
}
}
import abstract class Sphere{
}
import abstract class AACylinder{
}
import abstract class Segment{
}
class CAIIceGolemDefaults extends CAIGolemDefaults{
public function Init(){
super.Init();
deathTree.params.destroyAfterAnimDelay = 5;
/* NOP */;
}

}
import abstract class OrientedBox{
}
import abstract class FixedCapsule{
}
import abstract class ConvexHull{
}
import abstract class Cylinder{
}
import abstract class Quad{
}
import abstract class Plane{
}
import abstract class SSimpleCurvePoint{
}
import abstract class SSimpleCurve{
}
import abstract class SCurveData{
}
import abstract class SCurve3DData{
}
class CAIMonsterAxiiParams extends CAIAxiiParameters{
public editable var canFly : Bool;
public editable var onSpotLanding : Bool;
public editable var landingGroundOffset : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
import abstract class LongBitField{
}
class CR4OverlayPopup extends CR4PopupBase{
private var m_InitDataObject : W3NotificationData;
private var m_fxShowNotification : CScriptedFlashFunction;
private var m_fxHideNotification : CScriptedFlashFunction;
private var m_fxShowLoadingIndicator : CScriptedFlashFunction;
private var m_fxHideLoadingIndicator : CScriptedFlashFunction;
private var m_fxShowSavingIndicator : CScriptedFlashFunction;
private var m_fxHideSavingIndicator : CScriptedFlashFunction;
private var m_fxAppendButton : CScriptedFlashFunction;
private var m_fxRemoveButton : CScriptedFlashFunction;
private var m_fxRemoveContextButtons : CScriptedFlashFunction;
private var m_fxUpdateButtons : CScriptedFlashFunction;
private var m_fxShowMouseCursor : CScriptedFlashFunction;
private var m_fxShowSafeRect : CScriptedFlashFunction;
private var m_cursorRequested : Int32;

private var m_cursorHidden : Bool;


public function OnConfigUI() : Bool{
super.OnConfigUI();
m_fxShowNotification = m_flashModule.GetMemberFlashFunction("sho
wNotification");
m_fxHideNotification = m_flashModule.GetMemberFlashFunction("hid
eNotification");
m_fxShowLoadingIndicator = m_flashModule.GetMemberFlashFunction(
"showLoadIdicator");
m_fxHideLoadingIndicator = m_flashModule.GetMemberFlashFunction(
"hideLoadIdicator");
m_fxShowSavingIndicator = m_flashModule.GetMemberFlashFunction("
showSaveIdicator");
m_fxHideSavingIndicator = m_flashModule.GetMemberFlashFunction("
hideSaveIdicator");
m_fxAppendButton = m_flashModule.GetMemberFlashFunction("appendB
inding");
m_fxRemoveButton = m_flashModule.GetMemberFlashFunction("removeB
inding");
m_fxRemoveContextButtons = m_flashModule.GetMemberFlashFunction(
"removeAllContextBinding");
m_fxUpdateButtons = m_flashModule.GetMemberFlashFunction("update
InputFeedback");
m_fxShowMouseCursor = m_flashModule.GetMemberFlashFunction("show
MouseCursor");
m_fxShowSafeRect = m_flashModule.GetMemberFlashFunction("showSaf
eRect");
m_InitDataObject = (W3NotificationData)GetPopupInitData();
if (m_InitDataObject){
ShowNotification(m_InitDataObject.messageText, m_InitDat
aObject.duration);
}
m_cursorRequested = theGame.GetGuiManager().mouseCursorRequestSt
ack;
if (m_cursorRequested > 0){
UpdateCursorVisibility();
}
UpdateInputDevice();
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
}
public function RequestMouseCursor(value : Bool){
if (value){
m_cursorRequested += 1;
} else if (m_cursorRequested > 0){
m_cursorRequested -= 1;
}
UpdateCursorVisibility();
/* NOP */;
}
public function ForceHideMouseCursor(value : Bool){
m_cursorHidden = value;
UpdateCursorVisibility();
/* NOP */;
}
public function UpdateInputDevice(){
var isGamepad : Bool;
var detectionMessage : String;

var switchMessage : String;


isGamepad = theInput.LastUsedGamepad();
UpdateCursorVisibility();
SetControllerType(isGamepad);
switchMessage = GetLocStringByKeyExt("message_common_control_sch
eme_changed");
if (isGamepad){
detectionMessage = GetLocStringByKeyExt("message_common_
gpad_detected");
} else {
detectionMessage = GetLocStringByKeyExt("message_common_
kb_detected");
}
theGame.GetGuiManager().ShowNotification(detectionMessage + "<br
/>" + switchMessage, /* NOP */);
/* NOP */;
}
private function ShowSoftwareCursor(){
m_fxShowMouseCursor.InvokeSelfOneArg(FlashArgBool(true));
/* NOP */;
}
private function HideSoftwareCursor(){
m_fxShowMouseCursor.InvokeSelfOneArg(FlashArgBool(false));
/* NOP */;
}
private function ShowCursor(){
if (theGame.IsSoftwareCursor()){
ShowSoftwareCursor();
theGame.HideHardwareCursor();
} else {
HideSoftwareCursor();
theGame.ShowHardwareCursor();
}
/* NOP */;
}
private function HideCursor(){
HideSoftwareCursor();
theGame.HideHardwareCursor();
/* NOP */;
}
private function UpdateCursorVisibility(){
var isGamepad : Bool;
isGamepad = theInput.LastUsedGamepad();
if (!isGamepad && !m_cursorHidden && m_cursorRequested > 0){
ShowCursor();
} else {
HideCursor();
}
/* NOP */;
}
public function ShowSafeRect(value : Bool){
m_fxShowSafeRect.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
public function AppendButton(actionId : Int32, gpadCode : String, kbCode
: Int32, label : String, contextId : CName){
m_fxAppendButton.InvokeSelfFiveArgs(FlashArgInt(actionId), Flash
ArgString(gpadCode), FlashArgInt(kbCode), FlashArgString(label), FlashArgUInt(Na
meToFlashUInt(contextId)));
/* NOP */;

}
public function RemoveButton(actionId : Int32, contextId : CName){
m_fxRemoveButton.InvokeSelfTwoArgs(FlashArgInt(actionId), FlashA
rgUInt(NameToFlashUInt(contextId)));
/* NOP */;
}
public function RemoveContextButtons(contextId : CName){
m_fxRemoveContextButtons.InvokeSelfOneArg(FlashArgUInt(NameToFla
shUInt(contextId)));
/* NOP */;
}
public function UpdateButtons(){
m_fxUpdateButtons.InvokeSelf();
/* NOP */;
}
public function ShowNotification(messageText : String, duration : Float)
{
m_fxShowNotification.InvokeSelfTwoArgs(FlashArgString(messageTex
t), FlashArgNumber(duration));
/* NOP */;
}
public function HideNotification(){
m_fxHideNotification.InvokeSelf();
/* NOP */;
}
public function ShowLoadingIndicator(){
m_fxShowLoadingIndicator.InvokeSelf();
/* NOP */;
}
public function HideLoadingIndicator(immediateHide : Bool){
m_fxHideLoadingIndicator.InvokeSelfOneArg(FlashArgBool(immediate
Hide));
/* NOP */;
}
public function ShowSavingIndicator(){
m_fxShowSavingIndicator.InvokeSelf();
/* NOP */;
}
public function HideSavingIndicator(immediateHide : Bool){
m_fxHideSavingIndicator.InvokeSelfOneArg(FlashArgBool(immediateH
ide));
/* NOP */;
}
}
class CAIMonsterTauntParams extends CAITauntParameters{
public editable var stopTauntingDistance : Float;
public editable var tauntDelay : Float;
public editable var forceAttackDelay : Float;
public editable var useSurround : Bool;
public editable var chanceToMove : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CR4TutorialPopup extends CR4PopupBase{
public var m_DataObject : W3TutorialPopupData;
public var timeRemains : Float;

public
public
public
public
public
public
public
public

var removeOnTimer : Bool;


var enableGlossaryLink : Bool;
var hideCounter : Int32;
var forcedhideCounter : Int32;
var isVisible : Bool;
var m_fxPlayFeedbackAnim : CScriptedFlashFunction;
var m_fxResetInput : CScriptedFlashFunction;
function OnConfigUI() : Bool{
var initData : W3TutorialPopupData;
var isHidden : Bool;
var isForceHidden : Bool;
super.OnConfigUI();
m_fxResetInput = m_flashModule.GetMemberFlashFunction("resetInpu

t");
m_fxPlayFeedbackAnim = m_flashModule.GetMemberFlashFunction("pla
yFeedbackAnimation");
initData = (W3TutorialPopupData)GetPopupInitData();
if (!initData || initData.closeRequested){
m_DataObject = initData;
ClosePopup();
}
UpdateData(initData, true);
isVisible = true;
theGame.GetGuiManager().GetTutorialVisibility(isHidden, isForceH
idden);
if (isHidden){
SetInvisible(isHidden, isForceHidden);
}
/* NOP */;
}
public function UpdateInputDevice(){
var isGamepad : Bool;
isGamepad = theInput.LastUsedGamepad();
SetControllerType(isGamepad);
/* NOP */;
}
public function UpdateData(TutData : W3TutorialPopupData, showAnimation
: Bool){
var commonMenuRef : CR4CommonMenu;
if (!TutData){
return;
}
m_DataObject = TutData;
hideCounter = 0;
forcedhideCounter = 0;
removeOnTimer = true;
if (m_DataObject){
timeRemains = m_DataObject.duration;
m_DataObject.menuRef = this;
if (m_DataObject.enableGlossoryLink){
enableGlossaryLink = CanEnableGlossaryLink();
} else {
enableGlossaryLink = false;
}
if (enableGlossaryLink){
EnableGlossaryLink(true);
}
if (m_DataObject.blockInput || m_DataObject.fullscreen){
theInput.StoreContext('EMPTY_CONTEXT');
MakeModal(true);

m_guiManager.ForceHideMouseCursor(true);
commonMenuRef = theGame.GetGuiManager().GetCommo
nMenu();
if (commonMenuRef){
commonMenuRef.SetInputFeedbackVisibility
(false);
}
}
if (m_DataObject.pauseGame || m_DataObject.fullscreen){
theGame.Pause("tutorial");
}
CreateTutorialHint(showAnimation);
}
/* NOP */;
}
public function SetInvisible(value : Bool, forced : Bool){
var canBeShownInMenus : Bool;
canBeShownInMenus = m_DataObject && m_DataObject.canBeShownInMen
us;
if (isVisible != value){
return;
}
if (value){
if (!canBeShownInMenus || forced){
if (m_DataObject && m_DataObject.blockInput || m
_DataObject.fullscreen){
MakeModal(false);
theInput.RestoreContext('EMPTY_CONTEXT',
false);
}
if (m_DataObject && m_DataObject.pauseGame || m_
DataObject.fullscreen){
theGame.Unpause("tutorial");
}
m_flashModule.SetVisible(false);
isVisible = false;
}
} else {
if (m_DataObject && m_DataObject.blockInput || m_DataObj
ect.fullscreen){
MakeModal(true);
theInput.StoreContext('EMPTY_CONTEXT');
}
if (m_DataObject && m_DataObject.pauseGame || m_DataObje
ct.fullscreen){
theGame.Pause("tutorial");
}
m_flashModule.SetVisible(true);
m_fxResetInput.InvokeSelf();
isVisible = true;
}
/* NOP */;
}
public function OnStartHiding() : Bool{
RequestUnpause();
/* NOP */;
}
public function OnHideTimer() : Bool{
RequestClose(/* NOP */, /* NOP */);
/* NOP */;

}
public function OnGotoGlossary() : Bool{
if (isVisible){
theGame.RequestMenuWithBackground('GlossaryTutorialsMenu
', 'CommonMenu', /* NOP */);
if (m_DataObject.fullscreen){
ClosePopup();
}
}
/* NOP */;
}
public function OnCloseByUser() : Bool{
if (m_DataObject){
if (m_DataObject.fullscreen){
return false;
}
}
RequestClose(true, /* NOP */);
/* NOP */;
}
public function OnClosingPopup() : Bool{
var scriptTag : CName;
var commonMenuRef : CR4CommonMenu;
if (m_DataObject){
if (m_DataObject.pauseGame || m_DataObject.fullscreen){
theGame.Unpause("tutorial");
}
if (m_DataObject.blockInput || m_DataObject.fullscreen){
if (theInput.GetContext() == 'EMPTY_CONTEXT'){
theInput.RestoreContext('EMPTY_CONTEXT',
true);
}
m_guiManager.ForceHideMouseCursor(false);
MakeModal(false);
commonMenuRef = theGame.GetGuiManager().GetCommo
nMenu();
if (commonMenuRef){
commonMenuRef.SetInputFeedbackVisibility
(true);
}
}
scriptTag = m_DataObject.scriptTag;
m_DataObject.CloseCallback(true, false, /* NOP */);
delete m_DataObject;
theGame.GetTutorialSystem().OnTutorialHintClosed(scriptT
ag, true);
}
if (enableGlossaryLink){
EnableGlossaryLink(false);
}
/* NOP */;
}
private function CanEnableGlossaryLink() : Bool{
var tempEntries : array<CJournalBase>;
var entryTemp : CJournalTutorialGroup;
var status : EJournalStatus;
var m_journalManager : CWitcherJournalManager;
var allEntries : array<CJournalTutorialGroup>;
var i : Int32;
var j : Int32;

var length : Int32;


var l_groupEntry : CJournalTutorialGroup;
var l_entry : CJournalTutorial;
var l_tempEntries : array<CJournalBase>;
m_journalManager = theGame.GetJournalManager();
m_journalManager.GetActivatedOfType('CJournalTutorialGroup', tem
pEntries);
i = 0;
while (i < tempEntries.Size()){
entryTemp = (CJournalTutorialGroup)tempEntries[i];
if (entryTemp){
allEntries.PushBack(entryTemp);
}
i += 1;
}
length = allEntries.Size();
i = 0;
while (i < length){
l_groupEntry = allEntries[i];
l_tempEntries.Clear();
m_journalManager.GetActivatedChildren(l_groupEntry, l_te
mpEntries);
j = 0;
while (j < l_tempEntries.Size()){
l_entry = (CJournalTutorial)l_tempEntries[j];
if (m_journalManager.GetEntryStatus(l_entry) !=
0 && m_journalManager.GetEntryStatus(l_entry) != 3){
return true;
}
j += 1;
}
i += 1;
}
return false;
/* NOP */;
}
public function ShowTutorialHint(hintData : W3TutorialPopupData){
m_DataObject = hintData;
CreateTutorialHint(/* NOP */);
/* NOP */;
}
public function PlayFeedbackAnim(isCorrect : Bool){
m_fxPlayFeedbackAnim.InvokeSelfOneArg(FlashArgBool(isCorrect));
/* NOP */;
}
public function RequestUnpause(){
if (m_DataObject){
if (m_DataObject.pauseGame || m_DataObject.fullscreen){
theGame.Unpause("tutorial");
}
if (m_DataObject.blockInput || m_DataObject.fullscreen){
if (theInput.GetContext() == 'EMPTY_CONTEXT'){
theInput.RestoreContext('EMPTY_CONTEXT',
true);
}
MakeModal(false);
m_guiManager.ForceHideMouseCursor(false);
}
}
/* NOP */;

}
public function RequestClose(byUser : Bool, willBeCloned : Bool){
var scriptTag : CName;
var commonMenuRef : CR4CommonMenu;
if (m_DataObject){
if (m_DataObject.pauseGame || m_DataObject.fullscreen){
theGame.Unpause("tutorial");
}
if (m_DataObject.blockInput || m_DataObject.fullscreen){
if (theInput.GetContext() == 'EMPTY_CONTEXT'){
theInput.RestoreContext('EMPTY_CONTEXT',
true);
}
m_guiManager.ForceHideMouseCursor(false);
MakeModal(false);
commonMenuRef = theGame.GetGuiManager().GetCommo
nMenu();
if (commonMenuRef){
commonMenuRef.SetInputFeedbackVisibility
(true);
}
}
scriptTag = m_DataObject.scriptTag;
m_DataObject.CloseCallback(false, byUser, willBeCloned);
delete m_DataObject;
}
ClosePopup();
if (scriptTag != 'None'){
theGame.GetTutorialSystem().OnTutorialHintClosed(scriptT
ag, false);
}
/* NOP */;
}
protected function EnableGlossaryLink(value : Bool){
}
public function setArabicAligmentMode(){
super.setArabicAligmentMode();
/* NOP */;
}
protected function CreateTutorialHint(showAnimation : Bool){
var GFxHintObject : CScriptedFlashObject;
var GFxAreaObject : CScriptedFlashObject;
var GFxAreaList : CScriptedFlashArray;
var areasList : array<TutorialHighlightedArea>;
var curArea : TutorialHighlightedArea;
var idx : Int32;
var len : Int32;
GFxHintObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
GFxHintObject.SetMemberFlashNumber("posX", m_DataObject.posX);
GFxHintObject.SetMemberFlashNumber("posY", m_DataObject.posY);
GFxHintObject.SetMemberFlashNumber("duration", m_DataObject.dura
tion);
GFxHintObject.SetMemberFlashString("messageText", m_DataObject.m
essageText);
GFxHintObject.SetMemberFlashString("messageTitle", m_DataObject.
messageTitle);
GFxHintObject.SetMemberFlashString("imagePath", m_DataObject.ima
gePath);
GFxHintObject.SetMemberFlashBool("enableGlossaryLink", enableGlo

ssaryLink);
GFxHintObject.SetMemberFlashBool("enableAcceptButton", m_DataObj
ect.enableAcceptButton);
GFxHintObject.SetMemberFlashBool("autosize", m_DataObject.autosi
ze);
GFxHintObject.SetMemberFlashBool("fullscreen", m_DataObject.full
screen);
GFxHintObject.SetMemberFlashBool("showAnimation", showAnimation)
;
GFxHintObject.SetMemberFlashBool("isUiTutorial", m_DataObject.ca
nBeShownInMenus);
GFxAreaList = m_flashValueStorage.CreateTempFlashArray();
areasList = m_DataObject.GetHighlightedAreas();
len = areasList.Size();
if (len > 0){
idx = 0;
while (idx < len){
curArea = areasList[idx];
GFxAreaObject = m_flashValueStorage.CreateTempFl
ashObject(/* NOP */);
GFxAreaObject.SetMemberFlashNumber("x", curArea.
x);
GFxAreaObject.SetMemberFlashNumber("y", curArea.
y);
GFxAreaObject.SetMemberFlashNumber("width", curA
rea.width);
GFxAreaObject.SetMemberFlashNumber("height", cur
Area.height);
GFxAreaList.PushBackFlashObject(GFxAreaObject);
idx += 1;
}
m_flashValueStorage.SetFlashArray("tutorial.area.highlig
ht", GFxAreaList);
}
m_flashValueStorage.SetFlashObject("tutorial.hint.data", GFxHint
Object, /* NOP */);
/* NOP */;
}
}
class CR4GlossaryTutorialsMenu extends CR4ListBaseMenu{
public var allEntries : array<CJournalTutorialGroup>;
private var m_fxSetTitle : CScriptedFlashFunction;
private var m_fxSetText : CScriptedFlashFunction;
private var m_fxSetImage : CScriptedFlashFunction;
private var resetSelection : Bool;
public function OnConfigUI() : Bool{
var i : Int32;
var tempEntries : array<CJournalBase>;
var entryTemp : CJournalTutorialGroup;
var status : EJournalStatus;
super.OnConfigUI();
m_initialSelectionsToIgnore = 2;
m_journalManager.GetActivatedOfType('CJournalTutorialGroup', tem
pEntries);
i = 0;
while (i < tempEntries.Size()){
status = m_journalManager.GetEntryStatus(tempEntries[i])
;
entryTemp = (CJournalTutorialGroup)tempEntries[i];

if (entryTemp){
allEntries.PushBack(entryTemp);
}
i += 1;
}
m_fxSetTitle = m_flashModule.GetMemberFlashFunction("setTitle");
m_fxSetText = m_flashModule.GetMemberFlashFunction("setText");
m_fxSetImage = m_flashModule.GetMemberFlashFunction("setImage");
PopulateData();
SelectCurrentModule();
/* NOP */;
}
public function OnUpdateTutorials() : Bool{
resetSelection = true;
PopulateData();
OnEntrySelected(currentTag);
resetSelection = false;
/* NOP */;
}
public function UpdateImage(tag : CName){
var l_entry : CJournalTutorial;
var str : String;
l_entry = (CJournalTutorial)m_journalManager.GetEntryByTag(tag);
str = l_entry.GetImagePath();
if (str == ""){
m_fxSetImage.InvokeSelfOneArg(FlashArgString("empty_text
ure.PNG"));
} else {
m_fxSetImage.InvokeSelfOneArg(FlashArgString(str));
}
/* NOP */;
}
private function PopulateData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var i : Int32;
var j : Int32;
var length : Int32;
var l_groupEntry : CJournalTutorialGroup;
var l_entry : CJournalTutorial;
var l_entryPad : CJournalTutorial;
var l_tempEntries : array<CJournalBase>;
var l_Title : String;
var l_Tag : CName;
var l_IconPath : String;
var l_GroupTitle : String;
var l_GroupTag : CName;
var l_IsNew : Bool;
var l_IsUsingGamepad : Bool;
l_DataFlashArray = m_flashValueStorage.CreateTempFlashArray();
length = allEntries.Size();
l_IsUsingGamepad = theInput.LastUsedGamepad();
i = 0;
while (i < length){
l_groupEntry = allEntries[i];
l_GroupTitle = GetLocStringById(l_groupEntry.GetNameStri
ngId());
l_GroupTag = l_groupEntry.GetUniqueScriptTag();
if (l_GroupTitle == ""){
l_GroupTitle = "biuzm";

}
l_tempEntries.Clear();
m_journalManager.GetActivatedChildren(l_groupEntry, l_te
mpEntries);
j = l_tempEntries.Size() - 1;
while (j > -1){
l_Tag = l_tempEntries[j].GetUniqueScriptTag();
if (StrFindFirst(NameToString(l_Tag), "_pad") >
-1){
l_tempEntries.Erase(j);
}
j -= 1;
}
j = 0;
while (j < l_tempEntries.Size()){
l_entry = (CJournalTutorial)l_tempEntries[j];
if (l_IsUsingGamepad){
l_Tag = l_entry.GetUniqueScriptTag();
l_entryPad = (CJournalTutorial)m_journal
Manager.GetEntryByString(l_Tag + "_pad");
if (l_entryPad){
l_entry = l_entryPad;
}
}
if (m_journalManager.GetEntryStatus(l_entry) ==
0 || m_journalManager.GetEntryStatus(l_entry) == 3){
} else {
l_Title = GetLocStringById(l_entry.GetNa
meStringId());
l_IconPath = l_entry.GetImagePath();
l_IsNew = m_journalManager.IsEntryUnread
(l_entry);
l_Tag = l_entry.GetUniqueScriptTag();
l_DataFlashObject = m_flashValueStorage.
CreateTempFlashObject(/* NOP */);
l_DataFlashObject.SetMemberFlashUInt("ta
g", NameToFlashUInt(l_Tag));
l_DataFlashObject.SetMemberFlashString("
dropDownLabel", l_GroupTitle);
l_DataFlashObject.SetMemberFlashUInt("dr
opDownTag", NameToFlashUInt(l_GroupTag));
l_DataFlashObject.SetMemberFlashBool("dr
opDownOpened", IsCategoryOpened(l_GroupTag));
l_DataFlashObject.SetMemberFlashString("
dropDownIcon", "icons/monsters/ICO_MonsterDefault.png");
l_DataFlashObject.SetMemberFlashBool("is
New", l_IsNew);
if (resetSelection){
l_DataFlashObject.SetMemberFlash
Bool("selected", false);
} else {
l_DataFlashObject.SetMemberFlash
Bool("selected", l_Tag == currentTag);
}
l_DataFlashObject.SetMemberFlashString("
label", l_Title);
l_DataFlashObject.SetMemberFlashString("
iconPath", "icons/tutorials/" + l_IconPath);
l_DataFlashArray.PushBackFlashObject(l_D
ataFlashObject);

}
j += 1;
}
i += 1;
}
if (l_DataFlashArray.GetLength() > 0){
m_flashValueStorage.SetFlashArray(DATA_BINDING_NAME, l_D
ataFlashArray);
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(true));
} else {
m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBoo
l(false));
}
/* NOP */;
}
public function UpdateDescription(entryName : CName){
var l_entry : CJournalTutorial;
var description : String;
var title : String;
l_entry = (CJournalTutorial)m_journalManager.GetEntryByTag(entry
Name);
description = ReplaceTagsToIcons(GetLocStringById(l_entry.GetDes
criptionStringId()));
title = GetLocStringById(l_entry.GetNameStringId());
m_fxSetTitle.InvokeSelfOneArg(FlashArgString(title));
m_fxSetText.InvokeSelfOneArg(FlashArgString(description));
/* NOP */;
}
public function UpdateItems(tag : CName){
}
public function PlayOpenSoundEvent(){
}
}
class CAIMonsterCombatLogic extends CAISubTree{
public editable inlined var params : CAIMonsterCombatLogicParams;
public function Init(){
params = new CAIMonsterCombatLogicParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterSimpleDamageReactionTree extends CAISubTree{
}
class CAIMonsterCombatParams extends CAIBaseMonsterCombatParams{
public editable var createHitReactionEvent : CName;
public editable var IncreaseHitCounterOnlyOnMelee : Bool;
public editable inlined var criticalState : CAINpcCriticalState;
public editable inlined var reactionTree : CAIMonsterCombatReactionsTree
;
public function Init(){
super.Init();
createHitReactionEvent = 'MonsterHitReaction';
criticalState = new CAINpcCriticalState in this;
criticalState.OnCreated();
/* NOP */;
}

}
import struct CIndexed2dArray{
import public final function GetRowIndexByKey(key : CName) : Int32;
}
class CAINpcCriticalState extends CAICombatActionTree{
public editable inlined var params : CAINpcCriticalStateParams;
public function Init(){
params = new CAINpcCriticalStateParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterCombatReactionsTree extends CAIReactionTree{
public editable inlined var params : CAIMonsterReactionsTreeParams;
public function Init(){
var leadEscape : CAIActionLeadEscape;
var leadEscapeFearSomeEvent : CAIActionLeadEscape;
var escapeInPack : CAIActionEscapeInPack;
leadEscape = new CAIActionLeadEscape in this;
leadEscapeFearSomeEvent = new CAIActionLeadEscape in this;
escapeInPack = new CAIActionEscapeInPack in this;
params = new CAIMonsterReactionsTreeParams in this;
params.Init();
leadEscape.OnCreated();
leadEscapeFearSomeEvent.OnCreated();
escapeInPack.OnCreated();
leadEscapeFearSomeEvent.actionEventName = 'FearsomeEvent';
leadEscapeFearSomeEvent.saveReactionTargetUnder = 'FearsomeEvent
Source';
params.reactions.PushBack(leadEscape);
params.reactions.PushBack(leadEscapeFearSomeEvent);
params.reactions.PushBack(escapeInPack);
/* NOP */;
}
}
class CAIFlyingMonsterCombatParams extends CAIBaseMonsterCombatParams{
public editable var IncreaseHitCounterOnlyOnMelee : Bool;
public editable inlined var criticalState : CAINpcCriticalStateFlying;
public editable inlined var reactionTree : CAIMonsterCombatReactionsTree
;
public function Init(){
super.Init();
criticalState = new CAINpcCriticalStateFlying in this;
criticalState.OnCreated();
/* NOP */;
}
}
class CR4CommonMenu extends CR4MenuBase{
private var m_menuData : array<SMenuTab>;
private var m_subMenuData : array<SMenuTab>;
private var m_lastMenuName : CName;
public var m_hubEnabled : Bool;
private var m_lockedInHub : Bool;
private var m_lockedInMenu : Bool;
private var m_flashModule : CScriptedFlashSprite;

private var m_fxSubMenuClosed : CScriptedFlashFunction;


private var m_fxUpdateLevel : CScriptedFlashFunction;
private var m_fxUpdateMoney : CScriptedFlashFunction;
private var m_fxUpdateWeight : CScriptedFlashFunction;
private var m_fxNavigateNext : CScriptedFlashFunction;
private var m_fxNavigatePrior : CScriptedFlashFunction;
private var m_fxSelectSubMenuTab : CScriptedFlashFunction;
private var m_fxSetShopInventory : CScriptedFlashFunction;
private var m_fxUpdateTabEnabled : CScriptedFlashFunction;
private var m_fxLockOpenTabNavigation : CScriptedFlashFunction;
private var m_fxBlockMenuClosing : CScriptedFlashFunction;
private var m_fxBlockHubClosing : CScriptedFlashFunction;
private var m_fxSetInputFeedbackVisibility : CScriptedFlashFunction;
private var m_fxSetPlayerDefailsVis : CScriptedFlashFunction;
private var m_fxSetMeditationBackgroundMode : CScriptedFlashFunction;
private var m_fxOnChildMenuConfigured : CScriptedFlashFunction;
private var m_fxSelectTab : CScriptedFlashFunction;
private var m_fxEnterCurrentTab : CScriptedFlashFunction;
protected var m_defaultBindings : array<SKeyBinding>;
protected var m_contextBindings : array<SKeyBinding>;
protected var m_GFxBindings : array<SKeyBinding>;
public var m_contextManager : W3ContextManager;
public var m_mode_meditation : Bool;
public var m_had_meditation : Bool;
private var noSaveLock : Int32;
private var isCiri : Bool;
public function OnConfigUI() : Bool{
var stateName : CName;
var menuName : CName;
var initData : W3MenuInitData;
var initMapData : W3MapInitData;
var shouldSkipHub : Bool;
var lootPopup : CR4LootPopup;
if (!thePlayer.IsAlive() || theGame.HasBlackscreenRequested() ||
theGame.IsFading()){
CloseMenu();
return true;
}
theGame.CreateNoSaveLock("fullscreen_ui_panels", noSaveLock, fal
se, false);
theGame.GameplayFactsRemove("closingHubMenu");
theSound.SoundEvent("system_pause");
m_initialSelectionsToIgnore = 2;
m_hideTutorial = true;
m_forceHideTutorial = false;
menuName = theGame.GetMenuToOpen();
shouldSkipHub = menuName != 'None';
if (CheckCraftingComponent() || CheckRepairPanelEnabled() || Che
ckShopPanelEnabled()){
theGame.GameplayFactsAdd("shopMode", 1, /* NOP */);
} else {
theGame.GameplayFactsRemove("shopMode");
}
lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('Loot
Popup');
if (lootPopup){
lootPopup.ClosePopup();
}
super.OnConfigUI();
if ((W3ReplacerCiri)thePlayer){

isCiri = true;
} else {
isCiri = false;
}
m_hubEnabled = true;
GameplayFactsSet("GamePausedNotByUI", theGame.IsGameTimePaused()
);
theGame.Pause("menus");
m_flashModule = GetMenuFlash();
m_fxSubMenuClosed = m_flashModule.GetMemberFlashFunction("onSubM
enuClosed");
m_fxUpdateLevel = m_flashModule.GetMemberFlashFunction("updatePl
ayerLevel");
m_fxUpdateMoney = m_flashModule.GetMemberFlashFunction("updateMo
ney");
m_fxUpdateWeight = m_flashModule.GetMemberFlashFunction("updateW
eight");
m_fxNavigateNext = m_flashModule.GetMemberFlashFunction("handleF
orceNextTab");
m_fxNavigatePrior = m_flashModule.GetMemberFlashFunction("handle
ForcePriorTab");
m_fxSelectSubMenuTab = m_flashModule.GetMemberFlashFunction("ent
erCurrentlySelectedTab");
m_fxSetShopInventory = m_flashModule.GetMemberFlashFunction("set
ShopInventory");
m_fxUpdateTabEnabled = m_flashModule.GetMemberFlashFunction("upd
ateTabEnabled");
m_fxLockOpenTabNavigation = m_flashModule.GetMemberFlashFunction
("lockOpenTabNavigation");
m_fxBlockMenuClosing = m_flashModule.GetMemberFlashFunction("blo
ckMenuClosing");
m_fxBlockHubClosing = m_flashModule.GetMemberFlashFunction("bloc
kHubClosing");
m_fxSetInputFeedbackVisibility = m_flashModule.GetMemberFlashFun
ction("SetInputFeedbackVisibility");
m_fxSetPlayerDefailsVis = m_flashModule.GetMemberFlashFunction("
setPlayerDetailsVisible");
m_fxSetMeditationBackgroundMode = m_flashModule.GetMemberFlashFu
nction("setMeditationBackgroundMode");
m_fxSelectTab = m_flashModule.GetMemberFlashFunction("setSelecte
dTab");
m_fxEnterCurrentTab = m_flashModule.GetMemberFlashFunction("ente
rCurrentlySelectedTab");
m_fxOnChildMenuConfigured = m_flashModule.GetMemberFlashFunction
("onChildMenuConfigured");
stateName = 'None';
initData = (W3MenuInitData)GetMenuInitData();
if (initData){
stateName = initData.getDefaultState();
}
if (CheckCraftingComponent() || CheckRepairPanelEnabled() || Che
ckShopPanelEnabled()){
AddMerchantTagIfMissing_HACK();
DefineSceneMenuStructure();
} else {
DefineMenuStructure();
initMapData = (W3MapInitData)initData;
SetMenuTabeEnable('InventoryMenu', false, 'HorseInventor
y');
if (menuName == 'MapMenu' && initMapData && initMapData.

GetTriggeredExitEntity() || initMapData.GetUsedFastTravelEntity()){
SetSingleMenuTabEnabled('MapMenu');
m_hubEnabled = false;
} else if (menuName == 'InventoryMenu' && stateName == '
SingleHorseInventory'){
stateName = 'HorseInventory';
SetMenuTabeEnable('InventoryMenu', false, 'Chara
cterInventory');
SetMenuTabeEnable('JournalParent', false, /* NOP
*/);
SetMenuTabeEnable('GlossaryParent', false, /* NO
P */);
SetMenuTabeEnable('MeditationClockMenu', false,
/* NOP */);
SetMenuTabeEnable('MapMenu', false, 'GlobalMap')
;
}
}
DisableNotAllowedTabs();
UpdateTabs();
SetupMenu();
if (menuName == 'None'){
if (stateName != 'None'){
menuName = GetMenuParentName(stateName);
} else {
menuName = 'MapMenu';
stateName = 'GlobalMap';
}
} else if (menuName == 'MeditationClockMenu'){
SetMeditationMode(true);
}
if (isCiri){
m_hubEnabled = false;
m_fxSetPlayerDefailsVis.InvokeSelfOneArg(FlashArgBool(fa
lse));
shouldSkipHub = true;
m_fxSelectTab.InvokeSelfTwoArgs(FlashArgUInt(NameToFlash
UInt('MapMenu')), FlashArgString('GlobalMap'));
} else {
m_fxSelectTab.InvokeSelfTwoArgs(FlashArgUInt(NameToFlash
UInt(menuName)), FlashArgString(stateName));
}
if (shouldSkipHub){
m_fxEnterCurrentTab.InvokeSelf();
}
theInput.StoreContext('EMPTY_CONTEXT');
m_contextManager = new W3ContextManager in this;
m_contextManager.Init(this);
m_guiManager.RequestMouseCursor(true);
if (theInput.LastUsedPCInput()){
theGame.MoveMouseTo(0.475000, 0.480000);
}
/* NOP */;
}
protected function GetSavedDataMenuName() : CName{
return theGame.GetMenuToOpen();
/* NOP */;
}
public function SaveStateData(){
m_guiManager.UpdateUISavedData(GetMenuName(), UISavedData.opened

Categories, 'None', UISavedData.selectedModule, /* NOP */, /* NOP */);


/* NOP */;
}
protected function GetFirstChildMenuName(parentName : CName) : CName{
var i : Int32;
i = 0;
while (i < m_menuData.Size()){
if (m_menuData[i].ParentMenu == parentName){
return m_menuData[i].MenuName;
}
i += 1;
}
return parentName;
/* NOP */;
}
protected function GetMenuParentName(menuName : CName) : CName{
var i : Int32;
i = 0;
while (i < m_menuData.Size()){
if (m_menuData[i].MenuName == menuName){
if (m_menuData[i].ParentMenu != 'None'){
return m_menuData[i].ParentMenu;
}
} else if (m_menuData[i].MenuState == menuName){
if (m_menuData[i].ParentMenu != 'None'){
return m_menuData[i].ParentMenu;
}
}
i += 1;
}
return menuName;
/* NOP */;
}
protected function HasMenuDefined(menuName : CName) : Bool{
var i : Int32;
i = 0;
while (i < m_menuData.Size()){
if (m_menuData[i].MenuName == menuName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
protected function HasMenuWithStateDefined(menuName : CName, stateName :
CName) : Bool{
var i : Int32;
i = 0;
while (i < m_menuData.Size()){
if (m_menuData[i].MenuName == menuName && m_menuData[i].
MenuState == stateName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
protected function GetSavedMenuFromParentName(parentMenuName : CName) :

CName{
UISavedData = m_guiManager.GetUISavedData(parentMenuName);
if (UISavedData.selectedTag != 'None' && HasMenuDefined(UISavedD
ata.selectedTag)){
return UISavedData.selectedTag;
}
return parentMenuName;
/* NOP */;
}
public function OnClosingMenu() : Bool{
var menuInitData : W3MenuInitData;
var fastForward : CGameFastForwardSystem;
var waitt : W3PlayerWitcherStateMeditationWaiting;
theSound.SoundEvent("system_resume");
OnPlaySoundEvent("gui_global_panel_close");
if (thePlayer.GetCurrentStateName() == 'MeditationWaiting'){
waitt = (W3PlayerWitcherStateMeditationWaiting)thePlayer
.GetCurrentState();
if (waitt){
waitt.RequestWaitStop();
}
}
menuInitData = (W3MenuInitData)GetMenuInitData();
if (menuInitData){
delete menuInitData;
}
if (m_contextManager){
delete m_contextManager;
}
StopMeditation();
fastForward = theGame.GetFastForwardSystem();
fastForward.RequestFastForwardShutdown(true);
theGame.Unpause("menus");
if (m_configUICalled){
theInput.RestoreContext('EMPTY_CONTEXT', true);
}
theGame.SetMenuToOpen('None');
theGame.ReleaseNoSaveLock(noSaveLock);
theGame.GameplayFactsAdd("closingHubMenu", 1, /* NOP */);
m_guiManager.RequestMouseCursor(false);
super.OnClosingMenu();
theGame.FadeOutAsync(0, /* NOP */);
theGame.FadeInAsync(0.200000);
/* NOP */;
}
public function SetInputFeedbackVisibility(value : Bool){
m_fxSetInputFeedbackVisibility.InvokeSelfOneArg(FlashArgBool(val
ue));
/* NOP */;
}
public function SwitchToSubMenu(MenuName : CName, MenuState : String){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt(Men
uName)), FlashArgString(MenuState));
m_fxEnterCurrentTab.InvokeSelf();
/* NOP */;
}
public function OnHideChildMenu() : Bool{
var childMenu : CR4MenuBase;
if (!m_hubEnabled){
CloseMenu();

return true;
}
childMenu = GetLastChild();
m_fxSubMenuClosed.InvokeSelf();
m_GFxBindings.Clear();
m_defaultBindings.Clear();
m_contextBindings.Clear();
UpdateInputFeedback();
if (childMenu){
childMenu.CloseMenu();
}
/* NOP */;
}
public function OnRequestMenu(MenuName : CName, MenuState : String) : Bo
ol{
var menuInitData : W3MenuInitData;
var currentSubMenu : CR4MenuBase;
var parentMenuName : CName;
var ignoreSaveData : Bool;
currentSubMenu = (CR4MenuBase)GetSubMenu();
menuInitData = (W3MenuInitData)GetMenuInitData();
if (menuInitData){
ignoreSaveData = menuInitData.ignoreSaveSystem;
menuInitData.ignoreSaveSystem = false;
}
if (currentSubMenu && currentSubMenu.GetMenuName() == MenuName){
parentMenuName = GetMenuParentName(MenuName);
if (MenuState != NameToString(GetSavedMenuFromParentName
(parentMenuName))){
MenuName = GetSavedMenuFromParentName(parentMenu
Name);
}
UISavedData.openedCategories.Clear();
if (MenuState != ""){
UISavedData.openedCategories.PushBack(HaxGetPane
lStateName(MenuState));
}
m_guiManager.UpdateUISavedData(parentMenuName, UISavedDa
ta.openedCategories, MenuName, UISavedData.selectedModule, /* NOP */, /* NOP */)
;
if (MenuState != ""){
currentSubMenu.SetMenuState(HaxGetPanelStateName
(MenuState));
OnPlaySoundEvent("gui_global_submenu_whoosh");
}
} else {
if (currentSubMenu){
OnPlaySoundEvent("gui_global_submenu_whoosh");
} else {
OnPlaySoundEvent("gui_global_panel_open");
}
parentMenuName = GetMenuParentName(MenuName);
if (MenuName == parentMenuName){
if (!ignoreSaveData){
MenuName = GetSavedMenuFromParentName(pa
rentMenuName);
}
if (MenuName == parentMenuName){
MenuName = GetFirstChildMenuName(parentM
enuName);

}
}
if (menuInitData){
menuInitData.setDefaultState(HaxGetPanelStateNam
e(MenuState));
m_lastMenuName = MenuName;
RequestSubMenu(MenuName, menuInitData);
} else if (!GetMenuInitData() && MenuState != "" && Menu
State != "None"){
menuInitData = new W3MenuInitData in this;
menuInitData.setDefaultState(HaxGetPanelStateNam
e(MenuState));
m_lastMenuName = MenuName;
RequestSubMenu(MenuName, menuInitData);
} else {
m_lastMenuName = MenuName;
RequestSubMenu(MenuName, GetMenuInitData());
}
m_fxLockOpenTabNavigation.InvokeSelfOneArg(FlashArgBool(
true));
theGame.GetTutorialSystem().uiHandler.OnClosingMenu(GetM
enuName());
UISavedData.openedCategories.Clear();
if (MenuState != "" && MenuState != "None"){
UISavedData.openedCategories.PushBack(HaxGetPane
lStateName(MenuState));
}
if (MenuName != parentMenuName){
m_fxSelectSubMenuTab.InvokeSelfTwoArgs(FlashArgU
Int(NameToFlashUInt(MenuName)), FlashArgString(MenuState));
}
m_guiManager.UpdateUISavedData(GetMenuParentName(parentM
enuName), UISavedData.openedCategories, MenuName, UISavedData.selectedModule, /*
NOP */, /* NOP */);
}
m_GFxBindings.Clear();
/* NOP */;
}
public function ChildMenuConfigured(){
m_fxLockOpenTabNavigation.InvokeSelfOneArg(FlashArgBool(false));
m_fxOnChildMenuConfigured.InvokeSelf();
/* NOP */;
}
public function HaxGetPanelStateName(stateName : String) : CName{
switch(stateName){
case "CharacterInventory":
return 'CharacterInventory';
case "HorseInventory":
return 'HorseInventory';
case "GlobalMap":
return 'GlobalMap';
case "FastTravel":
return 'FastTravel';
case "Objectives":
return 'Objectives';
case "Sockets":
return 'Sockets';
case "Repair":
return 'Repair';
case "Disassemble":

return 'Disassemble';
}
return 'None';
/* NOP */;
}
public function OnSwipe(swipe : Int32) : Bool{
var subMenu : CR4MenuBase;
/* NOP */;
if (swipe == 0){
GoPriorMenu();
} else if (swipe == 1){
GoNextMenu();
} else if (swipe == 3){
subMenu = (CR4MenuBase)GetSubMenu();
if (subMenu){
subMenu.OnCloseMenu();
}
}
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
/* NOP */;
if (m_contextManager){
m_contextManager.HandleUserInput(NavCode, ActionId);
}
/* NOP */;
}
public function SetMenuNavigationEnabled(enabled : Bool){
m_flashValueStorage.SetFlashBool("common.input.navigation.enable
d", enabled, /* NOP */);
/* NOP */;
}
public function UpdateTutorialRestruction(){
CheckTutorialRestrictions();
SetupMenu();
/* NOP */;
}
private function DefineMenuStructure(){
var curMenuItem : SMenuTab;
var curMenuSubItems : SMenuTab;
m_menuData.Clear();
if (!isCiri){
DefineMenuItem('GlossaryParent', "panel_title_glossary",
/* NOP */, /* NOP */);
DefineMenuItem('GlossaryBestiaryMenu', "panel_title_glos
sary_bestiary", 'GlossaryParent', /* NOP */);
DefineMenuItem('GlossaryTutorialsMenu', "panel_title_glo
ssary_tutorials", 'GlossaryParent', /* NOP */);
DefineMenuItem('GlossaryEncyclopediaMenu', "panel_title_
glossary_dictionary", 'GlossaryParent', /* NOP */);
DefineMenuItem('CraftingMenu', "panel_title_crafting", '
GlossaryParent', /* NOP */);
DefineMenuItem('AlchemyMenu', "panel_title_alchemy", 'No
ne', /* NOP */);
DefineMenuItem('InventoryMenu', "panel_inventory", 'None
', 'CharacterInventory');
}
DefineMenuItem('MapMenu', "panel_title_fullmap", 'None', 'Global
Map');

if (!isCiri){
DefineMenuItem('JournalQuestMenu', "panel_title_journal_
quest", 'None', /* NOP */);
DefineMenuItem('CharacterMenu', "panel_title_character",
'None', /* NOP */);
DefineMenuItem('MeditationClockMenu', "panel_title_medit
ation", 'None', /* NOP */);
}
CheckTutorialRestrictions();
/* NOP */;
}
private function DisableNotAllowedTabs(){
if (!thePlayer.IsActionAllowed(36)){
SetMenuTabeEnable('GlossaryParent', false, /* NOP */);
}
if (!thePlayer.IsActionAllowed(17)){
SetMenuTabeEnable('JournalQuestMenu', false, /* NOP */);
}
if (!thePlayer.IsActionAllowed(15) && !isCiri){
SetMenuTabeEnable('MapMenu', false, 'GlobalMap');
}
if (!thePlayer.IsActionAllowed(2)){
SetMenuTabeEnable('InventoryMenu', false, 'CharacterInve
ntory');
}
if (!thePlayer.IsActionAllowed(18)){
SetMenuTabeEnable('AlchemyMenu', false, /* NOP */);
}
if (!thePlayer.IsActionAllowed(16)){
SetMenuTabeEnable('CharacterMenu', false, /* NOP */);
}
if (!thePlayer.IsActionAllowed(9)){
SetMenuTabeEnable('PreparationMenu', false, /* NOP */);
}
if (!thePlayer.IsActionAllowed(46)){
SetMenuTabeEnable('MeditationClockMenu', false, /* NOP *
/);
}
/* NOP */;
}
public function ActionBlockStateChange(action : EInputActionBlock, block
ed : Bool){
var tabName : CName;
var subTabName : CName;
if (action == 36){
SetMenuTabeEnable('GlossaryParent', blocked, /* NOP */);
tabName = 'GlossaryParent';
subTabName = 'None';
}
if (action == 17){
SetMenuTabeEnable('JournalQuestMenu', blocked, /* NOP */
);
tabName = 'JournalQuestMenu';
subTabName = 'None';
}
if (action == 15){
SetMenuTabeEnable('MapMenu', blocked, 'GlobalMap');
tabName = 'MapMenu';
subTabName = 'GlobalMap';
}

if (action == 2){
SetMenuTabeEnable('InventoryMenu', blocked, 'CharacterIn
ventory');
tabName = 'InventoryMenu';
subTabName = 'CharacterInventory';
}
if (action == 18){
SetMenuTabeEnable('AlchemyMenu', blocked, /* NOP */);
tabName = 'AlchemyMenu';
subTabName = 'None';
}
if (action == 16){
SetMenuTabeEnable('CharacterMenu', blocked, /* NOP */);
tabName = 'CharacterMenu';
subTabName = 'None';
}
if (action == 9){
SetMenuTabeEnable('PreparationMenu', blocked, /* NOP */)
;
tabName = 'PreparationMenu';
subTabName = 'None';
}
if (action == 46){
SetMenuTabeEnable('MeditationClockMenu', blocked, /* NOP
*/);
tabName = 'MeditationClockMenu';
subTabName = 'None';
}
m_fxUpdateTabEnabled.InvokeSelfThreeArgs(FlashArgUInt(NameToFlas
hUInt(tabName)), FlashArgString(subTabName), FlashArgBool(!blocked));
/* NOP */;
}
private function CheckTutorialRestrictions(){
var allowedMenus : array<CName>;
var tutorialMgr : CR4TutorialSystem;
var restrictionEnabled : Bool;
var curRestriction : Bool;
var i : Int32;
var len : Int32;
tutorialMgr = theGame.GetTutorialSystem();
if (tutorialMgr && tutorialMgr.IsRunning()){
restrictionEnabled = tutorialMgr.IsMenuRestrictionsEnabl
e();
allowedMenus = tutorialMgr.GetAllowedMenuList();
len = m_menuData.Size();
i = 0;
while (i < len){
curRestriction = restrictionEnabled && !allowedM
enus.Contains(m_menuData[i].MenuName);
m_menuData[i].Restricted = curRestriction;
i += 1;
}
}
/* NOP */;
}
private function DefineSceneMenuStructure(){
var curMenuItem : SMenuTab;
var curMenuSubItems : SMenuTab;
m_menuData.Clear();
if (CheckShopPanelEnabled()){

DefineMenuItem('InventoryMenu', "panel_title_shop", /* N
OP */, /* NOP */);
}
if (CheckAlchemyPanelEnabled()){
DefineMenuItem('AlchemyMenu', "panel_title_alchemy", 'No
ne', /* NOP */);
}
if (CheckCraftingComponent()){
DefineMenuItem('CraftingParent', "panel_title_crafting",
/* NOP */, /* NOP */);
DefineMenuItem('CraftingMenu', "panel_title_crafting", '
CraftingParent', /* NOP */);
DefineMenuItem('BlacksmithMenu', "panel_title_blacksmith
_repair", 'CraftingParent', 'Repair');
DefineMenuItem('BlacksmithMenu', "panel_title_blacksmith
_sockets", 'CraftingParent', 'Sockets');
DefineMenuItem('BlacksmithMenu', "panel_title_blacksmith
_disassamble", 'CraftingParent', 'Disassemble');
}
/* NOP */;
}
private function GetInitGameplayEntity() : IScriptable{
var l_obj : IScriptable;
var l_entity : IScriptable;
var l_initData : W3InventoryInitData;
l_obj = GetMenuInitData();
l_initData = (W3InventoryInitData)l_obj;
if (l_initData){
l_entity = l_initData.containerNPC;
} else {
l_entity = l_obj;
}
return l_entity;
/* NOP */;
}
private function AddMerchantTagIfMissing_HACK(){
var l_entity : W3MerchantNPC;
var shopInventory : CInventoryComponent;
l_entity = (W3MerchantNPC)GetInitGameplayEntity();
if (l_entity && !l_entity.HasTag('Merchant')){
shopInventory = l_entity.GetInventory();
if (shopInventory && !shopInventory.IsEmpty(/* NOP */)){
l_entity.AddTag('Merchant');
}
}
/* NOP */;
}
private function CheckCraftingComponent() : Bool{
var l_npc : W3MerchantNPC;
var l_component : W3CraftsmanComponent;
l_npc = (W3MerchantNPC)GetInitGameplayEntity();
if (l_npc){
l_component = (W3CraftsmanComponent)l_npc.GetComponentBy
ClassName('W3CraftsmanComponent');
if (l_component){
if (!l_npc.IsCraftingDisabled()){
return true;
}
}
}

return false;
/* NOP */;
}
private function CheckRepairPanelEnabled() : Bool{
var l_entity : CGameplayEntity;
l_entity = (CGameplayEntity)GetInitGameplayEntity();
if (l_entity){
if (l_entity.HasTag('Armorer') || l_entity.HasTag('Black
smith')){
return true;
}
}
return false;
/* NOP */;
}
private function CheckAlchemyPanelEnabled() : Bool{
var l_entity : CGameplayEntity;
var invComponent : CInventoryComponent;
l_entity = (CGameplayEntity)GetInitGameplayEntity();
if (l_entity){
invComponent = l_entity.GetInventory();
if (invComponent.HasTag('type_herbalist') || invComponen
t.HasTag('type_alchemist')){
return true;
}
}
return false;
/* NOP */;
}
private function CheckShopPanelEnabled() : Bool{
var l_entity : CGameplayEntity;
l_entity = (CGameplayEntity)GetInitGameplayEntity();
if (l_entity){
if (l_entity.HasTag('Merchant')){
return true;
}
}
return false;
/* NOP */;
}
private function DefineMenuItem(itemName : CName, itemLabel : String, pa
rentMenuItem : CName, menuState : CName){
var newMenuItem : SMenuTab;
newMenuItem.MenuName = itemName;
newMenuItem.MenuLabel = itemLabel;
newMenuItem.Enabled = true;
newMenuItem.Visible = true;
newMenuItem.MenuState = menuState;
newMenuItem.ParentMenu = parentMenuItem;
m_menuData.PushBack(newMenuItem);
/* NOP */;
}
private function SetupMenu(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.setup", l_flashSub
Array);
OnRefreshHubInfo(false);
/* NOP */;

}
private function GetGFxMenuStruct(StructGFx : CScriptedFlashArray){
var i : Int32;
var j : Int32;
var subLen : Int32;
var l_flashObject : CScriptedFlashObject;
var l_flashSubObject : CScriptedFlashObject;
var l_flashSubArray : CScriptedFlashArray;
var CurDataItem : SMenuTab;
var CurSubDataItem : SMenuTab;
i = 0;
while (i < m_menuData.Size()){
CurDataItem = m_menuData[i];
if (CurDataItem.ParentMenu == 'None'){
l_flashObject = m_flashValueStorage.CreateTempFl
ashObject(/* NOP */);
GetGFxMenuItem(CurDataItem, l_flashObject);
l_flashSubArray = m_flashValueStorage.CreateTemp
FlashArray();
j = 0;
while (j < m_menuData.Size()){
CurSubDataItem = m_menuData[j];
if (CurSubDataItem.ParentMenu == CurData
Item.MenuName){
l_flashSubObject = m_flashValueS
torage.CreateTempFlashObject(/* NOP */);
GetGFxMenuItem(CurSubDataItem, l
_flashSubObject);
l_flashSubArray.PushBackFlashObj
ect(l_flashSubObject);
}
j += 1;
}
subLen = l_flashSubArray.GetLength();
l_flashObject.SetMemberFlashArray("subItems", l_
flashSubArray);
StructGFx.PushBackFlashObject(l_flashObject);
}
i += 1;
}
/* NOP */;
}
private function GetGFxMenuItem(MenuItemData : SMenuTab, GFxObjectData :
CScriptedFlashObject){
GFxObjectData.SetMemberFlashUInt("id", NameToFlashUInt(MenuItemD
ata.MenuName));
GFxObjectData.SetMemberFlashString("name", NameToString(MenuItem
Data.MenuName));
GFxObjectData.SetMemberFlashString("icon", NameToString(MenuItem
Data.MenuName));
GFxObjectData.SetMemberFlashString("label", GetLocStringByKeyExt
(MenuItemData.MenuLabel));
GFxObjectData.SetMemberFlashString("tabDesc", GetLocStringByKeyE
xt(MenuItemData.MenuLabel + "_desc"));
GFxObjectData.SetMemberFlashString("tabNewDesc", "Nothing New");
GFxObjectData.SetMemberFlashBool("visible", MenuItemData.Visible
);
GFxObjectData.SetMemberFlashBool("enabled", MenuItemData.Enabled
&& !MenuItemData.Restricted);
GFxObjectData.SetMemberFlashString("state", MenuItemData.MenuSta

te);
/* NOP */;
}
private function UpdateTabs(){
UpdatePlayerOrens();
UpdatePlayerLevel();
UpdateItemsCounter();
/* NOP */;
}
public function SetMenuTabVisible(tabName : CName, value : Bool){
var j : Int32;
j = 0;
while (j < m_menuData.Size()){
if (m_menuData[j].MenuName == tabName){
m_menuData[j].Visible = value;
}
j += 1;
}
/* NOP */;
}
public function SetMenuTabeEnable(tabName : CName, value : Bool, stateNa
me : CName){
var j : Int32;
j = 0;
while (j < m_menuData.Size()){
if (m_menuData[j].MenuName == tabName && m_menuData[j].M
enuState == stateName){
m_menuData[j].Enabled = value;
}
j += 1;
}
/* NOP */;
}
public function SetSingleMenuTabEnabled(tabName : CName){
var j : Int32;
j = 0;
while (j < m_menuData.Size()){
if (m_menuData[j].MenuName == tabName){
m_menuData[j].Enabled = true;
} else {
m_menuData[j].Enabled = false;
}
j += 1;
}
/* NOP */;
}
public function GoNextMenu(){
m_fxNavigateNext.InvokeSelf();
/* NOP */;
}
public function GoPriorMenu(){
m_fxNavigatePrior.InvokeSelf();
/* NOP */;
}
public function ShowBackground(value : Bool){
m_flashValueStorage.SetFlashBool("panel.main.background.shows",
value, /* NOP */);
/* NOP */;
}
public function UpdatePlayerOrens(){

var orens : Int32;


orens = thePlayer.GetMoney();
m_fxUpdateMoney.InvokeSelfOneArg(FlashArgNumber(orens));
/* NOP */;
}
public function UpdatePlayerLevel(){
var curLevel : Int32;
var curExp : Float;
var levelExp : Float;
var targetExp : Float;
curLevel = GetCurrentLevel();
curExp = GetCurrentExperience();
levelExp = GetLevelExperience();
targetExp = GetTargetExperience();
m_fxUpdateLevel.InvokeSelfThreeArgs(FlashArgUInt(curLevel), Flas
hArgNumber(curExp - levelExp), FlashArgNumber(targetExp - levelExp));
/* NOP */;
}
public function UpdateItemsCounter() : Int32{
var encumbrance : Int32;
var encumbranceMax : Int32;
var _inv : CInventoryComponent;
var hasHorseUpgrade : Bool;
_inv = thePlayer.GetInventory();
encumbrance = GetWitcherPlayer().GetEncumbrance();
encumbranceMax = GetWitcherPlayer().GetMaxRunEncumbrance(hasHors
eUpgrade);
m_fxUpdateWeight.InvokeSelfTwoArgs(FlashArgUInt(encumbrance), Fl
ashArgUInt(encumbranceMax));
return encumbrance;
/* NOP */;
}
private function GetCurrentLevel() : Int32{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetLevel();
/* NOP */;
}
private function GetCurrentExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetPointsTotal(1);
/* NOP */;
}
private function GetLevelExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetTotalExpForCurrLevel();
/* NOP */;
}
private function GetTargetExperience() : Float{
var levelManager : W3LevelManager;
levelManager = GetWitcherPlayer().levelManager;
return levelManager.GetTotalExpForNextLevel();
/* NOP */;
}
public function SetMenuAlpha(value : Int32){
m_flashModule.SetAlpha(value);
/* NOP */;
}

public function CloseMenuRequest(){


var menu : CR4MenuBase;
menu = (CR4MenuBase)GetSubMenu();
if (!menu){
CloseMenu();
}
/* NOP */;
}
public function OnFailedCreateMenu() : Bool{
m_fxSubMenuClosed.InvokeSelf();
m_GFxBindings.Clear();
m_defaultBindings.Clear();
m_contextBindings.Clear();
UpdateInputFeedback();
/* NOP */;
}
public function ChildRequestCloseMenu(){
if (!m_hubEnabled){
CloseMenu();
} else {
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(GetM
enuName());
}
m_fxSubMenuClosed.InvokeSelf();
m_GFxBindings.Clear();
m_defaultBindings.Clear();
m_contextBindings.Clear();
UpdateInputFeedback();
if (m_parentMenu){
m_parentMenu.ChildRequestCloseMenu();
}
OnPlaySoundEvent("gui_global_panel_close");
/* NOP */;
}
public function UpdateGFxButtons(gfxButtonsList : array<SKeyBinding>, po
pulateData : Bool){
m_GFxBindings = gfxButtonsList;
if (populateData){
UpdateInputFeedback();
}
/* NOP */;
}
public function UpdateDefaultButtons(defaultButtonsList : array<SKeyBind
ing>, populateData : Bool){
m_defaultBindings = defaultButtonsList;
if (populateData){
UpdateInputFeedback();
}
/* NOP */;
}
public function UpdateContextButtons(contextButtonsList : array<SKeyBind
ing>, populateData : Bool){
m_contextBindings = contextButtonsList;
if (populateData){
UpdateInputFeedback();
}
/* NOP */;
}
protected function GatherBindersArray(resultArray : CScriptedFlashArray,
bindersList : array<SKeyBinding>, level : Int32, isContextBinding : Bool){

var tempFlashObject : CScriptedFlashObject;


var bindingGFxData : CScriptedFlashObject;
var curBinding : SKeyBinding;
var bindingsCount : Int32;
var i : Int32;
bindingsCount = bindersList.Size();
i = 0;
while (i < bindingsCount){
curBinding = bindersList[i];
tempFlashObject = m_flashValueStorage.CreateTempFlashObj
ect(/* NOP */);
bindingGFxData = tempFlashObject.CreateFlashObject("red.
game.witcher3.data.KeyBindingData");
bindingGFxData.SetMemberFlashString("gamepad_navEquivale
nt", curBinding.Gamepad_NavCode);
bindingGFxData.SetMemberFlashInt("keyboard_keyCode", cur
Binding.Keyboard_KeyCode);
if (curBinding.IsLocalized){
bindingGFxData.SetMemberFlashString("label", cur
Binding.LocalizationKey);
} else {
bindingGFxData.SetMemberFlashString("label", Get
LocStringByKeyExt(curBinding.LocalizationKey));
}
bindingGFxData.SetMemberFlashString("isContextBinding",
isContextBinding);
bindingGFxData.SetMemberFlashInt("level", level);
resultArray.PushBackFlashObject(bindingGFxData);
i += 1;
}
/* NOP */;
}
public function UpdateInputFeedback(){
var gfxDataList : CScriptedFlashArray;
gfxDataList = m_flashValueStorage.CreateTempFlashArray();
GatherBindersArray(gfxDataList, m_contextBindings, 2, true);
GatherBindersArray(gfxDataList, m_GFxBindings, 1, /* NOP */);
GatherBindersArray(gfxDataList, m_defaultBindings, 0, /* NOP */)
;
m_flashValueStorage.SetFlashArray("common.input.feedback.setup",
gfxDataList);
/* NOP */;
}
public function PlayOpenSoundEvent(){
OnPlaySoundEvent("gui_global_panel_open");
/* NOP */;
}
public function OnPlaySoundEvent(soundName : String) : Bool{
var currentSubMenu : CR4MenuBase;
currentSubMenu = (CR4MenuBase)GetSubMenu();
if (soundName != "gui_global_highlight" || !currentSubMenu){
super.OnPlaySoundEvent(soundName);
}
/* NOP */;
}
public function OnOpenSubPanel(menuName : CName) : Bool{
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosingMenu(GetM
enuName());

theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(menu
Name);
}
/* NOP */;
/* NOP */;
}
public function OnCloseSubPanel(menuName : CName) : Bool{
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosingMenu(menu
Name);
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(GetM
enuName());
}
/* NOP */;
/* NOP */;
}
public function OnControllerChanged(isGamepad : Bool) : Bool{
}
public function SetMeditationMode(value : Bool){
if (m_mode_meditation != value){
m_mode_meditation = value;
if (m_mode_meditation){
m_had_meditation = true;
}
}
/* NOP */;
}
private function StopMeditation(){
var medd : W3PlayerWitcherStateMeditation;
var waitt : W3PlayerWitcherStateMeditationWaiting;
if (m_had_meditation){
SetMeditationMode(false);
if (thePlayer.GetCurrentStateName() == 'MeditationWaitin
g'){
waitt = (W3PlayerWitcherStateMeditationWaiting)t
hePlayer.GetCurrentState();
if (waitt){
waitt.StopRequested(/* NOP */);
}
} else {
medd = (W3PlayerWitcherStateMeditation)GetWitche
rPlayer().GetCurrentState();
if (medd){
medd.StopRequested(/* NOP */);
}
}
}
/* NOP */;
}
private function SendLastItemInfoData(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetNewItemsGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.newestit
ems", l_flashSubArray);
/* NOP */;
}
private function SendQuestsInfoData(){
var l_flashSubArray : CScriptedFlashArray;

l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetTrackedQuestGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.quests",
l_flashSubArray);
/* NOP */;
}
private function SendGlossaryInfoData(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetGlossaryGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.glossary
", l_flashSubArray);
/* NOP */;
}
private function SendAlchemyInfoData(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetAlchemyGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.alchemy"
, l_flashSubArray);
/* NOP */;
}
private function SendSkillsInfoData(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetSkillGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.skills",
l_flashSubArray);
/* NOP */;
}
private function SendMappinInfoData(){
var l_flashSubArray : CScriptedFlashArray;
l_flashSubArray = m_flashValueStorage.CreateTempFlashArray();
GetMappinGFxMenuStruct(l_flashSubArray);
m_flashValueStorage.SetFlashArray("panel.main.panelinfo.map", l_
flashSubArray);
/* NOP */;
}
private function GetNewItemsGFxMenuStruct(StructGFx : CScriptedFlashArra
y){
var i : Int32;
var l_flashObject : CScriptedFlashObject;
var newestItems : array<SItemUniqueId>;
var _inv : CInventoryComponent;
var item : SItemUniqueId;
var iconPath : String;
var itemsDisplayed : Int32;
var m_guiManager : CR4GuiManager;
_inv = thePlayer.GetInventory();
m_guiManager = theGame.GetGuiManager();
if (!CheckCraftingComponent() && !CheckRepairPanelEnabled() && !
CheckShopPanelEnabled()){
newestItems = m_guiManager.GetNewestItems();
}
i = 0;
while (i < newestItems.Size()){
item = newestItems[i];
if (_inv.IsIdValid(item) && !_inv.ItemHasTag(item, 'NoSh
ow')){
l_flashObject = m_flashValueStorage.CreateTempFl

ashObject(/* NOP */);


iconPath = _inv.GetItemIconPathByUniqueID(item);
l_flashObject.SetMemberFlashString("iconName", i
conPath);
l_flashObject.SetMemberFlashString("category", G
etLocStringByKeyExt("item_category_" + _inv.GetItemCategory(item)) + " " + GetIt
emRarityDescriptionFromInt(_inv.GetItemQuality(item)));
l_flashObject.SetMemberFlashString("itemName", G
etLocStringByKeyExt(_inv.GetItemLocalizedNameByUniqueID(item)));
StructGFx.PushBackFlashObject(l_flashObject);
}
i += 1;
}
m_fxSetShopInventory.InvokeSelfOneArg(FlashArgBool(CheckShopPane
lEnabled() || CheckCraftingComponent()));
/* NOP */;
}
private function GetTrackedQuestGFxMenuStruct(StructGFx : CScriptedFlash
Array){
var l_flashObject : CScriptedFlashObject;
var curTrackedQuest : CJournalQuest;
var curHighlightedObjective : CJournalQuestObjective;
curTrackedQuest = theGame.GetJournalManager().GetTrackedQuest();
curHighlightedObjective = theGame.GetJournalManager().GetHighlig
htedObjective();
l_flashObject = m_flashValueStorage.CreateTempFlashObject(/* NOP
*/);
if (curTrackedQuest){
l_flashObject.SetMemberFlashString("questName", GetLocSt
ringById(curTrackedQuest.GetTitleStringId()));
l_flashObject.SetMemberFlashString("objectiveName", GetL
ocStringById(curHighlightedObjective.GetTitleStringId()));
} else {
l_flashObject.SetMemberFlashString("questName", "");
l_flashObject.SetMemberFlashString("objectiveName", "");
}
StructGFx.PushBackFlashObject(l_flashObject);
/* NOP */;
}
private function GetGlossaryGFxMenuStruct(StructGFx : CScriptedFlashArra
y){
var l_flashObject : CScriptedFlashObject;
var m_guiManager : CR4GuiManager;
var glossaryEntries : array<SGlossaryEntry>;
var i : Int32;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_guiManager = theGame.GetGuiManager();
glossaryEntries = m_guiManager.GetNewGlossaryEntries();
i = 0;
while (i < glossaryEntries.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("topText", GetLocStri
ngByKeyExt(glossaryEntries[i].panelName));
if (glossaryEntries[i].newEntry){
l_flashObject.SetMemberFlashString("bottomText",
GetEntryTitle(glossaryEntries[i].newEntry));
} else {
m_definitionsManager = theGame.GetDefinitionsMan
ager();

l_flashObject.SetMemberFlashString("bottomText",
GetLocStringByKeyExt(m_definitionsManager.GetItemLocalisationKeyName(glossaryEn
tries[i].tag)));
}
StructGFx.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
private function GetAlchemyGFxMenuStruct(StructGFx : CScriptedFlashArray
){
var l_flashObject : CScriptedFlashObject;
var m_guiManager : CR4GuiManager;
var alchemyEntries : array<SGlossaryEntry>;
var i : Int32;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_guiManager = theGame.GetGuiManager();
alchemyEntries = m_guiManager.GetNewAlchemyEntries();
i = 0;
while (i < alchemyEntries.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("topText", GetLocStri
ngByKeyExt(alchemyEntries[i].panelName));
m_definitionsManager = theGame.GetDefinitionsManager();
l_flashObject.SetMemberFlashString("bottomText", GetLocS
tringByKeyExt(m_definitionsManager.GetItemLocalisationKeyName(alchemyEntries[i].
tag)));
StructGFx.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
public function GetEntryTitle(journalBase : CJournalBase) : String{
var journalCreature : CJournalCreature;
var journalCharacter : CJournalCharacter;
var journalGlossary : CJournalGlossary;
journalCreature = (CJournalCreature)journalBase;
if (journalCreature){
return GetLocStringById(journalCreature.GetNameStringId(
));
}
journalCharacter = (CJournalCharacter)journalBase;
if (journalCharacter){
return GetLocStringById(journalCharacter.GetNameStringId
());
}
journalGlossary = (CJournalGlossary)journalBase;
if (journalGlossary){
return GetLocStringById(journalGlossary.GetTitleStringId
());
}
return "";
/* NOP */;
}
private function GetSkillGFxMenuStruct(StructGFx : CScriptedFlashArray){
var l_flashObject : CScriptedFlashObject;
var m_guiManager : CR4GuiManager;
var skillEntries : array<ESkill>;
var skillStruct : SSkill;

var i : Int32;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_guiManager = theGame.GetGuiManager();
skillEntries = m_guiManager.GetNewSkillsEntries();
i = 0;
while (i < skillEntries.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
skillStruct = thePlayer.GetPlayerSkill(skillEntries[i]);
l_flashObject.SetMemberFlashString("topText", GetLocStri
ngByKeyExt(skillStruct.localisationNameKey));
l_flashObject.SetMemberFlashString("bottomText", GetLocS
tringByKeyExt(SkillPathTypeToLocalisationKey(skillStruct.skillPath)));
StructGFx.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
private function GetMappinGFxMenuStruct(StructGFx : CScriptedFlashArray)
{
var l_flashObject : CScriptedFlashObject;
var m_guiManager : CR4GuiManager;
var mappinEntries : array<SMappinEntry>;
var i : Int32;
var m_definitionsManager : CDefinitionsManagerAccessor;
m_guiManager = theGame.GetGuiManager();
mappinEntries = m_guiManager.GetNewMappinEntries();
i = 0;
while (i < mappinEntries.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("topText", GetLocStri
ngByKeyExt(StrLower("map_location_" + mappinEntries[i].newMappin)));
if (mappinEntries[i].newMappinType != 'None'){
l_flashObject.SetMemberFlashString("bottomText",
GetLocStringByKeyExt(StrLower("map_location_" + mappinEntries[i].newMappinType)
));
l_flashObject.SetMemberFlashString("type", mappi
nEntries[i].newMappinType);
} else {
l_flashObject.SetMemberFlashString("bottomText",
"");
l_flashObject.SetMemberFlashString("type", mappi
nEntries[i].newMappin);
}
StructGFx.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
public function OnRefreshHubInfo(fromAs : Bool) : Bool{
SendQuestsInfoData();
SendSkillsInfoData();
SendLastItemInfoData();
if (!fromAs){
SendGlossaryInfoData();
SendAlchemyInfoData();
SendMappinInfoData();
}
/* NOP */;

}
public function OnVideoStopped() : Bool{
var menuSprite : CScriptedFlashSprite;
var menuSprite2 : CScriptedFlashSprite;
var menuStorybook : CR4GlossaryStorybookMenu;
menuStorybook = (CR4GlossaryStorybookMenu)GetSubMenu();
if (menuStorybook.bMovieIsPlaying){
menuSprite2 = GetMenuFlash();
menuSprite2.SetVisible(true);
menuStorybook.SetMovieIsPlaying(false);
menuStorybook.ShowMenuAgain();
}
/* NOP */;
}
public function SetLockedInHub(value : Bool){
m_lockedInHub = value;
m_fxBlockHubClosing.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
public function SetLockedInMenu(value : Bool){
var childMenu : CR4MenuBase;
m_lockedInMenu = value;
childMenu = GetLastChild();
if (childMenu){
childMenu.UpdateRestrictDirectClosing(value);
}
m_fxBlockMenuClosing.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
public function IsLockedInHub() : Bool{
return m_lockedInHub;
/* NOP */;
}
public function IsLockedInMenu() : Bool{
return m_lockedInMenu;
/* NOP */;
}
public function OnHotkeyTriggered(keyCode : EInputKey) : Bool{
var childMenu : CR4MenuBase;
var invMenu : CR4InventoryMenu;
var charMenu : CR4CharacterMenu;
var mapMenu : CR4MapMenu;
var jourMenu : CR4JournalQuestMenu;
var alchMenu : CR4AlchemyMenu;
var bestMenu : CR4GlossaryBestiaryMenu;
var glossMenu : CR4GlossaryEncyclopediaMenu;
var medMenu : CR4MeditationClockMenu;
var craftMenu : CR4CraftingMenu;
childMenu = GetLastChild();
if (childMenu && !IsLockedInHub() && !IsLockedInMenu()){
if (keyCode == 73){
invMenu = (CR4InventoryMenu)childMenu;
if (invMenu){
invMenu.CloseMenu();
CloseMenu();
} else if (HasMenuWithStateDefined('InventoryMen
u', 'CharacterInventory') && thePlayer.IsActionAllowed(2)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('InventoryMenu')), FlashArgString('CharacterInventory'));
m_fxEnterCurrentTab.InvokeSelf();

}
} else if (keyCode == 75){
charMenu = (CR4CharacterMenu)childMenu;
if (charMenu){
charMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('CharacterMenu') && th
ePlayer.IsActionAllowed(16)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('CharacterMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 77){
mapMenu = (CR4MapMenu)childMenu;
if (mapMenu){
mapMenu.CloseMenu();
CloseMenu();
} else if (HasMenuWithStateDefined('MapMenu', 'G
lobalMap') && thePlayer.IsActionAllowed(15)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('MapMenu')), FlashArgString('GlobalMap'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 74){
jourMenu = (CR4JournalQuestMenu)childMenu;
if (jourMenu){
jourMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('JournalQuestMenu') &&
thePlayer.IsActionAllowed(17)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('JournalQuestMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 76){
alchMenu = (CR4AlchemyMenu)childMenu;
if (alchMenu){
alchMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('AlchemyMenu') && theP
layer.IsActionAllowed(18)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('AlchemyMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 66){
bestMenu = (CR4GlossaryBestiaryMenu)childMenu;
if (bestMenu){
bestMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('GlossaryBestiaryMenu'
) && thePlayer.IsActionAllowed(36)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('GlossaryBestiaryMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 71){
glossMenu = (CR4GlossaryEncyclopediaMenu)childMe
nu;
if (glossMenu){

glossMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('GlossaryEncyclopediaM
enu') && thePlayer.IsActionAllowed(36)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('GlossaryEncyclopediaMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 78){
medMenu = (CR4MeditationClockMenu)childMenu;
if (medMenu){
medMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('MeditationClockMenu')
&& thePlayer.IsActionAllowed(46)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('MeditationClockMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
} else if (keyCode == 79 && theGame.GameplayFactsQuerySu
m("shopMode") == 0){
craftMenu = (CR4CraftingMenu)childMenu;
if (craftMenu){
craftMenu.CloseMenu();
CloseMenu();
} else if (HasMenuDefined('CraftingMenu') && the
Player.IsActionAllowed(36)){
m_fxSelectTab.InvokeSelfTwoArgs(FlashArg
UInt(NameToFlashUInt('CraftingMenu')), FlashArgString('None'));
m_fxEnterCurrentTab.InvokeSelf();
}
}
}
/* NOP */;
}
public function OnCloseMenu() : Bool{
if (!m_lockedInHub){
CloseMenu();
}
/* NOP */;
}
}
class CAINpcCriticalStateFlying extends CAICombatActionTree{
public editable inlined var params : CAINpcCriticalStateParams;
public function Init(){
params = new CAINpcCriticalStateParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIMonsterCombatLogicParams extends CAISubTreeParameters{
}
class CAIGravehagCombatLogicParams extends CAIMonsterCombatLogicParams{
public editable inlined var mistForm : Bool;
public editable inlined var mudThrow : Bool;
public editable inlined var witchSpecialAttack : Bool;
}

class CAIFlyingMonsterCombatLogic extends CAIMonsterCombatLogic{


}
class CAIWolfCombatLogicParams extends CAIMonsterCombatLogicParams{
public editable var attackMovementType : EMoveType;
public function Init(){
attackMovementType = 1;
/* NOP */;
}
}
class CAIArachasCombatLogicParams extends CAIMonsterCombatLogicParams{
public editable var minChargeDist : Float;
public editable var maxChargeDist : Float;
public function Init(){
minChargeDist = 7.000000;
maxChargeDist = 8.000000;
/* NOP */;
}
}
class CAIDamageReactionTreeParams extends CAISubTreeParameters{
public editable var completeTaskAfterDisablingHitReaction : Bool;
public editable var enableTeleportOnHit : Bool;
public function Init(){
completeTaskAfterDisablingHitReaction = true;
enableTeleportOnHit = false;
/* NOP */;
}
}
class CAIFinisherTreeParams extends CAICombatActionParameters{
public editable var syncAnimName : CName;
}
class CAIMonsterSpawnParams
public editable var
public editable var
public editable var
public editable var
public editable var
}

extends CAISubTreeParameters{
fxName : CName;
animEventNameActivator : CName;
playFXOnAnimEvent : Bool;
monitorGroundContact : Bool;
dealDamageOnAnimEvent : CName;

class CAIMonsterDefeatedParams extends CAIDeathParameters{


public editable inlined var localDeathTree : CAIMonsterDeath;
public editable inlined var unconsciousTree : CAINpcUnconsciousTree;
public function Init(){
localDeathTree = new CAIMonsterDeath in this;
localDeathTree.OnCreated();
unconsciousTree = new CAINpcUnconsciousTree in this;
unconsciousTree.OnCreated();
/* NOP */;
}
}
class CAINpcUnconsciousTree extends CAIDeathTree{
public editable inlined var params : CAINpcUnconsciousParams;
public function Init(){
params = new CAINpcUnconsciousParams in this;

params.OnCreated();
/* NOP */;
}
}
import abstract class CEntitiesDetector{
}
class CAIMonsterReactionsTreeParams extends CAIReactionsParameters{
public editable inlined var reactions : array<CAIMonsterActionSubtree>;
public editable var canFly : Bool;
}
abstract class CAIMonsterActionSubtree extends CAINpcActionSubtree{
}
class CAIReactionHowl extends CAINpcReaction{
}
class CAIActionSearchForTarget extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionSearchTarget in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionAllySearchesTarget extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionJoinSearchForTarget in thi
s;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionPlayWithTarget extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionPlayWithTarget in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionMoveToLure extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionMoveToLure in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionMoveOut extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionMoveOut in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}

class CAIActionMoveInPack extends CAIMonsterActionSubtree{


public editable var chanceToFollowPack : Float;
public function Init(){
reactionLogicTree = new CAINpcReactionMoveInPack in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionRunWildInPack extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionRunWildInPack in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionLeadEscape extends CAIMonsterActionSubtree{
public editable var saveReactionTargetUnder : CName;
public function Init(){
reactionLogicTree = new CAINpcReactionLeadEscape in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAIActionEscapeInPack extends CAIMonsterActionSubtree{
public function Init(){
reactionLogicTree = new CAINpcReactionEscapeInPack in this;
reactionLogicTree.OnCreated();
/* NOP */;
}
}
class CAINpcCombat extends CAICombatTree{
public editable inlined var params : CAINpcCombatParams;
public function Init(){
params = new CAINpcCombatParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCombatParams extends CAICombatParameters{
public editable var scaredCombat : Bool;
public editable inlined var scaredBranch : CAIScaredSubTree;
public editable inlined var combatStyles : array<CAINpcCombatStyle>;
public editable inlined var criticalState : CAINpcCriticalState;
public editable var preferedCombatStyle : EBehaviorGraph;
public editable var increaseHitCounterOnlyOnMelee : Bool;
public editable var reachabilityTolerance : Float;
public editable var targetOnlyPlayer : Bool;
public editable var hostileActorWeight : Float;
public editable var currentTargetWeight : Float;
public editable var rememberedHits : Int32;
public editable var hitterWeight : Float;
public editable var maxWeightedDistance : Float;
public editable var distanceWeight : Float;
public editable var playerWeightProbability : Int32;
public editable var playerWeight : Float;

public
public
public
public
public
public

editable var skipVehicle : ECombatTargetSelectionSkipTarget;


editable var skipVehicleProbability : Int32;
editable var skipUnreachable : ECombatTargetSelectionSkipTarget;
editable var skipUnreachableProbability : Int32;
editable var monsterWeight : Float;
function Init(){
SetupCombatStyles();
scaredBranch = new CAIScaredTree in this;
scaredBranch.OnCreated();
criticalState = new CAINpcCriticalState in this;
criticalState.OnCreated();
criticalState.params.FinisherAnim = 'HumanKnockDownFinisher';
/* NOP */;

}
protected function SetupCombatStyles(){
combatStyles.Clear();
/* NOP */;
}
protected function SetupCSFinisherAnims(){
}
protected function ClearCSFinisherAnims(){
criticalState.params.FinisherAnim = 'None';
/* NOP */;
}
public function InitializeCombatStyles(){
var i : Int32;
i = 0;
while (i < combatStyles.Size()){
combatStyles[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcCombatStyle extends CAISubTree{
public editable inlined var params : CAINpcCombatStyleParams;
public var highPriority : Bool;
public function Init(){
params = new CAINpcCombatStyleParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcDefaults extends CAIDefaults{
public editable inlined var npcGroupType : CAINPCGroupTypeRedefinition;
public editable inlined var combatTree : CAINpcCombat;
public editable inlined var idleTree : CAIIdleTree;
public editable inlined var deathTree : CAIDeathTree;
public editable inlined var reactionTree : CAINpcReactionsTree;
public editable inlined var softReactionTree : CAISoftReactionTree;
public editable var hasDrinkingMinigame : Bool;
public var tempNpcGroupType : ENPCGroupType;
public function Init(){
combatTree = new CAINpcCombat in this;
combatTree.OnCreated();
idleTree = new CAIIdleTree in this;
idleTree.OnCreated();
deathTree = new CAINpcDeath in this;

deathTree.OnCreated();
/* NOP */;
}
}
class CR4MenuBase extends CR4Menu{
protected var m_flashValueStorage : CScriptedFlashValueStorage;
protected var m_flashModule : CScriptedFlashSprite;
protected var m_parentMenu : CR4MenuBase;
protected var m_fxBlurLayer : CScriptedFlashFunction;
protected var m_fxSetState : CScriptedFlashFunction;
protected var m_fxSetColorBlindMode : CScriptedFlashFunction;
protected var m_fxSetCurrentModule : CScriptedFlashFunction;
protected var m_fxSetIsInCombat : CScriptedFlashFunction;
protected var m_fxShowSecondaryModulesSFF : CScriptedFlashFunction;
protected var m_fxSetArabicAligmentMode : CScriptedFlashFunction;
protected var m_fxSetRestrictDirectClosing : CScriptedFlashFunction;
protected var m_fxSwapAcceptCancel : CScriptedFlashFunction;
protected var m_fxSetControllerType : CScriptedFlashFunction;
protected var m_fxSetPlatform : CScriptedFlashFunction;
protected var m_fxSetGamepadType : CScriptedFlashFunction;
protected var m_fxLockControlScheme : CScriptedFlashFunction;
protected var m_menuState : CName;
protected var m_notificationData : W3TutorialPopupData;
protected var m_currentContext : W3UIContext;
protected var m_defaultInputBindings : array<SKeyBinding>;
protected var m_GFxInputBindings : array<SKeyBinding>;
protected var m_guiManager : CR4GuiManager;
protected var m_commonMenu : CR4CommonMenu;
protected var UISavedData : SUISavedData;
protected var m_lastSelectedModule : Int32;
protected var m_hideTutorial : Bool;
protected var m_forceHideTutorial : Bool;
protected var m_configUICalled : Bool;
protected var m_initialSelectionsToIgnore : Int32;
public function OnConfigUI() : Bool{
var menuInitData : W3MenuInitData;
var defaultState : CName;
var invMenu : CR4InventoryMenu;
var commonMenu : CR4CommonMenu;
var menuName : CName;
m_guiManager = theGame.GetGuiManager();
m_flashValueStorage = GetMenuFlashValueStorage();
m_flashModule = GetMenuFlash();
m_fxSetControllerType = m_flashModule.GetMemberFlashFunction("se
tControllerType");
m_fxSetPlatform = m_flashModule.GetMemberFlashFunction("setPlatf
orm");
m_fxBlurLayer = m_flashModule.GetMemberFlashFunction("setBackgro
undEffect");
m_fxSetState = m_flashModule.GetMemberFlashFunction("setMenuStat
e");
m_fxSetColorBlindMode = m_flashModule.GetMemberFlashFunction("se
tColorBlindMode");
m_fxShowSecondaryModulesSFF = m_flashModule.GetMemberFlashFuncti
on("ShowSecondaryModules");
m_fxSetCurrentModule = m_flashModule.GetMemberFlashFunction("set
CurrentModule");
m_fxSetArabicAligmentMode = m_flashModule.GetMemberFlashFunction
("setArabicAligmentMode");

m_fxSetRestrictDirectClosing = m_flashModule.GetMemberFlashFunct
ion("setRestrictDirectClosing");
m_fxSwapAcceptCancel = m_flashModule.GetMemberFlashFunction("swa
pAcceptCancel");
m_fxSetGamepadType = m_flashModule.GetMemberFlashFunction("setGa
mepadType");
m_fxLockControlScheme = m_flashModule.GetMemberFlashFunction("lo
ckControlScheme");
m_parentMenu = (CR4MenuBase)GetParent();
menuInitData = (W3MenuInitData)GetMenuInitData();
if (menuInitData){
defaultState = menuInitData.getDefaultState();
if (defaultState != 'None'){
SetMenuState(defaultState);
}
}
GetSavedData();
UpdateControlSchemeLock();
SetControllerType(theInput.LastUsedGamepad());
SetPlatformType(theGame.GetPlatform());
UpdateAcceptCancelSwaping();
PlayOpenSoundEvent();
m_defaultInputBindings.Clear();
SetButtons();
if (m_hideTutorial){
SetTutorialVisibility(false, m_forceHideTutorial);
}
setColorBlindMode(theGame.getColorBlindMode());
setArabicAligmentMode();
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
invMenu = (CR4InventoryMenu)this;
menuName = GetMenuName();
if (invMenu){
if ((CNewNPC)(W3InventoryInitData)GetMenuInitDat
a().containerNPC){
menuName = 'ShopMenu';
}
}
theGame.GetTutorialSystem().uiHandler.OnOpeningMenu(menu
Name);
}
commonMenu = (CR4CommonMenu)m_parentMenu;
if (commonMenu){
UpdateRestrictDirectClosing(commonMenu.IsLockedInMenu())
;
commonMenu.ChildMenuConfigured();
}
m_configUICalled = true;
/* NOP */;
}
public function OnFailedCreateMenu() : Bool{
}
public function OnClearSlotNewFlag(item : SItemUniqueId) : Bool{
}
public function UpdateRestrictDirectClosing(value : Bool){
m_fxSetRestrictDirectClosing.InvokeSelfOneArg(FlashArgBool(value
));
/* NOP */;
}

public function ActionBlockStateChange(action : EInputActionBlock, block


ed : Bool){
}
public function OnSendNotification(locKey : String) : Bool{
showNotification(GetLocStringByKeyExt(locKey), /* NOP */);
if (locKey == "menu_cannot_perform_action_combat"){
OnPlaySoundEvent("gui_global_denied");
}
/* NOP */;
}
protected function SetTutorialVisibility(value : Bool, forced : Bool){
theGame.GetGuiManager().HideTutorial(!value, forced);
/* NOP */;
}
protected function SendCombatState(){
if (!m_fxSetIsInCombat){
m_fxSetIsInCombat = m_flashModule.GetMemberFlashFunction
("setInCombat");
}
m_fxSetIsInCombat.InvokeSelfOneArg(FlashArgBool(thePlayer.IsInCo
mbat()));
/* NOP */;
}
protected function GetSavedData(){
UISavedData = m_guiManager.GetUISavedData(GetSavedDataMenuName()
);
/* NOP */;
}
protected function GetSavedDataMenuName() : CName{
return GetMenuName();
/* NOP */;
}
public function OnRequestSubMenu(menuName : CName, initData : IScriptabl
e){
RequestSubMenu(menuName, initData);
/* NOP */;
}
protected function IsCategoryOpened(categoryName : CName) : Bool{
var i : Int32;
i = 0;
while (i < UISavedData.openedCategories.Size()){
if (UISavedData.openedCategories[i] == categoryName){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
protected function UpdateAcceptCancelSwaping(){
var inGameConfigWrapper : CInGameConfigWrapper;
var configValue : Bool;
if (m_fxSwapAcceptCancel){
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
configValue = inGameConfigWrapper.GetVarValue('Controls'
, 'SwapAcceptCancel');
m_fxSwapAcceptCancel.InvokeSelfOneArg(FlashArgBool(confi
gValue));
}
/* NOP */;

}
protected function UpdateControlSchemeLock(){
if (m_fxLockControlScheme && m_guiManager){
m_fxLockControlScheme.InvokeSelfOneArg(FlashArgUInt(m_gu
iManager.GetLockedControlScheme()));
}
/* NOP */;
}
public function UpdateInputDevice(){
var isGamepad : Bool;
isGamepad = theInput.LastUsedGamepad();
SetControllerType(isGamepad);
/* NOP */;
}
protected function SetControllerType(isGamepad : Bool){
if (m_fxSetControllerType){
m_fxSetControllerType.InvokeSelfOneArg(FlashArgBool(isGa
mepad));
}
/* NOP */;
}
public function SetPlatformType(platformType : Platform){
if (m_fxSetPlatform){
m_fxSetPlatform.InvokeSelfOneArg(FlashArgInt(platformTyp
e));
}
/* NOP */;
}
protected function UpdateSceneEntityFromCreatureDataComponent(entity : C
Entity){
var creatureDataComponent : CCreatureDataComponent;
var environmentSunRotation : EulerAngles;
var cameraLookAt : Vector;
var cameraRotation : EulerAngles;
var cameraDistance : Float;
var fov : Float;
var guiSceneController : CR4GuiSceneController;
var entityPosition : Vector;
var entityRotation : EulerAngles;
var entityScale : Vector;
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
if (guiSceneController){
creatureDataComponent = (CCreatureDataComponent)entity.G
etComponentByClassName('CCreatureDataComponent');
if (creatureDataComponent){
environmentSunRotation.Yaw = creatureDataCompone
nt.GetEnvironmentSunRotationYaw();
environmentSunRotation.Pitch = creatureDataCompo
nent.GetEnvironmentSunRotationPitch();
cameraLookAt.X = 0;
cameraLookAt.Y = 0;
cameraLookAt.Z = creatureDataComponent.GetCamera
LookAtZ();
cameraRotation.Yaw = creatureDataComponent.GetCa
meraRotationYaw();
cameraRotation.Pitch = creatureDataComponent.Get
CameraRotationPitch();
cameraRotation.Roll = 0;
cameraDistance = creatureDataComponent.GetCamera

Distance();
fov = creatureDataComponent.getFov();
entityPosition = creatureDataComponent.GetEntity
Position();
entityRotation = creatureDataComponent.GetEntity
Rotation();
entityScale = creatureDataComponent.getEntitySca
le();
guiSceneController.SetEnvironmentAndSunRotation(
"environment\definitions\novigrad\env_burning_village.env", environmentSunRotati
on);
guiSceneController.SetCamera(cameraLookAt, camer
aRotation, cameraDistance, fov);
guiSceneController.SetEntityTransform(entityPosi
tion, entityRotation, entityScale);
}
}
m_flashValueStorage.SetFlashBool("render.to.texture.texture.visi
ble", true, /* NOP */);
m_flashValueStorage.SetFlashBool("render.to.texture.loading", fa
lse, /* NOP */);
/* NOP */;
}
protected function ShowRenderToTexture(targetName : String){
var templateFilename : String;
var appearance : CName;
var environmentFilename : String;
var environmentSunRotation : EulerAngles;
var cameraLookAt : Vector;
var cameraRotation : EulerAngles;
var cameraDistance : Float;
var fov : Float;
var guiSceneController : CR4GuiSceneController;
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
m_flashValueStorage.SetFlashBool("render.to.texture.texture.visi
ble", false, /* NOP */);
if (targetName != ""){
m_flashValueStorage.SetFlashBool("render.to.texture.load
ing", true, /* NOP */);
templateFilename = targetName;
appearance = 'None';
environmentSunRotation.Yaw = 0;
environmentSunRotation.Pitch = 0;
cameraLookAt.Z = 1;
cameraRotation.Yaw = 200;
cameraRotation.Pitch = 350;
cameraDistance = 2.500000;
fov = 70.000000;
guiSceneController.SetEntityTemplate(templateFilename);
guiSceneController.SetCamera(cameraLookAt, cameraRotatio
n, cameraDistance, fov);
guiSceneController.SetEnvironmentAndSunRotation("environ
ment\definitions\novigrad\env_burning_village.env", environmentSunRotation);
guiSceneController.SetEntityAppearance(appearance);
}
/* NOP */;
}
public function SetMenuNavigationEnabled(enabled : Bool){
var commonMenuRef : CR4CommonMenu;

commonMenuRef = theGame.GetGuiManager().GetCommonMenu();
commonMenuRef.SetMenuNavigationEnabled(enabled);
/* NOP */;
}
public function SetButtons(){
var RootMenu : CR4CommonMenu;
RootMenu = (CR4CommonMenu)GetRootMenu();
if (RootMenu){
RootMenu.UpdateDefaultButtons(m_defaultInputBindings, tr
ue);
}
/* NOP */;
}
public function OnMenuShown() : Bool{
HandleMenuLoaded();
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpenedMenu(GetMe
nuName());
}
/* NOP */;
}
public function showNotification(notificationText : String, duration : F
loat){
theGame.GetGuiManager().ShowNotification(notificationText, durat
ion);
/* NOP */;
}
public function OnClosingMenu() : Bool{
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.RemoveContextButtons(GetMenuName());
}
ResetContext();
if (theGame.GetTutorialSystem() && theGame.GetTutorialSystem().I
sRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosingMenu(GetM
enuName());
}
if (m_hideTutorial){
SetTutorialVisibility(true, m_forceHideTutorial);
}
/* NOP */;
}
public function OnCloseMenu() : Bool{
CloseMenu();
/* NOP */;
}
public function RestoreInput(){
m_flashValueStorage.SetFlashBool("restore.input", true, -1);
/* NOP */;
}
public function SetParentMenu(menu : CR4MenuBase){
m_parentMenu = menu;
/* NOP */;
}
public function GetParentMenu() : CR4MenuBase{
return m_parentMenu;

/* NOP */;
}
public function OnBreakPoint(text : String) : Bool{
/* NOP */;
/* NOP */;
}
public function UpdateButtons(ButtonsDef : array<SMenuButtonDef>){
}
public function UpdateButton(ButtonDef : SMenuButtonDef, ID : Int32){
}
protected function AddButtonDef(targetList : array<SMenuButtonDef>, navC
ode : String, label : String){
var ButtonDef : SMenuButtonDef;
ButtonDef.NavigationCode = navCode;
ButtonDef.LocalisationKey = label;
ButtonDef.enabled = true;
targetList.PushBack(ButtonDef);
/* NOP */;
}
protected function AddInputBinding(label : String, padNavCode : String,
keyboardKeyCode : Int32){
var bindingDef : SKeyBinding;
bindingDef.Gamepad_NavCode = padNavCode;
bindingDef.Keyboard_KeyCode = keyboardKeyCode;
bindingDef.LocalizationKey = label;
m_defaultInputBindings.PushBack(bindingDef);
/* NOP */;
}
public function setColorBlindMode(value : Bool){
if (m_fxSetColorBlindMode){
m_fxSetColorBlindMode.InvokeSelfOneArg(FlashArgBool(valu
e));
}
/* NOP */;
}
public function setArabicAligmentMode(){
var language : String;
var audioLanguage : String;
theGame.GetGameLanguageName(audioLanguage, language);
if (m_fxSetArabicAligmentMode){
m_fxSetArabicAligmentMode.InvokeSelfOneArg(FlashArgBool(
language == "AR"));
}
/* NOP */;
}
public function GetLastChild() : CR4MenuBase{
var subMenu : CR4MenuBase;
subMenu = (CR4MenuBase)GetSubMenu();
if (subMenu){
return subMenu.GetLastChild();
} else {
return this;
}
/* NOP */;
}
public function SetMenuState(newState : CName){
m_menuState = newState;
m_fxSetState.InvokeSelfOneArg(FlashArgString(newState));
/* NOP */;
}

public function BlurLayer(value : Bool){


m_fxBlurLayer.InvokeSelfOneArg(FlashArgBool(value));
/* NOP */;
}
protected function HandleMenuLoaded(){
var RootMenu : CR4CommonMenu;
RootMenu = (CR4CommonMenu)GetRootMenu();
if (RootMenu){
RootMenu.ShowBackground(false);
}
/* NOP */;
}
protected function ActivateContext(targetContext : W3UIContext){
var RootMenu : CR4CommonMenu;
RootMenu = (CR4CommonMenu)GetRootMenu();
if (RootMenu){
RootMenu.m_contextManager.ActivateContext(targetContext)
;
}
/* NOP */;
}
protected function ResetContext(){
if (m_currentContext){
m_currentContext.Deactivate();
delete m_currentContext;
m_currentContext = NULL;
}
/* NOP */;
}
protected function GetRootMenu() : CR4MenuBase{
var curParent : CR4MenuBase;
curParent = (CR4MenuBase)GetParent();
if (curParent){
return curParent.GetRootMenu();
} else {
return this;
}
/* NOP */;
}
public function ChildRequestCloseMenu(){
}
public function OnPlaySoundEvent(soundName : String) : Bool{
if (soundName == "gui_global_highlight"){
if (m_initialSelectionsToIgnore == 0){
theSound.SoundEvent(soundName);
} else {
m_initialSelectionsToIgnore -= 1;
}
} else {
theSound.SoundEvent(soundName);
}
/* NOP */;
}
public function PlayOpenSoundEvent(){
OnPlaySoundEvent("gui_global_panel_open");
/* NOP */;
}
public function OnModuleSelected(moduleID : Int32, moduleBindingName : S
tring) : Bool{
if (m_lastSelectedModule != moduleID){

OnPlaySoundEvent("gui_global_highlight");
}
m_lastSelectedModule = moduleID;
/* NOP */;
UISavedData.selectedModule = moduleID;
/* NOP */;
}
public function OnAppendButton(actionId : Int32, gamepadNavCode : String
, keyboardKeyCode : Int32, label : String) : Bool{
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.AppendButton(actionId, gamepadNavCode, k
eyboardKeyCode, label, GetMenuName());
}
/* NOP */;
}
public function OnRemoveButton(actionId : Int32) : Bool{
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.RemoveButton(actionId, GetMenuName());
}
/* NOP */;
}
public function OnCleanupButtons() : Bool{
var overlayPopupRef : CR4OverlayPopup;
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.RemoveContextButtons(GetMenuName());
}
/* NOP */;
}
public function OnUpdateGFxButtonsList() : Bool{
var commonMenuRef : CR4CommonMenu;
commonMenuRef = GetCommonMenu();
if (commonMenuRef){
commonMenuRef.UpdateGFxButtons(m_GFxInputBindings, true)
;
}
/* NOP */;
}
public function OnAppendGFxButton(actionId : Int32, gamepadNavCode : Str
ing, keyboardKeyCode : Int32, label : String, holdPrefix : Bool) : Bool{
var newButtonDef : SKeyBinding;
RemoveGFxButtonById(actionId);
newButtonDef.ActionID = actionId;
newButtonDef.Gamepad_NavCode = gamepadNavCode;
newButtonDef.Keyboard_KeyCode = keyboardKeyCode;
if (holdPrefix){
newButtonDef.LocalizationKey = GetHoldLabel() + " " + Ge
tLocStringByKeyExt(label);
newButtonDef.IsLocalized = true;
} else {
newButtonDef.LocalizationKey = label;
}
m_GFxInputBindings.PushBack(newButtonDef);

/* NOP */;
}
public function OnRemoveGFxButton(actionId : Int32) : Bool{
RemoveGFxButtonById(actionId);
/* NOP */;
}
protected function RemoveGFxButtonById(actionId : Int32){
var idx : Int32;
var len : Int32;
len = m_GFxInputBindings.Size();
idx = 0;
while (idx < len){
if (m_GFxInputBindings[idx].ActionID == actionId){
m_GFxInputBindings.Erase(idx);
return;
}
idx += 1;
}
/* NOP */;
}
protected function SelectCurrentModule(){
m_fxSetCurrentModule.InvokeSelfOneArg(FlashArgInt(UISavedData.se
lectedModule));
/* NOP */;
}
protected function SelectFirstModule(){
m_fxSetCurrentModule.InvokeSelfOneArg(FlashArgInt(0));
/* NOP */;
}
public function OnInputHandled(NavCode : String, KeyCode : Int32, Action
Id : Int32) : Bool{
/* NOP */;
/* NOP */;
}
public function Event_OnGuiSceneEntitySpawned(){
var guiSceneController : CR4GuiSceneController;
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
if (guiSceneController){
guiSceneController.OnGuiSceneEntitySpawned();
}
/* NOP */;
}
public function Event_OnGuiSceneEntityDestroyed(){
var guiSceneController : CR4GuiSceneController;
guiSceneController = theGame.GetGuiManager().GetSceneController(
);
if (guiSceneController){
guiSceneController.OnGuiSceneEntityDestroyed();
}
/* NOP */;
}
protected function GetCommonMenu() : CR4CommonMenu{
if (!m_commonMenu){
m_commonMenu = theGame.GetGuiManager().GetCommonMenu();
}
return m_commonMenu;
/* NOP */;
}
protected function GetNpcInfo(npcEntity : CGameplayEntity, dataObject :

CScriptedFlashObject){
var l_craftsmanComponent : W3CraftsmanComponent;
var l_craftsmanLevel : ECraftsmanLevel;
var l_craftsmanType : ECraftsmanType;
var l_craftsmanLevelName : String;
var l_merchantComponent : W3MerchantComponent;
var l_merchantType : String;
var l_merchantMoney : Int32;
var l_merchantMapPinType : CName;
if (!npcEntity){
return;
}
l_merchantMoney = npcEntity.GetInventory().GetMoney();
dataObject.SetMemberFlashInt("money", l_merchantMoney);
l_craftsmanType = 0;
l_merchantComponent = (W3MerchantComponent)npcEntity.GetComponen
tByClassName('W3MerchantComponent');
if (l_merchantComponent){
l_merchantMapPinType = l_merchantComponent.GetMapPinType
();
switch(l_merchantMapPinType){
case 'Shopkeeper':
l_merchantType = "map_location_shopkeeper";
l_craftsmanType = 0;
break;
case 'Blacksmith':
l_merchantType = "map_location_blacksmith";
l_craftsmanType = 1;
break;
case 'Armorer':
l_merchantType = "Armorer";
l_craftsmanType = 2;
break;
case 'Herbalist':
l_merchantType = "Herb_Dealer";
l_craftsmanType = 4;
break;
case 'Alchemist':
l_merchantType = "map_location_alchemic";
l_craftsmanType = 4;
break;
default:
l_merchantType = "map_location_shopkeeper";
}
dataObject.SetMemberFlashString("typeName", GetLocString
ByKeyExt(l_merchantType));
dataObject.SetMemberFlashString("type", NameToString(l_m
erchantMapPinType));
}
l_craftsmanComponent = (W3CraftsmanComponent)npcEntity.GetCompon
entByClassName('W3CraftsmanComponent');
if (l_craftsmanComponent){
l_craftsmanLevel = l_craftsmanComponent.GetCraftsmanLeve
l(l_craftsmanType);
switch(l_craftsmanLevel){
case 1:
l_craftsmanLevelName = GetLocStringByKeyExt("pan
el_shop_crating_level_journeyman");
break;
case 2:

l_craftsmanLevelName = GetLocStringByKeyExt("pan
el_shop_crating_level_master");
break;
case 3:
l_craftsmanLevelName = GetLocStringByKeyExt("pan
el_shop_crating_level_grand_master");
break;
default:
l_craftsmanLevelName = "";
}
dataObject.SetMemberFlashString("level", l_craftsmanLeve
lName);
}
/* NOP */;
}
}
class CR4IngameMenu extends CR4MenuBase{
protected var mInGameConfigWrapper : CInGameConfigWrapper;
protected var inGameConfigBufferedWrapper : CInGameConfigBufferedWrapper
;
protected var currentNewGameConfig : newGameConfig;
private var m_fxNavigateBack : CScriptedFlashFunction;
private var m_fxSetIsMainMenu : CScriptedFlashFunction;
private var m_fxSetCurrentUsername : CScriptedFlashFunction;
private var m_fxSetVersion : CScriptedFlashFunction;
private var m_fxShowHelp : CScriptedFlashFunction;
private var m_fxSetVisible : CScriptedFlashFunction;
private var m_fxSetPanelMode : CScriptedFlashFunction;
private var m_fxRemoveOption : CScriptedFlashFunction;
private var m_fxSetGameLogoLanguage : CScriptedFlashFunction;
private var m_fxUpdateOptionValue : CScriptedFlashFunction;
private var m_fxUpdateInputFeedback : CScriptedFlashFunction;
private var m_fxOnSaveScreenshotRdy : CScriptedFlashFunction;
private var m_fxSetIgnoreInput : CScriptedFlashFunction;
private var m_fxForceEnterCurEntry : CScriptedFlashFunction;
private var m_fxForceBackgroundVis : CScriptedFlashFunction;
protected var loadConfPopup : W3ApplyLoadConfirmation;
protected var saveConfPopup : W3SaveGameConfirmation;
protected var newGameConfPopup : W3NewGameConfirmation;
protected var actionConfPopup : W3ActionConfirmation;
protected var deleteConfPopup : W3DeleteSaveConf;
protected var diffChangeConfPopup : W3DifficultyChangeConfirmation;
protected var isShowingSaveList : Bool;
protected var isShowingLoadList : Bool;
protected var smartKeybindingEnabled : Bool;
public var m_structureCreator : IngameMenuStructureCreator;
protected var isInLoadselector : Bool;
protected var swapAcceptCancelChanged : Bool;
protected var shouldRefreshKinect : Bool;
public var isMainMenu : Bool;
protected var managingPause : Bool;
protected var updateInputDeviceRequired : Bool;
protected var hasChangedOption : Bool;
private var ignoreInput : Bool;
public var disableAccountPicker : Bool;
protected var currentLangValue : String;
protected var lastUsedLangValue : String;
protected var currentSpeechLang : String;
protected var lastUsedSpeechLang : String;

private var languageName : String;


private var panelMode : Bool;
public var lastSetDifficulty : Int32;
public function OnConfigUI() : Bool{
var initDataObject : W3MenuInitData;
var commonIngameMenu : CR4CommonIngameMenu;
var commonMainMenu : CR4CommonMainMenu;
var deathScreenMenu : CR4DeathScreenMenu;
var audioLanguageName : String;
var tempLanguageName : String;
var username : String;
var lootPopup : CR4LootPopup;
super.OnConfigUI();
m_fxNavigateBack = m_flashModule.GetMemberFlashFunction("handleN
avigateBack");
m_fxSetIsMainMenu = m_flashModule.GetMemberFlashFunction("setIsM
ainMenu");
m_fxSetCurrentUsername = m_flashModule.GetMemberFlashFunction("s
etCurrentUsername");
m_fxSetVersion = m_flashModule.GetMemberFlashFunction("setVersio
n");
m_fxShowHelp = m_flashModule.GetMemberFlashFunction("showHelpPan
el");
m_fxSetVisible = m_flashModule.GetMemberFlashFunction("setVisibl
e");
m_fxSetPanelMode = m_flashModule.GetMemberFlashFunction("setPane
lMode");
m_fxRemoveOption = m_flashModule.GetMemberFlashFunction("removeO
ption");
m_fxSetGameLogoLanguage = m_flashModule.GetMemberFlashFunction("
setGameLogoLanguage");
m_fxUpdateOptionValue = m_flashModule.GetMemberFlashFunction("up
dateOptionValue");
m_fxUpdateInputFeedback = m_flashModule.GetMemberFlashFunction("
updateInputFeedback");
m_fxOnSaveScreenshotRdy = m_flashModule.GetMemberFlashFunction("
onSaveScreenshotLoaded");
m_fxSetIgnoreInput = m_flashModule.GetMemberFlashFunction("setIg
noreInput");
m_fxForceEnterCurEntry = m_flashModule.GetMemberFlashFunction("f
orceEnterCurrentEntry");
m_fxForceBackgroundVis = m_flashModule.GetMemberFlashFunction("s
etForceBackgroundVisible");
m_structureCreator = new IngameMenuStructureCreator in this;
m_structureCreator.parentMenu = this;
m_structureCreator.m_flashValueStorage = m_flashValueStorage;
m_structureCreator.m_flashConstructor = m_flashValueStorage.Crea
teTempFlashObject(/* NOP */);
m_hideTutorial = false;
m_forceHideTutorial = false;
disableAccountPicker = false;
theGame.LoadHudSettings();
mInGameConfigWrapper = theGame.GetInGameConfigWrapper();
inGameConfigBufferedWrapper = theGame.GetGuiManager().GetInGameC
onfigBufferedWrapper();
lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('Loot
Popup');
if (lootPopup){
lootPopup.ClosePopup();
}

commonIngameMenu = (CR4CommonIngameMenu)GetParent();
commonMainMenu = (CR4CommonMainMenu)GetParent();
deathScreenMenu = (CR4DeathScreenMenu)GetParent();
if (commonIngameMenu){
isMainMenu = false;
panelMode = false;
mInGameConfigWrapper.ActivateScriptTag('inGame');
mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
if (!thePlayer.IsAlive() && !thePlayer.OnCheckUnconsciou
s() || theGame.HasBlackscreenRequested() || theGame.IsDialogOrCutscenePlaying())
{
CloseMenu();
return true;
}
} else if (commonMainMenu){
isMainMenu = true;
panelMode = false;
mInGameConfigWrapper.ActivateScriptTag('mainMenu');
mInGameConfigWrapper.DeactivateScriptTag('inGame');
if (theGame.AreConfigResetInThisSession() && !theGame.Ha
sShownConfigChangedMessage()){
showNotification(GetLocStringByKeyExt("update_wa
rning_message"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
theGame.SetHasShownConfigChangedMessage(true);
}
} else if (deathScreenMenu){
isMainMenu = false;
panelMode = true;
mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
mInGameConfigWrapper.DeactivateScriptTag('inGame');
deathScreenMenu.HideInputFeedback();
if (hasSaveDataToLoad()){
isInLoadselector = true;
SendLoadData();
m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(t
rue));
} else {
CloseMenu();
}
} else {
initDataObject = (W3MenuInitData)GetMenuInitData();
if (initDataObject && initDataObject.getDefaultState() =
= 'SaveGame'){
isMainMenu = false;
panelMode = true;
managingPause = true;
theInput.StoreContext('EMPTY_CONTEXT');
theGame.Pause('IngameMenu');
mInGameConfigWrapper.DeactivateScriptTag('mainMe
nu');
mInGameConfigWrapper.DeactivateScriptTag('inGame
');
SendSaveData();
m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(t
rue));
}
}
IngameMenu_UpdateDLCScriptTags();
if (!panelMode){

m_fxSetIsMainMenu.InvokeSelfOneArg(FlashArgBool(isMainMe
nu));
if (isMainMenu){
username = FixStringForFont(theGame.GetActiveUse
rDisplayName());
m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArg
String(username));
m_fxSetVersion.InvokeSelfOneArg(FlashArgString(t
heGame.GetApplicationVersion()));
}
theGame.GetSecondScreenManager().SendGameMenuOpen();
lastSetDifficulty = theGame.GetDifficultyLevel();
currentLangValue = mInGameConfigWrapper.GetVarValue('Loc
alization', 'Virtual_Localization_text');
lastUsedLangValue = currentLangValue;
currentSpeechLang = mInGameConfigWrapper.GetVarValue('Lo
calization', 'Virtual_Localization_speech');
lastUsedSpeechLang = currentSpeechLang;
theGame.GetGameLanguageName(audioLanguageName, tempLangu
ageName);
if (tempLanguageName != languageName){
languageName = tempLanguageName;
m_fxSetGameLogoLanguage.InvokeSelfOneArg(FlashAr
gString(languageName));
}
PopulateMenuData();
}
/* NOP */;
}
public function OnRefresh() : Bool{
var audioLanguageName : String;
var tempLanguageName : String;
var overlayPopupRef : CR4OverlayPopup;
var username : String;
var hud : CR4ScriptedHud;
currentLangValue = mInGameConfigWrapper.GetVarValue('Localizatio
n', 'Virtual_Localization_text');
lastUsedLangValue = currentLangValue;
currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localizati
on', 'Virtual_Localization_speech');
lastUsedSpeechLang = currentSpeechLang;
if (isMainMenu){
username = FixStringForFont(theGame.GetActiveUserDisplay
Name());
m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(u
sername));
PopulateMenuData();
}
UpdateAcceptCancelSwaping();
SetPlatformType(theGame.GetPlatform());
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateAcceptCancelSwaping();
}
theGame.GetGameLanguageName(audioLanguageName, tempLanguageName)
;
if (tempLanguageName != languageName){
languageName = tempLanguageName;
m_fxSetGameLogoLanguage.InvokeSelfOneArg(FlashArgString(
languageName));

m_fxUpdateInputFeedback.InvokeSelf();
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager
().GetPopup('OverlayPopup');
if (overlayPopupRef){
overlayPopupRef.UpdateButtons();
}
}
setArabicAligmentMode();
/* NOP */;
}
public function OnRequestSubMenu(menuName : CName, initData : IScriptabl
e){
RequestSubMenu(menuName, initData);
m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(false));
/* NOP */;
}
public function ChildRequestCloseMenu(){
m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(true));
/* NOP */;
}
public function OnCloseMenu() : Bool{
CloseMenu();
/* NOP */;
}
public function ReopenMenu(){
var commonInGameMenu : CR4CommonIngameMenu;
var commonMainMenu : CR4CommonMainMenu;
commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
if (commonInGameMenu){
commonInGameMenu.reopenRequested = true;
}
commonMainMenu = (CR4CommonMainMenu)m_parentMenu;
if (commonMainMenu){
commonMainMenu.reopenRequested = true;
}
CloseMenu();
/* NOP */;
}
public function OnClosingMenu() : Bool{
var commonInGameMenu : CR4CommonIngameMenu;
var commonMainMenu : CR4CommonMainMenu;
var deathScreenMenu : CR4DeathScreenMenu;
var controlsFeedbackModule : CR4HudModuleControlsFeedback;
var interactionModule : CR4HudModuleInteractions;
var hud : CR4ScriptedHud;
SaveChangedSettings();
theGame.GetSecondScreenManager().SendGameMenuClose();
super.OnClosingMenu();
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
controlsFeedbackModule = (CR4HudModuleControlsFeedback)h
ud.GetHudModule(NameToString('ControlsFeedbackModule'));
if (controlsFeedbackModule){
controlsFeedbackModule.ForceModuleUpdate();
}
interactionModule = (CR4HudModuleInteractions)hud.GetHud
Module(NameToString('InteractionsModule'));
if (interactionModule){
interactionModule.ForceUpdateModule();
}

}
if (managingPause){
managingPause = false;
theInput.RestoreContext('EMPTY_CONTEXT', true);
theGame.Unpause('IngameMenu');
}
if (theGame.GetGuiManager().potalConfirmationPending){
theGame.GetGuiManager().ResumePortalConfirmationPendingM
essage();
}
if (m_structureCreator){
delete m_structureCreator;
}
if (loadConfPopup){
delete loadConfPopup;
}
if (saveConfPopup){
delete saveConfPopup;
}
if (actionConfPopup){
delete actionConfPopup;
}
if (newGameConfPopup){
delete newGameConfPopup;
}
if (deleteConfPopup){
delete deleteConfPopup;
}
if (diffChangeConfPopup){
delete diffChangeConfPopup;
}
commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
if (commonInGameMenu){
commonInGameMenu.ChildRequestCloseMenu();
return true;
}
commonMainMenu = (CR4CommonMainMenu)m_parentMenu;
if (commonMainMenu){
commonMainMenu.ChildRequestCloseMenu();
return true;
}
deathScreenMenu = (CR4DeathScreenMenu)m_parentMenu;
if (deathScreenMenu){
deathScreenMenu.ChildRequestCloseMenu();
return true;
}
/* NOP */;
}
protected function CloseCurrentPopup(){
if (loadConfPopup){
loadConfPopup.ClosePopupOverlay();
} else if (saveConfPopup){
saveConfPopup.ClosePopupOverlay();
} else if (actionConfPopup){
actionConfPopup.ClosePopupOverlay();
} else if (newGameConfPopup){
newGameConfPopup.ClosePopupOverlay();
} else if (deleteConfPopup){
deleteConfPopup.ClosePopupOverlay();
} else if (diffChangeConfPopup){

diffChangeConfPopup.ClosePopupOverlay();
}
/* NOP */;
}
public function SetIgnoreInput(value : Bool){
if (value != ignoreInput){
ignoreInput = value;
m_fxSetIgnoreInput.InvokeSelfOneArg(FlashArgBool(value))
;
}
/* NOP */;
}
public function OnUserSignIn(){
SetIgnoreInput(false);
CloseCurrentPopup();
/* NOP */;
}
public function OnUserSignInCancelled(){
SetIgnoreInput(false);
CloseCurrentPopup();
/* NOP */;
}
public function OnSaveLoadingFailed(){
SetIgnoreInput(false);
CloseCurrentPopup();
/* NOP */;
}
public function OnItemActivated(actionType : Int32, menuTag : Int32) : B
ool{
var l_DataFlashArray : CScriptedFlashArray;
if (ignoreInput){
m_fxNavigateBack.InvokeSelf();
} else {
switch(actionType){
case 0:
theGame.RequestMenu('CommonMenu', /* NOP */);
break;
case 2:
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
break;
case 3:
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
break;
case 4:
if (hasSaveDataToLoad()){
SendLoadData();
} else {
m_fxNavigateBack.InvokeSelf();
}
isInLoadselector = true;
break;
case 5:
if (!theGame.AreSavesLocked()){
SendSaveData();
} else {
m_fxNavigateBack.InvokeSelf();
theGame.GetGuiManager().DisplayLockedSav
ePopup();

}
isInLoadselector = false;
break;
case 6:
if (theGame.GetPlatform() == 1){
ShowActionConfPopup(6, "", GetLocStringB
yKeyExt("error_message_exit_game_x1"));
} else if (theGame.GetPlatform() == 2){
ShowActionConfPopup(6, "", GetLocStringB
yKeyExt("error_message_exit_game_ps4"));
} else {
ShowActionConfPopup(6, "", GetLocStringB
yKeyExt("error_message_exit_game"));
}
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
LoadLastSave();
break;
case 1:
break;
case 12:
theGame.RequestMenuWithBackground('GlossaryTutor
ialsMenu', 'CommonMenu', /* NOP */);
break;
case 13:
OnRequestSubMenu('CreditsMenu', GetMenuInitData(
));
break;
case 14:
showHelpPanel();
break;
case 100:
l_DataFlashArray = IngameMenu_FillOptionsSubMenu
Data(m_flashValueStorage, isMainMenu);
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
m_flashValueStorage.SetFlashArray("ingamemenu.op
tions.entries", l_DataFlashArray);
break;
case 16:
SendControllerData();
break;
case 17:
TryStartNewGame(menuTag);
break;
case 26:
fetchNewGameConfigFromTag(menuTag);
SendNewGamePlusSaves();
break;
case 19:
SendRescaleData();
break;
case 21:
RequestSubMenu('MainDbgStartQuestMenu', GetMenuI

nitData());
break;
case 22:
GetRootMenu().CloseMenu();
theGame.RequestMenu('DeckBuilder', /* NOP */);
break;
case 23:
fetchNewGameConfigFromTag(menuTag);
SendImportSaveData();
break;
case 18:
if (!isMainMenu){
ShowActionConfPopup(18, "", GetLocString
ByKeyExt("error_message_exit_game"));
} else {
theGame.RequestExit();
}
break;
case 24:
SendKeybindData();
break;
}
}
/* NOP */;
}
public function HandleLoadGameFailed(){
disableAccountPicker = false;
SetIgnoreInput(false);
/* NOP */;
}
protected function LoadLastSave(){
if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.
GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected){
return;
}
SetIgnoreInput(true);
if (isMainMenu){
disableAccountPicker = true;
}
theGame.LoadLastGameInit(/* NOP */);
/* NOP */;
}
protected function ShowActionConfPopup(action : Int32, title : String, d
escription : String){
if (actionConfPopup){
delete actionConfPopup;
}
actionConfPopup = new W3ActionConfirmation in this;
actionConfPopup.SetMessageTitle(title);
actionConfPopup.SetMessageText(description);
actionConfPopup.actionID = action;
actionConfPopup.menuRef = this;
actionConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', actionConfPopup);
/* NOP */;
}
public function OnActionConfirmed(action : Int32){
var parentMenu : CR4MenuBase;
parentMenu = (CR4MenuBase)GetParent();
switch(action){

case 6:
parentMenu.OnCloseMenu();
theGame.RequestEndGame();
break;
case 18:
theGame.RequestExit();
break;
}
/* NOP */;
}
public function OnPresetApplied(groupId : CName, targetPresetIndex : Int
32) : Bool{
hasChangedOption = true;
IngameMenu_ChangePresetValue(groupId, targetPresetIndex, this);
if (groupId == 'Rendering' && !isMainMenu){
m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(tru
e));
}
/* NOP */;
}
public function UpdateOptions(groupId : CName){
var optionChangeContainer : CScriptedFlashObject;
optionChangeContainer = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
IngameMenu_GatherOptionUpdatedValues(groupId, optionChangeContai
ner, m_flashValueStorage);
m_flashValueStorage.SetFlashObject("ingamemenu.optionValueChange
s", optionChangeContainer, /* NOP */);
/* NOP */;
}
public function OnOptionValueChanged(groupId : Int32, optionName : CName
, optionValue : String) : Bool{
var groupName : CName;
var hud : CR4ScriptedHud;
var isBuffered : Bool;
hasChangedOption = true;
OnPlaySoundEvent("gui_global_switch");
if (groupId == NameToFlashUInt('SpecialSettingsGroupId')){
HandleSpecialValueChanged(optionName, optionValue);
return true;
}
if (optionName == 'SwapAcceptCancel'){
swapAcceptCancelChanged = true;
}
if (optionName == 'HardwareCursor'){
updateInputDeviceRequired = true;
}
groupName = mInGameConfigWrapper.GetGroupName(groupId);
isBuffered = mInGameConfigWrapper.DoGroupHasTag(groupName, 'buff
ered');
if (isBuffered == false){
isBuffered = mInGameConfigWrapper.DoVarHasTag(groupName,
optionName, 'buffered');
}
if (isBuffered == true){
inGameConfigBufferedWrapper.SetVarValue(groupName, optio
nName, optionValue);
} else {
mInGameConfigWrapper.SetVarValue(groupName, optionName,
optionValue);

}
theGame.OnConfigValueChanged(optionName, optionValue);
if (groupName == 'Hud' || optionName == 'Subtitles'){
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.UpdateHudConfig(optionName, true);
}
}
if (groupName == 'Localization'){
if (optionName == 'Virtual_Localization_text'){
currentLangValue = optionValue;
} else if (optionName == 'Virtual_Localization_speech'){
currentSpeechLang = optionValue;
}
}
if (groupName == 'Rendering' && !isMainMenu){
m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(tru
e));
}
/* NOP */;
}
protected function HandleSpecialValueChanged(optionName : CName, optionV
alue : String){
var intValue : Int32;
if (optionName == 'GameDifficulty'){
intValue = StringToInt(optionValue, 1);
lastSetDifficulty = intValue + 1;
}
/* NOP */;
}
public function OnGraphicsUpdated(keepChanges : Bool){
}
public function OnOptionPanelNavigateBack() : Bool{
var graphicChangesPending : Bool;
var hud : CR4ScriptedHud;
if (inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshVie
wport')){
inGameConfigBufferedWrapper.ApplyNewValues();
theGame.GetGuiManager().ShowProgressDialog(UMID_Graphics
Refreshing, "", "message_text_confirm_option_changes", true, 1, 100, 2, 'None');
ReopenMenu();
return true;
}
hud = (CR4ScriptedHud)theGame.GetHud();
if (hud){
hud.RefreshHudConfiguration();
}
/* NOP */;
}
public function OnNavigatedBack() : Bool{
var lowestDifficultyUsed : EDifficultyMode;
var hud : CR4ScriptedHud;
var overlayPopupRef : CR4OverlayPopup;
var confirmResult : Int32;
hud = (CR4ScriptedHud)theGame.GetHud();
overlayPopupRef = (CR4OverlayPopup)theGame.GetGuiManager().GetPo
pup('OverlayPopup');
if (inGameConfigBufferedWrapper.IsEmpty() == false){
inGameConfigBufferedWrapper.FlushBuffer();
hasChangedOption = true;

}
if (currentLangValue != lastUsedLangValue || lastUsedSpeechLang
!= currentSpeechLang){
lastUsedLangValue = currentLangValue;
lastUsedSpeechLang = currentSpeechLang;
theGame.ReloadLanguage();
}
if (swapAcceptCancelChanged){
swapAcceptCancelChanged = false;
UpdateAcceptCancelSwaping();
if (hud){
hud.UpdateAcceptCancelSwaping();
}
if (overlayPopupRef){
overlayPopupRef.UpdateAcceptCancelSwaping();
}
}
isShowingSaveList = false;
isShowingLoadList = false;
OnPlaySoundEvent("gui_global_panel_close");
lowestDifficultyUsed = theGame.GetLowestDifficultyUsed();
if (!isMainMenu && theGame.GetDifficultyLevel() != lastSetDiffic
ulty && lowestDifficultyUsed > lastSetDifficulty && lowestDifficultyUsed > 2){
diffChangeConfPopup = new W3DifficultyChangeConfirmation
in this;
diffChangeConfPopup.SetMessageTitle("");
if (theGame.GetPlatform() == 2){
diffChangeConfPopup.SetMessageText(GetLocStringB
yKeyExt("difficulty_change_warning_message_PS4"));
} else {
diffChangeConfPopup.SetMessageText(GetLocStringB
yKeyExt("difficulty_change_warning_message_X1"));
}
diffChangeConfPopup.menuRef = this;
diffChangeConfPopup.targetDifficulty = lastSetDifficulty
;
diffChangeConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', diffChangeConfPopup);
} else if (lastSetDifficulty != theGame.GetDifficultyLevel()){
theGame.SetDifficultyLevel(lastSetDifficulty);
theGame.OnDifficultyChanged(lastSetDifficulty);
}
SaveChangedSettings();
if (overlayPopupRef && updateInputDeviceRequired){
updateInputDeviceRequired = false;
overlayPopupRef.UpdateInputDevice();
}
/* NOP */;
}
public function CancelDifficultyChange(){
var difficultyIndex : Int32;
var difficultyIndexAsString : String;
lastSetDifficulty = theGame.GetDifficultyLevel();
difficultyIndex = lastSetDifficulty - 1;
difficultyIndexAsString = "" + difficultyIndex;
m_fxUpdateOptionValue.InvokeSelfTwoArgs(FlashArgUInt(NameToFlash
UInt('GameDifficulty')), FlashArgString(difficultyIndexAsString));
/* NOP */;
}
protected function SaveChangedSettings(){

if (hasChangedOption){
hasChangedOption = false;
theGame.SaveUserSettings();
}
/* NOP */;
}
public function OnProfileChange() : Bool{
if (!disableAccountPicker){
SetIgnoreInput(true);
theGame.ChangeActiveUser();
}
/* NOP */;
}
public function OnSaveGameCalled(type : ESaveGameType, saveArrayIndex :
Int32) : Bool{
var saves : array<SSavegameInfo>;
var currentSave : SSavegameInfo;
ignoreInput = true;
if (theGame.AreSavesLocked()){
theGame.GetGuiManager().DisplayLockedSavePopup();
SetIgnoreInput(false);
return false;
}
if (saveArrayIndex >= 0){
if (saveConfPopup){
delete saveConfPopup;
}
theGame.ListSavedGames(saves);
currentSave = saves[saveArrayIndex];
saveConfPopup = new W3SaveGameConfirmation in this;
saveConfPopup.SetMessageTitle("");
if (theGame.GetPlatform() == 1){
saveConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_overwrite_save_x1"));
} else if (theGame.GetPlatform() == 2){
saveConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_overwrite_save_ps4"));
} else {
saveConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_overwrite_save"));
}
saveConfPopup.menuRef = this;
saveConfPopup.type = currentSave.slotType;
saveConfPopup.slot = currentSave.slotIndex;
saveConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', saveConfPopup);
} else {
executeSave(type, -1);
SetIgnoreInput(false);
}
/* NOP */;
}
public function executeSave(type : ESaveGameType, slot : Int32){
var hadLoadable : Bool;
hadLoadable = hasSaveDataToLoad();
theGame.SaveGame(type, slot);
m_fxNavigateBack.InvokeSelf();
/* NOP */;
}
public function OnLoadGameCalled(type : ESaveGameType, saveListIndex : I

nt32) : Bool{
var saveGameRef : SSavegameInfo;
var saveGames : array<SSavegameInfo>;
if (ignoreInput){
return false;
}
disableAccountPicker = true;
if (loadConfPopup){
delete loadConfPopup;
}
theGame.ListSavedGames(saveGames);
saveGameRef = saveGames[saveListIndex];
if (panelMode || isMainMenu && !hasValidAutosaveData()){
LoadSaveRequested(saveGameRef);
} else {
loadConfPopup = new W3ApplyLoadConfirmation in this;
if (theGame.GetPlatform() == 1){
loadConfPopup.SetMessageTitle(GetLocStringByKeyE
xt("panel_mainmenu_popup_load_title_x1"));
} else if (theGame.GetPlatform() == 2){
loadConfPopup.SetMessageTitle(GetLocStringByKeyE
xt("panel_mainmenu_popup_load_title_ps4"));
} else {
loadConfPopup.SetMessageTitle(GetLocStringByKeyE
xt("panel_mainmenu_popup_load_title"));
}
if (isMainMenu){
if (theGame.GetPlatform() == 1){
loadConfPopup.SetMessageText(GetLocStrin
gByKeyExt("error_message_load_game_main_menu_x1"));
} else if (theGame.GetPlatform() == 2){
loadConfPopup.SetMessageText(GetLocStrin
gByKeyExt("error_message_load_game_main_menu_ps4"));
} else {
loadConfPopup.SetMessageText(GetLocStrin
gByKeyExt("error_message_load_game_main_menu"));
}
} else if (theGame.GetPlatform() == 1){
loadConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_load_game_x1"));
} else if (theGame.GetPlatform() == 2){
loadConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_load_game_ps4"));
} else {
loadConfPopup.SetMessageText(GetLocStringByKeyEx
t("error_message_load_game"));
}
loadConfPopup.menuRef = this;
loadConfPopup.saveSlotRef = saveGameRef;
loadConfPopup.BlurBackground = true;
SetIgnoreInput(true);
RequestSubMenu('PopupMenu', loadConfPopup);
}
/* NOP */;
}
public function LoadSaveRequested(saveSlotRef : SSavegameInfo){
if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.
GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected){
return;
}

SetIgnoreInput(true);
if (isMainMenu){
disableAccountPicker = true;
}
theGame.LoadGameInit(saveSlotRef);
/* NOP */;
}
public function OnImportGameCalled(menuTag : Int32) : Bool{
var savesToImport : array<SSavegameInfo>;
var difficulty : Int32;
var tutorialsEnabled : Bool;
var simulateImport : Bool;
var maskResult : Int32;
var progress : Float;
if (!theGame.IsContentAvailable('launch0')){
progress = theGame.ProgressToContentAvailable('launch0')
;
theSound.SoundEvent("gui_global_denied");
theGame.GetGuiManager().ShowProgressDialog(0, "", "error
_message_new_game_not_ready", true, 0, progress, 1, 'launch0');
} else {
theGame.ListW2SavedGames(savesToImport);
if (menuTag < savesToImport.Size()){
disableAccountPicker = true;
theGame.ClearInitialFacts();
if (theGame.ImportSave(savesToImport[menuTag])){
currentNewGameConfig.import_save_index =
menuTag;
if (theGame.GetDLCManager().IsNewGamePlu
sAvailable()){
m_fxForceEnterCurEntry.InvokeSel
f();
} else {
theGame.SetDifficultyLevel(curre
ntNewGameConfig.difficulty);
TutorialMessagesEnable(currentNe
wGameConfig.tutorialsOn);
if (theGame.RequestNewGame(theGa
me.GetNewGameDefinitionFilename())){
OnPlaySoundEvent("gui_gl
obal_game_start");
GetRootMenu().CloseMenu(
);
}
}
} else {
showNotification(GetLocStringByKeyExt("i
mport_witcher_two_failed"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
}
}
/* NOP */;
}
public function OnNewGamePlusCalled(saveListIndex : Int32) : Bool{
var startGameStatus : ENewGamePlusStatus;
var saveGameRef : SSavegameInfo;
var saveGames : array<SSavegameInfo>;
var errorMessage : String;
var progress : Float;

ignoreInput = true;
if (!theGame.IsContentAvailable('launch0')){
progress = theGame.ProgressToContentAvailable('launch0')
;
theSound.SoundEvent("gui_global_denied");
SetIgnoreInput(false);
theGame.GetGuiManager().ShowProgressDialog(0, "", "error
_message_new_game_not_ready", true, 0, progress, 1, 'launch0');
} else {
disableAccountPicker = true;
theGame.ListSavedGames(saveGames);
saveGameRef = saveGames[saveListIndex];
if (currentNewGameConfig.import_save_index == -1 && curr
entNewGameConfig.simulate_import){
theGame.AddInitialFact("simulate_import_ingame")
;
}
theGame.SetDifficultyLevel(currentNewGameConfig.difficul
ty);
TutorialMessagesEnable(currentNewGameConfig.tutorialsOn)
;
startGameStatus = theGame.StartNewGamePlus(saveGameRef);
if (startGameStatus == 0){
OnPlaySoundEvent("gui_global_game_start");
GetRootMenu().CloseMenu();
} else {
errorMessage = "";
SetIgnoreInput(false);
switch(startGameStatus){
case 1:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_invalid");
break;
case 2:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_cantload");
break;
case 3:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_too_old");
break;
case 4:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_requirementnotmet");
break;
case 5:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_internalerror");
break;
case 6:
errorMessage = GetLocStringByKeyExt("new
game_plus_error_contentrequired");
break;
}
showNotification(errorMessage, /* NOP */);
OnPlaySoundEvent("gui_global_denied");
}
}
/* NOP */;
}

public function OnDeleteSaveCalled(type : ESaveGameType, saveListIndex :


Int32, isSaveMode : Bool) : Bool{
if (ignoreInput){
return false;
}
SetIgnoreInput(true);
disableAccountPicker = true;
if (deleteConfPopup){
delete deleteConfPopup;
}
deleteConfPopup = new W3DeleteSaveConf in this;
deleteConfPopup.SetMessageTitle("");
if (theGame.GetPlatform() == 1){
deleteConfPopup.SetMessageText(GetLocStringByKeyExt("pan
el_mainmenu_confirm_delete_text_x1"));
} else if (theGame.GetPlatform() == 2){
deleteConfPopup.SetMessageText(GetLocStringByKeyExt("pan
el_mainmenu_confirm_delete_text_ps4"));
} else {
deleteConfPopup.SetMessageText(GetLocStringByKeyExt("pan
el_mainmenu_confirm_delete_text"));
}
deleteConfPopup.menuRef = this;
deleteConfPopup.type = type;
deleteConfPopup.slot = saveListIndex;
deleteConfPopup.saveMode = isSaveMode;
deleteConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', deleteConfPopup);
/* NOP */;
}
public function DeleteSave(type : ESaveGameType, saveListIndex : Int32,
isSaveMode : Bool){
var saves : array<SSavegameInfo>;
var currentSave : SSavegameInfo;
var numSavesBeforeDelete : Int32;
theGame.ListSavedGames(saves);
numSavesBeforeDelete = saves.Size();
if (saveListIndex < saves.Size()){
currentSave = saves[saveListIndex];
theGame.DeleteSavedGame(currentSave);
}
if (numSavesBeforeDelete <= 1){
m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlas
hUInt('Continue')));
m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlas
hUInt('LoadGame')));
if (isInLoadselector){
m_fxNavigateBack.InvokeSelf();
} else {
SendSaveData();
}
} else if (isSaveMode){
SendSaveData();
} else if (hasSaveDataToLoad()){
SendLoadData();
}
/* NOP */;
}
protected function showHelpPanel(){
m_fxNavigateBack.InvokeSelf();

theGame.DisplaySystemHelp();
/* NOP */;
}
public function TryStartNewGame(optionsArray : Int32){
var progress : Float;
if (!theGame.IsContentAvailable('launch0')){
progress = theGame.ProgressToContentAvailable('launch0')
;
theSound.SoundEvent("gui_global_denied");
theGame.GetGuiManager().ShowProgressDialog(0, "", "error
_message_new_game_not_ready", true, 0, progress, 1, 'launch0');
} else {
fetchNewGameConfigFromTag(optionsArray);
if (hasValidAutosaveData()){
if (newGameConfPopup){
delete newGameConfPopup;
}
newGameConfPopup = new W3NewGameConfirmation in
this;
newGameConfPopup.SetMessageTitle("");
if (theGame.GetPlatform() == 1){
newGameConfPopup.SetMessageText(GetLocSt
ringByKeyExt("error_message_start_game_x1"));
} else if (theGame.GetPlatform() == 2){
newGameConfPopup.SetMessageText(GetLocSt
ringByKeyExt("error_message_start_game_ps4"));
} else {
newGameConfPopup.SetMessageText(GetLocSt
ringByKeyExt("error_message_start_game"));
}
newGameConfPopup.menuRef = this;
newGameConfPopup.BlurBackground = true;
RequestSubMenu('PopupMenu', newGameConfPopup);
} else {
NewGameRequested();
}
}
/* NOP */;
}
protected function fetchNewGameConfigFromTag(optionsTag : Int32){
var maskResult : Int32;
currentNewGameConfig.import_save_index = -1;
currentNewGameConfig.difficulty = optionsTag & 7;
maskResult = optionsTag & 1024;
currentNewGameConfig.tutorialsOn = maskResult == 1024;
maskResult = optionsTag & 4096;
if (maskResult != 4096){
currentNewGameConfig.import_save_index = -1;
}
maskResult = optionsTag & 2048;
currentNewGameConfig.simulate_import = maskResult == 2048;
/* NOP */;
}
public function NewGameRequested(){
disableAccountPicker = true;
if (currentNewGameConfig.import_save_index == -1){
theGame.ClearInitialFacts();
}
if (currentNewGameConfig.import_save_index == -1 && currentNewGa
meConfig.simulate_import){

theGame.AddInitialFact("simulate_import_ingame");
}
theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
StartNewGame();
/* NOP */;
}
public function OnUpdateRescale(hScale : Float, vScale : Float) : Bool{
var hud : CR4ScriptedHud;
var needRescale : Bool;
hud = (CR4ScriptedHud)theGame.GetHud();
needRescale = false;
if (theGame.GetUIHorizontalFrameScale() != hScale){
theGame.SetUIHorizontalFrameScale(hScale);
mInGameConfigWrapper.SetVarValue('Hidden', 'uiHorizontal
FrameScale', FloatToString(hScale));
needRescale = true;
hasChangedOption = true;
}
if (theGame.GetUIVerticalFrameScale() != vScale){
theGame.SetUIVerticalFrameScale(vScale);
mInGameConfigWrapper.SetVarValue('Hidden', 'uiVerticalFr
ameScale', FloatToString(vScale));
needRescale = true;
hasChangedOption = true;
}
if (needRescale && hud){
hud.RescaleModules();
}
/* NOP */;
}
public function ShowTutorialChosen(enabled : Bool){
TutorialMessagesEnable(enabled);
StartNewGame();
/* NOP */;
}
public function StartNewGame(){
if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.
GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected){
return;
}
if (theGame.RequestNewGame(theGame.GetNewGameDefinitionFilename(
))){
OnPlaySoundEvent("gui_global_game_start");
GetRootMenu().CloseMenu();
}
/* NOP */;
}
public function PopulateMenuData(){
var l_DataFlashArray : CScriptedFlashArray;
var l_ChildMenuFlashArray : CScriptedFlashArray;
var l_DataFlashObject : CScriptedFlashObject;
var l_subDataFlashObject : CScriptedFlashObject;
l_DataFlashArray = m_structureCreator.PopulateMenuData();
m_flashValueStorage.SetFlashArray("ingamemenu.entries", l_DataFl
ashArray);
/* NOP */;
}
protected function addInLoadOption(){
var l_DataFlashObject : CScriptedFlashObject;

var l_ChildMenuFlashArray : CScriptedFlashArray;


l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject(/*
NOP */);
l_DataFlashObject.SetMemberFlashString("id", "mainmenu_loadgame"
);
l_DataFlashObject.SetMemberFlashUInt("tag", NameToFlashUInt('Loa
dGame'));
l_DataFlashObject.SetMemberFlashString("label", GetLocStringByKe
yExt("panel_mainmenu_loadgame"));
l_DataFlashObject.SetMemberFlashUInt("type", 4);
l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray
();
l_DataFlashObject.SetMemberFlashArray("subElements", l_ChildMenu
FlashArray);
m_flashValueStorage.SetFlashObject("ingamemenu.addloading", l_Da
taFlashObject, /* NOP */);
/* NOP */;
}
public function OnBack() : Bool{
CloseMenu();
/* NOP */;
}
public function HasSavesToImport() : Bool{
var savesToImport : array<SSavegameInfo>;
theGame.ListW2SavedGames(savesToImport);
return savesToImport.Size() != 0;
/* NOP */;
}
protected function SendImportSaveData(){
var dataFlashArray : CScriptedFlashArray;
dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
IngameMenu_PopulateImportSaveData(m_flashValueStorage, dataFlash
Array);
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
isShowingSaveList = true;
m_flashValueStorage.SetFlashArray("ingamemenu.importSlots", data
FlashArray);
/* NOP */;
}
protected function hasValidAutosaveData() : Bool{
var currentSave : SSavegameInfo;
var num : Int32;
var i : Int32;
num = theGame.GetNumSaveSlots(1);
i = 0;
while (i < num){
if (theGame.GetSaveInSlot(1, i, currentSave)){
return true;
}
i = i + 1;
}
num = theGame.GetNumSaveSlots(5);
i = 0;
while (i < num){
if (theGame.GetSaveInSlot(5, i, currentSave)){
return true;
}
i = i + 1;
}

return false;
/* NOP */;
}
public function HandleSaveListUpdate(){
if (isShowingSaveList){
SendSaveData();
} else if (isShowingLoadList){
SendLoadData();
}
if (hasSaveDataToLoad()){
addInLoadOption();
}
/* NOP */;
}
protected function SendLoadData(){
var dataFlashArray : CScriptedFlashArray;
dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
PopulateSaveDataForSlotType(-1, dataFlashArray, false);
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
if (dataFlashArray.GetLength() == 0){
m_fxNavigateBack.InvokeSelf();
} else {
isShowingLoadList = true;
m_flashValueStorage.SetFlashArray("ingamemenu.loadSlots"
, dataFlashArray);
}
/* NOP */;
}
protected function SendSaveData(){
var dataFlashArray : CScriptedFlashArray;
dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
PopulateSaveDataForSlotType(3, dataFlashArray, true);
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
isShowingSaveList = true;
m_flashValueStorage.SetFlashArray("ingamemenu.saveSlots", dataFl
ashArray);
if (theGame.ShouldShowSaveCompatibilityWarning()){
theGame.GetGuiManager().ShowUserDialog(UMID_SaveCompatWa
rning, "", "error_save_not_compatible", 0);
}
/* NOP */;
}
protected function SendNewGamePlusSaves(){
var dataFlashArray : CScriptedFlashArray;
dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
PopulateSaveDataForSlotType(-1, dataFlashArray, false);
if (dataFlashArray.GetLength() == 0){
OnPlaySoundEvent("gui_global_denied");
showNotification(GetLocStringByKeyExt("mainmenu_newgame_
plus_no_saves"), /* NOP */);
m_fxNavigateBack.InvokeSelf();
} else {
m_initialSelectionsToIgnore = 1;
OnPlaySoundEvent("gui_global_panel_open");
m_flashValueStorage.SetFlashArray("ingamemenu.newGamePlu
sSlots", dataFlashArray);
}
/* NOP */;

}
protected function PopulateSaveDataForSlotType(saveType : Int32, parentO
bject : CScriptedFlashArray, allowEmptySlot : Bool){
IngameMenu_PopulateSaveDataForSlotType(m_flashValueStorage, save
Type, parentObject, allowEmptySlot);
/* NOP */;
}
public function OnLoadSaveImageCancelled() : Bool{
theGame.FreeScreenshotData();
/* NOP */;
}
public function OnScreenshotDataRequested(saveIndex : Int32) : Bool{
var targetSaveInfo : SSavegameInfo;
var saveGames : array<SSavegameInfo>;
theGame.ListSavedGames(saveGames);
if (saveIndex >= 0 && saveIndex < saveGames.Size()){
targetSaveInfo = saveGames[saveIndex];
theGame.RequestScreenshotData(targetSaveInfo);
}
/* NOP */;
}
public function OnCheckScreenshotDataReady() : Bool{
if (theGame.IsScreenshotDataReady()){
m_fxOnSaveScreenshotRdy.InvokeSelf();
}
/* NOP */;
}
protected function SendRescaleData(){
var currentData : CScriptedFlashObject;
currentData = m_flashValueStorage.CreateTempFlashObject(/* NOP *
/);
currentData.SetMemberFlashNumber("initialHScale", theGame.GetUIH
orizontalFrameScale());
currentData.SetMemberFlashNumber("initialVScale", theGame.GetUIV
erticalFrameScale());
m_flashValueStorage.SetFlashObject("ingamemenu.uirescale", curre
ntData, /* NOP */);
/* NOP */;
}
protected function SendControllerData(){
var dataFlashArray : CScriptedFlashArray;
if ((W3ReplacerCiri)thePlayer){
dataFlashArray = InGameMenu_CreateControllerDataCiri(m_f
lashValueStorage);
} else {
dataFlashArray = InGameMenu_CreateControllerData(m_flash
ValueStorage);
}
m_flashValueStorage.SetFlashArray("ingamemenu.gamepad.mappings",
dataFlashArray);
/* NOP */;
}
protected function SendKeybindData(){
var dataFlashArray : CScriptedFlashArray;
dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
IngameMenu_GatherKeybindData(dataFlashArray, m_flashValueStorage
);
m_flashValueStorage.SetFlashArray("ingamemenu.keybindValues", da
taFlashArray);
/* NOP */;

}
public function OnClearKeybind(keybindTag : CName) : Bool{
hasChangedOption = true;
mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, "IK_None
;IK_None");
SendKeybindData();
/* NOP */;
}
protected function GetKeybindGroupTag(keybindName : CName) : CName{
if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'in
put_overlap1')){
return 'input_overlap1';
} else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindNa
me, 'input_overlap2')){
return 'input_overlap2';
} else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindNa
me, 'input_overlap3')){
return 'input_overlap3';
} else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindNa
me, 'input_overlap4')){
return 'input_overlap4';
} else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindNa
me, 'input_overlap5')){
return 'input_overlap5';
}
return 'None';
/* NOP */;
}
public function OnChangeKeybind(keybindTag : CName, newKeybindValue : EI
nputKey) : Bool{
var newSettingString : String;
var exisitingKeybind : CName;
var groupIndex : Int32;
var keybindChangedMessage : String;
var numKeybinds : Int32;
var i : Int32;
var currentBindingTag : CName;
var iterator_KeybindName : CName;
var iterator_KeybindKey : String;
hasChangedOption = true;
newSettingString = newKeybindValue;
groupIndex = IngameMenu_GetPCInputGroupIndex();
if (groupIndex != -1){
numKeybinds = mInGameConfigWrapper.GetVarsNumByGroupName
('PCInput');
currentBindingTag = GetKeybindGroupTag(keybindTag);
i = 0;
while (i < numKeybinds){
iterator_KeybindName = mInGameConfigWrapper.GetV
arName(groupIndex, i);
iterator_KeybindKey = mInGameConfigWrapper.GetVa
rValue('PCInput', iterator_KeybindName);
iterator_KeybindKey = StrReplace(iterator_Keybin
dKey, ";IK_None", "");
iterator_KeybindKey = StrReplace(iterator_Keybin
dKey, "IK_None;", "");
if (iterator_KeybindKey == newSettingString && c
urrentBindingTag == 'None' || currentBindingTag != GetKeybindGroupTag(iterator_K
eybindName)){
if (keybindChangedMessage != ""){

keybindChangedMessage += ", ";


}
keybindChangedMessage += IngameMenu_GetL
ocalizedKeybindName(iterator_KeybindName);
OnClearKeybind(iterator_KeybindName);
}
i += 1;
}
}
if (keybindChangedMessage != ""){
keybindChangedMessage += " </br>" + GetLocStringByKeyExt
("key_unbound_message");
showNotification(keybindChangedMessage, /* NOP */);
}
newSettingString = newKeybindValue + ";IK_None";
mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, newSetti
ngString);
SendKeybindData();
/* NOP */;
}
public function OnSmartKeybindEnabledChanged(value : Bool) : Bool{
smartKeybindingEnabled = value;
/* NOP */;
}
public function OnInvalidKeybindTried(keyCode : EInputKey) : Bool{
showNotification(GetLocStringByKeyExt("menu_cannot_perform_actio
n_now"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
/* NOP */;
}
public function OnLockedKeybindTried() : Bool{
showNotification(GetLocStringByKeyExt("menu_cannot_perform_actio
n_now"), /* NOP */);
OnPlaySoundEvent("gui_global_denied");
/* NOP */;
}
public function OnResetKeybinds() : Bool{
mInGameConfigWrapper.ResetGroupToDefaults('PCInput');
SendKeybindData();
showNotification(inGameMenu_TryLocalize("menu_option_reset_succe
ssful"), /* NOP */);
hasChangedOption = true;
/* NOP */;
}
public function PlayOpenSoundEvent(){
}
}
class CR4HudModuleRadialMenu extends CR4HudModuleBase{
private var m_fxBlockRadialMenuSFF : CScriptedFlashFunction;
private var m_fxShowRadialMenuSFF : CScriptedFlashFunction;
private var m_fxUpdateItemIconSFF : CScriptedFlashFunction;
private var m_fxUpdateFieldEquippedStateSFF : CScriptedFlashFunction;
private var m_fxMcItemDescription : CScriptedFlashSprite;
private var m_fxSetDesaturatedSFF : CScriptedFlashFunction;
private var m_fxSetCiriRadialSFF : CScriptedFlashFunction;
private var m_fxSetCiriItemSFF : CScriptedFlashFunction;
private var m_fxSetMeditationButtonEnabledSFF : CScriptedFlashFunction;
private var m_fxSetSelectedItem : CScriptedFlashFunction;
private var m_shown : Bool;

private var _currentSelection : String;


private var m_IsPlayerCiri : Bool;
private var m_isDesaturated : Bool;
private var m_HasBlink : Bool;
private var m_HasCharge : Bool;
private var m_allowAutoRotationReturnValue : Bool;
private var m_swappedAcceptCancel : Bool;
private var m_tutorialsHidden : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
m_tutorialsHidden = false;
m_anchorName = "ScaleOnly";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxBlockRadialMenuSFF = flashModule.GetMemberFlashFunction("Blo
ckRadialMenu");
m_fxShowRadialMenuSFF = flashModule.GetMemberFlashFunction("Show
RadialMenu");
m_fxUpdateItemIconSFF = flashModule.GetMemberFlashFunction("Upda
teItemIcon");
m_fxUpdateFieldEquippedStateSFF = flashModule.GetMemberFlashFunc
tion("UpdateFieldEquippedState");
m_fxMcItemDescription = flashModule.GetChildFlashSprite("mcItemD
escription");
m_fxSetDesaturatedSFF = flashModule.GetMemberFlashFunction("SetD
esaturated");
m_fxSetCiriRadialSFF = flashModule.GetMemberFlashFunction("setCi
riRadial");
m_fxSetCiriItemSFF = flashModule.GetMemberFlashFunction("setCiri
Item");
m_fxSetMeditationButtonEnabledSFF = flashModule.GetMemberFlashFu
nction("SetMeditationButtonEnabled");
m_fxSetSelectedItem = flashModule.GetMemberFlashFunction("setSel
ectedItem");
m_fxMcItemDescription.SetVisible(false);
theInput.RegisterListener(this, 'OnRadialMenu', 'RadialMenu');
theInput.RegisterListener(this, 'OnRadialMenuClose', 'CloseRadia
lMenu');
theInput.RegisterListener(this, 'OnRadialMenuConfirmSelection',
'ConfirmRadialMenuSelection');
theInput.RegisterListener(this, 'OnOpenMeditation', 'OpenMeditat
ion');
UpdateSwapAcceptCancel();
/* NOP */;
}
public function UpdateSwapAcceptCancel(){
var inGameConfigWrapper : CInGameConfigWrapper;
inGameConfigWrapper = theGame.GetInGameConfigWrapper();
m_swappedAcceptCancel = inGameConfigWrapper.GetVarValue('Control
s', 'SwapAcceptCancel');
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
}
public function IsRadialMenuOpened() : Bool{
return m_shown;
/* NOP */;
}
public function OnRadialMenuItemSelected(choosenSymbol : String, isDesat
urated : Bool) : Bool{

m_isDesaturated = isDesaturated;
if (!m_isDesaturated){
_currentSelection = choosenSymbol;
} else {
_currentSelection = "";
}
theSound.SoundEvent("gui_ingame_wheel_highlight");
/* NOP */;
}
public function OnRadialMenuItemChoose(choosenSymbol : String) : Bool{
}
public function OnRadialMenuConfirmSelection(action : SInputAction) : Bo
ol{
if (IsPressed(action, /* NOP */)){
if (m_swappedAcceptCancel){
UserClose();
} else {
UserConfirmSelection();
}
}
/* NOP */;
}
public function OnRadialMenuClose(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (m_swappedAcceptCancel){
UserConfirmSelection();
} else {
UserClose();
}
}
/* NOP */;
}
private function UserConfirmSelection(){
if (m_shown && !m_IsPlayerCiri){
if (_currentSelection != ""){
HideRadialMenu();
thePlayer.OnRadialMenuItemChoose(_currentSelecti
on);
} else {
theSound.SoundEvent("gui_global_denied");
}
}
/* NOP */;
}
public function OnActivateSlot(slotName : String) : Bool{
var outKeys : array<EInputKey>;
var player : W3PlayerWitcher;
player = GetWitcherPlayer();
thePlayer.OnRadialMenuItemChoose(slotName);
UpdateItemsIcons();
/* NOP */;
}
public function OnRequestCloseRadial() : Bool{
UserClose();
/* NOP */;
}
private function UserClose(){
if (m_shown){
HideRadialMenu();
}

/* NOP */;
}
public function OnOpenMeditation(action : SInputAction) : Bool{
var witcher : W3PlayerWitcher;
if (!m_IsPlayerCiri && IsPressed(action, /* NOP */)){
if (m_shown){
witcher = GetWitcherPlayer();
if (witcher.IsActionAllowed(46)){
HideRadialMenu();
ResetMeditationSavedData();
thePlayer.OnRadialMenuItemChoose("Medita
tion");
if (thePlayer.GetCurrentStateName() != '
Meditation'){
thePlayer.DisplayActionDisallowe
dHudMessage(46, /* NOP */, witcher.IsThreatened(), witcher.CanMeditateHere(), wi
tcher.IsThreatened());
} else {
return true;
}
} else {
thePlayer.DisplayActionDisallowedHudMess
age(46, /* NOP */, witcher.IsThreatened(), witcher.CanMeditateHere(), witcher.Is
Threatened());
}
}
}
/* NOP */;
}
public function ResetMeditationSavedData(){
var guiManager : CR4GuiManager;
guiManager = theGame.GetGuiManager();
guiManager.RemoveUISavedData('MeditationClockMenu');
/* NOP */;
}
public function OnRadialMenu(action : SInputAction) : Bool{
if (IsPressed(action, /* NOP */)){
if (m_shown){
HideRadialMenu();
return true;
}
if (!thePlayer.IsActionAllowed(3)){
thePlayer.DisplayActionDisallowedHudMessage(3, /
* NOP */, /* NOP */, /* NOP */, /* NOP */);
return false;
}
if (theGame.IsDialogOrCutscenePlaying() || theGame.IsBla
ckscreenOrFading() || !thePlayer.GetBIsInputAllowed() && !GetWitcherPlayer().IsU
ITakeInput()){
return false;
}
ShowRadialMenu();
}
/* NOP */;
}
public function ShowRadialMenu(){
var camera : CCustomCamera;
if (!m_shown && !theGame.IsDialogOrCutscenePlaying()){
thePlayer.RestoreBlockedSlots();
theGame.CenterMouse();

theGame.ForceUIAnalog(true);
theInput.StoreContext('RadialMenu');
theSound.SoundEvent("gui_ingame_wheel_open");
if (thePlayer.IsCiri() != m_IsPlayerCiri || m_HasBlink !
= thePlayer.HasAbility('CiriBlink') || m_HasCharge != thePlayer.HasAbility('Ciri
Charge')){
m_IsPlayerCiri = thePlayer.IsCiri();
m_HasBlink = thePlayer.HasAbility('CiriBlink');
m_HasCharge = thePlayer.HasAbility('CiriCharge')
;
m_fxSetCiriRadialSFF.InvokeSelfThreeArgs(FlashAr
gBool(m_IsPlayerCiri), FlashArgBool(m_HasBlink), FlashArgBool(m_HasCharge));
}
thePlayer.BlockAction(10, 'RadialMenu', /* NOP */, /* NO
P */, /* NOP */);
UpdateItemsIcons();
theGame.SetTimeScale(0.100000, theGame.GetTimescaleSourc
e(5), theGame.GetTimescalePriority(5), false, true);
GetWitcherPlayer().SetUITakeInput(true);
camera = (CCustomCamera)theCamera.GetTopmostCameraObject
();
m_allowAutoRotationReturnValue = camera.allowAutoRotatio
n;
camera.allowAutoRotation = false;
m_shown = true;
ResetItemsModule();
theGame.GetGuiManager().SendCustomUIEvent('OpenedRadialM
enu');
if (theGame.GetTutorialSystem() && theGame.GetTutorialSy
stem().IsRunning()){
theGame.GetTutorialSystem().uiHandler.OnOpenedMe
nu('RadialMenu');
}
m_fxSetMeditationButtonEnabledSFF.InvokeSelfOneArg(Flash
ArgBool(GetWitcherPlayer().IsActionAllowed(46)));
SelectCurrentSign();
/* NOP */;
if (!m_tutorialsHidden){
theGame.GetGuiManager().HideTutorial(true, false
);
m_tutorialsHidden = true;
}
}
/* NOP */;
}
private function SelectCurrentSign(){
if (thePlayer.IsCiri() == m_IsPlayerCiri){
m_fxSetSelectedItem.InvokeSelfOneArg(FlashArgString(Sign
EnumToString(thePlayer.GetEquippedSign())));
}
/* NOP */;
}
public function OnHideRadialMenu() : Bool{
/* NOP */;
if (m_tutorialsHidden){
theGame.GetGuiManager().HideTutorial(false, false);
m_tutorialsHidden = false;
}
/* NOP */;
}

public function HideRadialMenu(){


var camera : CCustomCamera;
if (m_shown){
theGame.ForceUIAnalog(false);
theSound.SoundEvent("gui_ingame_wheel_close");
theGame.RemoveTimeScale(theGame.GetTimescaleSource(5));
GetWitcherPlayer().SetUITakeInput(false);
camera = (CCustomCamera)theCamera.GetTopmostCameraObject
();
camera.allowAutoRotation = m_allowAutoRotationReturnValu
e;
m_shown = false;
theInput.RestoreContext('RadialMenu', true);
theGame.GetGuiManager().SendCustomUIEvent('ClosedRadialM
enu');
ResetItemsModule();
if (theGame.GetTutorialSystem() && theGame.GetTutorialSy
stem().IsRunning()){
theGame.GetTutorialSystem().uiHandler.OnClosedMe
nu('RadialMenu');
}
thePlayer.UnblockAction(10, 'RadialMenu');
}
/* NOP */;
}
private function ResetItemsModule(){
var itemInfoModule : CR4HudModuleItemInfo;
itemInfoModule = (CR4HudModuleItemInfo)theGame.GetHud().GetHudMo
dule("ItemInfoModule");
itemInfoModule.ResetItems();
/* NOP */;
}
public function UpdateItemsIcons(){
var i : Int32;
var inv : CInventoryComponent;
var item : SItemUniqueId;
var player : W3PlayerWitcher;
var _CurrentSelectedItem : SItemUniqueId;
var itemName : String;
var itemDescription : String;
var itemPath : String;
var itemCategory : CName;
var outKeys : array<EInputKey>;
player = GetWitcherPlayer();
inv = player.GetInventory();
_CurrentSelectedItem = GetWitcherPlayer().GetSelectedItemId();
if (m_IsPlayerCiri){
inv = thePlayer.GetInventory();
item = GetCiriItem();
if (inv.IsIdValid(item)){
itemName = inv.GetItemName(item);
itemName = GetLocStringByKeyExt(inv.GetItemLocal
izedNameByUniqueID(item));
itemDescription = GetLocStringByKeyExt(inv.GetIt
emLocalizedDescriptionByUniqueID(item));
itemPath = inv.GetItemIconPathByUniqueID(item);
}
m_fxSetCiriItemSFF.InvokeSelfThreeArgs(FlashArgString(it
emPath), FlashArgString(itemName), FlashArgString(itemDescription));
} else {

i = 7;
while (i < 11 + 1){
player.GetItemEquippedOnSlot(i, item);
if (inv.IsIdValid(item)){
itemName = GetLocStringByKeyExt(inv.GetI
temLocalizedNameByUniqueID(item));
itemDescription = GetLocStringByKeyExt(i
nv.GetItemLocalizedDescriptionByUniqueID(item));
itemCategory = inv.GetItemCategory(item)
;
itemPath = inv.GetItemIconPathByUniqueID
(item);
m_fxUpdateItemIconSFF.InvokeSelfFiveArgs
(FlashArgInt(i), FlashArgString(itemPath), FlashArgString(itemName), FlashArgStr
ing(itemCategory), FlashArgString(itemDescription));
itemName = "Slot" + i - 6;
if (item == _CurrentSelectedItem){
if (inv.IsIdValid(_CurrentSelect
edItem)){
theInput.GetCurrentKeysF
orAction('ThrowItem', outKeys);
m_fxUpdateFieldEquippedS
tateSFF.InvokeSelfFourArgs(FlashArgString(itemName), FlashArgString(itemDescript
ion), FlashArgBool(true), FlashArgInt(outKeys[0]));
m_fxMcItemDescription.Se
tVisible(true);
} else {
m_fxMcItemDescription.Se
tVisible(false);
}
} else {
m_fxUpdateFieldEquippedStateSFF.
InvokeSelfFourArgs(FlashArgString(itemName), FlashArgString(itemDescription), Fl
ashArgBool(false), FlashArgInt(0));
}
} else {
m_fxUpdateItemIconSFF.InvokeSelfFiveArgs
(FlashArgInt(i), FlashArgString(""), FlashArgString("EMPTY!!!"), FlashArgString(
""), FlashArgString(""));
}
i += 1;
}
outKeys.Clear();
theInput.GetCurrentKeysForAction('CastSign', outKeys);
m_fxUpdateFieldEquippedStateSFF.InvokeSelfFourArgs(Flash
ArgString(SignEnumToString(player.GetEquippedSign())), FlashArgString(""), Flash
ArgString(true), FlashArgInt(outKeys[0]));
}
/* NOP */;
}
public function GetCiriItem() : SItemUniqueId{
var ret : array<SItemUniqueId>;
ret = thePlayer.GetInventory().GetItemsByName('q403_ciri_meteor'
);
return ret[0];
/* NOP */;
}
public function SetDesaturated(value : Bool, fieldName : String){
if (GetWitcherPlayer()){
switch(StrLower(fieldName)){

case "aard":
GetWitcherPlayer().BlockSignSelection(0,
break;
case "axii":
GetWitcherPlayer().BlockSignSelection(4,
break;
case "igni":
GetWitcherPlayer().BlockSignSelection(2,
break;
case "quen":
GetWitcherPlayer().BlockSignSelection(3,
break;
case "yrden":
GetWitcherPlayer().BlockSignSelection(1,
break;
default:
break;
}

value);
value);
value);
value);
value);

}
m_fxSetDesaturatedSFF.InvokeSelfTwoArgs(FlashArgBool(value), Fla
shArgString(fieldName));
/* NOP */;
}
protected function UpdateScale(scale : Float, flashModule : CScriptedFla
shSprite) : Bool{
return false;
/* NOP */;
}
}
class CR4LootPopup extends CR4PopupBase{
private const var KEY_LOOT_ITEM_LIST : String;
private var _container : W3Container;
private var m_fxSetWindowTitle : CScriptedFlashFunction;
private var m_fxSetSelectionIndex : CScriptedFlashFunction;
private var m_indexToSelect : Int32;
private var safeLock : Int32;
private var inputContextSet : Bool;
public function OnConfigUI() : Bool{
var lootPopupData : W3LootPopupData;
super.OnConfigUI();
setupFunctions();
lootPopupData = (W3LootPopupData)GetPopupInitData();
theGame.ForceUIAnalog(true);
theGame.GetGuiManager().RequestMouseCursor(true);
if (theInput.LastUsedPCInput()){
theGame.MoveMouseTo(0.400000, 0.640000);
}
if (lootPopupData && lootPopupData.targetContainer && !theGame.I
sDialogOrCutscenePlaying() && !theGame.GetGuiManager().IsAnyMenu()){
theInput.StoreContext('EMPTY_CONTEXT');
inputContextSet = true;
theSound.SoundEvent("gui_loot_popup_open");
_container = lootPopupData.targetContainer;
PopulateData();
SignalLootingReactionEvent();
} else {
ClosePopup();
}
/* NOP */;

}
private function setupFunctions(){
m_fxSetWindowTitle = m_flashModule.GetMemberFlashFunction("SetWi
ndowTitle");
m_fxSetSelectionIndex = m_flashModule.GetMemberFlashFunction("Se
tSelectionIndex");
/* NOP */;
}
public function OnClosingPopup() : Bool{
theSound.SoundEvent("gui_loot_popup_close");
super.OnClosingPopup();
if (theInput.GetContext() == 'EMPTY_CONTEXT' && inputContextSet)
{
theInput.RestoreContext('EMPTY_CONTEXT', false);
}
theGame.GetGuiManager().RequestMouseCursor(false);
theGame.ForceUIAnalog(false);
SignalContainerClosedEvent();
if (ShouldProcessTutorial('TutorialLootWindow')){
FactsAdd("tutorial_container_close", 1, 1);
}
if (_container){
_container.OnContainerClosed();
}
/* NOP */;
}
public function UpdateInputContext(){
var currentContext : CName;
currentContext = theInput.GetContext();
if (inputContextSet && currentContext != 'EMPTY_CONTEXT'){
theInput.RestoreContext(currentContext, true);
if (theInput.GetContext() == 'EMPTY_CONTEXT'){
theInput.RestoreContext('EMPTY_CONTEXT', true);
}
theInput.StoreContext(currentContext);
ClosePopup();
}
/* NOP */;
}
public function PopulateData(){
var i : Int32;
var j : Int32;
var length : Int32;
var l_lootItemsFlashArray : CScriptedFlashArray;
var l_lootItemsDataFlashObject : CScriptedFlashObject;
var l_lootItemStatsFlashArray : CScriptedFlashArray;
var l_lootItemStatsDataFlashObject : CScriptedFlashObject;
var l_containerInv : CInventoryComponent;
var l_item : SItemUniqueId;
var l_itemName : String;
var l_itemIconPath : String;
var l_itemQuantity : Int32;
var l_itemPrice : Float;
var l_weight : Float;
var itemUIData : SInventoryItemUIData;
var l_allItems : array<SItemUniqueId>;
var l_primaryStatLabel : String;
var l_primaryStatValue : Float;
var l_statsList : CScriptedFlashArray;
var l_itemStats : array<SAttributeTooltip>;

var l_compareItem : SItemUniqueId;


var l_compareItemStats : array<SAttributeTooltip>;
var l_itemTags : array<CName>;
var l_typeStr : String;
l_containerInv = _container.GetInventory();
l_containerInv.GetAllItems(l_allItems);
i = l_allItems.Size() - 1;
while (i >= 0){
if (l_containerInv.ItemHasTag(l_allItems[i], theGame.par
ams.TAG_DONT_SHOW) && !l_containerInv.ItemHasTag(l_allItems[i], 'Lootable')){
l_allItems.Erase(i);
}
i -= 1;
}
length = l_allItems.Size();
l_lootItemsFlashArray = m_flashValueStorage.CreateTempFlashArray
();
l_lootItemsFlashArray.SetLength(length);
i = 0;
while (i < length){
l_item = l_allItems[i];
l_itemName = l_containerInv.GetItemLocalizedNameByUnique
ID(l_item);
l_itemName = GetLocStringByKeyExt(l_itemName);
if (l_itemName == ""){
l_itemName = " ";
}
if (l_containerInv.IsItemSingletonItem(l_item)){
l_itemQuantity = thePlayer.inv.SingletonItemGetA
mmo(l_item);
} else {
l_itemQuantity = l_containerInv.GetItemQuantity(
l_item);
}
l_itemIconPath = l_containerInv.GetItemIconPathByUniqueI
D(l_item);
if (l_containerInv.ItemHasTag(l_item, 'Quest') || l_cont
ainerInv.IsItemIngredient(l_item) || l_containerInv.IsItemAlchemyItem(l_item)){
l_weight = 0;
} else {
l_weight = l_containerInv.GetItemEncumbrance(l_i
tem);
}
l_lootItemsDataFlashObject = m_flashValueStorage.CreateT
empFlashObject(/* NOP */);
l_lootItemsDataFlashObject.SetMemberFlashString("WeightV
alue", NoTrailZeros(l_weight));
l_lootItemsDataFlashObject.SetMemberFlashString("label",
l_itemName);
l_lootItemsDataFlashObject.SetMemberFlashInt("quantity",
l_itemQuantity);
l_lootItemsDataFlashObject.SetMemberFlashNumber("PriceVa
lue", l_itemPrice);
l_lootItemsDataFlashObject.SetMemberFlashString("iconPat
h", l_itemIconPath);
l_lootItemsDataFlashObject.SetMemberFlashInt("quality",
l_containerInv.GetItemQuality(l_item));
l_containerInv.GetItemTags(l_item, l_itemTags);
GetWitcherPlayer().GetItemEquippedOnSlot(GetSlotForItem(
l_containerInv.GetItemCategory(l_item), l_itemTags, true), l_compareItem);

if (l_containerInv.GetItemName(l_item) != GetWitcherPlay
er().GetInventory().GetItemName(l_compareItem)){
GetWitcherPlayer().GetInventory().GetItemStats(l
_compareItem, l_compareItemStats);
}
l_statsList = m_flashValueStorage.CreateTempFlashArray()
;
l_containerInv.GetItemStats(l_item, l_itemStats);
CompareItemsStats(l_itemStats, l_compareItemStats, l_sta
tsList);
l_lootItemsDataFlashObject.SetMemberFlashArray("StatsLis
t", l_statsList);
l_typeStr = GetLocStringByKeyExt(GetFilterTypeName(l_con
tainerInv.GetFilterTypeByItem(l_item))) + " / " + GetItemRarityDescription(l_ite
m, l_containerInv);
l_lootItemsDataFlashObject.SetMemberFlashString("itemTyp
e", l_typeStr);
if (l_containerInv.HasItemDurability(l_item)){
l_lootItemsDataFlashObject.SetMemberFlashString(
"DurabilityValue", NoTrailZeros(l_containerInv.GetItemDurability(l_item) / l_con
tainerInv.GetItemMaxDurability(l_item) * 100));
} else {
l_lootItemsDataFlashObject.SetMemberFlashString(
"DurabilityValue", "");
}
l_containerInv.GetItemPrimaryStat(l_item, l_primaryStatL
abel, l_primaryStatValue);
l_lootItemsDataFlashObject.SetMemberFlashString("Primary
StatLabel", l_primaryStatLabel);
l_lootItemsDataFlashObject.SetMemberFlashNumber("Primary
StatValue", l_primaryStatValue);
l_lootItemsFlashArray.SetElementFlashObject(i, l_lootIte
msDataFlashObject);
i += 1;
}
m_flashValueStorage.SetFlashArray(KEY_LOOT_ITEM_LIST, l_lootItem
sFlashArray);
m_fxSetWindowTitle.InvokeSelfOneArg(FlashArgString(_container.Ge
tDisplayName(/* NOP */)));
/* NOP */;
}
public function CompareItemsStats(itemStats : array<SAttributeTooltip>,
compareItemStats : array<SAttributeTooltip>, compResult : CScriptedFlashArray){
var l_flashObject : CScriptedFlashObject;
var attributeVal : SAbilityAttributeValue;
var strDifference : String;
var percentDiff : Float;
var nDifference : Float;
var i : Int32;
var j : Int32;
var price : Int32;
strDifference = "none";
i = 0;
while (i < itemStats.Size()){
l_flashObject = m_flashValueStorage.CreateTempFlashObjec
t(/* NOP */);
l_flashObject.SetMemberFlashString("name", itemStats[i].
attributeName);
l_flashObject.SetMemberFlashString("color", itemStats[i]
.attributeColor);

j = 0;
while (j < compareItemStats.Size()){
if (itemStats[j].attributeName == compareItemSta
ts[i].attributeName){
nDifference = itemStats[j].value - compa
reItemStats[i].value;
percentDiff = AbsF(nDifference / itemSta
ts[j].value);
if (nDifference > 0){
if (percentDiff < 0.250000){
strDifference = "better"
;
} else if (percentDiff > 0.75000
0){
strDifference = "wayBett
er";
} else {
strDifference = "reallyB
etter";
}
} else if (nDifference < 0){
if (percentDiff < 0.250000){
strDifference = "worse";
} else if (percentDiff > 0.75000
0){
strDifference = "wayWors
e";
} else {
strDifference = "reallyW
orse";
}
}
break;
}
j += 1;
}
l_flashObject.SetMemberFlashString("icon", strDifference
);
if (itemStats[i].percentageValue){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value * 100) + " %");
} else if (itemStats[i].value < 0){
l_flashObject.SetMemberFlashString("value", NoTr
ailZeros(itemStats[i].value));
} else {
l_flashObject.SetMemberFlashString("value", "+"
+ NoTrailZeros(itemStats[i].value));
}
compResult.PushBackFlashObject(l_flashObject);
i += 1;
}
/* NOP */;
}
public function GetItemRarityDescription(item : SItemUniqueId, tooltipIn
v : CInventoryComponent) : String{
var itemQuality : Int32;
itemQuality = tooltipInv.GetItemQuality(item);
return GetItemRarityDescriptionFromInt(itemQuality);
/* NOP */;
}

public function OnPopupTakeAllItems() : Bool{


SignalStealingReactionEvent();
TakeAllAction();
OnCloseLootWindow();
/* NOP */;
}
public function OnPopupTakeItem(Id : Int32) : Bool{
var containerInv : CInventoryComponent;
var playerInv : CInventoryComponent;
var item : SItemUniqueId;
var invalidatedItems : array<SItemUniqueId>;
var itemName : CName;
var itemQuantity : Int32;
var i : Int32;
var category : CName;
var l_allItems : array<SItemUniqueId>;
SignalStealingReactionEvent();
m_indexToSelect = Id;
containerInv = _container.GetInventory();
playerInv = GetWitcherPlayer().inv;
containerInv.GetAllItems(l_allItems);
i = l_allItems.Size() - 1;
while (i >= 0){
if (containerInv.ItemHasTag(l_allItems[i], theGame.param
s.TAG_DONT_SHOW) || containerInv.ItemHasTag(l_allItems[i], 'NoDrop') && !contain
erInv.ItemHasTag(l_allItems[i], 'Lootable')){
l_allItems.Erase(i);
}
i -= 1;
}
item = l_allItems[Id];
itemName = containerInv.GetItemName(item);
itemQuantity = containerInv.GetItemQuantity(item);
if (containerInv.ItemHasTag(item, 'HerbGameplay')){
category = 'herb';
} else {
category = containerInv.GetItemCategory(item);
}
containerInv.NotifyItemLooted(item);
containerInv.GiveItemTo(playerInv, item, itemQuantity, true, fal
se, true);
PlayItemEquipSound(category);
containerInv.GetAllItems(l_allItems);
i = l_allItems.Size() - 1;
while (i >= 0){
if (containerInv.ItemHasTag(l_allItems[i], theGame.param
s.TAG_DONT_SHOW) || containerInv.ItemHasTag(l_allItems[i], 'NoDrop') && !contain
erInv.ItemHasTag(l_allItems[i], 'Lootable')){
l_allItems.Erase(i);
}
i -= 1;
}
if (_container){
_container.InformClueStash();
}
if (l_allItems.Size() == 0){
OnCloseLootWindow();
_container.Enable(false, /* NOP */, /* NOP */);
} else {
m_fxSetSelectionIndex.InvokeSelfOneArg(FlashArgInt(m_ind

exToSelect));
PopulateData();
}
/* NOP */;
}
public function OnCloseLootWindow() : Bool{
ClosePopup();
/* NOP */;
}
public function TakeAllAction(){
_container.TakeAllItems();
/* NOP */;
}
protected function SignalLootingReactionEvent(){
if (_container.disableStealing){
return;
}
if (_container.HasQuestItem()){
return;
}
if ((W3Herb)_container){
return;
}
if ((W3ActorRemains)_container){
return;
}
theGame.CreateNoSaveLock("Stealing", safeLock, true, /* NOP */);
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'LootingAction', -1, 10.000000, -1.000000, -1, true, /* NOP */, /*
NOP */);
/* NOP */;
}
protected function SignalStealingReactionEvent(){
if (_container.disableStealing || _container.HasQuestItem() || (
W3Herb)_container || (W3ActorRemains)_container){
return;
}
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'StealingAction', -1, 10.000000, -1.000000, -1, true, /* NOP */, /*
NOP */);
/* NOP */;
}
protected function SignalContainerClosedEvent(){
theGame.ReleaseNoSaveLock(safeLock);
if (_container.disableStealing || _container.HasQuestItem() || (
W3Herb)_container || (W3ActorRemains)_container){
return;
}
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(thePlayer, 'ContainerClosed', 10, 15.000000, -1.000000, -1, true, /* NOP */, /
* NOP */);
/* NOP */;
}
}
class W3PopupData extends CObject{
protected var ButtonsDef : array<SKeyBinding>;
protected var PopupRef : CR4MenuPopup;
public var ScreenPosX : Float;
public var ScreenPosY : Float;

public var BlurBackground : Bool;


public var PauseGame : Bool;
public var HideTutorial : Bool;
public function OnUserFeedback(KeyCode : String){
}
public function GetGFxButtons(parentFlashValueStorage : CScriptedFlashVa
lueStorage) : CScriptedFlashArray{
var resFlashArray : CScriptedFlashArray;
var tempFlashObject : CScriptedFlashObject;
var bindingGFxData : CScriptedFlashObject;
var curBinding : SKeyBinding;
var bindingsCount : Int32;
var i : Int32;
resFlashArray = parentFlashValueStorage.CreateTempFlashArray();
DefineDefaultButtons();
bindingsCount = ButtonsDef.Size();
i = 0;
while (i < bindingsCount){
curBinding = ButtonsDef[i];
tempFlashObject = parentFlashValueStorage.CreateTempFlas
hObject(/* NOP */);
bindingGFxData = tempFlashObject.CreateFlashObject("red.
game.witcher3.data.KeyBindingData");
bindingGFxData.SetMemberFlashString("gamepad_navEquivale
nt", curBinding.Gamepad_NavCode);
bindingGFxData.SetMemberFlashInt("keyboard_keyCode", cur
Binding.Keyboard_KeyCode);
bindingGFxData.SetMemberFlashString("label", GetLocStrin
gByKeyExt(curBinding.LocalizationKey));
resFlashArray.PushBackFlashObject(bindingGFxData);
i += 1;
}
return resFlashArray;
/* NOP */;
}
public function SetupOverlayRef(target : CR4MenuPopup){
PopupRef = target;
/* NOP */;
}
public function forceClose(){
}
public function ClosePopupOverlay(){
ClosePopup();
/* NOP */;
}
public function GetGFxData(parentFlashValueStorage : CScriptedFlashValue
Storage) : CScriptedFlashObject{
return NULL;
/* NOP */;
}
protected function GetContentRef() : String{
return "";
/* NOP */;
}
protected function AddButtonDef(label : String, padNavCode : String, key
boardNavCode : Int32){
var bindingDef : SKeyBinding;
bindingDef.Gamepad_NavCode = padNavCode;
bindingDef.Keyboard_KeyCode = keyboardNavCode;
bindingDef.LocalizationKey = label;

ButtonsDef.PushBack(bindingDef);
/* NOP */;
}
protected function DefineDefaultButtons(){
}
protected function ClosePopup(){
PopupRef.RequestClose();
/* NOP */;
}
}
class CAIScaredCombatTree extends CAISubTree{
}
abstract class CAINpcDefenseAction extends CAICombatActionTree{
}
class CAINpcCiriCounterAction extends CAINpcDefenseAction{
}
class CAINpcEredinParryAction extends CAINpcDefenseAction{
public editable var activationTimeLimitBonusHeavy : Float;
public editable var activationTimeLimitBonusLight : Float;
}
class CAINpcSummonGuardsAction extends CAINpcDefenseAction{
}
abstract class CAINpcTacticTree extends CAISubTree{
public editable inlined var params : CAINpcTacticTreeParams;
public function Init(){
params = new CAINpcTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcTacticTreeParams extends CAISubTreeParameters{
public editable inlined var specialActions : array<CAISpecialAction>;
public editable var dontUseRunWhileStrafing : Bool;
public editable var allowChangingGuard : Bool;
public function Init(){
}
public function InitializeSpecialActions(){
var i : Int32;
i = 0;
while (i < specialActions.Size()){
specialActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
abstract class CAINpcMeleeTacticTree extends CAINpcTacticTree{
}
abstract class CAINpcRangedTacticTree extends CAINpcTacticTree{
}

abstract class CAINpcCustomTacticTree extends CAINpcTacticTree{


}
abstract class CAISpecialAction extends CAISubTree{
public var params : CAISpecialActionParams;
public function Init(){
params = new CAISpecialActionParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcCombatRetreatActionTree extends CAICombatActionTree{
}
class CAINpcPreCombatWarningActionTree extends CAICombatActionTree{
}
class CAINpcFormationTacticTree extends CAISubTree{
public editable inlined var params : CAINpcFormationTacticTreeParams;
public function Init(){
params = new CAINpcFormationTacticTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcFormationTacticTreeParams extends CAISubTreeParameters{
public editable inlined var formationFollowerAttackAction : CAIAttackAct
ionTree;
public editable inlined var formationLeaderAttackBehavior : CAIAttackBeh
aviorTree;
public function Init(){
formationFollowerAttackAction = new CAIBasicAttackActionTree in
this;
formationFollowerAttackAction.OnCreated();
formationLeaderAttackBehavior = new CAIAttackBehaviorTree in thi
s;
formationLeaderAttackBehavior.OnCreated();
/* NOP */;
}
}
abstract class CAIAttackActionTree extends CAICombatActionTree{
public editable inlined var params : CAIAttackActionTreeParams;
public function Init(){
params = new CAIAttackActionTreeParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAIAttackBehaviorTree extends CAICombatActionTree{
public editable inlined var params : CAIAttackBehaviorTreeParams;
public function Init(){
params = new CAIAttackBehaviorTreeParams in this;
params.OnCreated();
/* NOP */;
}
}

class CAIAttackBehaviorTreeParams extends CAICombatActionParameters{


public editable inlined var chargeAction : Bool;
public editable inlined var approachAction : Bool;
public editable inlined var throwBomb : Bool;
public editable inlined var teleportAction : Bool;
public editable inlined var attackAction : CAIAttackActionTree;
public editable inlined var attackActionRange : CName;
public editable inlined var farAttackAction : CAIAttackActionTree;
public editable inlined var farAttackActionRange : CName;
public function Init(){
attackAction = new CAIBasicAttackActionTree in this;
attackAction.OnCreated();
attackActionRange = 'rangeNormal';
farAttackActionRange = 'rangeFar';
/* NOP */;
}
}
class CAISpecialActionParams extends CAISubTreeParameters{
}
class CAIAttackActionTreeParams extends CAICombatActionParameters{
public function Init(){
}
}
class CAINpcCombatStyleParams extends CAISubTreeParameters{
public editable var LeftItemType : CName;
public editable var RightItemType : CName;
public editable var chooseSilverIfPossible : Bool;
public editable var behGraph : EBehaviorGraph;
public editable var minCombatStyleDistance : Float;
public editable inlined var defenseActions : array<CAINpcDefenseAction>;
public editable inlined var combatTacticTree : CAINpcTacticTree;
public editable inlined var attackBehavior : CAIAttackBehaviorTree;
public editable var potentialFollower : Bool;
public editable var tryToUseFormation : Bool;
public editable inlined var formationTacticTree : CAINpcFormationTacticT
ree;
public function Init(){
var i : Int32;
var defenseAction : CAINpcDefenseAction;
defenseAction = new CAINpcParryAction in this;
defenseAction.OnCreated();
defenseActions.PushBack(defenseAction);
defenseAction = new CAINpcDodgeAction in this;
defenseAction.OnCreated();
defenseActions.PushBack(defenseAction);
defenseAction = new CAINpcCounterAction in this;
defenseAction.OnCreated();
defenseActions.PushBack(defenseAction);
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
attackBehavior = new CAIAttackBehaviorTree in this;
attackBehavior.OnCreated();
if (tryToUseFormation){
formationTacticTree = new CAINpcFormationTacticTree in t
his;
formationTacticTree.OnCreated();

}
/* NOP */;
}
}
class CAINpcStyleSorceressParams extends CAINpcCombatStyleParams{
public editable var magicAttackResourceName : CName;
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSorceressTacticTree in this;
combatTacticTree.OnCreated();
defenseActions.Clear();
defenseActions.PushBack(new CAINpcCounterPushAction in this);
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAINpcStyleSorcererParams extends CAINpcCombatStyleParams{
public editable var magicAttackResourceName : CName;
public function Init(){
var i : Int32;
super.Init();
combatTacticTree = new CAINpcSurroundTacticTree in this;
combatTacticTree.OnCreated();
combatTacticTree.params.dontUseRunWhileStrafing = true;
attackBehavior.params.attackAction = new CAITwoHandedAttackActio
nTree in attackBehavior.params;
attackBehavior.params.attackAction.OnCreated();
attackBehavior.params.attackActionRange = 'thrust250';
attackBehavior.params.farAttackActionRange = 'thrust320';
i = 0;
while (i < defenseActions.Size()){
defenseActions[i].OnCreated();
i += 1;
}
/* NOP */;
}
}
class CAIPCBase extends CAIBaseTree{
}
class CAINpcRiderDefaults extends CAIDefaults{
public editable inlined var npcGroupType : CAINPCGroupTypeRedefinition;
public editable inlined var combatTree : CAINpcCombat;
public editable inlined var riderCombatTree : CAINpcRiderCombat;
public editable inlined var idleTree : CAIIdleTree;
public editable inlined var riderIdleTree : CAINpcIdleHorseRider;
public editable inlined var deathTree : CAIDeathTree;
public editable inlined var reactionTree : CAINpcReactionsTree;
public editable inlined var softReactionTree : CAISoftReactionTree;
public editable var hasDrinkingMinigame : Bool;
public function Init(){
var stdStyle : CAINpcCombatStyle;

combatTree = new CAINpcCombat in this;


combatTree.OnCreated();
riderCombatTree = new CAINpcRiderCombat in this;
riderCombatTree.OnCreated();
deathTree = new CAINpcDeath in this;
deathTree.OnCreated();
/* NOP */;
}
}
class CAINpcRiderCombat extends CAICombatTree{
public editable inlined var params : CAINpcRiderCombatParams;
public function Init(){
params = new CAINpcRiderCombatParams in this;
params.Init();
/* NOP */;
}
}
class CAINpcIdleHorseRider extends CAIRiderIdle{
public function Init(){
params = new CAINpcIdleHorseRiderParams in this;
params.OnCreated();
/* NOP */;
}
}
class CAINpcRiderCombatParams extends CAICombatParameters{
public editable var reachabilityTolerance : Float;
public function Init(){
}
}
class CAICombatDecoratorGeneric extends CAICombatDecoratorTree{
}
class CAIRiderCombatDecoratorSimple extends CAICombatDecoratorTree{
}
class CAIRiderCombatDecoratorGeneric extends CAICombatDecoratorGeneric{
}
class CAINpcIdleParams extends CAIIdleParameters{
}
class CAINpcActiveIdleParams extends CAIIdleParameters{
public editable inlined var wanderTree : CAIWanderTree;
public editable inlined var workTree : CAINpcWork;
public function Init(){
super.Init();
wanderTree = new CAIWanderWithHistory in this;
workTree = new CAINpcWork in this;
wanderTree.OnCreated();
workTree.OnCreated();
workTree.InitWander();
/* NOP */;
}
}
class CAINpcWork extends CAISubTree{

public
public
public
public

editable inlined var actionPointSelector : CActionPointSelector;


editable var spawnToWork : Bool;
var params : CAINpcWorkParams;
function Init(){
spawnToWork = true;
actionPointSelector = new CSimpleActionPointSelector in this;
/* NOP */;

}
public function InitWander(){
spawnToWork = true;
actionPointSelector = new CWanderActionPointSelector in this;
/* NOP */;
}
}
class CAINpcTaggedWanderParams extends CAINpcWanderParams{
public editable var wanderPointsGroupTag : CName;
}
class CAINpcRandomWanderParams extends CAINpcTaggedWanderParams{
}
class CAILeadPackWander extends CAIDynamicWander{
public editable var leaderRegroupEvent : CName;
public editable var followers : Int32;
public editable var canWanderRun : Bool;
public editable var chanceToRun : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIDynamicWanderParams extends CAINpcWanderParams{
public editable var dynamicWanderArea : EntityHandle;
public editable var dynamicWanderIdleDuration : Float;
public editable var dynamicWanderIdleChance : Float;
public editable var dynamicWanderMoveDuration : Float;
public editable var dynamicWanderMoveChance : Float;
public function Init(){
super.Init();
/* NOP */;
}
}
class CAIFollowPartyMemberSideBySideTree extends CAIFollowPartyMemeberTree{
public editable var useCustomSteeringGraph : Bool;
public editable var customSteeringGraph : CMoveSteeringBehavior;
public function Init(){
super.Init();
useCustomSteeringGraph = true;
customSteeringGraph = LoadSteeringGraph("gameplay/behaviors/npc/
steering/action/follow_side_by_side.w2steer");
followDistance = 0.000000;
moveType = 1;
/* NOP */;
}
}
class CAIPatrol extends CAIWanderTree{

}
class CAINpcWorkParams extends CAISubTreeParameters{
public editable inlined var actionPointSelector : CActionPointSelector;
public editable var spawnToWork : Bool;
}
class CAINpcWorkIdleParams extends CAIIdleParameters{
public editable inlined var actionPointSelector : CActionPointSelector;
public editable var actionPointMoveType : EMoveType;
}
class CAIFollowLeaderTree extends IAIIdleFormationTree{
public editable var leaderName : CName;
}
class CAIFollowLeaderParameters extends CAIIdleParameters{
public editable var leaderName : CName;
public editable var formation : CFormation;
}
class CAILeadFormationTree extends IAIIdleFormationTree{
public editable var leadFormationSteeringGraph : CMoveSteeringBehavior;
public editable inlined var leadSubtree : CAIIdleTree;
public function Init(){
super.Init();
leadFormationSteeringGraph = LoadSteeringGraph("gameplay/behavio
rs/npc/formation/steering_leader/leader_default.w2steer");
/* NOP */;
}
}
class CAIIdleSpontanousFormationTree extends IAIIdleFormationTree{
public editable var partyMemberName : CName;
public editable var leaderSteering : CMoveSteeringBehavior;
public editable inlined var leadFormationTree : CAIIdleTree;
public editable inlined var loneWolfTree : CAIIdleTree;
public function Init(){
super.Init();
leaderSteering = LoadSteeringGraph("gameplay/behaviors/npc/forma
tion/steering_leader/leader_default.w2steer");
/* NOP */;
}
}
class CAINpcUnconsciousParams extends CAIDeathParameters{
public editable var unconsciousDuration : Float;
public editable var unconsciousGetUpDist : Float;
}
class CAIDefeatedParams extends CAIDeathParameters{
public editable inlined var localDeathTree : CAIDeathTree;
public editable inlined var unconsciousTree : CAINpcUnconsciousTree;
public function Init(){
localDeathTree = new CAINpcDeath in this;
localDeathTree.OnCreated();
unconsciousTree = new CAINpcUnconsciousTree in this;
unconsciousTree.OnCreated();
/* NOP */;
}

}
class CAINpcStyleMountedParams extends CAINpcCombatStyleParams{
}
class CAINpcCriticalStateParams extends CAICombatActionParameters{
public editable var FinisherAnim : CName;
}
class CAIMountHorse extends CAIRidingSubTree{
}
class CAIDismountHorse extends CAIRidingSubTree{
}
class CAIGenericFlee extends CAIFleeTree{
}
class CGoatDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 30.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CCatDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 5.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CRoosterDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 5.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CRamDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 20.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;

dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CGooseDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 5.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CSheepDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 10.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 2.000000;
dynamicWanderMoveChance = 0.200000;
wanderMoveType = 0;
/* NOP */;
}
}
class CPigDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 10.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 4.000000;
dynamicWanderMoveChance = 0.200000;
wanderMoveType = 0;
/* NOP */;
}
}
class CCowDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 60.000000;
dynamicWanderIdleChance = 1.000000;
dynamicWanderMoveDuration = 3.000000;
dynamicWanderMoveChance = 1.000000;
wanderMoveType = 0;
/* NOP */;
}
}
class CDogDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 10.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;

dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CDeerDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 10.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CHareDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 5.000000;
dynamicWanderIdleChance = 0.500000;
dynamicWanderMoveDuration = 5.000000;
dynamicWanderMoveChance = 0.500000;
wanderMoveType = 0;
/* NOP */;
}
}
class CTamedHorseDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
wanderMoveType = 0;
/* NOP */;
}
}
class CWildHorseDynamicWander extends CAIDynamicWander{
public function Init(){
super.Init();
dynamicWanderIdleDuration = 4.000000;
dynamicWanderIdleChance = 0.250000;
wanderMoveType = 1;
/* NOP */;
}
}
class BTCondAerialSpaceIsFree extends IBehTreeTask{
public var localOffset : Vector;
public var checkLineOfSight : Bool;
public var cylinderRadiusToCheck : Float;
public var cylinderHeightToCheck : Float;
public var checkedNode : ETargetName;
public var namedTarget : CName;
private var m_CollisionGroupNames : array<CName>;
private var m_LastTestTime : Float;
private var m_LastTestResult : Bool;
public function Initialize(){
m_CollisionGroupNames.PushBack('Terrain');

m_CollisionGroupNames.PushBack('Foliage');
m_CollisionGroupNames.PushBack('Static');
/* NOP */;
}
public function IsAvailable() : Bool{
var l_npc : CNewNPC;
var l_matrix : Matrix;
var l_pos : Vector;
var l_posToTest : Vector;
var l_worldOffset : Vector;
var l_ground : Vector;
var l_normal : Vector;
var l_npcRadius : Float;
var l_rotation : EulerAngles;
var l_temp : Vector;
var l_toPosVect : Vector;
var l_heading : Float;
l_npc = GetNPC();
if (theGame.GetEngineTimeAsSeconds() - m_LastTestTime > 1.000000
){
switch(checkedNode){
case 0:
l_pos = l_npc.GetWorldPosition();
l_matrix = l_npc.GetLocalToWorld();
break;
case 1:
l_pos = GetCombatTarget().GetWorldPosition();
l_matrix = GetCombatTarget().GetLocalToWorld();
break;
case 2:
l_pos = GetActionTarget().GetWorldPosition();
l_matrix = GetActionTarget().GetLocalToWorld();
break;
case 3:
GetCustomTarget(l_pos, l_heading);
l_matrix = l_npc.GetLocalToWorld();
break;
case 4:
l_pos = GetNamedTarget(namedTarget).GetWorldPosi
tion();
l_matrix = GetNamedTarget(namedTarget).GetLocalT
oWorld();
break;
}
l_worldOffset = VecTransform(l_matrix, localOffset);
l_posToTest = l_worldOffset;
l_npcRadius = l_npc.GetRadius();
m_LastTestResult = true;
if (theGame.GetWorld().SweepTest(l_posToTest, l_posToTes
t + Vector(0, 0, cylinderHeightToCheck), cylinderRadiusToCheck, l_temp, l_temp,
/* NOP */)){
m_LastTestResult = false;
}
if (m_LastTestResult == true && checkLineOfSight && theG
ame.GetWorld().SweepTest(l_pos, l_posToTest, l_npcRadius, l_temp, l_temp, m_Coll
isionGroupNames)){
l_toPosVect = l_posToTest - l_pos;
l_rotation = VecToRotation(l_toPosVect);
m_LastTestResult = false;
}

}
return m_LastTestResult;
/* NOP */;
}
}
class BTCondAerialSpaceIsFreeDef extends IBehTreeConditionalTaskDefinition{
public editable var localOffset : Vector;
public editable var checkLineOfSight : Bool;
public editable var cylinderRadiusToCheck : Float;
public editable var cylinderHeightToCheck : Float;
public editable var checkedNode : ETargetName;
public editable var namedTarget : CName;
}
class CBTCondActorCharmed extends IBehTreeTask{
public function IsAvailable() : Bool{
var owner : CActor;
owner = GetActor();
if (owner.HasBuff(36) || owner.HasBuff(5)){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondActorCharmedDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondActorInDanger extends IBehTreeTask{
public editable var ignoreEntityWithTag : CName;
public var dangerRadius : Float;
public var callFromQuest : Bool;
public var checkQuestRequests : Bool;
public function IsAvailable() : Bool{
var owner : CActor;
var actors : array<CActor>;
var i : Int32;
owner = GetActor();
actors = GetActorsInRange(owner, dangerRadius, 1000000, 'None',
true);
i = 0;
while (i < actors.Size()){
if (owner.HasTag(ignoreEntityWithTag) && actors[i].HasTa
g(ignoreEntityWithTag) == false){
return true;
}
if (actors[i].IsInCombat() || GetAttitudeBetween(owner,
actors[i]) == 2){
if (IsNameValid(ignoreEntityWithTag) && actors[i
].HasTag(ignoreEntityWithTag)){
return false;
}
return true;
}
i += 1;
}
if (checkQuestRequests && callFromQuest){
callFromQuest = false;

return true;
}
return false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == 'AnimalNervous'){
callFromQuest = true;
return true;
}
return false;
/* NOP */;
}
}
class CBTCondActorInDangerDef extends IBehTreeConditionalTaskDefinition{
public editable var dangerRadius : Float;
public editable var checkQuestRequests : Bool;
public editable var ignoreEntityWithTag : CName;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('AnimalNervous');
/* NOP */;
}
}
class CBTCondActorInIdleTrigger extends IBehTreeTask{
public var inIdleTrigger : Bool;
public function IsAvailable() : Bool{
if (inIdleTrigger){
return true;
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == 'InIdleTrigger'){
inIdleTrigger = true;
return true;
}
if (eventName == 'LeftIdleTrigger'){
inIdleTrigger = false;
return true;
}
return false;
/* NOP */;
}
}
class CBTCondActorInIdleTriggerDef extends IBehTreeConditionalTaskDefinition{
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('InIdleTrigger');
listenToGameplayEvents.PushBack('LeftIdleTrigger');
/* NOP */;
}
}
class CBTCondAppearanceName extends IBehTreeTask{
public var appearanceName : CName;

public function IsAvailable() : Bool{


var owner : CActor;
var currentAppearance : CName;
owner = GetActor();
currentAppearance = owner.GetAppearance();
if (currentAppearance == appearanceName){
return true;
} else {
return false;
}
/* NOP */;
}
}
class CBTCondAppearanceNameDef extends IBehTreeConditionalTaskDefinition{
public editable var appearanceName : CName;
}
class BTCondAttackedDelay extends IBehTreeTask{
public var delay : Float;
public var wasHit : Bool;
public var completeIfAttacked : Bool;
public function IsAvailable() : Bool{
var l_npc : CNewNPC;
var l_currentDelay : Float;
l_npc = GetNPC();
if (l_npc){
if (!wasHit){
l_currentDelay = l_npc.GetDelaySinceLastAttacked
();
} else {
l_currentDelay = l_npc.GetDelaySinceLastHit();
}
return l_currentDelay >= delay;
}
return false;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var l_npc : CNewNPC;
var l_currentDelay : Float;
l_npc = GetNPC();
while (completeIfAttacked){
if (!wasHit){
l_currentDelay = l_npc.GetDelaySinceLastAttacked
();
} else {
l_currentDelay = l_npc.GetDelaySinceLastHit();
}
if (l_currentDelay < delay){
Complete(false);
}
SleepOneFrame();
}
return 0;
/* NOP */;
}
}
class BTCondAttackedDelayDef extends IBehTreeConditionalTaskDefinition{

public editable var delay : Float;


public editable var completeIfAttacked : Bool;
public editable var wasHit : Bool;
}
class BTCondBaseStatLowerThan extends IBehTreeTask{
public var checkedActor : EStatOwner;
public var baseStatType : EBaseCharacterStats;
public var statValue : Float;
public var percentage : Bool;
public var ifNot : Bool;
public function IsAvailable() : Bool{
var target : CActor;
target = GetNPC();
if (checkedActor == 1){
target = target.GetTarget();
}
if (ifNot){
if (GetStat(target) > statValue){
return true;
}
} else if (GetStat(target) < statValue){
return true;
}
return false;
/* NOP */;
}
public function GetStat(target : CActor) : Float{
var value : Float;
if (percentage){
value = 100 * target.GetStatPercents(baseStatType);
return 100 * target.GetStatPercents(baseStatType);
} else {
value = target.GetStat(baseStatType, /* NOP */);
return target.GetStat(baseStatType, /* NOP */);
}
/* NOP */;
}
}
class BTCondBaseStatLowerThanDef extends IBehTreeConditionalTaskDefinition{
public editable var checkedActor : EStatOwner;
public editable var baseStatType : EBaseCharacterStats;
public editable var statValue : Float;
public editable var percentage : Bool;
public editable var ifNot : Bool;
}
class BTCondStaminaLowerThan extends IBehTreeTask{
public var baseStatType : EBaseCharacterStats;
public var statName : CName;
public var getStat : Bool;
public var statValue : Float;
public function IsAvailable() : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (getStat){
statValue = npc.GetStat(StatNameToEnum(statName), /* NOP
*/);
getStat = false;

}
if (npc.GetStat(2, /* NOP */) < statValue){
return false;
}
return true;
/* NOP */;
}
}
class BTCondStaminaLowerThanDef extends IBehTreeConditionalTaskDefinition{
public editable var statName : CName;
}
class CBTCondBehVarCheck extends IBehTreeTask{
public var behVarName : CName;
public var behVarValue : Int32;
public function IsAvailable() : Bool{
var value : Float;
value = GetActor().GetBehaviorVariable(behVarName, /* NOP */);
return value == behVarValue;
/* NOP */;
}
}
class CBTCondBehVarCheckDef extends IBehTreeConditionalTaskDefinition{
public editable var behVarName : CName;
public editable var behVarValue : Int32;
}
class BTCondCanLandAtPosition extends IBehTreeTask{
public var localOffset : Vector;
public var checkLineOfSight : Bool;
public var maxDistanceFromGround : Float;
public var landOnlyInGuardArea : Bool;
private var m_CollisionGroupNames : array<CName>;
private var m_ObstaclesGroupNames : array<CName>;
public function Initialize(){
m_CollisionGroupNames.PushBack('Terrain');
m_CollisionGroupNames.PushBack('Foliage');
m_CollisionGroupNames.PushBack('Static');
m_ObstaclesGroupNames.PushBack('Foliage');
m_ObstaclesGroupNames.PushBack('Static');
/* NOP */;
}
public function IsAvailable() : Bool{
var l_npc : CNewNPC;
var l_matrix : Matrix;
var l_pos : Vector;
var l_posToTest : Vector;
var l_worldOffset : Vector;
var l_groudLevel : Float;
var l_ground : Vector;
var l_npcRadius : Float;
var l_landRadius : Float;
var l_rotation : EulerAngles;
var l_temp1 : Vector;
var l_temp2 : Vector;
var l_waterDepth : Float;
var l_guardArea : CAreaComponent;
l_npc = GetNPC();

l_matrix = l_npc.GetLocalToWorld();
l_worldOffset = VecTransform(l_matrix, localOffset);
l_pos = l_npc.GetWorldPosition();
l_posToTest = l_worldOffset;
l_posToTest.Z = l_pos.Z;
l_waterDepth = theGame.GetWorld().GetWaterDepth(l_posToTest, /*
NOP */);
if (l_waterDepth > 0.500000){
return false;
}
if (!theGame.GetWorld().NavigationComputeZ(l_posToTest, l_posToT
est.Z - maxDistanceFromGround, l_posToTest.Z, l_groudLevel)){
return false;
}
l_ground = l_posToTest;
l_ground.Z = l_groudLevel;
if (landOnlyInGuardArea){
l_guardArea = l_npc.GetGuardArea();
if (l_guardArea && !l_guardArea.TestPointOverlap(l_groun
d)){
return false;
}
}
l_npcRadius = l_npc.GetRadius();
l_landRadius = l_npcRadius * 2.000000;
l_rotation = l_npc.GetWorldRotation();
if (checkLineOfSight && theGame.GetWorld().SweepTest(l_pos, l_gr
ound + Vector(0, 0, 1), l_landRadius, l_temp1, l_temp2, m_ObstaclesGroupNames)){
l_npc.GetVisualDebug().AddText('landingAreaText', "Obsta
cle To landing", l_temp1, true, 14, /* NOP */, /* NOP */, /* NOP */);
l_npc.GetVisualDebug().AddBox('landingArea', Vector(l_la
ndRadius, l_landRadius, l_landRadius), l_temp1, l_rotation, true, Color(255, 0,
0), 10);
return false;
}
if (!theGame.GetWorld().NavigationCircleTest(l_ground, l_landRad
ius, /* NOP */)){
l_npc.GetVisualDebug().AddText('landingAreaText', "Canno
t Land here", l_ground, true, 14, /* NOP */, /* NOP */, /* NOP */);
l_npc.GetVisualDebug().AddBox('landingArea', Vector(l_la
ndRadius, l_landRadius, 20), l_ground - Vector(l_landRadius * 0.500000, l_landRa
dius * 0.500000, 0), l_rotation, true, Color(255, 0, 0), 10);
return false;
}
l_npc.GetVisualDebug().AddText('landingAreaText', "Landing Area"
, l_ground, true, 14, /* NOP */, /* NOP */, /* NOP */);
l_npc.GetVisualDebug().AddBox('landingArea', Vector(l_landRadius
, l_landRadius, 20), l_ground - Vector(l_landRadius * 0.500000, l_landRadius * 0
.500000, 0), l_rotation, true, Color(255, 119, 160), 10);
return true;
/* NOP */;
}
}
class BTCondCanLandAtPositionDef extends IBehTreeConditionalTaskDefinition{
public editable var localOffset : Vector;
public editable var checkLineOfSight : Bool;
public editable var maxDistanceFromGround : CBehTreeValFloat;
public editable var landOnlyInGuardArea : Bool;
}

class CBTTaskChanceFromStat extends IBehTreeTask{


public var ifNot : Bool;
public var statName : CName;
public var frequency : Float;
public var scaleWithNumberOfOpponents : Bool;
public var chancePerOpponent : Int32;
public var lastRollTime : Float;
public function IsAvailable() : Bool{
if (lastRollTime + frequency > GetLocalTime()){
return false;
}
if (ifNot){
return !Roll();
} else {
return Roll();
}
/* NOP */;
}
public function Roll() : Bool{
var npc : CNewNPC;
var rollChance : Float;
var oppNo : Int32;
var i : Int32;
npc = GetNPC();
rollChance = CalculateAttributeValue(npc.GetAttributeValue(statN
ame, /* NOP */, /* NOP */), /* NOP */) * 100;
oppNo = NumberOfOpponents();
if (scaleWithNumberOfOpponents && oppNo > 1){
rollChance = oppNo * chancePerOpponent;
}
lastRollTime = GetLocalTime();
if (RandRange(100, /* NOP */) < rollChance){
return true;
}
return false;
/* NOP */;
}
public function NumberOfOpponents() : Int32{
var owner : CNewNPC;
owner = GetNPC();
if (owner.GetTarget() == thePlayer){
return thePlayer.GetNumberOfMoveTargets();
} else {
return -1;
}
/* NOP */;
}
}
class CBTTaskChanceFromStatDef extends IBehTreeConditionalTaskDefinition{
public editable var ifNot : Bool;
public editable var statName : CName;
public editable var frequency : Float;
public editable var scaleWithNumberOfOpponents : Bool;
public editable var chancePerOpponent : Int32;
}
class BTCondCheckRotationToTarget extends IBehTreeTask{
public var ifNot : Bool;

public var toleranceAngle : Float;


public function IsAvailable() : Bool{
var npc : CNewNPC;
var target : CActor;
var res : Bool;
npc = GetNPC();
target = GetCombatTarget();
res = npc.IsRotatedTowardsPoint(target.GetWorldPosition(), toler
anceAngle);
if (ifNot){
return !res;
} else {
return res;
}
/* NOP */;
}
}
class BTCondCheckRotationToTargetDef extends IBehTreeConditionalTaskDefinition{
public editable var ifNot : Bool;
public editable var toleranceAngle : Float;
}
class BTCondCheckTargetRotationToActor extends IBehTreeTask{
public var toleranceAngle : Float;
public function IsAvailable() : Bool{
var l_npc : CNewNPC;
var l_target : CActor;
var l_res : Bool;
l_npc = GetNPC();
l_target = GetCombatTarget();
l_res = l_target.IsRotatedTowards(l_npc, toleranceAngle);
return l_res;
/* NOP */;
}
}
class BTCondCheckTargetRotationToActorDef extends IBehTreeConditionalTaskDefinit
ion{
public editable var toleranceAngle : Float;
}
class CBTCondCleanShot extends IBehTreeTask{
public var doStaticTraceOnNavTestFailure : Bool;
public var useCombatTarget : Bool;
public var owner : CActor;
public var target : CNode;
public var ownerPos : Vector;
public var targetPos : Vector;
public var res : Bool;
public function IsAvailable() : Bool{
res = NavTest();
if (res){
return true;
} else if (doStaticTraceOnNavTestFailure){
return StaticTrace();
} else {
return false;
}
/* NOP */;

}
public function FillOwnerAndTarget(){
owner = GetActor();
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
/* NOP */;
}
public function NavTest() : Bool{
FillOwnerAndTarget();
ownerPos = owner.GetWorldPosition();
targetPos = target.GetWorldPosition();
return theGame.GetWorld().NavigationLineTest(ownerPos, targetPos
, 1.500000, false, true);
/* NOP */;
}
public function StaticTrace() : Bool{
var traceStartPos : Vector;
var traceEndPos : Vector;
var traceEffect : Vector;
var normal : Vector;
var targetEntity : CGameplayEntity;
var headBoneIdx : Int32;
var entMat : Matrix;
FillOwnerAndTarget();
traceStartPos = ownerPos;
traceStartPos.Z += (CMovingPhysicalAgentComponent)owner.GetMovin
gAgentComponent().GetCapsuleHeight() * 0.750000;
if ((CActor)target){
headBoneIdx = (CActor)target.GetHeadBoneIndex();
if (headBoneIdx >= 0){
traceEndPos = MatrixGetTranslation((CActor)targe
t.GetBoneWorldMatrixByIndex(headBoneIdx));
} else {
traceEndPos = targetPos;
traceEndPos.Z += (CMovingPhysicalAgentComponent)
(CActor)target.GetMovingAgentComponent().GetCapsuleHeight() * 0.750000;
}
} else if ((CGameplayEntity)target){
targetEntity = (CGameplayEntity)target;
if (!targetEntity.aimVector.X == 0 && targetEntity.aimVe
ctor.Y == 0 && targetEntity.aimVector.Z == 0){
entMat = targetEntity.GetLocalToWorld();
targetPos = VecTransform(entMat, targetEntity.ai
mVector);
}
} else {
traceEndPos = targetPos;
}
if (theGame.GetWorld().StaticTrace(traceStartPos, traceEndPos, t
raceEffect, normal, /* NOP */)){
return false;
} else {
return true;
}
/* NOP */;
}
}

class CBTCondCleanShotDef extends IBehTreeConditionalTaskDefinition{


public editable var doStaticTraceOnNavTestFailure : Bool;
public editable var useCombatTarget : Bool;
}
class BTCondDayTime extends IBehTreeTask{
public var validTimeStart : Int32;
public var validTimeEnd : Int32;
public final function IsAvailable() : Bool{
var l_hours : Int32;
l_hours = GameTimeHours(theGame.GetGameTime());
if (l_hours >= validTimeStart && l_hours <= validTimeEnd){
return true;
}
return true;
/* NOP */;
}
}
class BTCondDayTimeDef extends IBehTreeConditionalTaskDefinition{
private editable var validTimeStart : Int32;
private editable var validTimeEnd : Int32;
}
class BTCondDistanceFromGround extends IBehTreeTask{
public var checkedActor : EStatOwner;
public var value : Float;
public var operator : EOperator;
private var m_collisionGroupNames : array<CName>;
public final function Initialize(){
m_collisionGroupNames.PushBack('Terrain');
m_collisionGroupNames.PushBack('Foliage');
m_collisionGroupNames.PushBack('Static');
/* NOP */;
}
public final function IsAvailable() : Bool{
var target : CActor;
var oppNo : Float;
target = GetNPC();
if (checkedActor == 1){
target = target.GetTarget();
}
if (value <= 0){
oppNo = 0.100000;
} else {
oppNo = target.GetDistanceFromGround(value + 1, m_collis
ionGroupNames);
}
switch(operator){
case 0:
return oppNo == value;
case 1:
return oppNo != value;
case 2:
return oppNo < value;
case 3:
return oppNo <= value;
case 4:
return oppNo > value;

case 5:
return oppNo >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondDistanceFromGroundDef extends IBehTreeConditionalTaskDefinition{
public editable var checkedActor : EStatOwner;
public editable var value : CBehTreeValFloat;
public editable var operator : EOperator;
}
class BTCondDistanceToTagged extends IBehTreeTask{
public var minDistance : Float;
public var maxDistance : Float;
public var targetTag : CName;
public function IsAvailable() : Bool{
var npc : CNewNPC;
var target : CEntity;
var dist : Float;
npc = GetNPC();
target = theGame.GetEntityByTag(targetTag);
if (target){
dist = VecDistance2D(npc.GetWorldPosition(), target.GetW
orldPosition());
if (dist >= minDistance && dist <= maxDistance){
return true;
}
}
return false;
/* NOP */;
}
}
class BTCondDistanceToTaggedDef extends
public editable var minDistance
public editable var maxDistance
public editable var targetTag :
}

IBehTreeConditionalTaskDefinition{
: CBehTreeValFloat;
: CBehTreeValFloat;
CBehTreeValCName;

class BTCondDistanceToTarget extends IBehTreeTask{


public var minDistance : Float;
public var maxDistance : Float;
public var attackRange : Bool;
public var useCombatTarget : Bool;
public var predictionTime : Float;
public function IsAvailable() : Bool{
var npc : CNewNPC;
var target : CNode;
var dist : Float;
var npcPos : Vector;
var targetPos : Vector;
npc = GetNPC();
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();

}
if (target){
if (attackRange){
if ((CActor)target){
return npc.InAttackRange((CActor)target,
/* NOP */);
} else {
return false;
}
}
npcPos = npc.GetWorldPosition();
if (predictionTime < 0 || !(CActor)target){
targetPos = target.GetWorldPosition();
} else {
targetPos = (CActor)target.PredictWorldPosition(
predictionTime);
}
dist = VecDistance2D(npcPos, targetPos);
if (dist >= minDistance && dist < maxDistance){
return true;
}
}
return false;
/* NOP */;
}
}
class BTCondDistanceToTargetDef extends IBehTreeConditionalTaskDefinition{
public editable var minDistance : Float;
public editable var maxDistance : Float;
public editable var attackRange : Bool;
public editable var useCombatTarget : Bool;
public editable var predictionTime : Float;
}
class BTCondFightStage extends IBehTreeTask{
public var currentFightStageIs : ENPCFightStage;
public function IsAvailable() : Bool{
return currentFightStageIs == GetNPC().GetCurrentFightStage();
/* NOP */;
}
}
class BTCondFightStageDef extends IBehTreeConditionalTaskDefinition{
public editable var currentFightStageIs : ENPCFightStage;
}
class CBTCondHasActorWeaponDrawn extends IBehTreeTask{
public function IsAvailable() : Bool{
var actor : CActor;
actor = GetActor();
if (actor.HasWeaponDrawn(false)){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondHasActorWeaponDrawnDef extends IBehTreeConditionalTaskDefinition{

}
class BTCondHasStaminaFor extends IBehTreeTask{
public var staminaAction : EStaminaActionType;
public function IsAvailable() : Bool{
if (GetActor().HasStaminaToUseAction(staminaAction, /* NOP */, /
* NOP */, /* NOP */)){
return true;
}
return false;
/* NOP */;
}
}
class BTCondHasStaminaForDef extends IBehTreeConditionalTaskDefinition{
public editable var staminaAction : EStaminaActionType;
}
class CBTCondHasTag extends IBehTreeTask{
public var tag : CName;
public function IsAvailable() : Bool{
return GetActor().HasTag(tag);
/* NOP */;
}
}
class CBTCondHasTagDef extends IBehTreeConditionalTaskDefinition{
public editable var tag : CName;
}
class BTCondHasTarget extends IBehTreeTask{
public var useCombatTarget : Bool;
public function IsAvailable() : Bool{
if (HasTarget()){
return true;
}
return false;
/* NOP */;
}
public function HasTarget() : Bool{
if (useCombatTarget){
return GetCombatTarget();
} else {
return GetActionTarget();
}
return false;
/* NOP */;
}
}
class BTCondHasTargetDef extends IBehTreeConditionalTaskDefinition{
public editable var useCombatTarget : Bool;
}
class BTCondHeightFromTarget extends IBehTreeTask{
public var value : Float;
public var operator : EOperator;
public function IsAvailable() : Bool{
var target : CActor;
var oppNo : Float;

var pos : Vector;


var targetPos : Vector;
target = GetNPC().GetTarget();
pos = GetNPC().GetWorldPosition();
targetPos = target.GetWorldPosition();
oppNo = pos.Z - targetPos.Z;
switch(operator){
case 0:
return oppNo == value;
case 1:
return oppNo != value;
case 2:
return oppNo < value;
case 3:
return oppNo <= value;
case 4:
return oppNo > value;
case 5:
return oppNo >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondHeightFromTargetDef extends IBehTreeConditionalTaskDefinition{
public editable var value : Float;
public editable var operator : EOperator;
}
class BTCondHitCounter extends IBehTreeTask{
public var value : Float;
public var operator : EOperator;
public var total : Bool;
public function IsAvailable() : Bool{
var hitCounter : Int32;
hitCounter = GetNPC().GetHitCounter(total);
switch(operator){
case 0:
return hitCounter == value;
case 1:
return hitCounter != value;
case 2:
return hitCounter < value;
case 3:
return hitCounter <= value;
case 4:
return hitCounter > value;
case 5:
return hitCounter >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondHitCounterDef extends IBehTreeConditionalTaskDefinition{
public editable var value : Float;

public editable var operator : EOperator;


public editable var total : Bool;
}
class CBTCondHorseCanFlee extends IBehTreeTask{
public function IsAvailable() : Bool{
if (GetNPC().GetCanFlee()){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondHorseCanFleeDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsBeingHitByIgni extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetNPC().IsBeingHitByIgni();
/* NOP */;
}
}
class CBTCondIsBeingHitByIgniDef extends IBehTreeConditionalTaskDefinition{
}
class BTCondIsChangingWeapon extends IBehTreeTask{
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public function IsAvailable() : Bool{
InitializeCombatDataStorage();
return combatDataStorage.IsProcessingItems();
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class BTCondIsChangingWeaponDef extends IBehTreeConditionalTaskDefinition{
}
class BTCondDoesChangingWeaponRequiresIdle extends IBehTreeTask{
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public function IsAvailable() : Bool{
InitializeCombatDataStorage();
return combatDataStorage.DoesProcessingRequiresIdle();
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle

r.Get();
}
/* NOP */;
}
}
class BTCondDoesChangingWeaponRequiresIdleDef extends IBehTreeConditionalTaskDef
inition{
}
class CBTCondIsCombatTargetAlive extends IBehTreeTask{
public function IsAvailable() : Bool{
if (GetCombatTarget()){
return GetCombatTarget().IsAlive();
}
return false;
/* NOP */;
}
}
class CBTCondIsCombatTargetAliveDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsDialogOrCutscenePlaying extends IBehTreeTask{
public function IsAvailable() : Bool{
return theGame.IsDialogOrCutscenePlaying();
/* NOP */;
}
}
class CBTCondIsDialogOrCutscenePlayingDef extends IBehTreeConditionalTaskDefinit
ion{
}
class BTCondIsDodging extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetActor().IsCurrentlyDodging();
/* NOP */;
}
}
class BTCondIsDodgingDef extends IBehTreeConditionalTaskDefinition{
}
class BTCondIsTargetDodging extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetCombatTarget().IsCurrentlyDodging();
/* NOP */;
}
}
class BTCondIsTargetDodgingDef extends IBehTreeConditionalTaskDefinition{
}
class BTCondIsGuarded extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetActor().IsGuarded();
/* NOP */;
}
}

class BTCondIsGuardedDef extends IBehTreeConditionalTaskDefinition{


}
class BTCondIsTargetGuarded extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetCombatTarget().IsGuarded();
/* NOP */;
}
}
class BTCondIsTargetGuardedDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsInBehaviorGraph extends IBehTreeTask{
public var behGraphName : CName;
public function IsAvailable() : Bool{
return GetNPC().GetBehaviorGraphInstanceName(/* NOP */) == behGr
aphName;
/* NOP */;
}
}
class CBTCondIsInBehaviorGraphDef extends IBehTreeConditionalTaskDefinition{
public editable var behGraphName : CName;
}
class BTCondIsInBehaviorGraphNode extends IBehTreeTask{
public var activationScriptEvent : CName;
public var deactivateScriptEvent : CName;
private var m_availability : Bool;
public function Initialize(){
GetNPC().ActivateSignalBehaviorGraphNotification(activationScrip
tEvent);
GetNPC().ActivateSignalBehaviorGraphNotification(deactivateScrip
tEvent);
/* NOP */;
}
public function IsAvailable() : Bool{
return m_availability;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == activationScriptEvent){
m_availability = true;
}
if (eventName == deactivateScriptEvent){
m_availability = false;
}
return true;
/* NOP */;
}
}
class BTCondIsInBehaviorGraphNodeDef extends IBehTreeConditionalTaskDefinition{
public editable var activationScriptEvent : CName;
public editable var deactivateScriptEvent : CName;
public function InitializeEvents(){
super.InitializeEvents();
if (IsNameValid(activationScriptEvent)){

listenToGameplayEvents.PushBack(activationScriptEvent);
}
if (IsNameValid(deactivateScriptEvent)){
listenToGameplayEvents.PushBack(deactivateScriptEvent);
}
/* NOP */;
}
}
class BTCondIsInGuardArea extends IBehTreeTask{
public var position : ETargetName;
public var namedTarget : CName;
public var valueToReturnIfNoGA : Bool;
public final function IsAvailable() : Bool{
var l_guardArea : CAreaComponent;
var l_posToTest : Vector;
l_guardArea = GetNPC().GetGuardArea();
if (!l_guardArea){
return valueToReturnIfNoGA;
}
l_posToTest = GetTargetPos(position);
if (l_guardArea.TestPointOverlap(l_posToTest)){
return true;
}
return false;
/* NOP */;
}
private final function GetTargetPos(_TargetName : ETargetName) : Vector{
var l_pos : Vector;
var l_heading : Float;
switch(_TargetName){
case 0:
return GetNPC().GetWorldPosition();
case 1:
return GetCombatTarget().GetWorldPosition();
case 2:
return GetActionTarget().GetWorldPosition();
case 3:
GetCustomTarget(l_pos, l_heading);
return l_pos;
case 4:
GetNamedTarget(namedTarget).GetWorldPosition();
default:
}
return Vector(0, 0, 0);
/* NOP */;
}
}
class BTCondIsInGuardAreaDef
private editable var
private editable var
private editable var
}

extends IBehTreeTaskDefinition{
position : ETargetName;
namedTarget : CName;
valueToReturnIfNoGA : Bool;

class BTCondIsInStance extends IBehTreeTask{


public var currStance : ENpcStance;
public var ifNot : Bool;
public function IsAvailable() : Bool{
var npc : CNewNPC;

var stanceName : ENpcStance;


npc = GetNPC();
stanceName = npc.GetCurrentStance();
if (!ifNot){
if (stanceName == currStance){
return true;
}
} else if (stanceName != currStance){
return true;
}
return false;
/* NOP */;
}
}
class BTCondIsInStanceDef extends IBehTreeConditionalTaskDefinition{
public editable var currStance : ENpcStance;
public editable var ifNot : Bool;
}
class BTCondIsInState extends IBehTreeTask{
public var stateName : CName;
public var ifNot : Bool;
public function IsAvailable() : Bool{
var npc : CNewNPC;
var temp : String;
var currState : String;
npc = GetNPC();
currState = npc.GetRootAnimatedComponent().GetCurrentBehaviorSta
te(/* NOP */);
if (!ifNot){
return currState == stateName;
} else {
return currState != stateName;
}
/* NOP */;
}
}
class BTCondIsInStateDef extends IBehTreeConditionalTaskDefinition{
public editable var stateName : CName;
public editable var ifNot : Bool;
}
class BTCondIsPlayerUnconscious extends IBehTreeTask{
public function IsAvailable() : Bool{
return thePlayer.OnCheckUnconscious();
/* NOP */;
}
}
class BTCondIsPlayerUnconsciousDef extends IBehTreeConditionalTaskDefinition{
}
class BTCondIsPlayerInCombatState extends IBehTreeTask{
public function IsAvailable() : Bool{
return thePlayer.IsInCombatState();
/* NOP */;
}
}

class BTCondIsPlayerInCombatStateDef extends IBehTreeConditionalTaskDefinition{


}
class CBTCondIsInInterior extends IBehTreeTask{
public var testSubject : ETestSubject;
public function IsAvailable() : Bool{
var owner : CNewNPC;
if (testSubject == 0){
return thePlayer.IsInInterior();
} else {
owner = GetNPC();
if (owner){
return owner.IsInInterior();
}
}
return false;
/* NOP */;
}
}
class CBTCondIsInInteriorDef extends IBehTreeConditionalTaskDefinition{
public editable var testSubject : ETestSubject;
}
class BTCondIsInTheWay extends IBehTreeTask{
public var origin : ETargetName;
public var obstacle : ETargetName;
public var destination : ETargetName;
public var returnIfInvalid : Bool;
public var requiredDistanceFromLine : Float;
public final function IsAvailable() : Bool{
var l_originPos : Vector;
var l_obstaclePos : Vector;
var l_destinationPos : Vector;
var l_tempDebug : Vector;
var l_distOrOb : Float;
var l_distOrDes : Float;
var l_distDesOb : Float;
var distanceFromLine : Float;
if (origin == 4){
l_originPos = GetNamedTarget('OriginTarget').GetWorldPos
ition();
} else {
l_originPos = GetTargetPos(origin);
}
if (obstacle == 4){
l_obstaclePos = GetNamedTarget('ObstacleTarget').GetWorl
dPosition();
} else {
l_obstaclePos = GetTargetPos(obstacle);
}
if (destination == 4){
l_destinationPos = GetNamedTarget('DestinationTarget').G
etWorldPosition();
} else {
l_destinationPos = GetTargetPos(destination);
}
if (l_originPos == Vector(0, 0, 0) || l_obstaclePos == Vector(0,
0, 0) || l_destinationPos == Vector(0, 0, 0)){

return returnIfInvalid;
}
l_tempDebug = l_destinationPos - l_originPos + Vector(0, 0, 1);
l_tempDebug = l_tempDebug * 0.500000;
GetNPC().GetVisualDebug().AddText('Destination', "Follow", l_ori
ginPos + l_tempDebug, true, /* NOP */, Color(255, 255, 255), true, 0.500000);
GetNPC().GetVisualDebug().AddArrow('toDestination', l_originPos
+ Vector(0, 0, 1), l_destinationPos + Vector(0, 0, 1), 1, 0.500000, 0.800000, tr
ue, Color(255, 56, 89), /* NOP */, 0.500000);
l_distOrOb = VecDistance(l_originPos, l_obstaclePos);
l_distOrDes = VecDistance(l_originPos, l_destinationPos);
l_distDesOb = VecDistance(l_destinationPos, l_obstaclePos);
if (l_distOrOb > l_distOrDes && l_distDesOb > l_distOrDes){
return false;
}
if (l_distOrOb < l_distOrDes && l_distDesOb < l_distOrDes){
distanceFromLine = VecDistanceToEdge(l_obstaclePos, l_or
iginPos, l_destinationPos);
if (distanceFromLine < requiredDistanceFromLine){
return true;
}
}
return false;
/* NOP */;
}
private final function GetTargetPos(_TargetName : ETargetName) : Vector{
var l_pos : Vector;
var l_heading : Float;
switch(_TargetName){
case 0:
return GetNPC().GetWorldPosition();
case 1:
return GetCombatTarget().GetWorldPosition();
case 2:
return GetActionTarget().GetWorldPosition();
case 3:
GetCustomTarget(l_pos, l_heading);
return l_pos;
default:
}
return Vector(0, 0, 0);
/* NOP */;
}
}
class BTCondIsInTheWayDef extends IBehTreeConditionalTaskDefinition{
private editable var origin : ETargetName;
private editable var obstacle : ETargetName;
private editable var destination : ETargetName;
private editable var requiredDistanceFromLine : Float;
private editable var returnIfInvalid : Bool;
}
class BTCondIsNPCGroupType extends IBehTreeTask{
public var npcType : ENPCGroupType;
public function IsAvailable() : Bool{
var owner : CNewNPC;
owner = GetNPC();
if (owner.GetNPCType() == npcType){
return true;

}
return false;
/* NOP */;
}
}
class BTCondIsNPCGroupTypeDef extends IBehTreeConditionalTaskDefinition{
public editable var npcType : ENPCGroupType;
}
class BTCondIsPackLeader extends IBehTreeTask{
public function IsAvailable() : Bool{
if (GetNPC().isPackLeader){
return true;
} else {
return false;
}
/* NOP */;
}
}
class BTCondIsPackLeaderDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsTargetInWater extends IBehTreeTask{
public var boatCounts : Bool;
public function IsAvailable() : Bool{
if (GetCombatTarget() == thePlayer){
if (boatCounts && thePlayer.IsSailing()){
return true;
}
return thePlayer.IsSwimming() || thePlayer.OnCheckDiving
();
}
return GetCombatTarget().IsSwimming();
/* NOP */;
}
}
class CBTCondIsTargetInWaterDef extends IBehTreeConditionalTaskDefinition{
public editable var boatCounts : Bool;
}
class CBTCondIsTargetUnderwater extends IBehTreeTask{
public function IsAvailable() : Bool{
if (GetCombatTarget() == thePlayer){
return thePlayer.OnCheckDiving();
}
return false;
/* NOP */;
}
}
class CBTCondIsTargetUnderwaterDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsTargetOnHorse extends IBehTreeTask{
public var useCombatTarget : Bool;
public function IsAvailable() : Bool{
if (useCombatTarget){

return GetCombatTarget().IsUsingHorse(/* NOP */);


} else {
return (CActor)GetActionTarget().IsUsingHorse(/* NOP */)
;
}
return false;
/* NOP */;
}
}
class CBTCondIsTargetOnHorseDef extends IBehTreeConditionalTaskDefinition{
public editable var useCombatTarget : Bool;
}
class CBTCondIsTargettedBy extends IBehTreeTask{
public var isTargettedByActors : Bool;
public var isTargettedByPlayer : Bool;
public function IsAvailable() : Bool{
return IsTargetted();
/* NOP */;
}
public function IsTargetted() : Bool{
var npc : CNewNPC;
var targetCombatData : CCombatDataComponent;
var res : Bool;
var i : Int32;
npc = GetNPC();
targetCombatData = (CCombatDataComponent)npc.GetComponentByClass
Name('CCombatDataComponent');
if (targetCombatData){
i = targetCombatData.GetAttackersCount();
}
if (isTargettedByActors && isTargettedByPlayer){
if (thePlayer.GetDisplayTarget()){
res = true;
}
if (res || i > 0){
return true;
}
}
if (isTargettedByActors){
return i > 0;
}
if (isTargettedByPlayer && thePlayer.GetDisplayTarget()){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondIsTargettedByDef extends IBehTreeConditionalTaskDefinition{
public editable var isTargettedByActors : Bool;
public editable var isTargettedByPlayer : Bool;
}
class CBTCondIsTargetThePlayer extends IBehTreeTask{
public var useCombatTarget : Bool;
public function IsAvailable() : Bool{
return GetTarget() == thePlayer;

/* NOP */;
}
public function GetTarget() : CActor{
if (useCombatTarget){
return GetCombatTarget();
} else {
return (CActor)GetActionTarget();
}
/* NOP */;
}
}
class CBTCondIsTargetThePlayerDef extends IBehTreeConditionalTaskDefinition{
public editable var useCombatTarget : Bool;
}
class CBTCondIsTeleporting extends IBehTreeTask{
public function IsAvailable() : Bool{
var npc : CNewNPC;
if (!npc){
npc = GetNPC();
}
return npc.IsTeleporting();
/* NOP */;
}
}
class CBTCondIsTeleportingDef extends IBehTreeTaskDefinition{
}
class CBTCondIsUnderwater extends IBehTreeTask{
public var minSubmergeDepth : Float;
public final function IsAvailable() : Bool{
var subDepth : Float;
subDepth = (CMovingPhysicalAgentComponent)GetNPC().GetMovingAgen
tComponent().GetSubmergeDepth();
if (subDepth < minSubmergeDepth * -1){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondIsUnderwaterDef extends IBehTreeConditionalTaskDefinition{
private editable var minSubmergeDepth : Float;
}
class BTCondMonsterTacticIsUsed extends IBehTreeTask{
public var tactic : EMonsterTactic;
public var distanceToCheck : Float;
public var ignoreMyself : Bool;
public function IsAvailable() : Bool{
var i : Int32;
var l_npc : CNewNPC;
var l_actorsInRange : array<CActor>;
l_npc = GetNPC();
l_actorsInRange = GetActorsInRange(l_npc, 30, 50, 'None', true);
i = 0;
while (i < l_actorsInRange.Size()){

if (ignoreMyself && l_actorsInRange[i] == l_npc){


} else if (l_actorsInRange[i].GetBehaviorVariable('Curre
ntTactic', /* NOP */) == tactic){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
}
class BTCondMonsterTacticIsUsedDef extends IBehTreeConditionalTaskDefinition{
public editable var tactic : EMonsterTactic;
public editable var distanceToCheck : Float;
public editable var ignoreMyself : Bool;
}
class BTCondMorphRatio extends IBehTreeTask{
public var value : Float;
public var operator : EOperator;
public function IsAvailable() : Bool{
var l_component : CMorphedMeshManagerComponent;
var l_currentValue : Float;
l_component = GetNPC().GetMorphedMeshManagerComponent();
if (!l_component){
return false;
}
l_currentValue = l_component.GetMorphBlend();
switch(operator){
case 0:
return l_currentValue == value;
case 1:
return l_currentValue != value;
case 2:
return l_currentValue < value;
case 3:
return l_currentValue <= value;
case 4:
return l_currentValue > value;
case 5:
return l_currentValue >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondMorphRatioDef extends IBehTreeConditionalTaskDefinition{
public editable var value : Float;
public editable var operator : EOperator;
}
class BTCondNumberOfOpponents extends IBehTreeTask{
public var value : Float;
public var operator : EOperator;
public function IsAvailable() : Bool{
var oppNo : Int32;
oppNo = NumberOfOpponents();

switch(operator){
case 0:
return oppNo
case 1:
return oppNo
case 2:
return oppNo
case 3:
return oppNo
case 4:
return oppNo
case 5:
return oppNo
default:
}
return false;
/* NOP */;

== value;
!= value;
< value;
<= value;
> value;
>= value;

}
private function NumberOfOpponents() : Int32{
var owner : CNewNPC;
var target : CActor;
var targetCombatData : CCombatDataComponent;
var opponentsNum : Int32;
owner = GetNPC();
target = owner.GetTarget();
targetCombatData = (CCombatDataComponent)target.GetComponentByCl
assName('CCombatDataComponent');
opponentsNum = -1;
if (targetCombatData){
opponentsNum = targetCombatData.GetAttackersCount();
}
return opponentsNum;
/* NOP */;
}
}
class BTCondNumberOfOpponentsDef extends IBehTreeConditionalTaskDefinition{
public editable var value : Float;
public editable var operator : EOperator;
}
class BTCondNumberOfSummonedCreaturesAliveDef extends IBehTreeConditionalTaskDef
inition{
public editable var value : Float;
public editable var operator : EOperator;
}
class BTCondPlayerIsCastingSign extends IBehTreeTask{
public var sign : ESignType;
public function IsAvailable() : Bool{
var l_currentCastSign : ESignType;
if (!thePlayer.IsInCombatAction()){
return false;
}
if (thePlayer.GetBehaviorVariable('combatActionType', /* NOP */)
!= 6){
return false;
}
l_currentCastSign = thePlayer.GetCurrentlyCastSign();
if (l_currentCastSign == sign){

return true;
} else {
return false;
}
/* NOP */;
}
}
class BTCondPlayerIsCastingSignDef extends IBehTreeConditionalTaskDefinition{
public editable var sign : ESignType;
}
class BTCondSubmersionLevel extends IBehTreeTask{
public var checkedActor : EStatOwner;
public var value : Float;
public var operator : EOperator;
public function IsAvailable() : Bool{
var l_actor : CActor;
var l_pos : Vector;
var waterLevel : Float;
var submersionLevel : Float;
l_actor = GetNPC();
if (checkedActor == 0){
l_actor = GetNPC();
} else {
l_actor = GetCombatTarget();
}
l_pos = l_actor.GetWorldPosition();
waterLevel = theGame.GetWorld().GetWaterLevel(l_pos, true);
submersionLevel = waterLevel - l_pos.Z;
switch(operator){
case 0:
return submersionLevel == value;
case 1:
return submersionLevel != value;
case 2:
return submersionLevel < value;
case 3:
return submersionLevel <= value;
case 4:
return submersionLevel > value;
case 5:
return submersionLevel >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondSubmersionLevelDef extends IBehTreeConditionalTaskDefinition{
public editable var checkedActor : EStatOwner;
public editable var value : Float;
public editable var operator : EOperator;
}
class CBTCondSwarmShieldAvailable extends IBehTreeTask{
public var checkIsShieldInPlace : Bool;
private var lair : CFlyingSwarmMasterLair;
public function IsAvailable() : Bool{

var owner : CNewNPC;


var lairEntities : array<CGameplayEntity>;
owner = GetNPC();
if (!lair){
FindGameplayEntitiesInRange(lairEntities, GetActor(), 15
0, 1, 'SwarmMasterLair', /* NOP */, /* NOP */, /* NOP */);
if (lairEntities.Size() > 0){
lair = (CFlyingSwarmMasterLair)lairEntities[0];
}
}
if (checkIsShieldInPlace){
if (lair){
if (lair.CurrentShieldGroupState() == 'shield'){
return true;
}
}
} else if (lair){
if (lair.CurrentShieldGroupState() != 'shield' && lair.C
urrentShieldGroupState() != 'gotoBirdMaster'){
return true;
}
}
return false;
/* NOP */;
}
}
class CFlyingSwarmMasterLair extends CFlyingCrittersLairEntityScript{
public var m_spawnFromBirdMasterRequest : Int32;
public var m_spawnFromShieldGroupRequest : Int32;
public var m_despawnFromBirdMasterRequest : Int32;
public var teleportGroupId : CFlyingGroupId;
public var shieldGroupId : CFlyingGroupId;
public var passedInput : CFlyingSwarmScriptInput;
public var m_init : Bool;
public var disperseShield : Bool;
public var teleportGroupPosition : Vector;
public var shieldBirdCount : Int32;
public var teleportBirdCount : Int32;
public var spawnCount : Int32;
public var checkBeginAttackArray : array<CFlyingGroupId>;
public var shieldBirdState : CName;
public function FirstActivation(scriptInput : CFlyingSwarmScriptInput, d
eltaTime : Float){
var i : Int32;
var spawnPointArray : array<CName>;
spawnCount = CeilF(spawnLimit * 0.400000);
GetSpawnPointArray(spawnPointArray);
scriptInput.CreateGroup(CeilF(spawnCount * 0.250000), spawnPoint
Array[0], 'idle', /* NOP */);
scriptInput.CreateGroup(CeilF(spawnCount * 0.250000), spawnPoint
Array[1], 'idle', /* NOP */);
scriptInput.CreateGroup(spawnCount, spawnPointArray[2], 'idle',
/* NOP */);
scriptInput.CreateGroup(0, spawnPointArray[3], 'idle', /* NOP */
);
dynamicGroups = false;
doCircling = false;
isAgressive = false;
/* NOP */;

}
public function OnTick(scriptInput : CFlyingSwarmScriptInput, active : B
ool, deltaTime : Float){
var group : CFlyingSwarmGroup;
var teleportGroupIndex : Int32;
var shieldGroupIndex : Int32;
var i : Int32;
var groupIndex : Int32;
super.OnTick(scriptInput, active, deltaTime);
if (active == false){
return;
}
if (m_init == false){
if (scriptInput.groupList.Size() > 0){
m_init = true;
shieldGroupId = scriptInput.groupList[scriptInpu
t.groupList.Size() - 2].groupId;
teleportGroupId = scriptInput.groupList[scriptIn
put.groupList.Size() - 1].groupId;
}
}
if (m_init == true){
teleportGroupPosition = scriptInput.groupList[GroupIdToG
roupIndex(scriptInput, teleportGroupId)].groupCenter;
teleportBirdCount = scriptInput.groupList[GroupIdToGroup
Index(scriptInput, teleportGroupId)].boidCount;
shieldBirdCount = scriptInput.groupList[GroupIdToGroupIn
dex(scriptInput, shieldGroupId)].boidCount;
shieldBirdState = scriptInput.groupList[GroupIdToGroupIn
dex(scriptInput, shieldGroupId)].currentGroupState;
}
passedInput = scriptInput;
if (m_spawnFromBirdMasterRequest != -1){
/* NOP */;
teleportGroupIndex = GroupIdToGroupIndex(scriptInput, te
leportGroupId);
if (teleportGroupIndex != -1){
scriptInput.groupList[teleportGroupIndex].toSpaw
nCount = m_spawnFromBirdMasterRequest;
scriptInput.groupList[teleportGroupIndex].spawnP
oiType = 'BirdMaster';
}
m_spawnFromBirdMasterRequest = -1;
}
if (m_despawnFromBirdMasterRequest != -1){
teleportGroupIndex = GroupIdToGroupIndex(scriptInput, te
leportGroupId);
if (teleportGroupIndex != -1){
group = scriptInput.groupList[teleportGroupIndex
];
if (m_despawnFromBirdMasterRequest > teleportBir
dCount){
m_despawnFromBirdMasterRequest = telepor
tBirdCount;
}
scriptInput.groupList[teleportGroupIndex].toDesp
awnCount = m_despawnFromBirdMasterRequest;
scriptInput.groupList[teleportGroupIndex].despaw
nPoiType = 'BirdMaster';
}

m_despawnFromBirdMasterRequest = -1;
}
if (m_spawnFromShieldGroupRequest != -1){
shieldGroupIndex = GroupIdToGroupIndex(scriptInput, shie
ldGroupId);
if (shieldGroupIndex != -1){
scriptInput.groupList[shieldGroupIndex].toSpawnC
ount = m_spawnFromShieldGroupRequest;
}
m_spawnFromShieldGroupRequest = -1;
}
if (disperseShield){
shieldGroupIndex = GroupIdToGroupIndex(scriptInput, shie
ldGroupId);
if (shieldGroupIndex != -1){
scriptInput.groupList[shieldGroupIndex].changeGr
oupState = 'idle';
}
disperseShield = false;
}
if (m_birdMaster && !m_birdMaster.IsAlive()){
shieldGroupIndex = GroupIdToGroupIndex(scriptInput, shie
ldGroupId);
if (shieldGroupIndex != -1){
scriptInput.groupList[shieldGroupIndex].changeGr
oupState = 'idle';
}
teleportGroupIndex = GroupIdToGroupIndex(scriptInput, te
leportGroupId);
if (teleportGroupIndex != -1){
scriptInput.groupList[teleportGroupIndex].change
GroupState = 'idle';
}
}
i = checkBeginAttackArray.Size() - 1;
while (i >= 0){
groupIndex = GroupIdToGroupIndex(scriptInput, checkBegin
AttackArray[i]);
if (groupIndex != -1){
if (scriptInput.groupList[groupIndex].currentGro
upState == 'attackPlayer'){
SignalArrivalAtNode('attackPlayer', theP
layer, 'idle', checkBeginAttackArray[i], /* NOP */, /* NOP */, /* NOP */);
checkBeginAttackArray.Erase(i);
}
} else {
checkBeginAttackArray.Erase(i);
}
i -= 1;
}
/* NOP */;
}
public function SpawnFromBirdMaster(count : Int32){
m_spawnFromBirdMasterRequest = count;
/* NOP */;
}
public function DespawnFromBirdMaster(count : Int32){
m_despawnFromBirdMasterRequest = count;
/* NOP */;
}

public function GetTeleportGroupPosition() : Vector{


return teleportGroupPosition;
/* NOP */;
}
public function GetShieldBirdCount() : Int32{
return shieldBirdCount;
/* NOP */;
}
public function GetGroupId(groupIdStateName : CName) : CFlyingGroupId{
switch(groupIdStateName){
case 'shield':
return shieldGroupId;
case 'teleport':
return teleportGroupId;
}
/* NOP */;
}
public function CurrentShieldGroupState() : CName{
return shieldBirdState;
/* NOP */;
}
public function GetTeleportBirdCount() : Int32{
return teleportBirdCount;
/* NOP */;
}
public function GetSpawnCount() : Int32{
return spawnCount;
/* NOP */;
}
public function CompensateKilledShieldBirds(count : Int32){
m_spawnFromShieldGroupRequest = count;
/* NOP */;
}
public function DisperseShield() : Bool{
disperseShield = true;
return disperseShield;
/* NOP */;
}
public function IsBirdMasterAlive() : Bool{
if (m_birdMaster){
return m_birdMaster.IsAlive();
}
return false;
/* NOP */;
}
}
class CBTCondSwarmShieldAvailableDef extends IBehTreeConditionalTaskDefinition{
public editable var checkIsShieldInPlace : Bool;
}
class BTCondSynchronisedDelay extends IBehTreeTask{
public var syncEventName : CName;
public var delay : Float;
public var skipInvoker : Bool;
public var triggerEventOnActivate : Bool;
public var triggerEventOnDeactivate : Bool;
public var triggerEventOnSuccess : Bool;
public var triggerEventOnFailed : Bool;
public var isAvailableUntilFirstEvent : Bool;

public var personalSync : Bool;


private saved var m_eventReceivedTime : Float;
public function IsAvailable() : Bool{
if (isAvailableUntilFirstEvent && m_eventReceivedTime == 0){
return true;
}
if (m_eventReceivedTime + delay < GetLocalTime()){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (triggerEventOnActivate){
TriggerEvent();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (triggerEventOnDeactivate){
TriggerEvent();
}
/* NOP */;
}
public function OnCompletion(_Success : Bool){
if (_Success && triggerEventOnSuccess){
TriggerEvent();
}
if (!_Success && triggerEventOnFailed){
TriggerEvent();
}
/* NOP */;
}
public function OnListenedGameplayEvent(_EventName : CName) : Bool{
var npc : CNewNPC;
npc = GetNPC();
m_eventReceivedTime = GetLocalTime();
isAvailableUntilFirstEvent = false;
return false;
/* NOP */;
}
public function TriggerEvent(){
var l_actor : CActor;
l_actor = GetActor();
if (personalSync){
l_actor.SignalGameplayEvent(syncEventName);
} else if (IsNameValid(syncEventName)){
theGame.GetBehTreeReactionManager().CreateReactionEvent(
l_actor, syncEventName, 1, 100, -1, -1, skipInvoker, /* NOP */);
}
/* NOP */;
}
}
class BTCondSynchronisedDelayDef extends IBehTreeConditionalTaskDefinition{
public editable var delay : Float;
public editable var syncEventName : CBehTreeValCName;
public editable var skipInvoker : Bool;
public editable var triggerEventOnActivate : Bool;

public
public
public
public
public
public

editable var triggerEventOnDeactivate : Bool;


editable var triggerEventOnSuccess : Bool;
editable var triggerEventOnFailed : Bool;
editable var isAvailableUntilFirstEvent : Bool;
editable var personalSync : Bool;
function OnSpawn(taskGen : IBehTreeTask){
var task : BTCondSynchronisedDelay;
task = (BTCondSynchronisedDelay)taskGen;
if (IsNameValid(task.syncEventName)){
ListenToGameplayEvent(task.syncEventName);
}
/* NOP */;

}
}
class BTCondTargetAttackedDelay extends IBehTreeTask{
public var delay : Float;
public var wasHit : Bool;
public function IsAvailable() : Bool{
var l_target : CActor;
var l_currentDelay : Float;
l_target = GetCombatTarget();
if (l_target){
if (!wasHit){
l_currentDelay = l_target.GetDelaySinceLastAttac
ked();
} else {
l_currentDelay = l_target.GetDelaySinceLastHit()
;
}
return l_currentDelay >= delay;
}
return false;
/* NOP */;
}
}
class BTCondTargetAttackedDelayDef extends IBehTreeConditionalTaskDefinition{
public editable var delay : Float;
public editable var wasHit : Bool;
}
class CBTCondTargetHasItemHeld extends IBehTreeTask{
public var itemCategory : CName;
public var alsoCheckIfHeldsAnything : Bool;
public function IsAvailable() : Bool{
var i : Int32;
var target : CActor;
var targetInv : CInventoryComponent;
var items : array<SItemUniqueId>;
var weapon : SItemUniqueId;
target = GetCombatTarget();
if (!target){
return true;
}
targetInv = target.GetInventory();
if (!targetInv){
return true;
}
items = targetInv.GetItemsByCategory(itemCategory);

if (items.Size() > 0){


i = 0;
while (i < items.Size()){
if (targetInv.IsItemHeld(items[i])){
return true;
}
i += 1;
}
}
if (alsoCheckIfHeldsAnything && target.IsHuman()){
weapon = targetInv.GetItemFromSlot('r_weapon');
if (!targetInv.IsIdValid(weapon)){
weapon = targetInv.GetItemFromSlot('l_weapon');
if (!targetInv.IsIdValid(weapon)){
return true;
}
}
}
return false;
/* NOP */;
}
}
class CBTCondTargetHasItemHeldDef extends IBehTreeConditionalTaskDefinition{
public editable var itemCategory : CName;
public editable var alsoCheckIfHeldsAnything : Bool;
}
class CBTCondTargetHasTag extends IBehTreeTask{
public var tag : CName;
public function IsAvailable() : Bool{
var owner : CActor;
owner = GetActor();
if (GetCombatTarget().HasTag(tag)){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondTargetHasTagDef extends IBehTreeConditionalTaskDefinition{
public editable var tag : CName;
}
class BTCondTargetIsAlly extends IBehTreeTask{
public var useNamedTarget : CName;
public var useCombatTarget : Bool;
public var saveTargetOnGameplayEvents : array<CName>;
private var m_Target : CActor;
public final function IsAvailable() : Bool{
var l_npc : CNewNPC;
l_npc = GetNPC();
if (saveTargetOnGameplayEvents.Size() == 0){
SaveTarget();
}
if (!m_Target){
return false;
}
if (l_npc.GetAttitude(m_Target) != 0){

return false;
}
return true;
/* NOP */;
}
public final function OnListenedGameplayEvent(eventName : CName) : Bool{
if (saveTargetOnGameplayEvents.Contains(eventName)){
SaveTarget();
}
return true;
/* NOP */;
}
private final function SaveTarget(){
if (IsNameValid(useNamedTarget)){
m_Target = (CActor)GetNamedTarget(useNamedTarget);
} else if (useCombatTarget){
m_Target = GetCombatTarget();
} else {
m_Target = (CActor)GetActionTarget();
}
/* NOP */;
}
}
class BTCondTargetIsAllyDef extends IBehTreeConditionalTaskDefinition{
private editable var useNamedTarget : CBehTreeValCName;
private editable var useCombatTarget : Bool;
private editable var saveTargetOnGameplayEvents : array<CName>;
public function InitializeEvents(){
var i : Int32;
super.InitializeEvents();
i = 0;
while (i < saveTargetOnGameplayEvents.Size()){
if (IsNameValid(saveTargetOnGameplayEvents[i])){
listenToGameplayEvents.PushBack(saveTargetOnGame
playEvents[i]);
}
i += 1;
}
/* NOP */;
}
}
class BTCondThreatLevel extends IBehTreeTask{
public var operator : EOperator;
public var value : Int32;
public final function IsAvailable() : Bool{
var oppNo : Int32;
oppNo = GetNPC().GetThreatLevel();
switch(operator){
case 0:
return oppNo == value;
case 1:
return oppNo != value;
case 2:
return oppNo < value;
case 3:
return oppNo <= value;
case 4:
return oppNo > value;

case 5:
return oppNo >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondThreatLevelDef extends IBehTreeConditionalTaskDefinition{
private editable var operator : EOperator;
private editable var value : Int32;
}
class BTCondTargetThreatLevel extends IBehTreeTask{
public var operator : EOperator;
public var value : Int32;
public final function IsAvailable() : Bool{
var npc : CNewNPC;
var oppNo : Int32;
npc = (CNewNPC)GetCombatTarget();
if (!npc){
return false;
}
oppNo = npc.GetThreatLevel();
switch(operator){
case 0:
return oppNo == value;
case 1:
return oppNo != value;
case 2:
return oppNo < value;
case 3:
return oppNo <= value;
case 4:
return oppNo > value;
case 5:
return oppNo >= value;
default:
}
return false;
/* NOP */;
}
}
class BTCondTargetThreatLevelDef extends IBehTreeConditionalTaskDefinition{
private editable var operator : EOperator;
private editable var value : Int32;
}
class BTCondWasNPCInTalkInteraction extends IBehTreeTask{
public function IsAvailable() : Bool{
return GetNPC().wasInTalkInteraction;
/* NOP */;
}
}
class BTCondWasNPCInTalkInteractionDef extends IBehTreeConditionalTaskDefinition
{
}

class BTCondWaterDepth extends IBehTreeTask{


public var checkedActor : EStatOwner;
public var value : Float;
public var operator : EOperator;
public var frontalOffset : Float;
public function IsAvailable() : Bool{
var l_actor : CActor;
var l_pos : Vector;
var depth : Float;
l_actor = GetNPC();
if (checkedActor == 0){
l_actor = GetNPC();
} else {
l_actor = GetCombatTarget();
}
l_pos = l_actor.GetWorldPosition();
l_pos += VecNormalize(l_actor.GetHeadingVector()) * frontalOffse
t;
depth = theGame.GetWorld().GetWaterDepth(l_pos, /* NOP */);
if (depth > 1000){
depth = 0;
}
switch(operator){
case 0:
return depth == value;
case 1:
return depth != value;
case 2:
return depth < value;
case 3:
return depth <= value;
case 4:
return depth > value;
case 5:
return depth >= value;
default:
}
return false;
/* NOP */;
}
}
class W3ItemUpgradeManager extends CObject{
private var upgrades : array<SItemUpgradeListElement>;
public function Init(){
LoadXMLData();
/* NOP */;
}
public function PurchaseUpgrade(item : SItemUniqueId, upgradeName : CNam
e) : EItemUpgradeException{
var check : EItemUpgradeException;
var i : Int32;
var idx : Int32;
check = CanPurchaseUpgrade(item, upgradeName);
if (check != 0){
return check;
}
idx = GetUpgradeIndex(item, upgradeName);
thePlayer.RemoveMoney(upgrades[idx].upgrade.cost);

i = 0;
while (i < upgrades[idx].upgrade.ingredients.Size()){
thePlayer.inv.RemoveItemByName(upgrades[idx].upgrade.ing
redients[i].itemName, upgrades[idx].upgrade.ingredients[i].quantity);
i += 1;
}
thePlayer.inv.AddItemCraftedAbility(item, upgrades[idx].upgrade.
ability, /* NOP */);
return 0;
/* NOP */;
}
private function GetUpgradeIndex(item : SItemUniqueId, upgradeName : CNa
me) : Int32{
var i : Int32;
i = 0;
while (i < upgrades.Size()){
if (upgrades[i].upgrade.upgradeName == upgradeName && up
grades[i].itemId == item){
return i;
}
i += 1;
}
return -1;
/* NOP */;
}
public function CanPurchaseUpgrade(item : SItemUniqueId, upgradeName : C
Name) : EItemUpgradeException{
var i : Int32;
var j : Int32;
var idx : Int32;
var cnt : Int32;
var upg : SItemUpgrade;
var requiredName : CName;
var requiredAbilityName : CName;
if (!thePlayer.inv.IsItemUpgradeable(item)){
return 6;
}
idx = GetUpgradeIndex(item, upgradeName);
if (idx < 0){
return 7;
}
upg = upgrades[idx].upgrade;
if (thePlayer.GetMoney() < upg.cost){
return 1;
}
i = 0;
while (i < upg.ingredients.Size()){
cnt = thePlayer.inv.GetItemQuantityByName(upg.ingredient
s[i].itemName, /* NOP */);
if (cnt <= 0){
return 2;
} else if (cnt < upg.ingredients[i].quantity){
return 3;
}
i += 1;
}
i = 0;
while (i < upg.requiredUpgrades.Size()){
requiredName = upg.requiredUpgrades[i];
requiredAbilityName = 'None';

j = 0;
while (j < upgrades.Size()){
if (upgrades[j].itemId == item && upgrades[j].up
grade.upgradeName == requiredName){
requiredAbilityName = upgrades[j].upgrad
e.ability;
break;
}
j += 1;
}
if (IsNameValid(requiredAbilityName)){
if (!thePlayer.inv.ItemHasAbility(item, required
AbilityName)){
return 4;
}
}
i += 1;
}
if (thePlayer.inv.ItemHasAbility(item, upg.ability)){
return 5;
}
return 0;
/* NOP */;
}
private function LoadXMLData(){
var items : array<SItemUniqueId>;
var i : Int32;
var j : Int32;
var k : Int32;
var m : Int32;
var tmpInt : Int32;
var tmpName : CName;
var upgradesListName : CName;
var tmpString : String;
var dm : CDefinitionsManagerAccessor;
var main : SCustomNode;
var ingredients : SCustomNode;
var requirements : SCustomNode;
var upgradesDefs : array<SCustomNode>;
var ing : SItemParts;
var upgradeElement : SItemUpgradeListElement;
thePlayer.inv.GetAllItems(items);
i = items.Size() - 1;
while (i >= 0){
if (!thePlayer.inv.IsItemUpgradeable(items[i])){
items.Erase(i);
}
i -= 1;
}
if (items.Size() <= 0){
return;
}
dm = theGame.GetDefinitionsManager();
main = dm.GetCustomDefinition('upgrades_lists');
j = 0;
while (j < items.Size()){
upgradesListName = dm.GetItemUpgradeListName(thePlayer.i
nv.GetItemName(items[j]), true);
if (!IsNameValid(upgradesListName)){
LogAssert(false, "W3ItemUpgradeManager.LoadXMLDa

ta: item <<" + thePlayer.inv.GetItemName(items[j]) + ">> has non-valid upgrades


list name <<" + upgradesListName + ">>");
} else {
i = 0;
while (i < main.subNodes.Size()){
dm.GetCustomNodeAttributeValueName(main.
subNodes[i], 'name_name', tmpName);
if (tmpName != upgradesListName){
} else {
upgradesDefs = main.subNodes[i].
subNodes;
k = 0;
while (k < upgradesDefs.Size()){
if (dm.GetCustomNodeAttr
ibuteValueName(upgradesDefs[k], 'name_name', tmpName)){
upgradeElement.u
pgrade.upgradeName = tmpName;
}
if (dm.GetCustomNodeAttr
ibuteValueName(upgradesDefs[k], 'localizedName_name', tmpName)){
upgradeElement.u
pgrade.localizedName = tmpName;
}
if (dm.GetCustomNodeAttr
ibuteValueName(upgradesDefs[k], 'localizedDescription_name', tmpName)){
upgradeElement.u
pgrade.localizedDescriptionName = tmpName;
}
if (dm.GetCustomNodeAttr
ibuteValueInt(upgradesDefs[k], 'cost', tmpInt)){
upgradeElement.u
pgrade.cost = tmpInt;
}
if (dm.GetCustomNodeAttr
ibuteValueString(upgradesDefs[k], 'icon', tmpString)){
upgradeElement.u
pgrade.iconPath = tmpString;
}
if (dm.GetCustomNodeAttr
ibuteValueName(upgradesDefs[k], 'ability_name', tmpName)){
upgradeElement.u
pgrade.ability = tmpName;
}
ingredients = dm.GetCust
omDefinitionSubNode(upgradesDefs[k], 'ingredients');
m = 0;
while (m < ingredients.s
ubNodes.Size()){
if (dm.GetCustom
NodeAttributeValueName(ingredients.subNodes[m], 'name_name', tmpName)){
ing.item
Name = tmpName;
}
if (dm.GetCustom
NodeAttributeValueInt(ingredients.subNodes[m], 'quantity', tmpInt)){
ing.quan
tity = tmpInt;
}
upgradeElement.u
pgrade.ingredients.PushBack(ing);

ing.itemName = '
None';
ing.quantity = 0
;
m += 1;
}
requirements = dm.GetCus
tomDefinitionSubNode(upgradesDefs[k], 'required_upgrades');
m = 0;
while (m < requirements.
values.Size()){
if (IsNameValid(
requirements.values[m])){
upgradeE
lement.upgrade.requiredUpgrades.PushBack(requirements.values[m]);
} else {
LogAsser
t(false, "W3ItemUpgradeManager.LoadXMLData: found not valid (non-name) required
upgrade <<" + requirements.values[m] + ">>!!");
}
m += 1;
}
upgradeElement.itemId =
items[j];
upgrades.PushBack(upgrad
eElement);
upgradeElement.itemId =
GetInvalidUniqueId();
upgradeElement.upgrade.u
pgradeName = 'None';
upgradeElement.upgrade.l
ocalizedName = 'None';
upgradeElement.upgrade.l
ocalizedDescriptionName = 'None';
upgradeElement.upgrade.c
ost = 0;
upgradeElement.upgrade.i
conPath = "";
upgradeElement.upgrade.a
bility = 'None';
upgradeElement.upgrade.i
ngredients.Clear();
upgradeElement.upgrade.r
equiredUpgrades.Clear();
k += 1;
}
}
i += 1;
}
}
j += 1;
}
/* NOP */;
}
}
class BTCondWaterDepthDef extends IBehTreeConditionalTaskDefinition{
public editable var checkedActor : EStatOwner;
public editable var value : Float;
public editable var operator : EOperator;

public editable var frontalOffset : Float;


}
class CBTCondIsWeaponLoaded extends IBehTreeTask{
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public function IsAvailable() : Bool{
if (combatDataStorage.GetProjectile() || combatDataStorage.Retur
nWeaponSubTypeForActiveCombatStyle() == 0){
return true;
}
return false;
/* NOP */;
}
public function Initialize(){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandler.Get();
/* NOP */;
}
}
class CBTCondIsWeaponLoadedDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsTargetAMonster extends IBehTreeTask{
public function IsAvailable() : Bool{
var target : CActor;
target = GetCombatTarget();
if (target.IsMonster()){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondIsTargetAMonsterDef extends IBehTreeConditionalTaskDefinition{
}
class CBTCondIsTargetOnBoat extends IBehTreeTask{
public function IsAvailable() : Bool{
if (GetCombatTarget() == thePlayer && thePlayer.IsSailing()){
return true;
}
return false;
/* NOP */;
}
}
class CBTCondIsTargetOnBoatDef extends IBehTreeConditionalTaskDefinition{
}
class W3ActorLatentActionFollow extends W3ActorLatentActionFollowPlayer{
public editable var targetTag : CName;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIFollowAction;
action = (CAIFollowAction)super.ConvertToActionTree(parentObj);
action.params.targetTag = targetTag;
return action;

/* NOP */;
}
}
class W3ActorLatentActionMoveAlongPath extends IPresetActorLatentAction{
public editable var pathTag : CName;
public editable var upThePath : Bool;
public editable var fromBeginning : Bool;
public editable var pathMargin : Float;
public editable var moveType : EMoveType;
public editable var moveSpeed : Float;
public editable var dontCareAboutNavigable : Bool;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIMoveAlongPathAction;
action = new CAIMoveAlongPathAction in parentObj;
action.OnCreated();
action.params.pathTag = pathTag;
action.params.upThePath = upThePath;
action.params.fromBeginning = fromBeginning;
action.params.pathMargin = pathMargin;
action.params.moveType = moveType;
action.params.moveSpeed = moveSpeed;
action.params.dontCareAboutNavigable = dontCareAboutNavigable;
action.params.steeringGraph = NULL;
action.params.arrivalDistance = 0.500000;
action.params.rotateAfterReachStart = true;
return action;
/* NOP */;
}
}
class W3ActorLatentActionMoveAlongPathWithCompanion extends W3ActorLatentActionM
oveAlongPath{
public editable var companionTag : CName;
public editable var maxDistance : Float;
public editable var minDistance : Float;
public editable var progressWhenCompanionIsAhead : Bool;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIMoveAlongPathWithCompanionAction;
var params : CAIMoveAlongPathWithCompanionParams;
action = new CAIMoveAlongPathWithCompanionAction in parentObj;
action.OnCreated();
params = (CAIMoveAlongPathWithCompanionParams)action.params;
params.pathTag = pathTag;
params.upThePath = upThePath;
params.fromBeginning = fromBeginning;
params.pathMargin = pathMargin;
params.moveType = moveType;
params.moveSpeed = moveSpeed;
params.steeringGraph = NULL;
params.arrivalDistance = 0.500000;
params.rotateAfterReachStart = true;
params.dontCareAboutNavigable = dontCareAboutNavigable;
params.companionTag = companionTag;
params.maxDistance = maxDistance;
params.minDistance = minDistance;
params.progressWhenCompanionIsAhead = progressWhenCompanionIsAhe
ad;

return action;
/* NOP */;
}
}
class W3ActorLatentActionMoveAlongPathAwareOfTail extends W3ActorLatentActionMov
eAlongPath{
public editable var tailTag : CName;
public editable var startMovementDistance : Float;
public editable var stopDistance : Float;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIMoveAlongPathAwareOfTailAction;
var params : CAIMoveAlongPathAwareOfTailParams;
action = new CAIMoveAlongPathAwareOfTailAction in parentObj;
action.OnCreated();
params = (CAIMoveAlongPathAwareOfTailParams)action.params;
params.pathTag = pathTag;
params.upThePath = upThePath;
params.fromBeginning = fromBeginning;
params.pathMargin = pathMargin;
params.moveType = moveType;
params.moveSpeed = moveSpeed;
params.steeringGraph = NULL;
params.arrivalDistance = 0.500000;
params.rotateAfterReachStart = true;
params.dontCareAboutNavigable = dontCareAboutNavigable;
params.tailTag = tailTag;
params.startMovementDistance = startMovementDistance;
params.stopDistance = stopDistance;
return action;
/* NOP */;
}
}
class W3ActorLatentActionMoveTo extends IPresetActorLatentAction{
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var targetTag : CName;
public editable var rotateAfterwards : Bool;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIMoveToAction;
action = new CAIMoveToAction in parentObj;
action.OnCreated();
action.params.maxDistance = maxDistance;
action.params.moveSpeed = moveSpeed;
action.params.moveType = moveType;
action.params.targetTag = targetTag;
action.params.rotateAfterwards = rotateAfterwards;
return action;
/* NOP */;
}
}
class W3ActorLatentActionPlayAnimation extends IPresetActorLatentAction{
public editable var eventStateName : CName;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{

var action : CAIPlayAnimationStateAction;


action = new CAIPlayAnimationStateAction in parentObj;
action.OnCreated();
action.eventStateName = eventStateName;
return action;
/* NOP */;
}
}
class W3ActorLatentActionSlotAnimation extends IPresetActorLatentAction{
public editable var animName : CName;
public editable var slotName : CName;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIPlayAnimationSlotAction;
action = new CAIPlayAnimationSlotAction in parentObj;
action.OnCreated();
action.animName = animName;
action.slotName = slotName;
return action;
/* NOP */;
}
}
class W3ActorLatentActionBreakAnimations extends IPresetActorLatentAction{
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIBreakAnimationsAction;
action = new CAIBreakAnimationsAction in parentObj;
action.OnCreated();
return action;
/* NOP */;
}
}
class W3ActorLatentActionPlayVoiceSet extends IPresetActorLatentAction{
public editable var voiceSet : String;
public editable var priority : Int32;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIPlayVoiceSetAction;
action = new CAIPlayVoiceSetAction in parentObj;
action.OnCreated();
action.voiceSet = voiceSet;
action.priority = priority;
return action;
/* NOP */;
}
}
class W3ActorLatentActionRotateTo extends IPresetActorLatentAction{
public editable var targetTag : CName;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIRotateToAction;
action = new CAIRotateToAction in parentObj;
action.OnCreated();
action.targetTag = targetTag;
return action;
/* NOP */;

}
}
class W3ActorLatentActionWalkToTargetWaitActor extends IPresetActorLatentAction{
public editable var tag : CName;
public editable var maxDistance : Float;
public editable var moveSpeed : Float;
public editable var moveType : EMoveType;
public editable var waitForTag : CName;
public editable var timeout : Float;
public editable var testDistance : Float;
public function ConvertToActionTree(parentObj : IScriptable) : IAIAction
Tree{
var action : CAIWalkToTargetWaitingForActorAction;
action = new CAIWalkToTargetWaitingForActorAction in parentObj;
action.OnCreated();
action.tag = tag;
action.maxDistance = maxDistance;
action.moveSpeed = moveSpeed;
action.moveType = moveType;
action.waitForTag = waitForTag;
action.timeout = timeout;
action.testDistance = testDistance;
return action;
/* NOP */;
}
}
class BTCondThreatLevelDifference extends IBehTreeTask{
public var operator : EOperator;
public var value : Int32;
public var useCombatTarget : Bool;
public var useNamedTarget : CName;
public var saveTargetOnGameplayEvent : CName;
private var m_Target : CNode;
public final function IsAvailable() : Bool{
var threatLevel : Int32;
var targetThreatLevel : Int32;
var oppNo : Int32;
var actionTarget : CNode;
var result : Bool;
var npc : CNewNPC;
npc = GetNPC();
threatLevel = npc.GetThreatLevel();
if (!IsNameValid(saveTargetOnGameplayEvent)){
SaveTarget();
}
if ((CNewNPC)m_Target){
targetThreatLevel = (CNewNPC)m_Target.GetThreatLevel();
}
if (m_Target == thePlayer){
targetThreatLevel = 5;
}
oppNo = targetThreatLevel - threatLevel;
switch(operator){
case 0:
result = oppNo == value;
break;
case 1:
result = oppNo != value;

break;
case 2:
result = oppNo < value;
break;
case 3:
result = oppNo <= value;
break;
case 4:
result = oppNo > value;
break;
case 5:
result = oppNo >= value;
break;
default:
result = false;
break;
}
if (result){
return true;
} else {
return false;
}
/* NOP */;
}
public final function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == saveTargetOnGameplayEvent){
SaveTarget();
}
return true;
/* NOP */;
}
private final function SaveTarget(){
if (IsNameValid(useNamedTarget)){
m_Target = GetNamedTarget(useNamedTarget);
} else if (useCombatTarget){
m_Target = GetCombatTarget();
} else {
m_Target = GetActionTarget();
}
/* NOP */;
}
}
class BTCondThreatLevelDifferenceDef extends IBehTreeConditionalTaskDefinition{
private editable var operator : EOperator;
private editable var value : Int32;
private editable var useCombatTarget : Bool;
private editable var useNamedTarget : CBehTreeValCName;
private editable var saveTargetOnGameplayEvent : CBehTreeValCName;
public function OnSpawn(taskGen : IBehTreeTask){
var eventName : CName;
eventName = GetValCName(saveTargetOnGameplayEvent);
if (IsNameValid(eventName)){
ListenToGameplayEvent(eventName);
}
/* NOP */;
}
}
class CBTTaskAttack extends CBTTaskPlayAnimationEventDecorator{

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

var attackType : EAttackType;


var stopTaskAfterDealingDmg : Bool;
var setAttackEndVarOnStopTask : Bool;
var useDirectionalAttacks : Bool;
var fxOnDamageInstigated : CName;
var fxOnDamageVictim : CName;
var applyFXCooldown : Float;
var behVarNameOnDeactivation : CName;
var behVarValueOnDeactivation : Float;
var stopAllEfectsOnDeactivation : Bool;
var slideToTargetOnAnimEvent : Bool;
var useCombatTarget : Bool;
var applyEffectType : EEffectType;
var customEffectDuration : Float;
var fxTimeCooldown : Float;
var useActionBlend : Bool;
var stopTask : Bool;
function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var targetToAttackerAngle : Float;
npc = GetNPC();
InitializeCombatDataStorage();
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = (CActor)GetActionTarget();
}
npc.SetBehaviorVariable('AttackType', attackType, true);
if (setAttackEndVarOnStopTask){
npc.SetBehaviorVariable('AttackEnd', 0, /* NOP */);
}
target.SetUnpushableTarget(npc);
npc.SetUnpushableTarget(target);
if (useDirectionalAttacks){
targetToAttackerAngle = NodeToNodeAngleDistance(target,

npc);
npc.SetBehaviorVariable('targetAngleDiff', targetToAttac
kerAngle / 180, true);
if (targetToAttackerAngle >= -180.000000 && targetToAtta
ckerAngle < -157.500000){
npc.SetBehaviorVariable('targetDirection', 5, tr
ue);
}
if (targetToAttackerAngle >= -157.500000 && targetToAtta
ckerAngle < -112.500000){
npc.SetBehaviorVariable('targetDirection', 6, tr
ue);
}
if (targetToAttackerAngle >= -112.500000 && targetToAtta
ckerAngle < -67.500000){
npc.SetBehaviorVariable('targetDirection', 7, tr
ue);
} else if (targetToAttackerAngle >= -67.500000 && target
ToAttackerAngle < -22.500000){
npc.SetBehaviorVariable('targetDirection', 8, tr
ue);
} else if (targetToAttackerAngle >= -22.500000 && target
ToAttackerAngle < 22.500000){
npc.SetBehaviorVariable('targetDirection', 0, tr

ue);
} else if (targetToAttackerAngle >= 22.500000 && targetT
oAttackerAngle < 67.500000){
npc.SetBehaviorVariable('targetDirection', 1, tr
ue);
} else if (targetToAttackerAngle >= 67.500000 && targetT
oAttackerAngle < 112.500000){
npc.SetBehaviorVariable('targetDirection', 2, tr
ue);
} else if (targetToAttackerAngle >= 112.500000 && target
ToAttackerAngle < 157.500000){
npc.SetBehaviorVariable('targetDirection', 3, tr
ue);
} else if (targetToAttackerAngle >= 157.500000 && target
ToAttackerAngle < 180.000000){
npc.SetBehaviorVariable('targetDirection', 4, tr
ue);
}
}
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var startTime : Float;
var npc : CNewNPC;
startTime = GetLocalTime();
npc = GetNPC();
while (startTime + 0.150000 > GetLocalTime()){
SleepOneFrame();
}
combatDataStorage.SetIsAttacking(true, GetLocalTime());
return 0;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
var target : CActor;
npc = GetNPC();
target = GetCombatTarget();
combatDataStorage.SetIsAttacking(false, /* NOP */);
target.SetUnpushableTarget(NULL);
npc.SetUnpushableTarget(NULL);
if (thePlayer.GetDodgeFeedbackTarget() == npc){
npc.SetDodgeFeedback(false);
}
if (behVarNameOnDeactivation){
npc.SetBehaviorVariable(behVarNameOnDeactivation, behVar
ValueOnDeactivation, true);
}
if (stopAllEfectsOnDeactivation){
npc.StopAllEffects();
}
stopTask = false;
super.OnDeactivate();
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var owner : CActor;
var target : CActor;

var ticket : SMovementAdjustmentRequestTicket;


var movementAdjustor : CMovementAdjustor;
var minDistance : Float;
owner = GetActor();
target = GetCombatTarget();
if (slideToTargetOnAnimEvent && animEventName == 'SlideToTarget'
&& animEventType == 1 || animEventType == 2){
movementAdjustor = owner.GetMovingAgentComponent().GetMo
vementAdjustor();
if (movementAdjustor){
movementAdjustor.CancelByName('SlideToTarget');
ticket = movementAdjustor.CreateNewRequest('Slid
eToTarget');
movementAdjustor.BindToEventAnimInfo(ticket, ani
mInfo, /* NOP */);
movementAdjustor.MaxLocationAdjustmentSpeed(tick
et, 1000000, /* NOP */);
movementAdjustor.ScaleAnimation(ticket, /* NOP *
/, /* NOP */, /* NOP */);
minDistance = (CMovingPhysicalAgentComponent)own
er.GetMovingAgentComponent().GetCapsuleRadius() + (CMovingPhysicalAgentComponent
)target.GetMovingAgentComponent().GetCapsuleRadius();
minDistance += 0.100000;
movementAdjustor.SlideTowards(ticket, target, mi
nDistance, 10000);
}
return true;
} else if (stopTask && animEventName == 'AllowBlend' || useActio
nBlend && animEventName == 'ActionBlend'){
GetNPC().RaiseEvent('AnimEndAUX');
Complete(true);
return true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var attributeValue : SAbilityAttributeValue;
npc = GetNPC();
if (eventName == 'DamageInstigated'){
ApplyCriticalEffectOnTarget();
if (IsNameValid(fxOnDamageInstigated)){
npc.PlayEffect(fxOnDamageInstigated, /* NOP */);
}
if (IsNameValid(fxOnDamageVictim) && GetLocalTime() > fx
TimeCooldown){
fxTimeCooldown = GetLocalTime() + applyFXCooldow
n;
GetCombatTarget().PlayEffect(fxOnDamageVictim, /
* NOP */);
}
if (stopTaskAfterDealingDmg){
if (setAttackEndVarOnStopTask){
npc.SetBehaviorVariable('AttackEnd', 1.0
00000, /* NOP */);
}
stopTask = true;
}

return true;
} else if (eventName == 'AxiiGuardMeAdded'){
GetNPC().RaiseEvent('AnimEndAUX');
Complete(true);
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
public function ApplyCriticalEffectOnTarget(){
var npc : CNewNPC;
var target : CActor;
var params : SCustomEffectParams;
npc = GetNPC();
target = GetCombatTarget();
if (applyEffectType != 0){
if (customEffectDuration > 0){
params.effectType = applyEffectType;
params.creator = npc;
params.sourceName = npc.GetName();
params.duration = customEffectDuration;
target.AddEffectCustom(params);
} else {
target.AddEffectDefault(applyEffectType, npc, np
c.GetName(), /* NOP */);
}
}
/* NOP */;
}
}
class CBTTaskDespawn extends IBehTreeTask{
public var callFromQuest : Bool;
public var destroyCooldown : Float;
public var despawn : Bool;
public var disappearfxName : CName;
public var emptyName : CName;
public var despawnEventName : CName;
public var raiseEventName : CName;
public function IsAvailable() : Bool{
if (callFromQuest){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
npc.DisableHitAnimFor(2.000000);
npc.RaiseForceEvent(raiseEventName);
if (disappearfxName != emptyName){
npc.PlayEffect(disappearfxName, /* NOP */);
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();

while (!despawn){
Sleep(0.010000);
}
npc.SetVisibility(false);
npc.EnablePhysicalMovement(false);
Sleep(destroyCooldown);
return 2;
/* NOP */;
}
public function OnDeactivate(){
GetActor().Destroy();
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == despawnEventName){
despawn = true;
return true;
}
return false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == 'Despawn'){
callFromQuest = true;
return true;
}
return false;
/* NOP */;
}
}
class CBTTaskDespawnDef extends IBehTreeTaskDefinition{
public var callFromQuest : Bool;
public editable var despawnEventName : CName;
public editable var disappearfxName : CName;
public editable var raiseEventName : CName;
public editable var destroyCooldown : Float;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('Despawn');
/* NOP */;
}
}
class BTTaskEmpty extends IBehTreeTask{
public function OnActivate() : EBTNodeStatus{
return 0;
/* NOP */;
}
}
class BTTaskEmptyDef extends IBehTreeTaskDefinition{
}
class CBTTaskRaiseAnimationEvent extends IBehTreeTask{
public var eventName : CName;
public var forceEvent : Bool;
public function OnActivate() : EBTNodeStatus{
var owner : CActor;

owner = GetActor();
if (forceEvent == false){
owner.RaiseEvent(eventName);
} else {
owner.RaiseForceEvent(eventName);
}
return 0;
/* NOP */;
}
}
class CBTTaskRaiseAnimationEventDef extends IBehTreeTaskDefinition{
public editable var eventName : CName;
public editable var forceEvent : Bool;
}
class BTSaveNamedTargetOnEvent extends IBehTreeTask{
public var namedTargetToSave : CName;
public var saveUnder : CName;
public var gameplayEventToSaveOn : CName;
public final function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == gameplayEventToSaveOn){
SaveTarget();
}
return true;
/* NOP */;
}
private final function SaveTarget(){
if (IsNameValid(saveUnder)){
SetNamedTarget(saveUnder, GetNamedTarget(namedTargetToSa
ve));
}
/* NOP */;
}
}
class BTSaveNamedTargetOnEventDef extends IBehTreeTaskDefinition{
private editable var namedTargetToSave : CName;
private editable var saveUnder : CBehTreeValCName;
private editable var gameplayEventToSaveOn : CBehTreeValCName;
public final function OnSpawn(taskGen : IBehTreeTask){
var task : BTSaveNamedTargetOnEvent;
task = (BTSaveNamedTargetOnEvent)taskGen;
if (IsNameValid(task.gameplayEventToSaveOn)){
ListenToGameplayEvent(task.gameplayEventToSaveOn);
}
/* NOP */;
}
}
class BTTaskSaveTargetPosAsCustomTarget extends IBehTreeTask{
public var useActionTarget : Bool;
public var onDeactivate : Bool;
public var snapToGround : Bool;
public final function OnActivate() : EBTNodeStatus{
if (onDeactivate){
return 0;
}
SaveTarget();
return 0;

/* NOP */;
}
public final function OnDeactivate(){
if (!onDeactivate){
return;
}
SaveTarget();
/* NOP */;
}
public final function SaveTarget(){
var l_pos : Vector;
var l_heading : Float;
var l_groundZ : Float;
if (useActionTarget){
l_pos = GetActionTarget().GetWorldPosition();
l_heading = GetActionTarget().GetHeading();
} else {
l_pos = GetCombatTarget().GetWorldPosition();
l_heading = GetCombatTarget().GetHeading();
}
if (snapToGround && theGame.GetWorld().NavigationComputeZ(l_pos,
l_pos.Z - 100, l_pos.Z + 100, l_groundZ)){
l_pos.Z = l_groundZ;
}
SetCustomTarget(l_pos, l_heading);
/* NOP */;
}
}
class BTTaskSaveTargetPosAsCustomTargetDef extends IBehTreeTaskDefinition{
private editable var useActionTarget : Bool;
private editable var onDeactivate : Bool;
private editable var snapToGround : Bool;
}
class CBTTaskSelectTargetFromListDef extends IBehTreeTaskDefinition{
public editable var targetList : array<CName>;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('CurrentTargetIndex');
/* NOP */;
}
}
class CBTTaskSendTutorialEvent extends IBehTreeTask{
public var onActivation : Bool;
public var onDeactivation : Bool;
public var guardSwordWarning : Bool;
public var guardGeneralWarning : Bool;
public var guardLootingWarning : Bool;
public function OnActivate() : EBTNodeStatus{
if (onActivation){
SendEvent();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (onDeactivation){
SendEvent();

}
/* NOP */;
}
public function SendEvent(){
if (GetActor().GetAttitude(thePlayer) == 0){
return;
}
if (guardSwordWarning){
theGame.GetTutorialSystem().OnGuardSwordWarning();
}
if (guardGeneralWarning){
theGame.GetTutorialSystem().OnGuardGeneralWarning();
}
if (guardLootingWarning){
theGame.GetTutorialSystem().OnGuardLootingWarning();
}
/* NOP */;
}
}
class CBTTaskSendTutorialEventDef extends IBehTreeTaskDefinition{
public editable var onActivation : Bool;
public editable var onDeactivation : Bool;
public editable var guardSwordWarning : Bool;
public editable var guardGeneralWarning : Bool;
public editable var guardLootingWarning : Bool;
}
class BTTaskSoundSwitch extends IBehTreeTask{
public var swichGroupName : CName;
public var stateName : String;
public var onActivate : Bool;
public var onDeactivate : Bool;
public function OnActivate() : EBTNodeStatus{
if (!onActivate){
return 0;
}
SwitchSound();
return 0;
/* NOP */;
}
private function OnDeactivate(){
if (!onDeactivate){
return;
}
SwitchSound();
/* NOP */;
}
private function SwitchSound(){
GetNPC().SoundSwitch(swichGroupName, stateName, /* NOP */, /* NO
P */);
/* NOP */;
}
}
class BTTaskSoundSwitchDef extends IBehTreeTaskDefinition{
private editable var swichGroupName : CName;
private editable var stateName : String;
private editable var onActivate : Bool;
private editable var onDeactivate : Bool;

}
class CBTTaskSwarmDef extends CBTTaskPlayAnimationEventDecoratorDef{
}
class CBTTaskPlaySyncedAnimationDef extends IBehTreeTaskDefinition{
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('PlaySyncedAnim');
listenToGameplayEvents.PushBack('PlayFinisherSyncedAnim');
listenToGameplayEvents.PushBack('SetupSyncInstance');
listenToGameplayEvents.PushBack('SetupSequenceIndex');
listenToGameplayEvents.PushBack('SetupEndEvent');
listenToGameplayEvents.PushBack('SetupEndGameplayEvent');
/* NOP */;
}
}
class CBTTaskWait extends IBehTreeTask{
public var Delay : Float;
public latent function Main() : EBTNodeStatus{
Sleep(Delay);
return 2;
/* NOP */;
}
}
class CBTTaskWaitDef extends IBehTreeTaskDefinition{
public editable var Delay : Float;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('OnStopHorse');
/* NOP */;
}
}
class CBTTaskForceWait extends IBehTreeTask{
public var available : Bool;
public var Delay : Float;
public var Event : CName;
public function IsAvailable() : Bool{
if (available){
return true;
}
return false;
/* NOP */;
}
public function OnActivate(){
GetActor().ActionCancelAll();
/* NOP */;
}
public function OnDeactivate(){
available = false;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var time : Float;
GetActor().WaitForBehaviorNodeDeactivation('OnAnimIdleActivated'
, 10.000000);
time = GetLocalTime();

while (time + Delay > GetLocalTime()){


Sleep(0.010000);
}
return 2;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == Event){
available = true;
return true;
}
if (eventName == 'CalmDown' || eventName == 'ForceIdle'){
GetActor().RaiseForceEvent('ForceIdle');
}
if (eventName == 'Stop'){
available = true;
}
return false;
/* NOP */;
}
}
class CBTTaskForceWaitDef extends IBehTreeTaskDefinition{
public editable var Delay : Float;
public editable var Event : CName;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('ForceIdle');
if (IsNameValid(Event)){
listenToGameplayEvents.PushBack(Event);
}
/* NOP */;
}
}
class BTTask_DebugLog extends IBehTreeTask{
public var taskName : String;
public function OnActivate() : EBTNodeStatus{
/* NOP */;
return 2;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
while (true){
/* NOP */;
Sleep(1.000000);
}
return 2;
/* NOP */;
}
public function OnDeactivate(){
/* NOP */;
/* NOP */;
}
}
class BTTask_DebugLogDef extends IBehTreeTaskDefinition{
public editable var taskName : String;
}

class CBTTaskAnimalSetIsScaredDef extends IBehTreeHorseTaskDefinition{


public editable var value : Bool;
public editable var setOnDeactivate : Bool;
}
class CBTCondAnimalIsScaredDef extends IBehTreeHorseConditionalTaskDefinition{
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('AardHitReceived');
listenToGameplayEvents.PushBack('BeingHit');
/* NOP */;
}
}
class CBTCondAnimalFlee extends IBehTreeTask{
public var chanceOfBeingScared : Float;
public var chanceOfBeingScaredRerollTime : Float;
public var scaredIfTargetRuns : Bool;
public var maxTolerableTargetDistance : Float;
public var rollSaysScared : Bool;
public var rerollChanceTime : Float;
public function IsAvailable() : Bool{
var target : CActor;
var owner : CActor;
var attitude : EAIAttitude;
var dice : Float;
var distanceToTargetSquared : Float;
var localTime : Float;
target = GetCombatTarget();
owner = GetActor();
dice = -1.000000;
localTime = GetLocalTime();
if (rerollChanceTime < localTime){
rerollChanceTime = localTime + chanceOfBeingScaredReroll
Time;
rollSaysScared = RandF() <= chanceOfBeingScared;
}
if (rollSaysScared){
return true;
}
if (!target){
return false;
}
attitude = GetAttitudeBetween(owner, target);
if (scaredIfTargetRuns && target.GetMovingAgentComponent().GetRe
lativeMoveSpeed() >= target.GetMovingAgentComponent().GetMoveTypeRelativeMoveSpe
ed(1)){
return true;
}
distanceToTargetSquared = VecDistanceSquared(target.GetWorldPosi
tion(), owner.GetWorldPosition());
if (distanceToTargetSquared < maxTolerableTargetDistance * maxTo
lerableTargetDistance){
return true;
}
if (attitude == 2){
return true;
}
return false;
/* NOP */;

}
}
class CBTCondAnimalFleeDef extends IBehTreeHorseConditionalTaskDefinition{
public editable var chanceOfBeingScared : CBehTreeValFloat;
public editable var chanceOfBeingScaredRerollTime : CBehTreeValFloat;
public editable var scaredIfTargetRuns : CBehTreeValBool;
public editable var maxTolerableTargetDistance : CBehTreeValFloat;
}
class CBTTaskReactToHostility extends IBehTreeTask{
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var l_npc : CNewNPC;
var horseComp : W3HorseComponent;
l_npc = GetNPC();
if (l_npc.IsHorse()){
horseComp = GetNPC().GetHorseComponent();
if (horseComp){
switch(horseComp.riderSharedParams.mountStatus){
case 0:
return false;
case 1:
return false;
case 2:
return false;
default:
break;
}
}
}
l_npc.SignalGameplayEventParamFloat('AI_NeutralIsDanger', 10);
return true;
/* NOP */;
}
}
class CBTTaskReactToHostilityDef extends IBehTreeTaskDefinition{
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('BeingHit');
/* NOP */;
}
}
class CBTTask3StageIdle extends IBehTreeTask{
public editable var minTime : Float;
public editable var maxTime : Float;
public var loopTime : Float;
public latent function Main() : EBTNodeStatus{
var owner : CActor;
var time : Float;
owner = GetActor();
time = RandRangeF(maxTime, minTime);
Sleep(time);
owner.SetBehaviorVariable('IdleLoopEnd', 1, /* NOP */);
owner.WaitForBehaviorNodeDeactivation('IdleEnd', 1.500000);
return 2;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{

var owner : CActor;


owner = GetActor();
owner.RaiseEvent('3StateIdle');
owner.SetBehaviorVariable('IdleLoopEnd', 0, /* NOP */);
owner.SetBehaviorVariable('IdleAnim', RandRange(2, /* NOP */), /
* NOP */);
return 0;
/* NOP */;
}
}
class CBTTask3StateIdleDef extends IBehTreeTaskDefinition{
public editable var minTime : Float;
public editable var maxTime : Float;
}
class CMoveTRGAnimalFlee extends CMoveTRGScript{
}
class CBTTaskAnimalFlee extends IBehTreeTask{
public var maxDistance : Float;
public var heading : Float;
public var initialPosCheck : Bool;
public var isMoving : Bool;
public var alertRadius : Float;
public var ignoreEntitiesWithTag : CName;
public var moveType : EMoveType;
public var initialPos : Vector;
public var checkPos : Vector;
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var actor : CActor;
var dangerActors : array<CActor>;
var dangerSource : CActor;
var res : Bool;
var whereFrom : Vector;
var whereTo : Vector;
var randVec : Vector;
var heading : Float;
var headingAngle : EulerAngles;
var actorToTargetAngle : Float;
var distToTarget : Float;
var safeSpots : array<CNode>;
var i : Int32;
actor = GetActor();
dangerActors = GetActorsInRange(actor, alertRadius, 10000, 'None
', true);
i = 0;
while (i < dangerActors.Size()){
if (!dangerActors[i].HasTag(ignoreEntitiesWithTag)){
dangerSource = dangerActors[i];
break;
}
i += 1;
}
isMoving = true;
if (initialPosCheck == false){

initialPosCheck = true;
initialPos = actor.GetWorldPosition();
}
whereFrom = dangerSource.GetWorldPosition();
whereTo = initialPos + VecNormalize(initialPos - whereFrom) * ma
xDistance * 4.000000;
heading = whereTo.Y;
distToTarget = VecDistance(actor.GetWorldPosition(), whereFrom);
res = actor.ActionMoveToWithHeading(whereTo, heading, moveType,
0.000000, 2.000000, /* NOP */);
Sleep(5.000000);
isMoving = false;
return 2;
/* NOP */;
}
public function OnDeactivate(){
if (isMoving){
GetActor().ActionCancelAll();
isMoving = false;
}
/* NOP */;
}
}
class CBTTaskAnimalFleeDef extends IBehTreeTaskDefinition{
public editable var maxDistance : Float;
public editable var alertRadius : Float;
public editable var ignoreEntitiesWithTag : CName;
public editable var moveType : EMoveType;
}
class CBTTaskAxiiCharmMonitor extends IBehTreeTask{
public var wasCharmed : Bool;
public var removeCharmCooldown : Float;
public latent function Main() : EBTNodeStatus{
var owner : CActor;
owner = GetActor();
while (true){
Sleep(1.000000);
CharmCheck();
if (wasCharmed == true && removeCharmCooldown > 0){
Sleep(removeCharmCooldown);
wasCharmed = false;
}
}
return 0;
/* NOP */;
}
public function CharmCheck() : Bool{
var owner : CActor;
owner = GetActor();
if (owner.HasBuff(5) || owner.HasBuff(36)){
return true;
}
return false;
/* NOP */;
}
}
class CBTTaskAxiiCharmMonitorDef extends IBehTreeTaskDefinition{

public editable var removeCharmCooldown : Float;


}
class CBTTaskNervousState extends IBehTreeTask{
public var dangerRadius : Float;
public var rearingChance : Float;
public var kickChance : Float;
public var callFromQuestOnly : Bool;
public var force : Bool;
public var called : Bool;
private var dangerNode : CNode;
public function IsAvailable() : Bool{
var owner : CActor;
owner = GetActor();
if (callFromQuestOnly){
if (called){
return true;
}
} else if (!force){
return true;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var owner : CActor;
owner = GetActor();
if (callFromQuestOnly || force){
owner.ActionCancelAll();
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var owner : CActor;
owner = GetActor();
if (true){
Complete(false);
return 1;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var owner : CActor;
owner = GetActor();
owner.ActionCancelAll();
callFromQuestOnly = false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == 'AnimalNervous'){
called = true;
return true;
}
if (eventName == 'CalmDown'){
GetActor().RaiseForceEvent('ForceIdle');
Complete(true);
}
return false;

/* NOP */;
}
}
class W3PlayerModeTrigger extends CGameplayEntity{
public editable saved var isEnabled : Bool;
public var isActive : Bool;
public var isPlayerInside : Bool;
public editable var playerMode : EPlayerMode;
private function Activate(){
if (isActive){
return;
}
isActive = true;
if (playerMode == 1){
thePlayer.EnableMode(1, true);
} else if (playerMode == 2){
thePlayer.GetPlayerMode().ForceCombatMode(2);
}
/* NOP */;
}
private function Deactivate(){
if (!isActive){
return;
}
isActive = false;
if (playerMode == 1){
thePlayer.EnableMode(1, false);
} else if (playerMode == 2){
thePlayer.GetPlayerMode().ReleaseForceCombatMode(2);
}
/* NOP */;
}
public function OnAreaEnter(area : CTriggerAreaComponent, activator : CC
omponent) : Bool{
isPlayerInside = true;
if (isEnabled){
Activate();
}
/* NOP */;
}
public function OnAreaExit(area : CTriggerAreaComponent, activator : CCo
mponent) : Bool{
isPlayerInside = false;
Deactivate();
/* NOP */;
}
public function Enable(e : Bool){
if (e != isEnabled){
isEnabled = e;
if (e){
if (isPlayerInside){
Activate();
}
} else {
Deactivate();
}
}
/* NOP */;
}

}
class CBTTaskNervousStateDef extends IBehTreeTaskDefinition{
public editable var callFromQuestOnly : Bool;
public editable var dangerRadius : Float;
public editable var rearingChance : Float;
public editable var kickChance : Float;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('AnimalNervous');
listenToGameplayEvents.PushBack('CalmDown');
/* NOP */;
}
}
class CBTTask3StateWithRot extends CBTTask3StateAttack{
public var endLeft : EAttackType;
public var endRight : EAttackType;
public function ChooseAnim(){
var npc : CNewNPC;
var target : CActor;
var angleDist : Float;
npc = GetNPC();
target = GetCombatTarget();
angleDist = NodeToNodeAngleDistance(target, npc);
if (angleDist > 90){
npc.SetBehaviorVariable('AttackType', endRight, true);
} else if (angleDist < -90){
npc.SetBehaviorVariable('AttackType', endLeft, true);
}
/* NOP */;
}
}
class CBTTask3StateWithRotDef extends CBTTask3StateAttackDef{
public editable var endLeft : EAttackType;
public editable var endRight : EAttackType;
}
class CBTTask3StateWithDist extends CBTTask3StateAttack{
public var distance : Float;
public var endLess : EAttackType;
public var endMore : EAttackType;
public function ChooseAnim(){
var npc : CNewNPC;
var target : CActor;
var dist : Float;
npc = GetNPC();
target = GetCombatTarget();
dist = VecDistance2D(npc.GetWorldPosition(), target.GetWorldPosi
tion());
if (dist <= distance){
npc.SetBehaviorVariable('AttackType', endLess, true);
} else {
npc.SetBehaviorVariable('AttackType', endMore, true);
}
/* NOP */;
}
}

class CBTTask3StateWithDistDef extends CBTTask3StateAttackDef{


public editable var distance : Float;
public editable var endLess : EAttackType;
public editable var endMore : EAttackType;
}
class CBTTask3StateWithDistAndRot extends CBTTask3StateAttack{
public var distance : Float;
public var endLeft : EAttackType;
public var endRight : EAttackType;
public function ChooseAnim(){
var npc : CNewNPC;
var target : CActor;
var dist : Float;
var angleDist : Float;
npc = GetNPC();
target = GetCombatTarget();
dist = VecDistance2D(npc.GetWorldPosition(), target.GetWorldPosi
tion());
angleDist = NodeToNodeAngleDistance(target, npc);
if (dist >= distance){
if (angleDist > 90){
npc.SetBehaviorVariable('AttackType', endRight,
true);
} else if (angleDist < -90){
npc.SetBehaviorVariable('AttackType', endLeft, t
rue);
}
}
/* NOP */;
}
}
class CBTTask3StateWithDistAndRotDef extends CBTTask3StateAttackDef{
public editable var distance : Float;
public editable var endLeft : EAttackType;
public editable var endRight : EAttackType;
}
class CBTTask3StateAddEffectAttack extends CBTTask3StateAttack{
public var applyEffectInRange : Float;
public var applyEffectInCone : Float;
public var applyEffectInterval : Float;
public var effectType : EEffectType;
public var effectDuration : Float;
public var effectValue : Float;
public var effectPercentValue : Float;
public var activated : Bool;
public latent function Loop() : Int32{
var timeStamp : Float;
var endTime : Float;
var npc : CNewNPC;
var npcPos : Vector;
var targetPos : Vector;
var lookAtPos : Vector;
var playFX : Bool;
npc = GetNPC();
endTime = GetLocalTime() + loopTime;
playFX = IsNameValid(playFXOnLoopStart) && playLoopFXInterval >
0;

if (playFX){
lastFXTime = GetLocalTime();
}
while (GetLocalTime() <= endTime){
if (playFX && lastFXTime + playLoopFXInterval < GetLocal
Time()){
npc.PlayEffect(playFXOnLoopStart, /* NOP */);
lastFXTime = GetLocalTime();
}
if (timeStamp + applyEffectInterval < GetLocalTime() ||
timeStamp == 0){
timeStamp = GetLocalTime();
npcPos = npc.GetWorldPosition();
targetPos = GetCombatTarget().GetWorldPosition()
;
lookAtPos = npc.GetBehaviorVectorVariable('lookA
tTarget');
if (VecDistance(npcPos, targetPos) <= applyEffec
tInRange && AbsF(AngleDistance(VecHeading(lookAtPos - npcPos), VecHeading(target
Pos - npcPos))) <= applyEffectInCone){
ApplyEffect(true);
}
}
SleepOneFrame();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
activated = false;
super.OnDeactivate();
/* NOP */;
}
public function ApplyEffect(b : Bool){
var actor : CActor;
var target : CActor;
var params : SCustomEffectParams;
var effectName : CName;
actor = GetActor();
target = GetCombatTarget();
if (!b){
target.RemoveBuff(effectType, false, actor.GetName());
return;
}
params.effectType = effectType;
params.creator = actor;
params.sourceName = actor.GetName();
params.duration = effectDuration;
effectName = EffectTypeToName(effectType);
if (effectValue > 0){
params.effectValue.valueAdditive = effectValue;
}
if (effectPercentValue > 0){
params.effectValue.valueMultiplicative = effectPercentVa
lue;
}
if (target && !target.HasEffect(effectName)){
target.AddEffectCustom(params);
}
/* NOP */;

}
}
class CBTTask3StateAddEffectAttackDef extends CBTTask3StateAttackDef{
public editable var applyEffectInRange : Float;
public editable var applyEffectInCone : Float;
public editable var applyEffectInterval : Float;
public editable var effectType : EEffectType;
public editable var effectDuration : Float;
public editable var effectValue : Float;
public editable var effectPercentValue : Float;
}
class CBTTask3StateChargeDef extends CBTTask3StateAttackDef{
public editable var differentChargeEndings : Bool;
}
class CBTTask3StateProjectileAttackDef extends CBTTask3StateAttackDef{
public editable var attackRange : Float;
public editable var projectileName : CName;
public editable var dodgeable : Bool;
public editable var useLookatTarget : Bool;
}
class CBTTask3StateTaunt extends CBTTaskPlayAnimationEventDecorator{
public var tauntType : ETauntType;
public var raiseEventName : CName;
public var minDuration : Float;
public var maxDuration : Float;
public var res : Bool;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
res = false;
npc.SetBehaviorVariable('TauntEnd', 0.000000, true);
npc.SetBehaviorVariable('TauntType', tauntType, true);
if (IsNameValid(raiseEventName)){
npc.RaiseEvent(raiseEventName);
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var duration : Float;
npc = GetNPC();
target = npc.GetTarget();
duration = RandRangeF(maxDuration, minDuration);
Sleep(duration);
npc.SetBehaviorVariable('TauntEnd', 1.000000, true);
npc.WaitForBehaviorNodeDeactivation('TauntEnd', 1.000000);
res = true;
return 2;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
if (!res){

npc.SetBehaviorVariable('TauntEnd', 1, true);
}
/* NOP */;
}
}
class CBTTask3StateTauntDef
public editable var
public editable var
public editable var
public editable var
}

extends CBTTaskPlayAnimationEventDecoratorDef{
tauntType : ETauntType;
raiseEventName : CName;
minDuration : Float;
maxDuration : Float;

class CBTTaskAddEffectToTarget extends IBehTreeTask{


public var onActivate : Bool;
public var onEvent : Bool;
public var onDeactivate : Bool;
public var eventName : CName;
public var effectType : EEffectType;
public var effectDuration : Float;
public var effectValue : Float;
public var effectValuePerc : Float;
public var applyOnOwner : Bool;
public function OnActivate() : EBTNodeStatus{
if (onActivate){
ApplyEffect();
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (onDeactivate){
ApplyEffect();
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'eventName'){
ApplyEffect();
return true;
}
return false;
/* NOP */;
}
public function ApplyEffect(){
var npc : CNewNPC;
var target : CActor;
var params : SCustomEffectParams;
npc = GetNPC();
target = GetCombatTarget();
params.effectType = effectType;
params.creator = npc;
params.sourceName = npc.GetName();
params.duration = effectDuration;
if (effectValue > 0){
params.effectValue.valueAdditive = effectValue;
}
if (effectValuePerc > 0){
params.effectValue.valueMultiplicative = effectValuePerc

;
}
if (target && !applyOnOwner){
target.AddEffectCustom(params);
} else if (applyOnOwner){
GetNPC().AddEffectCustom(params);
}
/* NOP */;
}
}
class CBTTaskAddEffectToTargetDef extends IBehTreeTaskDefinition{
public editable var onActivate : Bool;
public editable var onEvent : Bool;
public editable var onDeactivate : Bool;
public editable var eventName : CName;
public editable var effectType : EEffectType;
public editable var effectDuration : Float;
public editable var effectValue : Float;
public editable var effectValuePerc : Float;
public editable var applyOnOwner : Bool;
}
class BTTaskAdditiveHitListener extends IBehTreeTask{
public var currentFightStageIs : ENPCFightStage;
public var playHitSound : Bool;
public var sounEventName : String;
public var boneName : CName;
public var timeStamp : Float;
public var manageIgnoreSignsEvents : Bool;
public var angleToIgnoreSigns : Float;
public var chanceToUseAdditive : Float;
public function OnActivate() : EBTNodeStatus{
GetActor().AddAbility('AdditiveHits', /* NOP */);
return 0;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var owner : CNewNPC;
var data : CDamageData;
owner = GetNPC();
if (eventName == 'BeingHit' && timeStamp + 0.400000 <= GetLocalT
ime()){
data = (CDamageData)GetEventParamBaseDamage();
if (data.additiveHitReactionAnimRequested){
if (playHitSound && sounEventName != "None" && s
ounEventName != ""){
if (owner.GetBoneIndex(boneName) != -1){
owner.SoundEvent(sounEventName,
boneName, /* NOP */);
} else {
owner.SoundEvent(sounEventName,
/* NOP */, /* NOP */);
}
}
owner.RaiseEvent('AdditiveHit');
timeStamp = GetLocalTime();
}
}
return false;

/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var playerToOwnerAngle : Float;
npc = GetNPC();
if (manageIgnoreSignsEvents){
if (eventName == 'IgnoreSigns'){
playerToOwnerAngle = AbsF(NodeToNodeAngleDistanc
e(thePlayer, npc));
if (npc.UseAdditiveCriticalState() && !npc.IsUns
toppable() && playerToOwnerAngle <= angleToIgnoreSigns){
npc.RaiseEvent('IgnoreSigns');
}
return true;
}
if (eventName == 'IgnoreSignsEnd'){
npc.RaiseEvent('IgnoreSignsEnd');
return true;
}
}
return false;
/* NOP */;
}
}
class BTTaskAdditiveHitListenerDef extends IBehTreeTaskDefinition{
public editable var playHitSound : Bool;
public editable var sounEventName : String;
public editable var boneName : CName;
public editable var manageIgnoreSignsEvents : Bool;
public editable var angleToIgnoreSigns : Float;
public editable var chanceToUseAdditive : Float;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('IgnoreSigns');
listenToGameplayEvents.PushBack('IgnoreSignsEnd');
/* NOP */;
}
}
class BTTaskAdditiveTaunt extends IBehTreeTask{
public var distMin : Float;
public var distMax : Float;
public function OnActivate() : EBTNodeStatus{
GetNPC().SetBehaviorVariable('additiveTauntOn', 1, /* NOP */);
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var l_npc : CNewNPC;
var target : CActor;
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_dist : Float;
var l_additivePercentage : Float;
l_npc = GetNPC();
target = l_npc.GetTarget();
while (true){
Sleep(0.100000);

l_npcPos = l_npc.GetWorldPosition();
l_targetPos = target.GetWorldPosition();
if (AbsF(AngleDistance(l_npc.GetHeading(), VecHeading(l_
targetPos - l_npcPos))) > 120){
l_npc.SetBehaviorVariable('additiveTauntOn', 0.0
00000, /* NOP */);
} else {
l_dist = VecDistance(l_npcPos, l_targetPos);
if (l_dist > distMax){
l_npc.SetBehaviorVariable('additiveTaunt
On', 0.000000, /* NOP */);
} else if (l_dist < distMin){
l_npc.SetBehaviorVariable('additiveTaunt
On', 1.000000, /* NOP */);
l_npc.SetBehaviorVariable('additiveTaunt
Per', 1, /* NOP */);
} else {
l_additivePercentage = 1.000000 - ClampF
(l_dist - distMin / distMax - distMin, 0.000000, 1.000000);
l_npc.SetBehaviorVariable('additiveTaunt
On', 1.000000, /* NOP */);
l_npc.SetBehaviorVariable('additiveTaunt
Per', l_additivePercentage, /* NOP */);
}
}
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetBehaviorVariable('additiveTauntOn', 0.000000, /* NOP
*/);
/* NOP */;
}
}
class BTTaskAdditiveTauntDef extends IBehTreeTaskDefinition{
private editable var distMin : Float;
private editable var distMax : Float;
}
class CBTTaskBoatAttack extends IBehTreeTask{
private var m_TargetBoat : CEntity;
private var m_LockedSlot : CName;
public function OnDeactivate(){
FreeGrabSlot();
/* NOP */;
}
public function OnGameplayEvent(_EventName : CName) : Bool{
if (_EventName == 'BeingHit'){
GetNPC().Kill(/* NOP */, /* NOP */, /* NOP */);
}
return true;
/* NOP */;
}
public function OnListenedGameplayEvent(_EventName : CName) : Bool{
var l_slotFound : Bool;
var l_destructionComp : CBoatDestructionComponent;
var l_targetLocation : Vector;
var l_targetHeading : Float;

if (_EventName == 'LockSlot'){
m_LockedSlot = GetEventParamCName('None');
}
return true;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'Detach'){
GetNPC().BreakAttachment();
return true;
} else if (animEventName == 'BreakBoat'){
DamageBoat(35);
return true;
}
return true;
/* NOP */;
}
private final function GetBoat() : CEntity{
if (!m_TargetBoat){
m_TargetBoat = thePlayer.GetUsedVehicle();
}
return m_TargetBoat;
/* NOP */;
}
private function FreeGrabSlot(){
var l_destructionComp : CBoatDestructionComponent;
l_destructionComp = (CBoatDestructionComponent)GetBoat().GetComp
onentByClassName('CBoatDestructionComponent');
l_destructionComp.FreeGrabSlot(m_LockedSlot);
l_destructionComp.DetachSiren(GetNPC());
/* NOP */;
}
private function DamageBoat(_Amount : Float){
var l_npc : CNewNPC;
var l_destructionComp : CBoatDestructionComponent;
l_npc = GetNPC();
l_destructionComp = (CBoatDestructionComponent)GetBoat().GetComp
onentByClassName('CBoatDestructionComponent');
if (l_destructionComp){
l_destructionComp.DealDmgToNearestVolume(_Amount, l_npc.
GetWorldPosition());
GCameraShake(1.500000, true, thePlayer.GetWorldPosition(
), 30.000000, /* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
}
class CBTTaskBoatAttackDef extends IBehTreeTaskDefinition{
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('LockSlot');
listenToGameplayEvents.PushBack('BoatDestroyed');
/* NOP */;
}
}
class CBTTaskBoatGrab extends IBehTreeTask{
private var m_Collided : Bool;

private var m_TargetBoat : CEntity;


private var m_ClosestSlot : CName;
public function OnActivate() : EBTNodeStatus{
m_TargetBoat = NULL;
return 0;
/* NOP */;
}
public function OnGameplayEvent(_EventName : CName) : Bool{
var l_slotFound : Bool;
var l_destructionComp : CBoatDestructionComponent;
var l_boatComponent : CBoatComponent;
var l_targetLocation : Vector;
var l_targetHeading : Float;
var l_boatHasDrowned : Bool;
if (!m_Collided && _EventName == 'CollisionWithBoat'){
m_Collided = true;
l_destructionComp = (CBoatDestructionComponent)GetBoat()
.GetComponentByClassName('CBoatDestructionComponent');
l_slotFound = l_destructionComp.GetClosestFreeGrabSlotIn
fo(GetNPC().GetWorldPosition(), GetNPC().GetHeading(), m_ClosestSlot, l_targetLo
cation, l_targetHeading);
l_boatComponent = (CBoatComponent)GetBoat().GetComponent
ByClassName('CBoatComponent');
l_boatHasDrowned = l_boatComponent.GetBoatEntity().HasDr
owned();
if (!l_slotFound || l_boatHasDrowned){
m_Collided = false;
m_ClosestSlot = 'None';
Complete(false);
return false;
}
GetNPC().SignalGameplayEventParamCName('LockSlot', m_Clo
sestSlot);
GetNPC().SignalGameplayEvent('StartGrab');
l_destructionComp.LockGrabSlot(m_ClosestSlot);
l_destructionComp.AttachSiren(GetNPC());
}
return false;
/* NOP */;
}
public function OnDeactivate(){
var l_destructionComp : CBoatDestructionComponent;
m_Collided = false;
if (GetNPC().GetBehaviorVariable('IsOnBoat', /* NOP */) == 0 &&
IsNameValid(m_ClosestSlot)){
l_destructionComp = (CBoatDestructionComponent)GetBoat()
.GetComponentByClassName('CBoatDestructionComponent');
l_destructionComp.FreeGrabSlot(m_ClosestSlot);
l_destructionComp.DetachSiren(GetNPC());
}
m_ClosestSlot = 'None';
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var l_npc : CNewNPC;
var l_res : Bool;
var l_movementAdjustor : CMovementAdjustor;
var l_ticket : SMovementAdjustmentRequestTicket;
var l_targetLocation : Vector;

var l_targetHeading : Float;


var l_slotMatrix : Matrix;
if (animEventName == 'GrabBoat' && animEventType == 1){
l_npc = GetNPC();
(CMovingPhysicalAgentComponent)l_npc.GetMovingAgentCompo
nent().SetDiving(false);
(CMovingPhysicalAgentComponent)l_npc.GetMovingAgentCompo
nent().SetSwimming(false);
l_npc.SetIsSwimming(false);
GetBoat().CalcEntitySlotMatrix(m_ClosestSlot, l_slotMatr
ix);
l_npc.GetMovingAgentComponent().SetAdditionalOffsetToCon
sumePointWS(l_slotMatrix, 0.500000);
l_npc.CreateAttachment(super.GetBoat(), m_ClosestSlot, /
* NOP */, /* NOP */);
}
return l_res;
/* NOP */;
}
private final function GetBoat() : CEntity{
if (!m_TargetBoat){
m_TargetBoat = thePlayer.GetUsedVehicle();
}
return m_TargetBoat;
/* NOP */;
}
}
class CBTTaskBoatGrabDef extends IBehTreeTaskDefinition{
}
class W3SignOwnerBTTaskCastSign extends W3SignOwner{
public var btTask : CBTTaskCastSign;
public function Init(parentActor : CActor, task : CBTTaskCastSign){
BaseInit(parentActor);
btTask = task;
/* NOP */;
}
public function HasStaminaToUseSkill(skill : ESkill, perSec : Bool, sign
Hack : Bool) : Bool{
return true;
/* NOP */;
}
public function HasCustomAttackRange() : Bool{
return IsNameValid(btTask.GetAttackRangeType());
/* NOP */;
}
public function GetCustomAttackRange() : CName{
return btTask.GetAttackRangeType();
/* NOP */;
}
}
class CBTTaskCastAard extends CBTTaskCastSign{
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (!IsNameValid(attackRangeName)){

attackRangeName = 'cone';
}
if (!IsNameValid(resourceName)){
resourceName = 'aard';
}
return super.OnActivate();
/* NOP */;
}
}
class CBTTaskCastAardDef extends CBTTaskCastSignDef{
}
class CBTTaskCastIgni extends CBTTaskCastSign{
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (!IsNameValid(attackRangeName)){
attackRangeName = 'cone';
}
if (!IsNameValid(resourceName)){
resourceName = 'igni';
}
return super.OnActivate();
/* NOP */;
}
}
class CR4HudModuleAreaInfo extends CR4HudModuleBase{
private var m_fxSetTextSFF : CScriptedFlashFunction;
private var dt : Float;
private var showTime : Float;
private var bShow : Bool;
public function OnConfigUI() : Bool{
var flashModule : CScriptedFlashSprite;
m_anchorName = "mcAnchorAreaInfo";
super.OnConfigUI();
flashModule = GetModuleFlash();
m_fxSetTextSFF = flashModule.GetMemberFlashFunction("SetText");
/* NOP */;
}
public function ShowAreaInfo(localisationKey : String){
var text : String;
text = GetLocStringByKeyExt(localisationKey);
m_fxSetTextSFF.InvokeSelfOneArg(FlashArgString(text));
ShowElement(true, /* NOP */);
showTime = 3;
dt = 0;
bShow = true;
/* NOP */;
}
public function OnTick(timeDelta : Float) : Bool{
if (bShow){
dt += timeDelta;
if (dt > showTime){
ShowElement(false, /* NOP */);
bShow = false;
}

}
/* NOP */;
}
}
class CBTTaskCastIgniDef extends CBTTaskCastSignDef{
}
class CBTTaskCastQuen extends CBTTaskCastSign{
public var completeAfterHit : Bool;
public var alternateFireMode : Bool;
public var processQuenOnCounterActivation : Bool;
public var hitEventReceived : Bool;
private var hitEntity : CEntity;
private var hitEntityTemplate : CEntityTemplate;
private var ownerBoneIndex : Int32;
private var shieldActive : Bool;
protected var humanCombatDataStorage : CHumanAICombatStorage;
private var playEffectTimeStamp : Float;
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
if (!IsNameValid(attackRangeName)){
attackRangeName = 'quen';
}
if (!IsNameValid(resourceName)){
resourceName = 'quen';
}
npc.SetGuarded(true);
npc.SetParryEnabled(true);
npc.customHits = true;
npc.SetCanPlayHitAnim(true);
npc.AddBuffImmunity(52, 'TaskCastQuen', false);
npc.AddBuffImmunity(18, 'TaskCastQuen', false);
if (ownerBoneIndex == -1){
ownerBoneIndex = npc.GetBoneIndex('pelvis');
}
npc.SetBehaviorVariable('CastSignEnd', 0.000000, /* NOP */);
InitializeCombatDataStorage();
humanCombatDataStorage.SetProtectedByQuen(true);
shieldActive = true;
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
hitEntityTemplate = (CEntityTemplate)LoadResourceAsync("gameplay
\sign\quen_hit_new", /* NOP */);
super.Main();
Started();
Throw();
return 0;
/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();

super.OnDeactivate();
if (hitEntity){
hitEntity.DestroyAfter(3.000000);
hitEntity = NULL;
}
npc.SetGuarded(false);
npc.SetParryEnabled(false);
npc.customHits = false;
npc.RemoveBuffImmunity(52, 'TaskCastQuen');
npc.RemoveBuffImmunity(18, 'TaskCastQuen');
npc.SetBehaviorVariable('CastSignEnd', 1.000000, /* NOP */);
if (signEntity){
signEntity.BreakAttachment();
}
humanCombatDataStorage.SetProtectedByQuen(false);
shieldActive = false;
/* NOP */;
}
public function Started(){
if (signEntity){
if (alternateFireMode){
signEntity.SetAlternateCast(40);
}
signEntity.OnStarted();
}
super.Started();
/* NOP */;
}
public function Throw(){
if (signEntity){
signEntity.OnThrowing();
}
/* NOP */;
}
public function ProcessAction(data : CDamageData){
var npc : CNewNPC;
var params : SCustomEffectParams;
npc = GetNPC();
if (data.isActionMelee){
params.effectType = 13;
params.creator = GetActor();
params.sourceName = "quen";
params.duration = 0.100000;
(CActor)data.attacker.AddEffectCustom(params);
}
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var data : CDamageData;
npc = GetNPC();
if (eventName == 'BeingHit' && shieldActive){
data = (CDamageData)GetEventParamBaseDamage();
PlayHitEffect(data);
ProcessAction(data);
super.Throw();
if (completeAfterHit){
npc.SetBehaviorVariable('CastSignEnd', 1.000000,
/* NOP */);
}

return true;
} else if (eventName == 'FinishQuen'){
Complete(true);
}
return false;
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
PlayHitEffect(/* NOP */);
super.Throw();
return true;
/* NOP */;
}
public function PlayHitEffect(data : CDamageData){
var rot : EulerAngles;
var localTime : Float;
localTime = GetLocalTime();
if (playEffectTimeStamp + 0.400000 >= localTime){
return;
}
if (data){
rot = VecToRotation(data.attacker.GetWorldPosition() - d
ata.victim.GetWorldPosition());
rot.Yaw -= 90;
} else {
rot.Pitch += 90;
}
hitEntity = theGame.CreateEntity(hitEntityTemplate, signEntity.G
etWorldPosition(), rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (hitEntity){
hitEntity.CreateAttachment(GetActor(), 'quen_sphere', /*
NOP */, /* NOP */);
hitEntity.PlayEffect('quen_rebound_sphere', /* NOP */);
}
playEffectTimeStamp = localTime;
/* NOP */;
}
public function SetupSignType(){
signType = 3;
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!humanCombatDataStorage){
super.InitializeCombatDataStorage();
humanCombatDataStorage = (CHumanAICombatStorage)combatDa
taStorage;
}
/* NOP */;
}
}
class CR4HudModuleDebugText extends CR4HudModuleBase{
public var bCurrentShowState : Bool;
public var bShouldShowElement : Bool;
public var bOpenDebugText : Bool;
public function OnConfigUI() : Bool{
super.OnConfigUI();
ShowElement(false, /* NOP */);
/* NOP */;
}

public function OnTick(timeDelta : Float) : Bool{


}
public function ShowElement(bShow : Bool, bImmediately : Bool){
bShouldShowElement = bShow;
if (bShow){
super.ShowElement(bCurrentShowState, bImmediately);
return;
} else {
bCurrentShowState = false;
}
super.ShowElement(bShow, bImmediately);
/* NOP */;
}
public function ShowDebugText(text : String){
var flashValueStorage : CScriptedFlashValueStorage;
flashValueStorage = GetModuleFlashValueStorage();
flashValueStorage.SetFlashString('debugtext.text', text, -1);
bCurrentShowState = true;
ShowElement(true, /* NOP */);
/* NOP */;
}
public function HideDebugText(){
ShowElement(false, /* NOP */);
/* NOP */;
}
}
class CBTTaskCastQuenDef extends CBTTaskCastSignDef{
public editable var completeAfterHit : Bool;
public editable var alternateFireMode : Bool;
public editable var processQuenOnCounterActivation : Bool;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('CustomHit');
/* NOP */;
}
}
class CBTTaskCharge extends CBTTaskAttack{
public var checkLineOfSight : Bool;
public var dealDamage : Bool;
public var bCollisionWithActor : Bool;
public var activated : Bool;
public var endTaskWhenOwnerGoesPastTarget : Bool;
public var xmlDamageName : CName;
public var collidedActor : CActor;
public var chargeType : EChargeAttackType;
public function IsAvailable() : Bool{
if (!checkLineOfSight){
return super.IsAvailable();
}
if (theGame.GetWorld().NavigationLineTest(GetActor().GetWorldPos
ition(), GetCombatTarget().GetWorldPosition(), GetActor().GetRadius(), /* NOP */
, /* NOP */)){
return super.IsAvailable();
}
return false;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{

var dotProduct : Float;


var npc : CNewNPC;
var target : CActor;
var targetPos : Vector;
var npcPos : Vector;
var startPos : Vector;
npc.SetBehaviorVariable('AttackEnd', 0, /* NOP */);
if (endTaskWhenOwnerGoesPastTarget){
npc = GetNPC();
target = GetCombatTarget();
startPos = npc.GetWorldPosition();
dotProduct = 0;
while (dotProduct >= 0.000000){
Sleep(0.250000);
npcPos = npc.GetWorldPosition();
targetPos = target.GetWorldPosition();
dotProduct = VecDot(targetPos - startPos, target
Pos - npcPos);
}
npc.SetBehaviorVariable('AttackEnd', 1.000000, /* NOP */
);
return 2;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
bCollisionWithActor = false;
collidedActor = NULL;
activated = false;
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var damageAction : W3DamageAction;
var action : W3Action_Attack;
var damage : Float;
var attackName : CName;
var skillName : CName;
var params : SCustomEffectParams;
npc = GetNPC();
if (activated && !bCollisionWithActor && eventName == 'Collision
WithActor'){
collidedActor = (CActor)GetEventParamObject();
if (IsRequiredAttitudeBetween(npc, collidedActor, true,
/* NOP */, /* NOP */)){
bCollisionWithActor = true;
if (!dealDamage){
if (chargeType == 0){
params.effectType = 10;
} else if (chargeType == 1){
params.effectType = 13;
}
if (params.effectType != 0){
params.creator = npc;
params.duration = 0.500000;
collidedActor.AddEffectCustom(pa
rams);
}

} else {
action = new W3Action_Attack in theGame.
damageMgr;
switch(chargeType){
case 0:
skillName = 'attack_super_heavy'
;
attackName = 'attack_super_heavy
';
break;
case 1:
skillName = 'attack_stagger';
attackName = 'attack_stagger';
break;
}
action.Init(npc, collidedActor, NULL, np
c.GetInventory().GetItemFromSlot('r_weapon'), attackName, npc.GetName(), 0, fals
e, true, skillName, 4, 0, true, false, false, false, /* NOP */, /* NOP */, /* NO
P */, /* NOP */, /* NOP */);
theGame.damageMgr.ProcessAction(action);
delete action;
}
}
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'attackStart'){
activated = true;
return true;
} else if (animEventName == 'Knockdown' && animEventType == 1){
activated = true;
return true;
} else if (animEventName == 'Knockdown' && animEventType == 3){
activated = false;
return true;
} else if (animEventName == 'Stagger' && animEventType == 1){
activated = true;
return true;
} else if (animEventName == 'Stagger' && animEventType == 3){
activated = false;
return true;
}
return res;
/* NOP */;
}
}
class CBTTaskChargeDef extends CBTTaskAttackDef{
public editable var checkLineOfSight : Bool;
public editable var dealDamage : Bool;
public editable var endTaskWhenOwnerGoesPastTarget : Bool;
public editable var chargeType : EChargeAttackType;
}

class CR4HudModuleWatermark extends CR4HudModuleBase{


public function OnConfigUI() : Bool{
m_anchorName = "mcAnchorWatermark";
super.OnConfigUI();
/* NOP */;
}
}
class CBTTaskCombatStorage extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CBaseAICombatStorage;
public var setIsShooting : Bool;
public var setIsAiming : Bool;
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
InitializeCombatDataStorage();
if (setIsShooting){
combatDataStorage.SetIsShooting(true);
}
if (setIsAiming){
combatDataStorage.SetIsAiming(true);
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (setIsShooting){
combatDataStorage.SetIsShooting(false);
}
if (setIsAiming){
combatDataStorage.SetIsAiming(false);
}
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBTTaskCombatStorageDef extends IBehTreeTaskDefinition{
public editable var setIsShooting : Bool;
public editable var setIsAiming : Bool;
}
class CBehTreeTaskCombatStorageCleanup extends IBehTreeTask{
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
public function OnActivate() : EBTNodeStatus{
GetNPC().DisableLookAt();
return 0;
/* NOP */;
}

public function OnDeactivate(){


var npc : CNewNPC;
npc = GetNPC();
InitializeCombatDataStorage();
combatDataStorage.SetActiveCombatStyle(1);
combatDataStorage.SetPreCombatWarning(true);
npc.SetBehaviorMimicVariable('gameplayMimicsMode', 0);
npc.OnAllowBehGraphChange();
npc.LowerGuard();
combatDataStorage.DetachAndDestroyProjectile();
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBehTreeTaskCombatStorageCleanupDef extends IBehTreeTaskDefinition{
}
class CBTTaskPreCombatWarning extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CBaseAICombatStorage;
public var setFlagOnActivate : Bool;
public var setFlagOnDectivate : Bool;
public var flag : Bool;
public function IsAvailable() : Bool{
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
InitializeCombatDataStorage();
if (setFlagOnActivate){
combatDataStorage.SetPreCombatWarning(flag);
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (setFlagOnDectivate){
combatDataStorage.SetPreCombatWarning(flag);
}
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBTTaskPreCombatWarningDef extends IBehTreeTaskDefinition{

public editable var setFlagOnActivate : Bool;


public editable var setFlagOnDectivate : Bool;
public editable var flag : Bool;
}
class CBTTaskGetPreCombatWarning extends IBehTreeTask{
protected var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CBaseAICombatStorage;
public var setFlagOnActivate : Bool;
public var setFlagOnDectivate : Bool;
public var flag : Bool;
public function IsAvailable() : Bool{
InitializeCombatDataStorage();
return combatDataStorage.GetPreCombatWarning();
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBTTaskGetPreCombatWarningDef extends IBehTreeTaskDefinition{
}
class CBehTreeCombatTargetSelectionTaskDef extends IBehTreeTaskDefinition{
public editable var maxTargetDistance : Float;
public editable var playerPriority : Int32;
public editable var targetOnlyPlayer : Bool;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('BeingHit');
listenToGameplayEvents.PushBack('ForceTarget');
listenToGameplayEvents.PushBack('UnforceTarget');
listenToGameplayEvents.PushBack('ReevaluateCombatTarget');
/* NOP */;
}
}
class CBTTaskCounterDecorator extends IBehTreeTask{
public function OnActivate() : EBTNodeStatus{
GetNPC().SetIsCountering(true);
return 0;
/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetIsCountering(false);
/* NOP */;
}
}
class CBTTaskCounterDecoratorDef extends IBehTreeTaskDefinition{
}
class CBTTaskDash extends CBTTaskPlayAnimationEventDecorator{
public var dashChance : Int32;

public
public
public
public
public

var nextDashTime : Float;


var dashDelay : Float;
var getStats : Bool;
var dashBack : Bool;
function IsAvailable() : Bool{
var npc : CNewNPC;
npc = GetNPC();
if (getStats){
GetDashStats();
getStats = false;
}
if (nextDashTime > GetLocalTime()){
return false;
}
if (!checkDistance()){
return false;
}
return Dash();
/* NOP */;

}
public function checkDistance() : Bool{
var npc : CNewNPC;
var target : CActor;
var dist : Float;
npc = GetNPC();
target = GetCombatTarget();
if (target){
dist = VecDistance2D(npc.GetWorldPosition(), target.GetW
orldPosition());
if (dist >= 0 && dist < 8){
return true;
}
}
return false;
/* NOP */;
}
public function Dash() : Bool{
if (!chooseAndCheckDash()){
return false;
}
return true;
/* NOP */;
}
public function GetDashStats(){
var npc : CNewNPC;
npc = GetNPC();
dashChance = 100 * CalculateAttributeValue(npc.GetAttributeValue
('dash_movement_chance', /* NOP */, /* NOP */), /* NOP */);
/* NOP */;
}
public function chooseAndCheckDash() : Bool{
var npc : CNewNPC;
var actorToTargetAngle : Float;
var target : CActor;
npc = GetNPC();
target = GetCombatTarget();
if (RandRange(100, /* NOP */) < dashChance){
actorToTargetAngle = AbsF(AngleDistance(VecHeading(targe
t.GetWorldPosition() - npc.GetWorldPosition()), VecHeading(npc.GetHeadingVector(
))));

if (dashBack){
npc.SetBehaviorVariable('DodgeDirection', 0, /*
NOP */);
} else if (actorToTargetAngle > -45 && actorToTargetAngl
e < 45){
npc.SetBehaviorVariable('DodgeDirection', 3, /*
NOP */);
} else if (actorToTargetAngle > 45 && actorToTargetAngle
< 135){
npc.SetBehaviorVariable('DodgeDirection', 2, /*
NOP */);
} else if (actorToTargetAngle > -135 && actorToTargetAng
le < -45){
npc.SetBehaviorVariable('DodgeDirection', 1, /*
NOP */);
} else {
npc.SetBehaviorVariable('DodgeDirection', 0, /*
NOP */);
}
return true;
}
return false;
/* NOP */;
}
public function OnDeactivate(){
nextDashTime = GetLocalTime() + dashDelay;
return super.OnDeactivate();
/* NOP */;
}
}
class CBTTaskDashDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var dashDelay : Float;
public editable var dashBack : Bool;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('Time2Dash');
listenToGameplayEvents.PushBack('LeftIdleTrigger');
/* NOP */;
}
}
class CBTTaskDefend extends IBehTreeTask{
public var useCustomHits : Bool;
public var listenToParryEvents : Bool;
public var completeTaskOnIsDefending : Bool;
public var minimumDuration : Float;
public var playParrySound : Bool;
private var m_activationTime : Float;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
npc.SetGuarded(true);
npc.SetParryEnabled(true);
if (useCustomHits){
npc.customHits = true;
npc.SetCanPlayHitAnim(true);
}
m_activationTime = GetLocalTime();
return 0;

/* NOP */;
}
public function OnDeactivate(){
var npc : CNewNPC;
npc = GetNPC();
npc.SetGuarded(false);
npc.SetParryEnabled(false);
if (useCustomHits){
npc.customHits = false;
}
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var data : CDamageData;
var l_currentDuration : Float;
npc = GetNPC();
if (eventName == 'BeingHit'){
data = (CDamageData)GetEventParamBaseDamage();
if ((CBaseGameplayEffect)data.causer){
return true;
}
if (playParrySound){
npc.SoundEvent("cmb_play_parry", /* NOP */, /* N
OP */);
}
if (data.customHitReactionRequested){
npc.RaiseEvent('CustomHit');
SetHitReactionDirection();
return true;
}
} else if (listenToParryEvents && eventName == 'ParryPerform' ||
eventName == 'ParryStagger' && npc.CanPlayHitAnim()){
npc.RaiseEvent('CustomHit');
SetHitReactionDirection();
return true;
} else if (eventName == 'IsDefending'){
SetEventRetvalInt(1);
l_currentDuration = GetLocalTime() - m_activationTime;
if (completeTaskOnIsDefending && l_currentDuration > min
imumDuration){
Complete(true);
}
return true;
}
return false;
/* NOP */;
}
private function SetHitReactionDirection(){
var victimToAttackerAngle : Float;
var npc : CNewNPC;
var target : CActor;
npc = GetNPC();
target = GetCombatTarget();
victimToAttackerAngle = NodeToNodeAngleDistance(target, npc);
if (AbsF(victimToAttackerAngle) <= 90){
npc.SetBehaviorVariable('HitReactionDirection', 0, /* NO
P */);
} else if (AbsF(victimToAttackerAngle) > 90){
npc.SetBehaviorVariable('HitReactionDirection', 1, /* NO

P */);
}
if (victimToAttackerAngle > 45 && victimToAttackerAngle < 135){
npc.SetBehaviorVariable('HitReactionSide', 2, /* NOP */)
;
} else if (victimToAttackerAngle < -45 && victimToAttackerAngle
> -135){
npc.SetBehaviorVariable('HitReactionSide', 1, /* NOP */)
;
} else {
npc.SetBehaviorVariable('HitReactionSide', 0, /* NOP */)
;
}
/* NOP */;
}
}
class CBTTaskDefendDef extends IBehTreeTaskDefinition{
public editable var useCustomHits : Bool;
public editable var listenToParryEvents : Bool;
public editable var completeTaskOnIsDefending : Bool;
public editable var minimumDuration : Float;
public editable var playParrySound : Bool;
}
class CBTTaskDelay extends IBehTreeTask{
public var delay : Float;
public var nextActionTime : Float;
public function IsAvailable() : Bool{
var target : CActor;
var npc : CNewNPC;
if (nextActionTime > GetLocalTime()){
return false;
}
npc = GetNPC();
target = GetCombatTarget();
return target && target.IsAlive();
/* NOP */;
}
public function OnDeactivate(){
nextActionTime = GetLocalTime() + delay;
/* NOP */;
}
}
class CBTTaskDelayDef extends IBehTreeTaskDefinition{
public editable var delay : Float;
}
class CBTTaskActivateOnlyOnce extends IBehTreeTask{
private var successOnly : Bool;
private var resetWhenReattachFromPool : Bool;
private var wasActivated : Bool;
public function IsAvailable() : Bool{
return !wasActivated;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (!successOnly){
wasActivated = true;

}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (!successOnly){
wasActivated = true;
}
/* NOP */;
}
public function OnCompletion(success : Bool){
if (success && successOnly){
wasActivated = true;
}
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (resetWhenReattachFromPool){
wasActivated = false;
}
return true;
/* NOP */;
}
}
class CBTTaskActivateOnlyOnceDef extends IBehTreeTaskDefinition{
public editable var successOnly : Bool;
public editable var resetWhenReattachFromPool : Bool;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('OnReattachFromPool');
/* NOP */;
}
}
class CBTTaskDodgeDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var navmeshCheckDist : Float;
public editable var minDelayBetweenDodges : Float;
public editable var maxDistanceFromTarget : Float;
public editable var movementAdjustorSlideDistance : Float;
public editable var allowDodgeWhileAttacking : Bool;
public editable var signalGameplayEventWhileInHitAnim : Bool;
public editable var alwaysAvailableOnDodgeType : EDodgeType;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('Time2Dodge');
listenToGameplayEvents.PushBack('Time2DodgeProjectile');
listenToGameplayEvents.PushBack('Time2DodgeBomb');
listenToGameplayEvents.PushBack('Time2DodgeProjectileDelayed');
listenToGameplayEvents.PushBack('Time2DodgeBombDelayed');
/* NOP */;
}
}
class CBTTaskCombatStyleDodge extends CBTTaskDodge{
public var parentCombatStyle : EBehaviorGraph;
private var humanCombatDataStorage : CHumanAICombatStorage;
public function GetActiveCombatStyle() : EBehaviorGraph{
InitializeCombatDataStorage();
if (humanCombatDataStorage){

return humanCombatDataStorage.GetActiveCombatStyle();
} else {
return 1;
}
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (eventName == 'Time2Dodge' && parentCombatStyle != GetActiveC
ombatStyle()){
return false;
}
return super.OnListenedGameplayEvent(eventName);
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!humanCombatDataStorage){
super.InitializeCombatDataStorage();
humanCombatDataStorage = (CHumanAICombatStorage)combatDa
taStorage;
}
/* NOP */;
}
}
class CBTTaskCombatStyleDodgeDef extends CBTTaskDodgeDef{
public editable inlined var parentCombatStyle : CBTEnumBehaviorGraph;
}
class CBTTaskCircularDodge extends CBTTaskDodge{
public var angle : Float;
public function ChooseAndCheckDodge() : Bool{
var npc : CNewNPC;
var target : CActor;
var dodgeChance : Int32;
npc = GetNPC();
target = npc.GetTarget();
switch(dodgeType){
case 0:
dodgeChance = dodgeChanceAttackLight;
break;
case 1:
dodgeChance = dodgeChanceAttackHeavy;
break;
case 2:
dodgeChance = dodgeChanceAard;
break;
case 3:
dodgeChance = dodgeChanceIgni;
break;
case 4:
dodgeChance = dodgeChanceBomb;
break;
case 5:
dodgeChance = dodgeChanceProjectile;
break;
case 6:
dodgeChance = dodgeChanceFear;
break;
default:
return false;

}
npc.slideTarget = target;
if (RandRange(100, /* NOP */) < dodgeChance){
if (dodgeType == 0 || dodgeType == 1 || dodgeType == 6){
dodgeDirection = 0;
} else if (RandRange(100, /* NOP */) < 50){
RotateToAngle(-angle);
dodgeDirection = 1;
} else {
RotateToAngle(angle);
dodgeDirection = 2;
}
npc.SetBehaviorVariable('DodgeDirection', dodgeDirection
, /* NOP */);
return true;
}
return false;
/* NOP */;
}
public function RotateToAngle(angleDeg : Float){
var npc : CNewNPC;
var target : CActor;
var angleRad : Float;
var fSin : Float;
var fCos : Float;
var targetHeading : Vector;
var heading : Vector;
npc = GetNPC();
target = npc.GetTarget();
heading = VecFromHeading(npc.GetHeading());
angleRad = Deg2Rad(angleDeg);
fSin = SinF(angleRad);
fCos = CosF(angleRad);
targetHeading.X = heading.X * fCos - heading.Y * fSin;
targetHeading.Y = heading.X * fSin + heading.Y * fCos;
targetHeading.Z = heading.Z;
targetHeading.W = heading.W;
npc.ActionSlideToWithHeadingAsync(npc.GetWorldPosition(), VecHea
ding(targetHeading), 0.010000, /* NOP */);
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var target : CActor;
npc = GetNPC();
if (eventName == 'RotateEventStart'){
target = npc.GetTarget();
npc.SetRotationAdjustmentRotateTo(target, /* NOP */);
npc.slideTarget = target;
return true;
}
return super.OnGameplayEvent(eventName);
/* NOP */;
}
}
class CBTTaskCircularDodgeDef extends CBTTaskDodgeDef{
public editable var angle : Float;
}

class CBehTreeTaskEquipMonsterWeapons extends IBehTreeTask{


public function IsAvailable() : Bool{
var ids : array<SItemUniqueId>;
var inv : CInventoryComponent;
var i : Int32;
inv = GetNPC().GetInventory();
ids = inv.GetItemsByCategory('monster_weapon');
i = 0;
while (i < ids.Size()){
if (!inv.IsItemHeld(ids[i])){
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var slots : array<CName>;
var items : array<CName>;
var ids : array<SItemUniqueId>;
var inv : CInventoryComponent;
var i : Int32;
var itemName : CName;
var dm : CDefinitionsManagerAccessor;
inv = GetNPC().GetInventory();
ids = inv.GetItemsByCategory('monster_weapon');
dm = theGame.GetDefinitionsManager();
i = 0;
while (i < ids.Size()){
itemName = inv.GetItemName(ids[i]);
slots.PushBack(dm.GetItemHoldSlot(itemName, false));
items.PushBack(itemName);
i += 1;
}
GetNPC().IssueRequiredItemsGeneric(items, slots);
return 0;
/* NOP */;
}
}
class CBehTreeTaskEquipMonsterWeaponsDef extends IBehTreeTaskDefinition{
}
class CBTTaskEquipItem extends IBehTreeTask{
public var itemCategory : CName;
public function IsAvailable() : Bool{
var npc : CNewNPC;
var itemIds : array<SItemUniqueId>;
var inv : CInventoryComponent;
var i : Int32;
npc = GetNPC();
inv = npc.GetInventory();
itemIds = inv.GetAllWeapons();
if (itemIds.Size() == 0){
LogAssert(false, "CBTTaskEquipItem.IsAvailable: actor <<
" + npc + ">> has no weapons at all, cannot equip");
return false;
}
i = 0;

while (i < itemIds.Size()){


if (inv.IsItemHeld(itemIds[i])){
return true;
}
i += 1;
}
return npc.EquipItem(itemIds[0], 0, true);
/* NOP */;
}
}
class CBTTaskEquipItemDef extends IBehTreeTaskDefinition{
public editable var itemCategory : CName;
}
class CBTTaskFear extends CBTTaskPlayAnimationEventDecorator{
public var useDirectionalAnims : Bool;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
var target : CActor;
var targetToAttackerAngle : Float;
npc = GetNPC();
target = GetCombatTarget();
if (useDirectionalAnims){
targetToAttackerAngle = NodeToNodeAngleDistance(target,
npc);
if (targetToAttackerAngle >= -180 && targetToAttackerAng
le < -67.500000){
npc.SetBehaviorVariable('targetDirection', 2, /*
NOP */);
} else if (targetToAttackerAngle >= -67.500000 && target
ToAttackerAngle < -22.500000){
npc.SetBehaviorVariable('targetDirection', 1, /*
NOP */);
} else if (targetToAttackerAngle >= -22.500000 && target
ToAttackerAngle < 22.500000){
npc.SetBehaviorVariable('targetDirection', 0, /*
NOP */);
} else if (targetToAttackerAngle >= 22.500000 && targetT
oAttackerAngle < 67.500000){
npc.SetBehaviorVariable('targetDirection', 8, /*
NOP */);
} else if (targetToAttackerAngle >= 67.500000 && targetT
oAttackerAngle < 180){
npc.SetBehaviorVariable('targetDirection', 7, /*
NOP */);
}
}
return super.OnActivate();
/* NOP */;
}
}
class CBTTaskFearDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var useDirectionalAnims : Bool;
}
class CBTTaskFinishable extends IBehTreeTask{
public var finisherAnimName : CName;
public function OnActivate() : EBTNodeStatus{

var owner : CNewNPC;


owner = GetNPC();
if (finisherAnimName){
owner.EnableFinishComponent(true);
thePlayer.AddToFinishableEnemyList(owner, true);
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var owner : CNewNPC;
owner = GetNPC();
owner.EnableFinishComponent(false);
thePlayer.AddToFinishableEnemyList(owner, false);
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
var npc : CNewNPC;
var syncAnimName : CName;
npc = GetNPC();
if (eventName == 'Finisher'){
npc.EnableFinishComponent(false);
thePlayer.AddToFinishableEnemyList(GetNPC(), false);
FinisherSyncAnim();
return true;
}
return false;
/* NOP */;
}
public function FinisherSyncAnim(){
theGame.GetSyncAnimManager().SetupSimpleSyncAnim(finisherAnimNam
e, thePlayer, GetActor());
/* NOP */;
}
}
class CBTTaskFinishableDef extends IBehTreeTaskDefinition{
public editable var finisherAnimName : CName;
}
class BTTaskFrostAreaAttack extends IBehTreeTask{
public var duration : SRangeF;
public var spreadingSpeed : Float;
public var maxRadius : Float;
public var spawnAtOnce : SRange;
public var createArena : Bool;
public var arenaAngle : Float;
public var scaleSpawnQuantityWithRadius : Bool;
public var spawnAttackDelay : SRangeF;
public var spawnAttackOnTargetDelay : SRangeF;
public var spawnedEntityTemplates : array<CEntityTemplate>;
public var frostWallReloadDelay : Float;
private var m_Npc : CNewNPC;
private var m_MinAttackRange : Float;
private var m_FrostRange : Float;
private var m_TimeToAttackOnTarget : Float;
private var m_PostFxOnGroundCmp : W3PostFXOnGroundComponent;
public function Initialize(){
m_Npc = GetNPC();
m_PostFxOnGroundCmp = (W3PostFXOnGroundComponent)GetNPC().GetCom

ponentByClassName('W3PostFXOnGroundComponent');
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var i : Int32;
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_gameplayFX : CGameplayFXSurfacePost;
var l_timeLeft : Float;
var l_lastLocalTime : Float;
var l_deltaTime : Float;
var l_timeUntilNextAttack : Float;
var l_spawnQuantity : Int32;
var l_timeBeforeWallIsLoaded : Float;
var l_radiusPercentage : Float;
var l_timeToReachMaxRadius : Float;
var l_arenaRange : Float;
var l_arenaPerimeter : Float;
var l_spawnedEntityRadius : Float;
var l_arenaSpawnQt : Float;
var l_angleBetweenSpikes : Float;
var l_spawnPos : Vector;
var l_forwardVector : Vector;
var l_rotation : EulerAngles;
var l_headingToTarget : Float;
var l_startHeading : Float;
l_gameplayFX = theGame.GetSurfacePostFX();
l_timeLeft = RandRangeF(duration.max, duration.min);
if (spreadingSpeed > 0){
l_timeToReachMaxRadius = maxRadius / spreadingSpeed;
} else {
l_timeToReachMaxRadius = 1;
}
m_TimeToAttackOnTarget = RandRangeF(spawnAttackOnTargetDelay.max
, spawnAttackOnTargetDelay.min);
if (m_PostFxOnGroundCmp){
m_PostFxOnGroundCmp.StopTicking();
}
l_npcPos = m_Npc.GetWorldPosition();
l_gameplayFX.AddSurfacePostFXGroup(l_npcPos, l_timeToReachMaxRad
ius, l_timeLeft, 1.000000, maxRadius * 4, 0);
m_Npc.PlayEffect('marker', /* NOP */);
m_FrostRange = 0;
if (spreadingSpeed < 0){
m_FrostRange = maxRadius;
}
if (createArena){
l_arenaRange = m_FrostRange * 1.000000;
l_spawnedEntityRadius = 3.000000;
l_arenaPerimeter = 2 * l_arenaRange * Pi();
l_arenaPerimeter *= arenaAngle / 360;
l_arenaSpawnQt = l_arenaPerimeter / l_spawnedEntityRadiu
s;
l_angleBetweenSpikes = arenaAngle / l_arenaSpawnQt;
l_targetPos = GetCombatTarget().GetWorldPosition();
l_headingToTarget = VecHeading(l_targetPos - l_npcPos);
l_startHeading = l_headingToTarget - arenaAngle * 0.5000
00;
i = 0;
while (i < l_arenaSpawnQt){

l_spawnPos = l_npcPos + VecConeRand(l_startHeadi


ng + i * l_angleBetweenSpikes, l_spawnedEntityRadius, l_arenaRange * 0.500000, l
_arenaRange);
l_forwardVector = l_npcPos - l_spawnPos;
l_rotation = VecToRotation(l_forwardVector);
CreateEntity(l_spawnPos, l_rotation);
i += 1;
}
}
while (l_timeLeft > 0){
l_lastLocalTime = GetLocalTime();
SleepOneFrame();
l_deltaTime = GetLocalTime() - l_lastLocalTime;
l_timeLeft -= l_deltaTime;
if (spreadingSpeed > 0){
m_FrostRange += spreadingSpeed * l_deltaTime;
}
m_FrostRange = ClampF(m_FrostRange, 0, maxRadius);
l_timeUntilNextAttack -= l_deltaTime;
m_TimeToAttackOnTarget -= l_deltaTime;
if (l_timeUntilNextAttack <= 0 && m_FrostRange > m_MinAt
tackRange){
l_radiusPercentage = 1;
if (scaleSpawnQuantityWithRadius){
l_radiusPercentage = m_FrostRange / maxR
adius;
}
l_spawnQuantity = RandRange(RoundF(l_radiusPerce
ntage * spawnAtOnce.max), RoundF(l_radiusPercentage * spawnAtOnce.min));
l_spawnQuantity = Clamp(l_spawnQuantity, Min(1,
spawnAtOnce.min), spawnAtOnce.max);
i = 0;
while (i < l_spawnQuantity){
SpawnAttack();
i += 1;
}
l_timeUntilNextAttack = RandRangeF(spawnAttackDe
lay.max + 1 - l_radiusPercentage * spawnAttackDelay.max * 0.500000, spawnAttackD
elay.min + 1 - l_radiusPercentage * spawnAttackDelay.min * 0.500000);
}
if (frostWallReloadDelay >= 0 && m_FrostRange > m_MinAtt
ackRange){
l_timeBeforeWallIsLoaded -= l_deltaTime;
if (l_timeBeforeWallIsLoaded <= 0){
l_targetPos = GetCombatTarget().GetWorld
Position();
if (VecDistance2D(l_targetPos, l_npcPos)
< 5){
SpawnDefenseWall();
l_timeBeforeWallIsLoaded = frost
WallReloadDelay;
}
}
}
}
return 2;
/* NOP */;
}
private function SpawnDefenseWall(){
var i : Int32;

var l_npcPos : Vector;


var l_target : CActor;
var l_targetPos : Vector;
var l_spawnPos : Vector;
var l_forwardVector : Vector;
var l_rotation : EulerAngles;
var l_headingToTarget : Float;
var l_angleBetweenSpawn : Float;
var l_randomDistance : Float;
l_target = GetCombatTarget();
l_npcPos = m_Npc.GetWorldPosition();
l_targetPos = l_target.GetWorldPosition();
l_headingToTarget = VecHeading(l_targetPos - l_npcPos);
l_angleBetweenSpawn = 45;
l_randomDistance = RandRangeF(2, 1);
i = -1;
while (i <= 1){
l_spawnPos = l_npcPos + VecConeRand(l_headingToTarget +
i * l_angleBetweenSpawn, 1, l_randomDistance, l_randomDistance);
l_forwardVector = l_spawnPos - l_npcPos;
l_rotation = VecToRotation(l_forwardVector);
CreateEntity(l_spawnPos, l_rotation);
i += 1;
}
/* NOP */;
}
private function SpawnAttack(){
var l_npcPos : Vector;
var l_target : CActor;
var l_targetPos : Vector;
var l_spawnPos : Vector;
var l_forwardVector : Vector;
var l_rotation : EulerAngles;
l_target = GetCombatTarget();
l_npcPos = m_Npc.GetWorldPosition();
l_targetPos = l_target.GetWorldPosition();
if (spawnAttackOnTargetDelay.max >= 0 && m_TimeToAttackOnTarget
<= 0 && VecDistance2D(l_targetPos, l_npcPos) < m_FrostRange && theGame.GetWorld(
).NavigationLineTest(l_npcPos, l_targetPos, m_Npc.GetRadius(), /* NOP */, /* NOP
*/)){
m_TimeToAttackOnTarget = RandRangeF(spawnAttackOnTargetD
elay.max, spawnAttackOnTargetDelay.min);
if (l_target.HasBuff(6) || l_target.HasBuff(9) || l_targ
et.HasBuff(10)){
return;
}
l_spawnPos = l_targetPos;
l_spawnPos += VecRingRand(0, 4);
} else {
l_spawnPos = l_npcPos + VecRingRand(m_MinAttackRange, m_
FrostRange);
if (VecDistance2D(l_spawnPos, l_targetPos) < 2){
return;
}
}
l_forwardVector = l_spawnPos - l_npcPos;
l_rotation = VecToRotation(l_forwardVector);
CreateEntity(l_spawnPos, l_rotation);
/* NOP */;
}

public function CreateEntity(_SpawnPos : Vector, _Rotation : EulerAngles


) : CEntity{
var l_spawnedEntity : CEntity;
var l_damageAreaEntity : CDamageAreaEntity;
var l_summonedEntityComponent : W3SummonedEntityComponent;
var l_normal : Vector;
var l_entityToSpawn : CEntityTemplate;
var l_randValue : Int32;
theGame.GetWorld().StaticTrace(_SpawnPos + Vector(0, 0, 5), _Spa
wnPos - Vector(0, 0, 5), _SpawnPos, l_normal, /* NOP */);
l_randValue = RandRange(spawnedEntityTemplates.Size(), /* NOP */
);
l_entityToSpawn = spawnedEntityTemplates[l_randValue];
l_spawnedEntity = theGame.CreateEntity(l_entityToSpawn, _SpawnPo
s, _Rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
l_damageAreaEntity = (CDamageAreaEntity)l_spawnedEntity;
if (l_damageAreaEntity){
l_damageAreaEntity.owner = m_Npc;
}
l_summonedEntityComponent = (W3SummonedEntityComponent)l_spawned
Entity.GetComponentByClassName('W3SummonedEntityComponent');
if (l_summonedEntityComponent){
l_summonedEntityComponent.Init(m_Npc);
}
return l_spawnedEntity;
/* NOP */;
}
public function OnDeactivate(){
if (m_PostFxOnGroundCmp){
m_PostFxOnGroundCmp.StartTicking();
}
m_Npc.StopEffect('marker');
/* NOP */;
}
}
class W3PostFXOnGroundComponent extends CSelfUpdatingComponent{
private editable var fadeInTime : Float;
private editable var activeTime : Float;
private editable var fadeOutTime : Float;
private editable var range : Float;
private editable var type : Int32;
private editable var updateDelay : Float;
private editable var stopAtDeath : Bool;
private var m_Actor : CActor;
private var m_DelaySinceLastUpdate : Float;
private var m_DefaultFadeInTime : Float;
private var m_DefaultActiveTime : Float;
private var m_DefaultFadeOutTime : Float;
private var m_DefaultRange : Float;
public function GetRange() : Float{
return range;
/* NOP */;
}
public function OnComponentAttached() : Bool{
m_DefaultFadeInTime = fadeInTime;
m_DefaultActiveTime = activeTime;
m_DefaultFadeOutTime = fadeOutTime;
m_DefaultRange = range;
m_Actor = (CActor)GetEntity();

/* NOP */;
}
public function OnComponentTick(_Dt : Float) : Bool{
if (stopAtDeath && m_Actor && !m_Actor.IsAlive()){
StopTicking();
return false;
}
Update(_Dt);
if (updateDelay < 0){
StopTicking();
}
/* NOP */;
}
public function OverrideValues(_FadeInTime : Float, _ActiveTime : Float,
_FadeOutTime : Float, _Range : Float){
fadeInTime = _FadeInTime;
activeTime = _ActiveTime;
fadeOutTime = _FadeOutTime;
range = _Range;
/* NOP */;
}
public function RestoreValues(){
fadeInTime = m_DefaultFadeInTime;
activeTime = m_DefaultActiveTime;
fadeOutTime = m_DefaultFadeOutTime;
range = m_DefaultRange;
/* NOP */;
}
private function Update(_Dt : Float){
var l_pos : Vector;
var l_normal : Vector;
var l_gameplayFX : CGameplayFXSurfacePost;
l_gameplayFX = theGame.GetSurfacePostFX();
m_DelaySinceLastUpdate += _Dt;
if (m_DelaySinceLastUpdate < updateDelay){
return;
}
l_pos = GetEntity().GetWorldPosition();
theGame.GetWorld().StaticTrace(l_pos + Vector(0, 0, 5), l_pos Vector(0, 0, 5), l_pos, l_normal, /* NOP */);
l_gameplayFX.AddSurfacePostFXGroup(l_pos, fadeInTime, activeTime
, fadeOutTime, range, type);
/* NOP */;
}
}
class BTTaskFrostAreaAttackDef extends IBehTreeTaskDefinition{
private editable var spawnedEntities : array<CName>;
private editable var duration : SRangeF;
private editable var spreadingSpeed : Float;
private editable var maxRadius : Float;
private editable var spawnAtOnce : SRange;
private editable var createArena : Bool;
private editable var arenaAngle : Float;
private editable var scaleSpawnQuantityWithRadius : Bool;
private editable var spawnAttackDelay : SRangeF;
private editable var spawnAttackOnTargetDelay : SRangeF;
private editable var frostWallReloadDelay : Float;
public function OnSpawn(taskGen : IBehTreeTask){
var i : Int32;

var task : BTTaskFrostAreaAttack;


task = (BTTaskFrostAreaAttack)taskGen;
i = 0;
while (i < spawnedEntities.Size()){
task.spawnedEntityTemplates.PushBack((CEntityTemplate)Lo
adResource(spawnedEntities[i], /* NOP */));
i += 1;
}
/* NOP */;
}
}
class BTTaskFrostSnakeAttack extends CBTTaskAttack{
public var useActionTarget : Bool;
public var spawnedEntityTemplates : array<CEntityTemplate>;
public var duration : SRangeF;
public var clampDurationWhenTargetReached : Float;
public var speed : Float;
public var radius : Float;
public var spawnAtOnce : SRange;
public var spawnAttackDelay : SRangeF;
public var maxDistance : Float;
public var abortAttackOnTargetReached : Bool;
public var ThreeStateAttack : Bool;
public var loopHeadFX : Bool;
public var waitForAnimEventToSummon : CName;
public var snakeHeadTemplate : CEntityTemplate;
public var playEffectOnOwner : CName;
public var additionalSnakeHeadFXName : CName;
public var destroyEffectDelay : Float;
public var canTriggerFrenzySlowmo : Bool;
private var m_Npc : CNewNPC;
private var m_SnakeHead : CEntity;
private var m_SnakeHeadPos : Vector;
private var m_LastSnakeHeadPos : Vector;
private var m_effectDummyComp : CEffectDummyComponent;
private var m_PlayEffect : Bool;
private var m_CanStartSummon : Bool;
public final function Initialize(){
m_Npc = GetNPC();
m_effectDummyComp = (CEffectDummyComponent)GetNPC().GetComponent
ByClassName('CEffectDummyComponent');
if (IsNameValid(waitForAnimEventToSummon)){
m_CanStartSummon = false;
} else {
m_CanStartSummon = true;
}
/* NOP */;
}
public final function OnActivate() : EBTNodeStatus{
if (ThreeStateAttack){
GetNPC().SetBehaviorVariable('AttackEnd', 0, true);
}
m_PlayEffect = true;
if (canTriggerFrenzySlowmo){
if ((W3PlayerWitcher)GetCombatTarget() && thePlayer.IsAc
tionAllowed(23) || thePlayer.IsActionAllowed(11) && thePlayer.GetStat(3, /* NOP
*/) > 0 && thePlayer.CanUseSkill(73)){
(W3PlayerWitcher)GetCombatTarget().StartFrenzy()
;

}
}
return OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var i : Int32;
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_gameplayFX : CGameplayFXSurfacePost;
var l_timeLeft : Float;
var l_lastLocalTime : Float;
var l_deltaTime : Float;
var l_timeUntilNextAttack : Float;
var l_spawnQuantity : Int32;
var l_timeBeforeWarning : Float;
var l_warningDone : Bool;
var l_warningPos : Vector;
var l_headingToTarget : Float;
var l_startHeading : Float;
var l_delayToSaveSnakePos : Float;
l_gameplayFX = theGame.GetSurfacePostFX();
if (IsNameValid(playEffectOnOwner)){
m_Npc.PlayEffect(playEffectOnOwner, /* NOP */);
}
l_npcPos = m_Npc.GetWorldPosition();
m_LastSnakeHeadPos = l_npcPos;
m_SnakeHeadPos = l_npcPos + m_Npc.GetWorldForward() * 0.100000;
if (useActionTarget){
l_targetPos = GetActionTarget().GetWorldPosition();
} else {
l_targetPos = GetCombatTarget().GetWorldPosition();
}
l_timeBeforeWarning = 0;
while (!m_CanStartSummon){
l_lastLocalTime = GetLocalTime();
SleepOneFrame();
l_deltaTime = GetLocalTime() - l_lastLocalTime;
l_timeBeforeWarning -= l_deltaTime;
if (!l_warningDone && l_timeBeforeWarning < 0){
l_headingToTarget = VecHeading(l_targetPos - l_n
pcPos);
l_startHeading = l_headingToTarget - 53;
i = 0;
while (i < 7){
l_warningPos = l_npcPos + VecConeRand(l_
startHeading - i * 37, 2, 2, 2.300000);
super.SpawnAttack(l_warningPos);
i += 1;
}
l_warningDone = true;
}
}
l_timeLeft = RandRangeF(duration.max, duration.min);
m_SnakeHead = theGame.CreateEntity(snakeHeadTemplate, m_SnakeHea
dPos, m_Npc.GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* N
OP */);
while (l_timeLeft > 0){
l_lastLocalTime = GetLocalTime();
SleepOneFrame();

l_deltaTime = GetLocalTime() - l_lastLocalTime;


l_timeLeft -= l_deltaTime;
super.MoveHead(l_deltaTime);
if (maxDistance > 0 && VecDistance(m_SnakeHeadPos, l_npc
Pos) > maxDistance){
return 2;
}
if (useActionTarget){
l_targetPos = GetActionTarget().GetWorldPosition
();
} else {
l_targetPos = GetCombatTarget().GetWorldPosition
();
}
if (clampDurationWhenTargetReached >= 0 && VecDistance(l
_targetPos, m_SnakeHeadPos) < radius * 0.300000){
l_timeLeft = ClampF(l_timeLeft, 0, clampDuration
WhenTargetReached);
}
l_timeUntilNextAttack -= l_deltaTime;
if (l_timeUntilNextAttack <= 0 && VecDistance(l_targetPo
s, m_SnakeHeadPos) < 3 && maxDistance < 0 || VecDistance(l_targetPos, l_npcPos)
< maxDistance){
l_spawnQuantity = RandRange(spawnAtOnce.max, spa
wnAtOnce.min);
l_spawnQuantity = Clamp(l_spawnQuantity, Min(1,
spawnAtOnce.min), spawnAtOnce.max);
i = 0;
while (i < l_spawnQuantity){
super.SpawnAttack(/* NOP */);
i += 1;
}
l_timeUntilNextAttack = RandRangeF(spawnAttackDe
lay.max, spawnAttackDelay.min);
}
l_delayToSaveSnakePos -= l_deltaTime;
if (l_delayToSaveSnakePos <= 0){
m_LastSnakeHeadPos = m_SnakeHeadPos;
l_delayToSaveSnakePos = 0.500000;
}
}
if (ThreeStateAttack){
GetNPC().SetBehaviorVariable('AttackEnd', 1, true);
}
return 2;
/* NOP */;
}
private final function MoveHead(_DeltaTime : Float){
var l_targetPos : Vector;
var l_normal : Vector;
if (useActionTarget){
l_targetPos = GetActionTarget().GetWorldPosition();
} else {
l_targetPos = GetCombatTarget().GetWorldPosition();
}
m_SnakeHeadPos = InterpTo_V(m_SnakeHeadPos, l_targetPos, _DeltaT
ime, speed);
theGame.GetWorld().StaticTrace(m_SnakeHeadPos + Vector(0, 0, 3),
m_SnakeHeadPos - Vector(0, 0, 3), m_SnakeHeadPos, l_normal, /* NOP */);
m_SnakeHead.Teleport(InterpTo_V(m_SnakeHeadPos, m_SnakeHead.GetW

orldPosition(), 0.050000, 0.500000));


if (IsNameValid(additionalSnakeHeadFXName) && m_PlayEffect){
m_SnakeHead.PlayEffect(additionalSnakeHeadFXName, /* NOP
*/);
if (!loopHeadFX){
m_PlayEffect = false;
}
}
/* NOP */;
}
private final function SpawnAttack(_Pos : Vector){
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_vectToTarget : Vector;
var l_spawnPos : Vector;
var l_forwardVector : Vector;
var l_rotation : EulerAngles;
var l_headingToTarget : Float;
l_npcPos = m_Npc.GetWorldPosition();
if (useActionTarget){
l_targetPos = GetActionTarget().GetWorldPosition();
} else {
l_targetPos = GetCombatTarget().GetWorldPosition();
}
l_vectToTarget = l_targetPos - m_SnakeHeadPos;
l_headingToTarget = VecHeading(l_vectToTarget);
if (_Pos == Vector(0, 0, 0)){
l_spawnPos = l_targetPos + VecRingRand(0, radius);
} else {
l_spawnPos = _Pos;
}
l_forwardVector = m_SnakeHeadPos - m_LastSnakeHeadPos;
l_rotation = VecToRotation(l_forwardVector);
if (VecDistance(l_npcPos, l_spawnPos) < 1.500000){
return;
}
CreateEntity(l_spawnPos, l_rotation);
/* NOP */;
}
private final function CreateEntity(_SpawnPos : Vector, _Rotation : Eule
rAngles) : CEntity{
var l_spawnedEntity : CEntity;
var l_damageAreaEntity : CDamageAreaEntity;
var l_summonedEntityComponent : W3SummonedEntityComponent;
var l_normal : Vector;
var l_entityToSpawn : CEntityTemplate;
var l_randValue : Int32;
theGame.GetWorld().StaticTrace(_SpawnPos + Vector(0, 0, 5), _Spa
wnPos - Vector(0, 0, 5), _SpawnPos, l_normal, /* NOP */);
l_randValue = RandRange(spawnedEntityTemplates.Size(), /* NOP */
);
l_entityToSpawn = spawnedEntityTemplates[l_randValue];
l_spawnedEntity = theGame.CreateEntity(l_entityToSpawn, _SpawnPo
s, _Rotation, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
l_damageAreaEntity = (CDamageAreaEntity)l_spawnedEntity;
if (l_damageAreaEntity){
l_damageAreaEntity.owner = m_Npc;
}
l_summonedEntityComponent = (W3SummonedEntityComponent)l_spawned
Entity.GetComponentByClassName('W3SummonedEntityComponent');

if (l_summonedEntityComponent){
l_summonedEntityComponent.Init(m_Npc);
}
return l_spawnedEntity;
/* NOP */;
}
public function OnDeactivate(){
m_SnakeHead.DestroyAfter(destroyEffectDelay);
if (IsNameValid(additionalSnakeHeadFXName)){
m_SnakeHead.StopEffect(additionalSnakeHeadFXName);
}
if (IsNameValid(playEffectOnOwner)){
m_Npc.StopEffect(playEffectOnOwner);
}
if (IsNameValid(waitForAnimEventToSummon)){
m_CanStartSummon = false;
}
if (ThreeStateAttack){
GetNPC().SetBehaviorVariable('AttackEnd', 1, true);
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'AllowBlend' && animEventType == 1){
if (ThreeStateAttack){
GetNPC().SetBehaviorVariable('AttackEnd', 1, tru
e);
} else {
Complete(true);
}
}
if (IsNameValid(waitForAnimEventToSummon) && animEventName == wa
itForAnimEventToSummon){
m_CanStartSummon = true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
}
class BTTaskFrostSnakeAttackDef extends CBTTaskAttackDef{
private editable var useActionTarget : Bool;
private editable var spawnedEntityTemplates : array<CEntityTemplate>;
private editable var clampDurationWhenTargetReached : CBehTreeValFloat;
private editable var duration : SRangeF;
private editable var maxDistance : Float;
private editable var speed : Float;
private editable var radius : Float;
private editable var spawnAtOnce : SRange;
private editable var spawnAttackDelay : SRangeF;
private editable var snakeHeadTemplate : CEntityTemplate;
private editable var additionalSnakeHeadFXName : CName;
private editable var playEffectOnOwner : CName;
private editable var ThreeStateAttack : Bool;
private editable var loopHeadFX : Bool;
private editable var destroyEffectDelay : Float;
private editable var waitForAnimEventToSummon : CName;
private editable var canTriggerFrenzySlowmo : Bool;

}
class CBTTaskImlerithShieldDestruction extends IBehTreeTask{
public var firstTreshold : Float;
public var secondTreshold : Float;
public var thirdTreshold : Float;
public var finalTreshold : Float;
public var dropShield : Bool;
public var shield : CEntity;
public var shieldState : Int32;
public function IsAvailable() : Bool{
if (dropShield){
return true;
} else if (GetEssence() < firstTreshold && shieldState == 0){
return true;
} else if (GetEssence() < secondTreshold && shieldState == 1){
return true;
} else if (GetEssence() < thirdTreshold && shieldState == 2){
return true;
} else {
return false;
}
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
if (!dropShield){
ProcessShieldDestruction();
return 2;
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'BreakAttachmentShield' && dropShield){
GetNPC().DropItemFromSlot('l_weapon', true);
return true;
} else if (animEventName == 'ChangePhase' && dropShield){
GetNPC().SignalGameplayEvent('LeaveCurrentCombatStyle');
return true;
}
return false;
/* NOP */;
}
public function ProcessShieldDestruction(){
var npc : CNewNPC;
var effectName : CName;
var appearanceName : CName;
npc = GetNPC();
if (shieldState == 0){
effectName = 'destroy';
appearanceName = 'damaged';
} else if (shieldState == 1){
effectName = 'destroy';
appearanceName = 'damaged_02';
} else if (shieldState == 2){
effectName = 'destroy';
appearanceName = 'damaged_03';

}
shieldState += 1;
shield = npc.GetInventory().GetItemEntityUnsafe(npc.GetInventory
().GetItemFromSlot('l_weapon'));
npc.ToggleEffectOnShield(effectName, true);
shield.ApplyAppearance(appearanceName);
/* NOP */;
}
public function GetEssence() : Float{
return 100 * GetActor().GetStatPercents(1);
/* NOP */;
}
}
class CBTTaskImlerithShieldDestructionDef extends IBehTreeTaskDefinition{
public editable var firstTreshold : Float;
public editable var secondTreshold : Float;
public editable var thirdTreshold : Float;
public editable var finalTreshold : Float;
public editable var dropShield : Bool;
}
class CBTTaskIsFriendlyNearTarget extends IBehTreeTask{
public var useCombatTarget : Bool;
public var considerOwnerAsFriendly : Bool;
public var radius : Float;
public function IsAvailable() : Bool{
return super.CheckIfFriendlyIsInAoe();
/* NOP */;
}
public final function CheckIfFriendlyIsInAoe() : Bool{
var i : Int32;
var owner : CActor;
var potentialTargets : array<CActor>;
var target : CNode;
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
owner = GetActor();
potentialTargets = GetActorsInRange(target, radius, 99, 'None',
true);
if (potentialTargets.Contains(owner)){
if (considerOwnerAsFriendly){
return true;
} else {
potentialTargets.Remove(owner);
}
}
i = 0;
while (i < potentialTargets.Size()){
if (GetAttitudeBetween(owner, potentialTargets[i]) == 0)
{
return true;
}
i += 1;
}
return false;
/* NOP */;

}
}
class CBTTaskIsFriendlyNearTargetDef extends IBehTreeConditionalTaskDefinition{
public editable var useCombatTarget : Bool;
public editable var considerOwnerAsFriendly : Bool;
public editable var radius : Float;
}
class CBTTaskIsHostileAndNoFriendlyNearTarget extends IBehTreeTask{
public var useCombatTarget : Bool;
public var radius : Float;
public function IsAvailable() : Bool{
return super.CheckPotentialTargetsInAoe();
/* NOP */;
}
public final function CheckPotentialTargetsInAoe() : Bool{
var i : Int32;
var owner : CActor;
var potentialTargets : array<CActor>;
var target : CNode;
var res : Bool;
var att : EAIAttitude;
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
owner = GetActor();
potentialTargets = GetActorsInRange(target, radius, 99, 'None',
true);
if (potentialTargets.Contains(owner)){
return false;
}
i = 0;
while (i < potentialTargets.Size()){
att = GetAttitudeBetween(owner, potentialTargets[i]);
if (att == 0){
return false;
} else if (att == 2){
res = true;
}
i += 1;
}
return res;
/* NOP */;
}
}
class CBTTaskIsHostileAndNoFriendlyNearTargetDef extends IBehTreeConditionalTask
Definition{
public editable var useCombatTarget : Bool;
public editable var radius : Float;
}
class CBTTaskJumpBack extends CBTTaskPlayAnimationEventDecorator{
public var chance : Int32;
public var checkRotation : Bool;
public var distance : Float;
public function IsAvailable() : Bool{

if (theGame.GetWorld().NavigationLineTest(GetActor().GetWorldPos
ition(), GetActor().GetWorldPosition() - GetActor().GetHeadingVector() * distanc
e, (CMovingPhysicalAgentComponent)GetActor().GetMovingAgentComponent().GetCapsul
eRadius(), /* NOP */, /* NOP */)){
return Roll(chance);
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
var victimHeading : Float;
var attackerHeading : Float;
var victimToAttackerAngle : Float;
npc = GetNPC();
if (checkRotation){
victimHeading = npc.GetHeading();
attackerHeading = npc.GetTarget().GetHeading();
victimToAttackerAngle = AngleDistance(attackerHeading, v
ictimHeading);
if (victimToAttackerAngle <= -30 || victimToAttackerAngl
e >= 30){
npc.SetBehaviorVariable('DodgeDirection', 0, /*
NOP */);
}
if (victimToAttackerAngle <= -60 || victimToAttackerAngl
e >= -30){
npc.SetBehaviorVariable('DodgeDirection', 2, /*
NOP */);
}
if (victimToAttackerAngle <= 60 || victimToAttackerAngle
>= 30){
npc.SetBehaviorVariable('DodgeDirection', 1, /*
NOP */);
}
}
return super.OnActivate();
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
return super.OnGameplayEvent(eventName);
/* NOP */;
}
}
class CBTTaskJumpBackDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var checkRotation : Bool;
public editable var chance : Int32;
public editable var distance : Float;
}
class CBTTaskKill extends IBehTreeTask{
public var actor : CActor;
public var owner : CActor;
public var self : Bool;
public var target : Bool;

public
public
public
public
public
public
public
public

var player : Bool;


var onDamageTaken : Bool;
var onAardHit : Bool;
var onIgniHit : Bool;
var onAxiiHit : Bool;
var onActivate : Bool;
var onDeactivate : Bool;
function OnActivate() : EBTNodeStatus{
if (onActivate){
Execute();
}
return 0;
/* NOP */;

}
public function OnDeactivate(){
if (onDeactivate){
Execute();
}
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (onAardHit && eventName == 'AardHitReceived'){
Execute();
return true;
}
if (onIgniHit && eventName == 'IgniHitReceived'){
Execute();
return true;
}
if (onIgniHit && eventName == 'AxiiHitReceived'){
Execute();
return true;
}
if (onDamageTaken && eventName == 'DamageTaken'){
Execute();
return true;
}
return false;
/* NOP */;
}
public function Execute(){
actor = GetCombatTarget();
owner = GetActor();
if (target && actor.IsAlive()){
actor.Kill(/* NOP */, /* NOP */, /* NOP */);
}
if (player && thePlayer.IsAlive()){
thePlayer.Kill(/* NOP */, /* NOP */, /* NOP */);
}
if (self && owner.IsAlive()){
owner.Kill(/* NOP */, /* NOP */, /* NOP */);
}
/* NOP */;
}
}
class CBTTaskKillDef extends IBehTreeTaskDefinition{
public editable var onActivate : Bool;
public editable var onDeactivate : Bool;
public editable var target : Bool;

public
public
public
public
public
public

editable
editable
editable
editable
editable
editable

var
var
var
var
var
var

player : Bool;
self : Bool;
onAardHit : Bool;
onIgniHit : Bool;
onAxiiHit : Bool;
onDamageTaken : Bool;

}
abstract class CBTTaskCollisionAttackDef extends CBTTaskAttackDef{
}
abstract class
public
public
public
public
}

CBTTaskMagicAttackDef extends CBTTaskCollisionAttackDef{


editable var dodgeable : Bool;
editable var effectName : CName;
editable var fxDummyEntityTag : CName;
editable var dummyEntityEffectName : CName;

class CBTTaskMagicMeleeAttackDef extends CBTTaskMagicAttackDef{


public editable inlined var resourceName : CBehTreeValCName;
}
class CBTTaskMagicRangeAttack extends CBTTaskMagicAttack{
public function PerformMagicAttack(){
var component : CComponent;
var target : CNode;
target = GetCombatTarget();
if (!target){
target = GetActionTarget();
} else {
component = (CActor)target.GetComponent('torso3effect');
}
if (component){
GetActor().PlayEffect(effectName, component);
} else if (target){
GetActor().PlayEffect(effectName, target);
}
GetActor().OnCollisionFromItem((CActor)target, /* NOP */);
/* NOP */;
}
public function NewCurrentAttackData(attackData : CPreAttackEventData){
}
}
class CBTTaskMagicRangeAttackDef extends CBTTaskMagicAttackDef{
}
class CBTTaskMagicFXAttack extends CBTTaskMagicAttack{
public var resourceName : CName;
private var effectEntityTemplate : CEntityTemplate;
private var dealDmgOnDeactivate : Bool;
private var couldntLoadResource : Bool;
public function IsAvailable() : Bool{
return !couldntLoadResource;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
effectEntityTemplate = (CEntityTemplate)LoadResourceAsync(resour
ceName, /* NOP */);
if (!effectEntityTemplate){

couldntLoadResource = true;
return 1;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
if (dealDmgOnDeactivate){
GetActor().OnCollisionFromItem(GetCombatTarget(), /* NOP
*/);
dealDmgOnDeactivate = false;
}
super.OnDeactivate();
/* NOP */;
}
public function PerformMagicAttack(){
dealDmgOnDeactivate = false;
GetActor().OnCollisionFromItem(GetCombatTarget(), /* NOP */);
/* NOP */;
}
public function NewCurrentAttackData(attackData : CPreAttackEventData){
SpawnEffect(attackData);
dealDmgOnDeactivate = true;
/* NOP */;
}
public function SpawnEffect(attackData : CPreAttackEventData) : Bool{
var entity : CEntity;
var pos : Vector;
var rot : EulerAngles;
if (effectName){
GetEffectPositionAndRotation(pos, rot);
entity = theGame.CreateEntity(effectEntityTemplate, pos,
rot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
if (entity){
entity.PlayEffect(effectName, /* NOP */);
entity.DestroyAfter(5.000000);
return true;
}
}
return false;
/* NOP */;
}
public function GetEffectPositionAndRotation(pos : Vector, rot : EulerAn
gles){
var target : CActor;
var owner : CActor;
target = GetCombatTarget();
owner = GetNPC();
pos = target.GetWorldPosition();
pos.Z += 0.700000;
rot = owner.GetWorldRotation();
/* NOP */;
}
}
class CBTTaskMagicFXAttackDef extends CBTTaskMagicAttackDef{
public editable var resourceName : CName;
}
class CBTTaskMagicBomb extends CBTTaskAttack{

public
public
public
public
public
public

var resourceName : CName;


var targetPos : Vector;
var targetRot : EulerAngles;
var entity : CEntity;
var entityTemplate : CEntityTemplate;
latent function Main() : EBTNodeStatus{
entityTemplate = (CEntityTemplate)LoadResourceAsync(resourceName

, /* NOP */);
if (!entityTemplate){
return 1;
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'PerformMagicAttack'){
if (useCombatTarget){
targetPos = GetCombatTarget().GetWorldPosition()
;
targetRot = GetCombatTarget().GetWorldRotation()
;
} else {
targetPos = GetActionTarget().GetWorldPosition()
;
targetRot = GetActionTarget().GetWorldRotation()
;
}
entity = theGame.CreateEntity(entityTemplate, targetPos,
targetRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return true;
}
return res;
/* NOP */;
}
}
class CBTTaskMagicBombDef extends CBTTaskAttackDef{
public editable var resourceName : CName;
}
class CBTTaskPerformParryDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var activationTimeLimitBonusHeavy : CBehTreeValFloat;
public editable var activationTimeLimitBonusLight : CBehTreeValFloat;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('ParryStart');
listenToGameplayEvents.PushBack('ParryPerform');
listenToGameplayEvents.PushBack('CounterParryPerform');
listenToGameplayEvents.PushBack('ParryStagger');
listenToGameplayEvents.PushBack('ParryEnd');
listenToGameplayEvents.PushBack('PerformAdditiveParry');
listenToGameplayEvents.PushBack('WantsToPerformDodgeAgainstHeavy
Attack');
listenToGameplayEvents.PushBack('IgniShieldUp');
listenToGameplayEvents.PushBack('IgniShieldDown');
/* NOP */;
}

}
class CBTTaskCombatStylePerformParry extends CBTTaskPerformParry{
public var parentCombatStyle : EBehaviorGraph;
public function GetActiveCombatStyle() : EBehaviorGraph{
InitializeCombatDataStorage();
if (combatDataStorage){
return combatDataStorage.GetActiveCombatStyle();
} else {
return 1;
}
/* NOP */;
}
public function OnListenedGameplayEvent(eventName : CName) : Bool{
if (IsNameValid(eventName) && parentCombatStyle != GetActiveComb
atStyle()){
return false;
}
return super.OnListenedGameplayEvent(eventName);
/* NOP */;
}
}
class CBTTaskCombatStylePerformParryDef extends CBTTaskPerformParryDef{
public editable inlined var parentCombatStyle : CBTEnumBehaviorGraph;
}
class CBTTaskPlayEventLatent extends IBehTreeTask{
public var nodeDeactivationName : CName;
public var playEventName : CName;
public var eventIsForced : Bool;
public var setVariable : Bool;
public var variableName : CName;
public var variableValue : Float;
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var eventFired : Bool;
var eventCompleted : Bool;
npc = GetNPC();
eventFired = false;
if (eventIsForced && npc.RaiseForceEvent(playEventName)){
eventFired = true;
} else if (npc.RaiseEvent(playEventName)){
eventFired = true;
} else if (setVariable && npc.SetBehaviorVariable(variableName,
variableValue, /* NOP */)){
eventFired = true;
}
if (eventFired){
Sleep(0.100000);
eventCompleted = npc.WaitForBehaviorNodeDeactivation(nod
eDeactivationName, 10.000000);
if (eventCompleted){
npc.SetBehaviorVariable(variableName, 0.000000,
/* NOP */);
return 2;
} else {
return 1;
}
} else {

return 1;
}
/* NOP */;
}
}
class CBTTaskPlayEventLatentDef extends IBehTreeTaskDefinition{
public editable var nodeDeactivationName : CName;
public editable var playEventName : CName;
public editable var eventIsForced : Bool;
public editable var setVariable : Bool;
public editable var variableName : CName;
public editable var variableValue : Float;
}
class CBTTaskProjectileAttack extends CBTTaskAttack{
public var attackRange : Float;
public var resourceName : CName;
public var projEntity : CEntityTemplate;
public var wasShot : Bool;
public var collisionGroups : array<CName>;
public var dodgeable : Bool;
public var shootOnGround : Bool;
public var useLookatTarget : Bool;
public var startPosFrontOffset : Float;
public var playFXOnShootProjectile : CName;
public var distance : Float;
private var couldntLoadResource : Bool;
protected var m_Projectiles : array<W3AdvancedProjectile>;
protected var projectile : W3AdvancedProjectile;
public function IsAvailable() : Bool{
return !couldntLoadResource;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
if (!projEntity){
projEntity = (CEntityTemplate)LoadResourceAsync(resource
Name, /* NOP */);
}
if (!projEntity){
couldntLoadResource = true;
return 1;
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
var i : Int32;
var l_projectile : W3AdvancedProjectile;
super.OnDeactivate();
if (!wasShot){
i = 0;
while (i < m_Projectiles.Size()){
l_projectile = m_Projectiles[i];
l_projectile.BreakAttachment();
l_projectile.DestroyRequest();
i += 1;
}
if (projectile){
projectile.BreakAttachment();

projectile.DestroyRequest();
}
}
m_Projectiles.Clear();
projectile = NULL;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'ShootProjectile' || animEventName == 'Thro
w'){
CreateAndShootProjectile(/* NOP */, /* NOP */);
m_Projectiles.Clear();
return true;
} else if (animEventName == 'Shoot3Projectiles'){
CreateProjectile(3);
CreateAndShootProjectile(0, 0);
CreateAndShootProjectile(GetActor().GetHeading() + 5, 1)
;
CreateAndShootProjectile(GetActor().GetHeading() - 5, 2)
;
m_Projectiles.Clear();
} else if (animEventName == 'Shoot3ProjectilesWide'){
CreateProjectile(3);
CreateAndShootProjectile(0, 0);
CreateAndShootProjectile(GetActor().GetHeading() + 15, 1
);
CreateAndShootProjectile(GetActor().GetHeading() - 15, 2
);
m_Projectiles.Clear();
} else if (animEventName == 'Shoot5Projectiles'){
CreateProjectile(5);
CreateAndShootProjectile(0, 0);
CreateAndShootProjectile(GetActor().GetHeading() + 5, 1)
;
CreateAndShootProjectile(GetActor().GetHeading() - 5, 2)
;
CreateAndShootProjectile(GetActor().GetHeading() + 10, 3
);
CreateAndShootProjectile(GetActor().GetHeading() - 10, 4
);
m_Projectiles.Clear();
} else if (animEventName == 'Shoot5ProjectilesWide'){
CreateProjectile(5);
CreateAndShootProjectile(0, 0);
CreateAndShootProjectile(GetActor().GetHeading() + 15, 1
);
CreateAndShootProjectile(GetActor().GetHeading() - 15, 2
);
CreateAndShootProjectile(GetActor().GetHeading() + 30, 3
);
CreateAndShootProjectile(GetActor().GetHeading() - 30, 4
);
m_Projectiles.Clear();
}
return res;
/* NOP */;
}

public function CreateAndShootProjectile(customHeading : Float, projecti


leIndex : Int32){
var npc : CNewNPC;
var target : CActor;
var npcPos : Vector;
var targetPos : Vector;
var combatTargetPos : Vector;
var range : Float;
var distToTarget : Float;
var i : Int32;
var l_projectile : W3AdvancedProjectile;
var l_heightFromTarget : Float;
var l_3DdistanceToTarget : Float;
var l_projectileFlightTime : Float;
npc = GetNPC();
target = GetCombatTarget();
if (m_Projectiles.Size() == 0){
CreateProjectile(1);
}
if (useCombatTarget){
combatTargetPos = GetCombatTarget().GetWorldPosition();
} else {
combatTargetPos = GetActionTarget().GetWorldPosition();
}
distToTarget = VecDistance2D(combatTargetPos, npc.GetWorldPositi
on());
range = attackRange;
l_projectile = m_Projectiles[projectileIndex];
if (useLookatTarget){
targetPos = npc.GetBehaviorVectorVariable('lookAtTarget'
);
} else if (customHeading){
targetPos = l_projectile.GetWorldPosition() + VecFromHea
ding(customHeading) * distToTarget;
targetPos.Z = combatTargetPos.Z;
} else {
targetPos = l_projectile.GetWorldPosition() + npc.GetHea
dingVector() * distToTarget;
targetPos.Z = combatTargetPos.Z;
}
if (!shootOnGround){
targetPos.Z = combatTargetPos.Z + 1.500000;
}
Clamp(projectileIndex, 0, m_Projectiles.Size() - 1);
l_projectile.ShootProjectileAtPosition(l_projectile.projAngle, l
_projectile.projSpeed, targetPos, range, collisionGroups);
if (IsNameValid(playFXOnShootProjectile) && !l_projectile.IsEffe
ctActive(playFXOnShootProjectile, /* NOP */)){
l_projectile.PlayEffect(playFXOnShootProjectile, /* NOP
*/);
}
if (dodgeable){
l_3DdistanceToTarget = VecDistance(npc.GetWorldPosition(
), target.GetWorldPosition());
l_projectileFlightTime = l_3DdistanceToTarget / l_projec
tile.projSpeed;
target.SignalGameplayEventParamFloat('Time2DodgeProjecti
le', l_projectileFlightTime);
}
wasShot = true;

/* NOP */;
}
public function CreateProjectile(_Quantity : Int32){
var l_npc : CNewNPC;
var l_projRot : EulerAngles;
var l_projPos : Vector;
var l_projectile : W3AdvancedProjectile;
var i : Int32;
l_npc = GetNPC();
if (m_Projectiles.Size() > 0){
return;
}
i = 0;
while (i < _Quantity){
l_projPos = GetProjectileStartPosition();
l_projRot = l_npc.GetWorldRotation();
l_projectile = (W3AdvancedProjectile)theGame.CreateEntit
y(projEntity, l_projPos, l_projRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
l_projectile.Init(l_npc);
m_Projectiles.PushBack(l_projectile);
i += 1;
}
if (_Quantity == 0){
l_projPos = GetProjectileStartPosition();
l_projRot = l_npc.GetWorldRotation();
l_projectile = (W3AdvancedProjectile)theGame.CreateEntit
y(projEntity, l_projPos, l_projRot, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
l_projectile.Init(l_npc);
projectile = l_projectile;
}
wasShot = false;
/* NOP */;
}
public function Initialize(){
collisionGroups.PushBack('Ragdoll');
collisionGroups.PushBack('Terrain');
collisionGroups.PushBack('Static');
collisionGroups.PushBack('Water');
/* NOP */;
}
protected function GetProjectileStartPosition() : Vector{
var slotWorldPos : Vector;
var slotMatrix : Matrix;
if (GetNPC().CalcEntitySlotMatrix('projectile_origin', slotMatri
x)){
slotWorldPos = MatrixGetTranslation(slotMatrix);
} else {
slotWorldPos = GetNPC().GetWorldPosition();
slotWorldPos.Z += 1.500000;
if (startPosFrontOffset > 0.010000){
slotWorldPos += GetNPC().GetHeadingVector() * st
artPosFrontOffset;
}
}
return slotWorldPos;
/* NOP */;
}
}

class CBTTaskProjectileAttackDef extends CBTTaskAttackDef{


public editable var attackRange : CBehTreeValFloat;
public editable var resourceName : CName;
public editable var parametrizedResourceName : CBehTreeValCName;
public editable var dodgeable : Bool;
public editable var shootOnGround : Bool;
public editable var useLookatTarget : Bool;
public editable var startPosFrontOffset : Float;
public editable var playFXOnShootProjectile : CName;
public var projEntity : CEntityTemplate;
public function Initialize(){
SetValFloat(attackRange, 10.000000);
/* NOP */;
}
public function OnSpawn(task : IBehTreeTask){
var thisTask : CBTTaskProjectileAttack;
thisTask = (CBTTaskProjectileAttack)task;
if (IsNameValid(GetValCName(parametrizedResourceName))){
resourceName = GetValCName(parametrizedResourceName);
}
if (projEntity){
thisTask.projEntity = projEntity;
}
super.OnSpawn(task);
/* NOP */;
}
}
class CBTTaskProjectileAttackWithPrepare extends CBTTaskProjectileAttack{
public var boneName : CName;
public var rawTarget : Bool;
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'Prepare'){
CreateProjectile(/* NOP */);
if (boneName){
projectile.CreateAttachment(GetActor(), boneName
, /* NOP */, /* NOP */);
}
return true;
}
return res;
/* NOP */;
}
public function CreateAndShootProjectile(customHeading : Float, projecti
leIndex : Int32){
var npc : CNewNPC;
var target : CActor;
var targetPos : Vector;
var combatTargetPos : Vector;
var normal : Vector;
var range : Float;
var distToTarget : Float;
var l_3DdistanceToTarget : Float;
var l_projectileFlightTime : Float;
npc = GetNPC();
target = GetCombatTarget();

if (!projectile){
CreateProjectile(/* NOP */);
}
projectile.BreakAttachment();
if (useCombatTarget){
combatTargetPos = GetCombatTarget().GetWorldPosition();
} else {
combatTargetPos = GetActionTarget().GetWorldPosition();
}
distToTarget = VecDistance(combatTargetPos, npc.GetWorldPosition
());
range = attackRange;
if (rawTarget){
targetPos = combatTargetPos;
} else if (useLookatTarget){
targetPos = npc.GetBehaviorVectorVariable('lookAtTarget'
);
} else if (customHeading){
targetPos = projectile.GetWorldPosition() + VecNormalize
(VecFromHeading(customHeading)) * distToTarget;
targetPos.Z = combatTargetPos.Z;
} else {
targetPos = projectile.GetWorldPosition() + VecNormalize
(npc.GetHeadingVector()) * distToTarget;
targetPos.Z = combatTargetPos.Z;
}
if (!shootOnGround){
targetPos.Z = combatTargetPos.Z + 1.500000;
}
projectile.ShootProjectileAtPosition(projectile.projAngle, proje
ctile.projSpeed, targetPos, range, collisionGroups);
if (IsNameValid(playFXOnShootProjectile) && !projectile.IsEffect
Active(playFXOnShootProjectile, /* NOP */)){
projectile.PlayEffect(playFXOnShootProjectile, /* NOP */
);
}
if (dodgeable){
l_3DdistanceToTarget = VecDistance(npc.GetWorldPosition(
), target.GetWorldPosition());
l_projectileFlightTime = l_3DdistanceToTarget / projecti
le.projSpeed;
target.SignalGameplayEventParamFloat('Time2DodgeProjecti
le', l_projectileFlightTime);
}
wasShot = true;
/* NOP */;
}
}
class CBTTaskProjectileAttackWithPrepareDef extends CBTTaskProjectileAttackDef{
public editable var boneName : CName;
public editable var rawTarget : Bool;
}
class CBTTaskReactionDef extends IBehTreeTaskDefinition{
public editable var counterChance : Int32;
public editable var dodgeChanceAttacks : Int32;
public editable var dodgeChanceAard : Int32;
public editable var dodgeChanceIgni : Int32;
public editable var dodgeChanceBomb : Int32;

public editable var dodgeChanceProjectile : Int32;


public editable var reactionDelay : Float;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('Time2Dodge');
/* NOP */;
}
}
class CBehTreeTaskRequiredItems extends IBehTreeTask{
public var LeftItemType : CName;
public var RightItemType : CName;
public var chooseSilverIfPossible : Bool;
public var destroyProjectileOnDeactivate : Bool;
private var storageHandler : CAIStorageHandler;
protected var combatDataStorage : CHumanAICombatStorage;
private var processLeftItem : Bool;
private var processRightItem : Bool;
private var requiredItems : Bool;
private var takeBowArrow : Bool;
private var takeBolt : Bool;
private var projResourceName : String;
private var projEntity : CEntityTemplate;
private var bolt : W3AdvancedProjectile;
public function IsAvailable() : Bool{
if (chooseSilverIfPossible && RightItemType == 'steelsword' || R
ightItemType == 'silversword'){
if (WitcherRequiredItems()){
return true;
}
}
return RequiredItems();
/* NOP */;
}
private function RequiredItems() : Bool{
var res : Bool;
var itemID : SItemUniqueId;
var i : Int32;
var items : array<SItemUniqueId>;
var inventory : CInventoryComponent;
inventory = GetNPC().GetInventory();
res = true;
processLeftItem = false;
processRightItem = false;
if (LeftItemType != 'None' && LeftItemType != 'Any'){
processLeftItem = true;
items = inventory.GetItemsByCategory(LeftItemType);
if (items.Size() == 0){
items = inventory.GetItemsByTag(LeftItemType);
}
if (items.Size() == 0){
res = false;
LogQuest("Cannot enter combat style. No " + Left
ItemType + " found in l_weapon");
} else {
i = 0;
while (i < items.Size()){
if (inventory.IsItemHeld(items[i])){
processLeftItem = false;
}

i += 1;
}
}
} else if (LeftItemType != 'Any'){
itemID = inventory.GetItemFromSlot('l_weapon');
if (inventory.IsIdValid(itemID) && inventory.GetItemCate
gory(itemID) != LeftItemType){
processLeftItem = true;
}
}
if (RightItemType != 'None' && RightItemType != 'Any'){
processRightItem = true;
items = inventory.GetItemsByCategory(RightItemType);
if (items.Size() == 0){
items = inventory.GetItemsByTag(RightItemType);
}
if (items.Size() == 0){
res = false;
LogQuest("Cannot enter combat style. No " + Righ
tItemType + " found in r_weapon");
} else {
i = 0;
while (i < items.Size()){
if (inventory.IsItemHeld(items[i])){
processRightItem = false;
}
i += 1;
}
}
} else if (RightItemType != 'Any'){
itemID = inventory.GetItemFromSlot('r_weapon');
if (inventory.IsIdValid(itemID) && inventory.GetItemCate
gory(itemID) != RightItemType){
processRightItem = true;
}
}
requiredItems = true;
return res;
/* NOP */;
}
public function WitcherRequiredItems() : Bool{
if (GetCombatTarget().UsesEssence()){
RightItemType = 'silversword';
if (RequiredItems()){
GetActor().SetBehaviorVariable('SelectedWeapon',
1, true);
return true;
}
}
RightItemType = 'steelsword';
GetActor().SetBehaviorVariable('SelectedWeapon', 0, true);
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
if (!requiredItems){
if (!RequiredItems()){
return 1;
}
}

if (LeftItemType == 'bow'){
projResourceName = "bow_arrow";
} else if (RightItemType == 'crossbow'){
projResourceName = "crossbow_bolt";
}
InitializeCombatDataStorage();
if (processLeftItem || processRightItem){
combatDataStorage.SetProcessingItems(true);
}
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var npc : CNewNPC;
var notWitcherSword : Bool;
var wasWaitingForItems : Bool;
npc = GetNPC();
combatDataStorage.SetProcessingItems(true);
if (projResourceName != "" && !projEntity){
projEntity = (CEntityTemplate)LoadResourceAsync(projReso
urceName, /* NOP */);
}
wasWaitingForItems = GetActor().WaitForFinishedAllLatentItemActi
ons();
if (wasWaitingForItems){
if (chooseSilverIfPossible && RightItemType == 'steelswo
rd' || RightItemType == 'silversword'){
WitcherRequiredItems();
} else {
RequiredItems();
}
}
if (processLeftItem || processRightItem){
if (combatDataStorage.GetActiveCombatStyle() == 8){
GetActor().SetBehaviorVariable('SelectedWeapon',
2, true);
notWitcherSword = true;
}
if (notWitcherSword || RightItemType != 'steelsword' ||
RightItemType != 'silversword'){
if (processLeftItem && processRightItem){
npc.SetRequiredItems('None', 'None');
} else if (processLeftItem){
npc.SetRequiredItems('None', 'Any');
} else if (processRightItem){
npc.SetRequiredItems('Any', 'None');
}
npc.ProcessRequiredItems(/* NOP */);
}
if (LeftItemType == 'shield'){
combatDataStorage.SetProcessingRequiresIdle(true
);
npc.SetRequiredItems(LeftItemType, 'Any');
npc.ProcessRequiredItems(/* NOP */);
npc.OnProcessRequiredItemsFinish();
combatDataStorage.SetProcessingRequiresIdle(fals
e);
}
npc.SetRequiredItems(LeftItemType, RightItemType);
npc.ProcessRequiredItems(/* NOP */);

npc.OnProcessRequiredItemsFinish();
} else if (LeftItemType == 'bow'){
TakeBowArrow();
takeBowArrow = false;
}
combatDataStorage.SetProcessingItems(false);
if (LeftItemType == 'bow'){
while (isActive){
SleepOneFrame();
if (takeBowArrow){
TakeBowArrow();
takeBowArrow = false;
}
}
} else if (RightItemType == 'crossbow'){
while (isActive){
SleepOneFrame();
if (takeBolt){
bolt = PutBoltInHand();
takeBolt = false;
}
}
}
return 0;
/* NOP */;
}
public function OnDeactivate(){
combatDataStorage.SetProcessingItems(false);
requiredItems = false;
processLeftItem = false;
processRightItem = false;
if (destroyProjectileOnDeactivate){
combatDataStorage.DetachAndDestroyProjectile();
}
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'TakeBowArrow'){
takeBowArrow = true;
} else if (animEventName == 'DestroyArrow'){
combatDataStorage.DetachAndDestroyProjectile();
} else if (animEventName == 'PutBoltInHand'){
takeBolt = true;
} else if (animEventName == 'PutBoltInCrossbow'){
if (bolt){
bolt.BreakAttachment();
bolt.CreateAttachment(GetActor().GetInventory().
GetItemEntityUnsafe(GetActor().GetInventory().GetItemFromSlot('r_weapon')), 'bol
t_slot', /* NOP */, /* NOP */);
}
} else if (animEventName == 'ReloadCrossbow'){
combatDataStorage.SetProjectile(bolt);
} else if (animEventName == 'DestroyProjectile'){
combatDataStorage.SetProjectile(NULL);
}
return false;
/* NOP */;
}
public function PutBoltInHand() : W3AdvancedProjectile{

var bolt : W3AdvancedProjectile;


bolt = (W3ArrowProjectile)theGame.CreateEntity(projEntity, GetAc
tor().GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */,
/* NOP */);
bolt.CreateAttachment(GetActor(), 'l_weapon', /* NOP */, /* NOP
*/);
return bolt;
/* NOP */;
}
public function TakeBowArrow(){
var arrowRot : EulerAngles;
var arrowPos : Vector;
var arrow : W3ArrowProjectile;
var inv : CInventoryComponent;
if (!projEntity){
return;
}
if (combatDataStorage.GetProjectile()){
return;
}
arrow = (W3ArrowProjectile)theGame.CreateEntity(projEntity, GetA
ctor().GetWorldPosition(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */
, /* NOP */);
if (LeftItemType == 'bow'){
arrow.CreateAttachment(GetActor(), 'r_weapon_arrow', /*
NOP */, /* NOP */);
} else if (RightItemType == 'crossbow'){
inv = GetActor().GetInventory();
arrow.CreateAttachment(inv.GetItemEntityUnsafe(inv.GetIt
emFromSlot('r_weapon')), 'bolt_slot', /* NOP */, /* NOP */);
}
combatDataStorage.SetProjectile(arrow);
/* NOP */;
}
public function OnGameplayEvent(eventName : CName) : Bool{
if (eventName == 'TakeBowArrow' && LeftItemType == 'bow'){
InitializeCombatDataStorage();
if (!combatDataStorage.GetProjectile()){
takeBowArrow = true;
}
}
return false;
/* NOP */;
}
public function InitializeCombatDataStorage(){
if (!combatDataStorage){
storageHandler = InitializeCombatStorage();
combatDataStorage = (CHumanAICombatStorage)storageHandle
r.Get();
}
/* NOP */;
}
}
class CBehTreeTaskRequiredItemsDef extends IBehTreeTaskDefinition{
public editable var LeftItemType : CBehTreeValCName;
public editable inlined var RightItemType : CBehTreeValCName;
public editable var chooseSilverIfPossible : CBehTreeValBool;
public editable var destroyProjectileOnDeactivate : Bool;
public function InitializeEvents(){

super.InitializeEvents();
listenToAnimEvents.PushBack('DestroyArrow');
listenToAnimEvents.PushBack('TakeBowArrow');
/* NOP */;
}
}
class CBehTreeTaskSheathWeaponsDef extends IBehTreeTaskDefinition{
}
class CBehTreeTaskConditionalSheathWeaponsDef extends IBehTreeTaskDefinition{
}
class BTTaskSearchTarget extends IBehTreeTask{
public var namedTarget : CName;
private var m_LastKnowPosition : Vector;
public function OnActivate() : EBTNodeStatus{
var l_npc : CNewNPC;
var l_targetPos : Vector;
var l_newPos : Vector;
var l_guardArea : CAreaComponent;
var l_target : CNode;
var l_groundZ : Float;
l_npc = GetNPC();
l_guardArea = l_npc.GetGuardArea();
l_target = GetNamedTarget(namedTarget);
m_LastKnowPosition = l_target.GetWorldPosition();
if (l_guardArea){
if (!l_guardArea.TestPointOverlap(m_LastKnowPosition)){
l_targetPos = l_npc.GetWorldPosition() + VecRand
2D() * 10;
if (theGame.GetWorld().NavigationFindSafeSpot(l_
targetPos, 3, 10, l_newPos)){
l_targetPos = l_newPos;
} else {
return 1;
}
} else {
l_targetPos = m_LastKnowPosition;
}
}
SetCustomTarget(l_targetPos, RandRangeF(180, /* NOP */));
return 0;
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
var l_targetPos : Vector;
var heading : Float;
while (true){
GetCustomTarget(l_targetPos, heading);
GetNPC().GetVisualDebug().AddArrow('toCustomTarget', Get
NPC().GetWorldPosition() + Vector(0, 0, 1), l_targetPos, 1, 0.500000, 0.800000,
true, Color(205, 156, 89), /* NOP */, -1);
SleepOneFrame();
}
return 0;
/* NOP */;
}
}

class BTTaskSearchTargetDef extends IBehTreeTaskDefinition{


private editable var namedTarget : CName;
}
class BTTaskSetAdditiveHitFlag extends IBehTreeTask{
public var onDeactivate : Bool;
public var onAnimEvent : CName;
public var flag : Bool;
public var additiveHits : Bool;
public var additiveCriticalStates : Bool;
public var overrideOnly : Bool;
public var playNormalHitOnCritical : Bool;
private var m_valueOnActivate : Bool;
private var m_csValueOnActivate : Bool;
private var m_waitingForEventEnd : Bool;
public function OnActivate() : EBTNodeStatus{
var npc : CNewNPC;
npc = GetNPC();
m_valueOnActivate = npc.UseAdditiveHit();
m_csValueOnActivate = npc.UseAdditiveCriticalState();
if (!onDeactivate){
Execute(flag, flag);
}
return 0;
/* NOP */;
}
private function OnDeactivate(){
if (onDeactivate){
Execute(flag, flag);
}
if (overrideOnly){
Execute(m_valueOnActivate, m_csValueOnActivate);
}
if (m_waitingForEventEnd){
Execute(!flag, !flag);
}
m_waitingForEventEnd = false;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == onAnimEvent && animEventType != 3 && animEv
entType != 4){
Execute(flag, flag);
m_waitingForEventEnd = true;
} else if (animEventName == onAnimEvent && animEventType == 3){
Execute(!flag, !flag);
m_waitingForEventEnd = false;
}
return true;
/* NOP */;
}
private function Execute(_Flag : Bool, _criticalStateFlag : Bool){
var npc : CNewNPC;
npc = GetNPC();
if (additiveHits){
npc.SetUseAdditiveHit(_Flag, playNormalHitOnCritical, /*
NOP */);
}
if (additiveCriticalStates){

npc.SetUseAdditiveCriticalStateAnim(_criticalStateFlag);
}
/* NOP */;
}
}
class BTTaskSetAdditiveHitFlagDef extends IBehTreeTaskDefinition{
public editable var onDeactivate : Bool;
public editable var onAnimEvent : CName;
public editable var flag : Bool;
public editable var additiveHits : Bool;
public editable var additiveCriticalStates : Bool;
public editable var overrideOnly : Bool;
public editable var playNormalHitOnCritical : Bool;
}
class CBTTaskShootDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var useCombatTarget : Bool;
public editable var attackRange : CBehTreeValFloat;
public editable var dodgeable : Bool;
public editable var setArrowOnFire : CBehTreeValBool;
public function Initialize(){
SetValFloat(attackRange, 10.000000);
/* NOP */;
}
}
class W3SummonerComponent extends CScriptedComponent{
public editable var forgetDeadEntities : Bool;
private var m_SummonedEntities : array<CEntity>;
public function AddEntity(_EntityToAdd : CEntity){
var summonedEntityComponent : W3SummonedEntityComponent;
if (!m_SummonedEntities.Contains(_EntityToAdd) && _EntityToAdd){
m_SummonedEntities.PushBack(_EntityToAdd);
summonedEntityComponent = (W3SummonedEntityComponent)_En
tityToAdd.GetComponentByClassName('W3SummonedEntityComponent');
if (summonedEntityComponent){
summonedEntityComponent.Init((CActor)GetEntity()
);
}
}
/* NOP */;
}
public function RemoveEntity(_EntityToRemove : CEntity){
m_SummonedEntities.Remove(_EntityToRemove);
/* NOP */;
}
public function GetSummonedEntities() : array<CEntity>{
UpdateArray();
return m_SummonedEntities;
/* NOP */;
}
public function GetNumberOfSummonedEntities() : Int32{
UpdateArray();
return m_SummonedEntities.Size();
/* NOP */;
}
private function UpdateArray(){
var i : Int32;
var actor : CActor;

i = m_SummonedEntities.Size() - 1;
while (i >= 0){
actor = (CActor)m_SummonedEntities[i];
if (!m_SummonedEntities[i]){
m_SummonedEntities.EraseFast(i);
} else if (forgetDeadEntities && actor && !actor.IsAlive
()){
m_SummonedEntities.EraseFast(i);
}
i -= 1;
}
/* NOP */;
}
public function OnDeath(){
var i : Int32;
var summonedCmp : W3SummonedEntityComponent;
i = 0;
while (i < m_SummonedEntities.Size()){
summonedCmp = (W3SummonedEntityComponent)m_SummonedEntit
ies[i].GetComponentByClassName('W3SummonedEntityComponent');
if (summonedCmp){
summonedCmp.OnSummonerDeath();
}
i += 1;
}
/* NOP */;
}
}
class CBTTaskSpawnEntityAttackDef extends CBTTaskAttackDef{
public editable var ressourceName : CBehTreeValCName;
public editable var spawnAnimEventName : CName;
public editable var entityTemplate : CEntityTemplate;
public editable var offsetVector : Vector;
public editable var completeAfterSpawn : Bool;
}
class CBTTaskSpawnMultipleEntitiesAttackDef extends CBTTaskSpawnEntityAttackDef{
public editable var numberToSpawn : Int32;
public editable var numberOfCircles : Int32;
public editable var spawnPositionPattern : ESpawnPositionPattern;
public editable var randomnessInCircles : Float;
public editable var useRandomSpaceBetweenSpawns : Bool;
public editable var spawnRadiusMin : Float;
public editable var spawnRadiusMax : Float;
public editable var spawnEntityRadius : Float;
public editable var spawnRotation : ESpawnRotation;
public editable var leaveOpenSpaceForDodge : Bool;
public editable var delayBetweenSpawn : Float;
public editable var spawnInRandomOrder : Bool;
public editable var spawnOnGround : Bool;
}
class CBTTaskSpawnMultipleEntities3StateAttack extends CBTTaskSpawnMultipleEntit
iesAttack{
public var delayActivationTime : Float;
public var loopTime : Float;
public var endTime : Float;
public var localTime : Float;
public var spawnInterval : Float;

public var decreaseLoopTimePerFailedCreateEntity : Float;


public var spawnAdditionalEntityOnTargetPos : Bool;
public function OnActivate() : EBTNodeStatus{
GetNPC().SetBehaviorVariable('AttackEnd', 0, true);
return super.OnActivate();
/* NOP */;
}
public latent function Main() : EBTNodeStatus{
while (!m_shouldSpawn){
SleepOneFrame();
}
if (delayActivationTime > 0){
Sleep(delayActivationTime);
}
localTime = GetLocalTime();
endTime = localTime + loopTime;
while (GetLocalTime() <= endTime && !m_canComplete){
LatentSpawnEntity();
SleepOneFrame();
if (spawnInterval > 0){
Sleep(spawnInterval);
}
}
GetNPC().SetBehaviorVariable('AttackEnd', 1, true);
if (m_entitiesSpawned >= numberToSpawn){
return 2;
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == 'AllowBlend' && animEventType == 1){
GetNPC().SetBehaviorVariable('AttackEnd', 1, true);
m_canComplete = true;
}
return super.OnAnimEvent(animEventName, animEventType, animInfo)
;
/* NOP */;
}
public function SpawnEntity(){
m_shouldSpawn = true;
/* NOP */;
}
public latent function LatentSpawnEntity(){
var i : Int32;
var l_spawnCenter : Vector;
var l_spawnPos : Vector;
var l_entity : CEntity;
var l_damageAreaEntity : CDamageAreaEntity;
var l_coneAngle : Float;
var l_coneWidth : Float;
var l_randomVector : Vector;
var l_normal : Vector;
var l_rotation : EulerAngles;
var l_npc : CNewNPC;
var l_npcPos : Vector;
var l_targetPos : Vector;
var l_dodgePos : Vector;
var l_currentCircle : Float;

var l_numPerCircle : Int32;


var l_numberInCurrentCircle : Int32;
var l_currentCone : Int32;
var l_circleRadiusMin : Float;
var l_circleRadiusMax : Float;
var l_positionArray : array<Vector>;
var l_rotationArray : array<EulerAngles>;
var l_summonedEntityComponent : W3SummonedEntityComponent;
l_npc = GetNPC();
switch(spawnPositionPattern){
case 0:
l_spawnCenter = GetCombatTarget().GetWorldPosition();
break;
case 1:
l_spawnCenter = GetNPC().GetWorldPosition();
break;
case 2:
l_spawnCenter = GetNPC().GetWorldPosition();
l_spawnCenter += GetCombatTarget().GetWorldPosition();
l_spawnCenter /= 2;
break;
}
numberOfCircles = Max(1, numberOfCircles);
l_numPerCircle = FloorF(numberToSpawn / numberOfCircles);
l_coneAngle = 360 / l_numPerCircle;
l_npcPos = l_npc.GetWorldPosition();
l_targetPos = GetCombatTarget().GetWorldPosition();
if (leaveOpenSpaceForDodge){
l_dodgePos = l_targetPos + VecRand2D() * m_dodgeDistance
;
}
l_coneWidth = 0.500000;
if (useRandomSpaceBetweenSpawns){
l_coneWidth = l_coneAngle;
}
l_positionArray.Clear();
l_rotationArray.Clear();
i = 0;
while (i < numberToSpawn){
l_circleRadiusMin = spawnRadiusMin + l_currentCircle / n
umberOfCircles * spawnRadiusMax - spawnRadiusMin;
l_circleRadiusMax = spawnRadiusMax - l_currentCircle / n
umberOfCircles * spawnRadiusMax - spawnRadiusMin;
if (numberOfCircles > 1){
l_circleRadiusMax = MinF(l_circleRadiusMin + ran
domnessInCircles, spawnRadiusMax);
}
l_randomVector = VecConeRand(l_currentCone * l_coneAngle
, l_coneWidth, l_circleRadiusMin, l_circleRadiusMax);
l_spawnPos = l_spawnCenter + l_randomVector + offsetVect
or;
if (leaveOpenSpaceForDodge && VecDistance(l_spawnPos, l_
dodgePos) < m_dodgeSafeAreaRadius){
m_entitiesSpawned += 1;
} else {
if (spawnOnGround){
theGame.GetWorld().StaticTrace(l_spawnPo
s + Vector(0, 0, 5), l_spawnPos - Vector(0, 0, 5), l_spawnPos, l_normal, /* NOP
*/);
}

switch(spawnRotation){
case 0:
l_rotation = VecToRotation(l_spawnPos l_npc.GetWorldPosition());
break;
case 1:
l_rotation = VecToRotation(l_npc.GetWorl
dPosition() - l_spawnPos);
break;
case 2:
l_rotation = VecToRotation(l_targetPos l_spawnPos);
break;
case 3:
l_rotation = GetActor().GetWorldRotation
();
break;
case 4:
l_rotation = VecToRotation(l_npc.GetWorl
dForward() * -1);
break;
}
l_positionArray.PushBack(l_spawnPos);
l_rotationArray.PushBack(l_rotation);
l_currentCone += 1;
l_numberInCurrentCircle += 1;
if (l_numberInCurrentCircle >= l_numPerCircle){
l_numberInCurrentCircle = 0;
l_currentCircle += 1;
l_currentCone = 0;
}
}
i += 1;
}
if (delayBetweenSpawn <= 0){
spawnInRandomOrder = false;
}
if (spawnAdditionalEntityOnTargetPos){
l_entity = CreateEntity(l_targetPos, l_rotation);
}
while (l_positionArray.Size() > 0){
i = 0;
if (spawnInRandomOrder){
i = RandRange(l_positionArray.Size(), 0);
}
l_spawnPos = l_positionArray[i];
l_rotation = l_rotationArray[i];
l_positionArray.Erase(i);
l_rotationArray.Erase(i);
l_entity = CreateEntity(l_spawnPos, l_rotation);
l_summonedEntityComponent = (W3SummonedEntityComponent)l
_entity.GetComponentByClassName('W3SummonedEntityComponent');
if (l_summonedEntityComponent){
l_summonedEntityComponent.Init(l_npc);
}
l_damageAreaEntity = (CDamageAreaEntity)l_entity;
if (l_damageAreaEntity){
l_damageAreaEntity.owner = GetActor();
}
m_entitiesSpawned += 1;

if (delayBetweenSpawn > 0){


Sleep(delayBetweenSpawn);
}
}
/* NOP */;
}
public function CreateEntity(_SpawnPos : Vector, _Rotation : EulerAngles
) : CEntity{
var l_entity : CEntity;
var l_newPos : Vector;
if (!theGame.GetWorld().NavigationFindSafeSpot(_SpawnPos, spawnE
ntityRadius, spawnEntityRadius * 3, l_newPos)){
if (decreaseLoopTimePerFailedCreateEntity > 0){
loopTime -= decreaseLoopTimePerFailedCreateEntit
y;
endTime = localTime + loopTime;
}
/* NOP */;
return NULL;
}
l_entity = theGame.CreateEntity(entityTemplate, l_newPos, _Rotat
ion, /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
return l_entity;
/* NOP */;
}
public function OnDeactivate(){
GetNPC().SetBehaviorVariable('AttackEnd', 1, true);
m_shouldSpawn = false;
m_canComplete = false;
/* NOP */;
}
}
class CBTTaskSpawnMultipleEntities3StateAttackDef extends CBTTaskSpawnMultipleEn
titiesAttackDef{
public editable var delayActivationTime : Float;
public editable var loopTime : Float;
public editable var spawnInterval : Float;
public editable var decreaseLoopTimePerFailedCreateEntity : Float;
public editable var spawnAdditionalEntityOnTargetPos : Bool;
}
class CBTTaskSpawnMultipleProjectilesAttack extends CBTTaskSpawnMultipleEntities
Attack{
public var projectileAngle : Float;
public var projectileAngleRandomness : Float;
public var projectileSpeed : Float;
public var projectileSpeedRandomness : Float;
public var dodgeable : Bool;
public function CreateEntity(_SpawnPos : Vector, _Rotation : EulerAngles
) : CEntity{
var l_target : CActor;
var l_projectile : W3AdvancedProjectile;
var l_angle : Float;
var l_velocity : Float;
var l_distanceToTarget : Float;
var l_projectileFlightTime : Float;
var l_targetPos : Vector;
l_target = GetCombatTarget();
l_angle = 0;

l_targetPos = GetCombatTarget().GetWorldPosition();
l_velocity = projectileSpeed + RandRangeF(projectileSpeedRandomn
ess, /* NOP */);
l_angle = projectileAngle + RandRangeF(projectileAngleRandomness
, /* NOP */);
l_projectile = (W3AdvancedProjectile)super.CreateEntity(_SpawnPo
s, _Rotation);
if (l_projectile){
l_projectile.ShootProjectileAtPosition(projectileAngle,
l_velocity, l_targetPos, /* NOP */, /* NOP */);
}
if (dodgeable){
l_distanceToTarget = VecDistance(GetNPC().GetWorldPositi
on(), l_target.GetWorldPosition());
l_projectileFlightTime = l_distanceToTarget / l_velocity
;
l_target.SignalGameplayEventParamFloat('Time2DodgeProjec
tile', l_projectileFlightTime);
}
return l_projectile;
/* NOP */;
}
}
class CBTTaskSpawnMultipleProjectilesAttackDef extends CBTTaskSpawnMultipleEntit
iesAttackDef{
public editable var projectileAngle : Float;
public editable var projectileAngleRandomness : Float;
public editable var projectileSpeed : Float;
public editable var projectileSpeedRandomness : Float;
public editable var dodgeable : Bool;
}
class CBTTaskSpawnObject extends IBehTreeTask{
public var useThisTask : Bool;
public var objectTemplate : CEntityTemplate;
public var useAnimEvent : Bool;
public var spawnAnimEventName : CName;
public var useCombatTarget : Bool;
public var spawnNodeTag : CName;
public var spawnAtBonePosition : Bool;
public var boneName : CName;
public var spawnOnGround : Bool;
public var groundZCheck : Float;
public var spawnPositionOffset : Vector;
public var offsetInLocalSpace : Bool;
public var randomizeOffset : Bool;
public var spawnNodes : array<CNode>;
public var i : Int32;
public var size : Int32;
public var npc : CNewNPC;
public function InitSpawnObject(){
var spawnNode : CNode;
npc = GetNPC();
if (npc){
if (useCombatTarget){
spawnNode = GetCombatTarget();
} else {
spawnNode = npc;
}

if (spawnNode){
spawnNodes.Clear();
spawnNodes.PushBack(spawnNode);
}
}
/* NOP */;
}
public function IsAvailable() : Bool{
var spawnEntity : CEntity;
var boneIndex : Int32;
var isAvailable : Bool;
isAvailable = useThisTask;
if (!objectTemplate){
/* NOP */;
isAvailable = false;
}
return isAvailable;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var spawnEntity : CEntity;
var boneIndex : Int32;
var isAvailable : Bool;
InitSpawnObject();
if (spawnNodes.Size() == 0){
/* NOP */;
isAvailable = false;
}
if (spawnAtBonePosition){
size = spawnNodes.Size();
i = 0;
while (i < size){
spawnEntity = (CEntity)spawnNodes[i];
if (!spawnEntity){
/* NOP */;
isAvailable = false;
} else {
boneIndex = spawnEntity.GetBoneIndex(bon
eName);
if (boneIndex == -1){
/* NOP */;
isAvailable = false;
}
}
i += 1;
}
}
if (!useAnimEvent){
SpawnObject();
}
return 0;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
if (animEventName == spawnAnimEventName && useAnimEvent){
SpawnObject();
return true;
}
return false;

/* NOP */;
}
public function OnDeactivate(){
}
public function FindPositionOnGround(position : Vector){
var minZPosition : Vector;
var maxZPosition : Vector;
var groundPosition : Vector;
var normal : Vector;
groundPosition = position;
minZPosition = position;
minZPosition.Z -= groundZCheck;
maxZPosition = position;
maxZPosition.Z += groundZCheck;
if (theGame.GetWorld().StaticTrace(minZPosition, maxZPosition, g
roundPosition, normal, /* NOP */)){
position = groundPosition;
}
/* NOP */;
}
public function SpawnObject(){
var spawnEntity : CEntity;
var spawnPosition : Vector;
var boneIndex : Int32;
var willSpawn : Bool;
var localToWorldMatrix : Matrix;
var spawnOffset : Vector;
willSpawn = true;
size = spawnNodes.Size();
i = 0;
while (i < size){
if (spawnAtBonePosition){
spawnEntity = (CEntity)spawnNodes[i];
boneIndex = spawnEntity.GetBoneIndex(boneName);
if (boneIndex != -1){
spawnPosition = spawnEntity.GetBoneWorld
Position(boneName);
} else {
willSpawn = false;
/* NOP */;
}
} else {
spawnPosition = spawnNodes[i].GetWorldPosition()
;
}
if (offsetInLocalSpace){
localToWorldMatrix = spawnNodes[i].GetLocalToWor
ld();
spawnOffset = spawnPosition - VecTransform(local
ToWorldMatrix, spawnPositionOffset);
spawnPosition = spawnPosition + spawnOffset;
} else {
spawnPosition += spawnPositionOffset;
}
if (spawnOnGround){
FindPositionOnGround(spawnPosition);
}
if (willSpawn){
theGame.CreateEntity(objectTemplate, spawnPositi
on, spawnNodes[i].GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */

, /* NOP */);
}
i += 1;
}
/* NOP */;
}
}
class CBTTaskSpawnObjectDef
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
public editable var
}

extends IBehTreeTaskDefinition{
useThisTask : Bool;
objectTemplate : CEntityTemplate;
useAnimEvent : Bool;
spawnAnimEventName : CName;
spawnAtBonePosition : Bool;
boneName : CName;
spawnOnGround : Bool;
groundZCheck : Float;
spawnPositionOffset : Vector;
offsetInLocalSpace : Bool;
randomizeOffset : Bool;

class CBTTaskSummonCreaturesDef extends CBTTaskPlayAnimationEventDecoratorDef{


public editable var dontResummonUntilMinionsAreDead : Bool;
public editable var preventActivationUntilMinionsAreDead : Bool;
public editable var teleportOutsidePlayerFOV : Bool;
public editable var killSummonedCreaturesOnSummonerDeath : Bool;
public editable var spawnOnAnimEventName : CName;
public editable var entityToSummonName : CName;
public editable var raiseEventOnSummon : CName;
public editable var overrideAttitude : Bool;
public editable var attitudeToPlayer : EAIAttitude;
public editable var count : Int32;
public editable var minDistance : Float;
public editable var maxDistance : Float;
public editable var spawnAnimation : EExplorationMode;
public editable var forcedSpawnAnim : Int32;
public editable var spawnTag : CName;
public editable var targetShouldBeAccessible : Bool;
public editable var spawnerShouldBeAccessible : Bool;
public editable var spawnConditionsCheckInterval : Float;
public editable var spawnConditionsChecksNumber : Int32;
public function InitializeEvents(){
super.InitializeEvents();
listenToGameplayEvents.PushBack('Death');
/* NOP */;
}
}
class CBTTaskTaunt extends CBTTaskPlayAnimationEventDecorator{
public var tauntType : ETauntType;
public var tauntDelay : Float;
public var useXMLTauntChance : Bool;
private var chance : Int32;
private var timeStamp : Float;
public function IsAvailable() : Bool{
timeStamp = combatDataStorage.GetTauntTimeStamp();
if (tauntDelay > 0 && timeStamp > 0 && timeStamp + tauntDelay >
GetLocalTime()){
return false;

}
if (useXMLTauntChance){
chance = 100 * CalculateAttributeValue(GetActor().GetAtt
ributeValue('taunt_chance', /* NOP */, /* NOP */), /* NOP */);
if (!Roll(chance)){
return false;
}
}
return true;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
GetNPC().SetBehaviorVariable('TauntType', tauntType, /* NOP */);
combatDataStorage.SetIsTaunting(true, GetLocalTime());
return super.OnActivate();
/* NOP */;
}
public function OnDeactivate(){
combatDataStorage.SetIsTaunting(false, /* NOP */);
super.OnDeactivate();
/* NOP */;
}
}
class CBTTaskTauntDef extends CBTTaskPlayAnimationEventDecoratorDef{
public editable var tauntType : ETauntType;
public editable var tauntDelay : Float;
public editable var useXMLTauntChance : Bool;
}
class CBTTaskThrowBomb extends CBTTaskAttack{
protected var thrownEntity : W3Petard;
protected var inventory : CInventoryComponent;
protected var bombs : array<SItemUniqueId>;
protected var cachedTargetPos : Vector;
public var dontUseDiwmeritium : Bool;
public var activationChance : Float;
public function IsAvailable() : Bool{
if (!InitializeBombs()){
return false;
}
if (CheckIfFriendlyIsInAoe()){
return false;
}
return Roll(activationChance);
/* NOP */;
}
public function InitializeBombs() : Bool{
var selectedBomb : SItemUniqueId;
if (!inventory){
inventory = GetActor().GetInventory();
if (!inventory){
return false;
}
}
if (bombs.Size() <= 0){
bombs = inventory.GetItemsByCategory('petard');
if (bombs.Size() <= 0){
return false;
}

}
if (!SelectProperBomb(selectedBomb)){
return false;
}
thrownEntity = (W3Petard)inventory.GetDeploymentItemEntity(selec
tedBomb, /* NOP */, /* NOP */, /* NOP */);
thrownEntity.Initialize(GetActor(), selectedBomb);
return true;
/* NOP */;
}
public function CheckIfFriendlyIsInAoe() : Bool{
var i : Int32;
var radius : Float;
var owner : CActor;
var potentialTargets : array<CActor>;
owner = GetActor();
radius = thrownEntity.GetImpactRange();
potentialTargets = GetActorsInRange(GetCombatTarget(), radius, 9
9, 'None', true);
if (potentialTargets.Contains(owner)){
potentialTargets.Remove(owner);
}
i = 0;
while (i < potentialTargets.Size()){
if (GetAttitudeBetween(owner, potentialTargets[i]) == 0)
{
return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnActivate() : EBTNodeStatus{
var target : CNode;
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
if (!thrownEntity){
InitializeBombs();
}
cachedTargetPos = target.GetWorldPosition();
return super.OnActivate();
/* NOP */;
}
public function SelectProperBomb(bomb : SItemUniqueId) : Bool{
var i : Int32;
var itemName : CName;
if (!dontUseDiwmeritium){
bomb = bombs[0];
return true;
}
i = 0;
while (i < bombs.Size()){
itemName = inventory.GetItemName(bombs[i]);
if (itemName != 'Dwimeritium Bomb 1' && itemName != 'Dwi
meritium Bomb 2' && itemName != 'Dwimeritium Bomb 3'){
bomb = bombs[i];

return true;
}
i += 1;
}
return false;
/* NOP */;
}
public function OnDeactivate(){
super.OnDeactivate();
bombs.Clear();
if (thrownEntity && !thrownEntity.WasThrown()){
thrownEntity.Destroy();
}
thrownEntity = NULL;
/* NOP */;
}
public function OnAnimEvent(animEventName : CName, animEventType : EAnim
ationEventType, animInfo : SAnimationEventAnimInfo) : Bool{
var res : Bool;
var target : CNode;
res = super.OnAnimEvent(animEventName, animEventType, animInfo);
if (animEventName == 'ProjectileAttach'){
thrownEntity.CreateAttachment(GetActor(), 'l_weapon', /*
NOP */, /* NOP */);
return true;
} else if (animEventName == 'ProjectileThrow'){
if (useCombatTarget){
target = GetCombatTarget();
} else {
target = GetActionTarget();
}
if (target){
cachedTargetPos = target.GetWorldPosition();
}
cachedTargetPos.Z += 1;
thrownEntity.ThrowProjectile(cachedTargetPos);
(CActor)target.SignalGameplayEventParamInt('Time2DodgeBo
mb', 4);
return true;
}
return res;
/* NOP */;
}
}
class W3Petard extends CThrowable{
protected editable var cameraShakeStrMin : Float;
protected editable var cameraShakeStrMax : Float;
protected editable var cameraShakeRange : Float;
protected editable var hitReactionType : EHitReactionType;
protected editable var noLoopEffectIfHitWater : Bool;
protected editable var dismemberOnKill : Bool;
protected editable var componentsEnabledOnLoop : array<CName>;
protected editable var friendlyFire : Bool;
protected editable var impactParams : SPetardParams;
protected editable var loopParams : SPetardParams;
protected editable var dodgeable : Bool;
protected editable var audioImpactName : CName;
private const var FX_TRAIL : CName;
private const var FX_CLUSTER : CName;

protected var itemName : CName;


private var targetPos : Vector;
private var isProximity : Bool;
private var isInWater : Bool;
private var isInDeepWater : Bool;
private var isStuck : Bool;
private var isCluster : Bool;
private var justPlayingFXs : array<CName>;
protected var loopDuration : Float;
protected var snapCollisionGroupNames : array<CName>;
protected var stopCollisions : Bool;
protected var previousTargets : array<CGameplayEntity>;
protected var targetsSinceLastCheck : array<CGameplayEntity>;
private var wasInTutorialTrigger : Bool;
public function OnDestroyed() : Bool{
ProcessPetardDestruction();
/* NOP */;
}
public function OnProcessThrowEvent(animEventName : CName) : Bool{
var throwPos : Vector;
var boneIndex : Int32;
var orientationTarget : EOrientationTarget;
var slideTargetActor : CActor;
if (animEventName == 'ProjectileThrow'){
if (GetOwner() == thePlayer){
if (thePlayer.GetDisplayTarget()){
throwPos = thePlayer.GetLookAtPosition()
;
} else {
orientationTarget = thePlayer.GetOrienta
tionTarget();
if (!GetOwner().HasBuff(7) && orientatio
nTarget == 3 || orientationTarget == 4){
throwPos = theCamera.GetCameraDi
rection() * 8 + GetOwner().GetWorldPosition();
} else {
throwPos = GetOwner().GetWorldFo
rward() * 8 + GetOwner().GetWorldPosition();
}
}
} else {
slideTargetActor = (CActor)GetOwner().slideTarge
t;
if (GetOwner().slideTarget && !GetOwner().HasBuf
f(7) && !slideTargetActor || slideTargetActor && GetAttitudeBetween(GetOwner(),
GetOwner().slideTarget) == 2){
boneIndex = GetOwner().slideTarget.GetBo
neIndex('pelvis');
if (boneIndex > -1){
throwPos = MatrixGetTranslation(
GetOwner().slideTarget.GetBoneWorldMatrixByIndex(boneIndex));
} else {
throwPos = GetOwner().slideTarge
t.GetWorldPosition();
}
} else {
orientationTarget = thePlayer.GetOrienta
tionTarget();
if (!GetOwner().HasBuff(7) && orientatio
nTarget == 3 || orientationTarget == 4){

throwPos = theCamera.GetCameraDi
rection() * 8 + GetOwner().GetWorldPosition();
} else {
throwPos = GetOwner().GetWorldFo
rward() * 8 + GetOwner().GetWorldPosition();
}
}
}
ThrowProjectile(throwPos);
}
return super.OnProcessThrowEvent(animEventName);
/* NOP */;
}
public function GetAudioImpactName() : CName{
return audioImpactName;
/* NOP */;
}
protected function LoadDataFromItemXMLStats(){
var atts : array<CName>;
var abs : array<CName>;
var j : Int32;
var i : Int32;
var iSize : Int32;
var jSize : Int32;
var disabledAbility : SBlockedAbility;
var dm : CDefinitionsManagerAccessor;
var buff : SEffectInfo;
var isLoopAbility : Bool;
var dmgRaw : SRawDamage;
var type : EEffectType;
var customAbilityName : CName;
var inv : CInventoryComponent;
var abilityDisableDuration : Float;
var min : SAbilityAttributeValue;
var max : SAbilityAttributeValue;
inv = GetOwner().GetInventory();
if (!inv){
LogAssert(false, "W3Petard.LoadDataFromItemXMLStats: own
er <<" + GetOwner() + ">> has no InventoryComponent!!!");
return;
}
loopDuration = CalculateAttributeValue(inv.GetItemAttributeValue
(itemId, 'duration', /* NOP */, /* NOP */), /* NOP */);
itemName = inv.GetItemName(itemId);
inv.GetItemAbilities(itemId, abs);
dm = theGame.GetDefinitionsManager();
iSize = abs.Size();
i = 0;
while (i < iSize){
isLoopAbility = dm.AbilityHasTag(abs[i], 'PetardLoopPara
ms');
if (!isLoopAbility){
if (!dm.AbilityHasTag(abs[i], 'PetardImpactParam
s')){
}
} else {
dm.GetAbilityAttributeValue(abs[i], 'ability_dis
able_duration', min, max);
abilityDisableDuration = CalculateAttributeValue
(GetAttributeRandomizedValue(min, max), /* NOP */);

dm.GetContainedAbilities(abs[i], atts);
jSize = atts.Size();
j = 0;
while (j < jSize){
if (IsEffectNameValid(atts[j])){
EffectNameToType(atts[j], type,
customAbilityName);
buff.effectType = type;
buff.effectAbilityName = customA
bilityName;
dm.GetAbilityAttributeValue(abs[
i], atts[j], min, max);
buff.applyChance = CalculateAttr
ibuteValue(GetAttributeRandomizedValue(min, max), /* NOP */);
if (isLoopAbility){
loopParams.buffs.PushBac
k(buff);
} else {
impactParams.buffs.PushB
ack(buff);
}
} else {
disabledAbility.abilityName = at
ts[j];
disabledAbility.timeWhenEnabledd
= abilityDisableDuration;
if (disabledAbility.timeWhenEnab
ledd == 0){
disabledAbility.timeWhen
Enabledd = -1;
}
if (isLoopAbility){
loopParams.disabledAbili
ties.PushBack(disabledAbility);
} else {
impactParams.disabledAbi
lities.PushBack(disabledAbility);
}
}
j += 1;
}
dm.GetAbilityAttributes(abs[i], atts);
jSize = atts.Size();
j = 0;
while (j < jSize){
if (IsDamageTypeNameValid(atts[j])){
dmgRaw.dmgVal = CalculateAttribu
teValue(inv.GetItemAttributeValue(itemId, atts[j], /* NOP */, /* NOP */), /* NOP
*/);
if (dmgRaw.dmgVal == 0){
} else {
dmgRaw.dmgType = atts[j]
;
if (isLoopAbility){
loopParams.damag
es.PushBack(dmgRaw);
} else {
impactParams.dam
ages.PushBack(dmgRaw);
}

}
}
j += 1;
}
if (isLoopAbility && loopParams.damages.Size() >
0){
loopParams.ignoresArmor = atts.Contains(
'ignoreArmor');
} else if (!isLoopAbility && impactParams.damage
s.Size() > 0){
impactParams.ignoresArmor = atts.Contain
s('ignoreArmor');
}
}
i += 1;
}
/* NOP */;
}
public function ThrowProjectile(targetPosIn : Vector){
var phantom : CPhantomComponent;
var inv : CInventoryComponent;
phantom = (CPhantomComponent)GetComponent('snappingCollisionGrou
pNames');
if (phantom){
phantom.GetTriggeringCollisionGroupNames(snapCollisionGr
oupNames);
} else {
snapCollisionGroupNames.PushBack('Terrain');
snapCollisionGroupNames.PushBack('Static');
}
LoadDataFromItemXMLStats();
targetPos = targetPosIn;
isProximity = false;
AddTimer('ReleaseProjectile', 0.010000, false, /* NOP */, /* NOP
*/, true, /* NOP */);
if (GetOwner() != thePlayer){
inv = GetOwner().GetInventory();
if (inv){
inv.RemoveItem(itemId, /* NOP */);
}
} else {
if (!FactsDoesExist("debug_fact_inf_bombs")){
thePlayer.inv.SingletonItemRemoveAmmo(itemId, 1)
;
}
if (thePlayer.inv.GetItemQuantity(itemId) < 1){
thePlayer.ClearSelectedItemId();
} else {
GetWitcherPlayer().AddBombThrowDelay(itemId);
}
if (GetOwner() == GetWitcherPlayer()){
GetWitcherPlayer().FailFundamentalsFirstAchievem
entCondition();
}
}
/* NOP */;
}
public timer function ReleaseProjectile(optional time : Float, optional
id : Int32){
var distanceToTarget : Float;

var projectileFlightTime : Float;


var target : CActor;
var actorsInAoE : array<CActor>;
var i : Int32;
target = thePlayer.GetTarget();
BreakAttachment();
ShootProjectileAtPosition(20.000000, 15.000000, targetPos, theGa
me.params.MAX_THROW_RANGE, /* NOP */);
if (isFromAimThrow && ShouldProcessTutorial('TutorialThrowHold')
){
wasInTutorialTrigger = FactsQuerySum("tut_aim_in_trigger
") > 0;
}
actorsInAoE = thePlayer.playerAiming.GetSweptActors();
if (actorsInAoE.Size() > 0){
if (dodgeable){
i = 0;
while (i < actorsInAoE.Size()){
actorsInAoE[i].SignalGameplayEvent('Time
2DodgeBombAOE');
(CNewNPC)actorsInAoE[i].OnIncomingProjec
tile(true);
i += 1;
}
}
} else if (target){
if (dodgeable){
distanceToTarget = VecDistance(thePlayer.GetWorl
dPosition(), target.GetWorldPosition());
projectileFlightTime = distanceToTarget / 15;
target.SignalGameplayEventParamFloat('Time2Dodge
Bomb', projectileFlightTime);
}
(CNewNPC)target.OnIncomingProjectile(true);
}
PlayEffectSingle(FX_TRAIL, /* NOP */);
wasThrown = true;
/* NOP */;
}
public function OnProjectileCollision(pos : Vector, normal : Vector, col
lidingComponent : CComponent, hitCollisionsGroups : array<CName>, actorIndex : I
nt32, shapeIndex : Int32) : Bool{
var depthTestPos : Vector;
var petardPos : Vector;
var collisionPos : Vector;
var collisionNormal : Vector;
var template : CEntityTemplate;
var npc : CNewNPC;
var victim : CActor;
if (stopCollisions){
return true;
}
if (collidingComponent && collidingComponent.GetEntity() == GetO
wner()){
return true;
}
if (collidingComponent){
victim = (CActor)collidingComponent.GetEntity();
npc = (CNewNPC)victim;
}

if (!CanCollideWithVictim(victim)){
return true;
}
if (npc && npc.HasAbility('RepulseProjectiles')){
bounceOfVelocityPreserve = 0.800000;
BounceOff(normal, pos);
victim.PlayEffect('lightning', this);
Init(npc);
return true;
}
if (itemName == 'Grapeshot 2' || itemName == 'Grapeshot 3'){
if (npc && npc.IsShielded(thePlayer)){
npc.ProcessShieldDestruction();
}
}
theGame.VibrateControllerVeryHard(/* NOP */);
if (hitCollisionsGroups.Contains('Water')){
if (isInWater){
return true;
}
isInWater = true;
petardPos = GetWorldPosition();
depthTestPos = petardPos;
depthTestPos.Z -= 1;
if (!theGame.GetWorld().StaticTrace(petardPos, depthTest
Pos, collisionPos, collisionNormal, snapCollisionGroupNames)){
isInDeepWater = true;
}
if (isInDeepWater){
template = (CEntityTemplate)LoadResource("water_
splash_small", /* NOP */);
theGame.CreateEntity(template, GetWorldPosition(
), GetWorldRotation(), /* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
stopCollisions = true;
DestroyAfter(3);
}
return true;
}
StopFlying();
if (isProximity || FactsQuerySum('debug_petards_proximity') > 0)
{
PlayEffectSingle('sparks', /* NOP */);
GetComponent("ProximityActivationArea").SetEnabled(true)
;
AddTimer('DetonationTimer', theGame.params.PROXIMITY_PET
ARD_IDLE_DETONATION_TIME, /* NOP */, /* NOP */, /* NOP */, true, /* NOP */);
isStuck = true;
} else {
ProcessEffect(pos, (CGameplayEntity)collidingComponent.G
etEntity());
}
/* NOP */;
}
protected function StopFlying(){
StopEffect(FX_TRAIL);
stopCollisions = true;
StopProjectile();
/* NOP */;
}
public function OnRangeReached() : Bool{

StopFlying();
ProcessEffect(/* NOP */, /* NOP */);
/* NOP */;
}
public function OnInteractionActivated(interactionComponentName : String
, activator : CEntity) : Bool{
if (isProximity || FactsQuerySum('debug_petards_proximity') > 0
&& interactionComponentName == "ProximityActivationArea" && IsRequiredAttitudeBe
tween(GetOwner(), activator, true, /* NOP */, /* NOP */)){
ProcessEffect(/* NOP */, /* NOP */);
}
/* NOP */;
}
public timer function DetonationTimer(optional detlaTime : Float, option
al id : Int32){
ProcessEffect(/* NOP */, /* NOP */);
/* NOP */;
}
public function ProcessEffect(explosionPosition : Vector, collidedTarget
: CGameplayEntity){
var targets : array<CGameplayEntity>;
var i : Int32;
var victimTags : array<CName>;
var attackerTags : array<CName>;
var dist : Float;
var camShakeStr : Float;
var camShakeStrFrac : Float;
var temp : Bool;
var phantom : CPhantomComponent;
var meshes : array<CComponent>;
var mesh : CMeshComponent;
var npc : CNewNPC;
if (isInDeepWater || noLoopEffectIfHitWater && isInWater){
Destroy();
return;
}
stopCollisions = true;
meshes = GetComponentsByClassName('CMeshComponent');
i = 0;
while (i < meshes.Size()){
mesh = (CMeshComponent)meshes[i];
if (!mesh){
} else {
mesh.SetVisible(false);
mesh.SetEnabled(false);
}
i += 1;
}
if (!isCluster && (W3PlayerWitcher)GetOwner() && GetWitcherPlaye
r().CanUseSkill(68) && !HasTag('Snowball')){
ProcessClusterBombs();
return;
}
if (explosionPosition == Vector(0, 0, 0)){
explosionPosition = GetWorldPosition();
}
explosionPosition = explosionPosition + Vector(0.000000, 0.00000
0, 0.100000);
FindGameplayEntitiesInSphere(targets, explosionPosition, impactP
arams.range, 1000, 'None', 16384, /* NOP */, /* NOP */);

if (targets.Size() == 0){
explosionPosition = explosionPosition - Vector(0.000000,
0.000000, 0.200000);
FindGameplayEntitiesInSphere(targets, explosionPosition,
impactParams.range, 1000, 'None', 16384, /* NOP */, /* NOP */);
}
if (collidedTarget && !targets.Contains(collidedTarget)){
targets.PushBack(collidedTarget);
}
i = targets.Size() - 1;
while (i >= 0){
if (!targets[i].IsAlive()){
npc = (CNewNPC)targets[i];
if (npc){
npc.SignalGameplayEvent('AbandonAgony');
npc.SetKinematic(false);
} else if (!targets[i].HasTag('TargetableByBomb'
)){
targets.Erase(i);
}
}
if (targets[i] == this){
targets.Erase(i);
}
i -= 1;
}
SnapComponents(true);
ProcessMechanicalEffect(targets, true, /* NOP */);
if (cameraShakeStrMin + cameraShakeStrMax > 0){
dist = VecDistance(GetOwner().GetWorldPosition(), GetWor
ldPosition());
if (dist <= cameraShakeRange){
camShakeStrFrac = cameraShakeRange - dist / came
raShakeRange;
camShakeStr = cameraShakeStrMin + camShakeStrFra
c * cameraShakeStrMax - cameraShakeStrMin;
GCameraShake(camShakeStr, true, GetWorldPosition
(), impactParams.range * 2, /* NOP */, /* NOP */, /* NOP */);
}
}
theGame.GetBehTreeReactionManager().CreateReactionEventIfPossibl
e(this, 'BombExplosionAction', 10.000000, 20.000000, -1, -1, true, /* NOP */, /*
NOP */);
ProcessEffectPlayFXs(true);
if (loopDuration > 0){
ProcessLoopEffect();
} else {
OnTimeEndedFunction(0);
}
/* NOP */;
}
protected function SnapComponents(isImpact : Bool){
var params : SPetardParams;
var i : Int32;
var pos : Vector;
if (isImpact){
params = impactParams;
} else {
params = loopParams;
}

i = 0;
while (i < params.componentsToSnap.Size()){
SnapComponentByName(params.componentsToSnap[i], 2, 0.250
000, snapCollisionGroupNames, pos);
i += 1;
}
/* NOP */;
}
protected function ProcessLoopEffect(){
LoopComponentsEnable(true);
SnapComponents(false);
ProcessEffectPlayFXs(false);
AddTimer('OnTimeEnded', loopDuration, false, /* NOP */, /* NOP *
/, true, /* NOP */);
AddTimer('Loop', 0.050000, true, /* NOP */, /* NOP */, true, /*
NOP */);
/* NOP */;
}
protected function LoopComponentsEnable(enable : Bool){
var i : Int32;
var component : CComponent;
i = 0;
while (i < componentsEnabledOnLoop.Size()){
component = GetComponent(componentsEnabledOnLoop[i]);
if (component){
component.SetEnabled(enable);
}
i += 1;
}
/* NOP */;
}
public timer function Loop(optional dt : Float, optional id : Int32){
LoopFunction(dt);
/* NOP */;
}
protected function ProcessPetardDestruction(){
var i : Int32;
i = 0;
while (i < previousTargets.Size()){
ProcessTargetOutOfArea(previousTargets[i]);
i += 1;
}
/* NOP */;
}
protected function LoopFunction(dt : Float){
var i : Int32;
var targets : array<CGameplayEntity>;
var pos : Vector;
pos = GetWorldPosition();
pos.Z += loopParams.cylinderOffsetZ;
targetsSinceLastCheck.Clear();
FindGameplayEntitiesInCylinder(targets, pos, loopParams.range, l
oopParams.cylinderHeight, 100000, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
targets.Remove(this);
targetsSinceLastCheck.Resize(targets.Size());
i = 0;
while (i < targetsSinceLastCheck.Size()){
targetsSinceLastCheck[i] = targets[i];
i += 1;
}

i = 0;
while (i < targetsSinceLastCheck.Size()){
ProcessTargetInArea(targetsSinceLastCheck[i], dt);
i += 1;
}
i = 0;
while (i < previousTargets.Size()){
if (!targetsSinceLastCheck.Contains(previousTargets[i]))
{
ProcessTargetOutOfArea(previousTargets[i]);
}
i += 1;
}
previousTargets.Clear();
previousTargets = targetsSinceLastCheck;
thePlayer.GetVisualDebug().AddSphere(GetRandomName(), loopParams
.range, GetWorldPosition(), true, Color(0, 0, 255), 0.200000);
/* NOP */;
}
protected function ProcessTargetInArea(actor : CGameplayEntity, dt : Flo
at){
var targets : array<CGameplayEntity>;
targets.PushBack(actor);
ProcessMechanicalEffect(targets, false, dt);
/* NOP */;
}
protected function ProcessTargetOutOfArea(entity : CGameplayEntity){
var dm : CDefinitionsManagerAccessor;
var j : Int32;
var k : Int32;
var skill : ESkill;
var successfullUnblock : Bool;
var actor : CActor;
actor = (CActor)entity;
if (!actor || !actor.IsAlive()){
return;
}
dm = theGame.GetDefinitionsManager();
successfullUnblock = false;
j = 0;
while (j < loopParams.disabledAbilities.Size()){
if (loopParams.disabledAbilities[j].timeWhenEnabledd ==
-1 && dm.IsAbilityDefined(loopParams.disabledAbilities[j].abilityName)){
skill = 0;
if (actor == thePlayer){
skill = SkillNameToEnum(loopParams.disab
ledAbilities[j].abilityName);
}
if (skill != 0){
successfullUnblock = thePlayer.BlockSkil
l(skill, false, /* NOP */) || successfullUnblock;
} else {
successfullUnblock = actor.BlockAbility(
loopParams.disabledAbilities[j].abilityName, false, /* NOP */) || successfullUnb
lock;
}
}
j += 1;
}
if (successfullUnblock){

k = 0;
while (k < loopParams.fxPlayedWhenAbilityDisabled.Size()
){
actor.StopEffect(loopParams.fxPlayedWhenAbilityD
isabled[k]);
k += 1;
}
k = 0;
while (k < loopParams.fxStoppedWhenAbilityDisabled.Size(
)){
actor.PlayEffectSingle(loopParams.fxStoppedWhenA
bilityDisabled[k], /* NOP */);
k += 1;
}
}
/* NOP */;
}
public timer function OnTimeEnded(optional dt : Float, optional id : Int
32){
OnTimeEndedFunction(dt);
/* NOP */;
}
protected function OnTimeEndedFunction(dt : Float){
LoopComponentsEnable(false);
StopAllEffects();
AddTimer('DestroyWhenNoFXPlayed', 1, true, /* NOP */, /* NOP */,
true, /* NOP */);
RemoveTimer('Loop', /* NOP */);
/* NOP */;
}
protected function ProcessEffectPlayFXs(isImpact : Bool){
var params : SPetardParams;
var i : Int32;
if (isImpact){
params = impactParams;
} else {
params = loopParams;
}
if (isInWater && params.fxWater.Size() > 0){
i = 0;
while (i < params.fxWater.Size()){
PlayEffectInternal(params.fxWater[i]);
i += 1;
}
} else {
i = 0;
while (i < params.fx.Size()){
PlayEffectInternal(params.fx[i]);
i += 1;
}
}
/* NOP */;
}
protected function ProcessMechanicalEffect(targets : array<CGameplayEnti
ty>, isImpact : Bool, dt : Float){
var i : Int32;
var index : Int32;
var j : Int32;
var k : Int32;
var action : W3DamageAction;

var none : SAbilityAttributeValue;


var atts : array<CName>;
var newDamage : SRawDamage;
var params : SPetardParams;
var attackerTags : array<CName>;
var allVictimsTags : array<CName>;
var targetTags : array<CName>;
var dm : CDefinitionsManagerAccessor;
var actorTarget : CActor;
var surface : CGameplayFXSurfacePost;
var successfullBlock : Bool;
var hitType : EHitReactionType;
var npc : CNewNPC;
i = targets.Size() - 1;
while (i >= 0){
if ((CActionPoint)targets[i] || (W3Petard)targets[i]){
targets.Erase(i);
} else if (GetAttitudeBetween(GetOwner(), targets[i]) ==
0){
actorTarget = (CActor)targets[i];
if (!actorTarget || targets[i] == GetOwner() &&
GetOwner() == thePlayer){
} else {
targets.Erase(i);
}
}
i -= 1;
}
if (action){
delete action;
}
if (isImpact){
params = impactParams;
} else {
params = loopParams;
}
if (params.surfaceFX.fxType >= 0 && !isInWater){
surface = theGame.GetSurfacePostFX();
surface.AddSurfacePostFXGroup(GetWorldPosition(), params
.surfaceFX.fxFadeInTime, params.surfaceFX.fxLastingTime, params.surfaceFX.fxFade
OutTime, params.surfaceFX.fxRadius, params.surfaceFX.fxType);
}
if (targets.Size() == 0){
return;
}
if (isImpact){
thePlayer.GetVisualDebug().AddSphere(EffectTypeToName(Ra
ndRange(EnumGetMax('EEffectType'), /* NOP */)), impactParams.range, GetWorldPosi
tion(), true, Color(255, 0, 0), 3);
if ((W3PlayerWitcher)GetOwner() && GetWitcherPlayer().Ca
nUseSkill(67) && !HasTag('Snowball')){
theGame.GetDefinitionsManager().GetAbilityAttrib
utes(SkillEnumToName(67), atts);
j = 0;
while (j < atts.Size()){
if (IsDamageTypeNameValid(atts[j])){
index = -1;
i = 0;
while (i < params.damages.Size()
){

if (params.damages[i].dm
gType == atts[j]){
index = i;
break;
}
i += 1;
}
if (index != -1){
params.damages[index].dm
gVal += CalculateAttributeValue(thePlayer.GetSkillAttributeValue(67, atts[j], fa
lse, true), /* NOP */) * thePlayer.GetSkillLevel(67);
} else {
newDamage.dmgType = atts
[j];
newDamage.dmgVal = Calcu
lateAttributeValue(thePlayer.GetSkillAttributeValue(67, atts[j], false, true), /
* NOP */) * thePlayer.GetSkillLevel(67);
params.damages.PushBack(
newDamage);
}
}
j += 1;
}
}
}
dm = theGame.GetDefinitionsManager();
if (isImpact){
hitType = hitReactionType;
} else {
hitType = 0;
}
i = 0;
while (i < targets.Size()){
targetTags = targets[i].GetTags();
ArrayOfNamesAppendUnique(allVictimsTags, targetTags);
actorTarget = (CActor)targets[i];
if (!actorTarget){
j = 0;
while (j < params.damages.Size()){
if (params.damages[j].dmgVal > 0){
if (params.damages[j].dmgType ==
theGame.params.DAMAGE_NAME_FIRE){
targets[i].OnFireHit(thi
s);
} else if (params.damages[j].dmg
Type == theGame.params.DAMAGE_NAME_FROST){
targets[i].OnFrostHit(th
is);
}
}
j += 1;
}
if (isFromAimThrow && wasInTutorialTrigger && Sh
ouldProcessTutorial('TutorialThrowHold')){
j = 0;
while (j < targetTags.Size()){
FactsAdd("aimthrowed_" + targetT
ags[j], /* NOP */, /* NOP */);
j += 1;
}

}
} else if (!actorTarget.IsAlive()){
} else {
action = new W3DamageAction in theGame.damageMgr
;
action.Initialize(GetOwner(), actorTarget, this,
'petard', hitType, 2, false, true, false, false, /* NOP */, /* NOP */, /* NOP *
/, /* NOP */);
action.SetHitAnimationPlayType(params.playHitAni
mMode);
action.SetIgnoreArmor(params.ignoresArmor);
action.SetProcessBuffsIfNoDamage(true);
action.SetIsDoTDamage(dt);
j = 0;
while (j < params.damages.Size()){
if (dt > 0){
action.AddDamage(params.damages[
j].dmgType, params.damages[j].dmgVal * dt);
} else {
action.AddDamage(params.damages[
j].dmgType, params.damages[j].dmgVal);
}
j += 1;
}
j = 0;
while (j < params.buffs.Size()){
action.AddEffectInfo(params.buffs[j].eff
ectType, params.buffs[j].effectDuration, params.buffs[j].effectCustomValue, para
ms.buffs[j].effectAbilityName, params.buffs[j].effectCustomParam, params.buffs[j
].applyChance);
j += 1;
}
theGame.damageMgr.ProcessAction(action);
delete action;
successfullBlock = false;
j = 0;
while (j < params.disabledAbilities.Size()){
if (dm.IsAbilityDefined(params.disabledA
bilities[j].abilityName)){
successfullBlock = BlockTargetsA
bility(actorTarget, params.disabledAbilities[j].abilityName, params.disabledAbil
ities[j].timeWhenEnabledd, /* NOP */) || successfullBlock;
}
j += 1;
}
k = 0;
while (k < params.fxPlayedOnHit.Size()){
actorTarget.PlayEffectSingle(params.fxPl
ayedOnHit[k], /* NOP */);
k += 1;
}
if (successfullBlock){
k = 0;
while (k < params.fxPlayedWhenAbilityDis
abled.Size()){
actorTarget.PlayEffectSingle(par
ams.fxPlayedWhenAbilityDisabled[k], /* NOP */);
k += 1;
}
k = 0;

while (k < params.fxStoppedWhenAbilityDi


sabled.Size()){
actorTarget.StopEffect(params.fx
StoppedWhenAbilityDisabled[k]);
k += 1;
}
}
npc = (CNewNPC)actorTarget;
if (npc && npc.GetNPCType() == 3 && !npc.IsInCom
bat()){
npc.SignalGameplayEventParamObject('Bein
gHitAction', GetOwner());
theGame.GetBehTreeReactionManager().Crea
teReactionEventIfPossible(npc, 'BeingHitAction', 8.000000, 1.000000, 999.000000,
1, false, /* NOP */, /* NOP */);
}
}
i += 1;
}
if (allVictimsTags.Size() > 0){
attackerTags = GetOwner().GetTags();
AddHitFacts(allVictimsTags, attackerTags, "_weapon_hit",
/* NOP */, /* NOP */);
AddHitFacts(allVictimsTags, attackerTags, "_bomb_hit", /
* NOP */, /* NOP */);
AddHitFacts(allVictimsTags, attackerTags, "_bomb_hit_typ
e_" + PrintFactFriendlyPetardName(), /* NOP */, /* NOP */);
}
/* NOP */;
}
protected function BlockTargetsAbility(target : CActor, abilityName : CN
ame, blockDuration : Float, unlock : Bool) : Bool{
var skill : ESkill;
skill = 0;
if (target == thePlayer){
skill = SkillNameToEnum(abilityName);
}
if (skill != 0){
return thePlayer.BlockSkill(skill, !unlock, blockDuratio
n);
} else {
return target.BlockAbility(abilityName, true, blockDurat
ion);
}
/* NOP */;
}
public timer function DelayedRestoreCollisions(optional dt : Float, opti
onal id : Int32){
stopCollisions = false;
/* NOP */;
}
private function ProcessClusterBombs(){
var target : CActor;
var i : Int32;
var clusterNbr : Int32;
var cluster : W3Petard;
var targetPosCluster : Vector;
var clusterInitPos : Vector;
var angle : Float;
var velocity : Float;

var distLen : Float;


var clusterTemplate : CEntityTemplate;
var dmgRaw : SRawDamage;
var cachedDamages : array<SRawDamage>;
var atts : array<CName>;
var distanceToTarget : Float;
var projectileFlightTime : Float;
target = thePlayer.GetTarget();
clusterInitPos = GetWorldPosition();
clusterInitPos.Z += radius + 0.150000;
clusterNbr = thePlayer.GetSkillLevel(68) + 1;
i = 0;
while (i < clusterNbr){
cluster = (W3Petard)Duplicate(/* NOP */);
cluster.Init(GetOwner());
cluster.isCluster = true;
cluster.isProximity = false;
cluster.AddTimer('DelayedRestoreCollisions', 0.200000, /
* NOP */, /* NOP */, /* NOP */, /* NOP */, /* NOP */);
targetPosCluster.X = SgnF(RandF() - 0.500000) * 1 + Rand
F() * 3;
targetPosCluster.Y = SgnF(RandF() - 0.500000) * 1 + Rand
F() * 3;
targetPosCluster.Z = 0;
distLen = VecLength2D(targetPosCluster);
targetPosCluster += GetWorldPosition();
angle = 9 - distLen * 10;
velocity = 4 + distLen / 2;
cluster.ShootProjectileAtPosition(angle, velocity, targe
tPosCluster, theGame.params.MAX_THROW_RANGE, /* NOP */);
cluster.PlayEffectSingle(FX_TRAIL, /* NOP */);
if (dodgeable){
distanceToTarget = VecDistance(thePlayer.GetWorl
dPosition(), target.GetWorldPosition());
projectileFlightTime = distanceToTarget / veloci
ty;
target.SignalGameplayEventParamFloat('Time2Dodge
Bomb', projectileFlightTime);
}
i += 1;
}
PlayEffect(FX_CLUSTER, /* NOP */);
justPlayingFXs.PushBack(FX_CLUSTER);
AddTimer('DestroyWhenNoFXPlayed', 1, true, /* NOP */, /* NOP */,
true, /* NOP */);
stopCollisions = true;
/* NOP */;
}
public timer function DestroyWhenNoFXPlayed(optional dt : Float, optiona
l id : Int32){
DestroyWhenNoFXPlayedFunction(dt);
/* NOP */;
}
protected function DestroyWhenNoFXPlayedFunction(dt : Float) : Bool{
var i : Int32;
i = 0;
while (i < justPlayingFXs.Size()){
if (IsEffectActive(justPlayingFXs[i], /* NOP */)){
return false;
}

i += 1;
}
RemoveTimer('DestroyWhenNoFXPlayed', /* NOP */);
DestroyAfter(0.100000);
return true;
/* NOP */;
}
protected function PlayEffectInternal(fx : CName){
PlayEffectSingle(fx, /* NOP */);
justPlayingFXs.PushBack(fx);
/* NOP */;
}
public function DismembersOnKill() : Bool{
return dismemberOnKill;
/* NOP */;
}
public function GetImpactRange() : Float{
return impactParams.range;
/* NOP */;
}
public function GetAoERange() : Float{
return loopParams.range;
/* NOP */;
}
public function IsStuck() : Bool{
return isStuck;
/* NOP */;
}
public function DisableProximity(){
isProximity = false;
/* NOP */;
}
public function IsProximity() : Bool{
return isProximity;
/* NOP */;
}
private function PrintFactFriendlyPetardName() : String{
return StrLower(StrReplaceAll(NameToString(itemName), " ", "_"))
;
/* NOP */;
}
}
class CBTTaskThrowBombDef extends CBTTaskAttackDef{
public editable var dontUseDiwmeritium : Bool;
public editable var activationChance : Float;
}
class CBTTaskThrowDwimeritiumBomb extends CBTTaskThrowBomb{
public function SelectProperBomb(bomb : SItemUniqueId) : Bool{
var i : Int32;
var itemName : CName;
i = 0;
while (i < bombs.Size()){
itemName = inventory.GetItemName(bombs[i]);
if (itemName == 'Dwimeritium Bomb 1' || itemName == 'Dwi
meritium Bomb 2' || itemName == 'Dwimeritium Bomb 3'){
bomb = bombs[i];
return true;
}

i += 1;
}
return false;
/* NOP */;
}
}
class CBTTaskThrowDwimeritiumBombDef extends CBTTaskThrowBombDef{
}
class CTicketAlgorithmSimple extends

Vous aimerez peut-être aussi