1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-12-25 19:46:50 -05:00

Archived old logic

This commit is contained in:
Tim Sarbin 2019-02-20 12:11:18 -05:00
parent b722405d53
commit ef52e31e9d
252 changed files with 0 additions and 28616 deletions

Binary file not shown.

View File

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{77B00705-A2A5-4675-9A16-1FAB2692151B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenDiablo2.Common.UT</RootNamespace>
<AssemblyName>OpenDiablo2.Common.UT</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UT_EnemyState.cs" />
<Compile Include="UT_MobState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UT_PlayerState.cs" />
<Compile Include="UT_Stat.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenDiablo2.Common\OpenDiablo2.Common.csproj">
<Project>{B743160E-A0BB-45DC-9998-967A85E50562}</Project>
<Name>OpenDiablo2.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -1,20 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OpenDiablo2.Common.UT")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenDiablo2.Common.UT")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("77b00705-a2a5-4675-9a16-1fab2692151b")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,200 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Enums.Mobs;
using OpenDiablo2.Common.Models.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.UT
{
[TestClass]
public class UT_EnemyState
{
public EnemyState MakeEnemyState(int id, eDifficulty difficulty, Random rand)
{
// does not correspond to any particular enemy in the actual data, just for testing
EnemyTypeConfig config = new EnemyTypeConfig(
InternalName: "TestEnemy",
Name: "TestEnemy1",
Type: "Skeleton",
Descriptor: "",
BaseId: 1,
PopulateId: 1,
Spawned: true,
Beta: false,
Code: "SK",
ClientOnly: false,
NoMap: false,
SizeX: 2,
SizeY: 2,
Height: 3,
NoOverlays: false,
OverlayHeight: 2,
Velocity: 3,
RunVelocity: 6,
CanStealFrom: false,
ColdEffect: 50,
Rarity: true,
MinimumGrouping: 2,
MaximumGrouping: 5,
BaseWeapon: "1hs",
AIParams: new int[] {75, 85, 9, 50, 0 },
Allied: false,
IsNPC: false,
IsCritter: false,
CanEnterTown: false,
HealthRegen: 80,
IsDemon: false,
IsLarge: false,
IsSmall: false,
IsFlying: false,
CanOpenDoors: false,
SpawningColumn: 0,
IsBoss: false,
IsInteractable: false,
IsKillable: true,
CanBeConverted: true,
HitClass: 3,
HasSpecialEndDeath: false,
DeadCollision: false,
CanBeRevivedByOtherMonsters: true,
AppearanceConfig: new EnemyTypeAppearanceConfig(
HasDeathAnimation: true,
HasNeutralAnimation: true,
HasWalkAnimation: true,
HasGetHitAnimation: true,
HasAttack1Animation: true,
HasAttack2Animation: false,
HasBlockAnimation: true,
HasCastAnimation: false,
HasSkillAnimation: new bool[] { false, false, false, false },
HasCorpseAnimation: false,
HasKnockbackAnimation: true,
HasRunAnimation: true,
HasLifeBar: true,
HasNameBar: false,
CannotBeSelected: false,
CanCorpseBeSelected: false,
BleedType: 0,
HasShadow: true,
LightRadius: 0,
HasUniqueBossColors: false,
CompositeDeath: true,
LightRGB: new byte[] { 255, 255, 255 }
),
CombatConfig: new EnemyTypeCombatConfig(
ElementalAttackMode: 4,
ElementalAttackType: eDamageTypes.PHYSICAL,
ElementalOverlayId: 0,
ElementalChance: 0,
ElementalMinDamage: 0,
ElementalMaxDamage: 0,
ElementalDuration: 0,
MissileForAttack: new int[] { 0, 0 },
MissileForSkill: new int[] { 0, 0, 0, 0, },
MissileForCase: 0,
MissileForSequence: 0,
CanMoveAttack: new bool[] { false, false },
CanMoveSkill: new bool[] { false, false, false, false },
CanMoveCast: false,
IsMelee: true,
IsAttackable: true,
MeleeRange: 0,
SkillType: new int[] { 0, 0, 0, 0 },
SkillSequence: new int[] { 0, 0, 0, 0 },
SkillLevel: new int[] { 0, 0, 0, 0 },
IsUndeadWithPhysicalAttacks: true,
IsUndeadWithMagicAttacks: false,
UsesMagicAttacks: false,
ChanceToBlock: 20,
DoesDeathDamage: false,
IgnoredBySummons: false
),
NormalDifficultyConfig: new EnemyTypeDifficultyConfig(
Level: 5,
DamageResist: 0,
MagicResist: 0,
FireResist: 0.5,
LightResist: 0,
ColdResist: 0,
PoisonResist: 0,
MinHP: 10,
MaxHP: 15,
AC: 3,
Exp: 100,
AttackMinDamage: new int[] { 5, 0 },
AttackMaxDamage: new int[] { 10, 0 },
AttackChanceToHit: new int[] { 35, 0 },
Skill1MinDamage: 0,
Skill1MaxDamage: 0,
Skill1ChanceToHit: 0,
TreasureClass: new string[] { "Swarm 1", "Act 2 Champ A", "Act 2 Unique A", "" }
),
NightmareDifficultyConfig: new EnemyTypeDifficultyConfig(
Level: 10,
DamageResist: 0,
MagicResist: 0,
FireResist: 0.5,
LightResist: 0.5,
ColdResist: 0,
PoisonResist: 0,
MinHP: 20,
MaxHP: 25,
AC: 3,
Exp: 1000,
AttackMinDamage: new int[] { 5, 0 },
AttackMaxDamage: new int[] { 10, 0 },
AttackChanceToHit: new int[] { 35, 0 },
Skill1MinDamage: 0,
Skill1MaxDamage: 0,
Skill1ChanceToHit: 0,
TreasureClass: new string[] { "Swarm 1", "Act 3 Champ A", "Act 3 Unique A", "" }
),
HellDifficultyConfig: new EnemyTypeDifficultyConfig(
Level: 15,
DamageResist: 0,
MagicResist: 0,
FireResist: 0.5,
LightResist: 0.5,
ColdResist: 0.5,
PoisonResist: 0,
MinHP: 30,
MaxHP: 45,
AC: 3,
Exp: 10000,
AttackMinDamage: new int[] { 5, 0 },
AttackMaxDamage: new int[] { 10, 0 },
AttackChanceToHit: new int[] { 35, 0 },
Skill1MinDamage: 0,
Skill1MaxDamage: 0,
Skill1ChanceToHit: 0,
TreasureClass: new string[] { "Swarm 2", "Act 4 Champ A", "Act 4 Unique A", "" }
)
);
EnemyState en = new EnemyState("Fallen", id, 0, 0, config, difficulty, rand);
return en;
}
[TestMethod]
public void EnemyDifficultyTest()
{
Random rand = new Random();
EnemyState en = MakeEnemyState(1, eDifficulty.NORMAL, rand);
Assert.AreEqual(5, en.Level);
Assert.AreEqual(100, en.ExperienceGiven);
EnemyState en2 = MakeEnemyState(2, eDifficulty.NIGHTMARE, rand);
Assert.AreEqual(10, en2.Level);
Assert.AreEqual(1000, en2.ExperienceGiven);
EnemyState en3 = MakeEnemyState(3, eDifficulty.HELL, rand);
Assert.AreEqual(15, en3.Level);
Assert.AreEqual(10000, en3.ExperienceGiven);
}
}
}

View File

@ -1,56 +0,0 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenDiablo2.Common.Enums.Mobs;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.UT
{
[TestClass]
public class UT_MobState
{
[TestMethod]
public void MobDeathTest()
{
MobState mob = new MobState("test1", 1, 1, 100, 0, 0);
mob.TakeDamage(1000, Enums.Mobs.eDamageTypes.NONE);
Assert.AreEqual(false, mob.Alive);
}
[TestMethod]
public void MobFlagsTest()
{
MobState mob = new MobState("test1", 1, 1, 100, 0, 0);
mob.AddFlag(Enums.Mobs.eMobFlags.ENEMY);
Assert.AreEqual(true, mob.HasFlag(Enums.Mobs.eMobFlags.ENEMY));
Assert.AreEqual(false, mob.HasFlag(Enums.Mobs.eMobFlags.INVULNERABLE));
mob.RemoveFlag(Enums.Mobs.eMobFlags.ENEMY);
Assert.AreEqual(false, mob.HasFlag(Enums.Mobs.eMobFlags.ENEMY));
}
[TestMethod]
public void MobResistancesTest()
{
MobState mob = new MobState("test1", 1, 1, 100, 0, 0);
mob.SetResistance(eDamageTypes.COLD, 0.5);
int dam = mob.TakeDamage(100, eDamageTypes.COLD); // now try 100 cold damage
Assert.AreEqual(50, dam); // b/c mob has 50% resistance, should only take 50 damage
Assert.IsTrue(mob.Alive); // mob should not have taken enough damage to die
int dam2 = mob.TakeDamage(100, eDamageTypes.FIRE); // now try 100 fire damage
Assert.AreEqual(100, dam2); // b/c mob has no fire resistance, should take full damage
Assert.IsFalse(mob.Alive); // mob should be dead
}
[TestMethod]
public void MobImmunityTest()
{
MobState mob = new MobState("test1", 1, 1, 100, 0, 0);
mob.AddImmunitiy(eDamageTypes.COLD);
int dam = mob.TakeDamage(100, eDamageTypes.COLD); // now try 100 cold damage
Assert.AreEqual(0, dam); // b/c mob has immunity, should not take damage
Assert.IsTrue(mob.Alive); // mob should not have taken enough damage to die
int dam2 = mob.TakeDamage(100, eDamageTypes.FIRE); // now try 100 fire damage
Assert.AreEqual(100, dam2); // b/c mob has no fire immunity, should take full damage
Assert.IsFalse(mob.Alive); // mob should be dead
}
}
}

