add names to quests in the stats gui, add different reward colors, properly remove "next Page" and "Previous Page" buttons from stats page

This commit is contained in:
Sarah 2017-06-01 20:15:39 +02:00
parent 738090bb30
commit 3c5f8bf72d
4 changed files with 21 additions and 15 deletions

View File

@ -275,13 +275,16 @@ public class QuestManager extends MiniClientPlugin<QuestClientData>
{
if (quest.getReward().contains(":"))
{
ChatColor color = ChatColor.YELLOW;
if (quest.getRewardName().equalsIgnoreCase("Shards"))
{
_donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "Completing Quest: " + quest.getID(), Integer.parseInt(quest.getReward().split(":")[1]), callback);
color = ChatColor.AQUA;
}
else if (quest.getRewardName().equalsIgnoreCase("Gems"))
{
_donationManager.rewardCurrency(GlobalCurrency.TREASURE_SHARD, player, "Completing Quest: " + quest.getID(), Integer.parseInt(quest.getReward().split(":")[1]), callback);
color = ChatColor.GREEN;
}
else if (quest.getRewardName().equalsIgnoreCase("XP"))
{
@ -293,6 +296,7 @@ public class QuestManager extends MiniClientPlugin<QuestClientData>
_inventoryManager.addItemToInventory(player, quest.getRewardName(), quest.getRewardAmount());
callback.accept(true);
}
UtilPlayer.message(player, F.main("Quest", "You have recieved " + color + quest.getRewardAmount() + " " + quest.getRewardName() + " " + ChatColor.GRAY + "for completing: " + ChatColor.YELLOW + quest.getName()));
}
}

View File

@ -27,6 +27,8 @@ import mineplex.core.shop.item.SalesPackageProcessor;
*/
public class BuyQuestButton implements IButton
{
private final static int MAX_QUESTS = 5;
private QuestManager _questManager;
private QuestPage _page;
@ -54,9 +56,9 @@ public class BuyQuestButton implements IButton
return;
}
if (_questManager.Get(player).getQuests().size() >= 3)
if (_questManager.Get(player).getQuests().size() >= MAX_QUESTS)
{
UtilPlayer.message(player, F.main("Quest", "You can't own more than 3 active quests at once!"));
UtilPlayer.message(player, F.main("Quest", "You can't own more than " + MAX_QUESTS + " active quests at once!"));
return;
}

View File

@ -46,16 +46,23 @@ public class QuestStatsPage extends ShopPageBase<QuestManager, QuestStatShop>
@Override
protected void buildPage()
{
removeButton(5*9);
removeButton((6*9) - 1);
int questID = (_siteIndex * 5 * 9);
for (int i = 0; i < 9*5; i++)
{
Quest quest = _manager.getQuestByID(questID);
if (quest == null)
break;
{
setItem(i, null);
questID++;
continue;
}
QuestClientData data = _manager.Get(getPlayer());
ItemStack item = ItemStackFactory.Instance.CreateStack(Material.WOOL, DyeColor.GRAY.getWoolData(), 1, ChatColor.RED + "Quest not acquired");
ItemStack item = ItemStackFactory.Instance.CreateStack(Material.WOOL, DyeColor.GRAY.getWoolData(), 1, ChatColor.YELLOW + quest.getName());
if (data.hasQuestFromAll(quest))
{
@ -74,7 +81,7 @@ public class QuestStatsPage extends ShopPageBase<QuestManager, QuestStatShop>
questID++;
}
if (_siteIndex != 0)
if (_siteIndex > 0)
{
addButton(5*9, ItemStackFactory.Instance.CreateStack(Material.SIGN, (byte) 0, 1, ChatColor.YELLOW + "Previous Page"), new IButton()
{
@ -87,7 +94,7 @@ public class QuestStatsPage extends ShopPageBase<QuestManager, QuestStatShop>
});
}
if (((_siteIndex + 1) * 5 * 9) < _manager.getAvailableQuests().size())
if (((_siteIndex + 1) * 5 * 9) <= _manager.getAvailableQuests().size())
{
addButton((6*9) - 1, ItemStackFactory.Instance.CreateStack(Material.SIGN, (byte) 0, 1, ChatColor.YELLOW + "Next Page"), new IButton()
{

View File

@ -95,19 +95,12 @@ public class RedeemDeclineQuestButton implements IButton
{
_questManager.resetQuest(player, _quest, true);
player.closeInventory();
UtilPlayer.message(player, F.main("Quest", "You have recieved " + ChatColor.AQUA + _quest.getRewardAmount() + " " + _quest.getRewardName() + " " + ChatColor.GRAY + "for completing: " + ChatColor.YELLOW + _quest.getName()));
}
else
{
UtilPlayer.message(player, F.main("Quest", "Something went wrong!"));
}
}
});
});
}
player.closeInventory();
new QuestShop(_questManager, _questManager.getClients(), _donations).attemptShopOpen(player);
new QuestShop(_questManager, _questManager.getClients(), _donations).attemptShopOpen(player);
}
}