Jump to content

[Release] Color Slot Cube C++/Python


WorldArd
 Share

Recommended Posts

[Cliente/Root]

 

 

 

 

1.Abrir archivo "cube.py" .

 

 

2.Buscar "class CubeResultWindow(ui.ScriptWindow)" y antes de esa linea agregar :

SystemCube = 0  

3.Buscar currentSlot.SetItemSlot(0, itemVnum, itemCount) y abajo agregar:

						if player.GetItemCountByVnum(itemVnum) >= itemCount:
							currentSlot.SetUsableSlot(0)
							currentSlot.SetUnusableWorldSlot(0)
						else:
							currentSlot.SetUnusableSlot(0)
							currentSlot.SetUsableWorldSlot(0)

4.Buscamos "(x, y, z) = player.GetMainCharacterPosition()" y arriba agregamos:

		if SystemCube == 1:
			self.Refresh()

 

 

 

[binario/EterPythonLib]

 

 

 

 

 

[PythonSlotWindow.cpp]

 

 

1.Buscar void CSlotWindow::SelectSlot(DWORD dwSelectingIndex) y arriba agregar:

void CSlotWindow::SetUnusableSlot(DWORD dwIndex)
{
    TSlot * pSlot;
    if (!GetSlotPointer(dwIndex, &pSlot))
        return;
     SET_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE);
}
void CSlotWindow::SetUsableSlot(DWORD dwIndex)

{

TSlot * pSlot;

if (!GetSlotPointer(dwIndex, &pSlot))

return;

REMOVE_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE);

}

void CSlotWindow::SetUnusableWorldSlot(DWORD dwIndex)

{

TSlot * pSlot;

if (!GetSlotPointer(dwIndex, &pSlot))

return;

SET_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE_WORLD);

}


void CSlotWindow::SetUsableWorldSlot(DWORD dwIndex)

{

TSlot * pSlot;

if (!GetSlotPointer(dwIndex, &pSlot))

return;

REMOVE_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE_WORLD);

}

2.Buscar if (rSlot.bActive) y arriba agregar:

         if (IS_SET(rSlot.dwState, SLOT_STATE_UNUSABLE))
         {
            //CPythonGraphic::Instance().SetDiffuseColor(1.0f, 1.0f, 1.0f, 0.3f);
            CPythonGraphic::Instance().SetDiffuseColor(1.0f, 0.0f, 0.0f, 0.3f);
            CPythonGraphic::Instance().RenderBar2d(m_rect.left + rSlot.ixPosition,
            m_rect.top + rSlot.iyPosition,
            m_rect.left + rSlot.ixPosition + rSlot.byxPlacedItemSize * ITEM_WIDTH,
            m_rect.top + rSlot.iyPosition + rSlot.byyPlacedItemSize * ITEM_HEIGHT);
          }
          if (IS_SET(rSlot.dwState, SLOT_STATE_UNUSABLE_WORLD))
          {
            //CPythonGraphic::Instance().SetDiffuseColor(1.0f, 1.0f, 1.0f, 0.3f);
            CPythonGraphic::Instance().SetDiffuseColor(0.0f, 1.0f, 0.0f, 0.3f);
            CPythonGraphic::Instance().RenderBar2d(m_rect.left + rSlot.ixPosition,
            m_rect.top + rSlot.iyPosition,
            m_rect.left + rSlot.ixPosition + rSlot.byxPlacedItemSize * ITEM_WIDTH,
            m_rect.top + rSlot.iyPosition + rSlot.byyPlacedItemSize * ITEM_HEIGHT);
          }

[PythonSlotWindow.H]

 

1.Buscar SLOT_STATE_ALWAYS_RENDER_COVER = (1 << 3), y abajo agregar:

        SLOT_STATE_UNUSABLE = (1 << 4),
        SLOT_STATE_UNUSABLE_WORLD = (1 << 5),

[PythonWindowManagerModule.cpp]

 

1.Buscamos PyObject * wndMgrShowSlotBaseImage(PyObject * poSelf, PyObject * poArgs) y arriba agregamos:

PyObject * wndMgrSetUnusableSlot(PyObject * poSelf, PyObject * poArgs)
{
 UI::CWindow * pWin;
 if (!PyTuple_GetWindow(poArgs, 0, &pWin))
  return Py_BuildException();
int iSlotIndex;

if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))

return Py_BuildException();


if (!pWin->IsType(UI::CSlotWindow::Type()))

return Py_BuildException();


UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;

pSlotWin->SetUnusableSlot(iSlotIndex);

return Py_BuildNone();

}


PyObject * wndMgrSetUsableSlot(PyObject * poSelf, PyObject * poArgs)

{

UI::CWindow * pWin;

if (!PyTuple_GetWindow(poArgs, 0, &pWin))

return Py_BuildException();


int iSlotIndex;

if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))

return Py_BuildException();


if (!pWin->IsType(UI::CSlotWindow::Type()))

return Py_BuildException();


UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;

pSlotWin->SetUsableSlot(iSlotIndex);

return Py_BuildNone();

}

PyObject * wndMgrSetUnusableWorldSlot(PyObject * poSelf, PyObject * poArgs)

{

UI::CWindow * pWin;

if (!PyTuple_GetWindow(poArgs, 0, &pWin))

return Py_BuildException();


int iSlotIndex;

if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))

return Py_BuildException();


if (!pWin->IsType(UI::CSlotWindow::Type()))

return Py_BuildException();


UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;

pSlotWin->SetUnusableWorldSlot(iSlotIndex);

return Py_BuildNone();

}


PyObject * wndMgrSetUsableWorldSlot(PyObject * poSelf, PyObject * poArgs)

{

UI::CWindow * pWin;

if (!PyTuple_GetWindow(poArgs, 0, &pWin))

return Py_BuildException();


int iSlotIndex;

if (!PyTuple_GetInteger(poArgs, 1, &iSlotIndex))

return Py_BuildException();


if (!pWin->IsType(UI::CSlotWindow::Type()))

return Py_BuildException();


UI::CSlotWindow * pSlotWin = (UI::CSlotWindow *)pWin;

pSlotWin->SetUsableWorldSlot(iSlotIndex);

return Py_BuildNone();

}

2.Buscamos { "DisableSlot" y abajo agregamos:

          { "SetUnusableSlot",               wndMgrSetUnusableSlot,                METH_VARARGS },
          { "SetUsableSlot",               wndMgrSetUsableSlot,                METH_VARARGS },
          { "SetUnusableWorldSlot",       wndMgrSetUnusableWorldSlot,                METH_VARARGS },
          { "SetUsableWorldSlot",           wndMgrSetUsableWorldSlot,                METH_VARARGS },

 

 

 

Imagen:

 

9e180c637e.jpg

 

Saludos!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...