public static void Startup() { SFML.Portable.Activate(); SetStatus(Strings.Get("loadscreen", "loading")); FrmMenu.Default.Visible = true; Application.DoEvents(); C_Types.CharSelection = new C_Types.CharSelRec[4]; C_Types.Player = new C_Types.PlayerRec[Constants.MAX_PLAYERS + 1]; for (var i = 1; i <= Constants.MAX_PLAYERS; i++) { C_Player.ClearPlayer(i); } C_AutoTiles.ClearAutotiles(); //Housing C_Housing.House = new C_Housing.HouseRec[C_Housing.MaxHouses + 1]; C_Housing.HouseConfig = new C_Housing.HouseRec[C_Housing.MaxHouses + 1]; //quests C_Quest.ClearQuests(); //npc's C_DataBase.ClearNpcs(); C_Maps.Map.Npc = new int[Constants.MAX_MAP_NPCS + 1]; C_Maps.MapNpc = new C_Types.MapNpcRec[Constants.MAX_MAP_NPCS + 1]; for (var i = 0; i <= Constants.MAX_MAP_NPCS; i++) { for (var x = 0; x <= (int)Enums.VitalType.Count - 1; x++) { C_Maps.MapNpc[(int)i].Vital = new int[(int)x + 1]; } } C_Shops.ClearShops(); C_DataBase.ClearAnimations(); C_DataBase.ClearAnimInstances(); C_Banks.ClearBank(); C_Projectiles.MapProjectiles = new C_Projectiles.MapProjectileRec[C_Projectiles.MaxProjectiles + 1]; C_Projectiles.Projectiles = new C_Projectiles.ProjectileRec[C_Projectiles.MaxProjectiles + 1]; C_Items.ClearItems(); //craft C_Crafting.ClearRecipes(); //party C_Parties.ClearParty(); //pets C_Pets.ClearPets(); C_Variables.GettingMap = true; C_Variables.VbQuote = System.Convert.ToString((char)34); // " // Update the form with the game's name before it's loaded FrmGame.Default.Text = C_Constants.GameName; SetStatus(Strings.Get("loadscreen", "options")); // load options if (File.Exists(Application.StartupPath + "\\Data\\Config.xml")) { C_DataBase.LoadOptions(); } else { C_DataBase.CreateOptions(); } // randomize rnd's seed VBMath.Randomize(); SetStatus(Strings.Get("loadscreen", "network")); FrmMenu.Default.Text = C_Constants.GameName; // DX7 Master Object is already created, early binding SetStatus(Strings.Get("loadscreen", "graphics")); C_Maps.CheckTilesets(); C_DataBase.CheckCharacters(); C_DataBase.CheckPaperdolls(); C_DataBase.CheckAnimations(); C_Items.CheckItems(); C_Resources.CheckResources(); C_DataBase.CheckSkillIcons(); C_DataBase.CheckFaces(); C_DataBase.CheckFog(); C_DataBase.CacheMusic(); C_DataBase.CacheSound(); C_DataBase.CheckEmotes(); C_DataBase.CheckPanoramas(); C_Housing.CheckFurniture(); C_Projectiles.CheckProjectiles(); C_DataBase.CheckParallax(); C_Graphics.InitGraphics(); // check if we have main-menu music if (C_Types.Options.Music == 1 && C_Types.Options.MenuMusic.Trim().Length > 0) { C_Sound.PlayMusic(C_Types.Options.MenuMusic.Trim()); C_Sound.MusicPlayer.Volume = 100; } // Reset values C_Variables.Ping = -1; // set values for directional blocking arrows C_Variables.DirArrowX[1] = 12; // up C_Variables.DirArrowY[1] = 0; C_Variables.DirArrowX[2] = 12; // down C_Variables.DirArrowY[2] = 23; C_Variables.DirArrowX[3] = 0; // left C_Variables.DirArrowY[3] = 12; C_Variables.DirArrowX[4] = 23; // right C_Variables.DirArrowY[4] = 12; //set gui switches C_UpdateUI.HudVisible = true; SetStatus(Strings.Get("loadscreen", "starting")); Started = true; C_UpdateUI.Frmmenuvisible = true; C_UpdateUI.Pnlloadvisible = false; //C_UpdateUI.PnlInventoryVisible = true; C_NetworkConfig.InitNetwork(); C_GameLogic.GameLoop(); }
public void Picscreen_MouseDown(object sender, MouseEventArgs e) { if (!C_GuiFunctions.CheckGuiClick(e.X, e.Y, e)) { if (C_Constants.InMapEditor) { FrmEditor_MapEditor.Default.MapEditorMouseDown((System.Int32)e.Button, e.X, e.Y, false); } // left click if (e.Button == MouseButtons.Left) { // if we're in the middle of choose the trade target or not if (!C_Trade.TradeRequest) { if (C_Pets.PetAlive(C_Variables.Myindex)) { if (C_GameLogic.IsInBounds()) { C_Pets.PetMove(C_Variables.CurX, C_Variables.CurY); } } // targetting C_NetworkSend.PlayerSearch(C_Variables.CurX, C_Variables.CurY, (byte)0); } else { // trading C_Trade.SendTradeRequest(C_Types.Player[C_Variables.MyTarget].Name); } C_UpdateUI.PnlRClickVisible = false; C_Pets.ShowPetStats = false; // right click } else if (e.Button == MouseButtons.Right) { if (C_Variables.ShiftDown || C_UpdateUI.VbKeyShift == true) { // admin warp if we're pressing shift and right clicking if (C_Player.GetPlayerAccess(C_Variables.Myindex) >= 2) { C_NetworkSend.AdminWarp(C_Variables.CurX, C_Variables.CurY); } } else { // rightclick menu if (C_Pets.PetAlive(C_Variables.Myindex)) { if (C_GameLogic.IsInBounds() && C_Variables.CurX == C_Types.Player[C_Variables.Myindex].Pet.X & C_Variables.CurY == C_Types.Player[C_Variables.Myindex].Pet.Y) { C_Pets.ShowPetStats = true; } } else { C_NetworkSend.PlayerSearch(C_Variables.CurX, C_Variables.CurY, (byte)1); } } C_Housing.FurnitureSelected = 0; } } C_GuiFunctions.CheckGuiMouseDown(e.X, e.Y, e); if (!FrmAdmin.Default.Visible || !FrmOptions.Default.Visible) { Focus(); } }