Space Plunder
Loading...
Searching...
No Matches
BaseData.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "BaseGameplayTags.h"
7#include "Engine/DataTable.h"
8#include "BaseData.generated.h"
9
10
11class UInputAction;
12
13DECLARE_LOG_CATEGORY_EXTERN(LogBaseHelpers, Display, All);
14DECLARE_LOG_CATEGORY_CLASS(LogBasePlayerState, Display, All);
15
16DECLARE_STATS_GROUP(TEXT("Base Helpers"), STATGROUP_BaseHelpers, STATCAT_Advanced)
17DECLARE_CYCLE_STAT_EXTERN(TEXT("BPLib"), STATGROUP_BaseHelpers_BPLib, STATGROUP_BaseHelpers, BASEHELPERS_API);
18DECLARE_CYCLE_STAT_EXTERN(TEXT("Character Component"), STATGROUP_BaseHelpers_CharacterComp, STATGROUP_BaseHelpers, BASEHELPERS_API);
19DECLARE_CYCLE_STAT_EXTERN(TEXT("Player Controller Component"), STATGROUP_BaseHelpers_PlayerControllerComp, STATGROUP_BaseHelpers, BASEHELPERS_API);
20DECLARE_CYCLE_STAT_EXTERN(TEXT("GameMode"), STATGROUP_BaseHelpers_GameMode, STATGROUP_BaseHelpers, BASEHELPERS_API);
21DECLARE_CYCLE_STAT_EXTERN(TEXT("GameState"), STATGROUP_BaseHelpers_GameState, STATGROUP_BaseHelpers, BASEHELPERS_API);
22DECLARE_CYCLE_STAT_EXTERN(TEXT("Common Actor Component"), STATGROUP_BaseHelpers_ActorComp, STATGROUP_BaseHelpers, BASEHELPERS_API);
23DECLARE_CYCLE_STAT_EXTERN(TEXT("Character Base"), STATGROUP_BaseHelpers_CharacterBase, STATGROUP_BaseHelpers, BASEHELPERS_API);
24DECLARE_CYCLE_STAT_EXTERN(TEXT("PlayerController Base"), STATGROUP_BaseHelpers_PlayerControllerBase, STATGROUP_BaseHelpers, BASEHELPERS_API);
25DECLARE_CYCLE_STAT_EXTERN(TEXT("Actor Base"), STATGROUP_BaseHelpers_ActorBase, STATGROUP_BaseHelpers, BASEHELPERS_API);
26
27
28static int32 DebugCharacterComponents = 0;
29
30
31UENUM(Blueprintable, BlueprintType, meta = (ScriptName = "EDamageTypePython"))
32enum class EDamageType : uint8
33{
34 Default,
35 Base,
36 Bullet,
37 Laser,
38 Plasma,
41 Fall,
42 Fire,
43 Melee,
47 Poison,
48 Water,
49};
50
51UENUM(BlueprintType)
52enum class EDeathType : uint8
53{
54 Default,
56 Bullet,
57 Laser,
58 Plasma,
59 Fire,
62 Fall,
63 Hit,
64 Melee,
65 Water,
66 Zombie,
67 Poison,
69};
70
71UENUM(BlueprintType, meta = (ScriptName = "ESoundSourcePython"))
72enum class ESoundSource : uint8
73{
75 Jump,
76 DryFire,
80 Melee,
82 Reload,
84 Door,
85 Voice,
87 Gadget,
88 Alarms, //Alerts
92};
93
94
95UENUM(BlueprintType)
96enum class EGameControllerType : uint8
97{
100 XboxOne,
103 SwitchPro,
105 SteamDeck,
106 Generic,
107};
108
109UENUM(BlueprintType)
110enum class ESize : uint8
111{
113 Small,
115 Medium,
117 Large,
119};
120
121//@TODO
122UENUM(BlueprintType)
123enum class EVehicleMode : uint8
124{
125 None,
126 Driver,
127 Passenger,
128 Gunner,
129};
130
131UENUM(Blueprintable, BlueprintType)
132enum class EBodyPartName : uint8
133{
134 Pelvis,
135 Head,
136 Spine,
137 RightArm,
138 LeftArm,
139 RightHand,
140 LeftHand,
141 RightLeg,
142 LeftLeg,
143};
144
145
146//@TODO maybe not needed for interaction part, can just change prompt
147UENUM(BlueprintType, meta = (ScriptName = "EInteractionTypePython"))
148enum class EInteractionType : uint8
149{
150 Default,
151 Interact,
152 Use,
153 Talk,
154 Trade,
155 Buy,
156 Sell,
157 Switch,
158 TurnOn,
159 TurnOff,
160 Hack,
161 Pickup,
162 Open,
163 Close,
164 Lock,
165 Unlock,
166 Inspect,
167 Tie,
168 Untie,
169 Eat,
170 Drink,
171 Swap,
172 Sleep,
173 Wakeup,
174 Climb,
175 Push,
176 Pull,
177 Craft,
178 Build,
179 Repair,
180 Takedown,
181 KnockOut,
182 Pilot,
183 Enter,
184 Delete,
185 Full,
186 Exit,
187
188 Command,
189 Attack,
190 Follow,
191 Wait,
192
193 None,
194};
195
196UENUM(BlueprintType)
197enum class EAIStimuliType : uint8
198{
199 Default,
200 Door,
201 Defence,
203 Item,
204 Switch,
209 Health,
210 Character,
211 DeadBody,
214 Vehicle
215};
216
217UENUM(BlueprintType)
218enum class EAIActionType : uint8
219{
220 Default,
221 Patrol,
223 JoinGroup, //- Add AI to Group who now follow Leader //
224 Attack,
228 Help,
229 //? Heal,
230 Retreat,
231 Flank,
232 //? Regroup,
233 Search, //- Unsure if found person, ask everyone to start Searching the whole area
234 Investigate, //- Heard Noise or saw something, Search Particular Area //
235 Alert, //- Everyone be on Alert //
236 Protect, //- Protect Specified Actor //
237
238 //@TODO Fill out more actions
239
240};
241
242// UENUM(BlueprintType)
243// enum class EButtonPressType : uint8
244// {
245// Hold,
246// Press,
247// Tap,
248// DoubleTap,
249// };
250
251USTRUCT(BlueprintType)
253{
254 GENERATED_BODY()
255
256 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
257 FString ID = "ID";
258
259 void SetUniqueNumber(const int32 NewID)
260 {
261 UniqueID = NewID;
262 }
263 int32 GetUniqueNumber() const
264 {
265 return UniqueID;
266 }
267 bool IsUnique() const
268 {
269 return UniqueID != -1;
270 }
271
272
274 {
275
276 }
277 explicit FUniqueID(const FString& NewID)
278 {
279 ID = NewID;
280 };
281 explicit FUniqueID(const FString& NewID, const int32 NewUniqueID)
282 {
283 ID = NewID;
284 UniqueID = NewUniqueID;
285 };
286
287 bool IsValid() const
288 {
289 bool bValid = false;
290 if(ID != "ID"){bValid = true;};
291 if(ID.IsEmpty()){bValid = false;}
292 return bValid;
293 }
294 bool operator==(const FUniqueID& Other) const
295 {
296 return (ID == Other.ID) && (UniqueID == Other.UniqueID);
297 }
298 bool operator!=(const FUniqueID& Other) const
299 {
300 return (ID != Other.ID) || (ID == Other.ID && UniqueID != Other.UniqueID);
301 }
302protected:
303 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="General")
304 int32 UniqueID = -1;
305};
306
307// Use For Dialogue/Interactions
308USTRUCT(BlueprintType)
310{
311 GENERATED_BODY()
312
313 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Base Actor")
314 AActor* Actor = nullptr;
315 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Base Actor")
316 FText DisplayName;
317 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Base Actor")
318 UTexture2D* DisplayImage = nullptr;
319
320
321 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Base Actor")
322 // FTransform ActorTransform = FTransform(FVector::ZeroVector);
323};
324
325
326
331USTRUCT(BlueprintType)
333{
334 GENERATED_BODY()
335
336 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
338 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
339 bool bHold = false;
340 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
341 bool bAvailable = true;
342 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
343 bool bHide = false;
344 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
345 bool bShowButton = false;
346 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
347 bool bCustomInteraction = false;
348 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
349 FString CustomInteractionText = "Default";
350 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
351 // UTexture2D* Icon = nullptr;
352
355 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
356 float InteractTimeMultiplier = 1.0f;
357
358
359 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction", meta=(DisplayThumbnail = false))
360 UInputAction* MappingContext = nullptr;
361
362
363
365 {
366
367 }
369 {
370 InteractionType = Type;
371 }
372 explicit FInteractionType(const EInteractionType Type, const bool bStartHidden)
373 {
374 InteractionType = Type;
375 bHide = bStartHidden;
376 }
377 explicit FInteractionType(const FString& CustomText)
378 {
379 bCustomInteraction = true;
380 CustomInteractionText = CustomText;
381 }
382 explicit FInteractionType(const FString& CustomText, const bool bShowButtonPrompt)
383 {
384 bCustomInteraction = true;
385 CustomInteractionText = CustomText;
386 bShowButton = bShowButtonPrompt;
387 }
389 {
391 return None;
392 }
394 {
395 bool bEqual = true;
396 if(InteractionType != Other.InteractionType)
397 {
398 bEqual = false;
399 }
400 // if(bHold != Other.bHold)
401 // {
402 // bEqual = false;
403 // }
404 // if(bAvailable != Other.bAvailable)
405 // {
406 // bEqual = false;
407 // }
408 // if(bAvailable != Other.bHide)
409 // {
410 // bEqual = false;
411 // }
412 return bEqual;
413 }
414};
415
416
417
418USTRUCT(BlueprintType)
420{
421 GENERATED_BODY()
422
423 // UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Interaction")
424 // FText Name;
425 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Interaction")
426 FCharacterInfo DisplayInfo;
427
428 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
429 TArray<FInteractionType> InteractionTypes;
431 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
433 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
434 bool bAIControlled = false;
435
437 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
438 bool bShowMenu = false;
439 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
440 bool bShowDefault = false;
442 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction")
443 int32 DefaultInteraction = 0;
444
445 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction", meta=(EditCondition="bShowMenu"))
446 // int32 MenuItems = 3;
447
448
449
451 {
452
453 };
454
456 {
457 DefaultInteraction = InteractionTypes.Add(FInteractionType(Default));
458 // InteractionStructTypes
459 }
461 {
462 DefaultInteraction = InteractionTypes.Add(FInteractionType(Default));
463 StimuliType = Stimuli;
464 }
466 {
467 DefaultInteraction = InteractionTypes.Add(FInteractionType(Default));
468 StimuliType = Stimuli;
469 }
470
471
474 {
475 if(InteractionTypes.IsValidIndex(DefaultInteraction))
476 {
477 Default = InteractionTypes[DefaultInteraction];
478 return true;
479 }
480 return false;
481 }
482
484 {
485 for(const auto& InteractionType : InteractionTypes)
486 {
487 if(Interaction == InteractionType.InteractionType)
488 {
489 Type = InteractionType;
490 return true;
491 }
492 }
493 return false;
494 }
495
496 bool SetInteractionHidden(const EInteractionType Interaction, const bool bValue)
497 {
498 for(auto& InteractionType : InteractionTypes)
499 {
500 if(Interaction == InteractionType.InteractionType)
501 {
502 InteractionType.bHide = bValue;
503 return true;
504 }
505 }
506 return false;
507 }
509 {
510 for(auto& InteractionType : InteractionTypes)
511 {
512 InteractionType.bHide = true;
513 if(Interaction == InteractionType.InteractionType)
514 {
515 InteractionType.bHide = false;
516 }
517 }
518 }
520 {
521 for(auto& InteractionType : InteractionTypes)
522 {
523 InteractionType.bHide = true;
524 if(Interaction == InteractionType.CustomInteractionText)
525 {
526 InteractionType.bHide = false;
527 }
528 }
529 }
530
532 {
533 for(auto& InteractionType : InteractionTypes)
534 {
535 if(Interaction == InteractionType.InteractionType)
536 {
537 InteractionType.bAvailable = bValue;
538 return true;
539 }
540 }
541 return false;
542 }
543 bool SetInteractionHold(const EInteractionType Interaction, const bool bValue)
544 {
545 for(auto& InteractionType : InteractionTypes)
546 {
547 if(Interaction == InteractionType.InteractionType)
548 {
549 InteractionType.bHold = bValue;
550 return true;
551 }
552 }
553 return false;
554 }
555
556 TArray<FInteractionType> GetVisibleInteractions() const
557 {
558 TArray<FInteractionType> VisibleInteractions;
559 for(const auto& Interaction : InteractionTypes)
560 {
561 if(Interaction.bHide == false)
562 {
563 VisibleInteractions.Add(Interaction);
564 }
565 }
566 return VisibleInteractions;
567 }
568
569
570 void SetDefault(const EInteractionType Default, const bool bRemoveOthers = true)
571 {
572 if(bRemoveOthers)
573 {
574 InteractionTypes.Empty();
575 }
576 DefaultInteraction = InteractionTypes.Add(FInteractionType(Default));
578 {
579 DefaultInteraction = -1;
580 }
581 }
582
584 {
587 None.bShowDefault = true;
588 return None;
589 }
590
592 {
593 bool bEqual = true;
594 if(InteractionTypes != Other.InteractionTypes)
595 {
596 bEqual = false;
597 }
598 if(DefaultInteraction != Other.DefaultInteraction)
599 {
600 bEqual = false;
601 }
602 if(bShowDefault != Other.bShowDefault)
603 {
604 bEqual = false;
605 }
606 return bEqual;
607 }
608};
609
610//@TODO Check all this, remove any extras
611USTRUCT(BlueprintType)
613{
614 GENERATED_BODY()
615
616 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
617 FString Attacker = "Attacker";
618 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
619 FString Victim = "Victim";
620 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
621 AActor* AttackerActor = nullptr;
622 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
623 AActor* VictimActor = nullptr;
624
625 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
626 class APlayerState* AttackerPlayerState = nullptr;
627 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
628 class APlayerState* VictimPlayerState = nullptr;
629
630 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
631 int32 AttackerTeamID = 0;
632 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
633 int32 VictimTeamID = 0;
634
635 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
637 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
638 FString WeaponID = "Weapon";
639
640 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
641 bool bAIAttacker = false;
642 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
643 bool bAIVictim = false;
644
645 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
646 bool bSelfDeath = false;
647 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
648 bool bTeamKill = false;
649 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player Death")
650 bool bStealthKill = false;
651};
652
653
654// USTRUCT(BlueprintType)
655// struct FBaseActorInfo
656// {
657// GENERATED_BODY()
658//
659// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Base Actor")
660// FTransform ActorTransform = FTransform(FVector::ZeroVector);
661//
662// // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Base Actor")
663// // bool b
664// };
665
666
667
668USTRUCT(BlueprintType)
669struct FInputIcon : public FTableRowBase
670{
671 GENERATED_BODY()
672
673 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Input")
674 FString Name;
675 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Input")
676 FSlateBrush Icon;
677};
678
679
680USTRUCT(BlueprintType)
682{
683 GENERATED_BODY()
684
685 // The overall Karma level (positive = good, negative = bad)
686 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
687 float Level = 0.0f;
688 // // Time-stamped log of key karma-related actions (optional)
689 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
690 // TArray<FString> KarmaHistory;
691 // // Weighted breakdown of karma by category
692 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
693 // TMap<FName, float> KarmaByCategory;
694 // // Whether this character is known for high or low karma
695 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
696 // bool bIsKarmaKnown = false;
697 // // Flags for unique moral decisions that affect storylines
698 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
699 // TSet<FName> MoralDecisions;
700 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
701 // TMap<FName, float> KarmaByFaction;
702 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Karma")
703 // TMap<FName, float> KarmaByRegion;
704};
705
706static int32 MAX_SKILL_LEVEL = 10;
707static int32 XP_PER_LEVEL = 1000;
708static int32 MIN_SKILL_LEVEL = 1;
709
717USTRUCT(BlueprintType)
719{
720 GENERATED_BODY()
721
722
723 // UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character Traits")
724 // FString Name = "Strength";
725 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character Traits")
726 FGameplayTag Name = SkillTags::Strength;
727 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
728 int32 Level = 1;
729 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
730 float XP = 0.0f;
731
733 {
734
735 }
736 explicit FCharacterSkill(const FGameplayTag SkillName)
737 {
738 Name = SkillName;
739 }
740 explicit FCharacterSkill(const FGameplayTag SkillName, const int32 StartingLevel)
741 {
742 Name = SkillName;
743 Level = StartingLevel;
744 XP = StartingLevel * XP_PER_LEVEL;
745 }
750 //@ todo Depricate don't need XP, characters choose levels
751 bool AddXP(const float Value)
752 {
753 const int32 LevelBefore = XP / XP_PER_LEVEL; // Level before adding XP
754 XP += Value;
755 // Level = XP / 1000;
756 //- Level after adding XP
757 Level = FMath::Min(static_cast<int32>(XP / XP_PER_LEVEL), MAX_SKILL_LEVEL); // Ensure Level does not exceed MaxLevel
758 return Level > LevelBefore;
759 }
760 //@TODO Check it doesn't go below 0
761 // Returns if changed
762 bool AddLevel(const bool bIncrease)
763 {
764 int32 PrevLevel = Level;
765 if(bIncrease)
766 {
767 Level++;
768 }
769 else
770 {
771 Level--;
772 }
773 Level = FMath::Min(FMath::Max(MIN_SKILL_LEVEL, Level), MAX_SKILL_LEVEL); // Ensure Level does not exceed MaxLevel
774 return Level != PrevLevel;
775 }
776};
777
778USTRUCT(BlueprintType)
779struct FSkill
780{
781 GENERATED_BODY()
782
783 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="General")
784 FString Name = "Health";
785 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
786 float Value = 0.0f;
787 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
788 float Value2 = 0.0f;
789 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
790 FText ValueFormat = FText::FromString("{0}/{1}");
791 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
792 bool bEditable = false;
793 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="General")
794 UTexture2D* Icon = nullptr;
795
796 explicit FSkill(const FCharacterSkill& CharacterSkill)
797 {
798 FString LastTagPart = "";
799 CharacterSkill.Name.GetTagName().ToString().Split(TEXT("."), nullptr, &LastTagPart, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
800 Name = LastTagPart;
801 Value = CharacterSkill.Level;
802 Value2 = CharacterSkill.XP;
803 ValueFormat = FText::FromString("{0}");
804 bEditable = true;
805 }
806 FSkill()
807 {
808
809 }
810};
811
812
813USTRUCT(BlueprintType)
814struct FCharacterBaseSkills
815{
816 GENERATED_BODY()
817
818 //- Melee Damage, How Easily Pushed Over //
819 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
820 FCharacterSkill Strength = FCharacterSkill(SkillTags::Strength, 1);
821 int32 GetStrength() const {return Strength.Level;};
822 bool AddStrengthXP(const float Value) {return Strength.AddXP(Value);};
823
824 //- How quickly spotting Enemies //
825 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
826 FCharacterSkill Perception = FCharacterSkill(SkillTags::Perception, 1);
827 int32 GetPerception() const {return Perception.Level;};
828 bool AddPerceptionXP(const float Value) {return Perception.AddXP(Value);};
829
830 //- Health Points, hp of body parts,
831 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
832 FCharacterSkill Endurance = FCharacterSkill(SkillTags::Endurance, 1);
833 int32 GetEndurance() const {return Endurance.Level;};
834 bool AddEnduranceXP(const float Value) {return Endurance.AddXP(Value);};
835
836 //- Companion Health,
837 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
838 FCharacterSkill Charisma = FCharacterSkill(SkillTags::Charisma, 1);
839 int32 GetCharisma() const {return Charisma.Level;};
840 bool AddCharismaXP(const float Value) {return Charisma.AddXP(Value);};
841
842 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
843 FCharacterSkill Intelligence = FCharacterSkill(SkillTags::Intelligence, 1);
844 int32 GetIntelligence() const {return Intelligence.Level;};
845 bool AddIntelligenceXP(const float Value) {return Intelligence.AddXP(Value);};
846
847 //- Stamina bar,
848 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
849 FCharacterSkill Agility = FCharacterSkill(SkillTags::Agility, 1);
850 int32 GetAgility() const {return Agility.Level;};
851 bool AddAgilityXP(const float Value) {return Agility.AddXP(Value);};
852
853 //- Accuracy +
854 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
855 FCharacterSkill WeaponSkill = FCharacterSkill(SkillTags::WeaponSkill, 1);
856 int32 GetWeaponSkill() const {return WeaponSkill.Level;};
857 bool AddWeaponSkillXP(const float Value) {return WeaponSkill.AddXP(Value);};
858
859 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
860 FCharacterSkill Stealth = FCharacterSkill(SkillTags::Stealth, 1);
861 int32 GetStealth() const {return Stealth.Level;};
862 bool AddStealthXP(const float Value) {return Stealth.AddXP(Value);};
863
864 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Character Traits")
865 FCharacterSkill Luck = FCharacterSkill(SkillTags::Luck, 1);
866 int32 GetLuck() const {return Luck.Level;};
867 bool AddLuckXP(const float Value) {return Luck.AddXP(Value);};
868
869 int32 GetSkillPoints() const {return SkillPoints;};
870
871
872 //~~ ~~//
873 void AddSkillXP(const FGameplayTag& Name, const int32 Value)
874 {
875 for(const auto& Skill : GetAllSkillsRef())
876 {
877 if(Skill == nullptr){continue;}
878 if(Skill->Name == Name)
879 {
880 Skill->AddXP(Value);
881 }
882 }
883 }
884 void AddSkillLevel(const FGameplayTag& Name, const bool bIncrease)
885 {
886 for(const auto& Skill : GetAllSkillsRef())
887 {
888 if(Skill == nullptr){continue;}
889 if(Skill->Name == Name)
890 {
891 Skill->AddLevel(bIncrease);
892 }
893 }
894 }
895 void AddSkillLevelByName(const FString& Name, const bool bIncrease)
896 {
897 FCharacterSkill* Skill = GetSkillByName(Name);
898 if(Skill == nullptr){UE_LOG(LogBaseHelpers, Warning, TEXT("FCharacterBaseSkills::AddSkillLevelByName Skill: %s Not found.."), *Name);return;}
899 // Get All Skill Points,
900 // Check we Have enough to Add.
901 // If Not, Return
902 // If true Add Level
903 // Mofify SkillPoints.
904 if(bIncrease && GetSkillPoints() <= 0)
905 {
906 return;
907 }
908 const bool bChangedLevel = Skill->AddLevel(bIncrease);
909 if(bChangedLevel == false){return;}
910 if(bIncrease)
911 {
912 SkillPoints--;
913 }
914 else
915 {
916 SkillPoints++;
917 }
918 }
919
920 FCharacterSkill* GetSkillByName(const FString& Name)
921 {
922 for(const auto& Skill : GetAllSkillsRef())
923 {
924 FString LastTagPart = "";
925 Skill->Name.GetTagName().ToString().Split(TEXT("."), nullptr, &LastTagPart, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
926 if(Name == LastTagPart)
927 {
928 return Skill;
929 }
930 }
931 return nullptr;
932 }
933 FCharacterSkill* GetSkillByTag(const FGameplayTag& Name)
934 {
935 for(const auto& Skill : GetAllSkillsRef())
936 {
937 if(Skill == nullptr){continue;}
938 if(Skill->Name == Name)
939 {
940 return Skill;
941 }
942 }
943 return nullptr;
944 }
945
946
947 //~~ Helpers ~~//
948
950 TArray<FCharacterSkill> GetAllSkills() const
951 {
952 TArray<FCharacterSkill> Skills;
953 Skills.Add(Strength);
954 Skills.Add(Perception);
955 Skills.Add(Endurance);
956 Skills.Add(Charisma);
957 Skills.Add(Intelligence);
958 Skills.Add(Agility);
959 Skills.Add(WeaponSkill);
960 Skills.Add(Stealth);
961 Skills.Add(Luck);
962 return Skills;
963 }
964 TArray<FCharacterSkill*> GetAllSkillsRef()
965 {
966 TArray<FCharacterSkill*> Skills;
967 Skills.Add(&Strength);
968 Skills.Add(&Perception);
969 Skills.Add(&Endurance);
970 Skills.Add(&Charisma);
971 Skills.Add(&Intelligence);
972 Skills.Add(&Agility);
973 Skills.Add(&WeaponSkill);
974 Skills.Add(&Stealth);
975 Skills.Add(&Luck);
976 return Skills;
977 }
978
979 int32 GetNumberOfSkills() const
980 {
981 return GetAllSkills().Num();
982 }
983
984
985 FCharacterBaseSkills()
986 {
987
988 }
989
990
991protected:
992 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character Traits")
993 int32 SkillPoints = 10;
994
995};
996
997
998
999
1000// UENUM(BlueprintType)
1001// enum class EGamepadButton : uint8
1002// {
1003// GamepadFaceButtonBottom,
1004//
1005//
1006// };
1007
1008// UENUM(BlueprintType)
1009// enum class EKeyboardMouseButton : uint8
1010// {
1011// LeftMouseButton,
1012//
1013//
1014// };
1015
1016// USTRUCT(BlueprintType)
1017// struct FCharacterComponentRequirements
1018// {
1019// GENERATED_BODY()
1020//
1021// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1022// bool bController = false;
1023// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1024// bool bPlayerController = false;
1025// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1026// bool bAIController = false;
1027// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1028// bool bSkeletalMesh = false;
1029// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1030// bool bAnimationInstance = false;
1031// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1032// bool bPawn = false;
1033// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1034// bool bHUDReference = false;
1035// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
1036// bool bShouldDestroyOnDeath = false;
1037// };
1038
1039
1040UENUM(Blueprintable, BlueprintType)
1041enum class EUnlockableCategory : uint8
1042{
1043 Default,
1044 Achievement,
1045 Challenge,
1046 Level,
1047 Seasonal,
1048};
1049
1050UENUM(BlueprintType)
1051enum class EDifficultyLevel : uint8
1052{
1053 Assisted,
1054 Easy,
1055 Normal,
1056 Hard,
1057 Expert,
1058 Master
1059};
1060
1061
1062
1063UENUM(Blueprintable, BlueprintType, meta = (ScriptName = "EMatchStatePython"))
1064enum class EMatchState : uint8
1065{
1066 Default,
1067 Lobby,
1068 WaitingToStart,
1069 PreMatch,
1070 InProgress,
1071 PostMatch,
1072 Finished
1073};
1074
1075USTRUCT(BlueprintType)
1076struct FMatchState
1077{
1078 GENERATED_BODY()
1079
1080 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1081 EMatchState MatchState = EMatchState::Default;
1082 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1083 bool bMatchTimed = false;
1084 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1085 int32 TimeRemaining = 0;
1086
1087 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1088 EMatchState RoundState = EMatchState::Default;
1089 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1090 int32 Round = 0;
1091 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1092 bool bRoundTimed = false;
1093 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Match State")
1094 int32 RoundTimeRemaining = 0;
1095
1096
1097 static FMatchState Empty()
1098 {
1099 const FMatchState EmptyMatchState;
1100 return EmptyMatchState;
1101 }
1102
1103};
1104
1105USTRUCT(BlueprintType)
1106struct FUnlockItemMethod : public FTableRowBase
1107{
1108 GENERATED_BODY()
1109
1110 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1111 bool bRequiresUnlock = false;
1112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1113 int32 RequiredLevel = -1;
1114 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1115 int32 RequiredAchievementID = -1;
1116 //- Mod / Beta Tester / Special Player //
1117 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1118 int32 RequiredPlayerStatusID = -1;
1119
1120};
1121
1122
1123USTRUCT(BlueprintType)
1124struct FProfilePicture : public FTableRowBase
1125{
1126 GENERATED_BODY()
1127
1128 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1129 class UTexture2D* Image = nullptr;
1130 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1131 bool bHasTooltip = false;
1132 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1133 int32 ID = 1;
1134 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1135 FString Name = "Default";
1136 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1137 EUnlockableCategory Category = EUnlockableCategory::Default;
1138 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Profile Picture")
1139 FString Description = "Default Description";
1140
1141};
1142
1143
1144USTRUCT(BlueprintType)
1145struct FAchievement : public FTableRowBase
1146{
1147 GENERATED_BODY()
1148
1149 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1150 int32 ID = 0;
1151 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1152 FString Name = "Default";
1153 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1154 FString Description = "Default Description";
1155 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1156 class UTexture2D* Image = nullptr;
1157 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1158 TArray<bool> Requirements;
1159 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1160 int32 Score = 0;
1161 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1162 bool bHidden = false;
1163
1164 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1165 bool bUnlocked = false;
1166 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1167 float Progress = 0.0f;
1168 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Achievements")
1169 // Reward;
1170
1171 // Implementing the '==' operator for the struct
1172 bool operator==(const FAchievement& Other) const
1173 {
1174 return ID == Other.ID;
1175 }
1176};
1177
1178//- Stats for the current multiplayer game //
1179USTRUCT(BlueprintType)
1180struct FMultiplayerPlayerStats : public FTableRowBase
1181{
1182 GENERATED_BODY()
1183
1184 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1185 FString DisplayName = "Name";
1186 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1187 int32 Kills = 0;
1188 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1189 int32 TeamKills = 0;
1190 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1191 int32 SelfKills = 0;
1192 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1193 int32 Deaths = 0;
1194 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1195 int32 Assists = 0;
1196 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1197 int32 Headshots = 0;
1198 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Mutliplayer")
1199 float XP = 0;
1200
1201 // TArray<FPlayerDeath> Deaths
1202 bool IsValid() const
1203 {
1204 if(DisplayName == "Name"){return false;}
1205 return true;
1206 }
1207 FMultiplayerPlayerStats AddKill()
1208 {
1209 Kills++;
1210 return *this;
1211 }
1212 FMultiplayerPlayerStats AddTeamKill()
1213 {
1214 TeamKills++;
1215 return *this;
1216 }
1217 FMultiplayerPlayerStats AddSelfKill()
1218 {
1219 SelfKills++;
1220 return *this;
1221 }
1222
1223 FMultiplayerPlayerStats AddDeath()
1224 {
1225 Deaths++;
1226 return *this;
1227 }
1228 FMultiplayerPlayerStats AddXP(const float Amount)
1229 {
1230 XP = FMath::Max(0.0f, XP + Amount);
1231 return *this;
1232 }
1233};
1234
1235
1236
1237USTRUCT(BlueprintType)
1238struct FUserProfile : public FTableRowBase
1239{
1240 GENERATED_BODY()
1241
1242 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1243 FString DisplayName = "Name";
1244 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1245 FString Nickname = "Name";
1246 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1247 FString ID = "12";
1248 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1249 int32 ProfilePictureID = 1;
1250 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1251 TArray<int32> Achievements;
1252 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1253 int32 XP = 0;
1254 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1255 int32 QuestsCompleted = 0;
1256 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1257 float TotalPlayTime = 0.0f;
1258 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1259 int32 MatchesWon = 0;
1260 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1261 int32 MatchesPlayed = 0;
1262 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1263 int32 Kills = 0;
1264 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1265 int32 Deaths = 0;
1266 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1267 int32 Assists = 0;
1268 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1269 int32 Headshots = 0;
1270 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1271 float HighestGameScore = 0;
1272 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1273 int32 ChallengesCompleted = 0;
1274 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1275 int32 Collectables = 0;
1276 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1277 FString TopWeapon = "Weapon";
1278 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1279 FString TopCharacter = "Character";
1280
1281 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="User Profile")
1282 bool bReady = false;
1283
1284
1285 //@TODO Create Formula for XP Curve
1286 int32 XPToLevelUp = 1000;//(999 * ((XP + 1) / 100));
1287
1288 bool IsValid() const
1289 {
1290 if(DisplayName == "Name"){return false;}
1291 return true;
1292 }
1293 FUserProfile AddKill()
1294 {
1295 Kills++;
1296 return *this;
1297 }
1298 FUserProfile AddDeath()
1299 {
1300 Deaths++;
1301 return *this;
1302 }
1303 float XPProgress() const
1304 {
1305 return static_cast<float>(XP % XPToLevelUp) / static_cast<float>(XPToLevelUp);
1306 }
1307 FUserProfile AddXP(const int32 Value)
1308 {
1309 XP += Value;
1310 return *this;
1311 }
1312
1313 int32 GetPlayerLevel() const
1314 {
1315 return (XP / XPToLevelUp);
1316 }
1317
1318
1319
1320 // Implementing the '==' operator for the struct
1321 bool operator==(const FUserProfile& Other) const
1322 {
1323 if(DisplayName == Other.DisplayName)
1324 {
1325 return true;
1326 }
1327 // if(ID == Other.ID &&
1328 // DisplayName == Other.DisplayName)
1329 // {
1330 // Result = true;
1331 // }
1332 return false;
1333 }
1334};
EInteractionType
Definition BaseData.h:149
@ Use
Definition InteractionComponent.cpp:798
EBodyPartName
Definition BaseData.h:133
EAIStimuliType
Definition BaseData.h:198
DECLARE_CYCLE_STAT_EXTERN(TEXT("BPLib"), STATGROUP_BaseHelpers_BPLib, STATGROUP_BaseHelpers, BASEHELPERS_API)
ESize
Definition BaseData.h:111
@ ExtraLarge
@ MediumLarge
@ SmallMedium
@ ExtraSmall
DECLARE_LOG_CATEGORY_EXTERN(LogBaseHelpers, Display, All)
EAIActionType
Definition BaseData.h:219
ESoundSource
Definition BaseData.h:73
static int32 XP_PER_LEVEL
Definition BaseData.h:707
static int32 MIN_SKILL_LEVEL
Definition BaseData.h:708
EGameControllerType
Definition BaseData.h:97
EDeathType
Definition BaseData.h:53
EVehicleMode
Definition BaseData.h:124
EDamageType
Definition BaseData.h:33
DECLARE_LOG_CATEGORY_CLASS(LogBasePlayerState, Display, All)
static int32 MAX_SKILL_LEVEL
Definition BaseData.h:706
static int32 DebugCharacterComponents
Definition BaseData.h:28
DECLARE_STATS_GROUP(TEXT("LineOfSight Stat Group"), STATGROUP_LineOfSight, STATCAT_Advanced)
Definition Health.Build.cs:6
Definition Interaction.Build.cs:6
Definition BaseGameplayTags.cpp:52
void AddSkillLevelByName(const FString &Name, const bool bIncrease)
Definition BaseData.h:895
Definition BaseData.h:310
Definition BaseData.h:682
The FCharacterSkill struct represents a skill of a character.
Definition BaseData.h:719
bool AddXP(const float Value)
Definition BaseData.h:751
FCharacterSkill(const FGameplayTag SkillName)
Definition BaseData.h:736
bool AddLevel(const bool bIncrease)
Definition BaseData.h:762
FCharacterSkill(const FGameplayTag SkillName, const int32 StartingLevel)
Definition BaseData.h:740
Definition BaseData.h:670
Definition BaseData.h:420
bool SetInteractionHidden(const EInteractionType Interaction, const bool bValue)
Definition BaseData.h:496
bool GetInteraction(FInteractionType &Type, const EInteractionType Interaction) const
Definition BaseData.h:483
bool SetInteractionAvailable(const EInteractionType Interaction, const bool bValue)
Definition BaseData.h:531
static FInteractionData None()
Definition BaseData.h:583
bool SetInteractionHold(const EInteractionType Interaction, const bool bValue)
Definition BaseData.h:543
void SetOnlyInteractionVisible(const EInteractionType Interaction)
Definition BaseData.h:508
void SetDefault(const EInteractionType Default, const bool bRemoveOthers=true)
Definition BaseData.h:570
void SetOnlyInteractionVisible(const FString &Interaction)
Definition BaseData.h:519
FInteractionData(const EInteractionType Default)
Definition BaseData.h:455
bool operator==(const FInteractionData &Other) const
Definition BaseData.h:591
FInteractionData(const FInteractionType Default, const EAIStimuliType Stimuli)
Definition BaseData.h:465
bool GetDefaultInteraction(FInteractionType &Default) const
Definition BaseData.h:473
TArray< FInteractionType > GetVisibleInteractions() const
Definition BaseData.h:556
FInteractionData(const EInteractionType Default, const EAIStimuliType Stimuli)
Definition BaseData.h:460
Definition BaseData.h:333
static FInteractionType None()
Definition BaseData.h:388
FInteractionType(const FString &CustomText, const bool bShowButtonPrompt)
Definition BaseData.h:382
bool operator==(const FInteractionType &Other) const
Definition BaseData.h:393
FInteractionType(const FString &CustomText)
Definition BaseData.h:377
FInteractionType(const EInteractionType Type, const bool bStartHidden)
Definition BaseData.h:372
FInteractionType(const EInteractionType Type)
Definition BaseData.h:368
Definition BaseData.h:613
Definition BaseData.h:780
Definition BaseData.h:253
FUniqueID()
Definition BaseData.h:273
FUniqueID(const FString &NewID, const int32 NewUniqueID)
Definition BaseData.h:281
bool IsUnique() const
Definition BaseData.h:267
bool operator==(const FUniqueID &Other) const
Definition BaseData.h:294
bool operator!=(const FUniqueID &Other) const
Definition BaseData.h:298
bool IsValid() const
Definition BaseData.h:287
FUniqueID(const FString &NewID)
Definition BaseData.h:277
int32 GetUniqueNumber() const
Definition BaseData.h:263