Quote:
Originally Posted by SkuulCandy
This is the same script to enchant his items. Without the condition of the quest:
Code:
USE [PS_GameData]
GO
/****** Object: Trigger [dbo].[GM_Enchant] Script Date: 08/07/2014 22:49:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[GM_Enchant]
ON [dbo].[CharQuests]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @QuestID INT = (SELECT QuestID FROM inserted)
IF @QuestID = 1720 -- QuestID
BEGIN
DECLARE @CharID INT = (SELECT CharID FROM inserted)
DECLARE @UserUID INT = (SELECT UserUID FROM Chars WHERE CharID = @CharID)
DECLARE @ItemType TINYINT,
@EnchantItemId INT
DECLARE @EnchantItem TABLE (EnchantID INT)
DECLARE @GearTypes TABLE (GearTypes TINYINT)
SET @ItemType = (SELECT Type FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 0)
SET @EnchantItemId = (SELECT ItemID FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 1)
-- the perfect lapisia itemid, change it for you needs
INSERT INTO @EnchantItem VALUES (100230)
-- add all the gear types you want to use here
INSERT INTO @GearTypes VALUES (16),(17),(18),(19),(20),(21),(24),(31),(32),(33), (34),(35),(36),(39),(58) ,(1),(2),(3),
(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),( 15),(22),(23),(40)
IF ((@ItemType IN (SELECT GearTypes FROM @GearTypes)) AND (@EnchantItemID IN (SELECT EnchantID FROM @EnchantItem)))
BEGIN
DECLARE @Enchant TINYINT = (SELECT CAST(SUBSTRING(Craftname, 19, 2) AS TINYINT) FROM UserStoredItems WHERE UserUID = @UserUID AND Slot = 0)
--- max enchant its [10]
IF @Enchant > = 60
GOTO FAIL
ELSE IF @Enchant > = 10 AND @Enchant < 50
GOTO FAIL
SET @Enchant += 1 -- this will increase the enchant by 1
DECLARE @EnchantString CHAR(2) = @Enchant
IF LEN(@EnchantString) = 1
SET @EnchantString = '0' + @EnchantString
UPDATE UserStoredItems
SET Craftname = SUBSTRING(Craftname, 1, 18) + @EnchantString
WHERE UserUID = @UserUID AND Slot = 0
END
ELSE GOTO FAIL
UPDATE UserStoredItems
SET Count -= 1
WHERE UserUID = @UserUID AND Slot = 1
DELETE FROM UserStoredItems
WHERE UserUID = @UserUID AND Slot = 1 AND Count = 0
FAIL:
DELETEQUEST:
DELETE FROM CharQuests
WHERE CharID = @CharID AND QuestID = @QuestID
END
END
GO
??
|
this version of is incorrect
this is the problem
---------------------------------------------------------------------
--- max enchant its [10]
IF @Enchant > = 60
GOTO FAIL
ELSE IF @Enchant > = 10 AND @Enchant < 50
GOTO FAIL
SET @Enchant += 1 -- this will increase the enchant by 1
---------------------------------------------------------------------
all craftnames start with enchants at 00 and when you add 1 enchant to a armor it goes from 00 to 51 on the first enchant so right now if a armor was at 00 enchants and you used this to enchant system for first time you will then have put power enchants on the item instead of abs
plus the insert into functions here aren't needed and puts extra work on the database and that's never good I see where this came from its a edited version of nubness's perfect reroll system there it was needed so that it could call stats by there true names here it is just a waste and can be harmful to your database if lots of people are doing enchants at the same time its kinda like trying to pull a car with the breaks on it much easier if the breaks was released
also both versions listed in this thread are missing all the new types of gears,weapons that was release after ep4 so if someone is running a ep5 or above they could only enchant about 1/2 the gears that are currently in the game
I added my own working version to the release mine can handle stacks of lapisias and it can also do more then 1 enchant at one time plus it don't added power enchants to armor