Пример #1
0
        public async static void SellVehicle(Marker _marker)
        {
            if (_marker == null)
            {
                return;
            }

            if (Game.Player.IsAlive && Game.Player.Character.IsInVehicle())
            {
                Vehicle plyVeh    = Game.Player.Character.CurrentVehicle;
                int     vehHandle = plyVeh.Handle;

                foreach (GarageItem gI in SessionManager.PlayerSession.getSelectedCharacter().Garage.garageItems)
                {
                    if (gI.vehicleNetworkID == plyVeh.NetworkId)
                    {
                        MainClient.TriggerServerEvent("Laced:SellCardealerVehicle", SessionManager.PlayerSession.getSessionKey(), JsonConvert.SerializeObject(gI), new Action <bool, string, int>((_sold, _garageItem, _price) =>
                        {
                            if (_sold)
                            {
                                Utils.WriteLine("Selling vehicle!");
                                GarageItem garageItem = JsonConvert.DeserializeObject <GarageItem>(_garageItem);
                                SessionManager.PlayerSession.getSelectedCharacter().SellVehicle(garageItem);
                                Utils.WriteLine("Removed vehicle!");
                                SessionManager.PlayerSession.getSelectedCharacter().SellItem(_price);
                                Utils.WriteLine("Sold vehicle!");
                                API.DeleteEntity(ref vehHandle);
                            }
                        }));
                    }
                }
            }
        }
Пример #2
0
        public static string GetDetailedName(Entity marketItem)
        {
            GarageItem item            = GarageItemsRegistry.GetItem <GarageItem>(marketItem);
            string     savedLocaleCode = LocaleUtils.GetSavedLocaleCode();

            return(!"ru".Equals(savedLocaleCode) ? (Instance.GetGarageItemName(item) + " " + Instance.GetCategoryName(marketItem)) : (Instance.GetCategoryName(marketItem) + " " + Instance.GetGarageItemName(item)));
        }
Пример #3
0
 public bool SellVehicle(GarageItem _garageItem)
 {
     try
     {
         Garage.garageItems.Remove(_garageItem);
         return(true);
     }
     catch (Exception _ex)
     {
         Utils.Throw(_ex);
         return(false);
     }
 }
Пример #4
0
        public void UpdateAGarage() //Put
        {
            Console.Clear();
            Console.WriteLine("Enter Garage ID to update");
            int id = GetSafeInterger();

            Console.Write("Connecting.....");
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token);
            Task <HttpResponseMessage> getTask  = httpClient.GetAsync($"https://{aPIUrl}/api/Garage/");
            HttpResponseMessage        response = getTask.Result;

            if (response.IsSuccessStatusCode)
            {
                Console.Clear();
                var task = httpClient.GetAsync($"https://{aPIUrl}/api/Garage/{id}").Result;
                if (task.IsSuccessStatusCode)
                {
                    GarageItem oldGarage = task.Content.ReadAsAsync <GarageItem>().Result;
                    Console.WriteLine($"{oldGarage.Name}   {oldGarage.Location}");
                    Dictionary <string, string> newGarage = new Dictionary <string, string>();
                    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token);
                    newGarage.Add("Id", id.ToString());

                    Console.Write("Name: ");
                    newGarage.Add("Name", UpdateProperty(oldGarage.Name));

                    Console.Write("Location: ");
                    newGarage.Add("Location", UpdateProperty(oldGarage.Location));

                    Console.Clear();
                    Console.WriteLine("Sending...");
                    HttpContent newRestHTTP = new FormUrlEncodedContent(newGarage);
                    Task <HttpResponseMessage> putResponse = httpClient.PutAsync($"https://{aPIUrl}/api/Garage/", newRestHTTP);
                    if (putResponse.Result.IsSuccessStatusCode)
                    {
                        Console.WriteLine("Success");
                    }
                    else
                    {
                        Console.WriteLine("Failed to save or no changes made");
                    }
                }
                else
                {
                    Console.WriteLine("Invalid ID");
                }
            }
            AnyKey();
        }
Пример #5
0
 public override void RunStep(TutorialData data)
 {
     TutorialCanvas.Instance.BlockInteractable();
     base.RunStep(data);
     this.selectedItem = GarageItemsRegistry.GetItem <TankPartItem>(data.TutorialStep.GetComponent <TutorialSelectItemDataComponent>().itemMarketId);
     if (ReferenceEquals(this.carousel.Selected.Item, this.selectedItem))
     {
         this.Complete(this.carousel.Selected);
     }
     else
     {
         this.carousel.onItemSelected += new UnityAction <GarageItemUI>(this.Complete);
         this.carousel.Select(this.selectedItem, false);
     }
 }
Пример #6
0
        private static async void BuyCardealerVehicle(dynamic _data, CallbackDelegate _callback)
        {
            Utils.WriteLine("Buying cardealer!");

            MainClient.TriggerServerEvent("Laced:BuyCardealerVehicle", PlayerSession.getSessionKey(), (string)_data.CarModel, new Action <bool, string>(async(_bought, _garageItem) => {
                if (_bought)
                {
                    Character playerCharacter = PlayerSession.getSelectedCharacter();
                    GarageItem garageItem     = JsonConvert.DeserializeObject <GarageItem>(_garageItem);
                    Utils.WriteLine("Bought item!");
                    //Loop through all the garage items to get how many of these cars the character already has
                    int vehGarageId = 0;
                    foreach (GarageItem gI in playerCharacter.Garage.garageItems)
                    {
                        if (gI.vehicleModel == garageItem.vehicleModel)
                        {
                            vehGarageId++;
                        }
                    }
                    string vehGarageIdString = "";
                    if (vehGarageId > 0)
                    {
                        vehGarageIdString = vehGarageId.ToString();
                    }
                    //After the car is added into the garage, spawn it
                    uint vehicleHash = Helpers.GetVehicleHashFromString(garageItem.vehicleModel);

                    int vehicleID = await Helpers.SpawnVehicle(vehicleHash, garageItem.vehicleNumberPlate);
                    Utils.WriteLine($"Vehicle created ID:[{vehicleID}], Vehicle networkID: [{API.NetworkGetNetworkIdFromEntity(vehicleID)}]");
                    //Create the new garage item and add it into the character garage
                    garageItem.setNetworkID(API.NetworkGetNetworkIdFromEntity(vehicleID));
                    playerCharacter.Garage.garageItems.Add(garageItem);

                    if (vehicleID != -1)
                    {
                        _ = _callback(new { ok = true });
                    }
                    else
                    {
                        _ = _callback(new { ok = false });
                    }
                }
            }));

            MainClient.GetInstance().SetNUIFocus(false, false);

            await Task.FromResult(0);
        }
Пример #7
0
        private void GarageStoreVehicle([FromSource] Player _player, string _seshKey, string _garageItem, NetworkCallbackDelegate _networkCallback)
        {
            if (_seshKey == null)
            {
                Utils.WriteLine($"Player[{_player.Name}] didn't have a session key!");
                return;
            }
            Session foundSesh = Sessions.Find(s => s.Player.Handle == _player.Handle);

            if (foundSesh.SessionKey != _seshKey)
            {
                Utils.WriteLine($"Players[{_player.Name}] session key didn't equal servers key!");
                return;
            }

            GarageItem storinggarageItem = JsonConvert.DeserializeObject <GarageItem>(_garageItem);

            foreach (GarageItem gI in foundSesh.selectedCharacter.Garage.garageItems)
            {
                Utils.WriteLine($"Storing vehicle[{storinggarageItem.garageID}], garage vehicle [{gI.garageID}]");
                //Get the garage item in the servers memory
                if (storinggarageItem.garageID == gI.garageID)
                {
                    //Check if the garage item is not stored and is not impounded
                    if (ConfigManager.ServerConfig.RPImpound)
                    {
                        if (gI.impounded)
                        {
                            Utils.WriteLine("Vehicle is impounded!");  return;
                        }
                    }
                    if (!gI.stored)
                    {
                        gI.setImpounded(false);
                        gI.setStored(true);
                        gI.setNetworkID(0);
                        foundSesh.UpdateCharacters(CharacterDBManager.UpdateCharacter(_player, foundSesh.User, foundSesh.selectedCharacter.Id));
                        _networkCallback(true);
                        return;
                    }
                }
            }

            _networkCallback(false);
        }
Пример #8
0
        public async Task <GarageItem> GetGarageById(int id)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = await
                             ctx
                             .Garages
                             .SingleAsync(e => e.Id == id && e.CollectorId == _userId);

                var garageItem = new GarageItem
                {
                    Id            = entity.Id,
                    Name          = entity.Name,
                    Location      = entity.Location,
                    CarCollection = entity.CarCollection.Select(r => new CarItem
                    {
                        Id             = r.Id,
                        ManufacturerId = r.ManufacturerId,
                        Manufacturer   = new ManufacturerDetail
                        {
                            Id          = r.Manufacturer.Id,
                            CompanyName = r.Manufacturer.CompanyName,
                            Locations   = r.Manufacturer.Locations,
                            Founded     = r.Manufacturer.Founded
                        },
                        GarageId = r.GarageId,
                        Garage   = new GarageSimpleItem
                        {
                            Id       = r.Garage.Id,
                            Name     = r.Garage.Name,
                            Location = r.Garage.Location
                        },
                        OwnerID      = r.OwnerID,
                        Make         = r.Make,
                        Model        = r.Model,
                        Year         = r.Year,
                        CarType      = r.CarType,
                        Transmission = r.Transmission,
                        CarValue     = r.CarValue
                    }).ToList()
                };
                return(garageItem);
            }
        }
Пример #9
0
        public async static void GarageStoring(Marker _marker)
        {
            if (_marker == null)
            {
                return;
            }

            if (!Game.PlayerPed.IsInVehicle() || !Game.Player.IsAlive)
            {
                Utils.WriteLine("Not in a vehicle or dead!"); return;
            }
            await Task.FromResult(0);

            //Get the current vehicle of the character
            Vehicle plyVeh = Game.Player.Character.CurrentVehicle;

            Utils.WriteLine($"Vehicle handle:[{plyVeh.Handle}], Vehicle ID:[{plyVeh.NetworkId}]");
            //Loop through all of the characters garage items to check if the current vehicle is inside their garage
            foreach (GarageItem gI in SessionManager.PlayerSession.getSelectedCharacter().Garage.garageItems)
            {
                Utils.WriteLine($"Garage network id:[{gI.vehicleNetworkID}]");
                //If the network ID is the same between both items then we know the character has their own car
                if (gI.vehicleNetworkID == plyVeh.NetworkId)
                {
                    //Send the
                    MainClient.TriggerServerEvent("Laced:GarageStoreVehicle", SessionManager.PlayerSession.getSessionKey(), JsonConvert.SerializeObject(gI), new Action <bool>((_stored) => {
                        //Networkcallback, if the server returned with true then we can set if the car is stored and impounded
                        if (_stored)
                        {
                            GarageItem updatedItem = SessionManager.PlayerSession.getSelectedCharacter().Garage.garageItems.Find(GI => GI.garageID == gI.garageID);
                            updatedItem.setImpounded(false);
                            updatedItem.setStored(true);
                            updatedItem.setNetworkID(0);
                            plyVeh.Delete();
                        }
                        else
                        {
                            Utils.WriteLine("Something went wrong when storing the vehicle!");
                        }
                    }));
                }
            }
        }
Пример #10
0
        public void ViewAGarage() //Get/{id}
        {
            Console.Clear();
            Console.WriteLine("Enter Garage ID");
            int id = GetSafeInterger();

            Console.Write("Connecting.....");
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token);
            Task <HttpResponseMessage> getTask  = httpClient.GetAsync($"https://{aPIUrl}/api/Garage/{id}");
            HttpResponseMessage        response = getTask.Result;

            if (response.IsSuccessStatusCode)
            {
                Console.Clear();
                var task = httpClient.GetAsync($"https://{aPIUrl}/api/Garage/{id}").Result;
                if (task.IsSuccessStatusCode)
                {
                    GarageItem garage = task.Content.ReadAsAsync <GarageItem>().Result;
                    Console.WriteLine($" {"Id",4}   {"Garage Name",-33} {"Location",-18}{"Total Collection Value"}");
                    Console.WriteLine($" {garage.Id,4} {garage.Name,-28} {garage.Location,20} {garage.CollectionValue,15:C}");
                    if (garage.CarCollection.Count() >= 1)
                    {
                        Console.WriteLine("\n Cars in this garage: \n");
                        Console.WriteLine($"{"Car ID",7}{"Make",7}{"Model",11}{"Year",14}{"Car Type",11}{"Transmission Size",20}{"Car value",9}{"Manufacturer",16}");
                        foreach (CarItem car in garage.CarCollection)
                        {
                            Console.WriteLine($"{car.Id,5}  {car.Make,-12} {car.Model,-16}  {car.Year,4}  {car.CarType,-10} {car.Transmission,-18} {car.CarValue.ToString("C"),-12} {car.Manufacturer.CompanyName}");;
                        }
                    }
                    else
                    {
                        Console.WriteLine("No Cars manufactured yet");
                    }
                }
                else
                {
                    Console.WriteLine("Invalid ID");
                }
            }
            AnyKey();
        }
Пример #11
0
        public static string GetFullItemDescription(GarageItem item, bool withParentItemName, string commonRarity = "", string rareRarity = "", string epicRarity = "", string legendaryRarity = "")
        {
            string         str    = !withParentItemName ? (Instance.GetCategoryName(item.MarketItem) + " " + item.Name) : GetDetailedName(item.MarketItem);
            string         str2   = string.Empty;
            ItemRarityType rarity = item.Rarity;

            switch (item.Rarity)
            {
            case ItemRarityType.COMMON:
                str2 = str2 + commonRarity;
                break;

            case ItemRarityType.RARE:
                str2 = str2 + rareRarity;
                break;

            case ItemRarityType.EPIC:
                str2 = str2 + epicRarity;
                break;

            case ItemRarityType.LEGENDARY:
                str2 = str2 + legendaryRarity;
                break;

            default:
                break;
            }
            if (!string.IsNullOrEmpty(str2))
            {
                string   str3       = str;
                string[] textArray1 = new string[] { str3, "\n<color=#", rarity.GetRarityColor().ToHexString(), ">", str2, "</color>" };
                str = string.Concat(textArray1);
            }
            string description = item.Description;

            if (!string.IsNullOrEmpty(description))
            {
                str = str + "\n" + description;
            }
            return(str);
        }
        public void SetItemRarity(GarageItem item)
        {
            Color rarityColor = item.Rarity.GetRarityColor();

            this.itemNameElement.color   = rarityColor;
            this.borderImg.color         = rarityColor;
            this.rarityNameElement.color = new Color(rarityColor.r, rarityColor.g, rarityColor.b, 0.3f);
            if (!item.IsVisualItem)
            {
                this.rarityNameElement.gameObject.SetActive(false);
            }
            else
            {
                switch (item.Rarity)
                {
                case ItemRarityType.COMMON:
                    this.rarityNameElement.text = $"[{this.commonText.Value}]";
                    break;

                case ItemRarityType.RARE:
                    this.rarityNameElement.text = $"[{this.rareText.Value}]";
                    this.rareEffect.SetActive(true);
                    break;

                case ItemRarityType.EPIC:
                    this.rarityNameElement.text = $"[{this.epicText.Value}]";
                    this.epicEffect.SetActive(true);
                    break;

                case ItemRarityType.LEGENDARY:
                    this.rarityNameElement.text = $"[{this.legendaryText.Value}]";
                    this.legendaryEffect.SetActive(true);
                    break;

                default:
                    break;
                }
            }
        }
Пример #13
0
        private static void RetrieveGarageVehicle(dynamic _data, CallbackDelegate _callback)
        {
            int garageID = _data.garageID;

            foreach (GarageItem gI in PlayerSession.getSelectedCharacter().Garage.garageItems)
            {
                if (gI.garageID == garageID)
                {
                    if (!gI.stored || gI.impounded)
                    {
                        Utils.WriteLine("Vehicle not stored or is impounded!"); _ = _callback(new { ok = false }); return;
                    }

                    MainClient.TriggerServerEvent("Laced:RetrieveGarageVehicle", PlayerSession.getSessionKey(), gI.garageID, new Action <bool, string>(async(_retrieved, _garageItem) => {
                        if (_retrieved)
                        {
                            GarageItem garageItem = JsonConvert.DeserializeObject <GarageItem>(_garageItem);

                            gI.setImpounded(garageItem.impounded);
                            gI.setStored(garageItem.stored);
                            uint vehicleHash = Helpers.GetVehicleHashFromString(garageItem.vehicleModel);
                            int vehicleID    = await Helpers.SpawnVehicle(vehicleHash, garageItem.vehicleNumberPlate);

                            gI.setNetworkID(API.NetworkGetNetworkIdFromEntity(vehicleID));

                            if (vehicleID != -1)
                            {
                                _ = _callback(new { ok = true });
                            }
                            else
                            {
                                _ = _callback(new { ok = false });
                            }
                        }
                    }));
                }
            }
        }
Пример #14
0
        protected override void FillFromEntity(Entity entity)
        {
            if (entity.HasComponent <ImageItemComponent>())
            {
                string spriteUid = entity.GetComponent <ImageItemComponent>().SpriteUid;
                base.banner.SpriteUid = spriteUid;
            }
            base.title.text = MarketItemNameLocalization.Instance.GetCategoryName(entity) + " \"";
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(entity);

            if (item != null)
            {
                base.title.text = base.title.text + MarketItemNameLocalization.Instance.GetGarageItemName(item);
            }
            else if (entity.HasComponent <DescriptionItemComponent>())
            {
                DescriptionItemComponent component = entity.GetComponent <DescriptionItemComponent>();
                base.title.text = base.title.text + component.Name;
            }
            base.title.text = base.title.text + "\"";
            XPriceItemComponent component2 = entity.GetComponent <XPriceItemComponent>();
            string priceStr = component2.Price.ToStringSeparatedByThousands();

            if (component2.Price < component2.OldPrice)
            {
                priceStr = priceStr + $" <s><#{this.greyColor.Color.ToHexString()}>{component2.OldPrice.ToStringSeparatedByThousands()}</color></s>";
            }
            this.SetPrice(priceStr, "<sprite=9>");
            base.EndDate = entity.GetComponent <MarketItemSaleComponent>().endDate;
            if (base.EndDate.UnityTime != 0f)
            {
                TextTimerComponent component = base.GetComponent <TextTimerComponent>();
                component.EndDate = base.EndDate;
                component.enabled = true;
            }
            base.FillFromEntity(entity);
        }
Пример #15
0
        public void ShowTutorialRewards(ShowTutorialRewardsEvent e, TutorialStepWithRewardsNode tutorialStepWithRewards, [JoinAll] ScreenNode screen)
        {
            List <SpecialOfferItem> items = new List <SpecialOfferItem>();

            foreach (Reward reward in tutorialStepWithRewards.tutorialRewardData.Rewards)
            {
                GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(reward.ItemId);
                if (item != null)
                {
                    items.Add(new SpecialOfferItem((int)reward.Count, item.Preview, item.Name));
                }
            }
            long crysCount = tutorialStepWithRewards.tutorialRewardData.CrysCount;

            if (crysCount > 0L)
            {
                items.Add(new SpecialOfferItem((int)crysCount, screen.battleResultsAwardsScreen.crysImageSkin.SpriteUid, screen.battleResultsAwardsScreen.crysLocalizedField.Value));
            }
            BattleResultSpecialOfferUiComponent specialOfferUI = screen.battleResultsAwardsScreen.specialOfferUI;

            specialOfferUI.ShowContent(screen.battleResultsAwardsScreen.tutorialCongratulationLocalizedField.Value, tutorialStepWithRewards.tutorialStepData.Message, items);
            specialOfferUI.SetTutorialRewardsButton();
            specialOfferUI.Appear();
        }
Пример #16
0
        private void BuyCardealerVehicle([FromSource] Player _player, string _seshKey, string _vehicleModel, NetworkCallbackDelegate _networkCallback)
        {
            Utils.WriteLine("Buying Cardealer vehicle!");
            if (_seshKey == null)
            {
                Utils.WriteLine("Session key is missing!");
                return;
            }

            Session foundSesh = Sessions.Find(s => s.Player.Handle == _player.Handle);

            if (foundSesh == null || foundSesh.SessionKey != _seshKey)
            {
                Utils.WriteLine("Session either doesn't exist or the session key doesn't match up");
                return;
            }

            Utils.WriteLine("Searching markers");
            foreach (string key in ConfigManager.MarkerConfig.Keys)
            {
                //Find the cardealers within the markers
                if (key.ToLower().Contains("dealer"))
                {
                    foreach (string dataKey in ConfigManager.MarkerConfig[key].MarkerData.Keys)
                    {
                        if (dataKey.ToLower().Contains("vehicles"))
                        {
                            string markerDataString = JsonConvert.SerializeObject(ConfigManager.MarkerConfig[key].MarkerData[dataKey]);
                            Dictionary <string, CardealerItem> markerData = JsonConvert.DeserializeObject <Dictionary <string, CardealerItem> >(markerDataString);

                            foreach (string dataKey2 in markerData.Keys)
                            {
                                if (dataKey2.ToLower().Contains(_vehicleModel))
                                {
                                    //We have found the vehicle
                                    //We need to save the car to the garage and the garage to the database
                                    string        jsonString    = JsonConvert.SerializeObject(markerData[dataKey2]);
                                    CardealerItem cardealerItem = JsonConvert.DeserializeObject <CardealerItem>(jsonString);
                                    if (!foundSesh.selectedCharacter.BuyItem(cardealerItem.Price))
                                    {
                                        Utils.WriteLine($"Player doesn't have enough money![{foundSesh.Player.Name}]");
                                        _networkCallback(false, null);
                                        return;
                                    }
                                    int        garageID   = foundSesh.selectedCharacter.Garage.garageItems.Count + 1;
                                    GarageItem garageItem = new GarageItem(garageID, foundSesh.selectedCharacter.Id, cardealerItem.CarName, cardealerItem.CarModel, Utils.CreateVehicleNumberPlate(), false, false, new Dictionary <string, int>());
                                    if (ConfigManager.ServerConfig.RPImpound)
                                    {
                                        garageItem.setImpounded(false);
                                    }
                                    else
                                    {
                                        garageItem.setImpounded(true);
                                    }
                                    garageItem.setStored(false);
                                    foundSesh.selectedCharacter.Garage.garageItems.Add(garageItem);
                                    foundSesh.UpdateCharacters(CharacterDBManager.UpdateCharacter(_player, foundSesh.User, foundSesh.selectedCharacter.Id));

                                    _networkCallback(true, JsonConvert.SerializeObject(garageItem));
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
        private void SellCardealerVehicle([FromSource] Player _player, string _seshKey, string _sellgarageItem, NetworkCallbackDelegate _networkCallback)
        {
            if (_seshKey == null)
            {
                Utils.WriteLine("Session key is missing!");
                return;
            }

            Session foundSesh = Sessions.Find(s => s.Player.Handle == _player.Handle);

            if (foundSesh == null || foundSesh.SessionKey != _seshKey)
            {
                Utils.WriteLine("Session either doesn't exist or the session key doesn't match up");
                return;
            }

            GarageItem sellgarageItem = JsonConvert.DeserializeObject <GarageItem>(_sellgarageItem);

            foreach (GarageItem gI in foundSesh.selectedCharacter.Garage.garageItems)
            {
                if (gI.garageID == sellgarageItem.garageID)
                {
                    foreach (string key in ConfigManager.MarkerConfig.Keys)
                    {
                        //Find the cardealers within the markers
                        if (key.ToLower().Contains("dealer"))
                        {
                            //Loop through vehicle dealer marker data
                            foreach (string dataKey in ConfigManager.MarkerConfig[key].MarkerData.Keys)
                            {
                                //Get the vehicles
                                if (dataKey.ToLower().Contains("vehicles"))
                                {
                                    string markerDataString = JsonConvert.SerializeObject(ConfigManager.MarkerConfig[key].MarkerData[dataKey]);
                                    Dictionary <string, CardealerItem> markerData = JsonConvert.DeserializeObject <Dictionary <string, CardealerItem> >(markerDataString);

                                    foreach (string dataKey2 in markerData.Keys)
                                    {
                                        if (dataKey2.ToLower().Contains(gI.vehicleModel))
                                        {
                                            //We have found the vehicle
                                            //We need to save the car to the garage and the garage to the database
                                            string        jsonString    = JsonConvert.SerializeObject(markerData[dataKey2]);
                                            CardealerItem cardealerItem = JsonConvert.DeserializeObject <CardealerItem>(jsonString);

                                            foundSesh.selectedCharacter.SellItem(cardealerItem.Price);
                                            foundSesh.selectedCharacter.SellVehicle(gI);

                                            foundSesh.UpdateCharacters(CharacterDBManager.UpdateCharacter(_player, foundSesh.User, foundSesh.selectedCharacter.Id));
                                            Utils.WriteLine("Updated character!");

                                            try
                                            {
                                                _networkCallback(true, JsonConvert.SerializeObject(gI), cardealerItem.Price);
                                                return;
                                            }
                                            catch (Exception _ex)
                                            {
                                                Utils.Throw(_ex);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            _networkCallback(false, null, 0);
        }
Пример #18
0
        public string GetGarageItemName(GarageItem item)
        {
            VisualItem item2 = item as VisualItem;

            return(((item2 == null) || ((item2.ParentItem == null) || item2.Name.Contains(item2.ParentItem.Name))) ? item.Name : $"{item2.ParentItem.Name} {item2.Name}");
        }