public override void Action(CommandCaller caller, string input, string[] args) { ushort id; if (!ushort.TryParse(args[0], out _)) { id = CommandUtilities.GetStatID(args[0]); if (id == 10) { Main.NewText("Invalid stat name."); return; } } else { id = ushort.Parse(args[0]); } levelplusModPlayer player = caller.Player.GetModPlayer <levelplusModPlayer>(); if (args.Length == 1) { player.InvestParticularAmount(id); } else { player.InvestParticularAmount(id, ushort.Parse(args[1])); } }
public override void Update(GameTime time) { base.Update(time); levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); level.SetText("" + (modPlayer.level + 1)); if (this.IsMouseHovering) { int numPlayers = 0; float averageLevel = 0; foreach (Player i in Main.player) { if (i.active) { numPlayers++; averageLevel += i.GetModPlayer <levelplusModPlayer>().level + 1; } } averageLevel /= numPlayers; Main.instance.MouseText("Level: " + (modPlayer.level + 1) + "\n" + modPlayer.statPoints + " unspent points\n" + ((Main.netMode == NetmodeID.MultiplayerClient) ? numPlayers + " players online\nAverage Level: " + ((int)averageLevel) : "")); } }
public override void Action(CommandCaller caller, string input, string[] args) { if (!levelplusConfig.Instance.CommandsEnabled) { Main.NewText("Enable commands in the Level+ config to use this command."); return; } ushort id; if (!ushort.TryParse(args[0], out _)) { id = CommandUtilities.GetStatID(args[0]); if (id == 10) { Main.NewText("Invalid stat name."); return; } } else { id = ushort.Parse(args[0]); } levelplusModPlayer player = caller.Player.GetModPlayer <levelplusModPlayer>(); if (args.Length == 1) { player.SetInvestmentToParticularAmount(id); } else { player.SetInvestmentToParticularAmount(id, ushort.Parse(args[1])); } }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); //spriteBatch.Begin(); float quotient = 1f; //calculate quotient switch (stat) { case ResourceBarMode.XP: quotient = modPlayer.currentXP / (float)modPlayer.neededXP; break; default: break; } currentBar.Width.Set(quotient * width, 0f); Recalculate(); //spriteBatch.End(); }
private void pointSpend(UIMouseEvent evt, UIElement listeningElement) { SoundEngine.PlaySound(SoundID.MenuTick); levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); modPlayer.spend(type, (ushort)(levelplus.SpendModFive.Current ? 5 : levelplus.SpendModTen.Current ? 10 : levelplus.SpendModTwentyFive.Current ? 25 : 1)); }
public override bool?UseItem(Player player) { levelplusModPlayer modPlayer = player.GetModPlayer <levelplusModPlayer>(); modPlayer.StatReset(); return(true); }
public override void Action(CommandCaller caller, string input, string[] args) { if (!levelplusConfig.Instance.CommandsEnabled) { Main.NewText("Enable commands in the Level+ config to use this command."); return; } levelplusModPlayer player = caller.Player.GetModPlayer <levelplusModPlayer>(); player.SetLevel(Math.Clamp(uint.Parse(args[0]), 1, 65536) - 1); }
public override void Update(GameTime gameTime) { base.Update(gameTime); levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); string HoverText; switch (stat) { case ResourceBarMode.XP: HoverText = "" + modPlayer.currentXP + " | " + modPlayer.neededXP; break; default: HoverText = ""; break; } if (IsMouseHovering) { Main.instance.MouseText(HoverText); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); unspentPoints.SetText("" + modPlayer.statPoints); if (dragging) { Left.Set(Main.mouseX - offset.X, 0f); Top.Set(Main.mouseY - offset.Y, 0f); Recalculate(); } Rectangle parentSpace = Parent.GetDimensions().ToRectangle(); if (!GetDimensions().ToRectangle().Intersects(parentSpace)) { Left.Pixels = Utils.Clamp(Left.Pixels, 0, parentSpace.Right - Width.Pixels); Top.Pixels = Utils.Clamp(Top.Pixels, 0, parentSpace.Bottom - Height.Pixels); Recalculate(); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); string text; int rarity; levelplusModPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer <levelplusModPlayer>(); switch (type) { case Stat.CONSTITUTION: points.SetText("" + modPlayer.constitution); text = "Constitution:\n\n" + " +" + (modPlayer.constitution * levelplusConfig.Instance.HealthPerPoint) + " life (+" + (modPlayer.level * levelplusConfig.Instance.HealthPerLevel) + " from level)\n" + " +" + (modPlayer.constitution / levelplusConfig.Instance.DefensePerPoint) + " defense\n" + " +" + (modPlayer.constitution / levelplusConfig.Instance.HRegenPerPoint) + " life regen"; rarity = 7; //lime break; case Stat.STRENGTH: points.SetText("" + modPlayer.strength); text = "Strength:\n\n" + " +" + ((int)(modPlayer.strength * (levelplusConfig.Instance.MeleeDamagePerPoint * 100))) + "% melee damage\n" + " +" + (modPlayer.strength / levelplusConfig.Instance.MeleeCritPerPoint) + "% melee crit chance"; rarity = 10; //red break; case Stat.INTELLIGENCE: points.SetText("" + modPlayer.intelligence); text = "Intelligence:\n\n" + " +" + ((int)(modPlayer.intelligence * (levelplusConfig.Instance.MagicDamagePerPoint * 100))) + "% magic damage\n" + " +" + (modPlayer.intelligence / levelplusConfig.Instance.MagicCritPerPoint) + "% magic crit chance"; rarity = 9; //cyan break; case Stat.CHARISMA: points.SetText("" + modPlayer.charisma); text = "Charisma:\n\n" + " +" + ((int)(modPlayer.charisma * (levelplusConfig.Instance.SummonDamagePerPoint * 100))) + "% minion damage\n" + " +" + (modPlayer.charisma / levelplusConfig.Instance.SummonCritPerPoint) + "% minion crit chance"; rarity = 6; //light purple break; case Stat.DEXTERITY: points.SetText("" + modPlayer.dexterity); text = "Dexterity:\n\n" + " +" + ((int)(modPlayer.dexterity * (levelplusConfig.Instance.RangedDamagePerPoint * 100))) + "% ranged damage\n" + " +" + (modPlayer.dexterity / levelplusConfig.Instance.RangedCritPerPoint) + "% ranged crit chance"; rarity = 8; //yellow break; case Stat.MOBILITY: points.SetText("" + modPlayer.mobility); text = "Mobility:\n\n" + " +" + ((int)(modPlayer.mobility * (levelplusConfig.Instance.AccelPerPoint * 100))) + "% acceleration\n" + " +" + ((int)(modPlayer.mobility * (levelplusConfig.Instance.WingPerPoint * 100))) + "% wing time\n" + " +" + ((int)(modPlayer.mobility * (levelplusConfig.Instance.RunSpeedPerPoint * 100))) + "% max run speed"; rarity = 0; //white break; case Stat.EXCAVATION: points.SetText("" + modPlayer.excavation); text = "Excavation:\n\n" + " +" + ((int)(modPlayer.excavation * (levelplusConfig.Instance.PickSpeedPerPoint * 100))) + "% pick speed\n" + " +" + ((int)(modPlayer.excavation * (levelplusConfig.Instance.BuildSpeedPerPoint * 100))) + "% place speed\n" + " +" + (modPlayer.excavation / levelplusConfig.Instance.RangePerPoint) + " block range"; rarity = 0; //white break; case Stat.ANIMALIA: points.SetText("" + modPlayer.animalia); text = "Animalia:\n\n" + " +" + ((int)(modPlayer.animalia * (levelplusConfig.Instance.FishSkillPerPoint * 100))) + "% better fishing\n" + " +" + (modPlayer.animalia / levelplusConfig.Instance.MinionPerPoint) + " minion slots\n"; //+ " +" + ((int)(modPlayer.animalia * (levelplusConfig.Instance.MinionKnockBack * 100))) + "% minion knockback"; rarity = 0; //white break; case Stat.LUCK: points.SetText("" + modPlayer.luck); text = "Luck:\n\n" + " +" + ((int)(modPlayer.luck * (levelplusConfig.Instance.XPPerPoint * 100))) + "% xp gain\n" + " +" + ((int)((modPlayer.luck * 100) / levelplusConfig.Instance.AmmoPerPoint)) + "% chance not to consume ammo"; rarity = 0; //white break; case Stat.MYSTICISM: points.SetText("" + modPlayer.mysticism); text = "Mysticism:\n\n" + " +" + (modPlayer.mysticism * levelplusConfig.Instance.ManaPerPoint) + " max mana (+" + (modPlayer.level * levelplusConfig.Instance.ManaPerLevel) + " from level)\n" + " +" + (modPlayer.mysticism / levelplusConfig.Instance.ManaRegPerPoint) + " mana regen\n" + " -" + System.Math.Clamp((int)(modPlayer.mysticism * (levelplusConfig.Instance.ManaCostPerPoint * 100)), 0f, 99.0f) + "% mana cost (can't be reduced below 1%)"; rarity = 0; //white break; default: text = ""; rarity = 0; break; } if (this.IsMouseHovering) { Main.instance.MouseText(text, rarity); } }