- Joined
- Jul 18, 2009
- Messages
- 391
- Reaction score
- 129
I will keep this thread updated with released procedures that fix things, and procedures that are usefull to people running a Pangya server.
All credits go to the people who created and/or modified these procedures to make them work, I only gathered them into one thread.
Procedure Fixes
Tutorial Fix by chreadie
Mail / Giveitem Fix (USP_MAIL_SEND) by chreadie
Card Equip Fix by lizardo (as posted by Acardia)
TD_CHAR_EQUIP_SAVE_S4 Fix by chreadie
Usefull Procedures
Add Item To User By Tsukasa
Register Proc that auto-adds Cookies by X_Sarah_X
All credits go to the people who created and/or modified these procedures to make them work, I only gathered them into one thread.
Procedure Fixes
Tutorial Fix by chreadie
Mail / Giveitem Fix (USP_MAIL_SEND) by chreadie
Card Equip Fix by lizardo (as posted by Acardia)
TD_CHAR_EQUIP_SAVE_S4 Fix by chreadie
Usefull Procedures
Add Item To User By Tsukasa
Code:
USE [Pangya_S4_TH]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[TSU_AddItemToUser] (
@user_id varchar(32),
@item_id int
)
AS
BEGIN
DECLARE @user_idx int
SELECT @user_idx = [UID] FROM [Pangya_Member_Info]
WHERE [userid] = @user_id
IF @@ROWCOUNT = 1
BEGIN
SELECT [TYPEID] AS [Item ID], [NAME] AS [Item Name] FROM [PANGYA_ITEM_TYPELIST]
WHERE TYPEID = @item_id
IF @@ROWCOUNT = 1
BEGIN
INSERT INTO Pangya_Item_WareHouse ( [UID], [typeid], [valid], [regdate] )
VALUES ( @user_idx, @item_id, 1, GETDATE())
RETURN @@ERROR
END
ELSE
BEGIN
PRINT N'Item does not exist!'
RETURN 1
END
END
ELSE
BEGIN
PRINT N'User does not exist!'
RETURN 1
END
END
GO
Register Proc that auto-adds Cookies by X_Sarah_X
Code:
USE [ini3_py_account]
GO
/****** Object: StoredProcedure [dbo].[SP_PANGYA_REGIST] Script Date: 02/05/2011 20:02:14 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[SP_PANGYA_REGIST]
@idcard CHAR(13),
@sex BIT,
@birthday VARCHAR(50),
@zipcode CHAR(5),
@id VARCHAR(32),
@pswd VARCHAR(32)
AS
IF NOT EXISTS( SELECT UserID FROM Ini3_UserLogin WHERE UserID = @id AND VisaIDCard = @idcard)
BEGIN
INSERT INTO Ini3_UserLogin(UserID, Password, Birthday, Sex, VisaIDCard, Confirm18, UserName, ZipCode)
VALUES (@id, @pswd, CONVERT(DATETIME,@birthday), @sex, @idcard, '0', @id, @zipcode)
-- Registration Done, adding cookies procedure below
DECLARE @UserName varchar(32)
DECLARE @UserIdx int
-- Static sitecode, is always 'ini3'
DECLARE @siteCode varchar(5)
SET @siteCode = N'ini3'
-- Get the nickname and the idx for the specified user from the game-server database...
SELECT @UserName = [UserID], @UserIdx = [idx] FROM [ini3_py_account].[dbo].[Ini3_UserLogin]
WHERE userid = @id;
-- Check whether we have previous records for this user...
SELECT UserNo, UserID FROM [INI3BILL_DB].[dbo].TAccountMst
WHERE UserNo = @UserIdx
AND UserID = @id
IF @@ROWCOUNT = 0
-- User never got cookies so we need to create a new row for him...
INSERT INTO [INI3BILL_DB].[dbo].TAccountMst ([SiteCode], [UserNo], [UserID], [UserName], [CookieAmt])
VALUES ( @siteCode, @UserIdx, @id, @UserName, '250000')
ELSE
-- User has cookies so we can simply update the old value
UPDATE [INI3BILL_DB].[dbo].TAccountMst SET [CookieAmt] = [CookieAmt] + '250000', [UpdDate] = CURRENT_TIMESTAMP
WHERE [UserNo] = @UserIdx AND [UserID] = @id
END