Макрос на панели шорткатов

Ezequiel

Последний из атеистов
Местный
Сообщения
58
Розыгрыши
0
Репутация
0
Реакции
5
Баллы
850
Добрый день!
Прошу подсказки уважаемые форумчане!
При создании чара требуется создать на панели шорткатов макрос '.menu'
Знаю что это реализуется в хранимых процедурах используя таблицу lin_CreateChar, а вот что туда прописать и как не могу понять.
Буду признателен любой подсказке.
Спасибо!
 

Ну так как сборка неуказана, то в CharacterCreate.java
 
Добрый день!
Прошу подсказки уважаемые форумчане!
При создании чара требуется создать на панели шорткатов макрос '.menu'
Знаю что это реализуется в хранимых процедурах используя таблицу lin_CreateChar, а вот что туда прописать и как не могу понять.
Буду признателен любой подсказке.
Спасибо!
Сделайте проще, закиньте макрос с нужным вам .menu и посмотрите в базу что и куда добавляет.
Потом сделайте похожее в процедуре.
Но как по мне было бы гораздо проще реализовать такое в интерфейсе если вам нужно вывести это на кнопку.
В данном случае если вам не нужен item mall, prime-mall, можете в его коде кнопки прописать такое:
Код:
ExecuteCommand(".menu");
 
Сделайте проще, закиньте макрос с нужным вам .menu и посмотрите в базу что и куда добавляет.
Потом сделайте похожее в процедуре.
Но как по мне было бы гораздо проще реализовать такое в интерфейсе если вам нужно вывести это на кнопку.
В данном случае если вам не нужен item mall, prime-mall, можете в его коде кнопки прописать такое:
Код:
ExecuteCommand(".menu");
Макрос создается в user_macros (данные макроса, название, иконка и т.д.) и user_macrosinfo (команды в макросе)

Мне нужно чтобы он создавался только при создании чара, т.е если пользователь его удалит, он больше не появится никогда.

И как вот это все воткнуть и что прописать я очень затрудняюсь …
 
Макрос создается в user_macros (данные макроса, название, иконка и т.д.) и user_macrosinfo (команды в макросе)

Мне нужно чтобы он создавался только при создании чара, т.е если пользователь его удалит, он больше не появится никогда.

И как вот это все воткнуть и что прописать я очень затрудняюсь …
Скиньте как выглядит структура таблицы user_macros без данных, с данными только нужного макроса на панели.
И скиньте таблицу отвечающей что у вас будет на старте.
Попробуем разобраться.
Только заверните все это в ббкод code и под спойлер.

Добавлю ниже процедурный запрос для lin2db, попробуйте у меня пока нет возможности проверить.
Сделайте предварительно бэкап.

Скрытое содержимое доступно для зарегистрированных пользователей!


Должно по идее создавать и добавлять иконку на панель.
 
Скиньте как выглядит структура таблицы user_macros без данных, с данными только нужного макроса на панели. И скиньте таблицу отвечающей что у вас будет на старте. Попробуем разобраться. Только заверните все это в ббкод code и под спойлер. Добавлю ниже процедурный запрос для lin2db, попробуйте у меня пока нет возможности проверить. Сделайте предварительно бэкап. *** Скрытый текст не может быть процитирован. *** Должно по идее создавать и добавлять иконку на панель.
хранимка при создании чара:

Форматирование (BB-код):
USE [lin2world]
GO
/****** Object:  StoredProcedure [dbo].[lin_CreateChar]    Script Date: Сб, 20.04.2024 17:16:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




/**
name:    lin_CreateChar
desc:    create user_data, quest, user_slot

history:    2007-03-30    modified by btwinuni
*/
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        bigint,
    @Lev        tinyint,
    @align        smallint,
    @PK        int,
    @nickname int,
    @Duel        int,
    @PKPardon    int,
    @FaceIndex    int = 0,
    @HairShapeIndex    int = 0,
    @HairColorIndex    int = 0
)

as

--set @Exp=25259243744
--set @SP=50000000
--set @Lev=85

set nocount on

declare @char_id int

set @char_id = 0
set @char_name = rtrim(@char_name)

if (@gender > 1) OR (@gender<0) set @gender = 0
if (@race > 5) OR (@race<0) set @race = 0
if (@HairShapeIndex<0) set @HairShapeIndex = 0
if (@FaceIndex<0) set @HairShapeIndex = 0
if (@race = 5) begin
  if (@HairShapeIndex>2) set @HairShapeIndex=0
