From 095be9864befe8e060a4c0e4c84aa3a96f9327d7 Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 14 Dec 2011 10:53:01 -0500 Subject: Core/Scripts: fix quest A Not-So-Modest Proposal (10270) --- src/server/scripts/World/go_scripts.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 3bb969977b6..44c3ab9bdc9 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -47,6 +47,7 @@ go_jotunheim_cage go_table_theka go_soulwell go_bashir_crystalforge +go_ethereal_teleport_pad EndContentData */ #include "ScriptPCH.h" @@ -921,6 +922,32 @@ public: } }; +/*###### +## go_ethereal_teleport_pad +######*/ + +enum eEtherealTeleportPad +{ + NPC_IMAGE_WIND_TRADER = 20518, + ITEM_TELEPORTER_POWER_PACK = 28969, +}; + +class go_ethereal_teleport_pad : public GameObjectScript +{ +public: + go_ethereal_teleport_pad() : GameObjectScript("go_ethereal_teleport_pad") { } + + bool OnGossipHello(Player* player, GameObject* pGO) + { + if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK, 1)) + return false; + + pGO->SummonCreature(NPC_IMAGE_WIND_TRADER, pGO->GetPositionX(), pGO->GetPositionY(), pGO->GetPositionZ(), pGO->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + + return true; + } +}; + /*###### ## go_soulwell ######*/ @@ -1282,6 +1309,7 @@ void AddSC_go_scripts() new go_jotunheim_cage; new go_table_theka; new go_inconspicuous_landmark; + new go_ethereal_teleport_pad; new go_soulwell; new go_tadpole_cage; new go_dragonflayer_cage; -- cgit v1.2.3 From d59c5e627fd023d3767bd8eb3e1eb4384d971bde Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 15 Dec 2011 11:12:15 +0100 Subject: Fix warnings --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 1 - src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 7 +------ src/server/game/Globals/ObjectMgr.cpp | 4 ++-- .../Movement/MovementGenerators/RandomMovementGenerator.cpp | 3 +-- src/server/game/Server/Protocol/Handlers/NPCHandler.cpp | 5 ++--- src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp | 11 +++-------- src/server/game/World/World.h | 2 +- .../CullingOfStratholme/culling_of_stratholme.cpp | 2 +- src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 2 +- .../ShatteredHalls/boss_warchief_kargath_bladefist.cpp | 4 +--- src/server/scripts/Outland/nagrand.cpp | 2 +- src/server/worldserver/CommandLine/CliRunnable.cpp | 2 +- src/server/worldserver/RemoteAccess/RASocket.cpp | 2 +- 14 files changed, 17 insertions(+), 32 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 06c1570ccd9..c5f04d4ff5f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -543,7 +543,6 @@ bool npc_escortAI::GetWaypointPosition(uint32 pointId, float& x, float& y, float if (waypoints.empty()) return false; - ScriptPointVector::const_iterator itrEnd = waypoints.end(); for (ScriptPointVector::const_iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr) { if (itr->uiPointId == pointId) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 5a9a3d2c751..61428d2afba 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18903,7 +18903,7 @@ void Player::_SaveSkills(SQLTransaction& trans) void Player::_SaveSpells(SQLTransaction& trans) { - for (PlayerSpellMap::iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();) + for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) trans->PAppend("DELETE FROM character_spell WHERE guid = '%u' and spell = '%u'", GetGUIDLow(), itr->first); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3b5b210d18e..f34d54d71a2 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1926,12 +1926,7 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext CombatStart(victim); RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MELEE_ATTACK); - uint32 hitInfo; - if (attType == BASE_ATTACK) - hitInfo = HITINFO_NORMALSWING2; - else if (attType == OFF_ATTACK) - hitInfo = HITINFO_LEFTSWING; - else + if (attType != BASE_ATTACK || attType != OFF_ATTACK) return; // ignore ranged case // melee attack spell casted at main hand attack only - no normal melee dmg dealt diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 4e159209e86..020f7bd56a9 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3818,11 +3818,11 @@ void ObjectMgr::LoadQuests() // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } //check for proper RequiredSkillId value (skill case) - if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) + if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) { if (qinfo->RequiredSkillId != skill_id) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%i).", + sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 5bd0a23207e..09af2303397 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -47,11 +47,10 @@ template<> void RandomMovementGenerator::_setRandomLocation(Creature &creature) { - float X, Y, Z, z, nx, ny, nz, ori, dist; + float X, Y, Z, nx, ny, nz, ori, dist; creature.GetHomePosition(X, Y, Z, ori); - z = creature.GetPositionZ(); Map const* map = creature.GetBaseMap(); // For 2D/3D system selection diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp index a675214930a..9c247655c3a 100755 --- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp @@ -878,19 +878,18 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket & recv_data) // reputation discount float discountMod = _player->GetReputationPriceDiscount(unit); - uint32 TotalCost = 0; if (itemGUID) { sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); Item* item = _player->GetItemByGuid(itemGUID); if (item) - TotalCost = _player->DurabilityRepair(item->GetPos(), true, discountMod, guildBank); + _player->DurabilityRepair(item->GetPos(), true, discountMod, guildBank); } else { sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); - TotalCost = _player->DurabilityRepairAll(true, discountMod, guildBank); + _player->DurabilityRepairAll(true, discountMod, guildBank); } } diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index a931d8a5b3d..9508f34b4f9 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -311,21 +311,16 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) uint64 ownerguid = 0; uint32 type; std::string name = "NO_NAME_FOR_GUID"; - uint8 signs = 0; - QueryResult result = CharacterDatabase.PQuery( - "SELECT ownerguid, name, " - " (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, " - " type " - "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid)); + QueryResult result = CharacterDatabase.PQuery("SELECT ownerguid, name, type" + "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); if (result) { Field* fields = result->Fetch(); ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); name = fields[1].GetString(); - signs = fields[2].GetUInt8(); - type = fields[3].GetUInt32(); + type = fields[2].GetUInt32(); } else { diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 4c5c2596fa0..9354c14f51c 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -635,7 +635,7 @@ class World /// Are we in the middle of a shutdown? bool IsShuttingDown() const { return m_ShutdownTimer > 0; } - uint32 const GetShutDownTimeLeft() { return m_ShutdownTimer; } + uint32 GetShutDownTimeLeft() const { return m_ShutdownTimer; } void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); void ShutdownCancel(); void ShutdownMsg(bool show = false, Player* player = NULL); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 82f16dd7784..7cbb1b91755 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -582,7 +582,7 @@ public: { Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f); if (!pJaina) - pJaina = pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); + pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000); if (pJaina) uiJainaGUID = pJaina->GetGUID(); bStepping = false; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 877971aa502..13c174a9607 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -590,7 +590,7 @@ class boss_freya : public CreatureScript waveCount++; } - void JustDied(Unit* who) + void JustDied(Unit* /*who*/) { //! Freya's chest is dynamically spawned on death by different spells. const uint32 summonSpell[2][4] = diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index 4f837870612..5965c352975 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -303,9 +303,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript if (resetcheck_timer <= diff) { - uint32 tempx, tempy; - tempx = uint32(me->GetPositionX()); - tempy = uint32(me->GetPositionY()); + uint32 tempx = uint32(me->GetPositionX()); if (tempx > 255 || tempx < 205) { EnterEvadeMode(); diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index c556253ecf1..bae3aa65b98 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -573,7 +573,7 @@ public: { Talk(SAY_KUR_MORE); - if (Creature* temp = me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) + if (me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0], kurenaiAmbushB[1], kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) Talk(SAY_KUR_MORE_TWO); me->SummonCreature(NPC_KUR_MURK_PUTRIFIER, kurenaiAmbushB[0]-2.5f, kurenaiAmbushB[1]-2.5f, kurenaiAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 564f6028eca..61352521d9f 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -104,7 +104,7 @@ void utf8print(void* /*arg*/, const char* str) printf(temp_buf); #else { - printf(str); + printf("%s", str); fflush(stdout); } #endif diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index 71d4d1df035..82238ee54bc 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -286,7 +286,7 @@ int RASocket::subnegotiate() if (n >= 1024) { - sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", n); + sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); return -1; } -- cgit v1.2.3 From eeb5a2d95efdc37a9b814bc653005e71930c2092 Mon Sep 17 00:00:00 2001 From: elecyb Date: Fri, 16 Dec 2011 12:11:26 -0300 Subject: Core/Spells: Added spells for Fire Elemental Totem and Earth Elemental Totem --- .../2011_12_16_00_world_creature_template.sql | 4 + .../world/2011_12_16_00_world_spell_bonus_data.sql | 5 + src/server/game/Entities/Pet/Pet.cpp | 1 + src/server/scripts/World/npcs_special.cpp | 117 +++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 sql/updates/world/2011_12_16_00_world_creature_template.sql create mode 100644 sql/updates/world/2011_12_16_00_world_spell_bonus_data.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2011_12_16_00_world_creature_template.sql b/sql/updates/world/2011_12_16_00_world_creature_template.sql new file mode 100644 index 00000000000..156fd431359 --- /dev/null +++ b/sql/updates/world/2011_12_16_00_world_creature_template.sql @@ -0,0 +1,4 @@ +-- Greater Fire Elemental script +UPDATE `creature_template` SET `ScriptName`='npc_fire_elemental' WHERE `entry`=15438; +-- Greater Earth Elemental script +UPDATE `creature_template` SET `ScriptName`='npc_earth_elemental' WHERE `entry`=15352; \ No newline at end of file diff --git a/sql/updates/world/2011_12_16_00_world_spell_bonus_data.sql b/sql/updates/world/2011_12_16_00_world_spell_bonus_data.sql new file mode 100644 index 00000000000..3250bda4fdb --- /dev/null +++ b/sql/updates/world/2011_12_16_00_world_spell_bonus_data.sql @@ -0,0 +1,5 @@ +-- Bounus coef for Greater Fire Elemental spells +DELETE FROM `spell_bonus_data` WHERE `entry` IN (13376,57984); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`,`ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(13376,0.032,-1,-1,-1,'Greater Fire Elemental - Fire Shield'), +(57984,0.4289,-1,-1,-1,'Greater Fire Elemental - Fire Blast'); \ No newline at end of file diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 404fe24d467..f730363d0c6 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -908,6 +908,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateHealth(40*petlevel); SetCreateMana(28 + 10*petlevel); } + SetBonusDamage(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_FIRE) * 0.5f); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4 - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4 + petlevel)); break; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index a5e5b467fc7..6ea25149734 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2163,6 +2163,121 @@ public: } }; +/*###### +# npc_fire_elemental +######*/ +#define SPELL_FIRENOVA 12470 +#define SPELL_FIRESHIELD 13376 +#define SPELL_FIREBLAST 57984 + +class npc_fire_elemental : public CreatureScript +{ +public: + npc_fire_elemental() : CreatureScript("npc_fire_elemental") { } + + struct npc_fire_elementalAI : public ScriptedAI + { + npc_fire_elementalAI(Creature* creature) : ScriptedAI(creature) {} + + uint32 FireNova_Timer; + uint32 FireShield_Timer; + uint32 FireBlast_Timer; + + void Reset() + { + FireNova_Timer = 5000 + rand() % 15000; // 5-20 sec cd + FireBlast_Timer = 5000 + rand() % 15000; // 5-20 sec cd + FireShield_Timer = 0; + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + if (FireShield_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRESHIELD); + FireShield_Timer = 2 * IN_MILLISECONDS; + } + else + FireShield_Timer -= diff; + + if (FireBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBLAST); + FireBlast_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + FireBlast_Timer -= diff; + + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + FireNova_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_fire_elementalAI(creature); + } +}; + +/*###### +# npc_earth_elemental +######*/ +#define SPELL_ANGEREDEARTH 36213 + +class npc_earth_elemental : public CreatureScript +{ +public: + npc_earth_elemental() : CreatureScript("npc_earth_elemental") { } + + struct npc_earth_elementalAI : public ScriptedAI + { + npc_earth_elementalAI(Creature* creature) : ScriptedAI(creature) {} + + uint32 AngeredEarth_Timer; + + void Reset() + { + AngeredEarth_Timer = 0; + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (AngeredEarth_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ANGEREDEARTH); + AngeredEarth_Timer = 5000 + rand() % 15000; // 5-20 sec cd + } + else + AngeredEarth_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature* creature) const + { + return new npc_earth_elementalAI(creature); + } +}; + /*###### # npc_wormhole ######*/ @@ -2673,5 +2788,7 @@ void AddSC_npcs_special() new npc_locksmith; new npc_tabard_vendor; new npc_experience; + new npc_fire_elemental; + new npc_earth_elemental; } -- cgit v1.2.3 From 3bd80d2bdf29f18eefe976fc645a9989aace7904 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sat, 17 Dec 2011 05:01:37 +0100 Subject: Scripts/Winter Veil: Fix possible exploit when kissing Winter Reveler. Also fix the visual cast of the debuff. --- src/server/scripts/World/npcs_special.cpp | 62 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 33 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 6ea25149734..38a56f7b64a 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1623,46 +1623,44 @@ public: ## npc_winter_reveler ####*/ +enum WinterReveler +{ + SPELL_MISTLETOE_DEBUFF = 26218, + SPELL_CREATE_MISTLETOE = 26206, + SPELL_CREATE_HOLLY = 26207, + SPELL_CREATE_SNOWFLAKES = 45036, +}; + class npc_winter_reveler : public CreatureScript { -public: - npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } + public: + npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } - struct npc_winter_revelerAI : public ScriptedAI - { - npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} - void ReceiveEmote(Player* player, uint32 emote) + struct npc_winter_revelerAI : public ScriptedAI { - if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - return; - //TODO: check auralist. - if (player->HasAura(26218)) - return; + npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} - if (emote == TEXT_EMOTE_KISS) + void ReceiveEmote(Player* player, uint32 emote) { - me->CastSpell(me, 26218, false); - player->CastSpell(player, 26218, false); - switch (urand(0, 2)) + if (player->HasAura(SPELL_MISTLETOE_DEBUFF)) + return; + + if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) + return; + + if (emote == TEXT_EMOTE_KISS) { - case 0: - me->CastSpell(player, 26207, false); - break; - case 1: - me->CastSpell(player, 26206, false); - break; - case 2: - me->CastSpell(player, 45036, false); - break; + uint32 spellId = RAND(SPELL_CREATE_MISTLETOE, SPELL_CREATE_HOLLY, SPELL_CREATE_SNOWFLAKES); + me->CastSpell(player, spellId, false); + me->CastSpell(player, SPELL_MISTLETOE_DEBUFF, false); } } - } - }; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_winter_revelerAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_winter_revelerAI(creature); + } }; /*#### @@ -1678,8 +1676,6 @@ public: #define C_VIPER 19921 -#define RAND 5 - class npc_snake_trap : public CreatureScript { public: @@ -1726,7 +1722,7 @@ public: float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) { - if (!(rand() % RAND)) + if (!(rand() % 5)) { me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); SpellTimer = (rand() % 10) * 100; -- cgit v1.2.3 From b4df932e7184a1ec9987b2592a3df8f6a0b267b2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 18 Dec 2011 22:09:03 +0100 Subject: Core/Dungeon Finder: Implemented Luck of the Draw buff --- .../2011_12_18_02_world_spell_script_names.sql | 3 ++ src/server/game/Maps/Map.cpp | 8 ++++ src/server/scripts/Spells/spell_generic.cpp | 50 ++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 sql/updates/world/2011_12_18_02_world_spell_script_names.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2011_12_18_02_world_spell_script_names.sql b/sql/updates/world/2011_12_18_02_world_spell_script_names.sql new file mode 100644 index 00000000000..c5f9a4376df --- /dev/null +++ b/sql/updates/world/2011_12_18_02_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_luck_of_the_draw'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(72221,'spell_gen_luck_of_the_draw'); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 04a5b102a6d..306af9c962a 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -30,6 +30,7 @@ #include "MapManager.h" #include "ObjectMgr.h" #include "Group.h" +#include "LFGMgr.h" union u_map_magic { @@ -2318,6 +2319,13 @@ bool InstanceMap::AddPlayerToMap(Player* player) ASSERT(playerBind->save == mapSave); } } + + if (group && group->isLFGGroup()) + if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) + if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) + if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) + if (dungeon->map == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } // for normal instances cancel the reset schedule when the diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 260b0c57563..af558d479a5 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -26,6 +26,8 @@ #include "SpellAuraEffects.h" #include "SkillDiscovery.h" #include "GridNotifiers.h" +#include "Group.h" +#include "LFGMgr.h" class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader { @@ -1419,6 +1421,53 @@ public: } }; +class spell_gen_luck_of_the_draw : public SpellScriptLoader +{ + public: + spell_gen_luck_of_the_draw() : SpellScriptLoader("spell_gen_luck_of_the_draw") { } + + class spell_gen_luck_of_the_draw_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript); + + // cheap hax to make it have update calls + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 5 * IN_MILLISECONDS; + } + + void Update(AuraEffect* /*effect*/) + { + if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER) + return; + + LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID()).begin())); + Group* group = GetUnitOwner()->ToPlayer()->GetGroup(); + Map const* map = GetUnitOwner()->GetMap(); + if (group && group->isLFGGroup()) + if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) + if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) + if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) + return; // in correct dungeon + + Remove(AURA_REMOVE_BY_DEFAULT); + } + + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_luck_of_the_draw_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_luck_of_the_draw_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_luck_of_the_draw_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1451,4 +1500,5 @@ void AddSC_generic_spell_scripts() new spell_gen_vehicle_scaling(); new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); + new spell_gen_luck_of_the_draw(); } -- cgit v1.2.3 From 7a2f7b0e6344bd5659d35f6ef50f23656cd68140 Mon Sep 17 00:00:00 2001 From: kaelima Date: Sun, 18 Dec 2011 22:45:23 +0100 Subject: Commands/Npc: Add AIName/ScriptName to npc info Thanks Aokromes for suggestion --- sql/updates/world/2011_12_18_03_world_trinity_string.sql | 3 +++ src/server/game/Miscellaneous/Language.h | 3 ++- src/server/scripts/Commands/cs_npc.cpp | 10 ++++------ 3 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 sql/updates/world/2011_12_18_03_world_trinity_string.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2011_12_18_03_world_trinity_string.sql b/sql/updates/world/2011_12_18_03_world_trinity_string.sql new file mode 100644 index 00000000000..d26cc356cff --- /dev/null +++ b/sql/updates/world/2011_12_18_03_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=5031; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES +(5031, 'AIName: %s ScriptName: %s'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index a6ff663b302..a5935e1de9f 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -946,8 +946,9 @@ enum TrinityStrings LANG_GOINFO_NAME = 5027, LANG_GOINFO_LOOTID = 5028, LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029, - // Room for more Trinity strings 5030-9999 LANG_FLEE = 5030, + LANG_NPCINFO_AIINFO = 5031, + // Room for more Trinity strings 5032-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index b9ac21cc040..a5aa2a516f3 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -552,15 +552,13 @@ public: handler->PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask()); handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor()); handler->PSendSysMessage(LANG_NPCINFO_POSITION, float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ())); + handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str()); - if ((npcflags & UNIT_NPC_FLAG_VENDOR)) - { + if (npcflags & UNIT_NPC_FLAG_VENDOR) handler->SendSysMessage(LANG_NPCINFO_VENDOR); - } - if ((npcflags & UNIT_NPC_FLAG_TRAINER)) - { + + if (npcflags & UNIT_NPC_FLAG_TRAINER) handler->SendSysMessage(LANG_NPCINFO_TRAINER); - } return true; } -- cgit v1.2.3 From b119558ee1d8198ef29ed393badf6e0ad9491de1 Mon Sep 17 00:00:00 2001 From: horn Date: Sun, 18 Dec 2011 23:42:23 +0100 Subject: Core/Dungeon Finder: Fixed LFG rewards in UK, ToCH, CoS and DTK. --- sql/updates/world/2011_12_18_04_world_conditions.sql | 7 +++++++ .../Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp | 8 ++++---- .../CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp | 8 ++++++-- src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp | 3 ++- .../UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp | 4 ++++ 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 sql/updates/world/2011_12_18_04_world_conditions.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2011_12_18_04_world_conditions.sql b/sql/updates/world/2011_12_18_04_world_conditions.sql new file mode 100644 index 00000000000..a56151a9f8f --- /dev/null +++ b/sql/updates/world/2011_12_18_04_world_conditions.sql @@ -0,0 +1,7 @@ +UPDATE spell_dbc SET EffectImplicitTargetA1 = 22, EffectImplicitTargetB1 = 7 WHERE Id = 58630; + +DELETE FROM conditions WHERE SourceTypeOrReferenceId = 13 AND SourceEntry IN (61863, 68663); +INSERT INTO conditions (SourceTypeOrReferenceId, SourceEntry, ConditionTypeOrReference, ConditionValue1, Comment) VALUES +(13, 61863, 18, 1, 'The Prophet Tharon''ja - Achievement Check'), +(13, 68663, 18, 1, 'The Black Knight - Kill Credit'), +(13, 58630, 18, 1, 'Mal''Ganis - Kill Credit'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 1a43472365a..798ea3925dc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -34,7 +34,8 @@ enum Spells H_SPELL_MIND_BLAST = 58850, SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. H_SPELL_SLEEP = 58849, - SPELL_VAMPIRIC_TOUCH = 52723 //Heals the caster for half the damage dealt by a melee attack. + SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack. + SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc }; enum Yells @@ -237,9 +238,8 @@ public: { instance->SetData(DATA_MAL_GANIS_EVENT, DONE); - // give achievement credit to players. criteria use spell 58630 which doesn't exist. - if (instance) - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + // give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc + DoCast(me, SPELL_KILL_CREDIT); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index fd84c1eec8a..f73e9779248 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -54,8 +54,10 @@ enum eSpells SPELL_BLACK_KNIGHT_RES = 67693, - SPELL_LEAP = 67749, - SPELL_LEAP_H = 67880 + SPELL_LEAP = 67749, + SPELL_LEAP_H = 67880, + + SPELL_KILL_CREDIT = 68663 }; enum eModels @@ -288,6 +290,8 @@ public: void JustDied(Unit* /*killer*/) { + DoCast(me, SPELL_KILL_CREDIT); + if (instance) instance->SetData(BOSS_BLACK_KNIGHT, DONE); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index e552341fd1e..d877bbd0842 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -237,7 +237,8 @@ public: for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* player = i->getSource()) player->DeMorph(); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_ACHIEVEMENT_CHECK); + + DoCast(me, SPELL_ACHIEVEMENT_CHECK); instance->SetData(DATA_THARON_JA_EVENT, DONE); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index dc2d34326a7..3712bd748a5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -173,7 +173,11 @@ public: DoScriptText(YELL_DEAD_2, me); if (instance) + { + // Ingvar has MOB_INGVAR_UNDEAD id in this moment, so we have to update encounter state for his original id + instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, MOB_INGVAR_HUMAN, me); instance->SetData(DATA_INGVAR_EVENT, DONE); + } } void KilledUnit(Unit* /*victim*/) -- cgit v1.2.3