455 lines
13 KiB
Plaintext
455 lines
13 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Olander's Player Stat's
|
|
// opw_inc_pstat
|
|
// By Don Anderson
|
|
// dandersonru@msn.com
|
|
//
|
|
// Some Player Stat Functions Originally By Invisible420...nicely done
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "nbde_inc"
|
|
|
|
// Color Variables
|
|
string RED = "<có >";
|
|
string BLUE = "<c ó>";
|
|
string GRAY = "<c°°°>";
|
|
string GREEN = "<c ó >";
|
|
string WHITE = "<cóóó>";
|
|
string CYAN = "<c óó>";
|
|
string YELLOW = "<cóó >";
|
|
string BLUISHG = "<c °°>";
|
|
string BLUISHR = "<c °ó>";
|
|
|
|
|
|
void ProcessPCBirthday(object oPC)
|
|
{
|
|
object oMod = GetModule();
|
|
|
|
int nTime = NBDE_GetCampaignInt("PLAYERSTATS", "PC_YEAR_START", oPC);
|
|
if (nTime == 0)
|
|
{
|
|
int nAge = GetAge(oPC);
|
|
int nYear = GetCalendarYear();
|
|
int nBorn = nYear - nAge;
|
|
int nMonth = GetCalendarMonth();
|
|
int nDay = GetCalendarDay();
|
|
int nHour = GetTimeHour();
|
|
int nTotalHours = (nYear*8760) + (nMonth*720) + (nDay*24) + nHour;
|
|
|
|
string sMonth;
|
|
switch(nMonth)
|
|
{
|
|
case 1: sMonth = GetLocalString(oMod,"MONTH1"); break;
|
|
case 2: sMonth = GetLocalString(oMod,"MONTH2"); break;
|
|
case 3: sMonth = GetLocalString(oMod,"MONTH3"); break;
|
|
case 4: sMonth = GetLocalString(oMod,"MONTH4"); break;
|
|
case 5: sMonth = GetLocalString(oMod,"MONTH5"); break;
|
|
case 6: sMonth = GetLocalString(oMod,"MONTH6"); break;
|
|
case 7: sMonth = GetLocalString(oMod,"MONTH7"); break;
|
|
case 8: sMonth = GetLocalString(oMod,"MONTH8"); break;
|
|
case 9: sMonth = GetLocalString(oMod,"MONTH9"); break;
|
|
case 10: sMonth = GetLocalString(oMod,"MONTH10"); break;
|
|
case 11: sMonth = GetLocalString(oMod,"MONTH11"); break;
|
|
case 12: sMonth = GetLocalString(oMod,"MONTH12"); break;
|
|
}
|
|
|
|
NBDE_SetCampaignInt("PLAYERSTATS", "PC_YEAR_START", nBorn, oPC);
|
|
NBDE_SetCampaignString("PLAYERSTATS", "PC_MONTH_START", sMonth, oPC);
|
|
NBDE_SetCampaignInt("PLAYERSTATS", "PC_DAY_START", nDay, oPC);
|
|
NBDE_SetCampaignInt("PLAYERSTATS", "PC_START_HOURS", nTotalHours, oPC);
|
|
}
|
|
}
|
|
|
|
void SetPCFavoriteWeapon(object oPC)
|
|
{
|
|
string sWeapName = GetName(GetLastWeaponUsed(oPC));
|
|
|
|
if(GetIsPC(oPC) == TRUE)
|
|
{
|
|
int nTimesWeapUsed = GetLocalInt(oPC, "X_WEAPUSED");
|
|
string sLWeapUsedName = GetLocalString(oPC, "L_WEAPNAME");
|
|
|
|
if(sLWeapUsedName != sWeapName)
|
|
{
|
|
SetLocalInt(oPC, "X_WEAPUSED",1 );
|
|
SetLocalString(oPC, "L_WEAPNAME", sWeapName);
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(oPC, "X_WEAPUSED", nTimesWeapUsed + 1);
|
|
if(nTimesWeapUsed >= 20)
|
|
{
|
|
NBDE_SetCampaignString("PLAYERSTATS", "FAVWEAPON", sLWeapUsedName, oPC);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SetStrongestCreatureKilled(object oPC, object oCreature)
|
|
{
|
|
string sLastCreatureName = GetName(oCreature);
|
|
int nCurrentCR = FloatToInt(GetChallengeRating(oCreature));
|
|
|
|
if (GetIsPC(oPC) == TRUE)
|
|
{
|
|
int nStrongestC = NBDE_GetCampaignInt("KILLS", "STRKILL", oPC);
|
|
|
|
if(nCurrentCR > nStrongestC)
|
|
{
|
|
NBDE_SetCampaignString("KILLS", "STRKILL", sLastCreatureName, oPC);
|
|
NBDE_SetCampaignInt("KILLS", "STRKILL", nCurrentCR, oPC);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SetAverageCR(object oPC, object oCreature)
|
|
{
|
|
int nPrevTotalCR = NBDE_GetCampaignInt("KILLS", "TOTALCR", oPC);
|
|
int nCurrentCR = FloatToInt(GetChallengeRating(oCreature));
|
|
int nNewTotalCR = nPrevTotalCR + nCurrentCR;
|
|
|
|
if (GetIsPC(oPC) == TRUE)
|
|
{
|
|
NBDE_SetCampaignInt("KILLS", "TOTALCR", nNewTotalCR, oPC);
|
|
}
|
|
}
|
|
|
|
string GetAverageCRofPlayersKills(object oPC)
|
|
{
|
|
int nTotalCRs = NBDE_GetCampaignInt("KILLS", "TOTALCR", oPC);
|
|
int nTotalK = NBDE_GetCampaignInt("KILLS", "NPC", oPC);
|
|
string sValue = "";
|
|
int nAveCR;
|
|
if (nTotalCRs == 0 || nTotalK == 0)
|
|
{
|
|
sValue = "No Average Creature CR Yet";
|
|
return sValue;
|
|
}
|
|
else
|
|
{
|
|
if(nTotalK == 0) nTotalK = 1;//Divide by Zero Issue
|
|
sValue = IntToString((nTotalCRs / nTotalK));
|
|
return sValue;
|
|
}
|
|
}
|
|
|
|
string GetTotalDeaths(object oPC)
|
|
{
|
|
int nTotalDeaths = NBDE_GetCampaignInt("SOULRUNE", "TIMES_DIED", oPC);
|
|
string sValue = "";
|
|
if (nTotalDeaths == 0) sValue = "Never Died";
|
|
else sValue = IntToString(nTotalDeaths);
|
|
return sValue;
|
|
}
|
|
|
|
string GetTotalLifes(object oPC)
|
|
{
|
|
int nTotalDeaths = NBDE_GetCampaignInt("SOULRUNE", "LIFES", oPC);
|
|
string sValue = "";
|
|
if (nTotalDeaths == 0) sValue = "No Lifes Left...Careful";
|
|
else sValue = IntToString(nTotalDeaths);
|
|
return sValue;
|
|
}
|
|
|
|
string GetTotalNPCKills(object oPC)
|
|
{
|
|
int nTotalKills = NBDE_GetCampaignInt("KILLS", "NPC", oPC);
|
|
string sValue = "";
|
|
if(nTotalKills == 0) sValue = "No Creatures Killed Yet";
|
|
else sValue = IntToString(nTotalKills);
|
|
return sValue;
|
|
}
|
|
|
|
string GetCreatureKiller(object oPC)
|
|
{
|
|
string sKiller = NBDE_GetCampaignString("KILLS", "PCKILLER", oPC);
|
|
if (sKiller == "") sKiller = "Never Killed by a Creature";
|
|
return sKiller;
|
|
}
|
|
|
|
string GetTotalPCKills(object oPC)
|
|
{
|
|
int nTotalKills = NBDE_GetCampaignInt("KILLS", "PC", oPC);
|
|
string sValue = "";
|
|
if(nTotalKills == 0) sValue = "No Players Killed Yet";
|
|
else sValue = IntToString(nTotalKills);
|
|
return sValue;
|
|
}
|
|
|
|
string GetPCKiller(object oPC)
|
|
{
|
|
string sKiller = NBDE_GetCampaignString("KILLS", "PVPNAME", oPC);
|
|
if (sKiller == "") sKiller = "Never Killed by a Player";
|
|
return sKiller;
|
|
}
|
|
|
|
string GetStrongestCreatureName(object oPC)
|
|
{
|
|
string sStrC = NBDE_GetCampaignString("KILLS", "STRKILL", oPC);
|
|
return sStrC;
|
|
}
|
|
|
|
string GetHighestCR(object oPC)
|
|
{
|
|
int nStrCKilled = NBDE_GetCampaignInt("KILLS", "STRKILL", oPC);
|
|
string sValue = IntToString(nStrCKilled);
|
|
if (nStrCKilled == 0) sValue = "No Highest Creature CR Yet";
|
|
return sValue;
|
|
}
|
|
|
|
string GetFavoriteWeapon(object oPC)
|
|
{
|
|
string sFavWeap = NBDE_GetCampaignString("PLAYERSTATS","FAVWEAPON", oPC);
|
|
if (sFavWeap == "") sFavWeap = "No Favorite Weapon Yet";
|
|
return sFavWeap;
|
|
}
|
|
|
|
string GetCharacterCreatedHours(object oPC)
|
|
{
|
|
int nStartHours = NBDE_GetCampaignInt("PLAYERSTATS", "PC_START_HOURS", oPC);
|
|
int nYear = GetCalendarYear();
|
|
int nMonth = GetCalendarMonth();
|
|
int nDay = GetCalendarDay();
|
|
int nHour = GetTimeHour();
|
|
int nCurrentHours = (nYear*8760) + (nMonth*720) + (nDay*24) + nHour;
|
|
int nNewHours = nCurrentHours - nStartHours;
|
|
if (nNewHours <= 0) return "Less Than 1 Game Hour";
|
|
if (nNewHours == 1) return "1 Game Hour";
|
|
else return IntToString(nNewHours) + " Game Hours";
|
|
}
|
|
|
|
/******************************************************************************/
|
|
//: ALIGNING FUNCTIONS
|
|
|
|
const string SKINNEUTRAL = "NeutralSkin";
|
|
const string SKINGOOD = "GoodSkin";
|
|
const string SKINEVIL = "EvilSkin";
|
|
|
|
void OAS_RemoveSkin(object oPC)
|
|
{
|
|
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
|
|
if(GetIsObjectValid(oSkin) == TRUE) DestroyObject(oSkin);
|
|
}
|
|
|
|
void OAS_GiveSkin(object oPC, string sSkin)
|
|
{
|
|
object oSkin = CreateItemOnObject(sSkin,oPC);
|
|
if(oSkin != OBJECT_INVALID) ActionEquipItem(oSkin,INVENTORY_SLOT_CARMOUR);
|
|
}
|
|
|
|
void OAS_UpdateSkin(object oPC,string sTag,string sResRef)
|
|
{
|
|
//Remove Skins from Inventory
|
|
string sIResRef;
|
|
object oISkin = GetFirstItemInInventory(oPC);
|
|
while(GetIsObjectValid(oISkin) == TRUE)
|
|
{
|
|
sIResRef = GetResRef(oISkin);
|
|
if(sIResRef == sResRef) DestroyObject(oISkin);
|
|
oISkin = GetNextItemInInventory(oPC);
|
|
}
|
|
|
|
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
|
|
string sETag = GetTag(oSkin);
|
|
|
|
//Remove Skin That is Not Part of That Allegiance and Give New One
|
|
if(sETag != sTag)
|
|
{
|
|
AssignCommand(oPC,ClearAllActions(TRUE));
|
|
AssignCommand(oPC,ActionDoCommand(OAS_RemoveSkin(oPC)));
|
|
AssignCommand(oPC,ActionDoCommand(OAS_GiveSkin(oPC,sResRef)));
|
|
}
|
|
}
|
|
|
|
void AlignEvil(object oPC)
|
|
{
|
|
//These are the Possible Allegiances for a Player
|
|
object oPackAn = GetObjectByTag("FACTION_1000");
|
|
object oHorse = GetObjectByTag("FACTION_1005");
|
|
object oEvil = GetObjectByTag("FACTION_001");
|
|
object oGood = GetObjectByTag("FACTION_002");
|
|
object oNeutral = GetObjectByTag("FACTION_003");
|
|
|
|
//Adjust Reputations
|
|
AdjustReputation(oPC,oGood,-100);
|
|
AdjustReputation(oPC,oEvil,100);
|
|
AdjustReputation(oPC,oNeutral,50);
|
|
AdjustReputation(oPC,oPackAn,50);
|
|
AdjustReputation(oPC,oHorse,50);
|
|
|
|
int nAllege = GetLocalInt(oPC,"FACTION");
|
|
if(nAllege == 0)
|
|
{
|
|
//Subrace Skins Already Here
|
|
//Now Check the Creature Skin and Save it
|
|
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
|
|
if(GetIsObjectValid(oSkin))
|
|
{
|
|
string sSkin = GetResRef(oSkin);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sSkin,oPC);
|
|
}
|
|
else
|
|
{
|
|
string sTag = SKINEVIL;
|
|
string sResRef = GetStringLowerCase(sTag);
|
|
|
|
//Give the Player the Allegiance Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sResRef,oPC);
|
|
}
|
|
}
|
|
|
|
//Only Run Once on Entering the Module
|
|
int nRR = GetLocalInt(oPC,"REPRESET_READY");
|
|
if(nAllege == 1 && nRR == 0)
|
|
{
|
|
SetLocalInt(oPC,"REPRESET_READY",1);
|
|
|
|
string sTag = SKINEVIL;
|
|
string sResRef = NBDE_GetCampaignString("ALLEGIANCE","CREATURESKIN",oPC);
|
|
|
|
//Give the Player a Fresh Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
}
|
|
}
|
|
|
|
void AlignGood(object oPC)
|
|
{
|
|
//These are the Possible Allegiances for a Player
|
|
object oPackAn = GetObjectByTag("FACTION_1000");
|
|
object oHorse = GetObjectByTag("FACTION_1005");
|
|
object oEvil = GetObjectByTag("FACTION_001");
|
|
object oGood = GetObjectByTag("FACTION_002");
|
|
object oNeutral = GetObjectByTag("FACTION_003");
|
|
|
|
//Adjust Reputations
|
|
AdjustReputation(oPC,oGood,100);
|
|
AdjustReputation(oPC,oEvil,-100);
|
|
AdjustReputation(oPC,oNeutral,50);
|
|
AdjustReputation(oPC,oPackAn,50);
|
|
AdjustReputation(oPC,oHorse,50);
|
|
|
|
int nAllege = GetLocalInt(oPC,"FACTION");
|
|
if(nAllege == 0)
|
|
{
|
|
//Subrace Skins Already Here
|
|
//Now Check the Creature Skin and Save it
|
|
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
|
|
if(GetIsObjectValid(oSkin))
|
|
{
|
|
string sSkin = GetResRef(oSkin);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sSkin,oPC);
|
|
}
|
|
else
|
|
{
|
|
string sTag = SKINGOOD;
|
|
string sResRef = GetStringLowerCase(sTag);
|
|
|
|
//Give the Player the Allegiance Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sResRef,oPC);
|
|
}
|
|
}
|
|
|
|
//Only Run Once on Entering the Module
|
|
int nRR = GetLocalInt(oPC,"REPRESET_READY");
|
|
if(nAllege == 2 && nRR == 0)
|
|
{
|
|
SetLocalInt(oPC,"REPRESET_READY",1);
|
|
|
|
string sTag = SKINGOOD;
|
|
string sResRef = NBDE_GetCampaignString("ALLEGIANCE","CREATURESKIN",oPC);
|
|
|
|
//Give the Player a Fresh Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
}
|
|
}
|
|
|
|
void AlignNeutral(object oPC)
|
|
{
|
|
//These are the Possible Allegiances for a Player
|
|
object oPackAn = GetObjectByTag("FACTION_1000");
|
|
object oHorse = GetObjectByTag("FACTION_1005");
|
|
object oEvil = GetObjectByTag("FACTION_001");
|
|
object oGood = GetObjectByTag("FACTION_002");
|
|
object oNeutral = GetObjectByTag("FACTION_003");
|
|
|
|
//Adjust Reputations
|
|
AdjustReputation(oPC,oGood,50);
|
|
AdjustReputation(oPC,oEvil,50);
|
|
AdjustReputation(oPC,oNeutral,50);
|
|
AdjustReputation(oPC,oPackAn,50);
|
|
AdjustReputation(oPC,oHorse,50);
|
|
|
|
int nAllege = GetLocalInt(oPC,"FACTION");
|
|
if(nAllege == 0)
|
|
{
|
|
//Subrace Skins Already Here
|
|
//Now Check the Creature Skin and Save it
|
|
object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
|
|
if(GetIsObjectValid(oSkin))
|
|
{
|
|
string sSkin = GetResRef(oSkin);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sSkin,oPC);
|
|
}
|
|
else
|
|
{
|
|
string sTag = SKINNEUTRAL;
|
|
string sResRef = GetStringLowerCase(sTag);
|
|
|
|
//Give the Player the Allegiance Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
NBDE_SetCampaignString("ALLEGIANCE","CREATURESKIN",sResRef,oPC);
|
|
}
|
|
}
|
|
|
|
//Only Run Once on Entering the Module
|
|
int nRR = GetLocalInt(oPC,"REPRESET_READY");
|
|
if(nAllege == 3 && nRR == 0)
|
|
{
|
|
SetLocalInt(oPC,"REPRESET_READY",1);
|
|
|
|
string sTag = SKINNEUTRAL;
|
|
string sResRef = NBDE_GetCampaignString("ALLEGIANCE","CREATURESKIN",oPC);
|
|
|
|
//Give the Player a Fresh Skin
|
|
OAS_UpdateSkin(oPC,sTag,sResRef);
|
|
}
|
|
}
|
|
|
|
//This Resets Reputations With Specified Factions (OAI Faction Reps)
|
|
void ResetReputations(object oPC)
|
|
{
|
|
int nAllege = GetLocalInt(oPC,"FACTION");
|
|
switch(nAllege)
|
|
{
|
|
case 0: break;
|
|
case 1: AlignEvil(oPC); break;
|
|
case 2: AlignGood(oPC); break;
|
|
case 3: AlignNeutral(oPC); break;
|
|
}
|
|
|
|
//Miscaneous Factions
|
|
object oPackAn = GetObjectByTag("FACTION_1000");
|
|
object oCommoner = GetObjectByTag("FACTION_1001");
|
|
object oMerchant = GetObjectByTag("FACTION_1002");
|
|
object oDefender = GetObjectByTag("FACTION_1003");
|
|
object oHostile = GetObjectByTag("FACTION_1004");
|
|
object oHorse = GetObjectByTag("FACTION_1005");
|
|
|
|
//Commoner and Merchant Special Reset
|
|
SetStandardFactionReputation(STANDARD_FACTION_COMMONER,50,oPC);
|
|
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT,50,oPC);
|
|
|
|
//Hostile Reset
|
|
SetStandardFactionReputation(STANDARD_FACTION_HOSTILE,0,oPC);
|
|
|
|
//Adjust Special Reputations
|
|
AdjustReputation(oPC,oPackAn,50);
|
|
AdjustReputation(oPC,oHorse,50);
|
|
}
|
|
|
|
//void main(){}
|