Mafia Connected support

This commit is contained in:
Vortrex
2021-08-14 20:49:47 -05:00
parent ebd8a91c87
commit 4fe9c45e0a
39 changed files with 2084 additions and 1669 deletions

View File

@@ -89,77 +89,81 @@ function saveSubAccountToDatabase(subAccountData) {
let safeLastName = escapeDatabaseString(dbConnection, subAccountData.lastName);
let safeMiddleName = escapeDatabaseString(dbConnection, subAccountData.middleName);
let dbQueryString = `
UPDATE sacct_main SET
sacct_name_first='${safeFirstName}',
sacct_name_last='${safeLastName}',
sacct_name_middle='${safeMiddleName}',
sacct_cash=${subAccountData.cash},
sacct_when_lastlogin=${subAccountData.lastLogin},
sacct_pos_x=${subAccountData.spawnPosition.x},
sacct_pos_y=${subAccountData.spawnPosition.y},
sacct_pos_z=${subAccountData.spawnPosition.z},
sacct_angle=${subAccountData.spawnHeading},
sacct_int=${subAccountData.interior},
sacct_vw=${subAccountData.dimension},
sacct_inhouse=${(subAccountData.inHouse != 0) ? getHouseData(subAccountData.inHouse).databaseId : 0},
sacct_inbusiness=${(subAccountData.inBusiness != 0) ? getBusinessData(subAccountData.inBusiness).databaseId : 0},
sacct_health=${subAccountData.health},
sacct_armour=${subAccountData.armour}
WHERE sacct_id=${subAccountData.databaseId}`;
let data = [
//["sacct_svr", getServerId()],
["sacct_acct", subAccountData.account],
["sacct_name_first", safeFirstName],
["sacct_name_last", safeLastName],
["sacct_name_middle", safeMiddleName],
["sacct_cash", subAccountData.cash],
["sacct_when_lastlogin", subAccountData.lastLogin],
["sacct_pos_x", subAccountData.spawnPosition.x],
["sacct_pos_y", subAccountData.spawnPosition.x],
["sacct_pos_z", subAccountData.spawnPosition.z],
["sacct_rot_z", subAccountData.spawnHeading],
["sacct_int", subAccountData.interior],
["sacct_vw", subAccountData.dimension],
["sacct_inhouse", (subAccountData.inHouse != 0) ? getHouseData(subAccountData.inHouse).databaseId : 0],
["sacct_inbusiness", (subAccountData.inBusiness != 0) ? getBusinessData(subAccountData.inBusiness).databaseId : 0],
["sacct_health", subAccountData.health],
["sacct_armour", subAccountData.armour],
];
//dbQueryString = dbQueryString.trim();
dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, "");
let dbQuery = queryDatabase(dbConnection, dbQueryString);
let dbQuery = null;
let queryString = createDatabaseUpdateQuery("sacct_main", data, `sacct_id=${subAccountData.databaseId}`);
dbQuery = queryDatabase(dbConnection, queryString);
freeDatabaseQuery(dbQuery);
let data2 = [
//["sacct_svr_svr", getServerId()],
["sacct_svr_sacct", subAccountData.databaseId],
["sacct_svr_job", subAccountData.job],
//["sacct_svr_job_rank", getServerId()],
["sacct_svr_clan", subAccountData.clan],
["sacct_svr_clan_rank", subAccountData.clanRank],
["sacct_svr_clan_tag", safeClanTag],
["sacct_svr_clan_title", safeClanTitle],
["sacct_svr_clan_flags", subAccountData.clanFlags],
["sacct_svr_scale_x", subAccountData.pedScale.x],
["sacct_svr_scale_y", subAccountData.pedScale.y],
["sacct_svr_scale_z", subAccountData.pedScale.z],
["sacct_svr_skin", subAccountData.skin],
["sacct_svr_fightstyle", subAccountData.fightStyle],
["sacct_svr_walkstyle", subAccountData.walkStyle],
["sacct_svr_hd_part_hair_model", subAccountData.bodyParts.hair[0]],
["sacct_svr_hd_part_hair_texture", subAccountData.bodyParts.hair[1]],
["sacct_svr_hd_part_head_model", subAccountData.bodyParts.head[0]],
["sacct_svr_hd_part_head_texture", subAccountData.bodyParts.head[1]],
["sacct_svr_hd_part_upper_model", subAccountData.bodyParts.upper[0]],
["sacct_svr_hd_part_upper_texture", subAccountData.bodyParts.upper[1]],
["sacct_svr_hd_part_lower_model", subAccountData.bodyParts.lower[0]],
["sacct_svr_hd_part_lower_texture", subAccountData.bodyParts.lower[1]],
["sacct_svr_hd_prop_hair_model", subAccountData.bodyProps.hair[0]],
["sacct_svr_hd_prop_hair_texture", subAccountData.bodyProps.hair[1]],
["sacct_svr_hd_prop_eyes_model", subAccountData.bodyProps.eyes[0]],
["sacct_svr_hd_prop_eyes_texture", subAccountData.bodyProps.eyes[1]],
["sacct_svr_hd_prop_head_model", subAccountData.bodyProps.head[0]],
["sacct_svr_hd_prop_head_texture", subAccountData.bodyProps.head[1]],
["sacct_svr_hd_prop_lefthand_model", subAccountData.bodyProps.leftHand[0]],
["sacct_svr_hd_prop_lefthand_texture", subAccountData.bodyProps.leftHand[1]],
["sacct_svr_hd_prop_righthand_model", subAccountData.bodyProps.rightHand[0]],
["sacct_svr_hd_prop_righthand_texture", subAccountData.bodyProps.rightHand[1]],
["sacct_svr_hd_prop_leftwrist_model", subAccountData.bodyProps.leftWrist[0]],
["sacct_svr_hd_prop_leftwrist_texture", subAccountData.bodyProps.leftWrist[1]],
["sacct_svr_hd_prop_rightwrist_model", subAccountData.bodyProps.rightWrist[0]],
["sacct_svr_hd_prop_rightwrist_texture", subAccountData.bodyProps.rightWrist[1]],
["sacct_svr_hd_prop_hip_model", subAccountData.bodyProps.hip[0]],
["sacct_svr_hd_prop_hip_texture",subAccountData.bodyProps.hip[1]],
["sacct_svr_hd_prop_leftfoot_model", subAccountData.bodyProps.leftFoot[0]],
["sacct_svr_hd_prop_leftfoot_texture", subAccountData.bodyProps.leftFoot[1]],
["sacct_svr_hd_prop_rightfoot_model", subAccountData.bodyProps.rightFoot[0]],
["sacct_svr_hd_prop_rightfoot_texture", subAccountData.bodyProps.rightFoot[1]],
];
dbQuery = null;
dbQueryString = `
UPDATE sacct_svr SET
sacct_svr_job=${subAccountData.job},
sacct_svr_clan=${subAccountData.clan},
sacct_svr_clan_rank=${subAccountData.clanRank},
sacct_svr_clan_tag='${safeClanTag}',
sacct_svr_clan_title='${safeClanTitle}',
sacct_svr_clan_flags=${subAccountData.clanFlags},
sacct_svr_scale_x=${subAccountData.pedScale.x},
sacct_svr_scale_y=${subAccountData.pedScale.y},
sacct_svr_scale_z=${subAccountData.pedScale.z},
sacct_svr_skin=${subAccountData.skin},
sacct_svr_fightstyle=${subAccountData.fightStyle},
sacct_svr_walkstyle=${subAccountData.walkStyle},
sacct_svr_hd_part_hair_model=${subAccountData.bodyParts.hair[0]},
sacct_svr_hd_part_hair_texture=${subAccountData.bodyParts.hair[1]},
sacct_svr_hd_part_head_model=${subAccountData.bodyParts.head[0]},
sacct_svr_hd_part_head_texture=${subAccountData.bodyParts.head[1]},
sacct_svr_hd_part_upper_model=${subAccountData.bodyParts.upper[0]},
sacct_svr_hd_part_upper_texture=${subAccountData.bodyParts.upper[1]},
sacct_svr_hd_part_lower_model=${subAccountData.bodyParts.lower[0]},
sacct_svr_hd_part_lower_texture=${subAccountData.bodyParts.lower[1]},
sacct_svr_hd_prop_hair_model=${subAccountData.bodyProps.hair[0]},
sacct_svr_hd_prop_hair_texture=${subAccountData.bodyProps.hair[1]},
sacct_svr_hd_prop_eyes_model=${subAccountData.bodyProps.eyes[0]},
sacct_svr_hd_prop_eyes_texture=${subAccountData.bodyProps.eyes[1]},
sacct_svr_hd_prop_head_model=${subAccountData.bodyProps.head[0]},
sacct_svr_hd_prop_head_texture=${subAccountData.bodyProps.head[1]},
sacct_svr_hd_prop_lefthand_model=${subAccountData.bodyProps.leftHand[0]},
sacct_svr_hd_prop_lefthand_texture=${subAccountData.bodyProps.leftHand[1]},
sacct_svr_hd_prop_righthand_model=${subAccountData.bodyProps.rightHand[0]},
sacct_svr_hd_prop_righthand_texture=${subAccountData.bodyProps.rightHand[1]},
sacct_svr_hd_prop_leftwrist_model=${subAccountData.bodyProps.leftWrist[0]},
sacct_svr_hd_prop_leftwrist_texture=${subAccountData.bodyProps.leftWrist[1]},
sacct_svr_hd_prop_rightwrist_model=${subAccountData.bodyProps.rightWrist[0]},
sacct_svr_hd_prop_rightwrist_texture=${subAccountData.bodyProps.rightWrist[1]},
sacct_svr_hd_prop_hip_model=${subAccountData.bodyProps.hip[0]},
sacct_svr_hd_prop_hip_texture=${subAccountData.bodyProps.hip[1]},
sacct_svr_hd_prop_leftfoot_model=${subAccountData.bodyProps.leftFoot[0]},
sacct_svr_hd_prop_leftfoot_texture=${subAccountData.bodyProps.leftFoot[1]},
sacct_svr_hd_prop_rightfoot_model=${subAccountData.bodyProps.rightFoot[0]},
sacct_svr_hd_prop_rightfoot_texture=${subAccountData.bodyProps.rightFoot[1]}
WHERE sacct_svr_sacct=${subAccountData.databaseId} AND sacct_svr_server = ${getServerId()}`;
dbQueryString = dbQueryString.replace(/(?:\r\n|\r|\n|\t)/g, "");
dbQuery = queryDatabase(dbConnection, dbQueryString);
queryString = "";
queryString = createDatabaseUpdateQuery("sacct_svr", data2, `sacct_svr_sacct=${subAccountData.databaseId} AND sacct_svr_server = ${getServerId()}`);
dbQuery = queryDatabase(dbConnection, queryString);
freeDatabaseQuery(dbQuery);
disconnectFromDatabase(dbConnection);