How to send items to all accounts.Rohan

01/09/2014 10:35 exstrike1234#1
Hi how can i send items directly to there event or item mall inventory? please need some help .
01/09/2014 10:53 Marvetick#2
You have to create SQL statement which loops adding value to Rohangame .dbo. TEventItem for every user
01/09/2014 13:13 Dr.Dr.SheldonLeeCooper#3
Quote:
Originally Posted by exstrike1234 View Post
Hi how can i send items directly to there event or item mall inventory? please need some help .
GO
DECLARE @a Integer = 100
DECLARE @i Integer
SELECT @i = COUNT(id) FROM dbo.TCharacter
SET @i = @i + 100
WHILE (@a < @i)
BEGIN
INSERT INTO dbo.TEventItem (type, attr, stack, rank, equip_level, equip_dexterity, equip_intelligence, equip_strength, char_id) VALUES (0, 0, 0, 0, 0, 0, 0, 0, @a)
SET @a = @a + 1
END

Just change the 100 to your the first Char ID on your DB from dbo.TCharacter. It will count every Char on the Server and send it to Event Inventar.
01/09/2014 14:35 oziel235#4
That's what Dr.Dr.SheldonLeeCooper Said is right. I did a little differently. Why? Simple no one will have access to the server. Only I.
I made a simple program in Java that logs on the server and gives you the options for those who send or even send to all.
An easy way is also using php, makes an Administrator page with the script does a FOREACH only for the ID_CHAR and within that FOR Insert SQL.

Each has a way I prefer more security :D
01/09/2014 15:29 zzerachiel#5
It's a bit more elegant this way

Code:
INSERT INTO [RohanGame].[dbo].[TEventItem] SELECT
           1 -- [type]
           ,0x00 -- attr
           ,1 -- stack
           ,1 -- rank
           ,1 -- equip level
           ,1 -- str
           ,1 -- dex
           ,1 -- int
           ,id -- char id
           , GETDATE() -- date
            FROM RohanGame.dbo.TCharacter
01/09/2014 16:35 oziel235#6
Quote:
Originally Posted by zzerachiel View Post
It's a bit more elegant this way
The only difference is that zzerachiel your code does not loop. Inserts one record at a time.
And as the question was to send items to all the accounts. Better place with Loop.
Code:
 

GO
 DECLARE @a Integer = 100
 DECLARE @i Integer
 SELECT @i = COUNT(id) FROM dbo.TCharacter
 SET @i = @i + 100

 WHILE (@a < @i)
 BEGIN
  INSERT INTO dbo.TEventItem (type, attr, stack, rank, equip_level, equip_dexterity, equip_intelligence, equip_strength, char_id) 
  VALUES (0, 0, 0, 0, 0, 0, 0, 0, @a)
  SET @a = @a + 1
END
01/09/2014 17:04 zzerachiel#7
Since when looping a few thousand times is better than adding all of them at once?

Not to mention that with my code you don't need to know the starting character id, nor the end.

What would your code do if there are gaps in the character_id?

I mean, it's nice that you managed to get a one line statement and turn it into 10 lines, while loosing performance.
01/09/2014 17:24 oziel235#8
Quote:
Originally Posted by zzerachiel View Post
Since when looping a few thousand times is better than adding all of them at once?

Not to mention that with my code you don't need to know the starting character id, nor the end.

What would your code do if there are gaps in the character_id?

I mean, it's nice that you managed to get a one line statement and turn it into 10 lines, while loosing performance.
You're right with the Loop loses a bit of performance.
But I replied the post with the Loop because unfortunately I couldn't run your code. may be I missed something. But it's not working for me
01/09/2014 17:40 zzerachiel#9
[Only registered and activated users can see links. Click Here To Register...]

Works.

All i said is that my code is a bit more elegant.
01/09/2014 17:55 oziel235#10
Perfect!
But it's not working for me! -_-
01/09/2014 19:29 zzerachiel#11
If you edited TEventItem structure, it won't work
01/09/2014 21:24 oziel235#12
Something in my SQL Server was blocking I have a paid version ... installed some additional patch's dai stopped working the sql scripts. but now it's working is bug.
01/10/2014 05:50 moviper#13
Quote:
Originally Posted by zzerachiel View Post
[Only registered and activated users can see links. Click Here To Register...]

Works.

All i said is that my code is a bit more elegant.
omg!! what hell is that of pict .. seem i need re-school to understand it :D
01/10/2014 06:07 oziel235#14
Quote:
Originally Posted by moviper View Post
omg!! what hell is that of pict .. seem i need re-school to understand it :D
is a SQL script to insert items in EventInventory.
06/06/2014 19:19 dedeernet#15
Quote:
Originally Posted by zzerachiel View Post
It's a bit more elegant this way

Code:
INSERT INTO [RohanGame].[dbo].[TEventItem] SELECT
           1 -- [type]
           ,0x00 -- attr
           ,1 -- stack
           ,1 -- rank
           ,1 -- equip level
           ,1 -- str
           ,1 -- dex
           ,1 -- int
           ,id -- char id
           , GETDATE() -- date
            FROM RohanGame.dbo.TCharacter
How to send it if certain players?