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

Public Types

enum  SpawnType {
  Item , Block , Cassette , Currency ,
  Category , Filter , Tag , Letter ,
  Map , Perfume , Plan , Potion ,
  Recipe , RedBook , Rod , Rune ,
  RuneFree , Scroll , Skill , Spell ,
  Usuihon
}
 

Public Member Functions

void OnThingCreated (Thing thing)
 
Thing Create (int createLv=-1)
 
override string ToString ()
 
- Public Member Functions inherited from CustomContent
virtual void OnGameLoad (GameIOContext context)
 
virtual void OnGameSave (GameIOContext context)
 
override string ToString ()
 

Static Public Member Functions

static CustomThingContent CreateFromRow (SourceThing.Row r, ModPackage mod=null)
 
- Static Public Member Functions inherited from CustomSourceContent
static string string string[] kv GetParams (string tag)
 
- 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

BlessedState blessedState
 
string id = ""
 
IDTLevel identifyLevel
 
int lv = -1
 
Dictionary< string, int > mapInt = new Dictionary<string, int>()
 
Dictionary< string, string > mapStr = new Dictionary<string, string>()
 
string material = ""
 
bool noCopy
 
bool noRandomSocket
 
int num = 1
 
Rarity rarity
 
bool restock = true
 
List< string > sockets = new List<string>()
 
SpawnType type
 
string priceCalc = ""
 

Properties

override string SourceType [get]
 
- Properties inherited from CustomSourceContent
virtual string SourceType [get]
 
string SourceId [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]
 

Additional Inherited Members

- Static Public Attributes inherited from CustomSourceContent
static string action
 
static string string spec
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 9 of file CustomThingContent.cs.

Member Enumeration Documentation

◆ SpawnType

Member Function Documentation

◆ Create()

Thing CustomThingContent.Create ( int  createLv = -1)
inline

Definition at line 201 of file CustomThingContent.cs.

