命格脚本优化
parent
f06acc6801
commit
2028b3cfe2
|
@ -4,6 +4,8 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -75,6 +77,7 @@ public class LifeGridChangeRequestHandler extends BaseHandler<HeroInfoProto.Life
|
|||
.build();
|
||||
response=HeroInfoProto.LifeGridChangeResponse.newBuilder().setLifeGridInfo(lifeGridInfo).build();
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.LIFE_GRID_CHANGE_RESPONSE_VALUE,response,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.ItemManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -45,6 +47,9 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
int itemId = proto.getCurGemId();
|
||||
int itemNum = proto.getSelectNum();
|
||||
SGemConfig gemConfig = STableManager.getConfig(SGemConfig.class).get(itemId);
|
||||
if (itemNum%gemConfig.getUpgradeNum()>0){
|
||||
itemNum=itemNum-(itemNum%gemConfig.getUpgradeNum());
|
||||
}
|
||||
long upNum = itemNum / gemConfig.getUpgradeNum();
|
||||
long costGold = upNum * gemConfig.getUpgradeCost()[1];
|
||||
costItemMap.put(gemConfig.getUpgradeCost()[0], costGold);
|
||||
|
@ -62,7 +67,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
int itemNum = proto.getSelectNum();
|
||||
SGemConfig gemConfig = STableManager.getConfig(SGemConfig.class).get(itemId);
|
||||
costItemMap.put(gemConfig.getUpgradeCost()[0], (long) gemConfig.getUpgradeCost()[1]);
|
||||
if (proto.getGridId() > 0) {
|
||||
if (proto.getGridIndex() > 0) {
|
||||
costItemMap.put(itemId, (long) itemNum);
|
||||
equipLifeStoneId = gemConfig.getNextGem();
|
||||
} else {
|
||||
|
@ -77,14 +82,14 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
int[] curUpCost = gemConfig.getUpgradeCost();
|
||||
long allGoldCost = costItemMap.get(curUpCost[0]) + curUpCost[1];
|
||||
costItemMap.put(curUpCost[0], allGoldCost);
|
||||
if (proto.getGridId() > 0) {
|
||||
if (proto.getGridIndex() > 0) {
|
||||
equipLifeStoneId = gemConfig.getNextGem();
|
||||
} else {
|
||||
addItemMap.put(gemConfig.getNextGem(), 1L);
|
||||
costItemMap.put(proto.getCurGemId(), 1L);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("命石合成材料不足");
|
||||
LOGGER.error("快速合成:命石合成材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +117,7 @@ public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeSto
|
|||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, addItem, BIReason.LIFE_STONE_UP);
|
||||
response.setDrop(drop.build());
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.LIFE_STONE_UP_RESPONSE_VALUE, response.build(), true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue