public static void PlayerShopClosed() { var store = OBJECT_SELF; var sellerPlayerId = GetLocalString(store, "SELLER_PLAYER_ID"); StoresOpen[sellerPlayerId]--; // If no one's accessing the store right now, destroy it and remove it from cache. if (StoresOpen[sellerPlayerId] <= 0) { StoreMerchants.Remove(sellerPlayerId); StoresOpen.Remove(sellerPlayerId); DestroyObject(store); } }
public static void OpenPlayerStore(uint player, string sellerPlayerId) { uint merchant; if (StoreMerchants.ContainsKey(sellerPlayerId)) { merchant = StoreMerchants[sellerPlayerId]; } else { var dbPlayerStore = DB.Get <PlayerStore>(sellerPlayerId); merchant = CreateMerchantObject(sellerPlayerId, dbPlayerStore); StoreMerchants[sellerPlayerId] = merchant; } OpenStore(merchant, player); }