Massive-Forum

Knight Online Koxp | 1849 Koxp - 1299 Koxp - 1849 Multi Client - Metin 2 hile ,bot,
 
AnasayfaAnasayfa  Kayıt OlKayıt Ol  Giriş yapGiriş yap  

Paylaş | 
 

 SQL 2005 Üzeri Başlangıç İtem Sorunu [Fixlendi]

Aşağa gitmek 
YazarMesaj
adiyosb4by



Mesaj Sayısı : 62
Kayıt tarihi : 08/05/10

MesajKonu: SQL 2005 Üzeri Başlangıç İtem Sorunu [Fixlendi]   Paz Mayıs 09, 2010 9:31 am

Selamlar

Kısa Geçiyorum Arkadaşlar SQL 2005 ve Üzeri Sistemlerde smallint Sorunu Oluyordu Biraz Araştırıp Fixledim Yardımlarından Dolayı Gökhan ve Trgino'ya Teşükkürler.Alıntı Yazısı Altında Paylaşmanız Dileğimle

PHP- Kodu:
USE [kn_online]
GO
/****** Object: Table [dbo].[Baslangic] Script Date: 04/18/2010 04:58:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE
[dbo].[Baslangic](
[class] [
smallint] NULL,
[
stritem] [varchar](400) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF


PHP- Kodu:
USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[baslangicitem] Script Date: 04/18/2010 04:58:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE
[dbo].[baslangicitem]
@
account varchar(21)
AS
begin

declare @class int

select
@class = class from userdata where struserid=@account

if @class in (101, 105, 106, 201, 205, 206)
set @class = 1

if @class in (102, 107, 108, 202, 207, 208)
set @class = 2

if @class in (103, 109, 110, 203, 209 ,210)
set @class = 3

if @class in (104, 111, 112, 204, 211, 212)
set @class = 4

update userdata set stritem
= (select stritem from baslangic where class=@class) where struserid=@account

end


PHP- Kodu:
USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[item_decode] Script Date: 04/18/2010 04:59:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure
[dbo].[item_decode]
@
StrUserID varchar(30)
AS
DECLARE
@
length int,
@
i int,
@
Num int,
@
dur int,
@
duar int,
@
StackSize1 int,
@
InventorySlot int,
@
Row int,
@
name varchar(100),
@
extname varchar(100),
@
ext int


set
@i = 14*0+1
set
@length = 401

select
@row=count(*) from userdata where struserid=@StrUserID

delete from INVENTORY_EDIT where struserid
=@StrUserID

if @row>0
begin

WHILE @i < @length
Begin

Select
@Num=cast(cast(substring(cast(substring(strItem, @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int),
@
dur = cast(cast(cast( substring(strItem, @i+5, 1) as varbinary(1))+cast(substring(strItem, @i+4, 1) as varbinary(1)) as varbinary(2)) as int),
@
StackSize1 = cast(cast(cast( substring(strItem, @i+7, 1) as varbinary(1))+cast(substring(strItem, @i+6, 1) as varbinary(1)) as varbinary(2)) as int),
@
StrUserID = strUserID
From UserData
Where strUserID
= @StrUserID


if @Num=0
begin
set
@extname='Free Slot'
set @name='Free Slot'
end
else
begin
set
@extname='Not Find'
set @name='Not Using'

select @extname=strName from item where Num=@Num

if @extname='Not Find'
begin

set
@ext=-1
set
@name='Not Find'

select @extname=strName,@ext=Slot from item where Num= cast(substring(cast(@Num as varchar(9)), 1, 6)+'000' as int) --cast(substring(cast(@Num as varbinary(4)),0,5) as int)*1000
if @ext>-1
begin
set
@duar=-1
If @ext = 0
select
@duar = Duration,@name=strName From item where Num = cast(substring(cast(@Num as varchar(9)), 7, 9) as int)
end
end
end

insert into INVENTORY_EDIT
(Num,stacksize,Durability,struserid,InventorySlot,ItemName,extname) values(@Num,@stacksize1,@dur,@StrUserID,(@i-1) / 8,@extname,@name )

set @i=@i+8

end
end


PHP- Kodu:
USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[ITEMLERI_BUL] Script Date: 04/18/2010 04:59:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure
[dbo].[ITEMLERI_BUL]
@
StrUserID varchar(30)
AS
DECLARE
@
length int, -- stritem uzunluğu
@i int, -- item'in stritem deki yeri
@dwid int,
@dur int,
@duar int,
@StackSize1 int,
@Sira int,
@Row int,
@name varchar(100),
@extname varchar(100),
@ext int


set @i = 14*0+1
set @length = 401

select @row=count(*) from userdata where struserid=@StrUserID

delete from itemler where struserid=@StrUserID

if @row>0
begin

WHILE @i < @length
Begin

Select @dwid=cast(cast(substring(cast(substring(strItem, @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(strItem, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int),
@dur = cast(cast(cast( substring(strItem, @i+5, 1) as varbinary(1))+cast(substring(strItem, @i+4, 1) as varbinary(1)) as varbinary(2)) as smallint),
@StackSize1 = cast(cast(cast( substring(strItem, @i+7, 1) as varbinary(1))+cast(substring(strItem, @i+6, 1) as varbinary(1)) as varbinary(2)) as int),
@StrUserID = strUserID
From UserData
Where strUserID = @StrUserID


if @dwid=0
begin
set @extname='
~~~~~~ item yok ~~~~~~'
set @name='
~~~~~~ item yok ~~~~~~'
end
else
begin
set @extname='
Bulunamadı'
set @name='
Gerekli Değil'

select @extname=szname from item_basic where dwid=@dwid

if @extname='
Bulunamadi'
begin

set @ext=-1
set @name='
Bulunamadı'

select @extname=szname,@ext=byextindex from item_basic where dwid= cast(substring(cast(@dwid as varchar(9)), 1, 6)+'
000' as int) --cast(substring(cast(@dwid as varbinary(4)),0,5) as int)*1000
if @ext>-1
begin
set @duar=-1
If @ext = 0
select @duar = siMaxDurability,@name=szheader From itemext0 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 1
select @duar = siMaxDurability,@name=szheader from itemext1 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 2
select @duar = siMaxDurability,@name=szheader from itemext2 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 3
select @duar = siMaxDurability,@name=szheader from itemext3 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 4
select @duar = siMaxDurability,@name=szheader from itemext4 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 5
select @duar = siMaxDurability,@name=szheader from itemext5 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 6
select @duar = siMaxDurability,@name=szheader from itemext6 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 7
select @duar = siMaxDurability,@name=szheader from itemext7 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 8
select @duar = siMaxDurability,@name=szheader from itemext8 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 9
select @duar = siMaxDurability,@name=szheader from itemext9 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 10
select @duar = siMaxDurability,@name=szheader from itemext10 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 11
select @duar = siMaxDurability,@name=szheader from itemext11 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 12
select @duar = siMaxDurability,@name=szheader from itemext12 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 13
select @duar = siMaxDurability,@name=szheader from itemext13 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 14
select @duar = siMaxDurability,@name=szheader from itemext14 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 15
select @duar = siMaxDurability,@name=szheader from itemext15 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 16
select @duar = siMaxDurability,@name=szheader from itemext16 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 17
select @duar = siMaxDurability,@name=szheader from itemext17 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 18
select @duar = siMaxDurability,@name=szheader from itemext18 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 19
select @duar = siMaxDurability,@name=szheader from itemext19 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 20
select @duar = siMaxDurability,@name=szheader from itemext20 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 21
select @duar = siMaxDurability,@name=szheader from itemext21 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
If @ext = 23
select @duar = siMaxDurability,@name=szheader from itemext23 where dwid = cast(substring(cast(@dwid as varchar(9)), 7, 9) as int)
end
end
end

insert into itemler (dwid,stacksize,durability,struserid,sira,itembasicname,extname) values(@dwid,@stacksize1,@dur,@StrUserID,(@i-1) / 8,@extname,@name )

set @i=@i+8

end
end


PHP- Kodu:
USE [kn_online]
GO
/****** Object: StoredProcedure [dbo].[ITEMLERI_ENCODE] Script Date: 04/18/2010 04:59:52 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO


ALTER procedure
[dbo].[ITEMLERI_ENCODE]
@
StrUserID varchar(30)
AS
DECLARE
@
length int, -- stritem uzunluğu
@row int, -- yerine göre deişior.
@
i int, -- item'in stritem deki yeri
@dwid int, -- dwid
@pos int,
@dur int,
@dur1 int,
@Kocuce int,
@ext int,
@StackSize1 int,
@strName varchar(30),
@strExtName varchar(30),
@Cdwid varbinary(4),
@cdur varchar(2),
@Source tinyint,
@NEWdwid int,
@StackSize int,
@cstack varchar(2),
@sira int

set @sira=0
set @i = 14*0
set @length = 401

select @row=count( * ) from userdata where struserid=@StrUserID

if @row>0
begin


Select @dwid=dwid,
@dur = durability,
@StackSize1 = stacksize,
@StrUserID = strUserID
From itemler
Where strUserID = @StrUserID and sira=@sira

Set @Cdwid = Substring(cast(@dwid as varbinary(4)), 4, 1) + Substring(cast(@dwid as varbinary(4)), 3, 1) + Substring(cast(@dwid as varbinary(4)), 2, 1) + Substring(cast(@dwid as varbinary(4)), 1, 1)
Set @Cdur = cast(Substring(cast(@dur as varbinary(2)), 2, 1)+Substring(cast(@dur as varbinary(2)), 1, 1) as varchar(2))
Set @Cstack = cast(Substring(cast(@StackSize1 as varbinary(2)), 2, 1)+Substring(cast(@StackSize1 as varbinary(2)), 1, 1) as varchar(2))


update UserData set strItem = cast(cast(cast(@Cdwid as varchar(4)) + @Cdur + @Cstack as varchar(Cool) as binary(400)) where strUserID = @strUserID


set @i=@i+8
set @sira=@sira+1



WHILE @sira < 50
Begin

Select @dwid=dwid,
@dur = durability,
@StackSize1 = stacksize,
@StrUserID = strUserID
From itemler
Where strUserID = @StrUserID and sira=@sira

Set @Cdwid = Substring(cast(@dwid as varbinary(4)), 4, 1) + Substring(cast(@dwid as varbinary(4)), 3, 1) + Substring(cast(@dwid as varbinary(4)), 2, 1) + Substring(cast(@dwid as varbinary(4)), 1, 1)
Set @Cdur = cast(Substring(cast(@dur as varbinary(2)), 2, 1)+Substring(cast(@dur as varbinary(2)), 1, 1) as varchar(2))
Set @Cstack = cast(Substring(cast(@StackSize1 as varbinary(2)), 2, 1)+Substring(cast(@StackSize1 as varbinary(2)), 1, 1) as varchar(2))



update UserData set strItem = cast( substring(strItem, 1, @i) + cast(cast(@Cdwid as varchar(4)) + @Cdur + @Cstack as varchar(Cool) + substring(strItem, @i+8, 401-@i) as binary(400)) where strUserID = @strUserID



set @i=@i+8
set @sira=@sira+1

end
end
DELETE FROM [dbo].[itemler]


Not : İtemli Başlangıcı Başlatmat İçin Create_New_Char Prosedürüne Altına

PHP- Kodu:
exec baslangicitem @CharID


Ekleyin

Saygılar İyi Forumlar
Sayfa başına dön Aşağa gitmek
 
SQL 2005 Üzeri Başlangıç İtem Sorunu [Fixlendi]
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
Massive-Forum :: Private Serverlar :: Prosedürler & Kodlar-
Buraya geçin: