I'm gonna release some stored procedures from the new KalOnline database.
So yeah, if you don't know how to use them, don't bother asking me.
Skill Redistribute:
Move Items:Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[SkillRedistribute] Script Date: 07/06/2008 16:40:41 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[SkillRedistribute] @Name varchar(15) AS DECLARE @PID int DECLARE @Class tinyint DECLARE @Level tinyint DECLARE @Specialty tinyint declare Player_Cursor cursor for select [PID], [Class], [Level], [Specialty] from Player where [Name] = @Name open Player_Cursor fetch next from Player_Cursor into @PID, @Class, @Level, @Specialty if (@@FETCH_STATUS = 0) begin delete from Skill where [PID] = @PID insert into Skill values ( @PID, 0, 1) -- 전력질주 insert into Skill values ( @PID, 1, 1) -- 참수 if( @Class = 0) begin if ( @Level >= 15) insert into Skill values ( @PID, 14, 1) -- 보호하기 if ( @Level >= 18) insert into Skill values ( @PID, 4, 1) -- 우롱하기 if ( @Level >= 25) insert into Skill values ( @PID, 15, 1) -- 방패치기 if ( @Specialty = 3) insert into Skill values ( @PID, 6, 1) -- 막아내기 if( @Specialty = 11) --장군 begin if( @Level < 56) -- 방어의기운 insert into Skill values ( @PID, 18, 1) else if( @Level < 62) insert into Skill values ( @PID, 18, 2) else if( @Level < 70) insert into Skill values ( @PID, 18, 3) else insert into Skill values ( @PID, 18, 4) if( @Level >= 66) --보호하기 update Skill set [Level] = 3 where PID = @PID and [Index] = 14 else if( @Level >= 53) update Skill set [Level] = 2 where PID = @PID and [Index] = 14 end end else if( @Class = 1) begin insert into Skill values ( @PID, 4, 1) -- 낙뢰술 if ( @Level >= 25) insert into Skill values ( @PID, 5, 1) -- 원거리보호 if ( @Specialty = 3) begin insert into Skill values ( @PID, 17, 1) -- 인염술 if( @Level >= 35) insert into Skill values ( @PID, 18, 1) -- 인해술 if( @Level >= 40) insert into Skill values ( @PID, 19, 1) -- 인노술 if( @Level >= 45) insert into Skill values ( @PID, 20, 1) -- 인거술 if( @Level >= 50) insert into Skill values ( @PID, 21, 1) -- 인화술 end end else if( @Class = 2) begin if ( @Level >= 25) insert into Skill values ( @PID, 15, 1) -- 침묵의화살 if ( @Specialty = 3 and @Level >= 30) insert into Skill values ( @PID, 7, (@Level - 30) / 5 + 1 ) -- 뛰어난기회포착 end -- 1차전직 기술 습득 if ( @Specialty >= 3) insert into Skill values ( @PID, 11, 2) -- 휴식2레벨 else insert into Skill values ( @PID, 11, 1) -- 휴식1레벨 -- 2차전직 기술 습득 if ( @Specialty >= 7) insert into Skill values ( @PID, 30, (@Level - 45) / 5) -- 생명력강화 END close Player_Cursor deallocate Player_Cursor update Player set SUPoint = [Level] - 1 + (select count(*) from Quest where Quest.PID = @PID and Quest.[Quest] in ( 7, 11, 12, 13, 14, 16, 19, 21, 22, 23, 24, 33) and Quest.[Clear] = 1) where [PID] = @PID
Name Change:Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[MoveItem] Script Date: 07/06/2008 16:52:25 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO -- 인자 -- @ PID who receive items PID -- @ IID moving items IID ALTER PROCEDURE [dbo].[MoveItem] @PID INT, @IID INT AS IF ( EXISTS (SELECT * FROM Item WHERE IID = @IID) ) BEGIN UPDATE Item SET PID = @PID, Info = Info&0xFFFFFFEF WHERE IID = @IID INSERT INTO Log VALUES ( GETDATE(), 15, 53, @PID, 0, @IID, 0, 0, 0, 0) END ELSE -- @PID BEGIN PRINT 'This item does not exist' END
Delete Player:Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[NameChange] Script Date: 07/06/2008 16:56:22 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[NameChange] @NameOld varchar(16), @NameNew varchar(16) AS DECLARE @PID int SELECT @PID = [PID] FROM Player WHERE [Name] = @NameOld if (select count(*) from Player where [Name] = @NameOld) > 0 begin if ( select count(*) from Player where [Name] = @NameNew) = 0 begin update Player set [Name] = @NameNew where [Name] = @NameOld update MLM set [Name] = @NameNew where [Name] = @NameOld update Friend set [FName] = @NameNew where [FName] = @NameOld update Mail set [SName] = @NameNew where [SName] = @NameOld update Mail set [RName] = @NameNew where [RName] = @NameOld if @@ERROR = 0 begin --INSERT INTO NameChanged VALUES ( GETDATE(), @PID, @NameOld, @NameNew) PRINT 'Sucessfully Changed. ' end else PRINT 'Failed. ' end else PRINT 'The new name already exists. ' end else PRINT 'Name does not exist. '
Change Co-Ordinates:Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[DeletePlayer] Script Date: 07/06/2008 17:06:33 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO ALTER procedure [dbo].[DeletePlayer] @PID int as DELETE FROM Player WHERE [PID] = @PID DELETE FROM Item WHERE [PID] = @PID AND ( [Info] & 16) = 0 -- 16 : ITEM_STORAGE DELETE FROM Quest WHERE [PID] = @PID DELETE FROM Skill WHERE [PID] = @PID
Unbound Items:Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[ChangeCoordinate] Script Date: 07/06/2008 17:13:46 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[ChangeCoordinate] @PID int AS SELECT * FROM Player WHERE PID = @PID UPDATE Player SET X=256495, Y=258908, Z=16297 WHERE PID = @PID SELECT * FROM Player WHERE PID = @PID
Code:USE [kal_db] GO /****** Object: StoredProcedure [dbo].[Own2Free] Script Date: 07/06/2008 17:15:43 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO ALTER PROCEDURE [dbo].[Own2Free] @IID int AS UPDATE Item SET Info = Info&0xFFFFFF7F WHERE IID = @IID


Reply With Quote![[Release] Stored Procedures.](http://ragezone.com/hyper728.png)


