diff options
Diffstat (limited to 'DSACore/FireBase')
-rw-r--r-- | DSACore/FireBase/Database.cs | 13 |
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>(); } |