新增图鉴类型
parent
e9327ca378
commit
b2223b8a04
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.bookImage;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
@Component
|
||||
public class QueryBookImageHandler extends BaseHandler<HeroInfoProto.QueryBookImageRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.QueryBookImageRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.QueryBookImageRequest proto) throws Exception {
|
||||
HeroLogic.getInstance().queryBookImage(iSession,proto.getType());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package com.ljsd.jieling.handler.magicSolder;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.fight.DuoduiTowerLogic;
|
||||
import com.ljsd.jieling.logic.magicSoldier.MagicSoldierLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.FightInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
@Component
|
||||
public class MagicSolderInfoHandler extends BaseHandler<PlayerInfoProto.MagicSoldierInfoRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
|
|
|||
|
|
@ -412,7 +412,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
.setActivityId(id);
|
||||
builder.setActivityInfo(builder1);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_PROGRESS_INDICATION_VALUE, builder.build(), true);
|
||||
|
||||
}
|
||||
|
||||
public void sendActivityProgress(User user, Set<Integer> filterMissId) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.BaublesBookNumEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
|
@ -27,6 +31,19 @@ public class BaublesBookNumActivity extends AbstractActivity {
|
|||
|
||||
BaublesBookNumActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, BaublesBookNumEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof BaublesBookNumEvent)) {
|
||||
return;
|
||||
}
|
||||
BaublesBookNumEvent event1 = (BaublesBookNumEvent) event;
|
||||
User user = UserManager.getUser(event1.getUid());
|
||||
// 客户端推送
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(session, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -50,7 +67,7 @@ public class BaublesBookNumActivity extends AbstractActivity {
|
|||
if (rewardConfigs == null){
|
||||
return missionInfo;
|
||||
}
|
||||
int num = user.getEquipManager().getBaublesBookList().size();
|
||||
int num = user.getEquipManager().getBaublesBookEnabled().size();
|
||||
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityMissionMap();
|
||||
for (SActivityRewardConfig config : rewardConfigs) {
|
||||
int missionId = config.getId();
|
||||
|
|
@ -114,7 +131,7 @@ public class BaublesBookNumActivity extends AbstractActivity {
|
|||
* 验证奖励是否可以领取
|
||||
*/
|
||||
boolean checkRewardsProcess(User user, SActivityRewardConfig rewardConfig) {
|
||||
int size = user.getEquipManager().getBaublesBookList().size();
|
||||
int size = user.getEquipManager().getBaublesBookEnabled().size();
|
||||
return size >= rewardConfig.getValues()[0][0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public class SuperFundNewActivity extends AbstractActivity {
|
|||
// 获取信息
|
||||
SuperBoxEvent event1 = (SuperBoxEvent) event;
|
||||
User user = UserManager.getUser(event1.getUserId());
|
||||
LOGGER.info("超值基金接收到监听器...uid={} activityId={}",user.getId(), id);
|
||||
// 活动数据处理
|
||||
updateValue(user,event1.getGiftId());
|
||||
// 零点刷新
|
||||
|
|
@ -98,15 +99,23 @@ public class SuperFundNewActivity extends AbstractActivity {
|
|||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
// 礼包是否已购买
|
||||
if (mission == null || mission.getV() == finish){
|
||||
if (mission != null) {
|
||||
LOGGER.error("超值基金活动退出,活动属于已购买,id:{},v:{}",id,mission.getV());
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 旧信息兼容
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
// 已购买基金
|
||||
if (bagInfo != null && bagInfo.isBought()){
|
||||
if (bagInfo != null && bagInfo.isBuyBefore()){
|
||||
// 初始化基金
|
||||
mission.setV(finish);
|
||||
mission.setCreatTime(TimeUtils.now());
|
||||
LOGGER.error("超值基金活动,修正活动信息,id:{},v:{}",id,mission.getV());
|
||||
}else {
|
||||
if (bagInfo != null) {
|
||||
LOGGER.error("超值基金活动退出,礼包未购买,id:{},buy:{}",id,bagInfo.isBuyBefore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,12 +207,12 @@ public class SuperFundNewActivity extends AbstractActivity {
|
|||
private ReceiveWelfareBag getBagInfo(User user){
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (activity == null){
|
||||
LOGGER.error("活动信息不存在,活动id:{}",id);
|
||||
LOGGER.error("超值基金活动信息不存在,活动id:{}",id);
|
||||
return null;
|
||||
}
|
||||
AbstractWelfareBag welfareBag = user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(activity.getCanBuyRechargeId()[0]);
|
||||
if (welfareBag == null){
|
||||
LOGGER.info("礼包未购买,活动id:{},礼包id:{}",id,activity.getCanBuyRechargeId()[0]);
|
||||
LOGGER.info("超值基金活动礼包未购买,活动id:{},礼包id:{}",id,activity.getCanBuyRechargeId()[0]);
|
||||
return null;
|
||||
}
|
||||
return (ReceiveWelfareBag)welfareBag;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
public class BaublesBookNumEvent implements IEvent {
|
||||
private int uid;
|
||||
|
||||
public BaublesBookNumEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,8 @@ public class EquipManager extends MongoBase {
|
|||
private Set<Integer> baublesBookList = new HashSet<>();// 全部法宝图鉴
|
||||
private Set<Integer> baublesBookEnabled = new HashSet<>();// 法宝激活图鉴
|
||||
private Set<Integer> soulGealList = new HashSet<>();// 魂印列表
|
||||
private Set<Integer> faxiangRecordList = new HashSet<>();// 全部法相图鉴
|
||||
private Set<Integer> faxiangEnabled = new HashSet<>();// 法相激活图鉴
|
||||
private Map<Integer, GemNew> gemNewMap = new HashMap<>();// 潜能列表
|
||||
private int soulEquipPool;//占星装备卡池
|
||||
|
||||
|
|
@ -222,4 +224,32 @@ public class EquipManager extends MongoBase {
|
|||
this.baublesBookList.add(id);
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
|
||||
public Set<Integer> getFaxiangRecordList() {
|
||||
return faxiangRecordList;
|
||||
}
|
||||
|
||||
public void setFaxiangRecordList(Set<Integer> faxiangRecordList) {
|
||||
this.faxiangRecordList = faxiangRecordList;
|
||||
updateString("faxiangRecordList",faxiangRecordList);
|
||||
}
|
||||
|
||||
public void addFaxiangRecord(int id) {
|
||||
this.faxiangRecordList.add(id);
|
||||
updateString("faxiangRecordList",faxiangRecordList);
|
||||
}
|
||||
|
||||
public Set<Integer> getFaxiangEnabled() {
|
||||
return faxiangEnabled;
|
||||
}
|
||||
|
||||
public void setFaxiangEnabled(Set<Integer> faxiangEnabled) {
|
||||
this.faxiangEnabled = faxiangEnabled;
|
||||
updateString("baublesBookEnabled",baublesBookEnabled);
|
||||
}
|
||||
|
||||
public void addFaxiangEnabled(int id) {
|
||||
this.faxiangEnabled.add(id);
|
||||
updateString("faxiangEnabled",faxiangEnabled);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,12 @@ public class ItemManager extends MongoBase {
|
|||
|
||||
|
||||
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
|
||||
///兼容线上数据,计算统计装备(为了做白金装备图鉴,需要初始化统计一次用户身上所有装备)true:已经计算过了 false:未计算
|
||||
private boolean isAbsEquip;
|
||||
private boolean isAbsEquip;//兼容线上数据,计算统计装备(为了做白金装备图鉴,需要初始化统计一次用户身上所有装备)true:已经计算过了 false:未计算
|
||||
private Map<Integer, Long> equipBookMap = new HashMap<>();
|
||||
private Set<Integer> equipBookEnabled = new HashSet<>();
|
||||
|
||||
private Set<Integer> huashenRecordList = new HashSet<>();// 全部身外化身图鉴
|
||||
private Set<Integer> huashenEnabled = new HashSet<>();// 身外化身激活图鉴
|
||||
|
||||
public boolean getIsAbsEquip() {
|
||||
return isAbsEquip;
|
||||
|
|
@ -24,8 +28,6 @@ public class ItemManager extends MongoBase {
|
|||
updateString("isAbsEquip", isAbsEquip);
|
||||
}
|
||||
|
||||
private Map<Integer, Long> equipBookMap = new HashMap<>();
|
||||
|
||||
public Map<Integer, Long> getEquipBookMap() {
|
||||
return equipBookMap;
|
||||
}
|
||||
|
|
@ -37,7 +39,16 @@ public class ItemManager extends MongoBase {
|
|||
this.equipBookMap.put(equipId,_num);
|
||||
updateString("equipBookMap." + equipId, _num);
|
||||
}
|
||||
private Set<Integer> equipBookEnabled = new HashSet<>();
|
||||
|
||||
public void setEquipBookMap(Map<Integer, Long> equipBookMap) {
|
||||
this.equipBookMap = equipBookMap;
|
||||
updateString("equipBookMap", equipBookMap);
|
||||
}
|
||||
|
||||
public void setEquipBookEnabled(Set<Integer> equipBookEnabled) {
|
||||
this.equipBookEnabled = equipBookEnabled;
|
||||
updateString("equipBookEnabled", equipBookEnabled);
|
||||
}
|
||||
|
||||
public Set<Integer> getEquipBookEnabled() {
|
||||
return equipBookEnabled;
|
||||
|
|
@ -83,4 +94,32 @@ public class ItemManager extends MongoBase {
|
|||
addItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
public Set<Integer> getHuashenRecordList() {
|
||||
return huashenRecordList;
|
||||
}
|
||||
|
||||
public void setHuashenRecordList(Set<Integer> huashenRecordList) {
|
||||
this.huashenRecordList = huashenRecordList;
|
||||
updateString("huashenRecordList", huashenRecordList);
|
||||
}
|
||||
|
||||
public void addHuashenRecord(int id) {
|
||||
this.huashenRecordList.add(id);
|
||||
updateString("huashenRecordList", huashenRecordList);
|
||||
}
|
||||
|
||||
public Set<Integer> getHuashenEnabled() {
|
||||
return huashenEnabled;
|
||||
}
|
||||
|
||||
public void setHuashenEnabled(Set<Integer> huashenEnabled) {
|
||||
this.huashenEnabled = huashenEnabled;
|
||||
updateString("huashenEnabled", huashenEnabled);
|
||||
}
|
||||
|
||||
public void addHuashenEnabled(int id) {
|
||||
this.huashenEnabled.add(id);
|
||||
updateString("huashenEnabled", huashenEnabled);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,23 +361,7 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
private static MagicSoldierManager magicSoldierCheck(int bookId, User user, int[][] tamers) throws ErrorCodeException {
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
if (soldierManager.getMagicSoldierBook().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
for (int[] soldier : tamers) {
|
||||
if (!soldierManager.getMagicSoldierRecord().contains(soldier[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
return soldierManager;
|
||||
}
|
||||
|
||||
private static Set<Integer> getHeroHands(int bookId, HeroManager heroManager) throws ErrorCodeException {
|
||||
if (heroManager.getHeroHandBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
private static Set<Integer> getHeroHands(HeroManager heroManager) {
|
||||
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
|
||||
Set<Integer> hero = new HashSet<>();
|
||||
//将拥有的神将放到set集和中
|
||||
|
|
@ -5189,7 +5173,10 @@ public class HeroLogic {
|
|||
|
||||
switch (bookConfig.getFetterType()) {
|
||||
case 1://神将激活
|
||||
Set<Integer> hero = getHeroHands(bookId, heroManager);
|
||||
if (heroManager.getHeroHandBookEnabled().contains(bookId)) {
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
Set<Integer> hero = getHeroHands(heroManager);
|
||||
//判断羁绊神将是否在集合
|
||||
for (int[] tmp : tamers) {
|
||||
if (!hero.contains(tmp[0])) {
|
||||
|
|
@ -5256,6 +5243,31 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
equipManager.addBaublesBookEnabled(bookId);
|
||||
Poster.getPoster().dispatchEvent(new BaublesBookNumEvent(user.getId()));
|
||||
break;
|
||||
case 7://法相图鉴激活
|
||||
Set<Integer> faxiangEnabled = equipManager.getFaxiangEnabled();
|
||||
if (faxiangEnabled.contains(bookId)) {
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] equip : tamers) {
|
||||
if (!equipManager.getFaxiangRecordList().contains(equip[0])){
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
equipManager.addFaxiangEnabled(bookId);
|
||||
break;
|
||||
case 8://身外化身图鉴激活
|
||||
Set<Integer> huashenEnabled = itemManager.getHuashenEnabled();
|
||||
if (huashenEnabled.contains(bookId)) {
|
||||
throw new ErrorTableException(165);//已激活
|
||||
}
|
||||
for (int[] equip : tamers) {
|
||||
if (!itemManager.getHuashenRecordList().contains(equip[0])){
|
||||
throw new ErrorTableException(166);//条件不足
|
||||
}
|
||||
}
|
||||
itemManager.addHuashenEnabled(bookId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -6524,7 +6536,7 @@ public class HeroLogic {
|
|||
* @param averageNum
|
||||
* @return
|
||||
*/
|
||||
public int getAverageLevel(User user, int averageNum) throws ErrorCodeException {
|
||||
public int getAverageLevel(User user, int averageNum) {
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
// 获取平均数量
|
||||
int num = Math.min(heroManager.getHeroMap().size(), averageNum);
|
||||
|
|
@ -7322,6 +7334,55 @@ public class HeroLogic {
|
|||
heroManager.putTrumpBookStar(bookId, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图鉴信息
|
||||
* @param iSession
|
||||
* @param type
|
||||
* @throws Exception
|
||||
*/
|
||||
public void queryBookImage(ISession iSession, int type) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
HeroInfoProto.QueryBookImageResponse.Builder builder = HeroInfoProto.QueryBookImageResponse.newBuilder();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
// 神将
|
||||
if (type == 0 || type == 1){
|
||||
builder.addAllBookImgIds(getHeroHands(heroManager));
|
||||
}
|
||||
// 魂印
|
||||
if (type == 0 || type == 2){
|
||||
builder.addAllBookImgIds(equipManager.getSoulGealList());
|
||||
}
|
||||
// 灵兽
|
||||
if (type == 0 || type == 3){
|
||||
builder.addAllBookImgIds(pokemonManager.getPokemonGot());
|
||||
}
|
||||
// 装备
|
||||
if (type == 0 || type == 4){
|
||||
builder.addAllBookImgIds(itemManager.getEquipBookMap().keySet());
|
||||
}
|
||||
// 神兵
|
||||
if (type == 0 || type == 5){
|
||||
builder.addAllBookImgIds(soldierManager.getMagicSoldierRecord());
|
||||
}
|
||||
// 法宝
|
||||
if (type == 0 || type == 6){
|
||||
builder.addAllBookImgIds(equipManager.getBaublesBookList());
|
||||
}
|
||||
// 法相
|
||||
if (type == 0 || type == 7){
|
||||
builder.addAllBookImgIds(equipManager.getFaxiangRecordList());
|
||||
}
|
||||
// 身外化身
|
||||
if (type == 0 || type == 8){
|
||||
builder.addAllBookImgIds(itemManager.getHuashenRecordList());
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.QueryBookImageResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static HeroLogic instance = new HeroLogic();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -775,7 +775,8 @@ public class ItemUtil {
|
|||
equipManager.addSoulGeal(itemId);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GOT_SOUL_MARK, id, (int) itemNum);
|
||||
break;
|
||||
case GlobalItemType.TRANSFORMATION_CARD://东海寻仙
|
||||
case GlobalItemType.TRANSFORMATION_CARD://身外化身
|
||||
itemManager.addHuashenRecord(itemId);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GET_TRANSFIGURATION_CARD_NUM, sItem.getQuantity(), (int) itemNum);
|
||||
break;
|
||||
default:break;
|
||||
|
|
@ -1238,11 +1239,16 @@ public class ItemUtil {
|
|||
EquipManager equipManager = user.getEquipManager();
|
||||
SItem item = SItem.getsItemMap().get(equipId);
|
||||
PropertyItem equip;
|
||||
if (item.getItemType() == GlobalItemType.ESPECIAL_EQUIP){
|
||||
equip = new Baubles(user.getId(), equipId);
|
||||
user.getEquipManager().addBaublesBookList(equipId);
|
||||
}else {
|
||||
equip = new PropertyItem(user.getId(), equipId);
|
||||
switch (item.getItemType()){
|
||||
case GlobalItemType.ESPECIAL_EQUIP:
|
||||
equip = new Baubles(user.getId(), equipId);
|
||||
equipManager.addBaublesBookList(equipId);
|
||||
break;
|
||||
case GlobalItemType.FAXIANG_EQUIP:
|
||||
equipManager.addFaxiangRecord(equipId);
|
||||
default:
|
||||
equip = new PropertyItem(user.getId(), equipId);
|
||||
break;
|
||||
}
|
||||
equipManager.addEquip(equip);
|
||||
jewelList.add(CBean2Proto.getPropertyEquipProto(equip));
|
||||
|
|
|
|||
Loading…
Reference in New Issue