📄 charinfotable.sql
字号:
--insert
DBCC USEROPTIONS
--drop proc dbo.s_insertChar
create proc dbo.s_insertChar
--charInfo
@iAccountID as int, -- AccountID
@name as char(16), -- 纳腐磐 捞抚
@iSh as int, -- _iShape
@bUn as tinyint, -- 辆练
@bJob as tinyint, -- 贸澜 急琶 流诀
@bSex as tinyint, -- 己喊
--charDetailInfo
@bStr as tinyint,
@bVit as tinyint,
@bInt as tinyint,
@bMan as tinyint,
@bDex as tinyint,
@stHp as smallint,
@stMp as smallint,
@xPos as real,
@yPos as real,
@zPos as real,
@bZN as tinyint, -- 矫累 粮
@charIdx as int OUTPUT
--Inven
As
SET NOCOUNT ON
select _charname from dbo.charInfo where _charname = @name
if @@Rowcount > 0
begin
set @charIdx = 2147483647 -- int MAX
return
end
begin tran
insert dbo.charInfo values (@name,@iSh, @bUn, @bJob, 0/*classshape*/,@iAccountID,getdate() - 1,@bSex) --for test
set @charIdx = @@IDENTITY;
if @@Error <> 0
begin
rollback tran
return
end
-- charDetailInfo俊 火涝
insert dbo.charDetailInfo values(@charIdx, 0/*捣*/, 0, 0/*胶懦*/, @bStr, @bVit, @bInt, @bMan, @bDex/*,0 焊呈胶 胶泡*/,
@stHp, @stMp, 0/*捞惑惑怕*/, 0/*滚橇*/, 1/*饭骇*//*, 0skillP*/, 0/*spriteP*/, 0/*疙己*/,
@xPos, @yPos, @zPos, @bZN, 0/*macro*/,0/*bClass*/,0/*guild*/,0/*何劝Index*/,0/*版氰摹*/)
if @@Error <> 0
begin
rollback tran
return
end
-- Inven 俊 火涝
insert dbo.InvenItem values (@charIdx
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
if @@Error <> 0
begin
rollback tran
return
end
-- 扁夯 酒捞袍 update
-- 芒绊俊 火涝, 霉 纳腐磐扼搁.
DECLARE @icount INT
select @icount = count(_iAccountID) from dbo.charInfo where _iAccountID = @iAccountID
if @icount = 1
begin
insert dbo.StoreItem values (@iAccountID
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
)
if @@Error <> 0
begin
rollback tran
return
end
end
set @charIdx = 1
commit tran
go
--insert dbo.charInfo values ('test1',1, 2, 3, 0/*classshape*/,3,getdate() - 1)
--select * from dbo.charInfo
--declare @put int
--exec sp_deleteChar '4','test11',@put output
--select @put
declare @Put int
exec s_deleteChar '3','4','hoon4',@Put output
select @Put
--drop proc dbo.s_deleteChar
create proc dbo.s_deleteChar
@iAccountID as int,
@charIdx as int,
@name as char(16),
@ret as int = 0 OUTPUT -- 1: 角菩 2:己傍
As
begin tran
DECLARE @icount INT
select @icount = count(_iAccountID) from dbo.charInfo where _iAccountID = @iAccountID
delete from dbo.charInfo where _charname = @name and _CreateTime < getdate() - 1 and _charIndex = @charIdx
if @@Rowcount > 0
begin
set @ret = 2
end
else
begin
commit tran
set @ret = 1
return
end
if @@Error <> 0
begin
rollback tran
set @ret = 1
return
end
SET NOCOUNT ON
-- charDetailInfo 昏力
delete from dbo.charDetailInfo where _charIndex = @charIdx
if @@Error <> 0
begin
set @ret = 1
rollback tran
return
end
-- Inven 昏力
delete from dbo.InvenItem where _charIndex = @charIdx
if @@Error <> 0
begin
rollback tran
set @ret = 1
return
end
-- equip俊 昏力
delete from dbo.EquipItem where _charIndex = @charIdx
if @@Error <> 0
begin
rollback tran
set @ret = 1
return
end
if @icount = 1
begin
--芒绊俊 昏力
delete from dbo.StoreItem where _iAccountID = @iAccountID
if @@Error <> 0
begin
rollback tran
set @ret = 1
return
end
--芒绊俊 昏力
delete from dbo.StoreItem2 where _iAccountID = @iAccountID
if @@Error <> 0
begin
rollback tran
set @ret = 1
return
end
end
commit tran
go
-- char 抛捞喉甸狼 select sp 累己
--drop proc s_selectCRInfo
create proc dbo.s_selectCRInfo
@id as int
AS
SET NOCOUNT on
select _charIndex,_charname,_iShape,_bUnion,
_bJob,_iClassShape,_bSex from dbo.charInfo where _iAccountID = @id
go
--@icount as int OUTPUT
--set @icount = @@RowCount
--return (@@Rowcount)
--exec sp_selectCRInfo 'hoon1'
--declare @count int
--exec @count = sp_selectCRInfo2 'hoon1'
--exec sp_selectCRInfo 'hoon1' ,@count output
--select @count
--select * from dbo.charInfo
--drop proc dbo.s_selectDetail
create proc dbo.s_selectDetail
@index as int
AS
SET NOCOUNT on
select _iMoney, _iStoreMoney, _bStr, _bVit, _bInt, _bMan, _bDex/*, _shSpareST*/, _stHp, _stMp,
_bLevel/*, _bSkillPoint*/, _iSpritePoint, _iFame, _xPos, _yPos, _zPos, _bZoneNumber, _bClass, _iGuild,_bWarpPos,_iExp,
_Skill, _bStrangeST, _strBuff, _Macro
from dbo.charDetailInfo where _charIndex = @index
go
--exec sp_selectDetail '1'
--select * from charInfo
-- char 抛捞喉狼 update sp
-- drop proc dbo.s_UpdateCRInfo
create proc dbo.s_UpdateCRInfo
@name as char(16),
@iSp as int,
@bJob as tinyint,
@iSC as int
As
begin tran
SET NOCOUNT on
update dbo.charInfo set _iShape = @iSp, _bJob = @bJob, _iClassShape = @iSC
where _charname = @name
if @@Error <> 0
begin
rollback tran
end
else
begin
commit tran
end
go
select * from charInfo where _charIndex = 3
select * from charDetailInfo where _charIndex = 3
select * from EquipItem where _charIndex = 3
select * from StoreItem where _iAccountID = 1
--select * from charDetailInfo
--exec s_UpdateDetail 1,0,0,
-- drop proc dbo.s_UpdateDetail
create proc dbo.s_UpdateDetail
@iIndex as int,--_charIndex int, --character Server 俊辑 积己等 key
@iMy as int, -- 牢亥 捣
@iSM as int, -- 芒绊 捣
@Sk as binary(84), -- 胶懦
@bStr as tinyint,
@bVit as tinyint,
@bInt as tinyint,
@bMan as tinyint,
@bDex as tinyint,
--@ssSST as smallint, -- 饭骇 1诀寸 3究 盒硅
@stHp as smallint,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -