void OnQuestComplete(PlayerPointer pPlayer, QuestLogEntry *qLogEntry) { if (!pPlayer) return; GameObjectPointer obj = NULLGOB; for(uint8 i = 0; i < 9; i++) { obj = sEAS.SpawnGameobject(pPlayer, GO_MEAT, MeatSpawnPoints[i].x, MeatSpawnPoints[i].y, MeatSpawnPoints[i].z, MeatSpawnPoints[i].o, 1, 0, 0, 0, 0); sEAS.GameobjectDelete(obj, 2*60*1000); } for(uint8 i = 0; i < 5; i++) { obj = sEAS.SpawnGameobject(pPlayer, GO_BOTTLE, BottleSpawnPoints[i].x, BottleSpawnPoints[i].y, BottleSpawnPoints[i].z, BottleSpawnPoints[i].o, 1, 0, 0, 0, 0); sEAS.GameobjectDelete(obj, 2*60*1000); } for(uint8 i = 0; i < 3; i++) { obj = sEAS.SpawnGameobject(pPlayer, GO_BREAD, BreadSpawnPoints[i].x, BreadSpawnPoints[i].y, BreadSpawnPoints[i].z, BreadSpawnPoints[i].o, 1, 0, 0, 0, 0); sEAS.GameobjectDelete(obj, 2*60*1000); } CreaturePointer Negolash = sEAS.SpawnCreature(pPlayer, 1494, -14657.400391, 155.115997, 4.081050, 0.353429); Negolash->GetAIInterface()->MoveTo(-14647.526367, 143.710052, 1.164550, 1.909); }
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * EnteredCode) { if(!plr) return; CreaturePointer doctor = TO_CREATURE(pObject); if (doctor == NULL) return; switch (IntId) { case 0: GossipHello(pObject, plr, true); break; case 1: { plr->GetItemInterface()->RemoveItemAmt(2799, 1); doctor->CastSpell(doctor, dbcSpell.LookupEntry(12380), true); if( !plr || !plr->GetMapMgr() || !plr->GetMapMgr()->GetInterface() ) return; CreaturePointer firstenemy = sEAS.SpawnCreature(plr, 1511, -13770.5, -6.79, 42.8, 5.7 , 0); firstenemy->GetAIInterface()->MoveTo(-13727.8, -26.2, 46.15, 4.07); firstenemy->Despawn(10*60*1000, 0); }break; } }
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; } CreaturePointer 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); pCreature->SaveToDB(); SystemMessage(m_session, "Value saved, you may need to rejoin or clean your client cache."); return true; }
bool ShatteringStomp(uint32 i, SpellPointer pSpell) { if( !pSpell->u_caster ) return false; UnitPointer _unit = pSpell->u_caster; CreaturePointer golem = NULLCREATURE; for(unordered_set<ObjectPointer>::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr) { if( (*itr) && (*itr)->IsCreature() ) { golem = TO_CREATURE((*itr)); if( golem->isAlive() && golem->creature_info && golem->creature_info->Id == MOLTEN_GOLEM_ENTRY ) { uint32 spellid = pSpell->m_spellInfo->Id == 59529 ? 59527 : 52429; CreaturePointer Golem = TO_CREATURE( (*itr) ); Golem->CastSpell( Golem, spellid, true ); for( uint8 i=0; i<7; i++ ) Golem->SchoolImmunityList[i] = 0; _unit->DealDamage( Golem, Golem->GetHealth(),0,0,0); } } } return true; }
void InnkeeperGossip::GossipHello(ObjectPointer pObject, PlayerPointer Plr, bool AutoSend) { CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE; if(pCreature==NULLCREATURE) return; GossipMenu *Menu; uint32 TextID = 820; uint32 Text = objmgr.GetGossipTextForNpc(pCreature->GetEntry()); if(Text != 0) { GossipText * text = NpcTextStorage.LookupEntry(Text); if(text != 0) TextID = Text; } objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr); #ifdef EVENT_HALLOWEEN if(!Plr->HasAura(SPELL_TRICK_OR_TREATED)) Menu->AddItem( 0, TRICK_OR_TREAT, 4 ); #endif if( pObject->GetUInt32Value(UNIT_NPC_FLAGS) & UNIT_NPC_FLAG_VENDOR ) Menu->AddItem( 1, "I would like to browse your goods.", 1 ); Menu->AddItem( 5, "Make this inn your home.", 2 ); Menu->AddItem( 0, "What can I do at an inn?", 3 ); if(AutoSend) Menu->SendTo(Plr); }
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * EnteredCode) { if(!plr) return; CreaturePointer spirit = TO_CREATURE(pObject); if (spirit == NULL) return; switch (IntId) { case 0: GossipHello(pObject, plr, true); break; case 1: { QuestLogEntry *en = plr->GetQuestLogForEntry(3520); if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0]) { en->SetMobCount(0, en->GetMobCount(0) + 1); en->SendUpdateAddKill(0); en->UpdatePlayerFields(); } if(!spirit) return; spirit->Despawn(1, 0); return; } } }
bool ChatHandler::HandleGOExport(const char * args, WorldSession * m_session) { /*if(!m_session->GetPlayer()->m_GM_SelectedGO) return false; std::stringstream name; if (*args) { name << "GO_" << args << ".sql"; } else { name << "GO_" << m_session->GetPlayer()->m_GM_SelectedGO->GetEntry() << ".sql"; } m_session->GetPlayer()->m_GM_SelectedGO->SaveToFile(name); BlueSystemMessage(m_session, "Go saved to: %s", name.str().c_str());*/ CreaturePointer pCreature = getSelectedCreature(m_session, true); if(!pCreature) return true; WorldDatabase.WaitExecute("INSERT INTO creature_names_export SELECT * FROM creature_names WHERE entry = %u", pCreature->GetEntry()); WorldDatabase.WaitExecute("INSERT INTO creature_proto_export SELECT * FROM creature_proto WHERE entry = %u", pCreature->GetEntry()); WorldDatabase.WaitExecute("INSERT INTO vendors_export SELECT * FROM vendors WHERE entry = %u", pCreature->GetEntry()); QueryResult * qr = WorldDatabase.Query("SELECT * FROM vendors WHERE entry = %u", pCreature->GetEntry()); if(qr != NULL) { do { WorldDatabase.WaitExecute("INSERT INTO items_export SELECT * FROM items WHERE entry = %u", qr->Fetch()[1].GetUInt32()); } while (qr->NextRow()); delete qr; } return true; }
void OnQuestComplete( PlayerPointer 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(); CreaturePointer Zealot = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 1931); if(Zealot == NULL) return; Zealot->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I. . . I. . .don't. . .feel. . .right. . ."); sEAS.EventCastSpell(Zealot, Zealot, 3287, 3000); Zealot->GetAIInterface()->setMoveType(11); Zealot->GetAIInterface()->StopMovement(3000); sEAS.CreateCustomWaypointMap(Zealot); sEAS.WaypointCreate(Zealot, 2289.649658f, 237.001389f, 27.089531f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2291.700928f, 235.561844f, 27.089531f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2292.835693f, 240.636948f, 27.089531f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2288.737305f, 240.503952f, 27.088022f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2287.812744f, 236.320938f, 27.088022f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2292.643033f, 240.513489f, 27.088022f, 1.323f, 0, 256, 0); sEAS.WaypointCreate(Zealot, 2289.628418f, 239.908279f, 27.088022f, 1.323f, 0, 256, 0); }
void OnQuestStart( PlayerPointer 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(); CreaturePointer 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()); } CreaturePointer Thug1 = sEAS.SpawnCreature(mTarget, 4969, -8686.803711, 445.267792, 99.789223, 5.461184, 300000); CreaturePointer Thug2 = sEAS.SpawnCreature(mTarget, 4969, -8675.571289, 444.162262, 99.644737, 3.834103, 300000); }
bool Temper(uint32 i, SpellPointer pSpell) { if( !pSpell->u_caster ) return false; UnitPointer _unit = pSpell->u_caster; //summon several Molten Golem's for( uint8 i=0; i<GOLEMS_COUNT; i++ ) { CreatureProto *cp = CreatureProtoStorage.LookupEntry(MOLTEN_GOLEM_ENTRY); CreatureInfo *ci = CreatureNameStorage.LookupEntry(MOLTEN_GOLEM_ENTRY); CreaturePointer c = NULLCREATURE; if (cp && ci) { c = _unit->GetMapMgr()->CreateCreature( MOLTEN_GOLEM_ENTRY ); if (c) { c->Load(cp, _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 0.0f); c->PushToWorld(_unit->GetMapMgr()); c->SetUInt64Value( UNIT_FIELD_SUMMONEDBY, _unit->GetGUID() ); } } } return true; }
bool Carcass(uint32 i, SpellPointer pSpell) // Becoming a Shadoweave Tailor { if(!pSpell->u_caster->IsPlayer()) return true; PlayerPointer pPlayer = TO_PLAYER(pSpell->u_caster); QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10804 ); CreaturePointer NetherDrake = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 21648); GameObjectPointer FlayerCarcass = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 185155); if ( FlayerCarcass == NULLGOB ) { FlayerCarcass = sEAS.SpawnGameobject(pPlayer, 185155, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, 1, 0, 0, 0, 0); FlayerCarcass->Despawn(60000); } if ( NetherDrake == NULL ) return true; if ( NetherDrake->HasActiveAura(38502) ) return true; if( pQuest!=NULL && pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[0] ) { NetherDrake->CastSpell(NetherDrake, dbcSpell.LookupEntry( 38502 ), true); NetherDrake->GetAIInterface()->m_moveFly = true; NetherDrake->GetAIInterface()->MoveTo(pPlayer->GetPositionX(), pPlayer->GetPositionY()+2, pPlayer->GetPositionZ(), 0); pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 )+1); pQuest->SendUpdateAddKill( 0 ); pQuest->UpdatePlayerFields(); } return true; }
void OnQuestComplete( PlayerPointer mTarget, QuestLogEntry * qLogEntry) { if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL ) return; CreaturePointer creat = mTarget->GetMapMgr()->GetInterface()->SpawnCreature(1946, 2467.314f, 14.8471f, 23.5950f, 0, true, false, 0, 0); creat->Despawn(60000,0); creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You have disturbed my rest. Now face my wrath!"); }
bool ChatHandler::HandleNpcComeCommand(const char* args, WorldSession* m_session) { // moves npc to players location PlayerPointer plr = m_session->GetPlayer(); CreaturePointer crt = getSelectedCreature(m_session, true); if(!crt) return true; crt->GetAIInterface()->MoveTo(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetOrientation()); return true; }
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code) { CreaturePointer creat = TO_CREATURE(pObject); switch(IntId) { case 1: creat->CastSpell(plr, dbcSpell.LookupEntry(34891), true); break; } }
bool ToLegionHold(uint32 i, AuraPointer pAura, bool apply) { if ( pAura == NULL || pAura->GetUnitCaster() == NULL || !pAura->GetUnitCaster()->IsPlayer() ) return true; PlayerPointer pPlayer = TO_PLAYER( pAura->GetUnitCaster() ); CreaturePointer pJovaanCheck = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(-3310.743896f, 2951.929199f, 171.132538f, 21633); if ( pJovaanCheck != NULL ) return true; QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10563 ); if ( pQuest == NULL ) { pQuest = pPlayer->GetQuestLogForEntry( 10596 ); if ( pQuest == NULL ) return true; } if ( apply ) { pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, 20366 ); pPlayer->Root(); CreaturePointer pJovaan = sEAS.SpawnCreature( pPlayer, 21633, -3310.743896f, 2951.929199f, 171.132538f, 5.054039f, 0 ); // Spawn Jovaan if ( pJovaan != NULL ) { pJovaan->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2 ); if ( pJovaan->GetAIInterface() != NULL ) { pJovaan->GetAIInterface()->SetAllowedToEnterCombat( false ); } } GameObjectPointer pGameObject = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 184834); if ( pGameObject != NULL ) { pGameObject->Despawn(60000); pPlayer->UpdateNearbyGameObjects(); } } else { if ( pQuest->GetMobCount( 2 ) < pQuest->GetQuest()->required_mobcount[2] ) { pQuest->SetMobCount( 2, pQuest->GetMobCount( 2 ) + 1 ); pQuest->SendUpdateAddKill( 2 ); pQuest->UpdatePlayerFields(); } pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, pPlayer->GetUInt32Value( UNIT_FIELD_NATIVEDISPLAYID ) ); pPlayer->UnRoot(); } return true; }
void OnLootTaken(PlayerPointer pLooter, ItemPrototype *pItemInfo) { float SSX = pLooter->GetPositionX(); float SSY = pLooter->GetPositionY(); float SSZ = pLooter->GetPositionZ(); float SSO = pLooter->GetOrientation(); CreaturePointer NewCreature = pLooter->GetMapMgr()->GetInterface()->SpawnCreature(11120, SSX, SSY, SSZ, SSO, true, false, 0, 0); if ( NewCreature != NULL ) NewCreature->Despawn(600000, 0); }
void OnActivate(PlayerPointer pPlayer) { float SSX = pPlayer->GetPositionX(); float SSY = pPlayer->GetPositionY(); float SSZ = pPlayer->GetPositionZ(); float SSO = pPlayer->GetOrientation(); CreaturePointer NewCreature = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(10882, SSX, SSY, SSZ, SSO, true, false, 0, 0); if ( NewCreature != NULL ) NewCreature->Despawn(600000, 0); }
bool ChatHandler::HandleItemRemoveCommand(const char* args, WorldSession *m_session) { char* iguid = strtok((char*)args, " "); if (!iguid) return false; uint64 guid = m_session->GetPlayer()->GetSelection(); if (guid == 0) { SystemMessage(m_session, "No selection."); return true; } CreaturePointer pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid)); if(!pCreature) { SystemMessage(m_session, "You should select a creature."); return true; } uint32 itemguid = atoi(iguid); int slot = pCreature->GetSlotByItemId(itemguid); std::stringstream sstext; if(slot != -1) { uint32 guidlow = GUID_LOPART(guid); std::stringstream ss; ss << "DELETE FROM vendors WHERE entry = " << guidlow << " AND item = " << itemguid << '\0'; WorldDatabase.Execute( ss.str().c_str() ); pCreature->RemoveVendorItem(itemguid); ItemPrototype* tmpItem = ItemPrototypeStorage.LookupEntry(itemguid); if(tmpItem) { sstext << "Item '" << itemguid << "' '" << tmpItem->Name1 << "' Deleted from list" << '\0'; } else { sstext << "Item '" << itemguid << "' Deleted from list" << '\0'; } } else { sstext << "Item '" << itemguid << "' Not Found in List." << '\0'; } SystemMessage(m_session, sstext.str().c_str()); return true; }
void OnLoad() { if(!_unit) return _unit->Despawn(60*1000, 0); CreaturePointer cialo = _unit->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), 5307); if(!cialo) return; if(!cialo->isAlive()) cialo->Despawn(1, 6*60*1000); }
void OnActivate(PlayerPointer pPlayer) { if(!pPlayer) return; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10915); if(qle == NULL) return; CreaturePointer exarch = sEAS.SpawnCreature(pPlayer, 22452, -3365.9, 5143.19, -9.00132, 3.05, 0); if ( exarch != NULL ) exarch->Despawn(6*60*1000, 0); }
void OnActivate(PlayerPointer pPlayer) { if(!pPlayer) return; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(9689); if(qle == NULL) return; CreaturePointer razormaw = sEAS.SpawnCreature(pPlayer, 17592, -1203.8, -12424.7, 95.36, 4.7, 0); if ( razormaw != NULL ) razormaw->Despawn(6*60*1000, 0); }
void OnActivate(PlayerPointer pPlayer) { if(!pPlayer) return; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(5381); if(qle == NULL) return; CreaturePointer demon = sEAS.SpawnCreature(pPlayer, 11876, -348.231, 1763.85, 138.371, 4.42728, 0); if ( demon != NULL ) demon->Despawn(6*60*1000, 0); }
void OnActivate(PlayerPointer pPlayer) { if(!pPlayer) return; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(6027); if(qle == NULL) return; CreaturePointer naga = sEAS.SpawnCreature(pPlayer, 12369, 246.741, 2953.3, 5.8631, 1.078, 0); if ( naga != NULL ) naga->Despawn(6*60*1000, 0); }
void OnActivate(PlayerPointer pPlayer) { if(!pPlayer) return; QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(8481); if(qle == NULL) return; CreaturePointer xandivious = sEAS.SpawnCreature(pPlayer, 15623, pPlayer->GetPositionX()+5, pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 0); if ( xandivious != NULL ) xandivious->Despawn(6*60*1000, 0); }
void OnDied(UnitPointer mKiller) { if( mKiller == NULL || mKiller->GetMapMgr() == NULL || mKiller->GetMapMgr()->GetInterface() == NULL ) return; float SSX = mKiller->GetPositionX(); float SSY = mKiller->GetPositionY(); float SSZ = mKiller->GetPositionZ(); CreaturePointer doctor = mKiller->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SSX, SSY, SSZ, 1449); if(doctor) doctor->Emote(EMOTE_ONESHOT_CHEER); }
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code) { if(IntId == 1) { QuestLogEntry *en = plr->GetQuestLogForEntry(9785); CreaturePointer casta = (TO_CREATURE(pObject)); switch (pObject->GetEntry()) { case 17900: { if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0]) { en->SetMobCount(0, 1); en->SendUpdateAddKill(0); en->UpdatePlayerFields(); } if(plr->GetStandingRank(942) == 4) casta->CastSpell(plr, 31808, true); else if(plr->GetStandingRank(942) == 5) casta->CastSpell(plr, 31810, true); else if(plr->GetStandingRank(942) == 6) casta->CastSpell(plr, 31811, true); else if(plr->GetStandingRank(942) == 7) casta->CastSpell(plr, 31815, true); }break; case 17901: { if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1]) { en->SetMobCount(1, 1); en->SendUpdateAddKill(1); en->UpdatePlayerFields(); } CreaturePointer casta = (TO_CREATURE(pObject)); if(plr->GetStandingRank(942) == 4) casta->CastSpell(plr, 31807, true); else if(plr->GetStandingRank(942) == 5) casta->CastSpell(plr, 31814, true); else if(plr->GetStandingRank(942) == 6) casta->CastSpell(plr, 31813, true); else if(plr->GetStandingRank(942) == 7) casta->CastSpell(plr, 31812, true); }break; } } }
bool ChatHandler::HandleItemCommand(const char* args, WorldSession *m_session) { char* pitem = strtok((char*)args, " "); if (!pitem) return false; uint64 guid = m_session->GetPlayer()->GetSelection(); if (guid == 0) { SystemMessage(m_session, "No selection."); return true; } CreaturePointer pCreature = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid)); if(!pCreature) { SystemMessage(m_session, "You should select a creature."); return true; } uint32 item = atoi(pitem); int amount = -1; char* pamount = strtok(NULL, " "); if (pamount) amount = atoi(pamount); ItemPrototype* tmpItem = ItemPrototypeStorage.LookupEntry(item); std::stringstream sstext; if(tmpItem) { std::stringstream ss; ss << "INSERT INTO vendors VALUES ('" << pCreature->GetUInt32Value(OBJECT_FIELD_ENTRY) << "', '" << item << "', '" << amount << "', 0, 0, 0 )" << '\0'; WorldDatabase.Execute( ss.str().c_str() ); pCreature->AddVendorItem(item, amount); sstext << "Item '" << item << "' '" << tmpItem->Name1 << "' Added to list" << '\0'; } else { sstext << "Item '" << item << "' Not Found in Database." << '\0'; } sGMLog.writefromsession(m_session, "added item %u to vendor %u", item, pCreature->GetEntry()); SystemMessage(m_session, sstext.str().c_str()); return true; }
void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code) { CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE; if(pObject->GetTypeId()!=TYPEID_UNIT) return; switch(IntId) { case 1: { plr->Gossip_Complete(); pCreature->CastSpell(plr, dbcSpell.LookupEntry(42711), true); }break; } }
void OnLootTaken(PlayerPointer pLooter, ItemPrototype *pItemInfo) { QuestLogEntry * en = pLooter->GetQuestLogForEntry(422); if(!en) return; float SSX = pLooter->GetPositionX(); float SSY = pLooter->GetPositionY(); float SSZ = pLooter->GetPositionZ(); float SSO = pLooter->GetOrientation(); CreaturePointer NewCreature = pLooter->GetMapMgr()->GetInterface()->SpawnCreature(1770, SSX, SSY, SSZ, SSO, true, false, 0, 0); if ( NewCreature != NULL ) NewCreature->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The Sons of Arugal will rise against all who challenge the power of the Moonrage!"); }
void OnActivate(PlayerPointer pPlayer) { uint32 Chance = RandomUInt(100); if(Chance <= 10) { float SSX = pPlayer->GetPositionX(); float SSY = pPlayer->GetPositionY(); float SSZ = pPlayer->GetPositionZ(); float SSO = pPlayer->GetOrientation(); CreaturePointer NewCreature = pPlayer->GetMapMgr()->GetInterface()->SpawnCreature(3619, SSX, SSY+1, SSZ, SSO, true, false, 0, 0); if ( NewCreature != NULL ) NewCreature->Despawn(600000, 0); } }