公会技能 代码提交
parent
3e3219fe05
commit
0d59731c5c
|
@ -125,6 +125,9 @@ public interface BIReason {
|
|||
|
||||
int JEWEL_DECOMPOSE = 70;//分解宝器
|
||||
|
||||
int RESET_GUILD_SKILL = 71;//重置工会技能
|
||||
|
||||
|
||||
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||
|
@ -228,6 +231,8 @@ public interface BIReason {
|
|||
|
||||
int JEWEL_BUILD_OR_UP_CONSUME = 1055;//宝器升级或精炼消耗
|
||||
|
||||
int GUILD_SKILL_LEVEL_UP_CONSUME = 1056;//工会技能升级消耗
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/5
|
||||
* @discribe 获取公会技能
|
||||
*/
|
||||
@Component
|
||||
public class GetAllGuildSkillHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_ALL_GUILD_SKILL_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildLogic.getAllSkill(iSession, MessageTypeProto.MessageType.GET_ALL_GUILD_SKILL_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/5
|
||||
* @discribe 公会技能升级
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class GuildSkillLevelUpHandler extends BaseHandler<Family.GuildSkillLevelUpRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GUILD_SKILL_LEVEL_UP_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, Family.GuildSkillLevelUpRequest proto) throws Exception {
|
||||
GuildLogic.guildSkillLevelUp(iSession,proto.getType(), MessageTypeProto.MessageType.GUILD_SKILL_LEVEL_UP_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/5
|
||||
* @discribe 公会技能重置
|
||||
*/
|
||||
@Component
|
||||
public class GuildSkillResetHandler extends BaseHandler<Family.ResetGuildSkillRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GUILD_SKILL_RESET_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, Family.ResetGuildSkillRequest proto) throws Exception {
|
||||
GuildLogic.resetGuildSkill(iSession,proto.getType(),MessageTypeProto.MessageType.GUILD_SKILL_RESET_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,9 @@ import manager.STableManager;
|
|||
import util.CellUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GuildMyInfo extends MongoBase {
|
||||
private static int speed = 200;
|
||||
|
@ -16,6 +18,8 @@ public class GuildMyInfo extends MongoBase {
|
|||
private long preMoveTimestamp; //上次更新时间
|
||||
private int maxBossHurt; //工会boss最高伤害
|
||||
private int lastHurt; //上一次伤害
|
||||
|
||||
private Map<Integer,Integer> guildSkill = new HashMap<>(4);
|
||||
public void clearOfLevelGuild(){
|
||||
path.clear();
|
||||
curPos = STableManager.getFigureConfig(CommonStaticConfig.class).getInitPos();
|
||||
|
@ -116,4 +120,19 @@ public class GuildMyInfo extends MongoBase {
|
|||
public long getPreMoveTimestamp() {
|
||||
return preMoveTimestamp;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getGuildSkill() {
|
||||
return guildSkill;
|
||||
}
|
||||
|
||||
public void addGuildSkillByType(int type){
|
||||
guildSkill.putIfAbsent(type, 0);
|
||||
guildSkill.put(type,guildSkill.get(type)+1);
|
||||
updateString("guildSkill",guildSkill);
|
||||
}
|
||||
|
||||
public void removeGuildSkillByType(int type){
|
||||
guildSkill.remove(type);
|
||||
updateString("guildSkill",guildSkill);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1145,4 +1145,96 @@ public class GuildLogic {
|
|||
Family.GetAllSendLikeResponse response = Family.GetAllSendLikeResponse.newBuilder().addAllUid(user.getFriendManager().getTodayLike()).build();
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有公会技能
|
||||
* @param session
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getAllSkill(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
Map<Integer, Integer> guildSkill = user.getGuildMyInfo().getGuildSkill();
|
||||
Family.GetAllGuildSkillResponse.Builder response =Family.GetAllGuildSkillResponse.newBuilder();
|
||||
for(Map.Entry<Integer, Integer> entry:guildSkill.entrySet()){
|
||||
Family.GuildSkill skill= Family.GuildSkill.newBuilder().setType(entry.getKey()).setLevel(entry.getValue()).build();
|
||||
response.addSkill(skill);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公会技能升级
|
||||
* @param session
|
||||
* @param type
|
||||
* @param messageType
|
||||
*/
|
||||
public static void guildSkillLevelUp(ISession session, int type,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
//todo 消耗校验
|
||||
Map<Integer, Integer> skillInfo= user.getGuildMyInfo().getGuildSkill();
|
||||
Map<Integer, Map<Integer, SGuildTechnology>> typeMap = SGuildTechnology.technologyMap.get(type);
|
||||
int size = typeMap.size();
|
||||
int[][] consume;
|
||||
if(!skillInfo.containsKey(type)){
|
||||
consume = typeMap.get(1).get(0).getConsume();
|
||||
}else{
|
||||
int level = skillInfo.get(type);
|
||||
consume = typeMap.get(level%size+1).get(level/size).getConsume();
|
||||
if(typeMap.get(level%size+1).get(level/size+1)==null){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_LEVE_MAX);
|
||||
}
|
||||
}
|
||||
boolean itemCost = ItemUtil.itemCost(user, consume, BIReason.GUILD_SKILL_LEVEL_UP_CONSUME, 1);
|
||||
|
||||
if(!itemCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
user.getGuildMyInfo().addGuildSkillByType(type);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 公会技能重置
|
||||
* @param session
|
||||
* @param type
|
||||
* @param messageType
|
||||
*/
|
||||
public static void resetGuildSkill(ISession session, int type, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||
if(!guildMyInfo.getGuildSkill().containsKey(type)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int level = guildMyInfo.getGuildSkill().get(type);
|
||||
|
||||
int size = SGuildTechnology.technologyMap.get(type).size();
|
||||
List<int[]> consume = new ArrayList<>();
|
||||
for(int i = 1;i<=size;i++){
|
||||
int baseLevel = level/size;
|
||||
if(level%size>=i){
|
||||
baseLevel+=1;
|
||||
}
|
||||
Map<Integer, SGuildTechnology> levelMap = SGuildTechnology.technologyMap.get(type).get(i);
|
||||
for(int j = 0 ; j<baseLevel;j++){
|
||||
SGuildTechnology sGuildTechnology = levelMap.get(j);
|
||||
consume.addAll(Arrays.asList(sGuildTechnology.getConsume()));
|
||||
}
|
||||
}
|
||||
int percent = SSpecialConfig.getIntegerValue(SSpecialConfig.GUILD_TECHNOLOGY_RETURN_PERCENT);
|
||||
int[][] dropArray = consume.toArray(new int[consume.size()][]);
|
||||
for(int i = 0;i<dropArray.length;i++){
|
||||
if(dropArray[i].length<2){
|
||||
continue;
|
||||
}
|
||||
dropArray[i][1] = (int) (dropArray[i][1]*(percent/10000f));
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropArray, BIReason.RESET_GUILD_SKILL);
|
||||
guildMyInfo.removeGuildSkillByType(type);
|
||||
Family.ResetGuildSkillResponse response = Family.ResetGuildSkillResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1409,12 +1409,25 @@ public class HeroLogic{
|
|||
int[][] property = SPlayerMountLevelUp.sPlayerMountLevelUpMap.get(rideLevel).getProperty();
|
||||
combinedAttribute(property,heroAllAttribute);
|
||||
}
|
||||
//公会技能加成
|
||||
Map<Integer, Integer> guildSkill = user.getGuildMyInfo().getGuildSkill();
|
||||
if(guildSkill.containsKey(scHero.getProfession())){
|
||||
int size = SGuildTechnology.technologyMap.get(scHero.getProfession()).size();
|
||||
int level = guildSkill.get(scHero.getProfession());
|
||||
List<int[]> skills = new ArrayList<>();
|
||||
for(int i = 1;i<=size;i++){
|
||||
int baseLevel = level/size;
|
||||
if(level%size>=i){
|
||||
baseLevel+=1;
|
||||
}
|
||||
Map<Integer, SGuildTechnology> levelMap = SGuildTechnology.technologyMap.get(scHero.getProfession()).get(i);
|
||||
SGuildTechnology sGuildTechnology = levelMap.get(baseLevel);
|
||||
skills.add(sGuildTechnology.getValues());
|
||||
}
|
||||
int[][] arraySkills = skills.toArray(new int[skills.size()][]);
|
||||
combinedAttribute(arraySkills,heroAllAttribute);
|
||||
}
|
||||
|
||||
// Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
// Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
|
||||
// soulEquipByPositionMap.values().forEach(e->{
|
||||
// combinedAttribute( equipConfigMap.get(e).getProperty(),heroAllAttribute);
|
||||
// });
|
||||
|
||||
//阵营光环加成
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GuildTechnology")
|
||||
public class SGuildTechnology implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int techId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[] values;
|
||||
|
||||
private int profession;
|
||||
|
||||
private int[][] consume;
|
||||
|
||||
|
||||
public static Map<Integer,Map<Integer,Map<Integer,SGuildTechnology>>> technologyMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SGuildTechnology> config = STableManager.getConfig(SGuildTechnology.class);
|
||||
for(SGuildTechnology value:config.values()){
|
||||
technologyMap.computeIfAbsent(value.getProfession(),n->new HashMap<>());
|
||||
technologyMap.get(value.getProfession()).computeIfAbsent(value.getTechId(),n->new HashMap<>());
|
||||
technologyMap.get(value.getProfession()).get(value.getTechId()).put(value.getLevel(),value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getTechId() {
|
||||
return techId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[] getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public int getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public int[][] getConsume() {
|
||||
return consume;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -60,6 +60,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String Sign_Location = "Sign_Location";//魂印位置开启条件(玩家等级)
|
||||
public static final String Gold_touch = "Gold_touch";//三个点金对应vip
|
||||
public static final String Gold_touch_refresh = "Gold_touch_refresh";//点金刷新时间
|
||||
public static final String GUILD_TECHNOLOGY_RETURN_PERCENT = "guild_technology_return_percent";//公会技能重置返还材料比例 实际百分比为填写数值/10000
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue