Jump to content

Non Tradeable Items Effect


Recommended Posts

  • Premium

M2 Download Center

This is the hidden content, please
( Internal )

Hallo all

 
.gif
 
c++ :
 
open EterPythonLib/PythonSlotWindow.cpp
 
Spoiler

 

 
find
 
void CSlotWindow::DisableSlot(DWORD dwIndex)
 
after this function add :
 
void CSlotWindow::SetUnusableSlot(DWORD dwIndex)
{
 TSlot * pSlot;
 if (!GetSlotPointer(dwIndex, &pSlot))
  return;
 
 
 
 SET_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE);
 //pSlot->dwState |= SLOT_STATE_UNUSABLE;
}
 
 
 
void CSlotWindow::SetUsableSlot(DWORD dwIndex)
{
 TSlot * pSlot;
 if (!GetSlotPointer(dwIndex, &pSlot))
  return;
 REMOVE_BIT(pSlot->dwState, SLOT_STATE_UNUSABLE);
 //pSlot->dwState ^= SLOT_STATE_UNUSABLE;
}
 
now find :
 
if (rSlot.pFinishCoolTimeEffect)
 
after this block add  ( this part by xP3NG3Rx 😞
 
if (IS_SET(rSlot.dwState, SLOT_STATE_UNUSABLE))
  {
   CPythonGraphic::Instance().SetDiffuseColor(1.0f, 1.0f, 1.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);
  }
 

 

 
 
 
 
now open
 
EterPythonLib/PythonSlotWindow.h
 
Spoiler

 

 
find : SLOT_STATE_ALWAYS_RENDER_COVER = (1 << 3)
 
add after it :
 
SLOT_STATE_UNUSABLE = (1 << 4),
 
now find : BOOL IsEnableSlot(DWORD dwIndex);
 
add after it :
 
   void SetUnusableSlot(DWORD dwIndex);
   void SetUsableSlot(DWORD dwIndex);
 

 

 

 
now open :
 
/EterPythonLib/PythonWindowManagerModule.cpp
 
Spoiler

 

 

 
find :
 
PyObject * wndMgrDisableSlot(PyObject * poSelf, PyObject * poArgs)
 
after this function add :
 
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();
}
 

now find :
 
{ "DisableSlot",    wndMgrDisableSlot,     METH_VARARGS },
 
add :
 
  { "SetUnusableSlot",   wndMgrSetUnusableSlot,    METH_VARARGS },
  { "SetUsableSlot",    wndMgrSetUsableSlot,    METH_VARARGS },
 

 

 
 
now open:
 
/UserInterface/PythonNetworkStreamPhaseGame.cpp
 
 
Spoiler

 

 
( thx to martysama0134 )
 
find : PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "StartExchange", Py_BuildValue("()"));
 
add after it :
 
__RefreshInventoryWindow();
 
 
 

 

now python part
 
Spoiler

 


open :root/ui.py
 
 
find : def EnableSlot(self, slotIndex):
 
after this def add :
 
def SetUnusableSlot(self, slotIndex):
  wndMgr.SetUnusableSlot(self.hWnd, slotIndex)
 
 def SetUsableSlot(self, slotIndex):
  wndMgr.SetUsableSlot(self.hWnd, slotIndex)
 

 

 
 
 
open : root/uiinventory.py
 
 
Spoiler

 

 

 

 

add
 
import exchange
 
find : self.wndCostume = None
 
add : self.listUnusableSlot = []
 

find : setItemVNum(i, itemVnum, itemCount)
 
add :
 
   if exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE):
    self.wndItem.SetUnusableSlot(i)
    self.listUnusableSlot.append(i)
   elif not exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE) and slotNumber in self.listUnusableSlot:
    self.wndItem.SetUsableSlot(i)
    self.listUnusableSlot.remove(i)
 
 

 

 

 


ok that's it , have a nice day :)
 
 
 
 
 
 

 

  • Metin2 Dev 17
  • Good 1
  • Love 1
  • Love 19

If you're going to do something, then do it right.

Link to comment
Share on other sites

1 hour ago, OceanusPT said:

 

i belive this will work with txt. Cuz there u can mark itens with  ANTIFLAG_GIVE but its complicate do set this in mysql, right?

I wrote this for you: http://sandbox.onlinephpfunctions.com/code/9194d1bac0985bcc9a35834ba6dd95e20651ef8d (it's easy to understand, find "$current_antiflag" and set your item's antiflag, after use the set_bit function to set a new flag).

Link to comment
Share on other sites

2 hours ago, Shang said:

Man, when server loads the txt it converts string to numbers (like mysql) ANTIFLAG_GIVE is an antiflag number.

hum... i dont know that! Ty for the info

 

2 hours ago, .Devil. said:

I wrote this for you: http://sandbox.onlinephpfunctions.com/code/9194d1bac0985bcc9a35834ba6dd95e20651ef8d (it's easy to understand, find "$current_antiflag" and set your item's antiflag, after use the set_bit function to set a new flag).

taks Devil. I get it yes. Ty for this tutorial.

Link to comment
Share on other sites

  • Premium

ok thx for the notice

thix fix will make the system work on all pages

change:

Spoiler

    self.wndItem.SetUnusableSlot(slotNumber)
    self.listUnusableSlot.append(slotNumber)

for :
 

Spoiler

 

    self.wndItem.SetUnusableSlot(i)
    self.listUnusableSlot.append(i)

 

and :

Spoiler

    self.wndItem.SetUsableSlot(slotNumber)
    self.listUnusableSlot.remove(slotNumber)

for :

Spoiler

    self.wndItem.SetUsableSlot(i)
    self.listUnusableSlot.remove(i)

 

If you're going to do something, then do it right.

Link to comment
Share on other sites

  • Premium
20 minutes ago, finaltorment said:

another problem now, seems he don't refresh well the pages now.

Explain more

ok edit this

self.listUnusableSlot.remove(I)
self.listUnusableSlot.append(I)

to

self.listUnusableSlot.remove(i)
self.listUnusableSlot.append(i)

If you're going to do something, then do it right.

Link to comment
Share on other sites

  • Premium
3 hours ago, veilles said:

Can someone help how to add this for safebox ? I can't find function which checking is that safebox is opened. I need something like this: "exchange.isTrading()"

try to make one , it's not hard

1 hour ago, Shang said:

Why are you appending the slots in a list if you don't use the list?

open your eyes

and slotNumber in self.listUnusableSlot:

1 hour ago, ImTweet said:

Same for shops ? 

player.IsOpenPrivateShop() and item.IsAntiFlag(item.ANTIFLAG_MYSHOP

 

  • Love 1

If you're going to do something, then do it right.

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.