View File

@ -1,79 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenDiablo2.Common.Models.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.UT
{
[TestClass]
public class UT_PlayerState
{
private PlayerState MakePlayer()
{
HeroTypeConfig herotypeconfig = new HeroTypeConfig(vitality: 20, strength: 20, dexterity: 20,
energy: 20, health: 50, mana: 40, stamina: 30, manaRegen: 20,
perlevelhealth: 3, perlevelmana: 1.5, perlevelstamina: 1,
pervitalityhealth: 2, pervitalitystamina: 1, perenergymana: 1.5,
perLevelStatPoints: 5,
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: "",
startingSkills: new string[] { },
allSkillsBonusString: "", firstTabBonusString: "", secondTabBonusString: "",
thirdTabBonusString: "", classOnlyBonusString: "", baseWeaponClass: "hth",
initialEquipment: new List<InitialEquipment>());
LevelExperienceConfig expconfig = new LevelExperienceConfig(new List<long>()
{
0, // level 0
0, // level 1
500, // level 2
1500, // level 3
2250,
4125,
});
PlayerState ps = new PlayerState(0, "player1", id: 1, level: 1, x: 0, y: 0,
vitality: herotypeconfig.StartingVitality,
strength: herotypeconfig.StartingStrength,
energy: herotypeconfig.StartingEnergy,
dexterity: herotypeconfig.StartingDexterity,
experience: 0,
herotype: Enums.eHero.Amazon,
heroconfig: herotypeconfig,
expconfig: expconfig);
return ps;
}
[TestMethod]
public void PlayerLevelUpTest()
{
PlayerState ps = MakePlayer();
int level1hp = ps.GetHealthMax();
int level1mana = ps.GetManaMax();
int level1stamina = ps.GetStaminaMax();
Assert.IsFalse(ps.AddExperience(499)); // not quite enough
Assert.IsTrue(ps.AddExperience(1)); // there we go
int level2hp = ps.GetHealthMax();
int level2mana = ps.GetManaMax();
int level2stamina = ps.GetStaminaMax();
Assert.IsFalse(ps.AddExperience(999)); // not quite enough
Assert.IsTrue(ps.AddExperience(1)); // there we go
int level3hp = ps.GetHealthMax();
int level3mana = ps.GetManaMax();
int level3stamina = ps.GetStaminaMax();
// this should update the player's health, mana, and stamina
Assert.AreEqual(level1hp + 3, level2hp);
Assert.AreEqual(level1mana + 1, level2mana);
Assert.AreEqual(level1stamina + 1, level2stamina);
Assert.AreEqual(level2hp + 3, level3hp);
Assert.AreEqual(level2mana + 2, level3mana); // because 2->3 is an odd levelup, should get 2
// more mana on this level (1.5 = +1 on even levels, +2 on odd)
Assert.AreEqual(level2stamina + 1, level3stamina);
}
}
}

View File

@ -1,80 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenDiablo2.Common.Models.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.UT
{
[TestClass]
public class UT_Stat
{
[TestMethod]
public void BasicStatTest()
{
Stat hp = new Stat(0, 100, 100, false);
Assert.AreEqual(100, hp.GetCurrent());
Assert.AreEqual(100, hp.GetMax());
Assert.AreEqual(0, hp.GetMin());
hp.AddCurrent(10);
Assert.AreEqual(100, hp.GetCurrent()); // not allowed to go over max
hp.AddCurrent(-30);
Assert.AreEqual(70, hp.GetCurrent());
hp.SetCurrent(10);
Assert.AreEqual(10, hp.GetCurrent());
hp.AddCurrent(-30);
Assert.AreEqual(0, hp.GetCurrent()); // not allowed to go under min
}
[TestMethod]
public void ModifierStatTest()
{
Stat hp = new Stat(0, 100, 100, false);
StatModifierAddition mod1 = new StatModifierAddition("mod1", 10);
hp.AddModifier(mod1);
Assert.AreEqual(100, hp.GetCurrent()); // not allowed to overflow from mods
hp.AllowedToOverflowFromModifiers = true;
Assert.AreEqual(110, hp.GetCurrent()); // if we flip overflow to true, should overflow from mods
StatModifierAddition mod2 = new StatModifierAddition("mod2", -20);
hp.AddModifier(mod2);
Assert.AreEqual(90, hp.GetCurrent());
hp.RemoveModifier("mod1");
Assert.AreEqual(80, hp.GetCurrent()); // if we remove mod1, we should see its effect go away
hp.RemoveModifier("mod2");
Assert.AreEqual(100, hp.GetCurrent()); // similarly with mod2
}
[TestMethod]
public void ModifierPriorityTest()
{
Stat hp = new Stat(0, 100, 50, true);
StatModifierMultiplication mod1 = new StatModifierMultiplication("mod1", 0.5, priority: 1);
hp.AddModifier(mod1);
Assert.AreEqual(75, hp.GetCurrent());
StatModifierMultiplication mod2 = new StatModifierMultiplication("mod2", 0.5, priority: 1);
hp.AddModifier(mod2);
Assert.AreEqual(100, hp.GetCurrent()); // because these have the same priority,
// they don't see eachother's effects (e.g. we get 50 + 50*0.5 + 50*0.5, NOT 50 + 50*0.5 + 75*0.5
hp.RemoveModifier("mod2");
Assert.AreEqual(75, hp.GetCurrent());
StatModifierMultiplication mod3 = new StatModifierMultiplication("mod3", -0.2, priority: 0);
hp.AddModifier(mod3);
Assert.AreEqual(60, hp.GetCurrent()); // because this one has a lower priority, it happens AFTER mod1
// so we get 50 + 50*0.5 = 75, then 75 + 75*-0.2 = 60
}
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.4.0" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.4.0" targetFramework="net461" />
</packages>

View File

@ -1,42 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Attributes
{
/// <summary>
/// Defines the class as a Message Frame. This is used by the client/server logic
/// to decide how to serialize and deserialize networking objects.
/// </summary>
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
public sealed class MessageFrameAttribute : Attribute
{
/// <summary>
/// The type of message frame this class represents.
/// </summary>
public eMessageFrameType FrameType { get; private set; }
/// <summary>
/// Define this class as a message frame.
/// </summary>
/// <param name="frameType">The type of message frame this class represents.</param>
public MessageFrameAttribute(eMessageFrameType frameType) => this.FrameType = frameType;
}
}

View File

@ -1,19 +0,0 @@
using System;
namespace OpenDiablo2.Common.Attributes
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class RandomizedMapAttribute : Attribute
{
readonly string mapName;
public string MapName => mapName;
public RandomizedMapAttribute(string mapName)
{
this.mapName = mapName;
}
}
}

View File

@ -1,39 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Attributes
{
/// <summary>
/// Defines this class as a scene.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class SceneAttribute : Attribute
{
/// <summary>
/// Defines the type of scene that this class represents.
/// </summary>
public eSceneType SceneType { get; }
/// <summary>
/// Defines this class as a scene type
/// </summary>
/// <param name="sceneType"></param>
public SceneAttribute(eSceneType sceneType) => SceneType = sceneType;
}
}

View File

@ -1,40 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Enums;
using System;
using System.Collections.Generic;
namespace OpenDiablo2.Common.Attributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public class SkillInfoAttribute : Attribute
{
int a = 5;
public SkillInfoAttribute(eHero hero, int spriteIndex = 0, int level/*levelGroup*/ = 0, params eSkill[] skillsRequired)
{
Hero = hero;
SpriteIndex = spriteIndex;
Level = level;
SkillsRequired = skillsRequired ?? Array.Empty<eSkill>();
}
public eHero Hero { get; }
public int SpriteIndex { get; }
public int Level { get; }
public IReadOnlyList<eSkill> SkillsRequired { get; }
}
}

View File

@ -1,7 +0,0 @@
/*
* Hi there.
* Looking to register an object from Common into DI, are ya?
* Well don't. Go to the Discord channel and talk about it there.
* If you add an autofac module to this project, your PR will be
* rejected.
*/

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eDamageTypes
{
NONE = -1, // no resistances apply
PHYSICAL = 0,
MAGIC = 3, //1=fire, 2=lightning, 4=cold, 5=poison
FIRE = 1,
COLD = 4,
LIGHTNING = 2,
POISON = 5,
LIFE_STEAL = 6,
MANA_STEAL = 7,
STAMINA_STEAL = 8,
STUN = 9,
RANDOM = 10, // random between fire/cold/lightning/poison
BURN = 11,
FREEZE = 12,
}
}

View File

@ -1,33 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eMobFlags
{
PLAYER,
ENEMY,
INVULNERABLE,
BOSS,
NPC,
CRITTER,
LARGE,
SMALL,
INTERACTABLE,
DEMON,
IGNORED_BY_SUMMONS,
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eStatModifierType
{
// does it affect the current value, min value, or max value?
MIN,
MAX,
CURRENT
}
}

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eAnimationFrame
{
NoEvent,
Attack,
Missile,
Sound,
Skill
}
}

View File

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eArmorType
{
Lite,
Medium,
Heavy
}
public static class eArmorTypeHelper
{
private static readonly Dictionary<eArmorType, string> tokens = new Dictionary<eArmorType, string>()
{
{ eArmorType.Lite , "lit" },
{ eArmorType.Medium , "med" },
{ eArmorType.Heavy , "hvy" }
};
public static string ToToken(this eArmorType armorType) => tokens[armorType];
public static eArmorType ToArmorType(this string source) => tokens.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}

View File

@ -1,26 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum eButtonType
{
Wide,
Medium,
Narrow,
Cancel,
Tall,
Short,
// Game UI
Skill,
Run,
Menu,
GoldCoin,
Close,
SecondaryInvHand,
MinipanelCharacter,
MinipanelInventory,
MinipanelSkill,
MinipanelAutomap,
MinipanelMessage,
MinipanelQuest,
MinipanelMenu
}
}

View File

@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eCompositType
{
Head,
Torso,
Legs,
RightArm,
LeftArm,
RightHand,
LeftHand,
Shield,
Special1,
Special2,
Special3,
Special4,
Special5,
Special6,
Special7,
Special8
}
public static class eCompositeTypeHelper
{
private readonly static Dictionary<eCompositType, string> tokens = new Dictionary<eCompositType, string>
{
{ eCompositType.Head , "HD" },
{ eCompositType.Torso , "TR" },
{ eCompositType.Legs , "LG" },
{ eCompositType.RightArm , "RA" },
{ eCompositType.LeftArm , "LA" },
{ eCompositType.RightHand , "RH" },
{ eCompositType.LeftHand , "LH" },
{ eCompositType.Shield , "SH" },
{ eCompositType.Special1 , "S1" },
{ eCompositType.Special2 , "S2" },
{ eCompositType.Special3 , "S3" },
{ eCompositType.Special4 , "S4" },
{ eCompositType.Special5 , "S5" },
{ eCompositType.Special6 , "S6" },
{ eCompositType.Special7 , "S7" },
{ eCompositType.Special8 , "S8" }
};
public static string ToToken(this eCompositType source) => tokens[source];
public static eCompositType ToCompositeType(this string source) => tokens.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eDamageTypes
{
NONE, // no resistances apply
PHYSICAL,
MAGIC,
FIRE,
COLD,
LIGHTNING,
POISON,
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eDifficulty
{
NORMAL,
NIGHTMARE,
HELL,
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eDrawEffect
{
//75 % transparency (colormaps 561-816 in a .pl2)
PctTransparency75,
//50 % transparency (colormaps 305-560 in a .pl2)
PctTransparency50,
//25 % transparency (colormaps 49-304 in a .pl2)
PctTransparency25,
//Screen (colormaps 817-1072 in a .pl2)
Screen,
//luminance (colormaps 1073-1328 in a .pl2)
Luminance,
//bright alpha blending (colormaps 1457-1712 in a .pl2)
BringAlphaBlending
}
}

View File

@ -1,60 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
using System.Linq;
namespace OpenDiablo2.Common.Enums
{
public enum eHero
{
None,
Barbarian,
Necromancer,
Paladin,
Assassin,
Sorceress,
Amazon,
Druid
}
public static class eHeroExtensions
{
public readonly static eHero[] all = {
eHero.Barbarian,
eHero.Necromancer,
eHero.Paladin,
eHero.Assassin,
eHero.Sorceress,
eHero.Amazon,
eHero.Druid,
};
public readonly static Dictionary<eHero, string> tokens = new Dictionary<eHero, string>
{
{ eHero.Barbarian , "BA" },
{ eHero.Necromancer , "NE" },
{ eHero.Paladin , "PA" },
{ eHero.Assassin , "AI" },
{ eHero.Sorceress , "SO" },
{ eHero.Amazon , "AM" },
{ eHero.Druid , "DZ" },
};
public static string ToToken(this eHero source) => tokens[source];
public static eHero ToHero(this string source) => tokens.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}

View File

@ -1,17 +0,0 @@
using System.Collections.Generic;
namespace OpenDiablo2.Common.Enums
{
public enum eItemContainerType
{
Helm,
Glove,
Armor,
Belt,
Boots,
Weapon,
Amulet,
Ring,
Generic
}
}

View File

@ -1,67 +0,0 @@
using OpenDiablo2.Common.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eLevelId
{
None,
Act1_Town1 = 1,
Act1_CaveTreasure2 = 13,
Act1_CaveTreasure3 = 14,
Act1_CaveTreasure4 = 15,
Act1_CaveTreasure5 = 16,
Act1_CryptCountessX = 25,
Act1_Tower2 = 20,
Act1_MonFront = 26,
Act1_Courtyard1 = 27,
Act1_Courtyard2 = 32,
Act1_Cathedral = 33,
Act1_Andariel = 37,
Act1_Tristram = 38,
Act2_Town = 40,
Act2_Harem = 50,
Act2_DurielsLair = 73,
Act3_Town = 75,
Act3_DungeonTreasure1 = 90,
Act3_DungeonTreasure2 = 91,
Act3_SewerTreasureX = 93,
Act3_Temple1 = 94,
Act3_Temple2 = 95,
Act3_Temple3 = 96,
Act3_Temple4 = 97,
Act3_Temple5 = 98,
Act3_Temple6 = 99,
Act3_MephistoComplex = 102,
Act4_Fortress = 103,
Act5_Town = 109,
Act5_TempleFinalRoom = 124,
Act5_ThroneRoom = 131,
Act5_WorldStone = 132,
Act5_TempleEntrance = 121,
Act5_BaalEntrance = 120,
}
public static class ELevelIdHelper
{
public static string GenerateEnum(List<LevelPreset> levelPresets)
{
var output = new StringBuilder();
foreach (LevelPreset lp in levelPresets)
{
// need to convert e.g. 'Act 1 - Town 1' to 'Act1_Town'
if (lp.LevelId == 0)
{
continue;
}
string name = lp.Name.Replace(" - ", "_").Replace(" ", "").Replace("'", "");
output.AppendLine($"{name}={lp.LevelId}");
}
return output.ToString();
}
}
}

View File

@ -1,17 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum eLevelSubType
{
Act1BorderCliff = 0,
Act1BorderMiddle = 1,
Act1BorderCorner = 2,
Act1BorderBorder = 3,
Act1Waypoint = 4,
Act1Shrine = 5,
Act1Wilderness = 6,
Act2Waypoint = 7,
Act2Shrine = 8,
Act2Desert = 9,
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eMPQFormatVersion
{
Format1,
Format2,
Format3,
Format4
}
}

View File

@ -1,21 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
// TODO: I don't think this needs to live in core...
public enum eMessageFrameType
{
None = 0x00,
SetSeed = 0x01,
JoinGame = 0x02,
LocatePlayers = 0x03,
PlayerInfo = 0x04,
FocusOnPlayer = 0x05,
MoveRequest = 0x06,
PlayerMove = 0x07,
UpdateEquipment = 0x08,
ChangeEquipment = 0x09,
MAX = 0xFF, // NOTE:
// You absolutely cannot have a higher ID than this without
// changing the message header to multi-byte for ALL frame types!!!
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eMobFlags
{
PLAYER,
ENEMY,
INVULNERABLE
}
}

View File

@ -1,117 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eMobMode
{
PlayerDeath,
PlayerNeutral,
PlayerWalk,
PlayerRun,
PlayerGetHit,
PlayerTownNeutral,
PlayerTownWalk,
PlayerAttack1,
PlayerAttack2,
PlayerBlock,
PlayerCast,
PlayerThrow,
PlayerKick,
PlayerSkill1,
PlayerSkill2,
PlayerSkill3,
PlayerSkill4,
PlayerDead,
PlayerSequence,
PlayerKnockBack,
MonsterDeath,
MonsterNeutral,
MonsterWalk,
MonsterGetHit,
MonsterAttack1,
MonsterAttack2,
MonsterBlock,
MonsterCast,
MonsterSkill1,
MonsterSkill2,
MonsterSkill3,
MonsterSkill4,
MonsterDead,
MonsterKnockback,
MonsterSequence,
MonsterRun,
ObjectNeutral,
ObjectOperating,
ObjectOpened,
ObjectSpecial1,
ObjectSpecial2,
ObjectSpecial3,
ObjectSpecial4,
ObjectSpecial5
}
public static class eMobModeExtensions
{
private static readonly Dictionary<eMobMode, string> mobModes = new Dictionary<eMobMode, string>
{
{ eMobMode.PlayerDeath ,"DT" },
{ eMobMode.PlayerNeutral ,"NU" },
{ eMobMode.PlayerWalk ,"WL" },
{ eMobMode.PlayerRun ,"RN" },
{ eMobMode.PlayerGetHit ,"GH" },
{ eMobMode.PlayerTownNeutral ,"TN" },
{ eMobMode.PlayerTownWalk ,"TW" },
{ eMobMode.PlayerAttack1 ,"A1" },
{ eMobMode.PlayerAttack2 ,"A2" },
{ eMobMode.PlayerBlock ,"BL" },
{ eMobMode.PlayerCast ,"SC" },
{ eMobMode.PlayerThrow ,"TH" },
{ eMobMode.PlayerKick ,"KK" },
{ eMobMode.PlayerSkill1 ,"S1" },
{ eMobMode.PlayerSkill2 ,"S2" },
{ eMobMode.PlayerSkill3 ,"S3" },
{ eMobMode.PlayerSkill4 ,"S4" },
{ eMobMode.PlayerDead ,"DD" },
{ eMobMode.PlayerSequence ,"GH" },
{ eMobMode.PlayerKnockBack ,"GH" },
{ eMobMode.MonsterDeath , "DT" },
{ eMobMode.MonsterNeutral , "NU" },
{ eMobMode.MonsterWalk , "WL" },
{ eMobMode.MonsterGetHit , "GH" },
{ eMobMode.MonsterAttack1 , "A1" },
{ eMobMode.MonsterAttack2 , "A2" },
{ eMobMode.MonsterBlock , "BL" },
{ eMobMode.MonsterCast , "SC" },
{ eMobMode.MonsterSkill1 , "S1" },
{ eMobMode.MonsterSkill2 , "S2" },
{ eMobMode.MonsterSkill3 , "S3" },
{ eMobMode.MonsterSkill4 , "S4" },
{ eMobMode.MonsterDead , "DD" },
{ eMobMode.MonsterKnockback , "GH" },
{ eMobMode.MonsterSequence , "xx" },
{ eMobMode.MonsterRun , "RN" },
{ eMobMode.ObjectNeutral , "NU" },
{ eMobMode.ObjectOperating , "OP" },
{ eMobMode.ObjectOpened , "ON" },
{ eMobMode.ObjectSpecial1 , "S1" },
{ eMobMode.ObjectSpecial2 , "S2" },
{ eMobMode.ObjectSpecial3 , "S3" },
{ eMobMode.ObjectSpecial4 , "S4" },
{ eMobMode.ObjectSpecial5 , "S5" }
};
public static string ToToken(this eMobMode src) => mobModes[src];
public static eMobMode FromToken(this string token) => mobModes.First(x => x.Value.ToUpper() == token.ToUpper()).Key;
}
}

View File

@ -1,9 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum eMovementType
{
Stopped,
Walking,
Running
}
}

