修复挂机key

back_recharge
wangyuan 2019-04-17 09:47:16 +08:00
parent 1f7d626309
commit 7307a444f4
3 changed files with 34 additions and 7 deletions

View File

@ -5,14 +5,16 @@ import com.ljsd.jieling.handler.map.TemporaryItems;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AdventureManager extends MongoBase {
private Map<Integer,AdventureStateInfo> adventureStateInfoMap;
private Map<int[],Float> tempDropRatio = new HashMap<>();
private List<TempDropInfo> tempDropRatio = new ArrayList<>();
public AdventureManager(){
this.setRootCollection(User._COLLECTION_NAME);
@ -25,18 +27,18 @@ public class AdventureManager extends MongoBase {
adventureStateInfoMap.put(position,adventureStateInfo);
}
public Map<int[], Float> getTempDropRation() {
public List<TempDropInfo> getTempDropRatio() {
return tempDropRatio;
}
public void updateTemp(int dropIds[],float ratio){
tempDropRatio.put(dropIds,ratio);
updateString("tempDropRatio."+dropIds,ratio);
public void updateTemp(int dropIds[], float ratio){
tempDropRatio.add(new TempDropInfo(dropIds,ratio));
updateString("tempDropRatio",tempDropRatio);
}
public void clearTemp(){
tempDropRatio.clear();
updateString("tempDropRatio",new HashMap<>());
updateString("tempDropRatio", new ArrayList<>());
}
public Map<Integer, AdventureStateInfo> getAdventureStateInfoMap() {

View File

@ -0,0 +1,22 @@
package com.ljsd.jieling.logic.dao;
public class TempDropInfo {
private int[] dropGroupIds;
private float dropRatio;
public TempDropInfo(int[] dropGroupIds, float dropRatio) {
this.dropGroupIds = dropGroupIds;
this.dropRatio = dropRatio;
}
public TempDropInfo() {
}
public int[] getDropGroupIds() {
return dropGroupIds;
}
public float getDropRatio() {
return dropRatio;
}
}

View File

@ -147,7 +147,10 @@ public class CombatLogic {
}
}
if(!isOnLine){
tempDropRation.putAll(adventureManager.getTempDropRation());
List<TempDropInfo> tempDropRatioList = adventureManager.getTempDropRatio();
for(TempDropInfo tempDropInfo : tempDropRatioList){
tempDropRation.put(tempDropInfo.getDropGroupIds(),tempDropInfo.getDropRatio());
}
adventureManager.clearTemp();
}
return ItemUtil.drop(user, tempDropRation);