Plus Emu r2.1 [RP] [Project Butter C#]

Status
Not open for further replies.

BenHands

Member
Oct 10, 2011
200
38
Awesome. This will be a great release. I think I speak on behalf of all who have seen this forum.

Keep up the great work, Crup.
 

Timmehz

New Member
Aug 16, 2014
18
4
maybe.

Update:
Automatic Logout coded
Gang Bots coded
Gang Bots will only attack if your gang is not neutral or if you're claiming their turf
XP now caches
Taxi now delays depending on your rank/job
Bots can now arrest other bots or even fight other bots
Bots/Pets can now follow their master through rooms
Bots/Pets will defend their master if they are attacked by users or a bot
Gates now automatically open when you're in front of them
Gang bots can now walk through arrows/teleporter
FEJbuyB.png
credits goes to sledmore, got the idea from v26 rps.
Code:
        public void Taxi(int RoomId)
        {
            RoomUser roomUser = CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Id);
            if (Jailed > 0 || Dead > 0 || roomUser.Stunned || dubCooldown > 0)
                Responds();
            else
            {
                if (TaxiDest > 0 && TaxiTime > 0)
                    return;
                using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("SELECT * FROM rooms WHERE id = " + RoomId + "");
                    DataTable dbTable = dbClient.getTable();
                    foreach (DataRow Row in dbTable.Rows)
                    {
                        if (Convert.ToInt32(Row[0]) > 0)
                        {
                            dubCooldown = 7;
                            CurrentRoom.SendMessage(new ShoutComposer(roomUser.VirtualId, "*calls for a taxi to " + Convert.ToString(Row[2]) + " [" + Convert.ToInt32(Row[0]) + "]*", 0, roomUser.LastBubble));
                            TaxiDest = Convert.ToInt32(Row[0]);
                            if (Rank == 1)
                                TaxiTime = SilverwaveEnvironment.GetRandomNumber(40, 80);
                            else if (Rank > 1 || Job == 1 && Working)
                                TaxiTime = SilverwaveEnvironment.GetRandomNumber(20, 30);
                        }
                    }
                }
            }
        }
You're putting a lot of effort in this project. Its one of the best projects I've seen so far. Good Luck with it :)
 

SirMustache

New Member
Feb 22, 2014
20
5
This is fucking nice, but how about the Police BOTs? If I want to be a COP myself is that possible? Maybe a function to turn off Police BOTs and make it that if its on "0" you can me a COP by joining a group... like the government.
 

Crup

weeeeee
Jul 25, 2010
545
310
This is fucking nice, but how about the Police BOTs? If I want to be a COP myself is that possible? Maybe a function to turn off Police BOTs and make it that if its on "0" you can me a COP by joining a group... like the government.

It's all up to the owner's preference to either have Police Bots take full control but what I currently have it set to, the Police Bots will only patrol if regulars cops are off duty.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Looks a good, just a few suggestions/points.

In your Startwork command and DeadSetup methods you don't do anything with the ServerMessages. In your Taxi command you do not need to run a forearch and create a DataRow, you could start off with that, such as;
Code:
DataRow Row = null;
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
    dbClient.setQuery("SELECT `id`,`caption` FROM `rooms` WHERE `id` = '" + RoomId + "' LIMIT 1");//LIMIT to 1 row, and only fetch what we need - runs quicker.
    Row = dbClient.getRow();
}

if (Row == null) 
{
    //Oops, no record found.
    return;
}

dubCooldown = 7;
TaxiDest = Convert.ToInt32(Row["id"]);
CurrentRoom.SendMessage(new ShoutComposer(roomUser.VirtualId, "*calls for a taxi to " + Convert.ToString(Row["caption"]) + " [" + Convert.ToInt32(Row["id"]) + "]*", 0, roomUser.LastBubble));

//A ternary operator can avoid the conditional statement, it does the same thing, but can look prettier!
TaxiTime = (Rank > 1 || Job == 1 && Working ? PlusEnvironment.GetRandomNumber(20, 30) : PlusEnvironment.GetRandomNumber(40, 80));

Just a couple of suggestions that will benefit quite nicely during runtime.

Also, nice to see you're making use of the notifications.
 

SirMustache

New Member
Feb 22, 2014
20
5
It's all up to the owner's preference to either have Police Bots take full control but what I currently have it set to, the Police Bots will only patrol if regulars cops are off duty.
Hmmm kay. But everything seems really nice for then (sorry for my bad English I'm Dutch!!!)
 

Crup

weeeeee
Jul 25, 2010
545
310
Looks a good, just a few suggestions/points.

In your Startwork command and DeadSetup methods you don't do anything with the ServerMessages. In your Taxi command you do not need to run a forearch and create a DataRow, you could start off with that, such as;
Code:
DataRow Row = null;
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
    dbClient.setQuery("SELECT `id`,`caption` FROM `rooms` WHERE `id` = '" + RoomId + "' LIMIT 1");//LIMIT to 1 row, and only fetch what we need - runs quicker.
    Row = dbClient.getRow();
}

if (Row == null)
{
    //Oops, no record found.
    return;
}

dubCooldown = 7;
TaxiDest = Convert.ToInt32(Row["id"]);
CurrentRoom.SendMessage(new ShoutComposer(roomUser.VirtualId, "*calls for a taxi to " + Convert.ToString(Row["caption"]) + " [" + Convert.ToInt32(Row["id"]) + "]*", 0, roomUser.LastBubble));

//A ternary operator can avoid the conditional statement, it does the same thing, but can look prettier!
TaxiTime = (Rank > 1 || Job == 1 && Working ? PlusEnvironment.GetRandomNumber(20, 30) : PlusEnvironment.GetRandomNumber(40, 80));

Just a couple of suggestions that will benefit quite nicely during runtime.

Also, nice to see you're making use of the notifications.

The "RoomUpdate.AppendString(Motto);" uses the servermessage. ye, I already removed the "for each" because I don't need to select everything from the rooms database, just what I need. thanks.
 

BenHands

Member
Oct 10, 2011
200
38
@Crup, have you got people testing your emu out?

Not that I'm doubting your work, putting alot of effort in to it.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
The "RoomUpdate.AppendString(Motto);" uses the servermessage. ye, I already removed the "for each" because I don't need to select everything from the rooms database, just what I need. thanks.

No problem, with the ServerMessage - you do not send it to the room nor user in the code you've shown above.
 

Crup

weeeeee
Jul 25, 2010
545
310
What's the point of using a query for Taxi Command? ;S
What's the point? where is the emulator suppose to get the room's id and name? from it's ass? unless you actually know what you're talking about, please shut the fuck up. You just probably learned what a query is, if you wanna make subjective criticism, take a look at your hotel *coughs* rage.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
What's the point? where is the emulator suppose to get the room's id and name? from it's ass? unless you actually know what you're talking about, please shut the fuck up. You just probably learned what a query is, if you wanna make subjective criticism, take a look at your hotel *coughs* rage.

He probably could of phrased what he said much better, a way of doing this without a query is to cache it with the RoomData instance.

In PlusEmulator there are 2 files, Room.cs and RoomData.cs (Room is the actual Room Instance and RoomData stores the data of the room, it's useful for many things, though it could of been done better).

Room inherits RoomData, you could store values there and load them there too. Just be aware that if Room doesn't actually have any inheritance of RoomData then you will have to either make it inherit RoomData or just store your values in RoomData (such as in Plus it is quite a mess by default).

You can then do simple checks such as;

Code:
if (Room.RoomData.TaxiEnabled)
{
//Do something.
}

Or, if the Room instance properly inherits the RoomData class then you can simply do;

Code:
if (Room.TaxiEnabled)
{
//Do something.
}

And you'd load those values up in the RoomData class, in some of the Fill methods.

(This is how you give suggestions/point things out nicely, @J3rry!!).
 

Threading

New Member
Aug 13, 2014
10
4
What's the point? where is the emulator suppose to get the room's id and name? from it's ass? unless you actually know what you're talking about, please shut the fuck up. You just probably learned what a query is, if you wanna make subjective criticism, take a look at your hotel *coughs* rage.
Quite aggressive? There is no point in using a query for the taxi command, as plus emulator caches room data in the Room.cs class.
 

Jerry

not rly active lol
Jul 8, 2013
1,957
522
What's the point? where is the emulator suppose to get the room's id and name? from it's ass? unless you actually know what you're talking about, please shut the fuck up. You just probably learned what a query is, if you wanna make subjective criticism, take a look at your hotel *coughs* rage.
No point but no RP emulator never uses queries for a taxi command.. Even Reality doesn't use queries for it so yeah.
 

Jaden

not so active
Aug 24, 2014
886
263
Craig that was aggressive!!!
What was the taxi command?

TaxiTime = (Rank > 1 || Job == 1 && Working ? PlusEnvironment.GetRandomNumber(20, 30) : PlusEnvironment.GetRandomNumber(40, 80)); ?? Thats a Timer?
How do you use Seconds--; ?
 
Last edited by a moderator:

Threading

New Member
Aug 13, 2014
10
4
Craig that was aggressive!!!
What was the taxi command?

TaxiTime = (Rank > 1 || Job == 1 && Working ? PlusEnvironment.GetRandomNumber(20, 30) : PlusEnvironment.GetRandomNumber(40, 80)); ?? Thats a Timer?
How do you use Seconds--; ?

Thats called a ternary operation, otherwise known as a substitute for an if an else statement could be translated as:
if(Rank > 1 || Job == 1 && Working) { TaxiTime = PlusEnvironment.GetRandomNumber(20,30); } else { TaxiTime = PlusEnvironment.GetRandomNumber(40,80); }
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
Looks good, Keep it up & hope you finish it for those who need it! :)
 

Rogify

Member
Dec 15, 2013
80
16
seems awesome, looking forward for this, I just wish that the dev. doesnt freeze
 
Status
Not open for further replies.

Users who are viewing this thread

Top