[C++ & PY]Non-Tradeable-Items-Effect

06/30/2016 02:48 MrLibya#1
Hallo all

system : [Only registered and activated users can see links. Click Here To Register...]

c++ :

open EterPythonLib/PythonSlotWindow.cpp

PHP Code:

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->dwStateSLOT_STATE_UNUSABLE);
 
//pSlot->dwState |= SLOT_STATE_UNUSABLE;
}



void CSlotWindow::SetUsableSlot(DWORD dwIndex)
{
 
TSlot pSlot;
 if (!
GetSlotPointer(dwIndex, &pSlot))
  return;
 
REMOVE_BIT(pSlot->dwStateSLOT_STATE_UNUSABLE);
 
//pSlot->dwState ^= SLOT_STATE_UNUSABLE;
}

now find :

if (
rSlot.pFinishCoolTimeEffect)

after this block add  this part by [COLOR="Red"]xP3NG3Rx [/COLOR]):

if (
IS_SET(rSlot.dwStateSLOT_STATE_UNUSABLE))
  {
   
CPythonGraphic::Instance().SetDiffuseColor(1.0f1.0f1.0f0.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

PHP Code:

find 
SLOT_STATE_ALWAYS_RENDER_COVER = (<< 3)

add after it :

SLOT_STATE_UNUSABLE = (<< 4),

now find BOOL IsEnableSlot(DWORD dwIndex);

add after it 

   
void SetUnusableSlot(DWORD dwIndex);
   
void SetUsableSlot(DWORD dwIndex); 
now open :

/EterPythonLib/PythonWindowManagerModule.cpp


PHP Code:

find 
:

PyObject wndMgrDisableSlot(PyObject poSelfPyObject poArgs)

after this function add :

PyObject wndMgrSetUnusableSlot(PyObject poSelfPyObject poArgs)
{
 
UI::CWindow pWin;
 if (!
PyTuple_GetWindow(poArgs0, &pWin))
  return 
Py_BuildException();



 
int iSlotIndex;
 if (!
PyTuple_GetInteger(poArgs1, &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 poSelfPyObject poArgs)
{
 
UI::CWindow pWin;
 if (!
PyTuple_GetWindow(poArgs0, &pWin))
  return 
Py_BuildException();



 
int iSlotIndex;
 if (!
PyTuple_GetInteger(poArgs1, &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

PHP Code:

thx to [COLOR="red"]martysama0134 [/COLOR])

find PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "StartExchange"Py_BuildValue("()"));

add after it :

__RefreshInventoryWindow(); 
now python part


open :root/ui.py

PHP Code:

find 
def EnableSlot(selfslotIndex):

after this def add :

def SetUnusableSlot(selfslotIndex):
  
wndMgr.SetUnusableSlot(self.hWndslotIndex)

 
def SetUsableSlot(selfslotIndex):
  
wndMgr.SetUsableSlot(self.hWndslotIndex
open : root/uiinventory.py

PHP Code:

add 

import exchange

find 
self.wndCostume None

add 
self.listUnusableSlot = []


find setItemVNum(iitemVnumitemCount)

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 :)






06/30/2016 04:16 Chris9090909090#2
its with red effect?

ty for this
06/30/2016 04:56 kstmr#3
Quote:
Originally Posted by Chris9090909090 View Post
its with red effect?

ty for this
change the color from here:
PHP Code:
   CPythonGraphic::Instance().SetDiffuseColor(1.0f1.0f1.0f0.3f); 
the last arg (0.3) is for the alpha channel (aka opacity it will look a bit gray)
06/30/2016 06:23 Finaltorment#4
seems only work in 1st page of inventory
06/30/2016 06:53 Hachiwari#5
Better is LockSlot, only change color
06/30/2016 11:35 LordMG#6
Not only in exchange is shown this effect man.
06/30/2016 12:09 filipw1#7
Quote:
Originally Posted by Finaltorment View Post
seems only work in 1st page of inventory
Change:
for i in xrange(player.INVENTORY_PAGE_SIZE*2):

for:
for i in xrange(player.INVENTORY_PAGE_SIZE*4): #4 pages

It will be fine.
06/30/2016 15:05 Finaltorment#8
Quote:
Originally Posted by filipw1 View Post
Change:
for i in xrange(player.INVENTORY_PAGE_SIZE*2):

for:
for i in xrange(player.INVENTORY_PAGE_SIZE*4): #4 pages

It will be fine.
i try it but don't work, i only see the effect on 1st page.
06/30/2016 15:42 MrLibya#9
ok thx for the notice

thix fix will make the system work on all pages

change:
<b>
PHP Code:

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

for :

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

and :
PHP Code:


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

for :

    
self.wndItem.SetUsableSlot(i)
    
self.listUnusableSlot.remove(i
07/01/2016 00:54 Voyboy#10
More guys testet? Its working fine?
07/01/2016 02:07 Finaltorment#11
yes is work fine
07/01/2016 10:46 synthou1234#12
Thanks !

Effect only at Inventory page 1

Quote:
Originally Posted by MrLibya View Post
ok thx for the notice

thix fix will make the system work on all pages

change:
<b>
PHP Code:

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

for :

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

and :
PHP Code:


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

for :

    
self.wndItem.SetUsableSlot(i)
    
self.listUnusableSlot.remove(i
Without this fix, it works fine
07/01/2016 11:33 DosenPinguin#13
Vielen dank dafür.
07/07/2016 09:57 AmerigoMendosa#14
I only see the effects of Page 1

[Only registered and activated users can see links. Click Here To Register...]
07/07/2016 11:11 MrLibya#15
Quote:
Originally Posted by AmerigoMendosa View Post
I only see the effects of Page 1

[Only registered and activated users can see links. Click Here To Register...]
've put the fix up there ( while I think the topic is updated with the fix )