add damage dealt stat instead of assists
This commit is contained in:
parent
023e1c0be1
commit
402fae7dfa
@ -24,7 +24,7 @@ var private KFOnlineGameSettings KFOGS;
|
||||
|
||||
var private OnlineSubsystemSteamworks OSS;
|
||||
|
||||
var private Array<YAS_RepInfo> RepInfos;
|
||||
var private Array<YAS_RepInfoOwner> RepInfos;
|
||||
|
||||
var private Array<CachedRankRelation> PlayerRelations;
|
||||
var private Array<CachedRankRelation> GroupRelations;
|
||||
@ -268,7 +268,7 @@ private function PostInit()
|
||||
|
||||
private function UpdateTimer()
|
||||
{
|
||||
local YAS_RepInfo RepInfo;
|
||||
local YAS_RepInfoOwner RepInfo;
|
||||
|
||||
foreach RepInfos(RepInfo)
|
||||
{
|
||||
@ -281,7 +281,7 @@ private function UpdateTimer()
|
||||
|
||||
private function MessageOfTheDayTimer()
|
||||
{
|
||||
local YAS_RepInfo RepInfo;
|
||||
local YAS_RepInfoOwner RepInfo;
|
||||
local int MessageIndex;
|
||||
|
||||
if (CfgMessageOfTheDay.default.bRandomize)
|
||||
@ -313,7 +313,7 @@ private function MessageOfTheDayTimer()
|
||||
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
local YAS_RepInfo RepInfo;
|
||||
local YAS_RepInfoOwner RepInfo;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
@ -329,7 +329,7 @@ public function NotifyLogin(Controller C)
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
local YAS_RepInfo RepInfo;
|
||||
local YAS_RepInfoOwner RepInfo;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
@ -341,34 +341,36 @@ public function NotifyLogout(Controller C)
|
||||
}
|
||||
}
|
||||
|
||||
public function YAS_RepInfo CreateRepInfo(Controller C)
|
||||
public function YAS_RepInfoOwner CreateRepInfo(Controller C)
|
||||
{
|
||||
local YAS_RepInfo OwnerRepInfo;
|
||||
local YAS_RepInfoRank RankRepInfo;
|
||||
local YAS_RepInfoOwner OwnerRepInfo;
|
||||
local YAS_RepInfoPlayer PlayerRepInfo;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
OwnerRepInfo = Spawn(class'YAS_RepInfo', C);
|
||||
RankRepInfo = Spawn(class'YAS_RepInfoRank', C);
|
||||
OwnerRepInfo = Spawn(class'YAS_RepInfoOwner', C);
|
||||
PlayerRepInfo = Spawn(class'YAS_RepInfoPlayer', C);
|
||||
|
||||
if (OwnerRepInfo != None && RankRepInfo != None)
|
||||
if (OwnerRepInfo != None && PlayerRepInfo != None)
|
||||
{
|
||||
RepInfos.AddItem(OwnerRepInfo);
|
||||
|
||||
OwnerRepInfo.RankRepInfo = RankRepInfo;
|
||||
OwnerRepInfo.PlayerRepInfo = PlayerRepInfo;
|
||||
OwnerRepInfo.YAS = Self;
|
||||
OwnerRepInfo.LogLevel = LogLevel;
|
||||
OwnerRepInfo.RankPlayer = CfgRanks.default.Player;
|
||||
OwnerRepInfo.RankAdmin = CfgRanks.default.Admin;
|
||||
OwnerRepInfo.MessageOfTheDay = CfgMessageOfTheDay.default.Message[LastMessageID];
|
||||
}
|
||||
|
||||
return OwnerRepInfo;
|
||||
}
|
||||
|
||||
private function YAS_RepInfo FindRepInfo(Controller C)
|
||||
return None;
|
||||
}
|
||||
|
||||
private function YAS_RepInfoOwner FindRepInfo(Controller C)
|
||||
{
|
||||
local YAS_RepInfo RepInfo;
|
||||
local YAS_RepInfoOwner RepInfo;
|
||||
|
||||
if (C == None) return None;
|
||||
|
||||
@ -383,20 +385,20 @@ private function YAS_RepInfo FindRepInfo(Controller C)
|
||||
return None;
|
||||
}
|
||||
|
||||
public function bool DestroyRepInfo(YAS_RepInfo RepInfo)
|
||||
public function bool DestroyRepInfo(YAS_RepInfoOwner RepInfo)
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (RepInfo == None) return false;
|
||||
|
||||
RepInfos.RemoveItem(RepInfo);
|
||||
RepInfo.RankRepInfo.SafeDestroy();
|
||||
RepInfo.PlayerRepInfo.SafeDestroy();
|
||||
RepInfo.SafeDestroy();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function InitRank(YAS_RepInfo RepInfo)
|
||||
private function InitRank(YAS_RepInfoOwner RepInfo)
|
||||
{
|
||||
local CachedRankRelation Rel;
|
||||
local String JoinedGroupIDs;
|
||||
@ -417,12 +419,12 @@ private function InitRank(YAS_RepInfo RepInfo)
|
||||
{
|
||||
if (Rel.UID.Uid == PRI.UniqueID.Uid)
|
||||
{
|
||||
RepInfo.RankRepInfo.Rank = Rel.Rank;
|
||||
RepInfo.PlayerRepInfo.Rank = Rel.Rank;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (RepInfo.RankRepInfo.Rank.RankID <= 0 && !KFPC.bIsEosPlayer)
|
||||
if (RepInfo.PlayerRepInfo.Rank.RankID <= 0 && !KFPC.bIsEosPlayer)
|
||||
{
|
||||
foreach GroupRelations(Rel)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
class YAS_RepInfo extends ReplicationInfo;
|
||||
class YAS_RepInfoOwner extends ReplicationInfo;
|
||||
|
||||
var public YAS YAS;
|
||||
|
||||
@ -7,7 +7,7 @@ var public repnotify SystemRank RankPlayer, RankAdmin;
|
||||
var public repnotify String DynamicServerName, MessageOfTheDay;
|
||||
var public repnotify bool UsesStats, Custom, PasswordRequired;
|
||||
|
||||
var public YAS_RepInfoRank RankRepInfo;
|
||||
var public YAS_RepInfoPlayer PlayerRepInfo;
|
||||
|
||||
var private KFPlayerController KFPC;
|
||||
var private YAS_ScoreBoard SC;
|
||||
@ -16,6 +16,7 @@ var private OnlineSubsystemSteamworks OSS;
|
||||
var private Array<UniqueNetID> PendingGroupIDs;
|
||||
|
||||
const CheckGroupTimer = 0.2f;
|
||||
const UpdatePlayerStatsTimer = 2.0f;
|
||||
const MaxRetries = 3;
|
||||
var private int Retries;
|
||||
|
||||
@ -92,6 +93,11 @@ public simulated event PreBeginPlay()
|
||||
GetScoreboard();
|
||||
}
|
||||
|
||||
if (Role == ROLE_Authority || WorldInfo.NetMode == NM_StandAlone)
|
||||
{
|
||||
SetTimer(UpdatePlayerStatsTimer, true, nameof(UpdatePlayerStats));
|
||||
}
|
||||
|
||||
GetOnlineSubsystem();
|
||||
}
|
||||
|
||||
@ -102,6 +108,22 @@ public simulated event PostBeginPlay()
|
||||
Super.PostBeginPlay();
|
||||
}
|
||||
|
||||
public function UpdatePlayerStats()
|
||||
{
|
||||
if (GetKFPC() == None || KFPC.MatchStats == None) return;
|
||||
|
||||
if (WorldInfo.GRI == None || KFGameReplicationInfo(WorldInfo.GRI) == None) return;
|
||||
|
||||
// At the end of the wave, TotalDamageDealt is incremented by GetDamageDealtInWave(),
|
||||
// but GetDamageDealtInWave() is not reset immediately.
|
||||
// In order not to receive a short-term doubling of damage in statistics,
|
||||
// Count damage only when the wave is active
|
||||
if (KFGameReplicationInfo(WorldInfo.GRI).bWaveStarted)
|
||||
{
|
||||
PlayerRepInfo.DamageDealt = KFPC.MatchStats.TotalDamageDealt + KFPC.MatchStats.GetDamageDealtInWave();
|
||||
}
|
||||
}
|
||||
|
||||
public reliable client function CheckGroupRanks(String JoinedGroupIDs)
|
||||
{
|
||||
local Array<String> StringGroupIDs;
|
||||
@ -164,12 +186,12 @@ private reliable server function ServerApplyMembership(UniqueNetId GroupUID)
|
||||
Rank = YAS.RankByGroupID(GroupUID);
|
||||
if (Rank.RankID > 0)
|
||||
{
|
||||
RankRepInfo.Rank = Rank;
|
||||
PlayerRepInfo.Rank = Rank;
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Warn("Cant find related rank for groupUID");
|
||||
RankRepInfo.Rank = class'YAS_Types'.static.FromSystemRank(RankPlayer);
|
||||
PlayerRepInfo.Rank = class'YAS_Types'.static.FromSystemRank(RankPlayer);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
class YAS_RepInfoRank extends ReplicationInfo;
|
||||
class YAS_RepInfoPlayer extends ReplicationInfo;
|
||||
|
||||
var public UniqueNetID UID;
|
||||
var public Rank Rank;
|
||||
var public int DamageDealt;
|
||||
|
||||
replication
|
||||
{
|
||||
@ -9,7 +10,7 @@ replication
|
||||
UID;
|
||||
|
||||
if (bNetDirty)
|
||||
Rank;
|
||||
Rank, DamageDealt;
|
||||
}
|
||||
|
||||
public simulated function bool SafeDestroy()
|
@ -13,6 +13,8 @@ const ListItemsDefault = 12;
|
||||
const FontScalarModCompact = 1.0f;
|
||||
const FontScalarModDefault = 1.25f;
|
||||
|
||||
const ShowDamage = true;
|
||||
|
||||
const IconRanked = Texture2D'DailyObjective_UI.KF2_Dailies_Icon_PerkLvl'; // where the hell is the right icon?
|
||||
const IconCustom = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I26';
|
||||
const IconUnranked = Texture2D'UI_Menus.ServerBrowserMenu_SWF_I28';
|
||||
@ -51,7 +53,7 @@ var float PingBars;
|
||||
var localized String Players, Spectators;
|
||||
|
||||
// Cache
|
||||
var public Array<YAS_RepInfoRank> RepInfos;
|
||||
var public Array<YAS_RepInfoPlayer> RepInfos;
|
||||
|
||||
var public YAS_Settings Settings;
|
||||
var public String DynamicServerName, MessageOfTheDay;
|
||||
@ -63,55 +65,44 @@ var public SystemRank RankAdmin;
|
||||
var private int ListItems;
|
||||
var private float FontScalarMod;
|
||||
|
||||
function Rank PlayerRank(KFPlayerReplicationInfo KFPRI)
|
||||
function YAS_RepInfoPlayer FindRepInfo(KFPlayerReplicationInfo KFPRI)
|
||||
{
|
||||
local YAS_RepInfoPlayer RepInfo;
|
||||
|
||||
foreach RepInfos(RepInfo)
|
||||
{
|
||||
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
||||
{
|
||||
return RepInfo;
|
||||
}
|
||||
}
|
||||
|
||||
foreach KFPRI.DynamicActors(class'YAS_RepInfoPlayer', RepInfo)
|
||||
{
|
||||
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
||||
{
|
||||
RepInfos.AddItem(RepInfo);
|
||||
return RepInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
function Rank PlayerRank(YAS_RepInfoPlayer RepInfo, bool bAdmin)
|
||||
{
|
||||
local YAS_RepInfoRank RepInfo;
|
||||
local Rank Rank;
|
||||
local bool NeedClean, FoundRepInfo;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
Rank = class'YAS_Types'.static.FromSystemRank(RankPlayer);
|
||||
|
||||
NeedClean = false;
|
||||
FoundRepInfo = false;
|
||||
|
||||
foreach RepInfos(RepInfo)
|
||||
{
|
||||
if (RepInfo == None)
|
||||
{
|
||||
NeedClean = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
||||
if (RepInfo != None)
|
||||
{
|
||||
Rank = RepInfo.Rank;
|
||||
FoundRepInfo = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!FoundRepInfo)
|
||||
{
|
||||
foreach KFPRI.DynamicActors(class'YAS_RepInfoRank', RepInfo)
|
||||
{
|
||||
if (RepInfo.UID.Uid == KFPRI.UniqueId.Uid)
|
||||
{
|
||||
Rank = RepInfo.Rank;
|
||||
FoundRepInfo = true;
|
||||
RepInfos.AddItem(RepInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NeedClean)
|
||||
{
|
||||
RepInfos.RemoveItem(None);
|
||||
}
|
||||
|
||||
if (KFPRI.bAdmin && !Rank.OverrideAdmin)
|
||||
if (bAdmin && !Rank.OverrideAdmin)
|
||||
{
|
||||
Rank = class'YAS_Types'.static.FromSystemRank(RankAdmin);
|
||||
}
|
||||
@ -504,7 +495,14 @@ function DrawMenu()
|
||||
DrawTextShadowHLeftVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PlayerString, XPos + PlayerXPos, YPos, BoxH, FontScalar);
|
||||
DrawTextShadowHLeftVCenter(class'KFGFxMenu_Inventory'.default.PerkFilterString, XPos + PerkXPos, YPos, BoxH, FontScalar);
|
||||
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.KillsString, XPos + KillsXPos, YPos, KillsWBox, BoxH, FontScalar);
|
||||
if (ShowDamage)
|
||||
{
|
||||
DrawTextShadowHVCenter(class'KFGFxTraderContainer_ItemDetails'.default.DamageTitle, XPos + AssistXPos, YPos, AssistWBox, BoxH, FontScalar);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.AssistsString, XPos + AssistXPos, YPos, AssistWBox, BoxH, FontScalar);
|
||||
}
|
||||
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.DoshString, XPos + DoshXPos, YPos, DoshWBox, BoxH, FontScalar);
|
||||
DrawTextShadowHVCenter(class'KFGFxHUD_ScoreboardWidget'.default.PingString, XPos + PingXPos, YPos, PingWBox, BoxH, FontScalar);
|
||||
|
||||
@ -580,6 +578,7 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
|
||||
local float FontScalar, XL, YL, PerkIconPosX, PerkIconPosY, PerkIconSize, PrestigeIconScale;
|
||||
local float XPos, BoxWidth, RealPlayerWBox;
|
||||
local KFPlayerReplicationInfo KFPRI;
|
||||
local YAS_RepInfoPlayer RepInfo;
|
||||
local byte Level, PrestigeLevel;
|
||||
local Color ColorTMP;
|
||||
local bool bIsZED;
|
||||
@ -599,7 +598,8 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
|
||||
|
||||
KFPRI = KFPRIArray[Index];
|
||||
|
||||
Rank = PlayerRank(KFPRI);
|
||||
RepInfo = FindRepInfo(KFPRI);
|
||||
Rank = PlayerRank(RepInfo, KFPRI.bAdmin);
|
||||
|
||||
if (KFGRI.bVersusGame)
|
||||
{
|
||||
@ -797,11 +797,18 @@ function DrawPlayerEntry(Canvas C, int Index, float YOffset, float Height, float
|
||||
|
||||
// Kill
|
||||
C.SetDrawColorStruct(Settings.Style.KillsTextColorMid);
|
||||
DrawTextShadowHVCenter(string (KFPRI.Kills), KillsXPos, YOffset, KillsWBox, Height, FontScalar);
|
||||
DrawTextShadowHVCenter(GetNiceSize(KFPRI.Kills), KillsXPos, YOffset, KillsWBox, Height, FontScalar);
|
||||
|
||||
// Assist
|
||||
C.SetDrawColorStruct(Settings.Style.AssistsTextColorMid);
|
||||
DrawTextShadowHVCenter(string (KFPRI.Assists), AssistXPos, YOffset, AssistWBox, Height, FontScalar);
|
||||
if (ShowDamage)
|
||||
{
|
||||
DrawTextShadowHVCenter((RepInfo == None ? "0" : GetNiceSize(RepInfo.DamageDealt)), AssistXPos, YOffset, AssistWBox, Height, FontScalar);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextShadowHVCenter(GetNiceSize(KFPRI.Assists), AssistXPos, YOffset, AssistWBox, Height, FontScalar);
|
||||
}
|
||||
|
||||
// Dosh
|
||||
if (bIsZED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user