公会奖励补发 及 机器人编队位置添加

back_recharge
zhangshanxue 2020-05-16 15:35:32 +08:00
parent feaa5fb4f5
commit 783120f7eb
5 changed files with 76 additions and 31 deletions

View File

@ -60,7 +60,7 @@ public class GuildHelpGetAllRequestHandler extends BaseHandler<Family.GuildHelpG
for (Map.Entry<Integer, Integer> entry : entries) {
builder.addGuildHelpInfo(CommonProto.GuildHelpInfo.newBuilder().setType(entry.getKey()).setHadtakenum(user.getGuildMyInfo().getGuidHelpHadTakeInfo().getOrDefault(entry.getKey(),0)).setHadtakenum(guidHelpHadTakeInfo.getOrDefault(entry.getKey(),0)).setNum(entry.getValue()));
}
Family.GuildHelpInfoIndication build = builder.setUid(target.getId()).build();
Family.GuildHelpInfoIndication build = builder.setUid(target.getId()).setName(target.getPlayerInfoManager().getNickName()).build();
builder1.addGuildHelpInfoIndication(build);
}

View File

@ -52,6 +52,19 @@ public class GuildHelpHelpOtherRequestHandler extends BaseHandler<Family.GuildHe
throw new ErrorCodeException(ErrorCode.FAMILY_NO);
}
SGuildHelpConfig sGuildHelpConfig = STableManager.getConfig(SGuildHelpConfig.class).get(1);
// time check
int guildHelpTime = user.getGuildMyInfo().getGuildHelpTime();
if(guildHelpTime+1>sGuildHelpConfig.getHelpTime()[0]+(sGuildHelpConfig.getHelpTime()[1])){
//check cost
throw new ErrorCodeException("次数用尽");
}
if(uid==proto.getUid()){
throw new ErrorCodeException("不可援助自己");
}
//lock all 会修改公会记录
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
@ -62,15 +75,6 @@ public class GuildHelpHelpOtherRequestHandler extends BaseHandler<Family.GuildHe
Lockeys.getLockeys().lock("guild",sendUids);
SGuildHelpConfig sGuildHelpConfig = STableManager.getConfig(SGuildHelpConfig.class).get(1);
// time check
int guildHelpTime = user.getGuildMyInfo().getGuildHelpTime();
if(guildHelpTime+1>sGuildHelpConfig.getHelpTime()[0]+(sGuildHelpConfig.getHelpTime()[1])){
//check cost
throw new ErrorCodeException("次数用尽");
}
if(guildHelpTime+1>sGuildHelpConfig.getHelpTime()[0]){
//check cost
int[][] cost = new int[1][];
@ -102,7 +106,7 @@ public class GuildHelpHelpOtherRequestHandler extends BaseHandler<Family.GuildHe
for (Map.Entry<Integer, Integer> entry : target.getGuildMyInfo().getGuidHelpInfo().entrySet()) {
build.addGuildHelpInfo(CommonProto.GuildHelpInfo.newBuilder().setType(entry.getKey()).setHadtakenum(user.getGuildMyInfo().getGuidHelpHadTakeInfo().getOrDefault(entry.getKey(),0)).setNum(entry.getValue()));
}
build.setUid(target.getId());
build.setName(target.getPlayerInfoManager().getNickName()).setUid(target.getId());
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(guildId), MessageTypeProto.MessageType.GuildHelpInfoIndication,build.build());

View File

@ -79,7 +79,7 @@ public class GuildSendHelpRequestHandler extends BaseHandler<Family.GuildSendHel
}
//notify all change
Family.GuildHelpInfoIndication build = builder.setUid(user.getId()).build();
Family.GuildHelpInfoIndication build = builder.setUid(user.getId()).setName(user.getPlayerInfoManager().getNickName()).build();
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(guildId), MessageTypeProto.MessageType.GuildHelpInfoIndication,build);

View File

@ -333,6 +333,7 @@ public class BehaviorUtil {
public static CommonProto.FightTeamInfo getRobotFightTeamInfo(SArenaRobotConfig sArenaRobotConfig,Map<String,Double> remainHp) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
Map<Integer,Integer> heroStarsMap = sArenaRobotConfig.getStarOfHeroMap();
int i=0;
for(Map.Entry<Integer,Integer> item : heroStarsMap.entrySet()){
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
@ -357,6 +358,7 @@ public class BehaviorUtil {
.setUnitId(Integer.toString(heroTid))
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
.setProperty(property.substring(0, property.length()-1))
.setPosition(++i)
.build();
heroFightInfos.add(heroFightInfo);
}

View File

@ -52,6 +52,8 @@ public class GuildLogic {
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder)throws Exception {
takeAllReward(user);
// 发送公会援助奖励
sendGuildHelpRewardEmail(user);
user.getGuildMyInfo().setFetetype(0);
user.getGuildMyInfo().clearHadTakeReward();
@ -60,6 +62,8 @@ public class GuildLogic {
fBuilder.setLastFeteType(user.getGuildMyInfo().getFetetype());
fBuilder.addAllTakeFeteReward(new HashSet<>());
}
//
}
@ -67,7 +71,7 @@ public class GuildLogic {
List<int[][]> itemArrs = new LinkedList<>();
//补发前日未领取的
//补发前日未领取的祭祀
Map<Integer, SGuildSacrificeRewardConfig> config = STableManager.getConfig(SGuildSacrificeRewardConfig.class);
if (null == config) {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
@ -619,6 +623,10 @@ public class GuildLogic {
if(GuildFightLogic.getStatus()!=0){
throw new ErrorCodeException(ErrorCode.FAMILY_NOT_KICK_IN_WAR);
}
//TODO lock check
OnUserLeveFamily(user);
Family.KickOutIndication kickIndication = Family.KickOutIndication.newBuilder().setUid(targetUid).build();
sendIndicationToMember(guildInfo,MessageTypeProto.MessageType.FAMILY_KICK_INDICATION,kickIndication);
boolean remove = guildInfo.removeMember(targetType, targetUid);
@ -824,7 +832,10 @@ public class GuildLogic {
if(session!=null){
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.FAMILY_KICK_INDICATION_VALUE,build,true);
}
User user = UserManager.getUser(sendUid);
//TODO lock check
OnUserLeveFamily(user);
user.getPlayerInfoManager().setGuildId(0);
MailLogic.getInstance().sendMail(user.getId(),title,content,"",(int)(System.currentTimeMillis()/1000), Global.MAIL_EFFECTIVE_TIME);
}
@ -1341,22 +1352,7 @@ public class GuildLogic {
//TODO lock all 公会id清零之前调用
//退公会清除数据 补发奖励
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
guildMyInfo.setGuidHelpHadTakeInfo(new HashMap<>(guildMyInfo.getGuidHelpInfo()));
String title = SErrorCodeEerverConfig.getI18NMessage("guildhelp_reward_title");
String content = SErrorCodeEerverConfig.getI18NMessage("guildhelp_reward_txt");
List<int[][]> list = new LinkedList<>();
for (Map.Entry<Integer, Integer> entry : user.getGuildMyInfo().getGuidHelpInfo().entrySet()) {
int[][] drop = new int[1][];
drop[0] = new int[2];
drop[0][0] = entry.getKey();
drop[0][1] = entry.getValue()-user.getGuildMyInfo().getGuidHelpHadTakeInfo().getOrDefault(entry.getKey(),0);
list.add(drop);
}
String mailReward = ItemUtil.getMailReward(list);
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
sendGuildHelpRewardEmail(user);
//notify all
Family.GuildHelpInfoIndication.Builder build = Family.GuildHelpInfoIndication.newBuilder();
@ -1366,7 +1362,50 @@ public class GuildLogic {
}
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.GuildHelpInfoIndication,build.build());
}
//sendGuildHelpRewardEmail
public static void sendGuildHelpRewardEmail(User user)throws Exception{
// 补发奖励
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
String title = SErrorCodeEerverConfig.getI18NMessage("guildhelp_reward_title");
String content = SErrorCodeEerverConfig.getI18NMessage("guildhelp_reward_txt");
List<int[][]> list = new LinkedList<>();
for (Map.Entry<Integer, Integer> entry : user.getGuildMyInfo().getGuidHelpInfo().entrySet()) {
int i = entry.getValue() - user.getGuildMyInfo().getGuidHelpHadTakeInfo().getOrDefault(entry.getKey(), 0);
if(i<=0){
continue;
}
int[][] drop = new int[1][];
drop[0] = new int[2];
drop[0][0] = entry.getKey();
drop[0][1] = i;
list.add(drop);
guildMyInfo.putGuidHelpHadTakeInfo(entry.getKey(),entry.getValue());
}
if(list.size()==0){
return;
}
boolean isfinish =true;
SGuildHelpConfig sGuildHelpConfig = STableManager.getConfig(SGuildHelpConfig.class).get(1);
if(guildMyInfo.getGuidHelpInfo().size()==sGuildHelpConfig.getRecourseTime()[0]){
for (Map.Entry<Integer,Integer> entry:guildMyInfo.getGuidHelpHadTakeInfo().entrySet()) {
if(entry.getValue()<sGuildHelpConfig.getRecourseTime()[1]){
isfinish = false;
break;
}
}
}else {
isfinish=false;
}
if(isfinish&&!guildMyInfo.isGuildHelpReward()){
list.add(sGuildHelpConfig.getReward());
}
String mailReward = ItemUtil.getMailReward(list);
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
}
}