Jump to content
  • 0

Subclass Cumulative + Skilles Accumulated


Question

Posted
I have to make a server with subclass accumulative (principal + 3 subs)

of any class and race.

and that skilles se accumulate between of a subclass and another.

 

I do it with this SP:

 



set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[lin_SetAquireSkill]
(
@char_id INT,
@subjob_id INT,
@skill_id INT,
@skill_level TINYINT
)
AS
DECLARE @subjob_acu INT

SET NOCOUNT ON

set @subjob_acu = 0

WHILE (@subjob_acu < 3)

BEGIN

SET @subjob_acu = @subjob_acu + 1
IF EXISTS(SELECT skill_lev FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id = @subjob_acu)
UPDATE user_skill SET skill_lev = @skill_level WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id <= @subjob_acu

ELSE
INSERT INTO user_skill (char_id, subjob_id, skill_id, skill_lev) VALUES (@char_id, @subjob_acu, @skill_id, @skill_level);
IF NOT EXISTS(SELECT skill_id FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND skill_lev = @skill_level AND subjob_id = 0)
INSERT INTO user_skill (char_id, subjob_id, skill_id, skill_lev) VALUES (@char_id, 0, @skill_id, @skill_level);

END



 

But only accumulate when "switch subclass".

When you subclass, the skilles of previous class  is cleared and starts loading the skilles of the new class, I need you to stay all skilles of all subclass.

is it possible?

15 answers to this question

Recommended Posts

  • 0
Posted

1. 4 jobs exist - not 3.

 

2. You already set subjob_acu to 1 before even making the loop effectively skipping all skills learned for the main\base class.

 

3.

 

 IF EXISTS(SELECT skill_lev FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id = @subjob_acu)
   UPDATE user_skill SET skill_lev = @skill_level WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id = @subjob_acu
 ELSE
   INSERT INTO user_skill (char_id, subjob_id, skill_id, skill_lev) VALUES (@char_id, @subjob_acu, @skill_id, @skill_level)

 set @subjob_fer = (@subjob_acu + 1)

 

 

Done.

  • 0
Posted
When a subclass ago erased all skilles and start to load the new class skilles.

I need not to delete, that are accumulated.

In the database yes accumulate.

But the player can see all skilles only when restarting the server.

Or when you "switch subclass".

It's like the player needs to do a refresh to the database so you can see all skilles. -

  • 0
Posted

lin_GetAquireSkill:

ALTER PROCEDURE [dbo].[lin_GetAquireSkill]
(
	@char_id	INT,
	@subjob_id	INT
)
AS
SET NOCOUNT ON

SELECT skill_id, skill_lev, is_lock FROM user_skill WHERE char_id = @char_id AND ISNULL(subjob_id, 0) = @subjob_id ORDER BY 1, 2

Edit it to:

ALTER PROCEDURE [dbo].[lin_GetAquireSkill]
(
	@char_id	INT,
	@subjob_id	INT
)
AS
SET NOCOUNT ON

SELECT skill_id, skill_lev, is_lock FROM user_skill WHERE char_id = @char_id ORDER BY 1, 2

Haven't tested but might work ;)

  • 0
Posted (edited)
Thank you very much for answering!

With this function you can do, I only need to add the turn of the subjob0_class, as I do?

 



function setCharacterData2($char_id, $genderId, $raceId, $classId, $faceId, $hairShapeId, $hairColorId)
{

global $cached_errors, $admin_name;
global $cached_ip, $cached_port;
$buf=pack("cVVVVVVV", 0x10, $char_id, $genderId, $raceId, $classId, $faceId, $hairShapeId, $hairColorId).tounicode_UA($admin_name);
$cachedsocket=@fsockopen($cached_ip, $cached_port, $errno, $errstr, 1) or die($notconnected);
fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf);
$len=unpack("v",fread($cachedsocket,2));
$rid=unpack("c",fread($cachedsocket,1));
for($i=0;$i<(($len[1]-4)/4);$i++){
$read=unpack("i",fread($cachedsocket,4));
$rs.=$read[1];
}
fclose($cachedsocket);
return $rs;

}

Edited by WaLas
  • 0
Posted

well i guess,do you wanna to save main class skills in your subclass?when you changed over 3 subclass,you will get 4 class skills?right?

 

yes, I want them to go accumulating skilles

  • 0
Posted (edited)

then you want incremental change -

 

so main = main

 

1st = main + 1st

 

2nd = main + 1st + 2nd

 

3rd = main + 1st + 2nd

 

correct?

 

haha....

 

@WaLas

will you make it via extend l2server?why not via ai.obj? DNS system?

anyway,via extend l2server is the best way,but its not so easy.

Edited by sandeagle
  • 0
Posted

then you want incremental change -

 

so main = main

 

1st = main + 1st

 

2nd = main + 1st + 2nd

 

3rd = main + 1st + 2nd

 

correct?

 

Yes, i need this. with extender or php.-

 

 

haha....

 

@WaLas

will you make it via extend l2server?why not via ai.obj? DNS system?

anyway,via extend l2server is the best way,but its not so easy.

 

The DN system fails when you switch to another race. -

  • 0
Posted

You can script it with tSQL - in GetAquireSkill.

 

 

Might possibly need a cacheD hook to refresh char on subjobchange\create for cached internal memory block.

 

(I can't remember if  that's needed but i believe i did it just with SQL alone).

  • 0
Posted

hey guys i got this at the moment

 

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[lin_SetAquireSkill]
(
@char_id INT,
@subjob_id INT,
@skill_id INT,
@skill_level TINYINT
)
AS
DECLARE @subjob_acu INT

SET NOCOUNT ON

set @subjob_acu = 0

WHILE (@subjob_acu < 3)

BEGIN

SET @subjob_acu = @subjob_acu + 1
IF EXISTS(SELECT skill_lev FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id = @subjob_acu)
UPDATE user_skill SET skill_lev = @skill_level WHERE char_id = @char_id AND skill_id = @skill_id AND subjob_id <= @subjob_acu

ELSE
INSERT INTO user_skill (char_id, subjob_id, skill_id, skill_lev) VALUES (@char_id, @subjob_acu, @skill_id, @skill_level);
IF NOT EXISTS(SELECT skill_id FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND skill_lev = @skill_level AND subjob_id = 0)
INSERT INTO user_skill (char_id, subjob_id, skill_id, skill_lev) VALUES (@char_id, 0, @skill_id, @skill_level);

END

 

 

 

i would like to do the same thing but with out changing the skin of the character

as now i can change subclass with out changing the skin but skills desapierd with subclass :(

  • 0
Posted

not very good on codding etc is there any thing that I need to change? like above ?

 

trying to save some $$ :( otherways devs will be doing it my Skype is sirblackx1 if anyone can guide me will be grate thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...