mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 08:20:51 +01:00
Set all credits/points event to the same method, added cancel for login event
This commit is contained in:
parent
09b8b07d20
commit
bb6a2e5eac
@ -548,13 +548,11 @@ public class CatalogManager {
|
||||
voucher.addHistoryEntry(habbo.getHabboInfo().getId());
|
||||
|
||||
if (voucher.points > 0) {
|
||||
client.getHabbo().getHabboInfo().addCurrencyAmount(voucher.pointsType, voucher.points);
|
||||
client.sendResponse(new UserPointsComposer(client.getHabbo().getHabboInfo().getCurrencyAmount(voucher.pointsType), voucher.points, voucher.pointsType));
|
||||
client.getHabbo().givePoints(voucher.pointsType, voucher.points);
|
||||
}
|
||||
|
||||
if (voucher.credits > 0) {
|
||||
client.getHabbo().getHabboInfo().addCredits(voucher.credits);
|
||||
client.sendResponse(new UserCreditsComposer(client.getHabbo()));
|
||||
client.getHabbo().giveCredits(voucher.credits);
|
||||
}
|
||||
|
||||
if (voucher.catalogItemId > 0) {
|
||||
@ -1072,15 +1070,13 @@ public class CatalogManager {
|
||||
|
||||
if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) {
|
||||
if (purchasedEvent.totalCredits > 0) {
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.totalCredits);
|
||||
habbo.getClient().sendResponse(new UserCreditsComposer(habbo.getClient().getHabbo()));
|
||||
habbo.getClient().getHabbo().giveCredits(-purchasedEvent.totalCredits);
|
||||
}
|
||||
}
|
||||
|
||||
if (!free && !habbo.getClient().getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) {
|
||||
if (purchasedEvent.totalPoints > 0) {
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.totalPoints);
|
||||
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.totalPoints, item.getPointsType()));
|
||||
habbo.getClient().getHabbo().givePoints(item.getPointsType(), -purchasedEvent.totalPoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,12 +279,11 @@ public class MarketPlace {
|
||||
client.getHabbo().getInventory().getItemsComponent().addItem(item);
|
||||
|
||||
if (MARKETPLACE_CURRENCY == 0) {
|
||||
client.getHabbo().getHabboInfo().addCredits(-event.price);
|
||||
client.getHabbo().giveCredits(-event.price);
|
||||
} else {
|
||||
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, -event.price);
|
||||
}
|
||||
|
||||
client.sendResponse(new UserCreditsComposer(client.getHabbo()));
|
||||
client.sendResponse(new AddHabboItemComposer(item));
|
||||
client.sendResponse(new InventoryRefreshComposer());
|
||||
client.sendResponse(new MarketplaceBuyErrorComposer(MarketplaceBuyErrorComposer.REFRESH, 0, offerId, price));
|
||||
@ -381,11 +380,10 @@ public class MarketPlace {
|
||||
offers.clear();
|
||||
|
||||
if (MARKETPLACE_CURRENCY == 0) {
|
||||
client.getHabbo().getHabboInfo().addCredits(credits);
|
||||
client.getHabbo().giveCredits(credits);
|
||||
} else {
|
||||
client.getHabbo().givePoints(MARKETPLACE_CURRENCY, credits);
|
||||
}
|
||||
client.sendResponse(new UserCreditsComposer(client.getHabbo()));
|
||||
}
|
||||
|
||||
private static void removeUser(MarketPlaceOffer offer) {
|
||||
|
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.users.UserCreditsComposer;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -30,7 +29,6 @@ public class MassCreditsCommand extends Command {
|
||||
Habbo habbo = set.getValue();
|
||||
|
||||
habbo.giveCredits(amount);
|
||||
habbo.getClient().sendResponse(new UserCreditsComposer(habbo));
|
||||
|
||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", amount + ""), RoomChatMessageBubbles.ALERT);
|
||||
|
@ -95,7 +95,7 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
||||
return false;
|
||||
|
||||
if (this.amount > 0) {
|
||||
habbo.getHabboInfo().addCurrencyAmount(Emulator.getConfig().getInt("hotelview.promotional.points.type"), this.amount);
|
||||
habbo.givePoints(Emulator.getConfig().getInt("hotelview.promotional.points.type"), this.amount);
|
||||
habbo.getClient().sendResponse(new BonusRareComposer(habbo));
|
||||
}
|
||||
|
||||
|
@ -375,15 +375,13 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
case "coins":
|
||||
case "credit":
|
||||
case "coin":
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCredits(amount);
|
||||
habbo.getClient().sendResponse(new UserCreditsComposer(habbo.getClient().getHabbo()));
|
||||
habbo.getClient().getHabbo().giveCredits(amount);
|
||||
break;
|
||||
|
||||
case "diamonds":
|
||||
case "diamond":
|
||||
pointCurrency = 5;
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(pointCurrency, amount);
|
||||
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(pointCurrency), amount, pointCurrency));
|
||||
habbo.getClient().getHabbo().givePoints(pointCurrency, amount);
|
||||
break;
|
||||
|
||||
case "duckets":
|
||||
@ -391,8 +389,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
case "pixels":
|
||||
case "pixel":
|
||||
pointCurrency = 0;
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(pointCurrency, amount);
|
||||
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(pointCurrency), amount, pointCurrency));
|
||||
habbo.getClient().getHabbo().givePoints(pointCurrency, amount);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -405,8 +402,7 @@ public class SubscriptionHabboClub extends Subscription {
|
||||
}
|
||||
|
||||
if (pointCurrency >= 0) {
|
||||
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(pointCurrency, amount);
|
||||
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(pointCurrency), amount, pointCurrency));
|
||||
habbo.getClient().getHabbo().givePoints(pointCurrency, amount);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ public class CatalogBuyClubDiscountEvent extends MessageHandler {
|
||||
return;
|
||||
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS))
|
||||
this.client.getHabbo().getHabboInfo().addCredits(-totalCredits);
|
||||
this.client.getHabbo().giveCredits(-totalCredits);
|
||||
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS))
|
||||
this.client.getHabbo().getHabboInfo().addCurrencyAmount(deal.getPointsType(), -totalDuckets);
|
||||
this.client.getHabbo().givePoints(deal.getPointsType(), -totalDuckets);
|
||||
|
||||
|
||||
if(this.client.getHabbo().getHabboStats().createSubscription(Subscription.HABBO_CLUB, (totalDays * 86400)) == null) {
|
||||
@ -69,12 +69,6 @@ public class CatalogBuyClubDiscountEvent extends MessageHandler {
|
||||
throw new Exception("Unable to create or extend subscription");
|
||||
}
|
||||
|
||||
if (totalCredits > 0)
|
||||
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
|
||||
|
||||
if (totalDuckets > 0)
|
||||
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
|
||||
|
||||
this.client.sendResponse(new PurchaseOKComposer(null));
|
||||
this.client.sendResponse(new InventoryRefreshComposer());
|
||||
|
||||
|
@ -358,11 +358,10 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
||||
}
|
||||
if (totalPoints > 0) {
|
||||
if (item.getPointsType() == 0 && !this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_PIXELS)) {
|
||||
this.client.getHabbo().getHabboInfo().addPixels(-totalPoints);
|
||||
this.client.getHabbo().givePixels(-totalPoints);
|
||||
} else if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) {
|
||||
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalPoints);
|
||||
this.client.getHabbo().givePoints(item.getPointsType(), -totalPoints);
|
||||
}
|
||||
this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -totalPoints, item.getPointsType()));
|
||||
}
|
||||
|
||||
this.client.sendResponse(new PurchaseOKComposer(item));
|
||||
|
@ -106,12 +106,10 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
}
|
||||
((RoomBundleLayout) page).buyRoom(this.client.getHabbo());
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().getHabboInfo().addCredits(-roomBundleItem.getCredits()); // takes their credits away
|
||||
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo())); // Sends the updated currency composer window
|
||||
this.client.getHabbo().giveCredits(-roomBundleItem.getCredits()); // takes their credits away
|
||||
}
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS)) { //if the player has this perm disabled
|
||||
this.client.getHabbo().getHabboInfo().addCurrencyAmount(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away
|
||||
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo())); // Sends the updated currency composer window
|
||||
this.client.getHabbo().givePoints(roomBundleItem.getPointsType(), -roomBundleItem.getPoints()); // takes their points away
|
||||
}
|
||||
this.client.sendResponse(new PurchaseOKComposer()); // Sends the composer to close the window.
|
||||
|
||||
@ -176,10 +174,10 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
return;
|
||||
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_CREDITS))
|
||||
this.client.getHabbo().getHabboInfo().addCredits(-totalCredits);
|
||||
this.client.getHabbo().giveCredits(-totalCredits);
|
||||
|
||||
if (!this.client.getHabbo().hasPermission(Permission.ACC_INFINITE_POINTS))
|
||||
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalDuckets);
|
||||
this.client.getHabbo().givePoints(item.getPointsType(), -totalDuckets);
|
||||
|
||||
|
||||
if(this.client.getHabbo().getHabboStats().createSubscription(Subscription.HABBO_CLUB, (totalDays * 86400)) == null) {
|
||||
@ -195,12 +193,6 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
this.client.sendResponse(new UserPermissionsComposer(this.client.getHabbo()));
|
||||
this.client.sendResponse(new UserClubComposer(this.client.getHabbo()));*/
|
||||
|
||||
if (totalCredits > 0)
|
||||
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
|
||||
|
||||
if (totalDuckets > 0)
|
||||
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
|
||||
|
||||
this.client.sendResponse(new PurchaseOKComposer(null));
|
||||
this.client.sendResponse(new InventoryRefreshComposer());
|
||||
|
||||
|
@ -33,6 +33,7 @@ import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
|
||||
import com.eu.habbo.messages.outgoing.mysterybox.MysteryBoxKeysComposer;
|
||||
import com.eu.habbo.messages.outgoing.users.*;
|
||||
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserLoginEvent;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import org.slf4j.Logger;
|
||||
@ -186,7 +187,13 @@ public class SecureLoginEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getHabbo().getHabboInfo().getIpLogin()));
|
||||
UserLoginEvent userLoginEvent = new UserLoginEvent(habbo, this.client.getHabbo().getHabboInfo().getIpLogin());
|
||||
Emulator.getPluginManager().fireEvent(userLoginEvent);
|
||||
|
||||
if(userLoginEvent.isCancelled()) {
|
||||
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Emulator.getConfig().getBoolean("hotel.welcome.alert.enabled")) {
|
||||
final Habbo finalHabbo = habbo;
|
||||
|
@ -107,8 +107,7 @@ public class RedeemItemEvent extends MessageHandler {
|
||||
|
||||
switch (furniRedeemEvent.currencyID) {
|
||||
case FurnitureRedeemedEvent.CREDITS:
|
||||
this.client.getHabbo().getHabboInfo().addCredits(furniRedeemEvent.amount);
|
||||
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
|
||||
this.client.getHabbo().giveCredits(furniRedeemEvent.amount);
|
||||
break;
|
||||
|
||||
case FurnitureRedeemedEvent.DIAMONDS:
|
||||
@ -116,8 +115,7 @@ public class RedeemItemEvent extends MessageHandler {
|
||||
break;
|
||||
|
||||
case FurnitureRedeemedEvent.PIXELS:
|
||||
this.client.getHabbo().getHabboInfo().addPixels(furniRedeemEvent.amount);
|
||||
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
|
||||
this.client.getHabbo().givePixels(furniRedeemEvent.amount);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user