TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
NPCHappiness.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using System.Linq;
4using Terraria.ID;
5
6namespace Terraria.ModLoader;
7
9public readonly struct NPCHappiness
10{
13 {
14 {
15 AffectionLevel.Hate,
16 1.12f
17 },
18 {
19 AffectionLevel.Dislike,
20 1.06f
21 },
22 {
23 AffectionLevel.Like,
24 0.94f
25 },
26 {
27 AffectionLevel.Love,
28 0.88f
29 }
30 };
31
32 public readonly int NpcType;
33
34 private NPCHappiness(int npcType)
35 {
37 }
38
43
45 {
46 List<IShopPersonalityTrait> shopModifiers = Main.ShopHelper._database.GetOrCreateProfileByNPCID(NpcType).ShopModifiers;
48 if (existingEntry != null)
49 {
51 {
53 return this;
54 }
55 existingEntry.Level = affectionLevel;
56 return this;
57 }
59 {
60 NpcId = npcId,
61 Level = affectionLevel
62 });
63 return this;
64 }
65
70
99
100 public static NPCHappiness Get(int npcType)
101 {
102 return new NPCHappiness(npcType);
103 }
104
105 internal static void RegisterVanillaNpcRelationships()
106 {
107 for (int i = 0; i < NPCID.Count; i++)
108 {
110 }
111 }
112}
static Dictionary< int, NPC > NpcsByNetId
The default T:Terraria.NPC for a given NPC type (F:Terraria.NPC.type). Note that these entries do n...
This class stores instances of various content types in a number of dictionaries. These instances ser...
static readonly short Count
Definition NPCID.cs:12909
static ShopHelper ShopHelper
Definition Main.cs:2024
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
Definition ModContent.cs:38
This class serves as a place for you to place all your properties and hooks for each NPC....
Definition ModNPC.cs:21
Allows for implementing types to be loaded and unloaded.
Definition ILoadable.cs:7
static NPCHappiness Get(int npcType)
NPCHappiness SetBiomeAffection< T >(AffectionLevel affectionLevel)
NPCHappiness SetNPCAffection(int npcId, AffectionLevel affectionLevel)
static readonly Dictionary< AffectionLevel, float > AffectionLevelToPriceMultiplier
Allows you to modify the shop price multipliers associated with a (biome/npc type) relationship level...
NPCHappiness SetBiomeAffection(IShoppingBiome biome, AffectionLevel affectionLevel)
NPCHappiness SetNPCAffection< T >(AffectionLevel affectionLevel)
static void RegisterVanillaNpcRelationships()
This struct provides access to an NPC type's NPC & Biome relationships.