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
[PlusEMU] Trouble With Marketplace
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="treebeard" data-source="post: 430090" data-attributes="member: 79259"><p>Hello everyone,</p><p></p><p>I've recently been trying to get the marketplace working in my Plus emulator R2. </p><p>When trying to add a new furni offer to the marketplace I get this error immediately:</p><p></p><p><img src="https://i.imgur.com/U1irhWk.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> </p><p></p><p><strong><u>Here's the packet headers I have in my Communication > Packets:</u></strong></p><p>[CODE]Client Packet Header</p><p>--------------------</p><p>public const int GetMarketplaceCanMakeOfferMessageEvent = 1552;//1647</p><p>public const int GetMarketplaceItemStatsMessageEvent = 1561;//1203</p><p>public const int GetMarketplaceConfigurationMessageEvent = 2811;//1604</p><p></p><p>Server Packet Header</p><p>--------------------</p><p>public const int MarketplaceCanMakeOfferResultMessageComposer = 2452;//1874</p><p>public const int MarketplaceConfigurationMessageComposer = 1817;//3702</p><p>public const int MarketplaceItemStatsMessageComposer = 480;//2909</p><p>public const int MarketPlaceOwnOffersMessageComposer = 1892;//2806</p><p>public const int MarketPlaceOffersMessageComposer = 291;//2985</p><p>public const int MarketplaceMakeOfferResultMessageComposer = 480;//3960</p><p>public const int MarketplaceCancelOfferResultMessageComposer = 1892;//202[/CODE]</p><p></p><p>Here's the code I have for marketplace in my EMU:</p><p><strong><u>MarketOffer.cs</u></strong></p><p>[CODE]namespace Plus.HabboHotel.Catalog.Marketplace</p><p>{</p><p> public class MarketOffer</p><p> {</p><p> public int OfferID { get; set; }</p><p> public int ItemType { get; set; }</p><p> public int SpriteId { get; set; }</p><p> public int TotalPrice { get; set; }</p><p> public int LimitedNumber { get; set; }</p><p> public int LimitedStack { get; set; }</p><p></p><p> public MarketOffer(int OfferID, int SpriteId, int TotalPrice, int ItemType, int LimitedNumber, int LimitedStack)</p><p> {</p><p> this.OfferID = OfferID;</p><p> this.SpriteId = SpriteId;</p><p> this.ItemType = ItemType;</p><p> this.TotalPrice = TotalPrice;</p><p> this.LimitedNumber = LimitedNumber;</p><p> this.LimitedStack = LimitedStack;</p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p><strong><u>MarketplaceManager.cs</u></strong></p><p>[CODE]using System;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.Database.Interfaces;</p><p></p><p>namespace Plus.HabboHotel.Catalog.Marketplace</p><p>{</p><p> public class MarketplaceManager</p><p> {</p><p> public List<int> MarketItemKeys = new List<int>();</p><p> public List<MarketOffer> MarketItems = new List<MarketOffer>();</p><p> public Dictionary<int, int> MarketCounts = new Dictionary<int, int>();</p><p> public Dictionary<int, int> MarketAverages = new Dictionary<int, int>();</p><p></p><p> public MarketplaceManager()</p><p> {</p><p></p><p> }</p><p></p><p> public int AvgPriceForSprite(int SpriteID)</p><p> {</p><p> int num = 0;</p><p> int num2 = 0;</p><p> if (this.MarketAverages.ContainsKey(SpriteID) && this.MarketCounts.ContainsKey(SpriteID))</p><p> {</p><p> if (this.MarketCounts[SpriteID] > 0)</p><p> {</p><p> return (this.MarketAverages[SpriteID] / this.MarketCounts[SpriteID]);</p><p> }</p><p> return 0;</p><p> }</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT `avgprice` FROM `catalog_marketplace_data` WHERE `sprite` = '" + SpriteID + "' LIMIT 1");</p><p> num = dbClient.GetInteger();</p><p></p><p> dbClient.SetQuery("SELECT `sold` FROM `catalog_marketplace_data` WHERE `sprite` = '" + SpriteID + "' LIMIT 1");</p><p> num2 = dbClient.GetInteger();</p><p> }</p><p></p><p> this.MarketAverages.Add(SpriteID, num);</p><p> this.MarketCounts.Add(SpriteID, num2);</p><p></p><p> if (num2 > 0)</p><p> return Convert.ToInt32(Math.Ceiling((double)(num / num2)));</p><p> </p><p> return 0;</p><p> }</p><p></p><p> public string FormatTimestampString()</p><p> {</p><p> return this.FormatTimestamp().ToString().Split(new char[] { ',' })[0];</p><p> }</p><p></p><p> public double FormatTimestamp()</p><p> {</p><p> return (PlusEnvironment.GetUnixTimestamp() - 172800.0);</p><p> }</p><p></p><p> public int OfferCountForSprite(int SpriteID)</p><p> {</p><p> Dictionary<int, MarketOffer> dictionary = new Dictionary<int, MarketOffer>();</p><p> Dictionary<int, int> dictionary2 = new Dictionary<int, int>();</p><p> foreach (MarketOffer item in this.MarketItems)</p><p> {</p><p> if (dictionary.ContainsKey(item.SpriteId))</p><p> {</p><p> if (dictionary[item.SpriteId].TotalPrice > item.TotalPrice)</p><p> {</p><p> dictionary.Remove(item.SpriteId);</p><p> dictionary.Add(item.SpriteId, item);</p><p> }</p><p></p><p> int num = dictionary2[item.SpriteId];</p><p> dictionary2.Remove(item.SpriteId);</p><p> dictionary2.Add(item.SpriteId, num + 1);</p><p> }</p><p> else</p><p> {</p><p> dictionary.Add(item.SpriteId, item);</p><p> dictionary2.Add(item.SpriteId, 1);</p><p> }</p><p> }</p><p> if (dictionary2.ContainsKey(SpriteID))</p><p> {</p><p> return dictionary2[SpriteID];</p><p> }</p><p> return 0;</p><p> }</p><p></p><p> public int CalculateComissionPrice(float SellingPrice)</p><p> {</p><p> return Convert.ToInt32(Math.Ceiling(SellingPrice / 100 * 1));</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p>& I'm using <strong><u>PRODUCTION-201701242205-837386173</u></strong></p><p></p><p>If there's any other information that can better equip you to assist me, feel free to let me know.</p><p>As always, I appreciate the time, energy, and effort that goes into all feedback. Thanks!</p></blockquote><p></p>
[QUOTE="treebeard, post: 430090, member: 79259"] Hello everyone, I've recently been trying to get the marketplace working in my Plus emulator R2. When trying to add a new furni offer to the marketplace I get this error immediately: [IMG]https://i.imgur.com/U1irhWk.png[/IMG] [B][U]Here's the packet headers I have in my Communication > Packets:[/U][/B] [CODE]Client Packet Header -------------------- public const int GetMarketplaceCanMakeOfferMessageEvent = 1552;//1647 public const int GetMarketplaceItemStatsMessageEvent = 1561;//1203 public const int GetMarketplaceConfigurationMessageEvent = 2811;//1604 Server Packet Header -------------------- public const int MarketplaceCanMakeOfferResultMessageComposer = 2452;//1874 public const int MarketplaceConfigurationMessageComposer = 1817;//3702 public const int MarketplaceItemStatsMessageComposer = 480;//2909 public const int MarketPlaceOwnOffersMessageComposer = 1892;//2806 public const int MarketPlaceOffersMessageComposer = 291;//2985 public const int MarketplaceMakeOfferResultMessageComposer = 480;//3960 public const int MarketplaceCancelOfferResultMessageComposer = 1892;//202[/CODE] Here's the code I have for marketplace in my EMU: [B][U]MarketOffer.cs[/U][/B] [CODE]namespace Plus.HabboHotel.Catalog.Marketplace { public class MarketOffer { public int OfferID { get; set; } public int ItemType { get; set; } public int SpriteId { get; set; } public int TotalPrice { get; set; } public int LimitedNumber { get; set; } public int LimitedStack { get; set; } public MarketOffer(int OfferID, int SpriteId, int TotalPrice, int ItemType, int LimitedNumber, int LimitedStack) { this.OfferID = OfferID; this.SpriteId = SpriteId; this.ItemType = ItemType; this.TotalPrice = TotalPrice; this.LimitedNumber = LimitedNumber; this.LimitedStack = LimitedStack; } } }[/CODE] [B][U]MarketplaceManager.cs[/U][/B] [CODE]using System; using System.Collections.Generic; using Plus.Database.Interfaces; namespace Plus.HabboHotel.Catalog.Marketplace { public class MarketplaceManager { public List<int> MarketItemKeys = new List<int>(); public List<MarketOffer> MarketItems = new List<MarketOffer>(); public Dictionary<int, int> MarketCounts = new Dictionary<int, int>(); public Dictionary<int, int> MarketAverages = new Dictionary<int, int>(); public MarketplaceManager() { } public int AvgPriceForSprite(int SpriteID) { int num = 0; int num2 = 0; if (this.MarketAverages.ContainsKey(SpriteID) && this.MarketCounts.ContainsKey(SpriteID)) { if (this.MarketCounts[SpriteID] > 0) { return (this.MarketAverages[SpriteID] / this.MarketCounts[SpriteID]); } return 0; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `avgprice` FROM `catalog_marketplace_data` WHERE `sprite` = '" + SpriteID + "' LIMIT 1"); num = dbClient.GetInteger(); dbClient.SetQuery("SELECT `sold` FROM `catalog_marketplace_data` WHERE `sprite` = '" + SpriteID + "' LIMIT 1"); num2 = dbClient.GetInteger(); } this.MarketAverages.Add(SpriteID, num); this.MarketCounts.Add(SpriteID, num2); if (num2 > 0) return Convert.ToInt32(Math.Ceiling((double)(num / num2))); return 0; } public string FormatTimestampString() { return this.FormatTimestamp().ToString().Split(new char[] { ',' })[0]; } public double FormatTimestamp() { return (PlusEnvironment.GetUnixTimestamp() - 172800.0); } public int OfferCountForSprite(int SpriteID) { Dictionary<int, MarketOffer> dictionary = new Dictionary<int, MarketOffer>(); Dictionary<int, int> dictionary2 = new Dictionary<int, int>(); foreach (MarketOffer item in this.MarketItems) { if (dictionary.ContainsKey(item.SpriteId)) { if (dictionary[item.SpriteId].TotalPrice > item.TotalPrice) { dictionary.Remove(item.SpriteId); dictionary.Add(item.SpriteId, item); } int num = dictionary2[item.SpriteId]; dictionary2.Remove(item.SpriteId); dictionary2.Add(item.SpriteId, num + 1); } else { dictionary.Add(item.SpriteId, item); dictionary2.Add(item.SpriteId, 1); } } if (dictionary2.ContainsKey(SpriteID)) { return dictionary2[SpriteID]; } return 0; } public int CalculateComissionPrice(float SellingPrice) { return Convert.ToInt32(Math.Ceiling(SellingPrice / 100 * 1)); } } } [/CODE] & I'm using [B][U]PRODUCTION-201701242205-837386173[/U][/B] If there's any other information that can better equip you to assist me, feel free to let me know. As always, I appreciate the time, energy, and effort that goes into all feedback. Thanks! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[PlusEMU] Trouble With Marketplace
Top