class Plugin(GUIClass): """ LOTROAssist loot bag plugin class """ metadata={ 'PLUGIN_NAME': 'Loot Bag', 'PLUGIN_CODENAME': 'lootbag', 'PLUGIN_VERSION': '0.1', 'PLUGIN_DESC': 'Lord Of The Rings Online Assistant plugin for loot counting', 'PLUGIN_COPYRIGHT': '(C) 2010 Oliver Gutiérrez <*****@*****.**>', 'PLUGIN_WEBSITE': 'http://www.evosistemas.com', 'PLUGIN_DOCK': 'lists', } def initialize(self): """ Initialization function """ self.lootbag=TreeViewFactory('list', ['int','str'], ['Items','Item Name',], treeview=self.widgets.tvLootBag) self.itemregexp=re.compile(r'You have acquired .*\[(?P<items>\d*\s)*(?P<name>.*)\]\.$') self.itemremregexp=re.compile(r'Item Removed: \[(?P<items>\d*\s)*(?P<name>.*)\].$') # TODO: lotroassist: purchased and sold items def copyItems(self,widget): """ Copy loot bag items to clipboard """ clipboard=gtk.Clipboard() # Get stored data data=self.lootbag.getData() # Copy data to clipboard textdata='' for row in data: textdata+='%s x %s\n' % tuple(row) if textdata: clipboard.set_text('Loot Bag\n' + textdata) def removeItem(self,widget): """ Remove selected item """ self.lootbag.remove() def clearItems(self,widget): """ Clears item list """ self.lootbag.clear() def newLine(self,line): """ New line analysing function """ return (self.gotItem(line) or self.lostItem(line)) def gotItem(self,line): """ Check if line is a item line and process it """ # Analyze log line resp=self.itemregexp.search(line) if resp: # Get line information items=resp.group('items') itemname=resp.group('name') if not items: items=1 else: items=int(items) # Check if we have adquired the item before item=self.lootbag.getRow(itemname,1) if item: self.lootbag.update(itemname,[item[0]+items],1) else: # Add the new quest to tree view self.lootbag.append([items,itemname]) return True def lostItem(self,line): """ Check if line is a item removing line and process it """ # Analyze log line resp=self.itemremregexp.search(line) if resp: # Get line information items=resp.group('items') itemname=resp.group('name') if not items: items=1 else: items=int(items) # Check if we have adquired the item before item=self.lootbag.getRow(itemname,1) if item and item[0]>0: self.lootbag.update(itemname,[item[0]-items],1) return True
class Plugin(GUIClass): """ LOTROAssist Combat stats plugin class """ metadata={ 'PLUGIN_NAME': 'Combat stats', 'PLUGIN_CODENAME': 'combatstats', 'PLUGIN_VERSION': '0.1', 'PLUGIN_DESC': 'Lord Of The Rings Online Assistant plugin for combat stats', 'PLUGIN_COPYRIGHT': '(C) 2010 Oliver Gutiérrez <*****@*****.**>', 'PLUGIN_WEBSITE': 'http://www.evosistemas.com', 'PLUGIN_DOCK': 'main', } def initialize(self): """ Initialization function """ self.damagedeal=TreeViewFactory('list', ['str','int','int','int','int'], ['Attack Skill','Hits','Average','Max','Total'], treeview=self.widgets.tvDamageDeal) self.dealregexp=re.compile(r'You wound the (?P<mob>.*) (with (?P<attack>.*))* for (?P<damage>\d*) points of (?P<type>.*)\.$') # You wound the Snarling Overseer with Retaliation for 370 points of Common damage. # You wound the Snarling Overseer for 305 points of Common damage. def clearStats(self,widget): """ Clear combat stats """ pass def newLine(self,line): """ New line analysing function """ # Analyze log line return self.damageDeal(line) def damageDeal(self,line): """ Check if line is a damage dealing line """ # Analyze log line resp=self.dealregexp.search(line) if resp: # Get line information # 'Attack','Used','Max damage','Total damage' mob=resp.group('mob') attack=resp.group('attack') damage=int(resp.group('damage')) type=resp.group('type') if not attack: attack='Unknown Attack' # Check if we have set this attack row=self.damagedeal.getRow(attack,0) if row: self.damagedeal.update(attack,[attack,row[1]+1,(row[2]+damage)/2,row[3]>damage and row[3] or damage,row[4]+damage],0) else: # Add the new quest to tree view self.damagedeal.append([attack,1,damage,damage,damage]) return True