/// <summary> /// Creates a new QuestRequirement and does some basich compativilite checks for the parameters /// </summary> /// <param name="defaultNPC"></param> /// <param name="type"></param> /// <param name="n"></param> /// <param name="v"></param> /// <param name="comp"></param> public AbstractRequirement(GameNPC defaultNPC, eRequirementType type, Object n, Object v, eComparator comp) : this(defaultNPC, type, comp) { RequirementAttribute attr = BehaviourMgr.getRequirementAttribute(this.GetType()); // handle parameter N object defaultValueN = GetDefaultValue(attr.DefaultValueN); this.N = (TypeN)BehaviourUtils.ConvertObject(n, defaultValueN, typeof(TypeN)); CheckParameter(this.N, attr.IsNullableN, typeof(TypeN)); // handle parameter V object defaultValueV = GetDefaultValue(attr.DefaultValueV); this.v = (TypeV)BehaviourUtils.ConvertObject(v, defaultValueV, typeof(TypeV)); CheckParameter(this.V, attr.IsNullableV, typeof(TypeV)); }
/// <summary> /// Initializes a new instance of the AbstractAction class. /// </summary> /// <param name="npc"></param> /// <param name="actionType"></param> /// <param name="p"></param> /// <param name="q"></param> public AbstractAction(GameNPC npc, eActionType actionType, object p, object q) : this(npc, actionType) { ActionAttribute attr = BehaviourMgr.GetActionAttribute(GetType()); // handle parameter P object defaultValueP = GetDefaultValue(attr.DefaultValueP); this.p = (TypeP)BehaviourUtils.ConvertObject(p, defaultValueP, typeof(TypeP)); CheckParameter(this.p, attr.IsNullableP, typeof(TypeP)); // handle parameter Q object defaultValueQ = GetDefaultValue(attr.DefaultValueQ); this.q = (TypeQ)BehaviourUtils.ConvertObject(q, defaultValueQ, typeof(TypeQ)); CheckParameter(this.q, attr.IsNullableQ, typeof(TypeQ)); }
/// <summary> /// Creates a new questtrigger and does some simple triggertype parameter compatibility checking /// </summary> /// <param name="defaultNPC"></param> /// <param name="notifyHandler"></param> /// <param name="type">Triggertype</param> /// <param name="k">keyword (K), meaning depends on triggertype</param> /// <param name="i">variable (I), meaning depends on triggertype</param> public AbstractTrigger(GameLiving defaultNPC, DOLEventHandler notifyHandler, eTriggerType type, object k, object i) : this(defaultNPC, notifyHandler, type) { TriggerAttribute attr = BehaviourMgr.getTriggerAttribute(this.GetType()); // handle parameter K object defaultValueK = GetDefaultValue(attr.DefaultValueK); this.k = (TypeK)BehaviourUtils.ConvertObject(k, defaultValueK, typeof(TypeK)); CheckParameter(K, attr.IsNullableK, typeof(TypeK)); // handle parameter I object defaultValueI = GetDefaultValue(attr.DefaultValueI); this.i = (TypeI)BehaviourUtils.ConvertObject(i, defaultValueI, typeof(TypeI)); CheckParameter(I, attr.IsNullableI, typeof(TypeI)); }