本文整理汇总了C++中debug_log函数的典型用法代码示例。如果您正苦于以下问题:C++ debug_log函数的具体用法?C++ debug_log怎么用?C++ debug_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: debug_log
void instance_gundrak::SetData(uint32 uiType, uint32 uiData)
{
debug_log("SD2: Instance Gundrak: SetData received for type %u with data %u",uiType,uiData);
switch(uiType)
{
case TYPE_SLADRAN:
m_auiEncounter[0] = uiData;
if (uiData == DONE)
if (GameObject* pGo = instance->GetGameObject(m_uiAltarOfSladranGUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
if (uiData == SPECIAL)
{
DoUseDoorOrButton(m_uiSnakeKeyGUID);
DoSwitchBridgeIfCan();
}
break;
case TYPE_MOORABI:
m_auiEncounter[1] = uiData;
if (uiData == DONE)
{
if (!instance->IsRegularDifficulty())
DoUseDoorOrButton(m_uiEckDoorGUID);
if (GameObject* pGo = instance->GetGameObject(m_uiAltarOfMoorabiGUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
}
if (uiData == SPECIAL)
{
DoUseDoorOrButton(m_uiMammothKeyGUID);
DoSwitchBridgeIfCan();
}
break;
case TYPE_COLOSSUS:
m_auiEncounter[2] = uiData;
if (uiData == DONE)
if (GameObject* pGo = instance->GetGameObject(m_uiAltarOfColossusGUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
if (uiData == SPECIAL)
{
DoUseDoorOrButton(m_uiTrollKeyGUID);
DoSwitchBridgeIfCan();
}
break;
case TYPE_GALDARAH:
m_auiEncounter[3] = uiData;
DoUseDoorOrButton(m_uiGaldarahDoorGUID);
if (uiData == DONE)
{
DoUseDoorOrButton(m_uiExitDoorLeftGUID);
DoUseDoorOrButton(m_uiExitDoorRightGUID);
}
break;
case TYPE_ECK:
m_auiEncounter[4] = uiData;
if (uiData == DONE)
DoUseDoorOrButton(m_uiEckUnderwaterDoorGUID);
break;
default:
error_log("SD2: Instance Gundrak: ERROR SetData = %u for type %u does not exist/not implemented.",uiType,uiData);
break;
}
if (uiData == DONE)
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " "
<< m_auiEncounter[4];
strInstData = saveStream.str();
SaveToDB();
OUT_SAVE_INST_DATA_COMPLETE;
}
}
示例2: debug_log
CanCastResult BossSpellWorker::_BSWSpellSelector(uint8 m_uiSpellIdx, Unit* pTarget)
{
if (_bossSpellCount == 0) return CAST_FAIL_OTHER;
SpellEntry const *spell;
SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx];
Unit* pSummon = NULL;
debug_log("BSW: Casting spell number %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget);
switch (pSpell->m_CastTarget) {
case DO_NOTHING:
return CAST_OK;
case CAST_ON_SELF:
if (!pSpell->m_IsBugged) return _DoCastSpellIfCan(boss, pSpell->m_uiSpellEntry[currentDifficulty]);
else return _BSWDoCast(m_uiSpellIdx, boss);
break;
case CAST_ON_SUMMONS:
if (!pTarget) return CAST_FAIL_OTHER;
else return _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]);
break;
case CAST_ON_VICTIM:
pTarget = boss->getVictim();
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_RANDOM:
pTarget = SelectUnit(SELECT_TARGET_RANDOM);
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_BOTTOMAGGRO:
pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case CAST_ON_TARGET:
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
break;
case APPLY_AURA_SELF:
if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]))
if(boss->AddAura(pSpell->m_uiSpellEntry[currentDifficulty], boss))
return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case APPLY_AURA_TARGET:
if (!pTarget) return CAST_FAIL_OTHER;
if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]))
if (pTarget->AddAura(pSpell->m_uiSpellEntry[currentDifficulty], pTarget))
return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_NORMAL:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_TEMP:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,
urand(pSpell->m_uiSpellTimerMin[currentDifficulty],pSpell->m_uiSpellTimerMax[currentDifficulty]));
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case SUMMON_INSTANT:
pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_MANUAL_DESPAWN,0);
if(pSummon) return CAST_OK;
else return CAST_FAIL_OTHER;
break;
case CAST_ON_ALLPLAYERS:
{
CanCastResult res1 = CAST_FAIL_OTHER;
Map::PlayerList const& pPlayers = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
{
pTarget = itr->getSource();
if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(boss, pSpell->LocData.x))
if (!pSpell->m_IsBugged) {
res1 = _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]);
}
else {
_BSWDoCast(m_uiSpellIdx, pTarget);
res1 = CAST_OK;
};
return res1;
}
break;
}
case CAST_ON_FRENDLY:
pTarget = SelectLowHPFriendly();
return _BSWCastOnTarget(pTarget, m_uiSpellIdx);
//.........这里部分代码省略.........
示例3: aircraft_fire_weapon
aircraft_fire_result aircraft_fire_weapon (entity *en, unsigned int check_flags)
{
entity
*target;
aircraft
*raw;
vec3d
*target_pos,
en_pos;
int loal_mode = FALSE;
ASSERT (en);
raw = (aircraft *) get_local_entity_data (en);
//
// Fire suppressed
//
if (check_flags & AIRCRAFT_FIRE_SUPPRESSED)
{
if (get_local_entity_int_value (get_session_entity (), INT_TYPE_SUPPRESS_AI_FIRE))
{
return AIRCRAFT_FIRE_SUPPRESSED;
}
}
//
// check weapon
//
if (check_flags & AIRCRAFT_FIRE_NO_WEAPON)
{
if (get_local_entity_int_value (en, INT_TYPE_SELECTED_WEAPON) == ENTITY_SUB_TYPE_WEAPON_NO_WEAPON)
{
debug_log ("AC_WPN: Fire Weapon Error - NO WEAPON");
return AIRCRAFT_FIRE_NO_WEAPON;
}
}
//
// weapon system_ready
//
if (check_flags & AIRCRAFT_FIRE_WEAPON_SYSTEM_NOT_READY)
{
if (!get_local_entity_int_value (en, INT_TYPE_SELECTED_WEAPON_SYSTEM_READY))
{
debug_log ("AC_WPN: Fire Weapon Error - WEAPON SYSTEM NOT READY");
return AIRCRAFT_FIRE_WEAPON_SYSTEM_NOT_READY;
}
}
// debug_log("%s: %d", get_sub_type_name(en), get_local_entity_int_value (en, INT_TYPE_SELECTED_WEAPON));
//
// find target
//
if (check_flags & AIRCRAFT_FIRE_NO_TARGET)
{
target = get_local_entity_parent (en, LIST_TYPE_TARGET);
if (!target)
{
debug_log ("AC_WPN: Fire Weapon Error - NO TARGET");
return AIRCRAFT_FIRE_NO_TARGET;
}
}
//
// line of sight checks
//
if (check_flags & AIRCRAFT_FIRE_NO_LOS)
{
int
criteria;
if (get_local_entity_int_value (target, INT_TYPE_PLAYER) != ENTITY_PLAYER_AI)
{
criteria = MOBILE_LOS_CHECK_ALL;
}
else
{
criteria = MOBILE_LOS_CHECK_COURSE_TERRAIN;
}
get_local_entity_vec3d (en, VEC3D_TYPE_POSITION, &en_pos);
target_pos = get_local_entity_vec3d_ptr (target, VEC3D_TYPE_POSITION);
en_pos.y -= (get_local_entity_float_value (en, FLOAT_TYPE_CENTRE_OF_GRAVITY_TO_GROUND_DISTANCE) + 2.0);
//.........这里部分代码省略.........
示例4: DoScriptText
/**
* Function that does script text
*
* @param iTextEntry Entry of the text, stored in SD2-database
* @param pSource Source of the text
* @param pTarget Can be NULL (depending on CHAT_TYPE of iTextEntry). Possible target for the text
*/
void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget)
{
if (!pSource)
{
error_log("SD2: DoScriptText entry %i, invalid Source pointer.", iTextEntry);
return;
}
if (iTextEntry >= 0)
{
error_log("SD2: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",
pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
return;
}
const StringTextData* pData = pSystemMgr.GetTextData(iTextEntry);
if (!pData)
{
error_log("SD2: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",
pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
return;
}
debug_log("SD2: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",
iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
if (pData->uiSoundId)
{
if (GetSoundEntriesStore()->LookupEntry(pData->uiSoundId))
{
if (pData->uiType == CHAT_TYPE_ZONE_YELL)
pSource->GetMap()->PlayDirectSoundToMap(pData->uiSoundId, pSource->GetZoneId());
else if (pData->uiType == CHAT_TYPE_WHISPER || pData->uiType == CHAT_TYPE_BOSS_WHISPER)
{
// An error will be displayed for the text
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
pSource->PlayDirectSound(pData->uiSoundId, (Player*)pTarget);
}
else
pSource->PlayDirectSound(pData->uiSoundId);
}
else
error_log("SD2: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
}
if (pData->uiEmote)
{
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
((Unit*)pSource)->HandleEmote(pData->uiEmote);
else
error_log("SD2: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
}
switch(pData->uiType)
{
case CHAT_TYPE_SAY:
pSource->MonsterSay(iTextEntry, pData->uiLanguage, pTarget);
break;
case CHAT_TYPE_YELL:
pSource->MonsterYell(iTextEntry, pData->uiLanguage, pTarget);
break;
case CHAT_TYPE_TEXT_EMOTE:
pSource->MonsterTextEmote(iTextEntry, pTarget);
break;
case CHAT_TYPE_BOSS_EMOTE:
pSource->MonsterTextEmote(iTextEntry, pTarget, true);
break;
case CHAT_TYPE_WHISPER:
{
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, pTarget);
else
error_log("SD2: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
break;
}
case CHAT_TYPE_BOSS_WHISPER:
{
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(iTextEntry, pTarget, true);
else
error_log("SD2: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
break;
}
case CHAT_TYPE_ZONE_YELL:
pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, pTarget);
break;
}
}
示例5: GetSingleCreatureFromStorage
void instance_stratholme::Update(uint32 uiDiff)
{
if (m_uiBarthilasRunTimer)
{
if (m_uiBarthilasRunTimer <= uiDiff)
{
Creature* pBarthilas = GetSingleCreatureFromStorage(NPC_BARTHILAS);
if (pBarthilas && pBarthilas->IsAlive() && !pBarthilas->IsInCombat())
pBarthilas->NearTeleportTo(aStratholmeLocation[1].m_fX, aStratholmeLocation[1].m_fY, aStratholmeLocation[1].m_fZ, aStratholmeLocation[1].m_fO);
SetData(TYPE_BARTHILAS_RUN, DONE);
m_uiBarthilasRunTimer = 0;
}
else
m_uiBarthilasRunTimer -= uiDiff;
}
if (m_uiBaronRunTimer)
{
if (m_uiYellCounter == 0 && m_uiBaronRunTimer <= 10 * MINUTE * IN_MILLISECONDS)
{
DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_10_MIN, NPC_BARON);
++m_uiYellCounter;
}
else if (m_uiYellCounter == 1 && m_uiBaronRunTimer <= 5 * MINUTE * IN_MILLISECONDS)
{
DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_5_MIN, NPC_BARON);
++m_uiYellCounter;
}
if (m_uiBaronRunTimer <= uiDiff)
{
SetData(TYPE_BARON_RUN, FAIL);
DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_FAIL, NPC_BARON);
m_uiBaronRunTimer = 0;
debug_log("SD2: Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
}
else
m_uiBaronRunTimer -= uiDiff;
}
if (m_uiMindlessSummonTimer)
{
if (m_uiMindlessCount < 30)
{
if (m_uiMindlessSummonTimer <= uiDiff)
{
if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
{
// Summon mindless skeletons and move them to random point in the center of the square
if (Creature* pTemp = pBaron->SummonCreature(NPC_MINDLESS_UNDEAD, aStratholmeLocation[4].m_fX, aStratholmeLocation[4].m_fY, aStratholmeLocation[4].m_fZ, aStratholmeLocation[4].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
{
float fX, fY, fZ;
pBaron->GetRandomPoint(aStratholmeLocation[5].m_fX, aStratholmeLocation[5].m_fY, aStratholmeLocation[5].m_fZ, 20.0f, fX, fY, fZ);
pTemp->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
m_luiUndeadGUIDs.push_back(pTemp->GetObjectGuid());
++m_uiMindlessCount;
}
}
m_uiMindlessSummonTimer = 400;
}
else
m_uiMindlessSummonTimer -= uiDiff;
}
else
m_uiMindlessSummonTimer = 0;
}
if (m_uiSlaugtherSquareTimer)
{
if (m_uiSlaugtherSquareTimer <= uiDiff)
{
// Call next Abomnations
for (GuidSet::const_iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end(); ++itr)
{
Creature* pAbom = instance->GetCreature(*itr);
// Skip killed and already walking Abomnations
if (!pAbom || !pAbom->IsAlive() || pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
continue;
// Let Move to somewhere in the middle
if (!pAbom->IsInCombat())
{
if (GameObject* pDoor = GetSingleGameObjectFromStorage(GO_PORT_SLAUGTHER))
{
float fX, fY, fZ;
pAbom->GetRandomPoint(pDoor->GetPositionX(), pDoor->GetPositionY(), pDoor->GetPositionZ(), 10.0f, fX, fY, fZ);
pAbom->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
}
}
break;
}
// TODO - how fast are they called?
m_uiSlaugtherSquareTimer = urand(15000, 30000);
}
else
m_uiSlaugtherSquareTimer -= uiDiff;
//.........这里部分代码省略.........
示例6: hna_global_add_orig
void hna_global_add_orig(struct orig_node *orig_node,
unsigned char *hna_buff, int hna_buff_len)
{
struct hna_global_entry *hna_global_entry;
struct hna_local_entry *hna_local_entry;
struct hashtable_t *swaphash;
char hna_str[ETH_STR_LEN], orig_str[ETH_STR_LEN];
int hna_buff_count = 0;
unsigned long flags;
unsigned char *hna_ptr;
addr_to_string(orig_str, orig_node->orig);
while ((hna_buff_count + 1) * ETH_ALEN <= hna_buff_len) {
spin_lock_irqsave(&hna_global_hash_lock, flags);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
hna_global_entry = (struct hna_global_entry *)
hash_find(hna_global_hash, hna_ptr);
if (hna_global_entry == NULL) {
spin_unlock_irqrestore(&hna_global_hash_lock, flags);
hna_global_entry =
kmalloc(sizeof(struct hna_global_entry),
GFP_ATOMIC);
if (!hna_global_entry)
break;
memcpy(hna_global_entry->addr, hna_ptr, ETH_ALEN);
addr_to_string(hna_str, hna_global_entry->addr);
debug_log(LOG_TYPE_ROUTES, "Creating new global hna entry: %s (via %s)\n", hna_str, orig_str);
spin_lock_irqsave(&hna_global_hash_lock, flags);
hash_add(hna_global_hash, hna_global_entry);
}
hna_global_entry->orig_node = orig_node;
spin_unlock_irqrestore(&hna_global_hash_lock, flags);
/* remove address from local hash if present */
spin_lock_irqsave(&hna_local_hash_lock, flags);
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
hna_local_entry = (struct hna_local_entry *)
hash_find(hna_local_hash, hna_ptr);
if (hna_local_entry != NULL)
hna_local_del(hna_local_entry, "global hna received");
spin_unlock_irqrestore(&hna_local_hash_lock, flags);
hna_buff_count++;
}
orig_node->hna_buff_len = hna_buff_len;
if (orig_node->hna_buff_len > 0) {
orig_node->hna_buff = kmalloc(orig_node->hna_buff_len,
GFP_ATOMIC);
memcpy(orig_node->hna_buff, hna_buff, orig_node->hna_buff_len);
} else {
orig_node->hna_buff = NULL;
}
spin_lock_irqsave(&hna_global_hash_lock, flags);
if (hna_global_hash->elements * 4 > hna_global_hash->size) {
swaphash = hash_resize(hna_global_hash,
hna_global_hash->size * 2);
if (swaphash == NULL)
debug_log(LOG_TYPE_CRIT, "Couldn't resize global hna hash table \n");
else
hna_global_hash = swaphash;
}
spin_unlock_irqrestore(&hna_global_hash_lock, flags);
}
示例7: UpdateAI
//.........这里部分代码省略.........
else
{
//apply resistance
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
IsCastingFireball = false;
Fireball_Timer = 5000 + rand() % 10000;
}
}
else Fireball_Timer -= diff;
//ArcaneDisruption_Timer
if (ArcaneDisruption_Timer <= diff)
{
DoCastVictim( SPELL_ARCANE_DISRUPTION, true);
ArcaneDisruption_Timer = 60000;
}
else ArcaneDisruption_Timer -= diff;
if (FlameStrike_Timer <= diff)
{
if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_FLAME_STRIKE);
FlameStrike_Timer = 30000;
}
FlameStrike_Timer -= diff;
if (MindControl_Timer <= diff)
{
if (me->getThreatManager().getThreatList().size() >= 2)
for (uint32 i = 0; i < 3; i++)
{
debug_log("OSCR: Kael'Thas mind control not supported.");
//DoCast(pTarget, SPELL_MIND_CONTROL);
}
MindControl_Timer = 60000;
}
MindControl_Timer -= diff;
}
//Phoenix_Timer
if (Phoenix_Timer <= diff)
{
DoCast(me, SPELL_PHOENIX_ANIMATION);
if (Creature* pPhoenix = me->SummonCreature(NPC_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000))
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
pPhoenix->AI()->AttackStart(pTarget);
}
else
error_log("OSCR: Kael'Thas Phoenix could not be spawned");
switch (rand() % 2)
{
case 0:
DoScriptText(SAY_SUMMON_PHOENIX1, me);
break;
case 1:
DoScriptText(SAY_SUMMON_PHOENIX2, me);
break;
}
Phoenix_Timer = 60000;
示例8: UpdateAI
void UpdateAI(const uint32 uiDiff){
if(portalLoc != -1)
StartMovement();
if (IsWalking && WalkTimer)
{
if (WalkTimer <= uiDiff)
{
if (WayPoint != WayPointList.end())
{
m_creature->GetMotionMaster()->MovePoint(WayPoint->id, WayPoint->x, WayPoint->y,WayPoint->z);
WalkTimer = 0;
}
}else WalkTimer -= uiDiff;
}
//Corrupt Seal
if(Creature *pDoorSeal2 = GetClosestCreatureWithEntry(m_creature, NPC_DOOR_SEAL, 150.0f)){
if(m_creature->IsWithinDist(pDoorSeal2, 27.0f, false) && !IsInCombat)
{
IsWalking = false;
WayPointList.clear();
m_creature->GetMotionMaster()->Clear(false);
m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
DoCast(pDoorSeal2, SPELL_CORRUPT);
m_pInstance->SetData(TYPE_DOOR,SPECIAL);
}
}
if(!IsWalking && !IsInCombat) {
if (Unit* m_uEmbraceTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
m_creature->GetMotionMaster()->MoveChase(m_uEmbraceTarget);
m_creature->SetInCombatWithZone();
IsInCombat = true;
}
//Return since we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if(m_creature->getVictim())
if(m_creature->getVictim()->GetEntry() == NPC_DOOR_SEAL)
return;
switch(creatureEntry)
{
case NPC_AZURE_CAPTAIN:
AzureCaptain_UpdateAI(uiDiff);
break;
case NPC_AZURE_RAIDER:
AzureRaider_UpdateAI(uiDiff);
break;
case NPC_AZURE_SORCEROR:
AzureSorceror_UpdateAI(uiDiff);
break;
case NPC_AZURE_STALKER:
AzureStalker_UpdateAI(uiDiff);
break;
case NPC_GUARDIAN:
case NPC_KEEPER:
case NPC_AZURE_BINDER:
case NPC_AZURE_INVADER:
case NPC_AZURE_MAGE_SLAYER:
case NPC_AZURE_SPELLBREAKER:
break;
default:
debug_log("重云垂� The Violet Hold: Unhandled dragon entry %u!", m_creature->GetEntry());
break;
}
DoMeleeAttackIfReady();
}
示例9: SetData
void SetData(uint32 uiType, uint32 uiData)
{
debug_log("DS: Instance Black Temple: SetData received for type %u with data %u",uiType,uiData);
switch(uiType)
{
case TYPE_NAJENTUS:
m_auiEncounter[0] = uiData;
if (uiData == DONE)
DoUseDoorOrButton(m_uiNajentusGateGUID);
break;
case TYPE_SUPREMUS:
m_auiEncounter[1] = uiData;
if (uiData == DONE)
DoUseDoorOrButton(m_uiMainTempleDoorsGUID);
break;
case TYPE_SHADE:
m_auiEncounter[2] = uiData;
if (uiData == DONE && CanPreMotherDoorOpen())
DoUseDoorOrButton(m_uiShahrazPreDoorGUID);
break;
case TYPE_GOREFIEND:
m_auiEncounter[3] = uiData;
if (uiData == DONE && CanPreMotherDoorOpen())
DoUseDoorOrButton(m_uiShahrazPreDoorGUID);
break;
case TYPE_BLOODBOIL:
m_auiEncounter[4] = uiData;
if (uiData == DONE && CanPreMotherDoorOpen())
DoUseDoorOrButton(m_uiShahrazPreDoorGUID);
break;
case TYPE_RELIQUIARY:
m_auiEncounter[5] = uiData;
if (uiData == DONE && CanPreMotherDoorOpen())
DoUseDoorOrButton(m_uiShahrazPreDoorGUID);
break;
case TYPE_SHAHRAZ:
if (uiData == DONE)
{
DoUseDoorOrButton(m_uiCouncilDoorGUID);
DoUseDoorOrButton(m_uiShahrazPostDoorGUID);
}
m_auiEncounter[6] = uiData;
break;
case TYPE_COUNCIL: m_auiEncounter[7] = uiData; break;
case TYPE_ILLIDAN: m_auiEncounter[8] = uiData; break;
default:
error_log("DS: Instance Black Temple: ERROR SetData = %u for type %u does not exist/not implemented.",uiType,uiData);
break;
}
if (uiData == DONE)
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
<< m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8];
strInstData = saveStream.str();
SaveToDB();
OUT_SAVE_INST_DATA_COMPLETE;
}
}
示例10: fetchASCStats
void fetchASCStats(int gpu, PGA_Stats * stats)
{
char command[256] = {0};
char buf[RECVSIZE+1] = {0};
sprintf_s(command, sizeof(command), "{ \"command\" : \"asc\" , \"parameter\" : \"%d\" }", gpu);
if (sendCommand(command, buf, sizeof(buf)) == 1)
{
parsePGAStats(buf, stats);
stats->id = gpu;
}
} // end of fetchASCStats()
void parseMinerConfig(char * buf, Miner_Config * minerCfg)
{
char temp[256] = {0};
char * ptr = NULL;
char * ptrEnd = NULL;
memset(minerCfg, 0, sizeof(Miner_Config));
//debug_log( LOG_SVR, "parseMinerConfig(): buf: %s", buf);
ptr = strstr(buf,"\"ASC Count\":");
if (ptr != NULL)
{
ptr += 12;
ptrEnd = strstr(ptr, ",");
if (ptrEnd != NULL)
{
memset(temp, 0, sizeof(temp));
strncpy_s(temp, sizeof(temp), ptr, ptrEnd-ptr);
minerCfg->ascCount = atoi(temp);
//debug_log( LOG_SVR, "parseMinerConfig(): ASC count, minerCfg->ascCount: %d", minerCfg->ascCount);
if (minerCfg->ascCount > MAX_ASC_DEVICES)
{
debug_log( LOG_SVR,
"parseMinerConfig(): number of ASICs defined in miner (%d) is greater than %d ASICs supported by akbash, only the first %d ASICs will be monitored.",
minerCfg->ascCount,
MAX_ASC_DEVICES,
MAX_ASC_DEVICES
);
minerCfg->ascCount = MAX_ASC_DEVICES;
}
}
}
ptr = strstr(buf,"\"PGA Count\":");
if (ptr != NULL)
{
ptr += 12;
ptrEnd = strstr(ptr, ",");
if (ptrEnd != NULL)
{
memset(temp, 0, sizeof(temp));
strncpy_s(temp, sizeof(temp), ptr, ptrEnd-ptr);
minerCfg->pgaCount = atoi(temp);
//debug_log( LOG_SVR, "parseMinerConfig(): PGA count, minerCfg->pgaCount: %d", minerCfg->pgaCount);
if (minerCfg->pgaCount > MAX_PGA_DEVICES)
{
debug_log( LOG_SVR,
"parseMinerConfig(): number of PGAs defined in cgminer (%d) is greater than %d PGAs supported by akbash, only the first %d PGAs will be monitored.",
minerCfg->pgaCount,
MAX_PGA_DEVICES,
MAX_PGA_DEVICES
);
minerCfg->pgaCount = MAX_PGA_DEVICES;
}
}
}
ptr = strstr(buf,"\"GPU Count\":");
if (ptr != NULL)
{
ptr += 12;
ptrEnd = strstr(ptr, ",");
if (ptrEnd != NULL)
{
memset(temp, 0, sizeof(temp));
strncpy_s(temp, sizeof(temp), ptr, ptrEnd-ptr);
minerCfg->gpuCount = atoi(temp);
if (minerCfg->gpuCount > MAX_GPU_DEVICES)
{
debug_log( LOG_SVR,
"parseMinerConfig(): number of gpus defined in cgminer (%d) is greater than %d gpus supported by akbash, only the first %d gpus will be monitored.",
minerCfg->gpuCount,
MAX_GPU_DEVICES,
MAX_GPU_DEVICES
//.........这里部分代码省略.........
示例11: displayMinerInfoObject
void displayMinerInfoObject(Miner_Info * mi)
{
int i = 0;
debug_log( LOG_DBG, "displayMinerInfoObject(): status: %s, gpus: %d, pgas: %d, asics: %d a: %d, gw: %d, avg: %0.2f, hw: %d, since: %s, u: %0.2f, ver: %s, days: %d, hrs: %d, min: %d, secs: %d, found blocks: %d",
gpuStatusStr(mi->status),
mi->config.gpuCount,
mi->config.pgaCount,
mi->config.ascCount,
mi->summary.accepted,
mi->summary.getworks,
mi->summary.mhsAvg,
mi->summary.hw,
mi->summary.startedOn,
mi->summary.util,
mi->summary.version,
mi->summary.days,
mi->summary.hrs,
mi->summary.min,
mi->summary.secs,
mi->summary.foundBlocks
);
for (i=0; i < mi->config.gpuCount; i++)
debug_log( LOG_DBG, "displayMinerInfoObject(): gpu %d, disabled: %s, status: %s, avg: %0.2f, %d/%d, %[email protected]%d%% hw: %d, v: %0.2f, u: %0.2f",
mi->gpu[i].id,
mi->gpu[i].disabled ? "Y" : "N",
gpuStatusStr(mi->gpu[i].status),
mi->gpu[i].avg,
mi->gpu[i].engine,
mi->gpu[i].mem,
mi->gpu[i].temp,
mi->gpu[i].fan,
mi->gpu[i].hw,
mi->gpu[i].volt,
mi->gpu[i].util
);
for (i=0; i < mi->config.pgaCount; i++)
debug_log( LOG_DBG, "displayMinerInfoObject(): pga %d, disabled: %s, status: %s, avg: %0.2f, %0.2fC hw: %d, u: %0.2f",
mi->pga[i].id,
mi->pga[i].disabled ? "Y" : "N",
gpuStatusStr(mi->pga[i].status),
mi->pga[i].avg,
mi->pga[i].temp,
mi->pga[i].hw,
mi->pga[i].util
);
for (i=0; i < mi->config.ascCount; i++)
debug_log( LOG_DBG, "displayMinerInfoObject(): asc %d, disabled: %s, status: %s, avg: %0.2f, %0.2fC hw: %d, u: %0.2f",
mi->asc[i].id,
mi->asc[i].disabled ? "Y" : "N",
gpuStatusStr(mi->asc[i].status),
mi->asc[i].avg,
mi->asc[i].temp,
mi->asc[i].hw,
mi->asc[i].util
);
for (i=0; i < mi->config.poolCount; i++)
debug_log( LOG_DBG, "displayMinerInfoObject(): pool %d, url: %s status: %s",
mi->pools[i].id,
mi->pools[i].url,
mi->pools[i].status
);
} // end of displayMinerInfoObject()
示例12: fetchGPUSummary
void fetchGPUSummary(GPU_Summary * sum)
{
char command[256] = {0};
char buf[RECVSIZE+1] = {0};
strcpy_s(command, sizeof(command), "{ \"command\" : \"summary\" }");
if (sendCommand(command, buf, sizeof(buf)) == 1)
{
parseGPUSummary(buf, sum);
}
} // end of fetchGPUSummary()
void fetchMinerInfo(Miner_Info * mi, CGMConfig * cfg)
{
int i = 0;
double maxTemp = 0;
char diffStr[128];
double difficulty = 0;
resetMinerInfoObject(mi);
// ------------------------
// Get miner configuration.
// ------------------------
fetchMinerConfig(&(mi->config));
debug_log( LOG_DBG, "fetchMinerInfo(): gpu count: %d, pga count: %d, asic count: %d", mi->config.gpuCount, mi->config.pgaCount, mi->config.ascCount);
// ------------------
// Get miner summary.
// ------------------
fetchGPUSummary(&(mi->summary));
if (mi->config.gpuCount > 0 || mi->config.pgaCount > 0 || mi->config.ascCount > 0)
mi->status = ALIVE;
// --------------
// Get GPU Stats.
// --------------
for(i=0; i < mi->config.gpuCount; i++)
{
// -------------
// Get GPU stat.
// -------------
fetchGPUStats(i, &(mi->gpu[i]));
if (mi->gpu[i].temp > maxTemp)
maxTemp = mi->gpu[i].temp;
if (mi->gpu[i].disabled)
{
mi->summary.mhsAvg -= mi->gpu[i].avg;
mi->summary.util -= mi->gpu[i].util;
mi->gpu[i].avg = 0.0;
mi->gpu[i].util = 0.0;
}
if (mi->gpu[i].status != ALIVE)
{
mi->status = mi->gpu[i].status;
debug_log( LOG_INF, "fetchMinerInfo(): gpu %d: status: %s, setting miner status to: %s",
i,
gpuStatusStr(mi->gpu[i].status),
gpuStatusStr(mi->status)
);
}
}
// --------------
// Get PGA Stats.
// --------------
for(i=0; i < mi->config.pgaCount; i++)
{
// -------------
// Get PGA stat.
// -------------
fetchPGAStats(i, &(mi->pga[i]));
if (mi->pga[i].temp > maxTemp)
maxTemp = mi->pga[i].temp;
if (mi->pga[i].status != ALIVE)
{
mi->status = mi->pga[i].status;
debug_log( LOG_INF, "fetchMinerInfo(): pga %d: status: %s, setting miner status to: %s",
i,
gpuStatusStr(mi->pga[i].status),
gpuStatusStr(mi->status)
);
}
}
// --------------
// Get ASC Stats.
// --------------
for(i=0; i < mi->config.ascCount; i++)
{
// -------------
//.........这里部分代码省略.........
示例13: debug_log
void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
//Waypoint Updating
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (m_uiWPWaitTimer <= uiDiff)
{
//End of the line
if (CurrentWP == WaypointList.end())
{
debug_log("SD2: EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
float fRetX, fRetY, fRetZ;
m_creature->GetRespawnCoord(fRetX, fRetY, fRetZ);
m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
m_uiWPWaitTimer = 0;
debug_log("SD2: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
if (m_bCanInstantRespawn)
{
m_creature->setDeathState(JUST_DIED);
m_creature->Respawn();
}
else
m_creature->ForcedDespawn();
return;
}
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
debug_log("SD2: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
m_uiWPWaitTimer = 0;
}
}
else
m_uiWPWaitTimer -= uiDiff;
}
//Check if player or any member of his group is within range
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !m_creature->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (m_uiPlayerCheckTimer < uiDiff)
{
if (!IsPlayerOrGroupInRange())
{
debug_log("SD2: EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
m_creature->setDeathState(JUST_DIED);
m_creature->Respawn();
}
else
m_creature->ForcedDespawn();
return;
}
m_uiPlayerCheckTimer = 1000;
}
else
m_uiPlayerCheckTimer -= uiDiff;
}
UpdateEscortAI(uiDiff);
}
示例14: debug_log
void instance_zulaman::SetData(uint32 uiType, uint32 uiData)
{
debug_log("SD2: Instance Zulaman: SetData received for type %u with data %u",uiType,uiData);
switch (uiType)
{
case TYPE_EVENT_RUN:
if (uiData == SPECIAL)
{
++m_uiGongCount;
if (m_uiGongCount == 5)
m_auiEncounter[TYPE_EVENT_RUN] = uiData;
return;
}
if (uiData == IN_PROGRESS)
{
DoTimeRunSay(RUN_START);
DoUseDoorOrButton(GO_MASSIVE_GATE);
if (m_auiEncounter[TYPE_RUN_EVENT_TIME])
SetData(TYPE_RUN_EVENT_TIME, m_auiEncounter[TYPE_RUN_EVENT_TIME]);
else
SetData(TYPE_RUN_EVENT_TIME, 60); // 20 Minutes as default time
DoUpdateWorldState(WORLD_STATE_ID, 1);
}
if (uiData == FAIL)
{
DoTimeRunSay(RUN_FAIL);
DoUpdateWorldState(WORLD_STATE_ID, 0);
// Kill remaining Event NPCs
for (uint8 i = 0; i < MAX_CHESTS; ++i)
{
// Not yet rescued, so too late
if (!m_aEventNpcInfo[i].uiSavePosition)
{
if (Creature* pCreature = instance->GetCreature(m_aEventNpcInfo[i].npGuid))
pCreature->ForcedDespawn();
}
}
}
if (uiData == DONE)
{
DoTimeRunSay(RUN_DONE);
DoUpdateWorldState(WORLD_STATE_ID, 0);
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_AKILZON:
DoUseDoorOrButton(GO_WIND_DOOR);
if (uiData == DONE)
{
if (m_auiEncounter[TYPE_EVENT_RUN] == IN_PROGRESS)
{
m_auiEncounter[TYPE_RUN_EVENT_TIME] += 10; // Add 10 minutes
SetData(TYPE_RUN_EVENT_TIME, m_auiEncounter[TYPE_RUN_EVENT_TIME]);
DoChestEvent(INDEX_AKILZON);
}
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_NALORAKK:
if (uiData == DONE)
{
if (m_auiEncounter[TYPE_EVENT_RUN] == IN_PROGRESS)
{
m_auiEncounter[TYPE_RUN_EVENT_TIME] += 15; // Add 15 minutes
SetData(TYPE_RUN_EVENT_TIME, m_auiEncounter[TYPE_RUN_EVENT_TIME]);
DoChestEvent(INDEX_NALORAKK);
}
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_JANALAI:
if (uiData == DONE)
{
if (m_auiEncounter[TYPE_EVENT_RUN] == IN_PROGRESS)
DoChestEvent(INDEX_JANALAI);
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_HALAZZI:
DoUseDoorOrButton(GO_LYNX_TEMPLE_ENTRANCE);
if (uiData == DONE)
{
DoUseDoorOrButton(GO_LYNX_TEMPLE_EXIT);
if (m_auiEncounter[TYPE_EVENT_RUN] == IN_PROGRESS)
DoChestEvent(INDEX_HALAZZI);
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_MALACRASS:
DoUseDoorOrButton(GO_HEXLORD_ENTRANCE);
if (uiData == DONE)
DoUseDoorOrButton(GO_WOODEN_DOOR);
m_auiEncounter[uiType] = uiData;
break;
case TYPE_ZULJIN:
DoUseDoorOrButton(GO_FIRE_DOOR);
m_auiEncounter[uiType] = uiData;
break;
case TYPE_RUN_EVENT_TIME:
//.........这里部分代码省略.........
示例15: switch
void instance_stratholme::SetData(uint32 uiType, uint32 uiData)
{
// TODO: Remove the hard-coded indexes from array accessing
switch (uiType)
{
case TYPE_BARON_RUN:
switch (uiData)
{
case IN_PROGRESS:
if (m_auiEncounter[uiType] == IN_PROGRESS || m_auiEncounter[uiType] == FAIL)
break;
DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_START, NPC_BARON);
m_uiBaronRunTimer = 45 * MINUTE * IN_MILLISECONDS;
debug_log("SD2: Instance Stratholme: Baron run in progress.");
break;
case FAIL:
// may add code to remove aura from players, but in theory the time should be up already and removed.
break;
case DONE:
m_uiBaronRunTimer = 0;
break;
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_BARONESS:
case TYPE_NERUB:
case TYPE_PALLID:
m_auiEncounter[uiType] = uiData;
if (uiData == DONE)
{
DoSortZiggurats();
DoUseDoorOrButton(m_zigguratStorage[uiType - TYPE_BARONESS].m_doorGuid);
}
if (uiData == SPECIAL)
StartSlaugtherSquare();
break;
case TYPE_RAMSTEIN:
if (uiData == SPECIAL)
{
if (m_auiEncounter[uiType] != SPECIAL && m_auiEncounter[uiType] != DONE)
{
m_uiSlaugtherSquareTimer = 20000; // TODO - unknown, also possible that this is not the very correct place..
DoUseDoorOrButton(GO_PORT_GAUNTLET);
}
uint32 uiCount = m_sAbomnationGUID.size();
for (GuidSet::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end();)
{
if (Creature* pAbom = instance->GetCreature(*itr))
{
++itr;
if (!pAbom->IsAlive())
--uiCount;
}
else
{
// Remove obsolete guid from set and decrement count
m_sAbomnationGUID.erase(itr++);
--uiCount;
}
}
if (!uiCount)
{
// Old Comment: a bit itchy, it should close GO_ZIGGURAT_DOOR_4 door after 10 secs, but it doesn't. skipping it for now.
// However looks like that this door is no more closed
DoUseDoorOrButton(GO_ZIGGURAT_DOOR_4);
// No more handlng of Abomnations
m_uiSlaugtherSquareTimer = 0;
if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
{
DoScriptText(SAY_ANNOUNCE_RAMSTEIN, pBaron);
if (Creature* pRamstein = pBaron->SummonCreature(NPC_RAMSTEIN, aStratholmeLocation[2].m_fX, aStratholmeLocation[2].m_fY, aStratholmeLocation[2].m_fZ, aStratholmeLocation[2].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
pRamstein->GetMotionMaster()->MovePoint(0, aStratholmeLocation[3].m_fX, aStratholmeLocation[3].m_fY, aStratholmeLocation[3].m_fZ);
debug_log("SD2: Instance Stratholme - Slaugther event: Ramstein spawned.");
}
}
else
debug_log("SD2: Instance Stratholme - Slaugther event: %u Abomnation left to kill.", uiCount);
}
// After fail aggroing Ramstein means wipe on Ramstein, so close door again
if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL)
DoUseDoorOrButton(GO_PORT_GAUNTLET);
if (uiData == DONE)
{
// Open side gate and start summoning skeletons
DoUseDoorOrButton(GO_PORT_SLAUGHTER_GATE);
// use this timer as a bool just to start summoning
m_uiMindlessSummonTimer = 500;
m_uiMindlessCount = 0;
m_luiUndeadGUIDs.clear();
// Summon 5 guards
if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
{
//.........这里部分代码省略.........