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

How to create an object by its name.

thunder

Member
Joined
Jul 8, 2012
Messages
143
Reaction score
2
I'm totally a newbie in programming, and i'm trying to write my own plugin, here is my problem.

i know i can create an object by its ID using Loki.Game.LokiPoe.ObjectManager.GetObjectById(int), but the ID of the item keeps changing every time I create a new instance. So is there any function like GetObjectByName(string)?
 
It would be nice and helpful if you posted how you solved the problem so that people can learn when they run into same problem, wouldn't it?
 
We will add wrapper functions to take care of this for users.

Otherwise, it's just using Linq:

var objects = Loki.Game.LokiPoe.ObjectManager.Objects.Where(o => o.Name == "Some Name");
// foreach objects or ToList it, or something.
or

var @object = Loki.Game.LokiPoe.ObjectManager.Objects.FirstOrDefault(o => o.Name == "Some Name");
// check @object against null to see if it exists
 
Back
Top