Fixed some bugs

This commit is contained in:
CharonInferar
2014-05-02 01:18:50 +02:00
parent 1c14d7a702
commit 5e4062ae38
4 changed files with 23 additions and 9 deletions
+1
View File
@@ -62,6 +62,7 @@ odb/resourceroots/je.info.*
odb/resources/je.info.*
odb/auction/je.info.*
odb/bounties/je.info.*
odb/swgobjects/je.info.*
# External tool builders
.externalToolBuilders/
+11
View File
@@ -46,11 +46,13 @@ public class LootRollSession {
private int sessionLootMode;
private boolean allowRareLoot;
private boolean increasedRLSChance;
private int lootedObjectLevel=0;
public LootRollSession(){
}
public LootRollSession(CreatureObject requester, TangibleObject lootedObject){
long requesterGroupId = requester.getGroupId();
if (requesterGroupId>0){
this.playerGroup = (GroupObject) NGECore.getInstance().objectService.getObject(requesterGroupId);
@@ -62,6 +64,7 @@ public class LootRollSession {
if (lootedObject instanceof CreatureObject){
CreatureObject lootedCreature = (CreatureObject)lootedObject;
lootedObjectLevel = lootedCreature.getLevel();
// Exclude rare loot depending on creature level
// For groups maybe average CL?
if (requester.getLevel()-lootedCreature.getLevel()<=6){
@@ -160,4 +163,12 @@ public class LootRollSession {
public void setRequester(CreatureObject requester) {
this.requester = requester;
}
public int getLootedObjectLevel() {
return lootedObjectLevel;
}
public void setLootedObjectLevel(int lootedObjectLevel) {
this.lootedObjectLevel = lootedObjectLevel;
}
}
+10 -8
View File
@@ -77,7 +77,7 @@ public class LootService implements INetworkDispatch {
}
public void handleLootRequest(CreatureObject requester, TangibleObject lootedObject) {
System.out.println("handleLootRequest ");
// security check
if (hasAccess(requester,lootedObject) && ! lootedObject.isLooted()){
LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession");
@@ -98,7 +98,7 @@ public class LootService implements INetworkDispatch {
if (lootRollSession==null)
System.err.println("LootSession null: " + lootRollSession);
if (lootRollSession!=null){
if (lootRollSession.getRequester()==requester && lootedObject.isLooted()){
if (lootRollSession.getRequester()==requester){
System.err.println("lootRollSession.getRequester()==requester: " + (lootRollSession.getRequester()==requester));
return true;
}
@@ -897,7 +897,7 @@ public class LootService implements INetworkDispatch {
//determine number of stats #20 yt
int statNumber = 1;
int levelOfDrop = 0;
int levelOfDrop = lootRollSession.getLootedObjectLevel();
int difficultyLevel = 1;
if (levelOfDrop>70 && levelOfDrop<90 && difficultyLevel==1)
@@ -919,9 +919,11 @@ public class LootService implements INetworkDispatch {
}
int primaryAttribute = new Random().nextInt(6); // 0-6
int maxValue = 25;
droppedItem.setIntAttribute(getAttributeSTF(primaryAttribute), getStatValue(maxValue));
int maxValue = (int) (levelOfDrop*25/90);
int minValue = (int) (0.75*maxValue);
droppedItem.setIntAttribute(getAttributeSTF(primaryAttribute), getStatValue(minValue,maxValue));
maxValue -= 2; //secondary attributes must have less maxValue
minValue = (int) (0.75*maxValue);
String prefix = getJewelryPrefix(droppedItem);
String suffix = getJewelrySuffix(primaryAttribute, statNumber);
String itemName = prefix + suffix;
@@ -934,7 +936,7 @@ public class LootService implements INetworkDispatch {
while (alreadyUsedStats.contains(attribute)) {
attribute = new Random().nextInt(6);
if (! alreadyUsedStats.contains(attribute)){
droppedItem.setIntAttribute(getAttributeSTF(attribute), getStatValue(maxValue));
droppedItem.setIntAttribute(getAttributeSTF(attribute), getStatValue(minValue,maxValue));
alreadyUsedStats.add(attribute);
}
}
@@ -942,8 +944,8 @@ public class LootService implements INetworkDispatch {
return itemName;
}
private int getStatValue(int maxValue){
return 1 + new Random().nextInt(maxValue-1);
private int getStatValue(int minValue, int maxValue){
return minValue + new Random().nextInt(maxValue-minValue);
}
+1 -1
View File
@@ -1195,7 +1195,7 @@ public class SimulationService implements INetworkDispatch {
float height = (float) (creature.getHeight()/* - 0.3*/);
if(creature.getPosture() == 2 || creature.getPosture() == 13)
if(creature.getPosture() == 2 || creature.getPosture() == 13 || creature.getPosture() == 14)
height = 0.3f;
else if(creature.getPosture() == 1)
height /= 2.f;