Advertisement
andriuspel

Untitled

May 18th, 2011
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.10 KB | None | 0 0
  1. Index: src/arcemu-shared/Database/DBCStores.cpp
  2. ===================================================================
  3. --- src/arcemu-shared/Database/DBCStores.cpp    (revision 4203)
  4. +++ src/arcemu-shared/Database/DBCStores.cpp    (working copy)
  5. @@ -65,6 +65,7 @@
  6.  SERVER_DECL DBCStorage<skilllinespell> dbcSkillLineSpell;
  7.  SERVER_DECL DBCStorage<skilllineentry> dbcSkillLine;
  8.  SERVER_DECL DBCStorage<SpellCastTime> dbcSpellCastTime;
  9. +SERVER_DECL DBCStorage<SpellDifficultyEntry> dbcSpellDifficultyEntry;
  10.  SERVER_DECL DBCStorage<SpellDuration> dbcSpellDuration;
  11.  SERVER_DECL DBCStorage<SpellEntry> dbcSpell;
  12.  SERVER_DECL DBCStorage<SpellRadius> dbcSpellRadius;
  13. @@ -272,7 +273,7 @@
  14.     "x" //Added in 3.1
  15.     "xxx" // unk 3.2.0, float!
  16.     "x" // unk 3.2.0
  17. -    "x"
  18. +    "i"
  19.  ;
  20.  
  21.  
  22. @@ -291,7 +292,6 @@
  23.  const char* auctionhousedbcFormat = "uuuuxxxxxxxxxxxxxxxxx";
  24.  const char* factiondbcFormat = "uiuuuuuuuuiiiiuuuuulxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  25.  
  26. -
  27.  const char* dbctaxinodeFormat = "uufffxxxxxxxxxxxxxxxxxuu";
  28.  const char* dbctaxipathFormat = "uuuu";
  29.  const char* dbctaxipathnodeFormat = "uuuufffuuxx";
  30. @@ -331,6 +331,7 @@
  31.  const char* scalingstatvaluesformat = "uuuuuuuuuuuuuuuuuuxxxxxx";
  32.  const char* itemlimitcategoryformat = "usxxxxxxxxxxxxxxxxuu";
  33.  const char* spellshapeshiftformformat = "uxxxxxxxxxxxxxxxxxxuuxuuuxxuuuuuuuu";
  34. +const char* spelldifficultyentryformat = "niiii";
  35.  const char* questxpformat = "uxuuuuuuuux";
  36.  const char* wmoareaformat = "uiiixxxxxuuxxxxxxxxxxxxxxxxx";
  37.  
  38. @@ -369,6 +370,7 @@
  39.     LOAD_DBC("DBC/Talent.dbc", talententryFormat, true, dbcTalent, false);
  40.     LOAD_DBC("DBC/TalentTab.dbc", talenttabentryFormat, true, dbcTalentTab, false);
  41.     LOAD_DBC("DBC/SpellCastTimes.dbc", spellcasttimeFormat, true, dbcSpellCastTime, false);
  42. +   LOAD_DBC("DBC/SpellDifficulty.dbc", spelldifficultyentryformat, true, dbcSpellDifficultyEntry, false);
  43.     LOAD_DBC("DBC/SpellRadius.dbc", spellradiusFormat, true, dbcSpellRadius, false);
  44.     LOAD_DBC("DBC/SpellRange.dbc", spellrangeFormat, true, dbcSpellRange, false);
  45.     LOAD_DBC("DBC/SpellRuneCost.dbc", SpellRuneCostFormat, true, dbcSpellRuneCost, false);
  46. Index: src/arcemu-shared/Database/DBCStores.h
  47. ===================================================================
  48. --- src/arcemu-shared/Database/DBCStores.h  (revision 4203)
  49. +++ src/arcemu-shared/Database/DBCStores.h  (working copy)
  50. @@ -773,7 +773,7 @@
  51.  // uint32 UnKnown;                                           //231
  52.  // uint32 UnKnown;                                           //232
  53.  // uint32 SpellDescriptionVariable;                          //233 References SpellDescriptionVariables.dbc
  54. -// uint32 SpellDifficultyID;                                 //234 References SpellDifficulty.dbc
  55. +   uint32 SpellDifficultyID;                                 //234 References SpellDifficulty.dbc
  56.  
  57.     /// CUSTOM: these fields are used for the modifications made in the world.cpp
  58.     uint32 DiminishStatus;                  //
  59. @@ -1018,6 +1018,14 @@
  60.  // uint32 unk2;
  61.  };
  62.  
  63. +#define MAP_DIFFICULTY 4
  64. +
  65. +struct SpellDifficultyEntry
  66. +{
  67. +   uint32 ID;
  68. +   uint32 SpellId[MAP_DIFFICULTY];
  69. +};
  70. +
  71.  struct SpellRadius
  72.  {
  73.     uint32 ID;
  74. @@ -1744,6 +1752,7 @@
  75.  extern SERVER_DECL DBCStorage<ItemSetEntry> dbcItemSet;
  76.  extern SERVER_DECL DBCStorage<Lock> dbcLock;
  77.  extern SERVER_DECL DBCStorage<SpellEntry> dbcSpell;
  78. +extern SERVER_DECL DBCStorage<SpellDifficultyEntry> dbcSpellDifficultyEntry;
  79.  extern SERVER_DECL DBCStorage<SpellDuration> dbcSpellDuration;
  80.  extern SERVER_DECL DBCStorage<SpellRange> dbcSpellRange;
  81.  extern SERVER_DECL DBCStorage<SpellShapeshiftForm> dbcSpellShapeshiftForm;
  82. Index: src/arcemu-world/Spell.cpp
  83. ===================================================================
  84. --- src/arcemu-world/Spell.cpp  (revision 4203)
  85. +++ src/arcemu-world/Spell.cpp  (working copy)
  86. @@ -154,8 +154,20 @@
  87.  
  88.  Spell::Spell(Object* Caster, SpellEntry *info, bool triggered, Aura* aur)
  89.  {
  90. -   Arcemu::Util::ARCEMU_ASSERT(    Caster != NULL && info != NULL );
  91. +   Arcemu::Util::ARCEMU_ASSERT( Caster != NULL && info != NULL );
  92. +   Arcemu::Util::ARCEMU_ASSERT( info==dbcSpell.LookupEntry(info->Id) && "`info` must be pointer to dbcSpell element" );
  93.  
  94. +   Instance* pInstance = NULL;
  95. +    if (info->SpellDifficultyID && Caster->GetTypeId() != TYPEID_PLAYER && Caster->IsInWorld() && IS_PERSISTENT_INSTANCE(pInstance))
  96. +    {
  97. +        if (SpellEntry *spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyID, pInstance->m_difficulty))
  98. +            m_spellInfo = spellEntry;
  99. +        else
  100. +            m_spellInfo = info;
  101. +    }
  102. +    else
  103. +        m_spellInfo = info;
  104. +
  105.     Caster->m_pendingSpells.insert(this);
  106.     m_overrideBasePoints = false;
  107.     m_overridenBasePoints[0] = 0xFFFFFFFF;
  108. Index: src/arcemu-world/SpellMgr.cpp
  109. ===================================================================
  110. --- src/arcemu-world/SpellMgr.cpp   (revision 4203)
  111. +++ src/arcemu-world/SpellMgr.cpp   (working copy)
  112. @@ -76,6 +76,22 @@
  113.     }
  114.  }
  115.  
  116. +SpellEntry* GetSpellEntryByDifficulty(uint32 id, uint32 difficulty)
  117. +{
  118. +    SpellDifficultyEntry* spellDiff = dbcSpellDifficultyEntry.LookupEntry(id);
  119. +   Instance* pInstance = NULL;
  120. +
  121. +    if (!spellDiff)
  122. +        return NULL;
  123. +
  124. +   difficulty = pInstance->m_difficulty;
  125. +    if (!spellDiff->SpellId[difficulty])
  126. +        return NULL;
  127. +
  128. +    SpellEntry* spellDifficulty = dbcSpell.LookupEntry(spellDiff->SpellId[difficulty]);
  129. +    return spellDifficulty;
  130. +}
  131. +
  132.  Spell* SpellFactoryMgr::NewSpell(Object* Caster, SpellEntry *info, bool triggered, Aura* aur)
  133.  {
  134.     if( info->SpellFactoryFunc == NULL )
  135. Index: src/arcemu-world/SpellMgr.h
  136. ===================================================================
  137. --- src/arcemu-world/SpellMgr.h (revision 4203)
  138. +++ src/arcemu-world/SpellMgr.h (working copy)
  139. @@ -38,6 +38,8 @@
  140.  typedef Spell *(*spell_factory_function)(Object* Caster, SpellEntry *info, bool triggered, Aura* aur);
  141.  typedef Aura *(*aura_factory_function)(SpellEntry *proto, int32 duration, Object* caster, Unit *target, bool temporary, Item* i_caster);
  142.  
  143. +SpellEntry* GetSpellEntryByDifficulty(uint32 id, uint32 difficulty);
  144. +
  145.  class SERVER_DECL SpellFactoryMgr: public Singleton < SpellFactoryMgr >
  146.  {
  147.  public:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement