Cerere funcție depozit!

Închis
Avatar utilizator
Gunther
Nivel 1

Nivel 1
Mesaje: 114
Membru din: 18 Aug 2013, 10:20
Server: WOD2
Regat: Jinno
Aprecieri: 99  
Mulţumiri: 4  
 Contact:
Medalii

Salut,
Caut de ceva timp funcție pentru depozit ca atunci când dai click dreapta pe un item să se pună automat în inventar, cum este și pe oficial.
Dacă are cineva această funcție și este drăguț să o împartă și cu mine...

[ Postat de pe Android ] Imagine
[*]În curând:CLICK AICI[/b] :ymparty:
[*]Site : CLICK AICI[/b]
Afișează semnătura
Avatar utilizator
Gunther
Nivel 1

Nivel 1
Mesaje: 114
Membru din: 18 Aug 2013, 10:20
Server: WOD2
Regat: Jinno
Aprecieri: 99  
Mulţumiri: 4  
 Contact:
Medalii

Up! Cineva? :D

[ Postat de pe Android ] Imagine
[*]În curând:CLICK AICI[/b] :ymparty:
[*]Site : CLICK AICI[/b]
Afișează semnătura
Avatar utilizator
Gunther
Nivel 1

Nivel 1
Mesaje: 114
Membru din: 18 Aug 2013, 10:20
Server: WOD2
Regat: Jinno
Aprecieri: 99  
Mulţumiri: 4  
 Contact:
Medalii

După o lungă căutare mai amănunţită am găsit funcţia şi o voi împărtăşi cu voi deoarce s-a oferit să mi-o dea cineva pentru 10 euro!
Funcţia este funcţională,testată de mine.
Partea de client:
Atenţie aici sunt explicate liniile fiecare în parte voi folosiţi doar codul în sine fără acele explicaţii,am lăsat explicaţiile doar ca să înţelegeţi ce sunt cu acele linii.
#[...]
import item
#[...]
class SafeboxWindow(ui.ScriptWindow):
#[...]
	def GetEmptyItemPos(self, itemHeight):
		#DaRealFreak is freak :o ;)
		inventory_size = player.INVENTORY_PAGE_SIZE * player.INVENTORY_PAGE_COUNT 
		# function to return the blocked slots based on the item size 
		GetBlockedSlots = lambda slot, size: [slot+(round*5) for round in xrange(size)] 
		# check if an item in on the slot and get the blocked slots, in the end chain all of our lists together 
		blocked_slots = [element for sublist in [GetBlockedSlots(slot, item.GetItemSize(item.SelectItem(player.GetItemIndex(slot)))[1]) for slot in xrange(inventory_size) if player.isItem(slot)] for element in sublist] 
		# check is only necessary if our item size is > 1, else bigger performance loss in list comprehension 
		if itemHeight > 1: 
			# add the slots where f.e. size 2 items won't fit because of the 2-page-separated inventory 
			[[blocked_slots.append(slot) for slot in range(inventory_size/round-(itemHeight-1)*5, inventory_size/round) if not slot in blocked_slots] for round in xrange(1,3)] 
		# check for every slot if it's not in the blocked_slots list and check also for the size the lower slots  
		free_slots = [slot for slot in xrange(inventory_size) if not slot in blocked_slots and not True in [e in blocked_slots for e in [slot+(round*5) for round in xrange(itemHeight)]]] 
		# if our free_slot list is empty return -1 as error code, else return the first possible slot 
		return [free_slots, -1][len(free_slots) == 0]

	def UseItemSlot(self, slotIndex):
		if mouseModule.mouseController.isAttached():
			mouseModule.mouseController.DeattachObject()

		item.SelectItem(safebox.GetItemID(self.__LocalPosToGlobalPos(slotIndex)))

		(w, h) = item.GetItemSize()
		emptyInvenSlots = self.GetEmptyItemPos(h)
		if emptyInvenSlots == -1:
			return

		net.SendSafeboxCheckoutPacket(slotIndex, emptyInvenSlots[0])
#[...]
Partea de sursă:
void CInputMain::SafeboxCheckout(LPCHARACTER ch, const char * c_pData, bool bMall)
{
		pkSafebox->Remove(p->bSafePos);
		pkItem->SetLastOwnerPID(ch->GetPlayerID()); #fixme slothighlight
		pkItem->AddToCharacter(ch, p->ItemPos);
		ITEM_MANAGER::instance().FlushDelayedSave(pkItem);
}
[*]În curând:CLICK AICI[/b] :ymparty:
[*]Site : CLICK AICI[/b]
Afișează semnătura
Avatar utilizator
FastReview
Veteran

Veteran
Mesaje: 2624
Membru din: 25 Oct 2015, 00:01
Aprecieri: 77  
Mulţumiri: 111  
Discord: Copiază ID
Medalii

T.C.
Rezolvat
Închis
Răspunsuri
5
Vizualizări
566
Răspunsuri
1
Vizualizări
857
Răspunsuri
3
Vizualizări
614

Înapoi la “Cereri Rezolvate”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 6 vizitatori