Swift Emulator fixes.

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Hai,

I recently released some fixes on another forum so I thought I'd release them here too for people who do not use the other forum.

Emulator: Swift Emulator
Revision: RELEASE63-201302211227-19310969

Change game port:
This fix is only for running more than one instance of this emulator on the same machine server times.

Do the following:

Add the following line to your configuration.ini file:
Code:
data.socket.port=PORT INTEGER HERE
Search for the following in the emulator:
PHP:
DataSocket.SetupListener(42);
Note, it may not be 42, it may be the hexadecimal value '0x2a', which would be:
PHP:
DataSocket.SetupListener(0x2a);
Replace it with:
PHP:
DataSocket.SetupListener(int.Parse(ButterflyEnvironment.GetConfig().data["data.socket.port"]));
Profiles fix (Load registration via users table/on login):
Profiles do work, your error is probably due to not having `users_info` or `user_info` table (I forgot which as I've changed this), I've made mine check via the users registration timestamp from `users` table, if you'd like to do this then do the following:

(Note: there is two ways to this, one a simple query (loads each time profile is opened) or do it on user login, like I have below):

Find the following in GameClinetMessageHandler:
PHP:
internal void LoadProfile()

Remove the following:
PHP:
DataRow Info;
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT `reg_timestamp` FROM `user_info` WHERE user_id = '" + habbo.Id + "'");
Info = adapter.getRow();
}
And further down (in the same void) remove this:
PHP:
this.Response.AppendString(UnixTimeStampToDateTime((double)Info["reg_timestamp"]).ToShortDateString());
Replace it with:
PHP:
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime regdate = origin.AddSeconds(Convert.ToDouble(habbo.regTimestamp));
this.Response.AppendString(regdate.ToString("dd/MM/yyyy"));
You will have an error, this is where the next step comes in, find the following in Habbo.cs:
PHP:
internal string LastOnline;
Add below or above it:
PHP:
internal string regTimestamp;
In the same file find:
PHP:
internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int Crystals, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, int achievementPoints, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
Replace with:
PHP:
internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int Crystals, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, int achievementPoints, string regTimestamp, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
In the same file/void find:
PHP:
this.LastOnline = DateTime.Now.ToString();
Add above or below it:
PHP:
this.regTimestamp = DateTime.Now.ToString();

Next in HabboFactoy.cs find:
PHP:
string lastOnline = (string)dRow["last_online"];
Add above or below it:
PHP:
string regTimestamp = (string)dRow["account_created"];

In the same file find: 'lastOnline', add next to it 'regTimestamp,'.

And that should tackle that.
Game Center updated packets and adding the disabled packet:
I haven't really finished this as I'm about to do something else so I will update you later, but I've updated some packets and added the game center disabled packet to the handler, here we go!

Incoming.cs:
(I'm not going to show what to replace, but they're all located in a similar place).

PHP:
Incoming.GetGames = 892;// 2498;
Incoming.GetGame = 1215;// 39;
Incoming.Game2LeaveGameMessageComposer = 850;// 42;
Incoming.Game2GameChatMessageComposer = 2113;// 1462;
Incoming.Game2SetUserMoveTargetMessageComposer = 1835;// 1630;
Incoming.Game2LoadStageReadyMessageComposer = 3770;// 270;
Incoming.GameCenterEnabled = 13;//Not sure of previous.

In the same file search for:
PHP:
public static int Game2SetUserMoveTargetMessageComposer;

And add under it:
PHP:
public static int GameCenterEnabled;

Outgoing.cs:
(Again, I'm not going to show what to replace as I've lost that now).

PHP:
Outgoing.GetRankInGame = 1563;// 1414;
Outgoing.CreateWar = 1519;// 2737; // I think this one is wrong - Sledmore
Outgoing.AddToNewGame = 3849;// 2200;
Outgoing.LeaveGame = 3757;// 3543;
Outgoing.StartCounter = 430;// 2155;
Outgoing.SetStep1 = 2656;// 3828;
Outgoing.Game2EnterArenaMessageEvent = 1864;// 811;
Outgoing.Game2ArenaEnteredMessageEvent = 133;// 2312;
Outgoing.Game2StageStillLoadingMessageEvent = 1283;// 1048;
Outgoing.Game2StageLoadMessageEvent = 2502;// 1125;
Outgoing.Game2StageStartingMessageEvent = 2900;// 2942;
Outgoing.Game2GameChatFromPlayerMessageEvent = 1577;// 483;
Outgoing.Game2StageRunningMessageEvent = 1184;// 2975;
Outgoing.Game2PlayerExitedGameArenaMessageEvent = 1956;// 2050;
Outgoing.Game2GameStatusMessageEvent = 2352;// 275;

