Jump to content
  • 0
Sign in to follow this  
markx202

open Interface object has no attribute 'game'

Question

Hi guys!

I have a problem:

0904 22:09:25493 :: Traceback (most recent call last):

0904 22:09:25494 ::   File "networkModule.py", line 239, in SetGamePhase

0904 22:09:25494 ::   File "game.py", line 111, in __init__

0904 22:09:25494 ::   File "interfaceModule.py", line 353, in MakeInterface

0904 22:09:25494 ::   File "interfaceModule.py", line 192, in __MakeWindows

0904 22:09:25494 :: AttributeError
0904 22:09:25494 :: : 
0904 22:09:25494 :: 'Interface' object has no attribute 'game'
0904 22:09:25494 :: 

Can someone help me?

 

I've done this:

 

game.py

import uirarityrefine

#Before self.__ServerCommand_Build()

self.wndRR = uirarityrefine.RefineRarityWindow()
self.wndRR.SetItemToolTip(self.interface.tooltipItem)

#After "PlayMusic"				: self.__PlayMusic,

"REFINE_Rarity"				: self.RefineRarity,
"RarityRefine_Success"		: self.RarityRefine_Success,
"RarityRefine_NeedItem"		: self.RarityRefine_NeedItem,
"RarityRefine_Fail"			: self.RarityRefine_Fail,

#AT THE END

def RefineRarity(self, evo):
	self.wndRR.Open(evo)
		
def RarityRefine_Success(self):
	self.wndRR.SuccessMessage()

def RarityRefine_NeedItem(self, code):
	self.wndRR.NeedItem(code)

def RarityRefine_Fail(self):
	self.wndRR.Failed()

 

interfacemodule.py

#After 	
def __MakeWindows(self):
		[..]
		wndInventory.BindInterfaceClass(self)
#I put
wndInventory.BindGameClass(self.game)

#Before
if __name__ == "__main__":
#I put
	def BindGameWindow(self, game):
		self.game = game

 

uiinventory.py

#Before def UseItemSlot(self, slotIndex):
#I put 
	def BindGameClass(self, game):
		self.game = game

#After slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
#I put 
		if (self.game is not None and self.game.wndRR.IsShow()):
			self.game.wndRR.UseItemSlot(player.INVENTORY, slotIndex)
			return

#After def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
#I put
		if srcItemVID == 11115:
			item.SelectItem(player.GetItemIndex(dstItemSlotPos))
			if item.GetItemType() == item.ITEM_TYPE_WEAPON:
				self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
				self.game.wndRR.UseItemSlot(player.INVENTORY,dstItemSlotPos,True)
			else:
				chat.AppendChat(1,"<Sistem> Item is not a weapon.")

 

Share this post


Link to post

10 answers to this question

Recommended Posts

  • 0

You are missing the declaration of

self.game = None

Search

	def __init__(self):

and add the missing code inside it

Share this post


Link to post
  • 0
10 minutes ago, Fire said:

You are missing the declaration of


self.game = None

Search


	def __init__(self):

and add the missing code inside it

Done and now i have this one!

0905 11:59:25425 :: Traceback (most recent call last):

0905 11:59:25425 ::   File "ui.py", line 1962, in OnSelectItemSlot

0905 11:59:25425 ::   File "ui.py", line 88, in __call__

0905 11:59:25425 ::   File "ui.py", line 79, in __call__

0905 11:59:25425 ::   File "uiInventory.py", line 823, in SelectItemSlot

0905 11:59:25425 ::   File "uiInventory.py", line 894, in __DropSrcItemToDestItemInInventory

0905 11:59:25425 :: AttributeError
0905 11:59:25425 :: : 
0905 11:59:25425 :: 'InventoryWindow' object has no attribute 'wndRR'
0905 11:59:25425 :: 

 

And if i add self.wndRR = None in __init__ on inventorywindow 

i have this one:

0905 12:01:20686 :: Traceback (most recent call last):

0905 12:01:20686 ::   File "ui.py", line 1962, in OnSelectItemSlot

0905 12:01:20686 ::   File "ui.py", line 88, in __call__

0905 12:01:20686 ::   File "ui.py", line 79, in __call__

0905 12:01:20686 ::   File "uiInventory.py", line 825, in SelectItemSlot

0905 12:01:20686 ::   File "uiInventory.py", line 896, in __DropSrcItemToDestItemInInventory

0905 12:01:20686 :: AttributeError
0905 12:01:20686 :: : 
0905 12:01:20686 :: 'NoneType' object has no attribute 'UseItemSlot'
0905 12:01:20686 :: 

 

However thanks for answer me! I really appreciate that.

  • Love 1

Share this post


Link to post
  • 0

Can you share this function?

__DropSrcItemToDestItemInInventory

 

Share this post


Link to post
  • 0
	def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
		if srcItemSlotPos == dstItemSlotPos:
			return

		if app.RARITY_SYSTEM:
			if srcItemVID == 71053 or srcItemVID == 30741:
				self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)

		if item.IsRefineScroll(srcItemVID):
			if self.__isSameItem(srcItemVID,dstItemSlotPos): # bugfix!
				self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
			else:
				self.RefineItem(srcItemSlotPos, dstItemSlotPos)
				self.wndItem.SetUseMode(False)

		if srcItemVID == 11115:
			item.SelectItem(player.GetItemIndex(dstItemSlotPos))
			if item.GetItemType() == item.ITEM_TYPE_WEAPON:
				self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
				self.game.wndRR.UseItemSlot(player.INVENTORY,dstItemSlotPos,True)
			else:
				chat.AppendChat(1,"This is not a weapon.")

		# cyh itemseal 2013 11 08
		elif app.ENABLE_SOULBIND_SYSTEM and item.IsSealScroll(srcItemVID):
			self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)

		elif item.IsMetin(srcItemVID):
			self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)

		elif item.IsDetachScroll(srcItemVID):
			self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)

		elif item.IsKey(srcItemVID):
			self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)

		elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
			self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)

		elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
			self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)

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

			## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
			if player.IsEquipmentSlot(dstItemSlotPos):

				## 들고 있는 아이템이 장비일때만
				if item.IsEquipmentVID(srcItemVID):
					self.__UseItem(srcItemSlotPos)

			else:
				self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
				#net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)

 

Share this post


Link to post
  • 0

As I can see uirarityrefine.py doesn't got 

UseItemSlot

function. You have to add it on uirarityrefine.py and adapt it to the file.

Feel free to share uirarityrefine and I'll try to reach the solution😁

Share this post


Link to post
  • 0

self.wndRR is looks like not initialized, probably you placed;

self.wndRR = uirarityrefine.RefineRarityWindow()
self.wndRR.SetItemToolTip(self.interface.tooltipItem)

lines to wrong function

  • Love 1

Share this post


Link to post
  • 0

I put:

        self.wndRR = uirarityrefine.RefineRarityWindow()
        self.wndRR.SetItemToolTip(self.interface.tooltipItem)

to

 image.png.701169e87423236a102e0041f27e6292.png

Share this post


Link to post
  • 0

self.wndRR func is used in uiinventory not in game

Share this post


Link to post
  • 0
28 minutes ago, Koray said:

self.wndRR func is used in uiinventory not in game

Yes but if i put self.wndRR = uirarityrefine.RefineWindow() in __init__ function on InventoryWindow class client generate a syserr with NoneType has no attribute 'wndRR'

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    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.