Initial code.

This commit is contained in:
gibbed
2017-11-07 21:49:37 -06:00
parent 1010ccdc9b
commit b6b737f84c
94 changed files with 6804 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal class AchievementDefinition
{
public string Id;
public string Name;
public string Description;
public string IconNormal;
public string IconLocked;
public bool IsHidden;
public int Permission;
}
}

View File

@@ -0,0 +1,47 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System.Windows.Forms;
namespace SAM.Game.Stats
{
internal class AchievementInfo
{
public string Id;
public bool IsAchieved;
public int Permission;
public string IconNormal;
public string IconLocked;
public string Name;
public string Description;
public ListViewItem Item;
#region public int ImageIndex;
public int ImageIndex
{
get { return this.Item.ImageIndex; }
set { this.Item.ImageIndex = value; }
}
#endregion
}
}

View File

@@ -0,0 +1,33 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal class FloatStatDefinition : StatDefinition
{
public float MinValue;
public float MaxValue;
public float MaxChange;
public bool IncrementOnly;
public float DefaultValue;
}
}

View File

@@ -0,0 +1,52 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal class FloatStatInfo : StatInfo
{
public float OriginalValue;
public float FloatValue;
public override object Value
{
get { return this.FloatValue; }
set
{
var f = float.Parse((string)value);
if ((this.Permission & 2) != 0 &&
this.FloatValue.Equals(f) == false)
{
throw new StatIsProtectedException();
}
this.FloatValue = f;
}
}
public override bool IsModified
{
get { return this.FloatValue.Equals(this.OriginalValue) == false; }
}
}
}

View File

@@ -0,0 +1,52 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal class IntStatInfo : StatInfo
{
public int OriginalValue;
public int IntValue;
public override object Value
{
get { return this.IntValue; }
set
{
var i = int.Parse((string)value);
if ((this.Permission & 2) != 0 &&
this.IntValue != i)
{
throw new StatIsProtectedException();
}
this.IntValue = i;
}
}
public override bool IsModified
{
get { return this.IntValue != this.OriginalValue; }
}
}
}

View File

@@ -0,0 +1,33 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal class IntegerStatDefinition : StatDefinition
{
public int MinValue;
public int MaxValue;
public int MaxChange;
public bool IncrementOnly;
public int DefaultValue;
}
}

View File

@@ -0,0 +1,31 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal abstract class StatDefinition
{
public string Id;
public string DisplayName;
public int Permission;
}
}

View File

@@ -0,0 +1,35 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
namespace SAM.Game.Stats
{
[Flags]
internal enum StatFlags
{
None = 0,
IncrementOnly = 1 << 0,
Protected = 1 << 1,
UnknownPermission = 1 << 2,
}
}

View File

@@ -0,0 +1,46 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.Game.Stats
{
internal abstract class StatInfo
{
public abstract bool IsModified { get; }
public string Id { get; set; }
public string DisplayName { get; set; }
public abstract object Value { get; set; }
public bool IsIncrementOnly { get; set; }
public int Permission { get; set; }
public string Extra
{
get
{
var flags = StatFlags.None;
flags |= this.IsIncrementOnly == false ? 0 : StatFlags.IncrementOnly;
flags |= ((this.Permission & 2) != 0) == false ? 0 : StatFlags.Protected;
flags |= ((this.Permission & ~2) != 0) == false ? 0 : StatFlags.UnknownPermission;
return flags.ToString();
}
}
}
}

View File

@@ -0,0 +1,30 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
namespace SAM.Game.Stats
{
internal class StatIsProtectedException : Exception
{
}
}