// 触发黑市npc public void TrigerBusinessman(DungeonScene _this) { var sceneNpcId = _this.mFubenRecord.BusinessManSceneId; var pr = _this.mFubenRecord.BusinessManPR; if (sceneNpcId >= 0 && pr >= 0 && MyRandom.Random(10000) < pr) { _this.CreateSceneNpc(sceneNpcId); // 初始化商店物品数量 var sceneNpc = Table.GetSceneNpc(sceneNpcId); if (sceneNpc == null) { return; } var npc = Table.GetNpcBase(sceneNpc.DataID); if (npc == null) { return; } _this.MapShopItems.Clear(); foreach (var serviceId in npc.Service) { if (serviceId >= 0) { var serviceR = Table.GetService(serviceId); if (serviceR == null || serviceR.Param[0] < 0) { continue; } var shopType = serviceR.Param[0]; _this.MapShopItems[shopType] = new Dictionary <int, int>(); SceneServer.Instance.ServerControl.InitFubenStoreCounts(shopType, _this.MapShopItems[shopType]); } } } }