From f2cea7719ca8265e4ac55189fc6401d78ed91cb7 Mon Sep 17 00:00:00 2001 From: Gloorf Date: Fri, 11 Sep 2015 17:43:09 +0200 Subject: [PATCH] Added a new way to report maps using ctrl+C --- README.md | 15 ++++++++++- config.ini | 5 +++- map_recorder.py | 66 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 50f6559..5ff0fc7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ A python script for Path Of Exile controlled by in game text input (it scans the * [global].log_path. The path to the logs/ folder (not the Client.txt file). * [map_recorder].send_data. Activated by default, sends data to my server for mass map data. * [map_recorder].output_path. The name of the .csv file where the data is stored +* [map_recorder].additional_iiq. Set it to your zana level For others values, the name should either be clear enough, or should be explicited in the comment before. @@ -35,7 +36,17 @@ You can add column after the 82, it won't be used. # Map recorder -## Example + +## Ctrl-C reporting + +I recommend using this method for regulars maps (ie no ambush/domination mods added with zana, no unID maps, no additionnal IIQ with sacrifice piece/rampage mod ...). It's better to use the manual reporting method for them. + +* Hover over the map and hit ctrl+C +* type "ms:" (or whatever keyword you defined) in chat. +* The script will take information from the clipboard, adn start a map according to that. It will also add the "additional_iiq" value from the config file. +* If there is info you can't get on the ctrl+c (IIQ from unID map, IIQ different because of sacrifice piece, ambush/domination mod from zana...), you can use the "medit:" command (see Available commands) + +## Manual reporting ``` ms:75,14,134,m #Map level 75, 14 pack size, 134 IIQ, with magic monsters. ml:76 #Got a level 76 map @@ -51,8 +62,10 @@ me:1 # You killed 1 boss on this maps * map note : (keyword)note. The note can be any size, comma will be removed though (to avoid breaking the .csv) ; multiples notes will be separated by a "|". Default keyword is **"mn:"** * map end : (keyword)[boss_killed]. You can omit boss_killed, in this case the default value in config.py will be used. Default keyword is **"me:"** * map abort : (keyword). Remove the last active map (if you made a mistake or whatever). Default keyword is **"ma:"** +* map edit : (keyword)admz[,iiq,psize]. Edit the last active map, replace the mods with whatever is in "amdz" (see map start for more information about mods). If IIQ/packsize exists, the current IIQ/packsize will be replaced by it. Default keyword is **"medit:"** # Advanced + ## Changing the keywords for action You need to look at the actions variable in the corresponding section in config.ini ([map_recorder] for example). Change simply the second value in the tuple by whatever you want. For example, if you want to use "map start:" as a keyword for starting the map, the line will be : ``` diff --git a/config.ini b/config.ini index ded344e..4e57c82 100644 --- a/config.ini +++ b/config.ini @@ -4,7 +4,7 @@ separator = , #Your characters names usernames = ["Glorf", "Faaee"] -log_path = C:/Program Files/Grinding Gear Games/Path of Exile/logs/ +log_path = /opt/pathofexile/drive_c/Program Files/Grinding Gear Games/Path of Exile/logs/ [handler] @@ -20,6 +20,8 @@ poetrade_url = #Number of boss killed by maps default_boss = 1 +#How much IIQ will be added on each map. If you don't use special zana mods (like rampage) or sacrifice piece, it's just your zana level +additional_iiq = 8 #Values are "" (the character name who wrote in local will be used), "anonymous" if you don't want to log it, or "Glorf"(any fixed username) if you want it to stay the same logged_username = output_path = map_data.csv @@ -29,6 +31,7 @@ actions = ("start", "ms:", "add_map") ("note", "mn:", "add_note") ("end", "me:", "end_map") ("abort", "ma:", "abort_map") + ("edit", "medit:", "edit_map") #Record options send_username = true #If disabled, you'll have to send the new data by using csv_sender.py diff --git a/map_recorder.py b/map_recorder.py index 02a1e4b..62c9fd3 100755 --- a/map_recorder.py +++ b/map_recorder.py @@ -17,9 +17,11 @@ #along with this program. If not, see from config import config as c import os +import re import time import inspect import util +import pyperclip from log import logger headers ="timestamp,character,level,pack size,IIQ,boss,ambush,beyond,domination,magic,zana,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,notes" @@ -57,6 +59,35 @@ def running(self): def add_map(self, msg, char_name): + #We get the information from the clipboard if the msg is empty + if not msg: + tmp = self.add_map_from_clipboard(msg, char_name) + else: + tmp = self.add_map_from_user_input(msg, char_name) + self.data.append(tmp) + logger.info("Started map, with level = {0}, psize = {1}, iiq = {2}, ambush = {5}, beyond = {3}, domination = {4}, magic = {6}, zana = {7}".format(tmp["level"], tmp["psize"], tmp["iiq"], tmp["beyond"], tmp["domination"], tmp["ambush"], tmp["magic"], tmp["zana"])) + + + def add_map_from_clipboard(self, msg, char_name): + info = pyperclip.paste() + regex_level = re.compile("Map Level: \d{2}") + regex_psize = re.compile("Monster Pack Size: \+\d{1,3}") + regex_quantity = re.compile("Item Quantity: \+\d{1,3}") + level = psize = quantity = 0 + magic = "more Magic Monsters" in info + if regex_level.search(info): + level = int(regex_level.findall(info)[0].replace("Map Level: ","")) + if regex_psize.search(info): + psize = int(regex_psize.findall(info)[0].replace("Monster Pack Size: +","")) + if regex_quantity.search(info): + quantity = int(regex_quantity.findall(info)[0].replace("Item Quantity: +","")) + quantity += int(c.get("map_recorder", "additional_iiq")) + tmp = {"character":char_name,"level":level, "psize":psize, "iiq":quantity, "ambush": False, "beyond": False,"domination": False, "magic": magic, "zana" : False, "boss":0, "loot":[], "note":[]} + return tmp + + + def add_map_from_user_input(self, msg, char_name): + #We want lvl,psize,iiq,[mods] info = msg.split(self.separator) #In case of user input error, assume empty while len(info) < 4: @@ -69,10 +100,37 @@ def add_map(self, msg, char_name): tmp["level"] = info[0] tmp["psize"] = info[1] tmp["iiq"] = info[2] - self.data.append(tmp) - logger.info("Started map, with level = {0}, psize = {1}, iiq = {2}, ambush = {5}, beyond = {3}, domination = {4}, magic = {6}, zana = {7}".format(tmp["level"], tmp["psize"], tmp["iiq"], tmp["beyond"], tmp["domination"], tmp["ambush"], tmp["magic"], tmp["zana"])) - - + return tmp + + def edit_map(self, msg): + #We want mods[,real_iiq,real_psize] + info = msg.split(self.separator) + log = "Edited map" + while len(info)< 3: + info.append("") + self.data[-1]["zana"] = "z" in info[0] + self.data[-1]["ambush"] = "a" in info[0] + self.data[-1]["domination"] = "d" in info[0] + self.data[-1]["magic"] = "m" in info[0] + if self.data[-1]["zana"]: + log +=", with Zana" + if self.data[-1]["ambush"]: + log +=", with Ambush" + if self.data[-1]["domination"]: + log +=", with Domination" + if self.data[-1]["magic"]: + log +=", with magic monsters" + #Remove non-digit from info (for real_iiq, real_psize) + info[1] = ''.join(filter(lambda x: x.isdigit(), info[1])) + info[2] = ''.join(filter(lambda x: x.isdigit(), info[2])) + if info[1]: + self.data[-1]["iiq"] = info[1] + log += ", with new IIQ " + info[1] + if info[2]: + self.data[-1]["psize"] = info[2] + log +=", with new Pack Size " + info[2] + logger.info(log) + def add_loot(self, msg): if len(self.data) > 0: info = [int(''.join(filter(lambda x: x.isdigit(), y))) for y in msg.split(self.separator)]