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

Function SkillBarFindItem

OsiInterface/Functions/PlayerFunctions.cpp:153–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 bool SkillBarFindItem(OsiArgumentDesc & args)
154 {
155 auto characterGuid = args[0].String;
156 auto skillBar = GetSkillBar(characterGuid);
157 if (skillBar == nullptr) return false;
158
159 auto itemGuid = args[1].String;
160 auto item = FindItemByNameGuid(itemGuid);
161 if (item == nullptr) {
162 OsiError("Item '" << itemGuid << "' does not exist!");
163 return false;
164 }
165
166 ObjectHandle handle;
167 item->GetObjectHandle(&handle);
168
169 for (uint32_t i = 0; i < skillBar->Set.Size; i++) {
170 auto & skill = skillBar->Set.Buf[i];
171 if (skill.Type == esv::SkillBarItem::kItem
172 && skill.ItemHandle == handle) {
173 args[2].Int32 = i;
174 return true;
175 }
176 }
177
178 return false;
179 }
180
181 void SkillBarSetSkill(OsiArgumentDesc const & args)
182 {

Callers

nothing calls this directly

Calls 2

GetSkillBarFunction · 0.85
FindItemByNameGuidFunction · 0.85

Tested by

no test coverage detected