void HandleCreatureQuery(QueryCreature packet) { CreatureTemplate ci = Global.ObjectMgr.GetCreatureTemplate(packet.CreatureID); if (ci != null) { if (!WorldConfig.GetBoolValue(WorldCfg.CacheDataQueries)) { ci.InitializeQueryData(); } QueryCreatureResponse queryCreatureResponse = ci.QueryData; LocaleConstant loc = GetSessionDbLocaleIndex(); if (loc != LocaleConstant.enUS) { CreatureLocale creatureLocale = Global.ObjectMgr.GetCreatureLocale(ci.Entry); if (creatureLocale != null) { string name = queryCreatureResponse.Stats.Name[0]; string nameAlt = queryCreatureResponse.Stats.NameAlt[0]; ObjectManager.GetLocaleString(creatureLocale.Name, loc, ref name); ObjectManager.GetLocaleString(creatureLocale.NameAlt, loc, ref nameAlt); ObjectManager.GetLocaleString(creatureLocale.Title, loc, ref queryCreatureResponse.Stats.Title); ObjectManager.GetLocaleString(creatureLocale.TitleAlt, loc, ref queryCreatureResponse.Stats.TitleAlt); queryCreatureResponse.Stats.Name[0] = name; queryCreatureResponse.Stats.NameAlt[0] = nameAlt; } } SendPacket(queryCreatureResponse); } else { Log.outDebug(LogFilter.Network, $"WORLD: CMSG_QUERY_CREATURE - NO CREATURE INFO! (ENTRY: {packet.CreatureID})"); QueryCreatureResponse response = new QueryCreatureResponse(); response.CreatureID = packet.CreatureID; SendPacket(response); } }
void HandleCreatureQuery(QueryCreature packet) { QueryCreatureResponse response = new QueryCreatureResponse(); response.CreatureID = packet.CreatureID; CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(packet.CreatureID); if (creatureInfo != null) { response.Allow = true; CreatureStats stats = new CreatureStats(); stats.Leader = creatureInfo.RacialLeader; string name = creatureInfo.Name; string nameAlt = creatureInfo.FemaleName; stats.Flags[0] = (uint)creatureInfo.TypeFlags; stats.Flags[1] = creatureInfo.TypeFlags2; stats.CreatureType = (int)creatureInfo.CreatureType; stats.CreatureFamily = (int)creatureInfo.Family; stats.Classification = (int)creatureInfo.Rank; for (uint i = 0; i < SharedConst.MaxCreatureKillCredit; ++i) { stats.ProxyCreatureID[i] = creatureInfo.KillCredit[i]; } stats.CreatureDisplayID[0] = creatureInfo.ModelId1; stats.CreatureDisplayID[1] = creatureInfo.ModelId2; stats.CreatureDisplayID[2] = creatureInfo.ModelId3; stats.CreatureDisplayID[3] = creatureInfo.ModelId4; stats.HpMulti = creatureInfo.ModHealth; stats.EnergyMulti = creatureInfo.ModMana; stats.CreatureMovementInfoID = creatureInfo.MovementId; stats.RequiredExpansion = creatureInfo.RequiredExpansion; stats.HealthScalingExpansion = creatureInfo.HealthScalingExpansion; stats.VignetteID = creatureInfo.VignetteID; stats.Title = creatureInfo.SubName; stats.TitleAlt = creatureInfo.TitleAlt; stats.CursorName = creatureInfo.IconName; var items = Global.ObjectMgr.GetCreatureQuestItemList(packet.CreatureID); foreach (uint item in items) { stats.QuestItems.Add(item); } LocaleConstant localeConstant = GetSessionDbLocaleIndex(); if (localeConstant != LocaleConstant.enUS) { CreatureLocale creatureLocale = Global.ObjectMgr.GetCreatureLocale(packet.CreatureID); if (creatureLocale != null) { ObjectManager.GetLocaleString(creatureLocale.Name, localeConstant, ref name); ObjectManager.GetLocaleString(creatureLocale.NameAlt, localeConstant, ref nameAlt); ObjectManager.GetLocaleString(creatureLocale.Title, localeConstant, ref stats.Title); ObjectManager.GetLocaleString(creatureLocale.TitleAlt, localeConstant, ref stats.TitleAlt); } } stats.Name[0] = name; stats.NameAlt[0] = nameAlt; response.Stats = stats; } SendPacket(response); }