arcdps: gw2 dps meter (and general metrics tool)
 WARNING: MODIFYING GUILD WARS 2 THROUGH ANY 3RD PARTY TOOLS IS NOT SUPPORTED BY ARENANET OR NCSOFT.
 THERE IS NO HELP OR WARRANTY. THIS IS ENTIRELY AT YOUR OWN RISK AND YOU ASSUME ALL RESPONSIBILITY
 FOR USING THIS TOOL
.
 stance: https://forum-en.guildwars2.com/forum/support/support/Policy-3rd-Party-Programs-Multi-Boxing-Macros/first#post354869.
 user agreement: https://www.guildwars2.com/en/legal/guild-wars-2-user-agreement/
 rules of conduct: https://www.guildwars2.com/en/legal/guild-wars-2-rules-of-conduct/
 latest ama: https://www.reddit.com/r/Guildwars2/comments/5svug8/the_head_of_the_snake_devs_here_ask_us_anything/ddi77u2/
 another explicit what is allowed clarification (and good thread to read): https://www.reddit.com/r/Guildwars2/comments/66m13h/anet_this_really_should_be_part_of_the_game/dgjwapj/

** https://www.reddit.com/r/Guildwars2/comments/60t7pq/bgdm_isnt_actually_anet_compliant/ apparently "remove gearcheck" means "hide behind ini key and share with my friends and guild".
** a good estimation is within a couple %. same with different pov. higher should be reported as a bug, including skill total screenshots for personal vs area + encounter.

how does it work
 arcdps jmp hooks several gw2 engine routines to "expose" temporal data not available by reads or vt hooks or detours.
 what that means is that it modifies the engine to provide me my own mod framework, making it most definitely not user agreement friendly.
 however, in the latest ama, arenanet has granted 3rd party tools permission to obtain and display combat data and combat data only via means previously not allowed.
 if you feel this mod provides any advantage over other players do not use this.
 these are runtime modifications only, no changes are made to gw2 files on disk.

what does it do/features
 personal stat totals and skill itemization stats (damage and healing) (img)
 area stat totals and skill itemization (damage only) for party and squad in visual range (img)
 area buff volume and itemization (img)
 detailed individual skill stats (img)
 configurable summary for characters (img)
 configurable stat time interval (img)
 history keeping for every stat panel, browsable on the fly (img)
 detailed logging (img)
 log saving on a configurable list of bosses, with parsers available.
 on-demand engine native naming (joint effort with bhagawan/bgdm).

how do i use it
 don't be a dick.
 save d3d9.dll into 'guildwars2installdir/bin64/' with the other dlls.
 arcpds.ini will be created in documents/arcdps/ on first run, ini options template can be found in the download folder to override some defaults.
 alternatively, create folder "arcdps" under %appdata%/roaming/ - if found, all configuration and containers will be loaded from there.
 all template ini options are commented to let me adjust their defaults - make sure to uncomment to override.
 for languages other than english, place translation ini alongside regular ini.
 character model limit should be set to highest for best results.
 alt shift t is the hotkey to bring up the options window.
 never send in crash reports or post about client crashes/bugs on the forums while using this.
 to update, just replace the dll with the newest.
 to reset to a "fresh start" state, exit gw2 and delete everything with arcdps.* in the name and replace the ini with the template.
 to disable/remove it, exit gw2 and rename/delete the dll, and optionally delete everything with arcdps.* in the name.

what is the forbidden fruit
 a collection of qol that should be harmless to every other player and provide no advantage for the user, but is still against the rules.
 this means no features such as gearcheck, boss mods, or heads-up data the native client doesn't show.
 combat meters were allowed as a leap of faith by anet, this serves to act as an example of what else i feel could be ok'd.
 the improvements here fall into three categories - the invisible, the modifications, and the interactives.
 invisible improvements contain game fixes and suppressions like the 2min wvw waypoint bug, and follow last pasted link.
 modifications contain visible modifications such as contact notes, window flashing on whisper/invite/enter combat.
 interactives interact with the client such as item autoclicking, reward autoaccept, waypoint bookmarks, and build templates.
 given interacting with the client is what anet is strongest against it is likely those will never make it to an ok but i still hope.
 these are kept almost entirely within the restricted dll for easy detection should anet not approve.
 global hotkeys listed under restricted options - hold d with number to delete from non-build templates, s to save last used.
 restricted must be updated with d3d9.
 if you do not agree with my modular approach or feel it could have consequences for non-restricted, do not use this mod.
 given cc's post i am no longer distributing this in hopes it will be reconsidered at a later date.

can i chain load another wrapper d3d9.dll
 arcdps will attempt to load d3d9_chainload.dll, and if found, redirect the direct3dcreate9 call to it instead of the system library.
 make sure you are using the 64bit version of wrappers (gemfx, sweetfx).
 due to how reshade works, arcdps (like most wrappers) will not chainload reshade: https://reshade.me/forum/suggestions/244-adding-another-wrapper-as-a-proxy#1839.

ascii ui (and global)
 alt+shift is the default modifier for most key or mouse events to be caught by the mod.
 the type of panel can be gauged from it's header colour - grey is deselected, blue is selected, and orange is prompt.
 prompt panels will steal all keyboard input unconditionally.
 when moused over, selected panels will steal keyboard input without modifiers (unless requireds set in options).
 when moused over, deselected panels will steal keyboard input with modifiers.
 if the panel does not have a handler for that key or if no panel is moused over, it is tried against global hotkeys.
 if no hotkey exists or has no effect, it is forwarded to the client.
 left clicks and right clicks with modifiers always set the panel underneath to selected.
 selected panels do not require modifiers for clicking (unless required set in options).
 click outside the panel (not on another panel) to deselect.
 like keys, processed click requests are not forwarded to the client.
 if a panel looks like it can be scrolled in, it probably can be.

alternate ui
 uses imgui (by ocornut) for displaying (img).
 it likely cannot support auto-centering for surround/eyefinity.
 it likely cannot support window/panel anchors or screen edge anchors other than top-left.
 it likely cannot support modifiers for catching input.
 it cannot support processing input from gw2 dispatch (some safety checks, restricted).
 it requires modifying many state tracking objects to safely allow async access (high crash probability).
 does not have any keyboard hotkeys, everything is tied to lclick and mouseovers.
 holding down the configured modifiers will pass input straight to game ignoring the ui.
 some components of the ascii ui cannot be recreated in imgui and will function using ascii ui and rules.
 font can be changed by placing arcdps_font.ttf in the config dir.
 to enable, toggle it in basic options or make sure alternate_ui is set to 1 under [session].

hotkeys
 up/down  scroll up/down for active panel in increments of 1.
 scrl wheel  scroll up/down for active panel in increments of 2.
 pgup/pgdown  scroll up/down for active panel in increments of list length.
 a  change panel anchor corner (ascii ui, not all panels will work).
 h  toggle global hide/unhide.
 k  lock game target for vs target stats.
 o  reload config.
 q  close panel (ascii ui).
 r  requeue id (prefix with letter eg s for skill).
 s  open summary panel on game target (ascii ui).
 t  toggle options visibility.
 left-click  click/panel select/panel deselect (ascii ui).
 right-click drag  move panel (ascii ui, alt ui if option enabled).

panel: options
 generic options panel.
 click on option category.
 click on options to toggle them.

panel: personal stats
 msgconn data source - game network traffic.
 time interval is assumed to be your in-combat duration, reset automatically.
 left numbers are cleave, right numbers are vs target.
 i to set interval in ms, eg. 30s or 30000 (0 = combat duration).
 backspace to reset view.
 </> to move forward/back in combat history - shared history state with skills panel.
 out (outgoing) / in (incoming) / cbt (combat) / act (active) are clickable.
 click on stats to toggle per-second/total.
 click on headings to open personal skills panel.
 last row click is shortcut to set interval.

panel: personal skills
 left numbers are cleave, right numbers are vs target.
 click on a skill to open skill summary, click on skill name again to go back to skill list.
 d to toggle between friendly and hostile srcs/dsts.
 i to set interval (0 = combat).
 backspace to reset view.
 </> to move fwd/back in combat history - history state sahred with personal stats panel.
 last row click is shortcut to set interval.

panel: target
 burst stats are in brackets, last 5 seconds.
 if target lock is set, vs target stats for all panels are against the desginated target.
 if not set, vs target are against the last selected agent in game.
 yellow target indicates the target no longer exists in the game but stats are preserved until next lock or unlock.
 teal logging line indicates automatically started logging.
 yellow logging line indicates manually started logging.
 click on logging line to stop logging, or start logging as manual - manually started logging will not stop with auto triggers.
 click on target lock row to unlock target.

panel: healthbar
 click to open selected agent's skill data in area stats panel.

panel: area stats (chcli)
 msgconn data source for physical damage, buff application+duration+removal, and skill activation+cancelling.
 condition damage is simulated.
 time interval is assumed to be character's in-combat duration, reset automatically.
 history hotkey on summary panels can be used to "align" combat data if a character enters combat after the end of an encounter.
 minions are included in master's stat totals.
 left numbers are cleave, right numbers are vs target.
 s/s (seconds/second) can be interpreted as percent: 0.7s/s = 70% - because 2500% might isn't an accurate representation.
 total sums in-combat if there is at least 1 player in combat, ooc total otherwise.
 click on player name to open player's skills list, click on their name again to go back to player list.
 click on player stats to toggle per-second/total/percent.
 click on player index to open player summary panel.
 click on a skill to open skill info, click on skill name again to go back to skill list.
 2nd last row/total on player list view opens summaries on first 10 displayed players (only if linked).
 last row click is shortcut to set interval.
 d to toggle between friendly and hostile srcs/dsts.
 i to set interval (0 = combat).
 r to open summary on selected agent.
 s to set focus to self.
 backspace to reset view.
 </> to move forward/back in combat history with agent selected.

panel: area buffs
 table for common damage increasing buffs, calculated as in chcli.
 stats are calculated in render thread, can heavily effect fps.
 buffs without any occurence are hidden.
 stability and resistance in wvw/pvp.
 rt click to un/collapse (alt ui).
 no customization yet.

panel: summary
 can be automatically linked together in short form with summary link option.
 can be automatically opened on players when they join squad/party with auto open option.
 individual categories of rows can be toggled in options.
 to find buff ids, use a filter on combat log with the expected buff's name (case sensitive).
 </> to move forward/back in character combat history (shared with chcli).
 q to close.
 a to close all and save farthest left as default location.

panel: logger
 cbt: local combat log if combat detail=0.
 cbt: area combat log filtered to self if combat detail=1.
 cbt: area combat log if combat detail=2.
 eng: user, resolver, and module.
 gme: game events.
 f to set filter.
 backspace to reset filter and autoscroll.
 click on last row for filter shortcut.

panel: compass
 click to toggle between bar mode and absolute mode.
 page: display mode. no subpage.

panel: metrics
 shows fps and current ping from the same source as game options ui.
 shows client-measured server tick rate - this result will only be perfectly accurate in situations with no network jitter.
 25 is the optimal value, anything lower means that the server isn't keeping up with combat events and that some user input will be dropped (skill lag).
 anything higher means that combat will be happening faster, eg. rev hammer 2 will land linearly faster.
 d to dump all 68 metrics tracked by client to arcdps.log for other analysis.

panel: gathering
 timer starts on first gather.
 backspace to reset gathering history.
 click to toggle between sum and per hour.

panel: input
 backspace as normal backspace.
 esc to cancel without sending to host panel.
 enter to send data to host panel.

evtc log files
 basic binary file that contains context and internal area event log.
 available in instanced content only.
 auto logging starts when an npc with species id in either boss_encounter_ids ini option enters combat and stops when all players exit combat.
 npc species id can be found by selecting it in chcli via healthbar click and looking at ####hs in the name.
 resulting logs are written to arcdps.cbtlogs/npc_id/date.evtc, or /npc_name/ if npc name in evtc path option is set.
 lock preftarget option locks all panel vs target stats to the npc that triggered auto logging.
 compression requires powershell with compress-archive, which has only been tested on windows10.
 the code used to write it out is provided in the evtc/ folder.
 there will not be a human-readable format supported by me any time soon.
 evtc docs: https://www.deltaconnected.com/arcdps/evtc/

parsing evtcs
 /u/ghandi-gandhi: https://github.com/phoenix-oosd/EVTC-Log-Parser/releases
 /u/loseyre: https://www.padl.tk/
 /u/maxlepeh: https://www.raidheroes.tk/
 /u/faerym: https://www.reddit.com/r/Guildwars2/comments/5u87jw/gw2act_an_arcdps_log_parser_plugin_for_advanced/
 if you would like a link to your project from here, let me know.

translations
 /u/nodooooka: https://www.deltaconnected.com/arcdps/translations/chinese/arcdps_lang.ini (chinese)
 Ainillia.5794: https://www.deltaconnected.com/arcdps/translations/french/arcdps_lang.ini (french)
 creating a translation: https://www.deltaconnected.com/arcdps/translations/

limitations
 potato machines will sometimes lack minion or player info (ptr instead of name on chcli) - likely related to model count too.
 potato machines will sometimes process the combat event before combat state change - first or last hit may be dropped.
 chcli is missing siphons and similar because they are internally flagged as buffs - the server does not notify of buff damage.
 chcli is missing gadget sources like engineer turrets or sylvari seed turrets - server only notifies of your own (except some buff applications).
 chcli adps uses approximated condition damage from gear, traits, and buffs.
 chcli adps adds time-to-tick damage on applicatation, and then the max of 1second/time remanining each tick.
 chcli adps condition damage scaling is probably different from the game's scaling, affecting accuracy at sub-80 zones.
 chcli adps condition damage may be off if the fight contains long periods of heavy "skill lag" - represented by r value in metrics.
 chcli adps condition damage will not scale to 50% for wvw cannons/mortars as they are currently indistinguishable.
 phys skill activation count will only count skills which have animations - not shouts.
 overstack and applied do not include stacks that are ignored (lower than lowest existing stack) - the server does not notify the client.
 area healing and absolute buff damage are presently impossible - not notified by server.
 area breakbar damage is presently impossible - not notified by server.
 area combo field finishers are presently impossible - not notified by server.
 area knockback, knockdown, pull, and blowout have no origin context.

known bugs
 alt ui widths are hardcoded and may not work on all fonts and sizes.
 short drag clicks near the borders in ascii ui can crash the process or do other strange things.
 the damage reduction formula is currently best-guess until someone provides better (48 stacks of -2 result in 10.2k being reduced to 3.0k).
 torment is weird on the server (be it moving or last tick rounding) - i use formula value in sim.
 a rounding difference is causing the summed total and displayed to be off by 1 sometimes (chcli, personal).
 overseer spawns in-combat which generates small evtc files after failed attempts (may be unavoidable).
 combat events with server as origin have unknown iff - can cause skills to be sorted into improper h/f chain.

do i need to update arcdps with a new guildwars 2 build
 not unless gw2 updates some low level functionality (crashes, attach point fail), or if you notice things broken.
 no need to remove or disable while the game is updating either.
 recommended to update at least once a week or so for the time being.

its not working
 make sure 'documents/arcdps/arcdps.ini' exists.
 check your 'documents/arcdps/' folder for an arcdps.log (will appear after you launch and are in char select).
 if there is no log, the dll isn't being loaded. the cause for this is system-specific, likely because some other application changed path.
 if there is a log, check to see there's no error and the date matches. attach point find fail means you may need to wait for me to update.
 some systems require placing d3d9.dll alongside gw2-64.exe.
 if you get a coherentui.dll error (0x7e), make sure directx9 june2010 end user runtimes and visual studio 2013 x64 redist are installed.
 if experiencing random crashes, try deleting the containers under arcdps.names/ and/or ini (while game is not running).
 some directx context stealing overlays and programs may cause it to crash on character select (eg d3dgear).

will there be source released
 no. it is fundamentally a hack, could be modified for advantage or malicious purposes, and was denied.
 there will not be any connect or network resource originating from within this module.
 if you don't trust me, i make no effort to obfuscate or pack or encrypt or anti-debug.
 if you are interested in x64 flow redirection code, take a peek at rafzi's hacklib or a cheat programming forum.

where do i complain this game doesn't need a meter or report a bug
 deltaconnected.4058 or deltaconnected on reddit (usually invis in game).
 due to volume i can't often respond to questions who's answer can be found on this page or a fast google search (eg. ini format).
 for ini related questions - i set the default config directory to docs/arcdps/ intead of just docs/, make sure to edit the one in the new location (and remove old).
 if you suspect arcdps as the cause of a crash, open %appdata%\guild wars 2\arenanet.log in notepad and scroll to the bottom.
 check that timestamps match and paste everything below "*--> Crash <--*" in an unlisted http://pastebin.com/ paste.
 include the contents of documents/arcdps/arcdps.log.
 send me the link.
 repro steps and specifics of where/when/who/what are appreciated.

to-do/wishlist
 dynamic widths with non-monospace fonts (alt ui).
 attempt to glue alt ui window positioning to old system for surround centering.
 reorganize logging autostart to be more versatile on long lists eg. fractals.

