修复挂机key
parent
1f7d626309
commit
7307a444f4
|
@ -5,14 +5,16 @@ import com.ljsd.jieling.handler.map.TemporaryItems;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AdventureManager extends MongoBase {
|
public class AdventureManager extends MongoBase {
|
||||||
|
|
||||||
private Map<Integer,AdventureStateInfo> adventureStateInfoMap;
|
private Map<Integer,AdventureStateInfo> adventureStateInfoMap;
|
||||||
|
|
||||||
private Map<int[],Float> tempDropRatio = new HashMap<>();
|
private List<TempDropInfo> tempDropRatio = new ArrayList<>();
|
||||||
|
|
||||||
public AdventureManager(){
|
public AdventureManager(){
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
@ -25,18 +27,18 @@ public class AdventureManager extends MongoBase {
|
||||||
adventureStateInfoMap.put(position,adventureStateInfo);
|
adventureStateInfoMap.put(position,adventureStateInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<int[], Float> getTempDropRation() {
|
public List<TempDropInfo> getTempDropRatio() {
|
||||||
return tempDropRatio;
|
return tempDropRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTemp(int dropIds[],float ratio){
|
public void updateTemp(int dropIds[], float ratio){
|
||||||
tempDropRatio.put(dropIds,ratio);
|
tempDropRatio.add(new TempDropInfo(dropIds,ratio));
|
||||||
updateString("tempDropRatio."+dropIds,ratio);
|
updateString("tempDropRatio",tempDropRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTemp(){
|
public void clearTemp(){
|
||||||
tempDropRatio.clear();
|
tempDropRatio.clear();
|
||||||
updateString("tempDropRatio",new HashMap<>());
|
updateString("tempDropRatio", new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, AdventureStateInfo> getAdventureStateInfoMap() {
|
public Map<Integer, AdventureStateInfo> getAdventureStateInfoMap() {
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -147,7 +147,10 @@ public class CombatLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isOnLine){
|
if(!isOnLine){
|
||||||
tempDropRation.putAll(adventureManager.getTempDropRation());
|
List<TempDropInfo> tempDropRatioList = adventureManager.getTempDropRatio();
|
||||||
|
for(TempDropInfo tempDropInfo : tempDropRatioList){
|
||||||
|
tempDropRation.put(tempDropInfo.getDropGroupIds(),tempDropInfo.getDropRatio());
|
||||||
|
}
|
||||||
adventureManager.clearTemp();
|
adventureManager.clearTemp();
|
||||||
}
|
}
|
||||||
return ItemUtil.drop(user, tempDropRation);
|
return ItemUtil.drop(user, tempDropRation);
|
||||||
|
|
Loading…
Reference in New Issue