Move Shop stuff to own package
This commit is contained in:
@@ -73,6 +73,7 @@ import server.partyquest.MonsterCarnival;
|
|||||||
import server.partyquest.MonsterCarnivalParty;
|
import server.partyquest.MonsterCarnivalParty;
|
||||||
import server.partyquest.PartyQuest;
|
import server.partyquest.PartyQuest;
|
||||||
import server.quest.Quest;
|
import server.quest.Quest;
|
||||||
|
import server.shop.Shop;
|
||||||
import tools.*;
|
import tools.*;
|
||||||
import tools.exceptions.NotEnabledException;
|
import tools.exceptions.NotEnabledException;
|
||||||
import tools.packets.WeddingPackets;
|
import tools.packets.WeddingPackets;
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package client.command;
|
package client.command;
|
||||||
|
|
||||||
import database.drop.DropProvider;
|
import database.drop.DropProvider;
|
||||||
import server.ShopFactory;
|
import server.shop.ShopFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ponk
|
||||||
|
*/
|
||||||
public record CommandContext(DropProvider dropProvider, ShopFactory shopFactory) {
|
public record CommandContext(DropProvider dropProvider, ShopFactory shopFactory) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ import client.command.CommandsExecutor;
|
|||||||
import client.processor.action.MakerProcessor;
|
import client.processor.action.MakerProcessor;
|
||||||
import client.processor.npc.FredrickProcessor;
|
import client.processor.npc.FredrickProcessor;
|
||||||
import database.drop.DropProvider;
|
import database.drop.DropProvider;
|
||||||
import server.ShopFactory;
|
import server.shop.ShopFactory;
|
||||||
import service.NoteService;
|
import service.NoteService;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ponk
|
||||||
|
*/
|
||||||
public record ChannelDependencies(
|
public record ChannelDependencies(
|
||||||
NoteService noteService, FredrickProcessor fredrickProcessor, MakerProcessor makerProcessor,
|
NoteService noteService, FredrickProcessor fredrickProcessor, MakerProcessor makerProcessor,
|
||||||
DropProvider dropProvider, CommandsExecutor commandsExecutor, ShopFactory shopFactory
|
DropProvider dropProvider, CommandsExecutor commandsExecutor, ShopFactory shopFactory
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import server.CashShop.CashItemFactory;
|
import server.CashShop.CashItemFactory;
|
||||||
import server.ShopFactory;
|
|
||||||
import server.SkillbookInformationProvider;
|
import server.SkillbookInformationProvider;
|
||||||
import server.ThreadManager;
|
import server.ThreadManager;
|
||||||
import server.TimerManager;
|
import server.TimerManager;
|
||||||
import server.expeditions.ExpeditionBossLog;
|
import server.expeditions.ExpeditionBossLog;
|
||||||
import server.life.PlayerNPCFactory;
|
import server.life.PlayerNPCFactory;
|
||||||
import server.quest.Quest;
|
import server.quest.Quest;
|
||||||
|
import server.shop.ShopFactory;
|
||||||
import service.NoteService;
|
import service.NoteService;
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ import net.packet.InPacket;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import scripting.npc.NPCScriptManager;
|
import scripting.npc.NPCScriptManager;
|
||||||
import server.ShopFactory;
|
|
||||||
import server.life.NPC;
|
import server.life.NPC;
|
||||||
import server.life.PlayerNPC;
|
import server.life.PlayerNPC;
|
||||||
import server.maps.MapObject;
|
import server.maps.MapObject;
|
||||||
|
import server.shop.ShopFactory;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
|
|
||||||
public final class NPCTalkHandler extends AbstractPacketHandler {
|
public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ import net.server.Server;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import server.ItemInformationProvider;
|
import server.ItemInformationProvider;
|
||||||
import server.Shop;
|
|
||||||
import server.ShopFactory;
|
|
||||||
import server.TimerManager;
|
import server.TimerManager;
|
||||||
import server.maps.*;
|
import server.maps.*;
|
||||||
|
import server.shop.Shop;
|
||||||
|
import server.shop.ShopFactory;
|
||||||
import service.NoteService;
|
import service.NoteService;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package server;
|
package server.shop;
|
||||||
|
|
||||||
import client.Client;
|
import client.Client;
|
||||||
import client.inventory.InventoryType;
|
import client.inventory.InventoryType;
|
||||||
@@ -30,6 +30,7 @@ import constants.id.ItemId;
|
|||||||
import constants.inventory.ItemConstants;
|
import constants.inventory.ItemConstants;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import server.ItemInformationProvider;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package server;
|
package server.shop;
|
||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
@@ -70,15 +70,15 @@ public class ShopFactory {
|
|||||||
return Optional.of(new Shop(dbShop.get().id(), dbShop.get().npcId(), fromDbShopItems(items)));
|
return Optional.of(new Shop(dbShop.get().id(), dbShop.get().npcId(), fromDbShopItems(items)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<server.ShopItem> fromDbShopItems(List<ShopItem> dbItems) {
|
private List<server.shop.ShopItem> fromDbShopItems(List<ShopItem> dbItems) {
|
||||||
Stream<server.ShopItem> purchaseableItems = dbItems.stream()
|
Stream<server.shop.ShopItem> purchaseableItems = dbItems.stream()
|
||||||
.map(dbItem -> {
|
.map(dbItem -> {
|
||||||
short buyable = ItemConstants.isRechargeable(dbItem.itemId()) ? (short) 1 : MAX_QUANTITY_PER_PURCHASE;
|
short buyable = ItemConstants.isRechargeable(dbItem.itemId()) ? (short) 1 : MAX_QUANTITY_PER_PURCHASE;
|
||||||
int pitch = dbItem.pitch() == null ? 0 : dbItem.pitch();
|
int pitch = dbItem.pitch() == null ? 0 : dbItem.pitch();
|
||||||
return new server.ShopItem(buyable, dbItem.itemId(), dbItem.price(), pitch);
|
return new server.shop.ShopItem(buyable, dbItem.itemId(), dbItem.price(), pitch);
|
||||||
});
|
});
|
||||||
Stream<server.ShopItem> rechargeableItems = rechargeableItemIds.stream()
|
Stream<server.shop.ShopItem> rechargeableItems = rechargeableItemIds.stream()
|
||||||
.map(rechItem -> new server.ShopItem((short) 0, rechItem, 0, 0));
|
.map(rechItem -> new server.shop.ShopItem((short) 0, rechItem, 0, 0));
|
||||||
return Stream.concat(purchaseableItems, rechargeableItems).toList();
|
return Stream.concat(purchaseableItems, rechargeableItems).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
You should have received a copy of the GNU Affero General Public License
|
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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package server;
|
package server.shop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Matze
|
* @author Matze
|
||||||
@@ -62,12 +62,16 @@ import net.server.world.World;
|
|||||||
import server.CashShop.CashItem;
|
import server.CashShop.CashItem;
|
||||||
import server.CashShop.CashItemFactory;
|
import server.CashShop.CashItemFactory;
|
||||||
import server.CashShop.SpecialCashItem;
|
import server.CashShop.SpecialCashItem;
|
||||||
import server.*;
|
import server.DueyPackage;
|
||||||
|
import server.ItemInformationProvider;
|
||||||
|
import server.MTSItemInfo;
|
||||||
|
import server.Trade;
|
||||||
import server.events.gm.Snowball;
|
import server.events.gm.Snowball;
|
||||||
import server.life.*;
|
import server.life.*;
|
||||||
import server.maps.*;
|
import server.maps.*;
|
||||||
import server.maps.MiniGame.MiniGameResult;
|
import server.maps.MiniGame.MiniGameResult;
|
||||||
import server.movement.LifeMovementFragment;
|
import server.movement.LifeMovementFragment;
|
||||||
|
import server.shop.ShopItem;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
|||||||
Reference in New Issue
Block a user