七界秘宝修改
parent
8692f5829f
commit
9c8f867c91
|
|
@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
|||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
|
|
@ -38,6 +39,10 @@ public class SevenWorldActivity extends AbstractActivity {
|
|||
* 礼包id
|
||||
*/
|
||||
private static final int GIFT = 108;
|
||||
/**
|
||||
* 七界秘宝积分
|
||||
*/
|
||||
private static final int FIRST_CHECKPOINT = 1001;
|
||||
|
||||
SevenWorldActivity(int id) {
|
||||
super(id);
|
||||
|
|
@ -80,47 +85,53 @@ public class SevenWorldActivity extends AbstractActivity {
|
|||
}
|
||||
// 七界秘宝积分
|
||||
if (param2 > 0){
|
||||
mission.setV(mission.getV()+param2);
|
||||
int integralId = STableManager.getConfig(SQijieStage.class).get(FIRST_CHECKPOINT).getTreasureIntegral()[0];
|
||||
ItemUtil.drop(user,new int[][]{{integralId,param2}},BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
}
|
||||
// 状态推送
|
||||
sendActivityProgress(user, mission, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) {
|
||||
public void initActivity(User user) throws Exception {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
Set<Integer> keySet = STableManager.getConfig(SQijieTreasure.class).keySet();
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>(keySet));
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
// 礼包初始化
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(GIFT);
|
||||
if (bag != null){
|
||||
bag.setOpen(true);
|
||||
}
|
||||
ActivityProgressInfo info = new ActivityProgressInfo();
|
||||
// 礼包是否购买的状态
|
||||
info.setState(0);
|
||||
user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap().put(-1,info);
|
||||
|
||||
// 刷新
|
||||
reset(user);
|
||||
LOGGER.info("七界秘宝初始化...{}",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user) throws Exception {
|
||||
// 删除活动积分
|
||||
int removeItemId = STableManager.getConfig(SQijieStage.class).get(1001).getTreasureIntegral()[0];
|
||||
/**
|
||||
* 刷新活动
|
||||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
private void reset(User user) throws Exception {
|
||||
// 删除秘宝积分
|
||||
int removeItemId = STableManager.getConfig(SQijieStage.class).get(FIRST_CHECKPOINT).getTreasureIntegral()[0];
|
||||
Item item = user.getItemManager().getItem(removeItemId);
|
||||
if(item!=null){
|
||||
int[][] cost = {{item.getItemId(), (int) item.getItemNum()}};
|
||||
ItemUtil.itemCost(user,cost,BIReason.SEVEN_WORLD_ACTIVITY_END,id);
|
||||
ItemUtil.itemCost(user,cost,BIReason.SEVEN_WORLD_ACTIVITY_END,-999);
|
||||
}
|
||||
// 礼包重置
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(GIFT);
|
||||
if (bag != null){
|
||||
bag.setOpen(true);
|
||||
bag.refresh();
|
||||
}
|
||||
// 礼包是否购买的状态
|
||||
ActivityProgressInfo info = new ActivityProgressInfo();
|
||||
info.setState(0);
|
||||
user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap().put(-1,info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user){
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -188,8 +199,9 @@ public class SevenWorldActivity extends AbstractActivity {
|
|||
return false;
|
||||
}
|
||||
int[][] integral = treasure.getIntegral();
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
return mission.getV() >= integral[0][1];
|
||||
int integralId = STableManager.getConfig(SQijieStage.class).get(FIRST_CHECKPOINT).getTreasureIntegral()[0];
|
||||
Item item = user.getItemManager().getItem(integralId);
|
||||
return item.getItemNum() >= integral[0][1];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue