[MANUAL] Фикс чаров мутантов для ц4

Тема в разделе "Установка и настройка (Setup and configuration)", создана пользователем root, 27 сен 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    Не помню постил или нет, потому возможно повторюсь. Делалось самим по мотивам процедур от гф.
    Код:
    USE [lin2world]GO
    /****** Object:  StoredProcedure [dbo].[lin_CreateChar]    Script Date: 12/14/2012 17:52:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    
    
    
    
    
    ALTER PROCEDURE [dbo].[lin_CreateChar]
    (  
    @char_name NVARCHAR(24),  
    @account_name NVARCHAR(24),  
    @account_id INT,  
    @pledge_id INT,  
    @builder  TINYINT,  
    @gender TINYINT,  
    @race  TINYINT,  
    @class  TINYINT,  
    @world  SMALLINT,  
    @xloc  INT,  
    @yloc  INT,  
    @zloc  INT,  
    @HP  FLOAT,  
    @MP  FLOAT,  
    @SP  INT,  
    @Exp  INT,  
    @Lev  TINYINT,  
    @align  SMALLINT,  
    @PK  INT,  
    @Duel  INT,  
    @PKPardon  INT,  
    @FaceIndex   INT = 0,  
    @HairShapeIndex  INT = 0,  
    @HairColorIndex  INT = 0  
    )  
    AS  
      
    SET NOCOUNT ON  
      
    SET @char_name = RTRIM(@char_name)  
    DECLARE @char_id int  
    SET @char_id = 0  
    
    
    -- Checking mutant cheat
    if(@FaceIndex>6)set @FaceIndex=0
    if(@HairShapeIndex>3)set @HairShapeIndex=0
    if(@HairColorIndex>2)set @HairColorIndex=0
    
    
    -- Checking class cheat
    if((@race=0) AND (@class!=0) AND (@class!=10))set @class=0
    if((@race=1) AND (@class!=18) AND (@class!=25))set @class=18
    if((@race=2) AND (@class!=31) AND (@class!=38))set @class=31
    if((@race=3) AND (@class!=44) AND (@class!=49))set @class=44
    if((@race=4) AND (@class!=53))set @class=53
    
    
    -- check for symbols
    if @char_name like N'%[^a-zA-Z0-9]%'
    begin
        raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)  
        return -1
    end
    
    
    -- check for space
    if @char_name like N'% %'
    begin
        raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)  
        return -1
    end
    
    
    -- check user_data
    if exists(select char_name from user_data (nolock) where char_name = @char_name)
    begin
        raiserror ('Character name is used: name = [%s]', 16, 1, @char_name)
        return -1
    end
    
    
    -- check user_prohibit
    if exists(select char_name from user_prohibit (nolock) where char_name = @char_name)
    begin
        raiserror ('Character name is prohibited: name = [%s]', 16, 1, @char_name)
        return -1
    end  
      
    -- check reserved name  
    declare @reserved_name nvarchar(50)  
    declare @reserved_account_id int  
    select top 1 @reserved_name = char_name, @reserved_account_id = account_id from user_name_reserved (nolock) where used = 0 and char_name = @char_name  
    if not @reserved_name is null  
    begin  
     if not @reserved_account_id = @account_id  
     begin  
      RAISERROR ('Character name is reserved by other player: name = [%s]', 16, 1, @char_name)  
      RETURN -1  
     end  
    end  
      
    -- insert user_data
    INSERT INTO user_data   
    ( char_name, account_name, account_id, pledge_id, builder, gender, race, class, subjob0_class, 
    world, xloc, yloc, zloc, HP, MP, max_hp, max_mp, SP, Exp, Lev, align, PK, PKpardon, duel, create_date, face_index, hair_shape_index, hair_color_index )  
    VALUES  
    (@char_name, @account_name, @account_id, @pledge_id, @builder, @gender, @race, @class, @class, 
    @world, @xloc, @yloc, @zloc, @HP, @MP, @HP, @MP, @SP, @Exp, @Lev, @align, @PK, @Duel, @PKPardon, GETDATE(), @FaceIndex, @HairShapeIndex, @HairColorIndex)  
      
    IF (@@error = 0)  
    BEGIN  
     SET @char_id = @@IDENTITY  
     INSERT INTO quest (char_id) VALUES (@char_id)  
    END  
      
    SELECT @char_id  
      
    if @char_id > 0  
    begin  
     -- make user_history  
     exec lin_InsertUserHistory @char_name, @char_id, 1, @account_name, NULL  
     if not @reserved_name is null  
      update user_name_reserved set used = 1 where char_name = @reserved_name  
    end
    Кому надо под другие хроники прически и требуху карамельскую сами добавите :)
    У кого длл за 2012г