コード例 #1
0
ファイル: CharacterHandler.cs プロジェクト: Sadikk/BlueSheep
        public static void CharacterExperienceGainMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharacterExperienceGainMessage msg = (CharacterExperienceGainMessage)message;
            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Log(new ActionTextInformation("Experience gagnée : + " + msg.experienceCharacter + " points d'expérience"), 4);
            account.CharacterStats.experience += msg.experienceCharacter;
            double i = account.CharacterStats.experience - account.CharacterStats.experienceLevelFloor;
            double j = account.CharacterStats.experienceNextLevelFloor - account.CharacterStats.experienceLevelFloor;
            try
            {
                int xppercent = (int)((i / j) * 100);
            }
            catch (Exception ex)
            {

            }
            account.ModifBar(1, (int)account.CharacterStats.experienceNextLevelFloor - (int)account.CharacterStats.experienceLevelFloor, (int)account.CharacterStats.experience - (int)account.CharacterStats.experienceLevelFloor, "Experience");
            if (account.Fight != null)
            {
                account.FightData.xpWon[DateTime.Today] += (int)msg.experienceCharacter;
            }
        }
コード例 #2
0
ファイル: NpcHandler.cs プロジェクト: DjTrilogic/BlueSheep
        public static void NpcDialogCreationMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            LeaveDialogMessage msg = (LeaveDialogMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.ModifBar(6, 0, 0, "Connecté");
        }
コード例 #3
0
ファイル: NpcHandler.cs プロジェクト: DjTrilogic/BlueSheep
        public static void GameContextRemoveElementMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            ExchangeStartOkNpcShopMessage msg = (ExchangeStartOkNpcShopMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.ModifBar(6, 0, 0, "Echange");
        }
コード例 #4
0
 public static void CharacterLevelUpMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     CharacterLevelUpMessage msg = (CharacterLevelUpMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.ModifBar(8, 0, 0, Convert.ToString(msg.newLevel));
     account.Log(new BotTextInformation("Level up ! New level : " + Convert.ToString(msg.newLevel)), 3);
 }
コード例 #5
0
ファイル: NpcHandler.cs プロジェクト: DjTrilogic/BlueSheep
        public static void LeaveDialogMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            NpcDialogCreationMessage msg = (NpcDialogCreationMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Npc.Id = msg.npcId;
            account.Npc.Entity = account.Map.Entities.FirstOrDefault((npc) => npc.Id == msg.npcId);
            account.ModifBar(6, 0, 0, "Dialogue");
        }
コード例 #6
0
ファイル: FightHandler.cs プロジェクト: DjTrilogic/BlueSheep
 public static void GameFightPlacementPossiblePositionsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameFightPlacementPossiblePositionsMessage msg = (GameFightPlacementPossiblePositionsMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.ModifBar(6, 0, 0, "Combat");
     account.Fight.PlacementCells = msg.positionsForChallengers.ToList();
     account.Fight.TurnId = 0;
     if (account.Fight.m_Conf.Tactic != BlueSheep.Core.Fight.TacticEnum.Immobile)
         account.Fight.PlaceCharacter();
     //account.Fight.PerformAutoTimeoutFight(3000);
     //if (account.IsMITM)
     // account.Fight.PerformAutoTimeoutFight(3000);
     if (account.WithItemSetBox.Checked == true)
     {
         sbyte id = (sbyte)account.PresetStartUpD.Value;
         InventoryPresetUseMessage msg2 = new InventoryPresetUseMessage((sbyte)(id - 1));
         account.SocketManager.Send(msg2);
         account.Log(new ActionTextInformation("Equipement rapide numero " + Convert.ToString(id)), 5);
         account.Fight.PerformAutoTimeoutFight(500);
     }
     //LaunchWatch()
     GameFightReadyMessage nmsg = new GameFightReadyMessage(true);
     account.SocketManager.Send(nmsg);
     account.Log(new BotTextInformation("Send Ready !"), 5);
 }
コード例 #7
0
ファイル: FightHandler.cs プロジェクト: DjTrilogic/BlueSheep
 public static void GameEntitiesDispositionMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameEntitiesDispositionMessage msg = (GameEntitiesDispositionMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     if (account.Fight != null)
     {
         msg.dispositions.ToList().ForEach(d =>
         {
             var fighter = account.Fight.GetFighter(d.id);
             if (fighter != null)
                 ((BFighter)fighter).CellId = d.cellId;
         });
     }
     account.ModifBar(6, 0, 0, "Combat");
 }
