Altercationz
:)
Hello,
I've decided to start working on an RP Emulator - This wont be anything spectacular it'll just be a basic roleplay emulator.
It will have basic functions like:
- Jobs
- a few furniture interactions (may code farming, you can suggest other ideas)
- Jail System
and a few more things.
I would like some c# developers to step up and comment below if they'd like to be apart of the project.
I just started this 30 minutes ago, and have some of the user manager coded.
I don't have time to be contributing a lot everyday, or spending several hours on end but i do promise a fully functioning RP Emulator.
Thanks, please comment feedback to improve the code or suggest ideas
I've decided to start working on an RP Emulator - This wont be anything spectacular it'll just be a basic roleplay emulator.
It will have basic functions like:
- Jobs
- a few furniture interactions (may code farming, you can suggest other ideas)
- Jail System
and a few more things.
I would like some c# developers to step up and comment below if they'd like to be apart of the project.
I just started this 30 minutes ago, and have some of the user manager coded.
Code:
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
using log4net;
using Plus.Core;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Groups;
using Plus.HabboHotel.GameClients;
using Plus.HabboHotel.Achievements;
using Plus.HabboHotel.Users.Badges;
using Plus.HabboHotel.Users.Inventory;
using Plus.HabboHotel.Users.Messenger;
using Plus.HabboHotel.Users.Relationships;
using Plus.HabboHotel.Users.UserDataManagement;
using Plus.HabboHotel.Users.Process;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using Plus.HabboHotel.Users.Navigator.SavedSearches;
using Plus.HabboHotel.Users.Effects;
using Plus.HabboHotel.Users.Messenger.FriendBar;
using Plus.HabboHotel.Users.Clothing;
using Plus.Communication.Packets.Outgoing.Navigator;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using Plus.Communication.Packets.Outgoing.Rooms.Session;
using Plus.Communication.Packets.Outgoing.Handshake;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Rooms.Chat.Commands;
using Plus.HabboHotel.Users.Permissions;
using Plus.HabboHotel.Subscriptions;
using Plus.HabboHotel.Users.Calendar;
namespace Plus.HabboHotel.Users
{
public class Roleplay
{
private static readonly ILog Log = LogManager.GetLogger("Plus.HabboHotel.Users.Roleplay");
// User Information
public int UserId;
public string Motto;
GameClient user;
// Health
public int Health;
// Taxi System
public int GoingToId;
// Police System
public bool Wanted;
public bool InJail;
public int JailTime;
// Load The Data.
private void LoadUserData()
{
if (this.UserId > 0)
{
int health = 100;
bool injail = false;
int jailtime = 0;
using (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
Adapter.SetQuery("SELECT * FROM rp_data WHERE userid @id");
Adapter.AddParameter("id", this.UserId);
DataRow Row = Adapter.getRow();
if (Row != null)
{
health = Convert.ToInt32(Row["health"]);
injail = PlusEnvironment.EnumToBool(Row["in_jail"].ToString());
jailtime = Convert.ToInt32(Row["jail_time"]);
}
else
{
// New User
Adapter.SetQuery("INSERT INTO rp_data (userid) VALUES @id");
Adapter.AddParameter("id", this.UserId);
Adapter.RunQuery();
}
}
this.Health = health;
this.InJail = false;
this.JailTime = jailtime;
this.Motto = "Citizen";
}
}
public Roleplay(int Id)
{
this.UserId = Id;
this.LoadUserData();
}
public void Chat(string msg)
{
GameClient User = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(this.UserId);
User.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(User.GetHabbo().Username).OnChat(0, msg, false);
}
public GameClient GetClient
{
get { return PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(this.UserId); }
}
public void CallTaxi(int ID)
{
this.GoingToId = ID;
RoomData Room = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(ID);
if (Room == null)
return;
this.Chat("*Whistles for a taxi to " + Room.Name + "*");
new Thread(() =>
{
Thread.Sleep(10000);
this.GetClient.GetHabbo().Credits -= 15;
this.GetClient.SendMessage(new CreditBalanceComposer(this.GetClient.GetHabbo().Credits));
this.GetClient.GetHabbo().PrepareRoom(ID, "");
}).Start();
}
}
}
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
class TaxiCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_taxi"; }
}
public string Parameters
{
get { return "%roomid%"; }
}
public string Description
{
get { return "Call a taxi to another room"; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (Session.GetHabbo().Roleplay.GoingToId > 0)
{
Session.GetHabbo().Roleplay.Chat("*Cancels their taxi*");
return;
}
if (Session.GetHabbo().Roleplay.InJail)
return;
int Id = Convert.ToInt32(Params[1]);
if (Id == Session.GetHabbo().CurrentRoomId)
return;
if (Session.GetHabbo().Credits < 15)
{
Session.SendWhisper("You cannot afford the taxi! ($15)");
return;
}
Session.GetHabbo().Roleplay.CallTaxi(Id);
}
}
}
Thanks, please comment feedback to improve the code or suggest ideas
Last edited: