From 04a92fe0c1f19140cf13863b601c7c8ebf33ef0d Mon Sep 17 00:00:00 2001 From: P0nk Date: Tue, 21 May 2024 19:42:56 +0200 Subject: [PATCH] Remove buyback custom feature --- config.yaml | 9 - docs/feature_list.md | 4 +- scripts/npc/9977777.js | 5 +- src/main/java/client/Character.java | 213 +++++++-------- .../java/client/command/CommandsExecutor.java | 181 ++++++++++++- .../command/commands/gm0/BuyBackCommand.java | 48 ---- .../processor/action/BuybackProcessor.java | 83 ------ src/main/java/config/ServerConfig.java | 9 - .../channel/handlers/EnterMTSHandler.java | 249 +++++++++--------- src/main/java/tools/PacketCreator.java | 73 +++-- wz/Sound.wz/Field.img.xml | 23 -- 11 files changed, 459 insertions(+), 438 deletions(-) delete mode 100644 src/main/java/client/command/commands/gm0/BuyBackCommand.java delete mode 100644 src/main/java/client/processor/action/BuybackProcessor.java diff --git a/config.yaml b/config.yaml index 77ea225d1a..bcbb1c37db 100644 --- a/config.yaml +++ b/config.yaml @@ -220,7 +220,6 @@ server: USE_MTS: false USE_CPQ: true #Renders the CPQ available or not. USE_AUTOHIDE_GM: true #When enabled, GMs are automatically hidden when joining. Thanks to Steven Deblois (steven1152). - USE_BUYBACK_SYSTEM: false #Enables the HeavenMS-builtin buyback system, to be used by dead players when clicking the MTS button. USE_FIXED_RATIO_HPMP_UPDATE: false #Enables the HeavenMS-builtin HPMP update based on the current pool to max pool ratio. USE_FAMILY_SYSTEM: true USE_DUEY: true @@ -447,14 +446,6 @@ server: WEDDING_GIFT_LIMIT: 1 #Max number of gifts per person to same wishlist on marriage instances. WEDDING_BLESSER_SHOWFX: true #Pops bubble sprite effect on players blessing the couple. Setting this false shows the blessing effect on the couple instead. - #Buyback Configuration - USE_BUYBACK_WITH_MESOS: true #Enables usage of either mesos or NX for the buyback fee. - BUYBACK_FEE: 77.70 #Sets the base amount needed to buyback (level 30 or under will use the base value). - BUYBACK_LEVEL_STACK_FEE: 85.47 #Sets the level-stacking portion of the amount needed to buyback (fee will sum up linearly until level 120, when it reaches the peak). - BUYBACK_MESO_MULTIPLIER: 1000 #Sets a multiplier for the fee when using meso as the charge unit. - BUYBACK_RETURN_MINUTES: 1 #Sets the maximum amount of time the player can wait before decide to buyback. - BUYBACK_COOLDOWN_MINUTES: 7 #Sets the time the player must wait before using buyback again. - # Login timeout by shavit TIMEOUT_DURATION: 3600000 # Kicks clients who don't send any packet to the game server in due time (in millisseconds). diff --git a/docs/feature_list.md b/docs/feature_list.md index 5e0b410217..235ff0e7f4 100644 --- a/docs/feature_list.md +++ b/docs/feature_list.md @@ -302,10 +302,10 @@ Localhost: * Removed caps for MATK, WDEF, MDEF, ACC and AVOID. * Removed "AP excess" popup and "Admin/MWLB" action block, original credits to kevintjuh93. * Removed "You've gained a level!" popup, original credits to PrinceReborn. -* Removed "Cannot enter MTS from this map." popup on maps that blocks transitions (such change channel, CS/MTS), rendering the buyback option now available for all maps. +* Removed "Cannot enter MTS from this map." popup on maps that blocks transitions (such change channel, CS/MTS). * Removed a check for players wishing to create/join a party being novices under level 10. * Set a new high cap for SPEED. * Removed the AP assign block for novices. * Removed a block that would show up when trying to apply an attack gem on equipments that aren't weapons. ---------------------------- \ No newline at end of file +--------------------------- diff --git a/scripts/npc/9977777.js b/scripts/npc/9977777.js index ce1087771b..7231068bd4 100644 --- a/scripts/npc/9977777.js +++ b/scripts/npc/9977777.js @@ -217,7 +217,6 @@ function writeFeatureTab_Serverpotentials() { addFeature("Poison damage value visible for other players."); addFeature("M. book announcer displays info based on demand."); addFeature("Custom jail system."); - addFeature("Custom buyback system, uses mesos / NX, via MTS."); addFeature("Custom fishing system having 'seasonal' catch times."); addFeature("Actual fishing handling w/ F. Net - thanks Dragohe4rt!"); addFeature("Custom map leasing system."); @@ -260,7 +259,7 @@ function writeFeatureTab_CustomNPCs() { function writeFeatureTab_Localhostedits() { addFeature("Removed the 'n' NPC dialog issue."); addFeature("Removed caps for MATK, WMDEF, ACC and AVOID."); - addFeature("Removed MTS block, buyback available anywhere."); + addFeature("Removed MTS block."); addFeature("Removed party blocks for novices under level 10."); addFeature("Set a much more higher cap for SPEED."); addFeature("Removed AP usage block for novices."); @@ -369,4 +368,4 @@ function generateSelectionMenu(array) { menu += "#L" + i + "#" + array[i] + "#l\r\n"; } return menu; -} \ No newline at end of file +} diff --git a/src/main/java/client/Character.java b/src/main/java/client/Character.java index e194af2d55..c90d31480c 100644 --- a/src/main/java/client/Character.java +++ b/src/main/java/client/Character.java @@ -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; } } diff --git a/src/main/java/client/command/CommandsExecutor.java b/src/main/java/client/command/CommandsExecutor.java index cc35cce603..a95e5943e2 100644 --- a/src/main/java/client/command/CommandsExecutor.java +++ b/src/main/java/client/command/CommandsExecutor.java @@ -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); diff --git a/src/main/java/client/command/commands/gm0/BuyBackCommand.java b/src/main/java/client/command/commands/gm0/BuyBackCommand.java deleted file mode 100644 index 00d0a94521..0000000000 --- a/src/main/java/client/command/commands/gm0/BuyBackCommand.java +++ /dev/null @@ -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 . -*/ - -/* - @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 "); - return; - } - - if (params[0].contentEquals("now")) { - BuybackProcessor.processBuyback(c); - } else { - c.getPlayer().showBuybackInfo(); - } - } -} diff --git a/src/main/java/client/processor/action/BuybackProcessor.java b/src/main/java/client/processor/action/BuybackProcessor.java deleted file mode 100644 index f77e9e5803..0000000000 --- a/src/main/java/client/processor/action/BuybackProcessor.java +++ /dev/null @@ -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 . -*/ -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); - } - } -} diff --git a/src/main/java/config/ServerConfig.java b/src/main/java/config/ServerConfig.java index 91e42533e3..125675b68e 100644 --- a/src/main/java/config/ServerConfig.java +++ b/src/main/java/config/ServerConfig.java @@ -68,7 +68,6 @@ public class ServerConfig { public boolean USE_MTS; public boolean USE_CPQ; public boolean USE_AUTOHIDE_GM; - public boolean USE_BUYBACK_SYSTEM; public boolean USE_FIXED_RATIO_HPMP_UPDATE; public boolean USE_FAMILY_SYSTEM; public boolean USE_DUEY; @@ -295,14 +294,6 @@ public class ServerConfig { public int WEDDING_GIFT_LIMIT; public boolean WEDDING_BLESSER_SHOWFX; - //Buyback Configuration - public boolean USE_BUYBACK_WITH_MESOS; - public float BUYBACK_FEE; - public float BUYBACK_LEVEL_STACK_FEE; - public int BUYBACK_MESO_MULTIPLIER; - public int BUYBACK_RETURN_MINUTES; - public int BUYBACK_COOLDOWN_MINUTES; - // Login timeout by shavit public long TIMEOUT_DURATION; diff --git a/src/main/java/net/server/channel/handlers/EnterMTSHandler.java b/src/main/java/net/server/channel/handlers/EnterMTSHandler.java index 26e1cc5449..493916af78 100644 --- a/src/main/java/net/server/channel/handlers/EnterMTSHandler.java +++ b/src/main/java/net/server/channel/handlers/EnterMTSHandler.java @@ -25,7 +25,6 @@ import client.Character; import client.Client; import client.inventory.Equip; import client.inventory.Item; -import client.processor.action.BuybackProcessor; import config.YamlConfig; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -45,136 +44,132 @@ import java.util.List; public final class EnterMTSHandler extends AbstractPacketHandler { + @Override - public final void handlePacket(InPacket p, Client c) { + public void handlePacket(InPacket p, Client c) { Character chr = c.getPlayer(); - if (!chr.isAlive() && YamlConfig.config.server.USE_BUYBACK_SYSTEM) { - BuybackProcessor.processBuyback(c); + if (!YamlConfig.config.server.USE_MTS) { c.sendPacket(PacketCreator.enableActions()); - } else { - if (!YamlConfig.config.server.USE_MTS) { - c.sendPacket(PacketCreator.enableActions()); - return; - } - - if (chr.getEventInstance() != null) { - c.sendPacket(PacketCreator.serverNotice(5, "Entering Cash Shop or MTS are disabled when registered on an event.")); - c.sendPacket(PacketCreator.enableActions()); - return; - } - - if (MiniDungeonInfo.isDungeonMap(chr.getMapId())) { - c.sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); - c.sendPacket(PacketCreator.enableActions()); - return; - } - - if (FieldLimit.CANNOTMIGRATE.check(chr.getMap().getFieldLimit())) { - chr.dropMessage(1, "You can't do it here in this map."); - c.sendPacket(PacketCreator.enableActions()); - return; - } - - if (!chr.isAlive()) { - c.sendPacket(PacketCreator.enableActions()); - return; - } - if (chr.getLevel() < 10) { - c.sendPacket(PacketCreator.blockedMessage2(5)); - c.sendPacket(PacketCreator.enableActions()); - return; - } - - chr.closePlayerInteractions(); - chr.closePartySearchInteractions(); - - chr.unregisterChairBuff(); - Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(chr.getId(), chr.getAllBuffs()); - Server.getInstance().getPlayerBuffStorage().addDiseasesToStorage(chr.getId(), chr.getAllDiseases()); - chr.setAwayFromChannelWorld(); - chr.notifyMapTransferToPartner(-1); - chr.removeIncomingInvites(); - chr.cancelAllBuffs(true); - chr.cancelAllDebuffs(); - chr.cancelBuffExpireTask(); - chr.cancelDiseaseExpireTask(); - chr.cancelSkillCooldownTask(); - chr.cancelExpirationTask(); - - chr.forfeitExpirableQuests(); - chr.cancelQuestExpirationTask(); - - chr.saveCharToDB(); - - c.getChannelServer().removePlayer(chr); - chr.getMap().removePlayer(c.getPlayer()); - try { - c.sendPacket(PacketCreator.openCashShop(c, true)); - } catch (Exception ex) { - ex.printStackTrace(); - } - chr.getCashShop().open(true);// xD - c.enableCSActions(); - c.sendPacket(PacketCreator.MTSWantedListingOver(0, 0)); - c.sendPacket(PacketCreator.showMTSCash(c.getPlayer())); - List items = new ArrayList<>(); - int pages = 0; - try (Connection con = DatabaseConnection.getConnection()) { - try (PreparedStatement ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = 1 AND transfer = 0 ORDER BY id DESC LIMIT 16, 16"); - ResultSet rs = ps.executeQuery()) { - while (rs.next()) { - if (rs.getInt("type") != 1) { - Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); - i.setOwner(rs.getString("owner")); - items.add(new MTSItemInfo(i, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); - } else { - Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); - equip.setOwner(rs.getString("owner")); - equip.setQuantity((short) 1); - equip.setAcc((short) rs.getInt("acc")); - equip.setAvoid((short) rs.getInt("avoid")); - equip.setDex((short) rs.getInt("dex")); - equip.setHands((short) rs.getInt("hands")); - equip.setHp((short) rs.getInt("hp")); - equip.setInt((short) rs.getInt("int")); - equip.setJump((short) rs.getInt("jump")); - equip.setVicious((short) rs.getInt("vicious")); - equip.setFlag((short) rs.getInt("flag")); - equip.setLuk((short) rs.getInt("luk")); - equip.setMatk((short) rs.getInt("matk")); - equip.setMdef((short) rs.getInt("mdef")); - equip.setMp((short) rs.getInt("mp")); - equip.setSpeed((short) rs.getInt("speed")); - equip.setStr((short) rs.getInt("str")); - equip.setWatk((short) rs.getInt("watk")); - equip.setWdef((short) rs.getInt("wdef")); - equip.setUpgradeSlots((byte) rs.getInt("upgradeslots")); - equip.setLevel((byte) rs.getInt("level")); - equip.setItemLevel(rs.getByte("itemlevel")); - equip.setItemExp(rs.getInt("itemexp")); - equip.setRingId(rs.getInt("ringid")); - equip.setExpiration(rs.getLong("expiration")); - equip.setGiftFrom(rs.getString("giftFrom")); - - items.add(new MTSItemInfo(equip, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); - } - } - } - - try (PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items"); - ResultSet rs = ps.executeQuery()) { - if (rs.next()) { - pages = (int) Math.ceil(rs.getInt(1) / 16); - } - } - } catch (SQLException e) { - e.printStackTrace(); - } - c.sendPacket(PacketCreator.sendMTS(items, 1, 0, 0, pages)); - c.sendPacket(PacketCreator.transferInventory(getTransfer(chr.getId()))); - c.sendPacket(PacketCreator.notYetSoldInv(getNotYetSold(chr.getId()))); + return; } + + if (chr.getEventInstance() != null) { + c.sendPacket(PacketCreator.serverNotice(5, "Entering Cash Shop or MTS are disabled when registered on an event.")); + c.sendPacket(PacketCreator.enableActions()); + return; + } + + if (MiniDungeonInfo.isDungeonMap(chr.getMapId())) { + c.sendPacket(PacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon.")); + c.sendPacket(PacketCreator.enableActions()); + return; + } + + if (FieldLimit.CANNOTMIGRATE.check(chr.getMap().getFieldLimit())) { + chr.dropMessage(1, "You can't do it here in this map."); + c.sendPacket(PacketCreator.enableActions()); + return; + } + + if (!chr.isAlive()) { + c.sendPacket(PacketCreator.enableActions()); + return; + } + if (chr.getLevel() < 10) { + c.sendPacket(PacketCreator.blockedMessage2(5)); + c.sendPacket(PacketCreator.enableActions()); + return; + } + + chr.closePlayerInteractions(); + chr.closePartySearchInteractions(); + + chr.unregisterChairBuff(); + Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(chr.getId(), chr.getAllBuffs()); + Server.getInstance().getPlayerBuffStorage().addDiseasesToStorage(chr.getId(), chr.getAllDiseases()); + chr.setAwayFromChannelWorld(); + chr.notifyMapTransferToPartner(-1); + chr.removeIncomingInvites(); + chr.cancelAllBuffs(true); + chr.cancelAllDebuffs(); + chr.cancelBuffExpireTask(); + chr.cancelDiseaseExpireTask(); + chr.cancelSkillCooldownTask(); + chr.cancelExpirationTask(); + + chr.forfeitExpirableQuests(); + chr.cancelQuestExpirationTask(); + + chr.saveCharToDB(); + + c.getChannelServer().removePlayer(chr); + chr.getMap().removePlayer(c.getPlayer()); + try { + c.sendPacket(PacketCreator.openCashShop(c, true)); + } catch (Exception ex) { + ex.printStackTrace(); + } + chr.getCashShop().open(true);// xD + c.enableCSActions(); + c.sendPacket(PacketCreator.MTSWantedListingOver(0, 0)); + c.sendPacket(PacketCreator.showMTSCash(c.getPlayer())); + List items = new ArrayList<>(); + int pages = 0; + try (Connection con = DatabaseConnection.getConnection()) { + try (PreparedStatement ps = con.prepareStatement("SELECT * FROM mts_items WHERE tab = 1 AND transfer = 0 ORDER BY id DESC LIMIT 16, 16"); + ResultSet rs = ps.executeQuery()) { + while (rs.next()) { + if (rs.getInt("type") != 1) { + Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); + i.setOwner(rs.getString("owner")); + items.add(new MTSItemInfo(i, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); + } else { + Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); + equip.setOwner(rs.getString("owner")); + equip.setQuantity((short) 1); + equip.setAcc((short) rs.getInt("acc")); + equip.setAvoid((short) rs.getInt("avoid")); + equip.setDex((short) rs.getInt("dex")); + equip.setHands((short) rs.getInt("hands")); + equip.setHp((short) rs.getInt("hp")); + equip.setInt((short) rs.getInt("int")); + equip.setJump((short) rs.getInt("jump")); + equip.setVicious((short) rs.getInt("vicious")); + equip.setFlag((short) rs.getInt("flag")); + equip.setLuk((short) rs.getInt("luk")); + equip.setMatk((short) rs.getInt("matk")); + equip.setMdef((short) rs.getInt("mdef")); + equip.setMp((short) rs.getInt("mp")); + equip.setSpeed((short) rs.getInt("speed")); + equip.setStr((short) rs.getInt("str")); + equip.setWatk((short) rs.getInt("watk")); + equip.setWdef((short) rs.getInt("wdef")); + equip.setUpgradeSlots((byte) rs.getInt("upgradeslots")); + equip.setLevel((byte) rs.getInt("level")); + equip.setItemLevel(rs.getByte("itemlevel")); + equip.setItemExp(rs.getInt("itemexp")); + equip.setRingId(rs.getInt("ringid")); + equip.setExpiration(rs.getLong("expiration")); + equip.setGiftFrom(rs.getString("giftFrom")); + + items.add(new MTSItemInfo(equip, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); + } + } + } + + try (PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM mts_items"); + ResultSet rs = ps.executeQuery()) { + if (rs.next()) { + pages = (int) Math.ceil(rs.getInt(1) / 16); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + c.sendPacket(PacketCreator.sendMTS(items, 1, 0, 0, pages)); + c.sendPacket(PacketCreator.transferInventory(getTransfer(chr.getId()))); + c.sendPacket(PacketCreator.notYetSoldInv(getNotYetSold(chr.getId()))); } private List getNotYetSold(int cid) { @@ -276,4 +271,4 @@ public final class EnterMTSHandler extends AbstractPacketHandler { } return items; } -} \ No newline at end of file +} diff --git a/src/main/java/tools/PacketCreator.java b/src/main/java/tools/PacketCreator.java index b7dfe1e1b8..7471e903b7 100644 --- a/src/main/java/tools/PacketCreator.java +++ b/src/main/java/tools/PacketCreator.java @@ -20,11 +20,29 @@ */ package tools; +import client.BuddylistEntry; +import client.BuffStat; import client.Character; -import client.*; import client.Character.SkillEntry; -import client.inventory.*; +import client.Client; +import client.Disease; +import client.FamilyEntitlement; +import client.FamilyEntry; +import client.MonsterBook; +import client.Mount; +import client.QuestStatus; +import client.Ring; +import client.Skill; +import client.SkillMacro; +import client.Stat; +import client.inventory.Equip; import client.inventory.Equip.ScrollResult; +import client.inventory.Inventory; +import client.inventory.InventoryType; +import client.inventory.Item; +import client.inventory.ItemFactory; +import client.inventory.ModifyInventory; +import client.inventory.Pet; import client.keybind.KeyBinding; import client.keybind.QuickslotBinding; import client.newyear.NewYearCardRecord; @@ -62,19 +80,45 @@ import net.server.world.World; import server.CashShop.CashItem; import server.CashShop.CashItemFactory; import server.CashShop.SpecialCashItem; -import server.*; +import server.DueyPackage; +import server.ItemInformationProvider; +import server.MTSItemInfo; +import server.ShopItem; +import server.Trade; import server.events.gm.Snowball; -import server.life.*; -import server.maps.*; +import server.life.MobSkill; +import server.life.MobSkillId; +import server.life.Monster; +import server.life.NPC; +import server.life.PlayerNPC; +import server.maps.AbstractMapObject; +import server.maps.Door; +import server.maps.DoorObject; +import server.maps.Dragon; +import server.maps.HiredMerchant; +import server.maps.MapItem; +import server.maps.MapleMap; +import server.maps.MiniGame; import server.maps.MiniGame.MiniGameResult; +import server.maps.Mist; +import server.maps.PlayerShop; +import server.maps.PlayerShopItem; +import server.maps.Reactor; +import server.maps.Summon; import server.movement.LifeMovementFragment; import java.awt.*; import java.net.InetAddress; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.List; -import java.util.*; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; +import java.util.TimeZone; import java.util.stream.Collectors; /** @@ -6136,23 +6180,6 @@ public class PacketCreator { return showSpecialEffect(15); } - public static Packet showBuybackEffect() { - final OutPacket p = OutPacket.create(SendOpcode.SHOW_ITEM_GAIN_INCHAT); - p.writeByte(11); - p.writeInt(0); - - return p; - } - - public static Packet showForeignBuybackEffect(int cid) { - final OutPacket p = OutPacket.create(SendOpcode.SHOW_FOREIGN_EFFECT); - p.writeInt(cid); - p.writeByte(11); - p.writeInt(0); - - return p; - } - /** * 0 = Levelup 6 = Exp did not drop (Safety Charms) 7 = Enter portal sound * 8 = Job change 9 = Quest complete 10 = Recovery 11 = Buff effect diff --git a/wz/Sound.wz/Field.img.xml b/wz/Sound.wz/Field.img.xml index c946c981f3..2213c14dc4 100644 --- a/wz/Sound.wz/Field.img.xml +++ b/wz/Sound.wz/Field.img.xml @@ -85,27 +85,4 @@ - - - - - - - - -