public void SetSoulReference(BaseSoul soul, bool overrideType = true) { this.soulReference = soul; if (overrideType) { this.soulType = this.soulReference?.soulType ?? SoulType.Red; } }
public SoulIndexUISoulSlot(BaseSoul soulReference = null) { this.soulReference = soulReference; this.soulType = this.soulReference?.soulType ?? SoulType.Red; this.Height.Pixels = 26; this.soulTexture = GetTexture("MysticHunter/Souls/Items/BasicSoulItem"); }
/// <summary> /// Tries to add the <paramref name="data"/> to the <see cref="MysticHunter.SoulDict"/> dictionary. /// </summary> /// <param name="data">The <see cref="BaseSoul"/> to add to the dictionary.</param> public static void AddSoul(BaseSoul data) { AddSoulWithKey(data.soulNPC, data); short[] additionalTypes = data.GetAdditionalTypes(); for (int i = 0; i < additionalTypes?.Length; ++i) { AddSoulWithKey(additionalTypes[i], data); } }
private static bool AddSoulWithKey(short key, BaseSoul data) { if (!MysticHunter.Instance.SoulDict.ContainsKey(key)) { MysticHunter.Instance.SoulDict.Add(key, data); return(true); } MysticHunter.Instance.Logger.Warn("ID '" + data.soulNPC + "' - from class '" + data.GetType().ToString() + "' already exists under name '" + MysticHunter.Instance.SoulDict[data.soulNPC].SoulNPCName() + "'."); return(false); }
public override void OnInitialize() { this.SetPadding(0); this.Top.Pixels = 0; this.Left.Pixels = this.Parent.Width.Pixels / 2 + 22; this.Width.Pixels = this.Parent.Width.Pixels / 2 - 28; this.Height.Pixels = this.Parent.Height.Pixels - SoulIndexUIListPanel.height - 8; drawNPC = new NPC(); this.soulReference = null; }
/// <summary> /// Used to process Yellow soul passives, if available. /// </summary> public override void PostUpdateEquips() { if (YellowSoulNet.soulNPC != 0 && !player.HasBuff(BuffType <YellowSoulDebuff>())) { BaseSoul soulReference = YellowSoul; soulReference.SoulUpdate(player, YellowSoulNet.stack); if (soulReference.cooldown > 0) { player.AddBuff(BuffType <YellowSoulDebuff>(), soulReference.cooldown); } } RedSoul?.PostUpdate(player); BlueSoul?.PostUpdate(player); YellowSoul?.PostUpdate(player); }
/// <summary> /// Tries to drop a soul instance for the specified NPC type. /// If the player is in SinglePlayer mode, a local item is created. /// In multiplayer mode, the server creates an instanced item and sends a net message to the relevant clients. /// </summary> /// <param name="soul">The <see cref="BaseSoul"/> instance for the current npc.</param> /// <param name="position">The positition to spawn the soul at.</param> public static void DropSoulnstanced(BaseSoul soul, Vector2 position) { if (Main.netMode == NetmodeID.Server) { var serverConfig = ModContent.GetInstance <SoulServerConfig>(); int item = Item.NewItem(position, ItemType <BasicSoulItem>(), 1, noBroadcast: true); BasicSoulItem bs = Main.item[item].modItem as BasicSoulItem; bs.soulNPC = soul.soulNPC; Main.itemLockoutTime[item] = 54000; for (int i = 0; i < 255; i++) { if (Main.player[i].active) { float modifier = Main.player[i].GetModPlayer <SoulPlayer>().soulDropModifier[(int)soul.soulType]; if (Main.rand.NextFloat() <= modifier || serverConfig.GuaranteedSoulDrops.Any(x => x.Type == soul.soulNPC)) { NetMessage.SendData(MessageID.InstancedItem, i, -1, null, item); } } } Main.item[item].active = false; } else if (Main.netMode == NetmodeID.SinglePlayer) { var serverConfig = ModContent.GetInstance <SoulServerConfig>(); float modifier = Main.LocalPlayer.GetModPlayer <SoulPlayer>().soulDropModifier[(int)soul.soulType]; if (Main.rand.NextFloat() <= modifier || serverConfig.GuaranteedSoulDrops.Any(x => x.Type == soul.soulNPC)) { Item item = Main.item[Item.NewItem(position, ItemType <BasicSoulItem>())]; if (item != null) { BasicSoulItem bs = item.modItem as BasicSoulItem; bs.soulNPC = soul.soulNPC; } } } }
public override void Update(ref float gravity, ref float maxFallSpeed) { if (soulNPC == 0) { return; } BaseSoul s = MysticHunter.Instance.SoulDict[soulNPC]; Vector3 c = new Vector3(.6f, .3f, .2f); if (s.soulType == SoulType.Blue) { c = new Vector3(.2f, .6f, .3f); } else if (s.soulType == SoulType.Yellow) { c = new Vector3(.2f, .5f, .5f); } Lighting.AddLight(item.position, c); }
public void SetSoulReference(BaseSoul soul) { this.soulReference = soul; }