星力九代 命中算法源代码 特殊用户处理 点控调整
难度命中算法制excel表格
package com.miracle9.game.algorithm; import com.miracle9.game.algorithm.FishServerSuanfa.FISH_TYPE; import java.util.Objects; import java.util.Random; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; public class DieFishSuanfa { public Logger log = Logger.getLogger(DieFishSuanfa.class); private static float afloat14 = 1.4F; private static int _int10 = 10; private static int _int4 = 4; private static int int10w = 1000000; private static float _float05f = 0.5F; private static double IIllIIlIIlIlIlIl; private static float[] levelPoint = new float[]{0.999F, 0.998F, 0.997F, 0.996F, 0.995F}; private STRUCT_GET_GF_RECORD struct_record = new STRUCT_GET_GF_RECORD(); private long _totalPlay; private long _totalWin; private boolean _fangWater; private double _amendedGameDf; double gameDf = 0.7 ; Random mRand = new Random(); public DieFishSuanfa() { this.Init(); } public void Init() { //DOMConfigurator.configureAndWatch("config/log4j.xml", 10000L); String logenable = LoadPropertiesUtil.getKey("../setting.properties", "logenable"); if (logenable.equals("INFO")) log.setLevel(Level.INFO); else if(logenable.equals("DEBUG")) log.setLevel(Level.DEBUG); else log.setLevel(Level.OFF); this.struct_record.totalRecord = 0L; for(int i = 0; i < _int4; ++i) { this.struct_record.record[i] = 0L; this.struct_record.tmpGf[i] = 1.0D; } this._fangWater = false; this._totalPlay = 0L; this._totalWin = 0L; } public double GetGameDf(int level) { if (level > 5 || level <= 0) { level = 3; } double[] var2 = new double[]{(double)0.99F, (double)0.95F, (double)0.9F, (double)0.8F, (double)0.75F}; return var2[level - 1]; //return (double)levelPoint[level - 1]; // Q10 备用 } public DieFishOutputInfo Fishing(DieFishInputInfo input) { DieFishOutputInfo output = new DieFishOutputInfo(); int nFishCounts = input.totalFish; //System.out.println( "\n nFishCounts: "+ nFishCounts ); int fishesCanGetIonic = 0; int ionicFlag = 0; int i; for(i = 0; i < nFishCounts; ++i) { output.dead[i].fishType = -1; output.dead[i].bet = 0; output.dead[i].fishid = input.fishes[i].fishid; output.dead[i].fx = input.fishes[i].fx; output.dead[i].fy = input.fishes[i].fy; } output.ionicCannonIndex = -1; gameDf = this.GetGameDf(input.gameDfLevel); //System.out.print("A3 "+input.hallType+" B3 "+input.gameDfLevel +" totalFish "+nFishCounts+" gameDf "+ gameDf); this._Preprocess(input); //处理额外奖励倍数 this._amendedGameDf = this._AmendGameDf(input); log.debug("当前 _AmendGameDf: "+ this._amendedGameDf ); // 0.9681936677049267 output.totalFish = input.totalFish; for(i = 0; i < nFishCounts; ++i) { output.dead[i].fishType = input.fishes[i].fishType; } label48: { if (input.locked) { this._CalculateLockedFish(input, output); if (output.dead[0].bet <= 0) { break label48; } } this._CalcultateUnlockedFishes(input, output); } //倍数大于9 有1/30机会获得能量炮 for(i = 0; i < nFishCounts; ++i) { if (output.dead[i].bet > 9) { ++fishesCanGetIonic; ionicFlag = output.dead[i].fishid; break; } } if (fishesCanGetIonic > 0) { if (Math.random() < (double)fishesCanGetIonic / 30.0D) { output.ionicCannonIndex = ionicFlag; } else { output.ionicCannonIndex = -1; } } output.totalFish = 0; for(i = 0; i < nFishCounts; ++i) { //System.out.println(i+" bet: "+ output.dead[i].bet ); //System.out.println(i+" output.totalFish: "+ output.totalFish ); if (output.dead[i].bet > 0) { output.dead[output.totalFish] = output.dead[i]; ++output.totalFish; } } //System.out.println(" output.totalFish: "+ output.totalFish ); return output; } //修正游戏难度 public double ModifyGameDf(long totalPlay, double gameDf, int coinValue, int hallType) { double dbGameDf; long profitStartCredit = 0L; double tmp = 0.0D; switch(hallType) { case 1: profitStartCredit = (long)(coinValue * 500000); break; case 2: profitStartCredit = (long)(coinValue * 1000000); break; case 3: profitStartCredit = (long)(coinValue * 2000000); break; } long profitConvergenceZone = (long)((double)(profitStartCredit * 5L) * (1.0D - gameDf) - (double)profitStartCredit * 0.001D); if (totalPlay < profitStartCredit) { dbGameDf = 0.999D; } else if (totalPlay < profitStartCredit << 1) { dbGameDf = 0.999D - (-0.0010000000000000009D + ((double)profitConvergenceZone * 0.25D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit << 1)) * (double)(totalPlay - profitStartCredit) / (double)profitStartCredit; } else if (totalPlay < profitStartCredit * 3L) { dbGameDf = (tmp = 1.0D - ((double)profitConvergenceZone * 0.25D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit << 1)) - (tmp - 1.0D + ((double)profitConvergenceZone * 0.5D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit * 3L)) * (double)(totalPlay - (profitStartCredit << 1)) / (double)profitStartCredit; } else if (totalPlay < profitStartCredit << 2) { dbGameDf = (tmp = 1.0D - ((double)profitConvergenceZone * 0.5D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit * 3L)) - (tmp - 1.0D + ((double)profitConvergenceZone * 0.75D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit << 2)) * (double)(totalPlay - profitStartCredit * 3L) / (double)profitStartCredit; } else if (totalPlay < profitStartCredit * 5L) { dbGameDf = (tmp = 1.0D - ((double)profitConvergenceZone * 0.75D + (double)profitStartCredit * 0.001D) / (double)(profitStartCredit << 2)) - (tmp - gameDf) * (double)(totalPlay - (profitStartCredit << 2)) / (double)profitStartCredit; } else { dbGameDf = gameDf; } System.out.print( "ModifyGameDf dbGameDf->"+dbGameDf ); return (double)((float)dbGameDf); } /** * 处理奖励倍数 * */ public void _Preprocess(DieFishInputInfo input) { int i,j; for(i = 0; i < input.totalFish; ++i) { if (FISH_TYPE.Fish_GreenDragon.ordinal() == input.fishes[i].fishType) { if (this.mRand.nextDouble() < 0.66D) { input.fishes[i].bet = this.mRand.nextInt(41) + 40; } else { input.fishes[i].bet = this.mRand.nextInt(61) + 40; } } else if (FISH_TYPE.Fish_SilverDragon.ordinal() == input.fishes[i].fishType) { if (this.mRand.nextDouble() < 0.8571D) { input.fishes[i].bet = this.mRand.nextInt(201) + 100; } else { input.fishes[i].bet = this.mRand.nextInt(101) + 100; } } //牛魔王 else if (FISH_TYPE.Fish_GoldenDragon.ordinal() == input.fishes[i].fishType) { // double gameDf = this.GetGameDf(input.gameDfLevel); int betflag=1 , RandInt301 = this.mRand.nextInt(75); double RandFloat = this.mRand.nextDouble(); double totalCoin = gameDf*input.totalPlay - input.totalWin; if (totalCoin > 30000L*input.coinValue){ //原版 1-0.8571D 可能600倍以上 if (this.mRand.nextDouble() < 0.8571D) j = this.mRand.nextInt(301) + 300; else j = this.mRand.nextInt(401) + 600; }else{ if (totalCoin > 10000L*input.coinValue) betflag = 4; else if (totalCoin > 6000L*input.coinValue) betflag = 3; else if (totalCoin > 3000L*input.coinValue) betflag = 2; else betflag = 1; if (RandFloat < 0.12D) j = betflag*this.mRand.nextInt(101) + 300; else if(RandFloat < 0.15D) j = betflag*RandInt301 +130 + 300; else if(RandFloat < 0.18D) j = betflag*RandInt301 +110 + 300; else if(RandFloat < 0.20D) j = betflag*RandInt301 +100 + 300; else if(RandFloat < 0.22D) j = betflag*RandInt301 +60 + 300; else if(RandFloat < 0.25D) j = betflag*RandInt301 +30 + 300; else j = betflag*this.mRand.nextInt(80) + 300; } input.fishes[i].bet = j; } } if (input.locked) { if (input.fishes[0].fishType == FISH_TYPE.Fish_Double_Kill.ordinal()) { for(i = 1; i < input.totalFish; ++i) { input.fishes[i].bet = -1; } } if (FISH_TYPE.Fish_Same_Shrimp.ordinal() <= input.fishes[0].fishType && input.fishes[0].fishType <= FISH_TYPE.Fish_Same_Turtle.ordinal()) { for(i = 1; i < input.totalFish; ++i) { if (input.fishes[i].fishType == input.fishes[0].fishType) { input.fishes[i].bet = -1; } } } else { for(i = 1; i < input.totalFish; ++i) { if (input.fishes[i].fishType == FISH_TYPE.Fish_LimitedBomb.ordinal() || input.fishes[i].fishType == FISH_TYPE.Fish_Double_Kill.ordinal() || FISH_TYPE.Fish_Same_Shrimp.ordinal() <= input.fishes[i].fishType && input.fishes[i].fishType <= FISH_TYPE.Fish_Same_Turtle.ordinal()) { input.fishes[i].bet = -1; } } } } else { for(i = 0; i < input.totalFish; ++i) { if (input.fishes[i].fishType == FISH_TYPE.Fish_LimitedBomb.ordinal() && input.totalFish > 1 && input.fishes[i].bet != -1) { if (this.mRand.nextBoolean()) { for(j = 0; j < input.totalFish; ++j) { if (i != j) { input.fishes[j].bet = -1; } } } else { input.fishes[i].bet = -1; } } else if (FISH_TYPE.Fish_Same_Shrimp.ordinal() <= input.fishes[i].fishType && input.fishes[i].fishType <= FISH_TYPE.Fish_Same_Turtle.ordinal() && input.fishes[i].bet != -1) { for(j = 0; j < input.totalFish; ++j) { if (i != j && input.fishes[j].fishType == input.fishes[i].fishType) { input.fishes[j].bet = -1; } } } else if (input.fishes[i].fishType == FISH_TYPE.Fish_Double_Kill.ordinal() && input.fishes[i].bet != -1) { for(j = 0; j < input.totalFish; ++j) { if (i != j && (input.fishes[j].fishType == input.fishes[i].doubleKillType[0] || input.fishes[j].fishType == input.fishes[i].doubleKillType[1])) { input.fishes[j].bet = -1; } } } } } } private static boolean IIIIlIlIIIIlIIlI(DieFishInputInfo input) { double credit = (double)input.fishes[0].bet * 0.19999999999999996D / 0.8D; double[] pkill = new double[_int10]; double[] rateAmongFish = new double[_int10]; double totalRate = 0.0D; boolean flag = false; if (input.fishes[0].fishType == FISH_TYPE.Fish_LimitedBomb.ordinal()) { flag = true; } if (input.fishes[0].fishType == FISH_TYPE.Fish_SilverDragon.ordinal()) { flag = true; } if (FISH_TYPE.Fish_BigEars_Group.ordinal() <= input.fishes[0].fishType && input.fishes[0].fishType <= FISH_TYPE.Fish_Turtle_Group.ordinal()) { flag = true; } if (input.fishes[0].fishType == FISH_TYPE.Fish_GoldenDragon.ordinal()) { flag = true; } int i; for(i = 1; i < _int10; ++i) { pkill[i] = 0.0D; rateAmongFish[i] = 0.0D; } for(i = 1; i < input.totalFish; ++i) { if (input.fishes[i].bet > 0) { totalRate += Math.pow((double)input.fishes[i].bet, 0.5D); } } if (totalRate < 0.1D) { flag = true; } else { for(i = 1; i < input.totalFish; ++i) { if (input.fishes[i].bet > 0) { rateAmongFish[i] = Math.pow((double)input.fishes[i].bet, 0.5D) / totalRate; } } } for(i = 1; i < input.totalFish; ++i) { if (input.fishes[i].bet > 0) { pkill[i] = credit * rateAmongFish[i] / (double)input.fishes[i].bet; } if (pkill[i] > 1.0D) { flag = true; } } return flag; } public void _CalculateLockedFish(DieFishInputInfo input, DieFishOutputInfo output) { double a = this._AmendGameDf(input) * 0.8D; double prob; if (IIIIlIlIIIIlIIlI(input)) { prob = a / 0.8D / (double)input.fishes[0].bet; } else { prob = a / (double)input.fishes[0].bet; } System.out.print(prob); if (this.mRand.nextDouble() < prob) { output.dead[0].bet = input.fishes[0].bet; } } public void _CalcultateUnlockedFishes(DieFishInputInfo input, DieFishOutputInfo output) { double var3 = 0.0D; double[] pkill = new double[_int10]; double[] rateAmongFish = new double[_int10]; double totalRate = 0.0D; double amendedGameDf = this._amendedGameDf; int lockFlag = 0; if (input.locked) { lockFlag = 1; if (IIIIlIlIIIIlIIlI(input)) { lockFlag = input.totalFish; } } int i; for(i = 0; i < _int10; ++i) { pkill[i] = 0.0D; rateAmongFish[i] = 0.0D; } //region 击中的权重分配 不影响命中 for(i = lockFlag; i < input.totalFish; ++i) { if (input.fishes[i].bet > 0) { totalRate += Math.pow( (double)input.fishes[i].bet, (double) _float05f) ;// 18 } } //如果击中多条 按权重分配每条鱼 for(i = lockFlag; i < input.totalFish; ++i) { if (input.fishes[i].bet > 0) { rateAmongFish[i] = Math.pow((double)input.fishes[i].bet, (double) _float05f) / totalRate; } } //endregion //按当前难度,确认命中 fix 如果special标记 提高4倍命中 for(i = lockFlag; i < input.totalFish; ++i) { if (lockFlag == 0) { if (input.fishes[i].bet > 0) { pkill[i] = amendedGameDf * rateAmongFish[i] / (double)input.fishes[i].bet; } else { pkill[i] = -1.0D; } } else if (input.fishes[i].bet > 0) { pkill[i] = (double)input.fishes[0].bet * 0.24999999999999994D * rateAmongFish[i] / (double)input.fishes[i].bet; } else { pkill[i] = -1.0D; } //System.out.print("\nfsDead "+input.fishes[i].fsDead); if (input.fishes[i].fsDead){ pkill[i] = 2.0 * pkill[i]; if (input.fishes[i].bet>299 ) pkill[i] = 10.0 * pkill[i]; else if(input.fishes[i].bet>99 ) pkill[i] = 4.0 * pkill[i]; else if(input.fishes[i].bet>39) pkill[i] = 2.0 * pkill[i]; } var3 = this.mRand.nextDouble() ; //System.out.print("rand "+var3+ " < pkill["+i+"] " + pkill[i] + " rateAmongFish[i] " +rateAmongFish[i]); if ( var3 < pkill[i]) { output.dead[i].bet = input.fishes[i].bet; } else { output.dead[i].bet = 0; } } } public double _AmendGameDf(DieFishInputInfo input) { //region 异常炮值修正 if (input.coinValue <= 0 || input.coinValue > 10000) { input.coinValue = 500; } //场地类型 if (input.hallType <= 0 || input.hallType > 3) {input.hallType = 2;} //endregion // 逻辑部分开始 double l_feadback3 = 1.0D; double specialAmend = 1.0D; if (input.coinValue < 500) { specialAmend = Math.pow( (double)input.coinValue / 500.0D , 0.8D); //pow(底数,次方) } // [ 阶段盈利 = 动态(总押-总得) - 参照(总押-总得) ] double nowWin = (double)(input.totalPlay - input.totalWin - (this._totalPlay - this._totalWin)); //当 重启后 或者 动态总押-参照总押 > 20W if (input.totalPlay - this._totalPlay > 200000L * (long)input.coinValue || this._totalPlay == 0L) { // 阶段盈利 > [ 3W / specialAmend ] if (this._totalPlay != 0L && nowWin > (double)(30000 * input.coinValue) / specialAmend) { this._fangWater = true; } else { this._fangWater = false; l_feadback3 = 1.0D; } this._totalPlay = input.totalPlay; this._totalWin = input.totalWin; } // 如果阶段盈利 且 币值>200 且 阶段盈利 + 1.5w > 0 if (this._fangWater && input.coinValue > 200 && nowWin + 15000.0D * (double)input.coinValue > 0.0D) { // l_FeedBack3 = 1.0D + { 阶段盈利 + 1.5W } / 10W l_feadback3 = 1.0D + ( nowWin + 15000.0D * (double)input.coinValue) / (100000.0D * (double)input.coinValue); } log.debug(" input.totalPlay=" +input.totalPlay +"\n input.totalWin=" +input.totalWin +"\n this._totalPlay=" +this._totalPlay +"\n this._totalWin=" + this._totalWin +"\n input.totalPlay - this._totalPlay=" + (input.totalPlay - this._totalPlay) +"\n nowWin =" + nowWin +"\n input.slavePlay=" + input.slavePlay +"\n input.slaveWin=" + input.slaveWin + " water->"+this._fangWater + " l_FeedBack3->"+l_feadback3+ " totalUnproCredit->" + input.totalUnproCredit); gameDf = this.GetGameDf(input.gameDfLevel); // 读取台桌难度系数 input.totalWin += (long)(gameDf * (double)input.totalUnproCredit); //飞在外面的分 可忽略 //座位总押盈利大于200 && 总押>20 if (this.struct_record.record[input.whichSlave] <= 0L || input.slavePlay - this.struct_record.record[input.whichSlave] > (long)( input.coinValue * 200 ) && input.totalPlay - this.struct_record.totalRecord > (long)(input.coinValue * 20)) { this.struct_record.totalRecord = input.totalPlay; // 动态总押 this.struct_record.record[input.whichSlave] = input.slavePlay; // 座位总押 STRUCT_AMEND_INPUT_SIM simAmendInput = new STRUCT_AMEND_INPUT_SIM(); simAmendInput.coinValue = input.coinValue; simAmendInput.gameDf = gameDf; simAmendInput.hallType = input.hallType; simAmendInput.feadback3 = l_feadback3; simAmendInput.totalPlay = input.totalPlay; simAmendInput.totalWin = input.totalWin; simAmendInput.slavePlay = input.slavePlay; simAmendInput.slaveWin = input.slaveWin; this.struct_record.tmpGf[input.whichSlave] = this.AmendGameDf_sim(simAmendInput); } return this.struct_record.tmpGf[input.whichSlave]; } /* 修正游戏难度 */ public double AmendGameDf_sim(STRUCT_AMEND_INPUT_SIM input) { double specialAmend = 1.0D; if (input.coinValue < 500 && input.gameDf * (double)input.totalPlay - (double)input.totalWin > 0.0D) { specialAmend = Math.pow((double)input.coinValue / 500.0D, 1.0D); // Math.pow(A,B) A的B次方 } // 1.0 + 1.0 * pow( 3/2 ,1.4 )=1.76 * (1.0 / 1000) * (gameDf * totalPlay -totalWin ) / 10w // 1.0 + 1.0 * pow( 3/2 ,1.4 )=1.76 * (1.0 / 1000) * (gameDf * slavePlay -slaveWin ) / 50w double feadback1 = 1.0D + specialAmend * Math.pow( 3.0D / (double)input.hallType , (double) afloat14) * (1.0D / (double)input.coinValue) * (input.gameDf * (double)input.totalPlay - (double)input.totalWin) / (double) int10w; double feadback2 = 1.0D + specialAmend * Math.pow( 3.0D / (double)input.hallType , (double) afloat14) * (1.0D / (double)input.coinValue) * (input.gameDf * (double)input.slavePlay - (double)input.slaveWin) / (double)(int10w *5); log.debug("feadback1=" + feadback1+" feadback2=" + feadback2); //预估盈利>(2WB/samend)且 总押<200WB if (input.gameDf * (double)input.totalPlay - (double)input.totalWin > (double)(20000 * input.coinValue) / specialAmend && input.totalPlay < 2000000L * (long)input.coinValue) { feadback1 = 1.0D + (feadback1 - 1.0D) * 5.0D; } else if (input.gameDf * (double)input.totalPlay - (double)input.totalWin > (double)(30000 * input.coinValue) / specialAmend) { feadback1 = 1.0D + (feadback1 - 1.0D) * 5.0D; } double F8 = feadback1 * feadback2 * input.feadback3; log.debug( "F8=" + F8+" feadback3=" + input.feadback3 ); if (F8 < 0.9D) { F8 = 0.9D; } else if (F8 > 1.1D) { F8 = 1.1D; } return input.gameDf * F8; } }
UserService
package com.miracle9.game.service; import com.google.gson.Gson; import com.miracle9.game.IIIIlIlIIIIlIIlI.IIIIlIlllllIlllI; import com.miracle9.game.IIIIlIlIIIIlIIlI.IIlIlIIIIIlllIIl; import com.miracle9.game.IIIIlIlIIIIlIIlI.IIlIllIlllIIIlIl; import com.miracle9.game.IIIIlIlIIIIlIIlI.IIlllIIIlIllIIIl; import com.miracle9.game.IIIIlIlIIIIlIIlI.IIlllIlllllIIIIl; import com.miracle9.game.IIIIlIlIIIIlIIlI.IlIIIIIlIllIlIIl; import com.miracle9.game.IIIIlIlIIIIlIIlI.IlIIlIlIlllIllIl; import com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlIIIIlIIlI; //import com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI; import com.miracle9.game.IIIIlIlllllIlllI.IIIllIlIlIlIlIll; //import com.miracle9.game.IIIllIlIlIlIlIll.IIIIlIlllllIlllI; //import com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl; //import com.miracle9.game.IIIllIlIlIlIlIll.IlIIIIIlIllIlIIl; import com.miracle9.game.algorithm.DieFishInputInfo; import com.miracle9.game.algorithm.DieFishOutputInfo; import com.miracle9.game.algorithm.FishInfo; import com.miracle9.game.algorithm.FishServerSuanfa; import com.miracle9.game.bean.HitFish; /* import com.miracle9.game.bean.IIIIlIlllllIlllI; import com.miracle9.game.bean.IIIllIlIlIlIlIll; import com.miracle9.game.bean.IIlIlIIIIIlllIIl; import com.miracle9.game.bean.IIlIllIlllIIIlIl; */ import com.miracle9.game.bean.Seat; import com.miracle9.game.entity.BulletFishDesk; import com.miracle9.game.entity.GameDataLog; import com.miracle9.game.entity.LevelInfo; import com.miracle9.game.entity.Promoter; import com.miracle9.game.entity.SystemConfig; import com.miracle9.game.entity.User; import com.miracle9.game.entity.UserTenMinScore; import com.miracle9.game.entity.UserTop; import com.miracle9.game.entity.UserWarning; import com.miracle9.game.entity.Version; import com.miracle9.game.util.LocalMem; import com.miracle9.game.util.MyUtil; import com.miracle9.game.util.OverFishPropertyUtil; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.codec.digest.DigestUtils; import org.apache.log4j.Logger; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import org.hibernate.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service("userService") public class UserService { public static Map<String, Map<Long, Integer>> userDeskTimeMap = new HashMap(); public static ConcurrentHashMap<Integer, User> CacheUser = new ConcurrentHashMap(); public static ConcurrentHashMap<Integer, UserWarning> userWardingCache = new ConcurrentHashMap(); public static Set<Integer> IIlllIIIlIllIIIllsiillill = new HashSet(); public static String xxoo = "29a28sp2hYae1Zf2WKV1ZHMnQX"; public static final double jingjiScore = 0.00926D; public static final double lianxiScore = 0.00463D; public Logger log = Logger.getLogger(UserService.class); // public static Logger logger2 = Logger.getLogger(UserService.class); @Autowired private IIllIIlIIlIlIlIl manageService; @Autowired private IIlllIlllllIIIIl userDao; @Autowired private IlIIIIIlIllIlIIl userTopDao; @Autowired private IIlIllIlllIIIlIl levelInfoDao; @Autowired private com.miracle9.game.IIIIlIlIIIIlIIlI.IIllIIlIIlIlIlIl promoterDao; @Autowired private IIlIlIIIIIlllIIl gameDataLogDao; @Autowired private IIIIlIlllllIlllI bulletFishDeskDao; @Autowired private IIlllIIIlIllIIIl systemConfigDao; @Autowired private com.miracle9.game.service.IIlllIlllllIIIIl userTenMinScoreService; @Autowired private IlIIlIlIlllIllIl versionDao; @Autowired private IIllllIlIlIlIIll userWarningService; public UserService() { } public void publicKey(String modulus, String exponent, IoSession session) { session.setAttribute("attack", "false"); Map<String, Object> arg = new HashMap(); String key = MyUtil.IlIIlIlIlllIllIl(16); LocalMem.y.put(session, key); key = MyUtil.IIIIlIlIIIIlIIlI(key, modulus, exponent); arg.put("key", key); arg.put("time", System.currentTimeMillis()); HashMap<String, Object> map = new HashMap(); map.put("method", "sendServerTime"); map.put("args", new Object[]{arg}); try { Gson gson = new Gson(); String msgJson = gson.toJson(map); byte[] content = msgJson.getBytes(); IoBuffer bb = IoBuffer.allocate(content.length + 4); bb.putInt(content.length); bb.put(content); bb.flip(); session.write(bb); } catch (Exception var11) { this.log.error("", var11); } } @Transactional public Map<String, Object> checkLogin(String username, String password, int uuid, IoSession session) { return this.checkLogin(username, password, uuid, "", session); } @Transactional public Map<String, Object> checkLogin(String username, String password, int uuid, String versionCode, final IoSession session) { User user = (User)this.userDao.IIlIllIlllIIIlIl("from User where username=?", new Object[]{username}); this.log.info("UserLogin:" + username + "," + user.getGameGold() + "," + user.getGameScore() + "," + uuid); if (uuid == 1 && !versionCode.equals("")) { Version version = this.versionDao.IlIIIIllllIIllIl(4); if (version != null && !version.getVersionCode().equals(versionCode)) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "checkVersion", new Object[]{version.getDownloadWindows()})); return null; } } Map<String, Object> result = new HashMap(); result.put("isLogin", false); result.put("messageStatus", -1); result.put("user", (Object)null); if (user == null || !user.getPassword().equals(DigestUtils.md5Hex(password))) { result.put("messageStatus", 0); return result; } //if (user != null && user.getPassword().equals(DigestUtils.md5Hex(password))) { if (user.getGameScore() > 0) { this.log.info("GameScore:" + user.getGameScore()); return null; } if (user.getStatus() != 0) { result.put("messageStatus", 1); return result; } SystemConfig config = this.systemConfigDao.IIllIIlIIlIlIlIl(); if (config != null && config.getGameStatus() == 1 && user.getType() != 2) { result.put("messageStatus", 2); return result; } // else { if (LocalMem.B.containsKey(user.getId())) { IoSession is = (IoSession)LocalMem.B.remove(user.getId()); if (LocalMem.z.containsKey(is)) { LocalMem.z.remove(is); } is.removeAttribute("id"); is.removeAttribute("username"); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(is, "quitToLogin", new Object[]{4})); is.setAttribute("needRemove", "true"); } session.setAttribute("username", user.getName()); session.setAttribute("id", user.getId()); LocalMem.B.put(user.getId(), session); session.setAttribute("trueClient", "true"); result.put("isLogin", true); result.put("isShutup", config.getChat() == 0); result.put("user", user); result.put("special", LocalMem.special); IIIllIlIlIlIlIll.IIIIlIlIIIIlIIlI(new IIIIlIlIIIIlIIlI(session, "checkLogin", new Object[]{result})); if (uuid == 1) { com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/login", new Object[]{user.getId(), com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.llllllIlllIIlIll}); if (CacheUser.containsKey(user.getId())) { this.log.info("remove user from usercache when login userId:" + user.getId()); CacheUser.remove(user.getId()); } } else { com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/reLogin", new Object[]{user.getId(), com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.llllllIlllIIlIll}); } if (!CacheUser.containsKey(user.getId())) { CacheUser.put(user.getId(), user); } else { ((User)CacheUser.get(user.getId())).setNickname(user.getNickname()); ((User)CacheUser.get(user.getId())).setLevel(user.getLevel()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{getUserScore(user.getId())})); } com.miracle9.game.bean.IIIIlIlllllIlllI ds; if (uuid == 1) { if (LocalMem.C.containsKey(user.getId())) { LocalMem.C.remove(user.getId()); } if (LocalMem.D.containsKey(user.getId())) { this.clearingUserScore(user.getId()); ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.remove(user.getId()); this.refreshUser(ds.deskId); } } else if (uuid == 2) { Integer roomId = (Integer)LocalMem.C.remove(user.getId()); if (roomId != null) { if (LocalMem.D.containsKey(user.getId())) { this.clearingUserScore(user.getId()); //com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.remove(user.getId()); this.refreshUser(ds.deskId); } this.enterRoom(roomId - 1, session); } else { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "quitToLogin", new Object[]{6})); } } else if (uuid == 3) { ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(user.getId()); if (ds != null) { int roomId = (Integer)LocalMem.C.remove(user.getId()); this.enterRoom(roomId - 1, session); this.refreshUser(ds.deskId); } else { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "quitToLogin", new Object[]{6})); this.log.error(username + "重连失败quitToLogin 6"); } } this.userDao.IIIIlIlIIIIlIIlI("update User set lastGame = 3 where id = ?", new Object[]{user.getId()}).executeUpdate(); final int isShutup = user.getShutupStatus(); (new Thread() { @Override public void run() { try { Thread.sleep(5000L); } catch (InterruptedException var2) { var2.printStackTrace(); } IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "userShutup", new Object[]{(Boolean)(isShutup > 0 ? 1 : false)})); } }).start(); return null; //} } public void enterRoom(int roomType, IoSession session) { int userId = Integer.parseInt(session.getAttribute("id").toString()); if (!LocalMem.C.containsKey(userId)) { List<BulletFishDesk> desks = this.bulletFishDeskDao.IIIIlIlIIIIlIIlI(roomType + 1); /*Iterator var6 = desks.iterator(); while(var6.hasNext()) { BulletFishDesk d = (BulletFishDesk)var6.next();*/ for (final BulletFishDesk d : desks) { Seat[] seats = this.getDesksSeats(d.getId()); d.setSeats(seats); } LocalMem.C.put(userId, roomType + 1); Map<String, Object> result = new HashMap(); result.put("FishDesk", desks.toArray(new BulletFishDesk[0])); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "roomInfo", new Object[]{result})); } } public void leaveRoom(int roomId, IoSession session) { Integer userId = Integer.parseInt(session.getAttribute("id").toString()); LocalMem.C.remove(userId); } @Transactional public Map<String, Object> requestSeat(int deskId, int seatId, IoSession session) { Map<String, Object> result = new HashMap(); Integer userId = Integer.parseInt(session.getAttribute("id").toString()); com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("userService/userSelectSeat", new Object[]{userId, String.valueOf(System.currentTimeMillis())}); com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/requestDesk", new Object[]{userId, deskId}); if (LocalMem.D.containsKey(userId)) { return null; } //else { BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(deskId); if (desk == null) { result.put("bCanSeat", false); result.put("messageStatus", 0); return result; } //else { User user = (User)this.userDao.IIIIlIlIIIIlIIlI(userId); if (desk.getRoomId() == 2) { if (user.getGameGold() < desk.getMinGold()) { result.put("bCanSeat", false); result.put("messageStatus", 1); return result; } } else if (user.getExpeGold() < desk.getMinGold()) { result.put("bCanSeat", false); result.put("messageStatus", 1); return result; } if (this.limitEnterDesk(userId, deskId)) { String reason = "用户:" + userId + "," + OverFishPropertyUtil.limitSecond + "秒内上桌<" + desk.getName() + ">次数超过" + OverFishPropertyUtil.limitCount + "次,进行封号处理"; this.log.info(reason); this.lockUser(userId, reason); } int deskOnlineNum = 0; synchronized(desk) { //Iterator var11 = LocalMem.D.entrySet().iterator(); //while(var11.hasNext()) { // Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var11.next(); for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == deskId && ((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).IIIllIlIlIlIlIll == seatId) { result.put("bCanSeat", false); result.put("messageStatus", 2); return result; } //if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == deskId) {++deskOnlineNum;} if (entry.getValue().deskId != deskId) {continue;} ++deskOnlineNum; } LocalMem.D.put(userId, new com.miracle9.game.bean.IIIIlIlllllIlllI(deskId, seatId)); ++deskOnlineNum; Integer deskMaxOnlineNum = (Integer)LocalMem.H.get(deskId); if (deskMaxOnlineNum == null || deskMaxOnlineNum < deskOnlineNum) { LocalMem.H.put(deskId, deskOnlineNum); } } if (desk.getAutoKick() == 1) { LocalMem.z.put(session, System.currentTimeMillis()); } if (desk.getAutoKick() >= 1) { LocalMem.z.put(session, System.currentTimeMillis()); session.setAttribute("kicktime", String.valueOf(desk.getAutoKick())); } result.put("bCanSeat", true); Integer bgId = (Integer)LocalMem.I.get(deskId); if (bgId == null) { Random random = new Random(); bgId = random.nextInt(3); LocalMem.I.put(deskId, bgId); } result.put("bgId", bgId); result.put("seatId", seatId); result.put("messageStatus", -1); this.userDao.IIIIlIlIIIIlIIlI(userId, deskId); this.refreshUser(deskId); if (desk.getRoomId() == 2) { UserWarning userWarning = this.userWarningService.IlIIIIIlIllIlIIl(user.getId()); if (userWarning == null) { userWarning = new UserWarning(); userWarning.setUserId(user.getId()); } userWardingCache.put(user.getId(), userWarning); } com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/requestSeat", new Object[]{userId, com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.llllllIlllIIlIll}); return result; //} //} } @Transactional public void leaveSeat(int deskId, int seatId, IoSession session) { Integer userId = Integer.parseInt(session.getAttribute("id").toString()); this.clearingUserScore(userId); LocalMem.F.remove(userId); LocalMem.z.remove(session); Integer fishId = (Integer)LocalMem.M.get(userId); if (fishId != null) { this.unLockFish(session); } com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.remove(userId); if (ds != null) { this.refreshUser(deskId); } } public Seat[] getDesksSeats(Integer id) { BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(id.intValue()); List<Seat> seats = new ArrayList(); List<Integer> existSeat = new ArrayList(); //Iterator var6 = LocalMem.D.entrySet().iterator(); //while(var6.hasNext()) { // Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var6.next(); for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == id) { User user = (User)CacheUser.get(entry.getKey()); Seat s = new Seat(); s.id = ((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).IIIllIlIlIlIlIll; s.isFree = false; s.user = user; Integer gunValue = (Integer)LocalMem.F.get(user.getId()); if (gunValue == null) { gunValue = desk.getMinGold(); } s.gunValue = gunValue; seats.add(s); existSeat.add(s.id); } } for(int i = 1; i <= 4; ++i) { if (!existSeat.contains(i)) { Seat s = new Seat(); s.isFree = true; s.id = i; seats.add(s); } } return (Seat[])seats.toArray(new Seat[0]); } @Transactional public void clearingUserScore(int id) { try { User user = (User)this.userDao.IIIIlIlIIIIlIIlI(id); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(id); IoSession session = (IoSession)LocalMem.B.get(id); int deskId = 1; if (ds != null) { deskId = ds.deskId; } else { deskId = user.getLastDeskId(); } BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(deskId); int notCrashScore = 0; int score = 0; final int gameGold = user.getGameGold(); synchronized((User)CacheUser.get(id)) { List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> fireds = (List)LocalMem.E.get(id); if (fireds != null) { //com.miracle9.game.bean.IIlIlIIIIIlllIIl f; //for(Iterator var13 = fireds.iterator(); var13.hasNext(); notCrashScore += f.value) { // f = (com.miracle9.game.bean.IIlIlIIIIIlllIIl)var13.next(); //} for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f : fireds) { notCrashScore += f.value; } LocalMem.E.remove(id); } if (notCrashScore != 0) { addUserScore(notCrashScore, id); } score = getUserScore(id); ((User)CacheUser.get(id)).setGameScore(0); } int exchange = desk.getExchange(); int addGold = 0; //UserWarning userWarning; if (score > 0) { addGold = score / exchange; if (score % exchange != 0) { int odd = score % exchange; Random random = new Random(); if (random.nextInt(exchange) < odd) { ++addGold; } } if (desk.getRoomId() == 2) { if (userWardingCache.containsKey(user.getId())) { UserWarning userWarning = (UserWarning)userWardingCache.remove(user.getId()); long allGold = (long)(user.getGameGold() + addGold); userWarning.setGameGold(allGold); com.miracle9.game.IIIllIlIlIlIlIll.IlIIIIIlIllIlIIl.lIIIIlllllIIlIll().IIIIlIlIIIIlIIlI(userWarning); } this.log.error("结算用户分值id:" + id + "分:" + score + "币:" + gameGold); this.userDao.IIIIlIlIIIIlIIlI("update User set gameScore=0,gameGold=gameGold+? where id=?", new Object[]{addGold, id}).executeUpdate(); if (session != null) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{0})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameGold", new Object[]{user.getGameGold() + addGold})); } user = (User)this.userDao.IIIIlIlIIIIlIIlI(id); this.log.info("结算用户分值id:" + id + "分:" + score + "币:" + gameGold + "桌:" + desk.getId() + "算后币:" + user.getGameGold()); } else { this.userDao.IIIIlIlIIIIlIIlI("update User set expeScore=0,expeGold=expeGold+? where id=?", new Object[]{addGold, id}).executeUpdate(); if (session != null) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{0})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "expeGold", new Object[]{user.getExpeGold() + addGold})); } this.log.info("结算用户体验分值"); } } else if (userWardingCache.containsKey(id)) { UserWarning userWarning = (UserWarning)userWardingCache.remove(id); com.miracle9.game.IIIllIlIlIlIlIll.IlIIIIIlIllIlIIl.lIIIIlllllIIlIll().IIIIlIlIIIIlIIlI(userWarning); } synchronized(LocalMem.V) { UserTenMinScore userTenMinScore = (UserTenMinScore)LocalMem.O.remove(id); if (userTenMinScore != null && desk.getRoomId() == 2) { this.userDao.getSession().refresh(user); userTenMinScore.setYaGold(userTenMinScore.getYaGold() + userTenMinScore.yaFen / desk.getExchange()); userTenMinScore.setDeGold(userTenMinScore.getDeGold() + userTenMinScore.deFen / desk.getExchange()); this.userTenMinScoreService.IIIIlIlIIIIlIIlI(user, userTenMinScore.getYaGold(), userTenMinScore.getDeGold(), user.getGameGold()); } } } catch (Exception e) { this.log.error("结算出错id:" + id, e); } } public static int getUserScore(int id) { User user = (User)CacheUser.get(id); return user == null ? 0 : user.getGameScore(); } public static boolean addUserScore(int score, int id) { User user = (User)CacheUser.get(id); synchronized(user) { int newScore = user.getGameScore() + score; if (newScore < 0) { return false; } user.setGameScore(newScore); return true; } } public void refreshUser(Integer deskId) { List<User> users = new ArrayList(); List<Seat> seats = new ArrayList<Seat>(); final BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI((int)deskId); List<Integer> existSeat = new ArrayList(); //Iterator var7 = LocalMem.D.entrySet().iterator(); //while(var7.hasNext()) { // Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var7.next(); for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == deskId) { Seat s = new Seat(); s.user = (User)CacheUser.get(entry.getKey()); s.id = ((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).IIIllIlIlIlIlIll; s.isFree = false; Integer gunValue = (Integer)LocalMem.F.get(entry.getKey()); if (gunValue == null) { gunValue = desk.getMinGunValue(); } s.gunValue = gunValue; seats.add(s); existSeat.add(s.id); users.add(s.user); } } for(int i = 1; i <= 4; ++i) { if (!existSeat.contains(i)) { Seat seat = new Seat(); seat.isFree = true; seat.id = i; seats.add(seat); } } Iterator seat = LocalMem.C.entrySet().iterator(); while(((Iterator)seat).hasNext()) { Entry<Integer, Integer> entry = (Entry)((Iterator)seat).next(); if ((Integer)entry.getValue() == desk.getRoomId()) { IoSession session = (IoSession)LocalMem.B.get(entry.getKey()); Map<String, Object> map = new HashMap(); map.put("deskId", deskId); map.put("Seat", seats.toArray(new Seat[0])); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "updateDeskInfo", new Object[]{map})); } } com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/deskInfo", new Object[]{deskId, users, 3}); } @Transactional public void userCoinIn(int num, IoSession session) { int userId = Integer.parseInt(session.getAttribute("id").toString()); this.log.info("玩家上分,玩家userId为" + userId); BulletFishDesk desk = null; com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null || num == 0) { return; } //if (ds != null && num != 0) { if (num < 0) { this.log.error("玩家上分小于0,分值为:" + num + " 玩家id为:" + userId); } //else { desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(ds.deskId); User user = (User)this.userDao.IIIIlIlIIIIlIIlI(userId); this.log.info("before userCoinIn num:" + num + ",userId:" + userId + ",deskId:" + ds.deskId + ",roomId:" + desk.getRoomId() + ",gameScore:" + user.getGameScore() + ",gameGold:" + user.getGameGold()); int addScore; int count; if (desk.getRoomId() == 2) { if (num * desk.getExchange() + getUserScore(userId) > 2000000) { //900000 return; } if (num > user.getGameGold()) { num = user.getGameGold(); } addScore = num * desk.getExchange(); count = this.userDao.IIIIlIlllllIlllI(userId, -num, addScore); this.log.info("addExpeGold userId:" + userId + ",expeGold:" + -num + "expeScore:" + addScore); if (count > 0) { addUserScore(addScore, userId); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameGold", new Object[]{user.getGameGold() - num})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{getUserScore(userId)})); } } else { if (num * desk.getExchange() + user.getExpeScore() > 2000000) { //900000 return; } if (num > user.getExpeGold()) { num = user.getExpeGold(); } addScore = num * desk.getExchange(); count = this.userDao.IIIIlIlIIIIlIIlI(userId, -num, addScore); this.log.info("addGameGold userId:" + userId + ",gameGold:" + -num + "gameScore:" + addScore); if (count > 0) { addUserScore(addScore, userId); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "expeGold", new Object[]{user.getExpeGold() - num})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{getUserScore(userId)})); } } //} //} } @Transactional public void userCoinOut(int score, IoSession session) { int userId = Integer.parseInt(session.getAttribute("id").toString()); this.log.info("玩家下分,userId为:" + userId); BulletFishDesk desk = null; com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null || score == 0) { return; } //if (ds != null && score != 0) { if (score < 0) { this.log.error("玩家下分小于0,分值为:" + score + " 玩家id为:" + userId); } //else { desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(ds.deskId); int addGold = score / desk.getExchange(); this.log.info("before userCoinOut score:" + score + ",userId:" + userId + ",deskId:" + ds.deskId + ",roomId:" + desk.getRoomId() + ",userScore:" + getUserScore(userId)); //int count; User user; if (desk.getRoomId() == 2) { if (score > getUserScore(userId)) {return;} int count = this.userDao.IIIIlIlllllIlllI(userId, addGold, -score); this.log.info("addExpeGold userId:" + userId + ",expeGold:" + addGold + "expeScore:" + -score); if (count > 0) { addUserScore(-score, userId); User user = (User)this.userDao.IIIIlIlIIIIlIIlI(userId); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameGold", new Object[]{user.getGameGold()})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{getUserScore(userId)})); } } else { if (score > getUserScore(userId)) {return;} int count = this.userDao.IIIIlIlIIIIlIIlI(userId, addGold, -score); this.log.info("addGameGold userId:" + userId + ",gameGold:" + addGold + "gameScore:" + -score); if (count > 0) { addUserScore(-score, userId); User user = (User)this.userDao.IIIIlIlIIIIlIIlI(userId); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "expeGold", new Object[]{user.getExpeGold()})); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "gameScore", new Object[]{getUserScore(userId)})); } } // } //} } public void lockFish(int fishId, IoSession session) { try { Object obj = session.getAttribute("id"); if (obj == null) { return; } int userId = Integer.parseInt(obj.toString()); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null) { return; } com.miracle9.game.bean.IIIllIlIlIlIlIll deskStatus = (com.miracle9.game.bean.IIIllIlIlIlIlIll)LocalMem.J.get(ds.deskId); if (deskStatus.status == 2) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "lockFish", new Object[]{false, fishId, ds.IIIllIlIlIlIlIll})); return; } com.miracle9.game.bean.IIlIllIlllIIIlIl fish = new com.miracle9.game.bean.IIlIllIlllIIIlIl(); if (fishId < 1000) { int group = (Integer)com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl.o.get(ds.deskId); Integer fishType = (Integer)((ConcurrentHashMap)LocalMem.L.get(group)).get(fishId); if (fishType == null) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "lockFish", new Object[]{false, fishId, ds.IIIllIlIlIlIlIll})); return; } fish.id = fishId; fish.type = fishType; } else { ConcurrentHashMap<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> fishs = (ConcurrentHashMap)LocalMem.K.get(ds.deskId); fish = (com.miracle9.game.bean.IIlIllIlllIIIlIl)fishs.get(fishId); } if (fish == null) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "lockFish", new Object[]{false, fishId, ds.IIIllIlIlIlIlIll})); return; } if ((fish.type < 20 || fish.type >= 30) && fish.type != 39 && fish.type != 32 && (Integer)LocalMem.Q.get(fish.type) < 10) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "lockFish", new Object[]{false, fishId, ds.IIIllIlIlIlIlIll})); return; } if (LocalMem.M.get(userId) != null && (Integer)LocalMem.M.get(userId) == fishId) { return; } if (LocalMem.M.get(userId) != null && (Integer)LocalMem.M.get(userId) != fishId) { List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> fireds = (List)LocalMem.E.get(userId); if (fireds != null) { //Iterator localIterator = fireds.iterator(); //while(localIterator.hasNext()) { // com.miracle9.game.bean.IIlIlIIIIIlllIIl f = (com.miracle9.game.bean.IIlIlIIIIIlllIIl)localIterator.next(); for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f : fireds) { if (f.IIllllIlIlIlIIll == fishId) { f.IIllllIlIlIlIIll = -1; } } } } //Iterator var17 = LocalMem.D.entrySet().iterator(); //while(var17.hasNext()) { // Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var17.next(); for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == ds.deskId) { IoSession s = (IoSession)LocalMem.B.get(entry.getKey()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "lockFish", new Object[]{true, fishId, ds.IIIllIlIlIlIlIll})); } } LocalMem.M.put(userId, fishId); } catch (Exception e) { this.log.error("", e); } } public void unLockFish(IoSession session) { Object obj = session.getAttribute("id"); if (obj == null) {return;} //if (obj != null) { int userId = Integer.parseInt(obj.toString()); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null) {return;} //if (ds != null) { Integer fishId = (Integer)LocalMem.M.remove(userId); if (fishId == null) {return;} //if (fishId != null) { /*Iterator var7 = LocalMem.D.entrySet().iterator(); while(var7.hasNext()) { Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var7.next();*/ for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == ds.deskId) { IoSession s = (IoSession)LocalMem.B.get(entry.getKey()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "unLockFish", new Object[]{fishId, ds.IIIllIlIlIlIlIll})); } } List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> fireds = (List)LocalMem.E.get(userId); if (fireds != null) { for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f : fireds) { /*Iterator var11 = fireds.iterator(); while(var11.hasNext()) { com.miracle9.game.bean.IIlIlIIIIIlllIIl f = (com.miracle9.game.bean.IIlIlIIIIIlllIIl)var11.next();*/ if (f.IIllllIlIlIlIIll == fishId) { f.IIllllIlIlIlIIll = -1; } } } //} //} //} } public void fired(int gunid, double xy, int gunValue, boolean isEnergy, IoSession session) { try { Object obj = session.getAttribute("id"); if (obj == null || gunValue == 0 || gunValue > 10000) { return; } if (gunValue < 0) { gunValue = -gunValue; } int userId = (Integer)obj; User user = (User)CacheUser.get(userId); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null) { return; } int seatId = ds.IIIllIlIlIlIlIll; BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(ds.deskId); gunValue = Math.abs(gunValue); gunValue = -gunValue; if (gunValue > 10001) { this.log.info("用户<" + user.getUsername() + ">在桌子<" + desk.getName() + ">发炮炮值大于10000"); return; } if (gunValue < 0) { gunValue = -gunValue; } com.miracle9.game.bean.IIIllIlIlIlIlIll dStatus = (com.miracle9.game.bean.IIIllIlIlIlIlIll)LocalMem.J.get(desk.getId()); if (dStatus.status != 0) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "notFired", new Object[]{gunid, seatId, getUserScore(userId)})); return; } Integer syuid; if (!addUserScore(-gunValue, userId)) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "notFired", new Object[]{gunid, seatId, getUserScore(userId)})); syuid = (Integer)LocalMem.M.remove(userId); if (syuid != null) { this.unLockFish(session); } return; } LocalMem.F.put(userId, gunValue); if (desk.getAutoKick() == 1) { LocalMem.z.put(session, System.currentTimeMillis()); } if (desk.getAutoKick() >= 1) { LocalMem.z.put(session, System.currentTimeMillis()); session.setAttribute("kicktime", String.valueOf(desk.getAutoKick())); } syuid = userId; synchronized(syuid) { List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> fireds = (List)LocalMem.E.get(syuid); if (fireds == null) { LocalMem.E.put(syuid, fireds = new ArrayList()); } if (LocalMem.M.containsKey(syuid)) { int fishid = (Integer)LocalMem.M.get(syuid); ((List)fireds).add(new com.miracle9.game.bean.IIlIlIIIIIlllIIl(gunid, seatId, xy, gunValue, isEnergy, System.currentTimeMillis(), fishid)); } else { ((List)fireds).add(new com.miracle9.game.bean.IIlIlIIIIIlllIIl(gunid, seatId, xy, gunValue, isEnergy, System.currentTimeMillis(), -1)); } } /*Iterator var21 = LocalMem.D.entrySet().iterator(); while(var21.hasNext()) { Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var21.next();*/ for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId == desk.getId()) { IoSession s = (IoSession)LocalMem.B.get(entry.getKey()); if ((Integer)entry.getKey() != userId) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "fired", new Object[]{gunid, xy, seatId, gunValue, isEnergy, getUserScore(userId)})); } else { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "gameScore", new Object[]{user.getGameScore()})); } } } } catch (Exception e) { this.log.error("", e); } } @Transactional public void gunHitFish(int gunId, HitFish[] hitFishs, IoSession session) { this.GunHitFish(session, gunId, hitFishs); } @Transactional public void gunHitFish(int gunId, HitFish[] hitFishs, HitFish[] hitFishs2, IoSession session) { this.GunHitFish(session, gunId, hitFishs, hitFishs2); } public void GunHitFish(IoSession session, int gunId, HitFish[]... hitFishs) { boolean locked = false; Object obj = session.getAttribute("id"); if (obj == null) { return; } int userId = (Integer)obj; com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); if (ds == null) { return; } List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> fireds = (List)LocalMem.E.get(userId); if (fireds == null) { return; } HitFish[] hitfishs = hitFishs[0]; com.miracle9.game.bean.IIlIlIIIIIlllIIl hitFired = null; User cacheuser = (User)CacheUser.get(userId); synchronized(cacheuser) { /*、、Iterator var14 = fireds.iterator(); 、、while(var14.hasNext()) { 、、 com.miracle9.game.bean.IIlIlIIIIIlllIIl f = (com.miracle9.game.bean.IIlIlIIIIIlllIIl)var14.next();*/ for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f : fireds) { if (f.id == gunId) { hitFired = f; fireds.remove(f); break; } } } if (hitFired == null) { return; } //region 1 //try { HitFish[] hitfishs2 = null; int limitFishCount = 0; if (hitFishs.length == 2) { hitfishs2 = hitFishs[1]; limitFishCount = hitfishs2.length; } int totalFishCount = hitfishs.length; BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(ds.deskId); FishServerSuanfa server = (FishServerSuanfa)LocalMem.P.get(ds.deskId); DieFishInputInfo in = new DieFishInputInfo(); in.totalPlay = desk.getSumYaFen(); in.totalWin = desk.getSumDeFen(); if (ds.IIIllIlIlIlIlIll == 1) { in.slavePlay = desk.getSumSeat1YaFen(); in.slaveWin = desk.getSumSeat1DeFen(); } else if (ds.IIIllIlIlIlIlIll == 2) { in.slavePlay = desk.getSumSeat2YaFen(); in.slaveWin = desk.getSumSeat2DeFen(); } else if (ds.IIIllIlIlIlIlIll == 3) { in.slavePlay = desk.getSumSeat3YaFen(); in.slaveWin = desk.getSumSeat3DeFen(); } else { in.slavePlay = desk.getSumSeat4YaFen(); in.slaveWin = desk.getSumSeat4DeFen(); } int totalUnproCredit = 0; boolean[] playerOnline = new boolean[4]; for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (entry.getValue().deskId == ds.deskId) { playerOnline[ds.IIIllIlIlIlIlIll - 1] = true; synchronized (UserService.CacheUser.get(entry.getKey())) { final List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> seatFireds = LocalMem.E.get(entry.getKey()); if (seatFireds != null) { for (int i = 0; i < seatFireds.size(); ++i) { totalUnproCredit += seatFireds.get(i).value; } } } /*playerOnline[ds.IIIllIlIlIlIlIll - 1] = true; synchronized((User)CacheUser.get(entry.getKey())) { List<com.miracle9.game.bean.IIlIlIIIIIlllIIl> seatFireds = (List)LocalMem.E.get(entry.getKey()); if (seatFireds != null) { for(int i = 0; i < seatFireds.size(); ++i) { totalUnproCredit += ((com.miracle9.game.bean.IIlIlIIIIIlllIIl)seatFireds.get(i)).value; } } }*/ // monitorexit((User)UserService.CacheUser.get((Object)entry.getKey())) } } //region 2 totalUnproCredit in.totalUnproCredit = totalUnproCredit; in.whichSlave = ds.IIIllIlIlIlIlIll; int slaveUnproCredit = 0; int gunValue = hitFired.value; if (hitFired.IIlllIlllllIIIIl) { gunValue = hitFired.value * 2; } //com.miracle9.game.bean.IIlIlIIIIIlllIIl f; //for(Iterator var50 = fireds.iterator(); var50.hasNext(); slaveUnproCredit += f.value) { // f = (com.miracle9.game.bean.IIlIlIIIIIlllIIl)var50.next(); //} for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f2 : fireds) { slaveUnproCredit += f2.value; } in.slaveUnproCredit = slaveUnproCredit; in.powerOfShell = hitFired.value; in.coinValue = desk.getExchange(); in.hallType = desk.getSiteType(); in.gameDfLevel = desk.getGameDiff(); in.playerInfo = playerOnline; FishInfo[] fis = new FishInfo[totalFishCount]; //region synchronized(desk) synchronized(desk) { ConcurrentHashMap<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> deskFishs = (ConcurrentHashMap)LocalMem.K.get(ds.deskId); if (deskFishs == null) { LocalMem.K.put(desk.getId(), deskFishs = new ConcurrentHashMap()); } if (hitFired.IIllllIlIlIlIIll != -1) { HitFish hitfish = hitfishs[0]; if (hitfish.IIllllIlIlIlIIll == hitFired.IIllllIlIlIlIIll && (hitFired.IIllllIlIlIlIIll < 1000 || !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitFired.IIllllIlIlIlIIll)).IlIIlIlIlllIllIl)) { locked = true; } } in.locked = locked; int count = totalFishCount; //int i; /*com.miracle9.game.bean.IIlIllIlllIIIlIl fish2; Iterator localIterator4; Iterator var65; Iterator itf;*/ //region for(int i = 0; i < totalFishCount; ++i) for(int i = 0; i < totalFishCount; ++i) { HitFish hf = hitfishs[i]; if (hf != null && deskFishs.get(hf.IIllllIlIlIlIIll) != null && hf.IIllllIlIlIlIIll >= 1000 && ((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hf.IIllllIlIlIlIIll)).IlIIlIlIlllIllIl) { --count; } else { FishInfo info = new FishInfo(); info.fishType = hf.fishType; info.fishid = hf.IIllllIlIlIlIIll; info.fx = (float)hf.IlIlIIIIlllIlIll; info.fy = (float)hf.IlIlIlllIIlIllll; if (info.fishType == 32) { info.fishType = ((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid)).IlIIIIllllIIllIl[0]; } if (info.fishType == 19) { info.bet = 300; } else if (info.fishType == 18) { info.bet = 100; } else if (info.fishType == 17) { info.bet = 40; } //Entry df; else if (info.fishType == 39) { com.miracle9.game.bean.IIlIllIlllIIIlIl fish = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid); info.bet = (Integer)LocalMem.Q.get(fish.IlIIIIllllIIllIl[0] - 20) + (Integer)LocalMem.Q.get(fish.IlIIIIllllIIllIl[1] - 20); /*Iterator localIterator3 = deskFishs.entrySet().iterator(); //label629: while(true) { while(true) { if (!localIterator3.hasNext()) {break label629;} df = (Entry)localIterator3.next();*/ for (final Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> fb : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl f3 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)fb.getValue(); if (f3.type == fish.IlIIIIllllIIllIl[0] - 20 && !f3.IlIIlIlIlllIllIl) { info.bet += (Integer)LocalMem.Q.get(f3.type); } else if (f3.type == fish.IlIIIIllllIIllIl[1] - 20 && !f3.IlIIlIlIlllIllIl) { info.bet += (Integer)LocalMem.Q.get(f3.type); } else if (f3.type == fish.IlIIIIllllIIllIl[0] && !f3.IlIIlIlIlllIllIl) { info.bet += (Integer)LocalMem.Q.get(f3.type - 20); } else if (f3.type == fish.IlIIIIllllIIllIl[1] && !f3.IlIIlIlIlllIllIl) { /*else { if (f3.type != fish.IlIIIIllllIIllIl[1] || f3.IlIIlIlIlllIllIl) { continue; }*/ info.bet += (Integer)LocalMem.Q.get(f3.type - 20); } } //} } else if (info.fishType >= 20 && info.fishType <= 29) { info.bet = (Integer)LocalMem.Q.get(info.fishType - 20); //var65 = deskFishs.entrySet().iterator(); //while(var65.hasNext()) { // df = (Entry)var65.next(); for (final Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> df : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl fish2 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)df.getValue(); if (fish2.type == info.fishType - 20 && !fish2.IlIIlIlIlllIllIl) { info.bet += (Integer)LocalMem.Q.get(fish2.type); } } } else if (info.fishType == 30) { info.bet = (Integer)LocalMem.Q.get(30); for(int j = 1; j < limitFishCount; ++j) { HitFish hitfish = hitfishs2[j]; if (hitfish.fishType == 32) { hitfish.fishType = ((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll)).IlIIIIllllIIllIl[0]; } if (hitfish.fishType == 19) { info.bet += 300; } else if (hitfish.fishType == 18) { info.bet += 100; } else if (hitfish.fishType == 17) { info.bet += 40; } else if (hitfish.fishType == 39) { com.miracle9.game.bean.IIlIllIlllIIIlIl fish2 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll); info.bet += (Integer)LocalMem.Q.get(fish2.IlIIIIllllIIllIl[0] - 20) + (Integer)LocalMem.Q.get(fish2.IlIIIIllllIIllIl[1] - 20); for (final Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> fb2 : deskFishs.entrySet()) { final com.miracle9.game.bean.IIlIllIlllIIIlIl f5 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)fb2.getValue(); if (f5.type == fish2.IlIIIIllllIIllIl[0] - 20 && !f5.IlIIlIlIlllIllIl) { info.bet += LocalMem.Q.get(f5.type); } else if (f5.type == fish2.IlIIIIllllIIllIl[1] - 20 && !f5.IlIIlIlIlllIllIl) { info.bet += LocalMem.Q.get(f5.type); } else if (f5.type == fish2.IlIIIIllllIIllIl[0] && !f5.IlIIlIlIlllIllIl) { info.bet += LocalMem.Q.get(f5.type - 20); } else if (f5.type == fish2.IlIIIIllllIIllIl[1] && !f5.IlIIlIlIlllIllIl) { info.bet += LocalMem.Q.get(f5.type - 20); } /*else { if (f5.type != fish2.IlIIIIllllIIllIl[1] || f5.IlIIlIlIlllIllIl) {continue;} final FishInfo fishInfo13 = info; fishInfo13.bet += LocalMem.Q.get(f5.type - 20); }*/ } } else if (hitfish.fishType >= 20 && hitfish.fishType <= 29) { info.bet += (Integer)LocalMem.Q.get(hitfish.fishType - 20); //itf = deskFishs.entrySet().iterator(); //while(itf.hasNext()) { // Object df = itf.next(); for (final Object df2 : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl f39 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)((Entry)df2).getValue(); if (f39.type == info.fishType - 20 && !f39.IlIIlIlIlllIllIl) { info.bet += (Integer)LocalMem.Q.get(f39.type); } } } else { info.bet += (Integer)LocalMem.Q.get(hitfish.fishType); } } } else { info.bet = (Integer)LocalMem.Q.get(info.fishType); } //log.debug( i +"|"+ totalFishCount +"|"+count );log.debug( i-(totalFishCount - count) ); fis[i - (totalFishCount - count) ] = info; // fis[i - (totalFishCount - count)] = info; } } //endregion //region 处理等级 if (cacheuser.getType() == 0) { double addLevelScore = 0.0D; if (desk.getRoomId() == 1) { if (cacheuser.getLevel() <= 3) { addLevelScore = 0.00463D; } } else { addLevelScore = 0.00926D; } if (addLevelScore != 0.0D) { cacheuser.setLevelScore(cacheuser.getLevelScore() + addLevelScore); LevelInfo level = this.levelInfoDao.IIlllIlllllIIIIl(cacheuser.getLevel()); if (level != null && cacheuser.getLevelScore() > level.getMaxScore() && level.getLevel() < 16) { cacheuser.setLevel(cacheuser.getLevel() + 1); com.miracle9.game.IIIllIlIlIlIlIll.IIIIlIlllllIlllI.IIlllIlllllIIIIl("update User set level=level+1 where id=?", new Object[]{userId}); } } } //endregion //region 处理 对应座位的 压分得分 //double yaGold; //double deGold; if (count == 0) { this.bulletFishDeskDao.IIIIlIlIIIIlIIlI((long)hitFired.value, 0L, ds.IIIllIlIlIlIlIll, ds.deskId); if (desk.getRoomId() == 2) { GameDataLog dataLog = this.gameDataLogDao.IIllIIlIIlIlIlIl(cacheuser.getPromoterId()); if (dataLog == null) { this.gameDataLogDao.IIlllIIIlIllIIIl(cacheuser.getPromoterId()); dataLog = this.gameDataLogDao.IIllIIlIIlIlIlIl(cacheuser.getPromoterId()); } double yaGold = MyUtil.IIIIlIlllllIlllI((double)hitFired.value, (double)desk.getExchange()); double deGold = MyUtil.IIIIlIlllllIlllI(0.0D, (double)desk.getExchange()); this.gameDataLogDao.IIIIlIlIIIIlIIlI(dataLog, yaGold, deGold); if (userWardingCache.containsKey(userId)) { UserWarning userWarning = (UserWarning)userWardingCache.get(userId); final double newYaGold = userWarning.getYaGold() + yaGold; userWarning.setYaGold(newYaGold); final double newDeGold = userWarning.getDeGold() + deGold; userWarning.setDeGold(newDeGold); /*yaGold = userWarning.getYaGold() + yaGold; userWarning.setYaGold(yaGold); deGold = userWarning.getDeGold() + deGold; userWarning.setDeGold(deGold);*/ } UserTenMinScore userTenMinScore = (UserTenMinScore)LocalMem.O.get(userId); if (userTenMinScore == null) { LocalMem.O.put(userId, userTenMinScore = new UserTenMinScore(userId, ds.deskId)); } userTenMinScore.yaFen += hitFired.value; } // monitorexit(desk) return; } //endregion fis = (FishInfo[])Arrays.copyOf(fis, count); in.totalFish = count; in.fishes = fis; in.ionicCannonState = hitFired.IIlllIlllllIIIIl; //是否能量炮 in.gameDfLevel = desk.getGameDiff(); boolean bCreateX2Gun = false; boolean bDeadBomb = false; DieFishOutputInfo out; //manageservice.class 加载了special if (IIlllIIIlIllIIIllsiillill.contains(userId)) { log.debug("special UId:" + userId); //in = this.specialKill(in); /*for(int i = 0; i < in.totalFish; ++i) { System.out.print(in.fishes[i].fsDead); }*/ } else { log.debug("normal UId:" + userId); } out = server.IsFishDied(desk.getId(), in); //region 鱼死了 totalfish > 0 打中 计算得分 int addScore = 0; double watervalue = 1 + cacheuser.getWaterValue(); if (out != null && out.totalFish > 0) { //region 瞎火 //User user = (User)this.userDao.IIlIllIlllIIIlIl("from User where username=?", new Object[]{cacheUser.getUsername()}); int nRandomNumber = ((int) (Math.random() * 99.0d)+1) % 100; this.log.debug( nRandomNumber + "你有多瞎:" + watervalue); //endregion if (nRandomNumber > watervalue * 100.0d) { this.log.debug( "瞎火" + nRandomNumber + "> "+ watervalue * 100.0d ); } else { bCreateX2Gun = out.ionicCannonIndex != -1; HitFish[] dieFishs = new HitFish[out.totalFish]; for(int i = 0; i < out.totalFish; ++i) { FishInfo info = out.dead[i]; for (final Object entry2 : LocalMem.M.entrySet()) { if (((Map.Entry)entry2).getValue() == info.fishid) { for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f6 : fireds) { f6.IIllllIlIlIlIIll = -1; } LocalMem.M.remove(((Map.Entry)entry2).getKey()); } } if (info.fishType == 31 && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid)).IlIIlIlIlllIllIl) { //定屏 com.miracle9.game.bean.IIIllIlIlIlIlIll deskStatus = (com.miracle9.game.bean.IIIllIlIlIlIlIll)LocalMem.J.get(ds.deskId); if (deskStatus.status == 0) { deskStatus.IIlIlIIIIIlllIIl += 10000L; LocalMem.G.put(ds.deskId, System.currentTimeMillis() + 10000L); //localIterator5 = deskFishs.entrySet().iterator(); //while(localIterator5.hasNext()) { // df = (Entry)localIterator5.next(); for (Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> df : deskFishs.entrySet()) { if (!df.getValue().IlIIlIlIlllIllIl) { //var10000 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)dfa1.getValue() ; //var10000.IlIIIIIlIllIlIIl += 10000L; //(com.miracle9.game.bean.IIlIllIlllIIIlIl)dfa1.getValue() += 10000L; final com.miracle9.game.bean.IIlIllIlllIIIlIl ilIllIlllIIIlIl = df.getValue(); ilIllIlllIIIlIl.IlIIIIIlIllIlIIl += 10000L; } } } } addScore += info.bet * hitFired.value; com.miracle9.game.bean.IIlIllIlllIIIlIl fish3; //region fishType 39 if (info.fishType == 39) { com.miracle9.game.bean.IIlIllIlllIIIlIl fish = deskFishs.get(Integer.valueOf(info.fishid)); for (Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> fb : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl fbb = fb.getValue(); if (fbb.type == fish.IlIIIIllllIIllIl[0] - 20 && !fbb.IlIIlIlIlllIllIl) { fbb.IlIIlIlIlllIllIl = true; continue; } if (fbb.type == fish.IlIIIIllllIIllIl[1] - 20 && !fbb.IlIIlIlIlllIllIl) { fbb.IlIIlIlIlllIllIl = true; continue; } if (fbb.type == fish.IlIIIIllllIIllIl[0] && !fbb.IlIIlIlIlllIllIl) { fbb.IlIIlIlIlllIllIl = true; continue; } if (fbb.type == fish.IlIIIIllllIIllIl[1] && !fbb.IlIIlIlIlllIllIl) fbb.IlIIlIlIlllIllIl = true; } /* fish2 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid); localIterator5 = deskFishs.entrySet().iterator(); label446: while(true) { while(true) { if (!localIterator5.hasNext()) { break label446; } df = (Entry)localIterator5.next(); fish3 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)df.getValue(); if (fish3.type == fish2.IlIIIIllllIIllIl[0] - 20 && !fish3.IlIIlIlIlllIllIl) { fish3.IlIIlIlIlllIllIl = true; } else if (fish3.type == fish2.IlIIIIllllIIllIl[1] - 20 && !fish3.IlIIlIlIlllIllIl) { fish3.IlIIlIlIlllIllIl = true; } else if (fish3.type == fish2.IlIIIIllllIIllIl[0] && !fish3.IlIIlIlIlllIllIl) { fish3.IlIIlIlIlllIllIl = true; } else if (fish3.type == fish2.IlIIIIllllIIllIl[1] && !fish3.IlIIlIlIlllIllIl) { fish3.IlIIlIlIlllIllIl = true; } } }*/ } //endregion if (info.fishid >= 1000 && deskFishs.get(info.fishid) != null && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid)).IlIIlIlIlllIllIl && (info.fishType == 18 || info.fishType == 19 || info.fishType == 30 || info.fishType == 31)) { ((Map)com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl.m.get(ds.deskId)).put(info.fishType, (Integer)((Map)com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl.m.get(ds.deskId)).get(info.fishType) - 1); } if (info.fishType == 30) { bDeadBomb = true; this.sendNotice(30, hitFired.value * info.bet, desk, cacheuser); if (desk.getRoomId() == 2) { com.miracle9.game.IIIllIlIlIlIlIll.IIIIlIlllllIlllI.IIIIlIlIIIIlIIlI(info.bet, info.bet * hitFired.value / desk.getExchange(), 30, cacheuser); } //label547: for(int j = 1; j < limitFishCount; ++j) { HitFish hitfish = hitfishs2[j]; for (final Map.Entry<Integer, Integer> entry3 : LocalMem.M.entrySet()) { if (entry3.getValue() == info.fishid) { for (final com.miracle9.game.bean.IIlIlIIIIIlllIIl f7 : fireds) { f7.IIllllIlIlIlIIll = -1; } LocalMem.M.remove(entry3.getKey()); } } if (deskFishs.get(hitfish.IIllllIlIlIlIIll) != null && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll)).IlIIlIlIlllIllIl && (hitfish.fishType == 18 || hitfish.fishType == 19 || hitfish.fishType == 30 || hitfish.fishType == 31)) { ((Map)com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl.m.get(ds.deskId)).put(hitfish.fishType, (Integer)((Map)com.miracle9.game.IIIllIlIlIlIlIll.IIlIlIIIIIlllIIl.m.get(ds.deskId)).get(hitfish.fishType) - 1); } if (hitfish.fishType == 39) { fish3 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid); if (fish3 != null) { for (final Object fb4 : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl ff = (com.miracle9.game.bean.IIlIllIlllIIIlIl)((Entry)fb4).getValue(); if (ff.type == fish3.IlIIIIllllIIllIl[0] - 20 && !ff.IlIIlIlIlllIllIl) { ff.IlIIlIlIlllIllIl = true; } else if (ff.type == fish3.IlIIIIllllIIllIl[1] - 20 && !ff.IlIIlIlIlllIllIl) { ff.IlIIlIlIlllIllIl = true; } else if (ff.type == fish3.IlIIIIllllIIllIl[0] && !ff.IlIIlIlIlllIllIl) { ff.IlIIlIlIlllIllIl = true; } else if (ff.type == fish3.IlIIIIllllIIllIl[1] && !ff.IlIIlIlIlllIllIl) { ff.IlIIlIlIlllIllIl = true; } } } } else if (hitfish.fishType == 19 && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll)).IlIIlIlIlllIllIl) { this.sendNotice(hitfish.fishType, hitFired.value * 300, desk, cacheuser); if (desk.getRoomId() == 2) { com.miracle9.game.IIIllIlIlIlIlIll.IIIIlIlllllIlllI.IIIIlIlIIIIlIIlI(hitfish.bet, hitfish.bet * hitFired.value / desk.getExchange(), 19, cacheuser); } } else if (hitfish.fishType == 31 && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll)).IlIIlIlIlllIllIl) { com.miracle9.game.bean.IIIllIlIlIlIlIll deskStatus = (com.miracle9.game.bean.IIIllIlIlIlIlIll)LocalMem.J.get(ds.deskId); if (deskStatus.status == 0) { ((com.miracle9.game.bean.IIIllIlIlIlIlIll)LocalMem.J.get(desk.getId())).IIlIlIIIIIlllIIl = deskStatus.IIlIlIIIIIlllIIl + 10000L; LocalMem.G.put(ds.deskId, System.currentTimeMillis() + 10000L); for (Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> df : deskFishs.entrySet()) { if (!((com.miracle9.game.bean.IIlIllIlllIIIlIl)df.getValue()).IlIIlIlIlllIllIl) { //final com.miracle9.game.bean.IIlIllIlllIIIlIl ilIllIlllIIIlIl2 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)((Entry)df).getValue(); //ilIllIlllIIIlIl2.IlIIIIIlIllIlIIl += 10000L; ((com.miracle9.game.bean.IIlIllIlllIIIlIl)df.getValue()).IlIIIIIlIllIlIIl += 10000L; } } } } else if (hitfish.fishType >= 20 && hitfish.fishType <= 29) { for (final Map.Entry<Integer, com.miracle9.game.bean.IIlIllIlllIIIlIl> df4 : deskFishs.entrySet()) { com.miracle9.game.bean.IIlIllIlllIIIlIl ff = (com.miracle9.game.bean.IIlIllIlllIIIlIl)df4.getValue(); if (ff.type == info.fishType - 20 && !ff.IlIIlIlIlllIllIl) { ff.IlIIlIlIlllIllIl = true; } } } com.miracle9.game.bean.IIlIllIlllIIIlIl fish4 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(hitfish.IIllllIlIlIlIIll); if (fish4 != null) { fish4.IlIIlIlIlllIllIl = true; } } } //if (info.fishType != 30) { //牛魔 else if (info.fishType == 19 && !((com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid)).IlIIlIlIlllIllIl) { this.sendNotice(19, info.bet * hitFired.value, desk, cacheuser); if (desk.getRoomId() == 2) { com.miracle9.game.IIIllIlIlIlIlIll.IIIIlIlllllIlllI.IIIIlIlIIIIlIIlI(info.bet, info.bet * hitFired.value / desk.getExchange(), 19, cacheuser); } } //一串串 else if (info.fishType >= 20 && info.fishType <= 29) { /*localIterator5 = deskFishs.entrySet().iterator(); while(localIterator5.hasNext()) { Object df = localIterator5.next();*/ for (final Object df5 : deskFishs.entrySet()) { fish3 = (com.miracle9.game.bean.IIlIllIlllIIIlIl)((Entry)df5).getValue(); if (fish3.type == info.fishType - 20 && !fish3.IlIIlIlIlllIllIl) { fish3.IlIIlIlIlllIllIl = true; } } } //} HitFish hf = new HitFish(); hf.IIllllIlIlIlIIll = info.fishid; hf.fishType = info.fishType; hf.IlIlIIIIlllIlIll = (double)info.fx; hf.IlIlIlllIIlIllll = (double)info.fy; hf.bet = info.bet; if (hitFired.IIlllIlllllIIIIl) { hf.bet /= 2; } dieFishs[i] = hf; com.miracle9.game.bean.IIlIllIlllIIIlIl ff = (com.miracle9.game.bean.IIlIllIlllIIIlIl)deskFishs.get(info.fishid); if (ff != null && ff.type >= 10) { ff.IlIIlIlIlllIllIl = true; this.clearFishLock(ff.id); } } addUserScore(addScore, userId); if (bDeadBomb) { for (final Object entry : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)((Entry)entry).getValue()).deskId == ds.deskId) { IoSession s = (IoSession)LocalMem.B.get(((Entry)entry).getKey()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "gunHitFish", new Object[]{gunId, gunValue, ds.IIIllIlIlIlIlIll, bCreateX2Gun, bDeadBomb, addScore, getUserScore(userId), dieFishs, hitfishs2})); } } } else { for (final Object entry4 : LocalMem.D.entrySet()) { if (((com.miracle9.game.bean.IIIIlIlllllIlllI)((Entry)entry4).getValue()).deskId == ds.deskId) { IoSession s = (IoSession)LocalMem.B.get(((Entry)entry4).getKey()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "gunHitFish", new Object[]{gunId, gunValue, ds.IIIllIlIlIlIlIll, bCreateX2Gun, bDeadBomb, addScore, getUserScore(userId), dieFishs})); } } } } } //endregion 鱼死了 totalfish > 0 打中 计算得分 //region 处理 对应座位的 压分得分 this.bulletFishDeskDao.IIIIlIlIIIIlIIlI((long)hitFired.value, (long)addScore, ds.IIIllIlIlIlIlIll, ds.deskId); if (desk.getRoomId() == 2) { GameDataLog dataLog = this.gameDataLogDao.IIllIIlIIlIlIlIl(cacheuser.getPromoterId()); if (dataLog == null) { this.gameDataLogDao.IIlllIIIlIllIIIl(cacheuser.getPromoterId()); dataLog = this.gameDataLogDao.IIllIIlIIlIlIlIl(cacheuser.getPromoterId()); } double yaGold = MyUtil.IIIIlIlllllIlllI((double)hitFired.value, (double)desk.getExchange()); double deGold = MyUtil.IIIIlIlllllIlllI((double)addScore, (double)desk.getExchange()); this.gameDataLogDao.IIIIlIlIIIIlIIlI(dataLog, yaGold, deGold); UserWarning userWarning; double newYaGold; double newDeGold; if (userWardingCache.containsKey(userId)) { userWarning = (UserWarning)userWardingCache.get(userId); newYaGold = userWarning.getYaGold() + yaGold; userWarning.setYaGold(newYaGold); newDeGold = userWarning.getDeGold() + deGold; userWarning.setDeGold(newDeGold); userWardingCache.put(userId, userWarning); } else { userWarning = this.userWarningService.IlIIIIIlIllIlIIl(userId); if (userWarning == null) { userWarning = new UserWarning(); userWarning.setUserId(userId); newYaGold = userWarning.getYaGold() + yaGold; userWarning.setYaGold(newYaGold); newDeGold = userWarning.getDeGold() + deGold; userWarning.setDeGold(newDeGold); } userWardingCache.put(userId, userWarning); this.log.error("缓存没有该玩家预警,玩家Id为:" + userId); } UserTenMinScore userTenMinScore = (UserTenMinScore)LocalMem.O.get(userId); if (userTenMinScore == null) { LocalMem.O.put(userId, userTenMinScore = new UserTenMinScore(userId, ds.deskId)); } userTenMinScore.yaFen += hitFired.value; userTenMinScore.deFen += addScore; if (LocalMem.x.contains(userId)) { this.log.info("玩家" + cacheuser.getUsername() + ",碰撞获得分值=" + addScore + ",当前币值、分值=" + cacheuser.getGameGold() + "," + cacheuser.getGameScore()); } } //endregion //return; } //endregion synchronized(desk) //endregion //} /*catch (Exception e) { this.log.error("", e); }*/ //endregion } @Transactional public Map<String, Object> playerInfo(int id, IoSession session) { Map<String, Object> result = new HashMap(); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(id); if (ds == null) { return null; } //else { User user = (User)this.userDao.IIIIlIlIIIIlIIlI(id); //fix 200513 更新水值 //User user = (User)this.userDao.IIlIllIlllIIIlIl("from User where username=?", new Object[]{username}); User cacheUser = (User)UserService.CacheUser.get(user.getId()); cacheUser.setWaterValue(user.getWaterValue() ); System.out.println("你个大水B:" + cacheUser.getWaterValue() ); OverFishPropertyUtil.reLoadConf(0); //fix 200513 result.put("user", user); result.put("seatId", ds.IIIllIlIlIlIlIll); int num = this.userTopDao.IIllIIlIIlIlIlIl("select count(*) from UserTop where type=3 and userId=?", new Object[]{id}); if (num <= 0) { result.put("honor", -1); } else { Query query = this.userTopDao.IIIIlIlIIIIlIIlI("select count(*) from UserTop where type=3 and gold>(select max(gold) from UserTop where type=3 and userId=?)", new Object[]{user.getId()}); Object temp = query.uniqueResult(); num = Integer.parseInt(temp.toString()) + 1; if (num > 10) { result.put("honor", -1); } else { result.put("honor", num); } } return result; //} } public void sendChat(int type, int receiverUserId, String message, IoSession session) { Integer senderId = Integer.parseInt(session.getAttribute("id").toString()); com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(senderId); Map<String, Object> senderMessage = new HashMap(); senderMessage.put("chatType", type); senderMessage.put("senderSeatId", ds.IIIllIlIlIlIlIll); senderMessage.put("chatMessage", message); if (type == 0) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "sendChat", new Object[]{senderMessage})); IoSession reSession = (IoSession)LocalMem.B.get(receiverUserId); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(reSession, "sendChat", new Object[]{senderMessage})); } else { /*Iterator var9 = LocalMem.D.entrySet().iterator(); while(var9.hasNext()) { Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var9.next(); */ for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { if (ds.deskId == ((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId) { IoSession s = (IoSession)LocalMem.B.get(entry.getKey()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(s, "sendChat", new Object[]{senderMessage})); } } } } public void heart(IoSession session) { LocalMem.A.put(session, System.currentTimeMillis()); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "heart", new Object[0])); } @Transactional public boolean addExpeGoldAuto(IoSession session) { try { Integer userId = Integer.parseInt(session.getAttribute("id").toString()); this.userDao.IIIIlIlllllIlllI(userId, 10000); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "expeGold", new Object[]{10000})); return true; } catch (Exception ex) { return false; } } @Transactional public void quitGame(IoSession session) { try { if (session == null) { return; } Object oUserId = session.getAttribute("id"); if (oUserId == null) { return; } int userId = Integer.parseInt(oUserId.toString()); if (LocalMem.C.containsKey(userId)) { LocalMem.C.remove(userId); } if (LocalMem.D.containsKey(userId)) { com.miracle9.game.bean.IIIIlIlllllIlllI ds = (com.miracle9.game.bean.IIIIlIlllllIlllI)LocalMem.D.get(userId); this.leaveSeat(ds.deskId, ds.IIIllIlIlIlIlIll, session); } session.removeAttribute("id"); LocalMem.B.remove(userId); LocalMem.y.remove(userId); if (LocalMem.z.containsKey(userId)) { LocalMem.z.remove(userId); } LocalMem.A.remove(session); CacheUser.remove(userId); LocalMem.F.remove(userId); com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("gameService/logout", new Object[]{userId, com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.llllllIlllIIlIll}); } catch (NumberFormatException var5) { this.log.error("退出游戏出错"); } } private void sendNotice(int type, int score, BulletFishDesk desk, User user) { String content = null; if (desk.getRoomId() == 1) { if (type == 19) { content = "恭喜:练习厅" + desk.getName() + "桌" + user.getNickname() + "捕获超级BOSS,获得" + score + "分"; } else { content = "恭喜:练习厅" + desk.getName() + "桌" + user.getNickname() + "击中超级炸弹,获得" + score + "分"; } } else if (type == 19) { content = "恭喜:竞技厅" + desk.getName() + "桌" + user.getNickname() + "捕获超级BOSS,获得" + score + "分"; } else { content = "恭喜:竞技厅" + desk.getName() + "桌" + user.getNickname() + "击中超级炸弹,获得" + score + "分"; } for (final Map.Entry<Integer, IoSession> entry : LocalMem.B.entrySet()) { IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI((IoSession)entry.getValue(), "scrollMessage", new Object[]{content})); } } public void clearFishLock(Integer fishId) { if (fishId == null) { return; } for (final Map.Entry<Integer, Integer> entry : LocalMem.M.entrySet()) { if (entry.getValue() == fishId) { IoSession s = (IoSession)LocalMem.B.get(entry.getKey()); this.unLockFish(s); } } } @Transactional public User getUser(Integer userId) { return (User)this.userDao.IIIIlIlIIIIlIIlI(userId); } @Transactional public void asyncSave(String hql, Object... params) { this.userDao.IIIIlIlIIIIlIIlI(hql, params).executeUpdate(); } @Transactional public void asyncSaveGameData() { SystemConfig config = this.systemConfigDao.IIllIIlIIlIlIlIl(); //Iterator var3 = LocalMem.D.entrySet().iterator(); //while(var3.hasNext()) { // Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry = (Entry)var3.next(); for (Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId); if (desk != null) { String hql = null; if (desk.getRoomId() == 2) { hql = "update User set gameScore=?,levelScore=? where id=?"; } else { hql = "update User set expeScore=?,levelScore=? where id=?"; } User user = (User)CacheUser.get(entry.getKey()); this.asyncSave(hql, user.getGameScore(), user.getLevelScore(), user.getId()); user = this.getUser(user.getId()); if (desk.getRoomId() != 2) { continue; } //if (desk.getRoomId() == 2) { int sumGameGold = user.getGameGold() + getUserScore(user.getId()) / desk.getExchange(); UserWarning userWarning = (UserWarning)userWardingCache.get(entry.getKey()); if (userWarning == null) { userWarning = this.userWarningService.IlIIIIIlIllIlIIl((Integer)entry.getKey()); } userWarning.setGameGold((long)sumGameGold); userWardingCache.put((Integer)entry.getKey(), userWarning); int overrunMoney = 0; if (user.getPromoterId() == 0) { overrunMoney = config.getMoneyOverrun(); } else { Promoter promoter = (Promoter)this.promoterDao.IIIIlIlIIIIlIIlI(user.getPromoterId()); overrunMoney = promoter.getChildrenUserOver(); } if (overrunMoney == -1 || sumGameGold * config.getPayScale() < overrunMoney * 100) { continue; } //if (overrunMoney != -1 && sumGameGold * config.getPayScale() >= overrunMoney * 100) { this.userDao.IIIIlIlIIIIlIIlI((Integer)entry.getKey(), 1); this.userDao.getSession().flush(); int userId = user.getId(); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI((IoSession)LocalMem.B.get(user.getId()), "overflow", new Object[0])); this.log.error("=====" + userId + "爆机前" + "用户分数:" + user.getGameScore() + "币" + user.getGameGold()); this.clearingUserScore(user.getId()); User user2 = this.getUser(userId); this.log.error("=====" + userId + "爆机后" + "用户分数:" + user2.getGameScore() + "币" + user2.getGameGold()); LocalMem.D.remove(user.getId()); LocalMem.C.remove(user.getId()); this.refreshUser(desk.getId()); //} //} } } String date = MyUtil.IIIIlIlllllIlllI(new Date()); for (final Object entry : IIlIlIIIIIlllIIl.lIlIIllIlIllllII.entrySet()) { try { if (!date.equals(((GameDataLog)((Entry)entry).getValue()).getDatetime())) { IIlIlIIIIIlllIIl.lIlIIllIlIllllII.remove(((Entry)entry).getKey()); } if (((GameDataLog)((Entry)entry).getValue()).getPromoterId() != 0) { ((GameDataLog)((Entry)entry).getValue()).setPromoterGold(((Promoter)this.promoterDao.IIIIlIlIIIIlIIlI(((GameDataLog)((Entry)entry).getValue()).getPromoterId())).getGold()); } this.gameDataLogDao.update((GameDataLog)((Entry)entry).getValue()); this.gameDataLogDao.getSession().flush(); } catch (Exception var12) { IIlIlIIIIIlllIIl.lIlIIllIlIllllII.remove(((Entry)entry).getKey()); } } List<BulletFishDesk> desks = this.bulletFishDeskDao.IIIIlIlIIIIlIIlI(); String hql = "update BulletFishDesk set sumYaFen=?,sumDeFen=?,sumSeat1YaFen=?,sumSeat1DeFen=?,sumSeat2YaFen=?,sumSeat2DeFen=?,sumSeat3YaFen=?,sumSeat3DeFen=?,sumSeat4YaFen=?,sumSeat4DeFen=? where id=?"; for (final BulletFishDesk f : desks) { this.bulletFishDeskDao.IIIIlIlIIIIlIIlI(hql, new Object[]{f.getSumYaFen(), f.getSumDeFen(), f.getSumSeat1YaFen(), f.getSumSeat1DeFen(), f.getSumSeat2YaFen(), f.getSumSeat2DeFen(), f.getSumSeat3YaFen(), f.getSumSeat3DeFen(), f.getSumSeat4YaFen(), f.getSumSeat4DeFen(), f.getId()}).executeUpdate(); } if (!userWardingCache.isEmpty()) { for (final Map.Entry<Integer, UserWarning> entry : UserService.userWardingCache.entrySet()) { UserWarning userWarning = (UserWarning)entry.getValue(); com.miracle9.game.IIIllIlIlIlIlIll.IlIIIIIlIllIlIIl.lIIIIlllllIIlIll().IIIIlIlIIIIlIIlI(userWarning); } } } public void printUserGold() { for (final Map.Entry<Integer, com.miracle9.game.bean.IIIIlIlllllIlllI> entry : LocalMem.D.entrySet()) { BulletFishDesk desk = this.bulletFishDeskDao.IIIIlIlllllIlllI(((com.miracle9.game.bean.IIIIlIlllllIlllI)entry.getValue()).deskId); if (desk != null) { User user = (User)CacheUser.get(entry.getKey()); if (user == null || desk.getRoomId() != 2) { continue; } //if (user != null && desk.getRoomId() == 2) { int sumGameGold = user.getGameGold() + getUserScore(user.getId()) / desk.getExchange(); UserWarning userWarning = (UserWarning)userWardingCache.get(entry.getKey()); if (userWarning == null) { userWarning = this.userWarningService.IlIIIIIlIllIlIIl((Integer)entry.getKey()); } userWarning.setGameGold((long)sumGameGold); this.log.info("printUserWarning:" + userWarning); this.log.info("printUserGold gameGold:" + user.getGameGold() + ",gameScore:" + getUserScore(user.getId()) + ",totalGold:" + sumGameGold); User user2 = this.getUser((Integer)entry.getKey()); this.log.info("user in db gameGold:" + user2.getGameGold() + ",gameScore:" + user2.getGameScore()); //} } } } @Transactional public boolean addUserTop(int bet, int addGold, int fishType, User user) { try { String datetime = MyUtil.IIIIlIlllllIlllI(new Date()); int topCount = this.userTopDao.IIllIIlIIlIlIlIl("select count(*) from UserTop where type=3 and gold>? and datetime>=?", new Object[]{addGold, datetime}); if (topCount < 10) { UserTop ut = new UserTop(); ut.setGold(addGold); ut.setUserId(user.getId()); ut.setNickname(user.getNickname()); if (fishType == 19) { ut.setAwardName("超级Boss(" + bet + "倍)"); } else { ut.setAwardName("超级炸弹(" + bet + "倍)"); } ut.setDatetime(MyUtil.IIIIlIlIIIIlIIlI(new Date())); ut.setType(3); this.userTopDao.IIIIlIlIIIIlIIlI(ut); return true; } } catch (Exception e) { this.log.error("添加排行榜失败,error:", e); } return false; } private DieFishInputInfo specialKill(DieFishInputInfo input) { DieFishOutputInfo output = new DieFishOutputInfo(); //log.debug( "nFishCounts: "+ input.totalFish ); for(int i = 0; i < input.totalFish; ++i) { //BUG 传参进来 偶尔会多一个 2bet的fish信息 //this.log.debug( i+" bet:" + input.fishes[i].bet +" fishid:" + input.fishes[i].fishid ); if ( this.IIlllIIIlIllIIIllkiillill(input.fishes[i].bet) ) { input.fishes[i].fsDead=true; this.log.debug(i+"fsDead:" + input.fishes[i].fsDead ); } } return input; } private DieFishOutputInfo IIlIlIIIIIlllIIloiiillll(DieFishInputInfo input) { //if (input == null) {System.out.println("IsFishDied input is null!");return null;} //new DieFishInputInfo(); DieFishOutputInfo output = new DieFishOutputInfo(); System.out.println( "nFishCounts: "+ input.totalFish ); for(int i = 0; i < input.totalFish; ++i) { //BUG 传参进来 偶尔会多一个 2bet的fish信息 this.log.debug( i+" bet:" + input.fishes[i].bet ); this.log.debug( i+" bet:" + input.fishes[i].fishid ); if ( this.IIlllIIIlIllIIIllkiillill(input.fishes[i].bet) ) { output.dead[i].fishType = input.fishes[i].fishType; output.dead[i].bet = input.fishes[i].bet; output.dead[i].fishid = input.fishes[i].fishid; output.dead[i].fx = input.fishes[i].fx; output.dead[i].fy = input.fishes[i].fy; this.log.debug( i+" fx:" + input.fishes[i].fx + "fy:" + input.fishes[i].fy ); this.log.debug( i+" deadfx:" + output.dead[i].fx + "deadfy:" + output.dead[i].fy ); ++output.totalFish; } } output.ionicCannonIndex = -1; return output; } private boolean IIlllIIIlIllIIIllkiillill(int bet) { Random random = new Random(); int num = random.nextInt(100); //System.out.print("命中率 "+num +" VS "+ this.IIlllIIIlIllIIIllgiillill(bet)); return (float)num < this.IIlllIIIlIllIIIllgiillill(bet); } private float IIlllIIIlIllIIIllgiillill(int bet) { for (final Map.Entry<String, Float> entry : OverFishPropertyUtil.IIILiillfffkkkllllu.entrySet()) { final String range = entry.getKey(); final int start = Integer.parseInt(range.split("-")[0]); final int end = Integer.parseInt(range.split("-")[1]); if (bet >= start && bet <= end) { return entry.getValue() * 100.0f; } } return 0.0f; } public void lockUser(int userId, String reason) { try { this.log.info("准备封号, userId:" + userId); IoSession session = (IoSession)LocalMem.B.get(userId); this.log.info("session:" + session); this.quitGame(session); IIIllIlIlIlIlIll.a.IIIIlIlllllIlllI(new IIIIlIlIIIIlIIlI(session, "quitToLogin", new Object[]{4})); com.miracle9.game.IIIIlIlllllIlllI.IIIIlIlllllIlllI.IIlllIIIlIllIIIl("userService/lockUserBySystem", new Object[]{userId, 1, reason + ",游戏:<牛魔王>"}); } catch (Exception e) { this.log.info("封号异常,userId:" + userId + ", error:" + e); } } public boolean limitEnterDesk(int userId, int deskId) { Map<Long, Integer> timeCountMap = (Map)userDeskTimeMap.get(String.valueOf(userId) + ":" + deskId); if (timeCountMap == null) { //Map<Long, Integer> timeCountMap = new HashMap(); timeCountMap = new HashMap(); timeCountMap.put(System.currentTimeMillis(), 1); userDeskTimeMap.put(String.valueOf(userId) + ":" + deskId, timeCountMap); return false; } else { long currentTime = System.currentTimeMillis(); for (Map.Entry<Long, Integer> entry : timeCountMap.entrySet()) { Long lastTime = (Long)entry.getKey(); Integer count = (Integer)entry.getValue(); if (System.currentTimeMillis() - lastTime >= (long)(OverFishPropertyUtil.limitSecond * 1000)) { timeCountMap.clear(); timeCountMap.put(currentTime, 1); this.log.info("用户" + userId + "上桌" + deskId + ",已经过了1分钟,重新开始计数"); } else { int newCount = count + 1; timeCountMap.put(lastTime, newCount); this.log.info("用户" + userId + "上桌" + deskId + ",一分钟内上桌次数:" + newCount); if (newCount >= OverFishPropertyUtil.limitCount) { return true; } continue; } } return false; } } public Map checkVersion(String paramString, IoSession paramIoSession) { HashMap localHashMap = new HashMap(); localHashMap.put("code", 0); localHashMap.put("path", ""); localHashMap.put("message", "123456"); return localHashMap; } }
邮箱 tickup [{at}] QQ.COM