diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-10 01:28:29 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-10 01:28:29 -0300 |
commit | 91538c6e6784c9baf2961f4aed314bd60556d041 (patch) | |
tree | ec5a84248e39e389dbfbf7ab6f1da004eb97adc0 | |
parent | 19ea058c8b33a4b4b631c815e10561528bc5d9bb (diff) | |
download | serverdata-91538c6e6784c9baf2961f4aed314bd60556d041.tar.gz serverdata-91538c6e6784c9baf2961f4aed314bd60556d041.tar.bz2 serverdata-91538c6e6784c9baf2961f4aed314bd60556d041.tar.xz serverdata-91538c6e6784c9baf2961f4aed314bd60556d041.zip |
Move faction utils to their own file (to don't make util.txt too messy)
-rw-r--r-- | npc/functions/faction.txt | 104 | ||||
-rw-r--r-- | npc/functions/util.txt | 85 | ||||
-rw-r--r-- | npc/scripts.conf | 1 |
3 files changed, 105 insertions, 85 deletions
diff --git a/npc/functions/faction.txt b/npc/functions/faction.txt new file mode 100644 index 00000000..19450df9 --- /dev/null +++ b/npc/functions/faction.txt @@ -0,0 +1,104 @@ +// The Mana World: rEvolt functions. +// Authors: +// Jesusalva +// Description: +// Faction utils +// Factions: +// THIEF / MAGE / LEGION / BROTHERHOOD +// Variables: +// FACTION_REP +// Your reputation with the faction (ally, friendly, cordial, enemy, ...) +// FACTION_EXP +// Your personal experience (=skill with the faction dealings) +// FACTION_RANK +// Your "level" in the faction, a mix of both above. + + +// Returns, based on a 1-5 range, the title for ranking systems (system guilds) +// legionrank() / brotherrank() / thiefrank() / magerank() +function script legionrank { + switch (LEGION_RANK) { + case 5: return l("Constable"); + case 4: return l("Tengu"); + case 3: return l("Terranite"); + case 2: return l("Fluffy"); + case 1: return l("Maggot"); + case 0: return l("Citizen"); + default: return l("Error"); + } +} +function script brotherrank { + switch (BROTHERHOOD_RANK) { + case 5: return l("Administrator"); + case 4: return l("Senior Developer"); + case 3: return l("Game Master"); + case 2: return l("Developer"); + case 1: return l("Contributor"); + case 0: return l("Citizen"); + default: return l("Error"); + } +} +function script thiefrank { + switch (THIEF_RANK) { + case 5: return l("Bandit Lord"); + case 4: return l("Assassin"); + case 3: return l("Rogue"); + case 2: return l("Bandit"); + case 1: return l("Thief"); + case 0: return l("Citizen"); + default: return l("Error"); + } +} +function script magerank { + switch (MAGE_RANK) { + case 5: return l("Elder Mage"); + case 4: return l("Great Mage"); + case 3: return l("Arch Mage"); + case 2: return l("Mage"); + case 1: return l("Initiate"); + case 0: return l("Citizen"); + default: return l("Error"); + } +} + +// faction_addrep( faction, amount ) +// Returns a dialog which can be used with mesc() or dispbottom() +function script faction_addrep { + .@fac$=strtoupper(getarg(0)); + .@old=getd(.@fac$+"_REP"); + setd(.@fac$+"_REP", .@old+getarg(1)); + if (getarg(1) > 0) + return l("Reputation with %s Faction UP (+%d)!", getarg(0), getarg(1)); + else + return l("Reputation with %s Faction DOWN (%d)!", getarg(0), getarg(1)); + + return; +} + +// Returns standing with faction (THIEF/MAGE/LEGION/BROTHERHOOD) +// An integer from 3 (ally) to -3 (enemy). Standings based on Hands of War; +// faction_standing( faction{, integer=True} ) +function script faction_standing { + .@fac$=strtoupper(getarg(0)); + .@ret=getarg(1, true); + .@rep=getd(.@fac$+"_REP"); + if (.@rep > 1000) { + return (.@ret ? 3 : "Ally"); // 1001 ~ inf. + } else if (.@rep > 500) { + return (.@ret ? 2 : "Friendly"); // 501 ~ 1000 + } else if (.@rep > 100) { + return (.@ret ? 1 : "Cordial"); // 101 ~ 500 + } else if (.@rep >= -100) { + return (.@ret ? 0 : "Neutral"); // -100 ~ +100 + } else if (.@rep > -500) { + return (.@ret ? -1 : "Unfriendly"); // -101 ~ -500 + } else if (.@rep > -1000) { + return (.@ret ? -2 : "Enemy"); // -501 ~ -1000 + } else { + return (.@ret ? -3 : "Nemesis"); // -1001 ~ inf + } + +} +// TODO: faction_checklvup() + + diff --git a/npc/functions/util.txt b/npc/functions/util.txt index ee040c4c..8e263eb0 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -106,91 +106,6 @@ function script get_race { return .@allskins$[.@g] + " " + .@allraces$[.@g]; } -// Returns, based on a 1-5 range, the title for ranking systems (system guilds) -// legionrank() / brotherrank() / thiefrank() / magerank() -function script legionrank { - switch (LEGION_RANK) { - case 5: return l("Constable"); - case 4: return l("Tengu"); - case 3: return l("Terranite"); - case 2: return l("Fluffy"); - case 1: return l("Maggot"); - case 0: return l("Citizen"); - default: return l("Error"); - } -} -function script brotherrank { - switch (BROTHERHOOD_RANK) { - case 5: return l("Administrator"); - case 4: return l("Senior Developer"); - case 3: return l("Game Master"); - case 2: return l("Developer"); - case 1: return l("Contributor"); - case 0: return l("Citizen"); - default: return l("Error"); - } -} -function script thiefrank { - switch (THIEF_RANK) { - case 5: return l("Bandit Lord"); - case 4: return l("Assassin"); - case 3: return l("Rogue"); - case 2: return l("Bandit"); - case 1: return l("Thief"); - case 0: return l("Citizen"); - default: return l("Error"); - } -} -function script magerank { - switch (MAGE_RANK) { - case 5: return l("Elder Mage"); - case 4: return l("Great Mage"); - case 3: return l("Arch Mage"); - case 2: return l("Mage"); - case 1: return l("Initiate"); - case 0: return l("Citizen"); - default: return l("Error"); - } -} -// faction_addrep( faction, amount ) -// THIEF / MAGE / LEGION / BROTHERHOOD -function script faction_addrep { - .@fac$=strtoupper(getarg(0)); - .@old=getd(.@fac$+"_REP"); - setd(.@fac$+"_REP", .@old+getarg(1)); - if (getarg(1) > 0) - return l("Reputation with %s Faction UP (+%d)!", getarg(0), getarg(1)); - else - return l("Reputation with %s Faction DOWN (%d)!", getarg(0), getarg(1)); - - return; -} -// Returns standing with faction (THIEF/MAGE/LEGION/BROTHERHOOD) -// An integer from 3 (ally) to -3 (enemy). Standings based on Hands of War; -// faction_standing( faction{, integer=True} ) -function script faction_standing { - .@fac$=strtoupper(getarg(0)); - .@ret=getarg(1, true); - .@rep=getd(.@fac$+"_REP"); - if (.@rep > 1000) { - return (.@ret ? 3 : "Ally"); // 1001 ~ inf. - } else if (.@rep > 500) { - return (.@ret ? 2 : "Friendly"); // 501 ~ 1000 - } else if (.@rep > 100) { - return (.@ret ? 1 : "Cordial"); // 101 ~ 500 - } else if (.@rep >= -100) { - return (.@ret ? 0 : "Neutral"); // -100 ~ +100 - } else if (.@rep > -500) { - return (.@ret ? -1 : "Unfriendly"); // -101 ~ -500 - } else if (.@rep > -1000) { - return (.@ret ? -2 : "Enemy"); // -501 ~ -1000 - } else { - return (.@ret ? -3 : "Nemesis"); // -1001 ~ inf - } - -} -// TODO: faction_checklvup() - // gettimeparam(GETTIME_X) // Returns the number of seconds/minutes/hours/days/months/years since 01/01/1970 // This is for truly daily quests, which doesn't imposes a timed wait in hours diff --git a/npc/scripts.conf b/npc/scripts.conf index f233f1c6..38597700 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -52,6 +52,7 @@ // May rely on custom functions and thus must be handled by last "npc/functions/util.txt", +"npc/functions/faction.txt", "npc/functions/scoreboards.txt", "npc/functions/manhole.txt", "npc/functions/skills.txt", |