Jump to content

Recommended Posts

Hi guys, i have the following problem while i open, close and reopen fast an NPC.

https://metin2.download/video/GWzQl1MbMdI171BA12xzTULIc0XrHe3W/.mp4

Any ideas why this is happening?

 

Quote
import net
import player
import item
import snd
import shop
import net
import wndMgr
import app
import chat
import constInfo
import ui
import uiCommon
import mouseModule
import localeInfo

###################################################################################################
## Shop
class ShopDialog(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.tooltipItem = 0
		self.xShopStart = 0
		self.yShopStart = 0
		self.questionDialog = None
		self.popup = None
		self.itemBuyQuestionDialog = None
		if app.WJ_ENABLE_TRADABLE_ICON:
			self.interface = None

	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def __GetRealIndex(self, i):
		return self.tabIdx * shop.SHOP_SLOT_COUNT + i

	def Refresh(self):
		getItemID = shop.GetItemID
		getItemCount = shop.GetItemCount
		setItemID = self.itemSlotWindow.SetItemSlot

		# First clear all slot covers just in case (prevents ghost icons)
		for i in xrange(shop.SHOP_SLOT_COUNT):
			self.itemSlotWindow.SetSlotCoverImage(i, "")
			self.itemSlotWindow.EnableSlotCoverImage(i, False)

		# Then process and apply normally
		for i in xrange(shop.SHOP_SLOT_COUNT):
			idx = self.__GetRealIndex(i)
			itemCount = getItemCount(idx)
			if itemCount <= 1:
				itemCount = 0
			setItemID(i, getItemID(idx), itemCount)

			if app.BL_TRANSMUTATION_SYSTEM:
				changelookvnum = shop.GetItemChangeLookVnum(idx)
				if changelookvnum != 0:
					self.itemSlotWindow.SetSlotCoverImage(i, "icon/item/ingame_convert_Mark.tga")
					self.itemSlotWindow.EnableSlotCoverImage(i, True)  # explicitly enable

		wndMgr.RefreshSlot(self.itemSlotWindow.GetWindowHandle())

	def SetItemData(self, pos, itemID, itemCount, itemPrice):
		shop.SetItemData(pos, itemID, itemCount, itemPrice)

	def LoadDialog(self):
		try:
			PythonScriptLoader = ui.PythonScriptLoader()
			PythonScriptLoader.LoadScriptFile(self, "UIScript/shopdialog.py")
		except:
			import exception
			exception.Abort("ShopDialog.LoadDialog.LoadObject")

		smallTab1 = None
		smallTab2 = None
		smallTab3 = None
		xSmallTab1 = None
		xSmallTab2 = None
		xSmallTab3 = None
		xSmallTab4 = None
		middleTab1 = None
		middleTab2 = None

		try:
			GetObject = self.GetChild
			self.itemSlotWindow = GetObject("ItemSlot")
			self.btnBuy = GetObject("BuyButton")
			self.btnSell = GetObject("SellButton")
			self.btnClose = GetObject("CloseButton")
			self.titleBar = GetObject("TitleBar")
			middleTab1 = GetObject("MiddleTab1")
			middleTab2 = GetObject("MiddleTab2")
			smallTab1 = GetObject("SmallTab1")
			smallTab2 = GetObject("SmallTab2")
			smallTab3 = GetObject("SmallTab3")
			xSmallTab1 = GetObject("xSmallTab1")
			xSmallTab2 = GetObject("xSmallTab2")
			xSmallTab3 = GetObject("xSmallTab3")
			xSmallTab4 = GetObject("xSmallTab4")
		except:
			import exception
			exception.Abort("ShopDialog.LoadDialog.BindObject")

		self.itemSlotWindow.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
		self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EMPTY", self.SelectEmptySlot)
		self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EXIST", self.SelectItemSlot)
		self.itemSlotWindow.SAFE_SetButtonEvent("RIGHT", "EXIST", self.UnselectItemSlot)

		self.itemSlotWindow.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
		self.itemSlotWindow.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))

		self.btnBuy.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping))
		self.btnBuy.SetToggleDownEvent(ui.__mem_func__(self.OnBuy))

		self.btnSell.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping))
		self.btnSell.SetToggleDownEvent(ui.__mem_func__(self.OnSell))

		self.btnClose.SetEvent(ui.__mem_func__(self.AskClosePrivateShop))

		self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))

		self.xSmallRadioButtonGroup = ui.RadioButtonGroup.Create([
			[xSmallTab1, ui.__mem_func__(self.OnClickTabButton), None],
			[xSmallTab2, ui.__mem_func__(self.OnClickTabButton), None],
			[xSmallTab3, ui.__mem_func__(self.OnClickTabButton), None],
			[xSmallTab4, ui.__mem_func__(self.OnClickTabButton), None],
		])
		self.smallRadioButtonGroup = ui.RadioButtonGroup.Create([
			[smallTab1, ui.__mem_func__(self.OnClickTabButton), None],
			[smallTab2, ui.__mem_func__(self.OnClickTabButton), None],
			[smallTab3, ui.__mem_func__(self.OnClickTabButton), None]
		])
		self.middleRadioButtonGroup = ui.RadioButtonGroup.Create([
			[middleTab1, ui.__mem_func__(self.OnClickTabButton), None],
			[middleTab2, ui.__mem_func__(self.OnClickTabButton), None]
		])

		self.__HideMiddleTabs()
		self.__HideSmallTabs()
		self.__HideXSmallTabs()

		self.tabIdx = 0
		self.coinType = shop.SHOP_COIN_TYPE_GOLD

		self.Refresh()

	def __ShowBuySellButton(self):
		self.btnBuy.Show()
		self.btnSell.Show()

	def IsDlgQuestionShow(self):
		if self.questionDialog and self.questionDialog.IsShow():
			return True

		return False

	def ExternQuestionDialog_Close(self):
		self.OnCloseQuestionDialog()

	def __ShowMiddleTabs(self):
		self.middleRadioButtonGroup.Show()

	def __ShowSmallTabs(self):
		self.smallRadioButtonGroup.Show()

	def __ShowXSmallTabs(self):
		self.xSmallRadioButtonGroup.Show()

	def __HideBuySellButton(self):
		self.btnBuy.Hide()
		self.btnSell.Hide()

	def __HideMiddleTabs(self):
		self.middleRadioButtonGroup.Hide()

	def __HideSmallTabs(self):
		self.smallRadioButtonGroup.Hide()

	def __HideXSmallTabs(self):
		self.xSmallRadioButtonGroup.Hide()

	def __SetTabNames(self):
		if shop.GetTabCount() == 2:
			self.middleRadioButtonGroup.SetToolTipText(0, shop.GetTabName(0))
			self.middleRadioButtonGroup.SetToolTipText(1, shop.GetTabName(1))
			self.middleRadioButtonGroup.SetText(0, "I")
			self.middleRadioButtonGroup.SetText(1, "II")
		elif shop.GetTabCount() == 3:
			self.smallRadioButtonGroup.SetToolTipText(0, shop.GetTabName(0))
			self.smallRadioButtonGroup.SetToolTipText(1, shop.GetTabName(1))
			self.smallRadioButtonGroup.SetToolTipText(2, shop.GetTabName(2))
			self.smallRadioButtonGroup.SetText(0, "I")
			self.smallRadioButtonGroup.SetText(1, "II")
			self.smallRadioButtonGroup.SetText(2, "III")
		elif shop.GetTabCount() == 4:
			self.xSmallRadioButtonGroup.SetToolTipText(0, shop.GetTabName(0))
			self.xSmallRadioButtonGroup.SetToolTipText(1, shop.GetTabName(1))
			self.xSmallRadioButtonGroup.SetToolTipText(2, shop.GetTabName(2))
			self.xSmallRadioButtonGroup.SetToolTipText(3, shop.GetTabName(3))
			self.xSmallRadioButtonGroup.SetText(0, "I")
			self.xSmallRadioButtonGroup.SetText(1, "II")
			self.xSmallRadioButtonGroup.SetText(2, "III")
			self.xSmallRadioButtonGroup.SetText(3, "IV")
		# elif shop.GetTabCount() == 5:
			# self.xSmallRadioButtonGroup.SetToolTipText(0, shop.GetTabName(0))
			# self.xSmallRadioButtonGroup.SetToolTipText(1, shop.GetTabName(1))
			# self.xSmallRadioButtonGroup.SetToolTipText(2, shop.GetTabName(2))
			# self.xSmallRadioButtonGroup.SetToolTipText(3, shop.GetTabName(3))
			# self.xSmallRadioButtonGroup.SetToolTipText(4, shop.GetTabName(4))
			# self.xSmallRadioButtonGroup.SetText(0, "I")
			# self.xSmallRadioButtonGroup.SetText(1, "II")
			# self.xSmallRadioButtonGroup.SetText(2, "III")
			# self.xSmallRadioButtonGroup.SetText(3, "IV")
			# self.xSmallRadioButtonGroup.SetText(4, "V")
		# elif shop.GetTabCount() == 6:
			# self.xSmallRadioButtonGroup.SetToolTipText(0, shop.GetTabName(0))
			# self.xSmallRadioButtonGroup.SetToolTipText(1, shop.GetTabName(1))
			# self.xSmallRadioButtonGroup.SetToolTipText(2, shop.GetTabName(2))
			# self.xSmallRadioButtonGroup.SetToolTipText(3, shop.GetTabName(3))
			# self.xSmallRadioButtonGroup.SetToolTipText(4, shop.GetTabName(4))
			# self.xSmallRadioButtonGroup.SetToolTipText(5, shop.GetTabName(5))
			# self.xSmallRadioButtonGroup.SetText(0, "I")
			# self.xSmallRadioButtonGroup.SetText(1, "II")
			# self.xSmallRadioButtonGroup.SetText(2, "III")
			# self.xSmallRadioButtonGroup.SetText(3, "IV")
			# self.xSmallRadioButtonGroup.SetText(4, "V")
			# self.xSmallRadioButtonGroup.SetText(5, "VI")

	def Destroy(self):
		if app.WJ_ENABLE_TRADABLE_ICON:
			self.Close(True)
			self.interface = None
		else:
			self.Close()
		self.ClearDictionary()

		self.tooltipItem = 0
		self.itemSlotWindow = 0
		self.btnBuy = 0
		self.btnSell = 0
		self.btnClose = 0
		self.titleBar = 0
		self.questionDialog = None
		self.popup = None

	def Open(self, vid):
		isPrivateShop = False
		isMainPlayerPrivateShop = False

		import chr
		if chr.IsNPC(vid):
			isPrivateShop = False
		else:
			isPrivateShop = True

		if player.IsMainCharacterIndex(vid):
			isMainPlayerPrivateShop = True

			self.btnBuy.Hide()
			self.btnSell.Hide()
			self.btnClose.Show()
		else:
			isMainPlayerPrivateShop = False

			self.btnBuy.Show()
			self.btnSell.Show()
			self.btnClose.Hide()

		shop.Open(isPrivateShop, isMainPlayerPrivateShop)

		self.tabIdx = 0

		if isPrivateShop:
			self.__HideMiddleTabs()
			self.__HideSmallTabs()
		else:
			if shop.GetTabCount() == 1:
				self.__ShowBuySellButton()
				self.__HideMiddleTabs()
				self.__HideSmallTabs()
				self.__HideXSmallTabs()
			elif shop.GetTabCount() == 2:
				self.__HideBuySellButton()
				self.__ShowMiddleTabs()
				self.__HideSmallTabs()
				self.__HideXSmallTabs()
				self.__SetTabNames()
				#Fix for tabs
				self.smallRadioButtonGroup.OnClick(0)
			elif shop.GetTabCount() == 3:
				self.__HideBuySellButton()
				self.__HideMiddleTabs()
				self.__ShowSmallTabs()
				self.__HideXSmallTabs()
				self.__SetTabNames()
				#Fix for tabs
				self.smallRadioButtonGroup.OnClick(0) # @fixme002 (middleRadioButtonGroup(1) -> smallRadioButtonGroup(0))
			elif shop.GetTabCount() == 4:
				self.__HideBuySellButton()
				self.__HideMiddleTabs()
				self.__HideSmallTabs()
				self.__ShowXSmallTabs()
				self.__SetTabNames()
				self.xSmallRadioButtonGroup.OnClick(0)

		self.Refresh()
		self.SetTop()
		self.Show()

		(self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()
		if app.WJ_ENABLE_TRADABLE_ICON:
			if not isPrivateShop:
				self.interface.SetOnTopWindow(player.ON_TOP_WND_SHOP)
				self.interface.RefreshMarkInventoryBag()

	if app.WJ_ENABLE_TRADABLE_ICON and app.EXTEND_SHOP_ITEMS:
		def Close(self, isDestroy=False):
			self.interface.SetOnTopWindow(player.ON_TOP_WND_NONE)
			if not isDestroy:
				self.interface.RefreshMarkInventoryBag()

			if self.itemBuyQuestionDialog:
				self.itemBuyQuestionDialog.Close()
				self.itemBuyQuestionDialog = None
				constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)

			self.OnCloseQuestionDialog()
			shop.Close()
			net.SendShopEndPacket()
			self.CancelShopping()
			# self.tooltipItem.HideToolTip()
			self.Hide()
	else:
		def Close(self):
			if self.itemBuyQuestionDialog:
				self.itemBuyQuestionDialog.Close()
				self.itemBuyQuestionDialog = None
				constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)

			self.OnCloseQuestionDialog()
		shop.Close()
		net.SendShopEndPacket()
		self.CancelShopping()
		self.tooltipItem.HideToolTip()
		self.Hide()

	def GetIndexFromSlotPos(self, slotPos):
		return self.tabIdx * shop.SHOP_SLOT_COUNT + slotPos

	def OnClickTabButton(self, idx):
		self.tabIdx = idx
		self.Refresh()

	def AskClosePrivateShop(self):
		questionDialog = uiCommon.QuestionDialog()
		questionDialog.SetText(localeInfo.PRIVATE_SHOP_CLOSE_QUESTION)
		questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnClosePrivateShop))
		questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
		questionDialog.Open()
		self.questionDialog = questionDialog

		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)

		return True

	def OnClosePrivateShop(self):
		net.SendChatPacket("/close_shop")
		self.OnCloseQuestionDialog()
		return True

	def OnPressEscapeKey(self):
		self.Close()
		return True

	def OnPressExitKey(self):
		self.Close()
		return True

	def OnBuy(self):
		chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
		app.SetCursor(app.BUY)
		self.btnSell.SetUp()

	def OnSell(self):
		chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_SELL_INFO)
		app.SetCursor(app.SELL)
		self.btnBuy.SetUp()

	def CancelShopping(self):
		self.btnBuy.SetUp()
		self.btnSell.SetUp()
		app.SetCursor(app.NORMAL)

	def __OnClosePopupDialog(self):
		self.pop = None
		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)

	def SellAttachedItem(self):

		if shop.IsPrivateShop():
			mouseModule.mouseController.DeattachObject()
			return

		attachedSlotType = mouseModule.mouseController.GetAttachedType()
		attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
		attachedCount = mouseModule.mouseController.GetAttachedItemCount()
		attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()

		if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:

			item.SelectItem(attachedItemIndex)

			if item.IsAntiFlag(item.ANTIFLAG_SELL):
				popup = uiCommon.PopupDialog()
				popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
				popup.SetAcceptEvent(self.__OnClosePopupDialog)
				popup.Open()
				self.popup = popup
				return

			itemtype = player.INVENTORY

			if player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:
				itemtype = player.DRAGON_SOUL_INVENTORY

			if player.IsValuableItem(itemtype, attachedSlotPos):

				itemPrice = item.GetISellItemPrice()

				if item.Is1GoldItem():
					itemPrice = attachedCount / itemPrice
				else:
					itemPrice = itemPrice * max(1, attachedCount)

				if not app.ENABLE_NO_SELL_PRICE_DIVIDED_BY_5:
					itemPrice /= 5

				itemName = item.GetItemName()

				questionDialog = uiCommon.QuestionDialog()
				questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount, itemPrice))

				questionDialog.SetAcceptEvent(lambda arg1=attachedSlotPos, arg2=attachedCount, arg3 = itemtype: self.OnSellItem(arg1, arg2, arg3))
				questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
				questionDialog.Open()
				self.questionDialog = questionDialog

				constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)

			else:
				self.OnSellItem(attachedSlotPos, attachedCount, itemtype)

		else:
			snd.PlaySound("sound/ui/loginfail.wav")

		mouseModule.mouseController.DeattachObject()

	def OnSellItem(self, slotPos, count):
		net.SendShopSellPacketNew(slotPos, count)
		snd.PlaySound("sound/ui/money.wav")
		self.OnCloseQuestionDialog()

	def OnCloseQuestionDialog(self):
		if not self.questionDialog:
			return

		self.questionDialog.Close()
		self.questionDialog = None
		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
		
	def SelectEmptySlot(self, selectedSlotPos):

		isAttached = mouseModule.mouseController.isAttached()
		if isAttached:
			self.SellAttachedItem()

	def UnselectItemSlot(self, selectedSlotPos):
		if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
			return
		if shop.IsPrivateShop():
			self.AskBuyItem(selectedSlotPos)
		else:
			net.SendShopBuyPacket(self.__GetRealIndex(selectedSlotPos))

	def SelectItemSlot(self, selectedSlotPos):
		if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
			return

		isAttached = mouseModule.mouseController.isAttached()
		selectedSlotPos = self.__GetRealIndex(selectedSlotPos)
		if isAttached:
			self.SellAttachedItem()

		else:

			if True == shop.IsMainPlayerPrivateShop():
				return

			curCursorNum = app.GetCursor()
			if app.BUY == curCursorNum:
				self.AskBuyItem(selectedSlotPos)

			elif app.SELL == curCursorNum:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_SELL_INFO)

			else:
				selectedItemID = shop.GetItemID(selectedSlotPos)
				itemCount = shop.GetItemCount(selectedSlotPos)

				type = player.SLOT_TYPE_SHOP
				if shop.IsPrivateShop():
					type = player.SLOT_TYPE_PRIVATE_SHOP

				mouseModule.mouseController.AttachObject(self, type, selectedSlotPos, selectedItemID, itemCount)
				mouseModule.mouseController.SetCallBack("INVENTORY", ui.__mem_func__(self.DropToInventory))
				snd.PlaySound("sound/ui/pick.wav")

	def DropToInventory(self):
		attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
		self.AskBuyItem(attachedSlotPos)

	def AskBuyItem(self, slotPos):
		slotPos = self.__GetRealIndex(slotPos)

		itemIndex = shop.GetItemID(slotPos)
		itemPrice = shop.GetItemPrice(slotPos)
		if app.ENABLE_CHEQUE_SYSTEM:
			itemCheque = shop.GetItemCheque(slotPos)
		itemCount = shop.GetItemCount(slotPos)

		item.SelectItem(itemIndex)
		itemName = item.GetItemName()

		if itemPrice == 0 and itemCheque == 0:
			itemBuyQuestionDialog = uiCommon.QuestionDialogDemo()
			itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_DEMO % (itemName))
			itemBuyQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerBuyItem(arg))
			itemBuyQuestionDialog.Open()
			itemBuyQuestionDialog.pos = slotPos
			self.itemBuyQuestionDialog = itemBuyQuestionDialog
		else:
			itemBuyQuestionDialog = uiCommon.QuestionDialog()
			if app.ENABLE_CHEQUE_SYSTEM:
				if itemCheque > 0 and itemPrice <=0:
					itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM_CHEQUE_SIN_YANG(itemName, itemCount, localeInfo.NumberToCheque(itemCheque)))
				elif itemCheque <= 0 and itemPrice > 0:
					itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToGoldNotText(itemPrice)))
				elif itemCheque > 0 and itemPrice > 0:
					itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM_YANG_CHEQUE(itemName, itemCount, localeInfo.NumberToGoldNotText(itemPrice),localeInfo.NumberToGoldNotText(itemCheque) ))
			else:
				itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))

			itemBuyQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerBuyItem(arg))
			itemBuyQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerBuyItem(arg))
			itemBuyQuestionDialog.Open()
			itemBuyQuestionDialog.pos = slotPos
			self.itemBuyQuestionDialog = itemBuyQuestionDialog

			constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)

	def AnswerBuyItem(self, flag):

		if flag:
			pos = self.itemBuyQuestionDialog.pos
			net.SendShopBuyPacket(pos)

		self.itemBuyQuestionDialog.Close()
		self.itemBuyQuestionDialog = None

		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
	def SetItemToolTip(self, tooltipItem):
		self.tooltipItem = tooltipItem

	def OverInItem(self, slotIndex):
		slotIndex = self.__GetRealIndex(slotIndex)
		if mouseModule.mouseController.isAttached():
			return

		if self.tooltipItem:
			if app.ENABLE_RENEWAL_SHOPEX:
				PriceType = shop.GetItemPriceType(slotIndex)
				if PriceType == shop.SHOPEX_GOLD:
					self.tooltipItem.SetShopItem(slotIndex)
				elif PriceType == shop.SHOPEX_SECONDCOIN:
					self.tooltipItem.SetShopItemBySecondaryCoin(slotIndex)
				else:
					self.tooltipItem.SetShopItemByShopEx(slotIndex, PriceType)
			else:
				if shop.SHOP_COIN_TYPE_GOLD == shop.GetTabCoinType(self.tabIdx):
					self.tooltipItem.SetShopItem(slotIndex)
				else: 
					self.tooltipItem.SetShopItemBySecondaryCoin(slotIndex)

	def OverOutItem(self):
		if 0 != self.tooltipItem:
			self.tooltipItem.HideToolTip()

	def BindInterface(self, interface):
		from _weakref import proxy
		self.interface = proxy(interface)

	def OnUpdate(self):

		USE_SHOP_LIMIT_RANGE = 1000

		(x, y, z) = player.GetMainCharacterPosition()
		if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE:
			self.Close()

	if app.WJ_ENABLE_TRADABLE_ICON:
		def BindInterface(self, interface):
			self.interface = interface

		def OnTop(self):
			if not shop.IsPrivateShop():
				self.interface.SetOnTopWindow(player.ON_TOP_WND_SHOP)
				self.interface.RefreshMarkInventoryBag()

class MallPageDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)

	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def Destroy(self):
		self.ClearDictionary()

	def Open(self):
		scriptLoader = ui.PythonScriptLoader()
		scriptLoader.LoadScriptFile(self, "uiscript/mallpagedialog.py")

		self.GetChild("titlebar").SetCloseEvent(ui.__mem_func__(self.Close))

		(x, y)=self.GetGlobalPosition()
		x+=10
		y+=30

		MALL_PAGE_WIDTH = 600
		MALL_PAGE_HEIGHT = 480

		app.ShowWebPage(
			"http://metin2.co.kr/08_mall/game_mall/login_fail.htm",
			(x, y, x+MALL_PAGE_WIDTH, y+MALL_PAGE_HEIGHT))

		self.Lock()
		self.Show()
		
	def Close(self):			
		app.HideWebPage()
		self.Unlock()
		self.Hide()
		
	def OnPressEscapeKey(self):
		self.Close()
		return True

 

GameType.h / binary:
 

Quote
typedef struct packet_shop_item
{
	DWORD		vnum;
	// DWORD		price;
	long long	price;
#ifdef ENABLE_CHEQUE_SYSTEM
	DWORD		cheque;
#endif

	BYTE		count;

	BYTE		display_pos;
	long		alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
	TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
#if defined(__BL_TRANSMUTATION__)
	DWORD		dwTransmutationVnum = 0;
#endif
#if defined(ENABLE_RENEWAL_SHOPEX)
	BYTE 	price_type;
	DWORD 	price_vnum;
#endif
} TShopItemData;

 


Packet.h / binary:
 

Quote
typedef struct SShopItemTable
{
	DWORD		vnum;
	BYTE		count;

	TItemPos	pos;
	// DWORD		price;
	long long	price;
#ifdef ENABLE_CHEQUE_SYSTEM
	DWORD		cheque;
#endif
	BYTE		display_pos;
#if defined(ENABLE_RENEWAL_SHOPEX)
	long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
	TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
	BYTE 	price_type;
	DWORD 	price_vnum;
	SShopItemTable() : price_type(SHOPEX_GOLD), price_vnum(0) {
		memset(&alSockets, 0, sizeof(alSockets));
		memset(&aAttr, 0, sizeof(aAttr));
	}
#endif
} TShopItemTable;

 


tables.h
 

Quote
typedef struct SShopItemTable
{
	DWORD		vnum;
	BYTE		count;

	TItemPos	pos;
	// DWORD		price;
	long long	price;
#ifdef ENABLE_CHEQUE_SYSTEM
	DWORD		cheque;
#endif
	BYTE		display_pos;
#if defined(ENABLE_RENEWAL_SHOPEX)
	long	alSockets[ITEM_SOCKET_MAX_NUM];
	TPlayerItemAttribute	aAttr[ITEM_ATTRIBUTE_MAX_NUM];
	BYTE 	price_type;
	DWORD 	price_vnum;
	SShopItemTable() : price_type(SHOPEX_GOLD), price_vnum(0) {
		memset(&alSockets, 0, sizeof(alSockets));
		memset(&aAttr, 0, sizeof(aAttr));
	}
#endif
} TShopItemTable;

