master_ob2
PC-202302260912\Administrator 2023-08-04 13:42:11 +08:00
parent 6eb47c0a72
commit 3915f25665
4 changed files with 46 additions and 185 deletions

View File

@ -17,8 +17,6 @@ public class BlessInfoHandler extends BaseHandler {
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
///
ActivityLogic.getInstance().blessInfo(iSession,MessageTypeProto.MessageType.BLESS_INFO_RESPONSE);
}
}

View File

@ -129,7 +129,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
*
*/
// private void webPayHandlerLogin(User user){
@ -162,7 +161,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @throws Exception
*/
public void checkActiviyStatus() throws Exception {
long now = System.currentTimeMillis();
@ -298,8 +296,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param activityMission
* @param activityId
*/
public void initMissionInfo(ActivityMission activityMission,int activityId){
if(activityId == ActivityType.DAILY_PREFERENTIAL_GIFT){
@ -337,15 +333,11 @@ public class ActivityLogic implements IEventHandler{
return activityManager.getDialRewardInfo().getOrDefault(activityId,new LuckWheelMission());
}
public void initLuckWheel(ActivityManager activityManager,int activityId) {
}
// public void initLuckWheel(ActivityManager activityManager,int activityId) {
// }
/**
*
* @param user
* @param builder
* @return
* @throws Exception
*/
public Set<Integer> checkActivityOfUser(User user, PlayerInfoProto.ActivityUpateIndication.Builder builder) throws Exception {
long now = TimeUtils.now();
@ -441,7 +433,7 @@ public class ActivityLogic implements IEventHandler{
}
if (openActivityIds.contains(activityId)) {
int[] ifOpen = sGlobalActivity.getIfOpen();
if (ifOpen == null || ifOpen.length <= 0){
if (ifOpen == null || ifOpen.length == 0){
continue;
}
if (ifOpen[0]!=1){
@ -556,9 +548,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param activityMissionMap
* @param createTime
* @return
*/
public List<CommonProto.ActivityInfo> getActivityInfos(User user,Map<Integer, ActivityMission> activityMissionMap, long createTime) {
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
@ -620,8 +609,7 @@ public class ActivityLogic implements IEventHandler{
if (sGlobalActivity.getIsSaving()==0 && activityStatus != ActivityType.OPEN_STATE) {
continue;
}
int startTime = 0;
int endTime = 0;
int startTime,endTime;
if(sGlobalActivity.getType() == ActivityType.DAILY_PREFERENTIAL_GIFT){
startTime=(int)(activityState.getValue().getCreatTime()/1000);
endTime = startTime+604800;
@ -681,20 +669,20 @@ public class ActivityLogic implements IEventHandler{
}
public void openActivityReallyOpen(User user, int activityType) {
ActivityManager activityManager = user.getActivityManager();
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
for (Map.Entry<Integer, ActivityMission> item : activityMissionMap.entrySet()) {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(item.getKey());
int targetActivityType = sGlobalActivity.getType();
if (targetActivityType == activityType) {
ActivityMission value = item.getValue();
if (value.getOpenType() == 0) {
value.setOpenType(1);
}
}
}
}
// public void openActivityReallyOpen(User user, int activityType) {
// ActivityManager activityManager = user.getActivityManager();
// Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
// for (Map.Entry<Integer, ActivityMission> item : activityMissionMap.entrySet()) {
// SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(item.getKey());
// int targetActivityType = sGlobalActivity.getType();
// if (targetActivityType == activityType) {
// ActivityMission value = item.getValue();
// if (value.getOpenType() == 0) {
// value.setOpenType(1);
// }
// }
// }
// }
public int getActivityOpenState(User user,int activityId){
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
@ -846,12 +834,8 @@ public class ActivityLogic implements IEventHandler{
public int getInitActivityMissionProgress(int activityId) {
int defalutProgress = 0;
switch (activityId) {
case ActivityType.SevenLogin:
defalutProgress = 1;
break;
default:
break;
if (activityId == ActivityType.SevenLogin) {
defalutProgress = 1;
}
return defalutProgress;
}
@ -991,13 +975,9 @@ public class ActivityLogic implements IEventHandler{
// }
return 0;
}
/**
*
*
* @param session
* @param locationId
* @param messageType
* @throws Exception
*/
public void blessChoose(ISession session, int locationId, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -1029,8 +1009,8 @@ public class ActivityLogic implements IEventHandler{
index++;
}
int[] order = MathUtils.randomFromWeightWithTaking(result, BlessInfoConfig.START_CAPACITY);
for (int i = 0; i < order.length; i++) {
LOGGER.info("获取顺序{}", order[i]);
for (int j : order) {
LOGGER.info("获取顺序{}", j);
}
index = 0;
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
@ -1141,7 +1121,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addCountReward(blessReward);
continue;
} else if (entry.getKey() / BlessInfoConfig.SUPREME_REWARD_START_ID > 0) {
CommonProto.blessReward blessReward = CommonProto.blessReward.newBuilder()
.setLocationId(entry.getKey() % BlessInfoConfig.SUPREME_REWARD_START_ID + 1)
@ -1149,7 +1128,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addSupremeReward(blessReward);
continue;
} else if (entry.getKey() / BlessInfoConfig.LEGEND_REWARD_START_ID > 0) {
CommonProto.blessReward blessReward = CommonProto.blessReward.newBuilder()
.setLocationId(entry.getKey() % BlessInfoConfig.LEGEND_REWARD_START_ID + 1)
@ -1157,7 +1135,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addLegendReward(blessReward);
continue;
} else if (entry.getKey() <= BlessInfoConfig.START_CAPACITY) {
CommonProto.blessReward blessReward = CommonProto.blessReward.newBuilder()
.setLocationId(entry.getKey())
@ -1176,8 +1153,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addCountReward(blessReward);
continue;
} else if (entry.getKey() / BlessInfoConfig.SUPREME_REWARD_START_ID > 0) {
CommonProto.blessReward blessReward = CommonProto.blessReward.newBuilder()
.setLocationId(entry.getKey() % BlessInfoConfig.SUPREME_REWARD_START_ID + 1)
@ -1185,7 +1160,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addSupremeReward(blessReward);
continue;
} else if (entry.getKey() / BlessInfoConfig.LEGEND_REWARD_START_ID > 0) {
CommonProto.blessReward blessReward = CommonProto.blessReward.newBuilder()
.setLocationId(entry.getKey() % BlessInfoConfig.LEGEND_REWARD_START_ID + 1)
@ -1193,7 +1167,6 @@ public class ActivityLogic implements IEventHandler{
.setRewardId(entry.getValue().getProgrss())
.build();
response.addLegendReward(blessReward);
continue;
}
}
for (int i = BlessInfoConfig.CHOOSE_START_ID; i <= BlessInfoConfig.REWARD_VIEW_END_ID; i++) {
@ -1228,14 +1201,6 @@ public class ActivityLogic implements IEventHandler{
public void blessSaveOptionalReward(ISession session, int[] rewardIds, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
// for(Map.Entry<Integer,SBlessingConfig> entry:SBlessingConfig.blessingConfigMap.entrySet()){
//
// int activityOpenState = getActivityOpenState(user, entry.getKey());
// if(activityOpenState==ActivityType.OPEN_STATE){
// blessingConfig = entry.getValue();
// continue;
// }
// }
int blessActivityId = getBlessActivityId(user);
if(blessActivityId==0){
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
@ -1267,13 +1232,9 @@ public class ActivityLogic implements IEventHandler{
/**
*
*
* @param session
* @param messageType
* @throws Exception
*/
public void blessRefreshReward(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
public void blessRefreshReward(ISession session, MessageTypeProto.MessageType messageType) {
// User user = UserManager.getUser(session.getUid());
// ActivityMission activityMission = blessRefresh(user);
//
// Poster.getPoster().dispatchEvent(new BlessInfoRefreshEvent(session.getUid()));
@ -1282,7 +1243,7 @@ public class ActivityLogic implements IEventHandler{
//// activityMission.getActivityMissionMap().put(BlessInfoConfig.LAST_REFRESH_TIME, new ActivityProgressInfo((int) (TimeUtils.now() / 1000), 0));
// PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(activityMission).build()).build();
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), res, true);
Poster.getPoster().dispatchEvent(new BlessInfoRefreshEvent(session.getUid()));
// Poster.getPoster().dispatchEvent(new BlessInfoRefreshEvent(session.getUid()));
}
@ -1390,8 +1351,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param session
* @param messageType
*/
public void toBeStronger(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -1401,9 +1360,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param session
* @param messageType
* @throws Exception
*/
public void treasureBuyLevel(ISession session,int level,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -1411,12 +1367,8 @@ public class ActivityLogic implements IEventHandler{
if(level<=treasureLevel){
throw new ErrorCodeException(ErrorCode.newDefineCode("等级错误"));
}
int num = 0;
int num;
int[][] cost= SSpecialConfig.getTwiceArrayValue(SSpecialConfig.SUNLONG_COST);
//这段代码并没有实现每一级相同的购买价格???
/*for(int i = level;i>treasureLevel;i--){
num+=MathUtils.calABX(i,cost[1]);
}*/
num = (int)MathUtils.calABX(level - treasureLevel, cost[1]);
int[][] costItems = new int[1][];
int[] costTemp = {cost[0][0],num};
@ -1440,8 +1392,7 @@ public class ActivityLogic implements IEventHandler{
if(activities.isEmpty()){
return new HashSet<>();
}else{
Set<Integer> objects = activities.stream().filter(n -> user.getActivityManager().getActivityMissionMap().keySet().contains(n.getId())).map(sGlobalActivity -> sGlobalActivity.getId()).collect(Collectors.toSet());
return objects;
return activities.stream().map(SGlobalActivity::getId).filter(id -> user.getActivityManager().getActivityMissionMap().containsKey(id)).collect(Collectors.toSet());
}
}
public void getNextActivityId(ISession session, int activityId, MessageTypeProto.MessageType messageType) throws Exception {
@ -1483,7 +1434,7 @@ public class ActivityLogic implements IEventHandler{
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}
public void getJadeDynastyNextRefreshTime(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
public void getJadeDynastyNextRefreshTime(ISession session,MessageTypeProto.MessageType messageType) {
int dayRefreshTime=(int) (TimeUtils.getLastOrUnderHour(TimeUtils.now(), 0,0, false)/1000);
int weekRefreshTime = (int)(TimeUtils.getNextWeekendStartTime(1,0)/1000);
PlayerInfoProto.JadeDynastyRefreshTimeResponse response = PlayerInfoProto.JadeDynastyRefreshTimeResponse.newBuilder().setDayTime(dayRefreshTime).setWeekTime(weekRefreshTime).build();
@ -1514,9 +1465,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param session
* @param activityId
* @param chooseId
*/
public void chooseSpecialMonster(ISession session,int activityId,int chooseId) throws Exception {
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
@ -1546,10 +1494,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param session
* @param activityId
* @param heroTemId
* @throws Exception
*/
public void upStarActivitySelectHero(ISession session,int activityId,int heroTemId) throws Exception{
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
@ -1639,16 +1583,12 @@ public class ActivityLogic implements IEventHandler{
}
long[] result = new long[2];
result[0] = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createUserTime, 1);
result[1] = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createUserTime, 2);;
result[1] = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createUserTime, 2);
return result;
}
/**
*
* @param user
* @param activityId
* @param type
* @throws Exception
*/
public void choiceDrawCard(User user,int activityId,int type) throws Exception {
// 初始值
@ -1725,8 +1665,6 @@ public class ActivityLogic implements IEventHandler{
/**
* list
* @param markRewards
* @return
*/
public List<String> rewardArrayToList(int[][] markRewards){
List<String> result = new ArrayList<>(markRewards.length);
@ -1748,11 +1686,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
* @param activityId
* @param num
* @return
* @throws Exception
*
*/
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num,int[][] reward) throws Exception {
@ -1765,11 +1698,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
* @param activityId
* @param num
* @return
* @throws Exception
*/
private CommonProto.Drop.Builder getDrawRewardOne(User user,int activityId,int num,int[][] reward) throws Exception {
// 活动信息
@ -1821,11 +1749,6 @@ public class ActivityLogic implements IEventHandler{
/**
*
* @param user
* @param activityId
* @param num
* @return
* @throws Exception
*/
private CommonProto.Drop.Builder getDrawRewardTen(User user,int activityId,int num,int[][] reward) throws Exception {
// 活动信息

View File

@ -194,7 +194,7 @@ public abstract class LuckWheelActivity extends AbstractActivity {
@Override
public void onActivityEndOnMySelf(User user) {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
ActivityLogic.getInstance().initLuckWheel(user.getActivityManager(),sGlobalActivity.getId());
// ActivityLogic.getInstance().initLuckWheel(user.getActivityManager(),sGlobalActivity.getId());
}
@Override

View File

@ -63,10 +63,6 @@ public class ItemLogic {
/**
*
*
* @param iSession
* @param itemList
* @throws Exception
*/
public void priceItem(ISession iSession, List<CommonProto.Item> itemList) throws Exception {
int uid = iSession.getUid();
@ -110,12 +106,12 @@ public class ItemLogic {
private StringBuilder getStringBuilder(StringBuilder reward, int itemNum, int[] itemReward) {
for (int i = 0; i < itemNum; i++) {
for (int j = 0; j < itemReward.length; j++) {
for (int k : itemReward) {
if (reward.length() == 0) {
reward = new StringBuilder();
reward.append(itemReward[j]);
reward.append(k);
} else {
reward.append("#").append(itemReward[j]);
reward.append("#").append(k);
}
}
@ -144,9 +140,6 @@ public class ItemLogic {
/**
* 使
*
* @param iSession
* @param itemList
*/
public void useItem(ISession iSession, List<CommonProto.Item> itemList) throws Exception {
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
@ -202,10 +195,6 @@ public class ItemLogic {
/**
* bt使
* 使truefalse
* @param user
* @param type
* @param num
* @return
*/
private boolean checkGmRechargeCardMax(User user, int type, int num){
if (type != GlobalItemType.ONE_RMB_RECHARGE_CARD){
@ -251,9 +240,6 @@ public class ItemLogic {
/**
*
* @param iSession
* @param proto
* @throws Exception
*/
public void getAssignInIdleReward(ISession iSession, PlayerInfoProto.UseAndPriceItemRequest proto) throws Exception {
User user = UserManager.getUser(iSession.getUid());
@ -281,29 +267,25 @@ public class ItemLogic {
/**
* 使
* @param user
* @param itemDropTime
* @return
* @throws ErrorCodeException
*/
public long[][] useItemGetHookReward(User user, int[][] itemDropTime,long useNum)throws ErrorCodeException{
long[][]dropArr=new long[itemDropTime.length][2];
int index=0;
for (int i = 0; i < itemDropTime.length; i++) {
int itemId=itemDropTime[i][0];
int dropRatio=itemDropTime[i][1];
ItemMap itemObj=new ItemMap();
for (int[] ints : itemDropTime) {
int itemId = ints[0];
int dropRatio = ints[1];
ItemMap itemObj = new ItemMap();
int fightId = user.getMainLevelManager().getFightId();
SMainLevelConfig targetMainLevelConfig = SMainLevelConfig.config.get(fightId);
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
int[] randomReward = targetMainLevelConfig.getRandomReward();
ItemUtil.combineRewardByMainLine(user,false, true, randomRewardMin, dropRatio,itemObj,BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.combineRewardByMainLine(user,true, false,randomReward, dropRatio,itemObj,BIReason.ADVENTURE_RANDOM_REWARDD);
if (itemObj.getItemMap().containsKey(itemId)){
dropArr[index][0]=itemId;
dropArr[index][1]=itemObj.getItemMap().get(itemId)*useNum;
ItemUtil.combineRewardByMainLine(user, false, true, randomRewardMin, dropRatio, itemObj, BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.combineRewardByMainLine(user, true, false, randomReward, dropRatio, itemObj, BIReason.ADVENTURE_RANDOM_REWARDD);
if (itemObj.getItemMap().containsKey(itemId)) {
dropArr[index][0] = itemId;
dropArr[index][1] = itemObj.getItemMap().get(itemId) * useNum;
index++;
}
}
@ -369,9 +351,6 @@ public class ItemLogic {
/**
*
*
* @param iSession
* @param equipIdsList
*/
public void decomposeEquip(ISession iSession, List<String> equipIdsList) throws Exception {
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
@ -505,17 +484,8 @@ public class ItemLogic {
return null;
}
private ErrorCode checkSoulEquipResolve(List<String> equipIdsList, EquipManager equipManager) {
if (equipIdsList.size() == 0) {
return ErrorCode.ITEM_DECOMPOSE_SOULE_EQUIP_NO;
}
return null;
}
/**
* |
*
* intlong
*/
public void decomposeHero(ISession iSession, List<String> heroIdsList, Set<Integer> filterItem) throws Exception {
@ -661,7 +631,6 @@ public class ItemLogic {
/**
*
*
* @param sumConsume
* @param rankUpReturnPercent 90%9000
*/
public long[][] itemReturnPercent(long[][] sumConsume, int rankUpReturnPercent) {
@ -714,9 +683,6 @@ public class ItemLogic {
/**
*
*
* @param iSession
* @param itemIdList
*/
public void refreshItemNum(ISession iSession, List<Integer> itemIdList) throws Exception {
int msgId = MessageTypeProto.MessageType.REFRESH_ITEM_NUM_RESPONSE_VALUE;
@ -752,9 +718,6 @@ public class ItemLogic {
/**
*
*
* @param session
* @param heroId
*/
public void especialEquipUpStar(ISession session, String heroId) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -813,21 +776,12 @@ public class ItemLogic {
/**
* 穿
*
* @param user
* @param equipId
* @return
*/
public static int getEquipByID(User user, int equipId) {
Item item = user.getItemManager().getItemMap().get(equipId);
if (item == null) {
return 0;
}
// TreeSet<String> equiplist = new TreeSet<>();
// user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
// StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid
// ).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey()));
return (int)item.getItemNum();
}
@ -875,11 +829,6 @@ public class ItemLogic {
/**
*
*
* @param iSession
* @param type
* @param jId
* @param items
* @throws Exception
*/
public void jewelBuild(ISession iSession, int type, String jId, List<String> items) throws Exception {
User user = UserManager.getUser(iSession.getUid());
@ -1028,10 +977,6 @@ public class ItemLogic {
/**
*
* @param uid
* @param type
* @param reason
* @throws Exception
*/
public void functionEndClearItem(int uid,int type,int reason){
try {
@ -1060,13 +1005,8 @@ public class ItemLogic {
}
}
/**
*
* @param user
*/
@Deprecated
public void zeroCleanItem(User user){
// 每天零点清理玩家背包内的一天次道具
// public void zeroCleanItem(User user){
/*try {
ItemManager itemManager = user.getItemManager();
Map<Integer, Item> itemMap = new HashMap<>(itemManager.getItemMap());
@ -1093,6 +1033,6 @@ public class ItemLogic {
}catch (Exception e){
LOGGER.error("零点清理玩家当日过期道具报错:{}",e.getMessage());
}*/
}
// }
}