AOC_PRC8/_module/nss/arena_scoreboard.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

252 lines
6.8 KiB
Plaintext

#include "rank"
void main()
{
// Get the first player
object oPC = GetLastUsedBy();
//object oPC = GetFirstPC();
object oMod = GetModule();
float fPerc;
int iHeav;
int iHell;
int iDied;
int iKilled;
int hVLoss;
int hLLoss;
int iHit;
int iPCdamage;
int iHvcas;
int iHlcas;
int iHvTotCas;
int iHlTotCas;
int aDamage;
int iDice;
int iSwing;
int iHitPerc;
int iHWkills;
int iHWdeaths;
int iHWdam;
int iHWhit;
int iHWswing;
int iHWPCkillTot;
int iHWPCdeathTot;
int iSwitch = GetLocalInt(oMod, "score_switch");
int iChamp = GetLocalInt(oPC, "champ_won");
int iRankNo = GetLocalInt(oPC, "status");
string sPRes2;
string sPRes;
string oRank;
string oDam;
string iMessage;
string SpeakText;
string sChamp = GetLocalString(oMod, "sChamp");
if (GetLocalInt(oMod, "mod_mode")==1)
{
PlaySound("sim_cntresist");
FloatingTextStringOnCreature
("*** Not used in campaign manager mode ***", oPC);
return;
}
PlaySound("gui_select");
//generate message
iDice = d8();
switch(iDice)
{
case 1: {iMessage = "Victory is written in blood!";}break;
case 2: {iMessage = "Winning a war is about making others die for their country!";}break;
case 3: {iMessage = "A stained soul is a remorseless weapon!";}break;
case 4: {iMessage = "Honour and glory are mortal enemies!";}break;
case 5: {iMessage = "A strong sword is useless to a weak heart!";}break;
case 6: {iMessage = "A blunt sword and a sharp wit are better than the converse!";}break;
case 7: {iMessage = "Love and war know nothing true of each other!";}break;
case 8: {iMessage = "Good and evil can not exist without each other!";}break;
case 9: {iMessage = "The blood of the earth begets the blood of mankind!";}break;
case 10: {iMessage = "Indifference is the true enemy of hatred!";}break;
}
if (iChamp==1)
{iMessage = "Congratulations! You are the Holy War Champion";}
if (iSwitch==1)
{
iHvcas = GetLocalInt(oMod, "heav_cas");
iHlcas = GetLocalInt(oMod, "hell_cas");
iHeav = GetLocalInt (oMod,"heav_score");
iHell = GetLocalInt (oMod,"hell_score");
hVLoss = GetLocalInt(oMod, "heav_loss");
hLLoss = GetLocalInt(oMod, "hell_loss");
iHvTotCas = GetLocalInt(oMod, "iHvTotCas");
iHlTotCas = GetLocalInt(oMod, "iHlTotCas");
SpeakText = "\n====== Holy War ======\n";
SpeakText += "The Champions of Light\n\n";
SpeakText += "Wins/Losses: ";
SpeakText += IntToString(iHeav);
SpeakText += " / ";
SpeakText += IntToString(hVLoss);
SpeakText += "\nCurrent Casualties: ";
SpeakText += IntToString(iHvcas);
SpeakText += "\nTOTAL Casualties: ";
SpeakText += IntToString(iHvTotCas);
SpeakText += "\n\n-----------------------\n";
SpeakText += "The Champions of Darkness\n\n";
SpeakText += "Wins/Losses: ";
SpeakText += IntToString(iHell);
SpeakText += " / ";
SpeakText += IntToString(hLLoss);
SpeakText += "\nCurrent Casualties: ";
SpeakText += IntToString(iHlcas);
SpeakText += "\nTOTAL Casualties: ";
SpeakText += IntToString(iHlTotCas);
SpeakText += "\n--------------------------\n";
SpeakText += sChamp;
SpeakString(SpeakText);
}
else if (iSwitch==2)
{
// initialise stat integers
sPRes = GetResRef(oPC);
sPRes2 =sPRes+"_HWd";
sPRes+="_HWk";
iHWkills = GetLocalInt(oMod, sPRes);
iHWdeaths = GetLocalInt(oMod, sPRes2);
iHWdam = GetLocalInt(oPC, "pc_HWdam");
iHWswing = GetLocalInt(oPC, "pc_HWswing");
iHWhit = GetLocalInt(oPC, "pc_HWhit");
iHWPCkillTot = GetLocalInt(oPC, "iHWPCkillTot");
iHWPCdeathTot = GetLocalInt(oPC, "iHWPCdeathTot");
// Get player rank details
GetRank(oPC);
// Calculate average damage (divide by zero will crash the script)
if (iHWhit!=0)
{aDamage = iHWdam / iHWhit;}
else
{aDamage = 0;}
// Calculate Hit %
if (iHWswing!=0)
{
fPerc = (IntToFloat(iHWhit) / IntToFloat(iHWswing)) * 100.0;
iHitPerc = FloatToInt(fPerc);
}
else
{iHitPerc=0;}
// generate text for scoreboard
SpeakText = "\n====== Holy War Stats======\n";
SpeakText += GetName(oPC);
SpeakText += "\n--------------------------\n";
SpeakText += "Rank: "+IntToString(iRankNo)+". ";
SpeakText += GetLocalString(oPC, "rank");
SpeakText += "\n\nKills: ";
SpeakText += IntToString(iHWkills);
SpeakText += " ("+IntToString(iHWPCkillTot)+")";
SpeakText += "\nDeaths: ";
SpeakText += IntToString(iHWdeaths);
SpeakText += " ("+IntToString(iHWPCdeathTot)+")";
SpeakText += "\nHits: ";
SpeakText += IntToString(iHWhit);
SpeakText += "\nAccuracy: ";
SpeakText += IntToString(iHitPerc);
SpeakText += "%";
SpeakText += "\nTotal Damage: ";
SpeakText += IntToString(iHWdam);
SpeakText += "\nAverage Damage: ";
SpeakText += IntToString(aDamage);
SpeakText += "\n--------------------------\n";
SpeakText += iMessage;
// Display the scoreboard details
SpeakString(SpeakText);
}
else
{
// Get player rank details
GetRank(oPC);
// initialise stat integers
iDied = GetLocalInt (oPC,"iDied");
iKilled = GetLocalInt (oPC,"iKilled");
iPCdamage = GetLocalInt(oPC, "player_dd");
iHit = GetLocalInt(oPC, "pc_hit");
iSwing = GetLocalInt(oPC, "pc_swing");
// Calculate average damage (divide by zero will crash the script)
if (iHit!=0)
{aDamage = iPCdamage / iHit;}
else {aDamage = 0;}
// Calculate Hit %
if (iSwing!=0)
{
fPerc = (IntToFloat(iHit) / IntToFloat(iSwing)) * 100.0;
iHitPerc = FloatToInt(fPerc);
}
else
{iHitPerc=0;}
// generate text for scoreboard
SpeakText = "\n====================\n";
SpeakText += GetName(oPC);
SpeakText += "\n--------------------\n";
SpeakText += "Rank: "+IntToString(iRankNo)+". ";
SpeakText += GetLocalString(oPC, "rank");
SpeakText += "\n\nKills: ";
SpeakText += IntToString(iKilled);
SpeakText += "\nDeaths: ";
SpeakText += IntToString(iDied);
SpeakText += "\nHits: ";
SpeakText += IntToString(iHit);
SpeakText += "\nAccuracy: ";
SpeakText += IntToString(iHitPerc);
SpeakText += "%";
SpeakText += "\nTotal Damage: ";
SpeakText += IntToString(iPCdamage);
SpeakText += "\nAverage Damage: ";
SpeakText += IntToString(aDamage);
SpeakText += "\n\n--------------------\n";
SpeakText += iMessage;
// Display the scoreboard details
SpeakString(SpeakText);
}
}
// <StartAction>[Reset Holy War Scores]</Start> <StartHighlight>[Reset Holy War Scores]</Start>