Jump to content

Delete item from inventory Problem


Recommended Posts

  • Premium

cde5f8a1a0faa327eaf53ff1a4c87b88.gif

How can i stop that quest input appear ?

 

The quest :

 

quest borrar_items begin

	    state start begin

	        

	        when login begin

	            cmdchat("BORRAR QID|"..q.getcurrentquestindex())

	        end

	        

	        when button or info begin

	            cmdchat("BORRAR INPUT|1")

	            local shang = split(input(cmdchat("BORRAR SEND|")), "|")

	            cmdchat("BORRAR INPUT|0")

	            

	            if shang[1] == "BORRAR" then

	                borrar_items.Borrar(tonumber(shang[2]), tonumber(shang[3]))

	            end

	        end

	        

	        function Borrar(slot, vnum)

	            item.select_cell(slot)

	            local item_vnum, item_count, item_id = item.get_vnum(), item.get_count(), item.get_id()

	                if is_test_server() then

	                syschat("---- Debug ----")

	                syschat("Vnum: "..tostring(vnum))

	                syschat("Slot: "..tostring(slot))

	                syschat("ID: "..tostring(item.get_id()))

	                syschat("---- End_Debug ----")

	            end

	            item.remove_stack()

	        end

	    end

	end

Client part :
Spoiler

 

### ConstInfo.py

BorrarItems = {
    "QID" : 0,
    "BORRAR" : "",
}

### Game.py

En el __ServerCommand_Build, pegar esto:

            "BORRAR"                : self.ManagerBorrar,

Al final del game.py pegar esto:

    def ManagerBorrar(self, cmd):
        cmd = cmd.split("|")
        if cmd[0] == "QID":
            constInfo.BorrarItems["QID"] = int(cmd[1])
        elif cmd[0] == "SEND":
            net.SendQuestInputStringPacket(str(constInfo.BorrarItems["BORRAR"]))
            constInfo.BorrarItems["BORRAR"] = ""
        elif cmd[0] == "INPUT":
            constInfo.INPUT_IGNORE = int(cmd[1])
            
### uiInventory.py

Debajo de 

            wndEquip = self.GetChild("EquipmentSlot")

Pegar esto:

            wndBorrar = self.GetChild("BorrarSlot")
            
Debajo de:

            self.costumeButton = self.GetChild2("CostumeButton")

Pegar:

            self.borrar_items = self.GetChild2("BorrarItems")
            
Debajo de:

        self.attachMetinDialog.Hide()

Pegar esto:

        self.drag = ui.Bar()
        self.drag.SetPosition(13+50,538)
        self.drag.SetParent(self)
        self.drag.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.0))
        self.drag.SetSize(32,32)
        self.drag.OnMouseLeftButtonUp = lambda: self.Add_Item()
        self.drag.Show()

        wndBorrar.SetOverInItemEvent(ui.__mem_func__(self.OverBorrarIn))
        wndBorrar.SetOverOutItemEvent(ui.__mem_func__(self.OverBorrarOut))
        
        self.RemoveQuestion = uiCommon.QuestionDialog()
        self.RemoveQuestion.SetAcceptEvent(lambda arg = TRUE: self.Borrar_Item(arg))
        self.RemoveQuestion.SetCancelEvent(lambda arg = FALSE: self.Borrar_Item(arg))
        self.RemoveQuestion.Close()
        
Debajo del def Close(self):

Pegar esto:

    def OverBorrarIn(self):
        self.ShowToolTip(0)
        
    def OverBorrarOut(self):
        self.tooltipItem.HideToolTip()
        
    def Add_Item(self):
        if mouseModule.mouseController.isAttached():
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            attachedSlotVnum = mouseModule.mouseController.GetAttachedItemIndex()
                
            # item.SelectItem(attachedSlotVnum)
            if player.SLOT_TYPE_INVENTORY == attachedSlotType:
                item.SelectItem(attachedSlotVnum)
                self.RemoveQuestion.SetText("żSeguro que quieres borrar "+str(item.GetItemName())+"?")
                self.RemoveQuestion.Open()
                constInfo.BorrarItems["BORRAR"] = ""
                constInfo.BorrarItems["BORRAR"] = "BORRAR|"+str(attachedSlotPos)+"|"+str(attachedSlotVnum)
                #chat.AppendChat(1, constInfo.BorrarItems["BORRAR"])
                
            mouseModule.mouseController.DeattachObject()
        
    def Borrar_Item(self, arg):
        if arg:
            event.QuestButtonClick(constInfo.BorrarItems["QID"])
            
        self.RemoveQuestion.Close()

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Open game.py and search function:

 

    def OpenQuestWindow(self, skin, idx):

 

and replaces it all

 

    def OpenQuestWindow(self, skin, idx):
        if constInfo.INPUT_IGNORE == 1:
            return
        self.interface.OpenQuestWindow(skin, idx)

 

 

or in QuestDialog:

 

    def __init__(self,skin,idx):
        if constInfo.INPUT_IGNORE == 1:
            return

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.