Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogFeaturedPage.java

58 lines
1.7 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
2019-05-26 20:14:53 +02:00
public class CatalogFeaturedPage implements ISerialize {
2018-07-06 15:30:00 +02:00
private final int slotId;
private final String caption;
private final String image;
private final Type type;
private final int expireTimestamp;
private final String pageName;
private final int pageId;
private final String productName;
2019-05-26 20:14:53 +02:00
public CatalogFeaturedPage(int slotId, String caption, String image, Type type, int expireTimestamp, String pageName, int pageId, String productName) {
2018-07-06 15:30:00 +02:00
this.slotId = slotId;
this.caption = caption;
this.image = image;
this.type = type;
this.expireTimestamp = expireTimestamp;
this.pageName = pageName;
this.pageId = pageId;
this.productName = productName;
}
@Override
2019-05-26 20:14:53 +02:00
public void serialize(ServerMessage message) {
2018-07-06 15:30:00 +02:00
message.appendInt(this.slotId);
message.appendString(this.caption);
message.appendString(this.image);
message.appendInt(this.type.type);
2019-05-26 20:14:53 +02:00
switch (this.type) {
2018-07-06 15:30:00 +02:00
case PAGE_NAME:
2019-05-26 20:14:53 +02:00
message.appendString(this.pageName);
break;
2018-07-06 15:30:00 +02:00
case PAGE_ID:
2019-05-26 20:14:53 +02:00
message.appendInt(this.pageId);
break;
2018-07-06 15:30:00 +02:00
case PRODUCT_NAME:
2019-05-26 20:14:53 +02:00
message.appendString(this.productName);
break;
2018-07-06 15:30:00 +02:00
}
message.appendInt(Emulator.getIntUnixTimestamp() - this.expireTimestamp);
}
2019-05-26 20:14:53 +02:00
public enum Type {
PAGE_NAME(0),
PAGE_ID(1),
PRODUCT_NAME(2);
public final int type;
Type(int type) {
this.type = type;
}
}
2018-07-06 15:30:00 +02:00
}