Пример #1
0
        public BuildingEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            Manager   = new MapTerrainStructure(sav);
            SAV       = sav;
            Buildings = Manager.Buildings;

            Scale1           = new int[Manager.Terrain.MapWidth * Manager.Terrain.MapHeight];
            ScaleX           = new int[Scale1.Length * scale * scale];
            Map              = new Bitmap(Manager.Terrain.MapWidth * scale, Manager.Terrain.MapHeight * scale);
            NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
            NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;

            foreach (var obj in Manager.Buildings)
            {
                LB_Items.Items.Add(obj.ToString());
            }

            LB_Items.SelectedIndex = 0;
            foreach (var entry in HelpDictionary)
            {
                CB_StructureType.Items.Add(entry.Key);
            }
            CB_StructureType.SelectedIndex = 0;

            DialogResult = DialogResult.Cancel;
        }
Пример #2
0
        public FieldItemEditor(MainSave sav)
        {
            SAV = sav;
            InitializeComponent();

            Items = new FieldItemManager(SAV.GetFieldItems());

            var l1 = Items.Layer1;

            Scale1    = new int[l1.GridWidth * l1.GridHeight];
            ScaleX    = new int[Scale1.Length * AcreScale * AcreScale];
            ScaleAcre = new Bitmap(l1.GridWidth * AcreScale, l1.GridHeight * AcreScale);

            Map        = new int[l1.MapWidth * l1.MapHeight * MapScale * MapScale];
            MapReticle = new Bitmap(l1.MapWidth * MapScale, l1.MapHeight * MapScale);

            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            PG_Tile.SelectedObject = new FieldItem();
            CB_Acre.SelectedIndex  = 0;
            LoadGrid(X, Y);
        }
Пример #3
0
 public static int Sign(long GroupID, long QQ)
 {
     using (var db = GetInstance())
     {
         var result = db.Ado.UseTran(() =>
         {
             var query         = GetUser(GroupID, QQ, db);
             long timestamp    = query.timestamp.GetValueOrDefault(0);
             DateTime dtStart  = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
             TimeSpan toNow    = new TimeSpan(timestamp * 10000000);
             DateTime targetDt = dtStart.Add(toNow);
             if (targetDt.Day != DateTime.Now.Day && targetDt.Year != DateTime.Now.Year &&
                 targetDt.Month != DateTime.Now.Month)
             {
                 Random rd       = new Random();
                 query.timestamp = MainSave.GetTimeStamp();
                 query.diamond  += rd.Next(PublicArgs.signmin, PublicArgs.signmax);
                 query.sign_count++;
                 db.Updateable(query).WhereColumns(x => x.qq).WhereColumns(x => x.fromgroup)
                 .ExecuteCommand();
                 return(query.diamond.GetValueOrDefault(0));
             }
             return(-1);
         });
         if (result.IsSuccess)
         {
             return(result.Data);
         }
         else
         {
             throw new Exception("执行错误,发生位置 Sign " + result.ErrorMessage);
         }
     }
 }
Пример #4
0
        public AcreEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            SAV = sav;

            Acres = new[]
            {
                NUD_00, NUD_01, NUD_02, NUD_03, NUD_04, NUD_05, NUD_06, NUD_07, NUD_08,
                NUD_09, NUD_0A, NUD_0B, NUD_0C, NUD_0D, NUD_0E, NUD_0F, NUD_10, NUD_11,
                NUD_12, NUD_13, NUD_14, NUD_15, NUD_16, NUD_17, NUD_18, NUD_19, NUD_1A,
                NUD_1B, NUD_1C, NUD_1D, NUD_1E, NUD_1F, NUD_20, NUD_21, NUD_22, NUD_23,
                NUD_24, NUD_25, NUD_26, NUD_27, NUD_28, NUD_29, NUD_2A, NUD_2B, NUD_2C,
                NUD_2D, NUD_2E, NUD_2F, NUD_30, NUD_31, NUD_32, NUD_33, NUD_34, NUD_35,
                NUD_36, NUD_37, NUD_38, NUD_39, NUD_3A, NUD_3B, NUD_3C, NUD_3D, NUD_3E,
                NUD_3F, NUD_40, NUD_41, NUD_42, NUD_43, NUD_44, NUD_45, NUD_46, NUD_47,
            };

            LoadAcres();

            LoadHintComboBox();
            for (var i = 0; i < Acres.Length; i++)
            {
                var a = Acres[i];
                var x = i % MainSave.AcreWidth;
                var y = i / MainSave.AcreWidth;
                a.MouseEnter   += (sender, args) => UpdateAcre((ushort)a.Value, x, y);
                a.ValueChanged += (sender, args) => UpdateAcre((ushort)a.Value, x, y);
            }
        }
Пример #5
0
        public FieldItemEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV  = sav;
            Map  = new MapManager(sav);
            View = new MapViewer(Map);

            Loading = true;
            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
            NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;

            foreach (var obj in Map.Buildings)
            {
                LB_Items.Items.Add(obj.ToString());
            }

            ReloadMapBackground();
            PG_Tile.SelectedObject        = new FieldItem();
            PG_TerrainTile.SelectedObject = new TerrainTile();
            LB_Items.SelectedIndex        = 0;
            CB_Acre.SelectedIndex         = 0;
            Loading = false;
            LoadItemGridAcre();
        }
Пример #6
0
        public FieldItemEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV   = sav;
            Items = new FieldItemManager(SAV.GetFieldItems());

            var l1 = Items.Layer1;

            Scale1    = new int[l1.GridWidth * l1.GridHeight];
            ScaleX    = new int[Scale1.Length * AcreScale * AcreScale];
            ScaleAcre = new Bitmap(l1.GridWidth * AcreScale, l1.GridHeight * AcreScale);

            Map        = new int[l1.MapWidth * l1.MapHeight * MapScale * MapScale];
            MapReticle = new Bitmap(l1.MapWidth * MapScale, l1.MapHeight * MapScale);

            Terrain = new TerrainManager(sav.GetTerrain());
            PB_Map.BackgroundImage = TerrainSprite.CreateMap(Terrain, 2);

            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            PG_Tile.SelectedObject = new FieldItem();
            CB_Acre.SelectedIndex  = 0;
            LoadGrid(X, Y);
        }
Пример #7
0
        public BuildingEditor(IReadOnlyList <Building> buildings, MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            SAV       = sav;
            Buildings = buildings;
            Terrain   = new TerrainManager(sav.GetTerrain());

            NUD_PlazaX.Value = sav.PlazaX;
            NUD_PlazaY.Value = sav.PlazaY;

            foreach (var obj in buildings)
            {
                LB_Items.Items.Add(obj.ToString());
            }

            LB_Items.SelectedIndex = 0;
            foreach (var entry in HelpDictionary)
            {
                CB_StructureType.Items.Add(entry.Key);
            }
            CB_StructureType.SelectedIndex = 0;

            DialogResult = DialogResult.Cancel;
        }
Пример #8
0
        private void LoadBuildings(MainSave sav)
        {
            NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
            NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;

            foreach (var obj in Map.Buildings)
                LB_Items.Items.Add(obj.ToString());
        }
Пример #9
0
        public MapEditorForm(MainSave save)
        {
            InitializeComponent();
            this.save       = save;
            this.mapManager = new MapManager(save);
            mapView.Map     = this.mapManager;

            toolButtons = new[] { tsbMarquee, tsbMove, tsbPan };
        }
Пример #10
0
        public VillagerEditor(IVillager[] villagers, IVillagerOrigin origin, MainSave sav, bool hasHouses)
        {
            InitializeComponent();
            Villagers = villagers;
            Origin    = origin;
            SAV       = sav;
            LoadVillagers();

            B_EditHouses.Visible = hasHouses;
        }
Пример #11
0
        public VillagerEditor(Villager[] villagers, IVillagerOrigin origin, MainSave sav, bool hasHouses)
        {
            Villagers = villagers;
            Origin    = origin;
            SAV       = sav;
            InitializeComponent();
            LoadVillagers();

            if (!hasHouses)
            {
                B_DumpHouse.Visible = B_LoadHouse.Visible = false;
            }
        }
Пример #12
0
        public TerrainEditor(MainSave sav)
        {
            SAV = sav;
            InitializeComponent();

            Terrain = new TerrainManager(SAV.Terrain);
            Grid    = GenerateGrid(TerrainManager.GridWidth, TerrainManager.GridHeight);

            foreach (var acre in Terrain.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            PG_Tile.SelectedObject = new TerrainTile();
            CB_Acre.SelectedIndex  = 0;
            ReloadMap();
        }
Пример #13
0
        public TerrainEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV     = sav;
            Terrain = new TerrainManager(SAV.GetTerrain());
            Grid    = GenerateGrid(GridWidth, GridHeight);

            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            PG_Tile.SelectedObject = new TerrainTile();
            CB_Acre.SelectedIndex  = 0;
            ReloadMap();
        }
Пример #14
0
        public FieldItemEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV  = sav;
            Map  = new MapManager(sav);
            View = new MapViewer(Map);

            Loading = true;

            LoadComboBoxes();
            LoadBuildings(sav);
            ReloadMapBackground();
            LoadEditors();
            LB_Items.SelectedIndex   = 0;
            CB_Acre.SelectedIndex    = 0;
            CB_MapAcre.SelectedIndex = 0;
            Loading = false;
            LoadItemGridAcre();
        }
Пример #15
0
        public TerrainEditor(MainSave sav)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);

            SAV     = sav;
            Terrain = new TerrainManager(SAV.GetTerrainTiles());
            Grid    = GenerateGrid(GridWidth, GridHeight);

            foreach (var acre in MapGrid.Acres)
            {
                CB_Acre.Items.Add(acre.Name);
            }

            Scale1 = new int[Terrain.MapWidth * Terrain.MapHeight];
            ScaleX = new int[Scale1.Length * MapScale * MapScale];
            Map    = new Bitmap(Terrain.MapWidth * MapScale, Terrain.MapHeight * MapScale);

            PG_Tile.SelectedObject = new TerrainTile();
            CB_Acre.SelectedIndex  = 0;
            ReloadMap();
        }
Пример #16
0
        public VillagerHouseEditor(VillagerHouse[] houses, IReadOnlyList <Villager> villagers, MainSave sav, int index)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            SAV          = sav;
            Houses       = houses;
            Villagers    = villagers;
            DialogResult = DialogResult.Cancel;

            foreach (var obj in Houses)
            {
                LB_Items.Items.Add(GetHouseSummary(obj));
            }

            var hIndex = Array.FindIndex(houses, z => z.NPC1 == index);

            if (hIndex < 0)
            {
                hIndex = 0;
            }
            LB_Items.SelectedIndex = hIndex;
        }
