Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE] Petition + database schema (https://postpacific.mmorpg-game.online/showthread.php?t=5629)

aralyon 03.09.2006 14:42

[SHARE] Petition + database schema
 
This is my very first bigger share, so be patient please, I’m not so skilled like others are :)
This is complete tutorial how to install PetitionD server and how to configure it. The server is from NCSoft, I haven’t changed anything. The database is my own work, because standard database schema is for old petition server, which doesn’t work with C4 retail. So I had to make totally different database schema, compatible with this client.
So let’s start with database:

PART I – DATABASE
Everything is tested on MS SQL server 2005, I was too lazy to looking for 2000 and installing it.
1. Create empty database for petition (in my examples it is call called ‘petition’)
http://aralyon.ratafak.net/peti/1a.jpg
http://aralyon.ratafak.net/peti/1b.jpg
2. Think out connection string – it’s string containing all information about connecting to database (Petition server DOESN’T use DSN like other parts of L2 server)
There are 2 ways how to connect
a) Windows authentication
You authenticate to mssql with your windows username and password - the connection string is
Code:

SERVER=(Server name);DATABASE=(Database name);Integrated security=true

EXAMPLE: SERVER=.;DATABASE=petition;Integrated security=true

b) Classic authetification using SQL login (recommended) and password
Code:

SERVER=(Server name);DATABASE=(Database name);UID=User name;PWD=Password

EXAMPLE: SERVER=hades;DATABASE=petidb;UID=sysdev;PWD=tltmxparoqkftlf1234!

3. Open db_schema\petition_schema.sql in MSSQL Management studio (or Query Analyzer in MSSQL2000)
4. Write connection string to INSERT INTO statement, as shown below:
http://aralyon.ratafak.net/peti/1c.jpg
5. Set current database to your petition database in toolbar
http://aralyon.ratafak.net/peti/1d.jpg
6. Execute it, it should return no error

PART II – SERVER
1) Choose mode - you can use it like service (originally) or (with my loader) like console program.
2) Installing service - skip if you want to use it like console program
Use InstallUtil from .NET installation directory (I think that it is explained somewhere in other topic.
Syntax is: InstallUtil.exe c:\yourL2server\PetitionD\PetitionD.exe
Some informations about it - http://msdn2.microsoft.com/en-us/library/50614e95.aspx
3) Make encrypted connection string:
1) Write your connection string from step 1.2 to a text file (e.g. connstr.txt)
2) Encrypt it with DES.exe many thanks to Digital - write name of the text file with connection string to field "File to encrypt" and then click on "Encrypt" button. It should show you a "Done" message and create .enc file (e.g. connstr.txt.enc)
http://aralyon.ratafak.net/peti/2a.jpg
3) it contains encrypted connection string.
4) Edit PetitionD.exe.config (for service version) or PetitionConsole.exe.config (for console version). Configuration options are in format <add key="Name" value="Value"></add>
Description of configuration file:
GmServicePort - port for connecting from GM client
WorldServicePort - port for connection from gameserver, it must be the same as [PetitionD] - port in l2server.ini
NoticeServicePort - I don't know yet, I'll have a look later
AuthIp - Ip address of AuthD (It needs auth to authenticate GM client)
AuthPort - admin port of AuthD
AuthConnCount - size of connection pool
LogDirectory - directory to store log files
EnableQuota, MaxQuota - Quote about number of petitions from one player, leave it off, because it isn't done yet
RunMode - can be "test" or "normal", it is highly recommended to set it on "normal"
DumpPacket - enables dumping packets to log file (I recommend to disable, it is for debugging purposes only)
ServerStatusRefreshInterval - ???
DatabaseConnString - encrypted connection string - you MUST change it to corrent values, otherwise it doesnt work!
DatabaseConnName - leave it, it is name of the connection string in NCDBA7
DatabaseConnCount,DatabaseConnTimeout - leave it
MaxActivePetition - maximum number of petitions
MinimumGmClientBuildNumber - minimum version of GM client
EnableGmStatusDump - ???
EnableAssignment - ???
MaxAssignmentPerGm - ???
EnableOnlineCheck - ???
So it is everyting, now petition server is configured. you can start console version with PetitionConsole.exe and service version in service manager in control panel.
It is not still fully tested, but I hope there is no more bugs. If you find anything, please write it to this topic or send me icq or msn message

There is one big problem related to it - It looks like external gm client is needed, because the only method which can get petition into state 3 (petition after submitting is in state 2) is called from gm client listener handler (=invoked by gm client).
But gm client supplied with server doesnt work, probably it is intended to use with old petitionD.
I wrote one, it is here - https://postpacific.mmorpg-game.onli...ad.php?p=66313. GMs can't do nearly anything with submitted petition with L2 client, you have to use GM client. The only builder command related to petition (which I know what it si doing is //force_peti <charname> <petition content> which forces player to submit a petition.
Security notice - for security reasons restrict database access for petition server, there might be security issues, it is unlikely,but it is possible.

Enjoy it :)

Download: http://aralyon.ratafak.net/peti/PetitionD.rar
- password: postpacifik
- it includes all files and tools described in this topic

GM Petition client:
forum thread - https://postpacific.mmorpg-game.onli...ad.php?p=66313
direct download - http://aralyon.ratafak.net/peti/gmclient.rar

Do you have problems with submitting petitions with UnexpectedCategory error?
Quote:

Originally Posted by MuNLoK (Post 66300)
The problem is that you shouldn't have a empty PetitionCategory.txt in the /script/ folder. If you have that, delete it and done


Cardon 03.09.2006 14:56

Very fascinating, and a great share/research indeed.

You have my respect mate.

Great work!

mantrastic 03.09.2006 15:05

nice, been looking for that info,
great work! =D

MuNLoK 03.09.2006 15:52

Wow, really good share... I go to test now. Thank you aralyon ;)

godfather 03.09.2006 16:09

nice share ty :)

is it secure ? (sql injection etc)

FidoW 03.09.2006 16:20

Good share, but petition_schema.sql isnt compatible with SQL2k :P

MuNLoK 03.09.2006 16:29

Ok, tested, work perfectly :D The l2server is connecting good to the petition, but I have a problem.

When I tried to send one petition in the game, with a player, I get "Already applied for petition", and I see in the log:

2006-09-03 18:26:38 D [World: Lineage2 (1)] RECV: W_SUBMIT_PETITION6(169)
2006-09-03 18:26:38 I Fail Log: UnexpectedCategory
2006-09-03 18:26:38 D [World: Lineage2 (1)] SEND: W_SUBMIT_PETITION_FAIL4(142)

Is it a error? What happens? Perhaps one incorrect config?

Thank you for this share, is great!

aralyon 03.09.2006 16:39

Quote:

Originally Posted by MuNLoK (Post 66293)
Ok, tested, work perfectly :D The l2server is connecting good to the petition, but I have a problem.

When I try tro send one petition in the game, with a player, I get "Already applied for petition", and I see in the log:

2006-09-03 18:26:38 D [World: Lineage2 (1)] RECV: W_SUBMIT_PETITION6(169)
2006-09-03 18:26:38 I Fail Log: UnexpectedCategory
2006-09-03 18:26:38 D [World: Lineage2 (1)] SEND: W_SUBMIT_PETITION_FAIL4(142)

Is it a error? What happens? Perhaps one incorrect config?

Thank you for this share, is great!

A category (in table category) is missing. I tried every category and it was ok .... which category did you selected? And do you have data in category table?

mantrastic 03.09.2006 16:46

ye he said he made it for sql2k5 :P

Onepex 03.09.2006 16:50

Nice work.

MuNLoK 03.09.2006 16:53

I tried every category and all give me the same error. I have this data in category table:

2 1 Immobility False
2 2 Game tips False
2 3 Bug report False
2 4 Quest related False
2 5 Suggestions False
2 6 Report a bad user False
2 8 Recovery related False
2 9 Operation related False
2 255 Other False

Complete log file:

Code:

