|
• الانـتـسـاب » Jan 2014
|
• رقـم العـضـويـة » 116041
|
• المشـــاركـات » 2,589
|
• الـدولـة » Gizaaa
|
• الـهـوايـة » SilkRoad4Arab Only One <3
|
• اسـم الـسـيـرفـر » Private Server
|
• الـجـنـس » Male
|
• نقـاط التقييم » 26
|
|
|
رد: بخصوص Addlogchar
كود PHP:
USE [SRO_VT_SHARDLOG]
GO
/****** Object: StoredProcedure [dbo].[_AddLogChar] Script Date: 07/03/2015 07:18:22 ã ******/
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
IF @EventID = 19 and
(@Desc Like '%My: Robber, Murderer%' -- Pk by Thief
Or @Desc Like '%My: Trader, Murderer%' -- Pk by Trader
Or @Desc Like '%My: Hunter, Murderer%' -- Pk by Hunter
Or @Desc Like '%My: no job, Murderer%') -- Pk by Normal Status
Begin
Execute [dbo].[_MurdererAutoBanned] @CharID
End
IF ( -- Skips over the unnecessary Records
(@EventID != 11) AND
(@EventID NOT BETWEEN 21 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)
)BEGIN
declare @len_pos int
declare @len_desc int
set @len_pos = len(@strPos)
set @len_desc = len(@Desc)
if (@len_pos > 0 and @len_desc > 0)
begin
insert _LogEventChar values(@CharID, GetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)
end
else if (@len_pos > 0 and @len_desc = 0)
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2, EventPos) values(@CharID, GetDate(), @EventID, @Data1, @Data2, @strPos)
end
else if (@len_pos = 0 and @len_desc > 0)
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2, strDesc) values(@CharID, GetDate(), @EventID, @Data1, @Data2, @Desc)
end
else
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2) values(@CharID, GetDate(), @EventID, @Data1, @Data2)
end
/*Extension*/--> by Yui
IF not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID)
BEGIN
INSERT INTO _OnlineOffline (CharID, Charname, [Status], [Date], [Minutes], [tMinutes], eSilk, mOnline, [Silk/Hour], [stillOnline@])
VALUES (
@CharID,
(SELECT CharName16 FROM SRO_VT_SHARD_JoOoO.dbo._Char WHERE CharID = @CharID),
'OnHold',
GETDATE(),
0,0,0,
NULL,(SELECT DefaultSilk FROM [_Silk/Hour-Config] WHERE [Desc] like 'Rates'),
NULL
);
END
IF (@EventID = 4 OR @EventID = 6)
BEGIN
IF (@EventID = 6 AND ((SELECT [Status] FROM _OnlineOffline WHERE CharID = @CharID) like 'OnHold'))
BEGIN
UPDATE _OnlineOffline
SET [Status] = 'Offline'
WHERE CharID = @CharID
END
IF (@EventID = 6 AND ((SELECT [Status] FROM _OnlineOffline WHERE CharID = @CharID) like '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
END
END
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] like 'Online'
/*Silk/Hour basic calc*/
IF ((SELECT [tMinutes] from _OnlineOffline WHERE CharID = @CharID) >= (SELECT [Step1Silk] FROM [_Silk/Hour-Config] WHERE [Desc] like 'Requirements'))
BEGIN
Declare @sph int;
exec @sph = [_GetSilkperHour] @CharID
UPDATE _OnlineOffline SET [Silk/Hour] = @sph WHERE CharID = @CharID
END
/*!Silk/Hour basic calc*/
IF (((SELECT NextDate FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next') IS NULL))
BEGIN
DECLARE @FirstDate datetime, @Today datetime = GETDATE(), @FirstCharID int;
exec @FirstCharID = SRO_VT_SHARD_JoOoO.dbo._RandomPlayerID
exec SRO_VT_SHARD_JoOoO.dbo._GetRandomTime @Today, @FirstDate OUTPUT
UPDATE [_RandomPlayer&Date]
SET
NextDate = @FirstDate,
RefreshedDate = GETDATE(),
CharID = @FirstCharID,
Charname = (SELECT CharName16 FROM SRO_VT_SHARD_JoOoO.dbo._Char WHERE CharID = @FirstCharID)
WHERE [Desc] like 'Next';
END
IF ((SELECT NextDate FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next') <= GETDATE())
BEGIN
UPDATE _OnlineOffline
SET [Silk/Hour] = (SELECT RewardSilk FROM [_Silk/Hour-Config] WHERE [Desc] like 'Rates')
WHERE CharID = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next');
Declare
@CurSilkperHour int,
@OldCharID int = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Current');
IF (@OldCharID IS NOT NULL)
BEGIN
exec @CurSilkperHour = _GetSilkperHour @OldCharID
UPDATE _OnlineOffline
SET [Silk/Hour] = @CurSilkperHour
WHERE CharID = @OldCharID;
END
UPDATE [_RandomPlayer&Date]
SET
NextDate = NULL,
RefreshedDate = GETDATE(),
CharID = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next'),
Charname = (SELECT Charname FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next')
WHERE [Desc] like 'Current'
/*new Random Time of Today+1*/
DECLARE @NextDate datetime, @Tomorrow datetime = GETDATE()+1, @NewCharID int;
exec @NewCharID = SRO_VT_SHARD_JoOoO.dbo._RandomPlayerID
exec SRO_VT_SHARD_JoOoO.dbo._GetRandomTime @Tomorrow, @NextDate OUTPUT
UPDATE [_RandomPlayer&Date]
SET
NextDate = @NextDate,
RefreshedDate = GETDATE(),
CharID = @NewCharID,
Charname = (SELECT CharName16 FROM SRO_VT_SHARD_JoOoO.dbo._Char WHERE CharID = @NewCharID)
WHERE [Desc] like 'Next'
/*!new Random...*/
END
/*Calculation of the silk amount*/
Declare @tMinutes bigint = (SELECT [Minutes] from _OnlineOffline WHERE CharID = @CharID), @Silk int;
IF (@tMinutes >= 60)
BEGIN
SET @Silk = CAST(((SELECT [Minutes] FROM _OnlineOffline WHERE CharID = @CharID) / 60) as int)
UPDATE _OnlineOffline
SET [Minutes] = [Minutes] % 60
WHERE CharID = @CharID
IF exists (SELECT [WEEKDAYS] FROM [_Silk/Hour-Config] WHERE [WEEKDAYS] like DATENAME(WEEKDAY, GETDATE()))
BEGIN
UPDATE _OnlineOffline
SET [eSilk] = [eSilk] + (@Silk*[Silk/Hour])
WHERE CharID = @CharID
exec SRO_VT_ACCOUNT_JoOoO.dbo._extraSilk @CharID, @Silk
END
END
/*Yui*/
/*!Extension*/
END -- !Skipping
declare @jobtype int,@jobnames varchar(50)
set @jobtype=(select jobtype from SRO_VT_SHARD.._chartrijob where charid=@charid)
select @jobnames=case when @jobtype =1 then 'Trader'
when @jobtype=2 then 'Thief'
when @jobtype=3 then 'Hunter'
end
if @eventid in (4,6) and ((select contribution from SRO_VT_SHARD.._CharTrijob where CharID=@CharID) >=436657932) and ((select jobtype from SRO_VT_SHARD.._CharTrijob where CHARid=@CharID)>0)
begin
if (select jobtype from SRO_VT_SHARD.._CharTrijob where CharID=@CharID)=1
begin
exec SRO_VT_SHARD.._TRAINING_CAMP_CREATE @charid
update SRO_VT_SHARD.._CharTrijob set Contribution=0 where CharID=@CharID
update SRO_VT_SHARD.._TrainingCamp set EvaluationPoint+=10,GraduateCount+=10 where id in (Select campid from SRO_VT_SHARD.._TrainingCampMember where charid=@charid)
if not exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
insert into [dbo].[SaveTrade_Mr.x] (Charname,Charid,CampID,HonorPoints,TradeCount,JobType) values ((select charname16 from SRO_VT_SHARD.._char where CharID=@CharID),@CharID,(select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID),(select GraduateCount from SRO_VT_SHARD.._TrainingCamp where id in (select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID)),0,@jobnames)
end
if exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
update [dbo].[SaveTrade_Mr.x] set TradeCount+=1,HonorPoints+=10 where Charid=@CharID
end
end
if (select jobtype from SRO_VT_SHARD.._CharTrijob where CharID=@CharID)=2
begin
exec SRO_VT_SHARD.._TRAINING_CAMP_CREATE @charid
update SRO_VT_SHARD.._CharTrijob set Contribution=0 where CharID=@CharID
update SRO_VT_SHARD.._TrainingCamp set EvaluationPoint+=10,GraduateCount+=10 where id in (Select campid from SRO_VT_SHARD.._TrainingCampMember where charid=@charid)
if not exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
insert into [dbo].[SaveTrade_Mr.x] (Charname,Charid,CampID,HonorPoints,TradeCount,JobType) values ((select charname16 from SRO_VT_SHARD.._char where CharID=@CharID),@CharID,(select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID),(select GraduateCount from SRO_VT_SHARD.._TrainingCamp where id in (select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID)),0,@jobnames)
end
if exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
update [dbo].[SaveTrade_Mr.x] set TradeCount+=1,HonorPoints+=10 where Charid=@CharID
end
end
if (select jobtype from SRO_VT_SHARD.._CharTrijob where CharID=@CharID)=3
begin
exec SRO_VT_SHARD.._TRAINING_CAMP_CREATE @charid
update SRO_VT_SHARD.._CharTrijob set Contribution=0 where CharID=@CharID
update SRO_VT_SHARD.._TrainingCamp set EvaluationPoint+=10,GraduateCount+=10 where id in (Select campid from SRO_VT_SHARD.._TrainingCampMember where charid=@charid)
if not exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
insert into [dbo].[SaveTrade_Mr.x] (Charname,C_char where CharID=@CharID),@CharID,(select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID),(select GraduateCount from SRO_VT_SHARD.._TrainingCamp where id in (select campid from SRO_VT_SHARD.._TrainingCampMember where CharID=@CharID)),0,@jobnames)
end
if exists (select campid from [dbo].[SaveTrade_Mr.x] where Charid=@CharID)
begin
update [dbo].[SaveTrade_Mr.x] set TradeCount+=1,HonorPoints+=10 where Charid=@CharID
end
update SRO_VT_SHARD.._CharTrijob set Contribution=Contribution+1000 where CharID=@CharID
end
harid,CampID,HonorPoints,TradeCount,JobType) values ((select charname16 from SRO_VT_SHARD.. end
|