mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 12:22:36 +01:00
Fixed effect boxes, credits to Beny and Skeletor.
This commit is contained in:
parent
5adf4590b8
commit
506886d794
@ -52,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");
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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); //effect.isActivated());
|
UserEffectsListComposer.this.response.appendBoolean(effect.duration <= 0); // is perm
|
||||||
return true;
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user