本文整理汇总了C++中TC_LOG_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ TC_LOG_DEBUG函数的具体用法?C++ TC_LOG_DEBUG怎么用?C++ TC_LOG_DEBUG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TC_LOG_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TC_LOG_WARN
void WardenMac::HandleHashResult(ByteBuffer &buff)
{
// test
int keyIn[4];
keyData mod_seed = { { { { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE } } } };
for (int i = 0; i < 4; ++i)
{
keyIn[i] = mod_seed.ints.ints[i];
}
int keyOut[4];
int keyIn1, keyIn2;
keyOut[0] = keyIn[0];
keyIn[0] ^= 0xDEADBEEFu;
keyIn1 = keyIn[1];
keyIn[1] -= 0x35014542u;
keyIn2 = keyIn[2];
keyIn[2] += 0x5313F22u;
keyIn[3] *= 0x1337F00Du;
keyOut[1] = keyIn1 - 0x6A028A84;
keyOut[2] = keyIn2 + 0xA627E44;
keyOut[3] = 0x1337F00D * keyIn[3];
// end test
buff.rpos(buff.wpos());
SHA1Hash sha1;
sha1.UpdateData((uint8*)keyIn, 16);
sha1.Finalize();
//const uint8 validHash[20] = { 0x56, 0x8C, 0x05, 0x4C, 0x78, 0x1A, 0x97, 0x2A, 0x60, 0x37, 0xA2, 0x29, 0x0C, 0x22, 0xB5, 0x25, 0x71, 0xA0, 0x6F, 0x4E };
// Verify key
if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0)
{
TC_LOG_WARN("warden", "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
TC_LOG_DEBUG("warden", "Request hash reply: succeed");
// client 7F96EEFDA5B63D20A4DF8E00CBF48304
//const uint8 client_key[16] = { 0x7F, 0x96, 0xEE, 0xFD, 0xA5, 0xB6, 0x3D, 0x20, 0xA4, 0xDF, 0x8E, 0x00, 0xCB, 0xF4, 0x83, 0x04 };
// server C2B7ADEDFCCCA9C2BFB3F85602BA809B
//const uint8 server_key[16] = { 0xC2, 0xB7, 0xAD, 0xED, 0xFC, 0xCC, 0xA9, 0xC2, 0xBF, 0xB3, 0xF8, 0x56, 0x02, 0xBA, 0x80, 0x9B };
// change keys here
memcpy(_inputKey, keyIn, 16);
memcpy(_outputKey, keyOut, 16);
_inputCrypto.Init(_inputKey);
_outputCrypto.Init(_outputKey);
_initialized = true;
_previousTimestamp = getMSTime();
}
示例2: TC_LOG_DEBUG
void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH");
}
示例3: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, ObjectGuid npcGUID, bool activateAccept) const
{
std::string questLogTitle = quest->GetLogTitle();
std::string questLogDescription = quest->GetLogDescription();
std::string questDescription = quest->GetQuestDescription();
std::string portraitGiverText = quest->GetPortraitGiverText();
std::string portraitGiverName = quest->GetPortraitGiverName();
std::string portraitTurnInText = quest->GetPortraitTurnInText();
std::string portraitTurnInName = quest->GetPortraitTurnInName();
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
if (localeConstant >= LOCALE_enUS)
{
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, localeConstant, questLogTitle);
ObjectMgr::GetLocaleString(questTemplateLocale->LogDescription, localeConstant, questLogDescription);
ObjectMgr::GetLocaleString(questTemplateLocale->QuestDescription, localeConstant, questDescription);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverText, localeConstant, portraitGiverText);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverName, localeConstant, portraitGiverName);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInText, localeConstant, portraitTurnInText);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInName, localeConstant, portraitTurnInName);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questLogTitle, quest->GetQuestLevel());
WorldPackets::Quest::QuestGiverQuestDetails packet;
packet.QuestGiverGUID = npcGUID;
packet.InformUnit = _session->GetPlayer()->GetDivider();
packet.QuestID = quest->GetQuestId();
packet.QuestTitle = questLogTitle;
packet.LogDescription = questLogDescription;
packet.DescriptionText = questDescription;
packet.PortraitGiverText = portraitGiverText;
packet.PortraitGiverName = portraitGiverName;
packet.PortraitTurnInText = portraitTurnInText;
packet.PortraitTurnInName = portraitTurnInName;
packet.PortraitGiver = quest->GetQuestGiverPortrait();
packet.PortraitTurnIn = quest->GetQuestTurnInPortrait();
packet.DisplayPopup = activateAccept;
packet.QuestFlags[0] = quest->GetFlags();
packet.QuestFlags[1] = quest->GetFlagsEx();
packet.SuggestedPartyMembers = quest->GetSuggestedPlayers();
if (quest->GetSrcSpell())
packet.LearnSpells.push_back(quest->GetSrcSpell());
quest->BuildQuestRewards(packet.Rewards, _session->GetPlayer());
packet.DescEmotes.resize(QUEST_EMOTE_COUNT);
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
packet.DescEmotes[i].Type = quest->DetailsEmote[i];
packet.DescEmotes[i].Delay = quest->DetailsEmoteDelay[i];
}
QuestObjectives const& objs = quest->GetObjectives();
packet.Objectives.resize(objs.size());
for (uint32 i = 0; i < objs.size(); ++i)
{
packet.Objectives[i].ID = objs[i].ID;
packet.Objectives[i].ObjectID = objs[i].ObjectID;
packet.Objectives[i].Amount = objs[i].Amount;
packet.Objectives[i].Type = objs[i].Type;
}
_session->SendPacket(packet.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
示例4: GetPlayer
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo; // used only for proper packet read
_player->ValidateMovementInfo(&movementInfo);
// in taxi flight packet received in 2 case:
// 1) end taxi path in far (multi-node) flight
// 2) switch from one map to other in case multim-map taxi path
// we need process only (1)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
if (!curDest)
return;
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
// far teleport case
if (curDestNode && curDestNode->MapID != GetPlayer()->GetMapId())
{
if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->SetCurrentNodeAfterTeleport();
TaxiPathNodeEntry const& node = flight->GetPath()[flight->GetCurrentNode()];
flight->SkipCurrentNode();
GetPlayer()->TeleportTo(curDestNode->MapID, node.Loc.X, node.Loc.Y, node.Loc.Z, GetPlayer()->GetOrientation());
}
return;
}
uint32 destinationnode = GetPlayer()->m_taxi.NextTaxiDestination();
if (destinationnode > 0) // if more destinations to go
{
// current source node for next destination
uint32 sourcenode = GetPlayer()->m_taxi.GetTaxiSource();
// Add to taximask middle hubs in taxicheat mode (to prevent having player with disabled taxicheat and not having back flight path)
if (GetPlayer()->isTaxiCheater())
{
if (GetPlayer()->m_taxi.SetTaximaskNode(sourcenode))
{
WorldPacket data(SMSG_NEW_TAXI_PATH, 0);
_player->GetSession()->SendPacket(&data);
}
}
TC_LOG_DEBUG("network", "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode);
uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam());
uint32 path, cost;
sObjectMgr->GetTaxiPath(sourcenode, destinationnode, path, cost);
if (path && mountDisplayId)
SendDoFlight(mountDisplayId, path, 1); // skip start fly node
else
GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next
return;
}
else
GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());
if (GetPlayer()->pvpInfo.IsHostile)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
示例5: TC_LOG_ERROR
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
{
uint32 questId, reward;
ObjectGuid guid;
recvData >> guid >> questId >> reward;
if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
TC_LOG_ERROR("network", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUID().GetCounter(), reward);
return;
}
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", guid.ToString().c_str(), questId, reward);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
return;
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(object))
return;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
{
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
{
TC_LOG_ERROR("network", "Error in QUEST_STATUS_COMPLETE: player %s (guid %u) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)",
_player->GetName().c_str(), _player->GetGUID().GetCounter(), questId);
return;
}
if (_player->CanRewardQuest(quest, reward, true))
{
_player->RewardQuest(quest, reward, object);
switch (object->GetTypeId())
{
case TYPEID_UNIT:
{
Creature* questgiver = object->ToCreature();
if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
// Only send the quest to the player if the conditions are met
if (_player->CanTakeQuest(nextQuest, false))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true))
_player->AddQuestAndCheckCompletion(nextQuest, object);
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
}
}
questgiver->AI()->sQuestReward(_player, quest, reward);
}
break;
}
case TYPEID_GAMEOBJECT:
{
GameObject* questGiver = object->ToGameObject();
if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, reward))
{
// Send next quest
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
{
// Only send the quest to the player if the conditions are met
if (_player->CanTakeQuest(nextQuest, false))
{
if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true))
_player->AddQuestAndCheckCompletion(nextQuest, object);
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
}
}
questGiver->AI()->QuestReward(_player, quest, reward);
}
break;
}
default:
break;
}
}
else
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
}
}
示例6: db
int RASocket::subnegotiate()
{
char buf[1024];
ACE_Data_Block db(sizeof (buf),
ACE_Message_Block::MB_DATA,
buf,
0,
0,
ACE_Message_Block::DONT_DELETE,
0);
ACE_Message_Block message_block(&db,
ACE_Message_Block::DONT_DELETE,
0);
const size_t recv_size = message_block.space();
// Wait a maximum of 1000ms for negotiation packet - not all telnet clients may send it
ACE_Time_Value waitTime = ACE_Time_Value(1);
const ssize_t n = peer().recv(message_block.wr_ptr(),
recv_size, &waitTime);
if (n <= 0)
return int(n);
if (n >= 1024)
{
TC_LOG_DEBUG("commands.ra", "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
return -1;
}
buf[n] = '\0';
#ifdef _DEBUG
for (uint8 i = 0; i < n; )
{
uint8 iac = buf[i];
if (iac == 0xFF) // "Interpret as Command" (IAC)
{
uint8 command = buf[++i];
std::stringstream ss;
switch (command)
{
case 0xFB: // WILL
ss << "WILL ";
break;
case 0xFC: // WON'T
ss << "WON'T ";
break;
case 0xFD: // DO
ss << "DO ";
break;
case 0xFE: // DON'T
ss << "DON'T ";
break;
default:
return -1; // not allowed
}
uint8 param = buf[++i];
ss << uint32(param);
TC_LOG_DEBUG("commands.ra", ss.str().c_str());
}
++i;
}
#endif
//! Just send back end of subnegotiation packet
uint8 const reply[2] = {0xFF, 0xF0};
#ifdef MSG_NOSIGNAL
return int(peer().send(reply, 2, MSG_NOSIGNAL));
#else
return int(peer().send(reply, 2));
#endif // MSG_NOSIGNAL
}
示例7: TC_LOG_DEBUG
void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList");
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
CreatureTemplate const* ci = unit->GetCreatureTemplate();
if (!ci)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
return;
}
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
if (!trainer_spells)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)",
GUID_LOPART(guid), unit->GetEntry());
return;
}
WorldPacket data(SMSG_TRAINER_LIST, 8+4+4+trainer_spells->spellList.size()*38 + strTitle.size()+1);
data << guid;
data << uint32(trainer_spells->trainerType);
size_t count_pos = data.wpos();
data << uint32(trainer_spells->spellList.size());
// reputation discount
float fDiscountMod = _player->GetReputationPriceDiscount(unit);
bool can_learn_primary_prof = GetPlayer()->GetFreePrimaryProfessionPoints() > 0;
uint32 count = 0;
for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr)
{
TrainerSpell const* tSpell = &itr->second;
bool valid = true;
bool primary_prof_first_rank = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i]))
{
valid = false;
break;
}
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(tSpell->learnedSpell[i]);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primary_prof_first_rank = true;
}
if (!valid)
continue;
TrainerSpellState state = _player->GetTrainerSpellState(tSpell);
data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case)
data << uint8(state == TRAINER_SPELL_GREEN_DISABLED ? TRAINER_SPELL_GREEN : state);
data << uint32(floor(tSpell->spellCost * fDiscountMod));
data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0);
// primary prof. learn confirmation dialog
data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state
data << uint8(tSpell->reqLevel);
data << uint32(tSpell->reqSkill);
data << uint32(tSpell->reqSkillValue);
//prev + req or req + 0
uint8 maxReq = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
if (uint32 prevSpellId = sSpellMgr->GetPrevSpellInChain(tSpell->learnedSpell[i]))
{
data << uint32(prevSpellId);
++maxReq;
}
if (maxReq == 3)
break;
SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(tSpell->learnedSpell[i]);
for (SpellsRequiringSpellMap::const_iterator itr2 = spellsRequired.first; itr2 != spellsRequired.second && maxReq < 3; ++itr2)
{
data << uint32(itr2->second);
++maxReq;
}
if (maxReq == 3)
break;
}
while (maxReq < 3)
//.........这里部分代码省略.........
示例8: TC_LOG_DEBUG
// Reconnect Challenge command handler
bool AuthSocket::_HandleReconnectChallenge()
{
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge");
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
// Read the first 4 bytes (header) to get the length of the remaining of the packet
std::vector<uint8> buf;
buf.resize(4);
socket().recv((char *)&buf[0], 4);
#if TRINITY_ENDIAN == TRINITY_BIGENDIAN
EndianConvert(*((uint16*)(buf[0])));
#endif
uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size;
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining);
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
return false;
// No big fear of memory outage (size is int16, i.e. < 65536)
buf.resize(remaining + buf.size() + 1);
buf[buf.size() - 1] = 0;
sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0];
// Read the remaining of the packet
socket().recv((char *)&buf[4], remaining);
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
_login = (const char*)ch->I;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SESSIONKEY);
stmt->setString(0, _login);
PreparedQueryResult result = LoginDatabase.Query(stmt);
// Stop if the account is not found
if (!result)
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
_expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
return false;
// Restore string order as its byte order is reversed
std::reverse(_os.begin(), _os.end());
Field* fields = result->Fetch();
uint8 secLevel = fields[2].GetUInt8();
_accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR;
K.SetHexStr ((*result)[0].GetCString());
// Sending response
ByteBuffer pkt;
pkt << uint8(AUTH_RECONNECT_CHALLENGE);
pkt << uint8(0x00);
_reconnectProof.SetRand(16 * 8);
pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random
pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
示例9: TC_LOG_DEBUG
void WardenMac::InitializeModule()
{
TC_LOG_DEBUG("warden", "Initialize module");
}
示例10: TC_LOG_ERROR
/// @todo get rid of this many variables passed in function.
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, uint64 playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
{
if (me->GetVictim())
{
TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
{
if (!WaypointList.empty())
WaypointList.clear();
FillPointMovementListForCreature();
}
if (WaypointList.empty())
{
TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
//set variables
m_bIsActiveAttacker = isActiveAttacker;
m_bIsRunning = run;
m_uiPlayerGUID = playerGUID;
m_pQuestForEscort = quest;
m_bCanInstantRespawn = instantRespawn;
m_bCanReturnToStart = canLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
TC_LOG_DEBUG("scripts", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
{
HasImmuneToNPCFlags = true;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
//Set initial speed
if (m_bIsRunning)
me->SetWalk(false);
else
me->SetWalk(true);
AddEscortState(STATE_ESCORT_ESCORTING);
}
示例11: ClearRBAC
void AccountMgr::LoadRBAC()
{
ClearRBAC();
TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC");
uint32 oldMSTime = getMSTime();
uint32 count1 = 0;
uint32 count2 = 0;
uint32 count3 = 0;
TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading permissions");
QueryResult result = LoginDatabase.Query("SELECT id, name FROM rbac_permissions");
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty.");
return;
}
do
{
Field* field = result->Fetch();
uint32 id = field[0].GetUInt32();
_permissions[id] = new rbac::RBACPermission(id, field[1].GetString());
++count1;
}
while (result->NextRow());
TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading linked permissions");
result = LoginDatabase.Query("SELECT id, linkedId FROM rbac_linked_permissions ORDER BY id ASC");
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 linked permissions. DB table `rbac_linked_permissions` is empty.");
return;
}
uint32 permissionId = 0;
rbac::RBACPermission* permission = NULL;
do
{
Field* field = result->Fetch();
uint32 newId = field[0].GetUInt32();
if (permissionId != newId)
{
permissionId = newId;
permission = _permissions[newId];
}
uint32 linkedPermissionId = field[1].GetUInt32();
if (linkedPermissionId == permissionId)
{
TC_LOG_ERROR("sql.sql", "RBAC Permission %u has itself as linked permission. Ignored", permissionId);
continue;
}
permission->AddLinkedPermission(linkedPermissionId);
++count2;
}
while (result->NextRow());
TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading default permissions");
result = LoginDatabase.PQuery("SELECT secId, permissionId FROM rbac_default_permissions WHERE (realmId = %u OR realmId = -1) ORDER BY secId ASC", realm.Id.Realm);
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty.");
return;
}
uint8 secId = 255;
rbac::RBACPermissionContainer* permissions = NULL;
do
{
Field* field = result->Fetch();
uint32 newId = field[0].GetUInt32();
if (secId != newId || permissions == NULL)
{
secId = newId;
permissions = &_defaultPermissions[secId];
}
permissions->insert(field[1].GetUInt32());
++count3;
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u permission definitions, %u linked permissions and %u default permissions in %u ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime));
}
示例12: GUID_LOPART
bool ArenaTeam::AddMember(uint64 playerGuid)
{
std::string playerName;
uint8 playerClass;
// Check if arena team is full (Can't have more than type * 2 players)
if (GetMembersSize() >= GetType() * 2)
return false;
if (Type == ARENA_TEAM_5v5 && GetMembersSize() >= 1) // Im 1on1 Team kann auch nur 1 Spieler sein.
return false;
// Get player name and class either from db or ObjectMgr
Player* player = ObjectAccessor::FindPlayer(playerGuid);
if (player)
{
playerClass = player->getClass();
playerName = player->GetName();
}
else
{
// 0 1
// SELECT name, class FROM characters WHERE guid = ?
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_CLASS);
stmt->setUInt32(0, GUID_LOPART(playerGuid));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
return false;
playerName = (*result)[0].GetString();
playerClass = (*result)[1].GetUInt8();
}
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
// Set player's personal rating
uint32 personalRating = 0;
if (sWorld->getIntConfig(CONFIG_ARENA_START_PERSONAL_RATING) > 0)
personalRating = sWorld->getIntConfig(CONFIG_ARENA_START_PERSONAL_RATING);
else if (GetRating() >= 1000)
personalRating = 1000;
if (Type == ARENA_TEAM_5v5) // Im 1on1 kein Rating (0)
personalRating = 0;
// Try to get player's match maker rating from db and fall back to config setting if not found
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
stmt->setUInt32(0, GUID_LOPART(playerGuid));
stmt->setUInt8(1, GetSlot());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
uint32 matchMakerRating;
if (result)
matchMakerRating = (*result)[0].GetUInt16();
else
matchMakerRating = sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);
if (Type == ARENA_TEAM_5v5) // Im 1on1 kein Rating (0)
matchMakerRating = 0;
// Remove all player signatures from other petitions
// This will prevent player from joining too many arena teams and corrupt arena team data integrity
Player::RemovePetitionsAndSigns(playerGuid, GetType());
// Feed data to the struct
ArenaTeamMember newMember;
newMember.Name = playerName;
newMember.Guid = playerGuid;
newMember.Class = playerClass;
newMember.SeasonGames = 0;
newMember.WeekGames = 0;
newMember.SeasonWins = 0;
newMember.WeekWins = 0;
newMember.PersonalRating = personalRating;
newMember.MatchMakerRating = matchMakerRating;
Members.push_back(newMember);
// Save player's arena team membership to db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
stmt->setUInt32(0, TeamId);
stmt->setUInt32(1, GUID_LOPART(playerGuid));
CharacterDatabase.Execute(stmt);
// Inform player if online
if (player)
{
player->SetInArenaTeam(TeamId, GetSlot(), GetType());
player->SetArenaTeamIdInvited(0);
// Hide promote/remove buttons
if (CaptainGuid != playerGuid)
//.........这里部分代码省略.........
示例13: TC_LOG_DEBUG
void WorldSession::HandleMoveTeleportAck(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK");
ObjectGuid guid;
uint32 flags, time;
recvPacket >> flags >> time;
guid[5] = recvPacket.ReadBit();
guid[0] = recvPacket.ReadBit();
guid[1] = recvPacket.ReadBit();
guid[6] = recvPacket.ReadBit();
guid[3] = recvPacket.ReadBit();
guid[7] = recvPacket.ReadBit();
guid[2] = recvPacket.ReadBit();
guid[4] = recvPacket.ReadBit();
recvPacket.ReadByteSeq(guid[4]);
recvPacket.ReadByteSeq(guid[2]);
recvPacket.ReadByteSeq(guid[7]);
recvPacket.ReadByteSeq(guid[6]);
recvPacket.ReadByteSeq(guid[5]);
recvPacket.ReadByteSeq(guid[1]);
recvPacket.ReadByteSeq(guid[3]);
recvPacket.ReadByteSeq(guid[0]);
TC_LOG_DEBUG("network", "Guid " UI64FMTD, uint64(guid));
TC_LOG_DEBUG("network", "Flags %u, time %u", flags, time/IN_MILLISECONDS);
Player* plMover = _player->m_mover->ToPlayer();
if (!plMover || !plMover->IsBeingTeleportedNear())
return;
if (guid != plMover->GetGUID())
return;
plMover->SetSemaphoreTeleportNear(false);
uint32 old_zone = plMover->GetZoneId();
WorldLocation const& dest = plMover->GetTeleportDest();
plMover->UpdatePosition(dest, true);
uint32 newzone, newarea;
plMover->GetZoneAndAreaId(newzone, newarea);
plMover->UpdateZone(newzone, newarea);
// new zone
if (old_zone != newzone)
{
// honorless target
if (plMover->pvpInfo.IsHostile)
plMover->CastSpell(plMover, 2479, true);
// in friendly area
else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP))
plMover->UpdatePvP(false, false);
}
// resummon pet
GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
//lets process all delayed operations on successful teleport
GetPlayer()->ProcessDelayedOperations();
}
示例14: main
/// Launch the auth server
extern int main(int argc, char **argv)
{
// Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_REALM_CONFIG;
int c = 1;
while (c < argc)
{
if (strcmp(argv[c], "-c") == 0)
{
if (++c >= argc)
{
printf("Runtime-Error: -c option requires an input argument\n");
usage(argv[0]);
return 1;
}
else
cfg_file = argv[c];
}
++c;
}
if (!ConfigMgr::Load(cfg_file))
{
printf("Invalid or missing configuration file : %s\n", cfg_file);
printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n");
return 1;
}
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION);
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " A World of Warcraft: Woltk Core Emulator ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " _/_/ _/ _/_/_/_/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " _/ _/ _/_/_/_/ _/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " _/ _/ _/ _/ _/_/_/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " _/ _/ _/ _/ _/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " _/_/ _/ _/ _/_/_/_/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " Autentificador de Cuentas AUTH ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " https://github.com/ApocalypseCore/ ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " One Community developers Costa Rica(c) 2013 ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " Desarrollado por ApocalypseEmu ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " One ");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Presione <Ctrl-C> para detenerlo.\n");
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, " El archivo de configuration usado es %s.", cfg_file);
TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
#else
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());
// authserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
if (!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
}
// Initialize the database connection
if (!StartDB())
return 1;
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
return 1;
}
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
//.........这里部分代码省略.........
示例15: extras
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
{
uint32 opcode = recvData.GetOpcode();
/* extract packet */
MovementInfo movementInfo;
static MovementStatusElements const speedElement = MSEExtraFloat;
Movement::ExtraMovementStatusElement extras(&speedElement);
GetPlayer()->ReadMovementInfo(recvData, &movementInfo, &extras);
// now can skip not our packet
if (_player->GetGUID() != movementInfo.guid)
{
recvData.rfinish(); // prevent warnings spam
return;
}
float newspeed = extras.Data.floatData;
/*----------------*/
// client ACK send one packet for mounted/run case and need skip all except last from its
// in other cases anti-cheat check can be fail in false case
UnitMoveType move_type;
static char const* const move_type_name[MAX_MOVE_TYPE] =
{
"Walk",
"Run",
"RunBack",
"Swim",
"SwimBack",
"TurnRate",
"Flight",
"FlightBack",
"PitchRate"
};
switch (opcode)
{
case CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; break;
case CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; break;
case CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; break;
case CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; break;
case CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; break;
case CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; break;
case CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; break;
case CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; break;
case CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; break;
default:
TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
return;
}
// skip all forced speed changes except last and unexpected
// in run/mounted case used one ACK and it must be skipped. m_forced_speed_changes[MOVE_RUN] store both.
if (_player->m_forced_speed_changes[move_type] > 0)
{
--_player->m_forced_speed_changes[move_type];
if (_player->m_forced_speed_changes[move_type] > 0)
return;
}
if (!_player->GetTransport() && fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
{
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
{
TC_LOG_ERROR("network", "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed);
_player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true);
}
else // must be lesser - cheating
{
TC_LOG_DEBUG("misc", "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed);
_player->GetSession()->KickPlayer();
}
}
}