Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE] Hero Skill acquire (https://postpacific.mmorpg-game.online/showthread.php?t=7971)

madar 04.07.2007 13:07

[SHARE] Hero Skill acquire
 
didnt tested yet because our server is still run in test phrase so dont have enough ppl to test it, if it works ill write a script that will delete those skills from players that are not heroes (after competition)

Code:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE dbo.lin_NominateHeroes
(
@now_season INT,
@new_step INT,
@new_season_start_time INT
)
AS
SET NOCOUNT ON

UPDATE user_nobless
SET hero_type = 0

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
INSERT INTO #hero_candidate
        SELECT un.char_id, ud.subjob0_class, un.match_count, un.olympiad_point
        FROM user_nobless un, user_data ud
        WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
        SELECT TOP 1 main_class, olympiad_point, match_count
        FROM #hero_candidate
        WHERE main_class = @hero_candidate_class
        ORDER BY olympiad_point DESC, match_count DESC

        FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
        SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
                WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
        SELECT char_id, main_class  FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
        SELECT @now_season, main_class, char_id, olympiad_point, match_count FROM #hero_candidate

INSERT INTO olympiad
        (step, season_start_time) VALUES (@new_step, @new_season_start_time)

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time)
        SELECT char_id, "395", "1", "0"
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time)
        SELECT char_id, "396", "1", "0"
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time)
        SELECT char_id, "1374", "1", "0"
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time)
        SELECT char_id, "1375", "1", "0"
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time)
        SELECT char_id, "1376", "1", "0"
        FROM user_nobless
        WHERE hero_type = 1

SELECT @@IDENTITY


HF 04.07.2007 14:16

Erm... i can mistake, but use Search "lin_NominateHeroes". It problem solved much age ago.

madar 04.07.2007 14:58

nothing for NominateHeroes neither "hero skill"

Chobito 04.07.2007 15:49

didn't found it also HF

I was searchin that

l2serverfull 04.07.2007 18:16

add hero skill :D in skilldata :D

Code:

skill_begin        skill_name = [heroic_valor]        /* [l2serverfull] */        skill_id = 1374        level = 1        operate_type = A2        magic_level = 77        effect = {{p_physical_attack;{all};250;diff};{p_resist_dispel_by_category;slot_buff;-30;per};{p_physical_defence;{all};500;diff}}        is_magic = 0        mp_consume2 = 289        item_consume = {[spirit_ore];80}        cast_range = -1        effective_range = -1        skill_hit_time = 6        skill_cool_time = 0        skill_hit_cancel_time = 0.5        reuse_delay = 3600        activate_rate = -1        lv_bonus_rate = 0        basic_property = none        abnormal_time = 60        abnormal_lv = 1        abnormal_type = max_breath_up        attribute = attr_none        effect_point = -993        target_type = self        affect_scope = pledge        affect_range = 900        affect_object = friend        affect_limit = {0;0}        next_action = none        debuff = 0        ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight}        skill_end
skill_begin        skill_name = [heroic_miracle]        /* [l2serverfull] */        skill_id = 395        level = 1        operate_type = A2        magic_level = 77        effect = {{p_physical_defence;{all};5400;diff};{p_magical_defence;{all};4050;diff};{p_speed;{all};5;per};{p_resist_dispel_by_category;slot_buff;-30;per}}        operate_cond = {{equip_shield}}        is_magic = 0        mp_consume2 = 72        item_consume = {[soul_ore];40}        cast_range = -1        effective_range = -1        skill_hit_time = 1        skill_cool_time = 0        skill_hit_cancel_time = 0.5        reuse_delay = 1800        activate_rate = -1        lv_bonus_rate = 0        basic_property = none        abnormal_time = 30        abnormal_lv = 1        abnormal_type = max_breath_up        attribute = attr_none        effect_point = 204        target_type = self        affect_scope = single        affect_limit = {0;0}        next_action = none        debuff = 0        ride_state = {@ride_none}        skill_end               
skill_begin        skill_name = [heroic_grandure]        /* [l2serverfull] */        skill_id = 1375        level = 1        operate_type = A2        magic_level = 76        effect = {{p_physical_defence;{all};-50;per};{p_magical_defence;{all};-50;per};{p_avoid;{all};-16;diff};{p_shield_defence_rate;-50};{p_block_buff};{p_block_debuff}}        is_magic = 0        mp_consume1 = 21        mp_consume2 = 84        item_consume = {[spirit_ore];80}        cast_range = 900        effective_range = 1400        skill_hit_time = 6        skill_cool_time = 0        skill_hit_cancel_time = 0.5        reuse_delay = 1800        activate_rate = 40        lv_bonus_rate = 1        basic_property = men        abnormal_time = 30        abnormal_lv = 1        abnormal_type = multi_debuff        attribute = attr_unholy        effect_point = -993        target_type = enemy_only        affect_scope = single        affect_limit = {0;0}        next_action = none        debuff = 1        ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight}        skill_end
skill_begin        skill_name = [heroic_dread]        /* [l2serverfull] */        skill_id = 1376        level = 1        operate_type = A2        magic_level = 77        effect = {{i_run_away;30;20};{p_speed;{all};52;per}}        is_magic = 1        mp_consume1 = 14        mp_consume2 = 56        item_consume = {[spirit_ore];80}        cast_range = 400        effective_range = 900        skill_hit_time = 4        skill_cool_time = 0        skill_hit_cancel_time = 0.5        reuse_delay = 1800        abnormal_time = 15        abnormal_lv = 1        abnormal_type = turn_flee        attribute = attr_derangement        effect_point = 666        target_type = enemy_only        affect_scope = single        affect_limit = {0;0}        next_action = none        debuff = 1        ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight}        skill_end
skill_begin        skill_name = [heroic_berserker]        /* [l2serverfull] */        skill_id = 396        level = 1        operate_type = A2        magic_level = 77        effect = {{p_hit;{all};8;diff};{p_physical_attack;{all};500;diff};{p_physical_defence;{all};-25;per};{p_magical_defence;{all};-25;per};{p_magic_speed;{all};100;diff};{p_magical_attack;{all};500;diff};{p_attack_speed;{all};100;diff};{p_resist_dispel_by_category;slot_buff;-30;per};{p_resist_abnormal_by_category;slot_debuff;-10;per};{p_avoid;{all};-8;diff};{p_speed;{all};20;diff};{p_heal_effect;25;per}}        is_magic = 1        mp_consume1 = 31        mp_consume2 = 72        item_consume = {[soul_ore];40}        cast_range = -1        effective_range = -1        skill_hit_time = 2.5        skill_cool_time = 0        skill_hit_cancel_time = 0.5        reuse_delay = 1800        activate_rate = -1        lv_bonus_rate = 0        basic_property = none        abnormal_time = 60        abnormal_lv = 1        abnormal_type = max_breath_up        attribute = attr_none        effect_point = 0        target_type = self        affect_scope = single        affect_limit = {0;0}        next_action = none        debuff = 0        ride_state = {@ride_none}        skill_end


l2serverfull 04.07.2007 18:17

thxx ,,, i go test now :D

l2serverfull 04.07.2007 23:11

no work in me server :( ... i use .. mssql 2005 :D

madar 04.07.2007 23:21

it only supposed to add skill when you become a hero with the monument not with //set_hero

FidoW 05.07.2007 02:53

You cant add skills that way, have no effect until the next restart, best way -> CacheD Interactive Port

Osito2Dancer 05.07.2007 06:32

Quote:

Originally Posted by FidoW (Post 90562)
You cant add skills that way, have no effect until the next restart, best way -> CacheD Interactive Port

You can add them, its not advisable only. Either way, i'm using it right now, it helps to forget about it, and if someone says "hero skills are missing", just restart and voila, all skills added.

A question: Hero Skills are available for 1ºst timers?

Chobito, yo ya te preste este script a ti, hdp.

Chobito 05.07.2007 10:37

Quote:

Originally Posted by Osito2Dancer (Post 90581)
You can add them, its not advisable only. Either way, i'm using it right now, it helps to forget about it, and if someone says "hero skills are missing", just restart and voila, all skills added.

A question: Hero Skills are available for 1ºst timers?

Chobito, yo ya te preste este script a ti, hdp.

sise xDDDD
pero toy curioso

;_(

muak!!

PyroMaker 05.07.2007 20:17

English only in here cabrons.

P.S: Good share, madar.

FidoW 05.07.2007 23:15

Quote:

Originally Posted by Osito2Dancer (Post 90581)
You can add them, its not advisable only. Either way, i'm using it right now, it helps to forget about it, and if someone says "hero skills are missing", just restart and voila, all skills added.

A question: Hero Skills are available for 1ºst timers?

Chobito, yo ya te preste este script a ti, hdp.

... And... why not do it by cached ? You really think restart the server is the solution? My server stands up more than 2-3 days without restart or maybe more, normally i restart the server to improve the performance and make some maintenance, but some times has been online for even 2 weeks with more than 1k players online, but with your system i will need to restart the server each time a player get hero status... and not necessary is the 1st of each month.

You cant make a script that check and add skills automatically each some minutes, i have more than 1 script running to check some things like connected builder.. (kick if not match with my list and ban account, etc etc).. an antibot system...and some more

madar 05.07.2007 23:45

player needs only to restart the game.

Aida 06.07.2007 02:24

for me a base accepted procedure only after this correction
SELECT char_id, "396", "1", "0", "0" -> SELECT char_id, '395', '1', '0', '0'

on how many I know heroic skily can have only mein class, therefore added

Quote:

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
SELECT char_id, '395', '1', '0', '0'

here that turned out for me, need tested

Code:

CREATE PROCEDURE dbo.lin_NominateHeroes
(
@now_season INT,
@new_step INT,
@new_season_start_time INT
)
AS
SET NOCOUNT ON

UPDATE user_nobless
SET hero_type = 0

/******************************************** 
not sure, need test
DELETE FROM user_skill WHERE skill_id in (395)
DELETE FROM user_skill WHERE skill_id in (396)
DELETE FROM user_skill WHERE skill_id in (1374)
DELETE FROM user_skill WHERE skill_id in (1375)
DELETE FROM user_skill WHERE skill_id in (1376)
********************************************/ 

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
INSERT INTO #hero_candidate
        SELECT un.char_id, ud.subjob0_class, un.match_count, un.olympiad_point
        FROM user_nobless un, user_data ud
        WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
        SELECT TOP 1 main_class, olympiad_point, match_count
        FROM #hero_candidate
        WHERE main_class = @hero_candidate_class
        ORDER BY olympiad_point DESC, match_count DESC

        FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
        SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
                WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
        SELECT char_id, main_class  FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
        SELECT @now_season, main_class, char_id, olympiad_point, match_count FROM #hero_candidate

INSERT INTO olympiad
        (step, season_start_time) VALUES (@new_step, @new_season_start_time)

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

SELECT @@IDENTITY

and it fully is a working script for the prepared heroes, having already a parameter 2 in user_nobless

Code:

DELETE FROM user_skill WHERE skill_id in (395);
DELETE FROM user_skill WHERE skill_id in (396);
DELETE FROM user_skill WHERE skill_id in (1374);
DELETE FROM user_skill WHERE skill_id in (1375);
DELETE FROM user_skill WHERE skill_id in (1376);

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

manual_pch.txt

Quote:

[HERO_NONE] = 0
[HERO_WAITING] = 1
[HERO_ACTIVE] = 2
And however that characters saw these skily restart of server is needed

спасибо онлайн переводчику за моё знание английского -)

tpuNIsher 06.07.2007 06:02

Question is.. your players can't choose the skills, can they? they aren't supposed to get ALL the hero skills. They are supposed to choose '1' skill out of all, right?

steph69412 06.07.2007 07:03

nope, retail heros get every skill, have a friend whos the retail pp hero

madar 06.07.2007 10:25

Quote:

Originally Posted by Aida (Post 90793)
for me a base accepted procedure only after this correction
SELECT char_id, "396", "1", "0", "0" -> SELECT char_id, '395', '1', '0', '0'

on how many I know heroic skily can have only mein class, therefore added




here that turned out for me, need tested

Code:

CREATE PROCEDURE dbo.lin_NominateHeroes
(
@now_season INT,
@new_step INT,
@new_season_start_time INT
)
AS
SET NOCOUNT ON

UPDATE user_nobless
SET hero_type = 0

/******************************************** 
not sure, need test
DELETE FROM user_skill WHERE skill_id in (395)
DELETE FROM user_skill WHERE skill_id in (396)
DELETE FROM user_skill WHERE skill_id in (1374)
DELETE FROM user_skill WHERE skill_id in (1375)
DELETE FROM user_skill WHERE skill_id in (1376)
********************************************/ 

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
INSERT INTO #hero_candidate
        SELECT un.char_id, ud.subjob0_class, un.match_count, un.olympiad_point
        FROM user_nobless un, user_data ud
        WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
        SELECT TOP 1 main_class, olympiad_point, match_count
        FROM #hero_candidate
        WHERE main_class = @hero_candidate_class
        ORDER BY olympiad_point DESC, match_count DESC

        FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
        SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
                WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
        SELECT char_id, main_class  FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
        SELECT @now_season, main_class, char_id, olympiad_point, match_count FROM #hero_candidate

INSERT INTO olympiad
        (step, season_start_time) VALUES (@new_step, @new_season_start_time)

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

SELECT @@IDENTITY

and it fully is a working script for the prepared heroes, having already a parameter 2 in user_nobless

Code:

DELETE FROM user_skill WHERE skill_id in (395);
DELETE FROM user_skill WHERE skill_id in (396);
DELETE FROM user_skill WHERE skill_id in (1374);
DELETE FROM user_skill WHERE skill_id in (1375);
DELETE FROM user_skill WHERE skill_id in (1376);

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

manual_pch.txt



And however that characters saw these skily restart of server is needed

спасибо онлайн переводчику за моё знание английского -)

