公会优化
parent
24c49c8cfe
commit
0319fcefae
|
@ -40,6 +40,7 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
|
||||
private int type;
|
||||
|
||||
private int[][] openGifts;
|
||||
|
||||
private static Map<Integer,SGlobalSystemConfig> sGlobalSystemConfigMap;
|
||||
|
||||
|
@ -151,4 +152,8 @@ public class SGlobalSystemConfig implements BaseConfig {
|
|||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int[][] getOpenGifts() {
|
||||
return openGifts;
|
||||
}
|
||||
}
|
|
@ -3,17 +3,29 @@ package com.ljsd.jieling.config;
|
|||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GuildRewardConfig")
|
||||
public class SGuildRewardConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int rankMin;
|
||||
private int rankMax;
|
||||
private String reward;
|
||||
public static Map<Integer,SGuildRewardConfig> sGuildRewardConfigMap;
|
||||
public static Map<Integer,String> rewardMap;
|
||||
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
sGuildRewardConfigMap = STableManager.getConfig(SGuildRewardConfig.class);
|
||||
rewardMap = new HashMap<>();
|
||||
for(Map.Entry<Integer,SGuildRewardConfig> entry: sGuildRewardConfigMap.entrySet()){
|
||||
SGuildRewardConfig value = entry.getValue();
|
||||
for(int i = value.getRankMin(); i<= value.getRankMax(); i++){
|
||||
rewardMap.put(i, value.getReward());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,5 +33,15 @@ public class SGuildRewardConfig implements BaseConfig {
|
|||
return id;
|
||||
}
|
||||
|
||||
public int getRankMin() {
|
||||
return rankMin;
|
||||
}
|
||||
|
||||
public int getRankMax() {
|
||||
return rankMax;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ public interface GlobalsDef {
|
|||
int MAIL_RED_TYPE = 1; // 邮件红点红点
|
||||
int SHARE_BOSS_RED_TYPE =2; // 分享外敌boss红点
|
||||
int ARENA_CHALLENGE_TYPE =3;// 竞技场防守记录红点
|
||||
int GUILD_APPLY_TYPE = 4;//公会申请红点
|
||||
|
||||
int addReason = 0;
|
||||
int subReason = 1;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.SArenaSetting;
|
||||
import com.ljsd.jieling.config.SGuildLevelConfig;
|
||||
import com.ljsd.jieling.config.SGuildScoreConfig;
|
||||
import com.ljsd.jieling.config.SGuildSetting;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -25,10 +22,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.FightDataUtil;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -392,6 +386,12 @@ public class GuildFightLogic {
|
|||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(userAttack.getId()),attackCount+1);
|
||||
FamilyFightInfo defendInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(defendUid), FamilyFightInfo.class);
|
||||
Map<String, FamilyHeroInfo> heroAttribute = defendInfo.getHeroAttribute();
|
||||
int aliveHero = 0;
|
||||
for(Map.Entry<String, FamilyHeroInfo> entry:heroAttribute.entrySet()){
|
||||
if(entry.getValue().getAttribute().get(HeroAttributeEnum.CurHP.getPropertyId())>0){
|
||||
aliveHero++;
|
||||
}
|
||||
}
|
||||
//防守血量处理
|
||||
CommonProto.FightTeamInfo fightDefendTeamInfo = BloodLogic.getInstance().fightDataMakeUp(defendInfo.getHeroSkills(),heroAttribute,defendInfo.getPokenmonSkills());
|
||||
//攻击者血量处理
|
||||
|
@ -444,16 +444,16 @@ public class GuildFightLogic {
|
|||
for (int i = 0; i < fightResult.length; i++) {
|
||||
System.out.println(fightResult[i]);
|
||||
}
|
||||
int dieCount = 0;
|
||||
int aliveCount = 0;
|
||||
|
||||
// 战斗之后数据处理
|
||||
for(int i = 2 ; i <fightResult.length;i++){
|
||||
if(fightResult[0]==0) {
|
||||
if(fightResult[i]==0){
|
||||
dieCount++;
|
||||
if(fightResult[i]>=0){
|
||||
aliveCount++;
|
||||
}
|
||||
}else{
|
||||
dieCount = 5;
|
||||
aliveCount=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,10 +477,10 @@ public class GuildFightLogic {
|
|||
|
||||
int memberType =player.getGuildPosition();
|
||||
int maxStar = sGuildSetting.getStarNum()[memberType-1];
|
||||
int lessStar = maxStar - dieCount*maxStar/5;
|
||||
getStar =(aliveHero-aliveCount)*maxStar/5;
|
||||
//倍数k(maxStar/5)
|
||||
getStar = defendInfo.getStarCount()-lessStar;
|
||||
defendInfo.setStarCount(lessStar);
|
||||
// getStar = defendInfo.getStarCount()-lessStar;
|
||||
defendInfo.setStarCount(maxStar-getStar);
|
||||
for(TeamPosHeroInfo attack:teamAttack){
|
||||
redisUtil.putMapEntry(RedisKey.FAMILY_ATTACK_BLOOD,String.valueOf(userAttack.getId()),attack.getHeroId(),100);
|
||||
}
|
||||
|
@ -762,21 +762,28 @@ public class GuildFightLogic {
|
|||
}else{
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
||||
}
|
||||
// //个人奖励
|
||||
// Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(guildId), 0, 20);
|
||||
// if(zsetreverseRangeWithScores.size()<1){
|
||||
// continue;
|
||||
// }
|
||||
// Iterator<ZSetOperations.TypedTuple<String>> it = zsetreverseRangeWithScores.iterator();
|
||||
// int userRank = 1;
|
||||
// int userResultRank = 1;
|
||||
//个人奖励
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(guildInfo.getId()), 0, 20);
|
||||
if(zsetreverseRangeWithScores.size()<1){
|
||||
continue;
|
||||
}
|
||||
Iterator<ZSetOperations.TypedTuple<String>> it = zsetreverseRangeWithScores.iterator();
|
||||
int userRank = 0;
|
||||
int userResultRank = 0;
|
||||
int lastStar = 0;
|
||||
// Family.PersonalFightResultResponse.Builder response = Family.PersonalFightResultResponse.newBuilder();
|
||||
//// response.addResult(Family.PersonalFightResult.newBuilder().setRank(userRank).set.build())
|
||||
// while (it.hasNext()){
|
||||
// ZSetOperations.TypedTuple<String> next = it.next();
|
||||
//// MailLogic.getInstance().sendMail(Integer.parseInt(next.getValue()),"公会战奖励","恭喜你在此次工会战中获得第"+userResultRank,,Global.MAIL_EFFECTIVE_TIME);
|
||||
// userRank++;
|
||||
// }
|
||||
// response.addResult(Family.PersonalFightResult.newBuilder().setRank(userRank).set.build())
|
||||
while (it.hasNext()){
|
||||
ZSetOperations.TypedTuple<String> next = it.next();
|
||||
userRank++;
|
||||
if(next.getScore()!=lastStar){
|
||||
lastStar = next.getScore().intValue();
|
||||
userResultRank = userRank;
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_reward_txt",new Object[]{String.valueOf(userResultRank)});
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(next.getValue()),title,content,SGuildRewardConfig.rewardMap.get(userResultRank),(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
|
|
|
@ -207,6 +207,13 @@ public class GuildLogic {
|
|||
continue;
|
||||
}
|
||||
GuilidManager.addApplyGuildInfo(guildApply);
|
||||
Map<Integer, Set<Integer>> members = GuilidManager.guildInfoMap.get(applyGuilds).getMembers();
|
||||
for(Set<Integer> items : members.values()){
|
||||
for(Integer sendUid : items){
|
||||
MessageUtil.sendRedIndication(sendUid,GlobalsDef.GUILD_APPLY_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
@ -231,7 +238,7 @@ public class GuildLogic {
|
|||
return;
|
||||
}
|
||||
if(user.getPlayerInfoManager().getLevel()<guildInfo.getIntoLevel()){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"等级不足");
|
||||
MessageUtil.sendErrorResponse(session,Global.SHOW_TIPS_ERROR,msgId,"条件不符,无法加入");
|
||||
return;
|
||||
}
|
||||
//todo 判读人数是否已达上限
|
||||
|
@ -352,6 +359,7 @@ public class GuildLogic {
|
|||
User userTmp = UserManager.getUser(guildApply.getId());
|
||||
builder.addFamilyApply(CBean2Proto.getFamilyApplyInfo(userTmp,guildApply.getCreateTime())).build();
|
||||
}
|
||||
user.getPlayerInfoManager().removeRed(GlobalsDef.GUILD_APPLY_TYPE);
|
||||
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
|
||||
}
|
||||
|
||||
|
@ -415,7 +423,9 @@ public class GuildLogic {
|
|||
}
|
||||
break;
|
||||
case 2: //全部拒绝
|
||||
Family.RefuseJoinFamily refuse = Family.RefuseJoinFamily.newBuilder().setName(guildInfo.getName()).build();
|
||||
for(Map.Entry<Integer, GuildApply> entry:applyGuild.entrySet()){
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(applyId),1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuse,true);
|
||||
GuilidManager.removeOneApplyGuildInfos(entry.getValue().getGuildId(),entry.getValue().getId());
|
||||
}
|
||||
break;
|
||||
|
@ -432,6 +442,8 @@ public class GuildLogic {
|
|||
break;
|
||||
case 4: //拒绝一个
|
||||
GuilidManager.removeOneApplyGuildInfos(guildId,applyId);
|
||||
Family.RefuseJoinFamily refuseName = Family.RefuseJoinFamily.newBuilder().setName(guildInfo.getName()).build();
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(applyId),1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuseName,true);
|
||||
break;
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
@ -499,15 +511,17 @@ public class GuildLogic {
|
|||
MessageUtil.sendErrorResponse(session,0,msgId,"无权操作");
|
||||
return;
|
||||
}
|
||||
if(GuildFightLogic.getStatus()!=0){
|
||||
MessageUtil.sendErrorResponse(session,0, msgId,"公会战期间不允许踢出成员");
|
||||
return;
|
||||
}
|
||||
Family.KickOutIndication kickIndication = Family.KickOutIndication.newBuilder().setUid(targetUid).build();
|
||||
sendIndicationToMember(guildInfo,MessageTypeProto.MessageType.FAMILY_KICK_INDICATION,kickIndication);
|
||||
boolean remove = guildInfo.removeMember(targetType, targetUid);
|
||||
if(!remove){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"该人已被踢出");
|
||||
return;
|
||||
}
|
||||
if(GuildFightLogic.getStatus()!=0){
|
||||
MessageUtil.sendErrorResponse(session,0, msgId,"公会战期间不允许踢出成员");
|
||||
return;
|
||||
}
|
||||
//如果有防守信息则删除
|
||||
if(guildInfo.getDefendInfo().containsKey((targetUid))){
|
||||
guildInfo.removeDefendInfo(targetUid);
|
||||
|
@ -516,11 +530,14 @@ public class GuildLogic {
|
|||
targetUser.getPlayerInfoManager().setGuildId(0);
|
||||
targetUser.getGuildMyInfo().clearOfLevelGuild();
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.KICK,targetUser.getPlayerInfoManager().getNickName());
|
||||
Family.FamilyKickIndication build = Family.FamilyKickIndication.newBuilder().setType(1).build();
|
||||
ISession targetSession = OnlineUserManager.getSessionByUid(targetUid);
|
||||
if(targetSession!=null){
|
||||
MessageUtil.sendIndicationMessage(targetSession,1, MessageTypeProto.MessageType.FAMILY_KICK_INDICATION_VALUE,build,true);
|
||||
}
|
||||
// Family.FamilyKickIndication build = Family.FamilyKickIndication.newBuilder().setType(1).build();
|
||||
// ISession targetSession = OnlineUserManager.getSessionByUid(targetUid);
|
||||
// if(targetSession!=null){
|
||||
//// MessageUtil.sendIndicationMessage(targetSession,1, MessageTypeProto.MessageType.FAMILY_KICK_INDICATION_VALUE,build,true);
|
||||
// }
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("family_kick_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("family_kick_txt",new Object[]{guildInfo.getName()});
|
||||
MailLogic.getInstance().sendMail(targetUid,title,content,"",(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
|
@ -556,7 +573,6 @@ public class GuildLogic {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
guildInfo.removeMember(targetType,targetUid);
|
||||
guildInfo.addMembers(position,targetUid);
|
||||
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||
|
@ -691,7 +707,7 @@ public class GuildLogic {
|
|||
|
||||
public static void releaseGuild(GuildInfo guildInfo) throws Exception {
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
Family.FamilyKickIndication build = Family.FamilyKickIndication.newBuilder().setType(2).build();
|
||||
Family.KickOutIndication build = Family.KickOutIndication.newBuilder().build();
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("guild_breakup_title");
|
||||
Set<Integer> chairmans = guildInfo.getMembers().get(GlobalsDef.CHAIRMAN);
|
||||
Integer chairmanUid = chairmans.iterator().next();
|
||||
|
@ -766,7 +782,30 @@ public class GuildLogic {
|
|||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
public static void sendPositionChange(int uid,int position){
|
||||
public static void sendPositionChange(int uid,int position) throws Exception {
|
||||
String title = "";
|
||||
String content = "";
|
||||
//给玩家发邮件
|
||||
switch (position){
|
||||
case 1:
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("family_leader_title");
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("family_leader_txt");
|
||||
break;
|
||||
case 2:
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("family_position_title");
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("family_position_txt");
|
||||
break;
|
||||
case 3:
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("family_relieve_title");
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("family_relieve_txt");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(StringUtil.isEmpty(title)||StringUtil.isEmpty(content)){
|
||||
return;
|
||||
}
|
||||
MailLogic.getInstance().sendMail(uid,title,content,"",(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||
if(session!=null){
|
||||
Family.FamilyPositionUpdateIndication build = Family.FamilyPositionUpdateIndication.newBuilder().setPostiion(position).build();
|
||||
|
|
Loading…
Reference in New Issue