typedef struct SShopTable
{
	DWORD		dwVnum;
	DWORD		dwNPCVnum;

	BYTE		byItemCount;
	TShopItemTable	items[SHOP_HOST_ITEM_MAX_NUM];
#if defined(ENABLE_RENEWAL_SHOPEX)
	char szShopName[SHOP_TAB_NAME_MAX + 1];
#endif
} TShopTable;

 

packet.h / server src:
 

Quote
struct packet_shop_item
{
	DWORD		vnum;
	// DWORD		price;
	long long	price;
#ifdef ENABLE_CHEQUE_SYSTEM
	DWORD		cheque;
#endif
	BYTE		count;
	BYTE		display_pos;
	long		alSockets[ITEM_SOCKET_MAX_NUM];
	TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
#if defined(__BL_TRANSMUTATION__)
	DWORD		dwTransmutationVnum;
#endif
#if defined(ENABLE_RENEWAL_SHOPEX)
	BYTE 	price_type;
	DWORD 	price_vnum;
	packet_shop_item() : price_type(SHOPEX_GOLD), price_vnum(0) {
		memset(&alSockets, 0, sizeof(alSockets));
		memset(&aAttr, 0, sizeof(aAttr));
	}
#endif
};

 

 

Edited by Metin2 Dev International
Core X - External 2 Internal

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/33888-shopex-renewal-problem/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.