foreach (string Keyword in Keywords.Split(';'))
{
this.Keywords.Add(Keyword.ToLower());
}
}
internal bool KeywordMatched(string Message)
{
foreach (string Keyword in Keywords)
{
if (Message.ToLower().Contains(Keyword.ToLower()))
{
return true;
}
}
return false;
}
}
}
Next, replace GenerciBot.cs with this;
Spoiler:
Code:
using System;
using Mercury.Core;
using Mercury.HabboHotel.Pathfinding;
using Mercury.HabboHotel.Rooms;
using Mercury.Messages;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using Mercury.Messages.Headers;
using Mercury;
using Database_Manager.Database;
using Database_Manager.Database.Session_Details.Interfaces;
namespace Mercury.HabboHotel.RoomBots
{
class GenericBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int speechDelta;
private bool canSpeak;
private int nextAction;
private int virtualId;
internal GenericBot(int VirtualId, int BotId)
{
int speechInterval = 7;
using (IQueryAdapter adapter = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT speaking_interval from bots WHERE id = " + BotId);
speechInterval = adapter.getInteger();
adapter.setQuery("SELECT automatic_chat from bots WHERE id = " + BotId);
canSpeak = Convert.ToBoolean(adapter.getString());
}
internal override void OnTimerTick()
{
if (base.GetBotData() != null)
{
if (this.SpeechTimer <= 0)
{
if (base.GetBotData().RandomSpeech.Count > 0)
{
if (canSpeak)
{
RandomSpeech randomSpeech = base.GetBotData().GetRandomSpeech();
base.GetRoomUser().Chat(null, randomSpeech.Message, randomSpeech.Shout, 0, 0);
}
}
this.SpeechTimer = speechDelta;
}
else
{
this.SpeechTimer--;
}
if (this.nextAction > 0)
{
this.nextAction--;
}
else
{
List<Point> list = base.GetRoom().GetGameMap().getWalkableList();
if (list.Count == 0)
return;
int randomNumber = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(0, list.Count - 1);
switch (base.GetBotData().WalkingMode.ToLower())
{
case "freeroam":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
case "specified_range":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
}
this.nextAction = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(15, 30);
}
}
}
}
}
Next, replace PetBot.cs with this;
Spoiler:
Code:
using Mercury.Core;
using Mercury.HabboHotel.GameClients;
using Database_Manager.Database.Session_Details.Interfaces;
using Mercury.HabboHotel.PathFinding;
using Mercury.HabboHotel.Pets;
using Mercury.HabboHotel.Rooms;
using Mercury.HabboHotel.Items;
using System;
using System.Linq;
using System.Drawing;
using System.Threading;
namespace Mercury.HabboHotel.RoomBots
{
internal class PetBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int EnergyTimer;
internal PetBot(int VirtualId)
{
checked
{
this.SpeechTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
this.ActionTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 30 + VirtualId);
this.EnergyTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
}
}
case "FUTBOL":
case "FOOTBALL":
case "SOCCER":
case "FÚTBOL":
if (!roomUser.PetData.HasCommand(5))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
var Footballs = base.GetRoom().GetRoomItemHandler().mFloorItems.Values.Where(x => x.GetBaseItem().InteractionType == Items.InteractionType.football);
if (Footballs.Count() < 1)
{
Lazy = true;
break;
}
else
{
Items.RoomItem Item = Footballs.FirstOrDefault();
this.ActionTimer = 50;
this.EnergyTimer = 30;
roomUser.MoveTo(Item.GetX, Item.GetY);
roomUser.PetData.AddExperience(35);
}
SubtractAttributes();
break;
case "JUEGA":
case "JUGAR":
case "PLAY":
if (!roomUser.PetData.HasCommand(11))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
SubtractAttributes();
break;
case "QUIETO":
case "CALLA":
case "CALM":
case "ESTATUA":
case "STATUE":
case "SHUT":
case "SHUT UP":
case "SILENCE":
case "SILENT":
case "STAY":
this.RemovePetStatus();
this.ActionTimer = 650;
this.EnergyTimer = 20;
roomUser.AddStatus("wav", "");
roomUser.UpdateNeeded = true;
break;
case "HABLA":
case "SPEAK":
case "TALK":
if (!roomUser.PetData.HasCommand(10))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.ActionTimer = 1;
this.EnergyTimer = 10;
roomUser.Statusses.Add("gst", "sml");
roomUser.UpdateNeeded = true;
roomUser.PetData.AddExperience(35);
SubtractAttributes();
break;
case "DORMIR":
case "DUERME":
case "A CASA":
case "TO NEST":
case "A DORMIR":
case "NEST":
this.RemovePetStatus();
Next, head over to GameClientMessageHandler, search for internal void PlantMonsterplant - then replace the entire void with this;
Spoiler:
Code:
internal void PlantMonsterplant(RoomItem Mopla, Room Room)
{
if (Room == null)
{
return;
}
if (Mopla == null)
{
return;
}
if (Mopla.GetBaseItem().InteractionType != InteractionType.moplaseed)
{
return;
}
int rarity = int.Parse(Mopla.ExtraData);
int getX = Mopla.GetX;
int getY = Mopla.GetY;
Room.GetRoomItemHandler().RemoveFurniture(this.Session, Mopla.Id, false);
Pet pet = Catalog.CreatePet(this.Session.GetHabbo().Id, "Monsterplant", 16, "0", "0", rarity);
this.Response.Init(Outgoing.SendMonsterplantIdMessageComposer);
this.Response.AppendUInt(pet.PetId);
this.SendResponse();
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
Room.RoomId,
"', x = '",
getX,
"', y = '",
getY,
"' WHERE id = '",
pet.PetId,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = Room.RoomId;
List<RandomSpeech> list = new List<RandomSpeech>();
List<BotResponse> list2 = new List<BotResponse>();
RoomBot bot = new RoomBot(pet.PetId, pet.OwnerId, pet.RoomId, AIType.Pet, "freeroam", pet.Name, "", pet.Look, pet.X, pet.Y, pet.Z, 0, 0, 0, 0, 0, ref list, ref list2, "", 0);
Room.GetRoomUserManager().DeployBot(bot, pet);
if (pet.DBState != DatabaseUpdateState.NeedsInsert)
{
pet.DBState = DatabaseUpdateState.NeedsUpdate;
}
using (IQueryAdapter queryreactor2 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor2.runFastQuery("DELETE FROM items WHERE id = " + Mopla.Id);
Room.GetRoomUserManager().SavePets(queryreactor2);
}
}
In the same file, search for internal void PlacePet() - once more replace the entire void with this;
Spoiler:
Code:
internal void PlacePet()
{
Room room = MercuryEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
if (room == null || (room.AllowPets == 0 && !room.CheckRights(this.Session, true, false)) || !room.CheckRights(this.Session, true, false))
{
return;
}
uint num = this.Request.PopWiredUInt();
Pet pet = this.Session.GetHabbo().GetInventoryComponent().GetPet(num);
if (pet == null || pet.PlacedInRoom)
{
return;
}
int num2 = this.Request.PopWiredInt32();
int num3 = this.Request.PopWiredInt32();
if (!room.GetGameMap().CanWalk(num2, num3, false, 0u))
{
return;
}
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
room.RoomId,
"', x = '",
num2,
"', y = '",
num3,
"' WHERE id = '",
num,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = room.RoomId;
Make sure you saved all files, then debug. If you've done it all correctly, then voila! You have bots working better then before. There are 2 known bugs with these, 1. If you edit the words, you need to save once, then save again for it to update, 2. Every time you update, they respawn back where you placed them. Not sure why, but I'll look into it.
Like? Leave a like! (This took a good 30 minutes to write up and edit x.x) More fixes coming soon amigos!
13-12-14
smatch
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by FatalLulz
Let's fix Mercury bots! *Note, this won't fix them 100% - How ever it will fix them duplicating, allow them to walk, fix them causing heaps of lag*
First of all, open your emulator source. On the right, navigate to RoomBots, right click AIType.cs and delete it.
Open BotAI.cs and replace the entire file with this;
Spoiler:
Code:
using System;
using Mercury.HabboHotel.GameClients;
using Mercury.HabboHotel.Rooms;
foreach (string Keyword in Keywords.Split(';'))
{
this.Keywords.Add(Keyword.ToLower());
}
}
internal bool KeywordMatched(string Message)
{
foreach (string Keyword in Keywords)
{
if (Message.ToLower().Contains(Keyword.ToLower()))
{
return true;
}
}
return false;
}
}
}
Next, replace GenerciBot.cs with this;
Spoiler:
Code:
using System;
using Mercury.Core;
using Mercury.HabboHotel.Pathfinding;
using Mercury.HabboHotel.Rooms;
using Mercury.Messages;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using Mercury.Messages.Headers;
using Mercury;
using Database_Manager.Database;
using Database_Manager.Database.Session_Details.Interfaces;
namespace Mercury.HabboHotel.RoomBots
{
class GenericBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int speechDelta;
private bool canSpeak;
private int nextAction;
private int virtualId;
internal GenericBot(int VirtualId, int BotId)
{
int speechInterval = 7;
using (IQueryAdapter adapter = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT speaking_interval from bots WHERE id = " + BotId);
speechInterval = adapter.getInteger();
adapter.setQuery("SELECT automatic_chat from bots WHERE id = " + BotId);
canSpeak = Convert.ToBoolean(adapter.getString());
}
internal override void OnTimerTick()
{
if (base.GetBotData() != null)
{
if (this.SpeechTimer <= 0)
{
if (base.GetBotData().RandomSpeech.Count > 0)
{
if (canSpeak)
{
RandomSpeech randomSpeech = base.GetBotData().GetRandomSpeech();
base.GetRoomUser().Chat(null, randomSpeech.Message, randomSpeech.Shout, 0, 0);
}
}
this.SpeechTimer = speechDelta;
}
else
{
this.SpeechTimer--;
}
if (this.nextAction > 0)
{
this.nextAction--;
}
else
{
List<Point> list = base.GetRoom().GetGameMap().getWalkableList();
if (list.Count == 0)
return;
int randomNumber = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(0, list.Count - 1);
switch (base.GetBotData().WalkingMode.ToLower())
{
case "freeroam":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
case "specified_range":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
}
this.nextAction = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(15, 30);
}
}
}
}
}
Next, replace PetBot.cs with this;
Spoiler:
Code:
using Mercury.Core;
using Mercury.HabboHotel.GameClients;
using Database_Manager.Database.Session_Details.Interfaces;
using Mercury.HabboHotel.PathFinding;
using Mercury.HabboHotel.Pets;
using Mercury.HabboHotel.Rooms;
using Mercury.HabboHotel.Items;
using System;
using System.Linq;
using System.Drawing;
using System.Threading;
namespace Mercury.HabboHotel.RoomBots
{
internal class PetBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int EnergyTimer;
internal PetBot(int VirtualId)
{
checked
{
this.SpeechTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
this.ActionTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 30 + VirtualId);
this.EnergyTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
}
}
case "FUTBOL":
case "FOOTBALL":
case "SOCCER":
case "FÚTBOL":
if (!roomUser.PetData.HasCommand(5))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
var Footballs = base.GetRoom().GetRoomItemHandler().mFloorItems.Values.Where(x => x.GetBaseItem().InteractionType == Items.InteractionType.football);
if (Footballs.Count() < 1)
{
Lazy = true;
break;
}
else
{
Items.RoomItem Item = Footballs.FirstOrDefault();
this.ActionTimer = 50;
this.EnergyTimer = 30;
roomUser.MoveTo(Item.GetX, Item.GetY);
roomUser.PetData.AddExperience(35);
}
SubtractAttributes();
break;
case "JUEGA":
case "JUGAR":
case "PLAY":
if (!roomUser.PetData.HasCommand(11))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
SubtractAttributes();
break;
case "QUIETO":
case "CALLA":
case "CALM":
case "ESTATUA":
case "STATUE":
case "SHUT":
case "SHUT UP":
case "SILENCE":
case "SILENT":
case "STAY":
this.RemovePetStatus();
this.ActionTimer = 650;
this.EnergyTimer = 20;
roomUser.AddStatus("wav", "");
roomUser.UpdateNeeded = true;
break;
case "HABLA":
case "SPEAK":
case "TALK":
if (!roomUser.PetData.HasCommand(10))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.ActionTimer = 1;
this.EnergyTimer = 10;
roomUser.Statusses.Add("gst", "sml");
roomUser.UpdateNeeded = true;
roomUser.PetData.AddExperience(35);
SubtractAttributes();
break;
case "DORMIR":
case "DUERME":
case "A CASA":
case "TO NEST":
case "A DORMIR":
case "NEST":
this.RemovePetStatus();
Next, head over to GameClientMessageHandler, search for internal void PlantMonsterplant - then replace the entire void with this;
Spoiler:
Code:
internal void PlantMonsterplant(RoomItem Mopla, Room Room)
{
if (Room == null)
{
return;
}
if (Mopla == null)
{
return;
}
if (Mopla.GetBaseItem().InteractionType != InteractionType.moplaseed)
{
return;
}
int rarity = int.Parse(Mopla.ExtraData);
int getX = Mopla.GetX;
int getY = Mopla.GetY;
Room.GetRoomItemHandler().RemoveFurniture(this.Session, Mopla.Id, false);
Pet pet = Catalog.CreatePet(this.Session.GetHabbo().Id, "Monsterplant", 16, "0", "0", rarity);
this.Response.Init(Outgoing.SendMonsterplantIdMessageComposer);
this.Response.AppendUInt(pet.PetId);
this.SendResponse();
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
Room.RoomId,
"', x = '",
getX,
"', y = '",
getY,
"' WHERE id = '",
pet.PetId,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = Room.RoomId;
List<RandomSpeech> list = new List<RandomSpeech>();
List<BotResponse> list2 = new List<BotResponse>();
RoomBot bot = new RoomBot(pet.PetId, pet.OwnerId, pet.RoomId, AIType.Pet, "freeroam", pet.Name, "", pet.Look, pet.X, pet.Y, pet.Z, 0, 0, 0, 0, 0, ref list, ref list2, "", 0);
Room.GetRoomUserManager().DeployBot(bot, pet);
if (pet.DBState != DatabaseUpdateState.NeedsInsert)
{
pet.DBState = DatabaseUpdateState.NeedsUpdate;
}
using (IQueryAdapter queryreactor2 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor2.runFastQuery("DELETE FROM items WHERE id = " + Mopla.Id);
Room.GetRoomUserManager().SavePets(queryreactor2);
}
}
In the same file, search for internal void PlacePet() - once more replace the entire void with this;
Spoiler:
Code:
internal void PlacePet()
{
Room room = MercuryEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
if (room == null || (room.AllowPets == 0 && !room.CheckRights(this.Session, true, false)) || !room.CheckRights(this.Session, true, false))
{
return;
}
uint num = this.Request.PopWiredUInt();
Pet pet = this.Session.GetHabbo().GetInventoryComponent().GetPet(num);
if (pet == null || pet.PlacedInRoom)
{
return;
}
int num2 = this.Request.PopWiredInt32();
int num3 = this.Request.PopWiredInt32();
if (!room.GetGameMap().CanWalk(num2, num3, false, 0u))
{
return;
}
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
room.RoomId,
"', x = '",
num2,
"', y = '",
num3,
"' WHERE id = '",
num,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = room.RoomId;
Make sure you saved all files, then debug. If you've done it all correctly, then voila! You have bots working better then before. There are 2 known bugs with these, 1. If you edit the words, you need to save once, then save again for it to update, 2. Every time you update, they respawn back where you placed them. Not sure why, but I'll look into it.
Like? Leave a like! (This took a good 30 minutes to write up and edit x.x) More fixes coming soon amigos!
Hi, very nice fix!
I get various errors. :/ http://prntscr.com/5g8uri
you have sucess in compile?
send me all files complete for bot fix.
Thx for this!
13-12-14
FatalLulz
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by smatch
Hi, very nice fix!
I get various errors. :/ http://prntscr.com/5g8uri
you have sucess in compile?
send me all files complete for bot fix.
Thx for this!
I've made other changes, so I'd have to post all those fixes would take too long in the time I have. Use google as a friend amigo. Also, make a help request.
13-12-14
Wuzix
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by FatalLulz
Let's fix Mercury bots! *Note, this won't fix them 100% - How ever it will fix them duplicating, allow them to walk, fix them causing heaps of lag*
First of all, open your emulator source. On the right, navigate to RoomBots, right click AIType.cs and delete it.
Open BotAI.cs and replace the entire file with this;
Spoiler:
Code:
using System;
using Mercury.HabboHotel.GameClients;
using Mercury.HabboHotel.Rooms;
foreach (string Keyword in Keywords.Split(';'))
{
this.Keywords.Add(Keyword.ToLower());
}
}
internal bool KeywordMatched(string Message)
{
foreach (string Keyword in Keywords)
{
if (Message.ToLower().Contains(Keyword.ToLower()))
{
return true;
}
}
return false;
}
}
}
Next, replace GenerciBot.cs with this;
Spoiler:
Code:
using System;
using Mercury.Core;
using Mercury.HabboHotel.Pathfinding;
using Mercury.HabboHotel.Rooms;
using Mercury.Messages;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using Mercury.Messages.Headers;
using Mercury;
using Database_Manager.Database;
using Database_Manager.Database.Session_Details.Interfaces;
namespace Mercury.HabboHotel.RoomBots
{
class GenericBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int speechDelta;
private bool canSpeak;
private int nextAction;
private int virtualId;
internal GenericBot(int VirtualId, int BotId)
{
int speechInterval = 7;
using (IQueryAdapter adapter = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT speaking_interval from bots WHERE id = " + BotId);
speechInterval = adapter.getInteger();
adapter.setQuery("SELECT automatic_chat from bots WHERE id = " + BotId);
canSpeak = Convert.ToBoolean(adapter.getString());
}
internal override void OnTimerTick()
{
if (base.GetBotData() != null)
{
if (this.SpeechTimer <= 0)
{
if (base.GetBotData().RandomSpeech.Count > 0)
{
if (canSpeak)
{
RandomSpeech randomSpeech = base.GetBotData().GetRandomSpeech();
base.GetRoomUser().Chat(null, randomSpeech.Message, randomSpeech.Shout, 0, 0);
}
}
this.SpeechTimer = speechDelta;
}
else
{
this.SpeechTimer--;
}
if (this.nextAction > 0)
{
this.nextAction--;
}
else
{
List<Point> list = base.GetRoom().GetGameMap().getWalkableList();
if (list.Count == 0)
return;
int randomNumber = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(0, list.Count - 1);
switch (base.GetBotData().WalkingMode.ToLower())
{
case "freeroam":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
case "specified_range":
{
base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
break;
}
}
this.nextAction = new Random(DateTime.Now.Millisecond + this.virtualId ^ 2).Next(15, 30);
}
}
}
}
}
Next, replace PetBot.cs with this;
Spoiler:
Code:
using Mercury.Core;
using Mercury.HabboHotel.GameClients;
using Database_Manager.Database.Session_Details.Interfaces;
using Mercury.HabboHotel.PathFinding;
using Mercury.HabboHotel.Pets;
using Mercury.HabboHotel.Rooms;
using Mercury.HabboHotel.Items;
using System;
using System.Linq;
using System.Drawing;
using System.Threading;
namespace Mercury.HabboHotel.RoomBots
{
internal class PetBot : BotAI
{
private int SpeechTimer;
private int ActionTimer;
private int EnergyTimer;
internal PetBot(int VirtualId)
{
checked
{
this.SpeechTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
this.ActionTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 30 + VirtualId);
this.EnergyTimer = new Random((VirtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 60);
}
}
case "FUTBOL":
case "FOOTBALL":
case "SOCCER":
case "FÚTBOL":
if (!roomUser.PetData.HasCommand(5))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
var Footballs = base.GetRoom().GetRoomItemHandler().mFloorItems.Values.Where(x => x.GetBaseItem().InteractionType == Items.InteractionType.football);
if (Footballs.Count() < 1)
{
Lazy = true;
break;
}
else
{
Items.RoomItem Item = Footballs.FirstOrDefault();
this.ActionTimer = 50;
this.EnergyTimer = 30;
roomUser.MoveTo(Item.GetX, Item.GetY);
roomUser.PetData.AddExperience(35);
}
SubtractAttributes();
break;
case "JUEGA":
case "JUGAR":
case "PLAY":
if (!roomUser.PetData.HasCommand(11))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.RemovePetStatus();
SubtractAttributes();
break;
case "QUIETO":
case "CALLA":
case "CALM":
case "ESTATUA":
case "STATUE":
case "SHUT":
case "SHUT UP":
case "SILENCE":
case "SILENT":
case "STAY":
this.RemovePetStatus();
this.ActionTimer = 650;
this.EnergyTimer = 20;
roomUser.AddStatus("wav", "");
roomUser.UpdateNeeded = true;
break;
case "HABLA":
case "SPEAK":
case "TALK":
if (!roomUser.PetData.HasCommand(10))
{
Unknown = true;
break;
}
if (roomUser.PetData.Energy < 20 || roomUser.PetData.Nutrition < 25)
{
Lazy = true;
break;
}
this.ActionTimer = 1;
this.EnergyTimer = 10;
roomUser.Statusses.Add("gst", "sml");
roomUser.UpdateNeeded = true;
roomUser.PetData.AddExperience(35);
SubtractAttributes();
break;
case "DORMIR":
case "DUERME":
case "A CASA":
case "TO NEST":
case "A DORMIR":
case "NEST":
this.RemovePetStatus();
Next, head over to GameClientMessageHandler, search for internal void PlantMonsterplant - then replace the entire void with this;
Spoiler:
Code:
internal void PlantMonsterplant(RoomItem Mopla, Room Room)
{
if (Room == null)
{
return;
}
if (Mopla == null)
{
return;
}
if (Mopla.GetBaseItem().InteractionType != InteractionType.moplaseed)
{
return;
}
int rarity = int.Parse(Mopla.ExtraData);
int getX = Mopla.GetX;
int getY = Mopla.GetY;
Room.GetRoomItemHandler().RemoveFurniture(this.Session, Mopla.Id, false);
Pet pet = Catalog.CreatePet(this.Session.GetHabbo().Id, "Monsterplant", 16, "0", "0", rarity);
this.Response.Init(Outgoing.SendMonsterplantIdMessageComposer);
this.Response.AppendUInt(pet.PetId);
this.SendResponse();
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
Room.RoomId,
"', x = '",
getX,
"', y = '",
getY,
"' WHERE id = '",
pet.PetId,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = Room.RoomId;
List<RandomSpeech> list = new List<RandomSpeech>();
List<BotResponse> list2 = new List<BotResponse>();
RoomBot bot = new RoomBot(pet.PetId, pet.OwnerId, pet.RoomId, AIType.Pet, "freeroam", pet.Name, "", pet.Look, pet.X, pet.Y, pet.Z, 0, 0, 0, 0, 0, ref list, ref list2, "", 0);
Room.GetRoomUserManager().DeployBot(bot, pet);
if (pet.DBState != DatabaseUpdateState.NeedsInsert)
{
pet.DBState = DatabaseUpdateState.NeedsUpdate;
}
using (IQueryAdapter queryreactor2 = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor2.runFastQuery("DELETE FROM items WHERE id = " + Mopla.Id);
Room.GetRoomUserManager().SavePets(queryreactor2);
}
}
In the same file, search for internal void PlacePet() - once more replace the entire void with this;
Spoiler:
Code:
internal void PlacePet()
{
Room room = MercuryEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
if (room == null || (room.AllowPets == 0 && !room.CheckRights(this.Session, true, false)) || !room.CheckRights(this.Session, true, false))
{
return;
}
uint num = this.Request.PopWiredUInt();
Pet pet = this.Session.GetHabbo().GetInventoryComponent().GetPet(num);
if (pet == null || pet.PlacedInRoom)
{
return;
}
int num2 = this.Request.PopWiredInt32();
int num3 = this.Request.PopWiredInt32();
if (!room.GetGameMap().CanWalk(num2, num3, false, 0u))
{
return;
}
using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
{
queryreactor.runFastQuery(string.Concat(new object[]
{
"UPDATE bots SET room_id = '",
room.RoomId,
"', x = '",
num2,
"', y = '",
num3,
"' WHERE id = '",
num,
"'"
}));
}
pet.PlacedInRoom = true;
pet.RoomId = room.RoomId;
Make sure you saved all files, then debug. If you've done it all correctly, then voila! You have bots working better then before. There are 2 known bugs with these, 1. If you edit the words, you need to save once, then save again for it to update, 2. Every time you update, they respawn back where you placed them. Not sure why, but I'll look into it.
Like? Leave a like! (This took a good 30 minutes to write up and edit x.x) More fixes coming soon amigos!
BotManager.cs and UserBot.cs have the same codes.
13-12-14
smatch
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by Wuzix
BotManager.cs and UserBot.cs have the same codes.
Yes, I also do not understand. :/
And, BotManager.cs not have GenerateBotFromRow from the code in Room.cs (RoomBot Bot = BotManager.GenerateBotFromRow(Row);
I do not understand.
the script, lack something.
14-12-14
FatalLulz
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Fixed my bot fix post above. Wasn't home till now.
I forget to patch the HTML 'exploit' so re-add the fix for Room.cs and BotManager.cs and also the extra bit at the end regarding GameClientMessageHandler!
14-12-14
C0R3G4M3R
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Would someone release or send me a fixed emulator? Would be very nice :D Because the Mercury Emulators I've tested are not working for me :/
14-12-14
Gaby
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by C0R3G4M3R
Would someone release or send me a fixed emulator? Would be very nice :D Because the Mercury Emulators I've tested are not working for me :/
What's exactly not working for you?
14-12-14
limithotel
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
'The name 'WebUtility' does not exist in the current context'
how can I fix this?
can't find anything on google.
*Fixed it.
14-12-14
Konquer
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Fix for the spam click teleport to get :tele
Find InteractionType.teleport and change out the case with this:
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by C0R3G4M3R
Would someone release or send me a fixed emulator? Would be very nice :D Because the Mercury Emulators I've tested are not working for me :/
Would be nice to release a new, fixed version of Mercury Emu.
There are too many fixes for me to let it work..
It would help all the noobs (and me haha)
15-12-14
Kristophers
Re: [Mercury Emulator] Fixes & Edits [Topic] [Post Your Bugs and Fixes]
Quote:
Originally Posted by Konquer
Fix for the spam click teleport to get :tele
Find InteractionType.teleport and change out the case with this: