Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ContentSamples.cs
Go to the documentation of this file.
2using System.Linq;
5
6namespace Terraria.ID;
7
8public static class ContentSamples
9{
10 public static class CommonlyUsedContentSamples
11 {
12 public static int TeamDyeShaderIndex = -1;
13
14 public static int ColorOnlyShaderIndex = -1;
15
17 {
18 TeamDyeShaderIndex = GameShaders.Hair.GetShaderIdFromItemId(1984);
19 ColorOnlyShaderIndex = GameShaders.Armor.GetShaderIdFromItemId(3978);
20 }
21 }
22
23 public static class CreativeHelper
24 {
25 public enum ItemGroup
26 {
27 Coin = 10,
28 CraftingObjects = 11,
29 Torches = 20,
30 Glowsticks = 25,
31 Wood = 30,
32 Bombs = 40,
33 LifePotions = 50,
34 ManaPotions = 51,
35 BuffPotion = 52,
36 Flask = 53,
37 Food = 54,
38 Crates = 60,
39 BossBags = 70,
40 GoodieBags = 80,
41 AlchemyPlants = 83,
42 AlchemySeeds = 84,
43 DyeMaterial = 87,
44 BossItem = 90,
45 EventItem = 91,
47 Solutions = 95,
48 Ammo = 96,
50 PlacableObjects = 100,
51 Blocks = 120,
52 Wands = 130,
53 Rope = 140,
54 Walls = 150,
55 Wiring = 200,
56 Pickaxe = 500,
57 Axe = 510,
58 Hammer = 520,
59 MeleeWeapon = 530,
60 RangedWeapon = 540,
61 MagicWeapon = 550,
62 SummonWeapon = 560,
63 Headgear = 600,
64 Torso = 610,
65 Pants = 620,
66 Accessories = 630,
67 Hook = 700,
68 Mount = 710,
69 Minecart = 720,
70 VanityPet = 800,
71 LightPet = 810,
72 Golf = 900,
73 BossSpawners = 901,
74 Dye = 910,
75 HairDye = 920,
76 Paint = 930,
77 FishingRods = 1000,
78 FishingQuestFish = 1010,
79 Fish = 1015,
80 FishingBait = 1020,
81 Critters = 1030,
82 Keys = 2000,
83 RemainingUseItems = 5000,
84 Material = 10000,
85 EverythingElse = 11000
86 }
87
89 {
90 public int ItemType;
91
93
94 public int OrderInGroup;
95
97 {
98 ItemType = item.type;
100 }
101 }
102
103 private static List<int> _manualEventItemsOrder = new List<int> { 361, 1315, 2767, 602, 1844, 1958 };
104
106 {
107 43, 560, 70, 1331, 1133, 5120, 1307, 267, 3828, 4988,
108 5334, 544, 557, 556, 1293, 2673, 4961, 3601
109 };
110
112 {
113 33, 35, 716, 221, 524, 1221, 525, 1220, 3549, 398,
114 1120, 1430, 1551, 345, 1791, 5008, 332, 352, 487, 995,
115 363, 2172, 2196, 2194, 2198, 2204, 998, 2197, 996, 4142,
116 2193, 2192, 2203, 2195
117 };
118
120 {
121 4095, 4596, 4597, 4595, 4598, 4592, 4593, 4591, 4594, 4092,
122 4093, 4039, 4094, 4588, 4589, 4587, 4590, 3989, 4242, 4243,
123 4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4252, 4253,
124 4254, 4255, 4040, 4086, 4085, 4088, 4084, 4083, 4087
125 };
126
127 public static ItemGroup GetItemGroup(Item item, out int orderInGroup)
128 {
129 orderInGroup = 0;
130 int num = _manualBossSpawnItemsOrder.IndexOf(item.type);
131 if (num != -1)
132 {
133 orderInGroup = num;
134 return ItemGroup.BossItem;
135 }
136 int num2 = _manualGolfItemsOrder.IndexOf(item.type);
137 if (num2 != -1)
138 {
140 return ItemGroup.Golf;
141 }
142 int num3 = ItemID.Sets.SortingPriorityWiring[item.type];
143 if (num3 != -1)
144 {
146 return ItemGroup.Wiring;
147 }
148 if (item.type == 3620)
149 {
150 return ItemGroup.Wiring;
151 }
152 if (item.type == 327 || item.type == 329 || item.type == 1141 || item.type == 1533 || item.type == 1537 || item.type == 1536 || item.type == 1534 || item.type == 1535 || item.type == 3092 || item.type == 3091 || item.type == 4714)
153 {
154 orderInGroup = -item.rare;
155 return ItemGroup.Keys;
156 }
157 if (item.type == 985 || item.type == 3079 || item.type == 3005 || item.type == 3080)
158 {
159 return ItemGroup.Rope;
160 }
161 if (item.type == 781 || item.type == 783 || item.type == 780 || item.type == 782 || item.type == 784)
162 {
163 return ItemGroup.Solutions;
164 }
165 if (item.type == 282 || item.type == 3112 || item.type == 4776 || item.type == 3002 || item.type == 286)
166 {
167 if (item.type == 282)
168 {
169 orderInGroup = -1;
170 }
171 return ItemGroup.Glowsticks;
172 }
173 if (item.type == 166 || item.type == 3115 || item.type == 235 || item.type == 167 || item.type == 3547 || item.type == 2896 || item.type == 3196 || item.type == 4908 || item.type == 4909 || item.type == 4827 || item.type == 4826 || item.type == 4825 || item.type == 4423 || item.type == 4824)
174 {
175 return ItemGroup.Bombs;
176 }
177 if (item.createTile == 376)
178 {
179 return ItemGroup.Crates;
180 }
181 if (item.type == 1774 || item.type == 1869 || item.type == 4345 || item.type == 3093 || item.type == 4410)
182 {
183 return ItemGroup.GoodieBags;
184 }
185 if (ItemID.Sets.BossBag[item.type])
186 {
187 return ItemGroup.BossBags;
188 }
189 if (item.type == 1115 || item.type == 1114 || item.type == 1110 || item.type == 1112 || item.type == 1108 || item.type == 1107 || item.type == 1116 || item.type == 1109 || item.type == 1111 || item.type == 1118 || item.type == 1117 || item.type == 1113 || item.type == 1119)
190 {
191 return ItemGroup.DyeMaterial;
192 }
193 if (item.type == 3385 || item.type == 3386 || item.type == 3387 || item.type == 3388)
194 {
195 orderInGroup = -1;
196 return ItemGroup.DyeMaterial;
197 }
198 if (item.dye != 0)
199 {
200 return ItemGroup.Dye;
201 }
202 if (item.hairDye != -1)
203 {
204 return ItemGroup.HairDye;
205 }
206 if (item.IsACoin)
207 {
208 if (item.type == 71)
209 {
210 orderInGroup = 4;
211 }
212 else if (item.type == 72)
213 {
214 orderInGroup = 3;
215 }
216 else if (item.type == 73)
217 {
218 orderInGroup = 2;
219 }
220 else if (item.type == 74)
221 {
222 orderInGroup = 1;
223 }
224 return ItemGroup.Coin;
225 }
226 if (item.createWall > 0)
227 {
228 return ItemGroup.Walls;
229 }
230 if (item.createTile == 82)
231 {
232 return ItemGroup.AlchemySeeds;
233 }
234 if (item.type == 315 || item.type == 313 || item.type == 316 || item.type == 318 || item.type == 314 || item.type == 2358 || item.type == 317)
235 {
236 return ItemGroup.AlchemyPlants;
237 }
238 if (item.createTile == 30 || item.createTile == 321 || item.createTile == 322 || item.createTile == 157 || item.createTile == 158 || item.createTile == 208 || item.createTile == 159 || item.createTile == 253 || item.createTile == 311 || item.createTile == 635)
239 {
240 if (item.createTile == 30)
241 {
242 orderInGroup = 0;
243 }
244 else if (item.createTile == 311)
245 {
246 orderInGroup = 100;
247 }
248 else
249 {
250 orderInGroup = 50;
251 }
252 return ItemGroup.Wood;
253 }
254 if (item.createTile >= 0)
255 {
256 if (item.type == 213)
257 {
258 orderInGroup = -1;
259 return ItemGroup.Pickaxe;
260 }
261 if (item.tileWand >= 0)
262 {
263 return ItemGroup.Wands;
264 }
265 if (item.createTile == 213 || item.createTile == 353 || item.createTile == 365 || item.createTile == 366 || item.createTile == 214)
266 {
267 return ItemGroup.Rope;
268 }
269 if (!Main.tileSolid[item.createTile] || Main.tileSolidTop[item.createTile] || item.createTile == 10)
270 {
271 int num4 = _manualCraftingStations.IndexOf(item.type);
272 if (num4 != -1)
273 {
275 return ItemGroup.CraftingObjects;
276 }
277 if (item.createTile == 4)
278 {
279 if (item.placeStyle == 0)
280 {
281 orderInGroup = 5;
282 }
283 else
284 {
285 orderInGroup = 10;
286 }
287 return ItemGroup.Torches;
288 }
289 if (item.createTile == 178)
290 {
291 orderInGroup = 5;
292 }
293 else if (item.createTile == 239)
294 {
295 orderInGroup = 7;
296 }
297 else if (item.type == 27 || item.type == 4857 || item.type == 4852 || item.type == 4856 || item.type == 4854 || item.type == 4855 || item.type == 4853 || item.type == 4851)
298 {
299 orderInGroup = 8;
300 }
301 else if (TileID.Sets.Platforms[item.createTile])
302 {
303 if (item.placeStyle == 0)
304 {
305 orderInGroup = 19;
306 }
307 else
308 {
309 orderInGroup = 20;
310 }
311 }
312 else if (item.createTile == 18)
313 {
314 if (item.placeStyle == 0)
315 {
316 orderInGroup = 29;
317 }
318 else
319 {
320 orderInGroup = 30;
321 }
322 }
323 else if (item.createTile == 16 || item.createTile == 134)
324 {
325 if (item.placeStyle == 0)
326 {
327 orderInGroup = 39;
328 }
329 else
330 {
331 orderInGroup = 40;
332 }
333 }
334 else if (item.createTile == 133 || item.createTile == 17)
335 {
336 if (item.placeStyle == 0)
337 {
338 orderInGroup = 49;
339 }
340 else
341 {
342 orderInGroup = 50;
343 }
344 }
345 else if (item.createTile == 10)
346 {
347 if (item.placeStyle == 0)
348 {
349 orderInGroup = 59;
350 }
351 else
352 {
353 orderInGroup = 60;
354 }
355 }
356 else if (item.createTile == 15)
357 {
358 if (item.placeStyle == 0)
359 {
360 orderInGroup = 69;
361 }
362 else
363 {
364 orderInGroup = 70;
365 }
366 }
367 else if (item.createTile == 497)
368 {
369 orderInGroup = 72;
370 }
371 else if (item.createTile == 79)
372 {
373 if (item.placeStyle == 0)
374 {
375 orderInGroup = 74;
376 }
377 else
378 {
379 orderInGroup = 75;
380 }
381 }
382 else if (item.createTile == 14)
383 {
384 if (item.placeStyle == 0)
385 {
386 orderInGroup = 79;
387 }
388 else
389 {
390 orderInGroup = 80;
391 }
392 }
393 else if (item.createTile == 469)
394 {
395 orderInGroup = 90;
396 }
397 else if (item.createTile == 21)
398 {
399 if (item.placeStyle == 0)
400 {
401 orderInGroup = 99;
402 }
403 else
404 {
405 orderInGroup = 100;
406 }
407 }
408 else if (item.createTile == 467)
409 {
410 orderInGroup = 110;
411 }
412 else if (item.createTile == 441)
413 {
414 orderInGroup = 120;
415 }
416 else if (item.createTile == 468)
417 {
418 orderInGroup = 130;
419 }
420 else
421 {
422 orderInGroup = item.createTile + 1000;
423 }
424 return ItemGroup.PlacableObjects;
425 }
426 if (TileID.Sets.Conversion.Grass[item.createTile] || item.type == 194)
427 {
428 orderInGroup = 5;
429 }
430 else
431 {
432 orderInGroup = 10000;
433 }
434 if (item.type == 2)
435 {
436 orderInGroup = 10;
437 }
438 else if (item.type == 3)
439 {
440 orderInGroup = 20;
441 }
442 else if (item.type == 133)
443 {
444 orderInGroup = 30;
445 }
446 else if (item.type == 424)
447 {
448 orderInGroup = 40;
449 }
450 else if (item.type == 1103)
451 {
452 orderInGroup = 50;
453 }
454 else if (item.type == 169)
455 {
456 orderInGroup = 60;
457 }
458 else if (item.type == 170)
459 {
460 orderInGroup = 70;
461 }
462 else if (item.type == 176)
463 {
464 orderInGroup = 80;
465 }
466 else if (item.type == 276)
467 {
468 orderInGroup = 80;
469 }
470 return ItemGroup.Blocks;
471 }
472 if (item.mountType != -1)
473 {
474 if (MountID.Sets.Cart[item.mountType])
475 {
476 return ItemGroup.Minecart;
477 }
478 return ItemGroup.Mount;
479 }
480 if (item.bait > 0)
481 {
482 orderInGroup = -item.bait;
483 return ItemGroup.FishingBait;
484 }
485 if (item.makeNPC > 0)
486 {
487 return ItemGroup.Critters;
488 }
489 if (item.fishingPole > 1)
490 {
491 orderInGroup = -item.fishingPole;
492 return ItemGroup.FishingRods;
493 }
494 if (item.questItem)
495 {
496 return ItemGroup.FishingQuestFish;
497 }
498 if ((item.type >= 2297 && item.type <= 2321) || item.type == 4402 || item.type == 4401 || item.type == 2290)
499 {
500 orderInGroup = -item.rare;
501 return ItemGroup.FishingQuestFish;
502 }
503 int num5 = ItemID.Sets.SortingPriorityPainting[item.type];
504 if (num5 != -1 || item.PaintOrCoating)
505 {
507 return ItemGroup.Paint;
508 }
509 int num6 = _manualEventItemsOrder.IndexOf(item.type);
510 if (num6 != -1)
511 {
513 return ItemGroup.EventItem;
514 }
515 if (item.shoot != 0 && Main.projHook[item.shoot])
516 {
517 return ItemGroup.Hook;
518 }
519 if (item.type == 2756 || item.type == 2351 || item.type == 4870 || item.type == 2350 || item.type == 2997 || item.type == 2352 || item.type == 2353)
520 {
521 return ItemGroup.BuffPotion;
522 }
523 if (item.buffType != 0)
524 {
525 if (BuffID.Sets.IsWellFed[item.buffType])
526 {
527 orderInGroup = -item.buffType * 10000000 - item.buffTime;
528 return ItemGroup.Food;
529 }
530 if (BuffID.Sets.IsAFlaskBuff[item.buffType])
531 {
532 return ItemGroup.Flask;
533 }
534 if (Main.vanityPet[item.buffType])
535 {
536 return ItemGroup.VanityPet;
537 }
538 if (Main.lightPet[item.buffType])
539 {
540 return ItemGroup.VanityPet;
541 }
542 if (item.damage == -1)
543 {
544 return ItemGroup.BuffPotion;
545 }
546 }
547 if (item.headSlot >= 0)
548 {
549 orderInGroup = -item.defense;
550 orderInGroup -= item.rare * 1000;
551 if (item.vanity)
552 {
553 orderInGroup += 100000;
554 }
555 return ItemGroup.Headgear;
556 }
557 if (item.bodySlot >= 0)
558 {
559 orderInGroup = -item.defense;
560 orderInGroup -= item.rare * 1000;
561 if (item.vanity)
562 {
563 orderInGroup += 100000;
564 }
565 return ItemGroup.Torso;
566 }
567 if (item.legSlot >= 0)
568 {
569 orderInGroup = -item.defense;
570 orderInGroup -= item.rare * 1000;
571 if (item.vanity)
572 {
573 orderInGroup += 100000;
574 }
575 return ItemGroup.Pants;
576 }
577 if (item.accessory)
578 {
579 orderInGroup = item.vanity.ToInt() - item.expert.ToInt();
580 if (item.type >= 3293 && item.type <= 3308)
581 {
582 orderInGroup -= 200000;
583 }
584 else if (item.type >= 3309 && item.type <= 3314)
585 {
586 orderInGroup -= 100000;
587 }
588 orderInGroup -= item.rare * 10000;
589 if (item.vanity)
590 {
591 orderInGroup += 100000;
592 }
593 return ItemGroup.Accessories;
594 }
595 if (item.pick > 0)
596 {
597 orderInGroup = -item.pick;
598 return ItemGroup.Pickaxe;
599 }
600 if (item.axe > 0)
601 {
602 orderInGroup = -item.axe;
603 return ItemGroup.Axe;
604 }
605 if (item.hammer > 0)
606 {
607 orderInGroup = -item.hammer;
608 return ItemGroup.Hammer;
609 }
610 if (item.healLife > 0)
611 {
612 if (item.type == 3544)
613 {
614 orderInGroup = 0;
615 }
616 else if (item.type == 499)
617 {
618 orderInGroup = 1;
619 }
620 else if (item.type == 188)
621 {
622 orderInGroup = 2;
623 }
624 else if (item.type == 28)
625 {
626 orderInGroup = 3;
627 }
628 else
629 {
630 orderInGroup = -item.healLife + 1000;
631 }
632 return ItemGroup.LifePotions;
633 }
634 if (item.healMana > 0)
635 {
636 orderInGroup = -item.healMana;
637 return ItemGroup.ManaPotions;
638 }
639 if (item.ammo != AmmoID.None && !item.notAmmo && item.type != 23 && item.type != 75)
640 {
641 orderInGroup = -item.ammo * 10000;
642 orderInGroup += -item.damage;
643 return ItemGroup.Ammo;
644 }
645 if (item.consumable)
646 {
647 if (item.damage > 0)
648 {
649 if (item.type == 422 || item.type == 423 || item.type == 3477)
650 {
651 orderInGroup = -100000;
652 }
653 else
654 {
655 orderInGroup = -item.damage;
656 }
657 return ItemGroup.ConsumableThatDamages;
658 }
659 if (item.type == 4910 || item.type == 4829 || item.type == 4830)
660 {
661 orderInGroup = 10;
662 }
663 else if (item.type == 66 || item.type == 2886 || item.type == 67)
664 {
665 orderInGroup = -10;
666 }
667 else if (item.type >= 1874 && item.type <= 1905)
668 {
669 orderInGroup = 5;
670 }
671 return ItemGroup.ConsumableThatDoesNotDamage;
672 }
673 if (item.damage > 0)
674 {
675 orderInGroup = -item.damage;
676 if (item.melee)
677 {
678 return ItemGroup.MeleeWeapon;
679 }
680 if (item.ranged)
681 {
682 return ItemGroup.RangedWeapon;
683 }
684 if (item.magic)
685 {
686 return ItemGroup.MagicWeapon;
687 }
688 if (item.summon)
689 {
690 return ItemGroup.SummonWeapon;
691 }
692 }
693 orderInGroup = -item.rare;
694 if (item.useStyle > 0)
695 {
696 return ItemGroup.RemainingUseItems;
697 }
698 if (item.material)
699 {
700 return ItemGroup.Material;
701 }
702 return ItemGroup.EverythingElse;
703 }
704
705 public static void SetCreativeMenuOrder()
706 {
707 List<Item> list = new List<Item>();
708 for (int i = 1; i < ItemID.Count; i++)
709 {
710 Item item = new Item();
711 item.SetDefaults(i);
712 list.Add(item);
713 }
715 select new ItemGroupAndOrderInGroup(x) into x
716 group x by x.Group into @group
717 orderby (int)@group.Key
718 select @group;
720 {
722 {
724 }
725 }
727 }
728
729 public static bool ShouldRemoveFromList(Item item)
730 {
731 return ItemID.Sets.Deprecated[item.type];
732 }
733 }
734
735 public static class BestiaryHelper
736 {
738 {
741 orderby GetBestiaryTownPriority(x.Value), !x.Value.isLikeATownNPC, GetBestiaryNormalGoldCritterPriority(x.Value), !x.Value.CountsAsACritter, GetBestiaryBossPriority(x.Value), x.Value.boss || NPCID.Sets.ShouldBeCountedAsBoss[x.Value.type], GetLowestBiomeGroupIndex(x.Value, database, commonFilters), x.Value.aiStyle, GetBestiaryPowerLevel(x.Value), GetBestiaryStarsPriority(x.Value)
742 select x).ToList();
743 list.RemoveAll((KeyValuePair<int, NPC> x) => ShouldHideBestiaryEntry(x.Value));
744 return list;
745 }
746
748 {
749 List<IBestiaryInfoElement> info = database.FindEntryByNPCID(npc.netID).Info;
750 for (int num = commonElements.Count - 1; num >= 0; num--)
751 {
752 if (info.IndexOf(commonElements[num]) != -1)
753 {
754 return num;
755 }
756 }
757 return int.MaxValue;
758 }
759
760 public static bool ShouldHideBestiaryEntry(NPC npc)
761 {
762 if (NPCID.Sets.NPCBestiaryDrawOffset.TryGetValue(npc.netID, out var value))
763 {
764 return value.Hide;
765 }
766 return false;
767 }
768
769 public static float GetBestiaryPowerLevel(NPC npc)
770 {
771 return npc.damage + npc.defense + npc.lifeMax / 4;
772 }
773
774 public static int GetBestiaryTownPriority(NPC npc)
775 {
776 int num = NPCID.Sets.TownNPCBestiaryPriority.IndexOf(npc.netID);
777 if (num == -1)
778 {
779 num = int.MaxValue;
780 }
781 return num;
782 }
783
785 {
786 int num = NPCID.Sets.NormalGoldCritterBestiaryPriority.IndexOf(npc.netID);
787 if (num == -1)
788 {
789 num = int.MaxValue;
790 }
791 return num;
792 }
793
794 public static int GetBestiaryBossPriority(NPC npc)
795 {
796 return NPCID.Sets.BossBestiaryPriority.IndexOf(npc.netID);
797 }
798
799 public static int GetBestiaryStarsPriority(NPC npc)
800 {
801 return NpcBestiaryRarityStars[npc.type];
802 }
803 }
804
806
808
810
812
814
816
818
820
822
824
826
828
829 public static void Initialize()
830 {
831 NpcsByNetId.Clear();
834 NpcBestiarySortingId.Clear();
835 for (int i = -65; i < NPCID.Count; i++)
836 {
837 NPC nPC = new NPC();
838 nPC.SetDefaults(i);
839 NpcsByNetId[i] = nPC;
840 string name = NPCID.Search.GetName(nPC.netID);
841 NpcPersistentIdsByNetIds[i] = name;
843 NpcNetIdsByPersistentIds[name] = i;
844 }
845 ModifyNPCIds();
846 ProjectilesByType.Clear();
847 for (int j = 0; j < ProjectileID.Count; j++)
848 {
849 Projectile projectile = new Projectile();
850 projectile.SetDefaults(j);
851 ProjectilesByType[j] = projectile;
852 }
853 ItemsByType.Clear();
854 for (int k = 0; k < ItemID.Count; k++)
855 {
856 Item item = new Item();
857 item.SetDefaults(k);
858 ItemsByType[k] = item;
859 string name2 = ItemID.Search.GetName(item.netID);
862 }
864 {
865 Item item2 = new Item();
866 item2.SetDefaults(item3);
868 string name3 = ItemID.Search.GetName(item2.netID);
871 }
874 }
875
876 private static void FillResearchItemOverrides()
877 {
878 AddItemResearchOverride(4131, 5325);
879 AddItemResearchOverride(5324, 5329, 5330);
880 AddItemResearchOverride(5437, 5358, 5359, 5360, 5361);
881 AddItemResearchOverride(4346, 5391);
882 AddItemResearchOverride(4767, 5453);
883 AddItemResearchOverride(5309, 5454);
884 AddItemResearchOverride(5323, 5455);
885 }
886
894
899
900 public static void FixItemsAfterRecipesAreAdded()
901 {
902 foreach (KeyValuePair<int, Item> item in ItemsByType)
903 {
904 item.Value.material = ItemID.Sets.IsAMaterial[item.Key];
905 }
906 }
907
913
919
920 private static void ModifyNPCIds()
921 {
978 short key = 499;
979 for (int i = 498; i <= 506; i++)
980 {
982 }
1037 }
1038
1049
1050 private static void FillNpcRarities()
1051 {
1053 nPCSpawnParams.gameModeData = Main.RegisteredGameModes[0];
1055 for (int i = -65; i < NPCID.Count; i++)
1056 {
1057 NPC nPC = new NPC();
1058 nPC.SetDefaults(i, spawnparams);
1060 }
1061 NpcBestiaryRarityStars[22] = 1;
1062 NpcBestiaryRarityStars[17] = 1;
1063 NpcBestiaryRarityStars[18] = 1;
1064 NpcBestiaryRarityStars[38] = 1;
1065 NpcBestiaryRarityStars[369] = 2;
1066 NpcBestiaryRarityStars[20] = 3;
1067 NpcBestiaryRarityStars[19] = 1;
1068 NpcBestiaryRarityStars[227] = 2;
1069 NpcBestiaryRarityStars[353] = 2;
1070 NpcBestiaryRarityStars[550] = 2;
1071 NpcBestiaryRarityStars[588] = 2;
1072 NpcBestiaryRarityStars[107] = 3;
1073 NpcBestiaryRarityStars[228] = 2;
1074 NpcBestiaryRarityStars[124] = 2;
1075 NpcBestiaryRarityStars[54] = 2;
1076 NpcBestiaryRarityStars[108] = 3;
1077 NpcBestiaryRarityStars[178] = 3;
1078 NpcBestiaryRarityStars[216] = 3;
1079 NpcBestiaryRarityStars[160] = 5;
1080 NpcBestiaryRarityStars[441] = 5;
1081 NpcBestiaryRarityStars[209] = 3;
1082 NpcBestiaryRarityStars[208] = 4;
1083 NpcBestiaryRarityStars[142] = 5;
1084 NpcBestiaryRarityStars[368] = 3;
1085 NpcBestiaryRarityStars[453] = 4;
1086 NpcBestiaryRarityStars[37] = 2;
1087 NpcBestiaryRarityStars[633] = 5;
1088 NpcBestiaryRarityStars[663] = 5;
1089 NpcBestiaryRarityStars[638] = 3;
1090 NpcBestiaryRarityStars[637] = 3;
1091 NpcBestiaryRarityStars[656] = 3;
1092 NpcBestiaryRarityStars[670] = 3;
1093 NpcBestiaryRarityStars[678] = 3;
1094 NpcBestiaryRarityStars[679] = 3;
1095 NpcBestiaryRarityStars[680] = 3;
1096 NpcBestiaryRarityStars[681] = 3;
1097 NpcBestiaryRarityStars[682] = 3;
1098 NpcBestiaryRarityStars[683] = 3;
1099 NpcBestiaryRarityStars[684] = 3;
1100 NpcBestiaryRarityStars[664] = 5;
1101 NpcBestiaryRarityStars[484] = 5;
1102 NpcBestiaryRarityStars[614] = 4;
1103 NpcBestiaryRarityStars[303] = 4;
1104 NpcBestiaryRarityStars[337] = 4;
1105 NpcBestiaryRarityStars[360] = 3;
1106 NpcBestiaryRarityStars[655] = 2;
1107 NpcBestiaryRarityStars[374] = 3;
1108 NpcBestiaryRarityStars[661] = 3;
1109 NpcBestiaryRarityStars[362] = 2;
1110 NpcBestiaryRarityStars[364] = 2;
1111 NpcBestiaryRarityStars[616] = 2;
1112 NpcBestiaryRarityStars[298] = 2;
1113 NpcBestiaryRarityStars[671] = 3;
1114 NpcBestiaryRarityStars[672] = 3;
1115 NpcBestiaryRarityStars[673] = 3;
1116 NpcBestiaryRarityStars[674] = 3;
1117 NpcBestiaryRarityStars[675] = 3;
1118 NpcBestiaryRarityStars[599] = 3;
1119 NpcBestiaryRarityStars[355] = 2;
1120 NpcBestiaryRarityStars[358] = 3;
1121 NpcBestiaryRarityStars[654] = 3;
1122 NpcBestiaryRarityStars[653] = 2;
1123 NpcBestiaryRarityStars[540] = 2;
1124 NpcBestiaryRarityStars[604] = 3;
1125 NpcBestiaryRarityStars[611] = 3;
1126 NpcBestiaryRarityStars[612] = 2;
1127 NpcBestiaryRarityStars[608] = 2;
1128 NpcBestiaryRarityStars[607] = 2;
1129 NpcBestiaryRarityStars[615] = 3;
1130 NpcBestiaryRarityStars[626] = 2;
1131 NpcBestiaryRarityStars[486] = 2;
1132 NpcBestiaryRarityStars[487] = 3;
1133 NpcBestiaryRarityStars[669] = 3;
1134 NpcBestiaryRarityStars[677] = 5;
1135 NpcBestiaryRarityStars[676] = 5;
1136 NpcBestiaryRarityStars[149] = 2;
1137 NpcBestiaryRarityStars[366] = 2;
1138 NpcBestiaryRarityStars[47] = 3;
1139 NpcBestiaryRarityStars[57] = 3;
1140 NpcBestiaryRarityStars[168] = 3;
1141 NpcBestiaryRarityStars[464] = 3;
1142 NpcBestiaryRarityStars[465] = 3;
1143 NpcBestiaryRarityStars[470] = 3;
1144 NpcBestiaryRarityStars[301] = 2;
1145 NpcBestiaryRarityStars[316] = 3;
1146 NpcBestiaryRarityStars[546] = 2;
1147 NpcBestiaryRarityStars[170] = 3;
1148 NpcBestiaryRarityStars[180] = 3;
1149 NpcBestiaryRarityStars[171] = 3;
1150 NpcBestiaryRarityStars[29] = 2;
1151 NpcBestiaryRarityStars[471] = 4;
1152 NpcBestiaryRarityStars[66] = 3;
1153 NpcBestiaryRarityStars[223] = 2;
1154 NpcBestiaryRarityStars[161] = 2;
1155 NpcBestiaryRarityStars[491] = 4;
1156 NpcBestiaryRarityStars[-9] = 3;
1157 NpcBestiaryRarityStars[594] = 2;
1158 NpcBestiaryRarityStars[628] = 2;
1159 NpcBestiaryRarityStars[225] = 2;
1160 NpcBestiaryRarityStars[224] = 2;
1161 NpcBestiaryRarityStars[250] = 3;
1162 NpcBestiaryRarityStars[16] = 2;
1163 NpcBestiaryRarityStars[481] = 2;
1164 NpcBestiaryRarityStars[483] = 2;
1165 NpcBestiaryRarityStars[184] = 2;
1166 NpcBestiaryRarityStars[185] = 3;
1167 NpcBestiaryRarityStars[206] = 3;
1168 NpcBestiaryRarityStars[541] = 4;
1169 NpcBestiaryRarityStars[537] = 2;
1170 NpcBestiaryRarityStars[205] = 4;
1171 NpcBestiaryRarityStars[499] = 2;
1172 NpcBestiaryRarityStars[494] = 2;
1173 NpcBestiaryRarityStars[496] = 2;
1174 NpcBestiaryRarityStars[302] = 3;
1175 NpcBestiaryRarityStars[317] = 3;
1176 NpcBestiaryRarityStars[318] = 3;
1177 NpcBestiaryRarityStars[319] = 3;
1178 NpcBestiaryRarityStars[320] = 3;
1179 NpcBestiaryRarityStars[321] = 3;
1180 NpcBestiaryRarityStars[331] = 3;
1181 NpcBestiaryRarityStars[332] = 3;
1182 NpcBestiaryRarityStars[322] = 3;
1183 NpcBestiaryRarityStars[323] = 3;
1184 NpcBestiaryRarityStars[324] = 3;
1185 NpcBestiaryRarityStars[335] = 3;
1186 NpcBestiaryRarityStars[336] = 3;
1187 NpcBestiaryRarityStars[333] = 3;
1188 NpcBestiaryRarityStars[334] = 3;
1190 NpcBestiaryRarityStars[50] = 2;
1191 NpcBestiaryRarityStars[35] = 3;
1192 NpcBestiaryRarityStars[13] = 3;
1193 NpcBestiaryRarityStars[134] = 4;
1194 NpcBestiaryRarityStars[262] = 4;
1195 NpcBestiaryRarityStars[668] = 3;
1196 }
1197
1198 private static int GetNPCBestiaryRarityStarsCount(NPC npc)
1199 {
1200 float num = 1f;
1201 num += (float)npc.rarity;
1202 if (npc.rarity == 1)
1203 {
1204 num += 1f;
1205 }
1206 else if (npc.rarity == 2)
1207 {
1208 num += 1.5f;
1209 }
1210 else if (npc.rarity == 3)
1211 {
1212 num += 2f;
1213 }
1214 else if (npc.rarity == 4)
1215 {
1216 num += 2.5f;
1217 }
1218 else if (npc.rarity == 5)
1219 {
1220 num += 3f;
1221 }
1222 else if (npc.rarity > 0)
1223 {
1224 num += 3.5f;
1225 }
1226 if (npc.boss)
1227 {
1228 num += 0.5f;
1229 }
1230 int num2 = npc.damage + npc.defense + npc.lifeMax / 4;
1231 if (num2 > 10000)
1232 {
1233 num += 3.5f;
1234 }
1235 else if (num2 > 5000)
1236 {
1237 num += 3f;
1238 }
1239 else if (num2 > 1000)
1240 {
1241 num += 2.5f;
1242 }
1243 else if (num2 > 500)
1244 {
1245 num += 2f;
1246 }
1247 else if (num2 > 150)
1248 {
1249 num += 1.5f;
1250 }
1251 else if (num2 > 50)
1252 {
1253 num += 1f;
1254 }
1255 if (num > 5f)
1256 {
1257 num = 5f;
1258 }
1259 return (int)num;
1260 }
1261
1262 private static void CreateCreativeItemSortingIds()
1263 {
1265 }
1266}
static HairShaderDataSet Hair
Definition GameShaders.cs:9
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static int None
Definition AmmoID.cs:104
static bool[] IsWellFed
Definition BuffID.cs:18
static bool[] IsAFlaskBuff
Definition BuffID.cs:28
static List< KeyValuePair< int, NPC > > GetSortedBestiaryEntriesList(BestiaryDatabase database)
static int GetLowestBiomeGroupIndex(NPC npc, BestiaryDatabase database, List< IBestiaryInfoElement > commonElements)
static int GetBestiaryNormalGoldCritterPriority(NPC npc)
static ItemGroup GetItemGroup(Item item, out int orderInGroup)
static int GetNPCBestiaryRarityStarsCount(NPC npc)
static Dictionary< int, string > NpcBestiaryCreditIdsByNpcNetIds
static void RebuildItemCreativeSortingIDsAfterRecipesAreSetUp()
static void AddItemResearchOverride_Inner(int itemTypeToSacrifice, int itemTypeToUnlock)
static Dictionary< int, string > NpcPersistentIdsByNetIds
static void CreateCreativeItemSortingIds()
static void FixItemsAfterRecipesAreAdded()
static void RebuildBestiarySortingIDsByBestiaryDatabaseContents(BestiaryDatabase database)
static void CreateBestiarySortingIds(BestiaryDatabase database)
static Dictionary< string, int > NpcNetIdsByPersistentIds
static Dictionary< int, int > NpcBestiaryRarityStars
static Dictionary< int, Item > ItemsByType
static Dictionary< int, CreativeHelper.ItemGroupAndOrderInGroup > ItemCreativeSortingId
static Dictionary< int, NPC > NpcsByNetId
static Dictionary< int, string > ItemPersistentIdsByNetIds
static void FillResearchItemOverrides()
static Dictionary< int, int > CreativeResearchItemPersistentIdOverride
static Dictionary< int, Projectile > ProjectilesByType
static void AddItemResearchOverride(int itemTypeToUnlock, params int[] itemsThatWillResearchTheItemToUnlock)
static Dictionary< string, int > ItemNetIdsByPersistentIds
static Dictionary< int, int > NpcBestiarySortingId
static bool[] IsAMaterial
Definition ItemID.cs:211
static bool[] Deprecated
Definition ItemID.cs:1042
static List< int > ItemsThatAreProcessedAfterNormalContentSample
Definition ItemID.cs:49
static bool[] BossBag
Definition ItemID.cs:1123
static int[] SortingPriorityPainting
Definition ItemID.cs:1074
static int[] SortingPriorityWiring
Definition ItemID.cs:1066
static readonly short Count
Definition ItemID.cs:12138
static readonly IdDictionary Search
Definition ItemID.cs:12140
static bool[] Cart
Definition MountID.cs:9
static Dictionary< int, NPCBestiaryDrawModifiers > NPCBestiaryDrawOffset
Definition NPCID.cs:106
static List< int > NormalGoldCritterBestiaryPriority
Definition NPCID.cs:4066
static List< int > TownNPCBestiaryPriority
Definition NPCID.cs:4086
static List< int > BossBestiaryPriority
Definition NPCID.cs:4075
static bool[] ShouldBeCountedAsBoss
Definition NPCID.cs:4244
static readonly short Count
Definition NPCID.cs:11744
static readonly IdDictionary Search
Definition NPCID.cs:11746
static readonly short Count
static bool[] Platforms
Definition TileID.cs:163
static bool[] vanityPet
Definition Main.cs:778
static bool[] tileSolidTop
Definition Main.cs:1469
static bool[] tileSolid
Definition Main.cs:1471
static bool[] lightPet
Definition Main.cs:780
static bool[] projHook
Definition Main.cs:772
static Dictionary< int, GameModeData > RegisteredGameModes
Definition Main.cs:315
bool boss
Definition NPC.cs:515
int type
Definition NPC.cs:445
int netID
Definition NPC.cs:531
int rarity
Definition NPC.cs:109
void SetDefaults(int Type)