diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 6609b2ed1..fc1ffc9fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -212,4 +212,34 @@ public class DonationManager extends MiniPlugin //Clean _gemQueue.clear(); } + + public void RewardCoins(final Callback callback, final String caller, final String name, final int amount) + { + RewardCoins(callback, caller, name, amount, true); + } + + public void RewardCoins(final Callback callback, final String caller, final String name, final int amount, final boolean updateTotal) + { + _repository.rewardCoins(new Callback() + { + public void run(Boolean success) + { + if (success) + { + if (updateTotal) + { + Donor donor = Get(name); + + if (donor != null) + { + donor.addCoins(amount); + } + } + + if (callback != null) + callback.run(true); + } + } + }, caller, name, amount); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java index 915d144e3..6678de58e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/Donor.java @@ -133,4 +133,9 @@ public class Donor { return _coins; } + + public void addCoins(int amount) + { + _coins += amount; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index 413e7b041..3eb91a8a5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -46,4 +46,13 @@ public class DonationRepository token.Amount = greenGems; new AsyncJsonWebCall(_webAddress + "PlayerAccount/GemReward").Execute(Boolean.class, callback, token); } + + public void rewardCoins(Callback callback, String giver, String name, int coins) + { + GemRewardToken token = new GemRewardToken(); + token.Source = giver; + token.Name = name; + token.Amount = coins; + new AsyncJsonWebCall(_webAddress + "PlayerAccount/CoinReward").Execute(Boolean.class, callback, token); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d79081a44..ad7f40c25 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,6 +1,7 @@ package mineplex.core.gadget; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.List; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -41,7 +42,7 @@ public class GadgetManager extends MiniPlugin private DisguiseManager _disguiseManager; private BlockRestore _blockRestore; - private NautHashMap> _gadgets; + private NautHashMap> _gadgets; private NautHashMap _lastMove = new NautHashMap(); private NautHashMap> _playerActiveGadgetMap = new NautHashMap>(); @@ -64,7 +65,7 @@ public class GadgetManager extends MiniPlugin private void CreateGadgets() { - _gadgets = new NautHashMap>(); + _gadgets = new NautHashMap>(); // Items addGadget(new ItemPaintballGun(this)); @@ -80,18 +81,18 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphChicken(this)); // Particles + addGadget(new ParticleGreen(this)); + addGadget(new ParticleFoot(this)); + addGadget(new ParticleEnchant(this)); addGadget(new ParticleFireRings(this)); addGadget(new ParticleRain(this)); addGadget(new ParticleHelix(this)); - addGadget(new ParticleEnchant(this)); - addGadget(new ParticleGreen(this)); - addGadget(new ParticleFoot(this)); } private void addGadget(Gadget gadget) { if (!_gadgets.containsKey(gadget.getGadgetType())) - _gadgets.put(gadget.getGadgetType(), new HashSet()); + _gadgets.put(gadget.getGadgetType(), new ArrayList()); _gadgets.get(gadget.getGadgetType()).add(gadget); } @@ -111,7 +112,7 @@ public class GadgetManager extends MiniPlugin } } - public HashSet getGadgets(GadgetType gadgetType) + public List getGadgets(GadgetType gadgetType) { return _gadgets.get(gadgetType); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java index a54406361..fff32e67d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java @@ -20,6 +20,7 @@ import mineplex.core.inventory.ui.button.ActivateGadgetButton; import mineplex.core.inventory.ui.button.DeactivateGadgetButton; import mineplex.core.inventory.ui.button.GadgetButton; import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; @@ -48,6 +49,15 @@ public class GadgetPage extends ShopPageBase if (slot == 26) slot = 28; } + + AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton() + { + @Override + public void Clicked(Player player) + { + Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); + } + }); } protected void addGadget(Gadget gadget, int slot) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java index bf0da3cda..ba2184aff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java @@ -65,7 +65,7 @@ public class Menu extends ShopPageBase if (Plugin.getPetManager().hasActivePet(Player.getName())) { - AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), "Deactivate " + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager())); + AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), F.item(Plugin.getPetManager().getActivePet(Player.getName()).getCustomName()), new String[] {}, 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager())); } if (Plugin.getMountManager().getActive(Player) != null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MorphPage.java index ff3f7bbc5..d45565259 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MorphPage.java @@ -1,13 +1,17 @@ package mineplex.core.inventory.ui.page; +import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.ui.InventoryShop; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.item.SingleButton; public class MorphPage extends GadgetPage { @@ -33,5 +37,14 @@ public class MorphPage extends GadgetPage if (slot == 26) slot = 28; } + + AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton() + { + @Override + public void Clicked(Player player) + { + Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); + } + }); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java index e6cb55861..11df3849e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; @@ -17,6 +18,7 @@ import mineplex.core.inventory.ui.button.DeactivateMountButton; import mineplex.core.inventory.ui.button.MountButton; import mineplex.core.mount.Mount; import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; @@ -47,9 +49,9 @@ public class MountPage extends ShopPageBase { List itemLore = new ArrayList(); - if (mount.GetCost(CurrencyType.Gems) != -1) + if (mount.GetCost(CurrencyType.Coins) != -1) { - itemLore.add(C.cYellow + mount.GetCost(CurrencyType.Gems) + " Gems"); + itemLore.add(C.cYellow + mount.GetCost(CurrencyType.Coins) + " Coins"); } itemLore.add(C.cBlack); @@ -68,11 +70,20 @@ public class MountPage extends ShopPageBase } else { - if (mount.GetCost(CurrencyType.Gems) != -1 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Gems) >= mount.GetCost(CurrencyType.Gems)) + if (mount.GetCost(CurrencyType.Coins) != -1 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins)) AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Purchase " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this)); else setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Purchase " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); - } + } + + AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton() + { + @Override + public void Clicked(Player player) + { + Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); + } + }); } public void purchaseMount(final Player player, final Mount _mount) @@ -83,7 +94,7 @@ public class MountPage extends ShopPageBase { Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); } - }, null, _mount, CurrencyType.Gems, Player)); + }, null, _mount, CurrencyType.Coins, Player)); } public void activateMount(Player player, Mount _mount) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/ParticlePage.java index 7ec4ca330..da1735305 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/ParticlePage.java @@ -1,14 +1,18 @@ package mineplex.core.inventory.ui.page; +import org.bukkit.Material; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.ui.InventoryShop; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.item.SingleButton; public class ParticlePage extends GadgetPage { @@ -34,5 +38,14 @@ public class ParticlePage extends GadgetPage if (slot == 26) slot = 28; } + + AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton() + { + @Override + public void Clicked(Player player) + { + Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); + } + }); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetPage.java index 31ae0eb50..ecc0d6eca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetPage.java @@ -28,6 +28,7 @@ import mineplex.core.inventory.ui.button.RenamePetButton; import mineplex.core.pet.Pet; import mineplex.core.pet.PetExtra; import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.item.SingleButton; import mineplex.core.shop.page.AnvilContainer; import mineplex.core.shop.page.ShopPageBase; @@ -52,7 +53,7 @@ public class PetPage extends ShopPageBase { List itemLore = new ArrayList(); - itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Gems) + " Coins"); + itemLore.add(C.cYellow + pet.GetCost(CurrencyType.Coins) + " Coins"); itemLore.add(C.cBlack); if (DonationManager.Get(Player.getName()).OwnsUnknownPackage(pet.GetPetName())) @@ -99,6 +100,15 @@ public class PetPage extends ShopPageBase slot++; } + + AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton() + { + @Override + public void Clicked(Player player) + { + Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player)); + } + }); } public void purchasePet(final Player player, final Pet pet) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java index 2181f8ac5..d0144c045 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java @@ -100,7 +100,7 @@ public class PetTagPage extends ShopPageBase Player.closeInventory(); } - }, null, _petPurchase ? _pet : tag, CurrencyType.Gems, Player)); + }, null, _petPurchase ? _pet : tag, CurrencyType.Coins, Player)); } public void SetTagName(String tagName) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index 36598771b..ad4f01280 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -20,9 +20,9 @@ public abstract class Mount extends SalesPackageBase implements Listener public MountManager Manager; - public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int gems) + public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins) { - super(name, material, displayData, description, gems); + super(name, material, displayData, description, coins); Manager = manager; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 5ea5416c4..eacfe7020 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -1,6 +1,7 @@ package mineplex.core.mount; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.List; import org.bukkit.Material; import org.bukkit.entity.Horse; @@ -26,7 +27,7 @@ public class MountManager extends MiniPlugin private DonationManager _donationManager; private BlockRestore _blockRestore; - private HashSet> _types; + private List> _types; private NautHashMap> _playerActiveMountMap = new NautHashMap>(); public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore) @@ -42,7 +43,7 @@ public class MountManager extends MiniPlugin private void CreateGadgets() { - _types = new HashSet>(); + _types = new ArrayList>(); _types.add(new Undead(this)); _types.add(new Frost(this)); @@ -50,7 +51,7 @@ public class MountManager extends MiniPlugin _types.add(new Dragon(this)); } - public HashSet> getMounts() + public List> getMounts() { return _types; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index f29805f4b..e0800c516 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -20,7 +20,7 @@ public class Pet extends SalesPackageBase _name = name; _petType = petType; - CurrencyCostMap.put(CurrencyType.Gems, cost); + CurrencyCostMap.put(CurrencyType.Coins, cost); KnownPackage = false; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java index 460800817..17844cf8b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -35,7 +35,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack this(name, material, (byte)0, description, -1); } - public SalesPackageBase(String name, Material material, byte displayData, String[] description, int gems) + public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins) { CurrencyCostMap = new NautHashMap(); @@ -45,7 +45,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack _displayMaterial = material; _displayData = displayData; - CurrencyCostMap.put(CurrencyType.Gems, gems); + CurrencyCostMap.put(CurrencyType.Coins, coins); } public abstract void Sold(Player player, CurrencyType currencyType); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index 274c08232..e0efb3eee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -15,11 +15,11 @@ import mineplex.core.database.column.ColumnVarChar; public class StatsRepository extends RepositoryBase { - private static String CREATE_STAT_TABLE = "CREATE TABLE IF NOT EXISTS stats (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), INDEX nameIndex (name));"; + private static String CREATE_STAT_TABLE = "CREATE TABLE IF NOT EXISTS stats (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));"; private static String CREATE_STAT_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountStats (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, statId INT NOT NULL, value INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (statId) REFERENCES stats(id), UNIQUE INDEX accountStatIndex (accountId, statId));"; private static String RETRIEVE_PLAYER_STATS = "SELECT stats.name, value FROM accountStats INNER JOIN stats ON stats.id = accountStats.statId INNER JOIN accounts ON accountStats.accountId = accounts.id WHERE accounts.uuid = ?;"; - private static String INSERT_PLAYER_STAT = "INSERT INTO accountStats (accountId, statId, value) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.uuid = ? ON DUPLICATE KEY UPDATE value=VALUES(value);"; + private static String INSERT_PLAYER_STAT = "INSERT INTO accountStats (accountId, statId, value) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.uuid = ? ON DUPLICATE KEY UPDATE value= value + VALUES(value);"; private static String RETRIEVE_STATS = "SELECT id, name FROM stats;"; private static String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);"; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java index 876bdb71f..1138fe4a9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubClient.java @@ -23,6 +23,8 @@ public class HubClient private int _lastGemCount = 0; + private int _lastCoinCount = 0; + public HubClient(String name) { ScoreboardString = " Welcome " + name + ", to the Mineplex Network!"; @@ -131,4 +133,14 @@ public class HubClient return display; } + + public void SetLastCoinCount(int coins) + { + _lastCoinCount = coins; + } + + public int GetLastCoinCount() + { + return _lastCoinCount; + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 2364af280..1fef44f58 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -721,6 +721,18 @@ public class HubManager extends MiniClientPlugin //Space obj.getScore(" ").setScore(line--); + obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--); + + // Remove Old + player.getScoreboard().resetScores(Get(player.getName()).GetLastCoinCount() + ""); + // Add New + obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--); + + Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins()); + + //Space + obj.getScore(" ").setScore(line--); + /* //News obj.getScore(C.cGray + C.Bold + "Latest News")).setScore(line--); @@ -735,7 +747,7 @@ public class HubManager extends MiniClientPlugin obj.getScore(Get(player).BestPig).setScore(line--); //Space - obj.getScore(" ").setScore(line--); + obj.getScore(" ").setScore(line--); //Display Rank if (GetClients().Get(player).GetRank().Has(Rank.HERO)) @@ -763,33 +775,10 @@ public class HubManager extends MiniClientPlugin //Space obj.getScore(" ").setScore(line--); - //Display Staff - obj.getScore(C.cGold + C.Bold + "Online Staff").setScore(line--); - String staff = ""; - for (Player other : UtilServer.getPlayers()) - { - Rank rank = GetClients().Get(other).GetRank(); - - if (!rank.Has(Rank.HELPER)) - continue; - - staff += other.getName() + " "; - } - if (staff.length() == 0) - staff = "None"; - - player.getScoreboard().resetScores(Get(player).GetStaffText(false)); - Get(player).StaffString = staff; - obj.getScore(Get(player).GetStaffText(true)).setScore(line--); - - //Space - obj.getScore(" ").setScore(line--); - //Website obj.getScore(C.cYellow + C.Bold + "Website").setScore(line--); obj.getScore("www.mineplex.com").setScore(line--); obj.getScore("----------------").setScore(line--); - } } diff --git a/Website/LOC.Core/LOC.Core.csproj b/Website/LOC.Core/LOC.Core.csproj index ade66c6d2..3b92112f2 100644 --- a/Website/LOC.Core/LOC.Core.csproj +++ b/Website/LOC.Core/LOC.Core.csproj @@ -69,6 +69,7 @@ + diff --git a/Website/LOC.Core/Model/Sales/CoinTransaction.cs b/Website/LOC.Core/Model/Sales/CoinTransaction.cs new file mode 100644 index 000000000..273d375cb --- /dev/null +++ b/Website/LOC.Core/Model/Sales/CoinTransaction.cs @@ -0,0 +1,13 @@ +namespace LOC.Core.Model.Sales +{ + public class CoinTransaction + { + public int CoinTransactionId { get; set; } + + public Account.Account Account { get; set; } + + public string Source { get; set; } + + public int Amount { get; set; } + } +} diff --git a/Website/LOC.Website.Common/Contexts/LOCContext.cs b/Website/LOC.Website.Common/Contexts/LOCContext.cs index fbc28e178..d3d367e1a 100644 --- a/Website/LOC.Website.Common/Contexts/LOCContext.cs +++ b/Website/LOC.Website.Common/Contexts/LOCContext.cs @@ -43,6 +43,7 @@ namespace LOC.Website.Common.Contexts public DbSet CaptureThePigPlayerStats { get; set; } public DbSet GemTransactions { get; set; } + public DbSet CoinTransactions { get; set; } public DbSet MineKarts { get; set; } diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs index 83a4c7760..9d6952f01 100644 --- a/Website/LOC.Website.Common/Models/AccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -220,6 +220,37 @@ return true; } + public bool CoinReward(GemRewardToken token) + { + using (var repository = _repositoryFactory.CreateRepository()) + { + var account = repository.Where(x => x.Name == token.Name).FirstOrDefault(); + account.LoadNavigationProperties(repository.Context); + + if (account == null) + return false; + + account.Coins += token.Amount; + + if (!token.Source.Contains("Earned") && !token.Source.Contains("Tutorial") && !token.Source.Contains("Parkour")) + { + var coinTransaction = new CoinTransaction + { + Source = token.Source, + Account = account, + Amount = token.Amount + }; + + repository.Add(coinTransaction); + } + + repository.Edit(account); + repository.CommitChanges(); + } + + return true; + } + public void AddTask(UpdateTaskToken token) { using (var repository = _repositoryFactory.CreateRepository()) diff --git a/Website/LOC.Website.Common/Models/IAccountAdministrator.cs b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs index 5446062af..a6a146ef0 100644 --- a/Website/LOC.Website.Common/Models/IAccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/IAccountAdministrator.cs @@ -36,5 +36,7 @@ void AddTask(UpdateTaskToken token); void UpdateAccountUUIDs(List tokens); + + bool CoinReward(GemRewardToken token); } } diff --git a/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs b/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs index 3bcd7e11d..e24fe93e5 100644 --- a/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs +++ b/Website/LOC.Website.Web/Controllers/PlayerAccountController.cs @@ -153,6 +153,13 @@ return Content(json, "application/json"); } + [HttpPost] + public ActionResult CoinReward(GemRewardToken token) + { + var json = JsonConvert.SerializeObject(_accountAdministrator.CoinReward(token)); + return Content(json, "application/json"); + } + [HttpPost] public ActionResult RankUpdate(RankUpdateToken token) { diff --git a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml index c87a6e316..c039de9b0 100644 --- a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml +++ b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml @@ -1,13 +1,11 @@  - - @@ -20,18 +18,14 @@ - - + - - - @@ -48,23 +42,23 @@ + - - - + - + + @@ -75,31 +69,32 @@ - - + - + + + + + + - - - - + @@ -107,42 +102,41 @@ - + + + - + - + - - + + - - - + - - + @@ -153,26 +147,32 @@ - + - + + + + + + - + + @@ -180,20 +180,19 @@ - - + - + + - @@ -203,73 +202,74 @@ - - + + - - + + - + - - + + + - + - + - - + - + - + - - + + - + - - + + - - + + - + + - + @@ -280,38 +280,42 @@ - + + + + + - + - + - + + - - + @@ -320,9 +324,7 @@ - - @@ -333,32 +335,28 @@ + - - - + + - - - + - - @@ -366,17 +364,18 @@ - + - + + + - @@ -384,21 +383,23 @@ - - + + + - + + - + @@ -409,64 +410,61 @@ - + - - - - + - - + - - - + - + - + - + + - + + + - + @@ -474,65 +472,67 @@ - - + + - + - + - + + - + - + + - - + + - - + + - + - - - - - + + + + + - + - + @@ -545,48 +545,48 @@ - + + + - + - + - + - - - + - + + - @@ -597,22 +597,22 @@ + - - + + - - + @@ -620,25 +620,25 @@ - + - - + + + - + - @@ -646,22 +646,23 @@ - - + - + - + + + - + @@ -672,34 +673,30 @@ - + - - - - + - - + - + - + + - @@ -707,29 +704,30 @@ - + - + - + - - + + + - + @@ -737,65 +735,67 @@ - - + + - + - - - + + + + - + - + - + + - - + + - - + + - + - - - - - + + + + + - + - + @@ -808,38 +808,38 @@ - + + + - + - + - + - - - + @@ -848,8 +848,8 @@ + - @@ -860,22 +860,22 @@ + - - + + - - + @@ -883,7 +883,7 @@ - + @@ -891,17 +891,17 @@ + - + - @@ -909,22 +909,23 @@ - - + - + - + + + - + @@ -935,34 +936,30 @@ - + - - - - + - - + + - @@ -970,29 +967,30 @@ - + - + - + - - + + + - + @@ -1000,56 +998,58 @@ - - + + - + - - + + + - + - + + - - + + - - + + - + - - - - - + + + + + - + \ No newline at end of file diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 4c0420838..cfa74081d 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