Elin Decompiled Documentation EA 23.312 Nightly Patch 4
Loading...
Searching...
No Matches
CustomMerchantStock Class Reference
Inheritance diagram for CustomMerchantStock:
CustomFileContent CustomContent EClass

Public Member Functions

List< ThingGenerate (Card owner)
 
override string ToString ()
 
- Public Member Functions inherited from CustomFileContent
bool HasFileChanged ()
 
virtual void OnSetLang (string lang)
 
void Load ()
 
- Public Member Functions inherited from CustomContent
virtual void OnGameLoad (GameIOContext context)
 
virtual void OnGameSave (GameIOContext context)
 
override string ToString ()
 

Static Public Member Functions

static CustomMerchantStock CreateFromId (string stockId, ModPackage owner)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

List< CustomThingContentitems = new List<CustomThingContent>()
 

Protected Member Functions

override void LoadContent ()
 
abstract void LoadContent ()
 

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from CustomFileContent
DateTime LastModified = DateTime.MinValue [get, set]
 
FileInfo File [get, set]
 
- Properties inherited from CustomContent
string ContentId [get, protected set]
 
EMod Owner [get, protected set]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 8 of file CustomMerchantStock.cs.

Member Function Documentation

◆ CreateFromId()

static CustomMerchantStock CustomMerchantStock.CreateFromId ( string  stockId,
ModPackage  owner 
)
inlinestatic

Definition at line 33 of file CustomMerchantStock.cs.

34 {
35 var (fileInfo, eMod) = PackageIterator.GetFilesEx("Data/stock_" + stockId + ".json").LastOrDefault();
36 if (fileInfo == null)
37 {
38 return null;
39 }
40 if (owner == null)
41 {
42 owner = eMod as ModPackage;
43 }
44 return new CustomMerchantStock
45 {
46 ContentId = "MerchantStock/" + stockId,
47 Owner = owner,
48 File = fileInfo
49 };
50 }
string ContentId
Definition: CustomContent.cs:6

References CustomContent.ContentId, CustomFileContent.File, and CustomContent.Owner.

Referenced by CustomCharaContent.CreateFromRow().

◆ Generate()

List< Thing > CustomMerchantStock.Generate ( Card  owner)
inline

Definition at line 12 of file CustomMerchantStock.cs.

13 {
14 Load();
15 List<Thing> list = new List<Thing>();
16 int createLv = owner?.trait?.ShopLv ?? (-1);
17 foreach (CustomThingContent item2 in items)
18 {
19 try
20 {
21 Thing item = item2.Create(createLv);
22 list.Add(item);
23 }
24 catch (Exception ex)
25 {
26 ModUtil.LogModError("can't create stock item '" + item2.ContentId + "'\n" + ex.Message, base.Owner);
27 Debug.LogError(ex);
28 }
29 }
30 return list;
31 }
Trait trait
Definition: Card.cs:54
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3221
List< CustomThingContent > items
Thing Create(int createLv=-1)
Definition: Thing.cs:8
virtual int ShopLv
Definition: Trait.cs:525

References Card.Add(), CustomContent.ContentId, CustomThingContent.Create(), Debug, item, items, CustomFileContent.Load(), Trait.ShopLv, and Card.trait.

◆ LoadContent()

override void CustomMerchantStock.LoadContent ( )
inlineprotectedvirtual

Implements CustomFileContent.

Definition at line 52 of file CustomMerchantStock.cs.

53 {
54 CustomMerchantStock customMerchantStock = IO.LoadFile<CustomMerchantStock>(base.File.FullName);
55 items = customMerchantStock.items;
56 }
Definition: IO.cs:11

References items.

◆ ToString()

override string CustomMerchantStock.ToString ( )
inline

Definition at line 58 of file CustomMerchantStock.cs.

59 {
60 return $"{base.ContentId}/items({items.Count})";
61 }
$
Definition: ModManager.cs:76

References $.

Member Data Documentation

◆ items

List<CustomThingContent> CustomMerchantStock.items = new List<CustomThingContent>()

Definition at line 10 of file CustomMerchantStock.cs.

Referenced by Generate(), and LoadContent().


The documentation for this class was generated from the following file: