本文整理汇总了C++中QuestLogEntry::UpdatePlayerFields方法的典型用法代码示例。如果您正苦于以下问题:C++ QuestLogEntry::UpdatePlayerFields方法的具体用法?C++ QuestLogEntry::UpdatePlayerFields怎么用?C++ QuestLogEntry::UpdatePlayerFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuestLogEntry
的用法示例。
在下文中一共展示了QuestLogEntry::UpdatePlayerFields方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LayingWasteToTheUnwantedAllianz
bool LayingWasteToTheUnwantedAllianz(uint32 i, Spell* pSpell)
{
Player *caster = pSpell->p_caster;
if(caster == NULL)
return true;
GameObject *eastern = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-155, 2517, 43, 300152);
GameObject *ceastern = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-152, 2661, 44, 300152);
GameObject *cwestern = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-174, 2772, 32, 300152);
GameObject *western = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-166, 2818, 29, 300152);
if(caster->GetQuestLogForEntry(10078))
{
// Eastern Thrower
if (eastern)
{
if(caster->CalcDistance(caster, eastern) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10078);
qle->SetMobCount(0, qle->GetMobCount(0)+1);
qle->SendUpdateAddKill(0);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -157.916, 2517.71, 58.5508, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Central Eastern Thrower
if (ceastern)
{
if(caster->CalcDistance(caster, ceastern) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10078);
qle->SetMobCount(1, qle->GetMobCount(1)+1);
qle->SendUpdateAddKill(1);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -152.527, 2661.99, 60.8123, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Central Western Thrower
if (cwestern)
{
if(caster->CalcDistance(caster, cwestern) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10078);
qle->SetMobCount(2, qle->GetMobCount(2)+1);
qle->SendUpdateAddKill(2);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -177.916, 2773.75, 48.636, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Western Thrower
if (western)
{
if(caster->CalcDistance(caster, western) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10078);
qle->SetMobCount(3, qle->GetMobCount(3)+1);
qle->SendUpdateAddKill(3);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -166, 2818, 29, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
}
else
{
caster->BroadcastMessage("Missing required quest : Laying Waste to the Unwanted");
}
return true;
}
示例2: OnPlayerKill
void QuestMgr::OnPlayerKill(Player* plr, Creature* victim)
{
if(!plr)
return;
uint32 i, j;
uint32 entry = victim->GetEntry();
QuestLogEntry *qle;
for(i = 0; i < 25; ++i)
{
if((qle = plr->GetQuestLogInSlot(i)))
{
// dont waste time on quests without mobs
if(qle->GetQuest()->count_required_mob == 0)
continue;
for(j = 0; j < 4; ++j)
{
if(qle->GetQuest()->required_mob[j] == entry &&
qle->GetQuest()->required_mobtype[j] == QUEST_MOB_TYPE_CREATURE &&
qle->m_mobcount[j] < qle->GetQuest()->required_mobcount[j])
{
// add another kill.
// (auto-dirtys it)
qle->SetMobCount(j, qle->m_mobcount[j] + 1);
qle->SendUpdateAddKill(j);
CALL_QUESTSCRIPT_EVENT(qle, OnCreatureKill)(entry, plr);
qle->UpdatePlayerFields();
break;
}
}
}
}
// Shared kills
Player *gplr = NULL;
if(plr->InGroup())
{
if(Group* pGroup = plr->GetGroup())
{
if(pGroup->GetGroupType() != GROUP_TYPE_PARTY) return; // Raid's don't get shared kills.
GroupMembersSet::iterator gitr;
for(uint32 k = 0; k < pGroup->GetSubGroupCount(); k++)
{
for(gitr = pGroup->GetSubGroup(k)->GetGroupMembersBegin(); gitr != pGroup->GetSubGroup(k)->GetGroupMembersEnd(); ++gitr)
{
gplr = (*gitr);
if(gplr && gplr != plr) // dont double kills
{
for(i = 0; i < 20; ++i)
{
if((qle = gplr->GetQuestLogInSlot(i)))
{
// dont waste time on quests without mobs
if(qle->GetQuest()->count_required_mob == 0)
continue;
for(j = 0; j < 4; ++j)
{
if(qle->GetQuest()->required_mob[j] == entry &&
qle->GetQuest()->required_mobtype[j] == QUEST_MOB_TYPE_CREATURE &&
qle->m_mobcount[j] < qle->GetQuest()->required_mobcount[j])
{
// add another kill.
// (auto-dirtys it)
qle->SetMobCount(j, qle->m_mobcount[j] + 1);
qle->SendUpdateAddKill(j);
CALL_QUESTSCRIPT_EVENT(qle, OnCreatureKill)(entry, plr);
qle->UpdatePlayerFields();
// lua stuff
//QUESTLUA_SendEvent(qst, victim, plr, ON_QUEST_KILLMOB, qle->m_mobcount[j]);
if(qle->CanBeFinished())
qle->SendQuestComplete();
break;
}
}
}
}
}
}
}
}
}
}
示例3: OnActivate
void OnActivate(Player * pPlayer)
{
float SSX = pPlayer->GetPositionX();
float SSY = pPlayer->GetPositionY();
float SSZ = pPlayer->GetPositionZ();
GameObject *nothern = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-820, 2029, 55, 300150);
GameObject *southern = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-1150, 2110, 84, 300150);
GameObject *forge = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-893, 1919, 82, 300150);
GameObject *foothill = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-978, 1879, 111, 300150);
GameObject *Beacon = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( SSX, SSY, SSZ, 184661);
if(Beacon)
{
Beacon->SetUInt32Value(GAMEOBJECT_FLAGS, (Beacon->GetUInt32Value(GAMEOBJECT_FLAGS)-1));
}
if(pPlayer->GetQuestLogForEntry(10895))
{
// Northern Zeth'Gor Tower
if (nothern != NULL)
{
if(pPlayer->CalcDistance(pPlayer, nothern) < 40) // if reduced the server will crash when out of range
{
QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10895);
qle->SetMobCount(0, qle->GetMobCount(0)+1);
qle->SendUpdateAddKill(0);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(pPlayer, 183816, -819.77, 2029.09, 55.6082, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
return;
}
}
// Southern Zeth'Gor Tower
if (southern != NULL)
{
if(pPlayer->CalcDistance(pPlayer, southern) < 40)
{
QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10895);
qle->SetMobCount(1, qle->GetMobCount(1)+1);
qle->SendUpdateAddKill(1);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(pPlayer, 183816, -1150.53, 2109.92, 84.4204, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
return;
}
}
// Forge Zeth'Gor Tower
if (forge)
{
if(pPlayer->CalcDistance(pPlayer, forge) < 40)
{
QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10895);
qle->SetMobCount(2, qle->GetMobCount(2)+1);
qle->SendUpdateAddKill(2);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(pPlayer, 183816, -893.499, 1919.27, 81.6449, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
return;
}
}
// Foothill Zeth'Gor Tower
if (foothill)
{
if(pPlayer->CalcDistance(pPlayer, foothill) < 40)
{
QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10895);
qle->SetMobCount(3, qle->GetMobCount(3)+1);
qle->SendUpdateAddKill(3);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(pPlayer, 183816, -977.713, 1879.500, 110.892, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
return;
}
}
else
{
//.........这里部分代码省略.........
示例4: ZethGorMustBurnHorde
bool ZethGorMustBurnHorde(uint32 i, Spell* pSpell)
{
Player *caster = pSpell->p_caster;
if(caster == NULL)
return true;
GameObject *barracks = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-1137, 1970, 74, 300151);
GameObject *eastern = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-940, 1920, 69, 300151);
GameObject *western = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-1155, 2061, 68, 300151);
GameObject *stable = caster->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-1052, 2007, 66, 300151);
if(caster->GetQuestLogForEntry(10792))
{
// Barracks
if (barracks)
{
if(caster->CalcDistance(caster, barracks) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10792);
qle->SetMobCount(0, qle->GetMobCount(0)+1);
qle->SendUpdateAddKill(0);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -1129.08, 1921.77, 94.0074, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
obj = sEAS.SpawnGameobject(caster, 183816, -1135.00, 1944.05, 84.7084, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
obj = sEAS.SpawnGameobject(caster, 183816, -1152.01, 1945.00, 102.901, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
obj = sEAS.SpawnGameobject(caster, 183816, -1159.60, 1958.76, 83.0412, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
obj = sEAS.SpawnGameobject(caster, 183816, -1126.17, 1880.96, 95.065, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
obj = sEAS.SpawnGameobject(caster, 183816, -1185.79, 1968.29, 90.931, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Eastern Hovel
if (eastern)
{
if(caster->CalcDistance(caster, eastern) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10792);
qle->SetMobCount(1, qle->GetMobCount(1)+1);
qle->SendUpdateAddKill(1);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -938.034, 1924.153, 73.590, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Western Hovel
if (western)
{
if(caster->CalcDistance(caster, western) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10792);
qle->SetMobCount(2, qle->GetMobCount(2)+1);
qle->SendUpdateAddKill(2);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -1152.10, 2066.20, 72.959, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
return true;
}
// Stable
if (stable)
{
if(caster->CalcDistance(caster, stable) < 30)
{
QuestLogEntry *qle = caster->GetQuestLogForEntry(10792);
qle->SetMobCount(3, qle->GetMobCount(3)+1);
qle->SendUpdateAddKill(3);
qle->UpdatePlayerFields();
GameObject* obj = 0;
obj = sEAS.SpawnGameobject(caster, 183816, -1058.85, 2010.95, 68.776, 0, 4);
sEAS.GameobjectDelete(obj, 1*60*1000);
}
//.........这里部分代码省略.........
示例5: AssaultControlPoint
//.........这里部分代码省略.........
m_basesAssaultedBy[Id] = Team;
// spawn the new control point gameobject
SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_ASSAULT : AB_SPAWN_TYPE_ALLIANCE_ASSAULT);
// update the client's map with the new assaulting field
SetWorldState(AssaultFields[Id][Team], 1);
// Check Assault/Defense, the time of capture is not the same.
if(DefFlag[Id][0] && !DefFlag[Id][1])
{
DefFlag[Id][0] = false;
SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N defend %s", ControlPointNames[Id]);
sEventMgr.AddEvent(this, &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, 1000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASES_CAPTURED]++;
UpdatePvPData();
}
else if(!DefFlag[Id][0] && !DefFlag[Id][1])
{
DefFlag[Id][0] = true;
SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N assault %s !", ControlPointNames[Id]);
PlaySoundToAll(Team ? 8212 : 8174);
if(Team)
{
QuestLogEntry* en = pPlayer->GetQuestLogForEntry(8120);
switch(Id)
{
case AB_CONTROL_POINT_MINE:
{
if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
{
en->SetMobCount(0, en->GetMobCount(0) + 1);
en->SendUpdateAddKill(0);
en->UpdatePlayerFields();
}
}
break;
case AB_CONTROL_POINT_LUMBERMILL:
{
if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1])
{
en->SetMobCount(1, en->GetMobCount(1) + 1);
en->SendUpdateAddKill(1);
en->UpdatePlayerFields();
}
}
break;
case AB_CONTROL_POINT_BLACKSMITH:
{
if(en && en->GetMobCount(2) < en->GetQuest()->required_mobcount[2])
{
en->SetMobCount(2, en->GetMobCount(2) + 1);
en->SendUpdateAddKill(2);
en->UpdatePlayerFields();
}
}
break;
case AB_CONTROL_POINT_STABLE:
{
if(en && en->GetMobCount(3) < en->GetQuest()->required_mobcount[3])
{
en->SetMobCount(3, en->GetMobCount(3) + 1);
en->SendUpdateAddKill(3);
en->UpdatePlayerFields();
}
}
示例6: HandleQuestStartCommand
bool ChatHandler::HandleQuestStartCommand(const char * args, WorldSession * m_session)
{
if(!*args) return false;
Player* plr = getSelectedChar(m_session, true);
if(!plr)
{
plr = m_session->GetPlayer();
SystemMessage(m_session, "Auto-targeting self.");
}
uint32 quest_id = atol(args);
std::string recout = "|cff00ff00";
Quest * qst = QuestStorage.LookupEntry(quest_id);
if(qst)
{
if (plr->HasFinishedQuest(quest_id) || plr->HasFinishedDailyQuest(quest_id))
recout += "Player has already completed that quest.";
else
{
QuestLogEntry * IsPlrOnQuest = plr->GetQuestLogForEntry(quest_id);
if (IsPlrOnQuest)
recout += "Player is currently on that quest.";
else
{
int32 open_slot = plr->GetOpenQuestSlot();
if (open_slot == -1)
{
sQuestMgr.SendQuestLogFull(plr);
recout += "Player's quest log is full.";
}
else
{
QuestLogEntry *qle = new QuestLogEntry();
qle->Init(qst, plr, (uint32)open_slot);
qle->UpdatePlayerFields();
CALL_QUESTSCRIPT_EVENT(qle, OnQuestStart)(plr, qle);
// If the quest should give any items on begin, give them the items.
for(uint32 i = 0; i < 4; ++i)
{
if(qst->receive_items[i])
{
Item* item = objmgr.CreateItem( qst->receive_items[i], plr);
if(!plr->GetItemInterface()->AddItemToFreeSlot(item))
{
if(item)
item->Destructor();
}
}
}
if(qst->srcitem && qst->srcitem != qst->receive_items[0])
{
Item* item = objmgr.CreateItem( qst->srcitem, plr);
if(item)
{
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, qst->srcitemcount ? qst->srcitemcount : 1);
if(!plr->GetItemInterface()->AddItemToFreeSlot(item))
{
if(item)
item->Destructor();
}
}
}
plr->UpdateNearbyGameObjects();
sHookInterface.OnQuestAccept( plr, qst, NULL );
recout += "Quest has been added to the player's quest log.";
}
}
}
}
else
{
recout += "Quest Id [";
recout += args;
recout += "] was not found and unable to add it to the player's quest log.";
}
recout += "\n\n";
SendMultilineMessage(m_session, recout.c_str());
return true;
}
示例7: GossipSelectOption
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char* Code)
{
GossipMenu* Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr);
break;
case 3:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7755, Plr);
Menu->AddItem(0, "That sounds dangerous.", 4);
Menu->SendTo(Plr);
}
break;
case 4:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7756, Plr);
Menu->AddItem(0, "What happened to her after that?", 5);
Menu->SendTo(Plr);
}
break;
case 5:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7757, Plr);
Menu->AddItem(0, "Natalia?", 6);
Menu->SendTo(Plr);
}
break;
case 6:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7758, Plr);
Menu->AddItem(0, "What demands?", 7);
Menu->SendTo(Plr);
}
break;
case 7:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7759, Plr);
Menu->AddItem(0, "Lost it? What do you mean?", 8);
Menu->SendTo(Plr);
}
break;
case 8:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7760, Plr);
Menu->AddItem(0, "Possessed by what?", 9);
Menu->SendTo(Plr);
}
break;
case 9:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7761, Plr);
Menu->AddItem(0, "I'll be back once I straighten this mess out.", 10);
Menu->SendTo(Plr);
}
break;
case 10:
{
QuestLogEntry* en = Plr->GetQuestLogForEntry(8304);
if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1])
{
en->SetMobCount(1, 1);
en->SendUpdateAddKill(1);
en->UpdatePlayerFields();
}
}
break;
}
}
示例8: HandleQuestgiverAcceptQuestOpcode
//.........这里部分代码省略.........
if( qst_giver->GetTypeId() == TYPEID_UNIT && static_cast< Creature* >( qst_giver )->m_escorter != NULL )
{
SystemMessage("You cannot accept this quest at this time.");
return;
}
// Check the player hasn't already taken this quest, or
// it isn't available.
uint32 status = sQuestMgr.CalcQuestStatus(qst_giver, _player,qst,3, bSkipLevelCheck);
if((!sQuestMgr.IsQuestRepeatable(qst) && _player->HasFinishedQuest(qst->id)) || ( status != QMGR_QUEST_AVAILABLE && status != QMGR_QUEST_REPEATABLE && status != QMGR_QUEST_CHAT )
|| !hasquest)
{
// We've got a hacker. Disconnect them.
//sCheatLog.writefromsession(this, "tried to accept incompatible quest %u from %u.", qst->id, qst_giver->GetEntry());
//Disconnect();
return;
}
int32 log_slot = GetPlayer()->GetOpenQuestSlot();
if (log_slot == -1)
{
sQuestMgr.SendQuestLogFull(GetPlayer());
return;
}
//FIXME
/*if(Player Has Timed quest && qst->HasFlag(QUEST_FLAG_TIMED))
sQuestMgr.SendQuestInvalid(INVALID_REASON_HAVE_TIMED_QUEST);*/
if(qst->count_receiveitems || qst->srcitem)
{
uint32 slots_required = qst->count_receiveitems;
if(GetPlayer()->GetItemInterface()->CalculateFreeSlots(NULL) < slots_required)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_BAG_FULL);
sQuestMgr.SendQuestFailed(FAILED_REASON_INV_FULL, qst, GetPlayer());
return;
}
}
/* if(qst_giver->GetTypeId() == TYPEID_UNIT && !ScriptSystem->OnQuestRequireEvent(qst, static_cast< Creature* >( qst_giver ), _player, QUEST_EVENT_CAN_ACCEPT))
return;*/
QuestLogEntry *qle = new QuestLogEntry();
qle->Init(qst, _player, log_slot);
qle->UpdatePlayerFields();
// If the quest should give any items on begin, give them the items.
for(uint32 i = 0; i < 4; ++i)
{
if(qst->receive_items[i])
{
Item *item = objmgr.CreateItem( qst->receive_items[i], GetPlayer());
if(!GetPlayer()->GetItemInterface()->AddItemToFreeSlot(item))
{
delete item;
}
else
SendItemPushResult(item, false, true, false, true,
_player->GetItemInterface()->LastSearchItemBagSlot(), _player->GetItemInterface()->LastSearchItemSlot(),
1);
}
}
if(qst->srcitem && qst->srcitem != qst->receive_items[0])
{
Item * item = objmgr.CreateItem( qst->srcitem, _player );
if(item)
{
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT, qst->srcitemcount ? qst->srcitemcount : 1);
if(!_player->GetItemInterface()->AddItemToFreeSlot(item))
delete item;
}
}
// Timed quest handler.
if(qst->time > 0)
{
//Start Quest Timer Event Here
//sEventMgr.AddEvent(GetPlayer(), &Player::EventTimedQuestExpire, qst, qle, static_cast<uint32>(log_slot), EVENT_TIMED_QUEST_EXPIRE, qst->time * 1000, 1);
//uint32 qtime = static_cast<uint32>(time(NULL) + qst->time);
//GetPlayer()->SetUInt32Value(log_slot+2, qtime);
//GetPlayer()->SetUInt32Value(PLAYER_QUEST_LOG_1_01 + (log_slot * 3), qtime);
//GetPlayer()->timed_quest_slot = log_slot;
}
if(qst->count_required_item || qst_giver->GetTypeId() == TYPEID_GAMEOBJECT) // gameobject quests deactivate
GetPlayer()->UpdateNearbyGameObjects();
//ScriptSystem->OnQuestEvent(qst, static_cast< Creature* >( qst_giver ), _player, QUEST_EVENT_ON_ACCEPT);
sQuestMgr.OnQuestAccepted(_player,qst,qst_giver);
sLog.outDebug("WORLD: Added new QLE.");
sHookInterface.OnQuestAccept(_player, qst);
}
示例9: OnActivate
void OnActivate(Player* pPlayer)
{
QuestLogEntry* pQuest = pPlayer->GetQuestLogForEntry(10895);
if(pQuest != NULL)
{
// M4ksiu - WTF IS THIS FOR? :|
float SSX = pPlayer->GetPositionX();
float SSY = pPlayer->GetPositionY();
float SSZ = pPlayer->GetPositionZ();
GameObject* pBeacon = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(SSX, SSY, SSZ, 184661);
if(pBeacon != NULL && pBeacon->GetFlags() > 0)
{
pBeacon->SetFlags((pBeacon->GetFlags() - 1));
}
// Northern Zeth'Gor Tower
if(pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0])
{
GameObject* pNorthern = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-820.0f, 2029.0f, 55.0f, 300150);
if(pNorthern != NULL && pPlayer->CalcDistance(pPlayer, pNorthern) < 40) // if reduced the server will crash when out of range
{
pQuest->SetMobCount(0, pQuest->GetMobCount(0) + 1);
pQuest->SendUpdateAddKill(0);
pQuest->UpdatePlayerFields();
GameObject* pGameobject = sEAS.SpawnGameobject(pPlayer, 183816, -819.77f, 2029.09f, 55.6082f, 0, 4, 0, 0, 0, 0);
if(pGameobject != NULL)
{
sEAS.GameobjectDelete(pGameobject, 1 * 60 * 1000);
}
return;
}
}
// Southern Zeth'Gor Tower
if(pQuest->GetMobCount(1) < pQuest->GetQuest()->required_mobcount[1])
{
GameObject* pSouthern = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-1150.0f, 2110.0f, 84.0f, 300150);
if(pSouthern != NULL && pPlayer->CalcDistance(pPlayer, pSouthern) < 40)
{
pQuest->SetMobCount(1, pQuest->GetMobCount(1) + 1);
pQuest->SendUpdateAddKill(1);
pQuest->UpdatePlayerFields();
GameObject* pGameobject = sEAS.SpawnGameobject(pPlayer, 183816, -1150.53f, 2109.92f, 84.4204f, 0, 4, 0, 0, 0, 0);
if(pGameobject != NULL)
{
sEAS.GameobjectDelete(pGameobject, 1 * 60 * 1000);
}
return;
}
}
// Forge Zeth'Gor Tower
if(pQuest->GetMobCount(2) < pQuest->GetQuest()->required_mobcount[2])
{
GameObject* pForge = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-893.0f, 1919.0f, 82.0f, 300150);
if(pForge != NULL && pPlayer->CalcDistance(pPlayer, pForge) < 40)
{
pQuest->SetMobCount(2, pQuest->GetMobCount(2) + 1);
pQuest->SendUpdateAddKill(2);
pQuest->UpdatePlayerFields();
GameObject* pGameobject = sEAS.SpawnGameobject(pPlayer, 183816, -893.499f, 1919.27f, 81.6449f, 0, 4, 0, 0, 0, 0);
if(pGameobject != NULL)
{
sEAS.GameobjectDelete(pGameobject, 1 * 60 * 1000);
}
return;
}
}
// Foothill Zeth'Gor Tower
if(pQuest->GetMobCount(3) < pQuest->GetQuest()->required_mobcount[3])
{
GameObject* pFoothill = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-978.0f, 1879.0f, 111.0f, 300150);
if(pFoothill != NULL && pPlayer->CalcDistance(pPlayer, pFoothill) < 40)
{
pQuest->SetMobCount(3, pQuest->GetMobCount(3) + 1);
pQuest->SendUpdateAddKill(3);
pQuest->UpdatePlayerFields();
GameObject* pGameobject = sEAS.SpawnGameobject(pPlayer, 183816, -977.713f, 1879.500f, 110.892f, 0, 4, 0, 0, 0, 0);
if(pGameobject != NULL)
{
sEAS.GameobjectDelete(pGameobject, 1 * 60 * 1000);
}
return;
}
}
else
{
pPlayer->BroadcastMessage("You are to far away!");
}
//.........这里部分代码省略.........
示例10: PlantForsakenBanner
// A Lesson in Fear
bool PlantForsakenBanner(uint32 i, Spell* pSpell)
{
if(pSpell->u_caster->IsPlayer() == false)
return true;
Player *pPlayer = static_cast<Player*>(pSpell->u_caster);
if( pPlayer == NULL )
return true;
QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry(11282);
if( pQuest == NULL )
return true;
Creature*target = static_cast<Creature*>(pSpell->GetUnitTarget());
if (target == NULL)
return true;
float X = target->GetPositionX();
float Y = target->GetPositionY();
float Z = target->GetPositionZ();
uint32 cit = target->GetEntry();
switch(cit)
{
case 24161:
{
if( pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[ 0 ] )
{
uint32 newcount = pQuest->GetMobCount( 0 ) + 1;
pQuest->SetMobCount( 0, newcount );
pQuest->SendUpdateAddKill( 0 );
pQuest->UpdatePlayerFields();
target->Despawn(0, 3*60*1000);
}
}
break;
case 24016:
{
if( pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[ 1 ] )
{
uint32 newcount = pQuest->GetMobCount( 0 ) + 1;
pQuest->SetMobCount( 0, newcount );
pQuest->SendUpdateAddKill( 0 );
pQuest->UpdatePlayerFields();
target->Despawn(0, 3*60*1000);
}
}
break;
case 24162:
{
if( pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[ 2 ] )
{
uint32 newcount = pQuest->GetMobCount( 0 ) + 1;
pQuest->SetMobCount( 0, newcount );
pQuest->SendUpdateAddKill( 0 );
pQuest->UpdatePlayerFields();
target->Despawn(0, 3*60*1000);
}
}
break;
}
return true;
}