diff --git a/ReallifeGamemode.Client/Interaction/elevator.ts b/ReallifeGamemode.Client/Interaction/elevator.ts index 149e321d..171f1015 100644 --- a/ReallifeGamemode.Client/Interaction/elevator.ts +++ b/ReallifeGamemode.Client/Interaction/elevator.ts @@ -19,19 +19,16 @@ cancelItem.BackColor = new Color(213, 0, 0); cancelItem.HighlightedBackColor = new Color(229, 57, 53); export default function elevatorList(globalData: IGlobalData) { - var elevatorMenu: NativeUI.Menu; var stages; var stage = ""; - //Weapon Menu mp.events.add('showElevatorMenu', (stagesArr) => { if (!globalData.InMenu) { - globalData.InMenu = true; stages = JSON.parse(stagesArr); diff --git a/ReallifeGamemode.Client/Jobs/RefuseCollector.ts b/ReallifeGamemode.Client/Jobs/RefuseCollector.ts index 8c691580..0b2d6789 100644 --- a/ReallifeGamemode.Client/Jobs/RefuseCollector.ts +++ b/ReallifeGamemode.Client/Jobs/RefuseCollector.ts @@ -1,9 +1,8 @@ export default function RefuseCollector() { - var State = false; var Traegt = false; var HintenVoll = false; - var MuellSack = null; + var BlipTonneHinten = null; var CheckpointTonneHinten = null; var ShapeTonneHinten = null; @@ -17,8 +16,6 @@ var BlipTonne = []; var ShapeTonne = []; - - mp.events.add('SERVER:MuellmannStatusTrue', () => { State = true; }); @@ -28,14 +25,13 @@ }); mp.events.add('SERVER:MuellmannBCSErstellen', (jsonPosArr, veh) => { - let posArr = JSON.parse(jsonPosArr); vehicle = veh; for (var i = 0; i < posArr.length; i++) { let pos = new mp.Vector3(posArr[i].x, posArr[i].y, posArr[i].z - 1) BlipTonne.push(mp.blips.new(1, pos, { name: 'Müllmann', color: 45, shortRange: false })); - BlipTonne[i].setFlashes(true); - ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z +0.5, 1.75)); + BlipTonne[i].setFlashTimer(2000); + ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z + 0.5, 1.75)); } BlipTonneBase = mp.blips.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), { name: 'Müllmann', color: 5, shortRange: false }); @@ -43,7 +39,6 @@ ShapeTonneBase = mp.colshapes.newSphere(-535.1912, -1713.742, 19.23861 - 1, 10); }); mp.events.add('SERVER:MuellmannBCSEntfernen', () => { - for (var i = 0; i < BlipTonne.length; i++) { if (BlipTonne[i] == null) continue; BlipTonne[i].destroy(); @@ -79,10 +74,8 @@ BlipTonne[i] = null; ShapeTonne[i].destroy(); ShapeTonne[i] = null; - MuellSack = mp.objects.new(3619689535, mp.players.local.position, { rotation: new mp.Vector3(0.0, 0.0, 0.0), alpha: 255, dimension: 0 }); - MuellSack.attachTo(mp.players.local.handle, mp.players.local.getBoneIndex(6286), 0.08, 0.0, -0.03, 270.0, 0.0, 25.0, true, true, false, false, 0, true); - interval = setInterval(function () { createMarker(); }, 250); + interval = setInterval(function () { createMarker(); }, 2); } else { mp.gui.chat.push("Der Müllwagen ist bereits voll! Fahre zur Base und lade ab!"); @@ -96,7 +89,6 @@ } if (Shape == ShapeTonneHinten) { if (Traegt) { - Traegt = false; mp.events.callRemote('CLIENT:MuellmannAddSack'); @@ -108,10 +100,7 @@ CheckpointTonneHinten = null; if (ShapeTonneHinten) ShapeTonneHinten.destroy(); ShapeTonneHinten = null; - MuellSack.destroy(); - } - } else if (Shape == ShapeTonneBase) { BlipTonneBase.setRoute(false); @@ -134,11 +123,31 @@ HintenVoll = true; }); - function createMarker() { if (vehicle != null) { - var boneIndex = vehicle.getBoneIndexByName("platelight"); - let pos = vehicle.getWorldPositionOfBone(boneIndex); + var boneIndex2 = vehicle.getBoneIndexByName("platelight"); + var boneIndex1 = vehicle.getBoneIndexByName("chassis_dummy"); + + let posPlate = vehicle.getWorldPositionOfBone(boneIndex2); + let posCentre = vehicle.getWorldPositionOfBone(boneIndex1); + + let plateVec = new mp.Vector3(posPlate.x, posPlate.y, posPlate.z); + let lightVec = new mp.Vector3(posCentre.x, posCentre.y, posCentre.z); + + let posPL = lightVec.subtract(plateVec); + + let temp = new mp.Vector3(posPL.x * -1, posPL.y * -1, posPL.z * -1) + + let length = Math.sqrt((temp.x * temp.x) + (temp.y * temp.y) + (temp.z * temp.z)); + + let x = temp.x / length; + let y = temp.y / length; + let z = temp.z / length; + + temp = new mp.Vector3(x, y, z - 1); + + let pos = plateVec.add(temp); + if (BlipTonneHinten) BlipTonneHinten.destroy(); BlipTonneHinten = null; if (CheckpointTonneHinten) CheckpointTonneHinten.destroy(); @@ -147,10 +156,7 @@ ShapeTonneHinten = null; BlipTonneHinten = mp.blips.new(318, pos, { name: 'Müllmann', color: 24, shortRange: false }); CheckpointTonneHinten = mp.markers.new(1, pos, 1, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [0, 255, 0, 255], visible: true, dimension: 0 }); - ShapeTonneHinten = mp.colshapes.newSphere(pos.x, pos.y, pos.z - 1, 2); - - + ShapeTonneHinten = mp.colshapes.newSphere(pos.x, pos.y, pos.z, 2); } }; - } \ No newline at end of file diff --git a/ReallifeGamemode.Client/Ped/PedCreator.ts b/ReallifeGamemode.Client/Ped/PedCreator.ts new file mode 100644 index 00000000..600599be --- /dev/null +++ b/ReallifeGamemode.Client/Ped/PedCreator.ts @@ -0,0 +1,768 @@ +export default function PedCreator() { + // Update 04/03/2020, Ped count [739] + var PedHashes = { + a_c_boar: 0xCE5FF074, + a_c_cat_01: 0x573201B8, + a_c_chickenhawk: 0xAAB71F62, + a_c_chimp: 0xA8683715, + a_c_chop: 0x14EC17EA, + a_c_cormorant: 0x56E29962, + a_c_cow: 0xFCFA9E1E, + a_c_coyote: 0x644AC75E, + a_c_crow: 0x18012A9F, + a_c_deer: 0xD86B5A95, + a_c_dolphin: 0x8BBAB455, + a_c_fish: 0x2FD800B7, + a_c_hen: 0x6AF51FAF, + a_c_humpback: 0x471BE4B2, + a_c_husky: 0x4E8F95A2, + a_c_killerwhale: 0x8D8AC8B9, + a_c_mtlion: 0x1250D7BA, + a_c_pig: 0xB11BAB56, + a_c_pigeon: 0x06A20728, + a_c_poodle: 0x431D501C, + a_c_pug: 0x6D362854, + a_c_rabbit_01: 0xDFB55C81, + a_c_rat: 0xC3B52966, + a_c_retriever: 0x349F33E1, + a_c_rhesus: 0xC2D06F53, + a_c_rottweiler: 0x9563221D, + a_c_seagull: 0xD3939DFD, + a_c_sharkhammer: 0x3C831724, + a_c_sharktiger: 0x06C3F072, + a_c_shepherd: 0x431FC24C, + a_c_stingray: 0xA148614D, + a_c_westy: 0xAD7844BB, + a_f_m_beach_01: 0x303638A7, + a_f_m_bevhills_01: 0xBE086EFD, + a_f_m_bevhills_02: 0xA039335F, + a_f_m_bodybuild_01: 0x3BD99114, + a_f_m_business_02: 0x1FC37DBC, + a_f_m_downtown_01: 0x654AD86E, + a_f_m_eastsa_01: 0x9D3DCB7A, + a_f_m_eastsa_02: 0x63C8D891, + a_f_m_fatbla_01: 0xFAB48BCB, + a_f_m_fatcult_01: 0xB5CF80E4, + a_f_m_fatwhite_01: 0x38BAD33B, + a_f_m_ktown_01: 0x52C824DE, + a_f_m_ktown_02: 0x41018151, + a_f_m_prolhost_01: 0x169BD1E1, + a_f_m_salton_01: 0xDE0E0969, + a_f_m_skidrow_01: 0xB097523B, + a_f_m_soucent_01: 0x745855A1, + a_f_m_soucent_02: 0xF322D338, + a_f_m_soucentmc_01: 0xCDE955D2, + a_f_m_tourist_01: 0x505603B9, + a_f_m_tramp_01: 0x48F96F5B, + a_f_m_trampbeac_01: 0x8CA0C266, + a_f_o_genstreet_01: 0x61C81C85, + a_f_o_indian_01: 0xBAD7BB80, + a_f_o_ktown_01: 0x47CF5E96, + a_f_o_salton_01: 0xCCFF7D8A, + a_f_o_soucent_01: 0x3DFA1830, + a_f_o_soucent_02: 0xA56DE716, + a_f_y_beach_01: 0xC79F6928, + a_f_y_bevhills_01: 0x445AC854, + a_f_y_bevhills_02: 0x5C2CF7F8, + a_f_y_bevhills_03: 0x20C8012F, + a_f_y_bevhills_04: 0x36DF2D5D, + a_f_y_business_01: 0x2799EFD8, + a_f_y_business_02: 0x31430342, + a_f_y_business_03: 0xAE86FDB4, + a_f_y_business_04: 0xB7C61032, + a_f_y_eastsa_01: 0xF5B0079D, + a_f_y_eastsa_02: 0x0438A4AE, + a_f_y_eastsa_03: 0x51C03FA4, + a_f_y_epsilon_01: 0x689C2A80, + a_f_y_femaleagent: 0x50610C43, + a_f_y_fitness_01: 0x457C64FB, + a_f_y_fitness_02: 0x13C4818C, + a_f_y_genhot_01: 0x2F4AEC3E, + a_f_y_golfer_01: 0x7DD8FB58, + a_f_y_hiker_01: 0x30830813, + a_f_y_hippie_01: 0x1475B827, + a_f_y_hipster_01: 0x8247D331, + a_f_y_hipster_02: 0x97F5FE8D, + a_f_y_hipster_03: 0xA5BA9A16, + a_f_y_hipster_04: 0x199881DC, + a_f_y_indian_01: 0x092D9CC1, + a_f_y_juggalo_01: 0xDB134533, + a_f_y_runner_01: 0xC7496729, + a_f_y_rurmeth_01: 0x3F789426, + a_f_y_scdressy_01: 0xDB5EC400, + a_f_y_skater_01: 0x695FE666, + a_f_y_soucent_01: 0x2C641D7A, + a_f_y_soucent_02: 0x5A8EF9CF, + a_f_y_soucent_03: 0x87B25415, + a_f_y_tennis_01: 0x550C79C6, + a_f_y_topless_01: 0x9CF26183, + a_f_y_tourist_01: 0x563B8570, + a_f_y_tourist_02: 0x9123FB40, + a_f_y_vinewood_01: 0x19F41F65, + a_f_y_vinewood_02: 0xDAB6A0EB, + a_f_y_vinewood_03: 0x379DDAB8, + a_f_y_vinewood_04: 0xFAE46146, + a_f_y_yoga_01: 0xC41B062E, + a_m_m_acult_01: 0x5442C66B, + a_m_m_afriamer_01: 0xD172497E, + a_m_m_beach_01: 0x403DB4FD, + a_m_m_beach_02: 0x787FA588, + a_m_m_bevhills_01: 0x54DBEE1F, + a_m_m_bevhills_02: 0x3FB5C3D3, + a_m_m_business_01: 0x7E6A64B7, + a_m_m_eastsa_01: 0xF9A6F53F, + a_m_m_eastsa_02: 0x07DD91AC, + a_m_m_farmer_01: 0x94562DD7, + a_m_m_fatlatin_01: 0x61D201B3, + a_m_m_genfat_01: 0x06DD569F, + a_m_m_genfat_02: 0x13AEF042, + a_m_m_golfer_01: 0xA9EB0E42, + a_m_m_hasjew_01: 0x6BD9B68C, + a_m_m_hillbilly_01: 0x6C9B2849, + a_m_m_hillbilly_02: 0x7B0E452F, + a_m_m_indian_01: 0xDDCAAA2C, + a_m_m_ktown_01: 0xD15D7E71, + a_m_m_malibu_01: 0x2FDE6EB7, + a_m_m_mexcntry_01: 0xDD817EAD, + a_m_m_mexlabor_01: 0xB25D16B2, + a_m_m_og_boss_01: 0x681BD012, + a_m_m_paparazzi_01: 0xECCA8C15, + a_m_m_polynesian_01: 0xA9D9B69E, + a_m_m_prolhost_01: 0x9712C38F, + a_m_m_rurmeth_01: 0x3BAD4184, + a_m_m_salton_01: 0x4F2E038A, + a_m_m_salton_02: 0x60F4A717, + a_m_m_salton_03: 0xB28C4A45, + a_m_m_salton_04: 0x964511B7, + a_m_m_skater_01: 0xD9D7588C, + a_m_m_skidrow_01: 0x01EEA6BD, + a_m_m_socenlat_01: 0x0B8D69E3, + a_m_m_soucent_01: 0x6857C9B7, + a_m_m_soucent_02: 0x9F6D37E1, + a_m_m_soucent_03: 0x8BD990BA, + a_m_m_soucent_04: 0xC2FBFEFE, + a_m_m_stlat_02: 0xC2A87702, + a_m_m_tennis_01: 0x546A5344, + a_m_m_tourist_01: 0xC89F0184, + a_m_m_tramp_01: 0x1EC93FD0, + a_m_m_trampbeac_01: 0x53B57EB0, + a_m_m_tranvest_01: 0xE0E69974, + a_m_m_tranvest_02: 0xF70EC5C4, + a_m_o_acult_01: 0x55446010, + a_m_o_acult_02: 0x4BA14CCA, + a_m_o_beach_01: 0x8427D398, + a_m_o_genstreet_01: 0xAD54E7A8, + a_m_o_ktown_01: 0x1536D95A, + a_m_o_salton_01: 0x20208E4D, + a_m_o_soucent_01: 0x2AD8921B, + a_m_o_soucent_02: 0x4086BD77, + a_m_o_soucent_03: 0x0E32D8D0, + a_m_o_tramp_01: 0x174D4245, + a_m_y_acult_01: 0xB564882B, + a_m_y_acult_02: 0x80E59F2E, + a_m_y_beach_01: 0xD1FEB884, + a_m_y_beach_02: 0x23C7DC11, + a_m_y_beach_03: 0xE7A963D9, + a_m_y_beachvesp_01: 0x7E0961B8, + a_m_y_beachvesp_02: 0xCA56FA52, + a_m_y_bevhills_01: 0x76284640, + a_m_y_bevhills_02: 0x668BA707, + a_m_y_breakdance_01: 0x379F9596, + a_m_y_busicas_01: 0x9AD32FE9, + a_m_y_business_01: 0xC99F21C4, + a_m_y_business_02: 0xB3B3F5E6, + a_m_y_business_03: 0xA1435105, + a_m_y_cyclist_01: 0xFDC653C7, + a_m_y_dhill_01: 0xFF3E88AB, + a_m_y_downtown_01: 0x2DADF4AA, + a_m_y_eastsa_01: 0xA4471173, + a_m_y_eastsa_02: 0x168775F6, + a_m_y_epsilon_01: 0x77D41A3E, + a_m_y_epsilon_02: 0xAA82FF9B, + a_m_y_gay_01: 0xD1CCE036, + a_m_y_gay_02: 0xA5720781, + a_m_y_genstreet_01: 0x9877EF71, + a_m_y_genstreet_02: 0x3521A8D2, + a_m_y_golfer_01: 0xD71FE131, + a_m_y_hasjew_01: 0xE16D8F01, + a_m_y_hiker_01: 0x50F73C0C, + a_m_y_hippy_01: 0x7D03E617, + a_m_y_hipster_01: 0x2307A353, + a_m_y_hipster_02: 0x14D506EE, + a_m_y_hipster_03: 0x4E4179C6, + a_m_y_indian_01: 0x2A22FBCE, + a_m_y_jetski_01: 0x2DB7EEF3, + a_m_y_juggalo_01: 0x91CA3E2C, + a_m_y_ktown_01: 0x1AF6542C, + a_m_y_ktown_02: 0x297FF13F, + a_m_y_latino_01: 0x132C1A8E, + a_m_y_methhead_01: 0x696BE0A9, + a_m_y_mexthug_01: 0x3053E555, + a_m_y_motox_01: 0x64FDEA7D, + a_m_y_motox_02: 0x77AC8FDA, + a_m_y_musclbeac_01: 0x4B652906, + a_m_y_musclbeac_02: 0xC923247C, + a_m_y_polynesian_01: 0x8384FC9F, + a_m_y_roadcyc_01: 0xF561A4C6, + a_m_y_runner_01: 0x25305EEE, + a_m_y_runner_02: 0x843D9D0F, + a_m_y_salton_01: 0xD7606C30, + a_m_y_skater_01: 0xC1C46677, + a_m_y_skater_02: 0xAFFAC2E4, + a_m_y_soucent_01: 0xE716BDCB, + a_m_y_soucent_02: 0xACA3C8CA, + a_m_y_soucent_03: 0xC3F0F764, + a_m_y_soucent_04: 0x8A3703F1, + a_m_y_stbla_01: 0xCF92ADE9, + a_m_y_stbla_02: 0x98C7404F, + a_m_y_stlat_01: 0x8674D5FC, + a_m_y_stwhi_01: 0x2418C430, + a_m_y_stwhi_02: 0x36C6E98C, + a_m_y_sunbathe_01: 0xB7292F0C, + a_m_y_surfer_01: 0xEAC2C7EE, + a_m_y_vindouche_01: 0xC19377E7, + a_m_y_vinewood_01: 0x4B64199D, + a_m_y_vinewood_02: 0x5D15BD00, + a_m_y_vinewood_03: 0x1FDF4294, + a_m_y_vinewood_04: 0x31C9E669, + a_m_y_yoga_01: 0xAB0A7155, + cs_amandatownley: 0x95EF18E3, + cs_andreas: 0xE7565327, + cs_ashley: 0x26C3D079, + cs_bankman: 0x9760192E, + cs_barry: 0x69591CF7, + cs_beverly: 0xB46EC356, + cs_brad: 0xEFE5AFE6, + cs_bradcadaver: 0x7228AF60, + cs_carbuyer: 0x8CCE790F, + cs_casey: 0xEA969C40, + cs_chengsr: 0x30DB9D7B, + cs_chrisformage: 0xC1F380E6, + cs_clay: 0xDBCB9834, + cs_dale: 0x0CE81655, + cs_davenorton: 0x8587248C, + cs_debra: 0xECD04FE9, + cs_denise: 0x6F802738, + cs_devin: 0x2F016D02, + cs_dom: 0x4772AF42, + cs_dreyfuss: 0x3C60A153, + cs_drfriedlander: 0xA3A35C2F, + cs_fabien: 0x47035EC1, + cs_fbisuit_01: 0x585C0B52, + cs_floyd: 0x062547E7, + cs_guadalope: 0x0F9513F1, + cs_gurk: 0xC314F727, + cs_hunter: 0x5B44892C, + cs_janet: 0x3034F9E2, + cs_jewelass: 0x4440A804, + cs_jimmyboston: 0x039677BD, + cs_jimmydisanto: 0xB8CC92B4, + cs_joeminuteman: 0xF09D5E29, + cs_johnnyklebitz: 0xFA8AB881, + cs_josef: 0x459762CA, + cs_josh: 0x450EEF9D, + cs_karen_daniels: 0x4BAF381C, + cs_lamardavis: 0x45463A0D, + cs_lazlow: 0x38951A1B, + cs_lestercrest: 0xB594F5C3, + cs_lifeinvad_01: 0x72551375, + cs_magenta: 0x5816C61A, + cs_manuel: 0xFBB374CA, + cs_marnie: 0x574DE134, + cs_martinmadrazo: 0x43595670, + cs_maryann: 0x0998C7AD, + cs_michelle: 0x70AEB9C8, + cs_milton: 0xB76A330F, + cs_molly: 0x45918E44, + cs_movpremf_01: 0x4BBA84D9, + cs_movpremmale: 0x8D67EE7D, + cs_mrk: 0xC3CC9A75, + cs_mrs_thornhill: 0x4F921E6E, + cs_mrsphillips: 0xCBFDA3CF, + cs_natalia: 0x4EFEB1F0, + cs_nervousron: 0x7896DA94, + cs_nigel: 0xE1479C0B, + cs_old_man1a: 0x1EEC7BDC, + cs_old_man2: 0x98F9E770, + cs_omega: 0x8B70B405, + cs_orleans: 0xAD340F5A, + cs_paper: 0x6B38B8F8, + cs_patricia: 0xDF8B1301, + cs_priest: 0x4D6DE57E, + cs_prolsec_02: 0x1E9314A2, + cs_russiandrunk: 0x46521A32, + cs_siemonyetarian: 0xC0937202, + cs_solomon: 0xF6D1E04E, + cs_stevehains: 0xA4E0A1FE, + cs_stretch: 0x893D6805, + cs_tanisha: 0x42FE5370, + cs_taocheng: 0x8864083D, + cs_taostranslator: 0x53536529, + cs_tenniscoach: 0x5C26040A, + cs_terry: 0x3A5201C5, + cs_tom: 0x69E8ABC3, + cs_tomepsilon: 0x8C0FD4E2, + cs_tracydisanto: 0x0609B130, + cs_wade: 0xD266D9D6, + cs_zimbor: 0xEAACAAF0, + csb_abigail: 0x89768941, + csb_agent: 0xD770C9B4, + csb_anita: 0x0703F106, + csb_anton: 0xA5C787B6, + csb_ballasog: 0xABEF0004, + csb_bride: 0x82BF7EA1, + csb_burgerdrug: 0x8CDCC057, + csb_car3guy1: 0x04430687, + csb_car3guy2: 0x1383A508, + csb_chef: 0xA347CA8A, + csb_chef2: 0xAE5BE23A, + csb_chin_goon: 0xA8C22996, + csb_cletus: 0xCAE9E5D5, + csb_cop: 0x9AB35F63, + csb_customer: 0xA44F6F8B, + csb_denise_friend: 0xB58D2529, + csb_fos_rep: 0x1BCC157B, + csb_g: 0xA28E71D7, + csb_groom: 0x7AAB19D2, + csb_grove_str_dlr: 0xE8594E22, + csb_hao: 0xEC9E8F1C, + csb_hugh: 0x6F139B54, + csb_imran: 0xE3420BDB, + csb_jackhowitzer: 0x44BC7BB1, + csb_janitor: 0xC2005A40, + csb_maude: 0xBCC475CB, + csb_money: 0x989DFD9A, + csb_mp_agent14: 0x6DBBFC8B, + csb_mweather: 0x613E626C, + csb_ortega: 0xC0DB04CF, + csb_oscar: 0xF41F399B, + csb_paige: 0x5B1FA0C3, + csb_popov: 0x617D89E2, + csb_porndudes: 0x2F4AFE35, + csb_prologuedriver: 0xF00B49DB, + csb_prolsec: 0x7FA2F024, + csb_ramp_gang: 0xC2800DBE, + csb_ramp_hic: 0x858C94B8, + csb_ramp_hipster: 0x21F58BB4, + csb_ramp_marine: 0x616C97B9, + csb_ramp_mex: 0xF64ED7D0, + csb_rashcosvki: 0x188099A9, + csb_reporter: 0x2E420A24, + csb_roccopelosi: 0xAA64168C, + csb_screen_writer: 0x8BE12CEC, + csb_stripper_01: 0xAEEA76B5, + csb_stripper_02: 0x81441B71, + csb_tonya: 0x6343DD19, + csb_trafficwarden: 0xDE2937F3, + csb_undercover: 0xEF785A6A, + csb_vagspeak: 0x48FF4CA9, + g_f_importexport_01: 0x84A1B11A, + g_f_y_ballas_01: 0x158C439C, + g_f_y_families_01: 0x4E0CE5D3, + g_f_y_lost_01: 0xFD5537DE, + g_f_y_vagos_01: 0x5AA42C21, + g_m_importexport_01: 0xBCA2CCEA, + g_m_m_armboss_01: 0xF1E823A2, + g_m_m_armgoon_01: 0xFDA94268, + g_m_m_armlieut_01: 0xE7714013, + g_m_m_chemwork_01: 0xF6157D8F, + g_m_m_chiboss_01: 0xB9DD0300, + g_m_m_chicold_01: 0x106D9A99, + g_m_m_chigoon_01: 0x7E4F763F, + g_m_m_chigoon_02: 0xFF71F826, + g_m_m_korboss_01: 0x352A026F, + g_m_m_mexboss_01: 0x5761F4AD, + g_m_m_mexboss_02: 0x4914D813, + g_m_y_armgoon_02: 0xC54E878A, + g_m_y_azteca_01: 0x68709618, + g_m_y_ballaeast_01: 0xF42EE883, + g_m_y_ballaorig_01: 0x231AF63F, + g_m_y_ballasout_01: 0x23B88069, + g_m_y_famca_01: 0xE83B93B7, + g_m_y_famdnf_01: 0xDB729238, + g_m_y_famfor_01: 0x84302B09, + g_m_y_korean_01: 0x247502A9, + g_m_y_korean_02: 0x8FEDD989, + g_m_y_korlieut_01: 0x7CCBE17A, + g_m_y_lost_01: 0x4F46D607, + g_m_y_lost_02: 0x3D843282, + g_m_y_lost_03: 0x32B11CDC, + g_m_y_mexgang_01: 0xBDDD5546, + g_m_y_mexgoon_01: 0x26EF3426, + g_m_y_mexgoon_02: 0x31A3498E, + g_m_y_mexgoon_03: 0x964D12DC, + g_m_y_pologoon_01: 0x4F3FBA06, + g_m_y_pologoon_02: 0xA2E86156, + g_m_y_salvaboss_01: 0x905CE0CA, + g_m_y_salvagoon_01: 0x278C8CB7, + g_m_y_salvagoon_02: 0x3273A285, + g_m_y_salvagoon_03: 0x03B8C510, + g_m_y_strpunk_01: 0xFD1C49BB, + g_m_y_strpunk_02: 0x0DA1EAC6, + hc_driver: 0x3B474ADF, + hc_gunman: 0x0B881AEE, + hc_hacker: 0x99BB00F8, + ig_abigail: 0x400AEC41, + ig_agent: 0x246AF208, + ig_amandatownley: 0x6D1E15F7, + ig_andreas: 0x47E4EEA0, + ig_ashley: 0x7EF440DB, + ig_avon: 0xFCE270C2, + ig_ballasog: 0xA70B4A92, + ig_bankman: 0x909D9E7F, + ig_barry: 0x2F8845A3, + ig_benny: 0xC4B715D2, + ig_bestmen: 0x5746CD96, + ig_beverly: 0xBDA21E5C, + ig_brad: 0xBDBB4922, + ig_bride: 0x6162EC47, + ig_car3guy1: 0x84F9E937, + ig_car3guy2: 0x75C34ACA, + ig_casey: 0xE0FA2554, + ig_chef: 0x49EADBF6, + ig_chef2: 0x85889AC3, + ig_chengsr: 0xAAE4EA7B, + ig_chrisformage: 0x286E54A7, + ig_clay: 0x6CCFE08A, + ig_claypain: 0x9D0087A8, + ig_cletus: 0xE6631195, + ig_dale: 0x467415E9, + ig_davenorton: 0x15CD4C33, + ig_denise: 0x820B33BD, + ig_devin: 0x7461A0B0, + ig_dom: 0x9C2DB088, + ig_dreyfuss: 0xDA890932, + ig_drfriedlander: 0xCBFC0DF5, + ig_fabien: 0xD090C350, + ig_fbisuit_01: 0x3AE4A33B, + ig_floyd: 0xB1B196B2, + ig_g: 0x841BA933, + ig_groom: 0xFECE8B85, + ig_hao: 0x65978363, + ig_hunter: 0xCE1324DE, + ig_janet: 0x0D6D9C49, + ig_jay_norris: 0x7A32EE74, + ig_jewelass: 0x0F5D26BB, + ig_jimmyboston: 0xEDA0082D, + ig_jimmydisanto: 0x570462B9, + ig_joeminuteman: 0xBE204C9B, + ig_johnnyklebitz: 0x87CA80AE, + ig_josef: 0xE11A9FB4, + ig_josh: 0x799E9EEE, + ig_karen_daniels: 0xEB51D959, + ig_kerrymcintosh: 0x5B3BD90D, + ig_lamardavis: 0x65B93076, + ig_lazlow: 0xDFE443E5, + ig_lestercrest_2: 0x6E42FD26, + ig_lestercrest: 0x4DA6E849, + ig_lifeinvad_01: 0x5389A93C, + ig_lifeinvad_02: 0x27BD51D4, + ig_magenta: 0xFCDC910A, + ig_malc: 0xF1BCA919, + ig_manuel: 0xFD418E10, + ig_marnie: 0x188232D0, + ig_maryann: 0xA36F9806, + ig_maude: 0x3BE8287E, + ig_michelle: 0xBF9672F4, + ig_milton: 0xCB3059B2, + ig_molly: 0xAF03DDE1, + ig_money: 0x37FACDA6, + ig_mp_agent14: 0xFBF98469, + ig_mrk: 0xEDDCAB6D, + ig_mrs_thornhill: 0x1E04A96B, + ig_mrsphillips: 0x3862EEA8, + ig_natalia: 0xDE17DD3B, + ig_nervousron: 0xBD006AF1, + ig_nigel: 0xC8B7167D, + ig_old_man1a: 0x719D27F4, + ig_old_man2: 0xEF154C47, + ig_omega: 0x60E6A7D8, + ig_oneil: 0x2DC6D3E7, + ig_orleans: 0x61D4C771, + ig_ortega: 0x26A562B7, + ig_paige: 0x154FCF3F, + ig_paper: 0x999B00C6, + ig_patricia: 0xC56E118C, + ig_popov: 0x267630FE, + ig_priest: 0x6437E77D, + ig_prolsec_02: 0x27B3AD75, + ig_ramp_gang: 0xE52E126C, + ig_ramp_hic: 0x45753032, + ig_ramp_hipster: 0xDEEF9F6E, + ig_ramp_mex: 0xE6AC74A4, + ig_rashcosvki: 0x380C4DE6, + ig_roccopelosi: 0xD5BA52FF, + ig_russiandrunk: 0x3D0A5EB1, + ig_screen_writer: 0xFFE63677, + ig_siemonyetarian: 0x4C7B2F05, + ig_solomon: 0x86BDFE26, + ig_stevehains: 0x382121C8, + ig_stretch: 0x36984358, + ig_talina: 0xE793C8E8, + ig_tanisha: 0x0D810489, + ig_taocheng: 0xDC5C5EA5, + ig_taostranslator: 0x7C851464, + ig_tenniscoach: 0xA23B5F57, + ig_terry: 0x67000B94, + ig_tomepsilon: 0xCD777AAA, + ig_tonya: 0xCAC85344, + ig_tracydisanto: 0xDE352A35, + ig_trafficwarden: 0x5719786D, + ig_tylerdix: 0x5265F707, + ig_vagspeak: 0xF9FD068C, + ig_wade: 0x92991B72, + ig_zimbor: 0x0B34D6F5, + mp_f_boatstaff_01: 0x3293B9CE, + mp_f_cardesign_01: 0x242C34A7, + mp_f_chbar_01: 0xC3F6E385, + mp_f_cocaine_01: 0x4B657AF8, + mp_f_counterfeit_01: 0xB788F1F5, + mp_f_deadhooker: 0x73DEA88B, + mp_f_execpa_01: 0x432CA064, + mp_f_execpa_02: 0x5972CCF0, + mp_f_forgery_01: 0x781A3CF8, + mp_f_freemode_01: 0x9C9EFFD8, + mp_f_helistaff_01: 0x19B6FF06, + mp_f_meth_01: 0xD2B27EC1, + mp_f_misty_01: 0xD128FF9D, + mp_f_stripperlite: 0x2970A494, + mp_f_weed_01: 0xB26573A3, + mp_g_m_pros_01: 0x6C9DD7C9, + mp_m_avongoon: 0x9C13CB95, + mp_m_boatstaff_01: 0xC85F0A88, + mp_m_bogdangoon: 0x4D5696F7, + mp_m_claude_01: 0xC0F371B7, + mp_m_cocaine_01: 0x56D38F95, + mp_m_counterfeit_01: 0x9855C974, + mp_m_exarmy_01: 0x45348DBB, + mp_m_execpa_01: 0x3E8417BC, + mp_m_famdd_01: 0x33A464E5, + mp_m_fibsec_01: 0x5CDEF405, + mp_m_forgery_01: 0x613E709B, + mp_m_freemode_01: 0x705E61F2, + mp_m_g_vagfun_01: 0xC4A617BD, + mp_m_marston_01: 0x38430167, + mp_m_meth_01: 0xEDB42F3F, + mp_m_niko_01: 0xEEDACFC9, + mp_m_securoguard_01: 0xDA2C984E, + mp_m_shopkeep_01: 0x18CE57D0, + mp_m_waremech_01: 0xF7A74139, + mp_m_weapexp_01: 0x36EA5B09, + mp_m_weapwork_01: 0x4186506E, + mp_m_weed_01: 0x917ED459, + mp_s_m_armoured_01: 0xCDEF5408, + player_one: 0x9B22DBAF, + player_two: 0x9B810FA2, + player_zero: 0x0D7114C9, + s_f_m_fembarber: 0x163B875B, + s_f_m_maid_01: 0xE093C5C6, + s_f_m_shop_high: 0xAE47E4B0, + s_f_m_sweatshop_01: 0x312B5BC0, + s_f_y_airhostess_01: 0x5D71A46F, + s_f_y_bartender_01: 0x780C01BD, + s_f_y_baywatch_01: 0x4A8E5536, + s_f_y_cop_01: 0x15F8700D, + s_f_y_factory_01: 0x69F46BF3, + s_f_y_hooker_01: 0x028ABF95, + s_f_y_hooker_02: 0x14C3E407, + s_f_y_hooker_03: 0x031640AC, + s_f_y_migrant_01: 0xD55B2BF5, + s_f_y_movprem_01: 0x2300C816, + s_f_y_ranger_01: 0x9FC7F637, + s_f_y_scrubs_01: 0xAB594AB6, + s_f_y_sheriff_01: 0x4161D042, + s_f_y_shop_low: 0xA96E2604, + s_f_y_shop_mid: 0x3EECBA5D, + s_f_y_stripper_01: 0x52580019, + s_f_y_stripper_02: 0x6E0FB794, + s_f_y_stripperlite: 0x5C14EDFA, + s_f_y_sweatshop_01: 0x8502B6B2, + s_m_m_ammucountry: 0x0DE9A30A, + s_m_m_armoured_01: 0x95C76ECD, + s_m_m_armoured_02: 0x63858A4A, + s_m_m_autoshop_01: 0x040EABE3, + s_m_m_autoshop_02: 0xF06B849D, + s_m_m_bouncer_01: 0x9FD4292D, + s_m_m_ccrew_01: 0xC9E5F56B, + s_m_m_chemsec_01: 0x2EFEAFD5, + s_m_m_ciasec_01: 0x625D6958, + s_m_m_cntrybar_01: 0x1A021B83, + s_m_m_dockwork_01: 0x14D7B4E0, + s_m_m_doctor_01: 0xD47303AC, + s_m_m_fiboffice_01: 0xEDBC7546, + s_m_m_fiboffice_02: 0x26F067AD, + s_m_m_fibsec_01: 0x7B8B434B, + s_m_m_gaffer_01: 0xA956BD9E, + s_m_m_gardener_01: 0x49EA5685, + s_m_m_gentransport: 0x1880ED06, + s_m_m_hairdress_01: 0x418DFF92, + s_m_m_highsec_01: 0xF161D212, + s_m_m_highsec_02: 0x2930C1AB, + s_m_m_janitor: 0xA96BD9EC, + s_m_m_lathandy_01: 0x9E80D2CE, + s_m_m_lifeinvad_01: 0xDE0077FD, + s_m_m_linecook: 0xDB9C0997, + s_m_m_lsmetro_01: 0x765AAAE4, + s_m_m_mariachi_01: 0x7EA4FFA6, + s_m_m_marine_01: 0xF2DAA2ED, + s_m_m_marine_02: 0xF0259D83, + s_m_m_migrant_01: 0xED0CE4C6, + s_m_m_movalien_01: 0x64611296, + s_m_m_movprem_01: 0xD85E6D28, + s_m_m_movspace_01: 0xE7B31432, + s_m_m_paramedic_01: 0xB353629E, + s_m_m_pilot_01: 0xE75B4B1C, + s_m_m_pilot_02: 0xF63DE8E1, + s_m_m_postal_01: 0x62599034, + s_m_m_postal_02: 0x7367324F, + s_m_m_prisguard_01: 0x56C96FC6, + s_m_m_scientist_01: 0x4117D39B, + s_m_m_security_01: 0xD768B228, + s_m_m_snowcop_01: 0x1AE8BB58, + s_m_m_strperf_01: 0x795AC7A8, + s_m_m_strpreach_01: 0x1C0077FB, + s_m_m_strvend_01: 0xCE9113A9, + s_m_m_trucker_01: 0x59511A6C, + s_m_m_ups_01: 0x9FC37F22, + s_m_m_ups_02: 0xD0BDE116, + s_m_o_busker_01: 0xAD9EF1BB, + s_m_y_airworker: 0x62018559, + s_m_y_ammucity_01: 0x9E08633D, + s_m_y_armymech_01: 0x62CC28E2, + s_m_y_autopsy_01: 0xB2273D4E, + s_m_y_barman_01: 0xE5A11106, + s_m_y_baywatch_01: 0x0B4A6862, + s_m_y_blackops_01: 0xB3F3EE34, + s_m_y_blackops_02: 0x7A05FA59, + s_m_y_blackops_03: 0x5076A73B, + s_m_y_busboy_01: 0xD8F9CD47, + s_m_y_chef_01: 0x0F977CEB, + s_m_y_clown_01: 0x04498DDE, + s_m_y_construct_01: 0xD7DA9E99, + s_m_y_construct_02: 0xC5FEFADE, + s_m_y_cop_01: 0x5E3DA4A4, + s_m_y_dealer_01: 0xE497BBEF, + s_m_y_devinsec_01: 0x9B557274, + s_m_y_dockwork_01: 0x867639D1, + s_m_y_doorman_01: 0x22911304, + s_m_y_dwservice_01: 0x75D30A91, + s_m_y_dwservice_02: 0xF5908A06, + s_m_y_factory_01: 0x4163A158, + s_m_y_fireman_01: 0xB6B1EDA8, + s_m_y_garbage: 0xEE75A00F, + s_m_y_grip_01: 0x309E7DEA, + s_m_y_hwaycop_01: 0x739B1EF5, + s_m_y_marine_01: 0x65793043, + s_m_y_marine_02: 0x58D696FE, + s_m_y_marine_03: 0x72C0CAD2, + s_m_y_mime: 0x3CDCA742, + s_m_y_pestcont_01: 0x48114518, + s_m_y_pilot_01: 0xAB300C07, + s_m_y_prismuscl_01: 0x5F2113A1, + s_m_y_prisoner_01: 0xB1BB9B59, + s_m_y_ranger_01: 0xEF7135AE, + s_m_y_robber_01: 0xC05E1399, + s_m_y_sheriff_01: 0xB144F9B9, + s_m_y_shop_mask: 0x6E122C06, + s_m_y_strvend_01: 0x927F2323, + s_m_y_swat_01: 0x8D8F1B10, + s_m_y_uscg_01: 0xCA0050E9, + s_m_y_valet_01: 0x3B96F23E, + s_m_y_waiter_01: 0xAD4C724C, + s_m_y_winclean_01: 0x550D8D9D, + s_m_y_xmech_01: 0x441405EC, + s_m_y_xmech_02_mp: 0x69147A0D, + s_m_y_xmech_02: 0xBE20FA04, + u_f_m_corpse_01: 0x2E140314, + u_f_m_drowned_01: 0xD7F37609, + u_f_m_miranda: 0x414FA27B, + u_f_m_promourn_01: 0xA20899E7, + u_f_o_moviestar: 0x35578634, + u_f_o_prolhost_01: 0xC512DD23, + u_f_y_bikerchic: 0xFA389D4F, + u_f_y_comjane: 0xB6AA85CE, + u_f_y_corpse_01: 0x9C70109D, + u_f_y_corpse_02: 0x0D9C72F8, + u_f_y_hotposh_01: 0x969B6DFE, + u_f_y_jewelass_01: 0xF0D4BE2E, + u_f_y_mistress: 0x5DCA2528, + u_f_y_poppymich: 0x23E9A09E, + u_f_y_princess: 0xD2E3A284, + u_f_y_spyactress: 0x5B81D86C, + u_m_m_aldinapoli: 0xF0EC56E2, + u_m_m_bankman: 0xC306D6F5, + u_m_m_bikehire_01: 0x76474545, + u_m_m_doa_01: 0x621E6BFD, + u_m_m_edtoh: 0x2A797197, + u_m_m_fibarchitect: 0x342333D3, + u_m_m_filmdirector: 0x2B6E1BB6, + u_m_m_glenstank_01: 0x45BB1666, + u_m_m_griff_01: 0xC454BCBB, + u_m_m_jesus_01: 0xCE2CB751, + u_m_m_jewelsec_01: 0xACCCBDB6, + u_m_m_jewelthief: 0xE6CC3CDC, + u_m_m_markfost: 0x1C95CB0B, + u_m_m_partytarget: 0x81F74DE7, + u_m_m_prolsec_01: 0x709220C7, + u_m_m_promourn_01: 0xCE96030B, + u_m_m_rivalpap: 0x60D5D6DA, + u_m_m_spyactor: 0xAC0EA5D8, + u_m_m_streetart_01: 0x6C19E962, + u_m_m_willyfist: 0x90769A8F, + u_m_o_filmnoir: 0x2BACC2DB, + u_m_o_finguru_01: 0x46E39E63, + u_m_o_taphillbilly: 0x9A1E5E52, + u_m_o_tramp_01: 0x6A8F1F9B, + u_m_y_abner: 0xF0AC2626, + u_m_y_antonb: 0xCF623A2C, + u_m_y_babyd: 0xDA116E7E, + u_m_y_baygor: 0x5244247D, + u_m_y_burgerdrug_01: 0x8B7D3766, + u_m_y_chip: 0x24604B2B, + u_m_y_corpse_01: 0x94C2A03F, + u_m_y_cyclist_01: 0x2D0EFCEB, + u_m_y_fibmugger_01: 0x85B9C668, + u_m_y_guido_01: 0xC6B49A2F, + u_m_y_gunvend_01: 0xB3229752, + u_m_y_hippie_01: 0xF041880B, + u_m_y_imporage: 0x348065F5, + u_m_y_juggernaut_01: 0x90EF5134, + u_m_y_justin: 0x7DC3908F, + u_m_y_mani: 0xC8BB1E52, + u_m_y_militarybum: 0x4705974A, + u_m_y_paparazzi: 0x5048B328, + u_m_y_party_01: 0x36E70600, + u_m_y_pogo_01: 0xDC59940D, + u_m_y_prisoner_01: 0x7B9B4BC0, + u_m_y_proldriver_01: 0x855E36A3, + u_m_y_rsranger_01: 0x3C438CD2, + u_m_y_sbike: 0x6AF4185D, + u_m_y_staggrm_01: 0x9194CE03, + u_m_y_tattoo_01: 0x94AE2B8C, + u_m_y_zombie_01: 0xAC4B4506, + } + var CreatedPeds = []; + mp.events.add("SERVER:CreateStaticPeds", (jsonVector3s, jsonHeadings, jsonCharHashes, jsonDimension) => { + var vector3s = JSON.parse(jsonVector3s); + var headings = JSON.parse(jsonHeadings); + var charHashes = JSON.parse(jsonCharHashes); + var dimension = JSON.parse(jsonDimension); + for (var i = 0; i < vector3s.length; i++) { + let p = mp.peds.new(Number(charHashes[i]), vector3s[i], headings[i], dimension[i]); + p.freezePosition(true); + p.setInvincible(true); + p.setCollision(false, false); + CreatedPeds.push(p); + } + }); + mp.events.add('entityStreamIn', (entity: EntityMp) => { + CreatedPeds.forEach(function (p) { + if (entity == p) { + + p.freezePosition(true); + p.setInvincible(true); + p.setCollision(false, false); + } + }); + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/html/inventory/css/inventory - backup with Trade.css b/ReallifeGamemode.Client/assets/html/inventory/css/inventory - backup with Trade.css new file mode 100644 index 00000000..1714eb32 --- /dev/null +++ b/ReallifeGamemode.Client/assets/html/inventory/css/inventory - backup with Trade.css @@ -0,0 +1,968 @@ +@font-face { + font-family: OSL; + src: url(../font/OSL.ttf); +} + +* { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +body { + width: 100%; + height: 100%; + margin: 0px auto; + background-color: transparent; +} + +.main2 { + z-index: 2; + background: #0c0c0cc4; + position: absolute; + padding-left: 100%; + padding-top: 100%; +} + +.main { + z-index: 1; + background: #272727; + position: absolute; + left: 19vw; + padding-left: 53vw; + padding-top: 33vw; + top: 5vw; + transition: 0.2s; +} + +.title { + font-size: 2vw; + position: absolute; + color: #fff; + font-family: 'OSL'; + left: 1vw; + top: 0.2vw; + background: #1b1b1b; +} + +.titletext { + position: absolute; + left: 21vw; + background: #1b1b1b; + padding-right: 22.7vw; +} + +.sidebar { + z-index: 1; + position: absolute; + right: 72.5vw; + cursor: pointer; + z-index: 200; + top: 9.5vw; +} + +.sidebaritem1 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem2 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem3 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem4 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem5 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem6 { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.sidebaritem { + z-index: 1; + margin-bottom: 0.2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.1vw; + transition: 0.2s; +} + +.items { + position: absolute; + left: 5.5vw; + top: 2.5vw; + cursor: default; + width: 6vw; +} + +.item { +} + +ul { + float: left; +} + +li { + display: block; +} + +.titlecount { + position: absolute; + font-size: 0.7vw; + width: 16.3vw; + top: 0vw; + background: #1b1b1b; + padding-top: 1.8vw; + left: -1vw; + padding-right: 10vw; + padding-left: 0.2vw; +} + +.sideicon1 { + padding-top: 0.2vw; +} + +.sideicon2 { + padding-top: 0.2vw; +} + +.sideicon3 { + padding-top: 0.2vw !important; +} + +.sideicon4 { + padding-top: 0.2vw; +} + +.sideicon5 { +} + +.sideicon6 { +} + +.sideicon7 { + width: 5vw; +} + +.sideicon8 { + width: 5vw; +} + +.sideicon9 { + width: 5vw; +} + +.sideicon10 { + width: 5vw; +} + +.sideicon11 { + width: 5vw; +} + +.sideicon12 { + width: 5vw; +} + +.sideicon13 { + width: 5vw; +} + +.sideicon14 { + width: 5vw; +} + +.sideicon15 { + width: 2vw; +} + +.sideicon16 { + width: 5vw; +} + +.sideicon17 { + width: 5vw; +} + +.sideicon18 { + width: 5vw; +} + +.sideicon7, .sideicon8, .sideicon9, .sideicon10, .sideicon11, .sideicon12, .sideicon13, .sideicon14, .sideicon15, .sideicon16, .sideicon17, .sideicon18 { + position: absolute; + left: 2.1vw; + top: 0.6vw; +} + +.sideicon1, .sideicon2, .sideicon3, .sideicon4, .sideicon5, .sideicon6 { + width: 2vw; + padding-bottom: 1.8vw; +} + +.bartext { + margin-top: -6.5vw; + font-size: 0.8vw; +} + +.sidebaritem1:hover { + background: #131313; +} + +.sidebaritem2:hover { + background: #131313; +} + +.sidebaritem3:hover { + background: #131313; +} + +.sidebaritem4:hover { + background: #131313; +} + +.sidebaritem5:hover { + background: #131313; +} + +.sidebaritem6:hover { + background: #131313; +} + +li.item1 { +} + +li.item2 { + top: -22vw; + left: 9vw; +} + +li.item3 { + top: -46vw; + left: 16vw; +} + +li.item4 { + top: -70vw; + left: 23vw; +} + +li.item5 { + top: -94vw; + left: 30vw; +} + +li.item6 { + top: -118vw; + left: 37vw; +} + +.item1, .item2, .item3, .item4, .item5, .item6 { + color: #fff; + font-family: 'OSL'; + position: relative; + margin-bottom: 2vw; + color: #fff; + font-family: OSL; + width: 6vw; + background: #1b1b1b; + height: 4vw; + text-align: center; + line-height: 6.5vw; + transition: 0.2s; + font-size: 0.5vw; + left: 2vw; + top: 2vw; +} + +.show { + display: show !important; +} + +.hidden { + display: none !important; +} + +.green { + z-index: 1; + position: relative; + width: 6vw; + background: #55ff0096; + height: 4vw; + line-height: 1; + top: -8vw; + cursor: pointer; + opacity: 0.0; + transition: 0.3s; +} + + .green:hover { + opacity: 1 + } + +.red { + z-index: 1; + position: relative; + width: 2.5vw; + left: 3.5vw; + background: #6d2525; + height: 1.5vw; + line-height: 1; + top: -2.4vw; + cursor: pointer; + opacity: 0.5; + transition: 0.3s; +} + + .red:hover { + opacity: 1 + } + +.blue { + z-index: 1; + position: relative; + width: 2.5vw; + left: 0vw; + background: #0d91af8c; + height: 1.5vw; + line-height: 1; + top: -7.9vw; + cursor: pointer; + opacity: 0.5; + transition: 0.3s; +} + + .blue:hover { + opacity: 1 + } + +.blue2 { + z-index: 1; + position: relative; + width: 2.5vw; + left: 0vw; + background: #0d91af8c; + height: 1.5vw; + line-height: 1; + top: -3.9vw; + cursor: pointer; + opacity: 0.5; + transition: 0.3s; +} + + .blue2:hover { + opacity: 1 + } + +.redImg { + width: 1.3vw; + margin-top: 0.1vw; +} + +.blueImg { + width: 1.3vw; + margin-top: 0.1vw; +} + +.greenImg { + width: 1.3vw; + margin-top: 1.2vw; +} + +body select { + display: block; + padding: 10px 70px 11px 13px !important; + margin-top: -29.9vw; + margin-left: -30.6vw; + height: auto !important; + border: 1px solid #000000; + border-radius: 3px; + background: url(https://i.ibb.co/b7xjLrB/selectbox-arrow.png) right center no-repeat; + background-color: #404040; + color: #fffbfb; + font-size: 12px; + line-height: 12px !important; + appearance: none; + -webkit-appearance: none; + -moz-appearance: none; +} + /* body select.select_box option */ + body select option { + padding: 0 4px; + } +/* for IE and Edge */ +select::-ms-expand { + display: none; +} + +select:disabled::-ms-expand { + background: #f60; +} + +.Betrag { + z-index: 2; + background: rgba(0,0,0,0.6); + height: 100%; + width: 100%; + display: block; + transform: translate(-50%, -50%); + position: absolute; + left: 50%; + top: 50%; +} + +.Betrag4 { + z-index: 2; + background: rgba(0,0,0,0.6); + height: 100%; + width: 100%; + display: block; + transform: translate(-50%, -50%); + position: absolute; + left: 50%; + top: 50%; +} + +.Betrag3 { + z-index: 2; + background: rgba(0,0,0,0.6); + height: 100%; + width: 100%; + display: block; + transform: translate(-50%, -50%); + position: absolute; + left: 50%; + top: 50%; +} + +.Betrag2 { + z-index: 2; + background: rgba(0,0,0,0.6); + height: 100%; + width: 100%; + display: block; + transform: translate(-50%, -50%); + position: absolute; + left: 50%; + top: 50%; +} + +t#tf_nameorid { + background-color: #313131; + border: none; + height: 1.2vw; + width: 6vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 12px; + position: relative; + left: -30.1vw; + top: -29.9vw; + color: #ffffff; +} + +#tf_submitTrade { + background-color: #267d00; + border: none; + height: 1.2vw; + width: 4vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + font-color: white; + position: relative; + left: -30vw; + top: -29.9vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_submitTrade { + opacity: 1; +} + +#tf_zahl { + background-color: #313131; /* blau */ + border: none; + height: 30px; + width: 124px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 12px; + position: relative; + left: 42%; + top: 40%; + color: #ffffff; +} + +#tf_cancle { + background-color: #ff0000; + border: none; + height: 32px; + width: 124px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + font-color: white; + position: relative; + left: 33.7%; + top: 44%; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_submitZahl { + background-color: #008CBA; /* blau */ + border: none; + height: 32px; + width: 124px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + font-color: white; + position: relative; + left: 42%; + top: 40%; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_submitZahl { + opacity: 1; +} + +#tf_zahl4 { + background-color: #313131; + border: none; + height: 1.5vw; + width: 5vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.6vw; + position: relative; + left: 19vw; + top: 13vw; + color: #ffffff; +} + +#tf_cancle4 { + background-color: #ff0000; + border: none; + height: 0.9vw; + width: 3vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + font-color: white; + position: relative; + left: 17.8vw; + top: 9.4vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_cancle4 { + opacity: 1; +} + +#tf_submitZahl4 { + background-color: #008CBA; + border: none; + height: 1.5vw; + width: 8vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + font-color: white; + position: relative; + left: 21vw; + top: 13vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_submitZahl4 { + opacity: 1; +} + +#tf_submitTrade { + background-color: #009b03; + border: none; + height: 1.6vw; + width: 4vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + font-color: white; + position: absolute; + color: #ffffff; + top: 3vw; + left: 29.3vw; + opacity: 0.5; + transition: 0.3s; +} + + #tf_submitTrade:hover { + opacity: 1; + } + +#tf_acceptTrade { + background-color: #009b03; + border: none; + height: 1.6vw; + width: 4vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + font-color: white; + position: absolute; + color: #ffffff; + top: 3vw; + left: 29.3vw; + opacity: 0.5; + transition: 0.3s; +} + + #tf_acceptTrade:hover { + opacity: 1; + } + +#tf_cancle3 { + background-color: #ff0000; + border: none; + height: 0.9vw; + width: 3vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + font-color: white; + position: relative; + left: 17.8vw; + top: 9.4vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +i + +#tf_cancle3:hover { + opacity: 1 +} + +#tf_cancle:hover { + opacity: 1 +} + +#tf_cancle2:hover { + opacity: 1 +} + +#tf_zahl3 { + background-color: #313131; + border: none; + height: 1.5vw; + width: 5vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.6vw; + position: relative; + left: 19vw; + top: 13vw; + color: #ffffff; +} + +#tf_submitZahl3 { + background-color: #008CBA; + border: none; + height: 1.5vw; + width: 8vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.7vw; + font-color: white; + position: relative; + left: 21vw; + top: 13vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + +#tf_submitZahl3 { + opacity: 1; +} + +.BoxBlue { + background-color: #1b1b1b; + height: 11.1vw; + width: 20.2vw; + position: relative; + margin-top: 11vw; + margin-left: 16vw; +} + +#tf_cancle2 { + background-color: #ff0000; + border: none; + height: 1vw; + width: 3vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + position: relative; + left: 5.45vw; + top: 0vw; + color: #ffffff; +} + +#tf_submitZahlToHandel { + background-color: #008CBA; + border: none; + height: 1.4vw; + width: 7vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.6vw; + position: relative; + left: -3vw; + top: 7vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + + #tf_submitZahlToHandel:hover { + opacity: 1; + } + +#tf_submitZahlToVehicle { + background-color: #008CBA; + border: none; + height: 1.3vw; + width: 7.8vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.6vw; + position: relative; + left: 10.8vw; + top: 5.45vw; + color: #ffffff; + opacity: 0.5; + transition: 0.3s; +} + + #tf_submitZahlToVehicle:hover { + opacity: 1 + } + +#tf_zahl2 { + background-color: #313131; + border: none; + height: 1vw; + width: 4.3vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 0.5vw; + position: relative; + left: 7.5vw; + top: 4.4vw; + color: #ffffff; +} + +select.select_box2 { + margin-top: -1vw; + margin-left: 11.3vw; +} + +.blueIcon1 { + position: relative; + height: 3vw; + margin-bottom: -3.1vw; + margin-left: 13.4vw; +} + +.blueIcon2 { + position: relative; + height: 3vw; + margin-bottom: 0.9vw; + margin-left: 3.4vw; +} + +.blue3 { + z-index: 1; + position: relative; + width: 2.5vw; + left: 0vw; + background: #0d91af8c; + height: 1.5vw; + line-height: 1; + top: -2.45vw; + z-index: 10000; + cursor: pointer; + opacity: 0.5; + transition: 0.3s; +} + + .blue3:hover { + opacity: 1 + } + +#tf_nameorid { + background-color: #313131; + border: none; + height: 1.5vw; + width: 6vw; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 12px; + position: absolute; + left: 23vw; + top: 3vw; + color: #ffffff; +} + +.alert_green { + z-index: 2; + background: rgba(85, 255, 0, 0.90); + position: relative; + width: 17vw; + height: 1vw; + margin-left: 74.1vw; + padding-bottom: 3vw; + margin-top: -9.5vw; + font-family: 'OSL'; + font-size: 0.9vw; + text-align: center; + line-height: 3.9vw; +} + +.alert_red { + z-index: 2; + background: rgba(175, 0, 0, 0.9); + position: relative; + width: 17vw; + height: 1vw; + margin-left: 74.1vw; + padding-bottom: 3vw; + margin-top: -9.5vw; + font-family: 'OSL'; + text-align: center; + line-height: 3.9vw; + font-size: 0.7vw; + display: none; +} + +.alert_blue { + z-index: 2; + background: rgba(0, 140, 186, 0.90); + position: relative; + width: 17vw; + height: 1vw; + margin-left: 74.1vw; + padding-bottom: 3vw; + margin-top: -9.5vw; + font-family: 'OSL'; + text-align: center; + line-height: 3.9vw; + font-size: 0.7vw; + display: none; +} + +.alerts { + margin-bottom: 47.5vw; + padding-top: 43.3vw; +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/html/inventory/css/inventory.css b/ReallifeGamemode.Client/assets/html/inventory/css/inventory.css index 4b4fad9a..dda031df 100644 --- a/ReallifeGamemode.Client/assets/html/inventory/css/inventory.css +++ b/ReallifeGamemode.Client/assets/html/inventory/css/inventory.css @@ -22,8 +22,6 @@ body { background-color: transparent; } - - .main2 { z-index: 2; background: #0c0c0cc4; @@ -557,53 +555,48 @@ t#tf_nameorid { } #tf_zahl { - background-color: #313131; /* blau */ + background-color: #313131; border: none; - height: 30px; - width: 124px; + height: 1vw; + width: 4.3vw; text-align: center; text-decoration: none; display: inline-block; - font-size: 12px; + font-size: 0.5vw; position: relative; - left: 42%; - top: 40%; + left: 7.8vw; + top: 1.2vw; color: #ffffff; } #tf_cancle { background-color: #ff0000; border: none; - height: 32px; - width: 124px; + height: 1vw; + width: 3vw; text-align: center; text-decoration: none; display: inline-block; - font-size: 16px; - font-color: white; + font-size: 0.5vw; position: relative; - left: 33.7%; - top: 44%; + left: 12.5vw; + top: -0.2vw; color: #ffffff; - opacity: 0.5; - transition: 0.3s; } #tf_submitZahl { - background-color: #008CBA; /* blau */ + background-color: #008CBA; border: none; - height: 32px; - width: 124px; + height: 1.5vw; + width: 8vw; text-align: center; text-decoration: none; display: inline-block; - font-size: 16px; - font-color: white; + font-size: 0.5vw; position: relative; - left: 42%; - top: 40%; + left: -1.8vw; + top: 6vw; color: #ffffff; - opacity: 0.5; transition: 0.3s; } @@ -614,15 +607,15 @@ t#tf_nameorid { #tf_zahl4 { background-color: #313131; border: none; - height: 1.5vw; - width: 5vw; + height: 1vw; + width: 4.3vw; text-align: center; text-decoration: none; display: inline-block; - font-size: 0.6vw; + font-size: 0.5vw; position: relative; - left: 19vw; - top: 13vw; + left: 7.7vw; + top: 1vw; color: #ffffff; } @@ -635,12 +628,10 @@ t#tf_nameorid { text-decoration: none; display: inline-block; font-size: 0.5vw; - font-color: white; position: relative; - left: 17.8vw; - top: 9.4vw; + left: 12.5vw; + top: -0.3vw; color: #ffffff; - opacity: 0.5; transition: 0.3s; } @@ -657,12 +648,10 @@ t#tf_nameorid { text-decoration: none; display: inline-block; font-size: 0.5vw; - font-color: white; position: relative; - left: 21vw; - top: 13vw; + left: -5.4vw; + top: 6vw; color: #ffffff; - opacity: 0.5; transition: 0.3s; } @@ -692,7 +681,6 @@ t#tf_nameorid { opacity: 1; } - #tf_acceptTrade { background-color: #009b03; border: none; @@ -731,11 +719,13 @@ t#tf_nameorid { color: #ffffff; opacity: 0.5; transition: 0.3s; -}i +} - #tf_cancle3:hover { - opacity: 1 - } +i + +#tf_cancle3:hover { + opacity: 1 +} #tf_cancle:hover { opacity: 1 @@ -784,7 +774,7 @@ t#tf_nameorid { .BoxBlue { background-color: #1b1b1b; - height: 11.1vw; + height: 8.9vw; width: 20.2vw; position: relative; margin-top: 11vw; @@ -801,7 +791,7 @@ t#tf_nameorid { display: inline-block; font-size: 0.5vw; position: relative; - left: 5.45vw; + left: 12.45vw; top: 0vw; color: #ffffff; } @@ -837,8 +827,8 @@ t#tf_nameorid { display: inline-block; font-size: 0.6vw; position: relative; - left: 10.8vw; - top: 5.45vw; + left: -1.7vw; + top: 6.45vw; color: #ffffff; opacity: 0.5; transition: 0.3s; @@ -858,8 +848,8 @@ t#tf_nameorid { display: inline-block; font-size: 0.5vw; position: relative; - left: 7.5vw; - top: 4.4vw; + left: 7.8vw; + top: 1.4vw; color: #ffffff; } @@ -871,15 +861,15 @@ select.select_box2 { .blueIcon1 { position: relative; height: 3vw; - margin-bottom: -3.1vw; - margin-left: 13.4vw; + margin-bottom: -3.6vw; + margin-left: 8.5vw; } .blueIcon2 { position: relative; height: 3vw; - margin-bottom: 0.9vw; - margin-left: 3.4vw; + margin-bottom: -4.6vw; + margin-left: 0.7vw; } .blue3 { @@ -901,7 +891,6 @@ select.select_box2 { opacity: 1 } - #tf_nameorid { background-color: #313131; border: none; @@ -917,7 +906,6 @@ select.select_box2 { color: #ffffff; } - .alert_green { z-index: 2; background: rgba(85, 255, 0, 0.90); diff --git a/ReallifeGamemode.Client/assets/html/inventory/img/backpack/trash2.svg b/ReallifeGamemode.Client/assets/html/inventory/img/backpack/trash2.svg new file mode 100644 index 00000000..418dd4e8 --- /dev/null +++ b/ReallifeGamemode.Client/assets/html/inventory/img/backpack/trash2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/html/inventory/inventory.html b/ReallifeGamemode.Client/assets/html/inventory/inventory.html index f32081e9..8c1002d1 100644 --- a/ReallifeGamemode.Client/assets/html/inventory/inventory.html +++ b/ReallifeGamemode.Client/assets/html/inventory/inventory.html @@ -11,40 +11,48 @@
-
- -
- - - - - - - - - - + - - + \ No newline at end of file diff --git a/ReallifeGamemode.Client/core/rage-mp/entities.ts b/ReallifeGamemode.Client/core/rage-mp/entities.ts index f11004e8..c40e5e00 100644 --- a/ReallifeGamemode.Client/core/rage-mp/entities.ts +++ b/ReallifeGamemode.Client/core/rage-mp/entities.ts @@ -1,4 +1,4 @@ -import { IEntity, IPlayer, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType } from "../../game"; +import { IEntity, IPlayer, IEntityAttachments, IEntityAttachmentPool, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType } from "../../game"; import { parseJson } from "../../util"; class RageEntity implements IEntity { @@ -8,6 +8,10 @@ class RageEntity implements IEntity { return this.entity.id; } + get remoteId(): any { + return this.entity.remoteId; + } + constructor(entity: EntityMp) { this.entity = entity; } @@ -32,6 +36,8 @@ class RageEntity implements IEntity { class RagePlayer extends RageEntity implements IPlayer { private player: PlayerMp; + public __attachments: any[]; + public __attachmentObjects: any[]; get name(): string { return this.player.name; @@ -52,6 +58,78 @@ class RagePlayer extends RageEntity implements IPlayer { } } +class RageAttachments implements IEntityAttachments { + remoteId: any; + public __attachments: any[]; + public __attachmentObjects: any[]; + + constructor(entity: IEntity, attachments: any[], attachmentObjects: any[]) { + this.remoteId = entity.remoteId; + this.__attachments = attachments; + this.__attachmentObjects = attachmentObjects; + } +} + +class RageEntityAttachmentPool implements IEntityAttachmentPool { + public attachmentPool: IEntityAttachments[]; + remove(entity: IEntity) { + for (let obj of this.attachmentPool.keys()) { + if (entity.remoteId == this.attachmentPool[obj].remoteId) delete this.attachmentPool[obj]; + } + } + find(entity: EntityMp): IEntityAttachments { + + for (let i of this.attachmentPool.keys()) { + let pool = this.attachmentPool[i]; + for (let obj of pool.__attachmentObjects) { + if (entity == obj) { return pool;} + } + } + return null; + } + + set(entity: IEntity, attachments: any[], attachmentObjects: any[]): IEntityAttachments { + if (!this.attachmentPool) { + let e = new RageAttachments(entity, attachments, attachmentObjects); + this.attachmentPool = []; + this.attachmentPool.push(e); + + return e; + } + + for (let obj of this.attachmentPool.keys()) { + if (entity.remoteId == this.attachmentPool[obj].remoteId) { this.remove(entity); } + } + let e = new RageAttachments(entity, attachments, attachmentObjects); + this.attachmentPool.push(e); + + return e; + } + + at(remoteId: any): IEntityAttachments { + if (!this.attachmentPool) { + return null; + } + + for (let obj of this.attachmentPool.keys()) { + if (remoteId == this.attachmentPool[obj].remoteId) { return this.attachmentPool[obj]; } + } + return null; + } + + get(entity: IEntity): IEntityAttachments { + if (!this.attachmentPool) { + + return null; + } + + for (let obj of this.attachmentPool.keys()) { + if (entity.remoteId == this.attachmentPool[obj].remoteId) { return this.attachmentPool[obj]; } + } + return null; + } +} + class RagePlayerPool implements IPlayerPool { get local(): IPlayer { return new RagePlayer(mp.players.local); @@ -111,14 +189,14 @@ class RageVehiclePool implements IVehiclePool { fn(new RageVehicle(e)); }) } - - } export { RageEntity, RagePlayer, RagePlayerPool, + RageAttachments, + RageEntityAttachmentPool, RageVehicle, RageVehiclePool, -} +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/core/rage-mp/game.ts b/ReallifeGamemode.Client/core/rage-mp/game.ts index 68cbd072..5094ba9f 100644 --- a/ReallifeGamemode.Client/core/rage-mp/game.ts +++ b/ReallifeGamemode.Client/core/rage-mp/game.ts @@ -1,12 +1,12 @@ -import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool } from "../../game"; +import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool, IEntityAttachmentPool } from "../../game"; import RageEvents from "./events"; import RageUi from "./ui"; -import { RagePlayerPool, RageVehiclePool } from "./entities"; +import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool } from "./entities"; export default class RageGame implements IGame { players: IPlayerPool = new RagePlayerPool(); vehicles: IVehiclePool = new RageVehiclePool(); - + attachments: IEntityAttachmentPool = new RageEntityAttachmentPool(); events: IEvents = new RageEvents; ui: IUi = new RageUi; diff --git a/ReallifeGamemode.Client/game.ts b/ReallifeGamemode.Client/game.ts index 0fa12ffd..6b32a90a 100644 --- a/ReallifeGamemode.Client/game.ts +++ b/ReallifeGamemode.Client/game.ts @@ -5,6 +5,7 @@ players: IPlayerPool; vehicles: IVehiclePool; + attachments: IEntityAttachmentPool; disableDefaultEngineBehaviour(): void; } @@ -41,6 +42,7 @@ interface IBrowser { interface IEntity { id: number; + remoteId: any; type: EntityType; getSharedData(key: string): T; } @@ -51,6 +53,12 @@ interface IPlayer extends IEntity { vehicle: IVehicle; } +interface IEntityAttachments { + remoteId: any; + __attachments: any[]; + __attachmentObjects: any[]; +} + interface IVehicle extends IEntity { isSeatFree(seat: VehicleSeat): boolean; setEngineStatus(status: boolean, instantly: boolean, otherwise: boolean); @@ -69,8 +77,16 @@ interface IPlayerPool extends IEntityPool { local: IPlayer; } -interface IVehiclePool extends IEntityPool { +interface IEntityAttachmentPool { + attachmentPool: IEntityAttachments[]; + find(entity: EntityMp): IEntityAttachments; + remove(entity: IEntity): void; + set(entity: IEntity, attachments: any[], attachmentObjects: any[]): IEntityAttachments; + at(handle: any): IEntityAttachments; + get(entity: IEntity): IEntityAttachments; +} +interface IVehiclePool extends IEntityPool { } enum EntityType { @@ -132,6 +148,8 @@ export { IBrowser, IPlayer, + IEntityAttachments, + IEntityAttachmentPool, IVehicle, IEntity, IEntityPool, diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 66159d5b..d8ef0342 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -221,6 +221,15 @@ taximeterInput(globalData); import refuseCollector from './Jobs/RefuseCollector'; refuseCollector(); +import PedCreator from './Ped/PedCreator'; +PedCreator(); + +import attachmentManager from './util/attachmentMngr'; +attachmentManager(game); + +import relativeVector from './util/relativevector'; +relativeVector(); + require('./Gui/policedepartment'); interface VehicleData { @@ -230,4 +239,6 @@ interface VehicleData { export { VehicleData -} \ No newline at end of file +} + + diff --git a/ReallifeGamemode.Client/inventory/inventory.ts b/ReallifeGamemode.Client/inventory/inventory.ts index 31845d1c..dd284b3a 100644 --- a/ReallifeGamemode.Client/inventory/inventory.ts +++ b/ReallifeGamemode.Client/inventory/inventory.ts @@ -1,44 +1,32 @@ - - -export default function inventory(globalData: IGlobalData): void { - +export default function inventory(globalData: IGlobalData): void { var invBrowser: BrowserMp = null; var itemIdArr; var itemAmountArr; var invWeight; var itemNameArr; + var itemArr; + var offerItemArr; + var tradeItemArr; + var vehItemArr; - var ivehArr; + var loaded = false; - var Players; - - mp.events.add('setVehiclesInventory', (vehInvArr) => { - ivehArr = vehInvArr; - invBrowser.execute(`setVehiclesInv('${JSON.stringify(ivehArr)}');`); - }); - - mp.events.add('showVehInventory', () => { - invBrowser.execute(`execVehInv();`); - }); - var open = false; - mp.events.add('inventoryShow', (iWeight, iNameArr, iAmountArr, iIdArr, playersArr) => { + mp.events.add('inventoryShow', () => { if (invBrowser !== null) { invBrowser.destroy() invBrowser = null; globalData.InInput = false; + loaded = false; mp.gui.cursor.show(false, false); return; } if (!globalData.InInput) { globalData.InInput = true; mp.gui.cursor.show(true, true); + itemArr = []; + vehItemArr = []; invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html'); - Players = playersArr; - itemIdArr = iIdArr; - itemAmountArr = iAmountArr; - itemNameArr = iNameArr; - invWeight = iWeight; - } + } }); var offer = 0; @@ -55,22 +43,42 @@ export default function inventory(globalData: IGlobalData): void { } }); - mp.events.add("addTradeItems", (itemId, itemAmount, itemName, weight) => { - tradeItemID = JSON.stringify(itemId); - tradeItemAmount = JSON.stringify(itemAmount); - tradeItemName = JSON.stringify(itemName); - tradeItemWeight = JSON.stringify(weight); - if (invBrowser != null) - invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`); + mp.events.addDataHandler("backpackItems", (entity: EntityMp, jsonItemArr) => { + if (entity.handle != mp.players.local.handle) return; + itemArr = JSON.parse(jsonItemArr); + if (loaded) + invBrowser.execute(`setBackpackItems('${JSON.stringify(itemArr)}',true)`); }); - - mp.events.add("CEF:saveVehicleTransfer", (val, jsonOrigin, jsonInvID, jsonInvAmount, jsonVehAmount) => { - if (val == 0) { - mp.events.callRemote('saveInventory', jsonInvID, jsonInvAmount, jsonOrigin, jsonVehAmount); - } else if(val == 1){ - mp.events.callRemote('saveVehicleInventory', jsonInvID, jsonInvAmount, jsonOrigin, jsonVehAmount); + + mp.events.addDataHandler("vehicleItems", (entity: EntityMp, jsonItemArr) => { + if (entity != mp.players.local) return; + vehItemArr = JSON.parse(jsonItemArr); + + if (loaded) + invBrowser.execute(`setVehicleItems('${JSON.stringify(vehItemArr)}')`); + }); + + mp.events.add("CEF:InventoryLoaded", () => { + invBrowser.execute(`setBackpackItems('${JSON.stringify(itemArr)}')`); + if (vehItemArr.length != 0) { + invBrowser.execute(`setVehicleItems('${JSON.stringify(vehItemArr)}')`); } - + + //invBrowser.execute(`setTradeItems('${JSON.stringify(tradeItemArr)}')`); + //invBrowser.execute(`setOfferItems('${JSON.stringify(offerItemArr)}')`); + loaded = true; + }); + + mp.events.add("CEF:callVehicleInventory", () => { + mp.events.callRemote("CLIENT:getVehicleInventory") + }); + + mp.events.add("CEF:backpackToVehicle", (jsonItemId, jsonAmount) => { + mp.events.callRemote('transferToVehicle', jsonItemId, jsonAmount); + }); + + mp.events.add("CEF:vehicleToBackpack", (jsonItemId, jsonAmount) => { + mp.events.callRemote('transferToBackpack', jsonItemId, jsonAmount); }); mp.events.add("CEF:useItem", (type, amount, id) => { @@ -111,22 +119,6 @@ export default function inventory(globalData: IGlobalData): void { } }); - - mp.events.add("CEF:InventoryLoaded", () => { - if (offer == 1) { - invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`); - invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`); - } - - invBrowser.execute(`setItems('${JSON.stringify(itemNameArr)}','${JSON.stringify(itemIdArr)}','${JSON.stringify(itemAmountArr)}','${JSON.stringify(Players)}');`); - invBrowser.execute(`setWeight('${JSON.stringify(invWeight)}');`); - }); - - - mp.events.add("CEF:getNearVehicles", () => { - mp.events.callRemote('getNearVehicles'); - }); - mp.events.add("CEF:acceptTrade", () => { if (invBrowser !== null) { @@ -135,7 +127,6 @@ export default function inventory(globalData: IGlobalData): void { invBrowser = null; mp.gui.cursor.show(false, false); } - }); mp.events.add("CEF:declineTrade", () => { @@ -169,5 +160,4 @@ export default function inventory(globalData: IGlobalData): void { } } }); - } \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index c50e5211..a1689a8e 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -1,7 +1,4 @@ - - -export default function gangwarHandle(globalData: IGlobalData) { - +export default function gangwarHandle(globalData: IGlobalData) { function inside(point, vs) { let x = point[0], y = point[1]; @@ -35,7 +32,6 @@ export default function gangwarHandle(globalData: IGlobalData) { }; var Gangturf = class { - name: string; id: number; range: number; @@ -70,12 +66,11 @@ export default function gangwarHandle(globalData: IGlobalData) { } _setup(name, id, x, y, range, color, rot, owner, edit, vector, value) { - var self = this; self.name = name; self.id = id; self.range = range; - self.setColor(owner); + self.setColor(owner); self.x = x; self.y = y; self.rotation = rot; @@ -97,7 +92,7 @@ export default function gangwarHandle(globalData: IGlobalData) { } else { self.leaderBlipVector = null; } - + self.leaderColShape = null; } @@ -127,7 +122,6 @@ export default function gangwarHandle(globalData: IGlobalData) { loadArea() { var self = this; - self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range); mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5); @@ -137,25 +131,21 @@ export default function gangwarHandle(globalData: IGlobalData) { self._colshape = mp.colshapes.newCircle(self.x, self.y, self.range * 1.5); } render() { - var self = this; if (self._colshape) { if (self.edit == true) { let vector3 = mp.players.local.getRotation(2); self.rotation = Math.round(vector3.z); //self.blip.setPosition(mp.players.local.position.x, mp.players.local.position.y, 1); - + mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1); self.x = mp.players.local.position.x; self.y = mp.players.local.position.y; } //self.blip.setRotation(self.rotation); - mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation); - + mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation); } - - if (self._status == "attack" || self.edit == true) { if (self._colshape) { if (mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.x, self.y, 0, true) < self.range * 1.5) { @@ -191,7 +181,6 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.game.graphics.drawLine(bottom_left.x, bottom_left.y, i, top_left.x, top_left.y, i, 255, 0, 0, 255); } } else { - /* let a = 0; for (var i = z; i < z + 1; i += 0.001) { @@ -202,10 +191,8 @@ export default function gangwarHandle(globalData: IGlobalData) { a += 0.001 } */ - } - + } } - if (self.isInsideArea()) { mp.game.graphics.drawText(self.name, [self.x, self.y, mp.players.local.position.z + 20], { @@ -215,7 +202,6 @@ export default function gangwarHandle(globalData: IGlobalData) { outline: true, centre: true }); - } } } @@ -233,11 +219,9 @@ export default function gangwarHandle(globalData: IGlobalData) { } } } - } - - startGangWar() { + startGangWar() { var self = this; if (self._status == "normal") { let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false); @@ -263,7 +247,7 @@ export default function gangwarHandle(globalData: IGlobalData) { if (status == "normal") { self._status = "normal"; //self.blip.setFlashes(false); - mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false); + mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false); return; } if (status == "conquered") { @@ -287,7 +271,6 @@ export default function gangwarHandle(globalData: IGlobalData) { self.attackBlip = mp.game.ui.addBlipForCoord(self.x, self.y, 0); mp.game.invoke(Natives.SET_BLIP_SPRITE, self.attackBlip, 378); mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.attackBlip, false); - } else if (!bool) { mp.game.invoke(Natives.SET_BLIP_SPRITE, self.attackBlip, 5); } @@ -310,20 +293,18 @@ export default function gangwarHandle(globalData: IGlobalData) { self.setLeaderColShape(); mp.game.invoke(Natives.SET_BLIP_SPRITE, self.leaderBlip, 437); mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.leaderBlip, false); - - } + } } setLeaderColShape() { var self = this; - let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2) - - self.leaderColShape = mp.markers.new(1, newVector, 2, { - color: [255, 255, 0, 150], - visible: true, - dimension: 0 - }); + let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2) + self.leaderColShape = mp.markers.new(1, newVector, 2, { + color: [255, 255, 0, 150], + visible: true, + dimension: 0 + }); } isTurfArea(shape) { @@ -335,7 +316,7 @@ export default function gangwarHandle(globalData: IGlobalData) { } check() { - var self = this + var self = this if (self._entered == true) { if (!self.isInsideArea() || (self.isNearGround() == false)) { self._entered = false; @@ -343,7 +324,7 @@ export default function gangwarHandle(globalData: IGlobalData) { } } } - + enter() { var self = this; self._timerCheck = setInterval(function () { @@ -354,8 +335,7 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true); mp.game.graphics.stopScreenEffect("MinigameTransitionIn"); mp.game.graphics.startScreenEffect("MinigameTransitionOut", 500, false); - - } + } mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id)); } } else if (self._entered == true) { @@ -364,7 +344,7 @@ export default function gangwarHandle(globalData: IGlobalData) { if (self._status === "attack") { mp.game.audio.playSoundFrontend(1, "Exit_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true); mp.game.graphics.startScreenEffect("MinigameTransitionIn", 500, false); - } + } mp.events.callRemote("Gangarea:Leave", JSON.stringify(self.id)); } } @@ -374,7 +354,7 @@ export default function gangwarHandle(globalData: IGlobalData) { leave() { var self = this; clearInterval(self._timerCheck); - + self.check(); } isNearGround() { @@ -475,7 +455,7 @@ export default function gangwarHandle(globalData: IGlobalData) { while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) { mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1); - mp.game.ui.removeBlip(last_blip); + mp.game.ui.removeBlip(last_blip); last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); x++; } @@ -499,7 +479,7 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.gui.chat.push("DEBUG: Attack blips not removed: " + y); mp.gui.chat.push("DEBUG: LeaderBlips blips not removed: " + z); } - + mp.events.add('GangAreas:Create', (turfsJSON) => { var turfs = JSON.parse(turfsJSON); if (gangturfs.length > 0) { @@ -512,9 +492,9 @@ export default function gangwarHandle(globalData: IGlobalData) { turf.leaderColShape = null; } if (turf._marker) - if (turf.blip != null) { - mp.game.ui.removeBlip(turf.blip); - } + if (turf.blip != null) { + mp.game.ui.removeBlip(turf.blip); + } if (turf.leaderBlip != null) { mp.game.ui.removeBlip(turf.leaderBlip); } @@ -525,7 +505,6 @@ export default function gangwarHandle(globalData: IGlobalData) { } clearBlips(); if (turfs.length > 0) { - gangturfs = []; turfs.forEach(function (turf) { if (turf.Id != undefined) { @@ -543,9 +522,8 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.events.add('ADMIN:SetTurf', (name) => { gangturfs[gangturfs.length - 1].edit = false; if (gangturfs[gangturfs.length - 1].id == -1) { - mp.events.callRemote("SERVER:SetTurf", JSON.stringify(gangturfs[gangturfs.length - 1].x), JSON.stringify(gangturfs[gangturfs.length - 1].y), JSON.stringify(gangturfs[gangturfs.length - 1].rotation), JSON.stringify(gangturfs[gangturfs.length - 1].range), name); - } + } }); mp.events.add('ADMIN:DeleteTurf', () => { @@ -581,13 +559,13 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => { gangturfs.forEach(function (turf) { - turf.setLeaderBlip(false); + turf.setLeaderBlip(false); }); }); mp.events.add('ADMIN:Turf_CreateLeaderBlip', () => { gangturfs.forEach(function (turf) { - if (turf._entered == true) { + if (turf._entered == true) { turf.setLeaderBlip(true); } }); @@ -596,7 +574,7 @@ export default function gangwarHandle(globalData: IGlobalData) { mp.events.add('CLIENT:StartGangwar', () => { gangturfs.forEach(function (turf) { if (turf._entered == true) { - turf.startGangWar(); + turf.startGangWar(); } }); }); diff --git a/ReallifeGamemode.Client/util/attachmentMngr.ts b/ReallifeGamemode.Client/util/attachmentMngr.ts new file mode 100644 index 00000000..79f54a6e --- /dev/null +++ b/ReallifeGamemode.Client/util/attachmentMngr.ts @@ -0,0 +1,279 @@ +import { IGame, EntityType } from "../game"; +import relativeVector from "./relativevector"; + +export default function attachmentManager(game: IGame) { + mp.events.add("SERVER:LoadAttachments", () => { + attachmentMngr.register("char_creator_1", "prop_beggers_sign_04", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0)); + attachmentMngr.register("ammobox", "gr_prop_gr_crate_mag_01a", 28422, new mp.Vector3(0, -0.18, -0.18), new mp.Vector3(0, 0, 0)); + attachmentMngr.register("binbag", "prop_cs_rub_binbag_01", 28422, new mp.Vector3(0.08, 0.0, -0.03), new mp.Vector3(270.0, 0.0, 25.0)); + attachmentMngr.register("weapondeal", "ex_prop_crate_ammo_bc", "chassis_dummy", new mp.Vector3(0.08, -0.9, -0.2), new mp.Vector3(0, 0, 0)); + attachmentMngr.register("weapondeal1", "ex_office_swag_guns02", "chassis_dummy", new mp.Vector3(0, 0.8, 0), new mp.Vector3(0, 0, 0)); + attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "weapondeal2w_sg_pumpshotgun", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180)); + }); + + const attachmentMngr = + { + attachments: {}, + + addFor: function (entityRage, id) { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + + let e = game.attachments.get(entity); + + if (this.attachments.hasOwnProperty(id)) { + if (e.__attachmentObjects == undefined) { e.__attachmentObjects = []; } + if (!e.__attachmentObjects.hasOwnProperty(id)) { + let attInfo = this.attachments[id]; + let object = mp.objects.new(attInfo.model, entityRage.position); + + object.attachTo(entityRage.handle, + (typeof (attInfo.boneName) === 'string') ? entityRage.getBoneIndexByName(attInfo.boneName) : entityRage.getBoneIndex(attInfo.boneName), + attInfo.offset.x, attInfo.offset.y, attInfo.offset.z, + attInfo.rotation.x, attInfo.rotation.y, attInfo.rotation.z, + false, false, false, false, 2, true); + + e.__attachmentObjects[id] = object; + } + } + else { + mp.game.graphics.notify(`Static Attachments Error: ~r~Unknown Attachment Used: ~w~0x${id.toString(16)}`); + } + }, + + removeFor: function (entityRage, id) { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + let e = game.attachments.get(entity); + + if (e.__attachmentObjects.hasOwnProperty(id)) { + let obj = e.__attachmentObjects[id]; + + obj.destroy(); + delete e.__attachmentObjects[id]; + } + }, + + initFor: function (entityRage) { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + + let e = game.attachments.get(entity); + if (e != null) { + for (let attachment of e.__attachments) { + attachmentMngr.addFor(entityRage, attachment); + } + } + }, + + shutdownFor: function (entityRage) { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + + let e = game.attachments.get(entity); + if (e != null) { + for (let attachment of e.__attachments) { + attachmentMngr.removeFor(entityRage, attachment); + } + } + }, + + register: function (id, model, boneName, offset, rotation) { + if (typeof (id) === 'string') { + id = mp.game.joaat(id); + } + + if (typeof (model) === 'string') { + model = mp.game.joaat(model); + } + + if (!this.attachments.hasOwnProperty(id)) { + if (mp.game.streaming.isModelInCdimage(model)) { + this.attachments[id] = + + { + id: id, + model: model, + offset: offset, + rotation: rotation, + boneName: boneName + }; + } + else { + mp.game.graphics.notify(`Static Attachments Error: ~r~Invalid Model(0x${model.toString(16)})`); + } + } + else { + mp.game.graphics.notify("Static Attachments Error: ~r~Duplicate Entry"); + } + }, + + unregister: function (id) { + if (typeof (id) === 'string') { + id = mp.game.joaat(id); + } + + if (this.attachments.hasOwnProperty(id)) { + this.attachments[id] = undefined; + } + }, + + addLocal: function (attachmentName) { + if (typeof (attachmentName) === 'string') { + attachmentName = mp.game.joaat(attachmentName); + } + + let entity = game.players.local; + let e = game.attachments.get(entity); + + if (!e.__attachments || e.__attachments.indexOf(attachmentName) === -1) { + mp.events.callRemote("staticAttachments.Add", attachmentName.toString(36)); + } + }, + + removeLocal: function (attachmentName) { + if (typeof (attachmentName) === 'string') { + attachmentName = mp.game.joaat(attachmentName); + } + + let entity = game.players.local; + let e = game.attachments.get(entity); + + if (e.__attachments && e.__attachments.indexOf(attachmentName) !== -1) { + mp.events.callRemote("staticAttachments.Remove", attachmentName.toString(36)); + } + }, + + getAttachments: function () { + return Object.assign({}, this.attachments); + } + }; + + mp.events.add("entityStreamIn", (entityRage) => { + if (entityRage.type === "player" || entityRage.type === "vehicle") { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + let e = game.attachments.get(entity); + if (e != null) { + if (e.__attachments) { + game.wait(5000); + attachmentMngr.initFor(entityRage); + } + } + } + }); + + mp.events.add("entityStreamOut", (entityRage) => { + if (entityRage == mp.players.local.vehicle) { mp.gui.chat.push("lol"); return; } + if (entityRage.type === "player" || entityRage.type === "vehicle") { + let e = game.attachments.at(entityRage.remoteId); + + if (e != null) { + if (e.__attachmentObjects) { + //game.wait(2500); + attachmentMngr.shutdownFor(entityRage); + } + } + } + }); + + mp.events.addDataHandler("attachmentsData", (entityRage, data) => { + let newAttachments = (data != null) ? data.split('|').map(att => parseInt(att, 36)) : []; + + if (entityRage.handle !== 0) { + let entity; + if (entityRage.type === "player") { + entity = game.players.at(entityRage.remoteId); + } else if (entityRage.type === "vehicle") { + entity = game.vehicles.at(entityRage.remoteId); + } + let e = game.attachments.get(entity); + if (e == null) { + let __attachments = []; + let __attachmentObjects = []; + e = game.attachments.set(entity, __attachments, __attachmentObjects); + } + + let oldAttachments = e.__attachments; + + if (!oldAttachments) { + oldAttachments = []; + e.__attachmentObjects = []; + } + + // process outdated first + for (let attachment of oldAttachments.keys()) { + var obj = oldAttachments[attachment]; + if (newAttachments.indexOf(obj) === -1) { + attachmentMngr.removeFor(entityRage, obj); + } + } + + // then new attachments + for (let attachment of newAttachments) { + if (oldAttachments.indexOf(attachment) === -1) { + attachmentMngr.addFor(entityRage, attachment); + } + } + e.__attachments = newAttachments; + } + }); + + function InitAttachmentsOnJoin() { + game.players.forEach(_player => { + let player = mp.players.at(_player.remoteId); + let e = game.attachments.get(_player); + if (e == null) { + let __attachments = []; + let __attachmentObjects = []; + e = game.attachments.set(_player, __attachments, __attachmentObjects); + } + let data = player.getVariable("attachmentsData"); + + if (data && data.length > 0) { + let atts = data.split('|').map(att => parseInt(att, 36)); + e.__attachments = atts; + e.__attachmentObjects = []; + } + }); + + game.vehicles.forEach(_veh => { + let vehicle = mp.vehicles.at(_veh.remoteId); + let e = game.attachments.get(_veh); + if (e == null) { + let __attachments = []; + let __attachmentObjects = []; + e = game.attachments.set(_veh, __attachments, __attachmentObjects); + } + let data = vehicle.getVariable("attachmentsData"); + + if (data && data.length > 0) { + let atts = data.split('|').map(att => parseInt(att, 36)); + e.__attachments = atts; + e.__attachmentObjects = []; + } + }); + } + + InitAttachmentsOnJoin(); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/relativevector.ts b/ReallifeGamemode.Client/util/relativevector.ts new file mode 100644 index 00000000..c8ab3b31 --- /dev/null +++ b/ReallifeGamemode.Client/util/relativevector.ts @@ -0,0 +1,28 @@ +export default function relativeVector() { + mp.events.add("SERVER:setMarkerBehindVehicle", (vehicle: EntityMp) => { + var boneIndex2 = vehicle.getBoneIndexByName("platelight"); + var boneIndex1 = vehicle.getBoneIndexByName("chassis_dummy"); + + let posPlate = vehicle.getWorldPositionOfBone(boneIndex2); + let posCentre = vehicle.getWorldPositionOfBone(boneIndex1); + + let plateVec = new mp.Vector3(posPlate.x, posPlate.y, posPlate.z); + let lightVec = new mp.Vector3(posCentre.x, posCentre.y, posCentre.z); + + let posPL = lightVec.subtract(plateVec); + + let temp = new mp.Vector3(posPL.x * -1, posPL.y * -1, posPL.z * -1) + + let length = Math.sqrt((temp.x * temp.x) + (temp.y * temp.y) + (temp.z * temp.z)); + + let x = temp.x / length; + let y = temp.y / length; + let z = temp.z / length; + + temp = new mp.Vector3(x, y, z - 1); + + let pos = plateVec.add(temp); + + mp.events.callRemote("CLIENT:setMarkerBehindVehicle", JSON.stringify(vehicle.remoteId), JSON.stringify(pos.x), JSON.stringify(pos.y), JSON.stringify(pos.z)); + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Database/Entities/JobVehicle.cs b/ReallifeGamemode.Database/Entities/JobVehicle.cs index 712fa83a..8a66bdad 100644 --- a/ReallifeGamemode.Database/Entities/JobVehicle.cs +++ b/ReallifeGamemode.Database/Entities/JobVehicle.cs @@ -1,6 +1,6 @@ namespace ReallifeGamemode.Database.Entities { - public partial class JobVehicle : ServerVehicle + public partial class JobVehicle : ServerVehicle { public int JobId { get; set; } } diff --git a/ReallifeGamemode.Database/Entities/Saves/SavedPed.cs b/ReallifeGamemode.Database/Entities/Saves/SavedPed.cs index 82bcc043..2ca399ca 100644 --- a/ReallifeGamemode.Database/Entities/Saves/SavedPed.cs +++ b/ReallifeGamemode.Database/Entities/Saves/SavedPed.cs @@ -21,5 +21,6 @@ namespace ReallifeGamemode.Database.Entities.Saves public float Heading { get; set; } public byte Dimension { get; set; } public bool Active { get; set; } + public int Type { get; set; } } } diff --git a/ReallifeGamemode.Database/Entities/Turfs.cs b/ReallifeGamemode.Database/Entities/Turfs.cs index 9ca8a6be..a6db8b19 100644 --- a/ReallifeGamemode.Database/Entities/Turfs.cs +++ b/ReallifeGamemode.Database/Entities/Turfs.cs @@ -22,7 +22,7 @@ namespace ReallifeGamemode.Database.Entities public float Range { get; set; } public int Color { get; set; } public string Vector { get; set; } = null; - public int Value {get; set;} = 0; + public int Value { get; set; } = 0; public int MaxValue { get; set; } = 0; public bool Surplus { get; set; } = false; diff --git a/ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs b/ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs index 617406c5..7d1b77ab 100644 --- a/ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs +++ b/ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs @@ -4,1282 +4,1282 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { - public partial class Initial : Migration + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ATMs", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Balance = table.Column(nullable: false), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - Faulty = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ATMs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BankAccountTransactionLogs", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Sender = table.Column(maxLength: 32, nullable: true), - SenderBalance = table.Column(nullable: false), - MoneySent = table.Column(nullable: false), - Receiver = table.Column(maxLength: 32, nullable: true), - ReceiverBalance = table.Column(nullable: false), - NewSenderBalance = table.Column(nullable: false), - NewReceiverBalance = table.Column(nullable: false), - Fee = table.Column(nullable: false), - Origin = table.Column(maxLength: 32, nullable: true), - Timestamp = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) - }, - constraints: table => - { - table.PrimaryKey("PK_BankAccountTransactionLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Blips", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Sprite = table.Column(nullable: false), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - Name = table.Column(nullable: true), - Scale = table.Column(nullable: false), - Color = table.Column(nullable: false), - Alpha = table.Column(nullable: false), - DrawDistance = table.Column(nullable: false), - ShortRange = table.Column(nullable: false), - Rotation = table.Column(nullable: false), - Dimension = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Blips", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BusinessBankAccounts", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Balance = table.Column(nullable: false), - BusinessId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BusinessBankAccounts", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BusinessData", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - BusinessId = table.Column(nullable: false), - Price = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_BusinessData", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BusRoutes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BusRoutes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ClothCombinations", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Gender = table.Column(nullable: false), - Top = table.Column(nullable: false), - Torso = table.Column(nullable: false), - Undershirt = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ClothCombinations", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Factions", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(maxLength: 32, nullable: true), - StateOwned = table.Column(nullable: false), - WeaponDealTime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Factions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "GotoPoints", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(maxLength: 32, nullable: true), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_GotoPoints", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Groups", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Groups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Interiors", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: true), - EnterPosition = table.Column(nullable: true), - ExitPosition = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Interiors", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Locations", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(nullable: true), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - Heading = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Locations", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Markers", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Type = table.Column(nullable: false), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - Scale = table.Column(nullable: false), - DirectionX = table.Column(nullable: false), - DirectionY = table.Column(nullable: false), - DirectionZ = table.Column(nullable: false), - RotationX = table.Column(nullable: false), - RotationY = table.Column(nullable: false), - RotationZ = table.Column(nullable: false), - ColorR = table.Column(nullable: false), - ColorG = table.Column(nullable: false), - ColorB = table.Column(nullable: false), - ColorA = table.Column(nullable: false), - Visible = table.Column(nullable: false), - Dimension = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Markers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Peds", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - HashModel = table.Column(nullable: true), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - Heading = table.Column(nullable: false), - Dimension = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Peds", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Pickups", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - PositionX = table.Column(maxLength: 128, nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - RotationX = table.Column(nullable: false), - RotationY = table.Column(nullable: false), - RotationZ = table.Column(nullable: false), - Vehicle = table.Column(nullable: false), - RespawnTime = table.Column(nullable: false), - Dimension = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Pickups", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ShopClothes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ClotheId = table.Column(nullable: false), - Gender = table.Column(nullable: false), - TypeId = table.Column(nullable: true), - ComponentId = table.Column(nullable: false), - Category = table.Column(nullable: false), - Price = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShopClothes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TextLabels", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Text = table.Column(nullable: false), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - LOS = table.Column(nullable: false), - Font = table.Column(nullable: false), - DrawDistance = table.Column(nullable: false), - ColorR = table.Column(nullable: false), - ColorG = table.Column(nullable: false), - ColorB = table.Column(nullable: false), - ColorA = table.Column(nullable: false), - Dimension = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TextLabels", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TuningGarages", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TuningGarages", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Turfs", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - FactionId = table.Column(nullable: true), - Owner = table.Column(nullable: true), - Name = table.Column(nullable: true), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Rotation = table.Column(nullable: false), - Range = table.Column(nullable: false), - Color = table.Column(nullable: false), - Vector = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Turfs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "WhitelistEntries", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - SocialClubName = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_WhitelistEntries", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "BusRoutesPoints", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(nullable: true), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - BusRouteId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BusRoutesPoints", x => x.Id); - table.ForeignKey( - name: "FK_BusRoutesPoints_BusRoutes_BusRouteId", - column: x => x.BusRouteId, - principalTable: "BusRoutes", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Doors", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Category = table.Column(nullable: true), - Name = table.Column(nullable: true), - Locked = table.Column(nullable: false), - Model = table.Column(nullable: false), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - Radius = table.Column(nullable: false), - FactionId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Doors", x => x.Id); - table.ForeignKey( - name: "FK_Doors_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "DutyClothes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - FactionId = table.Column(nullable: false), - Gender = table.Column(nullable: false), - SlotType = table.Column(nullable: false), - SlotId = table.Column(nullable: false), - ClothId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DutyClothes", x => x.Id); - table.ForeignKey( - name: "FK_DutyClothes_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "FactionBankAccounts", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - FactionId = table.Column(nullable: false), - Bic = table.Column(maxLength: 12, nullable: true), - Iban = table.Column(maxLength: 32, nullable: true), - Balance = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_FactionBankAccounts", x => x.Id); - table.ForeignKey( - name: "FK_FactionBankAccounts_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "FactionRanks", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - RankName = table.Column(nullable: true), - Order = table.Column(nullable: false), - FactionId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_FactionRanks", x => x.Id); - table.ForeignKey( - name: "FK_FactionRanks_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "FactionWeapons", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - FactionId = table.Column(nullable: true), - WeaponModel = table.Column(nullable: true), - SlotID = table.Column(nullable: false), - Rank = table.Column(nullable: false), - Ammount = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_FactionWeapons", x => x.Id); - table.ForeignKey( - name: "FK_FactionWeapons_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "GroupBankAccounts", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - GroupId = table.Column(nullable: true), - Balance = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_GroupBankAccounts", x => x.Id); - table.ForeignKey( - name: "FK_GroupBankAccounts_Groups_GroupId", - column: x => x.GroupId, - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(maxLength: 32, nullable: true), - SocialClubName = table.Column(maxLength: 32, nullable: true), - Password = table.Column(maxLength: 64, nullable: true), - LogUserId = table.Column(nullable: false), - RegistrationDate = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Email = table.Column(maxLength: 64, nullable: true), - AdminLevel = table.Column(nullable: false), - Dead = table.Column(nullable: false), - Handmoney = table.Column(nullable: false), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - CharacterId = table.Column(nullable: true), - BanId = table.Column(nullable: true), - BusinessId = table.Column(nullable: true), - FactionId = table.Column(nullable: true), - FactionLeader = table.Column(nullable: false), - FactionRankId = table.Column(nullable: true), - GroupId = table.Column(nullable: true), - GroupRank = table.Column(nullable: false), - HouseId = table.Column(nullable: true), - JobId = table.Column(nullable: true), - Wanteds = table.Column(nullable: false), - Wage = table.Column(nullable: false), - JailTime = table.Column(nullable: false), - PaydayTimer = table.Column(nullable: false), - DriverLicenseVehicle = table.Column(nullable: false), - FlyingLicensePlane = table.Column(nullable: false), - DriverLicenseBike = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - table.ForeignKey( - name: "FK_Users_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Users_FactionRanks_FactionRankId", - column: x => x.FactionRankId, - principalTable: "FactionRanks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Users_Groups_GroupId", - column: x => x.GroupId, - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Bans", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: false), - Reason = table.Column(nullable: true), - BannedBy = table.Column(nullable: true), - Applied = table.Column(nullable: false), - UntilDateTime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Bans", x => x.Id); - table.ForeignKey( - name: "FK_Bans_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CharacterClothes", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: false), - Duty = table.Column(nullable: false), - SlotType = table.Column(nullable: false), - SlotId = table.Column(nullable: false), - ClothId = table.Column(nullable: false), - Texture = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CharacterClothes", x => x.Id); - table.ForeignKey( - name: "FK_CharacterClothes_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Characters", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: false), - Gender = table.Column(nullable: false), - Father = table.Column(nullable: false), - Mother = table.Column(nullable: false), - Similarity = table.Column(nullable: false), - SkinSimilarity = table.Column(nullable: false), - NoseWidth = table.Column(nullable: false), - NoseBottomHeight = table.Column(nullable: false), - NoseTipLength = table.Column(nullable: false), - NoseBridgeDepth = table.Column(nullable: false), - NoseTipHeight = table.Column(nullable: false), - NoseBroken = table.Column(nullable: false), - BrowHeight = table.Column(nullable: false), - BrowDepth = table.Column(nullable: false), - CheekboneHeight = table.Column(nullable: false), - CheekboneWidth = table.Column(nullable: false), - CheekDepth = table.Column(nullable: false), - EyeSize = table.Column(nullable: false), - LipThickness = table.Column(nullable: false), - JawWidth = table.Column(nullable: false), - JawShape = table.Column(nullable: false), - ChinHeight = table.Column(nullable: false), - ChinDepth = table.Column(nullable: false), - ChinWidth = table.Column(nullable: false), - ChinIndent = table.Column(nullable: false), - NeckWidth = table.Column(nullable: false), - Blemishes = table.Column(nullable: false), - BlemishesOpacity = table.Column(nullable: false), - FacialHair = table.Column(nullable: false), - FacialHairOpacity = table.Column(nullable: false), - Eyebrows = table.Column(nullable: false), - EyebrowsOpacity = table.Column(nullable: false), - Ageing = table.Column(nullable: false), - AgeingOpacity = table.Column(nullable: false), - Makeup = table.Column(nullable: false), - MakeupOpacity = table.Column(nullable: false), - Blush = table.Column(nullable: false), - BlushOpacity = table.Column(nullable: false), - Complexion = table.Column(nullable: false), - ComplexionOpacity = table.Column(nullable: false), - SunDamage = table.Column(nullable: false), - SunDamageOpacity = table.Column(nullable: false), - Lipstick = table.Column(nullable: false), - LipstickOpacity = table.Column(nullable: false), - Freckles = table.Column(nullable: false), - FrecklesOpacity = table.Column(nullable: false), - ChestHair = table.Column(nullable: false), - ChestHairOpacity = table.Column(nullable: false), - Hair = table.Column(nullable: false), - HairColor = table.Column(nullable: false), - HairHighlightColor = table.Column(nullable: false), - EyebrowColor = table.Column(nullable: false), - BeardColor = table.Column(nullable: false), - EyeColor = table.Column(nullable: false), - BlushColor = table.Column(nullable: false), - LipstickColor = table.Column(nullable: false), - ChestHairColor = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Characters", x => x.Id); - table.ForeignKey( - name: "FK_Characters_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "DeathLogs", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - VictimId = table.Column(nullable: false), - KillerId = table.Column(nullable: true), - VictimPositionX = table.Column(nullable: false), - VictimPositionY = table.Column(nullable: false), - VictimPositionZ = table.Column(nullable: false), - VictimHeading = table.Column(nullable: false), - KillerPositionX = table.Column(nullable: false), - KillerPositionY = table.Column(nullable: false), - KillerPositionZ = table.Column(nullable: false), - KillerHeading = table.Column(nullable: false), - CauseOfDeath = table.Column(maxLength: 64, nullable: true), - Timestamp = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) - }, - constraints: table => - { - table.PrimaryKey("PK_DeathLogs", x => x.Id); - table.ForeignKey( - name: "FK_DeathLogs_Users_KillerId", - column: x => x.KillerId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_DeathLogs_Users_VictimId", - column: x => x.VictimId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Houses", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Type = table.Column(nullable: true), - Price = table.Column(nullable: false), - X = table.Column(nullable: false), - Y = table.Column(nullable: false), - Z = table.Column(nullable: false), - RentalFee = table.Column(nullable: false), - CanRentIn = table.Column(nullable: false), - OwnerId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Houses", x => x.Id); - table.ForeignKey( - name: "FK_Houses_Users_OwnerId", - column: x => x.OwnerId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "News", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: true), - Caption = table.Column(nullable: true), - Content = table.Column(nullable: true), - Active = table.Column(nullable: false), - Timestamp = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_News", x => x.Id); - table.ForeignKey( - name: "FK_News_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "ServerVehicles", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Model = table.Column(nullable: false), - PositionX = table.Column(nullable: false), - PositionY = table.Column(nullable: false), - PositionZ = table.Column(nullable: false), - Heading = table.Column(nullable: false), - NumberPlate = table.Column(maxLength: 8, nullable: true), - PrimaryColor = table.Column(nullable: false), - SecondaryColor = table.Column(nullable: false), - Locked = table.Column(nullable: false), - Active = table.Column(nullable: false, defaultValue: true), - DistanceDriven = table.Column(nullable: false), - TankAmount = table.Column(nullable: false), - Livery = table.Column(nullable: false), - Discriminator = table.Column(nullable: false), - FactionId = table.Column(nullable: true), - GroupId = table.Column(nullable: true), - JobId = table.Column(nullable: true), - SchoolId = table.Column(nullable: true), - BusinessId = table.Column(nullable: true), - Price = table.Column(nullable: true), - UserId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ServerVehicles", x => x.Id); - table.ForeignKey( - name: "FK_ServerVehicles_Factions_FactionId", - column: x => x.FactionId, - principalTable: "Factions", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ServerVehicles_Groups_GroupId", - column: x => x.GroupId, - principalTable: "Groups", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ServerVehicles_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserBankAccounts", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - UserId = table.Column(nullable: false), - Bic = table.Column(maxLength: 12, nullable: true), - Iban = table.Column(maxLength: 32, nullable: true), - Balance = table.Column(nullable: false), - Active = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserBankAccounts", x => x.Id); - table.ForeignKey( - name: "FK_UserBankAccounts_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserItems", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ItemId = table.Column(nullable: false), - UserId = table.Column(nullable: false), - Amount = table.Column(nullable: false), - Slot = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserItems", x => x.Id); - table.ForeignKey( - name: "FK_UserItems_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "HouseRentals", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - HouseId = table.Column(nullable: true), - UserId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_HouseRentals", x => x.Id); - table.ForeignKey( - name: "FK_HouseRentals_Houses_HouseId", - column: x => x.HouseId, - principalTable: "Houses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_HouseRentals_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "VehicleItems", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ItemId = table.Column(nullable: false), - VehicleId = table.Column(nullable: false), - Amount = table.Column(nullable: false), - Slot = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_VehicleItems", x => x.Id); - table.ForeignKey( - name: "FK_VehicleItems_ServerVehicles_VehicleId", - column: x => x.VehicleId, - principalTable: "ServerVehicles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "VehicleMods", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ServerVehicleId = table.Column(nullable: false), - Slot = table.Column(nullable: false), - ModId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_VehicleMods", x => x.Id); - table.ForeignKey( - name: "FK_VehicleMods_ServerVehicles_ServerVehicleId", - column: x => x.ServerVehicleId, - principalTable: "ServerVehicles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Bans_UserId", - table: "Bans", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_BusinessBankAccounts_BusinessId", - table: "BusinessBankAccounts", - column: "BusinessId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_BusRoutesPoints_BusRouteId", - table: "BusRoutesPoints", - column: "BusRouteId"); - - migrationBuilder.CreateIndex( - name: "IX_CharacterClothes_UserId", - table: "CharacterClothes", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Characters_UserId", - table: "Characters", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_DeathLogs_KillerId", - table: "DeathLogs", - column: "KillerId"); - - migrationBuilder.CreateIndex( - name: "IX_DeathLogs_VictimId", - table: "DeathLogs", - column: "VictimId"); - - migrationBuilder.CreateIndex( - name: "IX_Doors_FactionId", - table: "Doors", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_DutyClothes_FactionId", - table: "DutyClothes", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_FactionBankAccounts_FactionId", - table: "FactionBankAccounts", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_FactionRanks_FactionId", - table: "FactionRanks", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_FactionWeapons_FactionId", - table: "FactionWeapons", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_GroupBankAccounts_GroupId", - table: "GroupBankAccounts", - column: "GroupId"); - - migrationBuilder.CreateIndex( - name: "IX_HouseRentals_HouseId", - table: "HouseRentals", - column: "HouseId"); - - migrationBuilder.CreateIndex( - name: "IX_HouseRentals_UserId", - table: "HouseRentals", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Houses_OwnerId", - table: "Houses", - column: "OwnerId"); - - migrationBuilder.CreateIndex( - name: "IX_News_UserId", - table: "News", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_ServerVehicles_FactionId", - table: "ServerVehicles", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_ServerVehicles_GroupId", - table: "ServerVehicles", - column: "GroupId"); - - migrationBuilder.CreateIndex( - name: "IX_ServerVehicles_UserId", - table: "ServerVehicles", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserBankAccounts_UserId", - table: "UserBankAccounts", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserItems_UserId", - table: "UserItems", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_BanId", - table: "Users", - column: "BanId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_BusinessId", - table: "Users", - column: "BusinessId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Users_CharacterId", - table: "Users", - column: "CharacterId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_FactionId", - table: "Users", - column: "FactionId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_FactionRankId", - table: "Users", - column: "FactionRankId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_GroupId", - table: "Users", - column: "GroupId"); - - migrationBuilder.CreateIndex( - name: "IX_Users_HouseId", - table: "Users", - column: "HouseId"); - - migrationBuilder.CreateIndex( - name: "IX_VehicleItems_VehicleId", - table: "VehicleItems", - column: "VehicleId"); - - migrationBuilder.CreateIndex( - name: "IX_VehicleMods_ServerVehicleId_Slot", - table: "VehicleMods", - columns: new[] { "ServerVehicleId", "Slot" }, - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Houses_HouseId", - table: "Users", - column: "HouseId", - principalTable: "Houses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Bans_BanId", - table: "Users", - column: "BanId", - principalTable: "Bans", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Users_Characters_CharacterId", - table: "Users", - column: "CharacterId", - principalTable: "Characters", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Bans_Users_UserId", - table: "Bans"); - - migrationBuilder.DropForeignKey( - name: "FK_Characters_Users_UserId", - table: "Characters"); - - migrationBuilder.DropForeignKey( - name: "FK_Houses_Users_OwnerId", - table: "Houses"); - - migrationBuilder.DropTable( - name: "ATMs"); - - migrationBuilder.DropTable( - name: "BankAccountTransactionLogs"); - - migrationBuilder.DropTable( - name: "Blips"); - - migrationBuilder.DropTable( - name: "BusinessBankAccounts"); - - migrationBuilder.DropTable( - name: "BusinessData"); - - migrationBuilder.DropTable( - name: "BusRoutesPoints"); - - migrationBuilder.DropTable( - name: "CharacterClothes"); - - migrationBuilder.DropTable( - name: "ClothCombinations"); - - migrationBuilder.DropTable( - name: "DeathLogs"); - - migrationBuilder.DropTable( - name: "Doors"); - - migrationBuilder.DropTable( - name: "DutyClothes"); - - migrationBuilder.DropTable( - name: "FactionBankAccounts"); - - migrationBuilder.DropTable( - name: "FactionWeapons"); - - migrationBuilder.DropTable( - name: "GotoPoints"); - - migrationBuilder.DropTable( - name: "GroupBankAccounts"); - - migrationBuilder.DropTable( - name: "HouseRentals"); - - migrationBuilder.DropTable( - name: "Interiors"); - - migrationBuilder.DropTable( - name: "Locations"); - - migrationBuilder.DropTable( - name: "Markers"); - - migrationBuilder.DropTable( - name: "News"); - - migrationBuilder.DropTable( - name: "Peds"); - - migrationBuilder.DropTable( - name: "Pickups"); - - migrationBuilder.DropTable( - name: "ShopClothes"); - - migrationBuilder.DropTable( - name: "TextLabels"); - - migrationBuilder.DropTable( - name: "TuningGarages"); - - migrationBuilder.DropTable( - name: "Turfs"); - - migrationBuilder.DropTable( - name: "UserBankAccounts"); - - migrationBuilder.DropTable( - name: "UserItems"); - - migrationBuilder.DropTable( - name: "VehicleItems"); - - migrationBuilder.DropTable( - name: "VehicleMods"); - - migrationBuilder.DropTable( - name: "WhitelistEntries"); - - migrationBuilder.DropTable( - name: "BusRoutes"); - - migrationBuilder.DropTable( - name: "ServerVehicles"); - - migrationBuilder.DropTable( - name: "Users"); - - migrationBuilder.DropTable( - name: "Bans"); - - migrationBuilder.DropTable( - name: "Characters"); - - migrationBuilder.DropTable( - name: "FactionRanks"); - - migrationBuilder.DropTable( - name: "Groups"); - - migrationBuilder.DropTable( - name: "Houses"); - - migrationBuilder.DropTable( - name: "Factions"); - } + migrationBuilder.CreateTable( + name: "ATMs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Balance = table.Column(nullable: false), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + Faulty = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ATMs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BankAccountTransactionLogs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Sender = table.Column(maxLength: 32, nullable: true), + SenderBalance = table.Column(nullable: false), + MoneySent = table.Column(nullable: false), + Receiver = table.Column(maxLength: 32, nullable: true), + ReceiverBalance = table.Column(nullable: false), + NewSenderBalance = table.Column(nullable: false), + NewReceiverBalance = table.Column(nullable: false), + Fee = table.Column(nullable: false), + Origin = table.Column(maxLength: 32, nullable: true), + Timestamp = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_BankAccountTransactionLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Blips", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Sprite = table.Column(nullable: false), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + Name = table.Column(nullable: true), + Scale = table.Column(nullable: false), + Color = table.Column(nullable: false), + Alpha = table.Column(nullable: false), + DrawDistance = table.Column(nullable: false), + ShortRange = table.Column(nullable: false), + Rotation = table.Column(nullable: false), + Dimension = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Blips", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BusinessBankAccounts", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Balance = table.Column(nullable: false), + BusinessId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BusinessBankAccounts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BusinessData", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BusinessId = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BusinessData", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BusRoutes", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BusRoutes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ClothCombinations", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Gender = table.Column(nullable: false), + Top = table.Column(nullable: false), + Torso = table.Column(nullable: false), + Undershirt = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ClothCombinations", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Factions", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(maxLength: 32, nullable: true), + StateOwned = table.Column(nullable: false), + WeaponDealTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Factions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "GotoPoints", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(maxLength: 32, nullable: true), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GotoPoints", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Interiors", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), + EnterPosition = table.Column(nullable: true), + ExitPosition = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Interiors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Locations", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(nullable: true), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + Heading = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Locations", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Markers", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Type = table.Column(nullable: false), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + Scale = table.Column(nullable: false), + DirectionX = table.Column(nullable: false), + DirectionY = table.Column(nullable: false), + DirectionZ = table.Column(nullable: false), + RotationX = table.Column(nullable: false), + RotationY = table.Column(nullable: false), + RotationZ = table.Column(nullable: false), + ColorR = table.Column(nullable: false), + ColorG = table.Column(nullable: false), + ColorB = table.Column(nullable: false), + ColorA = table.Column(nullable: false), + Visible = table.Column(nullable: false), + Dimension = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Markers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Peds", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + HashModel = table.Column(nullable: true), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + Heading = table.Column(nullable: false), + Dimension = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Peds", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Pickups", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + PositionX = table.Column(maxLength: 128, nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + RotationX = table.Column(nullable: false), + RotationY = table.Column(nullable: false), + RotationZ = table.Column(nullable: false), + Vehicle = table.Column(nullable: false), + RespawnTime = table.Column(nullable: false), + Dimension = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Pickups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ShopClothes", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ClotheId = table.Column(nullable: false), + Gender = table.Column(nullable: false), + TypeId = table.Column(nullable: true), + ComponentId = table.Column(nullable: false), + Category = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopClothes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TextLabels", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Text = table.Column(nullable: false), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + LOS = table.Column(nullable: false), + Font = table.Column(nullable: false), + DrawDistance = table.Column(nullable: false), + ColorR = table.Column(nullable: false), + ColorG = table.Column(nullable: false), + ColorB = table.Column(nullable: false), + ColorA = table.Column(nullable: false), + Dimension = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TextLabels", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TuningGarages", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TuningGarages", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Turfs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FactionId = table.Column(nullable: true), + Owner = table.Column(nullable: true), + Name = table.Column(nullable: true), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Rotation = table.Column(nullable: false), + Range = table.Column(nullable: false), + Color = table.Column(nullable: false), + Vector = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Turfs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WhitelistEntries", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SocialClubName = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WhitelistEntries", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BusRoutesPoints", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(nullable: true), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + BusRouteId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BusRoutesPoints", x => x.Id); + table.ForeignKey( + name: "FK_BusRoutesPoints_BusRoutes_BusRouteId", + column: x => x.BusRouteId, + principalTable: "BusRoutes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Doors", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Category = table.Column(nullable: true), + Name = table.Column(nullable: true), + Locked = table.Column(nullable: false), + Model = table.Column(nullable: false), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + Radius = table.Column(nullable: false), + FactionId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Doors", x => x.Id); + table.ForeignKey( + name: "FK_Doors_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "DutyClothes", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FactionId = table.Column(nullable: false), + Gender = table.Column(nullable: false), + SlotType = table.Column(nullable: false), + SlotId = table.Column(nullable: false), + ClothId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DutyClothes", x => x.Id); + table.ForeignKey( + name: "FK_DutyClothes_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FactionBankAccounts", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FactionId = table.Column(nullable: false), + Bic = table.Column(maxLength: 12, nullable: true), + Iban = table.Column(maxLength: 32, nullable: true), + Balance = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FactionBankAccounts", x => x.Id); + table.ForeignKey( + name: "FK_FactionBankAccounts_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FactionRanks", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RankName = table.Column(nullable: true), + Order = table.Column(nullable: false), + FactionId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FactionRanks", x => x.Id); + table.ForeignKey( + name: "FK_FactionRanks_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "FactionWeapons", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FactionId = table.Column(nullable: true), + WeaponModel = table.Column(nullable: true), + SlotID = table.Column(nullable: false), + Rank = table.Column(nullable: false), + Ammount = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FactionWeapons", x => x.Id); + table.ForeignKey( + name: "FK_FactionWeapons_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "GroupBankAccounts", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + GroupId = table.Column(nullable: true), + Balance = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GroupBankAccounts", x => x.Id); + table.ForeignKey( + name: "FK_GroupBankAccounts_Groups_GroupId", + column: x => x.GroupId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(maxLength: 32, nullable: true), + SocialClubName = table.Column(maxLength: 32, nullable: true), + Password = table.Column(maxLength: 64, nullable: true), + LogUserId = table.Column(nullable: false), + RegistrationDate = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Email = table.Column(maxLength: 64, nullable: true), + AdminLevel = table.Column(nullable: false), + Dead = table.Column(nullable: false), + Handmoney = table.Column(nullable: false), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + CharacterId = table.Column(nullable: true), + BanId = table.Column(nullable: true), + BusinessId = table.Column(nullable: true), + FactionId = table.Column(nullable: true), + FactionLeader = table.Column(nullable: false), + FactionRankId = table.Column(nullable: true), + GroupId = table.Column(nullable: true), + GroupRank = table.Column(nullable: false), + HouseId = table.Column(nullable: true), + JobId = table.Column(nullable: true), + Wanteds = table.Column(nullable: false), + Wage = table.Column(nullable: false), + JailTime = table.Column(nullable: false), + PaydayTimer = table.Column(nullable: false), + DriverLicenseVehicle = table.Column(nullable: false), + FlyingLicensePlane = table.Column(nullable: false), + DriverLicenseBike = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + table.ForeignKey( + name: "FK_Users_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Users_FactionRanks_FactionRankId", + column: x => x.FactionRankId, + principalTable: "FactionRanks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Users_Groups_GroupId", + column: x => x.GroupId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Bans", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: false), + Reason = table.Column(nullable: true), + BannedBy = table.Column(nullable: true), + Applied = table.Column(nullable: false), + UntilDateTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Bans", x => x.Id); + table.ForeignKey( + name: "FK_Bans_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CharacterClothes", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: false), + Duty = table.Column(nullable: false), + SlotType = table.Column(nullable: false), + SlotId = table.Column(nullable: false), + ClothId = table.Column(nullable: false), + Texture = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CharacterClothes", x => x.Id); + table.ForeignKey( + name: "FK_CharacterClothes_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Characters", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: false), + Gender = table.Column(nullable: false), + Father = table.Column(nullable: false), + Mother = table.Column(nullable: false), + Similarity = table.Column(nullable: false), + SkinSimilarity = table.Column(nullable: false), + NoseWidth = table.Column(nullable: false), + NoseBottomHeight = table.Column(nullable: false), + NoseTipLength = table.Column(nullable: false), + NoseBridgeDepth = table.Column(nullable: false), + NoseTipHeight = table.Column(nullable: false), + NoseBroken = table.Column(nullable: false), + BrowHeight = table.Column(nullable: false), + BrowDepth = table.Column(nullable: false), + CheekboneHeight = table.Column(nullable: false), + CheekboneWidth = table.Column(nullable: false), + CheekDepth = table.Column(nullable: false), + EyeSize = table.Column(nullable: false), + LipThickness = table.Column(nullable: false), + JawWidth = table.Column(nullable: false), + JawShape = table.Column(nullable: false), + ChinHeight = table.Column(nullable: false), + ChinDepth = table.Column(nullable: false), + ChinWidth = table.Column(nullable: false), + ChinIndent = table.Column(nullable: false), + NeckWidth = table.Column(nullable: false), + Blemishes = table.Column(nullable: false), + BlemishesOpacity = table.Column(nullable: false), + FacialHair = table.Column(nullable: false), + FacialHairOpacity = table.Column(nullable: false), + Eyebrows = table.Column(nullable: false), + EyebrowsOpacity = table.Column(nullable: false), + Ageing = table.Column(nullable: false), + AgeingOpacity = table.Column(nullable: false), + Makeup = table.Column(nullable: false), + MakeupOpacity = table.Column(nullable: false), + Blush = table.Column(nullable: false), + BlushOpacity = table.Column(nullable: false), + Complexion = table.Column(nullable: false), + ComplexionOpacity = table.Column(nullable: false), + SunDamage = table.Column(nullable: false), + SunDamageOpacity = table.Column(nullable: false), + Lipstick = table.Column(nullable: false), + LipstickOpacity = table.Column(nullable: false), + Freckles = table.Column(nullable: false), + FrecklesOpacity = table.Column(nullable: false), + ChestHair = table.Column(nullable: false), + ChestHairOpacity = table.Column(nullable: false), + Hair = table.Column(nullable: false), + HairColor = table.Column(nullable: false), + HairHighlightColor = table.Column(nullable: false), + EyebrowColor = table.Column(nullable: false), + BeardColor = table.Column(nullable: false), + EyeColor = table.Column(nullable: false), + BlushColor = table.Column(nullable: false), + LipstickColor = table.Column(nullable: false), + ChestHairColor = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Characters", x => x.Id); + table.ForeignKey( + name: "FK_Characters_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DeathLogs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + VictimId = table.Column(nullable: false), + KillerId = table.Column(nullable: true), + VictimPositionX = table.Column(nullable: false), + VictimPositionY = table.Column(nullable: false), + VictimPositionZ = table.Column(nullable: false), + VictimHeading = table.Column(nullable: false), + KillerPositionX = table.Column(nullable: false), + KillerPositionY = table.Column(nullable: false), + KillerPositionZ = table.Column(nullable: false), + KillerHeading = table.Column(nullable: false), + CauseOfDeath = table.Column(maxLength: 64, nullable: true), + Timestamp = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + }, + constraints: table => + { + table.PrimaryKey("PK_DeathLogs", x => x.Id); + table.ForeignKey( + name: "FK_DeathLogs_Users_KillerId", + column: x => x.KillerId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_DeathLogs_Users_VictimId", + column: x => x.VictimId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Houses", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Type = table.Column(nullable: true), + Price = table.Column(nullable: false), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + RentalFee = table.Column(nullable: false), + CanRentIn = table.Column(nullable: false), + OwnerId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Houses", x => x.Id); + table.ForeignKey( + name: "FK_Houses_Users_OwnerId", + column: x => x.OwnerId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "News", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: true), + Caption = table.Column(nullable: true), + Content = table.Column(nullable: true), + Active = table.Column(nullable: false), + Timestamp = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_News", x => x.Id); + table.ForeignKey( + name: "FK_News_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ServerVehicles", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Model = table.Column(nullable: false), + PositionX = table.Column(nullable: false), + PositionY = table.Column(nullable: false), + PositionZ = table.Column(nullable: false), + Heading = table.Column(nullable: false), + NumberPlate = table.Column(maxLength: 8, nullable: true), + PrimaryColor = table.Column(nullable: false), + SecondaryColor = table.Column(nullable: false), + Locked = table.Column(nullable: false), + Active = table.Column(nullable: false, defaultValue: true), + DistanceDriven = table.Column(nullable: false), + TankAmount = table.Column(nullable: false), + Livery = table.Column(nullable: false), + Discriminator = table.Column(nullable: false), + FactionId = table.Column(nullable: true), + GroupId = table.Column(nullable: true), + JobId = table.Column(nullable: true), + SchoolId = table.Column(nullable: true), + BusinessId = table.Column(nullable: true), + Price = table.Column(nullable: true), + UserId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ServerVehicles", x => x.Id); + table.ForeignKey( + name: "FK_ServerVehicles_Factions_FactionId", + column: x => x.FactionId, + principalTable: "Factions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ServerVehicles_Groups_GroupId", + column: x => x.GroupId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ServerVehicles_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserBankAccounts", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(nullable: false), + Bic = table.Column(maxLength: 12, nullable: true), + Iban = table.Column(maxLength: 32, nullable: true), + Balance = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserBankAccounts", x => x.Id); + table.ForeignKey( + name: "FK_UserBankAccounts_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserItems", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(nullable: false), + UserId = table.Column(nullable: false), + Amount = table.Column(nullable: false), + Slot = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserItems", x => x.Id); + table.ForeignKey( + name: "FK_UserItems_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "HouseRentals", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + HouseId = table.Column(nullable: true), + UserId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_HouseRentals", x => x.Id); + table.ForeignKey( + name: "FK_HouseRentals_Houses_HouseId", + column: x => x.HouseId, + principalTable: "Houses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_HouseRentals_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "VehicleItems", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(nullable: false), + VehicleId = table.Column(nullable: false), + Amount = table.Column(nullable: false), + Slot = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleItems", x => x.Id); + table.ForeignKey( + name: "FK_VehicleItems_ServerVehicles_VehicleId", + column: x => x.VehicleId, + principalTable: "ServerVehicles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "VehicleMods", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ServerVehicleId = table.Column(nullable: false), + Slot = table.Column(nullable: false), + ModId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleMods", x => x.Id); + table.ForeignKey( + name: "FK_VehicleMods_ServerVehicles_ServerVehicleId", + column: x => x.ServerVehicleId, + principalTable: "ServerVehicles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Bans_UserId", + table: "Bans", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_BusinessBankAccounts_BusinessId", + table: "BusinessBankAccounts", + column: "BusinessId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_BusRoutesPoints_BusRouteId", + table: "BusRoutesPoints", + column: "BusRouteId"); + + migrationBuilder.CreateIndex( + name: "IX_CharacterClothes_UserId", + table: "CharacterClothes", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Characters_UserId", + table: "Characters", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_DeathLogs_KillerId", + table: "DeathLogs", + column: "KillerId"); + + migrationBuilder.CreateIndex( + name: "IX_DeathLogs_VictimId", + table: "DeathLogs", + column: "VictimId"); + + migrationBuilder.CreateIndex( + name: "IX_Doors_FactionId", + table: "Doors", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_DutyClothes_FactionId", + table: "DutyClothes", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_FactionBankAccounts_FactionId", + table: "FactionBankAccounts", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_FactionRanks_FactionId", + table: "FactionRanks", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_FactionWeapons_FactionId", + table: "FactionWeapons", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_GroupBankAccounts_GroupId", + table: "GroupBankAccounts", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_HouseRentals_HouseId", + table: "HouseRentals", + column: "HouseId"); + + migrationBuilder.CreateIndex( + name: "IX_HouseRentals_UserId", + table: "HouseRentals", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Houses_OwnerId", + table: "Houses", + column: "OwnerId"); + + migrationBuilder.CreateIndex( + name: "IX_News_UserId", + table: "News", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_ServerVehicles_FactionId", + table: "ServerVehicles", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_ServerVehicles_GroupId", + table: "ServerVehicles", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_ServerVehicles_UserId", + table: "ServerVehicles", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserBankAccounts_UserId", + table: "UserBankAccounts", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_UserItems_UserId", + table: "UserItems", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_BanId", + table: "Users", + column: "BanId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_BusinessId", + table: "Users", + column: "BusinessId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Users_CharacterId", + table: "Users", + column: "CharacterId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_FactionId", + table: "Users", + column: "FactionId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_FactionRankId", + table: "Users", + column: "FactionRankId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_GroupId", + table: "Users", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_Users_HouseId", + table: "Users", + column: "HouseId"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleItems_VehicleId", + table: "VehicleItems", + column: "VehicleId"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleMods_ServerVehicleId_Slot", + table: "VehicleMods", + columns: new[] { "ServerVehicleId", "Slot" }, + unique: true); + + migrationBuilder.AddForeignKey( + name: "FK_Users_Houses_HouseId", + table: "Users", + column: "HouseId", + principalTable: "Houses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Users_Bans_BanId", + table: "Users", + column: "BanId", + principalTable: "Bans", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Users_Characters_CharacterId", + table: "Users", + column: "CharacterId", + principalTable: "Characters", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Bans_Users_UserId", + table: "Bans"); + + migrationBuilder.DropForeignKey( + name: "FK_Characters_Users_UserId", + table: "Characters"); + + migrationBuilder.DropForeignKey( + name: "FK_Houses_Users_OwnerId", + table: "Houses"); + + migrationBuilder.DropTable( + name: "ATMs"); + + migrationBuilder.DropTable( + name: "BankAccountTransactionLogs"); + + migrationBuilder.DropTable( + name: "Blips"); + + migrationBuilder.DropTable( + name: "BusinessBankAccounts"); + + migrationBuilder.DropTable( + name: "BusinessData"); + + migrationBuilder.DropTable( + name: "BusRoutesPoints"); + + migrationBuilder.DropTable( + name: "CharacterClothes"); + + migrationBuilder.DropTable( + name: "ClothCombinations"); + + migrationBuilder.DropTable( + name: "DeathLogs"); + + migrationBuilder.DropTable( + name: "Doors"); + + migrationBuilder.DropTable( + name: "DutyClothes"); + + migrationBuilder.DropTable( + name: "FactionBankAccounts"); + + migrationBuilder.DropTable( + name: "FactionWeapons"); + + migrationBuilder.DropTable( + name: "GotoPoints"); + + migrationBuilder.DropTable( + name: "GroupBankAccounts"); + + migrationBuilder.DropTable( + name: "HouseRentals"); + + migrationBuilder.DropTable( + name: "Interiors"); + + migrationBuilder.DropTable( + name: "Locations"); + + migrationBuilder.DropTable( + name: "Markers"); + + migrationBuilder.DropTable( + name: "News"); + + migrationBuilder.DropTable( + name: "Peds"); + + migrationBuilder.DropTable( + name: "Pickups"); + + migrationBuilder.DropTable( + name: "ShopClothes"); + + migrationBuilder.DropTable( + name: "TextLabels"); + + migrationBuilder.DropTable( + name: "TuningGarages"); + + migrationBuilder.DropTable( + name: "Turfs"); + + migrationBuilder.DropTable( + name: "UserBankAccounts"); + + migrationBuilder.DropTable( + name: "UserItems"); + + migrationBuilder.DropTable( + name: "VehicleItems"); + + migrationBuilder.DropTable( + name: "VehicleMods"); + + migrationBuilder.DropTable( + name: "WhitelistEntries"); + + migrationBuilder.DropTable( + name: "BusRoutes"); + + migrationBuilder.DropTable( + name: "ServerVehicles"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "Bans"); + + migrationBuilder.DropTable( + name: "Characters"); + + migrationBuilder.DropTable( + name: "FactionRanks"); + + migrationBuilder.DropTable( + name: "Groups"); + + migrationBuilder.DropTable( + name: "Houses"); + + migrationBuilder.DropTable( + name: "Factions"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200202153232_ShopItems.cs b/ReallifeGamemode.Database/Migrations/20200202153232_ShopItems.cs index 6029e7a1..cc56b539 100644 --- a/ReallifeGamemode.Database/Migrations/20200202153232_ShopItems.cs +++ b/ReallifeGamemode.Database/Migrations/20200202153232_ShopItems.cs @@ -3,31 +3,31 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { - public partial class ShopItems : Migration + public partial class ShopItems : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ShopItems", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ShopId = table.Column(nullable: false), - ItemId = table.Column(nullable: false), - Amount = table.Column(nullable: false), - Price = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShopItems", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ShopItems"); - } + migrationBuilder.CreateTable( + name: "ShopItems", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ShopId = table.Column(nullable: false), + ItemId = table.Column(nullable: false), + Amount = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopItems", x => x.Id); + }); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ShopItems"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200313203304_UserWeaponLicense.cs b/ReallifeGamemode.Database/Migrations/20200313203304_UserWeaponLicense.cs index c4d7d58f..a0636ff9 100644 --- a/ReallifeGamemode.Database/Migrations/20200313203304_UserWeaponLicense.cs +++ b/ReallifeGamemode.Database/Migrations/20200313203304_UserWeaponLicense.cs @@ -2,22 +2,22 @@ namespace ReallifeGamemode.Database.Migrations { - public partial class UserWeaponLicense : Migration + public partial class UserWeaponLicense : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "WeaponLicense", - table: "Users", - nullable: false, - defaultValue: false); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "WeaponLicense", - table: "Users"); - } + migrationBuilder.AddColumn( + name: "WeaponLicense", + table: "Users", + nullable: false, + defaultValue: false); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "WeaponLicense", + table: "Users"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200317192534_VehicleAddPrice.cs b/ReallifeGamemode.Database/Migrations/20200317192534_VehicleAddPrice.cs index 7ec05ec1..38ebad57 100644 --- a/ReallifeGamemode.Database/Migrations/20200317192534_VehicleAddPrice.cs +++ b/ReallifeGamemode.Database/Migrations/20200317192534_VehicleAddPrice.cs @@ -2,21 +2,21 @@ namespace ReallifeGamemode.Database.Migrations { - public partial class VehicleAddPrice : Migration + public partial class VehicleAddPrice : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UserVehicle_Price", - table: "ServerVehicles", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UserVehicle_Price", - table: "ServerVehicles"); - } + migrationBuilder.AddColumn( + name: "UserVehicle_Price", + table: "ServerVehicles", + nullable: true); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "UserVehicle_Price", + table: "ServerVehicles"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200324175347_HouseWeeklyRentalFee.cs b/ReallifeGamemode.Database/Migrations/20200324175347_HouseWeeklyRentalFee.cs index 6554a409..105f64ae 100644 --- a/ReallifeGamemode.Database/Migrations/20200324175347_HouseWeeklyRentalFee.cs +++ b/ReallifeGamemode.Database/Migrations/20200324175347_HouseWeeklyRentalFee.cs @@ -3,22 +3,22 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { - public partial class HouseWeeklyRentalFee : Migration + public partial class HouseWeeklyRentalFee : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LastRentSetTime", - table: "Houses", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LastRentSetTime", - table: "Houses"); - } + migrationBuilder.AddColumn( + name: "LastRentSetTime", + table: "Houses", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "LastRentSetTime", + table: "Houses"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.cs b/ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.cs index 11683989..e94870c8 100644 --- a/ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.cs +++ b/ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.cs @@ -3,58 +3,58 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { - public partial class HouseBankAccounts : Migration + public partial class HouseBankAccounts : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BankAccountId", - table: "Houses", - nullable: true); + migrationBuilder.AddColumn( + name: "BankAccountId", + table: "Houses", + nullable: true); - migrationBuilder.CreateTable( - name: "HouseBankAccounts", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Balance = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_HouseBankAccounts", x => x.Id); - }); + migrationBuilder.CreateTable( + name: "HouseBankAccounts", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Balance = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HouseBankAccounts", x => x.Id); + }); - migrationBuilder.CreateIndex( - name: "IX_Houses_BankAccountId", - table: "Houses", - column: "BankAccountId"); + migrationBuilder.CreateIndex( + name: "IX_Houses_BankAccountId", + table: "Houses", + column: "BankAccountId"); - migrationBuilder.AddForeignKey( - name: "FK_Houses_HouseBankAccounts_BankAccountId", - table: "Houses", - column: "BankAccountId", - principalTable: "HouseBankAccounts", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Houses_HouseBankAccounts_BankAccountId", - table: "Houses"); - - migrationBuilder.DropTable( - name: "HouseBankAccounts"); - - migrationBuilder.DropIndex( - name: "IX_Houses_BankAccountId", - table: "Houses"); - - migrationBuilder.DropColumn( - name: "BankAccountId", - table: "Houses"); - } + migrationBuilder.AddForeignKey( + name: "FK_Houses_HouseBankAccounts_BankAccountId", + table: "Houses", + column: "BankAccountId", + principalTable: "HouseBankAccounts", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Houses_HouseBankAccounts_BankAccountId", + table: "Houses"); + + migrationBuilder.DropTable( + name: "HouseBankAccounts"); + + migrationBuilder.DropIndex( + name: "IX_Houses_BankAccountId", + table: "Houses"); + + migrationBuilder.DropColumn( + name: "BankAccountId", + table: "Houses"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs index 7a2460fb..1b155512 100644 --- a/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs +++ b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs @@ -2,32 +2,32 @@ namespace ReallifeGamemode.Database.Migrations { - public partial class TurfSurplusValue : Migration + public partial class TurfSurplusValue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Surplus", - table: "Turfs", - nullable: false, - defaultValue: false); + migrationBuilder.AddColumn( + name: "Surplus", + table: "Turfs", + nullable: false, + defaultValue: false); - migrationBuilder.AddColumn( - name: "Value", - table: "Turfs", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Surplus", - table: "Turfs"); - - migrationBuilder.DropColumn( - name: "Value", - table: "Turfs"); - } + migrationBuilder.AddColumn( + name: "Value", + table: "Turfs", + nullable: false, + defaultValue: 0); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Surplus", + table: "Turfs"); + + migrationBuilder.DropColumn( + name: "Value", + table: "Turfs"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200405102619_TurfMaxValue.cs b/ReallifeGamemode.Database/Migrations/20200405102619_TurfMaxValue.cs index a332baa9..0ac59308 100644 --- a/ReallifeGamemode.Database/Migrations/20200405102619_TurfMaxValue.cs +++ b/ReallifeGamemode.Database/Migrations/20200405102619_TurfMaxValue.cs @@ -2,22 +2,22 @@ namespace ReallifeGamemode.Database.Migrations { - public partial class TurfMaxValue : Migration + public partial class TurfMaxValue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MaxValue", - table: "Turfs", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "MaxValue", - table: "Turfs"); - } + migrationBuilder.AddColumn( + name: "MaxValue", + table: "Turfs", + nullable: false, + defaultValue: 0); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "MaxValue", + table: "Turfs"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/20200407014500_PedType.Designer.cs b/ReallifeGamemode.Database/Migrations/20200407014500_PedType.Designer.cs new file mode 100644 index 00000000..969f84cb --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20200407014500_PedType.Designer.cs @@ -0,0 +1,1447 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ReallifeGamemode.Database.Models; + +namespace ReallifeGamemode.Database.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20200407014500_PedType")] + partial class PedType + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.11-servicing-32099") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Faulty"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Applied"); + + b.Property("BannedBy"); + + b.Property("Reason"); + + b.Property("UntilDateTime"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("BusinessId"); + + b.HasKey("Id"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.ToTable("BusinessBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusRouteId"); + + b.Property("Description"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BusRouteId"); + + b.ToTable("BusRoutesPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ageing"); + + b.Property("AgeingOpacity"); + + b.Property("BeardColor"); + + b.Property("Blemishes"); + + b.Property("BlemishesOpacity"); + + b.Property("Blush"); + + b.Property("BlushColor"); + + b.Property("BlushOpacity"); + + b.Property("BrowDepth"); + + b.Property("BrowHeight"); + + b.Property("CheekDepth"); + + b.Property("CheekboneHeight"); + + b.Property("CheekboneWidth"); + + b.Property("ChestHair"); + + b.Property("ChestHairColor"); + + b.Property("ChestHairOpacity"); + + b.Property("ChinDepth"); + + b.Property("ChinHeight"); + + b.Property("ChinIndent"); + + b.Property("ChinWidth"); + + b.Property("Complexion"); + + b.Property("ComplexionOpacity"); + + b.Property("EyeColor"); + + b.Property("EyeSize"); + + b.Property("EyebrowColor"); + + b.Property("Eyebrows"); + + b.Property("EyebrowsOpacity"); + + b.Property("FacialHair"); + + b.Property("FacialHairOpacity"); + + b.Property("Father"); + + b.Property("Freckles"); + + b.Property("FrecklesOpacity"); + + b.Property("Gender"); + + b.Property("Hair"); + + b.Property("HairColor"); + + b.Property("HairHighlightColor"); + + b.Property("JawShape"); + + b.Property("JawWidth"); + + b.Property("LipThickness"); + + b.Property("Lipstick"); + + b.Property("LipstickColor"); + + b.Property("LipstickOpacity"); + + b.Property("Makeup"); + + b.Property("MakeupOpacity"); + + b.Property("Mother"); + + b.Property("NeckWidth"); + + b.Property("NoseBottomHeight"); + + b.Property("NoseBridgeDepth"); + + b.Property("NoseBroken"); + + b.Property("NoseTipHeight"); + + b.Property("NoseTipLength"); + + b.Property("NoseWidth"); + + b.Property("Similarity"); + + b.Property("SkinSimilarity"); + + b.Property("SunDamage"); + + b.Property("SunDamageOpacity"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("Duty"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.Property("Texture"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CharacterClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ClothCombination", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Gender"); + + b.Property("Top"); + + b.Property("Torso"); + + b.Property("Undershirt"); + + b.HasKey("Id"); + + b.ToTable("ClothCombinations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("FactionId"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("Name"); + + b.Property("Radius"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("Doors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("FactionId"); + + b.Property("Gender"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("DutyClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("StateOwned"); + + b.Property("WeaponDealTime"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("FactionBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Order"); + + b.Property("RankName"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionRanks"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ammount"); + + b.Property("FactionId"); + + b.Property("Rank"); + + b.Property("SlotID"); + + b.Property("WeaponModel"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GotoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Description") + .HasMaxLength(32); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("GotoPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.HasKey("Id"); + + b.ToTable("GroupBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("CanRentIn"); + + b.Property("LastRentSetTime"); + + b.Property("OwnerId"); + + b.Property("Price"); + + b.Property("RentalFee"); + + b.Property("Type"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.HasIndex("OwnerId"); + + b.ToTable("Houses"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.HasKey("Id"); + + b.ToTable("HouseBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HouseId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Interior", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EnterPositionStr") + .HasColumnName("EnterPosition"); + + b.Property("ExitPositionStr") + .HasColumnName("ExitPosition"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Interiors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Heading"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("Locations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.BankAccountTransactionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Fee"); + + b.Property("MoneySent"); + + b.Property("NewReceiverBalance"); + + b.Property("NewSenderBalance"); + + b.Property("Origin") + .HasMaxLength(32); + + b.Property("Receiver") + .HasMaxLength(32); + + b.Property("ReceiverBalance"); + + b.Property("Sender") + .HasMaxLength(32); + + b.Property("SenderBalance"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.HasKey("Id"); + + b.ToTable("BankAccountTransactionLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CauseOfDeath") + .HasMaxLength(64); + + b.Property("KillerHeading"); + + b.Property("KillerId"); + + b.Property("KillerPositionX"); + + b.Property("KillerPositionY"); + + b.Property("KillerPositionZ"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.Property("VictimHeading"); + + b.Property("VictimId"); + + b.Property("VictimPositionX"); + + b.Property("VictimPositionY"); + + b.Property("VictimPositionZ"); + + b.HasKey("Id"); + + b.HasIndex("KillerId"); + + b.HasIndex("VictimId"); + + b.ToTable("DeathLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Caption"); + + b.Property("Content"); + + b.Property("Timestamp"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("News"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedBlip", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Alpha"); + + b.Property("Color"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Name"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Rotation"); + + b.Property("Scale"); + + b.Property("ShortRange"); + + b.Property("Sprite"); + + b.HasKey("Id"); + + b.ToTable("Blips"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DirectionX"); + + b.Property("DirectionY"); + + b.Property("DirectionZ"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Scale"); + + b.Property("Type"); + + b.Property("Visible"); + + b.HasKey("Id"); + + b.ToTable("Markers"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("HashModel"); + + b.Property("Heading"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("Peds"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPickup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("PositionX") + .HasMaxLength(128); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RespawnTime"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Vehicle"); + + b.HasKey("Id"); + + b.ToTable("Pickups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedTextLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Font"); + + b.Property("LOS"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Text") + .IsRequired(); + + b.HasKey("Id"); + + b.ToTable("TextLabels"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ServerVehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active") + .ValueGeneratedOnAdd() + .HasDefaultValue(true); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("DistanceDriven"); + + b.Property("Heading"); + + b.Property("Livery"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("NumberPlate") + .HasMaxLength(8); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("PrimaryColor"); + + b.Property("SecondaryColor"); + + b.Property("TankAmount"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopClothe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("ClotheId"); + + b.Property("ComponentId"); + + b.Property("Gender"); + + b.Property("Price"); + + b.Property("TypeId"); + + b.HasKey("Id"); + + b.ToTable("ShopClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Price"); + + b.Property("ShopId"); + + b.HasKey("Id"); + + b.ToTable("ShopItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("TuningGarages"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Turfs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Color"); + + b.Property("FactionId"); + + b.Property("MaxValue"); + + b.Property("Name"); + + b.Property("Owner"); + + b.Property("Range"); + + b.Property("Rotation"); + + b.Property("Surplus"); + + b.Property("Value"); + + b.Property("Vector"); + + b.Property("X"); + + b.Property("Y"); + + b.HasKey("Id"); + + b.ToTable("Turfs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AdminLevel"); + + b.Property("BanId"); + + b.Property("BankAccountId"); + + b.Property("BusinessId"); + + b.Property("CharacterId"); + + b.Property("Dead"); + + b.Property("DriverLicenseBike"); + + b.Property("DriverLicenseVehicle"); + + b.Property("Email") + .HasMaxLength(64); + + b.Property("FactionId"); + + b.Property("FactionLeader"); + + b.Property("FactionRankId"); + + b.Property("FlyingLicensePlane"); + + b.Property("GroupId"); + + b.Property("GroupRank"); + + b.Property("Handmoney"); + + b.Property("HouseId"); + + b.Property("JailTime"); + + b.Property("JobId"); + + b.Property("LogUserId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("Password") + .HasMaxLength(64); + + b.Property("PaydayTimer"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName") + .HasMaxLength(32); + + b.Property("Wage"); + + b.Property("Wanteds"); + + b.Property("WeaponLicense"); + + b.HasKey("Id"); + + b.HasIndex("BanId"); + + b.HasIndex("BankAccountId"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.HasIndex("CharacterId"); + + b.HasIndex("FactionId"); + + b.HasIndex("FactionRankId"); + + b.HasIndex("GroupId"); + + b.HasIndex("HouseId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("UserBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("VehicleId"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ModId"); + + b.Property("ServerVehicleId"); + + b.Property("Slot"); + + b.HasKey("Id"); + + b.HasIndex("ServerVehicleId", "Slot") + .IsUnique(); + + b.ToTable("VehicleMods"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("Owners"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupVehicle"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("JobId"); + + b.ToTable("JobVehicle"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + + b.ToTable("SavedVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.SchoolVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("SchoolId"); + + b.ToTable("SchoolVehicle"); + + b.HasDiscriminator().HasValue("SchoolVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("Price") + .HasColumnName("UserVehicle_Price"); + + b.Property("UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserVehicles"); + + b.HasDiscriminator().HasValue("UserVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.BusRoute", "BusRoute") + .WithMany("RoutePoints") + .HasForeignKey("BusRouteId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.FactionBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.GroupBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.HouseBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.House", "House") + .WithMany("Rentals") + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "Killer") + .WithMany() + .HasForeignKey("KillerId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Ban", "Ban") + .WithMany() + .HasForeignKey("BanId"); + + b.HasOne("ReallifeGamemode.Database.Entities.UserBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + + b.HasOne("ReallifeGamemode.Database.Entities.FactionRank", "FactionRank") + .WithMany() + .HasForeignKey("FactionRankId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("ReallifeGamemode.Database.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/20200407014500_PedType.cs b/ReallifeGamemode.Database/Migrations/20200407014500_PedType.cs new file mode 100644 index 00000000..3995794d --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20200407014500_PedType.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Database.Migrations +{ + public partial class PedType : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Type", + table: "Peds", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Type", + table: "Peds"); + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/20200408151729_UserPoints.cs b/ReallifeGamemode.Database/Migrations/20200408151729_UserPoints.cs index 3be998db..d74af285 100644 --- a/ReallifeGamemode.Database/Migrations/20200408151729_UserPoints.cs +++ b/ReallifeGamemode.Database/Migrations/20200408151729_UserPoints.cs @@ -2,22 +2,22 @@ namespace ReallifeGamemode.Database.Migrations { - public partial class UserPoints : Migration + public partial class UserPoints : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Points", - table: "Users", - nullable: false, - defaultValue: 0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Points", - table: "Users"); - } + migrationBuilder.AddColumn( + name: "Points", + table: "Users", + nullable: false, + defaultValue: 0); } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Points", + table: "Users"); + } + } } diff --git a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs index 15c97956..2f773363 100644 --- a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs @@ -1017,6 +1017,8 @@ namespace ReallifeGamemode.Database.Migrations b.Property("PositionZ") .HasColumnType("float"); + b.Property("Type"); + b.HasKey("Id"); b.ToTable("Peds"); diff --git a/ReallifeGamemode.Server.Core/Commands/CommandHandler.cs b/ReallifeGamemode.Server.Core/Commands/CommandHandler.cs index 2477a2f0..91819a84 100644 --- a/ReallifeGamemode.Server.Core/Commands/CommandHandler.cs +++ b/ReallifeGamemode.Server.Core/Commands/CommandHandler.cs @@ -33,7 +33,7 @@ namespace ReallifeGamemode.Server.Core.Commands logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command); - if(legacyCommands.Contains(command)) + if (legacyCommands.Contains(command)) { return; } diff --git a/ReallifeGamemode.Server/Business/AirplaneDealerBusiness.cs b/ReallifeGamemode.Server/Business/AirplaneDealerBusiness.cs index c19a02fc..340290a5 100644 --- a/ReallifeGamemode.Server/Business/AirplaneDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/AirplaneDealerBusiness.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { - class AirplaneDealerBusiness : CarDealerBusinessBase + internal class AirplaneDealerBusiness : CarDealerBusinessBase { - public override int Id => 7; public override string Name => "Flugzeug Shop"; @@ -22,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } public override string BankAccountName => Name; diff --git a/ReallifeGamemode.Server/Business/BeachDealerBusiness.cs b/ReallifeGamemode.Server/Business/BeachDealerBusiness.cs index d82474ed..3c9be7b0 100644 --- a/ReallifeGamemode.Server/Business/BeachDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/BeachDealerBusiness.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { - class BeachDealerBusiness : CarDealerBusinessBase + internal class BeachDealerBusiness : CarDealerBusinessBase { - public override int Id => 9; public override string Name => "Beach Shop"; @@ -22,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/BikeDealerBusiness.cs b/ReallifeGamemode.Server/Business/BikeDealerBusiness.cs index e6aa47d5..48fff290 100644 --- a/ReallifeGamemode.Server/Business/BikeDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/BikeDealerBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -21,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/BoatDealerBusiness.cs b/ReallifeGamemode.Server/Business/BoatDealerBusiness.cs index f20dd17d..4c236a67 100644 --- a/ReallifeGamemode.Server/Business/BoatDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/BoatDealerBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -21,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/BusinessBase.cs b/ReallifeGamemode.Server/Business/BusinessBase.cs index 48970ddd..2e4e8b01 100644 --- a/ReallifeGamemode.Server/Business/BusinessBase.cs +++ b/ReallifeGamemode.Server/Business/BusinessBase.cs @@ -1,11 +1,11 @@ -using GTANetworkAPI; +using System; +using System.Linq; +using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; -using System; -using System.Linq; namespace ReallifeGamemode.Server.Business { @@ -86,7 +86,6 @@ namespace ReallifeGamemode.Server.Business NAPI.Util.ConsoleOutput("Creating Bank Account for Business: " + Name); using (var dbContext = new DatabaseContext()) { - dbContext.BusinessBankAccounts.Add(new BusinessBankAccount() { BusinessId = Id, diff --git a/ReallifeGamemode.Server/Business/CarDealerBusinessBase.cs b/ReallifeGamemode.Server/Business/CarDealerBusinessBase.cs index 9323f10b..66cd65da 100644 --- a/ReallifeGamemode.Server/Business/CarDealerBusinessBase.cs +++ b/ReallifeGamemode.Server/Business/CarDealerBusinessBase.cs @@ -1,7 +1,4 @@ using GTANetworkAPI; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Business { diff --git a/ReallifeGamemode.Server/Business/HelicopterDealerBusiness.cs b/ReallifeGamemode.Server/Business/HelicopterDealerBusiness.cs index a35b90f0..0f6b0490 100644 --- a/ReallifeGamemode.Server/Business/HelicopterDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/HelicopterDealerBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -21,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/LastTrainDealerBusiness.cs b/ReallifeGamemode.Server/Business/LastTrainDealerBusiness.cs index 0c2f2c3d..d61dc49d 100644 --- a/ReallifeGamemode.Server/Business/LastTrainDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/LastTrainDealerBusiness.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { - class LastTrainDealerBusiness : CarDealerBusinessBase + internal class LastTrainDealerBusiness : CarDealerBusinessBase { - public override int Id => 10; public override string Name => "Last Train Carshop"; @@ -22,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/PremiumDeluxeMotorsportCarDealerBusiness.cs b/ReallifeGamemode.Server/Business/PremiumDeluxeMotorsportCarDealerBusiness.cs index 8af353c3..f143c95a 100644 --- a/ReallifeGamemode.Server/Business/PremiumDeluxeMotorsportCarDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/PremiumDeluxeMotorsportCarDealerBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -19,7 +16,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/SUVDealerBusiness.cs b/ReallifeGamemode.Server/Business/SUVDealerBusiness.cs index 2b83aed1..c7388457 100644 --- a/ReallifeGamemode.Server/Business/SUVDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/SUVDealerBusiness.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { - class SUVDealerBusiness : CarDealerBusinessBase + internal class SUVDealerBusiness : CarDealerBusinessBase { - public override int Id => 11; public override string Name => "SUV Carshop"; @@ -22,7 +18,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/ShopBusiness.cs b/ReallifeGamemode.Server/Business/ShopBusiness.cs index 38fa7c2e..d8f1f5cf 100644 --- a/ReallifeGamemode.Server/Business/ShopBusiness.cs +++ b/ReallifeGamemode.Server/Business/ShopBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -15,7 +12,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/TelefonBusiness.cs b/ReallifeGamemode.Server/Business/TelefonBusiness.cs index 5e87f151..f77978f5 100644 --- a/ReallifeGamemode.Server/Business/TelefonBusiness.cs +++ b/ReallifeGamemode.Server/Business/TelefonBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -15,7 +12,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Business/VapidCarDealerBusiness.cs b/ReallifeGamemode.Server/Business/VapidCarDealerBusiness.cs index a97d9961..923aa527 100644 --- a/ReallifeGamemode.Server/Business/VapidCarDealerBusiness.cs +++ b/ReallifeGamemode.Server/Business/VapidCarDealerBusiness.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Business { @@ -19,7 +16,6 @@ namespace ReallifeGamemode.Server.Business public override void Load() { - } } } diff --git a/ReallifeGamemode.Server/Classes/TempBlip.cs b/ReallifeGamemode.Server/Classes/TempBlip.cs index c5eae011..fc27c86d 100644 --- a/ReallifeGamemode.Server/Classes/TempBlip.cs +++ b/ReallifeGamemode.Server/Classes/TempBlip.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ReallifeGamemode.Server.Classes +namespace ReallifeGamemode.Server.Classes { public class TempBlip { diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 3bf7332d..0dcd1811 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1,26 +1,25 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using GTANetworkAPI; +using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Managers; -using ReallifeGamemode.Server.Inventory.Interfaces; -using ReallifeGamemode.Server.Business; -using System.Text.RegularExpressions; -using ReallifeGamemode.Server.Classes; -using ReallifeGamemode.Server.Factions.Medic; -using ReallifeGamemode.Server.Job; -using ReallifeGamemode.Server.Finance; -using ReallifeGamemode.Server.Wanted; -using Microsoft.EntityFrameworkCore; using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Database; -using ReallifeGamemode.Services; +using ReallifeGamemode.Server.Business; +using ReallifeGamemode.Server.Classes; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Factions.Medic; +using ReallifeGamemode.Server.Finance; +using ReallifeGamemode.Server.Inventory.Interfaces; +using ReallifeGamemode.Server.Job; +using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Server.Wanted; +using ReallifeGamemode.Services; /** * @overview Life of German Reallife - Admin Commands (Admin.cs) @@ -32,8 +31,8 @@ namespace ReallifeGamemode.Server.Commands { public class AdminCommands : Script { - #region Todo + [Command("eat", "~m~Benutzung: ~s~/eat [Item]")] public void CmdAdminEat(Player player, string item) { @@ -126,8 +125,10 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, msg); } - #endregion + #endregion Todo + #region ahelp + [Command("ahelp", "~m~Benutzung: ~s~/ahelp")] public void CmdAdminHelp(Player player) { @@ -143,27 +144,33 @@ namespace ReallifeGamemode.Server.Commands case AdminLevel.MAPPING: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position"); break; + case AdminLevel.ENTWICKLUNG: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position"); break; + case AdminLevel.SUPPORTER: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); break; + case AdminLevel.ADMIN: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); ChatService.SendMessage(player, "~b~ " + "/a, /countdown, /freeze, /unfreeze, /mark, /gotmark, /gotox, /up, /setdimension, /spec, /warn, /ip, /kick, /ban /unban, /slap, /takeweapon, /tov, /ghv, /factionlist, /businesslist, /joblist"); break; + case AdminLevel.ADMIN2: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); ChatService.SendMessage(player, "~b~ " + "/a, /countdown, /freeze, /unfreeze, /mark, /gotmark, /gotox, /up, /setdimension, /spec, /warn, /ip, /kick, /ban /unban, /slap, /takeweapon, /tov, /ghv, /factionlist, /businesslist, /joblist"); ChatService.SendMessage(player, "~b~ " + "/sethp, /setarmor, /arevive, /aunjail, /aclear, /clothes, /props"); break; + case AdminLevel.ADMIN3: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); ChatService.SendMessage(player, "~b~ " + "/a, /countdown, /freeze, /unfreeze, /mark, /gotmark, /gotox, /up, /setdimension, /spec, /warn, /ip, /kick, /ban /unban, /slap, /takeweapon, /tov, /ghv, /factionlist, /businesslist, /joblist"); ChatService.SendMessage(player, "~b~ " + "/sethp, /setarmor, /arevive, /aunjail, /aclear, /clothes, /props"); ChatService.SendMessage(player, "~b~ " + "/adice, /settime, /setweather, /rsetarmor, /rgiveweapon, /giveweapon, /veh, /fv, /vfix, /vdestroy, /vlivery, /vcolor, /vehsmoke, /aneon, /mod, /showtuningmenu, /rvdestroy, /vsethp"); break; + case AdminLevel.HEADADMIN: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); ChatService.SendMessage(player, "~b~ " + "/a, /countdown, /freeze, /unfreeze, /mark, /gotmark, /gotox, /up, /setdimension, /spec, /warn, /ip, /kick, /ban /unban, /slap, /takeweapon, /tov, /ghv, /factionlist, /businesslist, /joblist"); @@ -171,6 +178,7 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "~b~ " + "/adice, /settime, /setweather, /rsetarmor, /rgiveweapon, /giveweapon, /veh, /fv, /vfix, /vdestroy, /vlivery, /vcolor, /vehsmoke, /aneon, /mod, /showtuningmenu, /rvdestroy, /vsethp"); ChatService.SendMessage(player, "~b~ " + "/aspeed, /set, /setmoney, /givemoney, /sethandmoney, /givehandmoney, /paydaydrop, /setwage, /freekh, /ainvite, /makeleader, /managefactionranks, /setweaponrack, /rmweaponrack, /setweaponrank, /giveitem, /inventory, /save, /remove, /house, /setbusinessbankbalance, /reloaddors, /interior, /editmode, /setbliptemplate, /ipl, /load, /quicksavemode, /createturf, /setturf, /cancleturf, /reloadturfs, /deleteturfs, /setturfpoint"); break; + case AdminLevel.PROJEKTLEITUNG: ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position, /tsupport, /showtickets, /rc, /rc quit, /o, /pm, /dimension, /to, /gh, /clearchat, /skick"); ChatService.SendMessage(player, "~b~ " + "/a, /countdown, /freeze, /unfreeze, /mark, /gotmark, /gotox, /up, /setdimension, /spec, /warn, /ip, /kick, /ban /unban, /slap, /takeweapon, /tov, /ghv, /factionlist, /businesslist, /joblist"); @@ -181,12 +189,9 @@ namespace ReallifeGamemode.Server.Commands break; } } - } - - - #endregion + #endregion ahelp #region Mapping / Entwicklung @@ -234,9 +239,10 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "Position: X Y Z: " + player.Position + " Richtung: " + player.Heading); } + #endregion Mapping / Entwicklung - #endregion #region Support + [Command("tsupport", "~m~Benutzung: ~s~/tsupport", Alias = "ts")] public void CmdAdminTSupport(Player player) { @@ -269,12 +275,15 @@ namespace ReallifeGamemode.Server.Commands case null: player.SetSharedData("blipColor", 0); break; + case 8: player.SetSharedData("blipColor", 83); break; + case 7: player.SetSharedData("blipColor", 52); break; + case 4: player.SetSharedData("blipColor", 5); break; @@ -456,7 +465,7 @@ namespace ReallifeGamemode.Server.Commands } } - #endregion + #endregion Support #region ALevel1 @@ -501,9 +510,6 @@ namespace ReallifeGamemode.Server.Commands ChatService.BroadcastAdmin("!{#1db992}** AC " + player.Name + ":~w~ " + message, AdminLevel.ADMIN); } - - - [Command("gotolist", "~m~Benutzung: ~s~/gotolist")] //TODO Als Browser anzeigeN?? public void CmdAdminGotoList(Player player) { @@ -850,7 +856,6 @@ namespace ReallifeGamemode.Server.Commands NAPI.Entity.SetEntityVelocity(player.Vehicle, new Vector3()); } else player.Position = new Vector3(p.X, p.Y, p.Z); - } } [Command("destroyped", "~m~Benutzung: ~s~/destroyped [PedNr]")] @@ -1033,7 +1038,6 @@ namespace ReallifeGamemode.Server.Commands else player.Position = new Vector3(x, y, z); } - [Command("slap", "~m~Benutzung: ~s~/slap [Spieler] (Höhe)")] public void CmdAdminSlap(Player player, string name, int wert = 5) { @@ -1165,8 +1169,10 @@ namespace ReallifeGamemode.Server.Commands } } - #endregion + #endregion ALevel1 + #region ALevel2 + [Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Hp)")] public void CmdAdminSetHp(Player player, string name, int hp = 100) { @@ -1326,7 +1332,6 @@ namespace ReallifeGamemode.Server.Commands [Command("aclear", "~m~Benutzung: ~s~/aclear [Spieler] [Grund]", GreedyArg = true)] public void CmdFactionClear(Player player, string nameOrId, string reason) { - User user = player.GetUser(); if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN2) ?? true) { @@ -1356,12 +1361,15 @@ namespace ReallifeGamemode.Server.Commands case null: target.SetSharedData("blipColor", 0); break; + case 8: target.SetSharedData("blipColor", 83); break; + case 7: target.SetSharedData("blipColor", 52); break; + case 4: target.SetSharedData("blipColor", 5); break; @@ -1372,7 +1380,9 @@ namespace ReallifeGamemode.Server.Commands dbContext.SaveChanges(); } } - #endregion + + #endregion ALevel2 + #region ALevel3 [Command("adice", "~m~Benutzung: ~s~/adice [Zahl]")] @@ -1734,7 +1744,6 @@ namespace ReallifeGamemode.Server.Commands TimeManager.PauseTimeManager(new TimeSpan(hour, min, sec)); NAPI.World.SetTime(hour, min, sec); return; - } [Command("setweather", "~m~Benutzung: ~s~/setweather [Wetter]")] @@ -1797,7 +1806,8 @@ namespace ReallifeGamemode.Server.Commands } } - #endregion + #endregion ALevel3 + #region ALevel1337 [Command("wepmod", "~m~Benutzung: ~s~/wepmod [Variable]")] public void CmdWeaponModifier(Player player, float modifier) @@ -1815,7 +1825,6 @@ namespace ReallifeGamemode.Server.Commands public void CmdAdminGotocp(Player admin) { admin.TriggerEvent("getCP"); - } [RemoteEvent("sendCP")] @@ -1922,7 +1931,7 @@ namespace ReallifeGamemode.Server.Commands else { UserItem item = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount }; - InventoryManager.AddItemToInventory(target, item); + InventoryManager.AddItemToInventory(target, item.ItemId, item.Amount); } } @@ -1968,7 +1977,6 @@ namespace ReallifeGamemode.Server.Commands player.SendNotification("Edit-Mode ~r~deaktiviert"); player.TriggerEvent("toggleEditMode", false); } - } [Command("setbliptemplate", "~m~Benutzung: ~s~/setbliptemplate [byte COLOR] [byte ALPHA] [bool SHORTRANGE] [uint SPRITE] [float SCALE] [string NAME]", GreedyArg = true)] @@ -2108,16 +2116,18 @@ namespace ReallifeGamemode.Server.Commands case null: target.SetSharedData("blipColor", 0); break; + case 8: target.SetSharedData("blipColor", 83); break; + case 7: target.SetSharedData("blipColor", 52); break; + case 4: target.SetSharedData("blipColor", 5); break; - } dbContext.SaveChanges(); } @@ -2166,16 +2176,18 @@ namespace ReallifeGamemode.Server.Commands case null: target.SetSharedData("blipColor", 0); break; + case 8: target.SetSharedData("blipColor", 83); break; + case 7: target.SetSharedData("blipColor", 52); break; + case 4: target.SetSharedData("blipColor", 5); break; - } dbContext.SaveChanges(); @@ -2196,6 +2208,7 @@ namespace ReallifeGamemode.Server.Commands case "blip": player.TriggerEvent("saveBlip"); break; + case "goto": if (option1 == null) { @@ -2217,10 +2230,10 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "Einen Goto-Punkt mit dieser Bezeichnung gibt es schon!"); } } - } break; + case "vehicle": if (player.IsInVehicle) { @@ -2233,6 +2246,7 @@ namespace ReallifeGamemode.Server.Commands } else ChatService.SendMessage(player, "~m~Du sitzt in keinem Fahrzeug!"); break; + case "fvehicle": if (player.IsInVehicle) { @@ -2271,6 +2285,7 @@ namespace ReallifeGamemode.Server.Commands } else ChatService.SendMessage(player, "~m~Du sitzt in keinem Fahrzeug!"); break; + case "jvehicle": if (player.IsInVehicle) { @@ -2469,6 +2484,7 @@ namespace ReallifeGamemode.Server.Commands } #region loadCommand + [Command("load", "~m~Benutzung: ~s~/load [Typ = OnlineBunkers, ArcadiusBusinessCentre, MazeBankBuilding, LomBank, MazeBankWest, ClubWareHouse, SpecialLocations, GRHYacht, DHYacht, PYacht, AircraftCarrier, BridgeTC, BridgeTN, NorthYankton, ONeilsFarmB, ONeilsFarm, Morgue")] public void CmdAdminloadlocation(Player player, string typ) { @@ -2495,6 +2511,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("gr_case4_bunkerclosed"); ChatService.SendMessage(player, "~y~ Online Bunkers~s~ erfolgreich geladen!"); break; + case "ArcadiusBusinessCentre": NAPI.World.RequestIpl("ex_dt1_02_office_02b"); NAPI.World.RequestIpl("ex_dt1_02_office_02c"); @@ -2511,6 +2528,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("imp_dt1_02_modgarage"); ChatService.SendMessage(player, "~y~ Arcadius Business Centre~s~ erfolgreich geladen!"); break; + case "MazeBankBuilding": NAPI.World.RequestIpl("ex_dt1_11_office_02b"); NAPI.World.RequestIpl("ex_dt1_11_office_02c"); @@ -2527,6 +2545,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("imp_dt1_11_modgarage"); ChatService.SendMessage(player, "~y~ Maze Bank Building~s~ erfolgreich geladen!"); break; + case "LomBank": NAPI.World.RequestIpl("ex_sm_13_office_02b"); NAPI.World.RequestIpl("ex_sm_13_office_02c"); @@ -2543,6 +2562,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("imp_sm_13_modgarage"); ChatService.SendMessage(player, "~y~Lom Bank~s~ erfolgreich geladen!"); break; + case "MazeBankWest": NAPI.World.RequestIpl("ex_sm_15_office_02b"); NAPI.World.RequestIpl("ex_sm_15_office_02c"); @@ -2559,6 +2579,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("imp_sm_15_modgarage"); ChatService.SendMessage(player, "~y~Maze Bank West~s~ erfolgreich geladen!"); break; + case "ClubWareHouse": NAPI.World.RequestIpl("bkr_biker_interior_placement_interior_0_biker_dlc_int_01_milo"); NAPI.World.RequestIpl("bkr_biker_interior_placement_interior_1_biker_dlc_int_02_milo"); @@ -2574,6 +2595,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("bkr_bi_hw1_13_int"); ChatService.SendMessage(player, "~y~Clubs & Warehouses~s~ erfolgreich geladen!"); break; + case "SpecialLocations": NAPI.World.RequestIpl("cargoship"); NAPI.World.RequestIpl("sunkcargoship"); @@ -2590,6 +2612,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("FIBlobby"); ChatService.SendMessage(player, "~y~Special Locations~s~ erfolgreich geladen!"); break; + case "GRHYacht": NAPI.World.RequestIpl("gr_heist_yacht2"); NAPI.World.RequestIpl("gr_heist_yacht2_bar"); @@ -2599,6 +2622,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("gr_heist_yacht2_lounge"); ChatService.SendMessage(player, "~y~Gunrunning heist Yacht~s~ erfolgreich geladen!"); break; + case "DHYacht": NAPI.World.RequestIpl("hei_yacht_heist"); NAPI.World.RequestIpl("hei_yacht_heist_enginrm"); @@ -2610,11 +2634,13 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("hei_yacht_heist_LODLights"); ChatService.SendMessage(player, "~y~Dignity heist Yacht~s~ erfolgreich geladen!"); break; + case "PYacht": NAPI.World.RequestIpl("smboat"); NAPI.World.RequestIpl("smboat_lod"); ChatService.SendMessage(player, "~y~Party Yacht~s~ erfolgreich geladen!"); break; + case "AircraftCarrier": NAPI.World.RequestIpl("hei_carrier"); NAPI.World.RequestIpl("hei_carrier_DistantLights"); @@ -2627,16 +2653,19 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("hei_carrier_LODLights"); ChatService.SendMessage(player, "~y~Aircraft Carrier~s~ erfolgreich geladen!"); break; + case "BridgeTC": NAPI.World.RequestIpl("canyonriver01_traincrash"); NAPI.World.RequestIpl("canyonriver01_traincrash"); ChatService.SendMessage(player, "~y~Bridge Train Crash~s~ erfolgreich geladen!"); break; + case "BridgeTN": NAPI.World.RequestIpl("canyonriver01"); NAPI.World.RequestIpl("railing_start"); ChatService.SendMessage(player, "~y~Bridge Train Normal~s~ erfolgreich geladen!"); break; + case "NorthYankton": NAPI.World.RequestIpl("prologue01"); NAPI.World.RequestIpl("prologue01c"); @@ -2671,6 +2700,7 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("prologuerdb"); ChatService.SendMessage(player, "~y~North Yankton~s~ erfolgreich geladen!"); break; + case "ONeilsFarmB": NAPI.World.RequestIpl("farmint"); NAPI.World.RequestIpl("farm_burnt"); @@ -2679,21 +2709,23 @@ namespace ReallifeGamemode.Server.Commands NAPI.World.RequestIpl("des_farmhs_end_occl"); ChatService.SendMessage(player, "~y~ONeils Farm Burnt~s~ erfolgreich geladen!"); break; + case "ONeilsFarm": NAPI.World.RequestIpl("farm"); NAPI.World.RequestIpl("farm_props"); NAPI.World.RequestIpl("farm_int"); ChatService.SendMessage(player, "~y~ONeils Farm~s~ erfolgreich geladen!"); break; + case "Morgue": NAPI.World.RequestIpl("coronertrash"); NAPI.World.RequestIpl("Coroner_Int_On"); ChatService.SendMessage(player, "~y~Morgue~s~ erfolgreich geladen!"); break; } - } - #endregion + + #endregion loadCommand // [Command("managefactionranks", "~m~Benutzung: ~s~/managefactionranks [Fraktions-ID]", Alias = "mfr")] @@ -2964,7 +2996,6 @@ namespace ReallifeGamemode.Server.Commands // return; // } - //} [Command("reloaddoors", "~m~Benutzung: ~s~/reloaddoors")] @@ -3079,7 +3110,6 @@ namespace ReallifeGamemode.Server.Commands dbContext.SaveChanges(); ChatService.SendMessage(player, "Waffeneintrag bearbeitet für die Fraktion " + f.Name + ": " + weaponModel + ", SlotId: " + slotId); return; - } FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel); @@ -3105,7 +3135,6 @@ namespace ReallifeGamemode.Server.Commands } } - [Command("rmweaponrack", "~m~Benutzung: ~s~/rmweaponrack [Fraktion ID] [Waffen Model]")] public void CmdAdminRmWeaponrack(Player player, int factionID, string weaponModel) { @@ -3267,9 +3296,11 @@ namespace ReallifeGamemode.Server.Commands } player.TriggerEvent("ADMIN:Turf_CreateLeaderBlip"); } - #endregion + + #endregion ALevel1337 #region ALevel1338 + [Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")] public void CmdAdminWhitelist(Player player, string option, string scName) { @@ -3374,6 +3405,7 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(target, "~b~[ADMIN]~s~ Du wurdest durch ~y~" + player.Name + " ~s~auf Adminlevel ~y~" + target.GetUser().AdminLevel.GetName() + " ~y~(" + rank + ") ~s~gesetzt."); ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du hast ~y~" + target.Name + " ~s~auf Adminlevel ~y~" + target.GetUser().AdminLevel.GetName() + " ~y~(" + rank + ") ~s~gesetzt."); } - #endregion + + #endregion ALevel1338 } } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index 9978ecde..4a393aa2 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -1,4 +1,7 @@ -using GTANetworkAPI; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using GTANetworkAPI; using Microsoft.EntityFrameworkCore; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; @@ -6,11 +9,7 @@ using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Wanted; using ReallifeGamemode.Services; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; /** * @overview Life of German Reallife - Faction Commands (Faction.cs) @@ -20,7 +19,7 @@ using System.Text.RegularExpressions; namespace ReallifeGamemode.Server.Commands { - class FactionCommands : Script + internal class FactionCommands : Script { #region Chat Commands @@ -74,8 +73,11 @@ namespace ReallifeGamemode.Server.Commands ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned)); } } - #endregion + + #endregion Chat Commands + #region Leader Commands + [Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)] public void CmdFactionGiverank(Player player, string name, string rank) { @@ -173,8 +175,8 @@ namespace ReallifeGamemode.Server.Commands } } + #endregion Leader Commands - #endregion #region Sanitäter Commands [Command("revive", "~m~Benutzung: ~s~/revive")] @@ -297,8 +299,11 @@ namespace ReallifeGamemode.Server.Commands target.SendNotification($"Du wurdest von ~g~{player.Name} ~s~ für ~g~{price.ToMoneyString()} geheilt.", false); player.SendNotification($"Du hast ~g~{target.Name} ~s~ für {price.ToMoneyString()} geheilt.", false); } - #endregion + + #endregion Sanitäter Commands + #region Staatsfraktionen (LSPD / FBI) Commands + [Command("wanted", "~m~Benutzung: ~s~/wa(nted) [Spieler] [Anzahl] [Grund]", Alias = "wa", GreedyArg = true)] public void CmdFactionWanted(Player player, string nameOrId, int amount, string reason) { @@ -341,7 +346,6 @@ namespace ReallifeGamemode.Server.Commands [Command("clear", "~m~Benutzung: ~s~/clear [Spieler] [Grund]", GreedyArg = true)] public void CmdFactionClear(Player player, string nameOrId, string reason) { - User user = player.GetUser(); if (user == null || (user.FactionId != 1 && user.FactionId != 3)) { @@ -378,9 +382,11 @@ namespace ReallifeGamemode.Server.Commands case 8: target.SetSharedData("blipColor", 83); break; + case 7: target.SetSharedData("blipColor", 52); break; + case 4: target.SetSharedData("blipColor", 5); break; @@ -392,11 +398,6 @@ namespace ReallifeGamemode.Server.Commands } } - - - - #endregion - #region Global Fraktions Commands - #endregion + #endregion Staatsfraktionen (LSPD / FBI) Commands } } diff --git a/ReallifeGamemode.Server/Commands/GroupCommands.cs b/ReallifeGamemode.Server/Commands/GroupCommands.cs index a5495fd0..8d86b9c3 100644 --- a/ReallifeGamemode.Server/Commands/GroupCommands.cs +++ b/ReallifeGamemode.Server/Commands/GroupCommands.cs @@ -1,16 +1,14 @@ +using System.Text.RegularExpressions; using GTANetworkAPI; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Services; -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; namespace ReallifeGamemode.Server.Commands { - class GroupCommands : Script + internal class GroupCommands : Script { #region Chat Commands + [Command("gc", "~m~Benutzung: ~s~/gc [Nachricht]", GreedyArg = true)] public void CmdGroupG(Player player, string message) { @@ -26,6 +24,7 @@ namespace ReallifeGamemode.Server.Commands ChatService.BroadcastGroup(message, group); } - #endregion + + #endregion Chat Commands } } diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index 904b91a5..a9ff1cb8 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -1,17 +1,14 @@ -using GTANetworkAPI; -using ReallifeGamemode.Database; +using System; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; -using ReallifeGamemode.Server.Util; -using System; -using System.Linq; namespace ReallifeGamemode.Server.Commands { - class UserCommands : Script + internal class UserCommands : Script { [Command("dice", "~m~Benutzung: ~s~/dice")] public void CmdUserDice(Player player) diff --git a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs index 440a6670..9f5be53d 100644 --- a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs +++ b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs @@ -1,18 +1,14 @@ -using System; using System.Collections.Generic; -using System.Text; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Services; -using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.DrivingSchool { - class DrivingSchool : Script + internal class DrivingSchool : Script { private static TextLabel informationLabel; private static Marker marker; @@ -40,6 +36,7 @@ namespace ReallifeGamemode.Server.DrivingSchool { new Vector3(-813.57, -1290.37, 4.59), }.AsReadOnly(); + private readonly IReadOnlyCollection DrivingRoute = new List { //BEGIN @@ -80,12 +77,12 @@ namespace ReallifeGamemode.Server.DrivingSchool new Vector3(-617.66, -1259.34, 9.82), new Vector3(-758.35, -1285.03, 3.48), }.AsReadOnly(); + private readonly IReadOnlyCollection StopCar = new List { new Vector3(-788.66, -1278.75, 4), }.AsReadOnly(); - public static void Setup() { informationLabel = NAPI.TextLabel.CreateTextLabel("Fahrschule\n~y~Auto ~s~- $~g~2500\n~y~Motorrad ~s~- $~g~3500", new Vector3(-813.17, -1354.5, 5.14), 20.0f, 1.3f, 0, new Color(255, 255, 255)); @@ -181,7 +178,6 @@ namespace ReallifeGamemode.Server.DrivingSchool user.Position = new Vector3(-813.17, -1354.5, 4.14); } - [RemoteEvent("drivingSchoolEvent")] public void DrivingSchoolEvent(Player user, int checkpoint) { @@ -189,7 +185,6 @@ namespace ReallifeGamemode.Server.DrivingSchool { user.TriggerEvent("renderTextOnScreen", "Sollten Sie aus dem Fahrzeug aussteigen fallen Sie durch."); } - else if (checkpoint == 9) { user.TriggerEvent("renderTextOnScreen", "Fahre zwischen den Laternen Slalom."); @@ -205,8 +200,6 @@ namespace ReallifeGamemode.Server.DrivingSchool } } - - [RemoteEvent("startBikeSchool")] public void StartBikeSchool(Player client) { @@ -233,7 +226,6 @@ namespace ReallifeGamemode.Server.DrivingSchool client.TriggerEvent("waitPlayerEntersVehicle"); } - [RemoteEvent("bikeSchoolEventEnd")] public void bikeSchoolEventEnd(Player user, int checkpoint) { @@ -258,7 +250,6 @@ namespace ReallifeGamemode.Server.DrivingSchool user.Position = new Vector3(-813.17, -1354.5, 4.14); } - [RemoteEvent("bikeSchoolEvent")] public void bikeSchoolEvent(Player user, int checkpoint) { @@ -272,6 +263,5 @@ namespace ReallifeGamemode.Server.DrivingSchool CheckPointHandle.StartCheckPointRoute(user, StopBike, 5000, 1, 7, 3, true, "bikeSchoolEventEnd"); } } - } } diff --git a/ReallifeGamemode.Server/DrivingSchool/Licenses.cs b/ReallifeGamemode.Server/DrivingSchool/Licenses.cs index 1e3645f9..f666bf10 100644 --- a/ReallifeGamemode.Server/DrivingSchool/Licenses.cs +++ b/ReallifeGamemode.Server/DrivingSchool/Licenses.cs @@ -1,7 +1,4 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.DrivingSchool { @@ -19,7 +16,6 @@ namespace ReallifeGamemode.Server.DrivingSchool [JsonProperty("weaponLicense")] public bool WeaponLicense { get; set; } - public Licenses(bool CarLicense, bool BikeLicense, bool PlaneLicense, bool weaponLicense) { this.CarLicense = CarLicense; @@ -27,6 +23,5 @@ namespace ReallifeGamemode.Server.DrivingSchool this.PlaneLicense = PlaneLicense; this.WeaponLicense = weaponLicense; } - } } diff --git a/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs index 66fb1c7a..b86702a0 100644 --- a/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs +++ b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs @@ -1,18 +1,14 @@ -using System; using System.Collections.Generic; -using System.Text; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Services; -using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.DrivingSchool { - class PlaneSchool : Script + internal class PlaneSchool : Script { private static TextLabel informationLabel1; private static Marker marker1; @@ -38,16 +34,13 @@ namespace ReallifeGamemode.Server.DrivingSchool new Vector3(-869.77, -1424.05, 133), }.AsReadOnly(); - private readonly IReadOnlyCollection planeRouteEnd = new List { new Vector3(-1164.29, -2351.52, 14.88), }.AsReadOnly(); - public static void Setup() { - informationLabel1 = NAPI.TextLabel.CreateTextLabel("Flugschule\n~y~Flugschein ~s~- $~g~5000", new Vector3(-1083.96, -2476.96, 14.07), 20.0f, 1.3f, 0, new Color(255, 255, 255)); marker1 = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1083.96, -2476.96, 13.07), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255)); @@ -56,6 +49,7 @@ namespace ReallifeGamemode.Server.DrivingSchool _colShape1.OnEntityExitColShape += EntityExitBusinessColShape; NAPI.Blip.CreateBlip(90, new Vector3(-1083.96, -2476.96, 14.07), 1.0f, 4, "Flugschule", shortRange: true); } + private static void EntityEnterBusinessColShape(ColShape colShape, Player client) { if (client.IsInVehicle || !client.IsLoggedIn()) return; @@ -132,6 +126,7 @@ namespace ReallifeGamemode.Server.DrivingSchool user.ResetData("ActiveSchool"); user.Position = new Vector3(-1083.96, -2476.96, 13.07); } + [RemoteEvent("planeSchoolEvent")] public void planeSchoolEvent(Player user, int checkpoint) { @@ -177,11 +172,7 @@ namespace ReallifeGamemode.Server.DrivingSchool user.TriggerEvent("renderTextOnScreen", "Setze zum landeflug an. Drücke 'G' um ihr Fahrwerk auszufahren."); CheckPointHandle.StartCheckPointRoute(user, planeRouteEnd, 5000, 6, 12, 5, true, "planeSchoolEventEnd"); break; - - } } - - } } diff --git a/ReallifeGamemode.Server/Events/Chat.cs b/ReallifeGamemode.Server/Events/Chat.cs index d21c355a..38c7d99e 100644 --- a/ReallifeGamemode.Server/Events/Chat.cs +++ b/ReallifeGamemode.Server/Events/Chat.cs @@ -1,6 +1,6 @@ +using System.Text.RegularExpressions; using GTANetworkAPI; using ReallifeGamemode.Server.Services; -using System.Text.RegularExpressions; namespace ReallifeGamemode.Server.Events { @@ -13,7 +13,7 @@ namespace ReallifeGamemode.Server.Events if (serverMsg.Trim().Length == 0) return; NAPI.Player.GetPlayersInRadiusOfPlayer(10, player).ForEach(p => { - ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}");// + ChatService.SendMessage(p, $"{player.Name} sagt: {serverMsg}"); }); } } diff --git a/ReallifeGamemode.Server/Events/Connect.cs b/ReallifeGamemode.Server/Events/Connect.cs index cf313dff..8dfb7313 100644 --- a/ReallifeGamemode.Server/Events/Connect.cs +++ b/ReallifeGamemode.Server/Events/Connect.cs @@ -1,13 +1,10 @@ using System; using System.Linq; using GTANetworkAPI; -using ReallifeGamemode.Database; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Wanted; /** * @overview Life of German Reallife - Event Login (Login.cs) @@ -17,7 +14,7 @@ using ReallifeGamemode.Server.Wanted; namespace ReallifeGamemode.Server.Events { - class Connect : Script + internal class Connect : Script { private readonly TimeSpan LightModeTimeFrom = new TimeSpan(5, 30, 0); private readonly TimeSpan LightModeTimeTo = new TimeSpan(21, 00, 0); diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index e079e2b0..0d919c1e 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -1,13 +1,16 @@ using System; +using System.Collections.Generic; +using System.Linq; using GTANetworkAPI; -using ReallifeGamemode.Database; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Factions.Medic; +using ReallifeGamemode.Server.Inventory; +using ReallifeGamemode.Server.Inventory.Interfaces; +using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; -using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Wanted; /** @@ -66,7 +69,6 @@ namespace ReallifeGamemode.Server.Events User user = player.GetUser(); if (user.JailTime <= 0) { - //MEDIC AUFTRAG MedicTask reviveTask = new MedicTask() { @@ -92,8 +94,35 @@ namespace ReallifeGamemode.Server.Events //TODO PICTURE NOTIFICATION + SOUND für Medics + player.ClearAttachments(); + using (var userDeath = new DatabaseContext()) { + List fItem = userDeath.UserItems.Where(u => u.UserId == user.Id).ToList(); + foreach (var item in fItem) + { + IItem iItem = InventoryManager.GetItemById(item.ItemId); + if (iItem is IWeaponDealItem obj) + { + int amount = item.Amount; + + Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0); + //new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f); + Random r = new Random(); + GTANetworkAPI.Object grndObject; + Vector3 textPos = dropPosition; + + dropPosition.Z -= 1.05f; + grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0); + + GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition }; + TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0); + GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl); + + userDeath.Remove(item); + } + } + var dead = new Database.Entities.Logs.Death { VictimId = player.GetUser().Id, @@ -167,7 +196,6 @@ namespace ReallifeGamemode.Server.Events Jail.Check_PutBehindBars(player); } - [RemoteEvent("RespawnPlayerAtHospital")] public void RespawnPlayerAtHospital(Player player) { diff --git a/ReallifeGamemode.Server/Events/Disconnect.cs b/ReallifeGamemode.Server/Events/Disconnect.cs index e5a8c9e9..77bc9238 100644 --- a/ReallifeGamemode.Server/Events/Disconnect.cs +++ b/ReallifeGamemode.Server/Events/Disconnect.cs @@ -12,8 +12,8 @@ using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Util; using ReallifeGamemode.Services; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Database; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; /** diff --git a/ReallifeGamemode.Server/Events/EnterVehicle.cs b/ReallifeGamemode.Server/Events/EnterVehicle.cs index 224f3532..25c2f5aa 100644 --- a/ReallifeGamemode.Server/Events/EnterVehicle.cs +++ b/ReallifeGamemode.Server/Events/EnterVehicle.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; @@ -19,17 +17,17 @@ namespace ReallifeGamemode.Server.Events return; } + if (vehicle.HasMarkerBehind()) + vehicle.RemoveMarkerBehind(); + if (vehicle.GetServerVehicle() is FactionVehicle veh) { User u = client.GetUser(); if (u.FactionId != null && veh.GetOwners().Contains(u.FactionId.Value) && (veh.Model == VehicleHash.Burrito3) && vehicle.HasData("weaponDeal") && vehicle.GetData("weaponDeal") == true) { - Vector3 vector = WeaponDealPoints.getRndWD_Route(client.GetUser().FactionId.Value); - if (vector == new Vector3()) - return; List dealPoint = new List(); - dealPoint.Add(vector); - CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, 4, true, "loadWeaponTransport"); + dealPoint.Add(vehicle.GetData("weaponDealPoint")); + CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, "loadWeaponTransport"); } } } diff --git a/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs b/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs index 881718db..f01507b1 100644 --- a/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs +++ b/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs @@ -12,7 +12,6 @@ using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Events { - public class EnterVehicleAttempt : Script { public static GTANetworkAPI.Vehicle Roller; diff --git a/ReallifeGamemode.Server/Events/ExitVehicle.cs b/ReallifeGamemode.Server/Events/ExitVehicle.cs index c1ed5014..37806165 100644 --- a/ReallifeGamemode.Server/Events/ExitVehicle.cs +++ b/ReallifeGamemode.Server/Events/ExitVehicle.cs @@ -8,7 +8,6 @@ using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.WeaponDeal; namespace ReallifeGamemode.Server.Events { @@ -22,6 +21,7 @@ namespace ReallifeGamemode.Server.Events LastVehicle = vehicle; if (client.VehicleSeat != 0) return; + if (vehicle.GetServerVehicle() is FactionVehicle veh) { User u = client.GetUser(); @@ -30,6 +30,10 @@ namespace ReallifeGamemode.Server.Events CheckPointHandle.RemovePlayerHandlerFromList(client); client.TriggerEvent("destroyCP"); } + else if ((u.FactionId != null) && (veh.GetOwners().Contains(u.FactionId ?? 0)) && ((VehicleHash)vehicle.Model == VehicleHash.Burrito3 || (VehicleHash)vehicle.Model == VehicleHash.Policet) && vehicle.HasData("WeaponDealLoad") && vehicle.GetData("WeaponDealLoad") == true) + { + client.TriggerEvent("SERVER:setMarkerBehindVehicle", vehicle); + } } if (vehicle.GetServerVehicle() is SchoolVehicle vehS) { diff --git a/ReallifeGamemode.Server/Events/Faction.cs b/ReallifeGamemode.Server/Events/Faction.cs index 82c38dd3..a2f41ea5 100644 --- a/ReallifeGamemode.Server/Events/Faction.cs +++ b/ReallifeGamemode.Server/Events/Faction.cs @@ -1,15 +1,15 @@ +using System.Collections.Generic; +using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; -using System.Collections.Generic; -using System.Linq; namespace ReallifeGamemode.Server.Events { - class Faction : Script + internal class Faction : Script { [RemoteEvent("OnFactionRanksEdit")] public void OnFactionRanksEdit(Player player, string jsonData) diff --git a/ReallifeGamemode.Server/Events/Inventory.cs b/ReallifeGamemode.Server/Events/Inventory.cs index 74ba2019..2e881764 100644 --- a/ReallifeGamemode.Server/Events/Inventory.cs +++ b/ReallifeGamemode.Server/Events/Inventory.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; @@ -61,7 +59,6 @@ namespace ReallifeGamemode.Server.Events iName.Add(iItem.Name); iAmount.Add(vehItem.Amount); iId.Add(iItem.Id); - } var vehInv = new VehicleInventory { @@ -76,6 +73,5 @@ namespace ReallifeGamemode.Server.Events } return vehicleInventory; } - } } diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 2de03984..21eb163c 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -2,21 +2,21 @@ using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; -using ReallifeGamemode.Server.Classes; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Classes; +using ReallifeGamemode.Server.DrivingSchool; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Inventory; +using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Database; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Inventory.Interfaces; -using ReallifeGamemode.Server.DrivingSchool; using ReallifeGamemode.Server.Types; -using Microsoft.EntityFrameworkCore; +using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Server.WeaponDeal; + /** * @overview Life of German Reallife - Event Key (Key.cs) * @author VegaZ @@ -47,6 +47,7 @@ namespace ReallifeGamemode.Server.Events tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString()); player.SendNotification("~y~Blip~s~ erstellt!", false); break; + case "atm": SaveManager.OnSaveBlipData(player, "500", "Geldautomat", 0.7.ToString(), "11", "0", "200", true.ToString(), 0.ToString(), 0.ToString()); @@ -182,20 +183,73 @@ namespace ReallifeGamemode.Server.Events if (!player.IsLoggedIn()) return; var user = player.GetUser(); - ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3)); - ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && (!user.GetData("duty"))); - - ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6); - JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6); if (user?.FactionId != null) { - DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.6 && d.FactionId == user.FactionId); - WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.6 && w.FactionId == user.FactionId); - JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData("duty")); + DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); + WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId); + JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData("duty")); + ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3)); + ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData("duty"))); + ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); + BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && (user.FactionId == 8 || user.FactionId == 7 || user.FactionId == 1 || user.FactionId == 3)); + if (nearestBehindVehiclePoint != null) + { + if (player.HasAttachment("ammobox")) return; + using (var dbContext = new DatabaseContext()) + { + List vehicleItems = dbContext.VehicleItems.Where(f => f.GetVehicle().GetVehicle() == nearestBehindVehiclePoint.vehicle && InventoryManager.GetItemById(f.ItemId) is IWeaponDealItem).ToList(); + if (vehicleItems.Count == 0) + { + GTANetworkAPI.Vehicle vehicle = nearestBehindVehiclePoint.vehicle; - if (nearestDuty != null && !player.IsInVehicle)// Duty Point + if (WeaponDealManager.checkWeaponDbyVehicle(vehicle)) + { + vehicle.ResetData("WeaponDealLoad"); + } + + nearestBehindVehiclePoint.vehicle.RemoveMarkerBehind(); + + return; + } + foreach (var v in vehicleItems) + { + int itemToAdd = 0; + for (int i = 1; i <= v.Amount; i++) + { + if (InventoryManager.GetUserInventoryWeight(player) + (i * InventoryManager.GetItemById(v.ItemId).Gewicht) > 40000) + { + break; + } + else + { + itemToAdd = i; + } + } + if (itemToAdd == 0) + break; + + v.Amount -= itemToAdd; + if (v.Amount <= 0) + dbContext.VehicleItems.Remove(v); + + var newItem = new UserItem() + { + ItemId = v.ItemId, + Slot = v.Slot, + Amount = itemToAdd, + UserId = user.Id, + }; + + InventoryManager.AddItemToInventory(player, newItem.Id, newItem.Amount); + nearestBehindVehiclePoint.usePoint(player); + dbContext.SaveChanges(); + return; + } + } + } + if (nearestDuty != null)// Duty Point { var nameTagColor = new Color(0, 0, 0); var factionId = user.FactionId; @@ -275,7 +329,6 @@ namespace ReallifeGamemode.Server.Events if (nearestWeapon != null) // Weapon Point { - List primarys = new List(); List secondarys = new List(); List melees = new List(); @@ -287,10 +340,14 @@ namespace ReallifeGamemode.Server.Events melees.Add("Keine"); specials.Add("Keine"); - - using (var context = new DatabaseContext()) { + if (player.HasAttachment("ammobox")) + { + player.AddAttachment("ammobox", true); + player.StopAnimation(); + } + bool unloadedWeaponPackage = false; List fItem = context.UserItems.Where(u => u.UserId == user.Id).ToList(); @@ -301,7 +358,11 @@ namespace ReallifeGamemode.Server.Events { FactionWeapon weapon = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == iItem.Name).FirstOrDefault(); if (weapon == null) + { + context.Remove(item); continue; + } + weapon.Ammount += item.Amount; ChatService.SendMessage(player, item.Amount + " " + iItem.Name + " wurden im Waffenlager hinzugefürgt."); context.Remove(item); @@ -332,14 +393,17 @@ namespace ReallifeGamemode.Server.Events if (user.FactionRank.Order >= weapon.Rank) primarys.Add(weapon.WeaponModel.ToString()); break; + case 2: if (user.FactionRank.Order >= weapon.Rank) secondarys.Add(weapon.WeaponModel.ToString()); break; + case 3: if (user.FactionRank.Order >= weapon.Rank) melees.Add(weapon.WeaponModel.ToString()); break; + case 4: if (user.FactionRank.Order >= weapon.Rank) specials.Add(weapon.WeaponModel.ToString()); @@ -452,7 +516,8 @@ namespace ReallifeGamemode.Server.Events public void KeyPressI(Player player) { if (!player.IsLoggedIn()) return; - InventoryManager.GetUserItems(player); + player.TriggerEvent("inventoryShow"); + InventoryManager.SetBackpackItems(player); } [RemoteEvent("keyPress:O")] @@ -507,9 +572,11 @@ namespace ReallifeGamemode.Server.Events case 11: tops.Add(cloth.ClothId.ToString()); break; + case 4: legs.Add(cloth.ClothId.ToString()); break; + case 6: shoes.Add(cloth.ClothId.ToString()); break; @@ -519,7 +586,6 @@ namespace ReallifeGamemode.Server.Events player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray()); } } - } [RemoteEvent("keyPress:L")] @@ -693,7 +759,6 @@ namespace ReallifeGamemode.Server.Events if (!player.IsInVehicle) { - Vehicle.VehicleMenuLockCarEvent(player); GroundItem.PickUpGroundItem(player); diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 936a89ee..1791fd23 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -1,16 +1,14 @@ using System.Linq; using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Managers; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Server.Types; using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Wanted; -using ReallifeGamemode.Database; -using ReallifeGamemode.Server.Types; -using ReallifeGamemode.Database.Entities; -using Newtonsoft.Json; /** * @overview Life of German Reallife - Event Login (Login.cs) @@ -102,12 +100,15 @@ namespace ReallifeGamemode.Server.Events case null: player.SetSharedData("blipColor", 0); break; + case 8: player.SetSharedData("blipColor", 83); break; + case 7: player.SetSharedData("blipColor", 52); break; + case 4: player.SetSharedData("blipColor", 5); break; diff --git a/ReallifeGamemode.Server/Events/Register.cs b/ReallifeGamemode.Server/Events/Register.cs index f1bd00a8..24c29b27 100644 --- a/ReallifeGamemode.Server/Events/Register.cs +++ b/ReallifeGamemode.Server/Events/Register.cs @@ -1,6 +1,5 @@ using System.Linq; using GTANetworkAPI; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Database.Entities; using Newtonsoft.Json; @@ -12,7 +11,7 @@ using Newtonsoft.Json; namespace ReallifeGamemode.Server.Events { - class Register : Script + internal class Register : Script { [RemoteEvent("CLIENT:Login_RegisterRequest")] public void OnPlayerRegister(Player player, string password) diff --git a/ReallifeGamemode.Server/Events/ResourceStop.cs b/ReallifeGamemode.Server/Events/ResourceStop.cs index 64813d96..78d82b25 100644 --- a/ReallifeGamemode.Server/Events/ResourceStop.cs +++ b/ReallifeGamemode.Server/Events/ResourceStop.cs @@ -1,4 +1,5 @@ -using GTANetworkAPI; +using System.Linq; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; diff --git a/ReallifeGamemode.Server/Events/Siren.cs b/ReallifeGamemode.Server/Events/Siren.cs index 79572e6c..75e3f199 100644 --- a/ReallifeGamemode.Server/Events/Siren.cs +++ b/ReallifeGamemode.Server/Events/Siren.cs @@ -1,11 +1,9 @@ -using GTANetworkAPI; -using System; using System.Collections.Generic; -using System.Text; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Events { - class Siren : Script + internal class Siren : Script { private readonly Dictionary _sirenStates = new Dictionary(); @@ -21,7 +19,6 @@ namespace ReallifeGamemode.Server.Events pV.SetSharedData("sirenSound", newValue); NAPI.ClientEvent.TriggerClientEventForAll("toggleVehicleSiren", pV, newValue); - } } } diff --git a/ReallifeGamemode.Server/Events/UpdateCharacterCloth.cs b/ReallifeGamemode.Server/Events/UpdateCharacterCloth.cs index f17f68c1..0b5035b0 100644 --- a/ReallifeGamemode.Server/Events/UpdateCharacterCloth.cs +++ b/ReallifeGamemode.Server/Events/UpdateCharacterCloth.cs @@ -198,7 +198,6 @@ namespace ReallifeGamemode.Server.Events } using (var dbContext = new DatabaseContext()) { - var clothes = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == data[0] && c.Duty == false); if (clothes == null) @@ -265,7 +264,6 @@ namespace ReallifeGamemode.Server.Events client.GetUser(dbContext).Handmoney -= data[6]; dbContext.SaveChanges(); client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney); - } client.TriggerEvent("clothesMenu:updateLast", data[2], data[1], data[4], data[5], data[3]); } diff --git a/ReallifeGamemode.Server/Events/UpdateCharacterElevator.cs b/ReallifeGamemode.Server/Events/UpdateCharacterElevator.cs index 36a6b31d..7015bb25 100644 --- a/ReallifeGamemode.Server/Events/UpdateCharacterElevator.cs +++ b/ReallifeGamemode.Server/Events/UpdateCharacterElevator.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Server.Managers; - namespace ReallifeGamemode.Server.Events { public class UpdateCharacterElevator : Script diff --git a/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs b/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs index 20f2b393..af29a00d 100644 --- a/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs +++ b/ReallifeGamemode.Server/Events/UpdateCharacterWeapon.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; @@ -48,7 +47,6 @@ namespace ReallifeGamemode.Server.Events client.RemoveAllWeapons(); } - [RemoteEvent("saveWeaponSelection")] public void SaveWeaponSelection(Player client, string primaryModel, string secondaryModel, string meleeModel, string specialModel) { @@ -69,7 +67,6 @@ namespace ReallifeGamemode.Server.Events melee = NAPI.Util.GetHashKey($"weapon_{meleeModel}"); } - client.GiveWeapon((WeaponHash)primary, 50); client.GiveWeapon((WeaponHash)secondary, 150); client.GiveWeapon((WeaponHash)melee, 1); diff --git a/ReallifeGamemode.Server/Events/Vehicle.cs b/ReallifeGamemode.Server/Events/Vehicle.cs index 7d9d5582..eb197c89 100644 --- a/ReallifeGamemode.Server/Events/Vehicle.cs +++ b/ReallifeGamemode.Server/Events/Vehicle.cs @@ -1,11 +1,10 @@ +using System; using GTANetworkAPI; -using ReallifeGamemode.Database; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Types; using ReallifeGamemode.Server.Util; -using System; namespace ReallifeGamemode.Server.Events { @@ -175,7 +174,6 @@ namespace ReallifeGamemode.Server.Events msg += state ? "~g~abgeschlossen" : "~r~aufgeschlossen"; player.TriggerEvent("vehsync:OpenCar", state); player.SendNotification(msg); - } } @@ -280,7 +278,5 @@ namespace ReallifeGamemode.Server.Events VehicleStreaming.SetDoorState(veh, doorId, DoorState.DoorClosed); } } - - } } diff --git a/ReallifeGamemode.Server/Events/Voice.cs b/ReallifeGamemode.Server/Events/Voice.cs index 391b2870..871474f2 100644 --- a/ReallifeGamemode.Server/Events/Voice.cs +++ b/ReallifeGamemode.Server/Events/Voice.cs @@ -8,7 +8,7 @@ using GTANetworkAPI; namespace ReallifeGamemode.Server.Events { - class Voice : Script + internal class Voice : Script { [RemoteEvent("CLIENT:AddVoiceListener")] public void AddPlayerVoiceListenerEvent(Player player, Player target) diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index c9769b17..d9a1eadb 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -1,12 +1,12 @@ -using GTANetworkAPI; +using System; +using System.Collections.Generic; +using System.Linq; +using GTANetworkAPI; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; -using System; -using System.Collections.Generic; -using System.Linq; /** * @overview Life of German Reallife - Player Extension (PlayerExtension.cs) diff --git a/ReallifeGamemode.Server/Extensions/EnumExtensions.cs b/ReallifeGamemode.Server/Extensions/EnumExtensions.cs index 4c606304..01412e79 100644 --- a/ReallifeGamemode.Server/Extensions/EnumExtensions.cs +++ b/ReallifeGamemode.Server/Extensions/EnumExtensions.cs @@ -1,8 +1,3 @@ -using ReallifeGamemode.Server.Util; -using System; -using System.Collections.Generic; -using System.Text; -using ReallifeGamemode.Database; using ReallifeGamemode.Server.Types; using static ReallifeGamemode.Server.Types.AdminLevel; @@ -21,18 +16,24 @@ namespace ReallifeGamemode.Server.Extensions { case MAPPING: return "Mapper"; + case ENTWICKLUNG: return "Entwickler"; + case SUPPORTER: return "Supporter"; + case ADMIN: case ADMIN2: case ADMIN3: return "Admin"; + case HEADADMIN: return "Headadmin"; + case PROJEKTLEITUNG: return "Projektleiter"; + default: return "Spieler"; } @@ -44,10 +45,13 @@ namespace ReallifeGamemode.Server.Extensions { case GroupRank.OWNER: return "Besitzer"; + case GroupRank.MANAGER: return "Manager"; + case GroupRank.MEMBER: return "Mitglied"; + default: return "Keiner"; } diff --git a/ReallifeGamemode.Server/Extensions/HouseExtensions.cs b/ReallifeGamemode.Server/Extensions/HouseExtensions.cs index 480b2b6d..58bb2341 100644 --- a/ReallifeGamemode.Server/Extensions/HouseExtensions.cs +++ b/ReallifeGamemode.Server/Extensions/HouseExtensions.cs @@ -1,11 +1,11 @@ +using System.Linq; using Microsoft.EntityFrameworkCore; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; -using System.Linq; namespace ReallifeGamemode.Server.Extensions { - static class HouseExtensions + internal static class HouseExtensions { public static House Refresh(this House house) { diff --git a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs index 754df8a0..2e8dd657 100644 --- a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs +++ b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace ReallifeGamemode.Server.Extensions { public static class IntegerExtension @@ -10,6 +6,7 @@ namespace ReallifeGamemode.Server.Extensions { return ToMoneyString(money ?? 0); } + public static string ToMoneyString(this int money) { return "$" + string.Format(Main.SERVER_CULTURE, "{0:C0}", money).Replace("€", "").Trim(); diff --git a/ReallifeGamemode.Server/Extensions/ListExtensions.cs b/ReallifeGamemode.Server/Extensions/ListExtensions.cs index 3a3bd4f2..a380ea0f 100644 --- a/ReallifeGamemode.Server/Extensions/ListExtensions.cs +++ b/ReallifeGamemode.Server/Extensions/ListExtensions.cs @@ -1,12 +1,10 @@ -using GTANetworkAPI; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Extensions { - static class ListExtensions + internal static class ListExtensions { public static bool Contains(this List list, Player client) { diff --git a/ReallifeGamemode.Server/Extensions/ServerVehicleExtensions.cs b/ReallifeGamemode.Server/Extensions/ServerVehicleExtensions.cs index 6bb7df35..faf9c0a0 100644 --- a/ReallifeGamemode.Server/Extensions/ServerVehicleExtensions.cs +++ b/ReallifeGamemode.Server/Extensions/ServerVehicleExtensions.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Job; diff --git a/ReallifeGamemode.Server/Extensions/VehicleExtension.cs b/ReallifeGamemode.Server/Extensions/VehicleExtension.cs index 99792dcd..8880ac26 100644 --- a/ReallifeGamemode.Server/Extensions/VehicleExtension.cs +++ b/ReallifeGamemode.Server/Extensions/VehicleExtension.cs @@ -1,8 +1,8 @@ -using GTANetworkAPI; +using System.Linq; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Managers; -using System.Linq; namespace ReallifeGamemode.Server.Extensions { diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index c1357256..3dd8a1ff 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using GTANetworkAPI; using Newtonsoft.Json; -using ReallifeGamemode.Server.Services; /** * @overview Life of German Reallife - Server Factions Medic Medic.cs @@ -11,7 +8,6 @@ using ReallifeGamemode.Server.Services; * @copyright (c) 2008 - 2018 Life of German */ - namespace ReallifeGamemode.Server.Factions.Medic { public class Medic : Script @@ -32,9 +28,11 @@ namespace ReallifeGamemode.Server.Factions.Medic case MedicTaskType.REVIVE: ReviveTasks.Add(task); break; + case MedicTaskType.HEAL: HealTasks.Add(task); break; + case MedicTaskType.FIRE: FireTasks.Add(task); break; @@ -53,14 +51,17 @@ namespace ReallifeGamemode.Server.Factions.Medic case MedicTaskType.REVIVE: ReviveTasks.Remove(task); break; + case MedicTaskType.HEAL: HealTasks.Remove(task); break; + case MedicTaskType.FIRE: FireTasks.Remove(task); break; } } + [RemoteEvent("loadMedicTasks")] public void LoadMedicTasks(Player player, int type) { @@ -69,14 +70,17 @@ namespace ReallifeGamemode.Server.Factions.Medic case 0: player.TriggerEvent("showMedicTasks", 0, JsonConvert.SerializeObject(ReviveTasks)); break; + case 1: player.TriggerEvent("showMedicTasks", 1, JsonConvert.SerializeObject(HealTasks)); break; + case 2: player.TriggerEvent("showMedicTasks", 2, JsonConvert.SerializeObject(FireTasks)); break; } } + [RemoteEvent("updateMedicTask")] public void UpdateMedicTasks(Player player, int type, int index, string medicName) { @@ -85,9 +89,11 @@ namespace ReallifeGamemode.Server.Factions.Medic case 0: ReviveTasks[index].MedicName = medicName; break; + case 1: HealTasks[index].MedicName = medicName; break; + case 2: FireTasks[index].MedicName = medicName; break; diff --git a/ReallifeGamemode.Server/Factions/Medic/MedicTask.cs b/ReallifeGamemode.Server/Factions/Medic/MedicTask.cs index 5f5365ed..50c0f2a8 100644 --- a/ReallifeGamemode.Server/Factions/Medic/MedicTask.cs +++ b/ReallifeGamemode.Server/Factions/Medic/MedicTask.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using GTANetworkAPI; /** @@ -9,7 +7,6 @@ using GTANetworkAPI; * @copyright (c) 2008 - 2018 Life of German */ - namespace ReallifeGamemode.Server.Factions.Medic { public class MedicTask diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index fa26d49a..7c5d9009 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -1,19 +1,18 @@ -/*** -@overview Life of German - Economy +/*** +@overview Life of German - Economy @author kookroach -@copyright (c) 2008 - 2019 Life of German +@copyright (c) 2008 - 2019 Life of German */ - using System; using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Services; using Newtonsoft.Json; using ReallifeGamemode.Server.Wanted; @@ -53,7 +52,6 @@ namespace ReallifeGamemode.Server.Finance } vehicleTaxation += (int)(uVeh.Price * 0.005f); } - } return vehicleTaxation; } @@ -86,7 +84,6 @@ namespace ReallifeGamemode.Server.Finance healthInsurance = 0; } - int? factionMoney = null; if (user.Faction != null && user.FactionRank != null) diff --git a/ReallifeGamemode.Server/Finance/Paycheck.cs b/ReallifeGamemode.Server/Finance/Paycheck.cs index 9a6059a0..3f96b286 100644 --- a/ReallifeGamemode.Server/Finance/Paycheck.cs +++ b/ReallifeGamemode.Server/Finance/Paycheck.cs @@ -1,13 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using GTANetworkAPI; -using Newtonsoft.Json; -using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Services; +using Newtonsoft.Json; namespace ReallifeGamemode.Server.Finance { diff --git a/ReallifeGamemode.Server/Gangwar/Gangwar.cs b/ReallifeGamemode.Server/Gangwar/Gangwar.cs index 4bfcc2a6..08115ea8 100644 --- a/ReallifeGamemode.Server/Gangwar/Gangwar.cs +++ b/ReallifeGamemode.Server/Gangwar/Gangwar.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; @@ -207,14 +206,14 @@ namespace ReallifeGamemode.Server.Gangwar { foreach (var turf in getTurfs()) { - if((turf.getValue() + 5) >= turf.getMaxValue()) + if ((turf.getValue() + 5) >= turf.getMaxValue()) { turf.setValue(turf.getMaxValue()); } else - { + { turf.addValue(5); - } + } values.Add(turf.getValue()); Turfs _turf = dbContext.Turfs.Where(t => t.Id == turf.getId()).FirstOrDefault(); _turf.Value = turf.getValue(); diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 957168c7..8828a401 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -1,21 +1,19 @@ using System; using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; -using System.Timers; using System.Linq; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Services; -using Newtonsoft.Json; +using System.Timers; +using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Services; namespace ReallifeGamemode.Server.Gangwar { public class Turf { - public int TurfID { get; set; } public string TurfName { get; set; } public int Color { get; set; } @@ -32,8 +30,7 @@ namespace ReallifeGamemode.Server.Gangwar public Player[] playerInGangwar { get; set; } public int timerCount; - - public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue,bool surplus) + public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue, bool surplus) { this.TurfID = TurfID; this.TurfName = TurfName; @@ -124,11 +121,10 @@ namespace ReallifeGamemode.Server.Gangwar } } - - private void update() { #region Ticket system + /* try { @@ -151,7 +147,9 @@ namespace ReallifeGamemode.Server.Gangwar if(owners.Length < attackers.Length) this.Def_Score -= attackers.Length - owners.Length; */ - #endregion + + #endregion Ticket system + foreach (Player gangwarPlayer in this.playerInGangwar) { gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score); @@ -276,7 +274,6 @@ namespace ReallifeGamemode.Server.Gangwar turf.FactionId = dbContext.Factions.Where(f => f.Name == this.Owner).FirstOrDefault().Id; dbContext.SaveChanges(); } - } this.Attacker = null; foreach (var c in playerInGangwar) @@ -303,15 +300,14 @@ namespace ReallifeGamemode.Server.Gangwar if (ownersInGangwar.Count < 1 && attackersInGangwar.Count < 1) { List leaders = context.Users.Include(u => u.Faction).Where(u => onlinePlayers.Contains(u.Name) && u.Faction.Name == attacker && u.FactionLeader).Select(u => u.Player).ToList(); - foreach(var l in leaders) + foreach (var l in leaders) { ChatService.ErrorMessage(l, "Gangwarstart ist nicht möglich, da die beteiligten Fraktionen nicht genügend Mitglieder aufweisen."); } - + return; } List inGangwar = new List(ownersInGangwar.Concat(attackersInGangwar)); - usersInGangwar = inGangwar.ToArray(); } diff --git a/ReallifeGamemode.Server/Inventory/GroundItem.cs b/ReallifeGamemode.Server/Inventory/GroundItem.cs index e199c7db..0fe1033c 100644 --- a/ReallifeGamemode.Server/Inventory/GroundItem.cs +++ b/ReallifeGamemode.Server/Inventory/GroundItem.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; +using System.Linq; using GTANetworkAPI; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Managers; -using System.Linq; -using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Database.Models; namespace ReallifeGamemode.Server.Inventory { @@ -34,10 +34,12 @@ namespace ReallifeGamemode.Server.Inventory var invWeight = InventoryManager.GetUserInventoryWeight(player); var itemsToAdd = 0; GTANetworkAPI.Object nearestObject = GroundObjects.FirstOrDefault(d => d.Position == nearest.Position); - TextLabel nearestTextLabel = GroundTextLabels.FirstOrDefault(d => d.Position == nearest.Position); + TextLabel nearestTextLabel = GroundTextLabels.FirstOrDefault(d => d.Position == new Vector3(nearest.Position.X, nearest.Position.Y, nearest.Position.Z + 1.05) || d.Position == new Vector3(nearest.Position.X, nearest.Position.Y, nearest.Position.Z + 0.8)); IItem nearestItem = InventoryManager.GetItemById(nearest.ItemId); UserItem existingItem = InventoryManager.UserHasThisItem(player, nearest.ItemId); var user = player.GetUser(); + if (player.HasAttachment("ammobox")) + { player.SendNotification("~r~Du kannst momentan nichts tragen!", false); return; } if (nearestItem.Gewicht * nearest.Amount + invWeight > 40000) { for (var i = 1; i <= nearest.Amount; i++) @@ -69,7 +71,7 @@ namespace ReallifeGamemode.Server.Inventory else { UserItem newItem = new UserItem { ItemId = nearest.ItemId, UserId = user.Id, Amount = nearest.Amount }; - InventoryManager.AddItemToInventory(player, newItem); + InventoryManager.AddItemToInventory(player, newItem.ItemId, newItem.Amount); } nearest.Amount -= itemsToAdd; nearestTextLabel.Text = nearestItem.Name + " ~s~(~y~" + nearest.Amount + "~s~)"; @@ -90,11 +92,20 @@ namespace ReallifeGamemode.Server.Inventory else { UserItem item = new UserItem() { ItemId = nearest.ItemId, UserId = user.Id, Amount = nearest.Amount }; - InventoryManager.AddItemToInventory(player, item); + InventoryManager.AddItemToInventory(player, item.ItemId, item.Amount); } RemoveGroundItem(nearest, nearestObject, nearestTextLabel); player.SendNotification("Du hast ~g~" + nearest.Amount + " ~y~" + nearestItem.Name + " ~s~aufgehoben."); } + if (nearestItem is IWeaponDealItem obj) + { + if (!player.HasAttachment("ammobox")) + { + player.PlayAnimation("anim@heists@box_carry@", "idle", 49); + player.AddAttachment("ammobox", false); + NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed); + } + } } } @@ -108,4 +119,3 @@ namespace ReallifeGamemode.Server.Inventory } } } - diff --git a/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs b/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs index 4c6e2ad2..dd364314 100644 --- a/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs +++ b/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Interfaces Item (IItem.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Interfaces/IUsableItem.cs b/ReallifeGamemode.Server/Inventory/Interfaces/IUsableItem.cs index 22769290..24383bee 100644 --- a/ReallifeGamemode.Server/Inventory/Interfaces/IUsableItem.cs +++ b/ReallifeGamemode.Server/Inventory/Interfaces/IUsableItem.cs @@ -1,8 +1,4 @@ -using GTANetworkAPI; -using ReallifeGamemode.Database.Entities; -using System; -using System.Collections.Generic; -using System.Text; +using ReallifeGamemode.Database.Entities; /** * @overview Life of German Reallife - Inventory Interfaces UsableItem (IUsableItem.cs) diff --git a/ReallifeGamemode.Server/Inventory/Interfaces/IWeaponDealItem.cs b/ReallifeGamemode.Server/Inventory/Interfaces/IWeaponDealItem.cs index 07698d89..e40c5d5f 100644 --- a/ReallifeGamemode.Server/Inventory/Interfaces/IWeaponDealItem.cs +++ b/ReallifeGamemode.Server/Inventory/Interfaces/IWeaponDealItem.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; namespace ReallifeGamemode.Server.Inventory.Interfaces diff --git a/ReallifeGamemode.Server/Inventory/Items/Aal.cs b/ReallifeGamemode.Server/Inventory/Items/Aal.cs index 930c0b90..ac1ec0e3 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Aal.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Aal.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/Barsch.cs b/ReallifeGamemode.Server/Inventory/Items/Barsch.cs index 54dd90c4..4dbfef66 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Barsch.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Barsch.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs b/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs index 653cb29a..60f7c53b 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs @@ -1,7 +1,4 @@ using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; /** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) diff --git a/ReallifeGamemode.Server/Inventory/Items/CarbineRifle.cs b/ReallifeGamemode.Server/Inventory/Items/CarbineRifle.cs index ea55e6f6..c3ddff6d 100644 --- a/ReallifeGamemode.Server/Inventory/Items/CarbineRifle.cs +++ b/ReallifeGamemode.Server/Inventory/Items/CarbineRifle.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German @@ -19,6 +14,6 @@ namespace ReallifeGamemode.Server.Inventory.Items public override int Gewicht => 4000; public override string Einheit => "g"; public override uint Object => 3666746839; //3061944032 - public override int Price => 0; + public override int Price => 0; } } diff --git a/ReallifeGamemode.Server/Inventory/Items/Cheeseburger.cs b/ReallifeGamemode.Server/Inventory/Items/Cheeseburger.cs index 044ba1cb..75e83ab7 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Cheeseburger.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Cheeseburger.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Cheeseburger (Cheeseburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German @@ -21,6 +16,5 @@ namespace ReallifeGamemode.Server.Inventory.Items public override int HpAmount => 20; public override uint Object => 2240524752; public override int Price => 150; - } } diff --git a/ReallifeGamemode.Server/Inventory/Items/Cocain.cs b/ReallifeGamemode.Server/Inventory/Items/Cocain.cs index b9cd9d39..4bb35ab0 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Cocain.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Cocain.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Chickenburger (Chickenburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/DropItem.cs b/ReallifeGamemode.Server/Inventory/Items/DropItem.cs index 2ed4e902..f00121a0 100644 --- a/ReallifeGamemode.Server/Inventory/Items/DropItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/DropItem.cs @@ -3,9 +3,6 @@ using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Managers; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Inventory.Items { diff --git a/ReallifeGamemode.Server/Inventory/Items/Flunder.cs b/ReallifeGamemode.Server/Inventory/Items/Flunder.cs index a9696747..caea9851 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Flunder.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Flunder.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/FoodItem.cs b/ReallifeGamemode.Server/Inventory/Items/FoodItem.cs index d19a19af..77f76cd4 100644 --- a/ReallifeGamemode.Server/Inventory/Items/FoodItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/FoodItem.cs @@ -3,9 +3,6 @@ using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Managers; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Inventory.Items { diff --git a/ReallifeGamemode.Server/Inventory/Items/Lachs.cs b/ReallifeGamemode.Server/Inventory/Items/Lachs.cs index 75de97be..c2e7daa9 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Lachs.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Lachs.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/Pistol50.cs b/ReallifeGamemode.Server/Inventory/Items/Pistol50.cs index 62496028..6369cdf6 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Pistol50.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Pistol50.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/PumpShotgun.cs b/ReallifeGamemode.Server/Inventory/Items/PumpShotgun.cs index f540609f..c873c0e5 100644 --- a/ReallifeGamemode.Server/Inventory/Items/PumpShotgun.cs +++ b/ReallifeGamemode.Server/Inventory/Items/PumpShotgun.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/SMG.cs b/ReallifeGamemode.Server/Inventory/Items/SMG.cs index 99bc94a3..4f2d965b 100644 --- a/ReallifeGamemode.Server/Inventory/Items/SMG.cs +++ b/ReallifeGamemode.Server/Inventory/Items/SMG.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/Schutzweste.cs b/ReallifeGamemode.Server/Inventory/Items/Schutzweste.cs index 4c217e2c..d15ea31a 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Schutzweste.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Schutzweste.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/SniperRifle.cs b/ReallifeGamemode.Server/Inventory/Items/SniperRifle.cs index 2a792fac..050865ae 100644 --- a/ReallifeGamemode.Server/Inventory/Items/SniperRifle.cs +++ b/ReallifeGamemode.Server/Inventory/Items/SniperRifle.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/Thunfisch.cs b/ReallifeGamemode.Server/Inventory/Items/Thunfisch.cs index 9723a074..fd2c4e2f 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Thunfisch.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Thunfisch.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs b/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs index 9fb91037..fdaff5cd 100644 --- a/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs @@ -2,10 +2,6 @@ using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory.Interfaces; -using ReallifeGamemode.Server.Managers; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Inventory.Items { diff --git a/ReallifeGamemode.Server/Inventory/Items/Zander.cs b/ReallifeGamemode.Server/Inventory/Items/Zander.cs index 2ea621a3..2e24b879 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Zander.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Zander.cs @@ -1,9 +1,4 @@ -using ReallifeGamemode.Server.Inventory.Interfaces; -using System; -using System.Collections.Generic; -using System.Text; - -/** +/** * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @author VegaZ * @copyright (c) 2008 - 2018 Life of German diff --git a/ReallifeGamemode.Server/Job/BusDriverJob.cs b/ReallifeGamemode.Server/Job/BusDriverJob.cs index 3f8a91bd..9c55ad6f 100644 --- a/ReallifeGamemode.Server/Job/BusDriverJob.cs +++ b/ReallifeGamemode.Server/Job/BusDriverJob.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using GTANetworkAPI; -using ReallifeGamemode.Server.Util; using Newtonsoft.Json; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; diff --git a/ReallifeGamemode.Server/Job/JobBase.cs b/ReallifeGamemode.Server/Job/JobBase.cs index cdccb45d..d40f5c81 100644 --- a/ReallifeGamemode.Server/Job/JobBase.cs +++ b/ReallifeGamemode.Server/Job/JobBase.cs @@ -1,19 +1,20 @@ +using System.Collections.Generic; +using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; -using System; -using System.Collections.Generic; -using System.Linq; namespace ReallifeGamemode.Server.Job { public abstract class JobBase : Script { public delegate void JobStartHandler(Player player); + public delegate void JobStopHandler(Player player); public event JobStartHandler JobStart; + public event JobStopHandler JobStop; private readonly List _inJob = new List(); @@ -59,6 +60,7 @@ namespace ReallifeGamemode.Server.Job } public static List GetPlayerInJob() => jobPlayer; + public List GetUsersInJob() => _inJob; } } diff --git a/ReallifeGamemode.Server/Job/PilotJob.cs b/ReallifeGamemode.Server/Job/PilotJob.cs index f4c4a9aa..6e9d2e29 100644 --- a/ReallifeGamemode.Server/Job/PilotJob.cs +++ b/ReallifeGamemode.Server/Job/PilotJob.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using GTANetworkAPI; -using ReallifeGamemode.Server.Util; using Newtonsoft.Json; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; @@ -10,7 +9,7 @@ using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Job { - class PilotJob : JobBase + internal class PilotJob : JobBase { public override int Id => 3; @@ -90,8 +89,6 @@ namespace ReallifeGamemode.Server.Job new Vector3(-710.89, -1836.81, 355.46), }.AsReadOnly(); - - public PilotJob() { JobStart += PilotJob_JobStart; @@ -106,7 +103,6 @@ namespace ReallifeGamemode.Server.Job if ((VehicleHash)veh.Model == VehicleHash.Velum || (VehicleHash)veh.Model == VehicleHash.Velum2) { - listRouteTexts2.Add("Route 4"); listRouteTexts2.Add("Route 5"); listRouteTexts2.Add("Route 6"); @@ -151,7 +147,6 @@ namespace ReallifeGamemode.Server.Job break; } }*/ - } [RemoteEvent("startPilotRoute")] public void StartPilotRoute(Player player, string type) { diff --git a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs index 2106a5a5..4a0b2d6e 100644 --- a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs +++ b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs @@ -202,6 +202,7 @@ namespace ReallifeGamemode.Server.Job Player target = data.getPartnerClient(player); if (target != null) target.TriggerEvent("MuellmannUpdateColshape", colshapeIndex); ChatService.SendMessage((Player)player, "Du hast den Müllsack in der Hand. Bringe ihm zum Müllwagen hinten."); + player.AddAttachment("binbag", false); return; } } @@ -213,14 +214,10 @@ namespace ReallifeGamemode.Server.Job { if (data.getDataFromClient(player) == null) continue; - int count = data.getTrashCount(); - count++; - data.setTrashCount(count); + data.setTrashCount(data.getTrashCount() + 1); Player target = data.getPartnerClient(player); - if (target != null) ChatService.SendMessage((Player)target, $"Es sind jetzt {count} Säcke im Müllwagen."); - ChatService.SendMessage((Player)player, $"Es sind jetzt {count} Säcke im Müllwagen."); - + player.AddAttachment("binbag", true); if (data.getTrashCount() >= 20) { ChatService.SendMessage((Player)player, "Auto ist voll fahre nun zu Base."); @@ -241,11 +238,9 @@ namespace ReallifeGamemode.Server.Job { if (data.getDataFromClient(player) == null) continue; - int count = data.getTrashCount(); - Player target = data.getPartnerClient(player); - if (target != null) ChatService.SendMessage((Player)target, $"Fahrzeug wurde entleert. Säcke: {count}"); - ChatService.SendMessage((Player)player, $"Fahrzeug wurde entleert. Säcke: {count}"); + if (target != null) ChatService.SendMessage((Player)target, $"Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); + ChatService.SendMessage((Player)player, $"Fahrzeug wurde entleert. Säcke: {data.getTrashCount()}"); //bonus pro sack data.setTrashCount(0); @@ -331,7 +326,7 @@ namespace ReallifeGamemode.Server.Job } CheckDataForDuplicatePlayer(player, data); data.setClientToData(player); - + //destroy veh MuellmannJobStarten(player, vehicle); target = data.getPartnerClient(player); diff --git a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs index 6e8ba86c..52a959d9 100644 --- a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs +++ b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs @@ -1,21 +1,18 @@ using System; using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Extensions; -using System.Timers; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Managers; -using ReallifeGamemode.Database.Entities; using System.Linq; +using GTANetworkAPI; using Newtonsoft.Json; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Job { - class TaxiDriverJob : JobBase + internal class TaxiDriverJob : JobBase { public List TaxiContracts { get; set; } = new List(); @@ -27,7 +24,6 @@ namespace ReallifeGamemode.Server.Job public override bool NeedVehicleToStart => true; - private static TaxiDriverJob _Instance; public TaxiDriverJob() @@ -42,6 +38,7 @@ namespace ReallifeGamemode.Server.Job _Instance = new TaxiDriverJob(); return _Instance; } + private void TaxiDriverJobJobStart(Player player) { player.Vehicle.SetSharedData("vehicleTaxiLight", true); @@ -89,24 +86,23 @@ namespace ReallifeGamemode.Server.Job dbContext.SaveChanges(); target.Player.TriggerEvent("SERVER:SET_HANDMONEY", target.Handmoney); } - } - /* - public static void StartTaxiTimer() - { - Timer timer = new Timer(500); - timer.Start(); - timer.Elapsed += UpdateFare; - } - */ + /* + public static void StartTaxiTimer() + { + Timer timer = new Timer(500); + timer.Start(); + timer.Elapsed += UpdateFare; + } + */ public static void UpdateFare() { foreach (var player in GetPlayerInJob()) { User u = player.GetUser(); - if (u.JobId != 1) return; + if (u.JobId != 1) return; Console.WriteLine(player.Name); if (!player.HasData("hasPassager")) { player.SetData("hasPassager", false); continue; } int playerId = player.GetUser().Id; @@ -124,9 +120,7 @@ namespace ReallifeGamemode.Server.Job { occupant.TriggerEvent("CLIENT:updateFare", JsonConvert.SerializeObject(distance)); } - } } - } } diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 7cc0f238..b65649ce 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -1,26 +1,19 @@ -using System.Globalization; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; using GTANetworkAPI; using Newtonsoft.Json; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Classes; -using ReallifeGamemode.Server.Finance; +using ReallifeGamemode.Server.Common; +using ReallifeGamemode.Server.Core.API; +using ReallifeGamemode.Server.Core.Events; +using ReallifeGamemode.Server.Core.RageMP; +using ReallifeGamemode.Server.DrivingSchool; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Server.Wanted; -using ReallifeGamemode.Server.DrivingSchool; -using ReallifeGamemode.Server.WeaponDeal; -using ReallifeGamemode.Server.Core.API; -using ReallifeGamemode.Server.Core.RageMP; -using ReallifeGamemode.Server.Core.Events; -using System.Collections.Generic; -using ReallifeGamemode.Server.Common; -using System.Reflection; -using System.Linq; -using ReallifeGamemode.Server.Job; -using ReallifeGamemode.Database.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Infrastructure; -using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Services; using System.Threading; diff --git a/ReallifeGamemode.Server/Managers/ATMManager.cs b/ReallifeGamemode.Server/Managers/ATMManager.cs index 9682af3e..6ac4ba08 100644 --- a/ReallifeGamemode.Server/Managers/ATMManager.cs +++ b/ReallifeGamemode.Server/Managers/ATMManager.cs @@ -1,11 +1,9 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; /** * @overview Life of German Reallife - Managers ATMManager (ATMManager.cs) @@ -59,6 +57,7 @@ namespace ReallifeGamemode.Server.Managers LoadATMs(); } } + public static void LoadATMs() { using (var dbContext = new DatabaseContext()) @@ -73,14 +72,17 @@ namespace ReallifeGamemode.Server.Managers } } } + public static void EnterATMRange(ColShape colShape, Player client) { client.SetData("nearATM", colShape.GetData("id")); } + public static void ExitATMRange(ColShape colShape, Player client) { client.ResetData("nearATM"); } + public static void ShowAtmUi(Player player, int atmId) { player.TriggerEvent("SERVER:ShowAtmUi", atmId); diff --git a/ReallifeGamemode.Server/Managers/BankManager.cs b/ReallifeGamemode.Server/Managers/BankManager.cs index 81c37466..60e29d0c 100644 --- a/ReallifeGamemode.Server/Managers/BankManager.cs +++ b/ReallifeGamemode.Server/Managers/BankManager.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using GTANetworkAPI; -using ReallifeGamemode.Server.Business; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Server.Util; using ReallifeGamemode.Database; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Database.Entities.Logs; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Entities.Logs; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Util; /** * @overview Life of German Reallife - Managers BankManager (BankManager.cs) diff --git a/ReallifeGamemode.Server/Managers/BusinessManager.cs b/ReallifeGamemode.Server/Managers/BusinessManager.cs index 4031bea7..2796b30a 100644 --- a/ReallifeGamemode.Server/Managers/BusinessManager.cs +++ b/ReallifeGamemode.Server/Managers/BusinessManager.cs @@ -1,22 +1,21 @@ -using GTANetworkAPI; -using Newtonsoft.Json; -using ReallifeGamemode.Server.Business; -using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using ReallifeGamemode.Database; -using ReallifeGamemode.Server.Types; +using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using ReallifeGamemode.Database; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Business; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Managers { - class BusinessManager : Script + internal class BusinessManager : Script { public static List Businesses { get; private set; } diff --git a/ReallifeGamemode.Server/Managers/CharacterCreator.cs b/ReallifeGamemode.Server/Managers/CharacterCreator.cs index fbbe7dd7..871c35f7 100644 --- a/ReallifeGamemode.Server/Managers/CharacterCreator.cs +++ b/ReallifeGamemode.Server/Managers/CharacterCreator.cs @@ -1,8 +1,8 @@ using System.Linq; using GTANetworkAPI; using Newtonsoft.Json.Linq; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; namespace ReallifeGamemode.Server.Managers { @@ -11,9 +11,10 @@ namespace ReallifeGamemode.Server.Managers [RemoteEvent("creator_GenderChange")] public void changeGender(Player player, int gender) { - if(gender == 0) player.SetSkin(PedHash.FreemodeMale01); + if (gender == 0) player.SetSkin(PedHash.FreemodeMale01); else player.SetSkin(PedHash.FreemodeFemale01); } + [RemoteEvent("creatorSave")] public void CreatorSave(Player player, bool gender, string parentData, string featureData, string appearanceData, string hairAndColorData) { @@ -304,7 +305,6 @@ namespace ReallifeGamemode.Server.Managers player.SetHeadOverlay(11, blemishes); player.SetHeadOverlay(12, blemishes); - //Gesicht (Vererbung durch Mutter / Vater) HeadBlend headBlend = new HeadBlend() { @@ -326,7 +326,6 @@ namespace ReallifeGamemode.Server.Managers //Augenfarbe NAPI.Player.SetPlayerEyeColor(player, character.EyeColor); - } } } diff --git a/ReallifeGamemode.Server/Managers/CityHallManager.cs b/ReallifeGamemode.Server/Managers/CityHallManager.cs index 2aaaff9a..504343d2 100644 --- a/ReallifeGamemode.Server/Managers/CityHallManager.cs +++ b/ReallifeGamemode.Server/Managers/CityHallManager.cs @@ -1,20 +1,15 @@ -using GTANetworkAPI; +using System.Linq; +using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ReallifeGamemode.Database; using ReallifeGamemode.Server.Types; namespace ReallifeGamemode.Server.Managers { - class CityHallManager : Script + internal class CityHallManager : Script { private static readonly Vector3 _cityHallPosition = new Vector3(273.22, -278.14, 53.9); diff --git a/ReallifeGamemode.Server/Managers/DoorManager.cs b/ReallifeGamemode.Server/Managers/DoorManager.cs index 848aebef..c5a6e223 100644 --- a/ReallifeGamemode.Server/Managers/DoorManager.cs +++ b/ReallifeGamemode.Server/Managers/DoorManager.cs @@ -2,11 +2,10 @@ using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Util; -using ReallifeGamemode.Database; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Types; + /** * @overview Life of German Reallife - Managers BankManager (BankManager.cs) * @author VegaZ diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index d9868c11..b316ab0d 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -1,21 +1,22 @@ -using GTANetworkAPI; +using System.Collections.Generic; +using System.Linq; +using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Job; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ReallifeGamemode.Database; -using ReallifeGamemode.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Services; + +using ReallifeGamemode.Server.Types; + using System.Buffers; using Microsoft.EntityFrameworkCore; using ReallifeGamemode.Server.Events; +using System; /** * @overview Life of German Reallife - Managers Interaction (InteractionManager.cs) @@ -27,9 +28,8 @@ namespace ReallifeGamemode.Server.Managers { public class InteractionManager : Script { - #region Umgebungsinteraktionen PFEILTASTE-HOCH - #endregion #region Eigeninteraktionen PFEILTASTE-RUNTER + [RemoteEvent("CLIENT:InteractionMenu_AcceptInvite")] public void InteractionMenuAcceptInvite(Player player, string type) { @@ -75,12 +75,15 @@ namespace ReallifeGamemode.Server.Managers default: player.SetSharedData("blipColor", 0); break; + case 8: player.SetSharedData("blipColor", 83); break; + case 7: player.SetSharedData("blipColor", 52); break; + case 4: player.SetSharedData("blipColor", 5); break; @@ -121,6 +124,7 @@ namespace ReallifeGamemode.Server.Managers } } } + [RemoteEvent("CLIENT:InteractionMenu_EndShow")] public void InteractionMenuEndShow(Player client) { @@ -165,7 +169,6 @@ namespace ReallifeGamemode.Server.Managers licenses.Add(playerUser.FlyingLicensePlane); licenses.Add(playerUser.WeaponLicense); target.TriggerEvent("ShowLicenses", player.Name, licenses.ToArray()); - } } @@ -310,7 +313,6 @@ namespace ReallifeGamemode.Server.Managers using (var dbContext = new DatabaseContext()) { - target.GetUser(dbContext).Group = null; target.GetUser(dbContext).GroupRank = GroupRank.NONE; @@ -451,8 +453,8 @@ namespace ReallifeGamemode.Server.Managers player.SendNotification("~r~Du kannst nur zwischen 1$ und 10000$ angeben!"); } } - } + [RemoteEvent("CLIENT:InteractionMenu_LSPD_Points3")] public void InteractionMenu_LSPD_Points3(Player player, string jsonNameOrId, string jsoAmount, string jsonReason) { @@ -524,7 +526,6 @@ namespace ReallifeGamemode.Server.Managers { target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/8 ~x~Strafpunkten.", true); } - } else { @@ -532,6 +533,7 @@ namespace ReallifeGamemode.Server.Managers } } } + [RemoteEvent("CLIENT:InteractionMenu_Ticket")] public void InteractionMenuTicket(Player target, string type, int ticket_amount) { @@ -572,7 +574,6 @@ namespace ReallifeGamemode.Server.Managers target.ResetData("ticket_boolean"); target.ResetData("ticket_amount"); target.ResetData("ticket_player"); - } else if (type == "Abgelehnt") { @@ -583,8 +584,11 @@ namespace ReallifeGamemode.Server.Managers target.ResetData("ticket_player"); } } - #endregion + + #endregion Eigeninteraktionen PFEILTASTE-RUNTER + #region Spielerinteraktionen PFEILTASTE-LINKS + [RemoteEvent("openTradeInventory")] public void OpenTradeInventory(Player player, string targetPlayer) { @@ -643,8 +647,7 @@ namespace ReallifeGamemode.Server.Managers tradeRequester.TriggerEvent("unlockTradeItems"); } } - #endregion - #region Fraktionsinteraktionen / Jobinteraktionen PFEILTASTE-RECHTS - #endregion + + #endregion Spielerinteraktionen PFEILTASTE-LINKS } } diff --git a/ReallifeGamemode.Server/Managers/InventoryManager.cs b/ReallifeGamemode.Server/Managers/InventoryManager.cs index 22ba91d6..7a5f1675 100644 --- a/ReallifeGamemode.Server/Managers/InventoryManager.cs +++ b/ReallifeGamemode.Server/Managers/InventoryManager.cs @@ -1,17 +1,17 @@ -using GTANetworkAPI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Timers; +using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory; using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; -using System; -using System.Timers; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Services; using ReallifeGamemode.Server.Types; @@ -31,6 +31,85 @@ namespace ReallifeGamemode.Server.Managers private static Dictionary TradeTimer { get; set; } = new Dictionary(); private static Dictionary TradeValue { get; set; } = new Dictionary(); + public static Dictionary> backpackItems { get; set; } = new Dictionary>(); + public static Dictionary> vehicleItems { get; set; } = new Dictionary>(); + + public class InventoryItem + { + public string Name; + public int Amount; + public int ItemId; + public int Weight; + public Vehicle vehicle; + } + + public static void SetBackpackItems(Player player) + { + List itemList = GetUserItems(player); + if (itemList == null) return; + + if (!backpackItems.ContainsKey(player)) + backpackItems.Add(player, new List()); + + backpackItems[player] = new List(); + + foreach (var i in itemList) + { + var newItem = new InventoryItem() + { + Name = GetItemById(i.ItemId).Name, + Amount = i.Amount, + ItemId = i.ItemId, + Weight = GetUserInventoryWeight(player), + }; + backpackItems[player].Add(newItem); + } + + player.SetSharedData("backpackItems", JsonConvert.SerializeObject(backpackItems[player].ToArray())); + } + + [RemoteEvent("CLIENT:getVehicleInventory")] + public static void SetVehicleItems(Player player) + { + if (player.IsInVehicle) + { + player.TriggerEvent("Error", "Du kannst dein Kofferraum nicht betätigen."); + } + Vehicle veh = NAPI.Pools.GetAllVehicles().ToList().Where(v => v.Position.DistanceTo(player.Position) <= 2).FirstOrDefault(); + if (veh == null) + { + player.TriggerEvent("Error", "Kein Fahrzeug in der Nähe !"); + return; + } + List itemList = GetVehicleItems(veh); + + if (itemList == null) + { + player.TriggerEvent("Error", "Kofferraum ist leer !"); + return; + } + + if (!vehicleItems.ContainsKey(player)) + vehicleItems.Add(player, new List()); + //VehicleStreaming.SetDoorState(veh, DoorID.DoorTrunk, DoorState.DoorOpen); + + vehicleItems[player] = new List(); + + foreach (var i in itemList) + { + var newItem = new InventoryItem + { + Name = GetItemById(i.ItemId).Name, + Amount = i.Amount, + ItemId = i.ItemId, + Weight = GetVehicleInventoryWeight(veh), + vehicle = veh, + }; + vehicleItems[player].Add(newItem); + } + + player.SetSharedData("vehicleItems", JsonConvert.SerializeObject(vehicleItems[player].ToArray())); + } public static void LoadItems() { @@ -79,43 +158,48 @@ namespace ReallifeGamemode.Server.Managers dbContext.Remove(userItem); dbContext.SaveChanges(); } + Player player = user.Player; + + List itemList = GetUserItems(player); + if (itemList == null) return; + dbContext.SaveChanges(); } } - public static void GetUserItems(Player player) + public static void RemoveVehicleItem(ServerVehicle sVeh, VehicleItem item, int amount, Player player) + { + using (var dbContext = new DatabaseContext()) + { + var vehicleItem = dbContext.VehicleItems.FirstOrDefault(i => i.Id == item.Id); + + vehicleItem.Amount -= amount; + + dbContext.SaveChanges(); + + if (vehicleItem.Amount == 0) + { + dbContext.Remove(vehicleItem); + dbContext.SaveChanges(); + } + Vehicle vehicle = sVeh.GetVehicle(); + List itemList = GetVehicleItems(vehicle); + if (itemList == null) return; + dbContext.SaveChanges(); + } + } + + public static List GetVehicleItems(Vehicle vehicle) + { + return new DatabaseContext().VehicleItems.ToList().FindAll(i => i.GetVehicle().GetVehicle() == vehicle); + } + + public static List GetUserItems(Player player) { var user = player.GetUser(); - var inventoryWeight = 0; - List iName = new List(); - List iAmount = new List(); - List iId = new List(); - List iWeight = new List(); using (var context = new DatabaseContext()) { - List userItems = context.UserItems.ToList().FindAll(i => i.UserId == user.Id); - - - foreach (var item in userItems) - { - IItem iItem = GetItemById(item.ItemId); - var currentItemWeight = iItem.Gewicht * item.Amount; - inventoryWeight += currentItemWeight; - - iName.Add(iItem.Name); - iAmount.Add(item.Amount); - iId.Add(iItem.Id); - - } - List targetList = NAPI.Player.GetPlayersInRadiusOfPlayer(2, player); - List username = new List(); - foreach (var target in targetList) - { - User cl = target.GetUser(); - username.Add(cl.Name); - } - - player.TriggerEvent("inventoryShow", inventoryWeight, iName.ToArray(), iAmount.ToArray(), iId.ToArray(), username.ToArray()); + return context.UserItems.ToList().FindAll(i => i.UserId == user.Id); } } @@ -138,7 +222,6 @@ namespace ReallifeGamemode.Server.Managers return inventoryWeight; } - public static int GetVehicleInventoryWeight(Vehicle veh) { var inventoryWeight = 0; @@ -194,318 +277,170 @@ namespace ReallifeGamemode.Server.Managers } } - public bool CheckOriginOfItem(Player client, string jsonItemID, string jsonItemAmount, string jsonOrigin, string jsonVehAmount) - { - var origin = JsonConvert.DeserializeObject(jsonOrigin); - var itemID = JsonConvert.DeserializeObject(jsonItemID); - var itemAmount = JsonConvert.DeserializeObject(jsonItemAmount); - var vehAmount = JsonConvert.DeserializeObject(jsonVehAmount); - var user = client.GetUser(); - using (var context = new DatabaseContext()) - { - if (origin.Length < 1) - return false; - - - if (origin[0] == 1) - { - foreach (Vehicle veh in NAPI.Pools.GetAllVehicles()) - { - if (veh.Position.DistanceTo(client.Position) < 5f) - { - if (VehicleStreaming.GetDoorState(veh, DoorID.DoorTrunk) == DoorState.DoorOpen || VehicleStreaming.GetDoorState(veh, DoorID.DoorRearLeft) == DoorState.DoorOpen || VehicleStreaming.GetDoorState(veh, DoorID.DoorRearRight) == DoorState.DoorOpen) - { - - UserItem vItem = new UserItem - { - Amount = vehAmount, - ItemId = itemID, - UserId = user.Id, - Slot = -1 - }; - - ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context); - VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == origin[1] && v.ItemId == vItem.ItemId).FirstOrDefault(); - if (vehItem != null) - { - IItem iItem = GetItemById(vItem.ItemId); - - if (GetUserInventoryWeight(client) + (iItem.Gewicht * vItem.Amount) > 40000) - { - for (int i = 0; i <= vItem.Amount; i++) - { - if (GetUserInventoryWeight(client) + (iItem.Gewicht * i) > 40000) - { - vItem.Amount = i - 1; - break; - } - - } - } - - if (vItem.Amount == 0) - { - return false; - } - - if (itemAmount < vehItem.Amount) - { - UserItem uItem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == vItem.ItemId).FirstOrDefault(); - if (uItem == null) - { - context.Add(vItem); - } - else - { - uItem.Amount += vItem.Amount; - } - context.SaveChanges(); - return true; - } - else if (itemAmount == vehItem.Amount) - { - UserItem uItem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == vItem.ItemId).FirstOrDefault(); - if (uItem == null) - { - context.Add(vItem); - } - else - { - uItem.Amount += vItem.Amount; - } - context.SaveChanges(); - return true; - } - return false; - } - } - } - } - } - else if (origin[0] == 0) - { - - VehicleItem cItem = new VehicleItem - { - Amount = vehAmount, - ItemId = itemID, - VehicleId = origin[1], - Slot = -1, - }; - - UserItem uItem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == cItem.ItemId).FirstOrDefault(); - IItem iItem = GetItemById(cItem.ItemId); - Vehicle veh = VehicleManager.GetVehicleFromId(cItem.VehicleId); - if (GetVehicleInventoryWeight(veh) + (iItem.Gewicht * cItem.Amount) > 250000) - { - for (int i = 0; i <= cItem.Amount; i++) - { - if (GetVehicleInventoryWeight(veh) + (iItem.Gewicht * i) > 250000) - { - cItem.Amount = i - 1; - break; - } - - } - } - - if (cItem.Amount == 0) - { - return false; - } - - if (iItem is IWeaponDealItem weaponDealItem) - { - return false; - } - - if (uItem != null) - { - if (vehAmount < uItem.Amount) - { - - VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == cItem.VehicleId && v.ItemId == cItem.ItemId).FirstOrDefault(); - if (vehItem == null) - { - context.Add(cItem); - } - else - { - vehItem.Amount += cItem.Amount; - } - context.SaveChanges(); - return true; - - - } - else if (vehAmount == uItem.Amount) - { - VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == cItem.VehicleId && v.ItemId == cItem.ItemId).FirstOrDefault(); - if (vehItem == null) - { - context.Add(cItem); - } - else - { - vehItem.Amount += cItem.Amount; - } - context.SaveChanges(); - return true; - } - return false; - } - } - return false; - } - } - - [RemoteEvent("saveVehicleInventory")] - public void SaveVehicleInventory(Player player, string jsonItemID, string jsonItemAmount, string jsonGotFrom, string vehAmount) + [RemoteEvent("transferToBackpack")] + public void TransferToBackpack(Player player, string jsonItemID, string jsonItemAmount) { var itemID = JsonConvert.DeserializeObject(jsonItemID); var itemAmount = JsonConvert.DeserializeObject(jsonItemAmount); - var origin = JsonConvert.DeserializeObject(jsonGotFrom); - - if (!CheckOriginOfItem(player, jsonItemID, jsonItemAmount, jsonGotFrom, vehAmount)) - return; using (var context = new DatabaseContext()) { + if (!vehicleItems.ContainsKey(player)) + vehicleItems.Add(player, new List()); + Vehicle veh = null; + if (vehicleItems[player].Count != 0) + veh = vehicleItems[player].FirstOrDefault().vehicle; - VehicleItem vItem = new VehicleItem - { - Amount = itemAmount, - ItemId = itemID, - VehicleId = origin[1], - Slot = -1 - }; + ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context); - VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == vItem.VehicleId && v.ItemId == vItem.ItemId).FirstOrDefault(); + VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == serverVehicle.Id && v.ItemId == itemID).FirstOrDefault(); if (vehItem == null) { - context.VehicleItems.Add(vItem); - } - else if (vItem.Amount <= 0) - { - context.VehicleItems.Remove(vehItem); - } - else - { - vehItem.Amount = vItem.Amount; + player.TriggerEvent("Error", "Transfer nicht möglich."); + return; } + + RemoveVehicleItem(serverVehicle, vehItem, itemAmount, player); + SetVehicleItems(player); + + AddItemToInventory(player, itemID, itemAmount); + + SetBackpackItems(player); context.SaveChanges(); - IItem iItem = GetItemById(vItem.ItemId); - player.TriggerEvent("aproveTransfer", JsonConvert.DeserializeObject(vehAmount), iItem.Name, "Rucksack"); + IItem iItem = GetItemById(vehItem.ItemId); } } - - [RemoteEvent("saveInventory")] - public void SavePlayerInventory(Player player, string jsonItemID, string jsonItemAmount, string jsonGotFrom, string vehAmount) + [RemoteEvent("transferToVehicle")] + public void TransferToVehicle(Player player, string jsonItemID, string jsonItemAmount) { - var user = player.GetUser(); var itemID = JsonConvert.DeserializeObject(jsonItemID); var itemAmount = JsonConvert.DeserializeObject(jsonItemAmount); - var origin = JsonConvert.DeserializeObject(jsonGotFrom); - - if (!CheckOriginOfItem(player, jsonItemID, jsonItemAmount, jsonGotFrom, vehAmount)) - return; using (var context = new DatabaseContext()) { + UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemID && u.Amount <= itemAmount).FirstOrDefault(); - UserItem cItem = new UserItem - { - Amount = itemAmount, - ItemId = itemID, - UserId = user.Id, - Slot = -1, - }; - - - UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == cItem.ItemId).FirstOrDefault(); if (item == null) { - context.UserItems.Add(cItem); - } - else if (cItem.Amount <= 0) - { - context.UserItems.Remove(item); - } - else - { - item.Amount = cItem.Amount; + player.TriggerEvent("Error", "Transfer nicht möglich."); + return; } + RemoveUserItem(user, item, itemAmount); + + if (!vehicleItems.ContainsKey(player)) + { + player.TriggerEvent("Error", "Transfer nicht möglich."); + return; + } + + if (!vehicleItems.ContainsKey(player)) + vehicleItems.Add(player, new List()); + Vehicle veh = null; + if (vehicleItems[player].Count != 0) + veh = vehicleItems[player].FirstOrDefault().vehicle; + + if (veh == null) + { + player.TriggerEvent("Error", "Transfer nicht möglich."); + return; + } + + AddItemToVehicleInventory(veh, itemID, itemAmount); + SetVehicleItems(player); + VehicleItem vehicleItem = context.VehicleItems.Where(f => f.ItemId == itemID && f.Vehicle == VehicleManager.GetServerVehicleFromVehicle(veh, context)).FirstOrDefault(); context.SaveChanges(); - IItem iItem = GetItemById(item.ItemId); - player.TriggerEvent("aproveTransfer", JsonConvert.DeserializeObject(vehAmount), iItem.Name, "Kofferraum"); + IItem iItem = GetItemById(itemID); + player.TriggerEvent("aproveTransfer", vehicleItem.Amount, iItem.Name, "Kofferraum"); } } - public static void AddItemToInventory(Player player, UserItem item) + public static void AddItemToInventory(Player player, int itemId, int amount) { var user = player.GetUser(); using (var context = new DatabaseContext()) { - UserItem existingItem = context.UserItems.FirstOrDefault(i => i.ItemId == item.ItemId && i.UserId == item.UserId); + int setAmount = 0; + for (int i = 1; i <= amount; i++) + { + if (GetUserInventoryWeight(player) + (i * GetItemById(itemId).Gewicht) > 40000) + { + break; + } + else + { + setAmount = i; + } + } + + if (setAmount == 0) + { + player.TriggerEvent("Error", "Du kannst nicht so viel tragen."); + return; + } + + UserItem existingItem = context.UserItems.FirstOrDefault(i => i.ItemId == itemId && i.UserId == user.Id); if (existingItem != null) { - existingItem.Amount += item.Amount; + existingItem.Amount += setAmount; } else { - List allItemsByUser = context.UserItems.ToList().FindAll(i => i.UserId == user.Id); - var slotArr = Enumerable.Range(1, 20).ToList(); - allItemsByUser.ForEach(allItem => + var newItem = new UserItem() { - if (slotArr.Contains(allItem.Slot)) slotArr.Remove(allItem.Slot); - }); - - int newSlot = slotArr.Min(); - - item.Slot = newSlot; - context.UserItems.Add(item); - - IItem iItem = GetItemById(item.ItemId); - - string[] newItem = new string[] { iItem.Name, iItem.Description, iItem.Gewicht.ToString(), item.Amount.ToString(), newSlot.ToString(), item.Id.ToString() }; - - player.TriggerEvent("addItem", JsonConvert.SerializeObject(newItem)); + ItemId = itemId, + Amount = setAmount, + Slot = -1, + UserId = user.Id, + }; + context.UserItems.Add(newItem); } context.SaveChanges(); + IItem iItem = GetItemById(itemId); + player.TriggerEvent("aproveTransfer", setAmount, iItem.Name, "Rucksack"); } } - public static void AddItemToVehicleInventory(Player player, VehicleItem item, Vehicle veh) + public static void AddItemToVehicleInventory(Vehicle veh, int itemId, int amount) { - var user = player.GetUser(); using (var context = new DatabaseContext()) { + int setAmount = 0; + for (int i = 1; i <= amount; i++) + { + if (GetVehicleInventoryWeight(veh) + (i * GetItemById(itemId).Gewicht) > 200000) + { + break; + } + else + { + setAmount = i; + } + } + + if (setAmount == 0) + { + return; + } + ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(veh); - VehicleItem existingItem = context.VehicleItems.FirstOrDefault(i => i.ItemId == item.ItemId && i.VehicleId == sVeh.Id); + VehicleItem existingItem = context.VehicleItems.FirstOrDefault(i => i.ItemId == itemId && i.VehicleId == sVeh.Id); if (existingItem != null) { - existingItem.Amount += item.Amount; + existingItem.Amount += amount; } else { - List allItemsByVehicle = context.VehicleItems.ToList().FindAll(i => i.VehicleId == sVeh.Id); - var slotArr = Enumerable.Range(1, 20).ToList(); - allItemsByVehicle.ForEach(allItem => + var newVehItem = new VehicleItem() { - if (slotArr.Contains(allItem.Slot)) slotArr.Remove(allItem.Slot); - }); - - int newSlot = slotArr.Min(); - - item.Slot = newSlot; - context.VehicleItems.Add(item); - - IItem iItem = GetItemById(item.ItemId); - - string[] newItem = new string[] { iItem.Name, iItem.Description, iItem.Gewicht.ToString(), item.Amount.ToString(), newSlot.ToString(), item.Id.ToString() }; + ItemId = itemId, + Amount = amount, + Slot = -1, + VehicleId = sVeh.Id, + }; + context.VehicleItems.Add(newVehItem); } context.SaveChanges(); } @@ -579,11 +514,13 @@ namespace ReallifeGamemode.Server.Managers if (iItem is IUsableItem usableItemObj) { usableItemObj.Use(fItem); - player.TriggerEvent("removeItem", itemId, 1); + List items = backpackItems[player]; + player.SetSharedData("backpackItems", JsonConvert.SerializeObject(items.ToArray())); player.TriggerEvent("aproveUse", 1, iItem.Name); } else player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen."); break; + case "drop": if (iItem == null) @@ -604,18 +541,19 @@ namespace ReallifeGamemode.Server.Managers //new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f); Random r = new Random(); GTANetworkAPI.Object grndObject; + Vector3 textPos = dropPosition; if (iItem is IWeaponDealItem obj) { dropPosition.Z -= 1.05f; - grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 0); + grndObject = NAPI.Object.CreateObject(3666746839, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0); } else { dropPosition.Z -= 0.8f; - grndObject = NAPI.Object.CreateObject(3777723516, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 0); + grndObject = NAPI.Object.CreateObject(3777723516, dropPosition, new Vector3(0, 0, r.Next(0, 360)), 255, 0); } GroundItem grndItem = new GroundItem { ItemId = iItem.Id, Amount = amount, Position = dropPosition }; - TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", dropPosition, 5, 0.5f, 4, new Color(255, 255, 255), false, 0); + TextLabel grndTxtLbl = NAPI.TextLabel.CreateTextLabel(iItem.Name + " ~s~(~y~" + amount + "~s~)", textPos, 5, 0.5f, 4, new Color(255, 255, 255), false, 0); GroundItem.AddGroundItem(grndItem, grndObject, grndTxtLbl); if (fItem.Amount > amount) { @@ -625,7 +563,8 @@ namespace ReallifeGamemode.Server.Managers { context.UserItems.Remove(fItem); } - player.TriggerEvent("removeItem", itemId, amount); + context.SaveChanges(); + SetBackpackItems(player); player.TriggerEvent("aproveThrow", amount, iItem.Name); } break; @@ -634,234 +573,6 @@ namespace ReallifeGamemode.Server.Managers } } - - [RemoteEvent("tradeItem")] - public void ServerEvent_tradeItem(Player client, int value, string jsonNameOrId, string itemIdArrStr, string itemAmountArrStr) - { - User user = client.GetUser(); - string nameOrId = JsonConvert.DeserializeObject(jsonNameOrId); - Player target = PlayerService.GetPlayerByNameOrId(nameOrId); - if (target == null || !target.IsLoggedIn() || target == client) - { - ChatService.PlayerNotFound(client); - return; - } - if (client.Position.DistanceTo(target.Position) >= 5) - { - ChatService.ErrorMessage(client, "Spieler ist zu weit entfernt."); - return; - } - int[] itemIdArr = JsonConvert.DeserializeObject(itemIdArrStr); - int[] itemAmountArr = JsonConvert.DeserializeObject(itemAmountArrStr); - List itemNameList = new List(); - - - if (target.HasData("inTrade") && target.GetData("inTrade") == true) - { - ChatService.SendMessage(client, $"~r~[FEHLER] ~w~{target.Name} befindet sich bereits in einem Handel."); - return; - } - int inventoryWeight = 0; - using (var context = new DatabaseContext()) - { - int targetInvWeight = GetUserInventoryWeight(target); - - for (int i = 0; i < itemIdArr.Length; i++) - { - int itemId = itemIdArr[i]; - int itemAmount = itemAmountArr[i]; - UserItem uitem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); - IItem iItem = GetItemById(uitem.ItemId); - var currentItemWeight = iItem.Gewicht * itemAmount; - inventoryWeight += currentItemWeight; - } - if (((targetInvWeight + inventoryWeight) / 1000) > 40) - { - ChatService.ErrorMessage(client, "Handel kann nicht getätigt werden."); - return; - } - - for (int x = 0; x < itemIdArr.Length; x++) - { - int itemId = itemIdArr[x]; - int itemAmount = itemAmountArr[x]; - UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); - if (item.Amount - itemAmount > 0) - { - item.Amount -= itemAmount; - } - else - { - context.UserItems.Remove(item); - } - IItem iItem = GetItemById(itemId); - itemNameList.Add(iItem.Name); - context.SaveChanges(); - } - } - ChatService.SendMessage(client, $"~b~Du hast eine Handelsanfrage an {target.Name} gesendet."); - TradeItems[user.Id] = (itemIdArr, itemAmountArr); - TradeValue[user.Id] = value; - target.SetData("tradePartner", user.Id); - target.SetData("trade", client.Name); - SendTradeOffer(target, client); - target.TriggerEvent("addTradeItems", itemIdArr, itemAmountArr, itemNameList.ToArray(), inventoryWeight); - } - - public void SendTradeOffer(Player client, Player sender) - { - client.SetData("inTrade", true); - sender.SetData("inTrade", true); - ChatService.SendMessage(client, $"~b~ Du hast eine Handelsanfrage von {sender.Name} bekommen."); - client.SetSharedData("tradeOffer", JsonConvert.SerializeObject(1)); - User user = sender.GetUser(); - Timer tradeTimer = new Timer(30000); - TradeTimer[user.Id] = tradeTimer; - tradeTimer.Start(); - tradeTimer.Elapsed += (s, e) => { SendBackToSender(sender); client.SetData("inTrade", false); sender.SetData("inTrade", false); client.SetSharedData("tradeOffer", JsonConvert.SerializeObject(0)); }; - } - - public void SendBackToSender(Player client) - { - User user = client.GetUser(); - ChatService.SendMessage(client, "Dein Handelspartner hat die Anfrage nicht angenommen."); - (int[] itemIdArr, int[] itemAmountArr) = TradeItems[user.Id]; - Timer timer = TradeTimer[user.Id]; - timer.Stop(); - using (var context = new DatabaseContext()) - { - for (int x = 0; x < itemIdArr.Length; x++) - { - int itemId = itemIdArr[x]; - int itemAmount = itemAmountArr[x]; - UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); - if (item != null) - { - item.Amount += itemAmount; - } - else - { - var newItem = new UserItem - { - ItemId = itemId, - UserId = user.Id, - Amount = itemAmount, - Slot = -1 - }; - - context.UserItems.Add(newItem); - } - context.SaveChanges(); - } - } - } - - [RemoteEvent("declineTrade")] - public void ServerEvent_declineTrade(Player client) - { - client.SetSharedData("tradeOffer", JsonConvert.SerializeObject(0)); - if (!client.GetData("inTrade")) - { - ChatService.ErrorMessage(client, "Das Handelsangebot ist abgelaufen."); - return; - } - string name = client.GetData("trade"); - Player target = PlayerService.GetPlayerByNameOrId(name); - if (target == null || !target.IsLoggedIn()) - { - ChatService.PlayerNotFound(client); - return; - } - - client.SetData("inTrade", false); - target.SetData("inTrade", false); - SendBackToSender(target); - } - - public static void OpenTradeAccept(Player client) - { - User user = client.GetUser(); - int id = client.GetData("tradePartner"); - (int[] itemIdArr, int[] itemAmountArr) = TradeItems[id]; - Timer tradeTimer = TradeTimer[id]; - tradeTimer.Stop(); - tradeTimer.Start(); - client.TriggerEvent("openTradeWindow", TradeValue[id], itemIdArr, itemAmountArr); - } - - [RemoteEvent("acceptTrade")] - public void ServerEvent_AcceptTrade(Player client) - { - if (!client.GetData("inTrade")) - { - ChatService.ErrorMessage(client, "Das Handelsangebot ist abgelaufen."); - return; - } - client.SetSharedData("tradeOffer", JsonConvert.SerializeObject(0)); - client.SetData("inTrade", false); - - User user = client.GetUser(); - int id = client.GetData("tradePartner"); - (int[] itemIdArr, int[] itemAmountArr) = TradeItems[id]; - Timer tradeTimer = TradeTimer[id]; - tradeTimer.Stop(); - string name = client.GetData("trade"); - Player target = PlayerService.GetPlayerByNameOrId(name); - if (target == null || !target.IsLoggedIn()) - { - ChatService.PlayerNotFound(client); - return; - } - target.SetData("inTrade", false); - - using (var context = new DatabaseContext()) - { - - int targetInvWeight = GetUserInventoryWeight(client); - int inventoryWeight = 0; - for (int i = 0; i < itemIdArr.Length; i++) - { - int itemId = itemIdArr[i]; - int itemAmount = itemAmountArr[i]; - UserItem uitem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); - IItem iItem = GetItemById(uitem.ItemId); - var currentItemWeight = iItem.Gewicht * itemAmount; - inventoryWeight += currentItemWeight; - } - if (((targetInvWeight + inventoryWeight) / 1000) > 40) - { - ChatService.ErrorMessage(client, "Handel kann nicht getätigt werden."); - return; - } - - for (int x = 0; x < itemIdArr.Length; x++) - { - int itemId = itemIdArr[x]; - int itemAmount = itemAmountArr[x]; - UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); - if (item != null) - { - item.Amount += itemAmount; - } - else - { - var newItem = new UserItem - { - ItemId = itemId, - UserId = user.Id, - Amount = itemAmount, - Slot = -1 - }; - - context.UserItems.Add(newItem); - } - context.SaveChanges(); - } - } - ChatService.SendMessage(target, $"{client.Name} hat deine Anfrage angenommen."); - - } - [RemoteEvent("SERVER:BuyItems")] public void SrvEvent_BuyItem(Player client, string itemName) { @@ -897,7 +608,6 @@ namespace ReallifeGamemode.Server.Managers dbContext.SaveChanges(); client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney); } - } } } diff --git a/ReallifeGamemode.Server/Managers/JobManager.cs b/ReallifeGamemode.Server/Managers/JobManager.cs index 26567d3c..77e13636 100644 --- a/ReallifeGamemode.Server/Managers/JobManager.cs +++ b/ReallifeGamemode.Server/Managers/JobManager.cs @@ -1,4 +1,8 @@ -using GTANetworkAPI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; @@ -147,7 +151,6 @@ namespace ReallifeGamemode.Server.Managers } }; } - } //JobPoint nearJobPoint = PositionManager.JobPoints.Find(p => p.Position.DistanceTo(player.Position) <= 2); if (u.JobId == 2 || u.JobId == 3 || u.JobId == 4) @@ -531,7 +534,6 @@ namespace ReallifeGamemode.Server.Managers } } - [RemoteEvent("CLIENT:JobManager_TaxiJob_AcceptCall")] public void TaxiJobAcceptCall(Player player, string name) { diff --git a/ReallifeGamemode.Server/Managers/LoadManager.cs b/ReallifeGamemode.Server/Managers/LoadManager.cs index 99f6889c..cd389753 100644 --- a/ReallifeGamemode.Server/Managers/LoadManager.cs +++ b/ReallifeGamemode.Server/Managers/LoadManager.cs @@ -14,7 +14,6 @@ namespace ReallifeGamemode.Server.Managers { public class LoadManager : Script { - [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { diff --git a/ReallifeGamemode.Server/Managers/PedManager.cs b/ReallifeGamemode.Server/Managers/PedManager.cs new file mode 100644 index 00000000..0a176366 --- /dev/null +++ b/ReallifeGamemode.Server/Managers/PedManager.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using GTANetworkAPI; +using Newtonsoft.Json; +using ReallifeGamemode.Database.Entities.Saves; +using ReallifeGamemode.Database.Models; + +namespace ReallifeGamemode.Server.Managers +{ + public class PedManager : Script + { + private List pedDatas = new List(); + public static List serverPeds = new List(); + private static Dictionary> dataDict = new Dictionary>(); + private void GetPedsFromDatabase() + { + using (var dbContext = new DatabaseContext()) + { + serverPeds = dbContext.Peds.Where(x => x.HashModel != null).ToList(); + } + } + + private List FindDataThroughPlayer(Player player) + { + if (!dataDict.ContainsKey(player)) return null; + return dataDict[player]; + } + + [ServerEvent(Event.PlayerConnected)] + public void LoadServerPedForPlayer(Player player) + { + if (serverPeds.Count == 0) + GetPedsFromDatabase(); + List vector3s = new List(); + List headings = new List(); + List hashes = new List(); + List dimensions = new List(); + pedDatas = new List(); + foreach (var s in serverPeds) + { + if (!s.Active) continue; + Vector3 vector3 = new Vector3(s.PositionX, s.PositionY, s.PositionZ); + pedDatas.Add(new PedData(player, (DataType)s.Type, vector3, s.Heading, s.HashModel)); + + vector3s.Add(vector3); + headings.Add(s.Heading); + hashes.Add(s.HashModel); + dimensions.Add(s.Dimension); + } + dataDict[player] = pedDatas; + Console.WriteLine($"[DEBUG] DATA ADDED - PED Data registered :{dataDict.Count}"); + + player.TriggerEvent("SERVER:CreateStaticPeds", JsonConvert.SerializeObject(vector3s.ToArray()), JsonConvert.SerializeObject(headings.ToArray()), JsonConvert.SerializeObject(hashes.ToArray()), JsonConvert.SerializeObject(dimensions.ToArray())); + } + + [ServerEvent(Event.PlayerDisconnected)] + public void RemovePlayerPedDataOnDc(Player player, DisconnectionType type, string reason) + { + List data = FindDataThroughPlayer(player); + if (data == null) return; + dataDict.Remove(player); + Console.WriteLine($"[DEBUG] DATA REMOVED - PED Data left :{dataDict.Count}"); + } + } + + public enum DataType : int + { + WeponDealPed, + DepartmentPed, + PrisonPed + } + + public class PedData + { + private DataType type; + public Player player; + public Vector3 vector3; + public float heading; + public string HashModel; + + public PedData(Player player, DataType type, Vector3 vector3, float heading, string HashModel) + { + this.player = player; + this.type = type; + this.vector3 = vector3; + this.heading = heading; + this.HashModel = HashModel; + } + + public DataType getType() + { + return type; + } + } +} diff --git a/ReallifeGamemode.Server/Managers/PositionManager.cs b/ReallifeGamemode.Server/Managers/PositionManager.cs index 35e418db..9d70f7da 100644 --- a/ReallifeGamemode.Server/Managers/PositionManager.cs +++ b/ReallifeGamemode.Server/Managers/PositionManager.cs @@ -214,6 +214,7 @@ namespace ReallifeGamemode.Server.Managers #endregion JobPoints #region Shops + foreach (var shop in ShopManager.clotheStores) { shop.LoadClothes(); @@ -232,7 +233,6 @@ namespace ReallifeGamemode.Server.Managers NAPI.TextLabel.CreateTextLabel("Kleiderladen - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0); } - foreach (var shop in ShopManager.itemShops) { shop.LoadItems(); @@ -262,12 +262,70 @@ namespace ReallifeGamemode.Server.Managers } } +public static class MarkerBehinVehicle +{ + public static List behindVehiclePoints = new List(); + + public static bool HasMarkerBehind(this Vehicle vehicle) + { + BehindVehiclePoint point = behindVehiclePoints.Find(v => v.vehicle == vehicle); + if (point != null) + { + return true; + } + return false; + } + + public static void RemoveMarkerBehind(this Vehicle vehicle) + { + BehindVehiclePoint point = behindVehiclePoints.Find(v => v.vehicle == vehicle); + point.marker.Delete(); + point.textLabel.Delete(); + behindVehiclePoints.Remove(point); + } + + public static void AddMarkerBehind(this Vehicle vehicle, Vector3 vector3) + { + Marker marker = NAPI.Marker.CreateMarker(1, vector3, new Vector3(), new Vector3(), 2, new Color(255, 255, 255, 70)); + TextLabel textLabel = NAPI.TextLabel.CreateTextLabel("Dr\u00fccke ~y~E~s~ um zu benutzen", new Vector3(vector3.X, vector3.Y, vector3.Z + 1.4), 7, 1, 0, new Color(255, 255, 255), false, 0); + BehindVehiclePoint behindVehiclePoint = new BehindVehiclePoint(vehicle, marker, textLabel); + behindVehiclePoints.Add(behindVehiclePoint); + } +} + public class DutyPoint { public Vector3 Position { get; set; } public int FactionId { get; set; } } +public class BehindVehiclePoint +{ + public Vehicle vehicle { get; set; } + public Marker marker { get; set; } + public TextLabel textLabel { get; set; } + + public BehindVehiclePoint(Vehicle vehicle, Marker marker, TextLabel textLabel) + { + this.vehicle = vehicle; + this.marker = marker; + this.textLabel = textLabel; + } + + public void usePoint(Player player) + { + if (vehicle.HasData("WeaponDealLoad") && vehicle.GetData("WeaponDealLoad") == true) + { + if (!player.HasAttachment("ammobox")) + { + player.PlayAnimation("anim@heists@box_carry@", "idle", 49); + player.AddAttachment("ammobox", false); + NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed); + } + } + } +} + public class WeaponPoint { public Vector3 Position { get; set; } @@ -283,14 +341,12 @@ public class ClotheshopPoint { public Vector3 Position { get; set; } public ClotheShop clotheShop { get; set; } - } public class ItemshopPoint { public Vector3 Position { get; set; } public ItemShop itemShop { get; set; } - } public class JobPoint @@ -307,4 +363,3 @@ public class ElevatorPoint public int FactionId { get; set; } public string Stage { get; set; } } - diff --git a/ReallifeGamemode.Server/Managers/SaveManager.cs b/ReallifeGamemode.Server/Managers/SaveManager.cs index 3059e607..7dc79981 100644 --- a/ReallifeGamemode.Server/Managers/SaveManager.cs +++ b/ReallifeGamemode.Server/Managers/SaveManager.cs @@ -1,17 +1,16 @@ -using GTANetworkAPI; -using ReallifeGamemode.Server.Business; +using System; +using GTANetworkAPI; +using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities.Saves; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; -using System; -using Newtonsoft.Json; +using ReallifeGamemode.Server.Business; +using ReallifeGamemode.Server.Extensions; namespace ReallifeGamemode.Server.Managers { public class SaveManager : Script { - [RemoteEvent("OnSaveBlipData")] public static void OnSaveBlipData(Player player, string blipSprite, string blipName, string blipScale, string blipColor, string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension) diff --git a/ReallifeGamemode.Server/Managers/ShopManager.cs b/ReallifeGamemode.Server/Managers/ShopManager.cs index 2b5762c7..2ff820c6 100644 --- a/ReallifeGamemode.Server/Managers/ShopManager.cs +++ b/ReallifeGamemode.Server/Managers/ShopManager.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Database.Entities.Saves; using ReallifeGamemode.Database.Models; @@ -12,25 +10,25 @@ namespace ReallifeGamemode.Server.Managers { public class ShopManager { - public static List clotheStores = new List(); public static List itemShops = new List(); public static void LoadClotheShops() { - using(var dbContext = new DatabaseContext()) + using (var dbContext = new DatabaseContext()) { List discount = dbContext.Blips.ToList().FindAll(s => s.Name == "Binco" || s.Name == "Discount Store"); List midclass = dbContext.Blips.ToList().FindAll(s => s.Name == "Suburban"); List luxury = dbContext.Blips.ToList().FindAll(s => s.Name == "Ponsonbys"); - foreach(var store in discount) { + foreach (var store in discount) + { Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ); ClotheShop newShop = new ClotheShop(1, pos); clotheStores.Add(newShop); NAPI.Util.ConsoleOutput($"Loading ClotheShop {store.Name}"); } - foreach(var store in midclass) + foreach (var store in midclass) { Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ); ClotheShop newShop = new ClotheShop(2, pos); @@ -49,21 +47,19 @@ namespace ReallifeGamemode.Server.Managers public static void LoadItemShops() { - using(var dbContext = new DatabaseContext()) + using (var dbContext = new DatabaseContext()) { int id = 0; List shops = dbContext.Blips.ToList().FindAll(s => s.Name == "24/7"); - foreach(var store in shops) + foreach (var store in shops) { Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ); ItemShop newShop = new ItemShop(pos, id); - itemShops.Add(newShop); + itemShops.Add(newShop); id++; } NAPI.Util.ConsoleOutput($"Loaded {itemShops.Count}x 24/7"); - } + } } - - } } diff --git a/ReallifeGamemode.Server/Managers/TimeManager.cs b/ReallifeGamemode.Server/Managers/TimeManager.cs index ad16f961..66141180 100644 --- a/ReallifeGamemode.Server/Managers/TimeManager.cs +++ b/ReallifeGamemode.Server/Managers/TimeManager.cs @@ -1,8 +1,6 @@ -using GTANetworkAPI; -using System; -using System.Collections.Generic; -using System.Text; +using System; using System.Timers; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Managers { diff --git a/ReallifeGamemode.Server/Managers/TuningManager.cs b/ReallifeGamemode.Server/Managers/TuningManager.cs index 4076cbc1..eecbef81 100644 --- a/ReallifeGamemode.Server/Managers/TuningManager.cs +++ b/ReallifeGamemode.Server/Managers/TuningManager.cs @@ -1,13 +1,13 @@ -using GTANetworkAPI; -using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Database.Models; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; +using GTANetworkAPI; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; namespace ReallifeGamemode.Server.Managers { - class TuningManager : Script + internal class TuningManager : Script { private static List tuningGarages = new List(); @@ -21,6 +21,7 @@ namespace ReallifeGamemode.Server.Managers } } } + /// /// Fügt eine Tuning-Garage zum Spiel hinzu /// @@ -58,7 +59,6 @@ namespace ReallifeGamemode.Server.Managers Vehicle veh = VehicleManager.GetVehicleFromServerVehicle(sVeh); if (veh == null) return; - veh.SetSharedData("mod18", false); using (var dbContext = new DatabaseContext()) diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index 8db1777f..9f61cb23 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -1,4 +1,5 @@ using GTANetworkAPI; +using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; @@ -783,7 +784,6 @@ namespace ReallifeGamemode.Server.Managers if (sVeh == null) continue; sVeh.DistanceDriven = (float)v.GetSharedData("drivenDistance"); - } dbContext.SaveChanges(); } @@ -804,6 +804,7 @@ namespace ReallifeGamemode.Server.Managers _serverVehicles[serverVehicle.Id] = vehicle.Handle; } + internal static void DeleteVehicle(Vehicle veh) { ServerVehicle sVeh; @@ -885,8 +886,14 @@ namespace ReallifeGamemode.Server.Managers Vehicle newVeh = serverVehicle.Spawn(vehicle); newVeh.Repair(); newVeh.Rotation = new Vector3(0, 0, serverVehicle.Heading); - NAPI.Util.ConsoleOutput("VehicleDeath: Debug 4"); } + [RemoteEvent("CLIENT:setMarkerBehindVehicle")] + public void setVectorBehindVehicle(Player player, int id, string jsonX, string jsonY, string jsonZ) + { + Vehicle vehicle = NAPI.Pools.GetAllVehicles().Find(v => v.Id == id); + Vector3 vector3 = new Vector3(Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonX)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonY)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonZ))); + vehicle.AddMarkerBehind(vector3); + } } } diff --git a/ReallifeGamemode.Server/Managers/WeaponManager.cs b/ReallifeGamemode.Server/Managers/WeaponManager.cs index e9822ed2..861ca0c8 100644 --- a/ReallifeGamemode.Server/Managers/WeaponManager.cs +++ b/ReallifeGamemode.Server/Managers/WeaponManager.cs @@ -1,11 +1,10 @@ -using GTANetworkAPI; -using System; +using System; using System.Collections.Generic; -using System.Text; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Managers { - class WeaponManager + internal class WeaponManager { private static readonly List _modWeapons = new List() { @@ -336,8 +335,6 @@ namespace ReallifeGamemode.Server.Managers { 727643628, "Ceramic Pistol"} }; - - public static bool IsValidHash(uint hash) { foreach (WeaponHash vh in Enum.GetValues(typeof(WeaponHash))) diff --git a/ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs b/ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs index 1e4aa965..f8507827 100644 --- a/ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs +++ b/ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs @@ -29,7 +29,6 @@ namespace ReallifeGamemode.Database.Migrations protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateTable( name: "Jobs", columns: table => new diff --git a/ReallifeGamemode.Server/Migrations/20190805184145_VehicleItems.cs b/ReallifeGamemode.Server/Migrations/20190805184145_VehicleItems.cs index 965b3c68..f253bca3 100644 --- a/ReallifeGamemode.Server/Migrations/20190805184145_VehicleItems.cs +++ b/ReallifeGamemode.Server/Migrations/20190805184145_VehicleItems.cs @@ -7,7 +7,6 @@ namespace ReallifeGamemode.Database.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateTable( name: "VehicleItems", columns: table => new @@ -34,17 +33,12 @@ namespace ReallifeGamemode.Database.Migrations name: "IX_VehicleItems_VehicleId", table: "VehicleItems", column: "VehicleId"); - - } protected override void Down(MigrationBuilder migrationBuilder) { - migrationBuilder.DropTable( name: "VehicleItems"); - - } } } diff --git a/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj b/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj index 221612df..ff6191e1 100644 --- a/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj +++ b/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj @@ -20,6 +20,7 @@ + all diff --git a/ReallifeGamemode.Server/Report/Report.cs b/ReallifeGamemode.Server/Report/Report.cs index 99a08ccf..ab64fdd6 100644 --- a/ReallifeGamemode.Server/Report/Report.cs +++ b/ReallifeGamemode.Server/Report/Report.cs @@ -1,22 +1,17 @@ -using GTANetworkAPI; +using System; +using System.Collections.Generic; +using GTANetworkAPI; +using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; -using ReallifeGamemode.Server.Finance; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; -using System; -using System.Linq; -using System.Collections; -using System.Collections.Generic; -using Newtonsoft.Json; -using ReallifeGamemode.Database; -using ReallifeGamemode.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Services; namespace ReallifeGamemode.Server.Report { - class Report : Script + internal class Report : Script { public static List listReports = new List(); @@ -27,7 +22,6 @@ namespace ReallifeGamemode.Server.Report client.TriggerEvent("showReportType"); //ChatService.BroadcastAdmin("Eingehendes Ticket von " + client.Name + ": " + message + " (Benutze /showtickets)", AdminLevel.ADMIN); - } [Command("showtickets", "~m~Benutzung: ~s~/showtickets")] @@ -64,10 +58,8 @@ namespace ReallifeGamemode.Server.Report return; } client.TriggerEvent("showReportMenu", JsonConvert.SerializeObject(listPlayers), JsonConvert.SerializeObject(listTicketnames)); - } - [RemoteEvent("acceptReport")] public void AcceptReport(Player admin, string playerName) { @@ -75,7 +67,6 @@ namespace ReallifeGamemode.Server.Report if (player == null) return; - for (int a = 0; a < listReports.Count; a++) { ReportManage temp = listReports[a]; @@ -155,7 +146,6 @@ namespace ReallifeGamemode.Server.Report { userIsAdmin = true; } - } //Für User if ((!client.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) || userIsAdmin) @@ -241,7 +231,6 @@ namespace ReallifeGamemode.Server.Report break; } } - } } } diff --git a/ReallifeGamemode.Server/Report/ReportManage.cs b/ReallifeGamemode.Server/Report/ReportManage.cs index 6b2da7ab..d7f8a02b 100644 --- a/ReallifeGamemode.Server/Report/ReportManage.cs +++ b/ReallifeGamemode.Server/Report/ReportManage.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Report { - class ReportManage + internal class ReportManage { private String user; private String admin; @@ -29,6 +27,7 @@ namespace ReallifeGamemode.Server.Report { return this.admin; } + public bool isAssigned() { return this.assigned; @@ -38,6 +37,7 @@ namespace ReallifeGamemode.Server.Report { return this.user; } + public String getReporttext() { return this.reportText; diff --git a/ReallifeGamemode.Server/Services/ChatService.cs b/ReallifeGamemode.Server/Services/ChatService.cs index 834ce0bf..0ae98467 100644 --- a/ReallifeGamemode.Server/Services/ChatService.cs +++ b/ReallifeGamemode.Server/Services/ChatService.cs @@ -1,14 +1,12 @@ -using GTANetworkAPI; -using ReallifeGamemode.Database; +using System.Collections.Generic; +using System.Linq; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Types; using ReallifeGamemode.Server.Util; -using System; -using System.Collections.Generic; -using System.Linq; /** * @overview Life of German Reallife - Chat Service (ChatService.cs) @@ -18,7 +16,7 @@ using System.Linq; namespace ReallifeGamemode.Server.Services { - class ChatService + internal class ChatService { public static void NotAuthorized(Player player) { @@ -99,6 +97,7 @@ namespace ReallifeGamemode.Server.Services } }); } + public static void BroadcastDutyAdmin(string message) { NAPI.Pools.GetAllPlayers().ForEach(p => diff --git a/ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs b/ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs index b2502396..1357c925 100644 --- a/ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs +++ b/ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; @@ -25,18 +23,19 @@ namespace ReallifeGamemode.Server.Shop.SevenEleven public void LoadItems() { - using(var dbContext = new DatabaseContext()) + using (var dbContext = new DatabaseContext()) { shopItems = dbContext.ShopItems.ToList().FindAll(i => i.ShopId == id); } } + public void LoadShopNUI(Player client) { List itemList = shopItems.ToList().FindAll(s => s.Amount > 0); List items = new List(); - foreach(var item in itemList) + foreach (var item in itemList) { - items.Add(InventoryManager.GetItemById(item.ItemId)); + items.Add(InventoryManager.GetItemById(item.ItemId)); } client.TriggerEvent("itemMenu:updateData", JsonConvert.SerializeObject(items.ToArray())); } diff --git a/ReallifeGamemode.Server/Util/AttachmentSync.cs b/ReallifeGamemode.Server/Util/AttachmentSync.cs new file mode 100644 index 00000000..f659b550 --- /dev/null +++ b/ReallifeGamemode.Server/Util/AttachmentSync.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using GTANetworkAPI; + +public static class AttachmentSync +{ + /// + /// Adds/Removes an attachment for an entity + /// + /// The entity to attach the object to + /// The attachment, should be in string or long type + /// Pass true to remove the specified attachment, false otherwise. + public static void AddAttachment(this Entity entity, dynamic attachment, bool remove) + { + if (!entity.HasData("Attachments")) + entity.SetData("Attachments", new List()); + + List currentAttachments = entity.GetData>("Attachments"); + + uint attachmentHash = 0; + + if (attachment.GetType() == typeof(string)) + attachmentHash = NAPI.Util.GetHashKey(attachment); + else + attachmentHash = Convert.ToUInt32(attachment); + + if (attachmentHash == 0) + { + Console.WriteLine($"Attachment hash couldn't be found for { attachment }"); + return; + } + + if (currentAttachments.IndexOf(attachmentHash) == -1) // if current attachment hasn't already been added + { + if (!remove) // if it needs to be added + { + currentAttachments.Add(attachmentHash); + } + } + else if (remove) // if it was found and needs to be removed + { + currentAttachments.Remove(attachmentHash); + } + + // send updated data to playerside + entity.SetSharedData("attachmentsData", currentAttachments.Serialize()); + } + + /// + /// Returns true if an entity has a certain attachment + /// + /// The entity to check + /// The attachment to look for + /// True if attachment was found, false otherwise + public static bool HasAttachment(this Entity entity, dynamic attachment) + { + if (!entity.HasData("Attachments")) + return false; + + List currentAttachments = entity.GetData>("Attachments"); + + uint attachmentHash = 0; + + if (attachment.GetType() == typeof(string)) + attachmentHash = NAPI.Util.GetHashKey(attachment); + else + attachmentHash = Convert.ToUInt32(attachment); + + if (attachmentHash == 0) + { + Console.WriteLine($"Attachment hash couldn't be found for { attachment }"); + return false; + } + + return currentAttachments.IndexOf(attachmentHash) != -1; + } + + /// + /// Clears the entity's current attachments + /// + /// The entity to clear the attachments of + public static void ClearAttachments(this Entity entity) + { + if (!entity.HasData("Attachments")) + return; + + List currentAttachments = entity.GetData>("Attachments"); + + if (currentAttachments.Count > 0) + { + for (int i = currentAttachments.Count - 1; i >= 0; i--) + { + entity.AddAttachment(currentAttachments[i], true); + } + } + + entity.ResetSharedData("attachmentsData"); + entity.SetData("Attachments", new List()); + } + + /// + /// Serializes a list of attachments + /// + /// a list of attachments in uint type + /// serialized attachment string + public static string Serialize(this List attachments) + { + return string.Join('|', attachments.Select(a => Base36Extensions.ToBase36(a)).ToArray()); + } +} + +public class AttachmentSyncExample : Script +{ + //REQUIRED + [ServerEvent(Event.PlayerConnected)] + public void OnPlayerConnect(Player player) + { + // reset data on connect + player.ClearAttachments(); + player.TriggerEvent("SERVER:LoadAttachments"); + } + + //REQUIRED + [RemoteEvent("staticAttachments.Add")] + private void OnStaticAttachmentAdd(Player player, string hash) + { + player.AddAttachment(Base36Extensions.FromBase36(hash), false); + } + + //REQUIRED + [RemoteEvent("staticAttachments.Remove")] + private void OnStaticAttachmentRemove(Player player, string hash) + { + player.AddAttachment(Base36Extensions.FromBase36(hash), true); + } + + [Command("xdd")] + public void attachment(Player player) + { + Vehicle veh = player.Vehicle; + if (!veh.HasAttachment("weapondeal")) + { + veh.AddAttachment("weapondeal", false); + //veh.AddAttachment("weapondeal1", false); + //veh.AddAttachment("weapondeal2", false); + } + else + { + veh.ClearAttachments(); + } + } +} diff --git a/ReallifeGamemode.Server/Util/CheckPointHandle.cs b/ReallifeGamemode.Server/Util/CheckPointHandle.cs index a0de0c8b..2baeaf81 100644 --- a/ReallifeGamemode.Server/Util/CheckPointHandle.cs +++ b/ReallifeGamemode.Server/Util/CheckPointHandle.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using ReallifeGamemode.Server.Services; -using GTANetworkAPI; using System.Linq; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Job; @@ -42,6 +40,7 @@ namespace ReallifeGamemode.Server.Util playerHandle.LastCheckpoint = 2; }*/ } + public static void RemovePlayerHandlerFromList(Player player) { CheckPointListForPlayer temp = null; @@ -283,6 +282,7 @@ namespace ReallifeGamemode.Server.Util { player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player, 0, this.delay, this.markerID, this.markerSize, this.markerDist, this.useVehicle, this.eventInCheckpoint); } + public void NextCheckpoint() { this.checkPointsDone++; diff --git a/ReallifeGamemode.Server/Util/Converter.cs b/ReallifeGamemode.Server/Util/Converter.cs index 7b282d58..709ad2e1 100644 --- a/ReallifeGamemode.Server/Util/Converter.cs +++ b/ReallifeGamemode.Server/Util/Converter.cs @@ -1,8 +1,5 @@ -using GTANetworkAPI; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; +using System.Globalization; +using GTANetworkAPI; namespace ReallifeGamemode.Server.Util { diff --git a/ReallifeGamemode.Server/Util/DatabaseHelper.cs b/ReallifeGamemode.Server/Util/DatabaseHelper.cs index 64b08ef6..7713bd5f 100644 --- a/ReallifeGamemode.Server/Util/DatabaseHelper.cs +++ b/ReallifeGamemode.Server/Util/DatabaseHelper.cs @@ -1,10 +1,10 @@ -using GTANetworkAPI; +using System.Linq; +using GTANetworkAPI; using ReallifeGamemode.Database.Models; -using System.Linq; namespace ReallifeGamemode.Server.Util { - class DatabaseHelper + internal class DatabaseHelper { public static void InitDatabaseFirstTime() { diff --git a/ReallifeGamemode.Server/Util/FactionHelper.cs b/ReallifeGamemode.Server/Util/FactionHelper.cs index 2170afee..c1565cac 100644 --- a/ReallifeGamemode.Server/Util/FactionHelper.cs +++ b/ReallifeGamemode.Server/Util/FactionHelper.cs @@ -8,7 +8,7 @@ using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Util { - class FactionHelper + internal class FactionHelper { public static void CheckFactionBankAccounts() { diff --git a/ReallifeGamemode.Server/Util/FactionRankHelper.cs b/ReallifeGamemode.Server/Util/FactionRankHelper.cs index 20df8fe4..93a5438c 100644 --- a/ReallifeGamemode.Server/Util/FactionRankHelper.cs +++ b/ReallifeGamemode.Server/Util/FactionRankHelper.cs @@ -1,17 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; namespace ReallifeGamemode.Server.Util { - class FactionRankHelper + internal class FactionRankHelper { public string FactionName { get; set; } public int FactionId { get; set; } public List Ranks { get; set; } } - class Rank + internal class Rank { public int Id { get; set; } public string Name { get; set; } diff --git a/ReallifeGamemode.Server/Util/GlobalHelper.cs b/ReallifeGamemode.Server/Util/GlobalHelper.cs index 64c637fc..160e1207 100644 --- a/ReallifeGamemode.Server/Util/GlobalHelper.cs +++ b/ReallifeGamemode.Server/Util/GlobalHelper.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Collections; +using System.Collections.Generic; using GTANetworkAPI; namespace ReallifeGamemode.Server.Util diff --git a/ReallifeGamemode.Server/Util/IndicatorData.cs b/ReallifeGamemode.Server/Util/IndicatorData.cs index 891232a0..7260cd11 100644 --- a/ReallifeGamemode.Server/Util/IndicatorData.cs +++ b/ReallifeGamemode.Server/Util/IndicatorData.cs @@ -5,4 +5,4 @@ public bool Left { get; set; } = false; public bool Right { get; set; } = false; } -} \ No newline at end of file +} diff --git a/ReallifeGamemode.Server/Util/TaxiContract.cs b/ReallifeGamemode.Server/Util/TaxiContract.cs index e3794840..91943f6c 100644 --- a/ReallifeGamemode.Server/Util/TaxiContract.cs +++ b/ReallifeGamemode.Server/Util/TaxiContract.cs @@ -1,7 +1,4 @@ using GTANetworkAPI; -using System; -using System.Collections.Generic; -using System.Text; namespace ReallifeGamemode.Server.Util { diff --git a/ReallifeGamemode.Server/Util/ThreadTimers.cs b/ReallifeGamemode.Server/Util/ThreadTimers.cs index d960a370..608fca2d 100644 --- a/ReallifeGamemode.Server/Util/ThreadTimers.cs +++ b/ReallifeGamemode.Server/Util/ThreadTimers.cs @@ -1,18 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Timers; -using ReallifeGamemode.Server.Wanted; +using System.Timers; using ReallifeGamemode.Server.Finance; -using ReallifeGamemode.Server.WeaponDeal; using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Wanted; +using ReallifeGamemode.Server.WeaponDeal; namespace ReallifeGamemode.Server.Util { public class ThreadTimers { - private static Timer timer500 = new Timer(500); //0.5 seconds timer private static Timer timer2500 = new Timer(2500); //2.5 seconds timer private static Timer timer10000 = new Timer(10000); // 10 second timer diff --git a/ReallifeGamemode.Server/Util/TransactionResult.cs b/ReallifeGamemode.Server/Util/TransactionResult.cs index dc8c2265..ed0bc493 100644 --- a/ReallifeGamemode.Server/Util/TransactionResult.cs +++ b/ReallifeGamemode.Server/Util/TransactionResult.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ReallifeGamemode.Server.Util +namespace ReallifeGamemode.Server.Util { public enum TransactionResult { diff --git a/ReallifeGamemode.Server/Wanted/Autowanted.cs b/ReallifeGamemode.Server/Wanted/Autowanted.cs index 34d06eb3..bb708f31 100644 --- a/ReallifeGamemode.Server/Wanted/Autowanted.cs +++ b/ReallifeGamemode.Server/Wanted/Autowanted.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; +using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; @@ -27,7 +24,6 @@ namespace ReallifeGamemode.Server.Wanted dbContext.SaveChanges(); } } - } } } diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index b96eb264..3f4ec861 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Factions.Medic; -using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Services; using System.Diagnostics; @@ -135,7 +134,6 @@ namespace ReallifeGamemode.Server.Wanted } } - /* public static void JailTimer() { @@ -150,6 +148,7 @@ namespace ReallifeGamemode.Server.Wanted //jailIn.Elapsed += JailIn_Elapsed; } */ + public static void JailIn_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) @@ -170,9 +169,7 @@ namespace ReallifeGamemode.Server.Wanted Check_PutBehindBars(player); } } - } - } } } @@ -195,7 +192,6 @@ namespace ReallifeGamemode.Server.Wanted dbContext.SaveChanges(); Jailtime.Remove(user.Id); } - } } } @@ -207,7 +203,6 @@ namespace ReallifeGamemode.Server.Wanted User user = player.GetUser(); if (user != null && Jailtime.ContainsKey(user.Id)) { - if (user.JailTime <= 0) { Jailtime.Remove(user.Id); @@ -238,7 +233,6 @@ namespace ReallifeGamemode.Server.Wanted player.Health = 100; } } - } } @@ -252,7 +246,6 @@ namespace ReallifeGamemode.Server.Wanted User user = player.GetUser(); if (Jailtime.ContainsKey(user.Id)) { - Jailtime.Remove(user.Id); using (var dbContext = new DatabaseContext()) { @@ -273,7 +266,6 @@ namespace ReallifeGamemode.Server.Wanted User user = target.GetUser(); if (Jailtime.ContainsKey(user.Id)) { - Jailtime.Remove(user.Id); using (var dbContext = new DatabaseContext()) { diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs index 7174274a..0585ed28 100644 --- a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs +++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs @@ -1,19 +1,14 @@ -/*** +/*** @overview Life of German - Wanted (Wanted.cs) @author kookroach -@copyright (c) 2008 - 2019 Life of German +@copyright (c) 2008 - 2019 Life of German */ - -using System; using System.Collections.Generic; -using System.Text; -using System.Threading; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; -using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Server.Extensions; namespace ReallifeGamemode.Server.Wanted { @@ -28,6 +23,7 @@ namespace ReallifeGamemode.Server.Wanted //timer.Elapsed += Timer_Elapsed; } */ + public static void ResetWantedTimeToElapse(Player client) { User user = client.GetUser(); @@ -60,7 +56,6 @@ namespace ReallifeGamemode.Server.Wanted //Schriftzug 'abgetaucht' zerstören :( isNearCop = true; break; - } //Hier abgetaucht schriftzug einfügen :) } @@ -82,12 +77,15 @@ namespace ReallifeGamemode.Server.Wanted case null: player.SetSharedData("blipColor", 0); break; + case 8: player.SetSharedData("blipColor", 83); break; + case 7: player.SetSharedData("blipColor", 52); break; + case 4: player.SetSharedData("blipColor", 5); break; @@ -95,7 +93,6 @@ namespace ReallifeGamemode.Server.Wanted } dbContext.SaveChanges(); } - } if (!isNearCop) diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs index edaf7db0..6d9218ff 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs @@ -1,14 +1,12 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Managers; -using System.Linq; using ReallifeGamemode.Server.Services; -using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.WeaponDeal { @@ -36,12 +34,55 @@ namespace ReallifeGamemode.Server.WeaponDeal ChatService.ErrorMessage(client, "Der Transporter ist zu weit entfernt"); return; } + WeaponDealPoints.factionWeaponDeal[user.FactionId.Value] = -1; + Vector3 vector; + vector = WeaponDealPoints.getRndWD_Route(client.GetUser().FactionId.Value); + if (vector == new Vector3()) + return; + fVeh.SetData("weaponDealPoint", vector); + if (user.Faction.WeaponDealTime <= 0) { - ChatService.BroadcastFaction("Die albanische Mafia hat einen Deal mit deiner Fraktion abgemacht!", user.Faction); - ChatService.SendMessage(client, "Steige in den Burrito ein und fahre zum Waffendeal."); + int i = 0; + string msg = ""; + foreach (var point in WeaponDealPoints.WT_Route) + { + i++; + if (point != vector) + continue; + + switch (i) + { + case 1: + msg = "Die albanische Mafia hat einen Waffendeal mit uns abgemacht."; + break; + + case 2: + msg = "Die Lost MC scheint wieder im Waffen-Business aktiv zu sein."; + break; + + case 3: + msg = "Ein paar hochrangige Militärs der U.S. Armee versuchen alte sowjetische Waffen los zu werden."; + break; + + case 4: + msg = "Die russische Mafia kann uns mit östliche Importe beliefern."; + break; + + case 5: + msg = "Die albanische Mafia will wohl wieder Geschäfte mit uns machen."; + break; + + case 6: + msg = "Die Waffen von den Russen waren schon immer zuverlässig..."; + break; + } + } + + ChatService.BroadcastFaction($"~y~[WAFFENDEAL]~s~ {msg}", user.Faction); + ChatService.SendMessage(client, "~y~[WAFFENDEAL]~s~ Steige in den Burrito ein und fahre zum Waffendeal."); fVeh.SetData("weaponDeal", true); - WeaponDealPoints.factionWeaponDeal[user.FactionId.Value] = -1; + InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh); Faction fac = context.Factions.Where(f => f.Id == user.FactionId).FirstOrDefault(); fac.WeaponDealTime = 60; context.SaveChanges(); @@ -61,6 +102,7 @@ namespace ReallifeGamemode.Server.WeaponDeal timer.Elapsed += Timer_Elapsed; } */ + public static void Timer_Elapsed() { using (var context = new DatabaseContext()) @@ -73,9 +115,14 @@ namespace ReallifeGamemode.Server.WeaponDeal } context.SaveChanges(); } - } + [ServerEvent(Event.PlayerWeaponSwitch)] + public void OnPlayerWeaponSwitch(Player player, WeaponHash oldWeapon, WeaponHash newWeapon) + { + if (!player.HasAttachment("ammobox")) return; + NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed); + } [RemoteEvent("loadWeaponTransport")] public void SrvEVENT_loadWeaponTransport(Player client) @@ -97,20 +144,18 @@ namespace ReallifeGamemode.Server.WeaponDeal fVeh.SetData("WeaponDealLoad", true); InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh); Random rnd = new Random(); - var owners = factionVehicle.GetOwners(); + int oMembers = NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn() && p.GetUser(context).FactionId == user.FactionId).Count(); - if (owners.Contains(8) || owners.Contains(7)) + if (factionVehicle.GetOwners().Contains(8) || factionVehicle.GetOwners().Contains(7)) { - VehicleItem item = new VehicleItem() { ItemId = 11, VehicleId = factionVehicle.Id, Amount = rnd.Next(45, 75) }; //pistole - InventoryManager.AddItemToVehicleInventory(client, item, fVeh); - VehicleItem item3 = new VehicleItem() { ItemId = 14, VehicleId = factionVehicle.Id, Amount = rnd.Next(30, 40) }; //Pumpe - InventoryManager.AddItemToVehicleInventory(client, item3, fVeh); - VehicleItem item2 = new VehicleItem() { ItemId = 16, VehicleId = factionVehicle.Id, Amount = rnd.Next(5, 15) }; //Schutzweste - InventoryManager.AddItemToVehicleInventory(client, item2, fVeh); + VehicleItem item = new VehicleItem() { ItemId = 11, VehicleId = factionVehicle.Id, Amount = rnd.Next(3, 5) * oMembers }; //pistole + InventoryManager.AddItemToVehicleInventory(fVeh, item.ItemId, item.Amount); + VehicleItem item3 = new VehicleItem() { ItemId = 14, VehicleId = factionVehicle.Id, Amount = rnd.Next(1, 4) * oMembers }; //Pumpe + InventoryManager.AddItemToVehicleInventory(fVeh, item3.ItemId, item3.Amount); + VehicleItem item2 = new VehicleItem() { ItemId = 16, VehicleId = factionVehicle.Id, Amount = 1 * oMembers }; //Schutzweste + InventoryManager.AddItemToVehicleInventory(fVeh, item2.ItemId, item2.Amount); } - } - } } } diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs index 8d3ffdf1..769c343d 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; using System.Linq; -using ReallifeGamemode.Database.Entities; +using GTANetworkAPI; namespace ReallifeGamemode.Server.WeaponDeal { @@ -11,8 +9,7 @@ namespace ReallifeGamemode.Server.WeaponDeal { public static Dictionary factionWeaponDeal = new Dictionary(); - - private static readonly IReadOnlyCollection WT_Route = new List + public static readonly IReadOnlyCollection WT_Route = new List { //new Vector3(2465.163, 1589.396, 32.72029), ungeeignet new Vector3(1532.045, 1702.775, 109.7561), //Hütte iwo Östlich