diff --git a/OpenDiablo2.Common.UT/UT_PlayerState.cs b/OpenDiablo2.Common.UT/UT_PlayerState.cs index 73501165..1fe24713 100644 --- a/OpenDiablo2.Common.UT/UT_PlayerState.cs +++ b/OpenDiablo2.Common.UT/UT_PlayerState.cs @@ -14,11 +14,14 @@ namespace OpenDiablo2.Common.UT private PlayerState MakePlayer() { HeroTypeConfig herotypeconfig = new HeroTypeConfig(vitality: 20, strength: 20, dexterity: 20, - energy: 20, health: 50, mana: 40, stamina: 30, + energy: 20, health: 50, mana: 40, stamina: 30, manaRegen: 20, perlevelhealth: 3, perlevelmana: 1.5, perlevelstamina: 1, pervitalityhealth: 2, pervitalitystamina: 1, perenergymana: 1.5, - baseatkrating: -30, basedefrating: -30, perdexterityatkrating: 5, perdexteritydefrating: 4); - LevelExperienceConfig expconfig = new LevelExperienceConfig(new List() + baseatkrating: -30, basedefrating: -30, perdexterityatkrating: 5, perdexteritydefrating: 4, + walkVelocity: 6, runVelocity: 9, runDrain: 20, walkFrames: 8, runFrames: 8, swingFrames: 8, + spellFrames: 8, getHitFrames: 8, bowFrames: 8, startingSkill: 0, baseWeaponClass: "hth", + itemNames: new List(), itemLocs: new List(), itemCounts: new List()); + LevelExperienceConfig expconfig = new LevelExperienceConfig(new List() { 0, // level 0 0, // level 1 diff --git a/OpenDiablo2.Common/Enums/eItemContainerType.cs b/OpenDiablo2.Common/Enums/eItemContainerType.cs new file mode 100644 index 00000000..e27fbae6 --- /dev/null +++ b/OpenDiablo2.Common/Enums/eItemContainerType.cs @@ -0,0 +1,15 @@ +namespace OpenDiablo2.Common.Enums +{ + public enum eItemContainerType + { + Helm, + Glove, + Armor, + Belt, + Boots, + Weapon, + Amulet, + Ring, + Generic + } +} diff --git a/OpenDiablo2.Common/Interfaces/ICharacterPanel.cs b/OpenDiablo2.Common/Interfaces/ICharacterPanel.cs new file mode 100644 index 00000000..3199519d --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/ICharacterPanel.cs @@ -0,0 +1,10 @@ +using System; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface ICharacterPanel : IDisposable + { + void Render(); + void Update(); + } +} diff --git a/OpenDiablo2.Common/Interfaces/IEngineDataManager.cs b/OpenDiablo2.Common/Interfaces/IEngineDataManager.cs index 1378cb9b..028f97a2 100644 --- a/OpenDiablo2.Common/Interfaces/IEngineDataManager.cs +++ b/OpenDiablo2.Common/Interfaces/IEngineDataManager.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using OpenDiablo2.Common.Enums; +using OpenDiablo2.Common.Interfaces.Mobs; using OpenDiablo2.Common.Models; namespace OpenDiablo2.Common.Interfaces @@ -8,5 +10,8 @@ namespace OpenDiablo2.Common.Interfaces List LevelPresets { get; } List LevelTypes { get; } List LevelDetails { get; } + List Items { get; } + Dictionary ExperienceConfigs { get; } + Dictionary HeroTypeConfigs { get; } } } diff --git a/OpenDiablo2.Common/Interfaces/IGameState.cs b/OpenDiablo2.Common/Interfaces/IGameState.cs index 934d8831..6cc3c677 100644 --- a/OpenDiablo2.Common/Interfaces/IGameState.cs +++ b/OpenDiablo2.Common/Interfaces/IGameState.cs @@ -22,6 +22,9 @@ namespace OpenDiablo2.Common.Interfaces bool ToggleShowCharacterPanel(); bool ShowCharacterPanel { get; set; } + Item SelectedItem { get; } + void SelectItem(Item item); + void Initialize(string text, eHero value, eSessionType sessionType); void Update(long ms); IEnumerable GetMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType); diff --git a/OpenDiablo2.Common/Interfaces/IInventoryPanel.cs b/OpenDiablo2.Common/Interfaces/IInventoryPanel.cs new file mode 100644 index 00000000..50f842a2 --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/IInventoryPanel.cs @@ -0,0 +1,10 @@ +using System; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface IInventoryPanel : IDisposable + { + void Render(); + void Update(); + } +} diff --git a/OpenDiablo2.Common/Interfaces/IItem.cs b/OpenDiablo2.Common/Interfaces/IItem.cs new file mode 100644 index 00000000..3d23e2e5 --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/IItem.cs @@ -0,0 +1,10 @@ +using System; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface IItem + { + string Name { get; set; } + string Code { get; set; } + } +} diff --git a/OpenDiablo2.Common/Interfaces/IItemManager.cs b/OpenDiablo2.Common/Interfaces/IItemManager.cs new file mode 100644 index 00000000..1d91c3e9 --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/IItemManager.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using OpenDiablo2.Common.Models; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface IItemManager + { + Item getItem(string code); + } +} diff --git a/OpenDiablo2.Common/Interfaces/IPanelFrame.cs b/OpenDiablo2.Common/Interfaces/IPanelFrame.cs new file mode 100644 index 00000000..799eaede --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/IPanelFrame.cs @@ -0,0 +1,11 @@ +using OpenDiablo2.Common.Enums; +using System; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface IPanelFrame : IDisposable + { + void Render(); + void Update(); + } +} diff --git a/OpenDiablo2.Common/Interfaces/Mobs/IHeroTypeConfig.cs b/OpenDiablo2.Common/Interfaces/Mobs/IHeroTypeConfig.cs index cbab772e..236cebc2 100644 --- a/OpenDiablo2.Common/Interfaces/Mobs/IHeroTypeConfig.cs +++ b/OpenDiablo2.Common/Interfaces/Mobs/IHeroTypeConfig.cs @@ -15,6 +15,7 @@ namespace OpenDiablo2.Common.Interfaces.Mobs int StartingHealth { get; } int StartingMana { get; } int StartingStamina { get; } + int StartingManaRegen { get; } double PerLevelHealth { get; } // NOTE: these are doubles because some classes have // e.g. 1.5 mana per level, which means they get 1 mana on even levels (e.g. -> 2) @@ -31,5 +32,23 @@ namespace OpenDiablo2.Common.Interfaces.Mobs int BaseDefenseRating { get; } int PerDexterityDefenseRating { get; } + + int WalkVelocity { get; } + int RunVelocity { get; } + int RunDrain { get; } + + int WalkFrames { get; } + int RunFrames { get; } + int SwingFrames { get; } + int SpellFrames { get; } + int GetHitFrames { get; } + int BowFrames { get; } + + int StartingSkill { get; } + string BaseWeaponClass { get; } + + IEnumerable ItemNames { get; } + IEnumerable ItemLocs { get; } + IEnumerable ItemCounts { get; } } } diff --git a/OpenDiablo2.Common/Interfaces/Mobs/ILevelExperienceConfig.cs b/OpenDiablo2.Common/Interfaces/Mobs/ILevelExperienceConfig.cs index 0779909c..4ba5ac33 100644 --- a/OpenDiablo2.Common/Interfaces/Mobs/ILevelExperienceConfig.cs +++ b/OpenDiablo2.Common/Interfaces/Mobs/ILevelExperienceConfig.cs @@ -8,7 +8,7 @@ namespace OpenDiablo2.Common.Interfaces.Mobs { public interface ILevelExperienceConfig { - int GetTotalExperienceForLevel(int level); + long GetTotalExperienceForLevel(int level); int GetMaxLevel(); } } diff --git a/OpenDiablo2.Common/Interfaces/System/IMouseInfoProvider.cs b/OpenDiablo2.Common/Interfaces/System/IMouseInfoProvider.cs index ea259720..f674495b 100644 --- a/OpenDiablo2.Common/Interfaces/System/IMouseInfoProvider.cs +++ b/OpenDiablo2.Common/Interfaces/System/IMouseInfoProvider.cs @@ -5,6 +5,7 @@ int MouseX { get; } int MouseY { get; } bool LeftMouseDown { get; } + bool LeftMousePressed { get; } bool RightMouseDown { get; } bool ReserveMouse { get; set; } } diff --git a/OpenDiablo2.Common/Interfaces/UI/IItemContainer.cs b/OpenDiablo2.Common/Interfaces/UI/IItemContainer.cs new file mode 100644 index 00000000..fb233f05 --- /dev/null +++ b/OpenDiablo2.Common/Interfaces/UI/IItemContainer.cs @@ -0,0 +1,16 @@ +using OpenDiablo2.Common.Models; +using System; +using System.Drawing; + +namespace OpenDiablo2.Common.Interfaces +{ + public interface IItemContainer : IDisposable + { + Item ContainedItem { get; } + Point Location { get; set; } + + void SetContainedItem(Item containedItem); + void Render(); + void Update(); + } +} diff --git a/OpenDiablo2.Common/Models/Item/Armor.cs b/OpenDiablo2.Common/Models/Item/Armor.cs new file mode 100644 index 00000000..8b6fe19a --- /dev/null +++ b/OpenDiablo2.Common/Models/Item/Armor.cs @@ -0,0 +1,25 @@ +using OpenDiablo2.Common.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenDiablo2.Common.Models +{ + public sealed class Armor : Item + { + + } + + public static class ArmorHelper + { + public static Armor ToArmor(this string[] row) + => new Armor + { + Name = row[0], + Code = row[17], + InvFile = row[33] + }; + } +} diff --git a/OpenDiablo2.Common/Models/Item/Item.cs b/OpenDiablo2.Common/Models/Item/Item.cs new file mode 100644 index 00000000..128b920c --- /dev/null +++ b/OpenDiablo2.Common/Models/Item/Item.cs @@ -0,0 +1,19 @@ +using OpenDiablo2.Common.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenDiablo2.Common.Models +{ + /** + * Base Item class, contains common attributes for all item types. + **/ + public abstract class Item + { + public string Code { get; internal set; } // Internal code + public string Name { get; internal set; } // Item name + public string InvFile { get; internal set; } // Sprite used for the inventory and mouse cursor + } +} diff --git a/OpenDiablo2.Common/Models/Item/Misc.cs b/OpenDiablo2.Common/Models/Item/Misc.cs new file mode 100644 index 00000000..6c55470f --- /dev/null +++ b/OpenDiablo2.Common/Models/Item/Misc.cs @@ -0,0 +1,25 @@ +using OpenDiablo2.Common.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenDiablo2.Common.Models +{ + public sealed class Misc : Item + { + + } + + public static class MiscHelper + { + public static Misc ToMisc(this string[] row) + => new Misc + { + Name = row[0], + Code = row[12], + InvFile = row[21] + }; + } +} diff --git a/OpenDiablo2.Common/Models/Item/Weapon.cs b/OpenDiablo2.Common/Models/Item/Weapon.cs new file mode 100644 index 00000000..6e1d595b --- /dev/null +++ b/OpenDiablo2.Common/Models/Item/Weapon.cs @@ -0,0 +1,25 @@ +using OpenDiablo2.Common.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenDiablo2.Common.Models +{ + public sealed class Weapon : Item + { + + } + + public static class WeaponHelper + { + public static Weapon ToWeapon(this string[] row) + => new Weapon + { + Name = row[0], + Code = row[2], + InvFile = row[45] + }; + } +} diff --git a/OpenDiablo2.Common/Models/ItemContainerLayout.cs b/OpenDiablo2.Common/Models/ItemContainerLayout.cs new file mode 100644 index 00000000..bd0701b8 --- /dev/null +++ b/OpenDiablo2.Common/Models/ItemContainerLayout.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OpenDiablo2.Common.Enums; + +namespace OpenDiablo2.Common.Models +{ + public class ItemContainerLayout + { + public string ResourceName { get; internal set; } + public string PaletteName { get; internal set; } = Palettes.Units; + public int BaseFrame { get; internal set; } = 0; + + public static Dictionary Values = new Dictionary + { + {eItemContainerType.Helm, new ItemContainerLayout { ResourceName = ResourcePaths.HelmGlovePlaceholder, BaseFrame = 1 } }, + {eItemContainerType.Amulet, new ItemContainerLayout{ ResourceName = ResourcePaths.RingAmuletPlaceholder } }, + {eItemContainerType.Armor, new ItemContainerLayout { ResourceName = ResourcePaths.ArmorPlaceholder } }, + {eItemContainerType.Weapon, new ItemContainerLayout { ResourceName = ResourcePaths.WeaponsPlaceholder } }, + {eItemContainerType.Belt, new ItemContainerLayout { ResourceName = ResourcePaths.BeltPlaceholder } }, + {eItemContainerType.Ring, new ItemContainerLayout { ResourceName = ResourcePaths.RingAmuletPlaceholder, BaseFrame = 1 } }, + {eItemContainerType.Glove, new ItemContainerLayout { ResourceName = ResourcePaths.HelmGlovePlaceholder } }, + {eItemContainerType.Boots, new ItemContainerLayout { ResourceName = ResourcePaths.BootsPlaceholder } }, + }; + } + +} diff --git a/OpenDiablo2.Common/Models/Mobs/HeroTypeConfig.cs b/OpenDiablo2.Common/Models/Mobs/HeroTypeConfig.cs index e6a9c711..56470342 100644 --- a/OpenDiablo2.Common/Models/Mobs/HeroTypeConfig.cs +++ b/OpenDiablo2.Common/Models/Mobs/HeroTypeConfig.cs @@ -16,6 +16,7 @@ namespace OpenDiablo2.Common.Models.Mobs public int StartingHealth { get; protected set; } public int StartingMana { get; protected set; } public int StartingStamina { get; protected set; } + public int StartingManaRegen { get; protected set; } public double PerLevelHealth { get; protected set; } public double PerLevelMana { get; protected set; } @@ -31,11 +32,34 @@ namespace OpenDiablo2.Common.Models.Mobs public int BaseDefenseRating { get; protected set; } public int PerDexterityDefenseRating { get; protected set; } + public int WalkVelocity { get; protected set; } + public int RunVelocity { get; protected set; } + public int RunDrain { get; protected set; } + + public int WalkFrames { get; protected set; } + public int RunFrames { get; protected set; } + public int SwingFrames { get; protected set; } + public int SpellFrames { get; protected set; } + public int GetHitFrames { get; protected set; } + public int BowFrames { get; protected set; } + + public int StartingSkill { get; protected set; } + public string BaseWeaponClass { get; protected set; } + + public IEnumerable ItemNames { get; } + public IEnumerable ItemLocs { get; } + public IEnumerable ItemCounts { get; } + public HeroTypeConfig(int vitality, int strength, int dexterity, int energy, - int health, int mana, int stamina, + int health, int mana, int stamina, int manaRegen, double perlevelhealth, double perlevelmana, double perlevelstamina, double pervitalityhealth, double pervitalitystamina, double perenergymana, - int baseatkrating, int basedefrating, int perdexterityatkrating, int perdexteritydefrating) + int baseatkrating, int basedefrating, int perdexterityatkrating, int perdexteritydefrating, + int walkVelocity, int runVelocity, int runDrain, + int walkFrames, int runFrames, int swingFrames, int spellFrames, int getHitFrames, int bowFrames, + int startingSkill, + string baseWeaponClass, + List itemNames, List itemLocs, List itemCounts) { StartingDexterity = dexterity; StartingVitality = vitality; @@ -44,6 +68,7 @@ namespace OpenDiablo2.Common.Models.Mobs StartingMana = mana; StartingHealth = health; StartingStamina = stamina; + StartingManaRegen = manaRegen; PerLevelHealth = perlevelhealth; PerLevelMana = perlevelmana; @@ -57,6 +82,102 @@ namespace OpenDiablo2.Common.Models.Mobs BaseDefenseRating = basedefrating; PerDexterityAttackRating = perdexterityatkrating; PerDexterityDefenseRating = perdexteritydefrating; + + WalkVelocity = walkVelocity; + RunVelocity = runVelocity; + RunDrain = runDrain; + + WalkFrames = walkFrames; + RunFrames = runFrames; + SwingFrames = swingFrames; + SpellFrames = spellFrames; + GetHitFrames = getHitFrames; + BowFrames = bowFrames; + + StartingSkill = startingSkill; + BaseWeaponClass = baseWeaponClass; + + ItemNames = itemNames; + ItemLocs = itemLocs; + ItemCounts = itemCounts; + } + } + + public static class HeroTypeConfigHelper + { + public static IHeroTypeConfig ToHeroTypeConfig(this string[] row) + { + // rows: + + // 0 1 2 3 4 5 6 7 + // class str dex int vit tot stamina hpadd + // 8 9 10 11 + // PercentStr PercentDex PercentInt PercentVit + // 12 13 14 15 + // ManaRegen ToHitFactor WalkVelocity RunVelocity + // 16 17 18 19 20 + // RunDrain Comment LifePerLevel StaminaPerLevel ManaPerLevel + // 21 22 23 + // LifePerVitality StaminaPerVitality ManaPerMagic + // 24 25 26 27 28 29 + // #walk #run #swing #spell #gethit #bow + // 30 31 32 + // BlockFactor StartSkill baseWClass + // 33 34 35 36 37 38 + // item1 item1loc item1count item2 item2loc item2count + // 39 40 41 42 43 44 + // item3 item3loc item3count item4 item4loc item4count + // 45 46 47 48 49 50 + // item5 item5loc item5count item6 item6loc item6count + // 51 52 53 54 55 56 + // item7 item7loc item7count item8 item8loc item8count + // 57 58 59 60 61 62 + // item9 item9loc item9count item10 item10loc item10count + + List itemNames = new List(); + List itemLocs = new List(); + List itemCounts = new List(); + + for(int i = 33; i <= 60; i+=3) + { + itemNames.Add(row[i]); + itemLocs.Add(row[i + 1]); + itemCounts.Add(Convert.ToInt32(row[i + 2])); + } + + return new HeroTypeConfig( + vitality: Convert.ToInt32(row[4]), + strength: Convert.ToInt32(row[1]), + dexterity: Convert.ToInt32(row[2]), + energy: Convert.ToInt32(row[3]), + health: Convert.ToInt32(row[7]), + mana: 0, + stamina: Convert.ToInt32(row[6]), + manaRegen: Convert.ToInt32(row[12]), + perlevelhealth: Convert.ToInt32(row[18]) / 4.0, + perlevelmana: Convert.ToInt32(row[20]) / 4.0, + perlevelstamina: Convert.ToInt32(row[19]) / 4.0, + pervitalityhealth: Convert.ToInt32(row[21]) / 4.0, + pervitalitystamina: Convert.ToInt32(row[22]) / 4.0, + perenergymana: Convert.ToInt32(row[23]) / 4.0, + baseatkrating: Convert.ToInt32(row[13]), + basedefrating: Convert.ToInt32(row[30]), + perdexterityatkrating: 5, + perdexteritydefrating: 4, + walkVelocity: Convert.ToInt32(row[14]), + runVelocity: Convert.ToInt32(row[15]), + runDrain: Convert.ToInt32(row[16]), + walkFrames: Convert.ToInt32(row[24]), + runFrames: Convert.ToInt32(row[25]), + swingFrames: Convert.ToInt32(row[26]), + spellFrames: Convert.ToInt32(row[27]), + getHitFrames: Convert.ToInt32(row[28]), + bowFrames: Convert.ToInt32(row[29]), + startingSkill: Convert.ToInt32(row[31]), + baseWeaponClass: row[32], + itemNames: itemNames, + itemLocs: itemLocs, + itemCounts: itemCounts); } } } diff --git a/OpenDiablo2.Common/Models/Mobs/LevelExperienceConfig.cs b/OpenDiablo2.Common/Models/Mobs/LevelExperienceConfig.cs index abfb5c12..5c0c3691 100644 --- a/OpenDiablo2.Common/Models/Mobs/LevelExperienceConfig.cs +++ b/OpenDiablo2.Common/Models/Mobs/LevelExperienceConfig.cs @@ -1,4 +1,5 @@ -using OpenDiablo2.Common.Interfaces.Mobs; +using OpenDiablo2.Common.Enums; +using OpenDiablo2.Common.Interfaces.Mobs; using System; using System.Collections.Generic; using System.Linq; @@ -9,14 +10,14 @@ namespace OpenDiablo2.Common.Models.Mobs { public class LevelExperienceConfig : ILevelExperienceConfig { - private List ExperiencePerLevel = new List(); + private List ExperiencePerLevel = new List(); - public LevelExperienceConfig(List expperlevel) + public LevelExperienceConfig(List expperlevel) { ExperiencePerLevel = expperlevel; } - public int GetTotalExperienceForLevel(int level) + public long GetTotalExperienceForLevel(int level) { if(ExperiencePerLevel.Count <= level) { @@ -30,4 +31,42 @@ namespace OpenDiablo2.Common.Models.Mobs return ExperiencePerLevel.Count - 1; } } + + public static class LevelExperienceConfigHelper + { + public static Dictionary ToLevelExperienceConfigs(this string[][] data) + { + Dictionary result = new Dictionary(); + for (int i = 1; i < data[0].Length; i++) + { + // i starts at 1 because we want to skip the first column + // the first column is just the row titles + string heroname = data[i][0]; // first row is the hero name + eHero herotype = default(eHero); + if(!Enum.TryParse(heroname, out herotype)) + { + continue; // skip this hero if we can't parse the name into a valid hero type + } + int maxlevel = -1; + if(!int.TryParse(data[1][i], out maxlevel)) + { + maxlevel = -1;// we don't need to fail in this case since maxlevel + // can be inferred from the number of experience listings + } + List expperlevel = new List(); + for (int o = 2; o < data.Length && (o-2 < maxlevel || maxlevel == -1); o++) + { + long exp = 0; + if(!long.TryParse(data[o][i], out exp)) + { + throw new Exception("Could not parse experience number '" + data[o][i] + "'."); + } + expperlevel.Add(exp); + } + result.Add(herotype, new LevelExperienceConfig(expperlevel)); + } + + return result; + } + } } diff --git a/OpenDiablo2.Common/Models/Mobs/PlayerState.cs b/OpenDiablo2.Common/Models/Mobs/PlayerState.cs index 4b3954a5..cb6d8bdf 100644 --- a/OpenDiablo2.Common/Models/Mobs/PlayerState.cs +++ b/OpenDiablo2.Common/Models/Mobs/PlayerState.cs @@ -25,19 +25,27 @@ namespace OpenDiablo2.Common.Models.Mobs protected Stat Stamina; protected Stat Mana; + protected Stat ManaRegen; - public int Experience { get; protected set; } + protected Stat WalkVelocity; + protected Stat RunVelocity; + protected Stat RunDrain; + + + + public long Experience { get; protected set; } public PlayerState() : base() { } public PlayerState(int clientHash, string name, int id, int level, float x, float y, - int vitality, int strength, int energy, int dexterity, int experience, eHero herotype, + int vitality, int strength, int energy, int dexterity, long experience, eHero herotype, IHeroTypeConfig heroconfig, ILevelExperienceConfig expconfig) : base(name, id, level, 0, x, y) { this.ClientHash = clientHash; Stamina = new Stat(0, 0, 0, true); Mana = new Stat(0, 0, 0, true); + ManaRegen = new Stat(0, heroconfig.StartingManaRegen, heroconfig.StartingManaRegen, true); Vitality = new Stat(0, vitality, vitality, true); Strength = new Stat(0, strength, strength, true); @@ -47,6 +55,10 @@ namespace OpenDiablo2.Common.Models.Mobs AttackRating = new Stat(0, 0, 0, false); DefenseRating = new Stat(0, 0, 0, false); + WalkVelocity = new Stat(0, heroconfig.WalkVelocity, 100, false); // TODO: what should max velocity be? (replace the 100) + RunVelocity = new Stat(0, heroconfig.RunVelocity, 100, false); // TODO: what should max velocity be? + RunDrain = new Stat(0, heroconfig.RunDrain, heroconfig.RunDrain, true); + Experience = experience; // how much total exp do they have HeroType = herotype; @@ -63,11 +75,11 @@ namespace OpenDiablo2.Common.Models.Mobs } #region Level and Experience - public int GetExperienceToLevel() + public long GetExperienceToLevel() { return GetExperienceTotalToLevel() - Experience; } - public int GetExperienceTotalToLevel() + public long GetExperienceTotalToLevel() { return ExperienceConfig.GetTotalExperienceForLevel(Level + 1); } @@ -75,7 +87,7 @@ namespace OpenDiablo2.Common.Models.Mobs { return ExperienceConfig.GetMaxLevel(); } - public bool AddExperience(int amount) + public bool AddExperience(long amount) { // returns true if you level up from this Experience += amount; @@ -183,6 +195,10 @@ namespace OpenDiablo2.Common.Models.Mobs { Mana.AddCurrent(-mana); } + public int GetManaRegen() + { + return ManaRegen.GetCurrent(); + } #endregion Mana #region Stamina @@ -204,6 +220,21 @@ namespace OpenDiablo2.Common.Models.Mobs } #endregion Stamina + #region Movement + public int GetRunVelocity() + { + return RunVelocity.GetCurrent(); + } + public int GetWalkVeloicty() + { + return WalkVelocity.GetCurrent(); + } + public int GetRunDrain() + { + return RunDrain.GetCurrent(); + } + #endregion Movement + // TODO: when a player equips an item, apply the relevant modifiers to their stats // TODO: when a player unequips an item, remove the relevant modifiers from their stats } diff --git a/OpenDiablo2.Common/OpenDiablo2.Common.csproj b/OpenDiablo2.Common/OpenDiablo2.Common.csproj index d224b892..355d520c 100644 --- a/OpenDiablo2.Common/OpenDiablo2.Common.csproj +++ b/OpenDiablo2.Common/OpenDiablo2.Common.csproj @@ -56,6 +56,7 @@ + @@ -77,6 +78,7 @@ + @@ -87,9 +89,11 @@ + + @@ -122,6 +126,10 @@ + + + + diff --git a/OpenDiablo2.Common/ResourcePaths.cs b/OpenDiablo2.Common/ResourcePaths.cs index 0e7a539f..5a5cd8a7 100644 --- a/OpenDiablo2.Common/ResourcePaths.cs +++ b/OpenDiablo2.Common/ResourcePaths.cs @@ -117,6 +117,13 @@ namespace OpenDiablo2.Common public static string RunButton = "data\\global\\ui\\PANEL\\runbutton.dc6"; public static string MenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6"; + public static string ArmorPlaceholder = "data\\global\\ui\\PANEL\\inv_armor.DC6"; + public static string BeltPlaceholder = "data\\global\\ui\\PANEL\\inv_belt.DC6"; + public static string BootsPlaceholder = "data\\global\\ui\\PANEL\\inv_boots.DC6"; + public static string HelmGlovePlaceholder = "data\\global\\ui\\PANEL\\inv_helm_glove.DC6"; + public static string RingAmuletPlaceholder = "data\\global\\ui\\PANEL\\inv_ring_amulet.DC6"; + public static string WeaponsPlaceholder = "data\\global\\ui\\PANEL\\inv_weapons.DC6"; + // --- Data --- // TODO: Doesn't sound right :) public static string EnglishTable = "data\\local\\lng\\eng\\English.txt"; @@ -130,6 +137,18 @@ namespace OpenDiablo2.Common public static string AnimationData = "data\\global\\animdata.d2"; public static string PlayerAnimationBase = "data\\global\\CHARS"; + // --- Inventory Data --- + public static string Weapons = "data\\global\\excel\\weapons.txt"; + public static string Armor = "data\\global\\excel\\armor.txt"; + public static string Misc = "data\\global\\excel\\misc.txt"; + // --- Character Data --- + public static string Experience = "data\\global\\excel\\experience.txt"; + public static string CharStats = "data\\global\\excel\\charstats.txt"; + + public static string GeneratePathForItem(string spriteName) + { + return $"data\\global\\items\\{spriteName}.dc6"; + } } } diff --git a/OpenDiablo2.Core/AutofacModule.cs b/OpenDiablo2.Core/AutofacModule.cs index 3c4889aa..1a12d811 100644 --- a/OpenDiablo2.Core/AutofacModule.cs +++ b/OpenDiablo2.Core/AutofacModule.cs @@ -17,6 +17,7 @@ namespace OpenDiablo2.Core builder.RegisterType