View File

@ -1,9 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum ePanelFrameType
{
Left,
Right,
Center
}
}

View File

@ -1,14 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum ePanelType
{
None,
Character,
Inventory,
Skill,
Automap,
Message,
Quest,
Menu
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eRenderCellType
{
Floor,
WallNormal,
WallLower,
Shadow,
Roof,
MAX
}
}

View File

@ -1,30 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace OpenDiablo2.Common.Enums
{
/// <summary>
/// Defines a scene type.
/// </summary>
public enum eSceneType
{
MainMenu,
Credits,
SelectHeroClass,
SelectCharacter,
Game
}
}

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
/// <summary>Defines the type of gameplay session we are running.</summary>
public enum eSessionType
{
/// <summary>This session is an offline single player game.</summary>
Local,
/// <summary>This session is a multiplayer game, and this instance is the server.</summary>
Server,
/// <summary>This session is a multiplayer game, and this instance is a client connected to an external server.</summary>
Remote
}
}

View File

@ -1,339 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Attributes;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace OpenDiablo2.Common.Enums
{
public static class SkillsHelper
{
public static SkillInfoAttribute GetSkillInfo(this eSkill skill)
{
var attr = skill.GetType().GetCustomAttributes(typeof(SkillInfoAttribute), false).FirstOrDefault() as SkillInfoAttribute;
Debug.Assert(attr != null, $"Skill {skill} does not contain SkillInfo attribute.");
return attr;
}
public static IEnumerable<eSkill> GetHeroSkills(eHero hero)
{
foreach(var skill in (eSkill[])Enum.GetValues(typeof(eSkill)))
{
if(skill.GetSkillInfo()?.Hero == hero)
yield return skill;
}
}
}
//public int[] eSkillLevelTier
//{
// 1,
// 6,
// 12,
// 18,
// 24,
// 30
//};
public enum eSkill
{
/// Generic Skills
[SkillInfo(eHero.None, 1)]
Attack = 0,
[SkillInfo(eHero.None, 3)]
Throw = 2,
[SkillInfo(eHero.None, 2)]
Unsummon = 3,
/// Amazon
// Javelin and Spear Skills
[SkillInfo(eHero.Amazon, 4, 1)]
Jab = 10,
[SkillInfo(eHero.Amazon, 8, 6, Jab)]
PowerStrike = 14,
[SkillInfo(eHero.Amazon, 9, 6)]
PoisonJavelin = 15,
[SkillInfo(eHero.Amazon, 13, 12, Jab)]
Impale = 19,
[SkillInfo(eHero.Amazon, 14, 12, PoisonJavelin)]
LightningBolt = 20,
[SkillInfo(eHero.Amazon, 18, 18, LightningBolt, PowerStrike)]
ChargedStrike = 24,
[SkillInfo(eHero.Amazon, 19, 18, LightningBolt)]
PlagueJavelin = 25,
[SkillInfo(eHero.Amazon, 24, 24, Impale)]
Fend = 30,
[SkillInfo(eHero.Amazon, 28, 30, ChargedStrike)]
LightningStrike = 34,
[SkillInfo(eHero.Amazon, 29, 30, PlagueJavelin)]
LightningFury = 35,
// Passive and Magic Skills
[SkillInfo(eHero.Amazon, 2, 1)]
InnerSight = 8,
[SkillInfo(eHero.Amazon, 3, 1)]
CriticalStrike = 9,
[SkillInfo(eHero.Amazon, 7, 6)]
Dodge = 13,
[SkillInfo(eHero.Amazon, 11, 12, InnerSight)]
SlowMissles = 17,
[SkillInfo(eHero.Amazon, 12, 12, Dodge)]
Avoid = 18,
[SkillInfo(eHero.Amazon, 17, 18, CriticalStrike)]
Penetrate = 23,
[SkillInfo(eHero.Amazon, 22, 24, SlowMissles)]
Decoy = 28, // called Dopplezon
[SkillInfo(eHero.Amazon, 23, 24, Avoid)]
Evade = 29,
[SkillInfo(eHero.Amazon, 26, 30, Decoy, Evade)]
Valkyrie = 32,
[SkillInfo(eHero.Amazon, 27, 30, Penetrate)]
Pierce = 33,
// Bow and Crossbow Skills
[SkillInfo(eHero.Amazon, 0, 1)]
MagicArrow = 6,
[SkillInfo(eHero.Amazon, 1, 1)]
FireArrow = 7,
[SkillInfo(eHero.Amazon, 5, 6)]
ColdArrow = 11,
[SkillInfo(eHero.Amazon, 6, 6, MagicArrow)]
MultipleShot = 12,
[SkillInfo(eHero.Amazon, 10, 12, FireArrow)]
ExplodingArrow = 16,
[SkillInfo(eHero.Amazon, 15, 18, ColdArrow)]
IceArrow = 21,
[SkillInfo(eHero.Amazon, 16, 18, MultipleShot)]
GuidedArrow = 22,
[SkillInfo(eHero.Amazon, 20, 24, GuidedArrow)]
Strafe = 26,
[SkillInfo(eHero.Amazon, 21, 24, ExplodingArrow)]
ImmolationArrow = 27,
[SkillInfo(eHero.Amazon, 25, 30, IceArrow)]
FreezingArrow = 31,
/// Assassin
// Martial Arts
TigerStrike,
DragonTalon,
FistsOfFire,
DragonClaw,
CobraStrike,
ClawsOfThunder,
DragonTail,
BladesOfIce,
DragonFlight,
PhoenixStrike,
// Shadow Disciplines
ClawMastery,
PsychicHammer,
BurstOfSpeed,
WeaponBlock,
CloakOfShadows,
Fade,
ShadowWarrior,
MindBlast,
Venom,
ShadowMaster,
// Traps
FireBlast,
ShockWeb,
BladeSentinel,
ChargedBoltSentry,
WakeOfFire,
BladeFury,
LightningSentry,
WakeOfInferno,
DeathSentry,
BladeShield,
/// Necromancer
// Summoning Spells
SkeletonMastery,
RaiseSkeleton,
ClayGolem,
GolemMastery,
RaiseSkeletalMage,
BloodGolem,
SummonResist,
IronGolem,
FireGolem,
Revive,
// Poison and Bone Spells
Teeth,
BoneArmor,
PoisonDagger,
CorpseExplosion,
BoneWall,
PoisonExplosion,
BoneSpear,
BonePrision,
PoisonNova,
BoneSpirit,
// Curses
AmplifyDamage,
DimVision,
Weaken,
IronMaiden,
Terror,
Confuse,
LifeTap,
Attract,
Decrepify,
LowerResist,
/// Barbarian
// Warcries
Howl,
FindPotion,
Taunt,
Shout,
FindItem,
BattleCry,
BattleOrders,
GrimWard,
WarCry,
BattleCommand,
// Combat Masteries
SwordMastery,
AxeMastery,
MaceMastery,
PoleArmMastery,
ThrowingMastery,
SpearMastery,
IncreasedStamina,
IronSkin,
IncreasedSpeed,
NaturalResistance,
// Combat Skills
Bash,
Leap,
DoubleSwing,
Stun,
DoubleThrow,
LeapAttack,
Concentrate,
Frenzy,
Whirlwind,
Berserk,
/// Paladin
// Defensive Auras
Prayer,
ResistFire,
Defiance,
ResistCold,
Cleansing,
ResistLightning,
Vigor,
Meditation,
Redemption,
Salvation,
// Offensive Auras
Might,
HolyFire,
Thorns,
BlessedAim,
Concentration,
HolyFreeze,
HolyShock,
Sanctuary,
Fanaticism,
Conviction,
// Combat Skills
Sacrafice,
Smite,
HolyBolt,
Zeal,
Charge,
Vengeance,
BlessedHammer,
Conversion,
HolyShield,
FistOfTheHeavens,
/// Sorceress
// Cold Spells
IceBolt,
FrozenArmor,
FrostNova,
IceBlast,
ShiverArmor,
GlacialSpike,
Blizzard,
ChillingArmor,
FrozenOrb,
ColdMastery,
// Lightning Spells
ChargedBolt,
StaticField,
Telekinesis,
Nova,
Lightning,
ChainLightning,
Teleport,
ThunderStorm,
EnergyShield,
LightningMastery,
// Fire Spells
FireBolt,
Warmth,
Inferno,
Blaze,
FireBall,
FireWall,
Enchant,
Meteor,
FireMastery,
Hydra,
/// Druid
// Elemental
Firestorm,
MoltenBoulder,
ArcticBlast,
Fissure,
CycloneArmor,
Twister,
Volcano,
Tornado,
Armageddon,
Hurricane,
// Shape Shifting
Werewolf,
Lycanthropy,
Werebear,
FeralRage,
Maul,
Rabies,
FireClaw,
Hunger,
ShockWave,
Fury,
// Summoning
Raven,
PoisonCreeper,
OakSage,
SummonSpiritWolf,
CarrionVine,
heartOfWolverine,
SummonDireWolf,
SolarCreeper,
SpiritOfBarbs,
SummonGrizzly
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums.Mobs
{
public enum eStatModifierType
{
// does it affect the current value, min value, or max value?
MIN,
MAX,
CURRENT
}
}

View File

@ -1,9 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum eTextAlign
{
Centered = 0,
Left,
Right
}
}

View File

@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eWeaponClass
{
None,
HandToHand,
Bow,
OneHandSwing,
OneHandThrust,
Staff,
TwoHandSwing,
TwoHandThrust,
Crossbow,
LeftJabRightSwing,
LeftJabRightThrust,
LeftSwingRightSwing,
LeftSwingRightThrust,
OneHandToHand,
TwoHandToHand
}
public static class eWeaponClassExtensions
{
private static readonly Dictionary<eWeaponClass, string> codes = new Dictionary<eWeaponClass, string>
{
{eWeaponClass.None , "" },
{eWeaponClass.HandToHand , "hth" },
{eWeaponClass.Bow , "bow" },
{eWeaponClass.OneHandSwing , "1hs" },
{eWeaponClass.OneHandThrust , "1ht" },
{eWeaponClass.Staff , "stf" },
{eWeaponClass.TwoHandSwing , "2hs" },
{eWeaponClass.TwoHandThrust , "2ht" },
{eWeaponClass.Crossbow , "xbw" },
{eWeaponClass.LeftJabRightSwing , "1js" },
{eWeaponClass.LeftJabRightThrust , "1jt" },
{eWeaponClass.LeftSwingRightSwing , "1ss" },
{eWeaponClass.LeftSwingRightThrust , "1st" },
{eWeaponClass.OneHandToHand , "ht1" },
{eWeaponClass.TwoHandToHand , "ht2" }
};
public static string ToToken(this eWeaponClass source) => codes[source];
public static eWeaponClass ToWeaponClass(this string source) => codes.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}

View File

@ -1,20 +0,0 @@
namespace OpenDiablo2.Common.Enums
{
public enum eWildBorder
{
South = 4,
West = 5,
North = 6,
East = 7,
SouthWest = 8,
NorthWest = 9,
NorthEast = 10,
SouthEast = 11,
ClosedBoxTopRight = 12,
ClosedBoxBottomRight = 13,
ClosedBoxBottomLeft = 14,
ClosedBoxTopLeft = 15,
RiverUpper = 26,
RiverLower = 27
}
}

View File

@ -1,32 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
namespace OpenDiablo2.Common.Exceptions
{
[Serializable]
public class OpenDiablo2Exception : Exception
{
public OpenDiablo2Exception() { }
public OpenDiablo2Exception(string message) : base(message) { }
public OpenDiablo2Exception(string message, Exception inner) : base(message, inner) { }
protected OpenDiablo2Exception(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
}

View File

@ -1,65 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Enums;
using System.Drawing;
namespace OpenDiablo2.Common.Extensions
{
public static class EnumExtensions
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Point GetOffset(this ePanelFrameType value)
{
switch (value)
{
case ePanelFrameType.Left:
return new Point(80, 63);
case ePanelFrameType.Right:
return new Point(400, 63);
case ePanelFrameType.Center:
return new Point(0, 0);
}
log.Warn($"Unknown panel positon, {value}");
return default(Point);
}
public static ePanelType GetPanelType(this eButtonType value)
{
switch(value)
{
case eButtonType.MinipanelAutomap:
return ePanelType.Automap;
case eButtonType.MinipanelCharacter:
return ePanelType.Character;
case eButtonType.MinipanelInventory:
return ePanelType.Inventory;
case eButtonType.MinipanelMenu:
return ePanelType.Menu;
case eButtonType.MinipanelMessage:
return ePanelType.Message;
case eButtonType.MinipanelQuest:
return ePanelType.Quest;
case eButtonType.MinipanelSkill:
return ePanelType.Skill;
default:
return ePanelType.None;
}
}
}
}

View File

@ -1,12 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Extensions
{
public static class MobManagerExtensions
{
public static IEnumerable<MobState> FindInRadius(this IEnumerable<MobState> mobs, float centerx, float centery, float radius)
=> mobs.Where(x => x.GetDistance(centerx, centery) <= radius);
}
}

View File

@ -1,32 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
using System.Collections.Generic;
using System.IO;
namespace OpenDiablo2.Common.Interfaces
{
public interface IMPQProvider : IEnumerable<MPQ>
{
IEnumerable<string> GetTextFile(string fileName);
Stream GetStream(string fileName);
byte[] GetBytes(string fileName);
string GetCharacterDccPath(eHero hero, eMobMode mobMode, eCompositType compositType, PlayerEquipment equipment);
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.IO;
namespace OpenDiablo2.Common.Interfaces
{
public interface ISoundProvider : IDisposable
{
void LoadSong(Stream data);
void PlaySong();
void StopSong();
void StopSfx(int channel);
int PlaySfx(byte[] data);
}
}

View File

@ -1,10 +0,0 @@
using System.Collections.Generic;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IPaletteProvider
{
Dictionary<string, Palette> PaletteTable { get; }
}
}

View File

@ -1,28 +0,0 @@
using System.Collections.Generic;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Interfaces
{
/// <summary>
/// A utility class to make it easy to get specific types of resources from the data files in the game.
/// </summary>
public interface IResourceManager
{
/// <summary>
/// Get an <see cref="ImageSet" /> from the game's resources.
/// </summary>
/// <param name="resourcePath">The path to the ImageSet to grab.</param>
/// <returns>The <see cref="ImageSet"/> that was requested. Throw an exception if not found.</returns>
ImageSet GetImageSet(string resourcePath);
MPQFont GetMPQFont(string resourcePath);
MPQDS1 GetMPQDS1(string resourcePath, LevelPreset level, LevelType levelType);
MPQDT1 GetMPQDT1(string resourcePath);
Palette GetPalette(string paletteFile);
MPQCOF GetPlayerAnimation(eHero hero, eMobMode mobMode, PlayerEquipment equipment);
MPQDCC GetPlayerDCC(MPQCOF.COFLayer cofLayer, PlayerEquipment equipment, Palette palette);
Dictionary<string, List<AnimationData>> Animations { get; }
}
}

View File

@ -1,7 +0,0 @@
namespace OpenDiablo2.Common.Interfaces
{
public interface ITextDictionary
{
string Translate(string key);
}
}

View File

@ -1,17 +0,0 @@
using System;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Interfaces.Drawing
{
public interface ICharacterRenderer : IDisposable
{
Guid UID { get; set; }
void Update(long ms);
void Render(int pixelOffsetX, int pixelOffsetY);
void ResetAnimationData();
void ResetCache();
}
}

View File

@ -1,36 +0,0 @@
using System;
using System.Drawing;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces.Drawing;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IRenderWindow : IDisposable
{
IMouseCursor MouseCursor { get; set; }
bool IsRunning { get; }
void Update();
void Clear();
void Sync();
void Quit();
uint GetTicks();
ISprite LoadSprite(string resourcePath, string palette, Point location, bool cacheFrames = false);
ISprite LoadSprite(string resourcePath, string palette, bool cacheFrames = false);
IFont LoadFont(string resourcePath, string palette);
ILabel CreateLabel(IFont font);
ILabel CreateLabel(IFont font, string text);
ILabel CreateLabel(IFont font, Point position, string text);
void Draw(ISprite sprite);
void Draw(ISprite sprite, Point location);
void Draw(ISprite sprite, int frame, Point location);
void Draw(ISprite sprite, int frame);
void Draw(ISprite sprite, int xSegments, int ySegments, int offset);
IMouseCursor LoadCursor(ISprite sprite, int frame, Point hotspot);
void Draw(ILabel label);
MapCellInfo CacheMapCell(MPQDT1Tile mapCell, eRenderCellType cellType);
void DrawMapCell(MapCellInfo mapCellInfo, int xPixel, int yPixel);
ICharacterRenderer CreateCharacterRenderer();
}
}

View File

@ -1,18 +0,0 @@
using System;
using System.Drawing;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface ISprite : IDisposable
{
Point Location { get; set; }
Size FrameSize { get; set; }
Size LocalFrameSize { get; }
int Frame { get; set; }
int TotalFrames { get; }
Palette CurrentPalette { get; set; }
bool Blend { get; set; }
bool Darken { get; set; }
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces
{
// This allows external systems to store their texture data in other services for later use
public interface ITexture
{
}
}

View File

@ -1,42 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.Caching;
namespace OpenDiablo2.Common.Interfaces
{
/// <summary>
/// Provides access to the cache system.
/// </summary>
public interface ICache
{
/// <summary>
/// Gets an item from the cache. If the item does not exist, the value factory will be executed to
/// generate the value.
/// </summary>
/// <typeparam name="T">The return type of the value</typeparam>
/// <param name="key">The name of the cache key, in the form of Type::X::Y::Z where
/// Type is the base type, and x/y/z are unique identifiers for the item.</param>
/// <param name="valueFactory">A function that returns the correct value if it does not already exist.</param>
/// <param name="cacheItemPolicy">Pass in a new policy to control how this item is handled. Typically you can leave this null.</param>
/// <returns>The item requested</returns>
T AddOrGetExisting<T>(string key, Func<T> valueFactory, CacheItemPolicy cacheItemPolicy = null);
bool Exists(string key);
T GetExisting<T>(string key) where T : class, new();
void Add<T>(string key, T value, CacheItemPolicy cacheItemPolicy = null);
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface ICharacterPanel : IDisposable
{
void Render();
void Update();
}
}

View File

@ -1,22 +0,0 @@
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Interfaces.Mobs;
using OpenDiablo2.Common.Models;
using System.Collections.Generic;
namespace OpenDiablo2.Common.Interfaces
{
public interface IEngineDataManager
{
List<LevelDetail> Levels { get; }
List<LevelPreset> LevelPresets { get; }
List<LevelType> LevelTypes { get; }
List<Item> Items { get; }
Dictionary<eHero, ILevelExperienceConfig> ExperienceConfigs { get; }
Dictionary<eHero, IHeroTypeConfig> HeroTypeConfigs { get; }
List<IEnemyTypeConfig> EnemyTypeConfigs { get; }
List<ObjectInfo> Objects { get; }
List<ObjectTypeInfo> ObjectTypes { get; }
Dictionary<int, IMissileTypeConfig> MissileTypeConfigs { get; }
Dictionary<string, int> MissileTypeConfigsLookup { get; }
}
}

View File

@ -1,9 +0,0 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IGameEngine : IDisposable
{
void Run();
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Interfaces
{
public interface IGameServer : IDisposable
{
IEnumerable<PlayerState> Players { get; }
int Seed { get; }
void Update(int ms);
void InitializeNewGame();
int SpawnNewPlayer(int clientHash, string playerName, eHero heroType);
PlayerEquipment UpdateEquipment(int clientHash, string slot, ItemInstance itemInstance);
}
}

View File

@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IGameState : IDisposable
{
object ThreadLocker { get; }
int Act { get; }
int Seed { get; }
string MapName { get; }
Palette CurrentPalette { get; }
IEnumerable<PlayerInfo> PlayerInfos { get; }
eDifficulty Difficulty { get; }
ItemInstance SelectedItem { get; }
void SelectItem(ItemInstance item);
int CameraOffset { get; set; }
void Initialize(string characterName, eHero hero, eSessionType sessionType, eDifficulty difficulty);
void Update(long ms);
IEnumerable<MapCellInfo> GetMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType);
void UpdateMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType, IEnumerable<MapCellInfo> mapCellInfo);
IMapInfo InsertMap(eLevelId levelId, IMapInfo parentMap = null);
IMapInfo InsertMap(int levelId, Point origin, IMapInfo parentMap = null);
IMapInfo InsertSubMap(int levelPresetId, int levelTypeId, Point origin, IMapInfo primaryMap, int subTile = -1);
IMapInfo GetSubMapInfo(int levelPresetId, int levelTypeId, IMapInfo primaryMap, Point origin, int subTile = -1);
void AddMap(IMapInfo map);
int HasMap(int cellX, int cellY);
IEnumerable<Size> GetMapSizes(int cellX, int cellY);
void RemoveEverythingAt(int cellX, int cellY);
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IInventoryPanel : IDisposable
{
void Render();
void Update();
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IItem
{
string Name { get; set; }
string Code { get; set; }
}
}

View File

@ -1,28 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IItemInstance
{
Item Item { get; }
string Name { get; }
int Level { get; }
bool Identified { get; }
}
}

View File

@ -1,11 +0,0 @@
using System.Collections.Generic;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IItemManager
{
Item getItem(string code);
ItemInstance getItemInstance(string code);
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface IMapRenderer
{
Guid FocusedPlayerId { get; set; }
int CameraOffset { get; set; }
PointF CameraLocation { get; set; }
void Update(long ms);
void Render();
PointF GetCellPositionAt(int x, int y);
}
}

View File

@ -1,46 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Interfaces
{
public interface IMobLocation
{
float X { get; set; }
float Y { get; set; }
float MovementSpeed { get; set; }
int MovementDirection { get; set; }
List<PointF> Waypoints { get; set; }
eMovementType MovementType { get; set; }
}
public static class MobLocationHelper
{
public static void CopyMobLocationDetailsTo(this IMobLocation source, IMobLocation dest)
{
dest.X = source.X;
dest.Y = source.Y;
dest.MovementSpeed = source.MovementSpeed;
dest.MovementDirection = source.MovementDirection;
dest.Waypoints = source.Waypoints; // TODO: do we need to do a literaly copy here?
dest.MovementType = source.MovementType;
}
}
}

View File

@ -1,11 +0,0 @@
using OpenDiablo2.Common.Enums;
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IPanelFrame : IDisposable
{
void Render();
void Update();
}
}

View File

@ -1,11 +0,0 @@
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common.Models;
namespace OpenDiablo2.Common.Interfaces
{
public interface IRandomizedMapGenerator
{
void Generate(IMapInfo parentMap, Point location);
}
}

View File

@ -1,10 +0,0 @@
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IScene : IDisposable
{
void Update(long ms);
void Render();
}
}

View File

@ -1,9 +0,0 @@
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Interfaces
{
public interface ISceneManager
{
void ChangeScene(eSceneType sceneType);
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces
{
public interface IMessageFrame
{
void LoadFrom(BinaryReader br);
void WriteTo(BinaryWriter bw);
void Process(int clientHash, ISessionEventProvider sessionEventProvider);
}
}

View File

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Interfaces
{
public delegate void OnSetSeedEvent(int clientHash, int seed);
public delegate void OnJoinGameEvent(int clientHash, eHero heroType, string playerName);
public delegate void OnUpdateEquipmentEvent(int clientHash, string slot, ItemInstance itemInstance);
public delegate void OnChangeEquipment(int clientHash, Guid PlayerUID, PlayerEquipment playerEquipment);
public delegate void OnLocatePlayersEvent(int clientHash, IEnumerable<LocationDetails> playerLocationDetails);
public delegate void OnPlayerInfoEvent(int clientHash, IEnumerable<PlayerInfo> playerInfo);
public delegate void OnFocusOnPlayer(int clientHash, Guid playerId);
public delegate void OnMoveRequest(int clientHash, PointF targetCell, eMovementType movementType);
public interface ISessionEventProvider
{
OnSetSeedEvent OnSetSeed { get; set; }
OnJoinGameEvent OnJoinGame { get; set; }
OnLocatePlayersEvent OnLocatePlayers { get; set; }
OnUpdateEquipmentEvent OnUpdateEquipment { get; set; }
OnChangeEquipment OnChangeEquipment { get; set; }
OnPlayerInfoEvent OnPlayerInfo { get; set; }
OnFocusOnPlayer OnFocusOnPlayer { get; set; }
OnMoveRequest OnMoveRequest { get; set; }
}
}

View File

@ -1,19 +0,0 @@
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models;
using OpenDiablo2.Common.Models.Mobs;
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface ISessionManager : ISessionEventProvider, IDisposable
{
void Initialize();
void Stop();
void JoinGame(string playerName, eHero heroType);
void MoveRequest(PointF targetCell, eMovementType movementType);
void UpdateEquipment(string slot, ItemInstance itemInstance);
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Threading;
namespace OpenDiablo2.Common.Interfaces
{
public interface ISessionServer : IDisposable
{
AutoResetEvent WaitServerStartEvent { get; set; }
void Start();
void Stop();
}
}

View File

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IEnemyTypeAppearanceConfig
{
bool HasDeathAnimation { get; }
bool HasNeutralAnimation { get; }
bool HasWalkAnimation { get; }
bool HasGetHitAnimation { get; }
bool[] HasAttackAnimation { get; } // 1-2
bool HasBlockAnimation { get; }
bool HasCastAnimation { get; }
bool[] HasSkillAnimation { get; } // 1-4
bool HasCorpseAnimation { get; }
bool HasKnockbackAnimation { get; }
// HasSkillSequenceAnimation skipped due to being unused
bool HasRunAnimation { get; }
bool HasLifeBar { get; } // does this monster show a lifebar when you scroll over it
bool HasNameBar { get; } // does this monster show a name when you scroll over it
bool CannotBeSelected { get; } // if true, monster can never be highlighted
bool CanCorpseBeSelected { get; } // if true, the corpse can be highlighted
int BleedType { get; } // how does this monster bleed when hit?
// 0 = it doesn't, 1 = small blood, 2 = large blood, 3+ = random missiles from missiles.txt, the larger
// the number, the more missiles (??? this needs to be tested...)
bool HasShadow { get; } // does this have a shadow?
int LightRadius { get; } // how large of a light does this emit?
bool HasUniqueBossColors { get; } // if true, has unique colors when spawned
// as a boss.
bool CompositeDeath { get; } // if true, death animation uses multiple components
// (not clear if this is just for reference or if it actually has an effect...)
byte[] LightRGB { get; } // 0: R, 1: G, 2: B
}
}

View File

@ -1,54 +0,0 @@
using OpenDiablo2.Common.Enums.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IEnemyTypeCombatConfig
{
int ElementalAttackMode { get;} // 4 = on hit, rest are unknown?
eDamageTypes ElementalAttackType { get;} // 1=fire, 2=lightning, 4=cold, 5=poison
int ElementalOverlayId { get;} // see overlays.txt, corresponds to a row number -2
int ElementalChance { get;} // chance of use on a normal attack, 0 = never 100 = always
int ElementalMinDamage { get;}
int ElementalMaxDamage { get;}
int ElementalDuration { get;} // duration of effects like cold and poison
// TODO: these could be switched to SHORTS, is there any benefit to that?
int[] MissileForAttack { get;} // 1-2, which missile is used per attack
// important note: 65535 = NONE. See missiles.txt, corresponds to a row number -2
int[] MissileForSkill { get;} // 1-4, which missile is used for a skill
// important note: 65535 = NONE. See missiles.txt, corresponds to a row number -2
int MissileForCase { get;} // see above, specifies a missile for Case
int MissileForSequence { get;} // see above, specifies a missile for Sequence
bool[] CanMoveAttack { get;} // 1-2, can move while using attack 1 / 2
bool[] CanMoveSkill { get;} // 1-4, can move while using skill 1/2/3/4
bool CanMoveCast { get;} // can move while casting?
bool IsMelee { get;} // is this a melee attacker?
bool IsAttackable { get;} // is this monster attackable?
int MeleeRange { get; }
int[] SkillType { get;} // 1-5, what type of skill is it? 0 = none
int[] SkillSequence { get;} // 1-5 animation sequence number
// should not be 0 if skill is not 0; see animation column in skills.txt
int[] SkillLevel { get;} // 1-5, level of the skill
bool IsUndeadWithPhysicalAttacks { get;} // if true, is an undead attacking with physical attacks
bool IsUndeadWithMagicAttacks { get;} // if true '' magic atttacks
bool UsesMagicAttacks { get;}
int ChanceToBlock { get;}
bool DoesDeathDamage { get;} // if true, does damage when it dies
// like undead flayers (TODO: understand exactly how this works)
bool IgnoredBySummons { get;} // if true, is ignored by summons in combat
}
}

View File

@ -1,88 +0,0 @@
using OpenDiablo2.Common.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IEnemyTypeConfig
{
string InternalName { get; }
string DisplayName { get; } // Note the distinction here; the second column
// in the monstats is a unique identifier string, whereas the first is non-unique
string Type { get; }
string Descriptor { get; }
int BaseId { get; }
int PopulateId { get; }
bool Spawned { get; }
bool Beta { get; }
string Code { get; }
bool ClientOnly { get; }
bool NoMap { get; }
int SizeX { get; }
int SizeY { get; }
int Height { get; }
bool NoOverlays { get; }
int OverlayHeight { get; }
int Velocity { get; }
int RunVelocity { get; }
bool CanStealFrom { get; }
int ColdEffect { get; }
bool Rarity { get; }
int MinimumGrouping { get; }
int MaximumGrouping { get; }
string BaseWeapon { get; }
int[] AIParams { get; } // up to 5
bool Allied { get; } // Is this enemy on the player's side?
bool IsNPC { get; } // is this an NPC?
bool IsCritter { get; } // is this a critter? (e.g. the chickens)
bool CanEnterTown { get; } // can this enter town or not?
int HealthRegen { get; } // hp regen per minute
bool IsDemon { get; } // demon?
bool IsLarge { get; } // size large (e.g. bosses)
bool IsSmall { get; } // size small (e.g. fallen)
bool IsFlying { get; } // can move over water for instance
bool CanOpenDoors { get; }
int SpawningColumn { get; } // is the monster area restricted
// 0 = no, spawns through levels.txt, 1-3 unknown?
// TODO: understand spawningcolumn
bool IsBoss { get; }
bool IsInteractable { get; } // can this be interacted with? like an NPC
bool IsKillable { get; }
bool CanBeConverted { get; } // if true, can be switched to Allied by spells like Conversion
int HitClass { get; } // TODO: find out what this is
bool HasSpecialEndDeath { get; } // marks if a monster dies a special death
bool DeadCollision { get; } // if true, corpse has collision
bool CanBeRevivedByOtherMonsters { get; }
// appearance config
IEnemyTypeAppearanceConfig AppearanceConfig { get; }
// combat config
IEnemyTypeCombatConfig CombatConfig { get; }
// difficulty configs
IEnemyTypeDifficultyConfig NormalDifficultyConfig { get; }
IEnemyTypeDifficultyConfig NightmareDifficultyConfig { get; }
IEnemyTypeDifficultyConfig HellDifficultyConfig { get; }
IEnemyTypeDifficultyConfig GetDifficultyConfig(eDifficulty Difficulty);
}
}

View File

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IEnemyTypeDifficultyConfig
{
int Level { get; }
double DamageResist { get; }
double MagicResist { get; }
double FireResist { get; }
double LightningResist { get; }
double ColdResist { get; }
double PoisonResist { get; }
int MinHP { get; }
int MaxHP { get; }
int AC { get; } // armor class
int Exp { get; }
int[] AttackMinDamage { get; } // 1-2, min damage attack can roll
int[] AttackMaxDamage { get; } // 1-2 max damage attack can roll
int[] AttackChanceToHit { get; } // 1-2 chance attack has to hit (out of 100??)
int Skill1MinDamage { get; } // min damage skill 1 can do (why only skill 1?)
int Skill1MaxDamage { get; } // max damage for skill 1
int Skill1ChanceToHit { get; } // chance skill has to hit
string[] TreasureClass { get; } // 1-4
}
}

