12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 27 ■ API <strong>Reference</strong> 819Arguments:index—Index <strong>of</strong> an entry in the trainer service listing (between 1 <strong>and</strong>GetNumTrainerServices()) (number)Returns:reqLevel—Level required to purchase the service, or nil if the service has nolevel requirement (number)GetTrainerServiceNumAbilityReqReturns the number <strong>of</strong> ability requirements <strong>for</strong> purchasing a trainer service.numRequirements = GetTrainerServiceNumAbilityReq(index)Ability requirements are <strong>of</strong>ten used <strong>for</strong> ranked class spells purchased from thetrainer: e.g. learning Blood Strike (Rank 3) requires having learned Blood Strike(Rank 2). See GetTrainerServiceAbilityReq() <strong>for</strong> in<strong>for</strong>mation aboutspecific ability requirements.Arguments:index—Index <strong>of</strong> an entry in the trainer service listing (between 1 <strong>and</strong>GetNumTrainerServices()) (number)Returns:numRequirements—Number <strong>of</strong> different ability requirements <strong>for</strong> the trainerservice (number)Example:-- prints a list <strong>of</strong> trainer services with their ability requirements<strong>for</strong> index = 1, GetNumTrainerServices() dolocal name, rank, serviceType = GetTrainerServiceInfo(index)if serviceType ~= “header“ thenlocal numRequirements = GetTrainerServiceNumAbilityReq(index)if numRequirements > 0 thenprint(“Ability requirements <strong>for</strong> “ .. name .. i“ (“ .. rank .. “):“)<strong>for</strong> i=1,numRequirements dolocal ability, hasReq = iGetTrainerServiceAbilityReq(index, i)if hasReq thenprint(“ + “ .. ability)elseprint(“ - “ .. ability)endendendendendGetTrainerServiceSkillLineReturns the name <strong>of</strong> the skill line associated with a trainer service.skillLine = GetTrainerServiceSkillLine(index)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!