Replaced Fish CSV data with aCis free version XML data.

This commit is contained in:
MobiusDevelopment
2020-01-25 07:25:33 +00:00
parent 65b3f4cc1d
commit a78309f34b
19 changed files with 632 additions and 879 deletions

View File

@@ -48,7 +48,6 @@ import org.l2jmobius.gameserver.datatables.SchemeBufferTable;
import org.l2jmobius.gameserver.datatables.SkillTable;
import org.l2jmobius.gameserver.datatables.csv.DoorTable;
import org.l2jmobius.gameserver.datatables.csv.ExtractableItemsData;
import org.l2jmobius.gameserver.datatables.csv.FishTable;
import org.l2jmobius.gameserver.datatables.csv.HennaTable;
import org.l2jmobius.gameserver.datatables.csv.MapRegionTable;
import org.l2jmobius.gameserver.datatables.csv.NpcWalkerRoutesTable;
@@ -73,6 +72,7 @@ import org.l2jmobius.gameserver.datatables.xml.AdminData;
import org.l2jmobius.gameserver.datatables.xml.AugmentationData;
import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
import org.l2jmobius.gameserver.datatables.xml.FenceData;
import org.l2jmobius.gameserver.datatables.xml.FishData;
import org.l2jmobius.gameserver.datatables.xml.ItemTable;
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
@@ -253,7 +253,7 @@ public class GameServer
SummonItemsData.getInstance();
if (Config.ALLOWFISHING)
{
FishTable.getInstance();
FishData.getInstance();
}
Util.printSection("Npc");

View File

@@ -1,226 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.datatables.csv;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.FishData;
/**
* @author -Nemesiss-
*/
public class FishTable
{
private static final Logger LOGGER = Logger.getLogger(FishTable.class.getName());
private static List<FishData> _fishsNormal;
private static List<FishData> _fishsEasy;
private static List<FishData> _fishsHard;
public static FishData fish;
private FishTable()
{
int count = 0;
FileReader reader = null;
BufferedReader buff = null;
LineNumberReader lnr = null;
try
{
final File fileData = new File(Config.DATAPACK_ROOT + "/data/csv/fish.csv");
reader = new FileReader(fileData);
buff = new BufferedReader(reader);
lnr = new LineNumberReader(buff);
String line = null;
_fishsEasy = new ArrayList<>();
_fishsNormal = new ArrayList<>();
_fishsHard = new ArrayList<>();
// format:
// id;level;name;hp;hpregen;fish_type;fish_group;fish_guts;guts_check_time;wait_time;combat_time
while ((line = lnr.readLine()) != null)
{
// ignore comments
if ((line.trim().length() == 0) || line.startsWith("#"))
{
continue;
}
final StringTokenizer st = new StringTokenizer(line, ";");
final int id = Integer.parseInt(st.nextToken());
final int lvl = Integer.parseInt(st.nextToken());
final String name = st.nextToken();
final int hp = Integer.parseInt(st.nextToken());
final int hpreg = Integer.parseInt(st.nextToken());
final int type = Integer.parseInt(st.nextToken());
final int group = Integer.parseInt(st.nextToken());
final int fish_guts = Integer.parseInt(st.nextToken());
final int guts_check_time = Integer.parseInt(st.nextToken());
final int wait_time = Integer.parseInt(st.nextToken());
final int combat_time = Integer.parseInt(st.nextToken());
fish = new FishData(id, lvl, name, hp, hpreg, type, group, fish_guts, guts_check_time, wait_time, combat_time);
switch (fish.getGroup())
{
case 0:
{
_fishsEasy.add(fish);
break;
}
case 1:
{
_fishsNormal.add(fish);
break;
}
case 2:
{
_fishsHard.add(fish);
}
}
}
count = _fishsEasy.size() + _fishsNormal.size() + _fishsHard.size();
}
catch (FileNotFoundException e)
{
LOGGER.warning("fish.csv is missing in data folder");
}
catch (IOException e0)
{
LOGGER.warning("Error while creating table: " + e0.getMessage() + "\n" + e0);
}
finally
{
if (lnr != null)
{
try
{
lnr.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
if (buff != null)
{
try
{
buff.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
if (reader != null)
{
try
{
reader.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
}
LOGGER.info("FishTable: Loaded " + count + " Fishes.");
}
/**
* @param lvl
* @param type
* @param group
* @return List of Fish that can be fished
*/
public List<FishData> getfish(int lvl, int type, int group)
{
final List<FishData> result = new ArrayList<>();
List<FishData> fishes = null;
switch (group)
{
case 0:
{
fishes = _fishsEasy;
break;
}
case 1:
{
fishes = _fishsNormal;
break;
}
case 2:
{
fishes = _fishsHard;
}
}
if (fishes == null)
{
LOGGER.warning("Fish are not defined!");
return null;
}
for (FishData f : fishes)
{
if (f.getLevel() != lvl)
{
continue;
}
if (f.getType() != type)
{
continue;
}
result.add(f);
}
if (result.isEmpty())
{
LOGGER.warning("Cant Find Any Fish!? - Lvl: " + lvl + " Type: " + type);
}
return result;
}
public static FishTable getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final FishTable INSTANCE = new FishTable();
}
}

View File

@@ -0,0 +1,102 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.datatables.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Fish;
import org.l2jmobius.gameserver.model.StatsSet;
/**
* This class loads and stores {@link Fish} infos.
*/
public class FishData implements IXmlReader
{
private final List<Fish> _fish = new ArrayList<>();
protected FishData()
{
load();
}
@Override
public void load()
{
parseDatapackFile("data/Fish.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _fish.size() + " fish.");
}
@Override
public void parseDocument(Document doc, File f)
{
// StatsSet used to feed informations. Cleaned on every entry.
final StatsSet set = new StatsSet();
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"fish".equalsIgnoreCase(node.getNodeName()))
{
continue;
}
// Parse and feed content.
final NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
final Node attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
// Feed the list with new data.
_fish.add(new Fish(set));
}
}
/**
* Get a random {@link FishData} based on level, type and group.
* @param lvl : the fish level to check.
* @param type : the fish type to check.
* @param group : the fish group to check.
* @return a Fish with good criteria.
*/
public Fish getFish(int lvl, int type, int group)
{
final List<Fish> fish = _fish.stream().filter(f -> (f.getLevel() == lvl) && (f.getType() == type) && (f.getGroup() == group)).collect(Collectors.toList());
return fish.get(Rnd.get(fish.size()));
}
public static FishData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final FishData INSTANCE = new FishData();
}
}

View File

@@ -69,10 +69,10 @@ public class Recipes implements IItemHandler
// can't add recipe, becouse create item level too low
player.sendPacket(new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER));
}
else if (player.getDwarvenRecipeBook().length >= player.GetDwarfRecipeLimit())
else if (player.getDwarvenRecipeBook().length >= player.getDwarfRecipeLimit())
{
final SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
sm.addNumber(player.GetDwarfRecipeLimit());
sm.addNumber(player.getDwarfRecipeLimit());
player.sendPacket(sm);
}
else
@@ -97,10 +97,10 @@ public class Recipes implements IItemHandler
// can't add recipe, becouse create item level too low
player.sendPacket(new SystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER));
}
else if (player.getCommonRecipeBook().length >= player.GetCommonRecipeLimit())
else if (player.getCommonRecipeBook().length >= player.getCommonRecipeLimit())
{
final SystemMessage sm = new SystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
sm.addNumber(player.GetCommonRecipeLimit());
sm.addNumber(player.getCommonRecipeLimit());
player.sendPacket(sm);
}
else

View File

@@ -64,13 +64,13 @@ public class Fishing implements ISkillHandler
if (player.isFishing())
{
if (player.GetFishCombat() != null)
if (player.getFishCombat() != null)
{
player.GetFishCombat().doDie(false);
player.getFishCombat().doDie(false);
}
else
{
player.EndFishing(false);
player.endFishing(false);
}
// Cancels fishing
player.sendPacket(SystemMessageId.FISHING_ATTEMPT_CANCELLED);
@@ -94,7 +94,7 @@ public class Fishing implements ISkillHandler
return;
}
player.SetLure(lure);
player.setLure(lure);
ItemInstance lure2 = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
if ((lure2 == null) || (lure2.getCount() < 1)) // Not enough bait.

View File

