def AttachMoney(self, owner, type, count): self.LastAttachedSlotNumber = self.AttachedSlotNumber self.AttachedFlag = True self.AttachedOwner = owner self.AttachedType = type self.AttachedSlotNumber = -1 self.AttachedItemIndex = player.ITEM_MONEY self.AttachedCount = count self.AttachedIconHandle = grpImage.Generate("icon/item/money.tga") self.AttachedIconHalfWidth = grpImage.GetWidth( self.AttachedIconHandle) / 2 self.AttachedIconHalfHeight = grpImage.GetHeight( self.AttachedIconHandle) / 2 wndMgr.AttachIcon(self.AttachedType, self.AttachedItemIndex, self.AttachedSlotNumber, 1, 1) if count > 1: self.countNumberLine.SetNumber(str(count)) self.countNumberLine.Show()
def AttachObject(self, Owner, Type, SlotNumber, ItemIndex, count=0): self.LastAttachedSlotNumber = self.AttachedSlotNumber self.AttachedFlag = True self.AttachedOwner = Owner self.AttachedType = Type self.AttachedSlotNumber = SlotNumber self.AttachedItemIndex = ItemIndex self.AttachedCount = count self.countNumberLine.SetNumber("") self.countNumberLine.Hide() if count > 1: self.countNumberLine.SetNumber(str(count)) self.countNumberLine.Show() try: width = 1 height = 1 if Type == player.SLOT_TYPE_INVENTORY or\ Type == player.SLOT_TYPE_PRIVATE_SHOP or\ Type == player.SLOT_TYPE_SHOP or\ Type == player.SLOT_TYPE_SAFEBOX or\ Type == player.SLOT_TYPE_MALL or\ Type == player.SLOT_TYPE_DRAGON_SOUL_INVENTORY: item.SelectItem(self.AttachedItemIndex) self.AttachedIconHandle = item.GetIconInstance() if not self.AttachedIconHandle: self.AttachedIconHandle = 0 self.DeattachObject() return (width, height) = item.GetItemSize() elif Type == player.SLOT_TYPE_SKILL: skillGrade = player.GetSkillGrade(SlotNumber) self.AttachedIconHandle = skill.GetIconInstanceNew( self.AttachedItemIndex, skillGrade) elif Type == player.SLOT_TYPE_EMOTION: image = player.GetEmotionIconImage(ItemIndex) self.AttachedIconHandle = grpImage.GenerateFromHandle(image) elif Type == player.SLOT_TYPE_QUICK_SLOT: (quickSlotType, position) = player.GetGlobalQuickSlot(SlotNumber) if quickSlotType == player.SLOT_TYPE_INVENTORY: itemIndex = player.GetItemIndex(position) item.SelectItem(itemIndex) self.AttachedIconHandle = item.GetIconInstance() (width, height) = item.GetItemSize() elif quickSlotType == player.SLOT_TYPE_SKILL: skillIndex = player.GetSkillIndex(position) skillGrade = player.GetSkillGrade(position) self.AttachedIconHandle = skill.GetIconInstanceNew( skillIndex, skillGrade) elif quickSlotType == player.SLOT_TYPE_EMOTION: image = player.GetEmotionIconImage(position) self.AttachedIconHandle = grpImage.GenerateFromHandle( image) if not self.AttachedIconHandle: self.DeattachObject() return self.AttachedIconHalfWidth = grpImage.GetWidth( self.AttachedIconHandle) / 2 self.AttachedIconHalfHeight = grpImage.GetHeight( self.AttachedIconHandle) / 2 self.AttachedIconHalfWidth = grpImage.GetWidth( self.AttachedIconHandle) / 2 self.AttachedIconHalfHeight = grpImage.GetHeight( self.AttachedIconHandle) / 2 wndMgr.AttachIcon(self.AttachedType, self.AttachedItemIndex, self.AttachedSlotNumber, width, height) except Exception, e: dbg.TraceError("mouseModule.py: AttachObject : " + str(e)) self.AttachedIconHandle = 0