Add RefuseCollector Job and other misc
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
export default function gangwarHandle(globalData: IGlobalData) {
|
||||
|
||||
|
||||
export default function gangwarHandle(globalData: IGlobalData) {
|
||||
|
||||
function inside(point, vs) {
|
||||
let x = point[0],
|
||||
@@ -48,7 +50,10 @@
|
||||
attacker: string;
|
||||
blip: BlipMp;
|
||||
_colshape: ColshapeMp;
|
||||
_marker: MarkerMp;
|
||||
vector: Vector3Mp;
|
||||
value: number;
|
||||
|
||||
_status: string;
|
||||
_entered: boolean;
|
||||
_isEntering: boolean;
|
||||
@@ -60,17 +65,17 @@
|
||||
leaderBlipVector: Vector3Mp;
|
||||
leaderColShape: MarkerMp;
|
||||
|
||||
constructor(name, id, x, y, range, color, rot, owner, edit, vector) {
|
||||
this._setup(name, id, x, y, range, color, rot, owner, edit, vector);
|
||||
constructor(name, id, x, y, range, color, rot, owner, edit, vector, value) {
|
||||
this._setup(name, id, x, y, range, color, rot, owner, edit, vector, value);
|
||||
}
|
||||
|
||||
_setup(name, id, x, y, range, color, rot, owner, edit, vector) {
|
||||
|
||||
_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;
|
||||
@@ -86,12 +91,13 @@
|
||||
self.loadArea();
|
||||
self.attackBlip = null;
|
||||
self.leaderBlip = null;
|
||||
self.value = value;
|
||||
if (vector != null) {
|
||||
self.leaderBlipVector = JSON.parse(vector);
|
||||
} else {
|
||||
self.leaderBlipVector = null;
|
||||
}
|
||||
|
||||
|
||||
self.leaderColShape = null;
|
||||
}
|
||||
|
||||
@@ -123,6 +129,7 @@
|
||||
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);
|
||||
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70);
|
||||
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
||||
@@ -136,12 +143,15 @@
|
||||
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;
|
||||
}
|
||||
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
|
||||
|
||||
//self.blip.setRotation(self.rotation);
|
||||
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -192,10 +202,10 @@
|
||||
a += 0.001
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (self.isInsideArea()) {
|
||||
mp.game.graphics.drawText(self.name, [self.x, self.y, mp.players.local.position.z + 20], {
|
||||
@@ -205,7 +215,7 @@
|
||||
outline: true,
|
||||
centre: true
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,7 +223,7 @@
|
||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
||||
if (self.isInsideArea() && self._status != "attack" && dist <= 6) {
|
||||
if (self.leaderBlipVector != null) {
|
||||
mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~187", [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], {
|
||||
mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~" + self.value, [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], {
|
||||
font: 7,
|
||||
color: [255, 255, 255, 185],
|
||||
scale: [0.4, 0.4],
|
||||
@@ -223,11 +233,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@@ -246,12 +256,14 @@
|
||||
}
|
||||
self._status = "attack";
|
||||
self.attacker = args[1];
|
||||
//self.blip.setFlashes(true);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, true);
|
||||
return;
|
||||
}
|
||||
if (status == "normal") {
|
||||
self._status = "normal";
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||
//self.blip.setFlashes(false);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||
return;
|
||||
}
|
||||
if (status == "conquered") {
|
||||
@@ -259,8 +271,10 @@
|
||||
self._status = "normal";
|
||||
self.owner = args[0];
|
||||
self.attacker = null;
|
||||
//self.blip.setFlashes(false);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||
self.setColor(self.owner)
|
||||
//self.blip.setColour(self.color);
|
||||
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
|
||||
self.setLeaderColShape();
|
||||
return;
|
||||
@@ -296,19 +310,19 @@
|
||||
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
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -321,7 +335,7 @@
|
||||
}
|
||||
|
||||
check() {
|
||||
var self = this
|
||||
var self = this
|
||||
if (self._entered == true) {
|
||||
if (!self.isInsideArea() || (self.isNearGround() == false)) {
|
||||
self._entered = false;
|
||||
@@ -329,7 +343,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enter() {
|
||||
var self = this;
|
||||
self._timerCheck = setInterval(function () {
|
||||
@@ -340,8 +354,8 @@
|
||||
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) {
|
||||
@@ -350,7 +364,7 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -360,7 +374,7 @@
|
||||
leave() {
|
||||
var self = this;
|
||||
clearInterval(self._timerCheck);
|
||||
|
||||
|
||||
self.check();
|
||||
}
|
||||
isNearGround() {
|
||||
@@ -412,6 +426,11 @@
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
setValue(value) {
|
||||
var self = this;
|
||||
self.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
var gangturfs = [];
|
||||
@@ -453,23 +472,28 @@
|
||||
let last_blip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 5);
|
||||
|
||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) {
|
||||
mp.game.ui.removeBlip(last_blip);
|
||||
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1);
|
||||
mp.game.ui.removeBlip(last_blip);
|
||||
last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5);
|
||||
x++;
|
||||
mp.gui.chat.push(""+x);
|
||||
}
|
||||
|
||||
let last_attackBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 378);
|
||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_attackBlip)) {
|
||||
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_attackBlip, -1);
|
||||
mp.game.ui.removeBlip(last_attackBlip);
|
||||
last_attackBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 378);
|
||||
}
|
||||
|
||||
let last_leaderBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 437);
|
||||
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_leaderBlip)) {
|
||||
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_leaderBlip, -1);
|
||||
mp.game.ui.removeBlip(last_leaderBlip);
|
||||
last_leaderBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 437);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mp.events.add('GangAreas:Create', (turfsJSON) => {
|
||||
var turfs = JSON.parse(turfsJSON);
|
||||
if (gangturfs.length > 0) {
|
||||
@@ -481,15 +505,25 @@
|
||||
turf.leaderColShape.destroy();
|
||||
turf.leaderColShape = null;
|
||||
}
|
||||
if (turf._marker)
|
||||
if (turf.blip != null) {
|
||||
mp.game.ui.removeBlip(turf.blip);
|
||||
}
|
||||
if (turf.leaderBlip != null) {
|
||||
mp.game.ui.removeBlip(turf.leaderBlip);
|
||||
}
|
||||
if (turf.attackBlip != null) {
|
||||
mp.game.ui.removeBlip(turf.attackBlip);
|
||||
}
|
||||
});
|
||||
}
|
||||
clearBlips();
|
||||
if (turfs.length > 0) {
|
||||
|
||||
|
||||
gangturfs = [];
|
||||
turfs.forEach(function (turf) {
|
||||
if (turf.Id != undefined) {
|
||||
gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector);
|
||||
gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector, turf.Value);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -497,7 +531,7 @@
|
||||
|
||||
mp.events.add('ADMIN:CreateTurf', (rangeJSON) => {
|
||||
var range = JSON.parse(rangeJSON);
|
||||
gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null);
|
||||
gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null, 0);
|
||||
});
|
||||
|
||||
mp.events.add('ADMIN:SetTurf', (name) => {
|
||||
@@ -505,7 +539,7 @@
|
||||
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', () => {
|
||||
@@ -541,13 +575,13 @@
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
@@ -556,8 +590,17 @@
|
||||
mp.events.add('CLIENT:StartGangwar', () => {
|
||||
gangturfs.forEach(function (turf) {
|
||||
if (turf._entered == true) {
|
||||
turf.startGangWar();
|
||||
turf.startGangWar();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mp.events.add('CLIENT:UpdateTurfValue', (jsonValues) => {
|
||||
let values = JSON.parse(jsonValues);
|
||||
for (var i = 0; i < gangturfs.length; i++) {
|
||||
let turf = gangturfs[i];
|
||||
turf.setValue(values[i]);
|
||||
turf.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user