Fishing bait rework.

This commit is contained in:
MobiusDev
2017-04-23 14:19:23 +00:00
parent 1610d0f443
commit 0c55e7e142
10 changed files with 198 additions and 244 deletions

View File

@@ -140,15 +140,15 @@ public class Fishing
return;
}
final int minPlayerLevel = FishingData.getInstance().getMinPlayerLevel();
final FishingBaitData baitData = getCurrentBaitData();
final int minPlayerLevel = baitData == null ? 85 : baitData.getMinPlayerLevel();
if (_player.getLevel() < minPlayerLevel)
{
if (minPlayerLevel == 85)
{
_player.sendPacket(SystemMessageId.FISHING_IS_AVAILABLE_TO_CHARACTERS_LV_85_OR_ABOVE);
}
else
// In case of custom fishing level requirement set in config.
else // In case of custom fishing level.
{
_player.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_FISHING_LEVEL_REQUIREMENTS);
}
@@ -166,7 +166,6 @@ public class Fishing
return;
}
final FishingBaitData baitData = getCurrentBaitData();
if (baitData == null)
{
_player.sendPacket(SystemMessageId.YOU_MUST_PUT_BAIT_ON_YOUR_HOOK_BEFORE_YOU_CAN_FISH);
@@ -224,8 +223,8 @@ public class Fishing
_reelInTask = ThreadPoolManager.getInstance().scheduleGeneral(() ->
{
_player.getFishing().reelInWithReward();
_startFishingTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> _player.getFishing().castLine(), Rnd.get(FishingData.getInstance().getFishingTimeWaitMin(), FishingData.getInstance().getFishingTimeWaitMax()));
}, Rnd.get(FishingData.getInstance().getFishingTimeMin(), FishingData.getInstance().getFishingTimeMax()));
_startFishingTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> _player.getFishing().castLine(), Rnd.get(baitData.getWaitMin(), baitData.getWaitMax()));
}, Rnd.get(baitData.getTimeMin(), baitData.getTimeMax()));
_player.stopMove(null);
_player.broadcastPacket(new ExFishingStart(_player, -1, baitData.getLevel(), _baitLocation));
_player.sendPacket(new ExUserInfoFishing(_player, true, _baitLocation));

View File

@@ -26,14 +26,24 @@ public class FishingBaitData
{
private final int _itemId;
private final int _level;
private final int _minPlayerLevel;
private final double _chance;
private final int _timeMin;
private final int _timeMax;
private final int _waitMin;
private final int _waitMax;
private final List<Integer> _rewards = new ArrayList<>();
public FishingBaitData(int itemId, int level, double chance)
public FishingBaitData(int itemId, int level, int minPlayerLevel, double chance, int timeMin, int timeMax, int waitMin, int waitMax)
{
_itemId = itemId;
_level = level;
_minPlayerLevel = minPlayerLevel;
_chance = chance;
_timeMin = timeMin;
_timeMax = timeMax;
_waitMin = waitMin;
_waitMax = waitMax;
}
public int getItemId()
@@ -46,11 +56,36 @@ public class FishingBaitData
return _level;
}
public int getMinPlayerLevel()
{
return _minPlayerLevel;
}
public double getChance()
{
return _chance;
}
public int getTimeMin()
{
return _timeMin;
}
public int getTimeMax()
{
return _timeMax;
}
public int getWaitMin()
{
return _waitMin;
}
public int getWaitMax()
{
return _waitMax;
}
public List<Integer> getRewards()
{
return _rewards;