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

@@ -1230,7 +1230,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");
@@ -1243,7 +1243,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("\">");
@@ -1254,7 +1254,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1262,16 +1262,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 = ".";
}
@@ -1280,7 +1280,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_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return;

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

@@ -985,21 +985,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

@@ -175,7 +175,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());