11 public static Thing _Create(
string id,
int idMat = -1,
int lv = -1)
17 Debug.LogError(
"exception: Item not found:" +
id);
19 s =
EClass.sources.cards.map.TryGetValue(
id,
null);
24 id = (((cardRow !=
null) ? cardRow.id :
null) ?? (from a in EClass.sources.cards.rows
32 thing.Create(
id, idMat, lv);
35 thing.SetNum(
EClass.rnd(20) + 10);
41 public static Thing TestCreate()
43 return ThingGen._Create(
SpawnList.Get(
"thing",
null,
null).Select(-1, -1).id, -1, -1);
47 public static Thing CreateCurrency(
int a,
string id =
"money")
49 return ThingGen.Create(
id, -1, -1).SetNum(a);
53 public static Thing CreateParcel(
string idLang =
null, params
Thing[] things)
56 foreach (
Thing c
in things)
60 thing.c_idRefName = idLang.lang();
65 public static Thing Create(
string id,
int idMat = -1,
int lv = -1)
67 return ThingGen._Create(
id, idMat, lv);
71 public static Thing Create(
string id,
string idMat)
73 return ThingGen.Create(
id, idMat.IsEmpty() ? -1 :
EClass.sources.materials.alias[idMat].id, -1);
77 public static Thing CreateFromFilter(
string id,
int lv = -1)
86 thing.ChangeMaterial(m.id);
91 public static Thing CreateFromCategory(
string idCat,
int lv = -1)
97 public static Thing CreateFromTag(
string idTag,
int lv = -1)
103 public static Thing CreateBill(
int pay,
bool tax)
105 Thing thing =
ThingGen.Create(tax ?
"bill_tax" :
"bill", -1, -1);
109 EClass.player.stats.taxBills += thing.c_bill;
114 EClass.player.unpaidBill += thing.c_bill;
120 public static Thing CreateBlock(
int id,
int idMat)
128 public static Thing CreateFloor(
int id,
int idMat,
bool platform =
false)
131 Thing thing =
ThingGen.Create(platform ?
"platform" :
"floor", idMat, -1);
137 public static Thing CreateObj(
int id,
int idMat)
146 public static Thing CreateMap(
string idSource =
null,
int lv = -1)
148 if (idSource.IsEmpty())
150 idSource =
EClass.game.world.region.GetRandomSiteSource().id;
156 return ThingGen.Create(
"map", -1, -1);
160 public static Thing CreatePlan(
int ele)
168 public static Thing CreateRecipe(
string id)
171 thing.SetStr(53,
id);
176 public static Thing CreateSpellbook(
string alias,
int num = 1)
178 return ThingGen.CreateSpellbook(
EClass.sources.elements.alias[alias].id, num);
182 public static Thing CreateSpellbook(
int ele,
int num = 1)
184 Thing thing =
ThingGen.Create(
"spellbook", -1, -1).SetNum(num);
190 public static Thing CreateScroll(
int ele,
int num = 1)
192 Thing thing =
ThingGen.Create(
"scroll_random", -1, -1).SetNum(num);
198 public static Thing CreatePotion(
int ele,
int num = 1)
206 public static Thing CreatePerfume(
int ele,
int num = 1)
208 Thing thing =
ThingGen.Create(
"perfume", -1, -1).SetNum(num);
214 public static Thing CreateCardboardBox(
int uidZone = -1)
223 }.RandomItem<
string>());
224 thing.things.DestroyAll(
null);
225 Spatial spatial = (uidZone == -1) ?
null :
EClass.game.spatials.map.TryGetValue(uidZone,
null);
228 thing.c_idRefName =
"sender_header".lang(
"sender_post".lang(spatial.Name,
null,
null,
null,
null),
null,
null,
null,
null);
234 public static Thing CreateTreasure(
string id,
int lv, TreasureType type = TreasureType.Map)
237 ThingGen.CreateTreasureContent(thing, lv, type,
true);
242 public static void CreateTreasureContent(
Thing t,
int lv, TreasureType type,
bool clearContent)
244 ThingGen.<>c__DisplayClass24_0 CS$<>8__locals1;
245 CS$<>8__locals1.miracleChance = lv;
246 int num =
EClass.curve(lv, 20, 15, 75);
249 CS$<>8__locals1.guaranteedMythical = ((type == TreasureType.BossQuest) ? 1 : 0);
250 ThingGen.<CreateTreasureContent>g__ChangeSeed|24_0();
251 t.AddEditorTag(EditorTag.PreciousContainer);
254 t.things.DestroyAll(
null);
258 case TreasureType.BossNefia:
259 case TreasureType.BossQuest:
260 t.Add(
"money",
EClass.rndHalf(500 + num * 50), 1);
261 t.Add(
"plat",
EClass.rndHalf(Mathf.Min(3 + num / 10, 15)), 1);
262 t.Add(
"rp_random", 1, lv);
265 t.Add(
"medal",
EClass.rnd(3), 1);
267 else if (
EClass.rnd(3) == 0)
269 t.Add(
"map_treasure", 1,
EClass.rndHalf(lv + 10));
273 t.Add(
"book_skill", 1, lv);
277 case TreasureType.Map:
278 CS$<>8__locals1.miracleChance += 50;
279 t.Add(
"money",
EClass.rndHalf(1000 + num * 100), 1);
280 t.Add(
"money2",
EClass.rndHalf(Mathf.Min(3 + num / 10, 10)), 1);
281 t.Add(
"medal",
EClass.rnd(3), 1);
283 case TreasureType.RandomChest:
285 CS$<>8__locals1.miracleChance /= 2;
286 if (CS$<>8__locals1.miracleChance > 50)
288 CS$<>8__locals1.miracleChance = 50;
292 t.Add(
"money",
EClass.rndHalf(10 + num * 25), 1);
294 else if (
EClass.rnd(2) == 0)
296 t.Add(
"money2", 1 +
EClass.rnd(Mathf.Min(2 + num / 25, 5)), 1);
300 t.Add(
"plat", 1 +
EClass.rnd(Mathf.Min(2 + num / 25, 5)), 1);
310 t.Add(
"map_treasure", 1,
EClass.rndHalf(lv + 10));
314 t.AddCard(
ThingGen.Create(
"rp_random", -1, lv));
316 if (t.c_lockLv > 0 &&
EClass.rnd(3) == 0)
318 t.Add(
"medal", 1, 1);
323 if (type == TreasureType.RandomChest &&
EClass.rnd(2) == 0)
325 t.AddCard(
ThingGen.CreateFromCategory(
"junk", lv));
327 else if (
EClass.rnd(3) == 0)
329 t.Add(
"rp_random", 1, lv);
331 else if (type != TreasureType.Map &&
EClass.rnd(2) == 0)
334 if (!thing.IsContainer)
341 t.AddCard(
ThingGen.CreateFromCategory(
"junk", lv));
345 t.Add(
"book_ancient", 1, lv);
349 CS$<>8__locals1.miracleChance += 20 + (int)Mathf.Sqrt((
float)(t.c_lockLv * 5));
353 ThingGen.<CreateTreasureContent>g__SetRarity|24_1(100, ref CS$<>8__locals1);
354 t.AddCard(
ThingGen.CreateFromFilter(
"eq", lv));
357 ThingGen.<CreateTreasureContent>g__SetRarity|24_1(20, ref CS$<>8__locals1);
358 t.AddCard(
ThingGen.CreateFromFilter(
"eq", lv));
365 public static void TryLickChest(
Thing chest)
369 if (chara.HasElement(1412, 1) && chara.Dist(chest) < 3)
371 chara.Say(
"lick", chara, chest,
null,
null);
372 chest.PlaySound(
"offering", 1f,
true);
373 chest.PlayEffect(
"mutation",
true, 0f,
default(Vector3));
374 using (List<Thing>.Enumerator enumerator2 = chest.things.GetEnumerator())
376 while (enumerator2.MoveNext())
378 Thing thing = enumerator2.Current;
379 thing.TryLickEnchant(chara,
false,
null,
null);
389 internal static void <CreateTreasureContent>g__ChangeSeed|24_0()
391 EClass.player.seedChest++;
392 Rand.SetSeed(
EClass.game.seed +
EClass.player.seedChest);
397 internal static void <CreateTreasureContent>g__SetRarity|24_1(
int mtp, ref
ThingGen.<>c__DisplayClass24_0 A_1)
399 ThingGen.<CreateTreasureContent>g__ChangeSeed|24_0();
400 Rarity rarity = (A_1.miracleChance * mtp / 100 >=
EClass.rnd(100)) ? ((
EClass.rnd(20) == 0) ? Rarity.Mythical : Rarity.Legendary) : Rarity.Superior;
401 if (A_1.guaranteedMythical > 0)
403 int guaranteedMythical = A_1.guaranteedMythical;
404 A_1.guaranteedMythical = guaranteedMythical - 1;
405 rarity = Rarity.Mythical;