back_recharge
zhangshanxue 2019-09-17 16:36:26 +08:00
commit 1127ca61ce
13 changed files with 111 additions and 57 deletions

View File

@ -385,6 +385,7 @@ public class Scene implements Runnable{
score=0;
}
UserBloodySnpInfo userBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(id);
myscore= calScore(sortDataBean);
builder.addSceneSimpleRankInfo(SceneFight.SceneSimpleRankInfo.newBuilder()
.setScore(myscore).setUpdateScore(score).setUid(id)
.setHead(userBloodySnpInfo.getHead()).setHeadFrame(userBloodySnpInfo.getHeadFrame()).setLevel(userBloodySnpInfo.getLevel())
@ -527,4 +528,21 @@ public class Scene implements Runnable{
this.quickEnd = -1;
this.quickPlayId = 0;
}
private int calScore(SortDataBean sortDataBean){
int result = 0;
int killNums = sortDataBean.getKillNums();
int mineral = sortDataBean.getMineral();
int[][] scoreConversion = SBloodyBattleSetting.sBloodyBattleSetting.getScoreConversion();
for(int [] scoreItem : scoreConversion){
int type = scoreItem[0];
if(type == 1){
result+=mineral/scoreItem[1];
}else{
result+=killNums/scoreItem[1];
}
}
return result;
}
}

View File

