BizarreDio
New Member
- Mar 17, 2018
- 26
- 2
After using
Here is my CreditFurniRedeemEvent.cs
Any clue how to fix?
You must be registered for see links
to figure out how to add diamond exchange, Items that start with "DF" in my furniture database convert to the price of diamonds but give credits instead. E.g. a exchange furni worth 1 diamond, when converted, gives 1 credit.Here is my CreditFurniRedeemEvent.cs
PHP:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Items;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
using Plus.Database.Interfaces;
namespace Plus.Communication.Packets.Incoming.Rooms.Furni
{
class CreditFurniRedeemEvent : IPacketEvent
{
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
Room Room = null;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
if (!Room.CheckRights(Session, true))
return;
if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.exchangeables.enabled") != "1")
{
Session.SendNotification("The hotel managers have temporarilly disabled exchanging!");
return;
}
Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt());
if (Exchange == null)
return;
if (Exchange.Data.InteractionType != InteractionType.EXCHANGE)
return;
int Value = Exchange.Data.BehaviourData;
if (!Exchange.GetBaseItem().ItemName.StartsWith("CF_") && !Exchange.GetBaseItem().ItemName.StartsWith("CFC_") && !Exchange.GetBaseItem().ItemName.StartsWith("DF_") && !Exchange.GetBaseItem().ItemName.StartsWith("DFD_"))
return;
string[] Split = Exchange.GetBaseItem().ItemName.Split('_');
int Value = int.Parse(Split[1]);
if (Value > 0)
{
switch (Split[0])
{ // Checks what type of exchange furni we're dealing with
case "DFD": // Updates a users diamonds instead of credits.
{
Session.GetHabbo().Diamonds += Value;
Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5));
break;
}
default:
{
Session.GetHabbo().Credits += Value;
Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
break;
}
}
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @exchangeId LIMIT 1");
dbClient.AddParameter("exchangeId", Exchange.Id);
dbClient.RunQuery();
}
Session.SendPacket(new FurniListUpdateComposer());
Room.GetRoomItemHandler().RemoveFurniture(null, Exchange.Id, false);
Session.GetHabbo().GetInventoryComponent().RemoveItem(Exchange.Id);
}
}
}
Any clue how to fix?