Now to add the new packet to the handler..

Find the following in StaticClientMessageHandler:
PHP:
handlers.Add(Incoming.GetRelationshipsProfile, new StaticRequestHandler(SharedPacketLib.GetRelationshipsProfile));

Add under it:
PHP:
handlers.Add(Incoming.GameCenterEnabled, new StaticRequestHandler(SharedPacketLib.GameCenterEnabled));

Next, in SharedPacketLib.cs find the following:
PHP:
public static void EventTracker(GameClientMessageHandler handler)

Add under it:
PHP:
public static void GameCenterEnabled(GameClientMessageHandler handler)
{
handler.GameCenterEnabled();
}

Next in GameClientMessageHandler.cs find:
PHP:
internal void Whisper()

And UNDER THAT VOID:
PHP:
internal void GameCenterEnabled()
{
Session.SendNotif("Game Center is currently not enabled!");
}

And that should be it, if I've missed anything or broken anything at your end please let me know, haha this all works for me, but I've not saved the previous work so I may have miss-placed something for you.

Oh and just a quick tip; if you do want the Game Center make sure to have this in your variables:
Code:
game.center.enabled=true
if you set it to false the new packet we added to the handler will display! :)

I'll update this thread with other fixes I make, but sometime soon I'm going to just update to another revision anyway.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Finally. I hope your other thread is already on the planning to show up... keep on going Craig.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Pftt, releasing them on another forum first. Who do you think you are

Don't want no Habbo hype around here no more, we are trying to move on to a gaming forum!

Thanks for the release!

You're welcome :).

Finally. I hope your other thread is already on the planning to show up... keep on going Craig.

I don't think it will (from the recent chat on in the Skype group), but thanks :D.

This is one good released. Thx

Thanks :D!
--
I'll most likely release more later, did some work on Achievements, fixed most of the Achievements (just updating packet structure and the packets), but I've ended up looking at other stuffs; I've re-done how the groups are (not a whole lot but for the database) and I've also been limiting how much data is pulled each time (as the queries are ridiculous).
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Sledmore can you release a fixed swift emulator?
Maybe not sure, as I've done a lot of work for some other hotel.
howcome when i debug an save it still hasn't saved?
No idea, did you open the project?
--
So I've done a lot of fixes, I can't even count, I've fixed promotions, Achievements, Wired, recoded Relationships, recoded Groups and a lot more.

Here is a nice little fix for Wired deleting each time you move it:

Search for 'internal void MoveItem()' (GameClientMessageHandler.cs):

Find the following:

PHP:
if (item.wiredHandler != null)
{
using (adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
item.wiredHandler.DeleteFromDatabase(adapter);
item.wiredHandler.Dispose();
room.GetWiredHandler().RemoveFurniture(item);
}
item.wiredHandler = null;
}
if (item.wiredCondition != null)
{
using (adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
item.wiredCondition.DeleteFromDatabase(adapter);
item.wiredCondition.Dispose();
room.GetWiredHandler().conditionHandler.ClearTile(item.Coordinate);
}
item.wiredCondition = null;
}

Remove it, or comment it - up to you, debug and see the changes.
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
Maybe not sure, as I've done a lot of work for some other hotel.

No idea, did you open the project?
--
So I've done a lot of fixes, I can't even count, I've fixed promotions, Achievements, Wired, recoded Relationships, recoded Groups and a lot more.

Here is a nice little fix for Wired deleting each time you move it:

Search for 'internal void MoveItem()' (GameClientMessageHandler.cs):

Find the following:

PHP:
if (item.wiredHandler != null)
{
using (adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
item.wiredHandler.DeleteFromDatabase(adapter);
item.wiredHandler.Dispose();
room.GetWiredHandler().RemoveFurniture(item);
}
item.wiredHandler = null;
}
if (item.wiredCondition != null)
{
using (adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
item.wiredCondition.DeleteFromDatabase(adapter);
item.wiredCondition.Dispose();
room.GetWiredHandler().conditionHandler.ClearTile(item.Coordinate);
}
item.wiredCondition = null;
}

Remove it, or comment it - up to you, debug and see the changes.

ive fixed it, but mind releasing the other fixes :p
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Where can we found the : RELEASE63-201302211227-19310969
Google, I guess.
--
Here is a nice fix for effects, the packet structure had changed.
  1. Open up the emulator.
  2. Go to AvatarEffectsInventoryComponent.cs
  3. Find 'internal ServerMessage Serialize()'
  4. Under 'message.AppendInt32(effect.EffectId);'
  5. Add 'message.AppendInt32(1);'.
  6. Debug the emulator.
Also, you should change how you serialize the effects inventory. If you want to, do the following:
  1. Go to GameClientMessageHandler.cs
  2. Find 'internal void GetWardrobe()'
  3. Remove 'Session.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize();'
  4. Next go to GameClient.cs
  5. Find 'ServerMessage message7 = new ServerMessage(Outgoing.bools1);'
  6. Just above it add the following: 'SendMessage(GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());'.
Totally up to you.
 

Innorman

New Member
Feb 20, 2012
9
0
Google, I guess.
--
Here is a nice fix for effects, the packet structure had changed.
  1. Open up the emulator.
  2. Go to AvatarEffectsInventoryComponent.cs
  3. Find 'internal ServerMessage Serialize()'
  4. Under 'message.AppendInt32(effect.EffectId);'
  5. Add 'message.AppendInt32(1);'.
  6. Debug the emulator.
Also, you should change how you serialize the effects inventory. If you want to, do the following:
  1. Go to GameClientMessageHandler.cs
  2. Find 'internal void GetWardrobe()'
  3. Remove 'Session.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize();'
  4. Next go to GameClient.cs
  5. Find 'ServerMessage message7 = new ServerMessage(Outgoing.bools1);'
  6. Just above it add the following: 'SendMessage(GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());'.
Totally up to you.

This is the reason why I answer this release ... Look :

You must be registered for see images attach
 

Nate Curry

New Member
Oct 3, 2011
13
0
Hai,

I recently released some fixes on another forum so I thought I'd release them here too for people who do not use the other forum.

Emulator: Swift Emulator
Revision: RELEASE63-201302211227-19310969

Change game port:
This fix is only for running more than one instance of this emulator on the same machine server times.

Do the following:

Add the following line to your configuration.ini file:
Code:
data.socket.port=PORT INTEGER HERE
Search for the following in the emulator:
PHP:
DataSocket.SetupListener(42);
Note, it may not be 42, it may be the hexadecimal value '0x2a', which would be:
PHP:
DataSocket.SetupListener(0x2a);
Replace it with:
PHP:
DataSocket.SetupListener(int.Parse(ButterflyEnvironment.GetConfig().data["data.socket.port"]));
Profiles fix (Load registration via users table/on login):
Profiles do work, your error is probably due to not having `users_info` or `user_info` table (I forgot which as I've changed this), I've made mine check via the users registration timestamp from `users` table, if you'd like to do this then do the following:

(Note: there is two ways to this, one a simple query (loads each time profile is opened) or do it on user login, like I have below):

Find the following in GameClinetMessageHandler:
PHP:
internal void LoadProfile()

Remove the following:
PHP:
DataRow Info;
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT `reg_timestamp` FROM `user_info` WHERE user_id = '" + habbo.Id + "'");
Info = adapter.getRow();
}
And further down (in the same void) remove this:
PHP:
this.Response.AppendString(UnixTimeStampToDateTime((double)Info["reg_timestamp"]).ToShortDateString());
Replace it with:
PHP:
DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime regdate = origin.AddSeconds(Convert.ToDouble(habbo.regTimestamp));
this.Response.AppendString(regdate.ToString("dd/MM/yyyy"));
You will have an error, this is where the next step comes in, find the following in Habbo.cs:
PHP:
internal string LastOnline;
Add below or above it:
PHP:
internal string regTimestamp;
In the same file find:
PHP:
internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int Crystals, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, int achievementPoints, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
Replace with:
PHP:
internal Habbo(uint Id, string Username, string RealName, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int Crystals, double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, bool MutantPenalty, bool HasFriendRequestsDisabled, int achievementPoints, string regTimestamp, string LastOnline, string quests, string queststates, bool canchangename, int favoriteGroup, bool PassedQuiz, int pointsOnline)
In the same file/void find:
PHP:
this.LastOnline = DateTime.Now.ToString();
Add above or below it:
PHP:
this.regTimestamp = DateTime.Now.ToString();