@@ -48,7 +48,7 @@ public class FishingSkill implements ISkillHandler
final PlayerInstance player = (PlayerInstance) creature;
final Fishing fish = player.GetFishCombat();
final Fishing fish = player.getFishCombat();
if (fish == null)
{
if (skill.getSkillType() == SkillType.PUMPING)

View File

@@ -1,122 +1,110 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model;
public class FishData
{
private final int _id;
private final int _level;
private final String _name;
private final int _hp;
private final int _hpRegen;
private int _type;
private final int _group;
private final int _fishGuts;
private final int _gutsCheckTime;
private final int _waitTime;
private final int _combatTime;
public FishData(int id, int lvl, String name, int hp, int hpRegen, int type, int group, int fishGuts, int gutsCheckTime, int waitTime, int combatTime)
{
_id = id;
_level = lvl;
_name = name.intern();
_hp = hp;
_hpRegen = hpRegen;
_type = type;
_group = group;
_fishGuts = fishGuts;
_gutsCheckTime = gutsCheckTime;
_waitTime = waitTime;
_combatTime = combatTime;
}
public FishData(FishData copyOf)
{
_id = copyOf.getId();
_level = copyOf.getLevel();
_name = copyOf.getName();
_hp = copyOf.getHP();
_hpRegen = copyOf.getHpRegen();
_type = copyOf.getType();
_group = copyOf.getGroup();
_fishGuts = copyOf.getFishGuts();
_gutsCheckTime = copyOf.getGutsCheckTime();
_waitTime = copyOf.getWaitTime();
_combatTime = copyOf.getCombatTime();
}
public int getId()
{
return _id;
}
public int getLevel()
{
return _level;
}
public String getName()
{
return _name;
}
public int getHP()
{
return _hp;
}
public int getHpRegen()
{
return _hpRegen;
}
public int getType()
{
return _type;
}
public int getGroup()
{
return _group;
}
public int getFishGuts()
{
return _fishGuts;
}
public int getGutsCheckTime()
{
return _gutsCheckTime;
}
public int getWaitTime()
{
return _waitTime;
}
public int getCombatTime()
{
return _combatTime;
}
public void setType(int type)
{
_type = type;
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model;
import org.l2jmobius.gameserver.GameTimeController;
/**
* A datatype used to retain a fish information.
*/
public class Fish
{
private final int _id;
private final int _level;
private final int _hp;
private final int _hpRegen;
private final int _type;
private final int _group;
private final int _guts;
private final int _gutsCheckTime;
private final int _waitTime;
private final int _combatTime;
public Fish(StatsSet set)
{
_id = set.getInt("id");
_level = set.getInt("level");
_hp = set.getInt("hp");
_hpRegen = set.getInt("hpRegen");
_type = set.getInt("type");
_group = set.getInt("group");
_guts = set.getInt("guts");
_gutsCheckTime = set.getInt("gutsCheckTime");
_waitTime = set.getInt("waitTime");
_combatTime = set.getInt("combatTime");
}
public int getId()
{
return _id;
}
public int getLevel()
{
return _level;
}
public int getHp()
{
return _hp;
}
public int getHpRegen()
{
return _hpRegen;
}
public int getType()
{
return _type;
}
public int getType(boolean isLureNight)
{
if (!GameTimeController.getInstance().isNowNight() && isLureNight)
{
return -1;
}
return _type;
}
public int getGroup()
{
return _group;
}
public int getGuts()
{
return _guts;
}
public int getGutsCheckTime()
{
return _gutsCheckTime;
}
public int getWaitTime()
{
return _waitTime;
}
public int getCombatTime()
{
return _combatTime;
}
}

View File

@@ -43,6 +43,8 @@ public class Fishing implements Runnable
private int _deceptiveMode = 0;
private Future<?> _fishAiTask;
private boolean _thinking;
// Fish datas
private final int _fishId;
private final int _fishMaxHp;
private int _fishCurHp;
@@ -77,10 +79,10 @@ public class Fishing implements Runnable
}
}
public Fishing(PlayerInstance fisher, FishData fish, boolean isNoob, boolean isUpperGrade, int lureId)
public Fishing(PlayerInstance fisher, Fish fish, boolean isNoob, boolean isUpperGrade, int lureId)
{
_fisher = fisher;
_fishMaxHp = fish.getHP();
_fishMaxHp = fish.getHp();
_fishCurHp = _fishMaxHp;
_regenHp = fish.getHpRegen();
_fishId = fish.getId();
@@ -101,9 +103,9 @@ public class Fishing implements Runnable
_mode = Rnd.get(100) >= 80 ? 1 : 0;
final ExFishingStartCombat efsc = new ExFishingStartCombat(_fisher, _time, _fishMaxHp, _mode, _lureType, _deceptiveMode);
_fisher.broadcastPacket(efsc);
_fisher.broadcastPacket(new ExFishingStartCombat(_fisher, _time, _fishMaxHp, _mode, _lureType, _deceptiveMode));
_fisher.sendPacket(new PlaySound(1, "SF_S_01"));
// Succeeded in getting a bite
_fisher.sendPacket(SystemMessageId.GOT_A_BITE);
@@ -121,8 +123,7 @@ public class Fishing implements Runnable
_fishCurHp = 0;
}
final ExFishingHpRegen efhr = new ExFishingHpRegen(_fisher, _time, _fishCurHp, _mode, _goodUse, _anim, pen, _deceptiveMode);
_fisher.broadcastPacket(efhr);
_fisher.broadcastPacket(new ExFishingHpRegen(_fisher, _time, _fishCurHp, _mode, _goodUse, _anim, pen, _deceptiveMode));
_anim = 0;
if (_fishCurHp > (_fishMaxHp * 2))
{
@@ -153,7 +154,8 @@ public class Fishing implements Runnable
final int check = Rnd.get(100);
if (check <= 5)
{
PenaltyMonster();
_fisher.sendPacket(SystemMessageId.YOU_CAUGHT_SOMETHING_SMELLY_THROW_IT_BACK);
spawnPenaltyMonster();
}
else
{
@@ -162,7 +164,7 @@ public class Fishing implements Runnable
FishingChampionshipManager.getInstance().newFish(_fisher, _lureId);
}
}
_fisher.EndFishing(win);
_fisher.endFishing(win);
_fisher = null;
}
@@ -249,15 +251,10 @@ public class Fishing implements Runnable
if (_deceptiveMode == 0)
{
// Reeling is successful, Damage: $s1
SystemMessage sm = new SystemMessage(SystemMessageId.REELING_SUCCESFUL_S1_DAMAGE);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.REELING_SUCCESFUL_S1_DAMAGE).addNumber(dmg));
if (pen == 50)
{
sm = new SystemMessage(SystemMessageId.REELING_SUCCESSFUL_PENALTY_S1);
sm.addNumber(pen);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.REELING_SUCCESSFUL_PENALTY_S1).addNumber(pen));
}
_goodUse = 1;
@@ -266,9 +263,7 @@ public class Fishing implements Runnable
else
{
// Reeling failed, Damage: $s1
final SystemMessage sm = new SystemMessage(SystemMessageId.FISH_RESISTED_REELING_S1_HP_REGAINED);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FISH_RESISTED_REELING_S1_HP_REGAINED).addNumber(dmg));
_goodUse = 2;
changeHp(-dmg, pen);
}
@@ -276,24 +271,17 @@ public class Fishing implements Runnable
else if (_deceptiveMode == 0)
{
// Reeling failed, Damage: $s1
final SystemMessage sm = new SystemMessage(SystemMessageId.FISH_RESISTED_REELING_S1_HP_REGAINED);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FISH_RESISTED_REELING_S1_HP_REGAINED).addNumber(dmg));
_goodUse = 2;
changeHp(-dmg, pen);
}
else
{
// Reeling is successful, Damage: $s1
SystemMessage sm = new SystemMessage(SystemMessageId.REELING_SUCCESFUL_S1_DAMAGE);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.REELING_SUCCESFUL_S1_DAMAGE).addNumber(dmg));
if (pen == 50)
{
sm = new SystemMessage(SystemMessageId.REELING_SUCCESSFUL_PENALTY_S1);
sm.addNumber(pen);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.REELING_SUCCESSFUL_PENALTY_S1).addNumber(pen));
}
_goodUse = 1;
@@ -323,15 +311,10 @@ public class Fishing implements Runnable
if (_deceptiveMode == 0)
{
// Pumping is successful. Damage: $s1
SystemMessage sm = new SystemMessage(SystemMessageId.PUMPING_SUCCESFUL_S1_DAMAGE);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PUMPING_SUCCESFUL_S1_DAMAGE).addNumber(dmg));
if (pen == 50)
{
sm = new SystemMessage(SystemMessageId.PUMPING_SUCCESSFUL_PENALTY_S1);
sm.addNumber(pen);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PUMPING_SUCCESSFUL_PENALTY_S1).addNumber(pen));
}
_goodUse = 1;
@@ -340,9 +323,7 @@ public class Fishing implements Runnable
else
{
// Pumping failed, Regained: $s1
final SystemMessage sm = new SystemMessage(SystemMessageId.FISH_RESISTED_PUMPING_S1_HP_REGAINED);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FISH_RESISTED_PUMPING_S1_HP_REGAINED).addNumber(dmg));
_goodUse = 2;
changeHp(-dmg, pen);
}
@@ -350,24 +331,17 @@ public class Fishing implements Runnable
else if (_deceptiveMode == 0)
{
// Pumping failed, Regained: $s1
final SystemMessage sm = new SystemMessage(SystemMessageId.FISH_RESISTED_PUMPING_S1_HP_REGAINED);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FISH_RESISTED_PUMPING_S1_HP_REGAINED).addNumber(dmg));
_goodUse = 2;
changeHp(-dmg, pen);
}
else
{
// Pumping is successful. Damage: $s1
SystemMessage sm = new SystemMessage(SystemMessageId.PUMPING_SUCCESFUL_S1_DAMAGE);
sm.addNumber(dmg);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PUMPING_SUCCESFUL_S1_DAMAGE).addNumber(dmg));
if (pen == 50)
{
sm = new SystemMessage(SystemMessageId.PUMPING_SUCCESSFUL_PENALTY_S1);
sm.addNumber(pen);
_fisher.sendPacket(sm);
_fisher.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PUMPING_SUCCESSFUL_PENALTY_S1).addNumber(pen));
}
_goodUse = 1;
@@ -375,74 +349,69 @@ public class Fishing implements Runnable
}
}
private void PenaltyMonster()
private void spawnPenaltyMonster()
{
final int lvl = (int) Math.round(_fisher.getLevel() * 0.1);
int npcid;
_fisher.sendPacket(SystemMessageId.YOU_CAUGHT_SOMETHING_SMELLY_THROW_IT_BACK);
switch (lvl)
int npcId;
switch ((int) Math.round(_fisher.getLevel() * 0.1))
{
case 0:
case 1:
{
npcid = 18319;
npcId = 18319;
break;
}
case 2:
{
npcid = 18320;
npcId = 18320;
break;
}
case 3:
{
npcid = 18321;
npcId = 18321;
break;
}
case 4:
{
npcid = 18322;
npcId = 18322;
break;
}
case 5:
{
npcid = 18323;
npcId = 18323;
break;
}
case 6:
{
npcid = 18324;
npcId = 18324;
break;
}
case 7:
{
npcid = 18325;
npcId = 18325;
break;
}
case 8:
case 9:
{
npcid = 18326;
npcId = 18326;
break;
}
default:
{
npcid = 18319;
npcId = 18319;
break;
}
}
NpcTemplate temp;
temp = NpcTable.getInstance().getTemplate(npcid);
if (temp != null)
NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
if (template != null)
{
try
{
final Spawn spawn = new Spawn(temp);
spawn.setX(_fisher.GetFishx());
spawn.setY(_fisher.GetFishy());
spawn.setZ(_fisher.GetFishz());
final Spawn spawn = new Spawn(template);
spawn.setX(_fisher.getFishX());
spawn.setY(_fisher.getFishY());
spawn.setZ(_fisher.getFishZ());
spawn.setAmount(1);
spawn.setHeading(_fisher.getHeading());
spawn.stopRespawn();

View File

@@ -142,6 +142,6 @@ public class PlayerFreight extends ItemContainer
@Override
public boolean validateCapacity(int slots)
{
return (getSize() + slots) <= _owner.GetFreightLimit();
return (getSize() + slots) <= _owner.getFreightLimit();
}
}

View File

@@ -58,6 +58,6 @@ public class PlayerWarehouse extends Warehouse
@Override
public boolean validateCapacity(int slots)
{
return (_items.size() + slots) <= _owner.GetWareHouseLimit();
return (_items.size() + slots) <= _owner.getWareHouseLimit();
}
}

View File

@@ -56,7 +56,6 @@ import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
import org.l2jmobius.gameserver.datatables.HeroSkillTable;
import org.l2jmobius.gameserver.datatables.NobleSkillTable;
import org.l2jmobius.gameserver.datatables.SkillTable;
import org.l2jmobius.gameserver.datatables.csv.FishTable;
import org.l2jmobius.gameserver.datatables.csv.HennaTable;
import org.l2jmobius.gameserver.datatables.csv.MapRegionTable;
import org.l2jmobius.gameserver.datatables.csv.RecipeTable;
@@ -66,6 +65,7 @@ import org.l2jmobius.gameserver.datatables.sql.NpcTable;
import org.l2jmobius.gameserver.datatables.sql.SkillTreeTable;
import org.l2jmobius.gameserver.datatables.xml.AdminData;
import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
import org.l2jmobius.gameserver.datatables.xml.FishData;
import org.l2jmobius.gameserver.datatables.xml.ItemTable;
import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
@@ -90,7 +90,7 @@ import org.l2jmobius.gameserver.instancemanager.TownManager;
import org.l2jmobius.gameserver.model.AccessLevel;
import org.l2jmobius.gameserver.model.BlockList;
import org.l2jmobius.gameserver.model.Effect;
import org.l2jmobius.gameserver.model.FishData;
import org.l2jmobius.gameserver.model.Fish;
import org.l2jmobius.gameserver.model.Fishing;
import org.l2jmobius.gameserver.model.Inventory;
import org.l2jmobius.gameserver.model.ItemContainer;
@@ -471,6 +471,7 @@ public class PlayerInstance extends Playable
private int _fishX = 0;
private int _fishY = 0;
private int _fishZ = 0;
private ItemInstance _lure = null;
private ScheduledFuture<?> _taskRentPet;
private ScheduledFuture<?> _taskWater;
private final List<String> _validBypass = new ArrayList<>();
@@ -519,7 +520,7 @@ public class PlayerInstance extends Playable
private final List<Integer> _selectedFriendList = new ArrayList<>(); // Related to CB.
private final List<Integer> _selectedBlocksList = new ArrayList<>(); // Related to CB.
private int _mailPosition;
private FishData _fish;
private Fish _fish;
private final Map<Integer, Timestamp> _reuseTimestamps = new ConcurrentHashMap<>();
boolean _gmStatus = true; // true by default since this is used by GMs
public WorldObject _saymode = null;
@@ -11714,7 +11715,7 @@ public class PlayerInstance extends Playable
{
if (System.currentTimeMillis() >= _endTaskTime)
{
EndFishing(false);
endFishing(false);
return;
}
if (_fishType == -1)
@@ -11725,7 +11726,7 @@ public class PlayerInstance extends Playable
if (_fishGutsCheck > check)
{
stopLookingForFishTask();
StartFishCombat(_isNoob, _isUpperGrade);
startFishCombat(_isNoob, _isUpperGrade);
}
}
}
@@ -14914,28 +14915,16 @@ public class PlayerInstance extends Playable
return _selectedBlocksList;
}
/**
* @return the mailPosition.
*/
public int getMailPosition()
{
return _mailPosition;
}
/**
* @param mailPosition The mailPosition to set.
*/
public void setMailPosition(int mailPosition)
{
_mailPosition = mailPosition;
}
/**
* Start fishing.
* @param x the fish x
* @param y the fish y
* @param z the fish z
*/
public void startFishing(int x, int y, int z)
{
stopMove(null);
@@ -14946,36 +14935,21 @@ public class PlayerInstance extends Playable
_fishZ = z;
broadcastUserInfo();
// Starts fishing
final int lvl = GetRandomFishLvl();
final int group = GetRandomGroup();
final int type = GetRandomFishType(group);
final List<FishData> fishs = FishTable.getInstance().getfish(lvl, type, group);
if ((fishs == null) || fishs.isEmpty())
final int lvl = getRandomFishLvl();
final int group = getRandomGroup();
final int type = getRandomFishType(group);
_fish = FishData.getInstance().getFish(lvl, type, group);
if (_fish == null)
{
sendMessage("Error - Fishes are not definied");
EndFishing(false);
endFishing(false);
return;
}
final 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));
fishs.clear();
sendPacket(SystemMessageId.CAST_LINE_AND_START_FISHING);
ExFishingStart efs = null;
if (!GameTimeController.getInstance().isNowNight() && _lure.isNightLure())
{
_fish.setType(-1);
}
efs = new ExFishingStart(this, _fish.getType(), x, y, z, _lure.isNightLure());
broadcastPacket(efs);
StartLookingForFishTask();
broadcastPacket(new ExFishingStart(this, _fish.getType(), x, y, z, _lure.isNightLure()));
startLookingForFishTask();
}
/**
* Stop looking for fish task.
*/
public void stopLookingForFishTask()
{
if (_taskforfish != null)
@@ -14985,10 +14959,7 @@ public class PlayerInstance extends Playable
}
}
/**
* Start looking for fish task.
*/
public void StartLookingForFishTask()
public void startLookingForFishTask()
{
if (!isDead() && (_taskforfish == null))
{
@@ -15014,15 +14985,11 @@ public class PlayerInstance extends Playable
checkDelay = Math.round((float) (_fish.getGutsCheckTime() * 0.66));
}
}
_taskforfish = ThreadPool.scheduleAtFixedRate(new LookingForFishTask(_fish.getWaitTime(), _fish.getFishGuts(), _fish.getType(), isNoob, isUpperGrade), 10000, checkDelay);
_taskforfish = ThreadPool.scheduleAtFixedRate(new LookingForFishTask(_fish.getWaitTime(), _fish.getGuts(), _fish.getType(), isNoob, isUpperGrade), 10000, checkDelay);
}
}
/**
* Gets the random group.
* @return the int
*/
private int GetRandomGroup()
private int getRandomGroup()
{
switch (_lure.getItemId())
{
@@ -15047,18 +15014,14 @@ public class PlayerInstance extends Playable
}
}
/**
* Gets the random fish type.
* @param group the group
* @return the int
*/
private int GetRandomFishType(int group)
private int getRandomFishType(int group)
{
final 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)
@@ -15127,7 +15090,9 @@ public class PlayerInstance extends Playable
}
}
break;
}
case 1: // normal fish
{
switch (_lure.getItemId())
{
case 7610:
@@ -15228,7 +15193,9 @@ public class PlayerInstance extends Playable
}
}
break;
}
case 2: // upper grade fish, luminous lure
{
switch (_lure.getItemId())
{
case 8506: // green lure, preferred by fast-moving (nimble) fish (type 8)
@@ -15296,15 +15263,13 @@ public class PlayerInstance extends Playable
break;
}
}
break;
}
}
return type;
}
/**
* Gets the random fish lvl.
* @return the int
*/
private int GetRandomFishLvl()
private int getRandomFishLvl()
{
final Effect[] effects = getAllEffects();
int skilllvl = getSkillLevel(1315);
@@ -15346,12 +15311,7 @@ public class PlayerInstance extends Playable
return randomlvl;
}
/**
* Start fish combat.
* @param isNoob the is noob
* @param isUpperGrade the is upper grade
*/
public void StartFishCombat(boolean isNoob, boolean isUpperGrade)
public void startFishCombat(boolean isNoob, boolean isUpperGrade)
{
_fishCombat = new Fishing(this, _fish, isNoob, isUpperGrade, _lure.getItemId());
}
@@ -15360,7 +15320,7 @@ public class PlayerInstance extends Playable
* End fishing.
* @param win the win
*/
public void EndFishing(boolean win)
public void endFishing(boolean win)
{
final ExFishingEnd efe = new ExFishingEnd(win, this);
broadcastPacket(efe);
@@ -15383,74 +15343,46 @@ public class PlayerInstance extends Playable
stopLookingForFishTask();
}
/**
* Gets the fish combat.
* @return the l2 fishing
*/
public Fishing GetFishCombat()
public Fishing getFishCombat()
{
return _fishCombat;
}
/**
* Gets the fishx.
* @return the int
*/
public int GetFishx()
public int getFishX()
{
return _fishX;
}
/**
* Gets the fishy.
* @return the int
*/
public int GetFishy()
public int getFishY()
{
return _fishY;
}
/**
* Gets the fishz.
* @return the int
*/
public int GetFishz()
public int getFishZ()
{
return _fishZ;
}
public void SetPartyFind(int find)
{
_partyFind = find;
}
public int GetPartyFind()
{
return _partyFind;
}
/**
* Sets the lure.
* @param lure the lure
*/
public void SetLure(ItemInstance lure)
public void setLure(ItemInstance lure)
{
_lure = lure;
}
/**
* Gets the lure.
* @return the l2 item instance
*/
public ItemInstance GetLure()
public ItemInstance getLure()
{
return _lure;
}
/**
* Gets the inventory limit.
* @return the int
*/
public void setPartyFind(int find)
{
_partyFind = find;
}
public int getPartyFind()
{
return _partyFind;
}
public int getInventoryLimit()
{
int ivlim;
@@ -15471,11 +15403,7 @@ public class PlayerInstance extends Playable
return ivlim;
}
/**
* Gets the ware house limit.
* @return the int
*/
public int GetWareHouseLimit()
public int getWareHouseLimit()
{
int whlim;
if (getRace() == Race.DWARF)
@@ -15491,11 +15419,7 @@ public class PlayerInstance extends Playable
return whlim;
}
/**
* Gets the private sell store limit.
* @return the int
*/
public int GetPrivateSellStoreLimit()
public int getPrivateSellStoreLimit()
{
int pslim;
if (getRace() == Race.DWARF)
@@ -15512,11 +15436,7 @@ public class PlayerInstance extends Playable
return pslim;
}
/**
* Gets the private buy store limit.
* @return the int
*/
public int GetPrivateBuyStoreLimit()
public int getPrivateBuyStoreLimit()
{
int pblim;
if (getRace() == Race.DWARF)
@@ -15532,61 +15452,37 @@ public class PlayerInstance extends Playable
return pblim;
}
/**
* Gets the freight limit.
* @return the int
*/
public int GetFreightLimit()
public int getFreightLimit()
{
return Config.FREIGHT_SLOTS + (int) getStat().calcStat(Stats.FREIGHT_LIM, 0, null, null);
}
/**
* Gets the dwarf recipe limit.
* @return the int
*/
public int GetDwarfRecipeLimit()
public int getDwarfRecipeLimit()
{
int recdlim = Config.DWARF_RECIPE_LIMIT;
recdlim += (int) getStat().calcStat(Stats.REC_D_LIM, 0, null, null);
return recdlim;
}
/**
* Gets the common recipe limit.
* @return the int
*/
public int GetCommonRecipeLimit()
public int getCommonRecipeLimit()
{
int recclim = Config.COMMON_RECIPE_LIMIT;
recclim += (int) getStat().calcStat(Stats.REC_C_LIM, 0, null, null);
return recclim;
}
/**
* Sets the mount object id.
* @param newID the new mount object id
*/
public void setMountObjectID(int newID)
public void setMountObjectID(int oid)
{
_mountObjectID = newID;
_mountObjectID = oid;
}
/**
* Gets the mount object id.
* @return the mount object id
*/
public int getMountObjectID()
{
return _mountObjectID;
}
/** The _lure. */
private ItemInstance _lure = null;
/**
* Get the current skill in use or return null.<BR>
* <BR>
* Get the current skill in use or return null.
* @return the current skill
*/
public SkillDat getCurrentSkill()
@@ -15595,8 +15491,7 @@ public class PlayerInstance extends Playable
}
/**
* Create a new SkillDat object and set the player _currentSkill.<BR>
* <BR>
* Create a new SkillDat object and set the player _currentSkill.
* @param currentSkill the current skill
* @param ctrlPressed the ctrl pressed
* @param shiftPressed the shift pressed

View File

@@ -141,7 +141,7 @@ public class SetPrivateStoreListBuy extends GameClientPacket
}
// Check maximum number of allowed slots for pvt shops
if (_count > player.GetPrivateBuyStoreLimit())
if (_count > player.getPrivateBuyStoreLimit())
{
player.sendPacket(new PrivateStoreManageListBuy(player));
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);

View File

@@ -149,7 +149,7 @@ public class SetPrivateStoreListSell extends GameClientPacket
}
// Check maximum number of allowed slots for pvt shops
if (_count > player.GetPrivateSellStoreLimit())
if (_count > player.getPrivateSellStoreLimit())
{
player.sendPacket(new PrivateStoreManageListSell(player));
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);

View File

@@ -376,9 +376,9 @@ public class CharInfo extends GameServerPacket
writeC((_player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) || _player.getIsPVPHero()) ? 1 : 0); // Hero Aura
writeC(_player.isFishing() ? 1 : 0); // 0x01: Fishing Mode (Cant be undone by setting back to 0)
writeD(_player.GetFishx());
writeD(_player.GetFishy());
writeD(_player.GetFishz());
writeD(_player.getFishX());
writeD(_player.getFishY());
writeD(_player.getFishZ());
writeD(_player.getAppearance().getNameColor());

View File

@@ -38,12 +38,12 @@ public class ExStorageMaxCount extends GameServerPacket
{
_player = character;
_inventory = _player.getInventoryLimit();
_warehouse = _player.GetWareHouseLimit();
_privateSell = _player.GetPrivateSellStoreLimit();
_privateBuy = _player.GetPrivateBuyStoreLimit();
_freight = _player.GetFreightLimit();
_receipeD = _player.GetDwarfRecipeLimit();
_recipe = _player.GetCommonRecipeLimit();
_warehouse = _player.getWareHouseLimit();
_privateSell = _player.getPrivateSellStoreLimit();
_privateBuy = _player.getPrivateBuyStoreLimit();
_freight = _player.getFreightLimit();
_receipeD = _player.getDwarfRecipeLimit();
_recipe = _player.getCommonRecipeLimit();
}
/*

View File

@@ -326,9 +326,9 @@ public class UserInfo extends GameServerPacket
writeC((_player.isHero() || (_player.isGM() && Config.GM_HERO_AURA) || _player.getIsPVPHero()) ? 1 : 0); // 0x01: Hero Aura
writeC(_player.isFishing() ? 1 : 0); // Fishing Mode
writeD(_player.GetFishx()); // fishing x
writeD(_player.GetFishy()); // fishing y
writeD(_player.GetFishz()); // fishing z
writeD(_player.getFishX()); // fishing x
writeD(_player.getFishY()); // fishing y
writeD(_player.getFishZ()); // fishing z
writeD(_player.getAppearance().getNameColor());
writeC(_player.isRunning() ? 0x01 : 0x00); // changes the Speed display on Status Window