Fixes NPE (#312)

- [X] Fixes issue with world load where items modify mobiles before mobiles are initialized

Bumps release version
This commit is contained in:
Kamron Batman 2020-11-15 13:52:05 -08:00 committed by GitHub
parent 0ec30e22d1
commit b0d8dd42c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 13 deletions

View file

@ -367,12 +367,12 @@ namespace Server
IIndexInfo<Serial> mobileIndexInfo = new EntityTypeIndex("Mobiles");
IIndexInfo<Serial> guildIndexInfo = new EntityTypeIndex("Guilds");
Items = LoadIndex(itemIndexInfo, out items);
Mobiles = LoadIndex(mobileIndexInfo, out mobiles);
Items = LoadIndex(itemIndexInfo, out items);
Guilds = LoadIndex(guildIndexInfo, out guilds);
LoadData(itemIndexInfo, items);
LoadData(mobileIndexInfo, mobiles);
LoadData(itemIndexInfo, items);
LoadData(guildIndexInfo, guilds);
EventSink.InvokeWorldLoad();
@ -464,8 +464,8 @@ namespace Server
IIndexInfo<Serial> mobileIndexInfo = new EntityTypeIndex("Mobiles");
IIndexInfo<Serial> guildIndexInfo = new EntityTypeIndex("Guilds");
WriteEntities(itemIndexInfo, Items, ItemTypes);
WriteEntities(mobileIndexInfo, Mobiles, MobileTypes);
WriteEntities(itemIndexInfo, Items, ItemTypes);
WriteEntities(guildIndexInfo, Guilds, GuildTypes);
watch.Stop();

View file

@ -1655,17 +1655,12 @@ namespace Server.Items
return true;
}
if (Layer == Layer.Pants)
return Layer switch
{
return m.FindItemOnLayer(Layer.InnerLegs) != null;
}
if (Layer == Layer.Shirt)
{
return m.FindItemOnLayer(Layer.InnerTorso) != null;
}
return false;
Layer.Pants => m.FindItemOnLayer(Layer.InnerLegs) != null,
Layer.Shirt => m.FindItemOnLayer(Layer.InnerTorso) != null,
_ => false
};
}
public override bool OnEquip(Mobile from)