A big part of what makes me love EFU is Halfbrood's work. This place wouldnt be the same without him
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu//expands tooltip of the selected item
void ExpandItemTooltip(object oTarget);
void ExpandItemTooltip(object oTarget)
{
string sTooltip, sBaseItemType, s2daLookup, sAspect, sPrename;
int nAspectID;
int nBaseItemType = GetBaseItemType(oTarget);
if (nBaseItemType == BASE_ITEM_BLANK_POTION || nBaseItemType == BASE_ITEM_BLANK_SCROLL || nBaseItemType == BASE_ITEM_BLANK_WAND
|| nBaseItemType == BASE_ITEM_ENCHANTED_POTION || nBaseItemType == BASE_ITEM_ENCHANTED_SCROLL || nBaseItemType == BASE_ITEM_ENCHANTED_WAND
|| nBaseItemType == BASE_ITEM_POTIONS || nBaseItemType == BASE_ITEM_SPELLSCROLL || nBaseItemType == BASE_ITEM_MAGICWAND) {
return;
}
//turn this to FALSE when not testing
int nFeedback = TRUE;
if(GetLocalInt(oTarget, "nTooltipName") == FALSE)
sPrename = GetName(oTarget, FALSE);
else
sPrename = GetLocalString(oTarget, "sTooltipPrename");
if(!JsonGetLength(RegExpMatch("</c>", sPrename))) {
//sPrename = ColorString(sPrename, Orange());
}
itemproperty iprpTarget = GetFirstItemProperty(oTarget);
// base item type
// moved above aspect to break the color between name/aspect
// removed extra padding
s2daLookup = Get2DAString("baseitems", "Name", GetBaseItemType(oTarget));
sBaseItemType = GetStringByStrRef(StringToInt(s2daLookup));
sTooltip += sBaseItemType;
if (GetLocalInt(oTarget, "nAspectID"))
{
// We want to skip no aspect given and "None" entirely
if(nAspectID > 1)
{
//string sAspect = GetAspectName(GetLocalInt(oTarget, "nAspectID"));
sTooltip += "\n" + sAspect;
}
}
float fWeight = IntToFloat(GetWeight(oTarget)) * 0.1f;
if(fWeight > 0.5) // dont show weight if this or below
sTooltip += "\n" + "Weight: " + FloatToString(fWeight, 4, 1);
int nCharges = GetItemCharges(oTarget);
if(nCharges > 0)
sTooltip += "\n" + "Charges: " + IntToString(nCharges);
while(GetIsItemPropertyValid(iprpTarget))
{
// if it has a duration, it is only temporary
if(GetItemPropertyDurationRemaining(iprpTarget))
{
iprpTarget = GetNextItemProperty(oTarget);
continue;
}
int nType = GetItemPropertyType(iprpTarget);
// item types we want to skip and not print to the tooltip
switch(nType){
// base item weight reduction
case 11 : iprpTarget = GetNextItemProperty(oTarget); continue;
// additional weight
case 81 : iprpTarget = GetNextItemProperty(oTarget); continue;
// secret properties
case 87 : iprpTarget = GetNextItemProperty(oTarget); continue;
}
int nSubtype = GetItemPropertySubType(iprpTarget);
int nCostTable = GetItemPropertyCostTable(iprpTarget);
int nCostTableValue = GetItemPropertyCostTableValue(iprpTarget);
int nParam1 = GetItemPropertyParam1(iprpTarget);
int nParam1Value = GetItemPropertyParam1Value(iprpTarget);
string sParam1, sParam1Value, sType, sCostTable, sCostTableValue, sSubtype;
string sBadstrref = "Bad Strref";
sType = Get2DAString("ItemProps", "StringRef", nType);
sSubtype = Get2DAString("itempropdef", "SubTypeResRef", nType);
sSubtype = Get2DAString(sSubtype, "Name", nSubtype);
sParam1 = Get2DAString("iprp_paramtable", "TableResRef", nParam1);
sParam1Value = Get2DAString(sParam1, "Name", nParam1Value);
sCostTable = Get2DAString("iprp_costtable", "Name", nCostTable);
sCostTableValue = Get2DAString(sCostTable, "Name", nCostTableValue);
// used for exceptions
int nSkip = FALSE;
// formatting for the new string that will be saved
// define exceptions here that you want to rename/alter
sTooltip += "\n";
if((nType == 65) ||
(nType == 64) ||
(nType == 63))
{
// only useable by for class, alignment, race
sTooltip += "OUB: ";
}
else if(nType == 1)
{
// armor class bonus
nSkip = TRUE;
sTooltip += GetStringByStrRef(StringToInt(sCostTableValue)) + " AC";
}
else if(nType == 2 || nType == 3 || nType == 4 || nType == 5)
{
// armor class bonus vs specific
nSkip = TRUE;
// bonus
sTooltip += GetStringByStrRef(StringToInt(sCostTableValue)) + " AC";
// versus what
sTooltip += " vs. " + GetStringByStrRef(StringToInt(sSubtype));
}
else if(nType == 13) // spell slot for classes
{
sTooltip += "Spell Slot: ";
}
else if(nType == 15 || // cast spell iprp
nType == 20) // damage immunity
{
// do nothing, leave blank
}
else if(nType == 37)
{
// used for broad immunities like crit, sneak, minda ffecting, etc
sTooltip += "Immunity: ";
}
else if(nType == 40 || nType == 41)
{
// saves item property, comment out if you want it gone
sTooltip += "Save vs. ";
}
else if(nType == 52)
{
// skills item property, comment out if you want it gone
//sTooltip += "Skill: ";
}
else if(nType == 56)
{
// generic Attack Bonus
nSkip = TRUE;
sTooltip += GetStringByStrRef(StringToInt(sCostTableValue)) + " Attack Bonus";
}
else if(nType == 57 || nType == 58 ||nType == 59)
{
// Attack Bonus vs specific
nSkip = TRUE;
// bonus
sTooltip += GetStringByStrRef(StringToInt(sCostTableValue)) + " AB";
// versus what
sTooltip += " vs. " + GetStringByStrRef(StringToInt(sSubtype));
}
else if(nType == 16)
{
// generic damage bonus
nSkip = TRUE;
// bonus
string sDamageBonus = GetStringByStrRef(StringToInt(sCostTableValue));
sTooltip += "+" + GetSubString(sDamageBonus, 0, FindSubString(sDamageBonus, "Damage"));
// type
sTooltip += GetStringByStrRef(StringToInt(sSubtype)) + " Damage";
}
else if(nType == 17 || nType == 18 ||nType == 19)
{
// specific damage bonus vs
nSkip = TRUE;
// bonus
string sDamageBonus = GetStringByStrRef(StringToInt(sCostTableValue));
sTooltip += "+" + GetSubString(sDamageBonus, 0, FindSubString(sDamageBonus, "Damage"));
// type
sTooltip += GetStringByStrRef(StringToInt(sParam1Value));
// versus what
sTooltip += " vs. " + GetStringByStrRef(StringToInt(sSubtype));
}
else
{
// non exception, print as tlk defines
sTooltip += GetStringByStrRef(StringToInt(sType));
if((nSubtype != 255) ||
(nParam1Value != 255) ||
(nCostTableValue != 255) )
{
// add to anything with subtypes, excluding exceptions listed above
sTooltip += ": ";
}
}
string sFeedback;
sFeedback += "nType: " + IntToString(nType) + " = " + GetStringByStrRef(StringToInt(sType)) + "\n";
// find values assigned from 2das and tlk
// this is everything from what alignment vs, to what value, and what spell is used
if((nSubtype != 255 ||
nParam1Value != 255 ||
nCostTableValue != 255)
&& !nSkip)
{
if(nSubtype == 335)
{
sTooltip += "Unique Power (Self Only)";
}
else if(nSubtype != 255)
{
string sSubtypestrref = GetStringByStrRef(StringToInt(sSubtype));
if(FindSubString(sSubtypestrref, sBadstrref, 0) != 0)
{
sTooltip += sSubtypestrref;
}
if(nSubtype == 329)
sTooltip += "(Use)";
}
if(nParam1Value != 255)
{
string sParamstrref = GetStringByStrRef(StringToInt(sParam1Value));
if(FindSubString(sParamstrref, sBadstrref, 0) != 0)
{
sTooltip += " ";
sTooltip += sParamstrref;
}
}
if(nCostTableValue != 255)
{
string sCoststrref = GetStringByStrRef(StringToInt(sCostTableValue));
if(FindSubString(sCoststrref, sBadstrref, 0) != 0)
{
sTooltip += " ";
sTooltip += sCoststrref;
}
}
}
sFeedback += "nSubtype: " + IntToString(nSubtype) + " = " + GetStringByStrRef(StringToInt(sSubtype)) + "\n";
sFeedback += "nCostTable: " + IntToString(nCostTable) + " = " + GetStringByStrRef(StringToInt(sCostTable)) + "\n";
sFeedback += "nCostTableValue: " + IntToString(nCostTableValue) + " = " + GetStringByStrRef(StringToInt(sCostTableValue)) + "\n";
sFeedback += "nParam1: " + IntToString(nParam1) + " = " + GetStringByStrRef(StringToInt(sParam1)) + "\n";
sFeedback += "nParam1Value: " + IntToString(nParam1Value) + " = " + GetStringByStrRef(StringToInt(sParam1Value));
if(nFeedback == TRUE)
//SendMessageToAllDMs(sFeedback);
SendMessageToPC(GetFirstPC(), sFeedback);
//end, loop back with next property
iprpTarget = GetNextItemProperty(oTarget);
}
SetObjectTextBubbleOverride(oTarget, OBJECT_UI_TEXT_BUBBLE_OVERRIDE_REPLACE, sPrename + "\n" + sTooltip);
}
//expands tooltip of the selected item
void ExpandItemTooltip(object oTarget);
void ExpandItemTooltip(object oTarget)
{
string sTooltip, sBaseItemType, s2daLookup, sAspect, sPrename;
int nAspectID;
//turn this to FALSE when not testing
int nFeedback = FALSE;
if(GetLocalInt(oTarget, "nTooltipName") == FALSE)
sPrename = GetName(oTarget, FALSE);
else
sPrename = GetLocalString(oTarget, "sTooltipPrename");
if(!JsonGetLength(RegExpMatch("</c>", sPrename))) {
sPrename = ColorString(sPrename, Orange());
}
itemproperty iprpTarget = GetFirstItemProperty(oTarget);
// base item type
// moved above aspect to break the color between name/aspect
// removed extra padding
s2daLookup = Get2DAString("baseitems", "Name", GetBaseItemType(oTarget));
sBaseItemType = GetStringByStrRef(StringToInt(s2daLookup));
sTooltip += "Item Type: " + sBaseItemType;
if (GetLocalInt(oTarget, "nAspectID"))
{
// We want to skip no aspect given and "None" entirely
if(nAspectID > 1)
{
string sAspect = GetAspectName(GetLocalInt(oTarget, "nAspectID"));
sTooltip += "\n" + sAspect;
}
}
float fWeight = IntToFloat(GetWeight(oTarget)) * 0.1f;
if(fWeight > 0.1) // dont show weight if it's 0.1 or less
sTooltip += "\n" + "Weight: " + FloatToString(fWeight, 4, 1);
int nCharges = GetItemCharges(oTarget);
if(nCharges > 0)
sTooltip += "\n" + "Charges: " + IntToString(nCharges);
while(GetIsItemPropertyValid(iprpTarget))
{
if(GetItemPropertyDurationRemaining(iprpTarget))
{
iprpTarget = GetNextItemProperty(oTarget);
continue;
}
int nType = GetItemPropertyType(iprpTarget);
// item types we want to skip and not print to the tooltip
switch(nType){
// base item weight reduction
case 11 : iprpTarget = GetNextItemProperty(oTarget); continue;
// additional weight
case 81 : iprpTarget = GetNextItemProperty(oTarget); continue;
// secret properties
case 87 : iprpTarget = GetNextItemProperty(oTarget); continue;
}
int nSubtype = GetItemPropertySubType(iprpTarget);
int nCostTable = GetItemPropertyCostTable(iprpTarget);
int nCostTableValue = GetItemPropertyCostTableValue(iprpTarget);
int nParam1 = GetItemPropertyParam1(iprpTarget);
int nParam1Value = GetItemPropertyParam1Value(iprpTarget);
string sParam1, sParam1Value, sType, sCostTable, sCostTableValue, sSubtype;
string sBadstrref = "Bad Strref";
sType = Get2DAString("ItemProps", "StringRef", nType);
sSubtype = Get2DAString("itempropdef", "SubTypeResRef", nType);
sSubtype = Get2DAString(sSubtype, "Name", nSubtype);
sParam1 = Get2DAString("iprp_paramtable", "TableResRef", nParam1);
sParam1Value = Get2DAString(sParam1, "Name", nParam1Value);
sCostTable = Get2DAString("iprp_costtable", "Name", nCostTable);
sCostTableValue = Get2DAString(sCostTable, "Name", nCostTableValue);
// formatting for the new string that will be saved
// define exceptions here that you want to rename/alter
sTooltip += "\n";
if((nType == 65) ||
(nType == 64) ||
(nType == 63)) // only useable by for class, alignment, race
{
sTooltip += "Only Useable By";
}
else if(nType == 13) // spell slot for classes
{
sTooltip += "Bonus Spell Slot";
}
else if(nType == 15) // cast spell iprp
{
sTooltip += "Use";
}
else
{
sTooltip += GetStringByStrRef(StringToInt(sType));
}
string sFeedback;
sFeedback += "nType: " + IntToString(nType) + " = " + GetStringByStrRef(StringToInt(sType)) + "\n";
if((nSubtype != 255) ||
(nParam1Value != 255) ||
(nCostTableValue != 255))
{
sTooltip += ": ";
if(nSubtype == 335)
{
sTooltip += "Unique Power (Self Only)";
}
else if(nSubtype != 255)
{
string sSubtypestrref = GetStringByStrRef(StringToInt(sSubtype));
if(FindSubString(sSubtypestrref, sBadstrref, 0) != 0)
{
sTooltip += sSubtypestrref;
}
if(nSubtype == 329)
sTooltip += ",";
}
if(nParam1Value != 255)
{
string sParamstrref = GetStringByStrRef(StringToInt(sParam1Value));
if(FindSubString(sParamstrref, sBadstrref, 0) != 0)
{
sTooltip += " ";
sTooltip += GetStringByStrRef(StringToInt(sParam1Value));
}
}
if(nCostTableValue != 255)
{
string sCoststrref = GetStringByStrRef(StringToInt(sCostTableValue));
if(FindSubString(sCoststrref, sBadstrref, 0) != 0)
{
sTooltip += " ";
sTooltip += GetStringByStrRef(StringToInt(sCostTableValue));
}
}
sFeedback += "nSubtype: " + IntToString(nSubtype) + " = " + GetStringByStrRef(StringToInt(sSubtype)) + "\n";
sFeedback += "nCostTable: " + IntToString(nCostTable) + " = " + GetStringByStrRef(StringToInt(sCostTable)) + "\n";
sFeedback += "nCostTableValue: " + IntToString(nCostTableValue) + " = " + GetStringByStrRef(StringToInt(sCostTableValue)) + "\n";
sFeedback += "nParam1: " + IntToString(nParam1) + " = " + GetStringByStrRef(StringToInt(sParam1)) + "\n";
sFeedback += "nParam1Value: " + IntToString(nParam1Value) + " = " + GetStringByStrRef(StringToInt(sParam1Value));
}
//end, loop back with next property
iprpTarget = GetNextItemProperty(oTarget);
if(nFeedback == TRUE)
SendMessageToAllDMs(sFeedback);
}
SetObjectTextBubbleOverride(oTarget, OBJECT_UI_TEXT_BUBBLE_OVERRIDE_REPLACE, sPrename + "\n" + sTooltip);
}