(Fix) Plus Edit - Pets DC (Fix)

Hangout

Member
Nov 11, 2011
118
7
Place pets in the room :)

Go to Messages -> Requests -> Rooms.cs.
Find:
Code:
internal void PlacePet()
Replace:
Code:
internal void PlacePet() //colocar pet
{
Room Room = SilverwaveEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

if (Room == null || (Room.AllowPets == 0 && !Room.CheckRights(Session, true)) || !Room.CheckRights(Session, true))
{
return;
}

uint PetId = Request.PopWiredUInt();

Pet Pet = Session.GetHabbo().GetInventoryComponent().GetPet(PetId);

if (Pet == null || Pet.PlacedInRoom)
{
return;
}

int X = Request.PopWiredInt32();
int Y = Request.PopWiredInt32();

if (!Room.GetGameMap().CanWalk(X, Y, false))
{
return;
}


using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE bots SET room_id = '" + Room.RoomId + "', x = '" + X + "', y = '" + Y + "' WHERE id = '" + PetId + "'");
}

Pet.PlacedInRoom = true;
Pet.RoomId = Room.RoomId;

List<RandomSpeech> RndSpeechList = new List<RandomSpeech>();
List<BotResponse> BotResponse = new List<Silverwave.HabboHotel.RoomBots.BotResponse>();
RoomUser PetUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Pet.PetId, Convert.ToUInt32(Pet.OwnerId), Pet.RoomId, AIType.Pet, "freeroam", Pet.Name, "", Pet.Look, X, Y, 0, 0, 0, 0, 0, 0, ref RndSpeechList, ref BotResponse, "", 0), Pet);

Session.GetHabbo().GetInventoryComponent().MovePetToRoom(Pet.PetId);

if (Pet.DBState != DatabaseUpdateState.NeedsInsert)
Pet.DBState = DatabaseUpdateState.NeedsUpdate;

using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
Room.GetRoomUserManager().SavePets(dbClient);

Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializePetInventory());

}
Find:
Code:
dbClient.setQuery("SELECT * FROM bots WHERE room_id = " + RoomId);
Replace:
Code:
dbClient.setQuery("SELECT * FROM bots WHERE room_id = " + RoomId + " AND ai_type = 'generic'");
Go to HabboHotel -> Rooms -> RoomUser.cs
Find:
Code:
internal void Serialize(ServerMessage Message, bool gotPublicRoom)
Replace:
Code:
internal void Serialize(ServerMessage Message, bool gotPublicRoom)
{
if (Message == null)
return;

if (IsSpectator)
return;

if (IsBot)
{
Message.AppendInt32(BotAI.BaseId);
Message.AppendString(BotData.Name);
Message.AppendString(BotData.Motto);
if (BotData.AiType == AIType.Pet)
if (PetData.HaveSaddle == Convert.ToBoolean(2))
{
Message.AppendString(string.Concat(new object[] { this.BotData.Look.ToLower(), " 3 4 10 0 2 ", this.PetData.PetHair, " ", this.PetData.HairDye, " 3 ", this.PetData.PetHair, " ", this.PetData.HairDye }));
}
else if (PetData.HaveSaddle == Convert.ToBoolean(1))
{
Message.AppendString(string.Concat(new object[] { this.BotData.Look.ToLower(), " 3 2 ", this.PetData.PetHair, " ", this.PetData.HairDye, " 3 ", this.PetData.PetHair, " ", this.PetData.HairDye, " 4 9 0" }));
}
else
{
Message.AppendString(string.Concat(new object[] { this.BotData.Look.ToLower(), " 2 2 ", this.PetData.PetHair, " ", this.PetData.HairDye, " 3 ", this.PetData.PetHair, " ", this.PetData.HairDye }));
}

//Message.AppendString(BotData.Look.ToLower() + ((PetData.HaveSaddle) ? " 3 2 " + PetData.PetHair + " " + PetData.HairDye + " 3 " + PetData.PetHair + " " + PetData.HairDye + " 4 9 0" : " 2 2 " + PetData.PetHair + " " + PetData.HairDye + " 3 " + PetData.PetHair + " " + PetData.HairDye + ""));
else
Message.AppendString(BotData.Look.ToLower());
Message.AppendInt32(VirtualId);
Message.AppendInt32(X);
Message.AppendInt32(Y);
Message.AppendString(TextHandling.GetString(Z));
Message.AppendInt32(0);
Message.AppendInt32((BotData.AiType == AIType.Generic) ? 4 : 2);

if (BotData.AiType == AIType.Pet)
{

Message.AppendInt32(PetData.Type);
Message.AppendInt32(PetData.OwnerId); // userid
Message.AppendString(PetData.OwnerName); // username
Message.AppendInt32(1);
Message.AppendBoolean(PetData.HaveSaddle);
Message.AppendBoolean(RidingHorse);
Message.AppendInt32(0);
Message.AppendInt32(0);
Message.AppendString("");
}
else
{
Message.AppendString(BotData.Gender.ToLower()); // ?
Message.AppendInt32(BotData.OwnerId); // ?
Message.AppendString(SilverwaveEnvironment.GetGame().GetClientManager().GetNameById(BotData.OwnerId)); // Owner name
Message.AppendInt32(4);
Message.AppendShort(1);
Message.AppendShort(2);
Message.AppendShort(5);
Message.AppendShort(4);
}
}
else if (!IsBot && GetClient() != null && GetClient().GetHabbo() != null)
{
Group Group = SilverwaveEnvironment.GetGame().GetGroupManager().GetGroup(GetClient().GetHabbo().FavouriteGroup);

Users.Habbo User = GetClient().GetHabbo();
Message.AppendInt32(User.Id);
Message.AppendString(User.Username);
Message.AppendString(User.Motto);
Message.AppendString(User.Look);
Message.AppendInt32(VirtualId);
Message.AppendInt32(X);
Message.AppendInt32(Y);
Message.AppendString(TextHandling.GetString(Z));
Message.AppendInt32(0);
Message.AppendInt32(1);
Message.AppendString(User.Gender.ToLower());
if (Group != null)
{
Message.AppendInt32(Group.Id);
Message.AppendInt32(0);
Message.AppendString(Group.Name);
}
else
{
Message.AppendInt32(0);
Message.AppendInt32(0);
Message.AppendString("");
}
Message.AppendString("");
//Message.AppendBoolean(false);
Message.AppendInt32(User.ActivityPoints);
Message.AppendBoolean(false);
//Message.AppendBoolean(true);

/*if (gotPublicRoom)
Message.AppendString("ch=s01/250,56,49");
else
Message.AppendString(string.Empty);
*/

}
}

Find CheckPetNameMessageEvent = and change it to public const int CheckPetNameMessageEvent = 3913; //akl
Find GetSellablePetBreedsMessageEvent = and change it to public const int GetSellablePetBreedsMessageEvent = 3780; //akl


Headers by Bloodraven

Credits to : from RZ
 

Users who are viewing this thread

Top