Exemplo n.º 1
0
        public static Actor Apply(Actor spellCaster, mysql.summon summon, mysql.spells spell_Template, Actor.effects effect)
        {
            // si la classe PlayerInfo est modifié comme l'ajout d'un nouveau champ, il faut ajouter son attribution ici
            Actor pi = new Actor();

            pi.blocage           = MnemonicStatsDispatcher.Int_Apply(summon.blocage, spellCaster.blocage);
            pi.cd                = MnemonicStatsDispatcher.Int_Apply(summon.cd, spellCaster.cd);
            pi.BuffsList         = new List <Actor.Buff>();
            pi.maxHealth         = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.currentHealth     = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.currentPc         = MnemonicStatsDispatcher.Int_Apply(summon.pc, spellCaster.originalPc);
            pi.currentPm         = MnemonicStatsDispatcher.Int_Apply(summon.pm, spellCaster.originalPm);
            pi.classeName        = spellCaster.classeName;
            pi.domDotonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domDotonFix, spellCaster.domDotonFix);
            pi.domFix            = MnemonicStatsDispatcher.Int_Apply(summon.domFix, spellCaster.domFix);
            pi.domFutonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domFutonFix, spellCaster.domFutonFix);
            pi.domKatonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domKatonFix, spellCaster.domKatonFix);
            pi.domRaitonFix      = MnemonicStatsDispatcher.Int_Apply(summon.domRaitonFix, spellCaster.domRaitonFix);
            pi.domSuitonFix      = MnemonicStatsDispatcher.Int_Apply(summon.domSuitonFix, spellCaster.domSuitonFix);
            pi.doton             = MnemonicStatsDispatcher.Int_Apply(summon.doton, spellCaster.doton);
            pi.dodgeCD           = MnemonicStatsDispatcher.Int_Apply(summon.dodgeCD, spellCaster.dodgeCD);
            pi.dodgePC           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePC, spellCaster.dodgePC);
            pi.dodgePE           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePE, spellCaster.dodgePE);
            pi.dodgePM           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePM, spellCaster.dodgePM);
            pi.escape            = MnemonicStatsDispatcher.Int_Apply(summon.escape, spellCaster.escape);
            pi.futon             = MnemonicStatsDispatcher.Int_Apply(summon.futon, spellCaster.futon);
            pi.idBattle          = spellCaster.idBattle;
            pi.summons           = MnemonicStatsDispatcher.Int_Apply(summon.summons, spellCaster.summons);
            pi.katon             = MnemonicStatsDispatcher.Int_Apply(summon.katon, spellCaster.katon);
            pi.level             = spell_Template.level;
            pi.maskColorString   = MnemonicStatsDispatcher.Str_Apply(summon.MaskColors, spellCaster.maskColorString);
            pi.map               = spellCaster.map;
            pi.directionLook     = 0;
            pi.originalPc        = MnemonicStatsDispatcher.Int_Apply(summon.pc, spellCaster.originalPc);
            pi.originalPm        = MnemonicStatsDispatcher.Int_Apply(summon.pm, spellCaster.originalPm);
            pi.owner             = spellCaster.Pseudo;
            pi.pe                = MnemonicStatsDispatcher.Int_Apply(summon.pe, spellCaster.pe);
            pi.Pseudo            = MnemonicStatsDispatcher.Str_Apply(summon.name, spellCaster.Pseudo);;
            pi.raiton            = MnemonicStatsDispatcher.Int_Apply(summon.raiton, spellCaster.raiton);
            pi.resiDotonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiDotonFix, spellCaster.resiDotonFix);
            pi.resiDotonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiDotonPercent, spellCaster.resiDotonPercent);
            pi.resiFix           = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.resiFutonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiFutonFix, spellCaster.resiFutonFix);
            pi.resiFutonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.resiKatonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiKatonFix, spellCaster.resiKatonFix);
            pi.resiKatonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiKatonPercent, spellCaster.resiKatonPercent);
            pi.resiRaitonFix     = MnemonicStatsDispatcher.Int_Apply(summon.resiRaitonFix, spellCaster.resiRaitonFix);
            pi.resiRaitonPercent = MnemonicStatsDispatcher.Int_Apply(summon.resiRaitonPercent, spellCaster.resiRaitonPercent);
            pi.resiSuitonFix     = MnemonicStatsDispatcher.Int_Apply(summon.resiSuitonFix, spellCaster.resiSuitonFix);
            pi.resiSuitonPercent = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.removeCD          = MnemonicStatsDispatcher.Int_Apply(summon.retraitCD, spellCaster.removeCD);
            pi.removePC          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPC, spellCaster.removePC);
            pi.removePE          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPE, spellCaster.removePE);
            pi.removePM          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPM, spellCaster.removePM);
            pi.sexe              = spellCaster.sexe;

            for (int cnt = 0; cnt < summon.sorts.Split('/').Length; cnt++)
            {
                string tmp_data = summon.sorts.Split('/')[cnt];
                Actor.SpellsInformations _info_sorts = new Actor.SpellsInformations();
                _info_sorts.SpellId    = Convert.ToInt32(tmp_data.Split(':')[0]);
                _info_sorts.SpellPlace = Convert.ToInt32(tmp_data.Split(':')[1]);
                _info_sorts.Level      = Convert.ToInt32(tmp_data.Split(':')[2]);
                _info_sorts.SpellColor = Convert.ToInt32(tmp_data.Split(':')[3]);
                _info_sorts.effect     = Cryptography.crypted_data.effects_decoder(_info_sorts.SpellId, _info_sorts.Level);
                pi.sorts.Add(_info_sorts);
            }

            pi.species   = Species.Name.Summon;
            pi.suiton    = MnemonicStatsDispatcher.Int_Apply(summon.suiton, spellCaster.suiton);
            pi.maxHealth = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.teamSide  = spellCaster.teamSide;
            int.TryParse(effect.flag2, out pi.summonID);
            pi.visible = true;

            return(pi);
        }
Exemplo n.º 2
0
        public static string Apply(object[] parameters)
        {
            // flag1 = id des states qui se trouve dans la table summon
            // flag2 = idForSummon

            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);
            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            Lidgren.Network.NetConnection nim = MainClass.netServer.Connections.Find(f => (f.Tag as Actor).Pseudo == spellCaster.Pseudo);

            // check si le joueur a assez de point d'invocation, pour cela, on dois calculer combiens d'invoc il a déja invoqué
            int sumOfInvoc = _battle.AllPlayersByOrder.FindAll(f => f.Pseudo.IndexOf(spellCaster.Pseudo + "$") != -1).Count;

            if (spellCaster.summons <= sumOfInvoc)
            {
                // pas assez de point d'invocation
                CommonCode.SendMessage("cmd•spellNotEnoughInvoc", nim, true);
                Console.WriteLine("<--cmd•spellNotEnoughInvoc to " + spellCaster.Pseudo);
                return("");
            }

            int isAllowedSpellArea = Fight.spellsChecker.isAllowedSpellArea(spell_Template.pe, spellCaster.map_position, spellCaster, _battle, spellPos, 0, false, true);

            if (isAllowedSpellArea == 0)
            {
                // spell autorisé
            }
            else if (isAllowedSpellArea == 1)
            {
                // spell non autorisé, case obstacle
                CommonCode.SendMessage("cmd•spellTileNotAllowed", nim, true);
                Console.WriteLine("<--cmd•spellTileNotAllowed to " + spellCaster.Pseudo);
                return("");
            }
            else if (isAllowedSpellArea == 2)
            {
                // spell non autorisé, pas de porté
                CommonCode.SendMessage("cmd•spellPointNotEnoughPe", nim, true);
                return("");
            }
            else if (isAllowedSpellArea == -1)
            {
                // impossible de determiner la direction, normalement ca deverai le deviner
                return("");
            }

            // creation d'un clone
            mysql.summon _summon = (DataBase.DataTables.summon as List <mysql.summon>).Find(f => f.template_id == Convert.ToInt32(effect.flag1));
            Actor        __clone_jutsu_naruto = Summon.StatsDispatcher.Apply(spellCaster, _summon, spell_Template, effect);

            // creation d'un id aleatoire pour l'invocation
            string rndStr = "";

            // check si le nom de l'invoc est déja dans la liste des joueurs pour eviter un doublons
            while (true)
            {
                rndStr = CommonCode.ReturnRandomId();
                if (!_battle.AllPlayersByOrder.Exists(f => f.Pseudo == __clone_jutsu_naruto.Pseudo + "$" + rndStr))
                {
                    break;
                }
            }

            __clone_jutsu_naruto.Pseudo       = __clone_jutsu_naruto.Pseudo + "$" + rndStr; // separateur entre le nom et le id de l'invocation
            __clone_jutsu_naruto.map_position = spellPos;


            // insert dans la liste
            int index = _battle.AllPlayersByOrder.FindIndex(f => f.Pseudo == spellCaster.Pseudo);

            _battle.AllPlayersByOrder.Insert(index + 1, __clone_jutsu_naruto);

            string buffer = "";

            // conversion des rawdata sort en base64
            string encryptedSpellsRaw = Cryptography.Algo.Encoding.Base64Encode(_summon.sorts);

            //rawData = "typeRox:addInvoc|name:x|cd:x|totalPdv:x";
            string piRaw = __clone_jutsu_naruto.Pseudo + ":" + __clone_jutsu_naruto.classeName + ":" + __clone_jutsu_naruto.spirit + ":" + __clone_jutsu_naruto.spiritLvl.ToString() + ":" + __clone_jutsu_naruto.Pvp.ToString() + ":" + __clone_jutsu_naruto.hiddenVillage + ":" + __clone_jutsu_naruto.maskColorString + ":" + __clone_jutsu_naruto.directionLook.ToString() + ":" + __clone_jutsu_naruto.level.ToString() + ":" + __clone_jutsu_naruto.map + ":" + __clone_jutsu_naruto.officialRang.ToString() + ":" + __clone_jutsu_naruto.currentHealth.ToString() + ":" + __clone_jutsu_naruto.maxHealth.ToString() + ":" + __clone_jutsu_naruto.doton.ToString() + ":" + __clone_jutsu_naruto.katon.ToString() + ":" + __clone_jutsu_naruto.futon.ToString() + ":" + __clone_jutsu_naruto.raiton.ToString() + ":" + __clone_jutsu_naruto.suiton.ToString() + ":" + /*MainClass.chakralvl2*/ 0 + ":" + /*MainClass.chakralvl3*/ 0 + ":" + /*MainClass.chakralvl4*/ 0 + ":" + /*MainClass.chakralvl5*/ 0 + ":" + /*MainClass.chakralvl6*/ 0 + ":" + /*pi.usingDoton.ToString()*/ 0 + ":" + /*pi.usingKaton.ToString()*/ 0 + ":" + /*pi.usingFuton.ToString()*/ 0 + ":" + /*pi.usingRaiton.ToString()*/ 0 + ":" + /*pi.usingSuiton.ToString()*/ 0 + ":" + /*pi.dotonEquiped.ToString()*/ 0 + ":" + /*pi.katonEquiped.ToString()*/ 0 + ":" + /*pi.futonEquiped.ToString()*/ 0 + ":" + /*pi.raitonEquiped.ToString()*/ 0 + ":" + /*pi.suitonEquiped.ToString()*/ 0 + ":" + __clone_jutsu_naruto.originalPc.ToString() + ":" + __clone_jutsu_naruto.originalPm.ToString() + ":" + __clone_jutsu_naruto.pe.ToString() + ":" + __clone_jutsu_naruto.cd.ToString() + ":" + __clone_jutsu_naruto.summons.ToString() + ":" + __clone_jutsu_naruto.initiative.ToString() + ":" + __clone_jutsu_naruto.resiDotonPercent.ToString() + ":" + __clone_jutsu_naruto.resiKatonPercent.ToString() + ":" + __clone_jutsu_naruto.resiFutonPercent.ToString() + ":" + __clone_jutsu_naruto.resiRaitonPercent.ToString() + ":" + __clone_jutsu_naruto.resiSuitonPercent.ToString() + ":" + __clone_jutsu_naruto.dodgePC.ToString() + ":" + __clone_jutsu_naruto.dodgePM.ToString() + ":" + __clone_jutsu_naruto.dodgePE.ToString() + ":" + __clone_jutsu_naruto.dodgeCD.ToString() + ":" + __clone_jutsu_naruto.removePC.ToString() + ":" + __clone_jutsu_naruto.removePM.ToString() + ":" + __clone_jutsu_naruto.removePE.ToString() + ":" + __clone_jutsu_naruto.removeCD.ToString() + ":" + __clone_jutsu_naruto.escape.ToString() + ":" + __clone_jutsu_naruto.blocage.ToString() + ":" + encryptedSpellsRaw + ":" + __clone_jutsu_naruto.resiDotonFix + ":" + __clone_jutsu_naruto.resiKatonFix + ":" + __clone_jutsu_naruto.resiFutonFix + ":" + __clone_jutsu_naruto.resiRaitonFix + ":" + __clone_jutsu_naruto.resiSuitonFix + ":" + __clone_jutsu_naruto.resiFix + ":" + __clone_jutsu_naruto.domDotonFix + ":" + __clone_jutsu_naruto.domKatonFix + ":" + __clone_jutsu_naruto.domFutonFix + ":" + __clone_jutsu_naruto.domRaitonFix + ":" + __clone_jutsu_naruto.domSuitonFix + ":" + __clone_jutsu_naruto.domFix + ":" + __clone_jutsu_naruto.power + ":" + __clone_jutsu_naruto.equipedPower;

            buffer = "typeRox:addInvoc|" + piRaw + "|cd:" + cd;

            return(buffer);
        }