summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-01-22 23:10:01 -0300
committerJesusaves <cpntb1@ymail.com>2020-01-22 23:10:01 -0300
commit9812a14ced434f8540b940f5da14e7b743088ed1 (patch)
tree76c6a2fbde52c7f9841ee07b2953d9adc2e67de9
parent0b3176efa2f6846d8847d6846e538c011f7947da (diff)
downloadserverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.gz
serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.bz2
serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.tar.xz
serverdata-9812a14ced434f8540b940f5da14e7b743088ed1.zip
Small sketch of PvP Honor System framework
-rw-r--r--npc/functions/honor.txt60
-rw-r--r--npc/functions/hub.txt49
-rw-r--r--npc/functions/mobpoint.txt35
-rw-r--r--npc/scripts.conf1
4 files changed, 111 insertions, 34 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;
+}
+
diff --git a/npc/functions/hub.txt b/npc/functions/hub.txt
index 528473584..3c5fd8425 100644
--- a/npc/functions/hub.txt
+++ b/npc/functions/hub.txt
@@ -245,3 +245,52 @@ function script HUB_SkillInvoke {
return;
}
+
+
+
+
+
+// HUB_PvP ( ) - killedrid must be set
+function script HUB_PvP {
+ // Update global PK count
+ $PLAYERS_KILLED+=1;
+
+ // Prepare local variables
+ .@atk=get_BR(getcharid(3));
+ .@def=get_BR(killedrid);
+ .@m$=getmap();
+
+ // TODO: Start using readparam2() to read if the opponent was worthy
+ // That is, read total attack, defense, HP, evasion and hit chance
+ // And compare with your own readparam2(), then use a % and a table
+ // based on your (assassin's) level.
+ .@bxp=readparam(BaseLevel, killedrid);
+ .@jxp=readparam(JobLevel, killedrid);
+ if (compare(.@m$, "001-8")) {
+ // Quirino Voraz PVP Arena
+ // You get 5 times killed player level, and 1 time job level
+ getexp .@bxp*5, .@jxp;
+ } else if (compare(.@m$, "ARENA") || compare(.@m$, "003-13")) {
+ // Tulimshar Duel Arena
+ // You get 3 times killed player level, and 2 times job level
+ getexp .@bxp*3, .@jxp*2;
+ } else if (compare(.@m$, "001-10")) {
+ // Call Of Dusty
+ // You get 3 times killed player level, and 3 times job level
+ getexp .@bxp*3, .@jxp*3;
+ } else if (compare(.@m$, "001-10-1")) {
+ // Call Of Dusty Boss Room
+ // You _may_ get a Bottled Dusty at random, but dead player status affect
+ .@bagistr=(readparam2(bAgi, killedrid)*2)+readparam2(bDex, killedrid);
+ //.@b2=readparam(MaxHp, killedrid);
+ if (.@bagistr > 20)
+ if (rand2(0,250) < readparam2(bLuk)+readparam2(bLuk, killedrid))
+ getitem BottledDust, any(1,1,2);
+ } else {
+ // Anywhere else
+ // You get 0.5 times killed player level, and 0 times job level
+ getexp (.@bxp/2), 0;
+ }
+ return;
+}
+
diff --git a/npc/functions/mobpoint.txt b/npc/functions/mobpoint.txt
index 224515bf1..6b3fb9d93 100644
--- a/npc/functions/mobpoint.txt
+++ b/npc/functions/mobpoint.txt
@@ -65,40 +65,7 @@ OnNPCKillEvent:
// Only a few maps will give you experience for PK: Tulimshar's Guards Arena,
// Frostia Imperial PVP Arena, Call Of Dusty, Arena Quirino Voraz.
OnPCKillEvent:
- $PLAYERS_KILLED+=1;
- // killedrid
- .@m$=getmap();
- // TODO: Start using readparam2() to read if the opponent was worthy
- // That is, read total attack, defense, HP, evasion and hit chance
- // And compare with your own readparam2(), then use a % and a table
- // based on your (assassin's) level.
- .@bxp=readparam(BaseLevel, killedrid);
- .@jxp=readparam(JobLevel, killedrid);
- if (compare(.@m$, "001-8")) {
- // Quirino Voraz PVP Arena
- // You get 5 times killed player level, and 1 time job level
- getexp .@bxp*5, .@jxp;
- } else if (compare(.@m$, "ARENA") || compare(.@m$, "003-13")) {
- // Tulimshar Duel Arena
- // You get 3 times killed player level, and 2 times job level
- getexp .@bxp*3, .@jxp*2;
- } else if (compare(.@m$, "001-10")) {
- // Call Of Dusty
- // You get 3 times killed player level, and 3 times job level
- getexp .@bxp*3, .@jxp*3;
- } else if (compare(.@m$, "001-10-1")) {
- // Call Of Dusty Boss Room
- // You _may_ get a Bottled Dusty at random, but dead player status affect
- .@bagistr=(readparam2(bAgi, killedrid)*2)+readparam2(bDex, killedrid);
- //.@b2=readparam(MaxHp, killedrid);
- if (.@bagistr > 20)
- if (rand2(0,250) < readparam2(bLuk)+readparam2(bLuk, killedrid))
- getitem BottledDust, any(1,1,2);
- } else {
- // Anywhere else
- // You get 0.5 times killed player level, and 0 times job level
- getexp (.@bxp/2), 0;
- }
+ HUB_PvP();
end;
}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 1448fc947..23281646b 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -46,6 +46,7 @@
"npc/functions/fishing.txt",
"npc/functions/guild.txt",
"npc/functions/hammocks.txt",
+"npc/functions/honor.txt",
"npc/functions/lockpicks.txt",
"npc/functions/marriage.txt",
"npc/functions/mobpoint.txt",