static public uint GetCharID(string str) { str = str.ToUpperInvariant(); //is self? if (System.String.Equals(str, Globals.gamedata.my_char.Name.ToUpperInvariant())) { return(Globals.gamedata.my_char.ID); } //is it a party member? Globals.PartyLock.EnterReadLock(); try { PartyMember pmem = Util.GetCharParty(str); if (pmem != null) { return(pmem.ID); } } finally { Globals.PartyLock.ExitReadLock(); } //is in the list of chars? Globals.PlayerLock.EnterReadLock(); try { CharInfo player = Util.GetChar(str); if (player != null) { return(player.ID); } } finally { Globals.PlayerLock.ExitReadLock(); } return(0); }
static public string GetCharName(uint id) { //is self? if (id == Globals.gamedata.my_char.ID) { return(Globals.gamedata.my_char.Name); } //is it a party member? Globals.PartyLock.EnterReadLock(); try { PartyMember pmem = Util.GetCharParty(id); if (pmem != null) { return(pmem.Name); } } finally { Globals.PartyLock.ExitReadLock(); } //is in the list of chars? Globals.PlayerLock.EnterReadLock(); try { CharInfo player = Util.GetChar(id); if (player != null) { return(player.Name); } } finally { Globals.PlayerLock.ExitReadLock(); } return("-nobody-"); }
static public void GetCharLoc(uint id, ref int x, ref int y, ref int z) { //this is for getting the location of a player, self or otherwise, for the purpose of buffing //dont give 2 shits about buffing mobs/items //is self? if (Globals.gamedata.my_char.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_char.X); y = Util.Float_Int32(Globals.gamedata.my_char.Y); z = Util.Float_Int32(Globals.gamedata.my_char.Z); return; } //is my pet? if (Globals.gamedata.my_pet.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet.X); y = Util.Float_Int32(Globals.gamedata.my_pet.Y); z = Util.Float_Int32(Globals.gamedata.my_pet.Z); return; } if (Globals.gamedata.my_pet1.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet1.X); y = Util.Float_Int32(Globals.gamedata.my_pet1.Y); z = Util.Float_Int32(Globals.gamedata.my_pet1.Z); return; } if (Globals.gamedata.my_pet2.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet2.X); y = Util.Float_Int32(Globals.gamedata.my_pet2.Y); z = Util.Float_Int32(Globals.gamedata.my_pet2.Z); return; } if (Globals.gamedata.my_pet3.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet3.X); y = Util.Float_Int32(Globals.gamedata.my_pet3.Y); z = Util.Float_Int32(Globals.gamedata.my_pet3.Z); return; } //is in the list of chars? Globals.PlayerLock.EnterReadLock(); try { CharInfo player = Util.GetChar(id); if (player != null) { x = Util.Float_Int32(player.X); y = Util.Float_Int32(player.Y); z = Util.Float_Int32(player.Z); return; } } finally { Globals.PlayerLock.ExitReadLock(); } //is it a party member? Globals.PartyLock.EnterReadLock(); try { PartyMember pmem = Util.GetCharParty(id); if (pmem != null) { x = pmem.X; y = pmem.Y; z = pmem.Z; return; } } finally { Globals.PartyLock.ExitReadLock(); } }
static public void GetLoc(uint id, ref int x, ref int y, ref int z) { //is self? if (Globals.gamedata.my_char.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_char.X); y = Util.Float_Int32(Globals.gamedata.my_char.Y); z = Util.Float_Int32(Globals.gamedata.my_char.Z); return; } //is my pet? if (Globals.gamedata.my_pet.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet.X); y = Util.Float_Int32(Globals.gamedata.my_pet.Y); z = Util.Float_Int32(Globals.gamedata.my_pet.Z); return; } if (Globals.gamedata.my_pet1.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet1.X); y = Util.Float_Int32(Globals.gamedata.my_pet1.Y); z = Util.Float_Int32(Globals.gamedata.my_pet1.Z); return; } if (Globals.gamedata.my_pet2.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet2.X); y = Util.Float_Int32(Globals.gamedata.my_pet2.Y); z = Util.Float_Int32(Globals.gamedata.my_pet2.Z); return; } if (Globals.gamedata.my_pet3.ID == id) { x = Util.Float_Int32(Globals.gamedata.my_pet3.X); y = Util.Float_Int32(Globals.gamedata.my_pet3.Y); z = Util.Float_Int32(Globals.gamedata.my_pet3.Z); return; } //is in the list of chars? Globals.PlayerLock.EnterReadLock(); try { CharInfo player = Util.GetChar(id); if (player != null) { x = Util.Float_Int32(player.X); y = Util.Float_Int32(player.Y); z = Util.Float_Int32(player.Z); return; } } finally { Globals.PlayerLock.ExitReadLock(); } //is it a party member? Globals.PartyLock.EnterReadLock(); try { PartyMember pmem = Util.GetCharParty(id); if (pmem != null) { x = pmem.X; y = pmem.Y; z = pmem.Z; return; } } finally { Globals.PartyLock.ExitReadLock(); } Globals.NPCLock.EnterReadLock(); try { NPCInfo npc = Util.GetNPC(id); if (npc != null) { x = Util.Float_Int32(npc.X); y = Util.Float_Int32(npc.Y); z = Util.Float_Int32(npc.Z); return; } } finally { Globals.NPCLock.ExitReadLock(); } }