Quantcast

Initial commit

Alar of Daggerspine [11-18-14 - 08:37]
Initial commit

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
.gitignore
.pkgmeta
CHANGELOG.txt
GarrisonCommander.lua
GarrisonCommander.toc
GarrisonCommander.xml
RelNotes.lua
embeds.xml
localization.lua
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+
diff --git a/.pkgmeta b/.pkgmeta
new file mode 100755
index 0000000..8d337a7
--- /dev/null
+++ b/.pkgmeta
@@ -0,0 +1,18 @@
+package-as: GarrisonCommander
+enable-nolib-creation: no
+
+externals:
+	libs/AlarShared-3.0:
+		url: git://git.curseforge.net/wow/alar-art-remover/mainline.git/libs/AlarShared-3.0
+	libs/Ace3:
+		url: svn://svn.wowace.com/wow/ace3/mainline/trunk
+		tag: latest
+
+manual-changelog:
+		filename: CHANGELOG.txt
+		markup-type: creole
+
+
+ignore:
+- .buildpath
+- .project
\ No newline at end of file
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 0000000..6b8f5ec
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,9 @@
+= GarrisonCommander helps you when choosing the right follower for the right mission =
+== Description ==
+GarrisonCommander adds to mission tooltips the following informations:
+* base success chance
+* list of follower that have the necessary counters for the mission, with their status (on mission, available etc)
+
+== Future plans ==
+# Showing information in an overlay on mission buttons to have all needed information for all missions at a glance
+# Mission assign optimizer: I think I could also propone the best assignment to maximise your chances of success
diff --git a/GarrisonCommander.lua b/GarrisonCommander.lua
new file mode 100644
index 0000000..75de59d
--- /dev/null
+++ b/GarrisonCommander.lua
@@ -0,0 +1,87 @@
+local __FILE__=tostring(debugstack(1,2,0):match("(.*):1:")) -- MUST BE LINE 1
+local toc=select(4,GetBuildInfo())
+local me, ns = ...
+local pp=print
+if (LibDebug) then LibDebug() end
+local L=LibStub("AceLocale-3.0"):GetLocale(me,true)
+local C=LibStub("AlarCrayon-3.0"):GetColorTable()
+local addon=LibStub("AlarLoader-3.0")(__FILE__,me,ns):CreateAddon(me,true) --#Addon
+local print=ns.print or print
+local debug=ns.debug or print
+--@debug@
+ns.debugEnable('on')
+--@end-debug@
+-----------------------------------------------------------------
+local followerIndexes
+local followers
+function addon:dump(...)
+	print("dump",...)
+end
+function addon:TooltipAdder(missionID)
+--@debug@
+	GameTooltip:AddLine("ID:" .. tostring(missionID))
+--@end-debug@
+	local _,_,_,perc=C_Garrison.GetPartyMissionInfo(missionID)
+	local difficulty='impossible'
+	if (perc > 99) then
+			difficulty='trivial'
+	elseif(perc >64) then
+			difficulty='standard'
+	elseif (perc >49) then
+			difficulty='difficult'
+	elseif(perc>34) then
+			difficulty='verydifficult'
+	end
+	local q=QuestDifficultyColors[difficulty]
+	GameTooltip:AddLine(format(GARRISON_MISSION_PERCENT_CHANCE,perc),q.r,q.g,q.b)
+	GameTooltip:AddLine(GARRISON_FOLLOWER_CAN_COUNTER)
+	local buffed=self:NewTable()
+	for id,d in pairs(C_Garrison.GetBuffedFollowersForMission(missionID)) do
+		buffed[id]=true
+	end
+	local followerList=GarrisonMissionFrameFollowers.followersList
+	for j=1,#followerList do
+		local index=followerList[j]
+		local follower=followers[index]
+		if (not follower.garrFollowerID) then return end
+		local b=buffed[follower.followerID]
+		if (b) then
+			if (follower.status) then
+				GameTooltip:AddDoubleLine(follower.name, follower.status or AVAILABLE,1,1,0,1,0,0)
+			else
+				GameTooltip:AddDoubleLine(follower.name, follower.status or AVAILABLE,1,1,0,0,1,0)
+			end
+		end
+	end
+	self:DelTable(buffed)
+end
+function addon:FillFollowersList()
+	if (GarrisonFollowerList_UpdateFollowers) then
+		GarrisonFollowerList_UpdateFollowers(GarrisonMissionFrame.FollowerList)
+	end
+end
+function addon:CacheFollowers()
+	followers=C_Garrison.GetFollowers()
+end
+
+function addon:OnInitialized()
+	self:FillFollowersList()
+	self:CacheFollowers()
+end
+function addon:OnDisabled()
+	self:UnhookAll()
+end
+local hooks={
+	"GarrisonMissionList_Update",
+	"GarrisonMissionButton_OnEnter",
+	"GarrisonFollowerList_OnShow",
+}
+function addon:OnEnabled()
+
+	for _,f in pairs(hooks) do
+		self[f]=function(...) debug(f,...) end
+		self:SecureHook(f,f)
+	end
+	self:SecureHook("GarrisonMissionButton_AddThreatsToTooltip","TooltipAdder")
+	self:SecureHook("GarrisonFollowerList_UpdateFollowers","CacheFollowers")
+end
diff --git a/GarrisonCommander.toc b/GarrisonCommander.toc
new file mode 100644
index 0000000..623a977
--- /dev/null
+++ b/GarrisonCommander.toc
@@ -0,0 +1,29 @@
+## Interface: 60000
+## Title: Alar:GarrisonCommander
+## Notes: Helps you when choosing the right follower for the right mission
+## Notes-itIT: Ti aiuta a scegliere il giusto seguace per la giusta missione
+## Author: Alar of Daggerspine
+## Version: @project-version@ @project-abbreviated-hash@
+## X-Version: 1.0.0
+## X-Revision: @project-abbreviated-hash@
+## eMail: alar@aspide.it
+## URL: http://wow.aspide.it
+## RequiredDeps: Blizzard_GarrisonUI
+## OptionalDeps: AlarArtRemover
+## DefaultState: Enabled
+## LoadOnDemand: 1
+## LoadWith: Blizzard_GarrisonUI
+## SavedVariables: dbGAC
+## X-ID: GAC
+## X-Database:dbGAC
+## X-Category: Garrison
+## X-ID: MRF
+## X-Database: dbMRF
+## X-License: GPL v3
+## X-eMail: alar@aspide.it
+## X-Date: @project-date-iso@
+## X-Embeds:
+embeds.xml
+localization.lua
+GarrisonCommander.xml
+RelNotes.lua
diff --git a/GarrisonCommander.xml b/GarrisonCommander.xml
new file mode 100644
index 0000000..0ead230
--- /dev/null
+++ b/GarrisonCommander.xml
@@ -0,0 +1,27 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+..\FrameXML\UI.xsd">
+
+	<Script file="GarrisonCommander.lua"/>
+
+	<CheckButton name="GarrisonFrame" parent="UIParent" movable="true" enableMouse="true" clampedToScreen="true" inherits="LootWonALertFrameTemplate">
+		<Anchors>
+			<Anchor point="CENTER" x="0" y="300"/>
+		</Anchors>
+		<Scripts>
+			<OnLoad>
+				self:RegisterForDrag("LeftButton")
+				self:RegisterForClicks("AnyUp")
+			</OnLoad>
+			<OnDragStart>
+				self:StartMoving()
+			</OnDragStart>
+			<OnDragStop>
+				self:SetopMovingOrSizing()
+			</OnDragStop>
+			<OnLeave>
+				GameTooltip:Hide()
+				ResetCursor()
+			</OnLeave>
+		</Scripts>
+	</CheckButton>
+</Ui>
\ No newline at end of file
diff --git a/RelNotes.lua b/RelNotes.lua
new file mode 100644
index 0000000..019cf24
--- /dev/null
+++ b/RelNotes.lua
@@ -0,0 +1,23 @@
+local me,ns=...
+local L=LibStub("AceLocale-3.0"):GetLocale(me,true)
+local hlp=LibStub("AceAddon-3.0"):GetAddon(me)
+function hlp:loadHelp()
+self:HF_Title(me,"RELNOTES")
+self:HF_Paragraph("Description")
+self:HF_Pre([[
+= GarrisonCommander helps you when choosing the right follower for the right mission =
+== Description ==
+GarrisonCommander adds to mission tooltips the following informations:
+* base success chance
+* list of follower that have the necessary counters for the mission, with their status (on mission, available etc)
+
+== Future plans ==
+# Showing information in an overlay on mission buttons to have all needed information for all missions at a glance
+# Mission assign optimizer: I think I could also propone the best assignment to maximise your chances of success
+
+]])
+self:RelNotes(1,0,0,[[
+Initial release
+]])
+end
+
diff --git a/embeds.xml b/embeds.xml
new file mode 100644
index 0000000..f2706c1
--- /dev/null
+++ b/embeds.xml
@@ -0,0 +1,17 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file="libs\Ace3\LibStub\LibStub.lua"/>
+	<Include file="libs\Ace3\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
+	<Include file="libs\Ace3\AceAddon-3.0\AceAddon-3.0.xml"/>
+	<Include file="libs\Ace3\AceHook-3.0\AceHook-3.0.xml"/>
+	<Include file="libs\Ace3\AceEvent-3.0\AceEvent-3.0.xml"/>
+	<Include file="libs\Ace3\AceTimer-3.0\AceTimer-3.0.xml"/>
+	<Include file="libs\Ace3\AceConsole-3.0\AceConsole-3.0.xml"/>
+	<Include file="libs\Ace3\AceLocale-3.0\AceLocale-3.0.xml"/>
+	<Include file="libs\Ace3\AceGUI-3.0\AceGUI-3.0.xml"/>
+	<Include file="libs\Ace3\AceConfig-3.0\AceConfig-3.0.xml"/>
+	<Include file="libs\Ace3\AceDB-3.0\AceDB-3.0.xml"/>
+	<Include file="libs\Ace3\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
+	<Include file="libs\AlarShared-3.0\lib.xml"/>
+	<Include file="libs\LibDeformat-3.0\lib.xml"/>
+	<Include file="libs\LibItemUpgradeInfo-1.0\LibItemUpgradeInfo-1.0.xml"/>
+</Ui>
diff --git a/localization.lua b/localization.lua
new file mode 100644
index 0000000..5c78b5f
--- /dev/null
+++ b/localization.lua
@@ -0,0 +1,55 @@
+local me,ns=...
+local lang=GetLocale()
+local l=LibStub("AceLocale-3.0")
+local L=l:NewLocale(me,"enUS",true,true)
+--@localization(locale="enUS", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+L=l:NewLocale(me,"ptBR")
+if (L) then
+--@localization(locale="ptBR", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"frFR")
+if (L) then
+--@localization(locale="frFR", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"deDE")
+if (L) then
+--@localization(locale="deDE", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"itIT")
+if (L) then
+--@localization(locale="itIT", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"koKR")
+if (L) then
+--@localization(locale="koKR", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"esMX")
+if (L) then
+--@localization(locale="esMX", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"ruRU")
+if (L) then
+--@localization(locale="ruRU", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"zhCN")
+if (L) then
+--@localization(locale="zhCN", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"esES")
+if (L) then
+--@localization(locale="esES", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
+L=l:NewLocale(me,"zhTW")
+if (L) then
+--@localization(locale="zhTW", format="lua_additive_table" , escape-non-ascii=true, same-key-is-true=true, handle-unlocalized="blank" )@
+return
+end
\ No newline at end of file