Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
f16f1dbc99
|
@ -34,6 +34,8 @@ public class SGlobalActivity implements BaseConfig {
|
|||
|
||||
private int isSaving;
|
||||
|
||||
private int isMail;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -111,4 +113,8 @@ public class SGlobalActivity implements BaseConfig {
|
|||
public int getIsSaving() {
|
||||
return isSaving;
|
||||
}
|
||||
|
||||
public int getIsMail() {
|
||||
return isMail;
|
||||
}
|
||||
}
|
|
@ -119,4 +119,6 @@ public interface BIReason {
|
|||
int CREATE_GUILD_CONSUME = 1031; // 创建宗门消耗
|
||||
int ENDLESS_CONSUME_EXECUTION = 1032; //无尽副本消耗行动力
|
||||
|
||||
int EMAIL_AUTO_TAKE_REWARD = 1033 ;// 活动结束邮件补发未领取奖
|
||||
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.config.SGlobalActivity;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
@ -11,12 +14,14 @@ import com.ljsd.jieling.logic.dao.ActivityMission;
|
|||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -45,7 +50,8 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* 子类重写
|
||||
* 子类重写
|
||||
*
|
||||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -85,6 +91,11 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 领奖默认方法 走统一奖励配置表
|
||||
* 重写此类 记得重写onActivityEndOnMySelf 否者活动结束走默认配置表发邮件奖
|
||||
*/
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
|
||||
|
@ -123,6 +134,55 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
void takeAllReward(ISession session) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
List<Integer> misssIds = new LinkedList<>();
|
||||
|
||||
List<SActivityRewardConfig> cfgs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
if (null == cfgs) {
|
||||
return;
|
||||
}
|
||||
for (SActivityRewardConfig sActivityRewardConfig : cfgs) {
|
||||
misssIds.add(sActivityRewardConfig.getId());
|
||||
}
|
||||
|
||||
List<int[][]> itemArrs = new LinkedList<>();
|
||||
for (Integer missionId : misssIds) {
|
||||
//check cfg
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
|
||||
if (sActivityRewardConfig == null || sActivityRewardConfig.getActivityId() != id) {
|
||||
continue;
|
||||
}
|
||||
//check state
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
||||
continue;
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
|
||||
continue;
|
||||
}
|
||||
//take rewards check
|
||||
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
|
||||
continue;
|
||||
}
|
||||
//up miss
|
||||
int[][] reward = sActivityRewardConfig.getReward();
|
||||
itemArrs.add(reward);
|
||||
}
|
||||
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (null == sGlobalActivity)
|
||||
return;
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title", new Object[]{sGlobalActivity.getSesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()});
|
||||
String mailReward = ItemUtil.getMailReward(itemArrs);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
void checkAndSetProgress(ActivityMission activityMission, ActivityProgressInfo activityProgressInfo, SActivityRewardConfig sActivityRewardConfig, int missionId) {
|
||||
activityProgressInfo.setState(ActivityType.HAD_TAKED);
|
||||
activityMission.updateProgressInfo(missionId, activityProgressInfo);
|
||||
|
@ -158,6 +218,14 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void onActivityEndSelfWithDealReward(User user) throws Exception {
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (sGlobalActivity.getIsMail() == 1)
|
||||
onActivityEndDealReward(user);
|
||||
onActivityEndOnMySelf(user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityEnd() throws Exception {
|
||||
|
||||
|
@ -165,9 +233,16 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动结束邮件 有比较多的潜规则 单号1003747体现
|
||||
*/
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
takeAllReward(sessionByUid);
|
||||
}
|
||||
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission) {
|
||||
return getAllMissInfo(activityMission, null);
|
||||
|
|
|
@ -158,7 +158,7 @@ public class ActivityLogic {
|
|||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
if (activityMission != null) {
|
||||
activityManager.removeActivity(activityId);
|
||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndOnMySelf(user);
|
||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndSelfWithDealReward(user);
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
|
@ -178,7 +178,7 @@ public class ActivityLogic {
|
|||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
if (activityMission != null) {
|
||||
activityManager.removeActivity(activityId);
|
||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndOnMySelf(user);
|
||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndSelfWithDealReward(user);
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +16,15 @@ class DailyRechargeActivity extends AbstractActivity {
|
|||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
//每日充值 补发前日未领取的奖
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
takeAllReward(sessionByUid);
|
||||
super.onResume(user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count + activityMission.getValue());
|
||||
|
@ -24,4 +35,7 @@ class DailyRechargeActivity extends AbstractActivity {
|
|||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,13 @@ public class DefaultEmptyActivity extends AbstractActivity{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if(sGlobalActivity.getType() == ActivityType.SERVERHAPPY){
|
||||
return;
|
||||
}
|
||||
super.onActivityEndDealReward(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,5 +116,10 @@ class ForceRankActivity extends AbstractActivity {
|
|||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
//没有奖励
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,9 @@ public interface IActivity {
|
|||
*/
|
||||
void onActivityEnd() throws Exception;
|
||||
|
||||
public void onActivityEndOnMySelf(User user) throws Exception;
|
||||
void onActivityEndDealReward(User user) throws Exception;
|
||||
|
||||
void onActivityEndOnMySelf(User user) throws Exception;
|
||||
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission, Set<Integer> filter);
|
||||
|
||||
|
|
|
@ -895,8 +895,9 @@ public class GuildLogic {
|
|||
.setPosition(2)
|
||||
.setSoulForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()),501,false))
|
||||
.setHead(playerManager.getHead())
|
||||
.setFrame(playerManager.getHeadFrame());
|
||||
playerInfo.setUserInfo(userInfo);
|
||||
.setFrame(playerManager.getHeadFrame())
|
||||
.setContribute(0);
|
||||
playerInfo.setUserInfo(userInfo.build());
|
||||
fightInfo.addUser(playerInfo);
|
||||
}
|
||||
return fightInfo.build();
|
||||
|
@ -930,12 +931,14 @@ public class GuildLogic {
|
|||
return;
|
||||
}
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
Set<String> rank = redisUtil.getZset(RedisKey.FAMILY_FIGHT_RANK, 0, redisUtil.getZsetSize(RedisKey.FAMILY_FIGHT_RANK));
|
||||
for(Integer gid:guildIds){
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, gid.toString(), true);
|
||||
if(!redisUtil.getZset(key,0, redisUtil.getZsetSize(RedisKey.FAMILY_FIGHT_RANK)).contains(gid)){
|
||||
redisUtil.zsetAddOne(RedisKey.FAMILY_FIGHT_RANK,gid.toString(),100);
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||
if(!rank.contains(gid.toString())){
|
||||
if(guildInfo.getDefendInfo()!=null&&guildInfo.getDefendInfo().size()>0){
|
||||
redisUtil.zsetAddOne(RedisKey.FAMILY_FIGHT_RANK,gid.toString(),100);
|
||||
}
|
||||
}
|
||||
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||
if(defendInfo==null||defendInfo.size()<1){
|
||||
continue;
|
||||
|
@ -958,6 +961,9 @@ public class GuildLogic {
|
|||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT,String.valueOf(guildInfo.getId()),String.valueOf(entry.getKey()),fightInfo);
|
||||
}
|
||||
}
|
||||
// redisUtil.getZset(key,0, redisUtil.getZsetSize(RedisKey.FAMILY_FIGHT_RANK));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -995,7 +1001,6 @@ public class GuildLogic {
|
|||
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(userDefend,1))
|
||||
.build();
|
||||
CommonProto.FightTeamInfo fightAttackTeamInfo = BehaviorUtil.getFightTeamInfo(userAttack, 502, true);
|
||||
|
||||
LuaValue getFightData = FightDataUtil.getFinalPlayerFightData(fightAttackTeamInfo, fightDefendTeamInfo);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||
|
||||
|
|
|
@ -208,6 +208,21 @@ public class ItemUtil {
|
|||
return getReward(itemMap,cardMap,equipMap,randomMap);
|
||||
}
|
||||
|
||||
|
||||
//指定道具掉落(如:邮件,初始化物品)
|
||||
public static String getMailReward (List<int[][]> itemArrs) throws Exception {
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||
Map<Integer,Integer> equipMap = new HashMap<>();
|
||||
Map<Integer,Integer> randomMap = new HashMap<>();
|
||||
for(int[][] itemArr : itemArrs){
|
||||
selectItemArr(itemArr,cardMap,itemMap,equipMap,randomMap);
|
||||
}
|
||||
return getReward(itemMap,cardMap,equipMap,randomMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void combineReward(User user,int[] dropGroupIds,float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap){
|
||||
combineRewardDropGroup(user, dropGroupIds, dropRatio, itemMap, cardMap, equipMap, randomMap);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue