Ejemplo n.º 1
0
        /// <summary>
        /// Создать гардероб
        /// </summary>
        private void CreateDressingRoom(ClanInfo clanInfo)
        {
            var dressing = _pointCreator.CreateMarker(Marker.VerticalCylinder, clanInfo.DressingMarker, Colors.VividCyan, 1.3f, "Гардероб");

            dressing.ColShape.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => {
                if (!HasRight(player, clanInfo.ClanId, ClanRank.Low))
                {
                    return;
                }
                var playerInfo = _playerInfoManager.GetInfo(player);
                var clothes    = CopyHelper.DeepCopy(playerInfo.Clothes);
                var isMale     = playerInfo.Skin == Skin.Male;
                foreach (var clanClothes in ClanDataGetter.GetClanClothes(clanInfo.ClanId, isMale))
                {
                    if (clothes.Any(e => e.Variation == clanClothes.Variation && e.Slot == clanClothes.Slot))
                    {
                        continue;
                    }
                    clothes.Add(clanClothes);
                }
                API.triggerClientEvent(
                    player, ServerEvent.SHOW_CLOTHES_MENU, 0,
                    JsonConvert.SerializeObject(clanInfo.DressingRoomPositions),
                    JsonConvert.SerializeObject(clothes), (int)Validator.INVALID_ID
                    );
            });
            dressing.ColShape.onEntityExitColShape += (shape, entity) =>
                                                      PlayerHelper.ProcessAction(entity, player => {
                if (HasRight(player, clanInfo.ClanId, ClanRank.Low))
                {
                    API.triggerClientEvent(player, ServerEvent.HIDE_CLOTHES_MENU);
                }
            }
                                                                                 );
        }