- Joined
- Dec 9, 2011
- Messages
- 78
- Reaction score
- 27
Hey there,
First of all #DirenGezi, #OccupyTurkey
And then
As you can see on the title it just sends a notice to server about alchemy actions
When a player successfully upgrades his/her item its automatically recording to Log DB. It will be a bit buggy. I'm not going to make a full guide here but i think you guys can handle it with some brain 
Btw i've used "auto notice's source codes by someone else". If you let me know his name i'll let others know who he is
Log in with that old way before sending notice
Table
To _AddLogItem procedure in log DB(be sure that you've changed "SRO_VT_SHARD" to your own shard db in procedure)
Change log:
v1.0.1:
-Sql connection issue fixed
v1.0.2:
-added remote connection
v1.0.3:
-empty/old notice spam fixed
v1.0.4:
-Packet sending issue fixed
V1.0.5:
-Manuel gateway port selection
And the download links of source and the sample:
Sample:
Source:
Password:
Virustotal:
I suggest you guys to read this thread before starting this one: http://forum.ragezone.com/f722/db-log-plus-weapons-globals-934558/
P.S: Found the auto notice base source developer which i created the whole system on it. Credits of it goes to Devsome.com
Hope you enjoy and hope it works for you
First of all #DirenGezi, #OccupyTurkey
And then
As you can see on the title it just sends a notice to server about alchemy actions
Btw i've used "auto notice's source codes by someone else". If you let me know his name i'll let others know who he is
Table
Code:
USE [SRO_VT_SHARDLOG]
GO
/****** Object: Table [dbo].[PlusNotice] Script Date: 14.06.2013 18:09:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[PlusNotice](
[Sent] [int] NOT NULL,
[Message] [varchar](300) NOT NULL,
[Date] [datetime] NOT NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[PlusNotice] ADD CONSTRAINT [DF_PlusNotice_Sent] DEFAULT ((0)) FOR [Sent]
GO
ALTER TABLE [dbo].[PlusNotice] ADD CONSTRAINT [DF_PlusNotice_Date] DEFAULT (getdate()) FOR [Date]
GO
To _AddLogItem procedure in log DB(be sure that you've changed "SRO_VT_SHARD" to your own shard db in procedure)
Code:
ALTER procedure [dbo].[_AddLogItem] @CharID int,
@ItemRefID int,
@ItemSerial bigint,
@dwData int,
@TargetStorage tinyint,
@Operation tinyint,
@Slot_From tinyint,
@Slot_To tinyint,
@EventPos varchar(64),
@strDesc varchar(128),
@Gold bigint -- #ifdef EXTEND_GOLD_TYPE »ðÀÔ
as
declare @len_pos int
declare @len_desc int
declare @strDesc_separado varchar(128)
declare @len_desc1 int
set @len_pos = len(@EventPos)
set @len_desc = len(@strDesc)
if (@len_pos > 0 and @len_desc > 0)
begin
insert _LogEventItem (EventTime, CharID, ItemRefID, dwData, TargetStorage, Operation, Slot_From, Slot_To, EventPos, strDesc, Serial64, Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
values(GetDate(), @CharID, @ItemRefID, @dwData, @TargetStorage, @Operation, @Slot_From, @Slot_To, @EventPos, @strDesc, @ItemSerial, @Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
end
else if (@len_pos > 0 and @len_desc = 0)
begin
insert _LogEventItem (EventTime, CharID, ItemRefID, dwData, TargetStorage, Operation, Slot_From, Slot_To, EventPos, Serial64, Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
values(GetDate(), @CharID, @ItemRefID, @dwData, @TargetStorage, @Operation, @Slot_From, @Slot_To, @EventPos, @ItemSerial, @Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
end
else if (@len_pos = 0 and @len_desc > 0)
begin
insert _LogEventItem (EventTime, CharID, ItemRefID, dwData, TargetStorage, Operation, Slot_From, Slot_To, strDesc, Serial64, Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
values(GetDate(), @CharID, @ItemRefID, @dwData, @TargetStorage, @Operation, @Slot_From, @Slot_To, @strDesc, @ItemSerial, @Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
end
else if (@len_pos = 0 and @len_desc = 0)
begin
insert _LogEventItem (EventTime, CharID, ItemRefID, dwData, TargetStorage, Operation, Slot_From, Slot_To, Serial64, Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
values(GetDate(), @CharID, @ItemRefID, @dwData, @TargetStorage, @Operation, @Slot_From, @Slot_To, @ItemSerial, @Gold) -- #ifdef EXTEND_GOLD_TYPE ±³Ã¼
end
-- À¯·á ¾ÆÀÌÅÛ ±¸ÀÔÀ̸é!
-- #define LOG_ITEMEVENT_BUY_CASHITEM (BYTE)35
if (@Operation = 35)
begin
insert _LogCashItem (RefItemID, CharID, Cnt, EventTime, Serial64)
values(@ItemRefID, @CharID, @dwData, GetDate(), @ItemSerial)
end
if (@Operation = 90 OR @Operation = 160)
begin
set @len_desc1 = CHARINDEX (']',@strDesc)
if(@len_desc1 = 9)
begin
set @strDesc = SUBSTRING(@strDesc,0,9)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 1)
end
else if(@len_desc1 = 10)
begin
set @strDesc = SUBSTRING(@strDesc,0,10)
set @strDesc_separado = SUBSTRING(@strDesc, 8, 2)
end
if(@strDesc_separado >= 8)
begin
--set @strDesc_separado = @len_desc1
insert _LogItemPlus(CharID, Serial64, Plus, Data, Lido) values(@CharID, @ItemSerial, @strDesc_separado, GetDate(), '0')
end
end
if(@Operation = 90)
begin
declare @iname varchar(129)
declare @iid int
declare @cname varchar(64)
select @iid = RefItemID from SRO_VT_SHARD.dbo._Items where Serial64 = @ItemSerial
select @iname = CodeName128 from SRO_VT_SHARD.dbo._RefObjCommon where id = @iid
select @cname = CharName16 from SRO_VT_SHARD.dbo._Char where CharID = @CharID
insert PlusNotice(Sent, Message)values(0,@cname + ' has increased ' + @iname + ' to [lvl ' + CAST(@strDesc_separado AS NVARCHAR) + ']')
end
Change log:
v1.0.1:
-Sql connection issue fixed
v1.0.2:
-added remote connection
v1.0.3:
-empty/old notice spam fixed
v1.0.4:
-Packet sending issue fixed
V1.0.5:
-Manuel gateway port selection
And the download links of source and the sample:
Sample:
To view the content, you need to sign in or register
Source:
To view the content, you need to sign in or register
Password:
Code:
ragezone
Virustotal:
To view the content, you need to sign in or register
I suggest you guys to read this thread before starting this one: http://forum.ragezone.com/f722/db-log-plus-weapons-globals-934558/
P.S: Found the auto notice base source developer which i created the whole system on it. Credits of it goes to Devsome.com
Hope you enjoy and hope it works for you
V3 under this spoiler
Credits goes to
Don't forget to give thanks to them under this thread
like their comments
Caosfox
and lemoniscoolDon't forget to give thanks to them under this thread
Hello Ragezoners.
(first of all, my english sucks, so live with it)
Finaly is time for the notice writer v3.
requeriments:
sql 2008 r2 (maybe works with 2005 or 2012, i dont have them so not tested it. dont ask me how to make it work on another version, im not going to install 2005 or 2012)
.net framework 3.5 minimum, but recommned 4.0+
time and patience, young padawan
How it works:
is rater simply, the "plus notice" querry writes a small text file on the hard drive with "xxxx as sucess blahblahlblah to +2544" (you define it on the plus notice querry),
next the notice writer monitors that file (folder in this case) for any new file created (is on real time and uses near no processor power).
When a new file is created, reads it and send the message in game (all of that process needs only 0.5 o 0.6 seconds, so is almost real time).
this method DONT use any table in the db
Now install guide:
1) download all the files in the attach
2) create a folder in the root hard drive of your silkroad server (root must be Cand name it MSSQLTips (so is C:\MSSQLTips),
3) copy TextFileTips.dll inside that folder
4) do a full db backup, only in case something goes wrong
5) now at SQL Server Management Studio execute this querrys:
first:
this querry enables CLR support for the dbCode:USE master GO sp_configure 'clr enabled', 1 GO RECONFIGURE GO
second :
needed for CLR compatibility (rename SRO_VT_SHARDLOG to your log db)Code:USE SRO_VT_SHARDLOG GO ALTER DATABASE SRO_VT_SHARDLOG SET TRUSTWORTHY ON GO
third:
this querry installs the CLR codeCode:CREATE ASSEMBLY TextFileTips FROM 'C:\MSSQLTips\TextFileTips.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS
5) execute this querry on your log db to create 2 new functions:
6) if any of the steps 5 or 6 gives a weird errors like :Code:CREATE FUNCTION [dbo].[WriteTextFile]( @text [nvarchar](4000), @path [nvarchar](4000), @append [bit]) RETURNS [bit] WITH EXECUTE AS CALLER AS EXTERNAL NAME [TextFileTips].[ReadWriteFileTips].[WriteTextFile] GO CREATE PROCEDURE [dbo].[ReadTextFile] @path [nvarchar](4000) WITH EXECUTE AS CALLER AS EXTERNAL NAME [TextFileTips].[ReadWriteFileTips].[ReadTextFile] GO
error :
Incorrect syntax near . You may need to set the compatibility level of the current database to a higher value to enable this feature.
solution:
execute this querry (use your log db)
error:Code:EXEC sp_dbcmptlevel 'SRO_VT_SHARDLOG', 100
if sql says you dont hve authorization on db, is a normal error of backups dbs created on one machine and restored on another (remember, all ours dbs are backups from a original one)
to fix this, simply follow this steps:
fix the error and repeat the stepsCode:Select the database, right click it, select PROPERTIES. A pop up window opens up and in the upper left corner you'll see "SELECT A PAGE". select FILE. Now in the main section on the top you'll see OWNER. Select the button next to the empty box. another pop up box opens up, select browse and then you'll have to select (NT AUTHORITY\SYSTEM)
7) modify the addlogitem proc, how? like this:
on your proc, at the inserting the message to the table, comment it and add:
in this querry @azar generates a random number, @veremos is the var where the "xxxx as sucessfull incresing xxx to lvl xxx" (or w/e your msg is) only that, no need date, time or anything moreCode:declare @azar INT declare @randomfile varchar(50) SELECT top 1 @azar = (ABS(CHECKSUM(NEWID())) % 10000) FROM Master.dbo.Syscolumns select @randomfile = 'C:\MSSQLTips\' + convert(varchar, @azar) + '.txt' SELECT dbo.WriteTextFile(@veremos, @randomfile, 0)
@randomfile = creates a text file with the random name, you ask why need to do this? easy, if 2 or more players plus at same time and if you use fixed names,
only 1 message is send, the first. this way all msgs are send (unless you are too unlucky and the random numbers are the same, but you have 1 in 10000 chances of that
and last command writes the text file (dont change paths)
8)done, now simply run the notice.exe and enjoy
virustotal detects 2 "troyan" things, but is the file monitoring routines at folder MSSQLTips
To view the content, you need to sign in or register
program
View attachment 133931
source
To view the content, you need to sign in or register
Last edited:

