Jump to content

tw1x1

Member
  • Posts

    10
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by tw1x1

  1. In root/ui.py look for
     

    def MakeTextLine(parent):

     

    Bellow add
     

    def MakeTextLineNew(parent, x, y, text):
    	textLine = TextLine()
    	textLine.SetParent(parent)
    	textLine.SetPosition(x, y)
    	textLine.SetText(text)
    	textLine.Show()
    	return textLine

     

    Now go in uiqcuicksell.py and change
     

    self.sellItemSelectedCount = ui.MakeTextLine

    and

    self.sellPrice = ui.MakeTextLine

     

    with
     

    		self.sellItemSelectedCount = ui.MakeTextLineNew(self.sellItemSelectedCountBG, 0, 0, "")
    		self.sellItemSelectedCount.SetWindowHorizontalAlignCenter()
    		self.sellItemSelectedCount.SetHorizontalAlignCenter()
    
    		self.sellPrice = ui.MakeTextLineNew(self.sellPriceBG, 0, 0, "")
    		self.sellPrice.SetWindowHorizontalAlignCenter()
    		self.sellPrice.SetHorizontalAlignCenter()

     

    You could even remove the "text" argument, you don't use it.

  2. PythonUtils.cpp add 
     

    bool PyTuple_GetUnsignedLong(PyObject *poArgs, int pos, unsigned long *ret)
    {
    	if (pos >= PyTuple_Size(poArgs))
    		return false;
    
    	PyObject *poItem = PyTuple_GetItem(poArgs, pos);
    	
    	if (!poItem)
    		return false;
    	
    	*ret = PyLong_AsUnsignedLong(poItem);
    	return true;
    }

     

    and PythonUtils.h
     

    bool PyTuple_GetUnsignedLong(PyObject *poArgs, int pos, unsigned long *ret);

     

    • Love 1
  3. [!] Note that you might have NULL instead of nullptr !

    In PythonSlotWindow.cpp look for
     

    	Slot.pSignImage = nullptr;

     

    Bellow add
     

    	Slot.pCoverImage = nullptr;


    Look for
     

    	if (pSlot->pSignImage)
    	{
     		pSlot->pSignImage->Hide();
    	}

     

    Bellow add
     

    	if (pSlot->pCoverImage)
    	{
    		pSlot->pCoverImage->Hide();
    	}

     

    Look for
     

    		if (rSlot.pNumberLine)
    		{
    			int ix = rSlot.byxPlacedItemSize*ITEM_WIDTH + rSlot.ixPosition - 4;
    			int iy = rSlot.iyPosition + rSlot.byyPlacedItemSize*ITEM_HEIGHT - 12 + 2;
    			rSlot.pNumberLine->SetPosition(ix, iy);
    			rSlot.pNumberLine->Update();
    			rSlot.pNumberLine->Render();
    		}

     

    Bellow add
     

    		if (rSlot.pCoverImage)
    		{
    			rSlot.pCoverImage->SetPosition(m_rect.left + rSlot.ixPosition, m_rect.top + rSlot.iyPosition);
    			rSlot.pCoverImage->Render();
    		}

     

    Now go in PythonSlotWindow.h and look for
     

    CAniImageBox* pFinishCoolTimeEffect;

     

    Bellow add
     

    				std::shared_ptr< CImageBox > pCoverImage;

     

    • Love 1
  4. 18 minutes ago, NvL said:


    0308 21:55:14716 ::   File "uiInventory.py", line 2129, in RefreshQuickSell

    0308 21:55:14716 :: AttributeError
    0308 21:55:14716 :: :
    0308 21:55:14716 :: 'GridSlotWindow' object has no attribute 'EnableSlotCoverImage'

    uiinventory.py

        if app.QUICK_SELL_SYSTEM:
            def RefreshQuickSell(self):
                for k in xrange(player.INVENTORY_PAGE_SIZE * 5):
                    slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(k)
                    if slotNumber in constInfo.QUICK_SELL_ITEMS:
                        self.wndItem.SetSlotCoverImage(k, "inventory/selected_icon.tga")
                    else:
                        self.wndItem.EnableSlotCoverImage(k, False)


    In EterPythonLib\PythonSlotWindow.cpp look for
     

    void CSlotWindow::SetSlotCoolTimeInverse(DWORD dwIndex, float fCoolTime, float fRemainingTime)


    add above or after whole function
     

    void CSlotWindow::SetSlotCoverImage(const DWORD dwIndex, const char* FileName)
    {
    	TSlot* pSlot;
    	if (!GetSlotPointer(dwIndex, &pSlot))
    		return;
    
    	auto& CoverImage = pSlot->pCoverImage;
    	if (CoverImage == nullptr)
    		CoverImage = std::make_shared<CImageBox>(nullptr);
    
    	CoverImage->LoadImage(FileName);
    	CoverImage->Show();
    }
    
    void CSlotWindow::EnableSlotCoverImage(const DWORD dwIndex, const bool bEnable)
    {
    	TSlot* pSlot;
    	if (!GetSlotPointer(dwIndex, &pSlot))
    		return;
    
    	const auto& CoverImage = pSlot->pCoverImage;
    	if (CoverImage == nullptr)
    		return;
    
    	if (bEnable)
    		CoverImage->Show();
    	else
    		CoverImage->Hide();
    }

     


    In EterPythonLib\PythonSlotWindow.cpp look for
     

    void RefreshSlot();



    Add after
     

    			void SetSlotCoverImage(const DWORD dwIndex, const char* FileName);
    			void EnableSlotCoverImage(const DWORD dwIndex, const bool bEnable);



    Now go in PythonWindowManagerModule.cpp and add before void initwndMgr()

     

    PyObject *wndMgrSetSlotCoverImage(PyObject *poSelf, PyObject *poArgs)
    {
    	UI::CWindow *pWin;
    	if (!PyTuple_GetWindow(poArgs, 0, &pWin))
    		return Py_BuildException();
    
    	DWORD dwSlotIndex;
    	if (!PyTuple_GetUnsignedLong(poArgs, 1, &dwSlotIndex))
    		return Py_BuildException();
    
    	char *szFileName;
    	if (!PyTuple_GetString(poArgs, 2, &szFileName))
    		return Py_BuildException();
    
    	if (!pWin->IsType(UI::CSlotWindow::Type()))
    		return Py_BuildException();
    
    	dynamic_cast<UI::CSlotWindow*>(pWin)->SetSlotCoverImage(dwSlotIndex, szFileName);
    
    	return Py_BuildNone();
    }
    
    PyObject *wndMgrEnableSlotCoverImage(PyObject *poSelf, PyObject *poArgs)
    {
    	UI::CWindow *pWin;
    	if (!PyTuple_GetWindow(poArgs, 0, &pWin))
    		return Py_BuildException();
    
    	DWORD dwSlotIndex;
    	if (!PyTuple_GetUnsignedLong(poArgs, 1, &dwSlotIndex))
    		return Py_BuildException();
    
    	bool bOnOff;
    	if (!PyTuple_GetBoolean(poArgs, 2, &bOnOff))
    		return Py_BuildException();
    
    	if (!pWin->IsType(UI::CSlotWindow::Type()))
    		return Py_BuildException();
    
    	dynamic_cast<UI::CSlotWindow*>(pWin)->EnableSlotCoverImage(dwSlotIndex, bOnOff);
    
    	return Py_BuildNone();
    }



    And look for
     

    { "ShowOverInWindowName",		wndMgrShowOverInWindowName,			METH_VARARGS },

     


    Add after
     

    		{ "SetSlotCoverImage",			wndMgrSetSlotCoverImage,			METH_VARARGS },
    		{ "EnableSlotCoverImage",		wndMgrEnableSlotCoverImage,			METH_VARARGS },



    Compile your binary and go in root/ui.py and look for
     

    	def GetStartIndex(self):
    		return 0

     


    Below add
     

    		def SetSlotCoverImage(self, slotindex, filename):
    			wndMgr.SetSlotCoverImage(self.hWnd, slotindex, filename)
    
    		def EnableSlotCoverImage(self, slotindex, onoff):
    			wndMgr.EnableSlotCoverImage(self.hWnd, slotindex, onoff)



    Or you could take all this from Mali's change look system released on this community.

    • Love 2
  5. Thank you, but I don't understand 

     

    Search self.wndItem.RefreshSlot() in def RefreshBagSlotWindow(self):
    
    Add below:
    
    		if app.QUICK_SELL_SYSTEM:
    			self.RefreshQuickSell()
    
    Add at the end:
    
    	if app.QUICK_SELL_SYSTEM:
    		def RefreshQuickSell(self):
    			for k in xrange(player.INVENTORY_PAGE_SIZE * 5):
    				slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(k)
    				if slotNumber in constInfo.QUICK_SELL_ITEMS:
    					self.wndItem.SetSlotCoverImage(k, "inventory/selected_icon.tga")
    				else:
    					self.wndItem.EnableSlotCoverImage(k, False)


    while you could've done

     

    			if app.QUICK_SELL_SYSTEM:
    				if slotNumber in constInfo.QUICK_SELL_ITEMS:
    					self.wndItem.SetSlotCoverImage(i, "d:/ymir work/ui/game/inventory/selected_icon.tga")
    				else:
    					self.wndItem.EnableSlotCoverImage(i, False)
    
    		self.wndItem.RefreshSlot()



    Also what can happen if your constInfo.IS_AUTO_POTION effect is active and you'll sell your potion or having growth pet active and selling it. I would suggest this

     

    		if app.ENABLE_QUICK_SELL_ITEM:
    			itemVnum = player.GetItemIndex(slotIndex)
    			blackList = [constInfo.IS_AFFECT_PLUS, constInfo.IS_AUTO_POTION, constInfo.IS_GROWTH_PET_ITEM]
    
    			if app.IsPressed(app.DIK_LCONTROL):
    				for func in blackList:
    					if func(itemVnum):
    						return
    
    				if slotIndex in constInfo.QUICK_SELL_ITEMS:
    					self.interface.RemoveSellSlot(slotIndex)
    					self.RefreshBagSlotWindow()
    					return
    				elif not slotIndex in constInfo.QUICK_SELL_ITEMS:
    					self.interface.AppendSellSlot(slotIndex)
    					self.RefreshBagSlotWindow()
    					return

     

  6. You could've done something like

    ACMD(do_item_purge)
    {
        char arg1[256];
        one_argument(argument, arg1, sizeof(arg1));
     
        int i;
        LPITEM item;
     
        if (*arg1 && !strcmp(arg1, "all"))
        {
            for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
            {
                if ((item = ch->GetInventoryItem(i)))
                {
                    ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
                    ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
                }
            }
            for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
            {
                if ((item = ch->GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i ))))
                {
                    ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
                }
            }
        }
        else
        {
            for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
            {
                if ((item = ch->GetInventoryItem(i)))
                {
                    if (item->IsEquipped())
                        continue; 
     
                    ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
                    ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
                }
            }
     
            for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
            {
                if ((item = ch->GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i))))
                {
                    if (item->IsEquipped())
                        continue;
     
                    ITEM_MANAGER::instance().RemoveItem(item, "PURGE");
                }
            }
        }
    }

     

    • Good 1
×
×
  • 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.