@ -93,8 +93,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
MessageUtil.sendErrorCode(session,0,"您的账号token不正确请退出游戏重新登陆!");
return;
}
//处理多设备重登
dealRepeatLogin(session.getUid());
//刷新token
refreshToken(session);
//踢下线
@ -110,11 +108,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
dealHeartBeat(session);
return;
}
//检查token
// if (checkToken(session,packetNetData) != 0 ){
// MessageUtil.sendErrorCode(session,0,"您的账号token不正确请退出游戏重新登陆!");
// return;
// }
if( packetNetData.getMsgId()== MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
processReconnect(session);
@ -122,9 +115,7 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
return;
}
if (checkIndex(session,packetNetData) != 0){
return;
}
LOGGER.info("request commond : " + packetNetData.getMsgId());
BaseHandler baseHandler = handlers.get(packetNetData.getMsgId());
if (baseHandler == null) {
@ -212,36 +203,6 @@ public class BloodyProtocolsManager implements ProtocolsAbstract {
}
private int dealRepeatLogin(int uid) {
if (OnlineUserManager.checkUidOnline(uid)){
ISession iSession = OnlineUserManager.getSessionByUid(uid);
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
iSession.setOfflineType(ErrorCode.reloginCode);
return 1;
}
return 0;
}
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
int index = packetNetData.getIndex();
if (iSession.getIndex() >= index){
byte[] message = iSession.getCacheMessage(index);
if (message==null &&( packetNetData.getMsgId() != MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() != MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE)){
//TODO error
LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
return 1;
}else {
LOGGER.info("the uid={},the msg={} reback",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
iSession.writeAndFlush(message);
return 1;
}
}else {
iSession.setIndex(index);
iSession.setLoginTime(System.currentTimeMillis());
}
return 0;
}
private void ackIndication(ISession iSession, int ackId) {
LOGGER.info("the uid={},the ackId={}",iSession.getUid(),ackId);
iSession.clearIndication(ackId);

View File

@ -46,7 +46,9 @@ public class SGlobalSystemConfig implements BaseConfig {
@Override
public void init() throws Exception {
Map<Integer,SGlobalSystemConfig> sGlobalSystemConfigMapTmp = new HashMap<>();
if( GameApplication.serverConfig == null){
return;
}
Map<Integer, SGlobalSystemConfig> config = STableManager.getConfig(SGlobalSystemConfig.class);
Iterator<Map.Entry<Integer, SGlobalSystemConfig>> iterator = config.entrySet().iterator();
while (iterator.hasNext()){

View File

@ -14,6 +14,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.message.BasicNameValuePair;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@ -84,9 +85,16 @@ public class DataMessageUtils {
}
public static JSONObject immediateSendPost(Object info){
String s = gson.toJson(info);
// if(info instanceof Report37CheckChat){
JSONObject jsonObject = HttpPool.sendPost(sendChatContent37, s);
// }
JSONObject jsonObject = null;
if(info instanceof Report37CheckChat){
Report37CheckChat info1 = (Report37CheckChat) info;
List<BasicNameValuePair> pairList = info1.getPairList();
try {
jsonObject = HttpPool.sendPostForm(sendChatContent37, new UrlEncodedFormEntity(pairList, "utf-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return jsonObject;
}
}

View File

@ -8,8 +8,12 @@ import com.ljsd.jieling.util.MD5Util;
import com.ljsd.jieling.util.TimeUtils;
import com.ljsd.jieling.util.http.HttpPool;
import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;
public class Report37CheckChat {
import java.util.ArrayList;
import java.util.List;
public class Report37CheckChat implements Report37Param{
private int time;
private String uid="100001";
private String gid="10111";
@ -254,4 +258,34 @@ public class Report37CheckChat {
System.out.println(report37Response);
}
@Override
public List<BasicNameValuePair> getPairList() {
List<BasicNameValuePair> pairList = new ArrayList<>();
pairList.add(new BasicNameValuePair("time", String.valueOf(getTime())));
pairList.add(new BasicNameValuePair("uid", getUid()));
pairList.add(new BasicNameValuePair("gid", getGid()));
pairList.add(new BasicNameValuePair("pid", getPid()));
pairList.add(new BasicNameValuePair("dsid", getDsid()));
pairList.add(new BasicNameValuePair("type", getType()));
pairList.add(new BasicNameValuePair("idfa", getIdfa()));
pairList.add(new BasicNameValuePair("idfv", getIdfv()));
pairList.add(new BasicNameValuePair("oudid", getOudid()));
pairList.add(new BasicNameValuePair("imei", getImei()));
pairList.add(new BasicNameValuePair("mac", getMac()));
pairList.add(new BasicNameValuePair("sign", getSign()));
pairList.add(new BasicNameValuePair("actor_name", getActor_name()));
pairList.add(new BasicNameValuePair("actor_id", getActor_id()));
pairList.add(new BasicNameValuePair("user_ip", getUser_ip()));
pairList.add(new BasicNameValuePair("chat_time", getChat_time()));
pairList.add(new BasicNameValuePair("content", getContent()));
pairList.add(new BasicNameValuePair("actor_level", getActor_level()));
pairList.add(new BasicNameValuePair("actor_recharge_gold", getActor_recharge_gold()));
pairList.add(new BasicNameValuePair("to_uid", getTo_uid()));
pairList.add(new BasicNameValuePair("to_actor_name", getTo_actor_name()));
pairList.add(new BasicNameValuePair("to_actor_id", getTo_actor_id()));
pairList.add(new BasicNameValuePair("to_actor_level", getTo_actor_level()));
pairList.add(new BasicNameValuePair("to_actor_recharge_gold", getTo_actor_recharge_gold()));
pairList.add(new BasicNameValuePair("type_id", getType_id()));
return pairList;
}
}

View File

@ -62,6 +62,7 @@ public class Repot37EventUtil {
report37CheckChat.setChat_time(String.valueOf(TimeUtils.now()/1000));
report37CheckChat.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));//uid
report37CheckChat.setActor_name(user.getPlayerInfoManager().getNickName());
report37CheckChat.setActor_id(String.valueOf(user.getId()));
report37CheckChat.setGid(SDK37Constans.gid);
report37CheckChat.setPid(SDK37Constans.pid);
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));

View File

@ -2,8 +2,12 @@ package com.ljsd.jieling.db.redis;
import com.ljsd.GameApplication;
import java.util.HashSet;
import java.util.Set;
public class RedisKey {
public final static String Delimiter_colon = ":";
private final static String areaId = "0";
@ -169,13 +173,26 @@ public class RedisKey {
public static final String MATCH_UID_KEY = "MATCH_UID_KEY";
public static final String BLOODY_TEAM = "BLOODY_TEAM";
public static final String BLOODY_SERVER_INFO = "BLOODY_SERVER_INFO";
public static final String BLOODY_PERSON_BATTLE_INFO = "BLOODY_PERSON_BATTLE_INFO";
public static final String MATCH_SERVER_INFO = "MATCH_SERVER_INFO";
public static final String LOGIC_SERVER_INFO = "LOGIC_SERVER_INFO";
public final static String CDKEY = "CDKEY";
public static Set<String> familyKey = new HashSet<>();
static {
familyKey.add(FAMILY_FIGHT);
familyKey.add(FAMILY_FIGHT_RANK);
familyKey.add(FAMILY_FIGHT_MATCHING_RANK);
familyKey.add(FAMILY_ATTACK_BLOOD);
familyKey.add(FAMILY_FIGHT_STAR_RANK);
familyKey.add(FAMILY_FIGHT_EXTRA_STAR);
familyKey.add(FAMILY_FIGHT_CAL_STAR);
familyKey.add(FAMILY_FIGHT_BUFF);
familyKey.add(FAMILY_FIGHT_ATTACK_COUNT);
familyKey.add(FAMILY_FIGHT_TOTAL_STAR);
familyKey.add(FAMILY_FIGHT_TOTAL_EXP);
}
public static String getKey(String type, String key, boolean withoutServerId) {
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)){
return type + RedisKey.Delimiter_colon + key;

View File

@ -993,7 +993,7 @@ public class RedisUtil {
public String getKey(String type,String key){
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type) || RedisKey.BLOODY_PERSON_BATTLE_INFO.equals(type)) {
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type) || RedisKey.BLOODY_PERSON_BATTLE_INFO.equals(type)||RedisKey.familyKey.contains(type)) {
return type + RedisKey.Delimiter_colon + key;
}
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)||

View File

@ -149,4 +149,6 @@ public interface BIReason {
int RANDOM_SOULEQUIP_CONSUME = 1036;//占星
int FAMILY_SET_ICON = 1037;//工会修改图腾
}

View File

@ -3356,7 +3356,11 @@ public class MapLogic {
Item item = itemManager.getItem(mapItem[i]);
int[] it = new int[2];
it[0] = mapItem[i];
it[1] = item.getItemNum();
if(item!=null){
it[1] = item.getItemNum();
}else{
it[1] = 0;
}
costItem[i] = it;
}
ItemUtil.itemCost(user,costItem, BIReason.ENDLESS_REASON_CHANGE,1);

View File

@ -193,7 +193,6 @@ public class BloodLogic {
int uid = session.getUid();
User user = UserManager.getUser(uid);
BloodyInfo bloodyInfo = user.getBloodyInfo();
bloodyInfo.setScore(99999);
Map<Integer, SBloodyBattleTreasure> sBloodyBattleTreasureMap = SBloodyBattleTreasure.sBloodyBattleTreasureMap;
RoomProto.GetBloodyScoreInfoResponse.Builder builder = RoomProto.GetBloodyScoreInfoResponse.newBuilder().setScore(bloodyInfo.getScore()).setHadBuy(bloodyInfo.getHadBuy());
if(bloodyInfo.getStateInfo().isEmpty()){
@ -302,12 +301,11 @@ public class BloodLogic {
}
public void calBloodyMissionInfo(User user,SortDataBean sortDataBean) throws Exception {
int killNums = sortDataBean.getKillNums();
BloodyInfo bloodyInfo = user.getBloodyInfo();
bloodyInfo.setKillNums(bloodyInfo.getKillNums() + 9999);
bloodyInfo.setKillNums(bloodyInfo.getKillNums());
int changeScore = calScore(sortDataBean);
if(changeScore>0){
bloodyInfo.setScore(bloodyInfo.getScore() + calScore(sortDataBean));
bloodyInfo.setScore(bloodyInfo.getScore() + changeScore);
}
MissionEventDistributor.requestStart();
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_END);

View File

@ -855,8 +855,16 @@ public class GuildLogic {
* @param messageType
*/
public static void changeFamilyIcon(ISession session, int iconId, MessageTypeProto.MessageType messageType) throws Exception {
PlayerManager playerInfoManager = UserManager.getUser(session.getUid()).getPlayerInfoManager();
User user = UserManager.getUser(session.getUid());
PlayerManager playerInfoManager = user.getPlayerInfoManager();
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
int[] cost = SGuildSetting.sGuildSetting.getTotemCost();
int[][] cost1 = new int[1][];
cost1[0] = cost;
boolean b = ItemUtil.itemCost(user, cost1, BIReason.FAMILY_SET_ICON, 1);
if (!b){
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"消耗物品不足");
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
}

View File

@ -298,7 +298,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
iSession.setOfflineType(ErrorCode.reloginCode);
backUpMsgToRedis(iSession);
offLine(iSession);
OnlineUserManager.userOffline(uid);
LOGGER.info("the channel={}",iSession.getCtx().channel());
return 1;
}
return 0;
@ -351,6 +352,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
LOGGER.info("player offLine ...");
ISession session = (ISession) gameSession;
synchronized (session) {
if(session.getOfflineType() == ErrorCode.reloginCode){
return;
}
User user = UserManager.getUserInMem(session.getUid());
if(user == null){
return;
@ -358,9 +362,6 @@ public class ProtocolsManager implements ProtocolsAbstract {
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,1);
LOGGER.info("player={} offLine ...",user.getId());
if(session.getOfflineType() == ErrorCode.reloginCode){
return;
}
OnlineUserManager.userOffline(session.getUid());
if (session.getCtx() != null) {
GameMessageHandler.allChannels.remove(session.getCtx().channel());