Thank you very much'
Printable View
Thank you very much'
thanks chillhabbo.
and I use privilege's packetlogger.
must I find MessageHandler.RegisterUsers();
MessageHandler.RegisterMessenger();
MessageHandler.RegisterCatalog();
MessageHandler.RegisterNavigator();
MessageHandler.RegisterRooms();? and add below that the code of you?
Example
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Uber.Net;
using Uber.Messages;
using Uber.HabboHotel.Users;
using Uber.HabboHotel.Users.Authenticator;
using Uber.HabboHotel.Support;
using Uber.HabboHotel.Misc;
using Uber.Storage;
using Uber.Util;
using Uber.Core;
namespace Uber.HabboHotel.GameClients
{
class GameClient
{
private uint Id;
private TcpConnection Connection;
private GameClientMessageHandler MessageHandler;
private Habbo Habbo;
public Boolean PongOK;
public uint ClientId
{
get
{
return Id;
}
}
public Boolean LoggedIn
{
get
{
if (Habbo == null)
{
return false;
}
return true;
}
}
public GameClient(uint ClientId)
{
Id = ClientId;
Connection = UberEnvironment.GetConnectionManager().GetConnection(ClientId);
MessageHandler = new GameClientMessageHandler(this);
}
public TcpConnection GetConnection()
{
return Connection;
}
public GameClientMessageHandler GetMessageHandler()
{
return MessageHandler;
}
public Habbo GetHabbo()
{
return Habbo;
}
public void StartConnection()
{
if (Connection == null)
{
return;
}
PongOK = true;
MessageHandler.RegisterGlobal();
MessageHandler.RegisterHandshake();
MessageHandler.RegisterHelp();
TcpConnection.RouteReceivedDataCallback DataRouter = new TcpConnection.RouteReceivedDataCallback(HandleConnectionData);
Connection.Start(DataRouter);
}
public void Login(string AuthTicket)
{
try
{
Habbo NewHabbo = Authenticator.TryLoginHabbo(AuthTicket, this);
UberEnvironment.GetGame().GetClientManager().LogClonesOut(NewHabbo.Username);
this.Habbo = NewHabbo;
this.Habbo.LoadData();
}
catch (IncorrectLoginException e)
{
SendNotif("Login error: " + e.Message);
//Logging.LogException(e.ToString());
Disconnect();
return;
}
try
{
UberEnvironment.GetGame().GetBanManager().CheckForBanConflicts(this);
}
catch (ModerationBanException e)
{
SendBanMessage(e.Message);
Disconnect();
return;
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE users SET online = '1', auth_ticket = '', ip_last = '" + GetConnection().ipAddress + "' WHERE id = '" + GetHabbo().Id + "' LIMIT 1;");
dbClient.ExecuteQuery("UPDATE user_info SET login_timestamp = '" + UberEnvironment.GetUnixTimestamp() + "' WHERE user_id = '" + GetHabbo().Id + "' LIMIT 1;");
}
List<string> Rights = UberEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(GetHabbo());
GetMessageHandler().GetResponse().Init(2);
GetMessageHandler().GetResponse().AppendInt32(Rights.Count);
foreach (string Right in Rights)
{
GetMessageHandler().GetResponse().AppendStringWithBreak(Right);
}
GetMessageHandler().SendResponse();
if (GetHabbo().HasFuse("fuse_mod"))
{
SendMessage(UberEnvironment.GetGame().GetModerationTool().SerializeTool());
UberEnvironment.GetGame().GetModerationTool().SendOpenTickets(this);
}
SendMessage(GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());
MessageHandler.GetResponse().Init(290);
MessageHandler.GetResponse().AppendBoolean(true);
MessageHandler.GetResponse().AppendBoolean(false);
MessageHandler.SendResponse();
MessageHandler.GetResponse().Init(3);
MessageHandler.SendResponse();
MessageHandler.GetResponse().Init(517);
MessageHandler.GetResponse().AppendBoolean(true);
MessageHandler.SendResponse();
if (UberEnvironment.GetGame().GetPixelManager().NeedsUpdate(this))
{
UberEnvironment.GetGame().GetPixelManager().GivePixels(this);
}
MessageHandler.GetResponse().Init(455);
MessageHandler.GetResponse().AppendUInt(GetHabbo().HomeRoom);
MessageHandler.SendResponse();
MessageHandler.GetResponse().Init(458);
MessageHandler.GetResponse().AppendInt32(30);
MessageHandler.GetResponse().AppendInt32(GetHabbo().FavoriteRooms.Count);
foreach (uint Id in GetHabbo().FavoriteRooms)
{
MessageHandler.GetResponse().AppendUInt(Id);
}
MessageHandler.SendResponse();
SendNotif("Welcome to Star-City hotel emu by sulake.vg SHJ");
//For club badges
if (GetHabbo().HasFuse("fuse_use_club_badge") && !GetHabbo().GetBadgeComponent().HasBadge("ACH_BasicClub1"))
{
GetHabbo().GetBadgeComponent().GiveBadge("ACH_BasicClub1", true);
}
else if (!GetHabbo().HasFuse("fuse_use_club_badge") && GetHabbo().GetBadgeComponent().HasBadge("ACH_BasicClub1"))
{
GetHabbo().GetBadgeComponent().RemoveBadge("ACH_BasicClub1");
}
if (GetHabbo().GetBadgeComponent().HasBadge("HC1"))
{
GetHabbo().GetBadgeComponent().RemoveBadge("HC1");
}
//For VIP's - Gives VIP badge since I'm lazy and cbf to give it by hand :)
if (GetHabbo().Rank == 2 && !GetHabbo().GetBadgeComponent().HasBadge("VIP"))
{
GetHabbo().GetBadgeComponent().GiveBadge("VIP", true);
SendNotif("Your VIP rights have been received. You now have the BETA badge in your inventory, as well as all the cool VIP rights in-game! Thanks for purchasing VIP!");
}
else if (GetHabbo().Rank < 2 && GetHabbo().GetBadgeComponent().HasBadge("VIP"))
{
GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
}
//For Staff - same structure as VIP
if (GetHabbo().Rank >= 3 && !GetHabbo().GetBadgeComponent().HasBadge("ADM"))
{
GetHabbo().GetBadgeComponent().GiveBadge("ADM", true);
}
else if (GetHabbo().Rank < 3 && GetHabbo().GetBadgeComponent().HasBadge("ADM"))
{
GetHabbo().GetBadgeComponent().RemoveBadge("ADM");
}
//100,000 register badge - inactive now
/*
if (!GetHabbo().GetBadgeComponent().HasBadge("BL1"))
{
GetHabbo().GetBadgeComponent().GiveBadge("BL1", true);
SendNotif("You have received the 100,000 Registrations badge. Check your badges to see more information.");
}
*/
//UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 11, 1);
//Unlocks Respect Achievements
//For users that came before the achievement was added
//Not tested, should work
if (GetHabbo().Respect >= 1)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 1);
if (GetHabbo().Respect >= 10)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 2);
if (GetHabbo().Respect >= 25)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 3);
if (GetHabbo().Respect >= 40)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 4);
if (GetHabbo().Respect >= 60)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 5);
if (GetHabbo().Respect >= 85)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 6);
if (GetHabbo().Respect >= 100)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 7);
if (GetHabbo().Respect >= 150)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 8);
if (GetHabbo().Respect >= 200)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 9);
if (GetHabbo().Respect >= 300)
UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 12, 10);
//if (!GetHabbo().GetBadgeComponent().HasBadge("Z63"))
// GetHabbo().GetBadgeComponent().GiveBadge("Z63", true);
MessageHandler.RegisterUsers();
MessageHandler.RegisterMessenger();
MessageHandler.RegisterCatalog();
MessageHandler.RegisterNavigator();
MessageHandler.RegisterRooms();
MessageHandler.Quests();
}
private void Quests()
{
ServerMessage Message = new ServerMessage(800);
Message.AppendStringWithBreak("FIND_STUFF");
Message.AppendStringWithBreak("throne");
Message.AppendInt32(1);
Message.AppendStringWithBreak("EXTRA01");
this.SendMessage(Message);
}
public void SendBanMessage(string Message)
{
ServerMessage BanMessage = new ServerMessage(35);
BanMessage.AppendStringWithBreak("A moderator has kicked you from the hotel:", 13);
BanMessage.AppendStringWithBreak(Message);
GetConnection().SendMessage(BanMessage);
}
public void SendNotif(string Message)
{
SendNotif(Message, false);
}
public void SendNotif(string Message, Boolean FromHotelManager)
{
ServerMessage nMessage = new ServerMessage();
if (FromHotelManager)
{
nMessage.Init(139);
}
else
{
nMessage.Init(161);
}
nMessage.AppendStringWithBreak(Message);
GetConnection().SendMessage(nMessage);
}
public void SendNotif(string Message, string Url)
{
ServerMessage nMessage = new ServerMessage(161);
nMessage.AppendStringWithBreak(Message);
nMessage.AppendStringWithBreak(Url);
GetConnection().SendMessage(nMessage);
}
public void Stop()
{
if (Connection != null)
Connection.Dispose();
if (GetHabbo() != null)
{
Habbo.OnDisconnect();
Habbo = null;
}
if (GetConnection() != null)
Connection = null;
if (GetMessageHandler() != null)
{
MessageHandler.Destroy();
MessageHandler = null;
}
}
public void Disconnect()
{
UberEnvironment.GetGame().GetClientManager().StopClient(Id);
}
public void HandleConnectionData(ref byte[] data)
{
if (data[0] == 64)
{
int pos = 0;
while (pos < data.Length)
{
try
{
int MessageLength = Base64Encoding.DecodeInt32(new byte[] { data[pos++], data[pos++], data[pos++] });
uint MessageId = Base64Encoding.DecodeUInt32(new byte[] { data[pos++], data[pos++] });
byte[] Content = new byte[MessageLength - 2];
for (int i = 0; i < Content.Length; i++)
{
Content[i] = data[pos++];
}
ClientMessage Message = new ClientMessage(MessageId, Content);
if (MessageHandler == null)
{
return;
}
MessageHandler.HandleRequest(Message);
}
catch (Exception e)
{
Logging.LogException("User DC: " + e.ToString());
Disconnect();
}
}
}
else
{
Connection.SendData(CrossdomainPolicy.GetXmlPolicy());
Connection.Dispose();
}
}
public void SendMessage(ServerMessage Message)
{
if (Message == null)
{
return;
}
GetConnection().SendMessage(Message);
}
}
}
^^ thanks above, but I overreaded some needed texts:$
I tried to insert it into the server as you said SpazzEmu but nothing has changed when I click on missions nothing appears.
Same problem. I dunno why but it isn't working.
For starters you're registering the wrong packet header. Second issue is the fact that the quest packets appear to have changed for the latest SWF release (so using this with your current r63 will just error you), which I have just taken a look at and guess what - They've changed the way they protect their SWFs, so it'll probably be a while before anyone figures out what's changed because the old communication file is now blank.
Thanks Sojobo, can you tell me the right packet header?
RequestHandlers[3102] = new RequestHandler(ShowQuests);
nanananana ^^
check this
down of MessageHandler.RegisterUsers(); .. MessageHandler.RegisterRooms();
add
MessageHandler.GetResponse().Init(800);
MessageHandler.GetResponse().AppendStringWithBreak("val11");
MessageHandler.GetResponse().AppendStringWithBreak("JISjKFIND_STUFF");
MessageHandler.GetResponse().AppendStringWithBreak("bling_chair_c");
MessageHandler.GetResponse().AppendStringWithBreak("QA1296543600000");
MessageHandler.GetResponse().AppendStringWithBreak("EXTRA01");
MessageHandler.GetResponse().AppendStringWithBreak("");
MessageHandler.SendResponse();
check EXTRA02... :) and check 1296543600000 is the time of event change to 1296543700000 (1 second more)
and change bling_chair_c to other furni... :D
Hope this goes well (:
my last code works fine.. the others codes not..
GameClient.cs
file.csPHP Code:public void Login(string AuthTicket)
{
//...
MessageHandler.RegisterUsers();
MessageHandler.RegisterMessenger();
MessageHandler.RegisterCatalog();
MessageHandler.RegisterNavigator();
MessageHandler.RegisterRooms();
MessageHandler.RegisterQuests();
//..
}
PHP Code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Uber.Messages
{
partial class GameClientMessageHandler
{
private void Initialize()
{
ServerMessage Message = new ServerMessage(800);
Message.AppendStringWithBreak("val11");
Message.AppendStringWithBreak("JISjKFIND_STUFF");
Message.AppendStringWithBreak("bling_chair_c");
Message.AppendStringWithBreak("QA1296543600000");
Message.AppendStringWithBreak("EXTRA01");
Message.AppendStringWithBreak("");
Session.SendMessage(Message);
}
public void RegisterQuests()
{
RequestHandlers[3102] = new RequestHandler(Initialize);
}
}
}
Woah, Nice Post :)
I have a little problem with this: RequestHandlers[3102] = new RequestHandler(Initialize); .
capostrike93 help me
The last packetlog of the quest :
L`val11JJSjIFIND_STUFFbling_chair_cQA1296540000000EXTRA01PkHFIND_STUFFval_table1QA1296626400000EXTRA02