Example #1
0
 public static Creature GetCreatureFromId(int creatureId)
 {
     if (creatureId >= 0)
     {
         return(AllPlayers.GetFromId(creatureId));
     }
     else
     {
         InGameCreature inGameCreature = AllInGameCreatures.GetByIndex(-creatureId);
         if (inGameCreature != null)
         {
             return(inGameCreature.Creature);
         }
     }
     return(null);
 }
Example #2
0
        int GetCreatureId(string targetName)
        {
            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);
        }
        public static int GetHueShift(int creatureId)
        {
            if (creatureId < 0)
            {
                InGameCreature creature = AllInGameCreatures.GetByIndex(-creatureId);
                if (creature == null)
                {
                    return(0);
                }


                Color color = (Color)ColorConverter.ConvertFromString(creature.BackgroundHex);
                return((int)color.GetHue());
            }
            else
            {
                Character player = AllPlayers.GetFromId(creatureId);
                if (player == null)
                {
                    return(0);
                }
                return(player.hueShift);
            }
        }