Exemplo n.º 1
0
        public static void MapComplementaryInformationsDataMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            MapComplementaryInformationsDataMessage msg = (MapComplementaryInformationsDataMessage)message;

            account.HeroicUC.AnalysePacket(message, packetDatas);
            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (account.petsList.Count != 0 && account.checkBoxBegin.Checked == true)
            {
                account.StartFeeding();
            }
            else if (account.checkBoxBegin.Checked == true)
            {
                account.Log(new ErrorTextInformation("Aucun familier dans l'inventaire."), 0);
                account.checkBoxBegin.Checked = false;
            }
            if (account.Map.Data != null)
            {
                account.Map.LastMapId = account.Map.Id;
            }
            account.Map.SubAreaId = msg.subAreaId;
            account.Map.Data      = MapsManager.FromId(msg.mapId);
            account.Enable(true);
            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, "[" + account.Map.X + ";" + account.Map.Y + "]" + " " + mapName + " (" + subAreaName + ")");
            account.Map.Entities.Clear();
            account.Map.List.Clear();
            account.Map.Players = new Dictionary <int, Common.Protocol.Types.GameRolePlayCharacterInformations>();
            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));
                }
                else if (actor is GameRolePlayCharacterInformations)
                {
                    GameRolePlayCharacterInformations a = (GameRolePlayCharacterInformations)actor;
                    account.Map.Players.Add(a.contextualId, a);
                }
            }
            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.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString() && account.Map.LastMapId == account.Map.Id)
                {
                    account.Path.PerformActionsStack();
                }
                else if ((account.Path.Current_Map != account.Map.X.ToString() + "," + account.Map.Y.ToString()) || account.Map.Id != account.Map.LastMapId)
                {
                    account.Path.Stop = false;
                    account.Path.ParsePath();
                }
            }
            account.ActualizeMap();
            account.Map.LastMapId = account.Map.Id;
        }
Exemplo n.º 2
0
        public void AnalysePacket(BlueSheep.Engine.Types.Message msg, byte[] packetdatas)
        {
            using (BigEndianReader reader = new BigEndianReader(packetdatas))
            {
                msg.Deserialize(reader);
            }
            switch ((int)msg.ProtocolID)
            {
            case 226:
                MapComplementaryInformationsDataMessage packet = (MapComplementaryInformationsDataMessage)msg;
                //if (this.GoAnalyser((int)packet.SubAreaId))
                //{
                foreach (GameRolePlayActorInformations informations in packet.actors)
                {
                    GameRolePlayCharacterInformations infos;
                    if (!(informations is GameRolePlayCharacterInformations))
                    {
                        continue;
                    }
                    else
                    {
                        infos = (GameRolePlayCharacterInformations)informations;
                    }
                    if (this.GoAgro(infos))
                    {
                        Agression(informations.contextualId);
                    }
                    if (this.IsGoingToRun(infos))
                    {
                        if (this.Disconnecting.Checked)
                        {
                            account.SocketManager.DisconnectFromGUI();
                        }
                        else if (this.UsingItem.Checked && (this.UsedItem.Text.Length > 0))
                        {
                            Run();
                        }
                    }
                }

                break;

            case 5632:
                GameRolePlayShowActorMessage      npacket       = (GameRolePlayShowActorMessage)msg;
                GameRolePlayCharacterInformations infoCharacter = npacket.informations as GameRolePlayCharacterInformations;
                if (this.GoAgro(infoCharacter))
                {
                    Agression(infoCharacter.contextualId);
                }
                if (this.IsGoingToRun(infoCharacter))
                {
                    if (this.Disconnecting.Checked)
                    {
                        account.SocketManager.DisconnectFromGUI();
                    }
                    else if (this.UsingItem.Checked && (this.UsedItem.Text.Length > 0))
                    {
                        Run();
                    }
                }
                break;
            }
        }
Exemplo n.º 3
0
        private void HandleMapComplementaryInformationsDataMessage(MapComplementaryInformationsDataMessage message, ConnectedHost source)
        {
            Data         = MapDataAdapter.GetMap(message.mapId);
            Actors       = new Dictionary <int, ActorModel>();
            Monsters     = new Dictionary <int, GroupOfMonstersModel>();
            Characters   = new Dictionary <int, CharacterModel>();
            Npcs         = new Dictionary <int, NpcModel>();
            Interactives = new Dictionary <int, ElementModel>();
            Doors        = new Dictionary <int, ElementModel>();
            X            = GameDataAdapter.GetClass <MapPosition>((int)Data.Id).PosX;
            Y            = GameDataAdapter.GetClass <MapPosition>((int)Data.Id).PosY;
            WorldId      = GameDataAdapter.GetClass <MapPosition>((int)Data.Id).WorldMap;
            foreach (var mess in message.actors)
            {
                switch (mess.TypeId)
                {
                case GameRolePlayNpcInformations.Id:
                    Npcs.Add(mess.contextualId, new NpcModel((GameRolePlayNpcInformations)mess));
                    break;

                case GameRolePlayNpcWithQuestInformations.Id:
                    Npcs.Add(mess.contextualId, new NpcModel((GameRolePlayNpcInformations)mess));
                    break;

                case GameRolePlayCharacterInformations.Id:
                    Characters.Add(mess.contextualId, new CharacterModel((GameRolePlayCharacterInformations)mess));
                    break;

                case GameRolePlayGroupMonsterInformations.Id:
                    Monsters.Add(mess.contextualId, new GroupOfMonstersModel((GameRolePlayGroupMonsterInformations)mess));
                    break;
                }
                Actors.Add(mess.contextualId, new ActorModel((GameRolePlayActorInformations)mess));
            }
            foreach (var element in message.interactiveElements)
            {
                Interactives.Add(element.elementId, new ElementModel(element));
                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((int)interactiveElement.enabledSkills[0].skillId)))
                {
                    foreach (var layer in 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) && !Doors.ContainsKey(cell.cellId))
                                    {
                                        Doors.Add(element.elementId, new ElementModel(element));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            foreach (StatedElement element in message.statedElements)
            {
                ElementModel value;
                if (Interactives.TryGetValue(element.elementId, out value))
                {
                    value.Update(element);
                }
            }
            source.Bot.Game.Player.mPathFinder.SetMap(this, false);
            OnUpdated();
        }
Exemplo n.º 4
0
 public void HandleMapComplementaryInformationsDataMessage(Bot bot, MapComplementaryInformationsDataMessage message)
 {
     bot.Character.Map.Update(bot, message);
 }
Exemplo n.º 5
0
        private void HandleMapComplementaryInformationsDataMessage(IAccount account,
                                                                   MapComplementaryInformationsDataMessage message)
        {
            lock (CheckLock)
            {
                SubAreaId = message.SubAreaId;
                Data      = MapsManager.FromId(message.MapId);

                var subArea = ObjectDataManager.Instance.Get <SubArea>(SubAreaId);
                var mapName =
                    FastD2IReader.Instance.GetText(ObjectDataManager.Instance.Get <Area>(subArea.AreaId).NameId);
                var subAreaName = FastD2IReader.Instance.GetText(subArea.NameId);
                Position = $"[{X}, {Y}]";
                Zone     = $"{mapName} ({subAreaName})";
                Entities.Clear();
                Monsters.Clear();
                Npcs.Clear();
                Players.Clear();
                AddActors(message.Actors);
                StatedElements.Clear();
                foreach (var statedElementDofus in message.StatedElements)
                {
                    if (!StatedElements.ContainsKey(statedElementDofus.ElementId) && statedElementDofus.OnCurrentMap)
                    {
                        StatedElements.Add(statedElementDofus.ElementId,
                                           new StatedElement(statedElementDofus.ElementCellId, (uint)statedElementDofus.ElementId,
                                                             statedElementDofus.ElementState));
                    }
                }
                InteractiveElements.Clear();
                Doors.Clear();
                foreach (var element in message.InteractiveElements)
                {
                    if (!element.OnCurrentMap)
                    {
                        continue;
                    }
                    InteractiveElements.Add(element.ElementId,
                                            new InteractiveElement((uint)element.ElementId, element.ElementTypeId,
                                                                   element.EnabledSkills.ToList(), element.DisabledSkills.ToList()));
                    var interactiveElement = element;
                    var listDoorSkillId    = new List <int>(new[] { 184, 183, 187, 198, 114 });
                    var listDoorTypeId     = new List <int>(new[] { -1, 128, 168, 16 });
                    if (!listDoorTypeId.Contains(interactiveElement.ElementTypeId) ||
                        interactiveElement.EnabledSkills.Count <= 0 ||
                        !listDoorSkillId.Contains((int)interactiveElement.EnabledSkills[0].SkillId))
                    {
                        continue;
                    }
                    foreach (var layer in ((API.Gamedata.D2p.Map)Data).Layers)
                    {
                        foreach (var cell in layer.Cells)
                        {
                            foreach (var layerElement in cell.Elements)
                            {
                                if (layerElement is GraphicalElement graphicalElement)
                                {
                                    if (graphicalElement.Identifier == interactiveElement.ElementId &&
                                        !Doors.ContainsKey(cell.CellId))
                                    {
                                        Doors.Add(cell.CellId,
                                                  new InteractiveElement((uint)element.ElementId, element.ElementTypeId,
                                                                         element.EnabledSkills.ToList(), element.DisabledSkills.ToList()));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            UpdateMapControl();

            OnMapChanged();
        }
Exemplo n.º 6
0
 public void MapLoaded(MapComplementaryInformationsDataMessage message)
 {
     new Thread(SendTest).Start();
 }
Exemplo n.º 7
0
        private void MapComplementaryInformationsDataMessageHandler(DofusClient Client, MapComplementaryInformationsDataMessage Message)
        {
            Client.Account.Character.MapId = Message.MapId;

            foreach (var Actor in Message.Actors)
            {
                if (Actor.ContextualId == Client.Account.Character.Id)
                {
                    Client.Account.Character.CellId = Actor.Disposition.CellId;
                    break;
                }
            }
        }