Experienced Elementalist
- Joined
- Aug 22, 2013
- Messages
- 208
- Reaction score
- 125
"Simplified" [Job/FreePVP Kill] Fetching (vSRO 1.88) - Now works with NoticeWriter!
Hey there,
I took this idea from PX2000 (thank you), which was originally posted here and here.
I just "simplifies" it for alternative, no need SR_GameServer modifications, no need separate tables between Job kill and Free PVP kill and key constraints, and everything based on SQL query only.
NEW Updates:
I just read this thread about PlusNotice (NoticeWriter). It's actually interesting. And since the author released the source I recon we can modify it ourselves, hence I made some updates to this "Kill Fetch" SP to so we can make it work with our own modified auto notice system.
Updates are:
NEW updates (December 02, 2013):
Additional table:
First, create table in [SRO_VT_LOG] database to record each kills (which you can use for your website, or whatever you want), I call this table: _LogEventPVP
Modification to existing _AddLogChar SP in [SRO_VT_LOG]:
Result of _LogEventPVP table after each kills: (strDesc is something that we can parse in-game using PlusNotice thingy)
Sample query to get kill count when doing job:
That's all
NOTES:
NEW Updates: (December 02, 2013)
Modified version of Notice Writer:
View attachment NoticeWriter.zip
This is modified version Notice Writer v2 from this this thread. I modified it to work with this Kill Fetching system, but it will NOT work with your old PlusNotice system (if you already have it), because the table name and columns are different.
Video:
Good luck and have fun
Hey there,
I took this idea from PX2000 (thank you), which was originally posted here and here.
I just "simplifies" it for alternative, no need SR_GameServer modifications, no need separate tables between Job kill and Free PVP kill and key constraints, and everything based on SQL query only.
NEW Updates:
I just read this thread about PlusNotice (NoticeWriter). It's actually interesting. And since the author released the source I recon we can modify it ourselves, hence I made some updates to this "Kill Fetch" SP to so we can make it work with our own modified auto notice system.
Updates are:
- Added 'isSent' and 'strDesc' columns in _LogEventPVP table (those two can be used with the PlusNotice program, but you have to modify the program first (don't ask me how, I'm not a .NET programmer), cause the original executable will look for "PlusNotice" table and "Sent"/"Message" columns)
- I suggest you drop and re-create the table (table code updated below)
- SP modified below, replace it with new one if you already applied this.
NEW updates (December 02, 2013):
- Modified version of NoticeWriter included (see attachment below)
- The SP will now write the Job Nickname instead of real character nickname (updated in the _AddLogChar SP)
- Add notice flag to set notice as "SENT" if it's not send more than 5 minutes. (to avoid notice flood)
Additional table:
First, create table in [SRO_VT_LOG] database to record each kills (which you can use for your website, or whatever you want), I call this table: _LogEventPVP
Code:
USE [SRO_VT_LOG]
GO
DROP TABLE _LogEventPVP
GO
CREATE TABLE _LogEventPVP (
isSent INT NOT NULL DEFAULT 0,
CharID INT NOT NULL DEFAULT 0,
KilledCharID INT NOT NULL DEFAULT 0,
JobType INT NOT NULL DEFAULT 0,
EventTime DATETIME NULL,
EventLocation VARCHAR(128) NULL,
strDesc VARCHAR(128) NULL
)
GO
Code:
IF (@EventID = 20) -- PVP
BEGIN
IF [USER=275999]des[/USER]c LIKE '%Trader, Neutral, no freebattle team%' -- Trader
OR [USER=275999]des[/USER]c LIKE '%Hunter, Neutral, no freebattle team%' -- Hunter
OR [USER=275999]des[/USER]c LIKE '%Robber, Neutral, no freebattle team%' -- Thief
OR [USER=275999]des[/USER]c like '%no job, Neutral, %no job, Neutral%' -- Free PVP
)
BEGIN
-- Get killer name
DECLARE [USER=434304]killername[/USER] VARCHAR(512) = [USER=275999]des[/USER]c
DECLARE [USER=803511]killeri[/USER]D INT = 0
SELECT [USER=434304]killername[/USER] = REPLACE [USER=434304]killername[/USER], LEFT [USER=434304]killername[/USER], CHARINDEX('(', [USER=434304]killername[/USER])), '')
SELECT [USER=434304]killername[/USER] = REPLACE [USER=434304]killername[/USER], RIGHT [USER=434304]killername[/USER], CHARINDEX(')', REVERSE [USER=434304]killername[/USER]))), '')
SELECT [USER=803511]killeri[/USER]D = CharID FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharName16 = [USER=434304]killername[/USER]
-- Get job type
DECLARE [USER=768752]job[/USER]String VARCHAR(10) = LTRIM(RTRIM(SUBSTRING [USER=275999]des[/USER]c, 5, 7)))
DECLARE [USER=768752]job[/USER]Type INT = CASE
WHEN [USER=768752]job[/USER]String LIKE 'Trader' THEN 1
WHEN [USER=768752]job[/USER]String LIKE 'Robber' THEN 2
WHEN [USER=768752]job[/USER]String LIKE 'Hunter' THEN 3
ELSE 0 END
-- Delete original log
DELETE FROM _LogEventChar WHERE CharID = [USER=551894]Char[/USER]ID AND EventID = 20
AND (strDesc LIKE '%Trader, Neutral, no freebattle team%'
OR strDesc LIKE '%Hunter, Neutral, no freebattle team%'
OR strDesc LIKE '%Robber, Neutral, no freebattle team%'
OR [USER=275999]des[/USER]c like '%no job, Neutral, %no job, Neutral%')
-- Get additional info for notice message
DECLARE [USER=551894]Char[/USER]Name VARCHAR(64) = (SELECT CharName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = [USER=551894]Char[/USER]ID)
DECLARE [USER=768752]job[/USER]Desc VARCHAR(32) = CASE WHEN [USER=768752]job[/USER]Type BETWEEN 1 AND 3 THEN 'Job Conflict' ELSE 'Free PVP' END
DECLARE @strDesc VARCHAR(512)
IF [USER=768752]job[/USER]String LIKE 'Trader' OR [USER=768752]job[/USER]String LIKE 'Robber' OR [USER=768752]job[/USER]String LIKE 'Hunter')
BEGIN
-- If it's a Job Kill, then write character nicknames
DECLARE [USER=770918]killer[/USER]NickName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[[COLOR=#ff0000]_Char[/COLOR]] WHERE CharID = [USER=803511]killeri[/USER]D)
DECLARE [USER=1333392005]Charnic[/USER]kName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[[COLOR=#ff0000]_Char[/COLOR]] WHERE CharID = [USER=551894]Char[/USER]ID)
SET @strDesc = '[' + [USER=770918]killer[/USER]NickName + '] has just killed [' + [USER=1333392005]Charnic[/USER]kName + '] in [' + [USER=768752]job[/USER]Desc + '] mode on [' + CONVERT(NVARCHAR(30), GETDATE(), 0) + ']'
END
ELSE BEGIN
-- If it's normal PVP Kill, write real character names
SET @strDesc = '[' + [USER=434304]killername[/USER] + '] has just killed [' + [USER=551894]Char[/USER]Name + '] in [' + [USER=768752]job[/USER]Desc + '] mode on [' + CONVERT(NVARCHAR(30), GETDATE(), 0) + ']'
END
-- Update the log
INSERT INTO _LogEventPVP VALUES (0, [USER=803511]killeri[/USER]D, [USER=551894]Char[/USER]ID, [USER=768752]job[/USER]Type, GETDATE(), @strPos, @strDesc)
-- Flag notice if it's not sent more than 5 minutes
UPDATE _LogEventPVP SET isSent = 1 WHERE CharID = [USER=551894]Char[/USER]ID AND EventTime < DATEADD(MINUTE, -5, GETDATE())
END
END
Sample query to get kill count when doing job:
Code:
SELECT COUNT(*) FROM [SRO_VT_LOG].[dbo].[_LogEventPVP] WHERE CharID = <yourCharID> AND JobType > 0
NOTES:
- You need to make sure that your "_AddLogChar" procedure is working. So If you use Evangelion SR_GameServer, you should set "disableLog = 0" in misc.ini and restart the gameserver.
- CharID = who kills
- KilledCharID = who got killed
- isSent = 0 or 1, to make it work with modified PlusNotice program
- strDesc = notice message, for PlusNotice also. (see screenshot)
- JobType (for your websites): 1 = Trader, 2 = Thief, 3 = Hunter, 0 = No job (Free PVP)
- My DB is vSRO 1.88 with SQL 2008 R2, didn't try in any other DB
NEW Updates: (December 02, 2013)
Modified version of Notice Writer:
View attachment NoticeWriter.zip
This is modified version Notice Writer v2 from this this thread. I modified it to work with this Kill Fetching system, but it will NOT work with your old PlusNotice system (if you already have it), because the table name and columns are different.
Video:
Good luck and have fun
Attachments
You must be registered for see attachments list
Last edited: