vrtc / flowerpicker (public) (License: GPLv3) (since 2019-11-07) (hash sha1)
Flowerpicker is a GUI extension, that is an add-on, for World of Warcraft game client. It is under development and not yet ready for usage by players.
List of commits:
Subject Hash Author Date (UTC)
Add world resource node harvest registration 2c7e1542abf677efc70a616291921f92ed9c04dd Vladyslav Bondarenko 2019-11-07 12:16:39
Update registration of money operations f0b4ec71099900dd51b5a4c35ce688586d6ddbfe Vladyslav Bondarenko 2019-11-06 19:49:01
Add basic money income via looting registration 9cfb08138268bb6985db1729c160b444a5e4e56a Vladyslav Bondarenko 2019-11-06 14:07:53
Update event format 554e63f3490dc48befe37fbfacf5c8c9ad188451 Vladyslav Bondarenko 2019-11-06 09:59:18
Initial commit f014031ddd4b2422ef5d000f33ad6602e64c9b36 Vladyslav Bondarenko 2019-11-05 20:29:14
Commit 2c7e1542abf677efc70a616291921f92ed9c04dd - Add world resource node harvest registration
When a player character harvests a resource node in the world,
for example a herb with herbalism or a ore node with mining,
an appropriate event is registered. It includes according
event type designation, looted item name and quantity, as well as
the name of the resource node harvested. This new functionality
was only tested with herbalism so far.

It is expected that opening of chests or crates by a player character
in the game to be handled similarly.

Fishing might be handled incorrectly or produce errors
after this update.

Events registered by the add-on are serialised as a Lua table literal.
Specifically, each event is represented as a Lua table with
a numerical index, instead of a string map. This was done this way
in a hope that export to CSV format will become more trivial.
However, the need to extend the number of properties per an event
arises. For example, only the looted item's localised name is
insufficient for practical analysis. Therefore, registry format
revision might be required.
Author: Vladyslav Bondarenko
Author date (UTC): 2019-11-07 12:16
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2019-11-07 12:16
Parent(s): 5e1ecc5da389bd13d2d882832515a03163810618
Signing key:
Tree: eec0e7652438923ee8ba7dfc7a73d1770e65f518
File Lines added Lines deleted
Flowerpicker.lua 30 6
File Flowerpicker.lua changed (mode: 100644) (index f617c8e..e40a7e3)
... ... local function isPermissibleSpellToProduceLoot(spellName)
218 218
219 219 if 'Fishing' == n then if 'Fishing' == n then
220 220 result = true result = true
221 elseif 'Herbalism' == n then
221 elseif 'Herb Gathering' == n then
222 222 result = true result = true
223 223 end end
224 224
 
... ... local function mapSpellNameToHarvestTypeDesignation(spellName)
261 261 assert (validateAnyName(s)) assert (validateAnyName(s))
262 262 local t = nil local t = nil
263 263
264 if 'Herbalism' == s then
264 if 'Herb Gathering' == s then
265 265 t = 'HERBALISM' t = 'HERBALISM'
266 266 elseif 'Fishing' == s then elseif 'Fishing' == s then
267 267 t = 'FISHING' t = 'FISHING'
 
... ... local function mapSpellNameToHarvestTypeDesignation(spellName)
269 269 t = string.upper(s) t = string.upper(s)
270 270 end end
271 271
272 assert (validateEnum(s, getPermissibleHarvestTypeSet()))
272 assert (validateEnum(t, getPermissibleHarvestTypeSet()))
273 273 return t return t
274 274 end end
275 275
 
... ... local function registerMoneyGainFromCorpse(moneyAmount, corpseName)
416 416 persistEventHarvest(e) persistEventHarvest(e)
417 417 end end
418 418
419 local function registerLootGainFromResourceNode(itemName, itemQuantity, resourceNodeName, harvestTypeDesignation)
420 local e = createEventHarvestWithDefaults(harvestTypeDesignation, resourceNodeName, itemName, itemQuantity)
421 persistEventHarvest(e)
422 end
423
419 424 local function processLoot(lootCache, slotId, lastSpellCastName, lootedCorpseGuessedName, playerMoneyDiff) local function processLoot(lootCache, slotId, lastSpellCastName, lootedCorpseGuessedName, playerMoneyDiff)
420 425 local spellName = sanitiseAnyName(lastSpellCastName) local spellName = sanitiseAnyName(lastSpellCastName)
421 426 local d local d
 
... ... local function processLoot(lootCache, slotId, lastSpellCastName, lootedCorpseGue
467 472 table.insert(FlowerpickerSavedVariables, e) table.insert(FlowerpickerSavedVariables, e)
468 473 end end
469 474
470 local function handleLootSlotCleared(lootCache, slotId, someSpellName, someCorpseName)
475 local function handleLootSlotCleared(lootCache, slotId, someSpellName, someCorpseName, someVictimName)
471 476 assert (lootCache ~= nil) assert (lootCache ~= nil)
472 477 assert ('table' == type(lootCache)) assert ('table' == type(lootCache))
473 478 assert (slotId ~= nil) assert (slotId ~= nil)
 
... ... local function handleLootSlotCleared(lootCache, slotId, someSpellName, someCorps
480 485 --[[ See `handlePlayerMoney` function. ]]-- --[[ See `handlePlayerMoney` function. ]]--
481 486 return return
482 487 elseif isPermissibleSpellToProduceLoot(sp) then elseif isPermissibleSpellToProduceLoot(sp) then
483 error('TODO')
488 local lootedItem = getCachedItemInfo(lootCache, slotId)
489 assert (lootedItem ~= nil)
490 assert ('table' == type(lootedItem))
491
492 i = sanitiseAnyName(lootedItem[2])
493 assert (validateAnyName(i))
494 q = sanitiseShort(lootedItem[3])
495 assert (validatePositiveAndNonZero(q))
496
497 local d = mapSpellNameToHarvestTypeDesignation(sp)
498 assert (validateAnyName(d))
499 assert (validateEnum(d, getPermissibleHarvestTypeSet()))
500 local s = sanitiseAnyName(someVictimName)
501 assert (validateAnyName(s))
502
503 registerLootGainFromResourceNode(i, q, s, d)
484 504 elseif true == validateAnyName(cr) then elseif true == validateAnyName(cr) then
485 505 local lootedItem = getCachedItemInfo(lootCache, slotId) local lootedItem = getCachedItemInfo(lootCache, slotId)
486 506 assert (lootedItem ~= nil) assert (lootedItem ~= nil)
 
... ... local function main(self, event, arg1, arg2, arg3, arg4, arg5)
530 550 local spellName = sanitiseAnyName(arg2) local spellName = sanitiseAnyName(arg2)
531 551 self.api.lastSpellCastName = spellName self.api.lastSpellCastName = spellName
532 552 end end
553 elseif 'UNIT_SPELLCAST_SENT' == event then
554 self.api.lastSpellTargetName = sanitiseAnyName(arg4)
533 555 elseif 'LOOT_OPENED' == event then elseif 'LOOT_OPENED' == event then
534 556 updateLootCache(FlowerpickerLootCache) updateLootCache(FlowerpickerLootCache)
535 557 if (1 == UnitIsDead('target')) then if (1 == UnitIsDead('target')) then
 
... ... local function main(self, event, arg1, arg2, arg3, arg4, arg5)
545 567 assert ('table' == type(lootCache)) assert ('table' == type(lootCache))
546 568 local lastSpellCastName = sanitiseAnyName(self.api.lastSpellCastName) local lastSpellCastName = sanitiseAnyName(self.api.lastSpellCastName)
547 569 local corpseName = sanitiseAnyName(self.api.lastLootedCorpseName) local corpseName = sanitiseAnyName(self.api.lastLootedCorpseName)
570 local nodeName = sanitiseAnyName(self.api.lastSpellTargetName)
548 571 self.api.lootSlotId = slotId self.api.lootSlotId = slotId
549 handleLootSlotCleared(lootCache, slotId, lastSpellCastName, corpseName)
572 handleLootSlotCleared(lootCache, slotId, lastSpellCastName, corpseName, nodeName)
550 573 elseif 'LOOT_CLOSED' == event then elseif 'LOOT_CLOSED' == event then
551 574 clearLootCache(FlowerpickerLootCache) clearLootCache(FlowerpickerLootCache)
552 575 self.api.lootSlotId = nil self.api.lootSlotId = nil
 
... ... local function init()
610 633
611 634 addonFrame:UnregisterEvent('ADDON_LOADED') addonFrame:UnregisterEvent('ADDON_LOADED')
612 635 addonFrame:RegisterEvent('UNIT_SPELLCAST_SUCCEEDED') addonFrame:RegisterEvent('UNIT_SPELLCAST_SUCCEEDED')
636 addonFrame:RegisterEvent('UNIT_SPELLCAST_SENT')
613 637 addonFrame:RegisterEvent('LOOT_OPENED') addonFrame:RegisterEvent('LOOT_OPENED')
614 638 addonFrame:RegisterEvent('LOOT_SLOT_CLEARED') addonFrame:RegisterEvent('LOOT_SLOT_CLEARED')
615 639 addonFrame:RegisterEvent('LOOT_CLOSED') addonFrame:RegisterEvent('LOOT_CLOSED')
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/flowerpicker

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/flowerpicker

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/flowerpicker

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main