Proper naming for various methods and variables.

This commit is contained in:
MobiusDevelopment
2021-12-26 22:17:47 +00:00
parent f5f80399c5
commit 3e61211e14
369 changed files with 1098 additions and 1099 deletions

View File

@@ -58,10 +58,10 @@ public class Apprentice extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q10329_BackupSeekers.class.getSimpleName());
if ((qs != null) && qs.isStarted())
{
final Quest quest_10329 = QuestManager.getInstance().getQuest(Q10329_BackupSeekers.class.getSimpleName());
if (quest_10329 != null)
final Quest q10329 = QuestManager.getInstance().getQuest(Q10329_BackupSeekers.class.getSimpleName());
if (q10329 != null)
{
quest_10329.notifyEvent("RESPAWN_BART", null, player);
q10329.notifyEvent("RESPAWN_BART", null, player);
}
}
}

View File

@@ -50,7 +50,7 @@ public class Toyron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (event.equals("museum_teleport"))
{
if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))

View File

@@ -103,10 +103,10 @@ public class YeSegiraTeleportDevice extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q10365_SeekerEscort.class.getSimpleName());
if ((qs != null) && qs.isStarted() && qs.isCond(1))
{
final Quest quest_10365 = QuestManager.getInstance().getQuest(Q10365_SeekerEscort.class.getSimpleName());
if (quest_10365 != null)
final Quest q10365 = QuestManager.getInstance().getQuest(Q10365_SeekerEscort.class.getSimpleName());
if (q10365 != null)
{
quest_10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
q10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
}
}
}

View File

