7 [
Attribute(
"{E6FC4537B53EA00B}Configs/Campaign/XPRewards.conf",
params:
"conf class=SCR_XPRewardList")]
10 [
Attribute(
"300",
UIWidgets.EditBox,
"How many XP a player needs to gain in a single life to get the Veterancy award. 0 = disabled.",
params:
"0 inf 1")]
11 protected int m_iVeterancyXPAwardThreshold;
13 [
Attribute(
"1800",
UIWidgets.EditBox,
"If suicide is committed more than once in this time (seconds), a penalty is issued.",
params:
"0 inf 1")]
16 [
Attribute(
"0.1",
UIWidgets.EditBox,
"Fraction of the vehicle cost to be awarded as XP to player destroying it",
params:
"0 inf 1")]
17 protected float m_fEnemyVehicleDestroyXPMultiplier;
19 [
Attribute(
"180",
UIWidgets.EditBox,
"Player is being rewarded xp for survival each time this amount of seconds pass since spawning",
params:
"0 inf 1")]
20 protected int m_iSurvivalRewardCooldown;
22 [
Attribute(
"60",
UIWidgets.EditBox,
"Maximum amount of survival reward cycles with xp rewards being scaled",
params:
"0 inf 1")]
23 protected int m_iSurvivalScaleMaxCycleAmount;
25 [
Attribute(
"1",
UIWidgets.EditBox,
"Ratio of XP awarded to supplies spent in repair action (ratio of 0.5: 10 supplies spent on repair rewards 5 XP",
params:
"0 inf 1")]
26 protected float m_fVehicleRepairXPMultiplier;
28 static protected bool s_bXpSystemEnabled;
35 protected static const float TRANSPORT_POINTS_TO_XP_RATIO = 0.01;
36 protected static const float TRANSPORT_HELI_MULTIPLIER = 0.25;
37 protected static const int TRANSPORT_XP_PAYOFF_THRESHOLD = 15;
39 protected ref array<ref SCR_XPRewardInfo> m_aXPRewardList = {};
53 static bool IsXpSystemEnabled()
55 return s_bXpSystemEnabled;
61 return m_iSurvivalRewardCooldown;
67 return m_iSurvivalScaleMaxCycleAmount;
74 if (!seizeXPRewardInfo)
84 if (!seizeXPRewardInfo)
93 super.OnPlayerSpawnFinalize_S(requestComponent, handlerComponent,
data, entity);
95 if (!requestComponent || !entity)
102 if (compartmentAccessComponent)
106 PlayerController pc = requestComponent.GetPlayerController();
121 super.OnPlayerDisconnected(playerId, cause, timeout);
129 super.OnPlayerKilled(instigatorContextData);
134 int playerID = instigatorContextData.GetVictimPlayerID();
140 PlayerController pc =
GetGame().GetPlayerManager().GetPlayerController(playerID);
156 if (!compartmentAccessComponent)
165 super.OnControllableDestroyed(instigatorContextData);
167 IEntity victim = instigatorContextData.GetVictimEntity();
172 if (victim.IsInherited(
Vehicle))
183 if (instigatorContextData.GetInstigator().GetInstigatorType() !=
InstigatorType.INSTIGATOR_PLAYER)
186 Vehicle vehicle =
Vehicle.Cast(instigatorContextData.GetVictimEntity());
190 int playerID = instigatorContextData.GetInstigator().GetInstigatorPlayerID();
198 Faction vehicleFaction = vehicle.GetFaction();
202 vehicleFaction = vehicle.GetDefaultFaction();
205 if (!vehicleFaction || playerFaction.IsFactionFriendly(vehicleFaction))
209 if (!editableEntityComponent)
212 array<ref SCR_EntityBudgetValue> budgets = {};
223 xpToAward = budget.GetBudgetValue() * m_fEnemyVehicleDestroyXPMultiplier;
234 if (instigatorContextData.GetInstigator().GetInstigatorType() !=
InstigatorType.INSTIGATOR_PLAYER)
238 int killerId = instigatorContextData.GetKillerPlayerID();
243 if (instigatorContextData.DoesPlayerKillCountAsTeamKill())
256 if (instigatorContextData.IsEnemyKillPunished(SCR_EDisguisedKillingPunishment.WARCRIME | SCR_EDisguisedKillingPunishment.XP_LOSS,
true,
true))
261 else if (instigatorContextData.IsEnemyKillPunished(SCR_EDisguisedKillingPunishment.XP_LOSS,
true))
268 int victimID = instigatorContextData.GetVictimPlayerID();
278 SCR_ChimeraCharacter instigatorChar = SCR_ChimeraCharacter.Cast(instigatorContextData.GetKillerEntity());
279 if (instigatorChar && instigatorChar.IsInVehicle())
297 int playerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(compartment.GetOccupant());
320 SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId));
321 IEntity vehicle = CompartmentAccessComponent.GetVehicleIn(player);
329 amount *= TRANSPORT_HELI_MULTIPLIER;
335 if (newValue * TRANSPORT_POINTS_TO_XP_RATIO >= TRANSPORT_XP_PAYOFF_THRESHOLD)
366 OnVehicleRepaired(supportStation, supportStationType, actionTarget, actionUser, action);
370 OnCharacterHealed(supportStation, supportStationType, actionTarget, actionUser, action);
383 int userPlayerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(actionUser);
384 if (userPlayerId == 0 || !action)
405 int userPlayerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(actionUser);
406 if (userPlayerId == 0 || !action)
410 int targetPlayerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(actionTarget);
411 if (targetPlayerId == userPlayerId)
421 if (!seizeXPRewardInfo)
425 SCR_ECampaignSeizingBaseType seizingBaseType;
428 seizingBaseType = SCR_ECampaignSeizingBaseType.CONTROL_POINT;
430 seizingBaseType = SCR_ECampaignSeizingBaseType.SOURCE_BASE;
432 seizingBaseType = SCR_ECampaignSeizingBaseType.FOB;
437 vector baseOrigin = baseComponent.GetOwner().GetOrigin();
438 Faction baseFaction = baseComponent.GetFaction();
443 radius = baseComponent.GetRadius();
446 array<int> players = {};
447 playerManager.GetPlayers(players);
448 SCR_ChimeraCharacter playerEntity;
450 foreach (
int playerId : players)
452 playerEntity = SCR_ChimeraCharacter.Cast(playerManager.GetPlayerControlledEntity(playerId));
454 if (!playerEntity || playerEntity.GetFactionKey() != baseFaction.GetFactionKey())
457 if (
vector.DistanceSq(playerEntity.GetOrigin(), baseOrigin) >= radius * radius)
485 array<int> players = {};
486 playerManager.GetPlayers(players);
487 PlayerController playerController;
490 foreach (
int playerId : players)
492 playerController =
GetGame().GetPlayerManager().GetPlayerController(playerId);
493 if (!playerController)
497 if (!playerXpHandlerComponent)
521 array<int> players = {};
522 playerManager.GetPlayers(players);
523 vector baseOrigin =
base.GetOwner().GetOrigin();
524 int radius =
base.GetRadius();
526 SCR_ChimeraCharacter playerEntity;
527 PlayerController playerController;
530 foreach (
int playerId : players)
532 playerEntity = SCR_ChimeraCharacter.Cast(playerManager.GetPlayerControlledEntity(playerId));
534 if (!playerEntity || playerEntity.GetFactionKey() == baseFaction.GetFactionKey())
537 playerController =
GetGame().GetPlayerManager().GetPlayerController(playerId);
538 if (!playerController)
542 if (!playerXpHandlerComponent)
545 if (
vector.DistanceSq(playerEntity.GetOrigin(), baseOrigin) < radius * radius)
557#ifdef NO_SUICIDE_PENALTY
560 PlayerController pc =
GetGame().GetPlayerManager().GetPlayerController(playerId);
575 float curTime =
GetGame().GetWorld().GetWorldTime();
578 if (curTime > penaltyTimestamp)
583 int playerXPWithPenalty = compXPPlayer.
GetPlayerXP() + penalty;
584 SCR_ECharacterRank newRank = ranks.
GetRankByXP(playerXPWithPenalty);
599 PlayerController controller =
GetGame().GetPlayerManager().GetPlayerController(playerId);
612 RplComponent rplComponent = RplComponent.Cast(
GetOwner().FindComponent(RplComponent));
614 return rplComponent && rplComponent.IsProxy();
624 void AwardXP(
int playerId,
SCR_EXPRewards rewardID,
float multiplier = 1.0,
bool volunteer =
false,
int customXP = 0)
629 PlayerController playerController =
GetGame().GetPlayerManager().GetPlayerController(playerId);
631 if (playerController)
632 AwardXP(playerController, rewardID, multiplier, volunteer, customXP);
642 void AwardXP(notnull PlayerController controller,
SCR_EXPRewards rewardID,
float multiplier = 1.0,
bool volunteer =
false,
int customXP = 0)
652 comp.
AddPlayerXP(rewardID, multiplier, volunteer, customXP);
655 if (rewardID ==
SCR_EXPRewards.VETERANCY || m_iVeterancyXPAwardThreshold == 0 || customXP != 0)
659 float veterancyAwards =
Math.Floor(singleLifeXP / m_iVeterancyXPAwardThreshold);
661 if (veterancyAwards < 1)
664 int leftoverXP = singleLifeXP % m_iVeterancyXPAwardThreshold;
685 if (info.GetRewardID() == reward)
698 int rewardsCnt = m_aXPRewardList.Count();
700 for (
int i = 0; i < rewardsCnt; i++)
702 if (m_aXPRewardList[i].GetRewardID() == reward)
703 return m_aXPRewardList[i].GetRewardXP();
723 int rewardsCnt = m_aXPRewardList.Count();
725 for (
int i = 0; i < rewardsCnt; i++)
727 if (m_aXPRewardList[i].GetRewardID() == reward)
728 return m_aXPRewardList[i].GetRewardName();
740 int rewardsCnt = m_aXPRewardList.Count();
742 for (
int i = 0; i < rewardsCnt; i++)
744 if (m_aXPRewardList[i].GetRewardID() == reward)
745 return m_aXPRewardList[i].AllowNotification();
796 if (supportStationManager)
806 s_bXpSystemEnabled =
true;
813 if (supportStationManager)
821 s_bXpSystemEnabled =
false;
ArmaReforgerScripted GetGame()
enum SCR_EAICombatMoveRequestState UNDEFINED
void OnCompartmentLeft(AIAgent agent, IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
void OnVehicleDestroyed(IEntity vehicle)
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void OnPlayerKilled(notnull SCR_InstigatorContextData instigatorContextData)
SCR_ECharacterControlType
What kind of controller the character or (in some cases vehicle) has, eg: AI, Player,...
SCR_ECharacterDeathStatusRelations
Get all prefabs that have the spawner data
void SCR_FactionManager(IEntitySource src, IEntity parent)
int m_iSuicidePenaltyCooldown
void OnControllableDestroyed(IEntity entity, IEntity killerEntity, Instigator instigator, notnull SCR_InstigatorContextData instigatorContextData)
override void EOnFrame(IEntity owner, float timeSlice)
override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
bool AllowNotification(SCR_EXPRewards reward)
void OnBaseSeized(SCR_CampaignMilitaryBaseComponent baseComponent)
void ~SCR_XPHandlerComponent()
int GetSeizeBaseProgressionXP(string baseFactionKey)
void ProcessSuicide(int playerId)
ref map< int, float > m_mPlayerTransportPoints
string GetXPRewardName(SCR_EXPRewards reward)
int GetXPRewardAmount(SCR_EXPRewards reward)
int GetSeizeBaseProgressionRewardTimer()
@ VALUABLE_INTEL_HANDIN_SMALL
@ DISMANTLE_BASE_COMPLETED
@ COMMANDER_TASK_COMPLETED
@ FIRE_SUPPORT_TASK_COMPLETED
@ VALUABLE_INTEL_HANDIN_MEDIUM
@ KILLING_WHILE_DISGUISED
@ ENEMY_VEHICLE_DESTRUCTION
@ FREE_ROAM_BUILDING_BUILT
@ REINFORCE_TASK_COMPLETED
@ ESTABLISH_BASE_COMPLETED
@ VALUABLE_INTEL_HANDIN_LARGE
bool IsHealingFriendlyStatPoint(SCR_EDataStats stat)
void OnCharacterHealed(SCR_BaseSupportStationComponent supportStation, ESupportStationType supportStationType, IEntity actionTarget, IEntity actionUser, SCR_BaseUseSupportStationAction action)
void OnBaseAttackEnded(notnull SCR_CampaignMilitaryBaseComponent base)
ref array< SCR_CampaignMilitaryBaseComponent > m_aBasesBeingSeized
const int RELAY_SEIZING_RADIUS
const int BASE_SEIZING_CHECK_INTERVAL
void OnBaseAttackStarted(notnull SCR_CampaignMilitaryBaseComponent base, Faction defendingFaction, Faction attackingFaction)
void OnCharacterKilled(notnull SCR_InstigatorContextData instigatorContextData)
SCR_XPRewardInfo GetXpRewardInfo(SCR_EXPRewards reward)
int GetSurvivalRewardCooldown()
void AwardTransportXP(int playerId)
void OnSupportStationExecuted(SCR_BaseSupportStationComponent supportStation, ESupportStationType supportStationType, IEntity actionTarget, IEntity actionUser, SCR_BaseUseSupportStationAction action)
void OnVehicleRepaired(SCR_BaseSupportStationComponent supportStation, ESupportStationType supportStationType, IEntity actionTarget, IEntity actionUser, SCR_BaseUseSupportStationAction action)
void EvaluateAllAttackedBasesAttackers()
void VeterancyAward(notnull PlayerController controller, float multiplier)
float m_fBaseSeizingCheckTimer
void EvaluateBaseAttackers(SCR_CampaignMilitaryBaseComponent base)
void OnHealingStatPointsAdded(int playerId)
int GetSurvivalScaleMaxCycleAmount()
void OnStatPointsAdded(int playerId, SCR_EDataStats stat, float amount, bool temp)
void OnDrivingStatPointsAdded(int playerId, float amount)
proto external Managed FindComponent(typename typeName)
Object holding reference to resource. In destructor release the resource.
int GetSupportStationSuppliesOnUse()
SCR_ECampaignBaseType GetType()
Returns type of this base.
static OnBaseAttackEndInvoker GetOnBaseAttackEnd()
static OnBaseStateChangedInvoker GetOnBaseUnderAttack()
ScriptInvoker GetOnCompartmentLeft(bool createNew=true)
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
bool GetEntityBudgetCost(out notnull array< ref SCR_EntityBudgetValue > outBudgets, IEntity owner=null)
static ref ScriptInvoker s_OnStatAdded
void SetPlayerXPSinceLastSpawn(int xp)
void UpdatePlayerRank(bool notify=true)
int GetPlayerXP()
Getter for player XP.
int GetPlayerXPSinceLastSpawn()
Getter for player XP accumulated since last respawn.
void StartSurvivalRewardCycle()
float GetSuicidePenaltyTimestamp()
void SetSuicidePenaltyTimestamp(float timestamp)
void StartSeizingProgressReward(notnull SCR_CampaignMilitaryBaseComponent base)
void StopSurvivalRewardCycle()
void StopSeizingProgressReward(notnull SCR_CampaignMilitaryBaseComponent base)
void AddPlayerXP(SCR_EXPRewards rewardID, float multiplier=1.0, bool volunteer=false, int addDirectly=0)
bool IsRankRenegade(SCR_ECharacterRank rankID)
SCR_ECharacterRank GetRankByXP(int XP)
int GetSeizeCompletionXpReward(SCR_ECampaignSeizingBaseType baseType)
int GetSeizeProgressionXpReward(string factionKey)
int GetSeizeProgressionTimer()
ScriptInvokerBase< SupportStation_OnSupportStationExecuted > GetOnSupportStationExecutedSuccessfully()
static SCR_SupportStationManagerComponent GetInstance()
Config template for XP rewards.
void GetRewardList(out notnull array< ref SCR_XPRewardInfo > rewardList)
enum EPhysicsLayerPresets Vehicle
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)