Moderator: Support Team
if (mob.NPCTemplateID != -1)
{
constructorParams = new Type[] { typeof(INpcTemplate) };
ConstructorInfo handlerConstructor = typeof(GameNPC).GetConstructor(constructorParams);
INpcTemplate template = NpcTemplateMgr.GetTemplate(mob.NPCTemplateID);
myMob = (GameNPC)handlerConstructor.Invoke(new object[] { template });
}
Index: world/Region.cs
===================================================================
--- world/Region.cs (revision 3226)
+++ world/Region.cs (working copy)
@@ -798,6 +798,17 @@
{
GameNPC myMob = null;
string error = string.Empty;
+
+ // Default Classtype
+ string classtype = ServerProperties.Properties.GAMENPC_DEFAULT_CLASSTYPE;
+
+ // load template if any
+ INpcTemplate template = null;
+ if(mob.NPCTemplateID != -1)
+ {
+ template = NpcTemplateMgr.GetTemplate(mob.NPCTemplateID);
+ }
+
if (mob.Guild.Length > 0 && mob.Realm >= 0 && mob.Realm <= (int)eRealm._Last)
{
@@ -806,18 +817,9 @@
{
try
{
- Type[] constructorParams;
- if (mob.NPCTemplateID != -1)
- {
- constructorParams = new Type[] { typeof(INpcTemplate) };
- ConstructorInfo handlerConstructor = typeof(GameNPC).GetConstructor(constructorParams);
- INpcTemplate template = NpcTemplateMgr.GetTemplate(mob.NPCTemplateID);
- myMob = (GameNPC)handlerConstructor.Invoke(new object[] { template });
- }
- else
- {
- myMob = (GameNPC)type.Assembly.CreateInstance(type.FullName);
- }
+
+ myMob = (GameNPC)type.Assembly.CreateInstance(type.FullName);
+
}
catch (Exception e)
{
@@ -827,12 +829,14 @@
}
}
-
+
if (myMob == null)
{
- string classtype = ServerProperties.Properties.GAMENPC_DEFAULT_CLASSTYPE;
-
- if (mob.ClassType != null && mob.ClassType.Length > 0 && mob.ClassType != Mob.DEFAULT_NPC_CLASSTYPE)
+ if(template != null && template.ClassType != null && template.ClassType.Length > 0 && template.ClassType != Mob.DEFAULT_NPC_CLASSTYPE && template.ReplaceMobValues)
+ {
+ classtype = template.ClassType;
+ }
+ else if (mob.ClassType != null && mob.ClassType.Length > 0 && mob.ClassType != Mob.DEFAULT_NPC_CLASSTYPE)
{
classtype = mob.ClassType;
}
i can't confirm that bug. all my templated mobs have the bodytype that's defined in NPCT.I think there is a BodyType bug too with NPCTemplate...
All my templated mob have bodytype = 1 !
but it's nowhere related to this patch
Thanks, that'll help me to look somewhere else !i can't confirm that bug. all my templated mobs have the bodytype that's defined in NPCT.I think there is a BodyType bug too with NPCTemplate...
All my templated mob have bodytype = 1 !
but it's nowhere related to this patch
regards
Argo
Return to “%s” DOL Development Discussion
Users browsing this forum: No registered users and 1 guest