Merge branch 'dev' into 'master'

2.1.1

See merge request morningstar/Arcturus-Community!66
This commit is contained in:
Harmonic 2020-01-16 18:15:31 -05:00
commit 98cda8cc19
7 changed files with 28 additions and 22 deletions

View File

@ -34,7 +34,7 @@ public final class Emulator {
public final static int MINOR = 2; public final static int MINOR = 2;
public final static int BUILD = 0; public final static int BUILD = 1;
public final static String PREVIEW = "Stable"; public final static String PREVIEW = "Stable";

View File

@ -27,8 +27,6 @@ public class InteractionFXBox extends InteractionDefault {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (client != null && this.getUserId() == client.getHabbo().getHabboInfo().getId()) { if (client != null && this.getUserId() == client.getHabbo().getHabboInfo().getId()) {
if(this.getExtradata().equals("1")) if(this.getExtradata().equals("1"))
return; return;
@ -54,7 +52,6 @@ public class InteractionFXBox extends InteractionDefault {
return; return;
EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0); EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0);
client.sendResponse(new UserEffectsListComposer(client.getHabbo()));
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
this.setExtradata("1"); this.setExtradata("1");

View File

@ -22,7 +22,12 @@ public class InteractionTotemHead extends InteractionDefault {
} }
public TotemType getTotemType() { public TotemType getTotemType() {
int extraData = Integer.parseInt(this.getExtradata()); int extraData;
try {
extraData = Integer.parseInt(this.getExtradata());
} catch(NumberFormatException ex) {
extraData = 0;
}
if(extraData < 3) { if(extraData < 3) {
return TotemType.fromInt(extraData + 1); return TotemType.fromInt(extraData + 1);
} }

View File

@ -74,8 +74,7 @@ public class InteractionTotemPlanet extends InteractionDefault {
return; return;
} }
client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId); EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId);
client.sendResponse(new UserEffectsListComposer(client.getHabbo()));
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
return; return;
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboManager;
import com.eu.habbo.habbohotel.users.inventory.EffectsComponent;
import com.eu.habbo.messages.NoAuthMessage; import com.eu.habbo.messages.NoAuthMessage;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
@ -95,7 +96,7 @@ public class SecureLoginEvent extends MessageHandler {
messages.add(new SecureLoginOKComposer().compose()); messages.add(new SecureLoginOKComposer().compose());
messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0).compose()); messages.add(new UserHomeRoomComposer(this.client.getHabbo().getHabboInfo().getHomeRoom(), 0).compose());
messages.add(new UserEffectsListComposer(habbo).compose()); messages.add(new UserEffectsListComposer(habbo, client.getHabbo().getInventory().getEffectsComponent().effects.values().toArray(new EffectsComponent.HabboEffect[0])).compose());
messages.add(new UserClothesComposer(this.client.getHabbo()).compose()); messages.add(new UserClothesComposer(this.client.getHabbo()).compose());
messages.add(new NewUserIdentityComposer(habbo).compose()); messages.add(new NewUserIdentityComposer(habbo).compose());
messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose()); messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose());

View File

@ -8,7 +8,8 @@ import com.eu.habbo.messages.outgoing.Outgoing;
public class EffectsListAddComposer extends MessageComposer { public class EffectsListAddComposer extends MessageComposer {
public final EffectsComponent.HabboEffect effect; public final EffectsComponent.HabboEffect effect;
public EffectsListAddComposer(EffectsComponent.HabboEffect effect) { public
EffectsListAddComposer(EffectsComponent.HabboEffect effect) {
this.effect = effect; this.effect = effect;
} }
@ -17,8 +18,8 @@ public class EffectsListAddComposer extends MessageComposer {
this.response.init(Outgoing.EffectsListAddComposer); this.response.init(Outgoing.EffectsListAddComposer);
this.response.appendInt(this.effect.effect); //Type this.response.appendInt(this.effect.effect); //Type
this.response.appendInt(0); //Unknown Costume? this.response.appendInt(0); //Unknown Costume?
this.response.appendInt(this.effect.duration); //Duration this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE); //Duration
this.response.appendBoolean(this.effect.isActivated()); //Is active this.response.appendBoolean(effect.duration <= 0); //Is active
return this.response; return this.response;
} }
} }

View File

@ -10,38 +10,41 @@ import gnu.trove.procedure.TObjectProcedure;
public class UserEffectsListComposer extends MessageComposer { public class UserEffectsListComposer extends MessageComposer {
public final Habbo habbo; public final Habbo habbo;
public final EffectsComponent.HabboEffect[] effects;
public UserEffectsListComposer(Habbo habbo) { public UserEffectsListComposer(Habbo habbo, EffectsComponent.HabboEffect[] effects) {
this.habbo = habbo; this.habbo = habbo;
this.effects = effects;
} }
@Override @Override
public ServerMessage compose() { public ServerMessage compose() {
this.response.init(Outgoing.UserEffectsListComposer); this.response.init(Outgoing.UserEffectsListComposer);
if (this.habbo == null || this.habbo.getInventory() == null || this.habbo.getInventory().getEffectsComponent() == null || this.habbo.getInventory().getEffectsComponent().effects == null) { if (this.habbo == null || this.habbo.getInventory() == null || this.habbo.getInventory().getEffectsComponent() == null || this.habbo.getInventory().getEffectsComponent().effects == null) {
this.response.appendInt(0); this.response.appendInt(0);
} else { } else {
synchronized (this.habbo.getInventory().getEffectsComponent().effects) { synchronized (this.habbo.getInventory().getEffectsComponent().effects) {
this.response.appendInt(this.habbo.getInventory().getEffectsComponent().effects.size()); this.response.appendInt(this.effects.length);
this.habbo.getInventory().getEffectsComponent().effects.forEachValue(effect -> {
for(EffectsComponent.HabboEffect effect : effects) {
UserEffectsListComposer.this.response.appendInt(effect.effect); UserEffectsListComposer.this.response.appendInt(effect.effect);
UserEffectsListComposer.this.response.appendInt(0); UserEffectsListComposer.this.response.appendInt(0);
UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : 1); UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE);
UserEffectsListComposer.this.response.appendInt(effect.total - (effect.isActivated() ? 1 : 0)); UserEffectsListComposer.this.response.appendInt((effect.duration > 0 ? (effect.total - (effect.isActivated() ? 1 : 0)) : 0));
if(!effect.isActivated()) { if(!effect.isActivated() && effect.duration > 0) {
UserEffectsListComposer.this.response.appendInt(0); UserEffectsListComposer.this.response.appendInt(0);
} }
else { else {
UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? (Emulator.getIntUnixTimestamp() - effect.activationTimestamp) + effect.duration : -1); UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? (Emulator.getIntUnixTimestamp() - effect.activationTimestamp) + effect.duration : 0);
}
UserEffectsListComposer.this.response.appendBoolean(effect.duration <= 0); // is perm
} }
UserEffectsListComposer.this.response.appendBoolean(effect.duration <= 0); //effect.isActivated());
return true;
});
} }
} }
return this.response; return this.response;
} }
} }