Code review Part 5.

This commit is contained in:
MobiusDevelopment
2019-12-22 15:33:46 +00:00
parent 4a563b8832
commit 7f3befa63c
4071 changed files with 23938 additions and 28938 deletions

View File

@@ -71,14 +71,12 @@ public class SummonPc extends AbstractNpcAI
final Attackable monster = (Attackable) npc;
if (monster.getMostHated() != null)
{
if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10))
if ((((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10)) //
&& ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill())))
{
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
}

View File

@@ -63,7 +63,7 @@ public class Ingrit extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_INRGIT)
{
QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":

View File

@@ -63,7 +63,7 @@ public class Iris extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_IRIS)
{
QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":

View File

@@ -63,7 +63,7 @@ public class Magrit extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_MARGIT)
{
QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":

View File

@@ -63,7 +63,7 @@ public class Rosammy extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_ROSAMMY)
{
QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":

View File

@@ -70,7 +70,7 @@ public class AttributeMaster extends AbstractNpcAI
spirit.upgrade();
}
}
UserInfo userInfo = new UserInfo(player);
final UserInfo userInfo = new UserInfo(player);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
player.sendPacket(userInfo);
player.sendPacket(new ElementalSpiritInfo(player, player.getActiveElementalSpiritType(), (byte) 0x01));

View File

@@ -54,7 +54,7 @@ public class DimensionalMerchant extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = null;
final String htmltext = null;
switch (event)
{
case "package_deposit":

View File

@@ -46,6 +46,8 @@ import ai.AbstractNpcAI;
*/
public class OlyManager extends AbstractNpcAI implements IBypassHandler
{
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
// NPC
private static final int MANAGER = 31688;
// Misc
@@ -56,7 +58,6 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
"watchmatch",
"arenachange"
};
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
private OlyManager()
{

View File

@@ -39,6 +39,7 @@ import ai.AbstractNpcAI;
public class EilhalderVonHellmann extends AbstractNpcAI
{
private static final Logger LOGGER = Logger.getLogger(EilhalderVonHellmann.class.getName());
private static final int EILHALDER_VON_HELLMANN = 25328;
private NpcSpawnTemplate _template;

View File

@@ -33,7 +33,7 @@ import ai.AbstractNpcAI;
*/
public class NpcLocationInfo extends AbstractNpcAI
{
private static final List<Integer> NPC = new ArrayList<>();
private static final List<Integer> NPC = new ArrayList<>();
static
{
NPC.add(30598);
@@ -42,7 +42,7 @@ public class NpcLocationInfo extends AbstractNpcAI
NPC.add(30601);
NPC.add(30602);
}
private static final List<Integer> NPCRADAR = new ArrayList<>();
private static final List<Integer> NPCRADAR = new ArrayList<>();
static
{
// Talking Island
@@ -224,7 +224,9 @@ public class NpcLocationInfo extends AbstractNpcAI
final int npcId = Integer.parseInt(event);
if (NPCRADAR.contains(npcId))
{
int x = 0, y = 0, z = 0;
int x = 0;
int y = 0;
int z = 0;
final Spawn spawn = SpawnTable.getInstance().getAnySpawn(npcId);
if (spawn != null)
{
@@ -243,7 +245,7 @@ public class NpcLocationInfo extends AbstractNpcAI
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext = getNoQuestMsg(player);
int npcId = npc.getId();
final int npcId = npc.getId();
if (NPC.contains(npcId))
{
htmltext = npcId + ".htm";
@@ -257,7 +259,7 @@ public class NpcLocationInfo extends AbstractNpcAI
addTalkId(NPC);
}
public static void main(String args[])
public static void main(String[] args)
{
new NpcLocationInfo();
}

View File

@@ -73,7 +73,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
String cmd = "";
StringBuilder params = new StringBuilder();
final StringBuilder params = new StringBuilder();
final StringTokenizer st = new StringTokenizer(command, " ");
if (st.hasMoreTokens())
@@ -130,7 +130,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
}
else
{
StringBuilder title = new StringBuilder();
final StringBuilder title = new StringBuilder();
title.append("BUFF SELL: ");
final StringTokenizer st = new StringTokenizer(params, " ");
while (st.hasMoreTokens())

View File

@@ -543,12 +543,12 @@ public class MerrySquashmas extends LongTimeEvent
{
case 13399: // Snowy Squash Seed
{
randomSpawn(13402, 13401, 13400, npc, true);
randomSpawn(13402, 13401, 13400, npc);
break;
}
case 13403: // Large Snowy Squash Seed
{
randomSpawn(13406, 13405, 13404, npc, true);
randomSpawn(13406, 13405, 13404, npc);
break;
}
}
@@ -600,7 +600,7 @@ public class MerrySquashmas extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)

View File

@@ -542,12 +542,12 @@ public class SquashEvent extends LongTimeEvent
{
case 12774: // Young Squash
{
randomSpawn(13016, 12775, 12776, npc, true);
randomSpawn(13016, 12775, 12776, npc);
break;
}
case 12777: // Large Young Squash
{
randomSpawn(13017, 12778, 12779, npc, true);
randomSpawn(13017, 12778, 12779, npc);
break;
}
}
@@ -599,7 +599,7 @@ public class SquashEvent extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)

View File

@@ -540,12 +540,12 @@ public class WatermelonNinja extends LongTimeEvent
{
case 13271: // Watermelon Seed
{
randomSpawn(13274, 13273, 13272, npc, true);
randomSpawn(13274, 13273, 13272, npc);
break;
}
case 13275: // Honey Watermelon Seed
{
randomSpawn(13278, 13277, 13276, npc, true);
randomSpawn(13278, 13277, 13276, npc);
break;
}
}
@@ -575,20 +575,10 @@ public class WatermelonNinja extends LongTimeEvent
final int chance = Rnd.get(100);
for (int[] drop : DROPLIST)
{
if (npcId == drop[0])
if ((npcId == drop[0]) && (chance < drop[2]))
{
if (chance < drop[2])
{
if (drop[1] > 6000)
{
((MonsterInstance) mob).dropItem(player, drop[1], 1);
}
else
{
((MonsterInstance) mob).dropItem(player, drop[1], 1);
}
continue;
}
((MonsterInstance) mob).dropItem(player, drop[1], 1);
continue;
}
if (npcId < drop[0])
{
@@ -597,18 +587,18 @@ public class WatermelonNinja extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)
final int random = Rnd.get(100);
if (random < 5)
{
spawnNext(low, npc);
}
if (_random < 10)
if (random < 10)
{
spawnNext(medium, npc);
}
else if (_random < 30)
else if (random < 30)
{
spawnNext(high, npc);
}

View File

@@ -734,7 +734,6 @@ public class MasterHandler
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Failed loading handler: " + c.getSimpleName(), e);
continue;
}
}
}

View File

@@ -72,7 +72,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken();
st.nextToken();
if (!st.hasMoreTokens())
{
BuilderUtil.sendSysMessage(activeChar, "Skill Id and level are not specified.");
@@ -176,9 +176,9 @@ public class AdminBuffs implements IAdminCommandHandler
{
try
{
StringTokenizer st = new StringTokenizer(command, " ");
final StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
int objectId = Integer.parseInt(st.nextToken());
final int objectId = Integer.parseInt(st.nextToken());
viewBlockedEffects(activeChar, objectId);
return true;
}
@@ -362,6 +362,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if ((target != null) && (skillId > 0))
@@ -389,6 +390,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if (target != null)

View File

@@ -120,7 +120,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
{
int hours = 0;
int minutes = 0;
int id = entry.getKey();
final int id = entry.getKey();
final long remainingTime = (entry.getValue() - System.currentTimeMillis()) / 1000;
if (remainingTime > 0)
{

View File

@@ -30,8 +30,8 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in
* that radius will be killed.
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in that
* radius will be killed.
* @version $Revision: 1.2.4.5 $ $Date: 2007/07/31 10:06:06 $
*/
public class AdminKill implements IAdminCommandHandler

View File

@@ -316,7 +316,7 @@ public class AdminQuest implements IAdminCommandHandler
{
continue;
}
else if (n.isDirectory())
if (n.isDirectory())
{
sb.append("<a action=\"bypass -h admin_script_dir " + c + "\">" + c + "</a><br1>");
}
@@ -348,7 +348,7 @@ public class AdminQuest implements IAdminCommandHandler
{
continue;
}
else if (n.isDirectory())
if (n.isDirectory())
{
sb.append("<a action=\"bypass -h admin_script_dir " + currentPath + "/" + c + "\">" + (questReducedNames ? getQuestName(c) : c) + "</a><br1>");
}

View File

@@ -69,7 +69,7 @@ public class AdminShop implements IAdminCommandHandler
{
try
{
int listId = Integer.parseInt(command.substring(16).trim());
final int listId = Integer.parseInt(command.substring(16).trim());
MultisellData.getInstance().separateAndSend(listId, activeChar, null, false);
}
catch (NumberFormatException | IndexOutOfBoundsException e)
@@ -81,7 +81,7 @@ public class AdminShop implements IAdminCommandHandler
{
try
{
int listId = Integer.parseInt(command.substring(20).trim());
final int listId = Integer.parseInt(command.substring(20).trim());
MultisellData.getInstance().separateAndSend(listId, activeChar, null, true);
}
catch (NumberFormatException | IndexOutOfBoundsException e)

View File

@@ -101,6 +101,7 @@ public class AdminSkill implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.startsWith("admin_skill_list"))
@@ -116,6 +117,7 @@ public class AdminSkill implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.startsWith("admin_add_skill"))

View File

@@ -84,7 +84,7 @@ public class FindPvP implements IBypassHandler
// Check if the player's clan is already outnumbering the PvP
if (player.getClan() != null)
{
Map<Integer, Integer> clanNumbers = new HashMap<>();
final Map<Integer, Integer> clanNumbers = new HashMap<>();
int allyId = player.getAllyId();
if (allyId == 0)
{

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExItemAuctionInfoPacket;
public class ItemAuctionLink implements IBypassHandler
{
private static final SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
private static final SimpleDateFormat SDF = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
private static final String[] COMMANDS =
{
@@ -91,7 +91,7 @@ public class ItemAuctionLink implements IBypassHandler
if (nextAuction != null)
{
player.sendMessage("The next auction will begin on the " + fmt.format(new Date(nextAuction.getStartingTime())) + ".");
player.sendMessage("The next auction will begin on the " + SDF.format(new Date(nextAuction.getStartingTime())) + ".");
}
return true;
}

View File

@@ -408,7 +408,7 @@ public class NpcViewMod implements IBypassHandler
{
final StringBuilder sb = new StringBuilder();
int height = 64;
final int height = 64;
final DropHolder dropItem = dropList.get(i);
final Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());

View File

@@ -38,22 +38,19 @@ public class ChatPartyRoomAll implements IChatHandler
@Override
public void handleChat(ChatType type, PlayerInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
}
}

View File

@@ -38,22 +38,19 @@ public class ChatPartyRoomCommander implements IChatHandler
@Override
public void handleChat(ChatType type, PlayerInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
}
}

View File

@@ -143,38 +143,38 @@ public class DropSearchBoard implements IParseBoardHandler
public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
{
final String navigation = HtmCache.getInstance().getHtm(player, NAVIGATION_PATH);
String[] params = command.split(" ");
final String[] params = command.split(" ");
String html = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/dropsearch/main.html");
switch (params[0])
{
case "_bbs_search_item":
{
String itemName = buildItemName(params);
String result = buildItemSearchResult(itemName);
final String itemName = buildItemName(params);
final String result = buildItemSearchResult(itemName);
html = html.replace("%searchResult%", result);
break;
}
case "_bbs_search_drop":
{
final DecimalFormat chanceFormat = new DecimalFormat("0.00##");
int itemId = Integer.parseInt(params[1]);
final int itemId = Integer.parseInt(params[1]);
int page = Integer.parseInt(params[2]);
List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
final List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
int pages = list.size() / 14;
if (pages == 0)
{
pages++;
}
int start = (page - 1) * 14;
int end = Math.min(list.size() - 1, start + 14);
StringBuilder builder = new StringBuilder();
final int start = (page - 1) * 14;
final int end = Math.min(list.size() - 1, start + 14);
final StringBuilder builder = new StringBuilder();
final double dropAmountEffectBonus = player.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
final double dropRateEffectBonus = player.getStat().getValue(Stats.BONUS_DROP_RATE, 1);
final double spoilRateEffectBonus = player.getStat().getValue(Stats.BONUS_SPOIL_RATE, 1);
for (int index = start; index <= end; index++)
{
CBDropHolder cbDropHolder = list.get(index);
final CBDropHolder cbDropHolder = list.get(index);
// real time server rate calculations
double rateChance = 1;
@@ -299,15 +299,15 @@ public class DropSearchBoard implements IParseBoardHandler
}
case "_bbs_npc_trace":
{
int npcId = Integer.parseInt(params[1]);
List<NpcSpawnTemplate> spawnList = SpawnsData.getInstance().getNpcSpawns(npc -> npc.getId() == npcId);
final int npcId = Integer.parseInt(params[1]);
final List<NpcSpawnTemplate> spawnList = SpawnsData.getInstance().getNpcSpawns(npc -> npc.getId() == npcId);
if (spawnList.isEmpty())
{
player.sendMessage("Cannot find any spawn. Maybe dropped by a boss or instance monster.");
}
else
{
NpcSpawnTemplate spawn = spawnList.get(Rnd.get(spawnList.size()));
final NpcSpawnTemplate spawn = spawnList.get(Rnd.get(spawnList.size()));
player.getRadar().addMarker(spawn.getSpawnLocation().getX(), spawn.getSpawnLocation().getY(), spawn.getSpawnLocation().getZ());
}
break;
@@ -330,8 +330,8 @@ public class DropSearchBoard implements IParseBoardHandler
private String buildItemSearchResult(String itemName)
{
int limit = 0;
Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
List<Item> items = new ArrayList<>();
final Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
final List<Item> items = new ArrayList<>();
for (Item item : ItemTable.getInstance().getAllItems())
{
if (item == null)
@@ -363,7 +363,7 @@ public class DropSearchBoard implements IParseBoardHandler
int line = 0;
StringBuilder builder = new StringBuilder(items.size() * 28);
final StringBuilder builder = new StringBuilder(items.size() * 28);
int i = 0;
for (Item item : items)
{
@@ -416,7 +416,7 @@ public class DropSearchBoard implements IParseBoardHandler
*/
private String buildItemName(String[] params)
{
StringJoiner joiner = new StringJoiner(" ");
final StringJoiner joiner = new StringJoiner(" ");
for (int i = 1; i < params.length; i++)
{
joiner.add(params[i]);

View File

@@ -99,7 +99,7 @@ public class HomeBoard implements IParseBoardHandler
@Override
public String[] getCommunityBoardCommands()
{
List<String> commands = new ArrayList<>();
final List<String> commands = new ArrayList<>();
commands.addAll(Arrays.asList(COMMANDS));
commands.addAll(Arrays.asList(CUSTOM_COMMANDS));
return commands.stream().filter(Objects::nonNull).toArray(String[]::new);
@@ -201,7 +201,7 @@ public class HomeBoard implements IParseBoardHandler
{
player.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, player, true);
final PetInstance pet = player.getPet();
List<Creature> targets = new ArrayList<>(4);
final List<Creature> targets = new ArrayList<>(4);
targets.add(player);
if (pet != null)
{

View File

@@ -38,7 +38,7 @@ public class DispelBySlotMyself extends AbstractEffect
public DispelBySlotMyself(StatsSet params)
{
String dispel = params.getString("dispel");
final String dispel = params.getString("dispel");
if ((dispel != null) && !dispel.isEmpty())
{
_dispelAbnormals = new HashSet<>();

View File

@@ -51,7 +51,7 @@ public class FatalBlow extends AbstractEffect
_criticalChance = params.getDouble("criticalChance", 0);
_overHit = params.getBoolean("overHit", false);
String abnormals = params.getString("abnormalType", null);
final String abnormals = params.getString("abnormalType", null);
if ((abnormals != null) && !abnormals.isEmpty())
{
_abnormals = new HashSet<>();

View File

@@ -87,7 +87,7 @@ public class RebalanceHP extends AbstractEffect
}
}
double percentHP = currentHPs / fullHP;
final double percentHP = currentHPs / fullHP;
for (PlayerInstance member : party.getMembers())
{
if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true))

View File

@@ -70,7 +70,7 @@ public class RebalanceHPSummon extends AbstractEffect
fullHP += effector.getMaxHp();
currentHPs += effector.getCurrentHp();
double percentHP = currentHPs / fullHP;
final double percentHP = currentHPs / fullHP;
for (Summon summon : effector.getServitors().values())
{
if (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))

View File

@@ -109,7 +109,7 @@ public class RestorationRandom extends AbstractEffect
continue;
}
long itemCount = (long) (createdItem.getCount() * Config.RATE_EXTRACTABLE);
final long itemCount = (long) (createdItem.getCount() * Config.RATE_EXTRACTABLE);
final ItemInstance newItem = player.addItem("Extract", createdItem.getId(), itemCount, effector, false);
if (createdItem.getMaxEnchant() > 0)

View File

@@ -88,17 +88,14 @@ public class Enemy implements ITargetTypeHandler
if (target.isAutoAttackable(creature) || forceUse)
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -124,17 +121,14 @@ public class Enemy implements ITargetTypeHandler
}
// Is this check still actual?
if (forceUse && (target.getActingPlayer() != null) && (creature.getActingPlayer() != null))
if (forceUse && (target.getActingPlayer() != null) && (creature.getActingPlayer() != null) && creature.getActingPlayer().isSiegeFriend(target))
{
if (creature.getActingPlayer().isSiegeFriend(target))
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
}
return target;

View File

@@ -60,17 +60,14 @@ public class EnemyNot implements ITargetTypeHandler
if (!target.isAutoAttackable(creature))
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
if ((skill.isFlyType()) && !GeoEngine.getInstance().canMoveToTarget(creature.getX(), creature.getY(), creature.getZ(), target.getX(), target.getY(), target.getZ(), creature.getInstanceWorld()))

View File

@@ -88,17 +88,14 @@ public class EnemyOnly implements ITargetTypeHandler
if (target.isAutoAttackable(creature))
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -124,17 +121,14 @@ public class EnemyOnly implements ITargetTypeHandler
}
// Is this check still actual?
if ((target.getActingPlayer() != null) && (creature.getActingPlayer() != null))
if ((target.getActingPlayer() != null) && (creature.getActingPlayer() != null) && creature.getActingPlayer().isSiegeFriend(target))
{
if (creature.getActingPlayer().isSiegeFriend(target))
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
}
return target;

View File

@@ -63,16 +63,13 @@ public class NpcBody implements ITargetTypeHandler
if (target.isDead())
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.

View File

@@ -93,17 +93,14 @@ public class PcBody implements ITargetTypeHandler
}
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.

View File

@@ -62,17 +62,14 @@ public class Target implements ITargetTypeHandler
}
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
if (skill.isFlyType() && !GeoEngine.getInstance().canMoveToTarget(creature.getX(), creature.getY(), creature.getZ(), target.getX(), target.getY(), target.getZ(), creature.getInstanceWorld()))

View File

@@ -24,10 +24,8 @@ import java.util.ArrayList;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.DecoyInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.util.Util;
@@ -52,7 +50,7 @@ public class ScarletVanHalisha extends AbstractNpcAI
private Creature _target;
private Skill _skill;
private long _lastRangedSkillTime;
private final int _rangedSkillMinCoolTime = 60000; // 1 minute
private static final int RANGED_SKILL_MIN_COOLTIME = 60000; // 1 minute
public ScarletVanHalisha()
{
@@ -144,11 +142,11 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 2);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_FIELD, 1);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_MORPH, 1);
}
@@ -215,55 +213,50 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
final ArrayList<Creature> result = new ArrayList<>();
{
for (WorldObject obj : npc.getInstanceWorld().getPlayers())
for (PlayerInstance obj : npc.getInstanceWorld().getPlayers())
{
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
continue;
}
if (((((Creature) obj).getZ() < (npc.getZ() - 100)) && (((Creature) obj).getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
continue;
}
continue;
}
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (((obj.getZ() < (npc.getZ() - 100)) && (obj.getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
int skillRange = 150;
if (skill != null)
continue;
}
int skillRange = 150;
if (skill != null)
{
switch (skill.getId())
{
switch (skill.getId())
case FRINTEZZA_DAEMON_ATTACK:
{
case FRINTEZZA_DAEMON_ATTACK:
{
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((Creature) obj).isDead())
{
result.add((Creature) obj);
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((Creature) obj).isDead())
{
result.add(obj);
}
}
}

View File

@@ -198,51 +198,48 @@ public class MonsterArena extends AbstractInstance
case "supply_reward":
{
final Instance world = npc.getInstanceWorld();
if ((world != null) && (npc.getId() == SUPPLIES) && (player.getLevel() > 39))
if ((world != null) && (npc.getId() == SUPPLIES) && (player.getLevel() > 39) && !REWARDED_PLAYERS.contains(player) && npc.isScriptValue(0))
{
if (!REWARDED_PLAYERS.contains(player) && npc.isScriptValue(0))
npc.setScriptValue(1);
npc.doDie(npc);
REWARDED_PLAYERS.add(player);
ThreadPool.schedule(() ->
{
npc.setScriptValue(1);
npc.doDie(npc);
REWARDED_PLAYERS.add(player);
ThreadPool.schedule(() ->
{
REWARDED_PLAYERS.remove(player);
}, 60000);
// Mandatory reward.
final Npc machine = world.getNpc(MACHINE);
final int progress = GlobalVariablesManager.getInstance().getInt(MONSTER_ARENA_VARIABLE + machine.getScriptValue());
if (progress > 16)
{
giveItems(player, BATTLE_BOX_4, 1);
}
else if (progress > 11)
{
giveItems(player, BATTLE_BOX_3, 1);
}
else if (progress > 6)
{
giveItems(player, BATTLE_BOX_2, 1);
}
else
{
giveItems(player, BATTLE_BOX_1, 1);
}
// Rare reward.
if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_L, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_M, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_H, 1);
}
REWARDED_PLAYERS.remove(player);
}, 60000);
// Mandatory reward.
final Npc machine = world.getNpc(MACHINE);
final int progress = GlobalVariablesManager.getInstance().getInt(MONSTER_ARENA_VARIABLE + machine.getScriptValue());
if (progress > 16)
{
giveItems(player, BATTLE_BOX_4, 1);
}
else if (progress > 11)
{
giveItems(player, BATTLE_BOX_3, 1);
}
else if (progress > 6)
{
giveItems(player, BATTLE_BOX_2, 1);
}
else
{
giveItems(player, BATTLE_BOX_1, 1);
}
// Rare reward.
if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_L, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_M, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_H, 1);
}
}
break;

View File

@@ -180,6 +180,7 @@ public class ResidenceOfQueenNebula extends AbstractInstance
{
world.finishInstance();
}
break;
}
case WATER_SLIME:
{
@@ -217,6 +218,7 @@ public class ResidenceOfQueenNebula extends AbstractInstance
skill.applyEffects(player, player);
}
}
break;
}
}

View File

@@ -163,12 +163,9 @@ public class SevenSignsRBs extends AbstractInstance
{
for (Creature charInside : _anakim_zone.getCharactersInside())
{
if (charInside != null)
if ((charInside != null) && charInside.isPlayer())
{
if (charInside.isPlayer())
{
charInside.teleToLocation(-20185 + getRandom(50), 13476 + getRandom(50), -4901);
}
charInside.teleToLocation(-20185 + getRandom(50), 13476 + getRandom(50), -4901);
}
}
break;
@@ -177,12 +174,9 @@ public class SevenSignsRBs extends AbstractInstance
{
for (Creature charInside : _lilith_zone.getCharactersInside())
{
if (charInside != null)
if ((charInside != null) && charInside.isPlayer())
{
if (charInside.isPlayer())
{
charInside.teleToLocation(171346 + getRandom(50), -17599 + getRandom(50), -4901);
}
charInside.teleToLocation(171346 + getRandom(50), -17599 + getRandom(50), -4901);
}
}
break;

View File

@@ -154,7 +154,7 @@ public class Q00255_Tutorial extends Quest
return null;
}
String htmltext = null;
final String htmltext = null;
switch (event)
{
case "start_newbie_tutorial":

View File

@@ -89,7 +89,7 @@ public class Q00300_HuntingLetoLizardman extends Quest
if (getQuestItemsCount(player, BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT)
{
takeItems(player, BRACELET_OF_LIZARDMAN, -1);
int rand = getRandom(1000);
final int rand = getRandom(1000);
if (rand < 500)
{
giveItems(player, REWARD_ADENA);

View File

@@ -72,7 +72,7 @@ public class Q00326_VanquishRemnants extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -345,7 +345,7 @@ public class Q00327_RecoverTheFarmland extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
if ((npc.getId() == TUREK_ORK_SHAMAN) || (npc.getId() == TUREK_ORK_WARLORD))
{

View File

@@ -74,7 +74,7 @@ public class Q00328_SenseForBusiness extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -68,7 +68,7 @@ public class Q00331_ArrowOfVengeance extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{
@@ -132,30 +132,27 @@ public class Q00331_ArrowOfVengeance extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isPet)
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if ((qs != null) && (getRandom(100) < MONSTERS.get(npc.getId())))
{
if (getRandom(100) < MONSTERS.get(npc.getId()))
switch (npc.getId())
{
switch (npc.getId())
case 20145:
{
case 20145:
{
giveItems(player, HARPY_FEATHER, 1);
break;
}
case 20158:
{
giveItems(player, MEDUSA_VENOM, 1);
break;
}
case 20176:
{
giveItems(player, WYRMS_TOOTH, 1);
break;
}
giveItems(player, HARPY_FEATHER, 1);
break;
}
case 20158:
{
giveItems(player, MEDUSA_VENOM, 1);
break;
}
case 20176:
{
giveItems(player, WYRMS_TOOTH, 1);
break;
}
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
return super.onKill(npc, player, isPet);
}

View File

@@ -1050,7 +1050,7 @@ public class Q00333_HuntOfTheBlackLion extends Quest
final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON);
if (itemcount < 20)
{
// Do nothing?
}
else if (itemcount < 50)
{
@@ -1081,7 +1081,7 @@ public class Q00333_HuntOfTheBlackLion extends Quest
final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON);
if (itemcount < 20)
{
// Do nothing?
}
else if (itemcount < 50)
{

View File

@@ -44,7 +44,7 @@ public class Q00344_1000YearsTheEndOfLamentation extends Quest
private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1);
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
// Monsters
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant

View File

@@ -112,9 +112,9 @@ public class Q00354_ConquestOfAlligatorIsland extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (MOB1.containsKey(npcId))
{
giveItemRandomly(qs.getPlayer(), npc, ALLIGATOR_TOOTH, 1, 0, MOB1.get(npcId), true);

View File

@@ -217,7 +217,7 @@ public class Q00355_FamilyHonor extends Quest
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
QuestState qs = getQuestState(player, true);
final QuestState qs = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (qs.isCreated())
{

View File

@@ -116,7 +116,7 @@ public class Q00369_CollectorOfJewels extends Quest
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance())
{
PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
final PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
final QuestState qs = getQuestState(luckyPlayer, false);

View File

@@ -127,12 +127,12 @@ public class Q00370_AnElderSowsSeeds extends Quest
@Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (MOBS1.containsKey(npcId))
{
if (getRandom(100) < MOBS1.get(npcId))
{
PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
final PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
giveItemRandomly(luckyPlayer, npc, SPELLBOOK_PAGE, 1, 0, 1.0, true);
@@ -142,7 +142,7 @@ public class Q00370_AnElderSowsSeeds extends Quest
else
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, SPELLBOOK_PAGE, 1, 0, MOBS2.get(npcId), true);
}

View File

@@ -238,12 +238,12 @@ public class Q00662_AGameOfCards extends Quest
{
final int cond = qs.getInt("v1");
int i1 = qs.getInt("ExMemoState");
int i5 = i1 % 100;
final int i5 = i1 % 100;
int i9 = i1 / 100;
i1 = cond % 100;
int i2 = (cond % 10000) / 100;
int i3 = (cond % 1000000) / 10000;
int i4 = (cond % 100000000) / 1000000;
final int i2 = (cond % 10000) / 100;
final int i3 = (cond % 1000000) / 10000;
final int i4 = (cond % 100000000) / 1000000;
switch (event)
{
case "turncard1":
@@ -531,52 +531,52 @@ public class Q00662_AGameOfCards extends Quest
{
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
htmltext = htmltext.replace("FontColor1", "FFFF00");
htmltext = htmltext.replace("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = htmltext.replace("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
htmltext = htmltext.replace("FontColor2", "FFFF00");
htmltext = htmltext.replace("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = htmltext.replace("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
htmltext = htmltext.replace("FontColor3", "FFFF00");
htmltext = htmltext.replace("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = htmltext.replace("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
htmltext = htmltext.replace("FontColor4", "FFFF00");
htmltext = htmltext.replace("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = htmltext.replace("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
htmltext = htmltext.replace("FontColor5", "FFFF00");
htmltext = htmltext.replace("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = htmltext.replace("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
@@ -612,66 +612,66 @@ public class Q00662_AGameOfCards extends Quest
}
else if (qs.getInt("ExMemoState") != 0)
{
int i0 = qs.getInt("v1");
final int i0 = qs.getInt("v1");
int i1 = qs.getInt("ExMemoState");
int i5 = i1 % 100;
int i9 = i1 / 100;
final int i5 = i1 % 100;
final int i9 = i1 / 100;
i1 = i0 % 100;
int i2 = (i0 % 10000) / 100;
int i3 = (i0 % 1000000) / 10000;
int i4 = (i0 % 100000000) / 1000000;
final int i2 = (i0 % 10000) / 100;
final int i3 = (i0 % 1000000) / 10000;
final int i4 = (i0 % 100000000) / 1000000;
htmltext = getHtm(player, "30845-11a.html");
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
htmltext = htmltext.replace("FontColor1", "FFFF00");
htmltext = htmltext.replace("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = htmltext.replace("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
htmltext = htmltext.replace("FontColor2", "FFFF00");
htmltext = htmltext.replace("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = htmltext.replace("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
htmltext = htmltext.replace("FontColor3", "FFFF00");
htmltext = htmltext.replace("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = htmltext.replace("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
htmltext = htmltext.replace("FontColor4", "FFFF00");
htmltext = htmltext.replace("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = htmltext.replace("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
htmltext = htmltext.replace("FontColor5", "FFFF00");
htmltext = htmltext.replace("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = htmltext.replace("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
@@ -710,7 +710,7 @@ public class Q00662_AGameOfCards extends Quest
if (MONSTERS.get(npc.getId()) < getRandom(1000))
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, RED_GEM, 1, 0, MONSTERS.get(npc.getId()), true);
}

View File

@@ -163,8 +163,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -186,8 +186,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -209,8 +209,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
}
return htmltext;

View File

@@ -43,9 +43,9 @@ public class Q10966_ATripBegins extends Quest
private static final int BELLA = 30256;
// Items
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 10);// TODO: Replace with Advanced Scroll of Escape Event(s)
private static final ItemHolder TALISMAN_OF_ADEN = new ItemHolder(91745, 1);// TODO: Fix item
private static final ItemHolder SCROLL_OF_ENCHANT_TALISMAN_OF_ADEN = new ItemHolder(91756, 1);// TODO: Fix item
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 10); // TODO: Replace with Advanced Scroll of Escape Event(s)
private static final ItemHolder TALISMAN_OF_ADEN = new ItemHolder(91745, 1); // TODO: Fix item
private static final ItemHolder SCROLL_OF_ENCHANT_TALISMAN_OF_ADEN = new ItemHolder(91756, 1); // TODO: Fix item
private static final ItemHolder ADVENTURERS_BRACELET = new ItemHolder(91934, 1);
// Monsters
private static final int ARACHNID_PREDATOR = 20926;

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
* Cultured Adventurer (10967)
* @author RobikBobik
* @Note: Based on NA server September 2019
* @TODO: Maybe wrong NpcStringId when you killing monsters in Abandoned Camp
* @TODO: Maybe wrong NpcStringId when you killing monsters in Abandoned Camp
*/
public class Q10967_CulturedAdventurer extends Quest
{

View File

@@ -47,7 +47,7 @@ public class Q10982_SpiderHunt extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -149,8 +149,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -168,8 +168,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -187,8 +187,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;

View File

@@ -47,7 +47,7 @@ public class Q10984_CollectSpiderweb extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -149,8 +149,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -168,8 +168,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -187,8 +187,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;

View File

@@ -48,7 +48,7 @@ public class Q10986_SwampMonster extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -150,8 +150,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -169,8 +169,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -188,8 +188,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;

View File

@@ -48,7 +48,7 @@ public class Q10988_Conspiracy extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -150,8 +150,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -169,8 +169,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -188,8 +188,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;

View File

@@ -46,7 +46,7 @@ public class Q10990_PoisonExtraction extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -148,8 +148,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -167,8 +167,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -186,8 +186,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;