坐骑,皮肤,称号
parent
baeb7e03cd
commit
c6df17e07b
|
@ -318,4 +318,7 @@ public interface BIReason {
|
|||
|
||||
|
||||
int USE_HEADFRAME = 1088;// 使用头像框
|
||||
int ACTIVE_USERSKIN = 1089;// 激活玩家皮肤
|
||||
int ACTIVE_TITLE = 1090;// 激活玩家称号
|
||||
int ACTIVE_MOUNT = 1091;// 激活玩家坐骑
|
||||
}
|
|
@ -223,6 +223,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setWorldLeve(GlobleSystemLogic.getGloableWorldLeveCache())
|
||||
.addAllDemonsTrialRewardInfo(user.getMapManager().getDemonsTrialRewardInfo())
|
||||
.addAllHeadFrameBag(CBean2Proto.getHeadFrameList(user))
|
||||
.addAllUserMountList(CBean2Proto.getUserMountList(user))
|
||||
.addAllUserSkinList(CBean2Proto.getUserSkinList(user))
|
||||
.addAllUserTitleList(CBean2Proto.getUserTitleList(user))
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
|
|
|
@ -51,6 +51,10 @@ public class GetMonsterAttackRankHandler extends BaseHandler<PlayerInfoProto.Get
|
|||
.setHead(playerInfoManager.getHead())
|
||||
.setRank(++start)
|
||||
.setUid(uid)
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setSex(playerInfoManager.getSex())
|
||||
.build();
|
||||
monsterRankInfos.add(monsterRankInfo);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
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.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SPlayerHeadIcon;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
public class ActiveUserMountHandler extends BaseHandler<PlayerInfoProto.ActiveUserMountRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ActiveUserMountRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.ActiveUserMountRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
// 玩家坐骑id
|
||||
int mountId = proto.getMountId();
|
||||
// 读配置表
|
||||
SPlayerHeadIcon headIcon = SPlayerHeadIcon.getHeadIconMapByType().get(SPlayerHeadIcon.MountType).get(mountId);
|
||||
if (headIcon == null){
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 验证道具是否足够
|
||||
boolean result = ItemUtil.itemCost(user, new int[][]{{mountId, 1}}, 1, BIReason.ACTIVE_USERSKIN,1);
|
||||
if (!result){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
// 赋值到期时间
|
||||
long now = TimeUtils.now() / 1000;
|
||||
long endTime = 0;
|
||||
// 是否为永久坐骑
|
||||
if (headIcon.getTime() != 0){
|
||||
endTime = now + headIcon.getTime();
|
||||
}
|
||||
user.getPlayerInfoManager().putUserMountValidTime(mountId,endTime);
|
||||
return PlayerInfoProto.ActiveUserMountResponse.newBuilder().setValidTime((int)endTime).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
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.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SPlayerHeadIcon;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
public class ActiveUserSkinHandler extends BaseHandler<PlayerInfoProto.ActiveUserSkinRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ActiveUserSkinRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.ActiveUserSkinRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
// 玩家皮肤id
|
||||
int skinId = proto.getSkinId();
|
||||
// 读配置表
|
||||
SPlayerHeadIcon headIcon = SPlayerHeadIcon.getHeadIconMapByType().get(SPlayerHeadIcon.SkinType).get(skinId);
|
||||
if (headIcon == null){
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 验证道具是否足够
|
||||
boolean result = ItemUtil.itemCost(user, new int[][]{{skinId, 1}}, 1, BIReason.ACTIVE_USERSKIN,1);
|
||||
if (!result){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
// 赋值到期时间
|
||||
long now = TimeUtils.now() / 1000;
|
||||
long endTime = 0;
|
||||
// 是否为永久头像框
|
||||
if (headIcon.getTime() != 0){
|
||||
endTime = now + headIcon.getTime();
|
||||
}
|
||||
user.getPlayerInfoManager().putUserSkinValidTime(skinId,endTime);
|
||||
return PlayerInfoProto.ActiveUserSkinResponse.newBuilder().setValidTime((int)endTime).build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
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.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SPlayerHeadIcon;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
public class ActiveUserTitleHandler extends BaseHandler<PlayerInfoProto.ActiveUserTitleRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ActiveUserTitleRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.ActiveUserTitleRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
// 玩家称号id
|
||||
int titleId = proto.getTitleId();
|
||||
// 读配置表
|
||||
SPlayerHeadIcon headIcon = SPlayerHeadIcon.getHeadIconMapByType().get(SPlayerHeadIcon.TitleType).get(titleId);
|
||||
if (headIcon == null){
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 验证道具是否足够
|
||||
boolean result = ItemUtil.itemCost(user, new int[][]{{titleId, 1}}, 1, BIReason.ACTIVE_USERSKIN,1);
|
||||
if (!result){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
// 赋值到期时间
|
||||
long now = TimeUtils.now() / 1000;
|
||||
long endTime = 0;
|
||||
// 是否为永久称号
|
||||
if (headIcon.getTime() != 0){
|
||||
endTime = now + headIcon.getTime();
|
||||
}
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(titleId,endTime);
|
||||
return PlayerInfoProto.ActiveUserTitleResponse.newBuilder().setValidTime((int)endTime).build();
|
||||
}
|
||||
}
|
|
@ -638,6 +638,9 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
Integer activityId = item.getKey();
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity == null){
|
||||
continue;
|
||||
}
|
||||
int targetActivityType = sGlobalActivity.getType();
|
||||
if (targetActivityType != activityType) {
|
||||
continue;
|
||||
|
@ -1242,6 +1245,10 @@ public class ActivityLogic implements IEventHandler{
|
|||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setHead(playerInfoManager.getHead())
|
||||
.setRank(++start)
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setSex(playerInfoManager.getSex())
|
||||
.build();
|
||||
expertInfos.add(personInfoBuild);
|
||||
}
|
||||
|
|
|
@ -439,6 +439,10 @@ public class ArenaLogic {
|
|||
.setRank(++start)
|
||||
.setTotalForce(totalForce)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setGender(playerInfoManager.getSex())
|
||||
.build();
|
||||
arenaRankMemberInfo.add(CommonProto.ArenaEnemy.newBuilder()
|
||||
.setPersonInfo(personInfoBuild)
|
||||
|
|
|
@ -1217,6 +1217,10 @@ public class ChampionshipLogic {
|
|||
.setTotalForce(totalForce)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setScore(score)
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setGender(playerInfoManager.getSex())
|
||||
.build();
|
||||
return builder.setPersonInfo(personInfoBuild)
|
||||
.build();
|
||||
|
|
|
@ -49,12 +49,6 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int mapId;
|
||||
|
||||
private int designation;//当前称号
|
||||
|
||||
private int ride;//坐骑
|
||||
|
||||
private int decoration;//皮肤
|
||||
|
||||
private int rideLevel;//坐骑等级
|
||||
|
||||
private long createTime; //创建时间
|
||||
|
@ -83,10 +77,22 @@ public class PlayerManager extends MongoBase {
|
|||
private Set<Integer> monthCardDailyTake = new HashSet<>();
|
||||
|
||||
private int headFrame;
|
||||
private int userSkin;
|
||||
private int userTitle;
|
||||
private int userMount;
|
||||
|
||||
// 头像框id,有效时间
|
||||
private Map<Integer,Long> headFrameValidTime = new HashMap<>();
|
||||
|
||||
// 玩家皮肤id,有效时间
|
||||
private Map<Integer,Long> userSkinValidTime = new HashMap<>();
|
||||
|
||||
// 玩家称号id,有效时间
|
||||
private Map<Integer,Long> userTitleValidTime = new HashMap<>();
|
||||
|
||||
// 玩家坐骑id,有效时间
|
||||
private Map<Integer,Long> userMountValidTime = new HashMap<>();
|
||||
|
||||
// 限时头像旧版本兼容
|
||||
private int oldHeadFrame;
|
||||
|
||||
|
@ -529,6 +535,142 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("headFrameValidTime", headFrameValidTime);
|
||||
}
|
||||
|
||||
public int getUserSkin(){
|
||||
if(userSkin == 0){
|
||||
userSkin = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultSuit();
|
||||
userSkinValidTime.put(userSkin,0L);
|
||||
}
|
||||
// 获取玩家皮肤有效时间
|
||||
Long time = userSkinValidTime.getOrDefault(userSkin,0L);
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now() / 1000;
|
||||
// 玩家皮肤不为永久且时间到期
|
||||
if (time != 0 && now >= time){
|
||||
// 删除过期玩家皮肤
|
||||
removeUserSkinValidTime(userSkin);
|
||||
|
||||
// 默认玩家皮肤id
|
||||
int userSkinId = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultSuit();
|
||||
// 赋值默认玩家皮肤
|
||||
setUserSkin(userSkinId);
|
||||
|
||||
return userSkinId;
|
||||
}
|
||||
return userSkin;
|
||||
}
|
||||
|
||||
public void setUserSkin(int userSkin) {
|
||||
updateString("userSkin", userSkin);
|
||||
this.userSkin = userSkin;
|
||||
}
|
||||
|
||||
public Map<Integer, Long> getUserSkinValidTime() {
|
||||
return userSkinValidTime;
|
||||
}
|
||||
|
||||
public void setUserSkinValidTime(Map<Integer, Long> userSkinValidTime) {
|
||||
this.userSkinValidTime = userSkinValidTime;
|
||||
updateString("userSkinValidTime", userSkinValidTime);
|
||||
}
|
||||
|
||||
public void putUserSkinValidTime(int userSkinId,Long time) {
|
||||
userSkinValidTime.put(userSkinId,time);
|
||||
updateString("userSkinValidTime", userSkinValidTime);
|
||||
}
|
||||
|
||||
public void removeUserSkinValidTime(int userSkinId) {
|
||||
userSkinValidTime.remove(userSkinId);
|
||||
updateString("userSkinValidTime", userSkinValidTime);
|
||||
}
|
||||
|
||||
public int getUserTitle() {
|
||||
// 获取称号有效时间
|
||||
Long time = userTitleValidTime.getOrDefault(userTitle,0L);
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now() / 1000;
|
||||
// 称号不为永久且时间到期
|
||||
if (time != 0 && now >= time){
|
||||
// 删除过期称号
|
||||
removeUserTitleValidTime(userTitle);
|
||||
|
||||
// 默认称号id
|
||||
int userTitleId = 0;
|
||||
// 赋值默认称号
|
||||
setUserTitle(userTitleId);
|
||||
|
||||
return userTitleId;
|
||||
}
|
||||
return userTitle;
|
||||
}
|
||||
|
||||
public void setUserTitle(int userTitle) {
|
||||
updateString("userTitle", userTitle);
|
||||
this.userTitle = userTitle;
|
||||
}
|
||||
|
||||
public Map<Integer, Long> getUserTitleValidTime() {
|
||||
return userTitleValidTime;
|
||||
}
|
||||
|
||||
public void setUserTitleValidTime(Map<Integer, Long> userTitleValidTime) {
|
||||
this.userTitleValidTime = userTitleValidTime;
|
||||
updateString("userTitleValidTime", userTitleValidTime);
|
||||
}
|
||||
|
||||
public void putUserTitleValidTime(int userTitle,Long time) {
|
||||
userTitleValidTime.put(userTitle,time);
|
||||
updateString("userTitleValidTime", userTitleValidTime);
|
||||
}
|
||||
|
||||
public void removeUserTitleValidTime(int userTitle) {
|
||||
userTitleValidTime.remove(userTitle);
|
||||
updateString("userTitleValidTime", userTitleValidTime);
|
||||
}
|
||||
|
||||
public int getUserMount() {
|
||||
// 获取坐骑有效时间
|
||||
Long time = userMountValidTime.getOrDefault(userMount,0L);
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now() / 1000;
|
||||
// 坐骑不为永久且时间到期
|
||||
if (time != 0 && now >= time){
|
||||
// 删除过期坐骑
|
||||
removeUserMountValidTime(userMount);
|
||||
|
||||
// 默认坐骑id
|
||||
int userMountId = 0;
|
||||
// 赋值默认坐骑
|
||||
setUserTitle(userMountId);
|
||||
|
||||
return userMountId;
|
||||
}
|
||||
return userMount;
|
||||
}
|
||||
|
||||
public void setUserMount(int userMount) {
|
||||
updateString("userMount", userMount);
|
||||
this.userMount = userMount;
|
||||
}
|
||||
|
||||
public Map<Integer, Long> getUserMountValidTime() {
|
||||
return userMountValidTime;
|
||||
}
|
||||
|
||||
public void setUserMountValidTime(Map<Integer, Long> userMountValidTime) {
|
||||
this.userMountValidTime = userMountValidTime;
|
||||
updateString("userMountValidTime", userMountValidTime);
|
||||
}
|
||||
|
||||
public void putUserMountValidTime(int userMount,Long time) {
|
||||
userMountValidTime.put(userMount,time);
|
||||
updateString("userMountValidTime", userMountValidTime);
|
||||
}
|
||||
|
||||
public void removeUserMountValidTime(int userMount) {
|
||||
userMountValidTime.remove(userMount);
|
||||
updateString("userMountValidTime", userMountValidTime);
|
||||
}
|
||||
|
||||
public int getOldHeadFrame() {
|
||||
return oldHeadFrame;
|
||||
}
|
||||
|
@ -674,37 +816,10 @@ public class PlayerManager extends MongoBase {
|
|||
this.sysMailIds = sysMailIds;
|
||||
}
|
||||
|
||||
public int getDesignation() {
|
||||
return designation;
|
||||
}
|
||||
|
||||
public int getRide() {
|
||||
return ride;
|
||||
}
|
||||
|
||||
public int getRideLevel() {
|
||||
return rideLevel;
|
||||
}
|
||||
|
||||
public int getDecoration() {
|
||||
return decoration;
|
||||
}
|
||||
|
||||
public void setDesignation(int designation) {
|
||||
this.designation = designation;
|
||||
updateString("designation", designation);
|
||||
}
|
||||
|
||||
public void setRide(int ride) {
|
||||
this.ride = ride;
|
||||
updateString("ride", ride);
|
||||
}
|
||||
|
||||
public void setDecoration(int decoration) {
|
||||
this.decoration = decoration;
|
||||
updateString("decoration", decoration);
|
||||
}
|
||||
|
||||
public void setRideLevel(int rideLevel) {
|
||||
this.rideLevel = rideLevel;
|
||||
updateString("rideLevel", rideLevel);
|
||||
|
|
|
@ -130,6 +130,10 @@ public class UserManager {
|
|||
playerManager.setHeadFrame(headFrameId);
|
||||
playerManager.putHeadFrameValidTime(headFrameId,0L);
|
||||
ItemUtil.itemCost(user, new int[][]{{headFrameId, 1}}, 1, BIReason.USE_HEADFRAME,1);
|
||||
int userSkinId = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultSuit();
|
||||
playerManager.setUserSkin(userSkinId);
|
||||
playerManager.putUserSkinValidTime(userSkinId,0L);
|
||||
ItemUtil.itemCost(user, new int[][]{{headFrameId, 1}}, 1, BIReason.ACTIVE_USERSKIN,1);
|
||||
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
|
||||
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
||||
playerManager.setRideLevel(1);
|
||||
|
|
|
@ -1658,6 +1658,18 @@ public class HeroLogic{
|
|||
}
|
||||
}
|
||||
}
|
||||
//玩家皮肤加成
|
||||
for(Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserSkinValidTime().entrySet()){
|
||||
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(),heroAllAttribute);
|
||||
}
|
||||
//玩家称号加成
|
||||
for(Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserTitleValidTime().entrySet()){
|
||||
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(),heroAllAttribute);
|
||||
}
|
||||
//玩家坐骑加成
|
||||
for(Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserMountValidTime().entrySet()){
|
||||
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(),heroAllAttribute);
|
||||
}
|
||||
//装备总战力评分
|
||||
int equipForce=0;
|
||||
boolean needRemove = false;
|
||||
|
@ -1837,21 +1849,21 @@ public class HeroLogic{
|
|||
});
|
||||
|
||||
|
||||
//皮肤、称号加成
|
||||
int decoration = user.getPlayerInfoManager().getDecoration();
|
||||
int designation = user.getPlayerInfoManager().getDesignation();
|
||||
if(decoration!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(decoration)!=null){
|
||||
combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(decoration).getProperty(),heroAllAttribute);
|
||||
}if(designation!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(designation)!=null){
|
||||
combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(designation).getProperty(),heroAllAttribute);
|
||||
}
|
||||
|
||||
//坐骑加成
|
||||
if(user.getPlayerInfoManager().getRide()!=0){
|
||||
int rideLevel = user.getPlayerInfoManager().getRideLevel();
|
||||
int[][] property = SPlayerMountLevelUp.sPlayerMountLevelUpMap.get(rideLevel).getProperty();
|
||||
combinedAttribute(property,heroAllAttribute);
|
||||
}
|
||||
// //皮肤、称号加成
|
||||
// int decoration = user.getPlayerInfoManager().getDecoration();
|
||||
// int designation = user.getPlayerInfoManager().getDesignation();
|
||||
// if(decoration!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(decoration)!=null){
|
||||
// combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(decoration).getProperty(),heroAllAttribute);
|
||||
// }if(designation!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(designation)!=null){
|
||||
// combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(designation).getProperty(),heroAllAttribute);
|
||||
// }
|
||||
//
|
||||
// //坐骑加成
|
||||
// if(user.getPlayerInfoManager().getRide()!=0){
|
||||
// int rideLevel = user.getPlayerInfoManager().getRideLevel();
|
||||
// int[][] property = SPlayerMountLevelUp.sPlayerMountLevelUpMap.get(rideLevel).getProperty();
|
||||
// combinedAttribute(property,heroAllAttribute);
|
||||
// }
|
||||
//公会技能加成
|
||||
Map<Integer, Integer> guildSkill = user.getGuildMyInfo().getGuildSkill();
|
||||
if(guildSkill.containsKey(scHero.getProfession())){
|
||||
|
|
|
@ -450,12 +450,6 @@ public class PlayerLogic {
|
|||
public void modifyDecoration(ISession session, int type,int decorationId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("外观物品Id{}",decorationId);
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
if(decorationId != 0 && type != 0){
|
||||
if(itemManager.getItem(decorationId)==null||itemManager.getItem(decorationId).getItemNum()<1){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此物品"));
|
||||
}
|
||||
}
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now()/1000;
|
||||
switch (type){
|
||||
|
@ -474,13 +468,39 @@ public class PlayerLogic {
|
|||
user.getPlayerInfoManager().setHead(decorationId);
|
||||
break;
|
||||
case 2:
|
||||
user.getPlayerInfoManager().setDesignation(decorationId);
|
||||
Long time2 = user.getPlayerInfoManager().getUserTitleValidTime().get(decorationId);
|
||||
if (time2 == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此称号"));
|
||||
}
|
||||
if (time2 != 0 && now > time2){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("称号时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserTitle(decorationId);
|
||||
break;
|
||||
case 3:
|
||||
user.getPlayerInfoManager().setRide(decorationId);
|
||||
Long time3 = null;
|
||||
if(decorationId == 0){
|
||||
time3 = new Long(0);
|
||||
}else{
|
||||
time3 = user.getPlayerInfoManager().getUserMountValidTime().get(decorationId);
|
||||
}
|
||||
if (time3 == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此坐骑"));
|
||||
}
|
||||
if (time3 != 0 && now > time3){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("坐骑时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserMount(decorationId);
|
||||
break;
|
||||
case 4:
|
||||
user.getPlayerInfoManager().setDecoration(decorationId);
|
||||
Long time4 = user.getPlayerInfoManager().getUserSkinValidTime().get(decorationId);
|
||||
if (time4 == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("无此皮肤"));
|
||||
}
|
||||
if (time4 != 0 && now > time4){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("皮肤时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserSkin(decorationId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -150,7 +150,10 @@ public abstract class AbstractRank implements IRank {
|
|||
.setLevel(everyUser.getPlayerInfoManager().getLevel())
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setForce(everyUser.getPlayerInfoManager().getMaxForce())
|
||||
.setSex(everyUser.getPlayerInfoManager().getSex());
|
||||
.setSex(everyUser.getPlayerInfoManager().getSex())
|
||||
.setUserSkin(everyUser.getPlayerInfoManager().getUserSkin())
|
||||
.setUserTitle(everyUser.getPlayerInfoManager().getUserTitle())
|
||||
.setUserMount(everyUser.getPlayerInfoManager().getUserMount());
|
||||
return everyRank;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,12 @@ public class GuildForceRank extends AbstractRank {
|
|||
.setLevel(user.getPlayerInfoManager().getLevel())
|
||||
.setGuildName(guildInfo.getName())
|
||||
.setRankInfo(everyRankInfo)
|
||||
.setSex(user.getPlayerInfoManager().getSex())
|
||||
.setHead(user.getPlayerInfoManager().getHead())
|
||||
.setHeadFrame(user.getPlayerInfoManager().getHeadFrame())
|
||||
.setUserMount(user.getPlayerInfoManager().getUserMount())
|
||||
.setUserSkin(user.getPlayerInfoManager().getUserSkin())
|
||||
.setUserTitle(user.getPlayerInfoManager().getUserTitle())
|
||||
;
|
||||
builder.addRanks(everyRank);
|
||||
}
|
||||
|
@ -105,6 +109,9 @@ public class GuildForceRank extends AbstractRank {
|
|||
.setRankInfo(everyRankInfo)
|
||||
.setForce(user.getPlayerInfoManager().getMaxForce())
|
||||
.setSex(user.getPlayerInfoManager().getSex())
|
||||
.setUserMount(user.getPlayerInfoManager().getUserMount())
|
||||
.setUserSkin(user.getPlayerInfoManager().getUserSkin())
|
||||
.setUserTitle(user.getPlayerInfoManager().getUserTitle())
|
||||
.setGuildName(guildInfo.getName());
|
||||
return builder;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,10 @@ public class RandomCardPerfectRank extends AbstractRank {
|
|||
.setRankInfo(everyRankInfo)
|
||||
.setGuildSign(familySign)
|
||||
.setGuildName(familyName)
|
||||
.setSex(everyUser.getPlayerInfoManager().getSex())
|
||||
.setUserMount(everyUser.getPlayerInfoManager().getUserMount())
|
||||
.setUserSkin(everyUser.getPlayerInfoManager().getUserSkin())
|
||||
.setUserTitle(everyUser.getPlayerInfoManager().getUserTitle())
|
||||
.build();
|
||||
builder.addRanks(everyRank);
|
||||
}
|
||||
|
|
|
@ -48,11 +48,11 @@ public class CBean2Proto {
|
|||
.setSaveAmt((rechargeInfo.getSaveAmt()))
|
||||
.setIsFirstRecharge(rechargeInfo.getIsFirst())
|
||||
.setHeadFrame(playerManager.getHeadFrame())
|
||||
.setDesignation(playerManager.getDesignation())
|
||||
.setRide(playerManager.getRide())
|
||||
.setDesignation(playerManager.getUserTitle())
|
||||
.setRide(playerManager.getUserMount())
|
||||
.setRideLevel(playerManager.getRideLevel())
|
||||
.setSex(playerManager.getSex())
|
||||
.setDecrotion(playerManager.getDecoration());
|
||||
.setDecrotion(playerManager.getUserSkin());
|
||||
String mathcInfo = RedisUtil.getInstence().getObject(RedisKey.MATCH_UID_KEY + ":" + uid, String.class);
|
||||
if(!StringUtil.isEmpty(mathcInfo)){
|
||||
builder.setRoomAddreess(mathcInfo);
|
||||
|
@ -110,6 +110,93 @@ public class CBean2Proto {
|
|||
return headFrameLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤列表
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.UserSkinInfo> getUserSkinList(User user){
|
||||
List<CommonProto.UserSkinInfo> userSkinLists = new ArrayList<>();
|
||||
// 获取玩家已使用皮肤列表
|
||||
Map<Integer, Long> validTime = user.getPlayerInfoManager().getUserSkinValidTime();
|
||||
|
||||
long now = TimeUtils.now() / 1000;
|
||||
|
||||
Iterator<Map.Entry<Integer, Long>> it = validTime.entrySet().iterator();
|
||||
while (it.hasNext()){
|
||||
Map.Entry<Integer, Long> next = it.next();
|
||||
// 过期的删除,其他返回给客户端
|
||||
if (next.getValue() != 0 && now >= next.getValue()){
|
||||
it.remove();
|
||||
}else {
|
||||
CommonProto.UserSkinInfo.Builder build = CommonProto.UserSkinInfo.newBuilder();
|
||||
build.setSkinId(next.getKey()).setOverTime(next.getValue().intValue());
|
||||
userSkinLists.add(build.build());
|
||||
}
|
||||
}
|
||||
// 数据库更新
|
||||
user.getPlayerInfoManager().setUserSkinValidTime(validTime);
|
||||
return userSkinLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤列表
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.UserTitleInfo> getUserTitleList(User user){
|
||||
List<CommonProto.UserTitleInfo> userTitleLists = new ArrayList<>();
|
||||
// 获取玩家已使用头像框列表
|
||||
Map<Integer, Long> validTime = user.getPlayerInfoManager().getUserTitleValidTime();
|
||||
|
||||
long now = TimeUtils.now() / 1000;
|
||||
|
||||
Iterator<Map.Entry<Integer, Long>> it = validTime.entrySet().iterator();
|
||||
while (it.hasNext()){
|
||||
Map.Entry<Integer, Long> next = it.next();
|
||||
// 过期的删除,其他返回给客户端
|
||||
if (next.getValue() != 0 && now >= next.getValue()){
|
||||
it.remove();
|
||||
}else {
|
||||
CommonProto.UserTitleInfo.Builder build = CommonProto.UserTitleInfo.newBuilder();
|
||||
build.setTitleId(next.getKey()).setOverTime(next.getValue().intValue());
|
||||
userTitleLists.add(build.build());
|
||||
}
|
||||
}
|
||||
// 数据库更新
|
||||
user.getPlayerInfoManager().setUserTitleValidTime(validTime);
|
||||
return userTitleLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤列表
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.UserMountInfo> getUserMountList(User user){
|
||||
List<CommonProto.UserMountInfo> userMountLists = new ArrayList<>();
|
||||
// 获取玩家已使用头像框列表
|
||||
Map<Integer, Long> validTime = user.getPlayerInfoManager().getUserMountValidTime();
|
||||
|
||||
long now = TimeUtils.now() / 1000;
|
||||
|
||||
Iterator<Map.Entry<Integer, Long>> it = validTime.entrySet().iterator();
|
||||
while (it.hasNext()){
|
||||
Map.Entry<Integer, Long> next = it.next();
|
||||
// 过期的删除,其他返回给客户端
|
||||
if (next.getValue() != 0 && now >= next.getValue()){
|
||||
it.remove();
|
||||
}else {
|
||||
CommonProto.UserMountInfo.Builder build = CommonProto.UserMountInfo.newBuilder();
|
||||
build.setMountId(next.getKey()).setOverTime(next.getValue().intValue());
|
||||
userMountLists.add(build.build());
|
||||
}
|
||||
}
|
||||
// 数据库更新
|
||||
user.getPlayerInfoManager().setUserMountValidTime(validTime);
|
||||
return userMountLists;
|
||||
}
|
||||
|
||||
public static CommonProto.Hero getHero(Hero hero){
|
||||
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
||||
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
||||
|
@ -310,6 +397,10 @@ public class CBean2Proto {
|
|||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setRank(rank)
|
||||
.setUid(uid)
|
||||
.setUserMount(playerInfoManager.getUserMount())
|
||||
.setUserSkin(playerInfoManager.getUserSkin())
|
||||
.setUserTitle(playerInfoManager.getUserTitle())
|
||||
.setSex(playerInfoManager.getSex())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -382,7 +473,10 @@ public class CBean2Proto {
|
|||
friend.setHead(playerInfoManager.getHead());
|
||||
friend.setFrame(playerInfoManager.getHeadFrame());
|
||||
friend.setSoulVal(playerInfoManager.getMaxForce());
|
||||
|
||||
friend.setUserMount(playerInfoManager.getUserMount());
|
||||
friend.setUserSkin(playerInfoManager.getUserSkin());
|
||||
friend.setUserTitle(playerInfoManager.getUserTitle());
|
||||
friend.setSex(playerInfoManager.getSex());
|
||||
return friend.build();
|
||||
}
|
||||
|
||||
|
@ -489,6 +583,10 @@ public class CBean2Proto {
|
|||
.addAllGuildHelpInfo(helplist)
|
||||
.setIsTakeGuildHelpReward(user.getGuildMyInfo().isGuildHelpReward())
|
||||
.setLastHelpSendTime((int)(user.getGuildMyInfo().getGuildHelpSendTime()/1000))
|
||||
.setUserMount(user.getPlayerInfoManager().getUserMount())
|
||||
.setUserSkin(user.getPlayerInfoManager().getUserSkin())
|
||||
.setUserTitle(user.getPlayerInfoManager().getUserTitle())
|
||||
.setSex(user.getPlayerInfoManager().getSex())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private int[][] differLocation;
|
||||
|
||||
|
||||
private int defaultSuit;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -323,4 +323,6 @@ public class SGameSetting implements BaseConfig {
|
|||
public int[][] getDifferLocation() {
|
||||
return differLocation;
|
||||
}
|
||||
|
||||
public int getDefaultSuit() {return defaultSuit; }
|
||||
}
|
|
@ -17,6 +17,12 @@ public class SPlayerHeadIcon implements BaseConfig {
|
|||
|
||||
private int time;
|
||||
|
||||
private int[][] unlockProperty;
|
||||
|
||||
private int[][] wearProperty;
|
||||
|
||||
private int effectiveRule;
|
||||
|
||||
/**
|
||||
* 头像框id,头像框类
|
||||
*/
|
||||
|
@ -28,6 +34,12 @@ public class SPlayerHeadIcon implements BaseConfig {
|
|||
|
||||
// 头像框类型
|
||||
public static int HeadFrameType = 2;
|
||||
// 称号类型
|
||||
public static int TitleType = 3;
|
||||
// 坐骑类型
|
||||
public static int MountType = 4;
|
||||
// 时装类型
|
||||
public static int SkinType = 5;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -60,6 +72,14 @@ public class SPlayerHeadIcon implements BaseConfig {
|
|||
return time;
|
||||
}
|
||||
|
||||
public int[][] getUnlockProperty() {
|
||||
return unlockProperty;
|
||||
}
|
||||
|
||||
public int[][] getWearProperty() {
|
||||
return wearProperty;
|
||||
}
|
||||
|
||||
public static Map<Integer, SPlayerHeadIcon> getHeadIconMap() {
|
||||
return headIconMap;
|
||||
}
|
||||
|
@ -67,4 +87,8 @@ public class SPlayerHeadIcon implements BaseConfig {
|
|||
public static Map<Integer, Map<Integer, SPlayerHeadIcon>> getHeadIconMapByType() {
|
||||
return headIconMapByType;
|
||||
}
|
||||
|
||||
public int getEffectiveRule() {
|
||||
return effectiveRule;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue