完善法相逻辑
parent
071219b068
commit
2ebfee79bd
|
@ -14,6 +14,6 @@ public class StrongthenFaxiangEquipHandler extends BaseHandler<PlayerInfoProto.S
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.StrongthenFaxiangEquipRequest proto) throws Exception {
|
||||
EquipLogic.getInstance().strongthenFaxiangEquip(iSession.getUid(),proto.getFaxiangID(), proto.getTargetLv(), proto.getAction());
|
||||
EquipLogic.getInstance().strongthenFaxiangEquip(iSession,proto.getFaxiangID(), proto.getTargetLv(), proto.getAction());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
public class WearFaxiangEquipHandler extends BaseHandler<PlayerInfoProto.WearFaxiangEquipRequest> {
|
||||
public class WearFaxiangEquipHandler extends BaseHandler<PlayerInfoProto.WearFaxiangEquipRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.WEAR_FAXIANG_EQUIP_REQUEST;
|
||||
|
@ -14,6 +14,6 @@ public class WearFaxiangEquipHandler extends BaseHandler<PlayerInfoProto.WearFa
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.WearFaxiangEquipRequest proto) throws Exception {
|
||||
EquipLogic.getInstance().wearFaxiangEquip(iSession.getUid(),proto.getHeroID(),proto.getFaxiangID(),proto.getAction());
|
||||
EquipLogic.getInstance().wearFaxiangEquip(iSession,proto.getHeroID(),proto.getFaxiangID(),proto.getAction());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,12 @@ import com.ljsd.jieling.logic.mail.MailLogic;
|
|||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalActivity;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -33,7 +34,6 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
User user = getUser();
|
||||
if("hotfix".equals(args[2])){
|
||||
LOGGER.info("hotfix user={},thread={}",user.getId(),Thread.currentThread().getName());
|
||||
// MongoUtil.getLjsdMongoTemplate().save(user);
|
||||
}
|
||||
if("force".equals(args[2])){
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||
|
@ -53,7 +53,6 @@ public class Cmd_changename extends GmRoleAbstract {
|
|||
UserManager.addUser(user);
|
||||
LOGGER.info("cmd_________reload:");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if("shop".equals(args[2])){
|
||||
|
|
|
@ -36,14 +36,9 @@ public class EquipLogic {
|
|||
|
||||
/**
|
||||
* 穿脱法相装备
|
||||
* @param uid
|
||||
* @param heroID
|
||||
* @param faxiangID
|
||||
* @param action
|
||||
* @throws Exception
|
||||
*/
|
||||
public void wearFaxiangEquip(int uid, String heroID, String faxiangID, int action) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
public void wearFaxiangEquip(ISession session, String heroID, String faxiangID, int action) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
Hero hero = user.getHeroManager().getHero(heroID);
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"英雄不存在:"+heroID);
|
||||
|
@ -70,13 +65,13 @@ public class EquipLogic {
|
|||
Faxiang faxiang1 = equipManager.getFaxiang(faxiangId);
|
||||
if (faxiang1 == null){
|
||||
hero.uninstallFaxiang(faxiangId);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",uid,heroID,faxiangID);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",user.getId(),heroID,faxiangID);
|
||||
continue;
|
||||
}
|
||||
SFaxiangConfig faxiangConfig1 = faxiangMap.get(faxiang1.getItemId());
|
||||
if (faxiangConfig1 == null){
|
||||
hero.uninstallFaxiang(faxiangId);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",uid,heroID,faxiangID);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",user.getId(),heroID,faxiangID);
|
||||
continue;
|
||||
}
|
||||
if (faxiangConfig.getType() == faxiangConfig1.getType()){
|
||||
|
@ -105,17 +100,14 @@ public class EquipLogic {
|
|||
}
|
||||
hero.uninstallFaxiang(faxiangID);
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.WEAR_FAXIANG_EQUIP_RESPONSE_VALUE, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强化法相,或法相升星
|
||||
* @param uid
|
||||
* @param faxiangID
|
||||
* @param action
|
||||
* @throws Exception
|
||||
*/
|
||||
public void strongthenFaxiangEquip(int uid, String faxiangID, int targetLv, int action) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
public void strongthenFaxiangEquip(ISession session, String faxiangID, int targetLv, int action) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Faxiang faxiang = equipManager.getFaxiang(faxiangID);
|
||||
if (faxiang == null){
|
||||
|
@ -201,18 +193,15 @@ public class EquipLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"SFaxiangLevelConfig 升级道具数量不足:"+faxiang.getStrongLv());
|
||||
}
|
||||
faxiang.setStar(targetLv);
|
||||
ItemUtil.itemCostLong(user,costMap, BIReason.UP_FAXIANG_EQUIP_LV_COST,0);
|
||||
ItemUtil.itemCostLong(user,costMap, BIReason.UP_FAXIANG_EQUIP_STAR_COST,0);
|
||||
costFaxiang(user, equipCostStr.toString(), true);
|
||||
}
|
||||
equipManager.putFaxiang(faxiang);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.STRONGTHEN_FAXIANG_EQUIP_RESPONSE_VALUE, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗法相道具
|
||||
* @param user
|
||||
* @param costStr
|
||||
* @param cost
|
||||
* @return
|
||||
*/
|
||||
private boolean costFaxiang(User user, String costStr, boolean cost){
|
||||
if (costStr == null || costStr.isEmpty()){
|
||||
|
@ -254,9 +243,6 @@ public class EquipLogic {
|
|||
|
||||
/**
|
||||
* 获取全部法相道具
|
||||
* @param iSession
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getAllFaxiangEquip(ISession iSession, int page) throws Exception {
|
||||
int pageNum = 20;
|
||||
|
|
Loading…
Reference in New Issue