예제 #1
0
파일: ImageJPX.cs 프로젝트: zxc120/GARbro
 public override ImageData Read(IBinaryStream stream, ImageMetaData info)
 {
     using (var bmp = OpenEncrypted(stream))
         return(Bmp.Read(bmp, info));
 }
예제 #2
0
 public void Dispose()
 {
     Bmp.UnlockBits(Lock);
 }
예제 #3
0
 public override ImageData Read(IBinaryStream file, ImageMetaData info)
 {
     using (var bmp = OpenCompressed(file))
         return(Bmp.Read(bmp, info));
 }
예제 #4
0
파일: ImageGTO.cs 프로젝트: ziyuejun/GARbro
 public override ImageData Read(IBinaryStream file, ImageMetaData info)
 {
     using (var input = OpenGtoStream(file))
         return(Bmp.Read(input, info));
 }
예제 #5
0
        public void Fetch(string[] commandStrings)
        {
            #region MapData
            // commandStrings[1] = pseudo#classe#pvp:spirit:spiritLvl#village#MaskColors#map_position#orientation#level#action#waypoint#TotalPdv#CurrentPdv#rang   | separateur entre plusieurs joueurs
            // pvp=0 donc mode pvp off, si pvp = 1 mode pvp on

            string[] playersInfos = commandStrings[1].Split('|');

            foreach (string t in playersInfos)
            {
                string[] states = t.Split('#');

                string actorName = states[0];
                Enums.ActorClass.ClassName className = (Enums.ActorClass.ClassName)Enum.Parse(typeof(Enums.ActorClass.ClassName), states[1]);
                bool pvpEnabled          = states[2].Split(':')[0] == "1";
                Enums.Spirit.Name spirit = (Enums.Spirit.Name)Enum.Parse(typeof(Enums.Spirit.Name), states[2].Split(':')[1]);
                int spiritLevel          = int.Parse(states[2].Split(':')[2]);
                Enums.HiddenVillage.Names hiddenVillage = (Enums.HiddenVillage.Names)Enum.Parse(typeof(Enums.HiddenVillage.Names), states[3]);
                string maskColors  = states[4];
                Point  mapPoint    = new Point(int.Parse(states[5].Split('/')[0]), int.Parse(states[5].Split('/')[1]));
                int    orientation = int.Parse(states[6]);
                int    level       = int.Parse(states[7]);
                Enums.AnimatedActions.Name action = (Enums.AnimatedActions.Name)Enum.Parse(typeof(Enums.AnimatedActions.Name), states[8]);
                string waypoint      = states[9];
                int    maxHealth     = int.Parse(states[10]);
                int    currentHealth = int.Parse(states[11]);

                // cette valeur n'est pas utilisé dans le jeu puisque le rang n'est pas encore affiché, il faut prévoir un truc pour montrer les rang de chaque joueur, ou pas si le rang dois etre caché, ptet que le rang est caché mais permet d'afficher le joueur avec un ora spécial
                Enums.Rang.official officialRang = (Enums.Rang.official)Enum.Parse(typeof(Enums.Rang.official), states[12]);

                // supprimer tout les anciennes instances qui correspond a ce joueur pour eviter un doublons ou une erreur de la part du serveur ou client s'il n'envoie pas la cmd de deconnexion du joeur au abonnés
                if (CommonCode.AllActorsInMap.Count(i => ((Actor)i.tag).pseudo == actorName) > 0)
                {
                    Bmp allPlayers = CommonCode.AllActorsInMap.Find(f => ((Actor)f.tag).pseudo == actorName);
                    allPlayers.visible = false;
                    CommonCode.AllActorsInMap.Remove(allPlayers);
                    CommonCode.AllActorsInMap.RemoveAll(i => ((Actor)i.tag).pseudo == actorName);
                }

                // affichage du personnage + position + orientation
                Bmp ibPlayers = new Bmp(@"gfx\general\classes\" + className + ".dat", Point.Empty, "Player_" + actorName, Manager.TypeGfx.Obj, true, 1, SpriteSheet.GetSpriteSheet(className.ToString(), CommonCode.ConvertToClockWizeOrientation(orientation)));
                ibPlayers.point      = new Point((mapPoint.X * 30) + 15 - (ibPlayers.rectangle.Width / 2), (mapPoint.Y * 30) - (ibPlayers.rectangle.Height) + 15);
                ibPlayers.MouseOver += CommonCode.ibPlayers_MouseOver;
                ibPlayers.MouseOut  += CommonCode.ibPlayers_MouseOut;
                ibPlayers.MouseMove += CommonCode.CursorHand_MouseMove;
                ibPlayers.MouseClic += CommonCode.ibPlayers_MouseClic;
                CommonCode.VerticalSyncZindex(ibPlayers);
                ibPlayers.TypeGfx = Manager.TypeGfx.Obj;
                Manager.manager.GfxObjList.Add(ibPlayers);

                ibPlayers.tag = CommonCode.MyPlayerInfo.instance.pseudo != actorName ? new Actor(actorName, level, !pvpEnabled ? Enums.Spirit.Name.neutral : spirit, className, pvpEnabled, !pvpEnabled ? 0 : spiritLevel, hiddenVillage, maskColors, orientation, action, waypoint) : CommonCode.MyPlayerInfo.instance.ibPlayer.tag;
                Actor actor = (Actor)ibPlayers.tag;
                actor.realPosition = mapPoint;
                actor.officialRang = officialRang;

                // affichage des ailles
                if (actor.pvpEnabled)
                {
                    if (actor.spirit != Enums.Spirit.Name.neutral)
                    {
                        Bmp _spirit = new Bmp(@"gfx\general\obj\2\" + actor.spirit + @"\" + actor.spiritLevel + ".dat", Point.Empty, "spirit_" + ibPlayers.name, Manager.TypeGfx.Obj, false, 1);
                        _spirit.point = new Point((ibPlayers.rectangle.Width / 2) - (_spirit.rectangle.Width / 2), -_spirit.rectangle.Height);
                        ibPlayers.Child.Add(_spirit);

                        Txt lPseudo = new Txt(actor.pseudo, Point.Empty, "lPseudo_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Regular), Brushes.Red);
                        lPseudo.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lPseudo.Text, lPseudo.font).Width / 2) + 5, -_spirit.rectangle.Height - 15);
                        ibPlayers.Child.Add(lPseudo);

                        Txt lLvlSpirit = new Txt(actor.spiritLevel.ToString(), Point.Empty, "lLvlSpirit_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Bold), Brushes.Red);
                        lLvlSpirit.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lLvlSpirit.Text, lLvlSpirit.font).Width / 2) + 2, -_spirit.rectangle.Y - (_spirit.rectangle.Height / 2) - (TextRenderer.MeasureText(lLvlSpirit.Text, lLvlSpirit.font).Height / 2));
                        ibPlayers.Child.Add(lLvlSpirit);

                        Bmp village = new Bmp(@"gfx\general\obj\1\pays_thumbs.dat", Point.Empty, "village_" + actor.hiddenVillage, Manager.TypeGfx.Obj, false, 1, SpriteSheet.GetSpriteSheet("pays_" + actor.hiddenVillage + "_thumbs", 0));
                        village.point = new Point((ibPlayers.rectangle.Width / 2) - (village.rectangle.Width / 2), lPseudo.point.Y - village.rectangle.Height + 2);
                        ibPlayers.Child.Add(village);
                    }
                }
                else
                {
                    Txt lPseudo = new Txt(actor.pseudo, Point.Empty, "lPseudo_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Regular), Brushes.Red);
                    lPseudo.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lPseudo.Text, lPseudo.font).Width / 2) + 5, -15);
                    ibPlayers.Child.Add(lPseudo);

                    Bmp village = new Bmp(@"gfx\general\obj\1\pays_thumbs.dat", Point.Empty, "village_" + actor.hiddenVillage, Manager.TypeGfx.Obj, false, 1, SpriteSheet.GetSpriteSheet("pays_" + actor.hiddenVillage + "_thumbs", 0));
                    village.point = new Point((ibPlayers.rectangle.Width / 2) - (village.rectangle.Width / 2), lPseudo.point.Y - village.rectangle.Height + 2);
                    ibPlayers.Child.Add(village);
                }

                // coloriage du personnage et attachement du maskColor au personnage
                CommonCode.ApplyMaskColorToClasse(ibPlayers);

                // pointeur vers l'image ibplayer de notre joueur s'il s'agit de son personnage
                if (CommonCode.MyPlayerInfo.instance.pseudo == actor.pseudo)
                {
                    CommonCode.MyPlayerInfo.instance.ibPlayer = ibPlayers;
                }

                // ajout du personnage dans la liste des joueurs
                CommonCode.AllActorsInMap.Add(ibPlayers);

                // lancement de l'animation de mouvement si le joueur a un waypoint
                if (actor.wayPoint.Count > 0)
                {
                    //mouvement du personnage
                    // thread a part
                    Thread tAnimAction = new Thread(() => CommonCode.AnimAction(ibPlayers, actor.wayPoint, actor.wayPoint.Count > 5 ? 20 : 50));
                    tAnimAction.Start();
                }

                // affectation des pdv
                actor.maxHealth     = maxHealth;
                actor.currentHealth = currentHealth;
            }
            #endregion
        }
예제 #6
0
        static ImageFormatService()
        {
            imageFormat = new IImageFormat[]
            {
                GetImageFormat("PNG", "png", true, Png.IsValid, Png.Read, (stream, image) => Png.Write(stream, image)),
                GetImageFormat("BMP", "bmp", true, Bmp.IsValid, Bmp.Read, (stream, image) => Bmp.Write(stream, image)),
                GetImageFormat("TIFF", "tiff", true, Tiff.IsValid, Tiff.Read, (stream, image) => Tiff.Write(stream, image)),

                GetImageFormat("FAC", "fac", true, Imgd.IsFac, s => Imgd.ReadAsFac(s), (stream, images) =>
                               Imgd.WriteAsFac(stream, images.Select(x => x.AsImgd()))),

                GetImageFormat("IMGD", "imd", true, Imgd.IsValid, Imgd.Read, (stream, image) => image.AsImgd().Write(stream)),

                GetImageFormat("IMGZ", "imz", true, Imgz.IsValid, s => Imgz.Read(s), (stream, images) =>
                               Imgz.Write(stream, images.Select(x => x.AsImgd()))),

                GetImageFormat("Font ARC", "arc", false, FontsArc.IsValid, s =>
                {
                    var fonts = FontsArc.Read(s);
                    return(new[]
                    {
                        fonts.FontCmd.Image1,
                        fonts.FontCmd.Image2,
                        fonts.FontHelp.Image1,
                        fonts.FontHelp.Image2,
                        fonts.FontMenu.Image1,
                        fonts.FontMenu.Image2,
                        fonts.FontMes.Image1,
                        fonts.FontMes.Image2,
                        fonts.FontNumeral.Image1,
                        fonts.FontNumeral.Image2,
                        fonts.FontIcon,
                    });
                }, (stream, images) =>
                               throw new NotImplementedException()),

                GetImageFormat("TIM2", "tm2", false, Tm2.IsValid, s => Tm2.Read(s), (stream, images) =>
                               throw new NotImplementedException()),

                GetImageFormat("KH2TIM", "tex", false, _ => true,
                               s => ModelTexture.Read(s).Images.Cast <IImageRead>(),
                               (stream, images) => throw new NotImplementedException()),
            };
        public void Fetch(string[] commandStrings)
        {
            // il faut voir le rawdata reçu si ca correspond vraiment a la longeur demandé et associé au variables ?
            #region reception des données du joueur qui a été selectionné dans la liste des joueurs

            /*_actor.Pseudo + "#"_actor.ClasseName + "#" + _actor.Spirit + "#" + _actor.SpiritLvl +
             *               "#" + _actor.Pvp + "#" + _actor.village + "#" + _actor.MaskColors + "#" +
             *               _actor.Orientation + "#" + _actor.Level + "#" + _actor.map + "#" + _actor.rang + "#" +
             *               _actor.currentHealth + "#" + _actor.totalHealth + "#" + _actor.xp + "#" + totalXp + "#" +
             *               _actor.doton + "#" + _actor.katon + "#" + _actor.futon + "#" + _actor.raiton + "#" +
             *               _actor.suiton + "#" + MainClass.chakralvl2 + "#" + MainClass.chakralvl3 + "#" +
             *               MainClass.chakralvl4 + "#" + MainClass.chakralvl5 + "#" + MainClass.chakralvl6 + "#" +
             *               _actor.usingDoton + "#" + _actor.usingKaton + "#" + _actor.usingFuton + "#" +
             *               _actor.usingRaiton + "#" + _actor.usingSuiton + "#" + _actor.equipedDoton + "#" +
             *               _actor.equipedKaton + "#" + _actor.equipedFuton + "#" + _actor.equipedRaiton + "#" +
             *               _actor.suitonEquiped + "#" + _actor.original_Pc + "#" + _actor.original_Pm + "#" +
             *               _actor.pe + "#" + _actor.cd + "#" + _actor.invoc + "#" + _actor.Initiative + "#" +
             *               _actor.job1 + "#" + _actor.job2 + "#" + _actor.specialite1 + "#" + _actor.specialite2 + "#" +
             *               _actor.TotalPoid + "#" + _actor.CurrentPoid + "#" + _actor.Ryo + "#" +
             *               _actor.resiDotonPercent + "#" + _actor.resiKatonPercent + "#" + _actor.resiFutonPercent +
             *               "#" + _actor.resiRaitonPercent + "#" + _actor.resiSuitonPercent + "#" + _actor.dodgePC +
             *               "#" + _actor.dodgePM + "#" + _actor.dodgePE + "#" + _actor.dodgeCD + "#" + _actor.removePC +
             *               "#" + _actor.removePM + "#" + _actor.removePE + "#" + _actor.removeCD + "#" + _actor.escape +
             *               "#" + _actor.blocage + "#" + _sorts + "#" + _actor.resiDotonFix + "#" + _actor.resiKatonFix +
             *               "#" + _actor.resiFutonFix + "#" + _actor.resiRaitonFix + "#" + _actor.resiSuitonFix + "#" +
             *               _actor.resiFix + "#" + _actor.domDotonFix + "#" + _actor.domKatonFix + "#" +
             *               _actor.domFutonFix + "#" + _actor.domRaitonFix + "#" + _actor.domSuitonFix + "#" +
             *               _actor.domFix + "#" + _actor.power + "#" + _actor.powerEquiped + "•" + quete + "•" +
             *               _actor.spellPointLeft;*/

            string[] states = commandStrings[1].Split('#');

            string actorName = states[0];
            Enums.ActorClass.ClassName className = (Enums.ActorClass.ClassName)Enum.Parse(typeof(Enums.ActorClass.ClassName), states[1]);
            Enums.Spirit.Name          spirit    = (Enums.Spirit.Name)Enum.Parse(typeof(Enums.Spirit.Name), states[2]);
            int  spiritLevel = int.Parse(states[3]);
            bool pvpEnabled  = bool.Parse(states[4]);
            Enums.HiddenVillage.Names hiddenVillage = (Enums.HiddenVillage.Names)Enum.Parse(typeof(Enums.HiddenVillage.Names), states[5]);
            string maskColorsString = states[6];
            int    orientation      = int.Parse(states[7]);
            int    level            = int.Parse(states[8]);
            string map = states[9];
            Enums.Rang.official officialRang = (Enums.Rang.official)Enum.Parse(typeof(Enums.Rang.official), states[10]);
            int      currentHealth           = int.Parse(states[11]);
            int      maxHealth         = int.Parse(states[12]);
            int      currentXp         = int.Parse(states[13]);
            int      maxXp             = int.Parse(states[14]);
            int      doton             = int.Parse(states[15]);
            int      katon             = int.Parse(states[16]);
            int      futon             = int.Parse(states[17]);
            int      raiton            = int.Parse(states[18]);
            int      suiton            = int.Parse(states[19]);
            int      chakra1Level      = int.Parse(states[20]);
            int      chakra2Level      = int.Parse(states[21]);
            int      chakra3Level      = int.Parse(states[22]);
            int      chakra4Level      = int.Parse(states[23]);
            int      chakra5Level      = int.Parse(states[24]);
            int      usingDoton        = int.Parse(states[25]);
            int      usingKaton        = int.Parse(states[26]);
            int      usingFuton        = int.Parse(states[27]);
            int      usingRaiton       = int.Parse(states[28]);
            int      usingSuiton       = int.Parse(states[29]);
            int      equipedDoton      = int.Parse(states[30]);
            int      equipedKaton      = int.Parse(states[31]);
            int      equipedFuton      = int.Parse(states[32]);
            int      equipedRaiton     = int.Parse(states[33]);
            int      equipedSuiton     = int.Parse(states[34]);
            int      pc                = int.Parse(states[35]);
            int      pm                = int.Parse(states[36]);
            int      pe                = int.Parse(states[37]);
            int      cd                = int.Parse(states[38]);
            int      summons           = int.Parse(states[39]);
            int      initiative        = int.Parse(states[40]);
            string   job1              = states[41];
            string   job2              = states[42];
            string   specialty1        = states[43];
            string   specialty2        = states[44];
            int      maxWeight         = int.Parse(states[45]);
            int      currentWeight     = int.Parse(states[46]);
            int      ryo               = int.Parse(states[47]);
            int      resiDotonPercent  = int.Parse(states[48]);
            int      resiKatonPercent  = int.Parse(states[49]);
            int      resiFutonPercent  = int.Parse(states[50]);
            int      resiRaitonPercent = int.Parse(states[51]);
            int      resiSuitonPercent = int.Parse(states[52]);
            int      dodgePc           = int.Parse(states[53]);
            int      dodgePm           = int.Parse(states[54]);
            int      dodgePe           = int.Parse(states[55]);
            int      dodgeCd           = int.Parse(states[56]);
            int      removePc          = int.Parse(states[57]);
            int      removePm          = int.Parse(states[58]);
            int      removePe          = int.Parse(states[59]);
            int      removeCd          = int.Parse(states[60]);
            int      escape            = int.Parse(states[61]);
            int      blocage           = int.Parse(states[62]);
            string[] spellsString      = states[63].Split('/');
            int      resiDotonFix      = int.Parse(states[64]);
            int      resiKatonFix      = int.Parse(states[65]);
            int      resiFutonFix      = int.Parse(states[66]);
            int      resiRaitonFix     = int.Parse(states[67]);
            int      resiSuitonFix     = int.Parse(states[68]);
            int      resiFix           = int.Parse(states[69]);
            int      domDotonFix       = int.Parse(states[70]);
            int      domKatonFix       = int.Parse(states[71]);
            int      domFutonFix       = int.Parse(states[72]);
            int      domRaitonFix      = int.Parse(states[73]);
            int      domSuitonFix      = int.Parse(states[74]);
            int      domFix            = int.Parse(states[75]);
            int      power             = int.Parse(states[76]);
            int      equipedPower      = int.Parse(states[77]);
            string   questString       = commandStrings[2];
            int      spellPointsLeft   = int.Parse(commandStrings[3]);

            HudHandle.DrawHud();

            new System.Threading.Thread(() =>
            {
                #region on affiche une fenetre de chargement
                // compteur pour voir si le temps passé est sufisant pour voir le chargement, si non on oblige le joueur a patienter le reste du temps détérminé pour l'animation qui est de 300 miliseconds
                Benchmark.Start();

                Bmp loadingParent = new Bmp(@"gfx\general\artwork\loading\naruto.dat", new Point(0, 0),
                                            "__loadingParent", Manager.TypeGfx.Bgr, true, 1)
                {
                    zindex = 100
                };
                Manager.manager.GfxTopList.Add(loadingParent);

                // barre de chargement
                Bmp loadingGif   = new Bmp(@"gfx\general\obj\1\loading1.dat", Point.Empty, "__loadingGif", Manager.TypeGfx.Bgr, true);
                loadingGif.point = new Point((ScreenManager.WindowWidth / 2) - (loadingGif.rectangle.Width / 2), ScreenManager.WindowHeight - 50);
                loadingParent.Child.Add(loadingGif);

                Txt loadingLabel   = new Txt(CommonCode.TranslateText(187), Point.Empty, "__loadingLabel", Manager.TypeGfx.Top, true, new Font("Verdana", 10, FontStyle.Bold), Brushes.White);
                loadingLabel.point = new Point((ScreenManager.WindowWidth / 2) - (TextRenderer.MeasureText(loadingLabel.Text, loadingLabel.font).Width / 2), 610);
                loadingParent.Child.Add(loadingLabel);

                Anim loadingSystemStart = new Anim(15, 1);
                for (int cnt = 0; cnt < 15; cnt++)
                {
                    loadingSystemStart.AddCell(@"gfx\general\obj\1\LoadingSystem.dat", 0, 300 + (cnt * 12), 550, 25 + (cnt * 2), 25 + (cnt * 2), 0.1F * (Convert.ToSingle(cnt)), 15);
                }
                loadingSystemStart.AddCell(@"gfx\general\obj\1\LoadingSystem.dat", 0, 300 + (15 * 12), 550, 25 + (15 * 2), 25 + (15 * 2), 0.1F * (Convert.ToSingle(15)), 15);
                loadingSystemStart.Ini(Manager.TypeGfx.Top, "__LoadingSystemStart", true);
                loadingSystemStart.AutoResetAnim = false;
                loadingSystemStart.Start();
                loadingParent.Child.Add(loadingSystemStart);

                /////////////////////////////////////////////////////////////
                CommonCode.MyPlayerInfo.instance.ibPlayer = new Bmp {
                    tag = new Actor()
                };
                Actor actor           = (Actor)CommonCode.MyPlayerInfo.instance.ibPlayer.tag;
                actor.pseudo          = actorName;
                actor.className       = className;
                actor.spirit          = spirit;
                actor.spiritLevel     = spiritLevel;
                actor.pvpEnabled      = pvpEnabled;
                actor.hiddenVillage   = hiddenVillage;
                actor.maskColorString = maskColorsString;
                actor.directionLook   = orientation;
                actor.level           = level;
                actor.map             = map;
                actor.officialRang    = officialRang;
                actor.currentHealth   = currentHealth;
                actor.maxHealth       = maxHealth;
                actor.currentXp       = currentXp;
                actor.maxXp           = maxXp;
                actor.doton           = doton;
                actor.katon           = katon;
                actor.futon           = futon;
                actor.raiton          = raiton;
                actor.suiton          = suiton;

                // association des données des chakralvl2,3,4,5
                CommonCode.chakra1Level = chakra1Level;
                CommonCode.chakra2Level = chakra2Level;
                CommonCode.chakra3Level = chakra3Level;
                CommonCode.chakra4Level = chakra4Level;
                CommonCode.chakra5Level = chakra5Level;

                actor.usingDoton        = usingDoton;
                actor.usingKaton        = usingKaton;
                actor.usingFuton        = usingFuton;
                actor.usingRaiton       = usingRaiton;
                actor.usingSuiton       = usingSuiton;
                actor.equipedDoton      = equipedDoton;
                actor.equipedKaton      = equipedKaton;
                actor.equipedFuton      = equipedFuton;
                actor.equipedRaiton     = equipedRaiton;
                actor.equipedSuiton     = equipedSuiton;
                actor.originalPc        = pc;
                actor.originalPm        = pm;
                actor.pe                = pe;
                actor.cd                = cd;
                actor.summons           = summons;
                actor.initiative        = initiative;
                actor.job1              = job1;
                actor.job2              = job2;
                actor.specialty1        = specialty1;
                actor.specialty2        = specialty2;
                actor.maxWeight         = maxWeight;
                actor.currentWeight     = currentWeight;
                actor.ryo               = ryo;
                actor.resiDotonPercent  = resiDotonPercent;
                actor.resiKatonPercent  = resiKatonPercent;
                actor.resiFutonPercent  = resiFutonPercent;
                actor.resiRaitonPercent = resiRaitonPercent;
                actor.resiSuitonPercent = resiSuitonPercent;
                actor.dodgePc           = dodgePc;
                actor.dodgePm           = dodgePm;
                actor.dodgePe           = dodgePe;
                actor.dodgeCd           = dodgeCd;
                actor.removePc          = removePc;
                actor.removePm          = removePm;
                actor.removePe          = removePe;
                actor.removeCd          = removeCd;
                actor.escape            = escape;
                actor.blocage           = blocage;

                if (spellsString.Length > 0)
                {
                    foreach (string t in spellsString)
                    {
                        Actor.SpellsInformations infoSorts = new Actor.SpellsInformations
                        {
                            sortID      = Convert.ToInt32(t.Split(':')[0]),
                            emplacement = Convert.ToInt32(t.Split(':')[1]),
                            level       = Convert.ToInt32(t.Split(':')[2]),
                            colorSort   = Convert.ToInt32(t.Split(':')[3])
                        };
                        actor.spells.Add(infoSorts);
                    }
                }
                actor.resiDotonFix  = resiDotonFix;
                actor.resiKatonFix  = resiKatonFix;
                actor.resiFutonFix  = resiFutonFix;
                actor.resiRaitonFix = resiRaitonFix;
                actor.resiSuitonFix = resiSuitonFix;
                actor.resiFix       = resiFix;

                // supression des sorts s'il sont déja été affiché avant
                if (HudHandle.all_sorts.Child.Count > 0)
                {
                    HudHandle.all_sorts.Child.Clear();
                }

                // affichage des sorts
                foreach (Actor.SpellsInformations t in actor.spells)
                {
                    Bmp spell = new Bmp(@"gfx\general\obj\1\spells.dat",
                                        new Point(spells.spellPositions[t.emplacement].X, spells.spellPositions[t.emplacement].Y),
                                        "__spell", Manager.TypeGfx.Top, true, 1, SpriteSheet.GetSpriteSheet(t.sortID + "_spell", 0))
                    {
                        tag = t
                    };
                    // attachement des infos du sort au tag de l'image
                    spell.MouseMove += MMORPG.Battle.__spell_MouseMove;
                    spell.MouseOut  += CommonCode.CursorDefault_MouseOut;
                    spell.MouseClic += MMORPG.Battle.__spell_MouseClic;
                    HudHandle.all_sorts.Child.Add(spell);
                }

                actor.domDotonFix  = domDotonFix;
                actor.domKatonFix  = domKatonFix;
                actor.domFutonFix  = domFutonFix;
                actor.domRaitonFix = domRaitonFix;
                actor.domSuitonFix = domSuitonFix;
                actor.domFix       = domFix;
                actor.power        = power;
                actor.equipedPower = equipedPower;
                CommonCode.CurMap  = actor.map;

                Benchmark.End();
                System.Threading.Thread.Sleep(225);
                loadingLabel.Text  = CommonCode.TranslateText(188);
                loadingLabel.point = new Point((ScreenManager.WindowWidth / 2) - (TextRenderer.MeasureText(loadingLabel.Text, loadingLabel.font).Width / 2), 610);

                ////////////////// mode designe
                loadingSystemStart.Visible(false);
                loadingParent.Child.Remove(loadingSystemStart);

                Anim loadingSystemEnd = new Anim(15, 1);
                for (int cnt = 0; cnt < 15; cnt++)
                {
                    loadingSystemEnd.AddCell(@"gfx\general\obj\1\LoadingSystem.dat", 0, loadingSystemStart.img.point.X + (cnt * 12), 550, 25 + ((15 - cnt) * 2), 25 + ((15 - cnt) * 2), 0.1F * (Convert.ToSingle(15 - cnt)), 15);
                }

                loadingSystemEnd.Ini(Manager.TypeGfx.Top, "__LoadingSystemEnd", true);
                loadingSystemEnd.AutoResetAnim = false;
                loadingSystemEnd.Start();
                loadingParent.Child.Add(loadingSystemEnd);

                Anim loadingGfxStart = new Anim(15, 1);
                for (int cnt = 0; cnt < 15; cnt++)
                {
                    loadingGfxStart.AddCell(@"gfx\general\obj\1\GrayPaletteColor.dat", 0, 300 + (cnt * 12), 550, 25 + (cnt * 2), 25 + (cnt * 2), 0.1F * (Convert.ToSingle(cnt)), 15);
                }
                loadingGfxStart.AddCell(@"gfx\general\obj\1\paletteColor.dat", 0, 300 + (15 * 12), 550, 25 + (15 * 2), 25 + (15 * 2), 0.1F * (Convert.ToSingle(15)), 15);
                loadingGfxStart.Ini(Manager.TypeGfx.Top, "__paletteColor", true);
                loadingGfxStart.AutoResetAnim = false;
                loadingGfxStart.Start();
                loadingParent.Child.Add(loadingGfxStart);

                loadingLabel.Text  = CommonCode.TranslateText(189);
                loadingLabel.point = new Point((ScreenManager.WindowWidth / 2) - (TextRenderer.MeasureText(loadingLabel.Text, loadingLabel.font).Width / 2), 610);

                ///////////////// affichage des composants du tableau stats
                // affichage de l'avatar
                MenuStats.ThumbsAvatar = new Bmp(@"gfx\general\classes\" + actor.className + ".dat", new Point(15, 10),
                                                 "ThumbsAvatar", Manager.TypeGfx.Top, true, 1,
                                                 SpriteSheet.GetSpriteSheet("avatar_" + actor.className, 0))
                {
                    tag = CommonCode.MyPlayerInfo.instance.ibPlayer.tag
                };
                CommonCode.ApplyMaskColorToClasse(MenuStats.ThumbsAvatar);
                MenuStats.StatsImg.Child.Add(MenuStats.ThumbsAvatar);

                // affichage du nom du personnage
                MenuStats.StatsPlayerName.Text = actor.pseudo[0].ToString().ToUpper() + actor.pseudo.Substring(1, actor.pseudo.Length - 1);

                // level
                MenuStats.StatsLevel.Text = CommonCode.TranslateText(50) + " " + actor.level;

                // affichage du rang général
                MenuStats.Rang.Text = CommonCode.officialRangToCurrentLangTranslation(actor.officialRang);

                // affichage du level Pvp
                MenuStats.LevelPvp.Text = actor.spiritLevel.ToString();

                // affichage du grade Pvp
                if (spirit != Enums.Spirit.Name.neutral)
                {
                    MenuStats.GradePvp = new Bmp(@"gfx\general\obj\2\" + actor.spirit + @"\" + MenuStats.LevelPvp.Text + ".dat", new Point(276 + (15 - Convert.ToInt16(MenuStats.LevelPvp.Text)), 2), new Size(40 + Convert.ToInt16(MenuStats.LevelPvp.Text), 20 + Convert.ToInt16(MenuStats.LevelPvp.Text)), "PlayerStats." + actor.spirit, Manager.TypeGfx.Top, true, 1);
                    MenuStats.StatsImg.Child.Add(MenuStats.GradePvp);
                }

                // update des pdv,Pc
                HudHandle.UpdateHealth();
                HudHandle.UpdatePc();
                HudHandle.UpdatePm();

                MenuStats.Flag = new Bmp(@"gfx\general\obj\1\pays_thumbs.dat", new Point(240, 8), "__Flag", Manager.TypeGfx.Top, true, 1, SpriteSheet.GetSpriteSheet("pays_" + actor.hiddenVillage + "_thumbs", 0));
                MenuStats.StatsImg.Child.Add(MenuStats.Flag);
                MenuStats.LFlag.Text          = hiddenVillage.ToString();
                MenuStats.Fusion1.Text        = CommonCode.TranslateText(75);
                MenuStats.Fusion2.Text        = CommonCode.TranslateText(75);
                MenuStats.NiveauGaugeTxt.Text = CommonCode.TranslateText(50) + " " + actor.level;

                // NiveauGaugeRecPercent, barre de progression du niveau
                // calcule du pourcentage du niveau en progression
                int currentProgressLevel = actor.currentXp;
                int totalProgressLevel   = actor.maxXp;
                int percentProgressLevel;

                if (totalProgressLevel != 0)
                {
                    percentProgressLevel = (currentProgressLevel * 100) / totalProgressLevel;
                }
                else
                {
                    percentProgressLevel = 100;
                }

                MenuStats.NiveauGaugeRecPercent.size.Width = (258 * percentProgressLevel) / 100;

                // affichage du label progression lvl
                MenuStats.NiveauGaugeTxtCurrent.Text  = currentProgressLevel + "/" + totalProgressLevel + " (" + percentProgressLevel + "%)";
                MenuStats.NiveauGaugeTxtCurrent.point = new Point(MenuStats.NiveauGaugeRec2.point.X + (MenuStats.NiveauGaugeRec2.size.Width / 2) - (TextRenderer.MeasureText(MenuStats.NiveauGaugeTxtCurrent.Text, MenuStats.NiveauGaugeTxtCurrent.font).Width / 2), MenuStats.NiveauGaugeRec2.point.Y);

                // raffrechissement du text pour des mesures de changement de langue
                MenuStats.AffiniteElementaireTxt.Text = CommonCode.TranslateText(76);
                MenuStats.terreStats.Text             = "(" + CommonCode.TranslateText(77) + ")";
                MenuStats.FeuStats.Text    = "(" + CommonCode.TranslateText(78) + ")";
                MenuStats.VentStats.Text   = "(" + CommonCode.TranslateText(79) + ")";
                MenuStats.FoudreStats.Text = "(" + CommonCode.TranslateText(80) + ")";
                MenuStats.EauStats.Text    = "(" + CommonCode.TranslateText(81) + ")";

                MenuStats.TerrePuissance.Text  = "(" + actor.doton + "+" + actor.equipedDoton + ")=" + (actor.doton + actor.equipedDoton);
                MenuStats.FeuPuissance.Text    = "(" + actor.katon + "+" + actor.equipedKaton + ")=" + (actor.katon + actor.equipedKaton);
                MenuStats.VentPuissance.Text   = "(" + actor.futon + "+" + actor.equipedFuton + ")=" + (actor.futon + actor.equipedFuton);
                MenuStats.FoudrePuissance.Text = "(" + actor.raiton + "+" + actor.equipedRaiton + ")=" + (actor.raiton + actor.equipedRaiton);
                MenuStats.EauPuissance.Text    = "(" + actor.suiton + "+" + actor.equipedSuiton + ")=" + (actor.suiton + actor.equipedSuiton);

                MenuStats.Lvl1RegleTxt.Text = CommonCode.TranslateText(82);
                MenuStats.Lvl2RegleTxt.Text = CommonCode.TranslateText(83);
                MenuStats.Lvl3RegleTxt.Text = CommonCode.TranslateText(84);
                MenuStats.Lvl4RegleTxt.Text = CommonCode.TranslateText(85);
                MenuStats.Lvl5RegleTxt.Text = CommonCode.TranslateText(86);
                MenuStats.Lvl6RegleTxt.Text = CommonCode.TranslateText(87);

                // affichage de la gauge lvl chakra selon les points
                MenuStats.Lvl2ReglePts.Text = CommonCode.chakra1Level.ToString();
                MenuStats.Lvl3ReglePts.Text = CommonCode.chakra2Level.ToString();
                MenuStats.Lvl4ReglePts.Text = CommonCode.chakra3Level.ToString();
                MenuStats.Lvl5ReglePts.Text = CommonCode.chakra4Level.ToString();
                MenuStats.Lvl6ReglePts.Text = CommonCode.chakra5Level.ToString();

                // modification du lvl de l'utilisation de l'element
                CommonCode.UpdateUsingElement(Enums.Chakra.Element.doton, actor.usingDoton);
                CommonCode.UpdateUsingElement(Enums.Chakra.Element.katon, actor.usingKaton);
                CommonCode.UpdateUsingElement(Enums.Chakra.Element.futon, actor.usingFuton);
                CommonCode.UpdateUsingElement(Enums.Chakra.Element.raiton, actor.usingRaiton);
                CommonCode.UpdateUsingElement(Enums.Chakra.Element.suiton, actor.equipedSuiton);

                MenuStats.DotonLvl.Text  = actor.usingDoton.ToString();
                MenuStats.KatonLvl.Text  = actor.usingKaton.ToString();
                MenuStats.FutonLvl.Text  = actor.usingFuton.ToString();
                MenuStats.RaitonLvl.Text = actor.usingRaiton.ToString();
                MenuStats.SuitonLvl.Text = actor.usingSuiton.ToString();

                // bar de vie selon les pdv 11 current, 12 total
                int totalPdv   = actor.maxHealth;
                int currentPdv = actor.currentHealth;
                int x          = 0;
                if (totalPdv != 0)
                {
                    x = (currentPdv * 100) / totalPdv;
                }
                MenuStats.VieBar.size.Width = (236 * x) / 100;

                // point de vie dans Menustats
                MenuStats.VieLabel.Text         = CommonCode.TranslateText(88);
                MenuStats.ViePts.Text           = currentPdv + " / " + totalPdv + " (" + x + "%)";
                MenuStats.PC.Text               = actor.originalPc.ToString();
                MenuStats.PM.Text               = actor.originalPm.ToString();
                MenuStats.PE.Text               = actor.pe.ToString();
                MenuStats.CD.Text               = actor.cd.ToString();
                MenuStats.Invoc.Text            = actor.summons.ToString();
                MenuStats.Initiative.Text       = actor.initiative.ToString();
                MenuStats.Puissance.Text        = (actor.power + actor.equipedPower).ToString();
                MenuStats.DomFix.Text           = actor.domFix.ToString();
                MenuStats.Job1Label.Text        = CommonCode.TranslateText(95) + " 1";
                MenuStats.Specialite1Label.Text = CommonCode.TranslateText(96) + " 1";
                MenuStats.Job2Labe1.Text        = CommonCode.TranslateText(95) + " 2";
                MenuStats.Specialite2Label.Text = CommonCode.TranslateText(96) + " 2";
                //////// playerData[41] = job1
                //////// playerdata[42] = job2
                //////// playerdata[43] = specialite1
                //////// playerdata[44] = specialite2
                MenuStats.PoidLabel.Text       = CommonCode.TranslateText(97);
                int totalPoid                  = actor.maxWeight;
                int currentPoid                = actor.currentWeight;
                int percentPoid                = (currentPoid * 100) / totalPoid;
                MenuStats.PoidRec.size.Width   = (116 * percentPoid) / 100;
                MenuStats.Poid.Text            = currentPoid + " / " + totalPoid + " (" + percentPoid + "%)";
                MenuStats.Poid.point.X         = MenuStats.PoidRec.point.X + 58 - (TextRenderer.MeasureText(MenuStats.Poid.Text, MenuStats.Poid.font).Width / 2);
                MenuStats.Ryo.Text             = CommonCode.MoneyThousendSeparation(actor.ryo.ToString());
                MenuStats.resiDotonTxt.Text    = actor.resiDotonPercent + "%";
                MenuStats.resiKatonTxt.Text    = actor.resiKatonPercent + "%";
                MenuStats.resiFutonTxt.Text    = actor.resiFutonPercent + "%";
                MenuStats.resiRaitonTxt.Text   = actor.resiRaitonPercent + "%";
                MenuStats.resiSuitonTxt.Text   = actor.resiSuitonPercent + "%";
                MenuStats.__esquivePC_Txt.Text = actor.dodgePc.ToString();
                MenuStats.__esquivePM_Txt.Text = actor.dodgePm.ToString();
                MenuStats.__retraitPC_Txt.Text = actor.removePc.ToString();
                MenuStats.__retraitPM_Txt.Text = actor.removePm.ToString();

                // quete
                // convertir la list de quete en string
                if (questString != "")
                {
                    for (int cnt = 0; cnt < questString.Split('/').Length; cnt++)
                    {
                        string quest = questString.Split('/')[cnt];
                        Actor.QuestInformations qi = new Actor.QuestInformations
                        {
                            nom_quete   = quest.Split(':')[0],
                            totalSteps  = Convert.ToInt16(quest.Split(':')[1]),
                            currentStep = Convert.ToInt16(quest.Split(':')[2]),
                            submited    = Convert.ToBoolean(quest.Split(':')[3])
                        };
                        actor.Quests.Add(qi);
                    }
                }

                // verification si le joueur été en combat pour le rediriger vers ce joueur

                /*if (commandStrings[3] == "inBattle")
                 * {
                 *  common1.MyPlayerInfo.instance.pseudo = pi.pseudo;
                 *  common1.MyPlayerInfo.instance.Event = "inBattle";
                 * }*/

                actor.spellPointLeft = spellPointsLeft;

                ///// effacement du menu loading
                loadingLabel.Text  = CommonCode.TranslateText(190);
                loadingLabel.point = new Point((ScreenManager.WindowWidth / 2) - (TextRenderer.MeasureText(loadingLabel.Text, loadingLabel.font).Width / 2), 610);
                System.Threading.Thread.Sleep(2000);

                // changement de map
                Manager.manager.mainForm.BeginInvoke((Action)(() =>
                {
                    CommonCode.ChangeMap(actor.map);                  // affichage du hud
                    Manager.manager.GfxTopList.Remove(loadingParent); // enlever l'image d'avant plant qui empeche de voir la map
                    MainForm.chatBox.Show();
                    HudHandle.HudVisibility(true);
                    MainForm.drawSpellStatesMenuOnce();
                    HudHandle.chatBoxRefreshHandler();
                    HudHandle.recalibrateChatBoxPosition();
                }));
                #endregion
            }).Start();
            #endregion
        }
예제 #8
0
파일: _0_0_0.cs 프로젝트: melharfi/Nova
 void DefaultCursor(Bmp bmp, MouseEventArgs e)
 {
     CommonCode.CursorDefault_MouseOut(null, null);
 }
예제 #9
0
        public void Fetch(string[] commandStrings)
        {
            #region
            // connexion d'un joueur
            // pseudo#classe#pvp:spirit:spiritLvl#village#MaskColors#map_position#orientation#level#action#waypoint   - separateur entre plusieurs joueurs
            // pvp=0 donc mode pvp off, si pvp = 1 mode pvp on
            string[] data = commandStrings[1].Split('#');

            string playerName = data[0];
            Enums.ActorClass.ClassName className = (Enums.ActorClass.ClassName)Enum.Parse(typeof(Enums.ActorClass.ClassName), data[1]);
            bool pvpEnabled          = bool.Parse(data[2].Split(':')[0]);
            Enums.Spirit.Name spirit = (Enums.Spirit.Name)Enum.Parse(typeof(Enums.Spirit.Name), data[2].Split(':')[1]);
            int spiritLevel          = int.Parse(data[2].Split(':')[2]);
            Enums.HiddenVillage.Names hiddenVillage = (Enums.HiddenVillage.Names)Enum.Parse(typeof(Enums.HiddenVillage.Names), data[3]);
            string   maskColorsString = data[4];
            string[] maskColors       = maskColorsString.Split('/');
            Point    mapPosition      = new Point(Convert.ToInt16(data[5].Split('/')[0]), Convert.ToInt16(data[5].Split('/')[1]));
            int      directionLook    = int.Parse(data[6]);
            int      level            = int.Parse(data[7]);
            Enums.AnimatedActions.Name animatedAction = (data[8] != "") ? (Enums.AnimatedActions.Name)Enum.Parse(typeof(Enums.AnimatedActions.Name), data[8]) : Enums.AnimatedActions.Name.idle;
            string waypoint = data[9];

            // verifier si le personnage est deja present pour ne pas créer un doublons, si par erreur le serveur n'envoie pas une cmd de deconnexion du client ou SessionZero
            if (CommonCode.AllActorsInMap.Exists(f => ((Actor)f.tag).pseudo == playerName && ((Actor)f.tag).pseudo != CommonCode.MyPlayerInfo.instance.pseudo))
            {
                Bmp tmpBmp = CommonCode.AllActorsInMap.Find(f => ((Actor)f.tag).pseudo == playerName);
                tmpBmp.visible = false;
                Manager.manager.GfxObjList.RemoveAll(f => f != null && f.GetType() == typeof(Bmp) && f.Tag() != null && f.Tag().GetType() == typeof(Actor) && ((Actor)f.Tag()).pseudo == playerName);
                CommonCode.AllActorsInMap.Remove(CommonCode.AllActorsInMap.Find(f => ((Actor)f.tag).pseudo == playerName));
            }

            // affichage du personnage + position + orientation
            Bmp ibPlayers = new Bmp(@"gfx\general\classes\" + className + ".dat", Point.Empty, "Player_" + playerName, 0, true, 1, SpriteSheet.GetSpriteSheet(className.ToString(), CommonCode.ConvertToClockWizeOrientation(directionLook)));
            ibPlayers.MouseOver += CommonCode.ibPlayers_MouseOver;
            ibPlayers.MouseOut  += CommonCode.ibPlayers_MouseOut;
            ibPlayers.MouseMove += CommonCode.CursorHand_MouseMove;
            ibPlayers.MouseClic += CommonCode.ibPlayers_MouseClic;
            Manager.manager.GfxObjList.Add(ibPlayers);

            // attachement des données
            ibPlayers.tag = new Actor(playerName, level, !pvpEnabled ? Enums.Spirit.Name.neutral : spirit, className, pvpEnabled, !pvpEnabled ? 0 : spiritLevel, hiddenVillage, maskColorsString, directionLook, animatedAction, waypoint);
            Actor pi = (Actor)ibPlayers.tag;
            pi.realPosition = mapPosition;

            CommonCode.AdjustPositionAndDirection(ibPlayers, new Point(mapPosition.X * 30, mapPosition.Y * 30));
            CommonCode.VerticalSyncZindex(ibPlayers);

            // affichage des ailles
            if (pi.pvpEnabled)
            {
                if (pi.spirit != Enums.Spirit.Name.neutral)
                {
                    Bmp spiritBmp = new Bmp(@"gfx\general\obj\2\" + pi.spirit + @"\" + pi.spiritLevel + ".dat", Point.Empty, "spirit_" + ibPlayers.name, Manager.TypeGfx.Obj, false, 1);
                    spiritBmp.point = new Point((ibPlayers.rectangle.Width / 2) - (spiritBmp.rectangle.Width / 2), -spiritBmp.rectangle.Height);
                    ibPlayers.Child.Add(spiritBmp);

                    Txt lPseudo = new Txt(pi.pseudo, Point.Empty, "lPseudo_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Regular), Brushes.Red);
                    lPseudo.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lPseudo.Text, lPseudo.font).Width / 2) + 5, -spiritBmp.rectangle.Height - 15);
                    ibPlayers.Child.Add(lPseudo);

                    Txt lLvlSpirit = new Txt(pi.spiritLevel.ToString(), Point.Empty, "lLvlSpirit_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Bold), Brushes.Red);
                    lLvlSpirit.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lLvlSpirit.Text, lLvlSpirit.font).Width / 2) + 2, -spiritBmp.rectangle.Y - (spiritBmp.rectangle.Height / 2) - (TextRenderer.MeasureText(lLvlSpirit.Text, lLvlSpirit.font).Height / 2));
                    ibPlayers.Child.Add(lLvlSpirit);

                    Bmp village = new Bmp(@"gfx\general\obj\1\pays_thumbs.dat", Point.Empty, "village_" + pi.hiddenVillage, Manager.TypeGfx.Obj, false, 1, SpriteSheet.GetSpriteSheet("pays_" + pi.hiddenVillage + "_thumbs", 0));
                    village.point = new Point((ibPlayers.rectangle.Width / 2) - (village.rectangle.Width / 2), lPseudo.point.Y - village.rectangle.Height + 2);
                    ibPlayers.Child.Add(village);
                }
            }
            else
            {
                Txt lPseudo = new Txt(pi.pseudo, Point.Empty, "lPseudo_" + ibPlayers.name, Manager.TypeGfx.Obj, false, new Font("Verdana", 10, FontStyle.Regular), Brushes.Red);
                lPseudo.point = new Point((ibPlayers.rectangle.Width / 2) - (TextRenderer.MeasureText(lPseudo.Text, lPseudo.font).Width / 2) + 5, -15);
                ibPlayers.Child.Add(lPseudo);

                Bmp village = new Bmp(@"gfx\general\obj\1\pays_thumbs.dat", Point.Empty, "village_" + pi.hiddenVillage, Manager.TypeGfx.Obj, false, 1, SpriteSheet.GetSpriteSheet("pays_" + pi.hiddenVillage + "_thumbs", 0));
                village.point = new Point((ibPlayers.rectangle.Width / 2) - (village.rectangle.Width / 2), lPseudo.point.Y - village.rectangle.Height + 2);
                ibPlayers.Child.Add(village);
            }

            // coloriage selon le MaskColors
            if (maskColors[0] != "null")
            {
                Color tmpColor = Color.FromArgb(Convert.ToInt16(maskColors[0].Split('-')[0]), Convert.ToInt16(maskColors[0].Split('-')[1]), Convert.ToInt16(maskColors[0].Split('-')[2]));
                CommonCode.SetPixelToClass(className, tmpColor, 1, ibPlayers);
            }

            if (maskColors[1] != "null")
            {
                Color tmpColor = Color.FromArgb(Convert.ToInt16(maskColors[1].Split('-')[0]), Convert.ToInt16(maskColors[1].Split('-')[1]), Convert.ToInt16(maskColors[1].Split('-')[2]));
                CommonCode.SetPixelToClass(className, tmpColor, 2, ibPlayers);
            }

            if (maskColors[2] != "null")
            {
                Color tmpColor = Color.FromArgb(Convert.ToInt16(maskColors[2].Split('-')[0]), Convert.ToInt16(maskColors[2].Split('-')[1]), Convert.ToInt16(maskColors[2].Split('-')[2]));
                CommonCode.SetPixelToClass(className, tmpColor, 3, ibPlayers);
            }

            // ajout du joueur dans la liste des joueurs
            CommonCode.ApplyMaskColorToClasse(ibPlayers);
            CommonCode.AllActorsInMap.Add(ibPlayers);
            #endregion
        }
예제 #10
0
        static public void Mux(string[] fileNames, string outFile, int countPerLine)
        {
            List <Bmp> bmps  = new List <Bmp>();
            var        lines = (fileNames.Length + countPerLine - 1) / countPerLine;
            var        index = 0;

            for (var y = 0; y < lines; ++y)
            {
                for (var x = 0; x < countPerLine; ++x)
                {
                    bmps.Add(Bmp.FromFile(fileNames[index]));
                    index++;
                }
            }
            bool           palettable = IsPalettable(bmps);
            List <RGBQUAD> colors     = null;

            if (palettable)
            {
                // パレット統合
                colors = CombinePalettes(bmps);
                if (colors.Count > 256)
                {
                    palettable = false;
                }
            }
            if (palettable)
            {
                ushort biBitCount = 8;
                if (colors.Count <= 2)
                {
                    biBitCount = 1;
                }
                if (colors.Count <= 16)
                {
                    biBitCount = 4;
                }
                else
                {
                    biBitCount = 8;
                }
                Bmp bmp = new Bmp();
                bmp.bmih = bmps[0].bmih;
                var width  = bmps[0].bmih.biWidth;
                var height = Math.Abs(bmps[0].bmih.biHeight);
                bmp.bmih.biWidth    = width * countPerLine;
                bmp.bmih.biHeight   = height * lines;
                bmp.bmih.biBitCount = biBitCount;
                if (bmp.bmih.biClrUsed == 0)
                {
                    bmp.colorTable = new RGBQUAD[1 << biBitCount];
                }
                else
                {
                    bmp.bmih.biClrUsed = (uint)(colors.Count);
                    bmp.colorTable     = new RGBQUAD[bmp.bmih.biClrUsed];
                }
                for (int i = 0; i < colors.Count; ++i)
                {
                    bmp.colorTable[i] = colors[i];
                }

                int lineStride = bmp.GetLineStride();
                bmp.imageData = new byte[Math.Abs(lineStride * bmp.bmih.biHeight)];
                index         = 0;
                for (var y = 0; y < lines; ++y)
                {
                    for (var x = 0; x < countPerLine; ++x)
                    {
                        bmp.Paste(x * width, y * height, bmps[index]);
                        index++;
                    }
                }
                bmp.ToFile(outFile);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
예제 #11
0
파일: ImageYKG.cs 프로젝트: zxc120/GARbro
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(0x40);

            if (!header.AsciiEqual(4, "00\0\0"))
            {
                return(null);
            }
            var ykg = new YkgMetaData {
                DataOffset = header.ToUInt32(0x28),
                DataSize   = header.ToUInt32(0x2C)
            };

            if (0 == ykg.DataOffset)
            {
                ykg.DataOffset = header.ToUInt32(8);
            }
            if (ykg.DataOffset < 0x30)
            {
                return(null);
            }
            if (0 == ykg.DataSize)
            {
                ykg.DataSize = (uint)(file.Length - ykg.DataOffset);
            }
            ImageMetaData info = null;

            using (var reg = new StreamRegion(file.AsStream, ykg.DataOffset, ykg.DataSize, true))
                using (var img = new BinaryStream(reg, file.Name))
                {
                    var img_header = img.ReadHeader(4);
                    if (img_header.AsciiEqual("BM"))
                    {
                        img.Position = 0;
                        info         = Bmp.ReadMetaData(img);
                        ykg.Format   = YkgImage.Bmp;
                    }
                    else if (img_header.AsciiEqual("\x89PNG"))
                    {
                        img.Position = 0;
                        info         = Png.ReadMetaData(img);
                        ykg.Format   = YkgImage.Png;
                    }
                    else if (img_header.AsciiEqual("\x89GNP"))
                    {
                        using (var body = new StreamRegion(file.AsStream, ykg.DataOffset + 4, ykg.DataSize - 4, true))
                            using (var pre = new PrefixStream(PngPrefix, body))
                                using (var png = new BinaryStream(pre, file.Name))
                                    info = Png.ReadMetaData(png);
                        ykg.Format = YkgImage.Gnp;
                    }
                }
            if (null == info)
            {
                return(null);
            }
            ykg.Width   = info.Width;
            ykg.Height  = info.Height;
            ykg.BPP     = info.BPP;
            ykg.OffsetX = info.OffsetX;
            ykg.OffsetY = info.OffsetY;
            return(ykg);
        }
예제 #12
0
        void SendBtn_MouseClic(Bmp bmp, MouseEventArgs e)
        {
            RichTextBoxEx ChatArea = MainForm.chatBox.Controls.Find("ChatArea", false)[0] as RichTextBoxEx;

            if (HudHandle.SelectedCanalTxt.Text == "P" && HudHandle.ChatTextBox.TextLength > CommonCode.MyPlayerInfo.instance.pseudo.Length && HudHandle.ChatTextBox.Text.Substring(0, CommonCode.MyPlayerInfo.instance.pseudo.Length) == CommonCode.MyPlayerInfo.instance.pseudo)
            {
                ChatArea.AppendText((ChatArea.Text == "") ? "" : "\n");
                ChatArea.SelectionStart  = ChatArea.TextLength;
                ChatArea.SelectionLength = 0;
                ChatArea.SelectionColor  = Color.Red;
                ChatArea.AppendText(CommonCode.TranslateText(28));
                ChatArea.SelectionColor = ChatArea.ForeColor;
            }
            else if (HudHandle.ChatTextBox.Text != "")
            {
                if (HudHandle.SelectedCanalTxt.Text == "P" && HudHandle.ChatTextBox.Text.Split('#').Count() == 2)
                {
                    // affichage du texte envoyé en mp en chat general
                    ChatArea.AppendText((ChatArea.Text == "") ? "" : "\n");
                    ChatArea.SelectionStart  = ChatArea.TextLength;
                    ChatArea.SelectionLength = 0;
                    ChatArea.SelectionColor  = Color.Green;

                    // pour recuperer le reste du texte quand l'utilisateur ajoute un # qui s'ajoute a celui du pseudo#...#
                    string tmpMsg = "";
                    if (HudHandle.ChatTextBox.Text.Split('#').Length >= 2)
                    {
                        for (int cnt = 1; cnt < HudHandle.ChatTextBox.Text.Split('#').Length; cnt++)
                        {
                            tmpMsg += HudHandle.ChatTextBox.Text.Split('#')[cnt] + "#";
                        }

                        tmpMsg = tmpMsg.Substring(0, tmpMsg.Length - 1);
                    }

                    ///////////////////// l'heur
                    ChatArea.SelectionStart  = ChatArea.TextLength;
                    ChatArea.SelectionLength = 0;
                    ChatArea.SelectionColor  = Color.Green;
                    ChatArea.AppendText("[" + DateTime.Now.ToString("HH:mm:ss") + "] ");
                    //////////////////////////////////////////////////////

                    ChatArea.AppendText(CommonCode.TranslateText(3) + " ");
                    ChatArea.InsertLink(" " + HudHandle.ChatTextBox.Text.Split('#')[0]);
                    ChatArea.AppendText(" : ");

                    // recherche l'existance d'un lien dans le text
                    if (tmpMsg.IndexOf("[l/]") != -1 && tmpMsg.IndexOf("[\\l]") != -1 && tmpMsg.Length > 12)
                    {
                        // le texte contiens un lien
                        // affichage du texte qui precede la balise ouverture de lien
                        ChatArea.AppendText(tmpMsg.Substring(0, tmpMsg.IndexOf("[l/]")) + " ");
                        string tmpMsg2 = tmpMsg.Substring(tmpMsg.IndexOf("[l/]") + 4, tmpMsg.IndexOf("[\\l]") - tmpMsg.IndexOf("[l/]") - 4);
                        ChatArea.InsertLink(tmpMsg2);
                        int    pos1 = tmpMsg.IndexOf("[\\l]") + 4;
                        string str1 = tmpMsg.Substring(pos1, tmpMsg.Length - pos1);
                        ChatArea.AppendText(str1);
                    }
                    else
                    {
                        ChatArea.AppendText(tmpMsg);
                    }

                    ChatArea.SelectionColor = ChatArea.ForeColor;
                }

                Network.SendMessage("cmd•ChatMessage•" + HudHandle.SelectedCanalTxt.Text + "•" + HudHandle.ChatTextBox.Text, true);

                // enregistrement des messages sur le chatlog
                MainForm.ChatLog.Add(HudHandle.ChatTextBox.Text + "•" + HudHandle.SelectedCanalTxt.Text);

                HudHandle.ChatTextBox.Text = "";
                HudHandle.ChannelState("G");
            }
        }
예제 #13
0
        public Bitmap getImage()
        {
            Bmp    bmp            = new Bmp(0, 0, Bmp.Dot.getDot(Color.White));
            int    l              = 0;
            int    t              = 0;
            string optionBmpLFile = null;

            foreach (string line in _pi.getDrawingScript())
            {
                int[] prms = Utils.toInts(StringTools.tokenize(line, StringTools.DIGIT, true, true).ToArray());

                if (prms.Length < 1)                 // ? 空行
                {
                    continue;
                }

                switch (prms[0])
                {
                case 0:
                    bmp.table.w = BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP + BMP_MARGIN_RB;
                    bmp.table.h = BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP + BMP_MARGIN_RB;
                    break;

                // 枠線
                case 1:
                case 2:
                case 3:
                    Utils.drawLine(
                        bmp,
                        BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP,
                        BMP_MARGIN + (l + prms[3]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[4]) * BMP_CELLSTEP,
                        Bmp.Dot.getDot(Color.Black),
                        prms[0] - 1
                        );
                    break;

                // 対角線
                case 4:
                    Utils.drawLine(
                        bmp,
                        BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP,
                        BMP_MARGIN + (l + prms[3]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[4]) * BMP_CELLSTEP,
                        new Bmp.Dot(255, 255, 200, 200),
                        2
                        );
                    break;

                // 重複部分
                case 5:
                    bmp.fillRect(
                        BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP,
                        BMP_MARGIN + (l + prms[3]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[4]) * BMP_CELLSTEP,
                        new Bmp.Dot(255, 255, 255, 200)
                        );
                    break;

                // 座標原点変更
                case 6:
                    l = prms[1];
                    t = prms[2];
                    break;

                // 奇数部分
                case 7:
                    bmp.fillRect(
                        BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP,
                        BMP_MARGIN + (l + prms[3]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[4]) * BMP_CELLSTEP,
                        new Bmp.Dot(
                            255,
                            (255 + 255) / 2,
                            (255 + 201) / 2,
                            (255 + 14) / 2
                            )
                        );
                    break;

                // 偶数部分
                case 8:
                    bmp.fillRect(
                        BMP_MARGIN + (l + prms[1]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[2]) * BMP_CELLSTEP,
                        BMP_MARGIN + (l + prms[3]) * BMP_CELLSTEP,
                        BMP_MARGIN + (t + prms[4]) * BMP_CELLSTEP,
                        new Bmp.Dot(
                            255,
                            (255 + 153) / 2,
                            (255 + 217) / 2,
                            (255 + 234) / 2
                            )
                        );
                    break;

                case 9:
                    optionBmpLFile = "even_odd.bmp";
                    break;

                default:
                    throw null;
                }
            }
            RectTable <int> csv        = Utils.readDigCsvFile(_csvFile);
            RectTable <int> surfaceCsv = null;

            if (_surface != null)
            {
                surfaceCsv = Utils.readDigCsvFile(_surface.csvFile);
            }

            for (int x = 0; x < csv.w; x++)
            {
                for (int y = 0; y < csv.h; y++)
                {
                    int   dig   = csv.get(x, y);
                    Color color = _digitColor;

                    if (surfaceCsv != null && surfaceCsv.get(x, y) != 0)
                    {
                        color = _surface.digitColor;
                    }

                    Utils.drawDigit(
                        bmp,
                        BMP_MARGIN + x * BMP_CELLSTEP + BMP_DIGIT_MARGIN,
                        BMP_MARGIN + y * BMP_CELLSTEP + BMP_DIGIT_MARGIN,
                        color,
                        dig
                        );
                }
            }
            if (optionBmpLFile != null)
            {
                string file = Utils.lFileToResFile(optionBmpLFile);

                using (Bitmap optBmp = (Bitmap)Bitmap.FromFile(file))
                {
                    bmp.putOptionBmp(optBmp);
                }
            }
            return(bmp.getBitmap());
        }
예제 #14
0
        static ImageFormatService()
        {
            imageFormat = new IImageFormat[]
            {
                GetImageFormat("PNG", "png", true, Png.IsValid, Png.Read, (stream, image) => Png.Write(stream, image)),
                GetImageFormat("BMP", "bmp", true, Bmp.IsValid, Bmp.Read, (stream, image) => Bmp.Write(stream, image)),
                GetImageFormat("TIFF", "tiff", true, Tiff.IsValid, Tiff.Read, (stream, image) => Tiff.Write(stream, image)),
                GetImageFormat("IMGD", "imd", true, Imgd.IsValid, Imgd.Read, (stream, image) => image.AsImgd().Write(stream)),

                GetImageFormat("IMGZ", "imz", true, Imgz.IsValid, s => Imgz.Read(s), (stream, images) =>
                               Imgz.Write(stream, images.Select(x => x.AsImgd()))),

                GetImageFormat("TIM2", "tm2", false, Tm2.IsValid, s => Tm2.Read(s), (stream, images) =>
                               throw new NotImplementedException()),

                GetImageFormat("KH2TIM", "tex", true, _ => true,
                               s => ModelTexture.Read(s).Images.Cast <IImageRead>(),
                               (stream, images) => throw new NotImplementedException()),
            };
예제 #15
0
 public override ImageData Read(IBinaryStream file, ImageMetaData info)
 {
     using (var bmp = OpenBitmapStream(file, file.Signature))
         return(Bmp.Read(bmp, info));
 }
예제 #16
0
파일: Network.cs 프로젝트: melharfi/Nova
        static void client_Disconnected(string reason)
        {
            Enums.DisconnectReason.disconnectReason disconnectReason;

            if (!Enum.TryParse(reason, true, out disconnectReason))
            {
                disconnectReason = DisconnectReason.disconnectReason.OTHER;
            }
            else
            {
                disconnectReason =
                    (Enums.DisconnectReason.disconnectReason)
                    Enum.Parse(typeof(Enums.DisconnectReason.disconnectReason), reason, true);
            }

            switch (disconnectReason)
            {
            case Enums.DisconnectReason.disconnectReason.HOST_UNREACHABLE:
                MessageBox.Show(CommonCode.TranslateText(2) + Environment.NewLine + reason, "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MainForm.DrawDisconnectImg(true);
                GameStates.GameStateManager.ChangeState(new GameStates.LoginMap());
                GameStates.GameStateManager.CheckState();
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.USER_BANNED:
                DialogResult userBannedResult = MessageBox.Show(CommonCode.TranslateText(10), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (userBannedResult == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(MainForm.url);
                }
                GameStates.GameStateManager.ChangeState(new GameStates.LoginMap());
                GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);

                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.MAINTENANCE:
                MessageBox.Show(CommonCode.TranslateText(14), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.RESTARTING:
                MessageBox.Show(CommonCode.TranslateText(15), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.SHUTDOWN:
                MessageBox.Show(CommonCode.TranslateText(16), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.WRONG_CREDENTIALS:
                MessageBox.Show(CommonCode.TranslateText(8), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.IP_BANNED:
                DialogResult ipBannedResult = MessageBox.Show(CommonCode.TranslateText(17), "IP Banned", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (ipBannedResult == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(MainForm.url);
                }
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case Enums.DisconnectReason.disconnectReason.INVALID_TYPES:
                MessageBox.Show(CommonCode.TranslateText(31), "Connexion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                MainForm.DrawDisconnectImg(true);
                Disconnect();
                break;

            case DisconnectReason.disconnectReason.ANOTHER_USER_OVERRIDE_CONNEXION:
                // il faut tester ce mode
                MessageBox.Show(CommonCode.TranslateText(13) + Environment.NewLine + reason, "Connexion Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                Shutdown();
                break;

            case DisconnectReason.disconnectReason.TIME_OUT:
                MessageBox.Show(CommonCode.TranslateText(193) + Environment.NewLine + reason, "Connexion Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                break;

            case Enums.DisconnectReason.disconnectReason.OTHER:
                MessageBox.Show(CommonCode.TranslateText(4) + Environment.NewLine + reason, "Connexion Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                MMORPG.GameStates.GameStateManager.ChangeState(new MMORPG.GameStates.LoginMap());
                MMORPG.GameStates.GameStateManager.CheckState();
                Disconnect();

                if (Manager.manager.mainForm.Controls.Find("username", false).Length == 0)
                {
                    return;
                }
                TextBox username = Manager.manager.mainForm.Controls.Find("username", false)[0] as TextBox;
                username.Enabled = true;
                TextBox password = Manager.manager.mainForm.Controls.Find("password", false)[0] as TextBox;
                password.Enabled = true;

                Bmp ConnexionBtn = Manager.manager.GfxObjList.FindLast(f => f.Name() == "__ConnexionBtn") as Bmp;
                ConnexionBtn.visible = true;
                IGfx __connexionBtnLabel = Manager.manager.GfxObjList.Find(f => f.Name() == "__connexionBtnLabel");
                if (__connexionBtnLabel != null)
                {
                    Manager.manager.GfxObjList.Find(f => f.Name() == "__connexionBtnLabel").Visible(true);
                }
                break;
            }
            Battle.Clear();
            Shutdown();
        }