mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Add custom timer support (closes #320)
This commit is contained in:
parent
cdf06f64ea
commit
aeafc99468
@ -339,6 +339,7 @@ public class PacketManager {
|
|||||||
this.registerHandler(Incoming.HotelViewRequestBadgeRewardEvent, HotelViewRequestBadgeRewardEvent.class);
|
this.registerHandler(Incoming.HotelViewRequestBadgeRewardEvent, HotelViewRequestBadgeRewardEvent.class);
|
||||||
this.registerHandler(Incoming.HotelViewClaimBadgeRewardEvent, HotelViewClaimBadgeRewardEvent.class);
|
this.registerHandler(Incoming.HotelViewClaimBadgeRewardEvent, HotelViewClaimBadgeRewardEvent.class);
|
||||||
this.registerHandler(Incoming.HotelViewRequestLTDAvailabilityEvent, HotelViewRequestLTDAvailabilityEvent.class);
|
this.registerHandler(Incoming.HotelViewRequestLTDAvailabilityEvent, HotelViewRequestLTDAvailabilityEvent.class);
|
||||||
|
this.registerHandler(Incoming.HotelViewRequestSecondsUntilEvent, HotelViewRequestSecondsUntilEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerInventory() throws Exception {
|
private void registerInventory() throws Exception {
|
||||||
|
@ -351,6 +351,8 @@ public class Incoming {
|
|||||||
public static final int LoveLockStartConfirmEvent = 3775;
|
public static final int LoveLockStartConfirmEvent = 3775;
|
||||||
|
|
||||||
public static final int HotelViewRequestLTDAvailabilityEvent = 410;
|
public static final int HotelViewRequestLTDAvailabilityEvent = 410;
|
||||||
|
public static final int HotelViewRequestSecondsUntilEvent = 271;
|
||||||
|
|
||||||
public static final int PurchaseTargetOfferEvent = 1826;
|
public static final int PurchaseTargetOfferEvent = 1826;
|
||||||
public static final int TargetOfferStateEvent = 2041;
|
public static final int TargetOfferStateEvent = 2041;
|
||||||
public static final int StopBreedingEvent = 2713;
|
public static final int StopBreedingEvent = 2713;
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.eu.habbo.messages.incoming.hotelview;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.messages.outgoing.hotelview.HotelViewSecondsUntilComposer;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
public class HotelViewRequestSecondsUntilEvent extends MessageHandler {
|
||||||
|
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle() throws Exception {
|
||||||
|
String date = this.packet.readString();
|
||||||
|
int secondsUntil = Math.max(0, (int) (dateFormat.parse(date).getTime() / 1000) - Emulator.getIntUnixTimestamp());
|
||||||
|
|
||||||
|
this.client.sendResponse(new HotelViewSecondsUntilComposer(date, secondsUntil));
|
||||||
|
}
|
||||||
|
}
|
@ -525,6 +525,7 @@ public class Outgoing {
|
|||||||
public final static int UnknownRoomViewerComposer = 3523;
|
public final static int UnknownRoomViewerComposer = 3523;
|
||||||
public final static int ErrorLoginComposer = 4000;
|
public final static int ErrorLoginComposer = 4000;
|
||||||
public final static int HotelViewNextLTDAvailableComposer = 44;
|
public final static int HotelViewNextLTDAvailableComposer = 44;
|
||||||
|
public final static int HotelViewSecondsUntilComposer = 3926;
|
||||||
public final static int UnknownRoomDesktopComposer = 69;
|
public final static int UnknownRoomDesktopComposer = 69;
|
||||||
public final static int UnknownGuildComposer3 = 876;
|
public final static int UnknownGuildComposer3 = 876;
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.eu.habbo.messages.outgoing.hotelview;
|
||||||
|
|
||||||
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||||
|
|
||||||
|
public class HotelViewSecondsUntilComposer extends MessageComposer {
|
||||||
|
private final String dateString;
|
||||||
|
private final int seconds;
|
||||||
|
|
||||||
|
public HotelViewSecondsUntilComposer(String dateString, int seconds) {
|
||||||
|
this.dateString = dateString;
|
||||||
|
this.seconds = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerMessage compose() {
|
||||||
|
this.response.init(Outgoing.HotelViewSecondsUntilComposer);
|
||||||
|
this.response.appendString(this.dateString);
|
||||||
|
this.response.appendInt(this.seconds);
|
||||||
|
|
||||||
|
return this.response;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user