Status
Not open for further replies.

treebeard

Member
Jan 16, 2018
317
173
Hello everyone,

I just edited my ItemUtility.cs and CreditFurniRedeemEvent.cs in PlusEMU R2 to try and add the ability to have a diamond exchange.

Here is a link to the classes before I made any edits:
Here is a link to the classes after I made my edits:

My emulator builds and runs with no errors. However, when I try to redeem a credit furni item the item doesn't not get redeemed.
The item stays in the same spot and the update to the purse never takes place.
No exceptions are thrown, no errors are give, and with the emu in debug the packet for CreditFurniRedeemEvent is sent.

As always I appreciate your time, energy, and feedback. Thanks!
 

Queso

echo 'Web Developer';
Nov 29, 2016
233
72
ItemUtiity.CS -
CreditFurniRedeemEvent.CS -
 

treebeard

Member
Jan 16, 2018
317
173
ItemUtiity.CS -
CreditFurniRedeemEvent.CS -
but why would you use default in the switch? what if someone scripts then the default option is to give credits instead of just returning out of the switch.
 
ItemUtiity.CS -
CreditFurniRedeemEvent.CS -
also this is written for R1 when I said I'm using R2
 

Mikee

Active Member
Jul 8, 2017
162
102
but why would you use default in the switch? what if someone scripts then the default option is to give credits instead of just returning out of the switch.
 

also this is written for R1 when I said I'm using R2
That switch is another way of saying
Code:
 if(split[0].equals("DF")){
      give diamonds;
} else {
   give credits;
}

So default in this case is the else clause, which is necessary because when the event is called something needs to be done, otherwise it wouldn't of been called. I.e. Give credits or give diamonds

Also changing from r1 to r2 should be trivial, if not just explain what's wrong.
 

treebeard

Member
Jan 16, 2018
317
173
That switch is another way of saying
Code:
 if(split[0].equals("DF")){
      give diamonds;
} else {
   give credits;
}

So default in this case is the else clause, which is necessary because when the event is called something needs to be done, wise it wouldn't of been called. I.e. Give credits or give diamonds

Also changing from r1 to r2 should be trivial, if not just explain what's wrong.

err well heres what I did and it works. This code is for PlusEMU R2 not R1.


This should eliminate the possibility of users scripting or finding a way to use the default case in switch to give credits.
 

Mikee

Active Member
Jul 8, 2017
162
102
err well heres what I did and it works. This code is for PlusEMU R2 not R1.


This should eliminate the possibility of users scripting or finding a way to use the default case in switch to give credits.
I respect your integrity in trying to eliminate exploits but unless your emu has no encryption or someone finds a way to inject packets its really not possible to script to trick the emulator thinking that a (for example) ducket is a currency.
Code:
Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt());

this is the Item that is getting handled and being run through the control flow. It is determined via the Packet that is being handled through the client (i.e. when a user double clicks the goldbar that is then passed to the client then from there it is passed to the emulator to this class). So unless you can trick the client into thinking that double clicking a ducket is the same thing as double clicking a goldbar, your worry for a possible exploit is really not possible.

BUT ! I salute you for the extra preventive check, it's a good habit to form.
Hope it all works.
 

treebeard

Member
Jan 16, 2018
317
173
I respect your integrity in trying to eliminate exploits but unless your emu has no encryption or someone finds a way to inject packets its really not possible to script to trick the emulator thinking that a (for example) ducket is a currency.
Code:
Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt());

this is the Item that is getting handled and being run through the control flow. It is determined via the Packet that is being handled through the client (i.e. when a user double clicks the goldbar that is then passed to the client then from there it is passed to the emulator to this class). So unless you can trick the client into thinking that double clicking a ducket is the same thing as double clicking a goldbar, your worry for a possible exploit is really not possible.

BUT ! I salute you for the extra preventive check, it's a good habit to form.
Hope it all works.
There are two newer Habbo packet injectors out there that I'm not going to link to. I don't know if they work but there is a community that works on that sort of thing.

Better safe than sorry! Everything works fine now.
I appreciate your well thought out and timely responses. ^.^
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
That switch is another way of saying
Code:
 if(split[0].equals("DF")){
      give diamonds;
} else {
   give credits;
}

So default in this case is the else clause, which is necessary because when the event is called something needs to be done, otherwise it wouldn't of been called. I.e. Give credits or give diamonds

Also changing from r1 to r2 should be trivial, if not just explain what's wrong.
No @birthofcool is right I this situation. You definitely do not want to return a default. You would rather return an error telling the user that's not a redeemable furni.

Also, not sure who taught you to code but your default statement gets triggered by everything so you shouldn't be putting default first. When the code gets executed even diamond would return credits because of the statement.
 
Status
Not open for further replies.

Users who are viewing this thread

Top