View File

@ -1,62 +0,0 @@
using OpenDiablo2.Common.Models.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IHeroTypeConfig
{
int StartingVitality { get; }
int StartingStrength { get; }
int StartingDexterity { get; }
int StartingEnergy { get; }
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)
// and 2 mana on odd levels (e.g. -> 3)
double PerLevelMana { get; }
double PerLevelStamina { get; }
double PerVitalityHealth { get; }
double PerVitalityStamina { get; }
double PerEnergyMana { get; }
int PerLevelStatPoints { get; }
int BaseAttackRating { get; }
int PerDexterityAttackRating { get; }
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; }
string StartingSkill { get; }
string[] StartingSkills { get; }
string AllSkillsBonusString { get; }
string FirstTabBonusString { get; }
string SecondTabBonusString { get; }
string ThirdTabBonusString { get; }
string ClassOnlyBonusString { get; }
string BaseWeaponClass { get; }
List<InitialEquipment> InitialEquipment { get; }
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface ILevelExperienceConfig
{
long GetTotalExperienceForLevel(int level);
int GetMaxLevel();
}
}

View File

@ -1,147 +0,0 @@
using OpenDiablo2.Common.Enums.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IMissileTypeConfig
{
string Name { get; }
int Id { get; }
int ClientMovementFunctionId { get; }
int ClientHitFunctionId { get; }
int ServerMovementFunctionId { get; }
int ServerHitFunctionId { get; }
int ServerDamageFunctionId { get; }
string ServerMovementCalc { get; }
int[] ServerMovementParams { get; }
string ClientMovementCalc { get; }
int[] ClientMovementParams { get; }
string ServerHitCalc { get; }
int[] ServerHitParams { get; }
string ClientHitCalc { get; }
int[] ClientHitParams { get; }
string ServerDamageCalc { get; }
int[] ServerDamageParams { get; }
int BaseVelocity { get; }
int MaxVelocity { get; }
int VelocityPerSkillLevel { get; }
int Acceleration { get; }
int Range { get; }
int ExtraRangePerLevel { get; }
int LightRadius { get; }
bool LightFlicker { get; }
byte[] LightColor { get; }
int FramesBeforeVisible { get; }
int FramesBeforeActive { get; }
bool LoopAnimation { get; }
string CelFilePath { get; }
int AnimationRate { get; }
int AnimationLength { get; }
int AnimationSpeed { get; }
int StartingFrame { get; }
bool AnimationHasSubLoop { get; }
int AnimationSubLoopStart { get; }
int AnimationSubLoopEnd { get; }
int CollisionType { get; }
bool CollideKill { get; }
bool CollideFriend { get; }
bool CollideLast { get; }
bool CollisionUnknown { get; }
bool CollisionClient { get; }
bool CollisionClientSend { get; }
bool CollisionUseTimer { get; }
int CollisionTimerLength { get; }
int XOffset { get; }
int YOffset { get; }
int ZOffset { get; }
int Size { get; }
bool SrcTown { get; }
bool SrcTownClient { get; }
bool CanDestroy { get; }
bool UseAttackRating { get; }
bool AlwaysExplode { get; }
bool IsClientExplosion { get; }
bool AllowedInTown { get; }
bool NoUniqueMod { get; }
bool NoMultishotMod { get; }
int Holy { get; }
bool CanSlow { get; }
bool ReturnFire { get; }
bool KnockIntoGetHit { get; }
bool SoftHit { get; }
int KnockbackChance { get; }
int TransparencyType { get; }
bool UsesQuantity { get; }
bool Pierce { get; }
bool SpecialSetup { get; }
bool MissileSkill { get; }
string SkillName { get; }
int ResultFlags { get; }
int HitFlags { get; }
int HitShift { get; }
bool ApplyMastery { get; }
int SourceDamage { get; }
bool HalfWithTwoHandedWeapon { get; }
int SourceMissileDamage { get; }
int MinDamage { get; }
int MaxDamage { get; }
int[] MinDamagePerLevel { get; }
int[] MaxDamagePerLevel { get; }
string PhysicalDamageSynergyCalc { get; }
eDamageTypes ElementalDamageType { get; }
int ElementalMinDamage { get; }
int ElementalMaxDamage { get; }
int[] ElementalMinDamagePerLevel { get; }
int[] ElementalMaxDamagePerLevel { get; }
string ElementalDamageSynergyCalc { get; }
int ElementalDuration { get; }
int[] ElementalDurationPerLevel { get; }
int HitClass { get; }
bool CanBleed { get; }
bool AffectedByOpenWounds { get; }
int DamageRate { get; }
string SoundTravel { get; }
string SoundHit { get; }
string SoundProg { get; }
string ProgOverlay { get; }
string ExplosionMissile { get; }
string[] SubMissiles { get; }
string[] HitSubMissiles { get; }
string[] ClientSubMissiles { get; }
string[] ClientHitSubMissiles { get; }
}
}

