MCPcopy Create free account
hub / github.com/Norbyte/ositools / SkillBarSetItem

Function SkillBarSetItem

OsiInterface/Functions/PlayerFunctions.cpp:205–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203 }
204
205 void SkillBarSetItem(OsiArgumentDesc const & args)
206 {
207 auto characterGuid = args[0].String;
208 auto slot = args[1].Int32;
209 auto itemGuid = args[2].String;
210
211 auto item = FindItemByNameGuid(itemGuid);
212 if (item == nullptr) {
213 OsiError("Item '" << itemGuid << "' does not exist!");
214 return;
215 }
216
217 auto skillBarItem = SkillBarGetSlot(characterGuid, slot);
218 if (skillBarItem == nullptr) return;
219
220 ObjectHandle handle;
221 item->GetObjectHandle(&handle);
222 // FIXME - check if item is in the players' inventory?
223
224 skillBarItem->Type = esv::SkillBarItem::kItem;
225 skillBarItem->SkillOrStatId = item->StatsId;
226 skillBarItem->ItemHandle = handle;
227
228 auto character = FindCharacterByNameGuid(characterGuid);
229 character->PlayerData->Dirty = true;
230 }
231
232 void SkillBarClear(OsiArgumentDesc const & args)
233 {

Callers

nothing calls this directly

Calls 3

FindItemByNameGuidFunction · 0.85
SkillBarGetSlotFunction · 0.85
FindCharacterByNameGuidFunction · 0.85

Tested by

no test coverage detected