Ejemplo n.º 1
0
        public void SaveBinco(Client player, int torso, int legs, int legsColor, int boots, int bootsColor, int
                              undershirt, int undershirtColor, int top, int topColor)
        {
            Character charData = Account.GetPlayerData(player);

            if (charData == null)
            {
                return;
            }

            NAPI.ClientEvent.TriggerClientEvent(player, "client.charBinco.toggle", false,
                                                charData.Sex == CharSex.Male ? 0 : 1);

            ClothSet clothSet = new ClothSet
            {
                CharId            = charData.Id,
                Name              = "Ubranie",
                TorsoId           = torso,
                Legs              = legs,
                LegsTexture       = legsColor,
                Boots             = boots,
                BootsTexture      = bootsColor,
                Undershirt        = undershirt,
                UndershirtTexture = undershirtColor,
                Tops              = top,
                TopsTexture       = topColor
            };


            Dictionary <string, object> offerData = new Dictionary <string, object>
            {
                { "clothSet", clothSet }
            };

            Offers.Library.CreateOffer(null, charData.PlayerHandle, OfferType.BincoCloth, 1000, offerData,
                                       "Zestaw ubrań", true);
            Sync.Library.SyncPlayerForPlayer(charData.PlayerHandle);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Buduje skina danego gracza.
        /// </summary>
        /// <param name="charData"></param>
        public static bool BuildPlayerSkin(Character charData)
        {
            if (charData == null)
            {
                return(false);
            }

            NAPI.Player.SetPlayerSkin(charData.PlayerHandle,
                                      charData.Sex == CharSex.Male ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

            if (charData.SkinLook == null)
            {
                if (!DoesPlayerHasSkin(charData))
                {
                    SendFormattedChatMessage(charData.PlayerHandle,
                                             "Nie posiadasz jeszcze skonfigurowanego wyglądu Twojej postaci. Przenoszenie do kreatora...",
                                             Constants.ColorPictonBlue);

                    NAPI.Player.SpawnPlayer(charData.PlayerHandle,
                                            new Vector3(402.9205627441406, -996.6041870117188, -99.00023651123047), 180.0f);
                    NAPI.Entity.SetEntityDimension(charData.PlayerHandle, (uint)Global.GetRandom(20000, 40000));
                    NAPI.ClientEvent.TriggerClientEvent(charData.PlayerHandle, "client.charCreator.toggle", true,
                                                        charData.Sex == CharSex.Male ? 0 : 1);
                    return(false);
                }

                charData.LoadSkin();
            }

            charData.Health = charData.PlayerHandle.Health;


            if (charData.ClothSet != 0)
            {
                using (Database.Database db = new Database.Database())
                {
                    ClothSet clothSet = db.ClothSets.FirstOrDefault(t => t.Id == charData.ClothSet);
                    if (clothSet == null)
                    {
                        return(false);
                    }

                    Dictionary <int, ComponentVariation> componentVariations = new Dictionary <int, ComponentVariation>
                    {
                        { 3, new ComponentVariation(clothSet.TorsoId, 0) },
                        { 4, new ComponentVariation(clothSet.Legs, clothSet.LegsTexture) },
                        { 6, new ComponentVariation(clothSet.Boots, clothSet.BootsTexture) },
                        { 7, new ComponentVariation(clothSet.Accessories, clothSet.AccessoriesTexture) },
                        { 8, new ComponentVariation(clothSet.Undershirt, clothSet.UndershirtTexture) },
                        { 11, new ComponentVariation(clothSet.Tops, clothSet.TopsTexture) }
                    };

                    charData.ComponentVariations = componentVariations;

                    // NAPI.Player.SetPlayerClothes(charData.PlayerHandle, componentVariations);
                }
            }

            Features.Sync.Library.SyncPlayerForPlayer(charData.PlayerHandle);
            NAPI.ClientEvent.TriggerClientEvent(charData.PlayerHandle, "client.cameras.reset");
            return(true);
        }