What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

Quick Noob Question for Identifying Particular Actors in Actor List

Magi

New Member
Joined
Oct 12, 2012
Messages
1,242
Reaction score
7
Not real familiar with C so any help would be appreciated. Should be a quick answer for those who know the syntax better than I.

I've got this function to get an actor based on it's ActorSNO (not mine, someone else's):

Code:
int[] _keywardenSNOs = { 255996, 256000, 256015 };

// set object
DiaObject wardenObject = ZetaDia.Actors.RActorList.OfType<DiaObject>().FirstOrDefault(r => _keywardenSNOs.Any(k => k == r.ActorSNO));

Works fine, but I want to now get an actor if the Name of the actor contains certain strings (keys yippie!) Trying to detect Uber Key/Organ drops
Code:
string[] _keyNames = { "demonkey_", "demontrebuchetkey", "_quest" };

// set key object
DiaObject keyObject = ZetaDia.Actors.RActorList.OfType<DiaObject>().FirstOrDefault(r => keySNOs.Any(k => k == r.Name));
//if (sThisInternalName.StartsWith("demonkey_") || sThisInternalName.StartsWith("demontrebuchetkey"))

Now the key check currently should be looking for an identical match, but I want to check if it "StartsWith" those names provided in the _keyNames string array. How would I write that DiaObject keyObject call?

Thank you in advance!
 
may have answered my own question after I got home and thought about it...we'll see if this works:

Code:
DiaObject keyObject = ZetaDia.Actors.RActorList.OfType<DiaObject>().FirstOrDefault(r => _keyNames.Any(k => r.Name.StartsWith(k)));
 
Back
Top