chore: initial commit
This commit is contained in:
commit
262652fefa
365
.gitignore
vendored
Normal file
365
.gitignore
vendored
Normal file
@ -0,0 +1,365 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# Packaging
|
||||
pack/
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
287
LICENCE
Normal file
287
LICENCE
Normal file
@ -0,0 +1,287 @@
|
||||
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
||||
EUPL © the European Union 2007, 2016
|
||||
|
||||
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
|
||||
below) which is provided under the terms of this Licence. Any use of the Work,
|
||||
other than as authorised under this Licence is prohibited (to the extent such
|
||||
use is covered by a right of the copyright holder of the Work).
|
||||
|
||||
The Work is provided under the terms of this Licence when the Licensor (as
|
||||
defined below) has placed the following notice immediately following the
|
||||
copyright notice for the Work:
|
||||
|
||||
Licensed under the EUPL
|
||||
|
||||
or has expressed by any other means his willingness to license under the EUPL.
|
||||
|
||||
1. Definitions
|
||||
|
||||
In this Licence, the following terms have the following meaning:
|
||||
|
||||
- ‘The Licence’: this Licence.
|
||||
|
||||
- ‘The Original Work’: the work or software distributed or communicated by the
|
||||
Licensor under this Licence, available as Source Code and also as Executable
|
||||
Code as the case may be.
|
||||
|
||||
- ‘Derivative Works’: the works or software that could be created by the
|
||||
Licensee, based upon the Original Work or modifications thereof. This Licence
|
||||
does not define the extent of modification or dependence on the Original Work
|
||||
required in order to classify a work as a Derivative Work; this extent is
|
||||
determined by copyright law applicable in the country mentioned in Article 15.
|
||||
|
||||
- ‘The Work’: the Original Work or its Derivative Works.
|
||||
|
||||
- ‘The Source Code’: the human-readable form of the Work which is the most
|
||||
convenient for people to study and modify.
|
||||
|
||||
- ‘The Executable Code’: any code which has generally been compiled and which is
|
||||
meant to be interpreted by a computer as a program.
|
||||
|
||||
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
||||
the Work under the Licence.
|
||||
|
||||
- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
|
||||
Licence, or otherwise contributes to the creation of a Derivative Work.
|
||||
|
||||
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
||||
the Work under the terms of the Licence.
|
||||
|
||||
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
||||
renting, distributing, communicating, transmitting, or otherwise making
|
||||
available, online or offline, copies of the Work or providing access to its
|
||||
essential functionalities at the disposal of any other natural or legal
|
||||
person.
|
||||
|
||||
2. Scope of the rights granted by the Licence
|
||||
|
||||
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
sublicensable licence to do the following, for the duration of copyright vested
|
||||
in the Original Work:
|
||||
|
||||
- use the Work in any circumstance and for all usage,
|
||||
- reproduce the Work,
|
||||
- modify the Work, and make Derivative Works based upon the Work,
|
||||
- communicate to the public, including the right to make available or display
|
||||
the Work or copies thereof to the public and perform publicly, as the case may
|
||||
be, the Work,
|
||||
- distribute the Work or copies thereof,
|
||||
- lend and rent the Work or copies thereof,
|
||||
- sublicense rights in the Work or copies thereof.
|
||||
|
||||
Those rights can be exercised on any media, supports and formats, whether now
|
||||
known or later invented, as far as the applicable law permits so.
|
||||
|
||||
In the countries where moral rights apply, the Licensor waives his right to
|
||||
exercise his moral right to the extent allowed by law in order to make effective
|
||||
the licence of the economic rights here above listed.
|
||||
|
||||
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
|
||||
any patents held by the Licensor, to the extent necessary to make use of the
|
||||
rights granted on the Work under this Licence.
|
||||
|
||||
3. Communication of the Source Code
|
||||
|
||||
The Licensor may provide the Work either in its Source Code form, or as
|
||||
Executable Code. If the Work is provided as Executable Code, the Licensor
|
||||
provides in addition a machine-readable copy of the Source Code of the Work
|
||||
along with each copy of the Work that the Licensor distributes or indicates, in
|
||||
a notice following the copyright notice attached to the Work, a repository where
|
||||
the Source Code is easily and freely accessible for as long as the Licensor
|
||||
continues to distribute or communicate the Work.
|
||||
|
||||
4. Limitations on copyright
|
||||
|
||||
Nothing in this Licence is intended to deprive the Licensee of the benefits from
|
||||
any exception or limitation to the exclusive rights of the rights owners in the
|
||||
Work, of the exhaustion of those rights or of other applicable limitations
|
||||
thereto.
|
||||
|
||||
5. Obligations of the Licensee
|
||||
|
||||
The grant of the rights mentioned above is subject to some restrictions and
|
||||
obligations imposed on the Licensee. Those obligations are the following:
|
||||
|
||||
Attribution right: The Licensee shall keep intact all copyright, patent or
|
||||
trademarks notices and all notices that refer to the Licence and to the
|
||||
disclaimer of warranties. The Licensee must include a copy of such notices and a
|
||||
copy of the Licence with every copy of the Work he/she distributes or
|
||||
communicates. The Licensee must cause any Derivative Work to carry prominent
|
||||
notices stating that the Work has been modified and the date of modification.
|
||||
|
||||
Copyleft clause: If the Licensee distributes or communicates copies of the
|
||||
Original Works or Derivative Works, this Distribution or Communication will be
|
||||
done under the terms of this Licence or of a later version of this Licence
|
||||
unless the Original Work is expressly distributed only under this version of the
|
||||
Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
||||
(becoming Licensor) cannot offer or impose any additional terms or conditions on
|
||||
the Work or Derivative Work that alter or restrict the terms of the Licence.
|
||||
|
||||
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
||||
Works or copies thereof based upon both the Work and another work licensed under
|
||||
a Compatible Licence, this Distribution or Communication can be done under the
|
||||
terms of this Compatible Licence. For the sake of this clause, ‘Compatible
|
||||
Licence’ refers to the licences listed in the appendix attached to this Licence.
|
||||
Should the Licensee's obligations under the Compatible Licence conflict with
|
||||
his/her obligations under this Licence, the obligations of the Compatible
|
||||
Licence shall prevail.
|
||||
|
||||
Provision of Source Code: When distributing or communicating copies of the Work,
|
||||
the Licensee will provide a machine-readable copy of the Source Code or indicate
|
||||
a repository where this Source will be easily and freely available for as long
|
||||
as the Licensee continues to distribute or communicate the Work.
|
||||
|
||||
Legal Protection: This Licence does not grant permission to use the trade names,
|
||||
trademarks, service marks, or names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the copyright notice.
|
||||
|
||||
6. Chain of Authorship
|
||||
|
||||
The original Licensor warrants that the copyright in the Original Work granted
|
||||
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
||||
power and authority to grant the Licence.
|
||||
|
||||
Each Contributor warrants that the copyright in the modifications he/she brings
|
||||
to the Work are owned by him/her or licensed to him/her and that he/she has the
|
||||
power and authority to grant the Licence.
|
||||
|
||||
Each time You accept the Licence, the original Licensor and subsequent
|
||||
Contributors grant You a licence to their contributions to the Work, under the
|
||||
terms of this Licence.
|
||||
|
||||
7. Disclaimer of Warranty
|
||||
|
||||
The Work is a work in progress, which is continuously improved by numerous
|
||||
Contributors. It is not a finished work and may therefore contain defects or
|
||||
‘bugs’ inherent to this type of development.
|
||||
|
||||
For the above reason, the Work is provided under the Licence on an ‘as is’ basis
|
||||
and without warranties of any kind concerning the Work, including without
|
||||
limitation merchantability, fitness for a particular purpose, absence of defects
|
||||
or errors, accuracy, non-infringement of intellectual property rights other than
|
||||
copyright as stated in Article 6 of this Licence.
|
||||
|
||||
This disclaimer of warranty is an essential part of the Licence and a condition
|
||||
for the grant of any rights to the Work.
|
||||
|
||||
8. Disclaimer of Liability
|
||||
|
||||
Except in the cases of wilful misconduct or damages directly caused to natural
|
||||
persons, the Licensor will in no event be liable for any direct or indirect,
|
||||
material or moral, damages of any kind, arising out of the Licence or of the use
|
||||
of the Work, including without limitation, damages for loss of goodwill, work
|
||||
stoppage, computer failure or malfunction, loss of data or any commercial
|
||||
damage, even if the Licensor has been advised of the possibility of such damage.
|
||||
However, the Licensor will be liable under statutory product liability laws as
|
||||
far such laws apply to the Work.
|
||||
|
||||
9. Additional agreements
|
||||
|
||||
While distributing the Work, You may choose to conclude an additional agreement,
|
||||
defining obligations or services consistent with this Licence. However, if
|
||||
accepting obligations, You may act only on your own behalf and on your sole
|
||||
responsibility, not on behalf of the original Licensor or any other Contributor,
|
||||
and only if You agree to indemnify, defend, and hold each Contributor harmless
|
||||
for any liability incurred by, or claims asserted against such Contributor by
|
||||
the fact You have accepted any warranty or additional liability.
|
||||
|
||||
10. Acceptance of the Licence
|
||||
|
||||
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
|
||||
placed under the bottom of a window displaying the text of this Licence or by
|
||||
affirming consent in any other similar way, in accordance with the rules of
|
||||
applicable law. Clicking on that icon indicates your clear and irrevocable
|
||||
acceptance of this Licence and all of its terms and conditions.
|
||||
|
||||
Similarly, you irrevocably accept this Licence and all of its terms and
|
||||
conditions by exercising any rights granted to You by Article 2 of this Licence,
|
||||
such as the use of the Work, the creation by You of a Derivative Work or the
|
||||
Distribution or Communication by You of the Work or copies thereof.
|
||||
|
||||
11. Information to the public
|
||||
|
||||
In case of any Distribution or Communication of the Work by means of electronic
|
||||
communication by You (for example, by offering to download the Work from a
|
||||
remote location) the distribution channel or media (for example, a website) must
|
||||
at least provide to the public the information requested by the applicable law
|
||||
regarding the Licensor, the Licence and the way it may be accessible, concluded,
|
||||
stored and reproduced by the Licensee.
|
||||
|
||||
12. Termination of the Licence
|
||||
|
||||
The Licence and the rights granted hereunder will terminate automatically upon
|
||||
any breach by the Licensee of the terms of the Licence.
|
||||
|
||||
Such a termination will not terminate the licences of any person who has
|
||||
received the Work from the Licensee under the Licence, provided such persons
|
||||
remain in full compliance with the Licence.
|
||||
|
||||
13. Miscellaneous
|
||||
|
||||
Without prejudice of Article 9 above, the Licence represents the complete
|
||||
agreement between the Parties as to the Work.
|
||||
|
||||
If any provision of the Licence is invalid or unenforceable under applicable
|
||||
law, this will not affect the validity or enforceability of the Licence as a
|
||||
whole. Such provision will be construed or reformed so as necessary to make it
|
||||
valid and enforceable.
|
||||
|
||||
The European Commission may publish other linguistic versions or new versions of
|
||||
this Licence or updated versions of the Appendix, so far this is required and
|
||||
reasonable, without reducing the scope of the rights granted by the Licence. New
|
||||
versions of the Licence will be published with a unique version number.
|
||||
|
||||
All linguistic versions of this Licence, approved by the European Commission,
|
||||
have identical value. Parties can take advantage of the linguistic version of
|
||||
their choice.
|
||||
|
||||
14. Jurisdiction
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- any litigation resulting from the interpretation of this License, arising
|
||||
between the European Union institutions, bodies, offices or agencies, as a
|
||||
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
||||
of Justice of the European Union, as laid down in article 272 of the Treaty on
|
||||
the Functioning of the European Union,
|
||||
|
||||
- any litigation arising between other parties and resulting from the
|
||||
interpretation of this License, will be subject to the exclusive jurisdiction
|
||||
of the competent court where the Licensor resides or conducts its primary
|
||||
business.
|
||||
|
||||
15. Applicable Law
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- this Licence shall be governed by the law of the European Union Member State
|
||||
where the Licensor has his seat, resides or has his registered office,
|
||||
|
||||
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
||||
residence or registered office inside a European Union Member State.
|
||||
|
||||
Appendix
|
||||
|
||||
‘Compatible Licences’ according to Article 5 EUPL are:
|
||||
|
||||
- GNU General Public License (GPL) v. 2, v. 3
|
||||
- GNU Affero General Public License (AGPL) v. 3
|
||||
- Open Software License (OSL) v. 2.1, v. 3.0
|
||||
- Eclipse Public License (EPL) v. 1.0
|
||||
- CeCILL v. 2.0, v. 2.1
|
||||
- Mozilla Public Licence (MPL) v. 2
|
||||
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
||||
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
||||
works other than software
|
||||
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
||||
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
||||
Reciprocity (LiLiQ-R+).
|
||||
|
||||
The European Commission may update this Appendix to later versions of the above
|
||||
licences without producing a new version of the EUPL, as long as they provide
|
||||
the rights granted in Article 2 of this Licence and protect the covered Source
|
||||
Code from exclusive appropriation.
|
||||
|
||||
All other changes or additions to this Appendix require the production of a new
|
||||
EUPL version.
|
16
Quest Map.sln
Normal file
16
Quest Map.sln
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quest Map", "Quest Map\Quest Map.csproj", "{63ACA302-ADBE-4353-A722-D38531C8A34D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{63ACA302-ADBE-4353-A722-D38531C8A34D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63ACA302-ADBE-4353-A722-D38531C8A34D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63ACA302-ADBE-4353-A722-D38531C8A34D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63ACA302-ADBE-4353-A722-D38531C8A34D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
24
Quest Map/Commands.cs
Normal file
24
Quest Map/Commands.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Dalamud.Game.Command;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class Commands : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
internal Commands(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
||||
this.Plugin.Interface.CommandManager.AddHandler("/quests", new CommandInfo(this.OnCommand) {
|
||||
HelpMessage = "Show Quest Map",
|
||||
});
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.Plugin.Interface.CommandManager.RemoveHandler("/quests");
|
||||
}
|
||||
|
||||
private void OnCommand(string command, string args) {
|
||||
this.Plugin.Ui.Show ^= true;
|
||||
}
|
||||
}
|
||||
}
|
22
Quest Map/Configuration.cs
Normal file
22
Quest Map/Configuration.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using Dalamud.Configuration;
|
||||
|
||||
namespace QuestMap {
|
||||
[Serializable]
|
||||
internal class Configuration : IPluginConfiguration {
|
||||
public int Version { get; set; } = 1;
|
||||
|
||||
public bool ShowCompleted;
|
||||
public bool ShowSeasonal;
|
||||
public bool ShowArrowheads;
|
||||
public bool CondenseMsq;
|
||||
|
||||
public Visibility EmoteVis;
|
||||
public Visibility ItemVis;
|
||||
public Visibility MinionVis;
|
||||
public Visibility ActionsVis;
|
||||
public Visibility InstanceVis;
|
||||
public Visibility TribeVis;
|
||||
public Visibility JobVis;
|
||||
}
|
||||
}
|
20
Quest Map/DalamudPlugin.cs
Normal file
20
Quest Map/DalamudPlugin.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Dalamud.Plugin;
|
||||
|
||||
namespace QuestMap {
|
||||
// ReSharper disable once UnusedType.Global
|
||||
public class DalamudPlugin : IDalamudPlugin {
|
||||
internal const string PluginName = "Quest Map";
|
||||
|
||||
public string Name => PluginName;
|
||||
|
||||
private Plugin? Plugin { get; set; }
|
||||
|
||||
public void Initialize(DalamudPluginInterface pluginInterface) {
|
||||
this.Plugin = new Plugin(pluginInterface);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.Plugin?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
3
Quest Map/FodyWeavers.xml
Normal file
3
Quest Map/FodyWeavers.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ILMerge/>
|
||||
</Weavers>
|
13
Quest Map/GraphInfo.cs
Normal file
13
Quest Map/GraphInfo.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class GraphInfo {
|
||||
internal GeometryGraph Graph { get; }
|
||||
internal Node? Centre { get; }
|
||||
|
||||
internal GraphInfo(GeometryGraph graph, Node? centre) {
|
||||
this.Graph = graph;
|
||||
this.Centre = centre;
|
||||
}
|
||||
}
|
||||
}
|
167
Quest Map/Node.cs
Normal file
167
Quest Map/Node.cs
Normal file
@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class Node<T> {
|
||||
internal uint Id { get; }
|
||||
internal List<Node<T>> Parents { get; set; }
|
||||
internal T Value { get; set; }
|
||||
internal List<Node<T>> Children { get; } = new();
|
||||
|
||||
internal Node(List<Node<T>> parents, uint id, T value) {
|
||||
this.Id = id;
|
||||
this.Parents = parents;
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
private Node(uint id) {
|
||||
this.Id = id;
|
||||
this.Parents = new List<Node<T>>();
|
||||
this.Value = default!;
|
||||
}
|
||||
|
||||
internal Node<T>? Find(uint id) {
|
||||
if (this.Id == id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
foreach (var child in this.Children) {
|
||||
var result = child.Find(id);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal IEnumerable<Node<T>> Ancestors() {
|
||||
var parents = new Stack<Node<T>>();
|
||||
foreach (var parent in this.Parents) {
|
||||
parents.Push(parent);
|
||||
}
|
||||
|
||||
while (parents.Any()) {
|
||||
var next = parents.Pop();
|
||||
yield return next;
|
||||
foreach (var parent in next.Parents) {
|
||||
parents.Push(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<Node<T>> Ancestors(Func<T, T?> consolidator) {
|
||||
var parents = new Stack<Node<T>>();
|
||||
foreach (var parent in this.Parents) {
|
||||
var consolidated = consolidator(parent.Value);
|
||||
parents.Push(consolidated == null
|
||||
? parent
|
||||
: new Node<T>(new List<Node<T>>(), parent.Id, consolidated) {
|
||||
Children = { this },
|
||||
});
|
||||
}
|
||||
|
||||
while (parents.Any()) {
|
||||
var next = parents.Pop();
|
||||
yield return next;
|
||||
foreach (var parent in next.Parents) {
|
||||
var consolidated = consolidator(parent.Value);
|
||||
parents.Push(consolidated == null
|
||||
? parent
|
||||
: new Node<T>(new List<Node<T>>(), parent.Id, consolidated) {
|
||||
Children = { next },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<Node<T>> Traverse() {
|
||||
var stack = new Stack<Node<T>>();
|
||||
stack.Push(this);
|
||||
while (stack.Any()) {
|
||||
var next = stack.Pop();
|
||||
yield return next;
|
||||
foreach (var child in next.Children) {
|
||||
stack.Push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<Tuple<Node<T>, uint>> TraverseWithDepth() {
|
||||
var stack = new Stack<Tuple<Node<T>, uint>>();
|
||||
stack.Push(Tuple.Create(this, (uint) 0));
|
||||
while (stack.Any()) {
|
||||
var next = stack.Pop();
|
||||
yield return next;
|
||||
foreach (var child in next.Item1.Children) {
|
||||
stack.Push(Tuple.Create(child, next.Item2 + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static (List<Node<Quest>>, Dictionary<uint, Node<Quest>>) BuildTree(Dictionary<uint, Quest> layouts) {
|
||||
var lookup = new Dictionary<uint, Node<Quest>>();
|
||||
var rootNodes = new List<Node<Quest>>();
|
||||
var allNodes = new Dictionary<uint, Node<Quest>>();
|
||||
|
||||
foreach (var item in layouts) {
|
||||
if (lookup.TryGetValue(item.Key, out var ourNode)) {
|
||||
ourNode.Value = item.Value;
|
||||
} else {
|
||||
ourNode = new Node<Quest>(new List<Node<Quest>>(), item.Key, item.Value);
|
||||
lookup[item.Key] = ourNode;
|
||||
allNodes[item.Key] = ourNode;
|
||||
}
|
||||
|
||||
var previous = item.Value.PreviousQuests().ToList();
|
||||
if (previous.Count == 0) {
|
||||
rootNodes.Add(ourNode);
|
||||
} else {
|
||||
foreach (var prev in previous) {
|
||||
if (!lookup.TryGetValue(prev.RowId, out var parentNode)) {
|
||||
// create preliminary parent
|
||||
parentNode = new Node<Quest>(prev.RowId);
|
||||
lookup[prev.RowId] = parentNode;
|
||||
allNodes[prev.RowId] = parentNode;
|
||||
}
|
||||
|
||||
parentNode.Children.Add(ourNode);
|
||||
ourNode.Parents.Add(parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (rootNodes, allNodes);
|
||||
}
|
||||
}
|
||||
|
||||
internal static class NodeExt {
|
||||
internal static Node<T>? Find<T>(this IEnumerable<Node<T>> nodes, uint id) {
|
||||
foreach (var node in nodes) {
|
||||
var found = node.Find(id);
|
||||
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static IEnumerable<Quest> PreviousQuests(this Quest quest) {
|
||||
if (quest.PreviousQuest0.Row != 0) {
|
||||
yield return quest.PreviousQuest0.Value;
|
||||
}
|
||||
|
||||
if (quest.PreviousQuest1.Row != 0) {
|
||||
yield return quest.PreviousQuest1.Value;
|
||||
}
|
||||
|
||||
if (quest.PreviousQuest2.Row != 0) {
|
||||
yield return quest.PreviousQuest2.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
Quest Map/Plugin.cs
Normal file
38
Quest Map/Plugin.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Threading.Channels;
|
||||
using Dalamud.Plugin;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
using XivCommon;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class Plugin : IDisposable {
|
||||
internal DalamudPluginInterface Interface { get; }
|
||||
internal XivCommonBase Common { get; }
|
||||
internal Configuration Config { get; }
|
||||
internal Quests Quests { get; }
|
||||
internal PluginUi Ui { get; }
|
||||
private Commands Commands { get; }
|
||||
|
||||
internal Plugin(DalamudPluginInterface pluginInterface) {
|
||||
this.Interface = pluginInterface;
|
||||
this.Common = new XivCommonBase(pluginInterface);
|
||||
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
|
||||
var graphChannel = Channel.CreateUnbounded<GraphInfo>();
|
||||
this.Quests = new Quests(this, graphChannel.Writer);
|
||||
this.Ui = new PluginUi(this, graphChannel.Reader);
|
||||
|
||||
this.Commands = new Commands(this);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.Commands.Dispose();
|
||||
this.Ui.Dispose();
|
||||
this.Common.Dispose();
|
||||
}
|
||||
|
||||
internal void SaveConfig() {
|
||||
this.Interface.SavePluginConfig(this.Config);
|
||||
}
|
||||
}
|
||||
}
|
901
Quest Map/PluginUi.cs
Normal file
901
Quest Map/PluginUi.cs
Normal file
@ -0,0 +1,901 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Channels;
|
||||
using Dalamud;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
using Lumina.Data;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Microsoft.Msagl.Core.Geometry;
|
||||
using Microsoft.Msagl.Core.Geometry.Curves;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class PluginUi : IDisposable {
|
||||
private static class Colours {
|
||||
internal static readonly uint Bg = ImGui.GetColorU32(new Vector4(0.13f, 0.13f, 0.13f, 1));
|
||||
internal static readonly uint Bg2 = ImGui.GetColorU32(new Vector4(0.3f, 0.3f, 0.3f, 1));
|
||||
internal static readonly uint Text = ImGui.GetColorU32(new Vector4(0.9f, 0.9f, 0.9f, 1));
|
||||
internal static readonly uint Line = ImGui.GetColorU32(new Vector4(0.7f, 0.7f, 0.7f, 1));
|
||||
internal static readonly uint Grid = ImGui.GetColorU32(new Vector4(0.1f, 0.1f, 0.1f, 1));
|
||||
|
||||
internal static readonly Vector4 NormalQuest = new(0.54f, 0.45f, 0.36f, 1);
|
||||
internal static readonly Vector4 MsqQuest = new(0.29f, 0.35f, 0.44f, 1);
|
||||
internal static readonly Vector4 BlueQuest = new(0.024F, 0.016f, 0.72f, 1);
|
||||
}
|
||||
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
private string _filter = string.Empty;
|
||||
private Quest? Quest { get; set; }
|
||||
private GeometryGraph? Graph { get; set; }
|
||||
private Node? Centre { get; set; }
|
||||
private ChannelReader<GraphInfo> GraphChannel { get; }
|
||||
private CancellationTokenSource? CancellationTokenSource { get; set; }
|
||||
private HashSet<uint> InfoWindows { get; } = new();
|
||||
private Dictionary<uint, TextureWrap> Icons { get; } = new();
|
||||
private List<(Quest, bool, string)> FilteredQuests { get; } = new();
|
||||
|
||||
internal bool Show;
|
||||
|
||||
private bool _relayout;
|
||||
private Vector2 _offset = Vector2.Zero;
|
||||
private static readonly Vector2 TextOffset = new(5, 2);
|
||||
private const int GridSmall = 10;
|
||||
private const int GridLarge = 50;
|
||||
private bool _viewDrag;
|
||||
private Vector2 _lastDragPos;
|
||||
|
||||
internal PluginUi(Plugin plugin, ChannelReader<GraphInfo> graphChannel) {
|
||||
this.Plugin = plugin;
|
||||
this.GraphChannel = graphChannel;
|
||||
|
||||
this.Refilter();
|
||||
|
||||
this.Plugin.Interface.UiBuilder.OnBuildUi += this.Draw;
|
||||
this.Plugin.Interface.UiBuilder.OnOpenConfigUi += this.OpenConfig;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.Plugin.Interface.UiBuilder.OnOpenConfigUi -= this.OpenConfig;
|
||||
this.Plugin.Interface.UiBuilder.OnBuildUi -= this.Draw;
|
||||
|
||||
foreach (var icon in this.Icons.Values) {
|
||||
icon.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenConfig(object sender, EventArgs e) {
|
||||
this.Show = true;
|
||||
}
|
||||
|
||||
private void Refilter() {
|
||||
this.FilteredQuests.Clear();
|
||||
|
||||
var filterLower = this._filter.ToLowerInvariant();
|
||||
var filtered = this.Plugin.Interface.Data.GetExcelSheet<Quest>()
|
||||
.Where(quest => {
|
||||
if (quest.Name.ToString().Length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.Plugin.Config.ShowSeasonal && quest.Festival.Row != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var completed = this.Plugin.Common.Functions.Journal.IsQuestCompleted(quest);
|
||||
if (!this.Plugin.Config.ShowCompleted && completed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.EmoteVis == Visibility.Only && !this.Plugin.Quests.EmoteRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.ItemVis == Visibility.Only && !this.Plugin.Quests.ItemRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.MinionVis == Visibility.Only) {
|
||||
if (!this.Plugin.Quests.ItemRewards.TryGetValue(quest.RowId, out var items)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (items.All(item => item.ItemUICategory.Row != 81)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.ActionsVis == Visibility.Only && !this.Plugin.Quests.ActionRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.InstanceVis == Visibility.Only && !this.Plugin.Quests.InstanceRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.TribeVis == Visibility.Only && !this.Plugin.Quests.BeastRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.JobVis == Visibility.Only && !this.Plugin.Quests.JobRewards.ContainsKey(quest.RowId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._filter.Length == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return quest.Name.ToString().ToLowerInvariant().Contains(filterLower)
|
||||
|| this.Plugin.Quests.ItemRewards.TryGetValue(quest.RowId, out var items1) && items1.Any(item => item.Name.ToString().ToLowerInvariant().Contains(filterLower))
|
||||
|| this.Plugin.Quests.EmoteRewards.TryGetValue(quest.RowId, out var emote) && emote.Name.ToString().ToLowerInvariant().Contains(filterLower)
|
||||
|| this.Plugin.Quests.ActionRewards.TryGetValue(quest.RowId, out var action) && action.Name.ToString().ToLowerInvariant().Contains(filterLower)
|
||||
|| this.Plugin.Quests.InstanceRewards.TryGetValue(quest.RowId, out var instances) && instances.Any(instance => instance.Name.ToString().ToLowerInvariant().Contains(filterLower))
|
||||
|| this.Plugin.Quests.BeastRewards.TryGetValue(quest.RowId, out var tribe) && tribe.Name.ToString().ToLowerInvariant().Contains(filterLower)
|
||||
|| this.Plugin.Quests.JobRewards.TryGetValue(quest.RowId, out var job) && job.Name.ToString().ToLowerInvariant().Contains(filterLower);
|
||||
})
|
||||
.SelectMany(quest => {
|
||||
var drawItems = new List<(Quest, bool, string)> {
|
||||
(quest, false, $"{this.Convert(quest.Name)}##{quest.RowId}"),
|
||||
};
|
||||
|
||||
var allItems = this.Plugin.Config.ItemVis != Visibility.Hidden;
|
||||
var anyItemVisible = allItems || this.Plugin.Config.MinionVis != Visibility.Hidden;
|
||||
if (anyItemVisible && this.Plugin.Quests.ItemRewards.TryGetValue(quest.RowId, out var items)) {
|
||||
var toShow = items.Where(item => allItems || item.ItemUICategory.Row == 81);
|
||||
drawItems.AddRange(toShow.Select(item => (quest, true, $"{this.Convert(item.Name)}##item-{quest.RowId}-{item.RowId}")));
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.EmoteVis != Visibility.Hidden && this.Plugin.Quests.EmoteRewards.TryGetValue(quest.RowId, out var emote)) {
|
||||
drawItems.Add((quest, true, $"{this.Convert(emote.Name)}##emote-{quest.RowId}-{emote.RowId}"));
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.ActionsVis != Visibility.Hidden && this.Plugin.Quests.ActionRewards.TryGetValue(quest.RowId, out var action)) {
|
||||
drawItems.Add((quest, true, $"{this.Convert(action.Name)}##action-{quest.RowId}-{action.RowId}"));
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.InstanceVis != Visibility.Hidden && this.Plugin.Quests.InstanceRewards.TryGetValue(quest.RowId, out var instances)) {
|
||||
drawItems.AddRange(instances.Select(instance => (quest, true, $"{this.Convert(instance.Name)}##instance-{quest.RowId}-{instance.RowId}")));
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.TribeVis != Visibility.Hidden && this.Plugin.Quests.BeastRewards.TryGetValue(quest.RowId, out var tribe)) {
|
||||
drawItems.Add((quest, true, $"{this.Convert(tribe.Name)}##tribe-{quest.RowId}-{tribe.RowId}"));
|
||||
}
|
||||
|
||||
if (this.Plugin.Config.JobVis != Visibility.Hidden && this.Plugin.Quests.JobRewards.TryGetValue(quest.RowId, out var job)) {
|
||||
drawItems.Add((quest, true, $"{this.Convert(job.Name)}##job-{quest.RowId}-{job.RowId}"));
|
||||
}
|
||||
|
||||
return drawItems;
|
||||
});
|
||||
this.FilteredQuests.AddRange(filtered);
|
||||
}
|
||||
|
||||
private void Draw() {
|
||||
if (this.GraphChannel.TryRead(out var graph)) {
|
||||
this.Graph = graph.Graph;
|
||||
this.Centre = graph.Centre;
|
||||
this.CancellationTokenSource = null;
|
||||
}
|
||||
|
||||
this.DrawInfoWindows();
|
||||
|
||||
this.DrawMainWindow();
|
||||
}
|
||||
|
||||
private void DrawMainWindow() {
|
||||
if (!this.Show) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(675, 600), ImGuiCond.FirstUseEver);
|
||||
|
||||
if (!ImGui.Begin(DalamudPlugin.PluginName, ref this.Show, ImGuiWindowFlags.MenuBar)) {
|
||||
ImGui.End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ImGui.BeginMenuBar()) {
|
||||
if (ImGui.BeginMenu("Options")) {
|
||||
var anyChanged = false;
|
||||
|
||||
if (ImGui.BeginMenu("Quest list")) {
|
||||
anyChanged |= ImGui.MenuItem("Show completed quests", null, ref this.Plugin.Config.ShowCompleted);
|
||||
anyChanged |= ImGui.MenuItem("Show seasonal quests", null, ref this.Plugin.Config.ShowSeasonal);
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui.BeginMenu("Quest map")) {
|
||||
if (ImGui.MenuItem("Show arrowheads", null, ref this.Plugin.Config.ShowArrowheads)) {
|
||||
this._relayout = true;
|
||||
anyChanged = true;
|
||||
}
|
||||
|
||||
if (ImGui.MenuItem("Condense final MSQ quests", null, ref this.Plugin.Config.CondenseMsq)) {
|
||||
this._relayout = true;
|
||||
anyChanged = true;
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
void VisibilityItem(string name, string id, ref Visibility visibility) {
|
||||
if (!ImGui.BeginMenu(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var vis in (Visibility[]) Enum.GetValues(typeof(Visibility))) {
|
||||
if (!ImGui.MenuItem($"{vis}##{id}", null, visibility == vis)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
visibility = vis;
|
||||
anyChanged = true;
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui.BeginMenu("Reward/unlock visibility")) {
|
||||
VisibilityItem("Emotes", "emote-vis", ref this.Plugin.Config.EmoteVis);
|
||||
VisibilityItem("Items", "item-vis", ref this.Plugin.Config.ItemVis);
|
||||
VisibilityItem("Minions", "minion-vis", ref this.Plugin.Config.MinionVis);
|
||||
VisibilityItem("Actions", "action-vis", ref this.Plugin.Config.ActionsVis);
|
||||
VisibilityItem("Instances", "instance-vis", ref this.Plugin.Config.InstanceVis);
|
||||
VisibilityItem("Beast tribes", "tribe-vis", ref this.Plugin.Config.TribeVis);
|
||||
VisibilityItem("Jobs", "job-vis", ref this.Plugin.Config.JobVis);
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
if (anyChanged) {
|
||||
this.Plugin.SaveConfig();
|
||||
this.Refilter();
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
ImGui.EndMenuBar();
|
||||
}
|
||||
|
||||
if (ImGui.InputText("Filter", ref this._filter, 100)) {
|
||||
this.Refilter();
|
||||
}
|
||||
|
||||
if (ImGui.BeginChild("quest-list", new Vector2(ImGui.GetContentRegionAvail().X * .25f, -1), false, ImGuiWindowFlags.HorizontalScrollbar)) {
|
||||
ImGuiListClipperPtr clipper;
|
||||
unsafe {
|
||||
clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
|
||||
}
|
||||
|
||||
clipper.Begin(this.FilteredQuests.Count);
|
||||
while (clipper.Step()) {
|
||||
for (var row = clipper.DisplayStart; row < clipper.DisplayEnd; row++) {
|
||||
var (quest, indent, drawItem) = this.FilteredQuests[row];
|
||||
|
||||
void DrawSelectable(string name, Quest quest) {
|
||||
var completed = this.Plugin.Common.Functions.Journal.IsQuestCompleted(quest);
|
||||
if (completed) {
|
||||
Vector4 disabled;
|
||||
unsafe {
|
||||
disabled = *ImGui.GetStyleColorVec4(ImGuiCol.TextDisabled);
|
||||
}
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, disabled);
|
||||
}
|
||||
|
||||
var ret = ImGui.Selectable(name, this.Quest == quest);
|
||||
|
||||
if (completed) {
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) {
|
||||
this.InfoWindows.Add(quest.RowId);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.Quest = quest;
|
||||
this._relayout = true;
|
||||
this.Graph = null;
|
||||
}
|
||||
|
||||
if (indent) {
|
||||
ImGui.TreePush();
|
||||
}
|
||||
|
||||
DrawSelectable(drawItem, quest);
|
||||
|
||||
if (indent) {
|
||||
ImGui.TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clipper.Destroy();
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.BeginChild("quest-map", new Vector2(-1, -1))) {
|
||||
if (this.Quest != null && this.Graph == null) {
|
||||
ImGui.TextUnformatted("Generating map...");
|
||||
}
|
||||
|
||||
if (this.Graph != null) {
|
||||
this.DrawGraph(this.Graph);
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
if (this._relayout && this.Quest != null) {
|
||||
this.Graph = null;
|
||||
this.CancellationTokenSource?.Cancel();
|
||||
this.CancellationTokenSource = this.Plugin.Quests.StartGraphRecalculation(this.Quest);
|
||||
this._relayout = false;
|
||||
}
|
||||
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
private void DrawInfoWindows() {
|
||||
var remove = 0u;
|
||||
|
||||
foreach (var id in this.InfoWindows) {
|
||||
var quest = this.Plugin.Interface.Data.GetExcelSheet<Quest>().GetRow(id);
|
||||
if (quest == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.DrawInfoWindow(quest)) {
|
||||
remove = id;
|
||||
}
|
||||
}
|
||||
|
||||
if (remove > 0) {
|
||||
this.InfoWindows.Remove(remove);
|
||||
}
|
||||
}
|
||||
|
||||
/// <returns>true if closing</returns>
|
||||
private bool DrawInfoWindow(Quest quest) {
|
||||
var open = true;
|
||||
if (!ImGui.Begin($"{this.Convert(quest.Name)}##{quest.RowId}", ref open, ImGuiWindowFlags.AlwaysAutoResize)) {
|
||||
ImGui.End();
|
||||
return !open;
|
||||
}
|
||||
|
||||
var completed = this.Plugin.Common.Functions.Journal.IsQuestCompleted(quest);
|
||||
|
||||
ImGui.TextUnformatted($"Level: {quest.ClassJobLevel0}");
|
||||
|
||||
if (completed) {
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
var check = FontAwesomeIcon.Check.ToIconString();
|
||||
var width = ImGui.GetContentRegionAvail().X - ImGui.CalcTextSize(check).X;
|
||||
ImGui.SameLine(width);
|
||||
ImGui.TextUnformatted(check);
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
TextureWrap GetIcon(uint id) {
|
||||
if (this.Icons.TryGetValue(id, out var wrap)) {
|
||||
return wrap;
|
||||
}
|
||||
|
||||
wrap = this.Plugin.Interface.Data.GetImGuiTextureIcon(this.Plugin.Interface.ClientState.ClientLanguage, (int) id);
|
||||
this.Icons[id] = wrap;
|
||||
|
||||
return wrap;
|
||||
}
|
||||
|
||||
var textWrap = ImGui.GetFontSize() * 20f;
|
||||
|
||||
if (quest.Icon != 0) {
|
||||
var header = GetIcon(quest.Icon);
|
||||
textWrap = header.Width;
|
||||
ImGui.Image(header.ImGuiHandle, new Vector2(header.Width, header.Height));
|
||||
}
|
||||
|
||||
var rewards = new List<string>();
|
||||
var paramGrow = this.Plugin.Interface.Data.GetExcelSheet<ParamGrow>().GetRow(quest.ClassJobLevel0);
|
||||
var xp = quest.ExpFactor * paramGrow.ScaledQuestXP * paramGrow.QuestExpModifier / 100;
|
||||
if (xp > 0) {
|
||||
rewards.Add($"Exp: {xp:N0}");
|
||||
}
|
||||
|
||||
if (quest.GilReward > 0) {
|
||||
rewards.Add($"Gil: {quest.GilReward:N0}");
|
||||
}
|
||||
|
||||
if (rewards.Count > 0) {
|
||||
ImGui.TextUnformatted(string.Join(" / ", rewards));
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
void DrawItemRewards(string label, IEnumerable<(SeString name, uint icon, byte qty)> enumerable) {
|
||||
var items = enumerable.ToArray();
|
||||
if (items.Length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(label);
|
||||
|
||||
var maxHeight = items.Select(entry => GetIcon(entry.icon)).Max(image => image.Height);
|
||||
|
||||
var originalY = ImGui.GetCursorPosY();
|
||||
foreach (var (name, icon, qty) in items) {
|
||||
var image = GetIcon(icon);
|
||||
if (image.Height < maxHeight) {
|
||||
ImGui.SetCursorPosY(originalY + (maxHeight - image.Height) / 2f);
|
||||
}
|
||||
|
||||
ImGui.Image(image.ImGuiHandle, new Vector2(image.Width, image.Height));
|
||||
Util.Tooltip(name.ToString());
|
||||
if (qty > 1) {
|
||||
var oldSpacing = ImGui.GetStyle().ItemSpacing;
|
||||
ImGui.GetStyle().ItemSpacing = new Vector2(2, 0);
|
||||
ImGui.SameLine();
|
||||
var qtyLabel = $"x{qty}";
|
||||
var labelSize = ImGui.CalcTextSize(qtyLabel);
|
||||
ImGui.SetCursorPosY(originalY + (maxHeight - labelSize.Y) / 2f);
|
||||
ImGui.TextUnformatted(qtyLabel);
|
||||
ImGui.GetStyle().ItemSpacing = oldSpacing;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
}
|
||||
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
var additionalRewards = new List<(SeString name, uint icon, byte qty)>();
|
||||
if (this.Plugin.Quests.JobRewards.TryGetValue(quest.RowId, out var job)) {
|
||||
// FIXME: figure out better way to find icon
|
||||
additionalRewards.Add((this.Convert(job.Name).ToString(), 62000 + job.RowId, 1));
|
||||
}
|
||||
|
||||
for (var i = 0; i < quest.ItemCatalyst.Length; i++) {
|
||||
var catalyst = quest.ItemCatalyst[i];
|
||||
var amount = quest.ItemCountCatalyst[i];
|
||||
|
||||
if (catalyst.Row != 0) {
|
||||
additionalRewards.Add((this.Convert(catalyst.Value.Name), catalyst.Value.Icon, amount));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var generalAction in quest.GeneralActionReward.Where(row => row.Row != 0)) {
|
||||
additionalRewards.Add((this.Convert(generalAction.Value.Name), (uint) generalAction.Value.Icon, 1));
|
||||
}
|
||||
|
||||
if (this.Plugin.Quests.ActionRewards.TryGetValue(quest.RowId, out var action)) {
|
||||
additionalRewards.Add((this.Convert(action.Name), action.Icon, 1));
|
||||
}
|
||||
|
||||
if (this.Plugin.Quests.EmoteRewards.TryGetValue(quest.RowId, out var emote)) {
|
||||
additionalRewards.Add((this.Convert(emote.Name), emote.Icon, 1));
|
||||
}
|
||||
|
||||
if (quest.OtherReward.Row != 0) {
|
||||
additionalRewards.Add((this.Convert(quest.OtherReward.Value.Name), quest.OtherReward.Value.Icon, 1));
|
||||
}
|
||||
|
||||
if (quest.ReputationReward > 0) {
|
||||
var beastTribe = quest.BeastTribe.Value;
|
||||
if (beastTribe != null) {
|
||||
additionalRewards.Add((this.Convert(beastTribe.NameRelation), beastTribe.Icon, quest.ReputationReward));
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.TomestoneReward > 0) {
|
||||
var tomestone = this.Plugin.Interface.Data.GetExcelSheet<TomestonesItem>().First(row => row.Tomestones.Row == quest.TomestoneReward);
|
||||
var item = tomestone?.Item?.Value;
|
||||
if (item != null) {
|
||||
additionalRewards.Add((this.Convert(item.Name), item.Icon, quest.TomestoneCountReward));
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.ItemRewardType is 0 or 1 or 3 or 5) {
|
||||
DrawItemRewards(
|
||||
"Rewards",
|
||||
quest.ItemReward0
|
||||
.Zip(quest.ItemCountReward0, (id, qty) => (id, qty))
|
||||
.Where(entry => entry.id != 0)
|
||||
.Select(entry => (item: this.Plugin.Interface.Data.GetExcelSheet<Item>().GetRow(entry.id), entry.qty))
|
||||
.Where(entry => entry.item != null)
|
||||
.Select(entry => (this.Convert(entry.item.Name), (uint) entry.item.Icon, entry.qty))
|
||||
.Concat(additionalRewards)
|
||||
);
|
||||
|
||||
DrawItemRewards(
|
||||
"Optional rewards",
|
||||
quest.ItemReward1
|
||||
.Zip(quest.ItemCountReward1, (row, qty) => (row, qty))
|
||||
.Where(entry => entry.row.Row != 0)
|
||||
.Select(entry => (item: entry.row.Value, entry.qty))
|
||||
.Where(entry => entry.item != null)
|
||||
.Select(entry => (this.Convert(entry.item.Name), (uint) entry.item.Icon, entry.qty))
|
||||
);
|
||||
}
|
||||
|
||||
if (this.Plugin.Quests.InstanceRewards.TryGetValue(quest.RowId, out var instances)) {
|
||||
ImGui.TextUnformatted("Instances");
|
||||
|
||||
foreach (var instance in instances) {
|
||||
var icon = instance.ContentType.Value?.Icon ?? 0;
|
||||
if (icon > 0) {
|
||||
var image = GetIcon(icon);
|
||||
ImGui.Image(image.ImGuiHandle, new Vector2(image.Width, image.Height));
|
||||
Util.Tooltip(this.Convert(instance.Name).ToString());
|
||||
} else {
|
||||
ImGui.TextUnformatted(this.Convert(instance.Name).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
if (this.Plugin.Quests.BeastRewards.TryGetValue(quest.RowId, out var tribe)) {
|
||||
ImGui.TextUnformatted("Beast tribe");
|
||||
|
||||
var image = GetIcon(tribe.Icon);
|
||||
ImGui.Image(image.ImGuiHandle, new Vector2(image.Width, image.Height));
|
||||
Util.Tooltip(this.Convert(tribe.Name).ToString());
|
||||
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
var id = quest.RowId & 0xFFFF;
|
||||
var lang = this.Plugin.Interface.ClientState.ClientLanguage switch {
|
||||
ClientLanguage.English => Language.English,
|
||||
ClientLanguage.Japanese => Language.Japanese,
|
||||
ClientLanguage.German => Language.German,
|
||||
ClientLanguage.French => Language.French,
|
||||
_ => Language.English,
|
||||
};
|
||||
var path = $"quest/{id.ToString("00000").Substring(0, 3)}/{quest.Id.RawString.ToLowerInvariant()}";
|
||||
// FIXME: this is gross, but lumina caches incorrectly
|
||||
this.Plugin.Interface.Data.Excel.RemoveSheetFromCache<QuestData>();
|
||||
var sheet = this.Plugin.Interface.Data.Excel.GetType()
|
||||
.GetMethod("GetSheet", BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?.MakeGenericMethod(typeof(QuestData))
|
||||
// ReSharper disable once ConstantConditionalAccessQualifier
|
||||
?.Invoke(this.Plugin.Interface.Data.Excel, new object?[] {
|
||||
path,
|
||||
lang,
|
||||
null,
|
||||
}) as ExcelSheet<QuestData>;
|
||||
// default to english if reflection failed
|
||||
sheet ??= this.Plugin.Interface.Data.Excel.GetSheet<QuestData>(path);
|
||||
var firstData = sheet?.GetRow(0);
|
||||
if (firstData != null) {
|
||||
ImGui.PushTextWrapPos(textWrap);
|
||||
ImGui.TextUnformatted(this.Convert(firstData.Text).ToString());
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
void OpenMap(Level? level) {
|
||||
if (level == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var mapLink = new MapLinkPayload(
|
||||
this.Plugin.Interface.Data,
|
||||
level.Territory.Row,
|
||||
level.Map.Row,
|
||||
(int) (level.X * 1_000f),
|
||||
(int) (level.Z * 1_000f)
|
||||
);
|
||||
|
||||
this.Plugin.Interface.Framework.Gui.OpenMapWithMapLink(mapLink);
|
||||
}
|
||||
|
||||
var issuer = this.Plugin.Interface.Data.GetExcelSheet<ENpcResident>().GetRow(quest.IssuerStart)?.Singular ?? "Unknown";
|
||||
var target = this.Plugin.Interface.Data.GetExcelSheet<ENpcResident>().GetRow(quest.TargetEnd)?.Singular ?? "Unknown";
|
||||
ImGui.TextUnformatted(issuer);
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.ArrowRight.ToIconString());
|
||||
ImGui.PopFont();
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(target);
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (Util.IconButton(FontAwesomeIcon.MapMarkerAlt)) {
|
||||
OpenMap(quest.IssuerLocation.Value);
|
||||
}
|
||||
|
||||
Util.Tooltip("Mark issuer on map");
|
||||
|
||||
ImGui.SameLine();
|
||||
if (Util.IconButton(FontAwesomeIcon.Book)) {
|
||||
this.Plugin.Common.Functions.Journal.OpenQuest(quest);
|
||||
}
|
||||
|
||||
Util.Tooltip("Open quest in Journal");
|
||||
|
||||
ImGui.SameLine();
|
||||
if (Util.IconButton(FontAwesomeIcon.ProjectDiagram)) {
|
||||
this.Quest = quest;
|
||||
this._relayout = true;
|
||||
}
|
||||
|
||||
Util.Tooltip("Show quest graph");
|
||||
|
||||
ImGui.End();
|
||||
return !open;
|
||||
}
|
||||
|
||||
private static Vector2 ConvertPoint(Point p) {
|
||||
return new((float) p.X, (float) p.Y);
|
||||
}
|
||||
|
||||
private Vector2 GetTopLeft(GeometryObject item) {
|
||||
// imgui measures from top left as 0,0
|
||||
return ConvertPoint(item.BoundingBox.RightTop) + this._offset;
|
||||
}
|
||||
|
||||
private Vector2 GetBottomRight(GeometryObject item) {
|
||||
return ConvertPoint(item.BoundingBox.LeftBottom) + this._offset;
|
||||
}
|
||||
|
||||
private void DrawGraph(GeometryGraph graph) {
|
||||
// now the fun (tm) begins
|
||||
var space = ImGui.GetContentRegionAvail();
|
||||
var size = new Vector2(space.X, space.Y);
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
|
||||
ImGui.BeginGroup();
|
||||
|
||||
ImGui.InvisibleButton("##NodeEmpty", size);
|
||||
var canvasTopLeft = ImGui.GetItemRectMin();
|
||||
var canvasBottomRight = ImGui.GetItemRectMax();
|
||||
|
||||
if (this.Centre != null) {
|
||||
this._offset = ConvertPoint(this.Centre.Center) * -1 + (canvasBottomRight - canvasTopLeft) / 2;
|
||||
this.Centre = null;
|
||||
}
|
||||
|
||||
drawList.PushClipRect(canvasTopLeft, canvasBottomRight, true);
|
||||
|
||||
drawList.AddRectFilled(canvasTopLeft, canvasBottomRight, Colours.Bg);
|
||||
// ========= GRID =========
|
||||
for (var i = 0; i < size.X / GridSmall; i++) {
|
||||
drawList.AddLine(new Vector2(canvasTopLeft.X + i * GridSmall, canvasTopLeft.Y), new Vector2(canvasTopLeft.X + i * GridSmall, canvasBottomRight.Y), Colours.Grid, 1.0f);
|
||||
}
|
||||
|
||||
for (var i = 0; i < size.Y / GridSmall; i++) {
|
||||
drawList.AddLine(new Vector2(canvasTopLeft.X, canvasTopLeft.Y + i * GridSmall), new Vector2(canvasBottomRight.X, canvasTopLeft.Y + i * GridSmall), Colours.Grid, 1.0f);
|
||||
}
|
||||
|
||||
for (var i = 0; i < size.X / GridLarge; i++) {
|
||||
drawList.AddLine(new Vector2(canvasTopLeft.X + i * GridLarge, canvasTopLeft.Y), new Vector2(canvasTopLeft.X + i * GridLarge, canvasBottomRight.Y), Colours.Grid, 2.0f);
|
||||
}
|
||||
|
||||
for (var i = 0; i < size.Y / GridLarge; i++) {
|
||||
drawList.AddLine(new Vector2(canvasTopLeft.X, canvasTopLeft.Y + i * GridLarge), new Vector2(canvasBottomRight.X, canvasTopLeft.Y + i * GridLarge), Colours.Grid, 2.0f);
|
||||
}
|
||||
|
||||
drawList.AddRect(canvasTopLeft, canvasBottomRight, Colours.Bg2);
|
||||
|
||||
Vector2 ConvertDrawPoint(Point p) {
|
||||
var ret = canvasBottomRight - (ConvertPoint(p) + this._offset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
foreach (var edge in graph.Edges) {
|
||||
var start = canvasBottomRight - this.GetTopLeft(edge);
|
||||
if (IsHidden(edge, start)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var curve = edge.Curve;
|
||||
switch (curve) {
|
||||
case Curve c: {
|
||||
foreach (var s in c.Segments) {
|
||||
switch (s) {
|
||||
case LineSegment l:
|
||||
drawList.AddLine(
|
||||
ConvertDrawPoint(l.Start),
|
||||
ConvertDrawPoint(l.End),
|
||||
Colours.Line,
|
||||
3.0f
|
||||
);
|
||||
break;
|
||||
case CubicBezierSegment cs:
|
||||
drawList.AddBezierCubic(
|
||||
ConvertDrawPoint(cs.B(0)),
|
||||
ConvertDrawPoint(cs.B(1)),
|
||||
ConvertDrawPoint(cs.B(2)),
|
||||
ConvertDrawPoint(cs.B(3)),
|
||||
Colours.Line,
|
||||
3.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case LineSegment l:
|
||||
drawList.AddLine(
|
||||
ConvertDrawPoint(l.Start),
|
||||
ConvertDrawPoint(l.End),
|
||||
Colours.Line,
|
||||
3.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
void DrawArrow(Vector2 start, Vector2 end) {
|
||||
const float arrowAngle = 30f;
|
||||
var dir = end - start;
|
||||
var h = dir;
|
||||
dir /= dir.Length();
|
||||
|
||||
var s = new Vector2(-dir.Y, dir.X);
|
||||
s *= (float) (h.Length() * Math.Tan(arrowAngle * 0.5f * (Math.PI / 180f)));
|
||||
|
||||
drawList.AddTriangleFilled(
|
||||
start + s,
|
||||
end,
|
||||
start - s,
|
||||
Colours.Line
|
||||
);
|
||||
}
|
||||
|
||||
if (edge.ArrowheadAtTarget) {
|
||||
DrawArrow(
|
||||
ConvertDrawPoint(edge.Curve.End),
|
||||
ConvertDrawPoint(edge.EdgeGeometry.TargetArrowhead.TipPosition)
|
||||
);
|
||||
}
|
||||
|
||||
if (edge.ArrowheadAtSource) {
|
||||
DrawArrow(
|
||||
ConvertDrawPoint(edge.Curve.Start),
|
||||
ConvertDrawPoint(edge.EdgeGeometry.SourceArrowhead.TipPosition)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsHidden(GeometryObject node, Vector2 start) {
|
||||
var width = (float) node.BoundingBox.Width;
|
||||
var height = (float) node.BoundingBox.Height;
|
||||
return start.X + width < canvasTopLeft.X
|
||||
|| start.Y + height < canvasTopLeft.Y
|
||||
|| start.X > canvasBottomRight.X
|
||||
|| start.Y > canvasBottomRight.Y;
|
||||
}
|
||||
|
||||
var drawn = new List<(Vector2, Vector2, uint)>();
|
||||
|
||||
foreach (var node in graph.Nodes) {
|
||||
var start = canvasBottomRight - this.GetTopLeft(node);
|
||||
|
||||
if (IsHidden(node, start)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var quest = (Quest) node.UserData;
|
||||
|
||||
var colour = quest.EventIconType.Row switch {
|
||||
1 => Colours.NormalQuest, // normal
|
||||
3 => Colours.MsqQuest, // msq
|
||||
8 => Colours.BlueQuest, // blue
|
||||
10 => Colours.BlueQuest, // also blue
|
||||
_ => Colours.NormalQuest,
|
||||
};
|
||||
var textColour = Colours.Text;
|
||||
|
||||
var completed = this.Plugin.Common.Functions.Journal.IsQuestCompleted(quest.RowId);
|
||||
if (completed) {
|
||||
colour.W = .5f;
|
||||
textColour = (uint) ((0x80 << 24) | (textColour & 0xFFFFFF));
|
||||
}
|
||||
|
||||
var end = canvasBottomRight - this.GetBottomRight(node);
|
||||
|
||||
drawn.Add((start, end, quest.RowId));
|
||||
|
||||
if (quest == this.Quest) {
|
||||
drawList.AddRect(start - Vector2.One, end + Vector2.One, Colours.Line, 5, ImDrawFlags.RoundCornersAll);
|
||||
}
|
||||
|
||||
drawList.AddRectFilled(start, end, ImGui.GetColorU32(colour), 5, ImDrawFlags.RoundCornersAll);
|
||||
drawList.AddText(start + TextOffset, textColour, this.Convert(quest.Name).ToString());
|
||||
}
|
||||
|
||||
// HOW ABOUT DRAGGING THE VIEW?
|
||||
if (ImGui.IsItemActive()) {
|
||||
if (ImGui.IsMouseDragging(ImGuiMouseButton.Left)) {
|
||||
var d = ImGui.GetMouseDragDelta();
|
||||
if (this._viewDrag) {
|
||||
var delta = d - this._lastDragPos;
|
||||
this._offset -= delta;
|
||||
}
|
||||
|
||||
this._viewDrag = true;
|
||||
this._lastDragPos = d;
|
||||
} else {
|
||||
this._viewDrag = false;
|
||||
}
|
||||
} else {
|
||||
if (!this._viewDrag) {
|
||||
var left = ImGui.IsMouseReleased(ImGuiMouseButton.Left);
|
||||
var right = ImGui.IsMouseReleased(ImGuiMouseButton.Right);
|
||||
if (left || right) {
|
||||
var mousePos = ImGui.GetMousePos();
|
||||
foreach (var (start, end, id) in drawn) {
|
||||
var inBox = mousePos.X >= start.X && mousePos.X <= end.X && mousePos.Y >= start.Y && mousePos.Y <= end.Y;
|
||||
if (!inBox) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (left) {
|
||||
this.InfoWindows.Add(id);
|
||||
}
|
||||
|
||||
if (right) {
|
||||
this.Plugin.Common.Functions.Journal.OpenQuest(id);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._viewDrag = false;
|
||||
}
|
||||
|
||||
drawList.PopClipRect();
|
||||
ImGui.EndGroup();
|
||||
// ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 5);
|
||||
}
|
||||
|
||||
private static readonly byte[] NewLinePayload = { 0x02, 0x10, 0x01, 0x03 };
|
||||
|
||||
private SeString Convert(Lumina.Text.SeString lumina) {
|
||||
var se = this.Plugin.Interface.SeStringManager.Parse(lumina.RawData.ToArray());
|
||||
for (var i = 0; i < se.Payloads.Count; i++) {
|
||||
switch (se.Payloads[i].Type) {
|
||||
case PayloadType.Unknown:
|
||||
if (se.Payloads[i].Encode().SequenceEqual(NewLinePayload)) {
|
||||
se.Payloads[i] = new TextPayload("\n");
|
||||
}
|
||||
|
||||
break;
|
||||
case PayloadType.RawText:
|
||||
if (se.Payloads[i] is TextPayload payload) {
|
||||
payload.Text = this.Plugin.Interface.Sanitizer.Sanitize(payload.Text);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return se;
|
||||
}
|
||||
}
|
||||
}
|
51
Quest Map/Quest Map.csproj
Normal file
51
Quest Map/Quest Map.csproj
Normal file
@ -0,0 +1,51 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<RootNamespace>QuestMap</RootNamespace>
|
||||
<Version>1.3.0</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Dalamud">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGui.NET">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGuiScene">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina.Excel">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\System.Memory.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="XivCommon">
|
||||
<HintPath>D:\code\XivCommon\XivCommon\bin\Release\net48\XivCommon.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutomaticGraphLayout" Version="1.1.12"/>
|
||||
<PackageReference Include="DalamudPackager" Version="1.2.1"/>
|
||||
<PackageReference Include="Fody" Version="6.5.2" PrivateAssets="all"/>
|
||||
<PackageReference Include="ILMerge.Fody" Version="1.16.0" PrivateAssets="all"/>
|
||||
<PackageReference Include="System.Threading.Channels" Version="5.0.0"/>
|
||||
<!-- <PackageReference Include="XivCommon" Version="2.2.0" />-->
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
9
Quest Map/Quest Map.yaml
Normal file
9
Quest Map/Quest Map.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
name: Quest Map
|
||||
author: ascclemens
|
||||
description: |-
|
||||
Explore quests and their rewards.
|
||||
- Search for quest names or their rewards, including instances,
|
||||
beast tribes, minions, etc.
|
||||
- See an interactive map of quest requirements and unlocks.
|
||||
- Open a quest info window even for quests you haven't completed.
|
||||
- Open quest starting locations on the map or open quests in the journal.
|
24
Quest Map/QuestData.cs
Normal file
24
Quest Map/QuestData.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Lumina;
|
||||
using Lumina.Data;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Text;
|
||||
|
||||
namespace QuestMap {
|
||||
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
|
||||
internal class QuestData : ExcelRow {
|
||||
#pragma warning disable 8618
|
||||
public string Id { get; set; }
|
||||
public SeString Text { get; set; }
|
||||
#pragma warning restore 8618
|
||||
|
||||
public override void PopulateData(RowParser parser, GameData gameData, Language language) {
|
||||
base.PopulateData(parser, gameData, language);
|
||||
|
||||
this.Id = parser.ReadColumn<string>(0);
|
||||
this.Text = parser.ReadColumn<SeString>(1);
|
||||
}
|
||||
}
|
||||
}
|
312
Quest Map/Quests.cs
Normal file
312
Quest Map/Quests.cs
Normal file
@ -0,0 +1,312 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Channels;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Microsoft.Msagl.Core.Geometry;
|
||||
using Microsoft.Msagl.Core.Geometry.Curves;
|
||||
using Microsoft.Msagl.Core.Layout;
|
||||
using Microsoft.Msagl.Layout.Layered;
|
||||
using Microsoft.Msagl.Miscellaneous;
|
||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||
|
||||
namespace QuestMap {
|
||||
internal class Quests {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
private Dictionary<uint, Node<Quest>> AllNodes { get; }
|
||||
internal IReadOnlyDictionary<uint, List<Item>> ItemRewards { get; }
|
||||
internal IReadOnlyDictionary<uint, Emote> EmoteRewards { get; }
|
||||
internal IReadOnlyDictionary<uint, Action> ActionRewards { get; }
|
||||
internal IReadOnlyDictionary<uint, HashSet<ContentFinderCondition>> InstanceRewards { get; }
|
||||
internal IReadOnlyDictionary<uint, BeastTribe> BeastRewards { get; }
|
||||
internal IReadOnlyDictionary<uint, ClassJob> JobRewards { get; }
|
||||
private ChannelWriter<GraphInfo> GraphChannel { get; }
|
||||
private LayoutAlgorithmSettings LayoutSettings { get; } = new SugiyamaLayoutSettings();
|
||||
|
||||
internal Quests(Plugin plugin, ChannelWriter<GraphInfo> graphChannel) {
|
||||
this.Plugin = plugin;
|
||||
this.GraphChannel = graphChannel;
|
||||
|
||||
var itemRewards = new Dictionary<uint, List<Item>>();
|
||||
var emoteRewards = new Dictionary<uint, Emote>();
|
||||
var actionRewards = new Dictionary<uint, Action>();
|
||||
var instanceRewards = new Dictionary<uint, HashSet<ContentFinderCondition>>();
|
||||
var beastRewards = new Dictionary<uint, BeastTribe>();
|
||||
var jobRewards = new Dictionary<uint, ClassJob>();
|
||||
var linkedInstances = new HashSet<ContentFinderCondition>();
|
||||
|
||||
var allQuests = new Dictionary<uint, Quest>();
|
||||
foreach (var quest in this.Plugin.Interface.Data.GetExcelSheet<Quest>()) {
|
||||
if (quest.Name.RawString.Length == 0 || quest.RowId == 65536) {
|
||||
continue;
|
||||
}
|
||||
|
||||
allQuests[quest.RowId] = quest;
|
||||
|
||||
if (quest.EmoteReward.Row != 0) {
|
||||
emoteRewards[quest.RowId] = quest.EmoteReward.Value;
|
||||
}
|
||||
|
||||
foreach (var row in quest.ItemReward0.Where(item => item != 0)) {
|
||||
var item = this.Plugin.Interface.Data.GetExcelSheet<Item>().GetRow(row);
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Item> rewards;
|
||||
if (itemRewards.TryGetValue(quest.RowId, out var items)) {
|
||||
rewards = items;
|
||||
} else {
|
||||
rewards = new List<Item>();
|
||||
itemRewards[quest.RowId] = rewards;
|
||||
}
|
||||
|
||||
rewards.Add(item);
|
||||
}
|
||||
|
||||
foreach (var row in quest.ItemReward1.Where(item => item.Row != 0)) {
|
||||
var item = row.Value;
|
||||
|
||||
List<Item> rewards;
|
||||
if (itemRewards.TryGetValue(quest.RowId, out var items)) {
|
||||
rewards = items;
|
||||
} else {
|
||||
rewards = new List<Item>();
|
||||
itemRewards[quest.RowId] = rewards;
|
||||
}
|
||||
|
||||
rewards.Add(item);
|
||||
}
|
||||
|
||||
if (quest.ActionReward.Row != 0) {
|
||||
actionRewards[quest.RowId] = quest.ActionReward.Value;
|
||||
}
|
||||
|
||||
var instances = this.InstanceUnlocks(quest, linkedInstances);
|
||||
if (instances.Count > 0) {
|
||||
instanceRewards[quest.RowId] = instances;
|
||||
foreach (var instance in instances) {
|
||||
linkedInstances.Add(instance);
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.BeastTribe.Row != 0 && !quest.IsRepeatable && quest.BeastReputationRank.Row == 0) {
|
||||
beastRewards[quest.RowId] = quest.BeastTribe.Value;
|
||||
}
|
||||
|
||||
var jobReward = this.JobUnlocks(quest);
|
||||
if (jobReward != null) {
|
||||
jobRewards[quest.RowId] = jobReward;
|
||||
}
|
||||
}
|
||||
|
||||
this.ItemRewards = itemRewards;
|
||||
this.EmoteRewards = emoteRewards;
|
||||
this.ActionRewards = actionRewards;
|
||||
this.InstanceRewards = instanceRewards;
|
||||
this.BeastRewards = beastRewards;
|
||||
this.JobRewards = jobRewards;
|
||||
|
||||
var (_, nodes) = Node<Quest>.BuildTree(allQuests);
|
||||
this.AllNodes = nodes;
|
||||
}
|
||||
|
||||
private static readonly Vector2 TextOffset = new(5, 2);
|
||||
|
||||
internal CancellationTokenSource StartGraphRecalculation(ExcelRow quest) {
|
||||
var cts = new CancellationTokenSource();
|
||||
new Thread(async () => {
|
||||
var info = this.GetGraphInfo(quest, cts.Token);
|
||||
if (info != null) {
|
||||
await this.GraphChannel.WriteAsync(info, cts.Token);
|
||||
}
|
||||
}).Start();
|
||||
|
||||
return cts;
|
||||
}
|
||||
|
||||
private GraphInfo? GetGraphInfo(ExcelRow quest, CancellationToken cancel) {
|
||||
if (!this.AllNodes.TryGetValue(quest.RowId, out var first)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var msaglNodes = new Dictionary<uint, Node>();
|
||||
var links = new List<(uint, uint)>();
|
||||
var g = new GeometryGraph();
|
||||
|
||||
void AddNode(Node<Quest> node) {
|
||||
if (msaglNodes.ContainsKey(node.Id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dims = ImGui.CalcTextSize(node.Value.Name.ToString()) + TextOffset * 2;
|
||||
var graphNode = new Node(CurveFactory.CreateRectangle(dims.X, dims.Y, new Point()), node.Value);
|
||||
g.Nodes.Add(graphNode);
|
||||
msaglNodes[node.Id] = graphNode;
|
||||
|
||||
foreach (var parent in node.Parents) {
|
||||
links.Add((parent.Id, node.Id));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var node in first.Traverse()) {
|
||||
if (cancel.IsCancellationRequested) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AddNode(node);
|
||||
}
|
||||
|
||||
foreach (var node in first.Ancestors(this.ConsolidateMsq)) {
|
||||
if (cancel.IsCancellationRequested) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AddNode(node);
|
||||
}
|
||||
|
||||
foreach (var (sourceId, targetId) in links) {
|
||||
if (cancel.IsCancellationRequested) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!msaglNodes.TryGetValue(sourceId, out var source) || !msaglNodes.TryGetValue(targetId, out var target)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var edge = new Edge(source, target);
|
||||
if (this.Plugin.Config.ShowArrowheads) {
|
||||
edge.EdgeGeometry = new EdgeGeometry {
|
||||
TargetArrowhead = new Arrowhead(),
|
||||
};
|
||||
}
|
||||
|
||||
g.Edges.Add(edge);
|
||||
}
|
||||
|
||||
LayoutHelpers.CalculateLayout(g, this.LayoutSettings, null);
|
||||
|
||||
Node? centre = null;
|
||||
if (g.Nodes.Count > 0) {
|
||||
centre = g.Nodes[0];
|
||||
}
|
||||
|
||||
return cancel.IsCancellationRequested
|
||||
? null
|
||||
: new GraphInfo(g, centre);
|
||||
}
|
||||
|
||||
private Quest? ConsolidateMsq(Quest quest) {
|
||||
if (!this.Plugin.Config.CondenseMsq) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var name = quest.RowId switch {
|
||||
66060 => "A Realm Reborn (2.0)",
|
||||
69414 => "A Realm Awoken (2.1)",
|
||||
66899 => "Through the Maelstrom (2.2)",
|
||||
66996 => "Defenders of Eorzea (2.3)",
|
||||
65625 => "Dreams of Ice (2.4)",
|
||||
65965 => "Before the Fall - Part 1 (2.5)",
|
||||
65964 => "Before the Fall - Part 2 (2.55)",
|
||||
67205 => "Heavensward (3.0)",
|
||||
67699 => "As Goes Light, So Goes Darkness (3.1)",
|
||||
67777 => "The Gears of Change (3.2)",
|
||||
67783 => "Revenge of the Horde (3.3)",
|
||||
67886 => "Soul Surrender (3.4)",
|
||||
67891 => "The Far Edge of Fate - Part 1 (3.5)",
|
||||
67895 => "The Far Edge of Fate - Part 2 (3.56)",
|
||||
68089 => "Stormblood (4.0)",
|
||||
68508 => "The Legend Returns (4.1)",
|
||||
68565 => "Rise of a New Sun (4.2)",
|
||||
68612 => "Under the Moonlight (4.3)",
|
||||
68685 => "Prelude in Violet (4.4)",
|
||||
68719 => "A Requiem for Heroes - Part 1 (4.5)",
|
||||
68721 => "A Requiem for Heroes - Part 2 (4.56)",
|
||||
69190 => "Shadowbringers (5.0)",
|
||||
69218 => "Vows of Virtue, Deeds of Cruelty (5.1)",
|
||||
69306 => "Echoes of a Fallen Star (5.2)",
|
||||
69318 => "Reflections in Crystal (5.3)",
|
||||
69552 => "Futures Rewritten (5.4)",
|
||||
69599 => "Death Unto Dawn - Part 1 (5.5)",
|
||||
69602 => "Death Unto Dawn - Part 2 (5.55)",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var newQuest = new Quest();
|
||||
foreach (var property in newQuest.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)) {
|
||||
property.SetValue(newQuest, property.GetValue(quest));
|
||||
}
|
||||
|
||||
newQuest.Name = new Lumina.Text.SeString($"{name} MSQ");
|
||||
return newQuest;
|
||||
}
|
||||
|
||||
private HashSet<ContentFinderCondition> InstanceUnlocks(Quest quest, ICollection<ContentFinderCondition> others) {
|
||||
if (quest.IsRepeatable) {
|
||||
return new HashSet<ContentFinderCondition>();
|
||||
}
|
||||
|
||||
var unlocks = new HashSet<ContentFinderCondition>();
|
||||
|
||||
if (quest.InstanceContentUnlock.Row != 0) {
|
||||
var cfc = this.Plugin.Interface.Data.GetExcelSheet<ContentFinderCondition>().FirstOrDefault(cfc => cfc.Content == quest.InstanceContentUnlock.Row && cfc.ContentLinkType == 1);
|
||||
if (cfc != null && cfc.UnlockQuest.Row == 0) {
|
||||
unlocks.Add(cfc);
|
||||
}
|
||||
}
|
||||
|
||||
var instanceRefs = quest.ScriptInstruction
|
||||
.Zip(quest.ScriptArg, (ins, arg) => (ins, arg))
|
||||
.Where(x => x.ins.RawString.StartsWith("INSTANCEDUNGEON"));
|
||||
|
||||
foreach (var reference in instanceRefs) {
|
||||
var key = reference.arg;
|
||||
|
||||
// var content = this.Plugin.Interface.Data.GetExcelSheet<InstanceContent>().GetRow(key);
|
||||
|
||||
var cfc = this.Plugin.Interface.Data.GetExcelSheet<ContentFinderCondition>().FirstOrDefault(cfc => cfc.Content == key && cfc.ContentLinkType == 1);
|
||||
if (cfc == null || cfc.UnlockQuest.Row != 0 || others.Contains(cfc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!quest.ScriptInstruction.Any(i => i.RawString == "UNLOCK_ADD_NEW_CONTENT_TO_CF" || i.RawString.StartsWith("UNLOCK_DUNGEON"))) {
|
||||
if (quest.ScriptInstruction.Any(i => i.RawString.StartsWith("LOC_ITEM"))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
unlocks.Add(cfc);
|
||||
}
|
||||
|
||||
return unlocks;
|
||||
}
|
||||
|
||||
private ClassJob? JobUnlocks(Quest quest) {
|
||||
if (quest.ClassJobUnlock.Row > 0) {
|
||||
return quest.ClassJobUnlock.Value;
|
||||
}
|
||||
|
||||
if (quest.ScriptInstruction.All(ins => ins.RawString.StartsWith("UNLOCK_IMAGE_CLASS"))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var jobId = quest.ScriptInstruction
|
||||
.Zip(quest.ScriptArg, (ins, arg) => (ins, arg))
|
||||
.FirstOrDefault(entry => entry.ins.RawString.StartsWith("CLASSJOB"))
|
||||
.arg;
|
||||
return jobId == 0
|
||||
? null
|
||||
: this.Plugin.Interface.Data.GetExcelSheet<ClassJob>().GetRow(jobId);
|
||||
}
|
||||
}
|
||||
}
|
31
Quest Map/Util.cs
Normal file
31
Quest Map/Util.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace QuestMap {
|
||||
internal static class Util {
|
||||
internal static bool IconButton(FontAwesomeIcon icon, string? id = null) {
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
|
||||
var label = icon.ToIconString();
|
||||
if (id != null) {
|
||||
label += $"##{id}";
|
||||
}
|
||||
|
||||
var ret = ImGui.Button(label);
|
||||
|
||||
ImGui.PopFont();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal static void Tooltip(string tooltip) {
|
||||
if (!ImGui.IsItemHovered()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted(tooltip);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
7
Quest Map/Visibility.cs
Normal file
7
Quest Map/Visibility.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace QuestMap {
|
||||
internal enum Visibility {
|
||||
Hidden,
|
||||
Visible,
|
||||
Only,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user