@@ -662,7 +662,7 @@ public class LastImperialTomb extends AbstractInstance
}
else // Teleport Cube
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -46,7 +46,7 @@ public class Lydia extends AbstractNpcAI
public String onFirstTalk(Npc npc, Player player)
{
String htmltext = null;
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && ((instance.getTemplateId() == OCTAVIS_TEMPLATE_ID) || (instance.getTemplateId() == OCTAVIS_EXTREME_TEMPLATE_ID)))
{
htmltext = "Lydia-02.html";

View File

@@ -138,7 +138,7 @@ public class OctavisWarzone extends AbstractInstance
}
case "reenterInstance":
{
final Instance activeInstance = getPlayer(player);
final Instance activeInstance = getPlayerInstance(player);
if (isInInstance(activeInstance))
{
enterInstance(player, npc, activeInstance.getTemplateId());

View File

@@ -194,9 +194,9 @@ public class TeredorWarzone extends AbstractInstance
}
case "checkConditions":
{
final Instance Player = getPlayer(player);
final Instance instance = getPlayerInstance(player);
final Party playerParty = player.getParty();
if ((Player != null) && (Player.getTemplateId() == TEMPLATE_ID))
if ((instance != null) && (instance.getTemplateId() == TEMPLATE_ID))
{
enterInstance(player, npc, TEMPLATE_ID);
}

View File

@@ -1234,7 +1234,7 @@ public class AdminEditChar implements IAdminCommandHandler
*/
private void findCharacter(Player activeChar, String characterToFind)
{
int CharactersFound = 0;
int charactersFound = 0;
String name;
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
adminReply.setFile(activeChar, "data/html/admin/charfind.htm");
@@ -1247,7 +1247,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName();
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound += 1;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@@ -1258,7 +1258,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1266,16 +1266,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Please try again.";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG2 = "s.<br>Please refine your search to see all of the results.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@@ -1284,7 +1284,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG2 = "s.";
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}

View File

@@ -66,9 +66,9 @@ public abstract class AbstractInstance extends AbstractNpcAI
* @param player player who wants get instance world
* @return instance world if found, otherwise null
*/
public Instance getPlayer(Player player)
public Instance getPlayerInstance(Player player)
{
return InstanceManager.getInstance().getPlayer(player, false);
return InstanceManager.getInstance().getPlayerInstance(player, false);
}
/**
@@ -107,7 +107,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
*/
protected final void enterInstance(Player player, Npc npc, int templateId)
{
Instance instance = getPlayer(player);
Instance instance = getPlayerInstance(player);
if (instance != null) // Player has already any instance active
{
if (instance.getTemplateId() != templateId)
@@ -153,7 +153,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
// Check if any player from enter group has active instance
for (Player member : enterGroup)
{
if (getPlayer(member) != null)
if (getPlayerInstance(member) != null)
{
enterGroup.forEach(p -> p.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return;

View File

@@ -74,7 +74,7 @@ public class EvasHiddenSpace extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -159,11 +159,11 @@ public class KartiaHelperAdolph extends AbstractNpcAI
if ((instance != null) && !npc.isCastingNow() && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
{
final StatSet instParams = instance.getTemplateParameters();
final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder skill1 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill2 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill3 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill4 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill5 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
final int numberOfActiveSkills = 5;
final int randomSkill = getRandom(numberOfActiveSkills + 1);
@@ -183,10 +183,10 @@ public class KartiaHelperAdolph extends AbstractNpcAI
case 0:
case 1:
{
if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
if ((skill1 != null) && SkillCaster.checkUseConditions(npc, skill1.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
npc.doCast(skill_01.getSkill(), null, true, false);
npc.doCast(skill1.getSkill(), null, true, false);
final List<Monster> monsterList = World.getInstance().getVisibleObjectsInRange(npc, Monster.class, 300);
if (!monsterList.isEmpty())
{
@@ -203,37 +203,37 @@ public class KartiaHelperAdolph extends AbstractNpcAI
}
case 2:
{
if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
if ((skill2 != null) && SkillCaster.checkUseConditions(npc, skill2.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE_3);
npc.doCast(skill_02.getSkill(), null, true, false);
npc.doCast(skill2.getSkill(), null, true, false);
}
break;
}
case 3:
{
if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
if ((skill3 != null) && SkillCaster.checkUseConditions(npc, skill3.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
npc.doCast(skill_03.getSkill(), null, true, false);
npc.doCast(skill3.getSkill(), null, true, false);
}
break;
}
case 4:
{
if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
if ((skill4 != null) && SkillCaster.checkUseConditions(npc, skill4.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
npc.doCast(skill_04.getSkill());
npc.doCast(skill4.getSkill());
}
break;
}
case 5:
{
if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
if ((skill5 != null) && SkillCaster.checkUseConditions(npc, skill5.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
npc.doCast(skill_05.getSkill(), null, true, false);
npc.doCast(skill5.getSkill(), null, true, false);
}
break;
}

View File

@@ -68,7 +68,7 @@ public class TalkingIslandPast extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -233,7 +233,7 @@ public class Q00129_PailakaDevilsLegacy extends Quest
}
else
{
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -200,7 +200,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
{
htmltext = getNoQuestLevelRewardMsg(player);
}
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -247,16 +247,16 @@ public class Q00350_EnhanceYourWeapon extends Quest
private static void exchangeCrystal(Player player, Attackable mob, int takeid, int giveid, boolean broke)
{
Item Item = player.getInventory().destroyItemByItemId("SoulCrystal", takeid, 1, player, mob);
if (Item != null)
Item item = player.getInventory().destroyItemByItemId("SoulCrystal", takeid, 1, player, mob);
if (item != null)
{
// Prepare inventory update packet
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addRemovedItem(Item);
playerIU.addRemovedItem(item);
// Add new crystal to the killer's inventory
Item = player.getInventory().addItem("SoulCrystal", giveid, 1, player, mob);
playerIU.addItem(Item);
item = player.getInventory().addItem("SoulCrystal", giveid, 1, player, mob);
playerIU.addItem(item);
// Send a sound event and text message to the player
if (broke)

View File

@@ -165,7 +165,7 @@ public class Q10284_AcquisitionOfDivineSword extends Quest
qs.unset("ex3");
qs.setCond(3, true);
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -103,7 +103,7 @@ public class Q10286_ReunionWithSirra extends Quest
{
qs.unset("ex");
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -202,7 +202,7 @@ public class Q10287_StoryOfThoseLeft extends Quest
qs.unset("ex1");
qs.unset("ex2");
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -432,7 +432,7 @@ public class InstanceManager implements IXmlReader
* @param isInside when {@code true} find world where player is currently located, otherwise find world where player can enter
* @return instance if found, otherwise {@code null}
*/
public Instance getPlayer(Player player, boolean isInside)
public Instance getPlayerInstance(Player player, boolean isInside)
{
for (Instance instance : _instanceWorlds.values())
{

View File

@@ -421,12 +421,12 @@ public abstract class ItemContainer
*/
public Item detachItem(String process, int itemObjectId, long count, ItemLocation newLocation, Player actor, Object reference)
{
final Item Item = getItemByObjectId(itemObjectId);
if (Item == null)
final Item item = getItemByObjectId(itemObjectId);
if (item == null)
{
return null;
}
return detachItem(process, Item, count, newLocation, actor, reference);
return detachItem(process, item, count, newLocation, actor, reference);
}
/**

View File

@@ -984,21 +984,21 @@ public class Formulas
*/
public static double calcAttributeBonus(Creature attacker, Creature target, Skill skill)
{
int attack_attribute;
int defence_attribute;
int attackAttribute;
int defenceAttribute;
if ((skill != null) && (skill.getAttributeType() != AttributeType.NONE))
{
attack_attribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
attackAttribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defenceAttribute = target.getDefenseElementValue(skill.getAttributeType());
}
else
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement());
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
attackAttribute = attacker.getAttackElementValue(attacker.getAttackElement());
defenceAttribute = target.getDefenseElementValue(attacker.getAttackElement());
}
final int diff = attack_attribute - defence_attribute;
final int diff = attackAttribute - defenceAttribute;
if (diff > 0)
{
return Math.min(1.025 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.25);

View File

@@ -171,7 +171,7 @@ public class EnterWorld implements IClientIncomingPacket
if (Config.RESTORE_PLAYER_INSTANCE)
{
final PlayerVariables vars = player.getVariables();
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getId() == vars.getInt("INSTANCE_RESTORE", 0)))
{
player.setInstance(instance);

View File

@@ -37,7 +37,7 @@ public class ExInzoneWaiting implements IClientOutgoingPacket
public ExInzoneWaiting(Player player)
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
_currentTemplateId = ((instance != null) && (instance.getTemplateId() >= 0)) ? instance.getTemplateId() : -1;
_instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
}

View File

@@ -68,7 +68,7 @@ public class ExListPartyMatchingWaitingRoom implements IClientOutgoingPacket
packet.writeS(player.getName());
packet.writeD(player.getClassId().getId());
packet.writeD(player.getLevel());
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
packet.writeD((instance != null) && (instance.getTemplateId() >= 0) ? instance.getTemplateId() : -1);
final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
packet.writeD(instanceTimes.size());

View File

@@ -64,7 +64,7 @@ public class Lailly extends AbstractNpcAI
}
case "okay":
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getEndTime() > Chronos.currentTimeMillis()))
{
switch (instance.getTemplateId())

View File

@@ -58,10 +58,10 @@ public class Apprentice extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q10329_BackupSeekers.class.getSimpleName());
if ((qs != null) && qs.isStarted())
{
final Quest quest_10329 = QuestManager.getInstance().getQuest(Q10329_BackupSeekers.class.getSimpleName());
if (quest_10329 != null)
final Quest q10329 = QuestManager.getInstance().getQuest(Q10329_BackupSeekers.class.getSimpleName());
if (q10329 != null)
{
quest_10329.notifyEvent("RESPAWN_BART", null, player);
q10329.notifyEvent("RESPAWN_BART", null, player);
}
}
}

View File

@@ -50,7 +50,7 @@ public class Toyron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (event.equals("museum_teleport"))
{
if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))

View File

@@ -103,10 +103,10 @@ public class YeSegiraTeleportDevice extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q10365_SeekerEscort.class.getSimpleName());
if ((qs != null) && qs.isStarted() && qs.isCond(1))
{
final Quest quest_10365 = QuestManager.getInstance().getQuest(Q10365_SeekerEscort.class.getSimpleName());
if (quest_10365 != null)
final Quest q10365 = QuestManager.getInstance().getQuest(Q10365_SeekerEscort.class.getSimpleName());
if (q10365 != null)
{
quest_10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
q10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
}
}
}

View File

@@ -662,7 +662,7 @@ public class LastImperialTomb extends AbstractInstance
}
else // Teleport Cube
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -46,7 +46,7 @@ public class Lydia extends AbstractNpcAI
public String onFirstTalk(Npc npc, Player player)
{
String htmltext = null;
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && ((instance.getTemplateId() == OCTAVIS_TEMPLATE_ID) || (instance.getTemplateId() == OCTAVIS_EXTREME_TEMPLATE_ID)))
{
htmltext = "Lydia-02.html";

View File

@@ -138,7 +138,7 @@ public class OctavisWarzone extends AbstractInstance
}
case "reenterInstance":
{
final Instance activeInstance = getPlayer(player);
final Instance activeInstance = getPlayerInstance(player);
if (isInInstance(activeInstance))
{
enterInstance(player, npc, activeInstance.getTemplateId());

View File

@@ -194,9 +194,9 @@ public class TeredorWarzone extends AbstractInstance
}
case "checkConditions":
{
final Instance Player = getPlayer(player);
final Instance instance = getPlayerInstance(player);
final Party playerParty = player.getParty();
if ((Player != null) && (Player.getTemplateId() == TEMPLATE_ID))
if ((instance != null) && (instance.getTemplateId() == TEMPLATE_ID))
{
enterInstance(player, npc, TEMPLATE_ID);
}

View File

@@ -1254,7 +1254,7 @@ public class AdminEditChar implements IAdminCommandHandler
*/
private void findCharacter(Player activeChar, String characterToFind)
{
int CharactersFound = 0;
int charactersFound = 0;
String name;
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
adminReply.setFile(activeChar, "data/html/admin/charfind.htm");
@@ -1267,7 +1267,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName();
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound += 1;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@@ -1278,7 +1278,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1286,16 +1286,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Please try again.";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG2 = "s.<br>Please refine your search to see all of the results.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@@ -1304,7 +1304,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG2 = "s.";
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}

View File

@@ -66,9 +66,9 @@ public abstract class AbstractInstance extends AbstractNpcAI
* @param player player who wants get instance world
* @return instance world if found, otherwise null
*/
public Instance getPlayer(Player player)
public Instance getPlayerInstance(Player player)
{
return InstanceManager.getInstance().getPlayer(player, false);
return InstanceManager.getInstance().getPlayerInstance(player, false);
}
/**
@@ -107,7 +107,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
*/
protected final void enterInstance(Player player, Npc npc, int templateId)
{
Instance instance = getPlayer(player);
Instance instance = getPlayerInstance(player);
if (instance != null) // Player has already any instance active
{
if (instance.getTemplateId() != templateId)
@@ -153,7 +153,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
// Check if any player from enter group has active instance
for (Player member : enterGroup)
{
if (getPlayer(member) != null)
if (getPlayerInstance(member) != null)
{
enterGroup.forEach(p -> p.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return;

View File

@@ -74,7 +74,7 @@ public class EvasHiddenSpace extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -159,11 +159,11 @@ public class KartiaHelperAdolph extends AbstractNpcAI
if ((instance != null) && !npc.isCastingNow() && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
{
final StatSet instParams = instance.getTemplateParameters();
final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder skill1 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill2 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill3 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill4 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill5 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
final int numberOfActiveSkills = 5;
final int randomSkill = getRandom(numberOfActiveSkills + 1);
@@ -183,10 +183,10 @@ public class KartiaHelperAdolph extends AbstractNpcAI
case 0:
case 1:
{
if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
if ((skill1 != null) && SkillCaster.checkUseConditions(npc, skill1.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
npc.doCast(skill_01.getSkill(), null, true, false);
npc.doCast(skill1.getSkill(), null, true, false);
final List<Monster> monsterList = World.getInstance().getVisibleObjectsInRange(npc, Monster.class, 300);
if (!monsterList.isEmpty())
{
@@ -203,37 +203,37 @@ public class KartiaHelperAdolph extends AbstractNpcAI
}
case 2:
{
if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
if ((skill2 != null) && SkillCaster.checkUseConditions(npc, skill2.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE_3);
npc.doCast(skill_02.getSkill(), null, true, false);
npc.doCast(skill2.getSkill(), null, true, false);
}
break;
}
case 3:
{
if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
if ((skill3 != null) && SkillCaster.checkUseConditions(npc, skill3.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
npc.doCast(skill_03.getSkill(), null, true, false);
npc.doCast(skill3.getSkill(), null, true, false);
}
break;
}
case 4:
{
if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
if ((skill4 != null) && SkillCaster.checkUseConditions(npc, skill4.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
npc.doCast(skill_04.getSkill());
npc.doCast(skill4.getSkill());
}
break;
}
case 5:
{
if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
if ((skill5 != null) && SkillCaster.checkUseConditions(npc, skill5.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
npc.doCast(skill_05.getSkill(), null, true, false);
npc.doCast(skill5.getSkill(), null, true, false);
}
break;
}

View File

@@ -68,7 +68,7 @@ public class TalkingIslandPast extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -233,7 +233,7 @@ public class Q00129_PailakaDevilsLegacy extends Quest
}
else
{
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -200,7 +200,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
{
htmltext = getNoQuestLevelRewardMsg(player);
}
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -165,7 +165,7 @@ public class Q10284_AcquisitionOfDivineSword extends Quest
qs.unset("ex3");
qs.setCond(3, true);
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -103,7 +103,7 @@ public class Q10286_ReunionWithSirra extends Quest
{
qs.unset("ex");
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -202,7 +202,7 @@ public class Q10287_StoryOfThoseLeft extends Quest
qs.unset("ex1");
qs.unset("ex2");
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -432,7 +432,7 @@ public class InstanceManager implements IXmlReader
* @param isInside when {@code true} find world where player is currently located, otherwise find world where player can enter
* @return instance if found, otherwise {@code null}
*/
public Instance getPlayer(Player player, boolean isInside)
public Instance getPlayerInstance(Player player, boolean isInside)
{
for (Instance instance : _instanceWorlds.values())
{

View File

@@ -421,12 +421,12 @@ public abstract class ItemContainer
*/
public Item detachItem(String process, int itemObjectId, long count, ItemLocation newLocation, Player actor, Object reference)
{
final Item Item = getItemByObjectId(itemObjectId);
if (Item == null)
final Item item = getItemByObjectId(itemObjectId);
if (item == null)
{
return null;
}
return detachItem(process, Item, count, newLocation, actor, reference);
return detachItem(process, item, count, newLocation, actor, reference);
}
/**

View File

@@ -984,21 +984,21 @@ public class Formulas
*/
public static double calcAttributeBonus(Creature attacker, Creature target, Skill skill)
{
int attack_attribute;
int defence_attribute;
int attackAttribute;
int defenceAttribute;
if ((skill != null) && (skill.getAttributeType() != AttributeType.NONE))
{
attack_attribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
attackAttribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defenceAttribute = target.getDefenseElementValue(skill.getAttributeType());
}
else
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement());
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
attackAttribute = attacker.getAttackElementValue(attacker.getAttackElement());
defenceAttribute = target.getDefenseElementValue(attacker.getAttackElement());
}
final int diff = attack_attribute - defence_attribute;
final int diff = attackAttribute - defenceAttribute;
if (diff > 0)
{
return Math.min(1.025 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.25);

View File

@@ -176,7 +176,7 @@ public class EnterWorld implements IClientIncomingPacket
if (Config.RESTORE_PLAYER_INSTANCE)
{
final PlayerVariables vars = player.getVariables();
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getId() == vars.getInt("INSTANCE_RESTORE", 0)))
{
player.setInstance(instance);

View File

@@ -37,7 +37,7 @@ public class ExInzoneWaiting implements IClientOutgoingPacket
public ExInzoneWaiting(Player player)
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
_currentTemplateId = ((instance != null) && (instance.getTemplateId() >= 0)) ? instance.getTemplateId() : -1;
_instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
}

View File

@@ -68,7 +68,7 @@ public class ExListPartyMatchingWaitingRoom implements IClientOutgoingPacket
packet.writeS(player.getName());
packet.writeD(player.getClassId().getId());
packet.writeD(player.getLevel());
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
packet.writeD((instance != null) && (instance.getTemplateId() >= 0) ? instance.getTemplateId() : -1);
final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
packet.writeD(instanceTimes.size());

View File

@@ -64,7 +64,7 @@ public class Lailly extends AbstractNpcAI
}
case "okay":
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getEndTime() > Chronos.currentTimeMillis()))
{
switch (instance.getTemplateId())

View File

@@ -50,7 +50,7 @@ public class Toyron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (event.equals("museum_teleport"))
{
if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))

View File

@@ -662,7 +662,7 @@ public class LastImperialTomb extends AbstractInstance
}
else // Teleport Cube
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -46,7 +46,7 @@ public class Lydia extends AbstractNpcAI
public String onFirstTalk(Npc npc, Player player)
{
String htmltext = null;
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && ((instance.getTemplateId() == OCTAVIS_TEMPLATE_ID) || (instance.getTemplateId() == OCTAVIS_EXTREME_TEMPLATE_ID)))
{
htmltext = "Lydia-02.html";

View File

@@ -138,7 +138,7 @@ public class OctavisWarzone extends AbstractInstance
}
case "reenterInstance":
{
final Instance activeInstance = getPlayer(player);
final Instance activeInstance = getPlayerInstance(player);
if (isInInstance(activeInstance))
{
enterInstance(player, npc, activeInstance.getTemplateId());

View File

@@ -194,9 +194,9 @@ public class TeredorWarzone extends AbstractInstance
}
case "checkConditions":
{
final Instance Player = getPlayer(player);
final Instance instance = getPlayerInstance(player);
final Party playerParty = player.getParty();
if ((Player != null) && (Player.getTemplateId() == TEMPLATE_ID))
if ((instance != null) && (instance.getTemplateId() == TEMPLATE_ID))
{
enterInstance(player, npc, TEMPLATE_ID);
}

View File

@@ -1254,7 +1254,7 @@ public class AdminEditChar implements IAdminCommandHandler
*/
private void findCharacter(Player activeChar, String characterToFind)
{
int CharactersFound = 0;
int charactersFound = 0;
String name;
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
adminReply.setFile(activeChar, "data/html/admin/charfind.htm");
@@ -1267,7 +1267,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName();
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound += 1;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@@ -1278,7 +1278,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1286,16 +1286,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Please try again.";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG2 = "s.<br>Please refine your search to see all of the results.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@@ -1304,7 +1304,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG2 = "s.";
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}

View File

@@ -66,9 +66,9 @@ public abstract class AbstractInstance extends AbstractNpcAI
* @param player player who wants get instance world
* @return instance world if found, otherwise null
*/
public Instance getPlayer(Player player)
public Instance getPlayerInstance(Player player)
{
return InstanceManager.getInstance().getPlayer(player, false);
return InstanceManager.getInstance().getPlayerInstance(player, false);
}
/**
@@ -107,7 +107,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
*/
protected final void enterInstance(Player player, Npc npc, int templateId)
{
Instance instance = getPlayer(player);
Instance instance = getPlayerInstance(player);
if (instance != null) // Player has already any instance active
{
if (instance.getTemplateId() != templateId)
@@ -153,7 +153,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
// Check if any player from enter group has active instance
for (Player member : enterGroup)
{
if (getPlayer(member) != null)
if (getPlayerInstance(member) != null)
{
enterGroup.forEach(p -> p.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return;

View File

@@ -47,7 +47,7 @@ public class DimensionMakkum extends AbstractInstance
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
switch (event)
{
case "enter_instance":

View File

@@ -74,7 +74,7 @@ public class EvasHiddenSpace extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -159,11 +159,11 @@ public class KartiaHelperAdolph extends AbstractNpcAI
if ((instance != null) && !npc.isCastingNow() && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
{
final StatSet instParams = instance.getTemplateParameters();
final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder skill1 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill2 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill3 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill4 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill5 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
final int numberOfActiveSkills = 5;
final int randomSkill = getRandom(numberOfActiveSkills + 1);
@@ -183,10 +183,10 @@ public class KartiaHelperAdolph extends AbstractNpcAI
case 0:
case 1:
{
if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
if ((skill1 != null) && SkillCaster.checkUseConditions(npc, skill1.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
npc.doCast(skill_01.getSkill(), null, true, false);
npc.doCast(skill1.getSkill(), null, true, false);
final List<Monster> monsterList = World.getInstance().getVisibleObjectsInRange(npc, Monster.class, 300);
if (!monsterList.isEmpty())
{
@@ -203,37 +203,37 @@ public class KartiaHelperAdolph extends AbstractNpcAI
}
case 2:
{
if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
if ((skill2 != null) && SkillCaster.checkUseConditions(npc, skill2.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE_3);
npc.doCast(skill_02.getSkill(), null, true, false);
npc.doCast(skill2.getSkill(), null, true, false);
}
break;
}
case 3:
{
if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
if ((skill3 != null) && SkillCaster.checkUseConditions(npc, skill3.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
npc.doCast(skill_03.getSkill(), null, true, false);
npc.doCast(skill3.getSkill(), null, true, false);
}
break;
}
case 4:
{
if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
if ((skill4 != null) && SkillCaster.checkUseConditions(npc, skill4.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
npc.doCast(skill_04.getSkill());
npc.doCast(skill4.getSkill());
}
break;
}
case 5:
{
if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
if ((skill5 != null) && SkillCaster.checkUseConditions(npc, skill5.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
npc.doCast(skill_05.getSkill(), null, true, false);
npc.doCast(skill5.getSkill(), null, true, false);
}
break;
}

View File

@@ -68,7 +68,7 @@ public class TalkingIslandPast extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -233,7 +233,7 @@ public class Q00129_PailakaDevilsLegacy extends Quest
}
else
{
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -200,7 +200,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
{
htmltext = getNoQuestLevelRewardMsg(player);
}
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -165,7 +165,7 @@ public class Q10284_AcquisitionOfDivineSword extends Quest
qs.unset("ex3");
qs.setCond(3, true);
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -103,7 +103,7 @@ public class Q10286_ReunionWithSirra extends Quest
{
qs.unset("ex");
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -202,7 +202,7 @@ public class Q10287_StoryOfThoseLeft extends Quest
qs.unset("ex1");
qs.unset("ex2");
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -432,7 +432,7 @@ public class InstanceManager implements IXmlReader
* @param isInside when {@code true} find world where player is currently located, otherwise find world where player can enter
* @return instance if found, otherwise {@code null}
*/
public Instance getPlayer(Player player, boolean isInside)
public Instance getPlayerInstance(Player player, boolean isInside)
{
for (Instance instance : _instanceWorlds.values())
{

View File

@@ -421,12 +421,12 @@ public abstract class ItemContainer
*/
public Item detachItem(String process, int itemObjectId, long count, ItemLocation newLocation, Player actor, Object reference)
{
final Item Item = getItemByObjectId(itemObjectId);
if (Item == null)
final Item item = getItemByObjectId(itemObjectId);
if (item == null)
{
return null;
}
return detachItem(process, Item, count, newLocation, actor, reference);
return detachItem(process, item, count, newLocation, actor, reference);
}
/**

View File

@@ -984,21 +984,21 @@ public class Formulas
*/
public static double calcAttributeBonus(Creature attacker, Creature target, Skill skill)
{
int attack_attribute;
int defence_attribute;
int attackAttribute;
int defenceAttribute;
if ((skill != null) && (skill.getAttributeType() != AttributeType.NONE))
{
attack_attribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
attackAttribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defenceAttribute = target.getDefenseElementValue(skill.getAttributeType());
}
else
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement());
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
attackAttribute = attacker.getAttackElementValue(attacker.getAttackElement());
defenceAttribute = target.getDefenseElementValue(attacker.getAttackElement());
}
final int diff = attack_attribute - defence_attribute;
final int diff = attackAttribute - defenceAttribute;
if (diff > 0)
{
return Math.min(1.025 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.25);

View File

@@ -176,7 +176,7 @@ public class EnterWorld implements IClientIncomingPacket
if (Config.RESTORE_PLAYER_INSTANCE)
{
final PlayerVariables vars = player.getVariables();
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getId() == vars.getInt("INSTANCE_RESTORE", 0)))
{
player.setInstance(instance);

View File

@@ -37,7 +37,7 @@ public class ExInzoneWaiting implements IClientOutgoingPacket
public ExInzoneWaiting(Player player)
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
_currentTemplateId = ((instance != null) && (instance.getTemplateId() >= 0)) ? instance.getTemplateId() : -1;
_instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
}

View File

@@ -68,7 +68,7 @@ public class ExListPartyMatchingWaitingRoom implements IClientOutgoingPacket
packet.writeS(player.getName());
packet.writeD(player.getClassId().getId());
packet.writeD(player.getLevel());
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
packet.writeD((instance != null) && (instance.getTemplateId() >= 0) ? instance.getTemplateId() : -1);
final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
packet.writeD(instanceTimes.size());

View File

@@ -64,7 +64,7 @@ public class Lailly extends AbstractNpcAI
}
case "okay":
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getEndTime() > Chronos.currentTimeMillis()))
{
switch (instance.getTemplateId())

View File

@@ -50,7 +50,7 @@ public class Toyron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (event.equals("museum_teleport"))
{
if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))

View File

@@ -662,7 +662,7 @@ public class LastImperialTomb extends AbstractInstance
}
else // Teleport Cube
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -46,7 +46,7 @@ public class Lydia extends AbstractNpcAI
public String onFirstTalk(Npc npc, Player player)
{
String htmltext = null;
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && ((instance.getTemplateId() == OCTAVIS_TEMPLATE_ID) || (instance.getTemplateId() == OCTAVIS_EXTREME_TEMPLATE_ID)))
{
htmltext = "Lydia-02.html";

View File

@@ -138,7 +138,7 @@ public class OctavisWarzone extends AbstractInstance
}
case "reenterInstance":
{
final Instance activeInstance = getPlayer(player);
final Instance activeInstance = getPlayerInstance(player);
if (isInInstance(activeInstance))
{
enterInstance(player, npc, activeInstance.getTemplateId());

View File

@@ -194,9 +194,9 @@ public class TeredorWarzone extends AbstractInstance
}
case "checkConditions":
{
final Instance Player = getPlayer(player);
final Instance instance = getPlayerInstance(player);
final Party playerParty = player.getParty();
if ((Player != null) && (Player.getTemplateId() == TEMPLATE_ID))
if ((instance != null) && (instance.getTemplateId() == TEMPLATE_ID))
{
enterInstance(player, npc, TEMPLATE_ID);
}

View File

@@ -1254,7 +1254,7 @@ public class AdminEditChar implements IAdminCommandHandler
*/
private void findCharacter(Player activeChar, String characterToFind)
{
int CharactersFound = 0;
int charactersFound = 0;
String name;
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
adminReply.setFile(activeChar, "data/html/admin/charfind.htm");
@@ -1267,7 +1267,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName();
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound += 1;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@@ -1278,7 +1278,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1286,16 +1286,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Please try again.";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG2 = "s.<br>Please refine your search to see all of the results.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@@ -1304,7 +1304,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG2 = "s.";
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}

View File

@@ -66,9 +66,9 @@ public abstract class AbstractInstance extends AbstractNpcAI
* @param player player who wants get instance world
* @return instance world if found, otherwise null
*/
public Instance getPlayer(Player player)
public Instance getPlayerInstance(Player player)
{
return InstanceManager.getInstance().getPlayer(player, false);
return InstanceManager.getInstance().getPlayerInstance(player, false);
}
/**
@@ -107,7 +107,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
*/
protected final void enterInstance(Player player, Npc npc, int templateId)
{
Instance instance = getPlayer(player);
Instance instance = getPlayerInstance(player);
if (instance != null) // Player has already any instance active
{
if (instance.getTemplateId() != templateId)
@@ -153,7 +153,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
// Check if any player from enter group has active instance
for (Player member : enterGroup)
{
if (getPlayer(member) != null)
if (getPlayerInstance(member) != null)
{
enterGroup.forEach(p -> p.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return;

View File

@@ -47,7 +47,7 @@ public class DimensionMakkum extends AbstractInstance
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
switch (event)
{
case "enter_instance":

View File

@@ -74,7 +74,7 @@ public class EvasHiddenSpace extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -159,11 +159,11 @@ public class KartiaHelperAdolph extends AbstractNpcAI
if ((instance != null) && !npc.isCastingNow() && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
{
final StatSet instParams = instance.getTemplateParameters();
final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder skill1 = instParams.getSkillHolder("adolphHate");
final SkillHolder skill2 = instParams.getSkillHolder("adolphPunish");
final SkillHolder skill3 = instParams.getSkillHolder("adolphShield");
final SkillHolder skill4 = instParams.getSkillHolder("adolphAggression");
final SkillHolder skill5 = instParams.getSkillHolder("adolphChainHydra");
final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
final int numberOfActiveSkills = 5;
final int randomSkill = getRandom(numberOfActiveSkills + 1);
@@ -183,10 +183,10 @@ public class KartiaHelperAdolph extends AbstractNpcAI
case 0:
case 1:
{
if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
if ((skill1 != null) && SkillCaster.checkUseConditions(npc, skill1.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
npc.doCast(skill_01.getSkill(), null, true, false);
npc.doCast(skill1.getSkill(), null, true, false);
final List<Monster> monsterList = World.getInstance().getVisibleObjectsInRange(npc, Monster.class, 300);
if (!monsterList.isEmpty())
{
@@ -203,37 +203,37 @@ public class KartiaHelperAdolph extends AbstractNpcAI
}
case 2:
{
if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
if ((skill2 != null) && SkillCaster.checkUseConditions(npc, skill2.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE_3);
npc.doCast(skill_02.getSkill(), null, true, false);
npc.doCast(skill2.getSkill(), null, true, false);
}
break;
}
case 3:
{
if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
if ((skill3 != null) && SkillCaster.checkUseConditions(npc, skill3.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
npc.doCast(skill_03.getSkill(), null, true, false);
npc.doCast(skill3.getSkill(), null, true, false);
}
break;
}
case 4:
{
if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
if ((skill4 != null) && SkillCaster.checkUseConditions(npc, skill4.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
npc.doCast(skill_04.getSkill());
npc.doCast(skill4.getSkill());
}
break;
}
case 5:
{
if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
if ((skill5 != null) && SkillCaster.checkUseConditions(npc, skill5.getSkill()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
npc.doCast(skill_05.getSkill(), null, true, false);
npc.doCast(skill5.getSkill(), null, true, false);
}
break;
}

View File

@@ -68,7 +68,7 @@ public class TalkingIslandPast extends AbstractInstance
}
else if (event.equals("exitInstance"))
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -233,7 +233,7 @@ public class Q00129_PailakaDevilsLegacy extends Quest
}
else
{
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -200,7 +200,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
{
htmltext = getNoQuestLevelRewardMsg(player);
}
final Instance inst = InstanceManager.getInstance().getPlayer(player, true);
final Instance inst = InstanceManager.getInstance().getPlayerInstance(player, true);
if (inst != null)
{
inst.finishInstance();

View File

@@ -165,7 +165,7 @@ public class Q10284_AcquisitionOfDivineSword extends Quest
qs.unset("ex3");
qs.setCond(3, true);
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -103,7 +103,7 @@ public class Q10286_ReunionWithSirra extends Quest
{
qs.unset("ex");
qs.setMemoState(2);
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -202,7 +202,7 @@ public class Q10287_StoryOfThoseLeft extends Quest
qs.unset("ex1");
qs.unset("ex2");
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (world != null)
{
world.finishInstance(0);

View File

@@ -432,7 +432,7 @@ public class InstanceManager implements IXmlReader
* @param isInside when {@code true} find world where player is currently located, otherwise find world where player can enter
* @return instance if found, otherwise {@code null}
*/
public Instance getPlayer(Player player, boolean isInside)
public Instance getPlayerInstance(Player player, boolean isInside)
{
for (Instance instance : _instanceWorlds.values())
{

View File

@@ -421,12 +421,12 @@ public abstract class ItemContainer
*/
public Item detachItem(String process, int itemObjectId, long count, ItemLocation newLocation, Player actor, Object reference)
{
final Item Item = getItemByObjectId(itemObjectId);
if (Item == null)
final Item item = getItemByObjectId(itemObjectId);
if (item == null)
{
return null;
}
return detachItem(process, Item, count, newLocation, actor, reference);
return detachItem(process, item, count, newLocation, actor, reference);
}
/**

View File

@@ -984,21 +984,21 @@ public class Formulas
*/
public static double calcAttributeBonus(Creature attacker, Creature target, Skill skill)
{
int attack_attribute;
int defence_attribute;
int attackAttribute;
int defenceAttribute;
if ((skill != null) && (skill.getAttributeType() != AttributeType.NONE))
{
attack_attribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
attackAttribute = attacker.getAttackElementValue(skill.getAttributeType()) + skill.getAttributeValue();
defenceAttribute = target.getDefenseElementValue(skill.getAttributeType());
}
else
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement());
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
attackAttribute = attacker.getAttackElementValue(attacker.getAttackElement());
defenceAttribute = target.getDefenseElementValue(attacker.getAttackElement());
}
final int diff = attack_attribute - defence_attribute;
final int diff = attackAttribute - defenceAttribute;
if (diff > 0)
{
return Math.min(1.025 + (Math.sqrt(Math.pow(diff, 3) / 2) * 0.0001), 1.25);

View File

@@ -176,7 +176,7 @@ public class EnterWorld implements IClientIncomingPacket
if (Config.RESTORE_PLAYER_INSTANCE)
{
final PlayerVariables vars = player.getVariables();
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getId() == vars.getInt("INSTANCE_RESTORE", 0)))
{
player.setInstance(instance);

View File

@@ -38,7 +38,7 @@ public class ExInzoneWaiting implements IClientOutgoingPacket
public ExInzoneWaiting(Player player, boolean hide)
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
_currentTemplateId = ((instance != null) && (instance.getTemplateId() >= 0)) ? instance.getTemplateId() : -1;
_instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
_hide = hide;

View File

@@ -68,7 +68,7 @@ public class ExListPartyMatchingWaitingRoom implements IClientOutgoingPacket
packet.writeS(player.getName());
packet.writeD(player.getClassId().getId());
packet.writeD(player.getLevel());
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
packet.writeD((instance != null) && (instance.getTemplateId() >= 0) ? instance.getTemplateId() : -1);
final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
packet.writeD(instanceTimes.size());

View File

@@ -64,7 +64,7 @@ public class Lailly extends AbstractNpcAI
}
case "okay":
{
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && (instance.getEndTime() > Chronos.currentTimeMillis()))
{
switch (instance.getTemplateId())

View File

@@ -50,7 +50,7 @@ public class Toyron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
final Instance world = InstanceManager.getInstance().getPlayer(player, true);
final Instance world = InstanceManager.getInstance().getPlayerInstance(player, true);
if (event.equals("museum_teleport"))
{
if ((world != null) && (world.getTemplateId() == TEMPLATE_ID))

View File

@@ -662,7 +662,7 @@ public class LastImperialTomb extends AbstractInstance
}
else // Teleport Cube
{
final Instance world = getPlayer(player);
final Instance world = getPlayerInstance(player);
if (world != null)
{
teleportPlayerOut(player, world);

View File

@@ -46,7 +46,7 @@ public class Lydia extends AbstractNpcAI
public String onFirstTalk(Npc npc, Player player)
{
String htmltext = null;
final Instance instance = InstanceManager.getInstance().getPlayer(player, false);
final Instance instance = InstanceManager.getInstance().getPlayerInstance(player, false);
if ((instance != null) && ((instance.getTemplateId() == OCTAVIS_TEMPLATE_ID) || (instance.getTemplateId() == OCTAVIS_EXTREME_TEMPLATE_ID)))
{
htmltext = "Lydia-02.html";

View File

@@ -138,7 +138,7 @@ public class OctavisWarzone extends AbstractInstance
}
case "reenterInstance":
{
final Instance activeInstance = getPlayer(player);
final Instance activeInstance = getPlayerInstance(player);
if (isInInstance(activeInstance))
{
enterInstance(player, npc, activeInstance.getTemplateId());

View File

@@ -194,9 +194,9 @@ public class TeredorWarzone extends AbstractInstance
}
case "checkConditions":
{
final Instance Player = getPlayer(player);
final Instance instance = getPlayerInstance(player);
final Party playerParty = player.getParty();
if ((Player != null) && (Player.getTemplateId() == TEMPLATE_ID))
if ((instance != null) && (instance.getTemplateId() == TEMPLATE_ID))
{
enterInstance(player, npc, TEMPLATE_ID);
}

Some files were not shown because too many files have changed in this diff Show More