• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Development] [C#] RajanMS v111

Status
Not open for further replies.
Junior Spellweaver
Joined
Sep 23, 2012
Messages
129
Reaction score
17
p2NCF1I - [Development] [C#] RajanMS v111 - RaGEZONE Forums



Good Luck :)
 
Last edited:
Junior Spellweaver
Joined
Sep 23, 2012
Messages
129
Reaction score
17
Lol anyway I would really to see this go somewhere and not die off..

ps ? is C# your first programming lang ? and how did you pick it up ?
 
Experienced Elementalist
Joined
Feb 10, 2008
Messages
249
Reaction score
161
Why not use an array?


mmmmm i could but in the future im sure i'd need to code sorting (the inventory button thing), so i could probably just control H in VS and replace Dictionary with SortedDictionary


Lol anyway I would really to see this go somewhere and not die off..


ps ? is C# your first programming lang ? and how did you pick it up ?


yeah its my 1st. april last year i wanted created a custom client for gms and it was like my big project for half a year. i implemented inventory, map objects etc. it started as a bot that floated ingame. now it has a minimap that when you click your char teles to the nearest FH. as lame as it sounds yeah i learned my c# trying to create a badass client for gms
 
Elite Diviner
Joined
May 30, 2011
Messages
443
Reaction score
95
I'm actually going to give constructive criticism without being a stick, so here it goes:

https://github.com/LankMasterFlex/RajanMS/blob/master/RajanMS/RajanMS/Constants.cs

Constants classes are ugly as duck, especially in C#. (String-based) resource providers are roughly just as fast and are the preferred design pattern here. Also, "readonly" should be reserved for truly immutable fields that you want evaluated at runtime, and "const" should be used instead for actual static constants, while other things marked as readonly here aren't really constant at all and would probably fit better in a config file. It looks like this was ported from a Java source which is kind of disappointing to see -- there are easier and more dynamic ways to represent the game's class hierarchy than an enum that won't require you to key in each class by hand with new updates or use helper functions like isClass(int). Also, you should never use camel case outside of a private scope.

https://github.com/LankMasterFlex/RajanMS/blob/master/RajanMS/RajanMS/Packets/PacketProcessor.cs

AppendHandler here will overwrite existing handlers, which can cause memory leaks depending on where your packet handlers get referenced.

https://github.com/LankMasterFlex/RajanMS/tree/master/RajanMS/RajanMS/Packets/Handlers

You probably don't need separate classes to handle each opcode when a delegate type would suffice. It's also just kind of weird in a C++ type way to have handlers take a MapleClient object when an object-oriented design is readily available.

https://github.com/LankMasterFlex/RajanMS/blob/master/RajanMS/RajanMS/Game/Inventory.cs

Your enum here should have a base case.

https://github.com/LankMasterFlex/RajanMS/tree/master/RajanMS/RajanMS/Core/IO

BinaryReader is bad, especially for packets. There are lots of alternatives, but even writing your own binary reader would be preferable.

https://github.com/LankMasterFlex/RajanMS/tree/master/RajanMS/RajanMS/Core/Network

The Begin/EndInvoke pattern isn't really used anymore, you should wrap sockets with a TcpClient and use the Async methods instead.

A lot of this looks like it was lifted directly from other sources, but you haven't included any licenses or credits. You should probably do that.
 
Legendary Battlemage
Joined
Jun 16, 2011
Messages
610
Reaction score
347
why do people make these threads to show off, especially v111 man you are like 40 versions behind
 
Newbie Spellweaver
Joined
Nov 14, 2011
Messages
80
Reaction score
24
i store inventory items by creating a dictionary with the size of the inventory max slots, leaving empty slots with null value. it's pretty gay but this is c# so it's ok right

I can't tell if this is troll or serious.
Dictionaries are dynamic, why on earth would you do that!?
 
Experienced Elementalist
Joined
Feb 10, 2008
Messages
249
Reaction score
161
constants class was a quick hackjob but nothing else really needs to be changed up too much. i will put your suggestions into action next commiy

why do people make these threads to show off, especially v111 man you are like 40 versions behind

has much changed in the v111 -> v117 span? i might just up the version since there is still lots of time (only login is done)
 
Junior Spellweaver
Joined
Apr 20, 2013
Messages
103
Reaction score
24
I would advice using LINQ more though,
For example, you now have this
Code:
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
    foreach (T item in sequence)
    {
        if (predicate(item)) //returned true
            return item;
    }


    return default(T);
}

Why not simply use this
Code:
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
    return sequence.Single(predicate);
}

Or simply dont even bother writing a function for it and directly call Single() or Where()
 
Last edited:
Initiate Mage
Joined
Sep 8, 2009
Messages
2
Reaction score
7
I would advice using LINQ more though,
For example, you now have this
Code:
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
    foreach (T item in sequence)
    {
        if (predicate(item)) //returned true
            return item;
    }


    return default(T);
}

Why not simply use this
Code:
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
    return sequence.Single(predicate);
}

Or simply dont even bother writing a function for it and directly call Single() or Where()

One good reason to not use Single there would be that Single blows up when an element is not found, or when more than one element is found, while the method he wrote returns the first found (irrelevant of other matches) and returns default(T) if there is no match.
Although you are correct in that the method is not needed, FirstOrDefault with a predicate is equivalent.
 
Newbie Spellweaver
Joined
Feb 13, 2009
Messages
6
Reaction score
0
This is a horrid c# project.

Anything made by Rajan (OP) is a disaster.

Functions that do not follow the simple 3 step c# rule...

Overall, due to Rajan being a noob, I give the project a 3/10
 
Initiate Mage
Joined
Jul 27, 2013
Messages
1
Reaction score
1
i'm liking it bro i think this is a cool project.


edit: idk man give this 10/10

would read code again
 
Status
Not open for further replies.
Back
Top