Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
9a1c002c4b
|
@ -95,7 +95,7 @@ public class SGlobalActivity implements BaseConfig {
|
|||
long serverOpenTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
startTime = serverOpenTime + baseTime*1000;
|
||||
}else if(time == ActivityType.OPEN_TYPE_ROLE){
|
||||
startTime =createUserTime+baseTime*1000;
|
||||
startTime = TimeUtils.getAppointTimeInXDay(createUserTime,0) + baseTime*1000;
|
||||
}
|
||||
return startTime;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
long serverOpenTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
startTime = serverOpenTime + baseTime*1000;
|
||||
}else if(time == ActivityType.OPEN_TYPE_ROLE){
|
||||
startTime =createUserTime+baseTime*1000;
|
||||
startTime = TimeUtils.getAppointTimeInXDay(createUserTime,0)+baseTime*1000;
|
||||
}
|
||||
return startTime;
|
||||
}
|
||||
|
|
|
@ -97,70 +97,90 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
* 重写此类 记得重写onActivityEndOnMySelf 否者活动结束走默认配置表发邮件奖
|
||||
*/
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int id) throws Exception {
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
//check cfg
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
|
||||
if (sActivityRewardConfig == null || sActivityRewardConfig.getActivityId() != id) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "");
|
||||
return false;
|
||||
}
|
||||
//check state
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "activity_close");
|
||||
return false;
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "had taked");
|
||||
return false;
|
||||
}
|
||||
//take rewards check
|
||||
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
|
||||
return false;
|
||||
}
|
||||
//up miss
|
||||
int[][] reward = sActivityRewardConfig.getReward();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
checkAndSetProgress(activityMission, activityProgressInfo, sActivityRewardConfig, missionId);
|
||||
//send
|
||||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void takeAllReward(ISession session) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
List<Integer> misssIds = new LinkedList<>();
|
||||
|
||||
if (id == -1) {
|
||||
List<SActivityRewardConfig> cfgs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
if (null == cfgs) {
|
||||
return false;
|
||||
}
|
||||
for (SActivityRewardConfig sActivityRewardConfig : cfgs) {
|
||||
misssIds.add(sActivityRewardConfig.getId());
|
||||
}
|
||||
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) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "");
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
//check state
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "activity_close");
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "had taked");
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
//take rewards check
|
||||
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
//up miss
|
||||
int[][] reward = sActivityRewardConfig.getReward();
|
||||
if (id == -1) {
|
||||
itemArrs.add(reward);
|
||||
continue;
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
checkAndSetProgress(activityMission, activityProgressInfo, sActivityRewardConfig, missionId);
|
||||
//send
|
||||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
return true;
|
||||
itemArrs.add(reward);
|
||||
}
|
||||
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title",new Object[]{sGlobalActivity.getSesc()});
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
||||
void checkAndSetProgress(ActivityMission activityMission, ActivityProgressInfo activityProgressInfo, SActivityRewardConfig sActivityRewardConfig, int missionId) {
|
||||
|
@ -213,14 +233,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user) throws Exception {
|
||||
List<SActivityRewardConfig> cfgs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||
if (null == cfgs) {
|
||||
return;
|
||||
}
|
||||
for (SActivityRewardConfig sActivityRewardConfig : cfgs) {
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
takeReward(sessionByUid, sActivityRewardConfig.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,7 +241,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
takeReward(sessionByUid, -1);
|
||||
takeAllReward(sessionByUid);
|
||||
}
|
||||
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.ljsd.jieling.logic.activity;
|
|||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -19,10 +18,10 @@ class DailyRechargeActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
super.onResume(user);
|
||||
//每日充值 补发前日未领取的奖
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
takeReward(sessionByUid, -1);
|
||||
takeAllReward(sessionByUid);
|
||||
super.onResume(user);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class GuildMyInfo extends MongoBase {
|
||||
private static int speed = 500;
|
||||
private static int speed = 200;
|
||||
private static int initPos = 0;
|
||||
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ public class GuildLogic {
|
|||
for(Set<Integer> members : guildInfo.getMembers().values()){
|
||||
for(int uidOfMember : members){
|
||||
User userMember = UserManager.getUser(uidOfMember);
|
||||
userMember.getGuildMyInfo().move(System.currentTimeMillis());
|
||||
builder.addFamilyWalkIndicaiton(CBean2Proto.getFamilyWalkIndicaiton(userMember));
|
||||
}
|
||||
}
|
||||
|
@ -231,6 +232,7 @@ public class GuildLogic {
|
|||
addGuildLog(guildInfo.getId(),GuildDef.Log.JOIN,user.getPlayerInfoManager().getNickName());
|
||||
Family.FamilyJoinIndicaion build = Family.FamilyJoinIndicaion.newBuilder().setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo)).setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, GlobalsDef.MEMBER)).build();
|
||||
Family.FamilyJoinResponse response = Family.FamilyJoinResponse.newBuilder().setFamilyJoinIndicaion(build).build();
|
||||
|
||||
MessageUtil.sendMessage(session,1,msgId,response,true);
|
||||
}
|
||||
|
||||
|
@ -400,6 +402,8 @@ public class GuildLogic {
|
|||
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
GuilidManager.removeMineApplyGuildInfos(guildInfo.getId(),applyId);
|
||||
GuilidManager.removeOneApplyGuildInfos(guildInfo.getId(),applyId);
|
||||
Family.FamilyWalkIndicaiton familyWalkIndicaiton = CBean2Proto.getFamilyWalkIndicaiton(targetUser);
|
||||
sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.FAMILY_WALK_INDICATION,familyWalkIndicaiton);
|
||||
}catch (Exception e){
|
||||
LOGGER.error("the exception={}",e);
|
||||
}finally {
|
||||
|
@ -703,16 +707,21 @@ public class GuildLogic {
|
|||
return;
|
||||
}
|
||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||
LOGGER.info("cur ={},path={}",guildMyInfo.getCurPos(),path);
|
||||
|
||||
|
||||
user.getGuildMyInfo().move(System.currentTimeMillis());
|
||||
LOGGER.info("old ={},path={}",guildMyInfo.getCurPos(),path);
|
||||
boolean continuous = CellUtil.isContinuous(guildMyInfo.getCurPos(),path);
|
||||
if(!continuous){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"路线有误");
|
||||
return;
|
||||
}
|
||||
user.getGuildMyInfo().move(path);
|
||||
LOGGER.info("cur ={},path={}",guildMyInfo.getCurPos(),path);
|
||||
Family.FamilyWalkIndicaiton familyWalkIndicaiton = CBean2Proto.getFamilyWalkIndicaiton(user);
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.FAMILY_WALK_INDICATION,familyWalkIndicaiton);
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
public static void updateMyPos(User user) {
|
||||
|
|
|
@ -948,12 +948,12 @@ public class HeroLogic {
|
|||
Equip equip = equipManager.getEquipMap().get(equipId);
|
||||
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
||||
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
||||
LOGGER.info("cal equip = {}",equip.getEquipId());
|
||||
// LOGGER.info("cal equip = {}",equip.getEquipId());
|
||||
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
||||
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equip.getEquipId());
|
||||
equipForce+=sEquipConfig.getScore();
|
||||
LOGGER.info("cal equip = {} end",equip.getEquipId());
|
||||
// LOGGER.info("cal equip = {} end",equip.getEquipId());
|
||||
}
|
||||
//天赋异妖加成
|
||||
Map<Integer, Pokemon> ringFireMap = pokemonManager.getRingFireMap();
|
||||
|
@ -1015,7 +1015,7 @@ public class HeroLogic {
|
|||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
||||
//装备战力保存
|
||||
heroAllAttribute.put(HeroAttributeEnum.EquipForce.getPropertyId(),equipForce);
|
||||
LOGGER.info("cal herotid = {},end",hero.getTemplateId());
|
||||
// LOGGER.info("cal herotid = {},end",hero.getTemplateId());
|
||||
return heroAllAttribute;
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ public class HeroLogic {
|
|||
Integer propertyId = item.getKey();
|
||||
float propertyValue = item.getValue();
|
||||
if(propertyId == HeroAttributeEnum.EquipForce.getPropertyId()){
|
||||
LOGGER.info("the equipScore={}",propertyValue);
|
||||
// LOGGER.info("the equipScore={}",propertyValue);
|
||||
continue;
|
||||
}
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
|
||||
|
|
Loading…
Reference in New Issue