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 Releases
Server Releases
[PlusEMU][Addon] Christmas Calander
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="Core" data-source="post: 392732" data-attributes="member: 72270"><p style="text-align: center"><span style="font-size: 22px"><strong><u><span style="color: #ff0000">Stop releasing on other forums and taking credits. This is a release for DevBest. </span></u></strong></span></p> <p style="text-align: center"><strong><u><span style="font-size: 22px">Habbo Advent Calendar</span></u></strong></p><p>This is for the Habbo.com's 2016 Advent Calendar. Only difference is that the prizes which are given are not random, it's a fixed prize each day. I done this so it's more fair for users. This release is for the latest production of Habbo.com (12/12/2016 (PRODUCTION-201612121204-107735592)). This is also a very pointless releases as it's 19th December but Habbo has calender's all the time for different things so you will only need to change the event name. Or you could just use the same calendar and just change the text in external flash texts? e.g. "New Year Advent Calendar" xD!</p><p></p><p>However, the structure has remained the same since PRODUCTION-201610312204-296063264 and maybe even before then. It was this build when I first created this so I know for certain it's not changed since then.</p><p></p><p><img src="http://image.prntscr.com/image/b4da223d578e44d3a5459545c71a7c62.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><strong>I didn't code "Force Open" but if you'd like to the packet id is 2799 and the structure is string, int. The string is the event name (xmas16) and the int is the day id. There is no use in this though and I'm lazy! xD - If you want it just edit the open gift and remove time check and check if user is an admin.</strong></p><p></p><p>Now you will want to open GameClient.cs and find</p><p>[code]_habbo.InitProcess();[/code]</p><p>Above that you want to add</p><p>[code]</p><p>if (PlusStaticGameSettings.CampaignCalendarEnabled)</p><p> SendMessage(new CampaignCalendarDataComposer(_habbo.GetStats().openedGifts));</p><p>[/code]</p><p></p><p>You may need to add this at the top of the GameClient.cs</p><p>[code]using Plus.Communication.Packets.Outgoing.Campaigns;[/code]</p><p></p><p>Next you want to open PlusStaticGameSettings and find</p><p>[code]public const bool NewUserTutorialBotEnabled = true;[/code]</p><p></p><p>and below that put</p><p>[code]public const bool CampaignCalendarEnabled = true;[/code]</p><p></p><p>Now you want to create CampaignCalendarDataComposer and put</p><p>[code]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</p><p></p><p>namespace Plus.Communication.Packets.Outgoing.Campaigns</p><p>{</p><p> class CampaignCalendarDataComposer : ServerPacket</p><p> {</p><p> public CampaignCalendarDataComposer(List<int> OpenedGifts)</p><p> : base(ServerPacketHeader.CampaignCalendarDataMessageComposer)</p><p> {</p><p> int currentDate = DateTime.Now.Day - 1;</p><p></p><p> base.WriteString("xmas16"); //eventTrigger</p><p> base.WriteString(string.Empty); //idk? same as habbo ;P</p><p> base.WriteInteger(currentDate); //currentDate</p><p> base.WriteInteger(25); //totalAmountOfDays</p><p></p><p> base.WriteInteger(OpenedGifts.Count); //countOpenGifts</p><p> foreach (int Opened in OpenedGifts)</p><p> {</p><p> base.WriteInteger(Opened); //giftDay</p><p> }</p><p></p><p> List<int> MissedGifts = Enumerable.Range(0, (currentDate - 2)).Where(Day => !OpenedGifts.Contains(Day)).ToList();</p><p></p><p> base.WriteInteger(MissedGifts.Count); //countMissedGifts</p><p> foreach (int Missed in MissedGifts)</p><p> {</p><p> base.WriteInteger(Missed); //giftDay</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>Next you want to go to ServerPacketHeader.cs and add</p><p>[code]</p><p>public const int CampaignCalendarDataMessageComposer = 2740; //updated</p><p>public const int CampaignCalendarGiftMessageComposer = 163; //updated</p><p>[/code]</p><p></p><p>Next you want to create an event called OpenCalendarBoxEvent and inside it put</p><p>[code]</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Furni;</p><p>using Plus.Communication.Packets.Outgoing.LandingView;</p><p>using Plus.Database.Interfaces;</p><p>using Plus.HabboHotel.Items;</p><p>using Plus.HabboHotel.Users;</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Data;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</p><p></p><p>namespace Plus.Communication.Packets.Incoming.LandingView</p><p>{</p><p> class OpenCalendarBoxEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> string eventName = Packet.PopString();</p><p> int giftDay = Packet.PopInt();</p><p></p><p> HabboStats habboStats = Session?.GetHabbo()?.GetStats();</p><p></p><p> int currentDay = DateTime.Now.Day - 1;</p><p></p><p> if (!PlusStaticGameSettings.CampaignCalendarEnabled || habboStats == null ||</p><p> habboStats.openedGifts.Contains(giftDay) || giftDay < (currentDay-2) ||</p><p> giftDay > currentDay || eventName != "xmas16")</p><p> {</p><p> return;</p><p> }</p><p></p><p> Item newItem = null;</p><p> if(!PlusEnvironment.GetGame().GetLandingManager().GenerateCalendarItem(</p><p> Session.GetHabbo(), eventName, giftDay, out newItem))</p><p> {</p><p> return;</p><p> }</p><p></p><p> habboStats.addOpenedGift(giftDay);</p><p> Session.GetHabbo().GetInventoryComponent().TryAddItem(newItem);</p><p> Session.SendMessage(new FurniListUpdateComposer());</p><p> Session.SendMessage(new CampaignCalendarGiftComposer(newItem.Data.ItemName));</p><p> }</p><p> }</p><p>}</p><p></p><p>[/code]</p><p></p><p>Go to PacketManager.cs and find</p><p>[code]this._incomingPackets.Add(ClientPacketHeader.GetPromoArticlesMessageEvent, new GetPromoArticlesEvent());[/code]</p><p>and then you want to add below this</p><p>[code]this._incomingPackets.Add(ClientPacketHeader.OpenCalendarBoxMessageEvent, new OpenCalendarBoxEvent());[/code]</p><p></p><p>Then in the same file find</p><p>[code]this._packetNames.Add(ClientPacketHeader.GetPromoArticlesMessageEvent, "RefreshPromoEvent");</p><p>[/code]</p><p>and below this add</p><p>[code]this._packetNames.Add(ClientPacketHeader.OpenCalendarBoxMessageEvent, "CampaignCalendarGiftEvent");[/code]</p><p></p><p>Now you want to go to ClientPacketHeader.cs and find</p><p>[code]public const int UseWallItemMessageEvent = 3940;[/code]</p><p></p><p>Below you want to add</p><p>[code]public const int OpenCalendarBoxMessageEvent = 693; //updated[/code]</p><p></p><p>Next create a server packet called CampaignCalendarGiftComposer.cs and put</p><p>[code]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</p><p></p><p>namespace Plus.Communication.Packets.Outgoing.LandingView</p><p>{</p><p> class CampaignCalendarGiftComposer : ServerPacket</p><p> {</p><p> public CampaignCalendarGiftComposer(string iconName = "throne")</p><p> : base(ServerPacketHeader.CampaignCalendarGiftMessageComposer)</p><p> {</p><p> base.WriteBoolean(true); // never bothered to check</p><p> base.WriteString("xmas14_starfish"); //productName</p><p> base.WriteString(""); //customImage</p><p> base.WriteString(iconName); //iconName</p><p> }</p><p> }</p><p>}</p><p></p><p>[/code]</p><p></p><p>Second string is xmas14_starfish because doesn't worth if not valid item but it's likely to do with the bool xD I rushed this so didn't bother checking. Still works fine just given gift string is wrong but icon shows as the rare.</p><p></p><p>Next you want to go to LandingViewManager.cs and add the following function (these should be cached but I'm lazy xD and this was done for fun not a public release)</p><p>[code]</p><p>public bool GenerateCalendarItem(Habbo Habbo, string eventName, int eventDate, out Item newItem)</p><p> {</p><p> newItem = null;</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT `item_id` FROM `campaign_calendar_gifts` WHERE `event_name` = @eventName AND `base_id` = @dayId LIMIT 1");</p><p> dbClient.AddParameter("eventName", eventName);</p><p> dbClient.AddParameter("dayId", eventDate);</p><p></p><p> DataRow row = dbClient.getRow();</p><p> ItemData itemData = null;</p><p></p><p> if (row?["item_id"] != null &&</p><p> PlusEnvironment.GetGame().GetItemManager().GetItem((string)row["item_id"], out itemData))</p><p> {</p><p> newItem = ItemFactory.CreateSingleItemNullable(itemData, Habbo, "", "");</p><p> return newItem != null;</p><p> }</p><p></p><p> return false;</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>Next you want to open ItemDataManager.cs and find</p><p>[code]public bool GetItem(int Id, out ItemData Item)[/code]</p><p></p><p>Above that put this</p><p>[code]</p><p>public bool GetItem(string itemName, out ItemData item)</p><p> {</p><p> item = this._items.Values.Where(x => x.ItemName == itemName).FirstOrDefault();</p><p> return item != null;</p><p> }</p><p>[/code]</p><p></p><p>Now you want to go to HabboStats.cs and find </p><p>[code]public int ForumPosts { get; set; }[/code]</p><p></p><p>Then blow that add</p><p>[code]</p><p>public List<int> openedGifts { get; private set; }</p><p></p><p> public void addOpenedGift(int eventDate)</p><p> {</p><p> if (this.openedGifts.Contains(eventDate))</p><p> {</p><p> return;</p><p> }</p><p></p><p> this.openedGifts.Add(eventDate);</p><p> string[] giftData = this.openedGifts.Select(giftDay => giftDay.ToString()).ToArray();</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("UPDATE `user_stats` SET `calendar_gifts` = @giftData WHERE `id` = @habboId LIMIT 1");</p><p> dbClient.AddParameter("giftData", string.Join(",", giftData));</p><p> dbClient.AddParameter("habboId", habboId);</p><p> dbClient.RunQuery();</p><p> }</p><p></p><p> }[/code]</p><p></p><p>Now in the same file fine</p><p>[code]this.ForumPosts = ForumPosts;[/code]</p><p></p><p>and below that add this</p><p>[code]</p><p>this.openedGifts = new List<int>();</p><p> foreach (string subStr in openedGifts.Split(','))</p><p> {</p><p> int openedDay = 0;</p><p> if (int.TryParse(subStr, out openedDay))</p><p> {</p><p> this.openedGifts.Add(openedDay);</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>Then find</p><p>[code]</p><p>public HabboStats(</p><p>[/code]</p><p></p><p>and just before the ) add</p><p>[code]</p><p>, string openedGifts</p><p>[/code]</p><p></p><p>Then go to Habbo.cs and find </p><p>[code]</p><p>this._habboStats = new HabboStats( [/code]</p><p>and once again before the ); add </p><p>[code]Convert.ToString(StatRow["calendar_gifts"])[/code]</p><p></p><p>You will also need to add (`calendar_gifts`) to the SELECT queries. I can't just page my query as I used this table for several things like nux status, which your table will not contain so will only give you errors.</p><p></p><p>Here is the database</p><p>[code]</p><p>/*</p><p>Navicat MySQL Data Transfer</p><p></p><p>Source Server : local</p><p>Source Server Version : 50505</p><p>Source Host : localhost:3306</p><p>Source Database : plus</p><p></p><p>Target Server Type : MYSQL</p><p>Target Server Version : 50505</p><p>File Encoding : 65001</p><p></p><p>Date: 2016-12-19 18:30:09</p><p>*/</p><p></p><p>SET FOREIGN_KEY_CHECKS=0;</p><p>-- ----------------------------</p><p>-- Table structure for `campaign_calendar_gifts`</p><p>-- ----------------------------</p><p>DROP TABLE IF EXISTS `campaign_calendar_gifts`;</p><p>CREATE TABLE `campaign_calendar_gifts` (</p><p> `id` int(11) NOT NULL AUTO_INCREMENT,</p><p> `event_name` varchar(225) NOT NULL,</p><p> `base_id` int(11) NOT NULL,</p><p> `item_id` varchar(225) NOT NULL DEFAULT '',</p><p> PRIMARY KEY (`id`)</p><p>) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;</p><p></p><p>-- ----------------------------</p><p>-- Records of campaign_calendar_gifts</p><p>-- ----------------------------</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('1', 'xmas16', '1', 'throne');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('2', 'xmas16', '2', 'typingmachine');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('3', 'xmas16', '3', 'spyro');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('4', 'xmas16', '4', 'rare_daffodil_rug');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('5', 'xmas16', '5', 'rare_beehive_bulb');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('6', 'xmas16', '6', 'rare_elephant_statue');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('7', 'xmas16', '7', 'rare_stand');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('8', 'xmas16', '8', 'rare_xmas_screen');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('9', 'xmas16', '9', 'djesko_turntable');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('10', 'xmas16', '10', 'rare_vdoll');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('11', 'xmas16', '11', 'rare_mmmth');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('12', 'xmas16', '12', 'rare_trex');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('13', 'xmas16', '13', 'rare_ironmaiden');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('14', 'xmas16', '14', 'rare_fountain_niko');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('15', 'xmas16', '15', 'rare_dragonlamp_pink');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('16', 'xmas16', '16', 'rare_trex');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('17', 'xmas16', '17', 'rare_elephant_statue');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('18', 'xmas16', '18', 'typingmachine');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('19', 'xmas16', '19', 'rare_dragonlamp_pink');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('20', 'xmas16', '20', 'typingmachine');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('21', 'xmas16', '21', 'throne');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('22', 'xmas16', '22', 'djesko_turntable');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('23', 'xmas16', '23', 'pillow_bronze');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('24', 'xmas16', '24', 'pillow_silver');</p><p>INSERT INTO `campaign_calendar_gifts` VALUES ('25', 'xmas16', '25', '0');</p><p></p><p>[/code]</p><p></p><p>I am shit at tutorials! So if you was unable to follow this or need help just add me on skype StackOverflow-</p><p>I will be more than happy to implement this for you <img src="/styles/default/xenforo/smilies/emojione/tongue.png" class="smilie" loading="lazy" alt=":p" title="Stick Out Tongue :p" data-shortname=":p" /></p></blockquote><p></p>
[QUOTE="Core, post: 392732, member: 72270"] [CENTER][SIZE=6][B][U][COLOR=#ff0000]Stop releasing on other forums and taking credits. This is a release for DevBest. [/COLOR][/U][/B][/SIZE] [B][U][SIZE=6]Habbo Advent Calendar[/SIZE][/U][/B][/CENTER] This is for the Habbo.com's 2016 Advent Calendar. Only difference is that the prizes which are given are not random, it's a fixed prize each day. I done this so it's more fair for users. This release is for the latest production of Habbo.com (12/12/2016 (PRODUCTION-201612121204-107735592)). This is also a very pointless releases as it's 19th December but Habbo has calender's all the time for different things so you will only need to change the event name. Or you could just use the same calendar and just change the text in external flash texts? e.g. "New Year Advent Calendar" xD! However, the structure has remained the same since PRODUCTION-201610312204-296063264 and maybe even before then. It was this build when I first created this so I know for certain it's not changed since then. [IMG]http://image.prntscr.com/image/b4da223d578e44d3a5459545c71a7c62.png[/IMG] [B]I didn't code "Force Open" but if you'd like to the packet id is 2799 and the structure is string, int. The string is the event name (xmas16) and the int is the day id. There is no use in this though and I'm lazy! xD - If you want it just edit the open gift and remove time check and check if user is an admin.[/B] Now you will want to open GameClient.cs and find [code]_habbo.InitProcess();[/code] Above that you want to add [code] if (PlusStaticGameSettings.CampaignCalendarEnabled) SendMessage(new CampaignCalendarDataComposer(_habbo.GetStats().openedGifts)); [/code] You may need to add this at the top of the GameClient.cs [code]using Plus.Communication.Packets.Outgoing.Campaigns;[/code] Next you want to open PlusStaticGameSettings and find [code]public const bool NewUserTutorialBotEnabled = true;[/code] and below that put [code]public const bool CampaignCalendarEnabled = true;[/code] Now you want to create CampaignCalendarDataComposer and put [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Plus.Communication.Packets.Outgoing.Campaigns { class CampaignCalendarDataComposer : ServerPacket { public CampaignCalendarDataComposer(List<int> OpenedGifts) : base(ServerPacketHeader.CampaignCalendarDataMessageComposer) { int currentDate = DateTime.Now.Day - 1; base.WriteString("xmas16"); //eventTrigger base.WriteString(string.Empty); //idk? same as habbo ;P base.WriteInteger(currentDate); //currentDate base.WriteInteger(25); //totalAmountOfDays base.WriteInteger(OpenedGifts.Count); //countOpenGifts foreach (int Opened in OpenedGifts) { base.WriteInteger(Opened); //giftDay } List<int> MissedGifts = Enumerable.Range(0, (currentDate - 2)).Where(Day => !OpenedGifts.Contains(Day)).ToList(); base.WriteInteger(MissedGifts.Count); //countMissedGifts foreach (int Missed in MissedGifts) { base.WriteInteger(Missed); //giftDay } } } } [/code] Next you want to go to ServerPacketHeader.cs and add [code] public const int CampaignCalendarDataMessageComposer = 2740; //updated public const int CampaignCalendarGiftMessageComposer = 163; //updated [/code] Next you want to create an event called OpenCalendarBoxEvent and inside it put [code] using Plus.Communication.Packets.Outgoing.Inventory.Furni; using Plus.Communication.Packets.Outgoing.LandingView; using Plus.Database.Interfaces; using Plus.HabboHotel.Items; using Plus.HabboHotel.Users; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Plus.Communication.Packets.Incoming.LandingView { class OpenCalendarBoxEvent : IPacketEvent { public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { string eventName = Packet.PopString(); int giftDay = Packet.PopInt(); HabboStats habboStats = Session?.GetHabbo()?.GetStats(); int currentDay = DateTime.Now.Day - 1; if (!PlusStaticGameSettings.CampaignCalendarEnabled || habboStats == null || habboStats.openedGifts.Contains(giftDay) || giftDay < (currentDay-2) || giftDay > currentDay || eventName != "xmas16") { return; } Item newItem = null; if(!PlusEnvironment.GetGame().GetLandingManager().GenerateCalendarItem( Session.GetHabbo(), eventName, giftDay, out newItem)) { return; } habboStats.addOpenedGift(giftDay); Session.GetHabbo().GetInventoryComponent().TryAddItem(newItem); Session.SendMessage(new FurniListUpdateComposer()); Session.SendMessage(new CampaignCalendarGiftComposer(newItem.Data.ItemName)); } } } [/code] Go to PacketManager.cs and find [code]this._incomingPackets.Add(ClientPacketHeader.GetPromoArticlesMessageEvent, new GetPromoArticlesEvent());[/code] and then you want to add below this [code]this._incomingPackets.Add(ClientPacketHeader.OpenCalendarBoxMessageEvent, new OpenCalendarBoxEvent());[/code] Then in the same file find [code]this._packetNames.Add(ClientPacketHeader.GetPromoArticlesMessageEvent, "RefreshPromoEvent"); [/code] and below this add [code]this._packetNames.Add(ClientPacketHeader.OpenCalendarBoxMessageEvent, "CampaignCalendarGiftEvent");[/code] Now you want to go to ClientPacketHeader.cs and find [code]public const int UseWallItemMessageEvent = 3940;[/code] Below you want to add [code]public const int OpenCalendarBoxMessageEvent = 693; //updated[/code] Next create a server packet called CampaignCalendarGiftComposer.cs and put [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Plus.Communication.Packets.Outgoing.LandingView { class CampaignCalendarGiftComposer : ServerPacket { public CampaignCalendarGiftComposer(string iconName = "throne") : base(ServerPacketHeader.CampaignCalendarGiftMessageComposer) { base.WriteBoolean(true); // never bothered to check base.WriteString("xmas14_starfish"); //productName base.WriteString(""); //customImage base.WriteString(iconName); //iconName } } } [/code] Second string is xmas14_starfish because doesn't worth if not valid item but it's likely to do with the bool xD I rushed this so didn't bother checking. Still works fine just given gift string is wrong but icon shows as the rare. Next you want to go to LandingViewManager.cs and add the following function (these should be cached but I'm lazy xD and this was done for fun not a public release) [code] public bool GenerateCalendarItem(Habbo Habbo, string eventName, int eventDate, out Item newItem) { newItem = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `item_id` FROM `campaign_calendar_gifts` WHERE `event_name` = @eventName AND `base_id` = @dayId LIMIT 1"); dbClient.AddParameter("eventName", eventName); dbClient.AddParameter("dayId", eventDate); DataRow row = dbClient.getRow(); ItemData itemData = null; if (row?["item_id"] != null && PlusEnvironment.GetGame().GetItemManager().GetItem((string)row["item_id"], out itemData)) { newItem = ItemFactory.CreateSingleItemNullable(itemData, Habbo, "", ""); return newItem != null; } return false; } } [/code] Next you want to open ItemDataManager.cs and find [code]public bool GetItem(int Id, out ItemData Item)[/code] Above that put this [code] public bool GetItem(string itemName, out ItemData item) { item = this._items.Values.Where(x => x.ItemName == itemName).FirstOrDefault(); return item != null; } [/code] Now you want to go to HabboStats.cs and find [code]public int ForumPosts { get; set; }[/code] Then blow that add [code] public List<int> openedGifts { get; private set; } public void addOpenedGift(int eventDate) { if (this.openedGifts.Contains(eventDate)) { return; } this.openedGifts.Add(eventDate); string[] giftData = this.openedGifts.Select(giftDay => giftDay.ToString()).ToArray(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `user_stats` SET `calendar_gifts` = @giftData WHERE `id` = @habboId LIMIT 1"); dbClient.AddParameter("giftData", string.Join(",", giftData)); dbClient.AddParameter("habboId", habboId); dbClient.RunQuery(); } }[/code] Now in the same file fine [code]this.ForumPosts = ForumPosts;[/code] and below that add this [code] this.openedGifts = new List<int>(); foreach (string subStr in openedGifts.Split(',')) { int openedDay = 0; if (int.TryParse(subStr, out openedDay)) { this.openedGifts.Add(openedDay); } } [/code] Then find [code] public HabboStats( [/code] and just before the ) add [code] , string openedGifts [/code] Then go to Habbo.cs and find [code] this._habboStats = new HabboStats( [/code] and once again before the ); add [code]Convert.ToString(StatRow["calendar_gifts"])[/code] You will also need to add (`calendar_gifts`) to the SELECT queries. I can't just page my query as I used this table for several things like nux status, which your table will not contain so will only give you errors. Here is the database [code] /* Navicat MySQL Data Transfer Source Server : local Source Server Version : 50505 Source Host : localhost:3306 Source Database : plus Target Server Type : MYSQL Target Server Version : 50505 File Encoding : 65001 Date: 2016-12-19 18:30:09 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `campaign_calendar_gifts` -- ---------------------------- DROP TABLE IF EXISTS `campaign_calendar_gifts`; CREATE TABLE `campaign_calendar_gifts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_name` varchar(225) NOT NULL, `base_id` int(11) NOT NULL, `item_id` varchar(225) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1; -- ---------------------------- -- Records of campaign_calendar_gifts -- ---------------------------- INSERT INTO `campaign_calendar_gifts` VALUES ('1', 'xmas16', '1', 'throne'); INSERT INTO `campaign_calendar_gifts` VALUES ('2', 'xmas16', '2', 'typingmachine'); INSERT INTO `campaign_calendar_gifts` VALUES ('3', 'xmas16', '3', 'spyro'); INSERT INTO `campaign_calendar_gifts` VALUES ('4', 'xmas16', '4', 'rare_daffodil_rug'); INSERT INTO `campaign_calendar_gifts` VALUES ('5', 'xmas16', '5', 'rare_beehive_bulb'); INSERT INTO `campaign_calendar_gifts` VALUES ('6', 'xmas16', '6', 'rare_elephant_statue'); INSERT INTO `campaign_calendar_gifts` VALUES ('7', 'xmas16', '7', 'rare_stand'); INSERT INTO `campaign_calendar_gifts` VALUES ('8', 'xmas16', '8', 'rare_xmas_screen'); INSERT INTO `campaign_calendar_gifts` VALUES ('9', 'xmas16', '9', 'djesko_turntable'); INSERT INTO `campaign_calendar_gifts` VALUES ('10', 'xmas16', '10', 'rare_vdoll'); INSERT INTO `campaign_calendar_gifts` VALUES ('11', 'xmas16', '11', 'rare_mmmth'); INSERT INTO `campaign_calendar_gifts` VALUES ('12', 'xmas16', '12', 'rare_trex'); INSERT INTO `campaign_calendar_gifts` VALUES ('13', 'xmas16', '13', 'rare_ironmaiden'); INSERT INTO `campaign_calendar_gifts` VALUES ('14', 'xmas16', '14', 'rare_fountain_niko'); INSERT INTO `campaign_calendar_gifts` VALUES ('15', 'xmas16', '15', 'rare_dragonlamp_pink'); INSERT INTO `campaign_calendar_gifts` VALUES ('16', 'xmas16', '16', 'rare_trex'); INSERT INTO `campaign_calendar_gifts` VALUES ('17', 'xmas16', '17', 'rare_elephant_statue'); INSERT INTO `campaign_calendar_gifts` VALUES ('18', 'xmas16', '18', 'typingmachine'); INSERT INTO `campaign_calendar_gifts` VALUES ('19', 'xmas16', '19', 'rare_dragonlamp_pink'); INSERT INTO `campaign_calendar_gifts` VALUES ('20', 'xmas16', '20', 'typingmachine'); INSERT INTO `campaign_calendar_gifts` VALUES ('21', 'xmas16', '21', 'throne'); INSERT INTO `campaign_calendar_gifts` VALUES ('22', 'xmas16', '22', 'djesko_turntable'); INSERT INTO `campaign_calendar_gifts` VALUES ('23', 'xmas16', '23', 'pillow_bronze'); INSERT INTO `campaign_calendar_gifts` VALUES ('24', 'xmas16', '24', 'pillow_silver'); INSERT INTO `campaign_calendar_gifts` VALUES ('25', 'xmas16', '25', '0'); [/code] I am shit at tutorials! So if you was unable to follow this or need help just add me on skype StackOverflow- I will be more than happy to implement this for you :p [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[PlusEMU][Addon] Christmas Calander
Top