Replaced assignments with compound operators.

This commit is contained in:
MobiusDev
2018-09-09 16:47:22 +00:00
parent b50b43a1f9
commit 96a39e7b73
127 changed files with 923 additions and 648 deletions

View File

@@ -185,7 +185,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2)))
{
newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes;
receivedBytes += newBytes;
left -= newBytes;
}

View File

@@ -924,20 +924,20 @@ public class L2AttackableAI extends L2CharacterAI
if (originalAttackTarget.getX() < posX)
{
posX = posX + 300;
posX += 300;
}
else
{
posX = posX - 300;
posX -= 300;
}
if (originalAttackTarget.getY() < posY)
{
posY = posY + 300;
posY += 300;
}
else
{
posY = posY - 300;
posY -= 300;
}
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId()))
@@ -1213,10 +1213,10 @@ public class L2AttackableAI extends L2CharacterAI
int range = npc.getPhysicalAttackRange() + combinedCollision;
if (mostHate.isMoving())
{
range = range + 50;
range += 50;
if (npc.isMoving())
{
range = range + 50;
range += 50;
}
}
@@ -1304,7 +1304,7 @@ public class L2AttackableAI extends L2CharacterAI
final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
if (attackTarget.isMoving())
{
dist2 = dist2 - 30;
dist2 -= 30;
}
if (sk.isContinuous())
@@ -1901,7 +1901,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving())
{
dist2 = dist2 - 70;
dist2 -= 70;
}
}
catch (NullPointerException e)
@@ -1930,7 +1930,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving())
{
dist2 = dist2 - 70;
dist2 -= 70;
}
}
catch (NullPointerException e)
@@ -1969,7 +1969,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + targets.getTemplate().getCollisionRadius();
if (targets.isMoving())
{
dist2 = dist2 - 70;
dist2 -= 70;
}
}
catch (NullPointerException e)
@@ -2002,7 +2002,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving())
{
dist2 = dist2 - 70;
dist2 -= 70;
}
}
catch (NullPointerException e)
@@ -2118,7 +2118,7 @@ public class L2AttackableAI extends L2CharacterAI
range = actor.getPhysicalAttackRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving())
{
dist2 = dist2 - 70;
dist2 -= 70;
}
}
catch (NullPointerException e)

View File

@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else
{
id = _curOID;
_curOID = _curOID + 1;
_curOID += 1;
}
return id;
}

View File

@@ -14,95 +14,370 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.areas.Gracia.AI.NPC.GeneralDilios;
package com.l2jmobius.gameserver.instancemanager;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
import ai.AbstractNpcAI;
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* Dilios AI
* @author JIV, Sephiroth, Apocalipce
* This class manage the player add/remove, team change and event arena status,<br>
* as the clearance of the participants list or liberate the arena.
* @author BiggBoss
*/
public final class GeneralDilios extends AbstractNpcAI
public final class HandysBlockCheckerManager
{
private static final int GENERAL_ID = 32549;
private static final int GUARD_ID = 32619;
// All the participants and their team classified by arena
private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4];
private L2Npc _general = null;
private final Set<L2Spawn> _guards = Collections.newSetFromMap(new ConcurrentHashMap<>());
// Arena votes to start the game
private static final Map<Integer, Integer> _arenaVotes = new HashMap<>();
private static final NpcStringId[] DILIOS_TEXT =
// Arena Status, True = is being used, otherwise, False
private static final Map<Integer, Boolean> _arenaStatus = new HashMap<>();
// Registration request penalty (10 seconds)
protected static Set<Integer> _registrationPenalty = Collections.synchronizedSet(new HashSet<>());
/**
* Return the number of event-start votes for the specified arena id
* @param arenaId
* @return int (number of votes)
*/
public synchronized int getArenaVotes(int arenaId)
{
NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_WE_RE_GATHERING_BRAVE_ADVENTURERS_TO_ATTACK_TIAT_S_MOUNTED_TROOP_THAT_S_ROOTED_IN_THE_SEED_OF_DESTRUCTION,
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_DESTRUCTION_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE,
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_TIATS_MOUNTED_TROOP_IS_CURRENTLY_TRYING_TO_RETAKE_SEED_OF_DESTRUCTION_COMMIT_ALL_THE_AVAILABLE_REINFORCEMENTS_INTO_SEED_OF_DESTRUCTION,
NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_BRAVE_ADVENTURERS_WHO_HAVE_CHALLENGED_THE_SEED_OF_INFINITY_ARE_CURRENTLY_INFILTRATING_THE_HALL_OF_EROSION_THROUGH_THE_DEFENSIVELY_WEAK_HALL_OF_SUFFERING,
// NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_SWEEPING_THE_SEED_OF_INFINITY_IS_CURRENTLY_COMPLETE_TO_THE_HEART_OF_THE_SEED_EKIMUS_IS_BEING_DIRECTLY_ATTACKED_AND_THE_UNDEAD_REMAINING_IN_THE_HALL_OF_SUFFERING_ARE_BEING_ERADICATED,
NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_INFINITY_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_RESURRECTED_UNDEAD_IN_THE_SEED_OF_INFINITY_ARE_POURING_INTO_THE_HALL_OF_SUFFERING_AND_THE_HALL_OF_EROSION
// NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_EKIMUS_IS_ABOUT_TO_BE_REVIVED_BY_THE_RESURRECTED_UNDEAD_IN_SEED_OF_INFINITY_SEND_ALL_REINFORCEMENTS_TO_THE_HEART_AND_THE_HALL_OF_SUFFERING
};
public GeneralDilios()
{
addSpawnId(GENERAL_ID, GUARD_ID);
return _arenaVotes.get(arenaId);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
/**
* Add a new vote to start the event for the specified arena id
* @param arena
*/
public synchronized void increaseArenaVotes(int arena)
{
if (event.startsWith("command_"))
final int newVotes = _arenaVotes.get(arena) + 1;
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted())
{
int value = Integer.parseInt(event.substring(8));
if (value < 6)
clearArenaVotes(arena);
if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0))
{
_general.broadcastPacket(new NpcSay(_general.getObjectId(), ChatType.NPC_GENERAL, GENERAL_ID, NpcStringId.STABBING_THREE_TIMES));
startQuestTimer("guard_animation_0", 3400, null, null);
return;
}
if (Config.HBCE_FAIR_PLAY)
{
holder.checkAndShuffle();
}
ThreadPool.execute(holder.getEvent().new StartEvent());
}
else
{
_arenaVotes.put(arena, newVotes);
}
}
/**
* Will clear the votes queue (of event start) for the specified arena id
* @param arena
*/
public synchronized void clearArenaVotes(int arena)
{
_arenaVotes.put(arena, 0);
}
protected HandysBlockCheckerManager()
{
// Initialize arena status
_arenaStatus.put(0, false);
_arenaStatus.put(1, false);
_arenaStatus.put(2, false);
_arenaStatus.put(3, false);
// Initialize arena votes
_arenaVotes.put(0, 0);
_arenaVotes.put(1, 0);
_arenaVotes.put(2, 0);
_arenaVotes.put(3, 0);
}
/**
* Returns the players holder
* @param arena
* @return ArenaParticipantsHolder
*/
public ArenaParticipantsHolder getHolder(int arena)
{
return _arenaPlayers[arena];
}
/**
* Initializes the participants holder
*/
public void startUpParticipantsQueue()
{
for (int i = 0; i < 4; ++i)
{
_arenaPlayers[i] = new ArenaParticipantsHolder(i);
}
}
/**
* Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets
* @param player
* @param arenaId
* @return
*/
public boolean addPlayerToArena(L2PcInstance player, int arenaId)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
boolean isRed;
for (int i = 0; i < 4; i++)
{
if (_arenaPlayers[i].getAllPlayers().contains(player))
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
msg.addString(player.getName());
player.sendPacket(msg);
return false;
}
}
if (player.isCursedWeaponEquipped())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON);
return false;
}
if (player.isOnEvent() || player.isInOlympiadMode())
{
player.sendMessage("Couldnt register you due other event participation");
return false;
}
if (OlympiadManager.getInstance().isRegistered(player))
{
OlympiadManager.getInstance().unRegisterNoble(player);
player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER);
}
// if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player))
// {
// UngerGroundColiseum.getInstance().removeParticipant(player);
// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
// }
// if(KrateiCubeManager.getInstance().isRegisteredPlayer(player))
// {
// KrateiCubeManager.getInstance().removeParticipant(player);
// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
// }
if (_registrationPenalty.contains(player.getObjectId()))
{
player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN);
return false;
}
if (holder.getBlueTeamSize() < holder.getRedTeamSize())
{
holder.addPlayer(player, 1);
isRed = false;
}
else
{
value = -1;
_general.broadcastPacket(new NpcSay(_general.getObjectId(), ChatType.NPC_SHOUT, GENERAL_ID, DILIOS_TEXT[getRandom(DILIOS_TEXT.length)]));
holder.addPlayer(player, 0);
isRed = true;
}
startQuestTimer("command_" + (value + 1), 60000, null, null);
holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed));
return true;
}
else if (event.startsWith("guard_animation_"))
{
final int value = Integer.parseInt(event.substring(16));
for (L2Spawn guard : _guards)
{
guard.getLastSpawn().broadcastSocialAction(4);
}
if (value < 2)
{
startQuestTimer("guard_animation_" + (value + 1), 1500, null, null);
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSpawn(L2Npc npc)
/**
* Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates
* @param player
* @param arenaId
* @param team
*/
public void removePlayer(L2PcInstance player, int arenaId, int team)
{
if (npc.getId() == GENERAL_ID)
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
startQuestTimer("command_0", 60000, null, null);
_general = npc;
final boolean isRed = team == 0;
holder.removePlayer(player, team);
holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
// End event if theres an empty team
final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize();
if (teamSize == 0)
{
holder.getEvent().endEventAbnormally();
}
_registrationPenalty.add(player.getObjectId());
schedulePenaltyRemoval(player.getObjectId());
}
else if (npc.getId() == GUARD_ID)
{
_guards.add(npc.getSpawn());
}
return super.onSpawn(npc);
}
}
/**
* Will change the player from one team to other (if possible) and will send the needed packets
* @param player
* @param arena
* @param team
*/
public void changePlayerToTeam(L2PcInstance player, int arena, int team)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
synchronized (holder)
{
final boolean isFromRed = holder.getRedPlayers().contains(player);
if (isFromRed && (holder.getBlueTeamSize() == 6))
{
player.sendMessage("The team is full");
return;
}
else if (!isFromRed && (holder.getRedTeamSize() == 6))
{
player.sendMessage("The team is full");
return;
}
final int futureTeam = isFromRed ? 1 : 0;
holder.addPlayer(player, futureTeam);
if (isFromRed)
{
holder.removePlayer(player, 0);
}
else
{
holder.removePlayer(player, 1);
}
holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
}
}
/**
* Will erase all participants from the specified holder
* @param arenaId
*/
public synchronized void clearPaticipantQueueByArenaId(int arenaId)
{
_arenaPlayers[arenaId].clearPlayers();
}
/**
* Returns true if arena is holding an event at this momment
* @param arenaId
* @return boolean
*/
public boolean arenaIsBeingUsed(int arenaId)
{
if ((arenaId < 0) || (arenaId > 3))
{
return false;
}
return _arenaStatus.get(arenaId);
}
/**
* Set the specified arena as being used
* @param arenaId
*/
public void setArenaBeingUsed(int arenaId)
{
_arenaStatus.put(arenaId, true);
}
/**
* Set as free the specified arena for future events
* @param arenaId
*/
public void setArenaFree(int arenaId)
{
_arenaStatus.put(arenaId, false);
}
/**
* Called when played logs out while participating in Block Checker Event
* @param player
*/
public void onDisconnect(L2PcInstance player)
{
final int arena = player.getBlockCheckerArena();
final int team = getHolder(arena).getPlayerTeam(player);
getInstance().removePlayer(player, arena, team);
if (player.getTeam() != Team.NONE)
{
player.stopAllEffects();
// Remove team aura
player.setTeam(Team.NONE);
// Remove the event items
final PcInventory inv = player.getInventory();
if (inv.getItemByItemId(13787) != null)
{
final long count = inv.getInventoryItemCount(13787, 0);
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
}
if (inv.getItemByItemId(13788) != null)
{
final long count = inv.getInventoryItemCount(13788, 0);
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
}
player.setInsideZone(ZoneId.PVP, false);
// Teleport Back
player.teleToLocation(-57478, -60367, -2370);
}
}
public void removePenalty(int objectId)
{
_registrationPenalty.remove(objectId);
}
private void schedulePenaltyRemoval(int objId)
{
ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000);
}
/**
* Gets the single instance of {@code HandysBlockCheckerManager}.
* @return single instance of {@code HandysBlockCheckerManager}
*/
public static HandysBlockCheckerManager getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final HandysBlockCheckerManager _instance = new HandysBlockCheckerManager();
}
}

View File

@@ -846,7 +846,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0)
{
heading = 65535 + heading;
heading += 65535;
}
return Util.convertHeadingToDegree(heading);
}

View File

@@ -101,7 +101,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood()
{
// Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL;
_remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION)
{
_remainingTime = MAX_DURATION;

View File

@@ -193,7 +193,7 @@ public class Hero
private String calcFightTime(long FightTime)
{
final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000;
FightTime /= 1000;
return String.format(format, (FightTime % 3600) / 60) + ":" + String.format(format, FightTime % 60);
}

View File

@@ -780,22 +780,22 @@ public final class Instance
else if ((remaining > 300000) && (emptyTimeLeft > 300000))
{
interval = 300000;
remaining = remaining - 300000;
remaining -= 300000;
}
else if ((remaining > 60000) && (emptyTimeLeft > 60000))
{
interval = 60000;
remaining = remaining - 60000;
remaining -= 60000;
}
else if ((remaining > 30000) && (emptyTimeLeft > 30000))
{
interval = 30000;
remaining = remaining - 30000;
remaining -= 30000;
}
else
{
interval = 10000;
remaining = remaining - 10000;
remaining -= 10000;
}
}
else if (remaining > 300000)
@@ -805,7 +805,7 @@ public final class Instance
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES);
sm.addString(Integer.toString(timeLeft));
Broadcast.toPlayersInInstance(sm, _id);
remaining = remaining - 300000;
remaining -= 300000;
}
else if (remaining > 60000)
{
@@ -814,21 +814,21 @@ public final class Instance
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES);
sm.addString(Integer.toString(timeLeft));
Broadcast.toPlayersInInstance(sm, _id);
remaining = remaining - 60000;
remaining -= 60000;
}
else if (remaining > 30000)
{
timeLeft = remaining / 1000;
interval = 30000;
cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left.");
remaining = remaining - 30000;
remaining -= 30000;
}
else
{
timeLeft = remaining / 1000;
interval = 10000;
cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left.");
remaining = remaining - 10000;
remaining -= 10000;
}
if (cs != null)
{

View File

@@ -1782,12 +1782,12 @@ public final class Formulas
attack_attribute += 100;
attack_attribute *= attack_attribute;
attack_attribute_mod = (attack_attribute / 144.0) * attack_attribute_mod;
attack_attribute_mod *= (attack_attribute / 144.0);
defence_attribute += 100;
defence_attribute *= defence_attribute;
defence_attribute_mod = (defence_attribute / 169.0) * defence_attribute_mod;
defence_attribute_mod *= (defence_attribute / 169.0);
double attribute_mod_diff = attack_attribute_mod - defence_attribute_mod;

View File

@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height;
// x1->x2
for (int x = _x1; x < _x2; x = x + STEP)
for (int x = _x1; x < _x2; x += STEP)
{
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
}
// y1->y2
for (int y = _y1; y < _y2; y = y + STEP)
for (int y = _y1; y < _y2; y += STEP)
{
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);

View File

@@ -49,21 +49,21 @@ public class ExUISetting implements IClientOutgoingPacket
if (_uiSettings.getCategories().containsKey(category))
{
final List<Integer> catElList1 = _uiSettings.getCategories().get(category);
size = size + catElList1.size();
size += catElList1.size();
}
category++;
size++;
if (_uiSettings.getCategories().containsKey(category))
{
final List<Integer> catElList2 = _uiSettings.getCategories().get(category);
size = size + catElList2.size();
size += catElList2.size();
}
category++;
size = size + 4;
size += 4;
if (_uiSettings.getKeys().containsKey(i))
{
final List<ActionKey> keyElList = _uiSettings.getKeys().get(i);
size = size + (keyElList.size() * 20);
size += (keyElList.size() * 20);
}
}
buffsize = size;

View File

@@ -83,7 +83,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0)
{
angleTarget = 360 + angleTarget;
angleTarget += 360;
}
return angleTarget;
}
@@ -97,7 +97,7 @@ public final class Util
{
if (degree < 0)
{
degree = 360 + degree;
degree += 360;
}
return (int) (degree * 182.044444444);
}
@@ -112,7 +112,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0)
{
angleTarget = 360 + angleTarget;
angleTarget += 360;
}
return (int) (angleTarget * 182.044444444);
}
@@ -122,7 +122,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0)
{
angleTarget = 360 + angleTarget;
angleTarget += 360;
}
return (int) (angleTarget * 182.044444444);
}

View File

@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2)))
{
newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes;
receivedBytes += newBytes;
left -= newBytes;
}