Skip to content

Commit

Permalink
Unifies lore tracking systems for waypoints, despawns and spam control
Browse files Browse the repository at this point in the history
Fixes bugs related to those lists becoming desynched
  • Loading branch information
Earthfiredrake committed Jun 26, 2017
1 parent 0d1d87b commit 3d38f88
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 190 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ The update system *should* carry forward settings from v0.4.0-beta onwards. Howe
If upgrading from v0.1.1-alpha, a clean reinstall is recommended. Remove the existing mod entirely and login to the game to clear any existing settings before installing a more recent version.

## Change Log
Version 1.1.2
+ Unifies lore tracking and waypoints, should no longer forget to provide despawn notifications

Version 1.1.0
+ Setting migration from versions prior to v1.0.0 no longer supported
+ Onscreen flags at detected lore locations!
Expand Down Expand Up @@ -99,8 +102,6 @@ Version 0.1.1-alpha
The following issues are known to exist in the most recent release:
+ There appear to be seven uncategorized lore IDs somewhere in the game
+ Three of these are believed to be event related and unavailable at the moment
+ Occasionally partially forgets that it's tracking lore drops, any waypoints remain but despawn notifications and the tooltip tracking list lose track of it.
+ Only noticed this with a particularly drop heavy padurii farm. Fairly unimportant, particularly as the waypoints make despawn tracking less vital.
+ Sometimes misses lore pickups already within the detection range when zoning into a new map
+ "Fixing" this causes cascading strange behaviours as it detects things halfway through loading the map. While these can, mostly, be corrected, I'm not convinced it's worth the time.
+ Text field labels are truncated to fixed sizes
Expand All @@ -109,6 +110,10 @@ The following issues are known to exist in the most recent release:
+ A brief lag may be observed after reloading the ui, where the full size icon is displayed rather than attached to the topbar
+ This is intentional and reduces the occurence of bugs related to other mods integrating with the topbar

This version of the mod has been lightly tested in SWL and found to work with the following known caveats:
+ It does not integrate with the default top-bar
+ GUI editing is not currently working, so the icon cannot be moved or resized

## Testing and Further Developments
I'm relatively satisfied with the features that exist, and will continue providing basic support for bug fixes and updates to files if needed. However, due to the current situation, I am unlikely to get around to implementing the remaining features or attempting to port to SWL until more information is available:
+ More flexible alert settings, at the category level
Expand Down
85 changes: 85 additions & 0 deletions efd/LoreHound/LoreData.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2017, Earthfiredrake (Peloprata)
// Released under the terms of the MIT License
// https://github.com/Earthfiredrake/TSW-LoreHound

import com.GameInterface.Game.Dynel;
import com.GameInterface.Lore;
import com.GameInterface.LoreNode;
import com.Utils.ID32;

// Helper data structure for detected lore dynel information

class efd.LoreHound.LoreData {
// Category flags for identifiable lore types
public static var ef_LoreType_None:Number = 0;
public static var ef_LoreType_Placed:Number = 1 << 0; // Most lore with fixed locations
public static var ef_LoreType_Trigger:Number = 1 << 1; // Lore with triggered spawn conditions, seems to stay spawned once triggered (often after dungeon bosses)
public static var ef_LoreType_Drop:Number = 1 << 2; // Lore which drops from monsters, or otherwise spawns with a time limit
public static var ef_LoreType_Despawn:Number = 1 << 3; // Special type for generating despawn messages (will be output as Drop lore)
public static var ef_LoreType_Uncategorized:Number = 1 << 4; // Newly detected lore, will need to be catalogued
public static var ef_LoreType_All:Number = (1 << 5) - 1;

public function LoreData(dynel:Dynel, formatStrID:Number, type:Number) {
// The dynel will be invalid when the lore tracking callbacks are disabled
// Caches useful values prior to this
DynelInst = dynel;
DynelID = dynel.GetID();
CategorizationID = formatStrID;
Type = type;
}

// Extracts the format string ID from the xml localization formatting tag
// Provides limited ability to detect different lore behaviours based on multiple instances of localization strings
public static function GetFormatStrID(dynel:Dynel):Number {
var dynelName:String = dynel.GetName();
var formatStrId:String = dynelName.substring(dynelName.indexOf('id="') + 4);
return Number(formatStrId.substring(0, formatStrId.indexOf('"')));
}

public function get LoreID():Number {
if (!LoreIDCache) {
LoreIDCache = DynelInst.GetStat(e_Stats_LoreId, 2);
}
return LoreIDCache;
}

public function get IsInactiveEventLore():Boolean {
return (Type == ef_LoreType_Placed && LoreID == 0);
}

public function get IsKnown():Boolean {
return !Lore.IsLocked(LoreID);
}

public function get Topic():String {
return Lore.GetDataNodeById(LoreID).m_Parent.m_Name;
}

public function get Source():Number {
// 0 == Buzzing; 1 == Black Signal
return Lore.GetTagViewpoint(LoreID);
}

public function get Index():Number {
var source:Number = Source;
var siblings:Array = Lore.GetDataNodeById(LoreID).m_Parent.m_Children;
var index:Number = 1; // Lore entries start count at 1
for (var i:Number = 0; i < siblings.length; ++i) {
var sibling:Number = siblings[i].m_Id;
if (LoreID == sibling) { return index; }
if (Lore.GetTagViewpoint(sibling) == source) {
++index;
}
}
}

// Variables
private static var e_Stats_LoreId:Number = 2000560; // Most lore dynels seem to store the LoreId at this stat index, those that don't are either not fully loaded, or event related

public var DynelInst:Dynel;
public var DynelID:ID32;
public var CategorizationID:Number;
public var Type:Number;

private var LoreIDCache:Number;
}
Loading

0 comments on commit 3d38f88

Please sign in to comment.