皮肤 头像修改
parent
aa94e3bc5b
commit
7232b8604a
|
@ -156,7 +156,7 @@ public interface BIReason {
|
|||
|
||||
int SPECIAL_MONSTER_REWARD = 88;//灵兽涅槃获得
|
||||
int SPECIAL_FREE_PIECE_REWARD = 89;//灵兽放生获得
|
||||
|
||||
int SKIN_USE_REWARD = 90;//激活皮肤获得头像
|
||||
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||
|
|
|
@ -3250,16 +3250,18 @@ public class HeroLogic{
|
|||
public void changeSkin(ISession session,String heroId,int skinId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
|
||||
if(!skinInfo.containsKey(skinId)||(skinInfo.get(skinId)!=-1&&skinInfo.get(skinId)<TimeUtils.nowInt())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
if(hero==null||hero.getSkin()==skinId){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skinId);
|
||||
if(sHeroSkin==null||sHeroSkin.getHeroId()!=hero.getTemplateId()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
if(skinId!=0){
|
||||
if(!skinInfo.containsKey(skinId)||(skinInfo.get(skinId)!=-1&&skinInfo.get(skinId)<TimeUtils.nowInt())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if(hero==null||hero.getSkin()==skinId){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skinId);
|
||||
if(sHeroSkin==null||sHeroSkin.getHeroId()!=hero.getTemplateId()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
|
||||
hero.setSkin(skinId);
|
||||
|
|
|
@ -187,17 +187,17 @@ public class ItemLogic {
|
|||
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||
}
|
||||
|
||||
private void useHeroSkin(ISession session,User user,CommonProto.Item item) throws ErrorCodeException {
|
||||
private void useHeroSkin(ISession session,User user,CommonProto.Item item) throws Exception {
|
||||
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
|
||||
SHeroSkin sHeroSkin = STableManager.getConfig(SHeroSkin.class).get(item.getItemId());
|
||||
if(sHeroSkin==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if(skinInfo.containsKey(item.getItemId())){
|
||||
if(skinInfo.get(item.getItemId())==-1||skinInfo.get(item.getItemId())> TimeUtils.nowInt()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
// if(skinInfo.containsKey(sHeroSkin.getType())){
|
||||
// if(skinInfo.get(sHeroSkin.getType())==-1||skinInfo.get(sHeroSkin.getType())> TimeUtils.nowInt()){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
int time;
|
||||
if(sHeroSkin.getTime()==0){
|
||||
time = -1;
|
||||
|
@ -205,6 +205,7 @@ public class ItemLogic {
|
|||
time = sHeroSkin.getTime()+TimeUtils.nowInt();
|
||||
}
|
||||
user.getHeroManager().addSkin(sHeroSkin.getType(),time);
|
||||
ItemUtil.drop(user,new int[][]{sHeroSkin.getHeadIcon()},BIReason.SKIN_USE_REWARD);
|
||||
HeroInfoProto.GetSkinIndication indication = HeroInfoProto.GetSkinIndication.newBuilder()
|
||||
.setSkinInfo(CommonProto.SkinInfo.newBuilder().setSkinId(sHeroSkin.getType()).setOverTime(time))
|
||||
.build();
|
||||
|
|
|
@ -29,6 +29,8 @@ public class SHeroSkin implements BaseConfig {
|
|||
|
||||
private int[] price;
|
||||
|
||||
private int[] headIcon;
|
||||
|
||||
|
||||
public static Map<Integer,SHeroSkin> skinMapByType;
|
||||
|
||||
|
@ -89,5 +91,7 @@ public class SHeroSkin implements BaseConfig {
|
|||
return price;
|
||||
}
|
||||
|
||||
|
||||
public int[] getHeadIcon() {
|
||||
return headIcon;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue