Reformat and clean up "client" package

This commit is contained in:
P0nk
2021-09-09 23:21:39 +02:00
parent 07f55fa53c
commit 9bf1b68924
108 changed files with 1770 additions and 1543 deletions

View File

@@ -42,8 +42,12 @@ public class CheckDmgCommand extends Command {
Integer watkBuff = victim.getBuffedValue(BuffStat.WATK);
Integer matkBuff = victim.getBuffedValue(BuffStat.MATK);
int blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12);
if (watkBuff == null) watkBuff = 0;
if (matkBuff == null) matkBuff = 0;
if (watkBuff == null) {
watkBuff = 0;
}
if (matkBuff == null) {
matkBuff = 0;
}
player.dropMessage(5, "Cur Str: " + victim.getTotalStr() + " Cur Dex: " + victim.getTotalDex() + " Cur Int: " + victim.getTotalInt() + " Cur Luk: " + victim.getTotalLuk());
player.dropMessage(5, "Cur WATK: " + victim.getTotalWatk() + " Cur MATK: " + victim.getTotalMagic());

View File

@@ -46,12 +46,16 @@ public class FlyCommand extends Command {
String sendStr = "";
if (params[0].equalsIgnoreCase("on")) {
sendStr += "Enabled Fly feature (F1). With fly active, you cannot attack.";
if (!srv.canFly(accid)) sendStr += " Re-login to take effect.";
if (!srv.canFly(accid)) {
sendStr += " Re-login to take effect.";
}
srv.changeFly(c.getAccID(), true);
} else {
sendStr += "Disabled Fly feature. You can now attack.";
if (srv.canFly(accid)) sendStr += " Re-login to take effect.";
if (srv.canFly(accid)) {
sendStr += " Re-login to take effect.";
}
srv.changeFly(c.getAccID(), false);
}

View File

@@ -42,7 +42,7 @@ public class GiveMesosCommand extends Command {
String recv_, value_;
long mesos_ = 0;
if (params.length == 2) {
recv_ = params[0];
value_ = params[1];
@@ -50,7 +50,7 @@ public class GiveMesosCommand extends Command {
recv_ = c.getPlayer().getName();
value_ = params[0];
}
try {
mesos_ = Long.parseLong(value_);
if (mesos_ > Integer.MAX_VALUE) {
@@ -65,7 +65,7 @@ public class GiveMesosCommand extends Command {
mesos_ = Integer.MIN_VALUE;
}
}
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(recv_);
if (victim != null) {
victim.gainMeso((int) mesos_, true);

View File

@@ -55,7 +55,7 @@ public class GiveNxCommand extends Command {
type = 1;
}
typeStr = params[0];
if (params.length > 2) {
recv = params[1];
value = Integer.parseInt(params[2]);

View File

@@ -21,7 +21,7 @@ public class GiveRpCommand extends Command {
if (victim != null) {
victim.setRewardPoints(victim.getRewardPoints() + Integer.parseInt(params[1]));
player.message("RP given. Player " + params[0] + " now has " + victim.getRewardPoints()
+ " reward points." );
+ " reward points.");
} else {
player.message("Player '" + params[0] + "' could not be found.");
}

View File

@@ -36,7 +36,7 @@ public class MaxHpMpCommand extends Command {
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
Character victim = player;
int statUpdate = 1;
if (params.length >= 2) {
victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
@@ -46,7 +46,7 @@ public class MaxHpMpCommand extends Command {
} else {
player.yellowMessage("Syntax: !maxhpmp [<playername>] <value>");
}
if (victim != null) {
int extraHp = victim.getCurrentMaxHp() - victim.getClientMaxHp();
int extraMp = victim.getCurrentMaxMp() - victim.getClientMaxMp();

View File

@@ -39,24 +39,24 @@ public class MusicCommand extends Command {
for (String s : GameConstants.GAME_SONGS) {
songList += (" " + s + "\r\n");
}
return songList;
}
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
if (params.length < 1) {
String sendMsg = "";
sendMsg += "Syntax: #r!music <song>#k\r\n\r\n";
sendMsg += getSongList();
c.sendPacket(PacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
return;
}
String song = player.getLastCommandMessage();
for (String s : GameConstants.GAME_SONGS) {
if (s.equalsIgnoreCase(song)) { // thanks Masterrulax for finding an issue here
@@ -65,11 +65,11 @@ public class MusicCommand extends Command {
return;
}
}
String sendMsg = "";
sendMsg += "Song not found, please enter a song below.\r\n\r\n";
sendMsg += getSongList();
c.sendPacket(PacketCreator.getNPCTalk(1052015, (byte) 0, sendMsg, "00 00", (byte) 0));
}
}

View File

@@ -36,8 +36,8 @@ public class QuestCompleteCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
if (params.length < 1){
if (params.length < 1) {
player.yellowMessage("Syntax: !completequest <questid>");
return;
}
@@ -51,7 +51,7 @@ public class QuestCompleteCommand extends Command {
} else {
c.getAbstractPlayerInteraction().forceCompleteQuest(questId);
}
player.dropMessage(5, "QUEST " + questId + " completed.");
} else {
player.dropMessage(5, "QUESTID " + questId + " not started or already completed.");

View File

@@ -36,8 +36,8 @@ public class QuestResetCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
if (params.length < 1){
if (params.length < 1) {
player.yellowMessage("Syntax: !resetquest <questid>");
return;
}

View File

@@ -36,8 +36,8 @@ public class QuestStartCommand extends Command {
@Override
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
if (params.length < 1){
if (params.length < 1) {
player.yellowMessage("Syntax: !startquest <questid>");
return;
}
@@ -51,7 +51,7 @@ public class QuestStartCommand extends Command {
} else {
c.getAbstractPlayerInteraction().forceStartQuest(questid);
}
player.dropMessage(5, "QUEST " + questid + " started.");
} else {
player.dropMessage(5, "QUESTID " + questid + " already started/completed.");

View File

@@ -42,12 +42,13 @@ public class ReloadMapCommand extends Command {
int callerid = c.getPlayer().getId();
Collection<Character> characters = player.getMap().getAllPlayers();
for (Character chr : characters) {
chr.saveLocationOnWarp();
chr.changeMap(newMap);
if (chr.getId() != callerid)
if (chr.getId() != callerid) {
chr.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience.");
}
}
newMap.respawn();
}

View File

@@ -39,8 +39,9 @@ public class StartEventCommand extends Command {
public void execute(Client c, String[] params) {
Character player = c.getPlayer();
int players = 50;
if (params.length > 1)
if (params.length > 1) {
players = Integer.parseInt(params[0]);
}
c.getChannelServer().setEvent(new Event(player.getMapId(), players));
Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.earnTitleMessage(
"[Event] An event has started on "