Example #1
0
 public PathManager(AccountUC account, string Path, string name)
 {
     Account = account;
     path = Path;
     Account.PathDownBt.Text = name;
     m_content = File.ReadAllLines(Path).ToList();
 }
Example #2
0
        private void listen(TcpClient client, AccountUC account)
        {
            m_Reader = new BigEndianReader(client.GetStream());
                //m_MessageInformations = new MessageInformations(account);

                //while ((client.Client != null) && (client.Client.Connected))
                //{
                //    byte[] buffer = new byte[client.Client.Available];

                //    if (buffer.Length != 0)
                //    {
                //        if (m_TimerInactivity != null)
                //            m_TimerInactivity.Change(60000, Timeout.Infinite);
                //        else
                //            m_TimerInactivity = new Timer(TimerInactivityFinished, null, 60000, Timeout.Infinite);

                //        client.Client.Receive(buffer);

                //        account.LatencyFrame.UpdateLatency();
                //        m_MessageInformations.ParseBuffer(buffer);
                //    }
                //}

                Connected = true;
                Thread task_id = new Thread(computeid);
                task_id.Start();
        }
Example #3
0
        public static void NpcDialogQuestionMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            NpcDialogQuestionMessage msg = (NpcDialogQuestionMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Npc.QuestionId = msg.messageId;
            int mess = (int)GameData.GetDataObject(D2oFileEnum.NpcMessages, account.Npc.QuestionId).Fields["messageId"];
            account.Log(new BotTextInformation("Dialogue : " + BlueSheep.Common.Data.I18N.GetText(mess)), 0);
            if (account.Npc.QuestionId == 318 && (int)msg.visibleReplies[0] == 259)
            {
                //Bank
                account.Npc.SendReply(259);
                return;
            }
            else if (account.Npc.QuestionId == 318)
            {
                account.Log(new ErrorTextInformation("Vous n'ĂȘtes pas level 10, vous ne pouvez pas utiliser la banque. Fermeture du dialogue."), 0);
                account.Npc.CloseDialog();
            }
            if (msg.visibleReplies.Length == 0)
                account.Npc.CloseDialog();
            account.Npc.Replies.Clear();
            account.Npc.Replies = msg.visibleReplies.Select<short, BlueSheep.Core.Npc.NpcReply>((id) => new BlueSheep.Core.Npc.NpcReply(account.MapData.Npcs.Find(n => n.contextualId == account.Npc.Id).npcId, id)).ToList();
            if (account.Path != null)
            {
                account.Path.SearchReplies(BlueSheep.Common.Data.I18N.GetText(mess));
            }
        }
Example #4
0
 public Npc(AccountUC Account)
 {
     account = Account;
     Entity = null;
     Npcs = new Dictionary<int, int>();
     Replies = new List<NpcReply>();
 }
Example #5
0
 public Condition(ConditionEnum condition, object delta, char operateur, AccountUC Account)
 {
     m_Cond = condition;
     m_delta = delta;
     m_operateur = operateur;
     account = Account;
 }
Example #6
0
        public JobUC(AccountUC Account, Job j , List<TreeNode> nodes = null)
        {
            InitializeComponent();
            account = Account;
            job = j;
            TV = new TreeView() { Dock = DockStyle.Fill };
            Load(nodes);
            InitTree();
            sadikTabControl1.TabPages[0].Controls.Add(g);
            sadikTabControl1.TabPages[1].Controls.Add(gg);
            sadikTabControl1.TabPages[2].Controls.Add(TV);
            //sadikTabControl1.TabPages[2].Controls.Add(GatherPie);
            this.Dock = DockStyle.Fill;
            g.Columns.Add("SkillName", "Skills");
            g.Columns.Add("RessourceName", "Ressources");
            g.Columns.Add("RessourceId", "Id");
            g.Columns.Add(new DataGridViewCheckBoxColumn() { Name = "Select",  HeaderText = "A récolter"});
            g.Columns[1].Width = 200;
            g.MultiSelect = false;

            gg.Columns.Add("SkillName", "Skills");
            gg.Columns.Add("RecipeName", "Recettes");
            gg.Columns[1].Width = 200;
            gg.Columns.Add("RecipeId", "Id");
            gg.ReadOnly = true;

            BlueSheep.Engine.Constants.Translate.TranslateUC(this);
        }
Example #7
0
 public BFight(AccountUC account, FightParser AI, FightData data)
 {
     m_Account = account;
     m_AI = AI;
     m_Data = data;
     flag = 1;
 }
