Jump to content

Interface object has no attribute 'game'


Recommended Posts

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.")

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

	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)

 

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.