// tbd private static void CheckDropBank(WealthTrackerEventArgs e) { }
// tbd private static void GoldDropBank(WealthTrackerEventArgs e) { }
private static void GoldLifted(WealthTrackerEventArgs e) { // sanity if (e == null || e.item == null || e.from == null || e.from.NetState == null) return; // eliminate tracking of all but approved scenarios if (ScenarioFilter(e) == false) return; NetState state = e.from.NetState; int iphc = state.ToString().GetHashCode(); // hash code of IP address IPDomain ipd = null; AccountDomain ad = null; if (m_IPList.Contains(iphc)) // if we have it already { ipd = m_IPList[iphc] as IPDomain; // get the IPDomain at this IP address if (ipd.accountList.Contains(e.from.Account) == false) // if we don't have an account domain, create it ipd.accountList.Add(e.from.Account, new AccountDomain()); ad = ipd.accountList[e.from.Account] as AccountDomain; // get the account domain } else { m_IPList[iphc] = new IPDomain(); // start a new list of clients at this IP address ipd = m_IPList[iphc] as IPDomain; // get the IPDomain at this IP address ipd.accountList.Add(e.from.Account, new AccountDomain()); // add another client at this IP + location ad = ipd.accountList[e.from.Account] as AccountDomain; // get the account domain } // update domain information if (ad != null && ipd != null) { ad.mobileList[e.from.Serial] = e.from; // record mobile (not sure what the key should be) ad.gold += e.item.Amount; // update gold for this IPDomain ad.lastTick = DateTime.Now; // last gold pickup ad.location = e.from.Location; // last gold pickup location ipd.gold += e.item.Amount; // update gold for this IPDomain ipd.lastTick = DateTime.Now; // last gold pickup ipd.location = e.from.Location; // last gold pickup location } }
private static bool ScenarioFilter(WealthTrackerEventArgs e) { switch (e.auditType) { // At this time, we only support the looting a corpse scenario and looting a dungeon chest scenario // we don't expect picking up harrower loot or looting treasure map chests will be exploitable case AuditType.GoldLifted: if (e.parent != null && (e.parent is Items.Corpse || e.parent is Items.DecayedCorpse || e.parent is Items.DungeonTreasureChest)) return true; return false; case AuditType.GoldDropBackpack: break; case AuditType.GoldDropBank: break; case AuditType.CheckDropBackpack: break; case AuditType.CheckDropBank: break; } return false; }
public static void OnWealthTracker(WealthTrackerEventArgs e) { // sanity if (e == null || e.item == null || e.item.Deleted == true) return; try { // if we've not audited this item before if (e.item.Audited == false) { e.item.Audited = true; switch (e.auditType) { default: return; case AuditType.GoldLifted: GoldLifted(e); break; case AuditType.GoldDropBackpack: GoldDropBackpack(e); break; case AuditType.GoldDropBank: GoldDropBank(e); break; case AuditType.CheckDropBackpack: CheckDropBackpack(e); break; case AuditType.CheckDropBank: CheckDropBank(e); break; } } } catch (Exception ex) { LogHelper.LogException(ex); } }
public static void InvokeWealthTracker(WealthTrackerEventArgs e) { if (WealthTracker != null) { foreach (WealthTrackerEventHandler currentDelegate in WealthTracker.GetInvocationList()) { try { currentDelegate.Invoke(e); } catch (Exception ex) { // Log an exception EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } }