/** * Send map informations request (actors, interactives, house, fights) */ public async Task SendMapInformationsRequest(GameClient client, MapInformationsRequestMessage mapInformationsRequestMessage) { var map = await this.GetMapById(mapInformationsRequestMessage.mapId); if (map == null) { client.Disconnect(); return; } var actors = new List <GameRolePlayInformations>(); //characters foreach (var character in map.Characters.Values) { //client character actors.Add(new GameRolePlayCharacterInformations(character.Id, character.EntityLook, new EntityDispositionInformations(character.CellId, 3), character.Name, new HumanInformations(), character.AccountId, new ActorAlignmentInformations(0, 0, 0, 3956606))); } //npcs foreach (var npc in map.NpcSpawns) { actors.Add(new GameRolePlayNpcInformations(npc.Id * -1, !npc.OverridedEntityLook.IsEmpty() ? EntityLookHelper.DecodeStringLook(npc.OverridedEntityLook) : EntityLookHelper.DecodeStringLook(npc.Npc.Look), new EntityDispositionInformations(npc.CellId, npc.DirectionId), npc.NpcId, false, 0, npc.Npc)); } //interactive => @TODO do it on Map object in future var layers = map.MidgroundLayer .Where(x => x.Value.FirstOrDefault(midLayer => midLayer.Id != null) != null) .ToList(); List <InteractiveElement> interactiveElements = new List <InteractiveElement>(); List <StatedElement> statedElements = new List <StatedElement>(); foreach (var layer in layers) { foreach (var cell in layer.Value.Where(x => x.Id != null)) { if (Map.ZAAP_GFX_ID.Contains(Convert.ToInt32(cell.G))) { interactiveElements.Add(new InteractiveElement((int)cell.Id, 16, new InteractiveElementSkill[] { new InteractiveElementSkill(114, 53040312, 0, "Utiliser", 1, 1, "Base"), new InteractiveElementSkill(44, 53040310, 0, "Sauvegarder", 1, 1, "Base"), }, new InteractiveElementSkill[] { }, "Zaap")); } else { //statedElements statedElements.Add(new StatedElement((int)cell.Id, Convert.ToInt32(layer.Key), 0)); interactiveElements.Add(new InteractiveElement((int)cell.Id, 38, new InteractiveElementSkill[] { new InteractiveElementSkill(45, 53040310, 4, "Faucher", 1, 1, "Faucher"), }, new InteractiveElementSkill[] { }, "Blé")); } } } client.Send(new MapComplementaryInformationsDataMessage(778, map.Id, new int[] { }, actors.ToArray(), interactiveElements.ToArray(), statedElements.ToArray(), new int[] { }, new int[] { })); }
public static bool Prefix(EntityHornet __instance, Context ___utilityAIContext, EntitySeeCache ___seeCache, EntityLookHelper ___lookHelper, ref int ___aggroCooldown) { if (!__instance.HasAnyTags(FastTags.Parse("allowEAI"))) { return(true); } if (GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving)) { __instance.SetMoveForwardWithModifiers(0f, 0f, false); if (__instance.aiManager != null) { __instance.aiManager.UpdateDebugName(); } return(true); } if (__instance.GetAttackTarget() != null) { __instance.SetRevengeTarget(__instance.GetAttackTarget()); } __instance.CheckDespawn(); ___seeCache.ClearIfExpired(); using (ProfilerUsingFactory.Profile("entities.live.ai.manager")) { __instance.aiManager.Update(); } using (ProfilerUsingFactory.Profile("entities.live.ai.getpath")) { PathInfo path = PathFinderThread.Instance.GetPath(__instance.entityId); if (path.path != null) { bool flag = true; flag = __instance.aiManager.CheckPath(path); if (flag) { __instance.navigator.SetPath(path, path.speed); } } __instance.navigator.UpdateNavigation(); } __instance.moveHelper.UpdateMoveHelper(); ___lookHelper.onUpdateLook(); if (__instance.distraction != null && (__instance.distraction.IsDead() || __instance.distraction.IsMarkedForUnload())) { __instance.distraction = null; } if (__instance.pendingDistraction != null && (__instance.pendingDistraction.IsDead() || __instance.pendingDistraction.IsMarkedForUnload())) { __instance.pendingDistraction = null; } return(true); }