diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-08 22:18:37 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-08 22:18:37 -0300 |
commit | 49cd686d3ceb8f066c6caf1fa2b78dbe1f49101d (patch) | |
tree | 0713d99a54c65657c2e6a662e25c4fc1aef305ec | |
parent | a4adaaa99d29d1ed693cf1ce34cc133213fbd143 (diff) | |
download | serverdata-49cd686d3ceb8f066c6caf1fa2b78dbe1f49101d.tar.gz serverdata-49cd686d3ceb8f066c6caf1fa2b78dbe1f49101d.tar.bz2 serverdata-49cd686d3ceb8f066c6caf1fa2b78dbe1f49101d.tar.xz serverdata-49cd686d3ceb8f066c6caf1fa2b78dbe1f49101d.zip |
Add a function to obtain a simplified faction standing.
This is getting offtopic...
-rw-r--r-- | npc/functions/util.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 1bcaa2bb..c16b0d7c 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -160,6 +160,30 @@ function script faction_addrep { setd(.@fac$+"_REP", .@old+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"); + } else if (.@rep > 500) { + return (.@ret ? 2 : "Friendly"); + } else if (.@rep > 100) { + return (.@ret ? 1 : "Cordial"); + } else if (.@rep > -100) { + return (.@ret ? 0 : "Neutral"); + } else if (.@rep < -100) { + return (.@ret ? -1 : "Unfriendly"); + } else if (.@rep < -500) { + return (.@ret ? -2 : "Enemy"); + } else if (.@rep < -1000) { + return (.@ret ? -3 : "Nemesis"); + } + +} // TODO: faction_checklvup() // gettimeparam(GETTIME_X) |