Fixes #0000061 Houses can't be deleted

This commit is contained in:
CharonInferar
2014-07-07 21:31:06 +02:00
parent 997033851a
commit 09f6266cc7
7 changed files with 74 additions and 13 deletions
+5
View File
@@ -111,6 +111,7 @@ import services.spawn.SpawnService;
import services.sui.SUIService;
import services.trade.TradeService;
import services.travel.TravelService;
import tools.CharonPacketLogger;
import tools.DevLogQueuer;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.CrcStringTableVisitor;
@@ -538,6 +539,10 @@ public class NGECore {
DevLogQueuer devLogQueuer = new DevLogQueuer();
CharonPacketLogger packetLogger;
if (PACKET_DEBUG)
packetLogger = new CharonPacketLogger();
didServerCrash = false;
System.out.println("Started Server.");
+1
View File
@@ -342,6 +342,7 @@ public class SWGList<E> implements List<E>, Serializable {
updateCounter += list.size();
//StringUtilities.printBytes(newListData);
//tools.CharonPacketUtils.printAnalysis(buffer,"SWGList set");
queue(newListData);
return true;
@@ -113,6 +113,7 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
buffer.putInt(creature.getFactionStatus());
byte[] customizationData = creature.getCustomization();
//byte[] customizationData = new byte[]{(byte)0x03,(byte)0xBF,(byte)0xC3,(byte)0x33,(byte)0x02,(byte)0x01,(byte)0x02};
if(customizationData == null || customizationData.length <= 0) // Shuttles have no customization data
buffer.putShort((short) 0);
@@ -148,6 +149,9 @@ public class CreatureMessageBuilder extends TangibleMessageBuilder {
buffer.flip();
buffer = createBaseline("CREO", (byte) 3, buffer, size);
tools.CharonPacketUtils.printAnalysis(buffer, "CREO 3");
return buffer;
}
+2 -2
View File
@@ -46,6 +46,7 @@ import resources.common.OutOfBand;
import resources.datatables.Citizenship;
import resources.datatables.DisplayType;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
import resources.objects.harvester.HarvesterObject;
import resources.objects.installation.InstallationObject;
@@ -325,7 +326,7 @@ public class HousingService implements INetworkDispatch {
} else {
window.addListBoxMenuItem("@player_structure:redeed_confirmation \\#32CD32 @player_structure:can_redeed_yes_suffix \\#FFFFFF ",1 );
}
if (building.getConditionDamage()<20){
if (building.getConditionDamage()>20){
window.addListBoxMenuItem("@player_structure:redeed_condition \\#BB0000 " + building.getConditionDamage() + " \\#FFFFFF ",1 );
noRedeed.add(-1);
} else {
@@ -421,7 +422,6 @@ public class HousingService implements INetworkDispatch {
houseOwner.sendSystemMessage("@player_structure:processing_destruction",(byte)1);
houseOwner.sendSystemMessage("@player_structure:deed_reclaimed",(byte)1);
} else {
houseOwner.sendSystemMessage("@player_structure:incorrect_destroy_code",(byte)1);
}
+5
View File
@@ -210,6 +210,11 @@ public class PetService implements INetworkDispatch {
activeAbilities.add("toggleBeastPassive");
player.getActivePetAbilities().set(activeAbilities);
// 02 01 02 33 C3 BF 03
//byte[] customization = new byte[]{(byte)0x03,(byte)0xBF,(byte)0xC3,(byte)0x33,(byte)0x02,(byte)0x01,(byte)0x02};
byte[] customization = new byte[]{(byte)0x02,(byte)0x01,(byte)0x02,(byte)0x33,(byte)0xC3,(byte)0xBF,(byte)0x03};
pet.setCustomization(customization);
pet.setFaction(actor.getFaction());
pet.setFactionStatus(actor.getFactionStatus());
pet.setOwnerId(actor.getObjectID());
+6 -3
View File
@@ -5,7 +5,7 @@ import java.util.concurrent.BlockingQueue;
import java.nio.file.*;
public class CharonPacketLogger extends Thread {
private static final CharonPacketLogger instance = new CharonPacketLogger();
private static CharonPacketLogger instance;
private BlockingQueue<String> itemsToLog =
new ArrayBlockingQueue<String>(100);
@@ -16,8 +16,11 @@ public class CharonPacketLogger extends Thread {
public static CharonPacketLogger getLogger() {
return instance;
}
private CharonPacketLogger() {
start();
public CharonPacketLogger() {
if (instance!=null)
return; // Singleton
instance = this;
start();
}
public void run() {
+51 -8
View File
@@ -9,6 +9,9 @@ import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import main.NGECore;
@@ -20,21 +23,30 @@ import org.apache.mina.core.buffer.IoBuffer;
public class CharonPacketUtils {
static Path newFile = Paths.get("M:/PSWG/LOGS/PSWG_PacketLog.txt");
private static int loggingSessionID=0;
static Path newFile = Paths.get("src", "PSWG_DEVLOG.log");
private static boolean writeToFile = false;
private CharonPacketLogger logger;
public static void createLog(){
try {
Files.deleteIfExists(newFile);
newFile = Files.createFile(newFile);
try {
writeToFile = true;
Date date = new Date();
Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(System.currentTimeMillis());
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-hh-mm-ss");
String sDate=dateFormat.format(cal1.getTime());
String fileName = "PSWG_PACKETLOG_"+sDate+".log";
newFile = Paths.get("debuglogs", fileName);
Files.deleteIfExists(newFile);
newFile = Files.createFile(newFile);
createHeader(newFile);
} catch (IOException ex) {
System.out.println("Error creating file");
}
System.out.println(Files.exists(newFile));
writeToFile=true;
System.out.println("Error creating file");
}
}
public static void appendToLog(String content, Path newFile){
@@ -58,6 +70,16 @@ public class CharonPacketUtils {
if (!NGECore.PACKET_DEBUG)
return;
if (pack==null)
return;
if (loggingSessionID>0){
} else {
createLog();
loggingSessionID++;
}
//appendToLog(packetName+" :");
int hexLineNumber = 0;
byte[] packArray = pack.array();
@@ -138,4 +160,25 @@ public class CharonPacketUtils {
//if (writeToFile)
// appendToLog("");
}
public static void createHeader(Path newFile){
//Writing to file
try(BufferedWriter writer = Files.newBufferedWriter(
newFile, Charset.defaultCharset(),new OpenOption[] {StandardOpenOption.APPEND})){
Date date = new Date();
Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(System.currentTimeMillis());
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-hh:mm:ss");
String sDate=dateFormat.format(cal1.getTime());
String developer = System.getProperty("user.name");
writer.append("*********************************************\n");
writer.append("**** PROJECTSWG PACKET LOG " + sDate + " ***\n");
writer.append("*********************************************\n");
writer.append("DEV: "+developer + "\n");
writer.append("\n");
writer.flush();
}catch(IOException exception){
System.out.println("Error writing to file");
}
}
}