Brad
Well-Known Member
Mango Emulator for Habbo revision PRODUCTION-201802201205-141713395
HI all,
As some will know I started working on Mango around 1 year ago, but I abandoned it when I got too busy and never really thought about continuing it until recently. If you don't know what Mango is you can find the link to the original release below. First off, credits go to @Sledmore, for starting this off (this is not the one he started before he released his PlusEmu) & of course, to the original creators of Mango. This is currently a solo project & I hope to release this as a solid Emulator.
Red = Not Started.
Yellow = In Progress.
Green = Live.
Yellow = In Progress.
Green = Live.
- Navigator
- Messenger
- Catalog
- Pets
- Bots
- Item handling.
- Trading.
- Wired.
- Moderation.
PHP:
using Mango.Communication.Sessions;
using Mango.Catalog;
namespace Mango.Communication.Packets.Incoming.Catalog
{
class PurchaseFromCatalogEvent : IPacketEvent
{
public void parse(Session session, ClientPacket packet)
{
if (session == null || session.GetPlayer() == null)
return;
int PageId = packet.PopWiredInt();
int ItemId = packet.PopWiredInt();
string Data = packet.PopString();
int Amount = packet.PopInt();
if (!Mango.GetServer().GetCatalogManager().TryGetPage(PageId, out CatalogPage Page))
return;
if (!Page.Visible || (Page.MinRank > session.GetPlayer().Rank))
return;
Page.PageType.OnPurchase(session, Page, ItemId, Data, Amount);
}
}
}
PHP:
using Mango.Players;
using Mango.Rooms.AI.Bots;
using Mango.Rooms.AI.Pets;
using Mango.Rooms.AI.Pets.Interfaces;
using Mango.Rooms.Bots;
using Mango.Rooms.Bots.Interfaces;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Concurrent;
using System.Data;
namespace Mango.Rooms.AI
{
class AIManager
{
private ConcurrentDictionary<int, Pet> _pets = null;
public ConcurrentDictionary<int, Bot> _bots = null;
private readonly BotComponent botComponent = null;
private readonly PetComponent petComponent = null;
public readonly RoomInstance roomInstance = null;
public AIManager()
{
this._bots = new ConcurrentDictionary<int, Bot>();
this._pets = new ConcurrentDictionary<int, Pet>();
this.InitializeBots();
this.InitializePets();
this.botComponent = new BotComponent(_bots);
this.petComponent = new PetComponent(_pets);
}
public void InitializePets()
{
if (this._pets.Count > 0)
this._pets.Clear();
using (var DbCon = Mango.GetServer().GetDatabaseManager().GetQueryReactor())
{
DbCon.SetQuery("SELECT `id`, `race`, `name` FROM `pets`;");
DataTable Pets = DbCon.getTable();
if (Pets != null)
{
foreach (DataRow Reader in Pets.Rows)
{
{
int Id = Convert.ToInt32(Reader["id"]);
int Race = Convert.ToInt32(Reader["race"]);
string Name = Convert.ToString(Reader["name"]);
IPetType Type = PetType.GetPetTypeFromPetRaceId(Race);
if (!this._pets.ContainsKey(Id))
{
this._pets.TryAdd(Id, new Pet(Id, Name, Type));
}
}
}
}
}
}
public void InitializeBots()
{
if (this._bots.Count > 0)
this._bots.Clear();
using (var DbCon = Mango.GetServer().GetDatabaseManager().GetQueryReactor())
{
DbCon.SetQuery("SELECT `id`, `room_id`, `user_id`, `name`, `motto`, `figure`, `gender`,`ai_type` FROM `bots`;");
DataTable Bots = DbCon.getTable();
if(Bots != null)
{
foreach (DataRow Reader in Bots.Rows)
{
int Id = Convert.ToInt32(Reader["id"]);
int RoomId = Convert.ToInt32(Reader["room_id"]);
int UserId = Convert.ToInt32(Reader["user_id"]);
string Name = Convert.ToString(Reader["name"]);
string Motto = Convert.ToString(Reader["motto"]);
string Figure = Convert.ToString(Reader["figure"]);
string Gender = Convert.ToString(Reader["gender"]);
BotType Type = BotTypes.GetBotTypesFromString(Convert.ToString(Reader["ai_type"]));
if (!this._bots.ContainsKey(Id))
{
this._bots.TryAdd(Id, new Bot(Id, RoomId, UserId, Name, Motto, Figure, Gender, Type));
}
}
}
}
}
public BotComponent GetBotComponent()
{
return botComponent;
}
public PetComponent GetPetComponent()
{
return petComponent;
}
public void Dispose()
{
_bots.Clear();
_pets.Clear();
_bots = null;
_pets = null;
}
}
}
You must be registered for see links
.Original Release:
You must be registered for see links
Last edited: