عرض مشاركة واحدة
قديم 27-06-2017, 11:06 AM   #6

tarekelpop1
عضو مميز



الصورة الرمزية tarekelpop1


• الانـتـسـاب » Mar 2011
• رقـم العـضـويـة » 83879
• المشـــاركـات » 545
• الـدولـة » Tanta
• الـهـوايـة » تفجير اى شي
• اسـم الـسـيـرفـر » Private Server
• الـجـنـس » Male
• نقـاط التقييم » 10
tarekelpop1 صـاعـد

tarekelpop1 غير متواجد حالياً



افتراضي رد: مشكلة في دخول اللعبه



ده ال Addlogchar ال عندي
كود PHP:
USE [rivallog]
GO
/****** Object:  StoredProcedure [dbo].[_AddLogChar]    Script Date: 6/27/2017 12:05:15 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER   procedure 
[dbo].[_AddLogChar
@
CharID        int,
@
EventID        tinyint,
@
Data1        int,
@
Data2        int,
@
strPos        varchar(64),
@
Desc        varchar(128)
as
declare @
Charname varchar (50)
    declare @
charid2 int,
    @
tagFinder    varchar(10) = '[His(',
    @
tagEnd        varchar(1) = ')',
    @
userName varchar(max),
    @
veremos varchar(max),
    @
latestregion int,
    @
azar INT,
    @
upper int,
    @
lower int,
    @
randomfile varchar(50),
    @
currenthwan int,
    @
jobtype tinyint,
    @
eventtype varchar (50),
    @
eventstatus varchar (50),
    @
latesteventID int,
    @
CharRegion int,
    @
jobExperience bigint,
    @
jobtopposition int,
    @
jobtype1 int,
    @
Latestcontributionamount bigint,
    @
totalcontribution bigint,
    @
latestcoinsgranted int,
    @
weeklycoinsgranted int,
    @
weeklycontributionamount bigint,
    @
JID21 int,
    @
AccountID2 varchar(140),
    @
RemainRewardAmount bigint,
    @
Coinlimit int,
    @
twelvehourdate datetime,
    @
joblevel int,
    @
JID int,
    @
RewardGiven varchar (150),
    @
AccountID varchar (150),
    @
RewardtobeGiven int,
    @
RewardAmount int,
    @
RewardPlus int,
    @
EventID32 int,
    @
JobDate datetime,
    @
LatestKillCount int,
    @
RewardAmount2 int,
    @
RewardGiven2 varchar(150),
    @
RewardAmount3 int,
    @
EventType2 varchar(150),
    @
WinAmount int,
    @
EventID45 int,
    @
JID2 int,
    @
AmountToGrant bigint,
    @
ComboAmount int,
    @
rewarddate datetime,
    @
Inventoryslot bigint,
    @
eventid46 int,
    @
rewarddate21 datetime,
    @
RewardCodename varchar (50),
    @
RewardOptLevel int,
    @
RewardData int,
    @
Inventoryslot2 bigint,
    @
RewardItemID int,
    @
onlinedelay int,
    @
charlevel int,
    @
regdate datetime,
    @
itemtotransfer int,
    @
CharIDtoRestore int,
    @
itemslot int,
    @
HungerGamesID int,
    @
RewardedCharID int,
    @
KillAmount int
     

     
     
/*Online*/ 
IF ( @EventID 
      
OR @EventID 
  
BEGIN 
      EXEC exigo
..Onlineoffline 
        
@CharID
        @
EventID 
  END 
DECLARE @ServiceLms INT=(SELECT service 
  FROM   exigo
..controls 
  WHERE  eventname 
'LMS'
/*LMS*/ 
IF ( @EventID 20 
     
AND @strPos LIKE '%%' 
     
AND @ServiceLms 
  
BEGIN 
      
DECLARE @NameLms NVARCHAR(50) = (SELECT charname16 
         FROM   rivalshd
.._char 
         WHERE  charid 
= @CharID

      
INSERT INTO Exigo..Killed 
                  
(CharName
      
VALUES      (@NameLms
  
END 
  
--------UNIQ_SURVIVAL*~*---------
  DECLARE 
    @
SUR int = (select latestregion from rivalshd.._Char where CharID = @CharID),
    @
S int = (select service from SRO_VT_ERIUS.dbo.UNIQ_survival_service)
    IF  @
and @SUR 25792
    BEGIN
     
DECLARE
        @
KillerName   VARCHAR(max),
        @
KillerID     INT,
 @
KilledName varchar(Max),        
        @
StartPos     TINYINT
        Select 
@KilledName = (select Charname16 from rivalshd.._Char where CharID = @CharID)
     
SELECT @StartPos   = (SELECT CHARINDEX('(',@desc)) + 1
  SELECT 
@KillerName = (SELECT SUBSTRING(@Desc, @StartPosCHARINDEX(')', @Desc, @StartPos) - @StartPos))
  
SELECT @KillerID   = (SELECT CharID FROM rivalshd.._Char WHERE CharName16 = @KillerName
update SRO_VT_ERIUS.dbo.UNIQ_Survival_Remain set Rem = (select count(*) from SRO_VT_ERIUS.dbo.UNIQ_Survival_Registered)
begin
DECLARE 
@
Now DateTime GETDATE(),
@
WIN_UNIQ_NAME varchar(255) = (select Charname from LEGENDKNIGHT_2015.dbo._Uniques where MonsterCodeName like 'MOB_FW_HYEONGCHEON_100')
END
    end
    
If @EventID and exists (select charid from SRO_VT_ERIUS.dbo.UNIQ_Survival_Registered where charid = @CharID) and @CharID not in (select charid from SRO_VT_ERIUS.dbo.UNIQ_survival_niggas)
    
begin
    delete from SRO_VT_ERIUS
.dbo.UNIQ_Survival_Registered where charid = @CharID
    end
If not exists (select charid from SRO_VT_ERIUS.dbo.UNIQ_Survival_Registered where charid = @CharID) and  @1  and Not exists (select charid from SRO_VT_ERIUS.dbo.UNIQ_survival_niggas where CharID = @CharID)
        
begin
        
DECLARE
        @
Zo INT  = (SELECT LATESTREGION FROM rivalshd.._Char WHERE CharID = @CharID),
        @
chariz varchar(max) = (Select charname16 from rivalshd.._Char where charid = @CharID)
        if @
EventID='11' OR @EventID='9' AND @Zo '25792' and @Charname not like '[BOT]'
        
begin
INSERT INTO rivalshd
.dbo._Notification (Type,Content,Target,Executor,NotifiedVALUES (4,@chariz,0,'LegendKnight',0)
end
        end
------------------------------------------------------------------------------------------------------------------------
IF(@
eventid in (4,6,9,10,11)) and @charid not in (select charid from rivalshd.._user where UserJID in (select jid from rivalacc..tb_user where sec_primary!=and sec_content!=3)) 

--
begin
update rivalshd
.._Items set optlevel=10 where optlevel between 11 and 99
update rivalshd
.._CharSkillMastery set level=0 where MasteryID=1339 and level>0


  
-----------------------------------------------------------------------------------------------------------------------              
-- 
Plevel Rewards
  
-----------------------------------------------------------------------------------------------------------------------              
--If @
eventid 22 
--begin 
--exec LEGENDKNIGHT_2015.LKT._PlvlRewards @charid,@eventid,@lkcharname,@data2 
--end
--IF (@EventID=20 AND @strPos Like '%(0x8018)%')
--
BEGIN
--Declare @NameLms nvarchar(50) = (Select CharName16 From rivalshd.._Char Where CharID=@CharID)
--
Insert Into zealous..LMSkilled (KilledNamevalues (@NameLms)
--
END
--     DECLARE @CharLevel3 tinyint = (SELECT CurLevel from rivalshd.dbo._Char WHERE CharID = @CharID)
--     Declare @
service tinyint = (Select Service From zealous..EventService Where EventName='Jop')
-- IF (@
EventID 19  AND @Desc like '%My: Robber%' OR @EventID 19 AND @Desc like '%My: Trader%' OR @EventID 19 AND @Desc like '%My: Hunter%')
--        
begin
--         IF @strPos LIKE '%(0x8018)%' AND @service =1
--     BEGIN 
--                 --EXEC JOBBING @CharID, @CharLevel2, @Desc
--            EXEC zealous..JOBS @CharID, @CharLevel3, @Desc
--        end
--        END
--IF  (@EventID=OR @EventID =6)
--
BEGIN 
--EXEC zealous..OnlineOffline @CharID,@EventID 
--END


 
-- #########################################  

     
--/*ALCHEMY EVENT*/
        
--    declare @isrunning int
        
--    select @isrunning IsRunningNow FROM _EventSchedule where EventName 'AlchemyEvent'
        
--    if @EventID and @isrunning 0
        
--    BEGIN
        
--    update RivalSHD.._Inventory set ItemID 0 where ItemID IN (Select ID64 FROM RivalSHD.._Items where RefItemID 14682)
        --    
update RivalSHD.._Chest set ItemID 0 where ItemID IN (Select ID64 FROM RivalSHD.._Items where RefItemID 14682)
        --    
END
     
  
--  if @CharID in (select charid from _OnlineOffline where IsBug 'Bug')
  --  
begin
  
--  update _OnlineOffline set LogPoints LogPoints 1LatestLog GETDATE() where CharID = @CharID
  
--  if @CharID in (select charid from _OnlineOffline where LogPoints 5)
  --  
begin
  
--  update _OnlineOffline set IsBug 'Clean'LogPoints 0LatestLog null where CharID = @CharID
  
--  update _OnlineOffline set IsBug 'OldBug' where LatestLog GETDATE()-0.5 and IsBug 'Bug'
  
--  end
  
-- end
    
IF(@EventID 9)
    
BEGIN
     
if ((select hwanlevel from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID) <> (select LatestHwan from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID))
    
begin
    set 
@currenthwan = (select hwanlevel from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID)
    
set @Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
    if 
not exists (select CharID from RivalSHD.dbo.AchievedHwan where CharID = @CharID and HwanLevel = @currenthwan)
    
begin
    insert RivalSHD
.dbo.AchievedHwan values (@CharID, @currenthwanGETDATE())
    
end
    
if (@currenthwan in (10,12,9,27,28,31,18,35,36,32,33,34))
    
begin
    
if (@currenthwan 10)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has been proclaimed the Erius Slayer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
exec RivalSHD.._SEEK_N_DESTROY_ITEM 'ITEM_QNO_DYMEREVENT8'
    
end
    
else if (@currenthwan 12)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has slain Roc and shall keep Roc Ruler title until the next Roc is slain!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 9)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has won the weekly Super Sayan event and will keep the Super Sayan title for a week!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 27)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has won the Int Championships and earned the Int Champion title until the next Championship takes place.'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 28)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has won the Str Championships and earned the Str Champion title until the next Championship takes place.'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 31)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has earned the Maze Champion title after completing the Wizard Maze Hunt, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 18)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' is one of the ExtremePvP winners and shall keep the Imperium Knight title until the next ExtremePvP!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 35)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos 'After slaying enough Underworld Spirits, ' + @Charname ' became one of the 10 Ghost Busters, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 36)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos 'After slaying the Lost Spirit, ' + @Charname ' became the latest Soul Reaper, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
END
    
else if (@currenthwan 32)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos 'After slaying Tiger Girl and Uruchi ' + @Charname ' completed Unique Hunters I and earned the Novice Hunter title, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 33)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos 'After slaying Isyutaru, Cerberus and Ivy ' + @Charname ' completed Unique Hunters II and earned the Unique Seeker title, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
else if (@currenthwan 34)
    
begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos 'After slaying Lord Yarkan and Shaitan ' + @Charname ' completed Unique Hunters III and earned the Unique Hunter title, congratulations!' 
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(1,@veremos,'','Exodus',0)
    
end
    
declare @currenthwan2 int
    set 
@currenthwan2 = (select LatestHwan from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID)
    if (@
currenthwan2 not in (1012912327283118193635))
    
begin
    update RivalSHD
.dbo._Char set LastPermanentHwan LatestHwan where CharID = @CharID
    update RivalSHD
.dbo._Char set HwanLevel LastPermanentHwan where CharID in (select CharID from RivalSHD..AchievedHwan where HwanLevel 36 and achievedate GETDATE()-0.5) and HwanLevel 36
    delete from RivalSHD
.dbo.AchievedHwan where HwanLevel 36 and achievedate GETDATE()-0.5
    end
    end
    
if (@currenthwan in (32,33,34))
    
begin
    update RivalSHD
.dbo.AchievedHwan set achievedate GETDATE()+7 where CharID CharID and HwanLevel = @currenthwan
    end
    
IF ((select COUNT(CharIDfrom RivalSHD.dbo.AchievedHwan with (nolock)  WHERE HwanLevel 10) > and @currenthwan 10)
    
begin
    delete from RivalSHD
.dbo.AchievedHwan WHERE HwanLevel 10 and CharID <> @CharID
    update RivalSHD
.._Char set HwanLevel LastPermanentHwan where CharID <> @CharID and HwanLevel 10
    end
    
IF ((select COUNT(CharIDfrom RivalSHD.dbo.AchievedHwan with (nolock)  WHERE HwanLevel 31) > and @currenthwan 31)
    
begin
    delete from RivalSHD
.dbo.AchievedHwan WHERE HwanLevel 31 and CharID <> @CharID
    update RivalSHD
.._Char set HwanLevel LastPermanentHwan where CharID <> @CharID and HwanLevel 31
    end
    
IF (@currenthwan 35)
    
begin
    insert GhostBusterLog values 
(@CharID)
    
delete from GhostBusterLog where CharID not in (Select CharID from RivalSHD.._char with (nolockwhere HwanLevel 35)
    if ((
select COUNT(CharIDfrom GhostBusterLog) > 10)
    
begin
    
declare @cursedcharid int
    set 
@cursedcharid = (select top 1 charid from GhostBusterLog order by ID desc)
    
update RivalSHD.dbo._Char set HwanLevel LastPermanentHwan where CharID = @cursedcharid
    delete from GhostBusterLog where CharID 
= @cursedcharid
    end
    end
    update RivalSHD
.dbo._Char set LatestHwan = @currenthwan where CharID = @CharID
    
if (@currenthwan 32)
    
begin
    update RivalSHD
.dbo._Inventory set ItemID 0 where ItemID = (select id64 from RivalSHD.dbo._items where refitemid in (46628,46629,46630,46631,46632,46633,46634)) and CharID = @CharID
    end
    
if (@currenthwan 33)
    
begin
    update RivalSHD
.dbo._Inventory set ItemID 0 where ItemID = (select id64 from RivalSHD.dbo._items where refitemid in (46628,46629,46630,46631,46632,46633,46634)) and CharID = @CharID
    end
    
if (@currenthwan 34)
    
begin
    update RivalSHD
.dbo._Inventory set ItemID 0 where ItemID = (select id64 from RivalSHD.dbo._items where refitemid in (46628,46629,46630,46631,46632,46633,46634)) and CharID = @CharID
    end
    
if (@currenthwan in (106,107,108,109,110,111,112,113,115,116,117,118,129,119,120,121,122,123,124,125,126,127,128,129,130))
    
begin
    
  
if (@currenthwan 106) --MOB_CH_TIGERWOMAN
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed tiger girl and obtained the title "Tiger Girl Slayer"  and earned 2 silk untill the next Tiger Girl killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

       
else if (@currenthwan 107)--MOB_EU_KERBEROS
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Cerberus and obtained the title "Cerberus Slayer" and earned 2 silk untill the next Cerberus killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 108)--MOB_AM_IVY
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Ivy and obtained the title "Ivy Slayer" and earned 4 silk untill the next Ivy killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 109)--MOB_OA_URUCHI
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Uruchi and obtained the title "Uruchi Slayer" and earned 4 silk untill the next Uruchi killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 110)--MOB_KK_ISYUTARU
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Isyutaru and obtained the title "Isyutaru Slayer" and earned 6 silk untill the next Isyutaru killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(3,'Teleport To get your title and silk',@Charname,'Exodus',0)
    
end
    
       
else if (@currenthwan 111)--MOB_TK_BONELORD
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord Yarkan and obtained the title "Lord Yarkan Slayer" and earned 8 silk untill the next Lord Yarkan killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 112)--MOB_RM_TAHOMET
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Demon Shaitan and obtained the title "Demon Shaitan Slayer" and earned 8 silk untill the next Demon Shaitan killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 113)--COW
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Rival and obtained the title "King Of Exodus" and earned 20 silk untill the next Exodus killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 114)--MOB_RM_ROC
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Roc and obtained the title "Roc Slayer" and earned 20 silk untill the next Roc killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

       
else if (@currenthwan 115)--MOB_ARABIA_LAUNATUNE1
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Launatune and obtained the title "Launatune Slayer" and earned 10 silk untill the next Launatune killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 116)--MOB_ARABIA_HARRISON1
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Harrison and obtained the title "Harrison Slayer" and earned 10 silk untill the next Harrison killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 117)--MOB_ARABIA_VENEFICA1
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Venefica and obtained the title "Venefica Slayer" and earned 10 silk untill the next Venefica killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
       
else if (@currenthwan 118)--MOB_ARABIA_VENEFICA_DEMON1
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Demon Venefica and obtained the title "Demon Venefica Slayer" and earned 10 silk untill the next Demon Venefica killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

     
else if (@currenthwan 119)--Isis Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Isis Slayer" and earned 10 silk untill the next Isis Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
    
   
else if (@currenthwan 120)--Selket Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Selket Slayer" and earned 10 silk untill the next Selket Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

    
   
else if (@currenthwan 121)--Neith Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Neith Slayer" and earned 10 silk untill the next Neith Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

    
   
else if (@currenthwan 122)--Anubis Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Anubis Slayer" and earned 10 silk untill the next Anubis Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end
   
else if (@currenthwan 123)--Seth King Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Seth King Slayer" and earned 15 silk untill the next Seth King Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

    
   
else if (@currenthwan 124)--Salamander Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Salamander Slayer" and earned 10 silk untill the next Salamander Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

    
   
else if (@currenthwan 125)--Sylph Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Sylph Slayer" and earned 10 silk untill the next Sylph Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

    
   
else if (@currenthwan 126)--Gnome Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Gnome Slayer" and earned 10 silk untill the next Gnome Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

   
else if (@currenthwan 127)--Undine Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Undine Slayer" and earned 10 silk untill the next Undine Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

   
else if (@currenthwan 128)--Abyss Wizard Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Abyss Wizard Slayer" and earned 10 silk untill the next Abyss Wizard Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

       
else if (@currenthwan 129)--Witch of the Abyss Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Witch of the Abyss Slayer" and earned 10 silk untill the next Witch of the Abyss Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
    
end

   
else if (@currenthwan 130)--Underworld Spirit Slayer
    begin
    set 
@Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
    
set @veremos = @Charname ' has killed Lord and obtained the title "Underworld Spirit Slayer" and earned 10 silk untill the next Underworld Spirit Slayer killer!'
    
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
    
(6,@veremos,'','Exodus',0)
  
END
  end
  END
  END

    
/*EVENTS*/
    
IF (@EventID 19) and (@Data2 1)
    
begin
    
if exists (select Charname from TemporalJobEventKill with (nolockwhere CharID = @CharID)
    
BEGIN
    set 
@jobtype = (select JobType from RivalSHD.dbo._CharTrijob where charid = @CharID)
    
update TemporalJobEventKill set KillAmount KillAmount 1JobType = @jobtype where CharID = @CharID
        
if (@jobtype 1)
        
begin
        update RivalSHD
.dbo.JobWarEventDistribution
        set KillsAmount 
KillsAmount 1
        where EventID 
= (select EventID from RivalSHD.DBO.JobWarEventLog where Status in ('DailyOpen''WeeklyOpen'))
        and 
JobType 'TraderKills'
        
end
    
if (@jobtype 2)
    
begin
    update RivalSHD
.dbo.JobWarEventDistribution
    set KillsAmount 
KillsAmount 1
        where EventID 
= (select EventID from RivalSHD.DBO.JobWarEventLog where Status in ('DailyOpen''WeeklyOpen'))
        and 
JobType 'ThiefKills'
        
end
        
if (@jobtype 3)
         
begin
        update RivalSHD
.dbo.JobWarEventDistribution
        set KillsAmount 
KillsAmount 1
        where EventID 
= (select EventID from RivalSHD.DBO.JobWarEventLog where Status in ('DailyOpen''WeeklyOpen'))
        and 
JobType 'HunterKills'
        
end
    END
    End 
    
/*ONLINE OFFLINE*/

    
IF (@CharID IN (select charid from RivalSHD.dbo._User with (nolockwhere UserJID in (select JID from RivalACC.dbo.TB_User with (nolockwhere sec_content <> 3)))
    
BEGIN
    
if not exists (select charid from RivalSHD.dbo._Inventory where ItemID in (select id64 from RivalSHD.dbo._items where RefItemID 35592) AND CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
exec RivalSHD.dbo._ADD_ITEM_EXTERN @CharnameITEM_EVENT_GLOBAL_CHATTING01
        end
    
if not exists (select CharID from OnlineGMTime where CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
INSERT INTO OnlineGMTime (CharIDCharname, [Status], [Date], mOnline, [stillOnline@])
        
VALUES (
                @
CharID,
                @
Charname,
                
'Online',
                
GETDATE(),
                
NULLGETDATE()
                );
        
end
        
else
        
begin 
        
        
IF (@CharID IN (select charid from RivalSHD.dbo._User with (nolockwhere UserJID in (select JID from RivalACC.dbo.TB_User with (nolockwhere sec_content in (89))))
    
BEGIN
        
if not exists (select CharID from OnlineGMTime where CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
INSERT INTO OnlineGMTime (CharIDCharname, [Status], [Date], mOnline, [stillOnline@])
        
VALUES (
                @
CharID,
                @
Charname,
                
'Online',
                
GETDATE(),
                
NULLGETDATE()
                );
        
end
        end
        end
    END    

    
/*PROTECT*/
    
IF (@CharID IN (select charid from RivalSHD.dbo._User with (nolockwhere UserJID in (select JID from RivalACC.dbo.TB_User with (nolockwhere sec_content in (10,660,890)))) 
    
BEGIN
        
if not exists (select charid from RivalSHD.dbo._Inventory where ItemID in (select id64 from RivalSHD.dbo._items where RefItemID 35592) AND CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        --
exec RivalSHD.dbo._ADD_ITEM_EXTERN @CharnameITEM_EVENT_GLOBAL_CHATTING020
        end
        
if not exists (select CharID from OnlineGMTime where CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
INSERT INTO OnlineGMTime (CharIDCharname, [Status], [Date], mOnline, [stillOnline@])
        
VALUES (
                @
CharID,
                @
Charname,
                
'Online',
                
GETDATE(),
                
NULLGETDATE()
                );
        
end
        
else
        
begin 
        
        
IF (@CharID IN (select charid from RivalSHD.dbo._User with (nolockwhere UserJID in (select JID from RivalACC.dbo.TB_User with (nolockwhere sec_content in (66))))
    
BEGIN
        
if not exists (select CharID from OnlineGMTime where CharID = @CharID)
        
begin
        set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
INSERT INTO OnlineGMTime (CharIDCharname, [Status], [Date], mOnline, [stillOnline@])
        
VALUES (
                @
CharID,
                @
Charname,
                
'Online',
                
GETDATE(),
                
NULLGETDATE()
                );
        
end
        end
        

        
IF (@EventID OR @EventID 6)
    
BEGIN

    
IF (@EventID AND ((SELECT [StatusFROM OnlineGMTime  with (nolockWHERE CharID = @CharIDlike 'Online'))
        
BEGIN
            UPDATE OnlineGMTime
            SET
                
[Status] = 'Offline',
                [
stillOnline@] = NULL
            WHERE CharID 
= @CharID    
        END
        
    
IF (@EventID 4)
        
BEGIN
            UPDATE OnlineGMTime
            SET 
                
[Status] = 'Online',
                [
Date] = GETDATE(),
                [
stillOnline@] = GETDATE()
            
WHERE CharID = @CharID
        END
        
    END
    end
    
    UPDATE OnlineGMTime
SET 
    
[mOnline] = CAST((DATEDIFF(MINUTE,[Date],GETDATE()))as varchar(max)) + ' minute(s) Online',
    [
stillOnline@] = GETDATE(),
    [
Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE()))
WHERE [Statuslike 'Online'
    
end
        
/*ONLINE OFFLINE*/
IF not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID) and ((select CurLevel from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID) > 89)
    
BEGIN
        set 
@JID21 = (select UserJID from RivalSHD.dbo._User with (nolockwhere CharID = @CharID)
        
set @AccountID = (select AccountID from RivalSHD.dbo._AccountJID with (nolockwhere JID = @JID21)
        
INSERT INTO _OnlineOffline (CharIDCharname, [Status], [Date], [Minutes], [tMinutes], eSilkmOnline, [Silk/Hour], [stillOnline@],LogPointsRegDateDailyGrantedSilksAccountID)
        
VALUES (
                @
CharID,
                (
SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID),
                
'OnHold',
                
GETDATE(),
                
0,0,0,
                
null,2,
                
GETDATE(), 0GETDATE(), 0, @AccountID
                
);
    
END
IF (@EventID OR @EventID 6)
    
BEGIN

    
IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline  with (nolockWHERE CharID = @CharIDlike 'OnHold'))
        
BEGIN
            UPDATE _OnlineOffline
            SET 
[Status] = 'Offline'
            
WHERE CharID = @CharID
        END
        
    
IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline  with (nolockWHERE CharID = @CharIDlike 'Online'))
        
BEGIN
            UPDATE _OnlineOffline
            SET
                
[Status] = 'Offline',
                [
Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
                [
tMinutes] = [tMinutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
                [
mOnline] = NULL,
                [
stillOnline@] = NULL,
                [
LastOnline] = GETDATE()
            
WHERE CharID = @CharID   
            
            
            
if not exists (Select CharID from RivalSHD.dbo.JobRegisterTable with (nolockwhere CharID = @CharID)
            
begin 
            set 
@JID21 = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
            
set @AccountID2 = (select AccountID from RivalSHD.dbo._AccountJID where JID = @JID21)
            
set @jobExperience 0
            set 
@jobtopposition 0
            set 
@jobtype1 = (select JobType from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @joblevel = (Select Level from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @Latestcontributionamount = (select Contribution from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @latestcoinsgranted 0
            set 
@weeklycoinsgranted = @latestcoinsgranted
            set 
@weeklycontributionamount = @Latestcontributionamount
            set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
            
insert RivalSHD.dbo.JobRegisterTable (CharIDCharnameJobExperienceJobTopPositionJobTypeLatestContributionAmountLatestCoinsGrantedWeeklyCoinsGrantedWeeklyContributionAmountLatestRewardedDateRemainRewardAmount, [12hStartDate], ContributionIn12hIsPenalizedJobLevelAccountIDIsCheater)
            
values (@CharID, @Charname, @jobExperience, @jobtopposition, @jobtype1, @Latestcontributionamount, @latestcoinsgranted, @weeklycoinsgranted, @weeklycontributionamountGETDATE(), @LatestContributionAmountGETDATE(), 00,@joblevel, @AccountID20)
            
end
            
            
if exists (Select CharID from RivalSHD.dbo.JobRegisterTable with (nolockwhere CharID = @CharID and IsPenalized 1)
            
begin
            set 
@Latestcontributionamount = (Select Contribution from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @jobtype = (Select JobType from RivalSHD.dbo.JobRegisterTable where CharID = @CharID)
            
set @jobtype1 = (Select PenalizedJobType from RivalSHD.dbo.JobRegisterTable where CharID = @CharID)
            
set @Latestcontributionamount = (@Latestcontributionamount / (select ContributionPerCoin from RivalSHD..NewRates where JobType = @jobtype1)) * (select ContributionPerCoin from RivalSHD..NewRates where JobType = @jobtype)
            --
update RivalSHD.dbo._CharTrijob set Contribution 0 where CharID = @CharID
            update RivalSHD
.dbo.JobRegisterTable set IsPenalized 0RemainRewardAmount = @Latestcontributionamount RemainRewardAmount where CharID = @CharID
            end
            
            
if exists (Select CharID from RivalSHD.dbo.JobRegisterTable with (nolockwhere CharID = @CharID and IsPenalized <> 1)
            
begin 
            
            set 
@JID21 = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
            
update RivalSHD.dbo._Chest set ItemID Null where ItemID 0
            update RivalSHD
.dbo.JobRegisterTable set RemainRewardAmount 0 where RemainRewardAmount is null or RemainRewardAmount 0
            
if exists (select UserJID from RivalSHD.dbo._Chest where UserJID = @JID21 and ItemID is Null)
            
begin
            
if (@CharID in (select CharID from RivalSHD..JobRegisterTable where IsCheater and CheaterFlagDateEnd GETDATE()))
            
begin
            set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
            
update RivalSHD..JobRegisterTable set IsCheater 0 where CharID = @CharID
            update RivalSHD
.._Char set NickName16 CharName16 where CharID = @CharID
            update RivalLOG
..ThiefJobRiskStatus set [1to5minuteRobs] = 0ClonePasswordTheftPoints 0 where Charname = @Charname
            end
            
if (@CharID not in (select CharID from RivalSHD..JobRegisterTable where IsCheater 1))
            
begin
            set 
@jobtopposition 0
            set 
@jobtype1 = (select JobType from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @joblevel = (Select Level from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @Latestcontributionamount = (select Contribution from RivalSHD.dbo._CharTrijob where CharID = @CharID)
            
set @totalcontribution = @Latestcontributionamount + (select RemainRewardAmount from RivalSHD.dbo.JobRegisterTable where CharID = @CharID)
            if (@
jobtype1 1)
            
begin
            set 
@latestcoinsgranted = ((select CAST (@totalcontribution as float))/(select TraderCoinRate from RivalSHD.dbo.JobRates))
            
set @latestcoinsgranted = @latestcoinsgranted - (select @latestcoinsgranted 1)
            
set @RemainRewardAmount = @totalcontribution - (select @latestcoinsgranted*(select TraderCoinRate from RivalSHD.dbo.JobRates))
            
end
            
if (@jobtype1 2)
            
begin
            set 
@latestcoinsgranted = ((select CAST (@totalcontribution as float))/(select ThiefCoinRate from RivalSHD.dbo.JobRates))
            
set @latestcoinsgranted = @latestcoinsgranted - (select @latestcoinsgranted 1)
            
set @RemainRewardAmount = @totalcontribution - (select @latestcoinsgranted*(select TraderCoinRate from RivalSHD.dbo.JobRates))
            
end
            
if (@jobtype1 3)
            
begin
            set 
@latestcoinsgranted = ((select CAST (@totalcontribution as float))/(select HunterCoinRate from RivalSHD.dbo.JobRates))
            
set @latestcoinsgranted = @latestcoinsgranted - (select @latestcoinsgranted 1)
            
set @RemainRewardAmount = @totalcontribution - (select @latestcoinsgranted*(select TraderCoinRate from RivalSHD.dbo.JobRates))
            
end
            
if (@latestcoinsgranted 1)
            
begin
            set 
@latestcoinsgranted 0
            set 
@RemainRewardAmount = (select RemainRewardAmount from RivalSHD.dbo.JobRegisterTable where CharID = @CharID) + @Latestcontributionamount
            end
            
if (@jobtype1 in (1,2,3))
            
begin
            set 
@AccountID2 = (select AccountID from RivalSHD.dbo._AccountJID where JID = @JID21)
            
set @weeklycoinsgranted = (select sum(WeeklyCoinsGrantedfrom RivalSHD.dbo.JobRegisterTable where AccountID = @AccountID2) + @latestcoinsgranted
            set 
@weeklycontributionamount = (select WeeklyContributionAmount from RivalSHD.dbo.JobRegisterTable where CharID = @CharID) + @Latestcontributionamount
            set 
@Coinlimit 150 - @weeklycoinsgranted
            set 
@jobExperience = (select [Expfrom RivalSHD.dbo._CharTrijob where CharID = @CharID)
            if (@
jobtype1 1)
            
begin
            update RivalSHD
.dbo.JobRegisterTable set TraderWeekly TraderWeekly + (@latestcoinsgranted * (select ContributionPerCoin from RivalSHD..NewRates where JobType = @jobtype1)) where CharID = @CharID
            
--update RivalSHD.dbo._CharTrijob set Contribution 0 where CharID = @CharID
            
if (@charid in (select charid from RivalSHD.dbo.JobRegisterTable where IsCapped 1))
            
begin
            update RivalSHD
.dbo.JobRegisterTable set RemainRewardAmount 0 where CharID = @CharID
            end
            end
            
if (@jobtype1 2)
            
begin
            update RivalSHD
.dbo.JobRegisterTable set ThiefWeekly ThiefWeekly + (@latestcoinsgranted * (select ContributionPerCoin from RivalSHD..NewRates where JobType = @jobtype1)) where CharID = @CharID
         
--   update RivalSHD.dbo._CharTrijob set Contribution 0 where CharID = @CharID
            
if (@charid in (select charid from RivalSHD.dbo.JobRegisterTable where IsCapped 1))
            
begin
            update RivalSHD
.dbo.JobRegisterTable set RemainRewardAmount 0 where CharID = @CharID
            end
            end
            
if (@jobtype1 3)
            
begin
            update RivalSHD
.dbo.JobRegisterTable set HunterWeekly HunterWeekly + (@latestcoinsgranted * (select ContributionPerCoin from RivalSHD..NewRates where JobType = @jobtype1)) where CharID = @CharID
        
--    update RivalSHD.dbo._CharTrijob set Contribution 0 where CharID = @CharID
            
if (@charid in (select charid from RivalSHD.dbo.JobRegisterTable where IsCapped 1))
            
begin
            update RivalSHD
.dbo.JobRegisterTable set RemainRewardAmount 0 where CharID = @CharID
            end
            end
            update RivalSHD
.dbo.JobRegisterTable set JobLevel = @joblevelWeeklyContributionAmount = @weeklycontributionamountLatestContributionAmount = @LatestcontributionamountJobType = @jobtype1RemainRewardAmount = @RemainRewardAmountAccountID = @AccountID2 where CharID = @CharID
            
if (@jobtype1 and @latestcoinsgranted >= 1)
            
begin
            set 
@Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
            
insert RivalSHD..ThiefCoinLog values (@Charname, @CharID, @latestcoinsgrantedGETDATE())
            
end
            
if (@jobExperience 2147483647)
            
begin
            update RivalSHD
.dbo._CharTrijob set [Exp] = 2147483647 where CharID = @CharID
            update RivalSHD
.dbo.JobRegisterTable set JobExperience JobExperience + (2147483647 - @jobExperience)
            
end
            
if (@jobExperience 0)
            
begin
            update RivalSHD
.dbo._CharTrijob set [Exp] = 2147483647 where CharID = @CharID
            end
            
DECLARE
            @
ContributionxD int = (select Contribution from rivalshd.dbo._CharTrijob where CharID = @CharID)
            if (@
Coinlimit and @latestcoinsgranted >= 1) AND (@ContributionxD >= '14318688')
            
begin
         
--   update RivalSHD.dbo._CharTrijob set Contribution 0 where CharID = @CharID
            update RivalSHD
.dbo.JobRegisterTable set WeeklyCoinsGranted = @weeklycoinsgrantedLatestCoinsGranted = @latestcoinsgrantedLatestRewardedDate GETDATE(), RemainRewardAmount = @RemainRewardAmount where CharID = @CharID
            exec RivalSHD
.DBO._ADD_ITEM_EXTERN_CHEST @AccountID2'ITEM_ETC_ARENA_COIN', @latestcoinsgranted0
            end
            
if (@Coinlimit and @latestcoinsgranted <> 0) AND (@ContributionxD >= '14318688')
            
begin
            set 
@latestcoinsgranted 150 - (select sum(WeeklyCoinsGrantedfrom RivalSHD.dbo.JobRegisterTable where AccountID = @AccountID2)
            if (@
latestcoinsgranted >= 1)
            
begin
            update RivalSHD
.dbo.JobRegisterTable set WeeklyCoinsGranted 150LatestCoinsGranted = @latestcoinsgrantedLatestRewardedDate GETDATE(), AccountID = @AccountID2 where CharID = @CharID
            exec RivalSHD
.DBO._ADD_ITEM_EXTERN_CHEST @AccountID2'ITEM_ETC_ARENA_COIN', @latestcoinsgranted0
            end
            end
            
if (@Coinlimit <= 0)
            
begin
            update RivalSHD
..JobRegisterTable set IsCapped 1 where AccountID = @AccountID2
            end
            end
            end
            end
            end
            

        END
        
    
IF (@EventID 4)
        
BEGIN
            UPDATE _OnlineOffline
            SET 
                
[Status] = 'Online',
                [
Date] = GETDATE(),
                [
stillOnline@] = GETDATE()
            
WHERE CharID = @CharID
         update RivalSHD
.dbo._Char set HwanLevel 0 where CharID in (Select CharID from RivalSHD.dbo.AchievedHwan where achievedate GETDATE() and HwanLevel in (32,33,34)) and HwanLevel in (32,33,34)
         
update RivalSHD.dbo._Char set LatestHwan 0 where CharID in (Select CharID from RivalSHD.dbo.AchievedHwan where achievedate GETDATE() and HwanLevel in (32,33,34)) and LatestHwan in (32,33,34)
        
END
    END

        
/*REWARDS*/
        
if (@CharID in (select CharID from RivalSHD.dbo._TimedJob with (nolockwhere CharID = @CharID and JobID in (12)))
        
begin
        update RivalSHD
.dbo._TimedJob set TimeToKeep 0 where CharID = @CharID and JobID in (12)
        
end
        
        
if (@CharID in (select Charid from RivalSHD.dbo._Char with (NOLOCKwhere IsJobWinner 1))
        
begin
        set 
@JID = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
        
set @JobDate GETDATE()
        
set @EventID32 = (select top 1 EventID from RivalSHD.dbo.JobWarEventLog order by EventID desc)
        
set @RewardGiven 'ITEM_ETC_ARENA_COIN'
        
set @AccountID = (select AccountID from RivalSHD.dbo._AccountJID where JID = @JID)
        
set @Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
update RivalSHD.dbo._Char set IsJobWinner 0 where CharID = @CharID
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven10
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID'ITEM_ETC_ARENA_COIN'10
        update RivalSHD
.dbo.JobWarParticipantLog set LatestCoinReward '1ArenaCoin' where Charname = @Charname
        end
    
        
        
if (@CharID in (select CharID from RivalSHD.dbo._Char with (NOLOCKwhere IsJobWinner 3))
        
begin
        set 
@JID = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
        
set @JobDate GETDATE()
        
set @EventID32 = (select top 1 EventID from RivalSHD.dbo.JobWarEventLog order by EventID desc)
        
set @RewardGiven = (select top 1 Rewardcodename from RivalSHD.dbo.EventRewardList where EventType 'DailyJobWar' order by NEWID())
        
set @RewardAmount = (select top 1 RewardAmount from RivalSHD.dbo.EventRewardList where Rewardcodename = @RewardGiven and EventType 'DailyJobWar')
        
set @AccountID = (select AccountID from RivalSHD.dbo._AccountJID where JID = @JID)
        
set @Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
set @LatestKillCount = (select LatestKillAmount from RivalSHD.dbo.JobWarParticipantLog where Charname = @Charname)/3
        update RivalSHD
.dbo._Char set IsJobWinner 0 where CharID = @CharID
        
if @LatestKillCount 0
        begin
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID'ITEM_ETC_ARENA_COIN', @LatestKillCount0
        set 
@LatestKillCount = @LatestKillCount 2
        exec RivalACC
.dbo._extraSilk2 @CharID, @LatestKillCount
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, @RewardAmount0
        update RivalSHD
.dbo.JobWarParticipantLog set RewardGiven = @RewardGiven
        end
        end
        
        
if (@CharID in (select CharID from RivalSHD.dbo._Char with (NOLOCKwhere IsJobWinner 2))
        
begin
        set 
@JID = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
        
set @JobDate GETDATE()
        
set @EventID32 = (select top 1 EventID from RivalSHD.dbo.JobWarEventLog order by EventID desc)
        
set @RewardGiven = (select top 1 Rewardcodename from RivalSHD.dbo.EventRewardList where EventType 'WeeklyJobWar' order by NEWID())
        
set @RewardAmount = (select top 1 RewardAmount from RivalSHD.dbo.EventRewardList where Rewardcodename = @RewardGiven and EventType 'WeeklyJobWar' order by NEWID())
        
set @RewardPlus = (select top 1 OptLevel from RivalSHD.dbo.EventRewardList where Rewardcodename = @RewardGiven and EventType 'WeeklyJobWar' order by NEWID())
        
set @AccountID = (select AccountID from RivalSHD.dbo._AccountJID where JID = @JID)
        
set @Charname = (SELECT CharName16 FROM RivalSHD.dbo._Char with (nolockWHERE CharID = @CharID)
        
set @LatestKillCount ROUND((select LatestKillAmount from RivalSHD.dbo.JobWarParticipantLog where Charname = @Charname)/10,0)
        
update RivalSHD.dbo._Char set IsJobWinner 0 where CharID = @CharID
        
if @LatestKillCount 0
        begin
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID'ITEM_ETC_ARENA_COIN', @LatestKillCount0
        set 
@LatestKillCount = @LatestKillCount 2
        set 
@LatestKillCount = @LatestKillCount 2
        exec RivalACC
.dbo._extraSilk2 @CharID, @LatestKillCount
        exec RivalSHD
.dbo._ADD_ITEM_EXTERN_CHEST @AccountID, @RewardGiven, @RewardAmount, @RewardPlus
        update RivalSHD
.dbo.JobWarParticipantLog set RewardGiven = @RewardGivenAmountGiven = @RewardAmount where Charname = @Charname
        end
        end

            
/*ONLINE OFFLINE*/
IF (@EventID OR @EventID 6)
    
BEGIN

    
IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike 'OnHold'))
        
BEGIN
            UPDATE _OnlineOffline
            SET 
[Status] = 'Offline'
            
WHERE CharID = @CharID
        END
        
IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline  with (nolockWHERE CharID = @CharIDlike 'Online'))
        
BEGIN
            UPDATE _OnlineOffline
            SET
                
[Status] = 'Offline',
                [
Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
                [
tMinutes] = [tMinutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
                [
mOnline] = NULL,
                [
stillOnline@] = NULL
            WHERE CharID 
= @CharID
             
            END
        
    
IF (@EventID 4)
        
BEGIN
            UPDATE _OnlineOffline
            SET 
                
[Status] = 'Online',
                [
Date] = GETDATE(),
                [
stillOnline@] = GETDATE()
            
WHERE CharID = @CharID
            
if (@CharID in (select charid from TopJobbers where TopNo 0))
            
begin
            update RivalSHD
.._Char set NickName16 CharName16 where CharID = @CharID
            delete from TopJobbers where CharID 
= @CharID
            end
            
if (@CharID in (select charid from TopJobbers where TopNo <> 0))
            
begin
            set 
@Charname = (select Charname16 from RivalSHD.._Char where CharID = @CharID)
            DECLARE
             @
TopNo1 int = (select TopNo from TopJobbers where CharID = @CharID),
             @
TopNo varchar(max) = '[' convert(varchar(max),(select TopNo from TopJobbers where CharID = @CharID)) + ']'
            
update RivalSHD.._Char set NickName16 = @TopNo + @Charname where CharID = @CharID
            delete from TopJobbers where CharID 
= @CharID
            end
            update _OnlineOffline set IsBug 
'Bug'LogPoints 1LatestLog GETDATE() where CharID = @CharID
        END
    END
if ((select CurLevel from RivalSHD.dbo._Char with (nolockwhere CharID = @CharID) = 90)
begin
UPDATE _OnlineOffline
SET 
    
[mOnline] = CAST((DATEDIFF(MINUTE,[Date],GETDATE()))as varchar(max)) + ' minute(s) Online',
    [
Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
    [
tMinutes] = [tMinutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())),
    [
stillOnline@] = GETDATE()
WHERE Status 'Online' AND CharID = @CharID

/*Silk/Hour basic calc*/
/*Calculation of the silk amount*/
    
DECLARE
    @
tMinutes bigint = (SELECT [Minutesfrom _OnlineOffline WHERE CharID = @CharID), @Silk int
    @
earnedsilk int
    @
cursilkperhour int ;
            if ((
select latestJobTitledate from TimedEvents) < GETDATE()) and ((SELECT DATENAME(WEEKDAYGETDATE())) = 'Sunday')
            
begin
            update TimedEvents set latestJobTitledate 
GETDATE() + 5
            update RivalSHD
.dbo._Char set HwanLevel LatestHwan where HwanLevel in (1,2,3)

            
set @Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 3 order by HunterWeekly desc))
            
set @veremos = @Charname ' is the top Hunter of the week and shall now keep the Grand Marshall as a title for a week!'
            
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
            
(1,@veremos,'','Exodus',0)

            
set @Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 1 order by TraderWeekly desc))
            
set @veremos = @Charname ' is the top Trader of the week and shall now keep the Dynasty Merchant as a title for a week!'
            
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
            
(1,@veremos,'','Exodus',0)


            
set @Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 2 order by ThiefWeekly desc))
            
set @veremos = @Charname ' is the top Thief of the week and shall now keep the Bandit King as a title for a week!'
            
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
            
(1,@veremos,'','Exodus',0)
                        
            
update RivalSHD.dbo._Char set HwanLevel 1 where CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 3 order by HunterWeekly desc
            
update RivalSHD.dbo._Char set HwanLevel 2 where CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 1 order by TraderWeekly desc
            
update RivalSHD.dbo._Char set HwanLevel 3 where CharID = (select top 1 CharID from RivalSHD.dbo.JobRegisterTable where JobType 2 order by ThiefWeekly desc
            
update RivalSHD.dbo.JobRegisterTable set WeeklyContributionAmount 0TraderWeekly 0HunterWeekly 0ThiefWeekly 0WeeklyCoinsGranted 0RemainRewardAmount 0JobExperience 0
            end
        
IF (@tMinutes >= 120)
            
BEGIN
                
DECLARE
                @
totalminutes int = (Select tMinutes from _OnlineOffline where CharID = @CharID),
                @
silklimit int = (select Limit from SilkPerHourConfig where WEEKDAYS = (select DATENAME(WEEKDAYGETDATE())))
                
set @cursilkperhour = (Select DefaultSilk from SilkPerHourConfig where Weekdays = (SELECT DATENAME(WEEKDAYGETDATE())))
                
SET @Silk CAST(((SELECT [MinutesFROM _OnlineOffline WHERE CharID = @CharID) / 60) as int)
                
set @JID = (select UserJID from RivalSHD.dbo._User where CharID = @CharID)
                
set @AccountID = (select AccountID from RivalSHD.._AccountJID where JID = @JID)
                
set @earnedsilk = (@Silk*@cursilkperhour)
                
UPDATE _OnlineOffline
                SET 
[Minutes] = 0
                WHERE CharID 
= @CharID
                    UPDATE _OnlineOffline
                    SET 
[eSilk] = [eSilk] + @earnedsilk
                    WHERE CharID 
= @CharID
                exec RivalACC
.dbo._extraSilk @CharID, @earnedsilk,@JID
                update _OnlineOffline set DailyGrantedSilks 
DailyGrantedSilks + @earnedsilk where CharID = @CharID
             end
                
                
        
if not exists (Select from SilkperhourDailyAmounts where Day GETDATE())
            
begin
            insert SilkperhourDailyAmounts values 
(0GETDATE()+1)
            
update _OnlineOffline set DailyGrantedSilks 0
            end
        
if exists (Select from SilkperhourDailyAmounts where Day GETDATE())
            
begin
            
DECLARE
            @
silkperhourid int
            set 
@silkperhourid = (Select top 1 ID from SilkperhourDailyAmounts order by ID desc)
            
update SilkperhourDailyAmounts set SilkAmount SilkAmount + @Silk where ID = @silkperhourid
            end
            
        END
            
            
/*JOB*/
        
if ((select latestJobTagdate from TimedEvents) < (select GETDATE()))
        
begin
        update TimedEvents set latestJobTagdate 
latestJobTagdate 1
        delete from TopJobbers
        
declare @designatedCharID int 0
        
while @designatedCharID <> null
        begin
        insert TopJobbers 
(CharIDTopNovalues ((select top 1 CharID from RivalSHD.._Char where NickName16 <> CharName16), 0)
        
set @designatedCharID = (select top 1 CharID from RivalSHD.._Char where NickName16 <> CharName16)
        
end
        
        insert TopJobbers values 
((select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount desc), 1
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType 2 order by WeeklyContributionAmount desc), 1
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType 3 order by WeeklyContributionAmount desc), 1
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 2
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 2
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 2
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 3
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 3
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 3
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 4
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 4
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 4
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 5
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 5
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 5
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 6
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 6
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 6
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 7
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 7
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 7
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 8
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 8
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 8
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 9
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 9
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 9
        
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 10
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 10
        
insert TopJobbers values ((select top 1 CharID from RivalSHD..JobRegisterTable where JobType and CharID not in (select top 1 CharID from RivalSHD..JobRegisterTable where JobType 1 order by WeeklyContributionAmount descorder by WeeklyContributionAmount desc), 10
        
        
        
end
        
/*BUG PROTECT*/
        
if (@EventID 11) and (@Data1 3)
        
begin
        
if ((select latestregion from RivalSHD.._Char with (nolockwhere CharID = @CharIDin (25761,24993,25244,24734,23183,23180,23436,23439,24438,23929,22390,22137))
begin
if not exists (Select CharID from RivalSHD..JobTeleportPenaltyLog where CharID = @CharID)
begin
insert RivalSHD
..JobTeleportPenaltyLog values (@CharIDGETDATE(), 00)
end
declare @latestteleport datetime = (select LatestTeleportDate from RivalSHD..JobTeleportPenaltyLog where CharID = @CharID)
update RivalSHD..JobTeleportPenaltyLog set AccumulatedMinuteTeleport 0 where LatestTeleportDate GETDATE()-0.00068
update RivalSHD
..JobTeleportPenaltyLog set AccumulatedMinuteTeleport AccumulatedMinuteTeleport 1 where CharID = @CharID and (select DATEDIFF(Second, @latestteleportGETDATE())) < 60
if exists (select CharID from RivalSHD..JobTeleportPenaltyLog where CharID = @CharID and AccumulatedMinuteTeleport 2)
begin
update RivalSHD
.._Char set PKPenaltyPoint PKPenaltyPoint 15 where CharID = @CharID
end
end
end
/*Essentilas*/
IF((@EventID NOT BETWEEN 23 AND 27) AND
   (@
EventID NOT BETWEEN 200 AND 202) AND
   (@
EventID NOT BETWEEN 204 AND 206) AND 
   (@
EventID != 210) AND (@EventID != 214) AND (@EventID != 244) and (@EventID != 21))
    
begin
           
DECLARE
         @
len_pos     int,
         @
len_desc    int
        select 
@len_pos len(@strPos),
        @
len_desc len(@Desc)
        if (@
len_pos and @len_desc 0)
        
begin    
            insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2EventPosstrDescvalues (@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)    
        
end
        
else if (@len_pos and @len_desc 0)
        
begin     
            insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2EventPosstrDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)
        
end
        
else if (@len_pos and @len_desc 0)
        
begin     
            insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2strDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @Desc)
        
end
        
else
        
begin
            insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2values(@CharIDGetDate(), @EventID, @Data1, @Data2)
        
end
    end
--------------------------------------------------------------------------------------------------
------------------------ 
IPLog System
IF @EventID 4        /*This eventID is triggered whenever a character logs in*/ 
    
BEGIN 
    
DECLARE
     @
Cname varchar(50) = (SELECT Charname16 from RivalSHD.dbo._Char WHERE CharID=@CharID), 
     @
IP bigint = @Data2,
     @
ip1 int,
     @
ip2 int,       
     @
ip3 int,                 
     @
ip4 int,
     @
LeftOver bigint,
     @
finalip varchar(50); 
        
SET @ip1 = @IP 16777216  /*First IP segment*/ 
        
SET @LeftOver = @IP - (@ip1 16777216)  
        
SET @ip2 = @LeftOver 65536 /*Second IP segment*/ 
        
SET @LeftOver = @LeftOver - (@ip2 65536
        
SET @ip3 = @LeftOver 256 /*Third IP segment*/ 
        
SET @ip4 = @LeftOver - (@ip3 256/*Fourth IP segment*/ 
         
        
SET @finalip =  /*Putting the segments together and reversing them*/ 
        
CONVERT(varchar, @ip4)+ 
        
'.'+CONVERT(varchar, @ip3)+ 
        
'.'+CONVERT(varchar, @ip2)+ 
        
'.'+CONVERT(varchar, @ip1

    
INSERT INTO RivalLOG.dbo._IP_LOGS (CharName,IP,LogTimevalues (@Cname,@finalip,GETDATE()) 
    
END 
/*    -- AutoEquipMent 
if @EventID = '22' and @Data2 > @Data1 and @Data2 between '0' and '98'  
begin 
exec zealous.dbo.[_AUTO_EQUIPMENT] @Data2,@CharID 
end*/
 
--If ( @Data1=@Data2-AND @Data2 = @Data1+AND @Data2 <= 84 AND @EventID 22 AND @Data2 10 BEGIN
-- Exec rivalshd.dbo._RoyalAutoEquipment @CharID, @Data2
 
--end
 
IF @EventID '22' and @Data2 > @Data1 and @Data2 between '0' and '87'  
 
BEGIN 
 EXEC SRO_VT_ERIUS
.dbo._AutoEquipt @CharID,@Data2
 END
/*---------- FIRST 200 Player Got lv100    
  IF @EventID = '22' and @Data2 = '100'
    BEGIN
    EXEC zealous.._ExodusOne @CharID,@EventID,@Data2
    END*/
         
--- Wanted System        
if @EventID '19'   -- Count kills
      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
        
        
DECLARE @ReqLevel INT =0
        SELECT 
@KilledName REPLACE(@KilledNameLEFT(@KilledNameCHARINDEX('(', @KilledName)), '')
        
SELECT @KilledName REPLACE(@KilledNameRIGHT(@KilledNameCHARINDEX(')'REVERSE(@KilledName))), '')
        
SELECT @ReqLevel CurLevel FROM [RivalSHD].[dbo].[_CharWHERE CharName16 = @KilledName
        
if @ReqLevel >= 85
        BEGIN
      Exec RivalLOG
.dbo.[_Wanted] @CharID , @EventID , @Desc
           End
             END
               END
                 
if @EventID '20' -- if dies
if (@EventID between 9 and 11)
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
    UPDATE _RowKills SET Kills 
'0' WHERE KillerID = @CharID
    
IF EXISTS (SELECT FROM RivalSHD.dbo._TimedJob WHERE CharID = @CharID AND JobID '33862' or CharID = @CharID and JobID between '50021' and '50024')
      
BEGIN
       DELETE FROM RivalSHD
.dbo._TimedJob WHERE CharID = @CharID and JobID '33862' or CharID = @CharID and JobID between '50021' and '50024' 
           
END
              END
                 END
    
DECLARE
    @
DynIP VARCHAR(12),
    @
CosID int,
    @
COSlevel TINYINT,
    @
Aha INT,
    @
PetOption tinyint,
    @
CharName1 Varchar(64),
    @
CharLevel1 tinyint = (SELECT CurLevel from RivalSHD.dbo._Char WHERE CharID = @CharID)
    
    
     IF (@
EventID 4)
     
BEGIN
        SELECT 
@CharName1 CharName16 FROM RivalSHD.dbo._Char WHERE CharID = @CharID
        exec 
@DynIP RivalACC.dbo.split_ip @Data2  
        INSERT INTO _IPLogs 
(CharID,Charname,IP,[Date]) VALUES (@CharID, @CharName1, @DynIPGETDATE())
    
END
    
     
IF (@EventID 6)
        
BEGIN
            DELETE FROM  _IPLogs WHERE CharID 
= @CharID
        END
    

    
/*ACADEMY*/
if @EventID '19'   -- Count kills
DECLARE
 @
Kc int    
 @
K_Name VARCHAR(512) = @Desc
        SELECT 
@K_Name REPLACE(@K_NameLEFT(@K_NameCHARINDEX('(', @K_Name)), '')
        
SELECT @K_Name REPLACE(@K_NameRIGHT(@K_NameCHARINDEX(')'REVERSE(@K_Name))), '')
  ----- 
Killed CharID
        
DECLARE @K_CharID INT =(SELECT  CharID FROM [RivalSHD].[dbo].[_CharWHERE CharName16 = @K_Name
  ------
 -- 
Check if he kills the char more than 3 times  
 
DECLARE
  @
PKill int = (select COUNT(*) from RivalLOG..Chetito where KillerID = @CharID and KilledID = @K_CharID),    
  @
MaxK int = (select COUNT(Killsfrom RivalLOG..Chetito where KillerID = @CharID and Kills '1')  
if @
EventID '19'  
    
BEGIN
INSERT INTO RivalLOG
..Chetito (KillerID KilledID KillsVALUES (@CharID , @K_CharID,'1')
            
END    
            
-- #########################################
            /*Hounr By Kills*/
            
-- #########################################
            
set @Charname = (select charname16 from RivalSHD.._Char with (nolockwhere CharID = @CharID)
Declare @
Kills int 
Set 
@CharID = (Select CharID From RivalSHD.._Char Where CharID=@CharID)
Set @Kills = (select COUNT(Killsfrom RivalLOG..Chetito where KillerID = @CharID)
Set @KillerID = (select KillerID from RivalLOG..Chetito where KillerID = @CharID)
        if (@
Kills 29
            
begin
                
print ''
            
end
    
-- No level for under 29 kills
        
IF (@EventID=19) and     (@Kills 31  )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level =8  where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 8 Because Row Kills Is [31] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End
        
-- level 8 for kills ebtween 30 and 44
        
IF (@EventID=19)  and (@Kills 41 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 9 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 9 Because Row Kills Is [41] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End
        
IF (@EventID=19)  and (@Kills 51 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level =10  where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 10 Because Row Kills Is [51] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
        
IF (@EventID=19) and (@Kills 101 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 11 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 11 Because Row Kills Is [101] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    

        
IF (@EventID=19) and (@Kills 151 )
            
begin
        Update RivalSHD
.dbo._CharTrijob set Level 12  where CharID = @CharID 
        set 
@veremos =  @Charname ' has been reached Level 12 Because Row Kills Is [151] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End

        
IF (@EventID=19) and (@Kills 212 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 13 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 13 Because Row Kills Is [212] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
        
IF (@EventID=19) and (@Kills 321 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 14 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 14 Because Row Kills Is [321] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End        
            
        
IF (@EventID=19) and (@Kills 401 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 15 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 15 Because Row Kills Is [401] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End
            
        
IF (@EventID=19) and (@Kills 501 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 16 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 16 Because Row Kills Is [501] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
        
IF (@EventID=19) and (@Kills 601 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 17 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 17 Because Row Kills Is [601] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End        
            
        
IF (@EventID=19) and (@Kills 701 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 18 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 18 Because Row Kills Is [701] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End
            
        
IF (@EventID=19) and (@Kills 801 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 19 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 19 Because Row Kills Is [801] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 851 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 20 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 20 Because Row Kills Is [851] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 901 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 21 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 21 Because Row Kills Is [901] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1001 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 22 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 22 Because Row Kills Is [1001] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1101 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 23 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 23 Because Row Kills Is [1101] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1201 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 24 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 24 Because Row Kills Is [1201] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1301 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 25 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 25 Because Row Kills Is [1301] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1401 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 26 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 26 Because Row Kills Is [1401] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1501 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 27 where CharID = @CharID 
             set 
@veremos =  @Charname ' has been reached Level 27 Because Row Kills Is [1501] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1601 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 28 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 28 Because Row Kills Is [1601] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1701 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 29 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 29 Because Row Kills Is [1701] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1801 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 30 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 30 Because Row Kills Is [1801] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 1901 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 31 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 31 Because Row Kills Is [1901] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2001 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 32 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 32 Because Row Kills Is [2001] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2101 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 33 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 33 Because Row Kills Is [2101] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2201 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 34 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 34 Because Row Kills Is [2201] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2301 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 35 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 35 Because Row Kills Is [2301] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2401 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 36 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 36 Because Row Kills Is [2401] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2501 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 37 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 37 Because Row Kills Is [2501] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2601 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 38 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 38 Because Row Kills Is [2601] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
            
IF (@EventID=19) and (@Kills 2701 )
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 39 where CharID = @CharID 
             set 
@veremos =  @Charname '  has been reached Level 39 Because Row Kills Is [2701] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End    
            
        
if (@Kills >2850)
            
begin
                Update RivalSHD
.dbo._CharTrijob set Level 40 where CharID = @CharID  -- Currently the highest level
             set 
@veremos =  @Charname '  has been reached Level 40 Highest Level Because Row Kills Is [2850] on Jobbing!'
        
INSERT INTO RivalSHD.._SQLBotConfig (Type,Content,Target,Executor,NotifiedVALUES
        
(6,@veremos,0,'Exodus',0)
            
End



--Hnonr BufF


if @EventID '19'   -- Count kills
DECLARE
 @
maxkills int,
 @
onekills int

set 
@onekills = (select  COUNT(*) FROM RivalLOG.dbo.JobRank WHERE KillerID = @CharID AND KilledID = @CharID)
set @maxkills = (select  COUNT(*) FROM RivalLOG.dbo.JobRank WHERE KillerID = @CharID)
DECLARE
 @
Kc1 int
 @
K_Name1 VARCHAR(512) = @Desc
        SELECT 
@K_Name1 REPLACE(@K_Name1LEFT(@K_Name1CHARINDEX('(', @K_Name1)), '')
        
SELECT @K_Name1 REPLACE(@K_Name1RIGHT(@K_Name1CHARINDEX(')'REVERSE(@K_Name1))), '')
  ----- 
Killed CharID
        
DECLARE @K_CharID1 INT =(SELECT  CharID FROM [RivalSHD].[dbo].[_CharWHERE CharName16 = @K_Name1
  ------
 -- 
Check if he kills the char more than 3 times  
 
DECLARE @PKill1 int = (select COUNT(*) from RivalLOG..JobRank where KillerID = @CharID and KilledID = @K_CharID1)     
 DECLARE @
MaxK1 int = (select COUNT(Killsfrom RivalLOG..JobRank where KillerID = @CharID and Kills '1')  
if @
EventID '19'  
    
BEGIN
INSERT INTO RivalLOG
..JobRank (KillerID KilledID KillsVALUES (@CharID , @K_CharID1,'1')
 
If (@
onekills <= 1)
if (@
maxkills <= 2850
    
BEGIN
    update RivalSHD
.dbo._CharTrijob set KillCount=KillCount+1 where CharID=@CharID
    
--Insert char kills
DECLARE
 @
Rank    TINYINT,
 @
Ranking    INT
    SET 
@Ranking 1
IF @Ranking <= 5
        BEGIN
            SET 
@Rank 1
        END
        
ELSE IF @Ranking <= 15
        BEGIN
            SET 
@Rank 2
        END
        
ELSE IF @Ranking <= 30
        BEGIN
            SET 
@Rank 3
        END
        
ELSE
        
BEGIN
            SET 
@Rank 4
        END
declare @CampID    INT
set 
@CampID = (select campid from RivalSHD.dbo._TrainingCampMember where CharID=@CharID)
declare @
id int
set 
@id=(Select id from RivalSHD.dbo._TrainingCamp where ID=@campid)
begin
EXEC RivalSHD
.DBO._TRAINING_CAMP_CREATE @CharID
END
update RivalSHD
.dbo._TrainingCampMember set HonorPoint=HonorPoint+1 where CharID=@CharID
update RivalSHD
.dbo._TrainingCamp set EvaluationPoint=EvaluationPoint+1 where ID=@id
update RivalSHD
.dbo._TrainingCamp set GraduateCount=GraduateCount+1 where ID=@id
begin
insert into RivalSHD
.dbo._TrainingCampHonorRank (RankingCampIDRankValues (@RANKING, @CampID, @Rank)
eND
END
END
-- #########################################  
  
-- WANTED NEW
 -- DECLARE @
CharLevel2 tinyint = (SELECT CurLevel from rivalshd.dbo._Char WHERE CharID = @CharID)
 --IF (@
EventID 19  AND @Desc like '%My: Robber%' OR @EventID 19 AND @Desc like '%My: Trader%' OR @EventID 19 AND @Desc like '%My: Hunter%')
    --    
begin
    
--        EXEC JOBBING @CharID, @CharLevel2, @Desc
    
--    end
  
-- #########################################  
  
--JOB COINS
-- Trade Gold Coins Anti Cheat
    
if @EventID '6' and exists (Select from rivalshd.dbo._CharTrijob where CharID = @CharID AND Contribution >= '14318688' )
    
begin Exec [dbo].[_JobCoins]  @charid , @eventid  
    end
    
-- Contri Save
     
if (@EventID'4'begin Exec [_Contribt] @charid end
    
-- ########################################
  
--
  --
Declares first,
  DECLARE
   @
Masterame0 varchar(50) = (select CharID from rivalshd.dbo._Char where CharID in (select Charid from rivalshd.dbo._GuildMember where GuildID in (select GuildID from rivalshd.dbo._SiegeFortress) and MemberClass '0' and Permission '-1' and SiegeAuthority '1')),
   @
checkit int = (select JobID from rivalshd.dbo._TimedJob where JobID '70004' and CharID not in (select Charid from rivalshd.dbo._GuildMember where GuildID  in (select GuildID from rivalshd.dbo._SiegeFortress) and MemberClass '0' and Permission '-1' and SiegeAuthority '1')),
   @
checkithwan int = (select Charid from rivalshd.dbo._Char where HwanLevel '113' and CharID not in (select Charid from rivalshd.dbo._GuildMember where GuildID  in (select GuildID from rivalshd.dbo._SiegeFortress) and MemberClass '0' and Permission '-1' and SiegeAuthority '1'))
 if (@
EventID=11)
  OR (@
EventID=9)
  
begin
  exec SRO_VT_ERIUS
.dbo._SpecialGReward @Masterame0,@checkit,@checkithwan
  end 


توقيع tarekelpop1 :
[CENTER][CENTER]
[IMG]https://www.gulf-up.com/hiytx62wax33[/IMG]
Name..I_WizZarD_I
Game...Inferno Sro
Guild...Brutality
Build...WizzarD/Cleric