yep, i missed the subjob thing :)

madar 06.07.2007 21:30

ok it should work and only need character to restart the game

activatedheroes will create a procedure that will be executed by the nominateheroes and set all hero skill for activated heroes

however nominateheroes is still set the skills for waiting heroes

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
lin_ActivatedHeroes.zip — 471 байт
lin_NominateHeroes.zip — 1047 байт

Aida 06.07.2007 22:09

Quote:

Originally Posted by madar (Post 90934)
ok it should work and only need character to restart the game

activatedheroes will create a procedure that will be executed by the nominateheroes and set all hero skill for activated heroes

however nominateheroes is still set the skills for waiting heroes

Fignyu you did...
If to abandon in my modification of procedure the lin_nominateheroes parameters of delete of skilov that is well-built, although I am not sure that it works, not testil. But in vroy procedure of lin_activatedheroes you delaesh large oschibku because again skanish base and udalyaesh skily which just gave initial procedure. Total there are 3 positions at the receipt of hero:
0 is a not hero 1 is a hero, but did not yet get him in a game 2 is a hero, already got him in a game.
Now so, if procedure of lin_nominateheroes is executed one time per a month and my insertion an the delete of skilov vsetaki works, takes a place

clear hero status
UPDATE user_nobless
SET hero_type = 0

delete all hero skill in user_skill
DELETE FROM user_skill WHERE skill_id = '395'
DELETE FROM user_skill WHERE skill_id = '396'
DELETE FROM user_skill WHERE skill_id = '1374'
DELETE FROM user_skill WHERE skill_id = '1375'
DELETE FROM user_skill WHERE skill_id = '1376'

the parameters of hero and skily are further heard for new heroes...
total there is enough implementation of procedure of lin_nominateheroes, but restart of server will be required

RUS

Фигню ты сделал...
Если оставлять в моей модификации процедуры lin_NominateHeroes параметры удаления скилов то ладно, хотя я не уверен что это работает, не тестил. Но во врой процедуре lin_ActivatedHeroes ты делаеш большую ощибку ибо опять сканиш базу и удаляеш скилы которые только что дал начальной процедурой. Итого при получении героя есть 3 позиции:
0 - не герой 1 - герой, но еще не получил его в игре 2 - герой, уже получил его в игре.
Теперь так, если процедура lin_NominateHeroes выполняется раз в месяц и моя вставка ан удаление скилов всетаки работает, то происходит следущее:

всем героям выставляется статус с 2(герой) на 0 (не герой)
UPDATE user_nobless
SET hero_type = 0

Если эта фигня всетаки работает коректно, хотя должна, то во всей таблице user_skill всем чарам удаляют геройские скилы
DELETE FROM user_skill WHERE skill_id = '395'
DELETE FROM user_skill WHERE skill_id = '396'
DELETE FROM user_skill WHERE skill_id = '1374'
DELETE FROM user_skill WHERE skill_id = '1375'
DELETE FROM user_skill WHERE skill_id = '1376'

далее выполняется скрипт, создаются временнные таблици и прочая лабуда, в итоге в таблице user_nobless у новых героев становится hero_type = 1, это значит что он уже герой но ожидает получения, естественно скилы ему уже тоже дали, но героя он получит на сервере без проблем, а вот для скилов потребуется рестарт сервера.
все....
а вторая часть, то где hero_type = 2 это если в серидне месяца рещил удалить или дать скилы просто выполни в QA.

Эх был бы у меня компилятор АИ сделалбы еще проще

Quote:

class obelisk_basic : citizen
**********сдесь куча всякого фуфла на проверки**************


myself->ShowPage(talker,"obelisk020a.htm");
}
}
else if( reply == 3 )
{
}
else if( reply == 4 )
{
if( talker.hero_type == 2 )
{
if( myself->OwnItemCount(talker,6842) >= 1 )
{
myself->ShowPage(talker,"obelisk020c.htm");
}
else if( talker.hero_type == 2 )
{
myself->GiveItem1(talker,6842,1); - вот это получение диадемы героя, тупо сюда дописать скилы и должно работать без рестарта, осталось найти способ их забрать. хотя каким параметром давать скил я тоже пока не понял GiveSkill1 судя по всему не прокатит.
}
else
{
myself->ShowPage(talker,"obelisk020c.htm");
}
}
else
{
myself->ShowPage(talker,"obelisk020a.htm");
}
}
}
ну или тупо дописать аи и сделать в ХТМ ссылку получить скилы.


сори за мой англиский, пользуюсь этим http://translate.a.ua/index.php

вот процедура которой более чем достаточно, но требуется рестарт сервера, хотя 100% гарантии не даю, ибо не тестили еще на 100%

madar 06.07.2007 22:14

i dont understand the eng sorry :/

btw you dont have to restart the server, only player has to restart his client, and the delete skill thingy is delete all skills from the table

Aida 06.07.2007 22:51

Quote:

Originally Posted by madar (Post 90937)
i dont understand the eng sorry :/

btw you dont have to restart the server, only player has to restart his client, and the delete skill thingy is delete all skills from the table

so I repeat
here this procedure does everything for you on beginning of month, you only require a 1 number of every month when new heroes were determined to overload a server.

Code:

CREATE PROCEDURE dbo.lin_NominateHeroes
(
@now_season INT,
@new_step INT,
@new_season_start_time INT
)
AS
SET NOCOUNT ON

UPDATE user_nobless
SET hero_type = 0

DELETE FROM user_skill WHERE skill_id = '395'
DELETE FROM user_skill WHERE skill_id = '396'
DELETE FROM user_skill WHERE skill_id = '1374'
DELETE FROM user_skill WHERE skill_id = '1375'
DELETE FROM user_skill WHERE skill_id = '1376'

CREATE TABLE #hero_candidate (char_id INT, main_class INT, match_count INT, olympiad_point INT)
INSERT INTO #hero_candidate
SELECT un.char_id, ud.subjob0_class, un.match_count, un.olympiad_point
FROM user_nobless un, user_data ud
WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1

CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
SELECT TOP 1 main_class, olympiad_point, match_count
FROM #hero_candidate
WHERE main_class = @hero_candidate_class
ORDER BY olympiad_point DESC, match_count DESC

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
SELECT char_id, main_class FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
SELECT @now_season, main_class, char_id, olympiad_point, match_count FROM #hero_candidate

INSERT INTO olympiad
(step, season_start_time) VALUES (@new_step, @new_season_start_time)

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1

SELECT @@IDENTITY

if you suddenly wanted to delete everything on a server do skills heroes it in QA and overload a server

Code:

DELETE FROM user_skill WHERE skill_id in (395);
DELETE FROM user_skill WHERE skill_id in (396);
DELETE FROM user_skill WHERE skill_id in (1374);
DELETE FROM user_skill WHERE skill_id in (1375);
DELETE FROM user_skill WHERE skill_id in (1376);

if you suddenly wanted in the middle of month to give heroic skills that delaesh so overload a server

Code:

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;


INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;


Fot@r@s 02.08.2007 12:39

I have made this script... it gives the heroskills in all subclasses and not only ine main.

Code:

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '0'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '1'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '2'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '2'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '2'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '2'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '2'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 2;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '395', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '396', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1374', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1375', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 1;

INSERT INTO user_skill (char_id, skill_id, skill_lev, to_end_time, subjob_id)
        SELECT char_id, '1376', '1', '0', '3'
        FROM user_nobless
        WHERE hero_type = 1;

To delete skills:
Code:

DELETE FROM user_skill WHERE skill_id in (395);
DELETE FROM user_skill WHERE skill_id in (396);
DELETE FROM user_skill WHERE skill_id in (1374);
DELETE FROM user_skill WHERE skill_id in (1375);
DELETE FROM user_skill WHERE skill_id in (1376);

Don't forget to make a DB BackUp and please test it and say results ;)

FidoW 02.08.2007 13:16

Quote:

Originally Posted by Fot@r@s (Post 93428)
I have made this script... it gives the heroskills in all subclasses and not only ine main.

.... .... .... .... .... ....
.... .... .... .... .... ....
.... .... .... .... .... ....
.... .... .... .... .... ....

Don't forget to make a DB BackUp and please test it and say results ;)

And why give skills to others subjobs ? Retail works that way ? Anyway, like i say, this way sucks, need server restart, what are you going to do, restart each 1st of month ?

Execute a small PHP would be the solution... for example... you execute this script each 30 minutes or so... or whatever, will check heros in 1st subjob and will add the skill thought cached... no restarts... and hero have the skill quickly.


PHP Code:

<?php

$skill1 
= 396;
$skill2 = 1374;
$skill3 = 1375;
$skill4 = 1376;

$query = "
SELECT char_name,user_data.char_id
FROM user_nobless
INNER JOIN user_data ON user_data.char_id = user_nobless.char_id
WHERE builder = 0 AND account_id > 0 AND subjob_id = 0
AND user_data.char_id NOT IN 
(
  SELECT DISTINCT char_id 
  FROM user_skill 
  WHERE 
  ( 
    skill_id = 
$skill1 OR skill_id = $skill2 OR skill_id = $skill3 OR skill_id = $skill4
  )
  AND subjob_id = 0
)
ORDER BY 2
"
;


$result = mssql_query($query);
$rows = mssql_num_rows($result);

if (
$rows) {
  for(
$i=0;$i<$rows;$i++) {
    
$char_name = mssql_result($result, $i, 0);
    
$char_id = mssql_result($result, $i, 1);
  
    
AddSkillPacket($char_id, $skill1, 1);
    
AddSkillPacket($char_id, $skill2, 1);
    
AddSkillPacket($char_id, $skill3, 1);
    
AddSkillPacket($char_id, $skill4, 1);
    
    echo 
"$char_name - OK<br>";
    
  }
}
else echo 
"No heros need skills at this moment";

?>

Of course isnt tested... but have no reason to not work i think... i just write it in 2 minutes, i only check the sql query and works good.

How to execute a PHP script each XX time ?... look for a way... there are thousands... you can execute even from a store proc if you want...

mexekanez 02.08.2007 19:07

Quote:

Originally Posted by FidoW (Post 93434)
And why give skills to others subjobs ? Retail works that way ? Anyway, like i say, this way sucks, need server restart, what are you going to do, restart each 1st of month ?

Execute a small PHP would be the solution... for example... you execute this script each 30 minutes or so... or whatever, will check heros in 1st subjob and will add the skill thought cached... no restarts... and hero have the skill quickly.


PHP Code:

<?php

$skill1 
= 396;
$skill2 = 1374;
$skill3 = 1375;
$skill4 = 1376;

$query = "
SELECT char_name,user_data.char_id
FROM user_nobless
INNER JOIN user_data ON user_data.char_id = user_nobless.char_id
WHERE builder = 0 AND account_id > 0 AND subjob_id = 0
AND user_data.char_id NOT IN 
(
  SELECT DISTINCT char_id 
  FROM user_skill 
  WHERE 
  ( 
    skill_id = 
$skill1 OR skill_id = $skill2 OR skill_id = $skill3 OR skill_id = $skill4
  )
  AND subjob_id = 0
)
ORDER BY 2
"
;


$result = mssql_query($query);
$rows = mssql_num_rows($result);

if (
$rows) {
  for(
$i=0;$i<$rows;$i++) {
    
$char_name = mssql_result($result, $i, 0);
    
$char_id = mssql_result($result, $i, 1);
  
    
AddSkillPacket($char_id, $skill1, 1);
    
AddSkillPacket($char_id, $skill2, 1);
    
AddSkillPacket($char_id, $skill3, 1);
    
AddSkillPacket($char_id, $skill4, 1);
    
    echo 
"$char_name - OK<br>";
    
  }
}
else echo 
"No heros need skills at this moment";

?>

Of course isnt tested... but have no reason to not work i think... i just write it in 2 minutes, i only check the sql query and works good.

How to execute a PHP script each XX time ?... look for a way... there are thousands... you can execute even from a store proc if you want...

thnks dude, but it dosen't work
Code:

<?
include("load.php");
mssql_connect($mssql_server,$mssql_user,$mssql_pass);
mssql_select_db($mssql_db);

$skill1 = 396;
$skill2 = 1374;
$skill3 = 1375;
$skill4 = 1376;
$skill5 = 395;


$query="SELECT char_name,user_data.char_id
FROM user_nobless
INNER JOIN user_data ON user_data.char_id = user_nobless.char_id
WHERE builder = 0 AND account_id > 0 AND subjob_id = 0
AND user_data.char_id NOT IN
(
  SELECT DISTINCT char_id
  FROM user_skill
  WHERE
  (
    skill_id = $skill1 OR skill_id = $skill2 OR skill_id = $skill3 OR skill_id = $skill4 OR skill_id = $skill5
  )
  AND subjob_id = 0
)
ORDER BY 2
";


$result = mssql_query($query);
$rows = mssql_num_rows($result);

if ($rows) {
  for($i=0;$i<$rows;$i++) {
    $char_name = mssql_result($result, $i, 0);
    $char_id = mssql_result($result, $i, 1);
 
    AddSkillPacket($char_id, $skill1, 1);
    AddSkillPacket($char_id, $skill2, 1);
    AddSkillPacket($char_id, $skill3, 1);
    AddSkillPacket($char_id, $skill4, 1);
    AddSkillPacket($char_id, $skill5, 1);
   
    echo "$char_name - OK<br>";
   
  }
}
else echo "No heros need skills at this moment";

?>

i have error:
Fatal error: Call to undefined function addskillpacket() in /var/www/***************/htdocs/hero.php on line 39


All times are GMT. The time now is 21:44.