2006-09-03 18:20:22 N Petition Service Start (build 20011)
2006-09-03 18:20:22 N Make Database 10 Connections
2006-09-03 18:20:22 N Clear GM Status
2006-09-03 18:20:22 I Load Petition Category
2006-09-03 18:20:22 I 1: Immobility
2006-09-03 18:20:22 I 2: Game tips
2006-09-03 18:20:22 I 3: Bug report
2006-09-03 18:20:22 I 4: Quest related
2006-09-03 18:20:22 I 5: Suggestions
2006-09-03 18:20:22 I 6: Report a bad user
2006-09-03 18:20:22 I 8: Recovery related
2006-09-03 18:20:22 I 9: Operation related
2006-09-03 18:20:22 I 255: Other
2006-09-03 18:20:22 I Initial Petition Sequence No: 20060903000001
2006-09-03 18:20:22 N Server Name: ignis01, Server IP: 10.0.0.10
2006-09-03 18:20:22 N Starting World Service at 0.0.0.0:2107
2006-09-03 18:20:22 N Starting GM Service at 0.0.0.0:3109
2006-09-03 18:20:22 N Starting Notice Service at 0.0.0.0:3121
2006-09-03 18:20:28 D [World: Unknown(0)] SEND: W_SERVER_VER(101)
2006-09-03 18:20:28 D [World: Unknown(0)] RECV: W_CONNECT_WORLD2(137)
2006-09-03 18:20:28 I [World: Lineage2 (1)] 0 petitions loaded.
2006-09-03 18:20:28 D [World: Lineage2 (1)] SEND: W_ACCEPT_WORLD(103)
2006-09-03 18:26:38 D [World: Lineage2 (1)] RECV: W_SUBMIT_PETITION6(169)
2006-09-03 18:26:38 I Fail Log: UnexpectedCategory
2006-09-03 18:26:38 D [World: Lineage2 (1)] SEND: W_SUBMIT_PETITION_FAIL4(142)


demon 03.09.2006 17:05

for SQL 2k
 
use that xls

create db petition, then use IMPORT, choose XLS 97-2000 choose file then choose all tables and press ok


also u dont need loader u can simply do a sortcut of petitiond.exe and in command change
to PATH\petitiond.exe /console

and it runs as console and not as service ^^

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
petion.xls.rar — 4114 байт

MuNLoK 03.09.2006 17:27

Ok, I found the problem :) . The problem is that you shouldn't have a empty PetitionCategory.txt in the /script/ folder. If you have that, delete it and done.

Thank you!!!

godfather 03.09.2006 17:37

does it work with sql2000 or only with sql2005?

aralyon 03.09.2006 18:19

Quote:

Originally Posted by godfather (Post 66302)
does it work with sql2000 or only with sql2005?

In theory, server should work with sql2000, but I made database with sql2k5, and export it with sql2k5, so it isn't probably 2k compatible. But I don't use 2k5 features, so if anyone can modify my .sql file and make it compatible, I would appreciate it. I can't do it, because I don't have 2k, and I'm too lazy to get it and install it.

godfather 03.09.2006 18:49

yes a sql2k compatible script will be usefull

paul 03.09.2006 19:00

This is good work aralyon congrats =D

Can't wait for the gm client. I'm tryin to work on a sql2k compatible script but i suck :(

midnight 03.09.2006 20:00

when i run the PetitionConsole, the petition server crash

aralyon 03.09.2006 20:08

Quote:

Originally Posted by midnight (Post 66310)
when i run the PetitionConsole, the petition server crash

And any messages? Any errors? Did you set log folder correctly?

palace 03.09.2006 20:46

3) Make encrypted connection string:

1) Write your connection string from step 1.2 to a text file (e.g. connstr.txt)
2) Encrypt it with DES.exe many thanks to Digital - write name of the text file with connection string to field "File to encrypt" and then click on "Encrypt" button. It should show you a "Done" message and create .enc file (e.g. connstr.txt.enc)
http://aralyon.ratafak.net/peti/2a.jpg
3) it contains encrypted connection string.
************************************************** ******
some person can explain better east happens at great length but. Really not of where to remove the data for connstr.txt

midnight 03.09.2006 21:21

It does not give messages in logs, it spends a little time after initiating and crash, the folder log this located good.

palace 03.09.2006 22:21

this error
 
http://img373.imageshack.us/img373/4227/dibujocr3.png


after following the guide and installing everything, it gives error me, I use SQL 2005 enterprice sp1 and xp x64. I have reviewed but profit again not to find the error

paul 04.09.2006 02:16