changes
 apr.27.2017: changed buff remove iff override to apply if src/dst invalid instead of unknown (skewed buff volumes if died).
 apr.27.2017: alt ui: changed chcli back button style to text.
 apr.27.2017: alt ui: moved chcli historical with agent selected to rightclick.
 apr.27.2017: alt ui: removed personal skills button from personal stats, moved historical to rightclick.
 apr.27.2017: alt ui: copied window toggles to chcli menu.
 apr.26.2017: adjusted buff table to use internal event tracking data to better match chcli.
 apr.26.2017: adjusted buff table to use chcli-like formatting.
 apr.26.2017: adjusted abbreviation gen to account for long utf8 chars.
 apr.26.2017: fixed clone-to-self events not having master_instid set.
 apr.26.2017: fixed ntdll crash with alt ui and recount-like.
 apr.26.2017: changed linking to use system msvcrt instead of static.
 apr.26.2017: added buff volume table (auto list, alt and ascii ui).
 apr.26.2017: buff volume table does stats calc from within panel gen, meaning it will affect min frame time.
 apr.26.2017: alt ui: buff table can be un/collapsed with rt click anywhere in window.
 apr.24.2017: changed buff remove to use resistance-like compensation if remover is not server.
 apr.24.2017: the last wvw inconsistencies have to do with no authoritative tick and many short durations/fast cleanses.
 apr.24.2017: removed showing health from target panel.
 apr.22.2017: adjusted config options that can be reloaded via alt-shift-o (to help with imgui colouring).
 apr.22.2017: more timing changes for wvw condition sim.
 apr.22.2017: testing different way to simulate resistance for wvw condition sim.
 apr.22.2017: removed showing health for npc's.
 apr.22.2017: harmless qol will no longer be distributed.
 apr.21.2017: sort self-self buff remove under in+out cleanse if removed buff is guessed unfriendly.
 apr.21.2017: prevent retal from hitting gadgets in wvw only (siege immune).
 apr.21.2017: removed combat/range checks - squad will now be shown unconditionally (no different than looking at squad ui).
 apr.21.2017: more condi timing tests to improve accuracy in wvw.
 apr.21.2017: alt ui: added imgui colour var enum loading to display_altui section (see template).
 apr.21.2017: alt ui: moved transparency key to display_altui section to avoid confusion (see template).
 apr.21.2017: alt ui: removed key forward option since i use no keys (always forward with modifiers held, except mousemove).
 apr.21.2017: alt ui: added option to require modifiers to move windows.
 apr.19.2017: fixed fast agent lookup from being too lenient (siege log spam).
 apr.19.2017: fixed compensation using wrong agents tick time.
 apr.19.2017: fixed retal not scaling to 66% in wvw/pvp.
 apr.19.2017: initial clean up for cleanses and strips (especially with minions/illusions).
 apr.19.2017: alt ui: will no longer ignore font size setting from [display].
 apr.18.2017: updated for apr18 game build.
 apr.18.2017: there have been more engine changes than i can reasonably list here - everything needs testing everywhere.
 apr.17.2017: added damage compensation on buff removal and resistance.
 apr.17.2017: prevent partial ticks from sometimes ignoring resistance.
 apr.17.2017: condition timing tweaks.
 apr.17.2017: clean up garbage buff add/remove logging.
 apr.17.2017: clean up input when minimized.
 apr.17.2017: more recount-like bar fixes.
 apr.17.2017: adjusted fresh start config for new users.
 apr.17.2017: alt ui: changed skills/stats windows to use current settings in menu bars instead of menu names.
 apr.15.2017: improved bar width on non-default fonts.
 apr.15.2017: fixed recount-like for buff list.
 apr.15.2017: alt ui: fixed chcli historical back-to-agent-list not resetting target combat chain.
 apr.15.2017: evtc: added language statechange that is the current client text language at the start of logging.
 apr.13.2017: fixed recount-like percents and sorting.
 apr.13.2017: fixed species id missing in evtc header since log stop change.
 apr.13.2017: changed total line in chcli with recount-like set to match style.
 apr.13.2017: changed alt ui to be default on new first-runs.
 apr.13.2017: changed 1m-10m digit range for consistency.
 apr.13.2017: more adjustments to input handling to prevent alt ui lockup.
 apr.13.2017: experimental - more efforts into preventing memguid crashes.
 apr.13.2017: added option to show total/dps/percent (cleave only) instead of cleave/target (format toggle), vs target can be gauged from bars.
 apr.12.2017: fixed exception thrashing on personal skills list in some circumstances.
 apr.12.2017: experimental - logging start will reset squad members stats (to ignore fight preevents eg. first xera skewing combat time).

downloads
 x64: current 20170427-0016