本文整理汇总了C++中GetTalentSpellCost函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTalentSpellCost函数的具体用法?C++ GetTalentSpellCost怎么用?C++ GetTalentSpellCost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTalentSpellCost函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: HandleLearnCommand
static bool HandleLearnCommand(ChatHandler* handler, const char* args)
{
Player* targetPlayer = handler->getSelectedPlayer();
if(!targetPlayer)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = handler->extractSpellIdFromLink((char*)args);
if(!spell || !sSpellStore.LookupEntry(spell))
return false;
char const* allStr = strtok(NULL, " ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
handler->SetSentErrorMessage(true);
return false;
}
if(!allRanks && targetPlayer->HasSpell(spell))
{
if(targetPlayer == handler->GetSession()->GetPlayer())
handler->SendSysMessage(LANG_YOU_KNOWN_SPELL);
else
handler->PSendSysMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
handler->SetSentErrorMessage(true);
return false;
}
if(allRanks)
targetPlayer->learnSpellHighRank(spell);
else
targetPlayer->learnSpell(spell, false);
uint32 first_spell = sSpellMgr->GetFirstSpellInChain(spell);
if(GetTalentSpellCost(first_spell))
targetPlayer->SendTalentsInfoData(false);
return true;
}
开发者ID:StarCore,项目名称:MythCore,代码行数:48,代码来源:cs_learn.cpp
示例2: HandleListAurasCommand
static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
char const* talentStr = handler->GetTrinityString(LANG_TALENT);
char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE);
Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()];
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
(talent ? talentStr : ""), aura->GetCasterGUID().IsPlayer() ? "player" : "creature",
aura->GetCasterGUID().GetCounter());
}
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i));
if (auraList.empty())
continue;
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i);
for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr)
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount());
}
return true;
}
开发者ID:AllThing,项目名称:TrinityCore,代码行数:47,代码来源:cs_list.cpp
示例3: HandleLearnAllMySpellsCommand
static bool HandleLearnAllMySpellsCommand(ChatHandler* handler, char const* /*args*/)
{
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass());
if (!classEntry)
return true;
uint32 family = classEntry->spellfamily;
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
{
SkillLineAbilityEntry const* entry = sSkillLineAbilityStore.LookupEntry(i);
if (!entry)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->spellId);
if (!spellInfo)
continue;
// skip server-side/triggered spells
if (spellInfo->SpellLevel == 0)
continue;
// skip wrong class/race skills
if (!handler->GetSession()->GetPlayer()->IsSpellFitByClassAndRace(spellInfo->Id))
continue;
// skip other spell families
if (spellInfo->SpellFamilyName != family)
continue;
// skip spells with first rank learned as talent (and all talents then also)
uint32 firstRank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id);
if (GetTalentSpellCost(firstRank) > 0)
continue;
// skip broken spells
if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
handler->GetSession()->GetPlayer()->learnSpell(spellInfo->Id, false);
}
handler->SendSysMessage(LANG_COMMAND_LEARN_CLASS_SPELLS);
return true;
}
开发者ID:Xanvial,项目名称:TrinityCore,代码行数:44,代码来源:cs_learn.cpp
示例4: HandleUnLearnCommand
static bool HandleUnLearnCommand(ChatHandler* handler, char const* args)
{
Player* target;
uint64 targetGuid;
std::string targetName;
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
if (!target)
{
handler->SetSentErrorMessage(true);
return false;
}
char const* spell = strtok(NULL, "");
if (!spell)
return false;
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellId = handler->extractSpellIdFromLink((char*)spell);
if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
return false;
char const* allStr = strtok(NULL, " ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
if (allRanks)
spellId = sSpellMgr->GetFirstSpellInChain (spellId);
if (target->HasSpell(spellId))
target->removeSpell(spellId, false, !allRanks);
else
handler->SendSysMessage(LANG_FORGET_SPELL);
if (GetTalentSpellCost(spellId))
target->SendTalentsInfoData(false);
return true;
}
开发者ID:Lbniese,项目名称:WoWCircle434,代码行数:39,代码来源:cs_learn.cpp
示例5: GetTalentSpellCost
uint32 GetTalentSpellCost(uint32 spellId)
{
return GetTalentSpellCost(GetTalentSpellPos(spellId));
}
开发者ID:51kfa,项目名称:mangos-classic,代码行数:4,代码来源:DBCStores.cpp
示例6: HandleLearnCommand
static bool HandleLearnCommand(ChatHandler* handler, char const* args)
{
Player* targetPlayer = handler->getSelectedPlayer();
if (!targetPlayer)
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
handler->SetSentErrorMessage(true);
return false;
}
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = handler->extractSpellIdFromLink((char*)args);
if (!spell)
return false;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
handler->SetSentErrorMessage(true);
return false;
}
if (!SpellMgr::IsSpellValid(spellInfo))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
handler->SetSentErrorMessage(true);
return false;
}
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spell);
uint32 spellDifficultyId = sSpellMgr->GetSpellDifficultyId(spell);
if (handler->GetSession()->GetSecurity() < SEC_CONSOLE && (bounds.first != bounds.second || spellDifficultyId))
{
handler->PSendSysMessage("Spell %u cannot be learnt using a command!", spell);
handler->SetSentErrorMessage(true);
return false;
}
char const* all = strtok(NULL, " ");
bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false;
if (!allRanks && targetPlayer->HasSpell(spell))
{
if (targetPlayer == handler->GetSession()->GetPlayer())
handler->SendSysMessage(LANG_YOU_KNOWN_SPELL);
else
handler->PSendSysMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
handler->SetSentErrorMessage(true);
return false;
}
if (allRanks)
targetPlayer->learnSpellHighRank(spell);
else
targetPlayer->learnSpell(spell);
uint32 firstSpell = sSpellMgr->GetFirstSpellInChain(spell);
if (GetTalentSpellCost(firstSpell))
targetPlayer->SendTalentsInfoData(false);
return true;
}
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:64,代码来源:cs_learn.cpp
示例7: HandleLookupSpellIdCommand
static bool HandleLookupSpellIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// can be NULL at console call
Player* target = handler->getSelectedPlayer();
uint32 id = atoi((char*)args);
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id))
{
int locale = handler->GetSessionDbcLocale();
std::string name = spellInfo->SpellName;
if (name.empty())
{
handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
return true;
}
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = spellInfo->IsPassive();
bool active = target && target->HasAura(id);
// unit32 used to prevent interpreting uint8 as char at output
// find rank of learned spell for learning spell, or talent rank
uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
std::ostringstream ss;
if (handler->GetSession())
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
else
ss << id << " - " << name;
// include rank in link name
if (rank)
ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
if (handler->GetSession())
ss << ' ' << localeNames[locale] << "]|h|r";
else
ss << ' ' << localeNames[locale];
if (talent)
ss << handler->GetTrinityString(LANG_TALENT);
if (passive)
ss << handler->GetTrinityString(LANG_PASSIVE);
if (learn)
ss << handler->GetTrinityString(LANG_LEARN);
if (known)
ss << handler->GetTrinityString(LANG_KNOWN);
if (active)
ss << handler->GetTrinityString(LANG_ACTIVE);
handler->SendSysMessage(ss.str().c_str());
}
else
handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
return true;
}
开发者ID:BravadoToDeath,项目名称:ArkCORE-NG,代码行数:69,代码来源:cs_lookup.cpp
示例8: HandleLookupSpellCommand
static bool HandleLookupSpellCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
// can be NULL at console call
Player* target = handler->getSelectedPlayer();
std::string namePart = args;
std::wstring wNamePart;
if (!Utf8toWStr(namePart, wNamePart))
return false;
// converting string that we try to find to lower case
wstrToLower(wNamePart);
bool found = false;
uint32 count = 0;
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in Spell.dbc
for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (spellInfo)
{
std::string name = spellInfo->SpellName;
if (name.empty())
continue;
if (!Utf8FitTo(name, wNamePart))
continue;
if (maxResults && count++ == maxResults)
{
handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
return true;
}
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = spellInfo->IsPassive();
bool active = target && target->HasAura(id);
// unit32 used to prevent interpreting uint8 as char at output
// find rank of learned spell for learning spell, or talent rank
uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank();
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
std::ostringstream ss;
if (handler->GetSession())
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name;
else
ss << id << " - " << name;
// include rank in link name
if (rank)
ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank;
if (handler->GetSession())
ss << "]|h|r";
if (talent)
ss << handler->GetTrinityString(LANG_TALENT);
if (passive)
ss << handler->GetTrinityString(LANG_PASSIVE);
if (learn)
ss << handler->GetTrinityString(LANG_LEARN);
if (known)
ss << handler->GetTrinityString(LANG_KNOWN);
if (active)
ss << handler->GetTrinityString(LANG_ACTIVE);
handler->SendSysMessage(ss.str().c_str());
if (!found)
found = true;
}
}
if (!found)
handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND);
return true;
}
开发者ID:BravadoToDeath,项目名称:ArkCORE-NG,代码行数:91,代码来源:cs_lookup.cpp
注:本文中的GetTalentSpellCost函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论