end else begin
  if (@HairShapeIndex>3) set @HairShapeIndex=0
end
if (@gender = 0) begin
  if (@FaceIndex>4) set @FaceIndex=0
end else begin
  if (@FaceIndex>6) set @FaceIndex=0
end
if (@HairColorIndex>2) OR (@HairColorIndex<0) set @HairColorIndex=0

if @char_name like N'%[^a-zA-Z0-9]%'
begin
    raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)
    return -1
end

if @char_name like N'% %'
begin
    raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)
    return -1
end

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

declare @user_prohibit_word nvarchar(20)
select top 1 @user_prohibit_word = words from user_prohibit_word (nolock) where @char_name like '%' + words + '%'
if @user_prohibit_word is not null
begin
    raiserror ('Character name has prohibited word: name = [%s], word[%s]', 16, 1, @char_name, @user_prohibit_word)
    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, nickname, 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, 'Title', @Duel, @PKPardon,
    GETDATE(), @FaceIndex, @HairShapeIndex, @HairColorIndex
)
 
if (@@error = 0)
begin
    set @char_id = @@identity
    insert into quest (char_id) values (@char_id)
    insert into user_slot (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

структура таблицы user_macro:

структура таблицы user_marcoinfo

Вот соответственно мне нужно в хранимку создания персонажа воткнуть создание макроса на шорткате с именем ".menu" и названием макроса соответственно такое-же "MENU"

хранимка при создании чара:

Форматирование (BB-код):
USE [lin2world]
GO
/****** Object:  StoredProcedure [dbo].[lin_CreateChar]    Script Date: Сб, 20.04.2024 17:16:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




/**
name:    lin_CreateChar
desc:    create user_data, quest, user_slot

history:    2007-03-30    modified by btwinuni
*/
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        bigint,
    @Lev        tinyint,
    @align        smallint,
    @PK        int,
    @nickname int,
    @Duel        int,
    @PKPardon    int,
    @FaceIndex    int = 0,
    @HairShapeIndex    int = 0,
    @HairColorIndex    int = 0
)

as

--set @Exp=25259243744
--set @SP=50000000
--set @Lev=85

set nocount on

declare @char_id int

set @char_id = 0
set @char_name = rtrim(@char_name)

if (@gender > 1) OR (@gender<0) set @gender = 0
if (@race > 5) OR (@race<0) set @race = 0
if (@HairShapeIndex<0) set @HairShapeIndex = 0
if (@FaceIndex<0) set @HairShapeIndex = 0
if (@race = 5) begin
  if (@HairShapeIndex>2) set @HairShapeIndex=0
end else begin
  if (@HairShapeIndex>3) set @HairShapeIndex=0
end
if (@gender = 0) begin
  if (@FaceIndex>4) set @FaceIndex=0
end else begin
  if (@FaceIndex>6) set @FaceIndex=0
end
if (@HairColorIndex>2) OR (@HairColorIndex<0) set @HairColorIndex=0

if @char_name like N'%[^a-zA-Z0-9]%'
begin
    raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)
    return -1
end

if @char_name like N'% %'
begin
    raiserror ('Character name has space : name = [%s]', 16, 1, @char_name)
    return -1
end

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

declare @user_prohibit_word nvarchar(20)
select top 1 @user_prohibit_word = words from user_prohibit_word (nolock) where @char_name like '%' + words + '%'
if @user_prohibit_word is not null
begin
    raiserror ('Character name has prohibited word: name = [%s], word[%s]', 16, 1, @char_name, @user_prohibit_word)
    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, nickname, 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, 'Title', @Duel, @PKPardon,
    GETDATE(), @FaceIndex, @HairShapeIndex, @HairColorIndex
)
 
if (@@error = 0)
begin
    set @char_id = @@identity
    insert into quest (char_id) values (@char_id)
    insert into user_slot (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

структура таблицы user_macro:


структура таблицы user_marcoinfo


Вот соответственно мне нужно в хранимку создания персонажа воткнуть создание макроса на шорткате с именем ".menu" и названием макроса соответственно такое-же "MENU"

структура таблицы user_macro:
48AKmPM.png


структура таблицы user_marcoinfo:
M6KnDyu.png
 
Последнее редактирование:

Похожие темы

Назад
Сверху Снизу