Пример #1
0
        public static void GameActionFightSpellCastMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameActionFightSpellCastMessage msg = (GameActionFightSpellCastMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.FightData.SetSpellCasted(msg.sourceId, msg.spellId, msg.destinationCellId);
        }
Пример #2
0
        public static void GameActionFightSpellCastMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            GameActionFightSpellCastMessage msg = (GameActionFightSpellCastMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            if (account.Fight != null)
            {
                BFighter fighter = (BFighter)account.Fight.GetFighter(msg.targetId);
                if (fighter != null && account.Fight.Fighter != null && fighter.Id == account.Fight.Fighter.Id)
                {
                    int spellLevel = -1;
                    BlueSheep.Common.Types.Spell spell = account.Spells.FirstOrDefault(s => s.Id == msg.spellId);
                    if (spell != null)
                    {
                        spellLevel = spell.Level;
                    }
                    if (spellLevel != -1)
                    {
                        DataClass spellData = GameData.GetDataObject(D2oFileEnum.Spells, msg.spellId);
                        if (spellData != null)
                        {
                            uint      spellLevelId   = (uint)((ArrayList)spellData.Fields["spellLevels"])[spellLevel - 1];
                            DataClass spellLevelData = GameData.GetDataObject(D2oFileEnum.SpellLevels, (int)spellLevelId);
                            if (spellLevelData != null)
                            {
                                if ((int)spellLevelData.Fields["minCastInterval"] > 0 && !(account.Fight.LastTurnLaunchBySpell.ContainsKey(msg.spellId)))
                                {
                                    account.Fight.LastTurnLaunchBySpell.Add(msg.spellId, (int)spellLevelData.Fields["minCastInterval"]);
                                }
                                if (account.Fight.TotalLaunchBySpell.ContainsKey(msg.spellId)) //Si on a déjà utilisé ce sort ce tour
                                {
                                    account.Fight.TotalLaunchBySpell[msg.spellId] += 1;
                                }
                                else
                                {
                                    account.Fight.TotalLaunchBySpell.Add(msg.spellId, 1);
                                }
                                if (account.Fight.TotalLaunchByCellBySpell.ContainsKey(msg.spellId))                            //Si on a déjà utilisé ce sort ce tour
                                {
                                    if (account.Fight.TotalLaunchByCellBySpell[msg.spellId].ContainsKey(msg.destinationCellId)) //Si on a déjà utilisé ce sort sur cette case
                                    {
                                        account.Fight.TotalLaunchByCellBySpell[msg.spellId][msg.destinationCellId] += 1;
                                    }
                                    else
                                    {
                                        account.Fight.TotalLaunchByCellBySpell[msg.spellId].Add(msg.destinationCellId, 1);
                                    }
                                }
                                else
                                {
                                    Dictionary <int, int> tempdico = new Dictionary <int, int>();
                                    tempdico.Add(msg.destinationCellId, 1);
                                    account.Fight.TotalLaunchByCellBySpell.Add(msg.spellId, tempdico);
                                }
                            }
                        }
                    }
                }
            }
        }