public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns) { base.EditSpawnRate(player, ref spawnRate, ref maxSpawns); PbonePlayer modPlayer = player.GetModPlayer <PbonePlayer>(); spawnRate = (int)(spawnRate * modPlayer.SpawnRateMultiplier); maxSpawns = (int)(maxSpawns * modPlayer.MaxSpawnsMultiplier); }
public override void UpdateInventory(Item item, Player player) { base.UpdateInventory(item, player); PbonePlayer mPlayer = player.GetModPlayer <PbonePlayer>(); if (mPlayer.VoidPig && CoinHelper.CoinTypes.Contains(item.type)) { CoinHelper.VoidPig(player.inventory, player.bank.item); } }
public override void UpdateInventory(Player player) { base.UpdateInventory(player); PbonePlayer modPlayer = player.GetModPlayer <PbonePlayer>(); if (Enabled) { modPlayer.SpawnRateMultiplier += 9; modPlayer.MaxSpawnsMultiplier -= 10; } }
public override bool CanPickup(Item item, Player player) { PbonePlayer mPlayer = player.GetModPlayer <PbonePlayer>(); if (mPlayer.PhilosophersStone && player.HeldItem.type == ModContent.ItemType <PhilosophersStone>()) { return(true); } return(base.CanPickup(item, player)); }
public override bool OnPickup(Item item, Player player) { PbonePlayer mPlayer = player.GetModPlayer <PbonePlayer>(); if (mPlayer.PhilosophersStone && player.HeldItem.type == ModContent.ItemType <PhilosophersStone>() && !CoinHelper.CoinTypes.Contains(item.type)) { int value = item.value; Main.PlaySound(SoundID.CoinPickup); player.SellItem(value, item.stack); return(false); } return(base.OnPickup(item, player)); }
private void UILogic() { Player player = Main.LocalPlayer; PbonePlayer mPlayer = player.GetModPlayer <PbonePlayer>(); if (!ShouldStayOpen(player, CheckRC)) { Close(); return; } CheckRC = true; (bool centerHovered, bool[] buttonsHovered)hoveredButtons = GetHoveredButtons(); if (hoveredButtons.centerHovered) { if (Main.mouseLeft && Main.mouseLeftRelease) { ItemConfig config = mPlayer.ItemConfigs[Name]; config.RedMode = !config.RedMode; } } for (int i = 0; i < ButtonAmount; i++) { if (hoveredButtons.buttonsHovered[i]) { ItemConfig config = mPlayer.ItemConfigs[Name]; string[] keys = config.Data.Keys.ToArray(); if (Main.mouseLeft && Main.mouseLeftRelease) { if (config.OnlyOne) { config.AllOff(); } string key = keys[i]; config.Data[key] = !config.Data[key]; break; } } } }
public void Draw(SpriteBatch spriteBatch, GameTime lastUpdateUIGameTime) { if (!Active) { return; } Player player = Main.LocalPlayer; PbonePlayer mPlayer = player.GetModPlayer <PbonePlayer>(); (Vector2 centerPosition, Vector2[] buttonsPositions)positions = GetPositions(); (bool centerHovered, bool[] buttonsHovered)hoveredButtons = GetHoveredButtons(); ItemConfig config = mPlayer.ItemConfigs[Name]; Vector2 position = positions.centerPosition - ButtonSize * 0.5f; bool hovered = hoveredButtons.centerHovered; Texture2D buttonTexture = PboneUtils.Textures.UI.GetRadialButton(hovered, config.RedMode); Texture2D iconTexture = PboneUtils.Textures.UI.RadialMenuIcons[Name + (config.RedMode ? "Red" : "")]; Color buttonColor = Color.White; Color iconColor = Color.White; spriteBatch.Draw(buttonTexture, position, null, buttonColor, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); spriteBatch.Draw(iconTexture, position, null, iconColor, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); string[] configNames = config.Data.Keys.ToArray(); string configName = ""; for (int i = 0; i < ButtonAmount; i++) { configName = configNames[i]; position = positions.buttonsPositions[i] - ButtonSize * 0.5f; hovered = hoveredButtons.buttonsHovered[i]; buttonTexture = PboneUtils.Textures.UI.GetRadialButton(hovered, config.RedMode); iconTexture = PboneUtils.Textures.UI.RadialMenuIcons[configName]; buttonColor = config.Data[configName] ? Color.White : (hovered ? ButtonOn : ButtonOff); iconColor = config.Data[configName] ? Color.White : (hovered ? IconOn : IconOff); spriteBatch.Draw(buttonTexture, position, null, buttonColor, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); spriteBatch.Draw(iconTexture, position, null, iconColor, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); } UILogic(); }