static bool Cmd_GetClassSkills_Execute(COMMAND_ARGS) { ArrayID arr = g_ArrayMap.Create(kDataType_Numeric, true, scriptObj->GetModIndex()); *result = arr; TESClass* theClass = NULL; if (ExtractArgs(PASS_EXTRACT_ARGS, &theClass)) { if (!theClass && thisObj) { TESNPC* npc = OBLIVION_CAST(thisObj->baseForm, TESForm, TESNPC); theClass = npc ? npc->npcClass : NULL; } if (theClass) { for (UInt32 idx = 0; idx < 7; idx++) { g_ArrayMap.SetElementNumber(arr, idx, theClass->majorSkills[idx]); } } } return true; }
static bool Cmd_GetCreatureModelPaths_Execute(COMMAND_ARGS) { UInt32 arrID = g_ArrayMap.Create(kDataType_Numeric, true, scriptObj->GetModIndex()); *result = arrID; TESActorBase* actorBase = NULL; if (ExtractArgs(PASS_EXTRACT_ARGS, &actorBase)) { if (!actorBase && thisObj) actorBase = OBLIVION_CAST(thisObj->baseForm, TESForm, TESActorBase); if (actorBase) { TESCreature* crea = OBLIVION_CAST(actorBase, TESActorBase, TESCreature); if (crea) { UInt32 idx = 0; for (TESModelList::Entry* cur = &crea->modelList.modelList; cur && cur->nifPath; cur = cur->next) { g_ArrayMap.SetElementString(arrID, ArrayKey(idx), cur->nifPath); idx++; } } } } return true; }
static bool Cmd_GetCellResetHours_Execute(COMMAND_ARGS) { *result = -1; TESObjectCELL* cell = NULL; if (ExtractArgs(PASS_EXTRACT_ARGS, &cell) && cell) { SInt32 iHoursToRespawn = TimeGlobals::HoursToRespawnCell(); SInt32 iHoursPassed = TimeGlobals::GameHoursPassed(); ExtraDetachTime* xDetach = (ExtraDetachTime*)cell->extraData.GetByType(kExtraData_DetachTime); if (xDetach) { SInt32 detachTime = xDetach->detachTime; if (xDetach->detachTime == 0xFFFFFFFF) // ResetInterior sets it to this for immediate respawn *result = 0; else { detachTime += iHoursToRespawn; if (detachTime <= iHoursPassed) *result = 0; else *result = detachTime - iHoursPassed; } } } return true; }
bool Cmd_SetPackageTargetReference_Execute(COMMAND_ARGS) { *result = 0; //DEBUG_MESSAGE("\t\tSPT @\n"); TESObjectREFR* pRefr = NULL; TESForm * pForm = NULL; TESPackage* pPackage = NULL; ExtractArgs(EXTRACT_ARGS, &pForm, &pRefr); if (!pRefr) if(!thisObj) return true; else pRefr = thisObj; //DEBUG_MESSAGE("\t\tSPT 0 Refr:[%08X]\n", pRefr->refID); if (!pForm) return true; //DEBUG_MESSAGE("\t\tSPT 1 Form:0x%x Refr:[%08X]\n", pForm, pRefr->refID); pPackage = DYNAMIC_CAST(pForm, TESForm, TESPackage); //DEBUG_MESSAGE("\t\tSPT 2 Package:0x%x Refr:[%08X]\n", pPackage, pRefr->refID); if (pPackage) { //if (pPackage->target) // DEBUG_MESSAGE("target is %s", pPackage->target->StringForTargetCodeAndData()); //DEBUG_MESSAGE("\t\tSPT 3 Package:[%08X] Refr:[%08X] Target:0x%x\n", pPackage->refID, pRefr->refID, pPackage->target); pPackage->SetTarget(pRefr); //DEBUG_MESSAGE("\t\tSPT 4 Package:[%08X] Refr:[%08X] Target:0x%x\n", pPackage->refID, pRefr->refID, pPackage->target); //if (pPackage->target) // DEBUG_MESSAGE("target is %s", pPackage->target->StringForTargetCodeAndData()); } return true; }
bool Cmd_RemovePackageAt_Execute(COMMAND_ARGS) { *result = 0; UInt32* refResult = (UInt32*)result; TESObjectREFR* pRefr = NULL; TESAIForm* pAI = NULL; TESPackage* pPackage = NULL; SInt32 anIndex = 0; ExtractArgs(EXTRACT_ARGS, &anIndex, &pRefr); if (!pRefr) if(!thisObj) return true; else pRefr = thisObj; //DEBUG_MESSAGE("\t\tRPA 0 Actor:%x index:[%d] package:[%010x]\n", pRefr->refID, anIndex, *result); Actor* pActor = DYNAMIC_CAST(pRefr, TESForm, Actor); if (pActor) pAI = DYNAMIC_CAST(pActor->baseForm, TESForm, TESAIForm); if (pAI) pPackage = pAI->RemovePackageAt(anIndex); if (pPackage) *refResult = pPackage->refID; //DEBUG_MESSAGE("\t\tRPA 1 Actor:%x index:[%d] package:[%010x]\n", pRefr->refID, anIndex, *result); return true; }
bool Cmd_GetCurrentPackage_Execute(COMMAND_ARGS) { *result = 0; UInt32* refResult = (UInt32*)result; *refResult = 0; //DEBUG_MESSAGE("\t\tGCP @\n"); TESObjectREFR* pRefr = NULL; Actor * pActor = NULL; TESPackage* pPackage = NULL; ExtractArgs(EXTRACT_ARGS, &pRefr); if (!pRefr) if(!thisObj) return true; else pRefr = thisObj; //DEBUG_MESSAGE("\t\tGCP 0 Refr:%x\n", pRefr->refID); pActor = DYNAMIC_CAST(pRefr, TESObjectREFR, Actor); if (!pActor || !pActor->baseProcess) return true; //DEBUG_MESSAGE("\t\tGCP 1 Package:[%x] Refr:%x\n", pForm, pRefr->refID); pPackage = pActor->baseProcess->GetCurrentPackage(); //DEBUG_MESSAGE("\t\tGCP 2 Package:[%x] Refr:%x\n", pPackage, pRefr->refID); if (pPackage) { *refResult = pPackage->refID; //DEBUG_MESSAGE("\t\tGCP 3 Package:%x Refr:%x\n", *refResult, pRefr->refID); } if (IsConsoleMode()) Console_Print("GetCurrentPackage >> [%08X] ", *result); return true; }
bool Cmd_GetPackageLocation_Execute(COMMAND_ARGS) { *result = 0; UInt32* refResult = (UInt32*)result; *refResult = 0; //DEBUG_MESSAGE("\t\tSPL @\n"); TESForm * pForm = NULL; TESPackage* pPackage = NULL; ExtractArgs(EXTRACT_ARGS, &pForm); if (!pForm) return true; //DEBUG_MESSAGE("\t\tGPL 1 Package:[%x]\n", pForm); pPackage = DYNAMIC_CAST(pForm, TESForm, TESPackage); //DEBUG_MESSAGE("\t\tGPL 2 Package:[%x]\n", pPackage); if (pPackage && pPackage->location) { //DEBUG_MESSAGE("\t\tGPL 3 Package:%x\n", pPackage->refID); TESPackage::LocationData * pLocation = pPackage->GetLocationData(); //DEBUG_MESSAGE("\t\GSPL 4 Package:%x Location:[%x]\n", pPackage->refID, pLocation); if (pLocation && pLocation->object.form) switch (pLocation->locationType) { case TESPackage::LocationData::kPackLocation_NearReference: case TESPackage::LocationData::kPackLocation_InCell: case TESPackage::LocationData::kPackLocation_ObjectID: *refResult = pLocation->object.form->refID; break; case TESPackage::LocationData::kPackLocation_ObjectType: *refResult = pLocation->object.objectCode; break; } //DEBUG_MESSAGE("\t\tSPL 5 Package:%x Location:[%x]\n", pPackage->refID, *refResult); } return true; }
static bool Cmd_TapControl_Execute(COMMAND_ARGS) { //returns false if control is not assigned *result = 0; UINT ctrl = 0; UINT keyCode = 0; if (!(ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &ctrl))) return true; if (ctrl >= CONTROLSMAPPED) return true; if (!InputControls) GetControlMap(); keyCode = InputControls[ctrl]; if (IsKeycodeValid(keyCode)) { DI_data.TapStates[keyCode] = 0x80; *result = 1; } else { keyCode = AltInputControls[ctrl] + 256; if (IsKeycodeValid(keyCode)) { DI_data.TapStates[keyCode] = 0x80; *result = 1; } } return true; }
// returns 1 if game-assigned control, 2 is custom mod control, 0 otherwise static bool Cmd_IsControl_Execute(COMMAND_ARGS) { UInt32 key = 0; *result = 0; if (!ExtractArgs(PASS_EXTRACT_ARGS, &key)) return true; // check game controls if (!InputControls) GetControlMap(); UInt8* controls = InputControls; if (key > 255) { key -= 256; controls = AltInputControls; } for (UInt32 i = 0; i < CONTROLSMAPPED; i++) { if (controls[i] == key) { *result = 1; return true; } } // check mod custom controls if (registeredControls[key].size()) *result = 2; return true; }
static bool Cmd_OnKeyDown_Execute(COMMAND_ARGS) { // key is refID, data is a set of key events that have been returned for that script static std::map< UINT, std::set<UINT> > KeyListeners; UINT keyCode = 0; *result = 0; if (!ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &keyCode)) return true; if (scriptObj) { std::set<UINT> * keyList = &KeyListeners[scriptObj->refID]; if (_isKeyPressed(keyCode)) { if (keyList->find(keyCode) == keyList->end()) { keyList->insert(keyCode); *result = 1; } } else if (keyList->find(keyCode) != keyList->end()) { keyList->erase(keyCode); } } return true; }
static bool Cmd_OnControlDown_Execute(COMMAND_ARGS) { // key is refID, data is a set of key events that have been returned for that script static std::map< UINT, std::set<UINT> > CtrlListeners; UINT ctrl = 0; *result = 0; if (!ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &ctrl)) return true; if (scriptObj) { std::set<UINT> * ctrlList = &CtrlListeners[scriptObj->refID]; if (_isControlPressed(ctrl)) { if (ctrlList->find(ctrl) == ctrlList->end()) { ctrlList->insert(ctrl); *result = 1; } } else if (ctrlList->find(ctrl) != ctrlList->end()) { ctrlList->erase(ctrl); } } return true; }
static bool Cmd_EnableControl_Execute(COMMAND_ARGS) { *result = 0; UInt32 ctrl = 0; if(!ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &ctrl)) return true; if (!InputControls) GetControlMap(); UInt32 dxCode = InputControls[ctrl]; if (dxCode != NOKEY && IsKeycodeValid(dxCode)) { DI_data.DisallowStates[dxCode] = 0x80; disabledControls[ctrl] = 0; } dxCode = AltInputControls[ctrl] + 256; if (dxCode != NOKEY && IsKeycodeValid(dxCode)) { DI_data.DisallowStates[dxCode] = 0x80; disabledControls[ctrl] = 0; } return true; }
bool Cmd_Rand_Execute(COMMAND_ARGS) { if(!Cmd_Rand_Initialized) { Cmd_Rand_Initialized=true; MersenneTwister::init_genrand(GetTickCount()); } *result = 0; float rangeMin = 0; float rangeMax = 0; if(!ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &rangeMin, &rangeMax)) return true; if(rangeMax < rangeMin) { float temp = rangeMin; rangeMin = rangeMax; rangeMax = temp; } float range = rangeMax - rangeMin; double value = MersenneTwister::genrand_real2() * range; value += rangeMin; *result = value; return true; }
static bool Cmd_IsClassAttribute_Execute(COMMAND_ARGS) { *result = 0; UInt32 attribute = 0; TESClass* theClass = NULL; ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &attribute, &theClass); if (attribute > kActorVal_Luck) return true; if (!theClass) { if (!thisObj) return true; TESNPC* npc = (TESNPC *)Oblivion_DynamicCast(thisObj->baseForm, 0, RTTI_TESForm, RTTI_TESNPC, 0); if (!npc || !npc->npcClass) return true; theClass = npc->npcClass; } for (int ix = 0; ix < 2; ++ix) { if (theClass->attributes[ix] == attribute) { *result = 1; return true; } } return true; }
static bool Cmd_SetPCMajorSkillUps_Execute(COMMAND_ARGS) { UInt32 nuValue = 0; *result = 0; PlayerCharacter* pc = *g_thePlayer; if (ExtractArgs(PASS_EXTRACT_ARGS, &nuValue) && pc) { pc->majorSkillAdvances = nuValue; // check if advancements allow player to level up SettingInfo* setting = NULL; if (GetGameSetting("iLevelUpSkillCount", &setting)) { float advPts = nuValue / setting->i; pc->bCanLevelUp = (advPts >= 1.0) ? 1 : 0; // HUD LevelUp icon updates automatically } *result = (pc->bCanLevelUp) ? 1 : 0; } return true; }
static bool Cmd_SetCreatureType_Execute(COMMAND_ARGS) { // cmd is a little flaky and probably doesn't do what 90% of users would want it to (make non-horse creatures ridable), but works for the purpose it was requested for // problems can arise with mountable creatures: if we set type to something other than horse while creature is ridden, rider can't dismount // if we set type to horse for a creature without an ActorParent node, weirdness occurs if actor tries to mount // both mostly addressed below UInt32 newType; Creature* creatureRef = OBLIVION_CAST(thisObj, TESObjectREFR, Creature); if (creatureRef && ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &newType) && newType < TESCreature::eCreatureType_MAX) { TESCreature* creatureBase = (TESCreature*)Oblivion_DynamicCast(creatureRef->baseForm, 0, RTTI_TESForm, RTTI_TESCreature, 0); if (!creatureBase) return true; // don't change creature type while creature is being ridden if (creatureRef->horseOrRider) return true; // don't change to horse-type unless it is ridable if (newType == TESCreature::eCreatureType_Horse && NULL == creatureRef->niNode->GetObjectByName("ActorParent")) return true; // what we *can't* feasibly check is if another reference to this base object exists in the world and is currently being ridden by an actor. // So ideally this cmd should only be used on a mountable creature if the creature is unique creatureBase->type = newType; *result = 1.0; } return true; }
static bool Cmd_GetTransactionInfo_Execute(COMMAND_ARGS) { char type[0x100] = { 0 }; ArrayID arrID = 0; if (ExtractArgs(PASS_EXTRACT_ARGS, type) && type[0]) { const TransactionInfo* info = NULL; if (!_stricmp(type, "buy")) { info = GetLastTransactionInfo(kPC_Buy, scriptObj->refID); } else if (!_stricmp(type, "sell")) { info = GetLastTransactionInfo(kPC_Sell, scriptObj->refID); } if (info) { arrID = g_ArrayMap.Create(kDataType_String, false, scriptObj->GetModIndex()); g_ArrayMap.SetElementFormID(arrID, "buyer", info->buyer->refID); g_ArrayMap.SetElementFormID(arrID, "seller", info->seller->refID); g_ArrayMap.SetElementFormID(arrID, "item", info->item->refID); g_ArrayMap.SetElementNumber(arrID, "price", info->price); g_ArrayMap.SetElementNumber(arrID, "quantity", info->quantity); } } *result = arrID; return true; }
bool Cmd_NX_ChangeRace_Execute(COMMAND_ARGS) { UInt32 *refResult = NULL; Actor *pActor = NULL; // item we are looking for TESRace *pRace = NULL; // current item from list _MESSAGE("START ChangeRace"); // refResult = (UInt32*)result; if (ExtractArgs(EXTRACT_ARGS, &pActor, &pRace)) { _MESSAGE(" SUCCESS %x %x %x", pActor, pRace, pActor->GetTypeID()); if (pActor) { // _MESSAGE(" Actor is a Character"); // needs a TESRaceForm not TESRace // pActor->race.race = *pRace; } } else { _MESSAGE(" FAIL"); } _MESSAGE("END ChangeRace"); return true; }
bool Cmd_SetPackageLocationReference_Execute(COMMAND_ARGS) { *result = 0; //DEBUG_MESSAGE("\t\tSPL @\n"); TESObjectREFR* pRefr = NULL; TESForm * pForm = NULL; TESPackage* pPackage = NULL; ExtractArgs(EXTRACT_ARGS, &pForm, &pRefr); if (!pRefr) if(!thisObj) return true; else pRefr = thisObj; //DEBUG_MESSAGE("\t\tSPL 0 Refr:%x\n", pRefr->refID); if (!pForm) return true; //DEBUG_MESSAGE("\t\tSPL 1 Package:[%x] Refr:%x\n", pForm, pRefr->refID); pPackage = DYNAMIC_CAST(pForm, TESForm, TESPackage); //DEBUG_MESSAGE("\t\tSPL 2 Package:[%x] Refr:%x\n", pPackage, pRefr->refID); if (pPackage) { //DEBUG_MESSAGE("\t\tSPL 3 Package:%x Refr:%x\n", pPackage->refID, pRefr->refID); TESPackage::LocationData * pLocation = pPackage->GetLocationData(); //DEBUG_MESSAGE("\t\tSPL 4 Package:%x Refr:%x Location:[%x]\n", pPackage->refID, pRefr->refID, pLocation); if (pLocation) { pLocation->locationType = TESPackage::LocationData::kPackLocation_NearReference; pLocation->object.form = pRefr; //DEBUG_MESSAGE("\t\tSPL 5 Package:%x Refr:%x Location:[%x]\n", pPackage->refID, pRefr->refID, pLocation); } } return true; }
bool Cmd_NX_GetEVFo_Execute(COMMAND_ARGS) { std::string key; char keyName[512]; float fValue = 0; UInt32 iPersist = 0; _MESSAGE("START GetEVFo"); *result = 0; if (ExtractArgs(EXTRACT_ARGS, &keyName)) { if (thisObj) { key = keyName; *((UInt32 *)result) = nvse_ex_evformmap[thisObj->refID][key]; if (IsConsoleMode()) { Console_Print("GetEVFo: %x", *((UInt32 *)result)); } } } _MESSAGE("END GetEVFo"); return true; }
bool Cmd_SetPackageLocationRadius_Execute(COMMAND_ARGS) { *result = 0; //DEBUG_MESSAGE("\t\tSPLR @\n"); float aRadius = 0.0; TESForm * pForm = NULL; TESPackage* pPackage = NULL; ExtractArgs(EXTRACT_ARGS, &pForm, &aRadius); //DEBUG_MESSAGE("\t\tSPLR 0 aRadius:%f\n", aRadius); if (!pForm) return true; //DEBUG_MESSAGE("\t\tSPLR 1 Form:0x%08x aRadius:%f\n", pForm, aRadius); pPackage = DYNAMIC_CAST(pForm, TESForm, TESPackage); //DEBUG_MESSAGE("\t\tSPLR 2 Package:0x%08x aRadius:%f\n", pPackage, aRadius); if (pPackage && pPackage->location) { //DEBUG_MESSAGE("\t\tSPLR 3 Package:[%08X] aRadius:%f\n", pPackage->refID, aRadius); TESPackage::LocationData * pLocation = pPackage->GetLocationData(); //DEBUG_MESSAGE("\t\tSPLR 4 Package:%x Refr:%x Location:[%x]\n", pPackage->refID, pForm->refID, pLocation); if (pLocation) { pLocation->radius = aRadius; //DEBUG_MESSAGE("\t\tSPLR 5 Package:%x Refr:%x Location:[%x] radius=%d\n", pPackage->refID, pForm->refID, pLocation, pLocation->radius); } } return true; }
bool Cmd_NX_ClrEVFo_Execute(COMMAND_ARGS) { std::string key = ""; char keyName[512]; int doMatch = 1; _MESSAGE("START ClrEVFl"); *result = 0; if (ExtractArgs(EXTRACT_ARGS, &keyName, &doMatch)) { key = keyName; } if (thisObj) { if (key != "") { nvse_ex_evformmap[thisObj->refID].erase(key); } else { nvse_ex_evfloatmap.clear(); } } _MESSAGE("END ClrEVFl"); return true; }
bool Cmd_GetNthPackage_Execute(COMMAND_ARGS) { *result = 0; UInt32* refResult = (UInt32*)result; TESObjectREFR* pRefr = NULL; TESAIForm* pAI = NULL; TESPackage* pPackage = NULL; SInt32 anIndex = 0; ExtractArgs(EXTRACT_ARGS, &anIndex, &pRefr); if (!pRefr) if(!thisObj) return true; else pRefr = thisObj; //DEBUG_MESSAGE("\t\tGNP 0 Actor:%x index:[%d] package:[%010x]\n", pRefr->refID, anIndex, *result); Actor* pActor = DYNAMIC_CAST(pRefr, TESForm, Actor); if (pActor) pAI = DYNAMIC_CAST(pActor->baseForm, TESForm, TESAIForm); if (pAI) { pPackage = pAI->GetNthPackage(anIndex); if (pPackage) *refResult = pPackage->refID; } if (IsConsoleMode()) Console_Print("GetNthPackage >> %u", *refResult); //DEBUG_MESSAGE("\t\tGNP 1 Actor:%x index:[%d] package:[%010x]\n", pRefr->refID, anIndex, *result); return true; }
static bool Cmd_GetMapMarkers_Execute(COMMAND_ARGS) { UInt32 inclHidden = 1; UInt32 markerType = 0; ArrayID arr = g_ArrayMap.Create(kDataType_Numeric, true, scriptObj->GetModIndex()); *result = arr; if(ExtractArgs(PASS_EXTRACT_ARGS, &inclHidden, &markerType)) { std::vector<TESObjectREFR*> vec; MapMenu* mapMenu = (MapMenu*)GetMenuByType(kMenuType_Map); for (MapMenu::MapMarkerEntry* cur = mapMenu->mapMarkers; cur && cur->mapMarker; cur = cur->next){ ExtraMapMarker* markerExtra = (ExtraMapMarker*)cur->mapMarker->baseExtraList.GetByType(kExtraData_MapMarker); UInt32 isVisible = markerExtra->IsVisible(); UInt32 canTravel = markerExtra->CanTravelTo(); if(!markerType || markerType == markerExtra->data->type){ if ((inclHidden == 0 && isVisible && canTravel) || (inclHidden == 1 && isVisible) || inclHidden == 2){ //It seems that disabled mapmarkers are considered visible so an extra check is needed if(!cur->mapMarker->IsDisabled() || inclHidden == 2){ vec.push_back(cur->mapMarker); } } } } //We wanna reverse the array to make it easier to combine with the GetMenuChildXXXValue functions std::reverse(vec.begin(), vec.end()); for (UInt32 i = 0; i < vec.size(); i++) { g_ArrayMap.SetElementFormID(arr, (double)i, vec[i]->refID); } } return true; }
static bool Cmd_ToggleCreatureModel_Execute(COMMAND_ARGS) { TESActorBase* actorBase = NULL; UInt32 bEnable = 0; char nifPath[512]; *result = 0; if (!ExtractArgs(paramInfo, arg1, opcodeOffsetPtr, thisObj, arg3, scriptObj, eventList, &nifPath, &bEnable, &actorBase)) return false; if (!actorBase) if (thisObj) actorBase = (TESActorBase*)Oblivion_DynamicCast(thisObj->baseForm, 0, RTTI_TESForm, RTTI_TESActorBase, 0); TESCreature* crea = (TESCreature*)Oblivion_DynamicCast(actorBase, 0, RTTI_TESActorBase, RTTI_TESCreature, 0); if (!crea) return true; if (bEnable) { if (crea->modelList.AddEntry(nifPath)) *result = 1; } else { //ModelListVisitor(&(crea->modelList.modelList)).Visit(ModelListDumper()); if (crea->modelList.RemoveEntry(nifPath)) *result = 1; //ModelListVisitor(&crea->modelList.modelList).Visit(ModelListDumper()); } return true; }
static bool Cmd_GetSoundAttenuation_Execute(COMMAND_ARGS) { TESSound* sound = NULL; char whichStr[0x20] = { 0 }; *result = -1.0; if (ExtractArgs(PASS_EXTRACT_ARGS, &sound, whichStr) && sound) { UInt32 which = AttenCodeForString(whichStr); switch (which) { case kAtten_Min: *result = sound->minAttenuation * 5; break; case kAtten_Max: *result = sound->maxAttenuation * 100; break; case kAtten_Static: *result = sound->staticAttenuation / 100.0; break; } } if (IsConsoleMode()) { Console_Print("GetSoundAttenuation >> %.2f", *result); } return true; }
static bool Cmd_SetCreatureSkill_Execute(COMMAND_ARGS) { char skillname[0x200] = { 0 }; UInt32 skill = 0; TESActorBase* actorBase = NULL; if (ExtractArgs(PASS_EXTRACT_ARGS, skillname, &skill, &actorBase)) { if (!actorBase && thisObj) { actorBase = OBLIVION_CAST(thisObj->baseForm, TESForm, TESActorBase); } TESCreature* crea = OBLIVION_CAST(actorBase, TESActorBase, TESCreature); if (crea && skill < 0x100) { if (!_stricmp(skillname, "combat")) { crea->combatSkill = skill; } else if (!_stricmp(skillname, "stealth")) { crea->stealthSkill = skill; } else if (!_stricmp(skillname, "magic")) { crea->magicSkill = skill; } } } return true; }
static bool Cmd_SetDebugMode_Execute(COMMAND_ARGS) { *result = 0; UInt32 bEnableDebug = 0; UInt32 modIndexArg = 0xFFFF; if (!ExtractArgs(PASS_EXTRACT_ARGS, &bEnableDebug, &modIndexArg)) return true; UInt8 modIndex = modIndexArg; if (modIndexArg == 0xFFFF) modIndex = scriptObj->GetModIndex(); if (modIndex > 0 && modIndex < 0xFF) { UInt8 modBit = modIndex % 32; //which bit to toggle //modIndex /= 32; UInt8 bucket = modIndex / 32; //index into bitfield array if (bEnableDebug) ModDebugStates[bucket].Set(1 << modBit); else ModDebugStates[bucket].UnSet(1 << modBit); if (IsConsoleMode()) Console_Print("Debug statements toggled %s for mod %02X", (bEnableDebug ? "on" : "off"), modIndex); } return true; }
static bool Cmd_SetCellResetHours_Execute(COMMAND_ARGS) { // specifies # of hours from now until cell reset *result = 0; TESObjectCELL* cell = NULL; UInt32 numHours = -1; if (ExtractArgs(PASS_EXTRACT_ARGS, &cell, &numHours) && cell && numHours != -1) { if (cell->IsInterior() && cell != (*g_thePlayer)->parentCell) { SInt32 iHoursToRespawn = TimeGlobals::HoursToRespawnCell(); SInt32 iHoursPassed = TimeGlobals::GameHoursPassed(); SInt32 detachTime = iHoursPassed + numHours - iHoursToRespawn; if (detachTime < iHoursPassed) { *result = 1; CALL_MEMBER_FN(cell, SetDetachTime)(detachTime); if (IsConsoleMode()) Console_Print("Current hours passed :%d Detach time: %d", iHoursPassed, detachTime); } else if (IsConsoleMode()) Console_Print("Detach time %d cannot be greater than current hours passed %d", detachTime, iHoursPassed); } } return true; }
static bool Cmd_SetClassAttribute_Execute(COMMAND_ARGS) { *result = 0; UInt32 which = 0; UInt32 nuAttr = -1; TESClass* theClass = NULL; if (ExtractArgs(PASS_EXTRACT_ARGS, &which, &nuAttr, &theClass) && which < 2 && nuAttr <= kActorVal_Luck) { if (!theClass && thisObj) { TESNPC* npc = OBLIVION_CAST(thisObj->baseForm, TESForm, TESNPC); if (npc && npc->npcClass) theClass = npc->npcClass; } if (theClass) { // make sure attribute is not the same as other governing attribute if (theClass->attributes[1 - which] != nuAttr) { theClass->attributes[which] = nuAttr; *result = 1; } } } return true; }