Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
[HELP] Diamond Exchange
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NickZeGamerX" data-source="post: 456419" data-attributes="member: 67381"><p>Hello, I am so noob with this ;[</p><p>So I have been gathering information about how to add diamond exchange;</p><p>So I got this one code from this source: <a href="http://forum.*****.com/f333/plusemu-exchange-diamonds-1106094/" target="_blank">http://forum.*****.com/f333/plusemu-exchange-diamonds-1106094/</a></p><p>And the problem is, it isn't letting me convert the diamond exchange furnis to diamond but It converts to credits instead!</p><p>SO this is my code:</p><p>CreditFurniRedeemEvent.cs</p><p></p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.Items;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Purse;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Furni;</p><p></p><p>using Plus.Database.Interfaces;</p><p></p><p></p><p>namespace Plus.Communication.Packets.Incoming.Rooms.Furni</p><p>{</p><p> class CreditFurniRedeemEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> if (!Session.GetHabbo().InRoom)</p><p> return;</p><p></p><p></p><p>Room Room;</p><p></p><p></p><p>if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))</p><p> return;</p><p></p><p></p><p>if (!Room.CheckRights(Session, true))</p><p> return;</p><p></p><p></p><p>if (PlusEnvironment.GetDBConfig().DBData["exchange_enabled"] != "1")</p><p>{</p><p> Session.SendNotification("The hotel managers have temporarilly disabled exchanging!");</p><p> return;</p><p>}</p><p></p><p></p><p>Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt());</p><p>if (Exchange == null)</p><p> return;</p><p></p><p></p><p>if (!Exchange.GetBaseItem().ItemName.StartsWith("CF_") && !Exchange.GetBaseItem().ItemName.StartsWith("CFC_") || !Exchange.GetBaseItem().ItemName.StartsWith("DFD_"))</p><p> return;</p><p></p><p></p><p>string[] Split = Exchange.GetBaseItem().ItemName.Split('_');</p><p>int Value = int.Parse(Split[1]);</p><p></p><p></p><p>if (Value > 0)</p><p>{</p><p> switch(Split[0]){ // Checks what type of exchange furni we're dealing with</p><p> default:</p><p> {</p><p> Session.GetHabbo().Credits += Value;</p><p> Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));</p><p> </p><p> break;</p><p> }</p><p> case "DFD": // Updates a users diamonds instead of credits.</p><p> {</p><p> Session.GetHabbo().Diamonds += Value;</p><p> Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5));</p><p> </p><p> break;</p><p> }</p><p> }</p><p>}</p><p></p><p></p><p>using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p>{</p><p> dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Exchange.Id + "' LIMIT 1");</p><p>}</p><p></p><p></p><p>Session.SendMessage(new FurniListUpdateComposer());</p><p>Room.GetRoomItemHandler().RemoveFurniture(null, Exchange.Id, false);</p><p>Session.GetHabbo().GetInventoryComponent().RemoveItem(Exchange.Id);</p><p></p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>ItemUtility.cs</p><p></p><p>[CODE]using Plus.HabboHotel.Items;</p><p>using Plus.HabboHotel.Items.Utilities;</p><p> </p><p>using Plus.HabboHotel.Items;</p><p></p><p>namespace Plus.HabboHotel.Catalog.Utilities</p><p>{</p><p> public static class ItemUtility {</p><p> public static bool CanGiftItem(CatalogItem Item)</p><p> {</p><p> if (!Item.Data.AllowGift || Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") || Item.Data.ItemName.ToLower().StartsWith("dfd_") ||</p><p> Item.Data.InteractionType == InteractionType.BADGE || (Item.Data.Type != 's' && Item.Data.Type != 'i') || Item.CostDiamonds > 0 ||</p><p> Item.Data.InteractionType == InteractionType.TELEPORT || Item.Data.InteractionType == InteractionType.DEAL)</p><p> return false;</p><p></p><p></p><p> if (Item.Data.IsRare)</p><p> return false;</p><p></p><p></p><p> if (PetUtility.IsPet(Item.Data.InteractionType))</p><p> return false;</p><p> return true;</p><p> }</p><p></p><p></p><p> public static bool CanSelectAmount(CatalogItem Item)</p><p> {</p><p> if (Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") || Item.Data.ItemName.ToLower().StartsWith("dfd_") || !Item.HaveOffer || Item.Data.InteractionType == InteractionType.BADGE || Item.Data.InteractionType == InteractionType.DEAL)</p><p> return false;</p><p> return true;</p><p> }</p><p></p><p> public static int GetSaddleId(int Saddle)</p><p> {</p><p> switch (Saddle)</p><p> {</p><p> default:</p><p> case 9:</p><p> return 4221;</p><p> case 10:</p><p> return 4450;</p><p> }</p><p> }</p><p></p><p> public static bool IsRare(Item Item)</p><p> {</p><p> if (Item.LimitedNo > 0)</p><p> return true;</p><p></p><p> if (Item.Data.IsRare)</p><p> return true;</p><p></p><p> return false;</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>So, the point is; idk what I did wrong or I am even doing it right :< Forgive me for being so noob about this</p></blockquote><p></p>
[QUOTE="NickZeGamerX, post: 456419, member: 67381"] Hello, I am so noob with this ;[ So I have been gathering information about how to add diamond exchange; So I got this one code from this source: [URL]http://forum.*****.com/f333/plusemu-exchange-diamonds-1106094/[/URL] And the problem is, it isn't letting me convert the diamond exchange furnis to diamond but It converts to credits instead! SO this is my code: CreditFurniRedeemEvent.cs [CODE]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; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session, true)) return; if (PlusEnvironment.GetDBConfig().DBData["exchange_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.GetBaseItem().ItemName.StartsWith("CF_") && !Exchange.GetBaseItem().ItemName.StartsWith("CFC_") || !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 default: { Session.GetHabbo().Credits += Value; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); break; } case "DFD": // Updates a users diamonds instead of credits. { Session.GetHabbo().Diamonds += Value; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5)); break; } } } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Exchange.Id + "' LIMIT 1"); } Session.SendMessage(new FurniListUpdateComposer()); Room.GetRoomItemHandler().RemoveFurniture(null, Exchange.Id, false); Session.GetHabbo().GetInventoryComponent().RemoveItem(Exchange.Id); } } }[/CODE] ItemUtility.cs [CODE]using Plus.HabboHotel.Items; using Plus.HabboHotel.Items.Utilities; using Plus.HabboHotel.Items; namespace Plus.HabboHotel.Catalog.Utilities { public static class ItemUtility { public static bool CanGiftItem(CatalogItem Item) { if (!Item.Data.AllowGift || Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") || Item.Data.ItemName.ToLower().StartsWith("dfd_") || Item.Data.InteractionType == InteractionType.BADGE || (Item.Data.Type != 's' && Item.Data.Type != 'i') || Item.CostDiamonds > 0 || Item.Data.InteractionType == InteractionType.TELEPORT || Item.Data.InteractionType == InteractionType.DEAL) return false; if (Item.Data.IsRare) return false; if (PetUtility.IsPet(Item.Data.InteractionType)) return false; return true; } public static bool CanSelectAmount(CatalogItem Item) { if (Item.IsLimited || Item.Amount > 1 || Item.Data.ItemName.ToLower().StartsWith("cf_") || Item.Data.ItemName.ToLower().StartsWith("cfc_") || Item.Data.ItemName.ToLower().StartsWith("dfd_") || !Item.HaveOffer || Item.Data.InteractionType == InteractionType.BADGE || Item.Data.InteractionType == InteractionType.DEAL) return false; return true; } public static int GetSaddleId(int Saddle) { switch (Saddle) { default: case 9: return 4221; case 10: return 4450; } } public static bool IsRare(Item Item) { if (Item.LimitedNo > 0) return true; if (Item.Data.IsRare) return true; return false; } } }[/CODE] So, the point is; idk what I did wrong or I am even doing it right :< Forgive me for being so noob about this [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[HELP] Diamond Exchange
Top