View File

@ -1,22 +0,0 @@
using System.Collections.Generic;
using OpenDiablo2.Common.Models.Mobs;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IMobManager
{
IEnumerable<MobState> Mobs { get; }
IEnumerable<PlayerState> Players { get; }
IEnumerable<EnemyState> Enemies { get; }
void AddPlayer(PlayerState player);
void RemovePlayer(PlayerState player);
void AddMob(MobState mob);
void RemoveMob(MobState mob);
int GetNextAvailableMobId();
void AddEnemy(EnemyState enemy);
void RemoveEnemy(EnemyState enemy);
}
}

View File

@ -1,19 +0,0 @@
using OpenDiablo2.Common.Enums.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Interfaces.Mobs
{
public interface IStatModifier
{
string Name { get; }
int Priority { get; } // what priority does this modifier happen in? higher = occurs before other modifiers
// modifiers at the same priority level occur simultaneously
eStatModifierType ModifierType { get; } // does it affect current, min or max?
int GetValue(int min, int max, int current); // what does this modifier add to the stat's current value?
double GetValue(double min, double max, double current);
}
}

View File

@ -1,10 +0,0 @@
namespace OpenDiablo2.Common.Interfaces
{
public delegate void OnKeyPressed(char charcode);
public interface IKeyboardInfoProvider
{
OnKeyPressed KeyPressCallback { get; set; }
bool KeyIsPressed(int scancode);
}
}