202 {
203 if (lv != -1)
204 {
205 createLv = lv;
206 }
208 int.TryParse(id, out var result);
209 if (EClass.sources.elements.fuzzyAlias.TryGetValue(id, out var value))
210 {
211 result = EClass.sources.elements.alias[value].id;
212 }
213 Thing thing = null;
214 int idMat = EClass.sources.materials.alias.TryGetValue(material)?.id ?? (-1);
215 switch (type)
216 {
217 case SpawnType.Item:
218 thing = ThingGen.Create(id, idMat, createLv).SetNum(num);
219 break;
220 case SpawnType.Block:
221 {
222 SourceBlock.Row row = EClass.sources.blocks.alias.TryGetValue(id);
223 if (row != null)
224 {
225 thing = ThingGen.CreateBlock(row.id, idMat).SetNum(num);
226 }
227 break;
228 }
229 case SpawnType.Cassette:
230 if (!EClass.core.refs.dictBGM.ContainsKey(result))
231 {
232 result = EClass.core.refs.dictBGM.RandomItem().id;
233 }
234 thing = ThingGen.CreateCassette(result);
235 break;
236 case SpawnType.Currency:
237 thing = ThingGen.CreateCurrency(num, id);
238 break;
239 case SpawnType.Category:
240 thing = ThingGen.CreateFromCategory(id, createLv).SetNum(num);
241 break;
242 case SpawnType.Filter:
243 thing = ThingGen.CreateFromFilter(id, createLv).SetNum(num);
244 break;
245 case SpawnType.Tag:
246 thing = ThingGen.CreateFromTag(id, createLv).SetNum(num);
247 break;
248 case SpawnType.Letter:
249 thing = ThingGen.CreateLetter(id);
250 break;
251 case SpawnType.Map:
252 thing = ThingGen.CreateMap(id, createLv);
253 break;
254 case SpawnType.Perfume:
255 thing = ThingGen.CreatePerfume(result, createLv).SetNum(num);
256 break;
257 case SpawnType.Plan:
258 thing = ThingGen.CreatePlan(result);
259 break;
260 case SpawnType.Potion:
261 thing = ThingGen.CreatePotion(result, num);
262 break;
263 case SpawnType.Recipe:
264 thing = ThingGen.CreateRecipe(id);
265 break;
266 case SpawnType.RedBook:
267 thing = ThingGen.CreateRedBook(id);
268 break;
269 case SpawnType.Rod:
270 thing = ThingGen.CreateRod(result, num);
271 break;
272 case SpawnType.Rune:
273 thing = ThingGen.CreateRune(result, num);
274 break;
275 case SpawnType.RuneFree:
276 thing = ThingGen.CreateRune(result, num, free: true);
277 break;
278 case SpawnType.Scroll:
279 thing = ThingGen.CreateScroll(result, num);
280 break;
281 case SpawnType.Skill:
282 thing = ThingGen.CreateSkillbook(result, num);
283 break;
284 case SpawnType.Spell:
285 thing = ThingGen.CreateSpellbook(result, 1, num);
286 break;
287 case SpawnType.Usuihon:
288 thing = ThingGen.Create("1084");
289 thing.c_idRefName = EClass.game.religions.dictAll.TryGetValue(id)?.id;
290 break;
291 default:
292 thing = ThingGen.Create(id);
293 break;
294 }
295 if (thing == null)
296 {
297 return null;
298 }
299 thing.c_IDTState = (int)identifyLevel;
301 if (!restock)
302 {
303 thing.SetBool(101, enable: true);
304 }
305 if (!priceCalc.IsEmpty())
306 {
307 thing.SetStr("price_calc_override", priceCalc);
308 }
309 return thing;
310 }
static void SetRarity(Rarity q=Rarity.Normal)
Thing SetNum(int a)
Definition: Card.cs:3640
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:4040
void SetStr(string id, string value=null)
Definition: Card.cs:2571
void SetBool(string id, bool enable)
Definition: Card.cs:2546
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:386
CoreRef refs
Definition: Core.cs:51
BlessedState blessedState
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
static SourceManager sources
Definition: EClass.cs:43
ReligionManager religions
Definition: Game.cs:159
Dictionary< string, Religion > dictAll
Dictionary< string, string > fuzzyAlias
SourceMaterial materials
SourceBlock blocks
SourceElement elements
static Thing CreateRune(int ele, int v, bool free=false)
Definition: ThingGen.cs:209
static Thing CreatePotion(int ele, int num=1)
Definition: ThingGen.cs:224
static Thing CreateFromFilter(string id, int lv=-1)
Definition: ThingGen.cs:63
static Thing CreateMap(string idSource=null, int lv=-1)
Definition: ThingGen.cs:132
static Thing CreatePerfume(int ele, int num=1)
Definition: ThingGen.cs:231
static Thing CreateBlock(int id, int idMat)
Definition: ThingGen.cs:101
static Thing CreateRedBook(string id, int num=1)
Definition: ThingGen.cs:175
static Thing CreateCassette(int id)
Definition: ThingGen.cs:238
static Thing CreateSpellbook(string alias, int num=1)
Definition: ThingGen.cs:159
static Thing CreatePlan(int ele)
Definition: ThingGen.cs:145
static Thing CreateFromTag(string idTag, int lv=-1)
Definition: ThingGen.cs:80
static Thing CreateRecipe(string id)
Definition: ThingGen.cs:152
static Thing CreateSkillbook(int ele, int num=1)
Definition: ThingGen.cs:183
static Thing CreateFromCategory(string idCat, int lv=-1)
Definition: ThingGen.cs:75
static Thing CreateLetter(string idLetter)
Definition: ThingGen.cs:245
static Thing CreateScroll(int ele, int num=1)
Definition: ThingGen.cs:190
static Thing CreateCurrency(int a, string id="money")
Definition: ThingGen.cs:37
static Thing CreateRod(int ele, int charge=-1)
Definition: ThingGen.cs:217
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
int id
Definition: TileRow.cs:8

References blessedState, SourceManager.blocks, EClass.core, ThingGen.Create(), ThingGen.CreateBlock(), ThingGen.CreateCassette(), ThingGen.CreateCurrency(), ThingGen.CreateFromCategory(), ThingGen.CreateFromFilter(), ThingGen.CreateFromTag(), ThingGen.CreateLetter(), ThingGen.CreateMap(), ThingGen.CreatePerfume(), ThingGen.CreatePlan(), ThingGen.CreatePotion(), ThingGen.CreateRecipe(), ThingGen.CreateRedBook(), ThingGen.CreateRod(), ThingGen.CreateRune(), ThingGen.CreateScroll(), ThingGen.CreateSkillbook(), ThingGen.CreateSpellbook(), ReligionManager.dictAll, CoreRef.dictBGM, SourceManager.elements, SourceElement.fuzzyAlias, EClass.game, TileRow.id, identifyLevel, lv, material, SourceManager.materials, num, priceCalc, rarity, Core.refs, Game.religions, restock, Card.SetBlessedState(), Card.SetBool(), Card.SetNum(), CardBlueprint.SetRarity(), Card.SetStr(), EClass.sources, and type.

Referenced by CustomMerchantStock.Generate().

◆ CreateFromRow()

static CustomThingContent CustomThingContent.CreateFromRow ( SourceThing::Row  r,
ModPackage  mod = null 
)
inlinestatic

Definition at line 73 of file CustomThingContent.cs.

