Merge branch 'master_test_gn' into master_test_gn_push

back_recharge
yuanshuai 2021-10-14 16:36:30 +08:00
commit 7bc172d613
7 changed files with 147 additions and 22 deletions

View File

@ -79,8 +79,10 @@ public class GetPlayerInfoHandler extends BaseHandler{
Map<Integer, SPrivilegeTypeConfig> privilegeTypeConfigMap = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap();
for(Map.Entry<Integer, SPrivilegeTypeConfig> entry:privilegeTypeConfigMap.entrySet()){
//如果是<4 系统内置特权 (6是新增的好感度特权收益加成 2021.9.26)
if(entry.getValue().getUnlockType()<4||entry.getValue().getUnlockType()==6&&!vipInfo.containsKey(entry.getKey())){
playerInfoManager.addVipInfo(entry.getKey());
if(entry.getValue().getUnlockType()<4||entry.getValue().getUnlockType()==6){
if (!vipInfo.containsKey(entry.getKey())){
playerInfoManager.addVipInfo(entry.getKey());
}
}
}
List<CommonProto.Privilege> privilegeList = new ArrayList<>();

View File

@ -3,13 +3,52 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class ItemManager extends MongoBase {
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
///兼容线上数据,计算统计装备(为了做白金装备图鉴,需要初始化统计一次用户身上所有装备)true:已经计算过了 false未计算
private boolean isAbsEquip;
public boolean getIsAbsEquip() {
return isAbsEquip;
}
public void setAbsEquip(boolean absEquip) {
isAbsEquip = absEquip;
updateString("isAbsEquip", isAbsEquip);
}
private Map<Integer, Long> equipBookMap = new HashMap<>();
public Map<Integer, Long> getEquipBookMap() {
return equipBookMap;
}
public void setEquipBookMap(int equipId,long addNum) {
long _num=addNum;
if (this.equipBookMap.containsKey(equipId)){
_num+=this.equipBookMap.get(equipId);
}
this.equipBookMap.put(equipId,_num);
updateString("equipBookMap." + equipId, _num);
}
private Set<Integer> equipBookEnabled = new HashSet<>();
public Set<Integer> getEquipBookEnabled() {
return equipBookEnabled;
}
public void addEquipBookEnabled(int bookId) {
this.equipBookEnabled.add(bookId);
updateString("equipBookEnabled", equipBookEnabled);
}
public ItemManager() {
this.setRootCollection(User._COLLECTION_NAME);

View File

@ -366,7 +366,8 @@ public class HeroLogic{
}
//特殊活动寻宝迷踪
if(sLotterySetting.getActivityId() == 8201){
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(sLotterySetting.getActivityId());
if(sGlobalActivity!= null &&sGlobalActivity.getType() == 82 ){
Poster.getPoster().dispatchEvent(new XunBaoMiZongEvent(user,0));
}
@ -2305,6 +2306,9 @@ public class HeroLogic{
//魂印图鉴加成
Set<Integer> equipBookEnabled = equipManager.getEquipBookEnabled();
bonuses(equipBookEnabled,heroAllAttribute);
//白金装备加成
Set<Integer> whiteBookEnabled = user.getItemManager().getEquipBookEnabled();
bonuses(whiteBookEnabled,heroAllAttribute);
//英雄皮肤加成 记得判断皮肤过期
int skin = hero.getSkin();
if(skin!=0){
@ -3876,9 +3880,33 @@ public class HeroLogic{
for (int enabled:user.getEquipManager().getEquipBookEnabled()){
builder.addAllBookEnabled(enabled);
}
//添加白金装备羁绊
for (Integer enabled : user.getItemManager().getEquipBookEnabled()) {
builder.addAllBookEnabled(enabled);
}
for (Integer equip:equipManager.getEquipList()) {
builder.addEquipGot(equip);
}
if (!user.getItemManager().getIsAbsEquip()) {
for (Map.Entry<Integer, Item> equipEntry : user.getItemManager().getItemMap().entrySet()) {
if (SItem.getsItemMap().get(equipEntry.getKey()).getItemType()==3) {
user.getItemManager().setEquipBookMap(equipEntry.getValue().getItemId(),equipEntry.getValue().getItemNum());
}
}
for (Map.Entry<String, Hero> stringHeroEntry : user.getHeroManager().getHeroMap().entrySet()) {
for (Map.Entry<Integer, Integer> entry : stringHeroEntry.getValue().getEquipByPositionMap().entrySet()) {
user.getItemManager().setEquipBookMap(entry.getValue(),1);
}
}
user.getItemManager().setAbsEquip(true);
}
for (Map.Entry<Integer, Long> entry : user.getItemManager().getEquipBookMap().entrySet()) {
CommonProto.EquipBookInfo equipBook=CommonProto.EquipBookInfo.newBuilder()
.setEquipId(entry.getKey())
.setNum(entry.getValue().intValue())
.build();
builder.addEquipList(equipBook);
}
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE_VALUE,builder.build(),true);
}
@ -3899,7 +3927,7 @@ public class HeroLogic{
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] teamers = bookConfig.getTeamers();
int[][] teamers = bookConfig.getTeamers();
int[][] reward = bookConfig.getReward();
CommonProto.Drop.Builder drop = null;
//神将激活
@ -3917,9 +3945,8 @@ public class HeroLogic{
}
}
//判断羁绊神将是否在集合
for(int tmp:teamers){
if(!hero.contains(tmp)){
System.out.println(tmp);
for(int[]tmp:teamers){
if(!hero.contains(tmp[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
@ -3934,8 +3961,8 @@ public class HeroLogic{
if(equipManager.getEquipBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for (int equip:teamers){
if (!equipManager.getEquipList().contains(equip)){
for (int[]equip:teamers){
if (!equipManager.getEquipList().contains(equip[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
@ -3949,14 +3976,29 @@ public class HeroLogic{
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for(int pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon)){
for(int[]pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon[0])){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
pokemonManager.addPokemonBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
//白金装备激活
if(bookConfig.getFetterType()==4){
ItemManager itemManager = user.getItemManager();
if(itemManager.getEquipBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for(int[]pokemon:teamers){
if(!itemManager.getEquipBookMap().containsKey(pokemon[0])||itemManager.getEquipBookMap().get(pokemon[0])<pokemon[1]){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
itemManager.addEquipBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
PlayerInfoProto.UseAndPriceItemResponse.Builder useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder();
if (drop != null) {
useAndPriceItemResponse.setDrop(drop);

View File

@ -352,9 +352,12 @@ public class BuyGoodsNewLogic {
String subKey = RedisUtil.getInstence().getKey(String.valueOf(user.getId()), String.valueOf(ActivityType.DAILY_RECHARGE),false);
String key = RedisUtil.getInstence().getKey(RedisKey.WEB_PAY, subKey);
// 计算金额
double num = Optional.ofNullable(RedisUtil.getInstence().get(key))
.map(v-> (double)v + price)
.orElse(price);
Object o = RedisUtil.getInstence().get(key);
double num = price;
if (o != null) {
num = Double.parseDouble((String) o) + price;
}
// 明天零点实际是今天的235930
long tomorrowZero = TimeUtils.getTomorrowZero2();
// 赋值

View File

@ -511,7 +511,7 @@ public class StoreLogic implements IEventHandler {
// add += orDefault;
// }
// }
dropItems[i][1] = ((goods[i][1] + levelAdd) * itemNum * (add / 10000));
dropItems[i][1] = ((goods[i][1] + levelAdd) * itemNum * (add / 1000)) / 10;
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.STORE_BUY_ITEM);
if(!storeGiftType.contains(SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId).getStoreType() )){

View File

@ -33,6 +33,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import config.SGameSetting;
@ -598,12 +599,19 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();
if(itemNum <= 0){
@ -680,6 +688,9 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -720,12 +731,19 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();
@ -803,6 +821,10 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -826,8 +848,25 @@ public class ItemUtil {
return 1;
}
///发送装备图鉴修改推送
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
if (_equipList==null||_equipList.isEmpty())return;
List<CommonProto.EquipBookInfo>equipList=new ArrayList<>();
for (Integer integer : _equipList) {
if (_itemManage.getEquipBookMap().containsKey(integer)) {
CommonProto.EquipBookInfo equipInfo=CommonProto.EquipBookInfo.newBuilder()
.setEquipId(integer)
.setNum(_itemManage.getEquipBookMap().get(integer).intValue())
.build();
equipList.add(equipInfo);
}
}
HeroInfoProto.EquipBookIndication build=HeroInfoProto.EquipBookIndication.newBuilder()
.addAllChangeEquipList(equipList)
.build();
ISession sessionByUid = OnlineUserManager.getSessionByUid(_uid);
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.EQUIP_BOOK_INDICATION_VALUE,build,true);
}
/**
* //zsx 保留 TODO 由事件分发到 playlogic 去处理

View File

@ -10,7 +10,7 @@ public class SSpiritAnimalBook implements BaseConfig {
private int id;
private int[] teamers;
private int[][] teamers;
private int[][] activePara;
@ -33,7 +33,7 @@ public class SSpiritAnimalBook implements BaseConfig {
return id;
}
public int[] getTeamers() {
public int[][] getTeamers() {
return teamers;
}