Skip to content
Galli edited this page Feb 18, 2023 · 9 revisions

To keep the code base clean and uniform this document should be referenced if you are planning to submit a pull request or work on the repository.

Windows line endings should be used at all times and files should all have an empty new line at the bottom.

Name Style

EntityStyle
Types and NamespacesPascal
MethodsPascal
PropertiesPascal
Local variableslowerCamel
ParameterslowerCamel
Fields (public)Pascal
Fields (other)lowerCamel
EnumerationsPascal
InterfacesIPascal (Pascal with I prefix, IFooInterface)
Database Tablessnake_case
Database ColumnslowerCamel

Braces and Brace Code Style

The overall global indent style is Allman with a few exceptions on where braces should be placed or added at all (redundant braces), see examples below.

classFooClass{// empty simple methods with no body should have the braces on the same line with a single space separating thempublicvirtualvoidSomeVirtualMethod(){}// properties with only a single function (or empty multiple functions) should be placed on a single linepublicuintFooProperty=>123u;publicuintFooBarProperty{get{return123u;}}publicuintFooBarSetter{set{privateFoo=value;}}publicuintEmptyProperty{get;set;}// properties should with multiple functions should still be single lined with the braces on seperate linespublicuintSomeProperty{get{return123u;}set{privateFoo=value;}}// simple one line methods should be placed on a single linepublicuintSimpleMethod(){return123u;}publicvoidStandardMethod(){Foo();DoSomethingElse();ThirdForGoodMeasure();}publicvoidRedundantBraces(){// no braces requiredfor(uinti=0u;i<5u;i++)DoSomething(i);foreach(varfooinbar)DoSomething(foo);// braces only required for the if block as it has multiple linesif(Foo()){FooBar();SecondFunction();}elsereturn;// no braces required for either as both are single lineif(Foo())FooBar();elseFooBar2();// no braces required as additional lines fall under single line ruleforeach(varfooinbar)if(foo.Bar())fooBar();}}

Enumerations

The enumeration and it's value names should both be PascalCase, if specifying index values these must be spaced out to the match to length of the longest value name (see example), the final value in any enumeration should not have the ending comma.

Note: enumerations should be ordered by their values unless specified otherwise with a comment (opcode enumerations)

[Flags]enumFooFlag{None=0x00,Foo=0x01,// commentSomeOtherFlag=0x02// final value comment has an extra space due to missing comma}// ordered enumeration values do not need to indexed, this is up to your discretionenumFooValues{None,Foo,SomeOtherValue}enumFooValues{None=0,Foo=1,SomeOtherValue=2}

Attributes

Attributes must be placed on a separate line to entity they are intended to effect, custom attributes must adhere to the standard class name style of PascalCase.

[FooAttribute]classFooClass{[FooAttribute]publicuintFooValue{get;}[FooAttribute]publicvoidFooMember(){}}enumFooEnum{None,[FooAttribute]Foo}

Database Updates

When making modifications to the database creating an update file is required, this should be placed in the respective update folder (auth/character/world) with the name format of YYYY-MM-DD-00-description.sql. Always start each new date with 00 and increment forward for scripts coming in on the same date. A small description of the update should also be included in the respective updates.txt file.

2017-01-01-00-some-update.sql
2017-01-01-01-some-other-update.sql
2017-01-02-00-foo-update.sql

Clone this wiki locally