diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-01-22 23:10:01 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-01-22 23:10:01 -0300 |
commit | 9812a14ced434f8540b940f5da14e7b743088ed1 (patch) | |
tree | 76c6a2fbde52c7f9841ee07b2953d9adc2e67de9 /npc/functions/honor.txt | |
parent | 0b3176efa2f6846d8847d6846e538c011f7947da (diff) | |
download | serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.gz serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.bz2 serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.xz serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.zip |
Small sketch of PvP Honor System framework
Diffstat (limited to 'npc/functions/honor.txt')
-rw-r--r-- | npc/functions/honor.txt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/npc/functions/honor.txt b/npc/functions/honor.txt new file mode 100644 index 000000000..e09f6b02f --- /dev/null +++ b/npc/functions/honor.txt @@ -0,0 +1,60 @@ +// TMW2 Script +// Author: +// Jesusalva +// Description: +// PvP Honor Rank system + +// Numerical representation of player strength +// get_BR( getcharid(3) ) +function script get_BR { + .@oid=getcharid(3); + .@rid=getarg(0, .@oid); + .@br=0; + + // attachrid() and detachrid() + // readbattleparam(.@rid) + // Load + if (attachrid(.@rid)) { + .@br+=BaseLevel; + } else { + Exception("GET_BR INVALID RID "+.@rid, RB_DEBUGMES|RB_IRCBROADCAST); + } + + // Restore + detachrid(); + if (!attachrid(.@oid)) + Exception("::FATAL :: GET_BR INVALID OID "+.@oid, RB_DEBUGMES|RB_IRCBROADCAST|RB_ISFATAL); + + return .@br; +} + +// Calculate the Honor Points which are due +// calc_HR( get_BR(getcharid(3)), get_BR(killedrid) ) +function script calc_HR { + .@atk_br=getarg(0); + .@def_br=getarg(1); + .@cbase=10000; + + // Dishonorable + if (.@atk_br > .@def_br) { + .@overpower=.@atk_br*.@cbase/.@def_br; + // Honorable + } else if (.@def_br > .@atk_br) { + .@overpower=.@atk_br*.@cbase/.@def_br; + // Neutral + } else { + .@overpower=0; + } + + return 0; +} + +// getvariableofpc(HONOR, .@rid, 0) < 0 → determine if other player is bandit +// is_bandit( account id ) +function script is_bandit { + .@oid=getcharid(3); + .@rid=getarg(0, .@oid); + + return getvariableofpc(HONOR, .@rid, 0) < 0; +} + |