mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-03 18:13:11 -04:00
Added prose package attachments to mails
This commit is contained in:
@@ -26,7 +26,9 @@ import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.common.StringUtilities;
|
||||
import protocol.swg.SWGMessage;
|
||||
import resources.common.ProsePackage;
|
||||
import services.chat.WaypointAttachment;
|
||||
|
||||
|
||||
@@ -40,9 +42,10 @@ public class ChatPersistentMessageToClient extends SWGMessage {
|
||||
private String subject;
|
||||
private byte status;
|
||||
private int timestamp;
|
||||
private List<WaypointAttachment> attachments;
|
||||
private List<WaypointAttachment> waypointAttachments;
|
||||
private List<ProsePackage> proseAttachments;
|
||||
|
||||
public ChatPersistentMessageToClient(String sender, String galaxyName, int mailId, byte requestTypeFlag, String message, String subject, byte status, int timestamp, List<WaypointAttachment> attachments) {
|
||||
public ChatPersistentMessageToClient(String sender, String galaxyName, int mailId, byte requestTypeFlag, String message, String subject, byte status, int timestamp, List<WaypointAttachment> waypointAttachments, List<ProsePackage> proseAttachments) {
|
||||
|
||||
this.sender = sender;
|
||||
this.galaxyName = galaxyName;
|
||||
@@ -52,7 +55,8 @@ public class ChatPersistentMessageToClient extends SWGMessage {
|
||||
this.subject = subject;
|
||||
this.status = status;
|
||||
this.timestamp = timestamp;
|
||||
this.attachments = attachments;
|
||||
this.waypointAttachments = waypointAttachments;
|
||||
this.proseAttachments = proseAttachments;
|
||||
|
||||
}
|
||||
|
||||
@@ -82,14 +86,14 @@ public class ChatPersistentMessageToClient extends SWGMessage {
|
||||
|
||||
result.put(getUnicodeString(subject));
|
||||
|
||||
if(requestTypeFlag == 1 || attachments.size() == 0)
|
||||
if(requestTypeFlag == 1 || (waypointAttachments.size() == 0 && proseAttachments.size() == 0))
|
||||
result.putInt(0);
|
||||
else if(requestTypeFlag == 0 && attachments.size() > 0){
|
||||
else if(requestTypeFlag == 0 && (waypointAttachments.size() > 0 || proseAttachments.size() > 0)){
|
||||
|
||||
int position = result.position();
|
||||
result.putInt(0);
|
||||
|
||||
for(WaypointAttachment attachment : attachments) {
|
||||
for(WaypointAttachment attachment : waypointAttachments) {
|
||||
|
||||
result.putShort((short) 0);
|
||||
result.put((byte) 4);
|
||||
@@ -108,6 +112,27 @@ public class ChatPersistentMessageToClient extends SWGMessage {
|
||||
|
||||
}
|
||||
|
||||
for(ProsePackage prose : proseAttachments) {
|
||||
|
||||
result.putShort((short) 0);
|
||||
result.put((byte) 1);
|
||||
result.putInt(0xFFFFFFFF);
|
||||
result.put(prose.getStf().getBytes());
|
||||
result.putLong(prose.getTuObjectId());
|
||||
result.put(prose.getTuStf().getBytes());
|
||||
result.put(getUnicodeString(prose.getTuCustomString()));
|
||||
result.putLong(prose.getTtObjectId());
|
||||
result.put(prose.getTtStf().getBytes());
|
||||
result.put(getUnicodeString(prose.getTtCustomString()));
|
||||
result.putLong(prose.getToObjectId());
|
||||
result.put(prose.getToStf().getBytes());
|
||||
result.put(getUnicodeString(prose.getToCustomString()));
|
||||
result.putInt(prose.getDiInteger());
|
||||
result.putFloat(prose.getDfFloat());
|
||||
result.put((byte) 0);
|
||||
|
||||
}
|
||||
|
||||
result.putInt(position, (result.position() - position - 4) / 2);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
******************************************************************************/
|
||||
package resources.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import engine.resources.common.Stf;
|
||||
|
||||
public class ProsePackage {
|
||||
public class ProsePackage implements Serializable {
|
||||
|
||||
/*
|
||||
* TU = Text User
|
||||
@@ -33,6 +35,8 @@ public class ProsePackage {
|
||||
* DF = Decimal Float
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Stf stf = new Stf();
|
||||
|
||||
private long tuObjectId = 0;
|
||||
|
||||
@@ -457,7 +457,6 @@ public class BazaarService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(item.getItem() instanceof TangibleObject && player.getInventoryItemCount() >= 80) {
|
||||
response.setStatus(RetrieveAuctionItemResponseMessage.FULLINVENTORY);
|
||||
player.getClient().getSession().write(response.serialize());
|
||||
@@ -606,10 +605,12 @@ public class BazaarService implements INetworkDispatch {
|
||||
if(item.getStatus() == AuctionItem.FORSALE && !item.isOnBazaar()) {
|
||||
if(vendor.getObjectID() != item.getVendorId() && (core.objectService.getObject(item.getVendorId()) == null || (Boolean) core.objectService.getObject(item.getVendorId()).getAttachment("vendorSearchEnabled")))
|
||||
break;
|
||||
if((category & 255) != 0 && item.getItemType() == category) {
|
||||
if(displayedItems >= offset)
|
||||
response.addItem(item);
|
||||
displayedItems++;
|
||||
if((category & 255) != 0) {
|
||||
if(item.getItemType() == category) {
|
||||
if(displayedItems >= offset)
|
||||
response.addItem(item);
|
||||
displayedItems++;
|
||||
}
|
||||
} else if((item.getItemType() & category) != 0) {
|
||||
if(displayedItems >= offset)
|
||||
response.addItem(item);
|
||||
|
||||
@@ -310,7 +310,7 @@ public class ChatService implements INetworkDispatch {
|
||||
mail.setStatus(Mail.NEW);
|
||||
mail.setSubject(packet.getSubject());
|
||||
mail.setTimeStamp((int) (date.getTime() / 1000));
|
||||
mail.setAttachments(packet.getWaypointAttachments());
|
||||
mail.setWaypointAttachments(packet.getWaypointAttachments());
|
||||
storePersistentMessage(mail);
|
||||
|
||||
if(recipient.getClient() != null) {
|
||||
@@ -687,7 +687,7 @@ public class ChatService implements INetworkDispatch {
|
||||
//System.out.println(config.getString("GALAXY_NAME"));
|
||||
|
||||
ChatPersistentMessageToClient msg = new ChatPersistentMessageToClient(mail.getSenderName(), config.getString("GALAXY_NAME"), mail.getMailId()
|
||||
,(byte) 1, "", mail.getSubject(), mail.getStatus(), mail.getTimeStamp(), mail.getAttachments());
|
||||
,(byte) 1, "", mail.getSubject(), mail.getStatus(), mail.getTimeStamp(), mail.getWaypointAttachments(), mail.getProseAttachments());
|
||||
|
||||
client.getSession().write(msg.serialize());
|
||||
}
|
||||
@@ -706,7 +706,7 @@ public class ChatService implements INetworkDispatch {
|
||||
//System.out.println(config.getString("GALAXY_NAME"));
|
||||
|
||||
ChatPersistentMessageToClient msg = new ChatPersistentMessageToClient(mail.getSenderName(), config.getString("GALAXY_NAME"), mail.getMailId()
|
||||
,(byte) 0, mail.getMessage(), mail.getSubject(), mail.getStatus(), mail.getTimeStamp(), mail.getAttachments());
|
||||
,(byte) 0, mail.getMessage(), mail.getSubject(), mail.getStatus(), mail.getTimeStamp(), mail.getWaypointAttachments(), mail.getProseAttachments());
|
||||
|
||||
client.getSession().write(msg.serialize());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.ProsePackage;
|
||||
|
||||
import com.sleepycat.persist.model.Entity;
|
||||
import com.sleepycat.persist.model.PrimaryKey;
|
||||
|
||||
@@ -42,6 +45,7 @@ public class Mail implements Serializable {
|
||||
private byte status;
|
||||
private int timeStamp;
|
||||
private List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
|
||||
private List<ProsePackage> proseAttachments = new ArrayList<ProsePackage>();
|
||||
|
||||
public static final byte NEW = 0x4E;
|
||||
public static final byte READ = 0x52;
|
||||
@@ -122,14 +126,28 @@ public class Mail implements Serializable {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
|
||||
public List<WaypointAttachment> getAttachments() {
|
||||
public List<WaypointAttachment> getWaypointAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
|
||||
public void setAttachments(List<WaypointAttachment> attachments) {
|
||||
public void setWaypointAttachments(List<WaypointAttachment> attachments) {
|
||||
this.attachments = attachments;
|
||||
}
|
||||
|
||||
public void addWaypointAttachment(WaypointAttachment attachment) {
|
||||
attachments.add(attachment);
|
||||
}
|
||||
|
||||
public List<ProsePackage> getProseAttachments() {
|
||||
return proseAttachments;
|
||||
}
|
||||
|
||||
public void setProseAttachments(List<ProsePackage> proseAttachments) {
|
||||
this.proseAttachments = proseAttachments;
|
||||
}
|
||||
|
||||
public void addProseAttachment(ProsePackage prose) {
|
||||
proseAttachments.add(prose);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import main.NGECore;
|
||||
import protocol.swg.EnterStructurePlacementModeMessage;
|
||||
import resources.objects.building.BuildingObject;
|
||||
|
||||
@@ -690,7 +690,7 @@ public class PlayerCity implements Serializable {
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizenObject.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
actorMail.setWaypointAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
if (newCitizen.getClient()!=null)
|
||||
@@ -722,7 +722,7 @@ public class PlayerCity implements Serializable {
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizen.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
actorMail.setWaypointAttachments(attachments);
|
||||
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
@@ -755,7 +755,7 @@ public class PlayerCity implements Serializable {
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizenObject.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
actorMail.setWaypointAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
if (newCitizen.getClient()!=null)
|
||||
@@ -790,7 +790,7 @@ public class PlayerCity implements Serializable {
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizenObject.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
actorMail.setWaypointAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
|
||||
@@ -823,7 +823,7 @@ public class PlayerCity implements Serializable {
|
||||
attachment.positionY = 0;
|
||||
attachment.positionZ = citizenObject.getPosition().z;
|
||||
attachments.add(attachment);
|
||||
actorMail.setAttachments(attachments);
|
||||
actorMail.setWaypointAttachments(attachments);
|
||||
|
||||
NGECore.getInstance().chatService.storePersistentMessage(actorMail);
|
||||
}
|
||||
|
||||
@@ -1078,7 +1078,7 @@ public class HarvesterService implements INetworkDispatch {
|
||||
String message = "Your construction is ready";
|
||||
constructionNotificationMail.setMessage(message);
|
||||
constructionNotificationMail.setStatus(Mail.NEW);
|
||||
constructionNotificationMail.setAttachments(attachments);
|
||||
constructionNotificationMail.setWaypointAttachments(attachments);
|
||||
//NGECore.getInstance().chatService.sendPersistentMessage(actor.getClient(), constructionNotificationMail);
|
||||
NGECore.getInstance().chatService.storePersistentMessage(constructionNotificationMail);
|
||||
NGECore.getInstance().chatService.sendPersistentMessageHeader(actor.getClient(), constructionNotificationMail);
|
||||
|
||||
Reference in New Issue
Block a user