mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Fixed wrong Valid until date calculations
This commit is contained in:
parent
b75225e707
commit
bcc807f7b5
@ -7,6 +7,7 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
public class ClubOffer implements ISerialize {
|
public class ClubOffer implements ISerialize {
|
||||||
|
|
||||||
@ -91,17 +92,17 @@ public class ClubOffer implements ISerialize {
|
|||||||
message.appendInt(this.pointsType);
|
message.appendInt(this.pointsType);
|
||||||
message.appendBoolean(this.vip);
|
message.appendBoolean(this.vip);
|
||||||
|
|
||||||
long seconds = this.days * 86400L;
|
long seconds = this.days * 86400;
|
||||||
|
|
||||||
long secondsTotal = seconds;
|
long secondsTotal = seconds;
|
||||||
|
|
||||||
int totalYears = (int) Math.floor((int) seconds / 86400 * 31 * 12);
|
int totalYears = (int) Math.floor((int) seconds / (86400.0 * 31 * 12));
|
||||||
seconds -= totalYears * 86400 * 31 * 12;
|
seconds -= totalYears * (86400 * 31 * 12);
|
||||||
|
|
||||||
int totalMonths = (int) Math.floor((int) seconds / 86400 * 31);
|
int totalMonths = (int) Math.floor((int) seconds / (86400.0 * 31));
|
||||||
seconds -= totalMonths * 86400 * 31;
|
seconds -= totalMonths * (86400 * 31);
|
||||||
|
|
||||||
int totalDays = (int) Math.floor((int) seconds / 86400);
|
int totalDays = (int) Math.floor((int) seconds / 86400.0);
|
||||||
seconds -= totalDays * 86400;
|
seconds -= totalDays * 86400;
|
||||||
|
|
||||||
message.appendInt((int) secondsTotal / 86400 / 31);
|
message.appendInt((int) secondsTotal / 86400 / 31);
|
||||||
@ -112,9 +113,10 @@ public class ClubOffer implements ISerialize {
|
|||||||
hcExpireTimestamp += secondsTotal;
|
hcExpireTimestamp += secondsTotal;
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
cal.setTimeInMillis(hcExpireTimestamp * 1000L);
|
cal.setTimeInMillis(hcExpireTimestamp * 1000L);
|
||||||
message.appendInt(cal.get(Calendar.YEAR));
|
message.appendInt(cal.get(Calendar.YEAR));
|
||||||
message.appendInt(cal.get(Calendar.MONTH));
|
message.appendInt(cal.get(Calendar.MONTH) + 1);
|
||||||
message.appendInt(cal.get(Calendar.DAY_OF_MONTH));
|
message.appendInt(cal.get(Calendar.DAY_OF_MONTH));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user