Mercurial > wow > wowdb-profiler
comparison Main.lua @ 121:ea4e4d3cc673
Removed some unused fields from action_data - renamed two for clarity.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 17 Sep 2012 14:19:23 -0500 |
parents | 8df432f8a15a |
children | 3c47401c3407 |
comparison
equal
deleted
inserted
replaced
120:6f844e166ea3 | 121:ea4e4d3cc673 |
---|---|
111 | 111 |
112 ----------------------------------------------------------------------- | 112 ----------------------------------------------------------------------- |
113 -- Local variables. | 113 -- Local variables. |
114 ----------------------------------------------------------------------- | 114 ----------------------------------------------------------------------- |
115 local anvil_spell_ids = {} | 115 local anvil_spell_ids = {} |
116 local action_data = {} | |
117 local currently_drunk | 116 local currently_drunk |
118 local db | 117 local db |
119 local durability_timer_handle | 118 local durability_timer_handle |
120 local faction_standings = {} | 119 local faction_standings = {} |
121 local forge_spell_ids = {} | 120 local forge_spell_ids = {} |
123 local name_to_id_map = {} | 122 local name_to_id_map = {} |
124 local reputation_npc_id | 123 local reputation_npc_id |
125 local target_location_timer_handle | 124 local target_location_timer_handle |
126 local current_target_id | 125 local current_target_id |
127 | 126 |
127 ----------------------------------------------------------------------- | |
128 -- Data for our current action. Including possible values as a reference. | |
129 ----------------------------------------------------------------------- | |
130 local action_data = { | |
131 identifier = nil, | |
132 loot_label = nil, | |
133 loot_list = nil, | |
134 loot_sources = nil, | |
135 map_level = nil, | |
136 spell_label = nil, | |
137 type = nil, | |
138 x = nil, | |
139 y = nil, | |
140 zone_data = nil, | |
141 | |
142 } | |
128 | 143 |
129 ----------------------------------------------------------------------- | 144 ----------------------------------------------------------------------- |
130 -- Helper Functions. | 145 -- Helper Functions. |
131 ----------------------------------------------------------------------- | 146 ----------------------------------------------------------------------- |
132 local ActualCopperCost | 147 local ActualCopperCost |
439 table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) | 454 table.insert(loot_table, ("%d:%d"):format(item_id, quantity)) |
440 end | 455 end |
441 end | 456 end |
442 end | 457 end |
443 end | 458 end |
444 -- TODO: Remove this when GetLootSourceInfo() has values for money | 459 |
460 -- This is used for Gas Extractions. | |
445 if #action_data.loot_list <= 0 then | 461 if #action_data.loot_list <= 0 then |
446 return | 462 return |
447 end | 463 end |
448 local entry | 464 local entry |
449 | 465 |
450 -- At this point we only have a name if it's an object. | 466 -- At this point we only have a name if it's an object. |
451 if action_data.type == AF.OBJECT then | 467 if action_data.type == AF.OBJECT then |
452 entry = DBEntry(data_type, ("%s:%s"):format(action_data.spell_label, action_data.target_name)) | 468 entry = DBEntry(data_type, ("%s:%s"):format(action_data.spell_label, action_data.object_name)) |
453 else | 469 else |
454 entry = DBEntry(data_type, action_data.identifier) | 470 entry = DBEntry(data_type, action_data.identifier) |
455 end | 471 end |
456 | 472 |
457 if not entry then | 473 if not entry then |
650 name_to_id_map[_G.UnitName("target")] = unit_idnum | 666 name_to_id_map[_G.UnitName("target")] = unit_idnum |
651 | 667 |
652 table.wipe(action_data) | 668 table.wipe(action_data) |
653 action_data.type = AF.NPC | 669 action_data.type = AF.NPC |
654 action_data.identifier = unit_idnum | 670 action_data.identifier = unit_idnum |
655 action_data.npc_level = npc_level | |
656 return npc, unit_idnum | 671 return npc, unit_idnum |
657 end | 672 end |
658 end -- do-block | 673 end -- do-block |
659 | 674 |
660 | 675 |
1595 | 1610 |
1596 action_data.instance_token = instance_token | 1611 action_data.instance_token = instance_token |
1597 action_data.map_level = map_level | 1612 action_data.map_level = map_level |
1598 action_data.x = x | 1613 action_data.x = x |
1599 action_data.y = y | 1614 action_data.y = y |
1600 action_data.zone = ("%s:%d"):format(zone_name, area_id) | 1615 action_data.zone_data = ("%s:%d"):format(zone_name, area_id) |
1601 action_data.spell_label = spell_label | 1616 action_data.spell_label = spell_label |
1602 | 1617 |
1603 if not private.NON_LOOT_SPELL_LABELS[spell_label] then | 1618 if not private.NON_LOOT_SPELL_LABELS[spell_label] then |
1604 action_data.loot_label = spell_label:lower() | 1619 action_data.loot_label = spell_label:lower() |
1605 end | 1620 end |
1608 if bit.band(spell_flags, AF.NPC) == AF.NPC then | 1623 if bit.band(spell_flags, AF.NPC) == AF.NPC then |
1609 if not tt_unit_id or tt_unit_name ~= target_name then | 1624 if not tt_unit_id or tt_unit_name ~= target_name then |
1610 return | 1625 return |
1611 end | 1626 end |
1612 action_data.type = AF.NPC | 1627 action_data.type = AF.NPC |
1613 action_data.unit_name = tt_unit_name | |
1614 end | 1628 end |
1615 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then | 1629 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then |
1616 action_data.type = AF.ITEM | 1630 action_data.type = AF.ITEM |
1617 | 1631 |
1618 if tt_item_name and tt_item_name == target_name then | 1632 if tt_item_name and tt_item_name == target_name then |
1620 elseif target_name and target_name ~= "" then | 1634 elseif target_name and target_name ~= "" then |
1621 local _, target_item_link = _G.GetItemInfo(target_name) | 1635 local _, target_item_link = _G.GetItemInfo(target_name) |
1622 action_data.identifier = ItemLinkToID(target_item_link) | 1636 action_data.identifier = ItemLinkToID(target_item_link) |
1623 end | 1637 end |
1624 elseif not tt_item_name and not tt_unit_name then | 1638 elseif not tt_item_name and not tt_unit_name then |
1625 action_data.name = target_name | |
1626 | |
1627 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then | 1639 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then |
1628 if target_name == "" then | 1640 if target_name == "" then |
1629 return | 1641 return |
1630 end | 1642 end |
1631 action_data.target_name = target_name | 1643 action_data.object_name = target_name |
1632 action_data.type = AF.OBJECT | 1644 action_data.type = AF.OBJECT |
1633 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then | 1645 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then |
1634 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. | 1646 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. |
1635 action_data.zone_data = UpdateDBEntryLocation("zones", identifier) | 1647 action_data.zone_data = UpdateDBEntryLocation("zones", identifier) |
1636 action_data.type = AF.ZONE | 1648 action_data.type = AF.ZONE |