Ejemplo n.º 1
0
 public static Task HandleMapComplementaryInformationsWithCoordsMessage(Account account, MapComplementaryInformationsWithCoordsMessage message)
 => Task.Run(async() => await HandleMapComplementaryInformationsDataMessage(account, message).ConfigureAwait(false));
Ejemplo n.º 2
0
        public static void MapComplementaryInformationsWithCoordsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            MapComplementaryInformationsWithCoordsMessage msg = (MapComplementaryInformationsWithCoordsMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Map.SubAreaId = msg.subAreaId;
            account.Map.Data      = MapsManager.FromId(msg.mapId);
            DataClass subArea     = GameData.GetDataObject(D2oFileEnum.SubAreas, (int)msg.subAreaId);
            string    mapName     = I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Areas, (int)subArea.Fields["areaId"]).Fields["nameId"]);
            string    subAreaName = I18N.GetText((int)subArea.Fields["nameId"]);

            account.ModifBar(5, 0, 0, "[" + msg.worldX + ";" + msg.worldY + "]" + " " + mapName + " (" + subAreaName + ")");
            account.Map.Entities.Clear();
            account.Map.List.Clear();
            account.Enable(true);
            foreach (GameRolePlayActorInformations actor in msg.actors)
            {
                account.Map.Entities.Add(new BlueSheep.Core.Fight.Entity(actor.contextualId, actor.disposition.cellId));
                if (actor is GameRolePlayGroupMonsterInformations)
                {
                    GameRolePlayGroupMonsterInformations a = (GameRolePlayGroupMonsterInformations)actor;
                    account.Map.List.Add(new MonsterGroup(a.staticInfos, a.disposition.cellId, a.contextualId));
                }
            }
            account.Map.StatedElements.Clear();
            foreach (var statedElementDofus in msg.statedElements)
            {
                if (!(account.Map.StatedElements.ContainsKey(statedElementDofus.elementId)))
                {
                    account.Map.StatedElements.Add(statedElementDofus.elementId, new BlueSheep.Core.Map.Elements.StatedElement((uint)statedElementDofus.elementCellId, (uint)statedElementDofus.elementId, (uint)statedElementDofus.elementState));
                }
            }
            account.Map.InteractiveElements.Clear();
            account.Map.Doors.Clear();
            foreach (var element in msg.interactiveElements)
            {
                account.Map.InteractiveElements.Add(element.elementId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills)));
                InteractiveElement interactiveElement = element;
                List <int>         listDoorSkillId    = new List <int>(new[] { 184, 183, 187, 198, 114 });
                List <int>         listDoorTypeId     = new List <int>(new[] { -1, 128, 168, 16 });
                if (listDoorTypeId.Contains(interactiveElement.elementTypeId) && (interactiveElement.enabledSkills.Length > 0) && (listDoorSkillId.Contains(interactiveElement.enabledSkills[0].skillId)))
                {
                    foreach (var layer in ((BlueSheep.Data.D2p.Map)account.Map.Data).Layers)
                    {
                        foreach (var cell in layer.Cells)
                        {
                            foreach (var layerElement in cell.Elements)
                            {
                                if (layerElement is GraphicalElement)
                                {
                                    GraphicalElement graphicalElement = (GraphicalElement)layerElement;
                                    if ((graphicalElement.Identifier == interactiveElement.elementId) && !(account.Map.Doors.ContainsKey(cell.CellId)))
                                    {
                                        account.Map.Doors.Add(cell.CellId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills)));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            account.Npc.Npcs.Clear();
            foreach (GameRolePlayActorInformations a in msg.actors)
            {
                if (a is GameRolePlayNpcInformations)
                {
                    account.Npc.Npcs.Add(a.contextualId, ((GameRolePlayNpcInformations)a).npcId);
                }
            }
            if (account.Path != null)
            {
                if (account.Path.Current_Flag == "<Fight>" && account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString())
                {
                    if (account.Fight.SearchFight() == false)
                    {
                        account.Path.PerformActionsStack();
                    }
                }
                else if (account.Path != null & account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString())
                {
                    account.Path.PerformActionsStack();
                }
                else if (account.Path != null & account.Path.Current_Map != account.Map.X.ToString() + "," + account.Map.Y.ToString() || account.Map.Id != account.Map.LastMapId)
                {
                    //account.Path.Stop = false;
                    account.Path.Start();
                }
            }
        }
Ejemplo n.º 3
0
 private void HandleMapComplementaryInformationsWithCoordsMessage(IAccount account,
                                                                  MapComplementaryInformationsWithCoordsMessage message)
 {
     HandleMapComplementaryInformationsDataMessage(account, message);
 }
 private void HandleMapComplementaryInformationsWithCoordsMessage(MapComplementaryInformationsWithCoordsMessage message, ConnectedHost source)
 {
     HandleMapComplementaryInformationsDataMessage(message, source);
 }