74 {
75 CustomThingContent customThingContent = new CustomThingContent
76 {
77 ContentId = "Thing/" + r.id,
78 SourceId = r.id,
79 Owner = mod,
80 id = r.id
81 };
82 string[] tag = r.tag;
83 for (int i = 0; i < tag.Length; i++)
84 {
85 var (text, item, array) = CustomSourceContent.GetParams(tag[i]);
86 switch (text)
87 {
88 case "forceRarity":
89 customThingContent.rarity = r.quality.ToEnum<Rarity>();
90 break;
91 case "noCopy":
92 if (r.elements.Contains(759))
93 {
94 customThingContent.noCopy = true;
95 }
96 break;
97 case "noRandomSocket":
98 customThingContent.noRandomSocket = true;
99 break;
100 case "noRestock":
101 customThingContent.restock = false;
102 break;
103 case "addSocket":
104 customThingContent.sockets.Add(item);
105 break;
106 case "addFlag":
107 case "addInt":
108 customThingContent.mapInt[array[0]] = array.TryGet(1, returnNull: true)?.ToInt() ?? 1;
109 break;
110 case "addFlagValue":
111 case "addStr":
112 if (!array.TryGet(1, returnNull: true).IsEmpty())
113 {
114 customThingContent.mapStr[array[0]] = array[1];
115 }
116 break;
117 }
118 }
119 return customThingContent;
120 }
Rarity
Definition: Rarity.cs:2
int quality
Definition: CardRow.cs:19
int[] elements
Definition: CardRow.cs:21
string id
Definition: CardRow.cs:7
string ContentId
Definition: CustomContent.cs:6
static string string string[] kv GetParams(string tag)
List< string > sockets
Dictionary< string, int > mapInt
Dictionary< string, string > mapStr
string[] tag
Definition: RenderRow.cs:58

References CustomContent.ContentId, CustomSourceContent.GetParams(), item, mapInt, mapStr, CustomContent.Owner, sockets, and CustomSourceContent.SourceId.

Referenced by ModPackage.GenerateCustomContentProfiles().

◆ OnThingCreated()

void CustomThingContent.OnThingCreated ( Thing  thing)
inline

Definition at line 122 of file CustomThingContent.cs.

123 {
124 if (thing.GetBool("custom_content") || thing.id != base.SourceId)
125 {
126 return;
127 }
128 thing.SetBool("custom_content", enable: true);
129 thing.SetStr("custom_content_id", base.ContentId);
130 thing.SetStr("custom_content_package", base.Owner.id);
131 string key2;
132 foreach (KeyValuePair<string, string> item in mapStr)
133 {
134 item.Deconstruct(out var key, out key2);
135 string text = key;
136 string value = key2;
137 thing.SetStr(text, value);
138 }
139 foreach (KeyValuePair<string, int> item2 in mapInt)
140 {
141 item2.Deconstruct(out key2, out var value2);
142 string text2 = key2;
143 int value3 = value2;
144 thing.SetInt(text2, value3);
145 }
146 thing.ChangeRarity(rarity);
147 if (noCopy)
148 {
149 EClass.core.actionsNextFrame.Add(delegate
150 {
151 thing.elements?.SetBase(759, 10);
152 });
153 }
154 if (sockets.Count <= 0)
155 {
156 return;
157 }
158 if (noRandomSocket)
159 {
160 thing.sockets.Clear();
161 }
162 int num = 0;
163 foreach (string socket in sockets)
164 {
165 thing.AddSocket();
166 if (socket.IsEmpty())
167 {
168 num++;
169 }
170 else
171 {
172 ApplyRangedSocket(socket);
173 }
174 }
175 thing.sockets.RemoveAll((int s) => s == 0);
176 for (int i = 0; i < num; i++)
177 {
178 thing.sockets.Add(0);
179 }
180 void ApplyRangedSocket(string socket)
181 {
182 int num2 = 3 + Mathf.Min(thing.genLv / 10, 15);
183 if (!EClass.sources.elements.alias.TryGetValue(socket, out var value4))
184 {
185 ModUtil.LogModError("source thing row '" + base.ContentId + "' has invalid addSocket spec '" + socket + "'", base.Owner);
186 }
187 else
188 {
189 float num3 = Mathf.Sqrt((float)(thing.genLv * value4.encFactor) / 100f);
190 float num4 = (float)num2 + num3;
191 int num5 = (value4.mtp + EClass.rnd(value4.mtp + (int)num4)) / value4.mtp;
192 if (value4.encFactor == 0 && num5 > 25)
193 {
194 num5 = 25;
195 }
196 thing.ApplySocket(value4.id, num5);
197 }
198 }
199 }
List< Action > actionsNextFrame
Definition: BaseCore.cs:31
void AddSocket()
Definition: Card.cs:3686
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
void SetInt(string id, int value=0)
Definition: Card.cs:2561
void ApplySocket(Thing t)
Definition: Card.cs:3695
bool GetBool(string id)
Definition: Card.cs:2541
int genLv
Definition: Card.cs:197
virtual void ChangeRarity(Rarity q)
Definition: Card.cs:4065
List< int > sockets
Definition: Card.cs:48
static int rnd(long a)
Definition: EClass.cs:59
Element SetBase(string alias, int v, int potential=0)

