Elin Modding Docs Doc
All Classes Namespaces
Element.2.cs
1using System;
2using System.Collections.Generic;
3using System.Runtime.CompilerServices;
4using UnityEngine;
5using UnityEngine.UI;
6
7// Token: 0x020002F7 RID: 759
8public class Element : EClass
9{
10 // Token: 0x0600178C RID: 6028 RVA: 0x00098C45 File Offset: 0x00096E45
11 public static string GetName(string alias)
12 {
13 return EClass.sources.elements.alias[alias].GetName();
14 }
15
16 // Token: 0x0600178D RID: 6029 RVA: 0x00098C61 File Offset: 0x00096E61
17 public static SourceElement.Row Get(int id)
18 {
19 return EClass.sources.elements.map[id];
20 }
21
22 // Token: 0x0600178E RID: 6030 RVA: 0x00098C78 File Offset: 0x00096E78
23 public virtual SourceElement.Row GetSource()
24 {
25 return EClass.sources.elements.alias.TryGetValue(base.GetType().ToString(), null);
26 }
27
28 // Token: 0x17000689 RID: 1673
29 // (get) Token: 0x0600178F RID: 6031 RVA: 0x00098C9C File Offset: 0x00096E9C
30 public SourceElement.Row source
31 {
32 get
33 {
34 SourceElement.Row result;
35 if ((result = this._source) == null)
36 {
37 result = (this._source = (((this.id == 0) ? this.GetSource() : Element.Get(this.id)) ?? EClass.sources.elements.rows[0]));
38 }
39 return result;
40 }
41 }
42
43 // Token: 0x1700068A RID: 1674
44 // (get) Token: 0x06001790 RID: 6032 RVA: 0x00098CF0 File Offset: 0x00096EF0
45 public virtual int DisplayValue
46 {
47 get
48 {
49 return this.Value;
50 }
51 }
52
53 // Token: 0x1700068B RID: 1675
54 // (get) Token: 0x06001791 RID: 6033 RVA: 0x00098CF8 File Offset: 0x00096EF8
55 public virtual int MinValue
56 {
57 get
58 {
59 return -100;
60 }
61 }
62
63 // Token: 0x1700068C RID: 1676
64 // (get) Token: 0x06001792 RID: 6034 RVA: 0x00098CFC File Offset: 0x00096EFC
65 public int Value
66 {
67 get
68 {
69 return this.ValueWithoutLink + this.vLink + ((this.owner != null) ? this.owner.ValueBonus(this) : 0);
70 }
71 }
72
73 // Token: 0x1700068D RID: 1677
74 // (get) Token: 0x06001793 RID: 6035 RVA: 0x00098D23 File Offset: 0x00096F23
75 public int ValueWithoutLink
76 {
77 get
78 {
79 return this.vBase + this.vSource;
80 }
81 }
82
83 // Token: 0x1700068E RID: 1678
84 // (get) Token: 0x06001794 RID: 6036 RVA: 0x00098D32 File Offset: 0x00096F32
85 public virtual int MinPotential
86 {
87 get
88 {
89 return 100;
90 }
91 }
92
93 // Token: 0x1700068F RID: 1679
94 // (get) Token: 0x06001795 RID: 6037 RVA: 0x00098D36 File Offset: 0x00096F36
95 public int Potential
96 {
97 get
98 {
99 return this.vPotential + this.vTempPotential + this.vSourcePotential + this.MinPotential;
100 }
101 }
102
103 // Token: 0x17000690 RID: 1680
104 // (get) Token: 0x06001796 RID: 6038 RVA: 0x00098D53 File Offset: 0x00096F53
105 public virtual bool CanGainExp
106 {
107 get
108 {
109 return this.ValueWithoutLink > 0;
110 }
111 }
112
113 // Token: 0x17000691 RID: 1681
114 // (get) Token: 0x06001797 RID: 6039 RVA: 0x00098D5E File Offset: 0x00096F5E
115 public bool IsFlag
116 {
117 get
118 {
119 return this.source.tag.Contains("flag");
120 }
121 }
122
123 // Token: 0x06001798 RID: 6040 RVA: 0x00098D75 File Offset: 0x00096F75
124 public virtual int GetSourcePotential(int v)
125 {
126 return 0;
127 }
128
129 // Token: 0x06001799 RID: 6041 RVA: 0x00098D78 File Offset: 0x00096F78
130 public virtual Sprite GetSprite()
131 {
132 return null;
133 }
134
135 // Token: 0x0600179A RID: 6042 RVA: 0x00098D7C File Offset: 0x00096F7C
136 public int GetMaterialSourceValue(Thing t, int v)
137 {
138 if (this.id == 2)
139 {
140 return v;
141 }
142 if (!this.IsTrait)
143 {
144 return v * (100 + t.encLV * 10) / 100;
145 }
146 if (t.IsFurniture)
147 {
148 return v;
149 }
150 return Mathf.Min(v + t.encLV * 10, 60);
151 }
152
153 // Token: 0x0600179B RID: 6043 RVA: 0x00098DCC File Offset: 0x00096FCC
154 public virtual int GetSourceValue(int v, int lv, SourceValueType type)
155 {
156 if (type == SourceValueType.Chara)
157 {
158 return v * (100 + (lv - 1 + EClass.rnd(lv / 2 + 1)) * this.source.lvFactor / 10) / 100 + EClass.rnd(lv / 3) * this.source.lvFactor / 100;
159 }
160 if (type != SourceValueType.Fixed)
161 {
162 return v * ((this.source.encFactor == 0) ? 100 : (50 + EClass.rnd(100) + EClass.rnd((int)Mathf.Sqrt((float)(lv * 100))) * this.source.encFactor / 100)) / 100;
163 }
164 return v;
165 }
166
167 // Token: 0x17000692 RID: 1682
168 // (get) Token: 0x0600179C RID: 6044 RVA: 0x00098E60 File Offset: 0x00097060
169 public virtual string Name
170 {
171 get
172 {
173 return this.source.GetName();
174 }
175 }
176
177 // Token: 0x17000693 RID: 1683
178 // (get) Token: 0x0600179D RID: 6045 RVA: 0x00098E6D File Offset: 0x0009706D
179 public virtual string FullName
180 {
181 get
182 {
183 return this.Name;
184 }
185 }
186
187 // Token: 0x0600179E RID: 6046 RVA: 0x00098E78 File Offset: 0x00097078
188 public virtual Sprite GetIcon(string suffix = "")
189 {
190 Sprite result;
191 if ((result = SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "ele_" + this.source.alias + suffix)) == null)
192 {
193 result = (SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "ele_" + this.source.aliasParent + suffix) ?? SpriteSheet.Get("Media/Graphics/Icon/Element/icon_elements", "cat_" + this.source.category));
194 }
195 return result;
196 }
197
198 // Token: 0x17000694 RID: 1684
199 // (get) Token: 0x0600179F RID: 6047 RVA: 0x00098EEC File Offset: 0x000970EC
200 public virtual int ExpToNext
201 {
202 get
203 {
204 return 1000;
205 }
206 }
207
208 // Token: 0x17000695 RID: 1685
209 // (get) Token: 0x060017A0 RID: 6048 RVA: 0x00098EF3 File Offset: 0x000970F3
210 public virtual bool UseExpMod
211 {
212 get
213 {
214 return true;
215 }
216 }
217
218 // Token: 0x17000696 RID: 1686
219 // (get) Token: 0x060017A1 RID: 6049 RVA: 0x00098EF6 File Offset: 0x000970F6
220 public virtual int CostTrain
221 {
222 get
223 {
224 return Mathf.Max((this.ValueWithoutLink / 10 + 5) * (100 + this.vTempPotential) / 500, 1);
225 }
226 }
227
228 // Token: 0x17000697 RID: 1687
229 // (get) Token: 0x060017A2 RID: 6050 RVA: 0x00098F19 File Offset: 0x00097119
230 public virtual int CostLearn
231 {
232 get
233 {
234 return 5;
235 }
236 }
237
238 // Token: 0x17000698 RID: 1688
239 // (get) Token: 0x060017A3 RID: 6051 RVA: 0x00098F1C File Offset: 0x0009711C
240 public virtual bool ShowXP
241 {
242 get
243 {
244 return EClass.debug.showExtra || this.source.category != "attribute";
245 }
246 }
247
248 // Token: 0x17000699 RID: 1689
249 // (get) Token: 0x060017A4 RID: 6052 RVA: 0x00098F41 File Offset: 0x00097141
250 public virtual bool ShowMsgOnValueChanged
251 {
252 get
253 {
254 return true;
255 }
256 }
257
258 // Token: 0x1700069A RID: 1690
259 // (get) Token: 0x060017A5 RID: 6053 RVA: 0x00098F44 File Offset: 0x00097144
260 public virtual bool ShowValue
261 {
262 get
263 {
264 return true;
265 }
266 }
267
268 // Token: 0x1700069B RID: 1691
269 // (get) Token: 0x060017A6 RID: 6054 RVA: 0x00098F47 File Offset: 0x00097147
270 public virtual bool ShowPotential
271 {
272 get
273 {
274 return true;
275 }
276 }
277
278 // Token: 0x1700069C RID: 1692
279 // (get) Token: 0x060017A7 RID: 6055 RVA: 0x00098F4A File Offset: 0x0009714A
280 public virtual bool UsePotential
281 {
282 get
283 {
284 return true;
285 }
286 }
287
288 // Token: 0x1700069D RID: 1693
289 // (get) Token: 0x060017A8 RID: 6056 RVA: 0x00098F4D File Offset: 0x0009714D
290 public virtual bool PotentialAsStock
291 {
292 get
293 {
294 return false;
295 }
296 }
297
298 // Token: 0x1700069E RID: 1694
299 // (get) Token: 0x060017A9 RID: 6057 RVA: 0x00098F50 File Offset: 0x00097150
300 public virtual bool ShowRelativeAttribute
301 {
302 get
303 {
304 return false;
305 }
306 }
307
308 // Token: 0x1700069F RID: 1695
309 // (get) Token: 0x060017AA RID: 6058 RVA: 0x00098F53 File Offset: 0x00097153
310 public virtual string ShortName
311 {
312 get
313 {
314 return this.Name;
315 }
316 }
317
318 // Token: 0x170006A0 RID: 1696
319 // (get) Token: 0x060017AB RID: 6059 RVA: 0x00098F5B File Offset: 0x0009715B
320 public bool IsGlobalElement
321 {
322 get
323 {
324 return this.vExp == -1 || this.vExp == -2;
325 }
326 }
327
328 // Token: 0x170006A1 RID: 1697
329 // (get) Token: 0x060017AC RID: 6060 RVA: 0x00098F72 File Offset: 0x00097172
330 public bool IsFactionWideElement
331 {
332 get
333 {
334 return this.vExp == -1;
335 }
336 }
337
338 // Token: 0x170006A2 RID: 1698
339 // (get) Token: 0x060017AD RID: 6061 RVA: 0x00098F7D File Offset: 0x0009717D
340 public bool IsPartyWideElement
341 {
342 get
343 {
344 return this.vExp == -2;
345 }
346 }
347
348 // Token: 0x060017AE RID: 6062 RVA: 0x00098F8C File Offset: 0x0009718C
349 public int SortVal(bool charaSheet = false)
350 {
351 int num = (this.source.sort != 0) ? this.source.sort : this.id;
352 return (this.IsFlag ? 100000 : 0) + ((!charaSheet && this.IsGlobalElement) ? -1000000 : 0) + num;
353 }
354
355 // Token: 0x060017AF RID: 6063 RVA: 0x00098FE0 File Offset: 0x000971E0
356 public virtual bool CanLink(ElementContainer owner)
357 {
358 return false;
359 }
360
361 // Token: 0x170006A3 RID: 1699
362 // (get) Token: 0x060017B0 RID: 6064 RVA: 0x00098FE3 File Offset: 0x000971E3
363 public virtual bool ShowEncNumber
364 {
365 get
366 {
367 return true;
368 }
369 }
370
371 // Token: 0x170006A4 RID: 1700
372 // (get) Token: 0x060017B1 RID: 6065 RVA: 0x00098FE6 File Offset: 0x000971E6
373 public bool IsTrait
374 {
375 get
376 {
377 return this.source.tag.Contains("trait");
378 }
379 }
380
381 // Token: 0x170006A5 RID: 1701
382 // (get) Token: 0x060017B2 RID: 6066 RVA: 0x00098FFD File Offset: 0x000971FD
383 public bool IsFoodTrait
384 {
385 get
386 {
387 return !this.source.foodEffect.IsEmpty();
388 }
389 }
390
391 // Token: 0x170006A6 RID: 1702
392 // (get) Token: 0x060017B3 RID: 6067 RVA: 0x00099012 File Offset: 0x00097212
393 public bool IsFoodTraitMain
394 {
395 get
396 {
397 return this.IsFoodTrait && (this.source.tag.Contains("primary") || this.source.tag.Contains("foodpot"));
398 }
399 }
400
401 // Token: 0x170006A7 RID: 1703
402 // (get) Token: 0x060017B4 RID: 6068 RVA: 0x0009904C File Offset: 0x0009724C
403 public bool IsMainAttribute
404 {
405 get
406 {
407 return this.source.category == "attribute" && this.source.tag.Contains("primary");
408 }
409 }
410
411 // Token: 0x170006A8 RID: 1704
412 // (get) Token: 0x060017B5 RID: 6069 RVA: 0x0009907C File Offset: 0x0009727C
413 public Act act
414 {
415 get
416 {
417 return (this as Act) ?? ACT.Create(this.id);
418 }
419 }
420
421 // Token: 0x060017B6 RID: 6070 RVA: 0x00099093 File Offset: 0x00097293
422 public bool HasTag(string tag)
423 {
424 return this.source.tag.Contains(tag);
425 }
426
427 // Token: 0x060017B7 RID: 6071 RVA: 0x000990A8 File Offset: 0x000972A8
428 public void SetImage(Image i)
429 {
430 Sprite icon = this.GetIcon("");
431 if (icon)
432 {
433 i.sprite = icon;
434 i.SetNativeSize();
435 }
436 }
437
438 // Token: 0x060017B8 RID: 6072 RVA: 0x000990D6 File Offset: 0x000972D6
439 public virtual string GetDetail()
440 {
441 return this.source.GetDetail();
442 }
443
444 // Token: 0x060017B9 RID: 6073 RVA: 0x000990E4 File Offset: 0x000972E4
445 public bool IsFactionElement(Chara c)
446 {
447 if (c == null)
448 {
449 return false;
450 }
451 if (c.IsPCFaction)
452 {
453 foreach (Element element in EClass.pc.faction.charaElements.dict.Values)
454 {
455 if (element.id == this.id && element.Value > 0)
456 {
457 return true;
458 }
459 }
460 }
461 if (c.faithElements != null)
462 {
463 foreach (Element element2 in c.faithElements.dict.Values)
464 {
465 if (element2.id == this.id && element2.Value > 0)
466 {
467 return true;
468 }
469 }
470 }
471 return false;
472 }
473
474 // Token: 0x060017BA RID: 6074 RVA: 0x000991D8 File Offset: 0x000973D8
475 public Element GetParent(Card c)
476 {
477 if (!this.source.aliasParent.IsEmpty())
478 {
479 return c.elements.GetOrCreateElement(this.source.aliasParent);
480 }
481 return null;
482 }
483
484 // Token: 0x060017BB RID: 6075 RVA: 0x00099204 File Offset: 0x00097404
485 public static Dictionary<int, int> GetElementMap(int[] list)
486 {
487 Dictionary<int, int> dictionary = new Dictionary<int, int>();
488 if (list != null)
489 {
490 for (int i = 0; i < list.Length / 2; i++)
491 {
492 dictionary[list[i * 2]] = list[i * 2 + 1];
493 }
494 }
495 return dictionary;
496 }
497
498 // Token: 0x060017BC RID: 6076 RVA: 0x00099240 File Offset: 0x00097440
499 public static Dictionary<int, int> GetElementMap(int[] list, Dictionary<int, int> map)
500 {
501 if (list != null)
502 {
503 for (int i = 0; i < list.Length / 2; i++)
504 {
505 map[list[i * 2]] = list[i * 2 + 1];
506 }
507 }
508 return map;
509 }
510
511 // Token: 0x060017BD RID: 6077 RVA: 0x00099274 File Offset: 0x00097474
512 public static SourceElement.Row GetRandomElement(int lv = 1)
513 {
514 if (Element.ListElements.Count == 0)
515 {
516 foreach (SourceElement.Row row in EClass.sources.elements.rows)
517 {
518 if (row.categorySub == "eleAttack" && row.chance > 0)
519 {
520 Element.ListElements.Add(row);
521 }
522 }
523 }
524 List<Tuple<SourceElement.Row, int>> list = new List<Tuple<SourceElement.Row, int>>();
525 foreach (SourceElement.Row row2 in Element.ListElements)
526 {
527 int num = 40 * (row2.eleP - 100) / 100;
528 if (list.Count == 0 || num < lv)
529 {
530 list.Add(new Tuple<SourceElement.Row, int>(row2, num));
531 }
532 }
533 return list.RandomItemWeighted((Tuple<SourceElement.Row, int> a) => (float)(10000 / (100 + (lv - a.Item2) * 25))).Item1;
534 }
535
536 // Token: 0x060017BE RID: 6078 RVA: 0x00099394 File Offset: 0x00097594
537 public void WriteNote(UINote n, ElementContainer owner = null, Action<UINote> onWriteNote = null)
538 {
539 n.Clear();
540 this._WriteNote(n, owner, onWriteNote, false, true);
541 n.Build();
542 }
543
544 // Token: 0x060017BF RID: 6079 RVA: 0x000993AD File Offset: 0x000975AD
545 public void WriteNoteWithRef(UINote n, ElementContainer owner, Action<UINote> onWriteNote, Element refEle)
546 {
547 n.Clear();
548 this._WriteNote(n, owner, onWriteNote, false, true);
549 refEle._WriteNote(n, owner, onWriteNote, true, true);
550 n.Build();
551 }
552
553 // Token: 0x060017C0 RID: 6080 RVA: 0x000993D4 File Offset: 0x000975D4
554 public void _WriteNote(UINote n, Chara c, Act act)
555 {
556 Element.<>c__DisplayClass101_0 CS$<>8__locals1;
557 CS$<>8__locals1.c = c;
558 CS$<>8__locals1.e = CS$<>8__locals1.c.elements.GetOrCreateElement(act.source.id);
559 Act.Cost cost = CS$<>8__locals1.e.GetCost(CS$<>8__locals1.c);
560 CS$<>8__locals1.p = CS$<>8__locals1.e.GetPower(CS$<>8__locals1.c);
561 n.Space(6, 1);
562 string text = this.source.GetText("textExtra", false);
563 if (!text.IsEmpty())
564 {
565 foreach (string text2 in text.Split(',', StringSplitOptions.None))
566 {
567 if (text2.StartsWith("@"))
568 {
569 Condition condition = Condition.Create(text2.Replace("@", ""), CS$<>8__locals1.p, null);
570 condition.owner = CS$<>8__locals1.c;
571 if (!this.source.aliasRef.IsEmpty())
572 {
573 condition.SetElement(EClass.sources.elements.alias[this.source.aliasRef].id);
574 }
575 int num = act.id;
576 if (num != 6902)
577 {
578 if (num == 8510 || num == 8710)
579 {
580 condition.SetRefVal(79, (act.id == 8710) ? 221 : 220);
581 }
582 }
583 else
584 {
585 condition.SetRefVal(79, 266);
586 }
587 n.AddText("_bullet".lang() + "hintCon".lang(condition.Name, condition.EvaluateTurn(CS$<>8__locals1.p).ToString() ?? "", null, null, null), FontColor.DontChange);
588 condition._WriteNote(n, true);
589 }
590 else
591 {
592 string text3 = text2.Replace("#calc", Element.<_WriteNote>g__Calc|101_0(ref CS$<>8__locals1));
593 if (!this.source.aliasRef.IsEmpty())
594 {
595 text3 = text3.Replace("#ele", EClass.sources.elements.alias[this.source.aliasRef].GetName().ToLower());
596 }
597 n.AddText("_bullet".lang() + text3, FontColor.DontChange);
598 }
599 }
600 }
601 if (this.source.tag.Contains("syncRide"))
602 {
603 n.AddText("_bullet".lang() + "hintSyncRide".lang(), FontColor.DontChange);
604 }
605 if (act.HaveLongPressAction)
606 {
607 int i = this.id;
608 if (i != 8230 && i != 8232)
609 {
610 n.AddText("_bullet".lang() + "hintPartyAbility".lang(), FontColor.DontChange);
611 }
612 }
613 if (!act.LocalAct)
614 {
615 n.Space(0, 1);
616 n.AddText("isGlobalAct".lang(), FontColor.DontChange);
617 }
618 if (cost.type != Act.CostType.None && cost.cost != 0)
619 {
620 n.Space(4, 1);
621 UIItem uiitem = n.AddExtra<UIItem>("costPrice");
622 uiitem.text1.SetText(cost.cost.ToString() ?? "", (((cost.type == Act.CostType.MP) ? CS$<>8__locals1.c.mana.value : CS$<>8__locals1.c.stamina.value) >= cost.cost) ? FontColor.Good : FontColor.Bad);
623 uiitem.image1.sprite = ((cost.type == Act.CostType.MP) ? EClass.core.refs.icons.mana : EClass.core.refs.icons.stamina);
624 uiitem.image1.SetNativeSize();
625 }
626 }
627
628 // Token: 0x060017C1 RID: 6081 RVA: 0x00099784 File Offset: 0x00097984
629 public void _WriteNote(UINote n, ElementContainer owner, Action<UINote> onWriteNote, bool isRef, bool addHeader = true)
630 {
631 if (addHeader)
632 {
633 if (isRef)
634 {
635 UIText.globalSizeMod = -2;
636 n.AddHeader("prevElement".lang(this.FullName, null, null, null, null), null);
637 }
638 else
639 {
640 n.AddHeader(this.FullName.ToTitleCase(true), null);
641 }
642 }
643 string detail = this.GetDetail();
644 if (!detail.IsEmpty())
645 {
646 n.AddText("NoteText_flavor_element", detail, FontColor.DontChange);
647 n.Space(6, 1);
648 }
649 int num = this.vLink;
650 bool flag = this.ShowValue;
651 bool flag2 = this.ShowRelativeAttribute;
652 if (this.source.category == "landfeat")
653 {
654 flag = false;
655 flag2 = false;
656 }
657 if (this is Act)
658 {
659 Act act = ACT.Create(this.source.id);
660 UIItem uiitem = n.AddItem("ItemAbility");
661 uiitem.text1.text = "vValue".lang(this.DisplayValue.ToString() ?? "", this.ValueWithoutLink.ToString() + ((num == 0) ? "" : ((num > 0) ? (" + " + num.ToString()) : (" - " + (-num).ToString()))), null, null, null);
662 uiitem.text2.text = act.TargetType.ToString().lang();
663 uiitem.text3.text = (((this is Spell) ? (owner.Chara.CalcCastingChance(owner.GetOrCreateElement(act.source.id), 1).ToString() + "%") : "-") ?? "");
664 }
665 else if (flag)
666 {
667 n.AddTopic("TopicLeft", "vCurrent".lang(), "vValue".lang(this.DisplayValue.ToString() ?? "", this.ValueWithoutLink.ToString() + ((num == 0) ? "" : ((num > 0) ? (" + " + num.ToString()) : (" - " + (-num).ToString()))), null, null, null));
668 if (this.ShowPotential)
669 {
670 num = this.vTempPotential;
671 n.AddTopic("TopicLeft", "vPotential".lang(), "vValue".lang(this.Potential.ToString() ?? "", (this.vPotential + this.vSourcePotential + this.MinPotential).ToString() + ((num == 0) ? "" : ((num > 0) ? (" + " + num.ToString()) : (" - " + (-num).ToString()))), null, null, null));
672 }
673 bool potentialAsStock = this.PotentialAsStock;
674 }
675 if (flag2 && !this.source.aliasParent.IsEmpty())
676 {
677 Element element = Element.Create(this.source.aliasParent, 1);
678 UIItem uiitem2 = n.AddItem("ItemRelativeAttribute");
679 uiitem2.text1.SetText(element.Name);
680 element.SetImage(uiitem2.image1);
681 bool flag3 = this.source.lvFactor > 0 && this is Act;
682 uiitem2.text2.SetActive(flag3);
683 uiitem2.text3.SetActive(flag3);
684 if (flag3)
685 {
686 uiitem2.text2.SetText(this.GetPower(EClass.pc).ToString() ?? "");
687 }
688 }
689 this.OnWriteNote(n, owner);
690 if (EClass.debug.showExtra)
691 {
692 string text = "TopicLeft";
693 string text2 = "Class:";
694 Type type = base.GetType();
695 n.AddTopic(text, text2, ((type != null) ? type.ToString() : null) ?? "");
696 n.AddTopic("TopicLeft", "vExp".lang(), this.vExp.ToString() ?? "");
697 n.AddTopic("TopicLeft", "vSource", this.vSource.ToString() ?? "");
698 n.AddTopic("TopicLeft", "vSourcePotential", this.vSourcePotential.ToString() ?? "");
699 n.AddTopic("TopicLeft", "vPotential", this.vPotential.ToString() ?? "");
700 n.AddTopic("TopicLeft", "Potential", this.Potential.ToString() ?? "");
701 }
702 this.CheckLevelBonus(owner, n);
703 if (onWriteNote != null)
704 {
705 onWriteNote(n);
706 }
707 UIText.globalSizeMod = 0;
708 }
709
710 // Token: 0x060017C2 RID: 6082 RVA: 0x00099C52 File Offset: 0x00097E52
711 public virtual void OnWriteNote(UINote n, ElementContainer owner)
712 {
713 }
714
715 // Token: 0x060017C3 RID: 6083 RVA: 0x00099C54 File Offset: 0x00097E54
716 public virtual void OnChangeValue()
717 {
718 }
719
720 // Token: 0x060017C4 RID: 6084 RVA: 0x00099C58 File Offset: 0x00097E58
721 public void CheckLevelBonus(ElementContainer owner, UINote n = null)
722 {
723 if (owner == null || this.source.levelBonus.IsEmpty())
724 {
725 return;
726 }
727 bool flag = n == null;
728 string[] array = (this.source.GetText("levelBonus", true) ?? this.source.levelBonus).Split(Environment.NewLine.ToCharArray());
729 if (!flag)
730 {
731 n.Space(10, 1);
732 }
733 string[] array2 = array;
734 for (int i = 0; i < array2.Length; i++)
735 {
736 string text = array2[i];
737 string[] array3 = text.Split(',', StringSplitOptions.None);
738 int lv = array3[0].ToInt();
739 SourceElement.Row row = EClass.sources.elements.alias.ContainsKey(array3[1]) ? EClass.sources.elements.alias[array3[1]] : null;
740 if (flag)
741 {
742 if (lv > this.ValueWithoutLink)
743 {
744 break;
745 }
746 if (row != null && !owner.Has(row.id) && owner is ElementContainerZone)
747 {
748 owner.Learn(row.id, 1);
749 }
750 }
751 else
752 {
753 string s = (row != null) ? row.GetName() : array3[1];
754 n.AddText((" Lv " + lv.ToString()).TagColor(FontColor.Topic, null) + " " + s.TagColorGoodBad(delegate()
755 {
756 if (row != null)
757 {
758 return owner.Has(row.id);
759 }
760 return lv <= this.ValueWithoutLink;
761 }, () => false, false), FontColor.DontChange);
762 }
763 }
764 if (!flag)
765 {
766 n.Space(4, 1);
767 }
768 }
769
770 // Token: 0x060017C5 RID: 6085 RVA: 0x00099E64 File Offset: 0x00098064
771 public int GetSortVal(UIList.SortMode m)
772 {
773 if (m == UIList.SortMode.ByNumber)
774 {
775 return -this.vPotential * 10000 + this.source.id;
776 }
777 if (m == UIList.SortMode.ByCategory)
778 {
779 return this.source.id + (this.source.aliasParent.IsEmpty() ? 0 : (EClass.sources.elements.alias[this.source.aliasParent].id * 10000));
780 }
781 if (m != UIList.SortMode.ByElementParent)
782 {
783 return this.source.id;
784 }
785 if (!this.source.aliasParent.IsEmpty())
786 {
787 return EClass.sources.elements.alias[this.source.aliasParent].sort;
788 }
789 return this.id;
790 }
791
792 // Token: 0x060017C6 RID: 6086 RVA: 0x00099F34 File Offset: 0x00098134
793 public virtual Act.Cost GetCost(Chara c)
794 {
795 if (this.source.cost[0] == 0)
796 {
797 return new Act.Cost
798 {
799 type = Act.CostType.None
800 };
801 }
802 Act.Cost cost = default(Act.Cost);
803 if (this is Spell)
804 {
805 cost.type = Act.CostType.MP;
806 int num = EClass.curve(this.Value, 50, 10, 75);
807 cost.cost = this.source.cost[0] * (100 + (this.source.tag.Contains("noCostInc") ? 0 : (num * 3))) / 100;
808 }
809 else
810 {
811 cost.type = Act.CostType.SP;
812 cost.cost = this.source.cost[0];
813 if (this.source.id == 6020)
814 {
815 cost.cost = c.stamina.max / 3 + 10;
816 }
817 }
818 if (!c.IsPC && cost.cost > 2)
819 {
820 cost.cost /= 2;
821 }
822 return cost;
823 }
824
825 // Token: 0x060017C7 RID: 6087 RVA: 0x0009A029 File Offset: 0x00098229
826 public virtual int GetPower(Card c)
827 {
828 return 100;
829 }
830
831 // Token: 0x060017C8 RID: 6088 RVA: 0x0009A030 File Offset: 0x00098230
832 public virtual void SetTextValue(UIText text)
833 {
834 string text2 = this.DisplayValue.ToString() ?? "";
835 if (this.ShowXP)
836 {
837 text2 += ".".TagSize((this.vExp / 10).ToString("D2") ?? "", 11);
838 }
839 if (this.vLink != 0)
840 {
841 string str = ((this.vLink > 0) ? "+" : "") + this.vLink.ToString();
842 text2 = string.Concat(new string[]
843 {
844 "<color=",
845 ((this.DisplayValue > this.ValueWithoutLink) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad).ToHex(),
846 ">",
847 text2,
848 (" (" + str + ")").TagSize(13),
849 "</color>"
850 });
851 }
852 text.text = text2;
853 }
854
855 // Token: 0x060017C9 RID: 6089 RVA: 0x0009A138 File Offset: 0x00098338
856 public static Element Create(int id, int v = 0)
857 {
858 SourceElement.Row row = EClass.sources.elements.map.TryGetValue(id, null);
859 if (row == null)
860 {
861 return null;
862 }
863 Element element = ClassCache.Create<Element>(row.type.IsEmpty("Element"), "Elin");
864 element.id = id;
865 element.vBase = v;
866 element._source = row;
867 return element;
868 }
869
870 // Token: 0x060017CA RID: 6090 RVA: 0x0009A190 File Offset: 0x00098390
871 public static Element Create(string id, int v = 1)
872 {
873 return Element.Create(EClass.sources.elements.alias[id].id, v);
874 }
875
876 // Token: 0x060017CB RID: 6091 RVA: 0x0009A1B2 File Offset: 0x000983B2
877 public static int GetId(string alias)
878 {
879 return EClass.sources.elements.alias[alias].id;
880 }
881
882 // Token: 0x060017CC RID: 6092 RVA: 0x0009A1D0 File Offset: 0x000983D0
883 public static int GetResistLv(int v)
884 {
885 int num = v / 5;
886 if (num < -2)
887 {
888 num = -2;
889 }
890 return num;
891 }
892
893 // Token: 0x060017CD RID: 6093 RVA: 0x0009A1EC File Offset: 0x000983EC
894 public static int GetResistDamage(int dmg, int v)
895 {
896 int resistLv = Element.GetResistLv(v);
897 if (resistLv >= 4)
898 {
899 return 0;
900 }
901 switch (resistLv)
902 {
903 case -2:
904 return dmg * 2;
905 case -1:
906 return dmg * 3 / 2;
907 case 1:
908 return dmg / 2;
909 case 2:
910 return dmg / 3;
911 case 3:
912 return dmg / 4;
913 }
914 return dmg;
915 }
916
917 // Token: 0x060017D0 RID: 6096 RVA: 0x0009A2CC File Offset: 0x000984CC
918 [CompilerGenerated]
919 internal static string <_WriteNote>g__Calc|101_0(ref Element.<>c__DisplayClass101_0 A_0)
920 {
921 Dice dice = Dice.Create(A_0.e, A_0.c);
922 if (dice == null)
923 {
924 return A_0.p.ToString() ?? "";
925 }
926 return dice.ToString();
927 }
928
929 // Token: 0x04001085 RID: 4229
930 public const int Div = 5;
931
932 // Token: 0x04001086 RID: 4230
933 public static Element Void = new Element();
934
935 // Token: 0x04001087 RID: 4231
936 public static int[] List_MainAttributes = new int[]
937 {
938 70,
939 72,
940 71,
941 77,
942 74,
943 75,
944 76,
945 73,
946 79
947 };
948
949 // Token: 0x04001088 RID: 4232
950 public static int[] List_MainAttributesMajor = new int[]
951 {
952 70,
953 72,
954 71,
955 77,
956 74,
957 75,
958 76,
959 73
960 };
961
962 // Token: 0x04001089 RID: 4233
963 public static int[] List_Body = new int[]
964 {
965 70,
966 72,
967 71,
968 77
969 };
970
971 // Token: 0x0400108A RID: 4234
972 public static int[] List_Mind = new int[]
973 {
974 74,
975 75,
976 76,
977 73
978 };
979
980 // Token: 0x0400108B RID: 4235
981 public SourceElement.Row _source;
982
983 // Token: 0x0400108C RID: 4236
984 public int id;
985
986 // Token: 0x0400108D RID: 4237
987 public int vBase;
988
989 // Token: 0x0400108E RID: 4238
990 public int vExp;
991
992 // Token: 0x0400108F RID: 4239
993 public int vPotential;
994
995 // Token: 0x04001090 RID: 4240
996 public int vTempPotential;
997
998 // Token: 0x04001091 RID: 4241
999 public int vLink;
1000
1001 // Token: 0x04001092 RID: 4242
1002 public int vSource;
1003
1004 // Token: 0x04001093 RID: 4243
1005 public int vSourcePotential;
1006
1007 // Token: 0x04001094 RID: 4244
1008 public ElementContainer owner;
1009
1010 // Token: 0x04001095 RID: 4245
1011 public static List<SourceElement.Row> ListElements = new List<SourceElement.Row>();
1012
1013 // Token: 0x04001096 RID: 4246
1014 public static List<SourceElement.Row> ListAttackElements = new List<SourceElement.Row>();
1015}
Definition ACT.cs:6
Definition Act.2.cs:7
Definition Card.cs:13
Definition Chara.cs:12
Definition Dice.cs:7
Definition Thing.cs:10