void HandleGameObjectQuery(QueryGameObject packet) { QueryGameObjectResponse response = new QueryGameObjectResponse(); response.GameObjectID = packet.GameObjectID; GameObjectTemplate gameObjectInfo = Global.ObjectMgr.GetGameObjectTemplate(packet.GameObjectID); if (gameObjectInfo != null) { response.Allow = true; GameObjectStats stats = new GameObjectStats(); stats.Type = (uint)gameObjectInfo.type; stats.DisplayID = gameObjectInfo.displayId; stats.Name[0] = gameObjectInfo.name; stats.IconName = gameObjectInfo.IconName; stats.CastBarCaption = gameObjectInfo.castBarCaption; stats.UnkString = gameObjectInfo.unk1; LocaleConstant localeConstant = GetSessionDbLocaleIndex(); if (localeConstant != LocaleConstant.enUS) { GameObjectLocale gameObjectLocale = Global.ObjectMgr.GetGameObjectLocale(packet.GameObjectID); if (gameObjectLocale != null) { ObjectManager.GetLocaleString(gameObjectLocale.Name, localeConstant, ref stats.Name[0]); ObjectManager.GetLocaleString(gameObjectLocale.CastBarCaption, localeConstant, ref stats.CastBarCaption); ObjectManager.GetLocaleString(gameObjectLocale.Unk1, localeConstant, ref stats.UnkString); } } var items = Global.ObjectMgr.GetGameObjectQuestItemList(packet.GameObjectID); foreach (uint item in items) { stats.QuestItems.Add(item); } unsafe { fixed(int *ptr = gameObjectInfo.Raw.data) { for (int i = 0; i < SharedConst.MaxGOData; i++) { stats.Data[i] = ptr[i]; } } } stats.RequiredLevel = (uint)gameObjectInfo.RequiredLevel; response.Stats = stats; } SendPacket(response); }
void HandleGameObjectQuery(QueryGameObject packet) { GameObjectTemplate info = Global.ObjectMgr.GetGameObjectTemplate(packet.GameObjectID); if (info != null) { if (!WorldConfig.GetBoolValue(WorldCfg.CacheDataQueries)) { info.InitializeQueryData(); } QueryGameObjectResponse queryGameObjectResponse = info.QueryData; LocaleConstant loc = GetSessionDbLocaleIndex(); if (loc != LocaleConstant.enUS) { GameObjectLocale gameObjectLocale = Global.ObjectMgr.GetGameObjectLocale(queryGameObjectResponse.GameObjectID); if (gameObjectLocale != null) { ObjectManager.GetLocaleString(gameObjectLocale.Name, loc, ref queryGameObjectResponse.Stats.Name[0]); ObjectManager.GetLocaleString(gameObjectLocale.CastBarCaption, loc, ref queryGameObjectResponse.Stats.CastBarCaption); ObjectManager.GetLocaleString(gameObjectLocale.Unk1, loc, ref queryGameObjectResponse.Stats.UnkString); } } SendPacket(queryGameObjectResponse); } else { Log.outDebug(LogFilter.Network, $"WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (ENTRY: {packet.GameObjectID})"); QueryGameObjectResponse response = new QueryGameObjectResponse(); response.GameObjectID = packet.GameObjectID; response.Guid = packet.Guid; SendPacket(response); } }