Next in HabboFactoy.cs find:
PHP:
string lastOnline = (string)dRow["last_online"];
Add above or below it:
PHP:
string regTimestamp = (string)dRow["account_created"];

In the same file find: 'lastOnline', add next to it 'regTimestamp,'.

And that should tackle that.
Game Center updated packets and adding the disabled packet:
I haven't really finished this as I'm about to do something else so I will update you later, but I've updated some packets and added the game center disabled packet to the handler, here we go!

Incoming.cs:
(I'm not going to show what to replace, but they're all located in a similar place).

PHP:
Incoming.GetGames = 892;// 2498;
Incoming.GetGame = 1215;// 39;
Incoming.Game2LeaveGameMessageComposer = 850;// 42;
Incoming.Game2GameChatMessageComposer = 2113;// 1462;
Incoming.Game2SetUserMoveTargetMessageComposer = 1835;// 1630;
Incoming.Game2LoadStageReadyMessageComposer = 3770;// 270;
Incoming.GameCenterEnabled = 13;//Not sure of previous.

In the same file search for:
PHP:
public static int Game2SetUserMoveTargetMessageComposer;

And add under it:
PHP:
public static int GameCenterEnabled;

Outgoing.cs:
(Again, I'm not going to show what to replace as I've lost that now).

PHP:
Outgoing.GetRankInGame = 1563;// 1414;
Outgoing.CreateWar = 1519;// 2737; // I think this one is wrong - Sledmore
Outgoing.AddToNewGame = 3849;// 2200;
Outgoing.LeaveGame = 3757;// 3543;
Outgoing.StartCounter = 430;// 2155;
Outgoing.SetStep1 = 2656;// 3828;
Outgoing.Game2EnterArenaMessageEvent = 1864;// 811;
Outgoing.Game2ArenaEnteredMessageEvent = 133;// 2312;
Outgoing.Game2StageStillLoadingMessageEvent = 1283;// 1048;
Outgoing.Game2StageLoadMessageEvent = 2502;// 1125;
Outgoing.Game2StageStartingMessageEvent = 2900;// 2942;
Outgoing.Game2GameChatFromPlayerMessageEvent = 1577;// 483;
Outgoing.Game2StageRunningMessageEvent = 1184;// 2975;
Outgoing.Game2PlayerExitedGameArenaMessageEvent = 1956;// 2050;
Outgoing.Game2GameStatusMessageEvent = 2352;// 275;

Now to add the new packet to the handler..

Find the following in StaticClientMessageHandler:
PHP:
handlers.Add(Incoming.GetRelationshipsProfile, new StaticRequestHandler(SharedPacketLib.GetRelationshipsProfile));

Add under it:
PHP:
handlers.Add(Incoming.GameCenterEnabled, new StaticRequestHandler(SharedPacketLib.GameCenterEnabled));

Next, in SharedPacketLib.cs find the following:
PHP:
public static void EventTracker(GameClientMessageHandler handler)

Add under it:
PHP:
public static void GameCenterEnabled(GameClientMessageHandler handler)
{
handler.GameCenterEnabled();
}

Next in GameClientMessageHandler.cs find:
PHP:
internal void Whisper()

And UNDER THAT VOID:
PHP:
internal void GameCenterEnabled()
{
Session.SendNotif("Game Center is currently not enabled!");
}

And that should be it, if I've missed anything or broken anything at your end please let me know, haha this all works for me, but I've not saved the previous work so I may have miss-placed something for you.

Oh and just a quick tip; if you do want the Game Center make sure to have this in your variables:
Code:
game.center.enabled=true
if you set it to false the new packet we added to the handler will display! :)

I'll update this thread with other fixes I make, but sometime soon I'm going to just update to another revision anyway.
How can you fix the rooms not creating?
 

Users who are viewing this thread

Top