Class Ext_TraitBase extends Object abstract config(ServerExt) DependsOn(ExtWebAdmin_UI); var array WebConfigs; var() class TraitGroup; // With groups you can prevent player from buying multiple traits of same group. var() localized string TraitName,Description; // UI name. var() byte NumLevels; // Maximum number of levels. var config array LevelCosts; var() array DefLevelCosts; // Point price tag for each level. var() class TraitData; // Optional additional data that this trait requires for each player. var config int MinLevel; // Minimum perk level player needs to be in order to be allowed to get this trait. var() int DefMinLevel; var() const byte LoadPriority; // Order of loading the trait class, if for example one trait depends on progress of another trait. var() class SupportedPerk; // Only functions on this perk. // Config init stuff. var config int ConfigVersion; var const int CurrentConfigVer; var config bool bDisabled; // This trait is currently disabled on server. var() bool bGroupLimitToOne, // TraitGroup should limit so you can only buy one of them. bHighPriorityDeath, // Should receive PreventDeath call before any other trait. bPostApplyEffect; // Apply effects on second pass (relies on that another trait is activated first). // Check if trait is enabled and usable on this perk. static function bool IsEnabled(Ext_PerkBase Perk) { return !Default.bDisabled && (Default.SupportedPerk==None || ClassIsChildOf(Perk.Class,Default.SupportedPerk)); } // Check if player meets the requirements to buy this trait. static function bool MeetsRequirements(byte Lvl, Ext_PerkBase Perk) { // First check level. if (Perk.CurrentLevel0) S = "Min perk level: #{FF4000}"$Default.MinLevel$"#{DEF}|"$S; // TODO: Localization return Default.Description$"||"$S; } // Return tooltip description of this trait static function string GetTooltipInfo() { return Default.TraitName$"|"$Default.Description; } // Return level specific trait prices. static function int GetTraitCost(byte LevelNum) { if (Default.LevelCosts.Length>0) { if (LevelNum DamType, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data); // Give/modify default inventory. static function AddDefaultInventory(KFPawn Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data); // Data that server should replicate to client. static final function string IntToStr(int Value, optional byte MaxVal) // Helper function to put integer into one character of string. { switch (MaxVal) { case 0: // 0-65535 return Chr(Max(Value,0)+1); case 1: // 0-1073741823 return Chr((Value & 32767)+1) $ Chr(((Value >> 15) & 32767)+1); } } static final function string InlineString(string Str) // Helper function to append a string line to a text using a length char in front. { return IntToStr(Len(Str))$Str; } static final function int StrToInt(out string Value, optional byte MaxVal) // Reverse. { local int Res; switch (MaxVal) { case 0: // 0-65535 Res = Asc(Left(Value,1))-1; Value = Mid(Value,1); break; case 1: // 0-1073741823 Res =(Asc(Mid(Value,0,1))-1) | ((Asc(Mid(Value,1,1)) << 15)-1); Value = Mid(Value,2); break; } return Res; } static final function string GetInlineStr(out string S) // Reverse. { local int l; local string Res; l = StrToInt(S); Res = Left(S,l); S = Mid(S,l); return Res; } static function string GetRepData() { local string S; local int i; S = IntToStr(Default.MinLevel)$IntToStr(Default.LevelCosts.Length); for (i=0; i