[MANUAL] Фикс мультипрофы в AdvExt Interlude

Тема в разделе "Установка и настройка (Setup and configuration)", создана пользователем root, 12 окт 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    Выкладываю SQL запрос на проверку скилов по классам, в случае обнаружения левого скилла(скилла, который не принадлежит данному классу) - он будет удален.
    Код:
    USE [lin2world]
    GO
    
    
    --- Only Select ---
    SELECT user_data.char_name , user_skill.skill_id, user_skill.subjob_id
    FROM user_data
    
    
    INNER JOIN user_skill ON user_data.char_id = user_skill.char_id
    
    
    -- PS. this is for main class only, just change the subjob0_class to subjob1_class, 2, 3 to test he subclass too, but since it doesn't check the skill level yet than some skills can be missed. 
    WHERE user_skill.skill_id NOT IN (SELECT my_skill_id FROM user_skill_check WHERE user_skill_check.my_class_id = user_data.subjob0_class or user_skill_check.my_class_id = -1 )/* nobless and any other skill that can be used at any class will have my_class_id = -1*/ 
    
    
    ORDER BY user_data.char_name, user_skill.skill_id
    ---------------
    
    
    
    
    --- Delete the skills ---
    DECLARE @CheckMulticlass CURSOR
    DECLARE @char_id INT
    DECLARE @skill_id INT
    DECLARE @subjob_id INT
    
    
    SET @CheckMulticlass = CURSOR FAST_FORWARD FOR
    
    
    SELECT user_data.char_id , user_skill.skill_id, user_skill.subjob_id
    FROM user_data
    
    
    INNER JOIN user_skill ON user_data.char_id = user_skill.char_id
    
    
    -- PS. this is for main class only, just change the subjob0_class to subjob1_class, 2, 3 to test he subclass too, but since it doesn't check the skill level yet than some skills can be missed. 
    WHERE user_skill.skill_id NOT IN (SELECT my_skill_id FROM user_skill_check WHERE user_skill_check.my_class_id = user_data.subjob0_class or user_skill_check.my_class_id = -1 )/* nobless and any other skill that can be used at any class will have my_class_id = -1*/
    
    
    OPEN @CheckMulticlass
    FETCH FROM @CheckMulticlass INTO @char_id, @skill_id, @subjob_id
    
    
    WHILE @@FETCH_STATUS = 0
    BEGIN
    DELETE FROM user_skill WHERE char_id = @char_id AND skill_id = @skill_id AND ISNULL(subjob_id, 0) = @subjob_id
    FETCH NEXT FROM @CheckMulticlass INTO @char_id, @skill_id, @subjob_id
    END
    
    
    CLOSE @CheckMulticlass
    DEALLOCATE @CheckMulticlass