Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch by TOM_RUS, thanks http://paste2.org/p/1025135 Signed-off-by: Konctantin <gawrilyako@gmail.com>
- Loading branch information
1 parent
8156df4
commit c0ca56c
Showing
13 changed files
with
860 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
|
||
namespace SpellWork | ||
{ | ||
class Loader | ||
{ | ||
public Loader(bool thread) | ||
public Loader() | ||
{ | ||
DBC.Spell = DBCReader.ReadDBC<SpellEntry>(DBC.SpellStrings); | ||
|
||
if (thread) | ||
new Thread(RunOther).Start(); | ||
else | ||
RunOther(); | ||
|
||
DBC.Locale = DetectedLocale; | ||
} | ||
DBC.Spell = DBCReader.ReadDBC<SpellEntry>(DBC.SpellStrings); | ||
DBC.SpellEffect = DBCReader.ReadDBC<SpellEffectEntry>(null); | ||
|
||
private void RunOther() | ||
{ | ||
DBC.SkillLine = DBCReader.ReadDBC<SkillLineEntry>(DBC.SkillLineStrings); | ||
DBC.SpellRange = DBCReader.ReadDBC<SpellRangeEntry>(DBC.SpellRangeStrings); | ||
DBC.ScreenEffect = DBCReader.ReadDBC<ScreenEffectEntry>(DBC.ScreenEffectStrings); | ||
|
||
DBC.SpellDuration = DBCReader.ReadDBC<SpellDurationEntry>(null); | ||
DBC.SkillLineAbility = DBCReader.ReadDBC<SkillLineAbilityEntry>(null); | ||
DBC.SpellRadius = DBCReader.ReadDBC<SpellRadiusEntry>(null); | ||
DBC.SpellCastTimes = DBCReader.ReadDBC<SpellCastTimesEntry>(null); | ||
// this is to speedup spelleffect lookups | ||
foreach (var value in DBC.SpellEffect) | ||
{ | ||
if (DBC.SpellEffects.ContainsKey(value.Value.EffectSpellId)) | ||
{ | ||
DBC.SpellEffects[value.Value.EffectSpellId].Add((int)value.Value.EffectIndex, value.Value); | ||
} | ||
else | ||
{ | ||
Dictionary<int, SpellEffectEntry> temp = new Dictionary<int, SpellEffectEntry>(3); | ||
DBC.SpellEffects.Add(value.Value.EffectSpellId, temp); | ||
DBC.SpellEffects[value.Value.EffectSpellId].Add((int)value.Value.EffectIndex, value.Value); | ||
} | ||
} | ||
|
||
DBC.SpellTargetRestrictions = DBCReader.ReadDBC<SpellTargetRestrictionsEntry>(null); | ||
DBC.SpellAuraRestrictions = DBCReader.ReadDBC<SpellAuraRestrictionsEntry>(null); | ||
DBC.SpellCooldowns = DBCReader.ReadDBC<SpellCooldownsEntry>(null); | ||
DBC.SpellCategories = DBCReader.ReadDBC<SpellCategoriesEntry>(null); | ||
DBC.SpellShapeshift = DBCReader.ReadDBC<SpellShapeshiftEntry>(null); | ||
DBC.SpellAuraOptions = DBCReader.ReadDBC<SpellAuraOptionsEntry>(null); | ||
DBC.SpellLevels = DBCReader.ReadDBC<SpellLevelsEntry>(null); | ||
DBC.SpellClassOptions = DBCReader.ReadDBC<SpellClassOptionsEntry>(null); | ||
DBC.SpellCastingRequirements = DBCReader.ReadDBC<SpellCastingRequirementsEntry>(null); | ||
DBC.SpellPower = DBCReader.ReadDBC<SpellPowerEntry>(null); | ||
DBC.SpellInterrupts = DBCReader.ReadDBC<SpellInterruptsEntry>(null); | ||
DBC.SpellEquippedItems = DBCReader.ReadDBC<SpellEquippedItemsEntry>(null); | ||
DBC.SpellDuration = DBCReader.ReadDBC<SpellDurationEntry>(null); | ||
DBC.SkillLineAbility = DBCReader.ReadDBC<SkillLineAbilityEntry>(null); | ||
DBC.SpellRadius = DBCReader.ReadDBC<SpellRadiusEntry>(null); | ||
DBC.SpellCastTimes = DBCReader.ReadDBC<SpellCastTimesEntry>(null); | ||
|
||
DBC.OverrideSpellData = DBCReader.ReadDBC<OverrideSpellDataEntry>(null); | ||
DBC.OverrideSpellData = DBCReader.ReadDBC<OverrideSpellDataEntry>(null); | ||
DBC.SkillLine = DBCReader.ReadDBC<SkillLineEntry>(DBC.SkillLineStrings); | ||
DBC.SpellRange = DBCReader.ReadDBC<SpellRangeEntry>(DBC.SpellRangeStrings); | ||
DBC.ScreenEffect = DBCReader.ReadDBC<ScreenEffectEntry>(DBC.ScreenEffectStrings); | ||
|
||
DBC.Locale = DetectedLocale(); | ||
} | ||
|
||
private LocalesDBC DetectedLocale | ||
private LocalesDBC DetectedLocale() | ||
{ | ||
get | ||
byte locale = 0; | ||
while (DBC.Spell[DBC.SPELL_ENTRY_FOR_DETECT_LOCALE].GetName(locale) == string.Empty) | ||
{ | ||
byte locale = 0; | ||
while (DBC.Spell[DBC.SPELL_ENTRY_FOR_DETECT_LOCALE].GetName(locale) == String.Empty) | ||
{ | ||
++locale; | ||
++locale; | ||
|
||
if (locale >= DBC.MAX_DBC_LOCALE) | ||
throw new SpellWorkException("Detected unknown locale index {0}", locale); | ||
} | ||
return (LocalesDBC)locale; | ||
if (locale >= DBC.MAX_DBC_LOCALE) | ||
throw new Exception("Detected unknown locale index " + locale); | ||
} | ||
return (LocalesDBC)locale; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.