Bug when adding Adding click-to-buff removal to interlude

robertahan

Знаменитый
Участник
Сообщения
30
Розыгрыши
0
Репутация
0
Реакции
1
Баллы
1 235
I'm adding Adding click-to-buff removal to interlude all good but I have my interface with the classic buff system that separates the buffs as buff and debuff dances, what is the problem when I shift click on the buff it removes the buff on the right and sometimes the buff that I marked, can someone help me adapt this system?

This is my AbnormalStatusWnd.uc


Код:
/*******************************************************************************
 * AbnormalStatusWnd generated by Eliot.UELib using UE Explorer.
 * Eliot.UELib © 2009-2022 Eliot van Uytfanghe. All rights reserved.
 * http://eliotvu.com
 *
 * All rights belong to their respective owners.
 *******************************************************************************/
class AbnormalStatusWnd extends UICommonAPI;

const NSTATUSICON_FRAMESIZE = 12;
const NSTATUSICON_MAXCOL = 12;

var int m_NormalStatusRow;
var int m_EtcStatusRow;
var int m_ShortStatusRow;
var int m_SongDanceStatusRow;
var int m_DebuffStatusRow;
var bool m_bOnCurState;
var WindowHandle Me;
var StatusIconHandle StatusIcon;

function OnLoad()
{
    RegisterEvent(950);
    RegisterEvent(960);
    RegisterEvent(970);
    RegisterEvent(40);
    RegisterEvent(50);
    RegisterEvent(310);
    RegisterEvent(1900);
    m_NormalStatusRow = -1;
    m_EtcStatusRow = -1;
    m_ShortStatusRow = -1;
    m_SongDanceStatusRow = -1;
    m_DebuffStatusRow = -1;
    m_bOnCurState = false;
    InitHandle();
    return;
}

function InitHandle()
{
    Me = GetHandle("AbnormalStatusWnd");
    StatusIcon = StatusIconHandle(GetHandle("AbnormalStatusWnd.StatusIcon"));
    return;
}

function OnEnterState(name a_PreStateName)
{
    m_bOnCurState = true;
    UpdateWindowSize();
    return;
}

function OnExitState(name a_NextStateName)
{
    m_bOnCurState = false;
    return;
}

function OnEvent(int Event_ID, string param)
{
    // End:0x1D
    if(Event_ID == 950)
    {
        HandleAddNormalStatus(param);      
    }
    else
    {
        // End:0x3A
        if(Event_ID == 960)
        {
            HandleAddEtcStatus(param);          
        }
        else
        {
            // End:0x57
            if(Event_ID == 970)
            {
                HandleAddShortStatus(param);              
            }
            else
            {
                // End:0x6C
                if(Event_ID == 40)
                {
                    HandleRestart();                  
                }
                else
                {
                    // End:0x81
                    if(Event_ID == 50)
                    {
                        HandleDie();                      
                    }
                    else
                    {
                        // End:0x99
                        if(Event_ID == 310)
                        {
                            HandleShowReplayQuitDialogBox();                          
                        }
                        else
                        {
                            // End:0xAE
                            if(Event_ID == 1900)
                            {
                                HandleLanguageChanged();
                            }
                        }
                    }
                }
            }
        }
    }
    return;
}

function HandleRestart()
{
    ClearAll();
    return;
}

function HandleDie()
{
    ClearStatus(false, false);
    ClearStatus(false, true);
    return;
}

function HandleShowReplayQuitDialogBox()
{
    Me.HideWindow();
    return;
}

function OnShow()
{
    local int RowCount;

    RowCount = StatusIcon.GetRowCount();
    // End:0x2F
    if(RowCount < 1)
    {
        Me.HideWindow();
    }
    return;
}

function ClearStatus(bool bEtcItem, bool bShortItem)
{
    local int i, j, RowCount, RowCountTmp, ColCount;

    local StatusIconInfo Info;

    // End:0x3B
    if((bEtcItem == false) && bShortItem == false)
    {
        m_NormalStatusRow = -1;
        m_SongDanceStatusRow = -1;
        m_DebuffStatusRow = -1;
    }
    // End:0x60
    if((bEtcItem == true) && bShortItem == false)
    {
        m_EtcStatusRow = -1;
    }
    // End:0x85
    if((bEtcItem == false) && bShortItem == true)
    {
        m_ShortStatusRow = -1;
    }
    RowCount = StatusIcon.GetRowCount();
    i = 0;
    J0xA1:

    // End:0x1A9 [Loop If]
    if(i < RowCount)
    {
        ColCount = StatusIcon.GetColCount(i);
        j = 0;
        J0xD1:

        // End:0x19F [Loop If]
        if(j < ColCount)
        {
            StatusIcon.GetItem(i, j, Info);
            // End:0x195
            if(Info.ClassID > 0)
            {
                // End:0x195
                if((Info.bEtcItem == bEtcItem) && Info.bShortItem == bShortItem)
                {
                    StatusIcon.DelItem(i, j);
                    j--;
                    ColCount--;
                    RowCountTmp = StatusIcon.GetRowCount();
                    // End:0x195
                    if(RowCountTmp != RowCount)
                    {
                        i--;
                        RowCount--;
                    }
                }
            }
            j++;
            // [Loop Continue]
            goto J0xD1;
        }
        i++;
        // [Loop Continue]
        goto J0xA1;
    }
    return;
}

function ClearAll()
{
    ClearStatus(false, false);
    ClearStatus(true, false);
    ClearStatus(false, true);
    return;
}

function HandleAddNormalStatus(string param)
{
    local int i, Max, BuffCnt;
    local StatusIconInfo Info;

    ClearStatus(false, false);
    Info.Size = GetBuffSize();
    Info.BackTex = "L2UI.EtcWndBack.AbnormalBack";
    Info.bShow = true;
    Info.bEtcItem = false;
    Info.bShortItem = false;
    BuffCnt = 0;
    ParseInt(param, "Max", Max);
    i = 0;
    J0x8C:

    // End:0x3D0 [Loop If]
    if(i < Max)
    {
        ParseInt(param, "SkillID_" $ string(i), Info.ClassID);
        ParseInt(param, "SkillLevel_" $ string(i), Info.Level);
        ParseInt(param, "RemainTime_" $ string(i), Info.RemainTime);
        ParseString(param, "Name_" $ string(i), Info.Name);
        ParseString(param, "IconName_" $ string(i), Info.IconName);
        ParseString(param, "Description_" $ string(i), Info.Description);
        // End:0x3C6
        if(Info.ClassID > 0)
        {
            // End:0x219
            if(IsSongDance(Info.ClassID))
            {
                // End:0x1FD
                if(m_SongDanceStatusRow == -1)
                {
                    m_SongDanceStatusRow = m_NormalStatusRow + 1;
                    StatusIcon.InsertRow(m_SongDanceStatusRow);
                    // End:0x1FD
                    if(m_DebuffStatusRow > -1)
                    {
                        m_DebuffStatusRow++;
                    }
                }
                StatusIcon.AddCol(m_SongDanceStatusRow, Info);
                // [Explicit Continue]
                goto J0x3C6;
            }
            // End:0x321
            if(IsDebuff(Info.ClassID, Info.Level))
            {
                Info.BackTex = "L2UI_CH3.PlayerStatusWnd.Debuff";
                // End:0x2A7
                if((m_DebuffStatusRow == -1) && m_SongDanceStatusRow == -1)
                {
                    m_DebuffStatusRow = m_NormalStatusRow + 1;
                    StatusIcon.InsertRow(m_DebuffStatusRow);                  
                }
                else
                {
                    // End:0x2E9
                    if((m_DebuffStatusRow == -1) && m_SongDanceStatusRow > -1)
                    {
                        m_DebuffStatusRow = m_SongDanceStatusRow + 1;
                        StatusIcon.InsertRow(m_DebuffStatusRow);
                    }
                }
                Info.ClassID = Info.ClassID + 1000000;
                StatusIcon.AddCol(m_DebuffStatusRow, Info);
                // [Explicit Continue]
                goto J0x3C6;
            }
            Info.BackTex = "L2UI.EtcWndBack.AbnormalBack";
            // End:0x3A6
            if((float(BuffCnt) % float(12)) == float(0))
            {
                m_NormalStatusRow++;
                StatusIcon.InsertRow(m_NormalStatusRow);
                // End:0x390
                if(m_SongDanceStatusRow > -1)
                {
                    m_SongDanceStatusRow++;
                }
                // End:0x3A6
                if(m_DebuffStatusRow > -1)
                {
                    m_DebuffStatusRow++;
                }
            }
            StatusIcon.AddCol(m_NormalStatusRow, Info);
            BuffCnt++;
        }
        J0x3C6:

        i++;
        // [Loop Continue]
        goto J0x8C;
    }
    // End:0x427
    if(m_EtcStatusRow > -1)
    {
        m_EtcStatusRow = m_NormalStatusRow + 1;
        // End:0x40A
        if(m_SongDanceStatusRow > -1)
        {
            m_EtcStatusRow = m_SongDanceStatusRow + 1;
        }
        // End:0x427
        if(m_DebuffStatusRow > -1)
        {
            m_EtcStatusRow = m_DebuffStatusRow + 1;
        }
    }
    // End:0x47E
    if(m_ShortStatusRow > -1)
    {
        m_ShortStatusRow = m_NormalStatusRow + 1;
        // End:0x461
        if(m_SongDanceStatusRow > -1)
        {
            m_ShortStatusRow = m_SongDanceStatusRow + 1;
        }
        // End:0x47E
        if(m_DebuffStatusRow > -1)
        {
            m_ShortStatusRow = m_DebuffStatusRow + 1;
        }
    }
    UpdateWindowSize();
    return;
}

function HandleAddEtcStatus(string param)
{
    local int i, Max, BuffCnt, CurRow;
    local bool bNewRow;
    local StatusIconInfo Info;

    ClearStatus(true, false);
    Info.Size = GetBuffSize();
    Info.BackTex = "L2UI.EtcWndBack.AbnormalBack";
    Info.bShow = true;
    Info.bEtcItem = true;
    Info.bShortItem = false;
    // End:0x8E
    if(m_ShortStatusRow > -1)
    {
        bNewRow = false;
        CurRow = m_ShortStatusRow;      
    }
    else
    {
        bNewRow = true;
        CurRow = m_NormalStatusRow;
        // End:0xBB
        if(m_SongDanceStatusRow > -1)
        {
            CurRow = m_SongDanceStatusRow;
        }
        // End:0xD5
        if(m_DebuffStatusRow > -1)
        {
            CurRow = m_DebuffStatusRow;
        }
    }
    BuffCnt = 0;
    ParseInt(param, "Max", Max);
    i = 0;
    J0xF8:

    // End:0x277 [Loop If]
    if(i < Max)
    {
        ParseInt(param, "SkillID_" $ string(i), Info.ClassID);
        ParseInt(param, "SkillLevel_" $ string(i), Info.Level);
        ParseInt(param, "RemainTime_" $ string(i), Info.RemainTime);
        ParseString(param, "Name_" $ string(i), Info.Name);
        ParseString(param, "IconName_" $ string(i), Info.IconName);
        ParseString(param, "Description_" $ string(i), Info.Description);
        // End:0x26D
        if(Info.ClassID > 0)
        {
            // End:0x242
            if(bNewRow)
            {
                bNewRow = !bNewRow;
                CurRow++;
                StatusIcon.InsertRow(CurRow);
            }
            StatusIcon.AddCol(CurRow, Info);
            m_EtcStatusRow = CurRow;
            BuffCnt++;
        }
        i++;
        // [Loop Continue]
        goto J0xF8;
    }
    UpdateWindowSize();
    return;
}

function HandleAddShortStatus(string param)
{
    local int i, Max, BuffCnt, CurRow, CurCol;

    local bool bNewRow;
    local StatusIconInfo Info;

    ClearStatus(false, true);
    Info.Size = GetBuffSize();
    Info.BackTex = "L2UI.EtcWndBack.AbnormalBack";
    Info.bShow = true;
    Info.bEtcItem = false;
    Info.bShortItem = true;
    CurCol = -1;
    // End:0x99
    if(m_EtcStatusRow > -1)
    {
        bNewRow = false;
        CurRow = m_EtcStatusRow;      
    }
    else
    {
        bNewRow = true;
        CurRow = m_NormalStatusRow;
        // End:0xC6
        if(m_SongDanceStatusRow > -1)
        {
            CurRow = m_SongDanceStatusRow;
        }
        // End:0xE0
        if(m_DebuffStatusRow > -1)
        {
            CurRow = m_DebuffStatusRow;
        }
    }
    BuffCnt = 0;
    ParseInt(param, "Max", Max);
    i = 0;
    J0x103:

    // End:0x28E [Loop If]
    if(i < Max)
    {
        ParseInt(param, "SkillID_" $ string(i), Info.ClassID);
        ParseInt(param, "SkillLevel_" $ string(i), Info.Level);
        ParseInt(param, "RemainTime_" $ string(i), Info.RemainTime);
        ParseString(param, "Name_" $ string(i), Info.Name);
        ParseString(param, "IconName_" $ string(i), Info.IconName);
        ParseString(param, "Description_" $ string(i), Info.Description);
        // End:0x284
        if(Info.ClassID > 0)
        {
            // End:0x24D
            if(bNewRow)
            {
                bNewRow = !bNewRow;
                CurRow++;
                StatusIcon.InsertRow(CurRow);
            }
            CurCol++;
            StatusIcon.InsertCol(CurRow, CurCol, Info);
            m_ShortStatusRow = CurRow;
            BuffCnt++;
        }
        i++;
        // [Loop Continue]
        goto J0x103;
    }
    UpdateWindowSize();
    return;
}

function UpdateWindowSize()
{
    local int RowCount;
    local Rect rectWnd;

    RowCount = StatusIcon.GetRowCount();
    // End:0xA4
    if(RowCount > 0)
    {
        // End:0x3B
        if(m_bOnCurState)
        {
            Me.ShowWindow();          
        }
        else
        {
            Me.HideWindow();
        }
        rectWnd = StatusIcon.GetRect();
        Me.SetWindowSize(rectWnd.nWidth + 12, rectWnd.nHeight);
        Me.SetFrameSize(12, rectWnd.nHeight);      
    }
    else
    {
        Me.HideWindow();
    }
    return;
}

function HandleLanguageChanged()
{
    local int i, j, RowCount, ColCount;
    local StatusIconInfo Info;

    RowCount = StatusIcon.GetRowCount();
    i = 0;
    J0x1C:

    // End:0x117 [Loop If]
    if(i < RowCount)
    {
        ColCount = StatusIcon.GetColCount(i);
        j = 0;
        J0x4C:

        // End:0x10D [Loop If]
        if(j < ColCount)
        {
            StatusIcon.GetItem(i, j, Info);
            // End:0x103
            if(Info.ClassID > 0)
            {
                Info.Name = Class'UIDATA_SKILL'.static.GetName(Info.ClassID, Info.Level);
                Info.Description = Class'UIDATA_SKILL'.static.GetDescription(Info.ClassID, Info.Level);
                StatusIcon.SetItem(i, j, Info);
            }
            j++;
            // [Loop Continue]
            goto J0x4C;
        }
        i++;
        // [Loop Continue]
        goto J0x1C;
    }
    return;
}

function int GetBuffSize()
{
    local int tmpSize;

    tmpSize = GetComboBoxHandle("OptionWnd.cbBuffSize").GetSelectedNum();
    switch(tmpSize)
    {
        // End:0x3A
        case 0:
            return 24;
        // End:0x41
        case 1:
            return 20;
        // End:0x49
        case 2:
            return 16;
        // End:0x51
        case 3:
            return 12;
        // End:0xFFFF
        default:
       
            break;
    }
}

function SetBuffSize()
{
    StatusIcon.SetIconSize(GetBuffSize());
    UpdateWindowSize();
    return;
}

function OnLButtonUp(WindowHandle a_WindowHandle, int X, int Y)
{
    local Rect abnormalRect;
    local StatusIconInfo Info;
    local SkillInfo SkillInfo;
    local int Row, col;

    // End:0x0F
    if(!IsKeyDown(EInputKey(18)))
    {
        return;
    }
    abnormalRect = Me.GetRect();
    // End:0x114
    if((X > abnormalRect.nX) && X < (abnormalRect.nX + abnormalRect.nWidth))
    {
        Row = (Y - abnormalRect.nY) / (GetBuffSize());
        col = ((X - abnormalRect.nX) - 12) / (GetBuffSize());
        StatusIcon.GetItem(Row, col, Info);
        // End:0xE3
        if(!GetSkillInfo(Info.ClassID, Info.Level, SkillInfo))
        {
            return;          
        }
        else
        {
            RequestBypassToServer((("_dispel:" $ string(Info.ClassID)) $ ",") $ string(Info.Level));
        }
    }
 
}

and this is the code to add

Код:
 const NSTATUSICON_SIZE =  24 ;
function OnLButtonDblClick ( int X ,  int Y )  {
    local Rect windowBounds ;
    local int targetRow ;
    local int targetCol ;
 
    local StatusIconInfo info ;
    local SkillInfo skillInfo ;
 
    // Find window position
    windowBounds = Me. GetRect ( ) ;
 
    // Process clicks outside of window frame only
    if  ( X >  ( windowBounds. nX +  NSTATUSICON_FRAMESIZE ) ) {  //
        Calc row and col of targeted icon
        targetRow =  ( Y - windowBounds. nY )  / NSTATUSICON_SIZE ;
        targetCol =  ( X - windowBounds. nX  - NSTATUSICON_FRAMESIZE )  / NSTATUSICON_SIZE ;
 
        // Store status info of targeted icon
        StatusIcon. GetItem ( targetRow , targetCol , info ) ;
 
        // Store actual skill info and make sure it is exists
        if  ( GetSkillInfo ( info. ClassID , info. Level , skillInfo ) )  {
            // Request server to stop skill effect
            // Usage: _dispel:<int:skill_id>,<int :skill_level>
            // Example: _dispel:313,8
            RequestBypassToServer ( "_dispel:" $ string ( skillInfo. SkillID ) $ "," $ string ( skillInfo. SkillLevel ) ) ) ;
        }
    }
}
 
Код:
function OnLButtonDown (WindowHandle a_WindowHandle, int X, int Y)
{
    local Rect windowBounds;
    local int targetRow;
    local int targetCol;
 
    local StatusIconInfo info;
    local SkillInfo skillInfo;
    if (IsKeyDown( IK_Alt ))
    {
        // Find window position
        windowBounds = Me.GetRect();
 
        // Process clicks outside of window frame only
        if (X > (windowBounds.nX + NSTATUSICON_FRAMESIZE))
        {
            //Calc row and col of targeted icon
            targetRow = (Y - windowBounds. nY) / (GetBuffSize() + 2);
            targetCol = (X - windowBounds. nX - NSTATUSICON_FRAMESIZE) / (GetBuffSize() + 2);
 
            // Store status info of targeted icon
            StatusIcon.GetItem(targetRow, targetCol ,info );
 
            // Store actual skill info and make sure it is exists
            if (GetSkillInfo(info.ClassID, info.Level, skillInfo))
            {
                // Request server to stop skill effect
                // Usage: _dispel:<int:skill_id>,<int :skill_level>
                // Example: _dispel:313,8
                RequestBypassToServer("dispelBuff_"$string(skillInfo.SkillID));
            }
        }
    }
}
RequestBypassToServer на свой исправьте. Должно помочь
 
It also removes a buff on the right, for example, I have shield and body and I try to remove shield, the body is removed
 
Назад
Сверху