Esempio n. 1
0
bool InjectActorValue(ClientEntity *ent,BYTE slot, INT16 value)
{
    if(!ent)
        return false;
    TESObjectREFR * refr = GetRefrFromEntity(ent);
    if(!refr || !refr->IsActor())
        return false;
    else
    {
        Actor * actor = (Actor *)refr;
        int CurrentVal = actor->GetActorValue(slot);
        //TODO: Sync health, fatigue, magicka unmodifiedvalues as well. In general sync all modifiers here

        switch(slot)
        {
        case AV_FATIGUE:
        case AV_HEALTH:
        case AV_MAGICKA:
            actor->ModActorBaseValue(slot,value - CurrentVal,0);
            //assert(actor->GetBaseActorValue(slot) == value);
            //TODO: Re-add this assertion here
            break;
        default:
            actor->ModActorValue(slot,value - CurrentVal,0);
            assert(actor->GetActorValue(slot) == value);
            break;
        }
    }
}
Esempio n. 2
0
bool InjectEquip( ClientEntity *ent,BYTE slot,UINT32 formid )
{
    return true;
    if(!ent)
        return false;
    TESObjectREFR * refr = GetRefrFromEntity(ent);
    if(!refr || !refr->IsActor())
        return false;
    else
    {
        Actor * act= (Actor*)refr;
        if(formid && LookupFormByID(formid))
        {
            feGetObject getObject;
            double itemResult;
            UInt32* itemRef = (UInt32 *)&itemResult;
            if (FindEquipped(act, slot, &getObject, &itemResult)  ) // If we find nothing, there already is no equip
            {
                ent->AddUnequipItem(*itemRef);
                ent->AddRemoveItem(*itemRef);
                //UnEquipItemCommand(act,*itemRef);
                //RemoveOneItemQueue.push(pair<Actor *,UINT32>(act,*itemRef));
            }
            //AddOneItemCommand(act,formid);
            ent->AddAddItem(formid);
            //ent->AddEquipItem(formid);
        }
        else
        {
            //Unequip the item in that slot.
            feGetObject getObject;
            double itemResult;
            UInt32* itemRef = (UInt32 *)&itemResult;
            if (FindEquipped(act, slot, &getObject, &itemResult)  ) // If we find nothing, there already is no equip
            {
                ent->AddUnequipItem(*itemRef);
                //ent->AddRemoveItem(*itemRef);
                //UnEquipItemCommand(act,*itemRef);
                //RemoveOneItemQueue.push(pair<Actor *,UINT32>(act,*itemRef));
            }
        }
        SafeAddUpdateQueue(ent);

    }
    return true;
}
Esempio n. 3
0
bool InjectAnimation( ClientEntity *ent,BYTE slot )
{
    TESObjectREFR * refr = GetRefrFromEntity(ent);
    if(!refr || !refr->IsActor())
        return false;
    else
    {
        ent->InjectAnim(slot);
#if 0
        //TODO: See CallCommandGeneric
        double result;
        // We wish to call PlayGroup. This has the parameters ( which are passed as flat array in arg1 )
        // AnimGroup ( a UINT16) , and 1 Integer ( flag, which we want to be "1" )
        UInt8 ParamData[sizeof(UINT16) + sizeof(UINT32)];
        Actor * actor = (Actor *)refr;
        // create a Script object
        UInt8	scriptObjBuf[sizeof(Script)];
        Script	* tempScriptObj = (Script *)scriptObjBuf;
        ScriptEventList evlist;
        evlist.m_eventList = NULL;
        evlist.m_script = tempScriptObj;
        evlist.m_unk1 = 0;
        evlist.m_vars = NULL;
        void	* scriptState = GetGlobalScriptStateObj();

        tempScriptObj->Constructor();
        tempScriptObj->MarkAsTemporary();
        if(Playing)
            *((UINT16 *)ParamData) = slot; // Set parameter 1 ( aniom group)
        else
            *((UINT16 *)ParamData) = 0; // Play idle anim
        *((UINT32 *)(ParamData + 2)) = 1; // Flag to start immediately
        // Parameter list, parameters, thisOBj, arg3= param count, ScriptEventList ( what to put in there?) , Result ptr, and offset ( is 0 ok ? )
        //Cmd_PlayGroup_Execute(kParams_CmdPlayGroup,ParamData,actor, 2,tempScriptObj,&evlist,&result,0); // NULL denotes incomplete params
        tempScriptObj->StaticDestructor();
#endif
    }
    return true;
}