Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
f6e9d89873
|
@ -0,0 +1,49 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ActivityRewardPool")
|
||||
public class SActivityRewardPool implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int poolId;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int initializeWeight;
|
||||
|
||||
private int extractWeight;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPoolId() {
|
||||
return poolId;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int getInitializeWeight() {
|
||||
return initializeWeight;
|
||||
}
|
||||
|
||||
public int getExtractWeight() {
|
||||
return extractWeight;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="BlessingConfig")
|
||||
public class SBlessingConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int[][] cost;
|
||||
|
||||
private int dailyRefreshTimes;
|
||||
|
||||
private int randomPoolId;
|
||||
|
||||
private int randomNum;
|
||||
|
||||
private int legendPoolId;
|
||||
|
||||
private int legendNum;
|
||||
|
||||
private int legendChooseNum;
|
||||
|
||||
private int supremePoolId;
|
||||
|
||||
private int supremeNum;
|
||||
|
||||
private int supremePoolIdChooseNum;
|
||||
|
||||
private int[] counts;
|
||||
|
||||
private int[] copuntsPoolId;
|
||||
|
||||
private int countsNum;
|
||||
|
||||
public static SBlessingConfig sBlessingConfig;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sBlessingConfig = STableManager.getConfig(SBlessingConfig.class).get(1);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int[][] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getDailyRefreshTimes() {
|
||||
return dailyRefreshTimes;
|
||||
}
|
||||
|
||||
public int getRandomPoolId() {
|
||||
return randomPoolId;
|
||||
}
|
||||
|
||||
public int getRandomNum() {
|
||||
return randomNum;
|
||||
}
|
||||
|
||||
public int getLegendPoolId() {
|
||||
return legendPoolId;
|
||||
}
|
||||
|
||||
public int getLegendNum() {
|
||||
return legendNum;
|
||||
}
|
||||
|
||||
public int getLegendChooseNum() {
|
||||
return legendChooseNum;
|
||||
}
|
||||
|
||||
public int getSupremePoolId() {
|
||||
return supremePoolId;
|
||||
}
|
||||
|
||||
public int getSupremeNum() {
|
||||
return supremeNum;
|
||||
}
|
||||
|
||||
public int getSupremePoolIdChooseNum() {
|
||||
return supremePoolIdChooseNum;
|
||||
}
|
||||
|
||||
public int[] getCounts() {
|
||||
return counts;
|
||||
}
|
||||
|
||||
public int[] getCopuntsPoolId() {
|
||||
return copuntsPoolId;
|
||||
}
|
||||
|
||||
public int getCountsNum() {
|
||||
return countsNum;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="BlessingRewardPool")
|
||||
public class SBlessingRewardPool implements BaseConfig {
|
||||
|
||||
public static Map<Integer,SBlessingRewardPool> sBlessingRewardPoolMap;
|
||||
|
||||
private int id;
|
||||
|
||||
private int poolId;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int initializeWeight;
|
||||
|
||||
private int extractWeight;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sBlessingRewardPoolMap = STableManager.getConfig(SBlessingRewardPool.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPoolId() {
|
||||
return poolId;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int getInitializeWeight() {
|
||||
return initializeWeight;
|
||||
}
|
||||
|
||||
public int getExtractWeight() {
|
||||
return extractWeight;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="CommercialActivityConfig")
|
||||
public class SCommercialActivityConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[] refreshType;
|
||||
|
||||
private int ifManualRefresh;
|
||||
|
||||
private int[][] refreshItem;
|
||||
|
||||
private int dailyRefreshTimes;
|
||||
|
||||
private int storeOpenRule;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getRefreshType() {
|
||||
return refreshType;
|
||||
}
|
||||
|
||||
public int getIfManualRefresh() {
|
||||
return ifManualRefresh;
|
||||
}
|
||||
|
||||
public int[][] getRefreshItem() {
|
||||
return refreshItem;
|
||||
}
|
||||
|
||||
public int getDailyRefreshTimes() {
|
||||
return dailyRefreshTimes;
|
||||
}
|
||||
|
||||
public int getStoreOpenRule() {
|
||||
return storeOpenRule;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TreasureConfig")
|
||||
public class STreasureConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int type;
|
||||
|
||||
private int points;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int[][] treasureReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[][] getTreasureReward() {
|
||||
return treasureReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TreasureTaskConfig")
|
||||
public class STreasureTaskConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int taskType;
|
||||
|
||||
private int[] taskValue;
|
||||
|
||||
private int points;
|
||||
|
||||
private int times;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public int[] getTaskValue() {
|
||||
return taskValue;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public int getTimes() {
|
||||
return times;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.config;
|
|||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Table(name = "TrialSetting")
|
||||
public class STrialSetting implements BaseConfig{
|
||||
|
||||
|
@ -10,7 +12,14 @@ public class STrialSetting implements BaseConfig{
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sTrialSetting = STableManager.getConfig(STrialSetting.class).get(1);
|
||||
STrialSetting sTrialSettingTmp = STableManager.getConfig(STrialSetting.class).get(1);
|
||||
int[] privilegeReward = sTrialSettingTmp.getPrivilegeReward();
|
||||
int temp = privilegeReward[0];
|
||||
privilegeReward[0] = privilegeReward[privilegeReward.length-1];
|
||||
privilegeReward[privilegeReward.length-1] = temp;
|
||||
int[] tempArray = Arrays.copyOf(privilegeReward, privilegeReward.length - 1);
|
||||
sTrialSettingTmp.setBombReward(tempArray);
|
||||
sTrialSetting = sTrialSettingTmp;
|
||||
}
|
||||
|
||||
private int id;
|
||||
|
@ -35,6 +44,8 @@ public class STrialSetting implements BaseConfig{
|
|||
private int limitTime;
|
||||
|
||||
private int[] privilegeReward;
|
||||
|
||||
private int[] bombReward;
|
||||
|
||||
|
||||
public int getId() {
|
||||
|
@ -60,4 +71,12 @@ public class STrialSetting implements BaseConfig{
|
|||
public int[] getPrivilegeReward() {
|
||||
return privilegeReward;
|
||||
}
|
||||
|
||||
public int[] getBombReward() {
|
||||
return bombReward;
|
||||
}
|
||||
|
||||
public void setBombReward(int[] bombReward) {
|
||||
this.bombReward = bombReward;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public interface GlobalItemType {
|
|||
int MINERAL=8; // 矿石
|
||||
int RINGTYPE=9; // 矿石
|
||||
int SecretBox=10; // 宝箱
|
||||
int HEAD_FRAME = 11;//头像框
|
||||
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
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;
|
||||
|
||||
@Component
|
||||
public class ServerZeroHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.SERVER_ZERO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
}
|
||||
}
|
|
@ -14,17 +14,14 @@ import com.ljsd.jieling.handler.mission.Mission;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.*;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -162,6 +159,12 @@ public class MapLogic {
|
|||
//todo 更新地圖次數
|
||||
mapManager.setCurMapId(mapId);
|
||||
if (type == 2) {
|
||||
STrialSetting sTrialSetting = STrialSetting.sTrialSetting;
|
||||
int[] privilegeReward = sTrialSetting.getPrivilegeReward();
|
||||
if(user.getPlayerInfoManager().checkFunctionIsAllowed(privilegeReward[privilegeReward.length-1])){
|
||||
ItemUtil.drop(user,sTrialSetting.getBombReward(),1.0f,1,BIReason.MONTH_CARD_REWARD);
|
||||
}
|
||||
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.COPY_TOWER_TIMES,1);
|
||||
initTrialMap(mapManager, user);
|
||||
} else {
|
||||
|
@ -234,6 +237,7 @@ public class MapLogic {
|
|||
mapEnterResponse.addHeroInfos(heroInfo);
|
||||
}
|
||||
LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
||||
LOGGER.info("进图临时背包{}",mapEnterResponse.getTemporaryItems().toString());
|
||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||
}
|
||||
|
||||
|
@ -926,6 +930,7 @@ public class MapLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
CombatLogic.elementEffect(user);
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||
|
@ -1584,7 +1589,7 @@ public class MapLogic {
|
|||
hasBoss = MathUtils.randomFromWeight(sChallengeConfig.getSweepingMonsterProbability());
|
||||
if(hasBoss==1){
|
||||
mapManager.findSuddenlyBoss(sChallengeConfig.getSweepingMonsterId(), now);
|
||||
mapSweepResponse.setCloudStore(hasBoss);
|
||||
mapManager.setFindSuddenlyBossMapId(mapId);
|
||||
mapSweepResponse.setSuddenlyBossInfo(CommonProto.SuddenlyBossInfo.newBuilder().setSuddBossId(mapManager.getSuddenlyBoss()).setEndTime(mapManager.getSuddenlyBossEndTime()).setFindMapId(mapManager.getFindSuddenlyBossMapId()).build());
|
||||
break;
|
||||
}
|
||||
|
@ -2342,10 +2347,11 @@ public class MapLogic {
|
|||
* @param iSession
|
||||
* @param messageType
|
||||
*/
|
||||
public void towerReset(ISession iSession, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void towerReset(ISession iSession,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
StoreManager storeManager = user.getStoreManager();
|
||||
if(mapManager.getMapIntoFlag()==0){
|
||||
MessageUtil.sendErrorResponse(iSession,0,messageType.getNumber(),"重置错误");
|
||||
|
@ -2358,19 +2364,7 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
playerInfoManager.updateVipPrivilage(VipPrivilegeType.TOWER_RESRT_NUM,1);
|
||||
// if(mapManager.getHighestTower()==0){
|
||||
// MessageUtil.sendErrorResponse(iSession,0,messageType.getNumber(),"最高层数为0,无需重置。");
|
||||
// return;
|
||||
// }
|
||||
int afterResetTower = mapManager.getHighestTower()-(mapManager.getHighestTower()%5);
|
||||
LOGGER.info("重置当前层,当前层为{},重置为{}",mapManager.getTower(),afterResetTower);
|
||||
if(mapManager.getHighestTower()==0){
|
||||
mapManager.setTower(1);
|
||||
} else if(mapManager.getHighestTower()>=5){
|
||||
mapManager.setTower(afterResetTower);
|
||||
}else{
|
||||
mapManager.setTower(1);
|
||||
}
|
||||
mapManager.setTower(MathUtils.resetMethod(mapManager.getHighestTower()));
|
||||
mapManager.setFightCount(0);
|
||||
mapManager.setEssenceValue(0);
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
|
@ -2389,6 +2383,24 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapTowerResetResponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5点自动重置
|
||||
* @param session
|
||||
*/
|
||||
public void towerAutoReset(ISession session, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
//5点自动重置
|
||||
if(mapManager.getCurMapId()==0||SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()!=2){
|
||||
int afterResetTower = MathUtils.resetMethod(mapManager.getHighestTower());
|
||||
mapManager.setTower(afterResetTower);
|
||||
}
|
||||
mapManager.setMapIntoFlag(0);
|
||||
CommonProto.fiveResetTowerInfo resetTowerInfo = CommonProto.fiveResetTowerInfo.newBuilder().setTower(user.getMapManager().getTower()).setIntoType(user.getMapManager().getMapIntoFlag()).build();
|
||||
if(fBuilder!=null){
|
||||
fBuilder.setFiveResetTowerInfo(resetTowerInfo);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 爬塔使用Buff
|
||||
* @param session
|
||||
|
|
|
@ -419,13 +419,21 @@ public class MapManager extends MongoBase {
|
|||
if(findsuddenlyBossTime!=0){
|
||||
findsuddenlyBossTime+=SGameSetting.getGameSetting().getIncidentalBossSave();
|
||||
this.findSuddenlyBossMapId = curMapId;
|
||||
updateString("findSuddenlyBossMapId" , findSuddenlyBossMapId);
|
||||
if(findSuddenlyBossMapId != 0){
|
||||
updateString("findSuddenlyBossMapId" , findSuddenlyBossMapId);
|
||||
}
|
||||
|
||||
}
|
||||
this.suddenlyBossEndTime = findsuddenlyBossTime;
|
||||
updateString("suddenlyBoss" , suddenlyBoss);
|
||||
updateString("suddenlyBossEndTime" , suddenlyBossEndTime);
|
||||
}
|
||||
|
||||
public void setFindSuddenlyBossMapId(int findSuddenlyBossMapId) {
|
||||
this.findSuddenlyBossMapId = findSuddenlyBossMapId;
|
||||
updateString("findSuddenlyBossMapId" , findSuddenlyBossMapId);
|
||||
}
|
||||
|
||||
public void checkSuddenlyBoss(){
|
||||
int now = (int)(TimeUtils.now()/1000);
|
||||
if(now>suddenlyBossEndTime){
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.ljsd.jieling.core.FunctionIdEnum;
|
|||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
|
@ -246,6 +247,7 @@ public class GlobalDataManaager {
|
|||
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
FriendLogic.getInstance().refreshState(session);
|
||||
MapLogic.getInstance().towerAutoReset(session,fBuilder);
|
||||
if(fBuilder!=null){
|
||||
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
|
||||
Map<Integer, SDailyTasksConfig> config = SDailyTasksConfig.config;
|
||||
|
@ -264,14 +266,23 @@ public class GlobalDataManaager {
|
|||
}
|
||||
}
|
||||
|
||||
public static void everFiveTask(){
|
||||
public static void everTask(int hour){
|
||||
Map<Integer, ISession> sessionMap = OnlineUserManager.sessionMap;
|
||||
int number = 0;
|
||||
switch (hour){
|
||||
case 0:
|
||||
number = MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE;
|
||||
break;
|
||||
case 5:
|
||||
number = MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE;
|
||||
break;
|
||||
}
|
||||
for(ISession session : sessionMap.values()){
|
||||
int uid = session.getUid();
|
||||
if(uid == 0){
|
||||
continue;
|
||||
}
|
||||
PacketNetData packetNetData = new PacketNetData(makeFinalMessage(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE,session));
|
||||
PacketNetData packetNetData = new PacketNetData(makeFinalMessage(number,session));
|
||||
ProtocolsManager.getInstance().addEntry(packetNetData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,4 +460,42 @@ public class ActivityLogic {
|
|||
}
|
||||
secretBoxSeasonTimes=0;
|
||||
}
|
||||
//云梦祈福
|
||||
public void blessActivityInit(User user){
|
||||
//第一次9种
|
||||
int fixRewardPool = SBlessingConfig.sBlessingConfig.getRandomPoolId();
|
||||
int fixRewardNum = SBlessingConfig.sBlessingConfig.getRandomNum();
|
||||
List<int[]> fixRewardArray = new ArrayList<>();
|
||||
Map<Integer,SBlessingRewardPool> rewardPoolMap = SBlessingRewardPool.sBlessingRewardPoolMap;
|
||||
//第二次6,6种
|
||||
int legendPool = SBlessingConfig.sBlessingConfig.getLegendPoolId();
|
||||
int legendNum = SBlessingConfig.sBlessingConfig.getLegendNum();
|
||||
List<int[]> legendRewardArray = new ArrayList<>();
|
||||
|
||||
int supremePool = SBlessingConfig.sBlessingConfig.getSupremePoolId();
|
||||
int supremeNum = SBlessingConfig.sBlessingConfig.getSupremeNum();
|
||||
List<int[]> supremeRewardArray = new ArrayList<>();
|
||||
|
||||
for(Map.Entry<Integer,SBlessingRewardPool> entry:rewardPoolMap.entrySet()){
|
||||
if(entry.getValue().getPoolId()==fixRewardPool){
|
||||
fixRewardArray.add(new int[]{entry.getValue().getId(),entry.getValue().getInitializeWeight()});
|
||||
}else if(entry.getValue().getPoolId()==legendPool){
|
||||
legendRewardArray.add(new int[]{entry.getValue().getId(),entry.getValue().getInitializeWeight()});
|
||||
}else if(entry.getValue().getPoolId()==supremePool){
|
||||
supremeRewardArray.add(new int[]{entry.getValue().getId(),entry.getValue().getInitializeWeight()});
|
||||
}
|
||||
}
|
||||
|
||||
int[] fixResult = MathUtils.randomFromWeightWithTaking((int[][])fixRewardArray.toArray(), fixRewardNum);
|
||||
int[] legendResult = MathUtils.randomFromWeightWithTaking((int[][])legendRewardArray.toArray(), legendNum);
|
||||
int[] supremeResult = MathUtils.randomFromWeightWithTaking((int[][])supremeRewardArray.toArray(), supremeNum);
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
activityManager.initAllActivityMission(SBlessingConfig.sBlessingConfig.getActivityId());
|
||||
// ActivityMission activityMission = activityManager.getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
||||
// Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.common.mogodb.MongoBase;
|
|||
import com.ljsd.jieling.db.mongo.MongoKey;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -12,6 +13,8 @@ public class TeamPosManager extends MongoBase {
|
|||
private Map<Integer, List<TeamPosHeroInfo>> teamPosForHero;
|
||||
private Map<Integer,String> teamNames;
|
||||
private Map<Integer,List<TeamPosForPokenInfo>> teamPosForPoken;
|
||||
@Transient
|
||||
private Map<Integer,Set<Integer>> teamIdExtraAddMap = new HashMap<>(5);
|
||||
|
||||
public TeamPosManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
|
|
@ -267,9 +267,10 @@ public class PlayerLogic {
|
|||
}
|
||||
|
||||
public void modifyHeadFrame(ISession session, int frameId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("头像框id{}",frameId);
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
if(itemManager.getItem(frameId).getItemNum()<1){
|
||||
if(itemManager.getItem(frameId)==null||itemManager.getItem(frameId).getItemNum()<1){
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"无此头像框");
|
||||
}
|
||||
user.getPlayerInfoManager().setHeadFrame(frameId);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.ljsd.jieling.logic.reward;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RewardLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RewardLogic.class);
|
||||
|
||||
private RewardLogic(){}
|
||||
|
||||
}
|
|
@ -75,6 +75,7 @@ public class MinuteTask extends Thread {
|
|||
if(hour == 0 && minute ==0){
|
||||
LOGGER.info("DailyOfZeroTask start ...");
|
||||
ArenaLogic.getInstance().sendReward(GlobalsDef.ARENA_DAILY_REWARD);
|
||||
GlobalDataManaager.everTask(0);
|
||||
LOGGER.info("DailyOfZeroTask end ...");
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +88,7 @@ public class MinuteTask extends Thread {
|
|||
int minute = calendar.get(Calendar.MINUTE);
|
||||
if(hour == 5 && minute ==0){
|
||||
LOGGER.info("DailyOfFiveTask start ...");
|
||||
GlobalDataManaager.everFiveTask();
|
||||
GlobalDataManaager.everTask(5);
|
||||
LOGGER.info("DailyOfFiveTask end ...");
|
||||
}
|
||||
}
|
||||
|
@ -106,4 +107,5 @@ public class MinuteTask extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public class CBean2Proto {
|
|||
.setIsFirstRecharge(rechargeInfo.getIsFirst())
|
||||
.setIsMatchRoom(roomInfo.isMatching()?1:0)
|
||||
.setCurRoomType(roomInfo.getRoomId()==-1?0:1)
|
||||
.setHeadFrame(playerManager.getHeadFrame())
|
||||
.build();
|
||||
return player;
|
||||
}
|
||||
|
|
|
@ -377,14 +377,15 @@ public class ItemUtil {
|
|||
case GlobalItemType.BLUE_IMAGE:
|
||||
case GlobalItemType.RINGTYPE:
|
||||
case GlobalItemType.MINERAL:
|
||||
case GlobalItemType.HEAD_FRAME:
|
||||
case GlobalItemType.SecretBox:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
case GlobalItemType.RANDOM_ITME:
|
||||
if (!sItem.isIsopen()){
|
||||
if (!sItem.isIsopen()){
|
||||
itemType = GlobalItemType.ITEM;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@ public class MathUtils {
|
|||
|
||||
|
||||
public static void main(String [] args){
|
||||
for (int i = 0 ; i <100;i++){
|
||||
System.out.println(randomFromArray(new int[]{100}));
|
||||
}
|
||||
|
||||
}
|
||||
public static int randomForStrArray(String [] rateArray) {
|
||||
return randomStrArray(rateArray, -1);
|
||||
|
@ -145,7 +143,7 @@ public class MathUtils {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
public static int randomFromWeight(int[][] array){
|
||||
public static int randomFromWeightReturnIndex(int[][] array){
|
||||
int amount = 0;
|
||||
int result = 0;
|
||||
for(int i = 0 ; i <array.length;i++){
|
||||
|
@ -157,7 +155,7 @@ public class MathUtils {
|
|||
for (int i = 0 ; i<array.length;i++){
|
||||
amount+=array[i][1];
|
||||
if(rate<amount){
|
||||
result = array[i][0];
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,4 +200,50 @@ public class MathUtils {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
public static int randomFromWeight(int[][] array){
|
||||
int index = randomFromWeightReturnIndex(array);
|
||||
return array[index][0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据权重,不放回随机
|
||||
* @param array
|
||||
* @param count 随机个数
|
||||
* @return
|
||||
*/
|
||||
public static int[] randomFromWeightWithTaking(int[][] array,int count){
|
||||
int[] result = new int[count];
|
||||
int[][] tempArray = new int[array.length][];
|
||||
for(int i = 0 ; i <array.length;i++){
|
||||
tempArray[i] = array[i];
|
||||
}
|
||||
for(int i = 0; i < count; i++){
|
||||
int index = randomFromWeightReturnIndex(tempArray);
|
||||
result[i] = array[index][0];
|
||||
tempArray[index] = tempArray[array.length-1];
|
||||
tempArray = Arrays.copyOf(array,array.length-1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据层数重置
|
||||
* @param tower
|
||||
* @return
|
||||
*/
|
||||
public static int resetMethod(int tower){
|
||||
int afterResetTower = tower-(tower%5);
|
||||
// LOGGER.info("重置当前层,当前层为{},重置为{}",mapManager.getTower(),afterResetTower);
|
||||
if(tower==0){
|
||||
return 1;
|
||||
} else if(tower>=5){
|
||||
return afterResetTower;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue