summaryrefslogtreecommitdiff
path: root/dsa/DSALib/Auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'dsa/DSALib/Auxiliary')
-rw-r--r--dsa/DSALib/Auxiliary/Calculator/Argument.cs15
-rw-r--r--dsa/DSALib/Auxiliary/Calculator/ISolvable.cs6
-rw-r--r--dsa/DSALib/Auxiliary/Calculator/Operator.cs18
-rw-r--r--dsa/DSALib/Auxiliary/Calculator/Ops.cs6
-rw-r--r--dsa/DSALib/Auxiliary/Calculator/StringSolver.cs60
-rw-r--r--dsa/DSALib/Auxiliary/CommandInfo.cs12
-rw-r--r--dsa/DSALib/Auxiliary/Dice.cs20
-rw-r--r--dsa/DSALib/Auxiliary/Extensions.cs12
-rw-r--r--dsa/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs22
-rw-r--r--dsa/DSALib/Auxiliary/RandomMisc.cs21
-rw-r--r--dsa/DSALib/Auxiliary/SpellCorrect.cs48
-rw-r--r--dsa/DSALib/Auxiliary/TalentEnumerableExtension.cs22
-rw-r--r--dsa/DSALib/Auxiliary/WeaponImporter.cs48
13 files changed, 111 insertions, 199 deletions
diff --git a/dsa/DSALib/Auxiliary/Calculator/Argument.cs b/dsa/DSALib/Auxiliary/Calculator/Argument.cs
index e681377..d6be0c8 100644
--- a/dsa/DSALib/Auxiliary/Calculator/Argument.cs
+++ b/dsa/DSALib/Auxiliary/Calculator/Argument.cs
@@ -1,16 +1,13 @@
using System;
-namespace DSALib.Auxiliary.Calculator
-{
+namespace DSALib.Auxiliary.Calculator {
/// <summary>
/// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int.
/// </summary>
- public class Argument : ISolvable
- {
+ public class Argument : ISolvable {
private readonly int value;
- public Argument(string value)
- {
+ public Argument(string value) {
// check whether the value given is an empty string
if (string.IsNullOrEmpty(value))
throw new ArgumentException("Argument kann nicht mit einem leeren string instanziert werden. ",
@@ -22,13 +19,11 @@ namespace DSALib.Auxiliary.Calculator
this.value = result;
}
- public int Solve()
- {
+ public int Solve() {
return value;
}
- public override string ToString()
- {
+ public override string ToString() {
return value.ToString();
}
}
diff --git a/dsa/DSALib/Auxiliary/Calculator/ISolvable.cs b/dsa/DSALib/Auxiliary/Calculator/ISolvable.cs
index 844e9b3..b2ea779 100644
--- a/dsa/DSALib/Auxiliary/Calculator/ISolvable.cs
+++ b/dsa/DSALib/Auxiliary/Calculator/ISolvable.cs
@@ -1,10 +1,8 @@
-namespace DSALib.Auxiliary.Calculator
-{
+namespace DSALib.Auxiliary.Calculator {
/// <summary>
/// Object has to be able to return an integer as it's value
/// </summary>
- public interface ISolvable
- {
+ public interface ISolvable {
int Solve();
}
} \ No newline at end of file
diff --git a/dsa/DSALib/Auxiliary/Calculator/Operator.cs b/dsa/DSALib/Auxiliary/Calculator/Operator.cs
index e6aeec6..f3d5c9f 100644
--- a/dsa/DSALib/Auxiliary/Calculator/Operator.cs
+++ b/dsa/DSALib/Auxiliary/Calculator/Operator.cs
@@ -1,17 +1,14 @@
using System;
using DSALibv.Auxiliary.Calculator;
-namespace DSALib.Auxiliary.Calculator
-{
+namespace DSALib.Auxiliary.Calculator {
/// <summary>
/// The Operator Class represents a binary operator with tow Arguments and an Operation type
/// </summary>
- public class Operator : ISolvable
- {
+ public class Operator : ISolvable {
private readonly ISolvable arg1, arg2;
- public Operator(ISolvable arg1, ISolvable arg2, Ops operatorType)
- {
+ public Operator(ISolvable arg1, ISolvable arg2, Ops operatorType) {
this.arg1 = arg1;
this.arg2 = arg2;
OperatorType = operatorType;
@@ -19,11 +16,9 @@ namespace DSALib.Auxiliary.Calculator
public Ops OperatorType { get; set; }
- public int Solve()
- {
+ public int Solve() {
int result;
- switch (OperatorType)
- {
+ switch (OperatorType) {
case Ops.Dice:
result = Dice.Roll(arg1.Solve(), arg2.Solve());
break;
@@ -43,8 +38,7 @@ namespace DSALib.Auxiliary.Calculator
return result;
}
- public override string ToString()
- {
+ public override string ToString() {
return $"({arg1} {OperatorType} {arg2})";
}
}
diff --git a/dsa/DSALib/Auxiliary/Calculator/Ops.cs b/dsa/DSALib/Auxiliary/Calculator/Ops.cs
index 93046d0..cf1a8e7 100644
--- a/dsa/DSALib/Auxiliary/Calculator/Ops.cs
+++ b/dsa/DSALib/Auxiliary/Calculator/Ops.cs
@@ -1,10 +1,8 @@
-namespace DSALibv.Auxiliary.Calculator
-{
+namespace DSALibv.Auxiliary.Calculator {
/// <summary>
/// The Different Operations, witch can be performed in execution-order
/// </summary>
- public enum Ops
- {
+ public enum Ops {
Dice,
Multiply,
Subtract,
diff --git a/dsa/DSALib/Auxiliary/Calculator/StringSolver.cs b/dsa/DSALib/Auxiliary/Calculator/StringSolver.cs
index 45d6a54..d46f8bc 100644
--- a/dsa/DSALib/Auxiliary/Calculator/StringSolver.cs
+++ b/dsa/DSALib/Auxiliary/Calculator/StringSolver.cs
@@ -3,24 +3,20 @@ using System.Collections.Generic;
using System.Linq;
using DSALibv.Auxiliary.Calculator;
-namespace DSALib.Auxiliary.Calculator
-{
+namespace DSALib.Auxiliary.Calculator {
/// <summary>
/// The StringSolver divides the calculation string into operations and SubStringSolvers if the string contains
/// parentheses
/// </summary>
- public class StringSolver : ISolvable
- {
+ public class StringSolver : ISolvable {
private readonly List<object> arguments = new List<object>();
private readonly string input;
- public StringSolver(string input)
- {
+ public StringSolver(string input) {
this.input = input;
}
- public int Solve()
- {
+ public int Solve() {
var workInput = "0+" + input.Replace(" ", string.Empty).ToLower();
workInput = ExpandParentheses(workInput);
@@ -34,8 +30,7 @@ namespace DSALib.Auxiliary.Calculator
return ((ISolvable) arguments.First()).Solve();
}
- public override string ToString()
- {
+ public override string ToString() {
return "(0+" + input.Replace(" ", string.Empty).ToLower() + ")";
}
@@ -43,23 +38,19 @@ namespace DSALib.Auxiliary.Calculator
GetInner(ref string input) // extract the inner bracket an remove the section from the input string
{
var depth = 0;
- for (var index = 1; index < input.Length; index++)
- {
+ for (var index = 1; index < input.Length; index++) {
var c = input[index];
- switch (c)
- {
+ switch (c) {
case '(':
depth++;
break;
case ')':
- if (depth == 0)
- {
+ if (depth == 0) {
var split = input.Substring(1, index - 1);
input = input.Substring(index + 1);
return split.Equals(string.Empty) ? "0" : split;
}
- else
- {
+ else {
depth--;
}
@@ -70,10 +61,8 @@ namespace DSALib.Auxiliary.Calculator
throw new ArgumentException("Invalid brace sequence");
}
- private static Ops GetOps(char c)
- {
- switch (c)
- {
+ private static Ops GetOps(char c) {
+ switch (c) {
case 'd':
case 'w':
return Ops.Dice;
@@ -101,14 +90,11 @@ namespace DSALib.Auxiliary.Calculator
return input;
}
- private void AtomizeOperations(string workInput)
- {
- for (var index = 0; index < workInput.Length; index++)
- {
+ private void AtomizeOperations(string workInput) {
+ for (var index = 0; index < workInput.Length; index++) {
var c = workInput[index];
- if (char.IsNumber(c))
- {
+ if (char.IsNumber(c)) {
// if char number, check if at end of string, else continue looping
if (index == workInput.Length - 1)
// if at end of string; add remaining number to arguments
@@ -117,8 +103,7 @@ namespace DSALib.Auxiliary.Calculator
continue;
}
- switch (c)
- {
+ switch (c) {
case ')':
throw new ArgumentException("Invalid brace sequence");
case '(':
@@ -136,12 +121,10 @@ namespace DSALib.Auxiliary.Calculator
}
}
- private void NestOperations()
- {
+ private void NestOperations() {
foreach (Ops currentOp in Enum.GetValues(typeof(Ops)))
// cycle through operators in operational order
- for (var index = 0; index < arguments.Count; index++)
- {
+ for (var index = 0; index < arguments.Count; index++) {
var arg = arguments[index];
if (arg.GetType() != typeof(Ops)) continue;
@@ -162,19 +145,16 @@ namespace DSALib.Auxiliary.Calculator
}
}
- private void HandleSpecialFormatting(ref int index, Ops op)
- {
+ private void HandleSpecialFormatting(ref int index, Ops op) {
var arg1 = arguments[index - 1];
- if (arg1.GetType() == typeof(Ops))
- {
+ if (arg1.GetType() == typeof(Ops)) {
if (op == Ops.Dice) arguments.Insert(index++, new Argument("1")); // w6 -> 1w6
if (op == Ops.Subtract) arguments.Insert(index++, new Argument("0")); // +-3 -> +0-3
}
var arg2 = arguments[index + 1]; // 3+-5 -> 3+(0-5)
- if (arg2.GetType() == typeof(Ops))
- {
+ if (arg2.GetType() == typeof(Ops)) {
arguments[index + 1] = new Operator(new Argument("0"), (ISolvable) arguments[index + 2], (Ops) arg2);
arguments.RemoveAt(index + 2);
}
diff --git a/dsa/DSALib/Auxiliary/CommandInfo.cs b/dsa/DSALib/Auxiliary/CommandInfo.cs
index d8e2188..80cc854 100644
--- a/dsa/DSALib/Auxiliary/CommandInfo.cs
+++ b/dsa/DSALib/Auxiliary/CommandInfo.cs
@@ -1,11 +1,8 @@
using System.Linq;
-namespace DSALib.Auxiliary
-{
- public struct CommandInfo
- {
- public CommandInfo(string name, string brief, string[] description, string scope)
- {
+namespace DSALib.Auxiliary {
+ public struct CommandInfo {
+ public CommandInfo(string name, string brief, string[] description, string scope) {
Name = name;
Scope = scope;
Brief = brief;
@@ -20,8 +17,7 @@ namespace DSALib.Auxiliary
public string[] Description { get; }
- public string GetDescription()
- {
+ public string GetDescription() {
return Description.Aggregate((s, c) => s + c);
}
}
diff --git a/dsa/DSALib/Auxiliary/Dice.cs b/dsa/DSALib/Auxiliary/Dice.cs
index 0bfabeb..36a4748 100644
--- a/dsa/DSALib/Auxiliary/Dice.cs
+++ b/dsa/DSALib/Auxiliary/Dice.cs
@@ -1,24 +1,22 @@
using System;
using System.Linq;
-namespace DSALib.Auxiliary
-{
+namespace DSALib.Auxiliary {
public static class Dice // roll it!
{
private static readonly Random Rnd = new Random();
- public static int Roll(int d = 20)
- {
+ public static int Roll(int d = 20) {
return Rnd.Next(d) + 1;
}
- public static int Roll(string input)
- {
+ public static int Roll(string input) {
var strings = input.ToLower().Split(new[] {'w', 'd'}, 2, StringSplitOptions.RemoveEmptyEntries).ToList();
-
+
if (strings.Count != 2)
- throw new ArgumentException($"{input}: does not satisfy the format requirements( dice count (d|w) die size)");
+ throw new ArgumentException(
+ $"{input}: does not satisfy the format requirements( dice count (d|w) die size)");
var count = Convert.ToInt32(strings[0]);
var d = Convert.ToInt32(strings[0]);
@@ -26,13 +24,11 @@ namespace DSALib.Auxiliary
return Roll(count, d);
}
- public static int Roll(int count, int d)
- {
+ public static int Roll(int count, int d) {
if (d <= 0 || count <= 0) return 0;
var sum = 0;
- for (var i = 0; i < Math.Abs(count); i++)
- {
+ for (var i = 0; i < Math.Abs(count); i++) {
var roll = Roll(d);
sum += roll;
}
diff --git a/dsa/DSALib/Auxiliary/Extensions.cs b/dsa/DSALib/Auxiliary/Extensions.cs
index 7d367a5..b4fde67 100644
--- a/dsa/DSALib/Auxiliary/Extensions.cs
+++ b/dsa/DSALib/Auxiliary/Extensions.cs
@@ -1,11 +1,8 @@
-namespace DSALib.Auxiliary
-{
- public static class StringExtension
- {
+namespace DSALib.Auxiliary {
+ public static class StringExtension {
//This mehod extends string. It adds spaces until a fixed length is reached.
//If the original string is already longer, it is returner unmodified.
- public static string AddSpaces(this string str, int length)
- {
+ public static string AddSpaces(this string str, int length) {
var temp = str;
for (var i = str.Length; i < length; i++) temp += " ";
return temp;
@@ -15,8 +12,7 @@
//This mehod extends string.
//It adds spaces at the HEAD of a string until a fixed length is reached.
//If the original string is already longer, it is returner unmodified.
- public static string AddSpacesAtHead(this string str, int length)
- {
+ public static string AddSpacesAtHead(this string str, int length) {
var temp = "";
for (var i = str.Length; i < length; i++) temp += " ";
return temp + str;
diff --git a/dsa/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs b/dsa/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs
index b8a6067..d695baf 100644
--- a/dsa/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs
+++ b/dsa/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs
@@ -1,25 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
using DSALib.Auxiliary;
using DSALib.Models.Database;
-namespace DSACore.Auxiliary
-{
- public static class DataObjectEnumerableExtension
- {
- public static IDataObject Match(this IEnumerable<IDataObject> dataObjects, string name)
- {
- return (dataObjects as IOrderedEnumerable<IDataObject> ?? throw new InvalidOperationException()).OrderBy(x => SpellCorrect.Compare(name,x.Name)).Last();
+namespace DSACore.Auxiliary {
+ public static class DataObjectEnumerableExtension {
+ public static IDataObject Match(this IEnumerable<IDataObject> dataObjects, string name) {
+ return (dataObjects as IOrderedEnumerable<IDataObject> ?? throw new InvalidOperationException())
+ .OrderBy(x => SpellCorrect.Compare(name, x.Name)).Last();
}
- public static bool TryMatch(this IEnumerable<IDataObject> dataObjects,out IDataObject data, string name)
- {
- data = (dataObjects as IOrderedEnumerable<IDataObject> ?? throw new InvalidOperationException()).OrderBy(x => SpellCorrect.Compare(name,x.Name)).Last();
+ public static bool TryMatch(this IEnumerable<IDataObject> dataObjects, out IDataObject data, string name) {
+ data = (dataObjects as IOrderedEnumerable<IDataObject> ?? throw new InvalidOperationException())
+ .OrderBy(x => SpellCorrect.Compare(name, x.Name)).Last();
return SpellCorrect.IsMatch(name, data.Name);
}
}
-}
+} \ No newline at end of file
diff --git a/dsa/DSALib/Auxiliary/RandomMisc.cs b/dsa/DSALib/Auxiliary/RandomMisc.cs
index 2723930..f78a25d 100644
--- a/dsa/DSALib/Auxiliary/RandomMisc.cs
+++ b/dsa/DSALib/Auxiliary/RandomMisc.cs
@@ -2,35 +2,29 @@
using System.Linq;
using System.Text;
-namespace DSALib.Auxiliary
-{
- public static class RandomMisc
- {
+namespace DSALib.Auxiliary {
+ public static class RandomMisc {
private static readonly Random Rand = new Random();
// use: 4w6 +4
- public static string Roll(string input)
- {
+ public static string Roll(string input) {
var output = new StringBuilder();
var strings = input.Split('w', 'd').ToList();
var count = Convert.ToInt32(strings[0]);
strings = strings[1].Split(' ').ToList();
var d = Convert.ToInt32(strings[0]);
- if (strings.Count > 0)
- {
+ if (strings.Count > 0) {
}
var sum = 0;
- for (var i = 0; i < count; i++)
- {
+ for (var i = 0; i < count; i++) {
var roll = Dice.Roll(d);
sum += roll;
output.Append("[" + roll + "] ");
}
- if (strings.Count > 1)
- {
+ if (strings.Count > 1) {
sum += Convert.ToInt32(strings[1]);
output.Append("sum: " + sum);
}
@@ -38,8 +32,7 @@ namespace DSALib.Auxiliary
return output.ToString();
}
- public static double Random(double stdDev = 1, double mean = 0)
- {
+ public static double Random(double stdDev = 1, double mean = 0) {
var u1 = Rand.NextDouble(); // uniform(0,1) random doubles
var u2 = Rand.NextDouble();
var randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) *
diff --git a/dsa/DSALib/Auxiliary/SpellCorrect.cs b/dsa/DSALib/Auxiliary/SpellCorrect.cs
index 79908c4..3b98942 100644
--- a/dsa/DSALib/Auxiliary/SpellCorrect.cs
+++ b/dsa/DSALib/Auxiliary/SpellCorrect.cs
@@ -1,21 +1,16 @@
-using System;
-
-namespace DSALib.Auxiliary
-{
- public class SpellCorrect
- {
- public const double ErrorThreshold = 1 / 3.0;
+namespace DSALib.Auxiliary {
+ public class SpellCorrect {
+ public const double ErrorThreshold = 1 / 3.0;
private const double Match = 3.0;
private const double Gap = -1.5;
private const double Mismatch = -2.0;
- public static double Compare(string s, string q)
- {
+ public static double Compare(string s, string q) {
s = s.ToLower();
q = q.ToLower();
int i, j;
-
+
var matrix = new double[s.Length + 1, q.Length + 1];
var max = 0.0;
matrix[0, 0] = 0.0;
@@ -27,33 +22,30 @@ namespace DSALib.Auxiliary
for (i = 1; i <= s.Length; i++)
- for (j = 1; j <= q.Length; j++)
- {
- double decay = j / (s.Length * 1000.0);
- var add = s[i - 1] == q[j - 1] ? Match - decay : Mismatch;
- var score = matrix[i - 1, j - 1] + add;
+ for (j = 1; j <= q.Length; j++) {
+ var decay = j / (s.Length * 1000.0);
+ var add = s[i - 1] == q[j - 1] ? Match - decay : Mismatch;
+ var score = matrix[i - 1, j - 1] + add;
- if (score < matrix[i - 1, j] + Gap) score = matrix[i - 1, j] + Gap;
+ if (score < matrix[i - 1, j] + Gap) score = matrix[i - 1, j] + Gap;
- if (score < matrix[i, j - 1] + Gap) score = matrix[i, j - 1] + Gap;
+ if (score < matrix[i, j - 1] + Gap) score = matrix[i, j - 1] + Gap;
- if (i > 1 && j > 1)
- if (s[i - 1] == q[j - 2] && s[i - 2] == q[j - 1])
- {
- add = 3 / 2.0 * Match - decay;
- if (score < matrix[i - 2, j - 2] + add) score = matrix[i - 2, j - 2] + add;
- }
+ if (i > 1 && j > 1)
+ if (s[i - 1] == q[j - 2] && s[i - 2] == q[j - 1]) {
+ add = 3 / 2.0 * Match - decay;
+ if (score < matrix[i - 2, j - 2] + add) score = matrix[i - 2, j - 2] + add;
+ }
- if (max < score && i == s.Length) max = score;
+ if (max < score && i == s.Length) max = score;
- matrix[i, j] = score;
- }
+ matrix[i, j] = score;
+ }
return max;
}
- public static bool IsMatch(string s1, string s2)
- {
+ public static bool IsMatch(string s1, string s2) {
var score = Compare(s1, s2);
return score > ErrorThreshold * s1.Length;
}
diff --git a/dsa/DSALib/Auxiliary/TalentEnumerableExtension.cs b/dsa/DSALib/Auxiliary/TalentEnumerableExtension.cs
index 6ec7fcc..fd2895b 100644
--- a/dsa/DSALib/Auxiliary/TalentEnumerableExtension.cs
+++ b/dsa/DSALib/Auxiliary/TalentEnumerableExtension.cs
@@ -5,12 +5,10 @@ using DSACore.Auxiliary;
using DSALib.DSA_Game.Characters;
using DSALib.Models.Dsa;
-namespace DSALib.Auxiliary
-{
- public static class TalentEnumerableExtension
- {
- public static string ProbenTest(this IEnumerable<Talent> List, Character c, string talentName, int erschwernis = 0)
- {
+namespace DSALib.Auxiliary {
+ public static class TalentEnumerableExtension {
+ public static string ProbenTest(this IEnumerable<Talent> List, Character c, string talentName,
+ int erschwernis = 0) {
var output = new StringBuilder();
var sc = new SpellCorrect();
@@ -34,11 +32,9 @@ namespace DSALib.Auxiliary
output.Append(" ");
tap -= erschwernis;
var gesamtErschwernis = tap;
- if (gesamtErschwernis < 0)
- {
+ if (gesamtErschwernis < 0) {
tap = 0;
- for (var i = 0; i <= 2; i++)
- {
+ for (var i = 0; i <= 2; i++) {
// foreach property, dice and tap
var temp = Dice.Roll();
var eigenschaft = c.Eigenschaften[c.PropTable[props[i]]];
@@ -50,10 +46,8 @@ namespace DSALib.Auxiliary
if (tap >= 0) tap = 1;
}
- else
- {
- for (var i = 0; i <= 2; i++)
- {
+ else {
+ for (var i = 0; i <= 2; i++) {
// foreach property, dice and tap
var temp = Dice.Roll();
var eigenschaft = c.Eigenschaften[c.PropTable[props[i]]];
diff --git a/dsa/DSALib/Auxiliary/WeaponImporter.cs b/dsa/DSALib/Auxiliary/WeaponImporter.cs
index 61eb33e..a3e7582 100644
--- a/dsa/DSALib/Auxiliary/WeaponImporter.cs
+++ b/dsa/DSALib/Auxiliary/WeaponImporter.cs
@@ -7,20 +7,16 @@ using System.Threading.Tasks;
using DSALib.FireBase;
using DSALib.Models.Database.Dsa;
-namespace DSALib.Auxiliary
-{
- public class WeaponImporter
- {
+namespace DSALib.Auxiliary {
+ public class WeaponImporter {
private readonly List<RangedWeapon> Range = new List<RangedWeapon>();
private readonly List<MeleeWeapon> Weapons = new List<MeleeWeapon>();
- public async Task DownloadWeapons()
- {
+ public async Task DownloadWeapons() {
var client = new HttpClient();
- for (var i = 1; i <= 25; i++)
- {
+ for (var i = 1; i <= 25; i++) {
var responseString =
await client.GetStringAsync("http://diarium.eu/dsa4-forge/ajax/categoryChanged/" + i);
@@ -35,15 +31,13 @@ namespace DSALib.Auxiliary
var ids = new List<int>();
foreach (var matchGroup in talentMatch.ToList())
- if (matchGroup.Success)
- {
+ if (matchGroup.Success) {
lines.Add(matchGroup.Groups[3].Value);
ids.Add(int.Parse(matchGroup.Groups[1].Value));
}
- for (var j = 0; j < lines.Count; j++)
- {
+ for (var j = 0; j < lines.Count; j++) {
var talent = lines[j];
var values = await client.GetStringAsync("http://diarium.eu/dsa4-forge/ajax/calculate/" + i + "/" +
@@ -71,18 +65,15 @@ namespace DSALib.Auxiliary
Console.ReadLine();
}
- private async Task AddMelee(int i, string talent, List<string> matches)
- {
+ private async Task AddMelee(int i, string talent, List<string> matches) {
var name = talent.Replace(' ', '_').Replace(".", "");
- if (!matches[1].Equals(string.Empty))
- {
+ if (!matches[1].Equals(string.Empty)) {
var temp = new MeleeWeapon(
name,
matches[1],
int.TryParse(matches[10], out var weight) ? weight : 0,
matches[0].Split(':', StringSplitOptions.RemoveEmptyEntries).First(),
- matches[11])
- {
+ matches[11]) {
INI = int.TryParse(matches[3], out var ini) ? ini : 0,
MW = matches[4],
TpKK = matches[2]
@@ -111,15 +102,13 @@ namespace DSALib.Auxiliary
await Database.AddWeapon(range);
return;
}*/
- if (i > 18)
- {
+ if (i > 18) {
var range = new RangedWeapon(
name,
matches[13].Replace(' ', '+'),
int.TryParse(matches[10], out var weight) ? weight : 0,
matches[0].Split(':', StringSplitOptions.RemoveEmptyEntries).First(),
- matches[11])
- {
+ matches[11]) {
AtMod = int.TryParse(matches[18], out var atMod) ? atMod : 0,
KKMod = int.TryParse(matches[17], out var kkMod) ? kkMod : 0,
AtReach = matches[14],
@@ -131,18 +120,15 @@ namespace DSALib.Auxiliary
}
}
- private async Task AddRanged(int i, string talent, List<string> matches)
- {
+ private async Task AddRanged(int i, string talent, List<string> matches) {
var name = talent.Replace(' ', '_').Replace(".", "");
- if (!matches[1].Equals(string.Empty))
- {
+ if (!matches[1].Equals(string.Empty)) {
var temp = new MeleeWeapon(
name,
matches[1],
int.TryParse(matches[10], out var weight) ? weight : 0,
matches[0].Split(':', StringSplitOptions.RemoveEmptyEntries).First(),
- matches[11])
- {
+ matches[11]) {
INI = int.TryParse(matches[3], out var ini) ? ini : 0,
MW = matches[4],
TpKK = matches[2]
@@ -152,15 +138,13 @@ namespace DSALib.Auxiliary
await Database.AddWeapon(temp);
}
- if (i > 18)
- {
+ if (i > 18) {
var range = new RangedWeapon(
name,
matches[13].Replace(' ', '+'),
int.TryParse(matches[10], out var weight) ? weight : 0,
matches[0].Split(':', StringSplitOptions.RemoveEmptyEntries).First(),
- matches[11])
- {
+ matches[11]) {
AtMod = int.TryParse(matches[18], out var atMod) ? atMod : 0,
KKMod = int.TryParse(matches[17], out var kkMod) ? kkMod : 0,
AtReach = matches[14],