parent
8f602dfebe
commit
753e693fed
|
@ -42,7 +42,7 @@ public class GmBuyGoodHandler extends BaseHandler<PlayerInfoProto.GmBuyGoodReque
|
||||||
// 礼包是否到达购买条件
|
// 礼包是否到达购买条件
|
||||||
boolean canBuy = isCanBuy(user, goodsId);
|
boolean canBuy = isCanBuy(user, goodsId);
|
||||||
if (!canBuy){
|
if (!canBuy){
|
||||||
throw new ErrorCodeException(ErrorCode.BLOOD_BUY_SCORE_YET);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"购买条件不足");
|
||||||
}
|
}
|
||||||
// 礼包配置是否存在
|
// 礼包配置是否存在
|
||||||
SGMMaster master = SGMMaster.getMap().get(goodsId);
|
SGMMaster master = SGMMaster.getMap().get(goodsId);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SChangingCard;
|
import config.SChangingCard;
|
||||||
import config.SChangingCardLevel;
|
import config.SChangingCardLevel;
|
||||||
import config.SItem;
|
import config.SChangingCardStar;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
|
@ -20,7 +20,6 @@ import rpc.protocols.HeroInfoProto;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,8 +48,8 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
|
||||||
TransformationInfo info = infoMap.get(id);
|
TransformationInfo info = infoMap.get(id);
|
||||||
HeroInfoProto.TransformationUpGradeResponse.Builder builder = HeroInfoProto.TransformationUpGradeResponse.newBuilder();
|
HeroInfoProto.TransformationUpGradeResponse.Builder builder = HeroInfoProto.TransformationUpGradeResponse.newBuilder();
|
||||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||||
if (type == 1) {
|
|
||||||
//升级
|
//升级
|
||||||
|
if (type == 1) {
|
||||||
int pool = changingCard.getLevelUpPool();
|
int pool = changingCard.getLevelUpPool();
|
||||||
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(pool);
|
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(pool);
|
||||||
if (poolConfig == null) {
|
if (poolConfig == null) {
|
||||||
|
@ -65,53 +64,50 @@ public class TransformationUpGradeHandler extends BaseHandler<HeroInfoProto.Tran
|
||||||
if (!ItemUtil.itemCost(user, costItem, BIReason.TRANSFORMATION_CARD_LEVEL_COST, 1)) {
|
if (!ItemUtil.itemCost(user, costItem, BIReason.TRANSFORMATION_CARD_LEVEL_COST, 1)) {
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
|
//更新数据库
|
||||||
info.setLevel(info.getLevel() + 1);
|
info.setLevel(info.getLevel() + 1);
|
||||||
user.getHeroManager().putTransformationList(info);
|
user.getHeroManager().putTransformationList(info);
|
||||||
|
// 获得道具
|
||||||
int[][] dropItem = {nextConfig.getChangingForceExp()};
|
int[][] dropItem = {nextConfig.getChangingForceExp()};
|
||||||
|
|
||||||
ItemUtil.drop(user, dropItem, drop, BIReason.TRANSFORMATION_CARD_LEVEL_REWARD);
|
ItemUtil.drop(user, dropItem, drop, BIReason.TRANSFORMATION_CARD_LEVEL_REWARD);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
|
}
|
||||||
} else if (type == 2) {
|
|
||||||
//升星
|
//升星
|
||||||
List<CommonProto.KeyVal> itemIdList = proto.getItemListList();
|
if (type == 2) {
|
||||||
Map<Integer, Integer> costMap = new HashMap<>();
|
SChangingCard card = STableManager.getConfig(SChangingCard.class).get(proto.getId());
|
||||||
for (CommonProto.KeyVal keyVal : itemIdList) {
|
if (card == null){
|
||||||
if (costMap.containsKey(keyVal.getKey())) {
|
throw new ErrorCodeException(ErrorCode.CFG_NULL, "变身卡不存在");
|
||||||
costMap.put(keyVal.getKey(), costMap.get(keyVal.getKey()) + keyVal.getVal());
|
}
|
||||||
|
if (info.getStar() >= card.getStarMax()){
|
||||||
|
throw new ErrorCodeException(ErrorCode.LEVE_MAX, "变身卡最大星级");
|
||||||
|
}
|
||||||
|
Map<Integer, SChangingCardStar> starMap = SChangingCardStar.getPoolMap().get(card.getStar());
|
||||||
|
if (starMap == null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL, "变身卡升星库不存在");
|
||||||
|
}
|
||||||
|
SChangingCardStar cardStar = starMap.get(info.getStar());
|
||||||
|
// 转换消耗物品id
|
||||||
|
HashMap<Integer, Integer> costMap = new HashMap<>();
|
||||||
|
for (int[] item : cardStar.getPropList()) {
|
||||||
|
// 0表示消耗本体
|
||||||
|
if (item[0] == 0){
|
||||||
|
costMap.put(card.getCardId(),item[1]);
|
||||||
}else {
|
}else {
|
||||||
costMap.put(keyVal.getKey(), keyVal.getVal());
|
costMap.put(item[0],item[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int num = 0;
|
boolean cost = ItemUtil.itemCost(user, costMap, BIReason.TRANSFORMATION_CARD_STAR_COST, 0);
|
||||||
int quantity = 0;
|
if (!cost){
|
||||||
if(changingCard.getStarUpCost().length>= info.getStar() + 1){
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "变身卡升星库不存在");
|
||||||
num = changingCard.getStarUpCost()[info.getStar()][1];
|
|
||||||
quantity = changingCard.getStarUpCost()[info.getStar()][0];
|
|
||||||
}
|
}
|
||||||
for (Integer itemId : costMap.keySet()) {
|
// 更新变身卡对象
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
|
||||||
if(sItem == null || sItem.getQuantity() != quantity){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int sum = costMap.values().stream().mapToInt(Integer::intValue).sum();
|
|
||||||
if(sum != num){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
if (!ItemUtil.itemCost(user, costMap, BIReason.TRANSFORMATION_CARD_STAR_COST, 1)) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
if (info != null) {
|
|
||||||
info.setStar(info.getStar() + 1);
|
info.setStar(info.getStar() + 1);
|
||||||
user.getHeroManager().putTransformationList(info);
|
user.getHeroManager().putTransformationList(info);
|
||||||
Map<Integer, Long> itemMap = new HashMap<>(1);
|
// 获得道具
|
||||||
int[] item = changingCard.getStarUpExp()[info.getStar() - 1];
|
int[][] dropItem = {cardStar.getStarUpExp()};
|
||||||
itemMap.put(item[0], Long.valueOf(item[1]));
|
ItemUtil.drop(user, dropItem, drop, BIReason.TRANSFORMATION_CARD_LEVEL_REWARD);
|
||||||
ItemUtil.addItem(user, itemMap, drop, BIReason.TRANSFORMATION_CARD_STAR_REWARD);
|
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
CommonProto.TransformationCardInfo cardInfo = CommonProto.TransformationCardInfo.newBuilder()
|
CommonProto.TransformationCardInfo cardInfo = CommonProto.TransformationCardInfo.newBuilder()
|
||||||
.setId(info.getCardId())
|
.setId(info.getCardId())
|
||||||
.setIndex(info.getIndex())
|
.setIndex(info.getIndex())
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ljsd.jieling.jbean.gm;
|
package com.ljsd.jieling.jbean.gm;
|
||||||
|
|
||||||
import com.ljsd.common.mogodb.MongoBase;
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ import java.util.HashMap;
|
||||||
* @author ascend
|
* @author ascend
|
||||||
* 2022/10/27 16:09:45
|
* 2022/10/27 16:09:45
|
||||||
*/
|
*/
|
||||||
public class GmActivity {
|
public class GmActivity extends MongoBase {
|
||||||
private HashMap<String, GmMission> missionMap = new HashMap<>();
|
private HashMap<String, GmMission> missionMap = new HashMap<>();
|
||||||
private String id;
|
private String id;
|
||||||
private int type;
|
private int type;
|
||||||
|
@ -18,12 +19,18 @@ public class GmActivity {
|
||||||
private String startTime;
|
private String startTime;
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
public GmActivity() {
|
||||||
|
//绑定关系
|
||||||
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
updateString("id",id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, GmMission> getMissionMap() {
|
public HashMap<String, GmMission> getMissionMap() {
|
||||||
|
@ -32,10 +39,12 @@ public class GmActivity {
|
||||||
|
|
||||||
public void setMissionMap(HashMap<String, GmMission> missionMap) {
|
public void setMissionMap(HashMap<String, GmMission> missionMap) {
|
||||||
this.missionMap = missionMap;
|
this.missionMap = missionMap;
|
||||||
|
updateString("missionMap",missionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putMissionMap(String id, GmMission mission) {
|
public void putMissionMap(String id, GmMission mission) {
|
||||||
this.missionMap.put(id,mission);
|
this.missionMap.put(id,mission);
|
||||||
|
updateString("missionMap",missionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
|
@ -44,6 +53,7 @@ public class GmActivity {
|
||||||
|
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
updateString("type",type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
|
@ -52,6 +62,7 @@ public class GmActivity {
|
||||||
|
|
||||||
public void setValue(int value) {
|
public void setValue(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
updateString("value",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStartTime() {
|
public String getStartTime() {
|
||||||
|
@ -60,6 +71,7 @@ public class GmActivity {
|
||||||
|
|
||||||
public void setStartTime(String startTime) {
|
public void setStartTime(String startTime) {
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
|
updateString("startTime",startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEndTime() {
|
public String getEndTime() {
|
||||||
|
@ -68,5 +80,6 @@ public class GmActivity {
|
||||||
|
|
||||||
public void setEndTime(String endTime) {
|
public void setEndTime(String endTime) {
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
|
updateString("endTime",endTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,31 @@
|
||||||
package com.ljsd.jieling.jbean.gm;
|
package com.ljsd.jieling.jbean.gm;
|
||||||
|
|
||||||
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 说明:gm活动档位
|
* 说明:gm活动档位
|
||||||
*
|
*
|
||||||
* @author ascend
|
* @author ascend
|
||||||
* 2022/10/27 16:09:54
|
* 2022/10/27 16:09:54
|
||||||
*/
|
*/
|
||||||
public class GmMission {
|
public class GmMission extends MongoBase {
|
||||||
private String id;
|
private String id;
|
||||||
private int value;
|
private int value;
|
||||||
private int state;
|
private int state;
|
||||||
|
|
||||||
|
public GmMission() {
|
||||||
|
//绑定关系
|
||||||
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
updateString("id",id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
|
@ -25,6 +34,7 @@ public class GmMission {
|
||||||
|
|
||||||
public void setValue(int value) {
|
public void setValue(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
updateString("value",value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getState() {
|
public int getState() {
|
||||||
|
@ -33,5 +43,6 @@ public class GmMission {
|
||||||
|
|
||||||
public void setState(int state) {
|
public void setState(int state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
updateString("state",state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.ljsd.jieling.kefu;
|
||||||
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
import util.TimeUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hj
|
* @author hj
|
||||||
|
@ -13,22 +12,7 @@ public class Cmd_support extends GmRoleAbstract {
|
||||||
public boolean exec(String[] args) throws Exception {
|
public boolean exec(String[] args) throws Exception {
|
||||||
// 获取用户
|
// 获取用户
|
||||||
User user = getUser();
|
User user = getUser();
|
||||||
// 第一位是奖励信息
|
BuyGoodsNewLogic.supportBuyGoods(user,args[0]);
|
||||||
String arg = args[0];
|
|
||||||
// 价格
|
|
||||||
int price = 0;
|
|
||||||
// 订单id
|
|
||||||
String orderId = "support-order";
|
|
||||||
// 多个奖励组,需要用"|"分割
|
|
||||||
String[] rewards = arg.split("\\|");
|
|
||||||
for (String reward : rewards) {
|
|
||||||
// 奖励id#奖励数量
|
|
||||||
String[] item = reward.split("#");
|
|
||||||
for (int i = 0; i < Integer.parseInt(item[1]); i++) {
|
|
||||||
// 发送充值礼包
|
|
||||||
BuyGoodsNewLogic.sendGoods(user.getId(), item[0], user.getPlayerInfoManager().getOpenId(), orderId, TimeUtils.now(), price);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,6 @@ public class GmActivityLogic implements IEventHandler {
|
||||||
LOGGER.error("充值返利,未找到得活动类型,uid:{}, activityId:{}", user.getId(), gmActivity.getId());
|
LOGGER.error("充值返利,未找到得活动类型,uid:{}, activityId:{}", user.getId(), gmActivity.getId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 入库
|
|
||||||
manager.putActivityMap(gmActivity.getId(),gmActivity);
|
|
||||||
// 验证奖励非空
|
// 验证奖励非空
|
||||||
String mailReward = ItemUtil.getMailReward(rewards);
|
String mailReward = ItemUtil.getMailReward(rewards);
|
||||||
if (StringUtil.isEmpty(mailReward)){
|
if (StringUtil.isEmpty(mailReward)){
|
||||||
|
@ -241,7 +239,6 @@ public class GmActivityLogic implements IEventHandler {
|
||||||
gmActivity.setType(arbActivity.getType());
|
gmActivity.setType(arbActivity.getType());
|
||||||
gmActivity.setStartTime(arbActivity.getStartTime());
|
gmActivity.setStartTime(arbActivity.getStartTime());
|
||||||
gmActivity.setEndTime(arbActivity.getEndTime());
|
gmActivity.setEndTime(arbActivity.getEndTime());
|
||||||
gmActivityManager.putActivityMap(gmActivity.getId(),gmActivity);
|
|
||||||
}
|
}
|
||||||
gmActivityManager.setUpdateVersion(version);
|
gmActivityManager.setUpdateVersion(version);
|
||||||
}
|
}
|
||||||
|
@ -253,14 +250,11 @@ public class GmActivityLogic implements IEventHandler {
|
||||||
public void zeroUpdateGmActivity(User user){
|
public void zeroUpdateGmActivity(User user){
|
||||||
updateGmActivity(user);
|
updateGmActivity(user);
|
||||||
GmActivityManager manager = user.getGmActivityManager();
|
GmActivityManager manager = user.getGmActivityManager();
|
||||||
HashMap<String, GmActivity> activityMap = manager.getActivityMap();
|
for (GmActivity gmActivity : manager.getActivityMap().values()) {
|
||||||
for (GmActivity gmActivity : activityMap.values()) {
|
|
||||||
// 单笔累充和妖晶返利每日清零
|
// 单笔累充和妖晶返利每日清零
|
||||||
if (gmActivity.getType() == 1 || gmActivity.getType() == 2){
|
if (gmActivity.getType() == 1 || gmActivity.getType() == 2){
|
||||||
gmActivity.setValue(0);
|
gmActivity.setValue(0);
|
||||||
gmActivity.setMissionMap(new HashMap<>());
|
gmActivity.setMissionMap(new HashMap<>());
|
||||||
// 入库
|
|
||||||
manager.putActivityMap(gmActivity.getId(),gmActivity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2942,30 +2942,15 @@ public class HeroLogic {
|
||||||
// 变身卡单独提供得属性
|
// 变身卡单独提供得属性
|
||||||
combinedAttribute(card.getPropList(), heroAllAttribute);
|
combinedAttribute(card.getPropList(), heroAllAttribute);
|
||||||
//变身卡升星属性
|
//变身卡升星属性
|
||||||
switch (info.getStar()){
|
SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(info.getStar());
|
||||||
case 1:
|
if (cardStar != null){
|
||||||
combinedAttribute(card.getStar1UpProps(), heroAllAttribute);
|
combinedAttribute(cardStar.getExp(), heroAllAttribute);
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
combinedAttribute(card.getStar2UpProps(), heroAllAttribute);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
combinedAttribute(card.getStar3UpProps(), heroAllAttribute);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
combinedAttribute(card.getStar4UpProps(), heroAllAttribute);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
combinedAttribute(card.getStar5UpProps(), heroAllAttribute);
|
|
||||||
break;
|
|
||||||
default:break;
|
|
||||||
}
|
}
|
||||||
//变身卡升级属性
|
//变身卡升级属性
|
||||||
int pool = card.getLevelUpPool();
|
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool());
|
||||||
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(pool);
|
List<SChangingCardLevel> levelList = poolConfig.values().stream().filter(n->n.getLevel() == info.getLevel()).collect(Collectors.toList());
|
||||||
List<SChangingCardLevel> selectConfiglist = poolConfig.values().stream().filter(n->n.getLevel() == info.getLevel()).collect(Collectors.toList());
|
if(levelList.size()>0){
|
||||||
if(selectConfiglist != null &&selectConfiglist.size()>0 ){
|
combinedAttribute(levelList.get(0).getPropList(), heroAllAttribute);
|
||||||
combinedAttribute(selectConfiglist.get(0).getPropList(), heroAllAttribute);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,13 +57,15 @@ import java.util.*;
|
||||||
public class BuyGoodsNewLogic {
|
public class BuyGoodsNewLogic {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(BuyGoodsNewLogic.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(BuyGoodsNewLogic.class);
|
||||||
|
|
||||||
|
|
||||||
public static RechargeHandler getRechargeHandler(int type){
|
public static RechargeHandler getRechargeHandler(int type){
|
||||||
return RechargeType.getHandler(type);
|
return RechargeType.getHandler(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final String test_buy_order = "test_buy_order";
|
||||||
|
private static final String gm_modifier = "gm_modifier";
|
||||||
|
private static final String support_order = "support_order";
|
||||||
|
|
||||||
//获取充值总金额,结合前面的
|
//获取充值总金额,结合前面的
|
||||||
public static double getAllAmount(User user){
|
public static double getAllAmount(User user){
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
|
@ -126,11 +128,9 @@ public class BuyGoodsNewLogic {
|
||||||
if (sRechargeCommodityConfig == null){
|
if (sRechargeCommodityConfig == null){
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
String openId = "test_buy_openId";
|
|
||||||
String orderId = "test_buy_order";
|
|
||||||
int price = (int)sRechargeCommodityConfig.getPrice() *100;
|
int price = (int)sRechargeCommodityConfig.getPrice() *100;
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
||||||
sendGoods(uid, goodsId, openId, orderId, TimeUtils.now(), price);
|
sendGoods(uid, goodsId, "", test_buy_order, TimeUtils.now(), price);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,10 +144,32 @@ public class BuyGoodsNewLogic {
|
||||||
if(sRechargeCommodityConfig == null){
|
if(sRechargeCommodityConfig == null){
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
String orderId = "gm_modifier";
|
|
||||||
int price = (int)sRechargeCommodityConfig.getPrice() * 100;
|
int price = (int)sRechargeCommodityConfig.getPrice() * 100;
|
||||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
|
||||||
sendGoods(iSession.getUid(), String.valueOf(goodsId), "", orderId, TimeUtils.now(), price);
|
sendGoods(iSession.getUid(), String.valueOf(goodsId), "", gm_modifier, TimeUtils.now(), price);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扶持发送奖励
|
||||||
|
* @param user
|
||||||
|
* @param goods
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void supportBuyGoods(User user, String goods) throws Exception {
|
||||||
|
String[] good = goods.split("\\|");
|
||||||
|
for (String info : good) {
|
||||||
|
String[] gift = info.split("#");
|
||||||
|
int goodId = Integer.parseInt(gift[0]);
|
||||||
|
// 礼包内从校验
|
||||||
|
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(goodId);
|
||||||
|
if(config == null){
|
||||||
|
LOGGER.error("sendGoods to 扶持发奖,礼包id未找到,uid:{},good:{}",user.getId(),goodId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int price = (int)config.getPrice() * 100;
|
||||||
|
// 发送多个礼包
|
||||||
|
sendGoods(user.getId(), String.valueOf(goodId), "", support_order, TimeUtils.now(), price);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,7 +178,7 @@ public class BuyGoodsNewLogic {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static boolean isRmbBuy(String orderId){
|
private static boolean isRmbBuy(String orderId){
|
||||||
return !"support-order".equals(orderId) && !"gm_modifier".equals(orderId) && !"test_buy_order".equals(orderId);
|
return !gm_modifier.equals(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,7 +215,7 @@ public class BuyGoodsNewLogic {
|
||||||
double priceTemp =config.getPrice();
|
double priceTemp =config.getPrice();
|
||||||
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
|
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
|
||||||
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
|
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
|
||||||
if(isRmbBuy(orderId) && !MathUtils.doubleEquals(amount,price * 100)){
|
if(!MathUtils.doubleEquals(amount,price * 100)){
|
||||||
resultRes.setResultCode(0);
|
resultRes.setResultCode(0);
|
||||||
resultRes.setResultMsg("charge price error");
|
resultRes.setResultMsg("charge price error");
|
||||||
LOGGER.error("sendGoods charge price error, uid={},the goodId={}, currentPrice={},realPrice={}",uid,goodsId, amount,price);
|
LOGGER.error("sendGoods charge price error, uid={},the goodId={}, currentPrice={},realPrice={}",uid,goodsId, amount,price);
|
||||||
|
@ -220,13 +242,14 @@ public class BuyGoodsNewLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<int[][]> list = bag.getDropByBag();
|
List<int[][]> list = bag.getDropByBag();
|
||||||
if (isRmbBuy(orderId) && config.getGainFame() != null && config.getGainFame().length > 0){
|
int[][] gainFame = config.getGainFame();
|
||||||
list.add(config.getGainFame());
|
if (gainFame != null && gainFame.length > 0){
|
||||||
|
list.add(gainFame);
|
||||||
}
|
}
|
||||||
//发货
|
//发货
|
||||||
sendGoodsByType(user,config,list);
|
sendGoodsByType(user,config,list);
|
||||||
|
|
||||||
if(config.getAccumulativeRecharge() == 1 && !"gm_modifier".equals(orderId)){
|
if(config.getAccumulativeRecharge() == 1 && !gm_modifier.equals(orderId)){
|
||||||
if(info.getMaxSingleR() < price){
|
if(info.getMaxSingleR() < price){
|
||||||
info.setMaxSingleR(price);
|
info.setMaxSingleR(price);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +285,7 @@ public class BuyGoodsNewLogic {
|
||||||
// 更新入库
|
// 更新入库
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
// 扶持订单不需要上报
|
// 扶持订单不需要上报
|
||||||
if(price>0 && !orderId.equals("support-order")) {
|
if(price>0 && !orderId.equals(support_order)) {
|
||||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
|
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.RECHARGE_SUCCESS_INDICATION_VALUE,
|
||||||
PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
|
PlayerInfoProto.RechargeSuccessIndication.newBuilder().setOrderId(orderId).build(), true);
|
||||||
// 开天上报
|
// 开天上报
|
||||||
|
|
|
@ -1,48 +1,29 @@
|
||||||
package config;
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
import manager.Table;
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Table(name ="ChangingCard")
|
@Table(name ="ChangingCard")
|
||||||
public class SChangingCard implements BaseConfig {
|
public class SChangingCard implements BaseConfig {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private int cardId;
|
private int cardId;
|
||||||
|
|
||||||
private int[][] propList;
|
private int[][] propList;
|
||||||
|
private int star;
|
||||||
private int[][] starUpCost;
|
|
||||||
|
|
||||||
private int[][] star1UpProps;
|
|
||||||
|
|
||||||
private int[][] star2UpProps;
|
|
||||||
|
|
||||||
private int[][] star3UpProps;
|
|
||||||
|
|
||||||
private int[][] star4UpProps;
|
|
||||||
|
|
||||||
private int[][] star5UpProps;
|
|
||||||
|
|
||||||
private int[] exp;
|
private int[] exp;
|
||||||
|
|
||||||
private int[][] starUpExp;
|
|
||||||
|
|
||||||
private int levelUpPool;
|
private int levelUpPool;
|
||||||
|
|
||||||
private int[] skill;
|
private int[] skill;
|
||||||
|
|
||||||
private int isOpen;
|
private int isOpen;
|
||||||
|
|
||||||
private int starMax;
|
private int starMax;
|
||||||
private int levelMax;
|
private int levelMax;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -55,30 +36,14 @@ public class SChangingCard implements BaseConfig {
|
||||||
return propList;
|
return propList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getStarUpCost() {
|
public int getStar() {
|
||||||
return starUpCost;
|
return star;
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getStar1UpProps() {
|
|
||||||
return star1UpProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getStar2UpProps() {
|
|
||||||
return star2UpProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getStar3UpProps() {
|
|
||||||
return star3UpProps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getExp() {
|
public int[] getExp() {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getStarUpExp() {
|
|
||||||
return starUpExp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLevelUpPool() {
|
public int getLevelUpPool() {
|
||||||
return levelUpPool;
|
return levelUpPool;
|
||||||
}
|
}
|
||||||
|
@ -98,12 +63,4 @@ public class SChangingCard implements BaseConfig {
|
||||||
public int getLevelMax() {
|
public int getLevelMax() {
|
||||||
return levelMax;
|
return levelMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getStar4UpProps() {
|
|
||||||
return star4UpProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getStar5UpProps() {
|
|
||||||
return star5UpProps;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue