Fix clan owner command
This commit is contained in:
@@ -311,7 +311,7 @@ function deleteClanCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setClanOwnerCommand(command, params, client) {
|
function setClanOwnerCommand(command, params, client) {
|
||||||
if (!doesPlayerHaveClanPermission(client, getClanFlagValue("owner"))) {
|
if (!doesPlayerHaveClanPermission(client, getClanFlagValue("Owner"))) {
|
||||||
messagePlayerError(client, "You must be the clan owner to use this command!");
|
messagePlayerError(client, "You must be the clan owner to use this command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -334,18 +334,20 @@ function setClanOwnerCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let highestRankIndex = getHighestClanRank(clanIndex);
|
||||||
|
|
||||||
getClanData(clanIndex).owner = getPlayerCurrentSubAccount(targetClient).databaseId;
|
getClanData(clanIndex).owner = getPlayerCurrentSubAccount(targetClient).databaseId;
|
||||||
getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanIndex).databaseId;
|
getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanIndex).databaseId;
|
||||||
getPlayerCurrentSubAccount(targetClient).clanRank = getHighestClanRank(clanIndex);
|
getPlayerCurrentSubAccount(targetClient).clanIndex = getClanIndexFromDatabaseId(clanIndex);
|
||||||
getPlayerCurrentSubAccount(targetClient).clanIndex = getClanIndexFromDatabaseId(clanIndex)
|
getPlayerCurrentSubAccount(targetClient).clanRank = getClanRankData(clanIndex, highestRankIndex).databaseId;
|
||||||
getPlayerCurrentSubAccount(targetClient).clanRankIndex = getClanRankIndexFromDatabaseId(clanIndex, getPlayerCurrentSubAccount(targetClient).clanRank);
|
getPlayerCurrentSubAccount(targetClient).clanRankIndex = highestRankIndex;
|
||||||
getClanData(clanIndex).needsSaved = true;
|
getClanData(clanIndex).needsSaved = true;
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanIndex).databaseId;
|
getPlayerCurrentSubAccount(targetClient).clan = getClanData(clanIndex).databaseId;
|
||||||
getPlayerCurrentSubAccount(targetClient).clanFlags = getClanFlagValue("All");
|
getPlayerCurrentSubAccount(targetClient).clanFlags = getClanFlagValue("All");
|
||||||
|
|
||||||
//messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanIndex).name} {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
|
//messageAdmins(`{adminOrange}${getPlayerName(client)} {MAINCOLOUR}set clan {clanOrange}${getClanData(clanIndex).name} {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
|
||||||
messagePlayerSuccess(client, `You changed the clan owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
|
messagePlayerSuccess(client, `You changed clan {clanOrange}${getClanData(clanIndex).name}'s {MAINCOLOUR}owner to {ALTCOLOUR}${getCharacterFullName(targetClient)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1047,7 +1049,12 @@ function createClan(name) {
|
|||||||
let tempClan = new ClanData(false);
|
let tempClan = new ClanData(false);
|
||||||
tempClan.databaseId = getDatabaseInsertId(dbConnection);
|
tempClan.databaseId = getDatabaseInsertId(dbConnection);
|
||||||
tempClan.name = name;
|
tempClan.name = name;
|
||||||
getServerData().clans.push(tempClan);
|
let clanId = getServerData().clans.push(tempClan);
|
||||||
|
|
||||||
|
let tempDefaultRank = new ClanRankData(false);
|
||||||
|
tempDefaultRank.name = "Default Rank";
|
||||||
|
tempDefaultRank.needsSaved = true;
|
||||||
|
getServerData().clans[clanId - 1].ranks.push(tempDefaultRank);
|
||||||
|
|
||||||
setAllClanDataIndexes();
|
setAllClanDataIndexes();
|
||||||
}
|
}
|
||||||
@@ -1521,7 +1528,7 @@ function getLowestClanRank(clanIndex) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getHighestJobRank(clanIndex) {
|
function getHighestClanRank(clanIndex) {
|
||||||
let highestRank = 0;
|
let highestRank = 0;
|
||||||
for (let i in getServerData().clans[clanIndex].ranks) {
|
for (let i in getServerData().clans[clanIndex].ranks) {
|
||||||
if (getClanRankData(clanIndex, i).level > getClanRankData(clanIndex, highestRank).level) {
|
if (getClanRankData(clanIndex, i).level > getClanRankData(clanIndex, highestRank).level) {
|
||||||
@@ -1531,4 +1538,4 @@ function getHighestJobRank(clanIndex) {
|
|||||||
return highestRank;
|
return highestRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user