太初特权和刷冲特权用到的特权覆盖
parent
6e81f56b7a
commit
2df133f4d2
|
@ -472,6 +472,15 @@ public class PlayerManager extends MongoBase {
|
|||
return vipInfo;
|
||||
}
|
||||
|
||||
public Set<Integer> getHadTakeLevelBoxVip() {
|
||||
return vipGoodInfo;
|
||||
}
|
||||
|
||||
public void setHadTakeLevelBoxVip(int vipLeve) {
|
||||
vipGoodInfo.add(vipLeve);
|
||||
updateString("vipGoodInfo", vipGoodInfo);
|
||||
}
|
||||
|
||||
public void updateVipInfo(int unlockType,int condition) {
|
||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(unlockType);
|
||||
for(Map.Entry<Integer, Map<Integer, Integer>> entry:conditionMap.entrySet()){
|
||||
|
@ -508,36 +517,6 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("vipInfo", vipInfo);
|
||||
}
|
||||
|
||||
public int getMaxForce() {
|
||||
return maxForce;
|
||||
}
|
||||
|
||||
public void setMaxForce(int maxForce) {
|
||||
updateString("maxForce", maxForce);
|
||||
this.maxForce = maxForce;
|
||||
}
|
||||
|
||||
public Set<Integer> getHadTakeLevelBoxVip() {
|
||||
return vipGoodInfo;
|
||||
}
|
||||
public boolean hadTakeLevelBoxVip(int vipLevel) {
|
||||
return vipGoodInfo.contains(vipLevel);
|
||||
}
|
||||
public void setHadTakeLevelBoxVip(int vipLeve) {
|
||||
updateString("vipGoodInfo", vipGoodInfo);
|
||||
vipGoodInfo.add(vipLevel);
|
||||
}
|
||||
|
||||
|
||||
public int getHadTakeDailyBoxVip() {
|
||||
return hadTakeDailyBoxVip;
|
||||
}
|
||||
|
||||
public void setHadTakeDailyBoxVip(int hadTakeDailyBoxVip) {
|
||||
updateString("hadTakeDailyBoxVip", hadTakeDailyBoxVip);
|
||||
this.hadTakeDailyBoxVip = hadTakeDailyBoxVip;
|
||||
}
|
||||
|
||||
public void vipFlush( Set<Integer> removePrivileges) {
|
||||
if (vipInfo.isEmpty()) {
|
||||
return;
|
||||
|
@ -566,10 +545,6 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("vipInfo", vipInfo);
|
||||
|
||||
}
|
||||
public void removeVipCount(int priviliageId){
|
||||
vipInfo.remove(priviliageId);
|
||||
removeString("vipInfo."+priviliageId);
|
||||
}
|
||||
|
||||
public void addVipInfo(int privilageId){
|
||||
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
||||
|
@ -621,7 +596,6 @@ public class PlayerManager extends MongoBase {
|
|||
return this.vipInfo.containsKey(privilageId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新整个类型的次数
|
||||
* @param privilegeType
|
||||
|
@ -636,11 +610,30 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
updateString("vipInfo", this.vipInfo);
|
||||
}
|
||||
|
||||
public void removeVipPriviliageId(int privilageId){
|
||||
vipInfo.remove(privilageId);
|
||||
removeString(getMongoKey() +".vipInfo."+privilageId);
|
||||
}
|
||||
|
||||
public int getMaxForce() {
|
||||
return maxForce;
|
||||
}
|
||||
|
||||
public void setMaxForce(int maxForce) {
|
||||
updateString("maxForce", maxForce);
|
||||
this.maxForce = maxForce;
|
||||
}
|
||||
|
||||
public int getHadTakeDailyBoxVip() {
|
||||
return hadTakeDailyBoxVip;
|
||||
}
|
||||
|
||||
public void setHadTakeDailyBoxVip(int hadTakeDailyBoxVip) {
|
||||
updateString("hadTakeDailyBoxVip", hadTakeDailyBoxVip);
|
||||
this.hadTakeDailyBoxVip = hadTakeDailyBoxVip;
|
||||
}
|
||||
|
||||
public RechargeInfo getRechargeInfo() {
|
||||
return rechargeInfo;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import rpc.protocols.CommonProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -528,16 +529,28 @@ public class BuyGoodsNewLogic {
|
|||
* 处理特权
|
||||
*/
|
||||
public static void activePrivilege(User user,SRechargeCommodityNewConfig config) throws Exception{
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
PlayerInfoProto.PrivilegeIndication.Builder indication = PlayerInfoProto.PrivilegeIndication.newBuilder();
|
||||
int[] openPrivilege = config.getOpenPrivilege();
|
||||
if(openPrivilege!=null && openPrivilege.length>0) {
|
||||
PlayerInfoProto.PrivilegeIndication.Builder indication = PlayerInfoProto.PrivilegeIndication.newBuilder();
|
||||
// 新增特权
|
||||
if (openPrivilege != null || openPrivilege.length > 0){
|
||||
for (int privilege : openPrivilege) {
|
||||
addNewPrivilege(user,privilege,indication);
|
||||
}
|
||||
MessageUtil.sendIndicationMessage(session, 1,
|
||||
MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
|
||||
LOGGER.info("********************购买礼包,新增特权id:{}", StringUtil.intArrToStringArr(openPrivilege));
|
||||
}
|
||||
|
||||
int[] coverPrivilege = config.getCoverPrivilege();
|
||||
// 覆盖旧特权
|
||||
if (coverPrivilege != null || coverPrivilege.length > 0){
|
||||
for (int privilegeId : config.getCoverPrivilege()) {
|
||||
user.getPlayerInfoManager().removeVipPriviliageId(privilegeId);
|
||||
}
|
||||
LOGGER.info("********************购买礼包,覆盖特权id:{}", StringUtil.intArrToStringArr(coverPrivilege));
|
||||
}
|
||||
|
||||
// todo 修改推送,获取全部特权,直接覆盖刷新
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
public static void addNewPrivilege(User user ,int privilege,PlayerInfoProto.PrivilegeIndication.Builder indication) throws Exception {
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.util.*;
|
||||
import com.sun.tools.javac.comp.Todo;
|
||||
import config.SPlayerLevelConfig;
|
||||
import config.SPrestigeConfig;
|
||||
import config.SStoreConfig;
|
||||
import config.SStoreTypeConfig;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -610,12 +611,39 @@ public class StoreLogic implements IEventHandler {
|
|||
//// }
|
||||
// }
|
||||
int[] buyRule = sStoreConfig.getBuyRule();
|
||||
if(buyRule!=null&&buyRule.length>0){
|
||||
//充值金额购买条件判断
|
||||
if(buyRule[0]==1&&BuyGoodsNewLogic.getAllAmount(user)<buyRule[1]){
|
||||
return "充值金额不足,无权购买";
|
||||
String err = "";
|
||||
if (buyRule != null && buyRule.length > 0){
|
||||
switch (buyRule[0]){
|
||||
case 1://充值金额购买条件判断
|
||||
double amount = BuyGoodsNewLogic.getAllAmount(user);
|
||||
if (amount < buyRule[1]){
|
||||
err = "充值金额不足,无权购买";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
SPrestigeConfig prestigeConfig = SPrestigeConfig.getTypeMap(1).get(buyRule[1]);
|
||||
Item item = user.getItemManager().getItem(prestigeConfig.getExperience()[0]);
|
||||
long num = item == null ? 0 : item.getItemNum();
|
||||
if (num < prestigeConfig.getExperience()[1]){
|
||||
err = "神尊等级不足,无权购买";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
SPrestigeConfig prestigeConfig2 = SPrestigeConfig.getTypeMap(2).get(buyRule[1]);
|
||||
Item item2 = user.getItemManager().getItem(prestigeConfig2.getExperience()[0]);
|
||||
long num2 = item2 == null ? 0 : item2.getItemNum();
|
||||
if (num2 < prestigeConfig2.getExperience()[1]){
|
||||
err = "名望等级不足,无权购买";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
err = "未知的条件类型,请联系策划确认";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!"".equals(err)){
|
||||
return err;
|
||||
}
|
||||
|
||||
int buyTimes = itemNumMap.get(itemId);
|
||||
int limit = sStoreConfig.getLimit();
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="PrestigeConfig")
|
||||
public class SPrestigeConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[] experience;
|
||||
|
||||
/**
|
||||
* 类型--》等级--》对象
|
||||
*/
|
||||
private static Map<Integer,Map<Integer,SPrestigeConfig>> typeMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SPrestigeConfig> config = STableManager.getConfig(SPrestigeConfig.class);
|
||||
Map<Integer,Map<Integer,SPrestigeConfig>> map = new HashMap<>();
|
||||
for (SPrestigeConfig value : config.values()) {
|
||||
Map<Integer, SPrestigeConfig> map1 = map.getOrDefault(value.getType(),new HashMap<>());
|
||||
map1.put(value.getLevel(),value);
|
||||
map.put(value.getType(),map1);
|
||||
}
|
||||
typeMap.clear();
|
||||
typeMap = map;
|
||||
}
|
||||
|
||||
// 神尊特权
|
||||
public static final int godPrivilege = 1;
|
||||
// 名望特权
|
||||
public static final int renownPrivilege = 2;
|
||||
|
||||
public static Map<Integer, SPrestigeConfig> getTypeMap(int type) {
|
||||
return typeMap.get(type);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[] getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -27,6 +27,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
private int[] openPrivilege;
|
||||
|
||||
private int[] coverPrivilege;
|
||||
|
||||
private int contiueDays;
|
||||
|
||||
private int limit;
|
||||
|
@ -148,6 +150,10 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
public int[] getOpenPrivilege() { return openPrivilege; }
|
||||
|
||||
public int[] getCoverPrivilege() {
|
||||
return coverPrivilege;
|
||||
}
|
||||
|
||||
public int getContiueDays() { return contiueDays; }
|
||||
|
||||
public int getLimit() { return limit; }
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="potentialConfig")
|
||||
public class SpotentialConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int level;
|
||||
|
||||
private int position ;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int[] number;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getPosition () {
|
||||
return position ;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int[] getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue