internal static void Load(VapePlayer modPlayer, TagCompound tag) { TagCompound stats = tag.GetCompound("BaseStats"); TagCompound skillLevels = tag.GetCompound("SkillLevels"); TagCompound chaosBonuses = tag.GetCompound("ChaosBonuses"); string key; modPlayer.statPoints = tag.GetAsInt("StatPoints"); modPlayer.skillPoints = tag.GetAsInt("SkillPoints"); modPlayer.chaosPoints = tag.GetAsInt("ChaosPoints"); // Unboxing values into the proper dictionary foreach (var stat in stats) { key = stat.Key; // Intellect was removed in v0.3.1 if (key == "Intellect") { modPlayer.statPoints += (int)stat.Value; continue; } // Agility was renamed to Haste in v0.3.1 else if (key == "Agility") { key = "Haste"; } modPlayer.BaseStats[key] = (int)stat.Value; } foreach (var skillLevel in skillLevels) { modPlayer.SkillLevels[skillLevel.Key] = (int)skillLevel.Value; } foreach (var chaosBonus in chaosBonuses) { key = chaosBonus.Key; // Movement Speed as a chaos bonus was replaced with Max Run Speed in v0.3.1 if (key == "Movement Speed") { key = "Max Run Speed"; } modPlayer.ChaosBonuses[key] = (float)chaosBonus.Value; } modPlayer.chaosRank = tag.GetAsInt("ChaosRank"); modPlayer.chaosXp = tag.GetAsLong("ChaosXp"); modPlayer.xp = tag.GetAsLong("Xp"); Vector2 expUIPos = tag.Get <Vector2>("expUIPos"); VapeRPG vapeMod = (modPlayer.mod as VapeRPG); vapeMod.ExpUI.SetPanelPosition(expUIPos); }
private void CheckExpUIOverflow() { VapeRPG vapeMod = (this.mod as VapeRPG); bool expUIOverflow = false; if (this.expUIPos.X >= Main.screenWidth) { this.expUIPos.X = Main.screenWidth - vapeMod.ExpUI.Width.Pixels; expUIOverflow = true; } if (this.expUIPos.Y >= Main.screenHeight) { this.expUIPos.Y = Main.screenHeight - vapeMod.ExpUI.Height.Pixels; expUIOverflow = true; } if (expUIOverflow) { vapeMod.ExpUI.SetPanelPosition(this.expUIPos); } }
public override void PostUpdate() { VapeRPG vapeMod = (this.mod as VapeRPG); // Just for saving it properly when the player exits this.expUIPos = vapeMod.ExpUI.GetPanelPosition(); if (this.level > VapeRPG.MaxLevel) { this.level = VapeRPG.MaxLevel; } else if (this.level < 1) { this.level = 1; } if (this.xp > vapeMod.XpNeededForLevel[VapeRPG.MaxLevel]) { this.xp = vapeMod.XpNeededForLevel[VapeRPG.MaxLevel]; } if (this.chaosXp > vapeMod.XpNeededForChaosRank[VapeRPG.MaxLevel]) { this.chaosXp = vapeMod.XpNeededForChaosRank[VapeRPG.MaxLevel]; } // Checking if the player has enough xp to level up if (this.level < VapeRPG.MaxLevel && this.xp >= vapeMod.XpNeededForLevel[this.level + 1]) { this.LevelUp(); } if (this.chaosRank < VapeRPG.MaxLevel && this.chaosXp >= vapeMod.XpNeededForChaosRank[this.chaosRank + 1]) { this.ChaosRankUp(); } this.CheckExpUIOverflow(); if (Main.netMode == NetmodeID.MultiplayerClient) { ModPacket packet = this.mod.GetPacket(); packet.Write((byte)VapeRPGMessageType.ClientSyncStats); packet.Write(this.player.whoAmI); foreach (var x in this.BaseStats) { packet.Write(String.Format("{0} {1}", x.Key, x.Value)); } foreach (var x in this.EffectiveStats) { packet.Write(String.Format("{0} {1}", x.Key, x.Value)); } packet.Send(); } if (this.fieldCounter > 0 && this.fieldCounter % 15 == 0) { foreach (NPC npc in Main.npc) { if (!npc.friendly && npc.active) { if (Vector2.Distance(npc.position, player.position) <= StaticField.range) { int baseDamage = 15 * this.SkillLevels["Static Field"]; npc.StrikeNPC((int)Math.Ceiling(baseDamage * this.player.minionDamage), 0, 0); if (this.HasSkill("High-Voltage Field")) { npc.AddBuff(32, 300); } } } } } // Updating the UI if (!Main.dedServ) { int nextLevel = this.level + 1; if (this.level == VapeRPG.MaxLevel) { nextLevel = VapeRPG.MaxLevel; } int nextRank = this.chaosRank + 1; if (this.chaosRank == VapeRPG.MaxLevel) { nextRank = VapeRPG.MaxLevel; } vapeMod.ExpUI.UpdateXpBar(this.xp, vapeMod.XpNeededForLevel[this.level], vapeMod.XpNeededForLevel[nextLevel]); vapeMod.ExpUI.UpdateChaosXpBar(this.chaosXp, vapeMod.XpNeededForChaosRank[this.chaosRank], vapeMod.XpNeededForChaosRank[nextRank]); vapeMod.ExpUI.UpdateLevel(this.level, this.chaosRank); if (CharUIState.visible) { vapeMod.CharUI.UpdateStats(this.BaseStats, this.EffectiveStats, this.statPoints, this.skillPoints); vapeMod.CharUI.UpdateBonusPanel(this.chaosPoints, player.meleeDamage, player.magicDamage, player.rangedDamage, player.meleeCrit, player.magicCrit, player.rangedCrit, 1f / player.meleeSpeed, player.maxRunSpeed, this.dodgeChance, this.blockChance, player.maxMinions, player.minionDamage); } } }
internal void AddPrerequisites() { // Reaper tree if (this.name == "Rage" || this.name == "Mana Addict" || this.name == "Static Field") { this.Prerequisites.Add(VapeRPG.GetSkill("Excitement")); } else if (this.name == "Bloodlust") { this.Prerequisites.Add(VapeRPG.GetSkill("Rage")); } else if (this.name == "Exploding Rage") { this.Prerequisites.Add(VapeRPG.GetSkill("Bloodlust")); } else if (this.name == "Overkill") { this.Prerequisites.Add(VapeRPG.GetSkill("Rage")); } else if (this.name == "Fury") { this.Prerequisites.Add(VapeRPG.GetSkill("Overkill")); } else if (this.name == "High-Voltage Field") { this.Prerequisites.Add(VapeRPG.GetSkill("Static Field")); this.Prerequisites.Add(VapeRPG.GetSkill("Energizing Kills")); } else if (this.name == "Magic Sparks") { this.Prerequisites.Add(VapeRPG.GetSkill("Mana Addict")); } else if (this.name == "Overkill Charge") { this.Prerequisites.Add(VapeRPG.GetSkill("Magic Sparks")); } else if (this.name == "Spectral Sparks") { this.Prerequisites.Add(VapeRPG.GetSkill("Overkill Charge")); this.Prerequisites.Add(VapeRPG.GetSkill("Energizing Kills")); } else if (this.name == "Energizing Kills") { this.Prerequisites.Add(VapeRPG.GetSkill("Mana Addict")); } //Shredder tree else if (this.name == "Bounce" || this.name == "Confusion" || this.name == "High Five" || this.name == "Close Combat Specialist" || this.name == "Ammo Hoarding") { this.Prerequisites.Add(VapeRPG.GetSkill("One Above All")); } else if (this.name == "Leftover Supply") { this.Prerequisites.Add(VapeRPG.GetSkill("Bounce")); } else if (this.name == "Confusion Field") { this.Prerequisites.Add(VapeRPG.GetSkill("Confusion")); } else if (this.name == "Titan Grip") { this.Prerequisites.Add(VapeRPG.GetSkill("High Five")); } else if (this.name == "Hawk Eye") { this.Prerequisites.Add(VapeRPG.GetSkill("Titan Grip")); } // Power else if (this.name == "First Touch" || this.name == "Aggro" || this.name == "Longer Flight" || this.name == "Reflection" || this.name == "Damage to Defense") { this.Prerequisites.Add(VapeRPG.GetSkill("Warmth")); } else if (this.name == "Kickstart") { this.Prerequisites.Add(VapeRPG.GetSkill("First Touch")); } else if (this.name == "Execution") { this.Prerequisites.Add(VapeRPG.GetSkill("Kickstart")); } else if (this.name == "Strengthen") { this.Prerequisites.Add(VapeRPG.GetSkill("Reflection")); } else if (this.name == "Vital Supplies") { this.Prerequisites.Add(VapeRPG.GetSkill("Damage to Defense")); } else if (this.name == "Hardened Skin") { this.Prerequisites.Add(VapeRPG.GetSkill("Vital Supplies")); this.Prerequisites.Add(VapeRPG.GetSkill("Strengthen")); } else if (this.name == "Angel") { this.Prerequisites.Add(VapeRPG.GetSkill("Longer Flight")); } }