Hello, long time no releases so it's time.
This release is applicable for any R63B release. This is the proper solution for it as I actually handled the missing packets. I will provide the packet headers for the following releases: Swift Emulator, Revision 5 and Plus Emulator, Skybird, any other plus edit.
1) In your external variable find the following lines and replace as it's set here:
landing.view.dynamic.slot.2.widget=promoarticle
landing.view.dynamic.slot.2.layout=
landing.view.dynamic.slot.2.conf=
2) Run the following MySQL script:
Code:
Source Server : weblink
Source Server Version : 50141
Source Host : localhost:3306
Source Database : lannok
Target Server Type : MYSQL
Target Server Version : 50141
File Encoding : 65001
Date: 2013-11-17 12:05:01
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `hotelview_promos`
-- ----------------------------
DROP TABLE IF EXISTS `hotelview_promos`;
CREATE TABLE `hotelview_promos` (
`index` int(10) unsigned NOT NULL AUTO_INCREMENT,
`header` varchar(255) NOT NULL DEFAULT '[Header Name]',
`body` varchar(255) NOT NULL DEFAULT '[BODY]',
`button` varchar(255) NOT NULL DEFAULT '[BUTTON]',
`in_game_promo` enum('0','1') NOT NULL DEFAULT '1',
`special_action` varchar(255) NOT NULL DEFAULT '[LINK HERE]',
`image` varchar(255) NOT NULL DEFAULT '',
`enabled` enum('0','1') NOT NULL DEFAULT '1',
PRIMARY KEY (`index`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records of hotelview_promos
-- ----------------------------
INSERT INTO hotelview_promos VALUES ('1', 'Was it crashing ?', 'Long time no fixes, so I hope you enjoy it. Find more at forum.ragezone.com', 'Go to RaGEZONE', '0', 'http://forum.ragezone.com/f282/', 'web_promo_small/meter_level_3_NY2013Resolution.png', '1');INSERT INTO hotelview_promos VALUES ('2', '${landing.view.hween13furni1.header}', '${landing.view.hween13furni1.body}', '${landing.view.hween13furni1.button}', '1', 'catalog/open/frightfulfurni', 'web_promo_small/habboween_furni_smallpromo.gif', '1');
3) Go to Messages\Requests\Navigator.cs
Code:
internal void RefreshPromoEvent() {
if (Session == null || Session.GetHabbo() == null)
{
return;
}
HotelView currentView = SilverwaveEnvironment.GetGame().GetHotelView();
if (!(currentView.HotelViewPromosIndexers.Count > 0))
return;
else
{
ServerMessage Message = currentView.SmallPromoComposer(new ServerMessage(Outgoing.SmallPromoComposer));
this.Session.SendMessage(Message);
}
}
You may need to change SilverwaveEnvironment to your current sever environment.
Next, go to your Outgoing headers class definitions. Outgoing.cs or Composer.cs
mostly. Add the following header:
PHP Code:
internal static int SmallPromoComposer = 949; //ak
Next, go to HabboHotel > Navigators > Create the file HotelView.cs and replace with the following.
Notice that you will need to change the 'Silverwave' to match your emulator environment again.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using HabboEncryption;
using Silverwave.Messages.Headers;
using Silverwave.Messages.ClientMessages;
using Silverwave.Core;
using Silverwave.Messages;
using ConnectionManager;
using Database_Manager.Database.Session_Details.Interfaces;
using System.Threading;
using Silverwave.HabboHotel.Users.Messenger;
namespace Silverwave.HabboHotel.Navigators
{
public class HotelView
{
internal List<SmallPromo> HotelViewPromosIndexers = new List<SmallPromo>();
public HotelView()
{
this.list();
}
private void list()
{
DataTable dTable;
using (IQueryAdapter DbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
DbClient.setQuery("SELECT * from hotelview_promos WHERE hotelview_promos.enabled = '1' ORDER BY hotelview_promos.`index` ASC");
dTable = DbClient.getTable();
}
foreach (DataRow dRow in dTable.Rows)
{
HotelViewPromosIndexers.Add(new SmallPromo(Convert.ToInt32(dRow[0]), (string)dRow[1], (string)dRow[2], (string)dRow[3], Convert.ToInt32(dRow[4]), (string)dRow[5], (string)dRow[6]));
}
}
public void RefreshPromoList()
{
HotelViewPromosIndexers.Clear();
this.list();
}
internal ServerMessage SmallPromoComposer(ServerMessage Message)
{
Message.AppendInt32(HotelViewPromosIndexers.Count);
foreach (SmallPromo promo in HotelViewPromosIndexers)
{
promo.Serialize(Message);
}
return Message;
}
public static SmallPromo load(int index)
{
DataRow dRow;
using (IQueryAdapter DbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
DbClient.setQuery("SELECT hotelview_promos.`index`,hotelview_promos.header,hotelview_promos.body,hotelview_promos.button,hotelview_promos.in_game_promo,hotelview_promos.special_action," +
"hotelview_promos.image,hotelview_promos.enabled FROM hotelview_promos WHERE hotelview_promos.`index` = @x LIMIT 1");
DbClient.addParameter("x", index);
dRow = DbClient.getRow();
}
SmallPromo newPromo = new SmallPromo(index, (string)dRow[1], (string)dRow[2], (string)dRow[3], Convert.ToInt32(dRow[4]), (string)dRow[5], (string)dRow[6]);
return newPromo;
}
}
public class SmallPromo
{
int Index;
string Header;
string Body;
string Button;
int inGamePromo;
string SpecialAction;
string Image;
public SmallPromo(int index, string header, string body,string button, int inGame, string specialAction, string image)
{
this.Index = index;
this.Header = header;
this.Body = body;
this.Button = button;
this.inGamePromo = inGame;
this.SpecialAction = specialAction;
this.Image = image;
}
internal ServerMessage Serialize(ServerMessage Composer)
{
Composer.AppendInt32(Index);
Composer.AppendString(Header);
Composer.AppendString(Body);
Composer.AppendString(Button);
Composer.AppendInt32(inGamePromo);
Composer.AppendString(SpecialAction);
Composer.AppendString(Image);
return Composer;
}
}
}
Next go to Game.cs.
Add the following (make sure you add it in the right places):
PHP Code:
private HotelView HotelView;
below
PHP Code:
private RoomManager RoomManager;
and the following methods in the proper places:
Add
PHP Code:
private HotelView HotelView;
below
PHP Code:
private RoomManager RoomManager;
Add: (below any other which looks like that)
Code:
internal HotelView GetHotelView()
{return HotelView;
}
Code:
HotelView = new HotelView(); //below PixelManager = new PixelManager();
Finally, go to your
Incoming packets class. Namely, Incoming.cs or Events.cs ( don't mess with the Rooms>Events . It's not this. )
Add the following:
PHP Code:
internal static int RefreshPromoEvent = 1946; //ak
Go to
SharedPacketLib.cs and add:
Code:
internal static void RefreshPromoEvent(GameClientMessageHandler handler) {
handler.RefreshPromoEvent();
}
Go to
StaticClientMessageHandler.cs and add:
PHP Code:
handlers.Add(Incoming.RefreshPromoEvent, new StaticRequestHandler(SharedPacketLib.RefreshPromoEvent));
below any other handler.
4) Compile it, and that's what you should have:
PS: I may post a quick guide about how to use the Small Promos widget later, if anyone else does so.