From ea594dfaa710eb2243578bf44fbda7a830b51672 Mon Sep 17 00:00:00 2001 From: gaojie Date: Mon, 20 May 2019 14:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=BA=97=E8=B4=AD=E4=B9=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/server/StoreConfig.txt | 122 +++++++++++++----- conf/server/StoreTypeConfig.txt | 11 +- .../com/ljsd/jieling/config/SStoreConfig.java | 21 +-- .../ljsd/jieling/logic/store/StoreLogic.java | 27 ++-- 4 files changed, 128 insertions(+), 53 deletions(-) diff --git a/conf/server/StoreConfig.txt b/conf/server/StoreConfig.txt index 2ba7a4d3c..bacd7c4f0 100644 --- a/conf/server/StoreConfig.txt +++ b/conf/server/StoreConfig.txt @@ -1,33 +1,89 @@ -Id GoodsName StoreId Sort Weight OpenLv Goods Cost Limit IsDiscount DiscountDegree -int string int int int mut,int#int,1 mut,int#int,1 mut,int#int,2 int int int -1 100金币 1 1 100 1#100 14#100 14|0#0#0#100 1 0 0 -2 1000金币 1 2 100 1#100 14#1000 14|0#0#0#100 2 0 0 -3 10000金币 1 3 100 1#100 14#10000 14|0#0#0#100 3 0 0 -4 55555金币 1 1 100 1#100 14#5555 14|0#0#0#100 4 1 2 -101 100金币 2 1 100 1#100 14#100 14|0#0#0#100 1 0 0 -102 1000金币 2 2 100 1#100 14#1000 14|0#0#0#100 2 0 0 -103 10000金币 2 3 100 1#100 14#10000 14|0#0#0#100 3 0 0 -104 55555金币 2 1 100 1#100 14#5555 14|0#0#0#100 4 0 2 -201 刀捞鬼 4 1 100 1#100 6001#1 24|0#0#0#60 1 0 0 -202 刀捞鬼 4 1 100 1#100 6002#1 24|0#0#0#60 1 0 0 -203 刀捞鬼 4 1 100 1#100 6003#1 24|0#0#0#60 1 0 0 -204 蒸笼仔 4 2 100 1#100 6004#1 24|0#0#0#60 1 0 0 -205 蒸笼仔 4 2 100 1#100 6005#1 24|0#0#0#60 1 0 0 -206 蒸笼仔 4 2 100 1#100 6006#1 24|0#0#0#60 1 0 0 -207 横公 4 3 100 1#100 6007#1 24|0#0#0#60 1 0 0 -208 横公 4 3 100 1#100 6008#1 24|0#0#0#60 1 0 0 -209 横公 4 3 100 1#100 6009#1 24|0#0#0#60 1 0 0 -210 拘魂姬 4 4 100 1#100 6010#1 24|0#0#0#60 1 0 0 -211 拘魂姬 4 4 100 1#100 6011#1 24|0#0#0#60 1 0 0 -212 拘魂姬 4 4 100 1#100 6012#1 24|0#0#0#60 1 0 0 -213 陌刀 4 5 100 1#100 6025#1 24|0#0#0#180 1 0 0 -214 陌刀 4 5 100 1#100 6026#1 24|0#0#0#180 1 0 0 -215 陌刀 4 5 100 1#100 6027#1 24|0#0#0#180 1 0 0 -216 陌刀 4 5 100 1#100 6028#1 24|0#0#0#180 1 0 0 -217 风狸 4 5 100 1#100 6029#1 24|0#0#0#180 1 0 0 -218 风狸 4 5 100 1#100 6030#1 24|0#0#0#180 1 0 0 -219 风狸 4 5 100 1#100 6031#1 24|0#0#0#180 1 0 0 -220 风狸 4 5 100 1#100 6032#1 24|0#0#0#180 1 0 0 -221 灵丹 4 6 100 1#100 5#150 24|0#0#0#15 1 0 0 -0 0 0 0 null null null 0 0 0 -0 0 0 0 null null null 0 0 0 +Id GoodsName StoreId Sort Weight OpenLv Goods PremiumType Cost Limit IsDiscount DiscountDegree +int string int int int mut,int#int,1 mut,int#int,1 int mut,int#int,2 int int int +1 100金币 1 1 100 1#100 14#100 1 14|0#0#0#100 1 0 0 +2 1000金币 1 2 100 1#100 14#1000 1 14|0#0#0#100 2 0 0 +3 10000金币 1 3 100 1#100 14#10000 1 14|0#0#0#100 3 0 0 +4 55555金币 1 1 100 1#100 14#5555 1 14|0#0#0#100 4 1 2 +101 100金币 2 1 100 1#100 14#100 1 14|0#0#0#100 1 0 0 +102 1000金币 2 2 100 1#100 14#1000 1 14|0#0#0#100 2 0 0 +103 10000金币 2 3 100 1#100 14#10000 1 14|0#0#0#100 3 0 0 +104 55555金币 2 1 100 1#100 14#5555 1 14|0#0#0#100 4 0 2 +201 刀捞鬼 4 1 100 1#100 6001#1 1 24|0#0#0#60 1 0 0 +202 刀捞鬼 4 1 100 1#100 6002#1 1 24|0#0#0#60 1 0 0 +203 刀捞鬼 4 1 100 1#100 6003#1 1 24|0#0#0#60 1 0 0 +204 蒸笼仔 4 2 100 1#100 6004#1 1 24|0#0#0#60 1 0 0 +205 蒸笼仔 4 2 100 1#100 6005#1 1 24|0#0#0#60 1 0 0 +206 蒸笼仔 4 2 100 1#100 6006#1 1 24|0#0#0#60 1 0 0 +207 横公 4 3 100 1#100 6007#1 1 24|0#0#0#60 1 0 0 +208 横公 4 3 100 1#100 6008#1 1 24|0#0#0#60 1 0 0 +209 横公 4 3 100 1#100 6009#1 1 24|0#0#0#60 1 0 0 +210 拘魂姬 4 4 100 1#100 6010#1 1 24|0#0#0#60 1 0 0 +211 拘魂姬 4 4 100 1#100 6011#1 1 24|0#0#0#60 1 0 0 +212 拘魂姬 4 4 100 1#100 6012#1 1 24|0#0#0#60 1 0 0 +213 陌刀 4 5 100 1#100 6025#1 1 24|0#0#0#180 1 0 0 +214 陌刀 4 5 100 1#100 6026#1 1 24|0#0#0#180 1 0 0 +215 陌刀 4 5 100 1#100 6027#1 1 24|0#0#0#180 1 0 0 +216 陌刀 4 5 100 1#100 6028#1 1 24|0#0#0#180 1 0 0 +217 风狸 4 5 100 1#100 6029#1 1 24|0#0#0#180 1 0 0 +218 风狸 4 5 100 1#100 6030#1 1 24|0#0#0#180 1 0 0 +219 风狸 4 5 100 1#100 6031#1 1 24|0#0#0#180 1 0 0 +220 风狸 4 5 100 1#100 6032#1 1 24|0#0#0#180 1 0 0 +221 灵丹 4 6 100 1#100 5#150 1 24|0#0#0#15 1 0 0 +1001 100金币 5 1 100 1#100 14#100 1 14|0#0#0#100 1 0 0 +1002 1000金币 5 2 100 1#100 14#1000 1 14|0#0#0#100 2 0 0 +1003 10000金币 5 3 100 1#100 14#10000 1 14|0#0#0#100 3 0 0 +1004 55555金币 5 1 100 1#100 14#5555 1 14|0#0#0#100 4 0 2 +1005 刀捞鬼 5 1 100 1#100 6001#1 1 24|0#0#0#60 1 0 0 +1006 刀捞鬼 5 1 100 1#100 6002#1 1 24|0#0#0#60 1 0 0 +1007 刀捞鬼 5 1 100 1#100 6003#1 1 24|0#0#0#60 1 0 0 +1008 蒸笼仔 5 2 100 1#100 6004#1 1 24|0#0#0#60 1 0 0 +1009 蒸笼仔 5 2 100 1#100 6005#1 1 24|0#0#0#60 1 0 0 +1010 蒸笼仔 5 2 100 1#100 6006#1 1 24|0#0#0#60 1 0 0 +1011 横公 5 3 100 1#100 6007#1 1 24|0#0#0#60 1 0 0 +1012 横公 5 3 100 1#100 6008#1 1 24|0#0#0#60 1 0 0 +1013 横公 5 3 100 1#100 6009#1 1 24|0#0#0#60 1 0 0 +1014 拘魂姬 5 4 100 1#100 6010#1 1 24|0#0#0#60 1 0 0 +1015 拘魂姬 5 4 100 1#100 6011#1 1 24|0#0#0#60 1 0 0 +1016 拘魂姬 5 4 100 1#100 6012#1 1 24|0#0#0#60 1 0 0 +1017 陌刀 5 5 100 1#100 6025#1 1 24|0#0#0#180 1 0 0 +1018 陌刀 5 5 100 1#100 6026#1 1 24|0#0#0#180 1 0 0 +1019 陌刀 5 5 100 1#100 6027#1 1 24|0#0#0#180 1 0 0 +1020 陌刀 5 5 100 1#100 6028#1 1 24|0#0#0#180 1 0 0 +1021 风狸 5 5 100 1#100 6029#1 1 24|0#0#0#180 1 0 0 +1022 风狸 5 5 100 1#100 6030#1 1 24|0#0#0#180 1 0 0 +1023 风狸 5 5 100 1#100 6031#1 1 24|0#0#0#180 1 0 0 +1024 风狸 5 5 100 1#100 6032#1 1 24|0#0#0#180 1 0 0 +1025 灵丹 5 6 100 1#100 5#150 1 24|0#0#0#15 1 0 0 +1026 6480钻石 5 7 100 1#100 16#6480 1 14|0#0#0#1 99999 0 0 +2001 刀捞鬼 6 1 100 1#100 6001#1 1 22|0#0#0#55 1 0 0 +2002 刀捞鬼 6 1 100 1#100 6002#1 1 22|0#0#0#55 1 0 0 +2003 刀捞鬼 6 1 100 1#100 6003#1 1 22|0#0#0#55 1 0 0 +2004 蒸笼仔 6 1 100 1#100 6004#1 1 22|0#0#0#55 1 0 0 +2005 蒸笼仔 6 1 100 1#100 6005#1 1 22|0#0#0#55 1 0 0 +2006 蒸笼仔 6 1 100 1#100 6006#1 1 22|0#0#0#55 1 0 0 +2007 横公 6 2 100 1#100 6007#1 1 22|0#0#0#55 1 0 0 +2008 横公 6 2 100 1#100 6008#1 1 22|0#0#0#55 1 0 0 +2009 横公 6 2 100 1#100 6009#1 1 22|0#0#0#55 1 0 0 +2010 拘魂姬 6 2 100 1#100 6010#1 1 22|0#0#0#55 1 0 0 +2011 拘魂姬 6 2 100 1#100 6011#1 1 22|0#0#0#55 1 0 0 +2012 拘魂姬 6 2 100 1#100 6012#1 1 22|0#0#0#55 1 0 0 +2013 火鼠 6 3 100 1#100 6013#1 1 22|0#0#0#190 1 0 0 +2014 火鼠 6 3 100 1#100 6014#1 1 22|0#0#0#190 1 0 0 +2015 火鼠 6 3 100 1#100 6015#1 1 22|0#0#0#190 1 0 0 +2016 火鼠 6 3 100 1#100 6016#1 1 22|0#0#0#190 1 0 0 +2017 拦面叟 6 4 100 1#100 6017#1 1 22|0#0#0#190 1 0 0 +2018 拦面叟 6 4 100 1#100 6018#1 1 22|0#0#0#190 1 0 0 +2019 拦面叟 6 4 100 1#100 6019#1 1 22|0#0#0#190 1 0 0 +2020 拦面叟 6 4 100 1#100 6020#1 1 22|0#0#0#190 1 0 0 +2021 孙龙 6 5 100 1#100 6021#1 1 22|0#0#0#190 1 0 0 +2022 孙龙 6 5 100 1#100 6022#1 1 22|0#0#0#190 1 0 0 +2023 孙龙 6 5 100 1#100 6023#1 1 22|0#0#0#190 1 0 0 +2024 孙龙 6 5 100 1#100 6024#1 1 22|0#0#0#190 1 0 0 +2025 天麟 6 6 100 1#100 6033#1 1 22|0#0#0#550 1 0 0 +2026 天麟 6 6 100 1#100 6034#1 1 22|0#0#0#550 1 0 0 +2027 天麟 6 6 100 1#100 6035#1 1 22|0#0#0#550 1 0 0 +2028 天麟 6 6 100 1#100 6036#1 1 22|0#0#0#550 1 0 0 +10001 群英招募单抽 7 1 100 1#100 19#1 1 16|0#0#0#250 9999999 0 0 +10002 群英招募十连抽 7 2 100 1#100 19#10 1 16|0#0#0#2500 9999999 0 0 +10003 秘盒单抽 7 3 100 1#100 21#1 1 16|0#0#0#200 9999999 0 0 +10004 秘盒十连抽 7 4 100 1#100 21#10 1 16|0#0#0#1760 9999999 0 0 diff --git a/conf/server/StoreTypeConfig.txt b/conf/server/StoreTypeConfig.txt index 62cee6c71..dd4c5829b 100644 --- a/conf/server/StoreTypeConfig.txt +++ b/conf/server/StoreTypeConfig.txt @@ -1,6 +1,9 @@ Id Number RefreshItem RefreshType IfManualRefresh StoreOpenRule StartTime EndTime int int mut,int#int,2 mut,int#int,1 int int string string -1 3 14|0#0#0#10000 2#5 1 1 0 0 -2 3 14|0#0#0#10000 3#2 1 1 0 0 -3 3 14|0#0#0#10000 1#0 1 2 0 30 -4 6 24|0#0#0#500 2#5 1 1 0 0 +1 3 16|0#0#1#50 2#5 1 1 0 0 +2 3 16|0#0#1#50 3#2 1 1 0 0 +3 3 25|0#0#0#10000 1#0 1 2 0 30 +4 6 24|0#0#1#500 2#5 1 1 0 0 +5 7 24|0#0#0#500 1#0 0 1 0 0 +6 6 24|0#0#0#500 1#0 0 1 0 0 +7 4 14|0#0#0#10000 2#5 0 1 0 0 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreConfig.java index 15c2eb2d1..21f871d00 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreConfig.java @@ -10,9 +10,9 @@ import java.util.concurrent.ConcurrentHashMap; @Table(name ="StoreConfig") public class SStoreConfig implements BaseConfig { - static Map sStoreConfigMap; + private static Map sStoreConfigMap; //key: type 商店类型 - static Map> sStoreConfigMapBuyType; + private static Map> sStoreConfigMapBuyType; private int id; @@ -36,6 +36,8 @@ public class SStoreConfig implements BaseConfig { private int discountDegree; + private int premiumType; + @Override public void init() throws Exception { @@ -48,17 +50,18 @@ public class SStoreConfig implements BaseConfig { } sStoreConfigMapBuyType.get(data.getStoreId()).add(data); } - this.sStoreConfigMapBuyType = sStoreConfigMapBuyType; + SStoreConfig.sStoreConfigMapBuyType = sStoreConfigMapBuyType; } - public static Map getSstoreConfigMap () { + public static Map getSstoreConfigMap() { return sStoreConfigMap; } - public static List getSstoreConfigBuyStore (int storeId) { - return sStoreConfigMapBuyType.get(storeId); + public static Map> getSstoreConfigBuyStore() { + return sStoreConfigMapBuyType; } - public int getId() { + + public int getId() { return id; } @@ -102,5 +105,7 @@ public class SStoreConfig implements BaseConfig { return discountDegree; } - + public int getPremiumType() { + return premiumType; + } } \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java index 8e760db97..9d8eb62f1 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java @@ -118,7 +118,7 @@ public class StoreLogic { private static int getRewardId(int storeId,int sort,User user) { PlayerManager playerInfoManager = user.getPlayerInfoManager(); - List sstoreConfigBuyStore = SStoreConfig.getSstoreConfigBuyStore(storeId); + List sstoreConfigBuyStore = SStoreConfig.getSstoreConfigBuyStore().get(storeId); List randomSstoreConfigList = new CopyOnWriteArrayList<>(); int totalWeight = 0; for (SStoreConfig sStoreConfig : sstoreConfigBuyStore) { @@ -177,8 +177,8 @@ public class StoreLogic { } int buyTimes = itemNumMap.get(itemId); SStoreConfig sStoreConfig = SStoreConfig.getSstoreConfigMap().get(itemId); - String cost = getCost(buyTimes,sStoreConfig.getCost()); - boolean result = ItemUtil.itemCost(user, StringUtil.parseFiledInt2(cost)); + int[][] cost = getCost(buyTimes,sStoreConfig.getCost(),sStoreConfig.getPremiumType()); + boolean result = ItemUtil.itemCost(user, cost); if (!result){ MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); return; @@ -193,12 +193,23 @@ public class StoreLogic { MessageUtil.sendMessage(iSession, 1,msgId, builder, true); } - private static String getCost(int buyTimes, int[][] costs) { + private static int[][] getCost(int buyTimes, int[][] costs,int premiumType) { int costItemId = costs[0][0]; int[] ints = costs[1]; int costNum = (int) (Math.ceil(Math.pow(ints[0], 3)) *buyTimes) + (int) (Math.ceil(Math.pow(ints[1], 2)) *buyTimes) +(int) (Math.ceil(Math.pow(ints[2], 1)) *buyTimes) + ints[3]; - String cost = costItemId +"#"+costNum; - return cost; + if (premiumType == 2){ + if (buyTimes < ints.length){ + costNum = ints[buyTimes]; + }else{ + costNum = ints[ints.length-1]; + } + } + int[][] value1 = new int[1][]; + int[] value2 = new int[2]; + value2[0] = costItemId; + value2[1] = costNum; + value1[0] =value2; + return value1; } //手动刷新商店 @@ -221,8 +232,8 @@ public class StoreLogic { return; } int refreshNum = storeInfo.getRefreshNum(); - String cost = getCost(refreshNum, sStoreTypeConfig.getRefreshItem()); - boolean result = ItemUtil.itemCost(user, StringUtil.parseFiledInt2(cost)); + int[][] cost = getCost(refreshNum, sStoreTypeConfig.getRefreshItem(),0); + boolean result = ItemUtil.itemCost(user, cost); if (!result){ MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); return;