CREATE PROCEDURE CreatePlayer
@uid int,
@name varchar(14),
@class tinyint,
@strength tinyint,
@health tinyint,
@intelligence tinyint,
@wisdom tinyint,
@dexterity tinyint,
@curhp smallint,
@curmp smallint,
@map tinyint,
@x int,
@y int,
@z int,
@face tinyint,
@hair tinyint
AS
DECLARE @PID int
DECLARE @GM int
DECLARE @globalgm int
DECLARE @itemid int
DECLARE @startitems int
DECLARE @knightx int
DECLARE @knighty int
DECLARE @knightz int
DECLARE @knightm int
DECLARE @magex int
DECLARE @magey int
DECLARE @magez int
DECLARE @magem int
DECLARE @archerx int
DECLARE @archery int
DECLARE @archerz int
DECLARE @archerm int
--***************************************
SET @startitems = 1 --set to 0 to disable
--Knight*********************************
SET @knightx = 233124 -- X Coord
SET @knighty = 252386 -- Y Coord
SET @knightz = 21176 -- Z Coord
SET @knightm = 0 -- MAP, 0 for normal world
--Mage***********************************
SET @magex = 233124 -- X Coord
SET @magey = 252386 -- Y Coord
SET @magez = 21176 -- Z Coord
SET @magem = 0 -- MAP, 0 for normal world
--Archer*********************************
SET @archerx = 233124 -- X Coord
SET @archery = 252386 -- Y Coord
SET @archerz = 21176 -- Z Coord
SET @archerm = 0 -- MAP, 0 for normal world
--***************************************
--Start Koordinates für jedes Klasse extra zuweisen
IF (@Class = 0) --knight
begin
Set @x = @knightx
Set @y = @knighty
Set @z = @knightz
Set @map = @knightm
end
ELSE IF (@Class = 1) --mage
begin
Set @x = @magex
Set @y = @magey
Set @z = @magez
Set @map = @magem
end
ELSE IF (@Class = 2) --archer
begin
Set @x = @archerx
Set @y = @archery
Set @z = @archerz
Set @map = @archerm
end
--Global Gamemaster, liest Admin in Login Table
SET @globalgm = (SELECT [Admin] FROM kal_auth.dbo.Login WHERE [UID] = @UID)
IF (@globalgm > 1)
begin
--SET @Name = "<gm>" + @name --Benötigt relog und gibt fehler
SET @GM = @globalgm
end
ELSE
begin
SET @GM = 0
end
--Charakter erstellen
begin
INSERT INTO Player ( [UID], [Admin], [Name], [Class], [Strength], [Health], [Intelligence], [Wisdom], [Dexterity], [CurHP], [CurMP], [Map], [X], [Y], [Z], [Face], [Hair]) VALUES ( @UID, @GM, @Name, @Class, @Strength, @Health, @Intelligence, @Wisdom, @Dexterity, @CurHP, @CurMP, @map, @x, @y, @z, @Face, @Hair)
end
--Jeder Klasse eigene Items geben
IF (@startitems = 1)
begin
SET @PID = (select max([PID]) from Player WHERE [UID] = @UID)
SET @itemid =(select max([IID]) from Item)
--common items
IF (@itemid >= 1000000)
begin
SET @itemid =(select max([IID]) from Item) + 1
end
ELSE
begin
SET @itemid = 1000000
end
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 47, 0, 128, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 1318, 0, 128, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 447, 0, 128, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
IF (@Class = 0) --knight
begin
--weapon
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 60, 0, 128, 1, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
--armor
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 16, 0, 128, 1, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 17, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 18, 0, 128, 1, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 19, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 20, 0, 128, 1, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 29, 0, 128, 1, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
end
ELSE IF (@Class = 1) --mage
begin
--weapon
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 97, 0, 128, 1, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
--armor
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 80, 0, 128, 1, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 81, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 82, 0, 128, 1, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 83, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 84, 0, 128, 1, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
end
ELSE IF (@Class = 2) --archer
begin
--weapon
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 63, 0, 128, 1, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
--armor
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 42, 0, 128, 1, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 43, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 44, 0, 128, 1, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 45, 0, 128, 1, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
SET @itemid = @itemid + 1
INSERT INTO Item ( [PID], [IID], [Index], [Prefix], [Info], [Num], [MaxEnd], [CurEnd], [SetGem], [XAttack], [XMagic], [XDefense], [XHit], [XDodge], [Protect], [UpgrLevel], [UpgrRate]) VALUES ( @PID, @itemid, 46, 0, 128, 1, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
end
end