public static DataAvailability GetAvailability(CompanionDefinition companion)
 {
     foreach (CompanionAvailability companion2 in s_instance.companions)
     {
         if (companion2.companion.value == companion.get_id())
         {
             return(companion2.availability);
         }
     }
     return(DataAvailability.NotUsed);
 }
 public override string ToString()
 {
     if (!(m_companion == null))
     {
         CompanionDefinition companion = ObjectReference.GetCompanion(m_companion.value);
         if (companion == null)
         {
             return(null);
         }
         return(companion.get_idAndName());
     }
     return("<not defined>");
 }
Beispiel #3
0
        public static IFamilyList FromJsonToken(JToken token)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0007: Invalid comparison between Unknown and I4
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            if ((int)token.get_Type() != 1)
            {
                Debug.LogWarning((object)("Malformed token : type Object expected, but " + token.get_Type() + " found"));
                return(null);
            }
            JObject val  = Extensions.Value <JObject>((IEnumerable <JToken>)token);
            JToken  val2 = default(JToken);

            if (!val.TryGetValue("type", ref val2))
            {
                Debug.LogWarning((object)"Malformed json: no 'type' property in object of class IFamilyList");
                return(null);
            }
            string      text = Extensions.Value <string>((IEnumerable <JToken>)val2);
            IFamilyList familyList;

            switch (text)
            {
            case "WeaponDefinition":
                familyList = new WeaponDefinition();
                break;

            case "SummoningDefinition":
                familyList = new SummoningDefinition();
                break;

            case "CompanionDefinition":
                familyList = new CompanionDefinition();
                break;

            case "FloorMechanismDefinition":
                familyList = new FloorMechanismDefinition();
                break;

            case "ObjectMechanismDefinition":
                familyList = new ObjectMechanismDefinition();
                break;

            default:
                Debug.LogWarning((object)("Unknown type: " + text));
                return(null);
            }
            familyList.PopulateFromJson(val);
            return(familyList);
        }
 public CompanionDefinitionContext([NotNull] CompanionDefinition definition, int level)
     : base(DynamicValueHolderType.Companion, level)
 {
 }