I used Nubness trigger for Perfec Orange Stat and im change this for letters quest to give ele lapis after get quest and this quest work but some pleyers (Not everyone but some) have rollback every time and i hvae no idea why?
here is my script
USE [PS_GameData]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==================================================
-- Developed by Euphoria Dev Team
-- ==================================================
ALTER TRIGGER [dbo].[ele II]
ON [dbo].[CharQuests]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @QuestID SMALLINT = (SELECT QuestID FROM inserted)
IF @QuestID = 2222 -- The Perfect Orange Stats QuestID
BEGIN
DECLARE @CharID INT = (SELECT CharID FROM inserted)
DECLARE @ID INT = (SELECT UserUID FROM Chars WHERE CharID = @CharID)
-- Fire II
if not exists (Select * from UserStoredItems where Slot='7' and UserUID @ID)
begin
if exists (Select ItemID from UserStoredItems where Slot='6' and ItemID='44193' and count >='1' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='0' and ItemID='44136' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='1' and ItemID='44137' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot='2' and ItemID='44138' and count >='2'and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='3' and ItemID='44139' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='4' and ItemID='44140' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='5' and ItemID='44141' and count >='2' and UserUID @ID)
Begin
INSERT INTO UserStoredItems (ServerID, UserUID, ItemID, ItemUID, Type, TypeID, Slot, Quality, Gem1, Gem2, Gem3, Gem4, Gem5, Gem6, Craftname, Count, Maketime, Maketype, Del)
VALUES ('1', @ID, '30181', dbo.ItemUID(), '30', '181', '7', (SELECT Quality FROM PS_GameDefs.dbo.Items WHERE ItemID = '30181'), 0, 0, 0, 0, 0, 0, '00000000000000000000', '1', GETDATE(), 'S', 0)
if (@@ERROR='0' and @@ROWCOUNT='1')
BEGIN
UPDATE UserStoredItems
SET Count=count - 2
WHERE UserUID = @ID AND Slot between 0 and 5
DELETE FROM UserStoredItems
WHERE UserUID = @ID AND Slot between 0 and 5 AND Count = 0
end
end
end
end
end
end
end
end
end
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ==================================================
-- Developed by Euphoria Dev Team
-- ==================================================
ALTER TRIGGER [dbo].[ele II]
ON [dbo].[CharQuests]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @QuestID SMALLINT = (SELECT QuestID FROM inserted)
IF @QuestID = 2222 -- The Perfect Orange Stats QuestID
BEGIN
DECLARE @CharID INT = (SELECT CharID FROM inserted)
DECLARE @ID INT = (SELECT UserUID FROM Chars WHERE CharID = @CharID)
-- Fire II
if not exists (Select * from UserStoredItems where Slot='7' and UserUID @ID)
begin
if exists (Select ItemID from UserStoredItems where Slot='6' and ItemID='44193' and count >='1' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='0' and ItemID='44136' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='1' and ItemID='44137' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot='2' and ItemID='44138' and count >='2'and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='3' and ItemID='44139' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='4' and ItemID='44140' and count >='2' and UserUID @ID)
Begin
if exists (Select ItemID from UserStoredItems where Slot ='5' and ItemID='44141' and count >='2' and UserUID @ID)
Begin
INSERT INTO UserStoredItems (ServerID, UserUID, ItemID, ItemUID, Type, TypeID, Slot, Quality, Gem1, Gem2, Gem3, Gem4, Gem5, Gem6, Craftname, Count, Maketime, Maketype, Del)
VALUES ('1', @ID, '30181', dbo.ItemUID(), '30', '181', '7', (SELECT Quality FROM PS_GameDefs.dbo.Items WHERE ItemID = '30181'), 0, 0, 0, 0, 0, 0, '00000000000000000000', '1', GETDATE(), 'S', 0)
if (@@ERROR='0' and @@ROWCOUNT='1')
BEGIN
UPDATE UserStoredItems
SET Count=count - 2
WHERE UserUID = @ID AND Slot between 0 and 5
DELETE FROM UserStoredItems
WHERE UserUID = @ID AND Slot between 0 and 5 AND Count = 0
end
end
end
end
end
end
end
end
end
and here is logs
2016-09-17 06:07:52 err=-1, [Microsoft][ODBC SQL Server Driver][SQL Server]Arithmetic overflow error for data type tinyint, value = -1., SQL STATE: 22003, NATIVE ERROR: 220 (0xDC)
2016-09-17 06:07:52 ::SaveCharacter 247 cola ret=1, qerr=-1, {?=call Usp_Save_Char_Quest_Add_E(247,2222,0,0,0,0)}
2016-09-17 06:07:52 ::SaveCharacter 247 cola ret=1, qerr=-1, {?=call Usp_Save_Char_Quest_Add_E(247,2222,0,0,0,0)}
and here:
--<begin>2016-09-17 05:22:55,kobra755,118,cola,238
{?=call usp_Save_Char_Info_E(238,60, 0,5000, 516,100,9,8,7,15, 12076,1370,4599, 42,209, 1641399100,72548176, 49.107594,1.891644,48.548889, 0,200,0,0,0, 32,12,0,0)}
EXEC usp_Save_User_StoredMoney_E 1,118,344
{?=call Usp_Save_User_StoredItem_Del_E(1,118,'736944517307 2770938')}
{?=call Usp_Save_User_StoredItem_Mod_E(1,118,4783478628593 762304, 6, 0, 0,0,0,0,0,0, 1,'')}
{?=call Usp_Save_User_StoredItem_Mod_E(1,118,4783479552011 730944, 22, 0, 0,0,0,0,0,0, 1,'')}
{?=call Usp_Save_User_StoredItem_Mod_E(1,118,8081534723095 38890, 233, 0, 0,0,0,0,0,0, 2,'00000000000000000000')}
{?=call Usp_Save_Char_Skill_Mod_E(238,1,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,32,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,56,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,192,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,30,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,31,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,38,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,40,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,112,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,39,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,139,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,17,2,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,4,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,3,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,24,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,58,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,118,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,73,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,129,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,55,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,302,2,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,7,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,156,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,158,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,157,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,171,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,87,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,301,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,174,2,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,188,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,180,2,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,8,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,18,3,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,20,2,0)}
{?=call Usp_Save_Char_Skill_Mod_E(238,151,3,0)}
{?=call Usp_Save_Char_ApplySkill_Del_E(238,0,0,1)}
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,112,3,360)}
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,139,3,676)}
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,223,1,2478636) }
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,225,1,2588450) }
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,227,1,2588450) }
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,228,1,160)}
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,233,1,2588450) }
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,259,1,842)}
{?=call Usp_Save_Char_ApplySkill_Add_E2(238,286,3,2588450) }
{?=call Usp_Save_Char_Quest_Add_E(238,2222,0,0,0,0)}
EXEC usp_Save_Char_QuickSlot_Del_E 238
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,0,100,38
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,1,101,4
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,2,100,171
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,3,100,156
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,4,100,157
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,5,100,40
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,6,100,301
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,7,100,39
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,8,100,174
EXEC usp_Save_Char_QuickSlot_Add_E 238,0,9,100,56
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,0,100,180
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,1,100,174
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,2,100,87
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,3,100,73
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,4,100,129
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,5,101,3
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,6,5,3
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,7,5,22
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,8,5,21
EXEC usp_Save_Char_QuickSlot_Add_E 238,1,9,5,20
EXEC usp_Save_Char_QuickSlot_Add_E 238,10,0,100,112
EXEC usp_Save_Char_QuickSlot_Add_E 238,10,1,100,31
EXEC usp_Save_Char_QuickSlot_Add_E 238,10,2,100,30
EXEC usp_Save_Char_QuickSlot_Add_E 238,10,3,100,139
EXEC usp_Save_Char_QuickSlot_Add_E 238,10,4,100,188
EXEC usp_Save_Char_QuickSlot_Add_E 238,100,0,5,18
EXEC usp_Save_Char_QuickSlot_Add_E 238,100,1,5,19
--<end>2016-09-17 05:22:55,cobra755,118,cola,238
My proc
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_Quest_Add_E] Script Date: 2016-09-17 14:32:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Quest_Add_E]
@CharID int,
@QuestID smallint,
@Delay smallint = Null,
@Count1 tinyint = Null,
@Count2 tinyint = Null,
@Count3 tinyint = Null
AS
SET NOCOUNT ON
INSERT INTO CharQuests(CharID,QuestID,[Delay],Count1,Count2,Count3) VALUES(@CharID,@QuestID,@Delay,@Count1,@Count2,@Co unt3)
IF(@@ERROR = 0)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_Quest_Add_E] Script Date: 2016-09-17 14:32:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Quest_Add_E]
@CharID int,
@QuestID smallint,
@Delay smallint = Null,
@Count1 tinyint = Null,
@Count2 tinyint = Null,
@Count3 tinyint = Null
AS
SET NOCOUNT ON
INSERT INTO CharQuests(CharID,QuestID,[Delay],Count1,Count2,Count3) VALUES(@CharID,@QuestID,@Delay,@Count1,@Count2,@Co unt3)
IF(@@ERROR = 0)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_FinishedQuest_E] Script Date: 2016-09-17 14:33:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_FinishedQuest_E]
@CharID int,
@QuestID smallint,
@ tinyint,
@Insert bit = 0
AS
SET NOCOUNT ON
IF(@Insert = 0)
BEGIN
UPDATE CharQuests SET Success @,Finish=1 WHERE CharID=@CharID AND QuestID=@QuestID
END
ELSE
BEGIN
INSERT INTO CharQuests(CharID,QuestID,[Delay],Success,Finish) VALUES(@CharID,@QuestID,0 @,1)
END
IF(@@ERROR = 0)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_Info_E] Script Date: 2016-09-17 14:34:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Info_E]
@CharID int,
@Level int,
@StatPoint smallint,
@SkillPoint smallint,
@ smallint,
@Dex smallint,
@Rec smallint,
@Int smallint,
@ smallint,
@Luc smallint,
@Hp smallint,
@Mp smallint,
@Sp smallint,
@Map smallint,
@Dir smallint,
@Exp int,
@Money int,
@Posx varchar(50),
@Posy varchar(50),
@Posz varchar(50),
@Hg int,
@Vg int,
@Cg int,
@Og int,
@Ig int,
@K1 int = null,
@K2 int = null,
@K3 int = null,
@K4 int = null,
@KillLevel tinyint,
@DeadLevel tinyint
AS
SET NOCOUNT ON
DECLARE @ServerID int,
@Grow int,
@p bigint,
@PosxR real,
@PosyR real,
@PoszR real
SET @ServerID = 1
IF (ISNumeric(@Posx) = 1 and ISNumeric(@Posy) = 1 and ISNumeric(@Posz) = 1)
BEGIN
SET @PosxR = CAST(@Posx as real)
SET @PosyR = CAST(@Posy as real)
SET @PoszR = CAST(@Posz as real)
END
ELSE
BEGIN
--Only gets here if there is a error in the positions, Most likely a bot or exploit.
--Log in a error table for manual invest.
--Set all the pos. to bootleg so it doesn't throw an error
SET @Map = 42
SET @PosxR = 66.5
SET @PosYR = 2.0
SET @PosZR = 52.6
END
UPDATE Chars
SET [Level] = @Level, StatPoint = @StatPoint, SkillPoint = @SkillPoint,
[Str] = @, dex = @Dex, Rec = @Rec, [int] = @Int, Wis = @, Luc = @Luc,
HP = @Hp, Mp = @Mp, Sp = @Sp,
Map = @Map, dir = @Dir, [exp] = @Exp, [money] = @Money,
PosX = @PosxR, PosY = @PosYR, PosZ = @PosZR, hg = @Hg, vg = @Vg, cg = @Cg, og = @Og, ig = @Ig,
KillLevel=@KillLevel, DeadLevel=@DeadLevel,LeaveDate=GETDATE()
WHERE CharID = @CharID
IF( (@K1 IS NOT NULL) AND (@K2 IS NOT NULL) AND (@K3 IS NOT NULL) AND (@K4 IS NOT NULL))
BEGIN
UPDATE Chars SET K1=@K1, K2=@K2, K3=@K3, K4=@K4 WHERE CharID=@CharID
END
IF(@@ERROR = 0 AND @@ROWCOUNT = 1)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_Info_E] Script Date: 2016-09-17 14:34:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Info_E]
@CharID int,
@Level int,
@StatPoint smallint,
@SkillPoint smallint,
@ smallint,
@Dex smallint,
@Rec smallint,
@Int smallint,
@ smallint,
@Luc smallint,
@Hp smallint,
@Mp smallint,
@Sp smallint,
@Map smallint,
@Dir smallint,
@Exp int,
@Money int,
@Posx varchar(50),
@Posy varchar(50),
@Posz varchar(50),
@Hg int,
@Vg int,
@Cg int,
@Og int,
@Ig int,
@K1 int = null,
@K2 int = null,
@K3 int = null,
@K4 int = null,
@KillLevel tinyint,
@DeadLevel tinyint
AS
SET NOCOUNT ON
DECLARE @ServerID int,
@Grow int,
@p bigint,
@PosxR real,
@PosyR real,
@PoszR real
SET @ServerID = 1
IF (ISNumeric(@Posx) = 1 and ISNumeric(@Posy) = 1 and ISNumeric(@Posz) = 1)
BEGIN
SET @PosxR = CAST(@Posx as real)
SET @PosyR = CAST(@Posy as real)
SET @PoszR = CAST(@Posz as real)
END
ELSE
BEGIN
--Only gets here if there is a error in the positions, Most likely a bot or exploit.
--Log in a error table for manual invest.
--Set all the pos. to bootleg so it doesn't throw an error
SET @Map = 42
SET @PosxR = 66.5
SET @PosYR = 2.0
SET @PosZR = 52.6
END
UPDATE Chars
SET [Level] = @Level, StatPoint = @StatPoint, SkillPoint = @SkillPoint,
[Str] = @, dex = @Dex, Rec = @Rec, [int] = @Int, Wis = @, Luc = @Luc,
HP = @Hp, Mp = @Mp, Sp = @Sp,
Map = @Map, dir = @Dir, [exp] = @Exp, [money] = @Money,
PosX = @PosxR, PosY = @PosYR, PosZ = @PosZR, hg = @Hg, vg = @Vg, cg = @Cg, og = @Og, ig = @Ig,
KillLevel=@KillLevel, DeadLevel=@DeadLevel,LeaveDate=GETDATE()
WHERE CharID = @CharID
IF( (@K1 IS NOT NULL) AND (@K2 IS NOT NULL) AND (@K3 IS NOT NULL) AND (@K4 IS NOT NULL))
BEGIN
UPDATE Chars SET K1=@K1, K2=@K2, K3=@K3, K4=@K4 WHERE CharID=@CharID
END
IF(@@ERROR = 0 AND @@ROWCOUNT = 1)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_QuickSlot_Add_E] Script Date: 2016-09-17 14:35:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_QuickSlot_Add_E]
@CharID int,
@QuickBar tinyint,
@QuickSlot tinyint,
@Bag tinyint,
@Number smallint
AS
SET NOCOUNT ON
INSERT INTO CharQuickSlots(CharID,QuickBar,QuickSlot,Bag,Numbe r) VALUES(@CharID,@QuickBar,@QuickSlot,@Bag,@Number)
SET NOCOUNT OFF
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_QuickSlot_Del_E] Script Date: 2016-09-17 14:37:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_QuickSlot_Del_E]
@CharID int
AS
SET NOCOUNT ON
DELETE CharQuickSlots WHERE CharID=@CharID
SET NOCOUNT OFF