Updated to 8.2.0.31429 (scripts disabled atm, they still need updated)

Code Port from TrinityCore https://github.com/TrinityCore/TrinityCore
Casc from WoW-Tools https://github.com/WoW-Tools/CASCExplorer
This commit is contained in:
hondacrx
2019-08-14 11:20:42 -04:00
parent e4d500f4b5
commit 125e3b3ac7
232 changed files with 12268 additions and 14670 deletions
+9 -9
View File
@@ -212,13 +212,13 @@ namespace Framework.Constants
CommandDebugBg = 304,
CommandDebugEntervehicle = 305,
CommandDebugGetitemstate = 306,
CommandDebugGetitemvalue = 307,
CommandDebugGetvalue = 308,
CommandDebugGetitemvalue = 307, // DEPRECATED: DON'T REUSE
CommandDebugGetvalue = 308, // DEPRECATED: DON'T REUSE
CommandDebugHostil = 309,
CommandDebugItemexpire = 310,
CommandDebugLootrecipient = 311,
CommandDebugLos = 312,
CommandDebugMod32value = 313,
CommandDebugMod32value = 313, // DEPRECATED: DON'T REUSE
CommandDebugMoveflags = 314,
CommandDebugPlay = 315,
CommandDebugPlayCinematic = 316,
@@ -237,13 +237,13 @@ namespace Framework.Constants
CommandDebugSendSetphaseshift = 329,
CommandDebugSendSpellfail = 330,
CommandDebugSetaurastate = 331,
CommandDebugSetbit = 332,
CommandDebugSetitemvalue = 333,
CommandDebugSetvalue = 334,
CommandDebugSetbit = 332, // DEPRECATED: DON'T REUSE
CommandDebugSetitemvalue = 333, // DEPRECATED: DON'T REUSE
CommandDebugSetvalue = 334, // DEPRECATED: DON'T REUSE
CommandDebugSetvid = 335,
CommandDebugSpawnvehicle = 336,
CommandDebugThreat = 337,
CommandDebugUpdate = 338,
CommandDebugUpdate = 338, // DEPRECATED: DON'T REUSE
CommandDebugUws = 339,
CommandWpgps = 340,
CommandDeserter = 341,
@@ -451,7 +451,7 @@ namespace Framework.Constants
CommandDemorph = 543,
CommandModify = 544,
CommandModifyArenapoints = 545,
CommandModifyBit = 546,
CommandModifyBit = 546, // DEPRECATED: DON'T REUSE
CommandModifyDrunk = 547,
CommandModifyEnergy = 548,
CommandModifyFaction = 549,
@@ -558,7 +558,7 @@ namespace Framework.Constants
CommandReloadSupportSystem = 650,
CommandReloadGossipMenu = 651,
CommandReloadGossipMenuOption = 652,
CommandReloadItemEnchantmentTemplate = 653,
CommandReloadItemRandomBonusListTemplate = 653,
CommandReloadItemLootTemplate = 654,
CommandReloadItemSetNames = 655,
CommandReloadLfgDungeonRewards = 656,
@@ -411,7 +411,7 @@ namespace Framework.Constants
ReachAccountHonorLevel = 213,
HeartOfAzerothArtifactPowerEarned = 214,
HeartOfAzerothLevelReached = 215,
TotalTypes
TotalTypes = 217
}
public enum CriteriaDataType
+14 -9
View File
@@ -110,7 +110,7 @@ namespace Framework.Constants
Unk1 = 0x01,
}
public enum NPCFlags : ulong
public enum NPCFlags : uint
{
None = 0x00,
Gossip = 0x01, // 100%
@@ -145,14 +145,19 @@ namespace Framework.Constants
VaultKeeper = 0x20000000, // Void Storage
WildBattlePet = 0x40000000, // Pet That Player Can Fight (Battle Pet)
BlackMarket = 0x80000000, // Black Market
ItemUpgradeMaster = 0x100000000,
GarrisonArchitect = 0x200000000,
Steering = 0x400000000,
ShipmentCrafter = 0x1000000000,
GarrisonMissionNpc = 0x2000000000,
TradeskillNpc = 0x4000000000,
BlackMarketView = 0x8000000000,
ContributionCollector = 0x40000000000,
}
public enum NPCFlags2
{
None = 0x00,
ItemUpgradeMaster = 0x01,
GarrisonArchitect = 0x02,
Steering = 0x04,
ShipmentCrafter = 0x10,
GarrisonMissionNpc = 0x20,
TradeskillNpc = 0x40,
BlackMarketView = 0x80,
ContributionCollector = 0x400,
}
public enum CreatureTypeFlags : uint
-1
View File
@@ -29,7 +29,6 @@ namespace Framework.Constants
public const int MaxOutfitItems = 24;
public const int MaxItemExtCostItems = 5;
public const int MaxItemExtCostCurrencies = 5;
public const int MaxItemRandomProperties = 5;
public const int MaxItemEnchantmentEffects = 3;
public const int MaxProtoSpells = 5;
public const int MaxEquipmentSetIndex = 20;
@@ -21,8 +21,8 @@ namespace Framework.Constants
public enum SessionStatus
{
Authed = 0, // Player authenticated (_player == NULL, m_playerRecentlyLogout = false or will be reset before handler call, m_GUID have garbage)
Loggedin, // Player in game (_player != NULL, m_GUID == _player->GetGUID(), inWorld())
Transfer, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld())
Loggedin, // Player in game (_player != NULL, m_GUID == _player.GetGUID(), inWorld())
Transfer, // Player transferring to another map (_player != NULL, m_GUID == _player.GetGUID(), !inWorld())
LoggedinOrRecentlyLogout, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid)
}
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -32,7 +32,8 @@ namespace Framework.Constants
Corpse = 10,
AreaTrigger = 11,
SceneObject = 12,
Conversation = 13
Conversation = 13,
Max = 14
}
public enum TypeMask
+4 -45
View File
@@ -30,14 +30,11 @@ namespace Framework.Constants
public const int MaxMasterySpells = 2;
public const int ReqPrimaryTreeTalents = 31;
public const int ExploredZonesSize = 320;
public const int ExploredZonesSize = 192;
public const ulong MaxMoneyAmount = 99999999999UL;
public const int MaxActionButtons = 132;
public const int MaxActionButtonActionValue = 0x00FFFFFF + 1;
public const uint KnowTitlesSize = 6;
public const uint MaxTitleIndex = KnowTitlesSize * 64;
public const int MaxDailyQuests = 25;
public const int QuestsCompletedBitsSize = 1750;
@@ -45,7 +42,7 @@ namespace Framework.Constants
public const uint infinityCooldownDelayCheck = Time.Month / 2;
public const int MaxPlayerSummonDelay = 2 * Time.Minute;
public const int TaxiMaskSize = 286;
public const int TaxiMaskSize = 311;
// corpse reclaim times
public const int DeathExpireStep = (5 * Time.Minute);
@@ -76,45 +73,6 @@ namespace Framework.Constants
public const int Gold = Silver * 100;
}
public struct PlayerFieldOffsets
{
public const byte BytesOffsetSkinId = 0;
public const byte BytesOffsetFaceId = 1;
public const byte BytesOffsetHairStyleId = 2;
public const byte BytesOffsetHairColorId = 3;
public const byte Bytes2OffsetCustomDisplayOption = 0; // 3 Bytes
public const byte Bytes2OffsetFacialStyle = 3;
public const byte Bytes3OffsetPartyType = 0;
public const byte Bytes3OffsetBankBagSlots = 1;
public const byte Bytes3OffsetGender = 2;
public const byte Bytes3OffsetInebriation = 3;
public const byte Bytes4OffsetPvpTitle = 0;
public const byte Bytes4OffsetArenaFaction = 1;
public const byte FieldBytesOffsetRafGrantableLevel = 0;
public const byte FieldBytesOffsetActionBarToggles = 1;
public const byte FieldBytesOffsetLifetimeMaxPvpRank = 2;
public const byte FieldBytesOffsetNumRespecs = 3;
public const byte FieldBytes2OffsetIgnorePowerRegenPredictionMask = 0;
public const byte FieldBytes2OffsetAuraVision = 1;
public const byte FieldBytes2OffsetNumBackpackSlots = 2;
public const byte FieldBytes3OffsetOverrideSpellsId = 2; // Uint16!
public const byte FieldBytes3OffsetOverrideSpellsIdUint16Offset = FieldBytes3OffsetOverrideSpellsId / 2;
public const byte FieldKillsOffsetTodayKills = 0;
public const byte FieldKillsOffsetYesterdayKills = 1;
public const byte RestStateXp = 0;
public const byte RestRestedXp = 1;
public const byte RestStateHonor = 2;
public const byte RestRestedHonor = 3;
}
public enum TradeSlots
{
Invalid = -1,
@@ -737,7 +695,8 @@ namespace Framework.Constants
None = 0x00,
BonusLevel90 = 0x01,
BonusLevel100 = 0x02,
BonusLevel110 = 0x04
BonusLevel110 = 0x04,
BonusLevel120 = 0x08
}
public enum HeirloomItemFlags
File diff suppressed because it is too large Load Diff
@@ -709,7 +709,8 @@ namespace Framework.Constants
WrongFaction = 292,
NotEnoughCurrency = 293,
BattleForAzerothRidingRequirement = 294,
Unknown = 295,
MountEquipmentError = 295,
Unknown = 296,
// Ok Cast Value - Here In Case A Future Version Removes Success And We Need To Use A Custom Value (Not Sent To Client Either Way)
SpellCastOk = Success
@@ -1711,7 +1712,7 @@ namespace Framework.Constants
Unk4 = 0x10, // 4
AbsorbEnvironmentalDamage = 0x20, // 5
Unk6 = 0x40, // 6
RankIgnoresCasterLevel = 0x80, // 7 Spell_C_GetSpellRank returns SpellLevels->MaxLevel * 5 instead of std::min(SpellLevels->MaxLevel, caster->Level) * 5
RankIgnoresCasterLevel = 0x80, // 7 Spell_C_GetSpellRank returns SpellLevels.MaxLevel * 5 instead of std::min(SpellLevels.MaxLevel, caster.Level) * 5
Unk8 = 0x100, // 8
Unk9 = 0x200, // 9
Unk10 = 0x400, // 10
@@ -2090,7 +2091,17 @@ namespace Framework.Constants
RespecAzeriteEmpoweredItem = 259,
SummonStabledPet = 260,
ScrapItem = 261,
TotalSpellEffects,
Unk262 = 262,
RepairItem = 263,
RemoveGem = 264,
LearnAzeriteEssencePower = 265,
Unk266 = 266,
Unk267 = 267,
ApplyMountEquipment = 268,
UpgradeItem = 269,
Unk270 = 270,
ApplyAreaAuraPartyNonrandom = 271,
TotalSpellEffects
}
public enum SpellEffectHandle
+8 -29
View File
@@ -242,7 +242,7 @@ namespace Framework.Constants
/// <summary>
/// UnitStandStateType
/// </summary>
public enum UnitStandStateType
public enum UnitStandStateType : byte
{
Stand = 0,
Sit = 1,
@@ -256,23 +256,7 @@ namespace Framework.Constants
Submerged = 9
}
public struct UnitBytes0Offsets
{
public const byte Race = 0;
public const byte Class = 1;
public const byte PlayerClass = 2;
public const byte Gender = 3;
}
public struct UnitBytes1Offsets
{
public const byte StandState = 0;
public const byte PetTalents = 1; // unused
public const byte VisFlag = 2;
public const byte AnimTier = 3;
}
public enum UnitStandFlags
public enum UnitVisFlags
{
Unk1 = 0x01,
Creep = 0x02,
@@ -284,22 +268,16 @@ namespace Framework.Constants
public enum UnitBytes1Flags
{
None = 0x00,
AlwaysStand = 0x01,
Hover = 0x02,
Unk3 = 0x04,
All = 0xFF
}
public struct UnitBytes2Offsets
{
public const byte SheathState = 0;
public const byte PvpFlag = 1;
public const byte PetFlags = 2;
public const byte ShapeshiftForm = 3;
}
public enum UnitBytes2Flags
public enum UnitPVPStateFlags
{
None = 0x00,
PvP = 0x01,
Unk1 = 0x02,
FFAPvp = 0x04,
@@ -310,8 +288,9 @@ namespace Framework.Constants
Unk7 = 0x80,
}
public enum UnitPetFlags
{
public enum UnitPetFlags : byte
{
None = 0x00,
CanBeRenamed = 0x01,
CanBeAbandoned = 0x02
}
File diff suppressed because it is too large Load Diff
@@ -1,455 +0,0 @@
/*
* Copyright (C) 2012-2019 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Framework.Constants
{
public enum ObjectFields
{
Guid = 0x000, // Size: 4, Flags: Public
Entry = 0x004, // Size: 1, Flags: Dynamic
DynamicFlags = 0x005, // Size: 1, Flags: Dynamic, Urgent
ScaleX = 0x006, // Size: 1, Flags: Public
End = 0x007,
}
public enum ItemFields
{
Owner = ObjectFields.End + 0x000, // Size: 4, Flags: Public
Contained = ObjectFields.End + 0x004, // Size: 4, Flags: Public
Creator = ObjectFields.End + 0x008, // Size: 4, Flags: Public
GiftCreator = ObjectFields.End + 0x00c, // Size: 4, Flags: Public
StackCount = ObjectFields.End + 0x010, // Size: 1, Flags: Owner
Duration = ObjectFields.End + 0x011, // Size: 1, Flags: Owner
SpellCharges = ObjectFields.End + 0x012, // Size: 5, Flags: Owner
Flags = ObjectFields.End + 0x017, // Size: 1, Flags: Public
Enchantment = ObjectFields.End + 0x018, // Size: 39, Flags: Public
PropertySeed = ObjectFields.End + 0x03f, // Size: 1, Flags: Public
RandomPropertiesId = ObjectFields.End + 0x040, // Size: 1, Flags: Public
Durability = ObjectFields.End + 0x041, // Size: 1, Flags: Owner
MaxDurability = ObjectFields.End + 0x042, // Size: 1, Flags: Owner
CreatePlayedTime = ObjectFields.End + 0x043, // Size: 1, Flags: Public
ModifiersMask = ObjectFields.End + 0x044, // Size: 1, Flags: Owner
Context = ObjectFields.End + 0x045, // Size: 1, Flags: Public
ArtifactXp = ObjectFields.End + 0x046, // Size: 2, Flags: OWNER
AppearanceModId = ObjectFields.End + 0x048, // Size: 1, Flags: OWNER
End = ObjectFields.End + 0x049
}
public enum ItemDynamicFields
{
Modifiers = 0x000, // Flags: Owner
BonusListIds = 0x001, // Flags: Owner, 0x100
ArtifactPowers = 0x002, // Flags: OWNER
Gems = 0x003, // Flags: OWNER
End = 0x004
}
public enum ContainerFields
{
Slot1 = ItemFields.End + 0x000, // Size: 144, Flags: Public
NumSlots = ItemFields.End + 0x090, // Size: 1, Flags: Public
End = ItemFields.End + 0x091
}
public enum AzeriteEmpoweredItemFields
{
Selections = ItemFields.End + 0x000, // Size: 4, Flags: PUBLIC
End = ItemFields.End + 0x004,
}
public enum AzeriteEmpoweredItemDynamicFields
{
End = ItemDynamicFields.End + 0x000,
}
public enum AzeriteItemFields
{
Xp = ItemFields.End + 0x000, // Size: 2, Flags: PUBLIC
Level = ItemFields.End + 0x002, // Size: 1, Flags: PUBLIC
AuraLevel = ItemFields.End + 0x003, // Size: 1, Flags: PUBLIC
KnowledgeLevel = ItemFields.End + 0x004, // Size: 1, Flags: OWNER
DebugKnowledgeWeek = ItemFields.End + 0x005, // Size: 1, Flags: OWNER
End = ItemFields.End + 0x006,
}
public enum AzeriteItemDynamicFields
{
End = ItemDynamicFields.End + 0x000,
}
public enum UnitFields
{
Charm = ObjectFields.End + 0x000, // Size: 4, Flags: Public
Summon = ObjectFields.End + 0x004, // Size: 4, Flags: Public
Critter = ObjectFields.End + 0x008, // Size: 4, Flags: Privaten
CharmedBy = ObjectFields.End + 0x00c, // Size: 4, Flags: Public
SummonedBy = ObjectFields.End + 0x010, // Size: 4, Flags: Public
CreatedBy = ObjectFields.End + 0x014, // Size: 4, Flags: Public
DemonCreator = ObjectFields.End + 0x018, // Size: 4, Flags: Public
LookAtControllerTarget = ObjectFields.End + 0x01c, // Size: 4, Flags: Public
Target = ObjectFields.End + 0x020, // Size: 4, Flags: Public
BattlePetCompanionGuid = ObjectFields.End + 0x024, // Size: 4, Flags: Public
BattlePetDbId = ObjectFields.End + 0x028, // Size: 2, Flags: Public
ChannelData = ObjectFields.End + 0x02a, // Size: 2, Flags: Public, Urgent
SummonedByHomeRealm = ObjectFields.End + 0x02c, // Size: 1, Flags: Public
Bytes0 = ObjectFields.End + 0x02d, // Size: 1, Flags: Public
DisplayPower = ObjectFields.End + 0x02e, // Size: 1, Flags: Public
OverrideDisplayPowerId = ObjectFields.End + 0x02f, // Size: 1, Flags: Public
Health = ObjectFields.End + 0x030, // Size: 2, Flags: Public
Power = ObjectFields.End + 0x032, // Size: 6, Flags: Public, UrgentSelfOnly
MaxHealth = ObjectFields.End + 0x038, // Size: 2, Flags: Public
MaxPower = ObjectFields.End + 0x03a, // Size: 6, Flags: Public
PowerRegenFlatModifier = ObjectFields.End + 0x040, // Size: 6, Flags: Private, Owner, UnitAll
PowerRegenInterruptedFlatModifier = ObjectFields.End + 0x046, // Size: 6, Flags: Private, Owner, UnitAll
Level = ObjectFields.End + 0x04c, // Size: 1, Flags: Public
EffectiveLevel = ObjectFields.End + 0x04d, // Size: 1, Flags: Public
ContentTuningId = ObjectFields.End + 0x04e, // Size: 1, Flags: Public
ScalingLevelMin = ObjectFields.End + 0x04f, // Size: 1, Flags: Public
ScalingLevelMax = ObjectFields.End + 0x050, // Size: 1, Flags: Public
ScalingLevelDelta = ObjectFields.End + 0x051, // Size: 1, Flags: Public
ScalingFactionGroup = ObjectFields.End + 0x052, // Size: 1, Flags: Public
ScalingHealthItemLevelCurveId = ObjectFields.End + 0x053, // Size: 1, Flags: Public
ScalingDamageItemLevelCurveId = ObjectFields.End + 0x054, // Size: 1, Flags: Public
FactionTemplate = ObjectFields.End + 0x055, // Size: 1, Flags: Public
VirtualItemSlotId = ObjectFields.End + 0x056, // Size: 6, Flags: Public
Flags = ObjectFields.End + 0x05c, // Size: 1, Flags: Public, Urgent
Flags2 = ObjectFields.End + 0x05d, // Size: 1, Flags: Public, Urgent
Flags3 = ObjectFields.End + 0x05e, // Size: 1, Flags: Public, UrgentScalingLevelDelta
AuraState = ObjectFields.End + 0x05f, // Size: 1, Flags: Public
BaseAttackTime = ObjectFields.End + 0x060, // Size: 2, Flags: Public
RangedAttackTime = ObjectFields.End + 0x062, // Size: 1, Flags: Private
BoundingRadius = ObjectFields.End + 0x063, // Size: 1, Flags: Public
CombatReach = ObjectFields.End + 0x064, // Size: 1, Flags: Public
DisplayId = ObjectFields.End + 0x065, // Size: 1, Flags: Dynamic, Urgent
DisplayScale = ObjectFields.End + 0x066, // Size: 1, Flags: Dynamic, Urgent
NativeDisplayId = ObjectFields.End + 0x067, // Size: 1, Flags: Public, Urgent
NativeXDisplayScale = ObjectFields.End + 0x068, // Size: 1, Flags: Public, Urgent
MountDisplayId = ObjectFields.End + 0x069, // Size: 1, Flags: Public, Urgent
MinDamage = ObjectFields.End + 0x06a, // Size: 1, Flags: Private, Owner, SpecialInfo
MaxDamage = ObjectFields.End + 0x06b, // Size: 1, Flags: Private, Owner, SpecialInfo
MinOffHandDamage = ObjectFields.End + 0x06c, // Size: 1, Flags: Private, Owner, SpecialInfo
MaxOffHandDamage = ObjectFields.End + 0x06d, // Size: 1, Flags: Private, Owner, SpecialInfo
Bytes1 = ObjectFields.End + 0x06e, // Size: 1, Flags: Public
PetNumber = ObjectFields.End + 0x06f, // Size: 1, Flags: Public
PetNameTimestamp = ObjectFields.End + 0x070, // Size: 1, Flags: Public
PetExperience = ObjectFields.End + 0x071, // Size: 1, Flags: Owner
PetNextLevelExp = ObjectFields.End + 0x072, // Size: 1, Flags: Owner
ModCastSpeed = ObjectFields.End + 0x073, // Size: 1, Flags: Public
ModCastHaste = ObjectFields.End + 0x074, // Size: 1, Flags: Public
ModHaste = ObjectFields.End + 0x075, // Size: 1, Flags: Public
ModRangedHaste = ObjectFields.End + 0x076, // Size: 1, Flags: Public
ModHasteRegen = ObjectFields.End + 0x077, // Size: 1, Flags: Public
ModTimeRate = ObjectFields.End + 0x078, // Size: 1, Flags: Public
CreatedBySpell = ObjectFields.End + 0x079, // Size: 1, Flags: Public
NpcFlags = ObjectFields.End + 0x07a, // Size: 2, Flags: Public, Dynamic
NpcEmotestate = ObjectFields.End + 0x07c, // Size: 1, Flags: Public
Stat = ObjectFields.End + 0x07d, // Size: 4, Flags: Private, Owner
PosStat = ObjectFields.End + 0x081, // Size: 4, Flags: Private, Owner
NegStat = ObjectFields.End + 0x085, // Size: 4, Flags: Private, Owner
Resistances = ObjectFields.End + 0x089, // Size: 7, Flags: Private, Owner, SpecialInfo
BonusResistanceMods = ObjectFields.End + 0x090, // Size: 7, Flags: Private, Owner
BaseMana = ObjectFields.End + 0x097, // Size: 1, Flags: Public
BaseHealth = ObjectFields.End + 0x098, // Size: 1, Flags: Private, Owner
Bytes2 = ObjectFields.End + 0x099, // Size: 1, Flags: Public
AttackPower = ObjectFields.End + 0x09a, // Size: 1, Flags: Private, Owner
AttackPowerModPos = ObjectFields.End + 0x09b, // Size: 1, Flags: Private, Owner
AttackPowerModNeg = ObjectFields.End + 0x09c, // Size: 1, Flags: Private, Owner
AttackPowerMultiplier = ObjectFields.End + 0x09d, // Size: 1, Flags: Private, Owner
RangedAttackPower = ObjectFields.End + 0x09e, // Size: 1, Flags: Private, Owner
RangedAttackPowerModPos = ObjectFields.End + 0x09f, // Size: 1, Flags: Private, Owner
RangedAttackPowerModNeg = ObjectFields.End + 0x0a0, // Size: 1, Flags: Private, Owner
RangedAttackPowerMultiplier = ObjectFields.End + 0x0a1, // Size: 1, Flags: Private, Owner
MainHandWeaponAttackPower = ObjectFields.End + 0x0a2, // Size: 1, Flags: Private, Owner
OffHandWeaponAttackPower = ObjectFields.End + 0x0a3, // Size: 1, Flags: Private, Owner
RangedHandWeaponAttackPower = ObjectFields.End + 0x0a4, // Size: 1, Flags: Private, Owner
AttackSpeedAura = ObjectFields.End + 0x0a5, // Size: 1, Flags: Private, Owner
Lifesteal = ObjectFields.End + 0x0a6, // Size: 1, Flags: Private, Owner
MinRangedDamage = ObjectFields.End + 0x0a7, // Size: 1, Flags: Private, Owner
MaxRangedDamage = ObjectFields.End + 0x0a8, // Size: 1, Flags: Private, Owner
PowerCostModifier = ObjectFields.End + 0x0a9, // Size: 7, Flags: Private, Owner
PowerCostMultiplier = ObjectFields.End + 0x0b0, // Size: 7, Flags: Private, Owner
MaxHealthModifier = ObjectFields.End + 0x0b7, // Size: 1, Flags: Private, Owner
HoverHeight = ObjectFields.End + 0x0b8, // Size: 1, Flags: Public
MinItemLevelCutoff = ObjectFields.End + 0x0b9, // Size: 1, Flags: Public
MinItemLevel = ObjectFields.End + 0x0ba, // Size: 1, Flags: Public
MaxItemlevel = ObjectFields.End + 0x0bb, // Size: 1, Flags: Public
WildBattlepetLevel = ObjectFields.End + 0x0bc, // Size: 1, Flags: Public
BattlepetCompanionNameTimestamp = ObjectFields.End + 0x0bd, // Size: 1, Flags: Public
InteractSpellid = ObjectFields.End + 0x0be, // Size: 1, Flags: Public
StateSpellVisualId = ObjectFields.End + 0x0bf, // Size: 1, Flags: Dynamic, Urgent
StateAnimId = ObjectFields.End + 0x0c0, // Size: 1, Flags: Dynamic, Urgent
StateAnimKitId = ObjectFields.End + 0x0c1, // Size: 1, Flags: Dynamic, Urgent
StateWorldEffectId = ObjectFields.End + 0x0c2, // Size: 4, Flags: Dynamic, Urgent
ScaleDuration = ObjectFields.End + 0x0c6, // Size: 1, Flags: Public
LooksLikeMountId = ObjectFields.End + 0x0c7, // Size: 1, Flags: Public
LooksLikeCreatureId = ObjectFields.End + 0x0c8, // Size: 1, Flags: Public
LookAtControllerId = ObjectFields.End + 0x0c9, // Size: 1, Flags: Public
GuildGuid = ObjectFields.End + 0x0ca, // Size: 4, Flags: Public
End = ObjectFields.End + 0x0ce
}
public enum UnitDynamicFields
{
PassiveSpells = 0x000, // Flags: Public, Urgent
WorldEffects = 0x001, // Flags: Public, Urgent
ChannelObjects = 0x002, // Flags: PUBLIC, URGENT
End = 0x003
}
public enum PlayerFields
{
DuelArbiter = UnitFields.End + 0x000, // Size: 4, Flags: Public
WowAccount = UnitFields.End + 0x004, // Size: 4, Flags: Public
LootTargetGuid = UnitFields.End + 0x008, // Size: 4, Flags: Public
Flags = UnitFields.End + 0x00c, // Size: 1, Flags: Public
FlagsEx = UnitFields.End + 0x00d, // Size: 1, Flags: Public
GuildRank = UnitFields.End + 0x00e, // Size: 1, Flags: Public
GuildDeleteDate = UnitFields.End + 0x00f, // Size: 1, Flags: Public
GuildLevel = UnitFields.End + 0x010, // Size: 1, Flags: Public
Bytes = UnitFields.End + 0x011, // Size: 1, Flags: Public
Bytes2 = UnitFields.End + 0x012, // Size: 1, Flags: Public
Bytes3 = UnitFields.End + 0x013, // Size: 1, Flags: Public
Bytes4 = UnitFields.End + 0x014, // Size: 1, Flags: Public
DuelTeam = UnitFields.End + 0x015, // Size: 1, Flags: Public
GuildTimestamp = UnitFields.End + 0x016, // Size: 1, Flags: Public
QuestLog = UnitFields.End + 0x017, // Size: 1600, Flags: PartyMember
VisibleItem = UnitFields.End + 0x657, // Size: 38, Flags: Public
ChosenTitle = UnitFields.End + 0x67d, // Size: 1, Flags: Public
FakeInebriation = UnitFields.End + 0x67e, // Size: 1, Flags: Public
VirtualRealm = UnitFields.End + 0x67f, // Size: 1, Flags: Public
CurrentSpecId = UnitFields.End + 0x680, // Size: 1, Flags: Public
TaxiMountAnimKitId = UnitFields.End + 0x681, // Size: 1, Flags: Public
AvgItemLevel = UnitFields.End + 0x682, // Size: 4, Flags: Public
CurrentBattlePetBreedQuality = UnitFields.End + 0x686, // Size: 1, Flags: Public
HonorLevel = UnitFields.End + 0x687, // Size: 1, Flags: Public
End = UnitFields.End + 0x688
}
public enum PlayerDynamicFields
{
ArenaCooldowns = UnitDynamicFields.End + 0x000, // Flags: Public
End = UnitDynamicFields.End + 0x001,
}
public enum ActivePlayerFields
{
InvSlotHead = PlayerFields.End + 0x000, // Size: 780, Flags: Public
Farsight = PlayerFields.End + 0x30c, // Size: 4, Flags: Public
SummonedBattlePetId = PlayerFields.End + 0x310, // Size: 4, Flags: Public
KnownTitles = PlayerFields.End + 0x314, // Size: 12, Flags: Public
Coinage = PlayerFields.End + 0x320, // Size: 2, Flags: Public
Xp = PlayerFields.End + 0x322, // Size: 1, Flags: Public
NextLevelXp = PlayerFields.End + 0x323, // Size: 1, Flags: Public
TrialXp = PlayerFields.End + 0x324, // Size: 1, Flags: Public
SkillLineId = PlayerFields.End + 0x325, // Size: 128, Flags: Public
SkillLineStep = PlayerFields.End + 0x3a5, // Size: 128, Flags: Public
SkillLineRank = PlayerFields.End + 0x425, // Size: 128, Flags: Public
SkillLineStartRank = PlayerFields.End + 0x4a5, // Size: 128, Flags: Public
SkillLineMaxRank = PlayerFields.End + 0x525, // Size: 128, Flags: Public
SkillLineTempBonus = PlayerFields.End + 0x5a5, // Size: 128, Flags: Public
SkillLinePermBonus = PlayerFields.End + 0x625, // Size: 128, Flags: Public
CharacterPoints = PlayerFields.End + 0x6a5, // Size: 1, Flags: Public
MaxTalentTiers = PlayerFields.End + 0x6a6, // Size: 1, Flags: Public
TrackCreatures = PlayerFields.End + 0x6a7, // Size: 1, Flags: Public
TrackResources = PlayerFields.End + 0x6a8, // Size: 2, Flags: Public
Expertise = PlayerFields.End + 0x6aa, // Size: 1, Flags: Public
OffhandExpertise = PlayerFields.End + 0x6ab, // Size: 1, Flags: Public
RangedExpertise = PlayerFields.End + 0x6ac, // Size: 1, Flags: Public
CombatRatingExpertise = PlayerFields.End + 0x6ad, // Size: 1, Flags: Public
BlockPercentage = PlayerFields.End + 0x6ae, // Size: 1, Flags: Public
DodgePercentage = PlayerFields.End + 0x6af, // Size: 1, Flags: Public
DodgePercentageFromAttribute = PlayerFields.End + 0x6b0, // Size: 1, Flags: Public
ParryPercentage = PlayerFields.End + 0x6b1, // Size: 1, Flags: Public
ParryPercentageFromAttribute = PlayerFields.End + 0x6b2, // Size: 1, Flags: Public
CritPercentage = PlayerFields.End + 0x6b3, // Size: 1, Flags: Public
RangedCritPercentage = PlayerFields.End + 0x6b4, // Size: 1, Flags: Public
OffhandCritPercentage = PlayerFields.End + 0x6b5, // Size: 1, Flags: Public
SpellCritPercentage1 = PlayerFields.End + 0x6b6, // Size: 1, Flags: Public
ShieldBlock = PlayerFields.End + 0x6b7, // Size: 1, Flags: Public
ShieldBlockCritPercentage = PlayerFields.End + 0x6b8, // Size: 1, Flags: Public
Mastery = PlayerFields.End + 0x6b9, // Size: 1, Flags: Public
Speed = PlayerFields.End + 0x6ba, // Size: 1, Flags: Public
Avoidance = PlayerFields.End + 0x6bb, // Size: 1, Flags: Public
Sturdiness = PlayerFields.End + 0x6bc, // Size: 1, Flags: Public
Versatility = PlayerFields.End + 0x6bd, // Size: 1, Flags: Public
VersatilityBonus = PlayerFields.End + 0x6be, // Size: 1, Flags: Public
PvpPowerDamage = PlayerFields.End + 0x6bf, // Size: 1, Flags: Public
PvpPowerHealing = PlayerFields.End + 0x6c0, // Size: 1, Flags: Public
ExploredZones = PlayerFields.End + 0x6c1, // Size: 320, Flags: Public
RestInfo = PlayerFields.End + 0x801, // Size: 4, Flags: Public
ModDamageDonePos = PlayerFields.End + 0x805, // Size: 7, Flags: Public
ModDamageDoneNeg = PlayerFields.End + 0x80c, // Size: 7, Flags: Public
ModDamageDonePct = PlayerFields.End + 0x813, // Size: 7, Flags: Public
ModHealingDonePos = PlayerFields.End + 0x81a, // Size: 1, Flags: Public
ModHealingPct = PlayerFields.End + 0x81b, // Size: 1, Flags: Public
ModHealingDonePct = PlayerFields.End + 0x81c, // Size: 1, Flags: Public
ModPeriodicHealingDonePercent = PlayerFields.End + 0x81d, // Size: 1, Flags: Public
WeaponDmgMultipliers = PlayerFields.End + 0x81e, // Size: 3, Flags: Public
WeaponAtkSpeedMultipliers = PlayerFields.End + 0x821, // Size: 3, Flags: Public
ModSpellPowerPct = PlayerFields.End + 0x824, // Size: 1, Flags: Public
ModResiliencePercent = PlayerFields.End + 0x825, // Size: 1, Flags: Public
OverrideSpellPowerByApPct = PlayerFields.End + 0x826, // Size: 1, Flags: Public
OverrideApBySpellPowerPercent = PlayerFields.End + 0x827, // Size: 1, Flags: Public
ModTargetResistance = PlayerFields.End + 0x828, // Size: 1, Flags: Public
ModTargetPhysicalResistance = PlayerFields.End + 0x829, // Size: 1, Flags: Public
LocalFlags = PlayerFields.End + 0x82a, // Size: 1, Flags: Public
Bytes = PlayerFields.End + 0x82b, // Size: 1, Flags: Public
PvpMedals = PlayerFields.End + 0x82c, // Size: 1, Flags: Public
BuyBackPrice = PlayerFields.End + 0x82d, // Size: 12, Flags: Public
BuyBackTimestamp = PlayerFields.End + 0x839, // Size: 12, Flags: Public
Kills = PlayerFields.End + 0x845, // Size: 1, Flags: Public
LifetimeHonorableKills = PlayerFields.End + 0x846, // Size: 1, Flags: Public
WatchedFactionIndex = PlayerFields.End + 0x847, // Size: 1, Flags: Public
CombatRating = PlayerFields.End + 0x848, // Size: 32, Flags: Public
ArenaTeamInfo = PlayerFields.End + 0x868, // Size: 54, Flags: Public
MaxLevel = PlayerFields.End + 0x89e, // Size: 1, Flags: Public
ScalingPlayerLevelDelta = PlayerFields.End + 0x89f, // Size: 1, Flags: Public
MaxCreatureScalingLevel = PlayerFields.End + 0x8a0, // Size: 1, Flags: Public
NoReagentCost = PlayerFields.End + 0x8a1, // Size: 4, Flags: Public
PetSpellPower = PlayerFields.End + 0x8a5, // Size: 1, Flags: Public
ProfessionSkillLine = PlayerFields.End + 0x8a6, // Size: 2, Flags: Public
UiHitModifier = PlayerFields.End + 0x8a8, // Size: 1, Flags: Public
UiSpellHitModifier = PlayerFields.End + 0x8a9, // Size: 1, Flags: Public
HomeRealmTimeOffset = PlayerFields.End + 0x8aa, // Size: 1, Flags: Public
ModPetHaste = PlayerFields.End + 0x8ab, // Size: 1, Flags: Public
Bytes2 = PlayerFields.End + 0x8ac, // Size: 1, Flags: Public
Bytes3 = PlayerFields.End + 0x8ad, // Size: 1, Flags: Public, UrgentSelfOnly
LfgBonusFactionId = PlayerFields.End + 0x8ae, // Size: 1, Flags: Public
LootSpecId = PlayerFields.End + 0x8af, // Size: 1, Flags: Public
OverrideZonePvpType = PlayerFields.End + 0x8b0, // Size: 1, Flags: Public, UrgentSelfOnly
BagSlotFlags = PlayerFields.End + 0x8b1, // Size: 4, Flags: Public
BankBagSlotFlags = PlayerFields.End + 0x8b5, // Size: 7, Flags: Public
InsertItemsLeftToRight = PlayerFields.End + 0x8bc, // Size: 1, Flags: Public
QuestCompleted = PlayerFields.End + 0x8bd, // Size: 1750, Flags: Public
Honor = PlayerFields.End + 0xf93, // Size: 1, Flags: Public
HonorNextLevel = PlayerFields.End + 0xf94, // Size: 1, Flags: Public
PvpTierMaxFromWins = PlayerFields.End + 0xf95, // Size: 1, Flags: Public
PvpLastWeeksTierMaxFromWins = PlayerFields.End + 0xf96, // Size: 1, Flags: Public
End = PlayerFields.End + 0xf97,
}
public enum ActivePlayerDynamicFields
{
ReserachSite = PlayerDynamicFields.End + 0x000, // Flags: Public
ResearchSiteProgress = PlayerDynamicFields.End + 0x001, // Flags: Public
DailyQuests = PlayerDynamicFields.End + 0x002, // Flags: Public
AvailableQuestLineXQuestId = PlayerDynamicFields.End + 0x003, // Flags: Public
Heirlooms = PlayerDynamicFields.End + 0x005, // Flags: Public
HeirloomFlags = PlayerDynamicFields.End + 0x006, // Flags: Public
Toys = PlayerDynamicFields.End + 0x007, // Flags: Public
Transmog = PlayerDynamicFields.End + 0x008, // Flags: Public
ConditionalTransmog = PlayerDynamicFields.End + 0x009, // Flags: Public
SelfResSpells = PlayerDynamicFields.End + 0x00a, // Flags: Public
CharacterRestrictions = PlayerDynamicFields.End + 0x00b, // Flags: Public
SpellPctModByLabel = PlayerDynamicFields.End + 0x00c, // Flags: Public
SpellFlatModByLabel = PlayerDynamicFields.End + 0x00d, // Flags: Public
Reserach = PlayerDynamicFields.End + 0x00e, // Flags: Public
End = PlayerDynamicFields.End + 0x00f,
}
public enum GameObjectFields
{
CreatedBy = ObjectFields.End + 0x000, // Size: 4, Flags: Public
GuildGuid = ObjectFields.End + 0x004, // Size: 4, Flags: Public
DisplayId = ObjectFields.End + 0x008, // Size: 1, Flags: Dynamic, Urgent
Flags = ObjectFields.End + 0x009, // Size: 1, Flags: Public, Urgent
ParentRotation = ObjectFields.End + 0x00a, // Size: 4, Flags: Public
Faction = ObjectFields.End + 0x00e, // Size: 1, Flags: Public
Level = ObjectFields.End + 0x00f, // Size: 1, Flags: Public
Bytes1 = ObjectFields.End + 0x010, // Size: 1, Flags: Public, Urgent
SpellVisualId = ObjectFields.End + 0x011, // Size: 1, Flags: Public, Dynamic, Urgent
StateSpellVisualId = ObjectFields.End + 0x012, // Size: 1, Flags: Dynamic, Urgent
StateAnimId = ObjectFields.End + 0x013, // Size: 1, Flags: Dynamic, Urgent
StateAnimKitId = ObjectFields.End + 0x014, // Size: 1, Flags: Dynamic, Urgent
StateWorldEffectId = ObjectFields.End + 0x015, // Size: 4, Flags: Dynamic, Urgent
CustomParam = ObjectFields.End + 0x019, // Size: 1, Flags: Public, Urgent
End = ObjectFields.End + 0x01a,
}
public enum GameObjectDynamicFields
{
EnableDoodadSets = 0x000, // Flags: PUBLIC
End = 0x001
}
public enum DynamicObjectFields
{
Caster = ObjectFields.End + 0x000, // Size: 4, Flags: Public
Type = ObjectFields.End + 0x004, // Size: 1, Flags: Public
SpellXSpellVisualId = ObjectFields.End + 0x005, // Size: 1, Flags: Public
SpellId = ObjectFields.End + 0x006, // Size: 1, Flags: Public
Radius = ObjectFields.End + 0x007, // Size: 1, Flags: Public
CastTime = ObjectFields.End + 0x008, // Size: 1, Flags: Public
End = ObjectFields.End + 0x009
}
public enum CorpseFields
{
Owner = ObjectFields.End + 0x000, // Size: 4, Flags: Public
Party = ObjectFields.End + 0x004, // Size: 4, Flags: Public
GuildGuid = ObjectFields.End + 0x008, // Size: 4, Flags: PUBLIC
DisplayId = ObjectFields.End + 0x00C, // Size: 1, Flags: Public
Item = ObjectFields.End + 0x00D, // Size: 19, Flags: Public
Bytes1 = ObjectFields.End + 0x020, // Size: 1, Flags: Public
Bytes2 = ObjectFields.End + 0x021, // Size: 1, Flags: Public
Flags = ObjectFields.End + 0x022, // Size: 1, Flags: Public
DynamicFlags = ObjectFields.End + 0x023, // Size: 1, Flags: Dynamic
FactionTemplate = ObjectFields.End + 0x024, // Size: 1, Flags: Public
CustomDisplayOption = ObjectFields.End + 0x025, // Size: 1, Flags: PUBLIC
End = ObjectFields.End + 0x026
}
public enum AreaTriggerFields
{
OverrideScaleCurve = ObjectFields.End + 0x000, // Size: 7, Flags: Public, Urgent
ExtraScaleCurve = ObjectFields.End + 0x007, // Size: 7, Flags: Public, Urgent
Caster = ObjectFields.End + 0x00e, // Size: 4, Flags: Public
Duration = ObjectFields.End + 0x012, // Size: 1, Flags: Public
TimeToTarget = ObjectFields.End + 0x013, // Size: 1, Flags: Public, Urgent
TimeToTargetScale = ObjectFields.End + 0x014, // Size: 1, Flags: Public, Urgent
TimeToTargetExtraScale = ObjectFields.End + 0x015, // Size: 1, Flags: Public, Urgent
SpellId = ObjectFields.End + 0x016, // Size: 1, Flags: Public
SpellForVisuals = ObjectFields.End + 0x017, // Size: 1, Flags: PUBLIC
SpellXSpellVisualId = ObjectFields.End + 0x018, // Size: 1, Flags: Dynamic
BoundsRadius2d = ObjectFields.End + 0x019, // Size: 1, Flags: Dynamic, Urgent
DecalPropertiesId = ObjectFields.End + 0x01A, // Size: 1, Flags: Public
CreatingEffectGuid = ObjectFields.End + 0x01B, // Size: 4, Flags: PUBLIC
End = ObjectFields.End + 0x01F
}
public enum SceneObjectFields
{
ScriptPackageId = ObjectFields.End + 0x000, // Size: 1, Flags: Public
RndSeedVal = ObjectFields.End + 0x001, // Size: 1, Flags: Public
Createdby = ObjectFields.End + 0x002, // Size: 4, Flags: Public
SceneType = ObjectFields.End + 0x006, // Size: 1, Flags: Public
End = ObjectFields.End + 0x007
}
public enum ConversationFields
{
LastLineEndTime = ObjectFields.End + 0x000, // Size: 1, Flags: DYNAMIC
End = ObjectFields.End + 0x001
}
public enum ConversationDynamicFields
{
Actors = 0x000, // Flags: Public
Lines = 0x001, // Flags: 0x100
End = 0x002
}
}
@@ -42,4 +42,13 @@ namespace Framework.Constants
//UPDATEFLAG_SCENEOBJECT = 0x10000,
//UPDATEFLAG_SCENE_PENDING_INSTANCE = 0x20000
}
public enum UpdateFieldFlag
{
None = 0,
Owner = 0x01,
PartyMember = 0x02,
UnitAll = 0x04,
Empath = 0x08
}
}
+37 -44
View File
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Security.Cryptography;
using System;
using System.Security.Cryptography;
@@ -25,66 +26,54 @@ namespace Framework.Cryptography
static readonly byte[] ServerEncryptionKey = { 0x08, 0xF1, 0x95, 0x9F, 0x47, 0xE5, 0xD2, 0xDB, 0xA1, 0x3D, 0x77, 0x8F, 0x3F, 0x3E, 0xE7, 0x00 };
static readonly byte[] ServerDecryptionKey = { 0x40, 0xAA, 0xD3, 0x92, 0x26, 0x71, 0x43, 0x47, 0x3A, 0x31, 0x08, 0xA6, 0xE7, 0xDC, 0x98, 0x2A };
public void Initialize(byte[] sessionKey)
public void Initialize(byte[] key)
{
if (IsInitialized)
throw new InvalidOperationException("PacketCrypt already initialized!");
SARC4Encrypt = new SARC4();
SARC4Decrypt = new SARC4();
_clientDecrypt = new AuthenticatedAesCng();
_clientDecrypt.Key = key;
_clientDecrypt.CngMode = CngChainingMode.Gcm;
_clientDecrypt.TagSize = 96;
var encryptSHA1 = new HMACSHA1(ServerEncryptionKey);
var decryptSHA1 = new HMACSHA1(ServerDecryptionKey);
SARC4Encrypt.PrepareKey(encryptSHA1.ComputeHash(sessionKey));
SARC4Decrypt.PrepareKey(decryptSHA1.ComputeHash(sessionKey));
var PacketEncryptionDummy = new byte[0x400];
var PacketDecryptionDummy = new byte[0x400];
SARC4Encrypt.ProcessBuffer(PacketEncryptionDummy, PacketEncryptionDummy.Length);
SARC4Decrypt.ProcessBuffer(PacketDecryptionDummy, PacketDecryptionDummy.Length);
_serverEncrypt = new AuthenticatedAesCng();
_serverEncrypt.Key = key;
_serverEncrypt.CngMode = CngChainingMode.Gcm;
_serverEncrypt.TagSize = 96;
IsInitialized = true;
}
public void Initialize(byte[] sessionKey, byte[] serverSeed, byte[] clientSeed)
public bool Encrypt(ref byte[] data, int length, ref byte[] tag)
{
if (IsInitialized)
throw new InvalidOperationException("PacketCrypt already initialized!");
{
_serverEncrypt.IV = BitConverter.GetBytes(_serverCounter).Combine(BitConverter.GetBytes(0x52565253));
SARC4Encrypt = new SARC4();
SARC4Decrypt = new SARC4();
using (IAuthenticatedCryptoTransform encryptor = _serverEncrypt.CreateAuthenticatedEncryptor())
{
data = encryptor.TransformFinalBlock(data, 0, length);
tag = encryptor.GetTag();
}
}
var encryptSHA1 = new HMACSHA1(serverSeed);
var decryptSHA1 = new HMACSHA1(clientSeed);
SARC4Encrypt.PrepareKey(encryptSHA1.ComputeHash(sessionKey));
SARC4Decrypt.PrepareKey(decryptSHA1.ComputeHash(sessionKey));
var PacketEncryptionDummy = new byte[0x400];
var PacketDecryptionDummy = new byte[0x400];
SARC4Encrypt.ProcessBuffer(PacketEncryptionDummy, PacketEncryptionDummy.Length);
SARC4Decrypt.ProcessBuffer(PacketDecryptionDummy, PacketDecryptionDummy.Length);
IsInitialized = true;
++_serverCounter;
return true;
}
public void Encrypt(byte[] data, int count)
public bool Decrypt(ref byte[] data, int length, byte[] tag)
{
if (!IsInitialized)
throw new InvalidOperationException("PacketCrypt not initialized!");
if (IsInitialized)
{
_clientDecrypt.IV = BitConverter.GetBytes(_clientCounter).Combine(BitConverter.GetBytes(0x544E4C43));
_clientDecrypt.Tag = tag;
SARC4Encrypt.ProcessBuffer(data, count);
}
using (ICryptoTransform decryptor = _clientDecrypt.CreateDecryptor())
data = decryptor.TransformFinalBlock(data, 0, length);
}
public void Decrypt(byte[] data, int count)
{
if (!IsInitialized)
throw new InvalidOperationException("PacketCrypt not initialized!");
SARC4Decrypt.ProcessBuffer(data, count);
++_clientCounter;
return true;
}
public void Dispose()
@@ -93,7 +82,11 @@ namespace Framework.Cryptography
}
public bool IsInitialized { get; set; }
SARC4 SARC4Encrypt;
SARC4 SARC4Decrypt;
AuthenticatedAesCng _clientDecrypt;
AuthenticatedAesCng _serverEncrypt;
ulong _clientCounter;
ulong _serverCounter;
}
}
+17 -88
View File
@@ -15,103 +15,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Numerics;
using System.Security.Cryptography;
namespace Framework.Cryptography
{
public class RsaCrypt : IDisposable
public class RsaCrypt
{
public RsaCrypt()
public static RSACryptoServiceProvider RSA;
static RsaCrypt()
{
Dispose();
RSA = new RSACryptoServiceProvider(2048);
RSA.ImportParameters(RsaStore.RSAParameters);
}
public void InitializeEncryption<T>(T p, T q, T dp, T dq, T iq, bool isBigEndian = false)
{
_p = p.ToBigInteger(isBigEndian);
_q = q.ToBigInteger(isBigEndian);
_dp = dp.ToBigInteger(isBigEndian);
_dq = dq.ToBigInteger(isBigEndian);
_iq = iq.ToBigInteger(isBigEndian);
if (_p.IsZero && _q.IsZero)
throw new InvalidOperationException("'0' isn't allowed for p or q");
else
_isEncryptionInitialized = true;
}
public void InitializeDecryption<T>(T e, T n, bool reverseBytes = false)
{
_e = e.ToBigInteger(reverseBytes);
_n = n.ToBigInteger(reverseBytes);
_isDecryptionInitialized = true;
}
public byte[] Encrypt<T>(T data, bool isBigEndian = false)
{
if (!_isEncryptionInitialized)
throw new InvalidOperationException("Encryption not initialized");
var bData = data.ToBigInteger(isBigEndian);
var m1 = BigInteger.ModPow(bData % _p, _dp, _p);
var m2 = BigInteger.ModPow(bData % _q, _dq, _q);
var h = (_iq * (m1 - m2)) % _p;
// Be sure to use the positive remainder
if (h.Sign == -1)
h = _p + h;
var m = m2 + h * _q;
return m.ToByteArray();
}
public byte[] Decrypt<T>(T data, bool isBigEndian = false)
{
if (!_isDecryptionInitialized)
throw new InvalidOperationException("Encryption not initialized");
var c = data.ToBigInteger(isBigEndian);
return BigInteger.ModPow(c, _e, _n).ToByteArray();
}
public void Dispose()
{
_e = 0;
_n = 0;
_p = 0;
_q = 0;
_dp = 0;
_dq = 0;
_iq = 0;
_isEncryptionInitialized = false;
_isDecryptionInitialized = false;
}
BigInteger _e;
BigInteger _n;
BigInteger _p;
BigInteger _q;
BigInteger _dp;
BigInteger _dq;
BigInteger _iq;
bool _isEncryptionInitialized;
bool _isDecryptionInitialized;
}
public class RsaStore
{
public static byte[] DP = { 0xE1, 0xA6, 0x22, 0xAB, 0xFF, 0x57, 0x83, 0x45, 0x3F, 0x93, 0x76, 0xC8, 0xFA, 0xD9, 0x17, 0xE1, 0x49, 0x73, 0xC2, 0x13, 0x28, 0x0B, 0x1F, 0xE2, 0x9A, 0xF4, 0x7F, 0x7C, 0x37, 0x56, 0xA1, 0xDF, 0x51, 0x97, 0x2F, 0x15, 0x10, 0x97, 0xCD, 0x2A, 0x40, 0x09, 0xFC, 0x0A, 0xC3, 0x3F, 0x88, 0x86, 0xA9, 0x51, 0x13, 0xE1, 0x76, 0xCF, 0xA8, 0x37, 0x9A, 0x91, 0x3B, 0xD0, 0x70, 0xA1, 0xD7, 0x03, 0x71, 0x59, 0x6C, 0xB3, 0x41, 0xB8, 0x32, 0x68, 0x56, 0xC8, 0xB8, 0xD1, 0xF9, 0x1D, 0x04, 0xC5, 0x13, 0xB5, 0x8E, 0x57, 0x73, 0x02, 0x97, 0x7B, 0x33, 0x60, 0x68, 0xA9, 0xC2, 0x40, 0x96, 0x3C, 0x57, 0x4E, 0x4F, 0xC0, 0xAB, 0x21, 0x5C, 0xBA, 0x7D, 0x65, 0xAA, 0x1B, 0xD6, 0x43, 0x06, 0xCE, 0x3E, 0x0C, 0xB9, 0xB2, 0x82, 0xB0, 0xC9, 0x54, 0x59, 0x32, 0xC5, 0x88, 0x08, 0x9C, 0x9B, 0xBF };
public static byte[] DQ = { 0xE3, 0xB1, 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C, 0x39, 0x55, 0x72, 0x2C, 0x55, 0x80, 0x63, 0xA0, 0xA1, 0x6F, 0x28, 0xF3, 0xF3, 0x5A, 0x6F, 0x68, 0x59, 0xB3, 0xF3 };
public static byte[] Q = { 0x0B, 0x1A, 0x13, 0x07, 0x12, 0xEF, 0xDD, 0x97, 0x01, 0x9A, 0x21, 0x7D, 0xFA, 0xA3, 0xB7, 0xE2, 0x39, 0x2E, 0x04, 0x92, 0x96, 0x45, 0x2A, 0xEB, 0x57, 0x03, 0xAC, 0xB1, 0x83, 0xCD, 0x25, 0x4F, 0x2C, 0xA9, 0xA1, 0x54, 0x26, 0x54, 0xCF, 0xE6, 0x1B, 0x53, 0x51, 0x3A, 0xC1, 0x15, 0xF4, 0x17, 0xBB, 0x17, 0x1F, 0x37, 0x66, 0x36, 0x1A, 0xD4, 0xB1, 0x5B, 0x49, 0xA8, 0xF1, 0x02, 0xB0, 0x42, 0xA9, 0x66, 0xA0, 0xE2, 0x52, 0x2C, 0x8C, 0x89, 0xA2, 0xDD, 0xA6, 0xF1, 0xA3, 0xDF, 0xB6, 0x80, 0x63, 0xB8, 0x10, 0xDA, 0xDE, 0x84, 0x56, 0xFA, 0xFB, 0x72, 0x65, 0x5E, 0xA3, 0x9C, 0x78, 0x65, 0xD0, 0x73, 0x07, 0x34, 0x1D, 0xE1, 0x4D, 0x77, 0xE8, 0x00, 0x0F, 0x80, 0x1C, 0x5A, 0x21, 0x55, 0x0A, 0x8C, 0xF4, 0x93, 0xF5, 0xF8, 0x40, 0xF2, 0x40, 0xEA, 0x52, 0x12, 0x40, 0xF0, 0xBF, 0xFA };
public static byte[] WherePacketHmac = { 0x2C, 0x1F, 0x1D, 0x80, 0xC3, 0x8C, 0x23, 0x64, 0xDA, 0x90, 0xCA, 0x8E, 0x2C, 0xFC, 0x0C, 0xCE, 0x09, 0xD3, 0x62, 0xF9, 0xF3, 0x8B, 0xBE, 0x9F, 0x19, 0xEF, 0x58, 0xA1, 0x1C, 0x34, 0x14, 0x41, 0x3F, 0x23, 0xFD, 0xD3, 0xE8, 0x14, 0xEC, 0x2A, 0xFD, 0x4F, 0x95, 0xBA, 0x30, 0x7E, 0x56, 0x5D, 0x83, 0x95, 0x81, 0x69, 0xB0, 0x5A, 0xB4, 0x9D, 0xA8, 0x55, 0xFF, 0xFC, 0xEE, 0x58, 0x0A, 0x2F };
public static RSAParameters RSAParameters = new RSAParameters()
{
Modulus = new byte[] { 0xee, 0xb3, 0xdc, 0xd4, 0xd3, 0xc3, 0xb4, 0x54, 0x51, 0xce, 0x66, 0x5b, 0xcb, 0x32, 0xb8, 0xf0, 0xf7, 0x92, 0x53, 0xc6, 0x19, 0xf2, 0x0c, 0x85, 0x2f, 0x8a, 0x26, 0xa9, 0x7a, 0x45, 0x9f, 0x60, 0xc4, 0xeb, 0xcd, 0xea, 0x7f, 0x8d, 0x59, 0xd8, 0x57, 0xb2, 0x60, 0x7b, 0x09, 0x4c, 0x9b, 0x68, 0xb8, 0xc7, 0xed, 0xef, 0x1e, 0x80, 0x0d, 0xe6, 0x6b, 0x37, 0x5b, 0x53, 0x90, 0xeb, 0x18, 0x13, 0x0d, 0x7f, 0x43, 0x64, 0x83, 0xda, 0x98, 0xe6, 0xac, 0xc2, 0x30, 0xa2, 0x82, 0xa5, 0xc6, 0xcb, 0xc7, 0xfb, 0x86, 0x9f, 0x9f, 0xa9, 0x02, 0x6a, 0x03, 0x49, 0xc5, 0x38, 0xfb, 0xc0, 0xc8, 0x55, 0xcc, 0xc0, 0xce, 0x25, 0x91, 0xbe, 0x85, 0xcf, 0xd1, 0xd1, 0x37, 0xce, 0xcc, 0x83, 0xd2, 0xea, 0x30, 0x80, 0x07, 0x7b, 0x80, 0x9f, 0x9d, 0x44, 0x54, 0x22, 0x29, 0xbe, 0x86, 0xda, 0xdb, 0x48, 0xc5, 0xa9, 0xf9, 0x13, 0x36, 0x95, 0x23, 0x76, 0xf1, 0x0e, 0xdc, 0x84, 0x0d, 0x94, 0x02, 0x12, 0xa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01, 0x97, 0xdd, 0xef, 0x12, 0x07, 0x13, 0x1a, 0x0b },
DP = new byte[] { 0xbf, 0x9b, 0x9c, 0x08, 0x88, 0xc5, 0x32, 0x59, 0x54, 0xc9, 0xb0, 0x82, 0xb2, 0xb9, 0x0c, 0x3e, 0xce, 0x06, 0x43, 0xd6, 0x1b, 0xaa, 0x65, 0x7d, 0xba, 0x5c, 0x21, 0xab, 0xc0, 0x4f, 0x4e, 0x57, 0x3c, 0x96, 0x40, 0xc2, 0xa9, 0x68, 0x60, 0x33, 0x7b, 0x97, 0x02, 0x73, 0x57, 0x8e, 0xb5, 0x13, 0xc5, 0x04, 0x1d, 0xf9, 0xd1, 0xb8, 0xc8, 0x56, 0x68, 0x32, 0xb8, 0x41, 0xb3, 0x6c, 0x59, 0x71, 0x03, 0xd7, 0xa1, 0x70, 0xd0, 0x3b, 0x91, 0x9a, 0x37, 0xa8, 0xcf, 0x76, 0xe1, 0x13, 0x51, 0xa9, 0x86, 0x88, 0x3f, 0xc3, 0x0a, 0xfc, 0x09, 0x40, 0x2a, 0xcd, 0x97, 0x10, 0x15, 0x2f, 0x97, 0x51, 0xdf, 0xa1, 0x56, 0x37, 0x7c, 0x7f, 0xf4, 0x9a, 0xe2, 0x1f, 0x0b, 0x28, 0x13, 0xc2, 0x73, 0x49, 0xe1, 0x17, 0xd9, 0xfa, 0xc8, 0x76, 0x93, 0x3f, 0x45, 0x83, 0x57, 0xff, 0xab, 0x22, 0xa6, 0xe1 },
DQ = new byte[] { 0xfa, 0xbc, 0x05, 0x44, 0x3c, 0x4e, 0x76, 0xf9, 0xbc, 0x84, 0x65, 0xae, 0x43, 0x65, 0x8c, 0xc7, 0x24, 0x3b, 0x36, 0x7d, 0x3b, 0x3c, 0x45, 0x7f, 0x2f, 0x15, 0x4c, 0x1e, 0x44, 0x91, 0x93, 0x28, 0x76, 0xde, 0xf5, 0x5a, 0x93, 0x20, 0xc4, 0xaa, 0xdc, 0xb7, 0xb9, 0x23, 0x92, 0x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 0x8f, 0x8f, 0xf4, 0x79, 0x0e, 0x4c, 0xbd, 0x56, 0x96, 0x9b, 0xb5, 0xf6, 0x4e, 0xbb, 0xf0, 0x04, 0x5b, 0x6e, 0x7d, 0x5c, 0x31, 0x22, 0x42, 0x04, 0xeb, 0x07, 0x81, 0x20, 0xf9, 0x2e, 0x06, 0x26, 0x31, 0xea, 0x03, 0x33, 0xd9, 0x06, 0x63, 0x32, 0xff, 0x18, 0x65, 0x0c, 0xae, 0x28, 0x31, 0x77, 0x9f, 0xa9, 0x74, 0x9c, 0x7c, 0x3e, 0x30, 0xd1, 0x1c, 0x6e, 0xb8, 0x21, 0x6b, 0xea, 0x5c, 0x4b, 0x3d, 0x9c, 0xf4, 0x4b, 0x7e, 0x41, 0x2b, 0x59, 0x08, 0x5a, 0x62, 0x24, 0xba, 0xff, 0xbd, 0x79, 0x0b, 0x88, 0xe0, 0x7a, 0xf5, 0x0b, 0x25, 0x70, 0x72, 0x1e, 0x1f, 0x91, 0xfb, 0xeb, 0xa7, 0xce, 0x31, 0xf2, 0xdb, 0xc0, 0x16, 0x79 },
};
}
}
@@ -21,7 +21,7 @@ namespace Framework.Database
{
public override void PreparedStatements()
{
const string SelectItemInstanceContent = "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, ii.randomPropertyType, ii.randomPropertyId, " +
const string SelectItemInstanceContent = "ii.guid, ii.itemEntry, ii.creatorGuid, ii.giftCreatorGuid, ii.count, ii.duration, ii.charges, ii.flags, ii.enchantments, ii.randomBonusListId, " +
"ii.durability, ii.playedTime, ii.text, ii.upgradeId, ii.battlePetSpeciesId, ii.battlePetBreedData, ii.battlePetLevel, ii.battlePetDisplayId, ii.context, ii.bonusListIDs, " +
"iit.itemModifiedAppearanceAllSpecs, iit.itemModifiedAppearanceSpec1, iit.itemModifiedAppearanceSpec2, iit.itemModifiedAppearanceSpec3, iit.itemModifiedAppearanceSpec4, " +
"iit.spellItemEnchantmentAllSpecs, iit.spellItemEnchantmentSpec1, iit.spellItemEnchantmentSpec2, iit.spellItemEnchantmentSpec3, iit.spellItemEnchantmentSpec4, " +
@@ -168,8 +168,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_ITEM_BOP_TRADE, "DELETE FROM item_soulbound_trade_data WHERE itemGuid = ? LIMIT 1");
PrepareStatement(CharStatements.INS_ITEM_BOP_TRADE, "INSERT INTO item_soulbound_trade_data VALUES (?, ?)");
PrepareStatement(CharStatements.REP_INVENTORY_ITEM, "REPLACE INTO character_inventory (guid, bag, slot, item) VALUES (?, ?, ?, ?)");
PrepareStatement(CharStatements.REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyType, randomPropertyId, durability, playedTime, text, upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomPropertyType = ?, randomPropertyId = ?, durability = ?, playedTime = ?, text = ?, upgradeId = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ?, bonusListIDs = ? WHERE guid = ?");
PrepareStatement(CharStatements.REP_ITEM_INSTANCE, "REPLACE INTO item_instance (itemEntry, owner_guid, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomBonusListId, durability, playedTime, text, upgradeId, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs, guid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.UPD_ITEM_INSTANCE, "UPDATE item_instance SET itemEntry = ?, owner_guid = ?, creatorGuid = ?, giftCreatorGuid = ?, count = ?, duration = ?, charges = ?, flags = ?, enchantments = ?, randomBonusListId = ?, durability = ?, playedTime = ?, text = ?, upgradeId = ?, battlePetSpeciesId = ?, battlePetBreedData = ?, battlePetLevel = ?, battlePetDisplayId = ?, context = ?, bonusListIDs = ? WHERE guid = ?");
PrepareStatement(CharStatements.UPD_ITEM_INSTANCE_ON_LOAD, "UPDATE item_instance SET duration = ?, flags = ?, durability = ?, upgradeId = ? WHERE guid = ?");
PrepareStatement(CharStatements.DEL_ITEM_INSTANCE, "DELETE FROM item_instance WHERE guid = ?");
PrepareStatement(CharStatements.DEL_ITEM_INSTANCE_BY_OWNER, "DELETE FROM item_instance WHERE owner_guid = ?");
@@ -625,8 +625,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_CHAR_FISHINGSTEPS, "DELETE FROM character_fishingsteps WHERE guid = ?");
// Void Storage
PrepareStatement(CharStatements.SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, suffixFactor, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?");
PrepareStatement(CharStatements.REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, suffixFactor, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_CHAR_VOID_STORAGE, "SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?");
PrepareStatement(CharStatements.REP_CHAR_VOID_STORAGE_ITEM, "REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_CHAR_GUID, "DELETE FROM character_void_storage WHERE playerGuid = ?");
PrepareStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_SLOT, "DELETE FROM character_void_storage WHERE slot = ? AND playerGuid = ?");
@@ -643,10 +643,10 @@ namespace Framework.Database
PrepareStatement(CharStatements.DEL_GUILD_FINDER_GUILD_SETTINGS, "DELETE FROM guild_finder_guild_settings WHERE guildId = ?");
// Items that hold loot or money
PrepareStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, rnd_suffix, context, bonus_list_ids FROM item_loot_items WHERE container_id = ?");
PrepareStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS, "SELECT item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids FROM item_loot_items WHERE container_id = ?");
PrepareStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS, "DELETE FROM item_loot_items WHERE container_id = ?");
PrepareStatement(CharStatements.DEL_ITEMCONTAINER_ITEM, "DELETE FROM item_loot_items WHERE container_id = ? AND item_id = ?");
PrepareStatement(CharStatements.INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_type, rnd_prop, rnd_suffix, context, bonus_list_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.INS_ITEMCONTAINER_ITEMS, "INSERT INTO item_loot_items (container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_bonus, context, bonus_list_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PrepareStatement(CharStatements.SEL_ITEMCONTAINER_MONEY, "SELECT money FROM item_loot_money WHERE container_id = ?");
PrepareStatement(CharStatements.DEL_ITEMCONTAINER_MONEY, "DELETE FROM item_loot_money WHERE container_id = ?");
PrepareStatement(CharStatements.INS_ITEMCONTAINER_MONEY, "INSERT INTO item_loot_money (container_id, money) VALUES (?, ?)");
File diff suppressed because it is too large Load Diff
@@ -27,8 +27,7 @@ namespace Framework.Database
PrepareStatement(LoginStatements.SEL_REALMLIST, "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild, Region, Battlegroup FROM realmlist WHERE flag <> 3 ORDER BY name");
PrepareStatement(LoginStatements.DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()");
PrepareStatement(LoginStatements.UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()");
PrepareStatement(LoginStatements.SEL_IP_INFO, "(SELECT unbandate > UNIX_TIMESTAMP() OR unbandate = bandate AS banned, NULL as country FROM ip_banned WHERE ip = ?) " +
"UNION (SELECT NULL AS banned, country FROM ip2nation WHERE INET_NTOA(ip) = ?)");
PrepareStatement(LoginStatements.SEL_IP_INFO, "SELECT unbandate > UNIX_TIMESTAMP() OR unbandate = bandate AS banned, NULL as country FROM ip_banned WHERE ip = ?");
PrepareStatement(LoginStatements.INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Cypher Auth', 'Failed login autoban')");
PrepareStatement(LoginStatements.SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate");
@@ -38,7 +37,6 @@ namespace Framework.Database
PrepareStatement(LoginStatements.DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?");
PrepareStatement(LoginStatements.UPD_ACCOUNT_INFO_CONTINUED_SESSION, "UPDATE account SET sessionkey = ? WHERE id = ?");
PrepareStatement(LoginStatements.SEL_ACCOUNT_INFO_CONTINUED_SESSION, "SELECT username, sessionkey FROM account WHERE id = ?");
PrepareStatement(LoginStatements.SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1");
PrepareStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?");
PrepareStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?");
PrepareStatement(LoginStatements.SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, a.os, ba.id, aa.gmLevel, " +
@@ -95,7 +93,6 @@ namespace Framework.Database
PrepareStatement(LoginStatements.SEL_LAST_IP, "SELECT last_ip FROM account WHERE id = ?");
PrepareStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?");
PrepareStatement(LoginStatements.DEL_ACCOUNT, "DELETE FROM account WHERE id = ?");
PrepareStatement(LoginStatements.SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1");
PrepareStatement(LoginStatements.SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1");
PrepareStatement(LoginStatements.GET_EMAIL_BY_ID, "SELECT email FROM account WHERE id = ?");
// 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_AccountLoginDeLete_IP_Logging"
@@ -191,7 +188,6 @@ namespace Framework.Database
UPD_ACCOUNT_INFO_CONTINUED_SESSION,
SEL_ACCOUNT_INFO_CONTINUED_SESSION,
UPD_VS,
SEL_LOGON_COUNTRY,
SEL_ACCOUNT_ID_BY_NAME,
SEL_ACCOUNT_LIST_BY_NAME,
SEL_ACCOUNT_INFO_BY_NAME,
+3 -2
View File
@@ -220,8 +220,8 @@ namespace Framework.Database
{
try
{
string query = File.ReadAllText(path);
if (query.Length > 1048576) //Default size limit of querys
string query = File.ReadAllText(path);
if (Encoding.UTF8.GetByteCount(query) > 1048576) //Default size limit of querys
Apply("SET GLOBAL max_allowed_packet=1073741824;");
using (var connection = _connectionInfo.GetConnection())
@@ -229,6 +229,7 @@ namespace Framework.Database
connection.Open();
using (MySqlCommand cmd = connection.CreateCommand())
{
cmd.CommandTimeout = 120;
cmd.CommandText = query;
cmd.ExecuteNonQuery();
return true;
+2 -1
View File
@@ -12,7 +12,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="MySqlConnector" Version="0.48.2" />
<PackageReference Include="MySqlConnector" Version="0.56.0" />
<PackageReference Include="Security.Cryptography" Version="1.7.2" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
</ItemGroup>
+41 -36
View File
@@ -162,30 +162,30 @@ namespace Framework.IO
//BitPacking
public byte ReadBit()
{
if (BitPosition == 8)
if (_bitPosition == 8)
{
BitValue = ReadUInt8();
BitPosition = 0;
_bitPosition = 0;
}
int returnValue = BitValue;
BitValue = (byte)(2 * returnValue);
++BitPosition;
++_bitPosition;
return (byte)(returnValue >> 7);
}
public bool HasBit()
{
if (BitPosition == 8)
if (_bitPosition == 8)
{
BitValue = ReadUInt8();
BitPosition = 0;
_bitPosition = 0;
}
int returnValue = BitValue;
BitValue = (byte)(2 * returnValue);
++BitPosition;
++_bitPosition;
return Convert.ToBoolean(returnValue >> 7);
}
@@ -203,64 +203,64 @@ namespace Framework.IO
#endregion
#region Write Methods
public void WriteInt8<T>(T data)
public void WriteInt8(sbyte data)
{
FlushBits();
writeStream.Write(Convert.ToSByte(data));
writeStream.Write(data);
}
public void WriteInt16<T>(T data)
public void WriteInt16(short data)
{
FlushBits();
writeStream.Write(Convert.ToInt16(data));
writeStream.Write(data);
}
public void WriteInt32<T>(T data)
public void WriteInt32(int data)
{
FlushBits();
writeStream.Write(Convert.ToInt32(data));
writeStream.Write(data);
}
public void WriteInt64<T>(T data)
public void WriteInt64(long data)
{
FlushBits();
writeStream.Write(Convert.ToInt64(data));
writeStream.Write(data);
}
public void WriteUInt8<T>(T data)
public void WriteUInt8(byte data)
{
FlushBits();
writeStream.Write(Convert.ToByte(data));
writeStream.Write(data);
}
public void WriteUInt16<T>(T data)
public void WriteUInt16(ushort data)
{
FlushBits();
writeStream.Write(Convert.ToUInt16(data));
writeStream.Write(data);
}
public void WriteUInt32<T>(T data)
public void WriteUInt32(uint data)
{
FlushBits();
writeStream.Write(Convert.ToUInt32(data));
writeStream.Write(data);
}
public void WriteUInt64<T>(T data)
public void WriteUInt64(ulong data)
{
FlushBits();
writeStream.Write(Convert.ToUInt64(data));
writeStream.Write(data);
}
public void WriteFloat<T>(T data)
public void WriteFloat(float data)
{
FlushBits();
writeStream.Write(Convert.ToSingle(data));
writeStream.Write(data);
}
public void WriteDouble<T>(T data)
public void WriteDouble(double data)
{
FlushBits();
writeStream.Write(Convert.ToDouble(data));
writeStream.Write(data);
}
/// <summary>
@@ -329,16 +329,16 @@ namespace Framework.IO
public bool WriteBit(object bit)
{
--BitPosition;
--_bitPosition;
if (Convert.ToBoolean(bit))
BitValue |= (byte)(1 << BitPosition);
BitValue |= (byte)(1 << _bitPosition);
if (BitPosition == 0)
if (_bitPosition == 0)
{
writeStream.Write(BitValue);
BitPosition = 8;
_bitPosition = 8;
BitValue = 0;
}
return Convert.ToBoolean(bit);
@@ -363,22 +363,27 @@ namespace Framework.IO
}
#endregion
public bool HasUnfinishedBitPack()
{
return _bitPosition != 8;
}
public void FlushBits()
{
if (BitPosition == 8)
if (_bitPosition == 8)
return;
writeStream.Write(BitValue);
BitValue = 0;
BitPosition = 8;
_bitPosition = 8;
}
public void ResetBitPos()
{
if (BitPosition > 7)
if (_bitPosition > 7)
return;
BitPosition = 8;
_bitPosition = 8;
BitValue = 0;
}
@@ -412,12 +417,12 @@ namespace Framework.IO
public void Clear()
{
BitPosition = 8;
_bitPosition = 8;
BitValue = 0;
writeStream = new BinaryWriter(new MemoryStream());
}
byte BitPosition = 8;
byte _bitPosition = 8;
byte BitValue;
BinaryWriter writeStream;
BinaryReader readStream;
@@ -103,6 +103,11 @@ namespace System.Collections.Generic
int cur = list.Count;
if (size < cur)
list.RemoveRange((int)size, cur - (int)size);
else
{
for (var i = list.Count; i < size; ++i)
list.Add(default(T));
}
}
public static void RandomResize<T>(this IList<T> list, uint size)