summaryrefslogtreecommitdiff
path: root/DSACore/FireBase/Database.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-10-01 02:28:42 +0200
committerTrueDoctor <d-kobert@web.de>2018-10-01 02:28:42 +0200
commit6285967d1cf6e9322f584de761eea31ade32b3e5 (patch)
tree2f2227e85c18011d5122924e56ecde00e2f47ec8 /DSACore/FireBase/Database.cs
parent560f454c9beb2f691730b126fc6b3e23d68d6681 (diff)
Completed Weapon import function to automagically load data from an dsa website into the database
Diffstat (limited to 'DSACore/FireBase/Database.cs')
-rw-r--r--DSACore/FireBase/Database.cs13
1 files changed, 8 insertions, 5 deletions
diff --git a/DSACore/FireBase/Database.cs b/DSACore/FireBase/Database.cs
index 02a4741..12ebb89 100644
--- a/DSACore/FireBase/Database.cs
+++ b/DSACore/FireBase/Database.cs
@@ -154,24 +154,27 @@ namespace DSACore.FireBase
public static async Task AddWeapon(Weapon wep)
{
+ string collection = wep.GetType() == typeof(MeleeWeapon) ? "MeleeWeapons" : "RangedWeapons";
await firebase
- .Child("Weapons")
+ .Child(collection)
.Child(wep.Name)
.PutAsync(wep);
}
- public static async Task RemoveWeapon(string weapon)
+ public static async Task RemoveWeapon(string weapon, bool ranged = false)
{
+ string collection = ranged ? "RangedWeapons" : "MeleeWeapons";
await firebase
- .Child("Weapons")
+ .Child(collection)
.Child(weapon)
.DeleteAsync();
}
- public static async Task< Weapon> GetWeapon(string weapon)
+ public static async Task< Weapon> GetWeapon(string weapon, bool ranged = false)
{
+ string collection = ranged ? "RangedWeapons" : "MeleeWeapons";
return await firebase
- .Child("Weapons")
+ .Child(collection)
.Child(weapon)
.OnceSingleAsync<Weapon>();
}