public void CloseShop(bool closedByCharacter = false)
{
if (HasShopOpened && Session.HasCurrentMap)
{
KeyValuePair<long, MapShop> shop = Session.CurrentMap.UserShops.FirstOrDefault(mapshop => mapshop.Value.OwnerId.Equals(CharacterId));
if (!shop.Equals(default(KeyValuePair<long, MapShop>)))
{
Session.CurrentMap.UserShops.Remove(shop.Key);
// declare that the shop cannot be closed
HasShopOpened = false;
Session.CurrentMap?.Broadcast(GenerateShopEnd());
Session.CurrentMap?.Broadcast(Session, GeneratePlayerFlag(0), ReceiverType.AllExceptMe);
IsSitting = false;
IsShopping = false; // close shop by character will always completely close the shop
LoadSpeed();
Session.SendPacket(GenerateCond());
Session.CurrentMap?.Broadcast(GenerateRest());
}
}
}