Minor code improvements.

This commit is contained in:
MobiusDev
2016-12-11 20:32:47 +00:00
parent 6a2ccc62e4
commit 70f0330eb0
182 changed files with 1006 additions and 1328 deletions
@@ -1391,15 +1391,12 @@ public class L2Clan implements IIdentifiable, INamable
temp.getPlayerInstance().sendSkillList();
}
}
else
else if (temp.getPledgeType() == subType)
{
if (temp.getPledgeType() == subType)
{
temp.getPlayerInstance().addSkill(newSkill, false); // Skill is not saved to player DB
temp.getPlayerInstance().sendPacket(new ExSubPledgeSkillAdd(subType, newSkill.getId(), newSkill.getLevel()));
temp.getPlayerInstance().sendPacket(sm);
temp.getPlayerInstance().sendSkillList();
}
temp.getPlayerInstance().addSkill(newSkill, false); // Skill is not saved to player DB
temp.getPlayerInstance().sendPacket(new ExSubPledgeSkillAdd(subType, newSkill.getId(), newSkill.getLevel()));
temp.getPlayerInstance().sendPacket(sm);
temp.getPlayerInstance().sendSkillList();
}
}
}
@@ -312,6 +312,6 @@ public final class L2SkillLearn
public String toString()
{
final Skill skill = SkillData.getInstance().getSkill(_skillId, _skillLvl);
return "[" + skill.toString() + " treeId: " + _treeId + " row: " + _row + " column: " + _column + " pointsRequired:" + _pointsRequired + "]";
return "[" + skill + " treeId: " + _treeId + " row: " + _row + " column: " + _column + " pointsRequired:" + _pointsRequired + "]";
}
}
@@ -558,23 +558,18 @@ public class L2Attackable extends L2Npc
}
rewards.remove(partyPlayer); // Remove the L2PcInstance from the L2Attackable rewards
}
else
else if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, partyPlayer, true))
{
// Add L2PcInstance of the party (that have attacked or not) to members that can be rewarded
// and in range of the monster.
if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, partyPlayer, true))
rewardedMembers.add(partyPlayer);
if (partyPlayer.getLevel() > partyLvl)
{
rewardedMembers.add(partyPlayer);
if (partyPlayer.getLevel() > partyLvl)
if (attackerParty.isInCommandChannel())
{
if (attackerParty.isInCommandChannel())
{
partyLvl = attackerParty.getCommandChannel().getLevel();
}
else
{
partyLvl = partyPlayer.getLevel();
}
partyLvl = attackerParty.getCommandChannel().getLevel();
}
else
{
partyLvl = partyPlayer.getLevel();
}
}
}
@@ -331,17 +331,14 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
addSkill(skill);
}
}
else
else if (isSummon())
{
if (isSummon())
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
addSkill(skill);
}
}
@@ -1125,12 +1122,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return;
}
}
else
else if (_disableRangedAttackEndTime > GameTimeController.getInstance().getGameTicks())
{
if (_disableRangedAttackEndTime > GameTimeController.getInstance().getGameTicks())
{
return;
}
return;
}
}
@@ -1635,7 +1629,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param itemObjId the item object ID
* @return if the item has a reuse time stamp, the remaining time, otherwise -1
*/
public synchronized final long getItemRemainingReuseTime(int itemObjId)
public final synchronized long getItemRemainingReuseTime(int itemObjId)
{
final TimeStamp reuseStamp = (_reuseTimeStampsItems != null) ? _reuseTimeStampsItems.get(itemObjId) : null;
return reuseStamp != null ? reuseStamp.getRemaining() : -1;
@@ -1706,7 +1700,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* Removes a skill reuse time stamp.
* @param skill the skill to remove
*/
public synchronized final void removeTimeStamp(Skill skill)
public final synchronized void removeTimeStamp(Skill skill)
{
if (_reuseTimeStampsSkills != null)
{
@@ -1717,7 +1711,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/**
* Removes all skill reuse time stamps.
*/
public synchronized final void resetTimeStamps()
public final synchronized void resetTimeStamps()
{
if (_reuseTimeStampsSkills != null)
{
@@ -1730,7 +1724,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return if the skill has a reuse time stamp, the remaining time, otherwise -1
*/
public synchronized final long getSkillRemainingReuseTime(long hashCode)
public final synchronized long getSkillRemainingReuseTime(long hashCode)
{
final TimeStamp reuseStamp = (_reuseTimeStampsSkills != null) ? _reuseTimeStampsSkills.get(hashCode) : null;
return reuseStamp != null ? reuseStamp.getRemaining() : -1;
@@ -1741,7 +1735,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return {@code true} if the skill is under reuse time, {@code false} otherwise
*/
public synchronized final boolean hasSkillReuse(long hashCode)
public final synchronized boolean hasSkillReuse(long hashCode)
{
final TimeStamp reuseStamp = (_reuseTimeStampsSkills != null) ? _reuseTimeStampsSkills.get(hashCode) : null;
return (reuseStamp != null) && reuseStamp.hasNotPassed();
@@ -1752,7 +1746,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return if the skill has a reuse time stamp, the skill reuse time stamp, otherwise {@code null}
*/
public synchronized final TimeStamp getSkillReuseTimeStamp(long hashCode)
public final synchronized TimeStamp getSkillReuseTimeStamp(long hashCode)
{
return _reuseTimeStampsSkills != null ? _reuseTimeStampsSkills.get(hashCode) : null;
}
@@ -1809,7 +1803,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/**
* Removes all the disabled skills.
*/
public synchronized final void resetDisabledSkills()
public final synchronized void resetDisabledSkills()
{
if (_disabledSkills != null)
{
@@ -3018,12 +3012,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
player.broadcastCharInfo();
}
else
else if (su.hasUpdates())
{
if (su.hasUpdates())
{
broadcastPacket(su);
}
broadcastPacket(su);
}
if (hasServitors() && isAffected(EffectFlag.SERVITOR_SHARE))
{
@@ -651,12 +651,9 @@ public class L2Npc extends L2Character
return temp;
}
}
else
else if (HtmCache.getInstance().isLoadable(temp))
{
if (HtmCache.getInstance().isLoadable(temp))
{
return temp;
}
return temp;
}
// If the file is not found, the standard message "I have nothing to say to you" is returned
@@ -850,16 +850,13 @@ public abstract class L2Summon extends L2Playable
activeChar.sendPacket(new PetItemList(getInventory().getItems()));
}
}
else if (isPet())
{
activeChar.sendPacket(new ExPetInfo(this, activeChar, 0));
}
else
{
if (isPet())
{
activeChar.sendPacket(new ExPetInfo(this, activeChar, 0));
}
else
{
activeChar.sendPacket(new SummonInfo(this, activeChar, 0));
}
activeChar.sendPacket(new SummonInfo(this, activeChar, 0));
}
}
@@ -92,12 +92,9 @@ public class DoppelgangerInstance extends L2Npc
getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, getSummoner());
}
}
else
else if (getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)
{
if (getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
}
@@ -371,9 +371,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional HP recovery for clan members in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery hp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional HP recovery for clan members in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery hp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -394,9 +394,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_MPREG2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional MP recovery for clan members in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery mp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional MP recovery for clan members in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery mp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -417,9 +417,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_EXPREG2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Restores the Exp of any clan member who is resurrected in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery exp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Restores the Exp of any clan member who is resurrected in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery exp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -440,7 +440,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -485,7 +485,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -530,7 +530,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -566,7 +566,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
final String mp = "[<a action=\"bypass -h npc_%objectId%_manage recovery edit_mp 40\">40%</a>][<a action=\"bypass -h npc_%objectId%_manage recovery edit_mp 50\">50%</a>]";
if (getFort().getFortFunction(Fort.FUNC_RESTORE_HP) != null)
{
html.replace("%hp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%hp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLease() + "</font>Adena /" + (Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%hp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getEndTime()));
html.replace("%change_hp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery hp_cancel\">Deactivate</a>]" + hp);
}
@@ -578,7 +578,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_RESTORE_EXP) != null)
{
html.replace("%exp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%exp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLease() + "</font>Adena /" + (Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%exp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getEndTime()));
html.replace("%change_exp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery exp_cancel\">Deactivate</a>]" + exp);
}
@@ -590,7 +590,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_RESTORE_MP) != null)
{
html.replace("%mp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%mp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLease() + "</font>Adena /" + (Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%mp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getEndTime()));
html.replace("%change_mp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery mp_cancel\">Deactivate</a>]" + mp);
}
@@ -645,9 +645,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_SUPPORT2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Enables the use of supplementary magic.");
html.replace("%apply%", "other support " + String.valueOf(stage));
html.replace("%apply%", "other support " + stage);
sendHtmlMessage(player, html);
return;
}
@@ -668,9 +668,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_TELE2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Teleports clan members in a fort to the target <font color=\"00FFFF\">Stage " + String.valueOf(stage) + "</font> staging area");
html.replace("%apply%", "other tele " + String.valueOf(stage));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Teleports clan members in a fort to the target <font color=\"00FFFF\">Stage " + stage + "</font> staging area");
html.replace("%apply%", "other tele " + stage);
sendHtmlMessage(player, html);
return;
}
@@ -691,7 +691,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", "Stage " + String.valueOf(val));
html.replace("%val%", "Stage " + val);
sendHtmlMessage(player, html);
return;
}
@@ -736,7 +736,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", "Stage " + String.valueOf(val));
html.replace("%val%", "Stage " + val);
sendHtmlMessage(player, html);
return;
}
@@ -774,7 +774,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
final String support = "[<a action=\"bypass -h npc_%objectId%_manage other edit_support 1\">Level 1</a>][<a action=\"bypass -h npc_%objectId%_manage other edit_support 2\">Level 2</a>]";
if (getFort().getFortFunction(Fort.FUNC_TELEPORT) != null)
{
html.replace("%tele%", "Stage " + String.valueOf(getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl()) + "</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_TELEPORT).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%tele%", "Stage " + getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl() + "</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_TELEPORT).getLease() + "</font>Adena /" + (Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%tele_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_TELEPORT).getEndTime()));
html.replace("%change_tele%", "[<a action=\"bypass -h npc_%objectId%_manage other tele_cancel\">Deactivate</a>]" + tele);
}
@@ -786,7 +786,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_SUPPORT) != null)
{
html.replace("%support%", "Stage " + String.valueOf(getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl()) + "</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_SUPPORT).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%support%", "Stage " + getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl() + "</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_SUPPORT).getLease() + "</font>Adena /" + (Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%support_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_SUPPORT).getEndTime()));
html.replace("%change_support%", "[<a action=\"bypass -h npc_%objectId%_manage other support_cancel\">Deactivate</a>]" + support);
}
@@ -850,19 +850,16 @@ public class L2FortManagerInstance extends L2MerchantInstance
{
player.doCast(skill);
}
else if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp()))
{
doCast(skill);
}
else
{
if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp()))
{
this.doCast(skill);
}
else
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-no_mana.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
sendHtmlMessage(player, html);
return;
}
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-no_mana.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
sendHtmlMessage(player, html);
return;
}
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-done.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
@@ -146,18 +146,15 @@ public class L2NpcInstance extends L2Npc
sm.addInt(minLevel);
player.sendPacket(sm);
}
else if (player.getClassId().level() == 1)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN_PLEASE_COME_BACK_AFTER_S1ND_CLASS_CHANGE);
sm.addInt(2);
player.sendPacket(sm);
}
else
{
if (player.getClassId().level() == 1)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN_PLEASE_COME_BACK_AFTER_S1ND_CLASS_CHANGE);
sm.addInt(2);
player.sendPacket(sm);
}
else
{
player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
}
else
@@ -49,16 +49,13 @@ public final class L2ObservationInstance extends L2Npc
filename = "data/html/observation/" + getId() + "-Oracle-" + val + ".htm";
}
}
else if (val == 0)
{
filename = "data/html/observation/" + getId() + ".htm";
}
else
{
if (val == 0)
{
filename = "data/html/observation/" + getId() + ".htm";
}
else
{
filename = "data/html/observation/" + getId() + "-" + val + ".htm";
}
filename = "data/html/observation/" + getId() + "-" + val + ".htm";
}
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
@@ -3287,20 +3287,17 @@ public final class L2PcInstance extends L2Playable
sendPacket(sm);
}
}
else if (process.equalsIgnoreCase("Sweeper") || process.equalsIgnoreCase("Quest"))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
else
{
if (process.equalsIgnoreCase("Sweeper") || process.equalsIgnoreCase("Quest"))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
}
@@ -3967,18 +3964,15 @@ public final class L2PcInstance extends L2Playable
{
client.cleanMe(true);
}
else
else if (client.getChannel().isActive())
{
if (client.getChannel().isActive())
if (closeClient)
{
if (closeClient)
{
client.close(LeaveWorld.STATIC_PACKET);
}
else
{
client.close(ServerClose.STATIC_PACKET);
}
client.close(LeaveWorld.STATIC_PACKET);
}
else
{
client.close(ServerClose.STATIC_PACKET);
}
}
}
@@ -4372,13 +4366,9 @@ public final class L2PcInstance extends L2Playable
}
}
else
else if (target != null) // _interactTarget=null should never happen but one never knows ^^;
{
// _interactTarget=null should never happen but one never knows ^^;
if (target != null)
{
target.onAction(this);
}
target.onAction(this);
}
}
@@ -5257,19 +5247,16 @@ public final class L2PcInstance extends L2Playable
player.setPvpKills(player.getPvpKills() + 1);
}
else if ((getReputation() > 0) && (getPkKills() == 0))
{
player.setReputation(0);
player.setPkKills(player.getPkKills() + 1);
}
else
{
if ((getReputation() > 0) && (getPkKills() == 0))
{
player.setReputation(0);
player.setPkKills(player.getPkKills() + 1);
}
else
{
// Calculate new karma and increase pk count
player.setReputation(player.getReputation() - Formulas.calculateKarmaGain(player.getPkKills(), killedPlayable.isSummon()));
player.setPkKills(player.getPkKills() + 1);
}
// Calculate new karma and increase pk count
player.setReputation(player.getReputation() - Formulas.calculateKarmaGain(player.getPkKills(), killedPlayable.isSummon()));
player.setPkKills(player.getPkKills() + 1);
}
final UserInfo ui = new UserInfo(this, false);
@@ -9288,7 +9275,7 @@ public final class L2PcInstance extends L2Playable
public void sendSkillList(int lastLearnedSkillId)
{
boolean isDisabled = false;
SkillList sl = new SkillList();
final SkillList sl = new SkillList();
for (Skill s : getSkillList())
{
@@ -9969,16 +9956,13 @@ public final class L2PcInstance extends L2Playable
{
reviver.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
}
else if (Pet)
{
reviver.sendPacket(SystemMessageId.A_PET_CANNOT_BE_RESURRECTED_WHILE_IT_S_OWNER_IS_IN_THE_PROCESS_OF_RESURRECTING); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
}
else
{
if (Pet)
{
reviver.sendPacket(SystemMessageId.A_PET_CANNOT_BE_RESURRECTED_WHILE_IT_S_OWNER_IS_IN_THE_PROCESS_OF_RESURRECTING); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
}
else
{
reviver.sendPacket(SystemMessageId.WHILE_A_PET_IS_BEING_RESURRECTED_IT_CANNOT_HELP_IN_RESURRECTING_ITS_MASTER); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
}
reviver.sendPacket(SystemMessageId.WHILE_A_PET_IS_BEING_RESURRECTED_IT_CANNOT_HELP_IN_RESURRECTING_ITS_MASTER); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
}
return;
}
@@ -10190,13 +10174,10 @@ public final class L2PcInstance extends L2Playable
}
}
}
else
else if (_teleportWatchdog != null)
{
if (_teleportWatchdog != null)
{
_teleportWatchdog.cancel(false);
_teleportWatchdog = null;
}
_teleportWatchdog.cancel(false);
_teleportWatchdog = null;
}
}
@@ -214,7 +214,7 @@ public class L2PetInstance extends L2Summon
}
}
public synchronized static L2PetInstance spawnPet(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
public static synchronized L2PetInstance spawnPet(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
{
if (L2World.getInstance().getPet(owner.getObjectId()) != null)
{
@@ -162,7 +162,7 @@ public final class L2StaticObjectInstance extends L2Character
public void setMeshIndex(int meshIndex)
{
_meshIndex = meshIndex;
this.broadcastPacket(new StaticObject(this));
broadcastPacket(new StaticObject(this));
}
/**
@@ -257,7 +257,7 @@ public enum PlayerClass
_type = pType;
}
public static final EnumSet<PlayerClass> getSet(Race race, ClassLevel level)
public static EnumSet<PlayerClass> getSet(Race race, ClassLevel level)
{
final EnumSet<PlayerClass> allOf = EnumSet.noneOf(PlayerClass.class);
@@ -80,7 +80,8 @@ public class CubicInstance
double commulativeChance = 0;
for (CubicSkill cubicSkill : _template.getSkills())
{
if ((commulativeChance += cubicSkill.getTriggerRate()) > random)
commulativeChance += cubicSkill.getTriggerRate();
if (commulativeChance > random)
{
final Skill skill = cubicSkill.getSkill();
if ((skill != null) && (Rnd.get(100) < cubicSkill.getSuccessRate()))
@@ -24,7 +24,7 @@ import com.l2jmobius.gameserver.model.cubic.conditions.ICubicCondition;
*/
public interface ICubicConditionHolder
{
public boolean validateConditions(CubicInstance cubic, L2Character owner, L2Character target);
boolean validateConditions(CubicInstance cubic, L2Character owner, L2Character target);
public void addCondition(ICubicCondition condition);
void addCondition(ICubicCondition condition);
}
@@ -24,5 +24,5 @@ import com.l2jmobius.gameserver.model.cubic.CubicInstance;
*/
public interface ICubicCondition
{
public boolean test(CubicInstance cubic, L2Character owner, L2Character target);
boolean test(CubicInstance cubic, L2Character owner, L2Character target);
}
@@ -353,16 +353,13 @@ public final class Castle extends AbstractResidence
}
_treasury -= amount;
}
else if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
_treasury += amount;
}
_treasury += amount;
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
@@ -750,26 +747,23 @@ public final class Castle extends AbstractResidence
{
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, 0, false));
}
else if ((lvl == 0) && (lease == 0))
{
removeFunction(type);
}
else
{
if ((lvl == 0) && (lease == 0))
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
removeFunction(type);
_function.remove(type);
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
_function.remove(type);
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
}
return true;
@@ -920,20 +920,17 @@ public class Duel
}
}
else
else if (player == _playerA)
{
if (player == _playerA)
{
_surrenderRequest = 1;
_playerA.setDuelState(DUELSTATE_DEAD);
_playerB.setDuelState(DUELSTATE_WINNER);
}
else if (player == _playerB)
{
_surrenderRequest = 2;
_playerB.setDuelState(DUELSTATE_DEAD);
_playerA.setDuelState(DUELSTATE_WINNER);
}
_surrenderRequest = 1;
_playerA.setDuelState(DUELSTATE_DEAD);
_playerB.setDuelState(DUELSTATE_WINNER);
}
else if (player == _playerB)
{
_surrenderRequest = 2;
_playerB.setDuelState(DUELSTATE_DEAD);
_playerA.setDuelState(DUELSTATE_WINNER);
}
}
@@ -268,11 +268,7 @@ public final class Fort extends AbstractResidence
*/
public FortFunction getFortFunction(int type)
{
if (_function.get(type) != null)
{
return _function.get(type);
}
return null;
return _function.get(type);
}
public void endOfSiege(L2Clan clan)
@@ -690,26 +686,23 @@ public final class Fort extends AbstractResidence
{
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, 0, false));
}
else if ((lvl == 0) && (lease == 0))
{
removeFunction(type);
}
else
{
if ((lvl == 0) && (lease == 0))
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
removeFunction(type);
_function.remove(type);
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
final int diffLease = lease - _function.get(type).getLease();
if (diffLease > 0)
{
_function.remove(type);
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
}
else
{
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
_function.get(type).setLease(lease);
_function.get(type).setLvl(lvl);
_function.get(type).dbSave();
}
}
return true;
@@ -169,7 +169,7 @@ public class FortSiege implements Siegable
}
else
{
_log.warning(getClass().getSimpleName() + ": Exception: ScheduleStartSiegeTask(): unknown siege time: " + String.valueOf(_time));
_log.warning(getClass().getSimpleName() + ": Exception: ScheduleStartSiegeTask(): unknown siege time: " + _time);
}
}
catch (Exception e)
@@ -1454,12 +1454,9 @@ public class Siege implements Siegable
return;
}
}
else
else if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans())
{
if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans())
{
return;
}
return;
}
if (!isUpdateRegistration)
@@ -1668,10 +1665,6 @@ public class Siege implements Siegable
public final Castle getCastle()
{
if (_castle == null)
{
return null;
}
return _castle;
}
@@ -21,7 +21,7 @@ package com.l2jmobius.gameserver.model.eventengine;
*/
public interface IConditionalEventScheduler
{
public boolean test();
boolean test();
public void run();
void run();
}
@@ -25,5 +25,5 @@ import com.l2jmobius.gameserver.model.holders.ItemHolder;
*/
public interface IEventDrop
{
public Collection<ItemHolder> calculateDrops();
Collection<ItemHolder> calculateDrops();
}
@@ -2438,21 +2438,18 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
player.sendPacket(smsg);
}
// Otherwise, send message of object reward to client
else if (count > 1)
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
smsg.addItemName(item);
smsg.addLong(count);
player.sendPacket(smsg);
}
else
{
if (count > 1)
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
smsg.addItemName(item);
smsg.addLong(count);
player.sendPacket(smsg);
}
else
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
smsg.addItemName(item);
player.sendPacket(smsg);
}
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
smsg.addItemName(item);
player.sendPacket(smsg);
}
// send packets
player.sendPacket(new ExUserInfoInvenWeight(player));
@@ -23,7 +23,7 @@ import com.l2jmobius.gameserver.model.html.IBypassFormatter;
*/
public class DefaultFormatter implements IBypassFormatter
{
public final static DefaultFormatter INSTANCE = new DefaultFormatter();
public static final DefaultFormatter INSTANCE = new DefaultFormatter();
@Override
public String formatBypass(String bypass, int page)
@@ -402,12 +402,9 @@ public final class Instance implements IIdentifiable, INamable
door.openMe();
}
}
else
else if (door.isOpen())
{
if (door.isOpen())
{
door.closeMe();
}
door.closeMe();
}
}
}
@@ -55,7 +55,7 @@ public final class AuctionDateGenerator
checkMinuteOfHour(0);
}
public synchronized final long nextDate(long date)
public final synchronized long nextDate(long date)
{
_calendar.setTimeInMillis(date);
_calendar.set(Calendar.MILLISECOND, 0);
@@ -412,7 +412,7 @@ public final class ItemAuctionInstance
{
if (!_auction.setAuctionState(state, ItemAuctionState.STARTED))
{
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED.toString() + ", expected: " + state.toString());
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED + ", expected: " + state);
}
LOGGER.info(getClass().getSimpleName() + ": Auction " + _auction.getAuctionId() + " has started for instance " + _auction.getInstanceId());
@@ -470,7 +470,7 @@ public final class ItemAuctionInstance
if (!_auction.setAuctionState(state, ItemAuctionState.FINISHED))
{
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.FINISHED.toString() + ", expected: " + state.toString());
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.FINISHED + ", expected: " + state);
}
onAuctionFinished(_auction);
@@ -478,7 +478,7 @@ public abstract class ItemContainer
*/
public L2ItemInstance destroyItem(String process, L2ItemInstance item, L2PcInstance actor, Object reference)
{
return this.destroyItem(process, item, item.getCount(), actor, reference);
return destroyItem(process, item, item.getCount(), actor, reference);
}
/**
@@ -547,7 +547,7 @@ public abstract class ItemContainer
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**
@@ -580,7 +580,7 @@ public class PcInventory extends Inventory
@Override
public L2ItemInstance destroyItem(String process, L2ItemInstance item, L2PcInstance actor, Object reference)
{
return this.destroyItem(process, item, item.getCount(), actor, reference);
return destroyItem(process, item, item.getCount(), actor, reference);
}
/**
@@ -631,7 +631,7 @@ public class PcInventory extends Inventory
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**
@@ -651,7 +651,7 @@ public class PcInventory extends Inventory
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**
@@ -1430,7 +1430,7 @@ public final class L2ItemInstance extends L2Object
*/
public void updateDatabase()
{
this.updateDatabase(false);
updateDatabase(false);
}
/**
@@ -782,7 +782,7 @@ public class SkillCaster implements Runnable
@Override
public String toString()
{
return super.toString() + " [caster: " + String.valueOf(_caster.get()) + " skill: " + String.valueOf(_skill) + " target: " + String.valueOf(_target.get()) + " type: " + String.valueOf(_castingType) + "]";
return super.toString() + " [caster: " + _caster.get() + " skill: " + _skill + " target: " + _target.get() + " type: " + _castingType + "]";
}
/**
@@ -233,7 +233,8 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatsSet>
float cumulativeChance = 0;
for (ChanceLocation loc : _locations)
{
if (locRandom <= (cumulativeChance += loc.getChance()))
cumulativeChance += loc.getChance();
if (locRandom <= cumulativeChance)
{
return loc;
}
@@ -439,7 +439,7 @@ public final class Formulas
* @param skill
* @return the hit time of the skill.
*/
public static final int calcHitTime(L2Character creature, Skill skill)
public static int calcHitTime(L2Character creature, Skill skill)
{
int skillTime = skill.getHitTime() - SKILL_LAUNCH_TIME;
@@ -457,7 +457,7 @@ public final class Formulas
return Math.max(skillTime, 0);
}
public static final int calcSkillCancelTime(L2Character creature, Skill skill)
public static int calcSkillCancelTime(L2Character creature, Skill skill)
{
// Fishing skills.
if ((skill.getId() == 1312) || (skill.getId() == 1314) || (skill.getId() == 1315))
@@ -474,7 +474,7 @@ public final class Formulas
* @param skill
* @return
*/
public static final double calcSkillTimeFactor(L2Character creature, Skill skill)
public static double calcSkillTimeFactor(L2Character creature, Skill skill)
{
double factor = 0;
if (skill.isPhysical() || skill.isDance()) // is_magic = 0 or 3
@@ -980,18 +980,15 @@ public final class Formulas
attack_attribute = 0;
defence_attribute = target.getDefenseElementValue(AttributeType.NONE_ARMOR);
}
else if (attacker.getAttackElement() == skill.getAttributeType())
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
}
else
{
if (attacker.getAttackElement() == skill.getAttributeType())
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
}
else
{
attack_attribute = skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
}
attack_attribute = skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
}
}
else
@@ -569,5 +569,5 @@ public interface IStatsFunction
return Math.max(minValue, value);
}
public double calc(L2Character creature, Optional<Double> base, Stats stat);
double calc(L2Character creature, Optional<Double> base, Stats stat);
}
@@ -32,7 +32,7 @@ public class ShieldDefenceFinalizer implements IStatsFunction
{
throwIfPresent(base);
double baseValue = calcWeaponPlusBaseValue(creature, stat);
final double baseValue = calcWeaponPlusBaseValue(creature, stat);
return Stats.defaultValue(creature, stat, baseValue);
}
}
@@ -32,7 +32,7 @@ public class ShieldDefenceRateFinalizer implements IStatsFunction
{
throwIfPresent(base);
double baseValue = calcWeaponPlusBaseValue(creature, stat);
final double baseValue = calcWeaponPlusBaseValue(creature, stat);
return Stats.defaultValue(creature, stat, baseValue);
}
}