يا جماعة ارجوكم انا عاوز اى برنامج اعمل من عليه البلص و الستات بس يكون غير الاس كيو ال او الاس ام سى
ده اول طلب تانى حاجة عاوز اعرف الطريقة الى اعمل بيها البف هونر بس من غير كويرى وى لو فى بلرنامج ابقا شاكر جدا
USE [SRO_VT_SHARD] GO /****** Object: StoredProcedure [dbo].[_ADD_GM_GEAR] Script Date: 11/02/2013 23:44:41 ******/ /* * Purpose: Add custom equipment to GM character * Auto check: Will auto detect character existence, GM status, race and gender. * How to use: * - * USE [SRO_VT_SHARD] * EXEC [_ADD_GM_GEAR] '<character_name>', '<weapon_type>', '<equipment_type>', '<equipment_degree>', <plus> * - * Parameters: * <character_name>: duh? * <weapon_type>, could be one of these: * Chinese: BOW, SWORD, BLADE, TBLADE, SPEAR * Euro: SWORD, TSWORD, AXE, DAGGER, CROSSBOW, HARP, TSTAFF, STAFF, DARKSTAFF * <equipment_type>: HEAVY, LIGHT, or CLOTHES * <equipment_degree>: duh? * <plus>: duh? * * Example: EXEC [_ADD_GM_GEAR] 'Visenya', 'DAGGER', 'LIGHT', '11', 12 * Will give: 'Visenya' (11 Degree, +12 100% Str/Int 7) Dagger, Light Armor, Shield, Accessories, * 1B Gold, 10M SP, and 109 Inventory slots * * Notes: * - Feel free to change anything ;) * - GM levels determined by "sec_primary" group in TB_User table in [SRO_VT_ACCOUNT] database. * I use default GM levels of 1-6 and 10. (GM level check section) * - I put Egy A and B 11D gears as default. (Item codes section) * * Important stuff: * - Dependecies SP (make sure they are exist): _FN_ADD_INITIAL_EQUIP, _ADD_ITEM_EXTERN, _IsExistingCharName, _STRG_DEL_ITEM_NoTX * - This will replace any equipped items automatically, except weapon and shield. New weapon and shield will be added without replacing old ones. * * -- Witchy * */ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO
-- Check if SP exist, if not, auto create the SP IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = '_ADD_GM_GEAR') EXEC('CREATE PROCEDURE [dbo].[_ADD_GM_GEAR] AS BEGIN SET NOCOUNT ON; END') GO
ALTER PROCEDURE [dbo].[_ADD_GM_GEAR] @CharName AS VARCHAR(64), @WPClass AS VARCHAR(16), @EQClass AS VARCHAR(16), @EQDegree AS VARCHAR(2), @EQPlus AS tinyINT AS -- Check if character exist DECLARE @isCharExist tinyINT
EXEC @isCharExist = [_IsExistingCharName] @CharNameToCheck = @CharName if (@isCharExist = 0) BEGIN RAISERROR('Character does not exist: %s', 1, 16, @CharName) RETURN -1 END
-- Check character and account related information (In relation with SRO_VT_ACCOUNT) DECLARE @CharID INT DECLARE @RefCharID INT DECLARE @UserJID INT DECLARE @GMLevel INT DECLARE @AccountName VARCHAR(32)
-- Check if character assigned to Account ID SELECT @CharID = CharID, @RefCharID = RefObjID FROM [_Char] WHERE CharName16 = @CharName SELECT @UserJID = UserJID FROM [_User] WHERE CharID = @CharID IF (@UserJID IS NULL OR @UserJID = 0) BEGIN RAISERROR('Account ID does not exist, character is not assigned to any user accounts: %s', 1, 16, @CharName) RETURN -2 END
-- Check GM levels (FEEL FREE TO CHANGE THESE) SELECT @GMLevel = sec_primary, @AccountName = StrUserID FROM [SRO_VT_ACCOUNT].[dbo].[TB_User] WHERE JID = @UserJID IF (@GMLevel IS NULL OR (@GMLevel > 6 AND @GMLevel < 10)) BEGIN RAISERROR('Account associated with this char does not have GM prvileges: %s', 1, 16, @AccountName) RETURN -3 END
-- Check character gender and race DECLARE @CharGender VARCHAR(1) DECLARE @CharRace VARCHAR(2)
IF (@RefCharID <= 14887 AND @RefCharID >= 14875) -- European Male BEGIN SET @CharGender = 'M' SET @CharRace = 'EU' END IF (@RefCharID <= 14900 AND @RefCharID >= 14888) -- European Female BEGIN SET @CharGender = 'W' SET @CharRace = 'EU' END IF (@RefCharID <= 1919 AND @RefCharID >= 1907) -- Chinesse Male BEGIN SET @CharGender = 'M' SET @CharRace = 'CH' END IF (@RefCharID <= 1932 AND @RefCharID >= 1920) -- Chinesse Female BEGIN SET @CharGender = 'W' SET @CharRace = 'CH' END
-- Setting up equipment -- Gears DECLARE @CodeNameHelm VARCHAR(256) DECLARE @CodeNameMail VARCHAR(256) DECLARE @CodeNameShoulder VARCHAR(256) DECLARE @CodeNameGauntlet VARCHAR(256) DECLARE @CodeNamePants VARCHAR(256) DECLARE @CodeNameBoots VARCHAR(256) DECLARE @RefHelmID INT DECLARE @RefMailID INT DECLARE @RefShoulderID INT DECLARE @RefGauntletID INT DECLARE @RefPantsID INT DECLARE @RefBootsID INT DECLARE @RefHelmLinkID INT DECLARE @RefMailLinkID INT DECLARE @RefShoulderLinkID INT DECLARE @RefGauntletLinkID INT DECLARE @RefPantsLinkID INT DECLARE @RefBootsLinkID INT DECLARE @DuraHelm INT DECLARE @DuraMail INT DECLARE @DuraShoulder INT DECLARE @DuraGauntlet INT DECLARE @DuraPants INT DECLARE @DuraBoots INT
-- Accessories DECLARE @CodeNameEarring VARCHAR(256) DECLARE @CodeNameNecklace VARCHAR(256) DECLARE @CodeNameRing VARCHAR(256) DECLARE @RefEarringID INT DECLARE @RefNecklaceID INT DECLARE @RefRingID INT DECLARE @RefEarringLinkID INT DECLARE @RefNecklaceLinkID INT DECLARE @RefRingLinkID INT
-- Weapon and Shield DECLARE @CodeNameWeapon VARCHAR(256) DECLARE @CodeNameShield VARCHAR(256) DECLARE @RefWeaponID INT DECLARE @RefShieldID INT DECLARE @RefWeaponLinkID INT DECLARE @RefShieldLinkID INT
-- Get Reference ID and Link ID -- Gears SELECT @RefHelmID = ID, @RefHelmLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameHelm SELECT @RefMailID = ID, @RefMailLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameMail SELECT @RefShoulderID = ID, @RefShoulderLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameShoulder SELECT @RefGauntletID = ID, @RefGauntletLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameGauntlet SELECT @RefPantsID = ID, @RefPantsLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNamePants SELECT @RefBootsID = ID, @RefBootsLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameBoots
-- Accessories SELECT @RefEarringID = ID, @RefEarringLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameEarring SELECT @RefNecklaceID = ID, @RefNecklaceLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameNecklace SELECT @RefRingID = ID, @RefRingLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameRing
-- Weapon and Shield SELECT @RefWeaponID = ID, @RefWeaponLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameWeapon SELECT @RefShieldID = ID, @RefShieldLinkID = link FROM [_RefObjCommon] WHERE CodeName128 = @CodeNameShield
IF ( @RefHelmID IS NULL OR @RefHelmID = 0 OR @RefMailID IS NULL OR @RefMailID = 0 OR @RefShoulderID IS NULL OR @RefShoulderID = 0 OR @RefGauntletID IS NULL OR @RefGauntletID = 0 OR @RefPantsID IS NULL OR @RefPantsID = 0 OR @RefBootsID IS NULL OR @RefBootsID = 0 OR @RefEarringID IS NULL OR @RefEarringID = 0 OR @RefNecklaceID IS NULL OR @RefNecklaceID = 0 OR @RefRingID IS NULL OR @RefRingID = 0 OR @RefWeaponID IS NULL OR @RefWeaponID = 0 OR @RefShieldID IS NULL OR @RefShieldID = 0 ) BEGIN RAISERROR('Invalid item reference ID, check item codename.', 1, 16) RETURN -4 END IF ( @RefHelmLinkID IS NULL OR @RefHelmLinkID = 0 OR @RefMailLinkID IS NULL OR @RefMailLinkID = 0 OR @RefShoulderLinkID IS NULL OR @RefShoulderLinkID = 0 OR @RefGauntletLinkID IS NULL OR @RefGauntletLinkID = 0 OR @RefPantsLinkID IS NULL OR @RefPantsLinkID = 0 OR @RefBootsLinkID IS NULL OR @RefBootsLinkID = 0 OR @RefEarringLinkID IS NULL OR @RefEarringLinkID = 0 OR @RefNecklaceLinkID IS NULL OR @RefNecklaceLinkID = 0 OR @RefRingLinkID IS NULL OR @RefRingLinkID = 0 OR @RefWeaponLinkID IS NULL OR @RefWeaponLinkID = 0 OR @RefShieldLinkID IS NULL OR @RefShieldLinkID = 0 ) BEGIN RAISERROR('Invalid link reference ID, check item codename.', 1, 16) RETURN -5 END
-- Get durability for 'Data' SELECT @DuraHelm = Dur_L from [_RefObjItem] WHERE ID = @RefHelmLinkID SELECT @DuraMail = Dur_L from [_RefObjItem] WHERE ID = @RefMailLinkID SELECT @DuraShoulder = Dur_L from [_RefObjItem] WHERE ID = @RefShoulderLinkID SELECT @DuraGauntlet = Dur_L from [_RefObjItem] WHERE ID = @RefGauntletLinkID SELECT @DuraPants = Dur_L from [_RefObjItem] WHERE ID = @RefPantsLinkID SELECT @DuraBoots = Dur_L from [_RefObjItem] WHERE ID = @RefBootsLinkID
-- Clear inventory (Just equipped items) ;) -- Update: will only clear equipped items only, so you don't have to take them off -- New weapon and shield will be added to inventory, not replacing old ones DECLARE @TSlots INT DECLARE @CharSlot INT SET @CharSlot = 0 SELECT @TSlots = COUNT(Slot) from _Inventory WHERE CharID = @CharID WHILE @CharSlot <= @TSlots BEGIN IF (@CharSlot < 6 OR (@CharSlot > 7 AND @CharSlot < 13)) BEGIN EXEC [_STRG_DEL_ITEM_NoTX] 1, @CharID, @CharSlot END SET @CharSlot = @CharSlot + 1 END
-- Start adding items to equipment slots BEGIN TRANSACTION
-- Add other stuff (make sure they're exist in database and Media) EXEC [_ADD_ITEM_EXTERN] @CharName, 'ITEM_MALL_REVERSE_RETURN_SCROLL', 10, 0 EXEC [_ADD_ITEM_EXTERN] @CharName, 'ITEM_MALL_RETURN_SCROLL_HIGH_SPEED', 10, 0 EXEC [_ADD_ITEM_EXTERN] @CharName, 'ITEM_MALL_CHAR_SKIN_CHANGE_SCROLL', 1, 0