private static async Task CreationSelectPeds() { uint hash_f = (uint)API.GetHashKey(model_f); uint hash_m = (uint)API.GetHashKey(model_m); /* * Esperamos a que cargen los modelos en cache */ await Miscellanea.LoadModel(hash_f); await Miscellanea.LoadModel(hash_m); /* * Creamos los modelos en el sitio de creacion */ PedFemale = API.CreatePed((uint)hash_f, -558.43f, -3776.65f, 237.7f, 93.2f, false, true, true, true); PedMale = API.CreatePed((uint)hash_m, -558.52f, -3775.6f, 237.7f, 93.2f, false, true, true, true); /* * Necesitan un radom Outfit ya que no se por que no salen si no */ Function.Call((Hash)0x283978A15512B2FE, PedFemale, true); Function.Call((Hash)0x283978A15512B2FE, PedMale, true); /* * Congelamos las Peds */ API.FreezeEntityPosition(PedFemale, true); API.FreezeEntityPosition(PedMale, true); ApplyDefaultSkinCanaryEdition(PedFemale); ApplyDefaultSkinCanaryEdition(PedMale); TriggerEvent("vorp:setInstancePlayer", true); }
public void Insert(int surr) { int widx = surr / 64; int bidx = (int)(surr % 64); int len = bitmap.Length; if (widx >= len) { int newLen = 2 * len; while (widx >= newLen) { newLen *= 2; } long[] newBitmap = new long[newLen]; Array.Copy(bitmap, newBitmap, len); bitmap = newBitmap; } long mask = bitmap[widx]; if (!Miscellanea.BitIsSet64(mask, bidx)) { bitmap[widx] = mask | (1L << bidx); count++; } // Debug.Assert(count == LiveCount()); }
private void InsertIntoHashtable(int index, int hashcode) { int hashIdx = Miscellanea.UnsignedRemaider(hashcode, hashRange); buckets[index] = hashtable[hashIdx]; hashtable[hashIdx] = index; }
public void Delete(int index, int hashcode) { int hashIdx = Miscellanea.UnsignedRemaider(hashcode, hashtable.Length); int head = hashtable[hashIdx]; Debug.Assert(head != Empty); if (head == index) { hashtable[hashIdx] = buckets[index]; buckets[index] = Empty; return; } int curr = head; for ( ; ;) { int next = buckets[curr]; Debug.Assert(next != Empty); if (next == index) { buckets[curr] = buckets[next]; buckets[next] = Empty; return; } curr = next; } }
static Data() { try { Credentials = JsonConvert.DeserializeObject <Credentials>(File.ReadAllText(Config.MainDirectory + @"src\Credentials.json")); Armour = JsonConvert.DeserializeObject <Armour[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Armour.json")); Crates = JsonConvert.DeserializeObject <Crate[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Crates.json")); Fish = JsonConvert.DeserializeObject <Fish[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Fish.json")); Guns = JsonConvert.DeserializeObject <Gun[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Guns.json")); Knives = JsonConvert.DeserializeObject <Knife[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Knives.json")); Meat = JsonConvert.DeserializeObject <Meat[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Meat.json")); Miscellanea = JsonConvert.DeserializeObject <Item[]>(File.ReadAllText(Config.MainDirectory + @"src\Data\Items\Miscellanea.json")); } catch (IOException e) { Logger.Log(LogSeverity.Critical, "Error while loading up data, please fix this issue and restart the bot", e.Message); Console.ReadKey(); Environment.Exit(0); } Food = (Fish as Food[]).Concat(Meat).ToArray(); Weapons = (Guns as Weapon[]).Concat(Knives).ToArray(); CrateItems = (Weapons as CrateItem[]).Concat(Armour).OrderByDescending(x => x.CrateOdds).ToArray(); Items = Miscellanea.Concat(Crates).Concat(CrateItems).Concat(Food).ToArray(); CrateItemOdds = CrateItems.Sum(x => x.CrateOdds); FishAcquireOdds = Fish.Sum(x => x.AcquireOdds); MeatAcquireOdds = Meat.Sum(x => x.AcquireOdds); }
public async void StartCreationOfCharacter2(dynamic charsid, dynamic charxx) { API.DoScreenFadeOut(500); Tick += OnTick; charidx = charsid; usedcha = charxx; Tick += OnTickCameras; Function.Call(Hash._REQUEST_IMAP, 183712523); Function.Call(Hash._REQUEST_IMAP, -1699673416); Function.Call(Hash._REQUEST_IMAP, 1679934574); Function.Call(Hash.SET_CLOCK_TIME, 12, 00, 0); API.SetClockTime(12, 00, 00); Miscellanea.TeleportToCoords(-563.1345f, -3775.811f, 237.60f); await CreationSelectPeds(); await CreateCams(); API.SetCamActive(Camera, true); API.RenderScriptCams(true, true, 1000, true, true, 0); isSelectSexActive = true; secondchance = true; API.DoScreenFadeIn(500); }
private void RemoveFromHashtable(int index) { int hashcode = hashcodeOrNextFree[index]; int hashIdx = Miscellanea.UnsignedRemaider(hashcode, hashtable.Length); int idx = hashtable[hashIdx]; Debug.Assert(idx != -1); if (idx == index) { hashtable[hashIdx] = buckets[index]; // buckets[index] = -1; // NOT STRICTLY NECESSARY... return; } int prevIdx = idx; idx = buckets[idx]; while (idx != index) { prevIdx = idx; idx = buckets[idx]; Debug.Assert(idx != -1); } buckets[prevIdx] = buckets[index]; // buckets[index] = -1; // NOT STRICTLY NECESSARY }
// public static string IntToBinaryString(int number) { // string binStr = ""; // while (number != 0) { // binStr = (number & 1) + binStr; // number = number >>> 1; // } // if (binStr == "") // binStr = "0"; // return binStr; // } // // public static string IntToBinaryString(long number) { // string binStr = ""; // while (number > 0) { // binStr = (number & 1) + binStr; // number = number >>> 1; // } // if (binStr == "") // binStr = "0"; // return binStr; // } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// public static Obj Copy(UnaryTable[] tables) { int count = 0; for (int i = 0; i < tables.Length; i++) { count += tables[i].count; } if (count == 0) { return(EmptyRelObj.singleton); } Obj[] objs = new Obj[count]; int next = 0; for (int i = 0; i < tables.Length; i++) { UnaryTable table = tables[i]; SurrObjMapper mapper = table.mapper; long[] bitmap = table.bitmap; for (int j = 0; j < bitmap.Length; j++) { long mask = bitmap[j]; for (int k = 0; k < 64; k++) { if (Miscellanea.BitIsSet64(mask, k)) { objs[next++] = mapper(k + 64 * j); } } } } Debug.Assert(next == count); return(Builder.CreateSet(objs, objs.Length)); }
public void Finish() { if (clear) { int len = bitmapCopy.Length; for (int i = 0; i < len; i++) { long mask = bitmapCopy[i]; int offset = 64 * i; for (int j = 0; j < 64; j++) { if (Miscellanea.BitIsSet64(mask, j)) { store.Release(offset + j); } } } } else { for (int i = 0; i < deleteCount; i++) { int surr = deleteList[i]; if (surr != -1) { store.Release(surr); } } } }
public static bool ContainsMinor(long[] array, int size, int value) { int low = 0; int high = size - 1; while (low <= high) { int midIdx = low + (high - low) / 2; int minorVal = Miscellanea.Low(array[midIdx]); if (minorVal < value) { // midIdx is below the target range low = midIdx + 1; } else if (minorVal > value) { // midIdx is above the target range high = midIdx - 1; } else { return(true); } } return(false); }
public static async Task InitStores() { string ped = "S_M_M_Tailor_01"; uint HashPed = await Miscellanea.GetHash(ped); foreach (var store in GetConfig.Config["Stores"]) { int blipIcon = int.Parse(store["BlipIcon"].ToString()); float x = float.Parse(store["EnterStore"][0].ToString()); float y = float.Parse(store["EnterStore"][1].ToString()); float z = float.Parse(store["EnterStore"][2].ToString()); float Pedx = float.Parse(store["NPCStore"][0].ToString()); float Pedy = float.Parse(store["NPCStore"][1].ToString()); float Pedz = float.Parse(store["NPCStore"][2].ToString()); float Pedheading = float.Parse(store["NPCStore"][3].ToString()); int _blip = Function.Call <int>((Hash)0x554D9D53F696D002, 1664425300, x, y, z); Function.Call((Hash)0x74F74D3207ED525C, _blip, blipIcon, 1); Function.Call((Hash)0x9CB1A1623062F402, _blip, store["name"].ToString()); StoreBlips.Add(_blip); int _PedShop = API.CreatePed(HashPed, Pedx, Pedy, Pedz, Pedheading, false, true, true, true); while (!API.DoesEntityExist(_PedShop)) { await Delay(200); } Function.Call((Hash)0x283978A15512B2FE, _PedShop, true); StorePeds.Add(_PedShop); API.SetEntityNoCollisionEntity(API.PlayerPedId(), _PedShop, false); API.SetEntityCanBeDamaged(_PedShop, false); API.SetEntityInvincible(_PedShop, true); API.FreezeEntityPosition(_PedShop, true); } }
static Data() { try { Armour = JsonConvert.DeserializeObject <Armour[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Armour.json")); Crates = JsonConvert.DeserializeObject <Crate[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Crates.json")); Fish = JsonConvert.DeserializeObject <Fish[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Fish.json")); Guns = JsonConvert.DeserializeObject <Gun[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Guns.json")); Knives = JsonConvert.DeserializeObject <Knife[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Knives.json")); Meat = JsonConvert.DeserializeObject <Meat[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Meat.json")); Miscellanea = JsonConvert.DeserializeObject <Item[]>(File.ReadAllText(Config.MainDirectory + "src/Data/Items/Miscellanea.json")); } catch (IOException e) { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Logger.LogAsync(LogSeverity.Critical, $"Error while loading up data, please fix this issue and restart the bot: {e.Message}"); Console.ReadKey(); Environment.Exit(0); } Food = (Fish as Food[]).Concat(Meat).ToArray(); Weapons = (Guns as Weapon[]).Concat(Knives).ToArray(); CrateItems = (Weapons as CrateItem[]).Concat(Armour).OrderByDescending(x => x.CrateOdds).ToArray(); Items = Miscellanea.Concat(Crates).Concat(CrateItems).Concat(Food).ToArray(); CrateItemOdds = CrateItems.Sum(x => x.CrateOdds); FishAcquireOdds = Fish.Sum(x => x.AcquireOdds); MeatAcquireOdds = Meat.Sum(x => x.AcquireOdds); }
////////////////////////////////////////////////////////////////////////////// private static void Flip(long[] array, int size) { for (int i = 0; i < size; i++) { long entry = array[i]; array[i] = Miscellanea.Pack(Miscellanea.High(entry), Miscellanea.Low(entry)); } }
public static double CalculateRequiredMemoryForLevel(GameCardsNewDB.Struct.CardsNewDBLevel level) { double ImgMemoryKoef = 34; double BmpMemoryKoef = 2.5; double GifMemoryKoef = 80; double VideoBitrateKoef = 40; double MediaElementMemoryLenght = 40 * 1024 * 1024; //double MaxVideoLenght; //if(Is64Bit) MaxVideoLenght = 90 * 1024 * 1024; //else MaxVideoLenght = 60 * 1024 * 1024; double RequiredMemory = 0; foreach (var card in level.DbLevelRecord.Cards) { string filename = Sets.Settings.GetInstance().DefaultImage; if (File.Exists(card.ImageAddress)) { filename = card.ImageAddress; } if (!File.Exists(filename)) { continue; } string ext = Path.GetExtension(filename); long FileSize = new FileInfo(filename).Length; switch (Path.GetExtension(filename)) { case ".jpg": case ".png": RequiredMemory += ImgMemoryKoef * FileSize; break; case ".bmp": RequiredMemory += BmpMemoryKoef * FileSize; break; case ".gif": RequiredMemory += GifMemoryKoef * FileSize; break; case ".avi": case ".wmv": var bitrate = Miscellanea.GetVideoBitRate(filename); var tmpsize = (long)(MediaElementMemoryLenght + VideoBitrateKoef * bitrate); RequiredMemory += tmpsize; Console.WriteLine(filename + " bitrate=" + bitrate / 1024 + " Size=" + (tmpsize / (1024 * 1024)).ToString()); break; default: break; } } return(RequiredMemory); }
public static void Shuffle(Card[] cards) { var rnd = Miscellanea.GetUnrepeatableRandom(54); for (int i = 0; i < 54; i++) { cards[i] = CardCarton.Get(rnd[i]); } }
private static async void StartAnim() { uint HashVeh = (uint)API.GetHashKey("hotAirBalloon01"); Vector3 coords = new Vector3(GetConfig.Config["StartingCoords"][0].ToObject <float>(), GetConfig.Config["StartingCoords"][1].ToObject <float>(), 220.3232f); Miscellanea.LoadModel(HashVeh); vehCreated = API.CreateVehicle(HashVeh, coords.X + 1, coords.Y, coords.Z, 0, true, true, true, true); //Spawn Function.Call((Hash)0x283978A15512B2FE, vehCreated, true); //TaskWanderStandard Function.Call((Hash)0xBB9CE077274F6A1B, 10, 10); uint HashPed = (uint)API.GetHashKey("CS_balloonoperator"); Miscellanea.LoadModel(HashPed); pedCreated = API.CreatePed(HashPed, coords.X + 1, coords.Y, coords.Z, 0.0f, false, true, true, true); //Spawn Function.Call((Hash)0x283978A15512B2FE, pedCreated, true); Function.Call((Hash)0xF75B0D629E1C063D, API.PlayerPedId(), vehCreated, -1, false); API.TaskLeaveVehicle(API.PlayerPedId(), vehCreated, 0, 0); //API.SetEntityCoords(API.PlayerPedId(), coords.X, coords.Y, coords.Z, true, true, true, false); //API.SetEntityHeading(API.PlayerPedId(), 0); await Delay(1000); //SetPedIntoVehicle Function.Call((Hash)0xF75B0D629E1C063D, pedCreated, vehCreated, -1, false); API.SetEntityAsMissionEntity(pedCreated, true, true); API.SetEntityAsMissionEntity(pedCreated, true, true); API.FreezeEntityPosition(pedCreated, true); API.SetRelationshipBetweenGroups(1, HashPed, (uint)API.GetHashKey("PLAYER")); TriggerEvent("vorp:Tip", GetConfig.Langs["TipFinal"], 15000); for (int i = 0; i < 255; i++) { if (API.NetworkIsPlayerActive(i)) { if (API.GetPlayerPed(i) != API.PlayerPedId()) { API.SetEntityAlpha(API.GetPlayerPed(i), 255, false); API.SetEntityNoCollisionEntity(API.PlayerPedId(), API.GetPlayerPed(i), true); } } } }
public void Insert(int index, int hashcode) { Debug.Assert(buckets[index] == Empty); Debug.Assert(index < buckets.Length); int hashIdx = Miscellanea.UnsignedRemaider(hashcode, hashtable.Length); int head = hashtable[hashIdx]; hashtable[hashIdx] = index; buckets[index] = head; }
private async void CreationSexPed(string model, int camedit) { model_selected = model; skinPlayer["sex"] = model; if (model_selected == model_m) { skinPlayer["albedo"] = API.GetHashKey("mp_head_mr1_sc08_c0_000_ab"); texture_types["albedo"] = API.GetHashKey("mp_head_mr1_sc08_c0_000_ab"); texture_types["normal"] = API.GetHashKey("mp_head_mr1_000_nm"); texture_types["material"] = 0x7FC5B1E1; texture_types["color_type"] = 1; texture_types["texture_opacity"] = 1.0f; texture_types["unk_arg"] = 0; } else { skinPlayer["albedo"] = API.GetHashKey("mp_head_fr1_sc08_c0_000_ab"); texture_types["albedo"] = API.GetHashKey("mp_head_fr1_sc08_c0_000_ab"); texture_types["normal"] = API.GetHashKey("head_fr1_mp_002_nm"); texture_types["material"] = 0x7FC5B1E1; texture_types["color_type"] = 1; texture_types["texture_opacity"] = 1.0f; texture_types["unk_arg"] = 0; } Debug.WriteLine(model); await Delay(200); int pID = API.PlayerId(); int pPedID = API.PlayerPedId(); Menus.MainMenu.GetMenu(); Miscellanea.TeleportToCoords(-558.3258f, -3781.111f, 237.60f, 93.2f); API.FreezeEntityPosition(pPedID, true); uint model_hash = (uint)API.GetHashKey(model); await Miscellanea.LoadModel(model_hash); Function.Call((Hash)0xED40380076A31506, pID, model_hash, true); Function.Call((Hash)0x283978A15512B2FE, pPedID, true); API.RenderScriptCams(false, true, 3000, true, true, 0); await Delay(2500); API.SetCamActive(Camera_Editor, true); API.RenderScriptCams(true, true, 1000, true, true, 0); API.DeletePed(ref PedFemale); API.DeletePed(ref PedMale); isInCharCreation = true; Menus.MainMenu.GetMenu().OpenMenu(); //MenuCreateCharacter(model); }
private async Task CreateCams() { Camera = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -560.83f, -3776.33f, 239.58f, -13.56231f, 0.00f, -91.93626f, 45.00f, false, 0); Camera_Male = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -559.6671f, -3775.44f, 239.4266f, -9.622695f, 0.0f, -86.08074f, 45.00f, false, 0); Camera_Female = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -559.8455f, -3776.596f, 239.4435f, -13.41718f, 0.0f, -88.04576f, 45.00f, false, 0); Camera_Editor = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -560.1333f, -3780.923f, 239.4437f, -11.32719f, 0.0f, -90.96693f, 45.00f, false, 0); Camera_FaceEditor = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -558.9781f, -3780.955f, 239.186f, 6.591177f, 0.0f, -92.76723f, 40.00f, false, 0); Camera_Waist = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -559.1779f, -3780.964f, 238.4654f, -0.6631846f, 0.0f, -91.76698f, 40.00f, false, 0); Camera_Legs = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -559.2103f, -3781.039f, 238.4678f, -42.50001f, 0.0f, -89.2997f, 40.00f, false, 0); Camera_Body = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -560.6195f, -3780.708f, 239.1954f, -15.75687f, 0.0f, -89.49976f, 40.00f, false, 0); //Camera_Back = API.CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -563.0956f, -3780.669f, 238.465f, 0.906957f, 0.0f, -89.36639f, 40.00f, false, 0); uint HashVeh = await Miscellanea.GetHash("hotAirBalloon01"); uint HashPed = await Miscellanea.GetHash("CS_balloonoperator"); }
public vorpcore_cl() { EventHandlers["getCore"] += new Action <CallbackDelegate>((cb) => { Dictionary <string, dynamic> corefunctions = new Dictionary <string, dynamic> { ["RpcCall"] = new Action <string, CallbackDelegate, object>((name, callback, args) => { Callback.ServerCallBacks.Add(callback); TriggerServerEvent("vorp:TriggerServerCallback", name, Callback.RequestId, args); if (Callback.RequestId < 65565) { Callback.RequestId += 1; } else { Callback.RequestId = 0; Callback.ServerCallBacks.Clear(); } }), ["displayTip"] = new Action <string, int>((text, miliseconds) => { Exports["vorp_core"].DisplayTip(text, miliseconds); }), ["displayRightTip"] = new Action <string, int>((text, miliseconds) => { Exports["vorp_core"].DisplayRightTip(text, miliseconds); }), ["displayObjetive"] = new Action <string, int>((text, miliseconds) => { Exports["vorp_core"].DisplayObjetive(text, miliseconds); }), ["displayTopCenterNotification"] = new Action <string, string, int>((text, location, miliseconds) => { Exports["vorp_core"].DisplayTopCenterNotification(text, location, miliseconds); }), ["displayLeftNotification"] = new Action <string, string, string, string, int>(async(title, text, dic, icon, miliseconds) => { await Miscellanea.LoadTexture(dic); Exports["vorp_core"].DisplayLeftNotification(title, text, dic, icon, miliseconds); }), }; cb.Invoke(corefunctions); }); }
int LiveCount() { int liveCount = 0; for (int i = 0; i < bitmap.Length; i++) { long mask = bitmap[i]; for (int j = 0; j < 64; j++) { if (Miscellanea.BitIsSet64(mask, j)) { liveCount++; } } } return(liveCount); }
public void Delete(int surr) { Debug.Assert(surr < 64 * bitmap.Length); int widx = surr / 64; if (widx < bitmap.Length) { long mask = bitmap[widx]; int bidx = (int)surr % 64; if (Miscellanea.BitIsSet64(mask, bidx)) { bitmap[widx] = mask & ~(1L << bidx); count--; } } // Debug.Assert(count == LiveCount()); }
public async Task StartAnim() { uint hashmodel = (uint)API.GetHashKey("mp_male"); await Miscellanea.LoadModel(hashmodel); int character_1 = API.CreatePed(hashmodel, 1701.316f, 1512.134f, 146.87f, 116.70f, false, false, true, true); Function.Call((Hash)0x283978A15512B2FE, character_1, true); await Delay(1000); API.TaskGoToCoordAnyMeans(character_1, 1696.17f, 1508.474f, 147.85f, 0.5f, 0, false, 524419, -1f); await Delay(8000); API.TaskGoToCoordAnyMeans(character_1, 1697.74f, 1510.202f, 147.87f, 0.5f, 0, false, 524419, -1f); await Delay(5000); API.DeletePed(ref character_1); }
private async Task CreationSelectPeds() { uint hash_f = await Miscellanea.GetHash(model_f); uint hash_m = await Miscellanea.GetHash(model_m); await Miscellanea.GetHash("mp_head_fr1_sc08_c0_000_ab"); /* * Esperamos a que cargen los modelos en cache */ /* * Creamos los modelos en el sitio de creacion */ PedFemale = API.CreatePed((uint)hash_f, -558.43f, -3776.65f, 237.7f, 93.2f, false, true, true, true); PedMale = API.CreatePed((uint)hash_m, -558.52f, -3775.6f, 237.7f, 93.2f, false, true, true, true); /* * Necesitan un radom Outfit ya que no se por que no salen si no */ while (!(API.DoesEntityExist(PedFemale) && API.DoesEntityExist(PedMale))) { await Delay(100); } while (!(Function.Call <bool>((Hash)0xA0BC8FAED8CFEB3C, PedFemale) && Function.Call <bool>((Hash)0xA0BC8FAED8CFEB3C, PedMale))) { await Delay(100); } Function.Call((Hash)0x283978A15512B2FE, PedFemale, true); //female fix need to set default ApplyDefaultSkin(PedFemale); //male fix need to set default ApplyDefaultSkin(PedMale); await Delay(10); /* * Congelamos las Peds */ API.FreezeEntityPosition(PedFemale, true); API.FreezeEntityPosition(PedMale, true); TriggerEvent("vorp:setInstancePlayer", true); }
//////////////////////////////////////////////////////////////////////////// bool ColsAreKey(Index index, int col1, int col2) { int[] hashtable = index.hashtable; long[] bucket = new long[32]; for (int i = 0; i < hashtable.Length; i++) { int count = 0; int idx = hashtable[i]; while (idx != Empty) { int offset = 3 * idx; long arg1 = flatTuples[offset + col1]; long arg2 = flatTuples[offset + col2]; long packedArgs = arg1 | (arg2 << 32); Debug.Assert(arg1 == (packedArgs & 0xFFFFFFFFL)); Debug.Assert(arg2 == Miscellanea.UnsignedLeftShift64(packedArgs, 32)); bucket = Array.Append(bucket, count++, packedArgs); idx = index.Next(idx); } if (count > 1) { if (count > 2) { Array.Sort(bucket, count); } long last = bucket[0]; for (int j = 1; j < count; j++) { long val = bucket[j]; if (val == last) { return(false); } last = val; } } } return(true); }
public int ValueToSurr(Obj value) { if (count == 0) { return(-1); } int hashcode = value.SignedHashcode(); int hashIdx = Miscellanea.UnsignedRemaider(hashcode, hashtable.Length); int idx = hashtable[hashIdx]; while (idx != -1) { Debug.Assert(values[idx] != null); if (hashcodeOrNextFree[idx] == hashcode && value.IsEq(values[idx])) { return(idx); } idx = buckets[idx]; } return(-1); }
public async void StartCreationOfCharacter() { Tick += OnTick; Tick += OnTickAnimm; Tick += OnTickCameras; /* * Cargamos los modelos del mapa de creación del online de RDR2 */ Function.Call(Hash._REQUEST_IMAP, 183712523); Function.Call(Hash._REQUEST_IMAP, -1699673416); Function.Call(Hash._REQUEST_IMAP, 1679934574); /* * Cambiamos el tiempo para que se vea de mañana */ Function.Call(Hash.SET_CLOCK_TIME, 12, 00, 0); API.SetClockTime(12, 00, 00); Miscellanea.TeleportToCoords(-563.1345f, -3775.811f, 237.60f); /* * Cargammos las Peds en el sitio */ await CreationSelectPeds(); /* * Creamos las camaras para movernos de sala con ella y la activamos */ await CreateCams(); /* * Esperamos un tiempo a que pueda cargar los modelos y el tiempo */ API.SetCamActive(Camera, true); API.RenderScriptCams(true, true, 1000, true, true, 0); isSelectSexActive = true; }
public static bool IsBigVideoFilesCheckOk(string[] Filenames) { //определение наличия файлов большого размера Dictionary <string, double> BigBitrateFiles = new Dictionary <string, double>(); foreach (var filename in Filenames) { var ext = Path.GetExtension(filename); if (!File.Exists(filename) && (ext != ".avi" || ext != ".wmv")) { continue; } var Bitrate = Miscellanea.GetVideoBitRate(filename); if (Bitrate > Settings.GetInstance().MaxVideoFileBitrate) { BigBitrateFiles.Add(Path.GetFileName(filename), Bitrate / 1024); } } if (BigBitrateFiles.Count > 0) { string BigLenghtFilesString = ""; foreach (var BigLenghtFile in BigBitrateFiles) { BigLenghtFilesString += BigLenghtFile.Key + " : " + BigLenghtFile.Value.ToString("0") + "kbps\n"; } if (System.Windows.MessageBox.Show("Некоторые файлы видео имеют очень высокий битрейт (большое разрешение, частоту и т.п.)," + " что может замедлить работу, " + "вызвать недостаток оперативной памяти, в том числе в ходе " + "игры при выборе уровня с большим количеством таких файлов:\n\n" + BigLenghtFilesString + "\nВсе равно открыть указанные файлы?", "Очень большие файлы", (MessageBoxButton)MessageBoxButtons.YesNo, (MessageBoxImage)MessageBoxIcon.Information) == MessageBoxResult.No) { return(false); } } return(true); }
private void Browser_ChoiceUrl(string filename) { if (!(Miscellanea.ExstentionCheck(filename, new string[] { ".jpg", ".png", ".gif", ".bmp", ".avi", ".wmv" }))) { var res = System.Windows.MessageBox.Show(@"Надо выбрать прямой путь к картинке с расширением " + ".jpg, .png, .gif или .bmp либо видеофайлу с расширением .avi или .wmv. " + "Т.е. чтобы в адресной строке браузера адрес заканчивался этим расширением: " + @"например так http:\\www.somesite.ru\image.jpg.", "Неверное расширение", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (res == MessageBoxResult.Yes) { return; } } if (!Miscellanea.UrlExists(filename)) { System.Windows.MessageBox.Show(@"По указанному адресу файл не обнаружен.", "Файл не найден", MessageBoxButton.OK, MessageBoxImage.Warning); return; } CreateCardsFromArrayOfImgFilenames(new string[] { filename }); }
public async void StartCreationOfCharacter() { Tick += OnTick; Tick += OnTickCameras; Function.Call(Hash._REQUEST_IMAP, 183712523); Function.Call(Hash._REQUEST_IMAP, -1699673416); Function.Call(Hash._REQUEST_IMAP, 1679934574); Function.Call(Hash.SET_CLOCK_TIME, 12, 00, 0); API.SetClockTime(12, 00, 00); Miscellanea.TeleportToCoords(-563.1345f, -3775.811f, 237.60f); await CreationSelectPeds(); await CreateCams(); API.SetCamActive(Camera, true); API.RenderScriptCams(true, true, 1000, true, true, 0); isSelectSexActive = true; secondchance = false; }