Actually i installed mssql 2005 (i'm lazy hehe) and works great! GOOD JOB =D =D =D

seraphii 04.09.2006 04:35

Hi i tried execute in query analiser the script of petition. and return thias folow erros:
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'TYPE'.
Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 7
Line 7: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 7
Line 7: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 7
Line 7: Incorrect syntax near '('.
Server: Msg 170, Level 15, State 1, Line 11
Line 11: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 10
Line 10: Incorrect syntax near '('.
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'max'.
Server: Msg 170, Level 15, State 1, Line 12
Line 12: Incorrect syntax near '('.

paul 04.09.2006 07:16

*points to the first few posts on the thread talking about it does NOT work for 2k*

aralyon 04.09.2006 09:03

Quote:

Originally Posted by palace (Post 66321)
after following the guide and installing everything, it gives error me, I use SQL 2005 enterprice sp1 and xp x64. I have reviewed but profit again not to find the error

Error in the encrypted connection string in .config file. Did you set i correctly?

mantrastic 04.09.2006 10:03

im gonna make it for 2k, hold on

ShinHawk 04.09.2006 10:05

Quote:

Originally Posted by mantrastic (Post 66382)
im gonna make it for 2k, hold on

holding on :D

Cardon 04.09.2006 13:54

In-game petition notice...

"Petition is not available for 5 to 13"

What could that possibly mean?

aralyon 04.09.2006 14:01

Quote:

Originally Posted by Cardon (Post 66400)
In-game petition notice...

"Petition is not available for 5 to 13"

What could that possibly mean?

It means that you have to set DisableStart and DisableEnd in l2server.ini to different values (or delete it?) .

Cardon 04.09.2006 14:07

Ahhh, thanks.

Digital 04.09.2006 15:19

nice sharing spirit and good start :)
thank god ppl understood the program i made :x
(was beginning to worry) lol

p.s u'll need to set ip and the revelent ports,
and if i'm not wrong... u might need to insert sql statements
(like how u add ur world info into sql) <-- not so sure abt this one... hopefully it's not missing any sql scripts... but it's not like we cant reconstruct it... just require some time.

gl

mantrastic 04.09.2006 15:52

im converting it to 2000, just few functions of mssql 2005 not sure how they are called in 2000 =x

ebosh 04.09.2006 17:29

good work man.
thx

darkkiss 04.09.2006 17:37

super work
congrats ...

1 problem ... GMPetiClient sometimes closes ... when petitions have to appear .. ..

aralyon 04.09.2006 18:04

Quote:

Originally Posted by darkkiss (Post 66421)
super work
congrats ...

1 problem ... GMPetiClient sometimes closes ... when petitions have to appear .. ..

What exactly mean "when petitions have to appear"? Does it suddenly close, or some error message appears?

mantrastic 04.09.2006 18:11

aralyon, in the servername, what exactly i gotta use, because i tried everything, machine name, ip, etc...
all i get is login failed for sa etc (using sql mode)


btw: i got it for sql 2000 but some procs doesnt work yet, basic stuff does, ill post it once its fully done, unless u want it now =x

edit2: i dont think it can work on 2000, or my settings fucked up =[ tried now windows mode aswell

pic

http://img503.imageshack.us/img503/8089/4343py1.jpg

aralyon 04.09.2006 19:20

Quote:

Originally Posted by mantrastic (Post 66427)
aralyon, in the servername, what exactly i gotta use, because i tried everything, machine name, ip, etc...
all i get is login failed for sa etc (using sql mode)


btw: i got it for sql 2000 but some procs doesnt work yet, basic stuff does, ill post it once its fully done, unless u want it now =x

edit2: i dont think it can work on 2000, or my settings fucked up =[ tried now windows mode aswell

pic

Petition cant connect do mssql - is it on the same machine? Is the mssql instance named?

login failed for sa is better, it can "see" the database, but you probably wrote bad password. Do you have mssql in mixed authencification mode or just windows auth mode?

mantrastic 04.09.2006 19:24

mixed mode, and yes its on the same machine, and no i didnt write bad password, checked it and tested with other stuff like 10 times :S

darkkiss 04.09.2006 21:30

Quote:

Originally Posted by aralyon (Post 66425)
What exactly mean "when petitions have to appear"? Does it suddenly close, or some error message appears?

petition client suddenly close .. no error .. no nothing ... just after i choose my GM Character ... and click OK ...
if i try to reopen client it works perfect

ohh ... and another thing .. if i try to add memo it crashes ... :(


All times are GMT. The time now is 23:18.