|
Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo. Caso seja registrado, efetue login. Esqueceu sua senha? Clique aqui Recomendamos o uso do Mozilla Firefox para uma melhor visualização. |
|
| Início | Postados Hoje | Marcar Fóruns Como Lidos | Álbums | Banidos | SE Team | Medalhas |
|
|||||||
| Registrar | Loteria VIP | Staff SE | Regras do fórum | Comunidade | Arcade | Postados Hoje | Pesquisar | Experience |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||
|
|
![]() |
|
|
Ferramentas do Tópico | Modos de Exibição |
|
|
#1 | ||||||||||||||
|
Jesus Te Ama, Mas EU Não!
![]() Registrado em: Oct 2008
Localização: 45º 33º 34º N | 122º 41º 41º W DESTINATION: ANYWHERE Adidas
Posts: 4,133
Agradeceu: 837
Agradecido 6,058 Vezes em 2,106 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
![]()
Nome Real: Anderson Andrade
|
Essa Query cria no seu banco de dados algo que feito manualmente torna-se estressante para muitos administradores, nos casos de roubos de itens... Ao invés de você ficar tentando procurar no txt de Log, pode criar uma tabela e inserir essa Query.
Ela rastreará somente itens individuais (consume_type_normal), pois tentar localizar outro tipo de itens é um pouco difícil (se não quase impossível) devido as mudanças de item_id. Lembrando que isso resultará num aumento significativo de tamanho no seu banco de dados, porém, se você não tiver problemas quanto a isso, vá em frente. Precisamos criar uma nova tabela, nesta tabela serão armazenadas as informações dos itens e haverá outro campo, que serão as informações da data exata em que ocorreu a troca. Primeiro passo, crie a tabela: Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
USE [lin2world] GO /****** Object: Table [dbo].[user_item_log] Script Date: 08/06/2008 20:52:58 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[user_item_log]( [item_id] [int] NOT NULL, [char_id] [int] NOT NULL, [item_type] [int] NOT NULL, [amount] [int] NOT NULL, [enchant] [int] NOT NULL, [eroded] [int] NOT NULL, [bless] [tinyint] NOT NULL, [ident] [int] NOT NULL, [wished] [tinyint] NOT NULL, [warehouse] [int] NOT NULL, [date] [datetime] NOT NULL CONSTRAINT [DF_Table_1_create_date] DEFAULT (getdate()) ) ON [PRIMARY] ----------------------------------------------------------------------------------------------- Second step: Modifying lin_UpdateUserItem Store Procedure. Senha: www.secretexperience.net Query 1: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] Após, rode as próximas Querys 2 e 3. E caso veja necessidade, a 4 também. Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
/****** Object: Stored Procedure dbo.lin_UpdateUserItem Script Date: 2003-09-20 ?? 11:51:57 ******/
/********************************************
lin_UpdateUserItem
INPUT
@char_id INT,
@item_type INT,
@amount INT,
@enchant INT,
@eroded INT,
@bless INT,
@ident INT,
@wished INT,
@warehouse INT,
@item_id INT
OUTPUT
return
made by
carrot
date
2002-06-09
********************************************/
ALTER PROCEDURE [dbo].[lin_UpdateUserItem]
(
@char_id INT,
@item_type INT,
@amount INT,
@enchant INT,
@eroded INT,
@bless INT,
@ident INT,
@wished INT,
@warehouse INT,
@item_id INT
)
AS
SET NOCOUNT ON
-- START FidoW addon item tracker
DECLARE @isOK INT
SELECT @isOK = id FROM itemdata WHERE isQuest = 0 AND consumetype = 'consume_type_normal' AND id = @item_type
IF (@isOK IS NOT NULL)
BEGIN
DECLARE @old_char_id int
SELECT @old_char_id = char_id FROM user_item WHERE item_id = @item_id
IF (@old_char_id <> @char_id)
BEGIN
INSERT INTO user_item_log (item_id,char_id,item_type,amount,enchant,eroded,bless,ident,wished,warehouse,date)
VALUES (@item_id,@char_id,@item_type,@amount,@enchant,@eroded,@bless,@ident,@wished,@warehouse,GETDATE())
END
END
-- END FidoW addon item tracker
UPDATE user_item set char_id=@char_id, item_type=@item_type, amount=@amount, enchant=@enchant, eroded=@eroded, bless=@bless, ident=@ident, wished=@wished, warehouse=@warehouse WHERE item_id=@item_id
---------------------------------------------------------------------------------------------------
Step three: Update lin_CreateItem Store Proceduce.
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go /****** Object: Stored Procedure dbo.lin_CreateItem Script Date: 2003-09-20 ?? 11:51:57 ******/ /******************************************** lin_CreateItem create item sp INPUT @char_id INT, @item_type INT, @amount INT, @enchant INT, @eroded INT, @bless TINYINT, @ident TINYINT, @ready TINYINT, @wished TINYINT, @warehouse INT OUTPUT Item_ID, @@IDENTITY return made by carrot date 2002-01-31 ********************************************/ ALTER PROCEDURE [dbo].[lin_CreateItem] ( @char_id INT, @item_type INT, @amount INT, @enchant INT, @eroded INT, @bless TINYINT, @ident TINYINT, @wished TINYINT, @warehouse INT ) AS SET NOCOUNT ON insert into user_item (char_id , item_type , amount , enchant , eroded , bless , ident , wished , warehouse) values (@char_id, @item_type , @amount , @enchant , @eroded , @bless , @ident , @wished , @warehouse) SELECT @@IDENTITY -- START FidoW addon item tracker DECLARE @isOK INT SELECT @isOK = id FROM itemdata WHERE isQuest = 0 AND consumetype = 'consume_type_normal' AND id = @item_type IF (@isOK IS NOT NULL) BEGIN DECLARE @item_id INT SELECT TOP 1 @item_id = item_id FROM user_item WHERE char_id = @char_id AND item_type = @item_type AND amount = @amount AND enchant = @enchant AND eroded = @eroded AND bless = @bless AND ident = @ident AND wished = @wished AND warehouse = @warehouse ORDER BY item_id DESC INSERT INTO user_item_log (item_id,char_id,item_type,amount,enchant,eroded,bless,ident,wished,warehouse,date) VALUES (@item_id,@char_id,@item_type,@amount,@enchant,@eroded,@bless,@ident,@wished,@warehouse,GETDATE()) END -- END FidoW addon item tracker -------------------------------------------------------------------------------------------------- set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go /****** Object: Stored Procedure dbo.lin_CreateItem Script Date: 2003-09-20 ?? 11:51:57 ******/ /******************************************** lin_CreateItem create item sp INPUT @char_id INT, @item_type INT, @amount INT, @enchant INT, @eroded INT, @bless TINYINT, @ident TINYINT, @ready TINYINT, @wished TINYINT, @warehouse INT OUTPUT Item_ID, @@IDENTITY return made by carrot date 2002-01-31 ********************************************/ ALTER PROCEDURE [dbo].[lin_CreateItem] ( @char_id INT, @item_type INT, @amount INT, @enchant INT, @eroded INT, @bless TINYINT, @ident TINYINT, @wished TINYINT, @warehouse INT ) AS SET NOCOUNT ON insert into user_item (char_id , item_type , amount , enchant , eroded , bless , ident , wished , warehouse) values (@char_id, @item_type , @amount , @enchant , @eroded , @bless , @ident , @wished , @warehouse) SELECT @@IDENTITY -- START FidoW addon item tracker DECLARE @isOK INT SELECT @isOK = id FROM itemdata WHERE isQuest = 0 AND consumetype = 'consume_type_normal' AND id = @item_type IF (@isOK IS NOT NULL) BEGIN DECLARE @item_id INT SELECT TOP 1 @item_id = item_id FROM user_item WHERE char_id = @char_id AND item_type = @item_type AND amount = @amount AND enchant = @enchant AND eroded = @eroded AND bless = @bless AND ident = @ident AND wished = @wished AND warehouse = @warehouse ORDER BY item_id DESC INSERT INTO user_item_log (item_id,char_id,item_type,amount,enchant,eroded,bless,ident,wished,warehouse,date) VALUES (@item_id,@char_id,@item_type,@amount,@enchant,@eroded,@bless,@ident,@wished,@warehouse,GETDATE()) END -- END FidoW addon item tracker -------------------------------------------------------------------------------------------------- [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] Isso não funcionará se você tiver esvaziado a tabela ItemData ou não tiver atualizado (dado update) no CacheD e no CachedScript do servidor. Como usar? Basta executar ambas as querys em MsSQL, feito isso e ele começará a registrar as informações supracitadas. A idealização dessa Query é para o caso de controle de itens roubados de uma determinada conta, sem necessitar ficar espionando igual a um detetive no Log que é imenso e não nos trás o resultado esperado. Espero que achem isso útil. Caso queira iniciar uma tabela user_item_log já com dados armazenados, pode executar a seguinte Query: Código:
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
INSERT INTO user_item_log SELECT item_id,char_id,item_type,amount,enchant,eroded,bless,ident,wished,warehouse,'2001-01-01 00:00:00' FROM user_item WHERE item_id NOT IN (SELECT DISTINCT item_id FROM user_item_log) AND item_type IN (SELECT id FROM itemdata WHERE isQuest = 0 AND consumetype = 'consume_type_normal') [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] Claramente não teremos a data exata neste caso, porém, teremos armazenado quem é o atual proprietário até a próxima mudança. Códigos by: FidoW Descrição da Função, Criação dos SQL Query e Upload by: Setokaiba. |
||||||||||||||
|
|
|||||||||||||||
| O seguinte membro ao lado disse Obrigado(a) a : Setokaiba por gostar deste Post : |
rto (13-03-2014)
|
| Links Patrocinados |
![]() |
| Tags |
| exchange, furtados, itens, l2off, lineage, logs, rastrear, rob, roubados, search, searching, servidor, stolen, trade, trocados |
|
|