示例#1
0
    //--------------------------------------------------

    //--------------------------------------------------
    public void EnableMap(MapsManager.MapType map, bool enabled)
    //--------------------------------------------------
    {
        MapsManager mapsManager = m_mapInHierarchy.GetComponent <MapsManager>();

        mapsManager.EnableMap(map, enabled);
    }
示例#2
0
        public void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            CleanUpOldTemps();
            CheckOrPromptForSetup();
            MapsManager.Init(osuSongsFolder);

            string bg = SettingManager.Get("customBgPath");

            if (!string.IsNullOrEmpty(bg))
            {
                SetFormCustomBackground(bg);
            }

            if (SettingManager.Get("overlayMode"))
            {
                // register hotkey, 2|4: CONTROL|SHIFT, 36: HOME
                HotkeyManager.Register(HotkeyManager.GetRuntimeHandle(this), 2 | 4, 36);
                // sub to hotkey press event
                HotkeyManager.HotkeyPressed += HotkeyPressed;
            }


            if (startupHide == true) // can only do this stuff when LOADED.
            {
                HideWindow();        // the uri handler is handling, lets just lay low in the background
            }
            CheckForUpdates();
        }
示例#3
0
    public override void GiveRevard(Player player)
    {
        player.coin += 1;

        transform.position = MapsManager.RandomPos();
        photonView.RPC("SetItemPositionRPC", PhotonTargets.All, transform.position);
    }
示例#4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var DofusPath       = @"C:\Users\NOM D'UTILISATEUR\AppData\Local\Ankama\Dofus";
            var AccountName     = "NomDeCompte";
            var AccountPassword = "******";

            Task.Factory.StartNew(() =>
            {
                MessageReceiver.Initialize();
                ProtocolTypeManager.Initialize();

                Properties.Settings.Default.DofusPath = DofusPath;
                Properties.Settings.Default.Save();

                MapsManager.Init(Properties.Settings.Default.DofusPath + @"\app\content\maps");
                IconsManager.Instance.Initialize(Properties.Settings.Default.DofusPath + @"\app\content\gfx\items");
                ObjectDataManager.Instance.AddReaders(Properties.Settings.Default.DofusPath + @"\app\data\common");
                I18nDataManager.Instance.AddReaders(Properties.Settings.Default.DofusPath + @"\app\data\i18n");
                I18nDataManager.Instance.DefaultLanguage = Languages.French;
                ImageManager.Init(Properties.Settings.Default.DofusPath);
            }).ContinueWith(p =>
            {
                Client = new DofusClient(AccountName, AccountPassword)
                {
                    Debug = false
                };

                Client.Logger.OnLog += Logger_OnLog;
            });
        }
示例#5
0
        public MapMakerF()
        {
            InitializeComponent();
            MinimumSize = MaximumSize = Size;
            MaximizeBox = false;
            Icon        = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            IsMaking = false;

            MapsManager.RemoveMapsFiles();
            Global.Maps.Clear();

            _kindClientStep = new KindClientStep(StepMapChoosen)
            {
                Parent = panel1
            };

            FormClosing += (sender, e) =>
            {
                if (IsMaking)
                {
                    DialogResult = DialogResult.OK;
                    return;
                }

                if (MessageBox.Show("Do you want really quit?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    e.Cancel = true;
                }
                else
                {
                    DialogResult = DialogResult.Abort;
                }
            };
        }
示例#6
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                GlobalConfiguration.Instance.Initialize();

                AccountConfiguration accountToConnect;

                using (var af = new AccountsForm())
                {
                    if (af.ShowDialog() != DialogResult.OK)
                    {
                        Environment.Exit(-1);
                    }

                    accountToConnect = af.AccountToConnect;
                }

                Task.Factory.StartNew(() =>
                {
                    UserData.RegisterAssembly();
                    CommandManager.Build();
                    ProtocolTypeManager.Initialize();

                    Logger.Default.OnLog += Logger_OnLog;

                    Settings.Default.DofusPath = GlobalConfiguration.Instance.DofusPath;
                    Settings.Default.Save();

                    MapsManager.Init(Settings.Default.DofusPath + @"\app\content\maps");
                    IconsManager.Instance.Initialize(Settings.Default.DofusPath + @"\app\content\gfx\items");
                    ObjectDataManager.Instance.AddReaders(Settings.Default.DofusPath + @"\app\data\common");

                    FastD2IReader.Instance.Init(Settings.Default.DofusPath + @"\app\data\i18n" +
                                                "\\i18n_fr.d2i");

                    ImageManager.Init(Settings.Default.DofusPath);
                }).ContinueWith(p =>
                {
                    var fullSocketConfiguration = new FullSocketConfiguration
                    {
                        RealAuthHost = "213.248.126.40",
                        RealAuthPort = 443
                    };

                    var messageReceiver = new MessageReceiver();
                    messageReceiver.Initialize();
                    _fullSocket        = new FullSocket.FullSocket(fullSocketConfiguration, messageReceiver);
                    var dispatcherTask = new DispatcherTask(new MessageDispatcher(), _fullSocket);
                    _account           = _fullSocket.Connect(accountToConnect.Username, accountToConnect.Password, this);
                    LogWelcomeMessage();
                });
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Environment.Exit(-1);
            }
        }
        public static MapElement getMapElement(MapsManager manager)
        {
            element = new MapElement(manager);
            SmallDialog_NewMap dialog = new SmallDialog_NewMap("新建地图", manager.tileGfxManager, true);

            dialog.ShowDialog();
            return(element);
        }
示例#8
0
        public MActorsManager actorsManager = null;    //
        //public ArrayList antetypesList = new ArrayList();
        //public ObjectVector antetypeFolders = new ObjectVector();//角色原型文件夹列表
        public AntetypesManager(MapsManager mapsManagerT, MActorsManager actorsManagerT)
        {
            mapsManager   = mapsManagerT;
            actorsManager = actorsManagerT;
            AntetypeFolder defFolder = new AntetypeFolder(this);

            this.Add(defFolder);
        }
示例#9
0
        public TileGfxManager(MapsManager mapsManagerT, MImgsManager imagesManagerT)
        {
            mapsManager   = mapsManagerT;
            imagesManager = imagesManagerT;
            //加入默认文件夹
            TileGfxContainer gfxContainer = new TileGfxContainer(this);

            this.Add(gfxContainer);
        }
示例#10
0
 //雪的效果:暂停一回合
 private void DoSnow()
 {
     if (item == Items.Snow)
     {
         infoText.text = "由于天气寒冷,暂停一回合";
         MapsManager mm = new MapsManager();
         mm.BePaused();
     }
 }
示例#11
0
 private void DoEnd()
 {
     if (item == Items.End)
     {
         infoText.text = "恭喜你,到达终点!";
         MapsManager mm = GameObject.Find("Map").GetComponent <MapsManager>();
         mm.GameOver();
     }
 }
 public TilePhysicsManager cloneForExport(MapsManager mapsManagerT)
 {
     TilePhysicsManager newInstance = new TilePhysicsManager(mapsManagerT);
     for (int i = 0; i < getElementCount(); i++)
     {
         TilePhysicsElement elementI = getElement(i);
         newInstance.addElement(elementI.clone(newInstance));
     }
     return newInstance;
 }
示例#13
0
        private void HandleFilesHashesMessage(FilesHashesMessage message)
        {
            Application.Current.Dispatcher.Invoke(async() =>
            {
                // Updater
                if (await this.ShowUpdatesAsync(message.FilesHashes))
                {
                    Environment.Exit(0);
                    return;
                }

                // Loading
                try
                {
                    var controller = await this.ShowProgressAsync(LanguageManager.Translate("483"), Randomize.GetRandomLoadingText());

                    await Task.Run(async() =>
                    {
                        Protocol.Messages.MessagesBuilder.Initialize();
                        controller.SetProgress(0.14);
                        await Task.Delay(200);

                        TypesBuilder.Initialize();
                        controller.SetProgress(0.28);
                        await Task.Delay(200);

                        DataManager.Initialize(DTConstants.AssetsVersion, GlobalConfiguration.Instance.Lang);
                        controller.SetProgress(0.42);
                        await Task.Delay(200);

                        MapsManager.Initialize(DTConstants.AssetsVersion);
                        controller.SetProgress(0.56);
                        await Task.Delay(200);

                        FramesManager.Initialize();
                        controller.SetProgress(0.70);
                        await Task.Delay(200);

                        CommandsHandler.Initialize();

                        BreedsUtility.Initialize();
                        controller.SetProgress(1);
                        await Task.Delay(200);

                        LuaScriptManager.Initialize();
                    });

                    await controller.CloseAsync();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            });
        }
示例#14
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#15
0
        public TilePhysicsManager cloneForExport(MapsManager mapsManagerT)
        {
            TilePhysicsManager newInstance = new TilePhysicsManager(mapsManagerT);

            for (int i = 0; i < getElementCount(); i++)
            {
                TilePhysicsElement elementI = getElement(i);
                newInstance.addElement(elementI.clone(newInstance));
            }
            return(newInstance);
        }
示例#16
0
        public TileGfxContainer cloneForExceport(MapsManager mapsManager, MImgsManager imagesManager)
        {
            TileGfxContainer newInstance = new TileGfxContainer((TileGfxManager)parent, name);

            for (int i = 0; i < Count(); i++)
            {
                TileGfxElement baseClip    = (TileGfxElement)this[i];
                TileGfxElement newBaseClip = baseClip.Clone(newInstance);
                newBaseClip.imageElement = imagesManager[newBaseClip.imageElement.GetID()];
                newInstance.Add(newBaseClip);
            }
            return(newInstance);
        }
示例#17
0
        //复制自己
        public TileGfxManager cloneForExport(MapsManager mapsManagerT, MImgsManager imagesManagerT)
        {
            TileGfxManager newInstance = new TileGfxManager(mapsManagerT, imagesManagerT);

            newInstance.RemoveAt(0);
            for (short i = 0; i < this.Count(); i++)
            {
                TileGfxContainer gfxContainer    = this[i];
                TileGfxContainer newGfxContainer = gfxContainer.cloneForExceport(mapsManagerT, imagesManagerT);
                newInstance.Add(newGfxContainer);
            }
            return(newInstance);
        }
示例#18
0
 public ActionResult Edit([Bind(Include = "id,nickname,number,address,lat,lgt,photo")] Formulist formulist)
 {
     if (ModelState.IsValid)
     {
         MapsManager map = new MapsManager();
         map.ParseAddress(formulist.address);
         formulist.lat             = map.Lat;
         formulist.lgt             = map.Lng;
         db.Entry(formulist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(formulist));
 }
示例#19
0
 /// <summary>
 /// Jeśli stworzysz pokój (czyli jesteś serverem) to w scenie roboczej
 /// Spawnisz mape i boty dla wszystkich graczy
 /// oraz w tym mejscu informujesz przyszłych graczy że dołączyłeś
 /// </summary>
 void OnCreatedRoom()
 {
     if (PhotonNetwork.isMasterClient)
     {
         Maps map = Maps.Village;
         //Maps map = MapsManager.RandomMapType();
         GameManager.Instance.GetGameplay().currentMap = map;
         MapsManager.AsMasterSpawnMapForAllPlayers(map);
         //MapData mapData = MapsManager.Instance.GetMapData(map);
         //BotsManager.Instance.AsMasterSpawnBotsForAllPlayers(mapData);
         //ItemManager.Instance.AsServerSpawnItemsForAllPlayers(mapData);
         photonView.RPC("InitPlayer", PhotonTargets.All, PhotonNetwork.player); //Tak naprawdę wysyłasz to tylko sobie
     }
 }
示例#20
0
文件: Map.cs 项目: Teles1/Cookie
        private void UpdateMapControl()
        {
            /////// MAPCONTROL ///////
            if (Data != null)
            {
                var tmp = MapsManager.FromId(Id);
                tmp.Cells.ForEachWithIndex((cellData, index) =>
                {
                    var cell  = ((Account)_account).MainForm.mapControl.GetCell(index);
                    cell.Text = cell.Id.ToString();
                    if (cellData.Los)
                    {
                        cell.State = CellState.NonWalkable;
                    }
                    if (cellData.Mov)
                    {
                        cell.State = CellState.Walkable;
                    }
                });

                foreach (var npc in Npcs)
                {
                    ((Account)_account).MainForm.mapControl.Entities.Remove(
                        ((Account)_account).MainForm.mapControl.Entities.Find(m => m.ID == npc.Id));
                    ((Account)_account).MainForm.mapControl.Entities.Add(new MapEntity(npc.Id, npc.CellId, Color.Yellow));
                }

                foreach (var g in Monsters)
                {
                    ((Account)_account).MainForm.mapControl.Entities.Remove(((Account)_account).MainForm.mapControl.Entities.Find(m => m.ID == g.Id));
                    ((Account)_account).MainForm.mapControl.Entities.Add(new MapEntity(g.Id, g.CellId, Color.Red));
                }

                foreach (var p in Players)
                {
                    ((Account)_account).MainForm.mapControl.Entities.Remove(
                        ((Account)_account).MainForm.mapControl.Entities.Find(m => m.ID == p.Id));
                    ((Account)_account).MainForm.mapControl.Entities.Add(new MapEntity(p.Id, p.CellId, Color.Blue));
                }
                foreach (var r in Resources)
                {
                    ((Account)_account).MainForm.mapControl.Entities.Remove(
                        ((Account)_account).MainForm.mapControl.Entities.Find(m => m.ID == r.Id));
                    ((Account)_account).MainForm.mapControl.Entities.Add(new MapEntity(r.Id, r.CellId, Color.Green));
                }
                ((Account)_account).MainForm.mapControl.Invalidate();
            }
            /////// MAPCONTROL ///////
        }
示例#21
0
 //清除所有图形元素
 public void clearAllElement()
 {
     //清除地图引用
     for (int i = 0; i < Count(); i++)
     {
         TileGfxElement element     = (TileGfxElement)this[i];
         MapsManager    mapsManager = ((TileGfxManager)parent).mapsManager;
         for (int j = 0; j < mapsManager.Count(); j++)
         {
             MapElement map = mapsManager[j];
             map.deleteTileUsed(element);
         }
     }
     Clear();
 }
示例#22
0
文件: Map.cs 项目: Teles1/Cookie
        private void HandleMapComplementaryInformationsDataMessage(IAccount account,
                                                                   MapComplementaryInformationsDataMessage message)
        {
            lock (CheckLock)
            {
                SubAreaId = message.SubAreaId;
                Data      = MapsManager.FromId(message.MapId);
                var subArea = ObjectDataManager.Instance.Get <SubArea>(SubAreaId);
                var mapName =
                    FastD2IReader.Instance.GetText(ObjectDataManager.Instance.Get <Area>(subArea.AreaId).NameId);
                var subAreaName = FastD2IReader.Instance.GetText(subArea.NameId);
                Position = $"[{X}, {Y}]";
                Zone     = $"{mapName} ({subAreaName})";
                Entities.Clear();
                Monsters.Clear();
                Npcs.Clear();
                Players.Clear();
                Resources.Clear();
                AddActors(message.Actors);
                StatedElements.Clear();
                //Populate the StateElements with new ones received.
                //StatesElements are the elements which our current bot in theory can harvest.
                foreach (var statedElement in message.StatedElements)
                {
                    if (!StatedElements.ContainsKey(statedElement.ElementId))
                    {
                        StatedElements.Add(statedElement.ElementId, new StatedElement(statedElement.ElementCellId, (uint)statedElement.ElementId, statedElement.ElementState));
                    }
                }
                InteractiveElements.Clear();
                Doors.Clear();
                //populate the interactiveElements which are essencially items that we can interact with. Their location is hardcoded into the map.layer
                foreach (var interactiveElement in message.InteractiveElements)
                {
                    if (!InteractiveElements.ContainsKey(interactiveElement.ElementId))
                    {
                        InteractiveElements.Add(interactiveElement.ElementId, new InteractiveElement((uint)interactiveElement.ElementId, interactiveElement.ElementTypeId, interactiveElement.EnabledSkills, interactiveElement.DisabledSkills));
                    }
                }
            }

            UpdateMapControl();

            OnMapChanged();
        }
示例#23
0
文件: MainForm.cs 项目: Mixi59/Cookie
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                var accountFile = File.ReadAllText(Directory.GetCurrentDirectory() + "/config/account.txt");
                var dofusPath   = File.ReadAllText(Directory.GetCurrentDirectory() + "/config/dofuspath.txt");

                var accountName     = accountFile.Split(':')[0];
                var accountPassword = accountFile.Split(':')[1];

                Task.Factory.StartNew(() =>
                {
                    CommandManager.Build();
                    MessageReceiver.Initialize();
                    ProtocolTypeManager.Initialize();

                    Settings.Default.DofusPath = dofusPath;
                    Settings.Default.Save();

                    MapsManager.Init(Settings.Default.DofusPath + @"\app\content\maps");
                    IconsManager.Instance.Initialize(Settings.Default.DofusPath + @"\app\content\gfx\items");
                    ObjectDataManager.Instance.AddReaders(Settings.Default.DofusPath + @"\app\data\common");

                    FastD2IReader.Instance.Init(Settings.Default.DofusPath + @"\app\data\i18n" +
                                                "\\i18n_fr.d2i");

                    ImageManager.Init(Settings.Default.DofusPath);
                }).ContinueWith(p =>
                {
                    _client = new DofusClient(accountName, accountPassword)
                    {
                        Debug = true
                    };

                    _client.Logger.OnLog += Logger_OnLog;
                });
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Environment.Exit(-1);
            }
        }
示例#24
0
        public ActionResult Create([Bind(Include = "id,nickname,number,address,lat,lgt,photo")] Formulist formulist)
        {
            if (ModelState.IsValid)
            {
                MapsManager map = new MapsManager();
                map.ParseAddress(formulist.address);
                formulist.lat  = map.Lat;
                formulist.lgt  = map.Lng;
                formulist.foto = "https://www.videosharp.info/users/" +
                                 formulist.number + "/avatar/" +
                                 formulist.number + "_avatar_1.jpg";

                db.MyFormulist.Add(formulist);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(formulist));
        }
示例#25
0
        private void TilesExplorer_Load(object sender, EventArgs e)
        {
            try
            {
                MapsManager.Initialize(AppDomain.CurrentDomain.BaseDirectory + @"\data\maps");

                foreach (var name in TextureManager.Instance.GetAllTilesFolders())
                {
                    TreeNode   node2    = new TreeNode("Sols");
                    TreeNode   node3    = new TreeNode("Objects");
                    TreeNode[] array    = new TreeNode[] { node2, node3 };
                    var        treeNode = new TreeNode(name, array);
                    treeView1.Nodes.Add(treeNode);
                }
            }
            catch (Exception m)
            {
            }

            //UIManager.Instance.EditorForm.Focus();
        }
        //初始化参数===========================================================
        public void initData(String path)
        {
            path_file = path;
            path_folder = path_file.Substring(0, path_file.LastIndexOf('\\') + 1);

            m_HistoryManager = new UndoManager();
            m_HistoryManager.MaxUndoLevel = 100;
            textsManager = new TextsManager(this);

            mapImagesManager = new MImgsManager(this);
            mapsManager = new MapsManager(this, mapImagesManager);

            varIntManager = new VarsManager(this);
            varStringManager = new VarsManager(this);
            triggerFunctionManager = new FunctionsManager(this);
            contextFunctionManager = new FunctionsManager(this);
            executionFunctionManager = new FunctionsManager(this);
            iDsManager = new VarsManager(this);
            propertyTypesManager = new PropertyTypesManager(this);

            form_MAnimation = new Form_MAnimation(this);
            mapsManager.initAntetype(form_MAnimation.form_MActorList.actorsManager);
            if (Consts.PATH_PROJECT_FILEPATH != null)
            {
                this.Text = Consts.PATH_PROJECT_FILEPATH;
            }
            userDoc.initUserData(path);//读入数据
        }
        static void Main(string[] args)
        {
            List <Test> list = new List <Test>();

            MapsManager.Initialize(@"E:\Jeux\Ankama\Dofus\app\content\maps");
            I18nDataManager.Instance.AddReaders(@"E:\Jeux\Ankama\Dofus\app\data\i18n");
            ObjectDataManager.Initialize(@"E:\Jeux\Ankama\Dofus\app\data\common");
            EleReader elementManager = new EleReader(@"E:\Jeux\Ankama\Dofus\app\content\maps\elements.ele");
            var       instance       = elementManager.ReadElements();
            var       maps           = MapsManager.ParseAllMaps();

            int i = 0;

            foreach (var map in maps)
            {
                Console.Title = "triages de tiles : " + i.ToString() + @"/" + (maps.Count - 1).ToString();

                var subArea = ObjectDataManager.Get <SubArea>(map.SubAreaId);
                var name    = I18nDataManager.Instance.GetText((int)subArea.nameId);

                var area  = ObjectDataManager.Get <Area>(subArea.areaId);
                var namel = I18nDataManager.Instance.GetText((int)area.nameId);

                if (!list.Any(x => x.Name == name))
                {
                    list.Add(new Test()
                    {
                        Name = name
                    });
                }

                var zone = list.First(x => x.Name == name);

                for (int j = 0; j <= 1; j++) // sols
                {
                    if (!map.Layers.Any(x => x.LayerId == j))
                    {
                        continue;
                    }

                    var layer = map.Layers.First(x => x.LayerId == j);

                    foreach (var cell in layer.Cells)
                    {
                        foreach (var element in cell.Elements)
                        {
                            if (element is GraphicalElement) //test
                            {
                                var ele = instance.GraphicalDatas.FirstOrDefault(x => x.Value.Id == (element as GraphicalElement).ElementId).Value as NormalGraphicalElementData;
                                if (ele == null)
                                {
                                    continue;
                                }
                                if (!zone.Sols.Any(x => x == ele.Gfx))
                                {
                                    zone.Sols.Add(ele.Gfx);
                                }
                            }
                        }
                    }
                }
                for (int j = 2; j <= 3; j++) // sols
                {
                    if (!map.Layers.Any(x => x.LayerId == j))
                    {
                        continue;
                    }

                    var layer = map.Layers.First(x => x.LayerId == j);

                    foreach (var cell in layer.Cells)
                    {
                        foreach (var element in cell.Elements)
                        {
                            if (element is GraphicalElement) //test
                            {
                                var ele = instance.GraphicalDatas.FirstOrDefault(x => x.Value.Id == (element as GraphicalElement).ElementId).Value as NormalGraphicalElementData;
                                if (ele == null)
                                {
                                    continue;
                                }

                                if (!zone.Objects.Any(x => x == ele.Gfx))
                                {
                                    zone.Objects.Add(ele.Gfx);
                                }
                            }
                        }
                    }
                }
                i++;
            }


            //}
            BigEndianWriter writer = new BigEndianWriter();

            foreach (var zone in list)
            {
                writer.WriteUTF(zone.Name);
                writer.WriteInt(zone.Sols.Count);
                foreach (var tile in zone.Sols)
                {
                    writer.WriteInt(tile);
                }

                writer.WriteInt(zone.Objects.Count);
                foreach (var tile in zone.Objects)
                {
                    writer.WriteInt(tile);
                }
            }


            File.WriteAllBytes("Test.data", writer.Data);
        }
示例#28
0
        private async void StepGenerateMaps(int choise, List <MapEntry> maps)
        {
            switch (choise)
            {
            case 0:     // download
                _originalMapStep.Visible = false;
                _creationMapsStep        = new CreationMapsStep {
                    Parent = panel1
                };

                await _creationMapsStep.ExecuteAction(choise, maps);

                //Global.Maps.AddRange(maps);
                foreach (MapEntry map in maps)
                {
                    Global.Maps[map.Index] = map;
                }

                MapsManager.SaveMaps();
                CloseSafe();
                break;

            case 1:     // generate classic
            {
                _originalMapStep.Visible = false;


                FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
                folderBrowserDialog.Description = "Select Ultima Online directory";
                while (true)
                {
                    DialogResult result = folderBrowserDialog.ShowDialog();
                    if (result == DialogResult.Cancel)
                    {
                        Process.GetCurrentProcess().Kill();
                    }
                    else if (result == DialogResult.OK)
                    {
                        DirectoryInfo info = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                        if (info.Exists && info.EnumerateFiles().Where(s => (s.Name.Contains("map") || s.Name.Contains("facet")) && (s.Extension == ".uop" || s.Extension == ".mul" || s.Extension == ".dds")).Count() > 0)
                        {
                            Global.UOPath = folderBrowserDialog.SelectedPath;
                            break;
                        }

                        MessageBox.Show("Wrong directory selected.");
                    }
                }

                _creationMapsStep = new CreationMapsStep {
                    Parent = panel1
                };

                await _creationMapsStep.ExecuteAction(choise, maps);

                foreach (MapEntry map in maps)
                {
                    Global.Maps[map.Index] = map;
                }
                MapsManager.SaveMaps();
                CloseSafe();
            }
            break;

            case 2:     // generate custom
            {
                _customMapStep.Visible = false;

                FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
                folderBrowserDialog.Description = "Select Ultima Online directory";

                while (true)
                {
                    DialogResult result = folderBrowserDialog.ShowDialog();
                    if (result == DialogResult.Cancel)
                    {
                        Process.GetCurrentProcess().Kill();
                    }
                    else if (result == DialogResult.OK)
                    {
                        DirectoryInfo info = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                        if (info.Exists && info.EnumerateFiles().Where(s => (s.Name.Contains("map") || s.Name.Contains("facet")) && (s.Extension == ".uop" || s.Extension == ".mul" || s.Extension == ".dds")).Count() > 0)
                        {
                            Global.UOPath = folderBrowserDialog.SelectedPath;
                            break;
                        }

                        MessageBox.Show("Wrong directory selected.");
                    }
                }

                _creationMapsStep = new CreationMapsStep {
                    Parent = panel1
                };


                await _creationMapsStep.ExecuteAction(choise, maps);

                foreach (MapEntry map in maps)
                {
                    Global.Maps[map.Index] = map;
                }
                MapsManager.SaveMaps();
                CloseSafe();
            }
            break;

            case 3:     // back
                if (panel1.Contains(_originalMapStep))
                {
                    panel1.Controls.Remove(_originalMapStep);
                }
                else if (panel1.Contains(_customMapStep))
                {
                    panel1.Controls.Remove(_customMapStep);
                }

                _kindClientStep.Visible = true;
                break;
            }
        }
示例#29
0
        private static void CheckBlueSheepDatas()
        {
            // Create the BlueSheep needed folders
            string applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string blueSheepPath       = Path.Combine(applicationDataPath, "BlueSheep");

            if (!Directory.Exists(blueSheepPath))
            {
                Directory.CreateDirectory(blueSheepPath);
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Accounts")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Accounts")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Groups")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Groups")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Temp")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Temp")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Paths")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Paths")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "IAs")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "IAs")).Attributes = FileAttributes.Normal;
            }
            if (!Directory.Exists(Path.Combine(blueSheepPath, "Logs")))
            {
                Directory.CreateDirectory(Path.Combine(blueSheepPath, "Logs")).Attributes = FileAttributes.Normal;
            }

            string bsConfPath = Path.Combine(blueSheepPath, "bs.conf");

            if (File.Exists(bsConfPath))
            {
                StreamReader sr   = new StreamReader(bsConfPath);
                string       path = sr.ReadLine();
                if (Directory.Exists(Path.Combine(path, "app", "content", "maps")))
                {
                    ActualMainForm.DofusPath = path;
                }
                else
                {
                    sr.Close();
                    DofusPathForm frm = new DofusPathForm(ActualMainForm);
                    frm.ShowDialog();
                }
            }
            else
            {
                DofusPathForm frm = new DofusPathForm(ActualMainForm);
                frm.ShowDialog();
            }


            FileInfo fileInfo = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Logs.txt");

            fileInfo.Delete();
            using (fileInfo.Create())
            {
            }

            //fileInfo = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Packets.txt");
            //fileInfo.Delete();
            //using (fileInfo.Create())
            //{
            //}


            I18NFileAccessor i18NFileAccessor = new I18NFileAccessor();

            if (File.Exists(@"C:\Program Files (x86)\Dofus2\app\data\i18n\i18n_fr.d2i"))
            {
                string path = @"C:\Program Files (x86)\Dofus2\app\data\i18n\i18n_fr.d2i";
                i18NFileAccessor.Init(path);
                I18N i18N = new I18N(i18NFileAccessor);
                GameData.Init(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                              + @"\Dofus2\app\data\common");
                MapsManager.Init(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                                 + @"\Dofus2\app\content\maps");
            }
            else if (File.Exists(bsConfPath))
            {
                List <string> PaysList = new List <string>();
                PaysList.AddRange(new List <string>()
                {
                    "fr", "en", "ja", "es", "de", "pt"
                });
                foreach (string pays in PaysList)
                {
                    string combinedPath = Path.Combine(ActualMainForm.DofusPath, "app", "data", "i18n", "i18n_" + pays + ".d2i");
                    if (File.Exists(combinedPath))
                    {
                        i18NFileAccessor.Init(combinedPath);
                        break;
                    }
                }
                I18N i18N = new I18N(i18NFileAccessor);
                GameData.Init(Path.Combine(ActualMainForm.DofusPath, "app", "data", "common"));
                MapsManager.Init(Path.Combine(ActualMainForm.DofusPath, "app", "content", "maps"));
            }
            //else
            //{
            //    i18NFileAccessor.Init(Path.Combine(ActualMainForm.DofusPath, "app", "data", "i18n", "i18n_fr.d2i"));
            //    I18N i18N = new I18N(i18NFileAccessor);
            //    GameData.Init(@"D:\Dofus2\app\data\common");
            //    MapsManager.Init(@"D:\Dofus2\app\content\maps");
            //}
            IntelliSense.InitMonsters();
            IntelliSense.InitItems();
            IntelliSense.InitServers();
        }
 public static MapElement getMapElement(MapsManager manager)
 {
     element = new MapElement(manager);
     SmallDialog_NewMap dialog = new SmallDialog_NewMap("新建地图", manager.tileGfxManager,true);
     dialog.ShowDialog();
     return element;
 }
        public void resExport_Map(String subFolderName,  String strFormat, SmallDialog_ExportConfig dialogRes)
        {
            mapImgsManagerForExport = mapImagesManager.Clone();
            mapsManagerForExport = mapsManager.cloneForExport(mapImgsManagerForExport);
            mapsManagerForExport.tileGfxManager.clearSpilth(false);
            //新生成的图片组
            MImgsManager mImgsManagerGenerated = new MImgsManager();
            //获取链接分组列表
            List<List<MImgElement>> allGroups = mapImgsManagerForExport.getAllUsedGroups();
            //处理优化分组
            for (int i = 0; i < allGroups.Count - 1; i++)
            {
                List<MImgElement> group = allGroups[i];
                Size needSize;
                int usedSpace;
                Image imgExort;
                MImgElement imgElement = MImgsManager.optimizeClips(group, out needSize, out usedSpace, out imgExort, true);
                mImgsManagerGenerated.Add(imgElement);
                SaveGenImage(strFormat, subFolderName, imgElement);
            }
            //处理禁止优化分组
            List<MImgElement> groupForbidOpt = allGroups[allGroups.Count - 1];
            foreach (MImgElement imgElement in groupForbidOpt)
            {
                mImgsManagerGenerated.Add(imgElement);
                imgElement.image = GraphicsUtil.getMatchImage((Bitmap)imgElement.image);
                SaveGenImage(strFormat, subFolderName, imgElement);
            }
            //变更图片管理器
            mapImgsManagerForExport = mImgsManagerGenerated;
            mapsManagerForExport.tileGfxManager.imagesManager = mapImgsManagerForExport;

            dialogRes.setStep(1, 1);
        }
 public void releaseRes()
 {
     m_HistoryManager=null;
     textsManager = null;
     mapImagesManager = null;
     mapsManager = null;
     varIntManager = null;
     varStringManager = null;
     triggerFunctionManager = null;
     contextFunctionManager = null;
     executionFunctionManager = null;
     //triggersManager = null;
     propertyTypesManager = null;
 }
示例#33
0
        public static void MapComplementaryInformationsWithCoordsMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            MapComplementaryInformationsWithCoordsMessage msg = (MapComplementaryInformationsWithCoordsMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            account.Map.SubAreaId = msg.subAreaId;
            account.Map.Data      = MapsManager.FromId(msg.mapId);
            DataClass subArea     = GameData.GetDataObject(D2oFileEnum.SubAreas, (int)msg.subAreaId);
            string    mapName     = I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Areas, (int)subArea.Fields["areaId"]).Fields["nameId"]);
            string    subAreaName = I18N.GetText((int)subArea.Fields["nameId"]);

            account.ModifBar(5, 0, 0, "[" + msg.worldX + ";" + msg.worldY + "]" + " " + mapName + " (" + subAreaName + ")");
            account.Map.Entities.Clear();
            account.Map.List.Clear();
            account.Enable(true);
            foreach (GameRolePlayActorInformations actor in msg.actors)
            {
                account.Map.Entities.Add(new BlueSheep.Core.Fight.Entity(actor.contextualId, actor.disposition.cellId));
                if (actor is GameRolePlayGroupMonsterInformations)
                {
                    GameRolePlayGroupMonsterInformations a = (GameRolePlayGroupMonsterInformations)actor;
                    account.Map.List.Add(new MonsterGroup(a.staticInfos, a.disposition.cellId, a.contextualId));
                }
            }
            account.Map.StatedElements.Clear();
            foreach (var statedElementDofus in msg.statedElements)
            {
                if (!(account.Map.StatedElements.ContainsKey(statedElementDofus.elementId)))
                {
                    account.Map.StatedElements.Add(statedElementDofus.elementId, new BlueSheep.Core.Map.Elements.StatedElement((uint)statedElementDofus.elementCellId, (uint)statedElementDofus.elementId, (uint)statedElementDofus.elementState));
                }
            }
            account.Map.InteractiveElements.Clear();
            account.Map.Doors.Clear();
            foreach (var element in msg.interactiveElements)
            {
                account.Map.InteractiveElements.Add(element.elementId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills)));
                InteractiveElement interactiveElement = element;
                List <int>         listDoorSkillId    = new List <int>(new[] { 184, 183, 187, 198, 114 });
                List <int>         listDoorTypeId     = new List <int>(new[] { -1, 128, 168, 16 });
                if (listDoorTypeId.Contains(interactiveElement.elementTypeId) && (interactiveElement.enabledSkills.Length > 0) && (listDoorSkillId.Contains(interactiveElement.enabledSkills[0].skillId)))
                {
                    foreach (var layer in ((BlueSheep.Data.D2p.Map)account.Map.Data).Layers)
                    {
                        foreach (var cell in layer.Cells)
                        {
                            foreach (var layerElement in cell.Elements)
                            {
                                if (layerElement is GraphicalElement)
                                {
                                    GraphicalElement graphicalElement = (GraphicalElement)layerElement;
                                    if ((graphicalElement.Identifier == interactiveElement.elementId) && !(account.Map.Doors.ContainsKey(cell.CellId)))
                                    {
                                        account.Map.Doors.Add(cell.CellId, new BlueSheep.Core.Map.Elements.InteractiveElement((uint)element.elementId, element.elementTypeId, new List <InteractiveElementSkill>(element.enabledSkills), new List <InteractiveElementSkill>(element.disabledSkills)));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            account.Npc.Npcs.Clear();
            foreach (GameRolePlayActorInformations a in msg.actors)
            {
                if (a is GameRolePlayNpcInformations)
                {
                    account.Npc.Npcs.Add(a.contextualId, ((GameRolePlayNpcInformations)a).npcId);
                }
            }
            if (account.Path != null)
            {
                if (account.Path.Current_Flag == "<Fight>" && account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString())
                {
                    if (account.Fight.SearchFight() == false)
                    {
                        account.Path.PerformActionsStack();
                    }
                }
                else if (account.Path != null & account.state != Enums.Status.Fighting && account.Path.Current_Map == account.Map.X.ToString() + "," + account.Map.Y.ToString())
                {
                    account.Path.PerformActionsStack();
                }
                else if (account.Path != null & account.Path.Current_Map != account.Map.X.ToString() + "," + account.Map.Y.ToString() || account.Map.Id != account.Map.LastMapId)
                {
                    //account.Path.Stop = false;
                    account.Path.Start();
                }
            }
        }
示例#34
0
        private void HandleMapComplementaryInformationsDataMessage(IAccount account,
                                                                   MapComplementaryInformationsDataMessage message)
        {
            lock (CheckLock)
            {
                SubAreaId = message.SubAreaId;
                Data      = MapsManager.FromId(message.MapId);

                var subArea = ObjectDataManager.Instance.Get <SubArea>(SubAreaId);
                var mapName =
                    FastD2IReader.Instance.GetText(ObjectDataManager.Instance.Get <Area>(subArea.AreaId).NameId);
                var subAreaName = FastD2IReader.Instance.GetText(subArea.NameId);
                Position = $"[{X}, {Y}]";
                Zone     = $"{mapName} ({subAreaName})";
                Entities.Clear();
                Monsters.Clear();
                Npcs.Clear();
                Players.Clear();
                AddActors(message.Actors);
                StatedElements.Clear();
                foreach (var statedElementDofus in message.StatedElements)
                {
                    if (!StatedElements.ContainsKey(statedElementDofus.ElementId) && statedElementDofus.OnCurrentMap)
                    {
                        StatedElements.Add(statedElementDofus.ElementId,
                                           new StatedElement(statedElementDofus.ElementCellId, (uint)statedElementDofus.ElementId,
                                                             statedElementDofus.ElementState));
                    }
                }
                InteractiveElements.Clear();
                Doors.Clear();
                foreach (var element in message.InteractiveElements)
                {
                    if (!element.OnCurrentMap)
                    {
                        continue;
                    }
                    InteractiveElements.Add(element.ElementId,
                                            new InteractiveElement((uint)element.ElementId, element.ElementTypeId,
                                                                   element.EnabledSkills.ToList(), element.DisabledSkills.ToList()));
                    var interactiveElement = element;
                    var listDoorSkillId    = new List <int>(new[] { 184, 183, 187, 198, 114 });
                    var listDoorTypeId     = new List <int>(new[] { -1, 128, 168, 16 });
                    if (!listDoorTypeId.Contains(interactiveElement.ElementTypeId) ||
                        interactiveElement.EnabledSkills.Count <= 0 ||
                        !listDoorSkillId.Contains((int)interactiveElement.EnabledSkills[0].SkillId))
                    {
                        continue;
                    }
                    foreach (var layer in ((API.Gamedata.D2p.Map)Data).Layers)
                    {
                        foreach (var cell in layer.Cells)
                        {
                            foreach (var layerElement in cell.Elements)
                            {
                                if (layerElement is GraphicalElement graphicalElement)
                                {
                                    if (graphicalElement.Identifier == interactiveElement.ElementId &&
                                        !Doors.ContainsKey(cell.CellId))
                                    {
                                        Doors.Add(cell.CellId,
                                                  new InteractiveElement((uint)element.ElementId, element.ElementTypeId,
                                                                         element.EnabledSkills.ToList(), element.DisabledSkills.ToList()));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            UpdateMapControl();

            OnMapChanged();
        }
示例#35
0
        public Task ExecuteAction(int cmd, List <MapEntry> maps)
        {
            return(Task.Run(() =>
            {
                switch (cmd)
                {
                case 0:     // download
                    {
                        try
                        {
                            const string MAPS_DOWNLOAD_URL = "http://razorenhanced.org/download/EnhancedMapMaps/";

                            using (WebClient wc = new WebClient {
                                Proxy = null
                            })
                            {
                                wc.DownloadProgressChanged += (sender, e) =>
                                {
                                    //_progress.Report(e.ProgressPercentage.ToString());
                                    _progress.Report("Downloading: " + Utility.GetSizeAdaptive(e.BytesReceived) + "/" + Utility.GetSizeAdaptive(e.TotalBytesToReceive));
                                };

                                if (!Directory.Exists("Maps"))
                                {
                                    Directory.CreateDirectory("Maps");
                                }


                                for (int i = 0; i < 6; i++)
                                {
                                    string map = "2Dmap" + i + ".png";
                                    wc.DownloadFileTaskAsync(new Uri(MAPS_DOWNLOAD_URL + map), Path.Combine("Maps", map)).Wait();
                                }

                                for (int i = 0; i < 6; i++)
                                {
                                    string map = "map" + i + ".png";
                                    wc.DownloadFileTaskAsync(new Uri(MAPS_DOWNLOAD_URL + map), Path.Combine("Maps", map)).Wait();
                                }
                            }
                        }
                        catch (WebException webEx)
                        {
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    break;

                case 1:     // generate original
                    {
                        MapsManager.CreateImages(maps, true, _progress);
                        MapsManager.CreateImages(maps, false, _progress);
                    }
                    break;

                case 2:     // generate custom
                    {
                        if (maps != null)
                        {
                            MapsManager.CreateImages(maps, true, _progress);
                            MapsManager.CreateImages(maps, false, _progress);
                        }
                    }
                    break;
                }
            }));
        }
 public TilePhysicsManager(MapsManager mapsManagerT)
 {
     mapsManager = mapsManagerT;
 }