bool ChatHandler::HandleNPCFlagCommand(const char* args, WorldSession *m_session) { if (!*args) return false; uint32 npcFlags = (uint32) atoi((char*)args); uint64 guid = m_session->GetPlayer()->GetSelection(); if (guid == 0) { SystemMessage(m_session, "No selection."); return true; } Creature * pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid)); if(!pCreature) { SystemMessage(m_session, "You should select a creature."); return true; } pCreature->SetUInt32Value(UNIT_NPC_FLAGS , npcFlags); WorldDatabase.Execute("UPDATE creature_proto SET npcflags = '%lu' WHERE entry = %lu", npcFlags, pCreature->GetProto()->Id); SystemMessage(m_session, "Value saved, you may need to rejoin or clean your client cache."); sGMLog.writefromsession( m_session, "changed npc flags of creature %u [%s] to %u", pCreature->GetEntry(), pCreature->GetCreatureInfo()->Name, npcFlags ); return true; }
bool ChatHandler::HandleNPCFlagCommand(const char* args, WorldSession *m_session) { if (!*args) return false; uint32 npcFlags = (uint32) atoi((char*)args); uint64 guid = m_session->GetPlayer()->GetSelection(); if (guid == 0) { SystemMessage(m_session, "No selection."); return true; } Creature * pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(guid); if(!pCreature) { SystemMessage(m_session, "You should select a creature."); return true; } pCreature->SetUInt32Value(UNIT_NPC_FLAGS , npcFlags); pCreature->SaveToDB(); SystemMessage(m_session, "Value saved, you may need to rejoin or clean your client cache."); return true; }
void WaypointMovementGenerator<Creature>::StartMove(Creature& creature) { if (!i_path || i_path->empty()) return; if (Stopped()) return; if (WaypointBehavior* behavior = i_path->at(i_currentNode).behavior) { if (behavior->model2 != 0) creature.SetDisplayId(behavior->model2); creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } if (m_isArrivalDone) i_currentNode = (i_currentNode + 1) % i_path->size(); m_isArrivalDone = false; creature.addUnitState(UNIT_STAT_ROAMING_MOVE); const WaypointNode& node = i_path->at(i_currentNode); Movement::MoveSplineInit init(creature); init.MoveTo(node.x, node.y, node.z, true); if (node.orientation != 100 && node.delay != 0) init.SetFacing(node.orientation); init.SetWalk(!creature.IsLevitating()); init.Launch(); }
void OnQuestStart(Player * mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; Creature * mogor = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(mTarget->GetPositionX(), mTarget->GetPositionY(), 0, 18069); if(mogor) { mogor->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Prepare yourselves!"); Unit * Qgiver = NULL; Qgiver = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(mTarget->GetPositionX(), mTarget->GetPositionY(), 0, 18471); if(Qgiver) { char msg[256]; snprintf((char*)msg, 256, "Mogor has challenged you. You have to accept! Get in the right of blood if you are ready to fight.", mTarget->GetName()); Qgiver->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, msg); string msg2 = "For the first time in the Ring of Bloods history. Mogor has chosen to exercise his right of the battle! On this wartorn ground, "; msg2 += mTarget->GetName(); msg2 += " will face Mogor, hero of the Warmaul!"; sEventMgr.AddEvent(static_cast< Unit* >(Qgiver), &Unit::SendChatMessage, (uint8)CHAT_MSG_MONSTER_YELL, (uint32)LANG_UNIVERSAL, msg2.c_str(), EVENT_UNIT_CHAT_MSG, 32000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); } mogor->SetUInt64Value(UNIT_FIELD_FLAGS, 0); mogor->GetAIInterface()->SetAllowedToEnterCombat(true); mogor->GetAIInterface()->MoveTo(-704.669f, 7871.08f, 45.0387f, 1.59531f); mogor->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 14); } }
//play npc emote static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, const char* args) { uint32 emote = atoi((char*)args); Creature* target = handler->getSelectedCreature(); if (!target) { handler->SendSysMessage(LANG_SELECT_CREATURE); handler->SetSentErrorMessage(true); return false; } if (target->GetTransport() && target->GetGUIDTransport()) { PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE); stmt->setInt16(0, int16(emote)); stmt->setInt32(1, target->GetTransport()->GetEntry()); stmt->setInt32(2, target->GetGUIDTransport()); WorldDatabase.Execute(stmt); } target->SetUInt32Value(UNIT_NPC_EMOTESTATE, emote); return true; }
void OnQuestStart( Player* mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* Dashel = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 4961); if(Dashel == NULL) return; Dashel->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, 72); Dashel->GetAIInterface()->disable_melee = false; Dashel->GetAIInterface()->SetAllowedToEnterCombat(true); uint32 chance = RandomUInt(100); if(chance < 15) { string say = "Now you're gonna get it good, "; say+=(TO_PLAYER(mTarget))->GetName(); say+="!"; Dashel->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, say.c_str()); } Creature* Thug1 = sEAS.SpawnCreature(mTarget, 4969, -8686.803711, 445.267792, 99.789223, 5.461184, 300000); Creature* Thug2 = sEAS.SpawnCreature(mTarget, 4969, -8675.571289, 444.162262, 99.644737, 3.834103, 300000); }
void OnQuestStart(Player* pPlayer, QuestLogEntry* pQuest) { Creature* pAkida = sEAS.SpawnCreature(pPlayer, 17379, -4183.043457f, -12511.419922f, 44.361786f, 6.05629f, 0); if (pAkida == nullptr) return; pAkida->m_escorter = pPlayer; pAkida->GetAIInterface()->setMoveType(RUN); pAkida->GetAIInterface()->StopMovement(1000); pAkida->GetAIInterface()->SetAllowedToEnterCombat(false); pAkida->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Follow me I shall result you on a place!"); pAkida->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); pAkida->CastSpell(pAkida, 25035, true); // Apparition Effect sEAS.CreateCustomWaypointMap(pAkida); sEAS.WaypointCreate(pAkida, -4174.025879f, -12512.800781f, 44.361458f, 2.827430f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -4078.135986f, -12535.500977f, 43.066765f, 5.949394f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -4040.495361f, -12565.537109f, 43.698250f, 5.592041f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -4009.526367f, -12598.929688f, 53.168480f, 5.434962f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -3981.581543f, -12635.541602f, 63.896046f, 5.332861f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -3953.170410f, -12680.391602f, 75.433006f, 5.218981f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -3924.324951f, -12741.846680f, 95.187035f, 5.124734f, 0, 256, 16995); sEAS.WaypointCreate(pAkida, -3920.791260f, -12746.218750f, 96.887978f, 3.271200f, 0, 256, 16995); sEAS.EnableWaypoints(pAkida); mAkidas.push_back(std::make_pair(pPlayer->GetGUID(), pAkida)); }
//set npcflag of creature static bool HandleNpcSetFlagCommand(ChatHandler* handler, const char* args) { if (!*args) return false; uint32 npcFlags = (uint32) atoi((char*)args); Creature* creature = handler->getSelectedCreature(); if (!creature) { handler->SendSysMessage(LANG_SELECT_CREATURE); handler->SetSentErrorMessage(true); return false; } creature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags); PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_NPCFLAG); stmt->setUInt32(0, npcFlags); stmt->setUInt32(1, creature->GetEntry()); WorldDatabase.Execute(stmt); handler->SendSysMessage(LANG_VALUE_SAVED_REJOIN); return true; }
bool ChatHandler::Command_NPC_Flags (const char* args) { if (!*args) return false; uint32 npcFlags = (uint32) atoi((char*)args); uint64 guid = m_session->GetPlayer()->GetSelection(); if (guid == 0) { m_session->SystemMessage(LANG_CMD_NOSEL); return true; } Creature * pCreature = objmgr.GetObject<Creature>(guid); if(!pCreature) { m_session->SystemMessage(LANG_CMD_SHSELCR); return true; } pCreature->SetUInt32Value(UNIT_NPC_FLAGS , npcFlags); pCreature->SaveToDB(); m_session->SystemMessage(LANG_CMD_VALSVD); return true; }
void OnQuestStart( Player* mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* creat = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 2768); if(creat == NULL) return; creat->m_escorter = mTarget; creat->GetAIInterface()->setMoveType(11); creat->GetAIInterface()->StopMovement(3000); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Defens Me!"); creat->SetUInt32Value(UNIT_NPC_FLAGS, 0); sEAS.CreateCustomWaypointMap(creat); sEAS.WaypointCreate(creat,-2078.054443f, -2091.207764f, 9.526212f, 4.770276f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2076.626465f, -2109.960449f, 14.320494f, 4.821321f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2072.851074f, -2123.574219f, 18.482662f, 5.623996f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2063.878906f, -2132.617920f, 21.430487f, 5.512474f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2051.495117f, -2145.205811f, 20.500065f, 5.481060f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2044.748291f, -2152.411377f, 20.158432f, 5.437863f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2044.748291f, -2152.411377f, 20.158432f, 5.437863f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2044.748291f, -2152.411377f, 20.158432f, 5.437863f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2044.748291f, -2152.411377f, 20.158432f, 5.437863f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2044.748291f, -2152.411377f, 20.158432f, 5.437863f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2051.495117f, -2145.205811f, 20.500065f, 5.481060f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2063.878906f, -2132.617920f, 21.430487f, 5.512474f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2072.851074f, -2123.574219f, 18.482662f, 5.623996f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2076.626465f, -2109.960449f, 14.320494f, 4.821321f, 0, 256, 4049); sEAS.WaypointCreate(creat,-2078.054443f, -2091.207764f, 9.526212f, 4.770276f, 0, 256, 4049); sEAS.EnableWaypoints(creat); }
void OnQuestStart( Player* mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* creat = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 5644); if(creat == NULL) return; creat->m_escorter = mTarget; creat->GetAIInterface()->setMoveType(11); creat->GetAIInterface()->StopMovement(3000); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Ts...... I must be removed from this lair"); creat->SetUInt32Value(UNIT_NPC_FLAGS, 0); sEAS.CreateCustomWaypointMap(creat); sEAS.WaypointCreate(creat,-336.599213f, 1764.957275f, 139.517746f, 4.461932f, 1, 256, 3791); sEAS.WaypointCreate(creat,-338.992798f, 1750.499023f, 139.414673f, 5.318010f, 1, 256, 3791); sEAS.WaypointCreate(creat,-327.872040f, 1734.572388f, 139.331665f, 3.382010f, 1, 256, 3791); sEAS.WaypointCreate(creat,-350.114044f, 1728.984741f, 139.337723f, 2.514144f, 1, 256, 3791); sEAS.WaypointCreate(creat,-372.413940f, 1745.675293f, 139.382660f, 3.872884f, 1, 256, 3791); sEAS.WaypointCreate(creat,-386.453796f, 1736.851685f, 137.771500f, 3.790415f, 1, 256, 3791); sEAS.WaypointCreate(creat,-400.639496f, 1728.250488f, 131.174881f, 3.511599f, 1, 256, 3791); sEAS.WaypointCreate(creat,-431.880005f, 1713.812378f, 127.584572f, 3.704021f, 1, 256, 3791); sEAS.WaypointCreate(creat,-453.655090f, 1700.086670f, 120.951744f, 4.261652f, 1, 256, 3791); sEAS.WaypointCreate(creat,-465.082306f, 1677.391113f, 111.065910f, 4.866406f, 1, 256, 3791); sEAS.WaypointCreate(creat,-462.129944f, 1665.744507f, 108.106010f, 4.257726f, 1, 256, 3791); sEAS.WaypointCreate(creat,-477.037445f, 1630.453857f, 99.003723f, 4.787863f, 1, 256, 3791); sEAS.WaypointCreate(creat,-474.509247f, 1590.814453f, 94.546768f, 5.197841f, 1, 256, 3791); sEAS.EnableWaypoints(creat); }
void WaypointMovementGenerator<Creature>::StartMove(Creature &creature) { if (!i_path || i_path->empty()) return; if (Stopped()) return; if (WaypointBehavior *behavior = i_path->at(i_currentNode).behavior) { if (behavior->model2 != 0) creature.SetDisplayId(behavior->model2); creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } if (m_isArrivalDone) i_currentNode = (i_currentNode+1) % i_path->size(); m_isArrivalDone = false; if (creature.CanFly()) creature.AddSplineFlag(SPLINEFLAG_FLYING); creature.addUnitState(UNIT_STAT_ROAMING_MOVE); const WaypointNode &node = i_path->at(i_currentNode); CreatureTraveller traveller(creature); i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z); }
void OnQuestStart( Player* mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* creat = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 3465); if(creat == NULL) return; creat->m_escorter = mTarget; creat->GetAIInterface()->setMoveType(11); creat->GetAIInterface()->StopMovement(3000); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I to the horror I fear wolfs, do not allow to approach them to me closely. Follow me"); creat->SetUInt32Value(UNIT_NPC_FLAGS, 0); sEAS.CreateCustomWaypointMap(creat); sEAS.WaypointCreate(creat,1408.243286f, 1086.476929f, 53.684814f, 4.145067f, 0, 256, 2684); sEAS.WaypointCreate(creat,1400.292236f, 1070.908325f, 52.454960f, 2.442609f, 0, 256, 2684); sEAS.WaypointCreate(creat,1370.173218f, 1087.330811f, 52.136669f, 3.921230f, 0, 256, 2684); sEAS.WaypointCreate(creat,1344.565063f, 1063.532349f, 52.780121f, 3.053365f, 0, 256, 2684); sEAS.WaypointCreate(creat,1291.855225f, 1065.194336f, 54.129812f, 2.291528f, 0, 256, 2684); sEAS.WaypointCreate(creat,1278.805664f, 1080.154541f, 53.967297f, 1.062379f, 0, 256, 2684); sEAS.WaypointCreate(creat,1293.010742f, 1106.864624f, 50.572147f, 1.476284f, 0, 256, 2684); sEAS.WaypointCreate(creat,1298.289917f, 1148.772827f, 52.434540f, 1.625511f, 0, 256, 2684); sEAS.WaypointCreate(creat,1289.469727f, 1200.744995f, 52.651005f, 1.488066f, 0, 256, 2684); sEAS.EnableWaypoints( creat ); }
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char* Code) { Creature* pCreature = (pObject->IsCreature()) ? TO_CREATURE(pObject) : NULL; if(pCreature == NULL) return; switch(IntId) { case 0: // Return to start GossipHello(pCreature, Plr); break; case 1: // Disciple of Naralex Casts Mark of the Wild on players. { pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Take this! It will be useful for you. I'll be waiting here when you have slain the 4 Fanglords to awake Naralex!"); pCreature->CastSpell(Plr, 5232, true); pCreature->Emote(EMOTE_ONESHOT_CHEER); Plr->Gossip_Complete(); } break; case 2: // Start Event { pCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); pCreature->GetAIInterface()->StopMovement(0); pCreature->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); pCreature->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); pCreature->GetAIInterface()->setWaypointToMove(2); } break; } }
//set npcflag of creature static bool HandleNpcSetFlagCommand(ChatHandler* handler, const char* args) { if (!*args) return false; uint32 npcFlags = (uint32) atoi((char*) args); Creature* pCreature = handler->getSelectedCreature(); if (!pCreature) { handler->SendSysMessage(LANG_SELECT_CREATURE); handler->SetSentErrorMessage(true); return false; } pCreature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags); WorldDatabase.PExecute( "UPDATE creature_template SET npcflag = '%u' WHERE entry = '%u'", npcFlags, pCreature->GetEntry()); handler->SendSysMessage(LANG_VALUE_SAVED_REJOIN); return true; }
void OnQuestStart(Player* mTarget, QuestLogEntry* qLogEntry) { float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* creat = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 1379); if(creat == NULL) return; creat->m_escorter = mTarget; creat->GetAIInterface()->setMoveType(11); creat->GetAIInterface()->StopMovement(3000); creat->GetAIInterface()->SetAllowedToEnterCombat(false); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Okay let's do!"); creat->SetUInt32Value(UNIT_NPC_FLAGS, 0); sEAS.CreateCustomWaypointMap(creat); sEAS.WaypointCreate(creat, -5753.780762f, -3433.290039f, 301.628387f, 4.834769f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5744.062500f, -3476.653564f, 302.269287f, 5.580896f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5674.703125f, -3543.583984f, 303.273682f, 4.775867f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5670.187500f, -3595.618164f, 311.888153f, 4.791576f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5664.515625f, -3687.601563f, 317.954590f, 4.131842f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5705.745117f, -3755.254150f, 321.452118f, 4.457779f, 0, 256, 1417); sEAS.WaypointCreate(creat, -5711.766113f, -3778.145752f, 322.827942f, 4.473486f, 0, 256, 1417); sEAS.EnableWaypoints(creat); }
void WaypointMovementGenerator<Creature>::StartMove(Creature& creature) { if (!i_path || i_path->empty()) { return; } if (Stopped(creature)) { return; } if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE)) { return; } WaypointPath::const_iterator currPoint = i_path->find(i_currentNode); MANGOS_ASSERT(currPoint != i_path->end()); if (WaypointBehavior* behavior = currPoint->second.behavior) { if (behavior->model2 != 0) { creature.SetDisplayId(behavior->model2); } creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } if (m_isArrivalDone) { bool reachedLast = false; ++currPoint; if (currPoint == i_path->end()) { reachedLast = true; currPoint = i_path->begin(); } // Inform AI if (creature.AI() && m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0) { if (!reachedLast) creature.AI()->MovementInform(EXTERNAL_WAYPOINT_MOVE_START + m_pathId, currPoint->first); else creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first); if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls return; } i_currentNode = currPoint->first; } m_isArrivalDone = false; creature.addUnitState(UNIT_STAT_ROAMING_MOVE); WaypointNode const& nextNode = currPoint->second;; Movement::MoveSplineInit init(creature); init.MoveTo(nextNode.x, nextNode.y, nextNode.z, true); if (nextNode.orientation != 100 && nextNode.delay != 0) { init.SetFacing(nextNode.orientation); } creature.SetWalk(!creature.hasUnitState(UNIT_STAT_RUNNING_STATE) && !creature.IsLevitating(), false); init.Launch(); }
void OPvPCapturePointEP::SummonFlightMaster(uint32 team) { if (EP_TOWER_EVENT_TEAM[EP_TOWER_PLAGUEWOOD] != team) { EP_TOWER_EVENT_TEAM[EP_TOWER_PLAGUEWOOD] = team; DelCreature(EP_PWT_FLIGHTMASTER); AddCreature(EP_PWT_FLIGHTMASTER,EP_PWT_FlightMaster.entry,team,EP_PWT_FlightMaster.map,EP_PWT_FlightMaster.x,EP_PWT_FlightMaster.y,EP_PWT_FlightMaster.z,EP_PWT_FlightMaster.o); // Change the flightmasters's faction to horde and display a red aura around the npc Creature* c = HashMapHolder<Creature>::Find(m_Creatures[EP_PWT_FLIGHTMASTER]); if (c && team == HORDE) { c->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, c->GetCreatureInfo()->faction_H); c->SetUInt32Value(UNIT_FIELD_AURA, EP_PWT_FlightMasterAura); } } }
void JustDied(Unit* /*Kill*/) { if (pInstance) pInstance->SetData(DATA_ALTAIRUS_EVENT, DONE); Creature* Slipstream = me->SummonCreature(NPC_SLIPSTREAM, -1190.88f, 125.20f, 737.62f, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); Slipstream->SetUInt32Value(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP); }
uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim) { Map* map = GetMap(); CreatureInfo const *ci = sObjectMgr.GetCreatureTemplate(entry); if (!ci) return 0; Creature* pCreature = NULL; if(ci->ScriptID) pCreature = sScriptMgr.GetCreatureScriptedClass(ci->ScriptID); if(pCreature == NULL) pCreature = new Creature(); if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0)) { delete pCreature; return 0; } pCreature->SetTransport(this); pCreature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); pCreature->m_movementInfo.guid = GetGUID(); pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o); if (anim) pCreature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim); pCreature->Relocate( GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))), GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())), z + GetPositionZ() , o + GetOrientation()); pCreature->SetHomePosition(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ(), pCreature->GetOrientation()); if(!pCreature->IsPositionValid()) { sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY()); delete pCreature; return 0; } map->Add(pCreature); m_NPCPassengerSet.insert(pCreature); if (tguid == 0) { ++currenttguid; tguid = currenttguid; } else currenttguid = std::max(tguid, currenttguid); pCreature->SetGUIDTransport(tguid); sScriptMgr.OnAddCreaturePassenger(this, pCreature); return tguid; }
void Spell::Effect_Summon_Wild(uint32 i) { if(!playerTarget) return; CreatureTemplate *ct; ct = objmgr.GetCreatureTemplate(m_spellInfo->EffectMiscValue[i]); if(!ct){ printf("unknown entry ID. return\n"); return; } uint32 level = m_caster->GetLevel(); Creature* spawnCreature = new Creature(); spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),ct->Name.c_str(),m_caster->GetMapId(),m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ(),m_caster->GetOrientation()); spawnCreature->SetUInt32Value(UNIT_FIELD_DISPLAYID, ct->Model); spawnCreature->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, ct->Model); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); spawnCreature->SetUInt32Value(UNIT_FIELD_HEALTH, 28 + 30*level); spawnCreature->SetUInt32Value(UNIT_FIELD_MAXHEALTH, 28 + 30*level); spawnCreature->SetUInt32Value(UNIT_FIELD_LEVEL , level); spawnCreature->SetUInt32Value(OBJECT_FIELD_TYPE, ct->Type); objmgr.AddObject(spawnCreature); spawnCreature->PlaceOnMap(); }
void Spell::Effect_Summon_Totem(uint32 i) { WorldPacket data; uint64 guid = 0; // delete old summoned totem if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT1){ guid = m_caster->m_TotemSlot1; m_caster->m_TotemSlot1 = 0; } else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT2){ guid = m_caster->m_TotemSlot2; m_caster->m_TotemSlot2 = 0; } else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT3){ guid = m_caster->m_TotemSlot3; m_caster->m_TotemSlot3 = 0; } else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT4){ guid = m_caster->m_TotemSlot4; m_caster->m_TotemSlot4 = 0; } if(guid != 0) { Creature* Totem; Totem = objmgr.GetObject<Creature>(guid); if(Totem){ Totem->RemoveFromMap(); objmgr.RemoveObject_Free(Totem); // Check if here bug with that _Free or not ? } } // spawn a new one Creature* pTotem = new Creature(); // need to set it via m_spellInfo uint16 display_id = (uint16)m_spellInfo->EffectMiscValue[i]; char* name = "need to fix this"; // uint32 guidlow, uint16 display_id, uint8 state, uint32 obj_field_entry, uint8 scale, uint16 type, uint16 faction, float x, float y, float z, float ang pTotem->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name, m_caster->GetMapId(), m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), m_caster->GetOrientation() ); pTotem->SetUInt32Value(OBJECT_FIELD_TYPE,33); pTotem->SetLevel (m_caster->GetLevel()); objmgr.AddObject(pTotem); pTotem->PlaceOnMap(); data.Initialize(SMSG_GAMEOBJECT_SPAWN_ANIM); data << pTotem->GetGUID(); m_caster->SendMessageToSet(&data,true); if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT1) m_caster->m_TotemSlot1 = pTotem->GetGUID(); else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT2) m_caster->m_TotemSlot2 = pTotem->GetGUID(); else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT3) m_caster->m_TotemSlot3 = pTotem->GetGUID(); else if(m_spellInfo->Effect[i] == EFFECT_SUMMON_TOTEM_SLOT4) m_caster->m_TotemSlot4 = pTotem->GetGUID(); }
void SummonBeams() { Creature* beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-258.333f,-356.34f,22.0499f,5.90835f,TEMPSUMMON_CORPSE_DESPAWN,0); if (beamer) { beamer->CastSpell(me,SPELL_BLUE_BEAM,true); beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); beams[0]=beamer->GetGUID(); } beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-219.918f,-371.308f,22.0042f,2.73072f,TEMPSUMMON_CORPSE_DESPAWN,0); if (beamer) { beamer->CastSpell(me,SPELL_BLUE_BEAM,true); beamer->SetUInt32Value(UNIT_FIELD_DISPLAYID , 11686); //invisible beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); beams[1]=beamer->GetGUID(); } }
ArcScriptCreatureAI* ArcScriptCreatureAI::SpawnCreature(uint32 pCreatureId, float pX, float pY, float pZ, float pO, bool pForceSameFaction) { Creature* NewCreature = _unit->GetMapMgr()->GetInterface()->SpawnCreature(pCreatureId, pX, pY, pZ, pO, false, false, 0, 0); ArcScriptCreatureAI* CreatureScriptAI = ( NewCreature ) ? static_cast<ArcScriptCreatureAI*>(NewCreature->GetScript()) : NULL; if( pForceSameFaction && NewCreature ) { uint32 FactionTemplate = _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); NewCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, FactionTemplate); } return CreatureScriptAI; }
void JustDied(Unit* /*who*/) { _JustDied(); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_WIND_OF_ALTAIRUS); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DOWNWIND_OF_ALTAIRUS); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UPWIND_OF_ALTAIRUS); summons.DespawnAll(); me->SetHover(false); Creature * Slipstream = me->SummonCreature(NPC_SLIPSTREAM_TWO, -1198.95f, 106.13f, 743.16f, 1.2f, TEMPSUMMON_CORPSE_DESPAWN, 0); Slipstream->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }
//change level of creature or pet static bool HandleNpcSetLevelCommand(ChatHandler* handler, const char* args) { if (!*args) return false; uint8 lvl = (uint8) atoi((char*)args); if (lvl < 1 || lvl > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + 3) { handler->SendSysMessage(LANG_BAD_VALUE); handler->SetSentErrorMessage(true); return false; } Creature* pCreature = handler->getSelectedCreature(); if (!pCreature) { handler->SendSysMessage(LANG_SELECT_CREATURE); handler->SetSentErrorMessage(true); return false; } if (pCreature->isPet()) { if (((Pet*)pCreature)->getPetType() == HUNTER_PET) { pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr->GetXPForLevel(lvl)/4); pCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); } ((Pet*)pCreature)->GivePetLevel(lvl); } else { pCreature->SetMaxHealth(100 + 30*lvl); pCreature->SetHealth(100 + 30*lvl); pCreature->SetLevel(lvl); pCreature->SaveToDB(); } return true; }
uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim) { Map* map = GetMap(); //make it world object so it will not be unloaded with grid Creature* creature = new Creature(true); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0)) { delete creature; return 0; } creature->SetTransport(this); creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); creature->m_movementInfo.guid = GetGUID(); creature->m_movementInfo.t_pos.Relocate(x, y, z, o); if (anim) creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim); creature->Relocate( GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))), GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())), z + GetPositionZ(), o + GetOrientation()); creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation()); creature->SetTransportHomePosition(creature->m_movementInfo.t_pos); if (!creature->IsPositionValid()) { sLog->outError(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); delete creature; return 0; } map->AddToMap(creature); m_NPCPassengerSet.insert(creature); if (tguid == 0) { ++currenttguid; tguid = currenttguid; } else currenttguid = std::max(tguid, currenttguid); creature->setActive(true); creature->SetGUIDTransport(tguid); sScriptMgr->OnAddCreaturePassenger(this, creature); return tguid; }
void JustDied(Unit* Killer) { Creature *pOtherBoss = GetOtherBoss(); if (pOtherBoss) { pOtherBoss->SetHealth(0); pOtherBoss->setDeathState(JUST_DIED); pOtherBoss->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); ((boss_twinemperorsAI *)pOtherBoss->AI())->DontYellWhenDead = true; } if (!DontYellWhenDead) // I hope AI is not threaded DoPlaySoundToSet(m_creature, IAmVeklor() ? SOUND_VL_DEATH : SOUND_VN_DEATH); }
MoonScriptCreatureAI* MoonScriptCreatureAI::SpawnCreature(uint32 pCreatureId, float pX, float pY, float pZ, float pO, bool pForceSameFaction, Unit *pTarget) { Creature *NewCreature = _unit->GetMapMgr()->GetMapScript()->SpawnCreature(pCreatureId, pX, pY, pZ, pO); MoonScriptCreatureAI* CreatureScriptAI = ( NewCreature ) ? static_cast<MoonScriptCreatureAI*>(NewCreature->GetScript()) : NULL; if( pForceSameFaction && NewCreature ) { uint32 FactionTemplate = _unit->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); NewCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, FactionTemplate); } if (pTarget!=NULLUNIT) CreatureScriptAI->AttackPlayer(pTarget); return CreatureScriptAI; }
void OnQuestStart( Player* mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mTarget->GetPositionX(); float SSY = mTarget->GetPositionY(); float SSZ = mTarget->GetPositionZ(); Creature* creat = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 9623); if(creat == NULL) return; creat->m_escorter = mTarget; creat->GetAIInterface()->setMoveType(11); creat->GetAIInterface()->StopMovement(3000); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "He-l-p Me... ts.. ts..."); creat->SetUInt32Value(UNIT_NPC_FLAGS, 0); sEAS.CreateCustomWaypointMap(creat); sEAS.WaypointCreate(creat,-6305.657715f, -1977.757080f, -268.076447f, 5.564124f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6292.354492f, -1988.233032f, -265.271667f, 4.821922f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6296.333984f, -2004.225342f, -268.766388f, 3.337522f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6329.421387f, -2007.737549f, -258.587250f, 3.769490f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6343.778809f, -2017.559204f, -256.952026f, 3.577064f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6360.504883f, -2030.157959f, -261.204926f, 3.526014f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6381.367676f, -2038.451904f, -262.319946f, 2.713128f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6404.608398f, -2028.813721f, -262.817230f, 1.146257f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6399.632813f, -2018.668091f, -263.569824f, 0.800682f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6383.180664f, -2003.231689f, -270.639984f, 0.631821f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6351.983887f, -1976.397827f, -276.039001f, 1.138403f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6342.651855f, -1958.451050f, -274.056122f, 1.805992f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6353.083008f, -1918.406006f, -264.135101f, 1.515395f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6350.737305f, -1900.465942f, -258.695831f, 2.677785f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6366.535645f, -1892.092651f, -256.424347f, 2.025904f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6378.548828f, -1866.535278f, -260.363281f, 1.154112f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6370.422852f, -1842.526978f, -259.409515f, 1.711744f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6374.264648f, -1825.782349f, -260.584442f, 1.955218f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6382.359375f, -1811.540527f, -266.374359f, 2.901623f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6383.307129f, -1794.137207f, -267.334686f, 1.821700f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6399.292980f, -1710.144897f, -273.734283f, 1.252285f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6361.579102f, -1582.413574f, -272.221008f, 1.798137f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6391.618652f, -1409.568237f, -272.190521f, 1.711742f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6407.588867f, -1305.676880f, -271.632935f, 0.553279f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6349.980469f, -1276.069580f, -266.971375f, 1.236575f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6324.551758f, -1233.252441f, -267.178619f, 0.451176f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6288.604492f, -1215.046265f, -267.426117f, 2.177482f, 1, 256, 8841); sEAS.WaypointCreate(creat,-6298.290039f, -1182.650024f, -269.101013f, 3.211410f, 1, 256, 8841); sEAS.EnableWaypoints( creat ); }