-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTheLunaticItem.cs
65 lines (48 loc) · 1.7 KB
/
TheLunaticItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
using TheLunatic.Items;
using TheLunatic.Logic;
namespace TheLunatic {
class TheLunaticItem : GlobalItem {
public override bool InstancePerEntity => true;
//public override bool CloneNewInstances { get { return true; } }
////////////////
public string AddedTooltip = "";
////////////////
public override GlobalItem Clone( Item item, Item itemClone ) {
var clone = (TheLunaticItem)base.Clone( item, itemClone );
clone.AddedTooltip = this.AddedTooltip;
return clone;
}
////////////////
public override void ModifyTooltips( Item item, List<TooltipLine> tooltips ) {
var mymod = (TheLunaticMod)this.mod;
if( !mymod.Config.Enabled ) { return; }
bool found = item.type == ModContent.ItemType<CustomBossMaskItem>();
if( !found ) { found = MaskLogic.AllVanillaMasks.Contains( item.type ); }
if( found ) {
TooltipLine line = new TooltipLine( mymod, "lunatic_info", "Contains latent spiritual essence" );
line.overrideColor = new Color( Main.DiscoR, 64, 64 );
tooltips.Add( line );
}
if( this.AddedTooltip != "" ) {
tooltips.Add( new TooltipLine( mymod, "lunatic_added", this.AddedTooltip ) );
}
}
public override void UpdateEquip( Item item, Player player ) {
var mymod = (TheLunaticMod)this.mod;
var myplayer = player.GetModPlayer<TheLunaticPlayer>();
if( !mymod.Config.Enabled ) { return; }
if( myplayer.Noclip.IsOn ) {
for( int i = 0; i < 50; i++ ) {
if( player.inventory[i] == null || player.inventory[i].IsAir || player.inventory[i].holdStyle == 0 ) {
player.selectedItem = i;
break;
}
}
}
}
}
}