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