|
@@ -69,7 +69,7 @@ import com.l2jserver.gameserver.datatables.ClanTable;
|
|
|
import com.l2jserver.gameserver.datatables.ClassListData;
|
|
|
import com.l2jserver.gameserver.datatables.EnchantGroupsTable;
|
|
|
import com.l2jserver.gameserver.datatables.ExperienceTable;
|
|
|
-import com.l2jserver.gameserver.datatables.FishTable;
|
|
|
+import com.l2jserver.gameserver.datatables.FishData;
|
|
|
import com.l2jserver.gameserver.datatables.HennaData;
|
|
|
import com.l2jserver.gameserver.datatables.ItemTable;
|
|
|
import com.l2jserver.gameserver.datatables.NpcTable;
|
|
@@ -97,7 +97,7 @@ import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
|
|
|
import com.l2jserver.gameserver.instancemanager.ZoneManager;
|
|
|
import com.l2jserver.gameserver.model.BlockList;
|
|
|
import com.l2jserver.gameserver.model.CharEffectList;
|
|
|
-import com.l2jserver.gameserver.model.FishData;
|
|
|
+import com.l2jserver.gameserver.model.L2Fish;
|
|
|
import com.l2jserver.gameserver.model.L2AccessLevel;
|
|
|
import com.l2jserver.gameserver.model.L2Clan;
|
|
|
import com.l2jserver.gameserver.model.L2ClanMember;
|
|
@@ -10207,14 +10207,15 @@ public final class L2PcInstance extends L2Playable
|
|
|
private class LookingForFishTask implements Runnable
|
|
|
{
|
|
|
boolean _isNoob, _isUpperGrade;
|
|
|
- int _fishType, _fishGutsCheck;
|
|
|
+ int _fishGroup;
|
|
|
+ double _fishGutsCheck;
|
|
|
long _endTaskTime;
|
|
|
|
|
|
- protected LookingForFishTask(int fishWaitTime, int fishGutsCheck, int fishType, boolean isNoob, boolean isUpperGrade)
|
|
|
+ protected LookingForFishTask(int startCombatTime, double fishGutsCheck, int fishGroup, boolean isNoob, boolean isUpperGrade)
|
|
|
{
|
|
|
_fishGutsCheck = fishGutsCheck;
|
|
|
- _endTaskTime = System.currentTimeMillis() + fishWaitTime + 10000;
|
|
|
- _fishType = fishType;
|
|
|
+ _endTaskTime = System.currentTimeMillis() + (startCombatTime * 1000) + 10000;
|
|
|
+ _fishGroup = fishGroup;
|
|
|
_isNoob = isNoob;
|
|
|
_isUpperGrade = isUpperGrade;
|
|
|
}
|
|
@@ -10226,9 +10227,9 @@ public final class L2PcInstance extends L2Playable
|
|
|
endFishing(false);
|
|
|
return;
|
|
|
}
|
|
|
- if (_fishType == -1)
|
|
|
+ if (_fishGroup == -1)
|
|
|
return;
|
|
|
- int check = Rnd.get(1000);
|
|
|
+ int check = Rnd.get(100);
|
|
|
if(_fishGutsCheck > check)
|
|
|
{
|
|
|
stopLookingForFishTask();
|
|
@@ -12316,7 +12317,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private FishData _fish;
|
|
|
+ private L2Fish _fish;
|
|
|
|
|
|
/* startFishing() was stripped of any pre-fishing related checks, namely the fishing zone check.
|
|
|
* Also worthy of note is the fact the code to find the hook landing position was also striped. The
|
|
@@ -12336,10 +12337,10 @@ public final class L2PcInstance extends L2Playable
|
|
|
_fishz = _z;
|
|
|
//broadcastUserInfo();
|
|
|
//Starts fishing
|
|
|
- int lvl = GetRandomFishLvl();
|
|
|
- int group = GetRandomGroup();
|
|
|
- int type = GetRandomFishType(group);
|
|
|
- List<FishData> fishs = FishTable.getInstance().getfish(lvl, type, group);
|
|
|
+ int lvl = getRandomFishLvl();
|
|
|
+ int grade = getRandomFishGrade();
|
|
|
+ int group = getRandomFishGroup(grade);
|
|
|
+ List<L2Fish> fishs = FishData.getInstance().getFish(lvl, group, grade);
|
|
|
if (fishs == null || fishs.isEmpty())
|
|
|
{
|
|
|
sendMessage("Error - Fishes are not definied");
|
|
@@ -12348,14 +12349,14 @@ public final class L2PcInstance extends L2Playable
|
|
|
}
|
|
|
int check = Rnd.get(fishs.size());
|
|
|
// Use a copy constructor else the fish data may be over-written below
|
|
|
- _fish = new FishData(fishs.get(check));
|
|
|
+ _fish = fishs.get(check).clone();
|
|
|
fishs.clear();
|
|
|
fishs = null;
|
|
|
sendPacket(SystemMessageId.CAST_LINE_AND_START_FISHING);
|
|
|
if (!GameTimeController.getInstance().isNowNight() && _lure.isNightLure())
|
|
|
- _fish.setType(-1);
|
|
|
+ _fish.setFishGroup(-1);
|
|
|
//sendMessage("Hook x,y: " + _x + "," + _y + " - Water Z, Player Z:" + _z + ", " + getZ()); //debug line, uncoment to show coordinates used in fishing.
|
|
|
- broadcastPacket(new ExFishingStart(this,_fish.getType(),_x,_y,_z,_lure.isNightLure()));
|
|
|
+ broadcastPacket(new ExFishingStart(this,_fish.getFishGroup(),_x,_y,_z,_lure.isNightLure()));
|
|
|
sendPacket(new PlaySound(1, "SF_P_01", 0, 0, 0, 0, 0));
|
|
|
startLookingForFishTask();
|
|
|
}
|
|
@@ -12378,44 +12379,47 @@ public final class L2PcInstance extends L2Playable
|
|
|
if (_lure != null)
|
|
|
{
|
|
|
int lureid = _lure.getItemId();
|
|
|
- isNoob = _fish.getGroup() == 0;
|
|
|
- isUpperGrade = _fish.getGroup() == 2;
|
|
|
+ isNoob = _fish.getFishGrade() == 0;
|
|
|
+ isUpperGrade = _fish.getFishGrade() == 2;
|
|
|
if (lureid == 6519 || lureid == 6522 || lureid == 6525 || lureid == 8505 || lureid == 8508 || lureid == 8511) //low grade
|
|
|
- checkDelay = Math.round((float)(_fish.getGutsCheckTime() * (1.33)));
|
|
|
+ checkDelay = Math.round(_fish.getGutsCheckTime() * (133));
|
|
|
else if (lureid == 6520 || lureid == 6523 || lureid == 6526 || (lureid >= 8505 && lureid <= 8513) || (lureid >= 7610 && lureid <= 7613) || (lureid >= 7807 && lureid <= 7809) || (lureid >= 8484 && lureid <= 8486)) //medium grade, beginner, prize-winning & quest special bait
|
|
|
- checkDelay = Math.round((float)(_fish.getGutsCheckTime() * (1.00)));
|
|
|
+ checkDelay = Math.round(_fish.getGutsCheckTime() * (100));
|
|
|
else if (lureid == 6521 || lureid == 6524 || lureid == 6527 || lureid == 8507 || lureid == 8510 || lureid == 8513) //high grade
|
|
|
- checkDelay = Math.round((float)(_fish.getGutsCheckTime() * (0.66)));
|
|
|
+ checkDelay = Math.round(_fish.getGutsCheckTime() * (66));
|
|
|
}
|
|
|
- _taskforfish = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new LookingForFishTask(_fish.getWaitTime(), _fish.getFishGuts(), _fish.getType(), isNoob, isUpperGrade), 10000, checkDelay);
|
|
|
+ _taskforfish = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new LookingForFishTask(_fish.getStartCombatTime(), _fish.getFishGuts(), _fish.getFishGroup(), isNoob, isUpperGrade), 10000, checkDelay);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private int GetRandomGroup()
|
|
|
+ private int getRandomFishGrade()
|
|
|
{
|
|
|
- switch (_lure.getItemId()) {
|
|
|
- case 7807: //green for beginners
|
|
|
- case 7808: //purple for beginners
|
|
|
- case 7809: //yellow for beginners
|
|
|
- case 8486: //prize-winning for beginners
|
|
|
+ switch (_lure.getItemId())
|
|
|
+ {
|
|
|
+ case 7807: // green for beginners
|
|
|
+ case 7808: // purple for beginners
|
|
|
+ case 7809: // yellow for beginners
|
|
|
+ case 8486: // prize-winning for beginners
|
|
|
return 0;
|
|
|
- case 8485: //prize-winning luminous
|
|
|
- case 8506: //green luminous
|
|
|
- case 8509: //purple luminous
|
|
|
- case 8512: //yellow luminous
|
|
|
+ case 8485: // prize-winning luminous
|
|
|
+ case 8506: // green luminous
|
|
|
+ case 8509: // purple luminous
|
|
|
+ case 8512: // yellow luminous
|
|
|
return 2;
|
|
|
default:
|
|
|
return 1;
|
|
|
}
|
|
|
}
|
|
|
- private int GetRandomFishType(int group)
|
|
|
+ private int getRandomFishGroup(int group)
|
|
|
{
|
|
|
int check = Rnd.get(100);
|
|
|
int type = 1;
|
|
|
- switch (group) {
|
|
|
- case 0: //fish for novices
|
|
|
- switch (_lure.getItemId()) {
|
|
|
- case 7807: //green lure, preferred by fast-moving (nimble) fish (type 5)
|
|
|
+ switch (group)
|
|
|
+ {
|
|
|
+ case 0: // fish for novices
|
|
|
+ switch (_lure.getItemId())
|
|
|
+ {
|
|
|
+ case 7807: // green lure, preferred by fast-moving (nimble) fish (type 5)
|
|
|
if (check <= 54)
|
|
|
type = 5;
|
|
|
else if (check <= 77)
|
|
@@ -12423,7 +12427,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 6;
|
|
|
break;
|
|
|
- case 7808: //purple lure, preferred by fat fish (type 4)
|
|
|
+ case 7808: // purple lure, preferred by fat fish (type 4)
|
|
|
if (check <= 54)
|
|
|
type = 4;
|
|
|
else if (check <= 77)
|
|
@@ -12431,7 +12435,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 5;
|
|
|
break;
|
|
|
- case 7809: //yellow lure, preferred by ugly fish (type 6)
|
|
|
+ case 7809: // yellow lure, preferred by ugly fish (type 6)
|
|
|
if (check <= 54)
|
|
|
type = 6;
|
|
|
else if (check <= 77)
|
|
@@ -12439,7 +12443,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 4;
|
|
|
break;
|
|
|
- case 8486: //prize-winning fishing lure for beginners
|
|
|
+ case 8486: // prize-winning fishing lure for beginners
|
|
|
if (check <= 33)
|
|
|
type = 4;
|
|
|
else if (check <= 66)
|
|
@@ -12449,15 +12453,16 @@ public final class L2PcInstance extends L2Playable
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
- case 1: //normal fish
|
|
|
- switch (_lure.getItemId()) {
|
|
|
+ case 1: // normal fish
|
|
|
+ switch (_lure.getItemId())
|
|
|
+ {
|
|
|
case 7610:
|
|
|
case 7611:
|
|
|
case 7612:
|
|
|
case 7613:
|
|
|
type = 3;
|
|
|
break;
|
|
|
- case 6519: //all theese lures (green) are prefered by fast-moving (nimble) fish (type 1)
|
|
|
+ case 6519: // all theese lures (green) are prefered by fast-moving (nimble) fish (type 1)
|
|
|
case 8505:
|
|
|
case 6520:
|
|
|
case 6521:
|
|
@@ -12471,7 +12476,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 3;
|
|
|
break;
|
|
|
- case 6522: //all theese lures (purple) are prefered by fat fish (type 0)
|
|
|
+ case 6522: // all theese lures (purple) are prefered by fat fish (type 0)
|
|
|
case 8508:
|
|
|
case 6523:
|
|
|
case 6524:
|
|
@@ -12485,7 +12490,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 3;
|
|
|
break;
|
|
|
- case 6525: //all theese lures (yellow) are prefered by ugly fish (type 2)
|
|
|
+ case 6525: // all theese lures (yellow) are prefered by ugly fish (type 2)
|
|
|
case 8511:
|
|
|
case 6526:
|
|
|
case 6527:
|
|
@@ -12499,7 +12504,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 3;
|
|
|
break;
|
|
|
- case 8484: //prize-winning fishing lure
|
|
|
+ case 8484: // prize-winning fishing lure
|
|
|
if (check <= 33)
|
|
|
type = 0;
|
|
|
else if (check <= 66)
|
|
@@ -12509,9 +12514,10 @@ public final class L2PcInstance extends L2Playable
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
- case 2: //upper grade fish, luminous lure
|
|
|
- switch (_lure.getItemId()) {
|
|
|
- case 8506: //green lure, preferred by fast-moving (nimble) fish (type 8)
|
|
|
+ case 2: // upper grade fish, luminous lure
|
|
|
+ switch (_lure.getItemId())
|
|
|
+ {
|
|
|
+ case 8506: // green lure, preferred by fast-moving (nimble) fish (type 8)
|
|
|
if (check <= 54)
|
|
|
type = 8;
|
|
|
else if (check <= 77)
|
|
@@ -12519,7 +12525,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 9;
|
|
|
break;
|
|
|
- case 8509: //purple lure, preferred by fat fish (type 7)
|
|
|
+ case 8509: // purple lure, preferred by fat fish (type 7)
|
|
|
if (check <= 54)
|
|
|
type = 7;
|
|
|
else if (check <= 77)
|
|
@@ -12527,7 +12533,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 8;
|
|
|
break;
|
|
|
- case 8512: //yellow lure, preferred by ugly fish (type 9)
|
|
|
+ case 8512: // yellow lure, preferred by ugly fish (type 9)
|
|
|
if (check <= 54)
|
|
|
type = 9;
|
|
|
else if (check <= 77)
|
|
@@ -12535,7 +12541,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
else
|
|
|
type = 7;
|
|
|
break;
|
|
|
- case 8485: //prize-winning fishing lure
|
|
|
+ case 8485: // prize-winning fishing lure
|
|
|
if (check <= 33)
|
|
|
type = 7;
|
|
|
else if (check <= 66)
|
|
@@ -12547,7 +12553,7 @@ public final class L2PcInstance extends L2Playable
|
|
|
}
|
|
|
return type;
|
|
|
}
|
|
|
- private int GetRandomFishLvl()
|
|
|
+ private int getRandomFishLvl()
|
|
|
{
|
|
|
int skilllvl = getSkillLevel(1315);
|
|
|
final L2Effect e = getFirstEffect(2274);
|