幸运探宝
parent
aff8be52f7
commit
b98fd6b273
|
|
@ -54,13 +54,11 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
|||
}
|
||||
sendIds.add(user1.getId());
|
||||
}
|
||||
InnerMessageUtil.broadcastWithRandom(new AyyncWorker() {
|
||||
@Override
|
||||
public void work(User user) throws Exception {
|
||||
InnerMessageUtil.broadcastWithRandom( user->{
|
||||
LOGGER.info("hotfix user={}",user.getId());
|
||||
MongoUtil.getLjsdMongoTemplate().save(user);
|
||||
}
|
||||
}, sendIds, Math.min(10, 10));
|
||||
, sendIds, Math.min(10, 10));
|
||||
result.setResultCode(1);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class SDialRewardConfig implements BaseConfig {
|
|||
|
||||
private int limitNum;
|
||||
public static Map<Integer, SDialRewardConfig> sDialRewardConfigMap;
|
||||
public static Map<Integer, Map<Integer, Set<Integer>>> sRandPosMap = new HashMap<>();
|
||||
public static Map<Integer, Map<Integer, Set<Integer>>> sRandPosMap = new HashMap<>(); //activityid posid - ids
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -33,13 +33,12 @@ public class SDialRewardConfig implements BaseConfig {
|
|||
sDialRewardConfigMap.forEach((k, v) ->
|
||||
sRandPosMap.compute(v.getActivityId(), (activityId, oldv) -> {
|
||||
if (oldv == null) {
|
||||
Map<Integer, Set<Integer>> map = new HashMap<>();
|
||||
Set<Integer> set = new HashSet<>();
|
||||
set.add(v.getId());
|
||||
map.put(v.getPoolId(), set);
|
||||
return map;
|
||||
oldv = new HashMap<>();
|
||||
}
|
||||
oldv.computeIfPresent(v.getPoolId(), (pooid, setv) -> {
|
||||
oldv.compute(v.getPoolId(), (pooid, setv) -> {
|
||||
if(null == setv){
|
||||
setv = new HashSet<>();
|
||||
}
|
||||
setv.add(v.getId());
|
||||
return setv;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ public class SDialRewardSetting implements BaseConfig {
|
|||
|
||||
private int[][] multipleCostItem;
|
||||
|
||||
private int extractingTime;
|
||||
|
||||
private int integral;
|
||||
|
||||
|
||||
|
|
@ -85,5 +87,11 @@ public class SDialRewardSetting implements BaseConfig {
|
|||
return integral;
|
||||
}
|
||||
|
||||
public int getExtractingTime() {
|
||||
return extractingTime;
|
||||
}
|
||||
|
||||
public void setExtractingTime(int extractingTime) {
|
||||
this.extractingTime = extractingTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
ActivityLogic.getInstance().flushForLogin(user);
|
||||
ActivityLogic.getInstance().flushForLogin(user,iSession);
|
||||
// DoFix.getInstance().loginFix(user);
|
||||
if(playerInfoManager.getIsdayFirst()==0){
|
||||
playerInfoManager.setIsdayFirst(1);
|
||||
|
|
|
|||
|
|
@ -18,19 +18,20 @@ 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 org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Description: 随机转盘奖励
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/9/25 20:31
|
||||
*/
|
||||
@Component
|
||||
public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuckWheelRandRewardRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_LUCKWHEEL_RANDREWARD_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.GetLuckWheelRandRewardRequest proto) throws Exception {
|
||||
|
||||
|
|
@ -45,27 +46,23 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
|||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.GET_LUCKWHEEL_RANDREWARD_RESPONSE_VALUE, "activity err");
|
||||
return;
|
||||
}
|
||||
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(proto.getActivityId());
|
||||
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());
|
||||
int reson = sGlobalActivity.getType() == 30 ? BIReason.LUCK_WHEEL : BIReason.LUCK_WHEEL_ADVANCE;
|
||||
|
||||
|
||||
//check cost
|
||||
LuckWheelMission luckWheelMission = user.getActivityManager().getLuckWheel(sGlobalActivity.getType());
|
||||
|
||||
int[][] costmap = proto.getRepeated() ? sDialRewardSetting.getCostItem() : sDialRewardSetting.getMultipleCostItem();
|
||||
int[][] costmap = proto.getRepeated() ? sDialRewardSetting.getMultipleCostItem() : sDialRewardSetting.getCostItem();
|
||||
int[][] realCost = LuckWheelActivity.getCost(luckWheelMission.getRefreshTime(), costmap);
|
||||
boolean enough = ItemUtil.itemCost(user, realCost, reson, 0);
|
||||
if (!enough) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.GET_LUCKWHEEL_RANDREWARD_RESPONSE_VALUE, "道具不足");
|
||||
return;
|
||||
}
|
||||
|
||||
//dodrop
|
||||
int time = costmap[1][3];
|
||||
int luckId = 0;
|
||||
int lastpos;
|
||||
int time = proto.getRepeated() ? sDialRewardSetting.getExtractingTime():1;
|
||||
int luckId;
|
||||
int lastpos=1;
|
||||
|
||||
int[][] drops = new int[time][];
|
||||
for (int i = 0; i < time; i++) {
|
||||
|
|
@ -83,7 +80,8 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
|||
PlayerInfoProto.GetLuckWheelRandRewardResponse.Builder builder = PlayerInfoProto.GetLuckWheelRandRewardResponse.newBuilder();
|
||||
builder.setActivityId(proto.getActivityId());
|
||||
builder.setDrop(drop);
|
||||
builder.setPos(luckId);
|
||||
builder.setPos(lastpos);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_LUCKWHEEL_RANDREWARD_RESPONSE_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@ 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 org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Description: 手动刷新幸运转盘奖励
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/9/25 20:07
|
||||
*/
|
||||
@Component
|
||||
public class RefreshLuckWheelRequestHandler extends BaseHandler<PlayerInfoProto.RefreshLuckWheelRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
|
|
|||
|
|
@ -73,9 +73,10 @@ public class ActivityLogic {
|
|||
|
||||
}
|
||||
|
||||
public void flushForLogin(User user) throws Exception {
|
||||
public void flushForLogin(User user,ISession iSession) throws Exception {
|
||||
checkActivityIsFinish(user);
|
||||
checkActivityOfUser(user, null);
|
||||
sendLuckWheelPool(user,iSession);
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
|
|
@ -160,6 +161,9 @@ public class ActivityLogic {
|
|||
|
||||
public void newPlayerOpenActivityMission(User user) throws Exception {
|
||||
checkActivityOfUser(user, null);
|
||||
ISession session = OnlineUserManager.sessionMap.get(user.getId());
|
||||
if (null != session)
|
||||
sendLuckWheelPool(user, session);
|
||||
}
|
||||
|
||||
private void checkNeedOpenStore(User user,int storeId,long startTime,long endTime) throws Exception {
|
||||
|
|
@ -224,11 +228,8 @@ public class ActivityLogic {
|
|||
if (null==abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
abstractActivity.onActivityEndSelfWithDealReward(user);
|
||||
abstractActivity .onActivityEndSelfWithDealReward(user);
|
||||
activityManager.removeActivity(activityId);
|
||||
if(sGlobalActivity.getShopId()!=0){
|
||||
user.getStoreManager().removeStoreInfo(sGlobalActivity.getShopId());
|
||||
}
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
|
|
@ -315,7 +316,7 @@ public class ActivityLogic {
|
|||
private void sendLuckWheelPool(User user,ISession session){
|
||||
PlayerInfoProto.LuckWheelIndication.Builder builder = PlayerInfoProto.LuckWheelIndication.newBuilder();
|
||||
builder.addAllPosInfos(LuckWheelActivity.getLuckWheelReward(user,ActivityType.LUCK_WHEEL));
|
||||
builder.addAllPosInfos(LuckWheelActivity.getLuckWheelReward(user,ActivityType.LUCK_WHEEL_ADVANCE));
|
||||
builder.addAllPosInfosAdvance(LuckWheelActivity.getLuckWheelReward(user,ActivityType.LUCK_WHEEL_ADVANCE));
|
||||
if(builder.getPosInfosAdvanceCount()==0||builder.getPosInfosCount()==0){
|
||||
return;
|
||||
}
|
||||
|
|
@ -1022,26 +1023,23 @@ public class ActivityLogic {
|
|||
}
|
||||
int start = (page - 1) * 20, end = page * 20 - 1;
|
||||
List<CommonProto.UseForceInfo> useForceInfoList = new ArrayList<>(20);
|
||||
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.COMBAT_RANKINGSHOWNUM);
|
||||
if(end<rankEndLine) {
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", start, end);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int score = item.getScore().intValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
User user = UserManager.getUser(uid);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK,"", start, end);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int score = item.getScore().intValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
User user = UserManager.getUser(uid);
|
||||
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
CommonProto.UseForceInfo personInfoBuild = CommonProto.UseForceInfo.newBuilder()
|
||||
.setLeve(playerInfoManager.getLevel())
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setForce(score)
|
||||
.setRank(++start)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setHead(0)
|
||||
.build();
|
||||
useForceInfoList.add(personInfoBuild);
|
||||
}
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
CommonProto.UseForceInfo personInfoBuild = CommonProto.UseForceInfo.newBuilder()
|
||||
.setLeve(playerInfoManager.getLevel())
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setForce(score)
|
||||
.setRank(++start)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setHead(0)
|
||||
.build();
|
||||
useForceInfoList.add(personInfoBuild);
|
||||
}
|
||||
|
||||
int uid = session.getUid();
|
||||
|
|
|
|||
|
|
@ -28,12 +28,18 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
|||
|
||||
private static int Dial_PerScore;//每转一次获得的积分
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
super.initActivity(user);
|
||||
randomReward(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
randomReward(user);
|
||||
}
|
||||
|
||||
public LuckWheelActivity(int id) {
|
||||
LuckWheelActivity(int id) {
|
||||
super(id);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
SDialRewardSetting sDialRewardSetting = SDialRewardSetting.getsDialRewardSettingMapByType().get(sGlobalActivity.getType());
|
||||
|
|
@ -85,7 +91,8 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
|||
LuckWheelMission luckWheelMission = user.getActivityManager().getLuckWheel(type);
|
||||
for (Map.Entry<Integer, LuckWheelPosInfo> entry : luckWheelMission.getPosInfoMap().entrySet()) {
|
||||
int luckId = entry.getValue().getLuckId();
|
||||
if (entry.getValue().getProgrss() >= SDialRewardConfig.getsDialRewardConfigMap().get(luckId).getLimitNum())
|
||||
int limitnum = SDialRewardConfig.getsDialRewardConfigMap().get(luckId).getLimitNum();
|
||||
if (limitnum != 0 && entry.getValue().getProgrss() >= SDialRewardConfig.getsDialRewardConfigMap().get(luckId).getLimitNum())
|
||||
continue;
|
||||
CommonProto.LuckWheelRewardPosInfo.Builder builder = CommonProto.LuckWheelRewardPosInfo.newBuilder();
|
||||
builder.setLuckId(entry.getValue().getLuckId());
|
||||
|
|
@ -117,7 +124,8 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
|||
for (Map.Entry<Integer, LuckWheelPosInfo> entry : luckWheelMission.getPosInfoMap().entrySet()) {
|
||||
int luckId = entry.getValue().getLuckId();
|
||||
SDialRewardConfig sDialRewardConfig = SDialRewardConfig.getsDialRewardConfigMap().get(luckId);
|
||||
if (entry.getValue().getProgrss() >= sDialRewardConfig.getLimitNum())
|
||||
int limitNum = sDialRewardConfig.getLimitNum();
|
||||
if (limitNum!=0&&entry.getValue().getProgrss() >= sDialRewardConfig.getLimitNum())
|
||||
continue;
|
||||
weightMap.put(luckId, sDialRewardConfig.getExtractWeight());
|
||||
amount += sDialRewardConfig.getExtractWeight();
|
||||
|
|
@ -129,7 +137,7 @@ public abstract class LuckWheelActivity extends AbstractActivity {
|
|||
for (Map.Entry<Integer, Integer> entry : weightMap.entrySet()) {
|
||||
amount += entry.getValue();
|
||||
if (rate < amount) {
|
||||
result = entry.getValue();
|
||||
result = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,11 @@ public class ActivityManager extends MongoBase {
|
|||
LuckWheelMission luckWheelMission = type == ActivityType.LUCK_WHEEL ? luckWheel : luckWheelAdvance;
|
||||
if (null == luckWheelMission) {
|
||||
String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
luckWheelMission = new LuckWheelMission();
|
||||
if (type == ActivityType.LUCK_WHEEL) {
|
||||
luckWheel = luckWheelMission = new LuckWheelMission();
|
||||
} else {
|
||||
luckWheelAdvance = luckWheelMission = new LuckWheelMission();
|
||||
}
|
||||
luckWheelMission.init(getRootId(), getMongoKey() + "." + key);
|
||||
updateString(key, luckWheelMission);
|
||||
}
|
||||
|
|
@ -80,7 +84,11 @@ public class ActivityManager extends MongoBase {
|
|||
LuckWheelMission luckWheelMission = type == ActivityType.LUCK_WHEEL ? luckWheel : luckWheelAdvance;
|
||||
if (null != luckWheelMission) {
|
||||
String key = type == ActivityType.LUCK_WHEEL ? "luckWheel" : "luckWheelAdvance";
|
||||
luckWheelMission = new LuckWheelMission();
|
||||
if (type == ActivityType.LUCK_WHEEL) {
|
||||
luckWheel = luckWheelMission = new LuckWheelMission();
|
||||
} else {
|
||||
luckWheelAdvance = luckWheelMission = new LuckWheelMission();
|
||||
}
|
||||
luckWheelMission.init(getRootId(), getMongoKey() + "." + key);
|
||||
updateString(key, luckWheelMission);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,16 +17,12 @@ public class LuckWheelMission extends MongoBase {
|
|||
|
||||
|
||||
public void setPosInfo(int pos,LuckWheelPosInfo luckWheelPosInfo) {
|
||||
if(!posInfoMap.containsKey(pos)){
|
||||
return;
|
||||
}
|
||||
posInfoMap.put(pos,luckWheelPosInfo);
|
||||
updateString("posInfoMap." + pos, luckWheelPosInfo);
|
||||
}
|
||||
|
||||
public void upPosInfo(int pos,LuckWheelPosInfo luckWheelPosInfo) {
|
||||
if(!posInfoMap.containsKey(pos)){
|
||||
return;
|
||||
}
|
||||
posInfoMap.put(pos,luckWheelPosInfo);
|
||||
updateString("posInfoMap." + pos, luckWheelPosInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue