From 581d077acd17b0e2724e9ebdbc46a432252dac2d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 12 Jul 2020 00:06:43 -0400 Subject: [PATCH] Refactoring of BNetServer --- Source/BNetServer/BNetServer.conf.dist | 18 +- Source/BNetServer/BNetServer.csproj | 7 +- Source/BNetServer/Managers/Global.cs | 35 +- .../Managers/LoginServiceManager.cs | 195 +++++ Source/BNetServer/Managers/SessionManager.cs | 116 --- Source/BNetServer/Networking/RestSession.cs | 79 +- .../BNetServer/Networking/Services/Account.cs | 76 ++ .../Networking/Services/Authentication.cs | 169 +++++ .../Networking/Services/Connection.cs | 48 ++ .../Networking/Services/GameUtilities.cs | 207 ++++++ Source/BNetServer/Networking/Session.cs | 696 ++++-------------- Source/BNetServer/Server.cs | 61 +- Source/BNetServer/Services/AccountService.cs | 360 --------- .../Services/AuthenticationService.cs | 442 ----------- .../BNetServer/Services/ChallengeService.cs | 81 -- .../BNetServer/Services/ConnectionService.cs | 187 ----- Source/BNetServer/Services/FriendService.cs | 432 ----------- .../Services/GameUtilitiesService.cs | 215 ------ Source/BNetServer/Services/PresenceService.cs | 203 ----- Source/BNetServer/Services/ReportService.cs | 87 --- .../BNetServer/Services/ResourcesService.cs | 60 -- .../BNetServer/Services/ServiceDispatcher.cs | 90 --- .../BNetServer/Services/UserManagerService.cs | 319 -------- Source/Framework/Constants/SharedConst.cs | 4 +- .../Database/Databases/LoginDatabase.cs | 56 +- Source/Framework/Database/SQLResult.cs | 9 + Source/Framework/Networking/AsyncAcceptor.cs | 8 +- Source/Framework/Networking/NetworkThread.cs | 17 +- Source/Framework/Networking/SSLSocket.cs | 95 +-- Source/Framework/Networking/SocketBase.cs | 97 +-- Source/Framework/Networking/SocketManager.cs | 10 +- Source/Framework/Realm/Realm.cs | 52 +- Source/Framework/Realm/RealmId.cs | 58 ++ Source/Framework/Realm/RealmManager.cs | 23 +- .../Rest/Authentication/LogonData.cs | 41 -- Source/Framework/Rest/Forms/FormInput.cs | 37 - Source/Framework/Rest/Forms/FormInputValue.cs | 31 - Source/Framework/Rest/Forms/FormInputs.cs | 35 - Source/Framework/Rest/Misc/Address.cs | 31 - Source/Framework/Rest/Misc/AddressFamily.cs | 32 - Source/Framework/Rest/Misc/ClientVersion.cs | 37 - .../Rest/Misc/RealmCharacterCountEntry.cs | 31 - .../Rest/Realmlist/RealmCharacterCountList.cs | 29 - .../Realmlist/RealmListServerIPAddresses.cs | 29 - .../RealmListTicketClientInformation.cs | 28 - .../Rest/Realmlist/RealmListTicketIdentity.cs | 31 - .../Rest/Realmlist/RealmListUpdate.cs | 31 - .../Rest/Realmlist/RealmListUpdates.cs | 29 - Source/Framework/Web/API/ApiRequest.cs | 12 + .../Web/Rest/Authentication/LogonData.cs | 27 + .../Rest/Authentication/LogonResult.cs | 20 +- Source/Framework/Web/Rest/Forms/FormInput.cs | 23 + .../Web/Rest/Forms/FormInputValue.cs | 17 + Source/Framework/Web/Rest/Forms/FormInputs.cs | 21 + Source/Framework/Web/Rest/Misc/Address.cs | 17 + .../Framework/Web/Rest/Misc/AddressFamily.cs | 18 + .../Framework/Web/Rest/Misc/ClientVersion.cs | 23 + .../Web/Rest/Misc/RealmCharacterCountEntry.cs | 17 + .../Rest/Realmlist/RealmCharacterCountList.cs | 15 + .../{ => Web}/Rest/Realmlist/RealmEntry.cs | 20 +- .../Realmlist/RealmListServerIPAddresses.cs | 15 + .../RealmListTicketClientInformation.cs | 14 + .../Rest/Realmlist/RealmListTicketIdentity.cs | 17 + .../Realmlist/RealmListTicketInformation.cs | 20 +- .../Web/Rest/Realmlist/RealmListUpdate.cs | 17 + .../Web/Rest/Realmlist/RealmListUpdates.cs | 15 + .../Game/Achievements/AchievementManager.cs | 16 +- Source/Game/Achievements/CriteriaHandler.cs | 4 +- Source/Game/Arenas/Arena.cs | 2 +- Source/Game/Arenas/ArenaScore.cs | 2 +- Source/Game/Arenas/ArenaTeam.cs | 2 +- Source/Game/Arenas/Zones/BladesEdgeArena.cs | 2 +- Source/Game/Arenas/Zones/DalaranSewers.cs | 2 +- Source/Game/Arenas/Zones/NagrandArena.cs | 2 +- Source/Game/Arenas/Zones/RingofValor.cs | 2 +- Source/Game/Arenas/Zones/RuinsofLordaeron.cs | 2 +- Source/Game/AuctionHouse/AuctionManager.cs | 20 +- Source/Game/BattleFields/BattleField.cs | 4 +- Source/Game/BattleFields/Zones/WinterGrasp.cs | 2 +- Source/Game/BattleGrounds/BattleGround.cs | 4 +- .../Game/BattleGrounds/BattleGroundManager.cs | 2 +- .../Game/BattleGrounds/BattleGroundQueue.cs | 2 +- .../Game/BattleGrounds/BattleGroundScore.cs | 2 +- .../Game/BattleGrounds/Zones/ArathiBasin.cs | 2 +- Source/Game/BattleGrounds/Zones/EyeofStorm.cs | 2 +- .../BattleGrounds/Zones/StrandofAncients.cs | 2 +- .../Game/BattleGrounds/Zones/WarsongGluch.cs | 2 +- Source/Game/BattlePets/BattlePetManager.cs | 2 +- Source/Game/BlackMarket/BlackMarketEntry.cs | 2 +- Source/Game/BlackMarket/BlackMarketManager.cs | 4 +- Source/Game/Cache/CharacterCache.cs | 2 +- Source/Game/Calendar/CalendarManager.cs | 4 +- Source/Game/Chat/Channels/Channel.cs | 6 +- Source/Game/Chat/Channels/ChannelAppenders.cs | 40 +- Source/Game/Chat/Channels/ChannelManager.cs | 6 +- Source/Game/Chat/CommandHandler.cs | 6 +- Source/Game/Chat/Commands/BanCommands.cs | 4 +- .../Game/Chat/Commands/CharacterCommands.cs | 4 +- Source/Game/Chat/Commands/DebugCommands.cs | 2 +- Source/Game/Chat/Commands/GMCommands.cs | 2 +- Source/Game/Chat/Commands/LearnCommands.cs | 6 +- Source/Game/Chat/Commands/LookupCommands.cs | 46 +- Source/Game/Chat/Commands/MessageCommands.cs | 2 +- Source/Game/Chat/Commands/MiscCommands.cs | 8 +- Source/Game/Chat/Commands/ModifyCommands.cs | 2 +- Source/Game/Chat/Commands/RbacCommands.cs | 2 +- Source/Game/Chat/Commands/TicketCommands.cs | 6 +- Source/Game/DataStorage/CliDB.cs | 4 +- .../DataStorage/ClientReader/DB6Storage.cs | 8 +- .../Game/DataStorage/ClientReader/DBReader.cs | 10 +- Source/Game/DataStorage/DB2Manager.cs | 36 +- Source/Game/DungeonFinding/LFGManager.cs | 2 +- Source/Game/DungeonFinding/LFGPlayerData.cs | 2 +- .../Game/Entities/AreaTrigger/AreaTrigger.cs | 4 +- .../AreaTrigger/AreaTriggerTemplate.cs | 2 +- Source/Game/Entities/Conversation.cs | 2 +- Source/Game/Entities/Corpse.cs | 2 +- Source/Game/Entities/Creature/Creature.cs | 6 +- Source/Game/Entities/Creature/CreatureData.cs | 10 +- Source/Game/Entities/Creature/Gossip.cs | 44 +- Source/Game/Entities/Creature/Trainer.cs | 14 +- Source/Game/Entities/DynamicObject.cs | 2 +- Source/Game/Entities/GameObject/GameObject.cs | 8 +- .../Entities/GameObject/GameObjectData.cs | 8 +- .../Entities/Item/AzeriteEmpoweredItem.cs | 4 +- Source/Game/Entities/Item/AzeriteItem.cs | 4 +- Source/Game/Entities/Item/Bag.cs | 2 +- Source/Game/Entities/Item/Item.cs | 6 +- Source/Game/Entities/Item/ItemTemplate.cs | 2 +- Source/Game/Entities/Object/ObjectGuid.cs | 4 +- .../Game/Entities/Object/Update/UpdateData.cs | 4 +- .../Entities/Object/Update/UpdateField.cs | 2 +- .../Entities/Object/Update/UpdateFields.cs | 2 +- Source/Game/Entities/Object/WorldObject.cs | 6 +- Source/Game/Entities/Pet.cs | 2 +- .../Game/Entities/Player/CollectionManager.cs | 2 +- Source/Game/Entities/Player/Player.Combat.cs | 2 +- Source/Game/Entities/Player/Player.DB.cs | 4 +- Source/Game/Entities/Player/Player.Items.cs | 2 +- Source/Game/Entities/Player/Player.Map.cs | 2 +- Source/Game/Entities/Player/Player.PvP.cs | 2 +- Source/Game/Entities/Player/Player.Quest.cs | 6 +- Source/Game/Entities/Player/Player.Spells.cs | 2 +- Source/Game/Entities/Player/Player.Talents.cs | 2 +- Source/Game/Entities/Player/Player.cs | 26 +- Source/Game/Entities/Player/PlayerTaxi.cs | 14 +- Source/Game/Entities/Player/SceneMgr.cs | 2 +- Source/Game/Entities/Player/SocialMgr.cs | 4 +- Source/Game/Entities/Player/TradeData.cs | 2 +- Source/Game/Entities/StatSystem.cs | 2 +- Source/Game/Entities/Totem.cs | 2 +- Source/Game/Entities/Unit/CharmInfo.cs | 2 +- Source/Game/Entities/Unit/Unit.Combat.cs | 2 +- Source/Game/Entities/Unit/Unit.Fields.cs | 2 +- Source/Game/Entities/Unit/Unit.Movement.cs | 2 +- Source/Game/Entities/Unit/Unit.Pets.cs | 2 +- Source/Game/Entities/Unit/Unit.Spells.cs | 2 +- Source/Game/Entities/Unit/Unit.cs | 8 +- Source/Game/Events/GameEventManager.cs | 2 +- Source/Game/Garrisons/Garrisons.cs | 2 +- Source/Game/Globals/ObjectManager.cs | 80 +- Source/Game/Groups/Group.cs | 4 +- Source/Game/Guilds/Guild.cs | 8 +- Source/Game/Guilds/GuildFinderManager.cs | 2 +- Source/Game/Handlers/ArtifactHandler.cs | 4 +- Source/Game/Handlers/AuctionHandler.cs | 4 +- Source/Game/Handlers/AuthenticationHandler.cs | 2 +- Source/Game/Handlers/AzeriteHandler.cs | 4 +- Source/Game/Handlers/BankHandler.cs | 4 +- Source/Game/Handlers/BattleFieldHandler.cs | 2 +- Source/Game/Handlers/BattleGroundHandler.cs | 4 +- Source/Game/Handlers/BattlePetHandler.cs | 4 +- Source/Game/Handlers/BattlenetHandler.cs | 4 +- Source/Game/Handlers/BlackMarketHandlers.cs | 4 +- Source/Game/Handlers/CalendarHandler.cs | 4 +- Source/Game/Handlers/ChannelHandler.cs | 4 +- Source/Game/Handlers/CharacterHandler.cs | 8 +- Source/Game/Handlers/ChatHandler.cs | 6 +- Source/Game/Handlers/CollectionsHandler.cs | 4 +- Source/Game/Handlers/CombatHandler.cs | 4 +- Source/Game/Handlers/DuelHandler.cs | 4 +- Source/Game/Handlers/GarrisonHandler.cs | 4 +- Source/Game/Handlers/GroupHandler.cs | 4 +- Source/Game/Handlers/GuildFinderHandler.cs | 4 +- Source/Game/Handlers/GuildHandler.cs | 4 +- Source/Game/Handlers/HotfixHandler.cs | 4 +- Source/Game/Handlers/InspectHandler.cs | 4 +- Source/Game/Handlers/ItemHandler.cs | 4 +- Source/Game/Handlers/LFGHandler.cs | 4 +- Source/Game/Handlers/LogoutHandler.cs | 4 +- Source/Game/Handlers/LootHandler.cs | 4 +- Source/Game/Handlers/MailHandler.cs | 4 +- Source/Game/Handlers/MiscHandler.cs | 4 +- Source/Game/Handlers/MovementHandler.cs | 4 +- Source/Game/Handlers/NPCHandler.cs | 4 +- Source/Game/Handlers/PetHandler.cs | 4 +- Source/Game/Handlers/PetitionsHandler.cs | 4 +- Source/Game/Handlers/QueryHandler.cs | 21 +- Source/Game/Handlers/QuestHandler.cs | 4 +- Source/Game/Handlers/RAFHandler.cs | 4 +- Source/Game/Handlers/ScenarioHandler.cs | 4 +- Source/Game/Handlers/SceneHandler.cs | 4 +- Source/Game/Handlers/SkillHandler.cs | 4 +- Source/Game/Handlers/SocialHandler.cs | 6 +- Source/Game/Handlers/SpellHandler.cs | 4 +- Source/Game/Handlers/TaxiHandler.cs | 4 +- Source/Game/Handlers/TicketHandler.cs | 4 +- Source/Game/Handlers/TimeHandler.cs | 4 +- Source/Game/Handlers/TokenHandler.cs | 4 +- Source/Game/Handlers/ToyHandler.cs | 4 +- Source/Game/Handlers/TradeHandler.cs | 4 +- .../Handlers/TransmogrificationHandler.cs | 4 +- Source/Game/Handlers/VehicleHandler.cs | 4 +- Source/Game/Handlers/VoidStorageHandler.cs | 4 +- Source/Game/Loot/Loot.cs | 2 +- Source/Game/Maps/GridNotifiers.cs | 10 +- Source/Game/Maps/Instances/InstanceScript.cs | 2 +- Source/Game/Maps/Map.cs | 4 +- Source/Game/Movement/MoveSplineInit.cs | 2 +- Source/Game/{Network => Networking}/Packet.cs | 2 +- .../Game/{Network => Networking}/PacketLog.cs | 10 +- .../{Network => Networking}/PacketManager.cs | 2 +- .../PacketUtilities.cs | 2 +- .../Packets/AchievementPackets.cs | 2 +- .../Packets/AddonPackets.cs | 2 +- .../Packets/AreaTriggerPackets.cs | 2 +- .../Packets/ArtifactPackets.cs | 2 +- .../Packets/AuctionHousePackets.cs | 2 +- .../Packets/AuthenticationPackets.cs | 2 +- .../Packets/AzeritePackets.cs | 2 +- .../Packets/BankPackets.cs | 2 +- .../Packets/BattleGroundPackets.cs | 2 +- .../Packets/BattlePetPackets.cs | 2 +- .../Packets/BattlefieldPackets.cs | 2 +- .../Packets/BattlenetPackets.cs | 2 +- .../Packets/BlackMarketPackets.cs | 2 +- .../Packets/CalendarPackets.cs | 2 +- .../Packets/ChannelPackets.cs | 2 +- .../Packets/CharacterPackets.cs | 2 +- .../Packets/ChatPackets.cs | 8 +- .../Packets/ClientConfigPackets.cs | 2 +- .../Packets/CollectionPackets.cs | 2 +- .../Packets/CombatLogPackets.cs | 2 +- .../Packets/CombatPackets.cs | 2 +- .../Packets/DuelPackets.cs | 2 +- .../Packets/EquipmentPackets.cs | 2 +- .../Packets/GameObjectPackets.cs | 2 +- .../Packets/GarrisonPackets.cs | 2 +- .../Packets/GuildFinderPackets.cs | 2 +- .../Packets/GuildPackets.cs | 2 +- .../Packets/HotfixPackets.cs | 2 +- .../Packets/InspectPackets.cs | 2 +- .../Packets/InstancePackets.cs | 2 +- .../Packets/ItemPackets.cs | 2 +- .../Packets/LFGPackets.cs | 2 +- .../Packets/LootPackets.cs | 2 +- .../Packets/MailPackets.cs | 2 +- .../Packets/MiscPackets.cs | 2 +- .../Packets/MovementPackets.cs | 2 +- .../Packets/NPCPackets.cs | 2 +- .../Packets/PartyPackets.cs | 2 +- .../Packets/PetPackets.cs | 2 +- .../Packets/PetitionPackets.cs | 2 +- .../Packets/QueryPackets.cs | 2 +- .../Packets/QuestPackets.cs | 2 +- .../Packets/ReferAFriendPackets.cs | 2 +- .../Packets/ReputationPackets.cs | 2 +- .../Packets/ScenarioPackets.cs | 2 +- .../Packets/ScenePackets.cs | 2 +- .../Packets/SocialPackets.cs | 2 +- .../Packets/SpellPackets.cs | 2 +- .../Packets/SystemPackets.cs | 2 +- .../Packets/TalentPackets.cs | 2 +- .../Packets/TaxiPackets.cs | 2 +- .../Packets/TicketPackets.cs | 2 +- .../Packets/TokenPackets.cs | 2 +- .../Packets/TotemPackets.cs | 2 +- .../Packets/ToyPackets.cs | 2 +- .../Packets/TradePackets.cs | 2 +- .../Packets/TransmogrificationPackets.cs | 2 +- .../Packets/UpdatePackets.cs | 2 +- .../Packets/VehiclePackets.cs | 2 +- .../Packets/VoidStoragePackets.cs | 2 +- .../Packets/WardenPackets.cs | 2 +- .../Packets/WhoPackets.cs | 2 +- .../Packets/WorldStatePackets.cs | 2 +- .../{Network => Networking}/WorldSocket.cs | 110 ++- .../WorldSocketManager.cs | 3 +- Source/Game/OutdoorPVP/OutdoorPvP.cs | 6 +- Source/Game/OutdoorPVP/OutdoorPvPManager.cs | 2 +- .../OutdoorPVP/Zones/HellfirePeninsulaPvP.cs | 2 +- Source/Game/Phasing/PhasingHandler.cs | 2 +- Source/Game/Quest/Quest.cs | 28 +- .../Quest/QuestObjectiveCriteriaManager.cs | 4 +- Source/Game/Reputation/ReputationManager.cs | 2 +- Source/Game/Scenarios/InstanceScenario.cs | 2 +- Source/Game/Scenarios/Scenario.cs | 4 +- Source/Game/Server/WorldManager.cs | 43 +- Source/Game/Server/WorldSession.cs | 31 +- Source/Game/Services/GameUtilitiesService.cs | 2 +- Source/Game/Spells/Auras/Aura.cs | 2 +- Source/Game/Spells/Auras/AuraEffect.cs | 2 +- Source/Game/Spells/Spell.cs | 2 +- Source/Game/Spells/SpellCastTargets.cs | 2 +- Source/Game/Spells/SpellEffects.cs | 2 +- Source/Game/Spells/SpellHistory.cs | 2 +- Source/Game/SupportSystem/SupportTickets.cs | 2 +- Source/Game/Text/ChatTextBuilder.cs | 14 +- Source/Game/Text/CreatureTextManager.cs | 26 +- Source/Game/Warden/Warden.cs | 2 +- Source/Game/Warden/WardenWin.cs | 2 +- Source/Game/Weather/WeatherManager.cs | 2 +- .../IcecrownCitadel/GunshipBattle.cs | 2 +- .../InstanceIcecrownCitadel.cs | 2 +- .../Northrend/Ulduar/UlduarInstance.cs | 2 +- Source/Scripts/Northrend/Ulduar/Xt002.cs | 2 +- Source/Scripts/Spells/Generic.cs | 2 +- Source/WorldServer/Server.cs | 16 +- 318 files changed, 2046 insertions(+), 4694 deletions(-) create mode 100644 Source/BNetServer/Managers/LoginServiceManager.cs delete mode 100644 Source/BNetServer/Managers/SessionManager.cs create mode 100644 Source/BNetServer/Networking/Services/Account.cs create mode 100644 Source/BNetServer/Networking/Services/Authentication.cs create mode 100644 Source/BNetServer/Networking/Services/Connection.cs create mode 100644 Source/BNetServer/Networking/Services/GameUtilities.cs delete mode 100644 Source/BNetServer/Services/AccountService.cs delete mode 100644 Source/BNetServer/Services/AuthenticationService.cs delete mode 100644 Source/BNetServer/Services/ChallengeService.cs delete mode 100644 Source/BNetServer/Services/ConnectionService.cs delete mode 100644 Source/BNetServer/Services/FriendService.cs delete mode 100644 Source/BNetServer/Services/GameUtilitiesService.cs delete mode 100644 Source/BNetServer/Services/PresenceService.cs delete mode 100644 Source/BNetServer/Services/ReportService.cs delete mode 100644 Source/BNetServer/Services/ResourcesService.cs delete mode 100644 Source/BNetServer/Services/ServiceDispatcher.cs delete mode 100644 Source/BNetServer/Services/UserManagerService.cs create mode 100644 Source/Framework/Realm/RealmId.cs delete mode 100644 Source/Framework/Rest/Authentication/LogonData.cs delete mode 100644 Source/Framework/Rest/Forms/FormInput.cs delete mode 100644 Source/Framework/Rest/Forms/FormInputValue.cs delete mode 100644 Source/Framework/Rest/Forms/FormInputs.cs delete mode 100644 Source/Framework/Rest/Misc/Address.cs delete mode 100644 Source/Framework/Rest/Misc/AddressFamily.cs delete mode 100644 Source/Framework/Rest/Misc/ClientVersion.cs delete mode 100644 Source/Framework/Rest/Misc/RealmCharacterCountEntry.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmCharacterCountList.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmListServerIPAddresses.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmListTicketClientInformation.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmListTicketIdentity.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmListUpdate.cs delete mode 100644 Source/Framework/Rest/Realmlist/RealmListUpdates.cs create mode 100644 Source/Framework/Web/API/ApiRequest.cs create mode 100644 Source/Framework/Web/Rest/Authentication/LogonData.cs rename Source/Framework/{ => Web}/Rest/Authentication/LogonResult.cs (53%) create mode 100644 Source/Framework/Web/Rest/Forms/FormInput.cs create mode 100644 Source/Framework/Web/Rest/Forms/FormInputValue.cs create mode 100644 Source/Framework/Web/Rest/Forms/FormInputs.cs create mode 100644 Source/Framework/Web/Rest/Misc/Address.cs create mode 100644 Source/Framework/Web/Rest/Misc/AddressFamily.cs create mode 100644 Source/Framework/Web/Rest/Misc/ClientVersion.cs create mode 100644 Source/Framework/Web/Rest/Misc/RealmCharacterCountEntry.cs create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmCharacterCountList.cs rename Source/Framework/{ => Web}/Rest/Realmlist/RealmEntry.cs (57%) create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmListServerIPAddresses.cs create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmListTicketClientInformation.cs create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmListTicketIdentity.cs rename Source/Framework/{ => Web}/Rest/Realmlist/RealmListTicketInformation.cs (65%) create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmListUpdate.cs create mode 100644 Source/Framework/Web/Rest/Realmlist/RealmListUpdates.cs rename Source/Game/{Network => Networking}/Packet.cs (99%) rename Source/Game/{Network => Networking}/PacketLog.cs (85%) rename Source/Game/{Network => Networking}/PacketManager.cs (99%) rename Source/Game/{Network => Networking}/PacketUtilities.cs (99%) rename Source/Game/{Network => Networking}/Packets/AchievementPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/AddonPackets.cs (97%) rename Source/Game/{Network => Networking}/Packets/AreaTriggerPackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/ArtifactPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/AuctionHousePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/AuthenticationPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/AzeritePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/BankPackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/BattleGroundPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/BattlePetPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/BattlefieldPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/BattlenetPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/BlackMarketPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/CalendarPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ChannelPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/CharacterPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ChatPackets.cs (97%) rename Source/Game/{Network => Networking}/Packets/ClientConfigPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/CollectionPackets.cs (97%) rename Source/Game/{Network => Networking}/Packets/CombatLogPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/CombatPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/DuelPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/EquipmentPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/GameObjectPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/GarrisonPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/GuildFinderPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/GuildPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/HotfixPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/InspectPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/InstancePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ItemPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/LFGPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/LootPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/MailPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/MiscPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/MovementPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/NPCPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/PartyPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/PetPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/PetitionPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/QueryPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/QuestPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ReferAFriendPackets.cs (97%) rename Source/Game/{Network => Networking}/Packets/ReputationPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ScenarioPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/ScenePackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/SocialPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/SpellPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/SystemPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TalentPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TaxiPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TicketPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TokenPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TotemPackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/ToyPackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/TradePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/TransmogrificationPackets.cs (98%) rename Source/Game/{Network => Networking}/Packets/UpdatePackets.cs (97%) rename Source/Game/{Network => Networking}/Packets/VehiclePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/VoidStoragePackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/WardenPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/WhoPackets.cs (99%) rename Source/Game/{Network => Networking}/Packets/WorldStatePackets.cs (98%) rename Source/Game/{Network => Networking}/WorldSocket.cs (94%) rename Source/Game/{Network => Networking}/WorldSocketManager.cs (99%) diff --git a/Source/BNetServer/BNetServer.conf.dist b/Source/BNetServer/BNetServer.conf.dist index b20fec8e8..867097dc6 100644 --- a/Source/BNetServer/BNetServer.conf.dist +++ b/Source/BNetServer/BNetServer.conf.dist @@ -4,15 +4,6 @@ ################################################################################################### # BNet SERVER SETTINGS -# -# LogsDir -# Description: Logs directory setting. -# Important: LogsDir needs to be quoted, as the string might contain space characters. -# Logs directory must exists, or log file creation will be disabled. -# Default: "Logs" - (Log files will be stored in the current path) - -LogsDir = "Logs" - # # BattlenetPort # Description: TCP port to reach the auth server for battle.net connections. @@ -177,6 +168,15 @@ Updates.CleanDeadRefMaxCount = 3 ################################################################################################### # # LOGGING SYSTEM SETTINGS +# +# LogsDir +# Description: Logs directory setting. +# Important: LogsDir needs to be quoted, as the string might contain space characters. +# Logs directory must exists, or log file creation will be disabled. +# Default: "Logs" - (Log files will be stored in the current path) + +LogsDir = "Logs" + # # Appender config values: Given a appender "name" # Appender.name diff --git a/Source/BNetServer/BNetServer.csproj b/Source/BNetServer/BNetServer.csproj index 8bf1aa458..fe7748683 100644 --- a/Source/BNetServer/BNetServer.csproj +++ b/Source/BNetServer/BNetServer.csproj @@ -1,13 +1,14 @@ - + Exe netcoreapp3.1 BNetServer.Server Red.ico - 8.0 - + + + diff --git a/Source/BNetServer/Managers/Global.cs b/Source/BNetServer/Managers/Global.cs index 507a12711..7a5aadccf 100644 --- a/Source/BNetServer/Managers/Global.cs +++ b/Source/BNetServer/Managers/Global.cs @@ -1,28 +1,13 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. -using BNetServer.Services; +using System; +using System.Collections.Generic; +using System.Text; +using BNetServer; -namespace BNetServer +public static class Global { - public static class Global - { - public static RealmManager RealmMgr { get { return RealmManager.Instance; } } - public static SessionManager SessionMgr { get { return SessionManager.Instance; } } - public static ServiceDispatcher ServiceDispatcher { get { return ServiceDispatcher.Instance; } } - } -} + public static RealmManager RealmMgr { get { return RealmManager.Instance; } } + public static LoginServiceManager LoginServiceMgr { get { return LoginServiceManager.Instance; } } +} \ No newline at end of file diff --git a/Source/BNetServer/Managers/LoginServiceManager.cs b/Source/BNetServer/Managers/LoginServiceManager.cs new file mode 100644 index 000000000..cec2260f0 --- /dev/null +++ b/Source/BNetServer/Managers/LoginServiceManager.cs @@ -0,0 +1,195 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using BNetServer.Networking; +using Framework.Configuration; +using Framework.Constants; +using Framework.Web; +using Google.Protobuf; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; + +namespace BNetServer +{ + public class LoginServiceManager : Singleton + { + ConcurrentDictionary<(uint ServiceHash, uint MethodId), BnetServiceHandler> serviceHandlers; + FormInputs formInputs; + IPEndPoint externalAddress; + IPEndPoint localAddress; + X509Certificate2 certificate; + + LoginServiceManager() + { + serviceHandlers = new ConcurrentDictionary<(uint ServiceHash, uint MethodId), BnetServiceHandler>(); + formInputs = new FormInputs(); + } + + public void Initialize() + { + int port = ConfigMgr.GetDefaultValue("LoginREST.Port", 8081); + if (port < 0 || port > 0xFFFF) + { + Log.outError(LogFilter.Network, $"Specified login service port ({port}) out of allowed range (1-65535), defaulting to 8081"); + port = 8081; + } + + string configuredAddress = ConfigMgr.GetDefaultValue("LoginREST.ExternalAddress", "127.0.0.1"); + IPAddress address; + if (!IPAddress.TryParse(configuredAddress, out address)) + { + Log.outError(LogFilter.Network, $"Could not resolve LoginREST.ExternalAddress {configuredAddress}"); + return; + } + externalAddress = new IPEndPoint(address, port); + + configuredAddress = ConfigMgr.GetDefaultValue("LoginREST.LocalAddress", "127.0.0.1"); + if (!IPAddress.TryParse(configuredAddress, out address)) + { + Log.outError(LogFilter.Network, $"Could not resolve LoginREST.ExternalAddress {configuredAddress}"); + return; + } + + localAddress = new IPEndPoint(address, port); + + // set up form inputs + formInputs.Type = "LOGIN_FORM"; + + var input = new FormInput(); + input.Id = "account_name"; + input.Type = "text"; + input.Label = "E-mail"; + input.MaxLength = 320; + formInputs.Inputs.Add(input); + + input = new FormInput(); + input.Id = "password"; + input.Type = "password"; + input.Label = "Password"; + input.MaxLength = 16; + formInputs.Inputs.Add(input); + + input = new FormInput(); + input.Id = "log_in_submit"; + input.Type = "submit"; + input.Label = "Log In"; + formInputs.Inputs.Add(input); + + certificate = new X509Certificate2("BNetServer.pfx"); + + Assembly currentAsm = Assembly.GetExecutingAssembly(); + foreach (var type in currentAsm.GetTypes()) + { + foreach (var methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic)) + { + foreach (var serviceAttr in methodInfo.GetCustomAttributes()) + { + if (serviceAttr == null) + continue; + + var key = (serviceAttr.ServiceHash, serviceAttr.MethodId); + if (serviceHandlers.ContainsKey(key)) + { + Log.outError(LogFilter.Network, $"Tried to override ServiceHandler: {serviceHandlers[key]} with {methodInfo.Name} (ServiceHash: {serviceAttr.ServiceHash} MethodId: {serviceAttr.MethodId})"); + continue; + } + + var parameters = methodInfo.GetParameters(); + if (parameters.Length == 0) + { + Log.outError(LogFilter.Network, $"Method: {methodInfo.Name} needs atleast one paramter"); + continue; + } + + serviceHandlers[key] = new BnetServiceHandler(methodInfo, parameters); + } + } + } + } + + public BnetServiceHandler GetHandler(uint serviceHash, uint methodId) + { + return serviceHandlers.LookupByKey((serviceHash, methodId)); + } + + public IPEndPoint GetAddressForClient(IPAddress address) + { + if (IPAddress.IsLoopback(address)) + return localAddress; + + return externalAddress; + } + + public FormInputs GetFormInput() + { + return formInputs; + } + + public X509Certificate2 GetCertificate() + { + return certificate; + } + } + + public class BnetServiceHandler + { + Delegate methodCaller; + Type requestType; + Type responseType; + + public BnetServiceHandler(MethodInfo info, ParameterInfo[] parameters) + { + requestType = parameters[0].ParameterType; + if (parameters.Length > 1) + responseType = parameters[1].ParameterType; + + if (responseType != null) + methodCaller = info.CreateDelegate(Expression.GetDelegateType(new[] { typeof(Session), requestType, responseType, info.ReturnType })); + else + methodCaller = info.CreateDelegate(Expression.GetDelegateType(new[] { typeof(Session), requestType, info.ReturnType })); + } + + public void Invoke(Session session, uint token, CodedInputStream stream) + { + var request = (IMessage)Activator.CreateInstance(requestType); + request.MergeFrom(stream); + + BattlenetRpcErrorCode status; + if (responseType != null) + { + var response = (IMessage)Activator.CreateInstance(responseType); + status = (BattlenetRpcErrorCode)methodCaller.DynamicInvoke(session, request, response); + Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server Method: {1}) Returned: {2} Status: {3}.", session.GetClientInfo(), request, response, status); + if (status == 0) + session.SendResponse(token, response); + else + session.SendResponse(token, status); + } + else + { + status = (BattlenetRpcErrorCode)methodCaller.DynamicInvoke(session, request); + Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server Method: {1}) Status: {2}.", session.GetClientInfo(), request, status); + if (status != 0) + session.SendResponse(token, status); + } + } + } + + [AttributeUsage(AttributeTargets.Method)] + public sealed class ServiceAttribute : System.Attribute + { + public uint ServiceHash { get; set; } + public uint MethodId { get; set; } + + public ServiceAttribute(OriginalHash serviceHash, uint methodId) + { + ServiceHash = (uint)serviceHash; + MethodId = methodId; + } + } +} \ No newline at end of file diff --git a/Source/BNetServer/Managers/SessionManager.cs b/Source/BNetServer/Managers/SessionManager.cs deleted file mode 100644 index 60557d5aa..000000000 --- a/Source/BNetServer/Managers/SessionManager.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Framework.Configuration; -using Framework.Rest; -using System.Net; -using System.Security.Cryptography.X509Certificates; - -namespace BNetServer -{ - public class SessionManager : Singleton - { - SessionManager() - { - _formInputs = new FormInputs(); - } - - public bool Initialize() - { - int _port = ConfigMgr.GetDefaultValue("LoginREST.Port", 8081); - if (_port < 0 || _port > 0xFFFF) - { - Log.outError(LogFilter.Network, "Specified login service port ({0}) out of allowed range (1-65535), defaulting to 8081", _port); - _port = 8081; - } - - string configuredAddress = ConfigMgr.GetDefaultValue("LoginREST.ExternalAddress", "127.0.0.1"); - IPAddress address; - if (!IPAddress.TryParse(configuredAddress, out address)) - { - Log.outError(LogFilter.Network, "Could not resolve LoginREST.ExternalAddress {0}", configuredAddress); - return false; - } - _externalAddress = new IPEndPoint(address, _port); - - configuredAddress = ConfigMgr.GetDefaultValue("LoginREST.LocalAddress", "127.0.0.1"); - if (!IPAddress.TryParse(configuredAddress, out address)) - { - Log.outError(LogFilter.Network, "Could not resolve LoginREST.ExternalAddress {0}", configuredAddress); - return false; - } - - _localAddress = new IPEndPoint(address, _port); - - // set up form inputs - _formInputs.Type = "LOGIN_FORM"; - - var input = new FormInput(); - input.Id = "account_name"; - input.Type = "text"; - input.Label = "E-mail"; - input.MaxLength = 320; - _formInputs.Inputs.Add(input); - - input = new FormInput(); - input.Id = "password"; - input.Type = "password"; - input.Label = "Password"; - input.MaxLength = 16; - _formInputs.Inputs.Add(input); - - input = new FormInput(); - input.Id = "log_in_submit"; - input.Type = "submit"; - input.Label = "Log In"; - _formInputs.Inputs.Add(input); - - _certificate = new X509Certificate2("BNetServer.pfx"); - - return true; - } - - public IPEndPoint GetAddressForClient(IPAddress address) - { - if (IPAddress.IsLoopback(address)) - return _localAddress; - - return _externalAddress; - } - - public FormInputs GetFormInput() - { - return _formInputs; - } - - public X509Certificate2 GetCertificate() - { - return _certificate; - } - - FormInputs _formInputs; - IPEndPoint _externalAddress; - IPEndPoint _localAddress; - X509Certificate2 _certificate; - } - - public enum BanMode - { - Ip = 0, - Account = 1 - } -} diff --git a/Source/BNetServer/Networking/RestSession.cs b/Source/BNetServer/Networking/RestSession.cs index d1071bb30..2f8077160 100644 --- a/Source/BNetServer/Networking/RestSession.cs +++ b/Source/BNetServer/Networking/RestSession.cs @@ -1,30 +1,17 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. -using Framework.Configuration; -using Framework.Database; -using Framework.Networking; -using Framework.Rest; -using Framework.Serialization; -using Framework.Web; using System; -using System.Net.Sockets; -using System.Security.Cryptography; +using System.Collections.Generic; using System.Text; +using Framework.Networking; +using System.Net.Sockets; +using Framework.Web; +using Framework.Constants; +using Framework.Database; +using Framework.Configuration; +using Framework.Serialization; +using System.Security.Cryptography; namespace BNetServer.Networking { @@ -32,14 +19,14 @@ namespace BNetServer.Networking { public RestSession(Socket socket) : base(socket) { } - public override void Start() + public override void Accept() { - AsyncHandshake(Global.SessionMgr.GetCertificate()); + AsyncHandshake(Global.LoginServiceMgr.GetCertificate()); } - public override void ReadHandler(int transferredBytes) - { - var httpRequest = HttpHelper.ParseRequest(GetReceiveBuffer(), transferredBytes); + public async override void ReadHandler(byte[] data, int receivedLength) + { + var httpRequest = HttpHelper.ParseRequest(data, receivedLength); if (httpRequest == null) return; @@ -47,20 +34,14 @@ namespace BNetServer.Networking { case "GET": default: - HandleConnectRequest(httpRequest); + SendResponse(HttpCode.Ok, Global.LoginServiceMgr.GetFormInput()); break; case "POST": HandleLoginRequest(httpRequest); return; } - AsyncRead(); - } - - public void HandleConnectRequest(HttpHeader request) - { - // Login form is the same for all clients... - SendResponse(HttpCode.Ok, Global.SessionMgr.GetFormInput()); + await AsyncRead(); } public void HandleLoginRequest(HttpHeader request) @@ -92,7 +73,7 @@ namespace BNetServer.Networking } } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_AUTHENTICATION); + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetAuthentication); stmt.AddValue(0, login); SQLResult result = DB.Login.Query(stmt); @@ -113,7 +94,7 @@ namespace BNetServer.Networking loginTicket = "TC-" + ticket.ToHexString(); } - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_AUTHENTICATION); + stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetAuthentication); stmt.AddValue(0, loginTicket); stmt.AddValue(1, Time.UnixTime + 3600); stmt.AddValue(2, accountId); @@ -126,39 +107,39 @@ namespace BNetServer.Networking uint maxWrongPassword = ConfigMgr.GetDefaultValue("WrongPass.MaxCount", 0u); if (ConfigMgr.GetDefaultValue("WrongPass.Logging", false)) - Log.outDebug(LogFilter.Network, "[{0}, Account {1}, Id {2}] Attempted to connect with wrong password!", request.Host, login, accountId); + Log.outDebug(LogFilter.Network, $"[{request.Host}, Account {login}, Id {accountId}] Attempted to connect with wrong password!"); if (maxWrongPassword != 0) { SQLTransaction trans = new SQLTransaction(); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_FAILED_LOGINS); + stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins); stmt.AddValue(0, accountId); trans.Append(stmt); ++failedLogins; - Log.outDebug(LogFilter.Network, "MaxWrongPass : {0}, failed_login : {1}", maxWrongPassword, accountId); + Log.outDebug(LogFilter.Network, "MaxWrongPass : {maxWrongPassword}, failed_login : {accountId}"); if (failedLogins >= maxWrongPassword) { - BanMode banType = ConfigMgr.GetDefaultValue("WrongPass.BanType", BanMode.Ip); + BanMode banType = ConfigMgr.GetDefaultValue("WrongPass.BanType", BanMode.IP); int banTime = ConfigMgr.GetDefaultValue("WrongPass.BanTime", 600); if (banType == BanMode.Account) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ACCOUNT_AUTO_BANNED); + stmt = DB.Login.GetPreparedStatement(LoginStatements.InsBnetAccountAutoBanned); stmt.AddValue(0, accountId); } else { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_IP_AUTO_BANNED); + stmt = DB.Login.GetPreparedStatement(LoginStatements.InsIpAutoBanned); stmt.AddValue(0, request.Host); } stmt.AddValue(1, banTime); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_RESET_FAILED_LOGINS); + stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetResetFailedLogins); stmt.AddValue(0, accountId); trans.Append(stmt); } @@ -171,7 +152,7 @@ namespace BNetServer.Networking SendResponse(HttpCode.Ok, loginResult); } else - { + { loginResult.AuthenticationState = "LOGIN"; loginResult.ErrorCode = "UNABLE_TO_DECODE"; loginResult.ErrorMessage = "There was an internal error while connecting to Battle.net. Please try again later."; @@ -179,9 +160,9 @@ namespace BNetServer.Networking } } - void SendResponse(HttpCode code, T response) + async void SendResponse(HttpCode code, T response) { - AsyncWrite(HttpHelper.CreateResponse(code, Json.CreateString(response))); + await AsyncWrite(HttpHelper.CreateResponse(code, Json.CreateString(response))); } string CalculateShaPassHash(string name, string password) diff --git a/Source/BNetServer/Networking/Services/Account.cs b/Source/BNetServer/Networking/Services/Account.cs new file mode 100644 index 000000000..24e58d2a1 --- /dev/null +++ b/Source/BNetServer/Networking/Services/Account.cs @@ -0,0 +1,76 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Bgs.Protocol.Account.V1; +using Framework.Constants; +using System.Collections.Generic; + +namespace BNetServer.Networking +{ + public partial class Session + { + [Service(OriginalHash.AccountService, 30)] + BattlenetRpcErrorCode HandleGetAccountState(GetAccountStateRequest request, GetAccountStateResponse response) + { + if (!authed) + return BattlenetRpcErrorCode.Denied; + + if (request.Options.FieldPrivacyInfo) + { + response.State = new AccountState(); + response.State.PrivacyInfo = new PrivacyInfo(); + response.State.PrivacyInfo.IsUsingRid = false; + response.State.PrivacyInfo.IsVisibleForViewFriends = false; + response.State.PrivacyInfo.IsHiddenFromFriendFinder = true; + + response.Tags = new AccountFieldTags(); + response.Tags.PrivacyInfoTag = 0xD7CA834D; + } + + return BattlenetRpcErrorCode.Ok; + } + + [Service(OriginalHash.AccountService, 31)] + BattlenetRpcErrorCode HandleGetGameAccountState(GetGameAccountStateRequest request, GetGameAccountStateResponse response) + { + if (!authed) + return BattlenetRpcErrorCode.Denied; + + if (request.Options.FieldGameLevelInfo) + { + var gameAccountInfo = accountInfo.GameAccounts.LookupByKey(request.GameAccountId.Low); + if (gameAccountInfo != null) + { + response.State = new GameAccountState(); + response.State.GameLevelInfo = new GameLevelInfo(); + response.State.GameLevelInfo.Name = gameAccountInfo.DisplayName; + response.State.GameLevelInfo.Program = 5730135; // WoW + } + + response.Tags = new GameAccountFieldTags(); + response.Tags.GameLevelInfoTag = 0x5C46D483; + } + + if (request.Options.FieldGameStatus) + { + if (response.State == null) + response.State = new GameAccountState(); + + response.State.GameStatus = new GameStatus(); + + var gameAccountInfo = accountInfo.GameAccounts.LookupByKey(request.GameAccountId.Low); + if (gameAccountInfo != null) + { + response.State.GameStatus.IsSuspended = gameAccountInfo.IsBanned; + response.State.GameStatus.IsBanned = gameAccountInfo.IsPermanenetlyBanned; + response.State.GameStatus.SuspensionExpires = (gameAccountInfo.UnbanDate * 1000000); + } + + response.State.GameStatus.Program = 5730135; // WoW + response.Tags.GameStatusTag = 0x98B75F99; + } + + return BattlenetRpcErrorCode.Ok; + } + } +} diff --git a/Source/BNetServer/Networking/Services/Authentication.cs b/Source/BNetServer/Networking/Services/Authentication.cs new file mode 100644 index 000000000..88a6ade59 --- /dev/null +++ b/Source/BNetServer/Networking/Services/Authentication.cs @@ -0,0 +1,169 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Bgs.Protocol; +using Bgs.Protocol.Authentication.V1; +using Bgs.Protocol.Challenge.V1; +using Framework.Constants; +using Framework.Database; +using Google.Protobuf; +using System; +using Framework.Realm; +using System.Net; + +namespace BNetServer.Networking +{ + public partial class Session + { + [Service(OriginalHash.AuthenticationService, 1)] + BattlenetRpcErrorCode HandleLogon(LogonRequest logonRequest, NoData response) + { + if (logonRequest.Program != "WoW") + { + Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with game other than WoW (using {logonRequest.Program})!"); + return BattlenetRpcErrorCode.BadProgram; + } + + if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64") + { + Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in from an unsupported platform (using {logonRequest.Platform})!"); + return BattlenetRpcErrorCode.BadPlatform; + } + + if (logonRequest.Locale.ToEnum() == Locale.enUS && logonRequest.Locale != "enUS") + { + Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with unsupported locale (using {logonRequest.Locale})!"); + return BattlenetRpcErrorCode.BadLocale; + } + + locale = logonRequest.Locale; + os = logonRequest.Platform; + build = (uint)logonRequest.ApplicationVersion; + + var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address); + + ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest(); + externalChallenge.PayloadType = "web_auth_url"; + externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/"); + + SendRequest((uint)OriginalHash.ChallengeListener, 3, externalChallenge); + return BattlenetRpcErrorCode.Ok; + } + + [Service(OriginalHash.AuthenticationService, 7)] + BattlenetRpcErrorCode HandleVerifyWebCredentials(VerifyWebCredentialsRequest verifyWebCredentialsRequest) + { + if (verifyWebCredentialsRequest.WebCredentials.IsEmpty) + return BattlenetRpcErrorCode.Denied; + + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetAccountInfo); + stmt.AddValue(0, verifyWebCredentialsRequest.WebCredentials.ToStringUtf8()); + + SQLResult result = DB.Login.Query(stmt); + if (result.IsEmpty()) + return BattlenetRpcErrorCode.Denied; + + accountInfo = new AccountInfo(result); + + if (accountInfo.LoginTicketExpiry < Time.UnixTime) + return BattlenetRpcErrorCode.TimedOut; + + stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetCharacterCountsByAccountId); + stmt.AddValue(0, accountInfo.Id); + + SQLResult characterCountsResult = DB.Login.Query(stmt); + if (!characterCountsResult.IsEmpty()) + { + do + { + var realmId = new RealmId(characterCountsResult.Read(3), characterCountsResult.Read(4), characterCountsResult.Read(2)); + accountInfo.GameAccounts[characterCountsResult.Read(0)].CharacterCounts[realmId.GetAddress()] = characterCountsResult.Read(1); + + } while (characterCountsResult.NextRow()); + } + + stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetLastPlayerCharacters); + stmt.AddValue(0, accountInfo.Id); + + SQLResult lastPlayerCharactersResult = DB.Login.Query(stmt); + if (!lastPlayerCharactersResult.IsEmpty()) + { + do + { + var realmId = new RealmId(lastPlayerCharactersResult.Read(1), lastPlayerCharactersResult.Read(2), lastPlayerCharactersResult.Read(3)); + + LastPlayedCharacterInfo lastPlayedCharacter = new LastPlayedCharacterInfo(); + lastPlayedCharacter.RealmId = realmId; + lastPlayedCharacter.CharacterName = lastPlayerCharactersResult.Read(4); + lastPlayedCharacter.CharacterGUID = lastPlayerCharactersResult.Read(5); + lastPlayedCharacter.LastPlayedTime = lastPlayerCharactersResult.Read(6); + + accountInfo.GameAccounts[lastPlayerCharactersResult.Read(0)].LastPlayedCharacters[realmId.GetSubRegionAddress()] = lastPlayedCharacter; + + } while (lastPlayerCharactersResult.NextRow()); + } + + string ip_address = GetRemoteIpEndPoint().ToString(); + + // If the IP is 'locked', check that the player comes indeed from the correct IP address + if (accountInfo.IsLockedToIP) + { + Log.outDebug(LogFilter.Session, $"Session.HandleVerifyWebCredentials: Account: {accountInfo.Login} is locked to IP: {accountInfo.LastIP} is logging in from IP: {ip_address}"); + + if (accountInfo.LastIP != ip_address) + return BattlenetRpcErrorCode.RiskAccountLocked; + } + else + { + Log.outDebug(LogFilter.Session, $"Session.HandleVerifyWebCredentials: Account: {accountInfo.Login} is not locked to ip"); + if (accountInfo.LockCountry.IsEmpty() || accountInfo.LockCountry == "00") + Log.outDebug(LogFilter.Session, $"Session.HandleVerifyWebCredentials: Account: {accountInfo.Login} is not locked to country"); + else if (!accountInfo.LockCountry.IsEmpty() && !ipCountry.IsEmpty()) + { + Log.outDebug(LogFilter.Session, $"Session.HandleVerifyWebCredentials: Account: {accountInfo.Login} is locked to Country: {accountInfo.LockCountry} player Country: {ipCountry}"); + + if (ipCountry != accountInfo.LockCountry) + return BattlenetRpcErrorCode.RiskAccountLocked; + } + } + + // If the account is banned, reject the logon attempt + if (accountInfo.IsBanned) + { + if (accountInfo.IsPermanenetlyBanned) + { + Log.outDebug(LogFilter.Session, $"{GetClientInfo()} Session.HandleVerifyWebCredentials: Banned account {accountInfo.Login} tried to login!"); + return BattlenetRpcErrorCode.GameAccountBanned; + } + else + { + Log.outDebug(LogFilter.Session, $"{GetClientInfo()} Session.HandleVerifyWebCredentials: Temporarily banned account {accountInfo.Login} tried to login!"); + return BattlenetRpcErrorCode.GameAccountSuspended; + } + } + + LogonResult logonResult = new LogonResult(); + logonResult.ErrorCode = 0; + logonResult.AccountId = new EntityId(); + logonResult.AccountId.Low = accountInfo.Id; + logonResult.AccountId.High = 0x100000000000000; + foreach (var pair in accountInfo.GameAccounts) + { + EntityId gameAccountId = new EntityId(); + gameAccountId.Low = pair.Value.Id; + gameAccountId.High = 0x200000200576F57; + logonResult.GameAccountId.Add(gameAccountId); + } + + if (!ipCountry.IsEmpty()) + logonResult.GeoipCountry = ipCountry; + + logonResult.SessionKey = ByteString.CopyFrom(new byte[64].GenerateRandomKey(64)); + + authed = true; + + SendRequest((uint)OriginalHash.AuthenticationListener, 5, logonResult); + return BattlenetRpcErrorCode.Ok; + } + } +} \ No newline at end of file diff --git a/Source/BNetServer/Networking/Services/Connection.cs b/Source/BNetServer/Networking/Services/Connection.cs new file mode 100644 index 000000000..0d1f84c47 --- /dev/null +++ b/Source/BNetServer/Networking/Services/Connection.cs @@ -0,0 +1,48 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Bgs.Protocol.Connection.V1; +using Framework.Constants; +using System.Collections.Generic; +using Google.Protobuf; +using Bgs.Protocol; +using System.Diagnostics; + +namespace BNetServer.Networking +{ + public partial class Session + { + [Service(OriginalHash.ConnectionService, 1)] + BattlenetRpcErrorCode HandleConnect(ConnectRequest request, ConnectResponse response) + { + if (request.ClientId != null) + response.ClientId.MergeFrom(request.ClientId); + + response.ServerId = new ProcessId(); + response.ServerId.Label = (uint)Process.GetCurrentProcess().Id; + response.ServerId.Epoch = (uint)Time.UnixTime; + response.ServerTime = (ulong)Time.UnixTimeMilliseconds; + + response.UseBindlessRpc = request.UseBindlessRpc; + + return BattlenetRpcErrorCode.Ok; + } + + [Service(OriginalHash.ConnectionService, 5)] + BattlenetRpcErrorCode HandleKeepAlive(NoData request) + { + return BattlenetRpcErrorCode.Ok; + } + + [Service(OriginalHash.ConnectionService, 7)] + BattlenetRpcErrorCode HandleRequestDisconnect(DisconnectRequest request) + { + var disconnectNotification = new DisconnectNotification(); + disconnectNotification.ErrorCode = request.ErrorCode; + SendRequest((uint)OriginalHash.ConnectionService, 4, disconnectNotification); + + CloseSocket(); + return BattlenetRpcErrorCode.Ok; + } + } +} \ No newline at end of file diff --git a/Source/BNetServer/Networking/Services/GameUtilities.cs b/Source/BNetServer/Networking/Services/GameUtilities.cs new file mode 100644 index 000000000..d20de084f --- /dev/null +++ b/Source/BNetServer/Networking/Services/GameUtilities.cs @@ -0,0 +1,207 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using Bgs.Protocol; +using Bgs.Protocol.GameUtilities.V1; +using Framework.Constants; +using Framework.Database; +using Framework.Serialization; +using Framework.Web; +using Google.Protobuf; +using System; +using System.Collections.Generic; + +namespace BNetServer.Networking +{ + public partial class Session + { + [Service(OriginalHash.GameUtilitiesService, 1)] + BattlenetRpcErrorCode HandleProcessClientRequest(ClientRequest request, ClientResponse response) + { + if (!authed) + return BattlenetRpcErrorCode.Denied; + + Bgs.Protocol.Attribute command = null; + Dictionary Params = new Dictionary(); + + for (int i = 0; i < request.Attribute.Count; ++i) + { + Bgs.Protocol.Attribute attr = request.Attribute[i]; + Params[attr.Name] = attr.Value; + if (attr.Name.Contains("Command_")) + command = attr; + } + + if (command == null) + { + Log.outError(LogFilter.SessionRpc, $"{GetClientInfo()} sent ClientRequest with no command."); + return BattlenetRpcErrorCode.RpcMalformedRequest; + } + + return command.Name switch + { + "Command_RealmListTicketRequest_v1_b9" => GetRealmListTicket(Params, response), + "Command_LastCharPlayedRequest_v1_b9" => GetLastCharPlayed(Params, response), + "Command_RealmListRequest_v1_b9" => GetRealmList(Params, response), + "Command_RealmJoinRequest_v1_b9" => JoinRealm(Params, response), + _ => BattlenetRpcErrorCode.RpcNotImplemented + }; + } + + [Service(OriginalHash.GameUtilitiesService, 10)] + BattlenetRpcErrorCode HandleGetAllValuesForAttribute(GetAllValuesForAttributeRequest request, GetAllValuesForAttributeResponse response) + { + if (!authed) + return BattlenetRpcErrorCode.Denied; + + if (request.AttributeKey == "Command_RealmListRequest_v1_b9") + { + Global.RealmMgr.WriteSubRegions(response); + return BattlenetRpcErrorCode.Ok; + } + + return BattlenetRpcErrorCode.RpcNotImplemented; + } + + BattlenetRpcErrorCode GetRealmListTicket(Dictionary Params, ClientResponse response) + { + Variant identity = Params.LookupByKey("Param_Identity"); + if (identity != null) + { + var realmListTicketIdentity = Json.CreateObject(identity.BlobValue.ToStringUtf8(), true); + var gameAccount = accountInfo.GameAccounts.LookupByKey(realmListTicketIdentity.GameAccountId); + if (gameAccount != null) + gameAccountInfo = gameAccount; + } + + if (gameAccountInfo == null) + return BattlenetRpcErrorCode.UtilServerInvalidIdentityArgs; + + if (gameAccountInfo.IsPermanenetlyBanned) + return BattlenetRpcErrorCode.GameAccountBanned; + else if (gameAccountInfo.IsBanned) + return BattlenetRpcErrorCode.GameAccountSuspended; + + bool clientInfoOk = false; + Variant clientInfo = Params.LookupByKey("Param_ClientInfo"); + if (clientInfo != null) + { + var realmListTicketClientInformation = Json.CreateObject(clientInfo.BlobValue.ToStringUtf8(), true); + clientInfoOk = true; + int i = 0; + foreach (byte b in realmListTicketClientInformation.Info.Secret) + clientSecret[i++] = b; + } + + if (!clientInfoOk) + return BattlenetRpcErrorCode.WowServicesDeniedRealmListTicket; + + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetLastLoginInfo); + stmt.AddValue(0, GetRemoteIpEndPoint().ToString()); + stmt.AddValue(1, Enum.Parse(typeof(Locale), locale)); + stmt.AddValue(2, os); + stmt.AddValue(3, accountInfo.Id); + + DB.Login.Execute(stmt); + + var attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_RealmListTicket"; + attribute.Value = new Variant(); + attribute.Value.BlobValue = ByteString.CopyFrom("AuthRealmListTicket", System.Text.Encoding.UTF8); + response.Attribute.Add(attribute); + + return BattlenetRpcErrorCode.Ok; + } + + BattlenetRpcErrorCode GetLastCharPlayed(Dictionary Params, ClientResponse response) + { + Variant subRegion = Params.LookupByKey("Command_LastCharPlayedRequest_v1_b9"); + if (subRegion != null) + { + var lastPlayerChar = gameAccountInfo.LastPlayedCharacters.LookupByKey(subRegion.StringValue); + if (lastPlayerChar != null) + { + var compressed = Global.RealmMgr.GetRealmEntryJSON(lastPlayerChar.RealmId, build); + if (compressed.Length == 0) + return BattlenetRpcErrorCode.UtilServerFailedToSerializeResponse; + + var attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_RealmEntry"; + attribute.Value = new Variant(); + attribute.Value.BlobValue = ByteString.CopyFrom(compressed); + response.Attribute.Add(attribute); + + attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_CharacterName"; + attribute.Value = new Variant(); + attribute.Value.StringValue = lastPlayerChar.CharacterName; + response.Attribute.Add(attribute); + + attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_CharacterGUID"; + attribute.Value = new Variant(); + attribute.Value.BlobValue = ByteString.CopyFrom(BitConverter.GetBytes(lastPlayerChar.CharacterGUID)); + response.Attribute.Add(attribute); + + attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_LastPlayedTime"; + attribute.Value = new Variant(); + attribute.Value.IntValue = (int)lastPlayerChar.LastPlayedTime; + response.Attribute.Add(attribute); + } + + return BattlenetRpcErrorCode.Ok; + } + + return BattlenetRpcErrorCode.UtilServerUnknownRealm; + } + + BattlenetRpcErrorCode GetRealmList(Dictionary Params, ClientResponse response) + { + if (gameAccountInfo == null) + return BattlenetRpcErrorCode.UserServerBadWowAccount; + + string subRegionId = ""; + Variant subRegion = Params.LookupByKey("Command_RealmListRequest_v1_b9"); + if (subRegion != null) + subRegionId = subRegion.StringValue; + + var compressed = Global.RealmMgr.GetRealmList(build, subRegionId); + if (compressed.Length == 0) + return BattlenetRpcErrorCode.UtilServerFailedToSerializeResponse; + + var attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_RealmList"; + attribute.Value = new Variant(); + attribute.Value.BlobValue = ByteString.CopyFrom(compressed); + response.Attribute.Add(attribute); + + var realmCharacterCounts = new RealmCharacterCountList(); + foreach (var characterCount in gameAccountInfo.CharacterCounts) + { + var countEntry = new RealmCharacterCountEntry(); + countEntry.WowRealmAddress = (int)characterCount.Key; + countEntry.Count = characterCount.Value; + realmCharacterCounts.Counts.Add(countEntry); + } + + compressed = Json.Deflate("JSONRealmCharacterCountList", realmCharacterCounts); + + attribute = new Bgs.Protocol.Attribute(); + attribute.Name = "Param_CharacterCountList"; + attribute.Value = new Variant(); + attribute.Value.BlobValue = ByteString.CopyFrom(compressed); + response.Attribute.Add(attribute); + return BattlenetRpcErrorCode.Ok; + } + + BattlenetRpcErrorCode JoinRealm(Dictionary Params, ClientResponse response) + { + Variant realmAddress = Params.LookupByKey("Param_RealmAddress"); + if (realmAddress != null) + return Global.RealmMgr.JoinRealm((uint)realmAddress.UintValue, build, GetRemoteIpEndPoint().Address, clientSecret, (Locale)Enum.Parse(typeof(Locale), locale), os, gameAccountInfo.Name, response); + + return BattlenetRpcErrorCode.WowServicesInvalidJoinTicket; + } + } +} diff --git a/Source/BNetServer/Networking/Session.cs b/Source/BNetServer/Networking/Session.cs index 450e7e3ba..0d7ebfe76 100644 --- a/Source/BNetServer/Networking/Session.cs +++ b/Source/BNetServer/Networking/Session.cs @@ -1,87 +1,80 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using Bgs.Protocol; -using Bgs.Protocol.Challenge.V1; using Framework.Constants; using Framework.Database; using Framework.IO; using Framework.Networking; -using Framework.Rest; -using Framework.Serialization; +using Framework.Realm; using Google.Protobuf; using System; using System.Collections.Generic; -using System.Linq; using System.Net.Sockets; namespace BNetServer.Networking { - public class Session : SSLSocket + partial class Session : SSLSocket { + AccountInfo accountInfo; + GameAccountInfo gameAccountInfo; + + string locale; + string os; + uint build; + string ipCountry; + + byte[] clientSecret; + bool authed; + uint requestToken; + + AsyncCallbackProcessor queryProcessor; + Dictionary> responseCallbacks; + public Session(Socket socket) : base(socket) { - _accountInfo = new AccountInfo(); - - ClientRequestHandlers.Add("Command_RealmListTicketRequest_v1_b9", GetRealmListTicket); - ClientRequestHandlers.Add("Command_LastCharPlayedRequest_v1_b9", GetLastCharPlayed); - ClientRequestHandlers.Add("Command_RealmListRequest_v1_b9", GetRealmList); - ClientRequestHandlers.Add("Command_RealmJoinRequest_v1_b9", JoinRealm); + clientSecret = new byte[32]; + queryProcessor = new AsyncCallbackProcessor(); + responseCallbacks = new Dictionary>(); } - public override void Start() + public override void Accept() { - string ip_address = GetRemoteIpAddress().ToString(); - Log.outInfo(LogFilter.Network, "{0} Accepted connection", GetClientInfo()); + string ipAddress = GetRemoteIpEndPoint().ToString(); + Log.outInfo(LogFilter.Network, $"{GetClientInfo()} Connection Accepted."); // Verify that this IP is not in the ip_banned table - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS)); + DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_IP_INFO); - stmt.AddValue(0, ip_address); - stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpAddress().GetAddressBytes(), 0)); + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelIpInfo); + stmt.AddValue(0, ipAddress); + stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpEndPoint().Address.GetAddressBytes(), 0)); - _queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(CheckIpCallback)); - } - - void CheckIpCallback(SQLResult result) - { - if (!result.IsEmpty()) + queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(async result => { - bool banned = false; - do + if (!result.IsEmpty()) { - if (result.Read(0) != 0) - banned = true; + bool banned = false; + do + { + if (result.Read(0) != 0) + banned = true; - if (!string.IsNullOrEmpty(result.Read(1))) - _ipCountry = result.Read(1); + if (!string.IsNullOrEmpty(result.Read(1))) + ipCountry = result.Read(1); - } while (result.NextRow()); + } while (result.NextRow()); - if (banned) - { - Log.outDebug(LogFilter.Session, "{0} tries to log in using banned IP!", GetClientInfo()); - CloseSocket(); - return; + if (banned) + { + Log.outDebug(LogFilter.Session, $"{GetClientInfo()} trying to login with banned ipaddress!"); + CloseSocket(); + return; + } } - } - AsyncHandshake(Global.SessionMgr.GetCertificate()); + await AsyncHandshake(Global.LoginServiceMgr.GetCertificate()); + })); } public override bool Update() @@ -89,557 +82,137 @@ namespace BNetServer.Networking if (!base.Update()) return false; - _queryProcessor.ProcessReadyCallbacks(); + queryProcessor.ProcessReadyCallbacks(); return true; } - public override void ReadHandler(int transferredBytes) + public async override void ReadHandler(byte[] data, int receivedLength) { if (!IsOpen()) return; - var stream = new CodedInputStream(GetReceiveBuffer(), 0, transferredBytes); + var stream = new CodedInputStream(data); while (!stream.IsAtEnd) { var header = new Header(); stream.ReadMessage(header); - if (header.ServiceId != 0xFE) + if (header.ServiceId != 0xFE && header.ServiceHash != 0) { - Global.ServiceDispatcher.Dispatch(this, header.ServiceHash, header.Token, header.MethodId, stream); + var handler = Global.LoginServiceMgr.GetHandler(header.ServiceHash, header.MethodId); + if (handler != null) + handler.Invoke(this, header.Token, stream); + else + { + Log.outError(LogFilter.ServiceProtobuf, $"{GetClientInfo()} tried to call not implemented methodId: {header.MethodId} for servicehash: {header.ServiceHash}"); + SendResponse(header.Token, BattlenetRpcErrorCode.RpcNotImplemented); + } } else { - var handler = _responseCallbacks.LookupByKey(header.Token); + var handler = responseCallbacks.LookupByKey(header.Token); if (handler != null) { handler(stream); - _responseCallbacks.Remove(header.Token); + responseCallbacks.Remove(header.Token); } } } - AsyncRead(); + await AsyncRead(); } - void AsyncWrite(ByteBuffer packet) - { - if (!IsOpen()) - return; - - AsyncWrite(packet.GetData()); - } - - public void SendResponse(uint token, IMessage response) + public async void SendResponse(uint token, IMessage response) { Header header = new Header(); header.Token = token; header.ServiceId = 0xFE; header.Size = (uint)response.CalculateSize(); - var headerSizeBytes = BitConverter.GetBytes((ushort)header.CalculateSize()); - Array.Reverse(headerSizeBytes); + ByteBuffer buffer = new ByteBuffer(); + buffer.WriteBytes(GetHeaderSize(header), 2); + buffer.WriteBytes(header.ToByteArray()); + buffer.WriteBytes(response.ToByteArray()); - ByteBuffer packet = new ByteBuffer(); - packet.WriteBytes(headerSizeBytes, 2); - packet.WriteBytes(header.ToByteArray()); - packet.WriteBytes(response.ToByteArray()); - - AsyncWrite(packet.GetData()); + await AsyncWrite(buffer.GetData()); } - public void SendResponse(uint token, BattlenetRpcErrorCode status) + public async void SendResponse(uint token, BattlenetRpcErrorCode status) { Header header = new Header(); header.Token = token; header.Status = (uint)status; header.ServiceId = 0xFE; - var headerSizeBytes = BitConverter.GetBytes((ushort)header.CalculateSize()); - Array.Reverse(headerSizeBytes); + ByteBuffer buffer = new ByteBuffer(); + buffer.WriteBytes(GetHeaderSize(header), 2); + buffer.WriteBytes(header.ToByteArray()); - ByteBuffer packet = new ByteBuffer(); - packet.WriteBytes(headerSizeBytes, 2); - packet.WriteBytes(header.ToByteArray()); - - AsyncWrite(packet); + await AsyncWrite(buffer.GetData()); } - public void SendRequest(uint serviceHash, uint methodId, IMessage request, Action callback) - { - _responseCallbacks[_requestToken] = callback; - SendRequest(serviceHash, methodId, request); - } - - public void SendRequest(uint serviceHash, uint methodId, IMessage request) + public async void SendRequest(uint serviceHash, uint methodId, IMessage request) { Header header = new Header(); header.ServiceId = 0; header.ServiceHash = serviceHash; header.MethodId = methodId; header.Size = (uint)request.CalculateSize(); - header.Token = _requestToken++; + header.Token = requestToken++; + + ByteBuffer buffer = new ByteBuffer(); + buffer.WriteBytes(GetHeaderSize(header), 2); + buffer.WriteBytes(header.ToByteArray()); + buffer.WriteBytes(request.ToByteArray()); + + await AsyncWrite(buffer.GetData()); + } + + public byte[] GetHeaderSize(Header header) + { + var size = (ushort)header.CalculateSize(); + byte[] bytes = new byte[2]; + bytes[0] = (byte)((size >> 8) & 0xff); + bytes[1] = (byte)(size & 0xff); var headerSizeBytes = BitConverter.GetBytes((ushort)header.CalculateSize()); Array.Reverse(headerSizeBytes); - ByteBuffer packet = new ByteBuffer(); - packet.WriteBytes(headerSizeBytes, 2); - packet.WriteBytes(header.ToByteArray()); - packet.WriteBytes(request.ToByteArray()); - - AsyncWrite(packet); - } - - public BattlenetRpcErrorCode HandleLogon(Bgs.Protocol.Authentication.V1.LogonRequest logonRequest) - { - if (logonRequest.Program != "WoW") - { - Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in with game other than WoW (using {1})!", GetClientInfo(), logonRequest.Program); - return BattlenetRpcErrorCode.BadProgram; - } - - if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64") - { - Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in from an unsupported platform (using {1})!", GetClientInfo(), logonRequest.Platform); - return BattlenetRpcErrorCode.BadPlatform; - } - - if (logonRequest.Locale.ToEnum() == LocaleConstant.enUS && logonRequest.Locale != "enUS") - { - Log.outDebug(LogFilter.Session, "Battlenet.LogonRequest: {0} attempted to log in with unsupported locale (using {1})!", GetClientInfo(), logonRequest.Locale); - return BattlenetRpcErrorCode.BadLocale; - } - - _locale = logonRequest.Locale; - _os = logonRequest.Platform; - _build = (uint)logonRequest.ApplicationVersion; - - var endpoint = Global.SessionMgr.GetAddressForClient(GetRemoteIpAddress()); - - ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest(); - externalChallenge.PayloadType = "web_auth_url"; - - externalChallenge.Payload = ByteString.CopyFromUtf8(string.Format("https://{0}:{1}/bnetserver/login/", endpoint.Address, endpoint.Port)); - SendRequest((uint)OriginalHash.ChallengeListener, 3, externalChallenge); - return BattlenetRpcErrorCode.Ok; - } - - public BattlenetRpcErrorCode HandleVerifyWebCredentials(Bgs.Protocol.Authentication.V1.VerifyWebCredentialsRequest verifyWebCredentialsRequest) - { - if (verifyWebCredentialsRequest.WebCredentials.IsEmpty) - return BattlenetRpcErrorCode.Denied; - - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_INFO); - stmt.AddValue(0, verifyWebCredentialsRequest.WebCredentials.ToStringUtf8()); - - SQLResult result = DB.Login.Query(stmt); - if (result.IsEmpty()) - return BattlenetRpcErrorCode.Denied; - - _accountInfo = new AccountInfo(); - _accountInfo.LoadResult(result); - - if (_accountInfo.LoginTicketExpiry < Time.UnixTime) - return BattlenetRpcErrorCode.TimedOut; - - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID); - stmt.AddValue(0, _accountInfo.Id); - - SQLResult characterCountsResult = DB.Login.Query(stmt); - if (!characterCountsResult.IsEmpty()) - { - do - { - RealmHandle realmId = new RealmHandle(characterCountsResult.Read(3), characterCountsResult.Read(4), characterCountsResult.Read(2)); - _accountInfo.GameAccounts[characterCountsResult.Read(0)].CharacterCounts[realmId.GetAddress()] = characterCountsResult.Read(1); - - } while (characterCountsResult.NextRow()); - } - - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_LAST_PLAYER_CHARACTERS); - stmt.AddValue(0, _accountInfo.Id); - - SQLResult lastPlayerCharactersResult = DB.Login.Query(stmt); - if (!lastPlayerCharactersResult.IsEmpty()) - { - do - { - RealmHandle realmId = new RealmHandle(lastPlayerCharactersResult.Read(1), lastPlayerCharactersResult.Read(2), lastPlayerCharactersResult.Read(3)); - - LastPlayedCharacterInfo lastPlayedCharacter = new LastPlayedCharacterInfo(); - lastPlayedCharacter.RealmId = realmId; - lastPlayedCharacter.CharacterName = lastPlayerCharactersResult.Read(4); - lastPlayedCharacter.CharacterGUID = lastPlayerCharactersResult.Read(5); - lastPlayedCharacter.LastPlayedTime = lastPlayerCharactersResult.Read(6); - - _accountInfo.GameAccounts[lastPlayerCharactersResult.Read(0)].LastPlayedCharacters[realmId.GetSubRegionAddress()] = lastPlayedCharacter; - - } while (lastPlayerCharactersResult.NextRow()); - } - - string ip_address = GetRemoteIpAddress().ToString(); - - // If the IP is 'locked', check that the player comes indeed from the correct IP address - if (_accountInfo.IsLockedToIP) - { - Log.outDebug(LogFilter.Session, "Session.HandleVerifyWebCredentials: Account '{0}' is locked to IP - '{1}' is logging in from '{2}'", - _accountInfo.Login, _accountInfo.LastIP, ip_address); - - if (_accountInfo.LastIP != ip_address) - return BattlenetRpcErrorCode.RiskAccountLocked; - } - else - { - Log.outDebug(LogFilter.Session, "Session.HandleVerifyWebCredentials: Account '{0}' is not locked to ip", _accountInfo.Login); - if (_accountInfo.LockCountry.IsEmpty() || _accountInfo.LockCountry == "00") - Log.outDebug(LogFilter.Session, "Session.HandleVerifyWebCredentials: Account '{0}' is not locked to country", _accountInfo.Login); - else if (!_accountInfo.LockCountry.IsEmpty() && !_ipCountry.IsEmpty()) - { - Log.outDebug(LogFilter.Session, "Session.HandleVerifyWebCredentials: Account '{0}' is locked to country: '{1}' Player country is '{2}'", - _accountInfo.Login, _accountInfo.LockCountry, _ipCountry); - - if (_ipCountry != _accountInfo.LockCountry) - return BattlenetRpcErrorCode.RiskAccountLocked; - } - } - - // If the account is banned, reject the logon attempt - if (_accountInfo.IsBanned) - { - if (_accountInfo.IsPermanenetlyBanned) - { - Log.outDebug(LogFilter.Session, "{0} Session.HandleVerifyWebCredentials: Banned account {1} tried to login!", GetClientInfo(), _accountInfo.Login); - return BattlenetRpcErrorCode.GameAccountBanned; - } - else - { - Log.outDebug(LogFilter.Session, "{0} Session.HandleVerifyWebCredentials: Temporarily banned account {1} tried to login!", GetClientInfo(), _accountInfo.Login); - return BattlenetRpcErrorCode.GameAccountSuspended; - } - } - - Bgs.Protocol.Authentication.V1.LogonResult logonResult = new Bgs.Protocol.Authentication.V1.LogonResult(); - logonResult.ErrorCode = 0; - logonResult.AccountId = new EntityId(); - logonResult.AccountId.Low = _accountInfo.Id; - logonResult.AccountId.High = 0x100000000000000; - foreach (var pair in _accountInfo.GameAccounts) - { - EntityId gameAccountId = new EntityId(); - gameAccountId.Low = pair.Value.Id; - gameAccountId.High = 0x200000200576F57; - logonResult.GameAccountId.Add(gameAccountId); - } - - if (!_ipCountry.IsEmpty()) - logonResult.GeoipCountry = _ipCountry; - - logonResult.SessionKey = ByteString.CopyFrom(new byte[64].GenerateRandomKey(64)); - - _authed = true; - - SendRequest((uint)OriginalHash.AuthenticationListener, 5, logonResult); - return BattlenetRpcErrorCode.Ok; - } - - public BattlenetRpcErrorCode HandleGetAccountState(Bgs.Protocol.Account.V1.GetAccountStateRequest request, Bgs.Protocol.Account.V1.GetAccountStateResponse response) - { - if (!_authed) - return BattlenetRpcErrorCode.Denied; - - if (request.Options.FieldPrivacyInfo) - { - response.State = new Bgs.Protocol.Account.V1.AccountState(); - response.State.PrivacyInfo = new Bgs.Protocol.Account.V1.PrivacyInfo(); - response.State.PrivacyInfo.IsUsingRid = false; - response.State.PrivacyInfo.IsVisibleForViewFriends = false; - response.State.PrivacyInfo.IsHiddenFromFriendFinder = true; - - response.Tags = new Bgs.Protocol.Account.V1.AccountFieldTags(); - response.Tags.PrivacyInfoTag = 0xD7CA834D; - } - - return BattlenetRpcErrorCode.Ok; - } - - public BattlenetRpcErrorCode HandleGetGameAccountState(Bgs.Protocol.Account.V1.GetGameAccountStateRequest request, Bgs.Protocol.Account.V1.GetGameAccountStateResponse response) - { - if (!_authed) - return BattlenetRpcErrorCode.Denied; - - if (request.Options.FieldGameLevelInfo) - { - var gameAccountInfo = _accountInfo.GameAccounts.LookupByKey(request.GameAccountId.Low); - if (gameAccountInfo != null) - { - response.State = new Bgs.Protocol.Account.V1.GameAccountState(); - response.State.GameLevelInfo = new Bgs.Protocol.Account.V1.GameLevelInfo(); - response.State.GameLevelInfo.Name = gameAccountInfo.DisplayName; - response.State.GameLevelInfo.Program = 5730135; // WoW - } - - response.Tags = new Bgs.Protocol.Account.V1.GameAccountFieldTags(); - response.Tags.GameLevelInfoTag = 0x5C46D483; - } - - if (request.Options.FieldGameStatus) - { - if (response.State == null) - response.State = new Bgs.Protocol.Account.V1.GameAccountState(); - - response.State.GameStatus = new Bgs.Protocol.Account.V1.GameStatus(); - - var gameAccountInfo = _accountInfo.GameAccounts.LookupByKey(request.GameAccountId.Low); - if (gameAccountInfo != null) - { - response.State.GameStatus.IsSuspended = gameAccountInfo.IsBanned; - response.State.GameStatus.IsBanned = gameAccountInfo.IsPermanenetlyBanned; - response.State.GameStatus.SuspensionExpires = (gameAccountInfo.UnbanDate * 1000000); - } - - response.State.GameStatus.Program = 5730135; // WoW - response.Tags.GameStatusTag = 0x98B75F99; - } - - return BattlenetRpcErrorCode.Ok; - } - - public BattlenetRpcErrorCode HandleProcessClientRequest(Bgs.Protocol.GameUtilities.V1.ClientRequest request, Bgs.Protocol.GameUtilities.V1.ClientResponse response) - { - if (!_authed) - return BattlenetRpcErrorCode.Denied; - - Bgs.Protocol.Attribute command = null; - Dictionary Params = new Dictionary(); - - for (int i = 0; i < request.Attribute.Count; ++i) - { - Bgs.Protocol.Attribute attr = request.Attribute[i]; - Params[attr.Name] = attr.Value; - if (attr.Name.Contains("Command_")) - command = attr; - } - - if (command == null) - { - Log.outError(LogFilter.SessionRpc, "{0} sent ClientRequest with no command.", GetClientInfo()); - return BattlenetRpcErrorCode.RpcMalformedRequest; - } - - var handler = ClientRequestHandlers.LookupByKey(command.Name); - if (handler == null) - { - Log.outError(LogFilter.SessionRpc, "{0} sent ClientRequest with unknown command {1}.", GetClientInfo(), command.Name); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - return handler(Params, response); - } - - Variant GetParam(Dictionary Params, string paramName) - { - return Params.LookupByKey(paramName); - } - - delegate BattlenetRpcErrorCode ClientRequestHandler(Dictionary Params, Bgs.Protocol.GameUtilities.V1.ClientResponse response); - BattlenetRpcErrorCode GetRealmListTicket(Dictionary Params, Bgs.Protocol.GameUtilities.V1.ClientResponse response) - { - Variant identity = GetParam(Params, "Param_Identity"); - if (identity != null) - { - var realmListTicketIdentity = Json.CreateObject(identity.BlobValue.ToStringUtf8(), true); - var gameAccountInfo = _accountInfo.GameAccounts.LookupByKey(realmListTicketIdentity.GameAccountId); - if (gameAccountInfo != null) - _gameAccountInfo = gameAccountInfo; - } - - if (_gameAccountInfo == null) - return BattlenetRpcErrorCode.UtilServerInvalidIdentityArgs; - - if (_gameAccountInfo.IsPermanenetlyBanned) - return BattlenetRpcErrorCode.GameAccountBanned; - else if (_gameAccountInfo.IsBanned) - return BattlenetRpcErrorCode.GameAccountSuspended; - - bool clientInfoOk = false; - Variant clientInfo = GetParam(Params, "Param_ClientInfo"); - if (clientInfo != null) - { - var realmListTicketClientInformation = Json.CreateObject(clientInfo.BlobValue.ToStringUtf8(), true); - clientInfoOk = true; - int i = 0; - foreach (var b in realmListTicketClientInformation.Info.Secret.Select(Convert.ToByte)) - _clientSecret[i++] = b; - } - - if (!clientInfoOk) - return BattlenetRpcErrorCode.WowServicesDeniedRealmListTicket; - - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_LAST_LOGIN_INFO); - stmt.AddValue(0, GetRemoteIpAddress().ToString()); - stmt.AddValue(1, Enum.Parse(typeof(LocaleConstant), _locale)); - stmt.AddValue(2, _os); - stmt.AddValue(3, _accountInfo.Id); - - DB.Login.Execute(stmt); - - var attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_RealmListTicket"; - attribute.Value = new Variant(); - attribute.Value.BlobValue = ByteString.CopyFrom("AuthRealmListTicket", System.Text.Encoding.UTF8); - response.Attribute.Add(attribute); - - return BattlenetRpcErrorCode.Ok; - } - - BattlenetRpcErrorCode GetLastCharPlayed(Dictionary Params, Bgs.Protocol.GameUtilities.V1.ClientResponse response) - { - Variant subRegion = GetParam(Params, "Command_LastCharPlayedRequest_v1_b9"); - if (subRegion != null) - { - var lastPlayerChar = _gameAccountInfo.LastPlayedCharacters.LookupByKey(subRegion.StringValue); - if (lastPlayerChar != null) - { - var compressed = Global.RealmMgr.GetRealmEntryJSON(lastPlayerChar.RealmId, _build); - if (compressed.Length == 0) - return BattlenetRpcErrorCode.UtilServerFailedToSerializeResponse; - - var attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_RealmEntry"; - attribute.Value = new Variant(); - attribute.Value.BlobValue = ByteString.CopyFrom(compressed); - response.Attribute.Add(attribute); - - attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_CharacterName"; - attribute.Value = new Variant(); - attribute.Value.StringValue = lastPlayerChar.CharacterName; - response.Attribute.Add(attribute); - - attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_CharacterGUID"; - attribute.Value = new Variant(); - attribute.Value.BlobValue = ByteString.CopyFrom(BitConverter.GetBytes(lastPlayerChar.CharacterGUID)); - response.Attribute.Add(attribute); - - attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_LastPlayedTime"; - attribute.Value = new Variant(); - attribute.Value.IntValue = (int)lastPlayerChar.LastPlayedTime; - response.Attribute.Add(attribute); - } - - return BattlenetRpcErrorCode.Ok; - } - - return BattlenetRpcErrorCode.UtilServerUnknownRealm; - } - - BattlenetRpcErrorCode GetRealmList(Dictionary Params, Bgs.Protocol.GameUtilities.V1.ClientResponse response) - { - if (_gameAccountInfo == null) - return BattlenetRpcErrorCode.UserServerBadWowAccount; - - string subRegionId = ""; - Variant subRegion = GetParam(Params, "Command_RealmListRequest_v1_b9"); - if (subRegion != null) - subRegionId = subRegion.StringValue; - - var compressed = Global.RealmMgr.GetRealmList(_build, subRegionId); - if (compressed.Length == 0) - return BattlenetRpcErrorCode.UtilServerFailedToSerializeResponse; - - var attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_RealmList"; - attribute.Value = new Variant(); - attribute.Value.BlobValue = ByteString.CopyFrom(compressed); - response.Attribute.Add(attribute); - - var realmCharacterCounts = new RealmCharacterCountList(); - foreach (var characterCount in _gameAccountInfo.CharacterCounts) - { - var countEntry = new RealmCharacterCountEntry(); - countEntry.WowRealmAddress = (int)characterCount.Key; - countEntry.Count = characterCount.Value; - realmCharacterCounts.Counts.Add(countEntry); - } - - compressed = Json.Deflate("JSONRealmCharacterCountList", realmCharacterCounts); - - attribute = new Bgs.Protocol.Attribute(); - attribute.Name = "Param_CharacterCountList"; - attribute.Value = new Variant(); - attribute.Value.BlobValue = ByteString.CopyFrom(compressed); - response.Attribute.Add(attribute); - return BattlenetRpcErrorCode.Ok; - } - - BattlenetRpcErrorCode JoinRealm(Dictionary Params, Bgs.Protocol.GameUtilities.V1.ClientResponse response) - { - Variant realmAddress = GetParam(Params, "Param_RealmAddress"); - if (realmAddress != null) - return Global.RealmMgr.JoinRealm((uint)realmAddress.UintValue, _build, GetRemoteIpAddress(), _clientSecret, (LocaleConstant)Enum.Parse(typeof(LocaleConstant), _locale), _os, _gameAccountInfo.Name, response); - - return BattlenetRpcErrorCode.WowServicesInvalidJoinTicket; - } - - public BattlenetRpcErrorCode HandleGetAllValuesForAttribute(Bgs.Protocol.GameUtilities.V1.GetAllValuesForAttributeRequest request, Bgs.Protocol.GameUtilities.V1.GetAllValuesForAttributeResponse response) - { - if (!_authed) - return BattlenetRpcErrorCode.Denied; - - if (request.AttributeKey == "Command_RealmListRequest_v1_b9") - { - Global.RealmMgr.WriteSubRegions(response); - return BattlenetRpcErrorCode.Ok; - } - - return BattlenetRpcErrorCode.RpcNotImplemented; + return bytes; } public string GetClientInfo() { - string stream = '[' + GetRemoteIpAddress().ToString() + ':' + GetRemotePort(); - if (_accountInfo != null && !string.IsNullOrEmpty(_accountInfo.Login)) - stream += ", Account: " + _accountInfo.Login; + string stream = '[' + GetRemoteIpEndPoint().ToString(); + if (accountInfo != null && !accountInfo.Login.IsEmpty()) + stream += ", Account: " + accountInfo.Login; - if (_gameAccountInfo != null) - stream += ", Game account: " + _gameAccountInfo.Name; + if (gameAccountInfo != null) + stream += ", Game account: " + gameAccountInfo.Name; stream += ']'; return stream; } - - public uint GetAccountId() { return _accountInfo.Id; } - public uint GetGameAccountId() { return _gameAccountInfo.Id; } - - Dictionary ClientRequestHandlers = new Dictionary(); - - AccountInfo _accountInfo; - GameAccountInfo _gameAccountInfo; // Points at selected game account (inside _gameAccounts) - - string _locale; - string _os; - uint _build; - - string _ipCountry; - - Array _clientSecret = new Array(32); - - bool _authed; - - AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); - - Dictionary> _responseCallbacks = new Dictionary>(); - uint _requestToken; } public class AccountInfo - { - public void LoadResult(SQLResult result) + { + public uint Id; + public string Login; + public bool IsLockedToIP; + public string LockCountry; + public string LastIP; + public uint LoginTicketExpiry; + public bool IsBanned; + public bool IsPermanenetlyBanned; + public string PasswordVerifier; + public string Salt; + + public Dictionary GameAccounts; + + public AccountInfo(SQLResult result) { Id = result.Read(0); Login = result.Read(1); @@ -652,34 +225,31 @@ namespace BNetServer.Networking PasswordVerifier = result.Read(9); Salt = result.Read(10); + GameAccounts = new Dictionary(); const int GameAccountFieldsOffset = 8; do { - var account = new GameAccountInfo(); - account.LoadResult(result.GetFields(), GameAccountFieldsOffset); + var account = new GameAccountInfo(result.GetFields(), GameAccountFieldsOffset); GameAccounts[result.Read(GameAccountFieldsOffset)] = account; } while (result.NextRow()); - } - - public uint Id; - public string Login; - public bool IsLockedToIP; - public string LockCountry; - public string LastIP; - public uint LoginTicketExpiry; - public bool IsBanned; - public bool IsPermanenetlyBanned; - public string PasswordVerifier; - public string Salt; - - public Dictionary GameAccounts = new Dictionary(); } public class GameAccountInfo { - public void LoadResult(SQLFields fields, int startColumn) + public uint Id; + public string Name; + public string DisplayName; + public uint UnbanDate; + public bool IsBanned; + public bool IsPermanenetlyBanned; + public AccountTypes SecurityLevel; + + public Dictionary CharacterCounts; + public Dictionary LastPlayedCharacters; + + public GameAccountInfo(SQLFields fields, int startColumn) { Id = fields.Read(startColumn + 0); Name = fields.Read(startColumn + 1); @@ -693,23 +263,15 @@ namespace BNetServer.Networking DisplayName = "WoW" + Name.Substring(hashPos + 1); else DisplayName = Name; + + CharacterCounts = new Dictionary(); + LastPlayedCharacters = new Dictionary(); } - - public uint Id; - public string Name; - public string DisplayName; - public uint UnbanDate; - public bool IsBanned; - public bool IsPermanenetlyBanned; - public AccountTypes SecurityLevel; - - public Dictionary CharacterCounts = new Dictionary(); - public Dictionary LastPlayedCharacters = new Dictionary(); } public class LastPlayedCharacterInfo { - public RealmHandle RealmId; + public RealmId RealmId; public string CharacterName; public ulong CharacterGUID; public uint LastPlayedTime; diff --git a/Source/BNetServer/Server.cs b/Source/BNetServer/Server.cs index 4bf1bdca3..9a8a143d4 100644 --- a/Source/BNetServer/Server.cs +++ b/Source/BNetServer/Server.cs @@ -1,28 +1,20 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using BNetServer.Networking; using Framework.Configuration; using Framework.Database; using Framework.Networking; +using Framework.Web.API; using System; -using System.Diagnostics; using System.Globalization; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Timers; +using System.Collections.Generic; +using System.Threading.Tasks; namespace BNetServer { @@ -34,18 +26,10 @@ namespace BNetServer CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - Console.CancelKeyPress += (o, e) => - { - Global.RealmMgr.Close(); - - Log.outInfo(LogFilter.Server, "Halting process..."); - Environment.Exit(-1); - }; - - if (!ConfigMgr.Load(Process.GetCurrentProcess().ProcessName + ".conf")) + if (!ConfigMgr.Load("BNetServer.conf")) ExitNow(); - // Initialize the database connection + // Initialize the database if (!StartDB()) ExitNow(); @@ -55,7 +39,7 @@ namespace BNetServer int restPort = ConfigMgr.GetDefaultValue("LoginREST.Port", 8081); if (restPort < 0 || restPort > 0xFFFF) { - Log.outError(LogFilter.Network, "Specified login service port ({0}) out of allowed range (1-65535), defaulting to 8081", restPort); + Log.outError(LogFilter.Network, "Specified login service port ({restPort}) out of allowed range (1-65535), defaulting to 8081"); restPort = 8081; } @@ -67,14 +51,14 @@ namespace BNetServer // Get the list of realms for the server Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10)); - Global.SessionMgr.Initialize(); + Global.LoginServiceMgr.Initialize(); var sessionSocketServer = new SocketManager(); // Start the listening port (acceptor) for auth connections int bnPort = ConfigMgr.GetDefaultValue("BattlenetPort", 1119); if (bnPort < 0 || bnPort > 0xFFFF) { - Log.outError(LogFilter.Server, "Specified battle.net port ({0}) out of allowed range (1-65535)", bnPort); + Log.outError(LogFilter.Server, $"Specified battle.net port ({bnPort}) out of allowed range (1-65535)"); ExitNow(); } @@ -84,11 +68,9 @@ namespace BNetServer ExitNow(); } - Log.outInfo(LogFilter.Server, $"Bnetserver started successfully, listening on {bindIp}:{bnPort}"); - uint _banExpiryCheckInterval = ConfigMgr.GetDefaultValue("BanExpiryCheckInterval", 60u); _banExpiryCheckTimer = new Timer(_banExpiryCheckInterval); - _banExpiryCheckTimer.Elapsed += _banExpiryCheckTimer_Elapsed; + _banExpiryCheckTimer.Elapsed += BanExpiryCheckTimer_Elapsed; _banExpiryCheckTimer.Start(); } @@ -106,17 +88,18 @@ namespace BNetServer static void ExitNow() { - Log.outInfo(LogFilter.Server, "Halting process..."); + Console.WriteLine("Halting process..."); + System.Threading.Thread.Sleep(10000); Environment.Exit(-1); } - static void _banExpiryCheckTimer_Elapsed(object sender, ElapsedEventArgs e) + static void BanExpiryCheckTimer_Elapsed(object sender, ElapsedEventArgs e) { - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS)); - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.UPD_EXPIRED_ACCOUNT_BANS)); - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DEL_BNET_EXPIRED_ACCOUNT_BANNED)); + DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); + DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.UpdExpiredAccountBans)); + DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelBnetExpiredAccountBanned)); } static Timer _banExpiryCheckTimer; } -} +} \ No newline at end of file diff --git a/Source/BNetServer/Services/AccountService.cs b/Source/BNetServer/Services/AccountService.cs deleted file mode 100644 index 473cf0824..000000000 --- a/Source/BNetServer/Services/AccountService.cs +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Account.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class AccountService : ServiceBase - { - public AccountService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 13: - { - ResolveAccountRequest request = new ResolveAccountRequest(); - request.MergeFrom(stream); - - ResolveAccountResponse response = new ResolveAccountResponse(); - BattlenetRpcErrorCode status = HandleResolveAccount(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAccount(GetAccountRequest: {1}) returned GetAccountResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 15: - { - IsIgrAddressRequest request = new IsIgrAddressRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleIsIgrAddress(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.IsIgrAddress(IsIgrAddressRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 25: - { - SubscriptionUpdateRequest request = new SubscriptionUpdateRequest(); - request.MergeFrom(stream); - - SubscriptionUpdateResponse response = new SubscriptionUpdateResponse(); - BattlenetRpcErrorCode status = HandleSubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.Subscribe(SubscriptionUpdateRequest: {1}) returned SubscriptionUpdateResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 26: - { - SubscriptionUpdateRequest request = new SubscriptionUpdateRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUnsubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.Unsubscribe(SubscriptionUpdateRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 30: - { - GetAccountStateRequest request = new GetAccountStateRequest(); - request.MergeFrom(stream); - - GetAccountStateResponse response = new GetAccountStateResponse(); - BattlenetRpcErrorCode status = HandleGetAccountState(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAccountState(GetAccountStateRequest: {1}) returned GetAccountStateResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 31: - { - GetGameAccountStateRequest request = new GetGameAccountStateRequest(); - request.MergeFrom(stream); - - GetGameAccountStateResponse response = new GetGameAccountStateResponse(); - BattlenetRpcErrorCode status = HandleGetGameAccountState(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameAccountState(GetGameAccountStateRequest: {1}) returned GetGameAccountStateResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 32: - { - GetLicensesRequest request = new GetLicensesRequest(); - request.MergeFrom(stream); - - GetLicensesResponse response = new GetLicensesResponse(); - BattlenetRpcErrorCode status = HandleGetLicenses(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetLicenses(GetLicensesRequest: {1}) returned GetLicensesResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 33: - { - GetGameTimeRemainingInfoRequest request = new GetGameTimeRemainingInfoRequest(); - request.MergeFrom(stream); - - GetGameTimeRemainingInfoResponse response = new GetGameTimeRemainingInfoResponse(); - BattlenetRpcErrorCode status = HandleGetGameTimeRemainingInfo(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameTimeRemainingInfo(GetGameTimeRemainingInfoRequest: {1}) returned GetGameTimeRemainingInfoResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 34: - { - GetGameSessionInfoRequest request = new GetGameSessionInfoRequest(); - request.MergeFrom(stream); - - GetGameSessionInfoResponse response = new GetGameSessionInfoResponse(); - BattlenetRpcErrorCode status = HandleGetGameSessionInfo(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameSessionInfo(GetGameSessionInfoRequest: {1}) returned GetGameSessionInfoResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 35: - { - GetCAISInfoRequest request = new GetCAISInfoRequest(); - request.MergeFrom(stream); - - GetCAISInfoResponse response = new GetCAISInfoResponse(); - BattlenetRpcErrorCode status = HandleGetCAISInfo(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetCAISInfo(GetCAISInfoRequest: {1}) returned GetCAISInfoResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 37: - { - GetAuthorizedDataRequest request = new GetAuthorizedDataRequest(); - request.MergeFrom(stream); - - GetAuthorizedDataResponse response = new GetAuthorizedDataResponse(); - BattlenetRpcErrorCode status = HandleGetAuthorizedData(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAuthorizedData(GetAuthorizedDataRequest: {1}) returned GetAuthorizedDataResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleResolveAccount(ResolveAccountRequest request, ResolveAccountResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.ResolveAccount({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleIsIgrAddress(IsIgrAddressRequest request, NoData response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.IsIgrAddress({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleSubscribe(SubscriptionUpdateRequest request, SubscriptionUpdateResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.Subscribe({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUnsubscribe(SubscriptionUpdateRequest request, NoData response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.Unsubscribe({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetAccountState(GetAccountStateRequest request, GetAccountStateResponse response) - { - return _session.HandleGetAccountState(request, response); - } - - BattlenetRpcErrorCode HandleGetGameAccountState(GetGameAccountStateRequest request, GetGameAccountStateResponse response) - { - return _session.HandleGetGameAccountState(request, response); - } - - BattlenetRpcErrorCode HandleGetLicenses(GetLicensesRequest request, GetLicensesResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetLicenses({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetGameTimeRemainingInfo(GetGameTimeRemainingInfoRequest request, GetGameTimeRemainingInfoResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetGameTimeRemainingInfo({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetGameSessionInfo(GetGameSessionInfoRequest request, GetGameSessionInfoResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetGameSessionInfo({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetCAISInfo(GetCAISInfoRequest request, GetCAISInfoResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetCAISInfo({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetAuthorizedData(GetAuthorizedDataRequest request, GetAuthorizedDataResponse response) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetAuthorizedData({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGameAccountFlagUpdate(GameAccountFlagUpdateRequest request) - { - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GameAccountFlagUpdate({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } - - class AccountListener : ServiceBase - { - public AccountListener(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - AccountStateNotification request = new AccountStateNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnAccountStateUpdated(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnAccountStateUpdated(AccountStateNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 2: - { - GameAccountStateNotification request = new GameAccountStateNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnGameAccountStateUpdated(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameAccountStateUpdated(GameAccountStateNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 3: - { - GameAccountNotification request = new GameAccountNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnGameAccountsUpdated(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameAccountsUpdated(GameAccountNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 4: - { - GameAccountSessionNotification request = new GameAccountSessionNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnGameSessionUpdated(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameSessionUpdated(GameAccountSessionNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleOnAccountStateUpdated(AccountStateNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnAccountStateUpdated: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameAccountStateUpdated(GameAccountStateNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameAccountStateUpdated: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameAccountsUpdated(GameAccountNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameAccountsUpdated: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameSessionUpdated(GameAccountSessionNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameSessionUpdated: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } -} diff --git a/Source/BNetServer/Services/AuthenticationService.cs b/Source/BNetServer/Services/AuthenticationService.cs deleted file mode 100644 index 099ea2171..000000000 --- a/Source/BNetServer/Services/AuthenticationService.cs +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Authentication.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class AuthenticationService : ServiceBase - { - public AuthenticationService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - LogonRequest request = new LogonRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleLogon(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.Logon(bgs.protocol.authentication.v1.LogonRequest: {1}) returned bgs.protocol.NoData: {2} status {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 2: - { - ModuleNotification request = new ModuleNotification(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleModuleNotify(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.ModuleNotify(bgs.protocol.authentication.v1.ModuleNotification: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 3: - { - ModuleMessageRequest request = new ModuleMessageRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleModuleMessage(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.ModuleMessage(bgs.protocol.authentication.v1.ModuleMessageRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 4: - { - EntityId request = new EntityId(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSelectGameAccount_DEPRECATED(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.SelectGameAccount_DEPRECATED(bgs.protocol.EntityId: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 5: - { - GenerateSSOTokenRequest request = new GenerateSSOTokenRequest(); - request.MergeFrom(stream); - - - GenerateSSOTokenResponse response = new GenerateSSOTokenResponse(); - BattlenetRpcErrorCode status = HandleGenerateSSOToken(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.GenerateSSOToken(bgs.protocol.authentication.v1.GenerateSSOTokenRequest: {1}) returned bgs.protocol.authentication.v1.GenerateSSOTokenResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 6: - { - SelectGameAccountRequest request = new SelectGameAccountRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSelectGameAccount(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.SelectGameAccount(bgs.protocol.authentication.v1.SelectGameAccountRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 7: - { - VerifyWebCredentialsRequest request = new VerifyWebCredentialsRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleVerifyWebCredentials(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.VerifyWebCredentials(bgs.protocol.authentication.v1.VerifyWebCredentialsRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 8: - { - GenerateWebCredentialsRequest request = new GenerateWebCredentialsRequest(); - request.MergeFrom(stream); - - - GenerateWebCredentialsResponse response = new GenerateWebCredentialsResponse(); - BattlenetRpcErrorCode status = HandleGenerateWebCredentials(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.GenerateWebCredentials(bgs.protocol.authentication.v1.GenerateWebCredentialsRequest: {1}) returned bgs.protocol.authentication.v1.GenerateWebCredentialsResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleLogon(LogonRequest request, NoData response) - { - return _session.HandleLogon(request); - } - - BattlenetRpcErrorCode HandleModuleNotify(ModuleNotification request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.ModuleNotify: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleModuleMessage(ModuleMessageRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.ModuleMessage: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleSelectGameAccount_DEPRECATED(EntityId request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.SelectGameAccount_DEPRECATED: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGenerateSSOToken(GenerateSSOTokenRequest request, GenerateSSOTokenResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.GenerateSSOToken: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleSelectGameAccount(SelectGameAccountRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.SelectGameAccount: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleVerifyWebCredentials(VerifyWebCredentialsRequest request, NoData response) - { - return _session.HandleVerifyWebCredentials(request); - } - - BattlenetRpcErrorCode HandleGenerateWebCredentials(GenerateWebCredentialsRequest request, GenerateWebCredentialsResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.GenerateWebCredentials: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } - - class AuthenticationListener : ServiceBase - { - public AuthenticationListener(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - ModuleLoadRequest request = new ModuleLoadRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnModuleLoad(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnModuleLoad(bgs.protocol.authentication.v1.ModuleLoadRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 2: - { - ModuleMessageRequest request = new ModuleMessageRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleOnModuleMessage(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnModuleMessage(bgs.protocol.authentication.v1.ModuleMessageRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 4: - { - ServerStateChangeRequest request = new ServerStateChangeRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnServerStateChange(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnServerStateChange(bgs.protocol.authentication.v1.ServerStateChangeRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 5: - { - LogonResult request = new LogonResult(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnLogonComplete(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonComplete(bgs.protocol.authentication.v1.LogonResult: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 6: - { - MemModuleLoadRequest request = new MemModuleLoadRequest(); - request.MergeFrom(stream); - - - MemModuleLoadResponse response = new MemModuleLoadResponse(); - BattlenetRpcErrorCode status = HandleOnMemModuleLoad(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnMemModuleLoad(bgs.protocol.authentication.v1.MemModuleLoadRequest: {1}) returned bgs.protocol.authentication.v1.MemModuleLoadResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 10: - { - LogonUpdateRequest request = new LogonUpdateRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnLogonUpdate(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonUpdate(bgs.protocol.authentication.v1.LogonUpdateRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 11: - { - VersionInfoNotification request = new VersionInfoNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnVersionInfoUpdated(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnVersionInfoUpdated(bgs.protocol.authentication.v1.VersionInfoNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 12: - { - LogonQueueUpdateRequest request = new LogonQueueUpdateRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnLogonQueueUpdate(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonQueueUpdate(bgs.protocol.authentication.v1.LogonQueueUpdateRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 13: - { - NoData request = new NoData(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnLogonQueueEnd(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonQueueEnd(bgs.protocol.NoData: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 14: - { - GameAccountSelectedRequest request = new GameAccountSelectedRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnGameAccountSelected(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnGameAccountSelected(bgs.protocol.authentication.v1.GameAccountSelectedRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleOnModuleLoad(ModuleLoadRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnModuleLoad: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnModuleMessage(ModuleMessageRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnModuleMessage: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnServerStateChange(ServerStateChangeRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnServerStateChange: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnLogonComplete(LogonResult request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonComplete: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnMemModuleLoad(MemModuleLoadRequest request, MemModuleLoadResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnMemModuleLoad: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnLogonUpdate(LogonUpdateRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonUpdate: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnVersionInfoUpdated(VersionInfoNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnVersionInfoUpdated: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnLogonQueueUpdate(LogonQueueUpdateRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonQueueUpdate: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnLogonQueueEnd(NoData request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonQueueEnd: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameAccountSelected(GameAccountSelectedRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnGameAccountSelected: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } -} diff --git a/Source/BNetServer/Services/ChallengeService.cs b/Source/BNetServer/Services/ChallengeService.cs deleted file mode 100644 index 75e979259..000000000 --- a/Source/BNetServer/Services/ChallengeService.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Challenge.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class ChallengeListener : ServiceBase - { - public ChallengeListener(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 3: - { - ChallengeExternalRequest request = new ChallengeExternalRequest(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnExternalChallenge(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallenge(bgs.protocol.challenge.v1.ChallengeExternalRequest: {1} status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 4: - { - ChallengeExternalResult request = new ChallengeExternalResult(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnExternalChallengeResult(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallengeResult(bgs.protocol.challenge.v1.ChallengeExternalResult: {1} status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleOnExternalChallenge(ChallengeExternalRequest request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnExternalChallenge: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnExternalChallengeResult(ChallengeExternalResult request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnExternalChallengeResult: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } -} diff --git a/Source/BNetServer/Services/ConnectionService.cs b/Source/BNetServer/Services/ConnectionService.cs deleted file mode 100644 index 84ce429df..000000000 --- a/Source/BNetServer/Services/ConnectionService.cs +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Connection.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; -using System.Diagnostics; - -namespace BNetServer.Networking -{ - class ConnectionService : ServiceBase - { - public ConnectionService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - ConnectRequest request = ConnectRequest.Parser.ParseFrom(stream); - ConnectResponse response = new ConnectResponse(); - - BattlenetRpcErrorCode status = HandleConnect(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Connect(bgs.protocol.connection.v1.ConnectRequest: {1}) returned bgs.protocol.connection.v1.ConnectResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 2: - { - BindRequest request = new BindRequest(); - request.MergeFrom(stream); - - BindResponse response = new BindResponse(); - BattlenetRpcErrorCode status = HandleBind(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Bind(bgs.protocol.connection.v1.BindRequest: {1}) returned bgs.protocol.connection.v1.BindResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 3: - { - EchoRequest request = new EchoRequest(); - request.MergeFrom(stream); - - EchoResponse response = new EchoResponse(); - BattlenetRpcErrorCode status = HandleEcho(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Echo(bgs.protocol.connection.v1.EchoRequest: {1}) returned bgs.protocol.connection.v1.EchoResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 4: - { - DisconnectNotification request = DisconnectNotification.Parser.ParseFrom(stream); - - BattlenetRpcErrorCode status = HandleForceDisconnect(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.ForceDisconnect(bgs.protocol.connection.v1.DisconnectNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 5: - { - NoData request = NoData.Parser.ParseFrom(stream); - - BattlenetRpcErrorCode status = HandleKeepAlive(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.KeepAlive(bgs.protocol.NoData: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 6: - { - EncryptRequest request = EncryptRequest.Parser.ParseFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleEncrypt(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Encrypt(bgs.protocol.connection.v1.EncryptRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 7: - { - DisconnectRequest request = DisconnectRequest.Parser.ParseFrom(stream); - - BattlenetRpcErrorCode status = HandleRequestDisconnect(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.RequestDisconnect(bgs.protocol.connection.v1.DisconnectRequest: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleConnect(ConnectRequest request, ConnectResponse response) - { - if (request.ClientId != null) - response.ClientId.MergeFrom(request.ClientId); - - response.ServerId = new ProcessId(); - response.ServerId.Label = (uint)Process.GetCurrentProcess().Id; - response.ServerId.Epoch = (uint)Time.UnixTime; - response.ServerTime = (ulong)Time.UnixTimeMilliseconds; - - response.UseBindlessRpc = request.UseBindlessRpc; - - return BattlenetRpcErrorCode.Ok; - } - - BattlenetRpcErrorCode HandleBind(BindRequest request, BindResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Bind: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleEcho(EchoRequest request, EchoResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Echo: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleForceDisconnect(DisconnectNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.ForceDisconnect: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleKeepAlive(NoData request) - { - return BattlenetRpcErrorCode.Ok; - } - - BattlenetRpcErrorCode HandleEncrypt(EncryptRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Encrypt: {1}", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleRequestDisconnect(DisconnectRequest request) - { - var disconnectNotification = new DisconnectNotification(); - disconnectNotification.ErrorCode = request.ErrorCode; - SendRequest(4, disconnectNotification); - - _session.CloseSocket(); - return BattlenetRpcErrorCode.Ok; - } - } -} diff --git a/Source/BNetServer/Services/FriendService.cs b/Source/BNetServer/Services/FriendService.cs deleted file mode 100644 index e0d6688bb..000000000 --- a/Source/BNetServer/Services/FriendService.cs +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Friends.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class FriendsService : ServiceBase - { - public FriendsService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - SubscribeRequest request = new SubscribeRequest(); - request.MergeFrom(stream); - - SubscribeResponse response = new SubscribeResponse(); - BattlenetRpcErrorCode status = HandleSubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Subscribe(bgs.protocol.friends.v1.SubscribeRequest: {1}) returned bgs.protocol.friends.v1.SubscribeResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 2: - { - SendInvitationRequest request = new SendInvitationRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSendInvitation(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.SendInvitation(bgs.protocol.SendInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 3: - { - AcceptInvitationRequest request = new AcceptInvitationRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleAcceptInvitation(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.AcceptInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 4: - { - RevokeInvitationRequest request = new RevokeInvitationRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleRevokeInvitation(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 5: - { - DeclineInvitationRequest request = new DeclineInvitationRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleDeclineInvitation(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.DeclineInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 6: - { - IgnoreInvitationRequest request = new IgnoreInvitationRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleIgnoreInvitation(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.IgnoreInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 8: - { - RemoveFriendRequest request = new RemoveFriendRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleRemoveFriend(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RemoveFriend(bgs.protocol.friends.v1.GenericFriendRequest: {1}) returned bgs.protocol.friends.v1.GenericFriendResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 9: - { - ViewFriendsRequest request = new ViewFriendsRequest(); - request.MergeFrom(stream); - - ViewFriendsResponse response = new ViewFriendsResponse(); - BattlenetRpcErrorCode status = HandleViewFriends(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.ViewFriends(bgs.protocol.friends.v1.ViewFriendsRequest: {1}) returned bgs.protocol.friends.v1.ViewFriendsResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 10: - { - UpdateFriendStateRequest request = new UpdateFriendStateRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUpdateFriendState(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.UpdateFriendState(bgs.protocol.friends.v1.UpdateFriendStateRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 11: - { - UnsubscribeRequest request = new UnsubscribeRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUnsubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Unsubscribe(bgs.protocol.friends.v1.UnsubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 12: - { - RevokeAllInvitationsRequest request = new RevokeAllInvitationsRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleRevokeAllInvitations(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeAllInvitations(bgs.protocol.friends.v1.GenericFriendRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, SubscribeResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.Subscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleSendInvitation(SendInvitationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.SendInvitation: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleAcceptInvitation(AcceptInvitationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.AcceptInvitation: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleRevokeInvitation(RevokeInvitationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RevokeInvitation: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleDeclineInvitation(DeclineInvitationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.DeclineInvitation: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleIgnoreInvitation(IgnoreInvitationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.IgnoreInvitation: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleRemoveFriend(RemoveFriendRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RemoveFriend: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleViewFriends(ViewFriendsRequest request, ViewFriendsResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.ViewFriends: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUpdateFriendState(UpdateFriendStateRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.UpdateFriendState: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.Unsubscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleRevokeAllInvitations(RevokeAllInvitationsRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RevokeAllInvitations: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } - - class FriendsListener : ServiceBase - { - public FriendsListener(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - FriendNotification request = new FriendNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnFriendAdded(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnFriendAdded(bgs.protocol.friends.v1.FriendNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 2: - { - FriendNotification request = new FriendNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnFriendRemoved(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnFriendRemoved(bgs.protocol.friends.v1.FriendNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 3: - { - InvitationNotification request = new InvitationNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnReceivedInvitationAdded(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnReceivedInvitationAdded(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 4: - { - InvitationNotification request = new InvitationNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnReceivedInvitationRemoved(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnReceivedInvitationRemoved(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 5: - { - InvitationNotification request = new InvitationNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnSentInvitationAdded(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnSentInvitationAdded(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 6: - { - InvitationNotification request = new InvitationNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnSentInvitationRemoved(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnSentInvitationRemoved(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 7: - { - UpdateFriendStateNotification request = new UpdateFriendStateNotification(); - request.MergeFrom(stream); - - BattlenetRpcErrorCode status = HandleOnUpdateFriendState(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnUpdateFriendState(bgs.protocol.friends.v1.UpdateFriendStateNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleOnFriendAdded(FriendNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnFriendAdded: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnFriendRemoved(FriendNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnFriendRemoved: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnReceivedInvitationAdded(InvitationNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnReceivedInvitationAdded: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnReceivedInvitationRemoved(InvitationNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnReceivedInvitationRemoved: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnSentInvitationAdded(InvitationNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnSentInvitationAdded: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnSentInvitationRemoved(InvitationNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnSentInvitationRemoved: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnUpdateFriendState(UpdateFriendStateNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnUpdateFriendState: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } -} diff --git a/Source/BNetServer/Services/GameUtilitiesService.cs b/Source/BNetServer/Services/GameUtilitiesService.cs deleted file mode 100644 index 94902f7fb..000000000 --- a/Source/BNetServer/Services/GameUtilitiesService.cs +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.GameUtilities.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class GameUtilitiesService : ServiceBase - { - public GameUtilitiesService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - ClientRequest request = new ClientRequest(); - request.MergeFrom(stream); - - - ClientResponse response = new ClientResponse(); - BattlenetRpcErrorCode status = HandleProcessClientRequest(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.ProcessClientRequest(bgs.protocol.game_utilities.v1.ClientRequest: {1}) returned bgs.protocol.game_utilities.v1.ClientResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 2: - { - PresenceChannelCreatedRequest request = new PresenceChannelCreatedRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandlePresenceChannelCreated(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.PresenceChannelCreated(bgs.protocol.game_utilities.v1.PresenceChannelCreatedRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 3: - { - GetPlayerVariablesRequest request = new GetPlayerVariablesRequest(); - request.MergeFrom(stream); - - - GetPlayerVariablesResponse response = new GetPlayerVariablesResponse(); - BattlenetRpcErrorCode status = HandleGetPlayerVariables(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetPlayerVariables(bgs.protocol.game_utilities.v1.GetPlayerVariablesRequest: {1}) returned bgs.protocol.game_utilities.v1.GetPlayerVariablesResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 6: - { - ServerRequest request = new ServerRequest(); - request.MergeFrom(stream); - - - ServerResponse response = new ServerResponse(); - BattlenetRpcErrorCode status = HandleProcessServerRequest(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.ProcessServerRequest(bgs.protocol.game_utilities.v1.ServerRequest: {1}) returned bgs.protocol.game_utilities.v1.ServerResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 7: - { - GameAccountOnlineNotification request = new GameAccountOnlineNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnGameAccountOnline(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.OnGameAccountOnline(bgs.protocol.game_utilities.v1.GameAccountOnlineNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 8: - { - GameAccountOfflineNotification request = new GameAccountOfflineNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnGameAccountOffline(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.OnGameAccountOffline(bgs.protocol.game_utilities.v1.GameAccountOfflineNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 9: - { - GetAchievementsFileRequest request = new GetAchievementsFileRequest(); - request.MergeFrom(stream); - - - GetAchievementsFileResponse response = new GetAchievementsFileResponse(); - BattlenetRpcErrorCode status = HandleGetAchievementsFile(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetAchievementsFile(bgs.protocol.game_utilities.v1.GetAchievementsFileRequest: {1}) returned bgs.protocol.game_utilities.v1.GetAchievementsFileResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 10: - { - GetAllValuesForAttributeRequest request = new GetAllValuesForAttributeRequest(); - request.MergeFrom(stream); - - - GetAllValuesForAttributeResponse response = new GetAllValuesForAttributeResponse(); - BattlenetRpcErrorCode status = HandleGetAllValuesForAttribute(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetAllValuesForAttribute(bgs.protocol.game_utilities.v1.GetAllValuesForAttributeRequest: {1}) returned bgs.protocol.game_utilities.v1.GetAllValuesForAttributeResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleProcessClientRequest(ClientRequest request, ClientResponse response) - { - return _session.HandleProcessClientRequest(request, response); - } - - BattlenetRpcErrorCode HandlePresenceChannelCreated(PresenceChannelCreatedRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.PresenceChannelCreated: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetPlayerVariables(GetPlayerVariablesRequest request, GetPlayerVariablesResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.GetPlayerVariables: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleProcessServerRequest(ServerRequest request, ServerResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.ProcessServerRequest: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameAccountOnline(GameAccountOnlineNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.OnGameAccountOnline: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnGameAccountOffline(GameAccountOfflineNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.OnGameAccountOffline: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetAchievementsFile(GetAchievementsFileRequest request, GetAchievementsFileResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.GetAchievementsFile: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleGetAllValuesForAttribute(GetAllValuesForAttributeRequest request, GetAllValuesForAttributeResponse response) - { - return _session.HandleGetAllValuesForAttribute(request, response); - } - } -} diff --git a/Source/BNetServer/Services/PresenceService.cs b/Source/BNetServer/Services/PresenceService.cs deleted file mode 100644 index f099eef89..000000000 --- a/Source/BNetServer/Services/PresenceService.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Presence.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class PresenceService : ServiceBase - { - public PresenceService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - SubscribeRequest request = new SubscribeRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Subscribe(bgs.protocol.presence.v1.SubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 2: - { - UnsubscribeRequest request = new UnsubscribeRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUnsubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Unsubscribe(bgs.protocol.presence.v1.UnsubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 3: - { - UpdateRequest request = new UpdateRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUpdate(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Update(bgs.protocol.presence.v1.UpdateRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 4: - { - QueryRequest request = new QueryRequest(); - request.MergeFrom(stream); - - - QueryResponse response = new QueryResponse(); - BattlenetRpcErrorCode status = HandleQuery(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Query(bgs.protocol.presence.v1.QueryRequest: {1}) returned bgs.protocol.presence.v1.QueryResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 5: - { - OwnershipRequest request = new OwnershipRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleOwnership(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Ownership(bgs.protocol.presence.v1.OwnershipRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 7: - { - SubscribeNotificationRequest request = new SubscribeNotificationRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSubscribeNotification(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.SubscribeNotification(bgs.protocol.presence.v1.SubscribeNotificationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - /*case 8: - { - MigrateOlympusCustomMessageRequest request = new MigrateOlympusCustomMessageRequest(); - request.MergeFrom(stream); - - - MigrateOlympusCustomMessageResponse response = new MigrateOlympusCustomMessageResponse(); - BattlenetRpcErrorCode status = HandleMigrateOlympusCustomMessage(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.MigrateOlympusCustomMessage(bgs.protocol.presence.v1.MigrateOlympusCustomMessageRequest: {1}) returned bgs.protocol.presence.v1.MigrateOlympusCustomMessageResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - }*/ - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Subscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Unsubscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUpdate(UpdateRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Update: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleQuery(QueryRequest request, QueryResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Query: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOwnership(OwnershipRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Ownership: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleSubscribeNotification(SubscribeNotificationRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.SubscribeNotification: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - /*BattlenetRpcErrorCode HandleMigrateOlympusCustomMessage(MigrateOlympusCustomMessageRequest request, MigrateOlympusCustomMessageResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.MigrateOlympusCustomMessage: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - */ - } -} diff --git a/Source/BNetServer/Services/ReportService.cs b/Source/BNetServer/Services/ReportService.cs deleted file mode 100644 index 5344cafc6..000000000 --- a/Source/BNetServer/Services/ReportService.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.Report.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class ReportService : ServiceBase - { - public ReportService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - SendReportRequest request = new SendReportRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSendReport(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ReportService.SendReport(bgs.protocol.report.v1.SendReportRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - /*case 2: - { - SubmitReportRequest request = new SubmitReportRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleSubmitReport(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ReportService.SubmitReport(bgs.protocol.report.v1.SubmitReportRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - }*/ - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleSendReport(SendReportRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ReportService.SendReport: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - /* BattlenetRpcErrorCode HandleSubmitReport(SubmitReportRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ReportService.SubmitReport: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - }*/ - } -} diff --git a/Source/BNetServer/Services/ResourcesService.cs b/Source/BNetServer/Services/ResourcesService.cs deleted file mode 100644 index c93d65b5d..000000000 --- a/Source/BNetServer/Services/ResourcesService.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class ResourcesService : ServiceBase - { - public ResourcesService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - /*case 1: - { - ContentHandleRequest request = new ContentHandleRequest(); - request.MergeFrom(stream); - - ContentHandle response = new ContentHandle(); - BattlenetRpcErrorCode status = HandleGetContentHandle(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ResourcesService.GetContentHandle(bgs.protocol.resources.v1.ContentHandleRequest: {1}) returned bgs.protocol.ContentHandle: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - }*/ - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - /*BattlenetRpcErrorCode HandleGetContentHandle(ContentHandleRequest request, ContentHandle response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ResourcesService.GetContentHandle({1})", GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - }*/ - } -} diff --git a/Source/BNetServer/Services/ServiceDispatcher.cs b/Source/BNetServer/Services/ServiceDispatcher.cs deleted file mode 100644 index d79cb7b95..000000000 --- a/Source/BNetServer/Services/ServiceDispatcher.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2012-2016 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 . - */ - -using BNetServer.Networking; -using Framework.Constants; -using Google.Protobuf; -using System; -using System.Collections.Generic; - -namespace BNetServer.Services -{ - public class ServiceDispatcher : Singleton - { - ServiceDispatcher() - { - AddService(OriginalHash.AccountService); - AddService(OriginalHash.AccountListener); - AddService(OriginalHash.AuthenticationService); - AddService(OriginalHash.ConnectionService); - AddService(OriginalHash.FriendsService); - AddService(OriginalHash.GameUtilitiesService); - AddService(OriginalHash.PresenceService); - AddService(OriginalHash.ReportService); - AddService(OriginalHash.ResourcesService); - AddService(OriginalHash.UserManagerService); - } - - public void Dispatch(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream) - { - var action = _dispatchers.LookupByKey(serviceHash); - if (action != null) - action(session, serviceHash, token, methodId, stream); - else - Log.outDebug(LogFilter.SessionRpc, "{0} tried to call invalid service {1}", session.GetClientInfo(), serviceHash); - } - - void AddService(OriginalHash OriginalHash) where Service : ServiceBase - { - _dispatchers[(uint)OriginalHash] = Dispatch; - } - - void Dispatch(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream) where Service : ServiceBase - { - var obj = (Service)Activator.CreateInstance(typeof(Service), session, serviceHash); - obj.CallServerMethod(token, methodId, stream); - } - - Dictionary _dispatchers = new Dictionary(); - - delegate void DispatcherHandler(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream); - } - - abstract class ServiceBase - { - protected ServiceBase(Session session, uint serviceHash) - { - _session = session; - _serviceHash = serviceHash; - } - - public abstract void CallServerMethod(uint token, uint methodId, CodedInputStream stream); - - public void SendRequest(uint methodId, IMessage request, Action callback) { _session.SendRequest(_serviceHash, methodId, request, callback); } - public void SendRequest(uint methodId, IMessage request) { _session.SendRequest(_serviceHash, methodId, request); } - public void SendResponse(uint token, BattlenetRpcErrorCode status) { _session.SendResponse(token, status); } - public void SendResponse(uint token, IMessage response) { _session.SendResponse(token, response); } - - public string GetCallerInfo() - { - return _session.GetClientInfo(); - } - - protected Session _session; - protected uint _serviceHash; - } -} diff --git a/Source/BNetServer/Services/UserManagerService.cs b/Source/BNetServer/Services/UserManagerService.cs deleted file mode 100644 index ec6d5a864..000000000 --- a/Source/BNetServer/Services/UserManagerService.cs +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using Bgs.Protocol; -using Bgs.Protocol.UserManager.V1; -using BNetServer.Services; -using Framework.Constants; -using Google.Protobuf; - -namespace BNetServer.Networking -{ - class UserManagerService : ServiceBase - { - public UserManagerService(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - SubscribeRequest request = new SubscribeRequest(); - request.MergeFrom(stream); - - SubscribeResponse response = new SubscribeResponse(); - BattlenetRpcErrorCode status = HandleSubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.Subscribe(bgs.protocol.user_manager.v1.SubscribeRequest: {1}) returned bgs.protocol.user_manager.v1.SubscribeResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 10: - { - AddRecentPlayersRequest request = new AddRecentPlayersRequest(); - request.MergeFrom(stream); - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleAddRecentPlayers(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.AddRecentPlayers(bgs.protocol.user_manager.v1.AddRecentPlayersRequest: {1}) returned bgs.protocol.user_manager.v1.AddRecentPlayersResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 11: - { - ClearRecentPlayersRequest request = new ClearRecentPlayersRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleClearRecentPlayers(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.ClearRecentPlayers(bgs.protocol.user_manager.v1.ClearRecentPlayersRequest: {1}) returned bgs.protocol.user_manager.v1.ClearRecentPlayersResponse: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 20: - { - BlockPlayerRequest request = new BlockPlayerRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleBlockPlayer(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.BlockPlayer(bgs.protocol.user_manager.v1.BlockPlayerRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 21: - { - UnblockPlayerRequest request = new UnblockPlayerRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUnblockPlayer(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.UnblockPlayer(bgs.protocol.user_manager.v1.UnblockPlayerRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 40: - { - BlockPlayerRequest request = new BlockPlayerRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleBlockPlayerForSession(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.BlockPlayerForSession(bgs.protocol.user_manager.v1.BlockPlayerRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 50: - { - EntityId request = new EntityId(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleLoadBlockList(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.LoadBlockList(bgs.protocol.EntityId: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - case 51: - { - UnsubscribeRequest request = new UnsubscribeRequest(); - request.MergeFrom(stream); - - - NoData response = new NoData(); - BattlenetRpcErrorCode status = HandleUnsubscribe(request, response); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.Unsubscribe(bgs.protocol.user_manager.v1.UnsubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", - GetCallerInfo(), request.ToString(), response.ToString(), status); - if (status == 0) - SendResponse(token, response); - else - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, SubscribeResponse response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.Subscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleAddRecentPlayers(AddRecentPlayersRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.AddRecentPlayers: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleClearRecentPlayers(ClearRecentPlayersRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.ClearRecentPlayers: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleBlockPlayer(BlockPlayerRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.BlockPlayer: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUnblockPlayer(UnblockPlayerRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.UnblockPlayer: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleBlockPlayerForSession(BlockPlayerRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.BlockPlayerForSession: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleLoadBlockList(EntityId request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.LoadBlockList: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.Unsubscribe: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } - - class UserManagerListener : ServiceBase - { - public UserManagerListener(Session session, uint serviceHash) : base(session, serviceHash) { } - - public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) - { - switch (methodId) - { - case 1: - { - BlockedPlayerAddedNotification request = new BlockedPlayerAddedNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnBlockedPlayerAdded(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnBlockedPlayerAdded(bgs.protocol.user_manager.v1.BlockedPlayerAddedNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 2: - { - BlockedPlayerRemovedNotification request = new BlockedPlayerRemovedNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnBlockedPlayerRemoved(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnBlockedPlayerRemoved(bgs.protocol.user_manager.v1.BlockedPlayerRemovedNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 11: - { - RecentPlayersAddedNotification request = new RecentPlayersAddedNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnRecentPlayersAdded(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnRecentPlayersAdded(bgs.protocol.user_manager.v1.RecentPlayersAddedNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - case 12: - { - RecentPlayersRemovedNotification request = new RecentPlayersRemovedNotification(); - request.MergeFrom(stream); - - - BattlenetRpcErrorCode status = HandleOnRecentPlayersRemoved(request); - Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnRecentPlayersRemoved(bgs.protocol.user_manager.v1.RecentPlayersRemovedNotification: {1}) status: {2}.", - GetCallerInfo(), request.ToString(), status); - if (status != 0) - SendResponse(token, status); - break; - } - default: - Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); - SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); - break; - } - } - - BattlenetRpcErrorCode HandleOnBlockedPlayerAdded(BlockedPlayerAddedNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnBlockedPlayerAdded: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnBlockedPlayerRemoved(BlockedPlayerRemovedNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnBlockedPlayerRemoved: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnRecentPlayersAdded(RecentPlayersAddedNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnRecentPlayersAdded: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - - BattlenetRpcErrorCode HandleOnRecentPlayersRemoved(RecentPlayersRemovedNotification request) - { - Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnRecentPlayersRemoved: {1}", - GetCallerInfo(), request.ToString()); - return BattlenetRpcErrorCode.RpcNotImplemented; - } - } -} diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index ac1f96e68..40c062386 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -142,7 +142,7 @@ namespace Framework.Constants /// public const uint CalendarMaxInvites = 100; public const uint CalendarDefaultResponseTime = 946684800; // 01/01/2000 00:00:00 - public const LocaleConstant DefaultLocale = LocaleConstant.enUS; + public const Locale DefaultLocale = Locale.enUS; public const int MaxAccountTutorialValues = 8; public const int MinAuctionTime = (12 * Time.Hour); public const int MaxConditionTargets = 3; @@ -372,7 +372,7 @@ namespace Framework.Constants } } - public enum LocaleConstant + public enum Locale { enUS = 0, koKR = 1, diff --git a/Source/Framework/Database/Databases/LoginDatabase.cs b/Source/Framework/Database/Databases/LoginDatabase.cs index c36bb2bea..8f631c811 100644 --- a/Source/Framework/Database/Databases/LoginDatabase.cs +++ b/Source/Framework/Database/Databases/LoginDatabase.cs @@ -25,11 +25,11 @@ namespace Framework.Database const string BnetGameAccountInfo = "a.id, a.username, ab.unbandate, ab.unbandate = ab.bandate, aa.gmlevel"; 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 = ?"); + PrepareStatement(LoginStatements.DelExpiredIpBans, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()"); + PrepareStatement(LoginStatements.UpdExpiredAccountBans, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()"); + PrepareStatement(LoginStatements.SelIpInfo, "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.InsIpAutoBanned, "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"); PrepareStatement(LoginStatements.SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate"); PrepareStatement(LoginStatements.SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id"); @@ -113,16 +113,16 @@ namespace Framework.Database PrepareStatement(LoginStatements.SEL_ACCOUNT_MUTE_INFO, "SELECT mutedate, mutetime, mutereason, mutedby FROM account_muted WHERE guid = ? ORDER BY mutedate ASC"); PrepareStatement(LoginStatements.DEL_ACCOUNT_MUTED, "DELETE FROM account_muted WHERE guid = ?"); - PrepareStatement(LoginStatements.SEL_BNET_AUTHENTICATION, "SELECT ba.id, ba.sha_pass_hash, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?"); - PrepareStatement(LoginStatements.UPD_BNET_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicket = ?, LoginTicketExpiry = ? WHERE id = ?"); - PrepareStatement(LoginStatements.SEL_BNET_ACCOUNT_INFO, "SELECT " + BnetAccountInfo + ", " + BnetGameAccountInfo + + PrepareStatement(LoginStatements.SelBnetAuthentication, "SELECT ba.id, ba.sha_pass_hash, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?"); + PrepareStatement(LoginStatements.UpdBnetAuthentication, "UPDATE battlenet_accounts SET LoginTicket = ?, LoginTicketExpiry = ? WHERE id = ?"); + PrepareStatement(LoginStatements.SelBnetAccountInfo, "SELECT " + BnetAccountInfo + ", " + BnetGameAccountInfo + " FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account a ON ba.id = a.battlenet_account" + " LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID = -1 WHERE ba.LoginTicket = ? ORDER BY a.id"); - PrepareStatement(LoginStatements.UPD_BNET_LAST_LOGIN_INFO, "UPDATE battlenet_accounts SET last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE id = ?"); + PrepareStatement(LoginStatements.UpdBnetLastLoginInfo, "UPDATE battlenet_accounts SET last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE id = ?"); PrepareStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?"); - PrepareStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_ACCOUNT_ID, "SELECT rc.acctid, rc.numchars, r.id, r.Region, r.Battlegroup FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id WHERE rc.acctid = ?"); + PrepareStatement(LoginStatements.SelBnetCharacterCountsByAccountId, "SELECT rc.acctid, rc.numchars, r.id, r.Region, r.Battlegroup FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id WHERE rc.acctid = ?"); PrepareStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID, "SELECT rc.acctid, rc.numchars, r.id, r.Region, r.Battlegroup FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id LEFT JOIN account a ON rc.acctid = a.id WHERE a.battlenet_account = ?"); - PrepareStatement(LoginStatements.SEL_BNET_LAST_PLAYER_CHARACTERS, "SELECT lpc.accountId, lpc.region, lpc.battlegroup, lpc.realmId, lpc.characterName, lpc.characterGUID, lpc.lastPlayedTime FROM account_last_played_character lpc LEFT JOIN account a ON lpc.accountId = a.id WHERE a.battlenet_account = ?"); + PrepareStatement(LoginStatements.SelBnetLastPlayerCharacters, "SELECT lpc.accountId, lpc.region, lpc.battlegroup, lpc.realmId, lpc.characterName, lpc.characterGUID, lpc.lastPlayedTime FROM account_last_played_character lpc LEFT JOIN account a ON lpc.accountId = a.id WHERE a.battlenet_account = ?"); PrepareStatement(LoginStatements.DEL_BNET_LAST_PLAYER_CHARACTERS, "DELETE FROM account_last_played_character WHERE accountId = ? AND region = ? AND battlegroup = ?"); PrepareStatement(LoginStatements.INS_BNET_LAST_PLAYER_CHARACTERS, "INSERT INTO account_last_played_character (accountId, region, battlegroup, realmId, characterName, characterGUID, lastPlayedTime) VALUES (?,?,?,?,?,?,?)"); PrepareStatement(LoginStatements.INS_BNET_ACCOUNT, "INSERT INTO battlenet_accounts (`email`,`sha_pass_hash`) VALUES (?, ?)"); @@ -137,10 +137,10 @@ namespace Framework.Database PrepareStatement(LoginStatements.SEL_BNET_MAX_ACCOUNT_INDEX, "SELECT MAX(battlenet_index) FROM account WHERE battlenet_account = ?"); PrepareStatement(LoginStatements.SEL_BNET_GAME_ACCOUNT_LIST, "SELECT a.id, a.username FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id WHERE ba.email = ?"); - PrepareStatement(LoginStatements.UPD_BNET_FAILED_LOGINS, "UPDATE battlenet_accounts SET failed_logins = failed_logins + 1 WHERE id = ?"); - PrepareStatement(LoginStatements.INS_BNET_ACCOUNT_AUTO_BANNED, "INSERT INTO battlenet_account_bans(id, bandate, unbandate, bannedby, banreason) VALUES(?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity Auth', 'Failed login autoban')"); - PrepareStatement(LoginStatements.DEL_BNET_EXPIRED_ACCOUNT_BANNED, "DELETE FROM battlenet_account_bans WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()"); - PrepareStatement(LoginStatements.UPD_BNET_RESET_FAILED_LOGINS, "UPDATE battlenet_accounts SET failed_logins = 0 WHERE id = ?"); + PrepareStatement(LoginStatements.UpdBnetFailedLogins, "UPDATE battlenet_accounts SET failed_logins = failed_logins + 1 WHERE id = ?"); + PrepareStatement(LoginStatements.InsBnetAccountAutoBanned, "INSERT INTO battlenet_account_bans(id, bandate, unbandate, bannedby, banreason) VALUES(?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity Auth', 'Failed login autoban')"); + PrepareStatement(LoginStatements.DelBnetExpiredAccountBanned, "DELETE FROM battlenet_account_bans WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()"); + PrepareStatement(LoginStatements.UpdBnetResetFailedLogins, "UPDATE battlenet_accounts SET failed_logins = 0 WHERE id = ?"); PrepareStatement(LoginStatements.SEL_LAST_CHAR_UNDELETE, "SELECT LastCharacterUndelete FROM battlenet_accounts WHERE Id = ?"); PrepareStatement(LoginStatements.UPD_LAST_CHAR_UNDELETE, "UPDATE battlenet_accounts SET LastCharacterUndelete = UNIX_TIMESTAMP() WHERE Id = ?"); @@ -178,10 +178,10 @@ namespace Framework.Database public enum LoginStatements { SEL_REALMLIST, - DEL_EXPIRED_IP_BANS, - UPD_EXPIRED_ACCOUNT_BANS, - SEL_IP_INFO, - INS_IP_AUTO_BANNED, + DelExpiredIpBans, + UpdExpiredAccountBans, + SelIpInfo, + InsIpAutoBanned, SEL_ACCOUNT_BANNED_ALL, SEL_ACCOUNT_BANNED_BY_USERNAME, DEL_ACCOUNT_BANNED, @@ -260,14 +260,14 @@ namespace Framework.Database SEL_ACCOUNT_MUTE_INFO, DEL_ACCOUNT_MUTED, - SEL_BNET_AUTHENTICATION, - UPD_BNET_AUTHENTICATION, - SEL_BNET_ACCOUNT_INFO, - UPD_BNET_LAST_LOGIN_INFO, + SelBnetAuthentication, + UpdBnetAuthentication, + SelBnetAccountInfo, + UpdBnetLastLoginInfo, UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, - SEL_BNET_CHARACTER_COUNTS_BY_ACCOUNT_ID, + SelBnetCharacterCountsByAccountId, SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID, - SEL_BNET_LAST_PLAYER_CHARACTERS, + SelBnetLastPlayerCharacters, DEL_BNET_LAST_PLAYER_CHARACTERS, INS_BNET_LAST_PLAYER_CHARACTERS, INS_BNET_ACCOUNT, @@ -283,10 +283,10 @@ namespace Framework.Database SEL_BNET_MAX_ACCOUNT_INDEX, SEL_BNET_GAME_ACCOUNT_LIST, - UPD_BNET_FAILED_LOGINS, - INS_BNET_ACCOUNT_AUTO_BANNED, - DEL_BNET_EXPIRED_ACCOUNT_BANNED, - UPD_BNET_RESET_FAILED_LOGINS, + UpdBnetFailedLogins, + InsBnetAccountAutoBanned, + DelBnetExpiredAccountBanned, + UpdBnetResetFailedLogins, SEL_LAST_CHAR_UNDELETE, UPD_LAST_CHAR_UNDELETE, diff --git a/Source/Framework/Database/SQLResult.cs b/Source/Framework/Database/SQLResult.cs index f4322bb3a..e97e42bd2 100644 --- a/Source/Framework/Database/SQLResult.cs +++ b/Source/Framework/Database/SQLResult.cs @@ -50,6 +50,15 @@ namespace Framework.Database return (T)value; } + public T[] ReadValues(int startIndex, int numColumns) + { + T[] values = new T[numColumns]; + for (var c = 0; c < numColumns; ++c) + values[c] = Read(startIndex + c); + + return values; + } + public bool IsNull(int column) { return _reader.IsDBNull(column); diff --git a/Source/Framework/Networking/AsyncAcceptor.cs b/Source/Framework/Networking/AsyncAcceptor.cs index 5fe6fa522..f99b0e184 100644 --- a/Source/Framework/Networking/AsyncAcceptor.cs +++ b/Source/Framework/Networking/AsyncAcceptor.cs @@ -25,12 +25,15 @@ namespace Framework.Networking public class AsyncAcceptor { + TcpListener _listener; + volatile bool _closed; + public bool Start(string ip, int port) { IPAddress bindIP; if (!IPAddress.TryParse(ip, out bindIP)) { - Log.outError(LogFilter.Network, "Server can't be started: Invalid IP-Address ({0})", ip); + Log.outError(LogFilter.Network, $"Server can't be started: Invalid IP-Address: {ip}"); return false; } @@ -73,8 +76,5 @@ namespace Framework.Networking _closed = true; _listener.Stop(); } - - TcpListener _listener; - volatile bool _closed; } } diff --git a/Source/Framework/Networking/NetworkThread.cs b/Source/Framework/Networking/NetworkThread.cs index 7e8b38af0..e34e737e3 100644 --- a/Source/Framework/Networking/NetworkThread.cs +++ b/Source/Framework/Networking/NetworkThread.cs @@ -22,6 +22,14 @@ namespace Framework.Networking { public class NetworkThread where TSocketType : ISocket { + int _connections; + volatile bool _stopped; + + Thread _thread; + + List _Sockets = new List(); + List _newSockets = new List(); + public void Stop() { _stopped = true; @@ -56,6 +64,7 @@ namespace Framework.Networking } protected virtual void SocketAdded(TSocketType sock) { } + protected virtual void SocketRemoved(TSocketType sock) { } void AddNewSockets() @@ -114,13 +123,5 @@ namespace Framework.Networking _newSockets.Clear(); _Sockets.Clear(); } - - int _connections; - volatile bool _stopped; - - Thread _thread; - - List _Sockets = new List(); - List _newSockets = new List(); } } diff --git a/Source/Framework/Networking/SSLSocket.cs b/Source/Framework/Networking/SSLSocket.cs index 7824ff06b..d2dc2fb4f 100644 --- a/Source/Framework/Networking/SSLSocket.cs +++ b/Source/Framework/Networking/SSLSocket.cs @@ -20,46 +20,56 @@ using System.Net; using System.Net.Security; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; namespace Framework.Networking { - public abstract class SSLSocket : ISocket + public abstract class SSLSocket : ISocket, IDisposable { + Socket _socket; + internal SslStream _stream; + IPEndPoint _remoteEndPoint; + byte[] _receiveBuffer; + protected SSLSocket(Socket socket) { _socket = socket; - _remoteAddress = ((IPEndPoint)_socket.RemoteEndPoint).Address; - _remotePort = (ushort)((IPEndPoint)_socket.RemoteEndPoint).Port; + _remoteEndPoint = (IPEndPoint)_socket.RemoteEndPoint; _receiveBuffer = new byte[ushort.MaxValue]; _stream = new SslStream(new NetworkStream(socket), false); } - public abstract void Start(); + public virtual void Dispose() + { + _receiveBuffer = null; + _stream.Dispose(); + } + + public abstract void Accept(); public virtual bool Update() { - return IsOpen(); + return _socket.Connected; } - public IPAddress GetRemoteIpAddress() + public IPEndPoint GetRemoteIpEndPoint() { - return _remoteAddress; + return _remoteEndPoint; } - public ushort GetRemotePort() - { - return _remotePort; - } - - public void AsyncRead() + public async Task AsyncRead() { if (!IsOpen()) return; try { - _stream.BeginRead(_receiveBuffer, 0, _receiveBuffer.Length, ReadHandlerInternal, _stream); + var result = await _stream.ReadAsync(_receiveBuffer, 0, _receiveBuffer.Length); + + byte[] data = new byte[result]; + Buffer.BlockCopy(_receiveBuffer, 0, data, 0, result); + ReadHandler(data, result); } catch (Exception ex) { @@ -67,28 +77,11 @@ namespace Framework.Networking } } - void ReadHandlerInternal(IAsyncResult result) - { - int bytes = 0; - try - { - bytes = _stream.EndRead(result); - } - catch (Exception ex) - { - Log.outException(ex); - } - - ReadHandler(bytes); - } - - public abstract void ReadHandler(int transferredBytes); - - public void AsyncHandshake(X509Certificate2 certificate) + public async Task AsyncHandshake(X509Certificate2 certificate) { try { - _stream.AuthenticateAsServer(certificate, false, System.Security.Authentication.SslProtocols.Tls, false); + await _stream.AuthenticateAsServerAsync(certificate, false, System.Security.Authentication.SslProtocols.Tls, false); } catch(Exception ex) { @@ -96,17 +89,20 @@ namespace Framework.Networking CloseSocket(); return; } - AsyncRead(); + + await AsyncRead(); } - public void AsyncWrite(byte[] data) + public abstract void ReadHandler(byte[] data, int receivedLength); + + public async Task AsyncWrite(byte[] data) { if (!IsOpen()) return; try { - _stream.Write(data, 0, data.Length); + await _stream.WriteAsync(data, 0, data.Length); } catch (Exception ex) { @@ -118,39 +114,22 @@ namespace Framework.Networking { try { - _closed = true; _socket.Shutdown(SocketShutdown.Both); _socket.Close(); } catch (Exception ex) { - Log.outDebug(LogFilter.Network, "WorldSocket.CloseSocket: {0} errored when shutting down socket: {1}", GetRemoteIpAddress().ToString(), ex.Message); + Log.outDebug(LogFilter.Network, $"WorldSocket.CloseSocket: {GetRemoteIpEndPoint()} errored when shutting down socket: {ex.Message}"); } - - OnClose(); } + public virtual void OnClose() { Dispose(); } + + public bool IsOpen() { return _socket.Connected; } + public void SetNoDelay(bool enable) { _socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, enable); } - - public virtual void OnClose() { } - - public bool IsOpen() { return !_closed; } - - public byte[] GetReceiveBuffer() - { - return _receiveBuffer; - } - - Socket _socket; - internal SslStream _stream; - byte[] _receiveBuffer; - - volatile bool _closed; - - IPAddress _remoteAddress; - ushort _remotePort; } } diff --git a/Source/Framework/Networking/SocketBase.cs b/Source/Framework/Networking/SocketBase.cs index 5ad553316..c597d7a94 100644 --- a/Source/Framework/Networking/SocketBase.cs +++ b/Source/Framework/Networking/SocketBase.cs @@ -18,42 +18,50 @@ using System; using System.Net; using System.Net.Sockets; +using System.Threading.Tasks; namespace Framework.Networking { + public interface ISocket + { + void Accept(); + bool Update(); + bool IsOpen(); + void CloseSocket(); + } + public abstract class SocketBase : ISocket, IDisposable { + Socket _socket; + IPEndPoint _remoteIPEndPoint; + byte[] _receiveBuffer; + protected SocketBase(Socket socket) { _socket = socket; - _remoteAddress = ((IPEndPoint)_socket.RemoteEndPoint).Address; - _remotePort = (ushort)((IPEndPoint)_socket.RemoteEndPoint).Port; + _remoteIPEndPoint = (IPEndPoint)_socket.RemoteEndPoint; _receiveBuffer = new byte[ushort.MaxValue]; } public virtual void Dispose() { _receiveBuffer = null; + _socket.Dispose(); } - public abstract void Start(); + public abstract void Accept(); public virtual bool Update() { return IsOpen(); } - public IPAddress GetRemoteIpAddress() + public IPEndPoint GetRemoteIpAddress() { - return _remoteAddress; + return _remoteIPEndPoint; } - public ushort GetRemotePort() - { - return _remotePort; - } - - public void AsyncRead() + public async Task AsyncRead() { if (!IsOpen()) return; @@ -63,12 +71,12 @@ namespace Framework.Networking using (var socketEventargs = new SocketAsyncEventArgs()) { socketEventargs.SetBuffer(_receiveBuffer, 0, _receiveBuffer.Length); - socketEventargs.Completed += (sender, args) => ReadHandlerInternal(args); + socketEventargs.Completed += async (sender, args) => await ProcessReadAsync(args); socketEventargs.SocketFlags = SocketFlags.None; socketEventargs.RemoteEndPoint = _socket.RemoteEndPoint; if (!_socket.ReceiveAsync(socketEventargs)) - ReadHandlerInternal(socketEventargs); + await ProcessReadAsync(socketEventargs); } } catch (Exception ex) @@ -77,8 +85,7 @@ namespace Framework.Networking } } - public delegate void SocketReadCallback(SocketAsyncEventArgs args); - public void AsyncReadWithCallback(SocketReadCallback callback) + public async Task AsyncReadWithCallback(SocketReadCallback callback) { if (!IsOpen()) return; @@ -92,7 +99,7 @@ namespace Framework.Networking socketEventargs.UserToken = _socket; socketEventargs.SocketFlags = SocketFlags.None; if (!_socket.ReceiveAsync(socketEventargs)) - callback(socketEventargs); + await callback(socketEventargs); } } catch (Exception ex) @@ -101,7 +108,7 @@ namespace Framework.Networking } } - void ReadHandlerInternal(SocketAsyncEventArgs args) + async Task ProcessReadAsync(SocketAsyncEventArgs args) { if (args.SocketError != SocketError.Success) { @@ -115,31 +122,19 @@ namespace Framework.Networking return; } - ReadHandler(args.BytesTransferred); + byte[] data = new byte[args.BytesTransferred]; + Buffer.BlockCopy(_receiveBuffer, 0, data, 0, args.BytesTransferred); + await ReadHandler(data, args.BytesTransferred); } - public abstract void ReadHandler(int transferredBytes); + public abstract Task ReadHandler(byte[] data, int bytesTransferred); - public void AsyncWrite(byte[] data) + public async void AsyncWrite(byte[] data) { if (!IsOpen()) return; - using (var socketEventargs = new SocketAsyncEventArgs()) - { - socketEventargs.SetBuffer(data, 0, data.Length); - socketEventargs.Completed += WriteHandlerInternal; - socketEventargs.RemoteEndPoint = _socket.RemoteEndPoint; - socketEventargs.UserToken = _socket; - socketEventargs.SocketFlags = SocketFlags.None; - - _socket.SendAsync(socketEventargs); - } - } - - void WriteHandlerInternal(object sender, SocketAsyncEventArgs args) - { - args.Completed -= WriteHandlerInternal; + await _socket.SendAsync(data, SocketFlags.None); } public void CloseSocket() @@ -149,46 +144,26 @@ namespace Framework.Networking try { - _closed = true; _socket.Shutdown(SocketShutdown.Both); _socket.Close(); } catch (Exception ex) { - Log.outDebug(LogFilter.Network, "WorldSocket.CloseSocket: {0} errored when shutting down socket: {1}", GetRemoteIpAddress().ToString(), ex.Message); + Log.outDebug(LogFilter.Network, $"WorldSocket.CloseSocket: {GetRemoteIpAddress()} errored when shutting down socket: {ex.Message}"); } OnClose(); } + public virtual void OnClose() { Dispose(); } + + public bool IsOpen() { return _socket.Connected; } + public void SetNoDelay(bool enable) { _socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, enable); } - public virtual void OnClose() { Dispose(); } - - public bool IsOpen() { return !_closed; } - - public byte[] GetReceiveBuffer() - { - return _receiveBuffer; - } - - Socket _socket; - byte[] _receiveBuffer; - - volatile bool _closed; - - IPAddress _remoteAddress; - ushort _remotePort; - } - - public interface ISocket - { - void Start(); - bool Update(); - bool IsOpen(); - void CloseSocket(); + public delegate Task SocketReadCallback(SocketAsyncEventArgs args); } } diff --git a/Source/Framework/Networking/SocketManager.cs b/Source/Framework/Networking/SocketManager.cs index 0636e73eb..869e5b448 100644 --- a/Source/Framework/Networking/SocketManager.cs +++ b/Source/Framework/Networking/SocketManager.cs @@ -22,6 +22,10 @@ namespace Framework.Networking { public class SocketManager where TSocketType : ISocket { + public AsyncAcceptor Acceptor; + NetworkThread[] _threads; + int _threadCount; + public virtual bool StartNetwork(string bindIp, int port, int threadCount = 1) { Cypher.Assert(threadCount > 0); @@ -74,7 +78,7 @@ namespace Framework.Networking try { TSocketType newSocket = (TSocketType)Activator.CreateInstance(typeof(TSocketType), sock); - newSocket.Start(); + newSocket.Accept(); _threads[SelectThreadWithMinConnections()].AddSocket(newSocket); } @@ -96,9 +100,5 @@ namespace Framework.Networking return min; } - - public AsyncAcceptor Acceptor; - NetworkThread[] _threads; - int _threadCount; } } diff --git a/Source/Framework/Realm/Realm.cs b/Source/Framework/Realm/Realm.cs index 65e2476c9..72ce9349f 100644 --- a/Source/Framework/Realm/Realm.cs +++ b/Source/Framework/Realm/Realm.cs @@ -16,6 +16,7 @@ */ using Framework.Constants; +using Framework.Realm; using System; using System.Net; using System.Net.Sockets; @@ -94,7 +95,7 @@ public class Realm : IEquatable return new { ExternalAddress, LocalAddress, LocalSubnetMask, Port, Name, Type, Flags, Timezone, AllowedSecurityLevel, PopulationLevel }.GetHashCode(); } - public RealmHandle Id; + public RealmId Id; public uint Build; public IPAddress ExternalAddress; public IPAddress LocalAddress; @@ -109,52 +110,3 @@ public class Realm : IEquatable public float PopulationLevel; } -public struct RealmHandle : IEquatable -{ - public RealmHandle(byte region, byte battlegroup, uint index) - { - Region = region; - Site = battlegroup; - Realm = index; - } - public RealmHandle(uint realmAddress) - { - Region = (byte)((realmAddress >> 24) & 0xFF); - Site = (byte)((realmAddress >> 16) & 0xFF); - Realm = realmAddress & 0xFFFF; - } - - public uint GetAddress() - { - return (uint)((Region << 24) | (Site << 16) | (ushort)Realm); - } - public string GetAddressString() - { - return $"{Region}-{Site}-{Realm}"; - } - - public string GetSubRegionAddress() - { - return $"{Region}-{Site}-0"; - } - - public override bool Equals(object obj) - { - return obj != null && obj is RealmHandle && Equals((RealmHandle)obj); - } - - public bool Equals(RealmHandle other) - { - return other.Realm == Realm; - } - - public override int GetHashCode() - { - return new { Site, Region, Realm }.GetHashCode(); - } - - public byte Region; - public byte Site; - public uint Realm; // primary key in `realmlist` table -} - diff --git a/Source/Framework/Realm/RealmId.cs b/Source/Framework/Realm/RealmId.cs new file mode 100644 index 000000000..1ef0678ad --- /dev/null +++ b/Source/Framework/Realm/RealmId.cs @@ -0,0 +1,58 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System; + +namespace Framework.Realm +{ + public struct RealmId : IEquatable + { + public uint Index { get; set; } + public byte Region { get; set; } + public byte Site { get; set; } + + public RealmId(byte region, byte battlegroup, uint index) + { + Region = region; + Site = battlegroup; + Index = index; + } + + public RealmId(uint realmAddress) + { + Region = (byte)((realmAddress >> 24) & 0xFF); + Site = (byte)((realmAddress >> 16) & 0xFF); + Index = realmAddress & 0xFFFF; + } + + public uint GetAddress() + { + return (uint)((Region << 24) | (Site << 16) | (ushort)Index); + } + + public string GetAddressString() + { + return $"{Region}-{Site}-{Index}"; + } + + public string GetSubRegionAddress() + { + return $"{Region}-{Site}-0"; + } + + public override bool Equals(object obj) + { + return obj != null && obj is RealmId && Equals((RealmId)obj); + } + + public bool Equals(RealmId other) + { + return other.Index == Index; + } + + public override int GetHashCode() + { + return new { Site, Region, Index }.GetHashCode(); + } + } +} diff --git a/Source/Framework/Realm/RealmManager.cs b/Source/Framework/Realm/RealmManager.cs index 02ee5c9ef..bed13038d 100644 --- a/Source/Framework/Realm/RealmManager.cs +++ b/Source/Framework/Realm/RealmManager.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Framework.Database; -using Framework.Rest; +using Framework.Web; using Framework.Serialization; using System; using System.Collections.Generic; @@ -25,6 +25,7 @@ using System.Linq; using System.Net; using System.Timers; using System.Collections.Concurrent; +using Framework.Realm; public class RealmManager : Singleton { @@ -91,7 +92,7 @@ public class RealmManager : Singleton { PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST); SQLResult result = DB.Login.Query(stmt); - Dictionary existingRealms = new Dictionary(); + Dictionary existingRealms = new Dictionary(); foreach (var p in _realms) existingRealms[p.Key] = p.Value.Name; @@ -125,11 +126,11 @@ public class RealmManager : Singleton byte region = result.Read(12); byte battlegroup = result.Read(13); - realm.Id = new RealmHandle(region, battlegroup, realmId); + realm.Id = new RealmId(region, battlegroup, realmId); UpdateRealm(realm); - var subRegion = new RealmHandle(region, battlegroup, 0).GetAddressString(); + var subRegion = new RealmId(region, battlegroup, 0).GetAddressString(); if (!_subRegions.Contains(subRegion)) _subRegions.Add(subRegion); @@ -147,7 +148,7 @@ public class RealmManager : Singleton Log.outInfo(LogFilter.Realmlist, "Removed realm \"{0}\".", pair.Value); } - public Realm GetRealm(RealmHandle id) + public Realm GetRealm(RealmId id) { return _realms.LookupByKey(id); } @@ -177,7 +178,7 @@ public class RealmManager : Singleton } } - public byte[] GetRealmEntryJSON(RealmHandle id, uint build) + public byte[] GetRealmEntryJSON(RealmId id, uint build) { byte[] compressed = new byte[0]; Realm realm = GetRealm(id); @@ -209,7 +210,7 @@ public class RealmManager : Singleton } realmEntry.Version = version; - realmEntry.CfgRealmsID = (int)realm.Id.Realm; + realmEntry.CfgRealmsID = (int)realm.Id.Index; realmEntry.Flags = (int)realm.Flags; realmEntry.Name = realm.Name; realmEntry.CfgConfigsID = (int)realm.GetConfigId(); @@ -256,7 +257,7 @@ public class RealmManager : Singleton realmListUpdate.Update.Version.Build = (int)realm.Value.Build; } - realmListUpdate.Update.CfgRealmsID = (int)realm.Value.Id.Realm; + realmListUpdate.Update.CfgRealmsID = (int)realm.Value.Id.Index; realmListUpdate.Update.Flags = (int)flag; realmListUpdate.Update.Name = realm.Value.Name; realmListUpdate.Update.CfgConfigsID = (int)realm.Value.GetConfigId(); @@ -270,9 +271,9 @@ public class RealmManager : Singleton return Json.Deflate("JSONRealmListUpdates", realmList); } - public BattlenetRpcErrorCode JoinRealm(uint realmAddress, uint build, IPAddress clientAddress, Array clientSecret, LocaleConstant locale, string os, string accountName, Bgs.Protocol.GameUtilities.V1.ClientResponse response) + public BattlenetRpcErrorCode JoinRealm(uint realmAddress, uint build, IPAddress clientAddress, byte[] clientSecret, Locale locale, string os, string accountName, Bgs.Protocol.GameUtilities.V1.ClientResponse response) { - Realm realm = GetRealm(new RealmHandle(realmAddress)); + Realm realm = GetRealm(new RealmId(realmAddress)); if (realm != null) { if (realm.Flags.HasAnyFlag(RealmFlags.Offline) || realm.Build != build) @@ -328,7 +329,7 @@ public class RealmManager : Singleton List GetSubRegions() { return _subRegions; } List _builds = new List(); - ConcurrentDictionary _realms = new ConcurrentDictionary(); + ConcurrentDictionary _realms = new ConcurrentDictionary(); List _subRegions = new List(); Timer _updateTimer; } diff --git a/Source/Framework/Rest/Authentication/LogonData.cs b/Source/Framework/Rest/Authentication/LogonData.cs deleted file mode 100644 index 6fb1fb658..000000000 --- a/Source/Framework/Rest/Authentication/LogonData.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class LogonData - { - public string this[string inputId] => Inputs.SingleOrDefault(i => i.Id == inputId)?.Value; - - [DataMember(Name = "version")] - public string Version { get; set; } - - [DataMember(Name = "program_id")] - public string Program { get; set; } - - [DataMember(Name = "platform_id")] - public string Platform { get; set; } - - [DataMember(Name = "inputs")] - public List Inputs { get; set; } = new List(); - } -} diff --git a/Source/Framework/Rest/Forms/FormInput.cs b/Source/Framework/Rest/Forms/FormInput.cs deleted file mode 100644 index 69234b83f..000000000 --- a/Source/Framework/Rest/Forms/FormInput.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class FormInput - { - [DataMember(Name = "input_id")] - public string Id { get; set; } - - [DataMember(Name = "type")] - public string Type { get; set; } - - [DataMember(Name = "label")] - public string Label { get; set; } - - [DataMember(Name = "max_length")] - public int MaxLength { get; set; } - } -} diff --git a/Source/Framework/Rest/Forms/FormInputValue.cs b/Source/Framework/Rest/Forms/FormInputValue.cs deleted file mode 100644 index 568721022..000000000 --- a/Source/Framework/Rest/Forms/FormInputValue.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class FormInputValue - { - [DataMember(Name = "input_id")] - public string Id { get; set; } - - [DataMember(Name = "value")] - public string Value { get; set; } - } -} diff --git a/Source/Framework/Rest/Forms/FormInputs.cs b/Source/Framework/Rest/Forms/FormInputs.cs deleted file mode 100644 index 2441aa63b..000000000 --- a/Source/Framework/Rest/Forms/FormInputs.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class FormInputs - { - [DataMember(Name = "type")] - public string Type { get; set; } - - [DataMember(Name = "prompt")] - public string Prompt { get; set; } - - [DataMember(Name = "inputs")] - public List Inputs { get; set; } = new List(); - } -} diff --git a/Source/Framework/Rest/Misc/Address.cs b/Source/Framework/Rest/Misc/Address.cs deleted file mode 100644 index 73f851244..000000000 --- a/Source/Framework/Rest/Misc/Address.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class Address - { - [DataMember(Name = "ip")] - public string Ip { get; set; } - - [DataMember(Name = "port")] - public int Port { get; set; } - } -} diff --git a/Source/Framework/Rest/Misc/AddressFamily.cs b/Source/Framework/Rest/Misc/AddressFamily.cs deleted file mode 100644 index 98575fee5..000000000 --- a/Source/Framework/Rest/Misc/AddressFamily.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class AddressFamily - { - [DataMember(Name = "family")] - public int Id { get; set; } - - [DataMember(Name = "addresses")] - public IList
Addresses { get; set; } = new List
(); - } -} diff --git a/Source/Framework/Rest/Misc/ClientVersion.cs b/Source/Framework/Rest/Misc/ClientVersion.cs deleted file mode 100644 index ed693975e..000000000 --- a/Source/Framework/Rest/Misc/ClientVersion.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class ClientVersion - { - [DataMember(Name = "versionMajor")] - public int Major { get; set; } - - [DataMember(Name = "versionBuild")] - public int Build { get; set; } - - [DataMember(Name = "versionMinor")] - public int Minor { get; set; } - - [DataMember(Name = "versionRevision")] - public int Revision { get; set; } - } -} diff --git a/Source/Framework/Rest/Misc/RealmCharacterCountEntry.cs b/Source/Framework/Rest/Misc/RealmCharacterCountEntry.cs deleted file mode 100644 index c1f018da4..000000000 --- a/Source/Framework/Rest/Misc/RealmCharacterCountEntry.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmCharacterCountEntry - { - [DataMember(Name = "wowRealmAddress")] - public int WowRealmAddress { get; set; } - - [DataMember(Name = "count")] - public int Count { get; set; } - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmCharacterCountList.cs b/Source/Framework/Rest/Realmlist/RealmCharacterCountList.cs deleted file mode 100644 index 043593a4d..000000000 --- a/Source/Framework/Rest/Realmlist/RealmCharacterCountList.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmCharacterCountList - { - [DataMember(Name = "counts")] - public IList Counts { get; set; } = new List(); - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmListServerIPAddresses.cs b/Source/Framework/Rest/Realmlist/RealmListServerIPAddresses.cs deleted file mode 100644 index 12bee7a06..000000000 --- a/Source/Framework/Rest/Realmlist/RealmListServerIPAddresses.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmListServerIPAddresses - { - [DataMember(Name = "families")] - public IList Families { get; set; } = new List(); - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmListTicketClientInformation.cs b/Source/Framework/Rest/Realmlist/RealmListTicketClientInformation.cs deleted file mode 100644 index 994ef8cc5..000000000 --- a/Source/Framework/Rest/Realmlist/RealmListTicketClientInformation.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmListTicketClientInformation - { - [DataMember(Name = "info")] - public RealmListTicketInformation Info { get; set; } = new RealmListTicketInformation(); - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmListTicketIdentity.cs b/Source/Framework/Rest/Realmlist/RealmListTicketIdentity.cs deleted file mode 100644 index 6b2bf2a22..000000000 --- a/Source/Framework/Rest/Realmlist/RealmListTicketIdentity.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmListTicketIdentity - { - [DataMember(Name = "gameAccountID")] - public int GameAccountId { get; set; } - - [DataMember(Name = "gameAccountRegion")] - public int GameAccountRegion { get; set; } - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmListUpdate.cs b/Source/Framework/Rest/Realmlist/RealmListUpdate.cs deleted file mode 100644 index 9ad78c0eb..000000000 --- a/Source/Framework/Rest/Realmlist/RealmListUpdate.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmListUpdate - { - [DataMember(Name = "update")] - public RealmEntry Update { get; set; } = new RealmEntry(); - - [DataMember(Name = "deleting")] - public bool Deleting { get; set; } - } -} diff --git a/Source/Framework/Rest/Realmlist/RealmListUpdates.cs b/Source/Framework/Rest/Realmlist/RealmListUpdates.cs deleted file mode 100644 index 411519125..000000000 --- a/Source/Framework/Rest/Realmlist/RealmListUpdates.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012-2020 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 . - */ - -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Framework.Rest -{ - [DataContract] - public class RealmListUpdates - { - [DataMember(Name = "updates")] - public IList Updates { get; set; } = new List(); - } -} diff --git a/Source/Framework/Web/API/ApiRequest.cs b/Source/Framework/Web/API/ApiRequest.cs new file mode 100644 index 000000000..f4d33afda --- /dev/null +++ b/Source/Framework/Web/API/ApiRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Framework.Web.API +{ + public class ApiRequest + { + public uint? SearchId { get; set; } + public Func SearchFunc { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Authentication/LogonData.cs b/Source/Framework/Web/Rest/Authentication/LogonData.cs new file mode 100644 index 000000000..ffa4c1fba --- /dev/null +++ b/Source/Framework/Web/Rest/Authentication/LogonData.cs @@ -0,0 +1,27 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class LogonData + { + public string this[string inputId] => Inputs.SingleOrDefault(i => i.Id == inputId)?.Value; + + [DataMember(Name = "version")] + public string Version { get; set; } + + [DataMember(Name = "program_id")] + public string Program { get; set; } + + [DataMember(Name = "platform_id")] + public string Platform { get; set; } + + [DataMember(Name = "inputs")] + public List Inputs { get; set; } = new List(); + } +} diff --git a/Source/Framework/Rest/Authentication/LogonResult.cs b/Source/Framework/Web/Rest/Authentication/LogonResult.cs similarity index 53% rename from Source/Framework/Rest/Authentication/LogonResult.cs rename to Source/Framework/Web/Rest/Authentication/LogonResult.cs index 085cc1d54..2d1681be8 100644 --- a/Source/Framework/Rest/Authentication/LogonResult.cs +++ b/Source/Framework/Web/Rest/Authentication/LogonResult.cs @@ -1,23 +1,9 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using System.Runtime.Serialization; -namespace Framework.Rest +namespace Framework.Web { [DataContract] public class LogonResult diff --git a/Source/Framework/Web/Rest/Forms/FormInput.cs b/Source/Framework/Web/Rest/Forms/FormInput.cs new file mode 100644 index 000000000..77a9f43d7 --- /dev/null +++ b/Source/Framework/Web/Rest/Forms/FormInput.cs @@ -0,0 +1,23 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class FormInput + { + [DataMember(Name = "input_id")] + public string Id { get; set; } + + [DataMember(Name = "type")] + public string Type { get; set; } + + [DataMember(Name = "label")] + public string Label { get; set; } + + [DataMember(Name = "max_length")] + public int MaxLength { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Forms/FormInputValue.cs b/Source/Framework/Web/Rest/Forms/FormInputValue.cs new file mode 100644 index 000000000..f67f2af0c --- /dev/null +++ b/Source/Framework/Web/Rest/Forms/FormInputValue.cs @@ -0,0 +1,17 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class FormInputValue + { + [DataMember(Name = "input_id")] + public string Id { get; set; } + + [DataMember(Name = "value")] + public string Value { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Forms/FormInputs.cs b/Source/Framework/Web/Rest/Forms/FormInputs.cs new file mode 100644 index 000000000..aa2d5c799 --- /dev/null +++ b/Source/Framework/Web/Rest/Forms/FormInputs.cs @@ -0,0 +1,21 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class FormInputs + { + [DataMember(Name = "type")] + public string Type { get; set; } + + [DataMember(Name = "prompt")] + public string Prompt { get; set; } + + [DataMember(Name = "inputs")] + public List Inputs { get; set; } = new List(); + } +} diff --git a/Source/Framework/Web/Rest/Misc/Address.cs b/Source/Framework/Web/Rest/Misc/Address.cs new file mode 100644 index 000000000..0f071f463 --- /dev/null +++ b/Source/Framework/Web/Rest/Misc/Address.cs @@ -0,0 +1,17 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class Address + { + [DataMember(Name = "ip")] + public string Ip { get; set; } + + [DataMember(Name = "port")] + public int Port { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Misc/AddressFamily.cs b/Source/Framework/Web/Rest/Misc/AddressFamily.cs new file mode 100644 index 000000000..d41acca4e --- /dev/null +++ b/Source/Framework/Web/Rest/Misc/AddressFamily.cs @@ -0,0 +1,18 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class AddressFamily + { + [DataMember(Name = "family")] + public int Id { get; set; } + + [DataMember(Name = "addresses")] + public IList
Addresses { get; set; } = new List
(); + } +} diff --git a/Source/Framework/Web/Rest/Misc/ClientVersion.cs b/Source/Framework/Web/Rest/Misc/ClientVersion.cs new file mode 100644 index 000000000..416042d4a --- /dev/null +++ b/Source/Framework/Web/Rest/Misc/ClientVersion.cs @@ -0,0 +1,23 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class ClientVersion + { + [DataMember(Name = "versionMajor")] + public int Major { get; set; } + + [DataMember(Name = "versionBuild")] + public int Build { get; set; } + + [DataMember(Name = "versionMinor")] + public int Minor { get; set; } + + [DataMember(Name = "versionRevision")] + public int Revision { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Misc/RealmCharacterCountEntry.cs b/Source/Framework/Web/Rest/Misc/RealmCharacterCountEntry.cs new file mode 100644 index 000000000..228c1f456 --- /dev/null +++ b/Source/Framework/Web/Rest/Misc/RealmCharacterCountEntry.cs @@ -0,0 +1,17 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmCharacterCountEntry + { + [DataMember(Name = "wowRealmAddress")] + public int WowRealmAddress { get; set; } + + [DataMember(Name = "count")] + public int Count { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Realmlist/RealmCharacterCountList.cs b/Source/Framework/Web/Rest/Realmlist/RealmCharacterCountList.cs new file mode 100644 index 000000000..4503af6ca --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmCharacterCountList.cs @@ -0,0 +1,15 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmCharacterCountList + { + [DataMember(Name = "counts")] + public IList Counts { get; set; } = new List(); + } +} diff --git a/Source/Framework/Rest/Realmlist/RealmEntry.cs b/Source/Framework/Web/Rest/Realmlist/RealmEntry.cs similarity index 57% rename from Source/Framework/Rest/Realmlist/RealmEntry.cs rename to Source/Framework/Web/Rest/Realmlist/RealmEntry.cs index 9ec6d147b..d39d1ff7c 100644 --- a/Source/Framework/Rest/Realmlist/RealmEntry.cs +++ b/Source/Framework/Web/Rest/Realmlist/RealmEntry.cs @@ -1,23 +1,9 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using System.Runtime.Serialization; -namespace Framework.Rest +namespace Framework.Web { [DataContract] public class RealmEntry diff --git a/Source/Framework/Web/Rest/Realmlist/RealmListServerIPAddresses.cs b/Source/Framework/Web/Rest/Realmlist/RealmListServerIPAddresses.cs new file mode 100644 index 000000000..e867b19a0 --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmListServerIPAddresses.cs @@ -0,0 +1,15 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmListServerIPAddresses + { + [DataMember(Name = "families")] + public IList Families { get; set; } = new List(); + } +} diff --git a/Source/Framework/Web/Rest/Realmlist/RealmListTicketClientInformation.cs b/Source/Framework/Web/Rest/Realmlist/RealmListTicketClientInformation.cs new file mode 100644 index 000000000..d1f73f034 --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmListTicketClientInformation.cs @@ -0,0 +1,14 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmListTicketClientInformation + { + [DataMember(Name = "info")] + public RealmListTicketInformation Info { get; set; } = new RealmListTicketInformation(); + } +} diff --git a/Source/Framework/Web/Rest/Realmlist/RealmListTicketIdentity.cs b/Source/Framework/Web/Rest/Realmlist/RealmListTicketIdentity.cs new file mode 100644 index 000000000..7c9b2c70f --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmListTicketIdentity.cs @@ -0,0 +1,17 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmListTicketIdentity + { + [DataMember(Name = "gameAccountID")] + public int GameAccountId { get; set; } + + [DataMember(Name = "gameAccountRegion")] + public int GameAccountRegion { get; set; } + } +} diff --git a/Source/Framework/Rest/Realmlist/RealmListTicketInformation.cs b/Source/Framework/Web/Rest/Realmlist/RealmListTicketInformation.cs similarity index 65% rename from Source/Framework/Rest/Realmlist/RealmListTicketInformation.cs rename to Source/Framework/Web/Rest/Realmlist/RealmListTicketInformation.cs index 21a248dd2..06b6dfa89 100644 --- a/Source/Framework/Rest/Realmlist/RealmListTicketInformation.cs +++ b/Source/Framework/Web/Rest/Realmlist/RealmListTicketInformation.cs @@ -1,24 +1,10 @@ -/* - * Copyright (C) 2012-2020 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 . - */ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using System.Collections.Generic; using System.Runtime.Serialization; -namespace Framework.Rest +namespace Framework.Web { [DataContract] public class RealmListTicketInformation diff --git a/Source/Framework/Web/Rest/Realmlist/RealmListUpdate.cs b/Source/Framework/Web/Rest/Realmlist/RealmListUpdate.cs new file mode 100644 index 000000000..e45b131f9 --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmListUpdate.cs @@ -0,0 +1,17 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmListUpdate + { + [DataMember(Name = "update")] + public RealmEntry Update { get; set; } = new RealmEntry(); + + [DataMember(Name = "deleting")] + public bool Deleting { get; set; } + } +} diff --git a/Source/Framework/Web/Rest/Realmlist/RealmListUpdates.cs b/Source/Framework/Web/Rest/Realmlist/RealmListUpdates.cs new file mode 100644 index 000000000..64a880584 --- /dev/null +++ b/Source/Framework/Web/Rest/Realmlist/RealmListUpdates.cs @@ -0,0 +1,15 @@ +// Copyright (c) CypherCore All rights reserved. +// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Framework.Web +{ + [DataContract] + public class RealmListUpdates + { + [DataMember(Name = "updates")] + public IList Updates { get; set; } = new List(); + } +} diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index 192415e1f..3b96bc0e7 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -25,8 +25,8 @@ using Game.Groups; using Game.Guilds; using Game.Mails; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Text; @@ -554,8 +554,8 @@ namespace Game.Achievements string subject = reward.Subject; string text = reward.Body; - LocaleConstant localeConstant = _owner.GetSession().GetSessionDbLocaleIndex(); - if (localeConstant != LocaleConstant.enUS) + Locale localeConstant = _owner.GetSession().GetSessionDbLocaleIndex(); + if (localeConstant != Locale.enUS) { AchievementRewardLocale loc = Global.AchievementMgr.GetAchievementRewardLocale(achievement); if (loc != null) @@ -1327,8 +1327,8 @@ namespace Game.Achievements } AchievementRewardLocale data = new AchievementRewardLocale(); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; ObjectManager.AddLocaleString(result.Read(2), locale, data.Subject); @@ -1363,8 +1363,8 @@ namespace Game.Achievements public class AchievementRewardLocale { - public StringArray Subject = new StringArray((int)LocaleConstant.Total); - public StringArray Body = new StringArray((int)LocaleConstant.Total); + public StringArray Subject = new StringArray((int)Locale.Total); + public StringArray Body = new StringArray((int)Locale.Total); } public class CompletedAchievementData diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index fc6f040bd..27112acc8 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -24,8 +24,8 @@ using Game.DataStorage; using Game.Entities; using Game.Garrisons; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Scenarios; using Game.Spells; using System; diff --git a/Source/Game/Arenas/Arena.cs b/Source/Game/Arenas/Arena.cs index 2d89cd760..e4dff6a96 100644 --- a/Source/Game/Arenas/Arena.cs +++ b/Source/Game/Arenas/Arena.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.BattleGrounds; using Game.Entities; using Game.Guilds; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Arenas/ArenaScore.cs b/Source/Game/Arenas/ArenaScore.cs index 8af0cf46a..b85392d84 100644 --- a/Source/Game/Arenas/ArenaScore.cs +++ b/Source/Game/Arenas/ArenaScore.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.BattleGrounds; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.Arenas { diff --git a/Source/Game/Arenas/ArenaTeam.cs b/Source/Game/Arenas/ArenaTeam.cs index 42b5bb4f6..6fc662c5c 100644 --- a/Source/Game/Arenas/ArenaTeam.cs +++ b/Source/Game/Arenas/ArenaTeam.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.Entities; using Game.Groups; -using Game.Network; +using Game.Networking; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Arenas/Zones/BladesEdgeArena.cs b/Source/Game/Arenas/Zones/BladesEdgeArena.cs index 2139a535f..a71eee81f 100644 --- a/Source/Game/Arenas/Zones/BladesEdgeArena.cs +++ b/Source/Game/Arenas/Zones/BladesEdgeArena.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.BattleGrounds; namespace Game.Arenas diff --git a/Source/Game/Arenas/Zones/DalaranSewers.cs b/Source/Game/Arenas/Zones/DalaranSewers.cs index 3e33298c7..568c5583b 100644 --- a/Source/Game/Arenas/Zones/DalaranSewers.cs +++ b/Source/Game/Arenas/Zones/DalaranSewers.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Dynamic; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.BattleGrounds; namespace Game.Arenas diff --git a/Source/Game/Arenas/Zones/NagrandArena.cs b/Source/Game/Arenas/Zones/NagrandArena.cs index 7d05372dd..3a6b21e9c 100644 --- a/Source/Game/Arenas/Zones/NagrandArena.cs +++ b/Source/Game/Arenas/Zones/NagrandArena.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.BattleGrounds; namespace Game.Arenas diff --git a/Source/Game/Arenas/Zones/RingofValor.cs b/Source/Game/Arenas/Zones/RingofValor.cs index 4245904db..ee5fe1435 100644 --- a/Source/Game/Arenas/Zones/RingofValor.cs +++ b/Source/Game/Arenas/Zones/RingofValor.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Dynamic; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.BattleGrounds; namespace Game.Arenas diff --git a/Source/Game/Arenas/Zones/RuinsofLordaeron.cs b/Source/Game/Arenas/Zones/RuinsofLordaeron.cs index 3d7d9405b..0f0e9df70 100644 --- a/Source/Game/Arenas/Zones/RuinsofLordaeron.cs +++ b/Source/Game/Arenas/Zones/RuinsofLordaeron.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.BattleGrounds; namespace Game.Arenas diff --git a/Source/Game/AuctionHouse/AuctionManager.cs b/Source/Game/AuctionHouse/AuctionManager.cs index 2b900b268..fb3852c78 100644 --- a/Source/Game/AuctionHouse/AuctionManager.cs +++ b/Source/Game/AuctionHouse/AuctionManager.cs @@ -21,7 +21,7 @@ using Framework.Dynamic; using Game.DataStorage; using Game.Entities; using Game.Mails; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Collections.Concurrent; @@ -588,9 +588,9 @@ namespace Game break; } - for (LocaleConstant locale = LocaleConstant.enUS; locale < LocaleConstant.Total; ++locale) + for (Locale locale = Locale.enUS; locale < Locale.Total; ++locale) { - if (locale == LocaleConstant.None) + if (locale == Locale.None) continue; bucket.FullName[(int)locale] = auction.Items[0].GetName(locale); @@ -677,7 +677,7 @@ namespace Game _itemsByAuctionId[auction.Id] = auction; - AuctionPosting.Sorter insertSorter = new AuctionPosting.Sorter(LocaleConstant.enUS, new AuctionSortDef[] { new AuctionSortDef(AuctionHouseSortOrder.Price, false) }, 1); + AuctionPosting.Sorter insertSorter = new AuctionPosting.Sorter(Locale.enUS, new AuctionSortDef[] { new AuctionSortDef(AuctionHouseSortOrder.Price, false) }, 1); var auctionIndex = bucket.Auctions.BinarySearch(auction, insertSorter); if (auctionIndex < 0) auctionIndex = ~auctionIndex; @@ -1407,7 +1407,7 @@ namespace Game else { bidderAccId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(auction.Bidder); - logGmTrade = Global.AccountMgr.HasPermission(bidderAccId, RBACPermissions.LogGmTrade, Global.WorldMgr.GetRealmId().Realm); + logGmTrade = Global.AccountMgr.HasPermission(bidderAccId, RBACPermissions.LogGmTrade, Global.WorldMgr.GetRealmId().Index); if (logGmTrade && !Global.CharacterCacheStorage.GetCharacterNameByGuid(auction.Bidder, out bidderName)) bidderName = Global.ObjectMgr.GetCypherString(CypherStrings.Unknown); @@ -1724,7 +1724,7 @@ namespace Game public class Sorter : IComparer { - public Sorter(LocaleConstant locale, AuctionSortDef[] sorts, int sortCount) + public Sorter(Locale locale, AuctionSortDef[] sorts, int sortCount) { _locale = locale; _sorts = sorts; @@ -1776,7 +1776,7 @@ namespace Game return 0; } - LocaleConstant _locale; + Locale _locale; AuctionSortDef[] _sorts; int _sortCount; } @@ -1800,7 +1800,7 @@ namespace Game public byte SortLevel = 0; public byte MinBattlePetLevel = 0; public byte MaxBattlePetLevel = 0; - public string[] FullName = new string[(int)LocaleConstant.Total]; + public string[] FullName = new string[(int)Locale.Total]; public List Auctions = new List(); @@ -1846,7 +1846,7 @@ namespace Game public class Sorter : IComparer { - public Sorter(LocaleConstant locale, AuctionSortDef[] sorts, int sortCount) + public Sorter(Locale locale, AuctionSortDef[] sorts, int sortCount) { _locale = locale; _sorts = sorts; @@ -1884,7 +1884,7 @@ namespace Game return 0; } - LocaleConstant _locale; + Locale _locale; AuctionSortDef[] _sorts; int _sortCount; } diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index 2599f0b1b..d6825de20 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -21,8 +21,8 @@ using Game.DataStorage; using Game.Entities; using Game.Groups; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/BattleFields/Zones/WinterGrasp.cs b/Source/Game/BattleFields/Zones/WinterGrasp.cs index c6cd3befd..df5ed7021 100644 --- a/Source/Game/BattleFields/Zones/WinterGrasp.cs +++ b/Source/Game/BattleFields/Zones/WinterGrasp.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 8bb2aee28..158c2da3b 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -24,8 +24,8 @@ using Game.Entities; using Game.Groups; using Game.Guilds; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index a4d766dda..2c24e3bec 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -20,7 +20,7 @@ using Framework.Database; using Game.Arenas; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/BattleGrounds/BattleGroundQueue.cs b/Source/Game/BattleGrounds/BattleGroundQueue.cs index 422434a1d..33ae145b5 100644 --- a/Source/Game/BattleGrounds/BattleGroundQueue.cs +++ b/Source/Game/BattleGrounds/BattleGroundQueue.cs @@ -21,7 +21,7 @@ using Game.Arenas; using Game.DataStorage; using Game.Entities; using Game.Groups; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/BattleGrounds/BattleGroundScore.cs b/Source/Game/BattleGrounds/BattleGroundScore.cs index 4f553fd1c..de0877bff 100644 --- a/Source/Game/BattleGrounds/BattleGroundScore.cs +++ b/Source/Game/BattleGrounds/BattleGroundScore.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.BattleGrounds { diff --git a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs index cd563b3e6..ed0cbfea2 100644 --- a/Source/Game/BattleGrounds/Zones/ArathiBasin.cs +++ b/Source/Game/BattleGrounds/Zones/ArathiBasin.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs index 98ae39be0..7836eaccc 100644 --- a/Source/Game/BattleGrounds/Zones/EyeofStorm.cs +++ b/Source/Game/BattleGrounds/Zones/EyeofStorm.cs @@ -18,7 +18,7 @@ using Game.Entities; using Framework.Constants; using System.Collections.Generic; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.DataStorage; using Game.BattleGrounds; diff --git a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs index b60be09f0..75317459b 100644 --- a/Source/Game/BattleGrounds/Zones/StrandofAncients.cs +++ b/Source/Game/BattleGrounds/Zones/StrandofAncients.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; using Framework.GameMath; diff --git a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs index 801c34771..31c98739a 100644 --- a/Source/Game/BattleGrounds/Zones/WarsongGluch.cs +++ b/Source/Game/BattleGrounds/Zones/WarsongGluch.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.BattleGrounds.Zones diff --git a/Source/Game/BattlePets/BattlePetManager.cs b/Source/Game/BattlePets/BattlePetManager.cs index 10866d132..dab7740df 100644 --- a/Source/Game/BattlePets/BattlePetManager.cs +++ b/Source/Game/BattlePets/BattlePetManager.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/BlackMarket/BlackMarketEntry.cs b/Source/Game/BlackMarket/BlackMarketEntry.cs index 97f2e0829..eed24816e 100644 --- a/Source/Game/BlackMarket/BlackMarketEntry.cs +++ b/Source/Game/BlackMarket/BlackMarketEntry.cs @@ -19,7 +19,7 @@ using Framework.Collections; using Framework.Constants; using Framework.Database; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.BlackMarket diff --git a/Source/Game/BlackMarket/BlackMarketManager.cs b/Source/Game/BlackMarket/BlackMarketManager.cs index 2e7b6d67b..852888e76 100644 --- a/Source/Game/BlackMarket/BlackMarketManager.cs +++ b/Source/Game/BlackMarket/BlackMarketManager.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.Entities; using Game.Mails; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.BlackMarket @@ -232,7 +232,7 @@ namespace Game.BlackMarket if (bidderAccId == 0) // Account exists return; - logGmTrade = Global.AccountMgr.HasPermission(bidderAccId, RBACPermissions.LogGmTrade, Global.WorldMgr.GetRealmId().Realm); + logGmTrade = Global.AccountMgr.HasPermission(bidderAccId, RBACPermissions.LogGmTrade, Global.WorldMgr.GetRealmId().Index); if (logGmTrade && !Global.CharacterCacheStorage.GetCharacterNameByGuid(bidderGuid, out bidderName)) bidderName = Global.ObjectMgr.GetCypherString(CypherStrings.Unknown); diff --git a/Source/Game/Cache/CharacterCache.cs b/Source/Game/Cache/CharacterCache.cs index c595059e7..08c0e5ff3 100644 --- a/Source/Game/Cache/CharacterCache.cs +++ b/Source/Game/Cache/CharacterCache.cs @@ -4,7 +4,7 @@ using Game.Entities; using Framework.Database; using Framework.Constants; using Game.Arenas; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.Cache { diff --git a/Source/Game/Calendar/CalendarManager.cs b/Source/Game/Calendar/CalendarManager.cs index f59157977..a9eb5f97c 100644 --- a/Source/Game/Calendar/CalendarManager.cs +++ b/Source/Game/Calendar/CalendarManager.cs @@ -20,8 +20,8 @@ using Framework.Database; using Game.Entities; using Game.Guilds; using Game.Mails; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Chat/Channels/Channel.cs b/Source/Game/Chat/Channels/Channel.cs index a5906917f..7651dd05b 100644 --- a/Source/Game/Chat/Channels/Channel.cs +++ b/Source/Game/Chat/Channels/Channel.cs @@ -21,7 +21,7 @@ using Framework.Database; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; @@ -106,7 +106,7 @@ namespace Game.Chat } } - public static void GetChannelName(ref string channelName, uint channelId, LocaleConstant locale, AreaTableRecord zoneEntry) + public static void GetChannelName(ref string channelName, uint channelId, Locale locale, AreaTableRecord zoneEntry) { if (channelId != 0) { @@ -123,7 +123,7 @@ namespace Game.Chat } } - public string GetName(LocaleConstant locale = LocaleConstant.enUS) + public string GetName(Locale locale = Locale.enUS) { string result = _channelName; GetChannelName(ref result, _channelId, locale, _zoneEntry); diff --git a/Source/Game/Chat/Channels/ChannelAppenders.cs b/Source/Game/Chat/Channels/ChannelAppenders.cs index 51048a72c..ece5f1fb4 100644 --- a/Source/Game/Chat/Channels/ChannelAppenders.cs +++ b/Source/Game/Chat/Channels/ChannelAppenders.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Cache; namespace Game.Chat @@ -38,10 +38,10 @@ namespace Game.Chat _modifier = modifier; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { // LocalizedPacketDo sends client DBC locale, we need to get available to server locale - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); ChannelNotify data = new ChannelNotify(); data.Type = _modifier.GetNotificationType(); @@ -61,9 +61,9 @@ namespace Game.Chat _source = source; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); ChannelNotifyJoined notify = new ChannelNotifyJoined(); //notify.ChannelWelcomeMsg = ""; @@ -86,9 +86,9 @@ namespace Game.Chat _suspended = suspend; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); ChannelNotifyLeft notify = new ChannelNotifyLeft(); notify.Channel = _source.GetName(localeIdx); @@ -111,9 +111,9 @@ namespace Game.Chat _guid = guid; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); ChatPkt packet = new ChatPkt(); Player player = Global.ObjAccessor.FindConnectedPlayer(_guid); @@ -146,17 +146,17 @@ namespace Game.Chat _guid = guid; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); ChatPkt packet = new ChatPkt(); Player player = Global.ObjAccessor.FindConnectedPlayer(_guid); if (player) - packet.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx), LocaleConstant.enUS, _prefix); + packet.Initialize(ChatMsg.Channel, _lang, player, player, _what, 0, _source.GetName(localeIdx), Locale.enUS, _prefix); else { - packet.Initialize(ChatMsg.Channel, _lang, null, null, _what, 0, _source.GetName(localeIdx), LocaleConstant.enUS, _prefix); + packet.Initialize(ChatMsg.Channel, _lang, null, null, _what, 0, _source.GetName(localeIdx), Locale.enUS, _prefix); packet.SenderGUID = _guid; packet.TargetGUID = _guid; } @@ -179,9 +179,9 @@ namespace Game.Chat _guid = guid; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); UserlistAdd userlistAdd = new UserlistAdd(); userlistAdd.AddedUserGUID = _guid; @@ -204,9 +204,9 @@ namespace Game.Chat _guid = guid; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); UserlistUpdate userlistUpdate = new UserlistUpdate(); userlistUpdate.UpdatedUserGUID = _guid; @@ -229,9 +229,9 @@ namespace Game.Chat _guid = guid; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { - LocaleConstant localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); + Locale localeIdx = Global.WorldMgr.GetAvailableDbcLocale(locale); UserlistRemove userlistRemove = new UserlistRemove(); userlistRemove.RemovedUserGUID = _guid; diff --git a/Source/Game/Chat/Channels/ChannelManager.cs b/Source/Game/Chat/Channels/ChannelManager.cs index b44938e7d..58f550b82 100644 --- a/Source/Game/Chat/Channels/ChannelManager.cs +++ b/Source/Game/Chat/Channels/ChannelManager.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; @@ -145,7 +145,7 @@ namespace Game.Chat { ulong high = 0; high |= (ulong)HighGuid.ChatChannel << 58; - high |= (ulong)Global.WorldMgr.GetRealmId().Realm << 42; + high |= (ulong)Global.WorldMgr.GetRealmId().Index << 42; high |= (ulong)(_team == Team.Alliance ? 3 : 5) << 4; ObjectGuid channelGuid = new ObjectGuid(); @@ -163,7 +163,7 @@ namespace Game.Chat ulong high = 0; high |= (ulong)HighGuid.ChatChannel << 58; - high |= (ulong)Global.WorldMgr.GetRealmId().Realm << 42; + high |= (ulong)Global.WorldMgr.GetRealmId().Index << 42; high |= 1ul << 25; // built-in if (channelEntry.Flags.HasAnyFlag(ChannelDBCFlags.CityOnly2)) high |= 1ul << 24; // trade diff --git a/Source/Game/Chat/CommandHandler.cs b/Source/Game/Chat/CommandHandler.cs index f008325ca..8f43eb875 100644 --- a/Source/Game/Chat/CommandHandler.cs +++ b/Source/Game/Chat/CommandHandler.cs @@ -22,7 +22,7 @@ using Game.DataStorage; using Game.Entities; using Game.Groups; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; @@ -735,7 +735,7 @@ namespace Game.Chat return Global.ObjectMgr.GetCypherString(str); } - public virtual LocaleConstant GetSessionDbcLocale() + public virtual Locale GetSessionDbcLocale() { return _session.GetSessionDbcLocale(); } @@ -864,7 +864,7 @@ namespace Game.Chat return true; } - public override LocaleConstant GetSessionDbcLocale() + public override Locale GetSessionDbcLocale() { return Global.WorldMgr.GetDefaultDbcLocale(); } diff --git a/Source/Game/Chat/Commands/BanCommands.cs b/Source/Game/Chat/Commands/BanCommands.cs index 4caf94940..742d7e44e 100644 --- a/Source/Game/Chat/Commands/BanCommands.cs +++ b/Source/Game/Chat/Commands/BanCommands.cs @@ -317,7 +317,7 @@ namespace Game.Chat.Commands [Command("account", RBACPermissions.CommandBanlistAccount, true)] static bool HandleBanListAccountCommand(StringArguments args, CommandHandler handler) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS); + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans); DB.Login.Execute(stmt); string filterStr = args.NextString(); @@ -433,7 +433,7 @@ namespace Game.Chat.Commands [Command("ip", RBACPermissions.CommandBanlistIp, true)] static bool HandleBanListIPCommand(StringArguments args, CommandHandler handler) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS); + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans); DB.Login.Execute(stmt); string filterStr = args.NextString(); diff --git a/Source/Game/Chat/Commands/CharacterCommands.cs b/Source/Game/Chat/Commands/CharacterCommands.cs index 20d16e715..73c6c131c 100644 --- a/Source/Game/Chat/Commands/CharacterCommands.cs +++ b/Source/Game/Chat/Commands/CharacterCommands.cs @@ -40,7 +40,7 @@ namespace Game.Chat if (!handler.ExtractPlayerTarget(args, out target)) return false; - LocaleConstant loc = handler.GetSessionDbcLocale(); + Locale loc = handler.GetSessionDbcLocale(); string targetName = target.GetName(); string knownStr = handler.GetCypherString(CypherStrings.Known); @@ -405,7 +405,7 @@ namespace Game.Chat if (!handler.ExtractPlayerTarget(args, out target)) return false; - LocaleConstant loc = handler.GetSessionDbcLocale(); + Locale loc = handler.GetSessionDbcLocale(); var targetFSL = target.GetReputationMgr().GetStateList(); foreach (var pair in targetFSL) diff --git a/Source/Game/Chat/Commands/DebugCommands.cs b/Source/Game/Chat/Commands/DebugCommands.cs index 157cabb3e..819c1b1b6 100644 --- a/Source/Game/Chat/Commands/DebugCommands.cs +++ b/Source/Game/Chat/Commands/DebugCommands.cs @@ -23,7 +23,7 @@ using Game.Combat; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Text; diff --git a/Source/Game/Chat/Commands/GMCommands.cs b/Source/Game/Chat/Commands/GMCommands.cs index 0551a83e2..18ac7fb5d 100644 --- a/Source/Game/Chat/Commands/GMCommands.cs +++ b/Source/Game/Chat/Commands/GMCommands.cs @@ -170,7 +170,7 @@ namespace Game.Chat // Get the accounts with GM Level >0 PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_GM_ACCOUNTS); stmt.AddValue(0, AccountTypes.Moderator); - stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Realm); + stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Index); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) diff --git a/Source/Game/Chat/Commands/LearnCommands.cs b/Source/Game/Chat/Commands/LearnCommands.cs index 38e5f69a4..11857cfb9 100644 --- a/Source/Game/Chat/Commands/LearnCommands.cs +++ b/Source/Game/Chat/Commands/LearnCommands.cs @@ -164,7 +164,7 @@ namespace Game.Chat.Commands skillInfo.CanLink == 0) // only prof with recipes have set continue; - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); name = skillInfo.DisplayName[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -172,7 +172,7 @@ namespace Game.Chat.Commands if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -186,7 +186,7 @@ namespace Game.Chat.Commands } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { skillId = skillInfo.Id; break; diff --git a/Source/Game/Chat/Commands/LookupCommands.cs b/Source/Game/Chat/Commands/LookupCommands.cs index 3c89068ec..65fa33b29 100644 --- a/Source/Game/Chat/Commands/LookupCommands.cs +++ b/Source/Game/Chat/Commands/LookupCommands.cs @@ -45,7 +45,7 @@ namespace Game.Chat // Search in AreaTable.dbc foreach (var areaEntry in CliDB.AreaTableStorage.Values) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = areaEntry.AreaName[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -53,7 +53,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -67,7 +67,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && count++ == maxlookup) { @@ -234,7 +234,7 @@ namespace Game.Chat { FactionState factionState = target ? target.GetReputationMgr().GetState(factionEntry) : null; - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = factionEntry.Name[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -242,7 +242,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -256,7 +256,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && count++ == maxlookup) { @@ -365,7 +365,7 @@ namespace Game.Chat // Search in ItemSet.dbc foreach (var set in CliDB.ItemSetStorage.Values) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = set.Name[locale]; if (name.IsEmpty()) continue; @@ -373,7 +373,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -387,7 +387,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && count++ == maxlookup) { @@ -629,7 +629,7 @@ namespace Game.Chat // Search in SkillLine.dbc foreach (var skillInfo in CliDB.SkillLineStorage.Values) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = skillInfo.DisplayName[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -637,7 +637,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -651,7 +651,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && count++ == maxlookup) { @@ -700,7 +700,7 @@ namespace Game.Chat bool found = false; uint count = 0; - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); // Search in TaxiNodes.dbc foreach (var nodeEntry in CliDB.TaxiNodesStorage.Values) @@ -802,7 +802,7 @@ namespace Game.Chat if (target && target.GetGender() != gender) continue; - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = gender == Gender.Male ? titleInfo.Name[locale]: titleInfo.Name1[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -810,7 +810,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -824,7 +824,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && counter == maxlookup) { @@ -869,7 +869,7 @@ namespace Game.Chat // search in Map.dbc foreach (var mapInfo in CliDB.MapStorage.Values) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = mapInfo.MapName[locale]; if (string.IsNullOrEmpty(name)) continue; @@ -877,7 +877,7 @@ namespace Game.Chat if (!name.Like(namePart) && handler.GetSession()) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -891,7 +891,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && counter == maxlookup) { @@ -1071,7 +1071,7 @@ namespace Game.Chat SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellName.Id, Difficulty.None); if (spellInfo != null) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = spellInfo.SpellName[locale]; if (name.IsEmpty()) continue; @@ -1079,7 +1079,7 @@ namespace Game.Chat if (!name.Like(namePart)) { locale = 0; - for (; locale < LocaleConstant.Total; ++locale) + for (; locale < Locale.Total; ++locale) { if (locale == handler.GetSessionDbcLocale()) continue; @@ -1093,7 +1093,7 @@ namespace Game.Chat } } - if (locale < LocaleConstant.Total) + if (locale < Locale.Total) { if (maxlookup != 0 && count++ == maxlookup) { @@ -1167,7 +1167,7 @@ namespace Game.Chat SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(id, Difficulty.None); if (spellInfo != null) { - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); string name = spellInfo.SpellName[locale]; if (string.IsNullOrEmpty(name)) { diff --git a/Source/Game/Chat/Commands/MessageCommands.cs b/Source/Game/Chat/Commands/MessageCommands.cs index 673d24dae..966aeb431 100644 --- a/Source/Game/Chat/Commands/MessageCommands.cs +++ b/Source/Game/Chat/Commands/MessageCommands.cs @@ -20,7 +20,7 @@ using Framework.Database; using Framework.IO; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; namespace Game.Chat diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 938c18035..e1e5c2a07 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -24,7 +24,7 @@ using Game.Entities; using Game.Groups; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -263,7 +263,7 @@ namespace Game.Chat { var record = CliDB.ItemSparseStorage.Values.FirstOrDefault(itemSparse => { - for (LocaleConstant i = 0; i < LocaleConstant.Total; ++i) + for (Locale i = 0; i < Locale.Total; ++i) if (itemName == itemSparse.Display[i]) return true; return false; @@ -1359,7 +1359,7 @@ namespace Game.Chat Race raceid; Class classid; Gender gender; - LocaleConstant locale = handler.GetSessionDbcLocale(); + Locale locale = handler.GetSessionDbcLocale(); uint totalPlayerTime; uint level; string alive = handler.GetCypherString(CypherStrings.Error); @@ -1437,7 +1437,7 @@ namespace Game.Chat // Query the prepared statement for login data stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO); - stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Realm); + stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Index); stmt.AddValue(1, accId); SQLResult result0 = DB.Login.Query(stmt); diff --git a/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index 2bb95f974..6d3634602 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.IO; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Chat/Commands/RbacCommands.cs b/Source/Game/Chat/Commands/RbacCommands.cs index 9be1405a3..b0592f77b 100644 --- a/Source/Game/Chat/Commands/RbacCommands.cs +++ b/Source/Game/Chat/Commands/RbacCommands.cs @@ -296,7 +296,7 @@ namespace Game.Chat.Commands if (rdata == null) { - data.rbac = new RBACData(accountId, accountName, (int)Global.WorldMgr.GetRealm().Id.Realm, (byte)Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm)); + data.rbac = new RBACData(accountId, accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index)); data.rbac.LoadFromDB(); data.needDelete = true; } diff --git a/Source/Game/Chat/Commands/TicketCommands.cs b/Source/Game/Chat/Commands/TicketCommands.cs index 53bbe83d8..69b62740a 100644 --- a/Source/Game/Chat/Commands/TicketCommands.cs +++ b/Source/Game/Chat/Commands/TicketCommands.cs @@ -260,7 +260,7 @@ namespace Game.Chat.Commands ObjectGuid targetGuid = Global.CharacterCacheStorage.GetCharacterGuidByName(target); uint accountId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid); // Target must exist and have administrative rights - if (!Global.AccountMgr.HasPermission(accountId, RBACPermissions.CommandsBeAssignedTicket, Global.WorldMgr.GetRealm().Id.Realm)) + if (!Global.AccountMgr.HasPermission(accountId, RBACPermissions.CommandsBeAssignedTicket, Global.WorldMgr.GetRealm().Id.Index)) { handler.SendSysMessage(CypherStrings.CommandTicketassignerrorA); return true; @@ -283,7 +283,7 @@ namespace Game.Chat.Commands } // Assign ticket - ticket.SetAssignedTo(targetGuid, Global.AccountMgr.IsAdminAccount(Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm))); + ticket.SetAssignedTo(targetGuid, Global.AccountMgr.IsAdminAccount(Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index))); ticket.SaveToDB(); string msg = ticket.FormatViewMessageString(handler, null, target, null, null); @@ -448,7 +448,7 @@ namespace Game.Chat.Commands { ObjectGuid guid = ticket.GetAssignedToGUID(); uint accountId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(guid); - security = Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm); + security = Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index); } // Check security diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index 731771688..c2fef5a06 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -28,7 +28,7 @@ namespace Game.DataStorage internal static int LoadedFileCount; internal static string DataPath; - public static void LoadStores(string dataPath, LocaleConstant defaultLocale) + public static void LoadStores(string dataPath, Locale defaultLocale) { uint oldMSTime = Time.GetMSTime(); LoadedFileCount = 0; @@ -36,7 +36,7 @@ namespace Game.DataStorage DataPath = dataPath + "/dbc/" + defaultLocale + "/"; AchievementStorage = DBReader.Read("Achievement.db2", HotfixStatements.SEL_ACHIEVEMENT, HotfixStatements.SEL_ACHIEVEMENT_LOCALE); - AnimationDataStorage = DBReader.Read("AnimationData.db2", HotfixStatements.SEL_ANIMATION_DATA); + //AnimationDataStorage = DBReader.Read("AnimationData.db2", HotfixStatements.SEL_ANIMATION_DATA); AnimKitStorage = DBReader.Read("AnimKit.db2", HotfixStatements.SEL_ANIM_KIT); AreaGroupMemberStorage = DBReader.Read("AreaGroupMember.db2", HotfixStatements.SEL_AREA_GROUP_MEMBER); AreaTableStorage = DBReader.Read("AreaTable.db2", HotfixStatements.SEL_AREA_TABLE, HotfixStatements.SEL_AREA_TABLE_LOCALE); diff --git a/Source/Game/DataStorage/ClientReader/DB6Storage.cs b/Source/Game/DataStorage/ClientReader/DB6Storage.cs index f288ca495..4905b6e43 100644 --- a/Source/Game/DataStorage/ClientReader/DB6Storage.cs +++ b/Source/Game/DataStorage/ClientReader/DB6Storage.cs @@ -30,7 +30,7 @@ namespace Game.DataStorage { bool HasRecord(uint id); - void WriteRecord(uint id, LocaleConstant locale, ByteBuffer buffer); + void WriteRecord(uint id, Locale locale, ByteBuffer buffer); void EraseRecord(uint id); } @@ -191,9 +191,9 @@ namespace Game.DataStorage if (preparedStatementLocale == 0) return; - for (LocaleConstant locale = 0; locale < LocaleConstant.Total; ++locale) + for (Locale locale = 0; locale < Locale.Total; ++locale) { - if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == LocaleConstant.None) + if (Global.WorldMgr.GetDefaultDbcLocale() == locale || locale == Locale.None) continue; PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatementLocale); @@ -235,7 +235,7 @@ namespace Game.DataStorage return ContainsKey(id); } - public void WriteRecord(uint id, LocaleConstant locale, ByteBuffer buffer) + public void WriteRecord(uint id, Locale locale, ByteBuffer buffer) { T entry = this.LookupByKey(id); diff --git a/Source/Game/DataStorage/ClientReader/DBReader.cs b/Source/Game/DataStorage/ClientReader/DBReader.cs index bc0c23a0d..c970f0f1f 100644 --- a/Source/Game/DataStorage/ClientReader/DBReader.cs +++ b/Source/Game/DataStorage/ClientReader/DBReader.cs @@ -536,13 +536,13 @@ namespace Game.DataStorage LocalizedString localized = new LocalizedString(); if (_stringsTable == null) { - localized[LocaleConstant.enUS] = _data.ReadCString(); + localized[Locale.enUS] = _data.ReadCString(); } else { var pos = _recordsOffset + (_data.Position >> 3); int ofs = GetFieldValue(fieldIndex); - localized[LocaleConstant.enUS] = _stringsTable.LookupByKey(pos + ofs); + localized[Locale.enUS] = _stringsTable.LookupByKey(pos + ofs); } f.SetValue(obj, localized); @@ -732,12 +732,12 @@ namespace Game.DataStorage public class LocalizedString { - public bool HasString(LocaleConstant locale = SharedConst.DefaultLocale) + public bool HasString(Locale locale = SharedConst.DefaultLocale) { return !string.IsNullOrEmpty(stringStorage[(int)locale]); } - public string this[LocaleConstant locale] + public string this[Locale locale] { get { @@ -749,6 +749,6 @@ namespace Game.DataStorage } } - StringArray stringStorage = new StringArray((int)LocaleConstant.Total); + StringArray stringStorage = new StringArray((int)Locale.Total); } } diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index 426414d30..20cab88cc 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Database; using Framework.GameMath; -using Game.Network; +using Game.Networking; using System; using System.Collections.Generic; using System.Linq; @@ -37,7 +37,7 @@ namespace Game.DataStorage _powersByClass[i][j] = (uint)PowerType.Max; } - for (uint i = 0; i < (int)LocaleConstant.Total + 1; ++i) + for (uint i = 0; i < (int)Locale.Total + 1; ++i) _nameValidators[i] = new List(); } @@ -360,13 +360,13 @@ namespace Game.DataStorage foreach (var namesProfanity in CliDB.NamesProfanityStorage.Values) { - Cypher.Assert(namesProfanity.Language < (int)LocaleConstant.Total || namesProfanity.Language == -1); + Cypher.Assert(namesProfanity.Language < (int)Locale.Total || namesProfanity.Language == -1); if (namesProfanity.Language != -1) _nameValidators[namesProfanity.Language].Add(namesProfanity.Name); else - for (uint i = 0; i < (int)LocaleConstant.Total; ++i) + for (uint i = 0; i < (int)Locale.Total; ++i) { - if (i == (int)LocaleConstant.None) + if (i == (int)Locale.None) continue; _nameValidators[i].Add(namesProfanity.Name); @@ -376,16 +376,16 @@ namespace Game.DataStorage CliDB.NamesProfanityStorage.Clear(); foreach (var namesReserved in CliDB.NamesReservedStorage.Values) - _nameValidators[(int)LocaleConstant.Total].Add(namesReserved.Name); + _nameValidators[(int)Locale.Total].Add(namesReserved.Name); CliDB.NamesReservedStorage.Clear(); foreach (var namesReserved in CliDB.NamesReservedLocaleStorage.Values) { - Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)LocaleConstant.Total) - 1))); - for (int i = 0; i < (int)LocaleConstant.Total; ++i) + Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)Locale.Total) - 1))); + for (int i = 0; i < (int)Locale.Total; ++i) { - if (i == (int)LocaleConstant.None) + if (i == (int)Locale.None) continue; if (Convert.ToBoolean(namesReserved.LocaleMask & (1 << i))) @@ -816,7 +816,7 @@ namespace Game.DataStorage return (uint)CliDB.AzeriteLevelInfoStorage.Count; } - public string GetBroadcastTextValue(BroadcastTextRecord broadcastText, LocaleConstant locale = LocaleConstant.enUS, Gender gender = Gender.Male, bool forceGender = false) + public string GetBroadcastTextValue(BroadcastTextRecord broadcastText, Locale locale = Locale.enUS, Gender gender = Gender.Male, bool forceGender = false) { if ((gender == Gender.Female || gender == Gender.None) && (forceGender || broadcastText.Text1.HasString(SharedConst.DefaultLocale))) { @@ -857,7 +857,7 @@ namespace Game.DataStorage return _charStartOutfits.LookupByKey(race | (class_ << 8) | (gender << 16)); } - public string GetClassName(Class class_, LocaleConstant locale = LocaleConstant.enUS) + public string GetClassName(Class class_, Locale locale = Locale.enUS) { ChrClassesRecord classEntry = CliDB.ChrClassesStorage.LookupByKey(class_); if (classEntry == null) @@ -866,7 +866,7 @@ namespace Game.DataStorage if (classEntry.Name[locale][0] != '\0') return classEntry.Name[locale]; - return classEntry.Name[LocaleConstant.enUS]; + return classEntry.Name[Locale.enUS]; } public uint GetPowerIndexByClass(PowerType powerType, Class classId) @@ -874,7 +874,7 @@ namespace Game.DataStorage return _powersByClass[(int)classId][(int)powerType]; } - public string GetChrRaceName(Race race, LocaleConstant locale = LocaleConstant.enUS) + public string GetChrRaceName(Race race, Locale locale = Locale.enUS) { ChrRacesRecord raceEntry = CliDB.ChrRacesStorage.LookupByKey(race); if (raceEntry == null) @@ -883,7 +883,7 @@ namespace Game.DataStorage if (raceEntry.Name[locale][0] != '\0') return raceEntry.Name[locale]; - return raceEntry.Name[LocaleConstant.enUS]; + return raceEntry.Name[Locale.enUS]; } public ChrSpecializationRecord GetChrSpecializationByIndex(Class class_, uint index) @@ -896,7 +896,7 @@ namespace Game.DataStorage return _defaultChrSpecializationsByClass.LookupByKey(class_); } - public string GetCreatureFamilyPetName(CreatureFamily petfamily, LocaleConstant locale) + public string GetCreatureFamilyPetName(CreatureFamily petfamily, Locale locale) { if (petfamily == CreatureFamily.None) return null; @@ -1526,14 +1526,14 @@ namespace Game.DataStorage return listNameGen[gender].SelectRandom().Name; } - public ResponseCodes ValidateName(string name, LocaleConstant locale) + public ResponseCodes ValidateName(string name, Locale locale) { foreach (var testName in _nameValidators[(int)locale]) if (testName.Equals(name, StringComparison.OrdinalIgnoreCase)) return ResponseCodes.CharNameProfane; // regexes at TOTAL_LOCALES are loaded from NamesReserved which is not locale specific - foreach (var testName in _nameValidators[(int)LocaleConstant.Total]) + foreach (var testName in _nameValidators[(int)Locale.Total]) if (testName.Equals(name, StringComparison.OrdinalIgnoreCase)) return ResponseCodes.CharNameReserved; @@ -2099,7 +2099,7 @@ namespace Game.DataStorage MultiMap _mountCapabilitiesByType = new MultiMap(); MultiMap _mountDisplays = new MultiMap(); Dictionary[]> _nameGenData = new Dictionary[]>(); - List[] _nameValidators = new List[(int)LocaleConstant.Total + 1]; + List[] _nameValidators = new List[(int)Locale.Total + 1]; MultiMap _phasesByGroup = new MultiMap(); Dictionary _powerTypes = new Dictionary(); Dictionary _pvpItemBonus = new Dictionary(); diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index 34b7b03d5..544a40534 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.DungeonFinding { diff --git a/Source/Game/DungeonFinding/LFGPlayerData.cs b/Source/Game/DungeonFinding/LFGPlayerData.cs index c39990868..3356dcb5c 100644 --- a/Source/Game/DungeonFinding/LFGPlayerData.cs +++ b/Source/Game/DungeonFinding/LFGPlayerData.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.DungeonFinding { diff --git a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs index a875faddd..f37638bd5 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs @@ -20,12 +20,12 @@ using Framework.GameMath; using Game.AI; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; using Framework.Dynamic; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs b/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs index cf44e9792..6d789426d 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTriggerTemplate.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Framework.Dynamic; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/Conversation.cs b/Source/Game/Entities/Conversation.cs index b1b4b4b95..8a7151175 100644 --- a/Source/Game/Entities/Conversation.cs +++ b/Source/Game/Entities/Conversation.cs @@ -20,7 +20,7 @@ using Game.DataStorage; using Game.Maps; using Game.Spells; using System.Collections.Generic; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index 1b2e626bf..fdb53a2cc 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -23,7 +23,7 @@ using Game.Maps; using System.Collections.Generic; using System.Text; using Framework.Collections; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 12d3c671d..ecc3294b9 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -23,7 +23,7 @@ using Game.DataStorage; using Game.Groups; using Game.Loots; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -2561,9 +2561,9 @@ namespace Game.Entities return vCount.count; } - public override string GetName(LocaleConstant locale = LocaleConstant.enUS) + public override string GetName(Locale locale = Locale.enUS) { - if (locale != LocaleConstant.enUS) + if (locale != Locale.enUS) { CreatureLocale cl = Global.ObjectMgr.GetCreatureLocale(GetEntry()); if (cl != null) diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index 69eeb7f87..c3018285b 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -20,7 +20,7 @@ using Framework.Constants; using System; using System.Collections.Generic; using Framework.Dynamic; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.Entities { @@ -309,10 +309,10 @@ namespace Game.Entities public class CreatureLocale { - public StringArray Name = new StringArray((int)LocaleConstant.Total); - public StringArray NameAlt = new StringArray((int)LocaleConstant.Total); - public StringArray Title = new StringArray((int)LocaleConstant.Total); - public StringArray TitleAlt = new StringArray((int)LocaleConstant.Total); + public StringArray Name = new StringArray((int)Locale.Total); + public StringArray NameAlt = new StringArray((int)Locale.Total); + public StringArray Title = new StringArray((int)Locale.Total); + public StringArray TitleAlt = new StringArray((int)Locale.Total); } public struct EquipmentItem diff --git a/Source/Game/Entities/Creature/Gossip.cs b/Source/Game/Entities/Creature/Gossip.cs index 1d047f58b..babe8b2bf 100644 --- a/Source/Game/Entities/Creature/Gossip.cs +++ b/Source/Game/Entities/Creature/Gossip.cs @@ -21,7 +21,7 @@ using Framework.GameMath; using Game.Conditions; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; @@ -103,7 +103,7 @@ namespace Game.Misc strBoxText = item.BoxText; // Check need of localization. - if (GetLocale() != LocaleConstant.enUS) + if (GetLocale() != Locale.enUS) { if (optionBroadcastText == null) { @@ -181,8 +181,8 @@ namespace Game.Misc public void SetMenuId(uint menu_id) { _menuId = menu_id; } public uint GetMenuId() { return _menuId; } - public void SetLocale(LocaleConstant locale) { _locale = locale; } - LocaleConstant GetLocale() { return _locale; } + public void SetLocale(Locale locale) { _locale = locale; } + Locale GetLocale() { return _locale; } public int GetMenuItemCount() { @@ -212,7 +212,7 @@ namespace Game.Misc Dictionary _menuItems = new Dictionary(); Dictionary _menuItemData = new Dictionary(); uint _menuId; - LocaleConstant _locale; + Locale _locale; } public class InteractionData @@ -284,8 +284,8 @@ namespace Game.Misc text.Repeatable = quest.IsRepeatable(); text.QuestTitle = quest.LogTitle; - LocaleConstant locale = _session.GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = _session.GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) @@ -319,8 +319,8 @@ namespace Game.Misc packet.Id = pointOfInterest.Id; packet.Name = pointOfInterest.Name; - LocaleConstant locale = _session.GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = _session.GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { PointOfInterestLocale localeData = Global.ObjectMgr.GetPointOfInterestLocale(id); if (localeData != null) @@ -338,7 +338,7 @@ namespace Game.Misc public void SendQuestGiverQuestListMessage(WorldObject questgiver) { ObjectGuid guid = questgiver.GetGUID(); - LocaleConstant localeConstant = _session.GetSessionDbLocaleIndex(); + Locale localeConstant = _session.GetSessionDbLocaleIndex(); QuestGiverQuestListMessage questList = new QuestGiverQuestListMessage(); questList.QuestGiverGUID = guid; @@ -350,7 +350,7 @@ namespace Game.Misc questList.GreetEmoteType = questGreeting.EmoteType; questList.Greeting = questGreeting.Text; - if (localeConstant != LocaleConstant.enUS) + if (localeConstant != Locale.enUS) { QuestGreetingLocale questGreetingLocale = Global.ObjectMgr.GetQuestGreetingLocale(questgiver.GetTypeId(), questgiver.GetEntry()); if (questGreetingLocale != null) @@ -368,7 +368,7 @@ namespace Game.Misc { string title = quest.LogTitle; - if (localeConstant != LocaleConstant.enUS) + if (localeConstant != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) @@ -412,8 +412,8 @@ namespace Game.Misc packet.PortraitTurnInText = quest.PortraitTurnInText; packet.PortraitTurnInName = quest.PortraitTurnInName; - LocaleConstant locale = _session.GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = _session.GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) @@ -479,8 +479,8 @@ namespace Game.Misc QueryQuestInfoResponse queryQuestInfoResponse = quest.QueryData; - LocaleConstant loc = _session.GetSessionDbLocaleIndex(); - if (loc != LocaleConstant.enUS) + Locale loc = _session.GetSessionDbLocaleIndex(); + if (loc != Locale.enUS) { QuestTemplateLocale questTemplateLocale = Global.ObjectMgr.GetQuestLocale(queryQuestInfoResponse.QuestID); if (questTemplateLocale != null) @@ -519,8 +519,8 @@ namespace Game.Misc packet.PortraitTurnInText = quest.PortraitTurnInText; packet.PortraitTurnInName = quest.PortraitTurnInName; - LocaleConstant locale = _session.GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = _session.GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) @@ -583,8 +583,8 @@ namespace Game.Misc packet.QuestTitle = quest.LogTitle; packet.CompletionText = quest.RequestItemsText; - LocaleConstant locale = _session.GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = _session.GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) @@ -747,7 +747,7 @@ namespace Game.Misc public class PageTextLocale { - public StringArray Text = new StringArray((int)LocaleConstant.Total); + public StringArray Text = new StringArray((int)Locale.Total); } public class GossipMenuItems @@ -781,7 +781,7 @@ namespace Game.Misc public class PointOfInterestLocale { - public StringArray Name = new StringArray((int)LocaleConstant.Total); + public StringArray Name = new StringArray((int)Locale.Total); } public class GossipMenus diff --git a/Source/Game/Entities/Creature/Trainer.cs b/Source/Game/Entities/Creature/Trainer.cs index 61c9d1495..b1039c765 100644 --- a/Source/Game/Entities/Creature/Trainer.cs +++ b/Source/Game/Entities/Creature/Trainer.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Framework.Constants; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; namespace Game.Entities @@ -26,10 +26,10 @@ namespace Game.Entities _type = type; _spells = spells; - _greeting[(int)LocaleConstant.enUS] = greeting; + _greeting[(int)Locale.enUS] = greeting; } - public void SendSpells(Creature npc, Player player, LocaleConstant locale) + public void SendSpells(Creature npc, Player player, Locale locale) { float reputationDiscount = player.GetReputationPriceDiscount(npc); @@ -171,15 +171,15 @@ namespace Game.Entities player.SendPacket(trainerBuyFailed); } - string GetGreeting(LocaleConstant locale) + string GetGreeting(Locale locale) { if (_greeting[(int)locale].IsEmpty()) - return _greeting[(int)LocaleConstant.enUS]; + return _greeting[(int)Locale.enUS]; return _greeting[(int)locale]; } - public void AddGreetingLocale(LocaleConstant locale, string greeting) + public void AddGreetingLocale(Locale locale, string greeting) { _greeting[(int)locale] = greeting; } @@ -187,6 +187,6 @@ namespace Game.Entities uint _id; TrainerType _type; List _spells; - Array _greeting = new Array((int)LocaleConstant.Total); + Array _greeting = new Array((int)Locale.Total); } } diff --git a/Source/Game/Entities/DynamicObject.cs b/Source/Game/Entities/DynamicObject.cs index 5de8eeb72..cf8a97053 100644 --- a/Source/Game/Entities/DynamicObject.cs +++ b/Source/Game/Entities/DynamicObject.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Spells; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 63c28ac49..297fd4f86 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -25,12 +25,12 @@ using Game.DataStorage; using Game.Groups; using Game.Loots; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; using System.Linq; -using Game.Network; +using Game.Networking; namespace Game.Entities { @@ -2086,9 +2086,9 @@ namespace Game.Entities return GetGoInfo().ScriptId; } - public override string GetName(LocaleConstant locale = LocaleConstant.enUS) + public override string GetName(Locale locale = Locale.enUS) { - if (locale != LocaleConstant.enUS) + if (locale != Locale.enUS) { GameObjectLocale cl = Global.ObjectMgr.GetGameObjectLocale(GetEntry()); if (cl != null) diff --git a/Source/Game/Entities/GameObject/GameObjectData.cs b/Source/Game/Entities/GameObject/GameObjectData.cs index 1a279725a..d988c14c8 100644 --- a/Source/Game/Entities/GameObject/GameObjectData.cs +++ b/Source/Game/Entities/GameObject/GameObjectData.cs @@ -20,7 +20,7 @@ using Framework.Constants; using Framework.GameMath; using System.Collections.Generic; using System.Runtime.InteropServices; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.Entities { @@ -1235,9 +1235,9 @@ namespace Game.Entities public class GameObjectLocale { - public StringArray Name = new StringArray((int)LocaleConstant.Total); - public StringArray CastBarCaption = new StringArray((int)LocaleConstant.Total); - public StringArray Unk1 = new StringArray((int)LocaleConstant.Total); + public StringArray Name = new StringArray((int)Locale.Total); + public StringArray CastBarCaption = new StringArray((int)Locale.Total); + public StringArray Unk1 = new StringArray((int)Locale.Total); } public class GameObjectAddon diff --git a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs index 4be20092c..784486771 100644 --- a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs +++ b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs @@ -18,10 +18,10 @@ using System; using System.Collections.Generic; using System.Text; -using Game.Network; +using Game.Networking; using Framework.Constants; using Framework.Database; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.DataStorage; using System.Linq; diff --git a/Source/Game/Entities/Item/AzeriteItem.cs b/Source/Game/Entities/Item/AzeriteItem.cs index 5ec77ca9f..42a686978 100644 --- a/Source/Game/Entities/Item/AzeriteItem.cs +++ b/Source/Game/Entities/Item/AzeriteItem.cs @@ -18,10 +18,10 @@ using System; using System.Collections.Generic; using System.Text; -using Game.Network; +using Game.Networking; using Framework.Constants; using Framework.Database; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.DataStorage; namespace Game.Entities diff --git a/Source/Game/Entities/Item/Bag.cs b/Source/Game/Entities/Item/Bag.cs index d63b350f4..feb7d6cf0 100644 --- a/Source/Game/Entities/Item/Bag.cs +++ b/Source/Game/Entities/Item/Bag.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Framework.Database; -using Game.Network; +using Game.Networking; namespace Game.Entities { diff --git a/Source/Game/Entities/Item/Item.cs b/Source/Game/Entities/Item/Item.cs index e05264ae0..a2192245b 100644 --- a/Source/Game/Entities/Item/Item.cs +++ b/Source/Game/Entities/Item/Item.cs @@ -20,8 +20,8 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Loots; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -104,7 +104,7 @@ namespace Game.Entities return true; } - public override string GetName(LocaleConstant locale = LocaleConstant.enUS) + public override string GetName(Locale locale = Locale.enUS) { ItemTemplate itemTemplate = GetTemplate(); var suffix = CliDB.ItemNameDescriptionStorage.LookupByKey(_bonusData.Suffix); diff --git a/Source/Game/Entities/Item/ItemTemplate.cs b/Source/Game/Entities/Item/ItemTemplate.cs index 0f6d3e270..f2cb1b469 100644 --- a/Source/Game/Entities/Item/ItemTemplate.cs +++ b/Source/Game/Entities/Item/ItemTemplate.cs @@ -35,7 +35,7 @@ namespace Game.Entities Specializations[2] = new BitSet((int)Class.Max * PlayerConst.MaxSpecializations); } - public string GetName(LocaleConstant locale = SharedConst.DefaultLocale) + public string GetName(Locale locale = SharedConst.DefaultLocale) { return ExtendedData.Display[locale]; } diff --git a/Source/Game/Entities/Object/ObjectGuid.cs b/Source/Game/Entities/Object/ObjectGuid.cs index 7fc76b80e..ff7c66f29 100644 --- a/Source/Game/Entities/Object/ObjectGuid.cs +++ b/Source/Game/Entities/Object/ObjectGuid.cs @@ -83,11 +83,11 @@ namespace Game.Entities if (type == HighGuid.Transport) return new ObjectGuid((ulong)type << 58 | (counter << 38), 0); else - return new ObjectGuid((ulong)type << 58 | (ulong)Global.WorldMgr.GetRealm().Id.Realm << 42, counter); + return new ObjectGuid((ulong)type << 58 | (ulong)Global.WorldMgr.GetRealm().Id.Index << 42, counter); } static ObjectGuid MapSpecificCreate(HighGuid type, byte subType, ushort mapId, uint serverId, uint entry, ulong counter) { - return new ObjectGuid((((ulong)type << 58) | ((ulong)(Global.WorldMgr.GetRealm().Id.Realm & 0x1FFF) << 42) | ((ulong)(mapId & 0x1FFF) << 29) | ((ulong)(entry & 0x7FFFFF) << 6) | ((ulong)subType & 0x3F)), + return new ObjectGuid((((ulong)type << 58) | ((ulong)(Global.WorldMgr.GetRealm().Id.Index & 0x1FFF) << 42) | ((ulong)(mapId & 0x1FFF) << 29) | ((ulong)(entry & 0x7FFFFF) << 6) | ((ulong)subType & 0x3F)), (((ulong)(serverId & 0xFFFFFF) << 40) | (counter & 0xFFFFFFFFFF))); } diff --git a/Source/Game/Entities/Object/Update/UpdateData.cs b/Source/Game/Entities/Object/Update/UpdateData.cs index 331aff1f8..826edcf4c 100644 --- a/Source/Game/Entities/Object/Update/UpdateData.cs +++ b/Source/Game/Entities/Object/Update/UpdateData.cs @@ -16,8 +16,8 @@ */ using Framework.IO; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.Entities diff --git a/Source/Game/Entities/Object/Update/UpdateField.cs b/Source/Game/Entities/Object/Update/UpdateField.cs index 9554e5b9d..65be28a0e 100644 --- a/Source/Game/Entities/Object/Update/UpdateField.cs +++ b/Source/Game/Entities/Object/Update/UpdateField.cs @@ -16,7 +16,7 @@ */ using Framework.Constants; -using Game.Network; +using Game.Networking; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index 2e4bb8f2c..33ac4faf8 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -16,7 +16,7 @@ */ using Framework.Constants; -using Game.Network; +using Game.Networking; using System; using System.Collections.Generic; using Framework.GameMath; diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 6576cc031..5d7c42185 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -21,8 +21,8 @@ using Framework.GameMath; using Game.AI; using Game.BattleFields; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Scenarios; using System; using System.Collections.Generic; @@ -1671,7 +1671,7 @@ namespace Game.Entities public virtual ushort GetMovementAnimKitId() { return 0; } public virtual ushort GetMeleeAnimKitId() { return 0; } - public virtual string GetName(LocaleConstant locale = LocaleConstant.enUS) { return _name; } + public virtual string GetName(Locale locale = Locale.enUS) { return _name; } public void SetName(string name) { _name = name; } public ObjectGuid GetGUID() { return m_guid; } diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 4c099635e..bac41b19e 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/CollectionManager.cs b/Source/Game/Entities/Player/CollectionManager.cs index a12438405..a3f3f0030 100644 --- a/Source/Game/Entities/Player/CollectionManager.cs +++ b/Source/Game/Entities/Player/CollectionManager.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Entities/Player/Player.Combat.cs b/Source/Game/Entities/Player/Player.Combat.cs index d533d3038..31c9cd275 100644 --- a/Source/Game/Entities/Player/Player.Combat.cs +++ b/Source/Game/Entities/Player/Player.Combat.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Groups; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index 33503ba06..098eda891 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -27,7 +27,7 @@ using Game.Groups; using Game.Guilds; using Game.Mails; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -3532,7 +3532,7 @@ namespace Game.Entities stmt.AddValue(0, GetSession().GetAccountId()); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Region); stmt.AddValue(2, Global.WorldMgr.GetRealmId().Site); - stmt.AddValue(3, Global.WorldMgr.GetRealmId().Realm); + stmt.AddValue(3, Global.WorldMgr.GetRealmId().Index); stmt.AddValue(4, GetName()); stmt.AddValue(5, GetGUID().GetCounter()); stmt.AddValue(6, Time.UnixTime); diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 240b1bb58..b2d17330a 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -25,7 +25,7 @@ using Game.Guilds; using Game.Loots; using Game.Mails; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index c39bbf151..a9daf88c0 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -21,7 +21,7 @@ using Game.DataStorage; using Game.Groups; using Game.Guilds; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/Player.PvP.cs b/Source/Game/Entities/Player/Player.PvP.cs index 78b343f9b..c0a61073f 100644 --- a/Source/Game/Entities/Player/Player.PvP.cs +++ b/Source/Game/Entities/Player/Player.PvP.cs @@ -22,7 +22,7 @@ using Game.BattleFields; using Game.BattleGrounds; using Game.Cache; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.PvP; using Game.Spells; using System; diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs index a3ea8d73d..2ffdc9e1e 100644 --- a/Source/Game/Entities/Player/Player.Quest.cs +++ b/Source/Game/Entities/Player/Player.Quest.cs @@ -23,7 +23,7 @@ using Game.Groups; using Game.Mails; using Game.Maps; using Game.Misc; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -2803,8 +2803,8 @@ namespace Game.Entities packet.QuestTitle = quest.LogTitle; - LocaleConstant loc_idx = receiver.GetSession().GetSessionDbLocaleIndex(); - if (loc_idx != LocaleConstant.enUS) + Locale loc_idx = receiver.GetSession().GetSessionDbLocaleIndex(); + if (loc_idx != Locale.enUS) { QuestTemplateLocale questLocale = Global.ObjectMgr.GetQuestLocale(quest.Id); if (questLocale != null) diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index 70cb6ed3f..a43e42ab5 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Dynamic; using Game.BattlePets; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index a15161ae3..76528cf92 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 47cad9acc..b41d0f464 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -31,8 +31,8 @@ using Game.Loots; using Game.Mails; using Game.Maps; using Game.Misc; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.PvP; using Game.Spells; using System; @@ -2429,7 +2429,7 @@ namespace Game.Entities string strBoxText = ""; BroadcastTextRecord optionBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(menuItems.OptionBroadcastTextId); BroadcastTextRecord boxBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(menuItems.BoxBroadcastTextId); - LocaleConstant locale = GetSession().GetSessionDbLocaleIndex(); + Locale locale = GetSession().GetSessionDbLocaleIndex(); if (optionBroadcastText != null) strOptionText = Global.DB2Mgr.GetBroadcastTextValue(optionBroadcastText, locale, GetGender()); @@ -2441,7 +2441,7 @@ namespace Game.Entities else strBoxText = menuItems.BoxText; - if (locale != LocaleConstant.enUS) + if (locale != Locale.enUS) { if (optionBroadcastText == null) { @@ -5057,8 +5057,8 @@ namespace Game.Entities if (playerChoice == null) return; - LocaleConstant locale = GetSession().GetSessionDbLocaleIndex(); - PlayerChoiceLocale playerChoiceLocale = locale != LocaleConstant.enUS ? Global.ObjectMgr.GetPlayerChoiceLocale(choiceId) : null; + Locale locale = GetSession().GetSessionDbLocaleIndex(); + PlayerChoiceLocale playerChoiceLocale = locale != Locale.enUS ? Global.ObjectMgr.GetPlayerChoiceLocale(choiceId) : null; PlayerTalkClass.GetInteractionData().Reset(); PlayerTalkClass.GetInteractionData().SourceGuid = sender; @@ -5080,7 +5080,7 @@ namespace Game.Entities for (var i = 0; i < playerChoice.Responses.Count; ++i) { PlayerChoiceResponse playerChoiceResponseTemplate = playerChoice.Responses[i]; - var playerChoiceResponse = new Network.Packets.PlayerChoiceResponse(); + var playerChoiceResponse = new Networking.Packets.PlayerChoiceResponse(); playerChoiceResponse.ResponseID = playerChoiceResponseTemplate.ResponseId; playerChoiceResponse.ChoiceArtFileID = playerChoiceResponseTemplate.ChoiceArtFileId; @@ -5111,7 +5111,7 @@ namespace Game.Entities if (playerChoiceResponseTemplate.Reward.HasValue) { - var reward = new Network.Packets.PlayerChoiceResponseReward(); + var reward = new Networking.Packets.PlayerChoiceResponseReward(); reward.TitleID = playerChoiceResponseTemplate.Reward.Value.TitleId; reward.PackageID = playerChoiceResponseTemplate.Reward.Value.PackageId; reward.SkillLineID = playerChoiceResponseTemplate.Reward.Value.SkillLineId; @@ -5123,7 +5123,7 @@ namespace Game.Entities foreach (var item in playerChoiceResponseTemplate.Reward.Value.Items) { - var rewardEntry = new Network.Packets.PlayerChoiceResponseRewardEntry(); + var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); rewardEntry.Item.ItemID = item.Id; rewardEntry.Quantity = item.Quantity; if (!item.BonusListIDs.Empty()) @@ -5136,7 +5136,7 @@ namespace Game.Entities foreach (var currency in playerChoiceResponseTemplate.Reward.Value.Currency) { - var rewardEntry = new Network.Packets.PlayerChoiceResponseRewardEntry(); + var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); rewardEntry.Item.ItemID = currency.Id; rewardEntry.Quantity = currency.Quantity; reward.Items.Add(rewardEntry); @@ -5144,7 +5144,7 @@ namespace Game.Entities foreach (var faction in playerChoiceResponseTemplate.Reward.Value.Faction) { - var rewardEntry = new Network.Packets.PlayerChoiceResponseRewardEntry(); + var rewardEntry = new Networking.Packets.PlayerChoiceResponseRewardEntry(); rewardEntry.Item.ItemID = faction.Id; rewardEntry.Quantity = faction.Quantity; reward.Items.Add(rewardEntry); @@ -6458,7 +6458,7 @@ namespace Game.Entities return; ChatPkt data = new ChatPkt(); - data.Initialize(ChatMsg.Whisper, isLogged ? Language.AddonLogged : Language.Addon, this, this, text, 0, "", LocaleConstant.enUS, prefix); + data.Initialize(ChatMsg.Whisper, isLogged ? Language.AddonLogged : Language.Addon, this, this, text, 0, "", Locale.enUS, prefix); receiver.SendPacket(data); } public override void Whisper(string text, Language language, Player target = null, bool something = false) @@ -6508,7 +6508,7 @@ namespace Game.Entities return; } - LocaleConstant locale = target.GetSession().GetSessionDbLocaleIndex(); + Locale locale = target.GetSession().GetSessionDbLocaleIndex(); ChatPkt packet = new ChatPkt(); packet.Initialize(ChatMsg.Whisper, Language.Universal, this, target, Global.DB2Mgr.GetBroadcastTextValue(bct, locale, GetGender())); target.SendPacket(packet); diff --git a/Source/Game/Entities/Player/PlayerTaxi.cs b/Source/Game/Entities/Player/PlayerTaxi.cs index 374500458..88c1625b5 100644 --- a/Source/Game/Entities/Player/PlayerTaxi.cs +++ b/Source/Game/Entities/Player/PlayerTaxi.cs @@ -18,7 +18,7 @@ using Framework.Collections; using Framework.Constants; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; using System.Text; using System; @@ -34,15 +34,11 @@ namespace Game.Entities public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level) { // class specific initial known nodes - var factionMask = Player.TeamForRace(race) == Team.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; - switch (chrClass) + if (chrClass == Class.Deathknight) { - case Class.Deathknight: - { - for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i) - m_taximask[i] |= (byte)(CliDB.OldContinentsNodesMask[i] & factionMask[i]); - break; - } + var factionMask = Player.TeamForRace(race) == Team.Horde ? CliDB.HordeTaxiNodesMask : CliDB.AllianceTaxiNodesMask; + for (int i = 0; i < PlayerConst.TaxiMaskSize; ++i) + m_taximask[i] |= (byte)(CliDB.OldContinentsNodesMask[i] & factionMask[i]); } // race specific initial known nodes: capital and taxi hub masks diff --git a/Source/Game/Entities/Player/SceneMgr.cs b/Source/Game/Entities/Player/SceneMgr.cs index a872418ee..48be1a4c0 100644 --- a/Source/Game/Entities/Player/SceneMgr.cs +++ b/Source/Game/Entities/Player/SceneMgr.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/SocialMgr.cs b/Source/Game/Entities/Player/SocialMgr.cs index 84ed42ddc..e52b745f6 100644 --- a/Source/Game/Entities/Player/SocialMgr.cs +++ b/Source/Game/Entities/Player/SocialMgr.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Framework.Database; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Player/TradeData.cs b/Source/Game/Entities/Player/TradeData.cs index 9b3aa8e07..10bdec649 100644 --- a/Source/Game/Entities/Player/TradeData.cs +++ b/Source/Game/Entities/Player/TradeData.cs @@ -16,7 +16,7 @@ */ using Framework.Constants; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game.Entities { diff --git a/Source/Game/Entities/StatSystem.cs b/Source/Game/Entities/StatSystem.cs index 44c0cea5a..3fbdfedd6 100644 --- a/Source/Game/Entities/StatSystem.cs +++ b/Source/Game/Entities/StatSystem.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.DataStorage; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Totem.cs b/Source/Game/Entities/Totem.cs index 83fa99505..bb88f5aaa 100644 --- a/Source/Game/Entities/Totem.cs +++ b/Source/Game/Entities/Totem.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.DataStorage; using Game.Groups; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; namespace Game.Entities diff --git a/Source/Game/Entities/Unit/CharmInfo.cs b/Source/Game/Entities/Unit/CharmInfo.cs index 5b174c11f..7267bd88a 100644 --- a/Source/Game/Entities/Unit/CharmInfo.cs +++ b/Source/Game/Entities/Unit/CharmInfo.cs @@ -18,7 +18,7 @@ using Framework.Collections; using Framework.Constants; using Framework.GameMath; -using Game.Network; +using Game.Networking; using Game.Spells; using System; diff --git a/Source/Game/Entities/Unit/Unit.Combat.cs b/Source/Game/Entities/Unit/Unit.Combat.cs index a3ed76d68..da044480d 100644 --- a/Source/Game/Entities/Unit/Unit.Combat.cs +++ b/Source/Game/Entities/Unit/Unit.Combat.cs @@ -23,7 +23,7 @@ using Game.DataStorage; using Game.Groups; using Game.Loots; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.PvP; using Game.Spells; using System; diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index 6ac10b27e..c9978bb88 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -23,7 +23,7 @@ using Game.Combat; using Game.DataStorage; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index 694a1c52d..8e066ce61 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -21,7 +21,7 @@ using Game.BattleGrounds; using Game.DataStorage; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using Game.Spells; diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index 427afb20e..14c1cc9c3 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.AI; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 1664a0bcd..d75ed6b8a 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Dynamic; using Game.BattleGrounds; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index f59068a38..50725fa28 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -25,12 +25,12 @@ using Game.Combat; using Game.DataStorage; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; using System.Linq; -using Game.Network; +using Game.Networking; namespace Game.Entities { @@ -366,7 +366,7 @@ namespace Game.Entities if (!target) return; - LocaleConstant locale = target.GetSession().GetSessionDbLocaleIndex(); + Locale locale = target.GetSession().GetSessionDbLocaleIndex(); ChatPkt data = new ChatPkt(); data.Initialize(isBossWhisper ? ChatMsg.RaidBossWhisper : ChatMsg.MonsterWhisper, Language.Universal, this, target, text, 0, "", locale); target.SendPacket(data); @@ -413,7 +413,7 @@ namespace Game.Entities return; } - LocaleConstant locale = target.GetSession().GetSessionDbLocaleIndex(); + Locale locale = target.GetSession().GetSessionDbLocaleIndex(); ChatPkt data = new ChatPkt(); data.Initialize(isBossWhisper ? ChatMsg.RaidBossWhisper : ChatMsg.MonsterWhisper, Language.Universal, this, target, Global.DB2Mgr.GetBroadcastTextValue(bct, locale, GetGender()), 0, "", locale); target.SendPacket(data); diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 503aa9c5a..27ea81123 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -20,7 +20,7 @@ using Framework.Database; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using Framework.Collections; diff --git a/Source/Game/Garrisons/Garrisons.cs b/Source/Game/Garrisons/Garrisons.cs index a242e6211..d5b3c97e6 100644 --- a/Source/Game/Garrisons/Garrisons.cs +++ b/Source/Game/Garrisons/Garrisons.cs @@ -22,7 +22,7 @@ using Framework.GameMath; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index c2e251cde..484aebae6 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -195,7 +195,7 @@ namespace Game } } - public static ResponseCodes CheckPlayerName(string name, LocaleConstant locale, bool create = false) + public static ResponseCodes CheckPlayerName(string name, Locale locale, bool create = false) { if (name.Length > 12) return ResponseCodes.CharNameTooLong; @@ -243,12 +243,12 @@ namespace Game return IsValidString(name, strictMask, true); } - public static void AddLocaleString(string value, LocaleConstant locale, StringArray data) + public static void AddLocaleString(string value, Locale locale, StringArray data) { if (!string.IsNullOrEmpty(value)) data[(int)locale] = value; } - public static void GetLocaleString(StringArray data, LocaleConstant locale, ref string value) + public static void GetLocaleString(StringArray data, Locale locale, ref string value) { if (data.Length > (int)locale && !string.IsNullOrEmpty(data[(int)locale])) value = data[(int)locale]; @@ -535,7 +535,7 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Loaded {0} realm names in {1} ms.", count, Time.GetMSTimeDiffToNow(oldMSTime)); } - public string GetCypherString(uint entry, LocaleConstant locale = LocaleConstant.enUS) + public string GetCypherString(uint entry, Locale locale = Locale.enUS) { if (!CypherStringStorage.ContainsKey(entry)) { @@ -549,7 +549,7 @@ namespace Game return cs[(int)SharedConst.DefaultLocale]; } - public string GetCypherString(CypherStrings cmd, LocaleConstant locale = LocaleConstant.enUS) + public string GetCypherString(CypherStrings cmd, Locale locale = Locale.enUS) { return GetCypherString((uint)cmd, locale); } @@ -3059,8 +3059,8 @@ namespace Game uint trainerId = trainerLocalesResult.Read(0); string localeName = trainerLocalesResult.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; Trainer trainer = _trainers.LookupByKey(trainerId); @@ -7883,8 +7883,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_creatureLocaleStorage.ContainsKey(id)) @@ -7915,8 +7915,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_gameObjectLocaleStorage.ContainsKey(id)) @@ -7946,8 +7946,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_questTemplateLocaleStorage.ContainsKey(id)) @@ -7981,8 +7981,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_questObjectivesLocaleStorage.ContainsKey(id)) @@ -8034,8 +8034,8 @@ namespace Game string localeName = result.Read(2); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_questGreetingLocaleStorage[type].ContainsKey(id)) @@ -8063,8 +8063,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_questOfferRewardLocaleStorage.ContainsKey(id)) @@ -8090,8 +8090,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_questRequestItemsLocaleStorage.ContainsKey(id)) @@ -8120,8 +8120,8 @@ namespace Game uint optionIndex = result.Read(1); string localeName = result.Read(2); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; GossipMenuItemsLocale data = new GossipMenuItemsLocale(); @@ -8149,8 +8149,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_pageTextLocaleStorage.ContainsKey(id)) @@ -8177,8 +8177,8 @@ namespace Game { uint id = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (!_pointOfInterestLocaleStorage.ContainsKey(id)) @@ -9171,8 +9171,8 @@ namespace Game { int choiceId = result.Read(0); string localeName = result.Read(1); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; if (GetPlayerChoice(choiceId) == null) @@ -9203,8 +9203,8 @@ namespace Game int choiceId = result.Read(0); int responseId = result.Read(1); string localeName = result.Read(2); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; var playerChoiceLocale = _playerChoiceLocales.LookupByKey(choiceId); @@ -10715,24 +10715,24 @@ namespace Game public class GossipMenuItemsLocale { - public StringArray OptionText = new StringArray((int)LocaleConstant.Total); - public StringArray BoxText = new StringArray((int)LocaleConstant.Total); + public StringArray OptionText = new StringArray((int)Locale.Total); + public StringArray BoxText = new StringArray((int)Locale.Total); } public class PlayerChoiceLocale { - public StringArray Question = new StringArray((int)LocaleConstant.Total); + public StringArray Question = new StringArray((int)Locale.Total); public Dictionary Responses = new Dictionary(); } public class PlayerChoiceResponseLocale { - public StringArray Answer = new StringArray((int)LocaleConstant.Total); - public StringArray Header = new StringArray((int)LocaleConstant.Total); - public StringArray SubHeader = new StringArray((int)LocaleConstant.Total); - public StringArray ButtonTooltip = new StringArray((int)LocaleConstant.Total); - public StringArray Description = new StringArray((int)LocaleConstant.Total); - public StringArray Confirmation = new StringArray((int)LocaleConstant.Total); + public StringArray Answer = new StringArray((int)Locale.Total); + public StringArray Header = new StringArray((int)Locale.Total); + public StringArray SubHeader = new StringArray((int)Locale.Total); + public StringArray ButtonTooltip = new StringArray((int)Locale.Total); + public StringArray Description = new StringArray((int)Locale.Total); + public StringArray Confirmation = new StringArray((int)Locale.Total); } public class PlayerChoiceResponseRewardItem diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index c2800422f..edada124f 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -23,8 +23,8 @@ using Game.DataStorage; using Game.Entities; using Game.Loots; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Guilds/Guild.cs b/Source/Game/Guilds/Guild.cs index ff445bc9e..c82b16ecd 100644 --- a/Source/Game/Guilds/Guild.cs +++ b/Source/Game/Guilds/Guild.cs @@ -21,8 +21,8 @@ using Game.Achievements; using Game.DataStorage; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; @@ -1437,7 +1437,7 @@ namespace Game.Guilds if (session != null && session.GetPlayer() != null && _HasRankRight(session.GetPlayer(), officerOnly ? GuildRankRights.OffChatSpeak : GuildRankRights.GChatSpeak)) { ChatPkt data = new ChatPkt(); - data.Initialize(officerOnly ? ChatMsg.Officer : ChatMsg.Guild, isLogged ? Language.AddonLogged : Language.Addon, session.GetPlayer(), null, msg, 0, "", LocaleConstant.enUS, prefix); + data.Initialize(officerOnly ? ChatMsg.Officer : ChatMsg.Guild, isLogged ? Language.AddonLogged : Language.Addon, session.GetPlayer(), null, msg, 0, "", Locale.enUS, prefix); foreach (var member in m_members.Values) { Player player = member.FindPlayer(); @@ -1744,7 +1744,7 @@ namespace Game.Guilds DB.Characters.CommitTransaction(trans); } - void _CreateDefaultGuildRanks(SQLTransaction trans, LocaleConstant loc = LocaleConstant.enUS) + void _CreateDefaultGuildRanks(SQLTransaction trans, Locale loc = Locale.enUS) { PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_RANKS); stmt.AddValue(0, m_id); diff --git a/Source/Game/Guilds/GuildFinderManager.cs b/Source/Game/Guilds/GuildFinderManager.cs index ecd134936..f8498aa84 100644 --- a/Source/Game/Guilds/GuildFinderManager.cs +++ b/Source/Game/Guilds/GuildFinderManager.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/ArtifactHandler.cs b/Source/Game/Handlers/ArtifactHandler.cs index c2a25e9c2..ea5c90382 100644 --- a/Source/Game/Handlers/ArtifactHandler.cs +++ b/Source/Game/Handlers/ArtifactHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index cbb210f17..e7f6fb45c 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -21,8 +21,8 @@ using Framework.Dynamic; using Game.DataStorage; using Game.Entities; using Game.Mails; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Handlers/AuthenticationHandler.cs b/Source/Game/Handlers/AuthenticationHandler.cs index 1d715e775..fbb974e76 100644 --- a/Source/Game/Handlers/AuthenticationHandler.cs +++ b/Source/Game/Handlers/AuthenticationHandler.cs @@ -16,7 +16,7 @@ */ using Framework.Constants; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/AzeriteHandler.cs b/Source/Game/Handlers/AzeriteHandler.cs index 1e1e66b88..828629a47 100644 --- a/Source/Game/Handlers/AzeriteHandler.cs +++ b/Source/Game/Handlers/AzeriteHandler.cs @@ -17,10 +17,10 @@ using Framework.Constants; using Game.Entities; -using Game.Network; +using Game.Networking; using Game.DataStorage; using System.Collections.Generic; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/BankHandler.cs b/Source/Game/Handlers/BankHandler.cs index 768884c02..60f5fa807 100644 --- a/Source/Game/Handlers/BankHandler.cs +++ b/Source/Game/Handlers/BankHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Handlers/BattleFieldHandler.cs b/Source/Game/Handlers/BattleFieldHandler.cs index 09e2ad936..feb332575 100644 --- a/Source/Game/Handlers/BattleFieldHandler.cs +++ b/Source/Game/Handlers/BattleFieldHandler.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.BattleFields; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/BattleGroundHandler.cs b/Source/Game/Handlers/BattleGroundHandler.cs index 55c10699b..155dad317 100644 --- a/Source/Game/Handlers/BattleGroundHandler.cs +++ b/Source/Game/Handlers/BattleGroundHandler.cs @@ -22,8 +22,8 @@ using Game.BattleGrounds; using Game.DataStorage; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/BattlePetHandler.cs b/Source/Game/Handlers/BattlePetHandler.cs index 7404227ab..540a899af 100644 --- a/Source/Game/Handlers/BattlePetHandler.cs +++ b/Source/Game/Handlers/BattlePetHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.BattlePets; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/BattlenetHandler.cs b/Source/Game/Handlers/BattlenetHandler.cs index 5a6506925..219644312 100644 --- a/Source/Game/Handlers/BattlenetHandler.cs +++ b/Source/Game/Handlers/BattlenetHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Google.Protobuf; using System; diff --git a/Source/Game/Handlers/BlackMarketHandlers.cs b/Source/Game/Handlers/BlackMarketHandlers.cs index 83ed05c5c..c09476497 100644 --- a/Source/Game/Handlers/BlackMarketHandlers.cs +++ b/Source/Game/Handlers/BlackMarketHandlers.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Framework.Database; using Game.BlackMarket; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/CalendarHandler.cs b/Source/Game/Handlers/CalendarHandler.cs index a85104d74..812c121bd 100644 --- a/Source/Game/Handlers/CalendarHandler.cs +++ b/Source/Game/Handlers/CalendarHandler.cs @@ -21,8 +21,8 @@ using Game.Cache; using Game.Entities; using Game.Guilds; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using Game.DataStorage; diff --git a/Source/Game/Handlers/ChannelHandler.cs b/Source/Game/Handlers/ChannelHandler.cs index 161e27025..4527289e4 100644 --- a/Source/Game/Handlers/ChannelHandler.cs +++ b/Source/Game/Handlers/ChannelHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.Chat; using Game.DataStorage; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index 710813822..f8430b8e8 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -24,8 +24,8 @@ using Game.Entities; using Game.Groups; using Game.Guilds; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; @@ -470,13 +470,13 @@ namespace Game stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_REALM_CHARACTERS_BY_REALM); stmt.AddValue(0, GetAccountId()); - stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Realm); + stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Index); loginTransaction.Append(stmt); stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_REALM_CHARACTERS); stmt.AddValue(0, createInfo.CharCount); stmt.AddValue(1, GetAccountId()); - stmt.AddValue(2, Global.WorldMgr.GetRealm().Id.Realm); + stmt.AddValue(2, Global.WorldMgr.GetRealm().Id.Index); loginTransaction.Append(stmt); DB.Login.CommitTransaction(loginTransaction); diff --git a/Source/Game/Handlers/ChatHandler.cs b/Source/Game/Handlers/ChatHandler.cs index 5e242db0d..b7342fdd3 100644 --- a/Source/Game/Handlers/ChatHandler.cs +++ b/Source/Game/Handlers/ChatHandler.cs @@ -21,8 +21,8 @@ using Game.DataStorage; using Game.Entities; using Game.Groups; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; using System.Linq; @@ -447,7 +447,7 @@ namespace Game } ChatPkt data = new ChatPkt(); - data.Initialize(type, isLogged ? Language.AddonLogged : Language.Addon, sender, null, text, 0, "", LocaleConstant.enUS, prefix); + data.Initialize(type, isLogged ? Language.AddonLogged : Language.Addon, sender, null, text, 0, "", Locale.enUS, prefix); group.BroadcastAddonMessagePacket(data, prefix, true, subGroup, sender.GetGUID()); break; } diff --git a/Source/Game/Handlers/CollectionsHandler.cs b/Source/Game/Handlers/CollectionsHandler.cs index 84cbb9a84..6e5af884d 100644 --- a/Source/Game/Handlers/CollectionsHandler.cs +++ b/Source/Game/Handlers/CollectionsHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/CombatHandler.cs b/Source/Game/Handlers/CombatHandler.cs index 5552d478d..95285ba9c 100644 --- a/Source/Game/Handlers/CombatHandler.cs +++ b/Source/Game/Handlers/CombatHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; namespace Game diff --git a/Source/Game/Handlers/DuelHandler.cs b/Source/Game/Handlers/DuelHandler.cs index 853e289a3..88e2a79d3 100644 --- a/Source/Game/Handlers/DuelHandler.cs +++ b/Source/Game/Handlers/DuelHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/GarrisonHandler.cs b/Source/Game/Handlers/GarrisonHandler.cs index f52dfc948..d83941e7d 100644 --- a/Source/Game/Handlers/GarrisonHandler.cs +++ b/Source/Game/Handlers/GarrisonHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Garrisons; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/GroupHandler.cs b/Source/Game/Handlers/GroupHandler.cs index dfcaf3505..5bede07cd 100644 --- a/Source/Game/Handlers/GroupHandler.cs +++ b/Source/Game/Handlers/GroupHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/GuildFinderHandler.cs b/Source/Game/Handlers/GuildFinderHandler.cs index 7c35aab30..867e0c3ec 100644 --- a/Source/Game/Handlers/GuildFinderHandler.cs +++ b/Source/Game/Handlers/GuildFinderHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.Cache; using Game.Entities; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/GuildHandler.cs b/Source/Game/Handlers/GuildHandler.cs index 717321c84..87f4680f6 100644 --- a/Source/Game/Handlers/GuildHandler.cs +++ b/Source/Game/Handlers/GuildHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.Entities; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/HotfixHandler.cs b/Source/Game/Handlers/HotfixHandler.cs index d76b787e2..25fcec77e 100644 --- a/Source/Game/Handlers/HotfixHandler.cs +++ b/Source/Game/Handlers/HotfixHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.DataStorage; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Handlers/InspectHandler.cs b/Source/Game/Handlers/InspectHandler.cs index 6d77e2c91..19eacc216 100644 --- a/Source/Game/Handlers/InspectHandler.cs +++ b/Source/Game/Handlers/InspectHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.Entities; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index c6f478ec4..f08ec4f5f 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -20,8 +20,8 @@ using Framework.Database; using Game.BattlePets; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/LFGHandler.cs b/Source/Game/Handlers/LFGHandler.cs index 2c35e8e21..fc6683520 100644 --- a/Source/Game/Handlers/LFGHandler.cs +++ b/Source/Game/Handlers/LFGHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.DungeonFinding; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; using System.Linq; using Game.DataStorage; diff --git a/Source/Game/Handlers/LogoutHandler.cs b/Source/Game/Handlers/LogoutHandler.cs index 426ec1733..91c239e8c 100644 --- a/Source/Game/Handlers/LogoutHandler.cs +++ b/Source/Game/Handlers/LogoutHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index 7e87c7927..639c682f9 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -21,8 +21,8 @@ using Game.Entities; using Game.Groups; using Game.Loots; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index 841a1fae5..258706e84 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -22,8 +22,8 @@ using Game.DataStorage; using Game.Entities; using Game.Guilds; using Game.Mails; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index 87dbf31d1..50291fcec 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -23,8 +23,8 @@ using Game.Entities; using Game.Groups; using Game.Guilds; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.PvP; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/MovementHandler.cs b/Source/Game/Handlers/MovementHandler.cs index 85f8bcb39..c78ce4453 100644 --- a/Source/Game/Handlers/MovementHandler.cs +++ b/Source/Game/Handlers/MovementHandler.cs @@ -22,8 +22,8 @@ using Game.Entities; using Game.Garrisons; using Game.Maps; using Game.Movement; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index 3dbce4576..4b174de02 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -20,8 +20,8 @@ using Framework.Database; using Game.BattleGrounds; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index 4cbd8da44..1d872a3cf 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Framework.Database; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; diff --git a/Source/Game/Handlers/PetitionsHandler.cs b/Source/Game/Handlers/PetitionsHandler.cs index b18c333c5..b3effec49 100644 --- a/Source/Game/Handlers/PetitionsHandler.cs +++ b/Source/Game/Handlers/PetitionsHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Framework.Database; using Game.Entities; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; using System.Text; diff --git a/Source/Game/Handlers/QueryHandler.cs b/Source/Game/Handlers/QueryHandler.cs index c50e4838e..9c56f1e81 100644 --- a/Source/Game/Handlers/QueryHandler.cs +++ b/Source/Game/Handlers/QueryHandler.cs @@ -17,12 +17,13 @@ using Framework.Constants; using Framework.GameMath; +using Framework.Realm; using Game.DataStorage; using Game.Entities; using Game.Maps; using Game.Misc; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game @@ -74,8 +75,8 @@ namespace Game QueryGameObjectResponse queryGameObjectResponse = info.QueryData; - LocaleConstant loc = GetSessionDbLocaleIndex(); - if (loc != LocaleConstant.enUS) + Locale loc = GetSessionDbLocaleIndex(); + if (loc != Locale.enUS) { GameObjectLocale gameObjectLocale = Global.ObjectMgr.GetGameObjectLocale(queryGameObjectResponse.GameObjectID); if (gameObjectLocale != null) @@ -110,8 +111,8 @@ namespace Game QueryCreatureResponse queryCreatureResponse = ci.QueryData; - LocaleConstant loc = GetSessionDbLocaleIndex(); - if (loc != LocaleConstant.enUS) + Locale loc = GetSessionDbLocaleIndex(); + if (loc != Locale.enUS) { CreatureLocale creatureLocale = Global.ObjectMgr.GetCreatureLocale(ci.Entry); if (creatureLocale != null) @@ -187,8 +188,8 @@ namespace Game page.PlayerConditionID = pageText.PlayerConditionID; page.Flags = pageText.Flags; - LocaleConstant locale = GetSessionDbLocaleIndex(); - if (locale != LocaleConstant.enUS) + Locale locale = GetSessionDbLocaleIndex(); + if (locale != Locale.enUS) { PageTextLocale pageLocale = Global.ObjectMgr.GetPageTextLocale(pageID); if (pageLocale != null) @@ -353,8 +354,8 @@ namespace Game RealmQueryResponse realmQueryResponse = new RealmQueryResponse(); realmQueryResponse.VirtualRealmAddress = queryRealmName.VirtualRealmAddress; - RealmHandle realmHandle = new RealmHandle(queryRealmName.VirtualRealmAddress); - if (Global.ObjectMgr.GetRealmName(realmHandle.Realm, ref realmQueryResponse.NameInfo.RealmNameActual, ref realmQueryResponse.NameInfo.RealmNameNormalized)) + RealmId realmHandle = new RealmId(queryRealmName.VirtualRealmAddress); + if (Global.ObjectMgr.GetRealmName(realmHandle.Index, ref realmQueryResponse.NameInfo.RealmNameActual, ref realmQueryResponse.NameInfo.RealmNameNormalized)) { realmQueryResponse.LookupState = (byte)ResponseCodes.Success; realmQueryResponse.NameInfo.IsInternalRealm = false; diff --git a/Source/Game/Handlers/QuestHandler.cs b/Source/Game/Handlers/QuestHandler.cs index 84ae1c6b1..7bd4171de 100644 --- a/Source/Game/Handlers/QuestHandler.cs +++ b/Source/Game/Handlers/QuestHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.BattleGrounds; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.DataStorage; using System.Collections.Generic; diff --git a/Source/Game/Handlers/RAFHandler.cs b/Source/Game/Handlers/RAFHandler.cs index afe83562a..798d04cb1 100644 --- a/Source/Game/Handlers/RAFHandler.cs +++ b/Source/Game/Handlers/RAFHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/ScenarioHandler.cs b/Source/Game/Handlers/ScenarioHandler.cs index c25aea525..99a8de386 100644 --- a/Source/Game/Handlers/ScenarioHandler.cs +++ b/Source/Game/Handlers/ScenarioHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Handlers/SceneHandler.cs b/Source/Game/Handlers/SceneHandler.cs index 3f4af3b83..12bd80500 100644 --- a/Source/Game/Handlers/SceneHandler.cs +++ b/Source/Game/Handlers/SceneHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/SkillHandler.cs b/Source/Game/Handlers/SkillHandler.cs index c90a38486..85f9d8a7d 100644 --- a/Source/Game/Handlers/SkillHandler.cs +++ b/Source/Game/Handlers/SkillHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; namespace Game diff --git a/Source/Game/Handlers/SocialHandler.cs b/Source/Game/Handlers/SocialHandler.cs index 0b16de2bd..c15cf6ca3 100644 --- a/Source/Game/Handlers/SocialHandler.cs +++ b/Source/Game/Handlers/SocialHandler.cs @@ -20,8 +20,8 @@ using Framework.Database; using Game.Cache; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; @@ -230,7 +230,7 @@ namespace Game Team team = Player.TeamForRace(characterInfo.RaceId); uint friendAccountId = characterInfo.AccountId; - if (HasPermission(RBACPermissions.AllowGmFriend) || Global.AccountMgr.IsPlayerAccount(Global.AccountMgr.GetSecurity(friendAccountId, (int)Global.WorldMgr.GetRealm().Id.Realm))) + if (HasPermission(RBACPermissions.AllowGmFriend) || Global.AccountMgr.IsPlayerAccount(Global.AccountMgr.GetSecurity(friendAccountId, (int)Global.WorldMgr.GetRealm().Id.Index))) { if (friendGuid == GetPlayer().GetGUID()) friendResult = FriendsResult.Self; diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index 6bdc33f26..50c665d10 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -20,8 +20,8 @@ using Framework.Database; using Game.DataStorage; using Game.Entities; using Game.Guilds; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/TaxiHandler.cs b/Source/Game/Handlers/TaxiHandler.cs index 14e073f80..52b6b6fa4 100644 --- a/Source/Game/Handlers/TaxiHandler.cs +++ b/Source/Game/Handlers/TaxiHandler.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; using Game.Movement; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Handlers/TicketHandler.cs b/Source/Game/Handlers/TicketHandler.cs index 8c400e869..8c4658500 100644 --- a/Source/Game/Handlers/TicketHandler.cs +++ b/Source/Game/Handlers/TicketHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Framework.Database; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.SupportSystem; namespace Game diff --git a/Source/Game/Handlers/TimeHandler.cs b/Source/Game/Handlers/TimeHandler.cs index f61b5a8e2..a66eb07b9 100644 --- a/Source/Game/Handlers/TimeHandler.cs +++ b/Source/Game/Handlers/TimeHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Linq; namespace Game diff --git a/Source/Game/Handlers/TokenHandler.cs b/Source/Game/Handlers/TokenHandler.cs index 7253c6f4d..7930521cb 100644 --- a/Source/Game/Handlers/TokenHandler.cs +++ b/Source/Game/Handlers/TokenHandler.cs @@ -16,8 +16,8 @@ */ using Framework.Constants; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/ToyHandler.cs b/Source/Game/Handlers/ToyHandler.cs index 11b7ddb1c..c4eb8831d 100644 --- a/Source/Game/Handlers/ToyHandler.cs +++ b/Source/Game/Handlers/ToyHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; namespace Game diff --git a/Source/Game/Handlers/TradeHandler.cs b/Source/Game/Handlers/TradeHandler.cs index 0a96a1d6f..f96d068a6 100644 --- a/Source/Game/Handlers/TradeHandler.cs +++ b/Source/Game/Handlers/TradeHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Framework.Database; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System.Collections.Generic; diff --git a/Source/Game/Handlers/TransmogrificationHandler.cs b/Source/Game/Handlers/TransmogrificationHandler.cs index e5093fd4a..825df2710 100644 --- a/Source/Game/Handlers/TransmogrificationHandler.cs +++ b/Source/Game/Handlers/TransmogrificationHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Handlers/VehicleHandler.cs b/Source/Game/Handlers/VehicleHandler.cs index 1a2cc826e..cbf448471 100644 --- a/Source/Game/Handlers/VehicleHandler.cs +++ b/Source/Game/Handlers/VehicleHandler.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; namespace Game { diff --git a/Source/Game/Handlers/VoidStorageHandler.cs b/Source/Game/Handlers/VoidStorageHandler.cs index 29f380740..fd31664e0 100644 --- a/Source/Game/Handlers/VoidStorageHandler.cs +++ b/Source/Game/Handlers/VoidStorageHandler.cs @@ -17,8 +17,8 @@ using Framework.Constants; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Loot/Loot.cs b/Source/Game/Loot/Loot.cs index 49129af6e..570389812 100644 --- a/Source/Game/Loot/Loot.cs +++ b/Source/Game/Loot/Loot.cs @@ -21,7 +21,7 @@ using Framework.Dynamic; using Game.Conditions; using Game.Entities; using Game.Groups; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index db0130f8e..a4f7358f8 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -18,8 +18,8 @@ using Framework.Constants; using Game.Chat; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Generic; @@ -836,7 +836,7 @@ namespace Game.Maps public void Invoke(Player player) { - LocaleConstant loc_idx = player.GetSession().GetSessionDbLocaleIndex(); + Locale loc_idx = player.GetSession().GetSessionDbLocaleIndex(); int cache_idx = (int)loc_idx + 1; ServerPacket data; @@ -857,7 +857,7 @@ namespace Game.Maps } MessageBuilder Builder; - ServerPacket[] i_data_cache = new ServerPacket[(int)LocaleConstant.Total]; // 0 = default, i => i-1 locale index + ServerPacket[] i_data_cache = new ServerPacket[(int)Locale.Total]; // 0 = default, i => i-1 locale index } public class LocalizedPacketListDo : IDoWork @@ -869,7 +869,7 @@ namespace Game.Maps public void Invoke(Player p) { - LocaleConstant loc_idx = p.GetSession().GetSessionDbLocaleIndex(); + Locale loc_idx = p.GetSession().GetSessionDbLocaleIndex(); int cache_idx = (int)loc_idx + 1; List data_list = new List(); diff --git a/Source/Game/Maps/Instances/InstanceScript.cs b/Source/Game/Maps/Instances/InstanceScript.cs index 5ba7ffe56..aa3932e7c 100644 --- a/Source/Game/Maps/Instances/InstanceScript.cs +++ b/Source/Game/Maps/Instances/InstanceScript.cs @@ -20,7 +20,7 @@ using Framework.Database; using Framework.IO; using Game.Entities; using Game.Groups; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scenarios; using System.Collections.Generic; using System.Text; diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 1e37f266b..794590030 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -24,8 +24,8 @@ using Game.Combat; using Game.DataStorage; using Game.Entities; using Game.Groups; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Scenarios; using System; using System.Collections; diff --git a/Source/Game/Movement/MoveSplineInit.cs b/Source/Game/Movement/MoveSplineInit.cs index e79c28dc6..093aa5e44 100644 --- a/Source/Game/Movement/MoveSplineInit.cs +++ b/Source/Game/Movement/MoveSplineInit.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.GameMath; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; namespace Game.Movement diff --git a/Source/Game/Network/Packet.cs b/Source/Game/Networking/Packet.cs similarity index 99% rename from Source/Game/Network/Packet.cs rename to Source/Game/Networking/Packet.cs index a99e2108e..3ecbbb99f 100644 --- a/Source/Game/Network/Packet.cs +++ b/Source/Game/Networking/Packet.cs @@ -20,7 +20,7 @@ using Framework.IO; using Game.Entities; using System; -namespace Game.Network +namespace Game.Networking { public abstract class ClientPacket : IDisposable { diff --git a/Source/Game/Network/PacketLog.cs b/Source/Game/Networking/PacketLog.cs similarity index 85% rename from Source/Game/Network/PacketLog.cs rename to Source/Game/Networking/PacketLog.cs index 9037c1cce..d41c17173 100644 --- a/Source/Game/Network/PacketLog.cs +++ b/Source/Game/Networking/PacketLog.cs @@ -49,7 +49,7 @@ public class PacketLog } } - public static void Write(byte[] data, uint opcode, IPAddress address, uint port, ConnectionType connectionType, bool isClientPacket) + public static void Write(byte[] data, uint opcode, IPEndPoint endPoint, ConnectionType connectionType, bool isClientPacket) { if (!CanLog()) return; @@ -64,17 +64,17 @@ public class PacketLog writer.Write(20); byte[] SocketIPBytes = new byte[16]; - if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) - Buffer.BlockCopy(address.GetAddressBytes(), 0, SocketIPBytes, 0, 4); + if (endPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 4); else - Buffer.BlockCopy(address.GetAddressBytes(), 0, SocketIPBytes, 0, 16); + Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 16); if (!isClientPacket) data.Combine(new byte[2]); writer.Write(data.Length + 4); writer.Write(SocketIPBytes); - writer.Write(port); + writer.Write((ushort)endPoint.Port); writer.Write(opcode); writer.Write(data); } diff --git a/Source/Game/Network/PacketManager.cs b/Source/Game/Networking/PacketManager.cs similarity index 99% rename from Source/Game/Network/PacketManager.cs rename to Source/Game/Networking/PacketManager.cs index edcd7ea32..7e05b0e5f 100644 --- a/Source/Game/Network/PacketManager.cs +++ b/Source/Game/Networking/PacketManager.cs @@ -22,7 +22,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Reflection; -namespace Game.Network +namespace Game.Networking { public static class PacketManager { diff --git a/Source/Game/Network/PacketUtilities.cs b/Source/Game/Networking/PacketUtilities.cs similarity index 99% rename from Source/Game/Network/PacketUtilities.cs rename to Source/Game/Networking/PacketUtilities.cs index 5fb7f9cdf..f1c222fdf 100644 --- a/Source/Game/Network/PacketUtilities.cs +++ b/Source/Game/Networking/PacketUtilities.cs @@ -17,7 +17,7 @@ using System; -namespace Game.Network +namespace Game.Networking { public class CompactArray { diff --git a/Source/Game/Network/Packets/AchievementPackets.cs b/Source/Game/Networking/Packets/AchievementPackets.cs similarity index 99% rename from Source/Game/Network/Packets/AchievementPackets.cs rename to Source/Game/Networking/Packets/AchievementPackets.cs index dfbbfdec0..20e8aadc2 100644 --- a/Source/Game/Network/Packets/AchievementPackets.cs +++ b/Source/Game/Networking/Packets/AchievementPackets.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class AllAchievementData : ServerPacket { diff --git a/Source/Game/Network/Packets/AddonPackets.cs b/Source/Game/Networking/Packets/AddonPackets.cs similarity index 97% rename from Source/Game/Network/Packets/AddonPackets.cs rename to Source/Game/Networking/Packets/AddonPackets.cs index 6a8aa19c3..9a5f86908 100644 --- a/Source/Game/Network/Packets/AddonPackets.cs +++ b/Source/Game/Networking/Packets/AddonPackets.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public struct AddOnInfo { diff --git a/Source/Game/Network/Packets/AreaTriggerPackets.cs b/Source/Game/Networking/Packets/AreaTriggerPackets.cs similarity index 98% rename from Source/Game/Network/Packets/AreaTriggerPackets.cs rename to Source/Game/Networking/Packets/AreaTriggerPackets.cs index 6bbfb7b67..59f5d306e 100644 --- a/Source/Game/Network/Packets/AreaTriggerPackets.cs +++ b/Source/Game/Networking/Packets/AreaTriggerPackets.cs @@ -22,7 +22,7 @@ using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class AreaTriggerPkt : ClientPacket { diff --git a/Source/Game/Network/Packets/ArtifactPackets.cs b/Source/Game/Networking/Packets/ArtifactPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ArtifactPackets.cs rename to Source/Game/Networking/Packets/ArtifactPackets.cs index 4ed3c7916..e28eeb2b8 100644 --- a/Source/Game/Network/Packets/ArtifactPackets.cs +++ b/Source/Game/Networking/Packets/ArtifactPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class ArtifactAddPower : ClientPacket { diff --git a/Source/Game/Network/Packets/AuctionHousePackets.cs b/Source/Game/Networking/Packets/AuctionHousePackets.cs similarity index 99% rename from Source/Game/Network/Packets/AuctionHousePackets.cs rename to Source/Game/Networking/Packets/AuctionHousePackets.cs index 0617fa9ea..56f7068cb 100644 --- a/Source/Game/Network/Packets/AuctionHousePackets.cs +++ b/Source/Game/Networking/Packets/AuctionHousePackets.cs @@ -20,7 +20,7 @@ using Game.Entities; using System.Collections.Generic; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class AuctionBrowseQuery : ClientPacket { diff --git a/Source/Game/Network/Packets/AuthenticationPackets.cs b/Source/Game/Networking/Packets/AuthenticationPackets.cs similarity index 99% rename from Source/Game/Network/Packets/AuthenticationPackets.cs rename to Source/Game/Networking/Packets/AuthenticationPackets.cs index 455d8a557..a790b71d5 100644 --- a/Source/Game/Network/Packets/AuthenticationPackets.cs +++ b/Source/Game/Networking/Packets/AuthenticationPackets.cs @@ -25,7 +25,7 @@ using System.Collections.Generic; using System.Security.Cryptography; using System.Linq; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class Ping : ClientPacket { diff --git a/Source/Game/Network/Packets/AzeritePackets.cs b/Source/Game/Networking/Packets/AzeritePackets.cs similarity index 99% rename from Source/Game/Network/Packets/AzeritePackets.cs rename to Source/Game/Networking/Packets/AzeritePackets.cs index 4b046b949..8ffe85881 100644 --- a/Source/Game/Network/Packets/AzeritePackets.cs +++ b/Source/Game/Networking/Packets/AzeritePackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class AzeriteXpGain : ServerPacket { diff --git a/Source/Game/Network/Packets/BankPackets.cs b/Source/Game/Networking/Packets/BankPackets.cs similarity index 98% rename from Source/Game/Network/Packets/BankPackets.cs rename to Source/Game/Networking/Packets/BankPackets.cs index eb8439d1a..5ce4c8c99 100644 --- a/Source/Game/Network/Packets/BankPackets.cs +++ b/Source/Game/Networking/Packets/BankPackets.cs @@ -17,7 +17,7 @@ using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class AutoBankItem : ClientPacket { diff --git a/Source/Game/Network/Packets/BattleGroundPackets.cs b/Source/Game/Networking/Packets/BattleGroundPackets.cs similarity index 99% rename from Source/Game/Network/Packets/BattleGroundPackets.cs rename to Source/Game/Networking/Packets/BattleGroundPackets.cs index f698c2380..3b91c5137 100644 --- a/Source/Game/Network/Packets/BattleGroundPackets.cs +++ b/Source/Game/Networking/Packets/BattleGroundPackets.cs @@ -22,7 +22,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class PVPSeason : ServerPacket { diff --git a/Source/Game/Network/Packets/BattlePetPackets.cs b/Source/Game/Networking/Packets/BattlePetPackets.cs similarity index 99% rename from Source/Game/Network/Packets/BattlePetPackets.cs rename to Source/Game/Networking/Packets/BattlePetPackets.cs index 53d65f325..6b4a53c0f 100644 --- a/Source/Game/Network/Packets/BattlePetPackets.cs +++ b/Source/Game/Networking/Packets/BattlePetPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class BattlePetJournal : ServerPacket { diff --git a/Source/Game/Network/Packets/BattlefieldPackets.cs b/Source/Game/Networking/Packets/BattlefieldPackets.cs similarity index 99% rename from Source/Game/Network/Packets/BattlefieldPackets.cs rename to Source/Game/Networking/Packets/BattlefieldPackets.cs index 1b107c3ed..ed93ec0ac 100644 --- a/Source/Game/Network/Packets/BattlefieldPackets.cs +++ b/Source/Game/Networking/Packets/BattlefieldPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class BFMgrEntryInvite : ServerPacket { diff --git a/Source/Game/Network/Packets/BattlenetPackets.cs b/Source/Game/Networking/Packets/BattlenetPackets.cs similarity index 99% rename from Source/Game/Network/Packets/BattlenetPackets.cs rename to Source/Game/Networking/Packets/BattlenetPackets.cs index 7f8132cf9..65eca35f8 100644 --- a/Source/Game/Network/Packets/BattlenetPackets.cs +++ b/Source/Game/Networking/Packets/BattlenetPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.IO; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class Notification : ServerPacket { diff --git a/Source/Game/Network/Packets/BlackMarketPackets.cs b/Source/Game/Networking/Packets/BlackMarketPackets.cs similarity index 99% rename from Source/Game/Network/Packets/BlackMarketPackets.cs rename to Source/Game/Networking/Packets/BlackMarketPackets.cs index b48044d37..ba5bc02e4 100644 --- a/Source/Game/Network/Packets/BlackMarketPackets.cs +++ b/Source/Game/Networking/Packets/BlackMarketPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class BlackMarketOpen : ClientPacket { diff --git a/Source/Game/Network/Packets/CalendarPackets.cs b/Source/Game/Networking/Packets/CalendarPackets.cs similarity index 99% rename from Source/Game/Network/Packets/CalendarPackets.cs rename to Source/Game/Networking/Packets/CalendarPackets.cs index 74b92c069..0cbcf98b2 100644 --- a/Source/Game/Network/Packets/CalendarPackets.cs +++ b/Source/Game/Networking/Packets/CalendarPackets.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class CalendarGetCalendar : ClientPacket { diff --git a/Source/Game/Network/Packets/ChannelPackets.cs b/Source/Game/Networking/Packets/ChannelPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ChannelPackets.cs rename to Source/Game/Networking/Packets/ChannelPackets.cs index 0c9572a55..f5b3d4549 100644 --- a/Source/Game/Network/Packets/ChannelPackets.cs +++ b/Source/Game/Networking/Packets/ChannelPackets.cs @@ -20,7 +20,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class ChannelListResponse : ServerPacket { diff --git a/Source/Game/Network/Packets/CharacterPackets.cs b/Source/Game/Networking/Packets/CharacterPackets.cs similarity index 99% rename from Source/Game/Network/Packets/CharacterPackets.cs rename to Source/Game/Networking/Packets/CharacterPackets.cs index b364ce49a..9b11cb6df 100644 --- a/Source/Game/Network/Packets/CharacterPackets.cs +++ b/Source/Game/Networking/Packets/CharacterPackets.cs @@ -24,7 +24,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class EnumCharacters : ClientPacket { diff --git a/Source/Game/Network/Packets/ChatPackets.cs b/Source/Game/Networking/Packets/ChatPackets.cs similarity index 97% rename from Source/Game/Network/Packets/ChatPackets.cs rename to Source/Game/Networking/Packets/ChatPackets.cs index 17ef3e084..970a9bb62 100644 --- a/Source/Game/Network/Packets/ChatPackets.cs +++ b/Source/Game/Networking/Packets/ChatPackets.cs @@ -21,7 +21,7 @@ using Game.Groups; using System; using Framework.Dynamic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class ChatMessage : ClientPacket { @@ -144,7 +144,7 @@ namespace Game.Network.Packets { public ChatPkt() : base(ServerOpcodes.Chat) { } - public void Initialize(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, string channelName = "", LocaleConstant locale = LocaleConstant.enUS, string addonPrefix = "") + public void Initialize(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, string channelName = "", Locale locale = Locale.enUS, string addonPrefix = "") { // Clear everything because same packet can be used multiple times Clear(); @@ -175,7 +175,7 @@ namespace Game.Network.Packets ChatText = message; } - void SetSender(WorldObject sender, LocaleConstant locale) + void SetSender(WorldObject sender, Locale locale) { SenderGUID = sender.GetGUID(); @@ -197,7 +197,7 @@ namespace Game.Network.Packets } } - public void SetReceiver(WorldObject receiver, LocaleConstant locale) + public void SetReceiver(WorldObject receiver, Locale locale) { TargetGUID = receiver.GetGUID(); diff --git a/Source/Game/Network/Packets/ClientConfigPackets.cs b/Source/Game/Networking/Packets/ClientConfigPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ClientConfigPackets.cs rename to Source/Game/Networking/Packets/ClientConfigPackets.cs index deab79895..0daf51a8f 100644 --- a/Source/Game/Network/Packets/ClientConfigPackets.cs +++ b/Source/Game/Networking/Packets/ClientConfigPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.IO; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class AccountDataTimes : ServerPacket { diff --git a/Source/Game/Network/Packets/CollectionPackets.cs b/Source/Game/Networking/Packets/CollectionPackets.cs similarity index 97% rename from Source/Game/Network/Packets/CollectionPackets.cs rename to Source/Game/Networking/Packets/CollectionPackets.cs index bb6641c61..a1a56d3cf 100644 --- a/Source/Game/Network/Packets/CollectionPackets.cs +++ b/Source/Game/Networking/Packets/CollectionPackets.cs @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -namespace Game.Network.Packets +namespace Game.Networking.Packets { public enum CollectionType { diff --git a/Source/Game/Network/Packets/CombatLogPackets.cs b/Source/Game/Networking/Packets/CombatLogPackets.cs similarity index 99% rename from Source/Game/Network/Packets/CombatLogPackets.cs rename to Source/Game/Networking/Packets/CombatLogPackets.cs index c3fe26e26..9e5016de0 100644 --- a/Source/Game/Network/Packets/CombatLogPackets.cs +++ b/Source/Game/Networking/Packets/CombatLogPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class CombatLogServerPacket : ServerPacket { diff --git a/Source/Game/Network/Packets/CombatPackets.cs b/Source/Game/Networking/Packets/CombatPackets.cs similarity index 99% rename from Source/Game/Network/Packets/CombatPackets.cs rename to Source/Game/Networking/Packets/CombatPackets.cs index 3773b3696..5157f7590 100644 --- a/Source/Game/Network/Packets/CombatPackets.cs +++ b/Source/Game/Networking/Packets/CombatPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class AttackSwing : ClientPacket { diff --git a/Source/Game/Network/Packets/DuelPackets.cs b/Source/Game/Networking/Packets/DuelPackets.cs similarity index 99% rename from Source/Game/Network/Packets/DuelPackets.cs rename to Source/Game/Networking/Packets/DuelPackets.cs index 1e7776bde..4d6adf76a 100644 --- a/Source/Game/Network/Packets/DuelPackets.cs +++ b/Source/Game/Networking/Packets/DuelPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class CanDuel : ClientPacket { diff --git a/Source/Game/Network/Packets/EquipmentPackets.cs b/Source/Game/Networking/Packets/EquipmentPackets.cs similarity index 99% rename from Source/Game/Network/Packets/EquipmentPackets.cs rename to Source/Game/Networking/Packets/EquipmentPackets.cs index d090827a1..c51e6391a 100644 --- a/Source/Game/Network/Packets/EquipmentPackets.cs +++ b/Source/Game/Networking/Packets/EquipmentPackets.cs @@ -20,7 +20,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class EquipmentSetID : ServerPacket { diff --git a/Source/Game/Network/Packets/GameObjectPackets.cs b/Source/Game/Networking/Packets/GameObjectPackets.cs similarity index 99% rename from Source/Game/Network/Packets/GameObjectPackets.cs rename to Source/Game/Networking/Packets/GameObjectPackets.cs index a7a8ee94c..3c16636ba 100644 --- a/Source/Game/Network/Packets/GameObjectPackets.cs +++ b/Source/Game/Networking/Packets/GameObjectPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class GameObjUse : ClientPacket { diff --git a/Source/Game/Network/Packets/GarrisonPackets.cs b/Source/Game/Networking/Packets/GarrisonPackets.cs similarity index 99% rename from Source/Game/Network/Packets/GarrisonPackets.cs rename to Source/Game/Networking/Packets/GarrisonPackets.cs index bca79a124..ba4f4e7df 100644 --- a/Source/Game/Network/Packets/GarrisonPackets.cs +++ b/Source/Game/Networking/Packets/GarrisonPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class GarrisonCreateResult : ServerPacket { diff --git a/Source/Game/Network/Packets/GuildFinderPackets.cs b/Source/Game/Networking/Packets/GuildFinderPackets.cs similarity index 99% rename from Source/Game/Network/Packets/GuildFinderPackets.cs rename to Source/Game/Networking/Packets/GuildFinderPackets.cs index 58461310e..6c51b96cb 100644 --- a/Source/Game/Network/Packets/GuildFinderPackets.cs +++ b/Source/Game/Networking/Packets/GuildFinderPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class LFGuildAddRecruit : ClientPacket { diff --git a/Source/Game/Network/Packets/GuildPackets.cs b/Source/Game/Networking/Packets/GuildPackets.cs similarity index 99% rename from Source/Game/Network/Packets/GuildPackets.cs rename to Source/Game/Networking/Packets/GuildPackets.cs index 23ed0c5bd..ee5dba1ed 100644 --- a/Source/Game/Network/Packets/GuildPackets.cs +++ b/Source/Game/Networking/Packets/GuildPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class QueryGuildInfo : ClientPacket { diff --git a/Source/Game/Network/Packets/HotfixPackets.cs b/Source/Game/Networking/Packets/HotfixPackets.cs similarity index 99% rename from Source/Game/Network/Packets/HotfixPackets.cs rename to Source/Game/Networking/Packets/HotfixPackets.cs index c1365af34..8c3dee627 100644 --- a/Source/Game/Network/Packets/HotfixPackets.cs +++ b/Source/Game/Networking/Packets/HotfixPackets.cs @@ -23,7 +23,7 @@ using System.Collections.Generic; using System; using Game.DataStorage; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class DBQueryBulk : ClientPacket { diff --git a/Source/Game/Network/Packets/InspectPackets.cs b/Source/Game/Networking/Packets/InspectPackets.cs similarity index 99% rename from Source/Game/Network/Packets/InspectPackets.cs rename to Source/Game/Networking/Packets/InspectPackets.cs index 168f1adca..f4161f862 100644 --- a/Source/Game/Network/Packets/InspectPackets.cs +++ b/Source/Game/Networking/Packets/InspectPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System.Collections.Generic; using System; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class Inspect : ClientPacket { diff --git a/Source/Game/Network/Packets/InstancePackets.cs b/Source/Game/Networking/Packets/InstancePackets.cs similarity index 99% rename from Source/Game/Network/Packets/InstancePackets.cs rename to Source/Game/Networking/Packets/InstancePackets.cs index 9d89644f6..58a892716 100644 --- a/Source/Game/Network/Packets/InstancePackets.cs +++ b/Source/Game/Networking/Packets/InstancePackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class UpdateLastInstance : ServerPacket { diff --git a/Source/Game/Network/Packets/ItemPackets.cs b/Source/Game/Networking/Packets/ItemPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ItemPackets.cs rename to Source/Game/Networking/Packets/ItemPackets.cs index 48047a1c2..257690087 100644 --- a/Source/Game/Network/Packets/ItemPackets.cs +++ b/Source/Game/Networking/Packets/ItemPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System.Collections.Generic; using System.Linq; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class BuyBackItem : ClientPacket { diff --git a/Source/Game/Network/Packets/LFGPackets.cs b/Source/Game/Networking/Packets/LFGPackets.cs similarity index 99% rename from Source/Game/Network/Packets/LFGPackets.cs rename to Source/Game/Networking/Packets/LFGPackets.cs index 39351f7fd..e2a54e6e4 100644 --- a/Source/Game/Network/Packets/LFGPackets.cs +++ b/Source/Game/Networking/Packets/LFGPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class DFJoin : ClientPacket { diff --git a/Source/Game/Network/Packets/LootPackets.cs b/Source/Game/Networking/Packets/LootPackets.cs similarity index 99% rename from Source/Game/Network/Packets/LootPackets.cs rename to Source/Game/Networking/Packets/LootPackets.cs index 790ba7e94..d7d46012c 100644 --- a/Source/Game/Network/Packets/LootPackets.cs +++ b/Source/Game/Networking/Packets/LootPackets.cs @@ -20,7 +20,7 @@ using Framework.Dynamic; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class LootUnit : ClientPacket { diff --git a/Source/Game/Network/Packets/MailPackets.cs b/Source/Game/Networking/Packets/MailPackets.cs similarity index 99% rename from Source/Game/Network/Packets/MailPackets.cs rename to Source/Game/Networking/Packets/MailPackets.cs index 94b092b1b..bc40e6639 100644 --- a/Source/Game/Network/Packets/MailPackets.cs +++ b/Source/Game/Networking/Packets/MailPackets.cs @@ -22,7 +22,7 @@ using Game.Mails; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class MailGetList : ClientPacket { diff --git a/Source/Game/Network/Packets/MiscPackets.cs b/Source/Game/Networking/Packets/MiscPackets.cs similarity index 99% rename from Source/Game/Network/Packets/MiscPackets.cs rename to Source/Game/Networking/Packets/MiscPackets.cs index 004ec54ee..fcb25d0b7 100644 --- a/Source/Game/Network/Packets/MiscPackets.cs +++ b/Source/Game/Networking/Packets/MiscPackets.cs @@ -22,7 +22,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class BindPointUpdate : ServerPacket { diff --git a/Source/Game/Network/Packets/MovementPackets.cs b/Source/Game/Networking/Packets/MovementPackets.cs similarity index 99% rename from Source/Game/Network/Packets/MovementPackets.cs rename to Source/Game/Networking/Packets/MovementPackets.cs index 68eebdbf2..db9a80fd1 100644 --- a/Source/Game/Network/Packets/MovementPackets.cs +++ b/Source/Game/Networking/Packets/MovementPackets.cs @@ -23,7 +23,7 @@ using Game.Movement; using System.Collections.Generic; using System; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public static class MovementExtensions { diff --git a/Source/Game/Network/Packets/NPCPackets.cs b/Source/Game/Networking/Packets/NPCPackets.cs similarity index 99% rename from Source/Game/Network/Packets/NPCPackets.cs rename to Source/Game/Networking/Packets/NPCPackets.cs index 8c101822f..7acaca5c8 100644 --- a/Source/Game/Network/Packets/NPCPackets.cs +++ b/Source/Game/Networking/Packets/NPCPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { // CMSG_BANKER_ACTIVATE // CMSG_BINDER_ACTIVATE diff --git a/Source/Game/Network/Packets/PartyPackets.cs b/Source/Game/Networking/Packets/PartyPackets.cs similarity index 99% rename from Source/Game/Network/Packets/PartyPackets.cs rename to Source/Game/Networking/Packets/PartyPackets.cs index 1dd411c09..98a7e3dac 100644 --- a/Source/Game/Network/Packets/PartyPackets.cs +++ b/Source/Game/Networking/Packets/PartyPackets.cs @@ -23,7 +23,7 @@ using Game.Spells; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class PartyCommandResult : ServerPacket { diff --git a/Source/Game/Network/Packets/PetPackets.cs b/Source/Game/Networking/Packets/PetPackets.cs similarity index 99% rename from Source/Game/Network/Packets/PetPackets.cs rename to Source/Game/Networking/Packets/PetPackets.cs index af34b39df..bed545a2c 100644 --- a/Source/Game/Network/Packets/PetPackets.cs +++ b/Source/Game/Networking/Packets/PetPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class DismissCritter : ClientPacket { diff --git a/Source/Game/Network/Packets/PetitionPackets.cs b/Source/Game/Networking/Packets/PetitionPackets.cs similarity index 99% rename from Source/Game/Network/Packets/PetitionPackets.cs rename to Source/Game/Networking/Packets/PetitionPackets.cs index 4e7d7484e..9cf82d923 100644 --- a/Source/Game/Network/Packets/PetitionPackets.cs +++ b/Source/Game/Networking/Packets/PetitionPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class QueryPetition : ClientPacket { diff --git a/Source/Game/Network/Packets/QueryPackets.cs b/Source/Game/Networking/Packets/QueryPackets.cs similarity index 99% rename from Source/Game/Network/Packets/QueryPackets.cs rename to Source/Game/Networking/Packets/QueryPackets.cs index 9c549998b..d25a2a0cb 100644 --- a/Source/Game/Network/Packets/QueryPackets.cs +++ b/Source/Game/Networking/Packets/QueryPackets.cs @@ -25,7 +25,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class QueryPlayerName : ClientPacket { diff --git a/Source/Game/Network/Packets/QuestPackets.cs b/Source/Game/Networking/Packets/QuestPackets.cs similarity index 99% rename from Source/Game/Network/Packets/QuestPackets.cs rename to Source/Game/Networking/Packets/QuestPackets.cs index 3e1d5c186..aa509e06b 100644 --- a/Source/Game/Network/Packets/QuestPackets.cs +++ b/Source/Game/Networking/Packets/QuestPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class QuestGiverStatusQuery : ClientPacket { diff --git a/Source/Game/Network/Packets/ReferAFriendPackets.cs b/Source/Game/Networking/Packets/ReferAFriendPackets.cs similarity index 97% rename from Source/Game/Network/Packets/ReferAFriendPackets.cs rename to Source/Game/Networking/Packets/ReferAFriendPackets.cs index d57646044..60ab0ee5e 100644 --- a/Source/Game/Network/Packets/ReferAFriendPackets.cs +++ b/Source/Game/Networking/Packets/ReferAFriendPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class ReferAFriendFailure : ServerPacket { diff --git a/Source/Game/Network/Packets/ReputationPackets.cs b/Source/Game/Networking/Packets/ReputationPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ReputationPackets.cs rename to Source/Game/Networking/Packets/ReputationPackets.cs index a6c358886..18ad7dd15 100644 --- a/Source/Game/Network/Packets/ReputationPackets.cs +++ b/Source/Game/Networking/Packets/ReputationPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class InitializeFactions : ServerPacket { diff --git a/Source/Game/Network/Packets/ScenarioPackets.cs b/Source/Game/Networking/Packets/ScenarioPackets.cs similarity index 99% rename from Source/Game/Network/Packets/ScenarioPackets.cs rename to Source/Game/Networking/Packets/ScenarioPackets.cs index d38144b20..dca1157b7 100644 --- a/Source/Game/Network/Packets/ScenarioPackets.cs +++ b/Source/Game/Networking/Packets/ScenarioPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Scenarios; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class ScenarioState : ServerPacket { diff --git a/Source/Game/Network/Packets/ScenePackets.cs b/Source/Game/Networking/Packets/ScenePackets.cs similarity index 98% rename from Source/Game/Network/Packets/ScenePackets.cs rename to Source/Game/Networking/Packets/ScenePackets.cs index ab59971b8..f5e471be9 100644 --- a/Source/Game/Network/Packets/ScenePackets.cs +++ b/Source/Game/Networking/Packets/ScenePackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class PlayScene : ServerPacket { diff --git a/Source/Game/Network/Packets/SocialPackets.cs b/Source/Game/Networking/Packets/SocialPackets.cs similarity index 99% rename from Source/Game/Network/Packets/SocialPackets.cs rename to Source/Game/Networking/Packets/SocialPackets.cs index 275d3a5a0..ab7d5e0ea 100644 --- a/Source/Game/Network/Packets/SocialPackets.cs +++ b/Source/Game/Networking/Packets/SocialPackets.cs @@ -20,7 +20,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class SendContactList : ClientPacket { diff --git a/Source/Game/Network/Packets/SpellPackets.cs b/Source/Game/Networking/Packets/SpellPackets.cs similarity index 99% rename from Source/Game/Network/Packets/SpellPackets.cs rename to Source/Game/Networking/Packets/SpellPackets.cs index 99c5aec04..debadb0a2 100644 --- a/Source/Game/Network/Packets/SpellPackets.cs +++ b/Source/Game/Networking/Packets/SpellPackets.cs @@ -23,7 +23,7 @@ using Game.Spells; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class CancelAura : ClientPacket { diff --git a/Source/Game/Network/Packets/SystemPackets.cs b/Source/Game/Networking/Packets/SystemPackets.cs similarity index 99% rename from Source/Game/Network/Packets/SystemPackets.cs rename to Source/Game/Networking/Packets/SystemPackets.cs index 06a5b0b92..2fdc81357 100644 --- a/Source/Game/Network/Packets/SystemPackets.cs +++ b/Source/Game/Networking/Packets/SystemPackets.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Generic; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class FeatureSystemStatus : ServerPacket { diff --git a/Source/Game/Network/Packets/TalentPackets.cs b/Source/Game/Networking/Packets/TalentPackets.cs similarity index 99% rename from Source/Game/Network/Packets/TalentPackets.cs rename to Source/Game/Networking/Packets/TalentPackets.cs index 0a4771077..d63e30ae4 100644 --- a/Source/Game/Network/Packets/TalentPackets.cs +++ b/Source/Game/Networking/Packets/TalentPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class UpdateTalentData : ServerPacket { diff --git a/Source/Game/Network/Packets/TaxiPackets.cs b/Source/Game/Networking/Packets/TaxiPackets.cs similarity index 99% rename from Source/Game/Network/Packets/TaxiPackets.cs rename to Source/Game/Networking/Packets/TaxiPackets.cs index 068ecb917..13e89ea7e 100644 --- a/Source/Game/Network/Packets/TaxiPackets.cs +++ b/Source/Game/Networking/Packets/TaxiPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Dynamic; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class TaxiNodeStatusQuery : ClientPacket { diff --git a/Source/Game/Network/Packets/TicketPackets.cs b/Source/Game/Networking/Packets/TicketPackets.cs similarity index 99% rename from Source/Game/Network/Packets/TicketPackets.cs rename to Source/Game/Networking/Packets/TicketPackets.cs index 1bf87406c..0975516fc 100644 --- a/Source/Game/Network/Packets/TicketPackets.cs +++ b/Source/Game/Networking/Packets/TicketPackets.cs @@ -22,7 +22,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class GMTicketGetSystemStatus : ClientPacket { diff --git a/Source/Game/Network/Packets/TokenPackets.cs b/Source/Game/Networking/Packets/TokenPackets.cs similarity index 99% rename from Source/Game/Network/Packets/TokenPackets.cs rename to Source/Game/Networking/Packets/TokenPackets.cs index 3dc6829f0..4eff139b9 100644 --- a/Source/Game/Network/Packets/TokenPackets.cs +++ b/Source/Game/Networking/Packets/TokenPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class UpdateListedAuctionableTokens : ClientPacket { diff --git a/Source/Game/Network/Packets/TotemPackets.cs b/Source/Game/Networking/Packets/TotemPackets.cs similarity index 98% rename from Source/Game/Network/Packets/TotemPackets.cs rename to Source/Game/Networking/Packets/TotemPackets.cs index 8cdc546f8..9adeb7158 100644 --- a/Source/Game/Network/Packets/TotemPackets.cs +++ b/Source/Game/Networking/Packets/TotemPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class TotemDestroyed : ClientPacket { diff --git a/Source/Game/Network/Packets/ToyPackets.cs b/Source/Game/Networking/Packets/ToyPackets.cs similarity index 98% rename from Source/Game/Network/Packets/ToyPackets.cs rename to Source/Game/Networking/Packets/ToyPackets.cs index 56bcffe27..d79c16620 100644 --- a/Source/Game/Network/Packets/ToyPackets.cs +++ b/Source/Game/Networking/Packets/ToyPackets.cs @@ -20,7 +20,7 @@ using Game.Entities; using System.Collections.Generic; using System; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class AddToy : ClientPacket { diff --git a/Source/Game/Network/Packets/TradePackets.cs b/Source/Game/Networking/Packets/TradePackets.cs similarity index 99% rename from Source/Game/Network/Packets/TradePackets.cs rename to Source/Game/Networking/Packets/TradePackets.cs index de9ec6897..dbb99816b 100644 --- a/Source/Game/Network/Packets/TradePackets.cs +++ b/Source/Game/Networking/Packets/TradePackets.cs @@ -20,7 +20,7 @@ using Framework.Dynamic; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class AcceptTrade : ClientPacket { diff --git a/Source/Game/Network/Packets/TransmogrificationPackets.cs b/Source/Game/Networking/Packets/TransmogrificationPackets.cs similarity index 98% rename from Source/Game/Network/Packets/TransmogrificationPackets.cs rename to Source/Game/Networking/Packets/TransmogrificationPackets.cs index c4cb1b593..3b1fecfdd 100644 --- a/Source/Game/Network/Packets/TransmogrificationPackets.cs +++ b/Source/Game/Networking/Packets/TransmogrificationPackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class TransmogrifyItems : ClientPacket { diff --git a/Source/Game/Network/Packets/UpdatePackets.cs b/Source/Game/Networking/Packets/UpdatePackets.cs similarity index 97% rename from Source/Game/Network/Packets/UpdatePackets.cs rename to Source/Game/Networking/Packets/UpdatePackets.cs index 5f50af04f..12e88b559 100644 --- a/Source/Game/Network/Packets/UpdatePackets.cs +++ b/Source/Game/Networking/Packets/UpdatePackets.cs @@ -17,7 +17,7 @@ using Framework.Constants; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class UpdateObject : ServerPacket { diff --git a/Source/Game/Network/Packets/VehiclePackets.cs b/Source/Game/Networking/Packets/VehiclePackets.cs similarity index 99% rename from Source/Game/Network/Packets/VehiclePackets.cs rename to Source/Game/Networking/Packets/VehiclePackets.cs index 3715e65d6..6c8a9851d 100644 --- a/Source/Game/Network/Packets/VehiclePackets.cs +++ b/Source/Game/Networking/Packets/VehiclePackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class MoveSetVehicleRecID : ServerPacket { diff --git a/Source/Game/Network/Packets/VoidStoragePackets.cs b/Source/Game/Networking/Packets/VoidStoragePackets.cs similarity index 99% rename from Source/Game/Network/Packets/VoidStoragePackets.cs rename to Source/Game/Networking/Packets/VoidStoragePackets.cs index 6750e263b..a6ad67764 100644 --- a/Source/Game/Network/Packets/VoidStoragePackets.cs +++ b/Source/Game/Networking/Packets/VoidStoragePackets.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Game.Entities; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { class VoidTransferResult : ServerPacket { diff --git a/Source/Game/Network/Packets/WardenPackets.cs b/Source/Game/Networking/Packets/WardenPackets.cs similarity index 99% rename from Source/Game/Network/Packets/WardenPackets.cs rename to Source/Game/Networking/Packets/WardenPackets.cs index e3c58254c..d79f9392f 100644 --- a/Source/Game/Network/Packets/WardenPackets.cs +++ b/Source/Game/Networking/Packets/WardenPackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.IO; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public enum WardenOpcodes { diff --git a/Source/Game/Network/Packets/WhoPackets.cs b/Source/Game/Networking/Packets/WhoPackets.cs similarity index 99% rename from Source/Game/Network/Packets/WhoPackets.cs rename to Source/Game/Networking/Packets/WhoPackets.cs index c51aa61c9..48026e0ca 100644 --- a/Source/Game/Network/Packets/WhoPackets.cs +++ b/Source/Game/Networking/Packets/WhoPackets.cs @@ -21,7 +21,7 @@ using Game.Entities; using System; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class WhoIsRequest : ClientPacket { diff --git a/Source/Game/Network/Packets/WorldStatePackets.cs b/Source/Game/Networking/Packets/WorldStatePackets.cs similarity index 98% rename from Source/Game/Network/Packets/WorldStatePackets.cs rename to Source/Game/Networking/Packets/WorldStatePackets.cs index 06e067a5a..44ad55c0c 100644 --- a/Source/Game/Network/Packets/WorldStatePackets.cs +++ b/Source/Game/Networking/Packets/WorldStatePackets.cs @@ -18,7 +18,7 @@ using Framework.Constants; using System.Collections.Generic; -namespace Game.Network.Packets +namespace Game.Networking.Packets { public class InitWorldStates : ServerPacket { diff --git a/Source/Game/Network/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs similarity index 94% rename from Source/Game/Network/WorldSocket.cs rename to Source/Game/Networking/WorldSocket.cs index 38fa62dfe..34d524616 100644 --- a/Source/Game/Network/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -20,12 +20,13 @@ using Framework.Cryptography; using Framework.Database; using Framework.IO; using Framework.Networking; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.IO; using System.Net.Sockets; +using System.Threading.Tasks; -namespace Game.Network +namespace Game.Networking { public class WorldSocket : SocketBase { @@ -37,6 +38,24 @@ namespace Game.Network static byte[] ContinuedSessionSeed = { 0x16, 0xAD, 0x0C, 0xD4, 0x46, 0xF9, 0x4F, 0xB2, 0xEF, 0x7D, 0xEA, 0x2A, 0x17, 0x66, 0x4D, 0x2F }; static byte[] EncryptionKeySeed = { 0xE9, 0x75, 0x3C, 0x50, 0x90, 0x93, 0x61, 0xDA, 0x3B, 0x07, 0xEE, 0xFA, 0xFF, 0x9D, 0x41, 0xB8 }; + ConnectionType _connectType; + ulong _key; + + byte[] _serverChallenge; + WorldCrypt _worldCrypt; + byte[] _sessionKey; + byte[] _encryptKey; + + long _LastPingTime; + uint _OverSpeedPings; + + WorldSession _worldSession; + + ZLib.z_stream _compressionStream; + + AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); + string _ipCountry; + public WorldSocket(Socket socket) : base(socket) { _connectType = ConnectionType.Realm; @@ -57,18 +76,18 @@ namespace Game.Network base.Dispose(); } - public override void Start() + public override void Accept() { string ip_address = GetRemoteIpAddress().ToString(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_IP_INFO); + PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelIpInfo); stmt.AddValue(0, ip_address); - stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpAddress().GetAddressBytes(), 0)); + stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpAddress().Address.GetAddressBytes(), 0)); _queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(CheckIpCallback)); } - void CheckIpCallback(SQLResult result) + async void CheckIpCallback(SQLResult result) { if (!result.IsEmpty()) { @@ -95,10 +114,10 @@ namespace Game.Network packet.WriteString("\n"); AsyncWrite(packet.GetData()); - AsyncReadWithCallback(InitializeHandler); + await AsyncReadWithCallback(InitializeHandler); } - public void InitializeHandler(SocketAsyncEventArgs args) + async Task InitializeHandler(SocketAsyncEventArgs args) { if (args.SocketError != SocketError.Success) { @@ -108,7 +127,7 @@ namespace Game.Network if (args.BytesTransferred > 0) { - ByteBuffer connBuffer = new ByteBuffer(GetReceiveBuffer()); + ByteBuffer connBuffer = new ByteBuffer(args.Buffer); string initializer = connBuffer.ReadString((uint)ClientConnectionInitialize.Length); if (initializer != ClientConnectionInitialize) @@ -130,29 +149,32 @@ namespace Game.Network } HandleSendAuthSession(); - AsyncRead(); + await AsyncRead(); return; } - AsyncReadWithCallback(InitializeHandler); + await AsyncReadWithCallback(InitializeHandler); } - public override void ReadHandler(int transferredBytes) + public async override Task ReadHandler(byte[] receiveData, int bytesTransferred) { if (!IsOpen()) return; - while (transferredBytes > 5) + while (bytesTransferred > 5) { - PacketHeader header; - if (!ReadHeader(out header)) + var header = new PacketHeader(); + header.Read(receiveData); + + if (!header.IsValidSize()) { + Log.outError(LogFilter.Network, "WorldSocket.ReadHeader(): client {0} sent malformed packet (size: {1})", GetRemoteIpAddress().ToString(), header.Size); CloseSocket(); return; } var data = new byte[header.Size]; - Buffer.BlockCopy(GetReceiveBuffer(), 16, data, 0, header.Size); + Buffer.BlockCopy(receiveData, 16, data, 0, header.Size); if (!_worldCrypt.Decrypt(ref data, header.Tag)) { @@ -167,32 +189,18 @@ namespace Game.Network return; } - PacketLog.Write(data, worldPacket.GetOpcode(), GetRemoteIpAddress(), GetRemotePort(), _connectType, true); + PacketLog.Write(data, worldPacket.GetOpcode(), GetRemoteIpAddress(), _connectType, true); if (!ProcessPacket(worldPacket)) { CloseSocket(); return; } - transferredBytes -= header.Size + 16; - Buffer.BlockCopy(GetReceiveBuffer(), header.Size + 16, GetReceiveBuffer(), 0, transferredBytes); + bytesTransferred -= header.Size + 16; + Buffer.BlockCopy(receiveData, header.Size + 16, receiveData, 0, bytesTransferred); } - AsyncRead(); - } - - bool ReadHeader(out PacketHeader header) - { - header = new PacketHeader(); - header.Read(GetReceiveBuffer()); - - if (!header.IsValidSize()) - { - Log.outError(LogFilter.Network, "WorldSocket.ReadHeader(): client {0} sent malformed packet (size: {1})", GetRemoteIpAddress().ToString(), header.Size); - return false; - } - - return true; + await AsyncRead(); } bool ProcessPacket(WorldPacket packet) @@ -282,7 +290,7 @@ namespace Game.Network var data = packet.GetData(); ServerOpcodes opcode = packet.GetOpcode(); - PacketLog.Write(data, (uint)opcode, GetRemoteIpAddress(), GetRemotePort(), _connectType, false); + PacketLog.Write(data, (uint)opcode, GetRemoteIpAddress(), _connectType, false); ByteBuffer buffer = new ByteBuffer(); @@ -375,7 +383,7 @@ namespace Game.Network { // Get the account information from the realmd database PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_BY_NAME); - stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Realm); + stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Index); stmt.AddValue(1, authSession.RealmJoinTicket); _queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthSessionCallback, authSession)); @@ -473,11 +481,11 @@ namespace Game.Network return; } - if (authSession.RealmID != Global.WorldMgr.GetRealm().Id.Realm) + if (authSession.RealmID != Global.WorldMgr.GetRealm().Id.Index) { SendAuthResponseError(BattlenetRpcErrorCode.Denied); Log.outError(LogFilter.Network, "WorldSocket.HandleAuthSession: Client {0} requested connecting with realm id {1} but this realm has id {2} set in config.", - GetRemoteIpAddress().ToString(), authSession.RealmID, Global.WorldMgr.GetRealm().Id.Realm); + GetRemoteIpAddress().ToString(), authSession.RealmID, Global.WorldMgr.GetRealm().Id.Index); CloseSocket(); return; } @@ -729,24 +737,6 @@ namespace Game.Network SendPacket(new Pong(ping.Serial)); return true; } - - ConnectionType _connectType; - ulong _key; - - byte[] _serverChallenge; - WorldCrypt _worldCrypt; - byte[] _sessionKey; - byte[] _encryptKey; - - long _LastPingTime; - uint _OverSpeedPings; - - WorldSession _worldSession; - - ZLib.z_stream _compressionStream; - - AsyncCallbackProcessor _queryProcessor = new AsyncCallbackProcessor(); - string _ipCountry; } class AccountInfo @@ -767,7 +757,7 @@ namespace Game.Network battleNet.LockCountry = fields.Read(4); game.Expansion = fields.Read(5); game.MuteTime = fields.Read(6); - battleNet.Locale = (LocaleConstant)fields.Read(7); + battleNet.Locale = (Locale)fields.Read(7); game.Recruiter = fields.Read(8); game.OS = fields.Read(9); battleNet.Id = fields.Read(10); @@ -776,8 +766,8 @@ namespace Game.Network game.IsBanned = fields.Read(13) != 0; game.IsRectuiter = fields.Read(14) != 0; - if (battleNet.Locale >= LocaleConstant.Total) - battleNet.Locale = LocaleConstant.enUS; + if (battleNet.Locale >= Locale.Total) + battleNet.Locale = Locale.enUS; } public bool IsBanned() { return battleNet.IsBanned || game.IsBanned; } @@ -791,7 +781,7 @@ namespace Game.Network public bool IsLockedToIP; public string LastIP; public string LockCountry; - public LocaleConstant Locale; + public Locale Locale; public bool IsBanned; } diff --git a/Source/Game/Network/WorldSocketManager.cs b/Source/Game/Networking/WorldSocketManager.cs similarity index 99% rename from Source/Game/Network/WorldSocketManager.cs rename to Source/Game/Networking/WorldSocketManager.cs index 5580fd3d2..c4f54099f 100644 --- a/Source/Game/Network/WorldSocketManager.cs +++ b/Source/Game/Networking/WorldSocketManager.cs @@ -20,7 +20,7 @@ using Framework.Constants; using Framework.Networking; using System.Net.Sockets; -namespace Game.Network +namespace Game.Networking { public class WorldSocketManager : SocketManager { @@ -51,7 +51,6 @@ namespace Game.Network public override void StopNetwork() { _instanceAcceptor.Close(); - base.StopNetwork(); _instanceAcceptor = null; diff --git a/Source/Game/OutdoorPVP/OutdoorPvP.cs b/Source/Game/OutdoorPVP/OutdoorPvP.cs index 379efac9d..8be54f995 100644 --- a/Source/Game/OutdoorPVP/OutdoorPvP.cs +++ b/Source/Game/OutdoorPVP/OutdoorPvP.cs @@ -23,8 +23,8 @@ using Game.Entities; using Game.Groups; using Game.Maps; using Game.Misc; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; @@ -735,7 +735,7 @@ namespace Game.PvP _id = id; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { string text = Global.OutdoorPvPMgr.GetDefenseMessage(_zoneId, _id, locale); diff --git a/Source/Game/OutdoorPVP/OutdoorPvPManager.cs b/Source/Game/OutdoorPVP/OutdoorPvPManager.cs index 430b7dc38..cb0e4ba25 100644 --- a/Source/Game/OutdoorPVP/OutdoorPvPManager.cs +++ b/Source/Game/OutdoorPVP/OutdoorPvPManager.cs @@ -218,7 +218,7 @@ namespace Game.PvP outdoor.HandlePlayerResurrects(player, zoneid); } - public string GetDefenseMessage(uint zoneId, uint id, LocaleConstant locale) + public string GetDefenseMessage(uint zoneId, uint id, Locale locale) { BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(id); if (bct != null) diff --git a/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs b/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs index 7c13f2d8a..1425801d1 100644 --- a/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs +++ b/Source/Game/OutdoorPVP/Zones/HellfirePeninsulaPvP.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; namespace Game.PvP diff --git a/Source/Game/Phasing/PhasingHandler.cs b/Source/Game/Phasing/PhasingHandler.cs index fbfbdd3d0..5d19a0d97 100644 --- a/Source/Game/Phasing/PhasingHandler.cs +++ b/Source/Game/Phasing/PhasingHandler.cs @@ -7,7 +7,7 @@ using Framework.Constants; using Game.Conditions; using Game.Spells; using System.Linq; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Chat; using Game.Maps; diff --git a/Source/Game/Quest/Quest.cs b/Source/Game/Quest/Quest.cs index 212ddf373..0499dc3e6 100644 --- a/Source/Game/Quest/Quest.cs +++ b/Source/Game/Quest/Quest.cs @@ -20,7 +20,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; @@ -698,35 +698,35 @@ namespace Game public class QuestGreetingLocale { - public StringArray Greeting = new StringArray((int)LocaleConstant.Total); + public StringArray Greeting = new StringArray((int)Locale.Total); } public class QuestTemplateLocale { - public StringArray LogTitle = new StringArray((int)LocaleConstant.Total); - public StringArray LogDescription = new StringArray((int)LocaleConstant.Total); - public StringArray QuestDescription = new StringArray((int)LocaleConstant.Total); - public StringArray AreaDescription = new StringArray((int)LocaleConstant.Total); - public StringArray PortraitGiverText = new StringArray((int)LocaleConstant.Total); - public StringArray PortraitGiverName = new StringArray((int)LocaleConstant.Total); - public StringArray PortraitTurnInText = new StringArray((int)LocaleConstant.Total); - public StringArray PortraitTurnInName = new StringArray((int)LocaleConstant.Total); - public StringArray QuestCompletionLog = new StringArray((int)LocaleConstant.Total); + public StringArray LogTitle = new StringArray((int)Locale.Total); + public StringArray LogDescription = new StringArray((int)Locale.Total); + public StringArray QuestDescription = new StringArray((int)Locale.Total); + public StringArray AreaDescription = new StringArray((int)Locale.Total); + public StringArray PortraitGiverText = new StringArray((int)Locale.Total); + public StringArray PortraitGiverName = new StringArray((int)Locale.Total); + public StringArray PortraitTurnInText = new StringArray((int)Locale.Total); + public StringArray PortraitTurnInName = new StringArray((int)Locale.Total); + public StringArray QuestCompletionLog = new StringArray((int)Locale.Total); } public class QuestRequestItemsLocale { - public StringArray CompletionText = new StringArray((int)LocaleConstant.Total); + public StringArray CompletionText = new StringArray((int)Locale.Total); } public class QuestObjectivesLocale { - public StringArray Description = new StringArray((int)LocaleConstant.Total); + public StringArray Description = new StringArray((int)Locale.Total); } public class QuestOfferRewardLocale { - public StringArray RewardText = new StringArray((int)LocaleConstant.Total); + public StringArray RewardText = new StringArray((int)Locale.Total); } public class QuestObjective diff --git a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs index 49074f77c..5f6a7bac1 100644 --- a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs +++ b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Framework.Database; using Game.Achievements; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index 544659521..f02a12d3c 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; diff --git a/Source/Game/Scenarios/InstanceScenario.cs b/Source/Game/Scenarios/InstanceScenario.cs index b9fba7414..734bb13ad 100644 --- a/Source/Game/Scenarios/InstanceScenario.cs +++ b/Source/Game/Scenarios/InstanceScenario.cs @@ -20,7 +20,7 @@ using Framework.Database; using Game.Achievements; using Game.DataStorage; using Game.Maps; -using Game.Network; +using Game.Networking; using System; using System.Collections.Generic; diff --git a/Source/Game/Scenarios/Scenario.cs b/Source/Game/Scenarios/Scenario.cs index 61dfbccc5..6f9600510 100644 --- a/Source/Game/Scenarios/Scenario.cs +++ b/Source/Game/Scenarios/Scenario.cs @@ -19,8 +19,8 @@ using Framework.Constants; using Game.Achievements; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.Scenarios diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index f689d4537..0ee30c179 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -19,14 +19,15 @@ using Framework.Collections; using Framework.Configuration; using Framework.Constants; using Framework.Database; +using Framework.Realm; using Game.BattlePets; using Game.Chat; using Game.Collision; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using Game.Spells; using System; using System.Collections.Concurrent; @@ -335,7 +336,7 @@ namespace Game RealmType server_type = IsFFAPvPRealm() ? RealmType.PVP : (RealmType)WorldConfig.GetIntValue(WorldCfg.GameType); uint realm_zone = WorldConfig.GetUIntValue(WorldCfg.RealmZone); - DB.Login.Execute("UPDATE realmlist SET icon = {0}, timezone = {1} WHERE id = '{2}'", (byte)server_type, realm_zone, _realm.Id.Realm); // One-time query + DB.Login.Execute("UPDATE realmlist SET icon = {0}, timezone = {1} WHERE id = '{2}'", (byte)server_type, realm_zone, _realm.Id.Index); // One-time query Log.outInfo(LogFilter.ServerLoading, "Initialize DataStorage..."); // Load DB2s @@ -857,7 +858,7 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Initialize game time and timers"); GameTime.UpdateGameTimers(); - DB.Login.Execute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES({0}, {1}, 0, '{2}')", _realm.Id.Realm, GameTime.GetStartTime(), ""); // One-time query + DB.Login.Execute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES({0}, {1}, 0, '{2}')", _realm.Id.Index, GameTime.GetStartTime(), ""); // One-time query m_timers[WorldTimers.Auctions].SetInterval(Time.Minute * Time.InMilliseconds); m_timers[WorldTimers.AuctionsPending].SetInterval(250); @@ -987,19 +988,19 @@ namespace Game }); } - Log.SetRealmId(_realm.Id.Realm); + Log.SetRealmId(_realm.Id.Index); } public void LoadConfigSettings(bool reload = false) { WorldConfig.Load(reload); - m_defaultDbcLocale = (LocaleConstant)ConfigMgr.GetDefaultValue("DBC.Locale", 0); + m_defaultDbcLocale = (Locale)ConfigMgr.GetDefaultValue("DBC.Locale", 0); - if (m_defaultDbcLocale >= LocaleConstant.Total || m_defaultDbcLocale == LocaleConstant.None) + if (m_defaultDbcLocale >= Locale.Total || m_defaultDbcLocale == Locale.None) { - Log.outError(LogFilter.ServerLoading, "Incorrect DBC.Locale! Must be >= 0 and < {0} and not {1} (set to 0)", LocaleConstant.Total, LocaleConstant.None); - m_defaultDbcLocale = LocaleConstant.enUS; + Log.outError(LogFilter.ServerLoading, "Incorrect DBC.Locale! Must be >= 0 and < {0} and not {1} (set to 0)", Locale.Total, Locale.None); + m_defaultDbcLocale = Locale.enUS; } Log.outInfo(LogFilter.ServerLoading, "Using {0} DBC Locale", m_defaultDbcLocale); @@ -1111,7 +1112,7 @@ namespace Game m_Autobroadcasts.Clear(); PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_AUTOBROADCAST); - stmt.AddValue(0, _realm.Id.Realm); + stmt.AddValue(0, _realm.Id.Index); SQLResult result = DB.Login.Query(stmt); if (result.IsEmpty()) @@ -1239,7 +1240,7 @@ namespace Game stmt.AddValue(0, tmpDiff); stmt.AddValue(1, maxOnlinePlayers); - stmt.AddValue(2, _realm.Id.Realm); + stmt.AddValue(2, _realm.Id.Index); stmt.AddValue(3, (uint)GameTime.GetStartTime()); DB.Login.Execute(stmt); @@ -1255,7 +1256,7 @@ namespace Game PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_OLD_LOGS); stmt.AddValue(0, WorldConfig.GetIntValue(WorldCfg.LogdbCleartime)); stmt.AddValue(1, 0); - stmt.AddValue(2, GetRealm().Id.Realm); + stmt.AddValue(2, GetRealm().Id.Index); DB.Login.Execute(stmt); } @@ -1806,13 +1807,13 @@ namespace Game PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_REALM_CHARACTERS_BY_REALM); stmt.AddValue(0, Id); - stmt.AddValue(1, _realm.Id.Realm); + stmt.AddValue(1, _realm.Id.Index); trans.Append(stmt); stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_REALM_CHARACTERS); stmt.AddValue(0, charCount); stmt.AddValue(1, Id); - stmt.AddValue(2, _realm.Id.Realm); + stmt.AddValue(2, _realm.Id.Index); trans.Append(stmt); DB.Login.CommitTransaction(trans); @@ -1961,7 +1962,7 @@ namespace Game public void LoadDBAllowedSecurityLevel() { PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL); - stmt.AddValue(0, _realm.Id.Realm); + stmt.AddValue(0, _realm.Id.Index); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -2226,11 +2227,11 @@ namespace Game return WorldConfig.GetIntValue(WorldCfg.GameType) == (int)RealmType.FFAPVP; } - public LocaleConstant GetDefaultDbcLocale() { return m_defaultDbcLocale; } + public Locale GetDefaultDbcLocale() { return m_defaultDbcLocale; } public bool LoadRealmInfo() { - SQLResult result = DB.Login.Query("SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild, Region, Battlegroup FROM realmlist WHERE id = {0}", _realm.Id.Realm); + SQLResult result = DB.Login.Query("SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild, Region, Battlegroup FROM realmlist WHERE id = {0}", _realm.Id.Index); if (result.IsEmpty()) return false; @@ -2251,7 +2252,7 @@ namespace Game } public Realm GetRealm() { return _realm; } - public RealmHandle GetRealmId() { return _realm.Id; } + public RealmId GetRealmId() { return _realm.Id; } public void RemoveOldCorpses() { @@ -2271,7 +2272,7 @@ namespace Game public int GetVisibilityNotifyPeriodInInstances() { return m_visibility_notify_periodInInstances; } public int GetVisibilityNotifyPeriodInBGArenas() { return m_visibility_notify_periodInBGArenas; } - public LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) + public Locale GetAvailableDbcLocale(Locale locale) { //if (m_availableDbcLocaleMask & (1 << locale)) //return locale; @@ -2319,7 +2320,7 @@ namespace Game Dictionary m_worldstates = new Dictionary(); uint m_playerLimit; AccountTypes m_allowedSecurityLevel; - LocaleConstant m_defaultDbcLocale; // from config for one from loaded DBC locales + Locale m_defaultDbcLocale; // from config for one from loaded DBC locales List m_motd = new List(); // scheduled reset times @@ -2405,7 +2406,7 @@ namespace Game i_args = args; } - public override void Invoke(List data_list, LocaleConstant loc_idx) + public override void Invoke(List data_list, Locale loc_idx) { string text = Global.ObjectMgr.GetCypherString(i_textId, loc_idx); diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index 4f6fe0e03..a6cf89e32 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -23,8 +23,8 @@ using Game.BattlePets; using Game.Entities; using Game.Guilds; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -32,12 +32,13 @@ using System.IO; using System.Numerics; using System.Text; using System.Threading.Tasks; +using Framework.Realm; namespace Game { public partial class WorldSession : IDisposable { - public WorldSession(uint id, string name, uint battlenetAccountId, WorldSocket sock, AccountTypes sec, Expansion expansion, long mute_time, string os, LocaleConstant locale, uint recruiter, bool isARecruiter) + public WorldSession(uint id, string name, uint battlenetAccountId, WorldSocket sock, AccountTypes sec, Expansion expansion, long mute_time, string os, Locale locale, uint recruiter, bool isARecruiter) { m_muteTime = mute_time; AntiDOS = new DosProtection(this); @@ -691,9 +692,9 @@ namespace Game AccountTypes secLevel = GetSecurity(); Log.outDebug(LogFilter.Rbac, "WorldSession.LoadPermissions [AccountId: {0}, Name: {1}, realmId: {2}, secLevel: {3}]", - id, _accountName, Global.WorldMgr.GetRealm().Id.Realm, secLevel); + id, _accountName, Global.WorldMgr.GetRealm().Id.Index, secLevel); - _RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Realm, (byte)secLevel); + _RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)secLevel); _RBACData.LoadFromDB(); } @@ -703,9 +704,9 @@ namespace Game AccountTypes secLevel = GetSecurity(); Log.outDebug(LogFilter.Rbac, "WorldSession.LoadPermissions [AccountId: {0}, Name: {1}, realmId: {2}, secLevel: {3}]", - id, _accountName, Global.WorldMgr.GetRealm().Id.Realm, secLevel); + id, _accountName, Global.WorldMgr.GetRealm().Id.Index, secLevel); - _RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Realm, (byte)secLevel); + _RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)secLevel); return _RBACData.LoadFromDBAsync(); } @@ -749,7 +750,7 @@ namespace Game { do { - _realmCharacterCounts[new RealmHandle(result.Read(3), result.Read(4), result.Read(2)).GetAddress()] = result.Read(1); + _realmCharacterCounts[new RealmId(result.Read(3), result.Read(4), result.Read(2)).GetAddress()] = result.Read(1); } while (result.NextRow()); } @@ -776,7 +777,7 @@ namespace Game bool hasPermission = _RBACData.HasPermission(permission); Log.outDebug(LogFilter.Rbac, "WorldSession:HasPermission [AccountId: {0}, Name: {1}, realmId: {2}]", - _RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Realm); + _RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Index); return hasPermission; } @@ -784,7 +785,7 @@ namespace Game public void InvalidateRBACData() { Log.outDebug(LogFilter.Rbac, "WorldSession:Invalidaterbac:RBACData [AccountId: {0}, Name: {1}, realmId: {2}]", - _RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Realm); + _RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Index); _RBACData = null; } @@ -801,8 +802,8 @@ namespace Game } } - public LocaleConstant GetSessionDbcLocale() { return m_sessionDbcLocale; } - public LocaleConstant GetSessionDbLocaleIndex() { return m_sessionDbLocaleIndex; } + public Locale GetSessionDbcLocale() { return m_sessionDbcLocale; } + public Locale GetSessionDbLocaleIndex() { return m_sessionDbLocaleIndex; } public uint GetLatency() { return m_latency; } public void SetLatency(uint latency) { m_latency = latency; } @@ -866,8 +867,8 @@ namespace Game bool m_playerLogout; // code processed in LogoutPlayer bool m_playerRecentlyLogout; bool m_playerSave; - LocaleConstant m_sessionDbcLocale; - LocaleConstant m_sessionDbLocaleIndex; + Locale m_sessionDbcLocale; + Locale m_sessionDbLocaleIndex; uint m_latency; uint m_clientTimeDelay; AccountData[] _accountData = new AccountData[(int)AccountDataTypes.Max]; @@ -1048,7 +1049,7 @@ namespace Game stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.Mounts, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_ACCOUNT_ID); + stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetCharacterCountsByAccountId); stmt.AddValue(0, accountId); SetQuery(AccountInfoQueryLoad.GlobalRealmCharacterCounts, stmt); diff --git a/Source/Game/Services/GameUtilitiesService.cs b/Source/Game/Services/GameUtilitiesService.cs index 6158dcbdb..186f90643 100644 --- a/Source/Game/Services/GameUtilitiesService.cs +++ b/Source/Game/Services/GameUtilitiesService.cs @@ -17,7 +17,7 @@ using Bgs.Protocol.GameUtilities.V1; using Framework.Constants; -using Framework.Rest; +using Framework.Web; using Framework.Serialization; using Game.Services; using Google.Protobuf; diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index cfa25ff5d..70cd658ec 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -20,7 +20,7 @@ using Framework.Dynamic; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using System; using System.Collections.Generic; diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index b23ff5752..43bf49535 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -23,7 +23,7 @@ using Game.DataStorage; using Game.Entities; using Game.Loots; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 189cd1985..b9afdb91c 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -25,7 +25,7 @@ using Game.Entities; using Game.Loots; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using System; using System.Collections.Generic; diff --git a/Source/Game/Spells/SpellCastTargets.cs b/Source/Game/Spells/SpellCastTargets.cs index a9bdcbd97..fbeae13a3 100644 --- a/Source/Game/Spells/SpellCastTargets.cs +++ b/Source/Game/Spells/SpellCastTargets.cs @@ -17,7 +17,7 @@ using Framework.Constants; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; namespace Game.Spells diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 39a8a9aa1..8b5996323 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -29,7 +29,7 @@ using Game.Guilds; using Game.Loots; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs index 2911a4bcf..9ec4a1cec 100644 --- a/Source/Game/Spells/SpellHistory.cs +++ b/Source/Game/Spells/SpellHistory.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.Database; using Game.DataStorage; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/SupportSystem/SupportTickets.cs b/Source/Game/SupportSystem/SupportTickets.cs index 54d1fa43e..c327843af 100644 --- a/Source/Game/SupportSystem/SupportTickets.cs +++ b/Source/Game/SupportSystem/SupportTickets.cs @@ -20,7 +20,7 @@ using Framework.Database; using Framework.GameMath; using Game.Chat; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Text; namespace Game.SupportSystem diff --git a/Source/Game/Text/ChatTextBuilder.cs b/Source/Game/Text/ChatTextBuilder.cs index 6951239e8..0adcb56bb 100644 --- a/Source/Game/Text/ChatTextBuilder.cs +++ b/Source/Game/Text/ChatTextBuilder.cs @@ -18,16 +18,16 @@ using Framework.Constants; using Game.DataStorage; using Game.Entities; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game.Chat { public class MessageBuilder { - public virtual ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) { return null; } - public virtual void Invoke(List data, LocaleConstant locale = LocaleConstant.enUS) { } + public virtual ServerPacket Invoke(Locale locale = Locale.enUS) { return null; } + public virtual void Invoke(List data, Locale locale = Locale.enUS) { } } public class BroadcastTextBuilder : MessageBuilder @@ -42,7 +42,7 @@ namespace Game.Chat _achievementId = achievementId; } - public override ServerPacket Invoke(LocaleConstant locale) + public override ServerPacket Invoke(Locale locale) { BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(_textId); var packet = new ChatPkt(); @@ -69,7 +69,7 @@ namespace Game.Chat _target = target; } - public override ServerPacket Invoke(LocaleConstant locale) + public override ServerPacket Invoke(Locale locale) { var packet = new ChatPkt(); packet.Initialize(_msgType, _language, _source, _target, _text, 0, "", locale); @@ -94,7 +94,7 @@ namespace Game.Chat _args = args; } - public override ServerPacket Invoke(LocaleConstant locale) + public override ServerPacket Invoke(Locale locale) { ChatPkt packet = new ChatPkt(); diff --git a/Source/Game/Text/CreatureTextManager.cs b/Source/Game/Text/CreatureTextManager.cs index 03d288f29..5ef33e747 100644 --- a/Source/Game/Text/CreatureTextManager.cs +++ b/Source/Game/Text/CreatureTextManager.cs @@ -23,8 +23,8 @@ using Game.DataStorage; using Game.Entities; using Game.Groups; using Game.Maps; -using Game.Network; -using Game.Network.Packets; +using Game.Networking; +using Game.Networking.Packets; using System; using System.Collections.Generic; @@ -142,8 +142,8 @@ namespace Game uint groupId = result.Read(1); uint id = result.Read(2); string localeName = result.Read(3); - LocaleConstant locale = localeName.ToEnum(); - if (locale == LocaleConstant.enUS) + Locale locale = localeName.ToEnum(); + if (locale == Locale.enUS) continue; var key = new CreatureTextId(creatureId, groupId, id); @@ -377,7 +377,7 @@ namespace Game return true; } - public string GetLocalizedChatString(uint entry, Gender gender, byte textGroup, uint id, LocaleConstant locale = LocaleConstant.enUS) + public string GetLocalizedChatString(uint entry, Gender gender, byte textGroup, uint id, Locale locale = Locale.enUS) { var multiMap = mTextMap.LookupByKey(entry); if (multiMap == null) @@ -398,8 +398,8 @@ namespace Game if (creatureTextEntry == null) return ""; - if (locale >= LocaleConstant.Total) - locale = LocaleConstant.enUS; + if (locale >= Locale.Total) + locale = Locale.enUS; string baseText = ""; BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(creatureTextEntry.BroadcastTextId); @@ -409,7 +409,7 @@ namespace Game else baseText = creatureTextEntry.text; - if (locale != LocaleConstant.enUS && bct == null) + if (locale != Locale.enUS && bct == null) { var creatureTextLocale = mLocaleTextMap.LookupByKey(new CreatureTextId(entry, textGroup, id)); if (creatureTextLocale != null) @@ -560,7 +560,7 @@ namespace Game } public class CreatureTextLocale { - public StringArray Text = new StringArray((int)LocaleConstant.Total); + public StringArray Text = new StringArray((int)Locale.Total); } public class CreatureTextId { @@ -595,7 +595,7 @@ namespace Game public void Invoke(Player player) { - LocaleConstant loc_idx = player.GetSession().GetSessionDbLocaleIndex(); + Locale loc_idx = player.GetSession().GetSessionDbLocaleIndex(); ServerPacket messageTemplate; // create if not cached yet @@ -621,7 +621,7 @@ namespace Game player.SendPacket(message); } - Dictionary _packetCache = new Dictionary(); + Dictionary _packetCache = new Dictionary(); MessageBuilder _builder; ChatMsg _msgType; } @@ -639,7 +639,7 @@ namespace Game _target = target; } - public override ServerPacket Invoke(LocaleConstant locale = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale locale = Locale.enUS) { string text = Global.CreatureTextMgr.GetLocalizedChatString(_source.GetEntry(), _gender, _textGroup, _textId, locale); var packet = new ChatPkt(); @@ -670,7 +670,7 @@ namespace Game _target = target; } - public override ServerPacket Invoke(LocaleConstant loc_idx = LocaleConstant.enUS) + public override ServerPacket Invoke(Locale loc_idx = Locale.enUS) { string text = Global.CreatureTextMgr.GetLocalizedChatString(_source.GetEntry(), _gender, _textGroup, _textId, loc_idx); var packet = new ChatPkt(); diff --git a/Source/Game/Warden/Warden.cs b/Source/Game/Warden/Warden.cs index f2e6078d7..008fd9d60 100644 --- a/Source/Game/Warden/Warden.cs +++ b/Source/Game/Warden/Warden.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Cryptography; using Framework.IO; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Numerics; using System.Security.Cryptography; diff --git a/Source/Game/Warden/WardenWin.cs b/Source/Game/Warden/WardenWin.cs index adaa87a9f..8bc172290 100644 --- a/Source/Game/Warden/WardenWin.cs +++ b/Source/Game/Warden/WardenWin.cs @@ -18,7 +18,7 @@ using Framework.Constants; using Framework.Cryptography; using Framework.IO; -using Game.Network.Packets; +using Game.Networking.Packets; using System; using System.Collections.Generic; using System.Linq; diff --git a/Source/Game/Weather/WeatherManager.cs b/Source/Game/Weather/WeatherManager.cs index 35ccb3143..9e23aa7da 100644 --- a/Source/Game/Weather/WeatherManager.cs +++ b/Source/Game/Weather/WeatherManager.cs @@ -17,7 +17,7 @@ using Framework.Database; using Game.Entities; -using Game.Network.Packets; +using Game.Networking.Packets; using System.Collections.Generic; namespace Game diff --git a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs index ce57f380c..0f4a79ff5 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs @@ -23,7 +23,7 @@ using Game.AI; using Game.Entities; using Game.Maps; using Game.Movement; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using Game.Spells; using System; diff --git a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs index 9de0def39..a7b48aaf9 100644 --- a/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs +++ b/Source/Scripts/Northrend/IcecrownCitadel/InstanceIcecrownCitadel.cs @@ -20,7 +20,7 @@ using Framework.IO; using Game; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using System.Collections.Generic; using System.Linq; diff --git a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs b/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs index c9c9b5947..054d9a13c 100644 --- a/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs +++ b/Source/Scripts/Northrend/Ulduar/UlduarInstance.cs @@ -19,7 +19,7 @@ using Framework.Constants; using Framework.IO; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using System; using System.Collections.Generic; diff --git a/Source/Scripts/Northrend/Ulduar/Xt002.cs b/Source/Scripts/Northrend/Ulduar/Xt002.cs index aed9e94a9..10286b099 100644 --- a/Source/Scripts/Northrend/Ulduar/Xt002.cs +++ b/Source/Scripts/Northrend/Ulduar/Xt002.cs @@ -24,7 +24,7 @@ using Game.Scripting; using Game.Spells; using System; using System.Collections.Generic; -using Game.Network.Packets; +using Game.Networking.Packets; namespace Scripts.Northrend.Ulduar.Xt002 { diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index d1ac94621..f87315357 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -20,7 +20,7 @@ using Framework.Dynamic; using Game.DataStorage; using Game.Entities; using Game.Maps; -using Game.Network.Packets; +using Game.Networking.Packets; using Game.Scripting; using Game.Spells; using System; diff --git a/Source/WorldServer/Server.cs b/Source/WorldServer/Server.cs index abcdb4e74..429794afb 100644 --- a/Source/WorldServer/Server.cs +++ b/Source/WorldServer/Server.cs @@ -20,7 +20,7 @@ using Framework.Constants; using Framework.Database; using Game; using Game.Chat; -using Game.Network; +using Game.Networking; using System; using System.Diagnostics; using System.Globalization; @@ -50,7 +50,7 @@ namespace WorldServer uint startupBegin = Time.GetMSTime(); // set server offline (not connectable) - DB.Login.DirectExecute("UPDATE realmlist SET flag = (flag & ~{0}) | {1} WHERE id = '{2}'", (uint)RealmFlags.VersionMismatch, (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm); + DB.Login.DirectExecute("UPDATE realmlist SET flag = (flag & ~{0}) | {1} WHERE id = '{2}'", (uint)RealmFlags.VersionMismatch, (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Index); Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10)); @@ -76,7 +76,7 @@ namespace WorldServer } // set server online (allow connecting now) - DB.Login.DirectExecute("UPDATE realmlist SET flag = flag & ~{0}, population = 0 WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm); + DB.Login.DirectExecute("UPDATE realmlist SET flag = flag & ~{0}, population = 0 WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Index); Global.WorldMgr.GetRealm().PopulationLevel = 0.0f; Global.WorldMgr.GetRealm().Flags = Global.WorldMgr.GetRealm().Flags & ~RealmFlags.VersionMismatch; @@ -111,7 +111,7 @@ namespace WorldServer Global.ScriptMgr.Unload(); // set server offline - DB.Login.DirectExecute("UPDATE realmlist SET flag = flag | {0} WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm); + DB.Login.DirectExecute("UPDATE realmlist SET flag = flag | {0} WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Index); Global.RealmMgr.Close(); ClearOnlineAccounts(); @@ -138,13 +138,13 @@ namespace WorldServer return false; // Get the realm Id from the configuration file - Global.WorldMgr.GetRealm().Id.Realm = ConfigMgr.GetDefaultValue("RealmID", 0u); - if (Global.WorldMgr.GetRealm().Id.Realm == 0) + Global.WorldMgr.GetRealm().Id.Index = ConfigMgr.GetDefaultValue("RealmID", 0u); + if (Global.WorldMgr.GetRealm().Id.Index == 0) { Log.outError(LogFilter.Server, "Realm ID not defined in configuration file"); return false; } - Log.outInfo(LogFilter.ServerLoading, "Realm running as realm ID {0} ", Global.WorldMgr.GetRealm().Id.Realm); + Log.outInfo(LogFilter.ServerLoading, "Realm running as realm ID {0} ", Global.WorldMgr.GetRealm().Id.Index); // Clean the database before starting ClearOnlineAccounts(); @@ -156,7 +156,7 @@ namespace WorldServer static void ClearOnlineAccounts() { // Reset online status for all accounts with characters on the current realm - DB.Login.DirectExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = {0})", Global.WorldMgr.GetRealm().Id.Realm); + DB.Login.DirectExecute("UPDATE account SET online = 0 WHERE online > 0 AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = {0})", Global.WorldMgr.GetRealm().Id.Index); // Reset online status for all characters DB.Characters.DirectExecute("UPDATE characters SET online = 0 WHERE online <> 0");