Пример #1
0
void TESPackage::SetTarget(TESForm* baseForm, UInt32 count)
{
	TargetData* tdata = GetTargetData();
	tdata->targetType = kTargetType_BaseObject;
	tdata->count = count;
	tdata->target.form = baseForm;
}
Пример #2
0
void TESPackage::SetTarget(TESObjectREFR* refr)
{
	TargetData* tdata = GetTargetData();
	tdata->targetType = kTargetType_Refr;
	tdata->target.refr = refr;
	tdata->count = 150;	//DefaultDistance
}
Пример #3
0
void TESPackage::SetCount(UInt32 aCount)
{
	if (target) {
		TargetData* tdata = GetTargetData();
		tdata->count = aCount;
	}
}
Пример #4
0
IFACEMETHODIMP ComposerShellMenu::QueryContextMenu(
    HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
    
    // Do nothing if uFlags include CMF_DEFAULTONLY.
    if (CMF_DEFAULTONLY & uFlags)
        return S_OK;
    
    // See if we have already written the menu.
    if (MenuExists(hMenu))
        return S_OK;

    // Get the target directory and status
    HRESULT hr = GetTargetData();
    if (SUCCEEDED(hr))
    {
        DWORD result = 0;
        if (!MenuBuild(hMenu, indexMenu, idCmdFirst, &result))
        {
            hr = HRESULT_FROM_WIN32(result);
        }
        else
        {
            hr = MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(result));
        }
    }
        
    return hr;
}
Пример #5
0
bool FUNCMEMLOOK::execute(void)
{
	VPVOID refr;
    //VPVOID temp,base;
	//ULONG type;
	if (GetTargetData(machine, &refr))
		machine.dumpobject((TES3REFERENCE*)refr);
	return true;
}
Пример #6
0
void TESPackage::SetTarget(UInt8 typeCode, UInt32 count)
{
	if (typeCode > 0 && typeCode < kObjectType_Max)
	{
		TargetData* tdata = GetTargetData();
		tdata->targetType = kTargetType_TypeCode;
		tdata->target.objectCode = typeCode;
		tdata->count= count;
	}
}
Пример #7
0
bool GetMaxMagickaFunction::execute(void)
{
	float magicka = -1.0;
	unsigned long record_type;
	VPVOID reference, temp;
	if (GetTargetData(machine, &reference, &temp, &record_type) &&
		(record_type == NPC || record_type == CREATURE)) {
		MACPRecord const* const macp =
			reinterpret_cast<MACPRecord*>(GetAttachPointer(
			machine, reference, MACHNODE));
		if (macp != NULL) magicka = macp->magicka.base;
	}
	return (machine.push(magicka));
}
Пример #8
0
bool GetAttributeFunction::execute(void)
{
	long attribute_index;
	float attribute_value = -1.0;
	unsigned long record_type;
	VPVOID reference, temp;
	if (GetTargetData(machine, &reference, &temp, &record_type) &&
		(record_type == NPC || record_type == CREATURE)) {
		MACPRecord const* const macp =
			reinterpret_cast<MACPRecord*>(GetAttachPointer(machine, reference, MACHNODE));
		if (macp != NULL && machine.pop(attribute_index) &&
			attribute_index >= kFirstAttribute &&
			attribute_index <= kLastAttribute) {
			attribute_value = macp->attributes[attribute_index].current;
		}
	}
	return (machine.push(attribute_value));
}
Пример #9
0
bool GetEncumbranceFunction::execute()
{
	enum Encumbrance
	{
		kCurrent = 0,
		kMax = 1,
		kBase = 2
	};
	double encumbrance = -999999.0;
	unsigned long record_type;
	unsigned char* reference;
	unsigned char* temp;
	unsigned char* base;
	if (GetTargetData(machine, &reference, &temp, &record_type, &base)
		&& (record_type == NPC || record_type == CREATURE)) {
		MACPRecord const* const macp =
			reinterpret_cast<MACPRecord*>(GetAttachPointer(
			machine, reference, MACHNODE));
		long encumbrance_type;
		long round_result;
		machine.pop(encumbrance_type);
		machine.pop(round_result);
		if (macp != NULL) {
			if (encumbrance_type == kMax) {
				encumbrance = macp->weight_limit.base;
			} else if (encumbrance_type == kBase || encumbrance_type == kCurrent) {
				encumbrance = macp->weight_limit.current;
				if (macp->num_active_effects > 0) {
					// first effect is a "dummy" node
					MACPRecord::ActiveEffect* current_effect =
						macp->active_effects->next;
					for (int i = 0; i < macp->num_active_effects; i++) {
						// It's not sufficient to simply read the current
						// magnitude of the effect (ActiveEffect.magnitude) for
						// two reasons: First, it does not take into account
						// any Magicka Resistance active when the effect was
						// applied to the actor (burden is affected by MR,
						// feather is not). Second, when a spell that is
						// already affecting an entity is cast again on that
						// entity, the game applies the effects of both copies
						// for one frame, doubling the effect on encumbrance
						// for that frame.
						if (current_effect->effect_type == kFeather ||
							current_effect->effect_type == kBurden) {
							if (encumbrance_type == kBase) {
								encumbrance += CalculateTotal(reference);
							} else {
								encumbrance += CalculateCorrection(reference);
							}
							break;
						}
						current_effect = current_effect->next;
					}
				}
			}
			// The smallest item weight is 0.01, so round to nearest 0.01.
			if (round_result != 0)
				encumbrance = round(encumbrance * 100.0) / 100.0;
		}
	}
	float value = static_cast<float>(encumbrance);
	return (machine.push(value));
}