Example #8
0
        public static void Test(uint status, AccountUC account)
        {
            switch (status)
            {
                case m_Offline:
                   account.Log(new ConnectionTextInformation("Echec de connexion : serveur déconnecté."),0);
                   account.TryReconnect(600);
                    break;

                case m_Saving:
                    account.Log(new ConnectionTextInformation("Echec de connexion : serveur en sauvegarde."),0);
                    account.TryReconnect(600);
                    break;

                case m_Full:
                    account.Log(new ConnectionTextInformation("Echec de connexion : serveur complet."),0);
                    account.TryReconnect(60);
                    break;

                default:
                    account.Log(new ConnectionTextInformation("Echec de connexion : raison inconnue."),0);
                    account.TryReconnect(30);
                    break;
            }
        }
Example #9
0
        public static void NpcDialogQuestionMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            NpcDialogQuestionMessage msg = (NpcDialogQuestionMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Npc.QuestionId = msg.messageId;
            int mess = (int)GameData.GetDataObject(D2oFileEnum.NpcMessages, account.Npc.QuestionId).Fields["messageId"];
            account.Log(new BotTextInformation("Dialogue : " + BlueSheep.Common.Data.I18N.GetText(mess)), 0);
            if (account.Npc.QuestionId == 318 && (int)msg.visibleReplies[0] == 259)
            {
                //Bank
                account.Npc.SendReply(259);
                return;
            }
            if (msg.visibleReplies.Length == 0)
                account.Npc.CloseDialog();
            account.Npc.Replies.Clear();
            account.Npc.Replies = msg.visibleReplies.Select<short, BlueSheep.Core.Npc.NpcReply>((id) => new BlueSheep.Core.Npc.NpcReply(account.Npc.Npcs[account.Npc.Id], id)).ToList();
            if (account.Path != null)
            {
                account.Path.SearchReplies(BlueSheep.Common.Data.I18N.GetText(mess));
            }
        }
Example #10
0
        public static void ChatServerMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            ChatServerMessage msg = (ChatServerMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            switch ((int)msg.channel)
            {
                case 0:
                    account.Log(new GeneralTextInformation(msg.senderName + ": " + msg.content),1);
                    break;
                case 1:
                    //account.Log(new DofAlertTextInformation("Bienvenue sur DOFUS, dans le Monde des Douze !" + System.Environment.NewLine + "Il est interdit de transmettre votre identifiant ou votre mot de passe."));
                    break;
                case 2:
                    account.Log(new GuildTextInformation(msg.senderName + ": " + msg.content),1);
                    break;
                case 3:
                    account.Log(new AllianceTextInformation(msg.senderName + ": " + msg.content),1);
                    break;
                case 5:
                    account.Log(new CommerceTextInformation(msg.senderName + ": " + msg.content),1);
                    break;
                case 6:
                    account.Log(new RecrutementTextInformation(msg.senderName + ": " + msg.content),1);
                    break;
                case 9:
                    account.Log(new PrivateTextInformation("de " + msg.senderName + " : " + msg.content),1);
                    break;
            }
        }
Example #11
0
        public static void JobExperienceMultiUpdateMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            JobExperienceMultiUpdateMessage msg = (JobExperienceMultiUpdateMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            foreach (JobExperience i in msg.experiencesUpdate)
            {
                foreach (Core.Job.Job j in account.Jobs)
                {
                    if (i.jobId == j.Id)
                    {
                        j.Level = i.jobLevel;
                        j.XP = (int)i.jobXP;
                        j.XpLevelFloor =(int)i.jobXpLevelFloor;
                        j.XpNextLevelFloor = (int)i.jobXpNextLevelFloor;
                        break;
                    }
                }
            }
            account.ActualizeJobs();
            foreach (JobUC j in account.JobsUC)
            {
                j.populateTreeview();
            }
        }
Example #12
0
        public void Init(AccountUC account)
        {
            int skillUID = 0;

            foreach (InteractiveElementSkill skill in account.Safe.enabledSkills)
            {
                if (skill.skillId == 104)
                {
                    skillUID = skill.skillInstanceUid;

                    break;
                }
            }

            InteractiveUseRequestMessage interactiveUseRequestMessage = new InteractiveUseRequestMessage(
                account.Safe.elementId,
                skillUID);

            using (BigEndianWriter writer = new BigEndianWriter())
            {
                interactiveUseRequestMessage.Serialize(writer);
                writer.Content = account.HumanCheck.hash_function(writer.Content);
                MessagePackaging messagePackaging = new MessagePackaging(writer);

                messagePackaging.Pack((int)interactiveUseRequestMessage.ProtocolID);

                account.SocketManager.Send(messagePackaging.Writer.Content);
                account.LastPacketID.Clear();
                if (account.DebugMode.Checked)
                    account.Log(new BlueSheep.Interface.Text.DebugTextInformation("[SND] 5001 (InteractiveUseRequestMessage)"), 0);
            }
        }
Example #13
0
        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;
            }
        }
Example #14
0
 public IAChoice(AccountUC account)
 {
     InitializeComponent();
     Account = account;
     switch (MainForm.ActualMainForm.Lang)
     {
         case "EN":
             this.Text = "AI Manager";
             DelBt.Text = "Delete";
             LoadBt.Text = "Load";
             AddBt.Text = "Add";
             FilesList.Columns[0].Text = "Name";
             FilesList.Columns[1].Text = "Author";
             FilesList.Columns[2].Text = "Breed";
             break;
     }
     System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\IAs");
     if (di.GetFiles().Count() == 0)
     {
         System.Windows.Forms.MessageBox.Show("Aucune IA, veuillez en télécharger sur le forum ou créer la vÎtre :) ");
     }
     else
     {
         foreach (System.IO.FileInfo file in di.GetFiles())
         {
             if (file.Extension == ".bs")
                 LoadIA(file);
         }
     }
 }
Example #15
0
 public static void GameActionFightDispellableEffectMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightDispellableEffectMessage msg = (GameActionFightDispellableEffectMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     if (msg.effect is FightTemporaryBoostStateEffect)
     {
         FightTemporaryBoostStateEffect effect = (FightTemporaryBoostStateEffect)msg.effect;
         if (effect.targetId == account.Fight.Fighter.Id)
         {
             if (account.Fight.DurationByEffect.ContainsKey(effect.stateId))
                 account.Fight.DurationByEffect.Remove(effect.stateId);
             account.Fight.DurationByEffect.Add(effect.stateId, effect.turnDuration);
         }
     }
     else if (msg.effect is FightTemporaryBoostEffect)
     {
         FightTemporaryBoostEffect effect = (FightTemporaryBoostEffect)msg.effect;
         if (msg.actionId == 168)
             ((BFighter)account.Fight.Fighter).ActionPoints = account.Fight.Fighter.ActionPoints - effect.delta;
         else if (msg.actionId == 169)
             ((BFighter)account.Fight.Fighter).MovementPoints = account.Fight.Fighter.MovementPoints - effect.delta;
     }
 }
Example #16
0
 public static void GameActionFightPointsVariationMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightPointsVariationMessage msg = (GameActionFightPointsVariationMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     BFighter fighter = (BFighter)account.Fight.GetFighter(msg.targetId);
     if (fighter != null)
     {
         switch (msg.actionId)
         {
             case 101:
             case 102:
             case 120:
                 fighter.ActionPoints = (fighter.ActionPoints + msg.delta);
                 break;
             case 78:
             case 127:
             case 129:
                 fighter.MovementPoints = (fighter.MovementPoints + msg.delta);
                 break;
         }
     }
 }
        public static void Test(int reason, AccountUC account)
        {
            switch (reason)
            {
                case m_WrongCredentials:
                    account.Log(new ErrorTextInformation("Echec de connexion : mauvais identifiants."),0);
                    break;

                case m_Banned:
                    account.Log(new ErrorTextInformation("Echec de connexion : compte banni."), 0);
                    break;

                case m_Kicked:
                    account.Log(new ErrorTextInformation("Echec de connexion : compte banni temporairement."), 0);
                    break;

                case m_InMaintenance:
                    account.Log(new ErrorTextInformation("Echec de connexion : serveur en maintenance."), 0);
                    account.TryReconnect(15);
                    break;

                default:
                    account.Log(new ErrorTextInformation("Echec de connexion : erreur inconnue."), 0);
                    break;
            }
        }
Example #18
0
 public Running(AccountUC accountform)
 {
     account = accountform;
     m_Openning = null;
     m_Leaving = null;
     m_Getting = null;
     m_CurrentPetIndex = 0;
 }
Example #19
0
 public Item(List<ObjectEffect> effects, int gid, int position, int quantity, int uid, AccountUC account)
 {
     this.Effects = effects;
     this.GID = gid;
     this.Position = position;
     this.Quantity = quantity;
     this.UID = uid;
 }
Example #20
0
 public Pet(Core.Inventory.Item informations, DataClass datas, AccountUC uc)
 {
     FoodList = new List<Food>();
     Informations = informations;
     Datas = datas;
     account = uc;
     Set();
 }
Example #21
0
 public static void AuthenticationTicketAcceptedMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     if (!account.IsMITM)
     {
         CharactersListRequestMessage charactersListRequestMessage = new CharactersListRequestMessage();
         account.SocketManager.Send(charactersListRequestMessage);
     }
 }
Example #22
0
 public static void GameActionFightDeathMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightDeathMessage msg = (GameActionFightDeathMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.FightData.SetFighterDeath(msg.targetId);
 }
Example #23
0
        public Inventory(AccountUC account)
        {
            Account = account;

            Items = new List<Item>();
            kamas = 0;
            maxWeight = 0;
            weight = 0;
        }
Example #24
0
 public static void InventoryContentAndPresetMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     InventoryContentAndPresetMessage msg = (InventoryContentAndPresetMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     foreach (ObjectItem item in msg.objects)
     {
         Core.Inventory.Item i = new Core.Inventory.Item(item.Effects.ToList(), item.ObjectGID, item.Position, item.Quantity, item.ObjectUID, account);
         account.Inventory.Items.Add(i);
     }
     account.ActualizeInventory();
     account.petsList = new List<Pet>();
     foreach (Core.Inventory.Item item in account.Inventory.Items)
     {
         DataClass itemData = GameData.GetDataObject(D2oFileEnum.Items, item.GID);
         if ((int)itemData.Fields["typeId"] == 18)
         {
             Pet pet = new Pet(item, itemData, account);
             account.petsList.Add(pet);
             pet.SetFood();
         }
     }
     account.Log(new BotTextInformation("Vos " +
     account.petsList.Count + " familiers vous font un gros bisou de la part de BlueSheep."), 5);
     if (!account.IsMITM)
     {
         FriendsGetListMessage friendGetListMessage = new FriendsGetListMessage();
         account.SocketManager.Send(friendGetListMessage);
         IgnoredGetListMessage ignoredGetListMessage = new IgnoredGetListMessage();
         account.SocketManager.Send(ignoredGetListMessage);
         SpouseGetInformationsMessage spouseGetInformationsMessage = new SpouseGetInformationsMessage();
         account.SocketManager.Send(spouseGetInformationsMessage);
         Random random = new Random();
         const string hexChars = "0123456789ABCDEF";
         string key = string.Empty;
         for (int index = 0; index < 20; index++)
         {
             int randomValue = random.Next(100);
             if (randomValue <= 40)
                 key += (char)(random.Next(26) + 65);
             else if (randomValue <= 80)
                 key += (char)(random.Next(26) + 97);
             else
                 key += (char)(random.Next(10) + 48);
         }
         int pos = key.Sum(t => t % 16);
         key += hexChars[pos % 16];
         ClientKeyMessage clientKeyMessage = new ClientKeyMessage(key);
         account.SocketManager.Send(clientKeyMessage);
         GameContextCreateRequestMessage gameContextCreateRequestMessage = new GameContextCreateRequestMessage();
         account.SocketManager.Send(gameContextCreateRequestMessage);
         ChannelEnablingMessage channelEnablingMessage = new ChannelEnablingMessage((sbyte)7, false);
         account.SocketManager.Send(channelEnablingMessage);
     }
 }
Example #25
0
 public static void HelloGameMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     if (!account.IsMITM)
     {
         AuthenticationTicketMessage authenticationTicketMessage = new AuthenticationTicketMessage(GameConstants.Lang,
         account.Ticket);
         account.SocketManager.Send(authenticationTicketMessage);
     }
 }
Example #26
0
 public LatencyFrame(AccountUC Account)
 {
     m_LatencyBuffer = new List<uint>();
     account = Account;
     //string blah = Str2.Str7(-1820302795);
     //pId = Player id
     //ct = character Ticket
     // hash loader info : 40c2dfcf773f83a6bbe1777b6e3a87f1
 }
Example #27
0
 public static void GameActionFightPointsVariationMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightPointsVariationMessage msg = (GameActionFightPointsVariationMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.FightData.SetPointsVariation(msg.targetId, msg.actionId, msg.delta);
 }
Example #28
0
 public static void GameActionFightLifePointsLostMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightLifePointsLostMessage msg = (GameActionFightLifePointsLostMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.FightData.UpdateFighterLifePoints(msg.targetId, -msg.loss);
 }
Example #29
0
 public Map(AccountUC account)
 {
     m_Account = account;
     Entities = new List<Core.Fight.Entity>();
     InteractiveElements = new Dictionary<int, InteractiveElement>();
     StatedElements = new Dictionary<int, StatedElement>();
     Doors = new Dictionary<int, InteractiveElement>();
     List = new List<BlueSheep.Common.Types.MonsterGroup>();
 }
Example #30
0
 public static void GameActionFightDispellableEffectMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightDispellableEffectMessage msg = (GameActionFightDispellableEffectMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     account.FightData.SetEffect(msg.effect, msg.actionId);
 }