コード例 #8
0
ファイル: ConnectionHandler.cs プロジェクト: Sadikk/BlueSheep
 public static void IdentificationSuccessMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     IdentificationSuccessMessage msg = (IdentificationSuccessMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
     dtDateTime = dtDateTime.AddMilliseconds(msg.subscriptionEndDate).ToLocalTime();
     DateTime subscriptionDate = dtDateTime;
     if (subscriptionDate > DateTime.Now)
         account.ModifBar(9, 0, 0, subscriptionDate.Date.ToShortDateString());
     account.Log(new ConnectionTextInformation("Identification réussie."), 0);
 }
コード例 #9
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.StatusLb.Text != "Combat" || account.StatusLb.Text == "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.StatusLb.Text != "Combat" && account.StatusLb.Text != "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.ParsePath();
                }
            }
        }
コード例 #10
0
        public static void GameMapMovementConfirmMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameMapMovementConfirmMessage msg = (GameMapMovementConfirmMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
               BlueSheep.Core.Fight.Entity Character = null;
            foreach (BlueSheep.Core.Fight.Entity e in account.Map.Entities)
            {
                if (e.Id == account.CharacterBaseInformations.id)
                    Character = e;
            }
            int mapChangeData = ((BlueSheep.Data.D2p.Map)account.Map.Data).Cells[Character.CellId].MapChangeData;
                if (mapChangeData != 0)
                {
                    int neighbourId = 0;
                    if (neighbourId == -2)
                    {
                        if ((mapChangeData & 64) > 0)
                            neighbourId = ((BlueSheep.Data.D2p.Map)account.Map.Data).TopNeighbourId;
                        if ((mapChangeData & 16) > 0)
                            neighbourId = ((BlueSheep.Data.D2p.Map)account.Map.Data).LeftNeighbourId;
                        if ((mapChangeData & 4) > 0)
                            neighbourId = ((BlueSheep.Data.D2p.Map)account.Map.Data).BottomNeighbourId;
                        if ((mapChangeData & 1) > 0)
                            neighbourId = ((BlueSheep.Data.D2p.Map)account.Map.Data).RightNeighbourId;
                    }
                    if (neighbourId >= 0)
                        account.Map.LaunchChangeMap(neighbourId);
                }
                account.ModifBar(6, 0, 0, "Connecté");
        }
コード例 #11
0
ファイル: CharacterHandler.cs プロジェクト: Sadikk/BlueSheep
        public static void CharacterSelectedSuccessMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharacterSelectedSuccessMessage characterSelectedSuccessMessage = (CharacterSelectedSuccessMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                characterSelectedSuccessMessage.Deserialize(reader);
            }

            account.CharacterBaseInformations = characterSelectedSuccessMessage.infos;

            account.Log(new BotTextInformation(account.CharacterBaseInformations.name + " de niveau "+ account.CharacterBaseInformations.level + " est connecté."),1);
            account.ModifBar(7,0,0, account.AccountName + " - " + account.CharacterBaseInformations.name);
            account.ModifBar(8, 0, 0, Convert.ToString(account.CharacterBaseInformations.level));

            //MainForm.ActualMainForm.ActualizeAccountInformations();
        }
コード例 #12
0
ファイル: CharacterHandler.cs プロジェクト: Sadikk/BlueSheep
        public static void CharacterStatsListMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharacterStatsListMessage msg = (CharacterStatsListMessage)message;
            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (!account.ConfigManager.Restored)
                account.ConfigManager.RecoverConfig();
            account.CharacterStats = msg.stats;
            account.CaracUC.Init();
            if (account.MyGroup != null)
                ((GroupForm)account.ParentForm).AddMember(account.CharacterBaseInformations.name);
            int percent = (msg.stats.lifePoints / msg.stats.maxLifePoints) * 100;
            string text = msg.stats.lifePoints + "/" + msg.stats.maxLifePoints + "(" + percent + "%)";
            account.ModifBar(2, (int)msg.stats.maxLifePoints, (int)msg.stats.lifePoints, "Vitalité");
            double i = msg.stats.experience - msg.stats.experienceLevelFloor;
            double j = msg.stats.experienceNextLevelFloor - msg.stats.experienceLevelFloor;
            try
            {
                int xppercent = (int)(Math.Round(i / j,2) * 100);
            }
            catch (Exception ex)
            {

            }
            account.ModifBar(1, (int)msg.stats.experienceNextLevelFloor - (int)msg.stats.experienceLevelFloor, (int)msg.stats.experience - (int)msg.stats.experienceLevelFloor, "Experience");
            account.ModifBar(4, 0, 0, msg.stats.kamas.ToString());
        }
コード例 #13
0
ファイル: InventoryHandler.cs プロジェクト: Sadikk/BlueSheep
 public static void InventoryWeightMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     InventoryWeightMessage msg = (InventoryWeightMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     int Percent = ((msg.weight / msg.weightMax) * 100);
     string text = Convert.ToString(msg.weight) + "/" + Convert.ToString(msg.weightMax) + "(" + Percent + "% )";
     int w = Convert.ToInt32(msg.weight);
     int wmax = Convert.ToInt32(msg.weightMax);
     account.ModifBar(3, wmax, w, "Pods");
     account.Pods = new Pods(msg.weight, msg.weightMax);
     account.Inventory.weight = msg.weight;
     account.Inventory.maxWeight = msg.weightMax;
 }
コード例 #14
0
ファイル: FightHandler.cs プロジェクト: DjTrilogic/BlueSheep
 public static void LifePointsRegenBeginMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     LifePointsRegenBeginMessage msg = (LifePointsRegenBeginMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     if (account.Fight != null && account.StatusLb.Text == "Combat" || account.StatusLb.Text == "Fighting")
     {
         account.Fight.watch.Stop();
         account.Fight.WaitForReady = false;
         account.Fight.IsFighterTurn = false;
         account.Fight.IsFightStarted = false;
         account.Log(new ActionTextInformation("Combat fini ! (" + account.Fight.watch.Elapsed.Minutes + " min, " + account.Fight.watch.Elapsed.Seconds + " sec)"), 0);
         account.Fight.watch.Reset();
         account.Fight.PerformAutoTimeoutFight(2000);
         if (account.WithItemSetBox.Checked == true)
         {
             sbyte id = (sbyte)account.PresetEndUpD.Value;
             InventoryPresetUseMessage msg2 = new InventoryPresetUseMessage((sbyte)(id - 1));
             account.SocketManager.Send(msg2);
             account.Log(new ActionTextInformation("Equipement rapide numero " + Convert.ToString(id)), 5);
         }
         account.Fight.PerformAutoTimeoutFight(2000);
         account.Fight.PulseRegen();
         account.ModifBar(6, 0, 0, "Connecté");
     }
     //account.Path.Stop = false;
 }
コード例 #15
0
        public static void DisplayNumericalValueMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            DisplayNumericalValuePaddockMessage msg = (DisplayNumericalValuePaddockMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }

            if ((int)msg.type == 1 && msg.rideId == account.CharacterBaseInformations.id)
            {
                if (account.Gather.resourceName == "Unknown")
                    return;
                account.ModifBar(6, 0, 0, "Connecté");
                account.Log(new ActionTextInformation("Ressource récoltée : " + account.Gather.resourceName + " +" + msg.value), 3);
                if (account.Gather.Stats.ContainsKey(account.Gather.resourceName))
                    account.Gather.Stats[account.Gather.resourceName] += msg.value;
                else
                    account.Gather.Stats.Add(account.Gather.resourceName, msg.value);
                account.Gather.Current_Job.ActualizeStats(account.Gather.Stats);
                if (account.PerformGather() == false && account.Path != null)
                    account.Path.PerformActionsStack();
            }
        }
コード例 #16
0
ファイル: FightHandler.cs プロジェクト: DjTrilogic/BlueSheep
 public static void LifePointsRegenEndMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     LifePointsRegenEndMessage msg = (LifePointsRegenEndMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     int percent = (msg.lifePoints / msg.maxLifePoints) * 100;
     account.Log(new BotTextInformation("Fin de la régénération. + " + msg.lifePointsGained + " points de vie"), 2);
     //string text = msg.lifePoints + "/" + msg.maxLifePoints + "(" + percent + "%)";
     account.ModifBar(2, (int)msg.maxLifePoints, (int)msg.lifePoints, "Vitalité");
 }
コード例 #17
0
        public static void CharacterStatsListMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            CharacterStatsListMessage msg = (CharacterStatsListMessage)message;
            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }

            account.CharacterStats = msg.stats;
            int percent = (msg.stats.lifePoints / msg.stats.maxLifePoints) * 100;
            string text = msg.stats.lifePoints + "/" + msg.stats.maxLifePoints + "(" + percent + "%)";
            account.ModifBar(2, (int)msg.stats.maxLifePoints,(int)msg.stats.lifePoints, "Vitalité");
            double i = msg.stats.experience - msg.stats.experienceLevelFloor;
            double j = msg.stats.experienceNextLevelFloor - msg.stats.experienceLevelFloor;
            try
            {
                int xppercent = (int)((i / j) * 100);
            }
            catch (Exception ex)
            {

            }
                account.ModifBar(1, (int)msg.stats.experienceNextLevelFloor - (int)msg.stats.experienceLevelFloor, (int)msg.stats.experience - (int)msg.stats.experienceLevelFloor, "Experience");
            account.ModifBar(4, 0, 0, msg.stats.kamas.ToString());
        }