View File

@ -1,5 +0,0 @@
namespace OpenDiablo2.Common.Interfaces
{
/// <summary>A cursor that can be displayed on the screen to indicate the location of the mouse.</summary>
public interface IMouseCursor { }
}

View File

@ -1,12 +0,0 @@
namespace OpenDiablo2.Common.Interfaces
{
public interface IMouseInfoProvider
{
int MouseX { get; }
int MouseY { get; }
bool LeftMouseDown { get; }
bool LeftMousePressed { get; }
bool RightMouseDown { get; }
bool ReserveMouse { get; set; }
}
}

View File

@ -1,68 +0,0 @@
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
/// <summary>
/// A callback that is executed the button is activated (clicked).
/// </summary>
public delegate void OnActivateDelegate();
/// <summary>
/// A callback that is executed if the button is toggled.
/// </summary>
/// <param name="isToggled">When enabled, this is true, otherwise false</param>
public delegate void OnToggleDelegate(bool isToggled);
/// <summary>
/// Represents a visual button on the screen.
/// </summary>
public interface IButton : IDisposable
{
/// <summary>
/// Assigning a function to this property will cause that function to be called
/// when a button is pressed.
/// </summary>
OnActivateDelegate OnActivate { get; set; }
/// <summary>
/// If false, the button is visually darkened, and will ignore all user input.
/// </summary>
bool Enabled { get; set; }
/// <summary>
/// If true, the button is pushed down, false otherwise. Only valid for toggle buttons.
/// </summary>
bool Toggled { get; }
/// <summary>
/// The position of the button on the screen.
/// </summary>
Point Location { get; set; }
/// <summary>
/// Assigning a function to this property will cause that function to be called
/// when the button is toggled on or off.
/// </summary>
OnToggleDelegate OnToggle { get; set; }
/// <summary>
/// Toggle the button. Only valid for toggle buttons.
/// </summary>
bool Toggle();
string Text { get; set; }
/// <summary>
/// Allows the button to update its internal state.
/// Call this in the Update method of your scene.
/// </summary>
void Update();
/// <summary>
/// Renders the button to the screen.
/// Call this in the render method of your scene.
/// </summary>
void Render();
}
}