References BaseCore.actionsNextFrame, EClass.core, SourceManager.elements, Card.GetBool(), Card.id, item, mapInt, mapStr, noCopy, noRandomSocket, num, rarity, EClass.rnd(), Card.SetBool(), Card.SetStr(), sockets, and EClass.sources.

◆ ToString()

override string CustomThingContent.ToString ( )
inline

Definition at line 312 of file CustomThingContent.cs.

313 {
314 StringBuilder stringBuilder = new StringBuilder();
315 stringBuilder.AppendLine($"{base.ContentId}/{type}/{base.Owner.id}");
316 stringBuilder.AppendLine($" - num({num})/lv({lv})/restock({restock})/noCopy({noCopy})/{material}/{rarity}/{blessedState}/{identifyLevel}");
317 if (sockets.Count > 0)
318 {
319 stringBuilder.AppendLine($" - sockets({sockets.Count})/noRandomSocket({noRandomSocket})/{string.Join(';', sockets)}");
320 }
321 if (mapStr.Count > 0)
322 {
323 stringBuilder.AppendLine(" - str/" + string.Join(';', mapStr.Select((KeyValuePair<string, string> kv) => kv.Key + "=" + kv.Value)));
324 }
325 if (mapInt.Count > 0)
326 {
327 stringBuilder.AppendLine(" - int/" + string.Join(';', mapInt.Select((KeyValuePair<string, int> kv) => $"{kv.Key}={kv.Value}")));
328 }
329 return stringBuilder.ToString();
330 }
$
Definition: ModManager.cs:76

References $, mapInt, mapStr, and sockets.

Member Data Documentation

◆ blessedState

BlessedState CustomThingContent.blessedState

Definition at line 37 of file CustomThingContent.cs.

Referenced by Create().

◆ id

string CustomThingContent.id = ""

Definition at line 39 of file CustomThingContent.cs.

◆ identifyLevel

IDTLevel CustomThingContent.identifyLevel

Definition at line 42 of file CustomThingContent.cs.

Referenced by Create().

◆ lv

int CustomThingContent.lv = -1

Definition at line 44 of file CustomThingContent.cs.

Referenced by Create().

◆ mapInt

Dictionary<string, int> CustomThingContent.mapInt = new Dictionary<string, int>()

Definition at line 46 of file CustomThingContent.cs.

Referenced by CreateFromRow(), OnThingCreated(), and ToString().

◆ mapStr

Dictionary<string, string> CustomThingContent.mapStr = new Dictionary<string, string>()

Definition at line 48 of file CustomThingContent.cs.

Referenced by CreateFromRow(), OnThingCreated(), and ToString().

◆ material

string CustomThingContent.material = ""

Definition at line 50 of file CustomThingContent.cs.

Referenced by Create().

◆ noCopy

bool CustomThingContent.noCopy

Definition at line 52 of file CustomThingContent.cs.

Referenced by OnThingCreated().

◆ noRandomSocket

bool CustomThingContent.noRandomSocket

Definition at line 54 of file CustomThingContent.cs.

Referenced by OnThingCreated().

◆ num

int CustomThingContent.num = 1

Definition at line 56 of file CustomThingContent.cs.

Referenced by Create(), and OnThingCreated().

◆ priceCalc

string CustomThingContent.priceCalc = ""

Definition at line 69 of file CustomThingContent.cs.

Referenced by Create().

◆ rarity

Rarity CustomThingContent.rarity

Definition at line 59 of file CustomThingContent.cs.

Referenced by Create(), and OnThingCreated().

◆ restock

bool CustomThingContent.restock = true

Definition at line 62 of file CustomThingContent.cs.

Referenced by Create().

◆ sockets

List<string> CustomThingContent.sockets = new List<string>()

Definition at line 64 of file CustomThingContent.cs.

Referenced by CreateFromRow(), OnThingCreated(), and ToString().

◆ type

SpawnType CustomThingContent.type

Definition at line 67 of file CustomThingContent.cs.

Referenced by Create().

Property Documentation

◆ SourceType

override string CustomThingContent.SourceType
get

Definition at line 71 of file CustomThingContent.cs.


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