Hello guys, I want to get my Honor Point Ranks by Killing Jobbers. any idea?
Hello guys, I want to get my Honor Point Ranks by Killing Jobbers. any idea?
Could you log packets or whatever in an external program when someone has killed another player in a job suit and have it place the killer and victim in a table and give them honor points?
No packets were logged, or even external program to record this.. though, I have edited some of Honor's SPs
Code:USE [SRO_VT_SHARD] GO /****** Object: StoredProcedure [dbo].[_TRAINING_CAMP_UPDATEHONORRANK] Script Date: 5/30/2015 9:55:11 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[_TRAINING_CAMP_UPDATEHONORRANK] AS Declare @CampID int Declare @CharID int declare @Index int declare @Rank int declare @id int SET @Index =0 SET @id =0 update _TrainingCampHonorRank set Rank =null,CampID =null /* --------------------Trader------------------*/ DECLARE RankCursor CURSOR FAST_FORWARD FOR SELECT TOP 30 CharID FROM _CharTrijob WITH (NOLOCK) WHERE JobType =1 and Level >=5 ORDER BY Exp DESC, Level desc OPEN RankCursor FETCH NEXT FROM RankCursor INTO @CharID WHILE @@FETCH_STATUS = 0 BEGIN select @CampID = CampID from _TrainingCampMember where CharID @CharID IF (@@ROWCOUNT > 0) BEGIN set @id = @id +1 set @Index = @Index +1 IF @Index between 1 and 5) BEGIN SET @Rank = 1 END ELSE IF @Index between 6 and 10) BEGIN SET @Rank = 2 END ELSE IF @Index between 11 and 20) BEGIN SET @Rank = 3 END ELSE IF @Index between 21 and 30) BEGIN SET @Rank = 4 END update _TrainingCamp set Rank= @Rank where ID @CampID update _TrainingCampHonorRank set Rank @Rank,CampID @CampID where Ranking = @id END FETCH NEXT FROM RankCursor INTO @CharID END CLOSE RankCursor DEALLOCATE RankCursor SET @Index =0 set @CharID =0 set @CampID =0 /* --------------------Thief------------------*/ DECLARE RankCursor CURSOR FAST_FORWARD FOR SELECT TOP 30 CharID FROM _CharTrijob WITH (NOLOCK) WHERE JobType =2 and Level >=5 ORDER BY Exp DESC, Level desc OPEN RankCursor FETCH NEXT FROM RankCursor INTO @CharID WHILE @@FETCH_STATUS = 0 BEGIN select @CampID = CampID from _TrainingCampMember where CharID @CharID IF (@@ROWCOUNT > 0) BEGIN set @id = @id +1 set @Index = @Index +1 IF @Index between 1 and 5) BEGIN SET @Rank = 1 END ELSE IF @Index between 6 and 10) BEGIN SET @Rank = 2 END ELSE IF @Index between 11 and 20) BEGIN SET @Rank = 3 END ELSE IF @Index between 21 and 30) BEGIN SET @Rank = 4 END update _TrainingCamp set Rank= @Rank where ID @CampID update _TrainingCampHonorRank set Rank @Rank,CampID @CampID where Ranking = @id END FETCH NEXT FROM RankCursor INTO @CharID END CLOSE RankCursor DEALLOCATE RankCursor SET @Index =0 set @CharID =0 set @CampID =0 /* --------------------Hunter------------------*/ DECLARE RankCursor CURSOR FAST_FORWARD FOR SELECT TOP 30 CharID FROM _CharTrijob WITH (NOLOCK) WHERE JobType =3 and Level >=5 ORDER BY Exp DESC, Level desc OPEN RankCursor FETCH NEXT FROM RankCursor INTO @CharID WHILE @@FETCH_STATUS = 0 BEGIN select @CampID = CampID from _TrainingCampMember where CharID @CharID IF (@@ROWCOUNT > 0) BEGIN set @id = @id +1 set @Index = @Index +1 IF @Index between 1 and 5) BEGIN SET @Rank = 1 END ELSE IF @Index between 6 and 10) BEGIN SET @Rank = 2 END ELSE IF @Index between 11 and 20) BEGIN SET @Rank = 3 END ELSE IF @Index between 21 and 30) BEGIN SET @Rank = 4 END update _TrainingCamp set Rank= @Rank where ID @CampID update _TrainingCampHonorRank set Rank @Rank,CampID @CampID where Ranking = @id END FETCH NEXT FROM RankCursor INTO @CharID END CLOSE RankCursor DEALLOCATE RankCursor RETURN 1Meanwhile, I have managed to get it work when a thief jobber kill a trader or even a hunter and vice... but he must be level (5) in a job when he killing his enemies... but still have bug in Honor Rank page in Storage NPCs...Code:USE [SRO_VT_SHARD] GO /****** Object: StoredProcedure [dbo].[_TrainingCamp_FnAddMember] Script Date: 5/30/2015 9:58:48 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[_TrainingCamp_FnAddMember] @CampID INT, @MemberID INT, @honorPoint INT AS SET NOCOUNT ON IF EXISTS (SELECT CharID FROM _TrainingCampMember WHERE CharID = @MemberID) BEGIN RETURN -1001 END DECLARE @MemberName VARCHAR(64) DECLARE @MemberMaxLvl TINYINT DECLARE @MemberCurLvl TINYINT DECLARE @Jobtype TINYINT Declare @String NVARCHAR(50) select @Jobtype = JobType from _CharTrijob where CharID=@MemberID if(@Jobtype =1) begin set @String ='*(Trader)' end else if (@Jobtype =2) begin set @String ='*(Thief)' end else if(@Jobtype =3) begin set @String ='*(Hunter)' end SELECT @MemberName = CharName16 @String, @MemberMaxLvl = MaxLevel, @MemberCurLvl = CurLevel FROM _Char WITH (NOLOCK) WHERE CharID = @MemberID IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -1 END IF EXISTS (SELECT CharID FROM _TrainingCampMember WITH (NOLOCK) WHERE CampID = @CampID AND CharID = @MemberID) BEGIN RETURN -2 END DECLARE @ReFObjID INT SELECT @ReFObjID = RefObjID FROM _Char WITH (NOLOCK) WHERE CharID = @MemberID IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -3 END /* commented by novice. ¾Æ·¡·Î ¿Å±ä´Ù!! 2007. 07. 16. ---------------------------------------------------------------------------------------------------------- -- by novice DECLARE @ApprenticeCount INT DECLARE @subMentorCount INT -- Àý´ë nolockÀ¸·Î ÇÏÁö ¸»ÀÚ!! SELECT @subMentorCount = COUNT(*) FROM _TrainingCampMember WHERE CampID = @CampID AND MemberClass = 1 IF ( @subMentorCount >= 2 ) BEGIN RETURN -11 END -- Àý´ë nolockÀ¸·Î ÇÏÁö ¸»ÀÚ!! SELECT @ApprenticeCount = COUNT(*) FROM _TrainingCampMember WHERE CampID = @CampID AND MemberClass = 2 IF ( @ApprenticeCount >= 5 ) BEGIN RETURN -12 END ---------------------------------------------------------------------------------------------------------- */ DECLARE @MemberClass TINYINT SET @MemberClass = 0 ---------------------------------------------------------------------------------------------------------- -- by novice 2007. 07. 16. -- °¡ÀÔ½ÃŰ´Â »ç¶÷ÀÇ ·¹º§¿¡ µû¶ó¼ Ŭ·¡½º¸¦ °áÁ¤Çϴµ¥.. -- ±×³É ¹«ÀÛÁ¤ °¢ Ŭ·¡½º¿¡ ´ëÇØ ÀοøÀ» °Ë»çÇÏ¸é ´ç±Ù ¹®Á¦°¡ ÀÖ´Ù -- °¡ÀÔÇÏ´Â »ç¶÷ÀÇ Å¬·¡½º¿¡ ¸Â´Â Àοø °Ë»ç¸¦ ½ÃµµÇØ¾ß ÇÑ´Ù!! -- ±Ùµ¥.. ³»°¡ Àü¿¡´Â ¿Ö Àú·¸°Ô Çß¾úÀ»±î.......... ¤Ð_¤Ð ---------------------------------------------------------------------------------------------------------- IF @MemberClass = 0 BEGIN DECLARE @mentorCount INT -- Àý´ë nolockÀ¸·Î ÇÏÁö ¸»ÀÚ!! SELECT @mentorCount = COUNT(*) FROM _TrainingCampMember WHERE CampID = @CampID AND MemberClass = 0 IF ( @mentorCount >= 1 ) BEGIN RETURN -14 -- ADD DBÀÛ¾÷ ½ÇÆÐ¶ó´Â ·Î±×·Î ¾´´Ù.. END END ELSE IF @MemberClass = 1 BEGIN DECLARE @subMentorCount INT -- Àý´ë nolockÀ¸·Î ÇÏÁö ¸»ÀÚ!! SELECT @subMentorCount = COUNT(*) FROM _TrainingCampMember WHERE CampID = @CampID AND MemberClass = 1 IF ( @subMentorCount >= 2 ) BEGIN RETURN -11 END END ELSE IF @MemberClass = 2 BEGIN DECLARE @ApprenticeCount INT -- Àý´ë nolockÀ¸·Î ÇÏÁö ¸»ÀÚ!! SELECT @ApprenticeCount = COUNT(*) FROM _TrainingCampMember WHERE CampID = @CampID AND MemberClass = 2 IF ( @ApprenticeCount >= 5 ) BEGIN RETURN -12 END END ---------------------------------------------------------------------------------------------------------- INSERT _TrainingCampMember VALUES @CampID, @MemberID, @ReFObjID, @MemberName, GETDATE(), @MemberClass, @MemberMaxLvl, @MemberCurLvl, @MemberMaxLvl, @honorPoint) IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -5 END IF ( 0 < (SELECT COUNT(*) FROM _TrainingCampBuffStatus WHERE CampID = @CampID and RecipientCharID = @MemberID) ) BEGIN RETURN -2006 END IF @MemberClass = 0 OR @MemberClass = 2 BEGIN -- °æÇèÄ¡ ´©Àû ¹öÇÁ¿¡ ´ëÇÑ ³»¿ë INSERT _TrainingCampBuffStatus VALUES @CampID, @MemberID, 0, 0, default, 0, 0) IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -2005 END END -- °æÇèÄ¡ Àû¸³ ¹öÇÁ¿¡ ´ëÇÑ ³»¿ë IF @MemberClass = 0 BEGIN INSERT _TrainingCampBuffStatus SELECT @CampID, @MemberID, cnt + 1, 0, '2000-01-01', 0, 3 FROM _RefDummySlot with( nolock ) WHERE cnt < 5 IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -2005 END END ELSE IF @MemberClass = 2 BEGIN INSERT _TrainingCampBuffStatus SELECT @CampID, @MemberID, 1, 0, '2000-01-01', 0, 3 IF (@@ERROR <> 0 OR @@ROWCOUNT = 0) BEGIN RETURN -2005 END END SET NOCOUNT OFF RETURN 1
An image for explain:
It doesn't record the number of Kills in the Graduates Column.
Oh I see what your doing now, so the job kills are all working correctly but the kill values aren't adding in the Graduates column?
I'll take a look, but i'll also tag @Witchy Moo as she deal's with database and queries on a daily basis and could probably help you in fixing your issue and improve the query.
Okay. I'm waiting for your answer.
Last edited by RenePunik; 27-05-15 at 11:31 AM.
Up...
Hello,
Oh, is the idea to update honor rank not by academy system but from job kills? and the "Graduates" should be the kill point?
Perhaps you could do that by calling [dbo].[_TRAINING_CAMP_MEMBER_GRADUATE] from _AddLogChar every time the job kill happens (EventID = 20), it's the simplest way but you have to adjust some values and not sure how this will effect the server performance.
OR
You could do that using another table (or another field in existing table) that count kills with the help of _AddLogChar procedure (EventID = 20). And put the kill values as graduates when updating the honor rank, or directly after kill sequence.
For example:
In store procedure [SRO_VT_LOG].[dbo].[_AddLogChar], add these:
And the table:Code:IF (@EventID = 20) -- PVP (died) BEGIN IF @desc LIKE '%Trader, Neutral, no freebattle team%' -- Trader OR @desc LIKE '%Hunter, Neutral, no freebattle team%' -- Hunter OR @desc LIKE '%Robber, Neutral, no freebattle team%' -- Thief ) BEGIN /* Uncomment this if you want PVP to be recorder only in certain region */ /* DECLARE @LatestRegion INT = (SELECT LatestRegion FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) IF (@LatestRegion IN (32241, 32242, 31985, 31986)) BEGIN RETURN -1 END */ -- Get killer name DECLARE @KillerName VARCHAR(512) = @desc DECLARE @KillerID INT = 0 SELECT @KillerName = REPLACE @KillerName, LEFT @KillerName, CHARINDEX('(', @KillerName)), '') SELECT @KillerName = REPLACE @KillerName, RIGHT @KillerName, CHARINDEX(')', REVERSE @KillerName))), '') SELECT @KillerID = CharID FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharName16 = @KillerName -- Get job type DECLARE @JobString VARCHAR(10) = LTRIM(RTRIM(SUBSTRING @desc, 5, 7))) DECLARE @JobType INT = CASE WHEN @JobString LIKE 'Trader' THEN 1 WHEN @JobString LIKE 'Robber' THEN 2 WHEN @JobString LIKE 'Hunter' THEN 3 ELSE 0 END -- Delete original log DELETE FROM _LogEventChar WHERE CharID = @CharID 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%' ) -- Get additional info for notice message DECLARE @CharName VARCHAR(64) = (SELECT CharName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) DECLARE @JobDesc VARCHAR(32) = CASE WHEN @JobType BETWEEN 1 AND 3 THEN 'Job Conflict' ELSE 'Free PVP' END DECLARE @strDesc VARCHAR(512) DECLARE @isSent TINYINT = 0 IF (@JobString LIKE 'Trader' OR @JobString LIKE 'Robber' OR @JobString LIKE 'Hunter') BEGIN -- If it's a Job Kill, then write character nicknames DECLARE @KillerNickName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @KillerID) DECLARE @CharNickName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) SET @strDesc = '[' + @KillerNickName + '] has just killed [' + @CharNickName + '] in [' + @JobDesc + '] mode on [' + CONVERT(NVARCHAR(30), GETDATE(), 0) + ']' END -- Update the log INSERT INTO _LogEventNotice VALUES (@isSent, @KillerID, @CharID, @JobType, GETDATE(), @strPos, @strDesc) -- Flag notice if it's not sent more than 5 minutes UPDATE _LogEventNotice SET isSent = 1 WHERE CharID = @CharID AND JobType BETWEEN 1 AND 3 AND EventTime < DATEADD(MINUTE, -5, GETDATE()) /* * Count kills (JOB KILLS) */ DECLARE @killCount INT = (SELECT COUNT(*) FROM _LogEventNotice WHERE CharID = @CharID AND JobType BETWEEN 1 AND 3) END RETURN -1 END
You can count the kill using:Code:USE [SRO_VT_LOG] GO /****** Object: Table [dbo].[_LogEventNotice] Script Date: 05/28/2015 01:31:00 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[_LogEventNotice]( [isSent] [int] NOT NULL, [CharID] [int] NOT NULL, [KilledCharID] [int] NOT NULL, [JobType] [int] NOT NULL, [EventTime] [datetime] NULL, [EventLocation] [varchar](128) NULL, [strDesc] [varchar](512) NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[_LogEventNotice] ADD DEFAULT ((0)) FOR [isSent] GO ALTER TABLE [dbo].[_LogEventNotice] ADD DEFAULT ((0)) FOR [CharID] GO ALTER TABLE [dbo].[_LogEventNotice] ADD DEFAULT ((0)) FOR [KilledCharID] GO ALTER TABLE [dbo].[_LogEventNotice] ADD DEFAULT ((0)) FOR [JobType] GO
And you can also use the _LogEventNotice table for another purpose :), modify as you need.
ye but problem is you will not see on real time (on game )your point you have to restart gs to see point....
I'm going to try. @Witchy Moo, I have to leave my above SPs as it or replace it with original ones?
Last edited by RenePunik; 28-05-15 at 12:03 PM.
you did pretty nice mods fulfilling your needs though, no need to change anything if they already works.
The _AddLogChar thingy is completely different thing, I just tried to add an example for you to record kill activities, which you can use for the honor thingy you wanna make, or other stuff.
For example you can update the kill count to automatically to your honor table everytime a char got killed, like:
the formula should be some value you want, say, how much honor value a person will get when they kill in job mode. And that sequence should be called by _AddLogChar, inside the Event 20 sequence :)Code:/* Check if Camp exist */ DECLARE @CampID INT SELECT @CampID = CampID FROM [SRO_VT_SHARD].[dbo].[_TrainingCampMember] WHERE CharID = @KillerCharID AND MemberClass = 0 IF (@CampID <> 0) BEGIN -- Set graduate UPDATE [SRO_VT_SHARD].[dbo].[_TrainingCamp] SET GraduateCount = GraduateCount + 1 WHERE CampID = @CampID -- Add honor point UPDATE [SRO_VT_SHARD].[dbo].[_TrainingCampMember] SET HonorPoint = HonorPoint + (your formula here) WHERE CharID = @KillerCharID END
something like that... ish..
Last edited by Witchy Moo; 30-05-15 at 01:45 AM.
After some edits, I got it executed with no errors was occurred, but you have made a little mistake... there's no column called CharID on _TrainingCamp table.
This is my edited _AddLogChar : ONLY YOUR PART
Code:IF (@EventID = 20) -- PVP (died) BEGIN IF @desc LIKE '%Trader, Neutral, no freebattle team%' -- Trader OR @desc LIKE '%Hunter, Neutral, no freebattle team%' -- Hunter OR @desc LIKE '%Robber, Neutral, no freebattle team%' -- Thief BEGIN /* Uncomment this if you want PVP to be recorder only in certain region */ /* DECLARE @LatestRegion INT = (SELECT LatestRegion FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) IF (@LatestRegion IN (32241, 32242, 31985, 31986)) BEGIN RETURN -1 END */ -- Get killer name DECLARE @KillerName VARCHAR(512) = @desc DECLARE @KillerID INT = 0 SELECT @KillerName = REPLACE (@KillerName, LEFT (@KillerName, CHARINDEX('(', @KillerName)), '') SELECT @KillerName = REPLACE (@KillerName, RIGHT (@KillerName, CHARINDEX(')', REVERSE @KillerName))), '') SELECT @KillerID = CharID FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharName16 = @KillerName -- Get job type DECLARE @JobString VARCHAR(10) = LTRIM(RTRIM(SUBSTRING (@desc, 5, 7))) DECLARE @JobType INT = CASE WHEN @JobString LIKE 'Trader' THEN 1 WHEN @JobString LIKE 'Robber' THEN 2 WHEN @JobString LIKE 'Hunter' THEN 3 ELSE 0 END -- Delete original log DELETE FROM _LogEventChar WHERE CharID = @CharID 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%' ) -- Get additional info for notice message DECLARE @CharName2 VARCHAR(64) = (SELECT CharName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) DECLARE @JobDesc VARCHAR(32) = CASE WHEN @JobType BETWEEN 1 AND 3 THEN 'Job Conflict' ELSE 'Free PVP' END DECLARE @strDesc VARCHAR(512) DECLARE @isSent TINYINT = 0 IF (@JobString LIKE 'Trader' OR @JobString LIKE 'Robber' OR @JobString LIKE 'Hunter') BEGIN -- If it's a Job Kill, then write character nicknames DECLARE @KillerNickName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @KillerID) DECLARE @CharNickName VARCHAR(64) = (SELECT NickName16 FROM [SRO_VT_SHARD].[dbo].[_Char] WHERE CharID = @CharID) SET @strDesc = '[' + @KillerNickName + '] has just killed [' + @CharNickName + '] in [' + @JobDesc + '] mode on [' + CONVERT(NVARCHAR(30), GETDATE(), 0) + ']' END -- Update the log INSERT INTO _LogEventNotice VALUES (@isSent, @KillerID, @CharID, @JobType, GETDATE(), @strPos, @strDesc) -- Flag notice if it's not sent more than 5 minutes UPDATE _LogEventNotice SET isSent = 1 WHERE CharID = @CharID AND JobType BETWEEN 1 AND 3 AND EventTime < DATEADD(MINUTE, -5, GETDATE()) /* * Count kills (JOB KILLS) */ DECLARE @killCount INT = (SELECT COUNT(*) FROM _LogEventNotice WHERE CharID = @CharID AND JobType BETWEEN 1 AND 3) END RETURN -1 /* Check if Camp exist */ DECLARE @CampID INT SELECT @CampID = CampID FROM SRO_VT_SHARD.[dbo].[_TrainingCampMember] WHERE CharID = @KillerID AND MemberClass = 0 IF @CampID <> 0) BEGIN -- Set graduate My Edited Line > UPDATE SRO_VT_SHARD.[dbo].[_TrainingCamp] SET GraduateCount = GraduateCount + 1 WHERE ID = @KillerID Your one > UPDATE SRO_VT_SHARD.[dbo].[_TrainingCamp] SET GraduateCount = GraduateCount + 1 WHERE CharID = @KillerCharID -- Add honor point UPDATE SRO_VT_SHARD.[dbo].[_TrainingCampMember] SET HonorPoint = HonorPoint + 39 WHERE CharID = @KillerID END END
Last edited by RenePunik; 28-05-15 at 06:57 PM.
Up...
Last edited by RenePunik; 30-05-15 at 12:07 AM.