1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-16 04:25:23 +00:00

Fixed more rule violations

This commit is contained in:
Tim Sarbin 2018-12-08 13:11:52 -05:00
parent 382b38abe0
commit 4a4dbbb0b9
35 changed files with 345 additions and 274 deletions

View File

@ -42,7 +42,7 @@ namespace OpenDiablo2.Common.Models
var result = 0U;
for (var i = 0; i < bits; i++)
result |= (GetBit() << i);
result |= GetBit() << i;
return result;
}

View File

@ -264,7 +264,7 @@ namespace OpenDiablo2.Common.Models
for (int j = 0; j < 5; j++) result.ObjGrp0_7[j] = Convert.ToInt32(v[i++]);
result.ObjPrb0_7 = new int[8];
for (int j = 0; j < 5; j++) result.ObjPrb0_7[j] = Convert.ToInt32(v[i++]);
result.Beta = Convert.ToInt32(v[i++]) == 1;
result.Beta = Convert.ToInt32(v[i]) == 1;
return result;

View File

@ -1,4 +1,20 @@
using System;
/* 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.Collections.Generic;
using System.IO;
using System.Linq;
@ -11,14 +27,10 @@ namespace OpenDiablo2.Common.Models
public sealed class MPQ : IDisposable
{
private const string HEADER_SIGNATURE = "MPQ\x1A";
//private const string USERDATA_SIGNATURE = "MPQ\x1B";
private const string LISTFILE_NAME = "(listfile)";
private const int MPQ_HASH_FILE_KEY = 3;
private const int MPQ_HASH_TABLE_OFFSET = 0;
private const int MPQ_HASH_NAME_A = 1;
private const int MPQ_HASH_NAME_B = 2;
private const UInt32 MPQ_HASH_ENTRY_EMPTY = 0xFFFFFFFF;
private const UInt32 MPQ_HASH_ENTRY_DELETED = 0xFFFFFFFE;
internal struct HeaderRecord
{
@ -34,9 +46,7 @@ namespace OpenDiablo2.Common.Models
}
[Flags]
#pragma warning disable IDE1006 // Naming Styles
internal enum eBlockRecordFlags : UInt32
#pragma warning restore IDE1006 // Naming Styles
internal enum eBlockRecordBitflag : UInt32
{
IsFile = 0x80000000, // Block is a file, and follows the file data format; otherwise, block is free space or unused. If the block is not a file, all other flags should be cleared, and FileSize should be 0.
SingleUnit = 0x01000000, // File is stored as a single unit, rather than split into sectors.
@ -55,12 +65,12 @@ namespace OpenDiablo2.Common.Models
public uint EncryptionSeed { get; set; }
public string FileName { get; internal set; }
public bool IsFile => (Flags & (UInt32)eBlockRecordFlags.IsFile) != 0;
public bool SingleUnit => (Flags & (UInt32)eBlockRecordFlags.SingleUnit) != 0;
public bool KeyAdjusted => (Flags & (UInt32)eBlockRecordFlags.KeyAdjusted) != 0;
public bool IsEncrypted => (Flags & (UInt32)eBlockRecordFlags.IsEncrypted) != 0;
public bool IsCompressed => (Flags & (UInt32)eBlockRecordFlags.IsCompressed) != 0;
public bool IsImploded => (Flags & (UInt32)eBlockRecordFlags.IsImploded) != 0;
public bool IsFile => (Flags & (UInt32)eBlockRecordBitflag.IsFile) != 0;
public bool SingleUnit => (Flags & (UInt32)eBlockRecordBitflag.SingleUnit) != 0;
public bool KeyAdjusted => (Flags & (UInt32)eBlockRecordBitflag.KeyAdjusted) != 0;
public bool IsEncrypted => (Flags & (UInt32)eBlockRecordBitflag.IsEncrypted) != 0;
public bool IsCompressed => (Flags & (UInt32)eBlockRecordBitflag.IsCompressed) != 0;
public bool IsImploded => (Flags & (UInt32)eBlockRecordBitflag.IsImploded) != 0;
}
internal struct HashRecord
@ -72,13 +82,13 @@ namespace OpenDiablo2.Common.Models
public UInt32 FileBlockIndex;
}
internal static UInt32[] cryptTable = new UInt32[0x500];
internal static readonly UInt32[] cryptTable = new UInt32[0x500];
internal HeaderRecord Header;
private readonly List<BlockRecord> blockTable = new List<BlockRecord>();
private readonly List<HashRecord> hashTable = new List<HashRecord>();
internal Stream fileStream;
public UInt16 LanguageId = 0;
public UInt16 LanguageId { get; internal set; } = 0;
public const byte Platform = 0;
public string Path { get; private set; }
@ -139,7 +149,7 @@ namespace OpenDiablo2.Common.Models
seed = (seed * 125 + 3) % 0x2AAAAB;
cryptTable[index2] = (temp | (seed & 0xFFFF));
cryptTable[index2] = temp | (seed & 0xFFFF);
}
}
}
@ -171,15 +181,15 @@ namespace OpenDiablo2.Common.Models
seed2 += cryptTable[(int)(0x400 + (seed1 & 0xff))];
uint result = BitConverter.ToUInt32(data, i);
result ^= (seed1 + seed2);
result ^= seed1 + seed2;
seed1 = ((~seed1 << 21) + 0x11111111) | (seed1 >> 11);
seed2 = result + seed2 + (seed2 << 5) + 3;
data[i + 0] = ((byte)(result & 0xff));
data[i + 1] = ((byte)((result >> 8) & 0xff));
data[i + 2] = ((byte)((result >> 16) & 0xff));
data[i + 3] = ((byte)((result >> 24) & 0xff));
data[i + 0] = (byte)(result & 0xff);
data[i + 1] = (byte)((result >> 8) & 0xff);
data[i + 2] = (byte)((result >> 16) & 0xff);
data[i + 3] = (byte)((result >> 24) & 0xff);
}
}
@ -269,6 +279,7 @@ namespace OpenDiablo2.Common.Models
return seed1;
}
/*
private static UInt32 ComputeFileKey(string filePath, BlockRecord blockRecord, UInt32 archiveOffset)
{
var fileName = filePath.Split('\\').Last();
@ -282,13 +293,13 @@ namespace OpenDiablo2.Common.Models
return fileKey;
}
private bool FindFileInHashTable(string filePath, out UInt32 fileHashEntry)
{
fileHashEntry = 0;
// Find the home entry in the hash table for the file
UInt32 initEntry = HashString(filePath, MPQ_HASH_TABLE_OFFSET) & (UInt32)(Header.HashTableSize - 1);
UInt32 initEntry = HashString(filePath, MPQ_HASH_TABLE_OFFSET) & Header.HashTableSize - 1;
// Is there anything there at all?
if (hashTable[(int)initEntry].FileBlockIndex == MPQ_HASH_ENTRY_EMPTY)
@ -315,12 +326,12 @@ namespace OpenDiablo2.Common.Models
}
}
iCurEntry = (iCurEntry + 1) & (UInt32)(Header.HashTableSize - 1);
iCurEntry = (iCurEntry + 1) & Header.HashTableSize - 1;
} while (iCurEntry != initEntry && hashTable[(int)iCurEntry].FileBlockIndex != MPQ_HASH_ENTRY_EMPTY);
return false;
}
*/
private bool GetHashRecord(string fileName, out HashRecord hash)
{
uint index = HashString(fileName, 0);
@ -328,7 +339,7 @@ namespace OpenDiablo2.Common.Models
uint name1 = HashString(fileName, MPQ_HASH_NAME_A);
uint name2 = HashString(fileName, MPQ_HASH_NAME_B);
for (uint i = index; i < hashTable.Count(); ++i)
for (uint i = index; i < hashTable.Count; ++i)
{
hash = hashTable[(int)i];
if (hash.FilePathHashA == name1 && hash.FilePathHashB == name2)

View File

@ -48,7 +48,7 @@ namespace OpenDiablo2.Common.Models
var numLayers = br.ReadByte();
var framesPerDir = br.ReadByte();
var numDirections = br.ReadByte();
br.ReadByte(); // Number of directions
br.ReadBytes(25); // Skip 25 unknown bytes...

View File

@ -11,24 +11,24 @@ namespace OpenDiablo2.Common.Models
{
public sealed class PixelBufferEntry
{
public byte[] Value;
public int Frame;
public int FrameCellIndex;
public byte[] Value { get; internal set; }
public int Frame { get; internal set; }
public int FrameCellIndex { get; internal set; }
}
public sealed class Cell
{
public int Width;
public int Height;
public int XOffset;
public int YOffset;
public int Width { get; internal set; }
public int Height { get; internal set; }
public int XOffset { get; internal set; }
public int YOffset { get; internal set; }
public int LastWidth;
public int LastHeight;
public int LastXOffset;
public int LastYOffset;
public int LastWidth { get; internal set; }
public int LastHeight { get; internal set; }
public int LastXOffset { get; internal set; }
public int LastYOffset { get; internal set; }
public byte[] PixelData;
public byte[] PixelData { get; internal set; }
}
public sealed class MPQDCCDirectionFrame
@ -49,7 +49,7 @@ namespace OpenDiablo2.Common.Models
public MPQDCCDirectionFrame(BitMuncher bits, MPQDCCDirection direction)
{
var variable0 = bits.GetBits(direction.Variable0Bits);
bits.GetBits(direction.Variable0Bits); // Variable0
Width = (int)bits.GetBits(direction.WidthBits);
Height = (int)bits.GetBits(direction.HeightBits);
XOffset = bits.GetSignedBits(direction.XOffsetBits);
@ -218,7 +218,7 @@ namespace OpenDiablo2.Common.Models
for (var i = 0; i < 256; i++)
paletteEntries.Add(bm.GetBit() != 0);
PaletteEntries = new byte[paletteEntries.Count(x => x == true)];
PaletteEntries = new byte[paletteEntries.Count(x => x)];
var paletteOffset = 0;
for (var i = 0; i < 256; i++)
{
@ -295,8 +295,6 @@ namespace OpenDiablo2.Common.Models
foreach (var frame in Frames)
{
frameIndex++;
var numberOfCells = frame.HorizontalCellCount * frame.VerticalCellCount;
var c = -1;
foreach (var cell in frame.Cells)
{
@ -393,7 +391,7 @@ namespace OpenDiablo2.Common.Models
var currentCellY = cellY + originCellY;
for (var cellX = 0; cellX < frame.HorizontalCellCount; cellX++, frameCellIndex++)
{
var currentCell = (originCellX + cellX) + (currentCellY * HorizontalCellCount);
var currentCell = originCellX + cellX + (currentCellY * HorizontalCellCount);
var nextCell = false;
var tmp = 0;
if (cellBuffer[currentCell] != null)

View File

@ -60,12 +60,12 @@ namespace OpenDiablo2.Common.Models
public struct DS1LookupTable
{
public int Orientation;
public int MainIndex;
public int SubIndex;
public int Frame;
public int Orientation { get; internal set; }
public int MainIndex { get; internal set; }
public int SubIndex { get; internal set; }
public int Frame { get; internal set; }
public MPQDT1Tile TileRef;
public MPQDT1Tile TileRef { get; internal set; }
}

View File

@ -328,13 +328,13 @@ namespace OpenDiablo2.Common.Models
target = Length + offset;
break;
default:
throw new ArgumentException("Origin", "Invalid SeekOrigin");
throw new ArgumentException("Invalid SeekOrigin", "origin");
}
if (target < 0)
throw new ArgumentOutOfRangeException("Attmpted to Seek before the beginning of the stream");
throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek before the beginning of the stream");
if (target >= Length)
throw new ArgumentOutOfRangeException("Attmpted to Seek beyond the end of the stream");
throw new ArgumentOutOfRangeException("offset", "Attmpted to Seek beyond the end of the stream");
position = target;

View File

@ -85,17 +85,17 @@ namespace OpenDiablo2.Common.Models
int temp2 = temp1 >> shift;
if ((value & 1) != 0)
temp2 += (temp1 >> 0);
temp2 += temp1 >> 0;
if ((value & 2) != 0)
temp2 += (temp1 >> 1);
temp2 += temp1 >> 1;
if ((value & 4) != 0)
temp2 += (temp1 >> 2);
temp2 += temp1 >> 2;
if ((value & 8) != 0)
temp2 += (temp1 >> 3);
temp2 += temp1 >> 3;
if ((value & 0x10) != 0)
temp2 += (temp1 >> 4);
temp2 += temp1 >> 4;
if ((value & 0x20) != 0)
temp2 += (temp1 >> 5);
temp2 += temp1 >> 5;
int temp3 = Array2[channel];
if ((value & 0x40) != 0)

View File

@ -11,7 +11,7 @@ namespace OpenDiablo2.Common.Models.Mobs
{
public class LevelExperienceConfig : ILevelExperienceConfig
{
private readonly List<long> ExperiencePerLevel = new List<long>();
private readonly List<long> ExperiencePerLevel;
public LevelExperienceConfig(List<long> expperlevel)
{

View File

@ -174,5 +174,6 @@ namespace OpenDiablo2.Common.Models.Mobs
public static bool operator >(MobState obj1, MobState obj2) => obj1?.Id > obj2?.Id;
public static bool operator <=(MobState obj1, MobState obj2) => obj1?.Id <= obj2?.Id;
public static bool operator >=(MobState obj1, MobState obj2) => obj1?.Id >= obj2?.Id;
public override int GetHashCode() => Id.GetHashCode();
}
}

View File

@ -1,4 +1,20 @@
using System;
/* 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;
using OpenDiablo2.Common.Enums.Mobs;
using OpenDiablo2.Common.Interfaces.Mobs;
@ -124,7 +140,7 @@ namespace OpenDiablo2.Common.Models.Mobs
{
// on even levels, e.g. 2, 4, 6, you gain 1 from an increase of 1.5
// on odd levels, you gain 2 from an increase of 1.5
return (int)(((Level % 2) * Math.Ceiling(increase)) + ((1 - (Level % 2)) * Math.Floor(increase)));
return (int)((Level % 2 * Math.Ceiling(increase)) + ((1 - (Level % 2)) * Math.Floor(increase)));
}
#endregion Level and Experience

View File

@ -1,10 +1,21 @@
using OpenDiablo2.Common.Enums.Mobs;
/* 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.Mobs;
using OpenDiablo2.Common.Interfaces.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Models.Mobs
{
@ -14,7 +25,7 @@ namespace OpenDiablo2.Common.Models.Mobs
protected int Max = 0;
protected int Current = 0; // the current value BEFORE modifiers
public bool AllowedToOverflowFromModifiers = false; // if true, can return a value greater than Max
public bool AllowedToOverflowFromModifiers { get; set; } = false; // if true, can return a value greater than Max
// if a modifier is increasing the current value
public Stat(int min, int max, int current, bool allowedToOverflowFromModifiers)

View File

@ -14,7 +14,7 @@ namespace OpenDiablo2.Common.Models.Mobs
protected double Max = 0;
protected double Current = 0; // the current value BEFORE modifiers
public bool AllowedToOverflowFromModifiers = false; // if true, can return a value greater than Max
public bool AllowedToOverflowFromModifiers { get; set; } = false; // if true, can return a value greater than Max
// if a modifier is increasing the current value
public StatDouble(double min, double max, double current, bool allowedToOverflowFromModifiers)

View File

@ -1,16 +1,27 @@
using OpenDiablo2.Common.Enums.Mobs;
/* 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.Mobs;
using OpenDiablo2.Common.Interfaces.Mobs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Models.Mobs
{
public class StatModifierAddition : IStatModifier
{
public double Value = 0;
public double Value { get; set; } = 0;
public int Priority { get; private set; }
public string Name { get; private set; }
public eStatModifierType ModifierType { get; private set; }
@ -33,7 +44,7 @@ namespace OpenDiablo2.Common.Models.Mobs
public class StatModifierMultiplication : IStatModifier
{
public double Value = 0;
public double Value { get; set; } = 0;
public int Priority { get; private set; }
public string Name { get; private set; }
public eStatModifierType ModifierType { get; private set; }
@ -62,11 +73,11 @@ namespace OpenDiablo2.Common.Models.Mobs
switch (ModifierType)
{
case eStatModifierType.CURRENT:
return (current * Value);
return current * Value;
case eStatModifierType.MAX:
return (max * Value);
return max * Value;
case eStatModifierType.MIN:
return (min * Value);
return min * Value;
}
return 0; // shouldn't reach this
}

View File

@ -187,7 +187,7 @@ namespace OpenDiablo2.Common.Models
private int DecodeDist(int length)
{
if (_bitstream.EnsureBits(8) == false) return 0;
if (!_bitstream.EnsureBits(8)) return 0;
int pos = sPosition1[_bitstream.PeekByte()];
byte skip = sDistBits[pos]; // Number of bits to skip
@ -196,13 +196,13 @@ namespace OpenDiablo2.Common.Models
if (length == 2)
{
if (_bitstream.EnsureBits(2) == false) return 0;
if (!_bitstream.EnsureBits(2)) return 0;
pos = (pos << 2) | _bitstream.ReadBits(2);
}
else
{
if (_bitstream.EnsureBits(_dictSizeBits) == false) return 0;
pos = ((pos << _dictSizeBits)) | _bitstream.ReadBits(_dictSizeBits);
if (!_bitstream.EnsureBits(_dictSizeBits)) return 0;
pos = (pos << _dictSizeBits) | _bitstream.ReadBits(_dictSizeBits);
}
return pos + 1;

View File

@ -26,7 +26,7 @@ namespace OpenDiablo2.Common.Models
var b = br.ReadByte();
var g = br.ReadByte();
var r = br.ReadByte();
result.Colors[i] = ((UInt32)255 << 24) + ((UInt32)r << 16) + ((UInt32)g << 8) + (UInt32)b;
result.Colors[i] = ((UInt32)255 << 24) + ((UInt32)r << 16) + ((UInt32)g << 8) + b;
}
return result;

View File

@ -1,4 +1,20 @@
using System;
/* 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.Collections.Generic;
using System.Text;
using OpenDiablo2.Common.Enums;
@ -24,7 +40,7 @@ namespace OpenDiablo2.Common.Models
result.Add((byte)WeaponClass);
result.Add((byte)ArmorType);
result.Add((byte)MobMode);
result.AddRange(BitConverter.GetBytes((Int32)nameBytes.Length));
result.AddRange(BitConverter.GetBytes(nameBytes.Length));
result.AddRange(nameBytes);
result.AddRange(LocationDetails.GetBytes());
result.AddRange(UID.ToByteArray());

View File

@ -1,4 +1,20 @@
using System;
/* 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.Collections.Generic;
using OpenDiablo2.Common.Enums;
using OpenDiablo2.Common.Models.Mobs;
@ -18,12 +34,12 @@ namespace OpenDiablo2.Common.Models
public byte[] GetBytes()
{
var result = new List<byte>();
result.AddRange(BitConverter.GetBytes((Int32)PlayerId));
result.AddRange(BitConverter.GetBytes((float)PlayerX));
result.AddRange(BitConverter.GetBytes((float)PlayerY));
result.AddRange(BitConverter.GetBytes((Int32)MovementDirection));
result.AddRange(BitConverter.GetBytes(PlayerId));
result.AddRange(BitConverter.GetBytes(PlayerX));
result.AddRange(BitConverter.GetBytes(PlayerY));
result.AddRange(BitConverter.GetBytes(MovementDirection));
result.AddRange(BitConverter.GetBytes((byte)MovementType));
result.AddRange(BitConverter.GetBytes((float)MovementSpeed));
result.AddRange(BitConverter.GetBytes(MovementSpeed));
return result.ToArray();
}
@ -54,7 +70,7 @@ namespace OpenDiablo2.Common.Models
PlayerY = source.GetPosition().Y,
MovementType = source.MovementType,
MovementDirection = source.MovementDirection,
MovementSpeed = (float)(source.MovementType == eMovementType.Running ? source.GetRunVelocity() : source.GetWalkVeloicty()) / 4f
MovementSpeed = (source.MovementType == eMovementType.Running ? source.GetRunVelocity() : source.GetWalkVeloicty()) / 4f
};
return result;
}

View File

@ -9,142 +9,142 @@ namespace OpenDiablo2.Common
public static class ResourcePaths
{
// --- Loading Screen ---
public static string LoadingScreen = "data\\global\\ui\\Loading\\loadingscreen.dc6";
public static string LoadingScreen { get; } = "data\\global\\ui\\Loading\\loadingscreen.dc6";
// --- Main Menu ---
public static string GameSelectScreen = "data\\global\\ui\\FrontEnd\\gameselectscreenEXP.dc6";
public static string Diablo2LogoFireLeft = "data\\global\\ui\\FrontEnd\\D2logoFireLeft.DC6";
public static string Diablo2LogoFireRight = "data\\global\\ui\\FrontEnd\\D2logoFireRight.DC6";
public static string Diablo2LogoBlackLeft = "data\\global\\ui\\FrontEnd\\D2logoBlackLeft.DC6";
public static string Diablo2LogoBlackRight = "data\\global\\ui\\FrontEnd\\D2logoBlackRight.DC6";
public static string GameSelectScreen { get; } = "data\\global\\ui\\FrontEnd\\gameselectscreenEXP.dc6";
public static string Diablo2LogoFireLeft { get; } = "data\\global\\ui\\FrontEnd\\D2logoFireLeft.DC6";
public static string Diablo2LogoFireRight { get; } = "data\\global\\ui\\FrontEnd\\D2logoFireRight.DC6";
public static string Diablo2LogoBlackLeft { get; } = "data\\global\\ui\\FrontEnd\\D2logoBlackLeft.DC6";
public static string Diablo2LogoBlackRight { get; } = "data\\global\\ui\\FrontEnd\\D2logoBlackRight.DC6";
// --- Character Select Screen ---
public static string CharacterSelectBackground = "data\\global\\ui\\FrontEnd\\charactercreationscreenEXP.dc6";
public static string CharacterSelectCampfire = "data\\global\\ui\\FrontEnd\\fire.DC6";
public static string CharacterSelectBackground { get; } = "data\\global\\ui\\FrontEnd\\charactercreationscreenEXP.dc6";
public static string CharacterSelectCampfire { get; } = "data\\global\\ui\\FrontEnd\\fire.DC6";
public static string CharacterSelectBarbarianUnselected = "data\\global\\ui\\FrontEnd\\barbarian\\banu1.DC6";
public static string CharacterSelectBarbarianUnselectedH = "data\\global\\ui\\FrontEnd\\barbarian\\banu2.DC6";
public static string CharacterSelectBarbarianSelected = "data\\global\\ui\\FrontEnd\\barbarian\\banu3.DC6";
public static string CharacterSelectBarbarianForwardWalk = "data\\global\\ui\\FrontEnd\\barbarian\\bafw.DC6";
public static string CharacterSelectBarbarianForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\barbarian\\BAFWs.DC6";
public static string CharacterSelectBarbarianBackWalk = "data\\global\\ui\\FrontEnd\\barbarian\\babw.DC6";
public static string CharacterSelectBarbarianUnselected { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu1.DC6";
public static string CharacterSelectBarbarianUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu2.DC6";
public static string CharacterSelectBarbarianSelected { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\banu3.DC6";
public static string CharacterSelectBarbarianForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\bafw.DC6";
public static string CharacterSelectBarbarianForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\BAFWs.DC6";
public static string CharacterSelectBarbarianBackWalk { get; } = "data\\global\\ui\\FrontEnd\\barbarian\\babw.DC6";
public static string CharacterSelecSorceressUnselected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU1.DC6";
public static string CharacterSelecSorceressUnselectedH = "data\\global\\ui\\FrontEnd\\sorceress\\SONU2.DC6";
public static string CharacterSelecSorceressSelected = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3.DC6";
public static string CharacterSelecSorceressSelectedOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3s.DC6";
public static string CharacterSelecSorceressForwardWalk= "data\\global\\ui\\FrontEnd\\sorceress\\SOFW.DC6";
public static string CharacterSelecSorceressForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOFWs.DC6";
public static string CharacterSelecSorceressBackWalk = "data\\global\\ui\\FrontEnd\\sorceress\\SOBW.DC6";
public static string CharacterSelecSorceressBackWalkOverlay = "data\\global\\ui\\FrontEnd\\sorceress\\SOBWs.DC6";
public static string CharacterSelecSorceressUnselected { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU1.DC6";
public static string CharacterSelecSorceressUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU2.DC6";
public static string CharacterSelecSorceressSelected { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3.DC6";
public static string CharacterSelecSorceressSelectedOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SONU3s.DC6";
public static string CharacterSelecSorceressForwardWalk{ get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOFW.DC6";
public static string CharacterSelecSorceressForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOFWs.DC6";
public static string CharacterSelecSorceressBackWalk { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOBW.DC6";
public static string CharacterSelecSorceressBackWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\sorceress\\SOBWs.DC6";
public static string CharacterSelectNecromancerUnselected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU1.DC6";
public static string CharacterSelectNecromancerUnselectedH = "data\\global\\ui\\FrontEnd\\necromancer\\NENU2.DC6";
public static string CharacterSelecNecromancerSelected = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3.DC6";
public static string CharacterSelecNecromancerSelectedOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3s.DC6";
public static string CharacterSelecNecromancerForwardWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEFW.DC6";
public static string CharacterSelecNecromancerForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEFWs.DC6";
public static string CharacterSelecNecromancerBackWalk = "data\\global\\ui\\FrontEnd\\necromancer\\NEBW.DC6";
public static string CharacterSelecNecromancerBackWalkOverlay = "data\\global\\ui\\FrontEnd\\necromancer\\NEBWs.DC6";
public static string CharacterSelectNecromancerUnselected { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU1.DC6";
public static string CharacterSelectNecromancerUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU2.DC6";
public static string CharacterSelecNecromancerSelected { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3.DC6";
public static string CharacterSelecNecromancerSelectedOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NENU3s.DC6";
public static string CharacterSelecNecromancerForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEFW.DC6";
public static string CharacterSelecNecromancerForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEFWs.DC6";
public static string CharacterSelecNecromancerBackWalk { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEBW.DC6";
public static string CharacterSelecNecromancerBackWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\necromancer\\NEBWs.DC6";
public static string CharacterSelectPaladinUnselected = "data\\global\\ui\\FrontEnd\\paladin\\PANU1.DC6";
public static string CharacterSelectPaladinUnselectedH = "data\\global\\ui\\FrontEnd\\paladin\\PANU2.DC6";
public static string CharacterSelecPaladinSelected = "data\\global\\ui\\FrontEnd\\paladin\\PANU3.DC6";
public static string CharacterSelecPaladinForwardWalk = "data\\global\\ui\\FrontEnd\\paladin\\PAFW.DC6";
public static string CharacterSelecPaladinForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\paladin\\PAFWs.DC6";
public static string CharacterSelecPaladinBackWalk = "data\\global\\ui\\FrontEnd\\paladin\\PABW.DC6";
public static string CharacterSelectPaladinUnselected { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU1.DC6";
public static string CharacterSelectPaladinUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU2.DC6";
public static string CharacterSelecPaladinSelected { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PANU3.DC6";
public static string CharacterSelecPaladinForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PAFW.DC6";
public static string CharacterSelecPaladinForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PAFWs.DC6";
public static string CharacterSelecPaladinBackWalk { get; } = "data\\global\\ui\\FrontEnd\\paladin\\PABW.DC6";
public static string CharacterSelectAmazonUnselected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU1.DC6";
public static string CharacterSelectAmazonUnselectedH = "data\\global\\ui\\FrontEnd\\amazon\\AMNU2.DC6";
public static string CharacterSelecAmazonSelected = "data\\global\\ui\\FrontEnd\\amazon\\AMNU3.DC6";
public static string CharacterSelecAmazonForwardWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMFW.DC6";
public static string CharacterSelecAmazonForwardWalkOverlay = "data\\global\\ui\\FrontEnd\\amazon\\AMFWs.DC6";
public static string CharacterSelecAmazonBackWalk = "data\\global\\ui\\FrontEnd\\amazon\\AMBW.DC6";
public static string CharacterSelectAmazonUnselected { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU1.DC6";
public static string CharacterSelectAmazonUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU2.DC6";
public static string CharacterSelecAmazonSelected { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMNU3.DC6";
public static string CharacterSelecAmazonForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMFW.DC6";
public static string CharacterSelecAmazonForwardWalkOverlay { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMFWs.DC6";
public static string CharacterSelecAmazonBackWalk { get; } = "data\\global\\ui\\FrontEnd\\amazon\\AMBW.DC6";
public static string CharacterSelectAssassinUnselected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU1.DC6";
public static string CharacterSelectAssassinUnselectedH = "data\\global\\ui\\FrontEnd\\assassin\\ASNU2.DC6";
public static string CharacterSelectAssassinSelected = "data\\global\\ui\\FrontEnd\\assassin\\ASNU3.DC6";
public static string CharacterSelectAssassinForwardWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASFW.DC6";
public static string CharacterSelectAssassinBackWalk = "data\\global\\ui\\FrontEnd\\assassin\\ASBW.DC6";
public static string CharacterSelectAssassinUnselected { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU1.DC6";
public static string CharacterSelectAssassinUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU2.DC6";
public static string CharacterSelectAssassinSelected { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASNU3.DC6";
public static string CharacterSelectAssassinForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASFW.DC6";
public static string CharacterSelectAssassinBackWalk { get; } = "data\\global\\ui\\FrontEnd\\assassin\\ASBW.DC6";
public static string CharacterSelectDruidUnselected = "data\\global\\ui\\FrontEnd\\druid\\DZNU1.dc6";
public static string CharacterSelectDruidUnselectedH = "data\\global\\ui\\FrontEnd\\druid\\DZNU2.dc6";
public static string CharacterSelectDruidSelected = "data\\global\\ui\\FrontEnd\\druid\\DZNU3.DC6";
public static string CharacterSelectDruidForwardWalk = "data\\global\\ui\\FrontEnd\\druid\\DZFW.DC6";
public static string CharacterSelectDruidBackWalk = "data\\global\\ui\\FrontEnd\\druid\\DZBW.DC6";
public static string CharacterSelectDruidUnselected { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU1.dc6";
public static string CharacterSelectDruidUnselectedH { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU2.dc6";
public static string CharacterSelectDruidSelected { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZNU3.DC6";
public static string CharacterSelectDruidForwardWalk { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZFW.DC6";
public static string CharacterSelectDruidBackWalk { get; } = "data\\global\\ui\\FrontEnd\\druid\\DZBW.DC6";
// -- Character Selection
public static string CharacterSelectionBackground = "data\\global\\ui\\CharSelect\\characterselectscreenEXP.dc6";
public static string CharacterSelectionBackground { get; } = "data\\global\\ui\\CharSelect\\characterselectscreenEXP.dc6";
// --- Game ---
public static string GamePanels = "data\\global\\ui\\PANEL\\800ctrlpnl7.dc6";
public static string GameGlobeOverlap = "data\\global\\ui\\PANEL\\overlap.DC6";
public static string HealthMana = "data\\global\\ui\\PANEL\\hlthmana.DC6";
public static string GameSmallMenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6"; // TODO: Used for inventory popout
public static string SkillIcon = "data\\global\\ui\\PANEL\\Skillicon.DC6"; // TODO: Used for skill icon button
public static string GamePanels { get; } = "data\\global\\ui\\PANEL\\800ctrlpnl7.dc6";
public static string GameGlobeOverlap { get; } = "data\\global\\ui\\PANEL\\overlap.DC6";
public static string HealthMana { get; } = "data\\global\\ui\\PANEL\\hlthmana.DC6";
public static string GameSmallMenuButton { get; } = "data\\global\\ui\\PANEL\\menubutton.DC6"; // TODO: Used for inventory popout
public static string SkillIcon { get; } = "data\\global\\ui\\PANEL\\Skillicon.DC6"; // TODO: Used for skill icon button
// --- Mouse Pointers ---
public static string CursorDefault = "data\\global\\ui\\CURSOR\\ohand.DC6";
public static string CursorDefault { get; } = "data\\global\\ui\\CURSOR\\ohand.DC6";
// --- Fonts ---
public static string Font6 = "data\\local\\font\\latin\\font6";
public static string Font8 = "data\\local\\font\\latin\\font8";
public static string Font16 = "data\\local\\font\\latin\\font16";
public static string Font24 = "data\\local\\font\\latin\\font24";
public static string Font30 = "data\\local\\font\\latin\\font30";
public static string FontFormal12 = "data\\local\\font\\latin\\fontformal12";
public static string FontFormal11 = "data\\local\\font\\latin\\fontformal11";
public static string FontFormal10 = "data\\local\\font\\latin\\fontformal10";
public static string FontExocet10 = "data\\local\\font\\latin\\fontexocet10";
public static string FontExocet8 = "data\\local\\font\\latin\\fontexocet8";
public static string Font6 { get; } = "data\\local\\font\\latin\\font6";
public static string Font8 { get; } = "data\\local\\font\\latin\\font8";
public static string Font16 { get; } = "data\\local\\font\\latin\\font16";
public static string Font24 { get; } = "data\\local\\font\\latin\\font24";
public static string Font30 { get; } = "data\\local\\font\\latin\\font30";
public static string FontFormal12 { get; } = "data\\local\\font\\latin\\fontformal12";
public static string FontFormal11 { get; } = "data\\local\\font\\latin\\fontformal11";
public static string FontFormal10 { get; } = "data\\local\\font\\latin\\fontformal10";
public static string FontExocet10 { get; } = "data\\local\\font\\latin\\fontexocet10";
public static string FontExocet8 { get; } = "data\\local\\font\\latin\\fontexocet8";
// --- UI ---
public static string WideButtonBlank = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
public static string MediumButtonBlank = "data\\global\\ui\\FrontEnd\\MediumButtonBlank.dc6";
public static string CancelButton = "data\\global\\ui\\FrontEnd\\CancelButtonBlank.dc6";
public static string NarrowButtonBlank = "data\\global\\ui\\FrontEnd\\NarrowButtonBlank.dc6";
public static string TextBox2 = "data\\global\\ui\\FrontEnd\\textbox2.dc6";
public static string TallButtonBlank = "data\\global\\ui\\CharSelect\\TallButtonBlank.dc6";
public static string WideButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
public static string MediumButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\MediumButtonBlank.dc6";
public static string CancelButton { get; } = "data\\global\\ui\\FrontEnd\\CancelButtonBlank.dc6";
public static string NarrowButtonBlank { get; } = "data\\global\\ui\\FrontEnd\\NarrowButtonBlank.dc6";
public static string TextBox2 { get; } = "data\\global\\ui\\FrontEnd\\textbox2.dc6";
public static string TallButtonBlank { get; } = "data\\global\\ui\\CharSelect\\TallButtonBlank.dc6";
// --- GAME UI ---
public static string MinipanelSmall = "data\\global\\ui\\PANEL\\minipanel_s.dc6";
public static string MinipanelButton = "data\\global\\ui\\PANEL\\minipanelbtn.DC6";
public static string MinipanelSmall { get; } = "data\\global\\ui\\PANEL\\minipanel_s.dc6";
public static string MinipanelButton { get; } = "data\\global\\ui\\PANEL\\minipanelbtn.DC6";
public static string Frame = "data\\global\\ui\\PANEL\\800borderframe.dc6";
public static string InventoryCharacterPanel = "data\\global\\ui\\PANEL\\invchar.DC6";
public static string Frame { get; } = "data\\global\\ui\\PANEL\\800borderframe.dc6";
public static string InventoryCharacterPanel { get; } = "data\\global\\ui\\PANEL\\invchar.DC6";
public static string RunButton = "data\\global\\ui\\PANEL\\runbutton.dc6";
public static string MenuButton = "data\\global\\ui\\PANEL\\menubutton.DC6";
public static string RunButton { get; } = "data\\global\\ui\\PANEL\\runbutton.dc6";
public static string MenuButton { get; } = "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";
public static string ArmorPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_armor.DC6";
public static string BeltPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_belt.DC6";
public static string BootsPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_boots.DC6";
public static string HelmGlovePlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_helm_glove.DC6";
public static string RingAmuletPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_ring_amulet.DC6";
public static string WeaponsPlaceholder { get; } = "data\\global\\ui\\PANEL\\inv_weapons.DC6";
// --- Data ---
// TODO: Doesn't sound right :)
public static string EnglishTable = "data\\local\\lng\\eng\\English.txt";
public static string ExpansionStringTable = "data\\local\\lng\\eng\\expansionstring.tbl";
public static string LevelPreset = "data\\global\\excel\\LvlPrest.txt";
public static string LevelType = "data\\global\\excel\\LvlTypes.txt";
public static string LevelDetails = "data\\global\\excel\\Levels.txt";
public static string EnglishTable { get; } = "data\\local\\lng\\eng\\English.txt";
public static string ExpansionStringTable { get; } = "data\\local\\lng\\eng\\expansionstring.tbl";
public static string LevelPreset { get; } = "data\\global\\excel\\LvlPrest.txt";
public static string LevelType { get; } = "data\\global\\excel\\LvlTypes.txt";
public static string LevelDetails { get; } = "data\\global\\excel\\Levels.txt";
// --- Animations ---
public static string ObjectData = "data\\global\\objects";
public static string AnimationData = "data\\global\\animdata.d2";
public static string PlayerAnimationBase = "data\\global\\CHARS";
public static string ObjectData { get; } = "data\\global\\objects";
public static string AnimationData { get; } = "data\\global\\animdata.d2";
public static string PlayerAnimationBase { get; } = "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";
public static string Weapons { get; } = "data\\global\\excel\\weapons.txt";
public static string Armor { get; } = "data\\global\\excel\\armor.txt";
public static string Misc { get; } = "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 Experience { get; } = "data\\global\\excel\\experience.txt";
public static string CharStats { get; } = "data\\global\\excel\\charstats.txt";
public static string GeneratePathForItem(string spriteName)
{

View File

@ -28,7 +28,7 @@ namespace OpenDiablo2.Core.UT
Assert.IsTrue(mobman.Mobs.Count(x => x.HasFlag(eMobFlags.ENEMY)) == 2);
Assert.IsTrue(mobman.Mobs.Count(x => x.HasFlag(eMobFlags.INVULNERABLE)) == 1);
Assert.IsTrue(mobman.Mobs.Count(x => x.HasFlag(eMobFlags.PLAYER)) == 0);
Assert.IsTrue(!mobman.Mobs.Any(x => x.HasFlag(eMobFlags.PLAYER)));
Assert.IsTrue(mobman.Mobs.Count(x => !x.HasFlag(eMobFlags.PLAYER)) == 3);
}

View File

@ -47,7 +47,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
.Where(x => x.Count() == 36 && x[0] != "Expansion")
.ToArray()
.Select(x => x.ToLevelType());
LevelTypes = new List<LevelType>(data);
@ -62,7 +61,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
.Where(x => x.Count() == 24 && x[0] != "Expansion")
.ToArray()
.Select(x => x.ToLevelPreset());
LevelPresets = new List<LevelPreset>(data);
@ -77,7 +75,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
.Where(x => x.Count() > 80 && x[0] != "Expansion")
.ToArray()
.Select(x => x.ToLevelDetail());
LevelDetails = new List<LevelDetail>(data);
@ -102,11 +99,9 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
//.Where(x => !String.IsNullOrWhiteSpace(x[27]))
.ToArray()
.Select(x => x.ToWeapon());
return data;
;
}
private IEnumerable<Armor> LoadArmorData()
@ -117,7 +112,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
//.Where(x => !String.IsNullOrWhiteSpace(x[27]))
.ToArray()
.Select(x => x.ToArmor());
return data;
@ -131,7 +125,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
//.Where(x => !String.IsNullOrWhiteSpace(x[27]))
.ToArray()
.Select(x => x.ToMisc());
return data;
@ -163,7 +156,6 @@ namespace OpenDiablo2.Core
.Where(x => !String.IsNullOrWhiteSpace(x))
.Select(x => x.Split('\t'))
.Where(x => x[0] != "Expansion")
.ToArray()
.ToDictionary(x => (eHero)Enum.Parse(typeof(eHero),x[0]), x => x.ToHeroTypeConfig());
HeroTypeConfigs = data;

View File

@ -106,7 +106,7 @@ namespace OpenDiablo2.Core.GameState_
{
log.Info($"Setting seed to {seed}");
this.Seed = seed;
(new MapGenerator(this)).Generate();
new MapGenerator(this).Generate();
}
public MapInfo LoadSubMap(int levelDefId, Point origin)
@ -126,7 +126,7 @@ namespace OpenDiablo2.Core.GameState_
var random = new Random(Seed);
var mapName = "data\\global\\tiles\\" + mapNames[random.Next(mapNames.Count())].Replace("/", "\\");
var mapName = "data\\global\\tiles\\" + mapNames[random.Next(mapNames.Count)].Replace("/", "\\");
var fileData = resourceManager.GetMPQDS1(mapName, level, levelDetails, levelType);
var result = new MapInfo
@ -162,7 +162,7 @@ namespace OpenDiablo2.Core.GameState_
var random = new Random(Seed);
var mapName = "data\\global\\tiles\\" + mapNames[random.Next(mapNames.Count())].Replace("/", "\\");
var mapName = "data\\global\\tiles\\" + mapNames[random.Next(mapNames.Count)].Replace("/", "\\");
MapName = level.Name;
Act = levelType.Act;
@ -238,10 +238,12 @@ namespace OpenDiablo2.Core.GameState_
public void SelectItem(Item item)
{
if(item == null)
if (item == null)
{
renderWindow.MouseCursor = this.originalMouseCursor;
} else {
}
else
{
var cursorsprite = renderWindow.LoadSprite(ResourcePaths.GeneratePathForItem(item.InvFile), Palettes.Units);
renderWindow.MouseCursor = renderWindow.LoadCursor(cursorsprite, 0, new Point(cursorsprite.FrameSize.Width / 2, cursorsprite.FrameSize.Height / 2));
@ -266,14 +268,11 @@ namespace OpenDiablo2.Core.GameState_
var main_index = (props.Prop3 >> 4) + ((props.Prop4 & 0x03) << 4);
var orientation = 0;
if (cellType == eRenderCellType.Floor)
// Floors can't have rotations, should we blow up here?
if (cellType == eRenderCellType.Floor && props.Prop1 == 0)
{
// Floors can't have rotations, should we blow up here?
if (props.Prop1 == 0)
{
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
return null;
}
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
return null;
}
if (cellType == eRenderCellType.Roof)
@ -420,7 +419,7 @@ namespace OpenDiablo2.Core.GameState_
public void Update(long ms)
{
animationTime += ((float)ms / 1000f);
animationTime += (float)ms / 1000f;
animationTime -= (float)Math.Truncate(animationTime);
var seconds = ms / 1000f;

View File

@ -54,10 +54,10 @@ namespace OpenDiablo2.Core.Map_Engine
}
// Generate the Blood Moore?
for (var y = 0; y < (bloodMooreRect.Height); y+= 8)
for (var y = 0; y < bloodMooreRect.Height; y+= 8)
{
for (var x = 0; x < (bloodMooreRect.Width); x += 8)
for (var x = 0; x < bloodMooreRect.Width; x += 8)
{
var tileIdx = 35;
var mapTile = gameState.LoadSubMap(tileIdx, new Point(bloodMooreRect.Left + x, bloodMooreRect.Top + y));

View File

@ -129,8 +129,8 @@ namespace OpenDiablo2.Core.UI
return;
}
var hovered = (mouseInfoProvider.MouseX >= location.X && mouseInfoProvider.MouseX < (location.X + buttonWidth))
&& (mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + buttonHeight));
var hovered = mouseInfoProvider.MouseX >= location.X && mouseInfoProvider.MouseX < (location.X + buttonWidth)
&& mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + buttonHeight);
if (!activeLock && hovered && mouseInfoProvider.LeftMouseDown && !mouseInfoProvider.ReserveMouse)
@ -165,7 +165,7 @@ namespace OpenDiablo2.Core.UI
activeLock = false;
}
pressed = (hovered && mouseInfoProvider.LeftMouseDown && active);
pressed = hovered && mouseInfoProvider.LeftMouseDown && active;
}
public void Render()

View File

@ -65,8 +65,8 @@ namespace OpenDiablo2.Core.UI
public void Update()
{
var hovered = (mouseInfoProvider.MouseX >= location.X && mouseInfoProvider.MouseX < (location.X + this.Size.Width))
&& (mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + this.Size.Height));
var hovered = mouseInfoProvider.MouseX >= location.X && mouseInfoProvider.MouseX < (location.X + this.Size.Width)
&& mouseInfoProvider.MouseY >= location.Y && mouseInfoProvider.MouseY < (location.Y + this.Size.Height);
if (hovered && mouseInfoProvider.LeftMousePressed)
{

View File

@ -28,7 +28,7 @@ namespace OpenDiablo2.GameServer_
public void InitializeNewGame()
{
log.Info("Initializing a new game");
Seed = (new Random()).Next();
Seed = new Random().Next();
}
public int SpawnNewPlayer(int clientHash, string playerName, eHero heroType)

View File

@ -203,11 +203,11 @@ namespace SDL2
public const uint SDL_INIT_EVENTS = 0x00004000;
public const uint SDL_INIT_SENSOR = 0x00008000;
public const uint SDL_INIT_NOPARACHUTE = 0x00100000;
public const uint SDL_INIT_EVERYTHING = (
public const uint SDL_INIT_EVERYTHING =
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO |
SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC |
SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR
);
;
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_Init(uint flags);
@ -934,7 +934,7 @@ namespace SDL2
public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z)
{
return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z));
return SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -1054,7 +1054,7 @@ namespace SDL2
SDL_WINDOW_INPUT_FOCUS = 0x00000200,
SDL_WINDOW_MOUSE_FOCUS = 0x00000400,
SDL_WINDOW_FULLSCREEN_DESKTOP =
(SDL_WINDOW_FULLSCREEN | 0x00001000),
SDL_WINDOW_FULLSCREEN | 0x00001000,
SDL_WINDOW_FOREIGN = 0x00000800,
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /* Only available in 2.0.1 */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /* Only available in 2.0.4 */
@ -1088,7 +1088,7 @@ namespace SDL2
public static int SDL_WINDOWPOS_UNDEFINED_DISPLAY(int X)
{
return (SDL_WINDOWPOS_UNDEFINED_MASK | X);
return SDL_WINDOWPOS_UNDEFINED_MASK | X;
}
public static bool SDL_WINDOWPOS_ISUNDEFINED(int X)
@ -1098,7 +1098,7 @@ namespace SDL2
public static int SDL_WINDOWPOS_CENTERED_DISPLAY(int X)
{
return (SDL_WINDOWPOS_CENTERED_MASK | X);
return SDL_WINDOWPOS_CENTERED_MASK | X;
}
public static bool SDL_WINDOWPOS_ISCENTERED(int X)
@ -2535,11 +2535,11 @@ namespace SDL2
}
SDL_PIXELTYPE_ENUM pType =
(SDL_PIXELTYPE_ENUM) SDL_PIXELTYPE(format);
return (
return
pType == SDL_PIXELTYPE_ENUM.SDL_PIXELTYPE_INDEX1 ||
pType == SDL_PIXELTYPE_ENUM.SDL_PIXELTYPE_INDEX4 ||
pType == SDL_PIXELTYPE_ENUM.SDL_PIXELTYPE_INDEX8
);
;
}
public static bool SDL_ISPIXELFORMAT_ALPHA(uint format)
@ -2550,12 +2550,12 @@ namespace SDL2
}
SDL_PIXELORDER_ENUM pOrder =
(SDL_PIXELORDER_ENUM) SDL_PIXELORDER(format);
return (
return
pOrder == SDL_PIXELORDER_ENUM.SDL_PACKEDORDER_ARGB ||
pOrder == SDL_PIXELORDER_ENUM.SDL_PACKEDORDER_RGBA ||
pOrder == SDL_PIXELORDER_ENUM.SDL_PACKEDORDER_ABGR ||
pOrder == SDL_PIXELORDER_ENUM.SDL_PACKEDORDER_BGRA
);
;
}
public static bool SDL_ISPIXELFORMAT_FOURCC(uint format)
@ -4498,7 +4498,7 @@ namespace SDL2
#region SDL_keycode.h
public const int SDLK_SCANCODE_MASK = (1 << 30);
public const int SDLK_SCANCODE_MASK = 1 << 30;
public static SDL_Keycode SDL_SCANCODE_TO_KEYCODE(SDL_Scancode X)
{
return (SDL_Keycode)((int)X | SDLK_SCANCODE_MASK);
@ -4794,10 +4794,10 @@ namespace SDL2
KMOD_RESERVED = 0x8000,
/* These are defines in the SDL headers */
KMOD_CTRL = (KMOD_LCTRL | KMOD_RCTRL),
KMOD_SHIFT = (KMOD_LSHIFT | KMOD_RSHIFT),
KMOD_ALT = (KMOD_LALT | KMOD_RALT),
KMOD_GUI = (KMOD_LGUI | KMOD_RGUI)
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
KMOD_ALT = KMOD_LALT | KMOD_RALT,
KMOD_GUI = KMOD_LGUI | KMOD_RGUI
}
#endregion
@ -5738,21 +5738,21 @@ namespace SDL2
#region SDL_haptic.h
/* SDL_HapticEffect type */
public const ushort SDL_HAPTIC_CONSTANT = (1 << 0);
public const ushort SDL_HAPTIC_SINE = (1 << 1);
public const ushort SDL_HAPTIC_LEFTRIGHT = (1 << 2);
public const ushort SDL_HAPTIC_TRIANGLE = (1 << 3);
public const ushort SDL_HAPTIC_SAWTOOTHUP = (1 << 4);
public const ushort SDL_HAPTIC_SAWTOOTHDOWN = (1 << 5);
public const ushort SDL_HAPTIC_SPRING = (1 << 7);
public const ushort SDL_HAPTIC_DAMPER = (1 << 8);
public const ushort SDL_HAPTIC_INERTIA = (1 << 9);
public const ushort SDL_HAPTIC_FRICTION = (1 << 10);
public const ushort SDL_HAPTIC_CUSTOM = (1 << 11);
public const ushort SDL_HAPTIC_GAIN = (1 << 12);
public const ushort SDL_HAPTIC_AUTOCENTER = (1 << 13);
public const ushort SDL_HAPTIC_STATUS = (1 << 14);
public const ushort SDL_HAPTIC_PAUSE = (1 << 15);
public const ushort SDL_HAPTIC_CONSTANT = 1 << 0;
public const ushort SDL_HAPTIC_SINE = 1 << 1;
public const ushort SDL_HAPTIC_LEFTRIGHT = 1 << 2;
public const ushort SDL_HAPTIC_TRIANGLE = 1 << 3;
public const ushort SDL_HAPTIC_SAWTOOTHUP = 1 << 4;
public const ushort SDL_HAPTIC_SAWTOOTHDOWN = 1 << 5;
public const ushort SDL_HAPTIC_SPRING = 1 << 7;
public const ushort SDL_HAPTIC_DAMPER = 1 << 8;
public const ushort SDL_HAPTIC_INERTIA = 1 << 9;
public const ushort SDL_HAPTIC_FRICTION = 1 << 10;
public const ushort SDL_HAPTIC_CUSTOM = 1 << 11;
public const ushort SDL_HAPTIC_GAIN = 1 << 12;
public const ushort SDL_HAPTIC_AUTOCENTER = 1 << 13;
public const ushort SDL_HAPTIC_STATUS = 1 << 14;
public const ushort SDL_HAPTIC_PAUSE = 1 << 15;
/* SDL_HapticDirection type */
public const byte SDL_HAPTIC_POLAR = 0;
@ -6153,9 +6153,9 @@ namespace SDL2
#region SDL_audio.h
public const ushort SDL_AUDIO_MASK_BITSIZE = 0xFF;
public const ushort SDL_AUDIO_MASK_DATATYPE = (1 << 8);
public const ushort SDL_AUDIO_MASK_ENDIAN = (1 << 12);
public const ushort SDL_AUDIO_MASK_SIGNED = (1 << 15);
public const ushort SDL_AUDIO_MASK_DATATYPE = 1 << 8;
public const ushort SDL_AUDIO_MASK_ENDIAN = 1 << 12;
public const ushort SDL_AUDIO_MASK_SIGNED = 1 << 15;
public static ushort SDL_AUDIO_BITSIZE(ushort x)
{
@ -6220,12 +6220,12 @@ namespace SDL2
public const uint SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002;
public const uint SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004;
public const uint SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008;
public const uint SDL_AUDIO_ALLOW_ANY_CHANGE = (
public const uint SDL_AUDIO_ALLOW_ANY_CHANGE =
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE |
SDL_AUDIO_ALLOW_FORMAT_CHANGE |
SDL_AUDIO_ALLOW_CHANNELS_CHANGE |
SDL_AUDIO_ALLOW_SAMPLES_CHANGE
);
;
public const int SDL_MIX_MAXVOLUME = 128;
@ -6535,7 +6535,7 @@ namespace SDL2
*/
public static bool SDL_TICKS_PASSED(UInt32 A, UInt32 B)
{
return ((Int32)(B - A) <= 0);
return (Int32)(B - A) <= 0;
}
/* Delays the thread's processing based on the milliseconds parameter */

View File

@ -91,8 +91,8 @@ namespace OpenDiablo2.SDL2_
if (currentDirectionCache == null)
return;
seconds += ((float)ms / 1000f);
var animationSeg = (15f / (float)currentDirectionCache.AnimationSpeed);
seconds += (float)ms / 1000f;
var animationSeg = 15f / (float)currentDirectionCache.AnimationSpeed;
while (seconds >= animationSeg)
{
seconds -= animationSeg;

View File

@ -85,7 +85,7 @@ namespace OpenDiablo2.SDL2_
return new Size(w, h);
}
if (MaxWidth < (font.sprite.FrameSize.Width))
if (MaxWidth < font.sprite.FrameSize.Width)
throw new OpenDiablo2Exception("Max label width cannot be smaller than a single character.");
var lastWordIndex = 0;
@ -181,7 +181,7 @@ namespace OpenDiablo2.SDL2_
var y = 0;
foreach(var line in linesToRender)
{
var lineWidth = (line.Sum(c => font.font.CharacterMetric[c].Width));
var lineWidth = line.Sum(c => font.font.CharacterMetric[c].Width);
var x = 0;
if (Alignment == eTextAlign.Centered)

View File

@ -373,7 +373,7 @@ namespace OpenDiablo2.SDL2_
{
UInt32* data = (UInt32*)pixels;
var pitchChange = (pitch / 4);
var pitchChange = pitch / 4;
for (var i = 0; i < frameSize.Height * pitchChange; i++)
data[i] = 0x0;

View File

@ -102,7 +102,7 @@ namespace OpenDiablo2.SDL2_
{
return source == null
? Location
: new Point(Location.X + source.Frames[Frame].OffsetX, (Location.Y - FrameSize.Height) + source.Frames[Frame].OffsetY);
: new Point(Location.X + source.Frames[Frame].OffsetX, Location.Y - FrameSize.Height + source.Frames[Frame].OffsetY);
}
public Size LocalFrameSize => new Size((int)source.Frames[Frame].Width, (int)source.Frames[Frame].Height);

View File

@ -68,8 +68,8 @@ namespace OpenDiablo2.Scenes
if (gameHUD.IsMouseOver())
return;
var mx = (mouseInfoProvider.MouseX - 400) - gameState.CameraOffset;
var my = (mouseInfoProvider.MouseY - 300);
var mx = mouseInfoProvider.MouseX - 400 - gameState.CameraOffset;
var my = mouseInfoProvider.MouseY - 300;
var tx = (mx / 60f + my / 40f) / 2f;
var ty = (my / 40f - (mx / 60f)) / 2f;

View File

@ -107,7 +107,7 @@ namespace OpenDiablo2.Scenes
public void Update(long ms)
{
float seconds = ((float)ms / 1000f);
float seconds = (float)ms / 1000f;
logoFrame += seconds;
while (logoFrame >= 1f)
logoFrame -= 1f;

View File

@ -341,7 +341,7 @@ namespace OpenDiablo2.Scenes
public void Update(long ms)
{
float seconds = ((float)ms / 1500f);
float seconds = (float)ms / 1500f;
secondTimer += seconds;
while (secondTimer >= 1f)
secondTimer -= 1f;

View File

@ -44,7 +44,7 @@ namespace OpenDiablo2
Parser.Default.ParseArguments<CommandLineOptions>(args).WithParsed(o => globalConfiguration = new GlobalConfiguration
{
BaseDataPath = Path.GetFullPath(o.DataPath ?? Directory.GetCurrentDirectory()),
MouseMode = o.HardwareMouse == true ? eMouseMode.Hardware : eMouseMode.Software,
MouseMode = o.HardwareMouse ? eMouseMode.Hardware : eMouseMode.Software,
HardwareMouseScale = o.MouseScale,
FullScreen = o.FullScreen
}).WithNotParsed(o =>