Merge branch 'refs/heads/master' into feat/postgresql-database
# Conflicts: # config.yaml # docker-compose.yml # pom.xml # src/main/java/client/Character.java # src/main/java/client/Client.java # src/main/java/client/MonsterBook.java # src/main/java/client/command/commands/gm0/BuyBackCommand.java # src/main/java/client/processor/stat/AssignAPProcessor.java # src/main/java/config/ServerConfig.java # src/main/java/net/server/channel/Channel.java # src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java # src/main/java/net/server/channel/handlers/BuddylistModifyHandler.java # src/main/java/net/server/channel/handlers/CloseRangeDamageHandler.java # src/main/java/net/server/channel/handlers/EnterMTSHandler.java # src/main/java/net/server/channel/handlers/NPCTalkHandler.java # src/main/java/net/server/channel/handlers/RangedAttackHandler.java # src/main/java/net/server/channel/handlers/SummonDamageHandler.java # src/main/java/net/server/channel/handlers/UseCashItemHandler.java # src/main/java/net/server/handlers/login/CreateCharHandler.java # src/main/java/net/server/world/World.java # src/main/java/scripting/npc/NPCConversationManager.java # src/main/java/server/ItemInformationProvider.java # src/main/java/server/life/Monster.java # src/main/java/server/life/MonsterInformationProvider.java # src/main/java/server/maps/MapleMap.java # src/main/java/tools/PacketCreator.java # src/test/java/service/NoteServiceTest.java # src/test/java/testutil/Any.java
This commit is contained in:
@@ -31,7 +31,12 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
public class BuddyList {
|
||||
public enum BuddyOperation {
|
||||
|
||||
@@ -24,8 +24,17 @@ package client;
|
||||
|
||||
import client.autoban.AutobanManager;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.*;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Equip.StatUpgrade;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryProof;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.ModifyInventory;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.PetDataFactory;
|
||||
import client.inventory.WeaponType;
|
||||
import client.inventory.manipulator.CashIdGenerator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.keybind.KeyBinding;
|
||||
@@ -40,7 +49,35 @@ import constants.id.ItemId;
|
||||
import constants.id.MapId;
|
||||
import constants.id.MobId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import constants.skills.*;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Beginner;
|
||||
import constants.skills.Bishop;
|
||||
import constants.skills.BlazeWizard;
|
||||
import constants.skills.Bowmaster;
|
||||
import constants.skills.Brawler;
|
||||
import constants.skills.Buccaneer;
|
||||
import constants.skills.Corsair;
|
||||
import constants.skills.Crusader;
|
||||
import constants.skills.DarkKnight;
|
||||
import constants.skills.DawnWarrior;
|
||||
import constants.skills.Evan;
|
||||
import constants.skills.FPArchMage;
|
||||
import constants.skills.Hermit;
|
||||
import constants.skills.Hero;
|
||||
import constants.skills.ILArchMage;
|
||||
import constants.skills.Legend;
|
||||
import constants.skills.Magician;
|
||||
import constants.skills.Marauder;
|
||||
import constants.skills.Marksman;
|
||||
import constants.skills.NightLord;
|
||||
import constants.skills.Noblesse;
|
||||
import constants.skills.Paladin;
|
||||
import constants.skills.Priest;
|
||||
import constants.skills.Ranger;
|
||||
import constants.skills.Shadower;
|
||||
import constants.skills.Sniper;
|
||||
import constants.skills.ThunderBreaker;
|
||||
import constants.skills.Warrior;
|
||||
import model.CharacterIdentity;
|
||||
import net.netty.GameViolationException;
|
||||
import net.packet.Packet;
|
||||
@@ -52,22 +89,59 @@ import net.server.guild.Alliance;
|
||||
import net.server.guild.Guild;
|
||||
import net.server.guild.GuildCharacter;
|
||||
import net.server.guild.GuildPackets;
|
||||
import net.server.world.*;
|
||||
import net.server.world.Messenger;
|
||||
import net.server.world.MessengerCharacter;
|
||||
import net.server.world.Party;
|
||||
import net.server.world.PartyCharacter;
|
||||
import net.server.world.PartyOperation;
|
||||
import net.server.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import scripting.item.ItemScriptManager;
|
||||
import server.*;
|
||||
import server.CashShop;
|
||||
import server.ExpLogger;
|
||||
import server.ExpLogger.ExpLogRecord;
|
||||
import server.ItemInformationProvider;
|
||||
import server.ItemInformationProvider.ScriptedItem;
|
||||
import server.Marriage;
|
||||
import server.StatEffect;
|
||||
import server.Storage;
|
||||
import server.ThreadManager;
|
||||
import server.TimerManager;
|
||||
import server.Trade;
|
||||
import server.events.Events;
|
||||
import server.events.RescueGaga;
|
||||
import server.events.gm.Fitness;
|
||||
import server.events.gm.Ola;
|
||||
import server.life.*;
|
||||
import server.maps.*;
|
||||
import server.life.BanishInfo;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.life.MobSkillId;
|
||||
import server.life.MobSkillType;
|
||||
import server.life.Monster;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.AbstractAnimatedMapObject;
|
||||
import server.maps.Door;
|
||||
import server.maps.DoorObject;
|
||||
import server.maps.Dragon;
|
||||
import server.maps.FieldLimit;
|
||||
import server.maps.HiredMerchant;
|
||||
import server.maps.MapEffect;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapManager;
|
||||
import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MiniGame;
|
||||
import server.maps.MiniGame.MiniGameResult;
|
||||
import server.maps.PlayerShop;
|
||||
import server.maps.PlayerShopItem;
|
||||
import server.maps.Portal;
|
||||
import server.maps.SavedLocation;
|
||||
import server.maps.SavedLocationType;
|
||||
import server.maps.Summon;
|
||||
import server.minigame.RockPaperScissor;
|
||||
import server.partyquest.AriantColiseum;
|
||||
import server.partyquest.MonsterCarnival;
|
||||
@@ -75,17 +149,38 @@ import server.partyquest.MonsterCarnivalParty;
|
||||
import server.partyquest.PartyQuest;
|
||||
import server.quest.Quest;
|
||||
import server.shop.Shop;
|
||||
import tools.*;
|
||||
import tools.exceptions.NotEnabledException;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.LongTool;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.Randomizer;
|
||||
import tools.packets.WeddingPackets;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -95,7 +190,9 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class Character extends AbstractCharacterObject {
|
||||
private static final Logger log = LoggerFactory.getLogger(Character.class);
|
||||
@@ -129,7 +226,7 @@ public class Character extends AbstractCharacterObject {
|
||||
private int expRate = 1, mesoRate = 1, dropRate = 1, expCoupon = 1, mesoCoupon = 1, dropCoupon = 1;
|
||||
private int omokwins, omokties, omoklosses, matchcardwins, matchcardties, matchcardlosses;
|
||||
private int owlSearch;
|
||||
private long lastfametime, lastUsedCashItem, lastExpression = 0, lastHealed, lastBuyback = 0, lastDeathtime, jailExpiration = -1;
|
||||
private long lastfametime, lastUsedCashItem, lastExpression = 0, lastHealed, lastDeathtime, jailExpiration = -1;
|
||||
private transient int localstr, localdex, localluk, localint_, localmagic, localwatk;
|
||||
private transient int equipmaxhp, equipmaxmp, equipstr, equipdex, equipluk, equipint_, equipmagic, equipwatk, localchairhp, localchairmp;
|
||||
private int localchairrate;
|
||||
@@ -255,9 +352,6 @@ public class Character extends AbstractCharacterObject {
|
||||
private int targetHpBarHash = 0;
|
||||
private long targetHpBarTime = 0;
|
||||
private long nextWarningTime = 0;
|
||||
private int banishMap = -1;
|
||||
private int banishSp = -1;
|
||||
private long banishTime = 0;
|
||||
private long lastExpGainTime;
|
||||
private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere
|
||||
private long loginTime;
|
||||
@@ -1259,48 +1353,14 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canRecoverLastBanish() {
|
||||
return System.currentTimeMillis() - this.banishTime < MINUTES.toMillis(5);
|
||||
}
|
||||
|
||||
public Pair<Integer, Integer> getLastBanishData() {
|
||||
return new Pair<>(this.banishMap, this.banishSp);
|
||||
}
|
||||
|
||||
public void clearBanishPlayerData() {
|
||||
this.banishMap = -1;
|
||||
this.banishSp = -1;
|
||||
this.banishTime = 0;
|
||||
}
|
||||
|
||||
public void setBanishPlayerData(int banishMap, int banishSp, long banishTime) {
|
||||
this.banishMap = banishMap;
|
||||
this.banishSp = banishSp;
|
||||
this.banishTime = banishTime;
|
||||
}
|
||||
|
||||
public void changeMapBanish(int mapid, String portal, String msg) {
|
||||
if (YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) {
|
||||
for (Item it : this.getInventory(InventoryType.EQUIPPED).list()) {
|
||||
if ((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int banMap = this.getMapId();
|
||||
int banSp = this.getMap().findClosestPlayerSpawnpoint(this.getPosition()).getId();
|
||||
long banTime = System.currentTimeMillis();
|
||||
|
||||
if (msg != null) {
|
||||
dropMessage(5, msg);
|
||||
public void changeMapBanish(BanishInfo banishInfo) {
|
||||
if (banishInfo.msg() != null) {
|
||||
dropMessage(5, banishInfo.msg());
|
||||
}
|
||||
|
||||
MapleMap map_ = getWarpMap(mapid);
|
||||
Portal portal_ = map_.getPortal(portal);
|
||||
Portal portal_ = map_.getPortal(banishInfo.portal());
|
||||
changeMap(map_, portal_ != null ? portal_ : map_.getRandomPlayerSpawnpoint());
|
||||
|
||||
setBanishPlayerData(banMap, banSp, banTime);
|
||||
}
|
||||
|
||||
public void changeMap(int map) {
|
||||
@@ -1684,7 +1744,6 @@ public class Character extends AbstractCharacterObject {
|
||||
this.mapTransitioning.set(true);
|
||||
|
||||
this.unregisterChairBuff();
|
||||
this.clearBanishPlayerData();
|
||||
Trade.cancelTrade(this, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP);
|
||||
this.closePlayerInteractions();
|
||||
|
||||
@@ -1972,7 +2031,7 @@ public class Character extends AbstractCharacterObject {
|
||||
this.getCashShop().gainCash(1, nxGain);
|
||||
|
||||
if (YamlConfig.config.server.USE_ANNOUNCE_NX_COUPON_LOOT) {
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300);
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(CashShop.NX_CREDIT) + " NX)", 300);
|
||||
}
|
||||
|
||||
this.getMap().pickItemDrop(pickupPacket, mapitem);
|
||||
@@ -2024,7 +2083,7 @@ public class Character extends AbstractCharacterObject {
|
||||
this.getCashShop().gainCash(1, nxGain);
|
||||
|
||||
if (YamlConfig.config.server.USE_ANNOUNCE_NX_COUPON_LOOT) {
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300);
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(CashShop.NX_CREDIT) + " NX)", 300);
|
||||
}
|
||||
} else if (applyConsumeOnPickup(mItem.getItemId())) {
|
||||
} else if (InventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
@@ -5967,7 +6026,8 @@ public class Character extends AbstractCharacterObject {
|
||||
sendPacket(PacketCreator.giveBuff(energybar, 0, stat));
|
||||
sendPacket(PacketCreator.showOwnBuffEffect(energycharge.getId(), 2));
|
||||
getMap().broadcastPacket(this, PacketCreator.showBuffEffect(id, energycharge.getId(), 2));
|
||||
getMap().broadcastPacket(this, PacketCreator.giveForeignBuff(energybar, stat));
|
||||
getMap().broadcastPacket(this, PacketCreator.giveForeignPirateBuff(id, energycharge.getId(),
|
||||
ceffect.getDuration(), stat));
|
||||
}
|
||||
if (energybar >= 10000 && energybar < 11000) {
|
||||
energybar = 15000;
|
||||
@@ -6056,65 +6116,6 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canBuyback(int fee, boolean usingMesos) {
|
||||
return (usingMesos ? this.getMeso() : cashshop.getCash(1)) >= fee;
|
||||
}
|
||||
|
||||
private void applyBuybackFee(int fee, boolean usingMesos) {
|
||||
if (usingMesos) {
|
||||
this.gainMeso(-fee);
|
||||
} else {
|
||||
cashshop.gainCash(1, -fee);
|
||||
}
|
||||
}
|
||||
|
||||
private long getNextBuybackTime() {
|
||||
return lastBuyback + MINUTES.toMillis(YamlConfig.config.server.BUYBACK_COOLDOWN_MINUTES);
|
||||
}
|
||||
|
||||
private boolean isBuybackInvincible() {
|
||||
return Server.getInstance().getCurrentTime() - lastBuyback < 4200;
|
||||
}
|
||||
|
||||
private int getBuybackFee() {
|
||||
float fee = YamlConfig.config.server.BUYBACK_FEE;
|
||||
int grade = Math.min(Math.max(level, 30), 120) - 30;
|
||||
|
||||
fee += (grade * YamlConfig.config.server.BUYBACK_LEVEL_STACK_FEE);
|
||||
if (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS) {
|
||||
fee *= YamlConfig.config.server.BUYBACK_MESO_MULTIPLIER;
|
||||
}
|
||||
|
||||
return (int) Math.floor(fee);
|
||||
}
|
||||
|
||||
public void showBuybackInfo() {
|
||||
String s = "#eBUYBACK STATUS#n\r\n\r\nCurrent buyback fee: #b" + getBuybackFee() + " " + (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS ? "mesos" : "NX") + "#k\r\n\r\n";
|
||||
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
boolean avail = true;
|
||||
if (!isAlive()) {
|
||||
long timeLapsed = timeNow - lastDeathtime;
|
||||
long timeRemaining = MINUTES.toMillis(YamlConfig.config.server.BUYBACK_RETURN_MINUTES) - (timeLapsed + Math.max(0, getNextBuybackTime() - timeNow));
|
||||
if (timeRemaining < 1) {
|
||||
s += "Buyback #e#rUNAVAILABLE#k#n";
|
||||
avail = false;
|
||||
} else {
|
||||
s += "Buyback countdown: #e#b" + getTimeRemaining(MINUTES.toMillis(YamlConfig.config.server.BUYBACK_RETURN_MINUTES) - timeLapsed) + "#k#n";
|
||||
}
|
||||
s += "\r\n";
|
||||
}
|
||||
|
||||
if (timeNow < getNextBuybackTime() && avail) {
|
||||
s += "Buyback available in #r" + getTimeRemaining(getNextBuybackTime() - timeNow) + "#k";
|
||||
s += "\r\n";
|
||||
} else {
|
||||
s += "Buyback #bavailable#k";
|
||||
}
|
||||
|
||||
this.showHint(s);
|
||||
}
|
||||
|
||||
private static String getTimeRemaining(long timeLeft) {
|
||||
int seconds = (int) Math.floor(timeLeft / SECONDS.toMillis(1)) % 60;
|
||||
int minutes = (int) Math.floor(timeLeft / MINUTES.toMillis(1)) % 60;
|
||||
@@ -6122,34 +6123,6 @@ public class Character extends AbstractCharacterObject {
|
||||
return (minutes > 0 ? (String.format("%02d", minutes) + " minutes, ") : "") + String.format("%02d", seconds) + " seconds";
|
||||
}
|
||||
|
||||
public boolean couldBuyback() { // Ronan's buyback system
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
|
||||
if (timeNow - lastDeathtime > MINUTES.toMillis(YamlConfig.config.server.BUYBACK_RETURN_MINUTES)) {
|
||||
this.dropMessage(5, "The period of time to decide has expired, therefore you are unable to buyback.");
|
||||
return false;
|
||||
}
|
||||
|
||||
long nextBuybacktime = getNextBuybackTime();
|
||||
if (timeNow < nextBuybacktime) {
|
||||
long timeLeft = nextBuybacktime - timeNow;
|
||||
this.dropMessage(5, "Next buyback available in " + getTimeRemaining(timeLeft) + ".");
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean usingMesos = YamlConfig.config.server.USE_BUYBACK_WITH_MESOS;
|
||||
int fee = getBuybackFee();
|
||||
|
||||
if (!canBuyback(fee, usingMesos)) {
|
||||
this.dropMessage(5, "You don't have " + fee + " " + (usingMesos ? "mesos" : "NX") + " to buyback.");
|
||||
return false;
|
||||
}
|
||||
|
||||
lastBuyback = timeNow;
|
||||
applyBuybackFee(fee, usingMesos);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isBuffFrom(BuffStat stat, Skill skill) {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
@@ -8878,11 +8851,7 @@ public class Character extends AbstractCharacterObject {
|
||||
boolean playerDied = false;
|
||||
if (hp <= 0) {
|
||||
if (oldHp > hp) {
|
||||
if (!isBuybackInvincible()) {
|
||||
playerDied = true;
|
||||
} else {
|
||||
hp = 1;
|
||||
}
|
||||
playerDied = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10913,70 +10882,33 @@ public class Character extends AbstractCharacterObject {
|
||||
this.commandtext = text;
|
||||
}
|
||||
|
||||
public void setReborns(int value) {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
|
||||
public int getRewardPoints() {
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reborns=? WHERE id=?;")) {
|
||||
PreparedStatement ps = con.prepareStatement("SELECT rewardpoints FROM accounts WHERE id=?;")) {
|
||||
ps.setInt(1, accountid);
|
||||
ResultSet resultSet = ps.executeQuery();
|
||||
int point = -1;
|
||||
if (resultSet.next()) {
|
||||
point = resultSet.getInt(1);
|
||||
}
|
||||
return point;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void setRewardPoints(int value) {
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET rewardpoints=? WHERE id=?;")) {
|
||||
ps.setInt(1, value);
|
||||
ps.setInt(2, id);
|
||||
ps.setInt(2, accountid);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addReborns() {
|
||||
setReborns(getReborns() + 1);
|
||||
}
|
||||
|
||||
public int getReborns() {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT reborns FROM characters WHERE id=?;")) {
|
||||
ps.setInt(1, id);
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
rs.next();
|
||||
return rs.getInt(1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void executeReborn() {
|
||||
// default to beginner: job id = 0
|
||||
// this prevents a breaking change
|
||||
executeRebornAs(Job.BEGINNER);
|
||||
}
|
||||
|
||||
public void executeRebornAsId(int jobId) {
|
||||
executeRebornAs(Job.getById(jobId));
|
||||
}
|
||||
|
||||
public void executeRebornAs(Job job) {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
if (getLevel() != getMaxClassLevel()) {
|
||||
return;
|
||||
}
|
||||
addReborns();
|
||||
changeJob(job);
|
||||
setLevel(0);
|
||||
levelUp(true);
|
||||
}
|
||||
|
||||
//EVENTS
|
||||
private byte team = 0;
|
||||
private Fitness fitness;
|
||||
|
||||
@@ -44,7 +44,11 @@ import net.server.coordinator.session.SessionCoordinator.AntiMulticlientResult;
|
||||
import net.server.guild.Guild;
|
||||
import net.server.guild.GuildCharacter;
|
||||
import net.server.guild.GuildPackets;
|
||||
import net.server.world.*;
|
||||
import net.server.world.MessengerCharacter;
|
||||
import net.server.world.Party;
|
||||
import net.server.world.PartyCharacter;
|
||||
import net.server.world.PartyOperation;
|
||||
import net.server.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
@@ -69,8 +73,23 @@ import java.net.InetSocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -7,9 +7,9 @@ import tools.PacketCreator;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -24,7 +24,11 @@ package client;
|
||||
import server.quest.Quest;
|
||||
import tools.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Matze
|
||||
|
||||
@@ -21,8 +21,63 @@
|
||||
*/
|
||||
package client;
|
||||
|
||||
import constants.skills.*;
|
||||
import provider.*;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Archer;
|
||||
import constants.skills.Assassin;
|
||||
import constants.skills.Bandit;
|
||||
import constants.skills.Beginner;
|
||||
import constants.skills.Bishop;
|
||||
import constants.skills.BlazeWizard;
|
||||
import constants.skills.Bowmaster;
|
||||
import constants.skills.Buccaneer;
|
||||
import constants.skills.ChiefBandit;
|
||||
import constants.skills.Cleric;
|
||||
import constants.skills.Corsair;
|
||||
import constants.skills.Crossbowman;
|
||||
import constants.skills.Crusader;
|
||||
import constants.skills.DarkKnight;
|
||||
import constants.skills.DawnWarrior;
|
||||
import constants.skills.DragonKnight;
|
||||
import constants.skills.Evan;
|
||||
import constants.skills.FPArchMage;
|
||||
import constants.skills.FPMage;
|
||||
import constants.skills.FPWizard;
|
||||
import constants.skills.Fighter;
|
||||
import constants.skills.GM;
|
||||
import constants.skills.Gunslinger;
|
||||
import constants.skills.Hermit;
|
||||
import constants.skills.Hero;
|
||||
import constants.skills.Hunter;
|
||||
import constants.skills.ILArchMage;
|
||||
import constants.skills.ILMage;
|
||||
import constants.skills.ILWizard;
|
||||
import constants.skills.Legend;
|
||||
import constants.skills.Magician;
|
||||
import constants.skills.Marauder;
|
||||
import constants.skills.Marksman;
|
||||
import constants.skills.NightLord;
|
||||
import constants.skills.NightWalker;
|
||||
import constants.skills.Noblesse;
|
||||
import constants.skills.Page;
|
||||
import constants.skills.Paladin;
|
||||
import constants.skills.Pirate;
|
||||
import constants.skills.Priest;
|
||||
import constants.skills.Ranger;
|
||||
import constants.skills.Rogue;
|
||||
import constants.skills.Shadower;
|
||||
import constants.skills.Sniper;
|
||||
import constants.skills.Spearman;
|
||||
import constants.skills.SuperGM;
|
||||
import constants.skills.ThunderBreaker;
|
||||
import constants.skills.Warrior;
|
||||
import constants.skills.WhiteKnight;
|
||||
import constants.skills.WindArcher;
|
||||
import provider.Data;
|
||||
import provider.DataDirectoryEntry;
|
||||
import provider.DataFileEntry;
|
||||
import provider.DataProvider;
|
||||
import provider.DataProviderFactory;
|
||||
import provider.DataTool;
|
||||
import provider.wz.WZFiles;
|
||||
import server.StatEffect;
|
||||
import server.life.Element;
|
||||
|
||||
@@ -24,13 +24,177 @@
|
||||
package client.command;
|
||||
|
||||
import client.Client;
|
||||
import client.command.commands.gm0.*;
|
||||
import client.command.commands.gm1.*;
|
||||
import client.command.commands.gm2.*;
|
||||
import client.command.commands.gm3.*;
|
||||
import client.command.commands.gm4.*;
|
||||
import client.command.commands.gm5.*;
|
||||
import client.command.commands.gm6.*;
|
||||
import client.command.commands.gm0.ChangeLanguageCommand;
|
||||
import client.command.commands.gm0.DisposeCommand;
|
||||
import client.command.commands.gm0.DropLimitCommand;
|
||||
import client.command.commands.gm0.EnableAuthCommand;
|
||||
import client.command.commands.gm0.EquipLvCommand;
|
||||
import client.command.commands.gm0.GachaCommand;
|
||||
import client.command.commands.gm0.GmCommand;
|
||||
import client.command.commands.gm0.HelpCommand;
|
||||
import client.command.commands.gm0.JoinEventCommand;
|
||||
import client.command.commands.gm0.LeaveEventCommand;
|
||||
import client.command.commands.gm0.MapOwnerClaimCommand;
|
||||
import client.command.commands.gm0.OnlineCommand;
|
||||
import client.command.commands.gm0.RanksCommand;
|
||||
import client.command.commands.gm0.RatesCommand;
|
||||
import client.command.commands.gm0.ReportBugCommand;
|
||||
import client.command.commands.gm0.ShowRatesCommand;
|
||||
import client.command.commands.gm0.StaffCommand;
|
||||
import client.command.commands.gm0.StatDexCommand;
|
||||
import client.command.commands.gm0.StatIntCommand;
|
||||
import client.command.commands.gm0.StatLukCommand;
|
||||
import client.command.commands.gm0.StatStrCommand;
|
||||
import client.command.commands.gm0.TimeCommand;
|
||||
import client.command.commands.gm0.ToggleExpCommand;
|
||||
import client.command.commands.gm0.UptimeCommand;
|
||||
import client.command.commands.gm1.BossHpCommand;
|
||||
import client.command.commands.gm1.BuffMeCommand;
|
||||
import client.command.commands.gm1.GotoCommand;
|
||||
import client.command.commands.gm1.MobHpCommand;
|
||||
import client.command.commands.gm1.WhatDropsFromCommand;
|
||||
import client.command.commands.gm1.WhoDropsCommand;
|
||||
import client.command.commands.gm2.ApCommand;
|
||||
import client.command.commands.gm2.BombCommand;
|
||||
import client.command.commands.gm2.BuffCommand;
|
||||
import client.command.commands.gm2.BuffMapCommand;
|
||||
import client.command.commands.gm2.ClearDropsCommand;
|
||||
import client.command.commands.gm2.ClearSavedLocationsCommand;
|
||||
import client.command.commands.gm2.ClearSlotCommand;
|
||||
import client.command.commands.gm2.DcCommand;
|
||||
import client.command.commands.gm2.EmpowerMeCommand;
|
||||
import client.command.commands.gm2.GachaListCommand;
|
||||
import client.command.commands.gm2.GmShopCommand;
|
||||
import client.command.commands.gm2.HealCommand;
|
||||
import client.command.commands.gm2.HideCommand;
|
||||
import client.command.commands.gm2.IdCommand;
|
||||
import client.command.commands.gm2.ItemCommand;
|
||||
import client.command.commands.gm2.ItemDropCommand;
|
||||
import client.command.commands.gm2.JailCommand;
|
||||
import client.command.commands.gm2.JobCommand;
|
||||
import client.command.commands.gm2.LevelCommand;
|
||||
import client.command.commands.gm2.LevelProCommand;
|
||||
import client.command.commands.gm2.LootCommand;
|
||||
import client.command.commands.gm2.MaxSkillCommand;
|
||||
import client.command.commands.gm2.MaxStatCommand;
|
||||
import client.command.commands.gm2.MobSkillCommand;
|
||||
import client.command.commands.gm2.ReachCommand;
|
||||
import client.command.commands.gm2.RechargeCommand;
|
||||
import client.command.commands.gm2.ResetSkillCommand;
|
||||
import client.command.commands.gm2.SearchCommand;
|
||||
import client.command.commands.gm2.SetSlotCommand;
|
||||
import client.command.commands.gm2.SetStatCommand;
|
||||
import client.command.commands.gm2.SpCommand;
|
||||
import client.command.commands.gm2.SummonCommand;
|
||||
import client.command.commands.gm2.UnBugCommand;
|
||||
import client.command.commands.gm2.UnHideCommand;
|
||||
import client.command.commands.gm2.UnJailCommand;
|
||||
import client.command.commands.gm2.WarpAreaCommand;
|
||||
import client.command.commands.gm2.WarpCommand;
|
||||
import client.command.commands.gm2.WarpMapCommand;
|
||||
import client.command.commands.gm2.WhereaMiCommand;
|
||||
import client.command.commands.gm3.BanCommand;
|
||||
import client.command.commands.gm3.ChatCommand;
|
||||
import client.command.commands.gm3.CheckDmgCommand;
|
||||
import client.command.commands.gm3.ClosePortalCommand;
|
||||
import client.command.commands.gm3.DebuffCommand;
|
||||
import client.command.commands.gm3.EndEventCommand;
|
||||
import client.command.commands.gm3.ExpedsCommand;
|
||||
import client.command.commands.gm3.FaceCommand;
|
||||
import client.command.commands.gm3.FameCommand;
|
||||
import client.command.commands.gm3.FlyCommand;
|
||||
import client.command.commands.gm3.GiveMesosCommand;
|
||||
import client.command.commands.gm3.GiveNxCommand;
|
||||
import client.command.commands.gm3.HairCommand;
|
||||
import client.command.commands.gm3.HealMapCommand;
|
||||
import client.command.commands.gm3.HealPersonCommand;
|
||||
import client.command.commands.gm3.HpMpCommand;
|
||||
import client.command.commands.gm3.HurtCommand;
|
||||
import client.command.commands.gm3.IgnoreCommand;
|
||||
import client.command.commands.gm3.IgnoredCommand;
|
||||
import client.command.commands.gm3.InMapCommand;
|
||||
import client.command.commands.gm3.KillAllCommand;
|
||||
import client.command.commands.gm3.KillCommand;
|
||||
import client.command.commands.gm3.KillMapCommand;
|
||||
import client.command.commands.gm3.MaxEnergyCommand;
|
||||
import client.command.commands.gm3.MaxHpMpCommand;
|
||||
import client.command.commands.gm3.MonitorCommand;
|
||||
import client.command.commands.gm3.MonitorsCommand;
|
||||
import client.command.commands.gm3.MusicCommand;
|
||||
import client.command.commands.gm3.MuteMapCommand;
|
||||
import client.command.commands.gm3.NightCommand;
|
||||
import client.command.commands.gm3.NoticeCommand;
|
||||
import client.command.commands.gm3.NpcCommand;
|
||||
import client.command.commands.gm3.OnlineTwoCommand;
|
||||
import client.command.commands.gm3.OpenPortalCommand;
|
||||
import client.command.commands.gm3.PeCommand;
|
||||
import client.command.commands.gm3.PosCommand;
|
||||
import client.command.commands.gm3.QuestCompleteCommand;
|
||||
import client.command.commands.gm3.QuestResetCommand;
|
||||
import client.command.commands.gm3.QuestStartCommand;
|
||||
import client.command.commands.gm3.ReloadDropsCommand;
|
||||
import client.command.commands.gm3.ReloadEventsCommand;
|
||||
import client.command.commands.gm3.ReloadMapCommand;
|
||||
import client.command.commands.gm3.ReloadPortalsCommand;
|
||||
import client.command.commands.gm3.ReloadShopsCommand;
|
||||
import client.command.commands.gm3.RipCommand;
|
||||
import client.command.commands.gm3.SeedCommand;
|
||||
import client.command.commands.gm3.SpawnCommand;
|
||||
import client.command.commands.gm3.StartEventCommand;
|
||||
import client.command.commands.gm3.StartMapEventCommand;
|
||||
import client.command.commands.gm3.StopMapEventCommand;
|
||||
import client.command.commands.gm3.TimerAllCommand;
|
||||
import client.command.commands.gm3.TimerCommand;
|
||||
import client.command.commands.gm3.TimerMapCommand;
|
||||
import client.command.commands.gm3.ToggleCouponCommand;
|
||||
import client.command.commands.gm3.UnBanCommand;
|
||||
import client.command.commands.gm4.BossDropRateCommand;
|
||||
import client.command.commands.gm4.CakeCommand;
|
||||
import client.command.commands.gm4.DropRateCommand;
|
||||
import client.command.commands.gm4.ExpRateCommand;
|
||||
import client.command.commands.gm4.FishingRateCommand;
|
||||
import client.command.commands.gm4.ForceVacCommand;
|
||||
import client.command.commands.gm4.HorntailCommand;
|
||||
import client.command.commands.gm4.ItemVacCommand;
|
||||
import client.command.commands.gm4.MesoRateCommand;
|
||||
import client.command.commands.gm4.PapCommand;
|
||||
import client.command.commands.gm4.PianusCommand;
|
||||
import client.command.commands.gm4.PinkbeanCommand;
|
||||
import client.command.commands.gm4.PlayerNpcCommand;
|
||||
import client.command.commands.gm4.PlayerNpcRemoveCommand;
|
||||
import client.command.commands.gm4.PmobCommand;
|
||||
import client.command.commands.gm4.PmobRemoveCommand;
|
||||
import client.command.commands.gm4.PnpcCommand;
|
||||
import client.command.commands.gm4.PnpcRemoveCommand;
|
||||
import client.command.commands.gm4.ProItemCommand;
|
||||
import client.command.commands.gm4.QuestRateCommand;
|
||||
import client.command.commands.gm4.ServerMessageCommand;
|
||||
import client.command.commands.gm4.SetEqStatCommand;
|
||||
import client.command.commands.gm4.TravelRateCommand;
|
||||
import client.command.commands.gm4.ZakumCommand;
|
||||
import client.command.commands.gm5.DebugCommand;
|
||||
import client.command.commands.gm5.IpListCommand;
|
||||
import client.command.commands.gm5.SetCommand;
|
||||
import client.command.commands.gm5.ShowMoveLifeCommand;
|
||||
import client.command.commands.gm5.ShowPacketsCommand;
|
||||
import client.command.commands.gm5.ShowSessionsCommand;
|
||||
import client.command.commands.gm6.ClearQuestCacheCommand;
|
||||
import client.command.commands.gm6.ClearQuestCommand;
|
||||
import client.command.commands.gm6.DCAllCommand;
|
||||
import client.command.commands.gm6.DevtestCommand;
|
||||
import client.command.commands.gm6.EraseAllPNpcsCommand;
|
||||
import client.command.commands.gm6.GetAccCommand;
|
||||
import client.command.commands.gm6.MapPlayersCommand;
|
||||
import client.command.commands.gm6.SaveAllCommand;
|
||||
import client.command.commands.gm6.ServerAddChannelCommand;
|
||||
import client.command.commands.gm6.ServerAddWorldCommand;
|
||||
import client.command.commands.gm6.ServerRemoveChannelCommand;
|
||||
import client.command.commands.gm6.ServerRemoveWorldCommand;
|
||||
import client.command.commands.gm6.SetGmLevelCommand;
|
||||
import client.command.commands.gm6.ShutdownCommand;
|
||||
import client.command.commands.gm6.SpawnAllPNpcsCommand;
|
||||
import client.command.commands.gm6.SupplyRateCouponCommand;
|
||||
import client.command.commands.gm6.WarpWorldCommand;
|
||||
import constants.id.MapId;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -178,7 +342,6 @@ public class CommandsExecutor {
|
||||
addCommand("droplimit", DropLimitCommand.class);
|
||||
addCommand("time", TimeCommand.class);
|
||||
addCommand("credits", StaffCommand.class);
|
||||
addCommand("buyback", BuyBackCommand.class);
|
||||
addCommand("uptime", UptimeCommand.class);
|
||||
addCommand("gacha", GachaCommand.class);
|
||||
addCommand("dispose", DisposeCommand.class);
|
||||
@@ -389,6 +552,7 @@ public class CommandsExecutor {
|
||||
addCommand("addworld", 6, ServerAddWorldCommand.class);
|
||||
addCommand("removechannel", 6, ServerRemoveChannelCommand.class);
|
||||
addCommand("removeworld", 6, ServerRemoveWorldCommand.class);
|
||||
addCommand("devtest", 6, DevtestCommand.class);
|
||||
|
||||
commandsNameDesc.add(levelCommandsCursor);
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server, commands OdinMS-based
|
||||
Copyleft (L) 2016 - 2019 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
@Author: Arthur L - Refactored command content into modules
|
||||
*/
|
||||
package client.command.commands.gm0;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import client.processor.action.BuybackProcessor;
|
||||
|
||||
public class BuyBackCommand extends Command {
|
||||
{
|
||||
setDescription("Revive yourself after a death.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params, CommandContext ctx) {
|
||||
if (params.length < 1) {
|
||||
c.getPlayer().yellowMessage("Syntax: @buyback <info|now>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params[0].contentEquals("now")) {
|
||||
BuybackProcessor.processBuyback(c);
|
||||
} else {
|
||||
c.getPlayer().showBuybackInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,10 @@ import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import net.server.Server;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static java.util.concurrent.TimeUnit.HOURS;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class UptimeCommand extends Command {
|
||||
{
|
||||
|
||||
@@ -29,7 +29,11 @@ import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import constants.game.GameConstants;
|
||||
import constants.id.NpcId;
|
||||
import server.maps.*;
|
||||
import server.maps.FieldLimit;
|
||||
import server.maps.MapFactory;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MiniDungeonInfo;
|
||||
import server.maps.Portal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -12,7 +12,11 @@ import tools.exceptions.IdTypeNotSupportedException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.Character;
|
||||
import client.*;
|
||||
import client.Client;
|
||||
import client.Job;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import provider.Data;
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
package client.command.commands.gm2;
|
||||
|
||||
import client.Character;
|
||||
import client.*;
|
||||
import client.Client;
|
||||
import client.Job;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import provider.Data;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package client.command.commands.gm6;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import client.command.CommandContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import scripting.AbstractScriptManager;
|
||||
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
public class DevtestCommand extends Command {
|
||||
{
|
||||
setDescription("Runs devtest.js. Developer utility - test stuff without restarting the server.");
|
||||
}
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DevtestCommand.class);
|
||||
|
||||
private static class DevtestScriptManager extends AbstractScriptManager {
|
||||
|
||||
@Override
|
||||
public ScriptEngine getInvocableScriptEngine(String path) {
|
||||
return super.getInvocableScriptEngine(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Client client, String[] params, CommandContext context) {
|
||||
DevtestScriptManager scriptManager = new DevtestScriptManager();
|
||||
ScriptEngine scriptEngine = scriptManager.getInvocableScriptEngine("devtest.js");
|
||||
try {
|
||||
Invocable invocable = (Invocable) scriptEngine;
|
||||
invocable.invokeFunction("run", client.getPlayer());
|
||||
} catch (ScriptException | NoSuchMethodException e) {
|
||||
log.info("devtest.js run() threw an exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,10 @@ import net.server.Server;
|
||||
import net.server.world.World;
|
||||
import server.TimerManager;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.*;
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static java.util.concurrent.TimeUnit.HOURS;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class ShutdownCommand extends Command {
|
||||
{
|
||||
|
||||
@@ -47,19 +47,19 @@ public abstract class CharacterFactory {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Character newchar = Character.getDefault(c);
|
||||
newchar.setWorld(c.getWorld());
|
||||
newchar.setSkinColor(SkinColor.getById(skin));
|
||||
newchar.setGender(gender);
|
||||
newchar.setName(name);
|
||||
newchar.setHair(hair);
|
||||
newchar.setFace(face);
|
||||
Character newCharacter = Character.getDefault(c);
|
||||
newCharacter.setWorld(c.getWorld());
|
||||
newCharacter.setSkinColor(SkinColor.getById(skin));
|
||||
newCharacter.setGender(gender);
|
||||
newCharacter.setName(name);
|
||||
newCharacter.setHair(hair);
|
||||
newCharacter.setFace(face);
|
||||
|
||||
newchar.setLevel(recipe.getLevel());
|
||||
newchar.setJob(recipe.getJob());
|
||||
newchar.setMapId(recipe.getMap());
|
||||
newCharacter.setLevel(recipe.getLevel());
|
||||
newCharacter.setJob(recipe.getJob());
|
||||
newCharacter.setMapId(recipe.getMap());
|
||||
|
||||
Inventory equipped = newchar.getInventory(InventoryType.EQUIPPED);
|
||||
Inventory equipped = newCharacter.getInventory(InventoryType.EQUIPPED);
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
|
||||
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
|
||||
@@ -88,12 +88,17 @@ public abstract class CharacterFactory {
|
||||
equipped.addItemFromDB(eq_weapon.copy());
|
||||
}
|
||||
|
||||
if (!newchar.insertNewChar(recipe)) {
|
||||
if (!MakeCharInfoValidator.isNewCharacterValid(newCharacter)) {
|
||||
log.warn("Owner from account {} tried to packet edit in character creation", c.getAccountName());
|
||||
return -2;
|
||||
}
|
||||
c.sendPacket(PacketCreator.addNewCharEntry(newchar));
|
||||
|
||||
Server.getInstance().createCharacterEntry(newchar);
|
||||
if (!newCharacter.insertNewChar(recipe)) {
|
||||
return -2;
|
||||
}
|
||||
c.sendPacket(PacketCreator.addNewCharEntry(newCharacter));
|
||||
|
||||
Server.getInstance().createCharacterEntry(newCharacter);
|
||||
Server.getInstance().broadcastGMMessage(c.getWorld(), PacketCreator.sendYellowTip("[New Char]: " + c.getAccountName() + " has created a new character with IGN " + name));
|
||||
log.info("Account {} created chr with name {}", c.getAccountName(), name);
|
||||
|
||||
|
||||
140
src/main/java/client/creator/MakeCharInfo.java
Normal file
140
src/main/java/client/creator/MakeCharInfo.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package client.creator;
|
||||
|
||||
import client.Character;
|
||||
import client.Job;
|
||||
import client.inventory.InventoryType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import provider.Data;
|
||||
import provider.DataTool;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class MakeCharInfo {
|
||||
private static final Logger log = LoggerFactory.getLogger(MakeCharInfo.class);
|
||||
private static final String FACE_ID = "0";
|
||||
private static final String HAIR_ID = "1";
|
||||
private static final String HAIR_COLOR_ID = "2";
|
||||
private static final String SKIN_ID = "3";
|
||||
private static final String TOP_ID = "4";
|
||||
private static final String BOTTOM_ID = "5";
|
||||
private static final String SHOE_ID = "6";
|
||||
private static final String WEAPON_ID = "7";
|
||||
|
||||
private final Set<Integer> charFaces = new HashSet<>();
|
||||
private final Set<Integer> charHairs = new HashSet<>();
|
||||
private final Set<Integer> charHairColors = new HashSet<>();
|
||||
private final Set<Integer> charSkins = new HashSet<>();
|
||||
private final Set<Integer> charTops = new HashSet<>();
|
||||
private final Set<Integer> charBottoms = new HashSet<>();
|
||||
private final Set<Integer> charShoes = new HashSet<>();
|
||||
private final Set<Integer> charWeapons = new HashSet<>();
|
||||
|
||||
public MakeCharInfo(Data charInfoData) {
|
||||
for (Data data : charInfoData.getChildren()) {
|
||||
switch (data.getName()) {
|
||||
case FACE_ID -> {
|
||||
for (Data faceData : data) {
|
||||
charFaces.add(DataTool.getInt(faceData));
|
||||
}
|
||||
}
|
||||
case HAIR_ID -> {
|
||||
for (Data hairData : data) {
|
||||
charHairs.add(DataTool.getInt(hairData));
|
||||
}
|
||||
}
|
||||
case HAIR_COLOR_ID -> {
|
||||
for (Data hairColorData : data) {
|
||||
charHairColors.add(DataTool.getInt(hairColorData));
|
||||
}
|
||||
}
|
||||
case SKIN_ID -> {
|
||||
for (Data skinData : data) {
|
||||
charSkins.add(DataTool.getInt(skinData));
|
||||
}
|
||||
}
|
||||
case TOP_ID -> {
|
||||
for (Data topData : data) {
|
||||
charTops.add(DataTool.getInt(topData));
|
||||
}
|
||||
}
|
||||
case BOTTOM_ID -> {
|
||||
for (Data bottomData : data) {
|
||||
charBottoms.add(DataTool.getInt(bottomData));
|
||||
}
|
||||
}
|
||||
case SHOE_ID -> {
|
||||
for (Data shoeData : data) {
|
||||
charShoes.add(DataTool.getInt(shoeData));
|
||||
}
|
||||
}
|
||||
case WEAPON_ID -> {
|
||||
for (Data weaponData : data) {
|
||||
charWeapons.add(DataTool.getInt(weaponData));
|
||||
}
|
||||
}
|
||||
default -> log.error("Unhandled node inside MakeCharInfo.img.xml: '" + data.getName() + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean verifyFaceId(int id) {
|
||||
return this.charFaces.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyHairId(int id) {
|
||||
if (id % 10 != 0) {
|
||||
return this.charHairs.contains(id - (id % 10));
|
||||
}
|
||||
return this.charHairs.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyHairColorId(int id) {
|
||||
return this.charHairColors.contains(id % 10);
|
||||
}
|
||||
|
||||
public boolean verifySkinId(int id) {
|
||||
return this.charSkins.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyTopId(int id) {
|
||||
return this.charTops.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyBottomId(int id) {
|
||||
return this.charBottoms.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyShoeId(int id) {
|
||||
return this.charShoes.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyWeaponId(int id) {
|
||||
return this.charWeapons.contains(id);
|
||||
}
|
||||
|
||||
public boolean verifyCharacter(Character character) {
|
||||
if (!verifyFaceId(character.getFace())) return false;
|
||||
if (!verifyHairId(character.getHair())) return false;
|
||||
if (!verifyHairColorId(character.getHair())) return false;
|
||||
if (!verifySkinId(character.getSkinColor().getId())) return false;
|
||||
|
||||
// Here we only verify the equipment if the character that's being created is of type 'Beginner'
|
||||
// This is because when the Maple Life A or Maple Life B items are used, the client does not send any data
|
||||
// regarding what equipment the character should be wearing (as it's all handled server-side)
|
||||
Job characterJob = character.getJob();
|
||||
if (characterJob == Job.BEGINNER || characterJob == Job.NOBLESSE || characterJob == Job.LEGEND) {
|
||||
if (!verifyTopId(character.getInventory(InventoryType.EQUIPPED).getItem((short) -5).getItemId()))
|
||||
return false;
|
||||
if (!verifyBottomId(character.getInventory(InventoryType.EQUIPPED).getItem((short) -6).getItemId()))
|
||||
return false;
|
||||
if (!verifyShoeId(character.getInventory(InventoryType.EQUIPPED).getItem((short) -7).getItemId()))
|
||||
return false;
|
||||
if (!verifyWeaponId(character.getInventory(InventoryType.EQUIPPED).getItem((short) -11).getItemId()))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
41
src/main/java/client/creator/MakeCharInfoValidator.java
Normal file
41
src/main/java/client/creator/MakeCharInfoValidator.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package client.creator;
|
||||
|
||||
import client.Character;
|
||||
import provider.Data;
|
||||
import provider.DataProviderFactory;
|
||||
import provider.wz.WZFiles;
|
||||
|
||||
public class MakeCharInfoValidator {
|
||||
private static final MakeCharInfo charFemale;
|
||||
private static final MakeCharInfo charMale;
|
||||
private static final MakeCharInfo orientCharFemale;
|
||||
private static final MakeCharInfo orientCharMale;
|
||||
private static final MakeCharInfo premiumCharFemale;
|
||||
private static final MakeCharInfo premiumCharMale;
|
||||
|
||||
static {
|
||||
Data data = DataProviderFactory.getDataProvider(WZFiles.ETC).getData("MakeCharInfo.img");
|
||||
charFemale = new MakeCharInfo(data.getChildByPath("Info/CharFemale"));
|
||||
charMale = new MakeCharInfo(data.getChildByPath("Info/CharMale"));
|
||||
orientCharFemale = new MakeCharInfo(data.getChildByPath("OrientCharFemale"));
|
||||
orientCharMale = new MakeCharInfo(data.getChildByPath("OrientCharMale"));
|
||||
premiumCharFemale = new MakeCharInfo(data.getChildByPath("PremiumCharFemale"));
|
||||
premiumCharMale = new MakeCharInfo(data.getChildByPath("PremiumCharMale"));
|
||||
}
|
||||
|
||||
private static MakeCharInfo getMakeCharInfo(Character character) {
|
||||
return switch (character.getJob()) {
|
||||
case BEGINNER, WARRIOR, MAGICIAN, BOWMAN, THIEF, PIRATE -> character.isMale() ? charMale : charFemale;
|
||||
case NOBLESSE -> character.isMale() ? premiumCharMale : premiumCharFemale;
|
||||
case LEGEND -> character.isMale() ? orientCharMale : orientCharFemale;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean isNewCharacterValid(Character character) {
|
||||
MakeCharInfo makeCharInfo = getMakeCharInfo(character);
|
||||
if (makeCharInfo == null) return false;
|
||||
|
||||
return makeCharInfo.verifyCharacter(character);
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public class BeginnerCreator extends CharacterFactory {
|
||||
}
|
||||
|
||||
public static int createCharacter(Client c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
|
||||
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.BEGINNER, 1, MapId.MUSHROOM_TOWN, top, bottom, shoes, weapon));
|
||||
return status;
|
||||
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.BEGINNER, 1, MapId.MUSHROOM_TOWN, top, bottom, shoes, weapon));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public class LegendCreator extends CharacterFactory {
|
||||
}
|
||||
|
||||
public static int createCharacter(Client c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
|
||||
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.LEGEND, 1, MapId.ARAN_TUTORIAL_START, top, bottom, shoes, weapon));
|
||||
return status;
|
||||
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.LEGEND, 1, MapId.ARAN_TUTORIAL_START, top, bottom, shoes, weapon));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public class NoblesseCreator extends CharacterFactory {
|
||||
}
|
||||
|
||||
public static int createCharacter(Client c, String name, int face, int hair, int skin, int top, int bottom, int shoes, int weapon, int gender) {
|
||||
int status = createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.NOBLESSE, 1, MapId.STARTING_MAP_NOBLESSE, top, bottom, shoes, weapon));
|
||||
return status;
|
||||
return createNewCharacter(c, name, face, hair, skin, gender, createRecipe(Job.NOBLESSE, 1, MapId.STARTING_MAP_NOBLESSE, top, bottom, shoes, weapon));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,14 @@ import server.ItemInformationProvider;
|
||||
import server.ThreadManager;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -652,4 +659,4 @@ public class Inventory implements Iterable<Item> {
|
||||
public void dispose() {
|
||||
owner = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@ package client.inventory;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.Pair;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@@ -418,4 +422,4 @@ public enum ItemFactory {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,12 @@ package client.inventory.manipulator;
|
||||
import client.BuffStat;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.inventory.*;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ModifyInventory;
|
||||
import client.inventory.Pet;
|
||||
import client.newyear.NewYearCardRecord;
|
||||
import config.YamlConfig;
|
||||
import constants.id.ItemId;
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2019 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client.processor.action; // thanks Alex for pointing out some package structures containing broad modules
|
||||
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import server.maps.MapleMap;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class BuybackProcessor {
|
||||
|
||||
public static void processBuyback(Client c) {
|
||||
Character chr = c.getPlayer();
|
||||
boolean buyback;
|
||||
|
||||
c.lockClient();
|
||||
try {
|
||||
buyback = !chr.isAlive() && chr.couldBuyback();
|
||||
} finally {
|
||||
c.unlockClient();
|
||||
}
|
||||
|
||||
if (buyback) {
|
||||
String jobString;
|
||||
switch (chr.getJobStyle()) {
|
||||
case WARRIOR:
|
||||
jobString = "warrior";
|
||||
break;
|
||||
|
||||
case MAGICIAN:
|
||||
jobString = "magician";
|
||||
break;
|
||||
|
||||
case BOWMAN:
|
||||
jobString = "bowman";
|
||||
break;
|
||||
|
||||
case THIEF:
|
||||
jobString = "thief";
|
||||
break;
|
||||
|
||||
case BRAWLER:
|
||||
case GUNSLINGER:
|
||||
jobString = "pirate";
|
||||
break;
|
||||
|
||||
default:
|
||||
jobString = "beginner";
|
||||
}
|
||||
|
||||
chr.healHpMp();
|
||||
chr.purgeDebuffs();
|
||||
chr.broadcastStance(chr.isFacingLeft() ? 5 : 4);
|
||||
|
||||
MapleMap map = chr.getMap();
|
||||
map.broadcastMessage(PacketCreator.playSound("Buyback/" + jobString));
|
||||
map.broadcastMessage(PacketCreator.earnTitleMessage(chr.getName() + " just bought back into the game!"));
|
||||
|
||||
chr.sendPacket(PacketCreator.showBuybackEffect());
|
||||
map.broadcastMessage(chr, PacketCreator.showForeignBuybackEffect(chr.getId()), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,12 @@ import tools.DatabaseConnection;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@@ -41,7 +41,11 @@ import tools.DatabaseConnection;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
package client.processor.stat;
|
||||
|
||||
import client.Character;
|
||||
import client.*;
|
||||
import client.Client;
|
||||
import client.Job;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.Stat;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
@@ -32,6 +36,12 @@ import client.inventory.Item;
|
||||
import config.YamlConfig;
|
||||
import constants.skills.*;
|
||||
import net.netty.GameViolationException;
|
||||
import constants.skills.BlazeWizard;
|
||||
import constants.skills.Brawler;
|
||||
import constants.skills.DawnWarrior;
|
||||
import constants.skills.Magician;
|
||||
import constants.skills.ThunderBreaker;
|
||||
import constants.skills.Warrior;
|
||||
import net.packet.InPacket;
|
||||
import tools.PacketCreator;
|
||||
import tools.Randomizer;
|
||||
@@ -542,16 +552,14 @@ public class AssignAPProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
int hp = player.getMaxHp();
|
||||
int level_ = player.getLevel();
|
||||
if (hp < level_ * 14 + 148) {
|
||||
int hplose = -takeHp(player.getJob());
|
||||
if (player.getMaxHp() + hplose < getMinHp(player.getJob(), player.getLevel())) {
|
||||
player.message("You don't have the minimum HP pool required to swap.");
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
|
||||
int curHp = player.getHp();
|
||||
int hplose = -takeHp(player.getJob());
|
||||
player.assignHP(hplose, -1);
|
||||
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
|
||||
player.updateHp(Math.max(1, curHp + hplose));
|
||||
@@ -573,29 +581,14 @@ public class AssignAPProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
int mp = player.getMaxMp();
|
||||
int level = player.getLevel();
|
||||
Job job = player.getJob();
|
||||
|
||||
boolean canWash = true;
|
||||
if (job.isA(Job.SPEARMAN) && mp < 4 * level + 156) {
|
||||
canWash = false;
|
||||
} else if ((job.isA(Job.FIGHTER) || job.isA(Job.ARAN1)) && mp < 4 * level + 56) {
|
||||
canWash = false;
|
||||
} else if (job.isA(Job.THIEF) && job.getId() % 100 > 0 && mp < level * 14 - 4) {
|
||||
canWash = false;
|
||||
} else if (mp < level * 14 + 148) {
|
||||
canWash = false;
|
||||
}
|
||||
|
||||
if (!canWash) {
|
||||
int mplose = -takeMp(player.getJob());
|
||||
if (player.getMaxMp() + mplose < getMinMp(player.getJob(), player.getLevel())) {
|
||||
player.message("You don't have the minimum MP pool required to swap.");
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
|
||||
int curMp = player.getMp();
|
||||
int mplose = -takeMp(job);
|
||||
player.assignMP(mplose, -1);
|
||||
if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) {
|
||||
player.updateMp(Math.max(0, curMp + mplose));
|
||||
@@ -886,4 +879,109 @@ public class AssignAPProcessor {
|
||||
return MaxMP;
|
||||
}
|
||||
|
||||
public static int getMinHp(Job job, int level) {
|
||||
int multiplier = 0;
|
||||
int offset = 0;
|
||||
|
||||
if (job == Job.WARRIOR ||
|
||||
job.isA(Job.PAGE) ||
|
||||
job.isA(Job.SPEARMAN) ||
|
||||
job == Job.DAWNWARRIOR1 ||
|
||||
job == Job.ARAN1) {
|
||||
multiplier = 24; offset = 118;
|
||||
|
||||
} else if (job.isA(Job.FIGHTER) ||
|
||||
job.isA(Job.DAWNWARRIOR2) ||
|
||||
job.isA(Job.ARAN2)) {
|
||||
multiplier = 24; offset = 418;
|
||||
|
||||
} else if (job.isA(Job.MAGICIAN) ||
|
||||
job.isA(Job.BLAZEWIZARD1)) {
|
||||
multiplier = 10; offset = 54;
|
||||
|
||||
} else if (job == Job.BOWMAN ||
|
||||
job == Job.THIEF ||
|
||||
job == Job.WINDARCHER1 ||
|
||||
job == Job.NIGHTWALKER1) {
|
||||
multiplier = 20; offset = 58;
|
||||
|
||||
} else if (job.isA(Job.HUNTER) ||
|
||||
job.isA(Job.CROSSBOWMAN) ||
|
||||
job.isA(Job.ASSASSIN) ||
|
||||
job.isA(Job.BANDIT) ||
|
||||
job.isA(Job.WINDARCHER2) ||
|
||||
job.isA(Job.NIGHTWALKER2)) {
|
||||
multiplier = 20; offset = 358;
|
||||
|
||||
} else if (job == Job.PIRATE ||
|
||||
job == Job.THUNDERBREAKER1) {
|
||||
multiplier = 22; offset = 38;
|
||||
|
||||
} else if (job.isA(Job.BRAWLER) ||
|
||||
job.isA(Job.GUNSLINGER) ||
|
||||
job.isA(Job.THUNDERBREAKER2)) {
|
||||
multiplier = 22; offset = 338;
|
||||
|
||||
} else if (job == Job.BEGINNER ||
|
||||
job == Job.NOBLESSE) {
|
||||
multiplier = 12; offset = 38;
|
||||
}
|
||||
|
||||
return (multiplier * level) + offset;
|
||||
}
|
||||
|
||||
public static int getMinMp(Job job, int level) {
|
||||
int multiplier = 0;
|
||||
int offset = 0;
|
||||
|
||||
if (job == Job.WARRIOR ||
|
||||
job.isA(Job.FIGHTER) ||
|
||||
job.isA(Job.DAWNWARRIOR1) ||
|
||||
job.isA(Job.ARAN1)) {
|
||||
multiplier = 4; offset = 55;
|
||||
|
||||
} else if (job.isA(Job.PAGE) ||
|
||||
job.isA(Job.SPEARMAN)) {
|
||||
multiplier = 4; offset = 155;
|
||||
|
||||
} else if (job == Job.MAGICIAN ||
|
||||
job == Job.BLAZEWIZARD1) {
|
||||
multiplier = 22; offset = -1;
|
||||
|
||||
} else if (job.isA(Job.FP_WIZARD) ||
|
||||
job.isA(Job.IL_WIZARD) ||
|
||||
job.isA(Job.CLERIC) ||
|
||||
job.isA(Job.BLAZEWIZARD2)) {
|
||||
multiplier = 22; offset = 449;
|
||||
|
||||
} else if (job == Job.BOWMAN ||
|
||||
job == Job.THIEF ||
|
||||
job == Job.WINDARCHER1 ||
|
||||
job == Job.NIGHTWALKER1) {
|
||||
multiplier = 14; offset = -15;
|
||||
|
||||
} else if (job.isA(Job.HUNTER) ||
|
||||
job.isA(Job.CROSSBOWMAN) ||
|
||||
job.isA(Job.ASSASSIN) ||
|
||||
job.isA(Job.BANDIT) ||
|
||||
job.isA(Job.WINDARCHER2) ||
|
||||
job.isA(Job.NIGHTWALKER2)) {
|
||||
multiplier = 14; offset = 135;
|
||||
|
||||
} else if (job == Job.PIRATE ||
|
||||
job == Job.THUNDERBREAKER1) {
|
||||
multiplier = 18; offset = -55;
|
||||
|
||||
} else if (job.isA(Job.BRAWLER) ||
|
||||
job.isA(Job.GUNSLINGER) ||
|
||||
job.isA(Job.THUNDERBREAKER2)) {
|
||||
multiplier = 18; offset = 95;
|
||||
|
||||
} else if (job == Job.BEGINNER ||
|
||||
job == Job.NOBLESSE) {
|
||||
multiplier = 10; offset = -5;
|
||||
}
|
||||
|
||||
return (multiplier * level) + offset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user