mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch 'dev' into 'master'
2.1.1 See merge request morningstar/Arcturus-Community!66
This commit is contained in:
commit
98cda8cc19
@ -34,7 +34,7 @@ public final class Emulator {
|
||||
public final static int MINOR = 2;
|
||||
|
||||
|
||||
public final static int BUILD = 0;
|
||||
public final static int BUILD = 1;
|
||||
|
||||
|
||||
public final static String PREVIEW = "Stable";
|
||||
|
@ -27,8 +27,6 @@ public class InteractionFXBox extends InteractionDefault {
|
||||
|
||||
@Override
|
||||
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(this.getExtradata().equals("1"))
|
||||
return;
|
||||
@ -54,7 +52,6 @@ public class InteractionFXBox extends InteractionDefault {
|
||||
return;
|
||||
|
||||
EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0);
|
||||
client.sendResponse(new UserEffectsListComposer(client.getHabbo()));
|
||||
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
|
||||
|
||||
this.setExtradata("1");
|
||||
|
@ -22,7 +22,12 @@ public class InteractionTotemHead extends InteractionDefault {
|
||||
}
|
||||
|
||||
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) {
|
||||
return TotemType.fromInt(extraData + 1);
|
||||
}
|
||||
|
@ -74,8 +74,7 @@ public class InteractionTotemPlanet extends InteractionDefault {
|
||||
return;
|
||||
}
|
||||
|
||||
client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId);
|
||||
client.sendResponse(new UserEffectsListComposer(client.getHabbo()));
|
||||
EffectsComponent.HabboEffect effect = client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId);
|
||||
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
|
||||
return;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.navigation.NavigatorSavedSearch;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
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.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
@ -95,7 +96,7 @@ public class SecureLoginEvent extends MessageHandler {
|
||||
|
||||
messages.add(new SecureLoginOKComposer().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 NewUserIdentityComposer(habbo).compose());
|
||||
messages.add(new UserPermissionsComposer(this.client.getHabbo()).compose());
|
||||
|
@ -8,7 +8,8 @@ import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
public class EffectsListAddComposer extends MessageComposer {
|
||||
public final EffectsComponent.HabboEffect effect;
|
||||
|
||||
public EffectsListAddComposer(EffectsComponent.HabboEffect effect) {
|
||||
public
|
||||
EffectsListAddComposer(EffectsComponent.HabboEffect effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
|
||||
@ -17,8 +18,8 @@ public class EffectsListAddComposer extends MessageComposer {
|
||||
this.response.init(Outgoing.EffectsListAddComposer);
|
||||
this.response.appendInt(this.effect.effect); //Type
|
||||
this.response.appendInt(0); //Unknown Costume?
|
||||
this.response.appendInt(this.effect.duration); //Duration
|
||||
this.response.appendBoolean(this.effect.isActivated()); //Is active
|
||||
this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE); //Duration
|
||||
this.response.appendBoolean(effect.duration <= 0); //Is active
|
||||
return this.response;
|
||||
}
|
||||
}
|
@ -10,38 +10,41 @@ import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
public class UserEffectsListComposer extends MessageComposer {
|
||||
public final Habbo habbo;
|
||||
public final EffectsComponent.HabboEffect[] effects;
|
||||
|
||||
public UserEffectsListComposer(Habbo habbo) {
|
||||
public UserEffectsListComposer(Habbo habbo, EffectsComponent.HabboEffect[] effects) {
|
||||
this.habbo = habbo;
|
||||
this.effects = effects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerMessage compose() {
|
||||
this.response.init(Outgoing.UserEffectsListComposer);
|
||||
|
||||
|
||||
if (this.habbo == null || this.habbo.getInventory() == null || this.habbo.getInventory().getEffectsComponent() == null || this.habbo.getInventory().getEffectsComponent().effects == null) {
|
||||
this.response.appendInt(0);
|
||||
} else {
|
||||
synchronized (this.habbo.getInventory().getEffectsComponent().effects) {
|
||||
this.response.appendInt(this.habbo.getInventory().getEffectsComponent().effects.size());
|
||||
this.habbo.getInventory().getEffectsComponent().effects.forEachValue(effect -> {
|
||||
this.response.appendInt(this.effects.length);
|
||||
|
||||
for(EffectsComponent.HabboEffect effect : effects) {
|
||||
|
||||
UserEffectsListComposer.this.response.appendInt(effect.effect);
|
||||
UserEffectsListComposer.this.response.appendInt(0);
|
||||
UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : 1);
|
||||
UserEffectsListComposer.this.response.appendInt(effect.total - (effect.isActivated() ? 1 : 0));
|
||||
UserEffectsListComposer.this.response.appendInt(effect.duration > 0 ? effect.duration : Integer.MAX_VALUE);
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user