Пример #17
0
        public bool OpenSaveFromFolder(string saveDirectory, out MainSave mainSave)
        {
            mainSave = null;
            var result            = false;
            var mainDatPath       = Path.Combine(saveDirectory, MainDat);
            var mainHeaderDatPath = Path.Combine(saveDirectory, MainHeaderDat);

            if (!File.Exists(mainDatPath))
            {
                MessageBox.Show($"{mainDatPath} doesn't exist!", "Failed to open save file", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!File.Exists(mainHeaderDatPath))
            {
                MessageBox.Show($"{mainHeaderDatPath} doesn't exist!", "Failed to open save file header", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    var mainSaveFile = new HorizonSave(saveDirectory);
                    if (mainSaveFile.ValidateSizes())
                    {
                        result   = true;
                        mainSave = mainSaveFile.Main;
                    }
                    else
                    {
                        MessageBox.Show("Save file sizes appear to be incorrect.", "Version doesn't match", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                    MessageBox.Show(e.Message, "Failed to load save file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            return(result);
        }
Пример #18
0
        public PlayerHouseEditor(IPlayerHouse[] houses, IReadOnlyList <Player> players, MainSave sav, int index)
        {
            InitializeComponent();
            this.TranslateInterface(GameInfo.CurrentLanguage);
            SAV     = sav;
            Houses  = houses;
            Players = players;
            Manager = new RoomItemManager(houses[0].GetRoom(0));

            var data = GameInfo.Strings.ItemDataSource;

            ItemEdit.Initialize(data, true);

            DialogResult = DialogResult.Cancel;

            for (var i = 0; i < Houses.Length; i++)
            {
                var obj = Houses[i];
                LB_Items.Items.Add(GetHouseSummary(players, obj, i));
            }

            LB_Items.SelectedIndex = index;
        }
Пример #19
0
        private void Btn_UnlockAll_Click(object sender, EventArgs e)
        {
            byte[] emblem180 = new byte[12] {
                0x31, 0x38, 0x30, 0x20, 0x45, 0x6D, 0x62, 0x6C, 0x65, 0x6D, 0x73, 0x00
            };

            for (int i = 0; i < emblem180.Length; i++)
            {
                Main.WriteByte(0x27 + i, emblem180[i], mainIndex);
            }
            Main.WriteByte((int)offsets.main.EmblemCount, 0xB4, mainIndex);

            Main.WriteByte((int)offsets.main.AllASonic, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllAShadow, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllATails, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllAEggman, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllAKnuckles, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllARouge, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.AllACannonsCore, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.HeroStoryComplete, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.DarkStoryComplete, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.LastStoryComplete, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.BossAttackHero, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.BossAttackDark, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.BossAttackAll, 0x01, mainIndex);

            Main.WriteByte((int)offsets.main.GreenHill, 0x01, mainIndex);

            Main.WriteByte((int)offsets.main.KartSonic, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.KartTails, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.KartKnuckles, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.KartShadow, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.KartEggman, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.KartRouge, 0x01, mainIndex);

            foreach (KeyValuePair <string, uint> keyValuePair in MainSave.offsets.main.MissionOffsets)
            {
                Main.WriteByte((int)keyValuePair.Value, 0x05, mainIndex);
                Main.WriteByte((int)keyValuePair.Value + 0x01, 0x05, mainIndex);
                Main.WriteByte((int)keyValuePair.Value + 0x02, 0x05, mainIndex);
                Main.WriteByte((int)keyValuePair.Value + 0x03, 0x05, mainIndex);
                Main.WriteByte((int)keyValuePair.Value + 0x04, 0x05, mainIndex);
            }
            foreach (KeyValuePair <string, uint> keyValuePair in MainSave.offsets.main.KartOffsets)
            {
                Main.WriteByte((int)(keyValuePair.Value + offsets.kart.Emblem), 0x01, mainIndex);
            }
            foreach (KeyValuePair <string, KeyValuePair <uint, uint> > keyValuePair in MainSave.offsets.main.BossOffsets)
            {
                Main.WriteByte((int)(keyValuePair.Value.Key + offsets.boss.Emblem), 0x01, mainIndex);
            }

            Main.WriteByte((int)offsets.main.ChaoKarateBeginner, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoKarateStandard, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoKarateExpert, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoKarateSuper, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoRaceBeginner, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoRaceJewel, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoRaceChallenge, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoRaceHero, 0x01, mainIndex);
            Main.WriteByte((int)offsets.main.ChaoRaceDark, 0x01, mainIndex);

            Main.tc_Main.TabPages.Clear();
            MainSave.activeMain.Clear();
            MainSave.GetMain();
        }