Jump to content

Activate all potions in the belt inventory


Recommended Posts

  • Premium

I saw this feature on a romanian private server. To avoid the spam you could do a countdown timer to disable the button for 10 seconds or whatever. 
 

Demo:

https://metin2.download/picture/GGsif6y94i4wuoP4B241s0rL9GRLq083/.gif
 

uiinventory.py:

		self.wndBeltInventoryLayer = None
		self.wndBeltInventorySlot = None
		self.expandBtn = None
		self.minBtn = None
		##activateall
		self.UseItemBelt = None
		
			self.expandBtn = self.GetChild("ExpandBtn")
			self.minBtn = self.GetChild("MinimizeBtn")
			##activateall
			self.UseItemBelt = self.GetChild("UseBeltItemsButton")
			
			self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
			self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
			##activateall
			self.UseItemBelt.SetEvent(self.ActivateAll)
			
		self.wndBeltInventorySlot.RefreshSlot()
		
	##activateall
	def ActivateAll(self):
		for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
			slotNumber = item.BELT_INVENTORY_SLOT_START + i
			net.SendItemUsePacket(slotNumber)
		

Beltinventorywindow.py:

import uiScriptLocale
import item

EQUIPMENT_START_INDEX = 90
BUTTON_ROOT = "d:/ymir work/ui/public/"

window = {
	"name" : "BeltInventoryWindow",

	## 600 - (width + 오른쪽으로 부터 띄우기 24 px)
	"x" : SCREEN_WIDTH - 176 - 148,
	"y" : SCREEN_HEIGHT - 37 - 565 + 209 + 32,
#	"x" : -148,
#	"y" : 241,
	"width" : 148,
	"height" : 169,

	"type" : "image",
	"image" : "d:/ymir work/ui/game/belt_inventory/bg.tga",
	

	"children" :
	(
		## Expand Buttons
		{
			"name" : "ExpandBtn",
			"type" : "button",

			"x" : 2,
			"y" : 15,

			"default_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_normal.tga",
			"over_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_over.tga",
			"down_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_down.tga",
			"disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_disabled.tga",
		},

		
		## Belt Inventory Layer (include minimize button)
		{
			"name" : "BeltInventoryLayer",
#			"type" : "board",
#			"style" : ("attach", "float"),

			"x" : 5,
			"y" : 0,

			"width" : 148,
			"height" : 169,

			"children" :
			(
				## Minimize Button
				{
					"name" : "MinimizeBtn",
					"type" : "button",

					"x" : 2,
					"y" : 15,

					"width" : 10,

					"default_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_normal.tga",
					"over_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_over.tga",
					"down_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_down.tga",
					"disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_disabled.tga",
				},

				## Real Belt Inventory Board
				{
					"name" : "BeltInventoryBoard",
					"type" : "board",
					"style" : ("attach", "float"),

					"x" : 10,
					"y" : 0,

					"width" : 138,
					"height" : 169,

					"children" :
					(
						## Belt Inventory Slots
						{
							"name" : "BeltInventorySlot",
							"type" : "grid_table",

							"x" : 5,
							"y" : 5,

							"start_index" : item.BELT_INVENTORY_SLOT_START,
							"x_count" : 4,
							"y_count" : 4,
							"x_step" : 32,
							"y_step" : 32,

							"image" : "d:/ymir work/ui/public/Slot_Base.sub"
						},
						##activateall
						{
							"name" : "UseBeltItemsButton",
							"type" : "button",
							"x" : 0,
							"y" : 138,
							"horizontal_align" : "center",
							"default_image" : BUTTON_ROOT + "AcceptButton00.sub",
							"over_image" : BUTTON_ROOT + "AcceptButton01.sub",
							"down_image" : BUTTON_ROOT + "AcceptButton02.sub",
						},
					),
				},
			)
		},

	),
}

I’m not a python expert so if you can improve the code you are welcome to do so.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 6
  • Angry 1
  • Sad 1
  • Confused 1
  • Good 8
  • Love 1
  • Love 7
Link to comment
Share on other sites

  • 3 weeks later...

It occurs only when teleport using a quest dialog, when teleporting by command indeed there is no problem, lets say you teleport using a quest teleport ring: https://metin2.download/picture/ECQLVFFc29r1WCACmGE143SK3W8I922Y/.gif

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

On 5/17/2021 at 2:50 AM, dv2axonn said:

It occurs only when teleport using a quest dialog, when teleporting by command indeed there is no problem, lets say you teleport using a quest teleport ring: https://metin2.download/picture/ECQLVFFc29r1WCACmGE143SK3W8I922Y/.gif

Interfacemodule.py

if self.wndInventory:
            self.wndInventory.Destroy()

to

if self.wndInventory:
            self.wndInventory.Hide()#fix
            self.wndInventory.Destroy()

Is it really that hard?

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
  • Not Good 1
  • Sad 1
  • Good 1
  • Love 1
Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.