LinkedRegion_1,2,3,4,5,... Question

11/15/2013 08:42 casper20052525#1
Hello, i'm asking about how to link the _RefRegion to LinkedRegion_# ...
check this photo and hopefully anybody can help

[Only registered and activated users can see links. Click Here To Register...]
11/15/2013 10:12 Kape7#2
Use _LinkRefRegion procedure if you want to create the links. I could explain what each column of that table does but its senseless, for 99% of the cases the generated code by the procedure works for what yo want to do.
11/15/2013 13:04 casper20052525#3
Will i find _LinkRefRegion in SRO_VT_SHARD ??, coz i didn't find it there.. can u tell me where can i find it
? and i appreciate ur help buddy
11/15/2013 13:08 Kape7#4
Quote:
Originally Posted by casper20052525 View Post
Will i find _LinkRefRegion in SRO_VT_SHARD ??, coz i didn't find it there.. can u tell me where can i find it
? and i appreciate ur help buddy
Its an stored procedure, I'm not sure if it was exactly called like that, but it was something similar, find it on Programability<Stored Procedures, not on tables.
That procedure link regions automatically, if you can read SQL code you will understand how it works, but by default _RefRegion table works so its fine if you leave it by default. The procedure is only useful when adding new regions that have no links defined.
11/15/2013 13:14 casper20052525#5
Quote:
Originally Posted by Synx7 View Post
Its an stored procedure, I'm not sure if it was exactly called like that, but it was something similar, find it on Programability<Stored Procedures, not on tables.
That procedure link regions automatically, if you can read SQL code you will understand how it works, but by default _RefRegion table works so its fine if you leave it by default. The procedure is only useful when adding new regions that have no links defined.
Thanks buddy, i'll check that and i'll answer back :)

so u mean bro, it's automatically connected ?? to _LinkRefRegion, sorry but im a newbie

[Only registered and activated users can see links. Click Here To Register...]

and that what i found inside _LinkRefRegion, can u describe it for me ?

if u have skype add me : branzdraike
11/15/2013 13:27 Kape7#6
Quote:
Originally Posted by casper20052525 View Post
Thanks buddy, i'll check that and i'll answer back :)

so u mean bro, it's automatically connected ?? to _LinkRefRegion, sorry but im a newbie

[Only registered and activated users can see links. Click Here To Register...]

and that what i found inside _LinkRefRegion, can u describe it for me ?

if u have skype add me : branzdraike
That code generate the links for the _RefRegion.LinkedRegion_#. The linked region columns define the regions that are around the region defined on wRegionID.
11/15/2013 13:37 casper20052525#7
ok, almost got it but can u add me on skype ? ID: branzdraike there are some small questions which i wanted to ask about
11/15/2013 13:54 Kape7#8
Quote:
Originally Posted by casper20052525 View Post
ok, almost got it but can u add me on skype ? ID: branzdraike there are some small questions which i wanted to ask about
Sorry I'm not adding people on skype for resolve doubts, if you have more questions I can answer them here, or you can ask here:

[Only registered and activated users can see links. Click Here To Register...]

Either me or anyone else will be able to answer you (as long as is not for solving a problem, but real questions)
11/15/2013 14:53 casper20052525#9
so, at last i have this line
Quote:
15194 90 59 FORT_CT_AREA 콘스탄티노플요새 1 1001 -1 0 0 xxx NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
as u see there's much nulls these nulls are LinkedRegion_#, so i only put it in _RefRegion
and don't change any other thing ? sorry for pushing but just coz im newbie still learning :)

this line comes from "Constantinople FTW" Media and as u know nobody gives Cons FTW Lines only files so what should i do to, i want to put Cons FTW lines i have brought them from Media but the problem comes from nulls
11/15/2013 17:52 Kape7#10
Quote:
Originally Posted by casper20052525 View Post
so, at last i have this line

as u see there's much nulls these nulls are LinkedRegion_#, so i only put it in _RefRegion
and don't change any other thing ? sorry for pushing but just coz im newbie still learning :)

