Redux V2 Code Releases

08/21/2016 05:19 patcac-patcac#1
Thought id release a few codes i wrote for redux when i was playing around.

(Command) Make GM


(Command) Ban Player


(Command) Unban Player


(Command) Reborn



(Monster) CP's Drop


(Monster) Random CP's Drop


(Monster) Drop Items to inventory


More will come soon if you have a cool codes post it here ill include it in the post lets make a redux code thread :)
08/21/2016 11:10 m e n a#2
You should've posted something like fixing some issues, or adding something that everyone would find it useful.

But at least you're trying, keep it up man just focus in adding/fixing.

And why you're using Redux V2?!
08/21/2016 12:48 patcac-patcac#3
#Would love it if a mod could fix the title please i made a mistake its V3 :) thanks in advance
08/30/2016 19:49 InsomniacPro#4
For the random CPs from monsters.
Code:
       Random rnd = new Random();
                int Valcp = rnd.Next(1, 100);
                killer.CP += ConvVal;
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
                killer.Save()

You can just typecast ConvVal to to a uint.

killer.CP += (uint) ConvVal;

Instead of converting it to a uint. Just a friendly tip.

Keep on working on programming. Though this release may seem minimal to some, it's a start on the path to learning.
08/31/2016 08:34 Super Aids#5
Quote:
Originally Posted by InsomniacPro View Post
For the random CPs from monsters.
Code:
       Random rnd = new Random();
                int Valcp = rnd.Next(1, 100);
                killer.CP += ConvVal;
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
                killer.Save()

You can just typecast ConvVal to to a uint.

killer.CP += (uint) ConvVal;

Instead of converting it to a uint. Just a friendly tip.

Keep on working on programming. Though this release may seem minimal to some, it's a start on the path to learning.
And here are some more tips.
Code:
                Random rnd = new Random();
This is a very bad idea. The random generator in C# is horrible and using it like this will most likely produce invalid values and in worst cases the same value over and over.

Instead provide a static thread local random generator.

Code:
                int Valcp = rnd.Next(1, 100);
You can use var.

Code:
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
Interpolated strings anyone? [Only registered and activated users can see links. Click Here To Register...]

Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
08/31/2016 09:17 SuperDaft#6
Quote:
Originally Posted by Super Aids View Post
Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
"Why the fuck is setting this integer crashing my fucking server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my shit because I changed the table structure. Wow do C# properties suck ass." Just another horrible Microsoftism.
08/31/2016 10:36 KraHen#7
Quote:
Originally Posted by SuperDaft View Post
"Why the fuck is setting this integer crashing my fucking server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my shit because I changed the table structure. Wow do C# properties suck ass." Just another horrible Microsoftism.
What? Are you for real? I cannot decide if you're a bot or a troll.
08/31/2016 11:01 patcac-patcac#8
Quote:
Originally Posted by Super Aids View Post
And here are some more tips.
Code:
                Random rnd = new Random();
This is a very bad idea. The random generator in C# is horrible and using it like this will most likely produce invalid values and in worst cases the same value over and over.

Instead provide a static thread local random generator.

Code:
                int Valcp = rnd.Next(1, 100);
You can use var.

Code:
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
Interpolated strings anyone? [Only registered and activated users can see links. Click Here To Register...]

Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
the killer.save(); method is needed cause it will note save the cps to the database i tested before i used it dont worry xD, without it it will only save when the player exits so if the server crashes players cps will roll back also the random value will never produce an invalid value ! it will only produce values between 1 and 100 . Thanks for the post
08/31/2016 15:24 Super Aids#9
Quote:
Originally Posted by SuperDaft View Post
"Why the fuck is setting this integer crashing my fucking server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my shit because I changed the table structure. Wow do C# properties suck ass." Just another horrible Microsoftism.
"Why the fuck is my database not updating with character information?! Oh, it's because I didn't make one billion manual calls to a database save that could have saved me tons of time debugging as well by having them in a property call."

Moron.

#Edit

On a side note. You're a shitty Go programmer anyway, so you don't know how to do anything remotely logical and smart anyway.

Quote:
Originally Posted by patcac-patcac View Post
the killer.save(); method is needed cause it will note save the cps to the database i tested before i used it dont worry xD, without it it will only save when the player exits so if the server crashes players cps will roll back also the random value will never produce an invalid value ! it will only produce values between 1 and 100 . Thanks for the post
What I'm saying is that you should put it in the property so you don't need to call it.
08/31/2016 17:41 Best Coder 2014#10
... why would you even want to save stuff to the database EVERY time some property of a player changes? That's pretty bad, at least if you actually care about, you know, like performance and stuff.
08/31/2016 17:54 SuperDaft#11
Quote:
Originally Posted by KraHen View Post
What? Are you for real? I cannot decide if you're a bot or a troll.
I'm not into my programs doing things that even the debugger can't follow. Seems like a very bad practice or poor abstraction, almost like there's better design / software architecture out there than abstraction. Overloaded operators are in the same category.
08/31/2016 18:24 nTL3fTy#12
Quote:
Originally Posted by SuperDaft View Post
I'm not into my programs doing things that even the debugger can't follow.
[Only registered and activated users can see links. Click Here To Register...]
08/31/2016 18:34 SuperDaft#13
Quote:
Originally Posted by nTL3fTy View Post
[Only registered and activated users can see links. Click Here To Register...]
Which is on by default, and still no. I'm not a fan of over abstraction, especially when there are better ways to design characters and saving.
08/31/2016 23:53 Super Aids#14
Quote:
Originally Posted by Best Coder 2014 View Post
... why would you even want to save stuff to the database EVERY time some property of a player changes? That's pretty bad, at least if you actually care about, you know, like performance and stuff.
No you want to bulk the records to insert/update, then perform them all at once to save performance, as well database speed.

But really it depends on what you want to achieve and how critical it is for you to have data loss.

Sometimes it may be better to sacrifice a little performance, over having critical data loss or possible bugs.

Also databases should be able to handle such type of updates anyway, if it gives you a significant performance loss, then the problem may lie somewhere else.
12/19/2017 12:21 puzzleop#15
I think that you need to remove the killer.Save() after every kill. True it saves you from the server doing a rollback, but just do a main daily. If 30 archers are hunting monsters, each of them will kill 20,000-50,000 monsters(at least) in an hour, that is 3,500,000 saves. Also I think on every big scatter, he is going to spike a bit. I have tried this on a Redux code a few months back, if you save that many times that fast, the killer will lag as hell.