Remove buyback custom feature
This commit is contained in:
@@ -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 net.packet.Packet;
|
||||
import net.server.PlayerBuffValueHolder;
|
||||
import net.server.PlayerCoolDownValueHolder;
|
||||
@@ -52,39 +89,98 @@ import net.server.guild.GuildCharacter;
|
||||
import net.server.guild.GuildPackets;
|
||||
import net.server.services.task.world.CharacterSaveService;
|
||||
import net.server.services.type.WorldServices;
|
||||
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.Shop;
|
||||
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.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;
|
||||
import server.partyquest.MonsterCarnivalParty;
|
||||
import server.partyquest.PartyQuest;
|
||||
import server.quest.Quest;
|
||||
import tools.*;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.LongTool;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.Randomizer;
|
||||
import tools.exceptions.NotEnabledException;
|
||||
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;
|
||||
@@ -94,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);
|
||||
@@ -128,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;
|
||||
@@ -6054,65 +6152,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;
|
||||
@@ -6120,34 +6159,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();
|
||||
@@ -8911,11 +8922,7 @@ public class Character extends AbstractCharacterObject {
|
||||
boolean playerDied = false;
|
||||
if (hp <= 0) {
|
||||
if (oldHp > hp) {
|
||||
if (!isBuybackInvincible()) {
|
||||
playerDied = true;
|
||||
} else {
|
||||
hp = 1;
|
||||
}
|
||||
playerDied = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,179 @@
|
||||
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.ReadPointsCommand;
|
||||
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.GiveRpCommand;
|
||||
import client.command.commands.gm3.GiveVpCommand;
|
||||
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.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;
|
||||
@@ -177,7 +343,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);
|
||||
|
||||
@@ -1,48 +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.processor.action.BuybackProcessor;
|
||||
|
||||
public class BuyBackCommand extends Command {
|
||||
{
|
||||
setDescription("Revive yourself after a death.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
if (params.length < 1) {
|
||||
c.getPlayer().yellowMessage("Syntax: @buyback <info|now>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params[0].contentEquals("now")) {
|
||||
BuybackProcessor.processBuyback(c);
|
||||
} else {
|
||||
c.getPlayer().showBuybackInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user