this line comes from "Constantinople FTW" Media and as u know nobody gives Cons FTW Lines only files so what should i do to, i want to put Cons FTW lines i have brought them from Media but the problem comes from nulls
Run this while the line with the nulls is inserted on _RefRegion

Code:
begin TRANSACTION
begin	
	declare @LinkNum		int
	declare @this_region	int
	declare @region_x		int
	declare @region_z		int
	declare @wRegionID	smallint
	declare @wTempRID	smallint
	declare @col_link		varchar(256)
	declare @query			varchar(256)
	declare @db_id_to_link	smallint
	
	-- clear all existing region link
	set @LinkNum = 1
	while (@LinkNum <= 10)
	begin
		set @query = 'update _RefRegion set LinkedRegion_' + cast(@LinkNum as varchar(10)) + ' = 0'
		execute (@query)
		
		set @LinkNum = @LinkNum + 1
	end
	-- loop all region
	declare region_cursor CURSOR FOR
	select 	wRegionID
	from	_RefRegion
	OPEN region_cursor
	FETCH NEXT FROM region_cursor INTO @wRegionID
	WHILE @@FETCH_STATUS = 0
	begin		
		if (@@error = 0 and @wRegionID <> 0)
		begin
			-- ´øÀüÀº ½ºÅµ!
			if (@wRegionID > 0)
			begin
				set @LinkNum = 8
				while (@LinkNum >= 0)
				begin
					set @region_z = (@wRegionID & 0xff00) / 256
					set @region_x = (@wRegionID & 0x0ff)
					set @wTempRID = 0;
									
					if (@LinkNum = 0)
					begin
						set @region_x = @region_x - 1
						set @col_link = 'LinkedRegion_1'
					end
					else if (@LinkNum = 1)
					begin
						set @region_x = @region_x - 1
						set @region_z = @region_z + 1
						set @col_link = 'LinkedRegion_2'
					end
					else if (@LinkNum = 2)
					begin
						set @region_z = @region_z + 1
						set @col_link = 'LinkedRegion_3'
					end
					else if (@LinkNum = 3)
					begin
						set @region_x = @region_x + 1
						set @region_z = @region_z + 1
						set @col_link = 'LinkedRegion_4'
					end
					else if (@LinkNum = 4)
					begin
						set @region_x = @region_x + 1
						set @col_link = 'LinkedRegion_5'
					end
					else if (@LinkNum = 5)
					begin
						set @region_x = @region_x + 1
						set @region_z = @region_z - 1
						set @col_link = 'LinkedRegion_6'
					end
					else if (@LinkNum = 6)
					begin
						set @region_z = @region_z - 1
						set @col_link = 'LinkedRegion_7'
					end
					else if (@LinkNum = 7)
					begin
						set @region_x = @region_x - 1
						set @region_z = @region_z - 1
						set @col_link = 'LinkedRegion_8'
					end
	
					set @wTempRID = (@region_z & 0x00ff) * 256
					set @wTempRID = @wTempRID + (@region_x & 0x00ff)
	
					select @db_id_to_link = wRegionID
					from _RefRegion
					where wRegionID = @wTempRID
	
					if (@@ROWCOUNT <> 0)
					begin
						set @query = 'update _RefRegion set  ' + @col_link + ' = ' + cast(@db_id_to_link as varchar(10)) + ' where wRegionID = ' + cast(@wRegionID as varchar(10))
					end
					else	-- Á¸ÀçÇÏÁö ¾Ê´Â region link ´Â 0À¸·Î ä¿î´Ù
					begin
						set @query = 'update _RefRegion set  ' + @col_link + ' = 0 where wRegionID = ' + cast(@wRegionID as varchar(10))
					end
	
					execute(@query)
				set @LinkNum = @LinkNum - 1
				end
			end
		end
	FETCH NEXT FROM region_cursor INTO @wRegionID
	end
	
	CLOSE region_cursor
	DEALLOCATE region_cursor
	COMMIT TRANSACTION