View File

@ -1,22 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace OpenDiablo2.Common.Interfaces
{
public interface ICharacterPanel : IPanel
{
}
}

View File

@ -1,10 +0,0 @@
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface IFont : IDisposable
{
Size CalculateSize(string text);
}
}

View File

@ -1,36 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Interfaces
{
public interface IGameHUD
{
bool IsRunningEnabled { get; }
bool IsLeftPanelVisible { get; }
bool IsRightPanelVisible { get; }
bool IsMouseOver();
void TogglePanel(ePanelType panelType);
void TogglePanel(IPanel panel);
void OpenPanels(IPanel leftPanel, IPanel rightPanel);
void ClosePanels();
void Render();
void Update();
}
}

View File

@ -1,22 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace OpenDiablo2.Common.Interfaces
{
public interface IInventoryPanel : IPanel
{
}
}

View File

@ -1,17 +0,0 @@
using OpenDiablo2.Common.Models;
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface IItemContainer : IDisposable
{
ItemInstance ContainedItem { get; }
Point Location { get; set; }
string Slot { get; set; }
void SetContainedItem(ItemInstance containedItem);
void Render();
void Update();
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Drawing;
using OpenDiablo2.Common.Enums;
namespace OpenDiablo2.Common.Interfaces
{
public interface ILabel : IDisposable
{
string Text { get; set; }
Point Location { get; set; }
Size TextArea { get; set; }
Color TextColor { get; set; }
int MaxWidth { get; set; }
eTextAlign Alignment { get; set; }
}
}

View File

@ -1,19 +0,0 @@
using OpenDiablo2.Common.Enums;
using System;
namespace OpenDiablo2.Common.Interfaces
{
public delegate void OnPanelToggledEvent(IPanel panel);
public interface IMiniPanel : IDisposable
{
event OnPanelToggledEvent OnPanelToggled;
IPanel GetPanel(ePanelType panelType);
bool IsMouseOver();
void UpdatePanelLocation();
void OnMenuToggle(bool isToggled);
void Render();
void Update();
}
}

View File

@ -1,33 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using OpenDiablo2.Common.Enums;
using System;
namespace OpenDiablo2.Common.Interfaces
{
public delegate void OnPanelClosedEvent(IPanel panel);
public interface IPanel : IDisposable
{
event OnPanelClosedEvent OnPanelClosed;
ePanelType PanelType { get; }
ePanelFrameType FrameType { get; }
void Render();
void Update();
}
}

View File

@ -1,11 +0,0 @@
using OpenDiablo2.Common.Enums;
using System;
namespace OpenDiablo2.Common.Interfaces
{
public interface IPanelFrame : IDisposable
{
void Render();
void Update();
}
}

View File

@ -1,23 +0,0 @@
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace OpenDiablo2.Common.Interfaces.UI
{
public interface ISkillsPanel : IPanel
{
int ActivePanelIndex { get; }
}
}

View File

@ -1,13 +0,0 @@
using System;
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface ITextBox : IDisposable
{
string Text { get; set; }
Point Location { get; set; }
void Render();
void Update(long ms);
}
}

View File

@ -1,11 +0,0 @@
using System.Drawing;
namespace OpenDiablo2.Common.Interfaces
{
public interface ITextLabel
{
string Text { get; set; }
Point Position { get; set; }
IFont Font { get; set; }
}
}

View File

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Models
{
public sealed class AnimationData
{
public string COFName { get; set; }
public int FramesPerDirection { get; set; }
public int AnimationSpeed { get; set; }
public byte[] Flags { get; set; }
public static Dictionary<string, List<AnimationData>> LoadFromStream(Stream stream)
{
var result = new Dictionary<string, List<AnimationData>>();
var br = new BinaryReader(stream);
while(stream.Length > stream.Position)
{
var dataCount = br.ReadInt32();
for (int i = 0; i < dataCount; ++i)
{
var data = new AnimationData
{
COFName = Encoding.ASCII.GetString(br.ReadBytes(8)).Trim('\0'),
FramesPerDirection = br.ReadInt32(),
AnimationSpeed = br.ReadInt32(),
Flags = br.ReadBytes(144),
};
if (!result.ContainsKey(data.COFName.ToUpper()))
result[data.COFName.ToUpper()] = new List<AnimationData>();
result[data.COFName.ToUpper()].Add(data);
}
}
br.Dispose();
return result;
}
}
}

Some files were not shown because too many files have changed in this diff Show More