private void PresetButtonLeftClick(UIMouseEvent evt, UIElement e)
        {
            SoulPlayer sp = Main.LocalPlayer.GetModPlayer <SoulPlayer>();

            if (this.presetIndex >= sp.activeSouls.GetLength(0))
            {
                return;
            }

            sp.activeSoulConfig = this.presetIndex;
            sp.UpdateActiveSoulData();
        }
示例#2
0
        /// <summary>
        /// Triggers on pickup. Checks if a corresponding soul exists and sets that soul as acquired.
        /// </summary>
        /// <param name="player">The player that interacts with this item.</param>
        /// <returns>Always returns false. This item is not actually added to the players' inventory.</returns>
        public override bool OnPickup(Player player)
        {
            SoulPlayer sp = player.GetModPlayer <SoulPlayer>();

            if (MysticHunter.Instance.SoulDict.TryGetValue(soulNPC, out BaseSoul soul))
            {
                Color c = Color.Red;
                if (soul.soulType == SoulType.Blue)
                {
                    c = Color.Blue;
                }
                else if (soul.soulType == SoulType.Yellow)
                {
                    c = Color.Yellow;
                }

                if (!sp.UnlockedSouls.ContainsKey(soulNPC))
                {
                    sp.UnlockedSouls.Add(soulNPC, 0);
                }

                if (!sp.HasMaxSouls(soulNPC))
                {
                    // Display a message in chat.
                    Main.NewText($"You collected your {numberList[sp.UnlockedSouls[soulNPC]]} {soul.SoulNPCName()} soul.", c);

                    // Increase the stack for this soul.
                    sp.UnlockedSouls[soulNPC]++;

                    // Update the local player soul data and UI.
                    sp.UpdateActiveSoulData();
                    SoulManager.ReloadSoulIndexUI();

                    // Emit a sound a particle effect.
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoulPickup"), player.Center);
                    for (int i = 0; i < 5; ++i)
                    {
                        Dust d = Main.dust[Dust.NewDust(player.position, player.width, player.height, DustID.AncientLight, 0f, 0f, 255, c, Main.rand.Next(20, 26) * 0.1f)];
                        d.noLight   = true;
                        d.noGravity = true;
                        d.velocity *= 0.5f;
                    }
                }
            }
            else
            {
                // Debug message for when a soul with the given `soulDataID` cannot be found.
                Main.NewText("Soul with ID '" + soulNPC + "' cannot be found.");
            }

            return(false);
        }
示例#3
0
        private void SetSoulSlot(UIMouseEvent evt, UIElement e)
        {
            if (!(e is SoulIndexUISoulSlot slot))
            {
                return;
            }

            int        soulIndex = (int)slot.soulReference.soulType;
            SoulPlayer sp        = Main.LocalPlayer.GetModPlayer <SoulPlayer>();

            // TODO: Eldrazi - Maybe change the sound?
            Main.PlaySound(SoundID.Item37);
            sp.activeSouls[sp.activeSoulConfig, soulIndex].soulNPC = slot.soulReference.soulNPC;
            sp.UpdateActiveSoulData();
        }