141 lines
3.9 KiB
Plaintext
141 lines
3.9 KiB
Plaintext
#include "itemupdater_inc"
|
|
#include "br_ruletokens"
|
|
#include "lod_include"
|
|
|
|
const string FIN_LEG_DB = "Final_Legends";
|
|
|
|
//Write item to log.
|
|
//Ba'al
|
|
void LogItem(object oPC, string sLogItem)
|
|
{
|
|
object oItem = GetFirstItemInInventory(oPC);
|
|
int nNumber;
|
|
nNumber = 0;
|
|
while(GetIsObjectValid(oItem))
|
|
{
|
|
if(GetTag(oItem) == sLogItem)
|
|
{
|
|
nNumber++;
|
|
}
|
|
oItem = GetNextItemInInventory(oPC);
|
|
}
|
|
int nSlot;
|
|
for(nSlot = 0; nSlot <= NUM_INVENTORY_SLOTS; nSlot++ )
|
|
{
|
|
oItem = GetItemInSlot(nSlot);
|
|
if(GetTag(oItem) == sLogItem)
|
|
{
|
|
nNumber++;
|
|
}
|
|
}
|
|
if(nNumber >= 2)
|
|
{
|
|
string sName = GetPCPlayerName(oPC);
|
|
string sIP = GetPCIPAddress(oPC);
|
|
string sCD = GetPCPublicCDKey(oPC);
|
|
string sAmmount = IntToString(nNumber);
|
|
string sMessage = sName + " (" + sIP + ") " + " (" + sCD + ") had " + sAmmount + " " + sLogItem;
|
|
WriteTimestampedLogEntry(sMessage);
|
|
}
|
|
}
|
|
|
|
void LogGold(object oPC)
|
|
{
|
|
int nGold = GetGold(oPC);
|
|
|
|
if(nGold <= 15000000) { return; }
|
|
|
|
string sCharName = GetName(oPC);
|
|
string sName = GetPCPlayerName(oPC);
|
|
string sIP = GetPCIPAddress(oPC);
|
|
string sCD = GetPCPublicCDKey(oPC);
|
|
string sAmmount = IntToString(nGold);
|
|
string sMessage = sName + " (" + sCharName + ") " + " (" + sIP + ") " + " (" + sCD + ") has " + sAmmount + " GP ##################";
|
|
WriteTimestampedLogEntry(sMessage);
|
|
}
|
|
|
|
|
|
void main()
|
|
{
|
|
int iResult = TRUE;
|
|
|
|
UpdateCharEquipment(OBJECT_SELF);
|
|
|
|
if(!GetIsDM(OBJECT_SELF)) RuleCheck(OBJECT_SELF);
|
|
|
|
LogItem(OBJECT_SELF, "BeltofCyan40");
|
|
LogItem(OBJECT_SELF, "ba_beltofcyan");
|
|
LogGold(OBJECT_SELF);
|
|
|
|
// Remove all perm freedom items AND replace Final Legend Rods
|
|
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
|
while (oItem != OBJECT_INVALID)
|
|
{
|
|
if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_FREEDOM_OF_MOVEMENT))
|
|
DestroyObject(oItem);
|
|
|
|
oItem = GetNextItemInInventory(OBJECT_SELF);
|
|
}
|
|
|
|
int nSlot;
|
|
for( nSlot = 0; nSlot <= NUM_INVENTORY_SLOTS; nSlot++ )
|
|
{
|
|
oItem = GetItemInSlot(nSlot);
|
|
if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_FREEDOM_OF_MOVEMENT))
|
|
DestroyObject(oItem);
|
|
}
|
|
|
|
// This set of functions controls Guild Auras/Items.
|
|
string sActName = GetPCPlayerName(OBJECT_SELF);
|
|
effect eSDVis;
|
|
eSDVis = GetFirstEffect(OBJECT_SELF);
|
|
while(GetIsEffectValid(eSDVis))
|
|
{
|
|
if(GetEffectType(eSDVis) == EFFECT_TYPE_VISUALEFFECT
|
|
&& GetEffectSubType(eSDVis) == SUBTYPE_SUPERNATURAL)
|
|
RemoveEffect(OBJECT_SELF, eSDVis);
|
|
|
|
eSDVis = GetNextEffect(OBJECT_SELF);
|
|
}
|
|
|
|
if(!GetIsDM(OBJECT_SELF))
|
|
{
|
|
ApplyGuildAura(sActName, OBJECT_SELF);
|
|
|
|
if (IsGuildLeader(sActName))
|
|
GivePCItem(OBJECT_SELF, kLeader);
|
|
else
|
|
TakePCItem(OBJECT_SELF, kLeader, "You are not a Guild Leader, and therefore shouldn't have this key.");
|
|
|
|
|
|
//Banes:
|
|
if(IsBane(sActName)) GivePCItem(OBJECT_SELF, kBane);
|
|
if(!IsBane(sActName)) TakePCItem(OBJECT_SELF, kBane, "You shouldn't have this.");
|
|
}
|
|
|
|
|
|
// Checks for existance of Final Legends Item. If it exists, the script checks for a variable on the PC in the DB.
|
|
string sFLegends = "elv_finallegend";
|
|
if (GetItemPossessedBy(OBJECT_SELF, sFLegends) != OBJECT_INVALID)
|
|
{
|
|
if (GetCampaignInt(FIN_LEG_DB, sActName) == 1)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
SendMessageToPC(OBJECT_SELF, "You have a Final Legends item. The DB is being updated with your information.");
|
|
SetCampaignInt(FIN_LEG_DB, sActName, 1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((GetCampaignInt(FIN_LEG_DB, sActName) == 1) && (GetHitDice(OBJECT_SELF) == 40))
|
|
{
|
|
CreateItemOnObject(sFLegends, OBJECT_SELF);
|
|
}
|
|
else
|
|
return;
|
|
}
|
|
}
|