TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
TravellingMerchantShop.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
3using Terraria.ID;
4
5namespace Terraria.ModLoader;
6
8{
10
12
14
16 : base(npcType)
17 {
18 }
19
21 {
22 _entries.Add(new Entry(item, conditions.ToList()));
23 return this;
24 }
25
26 public TravellingMerchantShop AddInfoEntry(int item, params Condition[] conditions)
27 {
28 return AddInfoEntry(ContentSamples.ItemsByType[item], conditions);
29 }
30
31 public override void FillShop(ICollection<Item> items, NPC npc)
32 {
33 int[] travelShop = Main.travelShop;
34 foreach (int itemId in travelShop)
35 {
36 if (itemId != 0)
37 {
38 items.Add(new Item(itemId));
39 }
40 }
41 }
42
43 public override void FillShop(Item[] items, NPC npc, out bool overflow)
44 {
45 overflow = false;
46 int i = 0;
47 int[] travelShop = Main.travelShop;
48 foreach (int itemId in travelShop)
49 {
50 if (itemId != 0)
51 {
52 items[i++] = new Item(itemId);
53 }
54 }
55 }
56}
static Dictionary< int, Item > ItemsByType
The default T:Terraria.Item for a given item type (F:Terraria.Item.type).
This class stores instances of various content types in a number of dictionaries. These instances ser...
static int[] travelShop
Definition Main.cs:2000
override void FillShop(ICollection< Item > items, NPC npc)
TravellingMerchantShop AddInfoEntry(Item item, params Condition[] conditions)
TravellingMerchantShop AddInfoEntry(int item, params Condition[] conditions)
override IEnumerable< AbstractNPCShop.Entry > ActiveEntries
override void FillShop(Item[] items, NPC npc, out bool overflow)
new record Entry(Item Item, IEnumerable< Condition > Conditions) List< Entry > _entries
record Condition(LocalizedText Description, Func< bool > Predicate)
Definition Condition.cs:10