Example #1
0
        int GetCreatureId(string targetName)
        {
            if (targetName == null)
            {
                return(int.MinValue);
            }
            string trimmedName = targetName.Trim();

            if (string.IsNullOrWhiteSpace(trimmedName))
            {
                return(int.MinValue);
            }
            int playerIdFromName = AllPlayers.GetPlayerIdFromName(trimmedName);

            if (playerIdFromName >= 0)
            {
                return(playerIdFromName);
            }
            InGameCreature creatureByName = AllInGameCreatures.GetCreatureByName(trimmedName);

            if (creatureByName != null)
            {
                return(-creatureByName.Index);
            }
            return(int.MinValue);
        }