From 9db99e959a322345cf60b38f0b635a34c9ee52af Mon Sep 17 00:00:00 2001 From: wangyuan Date: Thu, 24 Jan 2019 12:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E5=92=8C=E5=86=92=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/server/AdventureConfig.txt | 5 ++ conf/server/AdventureSetting.txt | 4 + conf/server/EquipConfig.txt | 4 + conf/server/EquipPropertyPool.txt | 3 + conf/server/PropertyConfig.txt | 58 +++++++++++++ .../ljsd/jieling/config/SAdventureConfig.java | 67 +++++++++++++++ .../jieling/config/SAdventureSetting.java | 61 ++++++++++++++ .../com/ljsd/jieling/config/SEquipConfig.java | 84 +++++++++++++++++++ .../jieling/config/SEquipPropertyPool.java | 72 ++++++++++++++++ .../ljsd/jieling/config/SPropertyConfig.java | 43 ++++++++++ .../com/ljsd/jieling/logic/dao/Equip.java | 65 ++++++++++++++ .../ljsd/jieling/logic/dao/EquipManager.java | 20 +++++ .../java/com/ljsd/jieling/logic/dao/User.java | 18 ++-- 13 files changed, 498 insertions(+), 6 deletions(-) create mode 100644 conf/server/AdventureConfig.txt create mode 100644 conf/server/AdventureSetting.txt create mode 100644 conf/server/EquipConfig.txt create mode 100644 conf/server/EquipPropertyPool.txt create mode 100644 conf/server/PropertyConfig.txt create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureConfig.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureSetting.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SEquipPropertyPool.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SPropertyConfig.java create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/logic/dao/EquipManager.java diff --git a/conf/server/AdventureConfig.txt b/conf/server/AdventureConfig.txt new file mode 100644 index 000000000..2dc1aa02f --- /dev/null +++ b/conf/server/AdventureConfig.txt @@ -0,0 +1,5 @@ +Id OpenLevel RecommendForce RecommendHeroIds MinNum BaseReward RandomRewardGroup RecommendRewardGroup +int int int mut,int#int,1 int mut,int#int,2 mut,int#int,1 mut,int#int,1 +1 10 1000 10001#10002 2 1#100|2#100 1001#1002 2001#2002#2003 +2 11 2000 10001 2 1#100|2#100 1001#1002 2001#2002#2003 +3 12 3000 10001 2 1#100|2#100 1001#1002 2001#2002#2003 diff --git a/conf/server/AdventureSetting.txt b/conf/server/AdventureSetting.txt new file mode 100644 index 000000000..46b8d9afe --- /dev/null +++ b/conf/server/AdventureSetting.txt @@ -0,0 +1,4 @@ +Id LimitHour ConsumeGemRatio BaseRewardRatio RandomRewardRatio PerMapMaxHour HourRewardRatio +int int mut,int#int,1 mut,int#int,2 mut,int#int,2 int mut,int#int,2 +1 12 0#0#10#100 0.8#0.5|0.9#0.8 0.8#0.5|0.9#0.8 12 0.8#0.5|0.9#0.8 +2 20 0#0#10#200 0.8#0.8|0.9#0.9 0.8#0.8|0.9#0.9 14 0.8#0.5|0.9#0.8 diff --git a/conf/server/EquipConfig.txt b/conf/server/EquipConfig.txt new file mode 100644 index 000000000..73242e613 --- /dev/null +++ b/conf/server/EquipConfig.txt @@ -0,0 +1,4 @@ +Id ProfessionLimit Position PropertyMin PropertyMax Pool SecondNumMin SecondNumMax SkillId IfClear +int int int mut,int#int,1 mut,int#int,1 int int int int int +3001 0 1 1#100 1#200 1 1 1 0 1 +3002 0 0 null null 0 0 0 0 0 diff --git a/conf/server/EquipPropertyPool.txt b/conf/server/EquipPropertyPool.txt new file mode 100644 index 000000000..ff83784d8 --- /dev/null +++ b/conf/server/EquipPropertyPool.txt @@ -0,0 +1,3 @@ +id PropertyId Min Max PoolNum Weight +int int int int int int +1 101 100 200 1 100 diff --git a/conf/server/PropertyConfig.txt b/conf/server/PropertyConfig.txt new file mode 100644 index 000000000..2c15ad1c4 --- /dev/null +++ b/conf/server/PropertyConfig.txt @@ -0,0 +1,58 @@ +Id PropertyId Name Info +int int string string +1 1 Hp 生命值 +2 2 Attack 攻击力 +3 3 PhysicalDefence 护甲 +4 4 MagicDefence 魔抗 +5 5 Speed 速度 +6 51 DamageBocusFactor 伤害加成百分比 +7 52 DamageReduceFactor 伤害减免百分比 +8 53 Hit 效果命中率 +9 54 Dodge 效果抵抗率 +10 55 CritFactor 暴击率 +11 56 CritDamageFactor 暴伤 +12 57 TreatFacter 回复系数 +13 101 FireDamageBonusFactor 火攻(%) +14 102 WindDamageBonusFactor 风攻(%) +15 103 WaterDamageBonusFactor 水攻(%) +16 104 LandDamageBonusFactor 地攻(%) +17 105 LightDamageBonusFactor 光攻(%) +18 106 DarkDamageBonusFactor 暗攻(%) +19 107 FireDamageReduceFactor 火抗(%) +20 108 WindDamageReduceFactor 风抗(%) +21 109 WaterDamageReduceFactor 水抗(%) +22 110 LandDamageReduceFactor 地抗(%) +23 111 LightDamageReduceFactor 光抗(%) +24 112 DarkDamageReduceFactor 暗抗(%) +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null +0 null diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureConfig.java new file mode 100644 index 000000000..2b2a3c11c --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureConfig.java @@ -0,0 +1,67 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.Map; + +@Table(name ="AdventureConfig") +public class SAdventureConfig implements BaseConfig { + + private int id; + + private int openLevel; + + private int recommendForce; + + private int[] recommendHeroIds; + + private int minNum; + + private int[][] baseReward; + + private int[] randomRewardGroup; + + private int[] recommendRewardGroup; + + + @Override + public void init() throws Exception { + + } + + + public int getId() { + return id; + } + + public int getOpenLevel() { + return openLevel; + } + + public int getRecommendForce() { + return recommendForce; + } + + public int[] getRecommendHeroIds() { + return recommendHeroIds; + } + + public int getMinNum() { + return minNum; + } + + public int[][] getBaseReward() { + return baseReward; + } + + public int[] getRandomRewardGroup() { + return randomRewardGroup; + } + + public int[] getRecommendRewardGroup() { + return recommendRewardGroup; + } + + +} \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureSetting.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureSetting.java new file mode 100644 index 000000000..ff21bcb1b --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SAdventureSetting.java @@ -0,0 +1,61 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.Map; + +@Table(name ="AdventureSetting") +public class SAdventureSetting implements BaseConfig { + + private int id; + + private int limitHour; + + private int[] consumeGemRatio; + + private int[][] baseRewardRatio; + + private int[][] randomRewardRatio; + + private int perMapMaxHour; + + private int[][] hourRewardRatio; + + + @Override + public void init() throws Exception { + + } + + + public int getId() { + return id; + } + + public int getLimitHour() { + return limitHour; + } + + public int[] getConsumeGemRatio() { + return consumeGemRatio; + } + + public int[][] getBaseRewardRatio() { + return baseRewardRatio; + } + + public int[][] getRandomRewardRatio() { + return randomRewardRatio; + } + + public int getPerMapMaxHour() { + return perMapMaxHour; + } + + public int[][] getHourRewardRatio() { + return hourRewardRatio; + } + + +} \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java new file mode 100644 index 000000000..1e183679b --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java @@ -0,0 +1,84 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.Map; + +@Table(name ="EquipConfig") +public class SEquipConfig implements BaseConfig { + + private static Map sEquipConfigByIdMap; + + private int id; + + private int professionLimit; + + private int position; + + private int[] propertyMin; + + private int[] propertyMax; + + private int pool; + + private int secondNumMin; + + private int secondNumMax; + + private int skillId; + + private int ifClear; + + + @Override + public void init() throws Exception { + sEquipConfigByIdMap = STableManager.getConfig(SEquipConfig.class); + } + + public static SEquipConfig getsEquipConfigByI(int equipTid) { + return sEquipConfigByIdMap.get(equipTid); + } + + public int getId() { + return id; + } + + public int getProfessionLimit() { + return professionLimit; + } + + public int getPosition() { + return position; + } + + public int[] getPropertyMin() { + return propertyMin; + } + + public int[] getPropertyMax() { + return propertyMax; + } + + public int getPool() { + return pool; + } + + public int getSecondNumMin() { + return secondNumMin; + } + + public int getSecondNumMax() { + return secondNumMax; + } + + public int getSkillId() { + return skillId; + } + + public int getIfClear() { + return ifClear; + } + + +} \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipPropertyPool.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipPropertyPool.java new file mode 100644 index 000000000..316406bf6 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipPropertyPool.java @@ -0,0 +1,72 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Table(name ="EquipPropertyPool") +public class SEquipPropertyPool implements BaseConfig { + + private static Map> SEquipPropertyPoolByIdMap; + + private int id; + + private int propertyId; + + private int min; + + private int max; + + private int poolNum; + + private int weight; + + + @Override + public void init() throws Exception { + Map> sEquipPropertyPoolByIdMapTmp = new HashMap<>(); + Map config = STableManager.getConfig(SEquipPropertyPool.class); + for(SEquipPropertyPool sEquipPropertyPool : config.values()){ + int poolNum = sEquipPropertyPool.getPoolNum(); + if(!sEquipPropertyPoolByIdMapTmp.containsKey(poolNum)){ + sEquipPropertyPoolByIdMapTmp.put(poolNum,new ArrayList<>()); + } + sEquipPropertyPoolByIdMapTmp.get(poolNum).add(sEquipPropertyPool); + } + SEquipPropertyPoolByIdMap = sEquipPropertyPoolByIdMapTmp; + } + + public static List getSEquipPropertyPool(int poolId) { + return SEquipPropertyPoolByIdMap.get(poolId); + } + + public int getId() { + return id; + } + + public int getPropertyId() { + return propertyId; + } + + public int getMin() { + return min; + } + + public int getMax() { + return max; + } + + public int getPoolNum() { + return poolNum; + } + + public int getWeight() { + return weight; + } + + +} \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SPropertyConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SPropertyConfig.java new file mode 100644 index 000000000..b00967509 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SPropertyConfig.java @@ -0,0 +1,43 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.Map; + +@Table(name ="PropertyConfig") +public class SPropertyConfig implements BaseConfig { + + private int id; + + private int propertyId; + + private String name; + + private String info; + + + @Override + public void init() throws Exception { + + } + + + public int getId() { + return id; + } + + public int getPropertyId() { + return propertyId; + } + + public String getName() { + return name; + } + + public String getInfo() { + return info; + } + + +} \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java index ea11c7857..b0afe8203 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java @@ -1,6 +1,15 @@ package com.ljsd.jieling.logic.dao; import com.ljsd.common.mogodb.MongoBase; +import com.ljsd.jieling.config.SEquipConfig; +import com.ljsd.jieling.config.SEquipPropertyPool; +import com.ljsd.jieling.util.KeyGenUtils; +import com.ljsd.jieling.util.MathUtils; +import com.ljsd.jieling.util.UUIDEnum; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class Equip extends MongoBase { @@ -12,6 +21,62 @@ public class Equip extends MongoBase { private int star; + private Map propertyValueByIdMap; //主属性 key 对应PropertyConfig id + + private Map secondValueByIdMap; //副属性 + + + + + + + public Equip(){ + + } + + public Equip(String uid,int equipTid){ + this.id = KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP,uid); + this.equipId = equipTid; + this.propertyValueByIdMap = new HashMap<>(); + SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigByI(equipTid); + int properTyId = sEquipConfig.getPropertyMin()[0]; + int properMinNum = sEquipConfig.getPropertyMin()[1]; + int properMaxNum = sEquipConfig.getPropertyMax()[1]; + int finalProperValue = MathUtils.random(properMinNum, properMaxNum); + this.propertyValueByIdMap.put(properTyId,finalProperValue); + int secondNumMin = sEquipConfig.getSecondNumMin(); + int secondNumMax = sEquipConfig.getSecondNumMax(); + int secondValue = MathUtils.random(secondNumMin, secondNumMax); + this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(),secondValue); + } + + public Map getSecondValue(int poolId,int nums){ + Map result = new HashMap<>(); + List sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId); + int totalWeight = 0; + for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){ + totalWeight+=sEquipPropertyPool.getWeight(); + } + while (result.size() equipMap; + + public void addEquip(Equip equip) throws Exception { + updateString("equipMap." + equip.getId(),equip); + equipMap.put(equip.getId(),equip); + } + + public void remove(String equipId){ + removeString("equipMap." + equipId); + equipMap.remove(equipId); + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/User.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/User.java index a35dabf04..595dfc76e 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/User.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/User.java @@ -19,6 +19,8 @@ public class User extends MongoRoot { private MailManager mailManager; + private EquipManager equipManager; + public User(int uid, PlayerManager playerManager, ItemManager itemManager, @@ -31,14 +33,16 @@ public class User extends MongoRoot { this.mapManager = mapManager; this.teamPosManager = new TeamPosManager(); this.mailManager = new MailManager(); + this.equipManager = new EquipManager(); //綁定关系 - playerManager.init(this, "playerManager", false); - itemManager.init(this, "itemManager", false); - heroManager.init(this, "heroManager", false); - mapManager.init(this, "mapManager", false); - teamPosManager.init(this,"teamPosManager",false); - mailManager.init(this,"mailManager",false); + this.playerManager.init(this, "playerManager", false); + this.itemManager.init(this, "itemManager", false); + this.heroManager.init(this, "heroManager", false); + this.mapManager.init(this, "mapManager", false); + this.teamPosManager.init(this,"teamPosManager",false); + this.mailManager.init(this,"mailManager",false); + this.equipManager.init(this,"equipManager",false); } public User(){ @@ -47,11 +51,13 @@ public class User extends MongoRoot { this.itemManager = new ItemManager(); this.heroManager = new HeroManager(); this.mapManager = new MapManager(); + this.equipManager = new EquipManager(); //綁定关系 playerManager.init(this, "playerManager", false); itemManager.init(this, "itemManager", false); heroManager.init(this, "heroManager", false); mapManager.init(this, "mapManager", false); + equipManager.init(this,"equipManager",false); } public static void init(LjsdMongoTemplate ljsdMongoTemplate) {