Commit Graph

172 Commits

Author SHA1 Message Date
megamage
67c84b1f3d Mobs fleeing and getting assistance feature implementaion. Author: Neo2003
--HG--
branch : trunk
2009-05-21 10:48:00 -05:00
megamage
3569f949d7 [7839] Rafactoring player targeting code in chat command and related cleanups/improvments.
* New extractOptFirstArg function for easy get 2 args in case option playe name as first arg.
    * New extractPlayerTarget function for get player pointer/guid/name for online/offline player base at provided name
      or if not provided by current seelction with error cases processing.
    * Property apply mute/unmute in case use different character name from loggined currently for account.
    * .reset commands can be used from console now
    * .repairitems comamnd can be used from console now but only to online player.

Author: VladimirMangos

--HG--
branch : trunk
2009-05-17 10:57:55 -05:00
QAston
47d5fc51c5 *Item enchancment/proc patch - original code by Thenecromancer
-void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType)
-{
-    if(!item || item->IsBroken())
-        return;
-
-    ItemPrototype const *proto = item->GetProto();
-    if(!proto)
-        return;
+void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
+{
+    Unit * Target = damageInfo->target;
+    WeaponAttackType attType = damageInfo->attackType;

     if (!Target || Target == this )
         return;

-    for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
-    {
-        _Spell const& spellData = proto->Spells[i];
-
-        // no spell
-        if(!spellData.SpellId )
-            continue;
-
-        // wrong triggering type
-        if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
-            continue;
-
-        SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
-        if(!spellInfo)
-        {
-            sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
-            continue;
-        }
-
-        // not allow proc extra attack spell at extra attack
-        if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
-            return;
-
-        float chance = spellInfo->procChance;
-
-        if(spellData.SpellPPMRate)
-        {
-            uint32 WeaponSpeed = GetAttackTime(attType);
-            chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
-        }
-        else if(chance > 100.0f)
-        {
-            chance = GetWeaponProcChance();
-        }
-
-        if (roll_chance_f(chance))
-            CastSpell(Target, spellInfo->Id, true, item);
+    // Can do effect if any damage done to target
+    if (damageInfo->damage)
+    {
+        for (int i = 0; i < 5; i++)
+        {
+            _Spell const& spellData = proto->Spells[i];
+
+            // no spell
+            if(!spellData.SpellId )
+                continue;
+
+            // wrong triggering type
+            if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
+                continue;
+
+            SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
+            if(!spellInfo)
+            {
+                sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
+                continue;
+            }
+
+            // not allow proc extra attack spell at extra attack
+            if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
+                return;
+
+            float chance = spellInfo->procChance;
+
+            if(spellData.SpellPPMRate)
+            {
+                uint32 WeaponSpeed = GetAttackTime(attType);
+                chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
+            }
+            else if(chance > 100.0f)
+            {
+                chance = GetWeaponProcChance();
+            }
+
+            if (roll_chance_f(chance))
+                CastSpell(Target, spellInfo->Id, true, item);
+        }
     }

     // item combat enchantments
@@ -6993,6 +6993,21 @@
             if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
                 continue;

+            SpellEnchantProcEntry const* entry =  spellmgr.GetSpellEnchantProcEvent(enchant_id);
+
+            if (entry && entry->procEx)
+            {
+                // Check hit/crit/dodge/parry requirement
+                if((entry->procEx & damageInfo->procEx) == 0)
+                    continue;
+            }
+            else
+            {
+                // Can do effect if any damage done to target
+                if (!(damageInfo->damage))
+                    continue;
+            }
+
             SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
             if (!spellInfo)
             {
@@ -7001,6 +7016,18 @@
             }

             float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
+
+            if (entry && entry->PPMChance)
+            {
+                uint32 WeaponSpeed = GetAttackTime(attType);
+                chance = GetPPMProcChance(WeaponSpeed, entry->PPMChance, spellInfo);
+            }
+            else if (entry && entry->customChance)
+                chance = entry->customChance;
+
+            // Apply spell mods
+            ApplySpellMod(pEnchant->spellid[s],SPELLMOD_CHANCE_OF_SUCCESS,chance);
+
             if (roll_chance_f(chance))
             {
                 if(IsPositiveSpell(pEnchant->spellid[s]))
@@ -7012,6 +7039,7 @@
     }
 }

+
 void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex)
 {
     ItemPrototype const* proto = item->GetProto();

--HG--
branch : trunk
2009-05-15 16:37:22 +02:00
Genars & Aokromes
854e791c2f New server options to block adding GMs to friends by players and to block inviting GMs to parties
--HG--
branch : trunk
2009-05-14 23:07:17 +02:00
megamage
e69d2cbed9 [7776] Completed implementation of CMSG_SPELLCLICK Author: arrai
For vehicles, you have to add the correct SPELL_AURA_CONTROL_VEHICLE spells to
    npc_spellclick_spells, otherwise you won't be able to use them

--HG--
branch : trunk
2009-05-05 16:56:15 -05:00
megamage
de11b9e901 [7730] Some optimizantion and code style. Author: zhenya
--HG--
branch : trunk
2009-04-29 00:26:07 -05:00
megamage
5ac67c27f7 [7715] Provided way for scripts set alternative gameobject state for client show. Author: VladimirMangos
Also use enum for gsmeobject states.

--HG--
branch : trunk
2009-04-27 18:36:10 -05:00
megamage
373914f1f9 *Fix a typo in reading config file.
--HG--
branch : trunk
2009-04-25 12:53:23 -05:00
megamage
19f8ba8cc1 [7707] Remove duplicate line in check. Author: NoFantasy
--HG--
branch : trunk
2009-04-24 11:45:59 -05:00
megamage
e7e03d167e *Merge.
--HG--
branch : trunk
2009-04-22 17:52:01 -05:00
megamage
2ecf455090 *Move move and remove obj from world update to map update.
--HG--
branch : trunk
2009-04-21 11:18:46 -05:00
megamage
905833f84e *Merge.
--HG--
branch : trunk
2009-04-15 17:06:38 -05:00
raczman
a712170758 Creature respawn linking, idea by Rat, wrote by Iskander, blessed by raczman.
--HG--
branch : trunk
2009-04-14 14:33:48 +02:00
XTZGZoReX
9787e5f578 * Merge.
--HG--
branch : trunk
2009-04-12 23:08:25 +02:00
megamage
8451619c2f [7647] Fixed typo in option StartHonorPoints default value set at error. Author: zhanhang03
--HG--
branch : trunk
2009-04-11 15:35:50 -05:00
megamage
6d0b82676c [7643] Allow set, store and output creture EventAI data version in addition to world DB and script library versions. Author: VladimirMangos
*This patch is disabled in TC2.

--HG--
branch : trunk
2009-04-09 17:57:57 -05:00
megamage
7b2ae4d964 [7627] Replace built-in in code table by new DB table achievement_criteria_data for store additional data for achievement criteria. Author: VladimirMangos
--HG--
branch : trunk
2009-04-08 16:24:34 -05:00
megamage
f59c4debf6 [7622] Added creatureAI with related database tables. Author: AlexDereka
*Note: three tables are renamed.

--HG--
branch : trunk
2009-04-07 19:38:09 -05:00
XTZGZoReX
760e31b249 * Ensure 100% that DB logging is enabled/disabled as expected.
--HG--
branch : trunk
2009-04-07 18:42:20 +02:00
mknjc
3157aa4013 Used constant SEC_PLAYER in World::SendGMText(int32 string_id, ...)
--HG--
branch : trunk
2009-04-07 16:24:49 +02:00
XTZGZoReX
2fe9fed7c7 * Tabs to spaces -- using: perl -p -i -e "s/\t/ /g" *
--HG--
branch : trunk
2009-04-07 10:51:45 +02:00
megamage
508a57313c *Merge.
--HG--
branch : trunk
2009-04-05 17:10:59 -05:00
megamage
f692364e8e *Fix a crash caused by scriptprocess
--HG--
branch : trunk
2009-04-04 20:31:43 -06:00
megamage
cb8b3fe5db [7607] Improvements in support some generic achievement classes Author: VladimirMangos
* Implement support achievements with refAchievement field != 0, that have criterias stored in achievement refAchievement.
    * Implement support achievement complete req. with specific count of completed critirias.
    * Avoid full achievement list scan at search achievement associated with criteria.

--HG--
branch : trunk
2009-04-03 16:36:20 -06:00
raczman
38d634a163 Fixed BG mark rewarding in case of prematurely finished BG:
-team with most points will get 3 marks, the other one 1 mark
-in case of a draw, each team gets 1 mark (not sure if blizzlike)
TODO:
-remove per BG score variables and substitute them further with general m_score[] array to avoid data duplication.
Please report any bugs, and TC2 devs - dont pull this change into TC2, its not 309-like.

--HG--
branch : trunk
2009-04-04 00:29:43 +02:00
megamage
6581497411 [7572] Use enum type instead int for World::SendServerMessage arg Author: VladimirMangos
--HG--
branch : trunk
2009-03-28 17:56:15 -06:00
XTZGZoReX
c23ca809df * Fixed tolerant login queue. Thanks to Iskander.
--HG--
branch : trunk
2009-03-28 10:55:14 +01:00
megamage
bc2f2bc56a [7552] Move client version dependend DBC code to src/game. Author: VladimirMangos
--HG--
branch : trunk
2009-03-27 09:58:20 -06:00
panaut0lordv
b40140e63c Fix typo.
--HG--
branch : trunk
2009-03-26 21:18:11 +01:00
megamage
1ac13728a7 [7545] Fixed exploration achievements for certian areas Author: DonTomika
[7546] move uptime table to Realm database, use realmid column. Author: Triply

--HG--
branch : trunk
2009-03-26 14:02:11 -06:00
XTZGZoReX
0952469d69 * Fix some conversion in DB logging.
--HG--
branch : trunk
2009-03-26 16:46:08 +01:00
XTZGZoReX
0da5f826b8 * Implement logging of battleground chats.
* New config option: ChatLogs.BattleGround.

--HG--
branch : trunk
2009-03-26 16:12:17 +01:00
XTZGZoReX
aa033536c1 * Fixed two typos. Thanks Wormheart.
--HG--
branch : trunk
2009-03-26 15:56:00 +01:00
XTZGZoReX
942e93fbcb * Implemented WUPDATE_CLEANDB timer to clean logs table of old entries.
* New config option: LogDB.Opt.ClearInterval - time in minutes between each call to cleanup.
* New config option: LogDB.Opt.ClearTime - maximum time in seconds to keep old log entries.

--HG--
branch : trunk
2009-03-25 15:21:32 +01:00
XTZGZoReX
82e966e5f2 * Added support for logging chats: Guild, raid, party, public, officer chat, addon messages, whispers, system/custom channels.
* Added config options to enable/disable them (ChatLogs.*), LogDB.Chat (enables/disables DB logging of chats), and ChatLogFile to specify the log file to use.

--HG--
branch : trunk
2009-03-25 14:25:15 +01:00
megamage
470d961dfa Let set in conf custom rates for low level kill/quest reputation gain. Author: VladimirMangos
--HG--
branch : trunk
2009-03-22 19:29:09 -06:00
megamage
a47d2e1c22 *Note some script id are changed. DB change may be needed.
[7518] Implement new script command SCRIPT_COMMAND_PLAY_SOUND (look in World.h for args) Author: VladimirMangos

    * Also rewrite use SMSG_PLAY_OBJECT_SOUND/SMSG_PLAY_SOUND
      Now WorldObject have 2 function for sound level dependent from distance (PlayDistanceSound)
      and for not depednet (PlayDirectSound)
    * Old Player::PlaySound function removed and uses need to be updated to WorldObject functions
      Note: function called for _source_ of sound in different from old function.
    * chat command .debug ps removed and .debug playsound can used for bother packects test:
      if no selection used SMSG_PLAY_SOUND, if selection exist including self then SMSG_PLAY_OBJECT_SOUND.

--HG--
branch : trunk
2009-03-22 19:20:03 -06:00
megamage
f1afff1a5b Updated OpenSSL lib. Thanks to Neo2003. Author: tomrus88
--HG--
branch : trunk
2009-03-21 14:39:04 -06:00
XTZGZoReX
55695eda78 * Implement ".server set closed on/off" command to allow/deny new connections to the world.
--HG--
branch : trunk
2009-03-21 13:51:28 +01:00
XTZGZoReX
9fe43fa9c0 * Implementing database logging:
** LogTime and LogColors config options removed due to incompatibility.
** Old file logging still available.
** Totally redone the Log class.
** Config options added: EnableLogDB, DBLogLevel, LogDB.Char, LogDB.RA, LogDB.GM -- remember to update config file.
** SQL updates attached.

--HG--
branch : trunk
2009-03-19 21:13:52 +01:00
megamage
f71dff82c6 *Fix build.
--HG--
branch : trunk
2009-03-09 19:17:12 -06:00
megamage
01b67a1f6a [7413] Fixed finally problems with node names localization in BattleGroundAB messages. Author: VladimirMangos
Also fix build at some platforms.
Note: GetTrinityString should be removed in the future when AV is updated.

--HG--
branch : trunk
2009-03-09 17:06:13 -06:00
megamage
5d5b37ab32 *Support localization for messsages in battleground. Author: VladimirMangos
[7411] Use similar localization classes for World::SendWorldText muti-line message. Author: VladimirMangos

--HG--
branch : trunk
2009-03-09 17:00:31 -06:00
megamage
e3fa93e75f [7395] Default MaxPlayerLevel should be 80 Author: multiplexer
--HG--
branch : trunk
2009-03-07 10:40:59 -06:00
megamage
417c7c8319 [7393] Implement access to client side holiday ids. Author: VladimirMangos
* src/game/GameEvent.* renamed to src/game/GameEventMgr.* for consistence
    * `game_event` now have new `holiday` field for store client side holiday id associated with game event
    * Added new enum HolidayIds with existed at this moment holiday ids.
    * New function "bool IsHolidayActive(HolidayIds id)" added accessabel from scripts for active holidays check.

--HG--
branch : trunk
2009-03-06 19:36:47 -06:00
megamage
7915fd768a *Merge.
--HG--
branch : trunk
2009-03-06 18:09:01 -06:00
Paradox
7b47d509e3 New AHBot plus AuctionHouse changes
--HG--
branch : trunk
2009-03-06 17:47:11 -06:00
megamage
80cd305082 [7383] Changed some comments in config file, changed default MaxRatingDifference from 100 to 150 in default config.
[7384] Removed some comments.
    Fixed problem that queues doesn't invite new players to already running battlegrounds.
    Some other fixes for announce system will be soon.

Author: Triply

--HG--
branch : trunk
2009-03-05 19:02:08 -06:00
megamage
635faad2bc *Merge.
--HG--
branch : trunk
2009-03-05 15:24:09 -06:00
Blaymoira
fd2fd00c14 *Implement access_requirement table - by Iskander
- now check the requirements on teleport not only on areatrigger use
- moved some columns from instance_template and areatrigger_teleport to access_requirement table

--HG--
branch : trunk
2009-03-05 21:02:33 +01:00